From 51bb6ac0e9f2b03acdbce7b28f9132060f2f6392 Mon Sep 17 00:00:00 2001 From: nhauge Date: Wed, 9 Feb 2011 14:56:57 +0000 Subject: This commit was manufactured by cvs2svn to create tag 'v201102090000'. --- .../org.eclipse.jpt.assembly.feature/.cvsignore | 2 - .../org.eclipse.jpt.assembly.feature/.project | 17 - .../build.properties | 0 .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../org.eclipse.jpt.assembly.feature/epl-v10.html | 328 - .../feature.properties | 144 - .../org.eclipse.jpt.assembly.feature/feature.xml | 46 - .../org.eclipse.jpt.assembly.feature/license.html | 93 - assembly/features/org.eclipse.jpt.patch/.project | 17 - .../org.eclipse.jpt.patch/build.properties | 10 - .../buildnotes_org.eclipse.jpt.patch.html | 20 - .../org.eclipse.jpt.patch/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../features/org.eclipse.jpt.patch/epl-v10.html | 328 - .../org.eclipse.jpt.patch/feature.properties | 143 - .../features/org.eclipse.jpt.patch/feature.xml | 35 - .../features/org.eclipse.jpt.patch/license.html | 93 - assembly/features/org.eclipse.jpt.sdk/.cvsignore | 4 - assembly/features/org.eclipse.jpt.sdk/.project | 17 - .../features/org.eclipse.jpt.sdk/build.properties | 15 - .../org.eclipse.jpt.sdk/eclipse_update_120.jpg | Bin 21695 -> 0 bytes assembly/features/org.eclipse.jpt.sdk/epl-v10.html | 328 - .../org.eclipse.jpt.sdk/feature.properties | 170 - assembly/features/org.eclipse.jpt.sdk/feature.xml | 42 - assembly/features/org.eclipse.jpt.sdk/license.html | 107 - .../.cvsignore | 3 - .../.project | 17 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../build.properties | 0 .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../epl-v10.html | 328 - .../feature.properties | 145 - .../feature.xml | 32 - .../license.html | 98 - assembly/features/org.eclipse.jpt.tests/.cvsignore | 3 - assembly/features/org.eclipse.jpt.tests/.project | 17 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../org.eclipse.jpt.tests/build.properties | 5 - .../org.eclipse.jpt.tests/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../features/org.eclipse.jpt.tests/epl-v10.html | 328 - .../org.eclipse.jpt.tests/feature.properties | 170 - .../features/org.eclipse.jpt.tests/feature.xml | 28 - .../features/org.eclipse.jpt.tests/license.html | 107 - assembly/features/org.eclipse.jpt/.cvsignore | 2 - assembly/features/org.eclipse.jpt/.project | 17 - assembly/features/org.eclipse.jpt/build.properties | 16 - .../org.eclipse.jpt/eclipse_update_120.jpg | Bin 21695 -> 0 bytes assembly/features/org.eclipse.jpt/epl-v10.html | 328 - .../features/org.eclipse.jpt/feature.properties | 170 - assembly/features/org.eclipse.jpt/feature.xml | 42 - assembly/features/org.eclipse.jpt/license.html | 107 - .../.cvsignore | 4 - .../org.eclipse.jpt_sdk.assembly.feature/.project | 17 - .../build.properties | 0 .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../epl-v10.html | 328 - .../feature.properties | 145 - .../feature.xml | 46 - .../license.html | 98 - assembly/plugins/org.eclipse.jpt/.cvsignore | 2 - assembly/plugins/org.eclipse.jpt/.project | 22 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../plugins/org.eclipse.jpt/META-INF/MANIFEST.MF | 7 - assembly/plugins/org.eclipse.jpt/about.html | 34 - assembly/plugins/org.eclipse.jpt/about.ini | 44 - assembly/plugins/org.eclipse.jpt/about.mappings | 6 - assembly/plugins/org.eclipse.jpt/about.properties | 24 - assembly/plugins/org.eclipse.jpt/build.properties | 19 - assembly/plugins/org.eclipse.jpt/component.xml | 12 - assembly/plugins/org.eclipse.jpt/eclipse32.gif | Bin 1706 -> 0 bytes assembly/plugins/org.eclipse.jpt/eclipse32.png | Bin 4594 -> 0 bytes assembly/plugins/org.eclipse.jpt/plugin.properties | 13 - .../plugins/org.eclipse.jpt.common.core/.classpath | 13 - .../plugins/org.eclipse.jpt.common.core/.project | 28 - .../.settings/org.eclipse.jdt.core.prefs | 8 - .../META-INF/MANIFEST.MF | 63 - .../plugins/org.eclipse.jpt.common.core/about.html | 34 - .../org.eclipse.jpt.common.core/build.properties | 21 - .../org.eclipse.jpt.common.core/plugin.properties | 31 - .../plugins/org.eclipse.jpt.common.core/plugin.xml | 156 - .../property_files/jpt_common_core.properties | 23 - .../schema/libraryValidators.exsd | 154 - .../schema/resourceLocators.exsd | 191 - .../org/eclipse/jpt/common/core/IResourcePart.java | 34 - .../jpt/common/core/JptCommonCorePlugin.java | 167 - .../eclipse/jpt/common/core/JptResourceModel.java | 44 - .../jpt/common/core/JptResourceModelListener.java | 34 - .../eclipse/jpt/common/core/JptResourceType.java | 99 - .../core/internal/JptCommonCoreMessages.java | 45 - .../core/internal/ResourceAdapterFactory.java | 49 - .../jpt/common/core/internal/XPointUtil.java | 143 - .../core/internal/gen/AbstractJptGenerator.java | 369 - ...ndlesLibraryProviderInstallOperationConfig.java | 45 - ...tUserLibraryProviderInstallOperationConfig.java | 45 - .../libprov/LibraryProviderPropertyTester.java | 41 - .../common/core/internal/libval/LibValUtil.java | 92 - .../internal/libval/LibraryValidatorConfig.java | 97 - .../internal/libval/LibraryValidatorManager.java | 149 - .../AbstractJptFileCreationDataModelProvider.java | 137 - .../JptFileCreationDataModelProperties.java | 33 - .../internal/resource/ModuleResourceLocator.java | 79 - .../internal/resource/PluginResourceLocator.java | 93 - .../internal/resource/ResourceLocatorConfig.java | 168 - .../internal/resource/ResourceLocatorManager.java | 167 - .../resource/SimpleJavaResourceLocator.java | 152 - .../resource/WebModuleResourceLocator.java | 54 - .../internal/utility/CallbackJobSynchronizer.java | 154 - .../common/core/internal/utility/JobCommand.java | 96 - .../core/internal/utility/JobSynchronizer.java | 198 - .../core/internal/utility/PlatformTools.java | 96 - .../internal/utility/SimpleSchedulingRule.java | 38 - .../core/internal/utility/SimpleTextRange.java | 41 - .../internal/utility/jdt/ASTNodeTextRange.java | 39 - .../common/core/internal/utility/jdt/ASTTools.java | 250 - .../utility/jdt/AbstractAnnotationAdapter.java | 165 - .../jdt/AbstractDeclarationAnnotationAdapter.java | 153 - .../utility/jdt/AbstractExpressionConverter.java | 82 - .../core/internal/utility/jdt/AbstractJDTType.java | 198 - ...AbstractNestedDeclarationAnnotationAdapter.java | 403 - .../AnnotatedElementAnnotationElementAdapter.java | 99 - .../AnnotationStringArrayExpressionConverter.java | 107 - .../utility/jdt/BooleanExpressionConverter.java | 51 - .../jdt/CharacterStringExpressionConverter.java | 53 - ...inationIndexedDeclarationAnnotationAdapter.java | 500 - ...versionDeclarationAnnotationElementAdapter.java | 154 - .../jdt/DefaultAnnotationEditFormatter.java | 219 - .../utility/jdt/ElementAnnotationAdapter.java | 27 - .../jdt/ElementIndexedAnnotationAdapter.java | 74 - ...umArrayDeclarationAnnotationElementAdapter.java | 150 - .../EnumDeclarationAnnotationElementAdapter.java | 119 - ...ressionDeclarationAnnotationElementAdapter.java | 327 - .../core/internal/utility/jdt/GenericVisitor.java | 791 -- .../internal/utility/jdt/JDTAnnotatedElement.java | 201 - .../common/core/internal/utility/jdt/JDTEnum.java | 132 - .../core/internal/utility/jdt/JDTEnumConstant.java | 121 - .../internal/utility/jdt/JDTFieldAttribute.java | 216 - .../core/internal/utility/jdt/JDTMember.java | 90 - .../internal/utility/jdt/JDTMethodAttribute.java | 263 - .../utility/jdt/JDTModifiedDeclaration.java | 584 - .../core/internal/utility/jdt/JDTPackage.java | 65 - .../common/core/internal/utility/jdt/JDTTools.java | 236 - .../common/core/internal/utility/jdt/JDTType.java | 207 - .../common/core/internal/utility/jdt/JPTTools.java | 283 - .../utility/jdt/NameStringExpressionConverter.java | 57 - .../jdt/NestedDeclarationAnnotationAdapter.java | 90 - .../NestedIndexedDeclarationAnnotationAdapter.java | 325 - .../utility/jdt/NullAnnotationEditFormatter.java | 42 - .../jdt/NullDeclarationAnnotationAdapter.java | 82 - .../NullDeclarationAnnotationElementAdapter.java | 60 - .../utility/jdt/NullExpressionConverter.java | 54 - .../jdt/NumberIntegerExpressionConverter.java | 51 - .../PrimitiveTypeStringExpressionConverter.java | 61 - .../jdt/ShortCircuitAnnotationElementAdapter.java | 104 - .../ShortCircuitArrayAnnotationElementAdapter.java | 43 - .../jdt/SimpleDeclarationAnnotationAdapter.java | 62 - .../jdt/SimpleTypeStringExpressionConverter.java | 63 - .../jdt/StringArrayExpressionConverter.java | 104 - .../utility/jdt/StringExpressionConverter.java | 52 - .../utility/jdt/TypeStringExpressionConverter.java | 55 - .../utility/translators/BooleanTranslator.java | 36 - .../translators/EmptyTagBooleanTranslator.java | 53 - .../translators/EnumeratedValueTranslator.java | 45 - .../utility/translators/SimpleRootTranslator.java | 92 - .../utility/translators/SimpleTranslator.java | 135 - .../JptLibraryProviderInstallOperationConfig.java | 34 - .../jpt/common/core/libval/LibraryValidator.java | 31 - .../jpt/common/core/resource/ResourceLocator.java | 50 - .../jpt/common/core/utility/AbstractTextRange.java | 71 - .../jpt/common/core/utility/BodySourceWriter.java | 303 - .../eclipse/jpt/common/core/utility/TextRange.java | 119 - .../jpt/common/core/utility/jdt/AbstractType.java | 38 - .../common/core/utility/jdt/AnnotatedElement.java | 82 - .../common/core/utility/jdt/AnnotatedPackage.java | 40 - .../common/core/utility/jdt/AnnotationAdapter.java | 63 - .../core/utility/jdt/AnnotationEditFormatter.java | 34 - .../core/utility/jdt/AnnotationElementAdapter.java | 68 - .../jpt/common/core/utility/jdt/Attribute.java | 46 - .../utility/jdt/DeclarationAnnotationAdapter.java | 72 - .../jdt/DeclarationAnnotationElementAdapter.java | 63 - .../eclipse/jpt/common/core/utility/jdt/Enum.java | 39 - .../jpt/common/core/utility/jdt/EnumConstant.java | 41 - .../core/utility/jdt/ExpressionConverter.java | 44 - .../common/core/utility/jdt/FieldAttribute.java | 39 - .../core/utility/jdt/IndexedAnnotationAdapter.java | 37 - .../jdt/IndexedDeclarationAnnotationAdapter.java | 37 - .../jpt/common/core/utility/jdt/Member.java | 39 - .../common/core/utility/jdt/MethodAttribute.java | 45 - .../core/utility/jdt/ModifiedDeclaration.java | 105 - .../eclipse/jpt/common/core/utility/jdt/Type.java | 56 - .../plugins/org.eclipse.jpt.common.ui/.classpath | 13 - common/plugins/org.eclipse.jpt.common.ui/.project | 28 - .../.settings/org.eclipse.jdt.core.prefs | 8 - .../org.eclipse.jpt.common.ui/META-INF/MANIFEST.MF | 36 - .../plugins/org.eclipse.jpt.common.ui/about.html | 34 - .../org.eclipse.jpt.common.ui/build.properties | 19 - .../org.eclipse.jpt.common.ui/plugin.properties | 23 - .../property_files/jpt_common_ui.properties | 28 - .../eclipse/jpt/common/ui/JptCommonUiPlugin.java | 65 - .../org/eclipse/jpt/common/ui/WidgetFactory.java | 240 - .../common/ui/internal/JptCommonUiMessages.java | 53 - .../eclipse/jpt/common/ui/internal/Tracing.java | 161 - .../internal/jface/AbstractItemLabelProvider.java | 224 - .../jface/AbstractTreeItemContentProvider.java | 204 - .../ui/internal/jface/ArchiveFileViewerFilter.java | 71 - .../DelegatingTreeContentAndLabelProvider.java | 58 - .../ui/internal/jface/ImageImageDescriptor.java | 47 - .../ui/internal/jface/NullLabelProvider.java | 60 - .../ui/internal/jface/NullTreeContentProvider.java | 60 - .../jface/StructuredContentProviderAdapter.java | 265 - .../SWTCollectionChangeListenerWrapper.java | 151 - .../listeners/SWTListChangeListenerWrapper.java | 201 - .../SWTPropertyChangeListenerWrapper.java | 82 - .../listeners/SWTStateChangeListenerWrapper.java | 79 - .../listeners/SWTTreeChangeListenerWrapper.java | 151 - .../properties/JptProjectPropertiesPage.java | 432 - .../ui/internal/swt/AbstractComboModelAdapter.java | 699 -- .../jpt/common/ui/internal/swt/ColumnAdapter.java | 55 - .../common/ui/internal/swt/ComboModelAdapter.java | 210 - .../ui/internal/swt/DateTimeModelAdapter.java | 352 - .../ui/internal/swt/SpinnerModelAdapter.java | 214 - .../ui/internal/swt/TableItemModelAdapter.java | 209 - .../common/ui/internal/swt/TableModelAdapter.java | 746 -- .../internal/swt/TriStateCheckBoxModelAdapter.java | 188 - .../common/ui/internal/util/ControlAligner.java | 913 -- .../common/ui/internal/util/ControlSwitcher.java | 130 - .../jpt/common/ui/internal/util/LabeledButton.java | 64 - .../common/ui/internal/util/LabeledControl.java | 37 - .../ui/internal/util/LabeledControlUpdater.java | 130 - .../jpt/common/ui/internal/util/LabeledLabel.java | 64 - .../jpt/common/ui/internal/util/PaneEnabler.java | 175 - .../ui/internal/util/PaneVisibilityEnabler.java | 173 - .../jpt/common/ui/internal/util/SWTUtil.java | 447 - .../common/ui/internal/util/StateController.java | 320 - .../ui/internal/util/TableLayoutComposite.java | 207 - .../utility/AsynchronousUiCommandExecutor.java | 49 - .../utility/SynchronousUiCommandExecutor.java | 49 - .../utility/swt/AbstractListWidgetAdapter.java | 42 - .../utility/swt/BooleanButtonModelBinding.java | 190 - .../utility/swt/BooleanStateController.java | 188 - .../swt/DropDownListBoxSelectionBinding.java | 283 - .../utility/swt/ListBoxSelectionBinding.java | 305 - .../utility/swt/ListWidgetModelBinding.java | 428 - .../swt/MultiControlBooleanStateController.java | 157 - .../ui/internal/utility/swt/SWTComboAdapter.java | 67 - .../ui/internal/utility/swt/SWTListAdapter.java | 49 - .../common/ui/internal/utility/swt/SWTTools.java | 392 - .../utility/swt/SimpleBooleanStateController.java | 68 - .../utility/swt/TextFieldModelBinding.java | 196 - .../ui/internal/widgets/AddRemoveListPane.java | 554 - .../common/ui/internal/widgets/AddRemovePane.java | 923 -- .../ui/internal/widgets/AddRemoveTablePane.java | 314 - .../common/ui/internal/widgets/ChooserPane.java | 167 - .../ui/internal/widgets/ClassChooserComboPane.java | 92 - .../ui/internal/widgets/ClassChooserPane.java | 368 - .../jpt/common/ui/internal/widgets/ComboPane.java | 289 - .../ui/internal/widgets/DefaultWidgetFactory.java | 260 - .../jpt/common/ui/internal/widgets/Dialog.java | 350 - .../jpt/common/ui/internal/widgets/DialogPane.java | 109 - .../ui/internal/widgets/EnumComboViewer.java | 369 - .../ui/internal/widgets/EnumDialogComboViewer.java | 77 - .../ui/internal/widgets/EnumFormComboViewer.java | 77 - .../ui/internal/widgets/FileChooserComboPane.java | 105 - .../ui/internal/widgets/FileChooserPane.java | 167 - .../internal/widgets/FolderChooserComboPane.java | 106 - .../ui/internal/widgets/FolderChooserPane.java | 140 - .../ui/internal/widgets/FormWidgetFactory.java | 338 - .../common/ui/internal/widgets/IntegerCombo.java | 188 - .../common/ui/internal/widgets/NewNameDialog.java | 166 - .../ui/internal/widgets/NewNameDialogBuilder.java | 179 - .../ui/internal/widgets/NewNameStateObject.java | 146 - .../ui/internal/widgets/NullPostExecution.java | 56 - .../ui/internal/widgets/PackageChooserPane.java | 237 - .../jpt/common/ui/internal/widgets/Pane.java | 3722 ------ .../common/ui/internal/widgets/PostExecution.java | 31 - .../widgets/PropertySheetWidgetFactory.java | 61 - .../ui/internal/widgets/TriStateCheckBox.java | 287 - .../ui/internal/widgets/ValidatingDialog.java | 233 - .../jface/DelegatingContentAndLabelProvider.java | 207 - .../jpt/common/ui/jface/ItemContentProvider.java | 36 - .../ui/jface/ItemContentProviderFactory.java | 26 - .../jpt/common/ui/jface/ItemLabelProvider.java | 47 - .../common/ui/jface/ItemLabelProviderFactory.java | 26 - .../common/ui/jface/TreeItemContentProvider.java | 40 - .../ui/jface/TreeItemContentProviderFactory.java | 26 - .../org.eclipse.jpt.common.utility/.classpath | 7 - .../org.eclipse.jpt.common.utility/.cvsignore | 4 - .../org.eclipse.jpt.common.utility/.project | 28 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../META-INF/MANIFEST.MF | 134 - .../org.eclipse.jpt.common.utility/about.html | 34 - .../build.properties | 17 - .../org.eclipse.jpt.common.utility/component.xml | 11 - .../plugin.properties | 24 - .../org/eclipse/jpt/common/utility/Command.java | 87 - .../jpt/common/utility/CommandExecutor.java | 61 - .../src/org/eclipse/jpt/common/utility/Filter.java | 125 - .../jpt/common/utility/IndentingPrintWriter.java | 155 - .../org/eclipse/jpt/common/utility/JavaType.java | 135 - .../jpt/common/utility/MethodSignature.java | 73 - .../jpt/common/utility/ObjectReference.java | 29 - .../common/utility/ReadOnlyObjectReference.java | 43 - .../utility/internal/AbstractAssociation.java | 69 - .../jpt/common/utility/internal/ArrayTools.java | 3122 ----- .../jpt/common/utility/internal/Association.java | 46 - .../internal/AsynchronousCommandExecutor.java | 168 - .../eclipse/jpt/common/utility/internal/Bag.java | 197 - .../jpt/common/utility/internal/BidiFilter.java | 122 - .../utility/internal/BidiStringConverter.java | 149 - .../common/utility/internal/BidiTransformer.java | 93 - .../jpt/common/utility/internal/BitTools.java | 214 - .../common/utility/internal/BooleanReference.java | 48 - .../jpt/common/utility/internal/BooleanTools.java | 105 - .../jpt/common/utility/internal/ClassName.java | 431 - .../jpt/common/utility/internal/Classpath.java | 939 -- .../common/utility/internal/CollectionTools.java | 1957 --- .../common/utility/internal/CommandRunnable.java | 37 - .../common/utility/internal/CompositeCommand.java | 44 - .../utility/internal/CompositeException.java | 96 - .../internal/ConsumerThreadCoordinator.java | 253 - .../common/utility/internal/ExceptionHandler.java | 87 - .../jpt/common/utility/internal/FileTools.java | 1002 -- .../utility/internal/FlaggedObjectReference.java | 69 - .../jpt/common/utility/internal/HashBag.java | 877 -- .../common/utility/internal/IdentityHashBag.java | 924 -- .../jpt/common/utility/internal/IntReference.java | 40 - .../jpt/common/utility/internal/JDBCTools.java | 349 - .../jpt/common/utility/internal/JDBCType.java | 162 - .../jpt/common/utility/internal/KeyedSet.java | 129 - .../internal/LazyReadOnlyObjectReference.java | 107 - .../jpt/common/utility/internal/ListenerList.java | 171 - .../jpt/common/utility/internal/NameTools.java | 376 - .../internal/NonNullBooleanTransformer.java | 79 - .../utility/internal/NotBooleanTransformer.java | 56 - .../jpt/common/utility/internal/NotNullFilter.java | 51 - .../jpt/common/utility/internal/NullList.java | 153 - .../eclipse/jpt/common/utility/internal/Queue.java | 75 - .../eclipse/jpt/common/utility/internal/Range.java | 87 - .../utility/internal/ReadOnlyBooleanReference.java | 46 - .../utility/internal/ReadOnlyIntReference.java | 145 - .../common/utility/internal/ReflectionTools.java | 1544 --- .../common/utility/internal/ReverseComparator.java | 40 - .../common/utility/internal/RunnableCommand.java | 37 - .../common/utility/internal/SimpleAssociation.java | 69 - .../utility/internal/SimpleBooleanReference.java | 107 - .../utility/internal/SimpleCommandExecutor.java | 46 - .../jpt/common/utility/internal/SimpleFilter.java | 107 - .../utility/internal/SimpleIntReference.java | 186 - .../common/utility/internal/SimpleJavaType.java | 213 - .../utility/internal/SimpleMethodSignature.java | 240 - .../utility/internal/SimpleObjectReference.java | 98 - .../jpt/common/utility/internal/SimpleQueue.java | 90 - .../jpt/common/utility/internal/SimpleStack.java | 100 - .../utility/internal/SimpleStringMatcher.java | 259 - .../utility/internal/SimpleThreadFactory.java | 53 - .../eclipse/jpt/common/utility/internal/Stack.java | 75 - .../utility/internal/StatefulCommandExecutor.java | 33 - .../common/utility/internal/StringConverter.java | 80 - .../jpt/common/utility/internal/StringMatcher.java | 65 - .../jpt/common/utility/internal/StringTools.java | 4708 ------- .../common/utility/internal/SynchronizedBag.java | 220 - .../utility/internal/SynchronizedBoolean.java | 437 - .../common/utility/internal/SynchronizedInt.java | 914 -- .../utility/internal/SynchronizedObject.java | 472 - .../common/utility/internal/SynchronizedQueue.java | 348 - .../common/utility/internal/SynchronizedStack.java | 325 - .../utility/internal/ThreadLocalCommand.java | 63 - .../internal/ThreadLocalCommandExecutor.java | 65 - .../eclipse/jpt/common/utility/internal/Tools.java | 89 - .../jpt/common/utility/internal/Transformer.java | 95 - .../common/utility/internal/XMLStringEncoder.java | 182 - .../internal/enumerations/EmptyEnumeration.java | 62 - .../internal/enumerations/IteratorEnumeration.java | 57 - .../utility/internal/iterables/ArrayIterable.java | 77 - .../internal/iterables/ArrayListIterable.java | 59 - .../utility/internal/iterables/ChainIterable.java | 96 - .../utility/internal/iterables/CloneIterable.java | 66 - .../internal/iterables/CloneListIterable.java | 92 - .../internal/iterables/CompositeIterable.java | 98 - .../internal/iterables/CompositeListIterable.java | 135 - .../utility/internal/iterables/EmptyIterable.java | 65 - .../internal/iterables/EmptyListIterable.java | 65 - .../internal/iterables/FilteringIterable.java | 95 - .../utility/internal/iterables/GraphIterable.java | 156 - .../utility/internal/iterables/ListIterable.java | 27 - .../internal/iterables/ListListIterable.java | 35 - .../internal/iterables/LiveCloneIterable.java | 85 - .../internal/iterables/LiveCloneListIterable.java | 85 - .../internal/iterables/PeekableIterable.java | 56 - .../utility/internal/iterables/QueueIterable.java | 51 - .../iterables/ReadOnlyCompositeListIterable.java | 100 - .../internal/iterables/ReadOnlyIterable.java | 50 - .../internal/iterables/ReadOnlyListIterable.java | 50 - .../internal/iterables/SingleElementIterable.java | 55 - .../iterables/SingleElementListIterable.java | 58 - .../internal/iterables/SnapshotCloneIterable.java | 124 - .../iterables/SnapshotCloneListIterable.java | 102 - .../utility/internal/iterables/StackIterable.java | 51 - .../internal/iterables/SubIterableWrapper.java | 47 - .../internal/iterables/SubListIterableWrapper.java | 52 - .../internal/iterables/SuperIterableWrapper.java | 48 - .../iterables/SuperListIterableWrapper.java | 54 - .../internal/iterables/TransformationIterable.java | 91 - .../iterables/TransformationListIterable.java | 111 - .../utility/internal/iterables/TreeIterable.java | 137 - .../utility/internal/iterators/ArrayIterator.java | 88 - .../internal/iterators/ArrayListIterator.java | 93 - .../utility/internal/iterators/ChainIterator.java | 159 - .../utility/internal/iterators/CloneIterator.java | 191 - .../internal/iterators/CloneListIterator.java | 291 - .../internal/iterators/CompositeIterator.java | 162 - .../internal/iterators/CompositeListIterator.java | 270 - .../utility/internal/iterators/EmptyIterator.java | 69 - .../internal/iterators/EmptyListIterator.java | 93 - .../internal/iterators/EnumerationIterator.java | 52 - .../internal/iterators/FilteringIterator.java | 148 - .../utility/internal/iterators/GraphIterator.java | 283 - .../internal/iterators/PeekableIterator.java | 112 - .../utility/internal/iterators/QueueIterator.java | 59 - .../iterators/ReadOnlyCompositeListIterator.java | 252 - .../internal/iterators/ReadOnlyIterator.java | 65 - .../internal/iterators/ReadOnlyListIterator.java | 108 - .../internal/iterators/ResultSetIterator.java | 162 - .../internal/iterators/ReverseIterator.java | 82 - .../internal/iterators/SingleElementIterator.java | 67 - .../iterators/SingleElementListIterator.java | 98 - .../utility/internal/iterators/StackIterator.java | 59 - .../internal/iterators/SubIteratorWrapper.java | 59 - .../internal/iterators/SubListIteratorWrapper.java | 90 - .../internal/iterators/SuperIteratorWrapper.java | 58 - .../iterators/SuperListIteratorWrapper.java | 88 - .../internal/iterators/SynchronizedIterator.java | 76 - .../iterators/SynchronizedListIterator.java | 122 - .../internal/iterators/TransformationIterator.java | 103 - .../iterators/TransformationListIterator.java | 152 - .../utility/internal/iterators/TreeIterator.java | 254 - .../utility/internal/model/AbstractModel.java | 1007 -- .../internal/model/AspectChangeSupport.java | 349 - .../utility/internal/model/ChangeSupport.java | 2844 ----- .../internal/model/SingleAspectChangeSupport.java | 380 - .../listener/awt/AWTChangeListenerWrapper.java | 454 - .../awt/AWTCollectionChangeListenerWrapper.java | 161 - .../listener/awt/AWTListChangeListenerWrapper.java | 211 - .../awt/AWTPropertyChangeListenerWrapper.java | 87 - .../awt/AWTStateChangeListenerWrapper.java | 86 - .../listener/awt/AWTTreeChangeListenerWrapper.java | 161 - .../model/value/AbstractCollectionValueModel.java | 124 - .../model/value/AbstractListValueModel.java | 124 - .../model/value/AbstractPropertyValueModel.java | 124 - .../value/AbstractPropertyValueModelAdapter.java | 117 - .../model/value/AbstractTreeNodeValueModel.java | 194 - .../internal/model/value/AspectAdapter.java | 266 - .../value/AspectCollectionValueModelAdapter.java | 155 - .../model/value/AspectListValueModelAdapter.java | 197 - .../value/AspectPropertyValueModelAdapter.java | 178 - .../model/value/AspectTreeValueModelAdapter.java | 119 - .../value/BufferedWritablePropertyValueModel.java | 392 - .../CachingTransformationPropertyValueModel.java | 112 - ...ngTransformationWritablePropertyValueModel.java | 107 - .../value/ChangePropertyValueModelAdapter.java | 99 - .../model/value/CollectionAspectAdapter.java | 158 - .../value/CollectionListValueModelAdapter.java | 217 - .../value/CollectionPropertyValueModelAdapter.java | 139 - .../model/value/CollectionValueModelWrapper.java | 132 - .../value/CompositeBooleanPropertyValueModel.java | 338 - .../model/value/CompositeCollectionValueModel.java | 448 - .../model/value/CompositeListValueModel.java | 683 - .../model/value/CompositePropertyValueModel.java | 198 - .../model/value/ExtendedListValueModelWrapper.java | 211 - .../model/value/FilteringCollectionValueModel.java | 179 - .../model/value/FilteringPropertyValueModel.java | 142 - .../value/FilteringWritablePropertyValueModel.java | 123 - .../value/ItemAspectListValueModelAdapter.java | 274 - .../value/ItemChangeListValueModelAdapter.java | 68 - .../value/ItemCollectionListValueModelAdapter.java | 101 - .../model/value/ItemListListValueModelAdapter.java | 109 - .../value/ItemPropertyListValueModelAdapter.java | 84 - .../value/ItemStateListValueModelAdapter.java | 74 - .../model/value/ItemTreeListValueModelAdapter.java | 101 - .../internal/model/value/ListAspectAdapter.java | 176 - .../value/ListCollectionValueModelAdapter.java | 233 - .../utility/internal/model/value/ListCurator.java | 226 - .../model/value/ListPropertyValueModelAdapter.java | 167 - .../model/value/ListValueModelWrapper.java | 164 - .../model/value/NullCollectionValueModel.java | 58 - .../internal/model/value/NullListValueModel.java | 71 - .../model/value/NullPropertyValueModel.java | 49 - .../internal/model/value/NullTreeValueModel.java | 52 - .../model/value/PropertyAspectAdapter.java | 128 - .../value/PropertyCollectionValueModelAdapter.java | 141 - .../model/value/PropertyListValueModelAdapter.java | 157 - .../model/value/PropertyValueModelWrapper.java | 92 - .../ReadOnlyWritablePropertyValueModelWrapper.java | 49 - .../model/value/SetCollectionValueModel.java | 134 - .../model/value/SimpleCollectionValueModel.java | 188 - .../internal/model/value/SimpleListValueModel.java | 322 - .../model/value/SimplePropertyValueModel.java | 66 - .../model/value/SortedListValueModelAdapter.java | 125 - .../model/value/SortedListValueModelWrapper.java | 250 - .../value/StatePropertyValueModelAdapter.java | 96 - .../model/value/StaticCollectionValueModel.java | 73 - .../internal/model/value/StaticListValueModel.java | 93 - .../model/value/StaticPropertyValueModel.java | 53 - .../internal/model/value/StaticTreeValueModel.java | 57 - .../model/value/TransformationListValueModel.java | 309 - .../value/TransformationPropertyValueModel.java | 144 - .../TransformationWritablePropertyValueModel.java | 131 - .../internal/model/value/TreeAspectAdapter.java | 155 - .../model/value/TreePropertyValueModelAdapter.java | 144 - .../internal/model/value/ValueAspectAdapter.java | 201 - .../internal/model/value/ValueChangeAdapter.java | 75 - .../model/value/ValueCollectionAdapter.java | 107 - .../internal/model/value/ValueListAdapter.java | 123 - .../internal/model/value/ValuePropertyAdapter.java | 82 - .../internal/model/value/ValueStateAdapter.java | 73 - .../internal/model/value/ValueTreeAdapter.java | 107 - ...ritablePropertyCollectionValueModelAdapter.java | 62 - .../WritablePropertyListValueModelAdapter.java | 62 - .../value/prefs/PreferencePropertyValueModel.java | 346 - .../prefs/PreferencesCollectionValueModel.java | 203 - .../model/value/swing/AbstractTreeModel.java | 216 - .../model/value/swing/CheckBoxModelAdapter.java | 43 - .../internal/model/value/swing/ColumnAdapter.java | 49 - .../model/value/swing/ComboBoxModelAdapter.java | 140 - .../model/value/swing/DateSpinnerModelAdapter.java | 198 - .../model/value/swing/DocumentAdapter.java | 375 - .../model/value/swing/ListModelAdapter.java | 292 - .../model/value/swing/ListSpinnerModelAdapter.java | 218 - .../value/swing/NumberSpinnerModelAdapter.java | 223 - .../value/swing/ObjectListSelectionModel.java | 427 - .../model/value/swing/PrimitiveListTreeModel.java | 239 - .../model/value/swing/RadioButtonModelAdapter.java | 151 - .../model/value/swing/SpinnerModelAdapter.java | 207 - .../model/value/swing/TableModelAdapter.java | 420 - .../value/swing/ToggleButtonModelAdapter.java | 224 - .../model/value/swing/TreeModelAdapter.java | 914 -- .../common/utility/internal/node/AbstractNode.java | 941 -- .../internal/node/AsynchronousValidator.java | 50 - .../utility/internal/node/DefaultProblem.java | 85 - .../jpt/common/utility/internal/node/Node.java | 377 - .../utility/internal/node/PluggableValidator.java | 121 - .../jpt/common/utility/internal/node/Problem.java | 51 - .../internal/node/SynchronousValidator.java | 44 - .../internal/swing/CachingComboBoxModel.java | 42 - .../internal/swing/CheckBoxTableCellRenderer.java | 206 - .../internal/swing/ComboBoxTableCellRenderer.java | 328 - .../common/utility/internal/swing/Displayable.java | 44 - .../common/utility/internal/swing/EmptyIcon.java | 54 - .../internal/swing/FilteringListBrowser.java | 140 - .../utility/internal/swing/FilteringListPanel.java | 455 - .../common/utility/internal/swing/ListChooser.java | 430 - .../utility/internal/swing/NodeSelector.java | 32 - .../internal/swing/NonCachingComboBoxModel.java | 73 - .../utility/internal/swing/SimpleDisplayable.java | 170 - .../utility/internal/swing/SimpleListBrowser.java | 86 - .../internal/swing/SimpleListCellRenderer.java | 128 - .../internal/swing/SpinnerTableCellRenderer.java | 186 - .../internal/swing/TableCellEditorAdapter.java | 96 - .../synchronizers/AsynchronousSynchronizer.java | 188 - .../CallbackAsynchronousSynchronizer.java | 120 - .../CallbackSynchronousSynchronizer.java | 83 - .../synchronizers/SynchronousSynchronizer.java | 263 - .../eclipse/jpt/common/utility/model/Model.java | 143 - .../common/utility/model/event/ChangeEvent.java | 66 - .../utility/model/event/CollectionAddEvent.java | 124 - .../utility/model/event/CollectionChangeEvent.java | 105 - .../utility/model/event/CollectionClearEvent.java | 61 - .../utility/model/event/CollectionEvent.java | 63 - .../utility/model/event/CollectionRemoveEvent.java | 112 - .../common/utility/model/event/ListAddEvent.java | 134 - .../utility/model/event/ListChangeEvent.java | 105 - .../common/utility/model/event/ListClearEvent.java | 61 - .../jpt/common/utility/model/event/ListEvent.java | 64 - .../common/utility/model/event/ListMoveEvent.java | 120 - .../utility/model/event/ListRemoveEvent.java | 134 - .../utility/model/event/ListReplaceEvent.java | 150 - .../utility/model/event/PropertyChangeEvent.java | 109 - .../utility/model/event/StateChangeEvent.java | 51 - .../common/utility/model/event/TreeAddEvent.java | 81 - .../utility/model/event/TreeChangeEvent.java | 90 - .../common/utility/model/event/TreeClearEvent.java | 61 - .../jpt/common/utility/model/event/TreeEvent.java | 62 - .../utility/model/event/TreeRemoveEvent.java | 81 - .../utility/model/listener/ChangeAdapter.java | 109 - .../utility/model/listener/ChangeListener.java | 25 - .../model/listener/CollectionChangeAdapter.java | 51 - .../model/listener/CollectionChangeListener.java | 65 - .../model/listener/CommandChangeListener.java | 44 - .../utility/model/listener/ListChangeAdapter.java | 61 - .../utility/model/listener/ListChangeListener.java | 87 - .../MultiMethodReflectiveChangeListener.java | 160 - .../model/listener/PropertyChangeAdapter.java | 31 - .../model/listener/PropertyChangeListener.java | 37 - .../model/listener/ReflectiveChangeListener.java | 377 - .../model/listener/SimpleChangeListener.java | 131 - .../SingleMethodReflectiveChangeListener.java | 60 - .../utility/model/listener/StateChangeAdapter.java | 31 - .../model/listener/StateChangeListener.java | 37 - .../utility/model/listener/TreeChangeAdapter.java | 51 - .../utility/model/listener/TreeChangeListener.java | 67 - .../utility/model/value/CollectionValueModel.java | 42 - .../common/utility/model/value/ListValueModel.java | 57 - .../utility/model/value/PropertyValueModel.java | 36 - .../utility/model/value/TreeNodeValueModel.java | 74 - .../common/utility/model/value/TreeValueModel.java | 36 - .../model/value/WritableCollectionValueModel.java | 34 - .../model/value/WritableListValueModel.java | 34 - .../model/value/WritablePropertyValueModel.java | 33 - .../synchronizers/CallbackSynchronizer.java | 92 - .../common/utility/synchronizers/Synchronizer.java | 83 - .../org.eclipse.jpt.common.core.tests/.classpath | 13 - .../org.eclipse.jpt.common.core.tests/.project | 28 - .../.settings/org.eclipse.jdt.core.prefs | 8 - .../META-INF/MANIFEST.MF | 20 - .../org.eclipse.jpt.common.core.tests/about.html | 34 - .../build.properties | 18 - .../plugin.properties | 23 - .../core/tests/internal/JptCommonCoreTests.java | 28 - .../internal/projects/TestFacetedProject.java | 85 - .../tests/internal/projects/TestJavaProject.java | 121 - .../internal/projects/TestPlatformProject.java | 79 - .../tests/internal/utility/jdt/ASTToolsTests.java | 88 - .../internal/utility/jdt/AnnotationTestCase.java | 1052 -- ...onIndexedDeclarationAnnotationAdapterTests.java | 744 -- .../jdt/DefaultAnnotationEditFormatterTests.java | 75 - .../utility/jdt/JptCommonCoreUtilityJdtTests.java | 35 - .../jdt/MemberAnnotationElementAdapterTests.java | 1297 -- .../core/tests/internal/utility/jdt/MiscTests.java | 48 - .../NestedDeclarationAnnotationAdapterTests.java | 763 -- ...edIndexedDeclarationAnnotationAdapterTests.java | 2229 ---- .../SimpleDeclarationAnnotationAdapterTests.java | 274 - .../core/tests/internal/utility/jdt/TypeTests.java | 52 - .../org.eclipse.jpt.common.core.tests/test.xml | 45 - .../org.eclipse.jpt.common.ui.tests/.classpath | 12 - .../tests/org.eclipse.jpt.common.ui.tests/.project | 28 - .../.settings/org.eclipse.jdt.core.prefs | 8 - .../META-INF/MANIFEST.MF | 21 - .../build.properties | 13 - .../plugin.properties | 23 - .../jpt/common/ui/tests/JptCommonUiTests.java | 34 - .../jface/DelegatingLabelProviderUiTest.java | 602 - .../jface/DelegatingTreeContentProviderUiTest.java | 563 - .../swt/AbstractComboModelAdapterTest.java | 777 -- .../tests/internal/swt/ComboModelAdapterTest.java | 78 - .../ui/tests/internal/swt/JptUiSWTTests.java | 38 - .../internal/swt/SpinnerModelAdapterTest.java | 342 - .../tests/internal/swt/TableModelAdapterTest.java | 1201 -- .../swt/TriStateCheckBoxModelAdapterUITest.java | 319 - .../ui/tests/internal/util/ControlAlignerTest.java | 803 -- .../ui/tests/internal/util/ControlEnablerTest.java | 85 - .../tests/internal/util/ControlSwitcherTest.java | 189 - .../util/ControlVisibilityEnablerTest.java | 85 - .../ui/tests/internal/util/JptUiUtilTests.java | 44 - .../ui/tests/internal/util/LabeledButtonTest.java | 122 - .../internal/util/LabeledControlUpdaterTest.java | 124 - .../ui/tests/internal/util/LabeledLabelTest.java | 122 - .../ui/tests/internal/util/PaneEnablerTest.java | 93 - .../internal/util/PaneVisibilityEnablerTest.java | 93 - .../utility/swt/BooleanStateControllerUITest.java | 278 - .../utility/swt/CheckBoxModelBindingUITest.java | 318 - .../swt/DropDownListBoxModelBindingUITest.java | 664 - .../utility/swt/ListBoxModelBindingUITest.java | 626 - .../utility/swt/TextFieldModelBindingUITest.java | 252 - .../.classpath | 11 - .../.cvsignore | 5 - .../org.eclipse.jpt.common.utility.tests/.project | 28 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../META-INF/MANIFEST.MF | 21 - .../about.html | 34 - .../build.properties | 16 - .../plugin.properties | 24 - .../resource/ClassTools.java | 1680 --- .../utility/tests/internal/ArrayToolsTests.java | 3523 ------ .../internal/AsynchronousCommandExecutorTests.java | 42 - .../common/utility/tests/internal/BagTests.java | 82 - .../utility/tests/internal/BidiFilterTests.java | 88 - .../tests/internal/BidiStringConverterTests.java | 115 - .../tests/internal/BidiTransformerTests.java | 73 - .../utility/tests/internal/BitToolsTests.java | 262 - .../utility/tests/internal/BooleanToolsTests.java | 89 - .../utility/tests/internal/ClassNameTests.java | 368 - .../utility/tests/internal/ClasspathTests.java | 402 - .../tests/internal/CollectionToolsTests.java | 2354 ---- .../tests/internal/CommandExecutorTests.java | 113 - .../tests/internal/CommandRunnableTests.java | 55 - .../utility/tests/internal/CommandTests.java | 137 - .../tests/internal/CompositeCommandTests.java | 61 - .../tests/internal/ExceptionHandlerTests.java | 51 - .../utility/tests/internal/FileToolsTests.java | 593 - .../common/utility/tests/internal/FilterTests.java | 79 - .../utility/tests/internal/HashBagTests.java | 555 - .../tests/internal/IdentityHashBagTests.java | 573 - .../tests/internal/IndentingPrintWriterTests.java | 109 - .../utility/tests/internal/JDBCTypeTests.java | 67 - .../utility/tests/internal/JavaTypeTests.java | 252 - .../tests/internal/JptCommonUtilityTests.java | 90 - .../utility/tests/internal/KeyedSetTests.java | 123 - .../utility/tests/internal/ListenerListTests.java | 194 - .../tests/internal/MethodSignatureTests.java | 208 - .../tests/internal/MultiThreadedTestCase.java | 141 - .../utility/tests/internal/NameToolsTests.java | 226 - .../utility/tests/internal/NotNullFilterTests.java | 37 - .../common/utility/tests/internal/RangeTests.java | 74 - .../tests/internal/ReflectionToolsTests.java | 440 - .../tests/internal/ReverseComparatorTests.java | 102 - .../tests/internal/SimpleAssociationTests.java | 112 - .../internal/SimpleBooleanReferenceTests.java | 110 - .../tests/internal/SimpleIntReferenceTests.java | 314 - .../tests/internal/SimpleObjectReferenceTests.java | 88 - .../utility/tests/internal/SimpleQueueTests.java | 149 - .../utility/tests/internal/SimpleStackTests.java | 148 - .../utility/tests/internal/StringToolsTests.java | 1850 --- .../tests/internal/SynchronizedBooleanTests.java | 236 - .../tests/internal/SynchronizedIntTests.java | 362 - .../tests/internal/SynchronizedObjectTests.java | 239 - .../tests/internal/SynchronizedQueueTests.java | 256 - .../tests/internal/SynchronizedStackTests.java | 257 - .../common/utility/tests/internal/TestTools.java | 184 - .../common/utility/tests/internal/ToolsTests.java | 63 - .../tests/internal/XMLStringEncoderTests.java | 136 - .../enumerations/EmptyEnumerationTests.java | 55 - .../enumerations/IteratorEnumerationTests.java | 100 - .../enumerations/JptUtilityEnumerationsTests.java | 34 - .../internal/iterables/ArrayIterableTests.java | 79 - .../internal/iterables/ArrayListIterableTests.java | 92 - .../internal/iterables/ChainIterableTests.java | 84 - .../internal/iterables/CloneIterableTests.java | 144 - .../internal/iterables/CompositeIterableTests.java | 115 - .../iterables/CompositeListIterableTests.java | 117 - .../internal/iterables/EmptyIterableTests.java | 39 - .../internal/iterables/EmptyListIterableTests.java | 39 - .../internal/iterables/FilteringIterableTests.java | 98 - .../internal/iterables/GraphIterableTests.java | 167 - .../iterables/JptUtilityIterablesTests.java | 57 - .../internal/iterables/LiveCloneIterableTests.java | 71 - .../iterables/LiveCloneListIterableTests.java | 131 - .../internal/iterables/PeekableIterableTests.java | 47 - .../internal/iterables/QueueIterableTests.java | 48 - .../ReadOnlyCompositeListIterableTests.java | 127 - .../internal/iterables/ReadOnlyIterableTests.java | 68 - .../iterables/ReadOnlyListIterableTests.java | 74 - .../iterables/SingleElementIterableTests.java | 66 - .../iterables/SingleElementListIterableTests.java | 70 - .../iterables/SnapshotCloneIterableTests.java | 71 - .../iterables/SnapshotCloneListIterableTests.java | 131 - .../internal/iterables/StackIterableTests.java | 50 - .../iterables/SuperIterableWrapperTests.java | 50 - .../iterables/TransformationIterableTests.java | 104 - .../iterables/TransformationListIterableTests.java | 104 - .../internal/iterables/TreeIterableTests.java | 155 - .../internal/iterators/ArrayIteratorTests.java | 135 - .../internal/iterators/ArrayListIteratorTests.java | 140 - .../internal/iterators/ChainIteratorTests.java | 133 - .../internal/iterators/CloneIteratorTests.java | 237 - .../internal/iterators/CloneListIteratorTests.java | 397 - .../internal/iterators/CompositeIteratorTests.java | 351 - .../iterators/CompositeListIteratorTests.java | 331 - .../internal/iterators/EmptyIteratorTests.java | 64 - .../internal/iterators/EmptyListIteratorTests.java | 128 - .../iterators/EnumerationIteratorTests.java | 120 - .../internal/iterators/FilteringIteratorTests.java | 266 - .../internal/iterators/GraphIteratorTests.java | 197 - .../iterators/JptUtilityIteratorsTests.java | 56 - .../internal/iterators/PeekableIteratorTests.java | 141 - .../ReadOnlyCompositeListIteratorTests.java | 205 - .../internal/iterators/ReadOnlyIteratorTests.java | 119 - .../iterators/ReadOnlyListIteratorTests.java | 204 - .../iterators/SingleElementIteratorTests.java | 72 - .../iterators/SingleElementListIteratorTests.java | 112 - .../iterators/SuperIteratorWrapperTests.java | 52 - .../iterators/SynchronizedIteratorTests.java | 310 - .../iterators/SynchronizedListIteratorTests.java | 524 - .../iterators/TransformationIteratorTests.java | 230 - .../iterators/TransformationListIteratorTests.java | 322 - .../internal/iterators/TreeIteratorTests.java | 211 - .../tests/internal/model/ChangeSupportTests.java | 4575 ------- .../tests/internal/model/JptUtilityModelTests.java | 37 - .../tests/internal/model/NewEventTests.java | 181 - .../model/SingleAspectChangeSupportTests.java | 192 - .../listener/JptUtilityModelListenerTests.java | 34 - .../ReflectiveCollectionChangeListenerTests.java | 331 - .../ReflectiveListChangeListenerTests.java | 498 - .../ReflectivePropertyChangeListenerTests.java | 176 - .../ReflectiveStateChangeListenerTests.java | 145 - .../ReflectiveTreeChangeListenerTests.java | 362 - .../BufferedWritablePropertyValueModelTests.java | 504 - ...chingTransformationPropertyValueModelTests.java | 241 - ...nsformationWritablePropertyValueModelTests.java | 253 - .../model/value/CollectionAspectAdapterTests.java | 372 - .../CollectionListValueModelAdapterTests.java | 247 - .../CollectionPropertyValueModelAdapterTests.java | 240 - .../CompositeBooleanPropertyValueModelTests.java | 201 - .../value/CompositeCollectionValueModelTests.java | 415 - .../model/value/CompositeListValueModelTests.java | 1248 -- .../value/CompositePropertyValueModelTests.java | 199 - .../tests/internal/model/value/CoordinatedBag.java | 163 - .../internal/model/value/CoordinatedList.java | 264 - .../value/ExtendedListValueModelWrapperTests.java | 313 - .../value/FilteringCollectionValueModelTests.java | 348 - .../value/FilteringPropertyValueModelTests.java | 191 - .../ItemCollectionListValueModelAdapterTests.java | 243 - .../value/ItemListListValueModelAdapterTests.java | 244 - .../ItemPropertyListValueModelAdapterTests.java | 335 - .../value/ItemStateListValueModelAdapterTests.java | 306 - .../model/value/JptUtilityModelValueTests.java | 78 - .../model/value/ListAspectAdapterTests.java | 476 - .../ListCollectionValueModelAdapterTests.java | 282 - .../internal/model/value/ListCuratorTests.java | 348 - .../model/value/NullCollectionValueModelTests.java | 44 - .../model/value/NullListValueModelTests.java | 54 - .../model/value/NullPropertyValueModelTests.java | 40 - .../model/value/PropertyAspectAdapterTests.java | 344 - .../PropertyCollectionValueModelAdapterTests.java | 162 - .../value/PropertyListValueModelAdapterTests.java | 211 - ...OnlyWritablePropertyValueModelWrapperTests.java | 157 - .../model/value/SetCollectionValueModelTests.java | 328 - .../value/SimpleCollectionValueModelTests.java | 443 - .../model/value/SimpleListValueModelTests.java | 378 - .../model/value/SimplePropertyValueModelTests.java | 97 - .../value/SortedListValueModelAdapterTests.java | 222 - .../value/SortedListValueModelWrapperTests.java | 237 - .../value/StaticCollectionValueModelTests.java | 62 - .../model/value/StaticListValueModelTests.java | 65 - .../model/value/StaticValueModelTests.java | 47 - .../value/TransformationListValueModelTests.java | 339 - .../TransformationPropertyValueModelTests.java | 189 - .../model/value/TreeAspectAdapterTests.java | 362 - .../model/value/ValueCollectionAdapterTests.java | 159 - .../model/value/ValueListAdapterTests.java | 169 - .../model/value/ValuePropertyAdapterTests.java | 145 - .../model/value/ValueStateAdapterTests.java | 145 - .../prefs/JptUtilityModelValuePrefsTests.java | 31 - .../prefs/PreferencePropertyValueModelTests.java | 398 - .../PreferencesCollectionValueModelTests.java | 312 - .../model/value/prefs/PreferencesTestCase.java | 82 - .../value/swing/CheckBoxModelAdapterTests.java | 135 - .../value/swing/CheckBoxModelAdapterUITest.java | 314 - .../value/swing/ComboBoxModelAdapterTests.java | 111 - .../value/swing/ComboBoxModelAdapterUITest.java | 393 - .../value/swing/ComboBoxModelAdapterUITest2.java | 75 - .../value/swing/DateSpinnerModelAdapterTests.java | 160 - .../model/value/swing/DocumentAdapterTests.java | 159 - .../model/value/swing/DocumentAdapterUITest.java | 256 - .../swing/JptUtilityModelValueSwingTests.java | 42 - .../model/value/swing/ListModelAdapterTests.java | 320 - .../model/value/swing/ListModelAdapterUITest.java | 370 - .../value/swing/ListSpinnerModelAdapterTests.java | 134 - .../swing/NumberSpinnerModelAdapterTests.java | 148 - .../value/swing/ObjectListSelectionModelTests.java | 205 - .../value/swing/PrimitiveListTreeModelTests.java | 198 - .../value/swing/RadioButtonModelAdapterTests.java | 230 - .../value/swing/RadioButtonModelAdapterUITest.java | 260 - .../swing/ReadOnlyTableModelAdapterUITest.java | 39 - .../value/swing/SpinnerModelAdapterTests.java | 118 - .../value/swing/SpinnerModelAdapterUITest.java | 344 - .../model/value/swing/TableModelAdapterTests.java | 641 - .../model/value/swing/TableModelAdapterUITest.java | 733 -- .../model/value/swing/TreeModelAdapterTests.java | 812 -- .../model/value/swing/TreeModelAdapterUITest.java | 425 - .../tests/internal/node/AbstractNodeTests.java | 495 - .../tests/internal/node/JptUtilityNodeTests.java | 29 - .../AsynchronousSynchronizerTests.java | 443 - .../JptUtilitySynchronizersTests.java | 35 - .../internal/synchronizers/SynchronizerTests.java | 41 - .../SynchronousSynchronizerTests.java | 756 -- .../org.eclipse.jpt.common.utility.tests/test.xml | 38 - .../.project | 17 - .../build.properties | 15 - .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../epl-v10.html | 328 - .../feature.properties | 163 - .../feature.xml | 60 - .../license.html | 107 - .../sourceTemplateBundle/about.html | 27 - .../sourceTemplateBundle/about.ini | 31 - .../sourceTemplateBundle/about.mappings | 6 - .../sourceTemplateBundle/about.properties | 26 - .../sourceTemplateBundle/build.properties | 21 - .../sourceTemplateBundle/eclipse32.gif | Bin 1706 -> 0 bytes .../sourceTemplateBundle/eclipse32.png | Bin 4634 -> 0 bytes .../sourceTemplateBundle/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplateBundle/epl-v10.html | 328 - .../sourceTemplateBundle/license.html | 86 - .../sourceTemplateBundle/plugin.properties | 13 - .../sourceTemplateFeature/build.properties | 16 - .../sourceTemplateFeature/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplateFeature/epl-v10.html | 328 - .../sourceTemplateFeature/feature.properties | 168 - .../sourceTemplateFeature/license.html | 107 - .../sourceTemplatePlugin/about.html | 27 - .../sourceTemplatePlugin/about.ini | 31 - .../sourceTemplatePlugin/about.mappings | 6 - .../sourceTemplatePlugin/about.properties | 26 - .../sourceTemplatePlugin/build.properties | 21 - .../sourceTemplatePlugin/eclipse32.gif | Bin 1706 -> 0 bytes .../sourceTemplatePlugin/eclipse32.png | Bin 4634 -> 0 bytes .../sourceTemplatePlugin/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplatePlugin/epl-v10.html | 328 - .../sourceTemplatePlugin/license.html | 86 - .../sourceTemplatePlugin/plugin.properties | 13 - .../.cvsignore | 2 - .../.project | 17 - .../build.properties | 7 - .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../epl-v10.html | 328 - .../feature.properties | 163 - .../feature.xml | 28 - .../license.html | 107 - .../.project | 17 - .../build.properties | 15 - .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../epl-v10.html | 328 - .../feature.properties | 163 - .../feature.xml | 39 - .../license.html | 107 - .../sourceTemplateBundle/about.html | 27 - .../sourceTemplateBundle/about.ini | 31 - .../sourceTemplateBundle/about.mappings | 6 - .../sourceTemplateBundle/about.properties | 26 - .../sourceTemplateBundle/build.properties | 21 - .../sourceTemplateBundle/eclipse32.gif | Bin 1706 -> 0 bytes .../sourceTemplateBundle/eclipse32.png | Bin 4634 -> 0 bytes .../sourceTemplateBundle/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplateBundle/epl-v10.html | 328 - .../sourceTemplateBundle/license.html | 86 - .../sourceTemplateBundle/plugin.properties | 13 - .../sourceTemplateFeature/build.properties | 16 - .../sourceTemplateFeature/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplateFeature/epl-v10.html | 328 - .../sourceTemplateFeature/feature.properties | 168 - .../sourceTemplateFeature/license.html | 107 - .../sourceTemplatePlugin/about.html | 27 - .../sourceTemplatePlugin/about.ini | 31 - .../sourceTemplatePlugin/about.mappings | 6 - .../sourceTemplatePlugin/about.properties | 26 - .../sourceTemplatePlugin/build.properties | 21 - .../sourceTemplatePlugin/eclipse32.gif | Bin 1706 -> 0 bytes .../sourceTemplatePlugin/eclipse32.png | Bin 4634 -> 0 bytes .../sourceTemplatePlugin/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplatePlugin/epl-v10.html | 328 - .../sourceTemplatePlugin/license.html | 86 - .../sourceTemplatePlugin/plugin.properties | 13 - .../.cvsignore | 2 - .../.project | 17 - .../build.properties | 7 - .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../epl-v10.html | 328 - .../feature.properties | 163 - .../feature.xml | 28 - .../license.html | 107 - .../features/org.eclipse.jpt.jaxb.feature/.project | 17 - .../org.eclipse.jpt.jaxb.feature/build.properties | 15 - .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../org.eclipse.jpt.jaxb.feature/epl-v10.html | 328 - .../feature.properties | 163 - .../org.eclipse.jpt.jaxb.feature/feature.xml | 70 - .../org.eclipse.jpt.jaxb.feature/license.html | 107 - .../sourceTemplateBundle/about.html | 27 - .../sourceTemplateBundle/about.ini | 31 - .../sourceTemplateBundle/about.mappings | 6 - .../sourceTemplateBundle/about.properties | 26 - .../sourceTemplateBundle/build.properties | 12 - .../sourceTemplateBundle/eclipse32.gif | Bin 1706 -> 0 bytes .../sourceTemplateBundle/eclipse32.png | Bin 4634 -> 0 bytes .../sourceTemplateBundle/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplateBundle/epl-v10.html | 328 - .../sourceTemplateBundle/license.html | 86 - .../sourceTemplateBundle/plugin.properties | 13 - .../sourceTemplateFeature/build.properties | 16 - .../sourceTemplateFeature/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplateFeature/epl-v10.html | 328 - .../sourceTemplateFeature/feature.properties | 168 - .../sourceTemplateFeature/license.html | 107 - .../sourceTemplatePlugin/about.html | 27 - .../sourceTemplatePlugin/about.ini | 31 - .../sourceTemplatePlugin/about.mappings | 6 - .../sourceTemplatePlugin/about.properties | 26 - .../sourceTemplatePlugin/build.properties | 12 - .../sourceTemplatePlugin/eclipse32.gif | Bin 1706 -> 0 bytes .../sourceTemplatePlugin/eclipse32.png | Bin 4634 -> 0 bytes .../sourceTemplatePlugin/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplatePlugin/epl-v10.html | 328 - .../sourceTemplatePlugin/license.html | 86 - .../sourceTemplatePlugin/plugin.properties | 13 - .../org.eclipse.jpt.jaxb.tests.feature/.cvsignore | 1 - .../org.eclipse.jpt.jaxb.tests.feature/.project | 17 - .../build.properties | 10 - .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../epl-v10.html | 328 - .../feature.properties | 171 - .../org.eclipse.jpt.jaxb.tests.feature/feature.xml | 26 - .../license.html | 107 - .../org.eclipse.jpt.jaxb_sdk.feature/.cvsignore | 2 - .../org.eclipse.jpt.jaxb_sdk.feature/.project | 17 - .../build.properties | 7 - .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../org.eclipse.jpt.jaxb_sdk.feature/epl-v10.html | 328 - .../feature.properties | 163 - .../org.eclipse.jpt.jaxb_sdk.feature/feature.xml | 28 - .../org.eclipse.jpt.jaxb_sdk.feature/license.html | 107 - .../.cvsignore | 1 - .../.project | 22 - .../META-INF/MANIFEST.MF | 7 - .../about.html | 34 - .../about.ini | 44 - .../about.mappings | 6 - .../about.properties | 24 - .../build.properties | 17 - .../icons/WTP_icon_x32_v2.png | Bin 5616 -> 0 bytes .../plugin.properties | 13 - .../.classpath | 7 - .../.cvsignore | 1 - .../.project | 28 - .../.settings/org.eclipse.jdt.core.prefs | 8 - .../META-INF/MANIFEST.MF | 11 - .../about.html | 47 - .../build.properties | 19 - .../plugin.properties | 24 - .../jpt/dbws/eclipselink/core/gen/Main.java | 241 - .../core/gen/internal/JptDbwsCoreMessages.java | 44 - .../dbws/eclipselink/core/gen/internal/Tools.java | 110 - .../core/gen/internal/jpt_dbws_core.properties | 17 - .../org.eclipse.jpt.jaxb.branding/.cvsignore | 1 - .../plugins/org.eclipse.jpt.jaxb.branding/.project | 22 - .../META-INF/MANIFEST.MF | 7 - .../org.eclipse.jpt.jaxb.branding/about.html | 34 - .../org.eclipse.jpt.jaxb.branding/about.ini | 44 - .../org.eclipse.jpt.jaxb.branding/about.mappings | 6 - .../org.eclipse.jpt.jaxb.branding/about.properties | 24 - .../org.eclipse.jpt.jaxb.branding/build.properties | 18 - .../org.eclipse.jpt.jaxb.branding/component.xml | 8 - .../icons/WTP_icon_x32_v2.png | Bin 5616 -> 0 bytes .../plugin.properties | 13 - .../org.eclipse.jpt.jaxb.core.schemagen/.classpath | 7 - .../org.eclipse.jpt.jaxb.core.schemagen/.cvsignore | 1 - .../org.eclipse.jpt.jaxb.core.schemagen/.project | 28 - .../.settings/org.eclipse.jdt.core.prefs | 8 - .../META-INF/MANIFEST.MF | 11 - .../org.eclipse.jpt.jaxb.core.schemagen/about.html | 47 - .../build.properties | 19 - .../plugin.properties | 24 - .../org/eclipse/jpt/jaxb/core/schemagen/Main.java | 287 - .../schemagen/internal/JptJaxbCoreMessages.java | 43 - .../jpt/jaxb/core/schemagen/internal/Tools.java | 104 - .../schemagen/internal/jpt_jaxb_core.properties | 19 - jaxb/plugins/org.eclipse.jpt.jaxb.core/.classpath | 15 - jaxb/plugins/org.eclipse.jpt.jaxb.core/.cvsignore | 6 - jaxb/plugins/org.eclipse.jpt.jaxb.core/.project | 28 - .../.settings/org.eclipse.jdt.core.prefs | 12 - .../org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF | 49 - jaxb/plugins/org.eclipse.jpt.jaxb.core/about.html | 34 - .../org.eclipse.jpt.jaxb.core/build.properties | 20 - .../org.eclipse.jpt.jaxb.core/component.xml | 16 - .../org.eclipse.jpt.jaxb.core/plugin.properties | 31 - jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml | 265 - .../property_files/jaxb_validation.properties | 27 - .../property_files/jpt_jaxb_core.properties | 22 - .../schema/jaxbPlatforms.exsd | 221 - .../eclipse/jpt/jaxb/core/AnnotationProvider.java | 79 - .../eclipse/jpt/jaxb/core/GenericJaxbPlatform.java | 43 - .../jpt/jaxb/core/GenericJaxbProjectManager.java | 1038 -- .../src/org/eclipse/jpt/jaxb/core/JaxbFacet.java | 55 - .../src/org/eclipse/jpt/jaxb/core/JaxbFactory.java | 138 - .../src/org/eclipse/jpt/jaxb/core/JaxbFile.java | 92 - .../src/org/eclipse/jpt/jaxb/core/JaxbNode.java | 43 - .../src/org/eclipse/jpt/jaxb/core/JaxbProject.java | 378 - .../eclipse/jpt/jaxb/core/JaxbProjectManager.java | 74 - .../jpt/jaxb/core/JaxbResourceModelProvider.java | 42 - .../eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java | 464 - .../src/org/eclipse/jpt/jaxb/core/MappingKeys.java | 32 - .../org/eclipse/jpt/jaxb/core/SchemaLibrary.java | 42 - .../jaxb/core/context/JaxbAttributeMapping.java | 46 - .../jaxb/core/context/JaxbContainmentMapping.java | 72 - .../jpt/jaxb/core/context/JaxbContextNode.java | 51 - .../jpt/jaxb/core/context/JaxbContextRoot.java | 110 - .../core/context/JaxbElementFactoryMethod.java | 84 - .../jpt/jaxb/core/context/JaxbEnumConstant.java | 58 - .../eclipse/jpt/jaxb/core/context/JaxbPackage.java | 70 - .../jpt/jaxb/core/context/JaxbPackageInfo.java | 75 - .../jaxb/core/context/JaxbPersistentAttribute.java | 98 - .../jpt/jaxb/core/context/JaxbPersistentClass.java | 61 - .../jpt/jaxb/core/context/JaxbPersistentEnum.java | 53 - .../jpt/jaxb/core/context/JaxbPersistentField.java | 31 - .../jaxb/core/context/JaxbPersistentProperty.java | 33 - .../jpt/jaxb/core/context/JaxbPersistentType.java | 146 - .../jpt/jaxb/core/context/JaxbRegistry.java | 41 - .../eclipse/jpt/jaxb/core/context/JaxbType.java | 99 - .../jpt/jaxb/core/context/XmlAccessOrder.java | 66 - .../jaxb/core/context/XmlAccessOrderHolder.java | 59 - .../jpt/jaxb/core/context/XmlAccessType.java | 72 - .../jpt/jaxb/core/context/XmlAccessTypeHolder.java | 59 - .../jpt/jaxb/core/context/XmlAdaptable.java | 30 - .../jpt/jaxb/core/context/XmlAttributeMapping.java | 28 - .../jpt/jaxb/core/context/XmlElementMapping.java | 53 - .../jpt/jaxb/core/context/XmlElementWrapper.java | 56 - .../jpt/jaxb/core/context/XmlJavaTypeAdapter.java | 51 - .../org/eclipse/jpt/jaxb/core/context/XmlList.java | 31 - .../org/eclipse/jpt/jaxb/core/context/XmlNs.java | 41 - .../eclipse/jpt/jaxb/core/context/XmlNsForm.java | 68 - .../jpt/jaxb/core/context/XmlRootElement.java | 84 - .../eclipse/jpt/jaxb/core/context/XmlSchema.java | 88 - .../jpt/jaxb/core/context/XmlSchemaType.java | 64 - .../jpt/jaxb/core/context/XmlValueMapping.java | 28 - .../DefaultJavaAttributeMappingDefinition.java | 37 - .../java/JavaAttributeMappingDefinition.java | 60 - .../jaxb/core/context/java/JavaContextNode.java | 43 - .../jaxb/core/internal/AbstractJaxbFactory.java | 164 - .../jpt/jaxb/core/internal/AbstractJaxbNode.java | 504 - .../internal/AbstractJaxbPlatformDefinition.java | 149 - .../jaxb/core/internal/AbstractJaxbProject.java | 1638 --- .../core/internal/GenericAnnotationProvider.java | 128 - .../jpt/jaxb/core/internal/GenericJaxbFile.java | 143 - .../jpt/jaxb/core/internal/GenericJaxbProject.java | 27 - .../JavaPackageInfoResourceModelProvider.java | 57 - .../core/internal/JavaResourceModelProvider.java | 57 - .../jaxb/core/internal/JptJaxbCoreMessages.java | 44 - .../jpt/jaxb/core/internal/SchemaLibraryImpl.java | 122 - .../core/internal/SimpleJaxbProjectConfig.java | 53 - .../internal/context/AbstractJaxbContextNode.java | 47 - .../core/internal/context/GenericContextRoot.java | 516 - .../jaxb/core/internal/context/GenericPackage.java | 128 - .../context/java/AbstractJavaAttributeMapping.java | 118 - .../AbstractJavaAttributeMappingDefinition.java | 30 - .../context/java/AbstractJavaContextNode.java | 57 - .../context/java/AbstractJavaPersistentType.java | 432 - .../internal/context/java/AbstractJavaType.java | 111 - .../java/AbstractJavaXmlJavaTypeAdapter.java | 132 - .../GenericJavaAttributeXmlJavaTypeAdapter.java | 62 - .../java/GenericJavaContainmentMapping.java | 369 - ...GenericJavaContainmentMappingXmlSchemaType.java | 47 - .../java/GenericJavaElementFactoryMethod.java | 189 - .../context/java/GenericJavaEnumConstant.java | 89 - .../java/GenericJavaNullAttributeMapping.java | 34 - .../context/java/GenericJavaPackageInfo.java | 369 - .../java/GenericJavaPackageXmlJavaTypeAdapter.java | 49 - .../java/GenericJavaPackageXmlSchemaType.java | 37 - .../java/GenericJavaPersistentAttribute.java | 380 - .../context/java/GenericJavaPersistentClass.java | 965 -- .../context/java/GenericJavaPersistentEnum.java | 131 - .../context/java/GenericJavaPersistentField.java | 59 - .../java/GenericJavaPersistentProperty.java | 109 - .../internal/context/java/GenericJavaRegistry.java | 140 - .../java/GenericJavaTypeXmlJavaTypeAdapter.java | 34 - .../context/java/GenericJavaXmlAdaptable.java | 122 - .../java/GenericJavaXmlAttributeMapping.java | 35 - .../context/java/GenericJavaXmlElementMapping.java | 223 - .../context/java/GenericJavaXmlElementWrapper.java | 211 - .../internal/context/java/GenericJavaXmlList.java | 84 - .../internal/context/java/GenericJavaXmlNs.java | 113 - .../context/java/GenericJavaXmlRootElement.java | 240 - .../context/java/GenericJavaXmlSchema.java | 283 - .../context/java/GenericJavaXmlSchemaType.java | 198 - .../java/GenericJavaXmlTransientMapping.java | 32 - .../context/java/GenericJavaXmlValueMapping.java | 129 - .../java/JavaXmlAttributeMappingDefinition.java | 77 - .../java/JavaXmlElementMappingDefinition.java | 85 - .../java/JavaXmlTransientMappingDefinition.java | 60 - .../java/JavaXmlValueMappingDefinition.java | 65 - .../facet/JaxbFacetDataModelProperties.java | 25 - .../internal/facet/JaxbFacetDataModelProvider.java | 277 - .../core/internal/facet/JaxbFacetDelegate.java | 57 - .../facet/JaxbFacetInstallDataModelProperties.java | 16 - .../facet/JaxbFacetInstallDataModelProvider.java | 20 - .../internal/facet/JaxbFacetInstallDelegate.java | 31 - .../internal/facet/JaxbFacetUninstallDelegate.java | 26 - .../JaxbFacetVersionChangeDataModelProperties.java | 16 - .../JaxbFacetVersionChangeDataModelProvider.java | 49 - .../facet/JaxbFacetVersionChangeDelegate.java | 26 - .../jaxb/core/internal/gen/ClassesGenerator.java | 264 - .../gen/ClassesGeneratorExtensionOptions.java | 54 - .../core/internal/gen/ClassesGeneratorOptions.java | 173 - .../core/internal/gen/GenerateJaxbClassesJob.java | 121 - .../jaxb/core/internal/gen/SchemaGenerator.java | 287 - .../internal/jaxb21/GenericJaxb_2_1_Factory.java | 37 - .../jaxb21/GenericJaxb_2_1_PlatformDefinition.java | 178 - .../GenericJaxb_2_1_PlatformDefinitionFactory.java | 22 - .../jaxb22/GenericJaxb_2_2_PlatformDefinition.java | 40 - .../GenericJaxb_2_2_PlatformDefinitionFactory.java | 23 - ...xbJreLibraryProviderInstallOperationConfig.java | 61 - ...ndlesLibraryProviderInstallOperationConfig.java | 38 - ...bUserLibraryProviderInstallOperationConfig.java | 37 - .../GenericEclipseLinkBundlesLibraryValidator.java | 32 - .../libval/GenericJaxbUserLibraryValidator.java | 56 - .../internal/libval/JaxbJreLibraryValidator.java | 44 - .../jaxb/core/internal/libval/JaxbLibValUtil.java | 135 - .../SchemaFileCreationDataModelProvider.java | 42 - .../platform/JaxbPlatformDescriptionImpl.java | 109 - .../platform/JaxbPlatformGroupDescriptionImpl.java | 69 - .../core/internal/platform/JaxbPlatformImpl.java | 133 - .../internal/platform/JaxbPlatformManagerImpl.java | 253 - .../internal/resource/java/NullAnnotation.java | 78 - .../java/NullXmlAccessorOrderAnnotation.java | 56 - .../java/NullXmlAccessorTypeAnnotation.java | 56 - .../java/NullXmlElementDeclAnnotation.java | 134 - .../resource/java/NullXmlEnumAnnotation.java | 58 - .../resource/java/NullXmlEnumValueAnnotation.java | 54 - .../resource/java/NullXmlSchemaAnnotation.java | 137 - .../resource/java/NullXmlTypeAnnotation.java | 144 - .../java/XmlAccessorOrderAnnotationDefinition.java | 60 - .../java/XmlAccessorTypeAnnotationDefinition.java | 60 - .../java/XmlAnyAttributeAnnotationDefinition.java | 62 - .../java/XmlAnyElementAnnotationDefinition.java | 62 - .../java/XmlAttachmentRefAnnotationDefinition.java | 62 - .../java/XmlAttributeAnnotationDefinition.java | 62 - .../java/XmlElementAnnotationDefinition.java | 61 - .../java/XmlElementDeclAnnotationDefinition.java | 62 - .../java/XmlElementRefAnnotationDefinition.java | 71 - .../XmlElementWrapperAnnotationDefinition.java | 62 - .../java/XmlElementsAnnotationDefinition.java | 61 - .../resource/java/XmlEnumAnnotationDefinition.java | 62 - .../java/XmlEnumValueAnnotationDefinition.java | 62 - .../resource/java/XmlIDAnnotationDefinition.java | 62 - .../java/XmlIDREFAnnotationDefinition.java | 62 - .../XmlInlineBinaryDataAnnotationDefinition.java | 62 - .../XmlJavaTypeAdapterAnnotationDefinition.java | 64 - .../resource/java/XmlListAnnotationDefinition.java | 62 - .../java/XmlMimeTypeAnnotationDefinition.java | 62 - .../java/XmlMixedAnnotationDefinition.java | 62 - .../java/XmlRegistryAnnotationDefinition.java | 62 - .../java/XmlRootElementAnnotationDefinition.java | 62 - .../java/XmlSchemaAnnotationDefinition.java | 61 - .../java/XmlSchemaTypeAnnotationDefinition.java | 60 - .../java/XmlSeeAlsoAnnotationDefinition.java | 62 - .../java/XmlTransientAnnotationDefinition.java | 62 - .../resource/java/XmlTypeAnnotationDefinition.java | 62 - .../java/XmlValueAnnotationDefinition.java | 62 - .../resource/java/binary/BinaryAnnotation.java | 93 - .../internal/resource/java/binary/BinaryNode.java | 62 - .../binary/BinaryXmlAccessorOrderAnnotation.java | 71 - .../binary/BinaryXmlAccessorTypeAnnotation.java | 71 - .../binary/BinaryXmlAnyAttributeAnnotation.java | 31 - .../java/binary/BinaryXmlAnyElementAnnotation.java | 107 - .../binary/BinaryXmlAttachmentRefAnnotation.java | 31 - .../java/binary/BinaryXmlAttributeAnnotation.java | 125 - .../java/binary/BinaryXmlElementAnnotation.java | 210 - .../binary/BinaryXmlElementDeclAnnotation.java | 209 - .../java/binary/BinaryXmlElementRefAnnotation.java | 132 - .../binary/BinaryXmlElementWrapperAnnotation.java | 151 - .../java/binary/BinaryXmlElementsAnnotation.java | 72 - .../java/binary/BinaryXmlEnumAnnotation.java | 80 - .../java/binary/BinaryXmlEnumValueAnnotation.java | 69 - .../java/binary/BinaryXmlIDAnnotation.java | 31 - .../java/binary/BinaryXmlIDREFAnnotation.java | 31 - .../BinaryXmlInlineBinaryDataAnnotation.java | 31 - .../binary/BinaryXmlJavaTypeAdapterAnnotation.java | 111 - .../java/binary/BinaryXmlListAnnotation.java | 32 - .../java/binary/BinaryXmlMimeTypeAnnotation.java | 69 - .../java/binary/BinaryXmlMixedAnnotation.java | 31 - .../java/binary/BinaryXmlRegistryAnnotation.java | 31 - .../binary/BinaryXmlRootElementAnnotation.java | 109 - .../java/binary/BinaryXmlSeeAlsoAnnotation.java | 96 - .../java/binary/BinaryXmlTransientAnnotation.java | 31 - .../java/binary/BinaryXmlTypeAnnotation.java | 212 - .../java/binary/BinaryXmlValueAnnotation.java | 31 - .../java/source/AbstractJavaResourceNode.java | 109 - .../resource/java/source/SourceAbstractType.java | 194 - .../java/source/SourceAnnotatedElement.java | 500 - .../resource/java/source/SourceAnnotation.java | 175 - .../resource/java/source/SourceAttribute.java | 321 - .../java/source/SourceCompilationUnit.java | 176 - .../internal/resource/java/source/SourceEnum.java | 215 - .../resource/java/source/SourceEnumConstant.java | 83 - .../internal/resource/java/source/SourceField.java | 53 - .../resource/java/source/SourceMember.java | 162 - .../resource/java/source/SourceMethod.java | 154 - .../internal/resource/java/source/SourceNode.java | 333 - .../resource/java/source/SourcePackage.java | 97 - .../source/SourcePackageInfoCompilationUnit.java | 123 - .../internal/resource/java/source/SourceType.java | 484 - .../java/source/SourceTypeCompilationUnit.java | 184 - .../source/SourceXmlAccessorOrderAnnotation.java | 99 - .../source/SourceXmlAccessorTypeAnnotation.java | 99 - .../source/SourceXmlAnyAttributeAnnotation.java | 43 - .../java/source/SourceXmlAnyElementAnnotation.java | 172 - .../source/SourceXmlAttachmentRefAnnotation.java | 43 - .../java/source/SourceXmlAttributeAnnotation.java | 185 - .../java/source/SourceXmlElementAnnotation.java | 362 - .../source/SourceXmlElementDeclAnnotation.java | 313 - .../java/source/SourceXmlElementRefAnnotation.java | 253 - .../source/SourceXmlElementWrapperAnnotation.java | 223 - .../java/source/SourceXmlElementsAnnotation.java | 116 - .../java/source/SourceXmlEnumAnnotation.java | 125 - .../java/source/SourceXmlEnumValueAnnotation.java | 99 - .../java/source/SourceXmlIDAnnotation.java | 43 - .../java/source/SourceXmlIDREFAnnotation.java | 43 - .../SourceXmlInlineBinaryDataAnnotation.java | 43 - .../source/SourceXmlJavaTypeAdapterAnnotation.java | 229 - .../java/source/SourceXmlListAnnotation.java | 43 - .../java/source/SourceXmlMimeTypeAnnotation.java | 98 - .../java/source/SourceXmlMixedAnnotation.java | 43 - .../java/source/SourceXmlNsAnnotation.java | 151 - .../java/source/SourceXmlRegistryAnnotation.java | 43 - .../source/SourceXmlRootElementAnnotation.java | 146 - .../java/source/SourceXmlSchemaAnnotation.java | 303 - .../java/source/SourceXmlSchemaTypeAnnotation.java | 272 - .../java/source/SourceXmlSeeAlsoAnnotation.java | 136 - .../java/source/SourceXmlTransientAnnotation.java | 43 - .../java/source/SourceXmlTypeAnnotation.java | 322 - .../java/source/SourceXmlValueAnnotation.java | 43 - .../validation/DefaultValidationMessages.java | 73 - .../validation/JaxbValidationMessages.java | 39 - .../core/internal/validation/JaxbValidator.java | 124 - .../JaxbLibraryProviderInstallOperationConfig.java | 24 - .../jpt/jaxb/core/platform/JaxbPlatform.java | 94 - .../jaxb/core/platform/JaxbPlatformDefinition.java | 66 - .../platform/JaxbPlatformDefinitionFactory.java | 30 - .../core/platform/JaxbPlatformDescription.java | 41 - .../platform/JaxbPlatformGroupDescription.java | 33 - .../jaxb/core/platform/JaxbPlatformManager.java | 45 - .../resource/java/AbstractJavaResourceType.java | 93 - .../jpt/jaxb/core/resource/java/Annotation.java | 55 - .../core/resource/java/AnnotationDefinition.java | 64 - .../eclipse/jpt/jaxb/core/resource/java/JAXB.java | 174 - .../java/JavaResourceAnnotatedElement.java | 143 - .../core/resource/java/JavaResourceAttribute.java | 104 - .../core/resource/java/JavaResourceClassFile.java | 33 - .../resource/java/JavaResourceCompilationUnit.java | 68 - .../jaxb/core/resource/java/JavaResourceEnum.java | 41 - .../resource/java/JavaResourceEnumConstant.java | 32 - .../jaxb/core/resource/java/JavaResourceField.java | 27 - .../core/resource/java/JavaResourceMember.java | 77 - .../core/resource/java/JavaResourceMethod.java | 50 - .../jaxb/core/resource/java/JavaResourceNode.java | 100 - .../core/resource/java/JavaResourcePackage.java | 32 - .../resource/java/JavaResourcePackageFragment.java | 45 - .../java/JavaResourcePackageFragmentRoot.java | 39 - .../JavaResourcePackageInfoCompilationUnit.java | 30 - .../jaxb/core/resource/java/JavaResourceType.java | 64 - .../resource/java/JaxbContainmentAnnotation.java | 86 - .../core/resource/java/NestableAnnotation.java | 34 - .../java/NestableAnnotationDefinition.java | 54 - .../jaxb/core/resource/java/XmlAccessOrder.java | 64 - .../jpt/jaxb/core/resource/java/XmlAccessType.java | 66 - .../resource/java/XmlAccessorOrderAnnotation.java | 52 - .../resource/java/XmlAccessorTypeAnnotation.java | 52 - .../resource/java/XmlAnyAttributeAnnotation.java | 31 - .../resource/java/XmlAnyElementAnnotation.java | 86 - .../resource/java/XmlAttachmentRefAnnotation.java | 31 - .../core/resource/java/XmlAttributeAnnotation.java | 30 - .../core/resource/java/XmlElementAnnotation.java | 104 - .../resource/java/XmlElementDeclAnnotation.java | 162 - .../resource/java/XmlElementRefAnnotation.java | 104 - .../resource/java/XmlElementWrapperAnnotation.java | 108 - .../core/resource/java/XmlElementsAnnotation.java | 64 - .../jaxb/core/resource/java/XmlEnumAnnotation.java | 67 - .../core/resource/java/XmlEnumValueAnnotation.java | 53 - .../jaxb/core/resource/java/XmlIDAnnotation.java | 31 - .../core/resource/java/XmlIDREFAnnotation.java | 31 - .../java/XmlInlineBinaryDataAnnotation.java | 31 - .../java/XmlJavaTypeAdapterAnnotation.java | 100 - .../jaxb/core/resource/java/XmlListAnnotation.java | 31 - .../core/resource/java/XmlMimeTypeAnnotation.java | 52 - .../core/resource/java/XmlMixedAnnotation.java | 31 - .../jaxb/core/resource/java/XmlNsAnnotation.java | 70 - .../jpt/jaxb/core/resource/java/XmlNsForm.java | 64 - .../core/resource/java/XmlRegistryAnnotation.java | 31 - .../resource/java/XmlRootElementAnnotation.java | 82 - .../core/resource/java/XmlSchemaAnnotation.java | 147 - .../resource/java/XmlSchemaTypeAnnotation.java | 117 - .../core/resource/java/XmlSeeAlsoAnnotation.java | 74 - .../core/resource/java/XmlTransientAnnotation.java | 31 - .../jaxb/core/resource/java/XmlTypeAnnotation.java | 175 - .../core/resource/java/XmlValueAnnotation.java | 31 - .../org/eclipse/jpt/jaxb/core/xsd/XsdAdapter.java | 27 - .../jaxb/core/xsd/XsdComplexTypeDefinition.java | 21 - .../jpt/jaxb/core/xsd/XsdElementDeclaration.java | 36 - .../org/eclipse/jpt/jaxb/core/xsd/XsdSchema.java | 202 - .../jpt/jaxb/core/xsd/XsdSimpleTypeDefinition.java | 21 - .../jpt/jaxb/core/xsd/XsdTypeDefinition.java | 30 - .../src/org/eclipse/jpt/jaxb/core/xsd/XsdUtil.java | 194 - .../.cvsignore | 1 - .../.project | 22 - .../META-INF/MANIFEST.MF | 7 - .../about.html | 34 - .../about.ini | 44 - .../about.mappings | 6 - .../about.properties | 24 - .../build.properties | 17 - .../icons/WTP_icon_x32_v2.png | Bin 5616 -> 0 bytes .../plugin.properties | 13 - .../.classpath | 8 - .../.cvsignore | 1 - .../.project | 28 - .../.settings/org.eclipse.jdt.core.prefs | 8 - .../META-INF/MANIFEST.MF | 12 - .../about.html | 47 - .../build.properties | 20 - .../lib/eclipselink-src.zip | Bin 5194269 -> 0 bytes .../lib/eclipselink.jar | Bin 5697505 -> 0 bytes .../plugin.properties | 24 - .../jpt/jaxb/eclipselink/core/schemagen/Main.java | 290 - .../internal/JptEclipseLinkJaxbCoreMessages.java | 43 - .../eclipselink/core/schemagen/internal/Tools.java | 104 - .../internal/jpt_eclipselink_jaxb_core.properties | 21 - jaxb/plugins/org.eclipse.jpt.jaxb.ui/.classpath | 13 - jaxb/plugins/org.eclipse.jpt.jaxb.ui/.cvsignore | 6 - jaxb/plugins/org.eclipse.jpt.jaxb.ui/.project | 28 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF | 50 - jaxb/plugins/org.eclipse.jpt.jaxb.ui/about.html | 34 - .../org.eclipse.jpt.jaxb.ui/build.properties | 23 - jaxb/plugins/org.eclipse.jpt.jaxb.ui/component.xml | 1 - .../icons/full/etool16/NewXSD.gif | Bin 364 -> 0 bytes .../icons/full/etool16/jaxb_facet.gif | Bin 220 -> 0 bytes .../icons/full/etool16/new_jaxb_project_wiz.gif | Bin 612 -> 0 bytes .../icons/full/etool16/newclass_wiz.gif | Bin 598 -> 0 bytes .../icons/full/obj16/XSDFile.gif | Bin 574 -> 0 bytes .../icons/full/obj16/dtdfile.gif | Bin 351 -> 0 bytes .../icons/full/obj16/enum_constant.gif | Bin 124 -> 0 bytes .../icons/full/obj16/jaxb_content.gif | Bin 220 -> 0 bytes .../icons/full/obj16/null-attribute-mapping.gif | Bin 911 -> 0 bytes .../icons/full/obj16/package.gif | Bin 227 -> 0 bytes .../icons/full/obj16/persistent_class.gif | Bin 586 -> 0 bytes .../icons/full/obj16/persistent_enum.gif | Bin 361 -> 0 bytes .../icons/full/obj16/persistent_field.gif | Bin 124 -> 0 bytes .../icons/full/obj16/persistent_property.gif | Bin 193 -> 0 bytes .../icons/full/obj16/text.gif | Bin 349 -> 0 bytes .../icons/full/obj16/xml-attribute.gif | Bin 897 -> 0 bytes .../icons/full/obj16/xml-element.gif | Bin 905 -> 0 bytes .../icons/full/obj16/xml-transient.gif | Bin 892 -> 0 bytes .../icons/full/obj16/xml-value.gif | Bin 905 -> 0 bytes .../icons/full/ovr16/error_ovr.gif | Bin 82 -> 0 bytes .../icons/full/wizban/NewXSD.gif | Bin 3162 -> 0 bytes .../icons/full/wizban/new_jaxb_prj_wiz.gif | Bin 2787 -> 0 bytes .../icons/full/wizban/newclass_wiz.gif | Bin 3213 -> 0 bytes .../org.eclipse.jpt.jaxb.ui/plugin.properties | 45 - jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml | 303 - .../property_files/jpt_jaxb_ui.properties | 167 - .../schema/jaxbPlatformUis.exsd | 139 - .../org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java | 116 - .../jpt/jaxb/ui/internal/ClassesGeneratorUi.java | 164 - .../JaxbJavaCompletionProposalComputer.java | 185 - .../jaxb/ui/internal/JaxbMappingImageHelper.java | 63 - .../jpt/jaxb/ui/internal/JptJaxbUiIcons.java | 40 - .../jpt/jaxb/ui/internal/JptJaxbUiMessages.java | 181 - .../ui/internal/actions/GenerateClassesAction.java | 27 - .../jpt/jaxb/ui/internal/actions/ObjectAction.java | 63 - .../jaxb/ui/internal/filters/ContainerFilter.java | 40 - .../internal/filters/EmptyInnerPackageFilter.java | 44 - .../filters/NonArchiveOrExternalElementFilter.java | 37 - .../ui/internal/filters/NonContainerFilter.java | 55 - .../ui/internal/filters/NonJavaElementFilter.java | 51 - ...Jaxb_2_1_NavigatorItemLabelProviderFactory.java | 70 - ..._1_NavigatorTreeItemContentProviderFactory.java | 66 - .../jaxb21/GenericJaxb_2_1_NavigatorUi.java | 43 - .../jaxb21/GenericJaxb_2_1_PlatformUi.java | 22 - .../jaxb21/JaxbContextRootItemContentProvider.java | 52 - .../jaxb21/JaxbContextRootItemLabelProvider.java | 54 - .../jaxb21/JaxbEnumConstantItemLabelProvider.java | 51 - .../jaxb21/JaxbPackageItemContentProvider.java | 51 - .../jaxb21/JaxbPackageItemLabelProvider.java | 49 - .../JaxbPersistentAttributeItemLabelProvider.java | 58 - .../JaxbPersistentClassItemContentProvider.java | 51 - .../JaxbPersistentEnumItemContentProvider.java | 51 - .../JaxbPersistentEnumItemLabelProvider.java | 51 - .../JaxbPersistentFieldItemLabelProvider.java | 31 - .../JaxbPersistentPropertyItemLabelProvider.java | 30 - .../jaxb21/JaxbRegistryItemContentProvider.java | 39 - .../internal/jaxb21/JaxbTypeItemLabelProvider.java | 49 - .../jaxb22/GenericJaxb_2_2_PlatformUi.java | 23 - .../JaxbNavigatorContentAndLabelProvider.java | 22 - .../navigator/JaxbNavigatorContentProvider.java | 232 - .../JaxbNavigatorItemLabelProviderFactory.java | 72 - .../navigator/JaxbNavigatorLabelProvider.java | 138 - ...axbNavigatorTreeItemContentProviderFactory.java | 72 - .../ui/internal/platform/JaxbPlatformUiConfig.java | 71 - .../platform/JaxbPlatformUiManagerImpl.java | 132 - .../ui/internal/properties/JaxbProjectModel.java | 71 - .../properties/JaxbProjectPropertiesPage.java | 315 - .../properties/JaxbSchemasPropertiesPage.java | 912 -- .../ui/internal/wizards/JavaProjectWizardPage.java | 252 - .../ui/internal/wizards/ProjectWizardPage.java | 246 - ...ClassesGeneratorExtensionOptionsWizardPage.java | 186 - .../ClassesGeneratorOptionsWizardPage.java | 805 -- .../wizards/classesgen/ClassesGeneratorWizard.java | 357 - .../classesgen/ClassesGeneratorWizardPage.java | 643 - .../wizards/classesgen/SchemaWizardPage.java | 190 - .../classesgen/SelectFileOrXMLCatalogIdPanel.java | 185 - .../classesgen/SelectSingleFileViewFacade.java | 58 - .../classesgen/SelectXMLCatalogIdPanel.java | 146 - .../wizards/classesgen/XMLCatalogTableViewer.java | 195 - .../wizards/facet/JaxbFacetInstallPage.java | 21 - .../ui/internal/wizards/facet/JaxbFacetPage.java | 178 - .../wizards/facet/JaxbFacetVersionChangePage.java | 21 - .../internal/wizards/proj/JaxbProjectWizard.java | 58 - .../wizards/proj/JaxbProjectWizardFirstPage.java | 90 - .../JaxbProjectCreationDataModelProvider.java | 39 - .../AbstractJarDestinationWizardPage.java | 26 - .../schemagen/CheckboxTreeAndListGroup.java | 856 -- .../wizards/schemagen/NewSchemaFileWizardPage.java | 204 - .../wizards/schemagen/SchemaGeneratorWizard.java | 267 - .../schemagen/SchemaGeneratorWizardPage.java | 439 - .../jpt/jaxb/ui/navigator/JaxbNavigatorUi.java | 40 - .../jpt/jaxb/ui/platform/JaxbPlatformUi.java | 40 - .../jaxb/ui/platform/JaxbPlatformUiManager.java | 35 - .../org.eclipse.jpt.jaxb.core.tests/.classpath | 14 - .../tests/org.eclipse.jpt.jaxb.core.tests/.project | 28 - .../META-INF/MANIFEST.MF | 30 - .../org.eclipse.jpt.jaxb.core.tests/about.html | 34 - .../build.properties | 18 - .../plugin.properties | 23 - .../jaxb/core/tests/JptJaxbCoreTestsPlugin.java | 57 - .../jaxb/core/tests/internal/JaxbCoreTests.java | 31 - .../jpt/jaxb/core/tests/internal/JaxbTestCase.java | 71 - .../core/tests/internal/SchemaLibraryTests.java | 122 - .../internal/context/GenericContextRootTests.java | 344 - .../internal/context/JaxbContextModelTestCase.java | 42 - .../context/JaxbCoreContextModelTests.java | 32 - ...enericJavaAttributeXmlJavaTypeAdapterTests.java | 171 - .../java/GenericJavaElementFactoryMethodTests.java | 404 - .../context/java/GenericJavaEnumConstantTests.java | 135 - .../context/java/GenericJavaPackageInfoTests.java | 797 -- .../GenericJavaPackageXmlJavaTypeAdapterTests.java | 161 - .../java/GenericJavaPersistentClassTests.java | 2121 ---- .../java/GenericJavaPersistentEnumTests.java | 740 -- .../context/java/GenericJavaRegistryTests.java | 209 - .../GenericJavaTypeXmlJavaTypeAdapterTests.java | 171 - .../java/GenericJavaXmlAttributeMappingTests.java | 437 - .../java/GenericJavaXmlElementMappingTests.java | 654 - .../java/GenericJavaXmlRootElementTests.java | 166 - .../context/java/GenericJavaXmlSchemaTests.java | 662 - .../java/GenericJavaXmlSchemaTypeTests.java | 207 - .../java/GenericJavaXmlValueMappingTests.java | 151 - .../java/JaxbCoreJavaContextModelTests.java | 42 - .../tests/internal/projects/TestJaxbProject.java | 68 - .../resource/JaxbCoreResourceModelTests.java | 32 - .../resource/java/JavaResourceModelTestCase.java | 197 - .../java/JaxbJavaResourceModelTestCase.java | 33 - .../resource/java/JaxbJavaResourceModelTests.java | 61 - .../XmlAccessorOrderPackageAnnotationTests.java | 60 - .../java/XmlAccessorOrderTypeAnnotationTests.java | 94 - .../XmlAccessorTypePackageAnnotationTests.java | 66 - .../java/XmlAccessorTypeTypeAnnotationTests.java | 106 - .../java/XmlAnyAttributeAnnotationTests.java | 51 - .../java/XmlAnyElementAnnotationTests.java | 136 - .../java/XmlAttachmentRefAnnotationTests.java | 51 - .../resource/java/XmlAttributeAnnotationTests.java | 174 - .../resource/java/XmlElementAnnotationTests.java | 283 - .../java/XmlElementDeclAnnotationTests.java | 280 - .../java/XmlElementRefAnnotationTests.java | 191 - .../java/XmlElementWrapperAnnotationTests.java | 203 - .../resource/java/XmlEnumAnnotationTests.java | 89 - .../resource/java/XmlEnumValueAnnotationTests.java | 109 - .../resource/java/XmlIDAnnotationTests.java | 51 - .../resource/java/XmlIDREFAnnotationTests.java | 51 - ...mlInlineBinaryDataAttributeAnnotationTests.java | 51 - .../XmlInlineBinaryDataTypeAnnotationTests.java | 49 - .../XmlJavaTypeAdapterPackageAnnotationTests.java | 267 - .../XmlJavaTypeAdapterTypeAnnotationTests.java | 111 - .../resource/java/XmlListAnnotationTests.java | 51 - .../resource/java/XmlMimeTypeAnnotationTests.java | 108 - .../resource/java/XmlMixedAnnotationTests.java | 51 - .../resource/java/XmlRegistryAnnotationTests.java | 49 - .../java/XmlRootElementAnnotationTests.java | 131 - .../resource/java/XmlSchemaAnnotationTests.java | 263 - .../XmlSchemaTypeAttributeAnnotationTests.java | 156 - .../java/XmlSchemaTypePackageAnnotationTests.java | 240 - .../resource/java/XmlSeeAlsoAnnotationTests.java | 159 - .../java/XmlTransientAttributeAnnotationTests.java | 51 - .../java/XmlTransientTypeAnnotationTests.java | 49 - .../resource/java/XmlTypeAnnotationTests.java | 340 - .../resource/java/XmlValueAnnotationTests.java | 51 - .../tests/org.eclipse.jpt.jaxb.core.tests/test.xml | 35 - .../org.eclipse.jpt.eclipselink.feature/.cvsignore | 1 - .../org.eclipse.jpt.eclipselink.feature/.project | 17 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../build.properties | 15 - .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../epl-v10.html | 328 - .../feature.properties | 163 - .../feature.xml | 53 - .../license.html | 107 - .../sourceTemplateBundle/about.html | 27 - .../sourceTemplateBundle/about.ini | 31 - .../sourceTemplateBundle/about.mappings | 6 - .../sourceTemplateBundle/about.properties | 26 - .../sourceTemplateBundle/build.properties | 21 - .../sourceTemplateBundle/eclipse32.gif | Bin 1706 -> 0 bytes .../sourceTemplateBundle/eclipse32.png | Bin 4634 -> 0 bytes .../sourceTemplateBundle/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplateBundle/epl-v10.html | 328 - .../sourceTemplateBundle/license.html | 86 - .../sourceTemplateBundle/plugin.properties | 13 - .../sourceTemplateFeature/build.properties | 16 - .../sourceTemplateFeature/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplateFeature/epl-v10.html | 328 - .../sourceTemplateFeature/feature.properties | 168 - .../sourceTemplateFeature/license.html | 107 - .../sourceTemplatePlugin/about.html | 27 - .../sourceTemplatePlugin/about.ini | 31 - .../sourceTemplatePlugin/about.mappings | 6 - .../sourceTemplatePlugin/about.properties | 26 - .../sourceTemplatePlugin/build.properties | 21 - .../sourceTemplatePlugin/eclipse32.gif | Bin 1706 -> 0 bytes .../sourceTemplatePlugin/eclipse32.png | Bin 4634 -> 0 bytes .../sourceTemplatePlugin/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplatePlugin/epl-v10.html | 328 - .../sourceTemplatePlugin/license.html | 86 - .../sourceTemplatePlugin/plugin.properties | 13 - .../.cvsignore | 3 - .../.project | 17 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../build.properties | 7 - .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../epl-v10.html | 328 - .../feature.properties | 163 - .../feature.xml | 28 - .../license.html | 107 - jpa/features/org.eclipse.jpt.feature/.cvsignore | 1 - jpa/features/org.eclipse.jpt.feature/.project | 17 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../org.eclipse.jpt.feature/build.properties | 15 - .../org.eclipse.jpt.feature/eclipse_update_120.jpg | Bin 21695 -> 0 bytes jpa/features/org.eclipse.jpt.feature/epl-v10.html | 328 - .../org.eclipse.jpt.feature/feature.properties | 163 - jpa/features/org.eclipse.jpt.feature/feature.xml | 132 - jpa/features/org.eclipse.jpt.feature/license.html | 107 - .../sourceTemplateBundle/about.html | 27 - .../sourceTemplateBundle/about.ini | 31 - .../sourceTemplateBundle/about.mappings | 6 - .../sourceTemplateBundle/about.properties | 26 - .../sourceTemplateBundle/build.properties | 12 - .../sourceTemplateBundle/eclipse32.gif | Bin 1706 -> 0 bytes .../sourceTemplateBundle/eclipse32.png | Bin 4634 -> 0 bytes .../sourceTemplateBundle/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplateBundle/epl-v10.html | 328 - .../sourceTemplateBundle/license.html | 86 - .../sourceTemplateBundle/plugin.properties | 13 - .../sourceTemplateFeature/build.properties | 16 - .../sourceTemplateFeature/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplateFeature/epl-v10.html | 328 - .../sourceTemplateFeature/feature.properties | 168 - .../sourceTemplateFeature/license.html | 107 - .../sourceTemplatePlugin/about.html | 27 - .../sourceTemplatePlugin/about.ini | 31 - .../sourceTemplatePlugin/about.mappings | 6 - .../sourceTemplatePlugin/about.properties | 26 - .../sourceTemplatePlugin/build.properties | 12 - .../sourceTemplatePlugin/eclipse32.gif | Bin 1706 -> 0 bytes .../sourceTemplatePlugin/eclipse32.png | Bin 4634 -> 0 bytes .../sourceTemplatePlugin/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplatePlugin/epl-v10.html | 328 - .../sourceTemplatePlugin/license.html | 86 - .../sourceTemplatePlugin/plugin.properties | 13 - .../.cvsignore | 3 - .../.project | 17 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../build.properties | 7 - .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../epl-v10.html | 328 - .../feature.properties | 163 - .../feature.xml | 28 - .../license.html | 107 - .../org.eclipse.jpt.jpa.feature/.cvsignore | 1 - jpa/features/org.eclipse.jpt.jpa.feature/.project | 17 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../org.eclipse.jpt.jpa.feature/build.properties | 15 - .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../org.eclipse.jpt.jpa.feature/epl-v10.html | 328 - .../org.eclipse.jpt.jpa.feature/feature.properties | 163 - .../org.eclipse.jpt.jpa.feature/feature.xml | 132 - .../org.eclipse.jpt.jpa.feature/license.html | 107 - .../sourceTemplateBundle/about.html | 27 - .../sourceTemplateBundle/about.ini | 31 - .../sourceTemplateBundle/about.mappings | 6 - .../sourceTemplateBundle/about.properties | 26 - .../sourceTemplateBundle/build.properties | 12 - .../sourceTemplateBundle/eclipse32.gif | Bin 1706 -> 0 bytes .../sourceTemplateBundle/eclipse32.png | Bin 4634 -> 0 bytes .../sourceTemplateBundle/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplateBundle/epl-v10.html | 328 - .../sourceTemplateBundle/license.html | 86 - .../sourceTemplateBundle/plugin.properties | 13 - .../sourceTemplateFeature/build.properties | 16 - .../sourceTemplateFeature/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplateFeature/epl-v10.html | 328 - .../sourceTemplateFeature/feature.properties | 168 - .../sourceTemplateFeature/license.html | 107 - .../sourceTemplatePlugin/about.html | 27 - .../sourceTemplatePlugin/about.ini | 31 - .../sourceTemplatePlugin/about.mappings | 6 - .../sourceTemplatePlugin/about.properties | 26 - .../sourceTemplatePlugin/build.properties | 12 - .../sourceTemplatePlugin/eclipse32.gif | Bin 1706 -> 0 bytes .../sourceTemplatePlugin/eclipse32.png | Bin 4634 -> 0 bytes .../sourceTemplatePlugin/eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../sourceTemplatePlugin/epl-v10.html | 328 - .../sourceTemplatePlugin/license.html | 86 - .../sourceTemplatePlugin/plugin.properties | 13 - .../org.eclipse.jpt.jpa_sdk.feature/.cvsignore | 3 - .../org.eclipse.jpt.jpa_sdk.feature/.project | 17 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../build.properties | 7 - .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../org.eclipse.jpt.jpa_sdk.feature/epl-v10.html | 328 - .../feature.properties | 163 - .../org.eclipse.jpt.jpa_sdk.feature/feature.xml | 35 - .../org.eclipse.jpt.jpa_sdk.feature/license.html | 107 - .../org.eclipse.jpt.tests.feature/.cvsignore | 1 - .../org.eclipse.jpt.tests.feature/.project | 17 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../org.eclipse.jpt.tests.feature/build.properties | 10 - .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../org.eclipse.jpt.tests.feature/epl-v10.html | 328 - .../feature.properties | 171 - .../org.eclipse.jpt.tests.feature/feature.xml | 50 - .../org.eclipse.jpt.tests.feature/license.html | 107 - .../org.eclipse.jpt_sdk.feature/.cvsignore | 3 - jpa/features/org.eclipse.jpt_sdk.feature/.project | 17 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../org.eclipse.jpt_sdk.feature/build.properties | 7 - .../eclipse_update_120.jpg | Bin 21695 -> 0 bytes .../org.eclipse.jpt_sdk.feature/epl-v10.html | 328 - .../org.eclipse.jpt_sdk.feature/feature.properties | 163 - .../org.eclipse.jpt_sdk.feature/feature.xml | 35 - .../org.eclipse.jpt_sdk.feature/license.html | 107 - jpa/plugins/org.eclipse.jpt.branding/.cvsignore | 2 - jpa/plugins/org.eclipse.jpt.branding/.project | 22 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../org.eclipse.jpt.branding/META-INF/MANIFEST.MF | 7 - jpa/plugins/org.eclipse.jpt.branding/about.html | 34 - jpa/plugins/org.eclipse.jpt.branding/about.ini | 44 - .../org.eclipse.jpt.branding/about.mappings | 6 - .../org.eclipse.jpt.branding/about.properties | 24 - .../org.eclipse.jpt.branding/build.properties | 18 - jpa/plugins/org.eclipse.jpt.branding/component.xml | 13 - .../icons/WTP_icon_x32_v2.png | Bin 5616 -> 0 bytes .../org.eclipse.jpt.branding/plugin.properties | 13 - jpa/plugins/org.eclipse.jpt.core/.project | 5 - jpa/plugins/org.eclipse.jpt.db.ui/.project | 5 - jpa/plugins/org.eclipse.jpt.db/.project | 5 - jpa/plugins/org.eclipse.jpt.doc.user/.project | 22 - .../org.eclipse.jpt.doc.user/META-INF/MANIFEST.MF | 9 - jpa/plugins/org.eclipse.jpt.doc.user/about.htm | 43 - jpa/plugins/org.eclipse.jpt.doc.user/about.html | 43 - .../org.eclipse.jpt.doc.user/build.properties | 136 - .../cheatsheets/add_persistence.xml | 63 - .../cheatsheets/create_entity.xml | 44 - .../cheatsheets/map_entity.xml | 88 - .../org.eclipse.jpt.doc.user/concept_mapping.htm | 46 - .../concept_persistence.htm | 41 - jpa/plugins/org.eclipse.jpt.doc.user/concepts.htm | 63 - .../org.eclipse.jpt.doc.user/concepts001.htm | 43 - .../org.eclipse.jpt.doc.user/concepts002.htm | 58 - .../org.eclipse.jpt.doc.user/concepts003.htm | 60 - jpa/plugins/org.eclipse.jpt.doc.user/contexts.xml | 646 - .../dcommon/css/blafdoc.css | 21 - .../org.eclipse.jpt.doc.user/dcommon/html/cpyr.htm | 11 - .../org.eclipse.jpt.doc.user/getting_started.htm | 47 - .../getting_started001.htm | 80 - .../getting_started002.htm | 49 - .../getting_started003.htm | 105 - .../getting_started004.htm | 204 - .../img/address.java_jpa_details.png | Bin 14825 -> 0 bytes .../img/address_id_details_quickstart.png | Bin 11473 -> 0 bytes .../img/address_java_JPA_structure_quickstart.png | Bin 4148 -> 0 bytes .../img/create_jpa_entity_wizard.png | Bin 21428 -> 0 bytes .../img/create_jpa_fields.png | Bin 21454 -> 0 bytes .../img/customize_default_entity_generation.png | Bin 27589 -> 0 bytes .../img/customize_individual_entities.png | Bin 24998 -> 0 bytes .../img/details_entitymappings.png | Bin 10563 -> 0 bytes .../org.eclipse.jpt.doc.user/img/error_sample.png | Bin 13762 -> 0 bytes .../img/generate_classes_from_schema.png | Bin 16127 -> 0 bytes .../img/generate_entities.png | Bin 11583 -> 0 bytes .../img/icon_basicmapmappings.png | Bin 361 -> 0 bytes .../img/icon_basicmapping.png | Bin 476 -> 0 bytes .../img/inheritance_join.png | Bin 11615 -> 0 bytes .../img/inheritance_single.png | Bin 3359 -> 0 bytes .../img/inheritance_tab.png | Bin 8101 -> 0 bytes .../img/java_editor_address.png | Bin 8380 -> 0 bytes .../img/jaxb_schmea_generation_dialog.png | Bin 18846 -> 0 bytes .../img/jpa_wizard_create_fields.png | Bin 7864 -> 0 bytes .../img/mapped_entity_type_link.png | Bin 14896 -> 0 bytes .../img/mapping_file_new.png | Bin 19392 -> 0 bytes .../img/mapping_type_selection_embed.png | Bin 15128 -> 0 bytes .../img/mapping_type_selection_entity.png | Bin 14985 -> 0 bytes .../img/mapping_type_selection_superclass.png | Bin 15162 -> 0 bytes .../img/modify_faceted_project.png | Bin 28047 -> 0 bytes .../img/new_icon_basicmappings.png | Bin 332 -> 0 bytes .../img/new_icon_embeddableentitymapping.png | Bin 700 -> 0 bytes .../img/new_icon_embeddedidmapping.png | Bin 477 -> 0 bytes .../img/new_icon_embeddedmapping.png | Bin 321 -> 0 bytes .../img/new_icon_idmapping.png | Bin 461 -> 0 bytes .../img/new_icon_manytomanymapping.png | Bin 311 -> 0 bytes .../img/new_icon_manytoonemapping.png | Bin 316 -> 0 bytes .../img/new_icon_mappedentity.png | Bin 682 -> 0 bytes .../img/new_icon_mappedsuperclass.png | Bin 681 -> 0 bytes .../img/new_icon_onetomanymapping.png | Bin 325 -> 0 bytes .../img/new_icon_onetoonemapping.png | Bin 270 -> 0 bytes .../img/new_icon_transientmapping.png | Bin 303 -> 0 bytes .../img/new_icon_versionmapping.png | Bin 373 -> 0 bytes .../img/new_jpa_facet_task.png | Bin 27810 -> 0 bytes .../img/new_jpa_perspective_button.png | Bin 387 -> 0 bytes .../img/new_jpa_project_task.png | Bin 26056 -> 0 bytes .../org.eclipse.jpt.doc.user/img/ngrelc.png | Bin 667 -> 0 bytes .../org.eclipse.jpt.doc.user/img/ngrelr.png | Bin 615 -> 0 bytes .../org.eclipse.jpt.doc.user/img/ngrelt.png | Bin 568 -> 0 bytes .../img/persistence_outline_view.png | Bin 8746 -> 0 bytes .../img/project_properties_tasks.png | Bin 29075 -> 0 bytes .../img/quickstart_project.png | Bin 9676 -> 0 bytes .../img/secondary_tables.png | Bin 4408 -> 0 bytes .../img/select_a_wizard_entity.png | Bin 20222 -> 0 bytes .../img/select_a_wizard_jpa_project.png | Bin 20446 -> 0 bytes .../img/select_a_wizard_mapping.png | Bin 22231 -> 0 bytes .../img/select_jaxb_schema_wizard.png | Bin 20015 -> 0 bytes .../org.eclipse.jpt.doc.user/img/select_tables.png | Bin 21639 -> 0 bytes .../img/synchornize_classes.png | Bin 10643 -> 0 bytes .../img/table_associations.png | Bin 26207 -> 0 bytes .../org.eclipse.jpt.doc.user/img/table_entity.png | Bin 9169 -> 0 bytes .../img/task_entering_query.png | Bin 9338 -> 0 bytes .../img/upgrade_persistence_jpa_version.png | Bin 5208 -> 0 bytes jpa/plugins/org.eclipse.jpt.doc.user/index.xml | 668 - jpa/plugins/org.eclipse.jpt.doc.user/legal.htm | 40 - .../org.eclipse.jpt.doc.user/plugin.properties | 32 - jpa/plugins/org.eclipse.jpt.doc.user/plugin.xml | 37 - .../ref_EntityClassPage.htm | 115 - .../ref_EntityPropertiesPage.htm | 117 - .../org.eclipse.jpt.doc.user/ref_add_converter.htm | 78 - .../ref_association_cardinality.htm | 65 - .../ref_association_table.htm | 74 - .../ref_configure_jaxb_class_generation_dialog.htm | 77 - .../ref_create_custom_entities_wizard.htm | 53 - .../ref_create_jpa_entity_wizard.htm | 46 - .../ref_create_new_association_wizard.htm | 50 - .../ref_customizIndividualEntities.htm | 89 - .../ref_customizeDefaultEntityGeneration.htm | 96 - .../org.eclipse.jpt.doc.user/ref_details_orm.htm | 56 - .../ref_eclipselink_mapping_file.htm | 81 - .../org.eclipse.jpt.doc.user/ref_java_page.htm | 74 - .../ref_jaxb_schema_wizard.htm | 50 - .../org.eclipse.jpt.doc.user/ref_join_columns.htm | 50 - .../org.eclipse.jpt.doc.user/ref_jpa_facet.htm | 122 - .../ref_mapping_general.htm | 272 - .../ref_new_jpa_project.htm | 104 - .../ref_new_jpa_project_wizard.htm | 49 - .../ref_persistence_general.htm | 126 - .../ref_persistence_map_view.htm | 52 - .../ref_persistence_outline.htm | 49 - .../ref_persistence_perspective.htm | 56 - .../ref_persistence_prop_view.htm | 52 - .../ref_persistence_xmll_editor.htm | 82 - .../org.eclipse.jpt.doc.user/ref_primary_key.htm | 142 - .../ref_project_properties.htm | 98 - .../ref_schema_from_classes_page.htm | 42 - .../org.eclipse.jpt.doc.user/ref_selectTables.htm | 79 - .../ref_select_cascade_dialog.htm | 40 - .../ref_tableAssociations.htm | 78 - jpa/plugins/org.eclipse.jpt.doc.user/reference.htm | 60 - .../org.eclipse.jpt.doc.user/reference001.htm | 58 - .../org.eclipse.jpt.doc.user/reference002.htm | 39 - .../org.eclipse.jpt.doc.user/reference003.htm | 134 - .../org.eclipse.jpt.doc.user/reference004.htm | 49 - .../org.eclipse.jpt.doc.user/reference005.htm | 52 - .../org.eclipse.jpt.doc.user/reference006.htm | 122 - .../org.eclipse.jpt.doc.user/reference007.htm | 80 - .../org.eclipse.jpt.doc.user/reference008.htm | 48 - .../org.eclipse.jpt.doc.user/reference009.htm | 113 - .../org.eclipse.jpt.doc.user/reference010.htm | 47 - .../org.eclipse.jpt.doc.user/reference011.htm | 82 - .../org.eclipse.jpt.doc.user/reference012.htm | 71 - .../org.eclipse.jpt.doc.user/reference013.htm | 98 - .../org.eclipse.jpt.doc.user/reference014.htm | 106 - .../org.eclipse.jpt.doc.user/reference015.htm | 116 - .../org.eclipse.jpt.doc.user/reference016.htm | 76 - .../org.eclipse.jpt.doc.user/reference017.htm | 46 - .../org.eclipse.jpt.doc.user/reference018.htm | 183 - .../org.eclipse.jpt.doc.user/reference019.htm | 221 - .../org.eclipse.jpt.doc.user/reference020.htm | 185 - .../org.eclipse.jpt.doc.user/reference021.htm | 241 - .../org.eclipse.jpt.doc.user/reference022.htm | 170 - .../org.eclipse.jpt.doc.user/reference023.htm | 143 - .../org.eclipse.jpt.doc.user/reference024.htm | 41 - .../org.eclipse.jpt.doc.user/reference025.htm | 46 - .../org.eclipse.jpt.doc.user/reference026.htm | 46 - .../org.eclipse.jpt.doc.user/reference027.htm | 108 - .../org.eclipse.jpt.doc.user/reference028.htm | 49 - .../org.eclipse.jpt.doc.user/reference029.htm | 67 - .../org.eclipse.jpt.doc.user/reference030.htm | 46 - .../org.eclipse.jpt.doc.user/reference031.htm | 125 - .../org.eclipse.jpt.doc.user/reference032.htm | 62 - .../org.eclipse.jpt.doc.user/reference033.htm | 53 - .../task_add_persistence.htm | 60 - .../task_additonal_tables.htm | 84 - .../task_create_jpa_entity.htm | 160 - .../task_create_new_project.htm | 141 - .../task_generate_classes_from_schema.htm | 55 - .../task_generating_schema_from_classes.htm | 74 - .../org.eclipse.jpt.doc.user/task_inheritance.htm | 138 - .../org.eclipse.jpt.doc.user/task_manage_orm.htm | 64 - .../task_manage_persistence.htm | 222 - .../org.eclipse.jpt.doc.user/task_mapping.htm | 77 - jpa/plugins/org.eclipse.jpt.doc.user/tasks.htm | 81 - jpa/plugins/org.eclipse.jpt.doc.user/tasks001.htm | 85 - jpa/plugins/org.eclipse.jpt.doc.user/tasks002.htm | 74 - jpa/plugins/org.eclipse.jpt.doc.user/tasks003.htm | 43 - jpa/plugins/org.eclipse.jpt.doc.user/tasks004.htm | 58 - jpa/plugins/org.eclipse.jpt.doc.user/tasks005.htm | 66 - jpa/plugins/org.eclipse.jpt.doc.user/tasks006.htm | 96 - jpa/plugins/org.eclipse.jpt.doc.user/tasks007.htm | 70 - jpa/plugins/org.eclipse.jpt.doc.user/tasks008.htm | 84 - jpa/plugins/org.eclipse.jpt.doc.user/tasks009.htm | 65 - jpa/plugins/org.eclipse.jpt.doc.user/tasks010.htm | 183 - jpa/plugins/org.eclipse.jpt.doc.user/tasks011.htm | 97 - jpa/plugins/org.eclipse.jpt.doc.user/tasks012.htm | 91 - jpa/plugins/org.eclipse.jpt.doc.user/tasks013.htm | 176 - jpa/plugins/org.eclipse.jpt.doc.user/tasks014.htm | 179 - jpa/plugins/org.eclipse.jpt.doc.user/tasks015.htm | 167 - jpa/plugins/org.eclipse.jpt.doc.user/tasks016.htm | 197 - jpa/plugins/org.eclipse.jpt.doc.user/tasks017.htm | 146 - jpa/plugins/org.eclipse.jpt.doc.user/tasks018.htm | 66 - jpa/plugins/org.eclipse.jpt.doc.user/tasks019.htm | 136 - jpa/plugins/org.eclipse.jpt.doc.user/tasks020.htm | 40 - jpa/plugins/org.eclipse.jpt.doc.user/tasks021.htm | 95 - jpa/plugins/org.eclipse.jpt.doc.user/tasks022.htm | 61 - jpa/plugins/org.eclipse.jpt.doc.user/tasks023.htm | 54 - jpa/plugins/org.eclipse.jpt.doc.user/tasks024.htm | 92 - jpa/plugins/org.eclipse.jpt.doc.user/tasks025.htm | 50 - jpa/plugins/org.eclipse.jpt.doc.user/tasks026.htm | 63 - .../org.eclipse.jpt.doc.user/tips_and_tricks.htm | 68 - jpa/plugins/org.eclipse.jpt.doc.user/toc.xml | 155 - jpa/plugins/org.eclipse.jpt.doc.user/whats_new.htm | 50 - .../org.eclipse.jpt.doc.user/whats_new001.htm | 39 - .../org.eclipse.jpt.doc.user/whats_new002.htm | 51 - .../org.eclipse.jpt.doc.user/whats_new003.htm | 63 - .../org.eclipse.jpt.doc.user/whats_new004.htm | 41 - .../org.eclipse.jpt.doc.user/whats_new005.htm | 41 - .../org.eclipse.jpt.doc.user/whats_new006.htm | 39 - .../.cvsignore | 1 - .../org.eclipse.jpt.eclipselink.branding/.project | 22 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../META-INF/MANIFEST.MF | 7 - .../about.html | 34 - .../org.eclipse.jpt.eclipselink.branding/about.ini | 44 - .../about.mappings | 6 - .../about.properties | 24 - .../build.properties | 17 - .../icons/WTP_icon_x32_v2.png | Bin 5616 -> 0 bytes .../plugin.properties | 13 - .../.project | 5 - .../org.eclipse.jpt.eclipselink.core/.project | 5 - .../.project | 5 - .../org.eclipse.jpt.eclipselink.ui/.project | 5 - jpa/plugins/org.eclipse.jpt.gen/.project | 5 - .../org.eclipse.jpt.jaxb.core.schemagen/.project | 5 - jpa/plugins/org.eclipse.jpt.jaxb.ui/.project | 5 - jpa/plugins/org.eclipse.jpt.jpa.core/.classpath | 13 - jpa/plugins/org.eclipse.jpt.jpa.core/.cvsignore | 6 - jpa/plugins/org.eclipse.jpt.jpa.core/.project | 28 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.jdt.core.prefs | 12 - .../org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF | 97 - jpa/plugins/org.eclipse.jpt.jpa.core/about.html | 34 - .../org.eclipse.jpt.jpa.core/build.properties | 22 - jpa/plugins/org.eclipse.jpt.jpa.core/component.xml | 12 - .../model/DaliEmfFormatter.xml | 274 - .../org.eclipse.jpt.jpa.core/model/common.ecore | 14 - .../model/jpaResourceModels.genmodel | 513 - .../org.eclipse.jpt.jpa.core/model/orm.ecore | 578 - .../model/persistence.ecore | 84 - .../org.eclipse.jpt.jpa.core/plugin.properties | 59 - jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml | 679 - .../property_files/jpa_core.properties | 49 - .../property_files/jpa_core_refactoring.properties | 61 - .../property_files/jpa_validation.properties | 224 - .../jpa_validation_description.properties | 23 - .../schema/jpaPlatforms.exsd | 210 - ...tityGeneratorDatabaseAnnotationNameBuilder.java | 78 - .../jpt/jpa/core/GenericJpaProjectManager.java | 1100 -- .../jpa/core/JpaAnnotationDefinitionProvider.java | 51 - .../jpt/jpa/core/JpaAnnotationProvider.java | 144 - .../org/eclipse/jpt/jpa/core/JpaDataSource.java | 81 - .../src/org/eclipse/jpt/jpa/core/JpaFacet.java | 55 - .../src/org/eclipse/jpt/jpa/core/JpaFactory.java | 270 - .../src/org/eclipse/jpt/jpa/core/JpaFile.java | 99 - .../src/org/eclipse/jpt/jpa/core/JpaNode.java | 53 - .../src/org/eclipse/jpt/jpa/core/JpaPlatform.java | 198 - .../eclipse/jpt/jpa/core/JpaPlatformFactory.java | 32 - .../eclipse/jpt/jpa/core/JpaPlatformProvider.java | 71 - .../eclipse/jpt/jpa/core/JpaPlatformVariation.java | 60 - .../src/org/eclipse/jpt/jpa/core/JpaProject.java | 549 - .../eclipse/jpt/jpa/core/JpaProjectManager.java | 74 - .../jpt/jpa/core/JpaResourceModelProvider.java | 42 - .../org/eclipse/jpt/jpa/core/JpaStructureNode.java | 64 - .../org/eclipse/jpt/jpa/core/JptJpaCorePlugin.java | 774 -- .../src/org/eclipse/jpt/jpa/core/MappingKeys.java | 44 - .../eclipse/jpt/jpa/core/ResourceDefinition.java | 33 - .../eclipse/jpt/jpa/core/context/AccessHolder.java | 52 - .../eclipse/jpt/jpa/core/context/AccessType.java | 101 - .../jpt/jpa/core/context/AssociationOverride.java | 34 - .../core/context/AssociationOverrideContainer.java | 74 - .../jpt/jpa/core/context/AttributeMapping.java | 160 - .../jpt/jpa/core/context/AttributeOverride.java | 34 - .../core/context/AttributeOverrideContainer.java | 55 - .../eclipse/jpt/jpa/core/context/BaseColumn.java | 66 - .../jpt/jpa/core/context/BaseEmbeddedMapping.java | 39 - .../jpt/jpa/core/context/BaseJoinColumn.java | 58 - .../eclipse/jpt/jpa/core/context/BasicMapping.java | 28 - .../org/eclipse/jpt/jpa/core/context/Cascade.java | 46 - .../jpt/jpa/core/context/CollectionMapping.java | 75 - .../org/eclipse/jpt/jpa/core/context/Column.java | 36 - .../jpt/jpa/core/context/ColumnMapping.java | 28 - .../eclipse/jpt/jpa/core/context/Converter.java | 33 - .../jpt/jpa/core/context/ConvertibleMapping.java | 39 - .../jpt/jpa/core/context/DiscriminatorColumn.java | 87 - .../jpt/jpa/core/context/DiscriminatorType.java | 99 - .../eclipse/jpt/jpa/core/context/Embeddable.java | 29 - .../jpt/jpa/core/context/EmbeddedIdMapping.java | 28 - .../jpt/jpa/core/context/EmbeddedMapping.java | 28 - .../org/eclipse/jpt/jpa/core/context/Entity.java | 292 - .../org/eclipse/jpt/jpa/core/context/EnumType.java | 95 - .../jpt/jpa/core/context/EnumeratedConverter.java | 36 - .../eclipse/jpt/jpa/core/context/FetchType.java | 95 - .../jpt/jpa/core/context/FetchableMapping.java | 35 - .../jpt/jpa/core/context/GeneratedValue.java | 41 - .../jpt/jpa/core/context/GenerationType.java | 103 - .../eclipse/jpt/jpa/core/context/Generator.java | 94 - .../jpt/jpa/core/context/GeneratorContainer.java | 49 - .../jpt/jpa/core/context/IdClassReference.java | 91 - .../eclipse/jpt/jpa/core/context/IdMapping.java | 33 - .../jpt/jpa/core/context/InheritanceType.java | 99 - .../eclipse/jpt/jpa/core/context/JoinColumn.java | 47 - .../jpa/core/context/JoinColumnRelationship.java | 42 - .../context/JoinColumnRelationshipStrategy.java | 77 - .../eclipse/jpt/jpa/core/context/JoinTable.java | 84 - .../jpa/core/context/JoinTableRelationship.java | 39 - .../context/JoinTableRelationshipStrategy.java | 46 - .../jpt/jpa/core/context/JpaContextNode.java | 79 - .../jpt/jpa/core/context/JpaNamedContextNode.java | 53 - .../jpt/jpa/core/context/JpaRootContextNode.java | 57 - .../eclipse/jpt/jpa/core/context/LobConverter.java | 28 - .../jpt/jpa/core/context/ManyToManyMapping.java | 28 - .../jpa/core/context/ManyToManyRelationship.java | 30 - .../jpt/jpa/core/context/ManyToOneMapping.java | 28 - .../jpa/core/context/ManyToOneRelationship.java | 28 - .../jpt/jpa/core/context/MappedByRelationship.java | 52 - .../core/context/MappedByRelationshipStrategy.java | 59 - .../jpt/jpa/core/context/MappedSuperclass.java | 28 - .../eclipse/jpt/jpa/core/context/MappingFile.java | 83 - .../MappingFilePersistenceUnitDefaults.java | 61 - .../MappingFilePersistenceUnitMetadata.java | 47 - .../jpt/jpa/core/context/MappingFileRoot.java | 60 - .../jpt/jpa/core/context/MappingRelationship.java | 54 - .../jpa/core/context/MultiRelationshipMapping.java | 28 - .../eclipse/jpt/jpa/core/context/NamedColumn.java | 72 - .../jpt/jpa/core/context/NamedNativeQuery.java | 46 - .../eclipse/jpt/jpa/core/context/NamedQuery.java | 28 - .../jpt/jpa/core/context/OneToManyMapping.java | 28 - .../jpa/core/context/OneToManyRelationship.java | 30 - .../jpt/jpa/core/context/OneToOneMapping.java | 28 - .../jpt/jpa/core/context/OneToOneRelationship.java | 31 - .../jpt/jpa/core/context/OptionalMapping.java | 41 - .../eclipse/jpt/jpa/core/context/Orderable.java | 44 - .../jpt/jpa/core/context/OverrideContainer.java | 215 - .../jpt/jpa/core/context/OverrideRelationship.java | 37 - .../eclipse/jpt/jpa/core/context/Override_.java | 39 - .../jpt/jpa/core/context/PersistentAttribute.java | 34 - .../jpt/jpa/core/context/PersistentType.java | 210 - .../jpt/jpa/core/context/PrimaryKeyJoinColumn.java | 28 - .../context/PrimaryKeyJoinColumnRelationship.java | 45 - .../PrimaryKeyJoinColumnRelationshipStrategy.java | 82 - .../org/eclipse/jpt/jpa/core/context/Query.java | 92 - .../jpt/jpa/core/context/QueryContainer.java | 112 - .../eclipse/jpt/jpa/core/context/QueryHint.java | 34 - .../jpt/jpa/core/context/ReadOnlyAccessHolder.java | 36 - .../core/context/ReadOnlyAssociationOverride.java | 29 - .../core/context/ReadOnlyAttributeOverride.java | 27 - .../jpt/jpa/core/context/ReadOnlyBaseColumn.java | 90 - .../jpa/core/context/ReadOnlyBaseJoinColumn.java | 62 - .../jpt/jpa/core/context/ReadOnlyColumn.java | 61 - .../jpt/jpa/core/context/ReadOnlyJoinColumn.java | 44 - .../context/ReadOnlyJoinColumnRelationship.java | 53 - .../ReadOnlyJoinColumnRelationshipStrategy.java | 110 - .../jpt/jpa/core/context/ReadOnlyJoinTable.java | 70 - .../context/ReadOnlyJoinTableRelationship.java | 50 - .../ReadOnlyJoinTableRelationshipStrategy.java | 43 - .../jpt/jpa/core/context/ReadOnlyNamedColumn.java | 82 - .../jpt/jpa/core/context/ReadOnlyOverride.java | 40 - .../core/context/ReadOnlyOverrideRelationship.java | 29 - .../core/context/ReadOnlyPersistentAttribute.java | 96 - .../core/context/ReadOnlyPrimaryKeyJoinColumn.java | 25 - .../jpa/core/context/ReadOnlyReferenceTable.java | 72 - .../jpt/jpa/core/context/ReadOnlyRelationship.java | 74 - .../core/context/ReadOnlyRelationshipStrategy.java | 44 - .../jpa/core/context/ReadOnlySecondaryTable.java | 74 - .../jpt/jpa/core/context/ReadOnlyTable.java | 97 - .../jpa/core/context/ReadOnlyUniqueConstraint.java | 39 - .../jpt/jpa/core/context/ReferenceTable.java | 72 - .../eclipse/jpt/jpa/core/context/Relationship.java | 42 - .../jpt/jpa/core/context/RelationshipMapping.java | 70 - .../jpt/jpa/core/context/RelationshipStrategy.java | 78 - .../jpt/jpa/core/context/SecondaryTable.java | 61 - .../jpt/jpa/core/context/SequenceGenerator.java | 43 - .../core/context/SingleRelationshipMapping.java | 28 - .../org/eclipse/jpt/jpa/core/context/Table.java | 88 - .../jpt/jpa/core/context/TableGenerator.java | 136 - .../jpt/jpa/core/context/TemporalConverter.java | 30 - .../eclipse/jpt/jpa/core/context/TemporalType.java | 99 - .../jpt/jpa/core/context/TransientMapping.java | 29 - .../eclipse/jpt/jpa/core/context/TypeMapping.java | 200 - .../jpt/jpa/core/context/UniqueConstraint.java | 75 - .../jpt/jpa/core/context/VersionMapping.java | 28 - .../core/context/VirtualAssociationOverride.java | 29 - .../jpa/core/context/VirtualAttributeOverride.java | 27 - .../jpt/jpa/core/context/VirtualBaseColumn.java | 28 - .../jpa/core/context/VirtualBaseJoinColumn.java | 25 - .../jpt/jpa/core/context/VirtualColumn.java | 40 - .../jpt/jpa/core/context/VirtualJoinColumn.java | 25 - .../context/VirtualJoinColumnRelationship.java | 26 - .../VirtualJoinColumnRelationshipStrategy.java | 30 - .../jpt/jpa/core/context/VirtualJoinTable.java | 34 - .../core/context/VirtualJoinTableRelationship.java | 26 - .../VirtualJoinTableRelationshipStrategy.java | 25 - .../jpt/jpa/core/context/VirtualNamedColumn.java | 31 - .../jpt/jpa/core/context/VirtualOverride.java | 32 - .../core/context/VirtualOverrideRelationship.java | 28 - .../core/context/VirtualPrimaryKeyJoinColumn.java | 25 - .../jpa/core/context/VirtualReferenceTable.java | 32 - .../jpt/jpa/core/context/VirtualRelationship.java | 27 - .../core/context/VirtualRelationshipStrategy.java | 25 - .../jpa/core/context/VirtualSecondaryTable.java | 31 - .../eclipse/jpt/jpa/core/context/VirtualTable.java | 30 - .../jpa/core/context/VirtualUniqueConstraint.java | 28 - .../jpt/jpa/core/context/XmlContextNode.java | 40 - .../org/eclipse/jpt/jpa/core/context/XmlFile.java | 34 - .../DefaultJavaAttributeMappingDefinition.java | 20 - .../eclipse/jpt/jpa/core/context/java/JarFile.java | 77 - .../core/context/java/JavaAssociationOverride.java | 35 - .../java/JavaAssociationOverrideContainer.java | 49 - .../core/context/java/JavaAttributeMapping.java | 42 - .../java/JavaAttributeMappingDefinition.java | 61 - .../core/context/java/JavaAttributeOverride.java | 35 - .../java/JavaAttributeOverrideContainer.java | 49 - .../jpt/jpa/core/context/java/JavaBaseColumn.java | 51 - .../core/context/java/JavaBaseEmbeddedMapping.java | 30 - .../jpa/core/context/java/JavaBaseJoinColumn.java | 49 - .../jpa/core/context/java/JavaBasicMapping.java | 31 - .../jpt/jpa/core/context/java/JavaCascade.java | 30 - .../core/context/java/JavaCollectionMapping.java | 27 - .../jpt/jpa/core/context/java/JavaColumn.java | 40 - .../jpa/core/context/java/JavaColumnMapping.java | 30 - .../jpt/jpa/core/context/java/JavaConverter.java | 143 - .../core/context/java/JavaConvertibleMapping.java | 27 - .../core/context/java/JavaDiscriminatorColumn.java | 44 - .../jpt/jpa/core/context/java/JavaEmbeddable.java | 31 - .../core/context/java/JavaEmbeddedIdMapping.java | 31 - .../jpa/core/context/java/JavaEmbeddedMapping.java | 31 - .../jpt/jpa/core/context/java/JavaEntity.java | 64 - .../core/context/java/JavaEnumeratedConverter.java | 57 - .../jpa/core/context/java/JavaGeneratedValue.java | 38 - .../jpt/jpa/core/context/java/JavaGenerator.java | 35 - .../core/context/java/JavaGeneratorContainer.java | 47 - .../core/context/java/JavaIdClassReference.java | 35 - .../jpt/jpa/core/context/java/JavaIdMapping.java | 36 - .../jpt/jpa/core/context/java/JavaJoinColumn.java | 40 - .../context/java/JavaJoinColumnRelationship.java | 30 - .../java/JavaJoinColumnRelationshipStrategy.java | 38 - .../jpt/jpa/core/context/java/JavaJoinTable.java | 46 - .../context/java/JavaJoinTableRelationship.java | 30 - .../java/JavaJoinTableRelationshipStrategy.java | 37 - .../jpa/core/context/java/JavaJpaContextNode.java | 51 - .../jpa/core/context/java/JavaLobConverter.java | 57 - .../core/context/java/JavaManyToManyMapping.java | 35 - .../context/java/JavaManyToManyRelationship.java | 32 - .../core/context/java/JavaManyToOneMapping.java | 33 - .../context/java/JavaManyToOneRelationship.java | 31 - .../context/java/JavaMappedByRelationship.java | 35 - .../java/JavaMappedByRelationshipStrategy.java | 30 - .../core/context/java/JavaMappedSuperclass.java | 33 - .../java/JavaMappingJoinColumnRelationship.java | 26 - .../java/JavaMappingJoinTableRelationship.java | 26 - .../core/context/java/JavaMappingRelationship.java | 30 - .../context/java/JavaMultiRelationshipMapping.java | 30 - .../jpt/jpa/core/context/java/JavaNamedColumn.java | 61 - .../core/context/java/JavaNamedNativeQuery.java | 35 - .../jpt/jpa/core/context/java/JavaNamedQuery.java | 35 - .../core/context/java/JavaOneToManyMapping.java | 35 - .../context/java/JavaOneToManyRelationship.java | 32 - .../jpa/core/context/java/JavaOneToOneMapping.java | 35 - .../context/java/JavaOneToOneRelationship.java | 33 - .../jpt/jpa/core/context/java/JavaOrderable.java | 30 - .../jpt/jpa/core/context/java/JavaOverride.java | 40 - .../core/context/java/JavaOverrideContainer.java | 96 - .../context/java/JavaOverrideRelationship.java | 31 - .../core/context/java/JavaPersistentAttribute.java | 169 - .../jpa/core/context/java/JavaPersistentType.java | 56 - .../context/java/JavaPrimaryKeyJoinColumn.java | 31 - .../java/JavaPrimaryKeyJoinColumnRelationship.java | 31 - ...vaPrimaryKeyJoinColumnRelationshipStrategy.java | 34 - .../jpt/jpa/core/context/java/JavaQuery.java | 49 - .../jpa/core/context/java/JavaQueryContainer.java | 54 - .../jpt/jpa/core/context/java/JavaQueryHint.java | 31 - .../java/JavaReadOnlyAssociationOverride.java | 27 - .../java/JavaReadOnlyAttributeOverride.java | 27 - .../core/context/java/JavaReadOnlyOverride.java | 27 - .../context/java/JavaReadOnlyRelationship.java | 28 - .../java/JavaReadOnlyRelationshipStrategy.java | 27 - .../context/java/JavaReadOnlyUniqueConstraint.java | 27 - .../jpa/core/context/java/JavaReferenceTable.java | 44 - .../jpa/core/context/java/JavaRelationship.java | 31 - .../core/context/java/JavaRelationshipMapping.java | 45 - .../context/java/JavaRelationshipStrategy.java | 30 - .../jpa/core/context/java/JavaSecondaryTable.java | 43 - .../core/context/java/JavaSequenceGenerator.java | 31 - .../java/JavaSingleRelationshipMapping.java | 31 - .../jpa/core/context/java/JavaStructureNodes.java | 36 - .../jpt/jpa/core/context/java/JavaTable.java | 43 - .../jpa/core/context/java/JavaTableGenerator.java | 36 - .../core/context/java/JavaTemporalConverter.java | 57 - .../core/context/java/JavaTransientMapping.java | 31 - .../jpt/jpa/core/context/java/JavaTypeMapping.java | 47 - .../context/java/JavaTypeMappingDefinition.java | 53 - .../core/context/java/JavaUniqueConstraint.java | 31 - .../jpa/core/context/java/JavaVersionMapping.java | 31 - .../java/JavaVirtualAssociationOverride.java | 31 - .../context/java/JavaVirtualAttributeOverride.java | 31 - .../jpa/core/context/java/JavaVirtualColumn.java | 46 - .../core/context/java/JavaVirtualJoinColumn.java | 33 - .../java/JavaVirtualJoinColumnRelationship.java | 28 - .../JavaVirtualJoinColumnRelationshipStrategy.java | 31 - .../core/context/java/JavaVirtualJoinTable.java | 41 - .../java/JavaVirtualJoinTableRelationship.java | 28 - .../JavaVirtualJoinTableRelationshipStrategy.java | 27 - .../jpa/core/context/java/JavaVirtualOverride.java | 29 - .../java/JavaVirtualOverrideRelationship.java | 28 - .../core/context/java/JavaVirtualRelationship.java | 27 - .../java/JavaVirtualRelationshipStrategy.java | 27 - .../context/java/JavaVirtualUniqueConstraint.java | 33 - .../jpt/jpa/core/context/orm/EntityMappings.java | 200 - .../core/context/orm/MappingFileDefinition.java | 31 - .../orm/NullOrmAttributeMappingDefinition.java | 62 - .../core/context/orm/OrmAssociationOverride.java | 35 - .../orm/OrmAssociationOverrideContainer.java | 52 - .../jpa/core/context/orm/OrmAttributeMapping.java | 115 - .../context/orm/OrmAttributeMappingDefinition.java | 47 - .../jpa/core/context/orm/OrmAttributeOverride.java | 35 - .../context/orm/OrmAttributeOverrideContainer.java | 54 - .../jpt/jpa/core/context/orm/OrmBaseColumn.java | 50 - .../core/context/orm/OrmBaseEmbeddedMapping.java | 33 - .../jpa/core/context/orm/OrmBaseJoinColumn.java | 48 - .../jpt/jpa/core/context/orm/OrmBasicMapping.java | 31 - .../jpt/jpa/core/context/orm/OrmCascade.java | 31 - .../jpa/core/context/orm/OrmCollectionMapping.java | 27 - .../jpt/jpa/core/context/orm/OrmColumn.java | 48 - .../jpt/jpa/core/context/orm/OrmColumnMapping.java | 30 - .../jpt/jpa/core/context/orm/OrmConverter.java | 116 - .../core/context/orm/OrmConvertibleMapping.java | 28 - .../core/context/orm/OrmDiscriminatorColumn.java | 47 - .../jpt/jpa/core/context/orm/OrmEmbeddable.java | 36 - .../jpa/core/context/orm/OrmEmbeddedIdMapping.java | 31 - .../jpa/core/context/orm/OrmEmbeddedMapping.java | 31 - .../jpt/jpa/core/context/orm/OrmEntity.java | 98 - .../core/context/orm/OrmEnumeratedConverter.java | 63 - .../jpa/core/context/orm/OrmGeneratedValue.java | 38 - .../jpt/jpa/core/context/orm/OrmGenerator.java | 35 - .../core/context/orm/OrmGeneratorContainer.java | 43 - .../jpa/core/context/orm/OrmIdClassReference.java | 62 - .../jpt/jpa/core/context/orm/OrmIdMapping.java | 36 - .../jpt/jpa/core/context/orm/OrmJoinColumn.java | 41 - .../context/orm/OrmJoinColumnRelationship.java | 34 - .../orm/OrmJoinColumnRelationshipStrategy.java | 38 - .../jpt/jpa/core/context/orm/OrmJoinTable.java | 42 - .../core/context/orm/OrmJoinTableRelationship.java | 33 - .../orm/OrmJoinTableRelationshipStrategy.java | 37 - .../jpt/jpa/core/context/orm/OrmLobConverter.java | 63 - .../jpa/core/context/orm/OrmManyToManyMapping.java | 33 - .../context/orm/OrmManyToManyRelationship.java | 33 - .../jpa/core/context/orm/OrmManyToOneMapping.java | 33 - .../core/context/orm/OrmManyToOneRelationship.java | 31 - .../core/context/orm/OrmMappedByRelationship.java | 33 - .../orm/OrmMappedByRelationshipStrategy.java | 30 - .../jpa/core/context/orm/OrmMappedSuperclass.java | 38 - .../orm/OrmMappingJoinColumnRelationship.java | 25 - .../orm/OrmMappingJoinTableRelationship.java | 26 - .../core/context/orm/OrmMappingRelationship.java | 30 - .../context/orm/OrmMultiRelationshipMapping.java | 31 - .../jpt/jpa/core/context/orm/OrmNamedColumn.java | 62 - .../jpa/core/context/orm/OrmNamedNativeQuery.java | 35 - .../jpt/jpa/core/context/orm/OrmNamedQuery.java | 35 - .../jpa/core/context/orm/OrmOneToManyMapping.java | 33 - .../core/context/orm/OrmOneToManyRelationship.java | 33 - .../jpa/core/context/orm/OrmOneToOneMapping.java | 33 - .../core/context/orm/OrmOneToOneRelationship.java | 34 - .../jpt/jpa/core/context/orm/OrmOrderable.java | 31 - .../jpt/jpa/core/context/orm/OrmOverride.java | 36 - .../jpa/core/context/orm/OrmOverrideContainer.java | 55 - .../core/context/orm/OrmOverrideRelationship.java | 34 - .../context/orm/OrmPersistenceUnitDefaults.java | 67 - .../context/orm/OrmPersistenceUnitMetadata.java | 50 - .../core/context/orm/OrmPersistentAttribute.java | 80 - .../jpa/core/context/orm/OrmPersistentType.java | 195 - .../core/context/orm/OrmPrimaryKeyJoinColumn.java | 34 - .../orm/OrmPrimaryKeyJoinColumnRelationship.java | 33 - ...rmPrimaryKeyJoinColumnRelationshipStrategy.java | 34 - .../eclipse/jpt/jpa/core/context/orm/OrmQuery.java | 49 - .../jpa/core/context/orm/OrmQueryContainer.java | 50 - .../jpt/jpa/core/context/orm/OrmQueryHint.java | 32 - .../orm/OrmReadOnlyAssociationOverride.java | 27 - .../context/orm/OrmReadOnlyAttributeOverride.java | 27 - .../jpa/core/context/orm/OrmReadOnlyOverride.java | 28 - .../orm/OrmReadOnlyPersistentAttribute.java | 92 - .../core/context/orm/OrmReadOnlyRelationship.java | 32 - .../orm/OrmReadOnlyRelationshipStrategy.java | 28 - .../context/orm/OrmReadOnlyUniqueConstraint.java | 31 - .../jpa/core/context/orm/OrmReferenceTable.java | 40 - .../jpt/jpa/core/context/orm/OrmRelationship.java | 31 - .../core/context/orm/OrmRelationshipMapping.java | 35 - .../core/context/orm/OrmRelationshipStrategy.java | 30 - .../jpa/core/context/orm/OrmSecondaryTable.java | 46 - .../jpa/core/context/orm/OrmSequenceGenerator.java | 31 - .../context/orm/OrmSingleRelationshipMapping.java | 31 - .../jpa/core/context/orm/OrmStructureNodes.java | 35 - .../eclipse/jpt/jpa/core/context/orm/OrmTable.java | 40 - .../jpa/core/context/orm/OrmTableGenerator.java | 42 - .../jpa/core/context/orm/OrmTemporalConverter.java | 63 - .../jpa/core/context/orm/OrmTransientMapping.java | 31 - .../jpt/jpa/core/context/orm/OrmTypeMapping.java | 159 - .../core/context/orm/OrmTypeMappingDefinition.java | 49 - .../jpa/core/context/orm/OrmUniqueConstraint.java | 31 - .../jpa/core/context/orm/OrmVersionMapping.java | 31 - .../context/orm/OrmVirtualAssociationOverride.java | 31 - .../context/orm/OrmVirtualAttributeOverride.java | 31 - .../jpt/jpa/core/context/orm/OrmVirtualColumn.java | 47 - .../jpa/core/context/orm/OrmVirtualJoinColumn.java | 34 - .../orm/OrmVirtualJoinColumnRelationship.java | 28 - .../OrmVirtualJoinColumnRelationshipStrategy.java | 31 - .../jpa/core/context/orm/OrmVirtualJoinTable.java | 42 - .../orm/OrmVirtualJoinTableRelationship.java | 28 - .../OrmVirtualJoinTableRelationshipStrategy.java | 27 - .../jpa/core/context/orm/OrmVirtualOverride.java | 29 - .../orm/OrmVirtualOverrideRelationship.java | 28 - .../orm/OrmVirtualPrimaryKeyJoinColumn.java | 29 - .../core/context/orm/OrmVirtualRelationship.java | 27 - .../orm/OrmVirtualRelationshipStrategy.java | 27 - .../core/context/orm/OrmVirtualSecondaryTable.java | 34 - .../context/orm/OrmVirtualUniqueConstraint.java | 33 - .../eclipse/jpt/jpa/core/context/orm/OrmXml.java | 43 - .../core/context/orm/OrmXmlContextNodeFactory.java | 183 - .../jpt/jpa/core/context/orm/OrmXmlDefinition.java | 54 - .../UnsupportedOrmAttributeMappingDefinition.java | 62 - .../jpt/jpa/core/context/persistence/ClassRef.java | 129 - .../jpa/core/context/persistence/JarFileRef.java | 93 - .../core/context/persistence/MappingFileRef.java | 190 - .../jpa/core/context/persistence/Persistence.java | 92 - .../persistence/PersistenceStructureNodes.java | 37 - .../core/context/persistence/PersistenceUnit.java | 839 -- .../persistence/PersistenceUnitProperties.java | 81 - .../PersistenceUnitTransactionType.java | 64 - .../core/context/persistence/PersistenceXml.java | 42 - .../PersistenceXmlContextNodeFactory.java | 69 - .../persistence/PersistenceXmlDefinition.java | 33 - .../persistence/PersistentTypeContainer.java | 45 - .../AbstractJpaAnnotationDefinitionProvider.java | 103 - .../jpt/jpa/core/internal/AbstractJpaFactory.java | 402 - .../jpt/jpa/core/internal/AbstractJpaNode.java | 223 - .../core/internal/AbstractJpaPlatformProvider.java | 149 - .../jpt/jpa/core/internal/AbstractJpaProject.java | 1955 --- ...tityGeneratorDatabaseAnnotationNameBuilder.java | 55 - .../GenericJpaAnnotationDefinitionProvider.java | 161 - .../internal/GenericJpaAnnotationProvider.java | 194 - .../jpt/jpa/core/internal/GenericJpaPlatform.java | 198 - .../core/internal/GenericJpaPlatformFactory.java | 96 - .../core/internal/GenericJpaPlatformProvider.java | 159 - .../core/internal/JarResourceModelProvider.java | 61 - .../JavaPackageInfoResourceModelProvider.java | 57 - .../core/internal/JavaResourceModelProvider.java | 57 - .../jpt/jpa/core/internal/JpaPlatformTester.java | 60 - .../eclipse/jpt/jpa/core/internal/JpaTester.java | 52 - .../jpt/jpa/core/internal/JptCoreMessages.java | 69 - .../core/internal/OrmResourceModelProvider.java | 50 - .../internal/PersistenceResourceModelProvider.java | 51 - .../jpa/core/internal/ProjectAdapterFactory.java | 62 - .../jpa/core/internal/SimpleJpaProjectConfig.java | 94 - .../internal/context/AbstractJpaContextNode.java | 143 - .../internal/context/AbstractXmlContextNode.java | 38 - .../internal/context/AttributeMappingTools.java | 67 - .../context/BaseColumnTextRangeResolver.java | 21 - .../context/BaseJoinColumnTextRangeResolver.java | 21 - .../internal/context/ContextContainerTools.java | 148 - .../internal/context/EntityTextRangeResolver.java | 18 - .../context/JoinColumnTextRangeResolver.java | 20 - .../jpa/core/internal/context/JptValidator.java | 23 - .../jpa/core/internal/context/MappingTools.java | 432 - .../context/NamedColumnTextRangeResolver.java | 21 - .../context/OverrideTextRangeResolver.java | 21 - .../context/PersistentAttributePropertyTester.java | 47 - .../PersistentAttributeTextRangeResolver.java | 21 - .../context/PrimaryKeyTextRangeResolver.java | 24 - .../internal/context/TableTextRangeResolver.java | 25 - .../context/TypeMappingTextRangeResolver.java | 21 - .../core/internal/context/TypeMappingTools.java | 119 - .../context/java/AbstractJavaAttributeMapping.java | 319 - .../context/java/AbstractJavaBaseColumn.java | 361 - .../java/AbstractJavaBaseEmbeddedMapping.java | 319 - .../context/java/AbstractJavaBasicMapping.java | 383 - .../java/AbstractJavaBasicMappingDefinition.java | 67 - .../context/java/AbstractJavaEmbeddable.java | 48 - .../AbstractJavaEmbeddedMappingDefinition.java | 63 - .../internal/context/java/AbstractJavaEntity.java | 1816 --- .../context/java/AbstractJavaGenerator.java | 225 - .../context/java/AbstractJavaIdMapping.java | 476 - .../java/AbstractJavaIdMappingDefinition.java | 65 - ...AbstractJavaJoinColumnRelationshipStrategy.java | 348 - .../AbstractJavaJoinTableRelationshipStrategy.java | 196 - .../context/java/AbstractJavaJpaContextNode.java | 72 - .../java/AbstractJavaManyToManyMapping.java | 51 - .../AbstractJavaManyToManyMappingDefinition.java | 61 - .../context/java/AbstractJavaManyToOneMapping.java | 50 - .../AbstractJavaManyToOneMappingDefinition.java | 61 - .../context/java/AbstractJavaMappedSuperclass.java | 112 - .../java/AbstractJavaMappingRelationship.java | 132 - .../java/AbstractJavaMultiRelationshipMapping.java | 780 -- .../context/java/AbstractJavaNamedColumn.java | 292 - .../context/java/AbstractJavaOneToManyMapping.java | 86 - .../AbstractJavaOneToManyMappingDefinition.java | 65 - .../context/java/AbstractJavaOneToOneMapping.java | 86 - .../AbstractJavaOneToOneMappingDefinition.java | 65 - .../context/java/AbstractJavaOverride.java | 215 - .../java/AbstractJavaPersistentAttribute.java | 816 -- .../context/java/AbstractJavaPersistentType.java | 722 -- .../internal/context/java/AbstractJavaQuery.java | 231 - .../java/AbstractJavaReadOnlyUniqueConstraint.java | 53 - .../java/AbstractJavaRelationshipMapping.java | 347 - .../java/AbstractJavaSequenceGenerator.java | 135 - .../AbstractJavaSingleRelationshipMapping.java | 156 - .../internal/context/java/AbstractJavaTable.java | 584 - .../context/java/AbstractJavaTypeMapping.java | 293 - .../context/java/AbstractJavaVersionMapping.java | 276 - .../java/AbstractJavaVersionMappingDefinition.java | 59 - .../java/AbstractJavaVirtualBaseColumn.java | 238 - .../java/AbstractJavaVirtualNamedColumn.java | 141 - .../context/java/AbstractJavaVirtualOverride.java | 63 - .../java/AbstractJavaVirtualReferenceTable.java | 200 - .../context/java/AbstractJavaVirtualTable.java | 315 - .../context/java/GenericJavaIdClassReference.java | 239 - .../java/GenericJavaManyToManyRelationship.java | 198 - .../java/GenericJavaManyToOneRelationship.java | 194 - .../GenericJavaMappedByRelationshipStrategy.java | 262 - ...cJavaMappingJoinColumnRelationshipStrategy.java | 216 - .../java/GenericJavaOneToManyRelationship.java | 272 - .../java/GenericJavaOneToOneRelationship.java | 300 - ...JavaOverrideJoinColumnRelationshipStrategy.java | 249 - ...vaPrimaryKeyJoinColumnRelationshipStrategy.java | 385 - .../context/java/GenericJavaVirtualJoinTable.java | 333 - .../java/JavaBaseColumnTextRangeResolver.java | 34 - .../context/java/JavaBasicMappingDefinition.java | 34 - .../context/java/JavaEmbeddableDefinition.java | 62 - .../java/JavaEmbeddedIdMappingDefinition.java | 73 - .../java/JavaEmbeddedMappingDefinition.java | 34 - .../context/java/JavaEntityDefinition.java | 116 - .../context/java/JavaEntityTextRangeResolver.java | 44 - .../context/java/JavaIdMappingDefinition.java | 34 - .../java/JavaJoinColumnTextRangeResolver.java | 38 - .../java/JavaManyToManyMappingDefinition.java | 34 - .../java/JavaManyToOneMappingDefinition.java | 34 - .../java/JavaMappedSuperclassDefinition.java | 79 - .../JavaMappedSuperclassTextRangeResolver.java | 46 - .../java/JavaNamedColumnTextRangeResolver.java | 37 - .../internal/context/java/JavaNullTypeMapping.java | 84 - .../java/JavaOneToManyMappingDefinition.java | 34 - .../java/JavaOneToOneMappingDefinition.java | 34 - .../java/JavaOverrideTextRangeResolver.java | 37 - .../JavaPersistentAttributeTextRangeResolver.java | 33 - .../JavaPrimaryKeyJoinColumnTextRangeResolver.java | 35 - .../context/java/JavaTableTextRangeResolver.java | 45 - .../java/JavaTransientMappingDefinition.java | 65 - .../java/JavaTypeMappingTextRangeResolver.java | 33 - .../context/java/JavaVersionMappingDefinition.java | 34 - .../context/orm/AbstractEntityMappings.java | 1016 -- .../context/orm/AbstractOrmAttributeMapping.java | 419 - .../context/orm/AbstractOrmBaseColumn.java | 302 - .../orm/AbstractOrmBaseEmbeddedMapping.java | 328 - .../context/orm/AbstractOrmBasicMapping.java | 425 - .../context/orm/AbstractOrmEmbeddable.java | 102 - .../internal/context/orm/AbstractOrmEntity.java | 2285 ---- .../internal/context/orm/AbstractOrmGenerator.java | 224 - .../internal/context/orm/AbstractOrmIdMapping.java | 508 - .../AbstractOrmJoinColumnRelationshipStrategy.java | 332 - .../AbstractOrmJoinTableRelationshipStrategy.java | 194 - .../context/orm/AbstractOrmManyToManyMapping.java | 64 - .../context/orm/AbstractOrmManyToOneMapping.java | 66 - .../context/orm/AbstractOrmMappedSuperclass.java | 213 - .../orm/AbstractOrmMappingRelationship.java | 136 - .../orm/AbstractOrmMultiRelationshipMapping.java | 813 -- .../context/orm/AbstractOrmNamedColumn.java | 287 - .../context/orm/AbstractOrmOneToManyMapping.java | 99 - .../context/orm/AbstractOrmOneToOneMapping.java | 102 - .../internal/context/orm/AbstractOrmQuery.java | 239 - .../orm/AbstractOrmReadOnlyUniqueConstraint.java | 53 - .../orm/AbstractOrmRelationshipMapping.java | 418 - .../context/orm/AbstractOrmSequenceGenerator.java | 91 - .../orm/AbstractOrmSingleRelationshipMapping.java | 141 - .../internal/context/orm/AbstractOrmTable.java | 541 - .../context/orm/AbstractOrmTypeMapping.java | 482 - .../context/orm/AbstractOrmVersionMapping.java | 325 - .../context/orm/AbstractOrmVirtualBaseColumn.java | 238 - .../context/orm/AbstractOrmVirtualNamedColumn.java | 140 - .../orm/AbstractOrmVirtualReferenceTable.java | 200 - .../context/orm/AbstractOrmVirtualTable.java | 314 - .../context/orm/AbstractOrmXmlContextNode.java | 53 - .../orm/AbstractOrmXmlContextNodeFactory.java | 386 - .../context/orm/AbstractOrmXmlDefinition.java | 115 - .../context/orm/GenericOrmIdClassReference.java | 323 - .../orm/GenericOrmManyToManyRelationship.java | 172 - .../orm/GenericOrmManyToOneRelationship.java | 177 - .../GenericOrmMappedByRelationshipStrategy.java | 223 - ...icOrmMappingJoinColumnRelationshipStrategy.java | 164 - ...ricOrmMappingJoinTableRelationshipStrategy.java | 64 - .../orm/GenericOrmOneToManyRelationship.java | 241 - .../orm/GenericOrmOneToOneRelationship.java | 263 - ...cOrmOverrideJoinColumnRelationshipStrategy.java | 209 - ...rmPrimaryKeyJoinColumnRelationshipStrategy.java | 344 - .../context/orm/GenericOrmVirtualJoinTable.java | 333 - ...tualOverrideJoinColumnRelationshipStrategy.java | 333 - .../orm/GenericOrmVirtualSecondaryTable.java | 272 - .../orm/GenericOrmXmlContextNodeFactory.java | 17 - .../orm/NullOrmJoinTableRelationshipStrategy.java | 128 - .../orm/OrmBaseColumnTextRangeResolver.java | 34 - .../context/orm/OrmBasicMappingDefinition.java | 64 - .../context/orm/OrmEmbeddableDefinition.java | 67 - .../orm/OrmEmbeddedIdMappingDefinition.java | 64 - .../context/orm/OrmEmbeddedMappingDefinition.java | 64 - .../internal/context/orm/OrmEntityDefinition.java | 67 - .../context/orm/OrmEntityTextRangeResolver.java | 44 - .../context/orm/OrmIdMappingDefinition.java | 64 - .../orm/OrmJoinColumnTextRangeResolver.java | 39 - .../orm/OrmManyToManyMappingDefinition.java | 64 - .../context/orm/OrmManyToOneMappingDefinition.java | 64 - .../context/orm/OrmMappedSuperclassDefinition.java | 67 - .../orm/OrmMappedSuperclassTextRangeResolver.java | 44 - .../orm/OrmNamedColumnTextRangeResolver.java | 33 - .../context/orm/OrmOneToManyMappingDefinition.java | 64 - .../context/orm/OrmOneToOneMappingDefinition.java | 64 - .../context/orm/OrmOverrideTextRangeResolver.java | 33 - .../OrmPersistentAttributeTextRangeResolver.java | 29 - .../OrmPrimaryKeyJoinColumnTextRangeResolver.java | 35 - .../context/orm/OrmTableTextRangeResolver.java | 40 - .../context/orm/OrmTransientMappingDefinition.java | 64 - .../orm/OrmTypeMappingTextRangeResolver.java | 29 - .../context/orm/OrmVersionMappingDefinition.java | 64 - .../orm/SpecifiedOrmPersistentAttribute.java | 430 - .../context/orm/VirtualOrmPersistentAttribute.java | 585 - .../context/persistence/AbstractJarFileRef.java | 384 - .../persistence/AbstractMappingFileRef.java | 344 - .../persistence/AbstractPersistenceUnit.java | 2404 ---- .../AbstractPersistenceUnitProperties.java | 529 - .../AbstractPersistenceXmlContextNode.java | 47 - .../AbstractPersistenceXmlContextNodeFactory.java | 75 - .../AbstractPersistenceXmlDefinition.java | 38 - .../GenericPersistenceXmlContextNodeFactory.java | 29 - .../jpt/jpa/core/internal/facet/FacetTools.java | 39 - .../internal/facet/JpaFacetActionDelegate.java | 75 - .../facet/JpaFacetDataModelProperties.java | 84 - .../internal/facet/JpaFacetDataModelProvider.java | 715 -- .../facet/JpaFacetInstallDataModelProperties.java | 33 - .../facet/JpaFacetInstallDataModelProvider.java | 206 - .../internal/facet/JpaFacetInstallDelegate.java | 143 - .../internal/facet/JpaFacetUninstallDelegate.java | 28 - .../JpaFacetVersionChangeDataModelProvider.java | 114 - .../facet/JpaFacetVersionChangeDelegate.java | 35 - .../internal/facet/RuntimeChangedListener.java | 49 - .../core/internal/jpa1/GenericJpaDataSource.java | 230 - .../jpa/core/internal/jpa1/GenericJpaFactory.java | 23 - .../jpt/jpa/core/internal/jpa1/GenericJpaFile.java | 152 - .../jpa/core/internal/jpa1/GenericJpaProject.java | 28 - .../context/AbstractEntityPrimaryKeyValidator.java | 107 - .../jpa1/context/AbstractJoinTableValidator.java | 41 - ...bstractMappedSuperclassPrimaryKeyValidator.java | 53 - .../jpa1/context/AbstractNamedColumnValidator.java | 152 - .../AbstractPersistentAttributeValidator.java | 74 - .../jpa1/context/AbstractPrimaryKeyValidator.java | 618 - .../jpa1/context/AbstractTableValidator.java | 188 - .../jpa1/context/AbstractTypeMappingValidator.java | 91 - ...ociationOverrideInverseJoinColumnValidator.java | 267 - .../AssociationOverrideJoinColumnValidator.java | 269 - .../AssociationOverrideJoinTableValidator.java | 125 - .../jpa1/context/AssociationOverrideValidator.java | 52 - .../context/AttributeOverrideColumnValidator.java | 156 - .../jpa1/context/AttributeOverrideValidator.java | 52 - .../jpa1/context/BaseColumnTableValidator.java | 116 - .../jpa1/context/BaseJoinColumnValidator.java | 177 - .../CollectionTableTableDescriptionProvider.java | 12 - .../jpa1/context/DiscriminatorColumnValidator.java | 34 - .../EmbeddableOverrideDescriptionProvider.java | 22 - .../EntityPrimaryKeyJoinColumnValidator.java | 44 - .../context/EntityTableDescriptionProvider.java | 12 - .../context/GenericEntityPrimaryKeyValidator.java | 34 - ...GenericMappedSuperclassPrimaryKeyValidator.java | 33 - .../GenericPersistentAttributeValidator.java | 62 - .../jpa1/context/GenericRootContextNode.java | 294 - .../jpa1/context/GenericTypeMappingValidator.java | 44 - .../jpa1/context/InverseJoinColumnValidator.java | 104 - .../internal/jpa1/context/JoinColumnValidator.java | 104 - .../context/JoinTableTableDescriptionProvider.java | 12 - .../internal/jpa1/context/JoinTableValidator.java | 41 - .../MapKeyAttributeOverrideColumnValidator.java | 76 - .../context/MapKeyAttributeOverrideValidator.java | 47 - .../jpa1/context/MapKeyColumnValidator.java | 73 - ...appedSuperclassOverrideDescriptionProvider.java | 22 - .../jpa1/context/NamedColumnValidator.java | 51 - .../OneToOnePrimaryKeyJoinColumnValidator.java | 54 - .../internal/jpa1/context/OverrideValidator.java | 144 - .../context/PrimaryKeyJoinColumnValidator.java | 100 - ...lationshipStrategyTableDescriptionProvider.java | 29 - ...econdaryTablePrimaryKeyJoinColumnValidator.java | 136 - .../jpa1/context/SecondaryTableValidator.java | 56 - .../core/internal/jpa1/context/TableValidator.java | 51 - .../jpa1/context/java/AbstractJavaConverter.java | 51 - .../java/AbstractJavaOverrideContainer.java | 587 - .../internal/jpa1/context/java/GenericJarFile.java | 238 - .../java/GenericJavaAssociationOverride.java | 122 - .../GenericJavaAssociationOverrideContainer.java | 91 - .../context/java/GenericJavaAttributeOverride.java | 218 - .../GenericJavaAttributeOverrideContainer.java | 67 - .../jpa1/context/java/GenericJavaBasicMapping.java | 21 - .../jpa1/context/java/GenericJavaCascade.java | 255 - .../jpa1/context/java/GenericJavaColumn.java | 221 - .../java/GenericJavaDiscriminatorColumn.java | 182 - .../jpa1/context/java/GenericJavaEmbeddable.java | 39 - .../context/java/GenericJavaEmbeddedIdMapping.java | 164 - .../context/java/GenericJavaEmbeddedMapping.java | 284 - .../jpa1/context/java/GenericJavaEntity.java | 72 - .../java/GenericJavaEnumeratedConverter.java | 110 - .../context/java/GenericJavaGeneratedValue.java | 220 - .../java/GenericJavaGeneratorContainer.java | 283 - .../jpa1/context/java/GenericJavaIdMapping.java | 22 - .../jpa1/context/java/GenericJavaJoinColumn.java | 212 - .../jpa1/context/java/GenericJavaJoinTable.java | 496 - .../jpa1/context/java/GenericJavaLobConverter.java | 49 - .../context/java/GenericJavaManyToManyMapping.java | 21 - .../context/java/GenericJavaManyToOneMapping.java | 21 - .../context/java/GenericJavaMappedSuperclass.java | 25 - ...icJavaMappingJoinTableRelationshipStrategy.java | 97 - .../context/java/GenericJavaNamedNativeQuery.java | 85 - .../jpa1/context/java/GenericJavaNamedQuery.java | 27 - .../java/GenericJavaNullAttributeMapping.java | 44 - .../context/java/GenericJavaOneToManyMapping.java | 21 - .../context/java/GenericJavaOneToOneMapping.java | 21 - .../jpa1/context/java/GenericJavaOrderable.java | 486 - .../java/GenericJavaOverrideRelationship.java | 247 - .../java/GenericJavaPersistentAttribute.java | 52 - .../context/java/GenericJavaPersistentType.java | 45 - .../java/GenericJavaPrimaryKeyJoinColumn.java | 208 - .../context/java/GenericJavaQueryContainer.java | 370 - .../jpa1/context/java/GenericJavaQueryHint.java | 104 - .../context/java/GenericJavaReferenceTable.java | 317 - .../context/java/GenericJavaSecondaryTable.java | 400 - .../context/java/GenericJavaSequenceGenerator.java | 45 - .../jpa1/context/java/GenericJavaTable.java | 103 - .../context/java/GenericJavaTableGenerator.java | 567 - .../context/java/GenericJavaTemporalConverter.java | 94 - .../context/java/GenericJavaTransientMapping.java | 46 - .../context/java/GenericJavaUniqueConstraint.java | 135 - .../context/java/GenericJavaVersionMapping.java | 21 - .../GenericJavaVirtualAssociationOverride.java | 68 - .../java/GenericJavaVirtualAttributeOverride.java | 93 - .../context/java/GenericJavaVirtualColumn.java | 167 - .../context/java/GenericJavaVirtualJoinColumn.java | 102 - ...tualOverrideJoinColumnRelationshipStrategy.java | 335 - .../GenericJavaVirtualOverrideRelationship.java | 169 - .../java/GenericJavaVirtualUniqueConstraint.java | 58 - .../jpa1/context/java/NullJavaConverter.java | 48 - .../NullJavaJoinColumnRelationshipStrategy.java | 166 - .../NullJavaJoinTableRelationshipStrategy.java | 115 - .../jpa1/context/orm/AbstractOrmConverter.java | 45 - .../jpa1/context/orm/AbstractOrmOverride.java | 138 - .../context/orm/AbstractOrmOverrideContainer.java | 472 - .../context/orm/AbstractOrmVirtualOverride.java | 63 - .../jpa1/context/orm/GenericEntityMappings.java | 27 - .../context/orm/GenericOrmAssociationOverride.java | 97 - .../GenericOrmAssociationOverrideContainer.java | 93 - .../context/orm/GenericOrmAttributeOverride.java | 201 - .../orm/GenericOrmAttributeOverrideContainer.java | 76 - .../jpa1/context/orm/GenericOrmBasicMapping.java | 25 - .../jpa1/context/orm/GenericOrmCascade.java | 303 - .../jpa1/context/orm/GenericOrmColumn.java | 188 - .../context/orm/GenericOrmDiscriminatorColumn.java | 169 - .../jpa1/context/orm/GenericOrmEmbeddable.java | 31 - .../context/orm/GenericOrmEmbeddedIdMapping.java | 180 - .../context/orm/GenericOrmEmbeddedMapping.java | 304 - .../jpa1/context/orm/GenericOrmEntity.java | 82 - .../context/orm/GenericOrmEnumeratedConverter.java | 134 - .../jpa1/context/orm/GenericOrmGeneratedValue.java | 194 - .../context/orm/GenericOrmGeneratorContainer.java | 261 - .../jpa1/context/orm/GenericOrmIdMapping.java | 25 - .../jpa1/context/orm/GenericOrmJoinColumn.java | 181 - .../jpa1/context/orm/GenericOrmJoinTable.java | 511 - .../jpa1/context/orm/GenericOrmLobConverter.java | 62 - .../context/orm/GenericOrmManyToManyMapping.java | 22 - .../context/orm/GenericOrmManyToOneMapping.java | 22 - .../context/orm/GenericOrmMappedSuperclass.java | 25 - .../context/orm/GenericOrmNamedNativeQuery.java | 85 - .../jpa1/context/orm/GenericOrmNamedQuery.java | 27 - .../orm/GenericOrmNullAttributeMapping.java | 55 - .../context/orm/GenericOrmOneToManyMapping.java | 22 - .../context/orm/GenericOrmOneToOneMapping.java | 25 - .../jpa1/context/orm/GenericOrmOrderable.java | 452 - .../orm/GenericOrmOverrideRelationship.java | 249 - .../orm/GenericOrmPersistenceUnitDefaults.java | 344 - .../orm/GenericOrmPersistenceUnitMetadata.java | 191 - .../context/orm/GenericOrmPersistentAttribute.java | 79 - .../jpa1/context/orm/GenericOrmPersistentType.java | 1195 -- .../orm/GenericOrmPrimaryKeyJoinColumn.java | 173 - .../jpa1/context/orm/GenericOrmQueryContainer.java | 366 - .../jpa1/context/orm/GenericOrmQueryHint.java | 103 - .../jpa1/context/orm/GenericOrmReferenceTable.java | 304 - .../jpa1/context/orm/GenericOrmSecondaryTable.java | 418 - .../context/orm/GenericOrmSequenceGenerator.java | 44 - .../internal/jpa1/context/orm/GenericOrmTable.java | 88 - .../jpa1/context/orm/GenericOrmTableGenerator.java | 440 - .../context/orm/GenericOrmTemporalConverter.java | 104 - .../context/orm/GenericOrmTransientMapping.java | 58 - .../context/orm/GenericOrmUniqueConstraint.java | 99 - .../jpa1/context/orm/GenericOrmVersionMapping.java | 23 - .../orm/GenericOrmVirtualAssociationOverride.java | 67 - .../orm/GenericOrmVirtualAttributeOverride.java | 92 - .../jpa1/context/orm/GenericOrmVirtualColumn.java | 167 - .../context/orm/GenericOrmVirtualJoinColumn.java | 102 - .../orm/GenericOrmVirtualOverrideRelationship.java | 169 - .../orm/GenericOrmVirtualPrimaryKeyJoinColumn.java | 100 - .../orm/GenericOrmVirtualUniqueConstraint.java | 57 - .../internal/jpa1/context/orm/GenericOrmXml.java | 281 - .../jpa1/context/orm/GenericOrmXmlDefinition.java | 111 - .../jpa1/context/orm/NullOrmConverter.java | 53 - .../orm/NullOrmJoinColumnRelationshipStrategy.java | 165 - .../orm/UnsupportedOrmAttributeMapping.java | 60 - .../jpa1/context/persistence/GenericClassRef.java | 378 - .../context/persistence/GenericJarFileRef.java | 26 - .../context/persistence/GenericMappingFileRef.java | 149 - .../context/persistence/GenericPersistence.java | 302 - .../persistence/GenericPersistenceUnit.java | 25 - .../GenericPersistenceUnitProperty.java | 159 - .../context/persistence/GenericPersistenceXml.java | 251 - .../GenericPersistenceXmlDefinition.java | 54 - .../context/persistence/ImpliedMappingFileRef.java | 105 - .../BinaryAssociationOverride1_0Annotation.java | 27 - .../BinaryAssociationOverrides1_0Annotation.java | 33 - .../binary/BinaryNamedQueries1_0Annotation.java | 32 - .../java/binary/BinaryNamedQuery1_0Annotation.java | 27 - .../BinarySequenceGenerator1_0Annotation.java | 27 - .../SourceAssociationOverride1_0Annotation.java | 43 - .../SourceAssociationOverrides1_0Annotation.java | 33 - .../java/source/SourceNamedQuery1_0Annotation.java | 31 - .../SourceSequenceGenerator1_0Annotation.java | 27 - .../Generic2_0JpaAnnotationDefinitionProvider.java | 191 - .../jpa2/Generic2_0JpaPlatformFactory.java | 60 - .../jpa2/Generic2_0JpaPlatformProvider.java | 170 - .../jpa2/GenericJpaDatabaseIdentifierAdapter.java | 80 - .../core/internal/jpa2/GenericJpaFactory2_0.java | 169 - .../jpa2/GenericMetamodelSynchronizer.java | 432 - .../jpa2/context/CollectionTableValidator.java | 57 - .../jpa2/context/OrderColumnValidator.java | 43 - .../jpa2/context/SimpleMetamodelField.java | 107 - .../AbstractJavaElementCollectionMapping2_0.java | 1530 --- ...tJavaElementCollectionMappingDefinition2_0.java | 92 - .../java/AbstractJavaIdMappingDefinition2_0.java | 56 - .../jpa2/context/java/GenericJavaCacheable2_0.java | 165 - .../java/GenericJavaCollectionTable2_0.java | 178 - .../java/GenericJavaDerivedIdentity2_0.java | 198 - .../GenericJavaElementCollectionMapping2_0.java | 21 - .../context/java/GenericJavaEmbeddable2_0.java | 46 - .../GenericJavaIdDerivedIdentityStrategy2_0.java | 137 - ...enericJavaMapsIdDerivedIdentityStrategy2_0.java | 361 - .../context/java/GenericJavaNamedQuery2_0.java | 90 - .../context/java/GenericJavaOrderColumn2_0.java | 250 - .../context/java/GenericJavaOrphanRemoval2_0.java | 121 - ...vaOverrideJoinTableRelationshipStrategy2_0.java | 102 - .../java/GenericJavaPersistentAttribute2_0.java | 83 - .../context/java/GenericJavaPersistentType2_0.java | 156 - .../java/GenericJavaSequenceGenerator2_0.java | 129 - ...alOverrideJoinTableRelationshipStrategy2_0.java | 121 - .../JavaElementCollectionMappingDefinition2_0.java | 34 - .../java/JavaEmbeddedMappingDefinition2_0.java | 55 - .../context/java/JavaIdMappingDefinition2_0.java | 34 - .../java/JavaManyToManyMappingDefinition2_0.java | 69 - .../java/JavaManyToOneMappingDefinition2_0.java | 55 - .../java/JavaOneToManyMappingDefinition2_0.java | 69 - .../java/JavaOneToOneMappingDefinition2_0.java | 55 - .../jpa2/context/java/NullJavaCacheable2_0.java | 54 - .../context/java/NullJavaDerivedIdentity2_0.java | 96 - .../jpa2/context/java/NullJavaMapKeyColumn2_0.java | 276 - .../context/java/NullJavaOrphanRemoval2_0.java | 54 - .../AbstractOrmElementCollectionMapping2_0.java | 1592 --- .../jpa2/context/orm/GenericOrmCacheable2_0.java | 107 - .../context/orm/GenericOrmCollectionTable2_0.java | 206 - .../context/orm/GenericOrmDerivedIdentity2_0.java | 181 - .../orm/GenericOrmElementCollectionMapping2_0.java | 21 - .../jpa2/context/orm/GenericOrmEmbeddable2_0.java | 33 - .../GenericOrmIdDerivedIdentityStrategy2_0.java | 114 - ...GenericOrmMapsIdDerivedIdentityStrategy2_0.java | 282 - .../jpa2/context/orm/GenericOrmNamedQuery2_0.java | 90 - .../jpa2/context/orm/GenericOrmOrderColumn2_0.java | 200 - .../context/orm/GenericOrmOrphanRemoval2_0.java | 118 - ...rmOverrideJoinTableRelationshipStrategy2_0.java | 61 - .../orm/GenericOrmPersistentAttribute2_0.java | 78 - .../orm/GenericOrmSequenceGenerator2_0.java | 128 - ...alOverrideJoinTableRelationshipStrategy2_0.java | 120 - .../orm/GenericOrmXml2_0ContextNodeFactory.java | 107 - .../context/orm/GenericOrmXml2_0Definition.java | 111 - .../jpa2/context/orm/NullOrmCacheable2_0.java | 53 - .../context/orm/NullOrmDerivedIdentity2_0.java | 99 - .../jpa2/context/orm/NullOrmOrphanRemoval2_0.java | 53 - .../OrmElementCollectionMapping2_0Definition.java | 65 - ...Generic2_0PersistenceXmlContextNodeFactory.java | 31 - .../Generic2_0PersistenceXmlDefinition.java | 53 - .../connection/GenericConnection2_0.java | 194 - .../persistence/connection/NullConnection2_0.java | 110 - .../persistence/options/GenericOptions2_0.java | 337 - .../persistence/options/NullOptions2_0.java | 152 - .../java/Access2_0AnnotationDefinition.java | 62 - ...AssociationOverride2_0AnnotationDefinition.java | 62 - ...ssociationOverrides2_0AnnotationDefinition.java | 62 - .../java/Cacheable2_0AnnotationDefinition.java | 62 - .../CollectionTable2_0AnnotationDefinition.java | 62 - .../ElementCollection2_0AnnotationDefinition.java | 62 - .../java/GeneratedAnnotationDefinition.java | 64 - .../java/MapKeyClass2_0AnnotationDefinition.java | 62 - .../java/MapKeyColumn2_0AnnotationDefinition.java | 62 - .../MapKeyEnumerated2_0AnnotationDefinition.java | 61 - .../MapKeyJoinColumn2_0AnnotationDefinition.java | 60 - .../MapKeyJoinColumns2_0AnnotationDefinition.java | 61 - .../MapKeyTemporal2_0AnnotationDefinition.java | 61 - .../java/MapsId2_0AnnotationDefinition.java | 65 - .../java/NamedQueries2_0AnnotationDefinition.java | 61 - .../java/NamedQuery2_0AnnotationDefinition.java | 61 - .../resource/java/NullAccess2_0Annotation.java | 50 - ...NullAssociationOverrideJoinTableAnnotation.java | 35 - .../java/NullCollectionTable2_0Annotation.java | 64 - .../resource/java/NullMapKeyColumnAnnotation.java | 77 - .../java/NullMapKeyEnumerated2_0Annotation.java | 48 - .../java/NullMapKeyTemporal2_0Annotation.java | 48 - .../resource/java/NullMapsId2_0Annotation.java | 51 - .../java/NullOrderColumn2_0Annotation.java | 77 - .../java/OrderColumn2_0AnnotationDefinition.java | 62 - .../SequenceGenerator2_0AnnotationDefinition.java | 62 - .../java/SourceMapKeyJoinColumn2_0Annotation.java | 111 - .../java/SourceMapKeyJoinColumns2_0Annotation.java | 137 - .../java/StaticMetamodelAnnotationDefinition.java | 64 - .../java/binary/BinaryAccess2_0Annotation.java | 77 - .../BinaryAssociationOverride2_0Annotation.java | 95 - .../BinaryAssociationOverrides2_0Annotation.java | 33 - .../java/binary/BinaryCacheable2_0Annotation.java | 70 - .../binary/BinaryCollectionTable2_0Annotation.java | 118 - .../BinaryElementCollection2_0Annotation.java | 102 - .../java/binary/BinaryGeneratedAnnotation.java | 140 - .../binary/BinaryMapKeyClass2_0Annotation.java | 79 - .../binary/BinaryMapKeyColumn2_0Annotation.java | 92 - .../BinaryMapKeyEnumerated2_0Annotation.java | 38 - .../BinaryMapKeyJoinColumn2_0Annotation.java | 83 - .../BinaryMapKeyJoinColumns2_0Annotation.java | 69 - .../binary/BinaryMapKeyTemporal2_0Annotation.java | 38 - .../java/binary/BinaryMapsId2_0Annotation.java | 80 - .../binary/BinaryNamedQueries2_0Annotation.java | 32 - .../java/binary/BinaryNamedQuery2_0Annotation.java | 69 - .../binary/BinaryOrderColumn2_0Annotation.java | 147 - .../BinarySequenceGenerator2_0Annotation.java | 102 - .../binary/BinaryStaticMetamodelAnnotation.java | 73 - .../java/source/SourceAccess2_0Annotation.java | 104 - .../SourceAssociationOverride2_0Annotation.java | 180 - .../SourceAssociationOverrides2_0Annotation.java | 33 - .../java/source/SourceCacheable2_0Annotation.java | 105 - .../source/SourceCollectionTable2_0Annotation.java | 272 - .../SourceElementCollection2_0Annotation.java | 188 - .../java/source/SourceGeneratedAnnotation.java | 222 - .../source/SourceMapKeyClass2_0Annotation.java | 138 - .../source/SourceMapKeyColumn2_0Annotation.java | 95 - .../SourceMapKeyEnumerated2_0Annotation.java | 41 - .../source/SourceMapKeyTemporal2_0Annotation.java | 42 - .../java/source/SourceMapsId2_0Annotation.java | 108 - .../source/SourceNamedQueries2_0Annotation.java | 33 - .../java/source/SourceNamedQuery2_0Annotation.java | 147 - .../source/SourceOrderColumn2_0Annotation.java | 244 - .../SourceSequenceGenerator2_0Annotation.java | 127 - .../source/SourceStaticMetamodelAnnotation.java | 133 - ...ndlesLibraryProviderInstallOperationConfig.java | 36 - ...aUserLibraryProviderInstallOperationConfig.java | 37 - .../libprov/LegacyJpaLibraryProviderDetector.java | 35 - ...LegacyJpaLibraryProviderUninstallOperation.java | 27 - .../AbstractOsgiBundlesLibraryValidator.java | 64 - .../GenericEclipseLinkBundlesLibraryValidator.java | 38 - .../libval/GenericJpaUserLibraryValidator.java | 46 - .../AbstractJpaFileCreationDataModelProvider.java | 157 - .../AbstractJpaFileCreationOperation.java | 132 - .../JpaFileCreationDataModelProperties.java | 22 - .../OrmFileCreationDataModelProperties.java | 32 - .../OrmFileCreationDataModelProvider.java | 280 - .../operations/OrmFileCreationOperation.java | 108 - ...PersistenceFileCreationDataModelProperties.java | 17 - .../PersistenceFileCreationDataModelProvider.java | 73 - .../PersistenceFileCreationOperation.java | 31 - .../platform/JpaPlatformDescriptionImpl.java | 109 - .../platform/JpaPlatformGroupDescriptionImpl.java | 68 - .../internal/platform/JpaPlatformManagerImpl.java | 238 - .../internal/prefs/JpaPreferenceInitializer.java | 26 - .../AbstractJpaDeleteTypeParticipant.java | 288 - .../AbstractJpaMoveJavaElementParticipant.java | 294 - .../AbstractJpaRenameJavaElementParticipant.java | 257 - .../refactoring/JpaCoreRefactoringMessages.java | 81 - .../JpaDeleteMappingFileParticipant.java | 210 - .../JpaDeletePackageOrFolderParticipant.java | 255 - .../refactoring/JpaDeleteTypeParticipant.java | 47 - .../refactoring/JpaMoveFolderParticipant.java | 239 - .../refactoring/JpaMoveMappingFileParticipant.java | 242 - .../refactoring/JpaMoveTypeParticipant.java | 113 - .../refactoring/JpaRenameFolderParticipant.java | 194 - .../JpaRenameMappingFileParticipant.java | 189 - .../refactoring/JpaRenamePackageParticipant.java | 75 - .../refactoring/JpaRenameTypeParticipant.java | 165 - .../IndeterminateContentDescriber.java | 41 - .../resource/java/AbstractJavaResourceNode.java | 109 - .../AssociationOverrideAnnotationDefinition.java | 62 - .../AssociationOverridesAnnotationDefinition.java | 62 - .../AttributeOverrideAnnotationDefinition.java | 62 - .../AttributeOverridesAnnotationDefinition.java | 62 - .../resource/java/BasicAnnotationDefinition.java | 62 - .../resource/java/ColumnAnnotationDefinition.java | 62 - .../DiscriminatorColumnAnnotationDefinition.java | 63 - .../DiscriminatorValueAnnotationDefinition.java | 62 - .../java/EmbeddableAnnotationDefinition.java | 62 - .../java/EmbeddedAnnotationDefinition.java | 62 - .../java/EmbeddedIdAnnotationDefinition.java | 62 - .../resource/java/EntityAnnotationDefinition.java | 62 - .../java/EnumeratedAnnotationDefinition.java | 62 - .../java/GeneratedValueAnnotationDefinition.java | 62 - .../resource/java/IdAnnotationDefinition.java | 62 - .../resource/java/IdClassAnnotationDefinition.java | 62 - .../java/InheritanceAnnotationDefinition.java | 62 - .../java/JoinColumnAnnotationDefinition.java | 62 - .../java/JoinColumnsAnnotationDefinition.java | 62 - .../java/JoinTableAnnotationDefinition.java | 62 - .../resource/java/LobAnnotationDefinition.java | 62 - .../java/ManyToManyAnnotationDefinition.java | 62 - .../java/ManyToOneAnnotationDefinition.java | 62 - .../resource/java/MapKeyAnnotationDefinition.java | 62 - .../java/MappedSuperclassAnnotationDefinition.java | 62 - .../NamedNativeQueriesAnnotationDefinition.java | 61 - .../java/NamedNativeQueryAnnotationDefinition.java | 61 - .../java/NamedQueriesAnnotationDefinition.java | 61 - .../java/NamedQueryAnnotationDefinition.java | 61 - .../internal/resource/java/NullAnnotation.java | 94 - .../NullAttributeOverrideColumnAnnotation.java | 33 - .../resource/java/NullBaseColumnAnnotation.java | 110 - .../resource/java/NullBaseTableAnnotation.java | 124 - .../resource/java/NullColumnAnnotation.java | 77 - .../java/NullDiscriminatorColumnAnnotation.java | 52 - .../java/NullDiscriminatorValueAnnotation.java | 46 - .../resource/java/NullEnumeratedAnnotation.java | 47 - .../resource/java/NullInheritanceAnnotation.java | 47 - .../resource/java/NullJoinColumnAnnotation.java | 48 - .../resource/java/NullJoinTableAnnotation.java | 93 - .../resource/java/NullNamedColumnAnnotation.java | 72 - .../java/NullPrimaryKeyJoinColumnAnnotation.java | 48 - .../resource/java/NullTableAnnotation.java | 29 - .../resource/java/NullTemporalAnnotation.java | 47 - .../java/OneToManyAnnotationDefinition.java | 62 - .../java/OneToOneAnnotationDefinition.java | 62 - .../resource/java/OrderByAnnotationDefinition.java | 62 - .../PrimaryKeyJoinColumnAnnotationDefinition.java | 62 - .../PrimaryKeyJoinColumnsAnnotationDefinition.java | 62 - .../java/SecondaryTableAnnotationDefinition.java | 62 - .../java/SecondaryTablesAnnotationDefinition.java | 62 - .../SequenceGeneratorAnnotationDefinition.java | 62 - .../resource/java/TableAnnotationDefinition.java | 62 - .../java/TableGeneratorAnnotationDefinition.java | 62 - .../java/TemporalAnnotationDefinition.java | 62 - .../java/TransientAnnotationDefinition.java | 62 - .../resource/java/VersionAnnotationDefinition.java | 62 - .../java/binary/BinaryAnnotatedElement.java | 225 - .../resource/java/binary/BinaryAnnotation.java | 113 - .../BinaryAssociationOverrideAnnotation.java | 101 - .../BinaryAssociationOverridesAnnotation.java | 70 - .../binary/BinaryAttributeOverrideAnnotation.java | 111 - .../binary/BinaryAttributeOverridesAnnotation.java | 68 - .../java/binary/BinaryBaseColumnAnnotation.java | 184 - .../binary/BinaryBaseEnumeratedAnnotation.java | 68 - .../binary/BinaryBaseJoinColumnAnnotation.java | 73 - .../java/binary/BinaryBaseTableAnnotation.java | 199 - .../java/binary/BinaryBaseTemporalAnnotation.java | 68 - .../java/binary/BinaryBasicAnnotation.java | 97 - .../resource/java/binary/BinaryClassFile.java | 68 - .../java/binary/BinaryColumnAnnotation.java | 91 - .../binary/BinaryCompleteColumnAnnotation.java | 124 - .../java/binary/BinaryContainerAnnotation.java | 73 - .../BinaryDiscriminatorColumnAnnotation.java | 100 - .../binary/BinaryDiscriminatorValueAnnotation.java | 70 - .../java/binary/BinaryEmbeddableAnnotation.java | 32 - .../java/binary/BinaryEmbeddedAnnotation.java | 32 - .../java/binary/BinaryEmbeddedIdAnnotation.java | 32 - .../java/binary/BinaryEntityAnnotation.java | 75 - .../java/binary/BinaryEnumeratedAnnotation.java | 37 - .../binary/BinaryGeneratedValueAnnotation.java | 101 - .../java/binary/BinaryGeneratorAnnotation.java | 129 - .../resource/java/binary/BinaryIdAnnotation.java | 32 - .../java/binary/BinaryIdClassAnnotation.java | 78 - .../java/binary/BinaryInheritanceAnnotation.java | 71 - .../java/binary/BinaryJoinColumnAnnotation.java | 82 - .../java/binary/BinaryJoinColumnsAnnotation.java | 68 - .../java/binary/BinaryJoinTableAnnotation.java | 163 - .../resource/java/binary/BinaryLobAnnotation.java | 31 - .../java/binary/BinaryManyToManyAnnotation.java | 92 - .../java/binary/BinaryManyToOneAnnotation.java | 88 - .../java/binary/BinaryMapKeyAnnotation.java | 79 - .../binary/BinaryMappedSuperclassAnnotation.java | 28 - .../java/binary/BinaryNamedColumnAnnotation.java | 111 - .../binary/BinaryNamedNativeQueriesAnnotation.java | 68 - .../binary/BinaryNamedNativeQueryAnnotation.java | 119 - .../java/binary/BinaryNamedQueriesAnnotation.java | 70 - .../java/binary/BinaryNamedQueryAnnotation.java | 50 - .../internal/resource/java/binary/BinaryNode.java | 62 - .../java/binary/BinaryOneToManyAnnotation.java | 121 - .../java/binary/BinaryOneToOneAnnotation.java | 148 - .../java/binary/BinaryOrderByAnnotation.java | 70 - .../java/binary/BinaryOverrideAnnotation.java | 78 - .../java/binary/BinaryPackageFragment.java | 125 - .../java/binary/BinaryPackageFragmentRoot.java | 116 - .../java/binary/BinaryPersistentAttribute.java | 657 - .../java/binary/BinaryPersistentMember.java | 190 - .../resource/java/binary/BinaryPersistentType.java | 694 - .../java/binary/BinaryPersistentTypeCache.java | 149 - .../BinaryPrimaryKeyJoinColumnAnnotation.java | 87 - .../BinaryPrimaryKeyJoinColumnsAnnotation.java | 69 - .../java/binary/BinaryQueryAnnotation.java | 154 - .../java/binary/BinaryQueryHintAnnotation.java | 101 - .../BinaryRelationshipMappingAnnotation.java | 232 - .../binary/BinarySecondaryTableAnnotation.java | 115 - .../binary/BinarySecondaryTablesAnnotation.java | 68 - .../binary/BinarySequenceGeneratorAnnotation.java | 92 - .../java/binary/BinaryTableAnnotation.java | 55 - .../binary/BinaryTableGeneratorAnnotation.java | 293 - .../java/binary/BinaryTemporalAnnotation.java | 37 - .../java/binary/BinaryTransientAnnotation.java | 32 - .../binary/BinaryUniqueConstraintAnnotation.java | 97 - .../java/binary/BinaryVersionAnnotation.java | 32 - .../resource/java/binary/RootBinaryNode.java | 82 - .../java/source/AnnotationContainerTools.java | 281 - .../java/source/SourceAnnotatedElement.java | 472 - .../resource/java/source/SourceAnnotation.java | 265 - .../SourceAssociationOverrideAnnotation.java | 245 - .../SourceAssociationOverridesAnnotation.java | 131 - .../source/SourceAttributeOverrideAnnotation.java | 182 - .../source/SourceAttributeOverridesAnnotation.java | 135 - .../java/source/SourceBaseColumnAnnotation.java | 334 - .../source/SourceBaseEnumeratedAnnotation.java | 93 - .../source/SourceBaseJoinColumnAnnotation.java | 145 - .../java/source/SourceBaseTableAnnotation.java | 426 - .../java/source/SourceBaseTemporalAnnotation.java | 94 - .../java/source/SourceBasicAnnotation.java | 144 - .../java/source/SourceColumnAnnotation.java | 106 - .../java/source/SourceCompilationUnit.java | 177 - .../source/SourceCompleteColumnAnnotation.java | 222 - .../SourceDiscriminatorColumnAnnotation.java | 181 - .../source/SourceDiscriminatorValueAnnotation.java | 103 - .../java/source/SourceEmbeddableAnnotation.java | 45 - .../java/source/SourceEmbeddedAnnotation.java | 45 - .../java/source/SourceEmbeddedIdAnnotation.java | 45 - .../java/source/SourceEntityAnnotation.java | 103 - .../java/source/SourceEnumeratedAnnotation.java | 38 - .../source/SourceGeneratedValueAnnotation.java | 148 - .../java/source/SourceGeneratorAnnotation.java | 186 - .../resource/java/source/SourceIdAnnotation.java | 45 - .../java/source/SourceIdClassAnnotation.java | 159 - .../java/source/SourceInheritanceAnnotation.java | 104 - .../java/source/SourceJoinColumnAnnotation.java | 119 - .../java/source/SourceJoinColumnsAnnotation.java | 134 - .../java/source/SourceJoinTableAnnotation.java | 409 - .../resource/java/source/SourceLobAnnotation.java | 45 - .../java/source/SourceManyToManyAnnotation.java | 141 - .../java/source/SourceManyToOneAnnotation.java | 142 - .../java/source/SourceMapKeyAnnotation.java | 107 - .../source/SourceMappedSuperclassAnnotation.java | 45 - .../java/source/SourceNamedColumnAnnotation.java | 194 - .../source/SourceNamedNativeQueriesAnnotation.java | 135 - .../source/SourceNamedNativeQueryAnnotation.java | 250 - .../source/SourceNamedQueries1_0Annotation.java | 32 - .../java/source/SourceNamedQueriesAnnotation.java | 131 - .../java/source/SourceNamedQueryAnnotation.java | 80 - .../internal/resource/java/source/SourceNode.java | 35 - .../java/source/SourceOneToManyAnnotation.java | 185 - .../java/source/SourceOneToOneAnnotation.java | 227 - .../java/source/SourceOrderByAnnotation.java | 102 - .../java/source/SourceOverrideAnnotation.java | 140 - .../resource/java/source/SourcePackage.java | 118 - .../source/SourcePackageInfoCompilationUnit.java | 120 - .../java/source/SourcePersistentAttribute.java | 408 - .../java/source/SourcePersistentMember.java | 138 - .../resource/java/source/SourcePersistentType.java | 930 -- .../SourcePrimaryKeyJoinColumnAnnotation.java | 185 - .../SourcePrimaryKeyJoinColumnsAnnotation.java | 135 - .../java/source/SourceQueryAnnotation.java | 351 - .../java/source/SourceQueryHintAnnotation.java | 201 - .../SourceRelationshipMappingAnnotation.java | 357 - .../source/SourceSecondaryTableAnnotation.java | 283 - .../source/SourceSecondaryTablesAnnotation.java | 135 - .../source/SourceSequenceGeneratorAnnotation.java | 132 - .../java/source/SourceTableAnnotation.java | 68 - .../source/SourceTableGeneratorAnnotation.java | 470 - .../java/source/SourceTemporalAnnotation.java | 39 - .../java/source/SourceTransientAnnotation.java | 45 - .../java/source/SourceTypeCompilationUnit.java | 167 - .../source/SourceUniqueConstraintAnnotation.java | 196 - .../java/source/SourceVersionAnnotation.java | 45 - .../resource/orm/OrmXmlResourceProvider.java | 82 - .../PersistenceXmlResourceProvider.java | 75 - .../resource/xml/JpaXmlResourceAdapterFactory.java | 48 - .../resource/xml/JpaXmlResourcePropertyTester.java | 53 - .../core/internal/synch/SynchronizeClassesJob.java | 146 - .../validation/DefaultJpaValidationMessages.java | 68 - .../jpa/core/internal/validation/JpaHelper.java | 32 - .../JpaValidationDescriptionMessages.java | 36 - .../internal/validation/JpaValidationMessages.java | 226 - .../validation/JpaValidationPreferences.java | 140 - .../jpa/core/internal/validation/JpaValidator.java | 122 - .../eclipse/jpt/jpa/core/jpa2/JpaFactory2_0.java | 93 - .../eclipse/jpt/jpa/core/jpa2/JpaProject2_0.java | 102 - .../eclipse/jpt/jpa/core/jpa2/MappingKeys2_0.java | 28 - .../jpt/jpa/core/jpa2/MetamodelSynchronizer.java | 93 - .../jpa/core/jpa2/context/AttributeMapping2_0.java | 45 - .../jpt/jpa/core/jpa2/context/Cacheable2_0.java | 37 - .../jpa/core/jpa2/context/CacheableHolder2_0.java | 32 - .../jpt/jpa/core/jpa2/context/Cascade2_0.java | 32 - .../core/jpa2/context/CollectionMapping2_0.java | 59 - .../jpa/core/jpa2/context/CollectionTable2_0.java | 30 - .../jpa/core/jpa2/context/DerivedIdentity2_0.java | 113 - .../jpa2/context/DerivedIdentityStrategy2_0.java | 43 - .../jpa2/context/ElementCollectionMapping2_0.java | 83 - .../core/jpa2/context/EmbeddedIdMapping2_0.java | 30 - .../jpa/core/jpa2/context/EmbeddedMapping2_0.java | 31 - .../jpa2/context/IdDerivedIdentityStrategy2_0.java | 41 - .../jpt/jpa/core/jpa2/context/IdMapping2_0.java | 30 - .../core/jpa2/context/JpaRootContextNode2_0.java | 31 - .../jpt/jpa/core/jpa2/context/LockModeType2_0.java | 120 - .../core/jpa2/context/ManyToManyMapping2_0.java | 31 - .../jpa/core/jpa2/context/ManyToOneMapping2_0.java | 31 - .../jpa2/context/ManyToOneRelationship2_0.java | 31 - .../context/MappedByRelationshipMapping2_0.java | 38 - .../MappingFilePersistenceUnitDefaults2_0.java | 34 - .../MappingFilePersistenceUnitMetadata2_0.java | 31 - .../context/MapsIdDerivedIdentityStrategy2_0.java | 76 - .../jpt/jpa/core/jpa2/context/MetamodelField.java | 36 - .../jpa/core/jpa2/context/MetamodelSourceType.java | 116 - .../jpt/jpa/core/jpa2/context/NamedQuery2_0.java | 41 - .../jpa/core/jpa2/context/OneToManyMapping2_0.java | 31 - .../jpa2/context/OneToManyRelationship2_0.java | 31 - .../jpa/core/jpa2/context/OneToOneMapping2_0.java | 31 - .../core/jpa2/context/OneToOneRelationship2_0.java | 32 - .../jpt/jpa/core/jpa2/context/OrderColumn2_0.java | 72 - .../jpt/jpa/core/jpa2/context/Orderable2_0.java | 53 - .../jpa/core/jpa2/context/OrphanRemovable2_0.java | 38 - .../core/jpa2/context/OrphanRemovalHolder2_0.java | 28 - .../core/jpa2/context/OverrideRelationship2_0.java | 36 - .../core/jpa2/context/PersistentAttribute2_0.java | 31 - .../jpa/core/jpa2/context/PersistentType2_0.java | 36 - .../context/ReadOnlyOverrideRelationship2_0.java | 32 - .../context/ReadOnlyPersistentAttribute2_0.java | 45 - .../core/jpa2/context/SequenceGenerator2_0.java | 56 - .../jpa2/context/SingleRelationshipMapping2_0.java | 30 - .../context/VirtualOverrideRelationship2_0.java | 30 - .../core/jpa2/context/java/JavaCacheable2_0.java | 31 - .../jpa2/context/java/JavaCacheableHolder2_0.java | 33 - .../jpa/core/jpa2/context/java/JavaCascade2_0.java | 31 - .../context/java/JavaCollectionMapping2_0.java | 40 - .../jpa2/context/java/JavaCollectionTable2_0.java | 32 - .../jpa2/context/java/JavaDerivedIdentity2_0.java | 41 - .../java/JavaElementCollectionMapping2_0.java | 50 - .../jpa2/context/java/JavaEmbeddedMapping2_0.java | 32 - .../java/JavaIdDerivedIdentityStrategy2_0.java | 31 - .../context/java/JavaManyToManyMapping2_0.java | 31 - .../jpa2/context/java/JavaManyToOneMapping2_0.java | 32 - .../context/java/JavaManyToOneRelationship2_0.java | 34 - .../java/JavaMapsIdDerivedIdentityStrategy2_0.java | 31 - .../core/jpa2/context/java/JavaNamedQuery2_0.java | 32 - .../jpa2/context/java/JavaOneToManyMapping2_0.java | 31 - .../context/java/JavaOneToManyRelationship2_0.java | 34 - .../jpa2/context/java/JavaOneToOneMapping2_0.java | 31 - .../context/java/JavaOneToOneRelationship2_0.java | 34 - .../core/jpa2/context/java/JavaOrderColumn2_0.java | 32 - .../core/jpa2/context/java/JavaOrderable2_0.java | 34 - .../jpa2/context/java/JavaOrphanRemovable2_0.java | 31 - .../context/java/JavaOrphanRemovalHolder2_0.java | 29 - .../context/java/JavaOverrideRelationship2_0.java | 35 - .../context/java/JavaPersistentAttribute2_0.java | 32 - .../jpa2/context/java/JavaPersistentType2_0.java | 35 - .../context/java/JavaSequenceGenerator2_0.java | 29 - .../java/JavaSingleRelationshipMapping2_0.java | 31 - .../java/JavaVirtualOverrideRelationship2_0.java | 32 - .../jpa/core/jpa2/context/orm/OrmCacheable2_0.java | 31 - .../jpa2/context/orm/OrmCacheableHolder2_0.java | 33 - .../jpa/core/jpa2/context/orm/OrmCascade2_0.java | 31 - .../jpa2/context/orm/OrmCollectionMapping2_0.java | 32 - .../jpa2/context/orm/OrmCollectionTable2_0.java | 31 - .../jpa2/context/orm/OrmDerivedIdentity2_0.java | 37 - .../orm/OrmElementCollectionMapping2_0.java | 43 - .../jpa2/context/orm/OrmEmbeddedMapping2_0.java | 32 - .../orm/OrmIdDerivedIdentityStrategy2_0.java | 31 - .../jpa2/context/orm/OrmManyToManyMapping2_0.java | 31 - .../jpa2/context/orm/OrmManyToOneMapping2_0.java | 31 - .../context/orm/OrmManyToOneRelationship2_0.java | 34 - .../orm/OrmMapsIdDerivedIdentityStrategy2_0.java | 31 - .../core/jpa2/context/orm/OrmNamedQuery2_0.java | 32 - .../jpa2/context/orm/OrmOneToManyMapping2_0.java | 31 - .../context/orm/OrmOneToManyRelationship2_0.java | 34 - .../jpa2/context/orm/OrmOneToOneMapping2_0.java | 31 - .../context/orm/OrmOneToOneRelationship2_0.java | 34 - .../core/jpa2/context/orm/OrmOrderColumn2_0.java | 48 - .../jpa/core/jpa2/context/orm/OrmOrderable2_0.java | 31 - .../jpa2/context/orm/OrmOrphanRemovable2_0.java | 31 - .../context/orm/OrmOrphanRemovalHolder2_0.java | 29 - .../context/orm/OrmOverrideRelationship2_0.java | 47 - .../context/orm/OrmPersistenceUnitDefaults2_0.java | 35 - .../context/orm/OrmPersistenceUnitMetadata2_0.java | 34 - .../context/orm/OrmPersistentAttribute2_0.java | 33 - .../jpa2/context/orm/OrmPersistentType2_0.java | 34 - .../orm/OrmReadOnlyPersistentAttribute2_0.java | 33 - .../jpa2/context/orm/OrmSequenceGenerator2_0.java | 32 - .../orm/OrmSingleRelationshipMapping2_0.java | 31 - .../orm/OrmVirtualOverrideRelationship2_0.java | 32 - .../context/orm/OrmXml2_0ContextNodeFactory.java | 52 - .../jpa2/context/persistence/Persistence2_0.java | 31 - .../context/persistence/PersistenceUnit2_0.java | 127 - .../context/persistence/PersistenceXml2_0.java | 31 - .../persistence/connection/JpaConnection2_0.java | 59 - .../context/persistence/options/JpaOptions2_0.java | 74 - .../persistence/options/SharedCacheMode.java | 77 - .../persistence/options/ValidationMode.java | 68 - .../jpa2/resource/java/Access2_0Annotation.java | 55 - .../java/AssociationOverride2_0Annotation.java | 51 - .../jpa2/resource/java/Cacheable2_0Annotation.java | 52 - .../java/CollectionTable2_0Annotation.java | 31 - .../java/ElementCollection2_0Annotation.java | 93 - .../jpa2/resource/java/GeneratedAnnotation.java | 117 - .../jpt/jpa/core/jpa2/resource/java/JPA2_0.java | 147 - .../java/JavaResourcePersistentType2_0.java | 85 - .../core/jpa2/resource/java/LockModeType_2_0.java | 72 - .../resource/java/ManyToMany2_0Annotation.java | 31 - .../jpa2/resource/java/ManyToOne2_0Annotation.java | 31 - .../resource/java/MapKeyClass2_0Annotation.java | 68 - .../resource/java/MapKeyColumn2_0Annotation.java | 31 - .../java/MapKeyEnumerated2_0Annotation.java | 32 - .../java/MapKeyJoinColumn2_0Annotation.java | 31 - .../java/MapKeyJoinColumns2_0Annotation.java | 33 - .../resource/java/MapKeyTemporal2_0Annotation.java | 32 - .../jpa2/resource/java/MapsId2_0Annotation.java | 58 - .../resource/java/NamedQuery2_0Annotation.java | 58 - .../java/NestableMapKeyJoinColumnAnnotation.java | 31 - .../jpa2/resource/java/OneToMany2_0Annotation.java | 31 - .../jpa2/resource/java/OneToOne2_0Annotation.java | 31 - .../resource/java/OrderColumn2_0Annotation.java | 100 - .../OwningRelationshipMapping2_0Annotation.java | 52 - .../java/RelationshipMapping2_0Annotation.java | 43 - .../java/SequenceGenerator2_0Annotation.java | 86 - .../resource/java/StaticMetamodelAnnotation.java | 60 - .../JpaLibraryProviderInstallOperationConfig.java | 24 - .../jpt/jpa/core/platform/GenericPlatform.java | 41 - .../jpa/core/platform/JpaPlatformDescription.java | 41 - .../core/platform/JpaPlatformGroupDescription.java | 33 - .../jpt/jpa/core/platform/JpaPlatformManager.java | 46 - .../core/resource/AbstractXmlResourceProvider.java | 386 - .../jpa/core/resource/JpaXmlResourceProvider.java | 30 - .../core/resource/JpaXmlResourceProviderEvent.java | 48 - .../resource/JpaXmlResourceProviderListener.java | 28 - .../jpt/jpa/core/resource/java/AccessType.java | 67 - .../jpt/jpa/core/resource/java/Annotation.java | 91 - .../core/resource/java/AnnotationContainer.java | 92 - .../core/resource/java/AnnotationDefinition.java | 67 - .../java/AssociationOverrideAnnotation.java | 70 - .../java/AssociationOverridesAnnotation.java | 31 - .../resource/java/AttributeOverrideAnnotation.java | 50 - .../java/AttributeOverridesAnnotation.java | 31 - .../core/resource/java/BaseColumnAnnotation.java | 149 - .../resource/java/BaseJoinColumnAnnotation.java | 59 - .../core/resource/java/BaseTableAnnotation.java | 165 - .../jpa/core/resource/java/BasicAnnotation.java | 72 - .../jpt/jpa/core/resource/java/CascadeType.java | 106 - .../jpa/core/resource/java/ColumnAnnotation.java | 29 - .../resource/java/CompleteColumnAnnotation.java | 97 - .../core/resource/java/ContainerAnnotation.java | 47 - .../java/DiscriminatorColumnAnnotation.java | 62 - .../jpa/core/resource/java/DiscriminatorType.java | 65 - .../java/DiscriminatorValueAnnotation.java | 51 - .../core/resource/java/EmbeddableAnnotation.java | 29 - .../jpa/core/resource/java/EmbeddedAnnotation.java | 29 - .../core/resource/java/EmbeddedIdAnnotation.java | 29 - .../jpa/core/resource/java/EntityAnnotation.java | 52 - .../jpt/jpa/core/resource/java/EnumType.java | 64 - .../core/resource/java/EnumeratedAnnotation.java | 52 - .../jpt/jpa/core/resource/java/FetchType.java | 64 - .../resource/java/GeneratedValueAnnotation.java | 78 - .../jpt/jpa/core/resource/java/GenerationType.java | 66 - .../core/resource/java/GeneratorAnnotation.java | 92 - .../jpt/jpa/core/resource/java/IdAnnotation.java | 29 - .../jpa/core/resource/java/IdClassAnnotation.java | 67 - .../core/resource/java/InheritanceAnnotation.java | 52 - .../jpa/core/resource/java/InheritanceType.java | 65 - .../eclipse/jpt/jpa/core/resource/java/JPA.java | 303 - .../java/JavaResourceAnnotatedElement.java | 137 - .../core/resource/java/JavaResourceClassFile.java | 33 - .../resource/java/JavaResourceCompilationUnit.java | 68 - .../jpa/core/resource/java/JavaResourceNode.java | 100 - .../core/resource/java/JavaResourcePackage.java | 35 - .../resource/java/JavaResourcePackageFragment.java | 46 - .../java/JavaResourcePackageFragmentRoot.java | 40 - .../JavaResourcePackageInfoCompilationUnit.java | 30 - .../java/JavaResourcePersistentAttribute.java | 144 - .../java/JavaResourcePersistentMember.java | 83 - .../resource/java/JavaResourcePersistentType.java | 215 - .../java/JavaResourcePersistentTypeCache.java | 48 - .../core/resource/java/JoinColumnAnnotation.java | 29 - .../core/resource/java/JoinColumnsAnnotation.java | 31 - .../core/resource/java/JoinTableAnnotation.java | 72 - .../jpt/jpa/core/resource/java/LobAnnotation.java | 29 - .../core/resource/java/ManyToManyAnnotation.java | 29 - .../core/resource/java/ManyToOneAnnotation.java | 29 - .../jpa/core/resource/java/MapKeyAnnotation.java | 58 - .../resource/java/MappedSuperclassAnnotation.java | 29 - .../core/resource/java/NamedColumnAnnotation.java | 92 - .../java/NamedNativeQueriesAnnotation.java | 31 - .../resource/java/NamedNativeQueryAnnotation.java | 89 - .../core/resource/java/NamedQueriesAnnotation.java | 31 - .../core/resource/java/NamedQueryAnnotation.java | 29 - .../jpa/core/resource/java/NestableAnnotation.java | 60 - .../NestableAssociationOverrideAnnotation.java | 29 - .../java/NestableAttributeOverrideAnnotation.java | 29 - .../java/NestableJoinColumnAnnotation.java | 29 - .../java/NestableNamedNativeQueryAnnotation.java | 29 - .../java/NestableNamedQueryAnnotation.java | 29 - .../NestablePrimaryKeyJoinColumnAnnotation.java | 29 - .../resource/java/NestableQueryHintAnnotation.java | 29 - .../java/NestableSecondaryTableAnnotation.java | 29 - .../java/NestableUniqueConstraintAnnotation.java | 29 - .../core/resource/java/OneToManyAnnotation.java | 29 - .../jpa/core/resource/java/OneToOneAnnotation.java | 29 - .../jpa/core/resource/java/OrderByAnnotation.java | 52 - .../jpa/core/resource/java/OverrideAnnotation.java | 58 - .../java/OwnableRelationshipMappingAnnotation.java | 61 - .../java/PrimaryKeyJoinColumnAnnotation.java | 61 - .../java/PrimaryKeyJoinColumnsAnnotation.java | 31 - .../jpa/core/resource/java/QueryAnnotation.java | 117 - .../core/resource/java/QueryHintAnnotation.java | 72 - .../resource/java/ReferenceTableAnnotation.java | 70 - .../java/RelationshipMappingAnnotation.java | 153 - .../resource/java/SecondaryTableAnnotation.java | 72 - .../resource/java/SecondaryTablesAnnotation.java | 31 - .../resource/java/SequenceGeneratorAnnotation.java | 58 - .../java/SingleRelationshipMappingAnnotation.java | 47 - .../jpa/core/resource/java/TableAnnotation.java | 29 - .../resource/java/TableGeneratorAnnotation.java | 227 - .../jpa/core/resource/java/TemporalAnnotation.java | 52 - .../jpt/jpa/core/resource/java/TemporalType.java | 65 - .../core/resource/java/TransientAnnotation.java | 29 - .../resource/java/UniqueConstraintAnnotation.java | 76 - .../jpa/core/resource/java/VersionAnnotation.java | 29 - .../resource/orm/AbstractXmlAttributeMapping.java | 280 - .../jpa/core/resource/orm/AbstractXmlColumn.java | 500 - .../jpa/core/resource/orm/AbstractXmlEmbedded.java | 220 - .../orm/AbstractXmlMultiRelationshipMapping.java | 1100 -- .../core/resource/orm/AbstractXmlNamedColumn.java | 286 - .../resource/orm/AbstractXmlReferenceTable.java | 222 - .../orm/AbstractXmlRelationshipMapping.java | 400 - .../orm/AbstractXmlSingleRelationshipMapping.java | 614 - .../jpa/core/resource/orm/AbstractXmlTable.java | 439 - .../core/resource/orm/AbstractXmlTypeMapping.java | 547 - .../jpt/jpa/core/resource/orm/AccessType.java | 235 - .../jpt/jpa/core/resource/orm/Attributes.java | 792 -- .../jpt/jpa/core/resource/orm/CascadeType.java | 586 - .../jpt/jpa/core/resource/orm/ColumnMapping.java | 65 - .../jpt/jpa/core/resource/orm/ColumnResult.java | 221 - .../jpa/core/resource/orm/DiscriminatorType.java | 262 - .../jpt/jpa/core/resource/orm/EntityListener.java | 928 -- .../jpt/jpa/core/resource/orm/EntityListeners.java | 200 - .../jpt/jpa/core/resource/orm/EntityResult.java | 363 - .../jpt/jpa/core/resource/orm/EnumType.java | 235 - .../jpt/jpa/core/resource/orm/EventMethod.java | 285 - .../jpt/jpa/core/resource/orm/FetchType.java | 235 - .../jpt/jpa/core/resource/orm/FieldResult.java | 294 - .../jpt/jpa/core/resource/orm/GenerationType.java | 289 - .../jpt/jpa/core/resource/orm/Inheritance.java | 231 - .../jpt/jpa/core/resource/orm/InheritanceType.java | 260 - .../org/eclipse/jpt/jpa/core/resource/orm/JPA.java | 120 - .../org/eclipse/jpt/jpa/core/resource/orm/Lob.java | 56 - .../eclipse/jpt/jpa/core/resource/orm/MapKey.java | 221 - .../jpt/jpa/core/resource/orm/OrmFactory.java | 970 -- .../jpt/jpa/core/resource/orm/OrmPackage.java | 12554 ------------------- .../core/resource/orm/OrmXmlResourceFactory.java | 47 - .../jpt/jpa/core/resource/orm/PostLoad.java | 68 - .../jpt/jpa/core/resource/orm/PostPersist.java | 68 - .../jpt/jpa/core/resource/orm/PostRemove.java | 68 - .../jpt/jpa/core/resource/orm/PostUpdate.java | 68 - .../jpt/jpa/core/resource/orm/PrePersist.java | 68 - .../jpt/jpa/core/resource/orm/PreRemove.java | 68 - .../jpt/jpa/core/resource/orm/PreUpdate.java | 68 - .../jpa/core/resource/orm/SqlResultSetMapping.java | 418 - .../jpt/jpa/core/resource/orm/TemporalType.java | 262 - .../jpt/jpa/core/resource/orm/XmlAccessHolder.java | 68 - .../core/resource/orm/XmlAssociationOverride.java | 521 - .../orm/XmlAssociationOverrideContainer.java | 57 - .../jpa/core/resource/orm/XmlAttributeMapping.java | 70 - .../core/resource/orm/XmlAttributeOverride.java | 440 - .../orm/XmlAttributeOverrideContainer.java | 57 - .../jpt/jpa/core/resource/orm/XmlBasic.java | 687 - .../jpa/core/resource/orm/XmlClassReference.java | 246 - .../jpa/core/resource/orm/XmlCollectionTable.java | 68 - .../jpt/jpa/core/resource/orm/XmlColumn.java | 375 - .../core/resource/orm/XmlConvertibleMapping.java | 144 - .../core/resource/orm/XmlDiscriminatorColumn.java | 297 - .../core/resource/orm/XmlElementCollection.java | 1660 --- .../jpt/jpa/core/resource/orm/XmlEmbeddable.java | 85 - .../jpt/jpa/core/resource/orm/XmlEmbedded.java | 256 - .../jpt/jpa/core/resource/orm/XmlEmbeddedId.java | 74 - .../jpt/jpa/core/resource/orm/XmlEntity.java | 2312 ---- .../jpa/core/resource/orm/XmlEntityMappings.java | 1118 -- .../core/resource/orm/XmlEventMethodContainer.java | 227 - .../jpa/core/resource/orm/XmlGeneratedValue.java | 303 - .../jpt/jpa/core/resource/orm/XmlGenerator.java | 120 - .../core/resource/orm/XmlGeneratorContainer.java | 86 - .../eclipse/jpt/jpa/core/resource/orm/XmlId.java | 805 -- .../jpa/core/resource/orm/XmlIdClassContainer.java | 61 - .../jpt/jpa/core/resource/orm/XmlJoinColumn.java | 234 - .../core/resource/orm/XmlJoinColumnContainer.java | 51 - .../jpt/jpa/core/resource/orm/XmlJoinTable.java | 210 - .../core/resource/orm/XmlJoinTableContainer.java | 59 - .../jpt/jpa/core/resource/orm/XmlManyToMany.java | 88 - .../jpt/jpa/core/resource/orm/XmlManyToOne.java | 85 - .../jpa/core/resource/orm/XmlMappedByMapping.java | 68 - .../jpa/core/resource/orm/XmlMappedSuperclass.java | 574 - .../jpa/core/resource/orm/XmlNamedNativeQuery.java | 586 - .../jpt/jpa/core/resource/orm/XmlNamedQuery.java | 542 - .../core/resource/orm/XmlNullAttributeMapping.java | 54 - .../jpt/jpa/core/resource/orm/XmlOneToMany.java | 376 - .../jpt/jpa/core/resource/orm/XmlOneToOne.java | 467 - .../jpt/jpa/core/resource/orm/XmlOrderColumn.java | 404 - .../jpt/jpa/core/resource/orm/XmlOrderable.java | 64 - .../jpt/jpa/core/resource/orm/XmlOverride.java | 67 - .../resource/orm/XmlPersistenceUnitDefaults.java | 727 -- .../resource/orm/XmlPersistenceUnitMetadata.java | 394 - .../core/resource/orm/XmlPrimaryKeyJoinColumn.java | 230 - .../orm/XmlPrimaryKeyJoinColumnContainer.java | 51 - .../jpt/jpa/core/resource/orm/XmlQuery.java | 111 - .../jpa/core/resource/orm/XmlQueryContainer.java | 67 - .../jpt/jpa/core/resource/orm/XmlQueryHint.java | 366 - .../jpa/core/resource/orm/XmlReferenceTable.java | 57 - .../jpa/core/resource/orm/XmlSecondaryTable.java | 205 - .../core/resource/orm/XmlSequenceGenerator.java | 702 -- .../jpt/jpa/core/resource/orm/XmlTable.java | 71 - .../jpa/core/resource/orm/XmlTableGenerator.java | 947 -- .../jpt/jpa/core/resource/orm/XmlTransient.java | 77 - .../jpt/jpa/core/resource/orm/XmlTypeMapping.java | 164 - .../jpa/core/resource/orm/XmlUniqueConstraint.java | 274 - .../jpt/jpa/core/resource/orm/XmlVersion.java | 523 - .../jpt/jpa/core/resource/orm/v2_0/JPA2_0.java | 53 - .../core/resource/orm/v2_0/LockModeType_2_0.java | 397 - .../jpa/core/resource/orm/v2_0/OrmV2_0Factory.java | 166 - .../jpa/core/resource/orm/v2_0/OrmV2_0Package.java | 3784 ------ .../orm/v2_0/XmlAssociationOverride_2_0.java | 64 - .../resource/orm/v2_0/XmlAttributeMapping_2_0.java | 35 - .../orm/v2_0/XmlAttributeOverride_2_0.java | 67 - .../core/resource/orm/v2_0/XmlAttributes_2_0.java | 86 - .../core/resource/orm/v2_0/XmlCacheable_2_0.java | 71 - .../core/resource/orm/v2_0/XmlCascadeType_2_0.java | 61 - .../resource/orm/v2_0/XmlCollectionTable_2_0.java | 35 - .../core/resource/orm/v2_0/XmlDerivedId_2_0.java | 72 - .../orm/v2_0/XmlElementCollection_2_0.java | 326 - .../core/resource/orm/v2_0/XmlEmbedded_2_0.java | 34 - .../resource/orm/v2_0/XmlEntityListener_2_0.java | 67 - .../jpa/core/resource/orm/v2_0/XmlEntity_2_0.java | 32 - .../core/resource/orm/v2_0/XmlEventMethod_2_0.java | 67 - .../core/resource/orm/v2_0/XmlGenerator_2_0.java | 67 - .../core/resource/orm/v2_0/XmlManyToMany_2_0.java | 34 - .../XmlMapKeyAttributeOverrideContainer_2_0.java | 60 - .../core/resource/orm/v2_0/XmlMapKeyClass_2_0.java | 67 - .../jpa/core/resource/orm/v2_0/XmlMapsId_2_0.java | 70 - .../orm/v2_0/XmlMultiRelationshipMapping_2_0.java | 174 - .../core/resource/orm/v2_0/XmlNamedQuery_2_0.java | 70 - .../core/resource/orm/v2_0/XmlOneToMany_2_0.java | 28 - .../core/resource/orm/v2_0/XmlOneToOne_2_0.java | 33 - .../core/resource/orm/v2_0/XmlOrderColumn_2_0.java | 121 - .../core/resource/orm/v2_0/XmlOrderable_2_0.java | 67 - .../resource/orm/v2_0/XmlOrphanRemovable_2_0.java | 65 - .../orm/v2_0/XmlPersistenceUnitDefaults_2_0.java | 94 - .../orm/v2_0/XmlPersistenceUnitMetadata_2_0.java | 67 - .../core/resource/orm/v2_0/XmlQueryHint_2_0.java | 67 - .../jpa/core/resource/orm/v2_0/XmlQuery_2_0.java | 67 - .../orm/v2_0/XmlSequenceGenerator_2_0.java | 94 - .../orm/v2_0/XmlSingleRelationshipMapping_2_0.java | 31 - .../orm/v2_0/XmlSqlResultSetMapping_2_0.java | 67 - .../resource/orm/v2_0/XmlUniqueConstraint_2_0.java | 67 - .../jpt/jpa/core/resource/persistence/JPA.java | 57 - .../resource/persistence/PersistenceFactory.java | 250 - .../resource/persistence/PersistencePackage.java | 1302 -- .../persistence/PersistenceXmlResourceFactory.java | 52 - .../core/resource/persistence/XmlJarFileRef.java | 249 - .../core/resource/persistence/XmlJavaClassRef.java | 248 - .../resource/persistence/XmlMappingFileRef.java | 277 - .../core/resource/persistence/XmlPersistence.java | 249 - .../resource/persistence/XmlPersistenceUnit.java | 1105 -- .../XmlPersistenceUnitTransactionType.java | 236 - .../core/resource/persistence/XmlProperties.java | 202 - .../jpa/core/resource/persistence/XmlProperty.java | 322 - .../jpa/core/resource/persistence/v2_0/JPA2_0.java | 39 - .../persistence/v2_0/PersistenceV2_0Factory.java | 192 - .../persistence/v2_0/PersistenceV2_0Package.java | 452 - .../v2_0/XmlPersistenceUnitCachingType_2_0.java | 312 - .../XmlPersistenceUnitValidationModeType_2_0.java | 258 - .../persistence/v2_0/XmlPersistenceUnit_2_0.java | 96 - .../jpa/core/resource/xml/AbstractJpaEObject.java | 332 - .../core/resource/xml/AbstractJpaRootEObject.java | 335 - .../jpt/jpa/core/resource/xml/CommonFactory.java | 115 - .../jpt/jpa/core/resource/xml/CommonPackage.java | 436 - .../jpt/jpa/core/resource/xml/EmfTools.java | 40 - .../jpt/jpa/core/resource/xml/JpaEObject.java | 61 - .../jpt/jpa/core/resource/xml/JpaRootEObject.java | 96 - .../jpt/jpa/core/resource/xml/JpaXmlResource.java | 307 - .../org/eclipse/jpt/jpa/core/resource/xml/XML.java | 35 - jpa/plugins/org.eclipse.jpt.jpa.db.ui/.classpath | 7 - jpa/plugins/org.eclipse.jpt.jpa.db.ui/.cvsignore | 6 - jpa/plugins/org.eclipse.jpt.jpa.db.ui/.project | 28 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../org.eclipse.jpt.jpa.db.ui/META-INF/MANIFEST.MF | 15 - jpa/plugins/org.eclipse.jpt.jpa.db.ui/about.html | 34 - .../org.eclipse.jpt.jpa.db.ui/build.properties | 16 - .../org.eclipse.jpt.jpa.db.ui/component.xml | 12 - .../org.eclipse.jpt.jpa.db.ui/plugin.properties | 24 - .../eclipse/jpt/jpa/db/ui/internal/DTPUiTools.java | 106 - jpa/plugins/org.eclipse.jpt.jpa.db/.classpath | 7 - jpa/plugins/org.eclipse.jpt.jpa.db/.cvsignore | 6 - jpa/plugins/org.eclipse.jpt.jpa.db/.project | 28 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../org.eclipse.jpt.jpa.db/META-INF/MANIFEST.MF | 20 - jpa/plugins/org.eclipse.jpt.jpa.db/about.html | 34 - .../org.eclipse.jpt.jpa.db/build.properties | 18 - jpa/plugins/org.eclipse.jpt.jpa.db/component.xml | 12 - .../org.eclipse.jpt.jpa.db/plugin.properties | 24 - .../src/org/eclipse/jpt/jpa/db/Catalog.java | 23 - .../src/org/eclipse/jpt/jpa/db/Column.java | 120 - .../org/eclipse/jpt/jpa/db/ConnectionAdapter.java | 71 - .../org/eclipse/jpt/jpa/db/ConnectionListener.java | 41 - .../org/eclipse/jpt/jpa/db/ConnectionProfile.java | 202 - .../jpt/jpa/db/ConnectionProfileAdapter.java | 35 - .../jpt/jpa/db/ConnectionProfileFactory.java | 62 - .../jpt/jpa/db/ConnectionProfileListener.java | 42 - .../src/org/eclipse/jpt/jpa/db/Database.java | 153 - .../jpt/jpa/db/DatabaseIdentifierAdapter.java | 79 - .../src/org/eclipse/jpt/jpa/db/DatabaseObject.java | 101 - .../src/org/eclipse/jpt/jpa/db/ForeignKey.java | 157 - .../src/org/eclipse/jpt/jpa/db/JptJpaDbPlugin.java | 100 - .../src/org/eclipse/jpt/jpa/db/Schema.java | 98 - .../org/eclipse/jpt/jpa/db/SchemaContainer.java | 84 - .../src/org/eclipse/jpt/jpa/db/Sequence.java | 28 - .../src/org/eclipse/jpt/jpa/db/Table.java | 126 - .../jpt/jpa/db/internal/DTPCatalogWrapper.java | 90 - .../jpt/jpa/db/internal/DTPColumnWrapper.java | 229 - .../db/internal/DTPConnectionProfileFactory.java | 163 - .../db/internal/DTPConnectionProfileWrapper.java | 574 - .../jpt/jpa/db/internal/DTPDatabaseObject.java | 24 - .../jpa/db/internal/DTPDatabaseObjectWrapper.java | 204 - .../jpt/jpa/db/internal/DTPDatabaseWrapper.java | 380 - .../jpt/jpa/db/internal/DTPForeignKeyWrapper.java | 331 - .../jpa/db/internal/DTPSchemaContainerWrapper.java | 228 - .../jpt/jpa/db/internal/DTPSchemaWrapper.java | 326 - .../jpt/jpa/db/internal/DTPSequenceWrapper.java | 64 - .../jpt/jpa/db/internal/DTPTableWrapper.java | 409 - .../jpt/jpa/db/internal/vendor/AbstractVendor.java | 304 - .../jpa/db/internal/vendor/CatalogStrategy.java | 38 - .../eclipse/jpt/jpa/db/internal/vendor/DB2.java | 56 - .../eclipse/jpt/jpa/db/internal/vendor/Derby.java | 67 - .../db/internal/vendor/FauxCatalogStrategy.java | 81 - .../jpa/db/internal/vendor/FoldingStrategy.java | 34 - .../eclipse/jpt/jpa/db/internal/vendor/HSQLDB.java | 57 - .../jpt/jpa/db/internal/vendor/Informix.java | 59 - .../internal/vendor/LowerCaseFoldingStrategy.java | 56 - .../eclipse/jpt/jpa/db/internal/vendor/MaxDB.java | 53 - .../eclipse/jpt/jpa/db/internal/vendor/MySQL.java | 109 - .../jpa/db/internal/vendor/NoCatalogStrategy.java | 56 - .../jpa/db/internal/vendor/NonFoldingStrategy.java | 65 - .../eclipse/jpt/jpa/db/internal/vendor/Oracle.java | 53 - .../jpt/jpa/db/internal/vendor/PostgreSQL.java | 97 - .../jpt/jpa/db/internal/vendor/SQLServer.java | 98 - .../db/internal/vendor/SimpleCatalogStrategy.java | 81 - .../eclipse/jpt/jpa/db/internal/vendor/Sybase.java | 114 - .../db/internal/vendor/UnknownCatalogStrategy.java | 87 - .../jpa/db/internal/vendor/UnrecognizedVendor.java | 58 - .../internal/vendor/UpperCaseFoldingStrategy.java | 56 - .../eclipse/jpt/jpa/db/internal/vendor/Vendor.java | 86 - .../jpa/db/internal/vendor/VendorRepository.java | 78 - .../.classpath | 8 - .../.cvsignore | 1 - .../.project | 28 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../META-INF/MANIFEST.MF | 13 - .../about.html | 47 - .../build.properties | 19 - .../lib/persistence.jar | Bin 46465 -> 0 bytes .../plugin.properties | 23 - .../jpt/jpa/eclipselink/core/ddlgen/Main.java | 218 - .../.classpath | 15 - .../.cvsignore | 3 - .../org.eclipse.jpt.jpa.eclipselink.core/.project | 28 - .../.settings/org.eclipse.core.resources.prefs | 9 - .../.settings/org.eclipse.jdt.core.prefs | 12 - .../META-INF/MANIFEST.MF | 97 - .../about.html | 34 - .../build.properties | 24 - .../model/eclipseLinkResourceModels.genmodel | 519 - .../model/eclipselink_orm.ecore | 651 - .../plugin.properties | 33 - .../plugin.xml | 286 - .../eclipselink_jpa_validation.properties | 25 - .../property_files/jpt_eclipselink_core.properties | 13 - .../schemas/eclipselink_orm_1_0.xsd | 3128 ----- .../schemas/eclipselink_orm_1_1.xsd | 3248 ----- .../schemas/eclipselink_orm_1_2.xsd | 3519 ------ .../schemas/eclipselink_orm_2_0.xsd | 3625 ------ .../schemas/eclipselink_orm_2_1.xsd | 4108 ------ .../schemas/eclipselink_orm_2_2.xsd | 4778 ------- .../schemas/eclipselink_oxm_2_0.xsd | 260 - .../schemas/eclipselink_oxm_2_1.xsd | 462 - .../schemas/eclipselink_oxm_2_2.xsd | 562 - .../schemas/eclipselink_persistence_map_1.0.xsd | 4109 ------ .../schemas/eclipselink_persistence_map_1.1.xsd | 4183 ------ .../schemas/eclipselink_persistence_map_1.2.xsd | 4253 ------- .../schemas/eclipselink_persistence_map_2.0.xsd | 4253 ------- .../schemas/eclipselink_sessions_1.0.xsd | 1477 --- .../schemas/eclipselink_sessions_1.1.xsd | 1585 --- .../schemas/eclipselink_sessions_1.2.xsd | 1586 --- .../schemas/eclipselink_sessions_2.0.xsd | 1591 --- .../schemas/eclipselink_sessions_2.1.xsd | 1598 --- .../eclipselink/core/EclipseLinkJpaProject.java | 38 - .../eclipselink/core/EclipseLinkMappingKeys.java | 28 - .../core/JptJpaEclipseLinkCorePlugin.java | 165 - .../context/EclipseLinkBasicCollectionMapping.java | 30 - .../core/context/EclipseLinkBasicMapMapping.java | 30 - .../core/context/EclipseLinkBasicMapping.java | 30 - .../context/EclipseLinkCacheCoordinationType.java | 106 - .../core/context/EclipseLinkCacheType.java | 133 - .../core/context/EclipseLinkCaching.java | 219 - .../core/context/EclipseLinkChangeTracking.java | 42 - .../context/EclipseLinkChangeTrackingType.java | 106 - .../core/context/EclipseLinkConversionValue.java | 38 - .../core/context/EclipseLinkConvert.java | 82 - .../core/context/EclipseLinkConverter.java | 75 - .../EclipseLinkConverterClassConverter.java | 31 - .../core/context/EclipseLinkCustomConverter.java | 26 - .../core/context/EclipseLinkCustomizer.java | 44 - .../core/context/EclipseLinkEmbeddable.java | 28 - .../core/context/EclipseLinkEntity.java | 28 - .../core/context/EclipseLinkExistenceType.java | 107 - .../core/context/EclipseLinkIdMapping.java | 30 - .../core/context/EclipseLinkJoinFetch.java | 31 - .../core/context/EclipseLinkJoinFetchMapping.java | 27 - .../core/context/EclipseLinkJoinFetchType.java | 89 - .../core/context/EclipseLinkMappedSuperclass.java | 28 - .../core/context/EclipseLinkMutable.java | 35 - .../EclipseLinkNonEmbeddableTypeMapping.java | 27 - .../context/EclipseLinkObjectTypeConverter.java | 102 - .../core/context/EclipseLinkOneToManyMapping.java | 32 - .../context/EclipseLinkOneToManyRelationship.java | 32 - .../core/context/EclipseLinkOneToOneMapping.java | 33 - .../core/context/EclipseLinkPrivateOwned.java | 30 - .../core/context/EclipseLinkReadOnly.java | 38 - .../context/EclipseLinkRelationshipMapping.java | 30 - .../core/context/EclipseLinkStructConverter.java | 27 - .../core/context/EclipseLinkTimeOfDay.java | 44 - .../context/EclipseLinkTransformationMapping.java | 30 - .../core/context/EclipseLinkTypeConverter.java | 34 - .../core/context/EclipseLinkTypeMapping.java | 40 - .../EclipseLinkVariableOneToOneMapping.java | 30 - .../core/context/EclipseLinkVersionMapping.java | 30 - .../java/EclipseLinkJavaOneToManyRelationship.java | 31 - .../context/java/EclipseLinkJavaTypeMapping.java | 29 - .../core/context/java/JavaEclipseLinkCaching.java | 39 - .../java/JavaEclipseLinkConverterContainer.java | 56 - .../context/java/JavaEclipseLinkEmbeddable.java | 32 - .../core/context/java/JavaEclipseLinkEntity.java | 32 - .../java/JavaEclipseLinkMappedSuperclass.java | 32 - .../JavaEclipseLinkNonEmbeddableTypeMapping.java | 27 - .../context/orm/EclipseLinkEntityMappings.java | 18 - .../orm/EclipseLinkOrmOneToManyRelationship.java | 31 - .../context/orm/EclipseLinkOrmTypeMapping.java | 34 - .../core/context/orm/OrmEclipseLinkCaching.java | 31 - .../orm/OrmEclipseLinkConverterContainer.java | 189 - .../core/context/orm/OrmEclipseLinkEmbeddable.java | 37 - .../core/context/orm/OrmEclipseLinkEntity.java | 37 - .../orm/OrmEclipseLinkMappedSuperclass.java | 38 - .../OrmEclipseLinkNonEmbeddableTypeMapping.java | 32 - ...clipseLinkPersistenceXmlContextNodeFactory.java | 21 - .../context/persistence/caching/CacheType.java | 30 - .../core/context/persistence/caching/Caching.java | 90 - .../persistence/caching/FlushClearCache.java | 24 - .../persistence/connection/BatchWriting.java | 26 - .../context/persistence/connection/Connection.java | 147 - .../connection/ExclusiveConnectionMode.java | 25 - .../persistence/customization/Customization.java | 142 - .../persistence/customization/Profiler.java | 52 - .../context/persistence/customization/Weaving.java | 24 - .../persistence/general/GeneralProperties.java | 28 - .../core/context/persistence/logging/Logger.java | 55 - .../core/context/persistence/logging/Logging.java | 78 - .../context/persistence/logging/LoggingLevel.java | 36 - .../core/context/persistence/options/Options.java | 81 - .../persistence/options/TargetDatabase.java | 77 - .../context/persistence/options/TargetServer.java | 49 - .../schema/generation/DdlGenerationType.java | 24 - .../persistence/schema/generation/OutputMode.java | 24 - .../schema/generation/SchemaGeneration.java | 59 - .../DefaultEclipseLinkJpaValidationMessages.java | 91 - ...EclipseLinkJpaAnnotationDefinitionProvider.java | 111 - .../core/internal/EclipseLinkJpaFactory.java | 139 - .../internal/EclipseLinkJpaPlatformFactory.java | 91 - .../internal/EclipseLinkJpaPlatformProvider.java | 183 - .../core/internal/EclipseLinkJpaProjectImpl.java | 34 - .../internal/EclipseLinkJpaValidationMessages.java | 46 - .../EclipseLinkOrmResourceModelProvider.java | 53 - .../core/internal/JptEclipseLinkCoreMessages.java | 34 - .../java/EclipseLinkJavaOneToManyRelationship.java | 28 - .../context/java/EclipseLinkJavaTimeOfDay.java | 137 - .../JavaEclipseLinkBasicCollectionMapping.java | 50 - ...clipseLinkBasicCollectionMappingDefinition.java | 66 - .../java/JavaEclipseLinkBasicMapMapping.java | 63 - .../JavaEclipseLinkBasicMapMappingDefinition.java | 66 - .../context/java/JavaEclipseLinkBasicMapping.java | 79 - .../JavaEclipseLinkBasicMappingDefinition.java | 56 - .../context/java/JavaEclipseLinkCachingImpl.java | 603 - .../java/JavaEclipseLinkChangeTracking.java | 138 - .../java/JavaEclipseLinkConversionValue.java | 140 - .../context/java/JavaEclipseLinkConvert.java | 357 - .../context/java/JavaEclipseLinkConverter.java | 257 - .../JavaEclipseLinkConverterContainerImpl.java | 340 - .../java/JavaEclipseLinkCustomConverter.java | 165 - .../context/java/JavaEclipseLinkCustomizer.java | 187 - .../java/JavaEclipseLinkEmbeddableImpl.java | 122 - .../context/java/JavaEclipseLinkEntityImpl.java | 192 - .../context/java/JavaEclipseLinkIdMapping.java | 76 - .../java/JavaEclipseLinkIdMappingDefinition.java | 48 - .../context/java/JavaEclipseLinkJoinFetch.java | 131 - .../java/JavaEclipseLinkManyToManyMapping.java | 63 - ...JavaEclipseLinkManyToManyMappingDefinition.java | 53 - .../java/JavaEclipseLinkManyToOneMapping.java | 63 - .../JavaEclipseLinkManyToOneMappingDefinition.java | 53 - .../java/JavaEclipseLinkMappedSuperclassImpl.java | 176 - .../context/java/JavaEclipseLinkMutable.java | 169 - .../java/JavaEclipseLinkObjectTypeConverter.java | 320 - .../java/JavaEclipseLinkOneToManyMapping.java | 92 - .../JavaEclipseLinkOneToManyMappingDefinition.java | 63 - .../java/JavaEclipseLinkOneToOneMapping.java | 76 - .../JavaEclipseLinkOneToOneMappingDefinition.java | 63 - .../java/JavaEclipseLinkPersistentAttribute.java | 109 - .../context/java/JavaEclipseLinkPrivateOwned.java | 117 - .../context/java/JavaEclipseLinkReadOnly.java | 131 - .../java/JavaEclipseLinkStructConverter.java | 174 - .../java/JavaEclipseLinkTransformationMapping.java | 35 - ...EclipseLinkTransformationMappingDefinition.java | 66 - .../context/java/JavaEclipseLinkTypeConverter.java | 150 - .../JavaEclipseLinkVariableOneToOneMapping.java | 35 - ...lipseLinkVariableOneToOneMappingDefinition.java | 70 - .../java/JavaEclipseLinkVersionMapping.java | 76 - .../JavaEclipseLinkVersionMappingDefinition.java | 48 - .../orm/AbstractEclipseLinkOrmXmlDefinition.java | 87 - ...stractOrmEclipseLinkBasicCollectionMapping.java | 67 - .../orm/AbstractOrmEclipseLinkBasicMapMapping.java | 85 - .../context/orm/EclipseLinkEntityMappingsImpl.java | 121 - .../orm/EclipseLinkOrmOneToManyRelationship.java | 28 - .../context/orm/EclipseLinkOrmTimeOfDay.java | 136 - .../orm/EclipseLinkOrmXmlContextNodeFactory.java | 124 - .../context/orm/EclipseLinkOrmXmlDefinition.java | 46 - .../orm/OrmEclipseLinkBasicCollectionMapping.java | 21 - ...clipseLinkBasicCollectionMappingDefinition.java | 65 - .../context/orm/OrmEclipseLinkBasicMapMapping.java | 21 - .../OrmEclipseLinkBasicMapMappingDefinition.java | 65 - .../context/orm/OrmEclipseLinkBasicMapping.java | 79 - .../context/orm/OrmEclipseLinkCachingImpl.java | 727 -- .../context/orm/OrmEclipseLinkChangeTracking.java | 166 - .../context/orm/OrmEclipseLinkConversionValue.java | 139 - .../context/orm/OrmEclipseLinkConvert.java | 343 - .../context/orm/OrmEclipseLinkConverter.java | 270 - .../orm/OrmEclipseLinkConverterClassConverter.java | 179 - .../orm/OrmEclipseLinkConverterContainerImpl.java | 746 -- .../context/orm/OrmEclipseLinkCustomConverter.java | 108 - .../context/orm/OrmEclipseLinkCustomizer.java | 235 - .../context/orm/OrmEclipseLinkEmbeddableImpl.java | 193 - .../context/orm/OrmEclipseLinkEntityImpl.java | 336 - .../context/orm/OrmEclipseLinkIdMapping.java | 76 - .../context/orm/OrmEclipseLinkJoinFetch.java | 89 - .../orm/OrmEclipseLinkManyToManyMapping.java | 63 - .../orm/OrmEclipseLinkManyToOneMapping.java | 63 - .../orm/OrmEclipseLinkMappedSuperclassImpl.java | 261 - .../context/orm/OrmEclipseLinkMutable.java | 127 - .../orm/OrmEclipseLinkObjectTypeConverter.java | 425 - .../orm/OrmEclipseLinkOneToManyMapping.java | 91 - .../context/orm/OrmEclipseLinkOneToOneMapping.java | 76 - .../orm/OrmEclipseLinkPersistentAttribute.java | 51 - .../context/orm/OrmEclipseLinkPrivateOwned.java | 88 - .../context/orm/OrmEclipseLinkReadOnly.java | 124 - .../context/orm/OrmEclipseLinkStructConverter.java | 108 - .../orm/OrmEclipseLinkTransformationMapping.java | 47 - ...EclipseLinkTransformationMappingDefinition.java | 65 - .../context/orm/OrmEclipseLinkTypeConverter.java | 245 - .../orm/OrmEclipseLinkVariableOneToOneMapping.java | 47 - ...lipseLinkVariableOneToOneMappingDefinition.java | 65 - .../context/orm/OrmEclipseLinkVersionMapping.java | 76 - .../context/persistence/EclipseLinkJarFileRef.java | 31 - .../persistence/EclipseLinkPersistenceUnit.java | 548 - .../EclipseLinkPersistenceUnitProperties.java | 55 - ...clipseLinkPersistenceXmlContextNodeFactory.java | 50 - .../EclipseLinkPersistenceXmlDefinition.java | 53 - .../persistence/caching/EclipseLinkCaching.java | 588 - .../context/persistence/caching/Entity.java | 144 - .../connection/EclipseLinkConnection.java | 677 - .../customization/EclipseLinkCustomization.java | 873 -- .../context/persistence/customization/Entity.java | 107 - .../general/EclipseLinkGeneralProperties.java | 96 - .../persistence/logging/EclipseLinkLogging.java | 409 - .../persistence/options/EclipseLinkOptions.java | 444 - .../generation/EclipseLinkSchemaGeneration.java | 232 - .../ddlgen/AbstractEclipseLinkDDLGenerator.java | 425 - .../internal/ddlgen/EclipseLinkDDLGenerator.java | 62 - ...ipseLinkEclipseLinkBundlesLibraryValidator.java | 102 - .../libval/EclipseLinkUserLibraryValidator.java | 122 - ...clipseLinkOrmFileCreationDataModelProvider.java | 86 - .../EclipseLinkOrmFileCreationOperation.java | 29 - ...pseLinkBasicCollectionAnnotationDefinition.java | 62 - .../EclipseLinkBasicMapAnnotationDefinition.java | 62 - .../java/EclipseLinkCacheAnnotationDefinition.java | 62 - ...ipseLinkChangeTrackingAnnotationDefinition.java | 62 - .../EclipseLinkConvertAnnotationDefinition.java | 62 - .../EclipseLinkConverterAnnotationDefinition.java | 62 - .../EclipseLinkCustomizerAnnotationDefinition.java | 62 - ...eLinkExistenceCheckingAnnotationDefinition.java | 62 - .../EclipseLinkJoinFetchAnnotationDefinition.java | 62 - .../EclipseLinkMutableAnnotationDefinition.java | 62 - ...inkObjectTypeConverterAnnotationDefinition.java | 62 - .../EclipseLinkPrimaryKeyAnnotationDefinition.java | 63 - ...clipseLinkPrivateOwnedAnnotationDefinition.java | 62 - .../EclipseLinkReadOnlyAnnotationDefinition.java | 62 - ...pseLinkReadTransformerAnnotationDefinition.java | 62 - ...pseLinkStructConverterAnnotationDefinition.java | 62 - ...ipseLinkTransformationAnnotationDefinition.java | 62 - ...lipseLinkTypeConverterAnnotationDefinition.java | 62 - ...seLinkVariableOneToOneAnnotationDefinition.java | 62 - ...seLinkWriteTransformerAnnotationDefinition.java | 62 - .../java/NullEclipseLinkCacheAnnotation.java | 172 - .../java/NullEclipseLinkJoinFetchAnnotation.java | 48 - .../NullEclipseLinkTransformationAnnotation.java | 63 - ...clipseLinkWriteTransformerColumnAnnotation.java | 34 - ...naryBaseEclipseLinkTypeConverterAnnotation.java | 104 - ...BinaryEclipseLinkBasicCollectionAnnotation.java | 32 - .../BinaryEclipseLinkBasicMapAnnotation.java | 32 - .../binary/BinaryEclipseLinkCacheAnnotation.java | 311 - .../BinaryEclipseLinkChangeTrackingAnnotation.java | 73 - ...BinaryEclipseLinkConversionValueAnnotation.java | 97 - .../binary/BinaryEclipseLinkConvertAnnotation.java | 74 - .../BinaryEclipseLinkConverterAnnotation.java | 85 - .../BinaryEclipseLinkCustomizerAnnotation.java | 80 - ...naryEclipseLinkExistenceCheckingAnnotation.java | 72 - .../BinaryEclipseLinkJoinFetchAnnotation.java | 72 - .../binary/BinaryEclipseLinkMutableAnnotation.java | 71 - .../BinaryEclipseLinkNamedConverterAnnotation.java | 75 - ...ryEclipseLinkObjectTypeConverterAnnotation.java | 140 - .../BinaryEclipseLinkPrimaryKeyAnnotation.java | 33 - .../BinaryEclipseLinkPrivateOwnedAnnotation.java | 33 - .../BinaryEclipseLinkReadOnlyAnnotation.java | 33 - ...BinaryEclipseLinkReadTransformerAnnotation.java | 46 - ...BinaryEclipseLinkStructConverterAnnotation.java | 78 - .../BinaryEclipseLinkTimeOfDayAnnotation.java | 149 - .../BinaryEclipseLinkTransformationAnnotation.java | 98 - .../BinaryEclipseLinkTransformerAnnotation.java | 97 - .../BinaryEclipseLinkTypeConverterAnnotation.java | 53 - ...inaryEclipseLinkVariableOneToOneAnnotation.java | 32 - ...inaryEclipseLinkWriteTransformerAnnotation.java | 124 - ...urceBaseEclipseLinkTypeConverterAnnotation.java | 199 - ...SourceEclipseLinkBasicCollectionAnnotation.java | 46 - .../SourceEclipseLinkBasicMapAnnotation.java | 46 - .../source/SourceEclipseLinkCacheAnnotation.java | 448 - .../SourceEclipseLinkChangeTrackingAnnotation.java | 105 - ...SourceEclipseLinkConversionValueAnnotation.java | 196 - .../source/SourceEclipseLinkConvertAnnotation.java | 109 - .../SourceEclipseLinkConverterAnnotation.java | 148 - .../SourceEclipseLinkCustomizerAnnotation.java | 144 - ...urceEclipseLinkExistenceCheckingAnnotation.java | 105 - .../SourceEclipseLinkJoinFetchAnnotation.java | 105 - .../source/SourceEclipseLinkMutableAnnotation.java | 105 - .../SourceEclipseLinkNamedConverterAnnotation.java | 102 - ...ceEclipseLinkObjectTypeConverterAnnotation.java | 269 - .../SourceEclipseLinkPrimaryKeyAnnotation.java | 48 - .../SourceEclipseLinkPrivateOwnedAnnotation.java | 46 - .../SourceEclipseLinkReadOnlyAnnotation.java | 46 - ...SourceEclipseLinkReadTransformerAnnotation.java | 50 - ...SourceEclipseLinkStructConverterAnnotation.java | 110 - .../SourceEclipseLinkTimeOfDayAnnotation.java | 215 - .../SourceEclipseLinkTransformationAnnotation.java | 145 - .../SourceEclipseLinkTransformerAnnotation.java | 132 - .../SourceEclipseLinkTypeConverterAnnotation.java | 58 - ...ourceEclipseLinkVariableOneToOneAnnotation.java | 46 - ...ourceEclipseLinkWriteTransformerAnnotation.java | 159 - .../orm/EclipseLinkOrmXmlResourceProvider.java | 84 - .../v1_1/EclipseLink1_1JpaPlatformFactory.java | 72 - .../v1_1/EclipseLink1_1JpaPlatformProvider.java | 188 - .../AbstractEclipseLinkTypeMappingValidator.java | 50 - .../EclipseLinkEntityPrimaryKeyValidator.java | 65 - ...pseLinkMappedSuperclassPrimaryKeyValidator.java | 73 - .../EclipseLinkMappedSuperclassValidator.java | 35 - .../EclipseLinkPersistentAttributeValidator.java | 34 - .../context/EclipseLinkTypeMappingValidator.java | 23 - .../EclipseLinkOrmXml1_1ContextNodeFactory.java | 27 - .../orm/EclipseLinkOrmXml1_1Definition.java | 47 - .../orm/OrmEclipseLinkPersistentAttribute1_1.java | 78 - ...ipseLink1_2JpaAnnotationDefinitionProvider.java | 61 - .../internal/v1_2/EclipseLink1_2JpaFactory.java | 31 - .../v1_2/EclipseLink1_2JpaPlatformFactory.java | 72 - .../v1_2/EclipseLink1_2JpaPlatformProvider.java | 191 - .../java/EclipseLinkJavaPersistentType1_2.java | 78 - .../orm/EclipseLinkOrmXml1_2Definition.java | 48 - .../AbstractEclipseLink2_0JpaPlatformProvider.java | 181 - .../internal/v2_0/EclipseLink2_0JpaFactory.java | 151 - .../v2_0/EclipseLink2_0JpaPlatformFactory.java | 71 - .../v2_0/EclipseLink2_0JpaPlatformProvider.java | 38 - ...JavaEclipseLinkElementCollectionMapping2_0.java | 64 - ...eLinkElementCollectionMappingDefinition2_0.java | 53 - .../JavaEclipseLinkIdMappingDefinition2_0.java | 69 - ...aEclipseLinkManyToManyMappingDefinition2_0.java | 51 - ...vaEclipseLinkManyToOneMappingDefinition2_0.java | 51 - ...vaEclipseLinkOneToManyMappingDefinition2_0.java | 57 - ...avaEclipseLinkOneToOneMappingDefinition2_0.java | 57 - .../EclipseLinkOrmXml2_0ContextNodeFactory.java | 107 - .../orm/EclipseLinkOrmXml2_0Definition.java | 120 - ...pseLink2_0PersistenceXmlContextNodeFactory.java | 56 - .../EclipseLink2_0PersistenceXmlDefinition.java | 53 - .../connection/EclipseLinkConnection2_0.java | 153 - .../persistence/logging/EclipseLinkLogging2_0.java | 329 - .../persistence/options/EclipseLinkOptions2_0.java | 350 - .../v2_0/ddlgen/EclipseLink2_0DDLGenerator.java | 85 - .../AbstractEclipseLink2_1JpaPlatformProvider.java | 46 - ...ipseLink2_1JpaAnnotationDefinitionProvider.java | 112 - .../v2_1/EclipseLink2_1JpaPlatformFactory.java | 72 - .../v2_1/EclipseLink2_1JpaPlatformProvider.java | 38 - .../EclipseLinkOrmElementCollectionMapping2_1.java | 64 - .../EclipseLinkOrmXml2_1ContextNodeFactory.java | 38 - .../orm/EclipseLinkOrmXml2_1Definition.java | 48 - .../OrmEclipseLinkBasicCollectionMapping2_1.java | 43 - .../orm/OrmEclipseLinkBasicMapMapping2_1.java | 43 - ...eLinkClassExtractor2_1AnnotationDefinition.java | 62 - ...naryEclipseLinkClassExtractorAnnotation2_1.java | 78 - ...urceEclipseLinkClassExtractorAnnotation2_1.java | 138 - .../v2_2/EclipseLink2_2JpaPlatformFactory.java | 73 - .../v2_2/EclipseLink2_2JpaPlatformProvider.java | 62 - .../orm/EclipseLinkOrmXml2_2Definition.java | 98 - .../core/platform/EclipseLinkPlatform.java | 43 - .../BaseEclipseLinkTypeConverterAnnotation.java | 88 - .../core/resource/java/CacheCoordinationType.java | 66 - .../eclipselink/core/resource/java/CacheType.java | 69 - .../core/resource/java/ChangeTrackingType.java | 66 - .../core/resource/java/EclipseLink.java | 135 - .../java/EclipseLinkBasicCollectionAnnotation.java | 31 - .../java/EclipseLinkBasicMapAnnotation.java | 31 - .../resource/java/EclipseLinkCacheAnnotation.java | 220 - .../java/EclipseLinkChangeTrackingAnnotation.java | 53 - .../java/EclipseLinkConversionValueAnnotation.java | 73 - .../java/EclipseLinkConvertAnnotation.java | 59 - .../java/EclipseLinkConverterAnnotation.java | 69 - .../java/EclipseLinkCustomizerAnnotation.java | 70 - .../EclipseLinkExistenceCheckingAnnotation.java | 53 - .../java/EclipseLinkJoinFetchAnnotation.java | 53 - .../java/EclipseLinkMutableAnnotation.java | 53 - .../java/EclipseLinkNamedConverterAnnotation.java | 54 - .../EclipseLinkObjectTypeConverterAnnotation.java | 91 - .../java/EclipseLinkPrimaryKeyAnnotation.java | 32 - .../java/EclipseLinkPrivateOwnedAnnotation.java | 31 - .../java/EclipseLinkReadOnlyAnnotation.java | 31 - .../java/EclipseLinkReadTransformerAnnotation.java | 29 - .../java/EclipseLinkStructConverterAnnotation.java | 52 - .../java/EclipseLinkTimeOfDayAnnotation.java | 121 - .../java/EclipseLinkTransformationAnnotation.java | 74 - .../java/EclipseLinkTransformerAnnotation.java | 77 - .../java/EclipseLinkTypeConverterAnnotation.java | 29 - .../EclipseLinkVariableOneToOneAnnotation.java | 31 - .../EclipseLinkWriteTransformerAnnotation.java | 64 - .../core/resource/java/ExistenceType.java | 66 - .../core/resource/java/JoinFetchType.java | 64 - ...stableEclipseLinkConversionValueAnnotation.java | 28 - .../eclipselink/core/resource/orm/Attributes.java | 394 - .../core/resource/orm/CacheCoordinationType.java | 295 - .../eclipselink/core/resource/orm/CacheType.java | 373 - .../eclipselink/core/resource/orm/EclipseLink.java | 130 - .../core/resource/orm/EclipseLinkOrmFactory.java | 1067 -- .../core/resource/orm/EclipseLinkOrmPackage.java | 11805 ----------------- .../orm/EclipseLinkOrmXmlResourceFactory.java | 53 - .../core/resource/orm/ExistenceType.java | 295 - .../core/resource/orm/XmlAccessMethods.java | 301 - .../core/resource/orm/XmlAccessMethodsHolder.java | 60 - .../core/resource/orm/XmlAdditionalCriteria.java | 221 - .../core/resource/orm/XmlAttributeMapping.java | 34 - .../eclipselink/core/resource/orm/XmlBasic.java | 1488 --- .../core/resource/orm/XmlBasicCollection.java | 451 - .../eclipselink/core/resource/orm/XmlBasicMap.java | 451 - .../core/resource/orm/XmlBatchFetch.java | 300 - .../core/resource/orm/XmlBatchFetchHolder.java | 68 - .../eclipselink/core/resource/orm/XmlCache.java | 841 -- .../core/resource/orm/XmlCacheHolder.java | 102 - .../core/resource/orm/XmlChangeTracking.java | 226 - .../core/resource/orm/XmlChangeTrackingHolder.java | 71 - .../core/resource/orm/XmlChangeTrackingType.java | 291 - .../core/resource/orm/XmlCloneCopyPolicy.java | 299 - .../core/resource/orm/XmlCollectionTable.java | 265 - .../core/resource/orm/XmlConversionValue.java | 314 - .../core/resource/orm/XmlConverter.java | 251 - .../core/resource/orm/XmlConverterHolder.java | 154 - .../core/resource/orm/XmlConvertersHolder.java | 113 - .../core/resource/orm/XmlConvertibleMapping.java | 77 - .../core/resource/orm/XmlCopyPolicy.java | 226 - .../core/resource/orm/XmlCustomizer.java | 208 - .../core/resource/orm/XmlCustomizerHolder.java | 72 - .../core/resource/orm/XmlDirection.java | 294 - .../core/resource/orm/XmlElementCollection.java | 2458 ---- .../core/resource/orm/XmlEmbeddable.java | 1387 -- .../eclipselink/core/resource/orm/XmlEmbedded.java | 470 - .../core/resource/orm/XmlEmbeddedId.java | 469 - .../eclipselink/core/resource/orm/XmlEntity.java | 3193 ----- .../core/resource/orm/XmlEntityMappings.java | 1049 -- .../core/resource/orm/XmlFetchAttribute.java | 214 - .../core/resource/orm/XmlFetchGroup.java | 360 - .../core/resource/orm/XmlHashPartitioning.java | 219 - .../jpa/eclipselink/core/resource/orm/XmlId.java | 1144 -- .../eclipselink/core/resource/orm/XmlIndex.java | 563 - .../resource/orm/XmlInstantiationCopyPolicy.java | 74 - .../core/resource/orm/XmlJoinFetch.java | 79 - .../core/resource/orm/XmlJoinFetchType.java | 242 - .../core/resource/orm/XmlJoinTable.java | 265 - .../core/resource/orm/XmlManyToMany.java | 2163 ---- .../core/resource/orm/XmlManyToOne.java | 1459 --- .../core/resource/orm/XmlMappedSuperclass.java | 3517 ------ .../eclipselink/core/resource/orm/XmlMutable.java | 76 - .../core/resource/orm/XmlNamedConverter.java | 218 - .../resource/orm/XmlNamedStoredProcedureQuery.java | 644 - .../core/resource/orm/XmlObjectTypeConverter.java | 477 - .../core/resource/orm/XmlOneToMany.java | 2253 ---- .../eclipselink/core/resource/orm/XmlOneToOne.java | 1626 --- .../core/resource/orm/XmlOptimisticLocking.java | 373 - .../resource/orm/XmlOptimisticLockingType.java | 294 - .../core/resource/orm/XmlOrderColumn.java | 260 - .../core/resource/orm/XmlPartitioning.java | 220 - .../resource/orm/XmlPersistenceUnitDefaults.java | 295 - .../resource/orm/XmlPersistenceUnitMetadata.java | 233 - .../core/resource/orm/XmlPinnedPartitioning.java | 219 - .../core/resource/orm/XmlPrimaryKey.java | 406 - .../core/resource/orm/XmlPrivateOwned.java | 76 - .../eclipselink/core/resource/orm/XmlProperty.java | 362 - .../core/resource/orm/XmlPropertyContainer.java | 51 - .../core/resource/orm/XmlQueryContainer.java | 51 - .../core/resource/orm/XmlQueryRedirectors.java | 654 - .../core/resource/orm/XmlRangePartitioning.java | 219 - .../eclipselink/core/resource/orm/XmlReadOnly.java | 76 - .../resource/orm/XmlReplicationPartitioning.java | 219 - .../core/resource/orm/XmlReturnInsert.java | 211 - .../resource/orm/XmlRoundRobinPartitioning.java | 219 - .../core/resource/orm/XmlSecondaryTable.java | 262 - .../resource/orm/XmlStoredProcedureParameter.java | 590 - .../core/resource/orm/XmlStructConverter.java | 255 - .../eclipselink/core/resource/orm/XmlTable.java | 264 - .../core/resource/orm/XmlTableGenerator.java | 274 - .../core/resource/orm/XmlTimeOfDay.java | 446 - .../core/resource/orm/XmlTransformation.java | 474 - .../core/resource/orm/XmlTransient.java | 345 - .../core/resource/orm/XmlTypeConverter.java | 339 - .../core/resource/orm/XmlUnionPartitioning.java | 219 - .../core/resource/orm/XmlValuePartitioning.java | 219 - .../core/resource/orm/XmlVariableOneToOne.java | 1219 -- .../eclipselink/core/resource/orm/XmlVersion.java | 1135 -- .../core/resource/orm/v1_1/EclipseLink1_1.java | 27 - .../orm/v1_1/EclipseLinkOrmV1_1Factory.java | 166 - .../orm/v1_1/EclipseLinkOrmV1_1Package.java | 688 - .../resource/orm/v1_1/IdValidationType_1_1.java | 257 - .../core/resource/orm/v1_1/XmlBasic_1_1.java | 61 - .../core/resource/orm/v1_1/XmlEntity_1_1.java | 62 - .../resource/orm/v1_1/XmlMappedSuperclass_1_1.java | 62 - .../core/resource/orm/v1_1/XmlPrimaryKey_1_1.java | 83 - .../core/resource/orm/v1_2/EclipseLink1_2.java | 23 - .../core/resource/orm/v2_0/EclipseLink2_0.java | 40 - .../orm/v2_0/EclipseLinkOrmV2_0Factory.java | 166 - .../orm/v2_0/EclipseLinkOrmV2_0Package.java | 1518 --- .../resource/orm/v2_0/OrderCorrectionType_2_0.java | 257 - .../resource/orm/v2_0/XmlCacheInterceptor_2_0.java | 65 - .../orm/v2_0/XmlCollectionMapping_2_0.java | 64 - .../orm/v2_0/XmlElementCollection_2_0.java | 36 - .../core/resource/orm/v2_0/XmlEntity_2_0.java | 94 - .../core/resource/orm/v2_0/XmlManyToMany_2_0.java | 34 - .../XmlMapKeyAssociationOverrideContainer_2_0.java | 58 - .../resource/orm/v2_0/XmlMappedSuperclass_2_0.java | 66 - .../core/resource/orm/v2_0/XmlOneToMany_2_0.java | 34 - .../core/resource/orm/v2_0/XmlOrderColumn_2_0.java | 70 - .../resource/orm/v2_0/XmlQueryRedirectors_2_0.java | 227 - .../core/resource/orm/v2_1/BatchFetchType_2_1.java | 266 - .../core/resource/orm/v2_1/CacheKeyType_2_1.java | 258 - .../core/resource/orm/v2_1/EclipseLink2_1.java | 39 - .../orm/v2_1/EclipseLinkOrmV2_1Factory.java | 192 - .../orm/v2_1/EclipseLinkOrmV2_1Package.java | 2559 ---- .../core/resource/orm/v2_1/XmlBasic_2_1.java | 125 - .../core/resource/orm/v2_1/XmlBatchFetch_2_1.java | 98 - .../orm/v2_1/XmlElementCollection_2_1.java | 68 - .../core/resource/orm/v2_1/XmlEmbeddable_2_1.java | 35 - .../core/resource/orm/v2_1/XmlEmbeddedId_2_1.java | 68 - .../core/resource/orm/v2_1/XmlEmbedded_2_1.java | 68 - .../resource/orm/v2_1/XmlEntityMappings_2_1.java | 35 - .../core/resource/orm/v2_1/XmlEntity_2_1.java | 97 - .../resource/orm/v2_1/XmlFetchAttribute_2_1.java | 61 - .../orm/v2_1/XmlFetchGroupContainer_2_1.java | 53 - .../core/resource/orm/v2_1/XmlFetchGroup_2_1.java | 107 - .../core/resource/orm/v2_1/XmlId_2_1.java | 68 - .../core/resource/orm/v2_1/XmlManyToMany_2_1.java | 67 - .../core/resource/orm/v2_1/XmlManyToOne_2_1.java | 35 - .../resource/orm/v2_1/XmlMappedSuperclass_2_1.java | 120 - .../core/resource/orm/v2_1/XmlOneToMany_2_1.java | 67 - .../core/resource/orm/v2_1/XmlOneToOne_2_1.java | 35 - .../orm/v2_1/XmlPersistenceUnitDefaults_2_1.java | 35 - .../core/resource/orm/v2_1/XmlPrimaryKey_2_1.java | 64 - .../resource/orm/v2_1/XmlReturnInsert_2_1.java | 61 - .../resource/orm/v2_1/XmlTransformation_2_1.java | 68 - .../core/resource/orm/v2_1/XmlVersion_2_1.java | 68 - .../core/resource/orm/v2_2/EclipseLink2_2.java | 46 - .../orm/v2_2/EclipseLinkOrmV2_2Factory.java | 113 - .../orm/v2_2/EclipseLinkOrmV2_2Package.java | 4502 ------- .../orm/v2_2/XmlAdditionalCriteria_2_2.java | 65 - .../resource/orm/v2_2/XmlBasicCollection_2_2.java | 65 - .../core/resource/orm/v2_2/XmlBasicMap_2_2.java | 65 - .../core/resource/orm/v2_2/XmlBasic_2_2.java | 65 - .../resource/orm/v2_2/XmlCollectionTable_2_2.java | 65 - .../orm/v2_2/XmlElementCollection_2_2.java | 90 - .../core/resource/orm/v2_2/XmlEmbeddable_2_2.java | 65 - .../resource/orm/v2_2/XmlEntityMappings_2_2.java | 176 - .../core/resource/orm/v2_2/XmlEntity_2_2.java | 117 - .../resource/orm/v2_2/XmlHashPartitioning_2_2.java | 65 - .../core/resource/orm/v2_2/XmlId_2_2.java | 56 - .../core/resource/orm/v2_2/XmlIndex_2_2.java | 191 - .../core/resource/orm/v2_2/XmlJoinTable_2_2.java | 65 - .../core/resource/orm/v2_2/XmlManyToMany_2_2.java | 90 - .../core/resource/orm/v2_2/XmlManyToOne_2_2.java | 63 - .../resource/orm/v2_2/XmlMappedSuperclass_2_2.java | 63 - .../core/resource/orm/v2_2/XmlOneToMany_2_2.java | 90 - .../core/resource/orm/v2_2/XmlOneToOne_2_2.java | 90 - .../orm/v2_2/XmlPartitioningGroup_2_2.java | 281 - .../resource/orm/v2_2/XmlPartitioning_2_2.java | 65 - .../orm/v2_2/XmlPinnedPartitioning_2_2.java | 65 - .../orm/v2_2/XmlRangePartitioning_2_2.java | 65 - .../orm/v2_2/XmlReplicationPartitioning_2_2.java | 65 - .../orm/v2_2/XmlRoundRobinPartitioning_2_2.java | 65 - .../resource/orm/v2_2/XmlSecondaryTable_2_2.java | 65 - .../resource/orm/v2_2/XmlTableGenerator_2_2.java | 65 - .../core/resource/orm/v2_2/XmlTable_2_2.java | 65 - .../orm/v2_2/XmlUnionPartitioning_2_2.java | 65 - .../orm/v2_2/XmlValuePartitioning_2_2.java | 65 - .../resource/orm/v2_2/XmlVariableOneToOne_2_2.java | 63 - .../core/resource/orm/v2_2/XmlVersion_2_2.java | 65 - .../EclipseLinkElementCollectionMapping2_0.java | 31 - .../context/EclipseLinkOneToManyMapping2_0.java | 31 - .../EclipseLinkOneToManyRelationship2_0.java | 32 - .../context/EclipseLinkOneToOneMapping2_0.java | 31 - .../EclipseLinkJavaOneToManyRelationship2_0.java | 31 - .../EclipseLinkOrmOneToManyRelationship2_0.java | 31 - .../persistence/connection/Connection2_0.java | 21 - .../context/persistence/logging/Logging2_0.java | 80 - .../context/persistence/options/Options2_0.java | 21 - .../core/v2_0/resource/java/EclipseLink2_1.java | 38 - .../EclipseLinkClassExtractorAnnotation2_1.java | 68 - .../org.eclipse.jpt.jpa.eclipselink.ui/.classpath | 16 - .../org.eclipse.jpt.jpa.eclipselink.ui/.cvsignore | 3 - .../org.eclipse.jpt.jpa.eclipselink.ui/.project | 28 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../META-INF/MANIFEST.MF | 65 - .../org.eclipse.jpt.jpa.eclipselink.ui/about.html | 34 - .../build.properties | 20 - .../plugin.properties | 27 - .../org.eclipse.jpt.jpa.eclipselink.ui/plugin.xml | 118 - .../property_files/eclipselink_ui.properties | 365 - .../eclipselink_ui_details.properties | 153 - .../eclipselink/ui/JptJpaEclipseLinkUiPlugin.java | 100 - .../ui/internal/EclipseLinkHelpContextIds.java | 57 - .../ui/internal/EclipseLinkUiMessages.java | 381 - .../internal/ddlgen/EclipseLinkDDLGeneratorUi.java | 176 - .../internal/ddlgen/wizards/GenerateDDLWizard.java | 56 - ...ipseLinkBasicCollectionMappingUiDefinition.java | 42 - ...ractEclipseLinkBasicMapMappingUiDefinition.java | 42 - ...lipseLinkTransformationMappingUiDefinition.java | 42 - ...pseLinkVariableOneToOneMappingUiDefinition.java | 42 - .../details/EclipseLinkAlwaysRefreshComposite.java | 101 - ...EclipseLinkBasicCollectionMappingComposite.java | 45 - .../EclipseLinkBasicMapMappingComposite.java | 45 - .../details/EclipseLinkBasicMappingComposite.java | 188 - .../EclipseLinkCacheCoordinationTypeComposite.java | 106 - .../details/EclipseLinkCacheSizeComposite.java | 94 - .../details/EclipseLinkCacheTypeComposite.java | 106 - .../details/EclipseLinkCachingComposite.java | 165 - .../EclipseLinkChangeTrackingComposite.java | 108 - .../details/EclipseLinkConversionValueDialog.java | 209 - .../EclipseLinkConversionValueStateObject.java | 139 - .../details/EclipseLinkConvertComposite.java | 359 - .../EclipseLinkCustomConverterComposite.java | 156 - .../details/EclipseLinkCustomizerComposite.java | 133 - .../details/EclipseLinkDisableHitsComposite.java | 100 - .../EclipseLinkEmbeddableAdvancedComposite.java | 58 - .../EclipseLinkEntityAdvancedComposite.java | 69 - .../details/EclipseLinkExpiryComposite.java | 337 - .../details/EclipseLinkIdMappingComposite.java | 107 - .../details/EclipseLinkJoinFetchComposite.java | 119 - .../EclipseLinkManyToManyMappingComposite.java | 103 - .../EclipseLinkManyToOneMappingComposite.java | 102 - ...lipseLinkMappedSuperclassAdvancedComposite.java | 69 - .../details/EclipseLinkMutableComposite.java | 100 - .../EclipseLinkObjectTypeConverterComposite.java | 482 - .../EclipseLinkOneToManyJoiningStrategyPane.java | 68 - .../EclipseLinkOneToManyMappingComposite.java | 131 - .../EclipseLinkOneToOneMappingComposite.java | 74 - .../details/EclipseLinkPrivateOwnedComposite.java | 67 - .../details/EclipseLinkReadOnlyComposite.java | 102 - .../EclipseLinkRefreshOnlyIfNewerComposite.java | 102 - .../EclipseLinkStructConverterComposite.java | 152 - .../EclipseLinkTransformationMappingComposite.java | 45 - .../details/EclipseLinkTypeConverterComposite.java | 199 - .../details/EclipseLinkUiDetailsMessages.java | 169 - ...clipseLinkVariableOneToOneMappingComposite.java | 45 - .../EclipseLinkVersionMappingComposite.java | 161 - ...AbstractJavaEclipseLinkEmbeddableComposite.java | 84 - .../AbstractJavaEclipseLinkEntityComposite.java | 120 - ...ctJavaEclipseLinkMappedSuperclassComposite.java | 107 - ...avaEclipseLinkOneToManyMappingUiDefinition.java | 83 - ...JavaEclipseLinkOneToOneMappingUiDefinition.java | 83 - ...pseLinkVariableOneToOneMappingUiDefinition.java | 78 - .../java/EclipseLinkJavaResourceUiDefinition.java | 106 - .../details/java/EclipseLinkJavaUiFactory.java | 160 - ...ipseLinkBasicCollectionMappingUiDefinition.java | 56 - ...JavaEclipseLinkBasicMapMappingUiDefinition.java | 56 - .../java/JavaEclipseLinkCachingComposite.java | 67 - .../java/JavaEclipseLinkConvertersComposite.java | 271 - .../java/JavaEclipseLinkEmbeddableComposite.java | 44 - .../java/JavaEclipseLinkEntityComposite.java | 44 - .../JavaEclipseLinkExistenceCheckingComposite.java | 129 - .../JavaEclipseLinkMappedSuperclassComposite.java | 44 - ...lipseLinkTransformationMappingUiDefinition.java | 56 - ...pseLinkVariableOneToOneMappingUiDefinition.java | 56 - ...stractEclipseLinkEntityMappingsDetailsPage.java | 132 - .../orm/AbstractOrmEclipseLinkEntityComposite.java | 91 - ...actOrmEclipseLinkMappedSuperclassComposite.java | 109 - .../orm/BaseEclipseLinkOrmXmlUiFactory.java | 126 - .../details/orm/EclipseLinkConverterDialog.java | 192 - .../orm/EclipseLinkConverterStateObject.java | 140 - .../orm/EclipseLinkEntityMappingsDetailsPage.java | 91 - .../EclipseLinkEntityMappingsDetailsProvider.java | 65 - .../details/orm/EclipseLinkOrmXmlUiDefinition.java | 103 - .../details/orm/EclipseLinkOrmXmlUiFactory.java | 15 - ...ipseLinkBasicCollectionMappingUiDefinition.java | 56 - .../OrmEclipseLinkBasicMapMappingUiDefinition.java | 56 - .../orm/OrmEclipseLinkBasicMappingComposite.java | 58 - .../orm/OrmEclipseLinkCachingComposite.java | 68 - .../orm/OrmEclipseLinkConvert1_0Composite.java | 220 - .../orm/OrmEclipseLinkConvertersComposite.java | 412 - .../orm/OrmEclipseLinkEmbeddableComposite.java | 104 - .../details/orm/OrmEclipseLinkEntityComposite.java | 26 - .../OrmEclipseLinkExistenceCheckingComposite.java | 107 - .../orm/OrmEclipseLinkIdMappingComposite.java | 49 - .../OrmEclipseLinkManyToManyMappingComposite.java | 93 - .../OrmEclipseLinkManyToOneMappingComposite.java | 104 - .../OrmEclipseLinkMappedSuperclassComposite.java | 27 - .../OrmEclipseLinkOneToManyMappingComposite.java | 55 - .../OrmEclipseLinkOneToOneMappingComposite.java | 126 - ...lipseLinkTransformationMappingUiDefinition.java | 56 - ...pseLinkVariableOneToOneMappingUiDefinition.java | 56 - .../orm/OrmEclipseLinkVersionMappingComposite.java | 55 - .../EclipseLinkPersistenceXmlUiDefinition.java | 55 - .../EclipseLinkPersistenceXmlUiFactory.java | 214 - .../caching/CacheDefaultsComposite.java | 55 - .../persistence/caching/CacheSizeComposite.java | 109 - .../persistence/caching/CacheTypeComposite.java | 170 - .../caching/DefaultCacheSizeComposite.java | 88 - .../caching/DefaultCacheTypeComposite.java | 91 - .../caching/DefaultSharedCacheComposite.java | 96 - .../caching/EclipseLinkCachingComposite.java | 45 - .../caching/EntityCachingPropertyComposite.java | 53 - .../persistence/caching/EntityListComposite.java | 212 - .../caching/FlushClearCacheComposite.java | 90 - .../caching/PersistenceXmlCachingTab.java | 87 - .../persistence/caching/SharedCacheComposite.java | 164 - .../connection/BatchWritingComposite.java | 87 - .../CacheStatementsPropertiesComposite.java | 135 - .../connection/ConnectionPropertiesComposite.java | 45 - .../connection/DataSourcePropertiesComposite.java | 146 - .../connection/EclipseLinkConnectionComposite.java | 55 - .../connection/JdbcBindParametersComposite.java | 97 - .../JdbcConnectionPropertiesComposite.java | 342 - .../connection/JdbcDriverComposite.java | 94 - .../JdbcExclusiveConnectionModeComposite.java | 87 - ...dbcExclusiveConnectionsPropertiesComposite.java | 84 - .../connection/JdbcLazyConnectionComposite.java | 98 - .../connection/JdbcPropertiesComposite.java | 90 - .../JdbcReadConnectionPropertiesComposite.java | 57 - .../JdbcReadConnectionsMaxComposite.java | 88 - .../JdbcReadConnectionsMinComposite.java | 87 - .../JdbcReadConnectionsSharedComposite.java | 98 - .../JdbcWriteConnectionPropertiesComposite.java | 63 - .../JdbcWriteConnectionsMaxComposite.java | 87 - .../JdbcWriteConnectionsMinComposite.java | 87 - .../persistence/connection/NativeSqlComposite.java | 98 - .../connection/PersistenceXmlConnectionTab.java | 84 - .../connection/TransactionTypeComposite.java | 129 - .../customization/CustomizerComposite.java | 103 - .../EclipseLinkCustomizationComposite.java | 77 - .../EntityCustomizationPropertyComposite.java | 47 - .../customization/EntityListComposite.java | 212 - .../customization/ExceptionHandlerComposite.java | 93 - .../PersistenceXmlCustomizationTab.java | 91 - .../customization/ProfilerComposite.java | 207 - .../customization/SessionCustomizersComposite.java | 192 - .../customization/ThrowExceptionsComposite.java | 97 - .../customization/ValidateSchemaComposite.java | 97 - .../customization/ValidationOnlyComposite.java | 97 - .../WeavingChangeTrackingComposite.java | 97 - .../customization/WeavingComposite.java | 87 - .../customization/WeavingEagerComposite.java | 97 - .../customization/WeavingFetchGroupsComposite.java | 97 - .../customization/WeavingInternalComposite.java | 98 - .../customization/WeavingLazyComposite.java | 97 - .../customization/WeavingPropertiesComposite.java | 56 - ...EclipseLinkPersistenceUnitGeneralComposite.java | 68 - ...clipseLinkPersistenceUnitJarFilesComposite.java | 53 - ...seLinkPersistenceUnitMappingFilesComposite.java | 126 - .../logging/EclipseLinkLoggingComposite.java | 83 - .../persistence/logging/ExceptionsComposite.java | 97 - .../persistence/logging/LoggerComposite.java | 208 - .../logging/LoggingFileLocationComposite.java | 98 - .../persistence/logging/LoggingLevelComposite.java | 90 - .../logging/PersistenceXmlLoggingTab.java | 84 - .../persistence/logging/SessionComposite.java | 98 - .../persistence/logging/ThreadComposite.java | 97 - .../persistence/logging/TimestampComposite.java | 96 - .../options/EclipseLinkOptionsComposite.java | 85 - .../options/EventListenerComposite.java | 93 - .../options/IncludeDescriptorQueriesComposite.java | 97 - .../options/PersistenceXmlOptionsTab.java | 84 - .../persistence/options/SessionNameComposite.java | 107 - .../persistence/options/SessionsXmlComposite.java | 107 - .../options/TargetDatabaseComposite.java | 183 - .../persistence/options/TargetServerComposite.java | 182 - .../options/TemporalMutableComposite.java | 97 - .../generation/CreateDdlFileNameComposite.java | 106 - .../generation/DdlGenerationLocationComposite.java | 98 - .../generation/DdlGenerationTypeComposite.java | 87 - .../generation/DropDdlFileNameComposite.java | 106 - .../EclipseLinkSchemaGenerationComposite.java | 49 - .../schema/generation/OutputModeComposite.java | 85 - .../PersistenceXmlSchemaGenerationTab.java | 56 - ...pseLinkNavigatorItemContentProviderFactory.java | 94 - ...lipseLinkNavigatorItemLabelProviderFactory.java | 23 - .../platform/EclipseLinkJpaPlatformUi.java | 35 - .../platform/EclipseLinkJpaPlatformUiFactory.java | 31 - .../platform/EclipseLinkJpaPlatformUiProvider.java | 71 - .../platform/EclipseLinkNavigatorProvider.java | 34 - ...lipseLinkOrmResourceModelStructureProvider.java | 48 - ...eLinkPersistenceItemContentProviderFactory.java | 136 - ...kPersistenceResourceModelStructureProvider.java | 47 - .../orm/EclipseLinkOrmXml1_1UiDefinition.java | 107 - .../details/orm/EclipseLinkOrmXml1_1UiFactory.java | 104 - ...ipseLinkBasicCollectionMapping1_1Composite.java | 57 - .../OrmEclipseLinkBasicMapMapping1_1Composite.java | 57 - .../OrmEclipseLinkBasicMapping1_1Composite.java | 61 - ...rmEclipseLinkEmbeddedIdMapping1_1Composite.java | 53 - .../OrmEclipseLinkEmbeddedMapping1_1Composite.java | 75 - .../orm/OrmEclipseLinkIdMapping1_1Composite.java | 52 - ...rmEclipseLinkManyToManyMapping1_1Composite.java | 95 - ...OrmEclipseLinkManyToOneMapping1_1Composite.java | 106 - ...OrmEclipseLinkOneToManyMapping1_1Composite.java | 57 - .../OrmEclipseLinkOneToOneMapping1_1Composite.java | 127 - .../OrmEclipseLinkVersionMapping1_1Composite.java | 57 - .../EclipseLink1_1JpaPlatformUiFactory.java | 33 - .../EclipseLink1_1JpaPlatformUiProvider.java | 75 - .../EclipseLink1_2JavaResourceUiDefinition.java | 104 - .../details/java/EclipseLink1_2JavaUiFactory.java | 50 - .../JavaEclipseLinkEmbeddable1_2Composite.java | 71 - .../java/JavaEclipseLinkEntity1_2Composite.java | 68 - ...avaEclipseLinkMappedSuperclass1_2Composite.java | 64 - .../orm/EclipseLinkOrmXml1_2UiDefinition.java | 108 - .../EclipseLink1_2JpaPlatformUiFactory.java | 33 - .../EclipseLink1_2JpaPlatformUiProvider.java | 75 - .../wizards/EclipseLink2_0DDLGeneratorUi.java | 57 - .../details/EclipseLinkCaching2_0Composite.java | 186 - .../EclipseLink2_0JavaResourceUiDefinition.java | 116 - .../details/java/EclipseLink2_0JavaUiFactory.java | 114 - .../java/JavaEclipseLinkCaching2_0Composite.java | 69 - ...seLinkElementCollectionMapping2_0Composite.java | 57 - .../java/JavaEclipseLinkEntity2_0Composite.java | 94 - .../java/JavaEclipseLinkIdMapping2_0Composite.java | 45 - .../JavaEclipseLinkIdMapping2_0UiDefinition.java | 51 - ...vaEclipseLinkManyToManyMapping2_0Composite.java | 57 - ...avaEclipseLinkManyToOneMapping2_0Composite.java | 57 - ...avaEclipseLinkMappedSuperclass2_0Composite.java | 70 - ...avaEclipseLinkOneToManyMapping2_0Composite.java | 63 - ...JavaEclipseLinkOneToOneMapping2_0Composite.java | 86 - .../EclipseLinkEntityMappings2_0DetailsPage.java | 103 - ...clipseLinkEntityMappings2_0DetailsProvider.java | 65 - .../orm/EclipseLinkOrmXml2_0UiDefinition.java | 110 - .../details/orm/EclipseLinkOrmXml2_0UiFactory.java | 137 - .../orm/OrmEclipseLinkCaching2_0Composite.java | 69 - ...rmEclipseLinkEmbeddedIdMapping2_0Composite.java | 43 - .../orm/OrmEclipseLinkEntity2_0Composite.java | 53 - .../orm/OrmEclipseLinkIdMapping2_0Composite.java | 49 - ...rmEclipseLinkManyToManyMapping2_0Composite.java | 51 - ...OrmEclipseLinkManyToOneMapping2_0Composite.java | 70 - ...OrmEclipseLinkMappedSuperclass2_0Composite.java | 34 - ...OrmEclipseLinkOneToManyMapping2_0Composite.java | 78 - .../OrmEclipseLinkOneToOneMapping2_0Composite.java | 101 - .../EclipseLink2_0PersistenceXmlUiFactory.java | 106 - .../EclipseLinkPersistenceXml2_0UiDefinition.java | 55 - .../caching/CacheDefaults2_0Composite.java | 88 - .../caching/EclipseLinkCaching2_0Composite.java | 74 - .../caching/FlushClearCache2_0Composite.java | 85 - .../caching/PersistenceXmlCaching2_0Tab.java | 36 - .../EclipseLinkCustomization2_0Composite.java | 32 - .../PersistenceXmlCustomization2_0Tab.java | 36 - .../persistence/logging/ConnectionComposite.java | 98 - .../EclipseLinkCategoryLoggingLevelComposite.java | 197 - .../logging/EclipseLinkLogging2_0Composite.java | 55 - .../logging/PersistenceXmlLogging2_0Tab.java | 37 - .../options/EclipseLinkOptions2_0Composite.java | 38 - .../options/LockingConfigurationComposite.java | 85 - .../options/PersistenceXmlOptions2_0Tab.java | 37 - .../options/QueryConfigurationComposite.java | 85 - .../options/ValidationConfigurationComposite.java | 382 - .../options/ValidationModeComposite.java | 92 - .../v2_0/platform/EclipseLink2_0JpaPlatformUi.java | 34 - .../EclipseLink2_0JpaPlatformUiFactory.java | 35 - .../EclipseLink2_0JpaPlatformUiProvider.java | 87 - .../orm/EclipseLinkOrmXml2_1UiDefinition.java | 105 - .../details/orm/EclipseLinkOrmXml2_1UiFactory.java | 31 - ...seLinkElementCollectionMapping2_1Composite.java | 72 - .../EclipseLink2_1JpaPlatformUiFactory.java | 34 - .../EclipseLink2_1JpaPlatformUiProvider.java | 89 - .../orm/EclipseLinkOrmXml2_2UiDefinition.java | 106 - .../EclipseLink2_2JpaPlatformUiFactory.java | 34 - .../EclipseLink2_2JpaPlatformUiProvider.java | 91 - .../wizards/EclipseLinkMappingFileWizard.java | 57 - jpa/plugins/org.eclipse.jpt.jpa.gen/.classpath | 8 - jpa/plugins/org.eclipse.jpt.jpa.gen/.cvsignore | 6 - jpa/plugins/org.eclipse.jpt.jpa.gen/.project | 28 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../org.eclipse.jpt.jpa.gen/META-INF/MANIFEST.MF | 26 - jpa/plugins/org.eclipse.jpt.jpa.gen/about.html | 34 - .../org.eclipse.jpt.jpa.gen/build.properties | 18 - jpa/plugins/org.eclipse.jpt.jpa.gen/component.xml | 12 - .../org.eclipse.jpt.jpa.gen/plugin.properties | 23 - .../property_files/jpt_gen.properties | 20 - .../eclipse/jpt/jpa/gen/internal/Association.java | 388 - .../jpt/jpa/gen/internal/AssociationRole.java | 273 - .../jpa/gen/internal/BaseEntityGenCustomizer.java | 230 - .../internal/DatabaseAnnotationNameBuilder.java | 105 - .../jpt/jpa/gen/internal/JptGenMessages.java | 38 - .../jpt/jpa/gen/internal/JptJpaGenPlugin.java | 33 - .../eclipse/jpt/jpa/gen/internal/ORMGenColumn.java | 415 - .../jpt/jpa/gen/internal/ORMGenCustomizer.java | 820 -- .../eclipse/jpt/jpa/gen/internal/ORMGenTable.java | 1031 -- .../jpt/jpa/gen/internal/OverwriteConfirmer.java | 59 - .../jpt/jpa/gen/internal/PackageGenerator.java | 327 - .../org/eclipse/jpt/jpa/gen/internal/TagNames.java | 46 - .../gen/internal/util/CompilationUnitModifier.java | 131 - .../eclipse/jpt/jpa/gen/internal/util/DTPUtil.java | 80 - .../jpt/jpa/gen/internal/util/EntityGenTools.java | 80 - .../jpt/jpa/gen/internal/util/FileUtil.java | 218 - .../jpt/jpa/gen/internal/util/ForeignKeyInfo.java | 120 - .../jpt/jpa/gen/internal/util/StringUtil.java | 648 - .../eclipse/jpt/jpa/gen/internal/util/UrlUtil.java | 125 - .../templates/entities/column.vm | 54 - .../templates/entities/join.vm | 80 - .../templates/entities/main.java.vm | 134 - .../templates/entities/manyToMany.vm | 26 - .../templates/entities/manyToOne.vm | 13 - .../templates/entities/mappingKind.vm | 34 - .../templates/entities/oneToMany.vm | 18 - .../templates/entities/oneToOne.vm | 22 - .../templates/entities/pk.java.vm | 66 - jpa/plugins/org.eclipse.jpt.jpa.ui/.classpath | 13 - jpa/plugins/org.eclipse.jpt.jpa.ui/.cvsignore | 6 - jpa/plugins/org.eclipse.jpt.jpa.ui/.jetproperties | 4 - jpa/plugins/org.eclipse.jpt.jpa.ui/.options | 14 - jpa/plugins/org.eclipse.jpt.jpa.ui/.project | 34 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF | 94 - jpa/plugins/org.eclipse.jpt.jpa.ui/about.html | 34 - .../org.eclipse.jpt.jpa.ui/build.properties | 26 - jpa/plugins/org.eclipse.jpt.jpa.ui/component.xml | 12 - .../icons/full/dtool16/new_entity_wiz.gif | Bin 594 -> 0 bytes .../icons/full/dtool16/new_jpa_file_wiz.gif | Bin 359 -> 0 bytes .../icons/full/dtool16/new_jpaproject_wiz.gif | Bin 372 -> 0 bytes .../icons/full/etool16/jpa_facet.gif | Bin 896 -> 0 bytes .../icons/full/etool16/new_entity_wiz.gif | Bin 624 -> 0 bytes .../icons/full/etool16/new_jpa_file_wiz.gif | Bin 586 -> 0 bytes .../icons/full/etool16/new_jpaproject_wiz.gif | Bin 991 -> 0 bytes .../icons/full/eview16/jpa_details.gif | Bin 953 -> 0 bytes .../icons/full/eview16/jpa_perspective.gif | Bin 896 -> 0 bytes .../icons/full/eview16/jpa_structure.gif | Bin 900 -> 0 bytes .../icons/full/obj16/basic.gif | Bin 897 -> 0 bytes .../icons/full/obj16/element-collection.gif | Bin 872 -> 0 bytes .../icons/full/obj16/embeddable.gif | Bin 1003 -> 0 bytes .../icons/full/obj16/embedded-id.gif | Bin 953 -> 0 bytes .../icons/full/obj16/embedded.gif | Bin 905 -> 0 bytes .../icons/full/obj16/entity-mappings.gif | Bin 974 -> 0 bytes .../icons/full/obj16/entity.gif | Bin 1010 -> 0 bytes .../org.eclipse.jpt.jpa.ui/icons/full/obj16/id.gif | Bin 938 -> 0 bytes .../icons/full/obj16/jpa-content.gif | Bin 896 -> 0 bytes .../icons/full/obj16/jpa-file.gif | Bin 968 -> 0 bytes .../icons/full/obj16/jpa-jar-file.gif | Bin 1013 -> 0 bytes .../icons/full/obj16/many-to-many.gif | Bin 328 -> 0 bytes .../icons/full/obj16/many-to-one.gif | Bin 307 -> 0 bytes .../icons/full/obj16/mapped-superclass.gif | Bin 1005 -> 0 bytes .../icons/full/obj16/null-attribute-mapping.gif | Bin 911 -> 0 bytes .../icons/full/obj16/null-type-mapping.gif | Bin 586 -> 0 bytes .../icons/full/obj16/one-to-many.gif | Bin 306 -> 0 bytes .../icons/full/obj16/one-to-one.gif | Bin 283 -> 0 bytes .../icons/full/obj16/persistence-unit.gif | Bin 931 -> 0 bytes .../icons/full/obj16/persistence.gif | Bin 961 -> 0 bytes .../icons/full/obj16/transient.gif | Bin 892 -> 0 bytes .../icons/full/obj16/version.gif | Bin 321 -> 0 bytes .../icons/full/obj16/warning.gif | Bin 338 -> 0 bytes .../icons/full/wizban/new_entity_wizban.gif | Bin 3316 -> 0 bytes .../icons/full/wizban/new_jpa_file_wizban.gif | Bin 3070 -> 0 bytes .../icons/full/wizban/new_jpa_prj_wiz.gif | Bin 2791 -> 0 bytes .../images/buttons/add-connection.gif | Bin 920 -> 0 bytes .../org.eclipse.jpt.jpa.ui/images/buttons/add.png | Bin 1000 -> 0 bytes .../images/buttons/browse-mini.png | Bin 448 -> 0 bytes .../images/buttons/browse.png | Bin 1072 -> 0 bytes .../images/buttons/collapse-all.png | Bin 989 -> 0 bytes .../images/buttons/delete.png | Bin 1059 -> 0 bytes .../images/buttons/deselect-all.png | Bin 1050 -> 0 bytes .../org.eclipse.jpt.jpa.ui/images/buttons/dot.gif | Bin 121 -> 0 bytes .../org.eclipse.jpt.jpa.ui/images/buttons/edit.png | Bin 380 -> 0 bytes .../images/buttons/expand-all.png | Bin 1004 -> 0 bytes .../images/buttons/list-of-values.png | Bin 1072 -> 0 bytes .../images/buttons/move-down.png | Bin 305 -> 0 bytes .../images/buttons/move-up.png | Bin 284 -> 0 bytes .../images/buttons/reconnect.png | Bin 1022 -> 0 bytes .../images/buttons/restore-defaults.png | Bin 1057 -> 0 bytes .../images/buttons/select-all.png | Bin 1096 -> 0 bytes .../images/buttons/warningstd.png | Bin 993 -> 0 bytes .../images/diagram/export-as-img-hover.png | Bin 1222 -> 0 bytes .../images/diagram/export-as-img.png | Bin 1047 -> 0 bytes .../images/diagram/header_left_bg.png | Bin 232 -> 0 bytes .../images/diagram/header_mid_bg.png | Bin 190 -> 0 bytes .../images/diagram/header_right_bg.png | Bin 232 -> 0 bytes .../images/diagram/print-hover.png | Bin 1219 -> 0 bytes .../images/diagram/print.png | Bin 1051 -> 0 bytes .../images/diagram/shadow-bottom.png | Bin 928 -> 0 bytes .../images/diagram/shadow-lower-left.png | Bin 978 -> 0 bytes .../images/diagram/shadow-lower-right.png | Bin 989 -> 0 bytes .../images/diagram/shadow-side.png | Bin 924 -> 0 bytes .../images/diagram/shadow-upper-right.png | Bin 976 -> 0 bytes .../images/diagram/toolbar_bg.png | Bin 196 -> 0 bytes .../images/objects/column.gif | Bin 113 -> 0 bytes .../images/objects/columnKey.gif | Bin 1715 -> 0 bytes .../org.eclipse.jpt.jpa.ui/images/objects/file.png | Bin 456 -> 0 bytes .../images/objects/folder.png | Bin 310 -> 0 bytes .../images/objects/forward.gif | Bin 138 -> 0 bytes .../images/objects/moveRight.gif | Bin 138 -> 0 bytes .../images/objects/package.png | Bin 319 -> 0 bytes .../images/objects/table.gif | Bin 953 -> 0 bytes .../images/objects/table_obj.gif | Bin 561 -> 0 bytes .../images/overlays/error.gif | Bin 82 -> 0 bytes .../images/overlays/warning.png | Bin 322 -> 0 bytes .../images/save-image-16.png | Bin 508 -> 0 bytes .../org.eclipse.jpt.jpa.ui/plugin.properties | 73 - jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.xml | 1039 -- .../property_files/jpt_ui.properties | 155 - .../property_files/jpt_ui_details.properties | 323 - .../property_files/jpt_ui_details2_0.properties | 52 - .../property_files/jpt_ui_details_orm.properties | 55 - .../property_files/jpt_ui_entity_gen.properties | 111 - .../property_files/jpt_ui_entity_wizard.properties | 57 - .../property_files/jpt_ui_persistence.properties | 56 - .../jpt_ui_persistence2_0.properties | 60 - .../jpt_ui_validation_preferences.properties | 211 - .../schema/jpaPlatformUis.exsd | 139 - .../src/org/eclipse/jpt/jpa/ui/JpaPlatformUi.java | 126 - .../eclipse/jpt/jpa/ui/JpaPlatformUiFactory.java | 26 - .../eclipse/jpt/jpa/ui/JpaPlatformUiProvider.java | 46 - .../src/org/eclipse/jpt/jpa/ui/JptJpaUiPlugin.java | 236 - .../jpt/jpa/ui/MappingResourceUiDefinition.java | 73 - .../jpa/ui/PersistenceXmlResourceUiDefinition.java | 34 - .../eclipse/jpt/jpa/ui/ResourceUiDefinition.java | 34 - .../jpa/ui/details/DefaultMappingUiDefinition.java | 28 - .../eclipse/jpt/jpa/ui/details/JpaComposite.java | 45 - .../eclipse/jpt/jpa/ui/details/JpaDetailsPage.java | 51 - .../jpt/jpa/ui/details/JpaDetailsProvider.java | 50 - .../jpt/jpa/ui/details/JpaPageComposite.java | 47 - .../jpt/jpa/ui/details/MappingUiDefinition.java | 69 - .../DefaultJavaAttributeMappingUiDefinition.java | 27 - .../java/DefaultJavaTypeMappingUiDefinition.java | 27 - .../java/JavaAttributeMappingUiDefinition.java | 48 - .../details/java/JavaTypeMappingUiDefinition.java | 48 - .../jpt/jpa/ui/details/java/JavaUiFactory.java | 265 - .../orm/OrmAttributeMappingUiDefinition.java | 48 - .../ui/details/orm/OrmTypeMappingUiDefinition.java | 48 - .../jpt/jpa/ui/details/orm/OrmXmlUiFactory.java | 220 - .../ui/internal/AbstractJpaPlatformUiProvider.java | 88 - .../jpa/ui/internal/EditorPartAdapterFactory.java | 65 - .../ui/internal/GenericJpaPlatformUiProvider.java | 70 - .../jpt/jpa/ui/internal/ImageRepository.java | 149 - .../jpt/jpa/ui/internal/JpaHelpContextIds.java | 151 - .../JpaJavaCompletionProposalComputer.java | 187 - .../jpt/jpa/ui/internal/JpaMappingImageHelper.java | 86 - .../eclipse/jpt/jpa/ui/internal/JptUiIcons.java | 127 - .../eclipse/jpt/jpa/ui/internal/JptUiMessages.java | 154 - .../JptUiValidationPreferenceMessages.java | 220 - .../jpa/ui/internal/actions/GenerateDDLAction.java | 27 - .../internal/actions/GenerateEntitiesAction.java | 26 - .../ui/internal/actions/MakePersistentAction.java | 145 - .../ui/internal/actions/OpenJpaResourceAction.java | 101 - .../jpt/jpa/ui/internal/actions/ProjectAction.java | 94 - .../internal/actions/SynchronizeClassesAction.java | 49 - .../AddPersistentAttributeToXmlAndMapHandler.java | 69 - .../AddPersistentAttributeToXmlHandler.java | 56 - .../commands/AddPersistentClassHandler.java | 57 - .../ConvertJavaProjectToJpaCommandHandler.java | 158 - .../commands/PersistentAttributeMapAsHandler.java | 143 - .../commands/PersistentTypeMapAsHandler.java | 124 - .../RemovePersistentAttributeFromXmlHandler.java | 60 - .../commands/RemovePersistentClassHandler.java | 37 - .../commands/UpgradeXmlFileVersionHandler.java | 63 - .../details/AbstractBasicMappingComposite.java | 217 - .../details/AbstractBasicMappingUiDefinition.java | 41 - .../details/AbstractEmbeddableComposite.java | 66 - .../details/AbstractEmbeddableUiDefinition.java | 41 - .../AbstractEmbeddedIdMappingComposite.java | 48 - .../AbstractEmbeddedIdMappingUiDefinition.java | 42 - .../details/AbstractEmbeddedMappingComposite.java | 75 - .../AbstractEmbeddedMappingOverridesComposite.java | 39 - .../AbstractEmbeddedMappingUiDefinition.java | 41 - .../internal/details/AbstractEntityComposite.java | 216 - .../AbstractEntityMappingsDetailsProvider.java | 32 - .../details/AbstractEntityOverridesComposite.java | 55 - .../details/AbstractEntityUiDefinition.java | 41 - .../details/AbstractIdMappingComposite.java | 136 - .../details/AbstractIdMappingUiDefinition.java | 42 - .../details/AbstractInheritanceComposite.java | 291 - .../details/AbstractJoiningStrategyPane.java | 99 - .../internal/details/AbstractJpaDetailsPage.java | 53 - .../AbstractManyToManyMappingComposite.java | 140 - .../AbstractManyToManyMappingUiDefinition.java | 41 - .../details/AbstractManyToOneMappingComposite.java | 80 - .../AbstractManyToOneMappingUiDefinition.java | 41 - .../details/AbstractMappedSuperclassComposite.java | 62 - .../AbstractMappedSuperclassUiDefinition.java | 41 - .../details/AbstractMappingUiDefinition.java | 25 - .../details/AbstractOneToManyMappingComposite.java | 132 - .../AbstractOneToManyMappingUiDefinition.java | 41 - .../details/AbstractOneToOneMappingComposite.java | 80 - .../AbstractOneToOneMappingUiDefinition.java | 41 - .../details/AbstractOrderingComposite.java | 139 - .../details/AbstractOverridesComposite.java | 414 - .../AbstractPrimaryKeyJoinColumnsComposite.java | 344 - .../details/AbstractSecondaryTablesComposite.java | 177 - .../AbstractTransientMappingUiDefinition.java | 41 - .../details/AbstractVersionMappingComposite.java | 161 - .../AbstractVersionMappingUiDefinition.java | 41 - .../ui/internal/details/AccessTypeComposite.java | 117 - .../jpa/ui/internal/details/AddQueryDialog.java | 195 - .../ui/internal/details/AddQueryStateObject.java | 146 - .../details/AssociationOverrideComposite.java | 85 - .../details/AttributeOverrideComposite.java | 71 - .../ui/internal/details/BaseJoinColumnDialog.java | 111 - .../internal/details/BaseJoinColumnDialogPane.java | 442 - .../details/BaseJoinColumnStateObject.java | 389 - .../ui/internal/details/BasicMappingComposite.java | 80 - .../jpa/ui/internal/details/CascadeComposite.java | 211 - .../jpa/ui/internal/details/ColumnComposite.java | 587 - .../details/DiscriminatorColumnComposite.java | 309 - .../details/EmbeddedIdMappingComposite.java | 35 - .../internal/details/EmbeddedMappingComposite.java | 50 - .../details/EmbeddedMappingOverridesComposite.java | 50 - .../ui/internal/details/EntityNameComposite.java | 122 - .../internal/details/EntityOverridesComposite.java | 25 - .../jpa/ui/internal/details/EnumTypeComposite.java | 115 - .../ui/internal/details/FetchTypeComposite.java | 109 - .../internal/details/GeneratedValueComposite.java | 217 - .../ui/internal/details/GenerationComposite.java | 234 - .../ui/internal/details/GeneratorComposite.java | 206 - .../jpa/ui/internal/details/IdClassComposite.java | 139 - .../ui/internal/details/IdMappingComposite.java | 33 - .../details/IdMappingGenerationComposite.java | 348 - .../InverseJoinColumnInJoinTableDialog.java | 78 - .../InverseJoinColumnInJoinTableStateObject.java | 94 - .../jpa/ui/internal/details/JoinColumnDialog.java | 53 - .../ui/internal/details/JoinColumnDialogPane.java | 286 - .../details/JoinColumnInJoiningStrategyDialog.java | 62 - .../JoinColumnInJoiningStrategyStateObject.java | 97 - .../details/JoinColumnInReferenceTableDialog.java | 80 - .../JoinColumnInReferenceTableStateObject.java | 87 - .../details/JoinColumnJoiningStrategyPane.java | 152 - .../ui/internal/details/JoinColumnStateObject.java | 212 - .../ui/internal/details/JoinColumnsComposite.java | 329 - .../ui/internal/details/JoinTableComposite.java | 417 - .../details/JoinTableJoiningStrategyPane.java | 114 - .../JoiningStrategyJoinColumnsComposite.java | 237 - ...tegyJoinColumnsWithOverrideOptionComposite.java | 152 - .../ui/internal/details/JptUiDetailsMessages.java | 303 - .../details/ManyToManyJoiningStrategyPane.java | 125 - .../details/ManyToManyMappingComposite.java | 83 - .../details/ManyToOneJoiningStrategyPane.java | 68 - .../details/ManyToOneMappingComposite.java | 84 - .../jpa/ui/internal/details/MapAsComposite.java | 638 - .../details/MappedByJoiningStrategyPane.java | 94 - .../jpt/jpa/ui/internal/details/MappedByPane.java | 100 - .../details/NamedNativeQueryPropertyComposite.java | 182 - .../details/NamedQueryPropertyComposite.java | 119 - .../details/OneToManyJoiningStrategyPane.java | 82 - .../details/OneToManyMappingComposite.java | 82 - .../details/OneToOneJoiningStrategyPane.java | 96 - .../internal/details/OneToOneMappingComposite.java | 85 - .../jpa/ui/internal/details/OptionalComposite.java | 102 - .../jpa/ui/internal/details/OrderingComposite.java | 115 - .../details/PersistentAttributeDetailsPage.java | 182 - .../details/PersistentAttributeMapAsComposite.java | 134 - .../details/PersistentTypeDetailsPage.java | 169 - .../details/PersistentTypeMapAsComposite.java | 127 - .../details/PrimaryKeyJoinColumnDialog.java | 108 - ...PrimaryKeyJoinColumnInSecondaryTableDialog.java | 111 - ...ryKeyJoinColumnInSecondaryTableStateObject.java | 99 - .../PrimaryKeyJoinColumnJoiningStrategyPane.java | 86 - .../details/PrimaryKeyJoinColumnStateObject.java | 101 - ...aryKeyJoinColumnsInSecondaryTableComposite.java | 414 - .../jpa/ui/internal/details/QueriesComposite.java | 313 - .../ui/internal/details/QueryHintsComposite.java | 339 - .../internal/details/ReferenceTableComposite.java | 436 - .../ui/internal/details/SecondaryTableDialog.java | 450 - .../details/SequenceGeneratorComposite.java | 136 - .../jpa/ui/internal/details/TableComposite.java | 239 - .../internal/details/TableGeneratorComposite.java | 499 - .../ui/internal/details/TargetEntityComposite.java | 131 - .../ui/internal/details/TemporalTypeComposite.java | 139 - .../details/TransientMappingComposite.java | 50 - .../internal/details/VersionMappingComposite.java | 61 - .../jpa/ui/internal/details/db/CatalogCombo.java | 44 - .../jpa/ui/internal/details/db/ColumnCombo.java | 63 - .../internal/details/db/DatabaseObjectCombo.java | 349 - .../jpa/ui/internal/details/db/SchemaCombo.java | 56 - .../jpa/ui/internal/details/db/SequenceCombo.java | 49 - .../jpt/jpa/ui/internal/details/db/TableCombo.java | 56 - .../java/AbstractJavaResourceUiDefinition.java | 242 - .../internal/details/java/BaseJavaUiFactory.java | 173 - .../java/DefaultBasicMappingUiDefinition.java | 83 - .../java/DefaultEmbeddedMappingUiDefinition.java | 83 - .../java/GenericJavaResourceUiDefinition.java | 75 - .../details/java/GenericJavaUiFactory.java | 23 - .../details/java/JavaBasicMappingUiDefinition.java | 55 - .../details/java/JavaEmbeddableComposite.java | 45 - .../details/java/JavaEmbeddableUiDefinition.java | 54 - .../java/JavaEmbeddedIdMappingUDefinition.java | 55 - .../java/JavaEmbeddedMappingUiDefinition.java | 55 - .../internal/details/java/JavaEntityComposite.java | 53 - .../details/java/JavaEntityUiDefinition.java | 55 - .../details/java/JavaIdMappingUiDefinition.java | 55 - .../details/java/JavaInheritanceComposite.java | 44 - .../java/JavaManyToManyMappingUiDefinition.java | 55 - .../java/JavaManyToOneMappingUiDefinition.java | 55 - .../java/JavaMappedSuperclassComposite.java | 54 - .../java/JavaMappedSuperclassUiDefinition.java | 55 - .../java/JavaOneToManyMappingUiDefinition.java | 55 - .../java/JavaOneToOneMappingUiDefinition.java | 55 - .../java/JavaPersistentAttributeDetailsPage.java | 69 - .../JavaPersistentAttributeDetailsProvider.java | 60 - .../java/JavaPersistentTypeDetailsProvider.java | 61 - .../java/JavaPrimaryKeyJoinColumnsComposite.java | 67 - .../details/java/JavaSecondaryTablesComposite.java | 130 - .../java/JavaTransientMappingUiDefinition.java | 55 - .../java/JavaVersionMappingUiDefinition.java | 55 - .../java/NullJavaAttributeMappingUiDefinition.java | 92 - .../java/NullJavaTypeMappingUiDefinition.java | 95 - .../orm/AbstractEntityMappingsDetailsPage.java | 268 - .../details/orm/AbstractOrmEntityComposite.java | 90 - .../orm/AbstractOrmXmlResourceUiDefinition.java | 174 - .../internal/details/orm/AddGeneratorDialog.java | 194 - .../details/orm/AddGeneratorStateObject.java | 146 - .../internal/details/orm/BaseOrmXmlUiFactory.java | 134 - .../details/orm/EntityMappingsDetailsPage.java | 82 - .../details/orm/EntityMappingsDetailsProvider.java | 60 - .../orm/EntityMappingsGeneratorsComposite.java | 371 - .../details/orm/GenericOrmXmlUiFactory.java | 15 - .../details/orm/JptUiDetailsOrmMessages.java | 76 - .../details/orm/MetadataCompleteComposite.java | 89 - .../details/orm/OrmBasicMappingComposite.java | 45 - .../details/orm/OrmBasicMappingUiDefinition.java | 54 - .../details/orm/OrmEmbeddableComposite.java | 54 - .../details/orm/OrmEmbeddableUiDefinition.java | 54 - .../details/orm/OrmEmbeddedIdMappingComposite.java | 39 - .../orm/OrmEmbeddedIdMappingUiDefinition.java | 56 - .../details/orm/OrmEmbeddedMappingComposite.java | 64 - .../orm/OrmEmbeddedMappingUiDefinition.java | 56 - .../internal/details/orm/OrmEntityComposite.java | 43 - .../details/orm/OrmEntityUiDefinition.java | 55 - .../details/orm/OrmIdMappingComposite.java | 36 - .../details/orm/OrmIdMappingUiDefinition.java | 56 - .../details/orm/OrmInheritanceComposite.java | 44 - .../internal/details/orm/OrmJavaClassChooser.java | 112 - .../details/orm/OrmManyToManyMappingComposite.java | 90 - .../orm/OrmManyToManyMappingUiDefinition.java | 56 - .../details/orm/OrmManyToOneMappingComposite.java | 92 - .../orm/OrmManyToOneMappingUiDefinition.java | 56 - .../details/orm/OrmMappedSuperclassComposite.java | 51 - .../orm/OrmMappedSuperclassUiDefinition.java | 55 - .../details/orm/OrmMappingNameChooser.java | 71 - .../details/orm/OrmOneToManyMappingComposite.java | 89 - .../orm/OrmOneToManyMappingUiDefinition.java | 56 - .../details/orm/OrmOneToOneMappingComposite.java | 91 - .../orm/OrmOneToOneMappingUiDefinition.java | 56 - .../ui/internal/details/orm/OrmPackageChooser.java | 98 - .../orm/OrmPersistentAttributeDetailsPage.java | 114 - .../orm/OrmPersistentAttributeDetailsProvider.java | 61 - .../orm/OrmPersistentTypeDetailsProvider.java | 62 - .../orm/OrmPrimaryKeyJoinColumnsComposite.java | 70 - .../internal/details/orm/OrmQueriesComposite.java | 94 - .../details/orm/OrmSecondaryTablesComposite.java | 211 - .../orm/OrmTransientMappingUiDefinition.java | 56 - .../details/orm/OrmVersionMappingComposite.java | 41 - .../details/orm/OrmVersionMappingUiDefinition.java | 56 - .../internal/details/orm/OrmXmlUiDefinition.java | 84 - .../orm/PersistenceUnitMetadataComposite.java | 303 - .../orm/UnsupportedOrmMappingUiDefinition.java | 89 - .../AddPersistentAttributeToXmlAndMapDialog.java | 197 - .../internal/dialogs/AddPersistentClassDialog.java | 310 - .../internal/editors/PersistenceContributor.java | 106 - .../jpa/ui/internal/editors/PersistenceEditor.java | 436 - .../internal/jface/JarFileItemLabelProvider.java | 47 - .../internal/jface/XmlMappingFileViewerFilter.java | 78 - .../jpa2/Generic2_0JpaPlatformUiProvider.java | 77 - .../internal/jpa2/GenericOrmXml2_0UiFactory.java | 147 - .../ui/internal/jpa2/Jpa2_0ProjectFlagModel.java | 31 - ...stractElementCollectionMapping2_0Composite.java | 378 - ...actElementCollectionMapping2_0UiDefinition.java | 42 - .../AbstractManyToOneMapping2_0Composite.java | 57 - .../AbstractOneToOneMapping2_0Composite.java | 53 - .../details/AssociationOverride2_0Composite.java | 86 - .../ui/internal/jpa2/details/Cacheable2_0Pane.java | 107 - .../ui/internal/jpa2/details/CascadePane2_0.java | 81 - .../jpa2/details/CollectionTable2_0Composite.java | 157 - .../jpa2/details/DerivedIdentity2_0Pane.java | 200 - .../ElementCollectionMapping2_0Composite.java | 81 - .../ElementCollectionValueOverridesComposite.java | 64 - .../details/EmbeddedIdMapping2_0Composite.java | 37 - ...beddedIdMapping2_0MappedByRelationshipPane.java | 70 - .../EmbeddedMapping2_0OverridesComposite.java | 64 - .../jpa2/details/Entity2_0OverridesComposite.java | 35 - .../jpa2/details/Generation2_0Composite.java | 42 - .../IdMapping2_0MappedByRelationshipPane.java | 72 - .../details/IdMappingGeneration2_0Composite.java | 48 - .../jpa2/details/JptUiDetailsMessages2_0.java | 78 - .../internal/jpa2/details/LockModeComposite.java | 89 - .../details/ManyToOneJoiningStrategy2_0Pane.java | 84 - .../details/NamedQueryProperty2_0Composite.java | 67 - .../details/OneToManyJoiningStrategy2_0Pane.java | 95 - .../details/OneToOneJoiningStrategy2_0Pane.java | 115 - .../jpa2/details/OrderColumnComposite.java | 370 - .../jpa2/details/Ordering2_0Composite.java | 168 - .../jpa2/details/OrphanRemoval2_0Composite.java | 111 - .../internal/jpa2/details/Queries2_0Composite.java | 55 - .../details/SequenceGenerator2_0Composite.java | 190 - .../jpa2/details/TargetClassComposite.java | 130 - .../java/Generic2_0JavaResourceUiDefinition.java | 91 - .../jpa2/details/java/Generic2_0JavaUiFactory.java | 134 - ...avaElementCollectionMapping2_0UiDefinition.java | 56 - .../details/java/JavaEmbeddable2_0Composite.java | 69 - .../java/JavaEmbeddedMapping2_0Composite.java | 60 - .../jpa2/details/java/JavaEntity2_0Composite.java | 105 - .../details/java/JavaIdMapping2_0Composite.java | 43 - .../java/JavaManyToManyMapping2_0Composite.java | 46 - .../java/JavaManyToOneMapping2_0Composite.java | 42 - .../details/java/JavaManyToOneMapping2_0Pane.java | 14 - .../java/JavaMappedSuperclass2_0Composite.java | 74 - .../java/JavaOneToManyMapping2_0Composite.java | 66 - .../java/JavaOneToOneMapping2_0Composite.java | 62 - .../details/orm/EntityMappings2_0DetailsPage.java | 43 - .../orm/EntityMappings2_0DetailsProvider.java | 58 - .../orm/EntityMappingsGenerators2_0Composite.java | 53 - .../details/orm/OrmBasicMapping2_0Composite.java | 58 - .../OrmElementCollectionMapping2_0Composite.java | 59 - ...OrmElementCollectionMapping2_0UiDefinition.java | 56 - .../orm/OrmEmbeddedIdMapping2_0Composite.java | 53 - .../orm/OrmEmbeddedMapping2_0Composite.java | 77 - .../jpa2/details/orm/OrmEntity2_0Composite.java | 91 - .../jpa2/details/orm/OrmIdMapping2_0Composite.java | 58 - .../orm/OrmManyToManyMapping2_0Composite.java | 57 - .../orm/OrmManyToOneMapping2_0Composite.java | 57 - .../orm/OrmOneToManyMapping2_0Composite.java | 80 - .../orm/OrmOneToOneMapping2_0Composite.java | 76 - .../jpa2/details/orm/OrmQueries2_0Composite.java | 43 - .../details/orm/OrmVersionMapping2_0Composite.java | 55 - .../jpa2/details/orm/OrmXml2_0UiDefinition.java | 96 - .../Generic2_0PersistenceXmlUiFactory.java | 83 - .../persistence/JptUiPersistence2_0Messages.java | 82 - .../persistence/PersistenceXml2_0UiDefinition.java | 55 - .../connection/ConnectionPropertiesComposite.java | 38 - .../connection/DataSourcePropertiesComposite.java | 142 - ...nericPersistenceUnit2_0ConnectionComposite.java | 49 - .../GenericPersistenceUnit2_0ConnectionTab.java | 90 - .../JdbcConnectionPropertiesComposite.java | 314 - .../connection/JdbcDriverComposite.java | 94 - .../connection/JdbcPropertiesComposite.java | 79 - .../connection/TransactionTypeComposite.java | 123 - .../GenericPersistenceUnit2_0OptionsComposite.java | 63 - .../GenericPersistenceUnit2_0OptionsTab.java | 90 - .../options/LockingConfigurationComposite.java | 85 - .../options/QueryConfigurationComposite.java | 85 - .../options/SharedCacheModeComposite.java | 94 - .../options/ValidationConfigurationComposite.java | 385 - .../options/ValidationModeComposite.java | 94 - .../generic/Generic2_0JpaPlatformUiFactory.java | 34 - .../listeners/SWTConnectionListenerWrapper.java | 348 - .../jpa/ui/internal/menus/MapAsContribution.java | 204 - .../PersistentAttributeMapAsContribution.java | 86 - .../menus/PersistentTypeMapAsContribution.java | 64 - .../navigator/JpaNavigatorActionProvider.java | 59 - .../JpaNavigatorContentAndLabelProvider.java | 20 - .../navigator/JpaNavigatorContentProvider.java | 216 - .../JpaNavigatorItemLabelProviderFactory.java | 75 - .../navigator/JpaNavigatorLabelProvider.java | 138 - ...JpaNavigatorTreeItemContentProviderFactory.java | 75 - .../persistence/JptUiPersistenceMessages.java | 78 - ...AbstractPersistenceXmlResourceUiDefinition.java | 50 - .../details/ArchiveFileSelectionDialog.java | 225 - .../GenericPersistenceUnitGeneralComposite.java | 116 - .../GenericPersistenceUnitJarFilesComposite.java | 26 - ...enericPersistenceUnitMappingFilesComposite.java | 52 - .../details/GenericPersistenceXmlUiFactory.java | 38 - .../details/PersistenceUnitClassesComposite.java | 376 - .../PersistenceUnitConnectionComposite.java | 144 - ...PersistenceUnitConnectionDatabaseComposite.java | 159 - .../PersistenceUnitConnectionGeneralComposite.java | 106 - .../details/PersistenceUnitGeneralComposite.java | 230 - .../details/PersistenceUnitJarFilesComposite.java | 230 - .../PersistenceUnitMappingFilesComposite.java | 261 - .../PersistenceUnitPropertiesComposite.java | 419 - .../details/PersistenceXmlUiDefinition.java | 53 - .../details/PersistenceXmlUiFactory.java | 38 - .../perspective/JpaPerspectiveFactory.java | 51 - .../internal/platform/JpaPlatformUiRegistry.java | 190 - .../internal/platform/base/BaseJpaPlatformUi.java | 191 - .../internal/platform/base/EntitiesGenerator.java | 66 - .../generic/ClassRefItemLabelProvider.java | 64 - .../generic/EntityMappingsItemLabelProvider.java | 48 - .../platform/generic/GenericJpaPlatformUi.java | 34 - .../generic/GenericJpaPlatformUiFactory.java | 32 - ...GenericNavigatorItemContentProviderFactory.java | 255 - .../GenericNavigatorItemLabelProviderFactory.java | 51 - .../platform/generic/GenericNavigatorProvider.java | 29 - .../generic/JarFileRefItemLabelProvider.java | 57 - .../JavaPersistentTypeItemContentProvider.java | 53 - .../generic/MappingFileRefItemLabelProvider.java | 63 - .../OrmPersistentTypeItemContentProvider.java | 82 - .../generic/OrmXmlItemContentProvider.java | 69 - .../platform/generic/OrmXmlItemLabelProvider.java | 46 - .../generic/PersistenceItemLabelProvider.java | 47 - .../generic/PersistenceUnitItemLabelProvider.java | 55 - .../generic/PersistenceXmlItemContentProvider.java | 61 - .../generic/PersistenceXmlItemLabelProvider.java | 46 - .../PersistentAttributeItemContentProvider.java | 39 - .../PersistentAttributeItemLabelProvider.java | 77 - .../generic/PersistentTypeItemLabelProvider.java | 67 - .../generic/RootContextItemContentProvider.java | 51 - .../generic/RootContextItemLabelProvider.java | 46 - .../internal/preferences/JpaPreferencesPage.java | 68 - .../preferences/JpaProblemSeveritiesPage.java | 941 -- .../internal/properties/DataModelPropertyPage.java | 309 - .../properties/JpaProjectPropertiesPage.java | 1617 --- .../ui/internal/selection/DefaultJpaSelection.java | 60 - .../selection/DefaultJpaSelectionManager.java | 288 - .../selection/JpaDetailsSelectionParticipant.java | 42 - .../jpa/ui/internal/selection/JpaSelection.java | 37 - .../ui/internal/selection/JpaSelectionEvent.java | 64 - .../ui/internal/selection/JpaSelectionManager.java | 57 - .../selection/JpaSelectionParticipant.java | 38 - .../JpaStructureSelectionParticipant.java | 69 - .../selection/SelectionManagerFactory.java | 105 - .../selection/TextEditorSelectionParticipant.java | 215 - .../selection/WorkbenchPartAdapterFactory.java | 61 - .../GeneralJpaMappingItemLabelProviderFactory.java | 33 - .../structure/JavaItemContentProviderFactory.java | 39 - .../structure/JavaItemLabelProviderFactory.java | 17 - .../JavaResourceModelStructureProvider.java | 45 - .../structure/OrmItemContentProviderFactory.java | 79 - .../structure/OrmItemLabelProviderFactory.java | 27 - .../OrmResourceModelStructureProvider.java | 46 - .../PersistenceItemContentProviderFactory.java | 271 - .../PersistenceItemLabelProviderFactory.java | 48 - .../PersistenceResourceModelStructureProvider.java | 46 - .../ResourceModelItemContentProvider.java | 55 - .../jpt/jpa/ui/internal/views/AbstractJpaView.java | 166 - .../jpt/jpa/ui/internal/views/JpaDetailsView.java | 190 - .../internal/views/structure/JpaStructurePage.java | 409 - .../internal/views/structure/JpaStructureView.java | 134 - .../internal/wizards/DatabaseSchemaWizardPage.java | 445 - .../ui/internal/wizards/JpaFacetActionPage.java | 203 - .../ui/internal/wizards/JpaFacetInstallPage.java | 248 - .../wizards/JpaFacetVersionChangePage.java | 44 - .../internal/wizards/JpaMakePersistentWizard.java | 79 - .../wizards/JpaMakePersistentWizardPage.java | 635 - .../internal/wizards/NewEntityDropDownAction.java | 261 - .../wizards/SelectJpaOrmMappingFileDialog.java | 146 - .../wizards/entity/AnnotatedEntityTemplate.java | 166 - .../wizards/entity/EntityClassWizardPage.java | 408 - .../wizards/entity/EntityFieldsWizardPage.java | 234 - .../entity/EntityRowTableWizardSection.java | 822 -- .../ui/internal/wizards/entity/EntityTemplate.java | 126 - .../ui/internal/wizards/entity/EntityWizard.java | 176 - .../internal/wizards/entity/EntityWizardMsg.java | 127 - .../internal/wizards/entity/IdClassTemplate.java | 255 - .../data/model/CreateEntityTemplateModel.java | 384 - .../entity/data/model/EntityDataModelProvider.java | 504 - .../wizards/entity/data/model/EntityRow.java | 206 - .../data/model/IEntityDataModelProperties.java | 33 - .../data/operation/NewEntityClassOperation.java | 537 - .../ui/internal/wizards/gen/AssociationFigure.java | 227 - .../wizards/gen/AssociationTablesPage.java | 194 - .../wizards/gen/AssociationsListComposite.java | 137 - .../ui/internal/wizards/gen/CardinalityPage.java | 161 - .../jpa/ui/internal/wizards/gen/CascadeDialog.java | 191 - .../ui/internal/wizards/gen/ColumnGenPanel.java | 360 - .../jpa/ui/internal/wizards/gen/DatabaseGroup.java | 526 - .../gen/DefaultTableGenerationWizardPage.java | 327 - .../gen/GenerateEntitiesFromSchemaWizard.java | 541 - .../ui/internal/wizards/gen/JoinColumnsPage.java | 629 - .../wizards/gen/JptUiEntityGenMessages.java | 123 - .../internal/wizards/gen/NewAssociationWizard.java | 199 - .../wizards/gen/NewAssociationWizardPage.java | 60 - .../wizards/gen/PromptJPAProjectWizardPage.java | 154 - .../jpt/jpa/ui/internal/wizards/gen/SWTUtil.java | 133 - .../ui/internal/wizards/gen/SelectTableDialog.java | 75 - .../wizards/gen/TableAssociationsWizardPage.java | 775 -- .../jpa/ui/internal/wizards/gen/TableFigure.java | 86 - .../jpa/ui/internal/wizards/gen/TableGenPanel.java | 400 - .../TablesAndColumnsCustomizationWizardPage.java | 377 - .../wizards/gen/TablesSelectorWizardPage.java | 557 - .../wizards/orm/MappingFileNewFileWizardPage.java | 76 - .../wizards/orm/MappingFileOptionsWizardPage.java | 125 - .../ui/internal/wizards/orm/MappingFileWizard.java | 347 - .../internal/wizards/proj/AddToEarComposite.java | 114 - .../ui/internal/wizards/proj/JpaProjectWizard.java | 62 - .../wizards/proj/JpaProjectWizardFirstPage.java | 121 - .../JpaProjectCreationDataModelProperties.java | 28 - .../model/JpaProjectCreationDataModelProvider.java | 349 - .../jpa/ui/jpa2/details/java/JavaUiFactory2_0.java | 41 - .../ui/jpa2/details/orm/OrmXmlUiFactory2_0.java | 41 - .../jpt/jpa/ui/navigator/JpaNavigatorProvider.java | 43 - .../jpt/jpa/ui/structure/JpaStructureProvider.java | 41 - .../templates/annotated_entity.javajet | 64 - .../templates/entity.javajet | 50 - .../templates/idClass.javajet | 124 - jpa/plugins/org.eclipse.jpt.ui/.project | 5 - jpa/plugins/org.eclipse.jpt.utility/.project | 5 - .../.project | 5 - jpa/tests/org.eclipse.jpt.core.tests/.project | 5 - jpa/tests/org.eclipse.jpt.db.tests/.project | 5 - .../.project | 5 - jpa/tests/org.eclipse.jpt.gen.tests/.project | 5 - .../.classpath | 13 - .../.cvsignore | 6 - .../.project | 28 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../META-INF/MANIFEST.MF | 23 - .../about.html | 34 - .../build.properties | 19 - .../plugin.properties | 23 - .../plugin.xml | 34 - .../extension/resource/ExtensionTestPlugin.java | 55 - .../resource/JavaTestAttributeMapping.java | 35 - .../JavaTestAttributeMappingDefinition.java | 63 - .../extension/resource/JavaTestTypeMapping.java | 42 - .../resource/JavaTestTypeMappingDefinition.java | 54 - .../extension/resource/TestJavaBasicMapping.java | 21 - .../tests/extension/resource/TestJavaEntity.java | 31 - .../tests/extension/resource/TestJpaFactory.java | 39 - .../extension/resource/TestJpaPlatformFactory.java | 66 - .../resource/TestJpaPlatformProvider.java | 163 - .../resource/TestJpaPlatformUiFactory.java | 33 - .../org.eclipse.jpt.jpa.core.tests/.classpath | 15 - .../org.eclipse.jpt.jpa.core.tests/.cvsignore | 5 - jpa/tests/org.eclipse.jpt.jpa.core.tests/.project | 28 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../META-INF/MANIFEST.MF | 45 - .../org.eclipse.jpt.jpa.core.tests/about.html | 34 - .../build.properties | 18 - .../plugin.properties | 23 - .../jpt/jpa/core/tests/JptJpaCoreTestsPlugin.java | 61 - .../org/eclipse/jpt/jpa/core/tests/MiscTests.java | 65 - .../jpa/core/tests/internal/JptJpaCoreTests.java | 74 - .../internal/context/ContextModelTestCase.java | 221 - .../core/tests/internal/context/JpaFileTests.java | 411 - .../tests/internal/context/JpaProjectTests.java | 172 - .../context/JptJpaCoreContextModelTests.java | 52 - .../java/GenericJavaPersistentAttributeTests.java | 236 - .../java/GenericJavaPersistentTypeTests.java | 759 -- .../context/java/JavaAssociationOverrideTests.java | 446 - .../context/java/JavaAttributeOverrideTests.java | 260 - .../context/java/JavaBasicMappingTests.java | 995 -- .../internal/context/java/JavaCascadeTests.java | 321 - .../internal/context/java/JavaColumnTests.java | 843 -- .../context/java/JavaDiscriminatorColumnTests.java | 458 - .../internal/context/java/JavaEmbeddableTests.java | 171 - .../context/java/JavaEmbeddedIdMappingTests.java | 659 - .../context/java/JavaEmbeddedMappingTests.java | 863 -- .../internal/context/java/JavaEntityTests.java | 3417 ----- .../context/java/JavaGeneratedValueTests.java | 150 - .../internal/context/java/JavaIdMappingTests.java | 715 -- .../internal/context/java/JavaJoinColumnTests.java | 549 - .../internal/context/java/JavaJoinTableTests.java | 1177 -- .../context/java/JavaManyToManyMappingTests.java | 1180 -- .../context/java/JavaManyToOneMappingTests.java | 960 -- .../context/java/JavaMappedSuperclassTests.java | 288 - .../context/java/JavaNamedNativeQueryTests.java | 432 - .../internal/context/java/JavaNamedQueryTests.java | 333 - .../context/java/JavaOneToManyMappingTests.java | 1160 -- .../context/java/JavaOneToOneMappingTests.java | 1511 --- .../java/JavaPrimaryKeyJoinColumnTests.java | 303 - .../internal/context/java/JavaQueryHintTests.java | 145 - .../context/java/JavaSecondaryTableTests.java | 730 -- .../context/java/JavaSequenceGeneratorTests.java | 235 - .../context/java/JavaTableGeneratorTests.java | 671 - .../internal/context/java/JavaTableTests.java | 610 - .../context/java/JavaTransientMappingTests.java | 249 - .../context/java/JavaVersionMappingTests.java | 400 - .../context/java/JptCoreContextJavaModelTests.java | 59 - .../internal/context/orm/EntityMappingsTests.java | 1066 -- .../orm/GenericOrmPersistentAttributeTests.java | 314 - .../context/orm/GenericOrmPersistentTypeTests.java | 574 - .../context/orm/JptCoreOrmContextModelTests.java | 62 - .../context/orm/OrmAssociationOverrideTests.java | 267 - .../context/orm/OrmAttributeOverrideTests.java | 99 - .../internal/context/orm/OrmBasicMappingTests.java | 711 -- .../internal/context/orm/OrmCascadeTests.java | 280 - .../tests/internal/context/orm/OrmColumnTests.java | 835 -- .../context/orm/OrmDiscriminatorColumnTests.java | 456 - .../internal/context/orm/OrmEmbeddableTests.java | 295 - .../context/orm/OrmEmbeddedIdMappingTests.java | 923 -- .../context/orm/OrmEmbeddedMappingTests.java | 943 -- .../tests/internal/context/orm/OrmEntityTests.java | 2790 ----- .../context/orm/OrmGeneratedValueTests.java | 136 - .../internal/context/orm/OrmIdMappingTests.java | 746 -- .../internal/context/orm/OrmJoinColumnTests.java | 506 - .../internal/context/orm/OrmJoinTableTests.java | 1365 -- .../context/orm/OrmManyToManyMappingTests.java | 1065 -- .../context/orm/OrmManyToOneMappingTests.java | 618 - .../context/orm/OrmMappedSuperclassTests.java | 386 - .../context/orm/OrmNamedNativeQueryTests.java | 358 - .../internal/context/orm/OrmNamedQueryTests.java | 273 - .../context/orm/OrmOneToManyMappingTests.java | 1058 -- .../context/orm/OrmOneToOneMappingTests.java | 1196 -- .../context/orm/OrmPrimaryKeyJoinColumnTests.java | 253 - .../internal/context/orm/OrmQueryHintTests.java | 122 - .../context/orm/OrmSecondaryTableTests.java | 767 -- .../context/orm/OrmSequenceGeneratorTests.java | 172 - .../context/orm/OrmTableGeneratorTests.java | 604 - .../tests/internal/context/orm/OrmTableTests.java | 827 -- .../context/orm/OrmTransientMappingTests.java | 305 - .../context/orm/OrmVersionMappingTests.java | 489 - .../tests/internal/context/orm/OrmXmlTests.java | 69 - .../context/orm/PersistenceUnitDefaultsTests.java | 369 - .../context/orm/PersistenceUnitMetadataTests.java | 104 - .../context/persistence/ClassRefTests.java | 113 - .../JptCorePersistenceContextModelTests.java | 33 - .../context/persistence/MappingFileRefTests.java | 98 - .../context/persistence/PersistenceTests.java | 134 - .../persistence/PersistenceUnitTestCase.java | 361 - .../context/persistence/PersistenceUnitTests.java | 1247 -- .../context/persistence/PersistenceXmlTests.java | 56 - .../context/persistence/RootContextNodeTests.java | 53 - .../context/Generic2_0ContextModelTestCase.java | 35 - .../java/Generic2_0JavaContextModelTests.java | 41 - .../GenericJavaAssociationOverride2_0Tests.java | 580 - .../context/java/GenericJavaCascade2_0Tests.java | 106 - .../java/GenericJavaCollectionTable2_0Tests.java | 722 -- ...enericJavaElementCollectionMapping2_0Tests.java | 2077 --- .../java/GenericJavaEmbeddedMapping2_0Tests.java | 1550 --- .../context/java/GenericJavaEntity2_0Tests.java | 2069 --- .../java/GenericJavaManyToManyMapping2_0Tests.java | 1218 -- .../java/GenericJavaManyToOneMapping2_0Tests.java | 419 - .../java/GenericJavaOneToManyMapping2_0Tests.java | 1526 --- .../java/GenericJavaOneToOneMapping2_0Tests.java | 884 -- .../GenericJavaPersistentAttribute2_0Tests.java | 162 - .../java/GenericJavaPersistentType2_0Tests.java | 853 -- .../java/GenericJavaSequenceGenerator2_0Tests.java | 200 - .../orm/Generic2_0OrmContextModelTests.java | 41 - .../orm/GenericOrmAssociationOverride2_0Tests.java | 534 - .../context/orm/GenericOrmCascade2_0Tests.java | 89 - .../orm/GenericOrmCollectionTable2_0Tests.java | 753 -- ...GenericOrmElementCollectionMapping2_0Tests.java | 1459 --- .../orm/GenericOrmEmbeddedMapping2_0Tests.java | 1734 --- .../jpa2/context/orm/GenericOrmEntity2_0Tests.java | 1972 --- .../orm/GenericOrmManyToManyMapping2_0Tests.java | 939 -- .../orm/GenericOrmManyToOneMapping2_0Tests.java | 674 - .../orm/GenericOrmOneToManyMapping2_0Tests.java | 1230 -- .../orm/GenericOrmOneToOneMapping2_0Tests.java | 991 -- .../orm/GenericOrmPersistentAttribute2_0Tests.java | 550 - .../orm/GenericOrmPersistentType2_0Tests.java | 283 - .../orm/GenericOrmSequenceGenerator2_0Tests.java | 91 - .../persistence/Generic2_0ConnectionTests.java | 186 - .../persistence/Generic2_0OptionsTests.java | 520 - .../Generic2_0PersistenceContextModelTests.java | 30 - .../Generic2_0PersistenceUnitTests.java | 58 - .../resource/java/Access2_0AnnotationTests.java | 175 - .../resource/java/AssociationOverride2_0Tests.java | 885 -- .../java/AssociationOverrides2_0Tests.java | 988 -- .../resource/java/Cacheable2_0AnnotationTests.java | 106 - .../java/CollectionTable2_0AnnotationTests.java | 498 - .../java/ElementCollection2_0AnnotationTests.java | 169 - .../jpa2/resource/java/JavaResource2_0Tests.java | 48 - .../java/JavaResourceModel2_0TestCase.java | 29 - .../java/ManyToMany2_0AnnotationTests.java | 409 - .../resource/java/ManyToOne2_0AnnotationTests.java | 402 - .../java/MapKeyClass2_0AnnotationTests.java | 108 - .../java/MapKeyColumn2_0AnnotationTests.java | 404 - .../java/MapKeyEnumerated2_0AnnotationTests.java | 90 - .../java/MapKeyJoinColumn2_0AnnotationTests.java | 352 - .../java/MapKeyJoinColumns2_0AnnotationTests.java | 420 - .../java/MapKeyTemporal2_0AnnotationTests.java | 89 - .../resource/java/MapsId2_0AnnotationTests.java | 86 - .../resource/java/OneToMany2_0AnnotationTests.java | 412 - .../resource/java/OneToOne2_0AnnotationTests.java | 462 - .../java/OrderColumn2_0AnnotationTests.java | 252 - .../java/SequenceGenerator2_0AnnotationTests.java | 123 - .../internal/model/JpaProjectManagerTests.java | 262 - .../tests/internal/model/JptJpaCoreModelTests.java | 28 - .../internal/platform/BaseJpaPlatformTests.java | 77 - .../platform/JpaPlatformExtensionTests.java | 96 - .../tests/internal/platform/JpaPlatformTests.java | 129 - .../tests/internal/projects/TestJpaProject.java | 128 - .../resource/JptJpaCoreResourceModelTests.java | 42 - .../resource/java/AssociationOverrideTests.java | 253 - .../resource/java/AssociationOverridesTests.java | 320 - .../resource/java/AttributeOverrideTests.java | 157 - .../resource/java/AttributeOverridesTests.java | 274 - .../tests/internal/resource/java/BasicTests.java | 151 - .../tests/internal/resource/java/ColumnTests.java | 404 - .../resource/java/DiscriminatorColumnTests.java | 212 - .../resource/java/DiscriminatorValueTests.java | 83 - .../internal/resource/java/EmbeddableTests.java | 74 - .../internal/resource/java/EmbeddedIdTests.java | 50 - .../internal/resource/java/EmbeddedTests.java | 50 - .../tests/internal/resource/java/EntityTests.java | 125 - .../internal/resource/java/EnumeratedTests.java | 89 - .../resource/java/GeneratedValueTests.java | 133 - .../tests/internal/resource/java/IdClassTests.java | 103 - .../core/tests/internal/resource/java/IdTests.java | 50 - .../internal/resource/java/InheritanceTests.java | 83 - .../internal/resource/java/JPTToolsTests.java | 479 - .../resource/java/JavaResourceModelTestCase.java | 164 - .../java/JavaResourcePersistentAttributeTests.java | 870 -- .../java/JavaResourcePersistentTypeTests.java | 937 -- .../internal/resource/java/JoinColumnTests.java | 352 - .../internal/resource/java/JoinColumnsTests.java | 420 - .../internal/resource/java/JoinTableTests.java | 656 - .../java/JpaJavaResourceModelTestCase.java | 48 - .../resource/java/JptJavaResourceTests.java | 75 - .../tests/internal/resource/java/LobTests.java | 49 - .../internal/resource/java/ManyToManyTests.java | 394 - .../internal/resource/java/ManyToOneTests.java | 387 - .../tests/internal/resource/java/MapKeyTests.java | 88 - .../resource/java/MappedSuperclassTests.java | 74 - .../resource/java/NamedNativeQueriesTests.java | 421 - .../resource/java/NamedNativeQueryTests.java | 341 - .../internal/resource/java/NamedQueriesTests.java | 331 - .../internal/resource/java/NamedQueryTests.java | 259 - .../internal/resource/java/OneToManyTests.java | 397 - .../internal/resource/java/OneToOneTests.java | 447 - .../tests/internal/resource/java/OrderByTests.java | 87 - .../resource/java/PrimaryKeyJoinColumnTests.java | 187 - .../resource/java/PrimaryKeyJoinColumnsTests.java | 252 - .../internal/resource/java/QueryHintTests.java | 65 - .../resource/java/SecondaryTableTests.java | 436 - .../resource/java/SecondaryTablesTests.java | 503 - .../resource/java/SequenceGeneratorTests.java | 234 - .../resource/java/TableGeneratorTests.java | 501 - .../tests/internal/resource/java/TableTests.java | 346 - .../internal/resource/java/TemporalTests.java | 88 - .../internal/resource/java/TransientTests.java | 50 - .../tests/internal/resource/java/VersionTests.java | 49 - jpa/tests/org.eclipse.jpt.jpa.core.tests/test.xml | 35 - jpa/tests/org.eclipse.jpt.jpa.db.tests/.classpath | 11 - jpa/tests/org.eclipse.jpt.jpa.db.tests/.cvsignore | 1 - jpa/tests/org.eclipse.jpt.jpa.db.tests/.project | 28 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../META-INF/MANIFEST.MF | 19 - jpa/tests/org.eclipse.jpt.jpa.db.tests/about.html | 34 - .../org.eclipse.jpt.jpa.db.tests/build.properties | 14 - .../config/derby.properties | 24 - .../config/mysql.properties | 23 - .../config/oracle10g.properties | 24 - .../config/oracle10gXE.properties | 24 - .../config/oracle9i.properties | 24 - .../config/postgresql.properties | 23 - .../config/sqlserver.properties | 24 - .../config/sybase.properties | 24 - .../org.eclipse.jpt.jpa.db.tests/plugin.properties | 24 - .../jpt/jpa/db/tests/internal/JDBCTests.java | 135 - .../jpt/jpa/db/tests/internal/JDBCTools.java | 105 - .../jpt/jpa/db/tests/internal/JptJpaDbTests.java | 34 - .../jpa/db/tests/internal/JptJpaDbTestsPlugin.java | 56 - .../tests/internal/platforms/AllPlatformTests.java | 37 - .../tests/internal/platforms/DTPPlatformTests.java | 1027 -- .../db/tests/internal/platforms/DerbyTests.java | 482 - .../db/tests/internal/platforms/MySQLTests.java | 404 - .../tests/internal/platforms/Oracle10gTests.java | 397 - .../tests/internal/platforms/Oracle10gXETests.java | 79 - .../db/tests/internal/platforms/Oracle9iTests.java | 79 - .../tests/internal/platforms/PostgreSQLTests.java | 486 - .../tests/internal/platforms/SQLServerTests.java | 83 - .../db/tests/internal/platforms/SybaseTests.java | 443 - .../.classpath | 13 - .../.cvsignore | 5 - .../.project | 28 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../META-INF/MANIFEST.MF | 46 - .../about.html | 34 - .../build.properties | 18 - .../plugin.properties | 23 - .../tests/internal/JptJpaEclipseLinkCoreTests.java | 93 - .../context/EclipseLinkContextModelTestCase.java | 50 - .../context/EclipseLinkJpaProjectTests.java | 149 - .../JptEclipseLink1_0CoreContextModelTests.java | 34 - .../JptJpaEclipseLinkCoreContextModelTests.java | 45 - .../java/EclipseLinkJavaBasicMappingTests.java | 322 - .../context/java/EclipseLinkJavaCachingTests.java | 646 - .../context/java/EclipseLinkJavaConvertTests.java | 224 - .../java/EclipseLinkJavaConverterTests.java | 222 - .../java/EclipseLinkJavaEmbeddableTests.java | 253 - .../context/java/EclipseLinkJavaEntityTests.java | 387 - .../java/EclipseLinkJavaIdMappingTests.java | 323 - .../EclipseLinkJavaManyToManyMappingTests.java | 149 - .../java/EclipseLinkJavaManyToOneMappingTests.java | 148 - .../java/EclipseLinkJavaMappedSuperclassTests.java | 348 - .../EclipseLinkJavaObjectTypeConverterTests.java | 644 - .../java/EclipseLinkJavaOneToManyMappingTests.java | 579 - .../java/EclipseLinkJavaOneToOneMappingTests.java | 448 - .../java/EclipseLinkJavaStructConverterTests.java | 221 - .../java/EclipseLinkJavaTypeConverterTests.java | 313 - .../java/EclipseLinkJavaVersionMappingTests.java | 322 - .../JptEclipseLinkCoreJavaContextModelTests.java | 43 - .../orm/EclipseLinkEntityMappingsTests.java | 675 - .../orm/EclipseLinkOrmBasicMappingTests.java | 389 - .../orm/EclipseLinkOrmContextModelTestCase.java | 84 - .../context/orm/EclipseLinkOrmConverterTests.java | 194 - .../context/orm/EclipseLinkOrmEmbeddableTests.java | 1035 -- .../context/orm/EclipseLinkOrmEntityTests.java | 2394 ---- .../context/orm/EclipseLinkOrmIdMappingTests.java | 389 - .../orm/EclipseLinkOrmManyToManyMappingTests.java | 383 - .../orm/EclipseLinkOrmManyToOneMappingTests.java | 321 - .../orm/EclipseLinkOrmMappedSuperclassTests.java | 2147 ---- .../EclipseLinkOrmObjectTypeConverterTests.java | 569 - .../orm/EclipseLinkOrmOneToManyMappingTests.java | 747 -- .../orm/EclipseLinkOrmOneToOneMappingTests.java | 455 - .../EclipseLinkOrmPersistentAttributeTests.java | 313 - .../orm/EclipseLinkOrmStructConverterTests.java | 199 - .../orm/EclipseLinkOrmTransientMappingTests.java | 62 - .../orm/EclipseLinkOrmTypeConverterTests.java | 266 - .../orm/EclipseLinkOrmVersionMappingTests.java | 387 - .../EclipseLinkPersistenceUnitDefaultsTests.java | 369 - .../EclipseLinkPersistenceUnitMetadataTests.java | 105 - .../JptEclipseLinkCoreOrmContextModelTests.java | 47 - .../EclipseLinkPersistenceUnitTestCase.java | 53 - .../EclipseLinkPersistenceUnitTests.java | 178 - ...clipseLinkCorePersistenceContextModelTests.java | 43 - .../persistence/caching/CachingAdapterTests.java | 449 - .../caching/CachingValueModelTests.java | 444 - .../JptEclipseLinkPersistenceCachingTests.java | 33 - .../connection/EclipseLinkConnectionTests.java | 542 - .../JptEclipseLinkPersistenceConnectionTests.java | 33 - .../CustomizationValueModelTests.java | 204 - .../EclipseLinkCustomizationTests.java | 761 -- ...ptEclipseLinkPersistenceCustomizationTests.java | 33 - .../general/GeneralPropertiesAdapterTests.java | 105 - .../general/GeneralPropertiesValueModelTests.java | 162 - .../JptEclipseLinkPersistenceGeneralTests.java | 33 - .../JptEclipseLinkPersistenceLoggingTests.java | 33 - .../persistence/logging/LoggingAdapterTests.java | 339 - .../logging/LoggingValueModelTests.java | 162 - .../JptEclipseLinkPersistenceOptionsTests.java | 33 - .../persistence/options/OptionsAdapterTests.java | 379 - .../options/OptionsValueModelTests.java | 161 - ...clipseLinkPersistenceSchemaGenerationTests.java | 35 - .../generation/SchemaGenerationAdapterTests.java | 254 - .../SchemaGenerationBasicAdapterTests.java | 153 - .../SchemaGenerationValueModelTests.java | 232 - .../JptJpaEclipselinkCoreResourceModelTests.java | 41 - .../tests/internal/resource/java/CacheTests.java | 448 - .../resource/java/ChangeTrackingTests.java | 88 - .../java/ConversionValueAnnotationTests.java | 131 - .../resource/java/ConvertAnnotationTests.java | 105 - .../resource/java/ConverterAnnotationTests.java | 155 - .../resource/java/CustomizerAnnotationTests.java | 99 - .../java/EclipseLinkJavaResourceModelTestCase.java | 34 - .../java/EclipseLinkPrimaryKeyAnnotationTests.java | 53 - .../resource/java/ExistenceCheckingTests.java | 88 - .../internal/resource/java/JoinFetchTests.java | 92 - .../JptEclipseLinkCoreJavaResourceModelTests.java | 47 - .../resource/java/MutableAnnotationTests.java | 111 - .../java/ObjectTypeConverterAnnotationTests.java | 426 - .../internal/resource/java/PrivateOwnedTests.java | 49 - .../internal/resource/java/ReadOnlyTests.java | 47 - .../java/ReadTransformerAnnotationTests.java | 155 - .../java/StructConverterAnnotationTests.java | 155 - .../internal/resource/java/TimeOfDayTests.java | 220 - .../java/TransformationAnnotationTests.java | 158 - .../java/TypeConverterAnnotationTests.java | 214 - .../java/WriteTransformerAnnotationTests.java | 219 - .../EclipseLink1_1ContextModelTestCase.java | 33 - .../context/EclipseLink1_1JpaProjectTests.java | 173 - .../JptEclipseLink1_1CoreContextModelTests.java | 31 - .../orm/EclipseLink1_1OrmContextModelTestCase.java | 92 - .../EclipseLink1_1OrmPersistentAttributeTests.java | 430 - .../orm/EclipseLink1_1OrmPersistentTypeTests.java | 302 - .../EclipseLink1_1OrmTransientMappingTests.java | 64 - .../JptEclipseLink1_1CoreOrmContextModelTests.java | 33 - .../EclipseLink1_2ContextModelTestCase.java | 34 - .../context/EclipseLink1_2JpaProjectTests.java | 173 - .../JptEclipseLink1_2CoreContextModelTests.java | 30 - .../EclipseLink2_0ContextModelTestCase.java | 35 - .../JptEclipseLink2_0CoreContextModelTests.java | 38 - .../EclipseLink2_0JavaCollectionTableTests.java | 724 -- ...seLink2_0JavaElementCollectionMappingTests.java | 2077 --- .../java/EclipseLink2_0JavaEntityTests.java | 1813 --- .../EclipseLink2_0JavaManyToManyMappingTests.java | 1303 -- .../EclipseLink2_0JavaManyToOneMappingTests.java | 330 - .../EclipseLink2_0JavaMappedSuperclassTests.java | 528 - .../EclipseLink2_0JavaOneToManyMappingTests.java | 1422 --- .../EclipseLink2_0JavaOneToOneMappingTests.java | 818 -- .../JptEclipseLink2_0JavaContextModelTests.java | 35 - .../orm/EclipseLink2_0OrmCollectionTableTests.java | 752 -- .../orm/EclipseLink2_0OrmContextModelTestCase.java | 92 - ...pseLink2_0OrmElementCollectionMappingTests.java | 1446 --- .../context/orm/EclipseLink2_0OrmEntityTests.java | 1806 --- .../EclipseLink2_0OrmManyToManyMappingTests.java | 963 -- .../EclipseLink2_0OrmMappedSuperclassTests.java | 2375 ---- .../EclipseLink2_0OrmOneToManyMappingTests.java | 1076 -- .../orm/EclipseLink2_0OrmOneToOneMappingTests.java | 910 -- .../Eclipselink2_0OrmManyToOneMappingTests.java | 589 - .../orm/JptEclipseLink2_0OrmContextModelTests.java | 35 - .../persistence/EclipseLink2_0ConnectionTests.java | 172 - .../persistence/EclipseLink2_0LoggingTests.java | 430 - .../persistence/EclipseLink2_0OptionsTests.java | 518 - .../EclipseLink2_0PersistenceUnitTestCase.java | 57 - ...pseLink2_0CorePersistenceContextModelTests.java | 34 - .../test.xml | 49 - jpa/tests/org.eclipse.jpt.jpa.gen.tests/.classpath | 11 - jpa/tests/org.eclipse.jpt.jpa.gen.tests/.project | 28 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../META-INF/MANIFEST.MF | 14 - jpa/tests/org.eclipse.jpt.jpa.gen.tests/about.html | 34 - .../org.eclipse.jpt.jpa.gen.tests/build.properties | 18 - .../plugin.properties | 23 - .../gen/tests/internal/EntityGenToolsTests.java | 143 - .../jpt/jpa/gen/tests/internal/JptJpaGenTests.java | 32 - jpa/tests/org.eclipse.jpt.jpa.gen.tests/test.xml | 49 - jpa/tests/org.eclipse.jpt.jpa.ui.tests/.classpath | 13 - jpa/tests/org.eclipse.jpt.jpa.ui.tests/.project | 28 - .../.settings/org.eclipse.core.resources.prefs | 3 - .../.settings/org.eclipse.jdt.core.prefs | 7 - .../META-INF/MANIFEST.MF | 23 - .../org.eclipse.jpt.jpa.ui.tests/build.properties | 13 - .../org.eclipse.jpt.jpa.ui.tests/plugin.properties | 23 - .../org/eclipse/jpt/jpa/ui/tests/JptUiTests.java | 32 - .../platform/JpaPlatformUiExtensionTests.java | 65 - .../internal/platform/JptUiPlatformTests.java | 27 - jpa/tests/org.eclipse.jpt.ui.tests/.project | 5 - jpa/tests/org.eclipse.jpt.utility.tests/.project | 5 - 5471 files changed, 880915 deletions(-) delete mode 100644 assembly/features/org.eclipse.jpt.assembly.feature/.cvsignore delete mode 100644 assembly/features/org.eclipse.jpt.assembly.feature/.project delete mode 100644 assembly/features/org.eclipse.jpt.assembly.feature/build.properties delete mode 100644 assembly/features/org.eclipse.jpt.assembly.feature/eclipse_update_120.jpg delete mode 100644 assembly/features/org.eclipse.jpt.assembly.feature/epl-v10.html delete mode 100644 assembly/features/org.eclipse.jpt.assembly.feature/feature.properties delete mode 100644 assembly/features/org.eclipse.jpt.assembly.feature/feature.xml delete mode 100644 assembly/features/org.eclipse.jpt.assembly.feature/license.html delete mode 100644 assembly/features/org.eclipse.jpt.patch/.project delete mode 100644 assembly/features/org.eclipse.jpt.patch/build.properties delete mode 100644 assembly/features/org.eclipse.jpt.patch/buildnotes_org.eclipse.jpt.patch.html delete mode 100644 assembly/features/org.eclipse.jpt.patch/eclipse_update_120.jpg delete mode 100644 assembly/features/org.eclipse.jpt.patch/epl-v10.html delete mode 100644 assembly/features/org.eclipse.jpt.patch/feature.properties delete mode 100644 assembly/features/org.eclipse.jpt.patch/feature.xml delete mode 100644 assembly/features/org.eclipse.jpt.patch/license.html delete mode 100644 assembly/features/org.eclipse.jpt.sdk/.cvsignore delete mode 100644 assembly/features/org.eclipse.jpt.sdk/.project delete mode 100644 assembly/features/org.eclipse.jpt.sdk/build.properties delete mode 100644 assembly/features/org.eclipse.jpt.sdk/eclipse_update_120.jpg delete mode 100644 assembly/features/org.eclipse.jpt.sdk/epl-v10.html delete mode 100644 assembly/features/org.eclipse.jpt.sdk/feature.properties delete mode 100644 assembly/features/org.eclipse.jpt.sdk/feature.xml delete mode 100644 assembly/features/org.eclipse.jpt.sdk/license.html delete mode 100644 assembly/features/org.eclipse.jpt.tests.assembly.feature/.cvsignore delete mode 100644 assembly/features/org.eclipse.jpt.tests.assembly.feature/.project delete mode 100644 assembly/features/org.eclipse.jpt.tests.assembly.feature/.settings/org.eclipse.core.resources.prefs delete mode 100644 assembly/features/org.eclipse.jpt.tests.assembly.feature/build.properties delete mode 100644 assembly/features/org.eclipse.jpt.tests.assembly.feature/eclipse_update_120.jpg delete mode 100644 assembly/features/org.eclipse.jpt.tests.assembly.feature/epl-v10.html delete mode 100644 assembly/features/org.eclipse.jpt.tests.assembly.feature/feature.properties delete mode 100644 assembly/features/org.eclipse.jpt.tests.assembly.feature/feature.xml delete mode 100644 assembly/features/org.eclipse.jpt.tests.assembly.feature/license.html delete mode 100644 assembly/features/org.eclipse.jpt.tests/.cvsignore delete mode 100644 assembly/features/org.eclipse.jpt.tests/.project delete mode 100644 assembly/features/org.eclipse.jpt.tests/.settings/org.eclipse.core.resources.prefs delete mode 100644 assembly/features/org.eclipse.jpt.tests/build.properties delete mode 100644 assembly/features/org.eclipse.jpt.tests/eclipse_update_120.jpg delete mode 100644 assembly/features/org.eclipse.jpt.tests/epl-v10.html delete mode 100644 assembly/features/org.eclipse.jpt.tests/feature.properties delete mode 100644 assembly/features/org.eclipse.jpt.tests/feature.xml delete mode 100644 assembly/features/org.eclipse.jpt.tests/license.html delete mode 100644 assembly/features/org.eclipse.jpt/.cvsignore delete mode 100644 assembly/features/org.eclipse.jpt/.project delete mode 100644 assembly/features/org.eclipse.jpt/build.properties delete mode 100644 assembly/features/org.eclipse.jpt/eclipse_update_120.jpg delete mode 100644 assembly/features/org.eclipse.jpt/epl-v10.html delete mode 100644 assembly/features/org.eclipse.jpt/feature.properties delete mode 100644 assembly/features/org.eclipse.jpt/feature.xml delete mode 100644 assembly/features/org.eclipse.jpt/license.html delete mode 100644 assembly/features/org.eclipse.jpt_sdk.assembly.feature/.cvsignore delete mode 100644 assembly/features/org.eclipse.jpt_sdk.assembly.feature/.project delete mode 100644 assembly/features/org.eclipse.jpt_sdk.assembly.feature/build.properties delete mode 100644 assembly/features/org.eclipse.jpt_sdk.assembly.feature/eclipse_update_120.jpg delete mode 100644 assembly/features/org.eclipse.jpt_sdk.assembly.feature/epl-v10.html delete mode 100644 assembly/features/org.eclipse.jpt_sdk.assembly.feature/feature.properties delete mode 100644 assembly/features/org.eclipse.jpt_sdk.assembly.feature/feature.xml delete mode 100644 assembly/features/org.eclipse.jpt_sdk.assembly.feature/license.html delete mode 100644 assembly/plugins/org.eclipse.jpt/.cvsignore delete mode 100644 assembly/plugins/org.eclipse.jpt/.project delete mode 100644 assembly/plugins/org.eclipse.jpt/.settings/org.eclipse.core.resources.prefs delete mode 100644 assembly/plugins/org.eclipse.jpt/META-INF/MANIFEST.MF delete mode 100644 assembly/plugins/org.eclipse.jpt/about.html delete mode 100644 assembly/plugins/org.eclipse.jpt/about.ini delete mode 100644 assembly/plugins/org.eclipse.jpt/about.mappings delete mode 100644 assembly/plugins/org.eclipse.jpt/about.properties delete mode 100644 assembly/plugins/org.eclipse.jpt/build.properties delete mode 100644 assembly/plugins/org.eclipse.jpt/component.xml delete mode 100644 assembly/plugins/org.eclipse.jpt/eclipse32.gif delete mode 100644 assembly/plugins/org.eclipse.jpt/eclipse32.png delete mode 100644 assembly/plugins/org.eclipse.jpt/plugin.properties delete mode 100644 common/plugins/org.eclipse.jpt.common.core/.classpath delete mode 100644 common/plugins/org.eclipse.jpt.common.core/.project delete mode 100644 common/plugins/org.eclipse.jpt.common.core/.settings/org.eclipse.jdt.core.prefs delete mode 100644 common/plugins/org.eclipse.jpt.common.core/META-INF/MANIFEST.MF delete mode 100644 common/plugins/org.eclipse.jpt.common.core/about.html delete mode 100644 common/plugins/org.eclipse.jpt.common.core/build.properties delete mode 100644 common/plugins/org.eclipse.jpt.common.core/plugin.properties delete mode 100644 common/plugins/org.eclipse.jpt.common.core/plugin.xml delete mode 100644 common/plugins/org.eclipse.jpt.common.core/property_files/jpt_common_core.properties delete mode 100644 common/plugins/org.eclipse.jpt.common.core/schema/libraryValidators.exsd delete mode 100644 common/plugins/org.eclipse.jpt.common.core/schema/resourceLocators.exsd delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/IResourcePart.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptCommonCorePlugin.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceModelListener.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceType.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptCommonCoreMessages.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/ResourceAdapterFactory.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/XPointUtil.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptOsgiBundlesLibraryProviderInstallOperationConfig.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptUserLibraryProviderInstallOperationConfig.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/LibraryProviderPropertyTester.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibValUtil.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorConfig.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorManager.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/AbstractJptFileCreationDataModelProvider.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/JptFileCreationDataModelProperties.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ModuleResourceLocator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/PluginResourceLocator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ResourceLocatorConfig.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ResourceLocatorManager.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleJavaResourceLocator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/WebModuleResourceLocator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/CallbackJobSynchronizer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JobCommand.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JobSynchronizer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/PlatformTools.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/SimpleSchedulingRule.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/SimpleTextRange.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ASTNodeTextRange.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ASTTools.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractAnnotationAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractDeclarationAnnotationAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractExpressionConverter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractJDTType.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractNestedDeclarationAnnotationAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AnnotatedElementAnnotationElementAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AnnotationStringArrayExpressionConverter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/BooleanExpressionConverter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/CharacterStringExpressionConverter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/CombinationIndexedDeclarationAnnotationAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ConversionDeclarationAnnotationElementAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/DefaultAnnotationEditFormatter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ElementAnnotationAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ElementIndexedAnnotationAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/EnumArrayDeclarationAnnotationElementAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/EnumDeclarationAnnotationElementAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ExpressionDeclarationAnnotationElementAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/GenericVisitor.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTAnnotatedElement.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTEnum.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTEnumConstant.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTFieldAttribute.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTMember.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTMethodAttribute.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTModifiedDeclaration.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTPackage.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTTools.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTType.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JPTTools.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NameStringExpressionConverter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NestedDeclarationAnnotationAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NestedIndexedDeclarationAnnotationAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NullAnnotationEditFormatter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NullDeclarationAnnotationAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NullDeclarationAnnotationElementAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NullExpressionConverter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NumberIntegerExpressionConverter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/PrimitiveTypeStringExpressionConverter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ShortCircuitAnnotationElementAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ShortCircuitArrayAnnotationElementAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/SimpleDeclarationAnnotationAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/SimpleTypeStringExpressionConverter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/StringArrayExpressionConverter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/StringExpressionConverter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/TypeStringExpressionConverter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/BooleanTranslator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/EmptyTagBooleanTranslator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/EnumeratedValueTranslator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/SimpleRootTranslator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/SimpleTranslator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/libprov/JptLibraryProviderInstallOperationConfig.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/libval/LibraryValidator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/ResourceLocator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/AbstractTextRange.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/BodySourceWriter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/TextRange.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AbstractType.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotatedElement.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotatedPackage.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationEditFormatter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationElementAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Attribute.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/DeclarationAnnotationAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/DeclarationAnnotationElementAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Enum.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/EnumConstant.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/ExpressionConverter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/FieldAttribute.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedAnnotationAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedDeclarationAnnotationAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Member.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/MethodAttribute.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/ModifiedDeclaration.java delete mode 100644 common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Type.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/.classpath delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/.project delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/.settings/org.eclipse.jdt.core.prefs delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/META-INF/MANIFEST.MF delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/about.html delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/build.properties delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/plugin.properties delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/property_files/jpt_common_ui.properties delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/JptCommonUiPlugin.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/WidgetFactory.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/JptCommonUiMessages.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/Tracing.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemLabelProvider.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractTreeItemContentProvider.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ArchiveFileViewerFilter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/DelegatingTreeContentAndLabelProvider.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ImageImageDescriptor.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NullLabelProvider.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NullTreeContentProvider.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StructuredContentProviderAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTCollectionChangeListenerWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTListChangeListenerWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTPropertyChangeListenerWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTStateChangeListenerWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTTreeChangeListenerWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/properties/JptProjectPropertiesPage.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/AbstractComboModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/ColumnAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/ComboModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/DateTimeModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/SpinnerModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/TableItemModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/TableModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/TriStateCheckBoxModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/ControlAligner.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/ControlSwitcher.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/LabeledButton.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/LabeledControl.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/LabeledControlUpdater.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/LabeledLabel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/PaneEnabler.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/PaneVisibilityEnabler.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/StateController.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/TableLayoutComposite.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AsynchronousUiCommandExecutor.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/SynchronousUiCommandExecutor.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/AbstractListWidgetAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/BooleanButtonModelBinding.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/BooleanStateController.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/DropDownListBoxSelectionBinding.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/ListBoxSelectionBinding.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/ListWidgetModelBinding.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/MultiControlBooleanStateController.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SWTComboAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SWTListAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SWTTools.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SimpleBooleanStateController.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/TextFieldModelBinding.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemoveListPane.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemovePane.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemoveTablePane.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ChooserPane.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserComboPane.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserPane.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ComboPane.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/DefaultWidgetFactory.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Dialog.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/DialogPane.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/EnumComboViewer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/EnumDialogComboViewer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/EnumFormComboViewer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FileChooserComboPane.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FileChooserPane.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FolderChooserComboPane.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FolderChooserPane.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FormWidgetFactory.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/NewNameDialog.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/NewNameDialogBuilder.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/NewNameStateObject.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/NullPostExecution.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PackageChooserPane.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Pane.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PostExecution.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PropertySheetWidgetFactory.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/TriStateCheckBox.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ValidatingDialog.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/DelegatingContentAndLabelProvider.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemContentProvider.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemContentProviderFactory.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemLabelProvider.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemLabelProviderFactory.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/TreeItemContentProvider.java delete mode 100644 common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/TreeItemContentProviderFactory.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/.classpath delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/.cvsignore delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/.project delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/.settings/org.eclipse.core.resources.prefs delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/.settings/org.eclipse.jdt.core.prefs delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/META-INF/MANIFEST.MF delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/about.html delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/build.properties delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/component.xml delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/plugin.properties delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Command.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/CommandExecutor.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Filter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/IndentingPrintWriter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/JavaType.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/MethodSignature.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ObjectReference.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ReadOnlyObjectReference.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AbstractAssociation.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ArrayTools.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Association.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AsynchronousCommandExecutor.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Bag.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiFilter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiStringConverter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiTransformer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BitTools.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanReference.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanTools.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ClassName.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Classpath.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CollectionTools.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CommandRunnable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CompositeCommand.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CompositeException.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ConsumerThreadCoordinator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ExceptionHandler.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/FileTools.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/FlaggedObjectReference.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/HashBag.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/IdentityHashBag.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/IntReference.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/JDBCTools.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/JDBCType.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/KeyedSet.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/LazyReadOnlyObjectReference.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ListenerList.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NameTools.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NonNullBooleanTransformer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NotBooleanTransformer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NotNullFilter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NullList.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Queue.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Range.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReadOnlyBooleanReference.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReadOnlyIntReference.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReflectionTools.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReverseComparator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/RunnableCommand.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleAssociation.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleBooleanReference.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleCommandExecutor.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleFilter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleIntReference.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleJavaType.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleMethodSignature.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleObjectReference.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleQueue.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleStack.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleStringMatcher.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleThreadFactory.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Stack.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StatefulCommandExecutor.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringConverter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringMatcher.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringTools.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedBag.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedBoolean.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedInt.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedObject.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedQueue.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedStack.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommand.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommandExecutor.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Tools.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Transformer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/XMLStringEncoder.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/enumerations/EmptyEnumeration.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/enumerations/IteratorEnumeration.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ArrayIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ArrayListIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ChainIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneListIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeListIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyListIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/FilteringIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/GraphIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ListIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ListListIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneListIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/PeekableIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/QueueIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyCompositeListIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyListIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementListIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneListIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/StackIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubIterableWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubListIterableWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperIterableWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperListIterableWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationListIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TreeIterable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ArrayIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ArrayListIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ChainIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CloneIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CloneListIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CompositeIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CompositeListIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/EmptyIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/EmptyListIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/EnumerationIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/FilteringIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/GraphIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/PeekableIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/QueueIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReadOnlyCompositeListIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReadOnlyIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReadOnlyListIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ResultSetIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReverseIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SingleElementIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SingleElementListIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/StackIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubIteratorWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubListIteratorWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperIteratorWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperListIteratorWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SynchronizedIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SynchronizedListIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/TransformationIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/TransformationListIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/TreeIterator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/AbstractModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/AspectChangeSupport.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/ChangeSupport.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/SingleAspectChangeSupport.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTChangeListenerWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTCollectionChangeListenerWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTListChangeListenerWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTPropertyChangeListenerWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTStateChangeListenerWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTTreeChangeListenerWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractCollectionValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractListValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractPropertyValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractPropertyValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractTreeNodeValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectCollectionValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectListValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectPropertyValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectTreeValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedWritablePropertyValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CachingTransformationPropertyValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CachingTransformationWritablePropertyValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ChangePropertyValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionAspectAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionListValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionPropertyValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionValueModelWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeBooleanPropertyValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeCollectionValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeListValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositePropertyValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ExtendedListValueModelWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringCollectionValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringPropertyValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringWritablePropertyValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemAspectListValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemChangeListValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemCollectionListValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemListListValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemPropertyListValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemStateListValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemTreeListValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListAspectAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCollectionValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCurator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListPropertyValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListValueModelWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullCollectionValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullListValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullPropertyValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullTreeValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyAspectAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyCollectionValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyListValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyValueModelWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ReadOnlyWritablePropertyValueModelWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SetCollectionValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SimpleCollectionValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SimpleListValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SimplePropertyValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SortedListValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SortedListValueModelWrapper.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StatePropertyValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticCollectionValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticListValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticPropertyValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticTreeValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationListValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationPropertyValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationWritablePropertyValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TreeAspectAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TreePropertyValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueAspectAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueChangeAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueCollectionAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueListAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValuePropertyAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueStateAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueTreeAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/WritablePropertyCollectionValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/WritablePropertyListValueModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/prefs/PreferencePropertyValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/prefs/PreferencesCollectionValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/AbstractTreeModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/CheckBoxModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ColumnAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ComboBoxModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/DateSpinnerModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/DocumentAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ListModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ListSpinnerModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/NumberSpinnerModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ObjectListSelectionModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/PrimitiveListTreeModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/RadioButtonModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/SpinnerModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/TableModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ToggleButtonModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/TreeModelAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/AbstractNode.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/AsynchronousValidator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/DefaultProblem.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/Node.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/PluggableValidator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/Problem.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/SynchronousValidator.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/CachingComboBoxModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/CheckBoxTableCellRenderer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/ComboBoxTableCellRenderer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/Displayable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/EmptyIcon.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/FilteringListBrowser.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/FilteringListPanel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/ListChooser.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/NodeSelector.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/NonCachingComboBoxModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SimpleDisplayable.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SimpleListBrowser.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SimpleListCellRenderer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SpinnerTableCellRenderer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/TableCellEditorAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/AsynchronousSynchronizer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/CallbackAsynchronousSynchronizer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/CallbackSynchronousSynchronizer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/SynchronousSynchronizer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/Model.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ChangeEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionAddEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionChangeEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionClearEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionRemoveEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListAddEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListChangeEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListClearEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListMoveEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListRemoveEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListReplaceEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/PropertyChangeEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/StateChangeEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeAddEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeChangeEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeClearEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeRemoveEvent.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ChangeAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ChangeListener.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CollectionChangeAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CollectionChangeListener.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CommandChangeListener.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ListChangeAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ListChangeListener.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/MultiMethodReflectiveChangeListener.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/PropertyChangeAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/PropertyChangeListener.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ReflectiveChangeListener.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/SimpleChangeListener.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/SingleMethodReflectiveChangeListener.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/StateChangeAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/StateChangeListener.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/TreeChangeAdapter.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/TreeChangeListener.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/CollectionValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/ListValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/PropertyValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/TreeNodeValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/TreeValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/WritableCollectionValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/WritableListValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/WritablePropertyValueModel.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/synchronizers/CallbackSynchronizer.java delete mode 100644 common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/synchronizers/Synchronizer.java delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/.classpath delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/.project delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/.settings/org.eclipse.jdt.core.prefs delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/META-INF/MANIFEST.MF delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/about.html delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/build.properties delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/plugin.properties delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/JptCommonCoreTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/projects/TestFacetedProject.java delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/projects/TestJavaProject.java delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/projects/TestPlatformProject.java delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/ASTToolsTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/AnnotationTestCase.java delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/CombinationIndexedDeclarationAnnotationAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/DefaultAnnotationEditFormatterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/JptCommonCoreUtilityJdtTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/MemberAnnotationElementAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/MiscTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/NestedDeclarationAnnotationAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/NestedIndexedDeclarationAnnotationAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/SimpleDeclarationAnnotationAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/TypeTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.core.tests/test.xml delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/.classpath delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/.project delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/.settings/org.eclipse.jdt.core.prefs delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/META-INF/MANIFEST.MF delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/build.properties delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/plugin.properties delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/JptCommonUiTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/jface/DelegatingLabelProviderUiTest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/jface/DelegatingTreeContentProviderUiTest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/AbstractComboModelAdapterTest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/ComboModelAdapterTest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/JptUiSWTTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/SpinnerModelAdapterTest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/TableModelAdapterTest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/TriStateCheckBoxModelAdapterUITest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlAlignerTest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlEnablerTest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlSwitcherTest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlVisibilityEnablerTest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/JptUiUtilTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledButtonTest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledControlUpdaterTest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledLabelTest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/PaneEnablerTest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/PaneVisibilityEnablerTest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/BooleanStateControllerUITest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/CheckBoxModelBindingUITest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/DropDownListBoxModelBindingUITest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/ListBoxModelBindingUITest.java delete mode 100644 common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/TextFieldModelBindingUITest.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/.classpath delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/.cvsignore delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/.project delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/.settings/org.eclipse.core.resources.prefs delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/.settings/org.eclipse.jdt.core.prefs delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/META-INF/MANIFEST.MF delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/about.html delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/build.properties delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/plugin.properties delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/resource/ClassTools.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ArrayToolsTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/AsynchronousCommandExecutorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BagTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BidiFilterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BidiStringConverterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BidiTransformerTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BitToolsTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BooleanToolsTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ClassNameTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ClasspathTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CollectionToolsTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CommandExecutorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CommandRunnableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CommandTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CompositeCommandTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ExceptionHandlerTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/FileToolsTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/FilterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/HashBagTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/IdentityHashBagTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/IndentingPrintWriterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/JDBCTypeTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/JavaTypeTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/JptCommonUtilityTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/KeyedSetTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ListenerListTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/MethodSignatureTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/MultiThreadedTestCase.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/NameToolsTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/NotNullFilterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/RangeTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ReflectionToolsTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ReverseComparatorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleAssociationTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleBooleanReferenceTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleIntReferenceTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleObjectReferenceTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleQueueTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleStackTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/StringToolsTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedBooleanTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedIntTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedObjectTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedQueueTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedStackTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/TestTools.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ToolsTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/XMLStringEncoderTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/enumerations/EmptyEnumerationTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/enumerations/IteratorEnumerationTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/enumerations/JptUtilityEnumerationsTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ArrayIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ArrayListIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ChainIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/CloneIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/CompositeIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/CompositeListIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/EmptyIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/EmptyListIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/FilteringIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/GraphIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/JptUtilityIterablesTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/LiveCloneIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/LiveCloneListIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/PeekableIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/QueueIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ReadOnlyCompositeListIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ReadOnlyIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ReadOnlyListIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SingleElementIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SingleElementListIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SnapshotCloneIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SnapshotCloneListIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/StackIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SuperIterableWrapperTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/TransformationIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/TransformationListIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/TreeIterableTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ArrayIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ArrayListIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ChainIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/CloneIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/CloneListIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/CompositeIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/CompositeListIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/EmptyIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/EmptyListIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/EnumerationIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/FilteringIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/GraphIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/JptUtilityIteratorsTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/PeekableIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ReadOnlyCompositeListIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ReadOnlyIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ReadOnlyListIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SingleElementIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SingleElementListIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SuperIteratorWrapperTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SynchronizedIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SynchronizedListIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/TransformationIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/TransformationListIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/TreeIteratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/ChangeSupportTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/JptUtilityModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/NewEventTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/SingleAspectChangeSupportTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/JptUtilityModelListenerTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectiveCollectionChangeListenerTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectiveListChangeListenerTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectivePropertyChangeListenerTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectiveStateChangeListenerTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectiveTreeChangeListenerTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/BufferedWritablePropertyValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CachingTransformationPropertyValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CachingTransformationWritablePropertyValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CollectionAspectAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CollectionListValueModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CollectionPropertyValueModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositeBooleanPropertyValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositeCollectionValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositeListValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositePropertyValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CoordinatedBag.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CoordinatedList.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ExtendedListValueModelWrapperTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/FilteringCollectionValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/FilteringPropertyValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ItemCollectionListValueModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ItemListListValueModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ItemPropertyListValueModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ItemStateListValueModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/JptUtilityModelValueTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ListAspectAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ListCollectionValueModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ListCuratorTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/NullCollectionValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/NullListValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/NullPropertyValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyAspectAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyCollectionValueModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyListValueModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ReadOnlyWritablePropertyValueModelWrapperTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SetCollectionValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SimpleCollectionValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SimpleListValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SimplePropertyValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SortedListValueModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SortedListValueModelWrapperTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/StaticCollectionValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/StaticListValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/StaticValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationListValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationPropertyValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TreeAspectAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ValueCollectionAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ValueListAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ValuePropertyAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ValueStateAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/prefs/JptUtilityModelValuePrefsTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/prefs/PreferencePropertyValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/prefs/PreferencesCollectionValueModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/prefs/PreferencesTestCase.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/CheckBoxModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/CheckBoxModelAdapterUITest.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ComboBoxModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest2.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/DateSpinnerModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/DocumentAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/DocumentAdapterUITest.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/JptUtilityModelValueSwingTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ListModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ListModelAdapterUITest.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ListSpinnerModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/NumberSpinnerModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ObjectListSelectionModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/PrimitiveListTreeModelTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/RadioButtonModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/RadioButtonModelAdapterUITest.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ReadOnlyTableModelAdapterUITest.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/SpinnerModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/SpinnerModelAdapterUITest.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/TableModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/TableModelAdapterUITest.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/TreeModelAdapterTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/TreeModelAdapterUITest.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/node/AbstractNodeTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/node/JptUtilityNodeTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/AsynchronousSynchronizerTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/JptUtilitySynchronizersTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/SynchronizerTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/SynchronousSynchronizerTests.java delete mode 100644 common/tests/org.eclipse.jpt.common.utility.tests/test.xml delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/.project delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/build.properties delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/eclipse_update_120.jpg delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/epl-v10.html delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/feature.properties delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/feature.xml delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/license.html delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/about.html delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/about.ini delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/about.mappings delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/about.properties delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/build.properties delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/eclipse32.gif delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/eclipse32.png delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/eclipse_update_120.jpg delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/epl-v10.html delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/license.html delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/plugin.properties delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/build.properties delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/eclipse_update_120.jpg delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/epl-v10.html delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/feature.properties delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/license.html delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/about.html delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/about.ini delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/about.mappings delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/about.properties delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/build.properties delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/eclipse32.gif delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/eclipse32.png delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/eclipse_update_120.jpg delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/epl-v10.html delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/license.html delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/plugin.properties delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/.cvsignore delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/.project delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/build.properties delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/eclipse_update_120.jpg delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/epl-v10.html delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/feature.properties delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/feature.xml delete mode 100644 jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/license.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/.project delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/build.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/eclipse_update_120.jpg delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/epl-v10.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/feature.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/feature.xml delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/license.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/about.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/about.ini delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/about.mappings delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/about.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/build.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/eclipse32.gif delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/eclipse32.png delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/eclipse_update_120.jpg delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/epl-v10.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/license.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/plugin.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/build.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/eclipse_update_120.jpg delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/epl-v10.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/feature.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/license.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/about.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/about.ini delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/about.mappings delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/about.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/build.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/eclipse32.gif delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/eclipse32.png delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/eclipse_update_120.jpg delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/epl-v10.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/license.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/plugin.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/.cvsignore delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/.project delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/build.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/eclipse_update_120.jpg delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/epl-v10.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/feature.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/feature.xml delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/license.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/.project delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/build.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/eclipse_update_120.jpg delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/epl-v10.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/feature.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/feature.xml delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/license.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/about.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/about.ini delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/about.mappings delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/about.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/build.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/eclipse32.gif delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/eclipse32.png delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/eclipse_update_120.jpg delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/epl-v10.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/license.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/plugin.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/build.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/eclipse_update_120.jpg delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/epl-v10.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/feature.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/license.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/about.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/about.ini delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/about.mappings delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/about.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/build.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/eclipse32.gif delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/eclipse32.png delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/eclipse_update_120.jpg delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/epl-v10.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/license.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/plugin.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.tests.feature/.cvsignore delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.tests.feature/.project delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.tests.feature/build.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.tests.feature/eclipse_update_120.jpg delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.tests.feature/epl-v10.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.tests.feature/feature.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.tests.feature/feature.xml delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb.tests.feature/license.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/.cvsignore delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/.project delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/build.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/eclipse_update_120.jpg delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/epl-v10.html delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/feature.properties delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/feature.xml delete mode 100644 jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/license.html delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/.cvsignore delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/.project delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/META-INF/MANIFEST.MF delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.html delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.ini delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.mappings delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/build.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/icons/WTP_icon_x32_v2.png delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/plugin.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.classpath delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.cvsignore delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.project delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/META-INF/MANIFEST.MF delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/about.html delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/build.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/plugin.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/Main.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/JptDbwsCoreMessages.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/Tools.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/jpt_dbws_core.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.branding/.cvsignore delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.branding/.project delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.branding/META-INF/MANIFEST.MF delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.html delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.ini delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.mappings delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.branding/build.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.branding/component.xml delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.branding/icons/WTP_icon_x32_v2.png delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.branding/plugin.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.classpath delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.cvsignore delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.project delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/META-INF/MANIFEST.MF delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/about.html delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/build.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/plugin.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/Main.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/JptJaxbCoreMessages.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/Tools.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/jpt_jaxb_core.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/.classpath delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/.cvsignore delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/.project delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/about.html delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/build.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/component.xml delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jaxb_validation.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jpt_jaxb_core.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/schema/jaxbPlatforms.exsd delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/AnnotationProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbPlatform.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbProjectManager.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFacet.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFactory.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFile.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbNode.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbProject.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbProjectManager.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbResourceModelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/MappingKeys.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/SchemaLibrary.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbAttributeMapping.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContainmentMapping.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContextNode.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContextRoot.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbElementFactoryMethod.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbEnumConstant.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPackage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPackageInfo.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentAttribute.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentClass.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentEnum.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentField.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentProperty.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentType.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbRegistry.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbType.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAccessOrder.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAccessOrderHolder.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAccessType.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAccessTypeHolder.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAdaptable.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAttributeMapping.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementMapping.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementWrapper.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlJavaTypeAdapter.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlList.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlNs.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlNsForm.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlRootElement.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlSchema.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlSchemaType.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlValueMapping.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/java/DefaultJavaAttributeMappingDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/java/JavaAttributeMappingDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/java/JavaContextNode.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbFactory.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbNode.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbPlatformDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbProject.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/GenericAnnotationProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/GenericJaxbFile.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/GenericJaxbProject.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaPackageInfoResourceModelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaResourceModelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JptJaxbCoreMessages.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SchemaLibraryImpl.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SimpleJaxbProjectConfig.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/AbstractJaxbContextNode.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/GenericContextRoot.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/GenericPackage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAttributeMapping.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAttributeMappingDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaContextNode.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaPersistentType.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaType.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaXmlJavaTypeAdapter.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapter.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaContainmentMapping.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaContainmentMappingXmlSchemaType.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaElementFactoryMethod.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaEnumConstant.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaNullAttributeMapping.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageInfo.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageXmlJavaTypeAdapter.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageXmlSchemaType.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentAttribute.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentClass.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentEnum.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentField.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentProperty.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaRegistry.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaTypeXmlJavaTypeAdapter.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAdaptable.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAttributeMapping.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementMapping.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementWrapper.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlList.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlNs.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlRootElement.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlSchema.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlSchemaType.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlTransientMapping.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlValueMapping.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/JavaXmlAttributeMappingDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/JavaXmlElementMappingDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/JavaXmlTransientMappingDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/JavaXmlValueMappingDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProperties.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDelegate.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDataModelProperties.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDataModelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDelegate.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetUninstallDelegate.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDataModelProperties.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDataModelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDelegate.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGenerator.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGeneratorExtensionOptions.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGeneratorOptions.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/GenerateJaxbClassesJob.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/SchemaGenerator.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_Factory.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_PlatformDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_PlatformDefinitionFactory.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb22/GenericJaxb_2_2_PlatformDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb22/GenericJaxb_2_2_PlatformDefinitionFactory.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbJreLibraryProviderInstallOperationConfig.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbOsgiBundlesLibraryProviderInstallOperationConfig.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbUserLibraryProviderInstallOperationConfig.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericJaxbUserLibraryValidator.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbJreLibraryValidator.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbLibValUtil.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/operations/SchemaFileCreationDataModelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformDescriptionImpl.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformGroupDescriptionImpl.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformImpl.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformManagerImpl.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorOrderAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorTypeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlElementDeclAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumValueAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlSchemaAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlTypeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAccessorOrderAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAccessorTypeAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyAttributeAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyElementAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttachmentRefAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttributeAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementDeclAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementRefAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementWrapperAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementsAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumValueAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDREFAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlInlineBinaryDataAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlJavaTypeAdapterAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlListAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMimeTypeAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMixedAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlRegistryAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlRootElementAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSchemaAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSchemaTypeAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSeeAlsoAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlTransientAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlTypeAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlValueAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryNode.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorOrderAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorTypeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyAttributeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyElementAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttachmentRefAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttributeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementDeclAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementWrapperAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementsAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumValueAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDREFAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlInlineBinaryDataAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlJavaTypeAdapterAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlListAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMimeTypeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMixedAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRegistryAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRootElementAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSeeAlsoAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTransientAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTypeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlValueAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/AbstractJavaResourceNode.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAbstractType.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotatedElement.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAttribute.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceCompilationUnit.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceEnum.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceEnumConstant.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceField.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMember.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMethod.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceNode.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourcePackage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceType.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceTypeCompilationUnit.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorOrderAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorTypeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyAttributeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyElementAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttachmentRefAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttributeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementDeclAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementWrapperAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementsAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumValueAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDREFAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlInlineBinaryDataAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlJavaTypeAdapterAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlListAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMimeTypeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMixedAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlNsAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRegistryAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRootElementAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaTypeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSeeAlsoAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTransientAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTypeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlValueAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/DefaultValidationMessages.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidationMessages.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidator.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/libprov/JaxbLibraryProviderInstallOperationConfig.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatform.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDefinitionFactory.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDescription.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformGroupDescription.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformManager.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/AbstractJavaResourceType.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/Annotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/AnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JAXB.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceAnnotatedElement.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceAttribute.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceClassFile.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceCompilationUnit.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceEnum.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceEnumConstant.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceField.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceMember.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceMethod.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceNode.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourcePackage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourcePackageFragment.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourcePackageFragmentRoot.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourcePackageInfoCompilationUnit.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceType.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JaxbContainmentAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/NestableAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/NestableAnnotationDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessOrder.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessType.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessorOrderAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessorTypeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAnyAttributeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAnyElementAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAttachmentRefAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAttributeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementDeclAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementRefAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementWrapperAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementsAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumValueAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlIDAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlIDREFAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlInlineBinaryDataAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlJavaTypeAdapterAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlListAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMimeTypeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMixedAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlNsAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlNsForm.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlRegistryAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlRootElementAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlSchemaAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlSchemaTypeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlSeeAlsoAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlTransientAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlTypeAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlValueAnnotation.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdAdapter.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdComplexTypeDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdElementDeclaration.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdSchema.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdSimpleTypeDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdTypeDefinition.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdUtil.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/.cvsignore delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/.project delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/META-INF/MANIFEST.MF delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.html delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.ini delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.mappings delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/build.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/icons/WTP_icon_x32_v2.png delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/plugin.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.classpath delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.cvsignore delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.project delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/META-INF/MANIFEST.MF delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/about.html delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/build.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/lib/eclipselink-src.zip delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/lib/eclipselink.jar delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/plugin.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/Main.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/JptEclipseLinkJaxbCoreMessages.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/Tools.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/jpt_eclipselink_jaxb_core.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/.classpath delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/.cvsignore delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/.project delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/about.html delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/build.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/component.xml delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/NewXSD.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/jaxb_facet.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/new_jaxb_project_wiz.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/newclass_wiz.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/XSDFile.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/dtdfile.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/enum_constant.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/jaxb_content.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/null-attribute-mapping.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/package.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_class.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_enum.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_field.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_property.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/text.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-attribute.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-element.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-transient.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-value.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/ovr16/error_ovr.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/NewXSD.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/new_jaxb_prj_wiz.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/newclass_wiz.gif delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/schema/jaxbPlatformUis.exsd delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbMappingImageHelper.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiIcons.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/GenerateClassesAction.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/ObjectAction.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/ContainerFilter.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/EmptyInnerPackageFilter.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonArchiveOrExternalElementFilter.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonContainerFilter.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonJavaElementFilter.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorUi.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_PlatformUi.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbContextRootItemContentProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbContextRootItemLabelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbEnumConstantItemLabelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemContentProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemLabelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentAttributeItemLabelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemContentProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemContentProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemLabelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentFieldItemLabelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentPropertyItemLabelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbRegistryItemContentProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTypeItemLabelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb22/GenericJaxb_2_2_PlatformUi.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentAndLabelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorItemLabelProviderFactory.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorLabelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorTreeItemContentProviderFactory.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiConfig.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiManagerImpl.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/JavaProjectWizardPage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/ProjectWizardPage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorOptionsWizardPage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SchemaWizardPage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectFileOrXMLCatalogIdPanel.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectSingleFileViewFacade.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectXMLCatalogIdPanel.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/XMLCatalogTableViewer.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetInstallPage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetVersionChangePage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizard.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizardFirstPage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/model/JaxbProjectCreationDataModelProvider.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/AbstractJarDestinationWizardPage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/CheckboxTreeAndListGroup.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/NewSchemaFileWizardPage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/navigator/JaxbNavigatorUi.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUi.java delete mode 100644 jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUiManager.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/.classpath delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/.project delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/about.html delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/build.properties delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/plugin.properties delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/JptJaxbCoreTestsPlugin.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbTestCase.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/SchemaLibraryTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/GenericContextRootTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/JaxbContextModelTestCase.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/JaxbCoreContextModelTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapterTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaElementFactoryMethodTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaEnumConstantTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageInfoTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageXmlJavaTypeAdapterTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentClassTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentEnumTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaRegistryTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaTypeXmlJavaTypeAdapterTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAttributeMappingTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementMappingTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlRootElementTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlSchemaTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlSchemaTypeTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlValueMappingTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/JaxbCoreJavaContextModelTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/projects/TestJaxbProject.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/JaxbCoreResourceModelTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JavaResourceModelTestCase.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTestCase.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorOrderPackageAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorOrderTypeAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorTypePackageAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorTypeTypeAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyAttributeAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyElementAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttachmentRefAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttributeAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementDeclAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementRefAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementWrapperAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumValueAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDREFAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlInlineBinaryDataAttributeAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlInlineBinaryDataTypeAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlJavaTypeAdapterPackageAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlJavaTypeAdapterTypeAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlListAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMimeTypeAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMixedAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlRegistryAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlRootElementAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaTypeAttributeAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaTypePackageAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSeeAlsoAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTransientAttributeAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTransientTypeAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTypeAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlValueAnnotationTests.java delete mode 100644 jaxb/tests/org.eclipse.jpt.jaxb.core.tests/test.xml delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/.cvsignore delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/.project delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/build.properties delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/feature.properties delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/feature.xml delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/license.html delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.html delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.ini delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.mappings delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.properties delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/build.properties delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse32.gif delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse32.png delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/license.html delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/plugin.properties delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/build.properties delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/feature.properties delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/license.html delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.html delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.ini delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.mappings delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.properties delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/build.properties delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse32.gif delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse32.png delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/license.html delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/plugin.properties delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.cvsignore delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.project delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/build.properties delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/feature.properties delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/feature.xml delete mode 100644 jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/license.html delete mode 100644 jpa/features/org.eclipse.jpt.feature/.cvsignore delete mode 100644 jpa/features/org.eclipse.jpt.feature/.project delete mode 100644 jpa/features/org.eclipse.jpt.feature/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/features/org.eclipse.jpt.feature/build.properties delete mode 100644 jpa/features/org.eclipse.jpt.feature/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt.feature/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt.feature/feature.properties delete mode 100644 jpa/features/org.eclipse.jpt.feature/feature.xml delete mode 100644 jpa/features/org.eclipse.jpt.feature/license.html delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.html delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.ini delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.mappings delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.properties delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/build.properties delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse32.gif delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse32.png delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/license.html delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/plugin.properties delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/build.properties delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/feature.properties delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/license.html delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.html delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.ini delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.mappings delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.properties delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/build.properties delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse32.gif delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse32.png delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/license.html delete mode 100644 jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/plugin.properties delete mode 100644 jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/.cvsignore delete mode 100644 jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/.project delete mode 100644 jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/build.properties delete mode 100644 jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/feature.properties delete mode 100644 jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/feature.xml delete mode 100644 jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/license.html delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/.cvsignore delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/.project delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/build.properties delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/feature.properties delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/feature.xml delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/license.html delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/about.html delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/about.ini delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/about.mappings delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/about.properties delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/build.properties delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/eclipse32.gif delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/eclipse32.png delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/license.html delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/plugin.properties delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/build.properties delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/feature.properties delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/license.html delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/about.html delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/about.ini delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/about.mappings delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/about.properties delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/build.properties delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/eclipse32.gif delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/eclipse32.png delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/license.html delete mode 100644 jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/plugin.properties delete mode 100644 jpa/features/org.eclipse.jpt.jpa_sdk.feature/.cvsignore delete mode 100644 jpa/features/org.eclipse.jpt.jpa_sdk.feature/.project delete mode 100644 jpa/features/org.eclipse.jpt.jpa_sdk.feature/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/features/org.eclipse.jpt.jpa_sdk.feature/build.properties delete mode 100644 jpa/features/org.eclipse.jpt.jpa_sdk.feature/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt.jpa_sdk.feature/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt.jpa_sdk.feature/feature.properties delete mode 100644 jpa/features/org.eclipse.jpt.jpa_sdk.feature/feature.xml delete mode 100644 jpa/features/org.eclipse.jpt.jpa_sdk.feature/license.html delete mode 100644 jpa/features/org.eclipse.jpt.tests.feature/.cvsignore delete mode 100644 jpa/features/org.eclipse.jpt.tests.feature/.project delete mode 100644 jpa/features/org.eclipse.jpt.tests.feature/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/features/org.eclipse.jpt.tests.feature/build.properties delete mode 100644 jpa/features/org.eclipse.jpt.tests.feature/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt.tests.feature/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt.tests.feature/feature.properties delete mode 100644 jpa/features/org.eclipse.jpt.tests.feature/feature.xml delete mode 100644 jpa/features/org.eclipse.jpt.tests.feature/license.html delete mode 100644 jpa/features/org.eclipse.jpt_sdk.feature/.cvsignore delete mode 100644 jpa/features/org.eclipse.jpt_sdk.feature/.project delete mode 100644 jpa/features/org.eclipse.jpt_sdk.feature/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/features/org.eclipse.jpt_sdk.feature/build.properties delete mode 100644 jpa/features/org.eclipse.jpt_sdk.feature/eclipse_update_120.jpg delete mode 100644 jpa/features/org.eclipse.jpt_sdk.feature/epl-v10.html delete mode 100644 jpa/features/org.eclipse.jpt_sdk.feature/feature.properties delete mode 100644 jpa/features/org.eclipse.jpt_sdk.feature/feature.xml delete mode 100644 jpa/features/org.eclipse.jpt_sdk.feature/license.html delete mode 100644 jpa/plugins/org.eclipse.jpt.branding/.cvsignore delete mode 100644 jpa/plugins/org.eclipse.jpt.branding/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.branding/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.branding/META-INF/MANIFEST.MF delete mode 100644 jpa/plugins/org.eclipse.jpt.branding/about.html delete mode 100644 jpa/plugins/org.eclipse.jpt.branding/about.ini delete mode 100644 jpa/plugins/org.eclipse.jpt.branding/about.mappings delete mode 100644 jpa/plugins/org.eclipse.jpt.branding/about.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.branding/build.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.branding/component.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.branding/icons/WTP_icon_x32_v2.png delete mode 100644 jpa/plugins/org.eclipse.jpt.branding/plugin.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.core/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.db.ui/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.db/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/META-INF/MANIFEST.MF delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/about.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/about.html delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/build.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/add_persistence.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/create_entity.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/map_entity.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/concept_mapping.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/concept_persistence.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/concepts.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/concepts001.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/concepts002.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/concepts003.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/contexts.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/dcommon/css/blafdoc.css delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/dcommon/html/cpyr.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/getting_started.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/getting_started001.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/getting_started002.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/getting_started003.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/getting_started004.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/address.java_jpa_details.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/address_id_details_quickstart.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/address_java_JPA_structure_quickstart.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/create_jpa_entity_wizard.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/create_jpa_fields.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/customize_default_entity_generation.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/customize_individual_entities.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/details_entitymappings.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/error_sample.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/generate_classes_from_schema.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/generate_entities.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/icon_basicmapmappings.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/icon_basicmapping.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_join.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_single.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_tab.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/java_editor_address.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/jaxb_schmea_generation_dialog.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/jpa_wizard_create_fields.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/mapped_entity_type_link.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_file_new.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_embed.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_entity.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_superclass.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/modify_faceted_project.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_basicmappings.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddableentitymapping.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddedidmapping.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddedmapping.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_idmapping.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_manytomanymapping.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_manytoonemapping.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_mappedentity.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_mappedsuperclass.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_onetomanymapping.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_onetoonemapping.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_transientmapping.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_versionmapping.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_facet_task.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_perspective_button.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_project_task.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelc.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelr.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelt.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/persistence_outline_view.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/project_properties_tasks.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/quickstart_project.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/secondary_tables.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_entity.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_jpa_project.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_mapping.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/select_jaxb_schema_wizard.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/select_tables.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/synchornize_classes.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/table_associations.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/table_entity.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/task_entering_query.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/img/upgrade_persistence_jpa_version.png delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/index.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/legal.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/plugin.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/plugin.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_EntityClassPage.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_EntityPropertiesPage.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_add_converter.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_association_cardinality.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_association_table.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_configure_jaxb_class_generation_dialog.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_create_custom_entities_wizard.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_create_jpa_entity_wizard.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_create_new_association_wizard.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_customizIndividualEntities.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_customizeDefaultEntityGeneration.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_details_orm.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_eclipselink_mapping_file.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_java_page.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_jaxb_schema_wizard.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_join_columns.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_jpa_facet.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_mapping_general.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_new_jpa_project.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_new_jpa_project_wizard.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_general.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_map_view.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_outline.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_perspective.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_prop_view.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_xmll_editor.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_primary_key.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_project_properties.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_schema_from_classes_page.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_selectTables.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_select_cascade_dialog.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/ref_tableAssociations.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference001.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference002.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference003.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference004.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference005.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference006.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference007.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference008.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference009.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference010.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference011.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference012.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference013.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference014.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference015.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference016.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference017.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference018.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference019.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference020.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference021.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference022.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference023.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference024.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference025.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference026.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference027.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference028.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference029.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference030.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference031.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference032.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/reference033.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/task_add_persistence.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/task_additonal_tables.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/task_create_jpa_entity.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/task_create_new_project.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/task_generate_classes_from_schema.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/task_generating_schema_from_classes.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/task_inheritance.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/task_manage_orm.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/task_manage_persistence.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/task_mapping.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks001.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks002.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks003.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks004.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks005.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks006.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks007.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks008.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks009.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks010.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks011.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks012.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks013.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks014.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks015.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks016.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks017.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks018.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks019.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks020.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks021.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks022.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks023.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks024.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks025.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tasks026.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/tips_and_tricks.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/toc.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/whats_new.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/whats_new001.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/whats_new002.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/whats_new003.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/whats_new004.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/whats_new005.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.doc.user/whats_new006.htm delete mode 100644 jpa/plugins/org.eclipse.jpt.eclipselink.branding/.cvsignore delete mode 100644 jpa/plugins/org.eclipse.jpt.eclipselink.branding/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.eclipselink.branding/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.eclipselink.branding/META-INF/MANIFEST.MF delete mode 100644 jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.html delete mode 100644 jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.ini delete mode 100644 jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.mappings delete mode 100644 jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.eclipselink.branding/build.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.eclipselink.branding/icons/WTP_icon_x32_v2.png delete mode 100644 jpa/plugins/org.eclipse.jpt.eclipselink.branding/plugin.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.eclipselink.core/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.eclipselink.jaxb.core.schemagen/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.eclipselink.ui/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.gen/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.jaxb.core.schemagen/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.jaxb.ui/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/.classpath delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/.cvsignore delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/about.html delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/build.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/component.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/model/DaliEmfFormatter.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/model/common.ecore delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/model/jpaResourceModels.genmodel delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/model/orm.ecore delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/model/persistence.ecore delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/plugin.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_core.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_core_refactoring.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_validation.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_validation_description.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/schema/jpaPlatforms.exsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/EntityGeneratorDatabaseAnnotationNameBuilder.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/GenericJpaProjectManager.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationDefinitionProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaDataSource.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFacet.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFile.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformVariation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProjectManager.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaResourceModelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaStructureNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCorePlugin.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/MappingKeys.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/ResourceDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AccessHolder.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AccessType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseEmbeddedMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BasicMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Cascade.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/CollectionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Column.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ColumnMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Converter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ConvertibleMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DiscriminatorColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DiscriminatorType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Embeddable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EmbeddedIdMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EmbeddedMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EnumType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EnumeratedConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchableMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GeneratedValue.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GenerationType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Generator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GeneratorContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdClassReference.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/InheritanceType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaContextNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaNamedContextNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaRootContextNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/LobConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToManyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToOneRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedSuperclass.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitDefaults.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitMetadata.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFileRoot.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MultiRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedNativeQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToManyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToOneRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OptionalMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Orderable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Override_.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentAttribute.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Query.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryHint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAccessHolder.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAssociationOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAttributeOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTableRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTableRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyNamedColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyOverrideRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPersistentAttribute.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPrimaryKeyJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyReferenceTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlySecondaryTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyUniqueConstraint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReferenceTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Relationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SecondaryTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SequenceGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SingleRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Table.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TableGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TemporalConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TemporalType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TransientMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TypeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/UniqueConstraint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VersionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualAssociationOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualAttributeOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualBaseColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualBaseJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTableRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTableRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualNamedColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualOverrideRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualPrimaryKeyJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualReferenceTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualSecondaryTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualUniqueConstraint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlContextNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/DefaultJavaAttributeMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JarFile.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseEmbeddedMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBasicMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaCascade.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaCollectionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaColumnMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConvertibleMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaDiscriminatorColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddedIdMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddedMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEntity.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratedValue.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratorContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdClassReference.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTableRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTableRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJpaContextNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToManyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToOneRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedByRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedByRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedSuperclass.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingJoinColumnRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingJoinTableRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMultiRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToManyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToOneRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOrderable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryHint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyAssociationOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyAttributeOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyUniqueConstraint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReferenceTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSecondaryTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSequenceGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSingleRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaStructureNodes.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTableGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTransientMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaUniqueConstraint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVersionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualAssociationOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualAttributeOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTableRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTableRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualOverrideRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualUniqueConstraint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/MappingFileDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/NullOrmAttributeMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseEmbeddedMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBasicMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmCascade.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmCollectionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmColumnMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConvertibleMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmDiscriminatorColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddedIdMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddedMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEntity.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEnumeratedConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGeneratedValue.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGeneratorContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdClassReference.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTableRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTableRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmLobConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToManyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToOneRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedByRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedByRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedSuperclass.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingJoinColumnRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingJoinTableRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMultiRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedNativeQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToManyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToOneRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOrderable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitDefaults.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitMetadata.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentAttribute.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryHint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyAssociationOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyAttributeOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyPersistentAttribute.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyUniqueConstraint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReferenceTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSecondaryTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSequenceGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSingleRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmStructureNodes.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTableGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTemporalConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTransientMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmUniqueConstraint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVersionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualAssociationOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualAttributeOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTableRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTableRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualOverrideRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualPrimaryKeyJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualSecondaryTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualUniqueConstraint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXml.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/UnsupportedOrmAttributeMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceStructureNodes.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnitProperties.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnitTransactionType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXml.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistentTypeContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaPlatformProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaPlatformTester.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaTester.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/OrmResourceModelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/PersistenceResourceModelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/ProjectAdapterFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/SimpleJpaProjectConfig.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractJpaContextNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractXmlContextNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AttributeMappingTools.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseColumnTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseJoinColumnTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/ContextContainerTools.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/EntityTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JoinColumnTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JptValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/NamedColumnTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/OverrideTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributeTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PrimaryKeyTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TableTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTools.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinTableRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappedSuperclass.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappingRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaReadOnlyUniqueConstraint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualBaseColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappedByRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBaseColumnTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaJoinColumnTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNamedColumnTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOverrideTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPersistentAttributeTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTableTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTypeMappingTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEmbeddable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinTableRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappingRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmReadOnlyUniqueConstraint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSequenceGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualBaseColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappedByRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/NullOrmJoinTableRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBasicMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddableDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmIdMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToManyMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToOneMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToManyMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToOneMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOverrideTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPersistentAttributeTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTableTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTransientMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmVersionMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnitProperties.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/FacetTools.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetActionDelegate.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProperties.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProperties.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFile.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaProject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractEntityPrimaryKeyValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractJoinTableValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractMappedSuperclassPrimaryKeyValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTableValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideColumnValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseColumnTableValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/DiscriminatorColumnValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EmbeddableOverrideDescriptionProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityPrimaryKeyJoinColumnValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityTableDescriptionProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericEntityPrimaryKeyValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericMappedSuperclassPrimaryKeyValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericPersistentAttributeValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/InverseJoinColumnValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinColumnValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyColumnValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MappedSuperclassOverrideDescriptionProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/NamedColumnValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OverrideValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTableValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/TableValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaBasicMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaCascade.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEntity.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaIdMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaLobConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryHint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTransientMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVersionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAssociationOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAttributeOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualUniqueConstraint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinTableRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericEntityMappings.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmCascade.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEntity.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmIdMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryHint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericJarFileRef.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericMappingFileRef.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/CollectionTableValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/OrderColumnValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/SimpleMetamodelField.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMappingDefinition2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaIdMappingDefinition2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToOneMappingDefinition2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToOneMappingDefinition2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaCacheable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaDerivedIdentity2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmIdDerivedIdentityStrategy2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmMapsIdDerivedIdentityStrategy2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOverrideJoinTableRelationshipStrategy2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmDerivedIdentity2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/NullOptions2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaOsgiBundlesLibraryProviderInstallOperationConfig.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaUserLibraryProviderInstallOperationConfig.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderDetector.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderUninstallOperation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/JpaFileCreationDataModelProperties.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProperties.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProperties.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationOperation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformGroupDescriptionImpl.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformManagerImpl.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferenceInitializer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaCoreRefactoringMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteTypeParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveTypeParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenamePackageParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameTypeParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/contenttypes/IndeterminateContentDescriber.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AbstractJavaResourceNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullDiscriminatorValueAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullEnumeratedAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullInheritanceAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullJoinTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullNamedColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullPrimaryKeyJoinColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullTemporalAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToManyAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OneToOneAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/OrderByAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/PrimaryKeyJoinColumnsAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTableAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SecondaryTablesAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/SequenceGeneratorAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TableGeneratorAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TemporalAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/TransientAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/VersionAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotatedElement.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverrideAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAssociationOverridesAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverrideAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryAttributeOverridesAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseEnumeratedAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseJoinColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBaseTemporalAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryBasicAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryClassFile.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryCompleteColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryContainerAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryDiscriminatorValueAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEmbeddedIdAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEntityAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryEnumeratedAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratedValueAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryGeneratorAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryIdClassAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryInheritanceAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinColumnsAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryJoinTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryLobAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToManyAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryManyToOneAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMapKeyAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryMappedSuperclassAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueriesAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedNativeQueryAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueriesAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNamedQueryAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToManyAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOneToOneAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOrderByAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryOverrideAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragment.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPackageFragmentRoot.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentAttribute.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentMember.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPersistentTypeCache.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryPrimaryKeyJoinColumnsAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryQueryHintAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryRelationshipMappingAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySecondaryTablesAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinarySequenceGeneratorAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTableGeneratorAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTemporalAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryTransientAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryUniqueConstraintAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/BinaryVersionAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/binary/RootBinaryNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/AnnotationContainerTools.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotatedElement.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverrideAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAssociationOverridesAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverrideAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceAttributeOverridesAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseEnumeratedAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseJoinColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBaseTemporalAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceBasicAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompilationUnit.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceCompleteColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceDiscriminatorValueAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEmbeddedIdAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEntityAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceEnumeratedAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratedValueAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceGeneratorAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceIdClassAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceInheritanceAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinColumnsAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceJoinTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceLobAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToManyAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceManyToOneAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMapKeyAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceMappedSuperclassAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueriesAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedNativeQueryAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueries1_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueriesAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNamedQueryAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToManyAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOneToOneAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOrderByAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceOverrideAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentAttribute.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentMember.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePersistentType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourcePrimaryKeyJoinColumnsAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceQueryHintAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceRelationshipMappingAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSecondaryTablesAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceSequenceGeneratorAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTableGeneratorAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTemporalAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTransientAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceTypeCompilationUnit.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceUniqueConstraintAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/source/SourceVersionAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/orm/OrmXmlResourceProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/persistence/PersistenceXmlResourceProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourceAdapterFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/xml/JpaXmlResourcePropertyTester.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/synch/SynchronizeClassesJob.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/DefaultJpaValidationMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaHelper.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationDescriptionMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidationPreferences.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/validation/JpaValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaFactory2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/JpaProject2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/MappingKeys2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/MetamodelSynchronizer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/AttributeMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/Cacheable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CacheableHolder2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/Cascade2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/CollectionTable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/DerivedIdentity2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/DerivedIdentityStrategy2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ElementCollectionMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/EmbeddedIdMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/EmbeddedMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/IdDerivedIdentityStrategy2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/IdMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/JpaRootContextNode2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/LockModeType2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ManyToManyMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ManyToOneMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ManyToOneRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MappedByRelationshipMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MappingFilePersistenceUnitDefaults2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MappingFilePersistenceUnitMetadata2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MapsIdDerivedIdentityStrategy2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MetamodelField.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/MetamodelSourceType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/NamedQuery2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToManyMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToManyRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToOneMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OneToOneRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OrderColumn2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/Orderable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OrphanRemovable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OrphanRemovalHolder2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/OverrideRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/PersistentAttribute2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/PersistentType2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ReadOnlyOverrideRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/ReadOnlyPersistentAttribute2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/SequenceGenerator2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/SingleRelationshipMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/VirtualOverrideRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCacheable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCacheableHolder2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCascade2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCollectionMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaCollectionTable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaDerivedIdentity2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaElementCollectionMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaEmbeddedMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaIdDerivedIdentityStrategy2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaManyToManyMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaManyToOneMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaManyToOneRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaMapsIdDerivedIdentityStrategy2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaNamedQuery2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToManyMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToManyRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToOneMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOneToOneRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrderColumn2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrderable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrphanRemovable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOrphanRemovalHolder2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaOverrideRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaPersistentAttribute2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaPersistentType2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaSequenceGenerator2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaSingleRelationshipMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/java/JavaVirtualOverrideRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCacheable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCacheableHolder2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCascade2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCollectionMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmCollectionTable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmDerivedIdentity2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmElementCollectionMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmEmbeddedMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmIdDerivedIdentityStrategy2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmManyToManyMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmManyToOneMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmManyToOneRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmMapsIdDerivedIdentityStrategy2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmNamedQuery2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToManyMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToManyRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToOneMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOneToOneRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrderColumn2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrderable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrphanRemovable2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOrphanRemovalHolder2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmOverrideRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistenceUnitDefaults2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistenceUnitMetadata2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistentAttribute2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmPersistentType2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmReadOnlyPersistentAttribute2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmSequenceGenerator2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmSingleRelationshipMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmVirtualOverrideRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/orm/OrmXml2_0ContextNodeFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/Persistence2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceUnit2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/PersistenceXml2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/connection/JpaConnection2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/options/JpaOptions2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/options/SharedCacheMode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/context/persistence/options/ValidationMode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Access2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/AssociationOverride2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/Cacheable2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/CollectionTable2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ElementCollection2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/GeneratedAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/JPA2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/JavaResourcePersistentType2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/LockModeType_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ManyToMany2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/ManyToOne2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyClass2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyColumn2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyEnumerated2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyJoinColumn2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyJoinColumns2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapKeyTemporal2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/MapsId2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/NamedQuery2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/NestableMapKeyJoinColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OneToMany2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OneToOne2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OrderColumn2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/OwningRelationshipMapping2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/RelationshipMapping2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/SequenceGenerator2_0Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/jpa2/resource/java/StaticMetamodelAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/libprov/JpaLibraryProviderInstallOperationConfig.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/GenericPlatform.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformDescription.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformGroupDescription.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/platform/JpaPlatformManager.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/AbstractXmlResourceProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProviderEvent.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/JpaXmlResourceProviderListener.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AccessType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/Annotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverrideAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AssociationOverridesAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AttributeOverrideAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/AttributeOverridesAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseJoinColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BaseTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/BasicAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/CascadeType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/CompleteColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ContainerAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/DiscriminatorValueAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EmbeddedIdAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EntityAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EnumType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/EnumeratedAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/FetchType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratedValueAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GenerationType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/GeneratorAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/IdClassAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/InheritanceAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/InheritanceType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JPA.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceAnnotatedElement.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceClassFile.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceCompilationUnit.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourceNode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragment.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageFragmentRoot.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePackageInfoCompilationUnit.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentAttribute.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentMember.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JavaResourcePersistentTypeCache.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinColumnsAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/JoinTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/LobAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ManyToManyAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ManyToOneAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MapKeyAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/MappedSuperclassAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedNativeQueriesAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedNativeQueryAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedQueriesAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NamedQueryAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAssociationOverrideAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableAttributeOverrideAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableJoinColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedNativeQueryAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableNamedQueryAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestablePrimaryKeyJoinColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableQueryHintAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableSecondaryTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/NestableUniqueConstraintAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OneToManyAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OneToOneAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OrderByAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OverrideAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/OwnableRelationshipMappingAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/PrimaryKeyJoinColumnsAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/QueryHintAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/ReferenceTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/RelationshipMappingAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SecondaryTablesAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SequenceGeneratorAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/SingleRelationshipMappingAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TableGeneratorAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TemporalAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TemporalType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/TransientAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/UniqueConstraintAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/java/VersionAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlAttributeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlEmbedded.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlMultiRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlNamedColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlReferenceTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlSingleRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AbstractXmlTypeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/AccessType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/Attributes.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/CascadeType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/ColumnMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/ColumnResult.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/DiscriminatorType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EntityListener.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EntityListeners.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EntityResult.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EnumType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/EventMethod.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/FetchType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/FieldResult.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/GenerationType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/Inheritance.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/InheritanceType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/JPA.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/Lob.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/MapKey.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmPackage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/OrmXmlResourceFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostLoad.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostPersist.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostRemove.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PostUpdate.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PrePersist.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PreRemove.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/PreUpdate.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/SqlResultSetMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/TemporalType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAccessHolder.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAssociationOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAssociationOverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAttributeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAttributeOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlAttributeOverrideContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlBasic.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlClassReference.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlCollectionTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlConvertibleMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlDiscriminatorColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlElementCollection.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEmbeddable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEmbedded.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEmbeddedId.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEntity.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEntityMappings.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlEventMethodContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlGeneratedValue.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlGeneratorContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlId.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlIdClassContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinColumnContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlJoinTableContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlManyToMany.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlManyToOne.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlMappedByMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlMappedSuperclass.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlNamedNativeQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlNamedQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlNullAttributeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOneToMany.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOneToOne.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOrderColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOrderable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlOverride.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPersistenceUnitDefaults.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPersistenceUnitMetadata.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPrimaryKeyJoinColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlPrimaryKeyJoinColumnContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlQueryContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlQueryHint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlReferenceTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlSecondaryTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlSequenceGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTableGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTransient.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlTypeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlUniqueConstraint.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/XmlVersion.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/JPA2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/LockModeType_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/OrmV2_0Factory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/OrmV2_0Package.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAssociationOverride_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAttributeMapping_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAttributeOverride_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlAttributes_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlCacheable_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlCascadeType_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlCollectionTable_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlDerivedId_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlElementCollection_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEmbedded_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEntityListener_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEntity_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlEventMethod_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlGenerator_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlManyToMany_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapKeyAttributeOverrideContainer_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapKeyClass_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMapsId_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlMultiRelationshipMapping_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlNamedQuery_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOneToMany_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOneToOne_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOrderColumn_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOrderable_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlOrphanRemovable_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlPersistenceUnitDefaults_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlPersistenceUnitMetadata_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlQueryHint_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlQuery_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlSequenceGenerator_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlSingleRelationshipMapping_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlSqlResultSetMapping_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/orm/v2_0/XmlUniqueConstraint_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/JPA.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistenceFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistencePackage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/PersistenceXmlResourceFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJarFileRef.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlJavaClassRef.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlMappingFileRef.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistence.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistenceUnit.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlPersistenceUnitTransactionType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlProperties.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/XmlProperty.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/JPA2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/PersistenceV2_0Factory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/PersistenceV2_0Package.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/XmlPersistenceUnitCachingType_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/XmlPersistenceUnitValidationModeType_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/persistence/v2_0/XmlPersistenceUnit_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/AbstractJpaEObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/AbstractJpaRootEObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/CommonFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/CommonPackage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/EmfTools.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaEObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaRootEObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/JpaXmlResource.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/resource/xml/XML.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db.ui/.classpath delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db.ui/.cvsignore delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db.ui/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db.ui/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db.ui/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db.ui/META-INF/MANIFEST.MF delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db.ui/about.html delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db.ui/build.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db.ui/component.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db.ui/plugin.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db.ui/src/org/eclipse/jpt/jpa/db/ui/internal/DTPUiTools.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/.classpath delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/.cvsignore delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/META-INF/MANIFEST.MF delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/about.html delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/build.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/component.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/plugin.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/Catalog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/Column.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/ConnectionAdapter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/ConnectionListener.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/ConnectionProfile.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/ConnectionProfileAdapter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/ConnectionProfileFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/ConnectionProfileListener.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/Database.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/DatabaseIdentifierAdapter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/DatabaseObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/ForeignKey.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/JptJpaDbPlugin.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/Schema.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/SchemaContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/Sequence.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/Table.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPCatalogWrapper.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPColumnWrapper.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPConnectionProfileFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPConnectionProfileWrapper.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPDatabaseObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPDatabaseObjectWrapper.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPDatabaseWrapper.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPForeignKeyWrapper.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPSchemaContainerWrapper.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPSchemaWrapper.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPSequenceWrapper.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/DTPTableWrapper.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/AbstractVendor.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/CatalogStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/DB2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/Derby.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/FauxCatalogStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/FoldingStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/HSQLDB.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/Informix.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/LowerCaseFoldingStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/MaxDB.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/MySQL.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/NoCatalogStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/NonFoldingStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/Oracle.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/PostgreSQL.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/SQLServer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/SimpleCatalogStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/Sybase.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/UnknownCatalogStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/UnrecognizedVendor.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/UpperCaseFoldingStrategy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/Vendor.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.db/src/org/eclipse/jpt/jpa/db/internal/vendor/VendorRepository.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/.classpath delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/.cvsignore delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/META-INF/MANIFEST.MF delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/about.html delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/build.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/lib/persistence.jar delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/plugin.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core.ddlgen/src/org/eclipse/jpt/jpa/eclipselink/core/ddlgen/Main.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/.classpath delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/.cvsignore delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/META-INF/MANIFEST.MF delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/about.html delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/build.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/model/eclipseLinkResourceModels.genmodel delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/model/eclipselink_orm.ecore delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/plugin.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/plugin.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/property_files/eclipselink_jpa_validation.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/property_files/jpt_eclipselink_core.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_orm_1_0.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_orm_1_1.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_orm_1_2.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_orm_2_0.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_orm_2_1.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_orm_2_2.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_oxm_2_0.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_oxm_2_1.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_oxm_2_2.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_persistence_map_1.0.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_persistence_map_1.1.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_persistence_map_1.2.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_persistence_map_2.0.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_sessions_1.0.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_sessions_1.1.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_sessions_1.2.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_sessions_2.0.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/schemas/eclipselink_sessions_2.1.xsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/EclipseLinkJpaProject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/EclipseLinkMappingKeys.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/JptJpaEclipseLinkCorePlugin.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkBasicCollectionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkBasicMapMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkBasicMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkCacheCoordinationType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkCacheType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkCaching.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkChangeTracking.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkChangeTrackingType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkConversionValue.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkConvert.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkConverterClassConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkCustomConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkCustomizer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkEmbeddable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkEntity.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkExistenceType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkIdMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkJoinFetch.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkJoinFetchMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkJoinFetchType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkMappedSuperclass.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkMutable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkNonEmbeddableTypeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkObjectTypeConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkOneToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkOneToManyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkOneToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkPrivateOwned.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkReadOnly.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkRelationshipMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkStructConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkTimeOfDay.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkTransformationMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkTypeConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkTypeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkVariableOneToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/EclipseLinkVersionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/EclipseLinkJavaOneToManyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/EclipseLinkJavaTypeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaEclipseLinkCaching.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaEclipseLinkConverterContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaEclipseLinkEmbeddable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaEclipseLinkEntity.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaEclipseLinkMappedSuperclass.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/java/JavaEclipseLinkNonEmbeddableTypeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/EclipseLinkEntityMappings.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/EclipseLinkOrmOneToManyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/EclipseLinkOrmTypeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmEclipseLinkCaching.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmEclipseLinkConverterContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmEclipseLinkEmbeddable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmEclipseLinkEntity.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmEclipseLinkMappedSuperclass.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/orm/OrmEclipseLinkNonEmbeddableTypeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/caching/CacheType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/caching/Caching.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/caching/FlushClearCache.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/connection/BatchWriting.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/connection/Connection.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/connection/ExclusiveConnectionMode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/customization/Customization.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/customization/Profiler.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/customization/Weaving.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/general/GeneralProperties.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/logging/Logger.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/logging/Logging.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/logging/LoggingLevel.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/options/Options.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/options/TargetDatabase.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/options/TargetServer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/schema/generation/DdlGenerationType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/schema/generation/OutputMode.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/context/persistence/schema/generation/SchemaGeneration.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/DefaultEclipseLinkJpaValidationMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaAnnotationDefinitionProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaPlatformProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaProjectImpl.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkJpaValidationMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/EclipseLinkOrmResourceModelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/JptEclipseLinkCoreMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaOneToManyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/EclipseLinkJavaTimeOfDay.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicCollectionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicCollectionMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkBasicMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkCachingImpl.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkChangeTracking.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConversionValue.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConvert.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkConverterContainerImpl.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkCustomConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkCustomizer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEmbeddableImpl.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkEntityImpl.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkIdMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkIdMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkJoinFetch.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkManyToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkManyToManyMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkManyToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkManyToOneMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMappedSuperclassImpl.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkMutable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkObjectTypeConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkOneToManyMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkOneToOneMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkPersistentAttribute.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkPrivateOwned.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkReadOnly.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkStructConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkTransformationMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkTransformationMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkTypeConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVariableOneToOneMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/java/JavaEclipseLinkVersionMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/AbstractEclipseLinkOrmXmlDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/AbstractOrmEclipseLinkBasicCollectionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/AbstractOrmEclipseLinkBasicMapMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkEntityMappingsImpl.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmOneToManyRelationship.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmTimeOfDay.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlContextNodeFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/EclipseLinkOrmXmlDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicCollectionMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkBasicMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCachingImpl.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkChangeTracking.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConversionValue.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConvert.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterClassConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkConverterContainerImpl.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkCustomizer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEmbeddableImpl.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkEntityImpl.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkIdMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkJoinFetch.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkManyToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMappedSuperclassImpl.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkMutable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkObjectTypeConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToManyMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkOneToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkPersistentAttribute.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkPrivateOwned.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkReadOnly.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkStructConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTransformationMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkTypeConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVariableOneToOneMappingDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/orm/OrmEclipseLinkVersionMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkJarFileRef.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnit.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceUnitProperties.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlContextNodeFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/EclipseLinkPersistenceXmlDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/caching/EclipseLinkCaching.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/caching/Entity.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/connection/EclipseLinkConnection.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/customization/EclipseLinkCustomization.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/customization/Entity.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/general/EclipseLinkGeneralProperties.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/logging/EclipseLinkLogging.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/options/EclipseLinkOptions.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/context/persistence/schema/generation/EclipseLinkSchemaGeneration.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/AbstractEclipseLinkDDLGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/ddlgen/EclipseLinkDDLGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/libval/EclipseLinkEclipseLinkBundlesLibraryValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/libval/EclipseLinkUserLibraryValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationDataModelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/operations/EclipseLinkOrmFileCreationOperation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkBasicCollectionAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkBasicMapAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkCacheAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkChangeTrackingAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkConvertAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkConverterAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkCustomizerAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkExistenceCheckingAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkJoinFetchAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkMutableAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkObjectTypeConverterAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkPrimaryKeyAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkPrivateOwnedAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkReadOnlyAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkReadTransformerAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkStructConverterAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTransformationAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkTypeConverterAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkVariableOneToOneAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/EclipseLinkWriteTransformerAnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkCacheAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkJoinFetchAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkTransformationAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/NullEclipseLinkWriteTransformerColumnAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryBaseEclipseLinkTypeConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkBasicCollectionAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkBasicMapAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkCacheAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkChangeTrackingAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkConversionValueAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkConvertAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkCustomizerAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkExistenceCheckingAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkJoinFetchAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkMutableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkNamedConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkObjectTypeConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkPrimaryKeyAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkPrivateOwnedAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkReadOnlyAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkReadTransformerAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkStructConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTimeOfDayAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTransformationAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTransformerAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkTypeConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkVariableOneToOneAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/binary/BinaryEclipseLinkWriteTransformerAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceBaseEclipseLinkTypeConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkBasicCollectionAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkBasicMapAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkCacheAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkChangeTrackingAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkConversionValueAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkConvertAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkCustomizerAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkExistenceCheckingAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkJoinFetchAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkMutableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkNamedConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkObjectTypeConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkPrimaryKeyAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkPrivateOwnedAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkReadOnlyAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkReadTransformerAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkStructConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTimeOfDayAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTransformationAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTransformerAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkTypeConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkVariableOneToOneAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/java/source/SourceEclipseLinkWriteTransformerAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/resource/orm/EclipseLinkOrmXmlResourceProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/EclipseLink1_1JpaPlatformFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/EclipseLink1_1JpaPlatformProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/AbstractEclipseLinkTypeMappingValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkEntityPrimaryKeyValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkMappedSuperclassPrimaryKeyValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkMappedSuperclassValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkPersistentAttributeValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/EclipseLinkTypeMappingValidator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/orm/EclipseLinkOrmXml1_1ContextNodeFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/orm/EclipseLinkOrmXml1_1Definition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_1/context/orm/OrmEclipseLinkPersistentAttribute1_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/EclipseLink1_2JpaAnnotationDefinitionProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/EclipseLink1_2JpaFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/EclipseLink1_2JpaPlatformFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/EclipseLink1_2JpaPlatformProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/context/java/EclipseLinkJavaPersistentType1_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v1_2/context/orm/EclipseLinkOrmXml1_2Definition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/AbstractEclipseLink2_0JpaPlatformProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/EclipseLink2_0JpaFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/EclipseLink2_0JpaPlatformFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/EclipseLink2_0JpaPlatformProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkElementCollectionMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkElementCollectionMappingDefinition2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkIdMappingDefinition2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkManyToManyMappingDefinition2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkManyToOneMappingDefinition2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkOneToManyMappingDefinition2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/java/JavaEclipseLinkOneToOneMappingDefinition2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/orm/EclipseLinkOrmXml2_0ContextNodeFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/orm/EclipseLinkOrmXml2_0Definition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/persistence/EclipseLink2_0PersistenceXmlContextNodeFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/persistence/EclipseLink2_0PersistenceXmlDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/persistence/connection/EclipseLinkConnection2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/persistence/logging/EclipseLinkLogging2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/context/persistence/options/EclipseLinkOptions2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_0/ddlgen/EclipseLink2_0DDLGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/AbstractEclipseLink2_1JpaPlatformProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/EclipseLink2_1JpaAnnotationDefinitionProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/EclipseLink2_1JpaPlatformFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/EclipseLink2_1JpaPlatformProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/EclipseLinkOrmElementCollectionMapping2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/EclipseLinkOrmXml2_1ContextNodeFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/EclipseLinkOrmXml2_1Definition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/OrmEclipseLinkBasicCollectionMapping2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/context/orm/OrmEclipseLinkBasicMapMapping2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/resource/java/EclipseLinkClassExtractor2_1AnnotationDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/resource/java/binary/BinaryEclipseLinkClassExtractorAnnotation2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_1/resource/java/source/SourceEclipseLinkClassExtractorAnnotation2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_2/EclipseLink2_2JpaPlatformFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_2/EclipseLink2_2JpaPlatformProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/internal/v2_2/context/orm/EclipseLinkOrmXml2_2Definition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/platform/EclipseLinkPlatform.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/BaseEclipseLinkTypeConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/CacheCoordinationType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/CacheType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/ChangeTrackingType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLink.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkBasicCollectionAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkBasicMapAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkCacheAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkChangeTrackingAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkConversionValueAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkConvertAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkCustomizerAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkExistenceCheckingAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkJoinFetchAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkMutableAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkNamedConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkObjectTypeConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkPrimaryKeyAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkPrivateOwnedAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkReadOnlyAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkReadTransformerAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkStructConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkTimeOfDayAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkTransformationAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkTransformerAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkTypeConverterAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkVariableOneToOneAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/EclipseLinkWriteTransformerAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/ExistenceType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/JoinFetchType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/java/NestableEclipseLinkConversionValueAnnotation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/Attributes.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/CacheCoordinationType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/CacheType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/EclipseLink.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/EclipseLinkOrmFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/EclipseLinkOrmPackage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/EclipseLinkOrmXmlResourceFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/ExistenceType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlAccessMethods.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlAccessMethodsHolder.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlAdditionalCriteria.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlAttributeMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasic.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasicCollection.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBasicMap.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBatchFetch.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlBatchFetchHolder.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlCache.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlCacheHolder.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlChangeTracking.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlChangeTrackingHolder.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlChangeTrackingType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlCloneCopyPolicy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlCollectionTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlConversionValue.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlConverterHolder.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlConvertersHolder.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlConvertibleMapping.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlCopyPolicy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlCustomizer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlCustomizerHolder.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlDirection.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlElementCollection.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbeddable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbedded.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEmbeddedId.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEntity.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlEntityMappings.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlFetchAttribute.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlFetchGroup.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlHashPartitioning.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlId.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlIndex.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlInstantiationCopyPolicy.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlJoinFetch.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlJoinFetchType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlJoinTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlManyToMany.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlManyToOne.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlMappedSuperclass.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlMutable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlNamedConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlNamedStoredProcedureQuery.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlObjectTypeConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlOneToMany.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlOneToOne.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlOptimisticLocking.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlOptimisticLockingType.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlOrderColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlPartitioning.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlPersistenceUnitDefaults.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlPersistenceUnitMetadata.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlPinnedPartitioning.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlPrimaryKey.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlPrivateOwned.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlProperty.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlPropertyContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlQueryContainer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlQueryRedirectors.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlRangePartitioning.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlReadOnly.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlReplicationPartitioning.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlReturnInsert.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlRoundRobinPartitioning.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlSecondaryTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlStoredProcedureParameter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlStructConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTableGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTimeOfDay.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTransformation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTransient.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlTypeConverter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlUnionPartitioning.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlValuePartitioning.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlVariableOneToOne.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/XmlVersion.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v1_1/EclipseLink1_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v1_1/EclipseLinkOrmV1_1Factory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v1_1/EclipseLinkOrmV1_1Package.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v1_1/IdValidationType_1_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v1_1/XmlBasic_1_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v1_1/XmlEntity_1_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v1_1/XmlMappedSuperclass_1_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v1_1/XmlPrimaryKey_1_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v1_2/EclipseLink1_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_0/EclipseLink2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_0/EclipseLinkOrmV2_0Factory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_0/EclipseLinkOrmV2_0Package.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_0/OrderCorrectionType_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_0/XmlCacheInterceptor_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_0/XmlCollectionMapping_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_0/XmlElementCollection_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_0/XmlEntity_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_0/XmlManyToMany_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_0/XmlMapKeyAssociationOverrideContainer_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_0/XmlMappedSuperclass_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_0/XmlOneToMany_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_0/XmlOrderColumn_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_0/XmlQueryRedirectors_2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/BatchFetchType_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/CacheKeyType_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/EclipseLink2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/EclipseLinkOrmV2_1Factory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/EclipseLinkOrmV2_1Package.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlBasic_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlBatchFetch_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlElementCollection_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlEmbeddable_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlEmbeddedId_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlEmbedded_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlEntityMappings_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlEntity_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlFetchAttribute_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlFetchGroupContainer_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlFetchGroup_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlId_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlManyToMany_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlManyToOne_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlMappedSuperclass_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlOneToMany_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlOneToOne_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlPersistenceUnitDefaults_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlPrimaryKey_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlReturnInsert_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlTransformation_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_1/XmlVersion_2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/EclipseLink2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/EclipseLinkOrmV2_2Factory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/EclipseLinkOrmV2_2Package.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlAdditionalCriteria_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlBasicCollection_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlBasicMap_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlBasic_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlCollectionTable_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlElementCollection_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlEmbeddable_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlEntityMappings_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlEntity_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlHashPartitioning_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlId_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlIndex_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlJoinTable_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlManyToMany_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlManyToOne_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlMappedSuperclass_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlOneToMany_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlOneToOne_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlPartitioningGroup_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlPartitioning_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlPinnedPartitioning_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlRangePartitioning_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlReplicationPartitioning_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlRoundRobinPartitioning_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlSecondaryTable_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlTableGenerator_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlTable_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlUnionPartitioning_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlValuePartitioning_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlVariableOneToOne_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/resource/orm/v2_2/XmlVersion_2_2.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_0/context/EclipseLinkElementCollectionMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_0/context/EclipseLinkOneToManyMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_0/context/EclipseLinkOneToManyRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_0/context/EclipseLinkOneToOneMapping2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_0/context/java/EclipseLinkJavaOneToManyRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_0/context/orm/EclipseLinkOrmOneToManyRelationship2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_0/context/persistence/connection/Connection2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_0/context/persistence/logging/Logging2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_0/context/persistence/options/Options2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_0/resource/java/EclipseLink2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.core/src/org/eclipse/jpt/jpa/eclipselink/core/v2_0/resource/java/EclipseLinkClassExtractorAnnotation2_1.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/.classpath delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/.cvsignore delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/META-INF/MANIFEST.MF delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/about.html delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/build.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/plugin.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/plugin.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/property_files/eclipselink_ui.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/property_files/eclipselink_ui_details.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/JptJpaEclipseLinkUiPlugin.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/EclipseLinkHelpContextIds.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/EclipseLinkUiMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/ddlgen/EclipseLinkDDLGeneratorUi.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/ddlgen/wizards/GenerateDDLWizard.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkBasicCollectionMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkBasicMapMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkTransformationMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/AbstractEclipseLinkVariableOneToOneMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkAlwaysRefreshComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkBasicCollectionMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkBasicMapMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkBasicMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCacheCoordinationTypeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCacheSizeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCacheTypeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCachingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkChangeTrackingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkConversionValueDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkConversionValueStateObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkConvertComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCustomConverterComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkCustomizerComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkDisableHitsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkEmbeddableAdvancedComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkEntityAdvancedComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkExpiryComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkIdMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkJoinFetchComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkManyToManyMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkManyToOneMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMappedSuperclassAdvancedComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkMutableComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkObjectTypeConverterComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkOneToManyJoiningStrategyPane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkOneToManyMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkOneToOneMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkPrivateOwnedComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkReadOnlyComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkRefreshOnlyIfNewerComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkStructConverterComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkTransformationMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkTypeConverterComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkUiDetailsMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkVariableOneToOneMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/EclipseLinkVersionMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/AbstractJavaEclipseLinkEmbeddableComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/AbstractJavaEclipseLinkEntityComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/AbstractJavaEclipseLinkMappedSuperclassComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkOneToManyMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkOneToOneMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/DefaultJavaEclipseLinkVariableOneToOneMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/EclipseLinkJavaResourceUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/EclipseLinkJavaUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/JavaEclipseLinkBasicCollectionMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/JavaEclipseLinkBasicMapMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/JavaEclipseLinkCachingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/JavaEclipseLinkConvertersComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/JavaEclipseLinkEmbeddableComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/JavaEclipseLinkEntityComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/JavaEclipseLinkExistenceCheckingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/JavaEclipseLinkMappedSuperclassComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/JavaEclipseLinkTransformationMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/java/JavaEclipseLinkVariableOneToOneMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/AbstractEclipseLinkEntityMappingsDetailsPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/AbstractOrmEclipseLinkEntityComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/AbstractOrmEclipseLinkMappedSuperclassComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/BaseEclipseLinkOrmXmlUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkConverterDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkConverterStateObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsDetailsPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkEntityMappingsDetailsProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXmlUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/EclipseLinkOrmXmlUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkBasicCollectionMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkBasicMapMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkBasicMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkCachingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkConvert1_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkConvertersComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkEmbeddableComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkEntityComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkExistenceCheckingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkIdMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkManyToManyMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkManyToOneMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkMappedSuperclassComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkOneToManyMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkOneToOneMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkTransformationMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkVariableOneToOneMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/details/orm/OrmEclipseLinkVersionMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkPersistenceXmlUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/EclipseLinkPersistenceXmlUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/CacheDefaultsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/CacheSizeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/CacheTypeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/DefaultCacheSizeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/DefaultCacheTypeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/DefaultSharedCacheComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EclipseLinkCachingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EntityCachingPropertyComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/EntityListComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/FlushClearCacheComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/PersistenceXmlCachingTab.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/caching/SharedCacheComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/BatchWritingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/CacheStatementsPropertiesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/ConnectionPropertiesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/DataSourcePropertiesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/EclipseLinkConnectionComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcBindParametersComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcConnectionPropertiesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcDriverComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcExclusiveConnectionModeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcExclusiveConnectionsPropertiesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcLazyConnectionComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcPropertiesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionPropertiesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionsMaxComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionsMinComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcReadConnectionsSharedComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcWriteConnectionPropertiesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcWriteConnectionsMaxComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/JdbcWriteConnectionsMinComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/NativeSqlComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/PersistenceXmlConnectionTab.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/connection/TransactionTypeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/CustomizerComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EclipseLinkCustomizationComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EntityCustomizationPropertyComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/EntityListComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/ExceptionHandlerComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/PersistenceXmlCustomizationTab.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/ProfilerComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/SessionCustomizersComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/ThrowExceptionsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/ValidateSchemaComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/ValidationOnlyComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/WeavingChangeTrackingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/WeavingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/WeavingEagerComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/WeavingFetchGroupsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/WeavingInternalComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/WeavingLazyComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/customization/WeavingPropertiesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitGeneralComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitJarFilesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/general/EclipseLinkPersistenceUnitMappingFilesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/logging/EclipseLinkLoggingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/logging/ExceptionsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/logging/LoggerComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/logging/LoggingFileLocationComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/logging/LoggingLevelComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/logging/PersistenceXmlLoggingTab.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/logging/SessionComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/logging/ThreadComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/logging/TimestampComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EclipseLinkOptionsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/EventListenerComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/IncludeDescriptorQueriesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/PersistenceXmlOptionsTab.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/SessionNameComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/SessionsXmlComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/TargetDatabaseComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/TargetServerComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/options/TemporalMutableComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/schema/generation/CreateDdlFileNameComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/schema/generation/DdlGenerationLocationComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/schema/generation/DdlGenerationTypeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/schema/generation/DropDdlFileNameComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/schema/generation/EclipseLinkSchemaGenerationComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/schema/generation/OutputModeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistence/schema/generation/PersistenceXmlSchemaGenerationTab.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemContentProviderFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/persistencexml/details/EclipseLinkNavigatorItemLabelProviderFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUi.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLinkJpaPlatformUiProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/platform/EclipseLinkNavigatorProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/structure/EclipseLinkOrmResourceModelStructureProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/structure/EclipseLinkPersistenceItemContentProviderFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/structure/EclipseLinkPersistenceResourceModelStructureProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_1/details/orm/EclipseLinkOrmXml1_1UiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_1/details/orm/EclipseLinkOrmXml1_1UiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_1/details/orm/OrmEclipseLinkBasicCollectionMapping1_1Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_1/details/orm/OrmEclipseLinkBasicMapMapping1_1Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_1/details/orm/OrmEclipseLinkBasicMapping1_1Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_1/details/orm/OrmEclipseLinkEmbeddedIdMapping1_1Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_1/details/orm/OrmEclipseLinkEmbeddedMapping1_1Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_1/details/orm/OrmEclipseLinkIdMapping1_1Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_1/details/orm/OrmEclipseLinkManyToManyMapping1_1Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_1/details/orm/OrmEclipseLinkManyToOneMapping1_1Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_1/details/orm/OrmEclipseLinkOneToManyMapping1_1Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_1/details/orm/OrmEclipseLinkOneToOneMapping1_1Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_1/details/orm/OrmEclipseLinkVersionMapping1_1Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_1/platform/EclipseLink1_1JpaPlatformUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_1/platform/EclipseLink1_1JpaPlatformUiProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_2/details/java/EclipseLink1_2JavaResourceUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_2/details/java/EclipseLink1_2JavaUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_2/details/java/JavaEclipseLinkEmbeddable1_2Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_2/details/java/JavaEclipseLinkEntity1_2Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_2/details/java/JavaEclipseLinkMappedSuperclass1_2Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_2/details/orm/EclipseLinkOrmXml1_2UiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_2/platform/EclipseLink1_2JpaPlatformUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v1_2/platform/EclipseLink1_2JpaPlatformUiProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/ddlgen/wizards/EclipseLink2_0DDLGeneratorUi.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/EclipseLinkCaching2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/java/EclipseLink2_0JavaResourceUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/java/EclipseLink2_0JavaUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/java/JavaEclipseLinkCaching2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/java/JavaEclipseLinkElementCollectionMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/java/JavaEclipseLinkEntity2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/java/JavaEclipseLinkIdMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/java/JavaEclipseLinkIdMapping2_0UiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/java/JavaEclipseLinkManyToManyMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/java/JavaEclipseLinkManyToOneMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/java/JavaEclipseLinkMappedSuperclass2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/java/JavaEclipseLinkOneToManyMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/java/JavaEclipseLinkOneToOneMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/orm/EclipseLinkEntityMappings2_0DetailsPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/orm/EclipseLinkEntityMappings2_0DetailsProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/orm/EclipseLinkOrmXml2_0UiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/orm/EclipseLinkOrmXml2_0UiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/orm/OrmEclipseLinkCaching2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/orm/OrmEclipseLinkEmbeddedIdMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/orm/OrmEclipseLinkEntity2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/orm/OrmEclipseLinkIdMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/orm/OrmEclipseLinkManyToManyMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/orm/OrmEclipseLinkManyToOneMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/orm/OrmEclipseLinkMappedSuperclass2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/orm/OrmEclipseLinkOneToManyMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/details/orm/OrmEclipseLinkOneToOneMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLink2_0PersistenceXmlUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/EclipseLinkPersistenceXml2_0UiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/caching/CacheDefaults2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/caching/EclipseLinkCaching2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/caching/FlushClearCache2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/caching/PersistenceXmlCaching2_0Tab.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/customization/EclipseLinkCustomization2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/customization/PersistenceXmlCustomization2_0Tab.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/logging/ConnectionComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/logging/EclipseLinkCategoryLoggingLevelComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/logging/EclipseLinkLogging2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/logging/PersistenceXmlLogging2_0Tab.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/options/EclipseLinkOptions2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/options/LockingConfigurationComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/options/PersistenceXmlOptions2_0Tab.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/options/QueryConfigurationComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/options/ValidationConfigurationComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/persistence/options/ValidationModeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/platform/EclipseLink2_0JpaPlatformUi.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/platform/EclipseLink2_0JpaPlatformUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_0/platform/EclipseLink2_0JpaPlatformUiProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_1/details/orm/EclipseLinkOrmXml2_1UiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_1/details/orm/EclipseLinkOrmXml2_1UiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_1/details/orm/OrmEclipseLinkElementCollectionMapping2_1Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_1/platform/EclipseLink2_1JpaPlatformUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_1/platform/EclipseLink2_1JpaPlatformUiProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_2/details/orm/EclipseLinkOrmXml2_2UiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_2/platform/EclipseLink2_2JpaPlatformUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/v2_2/platform/EclipseLink2_2JpaPlatformUiProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.eclipselink.ui/src/org/eclipse/jpt/jpa/eclipselink/ui/internal/wizards/EclipseLinkMappingFileWizard.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/.classpath delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/.cvsignore delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/META-INF/MANIFEST.MF delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/about.html delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/build.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/component.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/plugin.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/property_files/jpt_gen.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/Association.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/AssociationRole.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/BaseEntityGenCustomizer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/DatabaseAnnotationNameBuilder.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/JptGenMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/JptJpaGenPlugin.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/ORMGenColumn.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/ORMGenCustomizer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/ORMGenTable.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/OverwriteConfirmer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/PackageGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/TagNames.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/util/CompilationUnitModifier.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/util/DTPUtil.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/util/EntityGenTools.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/util/FileUtil.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/util/ForeignKeyInfo.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/util/StringUtil.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/src/org/eclipse/jpt/jpa/gen/internal/util/UrlUtil.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/templates/entities/column.vm delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/templates/entities/join.vm delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/templates/entities/main.java.vm delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/templates/entities/manyToMany.vm delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/templates/entities/manyToOne.vm delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/templates/entities/mappingKind.vm delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/templates/entities/oneToMany.vm delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/templates/entities/oneToOne.vm delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.gen/templates/entities/pk.java.vm delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/.classpath delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/.cvsignore delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/.jetproperties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/.options delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/META-INF/MANIFEST.MF delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/about.html delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/build.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/component.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/dtool16/new_entity_wiz.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/dtool16/new_jpa_file_wiz.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/dtool16/new_jpaproject_wiz.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/etool16/jpa_facet.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/etool16/new_entity_wiz.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/etool16/new_jpa_file_wiz.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/etool16/new_jpaproject_wiz.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/eview16/jpa_details.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/eview16/jpa_perspective.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/eview16/jpa_structure.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/basic.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/element-collection.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/embeddable.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/embedded-id.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/embedded.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/entity-mappings.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/entity.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/id.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/jpa-content.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/jpa-file.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/jpa-jar-file.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/many-to-many.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/many-to-one.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/mapped-superclass.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/null-attribute-mapping.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/null-type-mapping.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/one-to-many.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/one-to-one.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/persistence-unit.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/persistence.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/transient.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/version.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/obj16/warning.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/wizban/new_entity_wizban.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/wizban/new_jpa_file_wizban.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/icons/full/wizban/new_jpa_prj_wiz.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/add-connection.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/add.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/browse-mini.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/browse.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/collapse-all.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/delete.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/deselect-all.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/dot.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/edit.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/expand-all.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/list-of-values.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/move-down.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/move-up.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/reconnect.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/restore-defaults.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/select-all.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/buttons/warningstd.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/diagram/export-as-img-hover.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/diagram/export-as-img.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/diagram/header_left_bg.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/diagram/header_mid_bg.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/diagram/header_right_bg.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/diagram/print-hover.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/diagram/print.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/diagram/shadow-bottom.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/diagram/shadow-lower-left.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/diagram/shadow-lower-right.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/diagram/shadow-side.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/diagram/shadow-upper-right.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/diagram/toolbar_bg.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/objects/column.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/objects/columnKey.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/objects/file.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/objects/folder.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/objects/forward.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/objects/moveRight.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/objects/package.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/objects/table.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/objects/table_obj.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/overlays/error.gif delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/overlays/warning.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/images/save-image-16.png delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/plugin.xml delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_ui.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_ui_details.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_ui_details2_0.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_ui_details_orm.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_ui_entity_gen.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_ui_entity_wizard.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_ui_persistence.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_ui_persistence2_0.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/property_files/jpt_ui_validation_preferences.properties delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/schema/jpaPlatformUis.exsd delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaPlatformUi.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaPlatformUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JpaPlatformUiProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/JptJpaUiPlugin.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/MappingResourceUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/PersistenceXmlResourceUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/ResourceUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/DefaultMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/JpaComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/JpaDetailsPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/JpaDetailsProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/JpaPageComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/MappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/java/DefaultJavaAttributeMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/java/DefaultJavaTypeMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/java/JavaAttributeMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/java/JavaTypeMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/java/JavaUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/orm/OrmAttributeMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/orm/OrmTypeMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/details/orm/OrmXmlUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/AbstractJpaPlatformUiProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/EditorPartAdapterFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/GenericJpaPlatformUiProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/ImageRepository.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaHelpContextIds.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaJavaCompletionProposalComputer.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JpaMappingImageHelper.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JptUiIcons.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JptUiMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/JptUiValidationPreferenceMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/GenerateDDLAction.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/GenerateEntitiesAction.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/MakePersistentAction.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/OpenJpaResourceAction.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/ProjectAction.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/actions/SynchronizeClassesAction.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/AddPersistentAttributeToXmlAndMapHandler.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/AddPersistentAttributeToXmlHandler.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/AddPersistentClassHandler.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/ConvertJavaProjectToJpaCommandHandler.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/PersistentAttributeMapAsHandler.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/PersistentTypeMapAsHandler.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/RemovePersistentAttributeFromXmlHandler.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/RemovePersistentClassHandler.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/commands/UpgradeXmlFileVersionHandler.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractBasicMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractBasicMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddableComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddableUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddedIdMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddedIdMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddedMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddedMappingOverridesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEmbeddedMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEntityComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEntityMappingsDetailsProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEntityOverridesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractEntityUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractIdMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractIdMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractInheritanceComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractJoiningStrategyPane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractJpaDetailsPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractManyToManyMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractManyToManyMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractManyToOneMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractManyToOneMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractMappedSuperclassComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractMappedSuperclassUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOneToManyMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOneToManyMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOneToOneMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOneToOneMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOrderingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractOverridesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractPrimaryKeyJoinColumnsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractSecondaryTablesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractTransientMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractVersionMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AbstractVersionMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AccessTypeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AddQueryDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AddQueryStateObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AssociationOverrideComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/AttributeOverrideComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/BaseJoinColumnDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/BaseJoinColumnDialogPane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/BaseJoinColumnStateObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/BasicMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/CascadeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ColumnComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/DiscriminatorColumnComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/EmbeddedIdMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/EmbeddedMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/EmbeddedMappingOverridesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/EntityNameComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/EntityOverridesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/EnumTypeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/FetchTypeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/GeneratedValueComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/GenerationComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/GeneratorComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/IdClassComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/IdMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/IdMappingGenerationComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/InverseJoinColumnInJoinTableDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/InverseJoinColumnInJoinTableStateObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnDialogPane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnInJoiningStrategyDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnInJoiningStrategyStateObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnInReferenceTableDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnInReferenceTableStateObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnJoiningStrategyPane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnStateObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinColumnsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinTableComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoinTableJoiningStrategyPane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoiningStrategyJoinColumnsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JoiningStrategyJoinColumnsWithOverrideOptionComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/JptUiDetailsMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ManyToManyJoiningStrategyPane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ManyToManyMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ManyToOneJoiningStrategyPane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ManyToOneMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MapAsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MappedByJoiningStrategyPane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/MappedByPane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/NamedNativeQueryPropertyComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/NamedQueryPropertyComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/OneToManyJoiningStrategyPane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/OneToManyMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/OneToOneJoiningStrategyPane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/OneToOneMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/OptionalComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/OrderingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeDetailsPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentAttributeMapAsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeDetailsPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PersistentTypeMapAsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnInSecondaryTableDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnInSecondaryTableStateObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnJoiningStrategyPane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnStateObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/PrimaryKeyJoinColumnsInSecondaryTableComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/QueriesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/QueryHintsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/ReferenceTableComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/SecondaryTableDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/SequenceGeneratorComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/TableComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/TableGeneratorComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/TargetEntityComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/TemporalTypeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/TransientMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/VersionMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/db/CatalogCombo.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/db/ColumnCombo.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/db/DatabaseObjectCombo.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/db/SchemaCombo.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/db/SequenceCombo.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/db/TableCombo.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/AbstractJavaResourceUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/BaseJavaUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/DefaultBasicMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/DefaultEmbeddedMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/GenericJavaResourceUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/GenericJavaUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaBasicMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaEmbeddableComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaEmbeddableUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaEmbeddedIdMappingUDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaEmbeddedMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaEntityComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaEntityUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaIdMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaInheritanceComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaManyToManyMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaManyToOneMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaMappedSuperclassComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaMappedSuperclassUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaOneToManyMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaOneToOneMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaPersistentAttributeDetailsPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaPersistentAttributeDetailsProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaPersistentTypeDetailsProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaPrimaryKeyJoinColumnsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaSecondaryTablesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaTransientMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/JavaVersionMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/NullJavaAttributeMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/java/NullJavaTypeMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/AbstractEntityMappingsDetailsPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/AbstractOrmEntityComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/AbstractOrmXmlResourceUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/AddGeneratorDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/AddGeneratorStateObject.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/BaseOrmXmlUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/EntityMappingsDetailsPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/EntityMappingsDetailsProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/EntityMappingsGeneratorsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/GenericOrmXmlUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/JptUiDetailsOrmMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/MetadataCompleteComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmBasicMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmBasicMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmEmbeddableComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmEmbeddableUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmEmbeddedIdMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmEmbeddedIdMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmEmbeddedMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmEmbeddedMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmEntityComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmEntityUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmIdMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmIdMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmInheritanceComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmJavaClassChooser.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmManyToManyMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmManyToManyMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmManyToOneMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmManyToOneMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmMappedSuperclassComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmMappedSuperclassUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmMappingNameChooser.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmOneToManyMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmOneToManyMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmOneToOneMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmOneToOneMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPackageChooser.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPersistentAttributeDetailsPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPersistentAttributeDetailsProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPersistentTypeDetailsProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmPrimaryKeyJoinColumnsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmQueriesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmSecondaryTablesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmTransientMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmVersionMappingComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmVersionMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/OrmXmlUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/PersistenceUnitMetadataComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/details/orm/UnsupportedOrmMappingUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentAttributeToXmlAndMapDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/dialogs/AddPersistentClassDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/PersistenceContributor.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/editors/PersistenceEditor.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jface/JarFileItemLabelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jface/XmlMappingFileViewerFilter.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/Generic2_0JpaPlatformUiProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/GenericOrmXml2_0UiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/Jpa2_0ProjectFlagModel.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/AbstractElementCollectionMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/AbstractElementCollectionMapping2_0UiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/AbstractManyToOneMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/AbstractOneToOneMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/AssociationOverride2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/Cacheable2_0Pane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/CascadePane2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/CollectionTable2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/DerivedIdentity2_0Pane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/ElementCollectionMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/ElementCollectionValueOverridesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/EmbeddedIdMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/EmbeddedIdMapping2_0MappedByRelationshipPane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/EmbeddedMapping2_0OverridesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/Entity2_0OverridesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/Generation2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/IdMapping2_0MappedByRelationshipPane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/IdMappingGeneration2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/JptUiDetailsMessages2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/LockModeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/ManyToOneJoiningStrategy2_0Pane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/NamedQueryProperty2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OneToManyJoiningStrategy2_0Pane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OneToOneJoiningStrategy2_0Pane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrderColumnComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/Ordering2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/OrphanRemoval2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/Queries2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/SequenceGenerator2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/TargetClassComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/Generic2_0JavaResourceUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/Generic2_0JavaUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/JavaElementCollectionMapping2_0UiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/JavaEmbeddable2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/JavaEmbeddedMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/JavaEntity2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/JavaIdMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/JavaManyToManyMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/JavaManyToOneMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/JavaManyToOneMapping2_0Pane.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/JavaMappedSuperclass2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/JavaOneToManyMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/java/JavaOneToOneMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/EntityMappings2_0DetailsPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/EntityMappings2_0DetailsProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/EntityMappingsGenerators2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmBasicMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmElementCollectionMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmElementCollectionMapping2_0UiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmEmbeddedIdMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmEmbeddedMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmEntity2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmIdMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmManyToManyMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmManyToOneMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmOneToManyMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmOneToOneMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmQueries2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmVersionMapping2_0Composite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/details/orm/OrmXml2_0UiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/Generic2_0PersistenceXmlUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/JptUiPersistence2_0Messages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/PersistenceXml2_0UiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/connection/ConnectionPropertiesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/connection/DataSourcePropertiesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/connection/GenericPersistenceUnit2_0ConnectionComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/connection/GenericPersistenceUnit2_0ConnectionTab.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/connection/JdbcConnectionPropertiesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/connection/JdbcDriverComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/connection/JdbcPropertiesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/connection/TransactionTypeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/options/GenericPersistenceUnit2_0OptionsComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/options/GenericPersistenceUnit2_0OptionsTab.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/options/LockingConfigurationComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/options/QueryConfigurationComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/options/SharedCacheModeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/options/ValidationConfigurationComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/persistence/options/ValidationModeComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/jpa2/platform/generic/Generic2_0JpaPlatformUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/listeners/SWTConnectionListenerWrapper.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/MapAsContribution.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/PersistentAttributeMapAsContribution.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/menus/PersistentTypeMapAsContribution.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorActionProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorContentAndLabelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorContentProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorItemLabelProviderFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorLabelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/navigator/JpaNavigatorTreeItemContentProviderFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/JptUiPersistenceMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/AbstractPersistenceXmlResourceUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/ArchiveFileSelectionDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/GenericPersistenceUnitGeneralComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/GenericPersistenceUnitJarFilesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/GenericPersistenceUnitMappingFilesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/GenericPersistenceXmlUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/PersistenceUnitClassesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/PersistenceUnitConnectionComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/PersistenceUnitConnectionDatabaseComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/PersistenceUnitConnectionGeneralComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/PersistenceUnitGeneralComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/PersistenceUnitJarFilesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/PersistenceUnitMappingFilesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/PersistenceUnitPropertiesComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/PersistenceXmlUiDefinition.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/persistence/details/PersistenceXmlUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/perspective/JpaPerspectiveFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/JpaPlatformUiRegistry.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/BaseJpaPlatformUi.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/base/EntitiesGenerator.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/ClassRefItemLabelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/EntityMappingsItemLabelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/GenericJpaPlatformUi.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/GenericJpaPlatformUiFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/GenericNavigatorItemContentProviderFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/GenericNavigatorItemLabelProviderFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/GenericNavigatorProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/JarFileRefItemLabelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/JavaPersistentTypeItemContentProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/MappingFileRefItemLabelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/OrmPersistentTypeItemContentProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/OrmXmlItemContentProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/OrmXmlItemLabelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceItemLabelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceUnitItemLabelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceXmlItemContentProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistenceXmlItemLabelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistentAttributeItemContentProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistentAttributeItemLabelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/PersistentTypeItemLabelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/RootContextItemContentProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/platform/generic/RootContextItemLabelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/preferences/JpaPreferencesPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/preferences/JpaProblemSeveritiesPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/DataModelPropertyPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/properties/JpaProjectPropertiesPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/DefaultJpaSelection.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/DefaultJpaSelectionManager.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaDetailsSelectionParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaSelection.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaSelectionEvent.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaSelectionManager.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaSelectionParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/JpaStructureSelectionParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/SelectionManagerFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/TextEditorSelectionParticipant.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/selection/WorkbenchPartAdapterFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/GeneralJpaMappingItemLabelProviderFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/JavaItemContentProviderFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/JavaItemLabelProviderFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/JavaResourceModelStructureProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/OrmItemContentProviderFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/OrmItemLabelProviderFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/OrmResourceModelStructureProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceItemContentProviderFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceItemLabelProviderFactory.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/PersistenceResourceModelStructureProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/structure/ResourceModelItemContentProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/AbstractJpaView.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/JpaDetailsView.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/structure/JpaStructurePage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/views/structure/JpaStructureView.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/DatabaseSchemaWizardPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetActionPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetInstallPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaFacetVersionChangePage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizard.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/JpaMakePersistentWizardPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/NewEntityDropDownAction.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/SelectJpaOrmMappingFileDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/AnnotatedEntityTemplate.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityClassWizardPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityFieldsWizardPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityRowTableWizardSection.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityTemplate.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityWizard.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/EntityWizardMsg.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/IdClassTemplate.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/model/CreateEntityTemplateModel.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/model/EntityDataModelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/model/EntityRow.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/model/IEntityDataModelProperties.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/entity/data/operation/NewEntityClassOperation.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationFigure.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationTablesPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/AssociationsListComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CardinalityPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/CascadeDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/ColumnGenPanel.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DatabaseGroup.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/DefaultTableGenerationWizardPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/GenerateEntitiesFromSchemaWizard.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/JoinColumnsPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/JptUiEntityGenMessages.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/NewAssociationWizard.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/NewAssociationWizardPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/PromptJPAProjectWizardPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/SWTUtil.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/SelectTableDialog.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableAssociationsWizardPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableFigure.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TableGenPanel.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesAndColumnsCustomizationWizardPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/gen/TablesSelectorWizardPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileNewFileWizardPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileOptionsWizardPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/orm/MappingFileWizard.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/AddToEarComposite.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizard.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/JpaProjectWizardFirstPage.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/model/JpaProjectCreationDataModelProperties.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/internal/wizards/proj/model/JpaProjectCreationDataModelProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/jpa2/details/java/JavaUiFactory2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/jpa2/details/orm/OrmXmlUiFactory2_0.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/navigator/JpaNavigatorProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/src/org/eclipse/jpt/jpa/ui/structure/JpaStructureProvider.java delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/templates/annotated_entity.javajet delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/templates/entity.javajet delete mode 100644 jpa/plugins/org.eclipse.jpt.jpa.ui/templates/idClass.javajet delete mode 100644 jpa/plugins/org.eclipse.jpt.ui/.project delete mode 100644 jpa/plugins/org.eclipse.jpt.utility/.project delete mode 100644 jpa/tests/org.eclipse.jpt.core.tests.extension.resource/.project delete mode 100644 jpa/tests/org.eclipse.jpt.core.tests/.project delete mode 100644 jpa/tests/org.eclipse.jpt.db.tests/.project delete mode 100644 jpa/tests/org.eclipse.jpt.eclipselink.core.tests/.project delete mode 100644 jpa/tests/org.eclipse.jpt.gen.tests/.project delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.classpath delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.cvsignore delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.project delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/META-INF/MANIFEST.MF delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/about.html delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/build.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/plugin.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/plugin.xml delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/ExtensionTestPlugin.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestAttributeMapping.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestAttributeMappingDefinition.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestTypeMapping.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/JavaTestTypeMappingDefinition.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJavaBasicMapping.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJavaEntity.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaFactory.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformFactory.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformProvider.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests.extension.resource/src/org/eclipse/jpt/jpa/core/tests/extension/resource/TestJpaPlatformUiFactory.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/.classpath delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/.cvsignore delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/.project delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/META-INF/MANIFEST.MF delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/about.html delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/build.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/plugin.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/JptJpaCoreTestsPlugin.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/MiscTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/JptJpaCoreTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/ContextModelTestCase.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaFileTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JpaProjectTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/JptJpaCoreContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentAttributeTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/GenericJavaPersistentTypeTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaAssociationOverrideTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaAttributeOverrideTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaBasicMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaCascadeTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaColumnTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaDiscriminatorColumnTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddableTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddedIdMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEmbeddedMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaEntityTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaGeneratedValueTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaIdMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaJoinColumnTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaJoinTableTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaManyToManyMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaManyToOneMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaMappedSuperclassTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaNamedNativeQueryTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaNamedQueryTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaOneToManyMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaOneToOneMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaPrimaryKeyJoinColumnTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaQueryHintTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaSecondaryTableTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaSequenceGeneratorTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableGeneratorTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTableTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaTransientMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JavaVersionMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/java/JptCoreContextJavaModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/EntityMappingsTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/GenericOrmPersistentAttributeTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/GenericOrmPersistentTypeTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/JptCoreOrmContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmAssociationOverrideTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmAttributeOverrideTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmBasicMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmCascadeTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmColumnTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmDiscriminatorColumnTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddableTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddedIdMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEmbeddedMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmEntityTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmGeneratedValueTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmIdMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinColumnTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmJoinTableTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmManyToManyMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmManyToOneMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmMappedSuperclassTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmNamedNativeQueryTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmNamedQueryTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmOneToManyMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmOneToOneMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmPrimaryKeyJoinColumnTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmQueryHintTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmSecondaryTableTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmSequenceGeneratorTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableGeneratorTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTableTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmTransientMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmVersionMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/OrmXmlTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/PersistenceUnitDefaultsTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/orm/PersistenceUnitMetadataTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/ClassRefTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/JptCorePersistenceContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/MappingFileRefTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceUnitTestCase.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceUnitTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/PersistenceXmlTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/context/persistence/RootContextNodeTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/Generic2_0ContextModelTestCase.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/Generic2_0JavaContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaAssociationOverride2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaCascade2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaCollectionTable2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaEmbeddedMapping2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaEntity2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaManyToManyMapping2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaManyToOneMapping2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaOneToManyMapping2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaOneToOneMapping2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaPersistentType2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/Generic2_0OrmContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmAssociationOverride2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmCascade2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmCollectionTable2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmEmbeddedMapping2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmEntity2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmManyToManyMapping2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmManyToOneMapping2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmOneToManyMapping2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmOneToOneMapping2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmPersistentType2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/persistence/Generic2_0ConnectionTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/persistence/Generic2_0OptionsTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/persistence/Generic2_0PersistenceContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/context/persistence/Generic2_0PersistenceUnitTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/Access2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/AssociationOverride2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/AssociationOverrides2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/Cacheable2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/CollectionTable2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/ElementCollection2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/JavaResource2_0Tests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/JavaResourceModel2_0TestCase.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/ManyToMany2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/ManyToOne2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/MapKeyClass2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/MapsId2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/OneToMany2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/OneToOne2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/OrderColumn2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/model/JpaProjectManagerTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/model/JptJpaCoreModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/platform/BaseJpaPlatformTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/platform/JpaPlatformExtensionTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/platform/JpaPlatformTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/projects/TestJpaProject.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/JptJpaCoreResourceModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/AssociationOverrideTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/AssociationOverridesTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/AttributeOverrideTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/AttributeOverridesTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/BasicTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/ColumnTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/DiscriminatorColumnTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/DiscriminatorValueTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/EmbeddableTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/EmbeddedIdTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/EmbeddedTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/EntityTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/EnumeratedTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/GeneratedValueTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/IdClassTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/IdTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/InheritanceTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JPTToolsTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JavaResourceModelTestCase.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JavaResourcePersistentAttributeTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JavaResourcePersistentTypeTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JoinColumnTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JoinColumnsTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JoinTableTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JpaJavaResourceModelTestCase.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/JptJavaResourceTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/LobTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/ManyToManyTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/ManyToOneTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/MapKeyTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/MappedSuperclassTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/NamedNativeQueriesTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/NamedNativeQueryTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/NamedQueriesTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/NamedQueryTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/OneToManyTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/OneToOneTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/OrderByTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/PrimaryKeyJoinColumnTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/PrimaryKeyJoinColumnsTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/QueryHintTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/SecondaryTableTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/SecondaryTablesTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/SequenceGeneratorTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/TableGeneratorTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/TableTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/TemporalTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/TransientTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/src/org/eclipse/jpt/jpa/core/tests/internal/resource/java/VersionTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.core.tests/test.xml delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/.classpath delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/.cvsignore delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/.project delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/META-INF/MANIFEST.MF delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/about.html delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/build.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/config/derby.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/config/mysql.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/config/oracle10g.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/config/oracle10gXE.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/config/oracle9i.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/config/postgresql.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/config/sqlserver.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/config/sybase.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/plugin.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/JDBCTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/JDBCTools.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/JptJpaDbTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/JptJpaDbTestsPlugin.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/platforms/AllPlatformTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/platforms/DTPPlatformTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/platforms/DerbyTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/platforms/MySQLTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/platforms/Oracle10gTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/platforms/Oracle10gXETests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/platforms/Oracle9iTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/platforms/PostgreSQLTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/platforms/SQLServerTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.db.tests/src/org/eclipse/jpt/jpa/db/tests/internal/platforms/SybaseTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/.classpath delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/.cvsignore delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/.project delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/META-INF/MANIFEST.MF delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/about.html delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/build.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/plugin.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/JptJpaEclipseLinkCoreTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLinkContextModelTestCase.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/EclipseLinkJpaProjectTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/JptEclipseLink1_0CoreContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/JptJpaEclipseLinkCoreContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaBasicMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaCachingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConvertTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaConverterTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEmbeddableTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaEntityTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaIdMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToManyMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaManyToOneMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaMappedSuperclassTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaObjectTypeConverterTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToManyMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaOneToOneMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaStructConverterTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaTypeConverterTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/EclipseLinkJavaVersionMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/java/JptEclipseLinkCoreJavaContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkEntityMappingsTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmBasicMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmContextModelTestCase.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmConverterTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmEmbeddableTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmEntityTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmIdMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmManyToManyMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmManyToOneMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmMappedSuperclassTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmObjectTypeConverterTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmOneToManyMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmOneToOneMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmPersistentAttributeTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmStructConverterTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmTransientMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmTypeConverterTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkOrmVersionMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitDefaultsTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/EclipseLinkPersistenceUnitMetadataTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/orm/JptEclipseLinkCoreOrmContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLinkPersistenceUnitTestCase.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/EclipseLinkPersistenceUnitTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/JptEclipseLinkCorePersistenceContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/caching/CachingAdapterTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/caching/CachingValueModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/caching/JptEclipseLinkPersistenceCachingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/connection/EclipseLinkConnectionTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/connection/JptEclipseLinkPersistenceConnectionTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/customization/CustomizationValueModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/customization/EclipseLinkCustomizationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/customization/JptEclipseLinkPersistenceCustomizationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/general/GeneralPropertiesAdapterTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/general/GeneralPropertiesValueModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/general/JptEclipseLinkPersistenceGeneralTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/logging/JptEclipseLinkPersistenceLoggingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/logging/LoggingAdapterTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/logging/LoggingValueModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/options/JptEclipseLinkPersistenceOptionsTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/options/OptionsAdapterTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/options/OptionsValueModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/schema/generation/JptEclipseLinkPersistenceSchemaGenerationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/schema/generation/SchemaGenerationAdapterTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/schema/generation/SchemaGenerationBasicAdapterTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/context/persistence/schema/generation/SchemaGenerationValueModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/JptJpaEclipselinkCoreResourceModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/CacheTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/ChangeTrackingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/ConversionValueAnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/ConvertAnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/ConverterAnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/CustomizerAnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/EclipseLinkJavaResourceModelTestCase.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/EclipseLinkPrimaryKeyAnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/ExistenceCheckingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/JoinFetchTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/JptEclipseLinkCoreJavaResourceModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/MutableAnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/ObjectTypeConverterAnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/PrivateOwnedTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/ReadOnlyTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/ReadTransformerAnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/StructConverterAnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/TimeOfDayTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/TransformationAnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/TypeConverterAnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/resource/java/WriteTransformerAnnotationTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v1_1/context/EclipseLink1_1ContextModelTestCase.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v1_1/context/EclipseLink1_1JpaProjectTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v1_1/context/JptEclipseLink1_1CoreContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v1_1/context/orm/EclipseLink1_1OrmContextModelTestCase.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v1_1/context/orm/EclipseLink1_1OrmPersistentAttributeTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v1_1/context/orm/EclipseLink1_1OrmPersistentTypeTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v1_1/context/orm/EclipseLink1_1OrmTransientMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v1_1/context/orm/JptEclipseLink1_1CoreOrmContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v1_2/context/EclipseLink1_2ContextModelTestCase.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v1_2/context/EclipseLink1_2JpaProjectTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v1_2/context/JptEclipseLink1_2CoreContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/EclipseLink2_0ContextModelTestCase.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/JptEclipseLink2_0CoreContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/java/EclipseLink2_0JavaCollectionTableTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/java/EclipseLink2_0JavaElementCollectionMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/java/EclipseLink2_0JavaEntityTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/java/EclipseLink2_0JavaManyToManyMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/java/EclipseLink2_0JavaManyToOneMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/java/EclipseLink2_0JavaMappedSuperclassTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/java/EclipseLink2_0JavaOneToManyMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/java/EclipseLink2_0JavaOneToOneMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/java/JptEclipseLink2_0JavaContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/orm/EclipseLink2_0OrmCollectionTableTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/orm/EclipseLink2_0OrmContextModelTestCase.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/orm/EclipseLink2_0OrmElementCollectionMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/orm/EclipseLink2_0OrmEntityTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/orm/EclipseLink2_0OrmManyToManyMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/orm/EclipseLink2_0OrmMappedSuperclassTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/orm/EclipseLink2_0OrmOneToManyMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/orm/EclipseLink2_0OrmOneToOneMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/orm/Eclipselink2_0OrmManyToOneMappingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/orm/JptEclipseLink2_0OrmContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/persistence/EclipseLink2_0ConnectionTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/persistence/EclipseLink2_0LoggingTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/persistence/EclipseLink2_0OptionsTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/persistence/EclipseLink2_0PersistenceUnitTestCase.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/src/org/eclipse/jpt/jpa/eclipselink/core/tests/internal/v2_0/context/persistence/JptEclipseLink2_0CorePersistenceContextModelTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.eclipselink.core.tests/test.xml delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.gen.tests/.classpath delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.gen.tests/.project delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.gen.tests/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.gen.tests/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.gen.tests/META-INF/MANIFEST.MF delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.gen.tests/about.html delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.gen.tests/build.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.gen.tests/plugin.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/EntityGenToolsTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.gen.tests/src/org/eclipse/jpt/jpa/gen/tests/internal/JptJpaGenTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.gen.tests/test.xml delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.ui.tests/.classpath delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.ui.tests/.project delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.ui.tests/.settings/org.eclipse.core.resources.prefs delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.ui.tests/.settings/org.eclipse.jdt.core.prefs delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.ui.tests/META-INF/MANIFEST.MF delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.ui.tests/build.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.ui.tests/plugin.properties delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/JptUiTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/platform/JpaPlatformUiExtensionTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.jpa.ui.tests/src/org/eclipse/jpt/jpa/ui/tests/internal/platform/JptUiPlatformTests.java delete mode 100644 jpa/tests/org.eclipse.jpt.ui.tests/.project delete mode 100644 jpa/tests/org.eclipse.jpt.utility.tests/.project diff --git a/assembly/features/org.eclipse.jpt.assembly.feature/.cvsignore b/assembly/features/org.eclipse.jpt.assembly.feature/.cvsignore deleted file mode 100644 index de8b73fb72..0000000000 --- a/assembly/features/org.eclipse.jpt.assembly.feature/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -build.xml -org.eclipse.jpt_1.0.0.* diff --git a/assembly/features/org.eclipse.jpt.assembly.feature/.project b/assembly/features/org.eclipse.jpt.assembly.feature/.project deleted file mode 100644 index 1e211aff8d..0000000000 --- a/assembly/features/org.eclipse.jpt.assembly.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.assembly.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/assembly/features/org.eclipse.jpt.assembly.feature/build.properties b/assembly/features/org.eclipse.jpt.assembly.feature/build.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/assembly/features/org.eclipse.jpt.assembly.feature/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt.assembly.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/assembly/features/org.eclipse.jpt.assembly.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/assembly/features/org.eclipse.jpt.assembly.feature/epl-v10.html b/assembly/features/org.eclipse.jpt.assembly.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/assembly/features/org.eclipse.jpt.assembly.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/assembly/features/org.eclipse.jpt.assembly.feature/feature.properties b/assembly/features/org.eclipse.jpt.assembly.feature/feature.properties deleted file mode 100644 index 5771e2672f..0000000000 --- a/assembly/features/org.eclipse.jpt.assembly.feature/feature.properties +++ /dev/null @@ -1,144 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - -# "updateSiteName" property - label for the update site -updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site - -# "description" property - description of the feature -description=Dali Java Persistence Tools - Runtime - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\ -March 17, 2005\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\ -is provided to you under the terms and conditions of the Eclipse Public\n\ -License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\ -Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse.org CVS\n\ -repository ("Repository") in CVS modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -Features may also include other Features ("Included Features"). Files named\n\ -"feature.xml" may contain a list of the names and version numbers of\n\ -Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Eclipse Update Manager, you must agree to a license ("Feature Update\n\ -License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties". Such Abouts,\n\ -Feature Licenses and Feature Update Licenses contain the terms and\n\ -conditions (or references to such terms and conditions) that govern your\n\ -use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use,\n\ -and re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/assembly/features/org.eclipse.jpt.assembly.feature/feature.xml b/assembly/features/org.eclipse.jpt.assembly.feature/feature.xml deleted file mode 100644 index e3754862ef..0000000000 --- a/assembly/features/org.eclipse.jpt.assembly.feature/feature.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - - - - - - - - - - diff --git a/assembly/features/org.eclipse.jpt.assembly.feature/license.html b/assembly/features/org.eclipse.jpt.assembly.feature/license.html deleted file mode 100644 index 2347060ef3..0000000000 --- a/assembly/features/org.eclipse.jpt.assembly.feature/license.html +++ /dev/null @@ -1,93 +0,0 @@ - - -Eclipse.org Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

January 28, 2005

-

Usage Of Content

-

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION -AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF -THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE -TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED -BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED -BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE -AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY -APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU -MAY NOT USE THE CONTENT.

-

Applicable Licenses

-

Unless otherwise indicated, all Content made available by the Eclipse -Foundation is provided to you under the terms and conditions of the Eclipse -Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this -Content and is also available at http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

-

Content includes, but is not limited to, source code, object code, -documentation and other files maintained in the Eclipse.org CVS repository -("Repository") in CVS modules ("Modules") and made available as downloadable -archives ("Downloads").

-

Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments -("Fragments"), and features ("Features"). A Feature is a bundle of one or more -Plug-ins and/or Fragments and associated material. Files named "feature.xml" may -contain a list of the names and version numbers of the Plug-ins and/or Fragments -associated with a Feature. Plug-ins and Fragments are located in directories -named "plugins" and Features are located in directories named "features".

-

Features may also include other Features ("Included Features"). Files named -"feature.xml" may contain a list of the names and version numbers of Included -Features.

-

The terms and conditions governing Plug-ins and Fragments should be contained -in files named "about.html" ("Abouts"). The terms and conditions governing -Features and Included Features should be contained in files named "license.html" -("Feature Licenses"). Abouts and Feature Licenses may be located in any -directory of a Download or Module including, but not limited to the following -locations:

- -

Note: if a Feature made available by the Eclipse Foundation is installed -using the Eclipse Update Manager, you must agree to a license ("Feature Update -License") during the installation process. If the Feature contains Included -Features, the Feature Update License should either provide you with the terms -and conditions governing the Included Features or inform you where you can -locate them. Feature Update Licenses may be found in the "license" property of -files named "feature.properties". Such Abouts, Feature Licenses and Feature -Update Licenses contain the terms and conditions (or references to such terms -and conditions) that govern your use of the associated Content in that -directory.

-

THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL -OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is -provided, please contact the Eclipse Foundation to determine what terms and -conditions govern that particular Content.

-

Cryptography

-

Content may contain encryption software. The country in which you are -currently may have restrictions on the import, possession, and use, and/or -re-export to another country, of encryption software. BEFORE using any -encryption software, please check the country's laws, regulations and policies -concerning the import, possession, or use, and re-export of encryption software, -to see if this is permitted.

diff --git a/assembly/features/org.eclipse.jpt.patch/.project b/assembly/features/org.eclipse.jpt.patch/.project deleted file mode 100644 index b7a2bf552d..0000000000 --- a/assembly/features/org.eclipse.jpt.patch/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.patch - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/assembly/features/org.eclipse.jpt.patch/build.properties b/assembly/features/org.eclipse.jpt.patch/build.properties deleted file mode 100644 index c381fb22bb..0000000000 --- a/assembly/features/org.eclipse.jpt.patch/build.properties +++ /dev/null @@ -1,10 +0,0 @@ -bin.includes = feature.xml,\ - license.html,\ - feature.properties,\ - epl-v10.html,\ - eclipse_update_120.jpg -src.includes = eclipse_update_120.jpg,\ - epl-v10.html,\ - feature.properties,\ - feature.xml,\ - license.html diff --git a/assembly/features/org.eclipse.jpt.patch/buildnotes_org.eclipse.jpt.patch.html b/assembly/features/org.eclipse.jpt.patch/buildnotes_org.eclipse.jpt.patch.html deleted file mode 100644 index 0d115f43fb..0000000000 --- a/assembly/features/org.eclipse.jpt.patch/buildnotes_org.eclipse.jpt.patch.html +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - Java Persistence Tools (JTP) 1.0.2 Patches - - - - -

JTP 2.0.2 Patches

- -

Feature Patched: org.eclipse.jpt.patch

-

Plugin(s) replaced:

- -

Bug 220297. Entity generation creates Embeddables with compile errors in some cases.

- - - \ No newline at end of file diff --git a/assembly/features/org.eclipse.jpt.patch/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt.patch/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/assembly/features/org.eclipse.jpt.patch/eclipse_update_120.jpg and /dev/null differ diff --git a/assembly/features/org.eclipse.jpt.patch/epl-v10.html b/assembly/features/org.eclipse.jpt.patch/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/assembly/features/org.eclipse.jpt.patch/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/assembly/features/org.eclipse.jpt.patch/feature.properties b/assembly/features/org.eclipse.jpt.patch/feature.properties deleted file mode 100644 index a8457ea0cc..0000000000 --- a/assembly/features/org.eclipse.jpt.patch/feature.properties +++ /dev/null @@ -1,143 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### - -# "featureName" property - name of the feature -featureName=Java Persistence Tools (JTP) Patches - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse.org - -# "updateSiteName" property - label for the update site -updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site - -# "description" property - description of the feature -description=\ -Patch(s) for Java Persistence API (JPA) Tools. \n\ -See bug 220297 (https://bugs.eclipse.org/bugs/220297) Entity generation creates Embeddables with compile errors in some cases \n\ - - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006-08 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\ -June 06, 2007\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\ -is provided to you under the terms and conditions of the Eclipse Public\n\ -License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\ -Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse.org CVS\n\ -repository ("Repository") in CVS modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -Features may also include other Features ("Included Features"). Files named\n\ -"feature.xml" may contain a list of the names and version numbers of\n\ -Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Eclipse Update Manager, you must agree to a license ("Feature Update\n\ -License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties". Such Abouts,\n\ -Feature Licenses and Feature Update Licenses contain the terms and\n\ -conditions (or references to such terms and conditions) that govern your\n\ -use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ - - Common Development and Distribution License (CDDL) Version 1.0 (available at http://www.sun.com/cddl/cddl.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use,\n\ -and re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/assembly/features/org.eclipse.jpt.patch/feature.xml b/assembly/features/org.eclipse.jpt.patch/feature.xml deleted file mode 100644 index 4fae92b5fa..0000000000 --- a/assembly/features/org.eclipse.jpt.patch/feature.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - - - - - diff --git a/assembly/features/org.eclipse.jpt.patch/license.html b/assembly/features/org.eclipse.jpt.patch/license.html deleted file mode 100644 index 2347060ef3..0000000000 --- a/assembly/features/org.eclipse.jpt.patch/license.html +++ /dev/null @@ -1,93 +0,0 @@ - - -Eclipse.org Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

January 28, 2005

-

Usage Of Content

-

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION -AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF -THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE -TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED -BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED -BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE -AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY -APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU -MAY NOT USE THE CONTENT.

-

Applicable Licenses

-

Unless otherwise indicated, all Content made available by the Eclipse -Foundation is provided to you under the terms and conditions of the Eclipse -Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this -Content and is also available at http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

-

Content includes, but is not limited to, source code, object code, -documentation and other files maintained in the Eclipse.org CVS repository -("Repository") in CVS modules ("Modules") and made available as downloadable -archives ("Downloads").

-

Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments -("Fragments"), and features ("Features"). A Feature is a bundle of one or more -Plug-ins and/or Fragments and associated material. Files named "feature.xml" may -contain a list of the names and version numbers of the Plug-ins and/or Fragments -associated with a Feature. Plug-ins and Fragments are located in directories -named "plugins" and Features are located in directories named "features".

-

Features may also include other Features ("Included Features"). Files named -"feature.xml" may contain a list of the names and version numbers of Included -Features.

-

The terms and conditions governing Plug-ins and Fragments should be contained -in files named "about.html" ("Abouts"). The terms and conditions governing -Features and Included Features should be contained in files named "license.html" -("Feature Licenses"). Abouts and Feature Licenses may be located in any -directory of a Download or Module including, but not limited to the following -locations:

- -

Note: if a Feature made available by the Eclipse Foundation is installed -using the Eclipse Update Manager, you must agree to a license ("Feature Update -License") during the installation process. If the Feature contains Included -Features, the Feature Update License should either provide you with the terms -and conditions governing the Included Features or inform you where you can -locate them. Feature Update Licenses may be found in the "license" property of -files named "feature.properties". Such Abouts, Feature Licenses and Feature -Update Licenses contain the terms and conditions (or references to such terms -and conditions) that govern your use of the associated Content in that -directory.

-

THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL -OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is -provided, please contact the Eclipse Foundation to determine what terms and -conditions govern that particular Content.

-

Cryptography

-

Content may contain encryption software. The country in which you are -currently may have restrictions on the import, possession, and use, and/or -re-export to another country, of encryption software. BEFORE using any -encryption software, please check the country's laws, regulations and policies -concerning the import, possession, or use, and re-export of encryption software, -to see if this is permitted.

diff --git a/assembly/features/org.eclipse.jpt.sdk/.cvsignore b/assembly/features/org.eclipse.jpt.sdk/.cvsignore deleted file mode 100644 index bc2abf75c1..0000000000 --- a/assembly/features/org.eclipse.jpt.sdk/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -*.bin.dist.zip -build.xml -features -plugins diff --git a/assembly/features/org.eclipse.jpt.sdk/.project b/assembly/features/org.eclipse.jpt.sdk/.project deleted file mode 100644 index 821d453136..0000000000 --- a/assembly/features/org.eclipse.jpt.sdk/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.sdk - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/assembly/features/org.eclipse.jpt.sdk/build.properties b/assembly/features/org.eclipse.jpt.sdk/build.properties deleted file mode 100644 index 7200939aca..0000000000 --- a/assembly/features/org.eclipse.jpt.sdk/build.properties +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -bin.includes = feature.xml,\ - eclipse_update_120.jpg,\ - epl-v10.html,\ - license.html,\ - feature.properties diff --git a/assembly/features/org.eclipse.jpt.sdk/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt.sdk/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/assembly/features/org.eclipse.jpt.sdk/eclipse_update_120.jpg and /dev/null differ diff --git a/assembly/features/org.eclipse.jpt.sdk/epl-v10.html b/assembly/features/org.eclipse.jpt.sdk/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/assembly/features/org.eclipse.jpt.sdk/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/assembly/features/org.eclipse.jpt.sdk/feature.properties b/assembly/features/org.eclipse.jpt.sdk/feature.properties deleted file mode 100644 index 64b1fab799..0000000000 --- a/assembly/features/org.eclipse.jpt.sdk/feature.properties +++ /dev/null @@ -1,170 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools project SDK - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse.org - -# "updateSiteName" property - label for the update site -updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site - -# "description" property - description of the feature -description=Dali Java Persistence Tools project SDK - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/assembly/features/org.eclipse.jpt.sdk/feature.xml b/assembly/features/org.eclipse.jpt.sdk/feature.xml deleted file mode 100644 index 28dc74f6c8..0000000000 --- a/assembly/features/org.eclipse.jpt.sdk/feature.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - - - - - - diff --git a/assembly/features/org.eclipse.jpt.sdk/license.html b/assembly/features/org.eclipse.jpt.sdk/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/assembly/features/org.eclipse.jpt.sdk/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- - - -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- - - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/.cvsignore b/assembly/features/org.eclipse.jpt.tests.assembly.feature/.cvsignore deleted file mode 100644 index 2544693f86..0000000000 --- a/assembly/features/org.eclipse.jpt.tests.assembly.feature/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -*.bin.dist.zip -build.xml -org.eclipse.jpt.tests_1.0.0.* \ No newline at end of file diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/.project b/assembly/features/org.eclipse.jpt.tests.assembly.feature/.project deleted file mode 100644 index f34899cb8b..0000000000 --- a/assembly/features/org.eclipse.jpt.tests.assembly.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.tests.assembly.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/.settings/org.eclipse.core.resources.prefs b/assembly/features/org.eclipse.jpt.tests.assembly.feature/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 17acb651a8..0000000000 --- a/assembly/features/org.eclipse.jpt.tests.assembly.feature/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun May 27 15:11:05 EDT 2007 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/build.properties b/assembly/features/org.eclipse.jpt.tests.assembly.feature/build.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt.tests.assembly.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/assembly/features/org.eclipse.jpt.tests.assembly.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/epl-v10.html b/assembly/features/org.eclipse.jpt.tests.assembly.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/assembly/features/org.eclipse.jpt.tests.assembly.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/feature.properties b/assembly/features/org.eclipse.jpt.tests.assembly.feature/feature.properties deleted file mode 100644 index c98fef25cb..0000000000 --- a/assembly/features/org.eclipse.jpt.tests.assembly.feature/feature.properties +++ /dev/null @@ -1,145 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools Tests - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - -# "updateSiteName" property - label for the update site -updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site - -# "description" property - description of the feature -description=Dali Java Persistence Tools project Tests - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\ -June 06, 2007\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\ -is provided to you under the terms and conditions of the Eclipse Public\n\ -License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\ -Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse.org CVS\n\ -repository ("Repository") in CVS modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -Features may also include other Features ("Included Features"). Files named\n\ -"feature.xml" may contain a list of the names and version numbers of\n\ -Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Eclipse Update Manager, you must agree to a license ("Feature Update\n\ -License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties". Such Abouts,\n\ -Feature Licenses and Feature Update Licenses contain the terms and\n\ -conditions (or references to such terms and conditions) that govern your\n\ -use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ - - Common Development and Distribution License (CDDL) Version 1.0 (available at http://www.sun.com/cddl/cddl.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use,\n\ -and re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/feature.xml b/assembly/features/org.eclipse.jpt.tests.assembly.feature/feature.xml deleted file mode 100644 index 991e458213..0000000000 --- a/assembly/features/org.eclipse.jpt.tests.assembly.feature/feature.xml +++ /dev/null @@ -1,32 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - - - diff --git a/assembly/features/org.eclipse.jpt.tests.assembly.feature/license.html b/assembly/features/org.eclipse.jpt.tests.assembly.feature/license.html deleted file mode 100644 index 56445985d9..0000000000 --- a/assembly/features/org.eclipse.jpt.tests.assembly.feature/license.html +++ /dev/null @@ -1,98 +0,0 @@ - - -Eclipse.org Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

June 06, 2007

-

Usage Of Content

-

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION -AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF -THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE -TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED -BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED -BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE -AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY -APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU -MAY NOT USE THE CONTENT.

-

Applicable Licenses

-

Unless otherwise indicated, all Content made available by the Eclipse -Foundation is provided to you under the terms and conditions of the Eclipse -Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this -Content and is also available at http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

-

Content includes, but is not limited to, source code, object code, -documentation and other files maintained in the Eclipse.org CVS repository -("Repository") in CVS modules ("Modules") and made available as downloadable -archives ("Downloads").

-

Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments -("Fragments"), and features ("Features"). A Feature is a bundle of one or more -Plug-ins and/or Fragments and associated material. Files named "feature.xml" may -contain a list of the names and version numbers of the Plug-ins and/or Fragments -associated with a Feature. Plug-ins and Fragments are located in directories -named "plugins" and Features are located in directories named "features".

-

Features may also include other Features ("Included Features"). Files named -"feature.xml" may contain a list of the names and version numbers of Included -Features.

-

The terms and conditions governing Plug-ins and Fragments should be contained -in files named "about.html" ("Abouts"). The terms and conditions governing -Features and Included Features should be contained in files named "license.html" -("Feature Licenses"). Abouts and Feature Licenses may be located in any -directory of a Download or Module including, but not limited to the following -locations:

- -

Note: if a Feature made available by the Eclipse Foundation is installed -using the Eclipse Update Manager, you must agree to a license ("Feature Update -License") during the installation process. If the Feature contains Included -Features, the Feature Update License should either provide you with the terms -and conditions governing the Included Features or inform you where you can -locate them. Feature Update Licenses may be found in the "license" property of -files named "feature.properties". Such Abouts, Feature Licenses and Feature -Update Licenses contain the terms and conditions (or references to such terms -and conditions) that govern your use of the associated Content in that -directory.

-

THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL -OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is -provided, please contact the Eclipse Foundation to determine what terms and -conditions govern that particular Content.

-

Cryptography

-

Content may contain encryption software. The country in which you are -currently may have restrictions on the import, possession, and use, and/or -re-export to another country, of encryption software. BEFORE using any -encryption software, please check the country's laws, regulations and policies -concerning the import, possession, or use, and re-export of encryption software, -to see if this is permitted.

diff --git a/assembly/features/org.eclipse.jpt.tests/.cvsignore b/assembly/features/org.eclipse.jpt.tests/.cvsignore deleted file mode 100644 index 2544693f86..0000000000 --- a/assembly/features/org.eclipse.jpt.tests/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -*.bin.dist.zip -build.xml -org.eclipse.jpt.tests_1.0.0.* \ No newline at end of file diff --git a/assembly/features/org.eclipse.jpt.tests/.project b/assembly/features/org.eclipse.jpt.tests/.project deleted file mode 100644 index 3d1dde631a..0000000000 --- a/assembly/features/org.eclipse.jpt.tests/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.tests - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/assembly/features/org.eclipse.jpt.tests/.settings/org.eclipse.core.resources.prefs b/assembly/features/org.eclipse.jpt.tests/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 17acb651a8..0000000000 --- a/assembly/features/org.eclipse.jpt.tests/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun May 27 15:11:05 EDT 2007 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/assembly/features/org.eclipse.jpt.tests/build.properties b/assembly/features/org.eclipse.jpt.tests/build.properties deleted file mode 100644 index 7f47694aab..0000000000 --- a/assembly/features/org.eclipse.jpt.tests/build.properties +++ /dev/null @@ -1,5 +0,0 @@ -bin.includes = feature.xml,\ - eclipse_update_120.jpg,\ - epl-v10.html,\ - license.html,\ - feature.properties diff --git a/assembly/features/org.eclipse.jpt.tests/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt.tests/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/assembly/features/org.eclipse.jpt.tests/eclipse_update_120.jpg and /dev/null differ diff --git a/assembly/features/org.eclipse.jpt.tests/epl-v10.html b/assembly/features/org.eclipse.jpt.tests/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/assembly/features/org.eclipse.jpt.tests/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/assembly/features/org.eclipse.jpt.tests/feature.properties b/assembly/features/org.eclipse.jpt.tests/feature.properties deleted file mode 100644 index 094c58ba66..0000000000 --- a/assembly/features/org.eclipse.jpt.tests/feature.properties +++ /dev/null @@ -1,170 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Dali Java Persistence API (JPA) project Tests - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse.org - -# "updateSiteName" property - label for the update site -updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site - -# "description" property - description of the feature -description=Dali Java Persistence API (JPA) project Tests - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/assembly/features/org.eclipse.jpt.tests/feature.xml b/assembly/features/org.eclipse.jpt.tests/feature.xml deleted file mode 100644 index 020fa447a7..0000000000 --- a/assembly/features/org.eclipse.jpt.tests/feature.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - diff --git a/assembly/features/org.eclipse.jpt.tests/license.html b/assembly/features/org.eclipse.jpt.tests/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/assembly/features/org.eclipse.jpt.tests/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- - - -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- - - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/assembly/features/org.eclipse.jpt/.cvsignore b/assembly/features/org.eclipse.jpt/.cvsignore deleted file mode 100644 index de8b73fb72..0000000000 --- a/assembly/features/org.eclipse.jpt/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -build.xml -org.eclipse.jpt_1.0.0.* diff --git a/assembly/features/org.eclipse.jpt/.project b/assembly/features/org.eclipse.jpt/.project deleted file mode 100644 index b7aaec2f54..0000000000 --- a/assembly/features/org.eclipse.jpt/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/assembly/features/org.eclipse.jpt/build.properties b/assembly/features/org.eclipse.jpt/build.properties deleted file mode 100644 index 470b4bcb63..0000000000 --- a/assembly/features/org.eclipse.jpt/build.properties +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -bin.includes = feature.xml,\ - eclipse_update_120.jpg,\ - epl-v10.html,\ - license.html,\ - feature.properties - \ No newline at end of file diff --git a/assembly/features/org.eclipse.jpt/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/assembly/features/org.eclipse.jpt/eclipse_update_120.jpg and /dev/null differ diff --git a/assembly/features/org.eclipse.jpt/epl-v10.html b/assembly/features/org.eclipse.jpt/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/assembly/features/org.eclipse.jpt/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/assembly/features/org.eclipse.jpt/feature.properties b/assembly/features/org.eclipse.jpt/feature.properties deleted file mode 100644 index c3cd61abe6..0000000000 --- a/assembly/features/org.eclipse.jpt/feature.properties +++ /dev/null @@ -1,170 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform Project - -# "updateSiteName" property - label for the update site -updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site - -# "description" property - description of the feature -description=Eclipse Web Tools Platform Project Tools - Runtime - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006-2009 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/assembly/features/org.eclipse.jpt/feature.xml b/assembly/features/org.eclipse.jpt/feature.xml deleted file mode 100644 index b99f51d547..0000000000 --- a/assembly/features/org.eclipse.jpt/feature.xml +++ /dev/null @@ -1,42 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - - - - - - diff --git a/assembly/features/org.eclipse.jpt/license.html b/assembly/features/org.eclipse.jpt/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/assembly/features/org.eclipse.jpt/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- - - -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- - - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/.cvsignore b/assembly/features/org.eclipse.jpt_sdk.assembly.feature/.cvsignore deleted file mode 100644 index bc2abf75c1..0000000000 --- a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -*.bin.dist.zip -build.xml -features -plugins diff --git a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/.project b/assembly/features/org.eclipse.jpt_sdk.assembly.feature/.project deleted file mode 100644 index e901372085..0000000000 --- a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt_sdk.assembly.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/build.properties b/assembly/features/org.eclipse.jpt_sdk.assembly.feature/build.properties deleted file mode 100644 index e69de29bb2..0000000000 diff --git a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/eclipse_update_120.jpg b/assembly/features/org.eclipse.jpt_sdk.assembly.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/epl-v10.html b/assembly/features/org.eclipse.jpt_sdk.assembly.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/feature.properties b/assembly/features/org.eclipse.jpt_sdk.assembly.feature/feature.properties deleted file mode 100644 index 1f4dd698f5..0000000000 --- a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/feature.properties +++ /dev/null @@ -1,145 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools SDK - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - -# "updateSiteName" property - label for the update site -updateSiteName=The Eclipse Web Tools Platform (WTP) Project update site - -# "description" property - description of the feature -description=Dali Java Persistence Tools project SDK - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -ECLIPSE FOUNDATION SOFTWARE USER AGREEMENT\n\ -June 06, 2007\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the Eclipse Foundation\n\ -is provided to you under the terms and conditions of the Eclipse Public\n\ -License Version 1.0 ("EPL"). A copy of the EPL is provided with this\n\ -Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse.org CVS\n\ -repository ("Repository") in CVS modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java? ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -Features may also include other Features ("Included Features"). Files named\n\ -"feature.xml" may contain a list of the names and version numbers of\n\ -Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Eclipse Update Manager, you must agree to a license ("Feature Update\n\ -License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties". Such Abouts,\n\ -Feature Licenses and Feature Update Licenses contain the terms and\n\ -conditions (or references to such terms and conditions) that govern your\n\ -use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - IBM Public License 1.0 (available at http://oss.software.ibm.com/developerworks/opensource/license10.html)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ - - Common Development and Distribution License (CDDL) Version 1.0 (available at http://www.sun.com/cddl/cddl.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use,\n\ -and re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/feature.xml b/assembly/features/org.eclipse.jpt_sdk.assembly.feature/feature.xml deleted file mode 100644 index a859b722f9..0000000000 --- a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/feature.xml +++ /dev/null @@ -1,46 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - - - - - - - - - - diff --git a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/license.html b/assembly/features/org.eclipse.jpt_sdk.assembly.feature/license.html deleted file mode 100644 index 76abfb4621..0000000000 --- a/assembly/features/org.eclipse.jpt_sdk.assembly.feature/license.html +++ /dev/null @@ -1,98 +0,0 @@ - - -Eclipse.org Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

June 06, 2007

-

Usage Of Content

-

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION -AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT"). USE OF -THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE -TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED -BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED -BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE -AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS OF ANY -APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU -MAY NOT USE THE CONTENT.

-

Applicable Licenses

-

Unless otherwise indicated, all Content made available by the Eclipse -Foundation is provided to you under the terms and conditions of the Eclipse -Public License Version 1.0 ("EPL"). A copy of the EPL is provided with this -Content and is also available at http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

-

Content includes, but is not limited to, source code, object code, -documentation and other files maintained in the Eclipse.org CVS repository -("Repository") in CVS modules ("Modules") and made available as downloadable -archives ("Downloads").

-

Content may be apportioned into plug-ins ("Plug-ins"), plug-in fragments -("Fragments"), and features ("Features"). A Feature is a bundle of one or more -Plug-ins and/or Fragments and associated material. Files named "feature.xml" may -contain a list of the names and version numbers of the Plug-ins and/or Fragments -associated with a Feature. Plug-ins and Fragments are located in directories -named "plugins" and Features are located in directories named "features".

-

Features may also include other Features ("Included Features"). Files named -"feature.xml" may contain a list of the names and version numbers of Included -Features.

-

The terms and conditions governing Plug-ins and Fragments should be contained -in files named "about.html" ("Abouts"). The terms and conditions governing -Features and Included Features should be contained in files named "license.html" -("Feature Licenses"). Abouts and Feature Licenses may be located in any -directory of a Download or Module including, but not limited to the following -locations:

- -

Note: if a Feature made available by the Eclipse Foundation is installed -using the Eclipse Update Manager, you must agree to a license ("Feature Update -License") during the installation process. If the Feature contains Included -Features, the Feature Update License should either provide you with the terms -and conditions governing the Included Features or inform you where you can -locate them. Feature Update Licenses may be found in the "license" property of -files named "feature.properties". Such Abouts, Feature Licenses and Feature -Update Licenses contain the terms and conditions (or references to such terms -and conditions) that govern your use of the associated Content in that -directory.

-

THE ABOUTS, FEATURE LICENSES AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL -OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR -TO USE OF THE CONTENT. If no About, Feature License or Feature Update License is -provided, please contact the Eclipse Foundation to determine what terms and -conditions govern that particular Content.

-

Cryptography

-

Content may contain encryption software. The country in which you are -currently may have restrictions on the import, possession, and use, and/or -re-export to another country, of encryption software. BEFORE using any -encryption software, please check the country's laws, regulations and policies -concerning the import, possession, or use, and re-export of encryption software, -to see if this is permitted.

diff --git a/assembly/plugins/org.eclipse.jpt/.cvsignore b/assembly/plugins/org.eclipse.jpt/.cvsignore deleted file mode 100644 index c9401a2c83..0000000000 --- a/assembly/plugins/org.eclipse.jpt/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -build.xml -org.eclipse.jpt_1.0.0.* \ No newline at end of file diff --git a/assembly/plugins/org.eclipse.jpt/.project b/assembly/plugins/org.eclipse.jpt/.project deleted file mode 100644 index f51b04cc90..0000000000 --- a/assembly/plugins/org.eclipse.jpt/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.eclipse.jpt - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/assembly/plugins/org.eclipse.jpt/.settings/org.eclipse.core.resources.prefs b/assembly/plugins/org.eclipse.jpt/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 4aec29d1cd..0000000000 --- a/assembly/plugins/org.eclipse.jpt/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun May 27 15:10:09 EDT 2007 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/assembly/plugins/org.eclipse.jpt/META-INF/MANIFEST.MF b/assembly/plugins/org.eclipse.jpt/META-INF/MANIFEST.MF deleted file mode 100644 index a5fbedd077..0000000000 --- a/assembly/plugins/org.eclipse.jpt/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.jpt; singleton:=true -Bundle-Version: 2.3.1.qualifier -Bundle-Localization: plugin -Bundle-Vendor: %providerName diff --git a/assembly/plugins/org.eclipse.jpt/about.html b/assembly/plugins/org.eclipse.jpt/about.html deleted file mode 100644 index ca606b1bb5..0000000000 --- a/assembly/plugins/org.eclipse.jpt/about.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

June 06, 2007

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- - - \ No newline at end of file diff --git a/assembly/plugins/org.eclipse.jpt/about.ini b/assembly/plugins/org.eclipse.jpt/about.ini deleted file mode 100644 index 588a325a8f..0000000000 --- a/assembly/plugins/org.eclipse.jpt/about.ini +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=eclipse32.gif - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - -# Property "tipsAndTricksHref" contains the Help topic href to a tips and tricks page -# optional -tipsAndTricksHref=/org.eclipse.jpt.doc.user/tips_and_tricks.htm - - diff --git a/assembly/plugins/org.eclipse.jpt/about.mappings b/assembly/plugins/org.eclipse.jpt/about.mappings deleted file mode 100644 index bddaab4310..0000000000 --- a/assembly/plugins/org.eclipse.jpt/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ \ No newline at end of file diff --git a/assembly/plugins/org.eclipse.jpt/about.properties b/assembly/plugins/org.eclipse.jpt/about.properties deleted file mode 100644 index c74a186a13..0000000000 --- a/assembly/plugins/org.eclipse.jpt/about.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. - -blurb=Dali Java Persistence Tools\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Eclipse contributors and others 2006. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools diff --git a/assembly/plugins/org.eclipse.jpt/build.properties b/assembly/plugins/org.eclipse.jpt/build.properties deleted file mode 100644 index 0ccfb0ebb8..0000000000 --- a/assembly/plugins/org.eclipse.jpt/build.properties +++ /dev/null @@ -1,19 +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 -############################################################################### -bin.includes = META-INF/,\ - about.ini,\ - about.html,\ - about.mappings,\ - about.properties,\ - eclipse32.gif,\ - eclipse32.png,\ - plugin.properties,\ - component.xml diff --git a/assembly/plugins/org.eclipse.jpt/component.xml b/assembly/plugins/org.eclipse.jpt/component.xml deleted file mode 100644 index 11f133f65a..0000000000 --- a/assembly/plugins/org.eclipse.jpt/component.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - \ No newline at end of file diff --git a/assembly/plugins/org.eclipse.jpt/eclipse32.gif b/assembly/plugins/org.eclipse.jpt/eclipse32.gif deleted file mode 100644 index e6ad7ccd75..0000000000 Binary files a/assembly/plugins/org.eclipse.jpt/eclipse32.gif and /dev/null differ diff --git a/assembly/plugins/org.eclipse.jpt/eclipse32.png b/assembly/plugins/org.eclipse.jpt/eclipse32.png deleted file mode 100644 index 568fac1d05..0000000000 Binary files a/assembly/plugins/org.eclipse.jpt/eclipse32.png and /dev/null differ diff --git a/assembly/plugins/org.eclipse.jpt/plugin.properties b/assembly/plugins/org.eclipse.jpt/plugin.properties deleted file mode 100644 index c3c055a778..0000000000 --- a/assembly/plugins/org.eclipse.jpt/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools -providerName = Eclipse.org diff --git a/common/plugins/org.eclipse.jpt.common.core/.classpath b/common/plugins/org.eclipse.jpt.common.core/.classpath deleted file mode 100644 index 934fb38085..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/.classpath +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/common/plugins/org.eclipse.jpt.common.core/.project b/common/plugins/org.eclipse.jpt.common.core/.project deleted file mode 100644 index 5513a1552d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.jpt.common.core - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/common/plugins/org.eclipse.jpt.common.core/.settings/org.eclipse.jdt.core.prefs b/common/plugins/org.eclipse.jpt.common.core/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 4743c715ac..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Fri Jan 21 15:45:07 EST 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -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/common/plugins/org.eclipse.jpt.common.core/META-INF/MANIFEST.MF b/common/plugins/org.eclipse.jpt.common.core/META-INF/MANIFEST.MF deleted file mode 100644 index 075f6c4c68..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/META-INF/MANIFEST.MF +++ /dev/null @@ -1,63 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.common.core;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Activator: org.eclipse.jpt.common.core.JptCommonCorePlugin -Bundle-ActivationPolicy: lazy -Bundle-ClassPath: . -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)", - org.eclipse.core.filebuffers;bundle-version="[3.4.0,4.0.0)", - org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)", - org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)", - org.eclipse.debug.core;bundle-version="[3.4.0,4.0.0)", - org.eclipse.emf.ecore.xmi;bundle-version="[2.4.0,3.0.0)", - org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jdt.launching;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)", - org.eclipse.jst.common.project.facet.core;bundle-version="[1.3.100,2.0.0)", - org.eclipse.jst.j2ee;bundle-version="[1.1.200,2.0.0)", - org.eclipse.pde.core;bundle-version="[3.6.0,4.0.0)";resolution:=optional, - org.eclipse.text;bundle-version="[3.5.100,4.0.0)", - org.eclipse.wst.common.emf;bundle-version="[1.1.200,2.0.0)", - org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,2.0.0)", - org.eclipse.wst.common.project.facet.core;bundle-version="[1.3.0,2.0.0)", - org.eclipse.wst.validation;bundle-version="[1.2.0,2.0.0)" -Export-Package: org.eclipse.jpt.common.core, - org.eclipse.jpt.common.core.internal; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.jaxb.core", - org.eclipse.jpt.common.core.internal.gen; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.jaxb.core", - org.eclipse.jpt.common.core.internal.libprov; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.jaxb.core", - org.eclipse.jpt.common.core.internal.libval; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.jaxb.core", - org.eclipse.jpt.common.core.internal.operations; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.jaxb.core", - org.eclipse.jpt.common.core.internal.resource; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.jaxb.core", - org.eclipse.jpt.common.core.internal.utility; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.jaxb.core", - org.eclipse.jpt.common.core.internal.utility.jdt; - x-friends:="org.eclipse.jpt.common.ui, - org.eclipse.jpt.jpa.core, - org.eclipse.jpt.jaxb.core", - org.eclipse.jpt.common.core.internal.utility.translators; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.jaxb.core", - org.eclipse.jpt.common.core.libprov, - org.eclipse.jpt.common.core.libval, - org.eclipse.jpt.common.core.resource, - org.eclipse.jpt.common.core.utility, - org.eclipse.jpt.common.core.utility.jdt -Import-Package: com.ibm.icu.text;version="4.0.1" diff --git a/common/plugins/org.eclipse.jpt.common.core/about.html b/common/plugins/org.eclipse.jpt.common.core/about.html deleted file mode 100644 index be534ba44f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/about.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

May 02, 2008

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- - - diff --git a/common/plugins/org.eclipse.jpt.common.core/build.properties b/common/plugins/org.eclipse.jpt.common.core/build.properties deleted file mode 100644 index 750874fe97..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/build.properties +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# Copyright (c) 2011 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ -javacSource=1.5 -javacTarget=1.5 -source.. = src/,\ - property_files/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - about.html,\ - plugin.xml,\ - plugin.properties -jars.compile.order = . -src.includes = schema/ diff --git a/common/plugins/org.eclipse.jpt.common.core/plugin.properties b/common/plugins/org.eclipse.jpt.common.core/plugin.properties deleted file mode 100644 index a38a4a43c3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/plugin.properties +++ /dev/null @@ -1,31 +0,0 @@ -############################################################################### -# Copyright (c) 2011 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# ==================================================================== -# 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 = Dali Java Persistence Tools - Common Core -providerName = Eclipse Web Tools Platform - -LIBRARY_VALIDATORS=Library Validators -RESOURCE_LOCATORS=Resource Locators - -JAR_CONTENT = JAR Content -JAVA_PACKAGE_INFO_CONTENT = package-info.java - -NO_OP_LIBRARY_PROVIDER_WARNING = Library configuration is disabled. The user may need to configure further classpath changes later. diff --git a/common/plugins/org.eclipse.jpt.common.core/plugin.xml b/common/plugins/org.eclipse.jpt.common.core/plugin.xml deleted file mode 100644 index 0fe4f7e514..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/plugin.xml +++ /dev/null @@ -1,156 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/common/plugins/org.eclipse.jpt.common.core/property_files/jpt_common_core.properties b/common/plugins/org.eclipse.jpt.common.core/property_files/jpt_common_core.properties deleted file mode 100644 index e474609500..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/property_files/jpt_common_core.properties +++ /dev/null @@ -1,23 +0,0 @@ -################################################################################ -# Copyright (c) 2011 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ -DALI_EVENT_HANDLER_THREAD_NAME=Dali Event Handler -GENERATION_CREATING_LAUNCH_CONFIG_TASK=Creating launch configuration -GENERATION_SAVING_LAUNCH_CONFIG_TASK=Saving launch configuration -GENERATION_LAUNCHING_CONFIG_TASK=Launching configuration -REGISTRY_MISSING_ATTRIBUTE=Missing required attribute ''{0}'' for element ''{1}'' in extension ''{1}'' from plug-in ''{2}''. -REGISTRY_INVALID_VALUE=Invalid value ''{0}'' for ''{1}'' in extension ''{2}'' from plug-in ''{3}''. -REGISTRY_DUPLICATE=An extension of ''{0}'' with the ''{1}'' value of ''{2}'' is already registered. -REGISTRY_FAILED_CLASS_LOAD=Unable to load the class ''{0}'' declared for the extension point ''{1}'' in the plug-in ''{2}''. -REGISTRY_FAILED_INTERFACE_ASSIGNMENT=Unable to assign the class ''{0}'' declared for the extension point ''{1}'' in the plug-in ''{2}'' to the interface ''{3}''. -REGISTRY_FAILED_INSTANTIATION=Unable to instantiate the class ''{0}'' declared for the extension point ''{1}'' in the plug-in ''{2}''. -USER_LIBRARY_VALIDATOR__CLASS_NOT_FOUND=The class ''{0}'' is required to be in the selected libraries. -VALIDATE_CONTAINER_NOT_SPECIFIED=Parent folder must be specified -VALIDATE_FILE_NAME_NOT_SPECIFIED=File name must be specified -VALIDATE_FILE_ALREADY_EXISTS=File already exist \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.core/schema/libraryValidators.exsd b/common/plugins/org.eclipse.jpt.common.core/schema/libraryValidators.exsd deleted file mode 100644 index abfe03b046..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/schema/libraryValidators.exsd +++ /dev/null @@ -1,154 +0,0 @@ - - - - - - - - - Used to provide custom library validation to JPT project configuration. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Declares a library validator. See <samp>org.eclipse.jpt.core.libval.LibraryValidator</samp> for more information on library validators. - - - - - - - - - - A unique identifier for the declared library validator. - - - - - - - The implementation class, which implements <samp>org.eclipse.jpt.core.libval.LibraryValidator</samp>. - - - - - - - - - - - - - - - JPT 3.0 - - - - - - - - - <br> -<p> -The following example is the included generic library validator, which is used for user library validation for projects of the generic JPA platform group. -<p> -<pre> -<extension - point="org.eclipse.jpt.common.core.libraryValidators"> - <libraryValidator - id="genericUserLibraryValidator" - class="org.eclipse.jpt.core.internal.libval.GenericJpaUserLibraryValidator"> - <enablement> - <with variable="libraryProvider"> - <test property="org.eclipse.jpt.core.extendsId" value="jpa-user-library-provider"/> - </with> - </enablement> - </libraryValidator> -</extension> -</pre> -</p> - - - - - - - - - <p> -The contributed resource locator class must implement <code>org.eclipse.jpt.common.core.resource.ResourceLocator</code>. -<p> -The enablement variables include: -<ul> -<li>"libraryProvider" which gives the current ILibraryProvider.</li> -<li>"jpaPlatform" which gives the current JpaPlatformDescription.</li> -</ul> -</p> - - - - - - - - - <p>The org.eclipse.jpt.core plug-in provides the following library validators: -<ul> -<li>genericUserLibraryValidator</li> -<li>genericEclipselinkBundlesLibraryValidator</li> -</ul> -</p> - - - - - - - - - Copyright (c) 2010, 2011 Oracle. All rights reserved. -This program and the accompanying materials are made available under the -terms of the Eclipse Public License v1.0, which accompanies this distribution -and is available at http://www.eclipse.org/legal/epl-v10.html. - -Contributors: -Oracle - initial API and implementation - - - - diff --git a/common/plugins/org.eclipse.jpt.common.core/schema/resourceLocators.exsd b/common/plugins/org.eclipse.jpt.common.core/schema/resourceLocators.exsd deleted file mode 100644 index 5eaf59b07a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/schema/resourceLocators.exsd +++ /dev/null @@ -1,191 +0,0 @@ - - - - - - - - - Used to provide custom (non-java) resource location logic to JPT projects. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Declares a resource locator. See <samp>org.eclipse.jpt.common.core.resource.ResourceLocator</samp> for more information on resource locators. - - - - - - - - - - A unique identifier for the declared resource locator. - - - - - - - The implementation class, which implements <samp>org.eclipse.jpt.common.core.resource.ResourceLocator</samp>. - - - - - - - - - - Indicates the relative priority of this extension to other extensions. Used by the resource locator manager to determine which extension should be used in the case that multiple extensions apply to a given project. Defaults to "normal". - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - JPT 3.0 - - - - - - - - - <br> -<p> -The following example is the included simple java resource locator, which is used for simple java projects. It is of "lowest" priority, since all JPT projects will at their roots be simple java projects. -<p> -<pre> -<extension - point="org.eclipse.jpt.common.core.resourceLocators"> - <resourceLocator - id="simpleJavaResourceLocator" - class="org.eclipse.jpt.common.core.internal.resource.SimpleJavaResourceLocator" - priority="lowest" - <enablement> - <with variable="project"> - <test property="org.eclipse.wst.common.project.facet.core.projectFacet" value="java" forcePluginActivation="true"/> - </with> - </enablement> - </resourceLocator> -</extension> -</pre> -</p> - - - - - - - - - <p> -The contributed resource locator class must implement <code>org.eclipse.jpt.co9mmon.core.resource.ResourceLocator</code>. -<p> -The enablement variables include: -<ul> -<li>"project" which gives the current IProject.</li> -</ul> -</p> - - - - - - - - - <p>The org.eclipse.jpt.common.core plug-in provides the following resource locators: -<ul> -<li>simpleJavaResourceLocator</li> -<li>moduleResourceLocator</li> -<li>webModuleResourceLocator</li> -<li>pluginResourceLocator</li> -</ul> -</p> - - - - - - - - - Copyright (c) 2011 Oracle. All rights reserved. -This program and the accompanying materials are made available under the -terms of the Eclipse Public License v1.0, which accompanies this distribution -and is available at http://www.eclipse.org/legal/epl-v10.html. - -Contributors: -Oracle - initial API and implementation - - - - diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/IResourcePart.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/IResourcePart.java deleted file mode 100644 index e5e6a4251a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/IResourcePart.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core; - -import org.eclipse.core.resources.IResource; - - -/** - * Represents an object that can be described as being part of an {@link IResource} - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.1 - */ -public interface IResourcePart -{ - /** - * Return the resource of which this object is a part - */ - IResource getResource(); -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptCommonCorePlugin.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptCommonCorePlugin.java deleted file mode 100644 index a615cc78e1..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptCommonCorePlugin.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jpt.common.core.internal.libval.LibraryValidatorManager; -import org.eclipse.jpt.common.core.internal.resource.ResourceLocatorManager; -import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.common.core.libval.LibraryValidator; -import org.eclipse.jpt.common.core.resource.ResourceLocator; -import org.osgi.framework.BundleContext; - -public class JptCommonCorePlugin - extends Plugin -{ - - // ********** public constants ********** - - /** - * The plug-in identifier of the jpt common core support - * (value "org.eclipse.jpt.common.core"). - */ - public static final String PLUGIN_ID = "org.eclipse.jpt.common.core"; //$NON-NLS-1$ - public static final String PLUGIN_ID_ = PLUGIN_ID + '.'; - - - /** - * The content type for Java source code files. - */ - public static final IContentType JAVA_SOURCE_CONTENT_TYPE = getContentType(JavaCore.JAVA_SOURCE_CONTENT_TYPE); - - /** - * The resource type for Java source code files - */ - public static final JptResourceType JAVA_SOURCE_RESOURCE_TYPE = new JptResourceType(JAVA_SOURCE_CONTENT_TYPE); - - /** - * The content type for Java archives (JARs). - */ - public static final IContentType JAR_CONTENT_TYPE = getJptContentType("jar"); //$NON-NLS-1$ - - /** - * The resource type for Java archives (JARs). - */ - public static final JptResourceType JAR_RESOURCE_TYPE = new JptResourceType(JptCommonCorePlugin.JAR_CONTENT_TYPE); - - /** - * The content type for package-info Java code files. - */ - public static final IContentType JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE = getJptContentType("javaPackageInfo"); //$NON-NLS-1$ - - /** - * The resource type for package-info Java code files - */ - public static final JptResourceType JAVA_SOURCE_PACKAGE_INFO_RESOURCE_TYPE = new JptResourceType(JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE); - - - private static final String JPT_CONTENT_PREFIX = PLUGIN_ID_ + "content"; //$NON-NLS-1$ - - private static final String JPT_CONTENT_PREFIX_ = JPT_CONTENT_PREFIX + '.'; - - private static IContentType getJptContentType(String jptContentType) { - return getContentType(JPT_CONTENT_PREFIX_ + jptContentType); - } - - private static IContentType getContentType(String contentType) { - return Platform.getContentTypeManager().getContentType(contentType); - } - - public static ResourceLocator getResourceLocator(IProject project) { - return ResourceLocatorManager.instance().getResourceLocator(project); - } - - public static IFile getPlatformFile(IProject project, IPath runtimePath) { - ResourceLocator resourceLocator = getResourceLocator(project); - if (resourceLocator == null) { - return null; - } - IPath sourcePath = resourceLocator.getResourcePath(project, runtimePath); - if (sourcePath == null) { - return null; - } - return project.getWorkspace().getRoot().getFile(sourcePath); - } - - public static Iterable getLibraryValidators( - JptLibraryProviderInstallOperationConfig config) { - return LibraryValidatorManager.instance().getLibraryValidators(config); - } - - // ********** singleton ********** - - private static JptCommonCorePlugin INSTANCE; - - /** - * Return the singleton jpt common core plug-in. - */ - public static JptCommonCorePlugin instance() { - return INSTANCE; - } - - - // ********** public static methods ********** - - /** - * Log the specified status. - */ - public static void log(IStatus status) { - INSTANCE.getLog().log(status); - } - - /** - * Log the specified message. - */ - public static void log(String msg) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null)); - } - - /** - * Log the specified exception or error. - */ - public static void log(Throwable throwable) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable)); - } - - - // ********** plug-in implementation ********** - - public JptCommonCorePlugin() { - super(); - if (INSTANCE != null) { - throw new IllegalStateException(); - } - // this convention is *wack*... ~bjv - INSTANCE = this; - } - - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - // nothing yet... - } - - @Override - public void stop(BundleContext context) throws Exception { - super.stop(context); - // nothing yet... - } - -} - diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceModel.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceModel.java deleted file mode 100644 index db1cf21f26..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceModel.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core; - -/** - * Listeners are notified whenever anything in the JPT resource model changes. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.2 - */ -public interface JptResourceModel { - - /** - * Return the resource type of the model. This may potentially change. - * Return null if it cannot be determined, the content type or version is null. - */ - JptResourceType getResourceType(); - - /** - * Changes to the resource model result in events. - * In particular, the JPA project performs an "update" whenever a resource - * model changes. - */ - void addResourceModelListener(JptResourceModelListener listener); - - /** - * @see #addResourceModelListener(ResourceModelListener) - */ - void removeResourceModelListener(JptResourceModelListener listener); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceModelListener.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceModelListener.java deleted file mode 100644 index a0d0d3f046..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceModelListener.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core; - -import java.util.EventListener; - -/** - * The listener is notified whenever anything in the JPA resource model changes. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.2 - */ -public interface JptResourceModelListener - extends EventListener -{ - void resourceModelChanged(JptResourceModel jpaResourceModel); - - void resourceModelReverted(JptResourceModel jpaResourceModel); - - void resourceModelUnloaded(JptResourceModel jpaResourceModel); -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceType.java deleted file mode 100644 index e86355e266..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/JptResourceType.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core; - -import org.eclipse.core.runtime.content.IContentType; - -/** - * Describes the file content type and version for JPA resources. - * This is a value object that defines an {@link #equals(Object)} method. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public class JptResourceType -{ - private final IContentType contentType; - - private final String version; - - - /** - * Version used when version can not be determined or when there is no - * sense of version (e.g. Java). - */ - public static final String UNDETERMINED_VERSION = ""; //$NON-NLS-1$ - - - public JptResourceType(IContentType contentType) { - this(contentType, UNDETERMINED_VERSION); - } - - public JptResourceType(IContentType contentType, String version) { - super(); - if (contentType == null) { - throw new NullPointerException("content type"); //$NON-NLS-1$ - } - if (version == null) { - throw new NullPointerException("version"); //$NON-NLS-1$ - } - this.contentType = contentType; - this.version = version; - } - - - public IContentType getContentType() { - return this.contentType; - } - - public String getVersion() { - return this.version; - } - - @Override - public boolean equals(Object obj) { - if (obj == this) { - return true; - } - if ((obj == null) || (obj.getClass() != this.getClass())) { - return false; - } - JptResourceType other = (JptResourceType) obj; - return this.contentType.equals(other.contentType) && this.version.equals(other.version); - } - - @Override - public int hashCode() { - final int prime = 31; - int hash = 17; - hash = hash * prime + this.contentType.hashCode(); - hash = hash * prime + this.version.hashCode(); - return hash; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(this.getClass().getSimpleName()); - sb.append("(content = "); //$NON-NLS-1$ - sb.append(this.contentType); - sb.append(", "); //$NON-NLS-1$ - sb.append("version = "); //$NON-NLS-1$ - sb.append(this.version); - sb.append(')'); - return sb.toString(); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptCommonCoreMessages.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptCommonCoreMessages.java deleted file mode 100644 index 5a7511d6e9..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/JptCommonCoreMessages.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * Localized messages used by Dali common core. - */ -public class JptCommonCoreMessages { - - - public static String DALI_EVENT_HANDLER_THREAD_NAME; - public static String GENERATION_CREATING_LAUNCH_CONFIG_TASK; - public static String GENERATION_SAVING_LAUNCH_CONFIG_TASK; - public static String GENERATION_LAUNCHING_CONFIG_TASK; - public static String REGISTRY_MISSING_ATTRIBUTE; - public static String REGISTRY_INVALID_VALUE; - public static String REGISTRY_DUPLICATE; - public static String REGISTRY_FAILED_CLASS_LOAD; - public static String REGISTRY_FAILED_INTERFACE_ASSIGNMENT; - public static String REGISTRY_FAILED_INSTANTIATION; - public static String USER_LIBRARY_VALIDATOR__CLASS_NOT_FOUND;; - public static String VALIDATE_CONTAINER_NOT_SPECIFIED; - public static String VALIDATE_FILE_NAME_NOT_SPECIFIED; - public static String VALIDATE_FILE_ALREADY_EXISTS; - - private static final String BUNDLE_NAME = "jpt_common_core"; //$NON-NLS-1$ - private static final Class BUNDLE_CLASS = JptCommonCoreMessages.class; - static { - NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS); - } - - private JptCommonCoreMessages() { - throw new UnsupportedOperationException(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/ResourceAdapterFactory.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/ResourceAdapterFactory.java deleted file mode 100644 index 16c22cb19e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/ResourceAdapterFactory.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.jpt.common.core.IResourcePart; - -/** - * Factory to build adapters for Eclipse resources: - * - resource part - * - * See org.eclipse.jpt.common.core plugin.xml. - */ -public class ResourceAdapterFactory - implements IAdapterFactory -{ - private static final Class[] ADAPTER_LIST = new Class[] { IResourcePart.class }; - - public Class[] getAdapterList() { - return ADAPTER_LIST; - } - - public Object getAdapter(Object adaptableObject, @SuppressWarnings("unchecked") Class adapterType) { - if (adaptableObject instanceof IResource) { - return this.getAdapter((IResource) adaptableObject, adapterType); - } - return null; - } - - private Object getAdapter(final IResource resource, Class adapterType) { - if (adapterType == IResourcePart.class) { - return new IResourcePart() { - public IResource getResource() { - return resource; - } - }; - } - return null; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/XPointUtil.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/XPointUtil.java deleted file mode 100644 index 81a9d963c4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/XPointUtil.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal; - -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.osgi.util.NLS; -import org.osgi.framework.Bundle; - -/** - * Utilities for extension point management, validation, etc. - */ -public class XPointUtil { - - public static String findRequiredAttribute( - IConfigurationElement configElement, String attributeName) - throws XPointException { - - String val = configElement.getAttribute(attributeName); - if (val == null) { - logMissingAttribute(configElement, attributeName); - throw new XPointException(); - } - return val; - } - - public static T instantiate( - String pluginId, String extensionPoint, String className, Class interfaze) { - - Class clazz = loadClass(pluginId, extensionPoint, className, interfaze); - if (clazz == null) { - return null; - } - return instantiate(pluginId, extensionPoint, clazz); - } - - public static T instantiate(String pluginId, String extensionPoint, Class clazz) { - - try { - return clazz.newInstance(); - } - catch (Exception e) { - logFailedInstantiation(pluginId, extensionPoint, clazz.getName()); - return null; - } - } - - public static Class loadClass( - String pluginId, String extensionPoint, String className, Class interfaze) { - - Bundle bundle = Platform.getBundle(pluginId); - Class clazz; - - try { - clazz = bundle.loadClass(className); - } - catch (Exception e) { - logFailedClassLoad(pluginId, extensionPoint, className); - return null; - } - - if (interfaze != null && ! interfaze.isAssignableFrom(clazz)) { - logFailedInterfaceAssignment(pluginId, extensionPoint, className, interfaze.getName()); - return null; - } - - return (Class) clazz; - } - - public static void logDuplicateExtension(String extensionPoint, String nodeName, String value) { - - log(JptCommonCoreMessages.REGISTRY_DUPLICATE, extensionPoint, nodeName, value); - } - - public static void logMissingAttribute( - IConfigurationElement configElement, String attributeName) { - - log(JptCommonCoreMessages.REGISTRY_MISSING_ATTRIBUTE, - attributeName, - configElement.getName(), - configElement.getDeclaringExtension().getExtensionPointUniqueIdentifier(), - configElement.getContributor().getName()); - } - - public static void logInvalidValue( - IConfigurationElement configElement, String nodeName, String invalidValue) { - - log(JptCommonCoreMessages.REGISTRY_INVALID_VALUE, - invalidValue, - nodeName, - configElement.getDeclaringExtension().getExtensionPointUniqueIdentifier(), - configElement.getContributor().getName()); - } - - private static void logFailedClassLoad(String pluginId, String extensionPoint, String className) { - - log(JptCommonCoreMessages.REGISTRY_FAILED_CLASS_LOAD, - className, - extensionPoint, - pluginId); - } - - private static void logFailedInterfaceAssignment( - String pluginId, String extensionPoint, String className, String interfaceName) { - - log(JptCommonCoreMessages.REGISTRY_FAILED_INTERFACE_ASSIGNMENT, - className, - extensionPoint, - pluginId, - interfaceName); - } - - private static void logFailedInstantiation(String pluginId, String extensionPoint, String className) { - - log(JptCommonCoreMessages.REGISTRY_FAILED_INSTANTIATION, - className, - extensionPoint, - pluginId); - } - - public static void log(String msg, String... bindings) { - JptCommonCorePlugin.log(NLS.bind(msg, bindings)); - } - - public static void log(Exception e) { - JptCommonCorePlugin.log(e); - } - - - public static final class XPointException - extends Exception { - - private static final long serialVersionUID = 1L; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java deleted file mode 100644 index eeee457a07..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/gen/AbstractJptGenerator.java +++ /dev/null @@ -1,369 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2008, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.common.core.internal.gen; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.FileLocator; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.debug.core.DebugPlugin; -import org.eclipse.debug.core.ILaunch; -import org.eclipse.debug.core.ILaunchConfiguration; -import org.eclipse.debug.core.ILaunchConfigurationType; -import org.eclipse.debug.core.ILaunchConfigurationWorkingCopy; -import org.eclipse.debug.core.ILaunchManager; -import org.eclipse.debug.core.ILaunchesListener2; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; -import org.eclipse.jdt.launching.IRuntimeClasspathEntry; -import org.eclipse.jdt.launching.IVMInstall; -import org.eclipse.jdt.launching.JavaRuntime; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages; -import org.eclipse.osgi.service.datalocation.Location; -import org.osgi.framework.Bundle; - -public abstract class AbstractJptGenerator -{ - public static final String PLUGINS_DIR = "plugins/"; //$NON-NLS-1$ - - private IVMInstall jre; - protected ILaunchConfigurationWorkingCopy launchConfig; - private ILaunch launch; - - protected final IJavaProject javaProject; - protected final String projectLocation; - - private final boolean isDebug = true; - - // ********** constructors ********** - - protected AbstractJptGenerator(IJavaProject javaProject) { - super(); - this.javaProject = javaProject; - this.projectLocation = javaProject.getProject().getLocation().toString(); - this.initialize(); - } - - // ********** abstract methods ********** - - protected abstract String getMainType(); - - protected abstract String getLaunchConfigName(); - - protected String getBootstrapJarPrefix() { - throw new RuntimeException("Bootstrap JAR not specified."); //$NON-NLS-1$; - } - - protected abstract void specifyProgramArguments(); - - protected abstract List buildClasspath() throws CoreException; - - // ********** behavior ********** - - protected void initialize() { - try { - this.jre = this.getProjectJRE(); - if (this.jre == null) { - String message = "Could not identify the VM."; //$NON-NLS-1$ - throw new RuntimeException(message); - } - this.launchConfig = this.buildLaunchConfiguration(); - } - catch (CoreException e) { - throw new RuntimeException(e); - } - } - - protected void generate(IProgressMonitor monitor) { - SubMonitor sm = SubMonitor.convert(monitor, 10); - this.preGenerate(sm.newChild(2)); - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - sm.subTask(JptCommonCoreMessages.GENERATION_CREATING_LAUNCH_CONFIG_TASK); - this.initializeLaunchConfiguration(); - sm.worked(1); - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - - this.addLaunchListener(); - sm.worked(1); - - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - this.launch = this.saveAndLaunchConfig(sm.newChild(6)); - } - - private void initializeLaunchConfiguration() { - this.specifyJRE(); - - this.specifyProject(); - this.specifyMainType(); - - this.specifyProgramArguments(); - this.specifyWorkingDir(); - - this.specifyClasspathProperties(); - } - - private void addLaunchListener() { - - this.getLaunchManager().addLaunchListener(this.buildLaunchListener()); - } - - protected abstract void preGenerate(IProgressMonitor monitor); - - protected void postGenerate() { - try { - if( ! this.isDebug) { - this.removeLaunchConfiguration(); - } - } - catch(CoreException e) { - throw new RuntimeException(e); - } - } - - private ILaunchesListener2 buildLaunchListener() { - return new ILaunchesListener2() { - - public void launchesTerminated(ILaunch[] launches) { - for(int i = 0; i < launches.length; i++) { - ILaunch launch = launches[i]; - if (launch.equals(AbstractJptGenerator.this.getLaunch())) { - - AbstractJptGenerator.this.postGenerate(); - return; - } - } - } - - public void launchesAdded(ILaunch[] launches) { - // not interested to this event - } - - public void launchesChanged(ILaunch[] launches) { - // not interested to this event - } - - public void launchesRemoved(ILaunch[] launches) { - // not interested to this event - } - }; - } - - // ********** Setting Launch Configuration ********** - - private void specifyJRE() { - String jreName = this.jre.getName(); - String vmId = this.jre.getVMInstallType().getId(); - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, jreName); - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_JRE_CONTAINER_PATH, vmId); - } - - private void specifyProject() { - String projectName = this.getProject().getName(); - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, projectName); - } - - protected IProject getProject() { - return this.javaProject.getProject(); - } - - private void specifyMainType() { - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME, this.getMainType()); - } - - protected void specifyClasspathProperties() { - List classpath; - try { - classpath = this.buildClasspath(); - } - catch (CoreException e) { - throw new RuntimeException("An error occured generating a memento", e); //$NON-NLS-1$ - } - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_CLASSPATH, classpath); - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_DEFAULT_CLASSPATH, false); - } - - // ********** ClasspathEntry ********** - - protected IRuntimeClasspathEntry getSystemLibraryClasspathEntry() throws CoreException { - - IPath systemLibsPath = new Path(JavaRuntime.JRE_CONTAINER); - return JavaRuntime.newRuntimeContainerClasspathEntry(systemLibsPath, IRuntimeClasspathEntry.STANDARD_CLASSES); - } - - protected IRuntimeClasspathEntry getDefaultProjectClasspathEntry() { - - IRuntimeClasspathEntry projectEntry = JavaRuntime.newDefaultProjectClasspathEntry(this.javaProject); - projectEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES); - - return projectEntry; - } - - protected static IRuntimeClasspathEntry getArchiveClasspathEntry(IPath archivePath) { - IRuntimeClasspathEntry archiveEntry = JavaRuntime.newArchiveRuntimeClasspathEntry(archivePath); - archiveEntry.setClasspathProperty(IRuntimeClasspathEntry.USER_CLASSES); - - return archiveEntry; - } - - - // ********** LaunchConfig ********** - - private ILaunch saveAndLaunchConfig(IProgressMonitor monitor) { - SubMonitor sm = SubMonitor.convert(monitor, 10); - ILaunchConfiguration configuration = null; - ILaunch result = null; - try { - sm.subTask(JptCommonCoreMessages.GENERATION_SAVING_LAUNCH_CONFIG_TASK); - configuration = this.launchConfig.doSave(); - } - catch (CoreException saveException) { - throw new RuntimeException("Could not save LaunchConfig", saveException); //$NON-NLS-1$ - } - sm.worked(1); - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - try { - sm.subTask(JptCommonCoreMessages.GENERATION_LAUNCHING_CONFIG_TASK); - result = configuration.launch(ILaunchManager.RUN_MODE, sm.newChild(9)); - } - catch (CoreException launchException) { - throw new RuntimeException("An error occured during launch", launchException); //$NON-NLS-1$ - } - return result; - } - - // ********** Main arguments ********** - - protected void appendDebugArgument(StringBuffer sb) { - if (this.isDebug) { - sb.append(" -debug"); //$NON-NLS-1$ - } - } - - // ********** Queries ********** - - protected ILaunch getLaunch() { - return this.launch; - } - - protected ILaunchManager getLaunchManager() { - return DebugPlugin.getDefault().getLaunchManager(); - } - - private IVMInstall getProjectJRE() throws CoreException { - return JavaRuntime.getVMInstall(this.javaProject); - } - - // ********** Utilities ********** - - protected IRuntimeClasspathEntry getBootstrapJarClasspathEntry() { - return getArchiveClasspathEntry(this.buildBootstrapJarPath()); - } - - protected IPath buildBootstrapJarPath() { - return this.findGenJarStartingWith(this.getBootstrapJarPrefix()); - } - - protected IPath findGenJarStartingWith(String genJarName) { - try { - File jarInstallDir = this.getBundleParentDir(JptCommonCorePlugin.PLUGIN_ID); - - List result = new ArrayList(); - this.findFileStartingWith(genJarName, jarInstallDir, result); - if (result.isEmpty()) { - throw new RuntimeException("Could not find: " + genJarName + "#.#.#v###.jar in: " + jarInstallDir); //$NON-NLS-1$ //$NON-NLS-2$ - } - File genJarFile = result.get(0); - String genJarPath = genJarFile.getCanonicalPath(); - return new Path(genJarPath); - } - catch (IOException e) { - throw new RuntimeException(e); - } - } - - // ********** private methods ********** - - private File getBundleParentDir(String bundleName) throws IOException { - - if (Platform.inDevelopmentMode()) { - Location eclipseHomeLoc = Platform.getInstallLocation(); - String eclipseHome = eclipseHomeLoc.getURL().getPath(); - if ( ! eclipseHome.endsWith(PLUGINS_DIR)) { - eclipseHome += PLUGINS_DIR; - } - return new File(eclipseHome); - } - Bundle bundle = Platform.getBundle(bundleName); - return FileLocator.getBundleFile(bundle).getParentFile(); - } - - private ILaunchConfigurationWorkingCopy buildLaunchConfiguration() throws CoreException { - this.removeLaunchConfiguration(); - - ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); - ILaunchConfigurationType type = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION); - - return type.newInstance(null, this.getLaunchConfigName()); - } - - private void removeLaunchConfiguration() throws CoreException { - - ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager(); - ILaunchConfigurationType type = manager.getLaunchConfigurationType(IJavaLaunchConfigurationConstants.ID_JAVA_APPLICATION); - - ILaunchConfiguration[] configurations = manager.getLaunchConfigurations(type); - for (int i = 0; i < configurations.length; i++) { - ILaunchConfiguration configuration = configurations[i]; - if (configuration.getName().equals(this.getLaunchConfigName())) { - configuration.delete(); - break; - } - } - } - - private void findFileStartingWith(String fileName, File directory, List list) { - if(directory.listFiles() == null) { - throw new RuntimeException("Could not find directory: " + directory); //$NON-NLS-1$ - } - for (File file : directory.listFiles()) { - if (file.getName().startsWith(fileName)) { - list.add(file); - } - if (file.isDirectory()) { - this.findFileStartingWith(fileName, file, list); - } - } - } - - private void specifyWorkingDir() { - File workingDir = new Path(this.projectLocation).toFile(); - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_WORKING_DIRECTORY, workingDir.getAbsolutePath()); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptOsgiBundlesLibraryProviderInstallOperationConfig.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptOsgiBundlesLibraryProviderInstallOperationConfig.java deleted file mode 100644 index b91c73b440..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptOsgiBundlesLibraryProviderInstallOperationConfig.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.libprov; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.common.core.libval.LibraryValidator; -import org.eclipse.jst.j2ee.internal.common.classpath.WtpOsgiBundlesLibraryProviderInstallOperationConfig; - - -public abstract class JptOsgiBundlesLibraryProviderInstallOperationConfig - extends WtpOsgiBundlesLibraryProviderInstallOperationConfig - implements JptLibraryProviderInstallOperationConfig { - - protected JptOsgiBundlesLibraryProviderInstallOperationConfig() { - super(); - } - - - @Override - public synchronized IStatus validate() { - IStatus status = super.validate(); - if (! status.isOK()) { - return status; - } - - for (LibraryValidator libraryValidator : JptCommonCorePlugin.getLibraryValidators(this)) { - status = libraryValidator.validate(this); - if (! status.isOK()) { - return status; - } - } - - return Status.OK_STATUS; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptUserLibraryProviderInstallOperationConfig.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptUserLibraryProviderInstallOperationConfig.java deleted file mode 100644 index 224f52afe2..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/JptUserLibraryProviderInstallOperationConfig.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.libprov; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.common.core.libval.LibraryValidator; -import org.eclipse.jst.j2ee.internal.common.classpath.WtpUserLibraryProviderInstallOperationConfig; - - -public abstract class JptUserLibraryProviderInstallOperationConfig - extends WtpUserLibraryProviderInstallOperationConfig - implements JptLibraryProviderInstallOperationConfig { - - protected JptUserLibraryProviderInstallOperationConfig() { - super(); - } - - - @Override - public synchronized IStatus validate() { - IStatus status = super.validate(); - if (! status.isOK()) { - return status; - } - - for (LibraryValidator libraryValidator : JptCommonCorePlugin.getLibraryValidators(this)) { - status = libraryValidator.validate(this); - if (! status.isOK()) { - return status; - } - } - - return Status.OK_STATUS; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/LibraryProviderPropertyTester.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/LibraryProviderPropertyTester.java deleted file mode 100644 index e3bb569eed..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libprov/LibraryProviderPropertyTester.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.libprov; - -import org.eclipse.core.expressions.PropertyTester; -import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider; - -public class LibraryProviderPropertyTester - extends PropertyTester { - - public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { - if (! (property.equals("id") || property.equals("extendsId")) //$NON-NLS-1$ //$NON-NLS-2$ - || ! (receiver instanceof ILibraryProvider) - || ! (expectedValue instanceof String)) { - return false; - } - - ILibraryProvider libraryProvider = (ILibraryProvider) receiver; - - if (property.equals("id")) { //$NON-NLS-1$ - return libraryProvider.getId().equals(expectedValue); - } - else if (property.equals("extendsId")) { //$NON-NLS-1$ - while (libraryProvider != null) { - if (libraryProvider.getId().equals(expectedValue)) { - return true; - } - libraryProvider = libraryProvider.getBaseProvider(); - } - } - - return false; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibValUtil.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibValUtil.java deleted file mode 100644 index 34afb0c83b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibValUtil.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.libval; - -import static org.eclipse.jst.common.project.facet.core.internal.FacetedProjectFrameworkJavaPlugin.PLUGIN_ID; -import java.io.File; -import java.io.IOException; -import java.util.Enumeration; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages; -import org.eclipse.osgi.util.NLS; - - -public class LibValUtil { - - public static IStatus validate(Iterable libraryPaths, Set classNames) { - Set classFileNames = new HashSet(); - Map classFileNameToClassName = new HashMap(); - for (String className : classNames) { - String classFileName = className.replace('.', '/') + ".class"; //$NON-NLS-1$ - classFileNames.add(classFileName); - classFileNameToClassName.put(classFileName, className); - } - - final Map classAppearanceCounts = new HashMap(); - - for (String classFileName : classFileNames) { - classAppearanceCounts.put(classFileName, 0); - } - - for (IPath libraryPath : libraryPaths) { - final File file = libraryPath.toFile(); - - if (file.exists()) { - ZipFile zip = null; - - try { - zip = new ZipFile(file); - - for (Enumeration itr = zip.entries(); itr.hasMoreElements(); ) { - final ZipEntry zipEntry = itr.nextElement(); - final String name = zipEntry.getName(); - - Integer count = classAppearanceCounts.get(name); - - if (count != null) { - classAppearanceCounts.put(name, count + 1); - } - } - } - catch (IOException e) {} - finally { - if (zip != null) { - try { - zip.close(); - } - catch (IOException e) {} - } - } - } - } - - for (Map.Entry entry : classAppearanceCounts.entrySet()) { - final int count = entry.getValue(); - - if (count == 0) { - final String classFileName = entry.getKey(); - final String className = classFileNameToClassName.get(classFileName); - final String message = - NLS.bind(JptCommonCoreMessages.USER_LIBRARY_VALIDATOR__CLASS_NOT_FOUND, className); - return new Status(IStatus.ERROR, PLUGIN_ID, message); - } - } - - return Status.OK_STATUS; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorConfig.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorConfig.java deleted file mode 100644 index 05c340df35..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorConfig.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.libval; - -import static org.eclipse.jst.common.project.facet.core.internal.FacetedProjectFrameworkJavaPlugin.log; -import org.eclipse.core.expressions.EvaluationContext; -import org.eclipse.core.expressions.EvaluationResult; -import org.eclipse.core.expressions.Expression; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jpt.common.core.internal.XPointUtil; -import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.common.core.libval.LibraryValidator; - -public class LibraryValidatorConfig { - - public static final String CONFIG_EXPR_VAR = "config"; //$NON-NLS-1$ - public static final String LIBRARY_PROVIDER_EXPR_VAR = "libraryProvider"; //$NON-NLS-1$ - - - private String id; - private String pluginId; - private String className; - private Expression enablementCondition; - - - LibraryValidatorConfig() { - super(); - } - - - public String getId() { - return this.id; - } - - void setId(String id) { - this.id = id; - } - - public String getPluginId() { - return this.pluginId; - } - - void setPluginId(String pluginId) { - this.pluginId = pluginId; - } - - public String getClassName() { - return this.className; - } - - void setClassName(String className) { - this.className = className; - } - - public Expression getEnablementCondition() { - return this.enablementCondition; - } - - void setEnablementCondition(Expression enablementCondition) { - this.enablementCondition = enablementCondition; - } - - public LibraryValidator getLibraryValidator() { - return XPointUtil.instantiate( - this.pluginId, LibraryValidatorManager.QUALIFIED_EXTENSION_POINT_ID, - this.className, LibraryValidator.class); - } - - public boolean isEnabledFor(JptLibraryProviderInstallOperationConfig config) { - EvaluationContext evalContext = new EvaluationContext(null, config); - evalContext.setAllowPluginActivation(true); - evalContext.addVariable(CONFIG_EXPR_VAR, config); - evalContext.addVariable(LIBRARY_PROVIDER_EXPR_VAR, config.getLibraryProvider()); - - if (this.enablementCondition != null) { - try { - EvaluationResult evalResult = this.enablementCondition.evaluate(evalContext); - - if (evalResult == EvaluationResult.FALSE) { - return false; - } - } - catch (CoreException e) { - log(e); - } - } - - return true; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorManager.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorManager.java deleted file mode 100644 index 3ff3679a5e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/libval/LibraryValidatorManager.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.libval; - -import static org.eclipse.jpt.common.core.internal.XPointUtil.*; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.expressions.Expression; -import org.eclipse.core.expressions.ExpressionConverter; -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.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.internal.XPointUtil.XPointException; -import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.common.core.libval.LibraryValidator; -import org.eclipse.jpt.common.utility.internal.KeyedSet; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; - -public class LibraryValidatorManager { - - public static final String EXTENSION_POINT_ID = "libraryValidators"; //$NON-NLS-1$ - public static final String QUALIFIED_EXTENSION_POINT_ID = JptCommonCorePlugin.PLUGIN_ID_ + EXTENSION_POINT_ID; - public static final String LIBRARY_VALIDATOR_ELEMENT = "libraryValidator"; //$NON-NLS-1$ - public static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$ - public static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ - public static final String ENABLEMENT_ELEMENT = "enablement"; //$NON-NLS-1$ - - - private static LibraryValidatorManager INSTANCE = new LibraryValidatorManager(); - - - public static LibraryValidatorManager instance() { - return INSTANCE; - } - - - private KeyedSet libraryValidatorConfigs; - - - private LibraryValidatorManager() { - this.libraryValidatorConfigs = new KeyedSet(); - readExtensions(); - } - - - /** - * Return the {@link LibraryValidator}s - */ - public Iterable getLibraryValidators(final JptLibraryProviderInstallOperationConfig config) { - return new FilteringIterable( - new TransformationIterable( - new FilteringIterable( - this.libraryValidatorConfigs.getItemSet()) { - @Override - protected boolean accept(LibraryValidatorConfig o) { - return o.isEnabledFor(config); - } - }) { - @Override - protected LibraryValidator transform(LibraryValidatorConfig o) { - return o.getLibraryValidator(); - } - }) { - @Override - protected boolean accept(LibraryValidator o) { - return o != null; - } - }; - } - - private void readExtensions() { - final IExtensionRegistry registry = Platform.getExtensionRegistry(); - - final IExtensionPoint xpoint - = registry.getExtensionPoint(QUALIFIED_EXTENSION_POINT_ID); - - if (xpoint == null) { - throw new IllegalStateException(); - } - - final List configs = new ArrayList(); - - for (IExtension extension : xpoint.getExtensions()) { - for (IConfigurationElement element : extension.getConfigurationElements()) { - configs.add(element); - } - } - - for (IConfigurationElement element : configs) { - if (element.getName().equals(LIBRARY_VALIDATOR_ELEMENT)) { - readExtension(element); - } - } - } - - private void readExtension(IConfigurationElement element) { - try { - final LibraryValidatorConfig lvConfig = new LibraryValidatorConfig(); - - // plug-in id - lvConfig.setPluginId(element.getContributor().getName()); - - // resource locator id - lvConfig.setId(findRequiredAttribute(element, ID_ATTRIBUTE)); - - if (this.libraryValidatorConfigs.containsKey(lvConfig.getId())) { - logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, lvConfig.getId()); - throw new XPointException(); - } - - // resource locator class name - lvConfig.setClassName(findRequiredAttribute(element, CLASS_ATTRIBUTE)); - - // enablement - for (IConfigurationElement child : element.getChildren()) { - String childName = child.getName(); - if (childName.equals(ENABLEMENT_ELEMENT)) { - Expression expr; - try { - expr = ExpressionConverter.getDefault().perform(child); - } - catch (CoreException e) { - log(e); - throw new XPointException(); - } - lvConfig.setEnablementCondition(expr); - } - } - - this.libraryValidatorConfigs.addItem(lvConfig.getId(), lvConfig); - } - catch (XPointException e) { - // Ignore and continue. The problem has already been reported to the user - // in the log. - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/AbstractJptFileCreationDataModelProvider.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/AbstractJptFileCreationDataModelProvider.java deleted file mode 100644 index e15e98011a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/AbstractJptFileCreationDataModelProvider.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.operations; - -import java.util.Set; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages; -import org.eclipse.jpt.common.core.internal.utility.PlatformTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelProvider; - -public abstract class AbstractJptFileCreationDataModelProvider - extends AbstractDataModelProvider - implements JptFileCreationDataModelProperties -{ - protected AbstractJptFileCreationDataModelProvider() { - super(); - } - - - @Override - public Set getPropertyNames() { - @SuppressWarnings("unchecked") - Set propertyNames = super.getPropertyNames(); - propertyNames.add(PROJECT); - propertyNames.add(CONTAINER_PATH); - propertyNames.add(FILE_NAME); - return propertyNames; - } - - @Override - public Object getDefaultProperty(String propertyName) { - if (propertyName.equals(CONTAINER_PATH)) { - IContainer sourceLocation = getDefaultContainer(); - if (sourceLocation != null && sourceLocation.exists()) { - return sourceLocation.getFullPath(); - } - } - else if (propertyName.equals(FILE_NAME)) { - return getDefaultFileName(); - } - return super.getDefaultProperty(propertyName); - } - - protected abstract String getDefaultFileName(); - - - // **************** validation ********************************************* - - @Override - public IStatus validate(String propertyName) { - IStatus status = Status.OK_STATUS; - if (propertyName.equals(CONTAINER_PATH) - || propertyName.equals(FILE_NAME)) { - status = validateContainerPathAndFileName(); - } - if (! status.isOK()) { - return status; - } - - return status; - } - - protected IStatus validateContainerPathAndFileName() { - IContainer container = getContainer(); - if (container == null) { - // verifies container has been specified, but should be unnecessary in most cases. - // there is almost always a default, and the new file wizard does this validation as well. - return new Status( - IStatus.ERROR, JptCommonCorePlugin.PLUGIN_ID, - JptCommonCoreMessages.VALIDATE_CONTAINER_NOT_SPECIFIED); - } - String fileName = getStringProperty(FILE_NAME); - if (StringTools.stringIsEmpty(fileName)) { - // verifies file name has been specified, but should be unnecessary in most cases. - // there is almost always a default, and the new file wizard does this validation as well. - return new Status( - IStatus.ERROR, JptCommonCorePlugin.PLUGIN_ID, - JptCommonCoreMessages.VALIDATE_FILE_NAME_NOT_SPECIFIED); - } - if (container.getFile(new Path(fileName)).exists()) { - // verifies file does not exist, but should be unnecessary in most cases. - // the new file wizard does this validation as well. - return new Status( - IStatus.ERROR, JptCommonCorePlugin.PLUGIN_ID, - JptCommonCoreMessages.VALIDATE_FILE_ALREADY_EXISTS); - } - return Status.OK_STATUS; - } - - - // **************** helper methods ***************************************** - - protected IPath getContainerPath() { - return (IPath) this.model.getProperty(CONTAINER_PATH); - } - - protected IContainer getContainer() { - IPath containerPath = getContainerPath(); - if (containerPath == null) { - return null; - } - return PlatformTools.getContainer(containerPath); - } - - protected IProject getProject() { - return getProject(getContainer()); - } - - protected IProject getProject(IContainer container) { - return (container == null) ? null : container.getProject(); - } - - /** - * Return a best guess source location for the for the specified project - */ - protected IContainer getDefaultContainer() { - IProject project = (IProject) this.model.getProperty(PROJECT); - if (project != null) { - return JptCommonCorePlugin.getResourceLocator(project).getDefaultResourceLocation(project); - } - return null; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/JptFileCreationDataModelProperties.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/JptFileCreationDataModelProperties.java deleted file mode 100644 index 5c635c98c8..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/operations/JptFileCreationDataModelProperties.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.operations; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; - -public interface JptFileCreationDataModelProperties -{ - /** - * Optional, type {@link IProject}, gives a clue as to the default container path - */ - String PROJECT = "JptFileCreationDataModelProperties.PROJECT"; //$NON-NLS-1$ - - /** - * Required, type {@link IPath}, identifies the full path to the container in which - * the file should be created - */ - String CONTAINER_PATH = "JptFileCreationDataModelProperties.CONTAINER_PATH"; //$NON-NLS-1$ - - /** - * Required, type {@link String}, identifies the file name - */ - String FILE_NAME = "JptFileCreationDataModelProperties.FILE_NAME"; //$NON-NLS-1$ -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ModuleResourceLocator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ModuleResourceLocator.java deleted file mode 100644 index 104081ec57..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ModuleResourceLocator.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.resource; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.internal.utility.PlatformTools; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; -import org.eclipse.wst.common.componentcore.resources.IVirtualFile; -import org.eclipse.wst.common.componentcore.resources.IVirtualFolder; -import org.eclipse.wst.common.componentcore.resources.IVirtualResource; - -public class ModuleResourceLocator - extends SimpleJavaResourceLocator { - - /** - * Return the folder representing the "META-INF" runtime location - */ - @Override - public IContainer getDefaultResourceLocation(IProject project) { - IVirtualComponent component = ComponentCore.createComponent(project); - return component.getRootFolder().getFolder(META_INF_PATH).getUnderlyingFolder(); - } - - @Override - public IPath getResourcePath(IProject project, IPath runtimePath) { - IVirtualComponent component = ComponentCore.createComponent(project); - return component.getRootFolder().getFile(runtimePath).getWorkspaceRelativePath(); - } - - @Override - public IPath getRuntimePath(IProject project, IPath resourcePath) { - IFile file = PlatformTools.getFile(resourcePath); - IVirtualComponent component = ComponentCore.createComponent(project); - IVirtualFolder root = component.getRootFolder(); - IVirtualFile vFile = findVirtualFile(root, file); - if (vFile != null) { - return vFile.getRuntimePath().makeRelative(); - } - // couldn't find it. try the super-case - return super.getRuntimePath(project, resourcePath); - } - - private IVirtualFile findVirtualFile(IVirtualFolder vFolder, IFile file) { - try { - for (IVirtualResource vResource : vFolder.members()) { - if (vResource.getType() == IVirtualResource.FILE) { - IVirtualFile vFile = (IVirtualFile) vResource; - if (file.equals(vFile.getUnderlyingResource())) { - return vFile; - } - } - else if (vResource.getType() == IVirtualResource.FOLDER) { - IVirtualFile vFile = findVirtualFile((IVirtualFolder) vResource, file); - if (vFile != null) { - return vFile; - } - } - } - } - catch (CoreException ce) { - // fall through - JptCommonCorePlugin.log(ce); - } - return null; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/PluginResourceLocator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/PluginResourceLocator.java deleted file mode 100644 index 4dcd3fd221..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/PluginResourceLocator.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.resource; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.internal.utility.PlatformTools; -import org.eclipse.pde.core.project.IBundleProjectDescription; -import org.eclipse.pde.core.project.IBundleProjectService; -import org.osgi.framework.BundleContext; -import org.osgi.framework.ServiceReference; - -public class PluginResourceLocator - extends SimpleJavaResourceLocator { - - @Override - public IContainer getDefaultResourceLocation(IProject project) { - try { - IContainer root = getBundleRoot(project); - return root.getFolder(META_INF_PATH); - } - catch (CoreException ce) { - // fall through - JptCommonCorePlugin.log(ce); - } - return super.getDefaultResourceLocation(project); - } - - @Override - public IPath getResourcePath(IProject project, IPath runtimePath) { - try { - IContainer root = getBundleRoot(project); - IPath resourcePath = root.getFullPath().append(runtimePath); - if (project.getWorkspace().getRoot().getFile(resourcePath).exists()) { - return resourcePath; - } - } - catch (CoreException ce) { - // fall through - JptCommonCorePlugin.log(ce); - } - return super.getResourcePath(project, runtimePath); - } - - @Override - public IPath getRuntimePath(IProject project, IPath resourcePath) { - IFile file = PlatformTools.getFile(resourcePath); - try { - IContainer root = getBundleRoot(project); - if (root.contains(file)) { - return resourcePath.makeRelativeTo(root.getFullPath()); - } - } - catch (CoreException ce) { - // fall through - JptCommonCorePlugin.log(ce); - } - return super.getRuntimePath(project, resourcePath); - } - - protected IContainer getBundleRoot(IProject project) - throws CoreException { - - IBundleProjectService service = getBundleProjectService(); - IBundleProjectDescription description = service.getDescription(project); - IPath path = description.getBundleRoot(); - return (path == null) ? project : project.getFolder(path); - } - - protected IBundleProjectService getBundleProjectService() { - BundleContext context = JptCommonCorePlugin.instance().getBundle().getBundleContext(); - ServiceReference reference = context.getServiceReference(IBundleProjectService.class); - if (reference == null) { - return null; - } - IBundleProjectService service = context.getService(reference); - if (service != null) { - context.ungetService(reference); - } - return service; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ResourceLocatorConfig.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ResourceLocatorConfig.java deleted file mode 100644 index 862fb04e73..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ResourceLocatorConfig.java +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.resource; - -import static org.eclipse.jst.common.project.facet.core.internal.FacetedProjectFrameworkJavaPlugin.log; -import org.eclipse.core.expressions.EvaluationContext; -import org.eclipse.core.expressions.EvaluationResult; -import org.eclipse.core.expressions.Expression; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.internal.XPointUtil; -import org.eclipse.jpt.common.core.resource.ResourceLocator; -import org.eclipse.jpt.common.utility.internal.StringTools; - -public class ResourceLocatorConfig - implements Comparable { - - public static final String PROJECT_ENABLEMENT_VARIABLE = "project"; //$NON-NLS-1$ - - private String id; - private String pluginId; - private String className; - private Priority priority; - private Expression enablementCondition; - - - ResourceLocatorConfig() { - super(); - } - - - public String getId() { - return this.id; - } - - void setId(String id) { - this.id = id; - } - - public String getPluginId() { - return this.pluginId; - } - - void setPluginId(String pluginId) { - this.pluginId = pluginId; - } - - public String getClassName() { - return this.className; - } - - void setClassName(String className) { - this.className = className; - } - - public Priority getPriority() { - return this.priority; - } - - void setPriority(Priority priority) { - this.priority = priority; - } - - public Expression getEnablementCondition() { - return this.enablementCondition; - } - - void setEnablementCondition(Expression enablementCondition) { - this.enablementCondition = enablementCondition; - } - - public ResourceLocator getResourceLocator() { - return XPointUtil.instantiate( - JptCommonCorePlugin.PLUGIN_ID, ResourceLocatorManager.QUALIFIED_EXTENSION_POINT_ID, - this.className, ResourceLocator.class); - } - - public boolean isEnabledFor(IProject project) { - EvaluationContext evalContext = new EvaluationContext(null, project); - evalContext.setAllowPluginActivation(true); - evalContext.addVariable(PROJECT_ENABLEMENT_VARIABLE, project); - - if (this.enablementCondition != null) { - try { - EvaluationResult evalResult = this.enablementCondition.evaluate(evalContext); - - if (evalResult == EvaluationResult.FALSE) { - return false; - } - } - catch (CoreException e) { - log(e); - } - } - - return true; - } - - public int compareTo(ResourceLocatorConfig other) { - return Priority.compare(this.priority, other.priority); - } - - - public static enum Priority { - - /* The lowest priority for a resource locator */ - LOWEST(6, "lowest"), //$NON-NLS-1$ - - /* The second lowest priority for a resource locator */ - LOWER(5, "lower"), //$NON-NLS-1$ - - /* The third lowest priority for a resource locator */ - LOW(4, "low"), //$NON-NLS-1$ - - /* The default priority for a resource locator */ - NORMAL(3, "normal"), //$NON-NLS-1$ - - /* The third highest priority for a resource locator */ - HIGH(2, "high"), //$NON-NLS-1$ - - /* The second highest priority for a resource locator */ - HIGHER(1, "higher"), //$NON-NLS-1$ - - /* The highest priority for a resource locator */ - HIGHEST(0, "highest"); //$NON-NLS-1$ - - - public static int compare(Priority priority1, Priority priority2) { - return priority1.value.compareTo(priority2.value); - } - - public static Priority get(String literal) { - if (literal == null) { - return NORMAL; - } - for (Priority priority : values()) { - if (StringTools.stringsAreEqual(literal, priority.literal)) { - return priority; - } - } - return null; - } - - - private Integer value; - private String literal; - - - private Priority(int value, String literal) { - this.value = Integer.valueOf(value); - this.literal = literal; - } - - - @Override - public String toString() { - return this.literal; - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ResourceLocatorManager.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ResourceLocatorManager.java deleted file mode 100644 index 058becd765..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/ResourceLocatorManager.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.resource; - -import static org.eclipse.jpt.common.core.internal.XPointUtil.findRequiredAttribute; -import static org.eclipse.jpt.common.core.internal.XPointUtil.log; -import static org.eclipse.jpt.common.core.internal.XPointUtil.logDuplicateExtension; -import static org.eclipse.jpt.common.core.internal.XPointUtil.logInvalidValue; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.TreeSet; -import org.eclipse.core.expressions.Expression; -import org.eclipse.core.expressions.ExpressionConverter; -import org.eclipse.core.resources.IProject; -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.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.internal.XPointUtil.XPointException; -import org.eclipse.jpt.common.core.internal.resource.ResourceLocatorConfig.Priority; -import org.eclipse.jpt.common.core.resource.ResourceLocator; -import org.eclipse.jpt.common.utility.internal.KeyedSet; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; - -public class ResourceLocatorManager { - - public static final String EXTENSION_POINT_ID = "resourceLocators"; //$NON-NLS-1$ - public static final String QUALIFIED_EXTENSION_POINT_ID = JptCommonCorePlugin.PLUGIN_ID_ + EXTENSION_POINT_ID; - public static final String RESOURCE_LOCATOR_ELEMENT = "resourceLocator"; //$NON-NLS-1$ - public static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$ - public static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ - public static final String PRIORITY_ATTRIBUTE = "priority"; //$NON-NLS-1$ - public static final String ENABLEMENT_ELEMENT = "enablement"; //$NON-NLS-1$ - - - private static ResourceLocatorManager INSTANCE = new ResourceLocatorManager(); - - - public static ResourceLocatorManager instance() { - return INSTANCE; - } - - - private KeyedSet resourceLocatorConfigs; - - - private ResourceLocatorManager() { - this.resourceLocatorConfigs = new KeyedSet(); - readExtensions(); - } - - - /** - * Return the {@link ResourceLocator} of highest priority that is acceptable - * for the given project - */ - public ResourceLocator getResourceLocator(final IProject project) { - Iterator stream = new FilteringIterable( - new TransformationIterable( - new FilteringIterable( - new TreeSet(this.resourceLocatorConfigs.getItemSet())) { - @Override - protected boolean accept(ResourceLocatorConfig o) { - return o.isEnabledFor(project); - } - }) { - @Override - protected ResourceLocator transform(ResourceLocatorConfig o) { - return o.getResourceLocator(); - } - }) { - @Override - protected boolean accept(ResourceLocator o) { - return o != null; - } - }.iterator(); - return (stream.hasNext()) ? stream.next() : null; - } - - private void readExtensions() { - final IExtensionRegistry registry = Platform.getExtensionRegistry(); - - final IExtensionPoint xpoint - = registry.getExtensionPoint(QUALIFIED_EXTENSION_POINT_ID); - - if (xpoint == null) { - throw new IllegalStateException(); - } - - final List configs = new ArrayList(); - - for (IExtension extension : xpoint.getExtensions()) { - for (IConfigurationElement element : extension.getConfigurationElements()) { - configs.add(element); - } - } - - for (IConfigurationElement element : configs) { - if (element.getName().equals(RESOURCE_LOCATOR_ELEMENT)) { - readExtension(element); - } - } - } - - private void readExtension(IConfigurationElement element) { - try { - final ResourceLocatorConfig rlConfig = new ResourceLocatorConfig(); - - // plug-in id - rlConfig.setPluginId(element.getContributor().getName()); - - // resource locator id - rlConfig.setId(findRequiredAttribute(element, ID_ATTRIBUTE)); - - if (this.resourceLocatorConfigs.containsKey(rlConfig.getId())) { - logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, rlConfig.getId()); - throw new XPointException(); - } - - // resource locator class name - rlConfig.setClassName(findRequiredAttribute(element, CLASS_ATTRIBUTE)); - - // priority - String priorityString = element.getAttribute(PRIORITY_ATTRIBUTE).trim(); - Priority priority = Priority.get(priorityString); - if (priority == null) { - logInvalidValue(element, PRIORITY_ATTRIBUTE, priorityString); - throw new XPointException(); - } - rlConfig.setPriority(priority); - - // enablement - for (IConfigurationElement child : element.getChildren()) { - String childName = child.getName(); - if (childName.equals(ENABLEMENT_ELEMENT)) { - Expression expr; - try { - expr = ExpressionConverter.getDefault().perform(child); - } - catch (CoreException e) { - log(e); - throw new XPointException(); - } - rlConfig.setEnablementCondition(expr); - } - } - - this.resourceLocatorConfigs.addItem(rlConfig.getId(), rlConfig); - } - catch (XPointException e) { - // Ignore and continue. The problem has already been reported to the user - // in the log. - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleJavaResourceLocator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleJavaResourceLocator.java deleted file mode 100644 index 2050f09006..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/SimpleJavaResourceLocator.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.resource; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.internal.utility.PlatformTools; -import org.eclipse.jpt.common.core.resource.ResourceLocator; -import org.eclipse.jst.j2ee.internal.J2EEConstants; - -public class SimpleJavaResourceLocator - implements ResourceLocator { - - protected static IPath META_INF_PATH = new Path(J2EEConstants.META_INF); - - /** - * Simply ensure the container is either: - * - on the java project classpath - * or - * - in the non-java resources, but not in the project output location - */ - public boolean acceptResourceLocation(IProject project, IContainer container) { - IJavaProject javaProject = getJavaProject(project); - if (javaProject.isOnClasspath(container)) { - return true; - } - try { - IPath outputLocation = javaProject.getOutputLocation(); - if (container.equals(project) && outputLocation.isPrefixOf(container.getFullPath())) { - return true; - } - for (Object resource : javaProject.getNonJavaResources()) { - if (resource instanceof IFolder) { - IFolder folder = (IFolder) resource; - if ((folder.equals(container) || folder.contains(container)) - && ! outputLocation.isPrefixOf(container.getFullPath())) { - return true; - } - } - } - } - catch (JavaModelException jme) { - JptCommonCorePlugin.log(jme); - // only happens if the java project doesn't exist. fall through. - } - return false; - } - - /** - * Return - * - the first package fragment root (source folder) META-INF folder if it exists, - * or - * - the project rooted META-INF folder if it exists - * or - * - the non-existent META-INF folder in the first package fragment root (source folder) - */ - public IContainer getDefaultResourceLocation(IProject project) { - IJavaProject javaProject = getJavaProject(project); - IContainer defaultLocation = null; - try { - for (IPackageFragmentRoot root : javaProject.getPackageFragmentRoots()) { - if (root.getKind() == IPackageFragmentRoot.K_SOURCE) { - IContainer rootContainer = (IContainer) root.getUnderlyingResource(); - IFolder metaInfFolder = rootContainer.getFolder(META_INF_PATH); - if (metaInfFolder.exists()) { - return metaInfFolder; - } - if (defaultLocation == null) { - // hold on to this in case the META-INF folder can't be found - defaultLocation = metaInfFolder; - } - } - } - IFolder metaInfFolder = project.getFolder(META_INF_PATH); - if (metaInfFolder.exists()) { - return metaInfFolder; - } - } - catch (JavaModelException jme) { - // only happens if the java project doesn't exist or there is some problem with the - // java resources. fall through. - JptCommonCorePlugin.log(jme); - } - - return defaultLocation; - } - - public IPath getResourcePath(IProject project, IPath runtimePath) { - IJavaProject javaProject = getJavaProject(project); - IPath firstResourcePath = null; - try { - for (IPackageFragmentRoot root : javaProject.getPackageFragmentRoots()) { - if (root.getKind() == IPackageFragmentRoot.K_SOURCE) { - IContainer rootContainer = (IContainer) root.getUnderlyingResource(); - IPath resourcePath = rootContainer.getFullPath().append(runtimePath); - if (firstResourcePath == null) { - firstResourcePath = resourcePath; - } - IFile file = project.getWorkspace().getRoot().getFile(resourcePath); - if (file.exists()) { - return file.getFullPath(); - } - } - } - } - catch (JavaModelException jme) { - JptCommonCorePlugin.log(jme); - return null; - } - return firstResourcePath; - } - - public IPath getRuntimePath(IProject project, IPath resourcePath) { - IJavaProject javaProject = getJavaProject(project); - IFile file = PlatformTools.getFile(resourcePath); - try { - for (IPackageFragmentRoot root : javaProject.getPackageFragmentRoots()) { - if (root.getKind() == IPackageFragmentRoot.K_SOURCE) { - IContainer rootContainer = (IContainer) root.getUnderlyingResource(); - if (rootContainer.contains(file)) { - return resourcePath.makeRelativeTo(rootContainer.getFullPath()); - } - } - } - } - catch (JavaModelException jme) { - // fall through - JptCommonCorePlugin.log(jme); - } - return resourcePath.makeRelativeTo(project.getFullPath()); - } - - private IJavaProject getJavaProject(IProject project) { - return JavaCore.create(project); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/WebModuleResourceLocator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/WebModuleResourceLocator.java deleted file mode 100644 index a7fffe7e8c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/resource/WebModuleResourceLocator.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.resource; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualComponent; - -public class WebModuleResourceLocator - extends ModuleResourceLocator{ - - protected static IPath WEB_INF_CLASSES_PATH = new Path(J2EEConstants.WEB_INF_CLASSES); - - /** - * Return the folder representing the "WEB-INF/classes/META-INF" location - */ - @Override - public IContainer getDefaultResourceLocation(IProject project) { - IVirtualComponent component = ComponentCore.createComponent(project); - return component.getRootFolder().getFolder(WEB_INF_CLASSES_PATH.append(META_INF_PATH)).getUnderlyingFolder(); - } - - /** - * Return the full resource path representing the given runtime location appended - * to the "WEB-INF/classes" location - */ - @Override - public IPath getResourcePath(IProject project, IPath runtimePath) { - return super.getResourcePath(project, WEB_INF_CLASSES_PATH.append(runtimePath)); - } - - /** - * - */ - @Override - public IPath getRuntimePath(IProject project, IPath resourcePath) { - IPath runtimePath = super.getRuntimePath(project, resourcePath); - if (WEB_INF_CLASSES_PATH.isPrefixOf(runtimePath)) { - return runtimePath.makeRelativeTo(WEB_INF_CLASSES_PATH); - } - return runtimePath; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/CallbackJobSynchronizer.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/CallbackJobSynchronizer.java deleted file mode 100644 index 38a4cda80f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/CallbackJobSynchronizer.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.jpt.common.utility.internal.ListenerList; -import org.eclipse.jpt.common.utility.synchronizers.CallbackSynchronizer; - -/** - * Extend the job synchronizer to notify listeners - * when a synchronization "cycle" is complete; i.e. the synchronization has, - * for the moment, handled every "synchronize" request and quiesced. - * This notification is not guaranteed to occur with every - * synchronization "cycle"; - * since other, unrelated, synchronizations can be triggered concurrently; - * preventing the synchronization from quiescing. - */ -public class CallbackJobSynchronizer - extends JobSynchronizer - implements CallbackSynchronizer -{ - private final ListenerList listenerList = new ListenerList(Listener.class); - - - // ********** construction ********** - - /** - * Construct a callback job synchronizer that uses the specified job command to - * perform the synchronization. Assign the generated Eclipse job the - * specified name. - */ - public CallbackJobSynchronizer(String jobName, JobCommand command) { - super(jobName, command); - } - - /** - * Construct a callback job synchronizer that uses the specified job command to - * perform the synchronization. Assign the generated Eclipse job the - * specified name and scheduling rule. - */ - public CallbackJobSynchronizer(String jobName, JobCommand command, ISchedulingRule schedulingRule) { - super(jobName, command, schedulingRule); - } - - /** - * Build a job that will let us know when the synchronization has - * quiesced. - */ - @Override - SynchronizationJob buildJob(String jobName, JobCommand command, ISchedulingRule schedulingRule) { - return new CallbackSynchronizationJob(jobName, command, schedulingRule); - } - - - // ********** CallbackSynchronizer implementation ********** - - public void addListener(Listener listener) { - this.listenerList.add(listener); - } - - public void removeListener(Listener listener) { - this.listenerList.remove(listener); - } - - /** - * Notify our listeners. - */ - void synchronizationQuiesced() { - for (Listener listener : this.listenerList.getListeners()) { - listener.synchronizationQuiesced(this); - } - } - - - // ********** synchronization job ********** - - /** - * Extend {@link JobSynchronizer.SynchronizationJob} - * to notify the synchronizer when the synchronization has quiesced - * (i.e. the command has finished executing and there are no further - * requests for synchronization). - * Because synchronization occurs during the job's execution, - * no other thread will be able to - * initiate another synchronization until the synchronizer's listeners have been - * notified. Note also, the synchronizer's listeners can, themselves, - * trigger another synchronization (by directly or indirectly calling - * {@link org.eclipse.jpt.common.utility.synchronizers.Synchronizer#synchronize()}); - * but this synchronization will not occur until after all the - * listeners have been notified. - */ - class CallbackSynchronizationJob - extends SynchronizationJob - { - /** - * When this flag is set to true, the job has been scheduled to run. - * We need this because {@link org.eclipse.core.runtime.jobs.Job Job} - * has no public API for discovering whether a job is "scheduled". - */ - // use 'volatile' because synchronization isn't really required - private volatile boolean scheduled; - - - CallbackSynchronizationJob(String jobName, JobCommand command, ISchedulingRule schedulingRule) { - super(jobName, command, schedulingRule); - this.scheduled = false; - } - - /** - * If we are allowing the job to be scheduled (i.e. {@link #start()} - * was called), set the "scheduled" flag. - */ - @Override - void synchronize() { - if (this.shouldSchedule) { - this.scheduled = true; - } - super.synchronize(); - } - - /** - * Clear the "scheduled" flag; perform the synchronization; and, - * if the "scheduled" flag is still clear (i.e. there have been no - * further calls to {@link #synchronize()}), notify our listeners. - */ - @Override - protected IStatus run(IProgressMonitor monitor) { - this.scheduled = false; - IStatus status = super.run(monitor); - // hmmm - we will notify listeners even when we our job is "stopped"; - // that seems ok... ~bjv - if ( ! this.scheduled) { - CallbackJobSynchronizer.this.synchronizationQuiesced(); - } - return status; - } - - @Override - void stop() { - this.scheduled = false; - super.stop(); - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JobCommand.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JobCommand.java deleted file mode 100644 index 0a46bb470d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JobCommand.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility; - -import java.io.Serializable; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; - -/** - * Simple interface for implementing the GOF Command design pattern in an - * Eclipse job. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JobCommand { - - /** - * Execute the command. The semantics of the command - * is determined by the contract between the client and server. - * The command should check, as appropriate, whether the specified progress - * monitor is {@link IProgressMonitor#isCanceled() "canceled"}; if it is, - * the command should throw an - * {@link org.eclipse.core.runtime.OperationCanceledException OperationCanceledException}. - * @see IProgressMonitor#isCanceled() - */ - IStatus execute(IProgressMonitor monitor); - - /** - * Singleton implementation of the job command interface that will do - * nothing when executed. - */ - final class Null implements JobCommand, Serializable { - public static final JobCommand INSTANCE = new Null(); - public static JobCommand instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - public IStatus execute(IProgressMonitor arg0) { - return Status.OK_STATUS; - } - @Override - public String toString() { - return "JobCommand.Null"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - /** - * Singleton implementation of the job command interface that will throw an - * exception when executed. - */ - final class Disabled implements JobCommand, Serializable { - public static final JobCommand INSTANCE = new Disabled(); - public static JobCommand instance() { - return INSTANCE; - } - // ensure single instance - private Disabled() { - super(); - } - // throw an exception - public IStatus execute(IProgressMonitor arg0) { - throw new UnsupportedOperationException(); - } - @Override - public String toString() { - return "JobCommand.Disabled"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JobSynchronizer.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JobSynchronizer.java deleted file mode 100644 index 2ab0283e5a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/JobSynchronizer.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility; - -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.synchronizers.Synchronizer; - -/** - * This synchronizer will perform synchronizations in an Eclipse job on a - * separate thread, allowing calls to {@link Synchronizer#synchronize()} - * to return immediately. - *

- * If necessary, the client-supplied job command should handle any - * exceptions appropriately. Although, the default exception-handling provided - * by the Eclipse Job Framework is probably adequate in most cases:

    - *
  • An {@link org.eclipse.core.runtime.OperationCanceledException OperationCanceledException} - * results in a {@link org.eclipse.core.runtime.Status#CANCEL_STATUS CANCEL_STATUS}. - *
  • Any non-{@link ThreadDeath} {@link Throwable} - * results in a {@link org.eclipse.core.runtime.IStatus#ERROR ERROR} - * {@link org.eclipse.core.runtime.IStatus IStatus} - *
- * @see org.eclipse.core.internal.jobs.Worker#run() - */ -public class JobSynchronizer - implements Synchronizer -{ - /** - * The synchronization is performed by this job. The same job is used - * for every start/stop cycle (since a job can be re-started). - */ - private final SynchronizationJob job; - - - // ********** construction ********** - - /** - * Construct a job synchronizer that uses the specified job command to - * perform the synchronization. Assign the generated Eclipse job the - * specified name. - */ - public JobSynchronizer(String jobName, JobCommand command) { - this(jobName, command, null); - } - - /** - * Construct a job synchronizer that uses the specified job command to - * perform the synchronization. Assign the generated Eclipse job the - * specified name and scheduling rule. - */ - public JobSynchronizer(String jobName, JobCommand command, ISchedulingRule schedulingRule) { - super(); - this.job = this.buildJob(jobName, command, schedulingRule); - } - - SynchronizationJob buildJob(String jobName, JobCommand command, ISchedulingRule schedulingRule) { - return new SynchronizationJob(jobName, command, schedulingRule); - } - - - // ********** Synchronizer implementation ********** - - /** - * Allow the job to be scheduled, but postpone the first synchronization - * until requested, via {@link #synchronize()}. - */ - public void start() { - this.job.start(); - } - - /** - * "Schedule" the job. - */ - public void synchronize() { - this.job.synchronize(); - } - - /** - * Wait for the current job execution to complete. - */ - public void stop() { - this.job.stop(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.job); - } - - - // ********** synchronization job ********** - - /** - * This is the job that gets scheduled by the job synchronizer. - * When the job is run it executes the client-supplied job command. - */ - static class SynchronizationJob extends Job { - /** - * The client-supplied job command that executes every time the job - * runs. - */ - private final JobCommand command; - - /** - * When this flag is set to false, the job does not stop immediately; - * but it will not be scheduled to run again. - */ - // use 'volatile' because synchronization isn't really required - volatile boolean shouldSchedule; - - - SynchronizationJob(String jobName, JobCommand command, ISchedulingRule schedulingRule) { - super(jobName); - if (command == null) { - throw new NullPointerException(); - } - this.command = command; - this.shouldSchedule = false; - this.setRule(schedulingRule); - } - - /** - * Just set the "should schedule" flag so the job can be - * scheduled; but don't actually schedule it. - */ - void start() { - if (this.shouldSchedule) { - throw new IllegalStateException("The Synchronizer was not stopped."); //$NON-NLS-1$ - } - this.shouldSchedule = true; - } - - /** - * Simply re-schedule the job, allowing the current execution - * to run to completion (i.e. do not try to cancel it prematurely). - * This should minimize the number of times the job is re-executed - * (recursively and otherwise). - */ - void synchronize() { - this.schedule(); - } - - /** - * Any uncaught exceptions thrown by the command will be reasonably - * handled by the Job Framework. - * @see org.eclipse.core.internal.jobs.Worker#run() - */ - @Override - protected IStatus run(IProgressMonitor monitor) { - return this.command.execute(monitor); - } - - /** - * Prevent the job from running again and wait for the current - * execution, if there is any, to end before returning. - */ - void stop() { - if ( ! this.shouldSchedule) { - throw new IllegalStateException("The Synchronizer was not started."); //$NON-NLS-1$ - } - // this will prevent the job from being scheduled to run again - this.shouldSchedule = false; - // this will cancel the job if it has already been scheduled, but is currently WAITING - this.cancel(); - try { - // if the job is currently RUNNING, wait until it is done before returning - this.join(); - } catch (InterruptedException ex) { - // the thread that called #stop() was interrupted while waiting to - // join the synchronization job - ignore; - // 'shouldSchedule' is still set to 'false', so the job loop will still stop - we - // just won't wait around for it... - } - } - - /** - * This is part of the normal {@link Job} behavior. By default, it is - * not used (i.e. it always returns true). - * We implement it here. - */ - @Override - public boolean shouldSchedule() { - return this.shouldSchedule; - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/PlatformTools.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/PlatformTools.java deleted file mode 100644 index 6981696e0d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/PlatformTools.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility; - -import java.io.IOException; -import java.io.InputStream; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IWorkspaceRoot; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.core.runtime.content.IContentTypeManager; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; - -/** - * A collection of utilities for dealing with the Eclipse platform API. - */ -public class PlatformTools { - - /** - * Return the {@link IContainer} with the workspace relative "full" path - */ - public static IContainer getContainer(IPath fullContainerPath) { - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - return root.getContainerForLocation(root.getLocation().append(fullContainerPath)); - } - - /** - * Return the {@link IFile} with the workspace relative "full" path - */ - public static IFile getFile(IPath fullFilePath) { - IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); - return root.getFileForLocation(root.getLocation().append(fullFilePath)); - } - - /** - * Return the specified file's content type, - * using the Eclipse platform's content type manager. - */ - public static IContentType getContentType(IFile file) { - String fileName = file.getName(); - InputStream fileContents = null; - try { - fileContents = file.getContents(); - } catch (CoreException ex) { - // seems like we can ignore any exception that might occur here; - // e.g. we get a FNFE if the workspace is out of synch with the O/S file system - // JptCorePlugin.log(ex); - - // look for content type based on the file name only(?) - return findContentTypeFor(fileName); - } - - IContentType contentType = null; - try { - contentType = findContentTypeFor(fileContents, fileName); - } catch (IOException ex) { - JptCommonCorePlugin.log(ex); - } finally { - try { - fileContents.close(); - } catch (IOException ex) { - JptCommonCorePlugin.log(ex); - } - } - return contentType; - } - - private static IContentType findContentTypeFor(InputStream fileContents, String fileName) throws IOException { - return getContentTypeManager().findContentTypeFor(fileContents, fileName); - } - - private static IContentType findContentTypeFor(String fileName) { - return getContentTypeManager().findContentTypeFor(fileName); - } - - private static IContentTypeManager getContentTypeManager() { - return Platform.getContentTypeManager(); - } - - private PlatformTools() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/SimpleSchedulingRule.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/SimpleSchedulingRule.java deleted file mode 100644 index 04d8a24d15..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/SimpleSchedulingRule.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility; - -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * A job scheduling rule that conflicts only with itself. - */ -public final class SimpleSchedulingRule - implements ISchedulingRule -{ - public SimpleSchedulingRule() { - super(); - } - - public boolean contains(ISchedulingRule rule) { - return rule == this; - } - - public boolean isConflicting(ISchedulingRule rule) { - return rule == this; - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/SimpleTextRange.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/SimpleTextRange.java deleted file mode 100644 index f7d5dc90a1..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/SimpleTextRange.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility; - -import org.eclipse.jpt.common.core.utility.AbstractTextRange; - -/** - * Straightforward implementation of TextRange. - */ -public class SimpleTextRange extends AbstractTextRange { - private final int offset; - private final int length; - private final int lineNumber; - - public SimpleTextRange(int offset, int length, int lineNumber) { - super(); - this.offset = offset; - this.length = length; - this.lineNumber = lineNumber; - } - - public int getOffset() { - return this.offset; - } - - public int getLength() { - return this.length; - } - - public int getLineNumber() { - return this.lineNumber; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ASTNodeTextRange.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ASTNodeTextRange.java deleted file mode 100644 index 1d44f9fcdb..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ASTNodeTextRange.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.AbstractTextRange; - -/** - * Adapt an ASTNode to the TextRange interface. - */ -public class ASTNodeTextRange extends AbstractTextRange { - private final ASTNode astNode; - - public ASTNodeTextRange(ASTNode astNode) { - super(); - this.astNode = astNode; - } - - public int getOffset() { - return this.astNode.getStartPosition(); - } - - public int getLength() { - return this.astNode.getLength(); - } - - public int getLineNumber() { - return ((CompilationUnit) this.astNode.getRoot()).getLineNumber(this.getOffset()); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ASTTools.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ASTTools.java deleted file mode 100644 index dfbb2d15be..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ASTTools.java +++ /dev/null @@ -1,250 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.util.HashSet; -import java.util.List; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.ASTParser; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.IAnnotationBinding; -import org.eclipse.jdt.core.dom.IBinding; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jdt.core.dom.IVariableBinding; -import org.eclipse.jdt.core.dom.MethodDeclaration; -import org.eclipse.jdt.core.dom.Name; -import org.eclipse.jdt.core.dom.SingleVariableDeclaration; -import org.eclipse.jdt.core.dom.TypeLiteral; -import org.eclipse.jpt.common.utility.JavaType; -import org.eclipse.jpt.common.utility.MethodSignature; -import org.eclipse.jpt.common.utility.internal.SimpleJavaType; -import org.eclipse.jpt.common.utility.internal.SimpleMethodSignature; - -/** - * Convenience methods for dealing with JDT ASTs. - */ -public class ASTTools { - - /** - * Build an AST without method bodies for the specified compilation unit - * with its bindings resolved (and the resultant performance hit). - */ - public static CompilationUnit buildASTRoot(ICompilationUnit compilationUnit) { - ASTParser parser = ASTParser.newParser(AST.JLS3); - parser.setSource(compilationUnit); - parser.setIgnoreMethodBodies(true); // we don't need method bodies - parser.setResolveBindings(true); - parser.setBindingsRecovery(true); // see bugs 196200, 222735 - return (CompilationUnit) parser.createAST(null); - } - - - // ********** JDT DOM ********** - - public static String resolveEnum(Expression expression) { - if (expression == null) { - return null; - } - switch (expression.getNodeType()) { - case ASTNode.QUALIFIED_NAME: - case ASTNode.SIMPLE_NAME: - return resolveEnum((Name) expression); - default: - return null; - } - } - - public static String resolveEnum(Name enumExpression) { - IBinding binding = enumExpression.resolveBinding(); - if (binding == null) { - return null; // TODO figure out why this is null sometimes - } - if (binding.getKind() != IBinding.VARIABLE) { - return null; - } - IVariableBinding variableBinding = (IVariableBinding) binding; - return variableBinding.getType().getQualifiedName() + '.' + variableBinding.getName(); - } - - /** - * Return the fully-qualified name of the specified node's annotation - * class. - */ - public static String resolveAnnotation(Annotation node) { - IAnnotationBinding annotationBinding = node.resolveAnnotationBinding(); - if (annotationBinding == null) { - return null; - } - ITypeBinding annotationTypeBinding = annotationBinding.getAnnotationType(); - return (annotationTypeBinding == null) ? null : annotationTypeBinding.getQualifiedName(); - } - - /** - * If the specified expression is a type literal, return the type's fully- - * qualified name. Return null otherwise. - */ - public static String resolveFullyQualifiedName(Expression expression) { - ITypeBinding resolvedTypeBinding = resolveTypeBinding(expression); - return (resolvedTypeBinding == null) ? null : resolvedTypeBinding.getQualifiedName(); - } - - /** - * If the specified expression is a type literal, return the corresponding - * type binding. - */ - public static ITypeBinding resolveTypeBinding(Expression expression) { - if (expression.getNodeType() == ASTNode.TYPE_LITERAL) { - return ((TypeLiteral) expression).getType().resolveBinding(); - } - return null; - } - - public static MethodSignature buildMethodSignature(MethodDeclaration methodDeclaration) { - return new SimpleMethodSignature( - methodDeclaration.getName().getFullyQualifiedName(), - buildParameterTypes(methodDeclaration) - ); - } - - public static JavaType[] buildParameterTypes(MethodDeclaration methodDeclaration) { - List parameters = parameters(methodDeclaration); - int len = parameters.size(); - JavaType[] parameterTypes = new JavaType[len]; - for (int i = 0; i < len; i++) { - ITypeBinding type = parameters.get(i).getType().resolveBinding(); - parameterTypes[i] = new SimpleJavaType(type.getQualifiedName(), type.getDimensions()); - } - return parameterTypes; - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - private static List parameters(MethodDeclaration methodDeclaration) { - return methodDeclaration.parameters(); - } - - /** - * Return whether the specified expression is a type literal and the type binding - * corresponding to the specified type name exists in the type - * literal's inheritance hierarchy (superclasses and interfaces). - * Return null otherwise. - */ - public static boolean typeIsSubTypeOf(Expression expression, String searchTypeName) { - return findTypeInHierarchy(expression, searchTypeName) != null; - } - - /** - * If the specified expression is a type literal, return the type binding - * corresponding to the specified type name if it exists in the type - * literal's inheritance hierarchy (superclasses and interfaces). - * Return null otherwise. - */ - public static ITypeBinding findTypeInHierarchy(Expression expression, String searchTypeName) { - ITypeBinding typeBinding = resolveTypeBinding(expression); - return (typeBinding == null) ? null : findTypeInHierarchy(typeBinding, searchTypeName); - } - - /** - * Return whether a type binding with the specified type name exists in - * the specified type binding's inheritance hierarchy (superclasses - * and interfaces). - */ - public static boolean typeIsSubTypeOf(ITypeBinding typeBinding, String searchTypeName) { - return findTypeInHierarchy(typeBinding, searchTypeName) != null; - } - - /** - * Return the type binding corresponding to the specified type name if it - * exists in the specified type binding's inheritance hierarchy (superclasses - * and interfaces). Return null otherwise. - */ - public static ITypeBinding findTypeInHierarchy(ITypeBinding typeBinding, String searchTypeName) { - return findTypeInHierarchy(typeBinding, searchTypeName, new HashSet()); - } - - private static ITypeBinding findTypeInHierarchy(ITypeBinding typeBinding, String searchTypeName, HashSet visited) { - String typeName = typeBinding.getQualifiedName(); - if (visited.contains(typeName)) { - return null; - } - if (typeName.equals(searchTypeName)) { - return typeBinding; - } - visited.add(typeName); - - ITypeBinding interfaceBinding = findTypeInInterfaces(typeBinding, searchTypeName, visited); - if (interfaceBinding != null) { - return interfaceBinding; - } - - return findTypeInSuperclasses(typeBinding, searchTypeName, visited); - } - - private static ITypeBinding findTypeInInterfaces(ITypeBinding typeBinding, String searchTypeName, HashSet visited) { - ITypeBinding[] interfaceBindings = typeBinding.getInterfaces(); - for (ITypeBinding interfaceBinding : interfaceBindings) { // recurse up interfaces - ITypeBinding result = findTypeInHierarchy(interfaceBinding, searchTypeName, visited); - if (result != null) { - return result; - } - } - return null; - } - - private static ITypeBinding findTypeInSuperclasses(ITypeBinding typeBinding, String searchTypeName, HashSet visited) { - ITypeBinding superBinding = typeBinding.getSuperclass(); - if (superBinding != null) { // recurse up superclasses - ITypeBinding result = findTypeInHierarchy(superBinding, searchTypeName, visited); - if (result != null) { - return result; - } - } - return null; - } - /** - * Return whether the specified expression is a type literal and the type binding - * corresponding to the specified interface name exists in the type - * literal's inheritance hierarchy (superclasses and interfaces). - * Return null otherwise. - */ - public static boolean typeImplementsInterface(Expression expression, String searchInterfaceName) { - ITypeBinding typeBinding = resolveTypeBinding(expression); - if (typeBinding == null) { - return false; - } - return findInterfaceInHierarchy(typeBinding, searchInterfaceName) != null; - } - - /** - * Return whether a type binding with the specified interface name exists in - * the specified type binding's inheritance hierarchy (superclasses - * and interfaces). - */ - public static boolean typeImplementsInterface(ITypeBinding typeBinding, String searchInterfaceName) { - return findInterfaceInHierarchy(typeBinding, searchInterfaceName) != null; - } - - private static ITypeBinding findInterfaceInHierarchy(ITypeBinding typeBinding, String searchInterfaceName) { - HashSet visited = new HashSet(); - ITypeBinding interfaceBinding = findTypeInInterfaces(typeBinding, searchInterfaceName, visited); - if (interfaceBinding != null) { - return interfaceBinding; - } - - return findTypeInSuperclasses(typeBinding, searchInterfaceName, visited); - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractAnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractAnnotationAdapter.java deleted file mode 100644 index 7333322d48..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractAnnotationAdapter.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * Adapt an annotated element and a declaration annotation adapter. - */ -public abstract class AbstractAnnotationAdapter implements AnnotationAdapter { - private final AnnotatedElement annotatedElement; - private final DeclarationAnnotationAdapter daa; - - - // ********** constructor ********** - - public AbstractAnnotationAdapter(AnnotatedElement annotatedElement, DeclarationAnnotationAdapter daa) { - super(); - this.annotatedElement = annotatedElement; - this.daa = daa; - } - - - // ********** AnnotationAdapter implementation ********** - - public Annotation getAnnotation(CompilationUnit astRoot) { - return this.daa.getAnnotation(this.annotatedElement.getModifiedDeclaration(astRoot)); - } - - public void newMarkerAnnotation() { - this.edit(this.buildNewMarkerAnnotationEditor()); - } - - public void newSingleMemberAnnotation() { - this.edit(this.buildNewSingleMemberAnnotationEditor()); - } - - public void newNormalAnnotation() { - this.edit(this.buildNewNormalAnnotationEditor()); - } - - public void removeAnnotation() { - this.edit(this.buildRemoveAnnotationEditor()); - } - - public ASTNode getAstNode(CompilationUnit astRoot) { - return this.daa.getAstNode(this.annotatedElement.getModifiedDeclaration(astRoot)); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.daa); - } - - - // ********** internal methods ********** - - protected void edit(AnnotatedElement.Editor editor) { - this.annotatedElement.edit(editor); - } - - - // ********** factory methods ********** - - protected AnnotatedElement.Editor buildNewMarkerAnnotationEditor() { - return new NewMarkerAnnotationEditor(this.daa); - } - - protected AnnotatedElement.Editor buildNewSingleMemberAnnotationEditor() { - return new NewSingleMemberAnnotationEditor(this.daa); - } - - protected AnnotatedElement.Editor buildNewNormalAnnotationEditor() { - return new NewNormalAnnotationEditor(this.daa); - } - - protected AnnotatedElement.Editor buildRemoveAnnotationEditor() { - return new RemoveAnnotationEditor(this.daa); - } - - - // ********** member classes ********** - - protected static class NewMarkerAnnotationEditor implements AnnotatedElement.Editor { - private final DeclarationAnnotationAdapter daa; - - NewMarkerAnnotationEditor(DeclarationAnnotationAdapter daa) { - super(); - this.daa = daa; - } - public void edit(ModifiedDeclaration declaration) { - this.daa.newMarkerAnnotation(declaration); - } - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - } - - - protected static class NewSingleMemberAnnotationEditor implements AnnotatedElement.Editor { - private final DeclarationAnnotationAdapter daa; - - NewSingleMemberAnnotationEditor(DeclarationAnnotationAdapter daa) { - super(); - this.daa = daa; - } - public void edit(ModifiedDeclaration declaration) { - this.daa.newSingleMemberAnnotation(declaration); - } - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - } - - - protected static class NewNormalAnnotationEditor implements AnnotatedElement.Editor { - private final DeclarationAnnotationAdapter daa; - - NewNormalAnnotationEditor(DeclarationAnnotationAdapter daa) { - super(); - this.daa = daa; - } - public void edit(ModifiedDeclaration declaration) { - this.daa.newNormalAnnotation(declaration); - } - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - } - - - protected static class RemoveAnnotationEditor implements AnnotatedElement.Editor { - private final DeclarationAnnotationAdapter daa; - - RemoveAnnotationEditor(DeclarationAnnotationAdapter daa) { - super(); - this.daa = daa; - } - public void edit(ModifiedDeclaration declaration) { - this.daa.removeAnnotation(declaration); - } - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractDeclarationAnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractDeclarationAnnotationAdapter.java deleted file mode 100644 index 821c4ed618..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractDeclarationAnnotationAdapter.java +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.util.List; -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jdt.core.dom.MemberValuePair; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * - */ -public abstract class AbstractDeclarationAnnotationAdapter implements DeclarationAnnotationAdapter { - private final String annotationName; - - - // ********** constructors ********** - - protected AbstractDeclarationAnnotationAdapter(String annotationName) { - super(); - this.annotationName = annotationName; - } - - - // ********** DeclarationAnnotationAdapter implementation ********** - - public MarkerAnnotation newMarkerAnnotation(ModifiedDeclaration declaration) { - MarkerAnnotation annotation = this.newMarkerAnnotation(declaration.getAst()); - this.addAnnotationAndImport(declaration, annotation); - return annotation; - } - - public SingleMemberAnnotation newSingleMemberAnnotation(ModifiedDeclaration declaration) { - SingleMemberAnnotation annotation = this.newSingleMemberAnnotation(declaration.getAst()); - this.addAnnotationAndImport(declaration, annotation); - return annotation; - } - - public NormalAnnotation newNormalAnnotation(ModifiedDeclaration declaration) { - NormalAnnotation annotation = this.newNormalAnnotation(declaration.getAst()); - this.addAnnotationAndImport(declaration, annotation); - return annotation; - } - - /** - * Add the appropriate import statement, then shorten the annotation's - * name before adding it to the declaration. - */ - protected void addAnnotationAndImport(ModifiedDeclaration declaration, Annotation annotation) { - annotation.setTypeName(declaration.getAst().newName(this.getSourceCodeAnnotationName(declaration))); - this.addAnnotation(declaration, annotation); - } - - /** - * Return the annotation's name as it can be used in source code; - * i.e. if we can add it to the compilation unit's imports, return the short - * name; if we can't (because of a collision), return the fully-qualified name. - * NB: an import may be added as a side-effect :-( - */ - protected String getSourceCodeAnnotationName(ModifiedDeclaration declaration) { - return declaration.addImport(this.annotationName) ? this.getShortAnnotationName() : this.annotationName; - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.annotationName); - } - - /** - * Add the specified annotation to the specified declaration, - * replacing the original annotation if present. - */ - protected abstract void addAnnotation(ModifiedDeclaration declaration, Annotation annotation); - - - // ********** public methods ********** - - /** - * This is 'public' because we use it in CombinationIndexedDeclarationAnnotationAdapter - * to get the annotation name from a NestedIndexedDeclarationAnnotationAdapter. - */ - public String getAnnotationName() { - return this.annotationName; - } - - - // ********** helper methods ********** - - protected boolean nameMatches(ModifiedDeclaration declaration, Annotation annotation) { - return this.nameMatches(declaration, annotation, this.annotationName); - } - - protected boolean nameMatches(ModifiedDeclaration declaration, Annotation annotation, String name) { - return declaration.annotationIsNamed(annotation, name); - } - - protected MarkerAnnotation newMarkerAnnotation(AST ast) { - return this.newMarkerAnnotation(ast, this.annotationName); - } - - protected MarkerAnnotation newMarkerAnnotation(AST ast, String name) { - MarkerAnnotation annotation = ast.newMarkerAnnotation(); - annotation.setTypeName(ast.newName(name)); - return annotation; - } - - protected SingleMemberAnnotation newSingleMemberAnnotation(AST ast) { - return this.newSingleMemberAnnotation(ast, this.annotationName); - } - - protected SingleMemberAnnotation newSingleMemberAnnotation(AST ast, String name) { - SingleMemberAnnotation annotation = ast.newSingleMemberAnnotation(); - annotation.setTypeName(ast.newName(name)); - return annotation; - } - - protected NormalAnnotation newNormalAnnotation(AST ast) { - return this.newNormalAnnotation(ast, this.annotationName); - } - - protected NormalAnnotation newNormalAnnotation(AST ast, String name) { - NormalAnnotation annotation = ast.newNormalAnnotation(); - annotation.setTypeName(ast.newName(name)); - return annotation; - } - - protected String getShortAnnotationName() { - return convertToShortName(this.annotationName); - } - - protected static String convertToShortName(String name) { - return name.substring(name.lastIndexOf('.') + 1); - } - - @SuppressWarnings("unchecked") - protected List values(NormalAnnotation na) { - return na.values(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractExpressionConverter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractExpressionConverter.java deleted file mode 100644 index 66b49ff157..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractExpressionConverter.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * Gather together the common implementation behavior. - * T is the type of the object to be converted to and from an expression. - * - * We're still figuring out Java Generics here.... The methods in this abstract - * class work fine with any subclass of Expression E; but a ClassCastException - * will occur as soon as we call any method implemented by a subclass - * (e.g. StringExpressionConverter) that expects a particular subclass of - * Expression (e.g. StringLiteral). - */ -public abstract class AbstractExpressionConverter - implements ExpressionConverter -{ - - protected AbstractExpressionConverter() { - super(); - } - - - // ********** object -> expression ********** - - public Expression convert(T object, AST ast) { - return (object == null) ? this.convertNull(ast) : this.convertObject(object, ast); - } - - /** - * Return the expression for a null object. By default, a null object will - * be converted into a null expression. - */ - protected Expression convertNull(@SuppressWarnings("unused") AST ast) { - return null; - } - - /** - * The specified object is not null. - * @see #convert(Object, AST) - */ - protected abstract Expression convertObject(T object, AST ast); - - - // ********** expression -> object ********** - - public T convert(Expression expression) { - return (expression == null) ? this.convertNull() : this.convertExpression(expression); - } - - /** - * Return the object for a null expression. By default, a null expression will - * be converted into a null object. - */ - protected T convertNull() { - return null; - } - - /** - * The specified expression is not null. - * @see #convert(Expression) - */ - protected abstract T convertExpression(Expression expression); - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractJDTType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractJDTType.java deleted file mode 100644 index abbd202f7a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractJDTType.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.AbstractTypeDeclaration; -import org.eclipse.jdt.core.dom.BodyDeclaration; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumDeclaration; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jdt.core.dom.TypeDeclaration; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.common.utility.CommandExecutor; - -/** - * Adapt and extend a JDT abstract type. - */ -public abstract class AbstractJDTType - extends JDTMember - implements AbstractType -{ - - /** - * constructor for the compilation unit's primary type - */ - protected AbstractJDTType( - AbstractTypeDeclaration typeDeclaration, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor) { - this(typeDeclaration, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance()); - } - - /** - * constructor for the compilation unit's primary type - */ - protected AbstractJDTType( - AbstractTypeDeclaration typeDeclaration, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor, - AnnotationEditFormatter annotationEditFormatter) { - this(null, typeDeclaration, 1, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter); - } - - /** - * constructor for nested types - */ - protected AbstractJDTType( - Type declaringType, - AbstractTypeDeclaration typeDeclaration, - int occurrence, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor) { - this(declaringType, typeDeclaration, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance()); - } - - /** - * constructor for nested types - */ - protected AbstractJDTType( - Type declaringType, - AbstractTypeDeclaration typeDeclaration, - int occurrence, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor, - AnnotationEditFormatter annotationEditFormatter) { - super(declaringType, typeDeclaration.getName().getFullyQualifiedName(), occurrence, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter); - } - - /** - * constructor for testing - */ - protected AbstractJDTType(Type declaringType, String name, int occurrence, ICompilationUnit compilationUnit) { - super(declaringType, name, occurrence, compilationUnit, CommandExecutor.Default.instance(), DefaultAnnotationEditFormatter.instance()); - } - - @Override - protected Type getDeclaringType() { - return (Type) super.getDeclaringType(); - } - - // ********** Member/Type implementation ********** - - public ITypeBinding getBinding(CompilationUnit astRoot) { - AbstractTypeDeclaration td = this.getBodyDeclaration(astRoot); - return (td == null) ? null : td.resolveBinding(); - } - - /** - * find the type's body declaration in the specified AST - */ - @Override - public AbstractTypeDeclaration getBodyDeclaration(CompilationUnit astRoot) { - Type declaringType = this.getDeclaringType(); - if (declaringType == null) { - return this.getTopLevelTypeDeclaration(astRoot); - } - TypeDeclaration typeDeclaration = declaringType.getBodyDeclaration(astRoot); - // the type declaration can be null when the source is completely hosed - return (typeDeclaration == null) ? null : this.getNestedTypeDeclaration(typeDeclaration); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return new ASTNodeTextRange(this.getBodyDeclaration(astRoot).getName()); - } - - - // ********** internal ********** - - /** - * return the first top-level type in the specified AST with a matching name - */ - protected AbstractTypeDeclaration getTopLevelTypeDeclaration(CompilationUnit astRoot) { - return this.getTypeDeclaration(types(astRoot)); - } - - protected AbstractTypeDeclaration getTypeDeclaration(List typeDeclarations) { - return this.getTypeDeclaration(typeDeclarations.toArray(new AbstractTypeDeclaration[typeDeclarations.size()])); - } - - /** - * Return the nested type declaration with matching name and occurrence within the declaring type - */ - protected abstract AbstractTypeDeclaration getNestedTypeDeclaration(TypeDeclaration declaringTypeDeclaration); - - /** - * return the type declaration corresponding to the type from the specified - * set of type declarations (match name and occurrence). - * Only return type or enum declarations - */ - protected AbstractTypeDeclaration getTypeDeclaration(AbstractTypeDeclaration[] typeDeclarations) { - String name = this.getName(); - int occurrence = this.getOccurrence(); - int count = 0; - for (AbstractTypeDeclaration typeDeclaration : typeDeclarations) { - if (typeDeclaration.getName().getFullyQualifiedName().equals(name)) { - count++; - if (count == occurrence) { - return (typeDeclaration.getNodeType() == this.getASTNodeType()) ? typeDeclaration : null; - } - } - } - // return null if the type is no longer in the source code; - // this can happen when the context model has not yet - // been synchronized with the resource model but is still - // asking for an ASTNode (e.g. during a selection event) - return null; - } - - protected abstract int getASTNodeType(); - - /** - * we only instantiate a single top-level, non-annotation - * type per compilation unit (i.e. a class, enum, or interface) - */ - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - protected static List types(CompilationUnit astRoot) { - return astRoot.types(); - } - - protected static EnumDeclaration[] getEnums(TypeDeclaration declaringTypeDeclaration) { - List bd = bodyDeclarations(declaringTypeDeclaration); - int typeCount = 0; - for (Iterator it = bd.listIterator(); it.hasNext(); ) { - if (it.next().getNodeType() == ASTNode.ENUM_DECLARATION) { - typeCount++; - } - } - EnumDeclaration[] memberEnums = new EnumDeclaration[typeCount]; - int next = 0; - for (Iterator it = bd.listIterator(); it.hasNext(); ) { - BodyDeclaration decl = it.next(); - if (decl.getNodeType() == ASTNode.ENUM_DECLARATION) { - memberEnums[next++] = (EnumDeclaration) decl; - } - } - return memberEnums; - } - - @SuppressWarnings("unchecked") - protected static List bodyDeclarations(TypeDeclaration typeDeclaration) { - return typeDeclaration.bodyDeclarations(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractNestedDeclarationAnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractNestedDeclarationAnnotationAdapter.java deleted file mode 100644 index 1e12f713b0..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AbstractNestedDeclarationAnnotationAdapter.java +++ /dev/null @@ -1,403 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jdt.core.dom.MemberValuePair; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; - -/** - * Pull together some of the behavior common to - * {@link NestedDeclarationAnnotationAdapter} - * and {@link NestedIndexedDeclarationAnnotationAdapter} - */ -public abstract class AbstractNestedDeclarationAnnotationAdapter - extends AbstractDeclarationAnnotationAdapter -{ - private final DeclarationAnnotationAdapter outerAnnotationAdapter; - private final String elementName; - - // reduce NLS checks - protected static final String VALUE = "value"; //$NON-NLS-1$ - - - // ********** constructors ********** - - /** - * The default element name is value. - */ - protected AbstractNestedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter outerAnnotationAdapter, String annotationName) { - this(outerAnnotationAdapter, VALUE, annotationName); - } - - protected AbstractNestedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter outerAnnotationAdapter, String elementName, String annotationName) { - super(annotationName); - this.outerAnnotationAdapter = outerAnnotationAdapter; - this.elementName = elementName; - } - - - // ********** DeclarationAnnotationAdapter implementation ********** - - public Annotation getAnnotation(ModifiedDeclaration declaration) { - Annotation outer = this.outerAnnotationAdapter.getAnnotation(declaration); - if (outer == null) { - return null; - } - Expression value = this.elementValue(outer); - if (value == null) { - return null; - } - Annotation inner = this.getAnnotation(value); - if (inner == null) { - return null; - } - // return the annotation only if it has a matching name(?) - return this.nameMatches(declaration, inner) ? inner : null; - } - - public void removeAnnotation(ModifiedDeclaration declaration) { - Annotation outer = this.outerAnnotationAdapter.getAnnotation(declaration); - if (outer == null) { - return; - } - Expression value = this.elementValue(outer); - if (value == null) { - return; - } - // hack to allow short-circuit when the value is an array initializer - if (this.removeAnnotation(declaration, outer, value)) { - return; - } - Annotation inner = this.annotationValue(value); - if (inner == null) { - return; - } - // remove the annotation only if it has a matching name(?) - if (this.nameMatches(declaration, inner)) { - this.removeElementAndNormalize(declaration, outer); - } - } - - public ASTNode getAstNode(ModifiedDeclaration declaration) { - // if the annotation is missing, return the outer annotation's node - Annotation annotation = this.getAnnotation(declaration); - return (annotation != null) ? annotation : this.outerAnnotationAdapter.getAstNode(declaration); - } - - @Override - protected void addAnnotation(ModifiedDeclaration declaration, Annotation inner) { - Annotation outer = this.outerAnnotationAdapter.getAnnotation(declaration); - if (outer == null) { - this.buildNewOuterAnnotation(declaration, inner); - } else if (outer.isMarkerAnnotation()) { - this.modifyAnnotation(declaration, (MarkerAnnotation) outer, inner); - } else if (outer.isSingleMemberAnnotation()) { - this.modifyAnnotation(declaration, (SingleMemberAnnotation) outer, inner); - } else if (outer.isNormalAnnotation()) { - this.modifyAnnotation(declaration, (NormalAnnotation) outer, inner); - } else { - throw new IllegalStateException("unknown annotation type: " + outer); //$NON-NLS-1$ - } - } - - - // ********** abstract methods ********** - - /** - * Return an annotation extracted from the specified expression, - * which is the value of the adapter's element. - */ - protected abstract Annotation getAnnotation(Expression value); - - /** - * Remove the annotation from the specified expression, - * which is the value of the adapter's element. - * Return whether the removal was successful. - */ - protected abstract boolean removeAnnotation(ModifiedDeclaration declaration, Annotation outer, Expression value); - - /** - * Set the value of the specified outer annotation to the - * specified inner annotation. - */ - protected abstract void modifyAnnotationValue(SingleMemberAnnotation outer, Annotation inner); - - /** - * Set the value of the specified member value pair to the - * specified inner annotation. - */ - protected abstract void modifyMemberValuePair(MemberValuePair pair, Annotation inner); - - - // ********** public methods ********** - - public DeclarationAnnotationAdapter getOuterAnnotationAdapter() { - return this.outerAnnotationAdapter; - } - - public String getElementName() { - return this.elementName; - } - - - // ********** internal methods ********** - - /** - * If the specified expression is an annotation, cast it to an annotation; - * otherwise return null. - */ - protected Annotation annotationValue(Expression expression) { - switch (expression.getNodeType()) { - case ASTNode.NORMAL_ANNOTATION: - case ASTNode.SINGLE_MEMBER_ANNOTATION: - case ASTNode.MARKER_ANNOTATION: - return (Annotation) expression; - default: - return null; - } - } - - /** - * Remove the first annotation element with the specified name - * from the specified annotation, converting the annotation as appropriate. - */ - protected void removeElementAndNormalize(ModifiedDeclaration declaration, Annotation outer) { - if (outer.isNormalAnnotation()) { - this.removeElementAndNormalize(declaration, (NormalAnnotation) outer); - } else if (outer.isSingleMemberAnnotation()) { - this.removeElementAndNormalize(declaration, (SingleMemberAnnotation) outer); - } else if (outer.isMarkerAnnotation()) { - this.removeElementAndNormalize(declaration, (MarkerAnnotation) outer); - } else { - throw new IllegalArgumentException("unknown annotation type: " + outer); //$NON-NLS-1$ - } - } - - /** - * Remove the first annotation element with the adapter's element - * name from the specified annotation. Convert the annotation to - * a marker annotation or single member annotation if appropriate. - *
-	 * @Outer(name="Fred", foo=@Inner) => @Outer(name="Fred")
-	 * @Outer(foo=@Inner) => @Outer
-	 * 
- */ - protected void removeElementAndNormalize(ModifiedDeclaration declaration, NormalAnnotation outer) { - this.removeElement(outer); - this.normalizeAnnotation(declaration, outer); - } - - /** - * Remove from the specified annotation the element with - * the adapter's element name. - */ - protected void removeElement(NormalAnnotation annotation) { - for (Iterator stream = this.values(annotation).iterator(); stream.hasNext(); ) { - MemberValuePair pair = stream.next(); - if (pair.getName().getFullyQualifiedName().equals(this.elementName)) { - stream.remove(); - break; - } - } - } - - /** - * Convert the specified normal annotation to a marker annotation or - * single member annotation if appropriate. - */ - protected void normalizeAnnotation(ModifiedDeclaration declaration, NormalAnnotation outer) { - List values = this.values(outer); - switch (values.size()) { - case 0: - // if the elements are all gone, convert the annotation to a marker annotation - this.outerAnnotationAdapter.newMarkerAnnotation(declaration); - break; - case 1: - MemberValuePair pair = values.get(0); - if (pair.getName().getFullyQualifiedName().equals(VALUE)) { - // if the last remaining element is 'value', convert the annotation to a single member annotation - Expression vv = pair.getValue(); - vv = (Expression) ASTNode.copySubtree(vv.getAST(), vv); - this.outerAnnotationAdapter.newSingleMemberAnnotation(declaration).setValue(vv); - } - break; - default: - // do nothing - break; - } - } - - /** - * Convert the specified single member annotation to a marker annotation - * if the adapter's element name is value. - */ - protected void removeElementAndNormalize(ModifiedDeclaration declaration, @SuppressWarnings("unused") SingleMemberAnnotation outer) { - if (this.elementName.equals(VALUE)) { - this.outerAnnotationAdapter.newMarkerAnnotation(declaration); - } - } - - protected void removeElementAndNormalize(@SuppressWarnings("unused") ModifiedDeclaration declaration, @SuppressWarnings("unused") MarkerAnnotation outer) { - // NOP - } - - /** - * Return the value of the *first* annotation element - * with the adapter's element name. - * Return null if the annotation has no such element. - * (An element name of "value" will return the value of a single - * member annotation.) - */ - protected Expression elementValue(Annotation annotation) { - if (annotation.isNormalAnnotation()) { - return this.elementValue((NormalAnnotation) annotation); - } - if (annotation.isSingleMemberAnnotation()) { - return this.elementValue((SingleMemberAnnotation) annotation); - } - return null; - } - - protected Expression elementValue(NormalAnnotation annotation) { - MemberValuePair pair = this.memberValuePair(annotation); - return (pair == null) ? null : pair.getValue(); - } - - /** - * If the adapter's element name is "value", return the value of the - * annotation, otherwise return null. - */ - protected Expression elementValue(SingleMemberAnnotation annotation) { - return this.elementName.equals(VALUE) ? annotation.getValue() : null; - } - - /** - * Return the *first* member value pair for the adapter's element name. - * Return null if the specified annotation has no such element. - */ - protected MemberValuePair memberValuePair(NormalAnnotation annotation) { - for (MemberValuePair pair : this.values(annotation)) { - if (pair.getName().getFullyQualifiedName().equals(this.elementName)) { - return pair; - } - } - return null; - } - - /** - * Build a new outer annotation and add the specified - * inner annotation to it: - *
-	 *     @Outer(@Inner)
-	 * 
- * or - *
-	 *     @Outer(foo=@Inner)
-	 * 
- */ - protected void buildNewOuterAnnotation(ModifiedDeclaration declaration, Annotation inner) { - if (this.elementName.equals(VALUE)) { - this.outerAnnotationAdapter.newSingleMemberAnnotation(declaration).setValue(this.buildNewInnerExpression(inner)); - } else { - List values = this.values(this.outerAnnotationAdapter.newNormalAnnotation(declaration)); - values.add(this.newMemberValuePair(this.buildNewInnerExpression(inner))); - } - } - - /** - * Build an expression to be added to a new outer annotation - * for the specified inner annotation. - */ - protected abstract Expression buildNewInnerExpression(Annotation inner); - - /** - * Build a new member value pair with the specified name and value. - */ - protected MemberValuePair newMemberValuePair(String name, Expression value) { - AST ast = value.getAST(); - MemberValuePair pair = ast.newMemberValuePair(); - pair.setName(ast.newSimpleName(name)); - pair.setValue(value); - return pair; - } - - /** - * Build a new member value pair with the adapter's element name - * and the specified inner annotation. - */ - protected MemberValuePair newMemberValuePair(Expression value) { - return this.newMemberValuePair(this.elementName, value); - } - - /** - * Add the specified inner annotation to the marker annotation. - */ - protected void modifyAnnotation(ModifiedDeclaration declaration, @SuppressWarnings("unused") MarkerAnnotation outer, Annotation inner) { - this.buildNewOuterAnnotation(declaration, inner); - } - - /** - * Add the specified inner annotation to the single member annotation. - */ - protected void modifyAnnotation(ModifiedDeclaration declaration, SingleMemberAnnotation outer, Annotation inner) { - if (this.elementName.equals(VALUE)) { - this.modifyAnnotationValue(outer, inner); - } else { - this.modifyAnnotationNonValue(declaration, outer, inner); - } - } - - /** - * Add the specified inner annotation to the single member annotation, - * converting it to a normal annotation: - *
-	 *     @Outer("lorem ipsum") => @Outer(value="lorem ipsum", foo=@Inner)
-	 * 
- */ - protected void modifyAnnotationNonValue(ModifiedDeclaration declaration, SingleMemberAnnotation outer, Annotation inner) { - Expression vv = outer.getValue(); - vv = (Expression) ASTNode.copySubtree(vv.getAST(), vv); - NormalAnnotation newOuter = this.outerAnnotationAdapter.newNormalAnnotation(declaration); - List values = this.values(newOuter); - values.add(this.newMemberValuePair(VALUE, vv)); - values.add(this.newMemberValuePair(this.buildNewInnerExpression(inner))); - } - - /** - * Add the specified inner annotation to the normal annotation: - *
-	 *     @Outer(bar="lorem ipsum") => @Outer(bar="lorem ipsum", foo=@Inner)
-	 * 
- * or - *
-	 *     @Outer(foo=@Inner("lorem ipsum")) => @Outer(foo=@Inner)
-	 * 
- */ - protected void modifyAnnotation(@SuppressWarnings("unused") ModifiedDeclaration declaration, NormalAnnotation outer, Annotation inner) { - MemberValuePair pair = this.memberValuePair(outer); - if (pair == null) { - List values = this.values(outer); - values.add(this.newMemberValuePair(inner)); - } else { - this.modifyMemberValuePair(pair, inner); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AnnotatedElementAnnotationElementAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AnnotatedElementAnnotationElementAdapter.java deleted file mode 100644 index 4419a56f0c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AnnotatedElementAnnotationElementAdapter.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.StringTools; - - /** - * Adapt an annotated element and a declaration annotation element adapter. - */ -public class AnnotatedElementAnnotationElementAdapter - implements AnnotationElementAdapter -{ - private final AnnotatedElement annotatedElement; - private final DeclarationAnnotationElementAdapter daea; - - - // ********** constructor ********** - - public AnnotatedElementAnnotationElementAdapter(AnnotatedElement annotatedElement, DeclarationAnnotationElementAdapter daea) { - super(); - this.annotatedElement = annotatedElement; - this.daea = daea; - } - - - // ********** AnnotationElementAdapter implementation ********** - - public T getValue() { - return this.daea.getValue(this.annotatedElement.getModifiedDeclaration()); - } - - public T getValue(CompilationUnit astRoot) { - return this.daea.getValue(this.annotatedElement.getModifiedDeclaration(astRoot)); - } - - public void setValue(T value) { - this.edit(this.buildSetValueEditor(value)); - } - - public Expression getExpression(CompilationUnit astRoot) { - return this.daea.getExpression(this.annotatedElement.getModifiedDeclaration(astRoot)); - } - - public ASTNode getAstNode(CompilationUnit astRoot) { - return this.daea.getAstNode(this.annotatedElement.getModifiedDeclaration(astRoot)); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.daea); - } - - - // ********** internal methods ********** - - protected void edit(AnnotatedElement.Editor editor) { - this.annotatedElement.edit(editor); - } - - protected AnnotatedElement.Editor buildSetValueEditor(T value) { - return new SetValueEditor(value, this.daea); - } - - - // ********** member classes ********** - - protected static class SetValueEditor implements AnnotatedElement.Editor { - private final DeclarationAnnotationElementAdapter daea; - private final T value; - - SetValueEditor(T value, DeclarationAnnotationElementAdapter daea) { - super(); - this.value = value; - this.daea = daea; - } - public void edit(ModifiedDeclaration declaration) { - this.daea.setValue(this.value, declaration); - } - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AnnotationStringArrayExpressionConverter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AnnotationStringArrayExpressionConverter.java deleted file mode 100644 index bd085ef4ff..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/AnnotationStringArrayExpressionConverter.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.ArrayInitializer; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; - -/** - * Convert an array initializer or single expression to/from an array of - * strings (e.g. {"text0", "text1"}). - * E is the type of the expressions to be found either stand-alone or - * as elements in the array initializer. - */ -public class AnnotationStringArrayExpressionConverter - extends AbstractExpressionConverter -{ - private final ExpressionConverter elementConverter; - private final StringArrayExpressionConverter arrayConverter; - - - /** - * The default behavior is to remove the array initializer if it is empty. - */ - public AnnotationStringArrayExpressionConverter(ExpressionConverter elementConverter) { - this(elementConverter, true); - } - - public AnnotationStringArrayExpressionConverter(ExpressionConverter elementConverter, boolean removeArrayInitializerWhenEmpty) { - super(); - this.elementConverter = elementConverter; - this.arrayConverter = new StringArrayExpressionConverter(elementConverter, removeArrayInitializerWhenEmpty); - } - - /** - * if we only have a single string in the array return the single expression, - * without braces, instead of an array initializer - */ - @Override - protected Expression convertObject(String[] strings, AST ast) { - return (strings.length == 1) ? - this.elementConverter.convert(strings[0], ast) - : - this.arrayConverter.convertObject(strings, ast); - } - - @Override - protected String[] convertNull() { - return this.arrayConverter.convertNull(); - } - - /** - * check for a single expression with no surrounding braces, implying a - * single-entry array - */ - @Override - protected String[] convertExpression(Expression expression) { - return (expression.getNodeType() == ASTNode.ARRAY_INITIALIZER) ? - this.arrayConverter.convertArrayInitializer((ArrayInitializer) expression) - : - new String[] {this.elementConverter.convert(expression)}; - } - - - // ********** factory methods ********** - - /** - * Build an expression converter for an annotation element of type String[]. - * @Foo(bar={"text0", "text1"}) - * or - * @Foo(bar="text0") - */ - public static AnnotationStringArrayExpressionConverter forStrings() { - return new AnnotationStringArrayExpressionConverter(StringExpressionConverter.instance()); - } - - /** - * Build an expression converter for an annotation element of type []. - * @Foo(bar={BAZ, BAT}) - * or - * @Foo(bar=BAZ) - */ - public static AnnotationStringArrayExpressionConverter forNames() { - return new AnnotationStringArrayExpressionConverter(NameStringExpressionConverter.instance()); - } - - - /** - * Build an expression converter for an annotation element of type Class[]. - * @Foo(bar={Baz.class, Bat.class}) - * or - * @Foo(bar=Baz.class) - */ - public static AnnotationStringArrayExpressionConverter forTypes() { - return new AnnotationStringArrayExpressionConverter(TypeStringExpressionConverter.instance()); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/BooleanExpressionConverter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/BooleanExpressionConverter.java deleted file mode 100644 index f33a719986..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/BooleanExpressionConverter.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.BooleanLiteral; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; - -/** - * Convert a boolean literal to/from a Boolean - * (e.g. Boolean.TRUE). - */ -public final class BooleanExpressionConverter - extends AbstractExpressionConverter -{ - private static final ExpressionConverter INSTANCE = new BooleanExpressionConverter(); - - /** - * Return the singleton. - */ - public static ExpressionConverter instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private BooleanExpressionConverter() { - super(); - } - - @Override - protected BooleanLiteral convertObject(Boolean booleanObject, AST ast) { - return ast.newBooleanLiteral(booleanObject.booleanValue()); - } - - @Override - protected Boolean convertExpression(Expression expression) { - Object value = expression.resolveConstantExpressionValue(); - return (value instanceof Boolean) ? ((Boolean) value) : null; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/CharacterStringExpressionConverter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/CharacterStringExpressionConverter.java deleted file mode 100644 index cfb470581b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/CharacterStringExpressionConverter.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.CharacterLiteral; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; - -/** - * Convert a character literal to/from a string representation of a character - * (e.g. "A"). - */ -public final class CharacterStringExpressionConverter - extends AbstractExpressionConverter -{ - private static final ExpressionConverter INSTANCE = new CharacterStringExpressionConverter(); - - /** - * Return the singleton. - */ - public static ExpressionConverter instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private CharacterStringExpressionConverter() { - super(); - } - - @Override - protected CharacterLiteral convertObject(String string, AST ast) { - CharacterLiteral characterLiteral = ast.newCharacterLiteral(); - characterLiteral.setCharValue(string.charAt(0)); - return characterLiteral; - } - - @Override - protected String convertExpression(Expression expression) { - Object value = expression.resolveConstantExpressionValue(); - return (value instanceof Character) ? ((Character) value).toString() : null; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/CombinationIndexedDeclarationAnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/CombinationIndexedDeclarationAnnotationAdapter.java deleted file mode 100644 index c41fc8e8a9..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/CombinationIndexedDeclarationAnnotationAdapter.java +++ /dev/null @@ -1,500 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.util.List; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jdt.core.dom.MemberValuePair; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * Manipulate an annotation that either occurs stand-alone, e.g. - *
- *     @Inner("zero")
- *     private int id;
- * 
- * - * or is embedded in an element array within another annotation, e.g. - *
- *     @Outer(foo={@Inner("zero"), @Inner("one"), @Inner("two")})
- *     private int id;
- *     
- *         annotationName = "Inner"
- *         containerAnnotationName = "Outer"
- *         elementName = "foo"
- *         index = 0-2
- * 
- * - * This is a useful pattern because a declaration cannot have more - * than one annotation of the same type, and allowing the stand-alone - * configuration reduces clutter. - *
- * NB: This configuration only makes sense for "top-level" annotations, as - * opposed to "nested" annotations. This is because annotation elements - * can only be declared with a type of a single annotation and annotations - * cannot be part of an inheritance hierarchy. - * For example, the following configurations cannot *both* be supported: - *
- *     @Foo(bar=@Outer(...))
- *     private int id;
- * 
- *     @Foo(bar=@Inner(...))  // not allowed
- *     private int id;
- * 
- * - * NB: Behavior is undefined when both the stand-alone and the nested - * configurations annotate the same declaration, e.g. - *
- *     // undefined behavior
- *     @Inner("zero")
- *     @Outer(foo={@Inner("zero"), @Inner("one"), @Inner("two")})
- *     private int id;
- * 
- */ -public class CombinationIndexedDeclarationAnnotationAdapter - implements IndexedDeclarationAnnotationAdapter -{ - - /** - * this adapter is used when the annotation is "stand-alone": - *
-	 *     @Inner("zero")
-	 * 
- * and is only used when the index is 0 or 1 - */ - private final SimpleDeclarationAnnotationAdapter standAloneAnnotationAdapter; - - /** - * this adapter is used when the annotation is "nested": - *
-	 *     @Outer(foo={@Inner("zero"), @Inner("one")})
-	 * 
- */ - private final NestedIndexedDeclarationAnnotationAdapter nestedAnnotationAdapter; - - /** - * this adapter is for the "nested" annotation at the zero index; - * and is only used when the index is 1 - */ - private final NestedIndexedDeclarationAnnotationAdapter zeroNestedAnnotationAdapter; - - // reduce NLS checks - protected static final String VALUE = "value"; //$NON-NLS-1$ - - - // ********** constructors ********** - - /** - * default element name is "value" - *
-	 *     @Inner("zero")
-	 *     @Outer({@Inner("zero"), @Inner("one")})
-	 * 
- */ - public CombinationIndexedDeclarationAnnotationAdapter(String annotationName, String containerAnnotationName, int index) { - this(annotationName, containerAnnotationName, VALUE, index); - } - - public CombinationIndexedDeclarationAnnotationAdapter(String annotationName, String containerAnnotationName, String elementName, int index) { - this(new SimpleDeclarationAnnotationAdapter(annotationName), new SimpleDeclarationAnnotationAdapter(containerAnnotationName), elementName, index, annotationName); - } - - /** - * default element name is "value" - */ - public CombinationIndexedDeclarationAnnotationAdapter( - SimpleDeclarationAnnotationAdapter standAloneAnnotationAdapter, - SimpleDeclarationAnnotationAdapter containerAnnotationAdapter, - int index, - String nestedAnnotationName - ) { - this(standAloneAnnotationAdapter, containerAnnotationAdapter, VALUE, index, nestedAnnotationName); - } - - public CombinationIndexedDeclarationAnnotationAdapter( - SimpleDeclarationAnnotationAdapter standAloneAnnotationAdapter, - SimpleDeclarationAnnotationAdapter containerAnnotationAdapter, - String elementName, - int index, - String nestedAnnotationName - ) { - super(); - this.standAloneAnnotationAdapter = standAloneAnnotationAdapter; - this.nestedAnnotationAdapter = new NestedIndexedDeclarationAnnotationAdapter(containerAnnotationAdapter, elementName, index, nestedAnnotationName); - this.zeroNestedAnnotationAdapter = new NestedIndexedDeclarationAnnotationAdapter(containerAnnotationAdapter, elementName, 0, nestedAnnotationName); - } - - - // ********** DeclarationAnnotationAdapter implementation ********** - - public Annotation getAnnotation(ModifiedDeclaration declaration) { - if (this.getIndex() == 0) { - // check for the stand-alone annotation - Annotation standAloneAnnotation = this.getStandAloneAnnotation(declaration); - if (standAloneAnnotation != null) { - return standAloneAnnotation; - } - } - return this.getNestedAnnotation(declaration); - } - - /** - *
-	 * [none] => @Inner
-	 *     or
-	 * @Inner("lorem ipsum") => @Inner
-	 *     or
-	 * @Inner(text="lorem ipsum") => @Inner
-	 *     or
-	 * @Outer(foo={@Inner, @Inner}) => @Outer(foo={@Inner, @Inner, @Inner})
-	 *     or
-	 * @Outer(foo=@Inner) => @Outer(foo={@Inner, @Inner})
-	 *     or
-	 * @Inner => @Outer(foo={@Inner, @Inner})
-	 *     etc.
-	 * 
- */ - public MarkerAnnotation newMarkerAnnotation(ModifiedDeclaration declaration) { - return (MarkerAnnotation) this.newAnnotation(MARKER_ANNOTATION_FACTORY, declaration); - } - - public SingleMemberAnnotation newSingleMemberAnnotation(ModifiedDeclaration declaration) { - return (SingleMemberAnnotation) this.newAnnotation(SINGLE_MEMBER_ANNOTATION_FACTORY, declaration); - } - - public NormalAnnotation newNormalAnnotation(ModifiedDeclaration declaration) { - return (NormalAnnotation) this.newAnnotation(NORMAL_ANNOTATION_FACTORY, declaration); - } - - public void removeAnnotation(ModifiedDeclaration declaration) { - if (this.getIndex() == 0) { - // check for the stand-alone annotation - if (this.standAloneAnnotationIsPresent(declaration)) { - this.removeStandAloneAnnotation(declaration); - return; - } - } - this.removeNestedAnnotation(declaration); - if (this.nestedElementCanBeConvertedToStandAlone(declaration)) { - this.convertLastElementAnnotationToStandAloneAnnotation(declaration); - } - } - - public ASTNode getAstNode(ModifiedDeclaration declaration) { - // if the annotation is missing, delegate to the nested annotation adapter - Annotation annotation = this.getAnnotation(declaration); - return (annotation != null) ? annotation : this.nestedAnnotationAdapter.getAstNode(declaration); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.getAnnotationName()); - } - - - // ********** IndexedDeclarationAnnotationAdapter implementation ********** - - public int getIndex() { - return this.nestedAnnotationAdapter.getIndex(); - } - - public void moveAnnotation(int newIndex, ModifiedDeclaration declaration) { - int oldIndex = this.getIndex(); - if (newIndex == oldIndex) { - return; - } - - Annotation standAloneAnnotation = this.getStandAloneAnnotation(declaration); - if (standAloneAnnotation == null) { - this.moveNestedAnnotation(newIndex, declaration); - if (this.nestedElementCanBeConvertedToStandAlone(declaration)) { - this.convertLastElementAnnotationToStandAloneAnnotation(declaration); - } - } else { - if ((oldIndex == 0) && (newIndex == 1)) { - // this is one of two situations where we transition from stand-alone to container - this.moveStandAloneAnnotationToContainerAnnotation(standAloneAnnotation, declaration); - this.moveNestedAnnotation(newIndex, declaration); - } else if (newIndex == 0) { - // we are moving a 'null' entry on top of the stand-alone, so remove it - this.removeStandAloneAnnotation(declaration); - } else { - throw new IllegalStateException("old index = " + oldIndex + "; new index = " + newIndex); //$NON-NLS-1$ //$NON-NLS-2$ - } - } - } - - - // ********** internal methods ********** - - /** - * build the appropriate new annotation, - * which may require moving the 0th annotation from "stand-alone" to "nested" - */ - private Annotation newAnnotation(AnnotationFactory annotationFactory, ModifiedDeclaration declaration) { - if (this.getIndex() == 0) { - return this.newZeroAnnotation(annotationFactory, declaration); - } - if (this.zeroNestedAnnotationIsPresent(declaration)) { - // manipulate the container annotation - ignore the stand-alone annotation(?) - // @Outer(foo=@Inner("zero")) => @Outer(foo={@Inner("zero"), @Inner}) - // or - // @Outer(foo={@Inner("zero"), @Inner("one")}) => @Outer(foo={@Inner("zero"), @Inner}) - return annotationFactory.newAnnotation(this.nestedAnnotationAdapter, declaration); - } - - // this is one of two situations where we transition from stand-alone to container - this.moveStandAloneAnnotationToContainerAnnotation(declaration); - // once the stand-alone annotation is moved to index=0, build the new annotation at index=1 - return annotationFactory.newAnnotation(this.nestedAnnotationAdapter, declaration); - } - - /** - * the index is 0 - build the appropriate new annotation, - * which may be either "stand-alone" or "nested" - */ - private Annotation newZeroAnnotation(AnnotationFactory annotationFactory, ModifiedDeclaration declaration) { - if (this.standAloneAnnotationIsPresent(declaration)) { - // replace the stand-alone annotation - ignore the container annotation(?) - // @Inner(text="lorem ipsum") => @Inner - return annotationFactory.newAnnotation(this.standAloneAnnotationAdapter, declaration); - } - if (this.containerAnnotationIsPresent(declaration)) { - // manipulate the container annotation - // @Outer(foo=@Inner(text="lorem ipsum")) => @Outer(foo=@Inner) - return annotationFactory.newAnnotation(this.nestedAnnotationAdapter, declaration); - } - // neither annotation is present - add a new stand-alone annotation - return annotationFactory.newAnnotation(this.standAloneAnnotationAdapter, declaration); - } - - /** - * move the stand-alone annotation to the container annotation at index=0 - */ - private void moveStandAloneAnnotationToContainerAnnotation(ModifiedDeclaration declaration) { - Annotation standAloneAnnotation = this.getStandAloneAnnotation(declaration); - if (standAloneAnnotation == null) { - throw new IllegalStateException("the stand-alone annotation is missing"); //$NON-NLS-1$ - } - this.moveStandAloneAnnotationToContainerAnnotation(standAloneAnnotation, declaration); - } - - /** - * move the specified, non-null, stand-alone annotation to - * the container annotation at index=0 - */ - private void moveStandAloneAnnotationToContainerAnnotation(Annotation standAloneAnnotation, ModifiedDeclaration declaration) { - if (standAloneAnnotation.isMarkerAnnotation()) { - this.zeroNestedAnnotationAdapter.newMarkerAnnotation(declaration); - } else if (standAloneAnnotation.isSingleMemberAnnotation()) { - Expression vv = ((SingleMemberAnnotation) standAloneAnnotation).getValue(); - vv = (Expression) ASTNode.copySubtree(vv.getAST(), vv); - this.zeroNestedAnnotationAdapter.newSingleMemberAnnotation(declaration).setValue(vv); - } else if (standAloneAnnotation.isNormalAnnotation()) { - NormalAnnotation newNA = this.zeroNestedAnnotationAdapter.newNormalAnnotation(declaration); - List values = this.values(newNA); - for (MemberValuePair pair : this.values((NormalAnnotation) standAloneAnnotation)) { - values.add((MemberValuePair) ASTNode.copySubtree(pair.getAST(), pair)); - } - } else { - throw new IllegalStateException("unknown annotation type: " + standAloneAnnotation); //$NON-NLS-1$ - } - this.removeStandAloneAnnotation(declaration); - } - - /** - * return whether the "nested" annotation container has been reduced to - * a single element (and the array initializer is converted to just - * the single remaining element) and can be further converted to the - * "stand-alone" annotation: - *
-	 *     @Outer(foo={@Inner("zero"), @Inner("one")}) =>
-	 *     @Outer(foo=@Inner("zero")) =>
-	 *     @Inner("zero")
-	 * 
- */ - private boolean nestedElementCanBeConvertedToStandAlone(ModifiedDeclaration declaration) { - Annotation containerAnnotation = this.getContainerAnnotation(declaration); - if (containerAnnotation == null) { - return false; - } - if (containerAnnotation.isMarkerAnnotation()) { - return false; - } - if (containerAnnotation.isSingleMemberAnnotation()) { - if (this.getElementName().equals(VALUE)) { - return (((SingleMemberAnnotation) containerAnnotation).getValue().getNodeType() != ASTNode.ARRAY_INITIALIZER) - && (this.zeroNestedAnnotationAdapter.getAnnotation(declaration) != null); - } - return false; - } - if (containerAnnotation.isNormalAnnotation()) { - NormalAnnotation na = (NormalAnnotation) containerAnnotation; - if (na.values().size() == 0) { - return false; // there are no elements present - } - if (na.values().size() != 1) { - return false; // there are other elements present - leave them all alone - } - MemberValuePair pair = (MemberValuePair) na.values().get(0); - if (this.getElementName().equals(pair.getName().getFullyQualifiedName())) { - return (pair.getValue().getNodeType() != ASTNode.ARRAY_INITIALIZER) - && (this.zeroNestedAnnotationAdapter.getAnnotation(declaration) != null); - } - return false; - } - throw new IllegalStateException("unknown annotation type: " + containerAnnotation); //$NON-NLS-1$ - } - - /** - * move the annotation in the container annotation at index=0 - * to the stand-alone annotation - */ - private void convertLastElementAnnotationToStandAloneAnnotation(ModifiedDeclaration declaration) { - Annotation last = this.zeroNestedAnnotationAdapter.getAnnotation(declaration); - if (last == null) { - throw new IllegalStateException("the last nested annotation is missing"); //$NON-NLS-1$ - } else if (last.isMarkerAnnotation()) { - this.newStandAloneMarkerAnnotation(declaration); - } else if (last.isSingleMemberAnnotation()) { - Expression vv = ((SingleMemberAnnotation) last).getValue(); - vv = (Expression) ASTNode.copySubtree(vv.getAST(), vv); - this.newStandAloneSingleMemberAnnotation(declaration).setValue(vv); - } else if (last.isNormalAnnotation()) { - NormalAnnotation newNA = this.newStandAloneNormalAnnotation(declaration); - List values = this.values(newNA); - for (MemberValuePair pair : this.values((NormalAnnotation) last)) { - values.add((MemberValuePair) ASTNode.copySubtree(pair.getAST(), pair)); - } - } else { - throw new IllegalStateException("unknown annotation type: " + last); //$NON-NLS-1$ - } - this.removeContainerAnnotation(declaration); - } - - private boolean standAloneAnnotationIsPresent(ModifiedDeclaration declaration) { - return this.getStandAloneAnnotation(declaration) != null; - } - - private Annotation getStandAloneAnnotation(ModifiedDeclaration declaration) { - return this.standAloneAnnotationAdapter.getAnnotation(declaration); - } - - private MarkerAnnotation newStandAloneMarkerAnnotation(ModifiedDeclaration declaration) { - return this.standAloneAnnotationAdapter.newMarkerAnnotation(declaration); - } - - private SingleMemberAnnotation newStandAloneSingleMemberAnnotation(ModifiedDeclaration declaration) { - return this.standAloneAnnotationAdapter.newSingleMemberAnnotation(declaration); - } - - private NormalAnnotation newStandAloneNormalAnnotation(ModifiedDeclaration declaration) { - return this.standAloneAnnotationAdapter.newNormalAnnotation(declaration); - } - - private void removeStandAloneAnnotation(ModifiedDeclaration declaration) { - this.standAloneAnnotationAdapter.removeAnnotation(declaration); - } - - private Annotation getNestedAnnotation(ModifiedDeclaration declaration) { - return this.nestedAnnotationAdapter.getAnnotation(declaration); - } - - private void moveNestedAnnotation(int newIndex, ModifiedDeclaration declaration) { - this.nestedAnnotationAdapter.moveAnnotation(newIndex, declaration); - } - - private void removeNestedAnnotation(ModifiedDeclaration declaration) { - this.nestedAnnotationAdapter.removeAnnotation(declaration); - } - - private boolean containerAnnotationIsPresent(ModifiedDeclaration declaration) { - return this.getContainerAnnotation(declaration) != null; - } - - private Annotation getContainerAnnotation(ModifiedDeclaration declaration) { - return this.nestedAnnotationAdapter.getOuterAnnotationAdapter().getAnnotation(declaration); - } - - private void removeContainerAnnotation(ModifiedDeclaration declaration) { - this.nestedAnnotationAdapter.getOuterAnnotationAdapter().removeAnnotation(declaration); - } - - private boolean zeroNestedAnnotationIsPresent(ModifiedDeclaration declaration) { - return this.getZeroNestedAnnotation(declaration) != null; - } - - private Annotation getZeroNestedAnnotation(ModifiedDeclaration declaration) { - return this.zeroNestedAnnotationAdapter.getAnnotation(declaration); - } - - private String getAnnotationName() { - return this.nestedAnnotationAdapter.getAnnotationName(); - } - - private String getElementName() { - return this.nestedAnnotationAdapter.getElementName(); - } - - @SuppressWarnings("unchecked") - protected List values(NormalAnnotation na) { - return na.values(); - } - - - // ********** annotation factories ********** - - /** - * define interface that allows us to "re-use" the nasty code in - * #newAnnotation(AnnotationFactory, ModifiedDeclaration) - */ - private interface AnnotationFactory { - Annotation newAnnotation(DeclarationAnnotationAdapter adapter, ModifiedDeclaration declaration); - } - - private static final AnnotationFactory MARKER_ANNOTATION_FACTORY = new AnnotationFactory() { - public Annotation newAnnotation(DeclarationAnnotationAdapter adapter, ModifiedDeclaration declaration) { - return adapter.newMarkerAnnotation(declaration); - } - @Override - public String toString() { - return "MarkerAnnotationFactory"; //$NON-NLS-1$ - } - }; - - private static final AnnotationFactory SINGLE_MEMBER_ANNOTATION_FACTORY = new AnnotationFactory() { - public Annotation newAnnotation(DeclarationAnnotationAdapter adapter, ModifiedDeclaration declaration) { - return adapter.newSingleMemberAnnotation(declaration); - } - @Override - public String toString() { - return "SingleMemberAnnotationFactory"; //$NON-NLS-1$ - } - }; - - private static final AnnotationFactory NORMAL_ANNOTATION_FACTORY = new AnnotationFactory() { - public Annotation newAnnotation(DeclarationAnnotationAdapter adapter, ModifiedDeclaration declaration) { - return adapter.newNormalAnnotation(declaration); - } - @Override - public String toString() { - return "NormalAnnotationFactory"; //$NON-NLS-1$ - } - }; - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ConversionDeclarationAnnotationElementAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ConversionDeclarationAnnotationElementAdapter.java deleted file mode 100644 index b65a2fec5f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ConversionDeclarationAnnotationElementAdapter.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * Wrap a declaration annotation element adapter that deals with AST - * expressions, converting them to/from various other objects. - * - * @param the type of the object be passed to and returned by the adapter - */ -public class ConversionDeclarationAnnotationElementAdapter - implements DeclarationAnnotationElementAdapter -{ - /** - * The wrapped adapter that returns and takes AST expressions. - */ - private final DeclarationAnnotationElementAdapter adapter; - - /** - * The converter that converts AST expressions to other objects - * (e.g. Strings). - */ - private final ExpressionConverter converter; - - - // ********** constructors ********** - - /** - * The default element name is value. - */ - public ConversionDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, ExpressionConverter converter) { - this(new ExpressionDeclarationAnnotationElementAdapter(annotationAdapter), converter); - } - - public ConversionDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter converter) { - this(new ExpressionDeclarationAnnotationElementAdapter(annotationAdapter, elementName), converter); - } - - public ConversionDeclarationAnnotationElementAdapter(DeclarationAnnotationElementAdapter adapter, ExpressionConverter converter) { - super(); - this.adapter = adapter; - this.converter = converter; - } - - - // ********** DeclarationAnnotationElementAdapter implementation ********** - - public T getValue(ModifiedDeclaration declaration) { - Expression expression = this.adapter.getValue(declaration); - return this.converter.convert(expression); - } - - public void setValue(T value, ModifiedDeclaration declaration) { - Expression expression; - try { - expression = this.converter.convert(value, declaration.getAst()); - } catch (IllegalArgumentException ex) { - // if there is a problem converting the 'value' to an Expression we get this exception - return; // don't set the value if it is "illegal" - } - this.adapter.setValue(expression, declaration); - } - - public Expression getExpression(ModifiedDeclaration declaration) { - return this.adapter.getExpression(declaration); - } - - public ASTNode getAstNode(ModifiedDeclaration declaration) { - return this.adapter.getAstNode(declaration); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.adapter); - } - - - // ********** factory static methods ********** - - /** - * The default element name is value; - * the default expression converter expects string constant expressions. - */ - public static ConversionDeclarationAnnotationElementAdapter forStrings(DeclarationAnnotationAdapter annotationAdapter) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, StringExpressionConverter.instance()); - } - - /** - * The default expression converter expects string constant expressions. - */ - public static ConversionDeclarationAnnotationElementAdapter forStrings(DeclarationAnnotationAdapter annotationAdapter, String elementName) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, StringExpressionConverter.instance()); - } - - /** - * The default element name is value; - * the default expression converter expects number constant expressions. - */ - public static ConversionDeclarationAnnotationElementAdapter forNumbers(DeclarationAnnotationAdapter annotationAdapter) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, NumberIntegerExpressionConverter.instance()); - } - - /** - * The default expression converter expects number constant expressions. - */ - public static ConversionDeclarationAnnotationElementAdapter forNumbers(DeclarationAnnotationAdapter annotationAdapter, String elementName) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, NumberIntegerExpressionConverter.instance()); - } - - /** - * The default element name is value; - * the default expression converter expects boolean constant expressions. - */ - public static ConversionDeclarationAnnotationElementAdapter forBooleans(DeclarationAnnotationAdapter annotationAdapter) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, BooleanExpressionConverter.instance()); - } - - /** - * The default expression converter expects boolean constant expressions. - */ - public static ConversionDeclarationAnnotationElementAdapter forBooleans(DeclarationAnnotationAdapter annotationAdapter, String elementName) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, BooleanExpressionConverter.instance()); - } - - /** - * The default element name is value; - * the default expression converter expects character constant expressions. - */ - public static ConversionDeclarationAnnotationElementAdapter forCharacters(DeclarationAnnotationAdapter annotationAdapter) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, CharacterStringExpressionConverter.instance()); - } - - /** - * The default expression converter expects character constant expressions. - */ - public static ConversionDeclarationAnnotationElementAdapter forCharacters(DeclarationAnnotationAdapter annotationAdapter, String elementName) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, CharacterStringExpressionConverter.instance()); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/DefaultAnnotationEditFormatter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/DefaultAnnotationEditFormatter.java deleted file mode 100644 index 97264a9d93..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/DefaultAnnotationEditFormatter.java +++ /dev/null @@ -1,219 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.text.edits.InsertEdit; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.MultiTextEdit; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.text.edits.TextEdit; - -/** - * This implementation will clean up some of the nasty Eclipse annotation - * formatting (or lack thereof); e.g. arrays of annotations. - */ -public final class DefaultAnnotationEditFormatter - implements AnnotationEditFormatter -{ - private static final DefaultAnnotationEditFormatter INSTANCE = new DefaultAnnotationEditFormatter(); - - /** - * Return the singleton. - */ - public static DefaultAnnotationEditFormatter instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private DefaultAnnotationEditFormatter() { - super(); - } - - /** - * TODO - */ - public void format(IDocument doc, TextEdit editTree) throws MalformedTreeException, BadLocationException { - TextEdit[] edits = editTree.getChildren(); - int len = edits.length; - if (len == 0) { - return; - } - - MultiTextEdit extraEdits = new MultiTextEdit(); - for (int i = 0; i < len; i++) { - TextEdit edit1 = edits[i]; - if ( ! (edit1 instanceof InsertEdit)) { - continue; // if the edit is not an insert, skip to the next edit - } - InsertEdit insert1 = (InsertEdit) edit1; - int j = i + 1; - if (j < len) { - TextEdit edit2 = edits[j]; - if (edit2 instanceof InsertEdit) { - InsertEdit insert2 = (InsertEdit) edit2; - String text1 = insert1.getText(); - String text2 = insert2.getText(); - int offset1 = insert1.getOffset(); - int offset2 = insert2.getOffset(); - if (this.stringIsAnnotation(text1) && text2.equals(" ")) { //$NON-NLS-1$ - // an annotation was inserted before something on the same line; - // replace the trailing space with a newline and appropriate indent - extraEdits.addChild(new ReplaceEdit(offset2, 1, this.buildCR(doc, offset2))); - i++; // jump the index past 'edit2' - continue; // go to the next edit - } - int comma1Length = this.commaLength(text1); - if ((comma1Length != 0) && this.stringIsAnnotation(text2)) { - // an annotation was inserted in an array initializer on the - // same line as the previous array element; - // replace the preceding space with a newline and appropriate indent - extraEdits.addChild(new ReplaceEdit(offset1 + comma1Length, text1.length() - comma1Length, this.buildCR(doc, offset1))); - i++; // jump the index past 'edit2' - continue; // go to the next edit - } - } - } - this.formatArrayInitializer(doc, insert1, extraEdits); - } - extraEdits.apply(doc, TextEdit.NONE); - } - - /** - * If the insert edit is inserting an annotation containing an array of annotations as - * its value then format them nicely. - */ - private void formatArrayInitializer(IDocument doc, InsertEdit insertEdit, MultiTextEdit extraEdits) throws BadLocationException { - String s = insertEdit.getText(); - if ( ! this.stringIsAnnotation(s)) { - return; - } - int len = s.length(); - int pos = 1; // skip '@' - while (pos < len) { - char c = s.charAt(pos); - pos++; // bump to just past first '(' - if (c == '(') { - break; - } - } - if (pos == len) { - return; // reached end of string - } - while (pos < len) { - char c = s.charAt(pos); - pos++; // bump to just past first '{' - if (c == '{') { - break; - } - if (c != ' ') { - return; - } - } - if (pos == len) { - return; // reached end of string - } - // now look for '@' not inside parentheses and put in - // line delimeter and indent string before each - int offset = insertEdit.getOffset(); - String indent = null; - int parenDepth = 0; - while (pos < len) { - switch (s.charAt(pos)) { - case '(' : - parenDepth++; - break; - case ')' : - parenDepth--; - break; - case '@' : - if (parenDepth == 0) { - if (indent == null) { - indent = this.buildCR(doc, offset, "\t"); // TODO use tab preference? //$NON-NLS-1$ - } - extraEdits.addChild(new InsertEdit(offset + pos, indent)); - } - break; - case '}' : - if (parenDepth == 0) { - extraEdits.addChild(new InsertEdit(offset + pos, this.buildCR(doc, offset))); - } - break; - } - pos++; - } - } - - /** - * Build a string containing a line delimeter and indenting characters - * matching the indent level of the line containing the character offset - * (i.e. the new line's indent matches the current line). - */ - private String buildCR(IDocument doc, int offset) throws BadLocationException { - return this.buildCR(doc, offset, ""); //$NON-NLS-1$ - } - - private String buildCR(IDocument doc, int offset, String suffix) throws BadLocationException { - int line = doc.getLineOfOffset(offset); - StringBuilder sb = new StringBuilder(); - sb.append(doc.getLineDelimiter(line)); // use same CR as current line - - int o = doc.getLineOffset(line); // match the whitespace of the current line - char c = doc.getChar(o++); - while ((c == ' ') || (c == '\t')) { - sb.append(c); - c = doc.getChar(o++); - } - sb.append(suffix); - return sb.toString(); - } - - /** - * Return whether the specified string is an annotation. - */ - private boolean stringIsAnnotation(String string) { - return (string.length() > 1) && string.charAt(0) == '@'; - } - - /** - * If the specified string is a single comma, possibly surrounded by - * spaces, return the length of the substring containing the - * initial spaces and the comma. - */ - private int commaLength(String string) { - boolean comma = false; - int len = string.length(); - int result = 0; - for (int i = 0; i < len; i++) { - switch (string.charAt(i)) { - case ' ' : - if ( ! comma) { - result++; // space preceding comma - } - break; - case ',' : - if (comma) { - return 0; // second comma! - } - comma = true; - result++; - break; - default: - return 0; // non-comma, non-space char - } - } - return result; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ElementAnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ElementAnnotationAdapter.java deleted file mode 100644 index 17f14a4b22..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ElementAnnotationAdapter.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; - -/** - * Adapt an annotated element and a declaration annotation adapter. - */ -public class ElementAnnotationAdapter extends AbstractAnnotationAdapter { - - - // ********** constructor ********** - - public ElementAnnotationAdapter(AnnotatedElement annotatedElement, DeclarationAnnotationAdapter daa) { - super(annotatedElement, daa); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ElementIndexedAnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ElementIndexedAnnotationAdapter.java deleted file mode 100644 index f3e3467b8b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ElementIndexedAnnotationAdapter.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * Adapt an annotated element and an indexed declaration annotation adapter. - */ -public class ElementIndexedAnnotationAdapter - extends AbstractAnnotationAdapter - implements IndexedAnnotationAdapter -{ - private final IndexedDeclarationAnnotationAdapter idaa; - - - // ********** constructor ********** - - public ElementIndexedAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) { - super(annotatedElement, idaa); - this.idaa = idaa; - } - - - // ********** IndexedAnnotationAdapter implementation ********** - - public int getIndex() { - return this.idaa.getIndex(); - } - - public void moveAnnotation(int newIndex) { - this.edit(this.buildMoveAnnotationEditor(newIndex)); - } - - - // ********** factory methods ********** - - protected AnnotatedElement.Editor buildMoveAnnotationEditor(int newIndex) { - return new MoveAnnotationEditor(this.idaa, newIndex); - } - - - // ********** member classes ********** - - protected static class MoveAnnotationEditor implements AnnotatedElement.Editor { - private final IndexedDeclarationAnnotationAdapter idaa; - private int index; - - MoveAnnotationEditor(IndexedDeclarationAnnotationAdapter idaa, int index) { - super(); - this.idaa = idaa; - this.index = index; - } - public void edit(ModifiedDeclaration declaration) { - this.idaa.moveAnnotation(this.index, declaration); - } - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/EnumArrayDeclarationAnnotationElementAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/EnumArrayDeclarationAnnotationElementAdapter.java deleted file mode 100644 index 3b3a74be0d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/EnumArrayDeclarationAnnotationElementAdapter.java +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.util.List; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.ArrayInitializer; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * Wrap a declaration annotation element adapter and simply - * add an import for the enums when necessary. - */ -public class EnumArrayDeclarationAnnotationElementAdapter - implements DeclarationAnnotationElementAdapter -{ - /** - * The wrapped adapter that returns and takes name strings (enums). - */ - private final ConversionDeclarationAnnotationElementAdapter adapter; - - - // ********** constructors ********** - - /** - * The default element name is value. - * The default behavior is to remove the array initializer if it is empty. - */ - public EnumArrayDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter) { - this(annotationAdapter, VALUE); - } - - /** - * The default behavior is to remove the array initializer if it is empty. - */ - public EnumArrayDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) { - this(annotationAdapter, elementName, true); - } - - public EnumArrayDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, boolean removeArrayInitializerWhenEmpty) { - this(new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, buildExpressionConverter(removeArrayInitializerWhenEmpty))); - } - - private static ExpressionConverter buildExpressionConverter(boolean removeArrayInitializerWhenEmpty) { - return new AnnotationStringArrayExpressionConverter(NameStringExpressionConverter.instance(), removeArrayInitializerWhenEmpty); - } - - protected EnumArrayDeclarationAnnotationElementAdapter(ConversionDeclarationAnnotationElementAdapter adapter) { - super(); - this.adapter = adapter; - } - - - // ********** DeclarationAnnotationElementAdapter implementation ********** - - public String[] getValue(ModifiedDeclaration declaration) { - // ignore the adapter's getValue() - we want the expression - return this.resolve(this.adapter.getExpression(declaration), declaration); - } - - public void setValue(String[] value, ModifiedDeclaration declaration) { - this.adapter.setValue(this.convertToSourceCodeNames(value, declaration), declaration); - } - - public Expression getExpression(ModifiedDeclaration declaration) { - return this.adapter.getExpression(declaration); - } - - public ASTNode getAstNode(ModifiedDeclaration declaration) { - return this.adapter.getAstNode(declaration); - } - - - // ********** internal methods ********** - - /** - * resolve the enums, which can be - * null - * or - * {FOO, BAR, BAZ} - * or - * FOO - */ - protected String[] resolve(Expression expression, ModifiedDeclaration declaration) { - if (expression == null) { - return StringTools.EMPTY_STRING_ARRAY; - } else if (expression.getNodeType() == ASTNode.ARRAY_INITIALIZER) { - return this.resolveArray((ArrayInitializer) expression, declaration); - } else { - return this.resolveSingleElement(expression, declaration); - } - } - - protected String[] resolveArray(ArrayInitializer ai, @SuppressWarnings("unused") ModifiedDeclaration declaration) { - List expressions = this.expressions(ai); - int len = expressions.size(); - String[] enums = new String[len]; - for (int i = len; i-- > 0; ) { - enums[i] = this.resolveEnum(expressions.get(i)); - } - return enums; - } - - protected String[] resolveSingleElement(Expression enumExpression, @SuppressWarnings("unused") ModifiedDeclaration declaration) { - return new String[] {this.resolveEnum(enumExpression)}; - } - - protected String resolveEnum(Expression expression) { - return ASTTools.resolveEnum(expression); - } - - // minimize scope of suppressd warnings - @SuppressWarnings("unchecked") - private List expressions(ArrayInitializer arrayInitializer) { - return arrayInitializer.expressions(); - } - - /** - * convert the fully-qualified enums to names that can be inserted in source code - * NB: imports may be added as a side-effect :-( - */ - protected String[] convertToSourceCodeNames(String[] enums, ModifiedDeclaration declaration) { - if (enums == null) { - return null; - } - int len = enums.length; - String[] sourceCodeNames = new String[len]; - for (int i = 0; i < len; i++) { - sourceCodeNames[i] = this.convertToSourceCodeName(enums[i], declaration); - } - return sourceCodeNames; - } - - protected String convertToSourceCodeName(String enum_, ModifiedDeclaration declaration) { - return EnumDeclarationAnnotationElementAdapter.convertToSourceCodeName(enum_, declaration); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/EnumDeclarationAnnotationElementAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/EnumDeclarationAnnotationElementAdapter.java deleted file mode 100644 index 21cbe29aaa..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/EnumDeclarationAnnotationElementAdapter.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; - -/** - * Wrap a declaration annotation element adapter and simply - * add an import for the enum when necessary. - */ -public class EnumDeclarationAnnotationElementAdapter - implements DeclarationAnnotationElementAdapter -{ - /** - * The wrapped adapter that returns and takes name strings (enums). - */ - private final ConversionDeclarationAnnotationElementAdapter adapter; - - - // ********** constructors ********** - - /** - * The default element name is value. - */ - public EnumDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter) { - this(annotationAdapter, VALUE); - } - - public EnumDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) { - this(new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, NameStringExpressionConverter.instance())); - } - - protected EnumDeclarationAnnotationElementAdapter(ConversionDeclarationAnnotationElementAdapter adapter) { - super(); - this.adapter = adapter; - } - - - // ********** DeclarationAnnotationElementAdapter implementation ********** - - public String getValue(ModifiedDeclaration declaration) { - return this.resolve(this.adapter.getExpression(declaration)); - } - - public void setValue(String value, ModifiedDeclaration declaration) { - this.adapter.setValue(convertToSourceCodeName(value, declaration), declaration); - } - - public Expression getExpression(ModifiedDeclaration declaration) { - return this.adapter.getExpression(declaration); - } - - public ASTNode getAstNode(ModifiedDeclaration declaration) { - return this.adapter.getAstNode(declaration); - } - - - // ********** internal methods ********** - - /** - * resolve the enum - */ - protected String resolve(Expression expression) { - return ASTTools.resolveEnum(expression); - } - - /** - * convert the fully-qualified enum constant to a static import and the constant's short name, e.g. - * static import javax.persistence.FetchType.EAGER; - * return "EAGER" - * if that doesn't work, convert to a normal import and the constant's partially-qualified name, e.g. - * import javax.persistence.FetchType; - * return "FetchType.EAGER" - * if that doesn't work, simply return the constant's fully-qualified name, e.g. - * return "javax.persistence.FetchType.EAGER" - * NB: an import may be added as a side-effect :-( - */ - protected static String convertToSourceCodeName(String enumConstantName, ModifiedDeclaration declaration) { - return (enumConstantName == null) ? null : convertToSourceCodeName_(enumConstantName, declaration); - } - - /** - * pre-condition: enum constant name is non-null; - * convert it to its short version if we can add a static import etc. - */ - protected static String convertToSourceCodeName_(String enumConstantName, ModifiedDeclaration declaration) { - if (declaration.addStaticImport(enumConstantName)) { - return convertToShortName(enumConstantName); - } - if (declaration.addImport(convertToTypeName(enumConstantName))) { - return convertToPartiallyQualifiedName(enumConstantName); - } - return enumConstantName; - } - - protected static String convertToShortName(String name) { - return name.substring(name.lastIndexOf('.') + 1); - } - - protected static String convertToTypeName(String name) { - return name.substring(0, name.lastIndexOf('.')); - } - - protected static String convertToPartiallyQualifiedName(String name) { - return name.substring(name.lastIndexOf('.', name.lastIndexOf('.') - 1) + 1); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ExpressionDeclarationAnnotationElementAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ExpressionDeclarationAnnotationElementAdapter.java deleted file mode 100644 index d3b0370942..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ExpressionDeclarationAnnotationElementAdapter.java +++ /dev/null @@ -1,327 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jdt.core.dom.MemberValuePair; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * Most obvious implementation of the interface. - * Assume the element's value is an Expression. - */ -public class ExpressionDeclarationAnnotationElementAdapter - implements DeclarationAnnotationElementAdapter -{ - /** - * Adapter used to manipulate the element's annotation. - */ - private final DeclarationAnnotationAdapter annotationAdapter; - - /** - * The name of the relevant annotation element. - */ - private final String elementName; - - - // ********** constructors ********** - - /** - * The default element name is value. - */ - public ExpressionDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter) { - this(annotationAdapter, VALUE); - } - - public ExpressionDeclarationAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) { - this.annotationAdapter = annotationAdapter; - this.elementName = elementName; - } - - - // ********** DeclarationAnnotationElementAdapter implementation ********** - - public E getValue(ModifiedDeclaration declaration) { - // return the expression unmodified - return this.getExpression(declaration); - } - - public void setValue(E value, ModifiedDeclaration declaration) { - this.setValue(value, this.annotationAdapter.getAnnotation(declaration), declaration); - } - - public E getExpression(ModifiedDeclaration declaration) { - return this.expression(this.annotationAdapter.getAnnotation(declaration)); - } - - public ASTNode getAstNode(ModifiedDeclaration declaration) { - Expression exp = this.getExpression(declaration); - return (exp != null) ? exp : this.annotationAdapter.getAstNode(declaration); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.elementName); - } - - - // ********** expression ********** - - /** - * Return the expression value of the *first* annotation element - * with the adapter's element name. - * Return null if the annotation has no such element. - * (An element name of "value" will return the value of a single - * member annotation.) - */ - protected E expression(Annotation annotation) { - if (annotation == null) { - return this.expressionNoAnnotation(); - } - if (annotation.isMarkerAnnotation()) { - return this.expressionMarkerAnnotation((MarkerAnnotation) annotation); - } - if (annotation.isSingleMemberAnnotation()) { - return this.expressionSingleMemberAnnotation((SingleMemberAnnotation) annotation); - } - if (annotation.isNormalAnnotation()) { - return this.expressionNormalAnnotation((NormalAnnotation) annotation); - } - throw new IllegalArgumentException("unknown annotation type: " + annotation); //$NON-NLS-1$ - } - - protected E expressionNoAnnotation() { - return null; - } - - /** - * Return the expression value of the *first* annotation element - * with the adapter's element name. - * Return null if the annotation has no such element. - */ - protected E expressionMarkerAnnotation(@SuppressWarnings("unused") MarkerAnnotation annotation) { - return null; - } - - /** - * Return the expression value of the *first* annotation element - * with the adapter's element name. - * Return null if the annotation has no such element. - */ - protected E expressionSingleMemberAnnotation(SingleMemberAnnotation annotation) { - return this.downcast(this.elementName.equals(VALUE) ? annotation.getValue() : null); - } - - @SuppressWarnings("unchecked") - private E downcast(Expression e) { - return (E) e; - } - - /** - * Return the expression value of the *first* annotation element - * with the adapter's element name. - * Return null if the annotation has no such element. - */ - protected E expressionNormalAnnotation(NormalAnnotation annotation) { - MemberValuePair pair = this.memberValuePair(annotation); - return this.downcast((pair == null) ? null : pair.getValue()); - } - - - // ********** set value ********** - - /** - * set non-null, non-empty value - */ - protected void setValue(Expression value, Annotation annotation, ModifiedDeclaration declaration) { - if (value == null) { - this.removeElement(annotation, declaration); - } - else if (annotation == null) { - this.setValueNoAnnotation(value, declaration); - } - else if (annotation.isMarkerAnnotation()) { - this.setValueMarkerAnnotation(value, (MarkerAnnotation) annotation, declaration); - } - else if (annotation.isSingleMemberAnnotation()) { - this.setValueSingleMemberAnnotation(value, (SingleMemberAnnotation) annotation, declaration); - } - else if (annotation.isNormalAnnotation()) { - this.setValueNormalAnnotation(value, (NormalAnnotation) annotation, declaration); - } - else { - throw new IllegalArgumentException("unknown annotation type: " + annotation); //$NON-NLS-1$ - } - } - - /** - * add non-null, non-empty value - */ - protected void setValueNoAnnotation(Expression value, ModifiedDeclaration declaration) { - if (this.elementName.equals(VALUE)) { - // @Foo("xxx") - this.annotationAdapter.newSingleMemberAnnotation(declaration).setValue(value); - } else { - // @Foo(bar="xxx") - this.addValue(value, this.annotationAdapter.newNormalAnnotation(declaration)); - } - } - - protected void addValue(Expression value, NormalAnnotation annotation) { - this.addValue(value, annotation, this.elementName); - } - - protected void addValue(Expression value, NormalAnnotation annotation, String annotationElementName) { - AST ast = annotation.getAST(); - MemberValuePair pair = ast.newMemberValuePair(); - pair.setName(ast.newSimpleName(annotationElementName)); - pair.setValue(value); - List values = this.values(annotation); - values.add(pair); - } - - protected void setValueMarkerAnnotation(Expression value, @SuppressWarnings("unused") MarkerAnnotation annotation, ModifiedDeclaration declaration) { - // @Foo => @Foo("xxx") - // or - // @Foo => @Foo(bar="xxx") - this.setValueNoAnnotation(value, declaration); - } - - protected void setValueSingleMemberAnnotation(Expression value, SingleMemberAnnotation annotation, ModifiedDeclaration declaration) { - if (this.elementName.equals(VALUE)) { - // @Foo("yyy") => @Foo("xxx") - annotation.setValue(value); - } else { - // @Foo("yyy") => @Foo(value="yyy", bar="xxx") - Expression vv = annotation.getValue(); - vv = (Expression) ASTNode.copySubtree(vv.getAST(), vv); - NormalAnnotation normalAnnotation = this.annotationAdapter.newNormalAnnotation(declaration); - this.addValue(vv, normalAnnotation, VALUE); - this.addValue(value, normalAnnotation); - } - } - - protected void setValueNormalAnnotation(Expression value, NormalAnnotation annotation, @SuppressWarnings("unused") ModifiedDeclaration declaration) { - MemberValuePair pair = this.memberValuePair(annotation); - if (pair == null) { - this.addValue(value, annotation); - } else { - pair.setValue(value); - } - } - - - // ********** remove element ********** - - protected void removeElement(Annotation annotation, ModifiedDeclaration declaration) { - if (annotation == null) { - this.removeElementNoAnnotation(declaration); - } - else if (annotation.isMarkerAnnotation()) { - this.removeElementMarkerAnnotation((MarkerAnnotation) annotation, declaration); - } - else if (annotation.isSingleMemberAnnotation()) { - this.removeElementSingleMemberAnnotation((SingleMemberAnnotation) annotation, declaration); - } - else if (annotation.isNormalAnnotation()) { - this.removeElementNormalAnnotation((NormalAnnotation) annotation, declaration); - } - else { - throw new IllegalArgumentException("unknown annotation type: " + annotation); //$NON-NLS-1$ - } - } - - protected void removeElementNoAnnotation(@SuppressWarnings("unused") ModifiedDeclaration declaration) { - // the element is already gone (?) - } - - protected void removeElementMarkerAnnotation(@SuppressWarnings("unused") MarkerAnnotation annotation, @SuppressWarnings("unused") ModifiedDeclaration declaration) { - // the element is already gone (?) - } - - protected void removeElementSingleMemberAnnotation(@SuppressWarnings("unused") SingleMemberAnnotation annotation, ModifiedDeclaration declaration) { - if (this.elementName.equals(VALUE)) { - // @Foo("xxx") => @Foo - this.annotationAdapter.newMarkerAnnotation(declaration); - } else { - // the [non-'value'] element is already gone (?) - } - } - - protected void removeElementNormalAnnotation(NormalAnnotation annotation, ModifiedDeclaration declaration) { - List values = this.values(annotation); - if ((values.size() == 1) && values.get(0).getName().getFullyQualifiedName().equals(this.elementName)) { - // @Foo(bar="xxx") => @Foo - this.annotationAdapter.newMarkerAnnotation(declaration); - } else { - this.removeElement(annotation); - if (values.size() == 1) { - MemberValuePair pair = values.get(0); - if (pair.getName().getFullyQualifiedName().equals(VALUE)) { - // @Foo(bar="xxx", value="yyy") => @Foo("yyy") - Expression vv = pair.getValue(); - vv = (Expression) ASTNode.copySubtree(vv.getAST(), vv); - this.annotationAdapter.newSingleMemberAnnotation(declaration).setValue(vv); - } else { - // @Foo(bar="xxx", baz="yyy") => @Foo(baz="yyy") - } - } else { - // @Foo(bar="xxx", baz="yyy", joo="xxx") => @Foo(baz="yyy", joo="xxx") - } - } - } - - /** - * Remove the *first* member value pair from the specified annotation element - * with the adapter's element name. - */ - protected void removeElement(NormalAnnotation annotation) { - for (Iterator stream = this.values(annotation).iterator(); stream.hasNext(); ) { - MemberValuePair pair = stream.next(); - if (pair.getName().getFullyQualifiedName().equals(this.elementName)) { - stream.remove(); - } - } - } - - - // ********** convenience methods ********** - - /** - * Return the *first* member value pair for the specified annotation element - * with the adapter's element name. - * Return null if the annotation has no such element. - */ - protected MemberValuePair memberValuePair(NormalAnnotation annotation) { - for (MemberValuePair pair : this.values(annotation)) { - if (pair.getName().getFullyQualifiedName().equals(this.elementName)) { - return pair; - } - } - return null; - } - - @SuppressWarnings("unchecked") - protected List values(NormalAnnotation na) { - return na.values(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/GenericVisitor.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/GenericVisitor.java deleted file mode 100644 index 92160afdf5..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/GenericVisitor.java +++ /dev/null @@ -1,791 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 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.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.ASTVisitor; -import org.eclipse.jdt.core.dom.AnnotationTypeDeclaration; -import org.eclipse.jdt.core.dom.AnnotationTypeMemberDeclaration; -import org.eclipse.jdt.core.dom.AnonymousClassDeclaration; -import org.eclipse.jdt.core.dom.ArrayAccess; -import org.eclipse.jdt.core.dom.ArrayCreation; -import org.eclipse.jdt.core.dom.ArrayInitializer; -import org.eclipse.jdt.core.dom.ArrayType; -import org.eclipse.jdt.core.dom.AssertStatement; -import org.eclipse.jdt.core.dom.Assignment; -import org.eclipse.jdt.core.dom.Block; -import org.eclipse.jdt.core.dom.BlockComment; -import org.eclipse.jdt.core.dom.BooleanLiteral; -import org.eclipse.jdt.core.dom.BreakStatement; -import org.eclipse.jdt.core.dom.CastExpression; -import org.eclipse.jdt.core.dom.CatchClause; -import org.eclipse.jdt.core.dom.CharacterLiteral; -import org.eclipse.jdt.core.dom.ClassInstanceCreation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.ConditionalExpression; -import org.eclipse.jdt.core.dom.ConstructorInvocation; -import org.eclipse.jdt.core.dom.ContinueStatement; -import org.eclipse.jdt.core.dom.DoStatement; -import org.eclipse.jdt.core.dom.EmptyStatement; -import org.eclipse.jdt.core.dom.EnhancedForStatement; -import org.eclipse.jdt.core.dom.EnumConstantDeclaration; -import org.eclipse.jdt.core.dom.EnumDeclaration; -import org.eclipse.jdt.core.dom.ExpressionStatement; -import org.eclipse.jdt.core.dom.FieldAccess; -import org.eclipse.jdt.core.dom.FieldDeclaration; -import org.eclipse.jdt.core.dom.ForStatement; -import org.eclipse.jdt.core.dom.IfStatement; -import org.eclipse.jdt.core.dom.ImportDeclaration; -import org.eclipse.jdt.core.dom.InfixExpression; -import org.eclipse.jdt.core.dom.Initializer; -import org.eclipse.jdt.core.dom.InstanceofExpression; -import org.eclipse.jdt.core.dom.Javadoc; -import org.eclipse.jdt.core.dom.LabeledStatement; -import org.eclipse.jdt.core.dom.LineComment; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jdt.core.dom.MemberRef; -import org.eclipse.jdt.core.dom.MemberValuePair; -import org.eclipse.jdt.core.dom.MethodDeclaration; -import org.eclipse.jdt.core.dom.MethodInvocation; -import org.eclipse.jdt.core.dom.MethodRef; -import org.eclipse.jdt.core.dom.MethodRefParameter; -import org.eclipse.jdt.core.dom.Modifier; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.NullLiteral; -import org.eclipse.jdt.core.dom.NumberLiteral; -import org.eclipse.jdt.core.dom.PackageDeclaration; -import org.eclipse.jdt.core.dom.ParameterizedType; -import org.eclipse.jdt.core.dom.ParenthesizedExpression; -import org.eclipse.jdt.core.dom.PostfixExpression; -import org.eclipse.jdt.core.dom.PrefixExpression; -import org.eclipse.jdt.core.dom.PrimitiveType; -import org.eclipse.jdt.core.dom.QualifiedName; -import org.eclipse.jdt.core.dom.QualifiedType; -import org.eclipse.jdt.core.dom.ReturnStatement; -import org.eclipse.jdt.core.dom.SimpleName; -import org.eclipse.jdt.core.dom.SimpleType; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jdt.core.dom.SingleVariableDeclaration; -import org.eclipse.jdt.core.dom.StringLiteral; -import org.eclipse.jdt.core.dom.SuperConstructorInvocation; -import org.eclipse.jdt.core.dom.SuperFieldAccess; -import org.eclipse.jdt.core.dom.SuperMethodInvocation; -import org.eclipse.jdt.core.dom.SwitchCase; -import org.eclipse.jdt.core.dom.SwitchStatement; -import org.eclipse.jdt.core.dom.SynchronizedStatement; -import org.eclipse.jdt.core.dom.TagElement; -import org.eclipse.jdt.core.dom.TextElement; -import org.eclipse.jdt.core.dom.ThisExpression; -import org.eclipse.jdt.core.dom.ThrowStatement; -import org.eclipse.jdt.core.dom.TryStatement; -import org.eclipse.jdt.core.dom.TypeDeclaration; -import org.eclipse.jdt.core.dom.TypeDeclarationStatement; -import org.eclipse.jdt.core.dom.TypeLiteral; -import org.eclipse.jdt.core.dom.TypeParameter; -import org.eclipse.jdt.core.dom.VariableDeclarationExpression; -import org.eclipse.jdt.core.dom.VariableDeclarationFragment; -import org.eclipse.jdt.core.dom.VariableDeclarationStatement; -import org.eclipse.jdt.core.dom.WhileStatement; -import org.eclipse.jdt.core.dom.WildcardType; - -/** - * copied from org.eclipse.jdt.internal.corext.dom.GenericVisitor - */ -public class GenericVisitor extends ASTVisitor { - - public GenericVisitor() { - super(); - } - - public GenericVisitor(boolean visitJavadocTags) { - super(visitJavadocTags); - } - - // ********** hooks for subclasses ********** - - protected boolean visit_(@SuppressWarnings("unused") ASTNode node) { - return true; - } - - protected void endVisit_(@SuppressWarnings("unused") ASTNode node) { - // do nothing - } - - // ********** overrides ********** - - @Override - public boolean visit(AnonymousClassDeclaration node) { - return visit_(node); - } - @Override - public boolean visit(ArrayAccess node) { - return visit_(node); - } - @Override - public boolean visit(ArrayCreation node) { - return visit_(node); - } - @Override - public boolean visit(ArrayInitializer node) { - return visit_(node); - } - @Override - public boolean visit(ArrayType node) { - return visit_(node); - } - @Override - public boolean visit(AssertStatement node) { - return visit_(node); - } - @Override - public boolean visit(Assignment node) { - return visit_(node); - } - @Override - public boolean visit(Block node) { - return visit_(node); - } - @Override - public boolean visit(BooleanLiteral node) { - return visit_(node); - } - @Override - public boolean visit(BreakStatement node) { - return visit_(node); - } - @Override - public boolean visit(CastExpression node) { - return visit_(node); - } - @Override - public boolean visit(CatchClause node) { - return visit_(node); - } - @Override - public boolean visit(CharacterLiteral node) { - return visit_(node); - } - @Override - public boolean visit(ClassInstanceCreation node) { - return visit_(node); - } - @Override - public boolean visit(CompilationUnit node) { - return visit_(node); - } - @Override - public boolean visit(ConditionalExpression node) { - return visit_(node); - } - @Override - public boolean visit(ConstructorInvocation node) { - return visit_(node); - } - @Override - public boolean visit(ContinueStatement node) { - return visit_(node); - } - @Override - public boolean visit(DoStatement node) { - return visit_(node); - } - @Override - public boolean visit(EmptyStatement node) { - return visit_(node); - } - @Override - public boolean visit(ExpressionStatement node) { - return visit_(node); - } - @Override - public boolean visit(FieldAccess node) { - return visit_(node); - } - @Override - public boolean visit(FieldDeclaration node) { - return visit_(node); - } - @Override - public boolean visit(ForStatement node) { - return visit_(node); - } - @Override - public boolean visit(IfStatement node) { - return visit_(node); - } - @Override - public boolean visit(ImportDeclaration node) { - return visit_(node); - } - @Override - public boolean visit(InfixExpression node) { - return visit_(node); - } - @Override - public boolean visit(InstanceofExpression node) { - return visit_(node); - } - @Override - public boolean visit(Initializer node) { - return visit_(node); - } - @Override - public boolean visit(Javadoc node) { - return (super.visit(node)) ? visit_(node) : false; - } - @Override - public boolean visit(LabeledStatement node) { - return visit_(node); - } - @Override - public boolean visit(MethodDeclaration node) { - return visit_(node); - } - @Override - public boolean visit(MethodInvocation node) { - return visit_(node); - } - @Override - public boolean visit(NullLiteral node) { - return visit_(node); - } - @Override - public boolean visit(NumberLiteral node) { - return visit_(node); - } - @Override - public boolean visit(PackageDeclaration node) { - return visit_(node); - } - @Override - public boolean visit(ParenthesizedExpression node) { - return visit_(node); - } - @Override - public boolean visit(PostfixExpression node) { - return visit_(node); - } - @Override - public boolean visit(PrefixExpression node) { - return visit_(node); - } - @Override - public boolean visit(PrimitiveType node) { - return visit_(node); - } - @Override - public boolean visit(QualifiedName node) { - return visit_(node); - } - @Override - public boolean visit(ReturnStatement node) { - return visit_(node); - } - @Override - public boolean visit(SimpleName node) { - return visit_(node); - } - @Override - public boolean visit(SimpleType node) { - return visit_(node); - } - @Override - public boolean visit(StringLiteral node) { - return visit_(node); - } - @Override - public boolean visit(SuperConstructorInvocation node) { - return visit_(node); - } - @Override - public boolean visit(SuperFieldAccess node) { - return visit_(node); - } - @Override - public boolean visit(SuperMethodInvocation node) { - return visit_(node); - } - @Override - public boolean visit(SwitchCase node) { - return visit_(node); - } - @Override - public boolean visit(SwitchStatement node) { - return visit_(node); - } - @Override - public boolean visit(SynchronizedStatement node) { - return visit_(node); - } - @Override - public boolean visit(ThisExpression node) { - return visit_(node); - } - @Override - public boolean visit(ThrowStatement node) { - return visit_(node); - } - @Override - public boolean visit(TryStatement node) { - return visit_(node); - } - @Override - public boolean visit(TypeDeclaration node) { - return visit_(node); - } - @Override - public boolean visit(TypeDeclarationStatement node) { - return visit_(node); - } - @Override - public boolean visit(TypeLiteral node) { - return visit_(node); - } - @Override - public boolean visit(SingleVariableDeclaration node) { - return visit_(node); - } - @Override - public boolean visit(VariableDeclarationExpression node) { - return visit_(node); - } - @Override - public boolean visit(VariableDeclarationStatement node) { - return visit_(node); - } - @Override - public boolean visit(VariableDeclarationFragment node) { - return visit_(node); - } - @Override - public boolean visit(WhileStatement node) { - return visit_(node); - } - @Override - public boolean visit(AnnotationTypeDeclaration node) { - return visit_(node); - } - @Override - public boolean visit(AnnotationTypeMemberDeclaration node) { - return visit_(node); - } - @Override - public boolean visit(BlockComment node) { - return visit_(node); - } - @Override - public boolean visit(EnhancedForStatement node) { - return visit_(node); - } - @Override - public boolean visit(EnumConstantDeclaration node) { - return visit_(node); - } - @Override - public boolean visit(EnumDeclaration node) { - return visit_(node); - } - @Override - public boolean visit(LineComment node) { - return visit_(node); - } - @Override - public boolean visit(MarkerAnnotation node) { - return visit_(node); - } - @Override - public boolean visit(MemberRef node) { - return visit_(node); - } - @Override - public boolean visit(MemberValuePair node) { - return visit_(node); - } - @Override - public boolean visit(MethodRef node) { - return visit_(node); - } - @Override - public boolean visit(MethodRefParameter node) { - return visit_(node); - } - @Override - public boolean visit(Modifier node) { - return visit_(node); - } - @Override - public boolean visit(NormalAnnotation node) { - return visit_(node); - } - @Override - public boolean visit(ParameterizedType node) { - return visit_(node); - } - @Override - public boolean visit(QualifiedType node) { - return visit_(node); - } - @Override - public boolean visit(SingleMemberAnnotation node) { - return visit_(node); - } - @Override - public boolean visit(TagElement node) { - return visit_(node); - } - @Override - public boolean visit(TextElement node) { - return visit_(node); - } - @Override - public boolean visit(TypeParameter node) { - return visit_(node); - } - @Override - public boolean visit(WildcardType node) { - return visit_(node); - } - - @Override - public void endVisit(AnonymousClassDeclaration node) { - endVisit_(node); - } - @Override - public void endVisit(ArrayAccess node) { - endVisit_(node); - } - @Override - public void endVisit(ArrayCreation node) { - endVisit_(node); - } - @Override - public void endVisit(ArrayInitializer node) { - endVisit_(node); - } - @Override - public void endVisit(ArrayType node) { - endVisit_(node); - } - @Override - public void endVisit(AssertStatement node) { - endVisit_(node); - } - @Override - public void endVisit(Assignment node) { - endVisit_(node); - } - @Override - public void endVisit(Block node) { - endVisit_(node); - } - @Override - public void endVisit(BooleanLiteral node) { - endVisit_(node); - } - @Override - public void endVisit(BreakStatement node) { - endVisit_(node); - } - @Override - public void endVisit(CastExpression node) { - endVisit_(node); - } - @Override - public void endVisit(CatchClause node) { - endVisit_(node); - } - @Override - public void endVisit(CharacterLiteral node) { - endVisit_(node); - } - @Override - public void endVisit(ClassInstanceCreation node) { - endVisit_(node); - } - @Override - public void endVisit(CompilationUnit node) { - endVisit_(node); - } - @Override - public void endVisit(ConditionalExpression node) { - endVisit_(node); - } - @Override - public void endVisit(ConstructorInvocation node) { - endVisit_(node); - } - @Override - public void endVisit(ContinueStatement node) { - endVisit_(node); - } - @Override - public void endVisit(DoStatement node) { - endVisit_(node); - } - @Override - public void endVisit(EmptyStatement node) { - endVisit_(node); - } - @Override - public void endVisit(ExpressionStatement node) { - endVisit_(node); - } - @Override - public void endVisit(FieldAccess node) { - endVisit_(node); - } - @Override - public void endVisit(FieldDeclaration node) { - endVisit_(node); - } - @Override - public void endVisit(ForStatement node) { - endVisit_(node); - } - @Override - public void endVisit(IfStatement node) { - endVisit_(node); - } - @Override - public void endVisit(ImportDeclaration node) { - endVisit_(node); - } - @Override - public void endVisit(InfixExpression node) { - endVisit_(node); - } - @Override - public void endVisit(InstanceofExpression node) { - endVisit_(node); - } - @Override - public void endVisit(Initializer node) { - endVisit_(node); - } - @Override - public void endVisit(Javadoc node) { - endVisit_(node); - } - @Override - public void endVisit(LabeledStatement node) { - endVisit_(node); - } - @Override - public void endVisit(MethodDeclaration node) { - endVisit_(node); - } - @Override - public void endVisit(MethodInvocation node) { - endVisit_(node); - } - @Override - public void endVisit(NullLiteral node) { - endVisit_(node); - } - @Override - public void endVisit(NumberLiteral node) { - endVisit_(node); - } - @Override - public void endVisit(PackageDeclaration node) { - endVisit_(node); - } - @Override - public void endVisit(ParenthesizedExpression node) { - endVisit_(node); - } - @Override - public void endVisit(PostfixExpression node) { - endVisit_(node); - } - @Override - public void endVisit(PrefixExpression node) { - endVisit_(node); - } - @Override - public void endVisit(PrimitiveType node) { - endVisit_(node); - } - @Override - public void endVisit(QualifiedName node) { - endVisit_(node); - } - @Override - public void endVisit(ReturnStatement node) { - endVisit_(node); - } - @Override - public void endVisit(SimpleName node) { - endVisit_(node); - } - @Override - public void endVisit(SimpleType node) { - endVisit_(node); - } - @Override - public void endVisit(StringLiteral node) { - endVisit_(node); - } - @Override - public void endVisit(SuperConstructorInvocation node) { - endVisit_(node); - } - @Override - public void endVisit(SuperFieldAccess node) { - endVisit_(node); - } - @Override - public void endVisit(SuperMethodInvocation node) { - endVisit_(node); - } - @Override - public void endVisit(SwitchCase node) { - endVisit_(node); - } - @Override - public void endVisit(SwitchStatement node) { - endVisit_(node); - } - @Override - public void endVisit(SynchronizedStatement node) { - endVisit_(node); - } - @Override - public void endVisit(ThisExpression node) { - endVisit_(node); - } - @Override - public void endVisit(ThrowStatement node) { - endVisit_(node); - } - @Override - public void endVisit(TryStatement node) { - endVisit_(node); - } - @Override - public void endVisit(TypeDeclaration node) { - endVisit_(node); - } - @Override - public void endVisit(TypeDeclarationStatement node) { - endVisit_(node); - } - @Override - public void endVisit(TypeLiteral node) { - endVisit_(node); - } - @Override - public void endVisit(SingleVariableDeclaration node) { - endVisit_(node); - } - @Override - public void endVisit(VariableDeclarationExpression node) { - endVisit_(node); - } - @Override - public void endVisit(VariableDeclarationStatement node) { - endVisit_(node); - } - @Override - public void endVisit(VariableDeclarationFragment node) { - endVisit_(node); - } - @Override - public void endVisit(WhileStatement node) { - endVisit_(node); - } - @Override - public void endVisit(AnnotationTypeDeclaration node) { - endVisit_(node); - } - @Override - public void endVisit(AnnotationTypeMemberDeclaration node) { - endVisit_(node); - } - @Override - public void endVisit(BlockComment node) { - endVisit_(node); - } - @Override - public void endVisit(EnhancedForStatement node) { - endVisit_(node); - } - @Override - public void endVisit(EnumConstantDeclaration node) { - endVisit_(node); - } - @Override - public void endVisit(EnumDeclaration node) { - endVisit_(node); - } - @Override - public void endVisit(LineComment node) { - endVisit_(node); - } - @Override - public void endVisit(MarkerAnnotation node) { - endVisit_(node); - } - @Override - public void endVisit(MemberRef node) { - endVisit_(node); - } - @Override - public void endVisit(MemberValuePair node) { - endVisit_(node); - } - @Override - public void endVisit(MethodRef node) { - endVisit_(node); - } - @Override - public void endVisit(MethodRefParameter node) { - endVisit_(node); - } - @Override - public void endVisit(Modifier node) { - endVisit_(node); - } - @Override - public void endVisit(NormalAnnotation node) { - endVisit_(node); - } - @Override - public void endVisit(ParameterizedType node) { - endVisit_(node); - } - @Override - public void endVisit(QualifiedType node) { - endVisit_(node); - } - @Override - public void endVisit(SingleMemberAnnotation node) { - endVisit_(node); - } - @Override - public void endVisit(TagElement node) { - endVisit_(node); - } - @Override - public void endVisit(TextElement node) { - endVisit_(node); - } - @Override - public void endVisit(TypeParameter node) { - endVisit_(node); - } - @Override - public void endVisit(WildcardType node) { - endVisit_(node); - } - -} - diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTAnnotatedElement.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTAnnotatedElement.java deleted file mode 100644 index c771c77ce5..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTAnnotatedElement.java +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.core.filebuffers.FileBuffers; -import org.eclipse.core.filebuffers.ITextFileBuffer; -import org.eclipse.core.filebuffers.LocationKind; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.Document; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.TextEdit; - -/** - * Adapt and extend a JDT member with simplified annotation handling. - */ -public abstract class JDTAnnotatedElement - implements AnnotatedElement -{ - - /** the annotated element's name (duh) */ - private final String name; - - /** - * the compilation unit (file) containing the annotated element; - * used for building an AST when we modify the annotated element - */ - private final ICompilationUnit compilationUnit; - - /** - * this allows clients to provide a way to modify the compilation unit - * (file) when it is open in an editor and should be modified on the UI - * thread - */ - private final CommandExecutor modifySharedDocumentCommandExecutor; - - /** this will format the annotated element's annotations a bit */ - private final AnnotationEditFormatter annotationEditFormatter; - - - // ********** constructors ********** - - protected JDTAnnotatedElement( - String name, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor) { - this(name, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance()); - } - - protected JDTAnnotatedElement( - String name, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor, - AnnotationEditFormatter annotationEditFormatter) { - super(); - this.name = name; - this.compilationUnit = compilationUnit; - this.modifySharedDocumentCommandExecutor = modifySharedDocumentCommandExecutor; - this.annotationEditFormatter = annotationEditFormatter; - } - - - // ********** AnnotatedElement implementation ********** - - public String getName() { - return this.name; - } - - public abstract ModifiedDeclaration getModifiedDeclaration(CompilationUnit astRoot); - - public ModifiedDeclaration getModifiedDeclaration() { - return this.getModifiedDeclaration(this.buildASTRoot()); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.name); - } - - - // ********** editing ********** - - /** - * Edit the member with the specified editor. - * The editor will be invoked once the member's compilation unit - * is in an editable state. - */ - public void edit(Editor editor) { - try { - this.edit_(editor); - } catch (JavaModelException ex) { - throw new RuntimeException(ex); - } catch (BadLocationException ex) { - throw new RuntimeException(ex); - } - } - - /** - * NB: Be careful changing this method. - * Things to look out for: - * - when editing via the JavaEditor there is no need to create a working copy - * - when editing without an editor or via a simple text editor, a "working copy" must be created. - * (at least as far as I can tell ~kfm) - * - sharedDocument is only ever false in tests (headless mode). In the UI, even if the file - * is not open in an editor, sharedDocument is still true (buffer is not null) - * - if a working copy is created, then we must discard it - */ - protected void edit_(Editor editor) throws JavaModelException, BadLocationException { - boolean createWorkingCopy = ! this.compilationUnit.isWorkingCopy(); - if (createWorkingCopy) { - this.compilationUnit.becomeWorkingCopy(null); - } - - ITextFileBuffer buffer = FileBuffers.getTextFileBufferManager().getTextFileBuffer(this.compilationUnit.getResource().getFullPath(), LocationKind.NORMALIZE); - boolean sharedDocument = (buffer != null); // documents are typically shared when they are already open in an editor - IDocument doc = sharedDocument ? - buffer.getDocument() : - new Document(this.compilationUnit.getBuffer().getContents()); - - try { - CompilationUnit astRoot = this.buildASTRoot(); - astRoot.recordModifications(); - - editor.edit(this.getModifiedDeclaration(astRoot)); - - TextEdit edits = astRoot.rewrite(doc, this.compilationUnit.getJavaProject().getOptions(true)); - if (sharedDocument) { - this.modifySharedDocumentCommandExecutor.execute(new ModifySharedDocumentCommand(edits, doc)); - } else { - this.applyEdits(edits, doc); - } - } - finally { - if (createWorkingCopy) { - //discardWorkingCopy must be called every time becomeWorkingCopy is called. - this.compilationUnit.getBuffer().setContents(doc.get()); - this.compilationUnit.commitWorkingCopy(true, null); // true="force" - this.compilationUnit.discardWorkingCopy(); - } - } - } - - /** - * apply the specified edits to the specified document, - * reformatting the document if necessary - */ - protected void applyEdits(TextEdit edits, IDocument doc) throws MalformedTreeException, BadLocationException { - edits.apply(doc, TextEdit.UPDATE_REGIONS); - this.annotationEditFormatter.format(doc, edits); - } - - protected CompilationUnit buildASTRoot() { - return ASTTools.buildASTRoot(this.compilationUnit); - } - - - // ********** modify shared document command class ********** - - /** - * simple command that calls back to the member to apply the edits - * in the same way as if the document were not shared - */ - protected class ModifySharedDocumentCommand implements Command { - private final TextEdit edits; - private final IDocument doc; - - protected ModifySharedDocumentCommand(TextEdit edits, IDocument doc) { - super(); - this.edits = edits; - this.doc = doc; - } - - public void execute() { - try { - JDTAnnotatedElement.this.applyEdits(this.edits, this.doc); - } catch (MalformedTreeException ex) { - throw new RuntimeException(ex); - } catch (BadLocationException ex) { - throw new RuntimeException(ex); - } - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTEnum.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTEnum.java deleted file mode 100644 index 53d9bc2c1c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTEnum.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.util.List; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.AbstractTypeDeclaration; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumConstantDeclaration; -import org.eclipse.jdt.core.dom.EnumDeclaration; -import org.eclipse.jdt.core.dom.TypeDeclaration; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.core.utility.jdt.Enum; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.common.utility.CommandExecutor; - -/** - * Adapt and extend a JDT enum. - */ -public class JDTEnum - extends AbstractJDTType - implements Enum -{ - - /** - * constructor for the compilation unit's primary type, an enum - */ - public JDTEnum( - EnumDeclaration enumDeclaration, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor) { - this(enumDeclaration, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance()); - } - - /** - * constructor for the compilation unit's primary type, an enum - */ - public JDTEnum( - EnumDeclaration enumDeclaration, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor, - AnnotationEditFormatter annotationEditFormatter) { - super(null, enumDeclaration, 1, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter); - } - - /** - * constructor for nested enums - */ - public JDTEnum( - Type declaringType, - EnumDeclaration enumDeclaration, - int occurrence, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor) { - this(declaringType, enumDeclaration, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance()); - } - - /** - * constructor for nested enums - */ - public JDTEnum( - Type declaringType, - EnumDeclaration enumDeclaration, - int occurrence, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor, - AnnotationEditFormatter annotationEditFormatter) { - super(declaringType, enumDeclaration, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter); - } - - /** - * constructor for testing - */ - public JDTEnum(Type declaringType, String name, int occurrence, ICompilationUnit compilationUnit) { - super(declaringType, name, occurrence, compilationUnit); - } - - @Override - public EnumDeclaration getBodyDeclaration(CompilationUnit astRoot) { - return (EnumDeclaration) super.getBodyDeclaration(astRoot); - } - - public boolean isPersistable(CompilationUnit astRoot) { - return true; - } - - public EnumConstantDeclaration[] getEnumConstants(CompilationUnit astRoot) { - List enumConstants = enumConstants(getBodyDeclaration(astRoot)); - return enumConstants.toArray(new EnumConstantDeclaration[enumConstants.size()]); - } - - @SuppressWarnings("unchecked") - private static List enumConstants(EnumDeclaration ed) { - return ed.enumConstants(); - } - - - // ********** internal ********** - - @Override - protected EnumDeclaration getTopLevelTypeDeclaration(CompilationUnit astRoot) { - return (EnumDeclaration) super.getTopLevelTypeDeclaration(astRoot); - } - - @Override - protected EnumDeclaration getTypeDeclaration(List typeDeclarations) { - return (EnumDeclaration) super.getTypeDeclaration(typeDeclarations); - } - - @Override - protected EnumDeclaration getNestedTypeDeclaration(TypeDeclaration declaringTypeDeclaration) { - return this.getTypeDeclaration(getEnums(declaringTypeDeclaration)); - } - - @Override - protected EnumDeclaration getTypeDeclaration(AbstractTypeDeclaration[] typeDeclarations) { - return (EnumDeclaration) super.getTypeDeclaration(typeDeclarations); - } - - @Override - protected int getASTNodeType() { - return ASTNode.ENUM_DECLARATION; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTEnumConstant.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTEnumConstant.java deleted file mode 100644 index 3bedd952bf..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTEnumConstant.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.util.List; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumConstantDeclaration; -import org.eclipse.jdt.core.dom.EnumDeclaration; -import org.eclipse.jdt.core.dom.IVariableBinding; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.core.utility.jdt.Enum; -import org.eclipse.jpt.common.core.utility.jdt.EnumConstant; -import org.eclipse.jpt.common.utility.CommandExecutor; - -/** - * Adapt and extend a JDT enum constant. - */ -public class JDTEnumConstant - extends JDTMember - implements EnumConstant -{ - - // ********** constructors ********** - - public JDTEnumConstant( - Enum declaringEnum, - String name, - int occurrence, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor) { - this(declaringEnum, name, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance()); - } - - public JDTEnumConstant( - Enum declaringEnum, - String name, - int occurrence, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor, - AnnotationEditFormatter annotationEditFormatter) { - super(declaringEnum, name, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter); - } - - /** - * constructor for testing - */ - public JDTEnumConstant(Enum declaringEnum, String name, int occurrence, ICompilationUnit compilationUnit) { - this(declaringEnum, name, occurrence, compilationUnit, CommandExecutor.Default.instance(), DefaultAnnotationEditFormatter.instance()); - } - - @Override - protected Enum getDeclaringType() { - return (Enum) super.getDeclaringType(); - } - - // ********** AnnotatedElement/EnumConstant implementation ********** - - public IVariableBinding getBinding(CompilationUnit astRoot) { - return this.getBodyDeclaration(astRoot).resolveVariable(); - } - - @Override - public EnumConstantDeclaration getBodyDeclaration(CompilationUnit astRoot) { - return this.getSelectedDeclaration(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return new ASTNodeTextRange(this.getBodyDeclaration(astRoot).getName()); - } - - //As far as I can tell, enum constants are always "persistable", - //there are no modifiers you can add to an enum constant - public boolean isPersistable(CompilationUnit astRoot) { - return true; - } - - - // ********** internal ********** - - protected EnumConstantDeclaration getSelectedDeclaration(CompilationUnit astRoot) { - String name = this.getName(); - int occurrence = this.getOccurrence(); - int count = 0; - for (EnumConstantDeclaration enumConstantDeclaration : this.getDeclaringTypeEnumConstantDeclarations(astRoot)) { - if (enumConstantDeclaration.getName().getFullyQualifiedName().equals(name)) { - count++; - if (count == occurrence) { - return enumConstantDeclaration; - } - } - } - // return null if the field is no longer in the source code; - // this can happen when the context model has not yet - // been synchronized with the resource model but is still - // asking for an ASTNode (e.g. during a selection event) - return null; - } - - protected EnumConstantDeclaration[] getDeclaringTypeEnumConstantDeclarations(CompilationUnit astRoot) { - List enumConstants = enumConstants(this.getDeclaringTypeDeclaration(astRoot)); - return enumConstants.toArray(new EnumConstantDeclaration[enumConstants.size()]); - } - - @SuppressWarnings("unchecked") - private static List enumConstants(EnumDeclaration ed) { - return ed.enumConstants(); - } - - protected EnumDeclaration getDeclaringTypeDeclaration(CompilationUnit astRoot) { - return this.getDeclaringType().getBodyDeclaration(astRoot); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTFieldAttribute.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTFieldAttribute.java deleted file mode 100644 index fcce1eed37..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTFieldAttribute.java +++ /dev/null @@ -1,216 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.util.List; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.FieldDeclaration; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jdt.core.dom.IVariableBinding; -import org.eclipse.jdt.core.dom.TypeDeclaration; -import org.eclipse.jdt.core.dom.VariableDeclarationFragment; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.core.utility.jdt.FieldAttribute; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.common.utility.CommandExecutor; - -/** - * Adapt and extend a JDT field. - * Attribute based on a Java field, e.g. - * private int foo; - */ -public class JDTFieldAttribute - extends JDTMember - implements FieldAttribute -{ - - // ********** constructors ********** - - public JDTFieldAttribute( - Type declaringType, - String name, - int occurrence, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor) { - this(declaringType, name, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance()); - } - - public JDTFieldAttribute( - Type declaringType, - String name, - int occurrence, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor, - AnnotationEditFormatter annotationEditFormatter) { - super(declaringType, name, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter); - } - - /** - * constructor for testing - */ - public JDTFieldAttribute(Type declaringType, String name, int occurrence, ICompilationUnit compilationUnit) { - this(declaringType, name, occurrence, compilationUnit, CommandExecutor.Default.instance(), DefaultAnnotationEditFormatter.instance()); - } - - - // ********** Member/Attribute/FieldAttribute implementation ********** - - @Override - protected Type getDeclaringType() { - return (Type) super.getDeclaringType(); - } - - public IVariableBinding getBinding(CompilationUnit astRoot) { - return this.getFragment(astRoot).resolveBinding(); - } - - @Override - public FieldDeclaration getBodyDeclaration(CompilationUnit astRoot) { - return this.getSelectedDeclaration(astRoot, FIELD_DECLARATION_SELECTOR); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return new ASTNodeTextRange(this.getFragment(astRoot).getName()); - } - - public String getAttributeName() { - return this.getName(); - } - - public ITypeBinding getTypeBinding(CompilationUnit astRoot) { - return this.getBodyDeclaration(astRoot).getType().resolveBinding(); - } - - public boolean isField() { - return true; - } - - public boolean isPersistable(CompilationUnit astRoot) { - IVariableBinding binding = this.getBinding(astRoot); - return (binding == null) ? false : JPTTools.fieldIsPersistable(new JPTToolsAdapter(binding)); - } - - - // ********** internal ********** - - protected TypeDeclaration getDeclaringTypeDeclaration(CompilationUnit astRoot) { - // assume the declaring type is not an enum or annotation - // since they do not have field or method declarations - return this.getDeclaringType().getBodyDeclaration(astRoot); - } - - protected VariableDeclarationFragment getFragment(CompilationUnit astRoot) { - return this.getSelectedDeclaration(astRoot, VARIABLE_DECLARATION_FRAGMENT_SELECTOR); - } - - /** - * return either a FieldDeclaration or a VariableDeclarationFragment, - * depending on the specified selector; - * - * handle multiple fields declared in a single statement: - * private int foo, bar; - */ - protected T getSelectedDeclaration(CompilationUnit astRoot, Selector selector) { - String name = this.getName(); - int occurrence = this.getOccurrence(); - int count = 0; - for (FieldDeclaration fieldDeclaration : this.getDeclaringTypeFieldDeclarations(astRoot)) { - for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) { - if (fragment.getName().getFullyQualifiedName().equals(name)) { - count++; - if (count == occurrence) { - return selector.select(fieldDeclaration, fragment); - } - } - } - } - // return null if the field is no longer in the source code; - // this can happen when the context model has not yet - // been synchronized with the resource model but is still - // asking for an ASTNode (e.g. during a selection event) - return null; - } - - protected FieldDeclaration[] getDeclaringTypeFieldDeclarations(CompilationUnit astRoot) { - return this.getDeclaringTypeDeclaration(astRoot).getFields(); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - protected static List fragments(FieldDeclaration fd) { - return fd.fragments(); - } - - - // ********** Selector ********** - - // I'm not quite sure this interface is worth the resulting obfuscation, - // but, then, I kept changing both methods, so... ~bjv - protected interface Selector { - T select(FieldDeclaration fieldDeclaration, VariableDeclarationFragment variableDeclarationFragment); - String getDescription(); - } - - protected static final Selector FIELD_DECLARATION_SELECTOR = - new Selector() { - public FieldDeclaration select(FieldDeclaration fieldDeclaration, VariableDeclarationFragment variableDeclarationFragment) { - return fieldDeclaration; - } - public String getDescription() { - return "field declaration"; //$NON-NLS-1$ - } - @Override - public String toString() { - return "FIELD_DECLARATION_SELECTOR"; //$NON-NLS-1$ - } - }; - - protected static final Selector VARIABLE_DECLARATION_FRAGMENT_SELECTOR = - new Selector() { - public VariableDeclarationFragment select(FieldDeclaration fieldDeclaration, VariableDeclarationFragment variableDeclarationFragment) { - return variableDeclarationFragment; - } - public String getDescription() { - return "variable declaration fragment"; //$NON-NLS-1$ - } - @Override - public String toString() { - return "VARIABLE_DECLARATION_FRAGMENT_SELECTOR"; //$NON-NLS-1$ - } - }; - - - // ********** JPTTools adapter ********** - - /** - * JPTTools needs an adapter so it can work with either an IField - * or an IVariableBinding etc. - */ - protected static class JPTToolsAdapter implements JPTTools.FieldAdapter { - private final IVariableBinding fieldBinding; - - protected JPTToolsAdapter(IVariableBinding fieldBinding) { - super(); - if (fieldBinding == null) { - throw new NullPointerException(); - } - this.fieldBinding = fieldBinding; - } - - public int getModifiers() { - return this.fieldBinding.getModifiers(); - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTMember.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTMember.java deleted file mode 100644 index 35638f0503..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTMember.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.BodyDeclaration; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.CommandExecutor; - -/** - * Adapt and extend a JDT member with simplified annotation handling. - */ -public abstract class JDTMember extends JDTAnnotatedElement - implements Member -{ - - /** this will be null for the primary type */ - private final AbstractType declaringType; - - /** - * members can occur more than once in non-compiling source; - * count starts at 1; the primary type will have occurrence 1 - */ - private final int occurrence; - - - // ********** constructors ********** - - protected JDTMember( - AbstractType declaringType, - String name, - int occurrence, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor) { - this(declaringType, name, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance()); - } - - protected JDTMember( - AbstractType declaringType, - String name, - int occurrence, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor, - AnnotationEditFormatter annotationEditFormatter) { - super(name, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter); - this.declaringType = declaringType; - this.occurrence = occurrence; - } - - //covariant override - public abstract BodyDeclaration getBodyDeclaration(CompilationUnit astRoot); - - - // ********** Member implementation ********** - - @Override - public ModifiedDeclaration getModifiedDeclaration(CompilationUnit astRoot) { - return new JDTModifiedDeclaration(this.getBodyDeclaration(astRoot)); - } - - public boolean matches(String memberName, int occur) { - return memberName.equals(this.getName()) && (occur == this.occurrence); - } - - - // ********** internal ********** - - protected int getOccurrence() { - return this.occurrence; - } - - /** - * this will return null for a top-level type - */ - protected AbstractType getDeclaringType() { - return this.declaringType; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTMethodAttribute.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTMethodAttribute.java deleted file mode 100644 index cedc01f454..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTMethodAttribute.java +++ /dev/null @@ -1,263 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.util.Arrays; -import java.util.List; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IMethodBinding; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jdt.core.dom.MethodDeclaration; -import org.eclipse.jdt.core.dom.SingleVariableDeclaration; -import org.eclipse.jdt.core.dom.TypeDeclaration; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.core.utility.jdt.MethodAttribute; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.JavaType; -import org.eclipse.jpt.common.utility.MethodSignature; -import org.eclipse.jpt.common.utility.internal.NameTools; -import org.eclipse.jpt.common.utility.internal.SimpleMethodSignature; - -/** - * Adapt and extend a JDT method. - * Attribute based on a Java property, e.g. - * private int getFoo() { - * return foo; - * } - * private void setFoo(int foo) { - * this.foo = foo; - * } - */ -public class JDTMethodAttribute - extends JDTMember - implements MethodAttribute -{ - /** we need the parameter types to build the method signature */ - private final JavaType[] parameterTypes; - - - // ********** constructors ********** - - public static JDTMethodAttribute newInstance( - Type declaringType, - MethodSignature signature, - int occurrence, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor) { - return newInstance(declaringType, signature, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance()); - } - - public static JDTMethodAttribute newInstance( - Type declaringType, - MethodSignature signature, - int occurrence, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor, - AnnotationEditFormatter annotationEditFormatter) { - return new JDTMethodAttribute(declaringType, signature, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter); - } - - private JDTMethodAttribute( - Type declaringType, - MethodSignature methodSignature, - int occurrence, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor, - AnnotationEditFormatter annotationEditFormatter) { - super(declaringType, methodSignature.getName(), occurrence, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter); - this.parameterTypes = methodSignature.getParameterTypes(); - } - - /** - * constructor for testing - */ - public JDTMethodAttribute(Type declaringType, String name, String[] parameterTypeNames, int occurrence, ICompilationUnit compilationUnit) { - this(declaringType, new SimpleMethodSignature(name, parameterTypeNames), occurrence, compilationUnit, CommandExecutor.Default.instance(), DefaultAnnotationEditFormatter.instance()); - } - - - // ********** Member/Attribute/MethodAttribute implementation ********** - - @Override - protected Type getDeclaringType() { - return (Type) super.getDeclaringType(); - } - - public boolean isField() { - return false; - } - - public IMethodBinding getBinding(CompilationUnit astRoot) { - return this.getBodyDeclaration(astRoot).resolveBinding(); - } - - @Override - public MethodDeclaration getBodyDeclaration(CompilationUnit astRoot) { - int count = 0; - for (MethodDeclaration methodDeclaration : this.getDeclaringTypeMethodDeclarations(astRoot)) { - if (this.matches(methodDeclaration)) { - count++; - if (count == this.getOccurrence()) { - return methodDeclaration; - } - } - } - // return null if the method is no longer in the source code; - // this can happen when the context model has not yet - // been synchronized with the resource model but is still - // asking for an ASTNode (e.g. during a selection event) - return null; - } - - public boolean matches(MethodSignature signature, int occurrence) { - return this.matches(signature) && (occurrence == this.getOccurrence()); - } - - protected boolean matches(MethodSignature signature) { - return signature.getName().equals(this.getName()) - && Arrays.equals(this.parameterTypes, signature.getParameterTypes()); - } - - protected boolean matches(MethodDeclaration methodDeclaration) { - return this.matches(ASTTools.buildMethodSignature(methodDeclaration)); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - protected static List parameters(MethodDeclaration methodDeclaration) { - return methodDeclaration.parameters(); - } - - @Override - public boolean matches(String memberName, int occurrence) { - throw new UnsupportedOperationException("Use #matches(MethodSignature, int)."); //$NON-NLS-1$ - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return new ASTNodeTextRange(this.getBodyDeclaration(astRoot).getName()); - } - - /** - * return "foo" for a method named "getFoo", "isFoo", "setFoo" - */ - public String getAttributeName() { - return NameTools.convertGetterSetterMethodNameToPropertyName(this.getName()); - } - - public ITypeBinding getTypeBinding(CompilationUnit astRoot) { - IMethodBinding methodBinding = getBodyDeclaration(astRoot).resolveBinding(); - return (methodBinding == null) ? null : methodBinding.getReturnType(); - } - - public boolean isPersistable(CompilationUnit astRoot) { - IMethodBinding binding = this.getBinding(astRoot); - return (binding == null) ? false : JPTTools.methodIsPersistablePropertyGetter(new JPTToolsAdapter(binding)); - } - - - // ********** internal ********** - - protected TypeDeclaration getDeclaringTypeDeclaration(CompilationUnit astRoot) { - // assume the declaring type is not an enum or annotation - // since they do not have field or method declarations - return this.getDeclaringType().getBodyDeclaration(astRoot); - } - - protected MethodDeclaration[] getDeclaringTypeMethodDeclarations(CompilationUnit astRoot) { - return this.getDeclaringTypeDeclaration(astRoot).getMethods(); - } - - - // ********** JPTTools adapter ********** - - /** - * JPTTools needs an adapter so it can work with either an IMethod - * or an IMethodBinding etc. - */ - protected static class SimpleJPTToolsAdapter - implements JPTTools.SimpleMethodAdapter - { - protected final IMethodBinding methodBinding; - - protected SimpleJPTToolsAdapter(IMethodBinding methodBinding) { - super(); - if (methodBinding == null) { - throw new NullPointerException(); - } - this.methodBinding = methodBinding; - } - - public int getModifiers() { - return this.methodBinding.getModifiers(); - } - - public String getReturnTypeErasureName() { - ITypeBinding returnType = this.methodBinding.getReturnType(); - return (returnType == null) ? null : returnType.getTypeDeclaration().getErasure().getQualifiedName(); - } - - public boolean isConstructor() { - return this.methodBinding.isConstructor(); - } - - } - - protected static class JPTToolsAdapter - extends SimpleJPTToolsAdapter - implements JPTTools.MethodAdapter - { - protected JPTToolsAdapter(IMethodBinding methodBinding) { - super(methodBinding); - } - - public String getName() { - return this.methodBinding.getName(); - } - - public int getParametersLength() { - return this.methodBinding.getParameterTypes().length; - } - - public JPTTools.SimpleMethodAdapter getSibling(String name) { - ITypeBinding typeBinding = this.methodBinding.getDeclaringClass(); - if (typeBinding == null) { - return null; - } - for (IMethodBinding sibling : typeBinding.getDeclaredMethods()) { - if ((sibling.getParameterTypes().length == 0) - && sibling.getName().equals(name)) { - return new SimpleJPTToolsAdapter(sibling); - } - } - return null; - } - - public JPTTools.SimpleMethodAdapter getSibling(String name, String parameterTypeErasureName) { - ITypeBinding typeBinding = this.methodBinding.getDeclaringClass(); - if (typeBinding == null) { - return null; - } - for (IMethodBinding sibling : typeBinding.getDeclaredMethods()) { - ITypeBinding[] siblingParmTypes = sibling.getParameterTypes(); - if ((siblingParmTypes.length == 1) - && sibling.getName().equals(name) - && siblingParmTypes[0].getTypeDeclaration().getErasure().getQualifiedName().equals(parameterTypeErasureName)) { - return new SimpleJPTToolsAdapter(sibling); - } - } - return null; - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTModifiedDeclaration.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTModifiedDeclaration.java deleted file mode 100644 index 6e67e46fbc..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTModifiedDeclaration.java +++ /dev/null @@ -1,584 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jdt.core.IField; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.BodyDeclaration; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IExtendedModifier; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jdt.core.dom.ImportDeclaration; -import org.eclipse.jdt.core.dom.PackageDeclaration; -import org.eclipse.jdt.core.dom.SingleVariableDeclaration; -import org.eclipse.jdt.core.dom.VariableDeclarationExpression; -import org.eclipse.jdt.core.dom.VariableDeclarationStatement; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper; - -/** - * Wrap any of the AST nodes that have modifiers (specifically, annotations); - * i.e. BodyDeclaration, SingleVariableDeclaration, VariableDeclarationExpression, - * and VariableDeclarationStatement. - */ -public class JDTModifiedDeclaration - implements ModifiedDeclaration -{ - private final Adapter adapter; - - - // ********** constructors ********** - - public JDTModifiedDeclaration(Adapter adapter) { - super(); - this.adapter = adapter; - } - - public JDTModifiedDeclaration(BodyDeclaration declaration) { - this(new BodyDeclarationAdapter(declaration)); - } - - public JDTModifiedDeclaration(PackageDeclaration declaration) { - this(new PackageDeclarationAdapter(declaration)); - } - - public JDTModifiedDeclaration(SingleVariableDeclaration declaration) { - this(new SingleVariableDeclarationAdapter(declaration)); - } - - public JDTModifiedDeclaration(VariableDeclarationExpression declaration) { - this(new VariableDeclarationExpressionAdapter(declaration)); - } - - public JDTModifiedDeclaration(VariableDeclarationStatement declaration) { - this(new VariableDeclarationStatementAdapter(declaration)); - } - - - // ********** annotations ********** - - public Annotation getAnnotationNamed(String annotationName) { - for (Iterator stream = this.annotations(); stream.hasNext(); ) { - Annotation annotation = stream.next(); - if (this.annotationIsNamed(annotation, annotationName)) { - return annotation; - } - } - return null; - } - - public void removeAnnotationNamed(String annotationName) { - for (Iterator stream = this.getModifiers().iterator(); stream.hasNext(); ) { - IExtendedModifier modifier = stream.next(); - if (modifier.isAnnotation()) { - if (this.annotationIsNamed((Annotation) modifier, annotationName)) { - stream.remove(); - break; - } - } - } - } - - public void replaceAnnotationNamed(String oldAnnotationName, Annotation newAnnotation) { - List modifiers = this.getModifiers(); - for (ListIterator stream = modifiers.listIterator(); stream.hasNext(); ) { - IExtendedModifier modifier = stream.next(); - if (modifier.isAnnotation()) { - if (this.annotationIsNamed((Annotation) modifier, oldAnnotationName)) { - stream.set(newAnnotation); - return; - } - } - } - this.addAnnotation(newAnnotation); - } - - /** - * Add the specified annotation to the declaration. - * By convention annotations precede the "standard" (JLS2) modifiers; - * though, technically, they can be interspersed. - */ - protected void addAnnotation(Annotation annotation) { - List modifiers = this.getModifiers(); - for (ListIterator stream = modifiers.listIterator(); stream.hasNext(); ) { - if (stream.next().isModifier()) { - stream.previous(); // put the annotation *before* the first "standard" (JLS2) modifier - stream.add(annotation); - return; - } - } - modifiers.add(annotation); // just tack it on to the end - } - - /** - * Return the declaration's annotations. - */ - protected Iterator annotations() { - return new SubIteratorWrapper(this.annotations_()); - } - - protected Iterator annotations_() { - return new FilteringIterator(this.getModifiers().iterator()) { - @Override - protected boolean accept(IExtendedModifier next) { - return next.isAnnotation(); - } - }; - } - - - // ********** add import ********** - - public boolean addImport(String className) { - if (className.indexOf('.') == -1) { - return true; // the class is in the default package - no need for import - } - return this.addImport(className, false); - } - - public boolean addStaticImport(String enumConstantName) { - int index1 = enumConstantName.indexOf('.'); - if (index1 == -1) { - throw new IllegalArgumentException(enumConstantName); // shouldn't happen? - } - int index2 = enumConstantName.indexOf('.', index1 + 1); - if (index2 == -1) { - return true; // the enum is in the default package - no need for import - } - return this.addImport(enumConstantName, true); - } - - public boolean addImport(String importName, boolean staticImport) { - Boolean include = this.importsInclude(importName, staticImport); - if (include != null) { - return include.booleanValue(); - } - - ImportDeclaration importDeclaration = this.getAst().newImportDeclaration(); - importDeclaration.setName(this.getAst().newName(importName)); - importDeclaration.setStatic(staticImport); - this.getImports().add(importDeclaration); - return true; - } - - /** - * Just a bit hacky: - * Return Boolean.TRUE if the import is already present. - * Return Boolean.FALSE if a colliding import is already present. - * Return null if a new import may be added. - * This hackery allows us to loop through the imports only once - * (and compose our methods). - * Pre-condition: 'importName' is not in the "default" package (i.e. it *is* qualified) - */ - protected Boolean importsInclude(String importName, boolean staticImport) { - int period = importName.lastIndexOf('.'); // should not be -1 - String importNameQualifier = importName.substring(0, period); - String shortImportName = importName.substring(period + 1); - return this.importsInclude(importName, importNameQualifier, shortImportName, staticImport); - } - - /** - * pre-calculate the qualifier and short name - */ - protected Boolean importsInclude(String importName, String importNameQualifier, String shortImportName, boolean staticImport) { - for (ImportDeclaration importDeclaration : this.getImports()) { - if (importDeclaration.isStatic() == staticImport) { - Boolean match = this.importMatches(importDeclaration, importName, importNameQualifier, shortImportName); - if (match != null) { - return match; - } - } - } - return null; - } - - /** - * we should be able to rely on the JDT model here, since we are looking - * at objects that should not be changing underneath us... - */ - protected Boolean importMatches(ImportDeclaration importDeclaration, String importName, String importNameQualifier, String shortImportName) { - // examples: - // 'importName' is "java.util.Date" - // or - // 'importName' is "java.lang.annotation.ElementType.TYPE" - String idn = importDeclaration.getName().getFullyQualifiedName(); - if (importName.equals(idn)) { - // import java.util.Date; => "Date" will resolve to "java.util.Date" - // import static java.lang.annotation.ElementType.TYPE; => "TYPE" will resolve to "java.lang.annotation.ElementType.TYPE" - return Boolean.TRUE; - } - - String shortIDN = idn.substring(idn.lastIndexOf('.') + 1); - if (shortImportName.equals(shortIDN)) { - // import java.sql.Date; => ambiguous resolution of "Date" - // import static org.foo.Bar.TYPE; => ambiguous resolution of "TYPE" - return Boolean.FALSE; - } - - if (importDeclaration.isOnDemand()) { - if (importNameQualifier.equals(idn)) { - // import java.util.*; => "Date" will resolve to "java.util.Date" - // import static java.lang.annotation.ElementType.*; => "TYPE" will resolve to "java.lang.annotation.ElementType.TYPE" - return Boolean.TRUE; - } - if (importDeclaration.isStatic()) { - if (this.enumResolves(idn, shortImportName)) { - // import static org.foo.Bar.*; => ambiguous resolution of "TYPE" - return Boolean.FALSE; - } - } else { - if (this.typeResolves(idn + '.' + shortImportName)) { - // import java.sql.*; => ambiguous resolution of "Date" - return Boolean.FALSE; - } - } - } - // no matches - OK to add explicit import - return null; - } - - protected boolean enumResolves(String enumTypeName, String enumConstantName) { - try { - return this.enumResolves_(enumTypeName, enumConstantName); - } catch (JavaModelException ex) { - throw new RuntimeException(ex); - } - } - - protected boolean enumResolves_(String enumTypeName, String enumConstantName) throws JavaModelException { - IType jdtType = this.findType_(enumTypeName); - if (jdtType == null) { - return false; - } - if ( ! jdtType.isEnum()) { - return false; - } - for (IField jdtField : jdtType.getFields()) { - if (jdtField.isEnumConstant() && jdtField.getElementName().equals(enumConstantName)) { - return true; - } - } - return false; - } - - protected boolean typeResolves(String name) { - return this.findType(name) != null; - } - - protected IType findType(String name) { - try { - return this.findType_(name); - } catch (JavaModelException ex) { - throw new RuntimeException(ex); - } - } - - protected IType findType_(String name) throws JavaModelException { - return this.getCompilationUnit().getJavaElement().getJavaProject().findType(name); - } - - protected List getImports() { - return this.imports(this.getCompilationUnit()); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - protected List imports(CompilationUnit astRoot) { - return astRoot.imports(); - } - - - // ********** annotation name resolution ********** - - public boolean annotationIsNamed(Annotation annotation, String name) { - return this.getQualifiedName(annotation).equals(name); - } - - /** - * Simply return the annotation's unqualified name if we can't "resolve" it. - */ - protected String getQualifiedName(Annotation annotation) { - ITypeBinding typeBinding = annotation.resolveTypeBinding(); - if (typeBinding != null) { - String resolvedName = typeBinding.getQualifiedName(); - if (resolvedName != null) { - return resolvedName; - } - } - // hack(?): check for a matching import because when moving a stand-alone - // annotation to its container in CombinationIndexedDeclarationAnnotationAdapter - // the container's import is added but then it won't "resolve" upon - // subsequent lookups (because the parser hasn't had time to run?)... :-( - return this.convertToFullClassName(annotation.getTypeName().getFullyQualifiedName()); - } - - /** - * If necessary, use the declaration's imports to calculate a guess as to - * the specified name's fully-qualified form. - * Simply return the unqualified name if we can't "resolve" it. - */ - protected String convertToFullClassName(String name) { - // check for fully-qualified name - return (name.lastIndexOf('.') != -1) ? name : this.resolveAgainstImports(name, false); - } - - /** - * If necessary, use the declaration's imports to calculate a guess as to - * the specified name's fully-qualified form. - * Simply return the unqualified name if we can't "resolve" it. - */ - protected String convertToFullEnumConstantName(String name) { - int index1 = name.indexOf('.'); - if (index1 == -1) { - // short name, e.g. "TYPE" - // true = look for static import of enum constant - return this.resolveAgainstImports(name, true); - } - - int index2 = name.indexOf('.', index1 + 1); - if (index2 == -1) { - // partially-qualified name, e.g. "ElementType.TYPE" - // false = look regular import of enum class, not static import of enum constant - return this.resolveAgainstImports(name, false); - } - - // fully-qualified name, e.g. "java.lang.annotation.ElementType.TYPE" - return name; - } - - /** - * Attempt to resolve the specified "short" name against the declaration's - * imports. Return the name unchanged if we can't resolve it (perhaps it is - * in the "default" package). - */ - protected String resolveAgainstImports(String shortName, boolean static_) { - for (ImportDeclaration importDeclaration : this.getImports()) { - if (importDeclaration.isStatic() == static_) { - String resolvedName = this.resolveAgainstImport(importDeclaration, shortName); - if (resolvedName != null) { - return resolvedName; - } - } - } - return shortName; // "default" package or unknown - } - - /** - * Attempt to resolve the specified "short" name against the specified - * import. Return the resolved name if the import resolves it; otherwise - * return null. - */ - protected String resolveAgainstImport(ImportDeclaration importDeclaration, String shortName) { - String idn = importDeclaration.getName().getFullyQualifiedName(); - if (importDeclaration.isOnDemand()) { - String candidate = idn + '.' + shortName; - if (importDeclaration.isStatic()) { - if (this.enumResolves(idn, shortName)) { - return candidate; - } - } else { - if (this.typeResolves(candidate)) { - return candidate; - } - } - // no match - return null; - } - - // explicit import - see whether its end matches 'shortName' - int period = idn.length() - shortName.length() - 1; - if (period < 1) { - // something must precede period - return null; - } - if ((idn.charAt(period) == '.') && idn.endsWith(shortName)) { - return idn; // probable exact match - } - return null; - } - - - // ********** miscellaneous methods ********** - - public ASTNode getDeclaration() { - return this.adapter.getDeclaration(); - } - - /** - * Return the declaration's list of modifiers. - * Element type: org.eclipse.jdt.core.dom.IExtendedModifier - */ - protected List getModifiers() { - return this.adapter.getModifiers(); - } - - public AST getAst() { - return this.getDeclaration().getAST(); - } - - protected CompilationUnit getCompilationUnit() { - return (CompilationUnit) this.getDeclaration().getRoot(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.adapter.toString()); - } - - - // ********** declaration adapter interface and implementations ********** - - /** - * Define common protocol among the various "declarations". - */ - public interface Adapter { - - /** - * Return the adapted "declaration". - */ - ASTNode getDeclaration(); - - /** - * Return the "declaration"'s list of modifiers. - * Element type: org.eclipse.jdt.core.dom.IExtendedModifier - */ - List getModifiers(); - - } - - public static class BodyDeclarationAdapter implements Adapter { - private final BodyDeclaration declaration; - public BodyDeclarationAdapter(BodyDeclaration declaration) { - super(); - this.declaration = declaration; - } - public ASTNode getDeclaration() { - return this.declaration; - } - @SuppressWarnings("unchecked") - public List getModifiers() { - return this.declaration.modifiers(); - } - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.declaration.toString()); - } - } - - public static class PackageDeclarationAdapter implements Adapter { - private final PackageDeclaration declaration; - public PackageDeclarationAdapter(PackageDeclaration declaration) { - super(); - this.declaration = declaration; - } - public ASTNode getDeclaration() { - return this.declaration; - } - @SuppressWarnings("unchecked") - public List getModifiers() { - return this.declaration.annotations(); - } - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.declaration.toString()); - } - } - - /*public static class ASTNodeAdapter implements Adapter { - private final ASTNode declaration; - public ASTNodeAdapter(ASTNode declaration) { - super(); - this.declaration = declaration; - } - public ASTNode getDeclaration() { - return this.declaration; - } - @SuppressWarnings("unchecked") - public List getModifiers() { - if (declaration instanceof BodyDeclaration) { - return ((BodyDeclaration) declaration).modifiers(); - } else if (declaration instanceof PackageDeclaration) { - return ((PackageDeclaration) declaration).annotations(); - } - return Collections.emptyList(); - } - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.declaration.toString()); - } - }*/ - - public static class SingleVariableDeclarationAdapter implements Adapter { - private final SingleVariableDeclaration declaration; - public SingleVariableDeclarationAdapter(SingleVariableDeclaration declaration) { - super(); - this.declaration = declaration; - } - public ASTNode getDeclaration() { - return this.declaration; - } - @SuppressWarnings("unchecked") - public List getModifiers() { - return this.declaration.modifiers(); - } - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.declaration.toString()); - } - } - - public static class VariableDeclarationExpressionAdapter implements Adapter { - private final VariableDeclarationExpression declaration; - public VariableDeclarationExpressionAdapter(VariableDeclarationExpression declaration) { - super(); - this.declaration = declaration; - } - public ASTNode getDeclaration() { - return this.declaration; - } - @SuppressWarnings("unchecked") - public List getModifiers() { - return this.declaration.modifiers(); - } - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.declaration.toString()); - } - } - - public static class VariableDeclarationStatementAdapter implements Adapter { - private final VariableDeclarationStatement declaration; - public VariableDeclarationStatementAdapter(VariableDeclarationStatement declaration) { - super(); - this.declaration = declaration; - } - public ASTNode getDeclaration() { - return this.declaration; - } - @SuppressWarnings("unchecked") - public List getModifiers() { - return this.declaration.modifiers(); - } - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.declaration.toString()); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTPackage.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTPackage.java deleted file mode 100644 index dfdbd2c112..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTPackage.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Red Hat, Inc. - * Distributed under license by Red Hat, Inc. All rights reserved. - * This program is made available under the terms of the - * Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributor: - * Red Hat, Inc. - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IPackageBinding; -import org.eclipse.jdt.core.dom.PackageDeclaration; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedPackage; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.CommandExecutor; - -/** - * @author Dmitry Geraskov - * - */ - -public class JDTPackage extends JDTAnnotatedElement implements AnnotatedPackage { - - - protected JDTPackage(PackageDeclaration declaringPackage, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor) { - super(declaringPackage.getName().getFullyQualifiedName(), - compilationUnit, - modifySharedDocumentCommandExecutor); - } - - public JDTPackage( - PackageDeclaration declaringPackage, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor, - AnnotationEditFormatter annotationEditFormatter) { - super(declaringPackage.getName().getFullyQualifiedName(), - compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter); - } - - @Override - public ModifiedDeclaration getModifiedDeclaration(CompilationUnit astRoot) { - return new JDTModifiedDeclaration(this.getBodyDeclaration(astRoot)); - } - - public IPackageBinding getBinding(CompilationUnit astRoot) { - PackageDeclaration pd = this.getBodyDeclaration(astRoot); - return (pd == null) ? null : pd.resolveBinding(); - } - - public PackageDeclaration getBodyDeclaration(CompilationUnit astRoot) { - return astRoot.getPackage(); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return new ASTNodeTextRange(this.getBodyDeclaration(astRoot).getName()); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTTools.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTTools.java deleted file mode 100644 index 63af352530..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTTools.java +++ /dev/null @@ -1,236 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.io.FileNotFoundException; -import java.util.ArrayList; -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.JavaModelException; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; - -/** - * Convenience methods for dealing with JDT core - */ -public final class JDTTools -{ - - public static boolean packageFragmentRootIsSourceFolder(IPackageFragmentRoot pfr) { - try { - return packageFragmentRootIsSourceFolder_(pfr); - } catch (JavaModelException ex) { - JptCommonCorePlugin.log(ex); - return false; - } - } - - protected static boolean packageFragmentRootIsSourceFolder_(IPackageFragmentRoot pfr) throws JavaModelException { - return pfr.exists() && (pfr.getKind() == IPackageFragmentRoot.K_SOURCE); - } - - public static IJavaElement[] getJDTChildren(IPackageFragmentRoot root) { - try { - return getJDTChildren_(root); - } catch (JavaModelException ex) { - // ignore FNFE - which can happen when the workspace is out of synch with O/S file system - if ( ! (ex.getCause() instanceof FileNotFoundException)) { - JptCommonCorePlugin.log(ex); - } - return EMPTY_JAVA_ELEMENT_ARRAY; - } - } - - private static IJavaElement[] getJDTChildren_(IPackageFragmentRoot root) throws JavaModelException { - return root.getChildren(); - } - - private static final IJavaElement[] EMPTY_JAVA_ELEMENT_ARRAY = new IJavaElement[0]; - - public static boolean typeNamedImplementsInterfaceNamed(IJavaProject javaProject, String typeName, String interfaceNamed) { - try { - return typeImplementsInterface(javaProject, javaProject.findType(typeName), javaProject.findType(interfaceNamed)); - } - catch (JavaModelException ex) { - JptCommonCorePlugin.log(ex); - return false; - } - } - - public static boolean typeImplementsInterface(IJavaProject javaProject, IType type, IType interfase) { - try { - if (type == null || interfase == null) { - return false; - } - - Iterable resolvedSuperInterfaceNames = resolveSuperInterfaceNames(type); - if (CollectionTools.contains(resolvedSuperInterfaceNames, interfase.getFullyQualifiedName())) { - return true; - } - - for (String interfaceName : resolveSuperInterfaceNames(type)) { - IType superInterface = javaProject.findType(interfaceName); - if (superInterface != null && typeImplementsInterface(javaProject, superInterface, interfase)) { - return true; - } - } - - if (type.getSuperclassName() == null) { - return false; - } - - return typeImplementsInterface(javaProject, getJDTSuperclass(javaProject, type), interfase); - } - catch (JavaModelException ex) { - return false; - } - - } - - /** - * This is necessary because for whatever reason getSuperClassName() on IType returns unqualified names - * when the type is java sourced. - * @param type - * @return String - resolved super class name or null - */ - private static String resolveSuperClassName(final IType type) { - try { - if (!type.isBinary()) { - String superClassName = type.getSuperclassName(); - String[][] resolvedSuperClassName = type.resolveType(superClassName); - return resolvedSuperClassName[0][0] + "." + resolvedSuperClassName[0][1]; //$NON-NLS-1$ - } - return type.getSuperclassName(); - } catch (JavaModelException ex) { - JptCommonCorePlugin.log(ex); - return null; - } - } - - /** - * This is necessary because for whatever reason getSuperInterfaceNames() on IType returns unqualified names - * when the type is java sourced. - * @param type - * @return Iterable - resolved super interface names - */ - private static Iterable resolveSuperInterfaceNames(final IType type) { - try { - if (!type.isBinary()) { - ArrayList resolvedSuperInterfaceNames = new ArrayList(); - for (String superInterfaceName : new ArrayIterable(type.getSuperInterfaceNames())) { - String[][] resolvedTypeNames = type.resolveType(superInterfaceName); - for (String[] resolvedTypeName : resolvedTypeNames) { - resolvedSuperInterfaceNames.add(resolvedTypeName[0] + "." + resolvedTypeName[1]); //$NON-NLS-1$ - } - } - return resolvedSuperInterfaceNames; - } - return new ArrayIterable(type.getSuperInterfaceNames()); - } - catch (JavaModelException ex) { - JptCommonCorePlugin.log(ex); - return EmptyIterable.instance(); - } - } - - public static IType getJDTType(IJavaProject javaProject, String fullyQualifiedName) { - try { - return javaProject.findType(fullyQualifiedName); - } - catch (JavaModelException ex) { - JptCommonCorePlugin.log(ex); - return null; - } - } - - public static IType getJDTSuperclass(IJavaProject javaProject, IType child) { - try { - return javaProject.findType(resolveSuperClassName(child)); - } - catch (JavaModelException ex) { - JptCommonCorePlugin.log(ex); - return null; - } - } - - public static Iterable getJDTSuperInterfaces(IJavaProject javaProject, IType child) { - ArrayList superclassInterfaces = new ArrayList(); - try { - Iterable superInterfaceNameIterable = resolveSuperInterfaceNames(child); - for (String superInterfaceName : superInterfaceNameIterable) { - superclassInterfaces.add(javaProject.findType(superInterfaceName)); - } - } - catch (JavaModelException ex) { - JptCommonCorePlugin.log(ex); - return EmptyIterable.instance(); - } - - return superclassInterfaces; - } - - public static Iterable getJavaSourceFolders(IJavaProject javaProject) { - try { - return new FilteringIterable( - getPackageFragmentRoots(javaProject), - SOURCE_PACKAGE_FRAGMENT_ROOT_FILTER); - } - catch (JavaModelException ex) { - JptCommonCorePlugin.log(ex); - return EmptyIterable.instance(); - } - } - - /** - * This returns the first package fragment root found on this project. - * I am not completely sure why, but the JavaTypeCompletionProcessor works with this. - */ - //TODO move this method to JpaProject once API freeze is over - public static IPackageFragmentRoot getCodeCompletionContextRoot(IJavaProject javaProject) { - try { - return javaProject.getPackageFragmentRoots()[0]; - } - catch (JavaModelException e) { - JptCommonCorePlugin.log(e); - return null; - } - } - - protected static Iterable getJavaSourceFolders_(IJavaProject javaProject) throws JavaModelException { - return new FilteringIterable( - getPackageFragmentRoots(javaProject), - SOURCE_PACKAGE_FRAGMENT_ROOT_FILTER - ); - } - - protected static final Filter SOURCE_PACKAGE_FRAGMENT_ROOT_FILTER = - new Filter() { - public boolean accept(IPackageFragmentRoot pfr) { - try { - return this.accept_(pfr); - } catch (JavaModelException ex) { - return false; - } - } - private boolean accept_(IPackageFragmentRoot pfr) throws JavaModelException { - return packageFragmentRootIsSourceFolder_(pfr); - } - }; - - protected static Iterable getPackageFragmentRoots(IJavaProject javaProject) throws JavaModelException { - return new ArrayIterable(javaProject.getPackageFragmentRoots()); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTType.java deleted file mode 100644 index 55bef8862a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JDTType.java +++ /dev/null @@ -1,207 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.util.List; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.AbstractTypeDeclaration; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumDeclaration; -import org.eclipse.jdt.core.dom.FieldDeclaration; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jdt.core.dom.MethodDeclaration; -import org.eclipse.jdt.core.dom.TypeDeclaration; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.common.utility.CommandExecutor; - -/** - * Adapt and extend a JDT type. - */ -public class JDTType - extends AbstractJDTType - implements Type -{ - - /** - * constructor for the compilation unit's primary type - */ - public JDTType( - TypeDeclaration typeDeclaration, // exclude annotations and enums - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor) { - this(typeDeclaration, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance()); - } - - /** - * constructor for the compilation unit's primary type - */ - public JDTType( - TypeDeclaration typeDeclaration, // exclude annotations and enums - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor, - AnnotationEditFormatter annotationEditFormatter) { - this(null, typeDeclaration, 1, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter); - } - - /** - * constructor for nested types - */ - public JDTType( - Type declaringType, - TypeDeclaration typeDeclaration, // exclude annotations and enums - int occurrence, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor) { - this(declaringType, typeDeclaration, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, DefaultAnnotationEditFormatter.instance()); - } - - /** - * constructor for nested types - */ - public JDTType( - Type declaringType, - TypeDeclaration typeDeclaration, // exclude annotations and enums - int occurrence, - ICompilationUnit compilationUnit, - CommandExecutor modifySharedDocumentCommandExecutor, - AnnotationEditFormatter annotationEditFormatter) { - super(declaringType, typeDeclaration, occurrence, compilationUnit, modifySharedDocumentCommandExecutor, annotationEditFormatter); - } - - /** - * constructor for testing - */ - public JDTType(Type declaringType, String name, int occurrence, ICompilationUnit compilationUnit) { - super(declaringType, name, occurrence, compilationUnit); - } - - - // ********** Member/Type implementation ********** - - /** - * find the type's body declaration in the specified AST - */ - @Override - public TypeDeclaration getBodyDeclaration(CompilationUnit astRoot) { - return (TypeDeclaration) super.getBodyDeclaration(astRoot); - } - - public boolean isPersistable(CompilationUnit astRoot) { - ITypeBinding binding = this.getBinding(astRoot); - return (binding == null) ? false : JPTTools.typeIsPersistable(new JPTToolsAdapter(binding)); - } - - public TypeDeclaration[] getTypes(CompilationUnit astRoot) { - return this.getBodyDeclaration(astRoot).getTypes(); - } - - public EnumDeclaration[] getEnums(CompilationUnit astRoot) { - return getEnums(this.getBodyDeclaration(astRoot)); - } - - public FieldDeclaration[] getFields(CompilationUnit astRoot) { - return this.getBodyDeclaration(astRoot).getFields(); - } - - public MethodDeclaration[] getMethods(CompilationUnit astRoot) { - return this.getBodyDeclaration(astRoot).getMethods(); - } - - - // ********** internal ********** - - /** - * return the first top-level type in the specified AST with a matching name - */ - @Override - protected TypeDeclaration getTopLevelTypeDeclaration(CompilationUnit astRoot) { - return (TypeDeclaration) super.getTopLevelTypeDeclaration(astRoot); - } - - @Override - protected TypeDeclaration getTypeDeclaration(List typeDeclarations) { - return (TypeDeclaration) super.getTypeDeclaration(typeDeclarations); - } - - /** - * return the nested type with a matching name and occurrence - */ - @Override - protected TypeDeclaration getNestedTypeDeclaration(TypeDeclaration declaringTypeDeclaration) { - return this.getTypeDeclaration(declaringTypeDeclaration.getTypes()); - } - - /** - * return the type declaration corresponding to the type from the specified - * set of type declarations (match name and occurrence) - */ - @Override - protected TypeDeclaration getTypeDeclaration(AbstractTypeDeclaration[] typeDeclarations) { - return (TypeDeclaration) super.getTypeDeclaration(typeDeclarations); - } - - @Override - protected int getASTNodeType() { - return ASTNode.TYPE_DECLARATION; - } - - - // ********** JPT tools adapter ********** - - protected static class JPTToolsAdapter implements JPTTools.TypeAdapter { - private final ITypeBinding typeBinding; - protected JPTToolsAdapter(ITypeBinding typeBinding) { - super(); - if (typeBinding == null) { - throw new NullPointerException(); - } - this.typeBinding = typeBinding; - } - - public int getModifiers() { - return this.typeBinding.getModifiers(); - } - - public boolean isAnnotation() { - return this.typeBinding.isAnnotation(); - } - - public boolean isAnonymous() { - return this.typeBinding.isAnonymous(); - } - - public boolean isArray() { - return this.typeBinding.isArray(); - } - - public boolean isEnum() { - return this.typeBinding.isEnum(); - } - - public boolean isInterface() { - return this.typeBinding.isInterface(); - } - - public boolean isLocal() { - return this.typeBinding.isLocal(); - } - - public boolean isMember() { - return this.typeBinding.isMember(); - } - - public boolean isPrimitive() { - return this.typeBinding.isPrimitive(); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JPTTools.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JPTTools.java deleted file mode 100644 index f1930c829c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/JPTTools.java +++ /dev/null @@ -1,283 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.lang.reflect.Modifier; - -/** - * Convenience methods for JPA-related queries concerning JDT objects. - */ -//TODO this needs to move because it is only used for JPA -public class JPTTools { - - // ********** type ********** - - /** - * Return whether the specified type can be "persisted", i.e. marked as - * Entity, MappedSuperclass, Embeddable - */ - public static boolean typeIsPersistable(TypeAdapter typeAdapter) { - if (typeAdapter.isInterface()) { - return false; - } - if (typeAdapter.isAnnotation()) { - return false; - } - if (typeAdapter.isEnum()) { - return false; - } - if (typeAdapter.isLocal()) { - return false; - } - if (typeAdapter.isAnonymous()) { - return false; - } - if (typeAdapter.isPrimitive()) { - return false; // should never get here(?) - } - if (typeAdapter.isArray()) { - return false; // should never get here(?) - } - return true; - } - - /** - * Queries needed to calculate whether a type is "persistable". - * Adapted to ITypeBinding and IType. - */ - public interface TypeAdapter { - int getModifiers(); - boolean isAnnotation(); - boolean isAnonymous(); - boolean isArray(); - boolean isEnum(); - boolean isInterface(); - boolean isLocal(); - boolean isMember(); - boolean isPrimitive(); - } - - - // ********** field ********** - - /** - * Return whether the specified field may be "persisted". - * According to the spec, "All non-transient instance variables that are not - * annotated with the Transient annotation are persistent." - */ - public static boolean fieldIsPersistable(FieldAdapter fieldAdapter) { - int modifiers = fieldAdapter.getModifiers(); - if (Modifier.isStatic(modifiers)) { - return false; - } - if (Modifier.isTransient(modifiers)) { - return false; - } - return true; - } - - /** - * Queries needed to calculate whether a field is "persistable". - * Adapted to IVariableBinding and IField. - */ - public interface FieldAdapter { - /** - * Return the field's modifiers. We use these to check whether the - * field is static or transient. - */ - int getModifiers(); - } - - - // ********** method ********** - - /** - * Return whether the specified method is a "getter" method that - * represents a property that may be "persisted". - */ - public static boolean methodIsPersistablePropertyGetter(MethodAdapter methodAdapter) { - if (methodHasInvalidModifiers(methodAdapter)) { - return false; - } - if (methodAdapter.isConstructor()) { - return false; - } - - String returnTypeName = methodAdapter.getReturnTypeErasureName(); - if (returnTypeName == null) { - return false; // DOM method bindings can have a null name - } - if (returnTypeName.equals("void")) { //$NON-NLS-1$ - return false; - } - if (methodHasParameters(methodAdapter)) { - return false; - } - - String name = methodAdapter.getName(); - int beginIndex = 0; - boolean booleanGetter = false; - if (name.startsWith("is")) { //$NON-NLS-1$ - if (returnTypeName.equals("boolean")) { //$NON-NLS-1$ - beginIndex = 2; - } else { - return false; - } - } else if (name.startsWith("get")) { //$NON-NLS-1$ - beginIndex = 3; - if (returnTypeName.equals("boolean")) { //$NON-NLS-1$ - booleanGetter = true; - } - } else { - return false; - } - - String capitalizedAttributeName = name.substring(beginIndex); - // if the type has both methods: - // boolean isProperty() - // boolean getProperty() - // then #isProperty() takes precedence and we ignore #getProperty(); - // but only having #getProperty() is OK too - // (see the JavaBeans spec 1.01) - if (booleanGetter && methodHasValidSiblingIsMethod(methodAdapter, capitalizedAttributeName)) { - return false; // since the type also defines #isProperty(), ignore #getProperty() - } - return methodHasValidSiblingSetMethod(methodAdapter, capitalizedAttributeName, returnTypeName); - } - - /** - * Return whether the method's modifiers prevent it - * from being a getter or setter for a "persistent" property. - */ - private static boolean methodHasInvalidModifiers(SimpleMethodAdapter methodAdapter) { - int modifiers = methodAdapter.getModifiers(); - if (Modifier.isStatic(modifiers)) { - return true; - } - return false; - } - - private static boolean methodHasParameters(MethodAdapter methodAdapter) { - return methodAdapter.getParametersLength() != 0; - } - - /** - * Return whether the method has a sibling "is" method for the specified - * property and that method is valid for a "persistable" property. - * Pre-condition: the method is a "boolean getter" (e.g. 'public boolean getProperty()'); - * this prevents us from returning true when the method itself is an - * "is" method. - */ - private static boolean methodHasValidSiblingIsMethod(MethodAdapter methodAdapter, String capitalizedAttributeName) { - SimpleMethodAdapter isMethodAdapter = methodAdapter.getSibling("is" + capitalizedAttributeName); //$NON-NLS-1$ - return methodIsValidSibling(isMethodAdapter, "boolean"); //$NON-NLS-1$ - } - - /** - * Return whether the method has a sibling "set" method - * and that method is valid for a "persistable" property. - */ - private static boolean methodHasValidSiblingSetMethod(MethodAdapter methodAdapter, String capitalizedAttributeName, String parameterTypeErasureName) { - SimpleMethodAdapter setMethodAdapter = methodAdapter.getSibling("set" + capitalizedAttributeName, parameterTypeErasureName); //$NON-NLS-1$ - return methodIsValidSibling(setMethodAdapter, "void"); //$NON-NLS-1$ - } - - /** - * Return whether the specified method is a valid sibling with the - * specified return type. - */ - private static boolean methodIsValidSibling(SimpleMethodAdapter methodAdapter, String returnTypeName) { - if (methodAdapter == null) { - return false; - } - if (methodHasInvalidModifiers(methodAdapter)) { - return false; - } - if (methodAdapter.isConstructor()) { - return false; - } - String rtName = methodAdapter.getReturnTypeErasureName(); - if (rtName == null) { - return false; // DOM method bindings can have a null name - } - return rtName.equals(returnTypeName); - } - - /** - * Queries needed to calculate whether a method is "persistable". - * Adapted to IMethodBinding and IMethod. - */ - public interface SimpleMethodAdapter { - /** - * Return the method's modifiers. - * We use these to check whether the method is static, final, etc. - */ - int getModifiers(); - - /** - * Return the name of the method's return type erasure. - * We use this to check for - * - boolean getters - * - void return types - * - matching getters and setters - */ - String getReturnTypeErasureName(); - - /** - * Return whether the method is a constructor. - */ - boolean isConstructor(); - } - - /** - * Queries needed to calculate whether a method is "persistable". - * Adapted to IMethodBinding and IMethod. - */ - public interface MethodAdapter extends SimpleMethodAdapter { - /** - * Return the method's name. - * We use this to determine - * - whether the method is a "getter" - * - the property name implied by the getter's name - */ - String getName(); - - /** - * Return the number of paramters declared by the method. - * We use this to determine whether the method is a "getter". - */ - int getParametersLength(); - - /** - * Return the method's "sibling" with the specified name and no parameters. - * We use this to find an "is" boolean getter that would take precedence - * over a "get" boolean getter. - */ - SimpleMethodAdapter getSibling(String name); - - /** - * Return the method's "sibling" with the specified name and single parameter. - * We use this to find a matching "setter" for a possible "getter". - */ - SimpleMethodAdapter getSibling(String name, String parameterTypeErasureName); - } - - - // ********** suppressed constructor ********** - - /** - * Suppress default constructor, ensuring non-instantiability. - */ - private JPTTools() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NameStringExpressionConverter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NameStringExpressionConverter.java deleted file mode 100644 index 5c9bc46dde..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NameStringExpressionConverter.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.Name; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; - -/** - * Convert a name to/from a string representation of a name/identifier - * (e.g. "com.xxx.Foo.VALUE1" or "value"). - */ -public final class NameStringExpressionConverter - extends AbstractExpressionConverter -{ - private static final ExpressionConverter INSTANCE = new NameStringExpressionConverter(); - - /** - * Return the singleton. - */ - public static ExpressionConverter instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private NameStringExpressionConverter() { - super(); - } - - @Override - protected Name convertObject(String string, AST ast) { - return ast.newName(string); - } - - @Override - protected String convertExpression(Expression expression) { - switch (expression.getNodeType()) { - case ASTNode.QUALIFIED_NAME: - case ASTNode.SIMPLE_NAME: - return ((Name) expression).getFullyQualifiedName(); - default: - return null; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NestedDeclarationAnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NestedDeclarationAnnotationAdapter.java deleted file mode 100644 index 17eb956055..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NestedDeclarationAnnotationAdapter.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.MemberValuePair; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; - -/** - * Manipulate an annotation that is embedded as an element within - * another annotation, e.g. - *
- *     @Outer(foo=@Inner)
- *     private int id;
- *         outerAnnotationAdapter = AnnotationAdapter<@Outer>
- *         elementName = "foo"
- *         annotationName = "Inner"
- * 
- */ -public class NestedDeclarationAnnotationAdapter - extends AbstractNestedDeclarationAnnotationAdapter -{ - // ********** constructors ********** - - /** - * The default element name is value. - */ - public NestedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter outerAnnotationAdapter, String annotationName) { - super(outerAnnotationAdapter, annotationName); - } - - /** - * default behavior is to remove the outer annotation when it is empty - */ - public NestedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter outerAnnotationAdapter, String elementName, String annotationName) { - super(outerAnnotationAdapter, elementName, annotationName); - } - - - // ********** AbstractNestedDeclarationAnnotationAdapter implementation ********** - - @Override - protected Annotation getAnnotation(Expression value) { - return this.annotationValue(value); - } - - @Override - protected Expression buildNewInnerExpression(Annotation inner) { - return inner; - } - - /** - * the annotation is the expression itself, so the annotation cannot be - * "removed" from itself - return 'false' - */ - @Override - protected boolean removeAnnotation(ModifiedDeclaration declaration, Annotation outer, Expression value) { - return false; - } - - /** - *
-	 * @Outer("lorem ipsum") => @Outer(@Inner)
-	 * 
- */ - @Override - protected void modifyAnnotationValue(SingleMemberAnnotation outer, Annotation inner) { - // replace(?) the current element value - outer.setValue(inner); - } - - /** - * Simply set the pair's value. - */ - @Override - protected void modifyMemberValuePair(MemberValuePair pair, Annotation inner) { - pair.setValue(inner); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NestedIndexedDeclarationAnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NestedIndexedDeclarationAnnotationAdapter.java deleted file mode 100644 index acfd74372f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NestedIndexedDeclarationAnnotationAdapter.java +++ /dev/null @@ -1,325 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.util.List; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.ArrayInitializer; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.MemberValuePair; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; - -/** - * Manipulate an annotation that is embedded in an element array within - * another annotation, e.g. - *
- *     @Outer(foo={@Inner("zero"), @Inner("one"), @Inner("two")})
- *     private int id;
- *         outerAnnotationAdapter = AnnotationAdapter<@Outer>
- *         elementName = "foo"
- *         index = 0-2
- *         annotationName = "Inner"
- * 
- */ -public class NestedIndexedDeclarationAnnotationAdapter - extends AbstractNestedDeclarationAnnotationAdapter - implements IndexedDeclarationAnnotationAdapter -{ - private int index; - - - // ********** constructors ********** - - /** - * The default element name is value. - */ - public NestedIndexedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter annotationAdapter, int index, String annotationName) { - super(annotationAdapter, annotationName); - this.index = index; - } - - public NestedIndexedDeclarationAnnotationAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, int index, String annotationName) { - super(annotationAdapter, elementName, annotationName); - this.index = index; - } - - - // ********** AbstractNestedDeclarationAnnotationAdapter implementation ********** - - @Override - protected Annotation getAnnotation(Expression value) { - if (value.getNodeType() == ASTNode.ARRAY_INITIALIZER) { - return this.annotation((ArrayInitializer) value); - } - return (this.index == 0) ? this.annotationValue(value) : null; - } - - @Override - protected Expression buildNewInnerExpression(Annotation inner) { - return (this.index == 0) ? inner : (Expression) this.buildNewInnerArrayInitializer(inner); - } - - @Override - protected boolean removeAnnotation(ModifiedDeclaration declaration, Annotation outer, Expression value) { - if (value.getNodeType() == ASTNode.ARRAY_INITIALIZER) { - this.removeAnnotation(declaration, outer, (ArrayInitializer) value); - return true; - } - // if our index is greater than zero, but we don't have an array, - // then the annotation must already be gone - return (this.index != 0); - } - - /** - *
-	 * @Outer({@Inner(0), @Inner(1)}) => @Outer({@Inner(0), @Inner(1), @Inner(2)})
-	 *     or
-	 * @Outer("lorem ipsum") => @Outer(@Inner(0))
-	 *     or
-	 * @Outer(@Inner(0)) => @Outer({@Inner(0), @Inner(1)})
-	 * 
- */ - @Override - protected void modifyAnnotationValue(SingleMemberAnnotation outer, Annotation inner) { - this.modifyExpression(outer, SINGLE_MEMBER_ANNOTATION_EXPRESSION_PROVIDER, inner); - } - - /** - *
-	 * @Outer(text="lorem ipsum") => @Outer(text="lorem ipsum", foo=@Inner(0))
-	 *     or
-	 * @Outer(foo={@Inner(0), @Inner(1)}) => @Outer(foo={@Inner(0), @Inner(1), @Inner(2)})
-	 *     or
-	 * @Outer(foo="lorem ipsum") => @Outer(foo=@Inner(0))
-	 *     or
-	 * @Outer(foo=@NotInner) => @Outer(foo=@Inner(0))
-	 *     or
-	 * @Outer(foo=@Inner(0)) => @Outer(foo={@Inner(0), @Inner(1)})
-	 * 
- */ - @Override - protected void modifyMemberValuePair(MemberValuePair pair, Annotation inner) { - this.modifyExpression(pair, MEMBER_VALUE_PAIR_EXPRESSION_PROVIDER, inner); - } - - - // ********** IndexedDeclarationAnnotationAdapter implementation ********** - - public int getIndex() { - return this.index; - } - - /** - * Move the annotation to the specified index, leaving its original - * position cleared out. - */ - public void moveAnnotation(int newIndex, ModifiedDeclaration declaration) { - int oldIndex = this.index; - if (newIndex == oldIndex) { - return; - } - - Annotation original = this.getAnnotation(declaration); - if (original == null) { - this.index = newIndex; - this.removeAnnotation(declaration); // clear out the new location (?) - } else { - Annotation copy = (Annotation) ASTNode.copySubtree(original.getAST(), original); - this.index = newIndex; - this.addAnnotation(declaration, copy); // install the copy in the new location - this.index = oldIndex; - this.removeAnnotation(declaration); // go back and clear out the original location (AFTER the move) - this.index = newIndex; - } - } - - - // ********** internal methods ********** - - /** - * Return the adapter's annotation from the specified array initializer. - */ - private Annotation annotation(ArrayInitializer value) { - List expressions = this.expressions(value); - return (this.index >= expressions.size()) ? null : this.annotationValue(expressions.get(this.index)); - } - - /** - * Build a new array initializer to hold the specified annotation, - * padding it with 'null' literals as necessary - */ - private ArrayInitializer buildNewInnerArrayInitializer(Annotation inner) { - ArrayInitializer ai = inner.getAST().newArrayInitializer(); - this.addInnerToExpressions(inner, this.expressions(ai)); - return ai; - } - - /** - * Add the specified annotation to the specified array initializer, - * padding it with 'null' literals as necessary - */ - private void addInnerToExpressions(Annotation inner, List expressions) { - if (expressions.size() > this.index) { - throw new IllegalStateException("expressions size is greater than index (size: " + expressions.size() + " index: " + this.index + ")"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - while (expressions.size() < this.index) { - expressions.add(inner.getAST().newNullLiteral()); - } - expressions.add(inner); - } - - /** - * Remove the adapter's annotation from the specified array initializer. - */ - private void removeAnnotation(ModifiedDeclaration declaration, Annotation outer, ArrayInitializer value) { - List expressions = this.expressions(value); - if (this.index >= expressions.size()) { - return; // avoid IndexOutOfBoundsException(?) - } - Annotation inner = this.annotationValue(expressions.get(this.index)); - if (inner == null) { - return; - } - if ( ! this.nameMatches(declaration, inner)) { - return; - } - if (this.index == (expressions.size() - 1)) { - expressions.remove(this.index); - } else { - expressions.set(this.index, value.getAST().newNullLiteral()); - } - this.trimExpressions(declaration, outer, expressions); - } - - /** - * Strip all the null literals off the end of the specified list of expressions - * and normalize the specified outer annotation. - */ - private void trimExpressions(ModifiedDeclaration declaration, Annotation outer, List expressions) { - // start at the end of the list - for (int i = expressions.size(); i-- > 0; ) { - if (expressions.get(i).getNodeType() == ASTNode.NULL_LITERAL) { - expressions.remove(i); - } else { - break; // stop with the first non-null literal encountered - } - } - switch (expressions.size()) { - case 0: - this.removeElementAndNormalize(declaration, outer); - break; - case 1: - this.convertArrayToLastRemainingExpression(outer, expressions.get(0)); - break; - default: - break; - } - } - - /** - * When there is only a single element in an array initializer, convert the - * expression to be just the single element; e.g. - *
-	 *     @Foo(xxx={"abc"}) => @Foo(xxx="abc")
-	 * or
-	 *     @Foo({"abc"}) => @Foo("abc")
-	 * 
- */ - private void convertArrayToLastRemainingExpression(Annotation outer, Expression lastValue) { - lastValue = (Expression) ASTNode.copySubtree(lastValue.getAST(), lastValue); - if (outer.isNormalAnnotation()) { - this.memberValuePair((NormalAnnotation) outer).setValue(lastValue); - } else if (outer.isSingleMemberAnnotation()) { - ((SingleMemberAnnotation) outer).setValue(lastValue); - } else { - throw new IllegalArgumentException("unexpected annotation type: " + outer); //$NON-NLS-1$ - } - } - - /** - * Manipulate the specified expression appropriately. - * If it is an array initializer, add the specified annotation to it. - * If it is not, replace the expression or convert it into an array - * initializer. - */ - private void modifyExpression(ASTNode node, ExpressionProvider expProvider, Annotation inner) { - Expression value = expProvider.getExpression(node); - if (value.getNodeType() == ASTNode.ARRAY_INITIALIZER) { - // ignore the other entries in the array initializer(?) - they may not be matching Annotations... - List expressions = this.expressions((ArrayInitializer) value); - if (this.index >= expressions.size()) { - this.addInnerToExpressions(inner, expressions); - } else { - expressions.set(this.index, inner); - } - } else { - if (this.index == 0) { - // replace whatever was there before - expProvider.setExpression(node, inner); - } else { - // convert to an array - ArrayInitializer ai = inner.getAST().newArrayInitializer(); - List expressions = this.expressions(ai); - expressions.add((Expression) ASTNode.copySubtree(value.getAST(), value)); - this.addInnerToExpressions(inner, expressions); - expProvider.setExpression(node, ai); - } - } - } - - @SuppressWarnings("unchecked") - protected List expressions(ArrayInitializer ai) { - return ai.expressions(); - } - - - // ********** expression providers ********** - - /** - * define interface that allows us to "re-use" the code in - * #modifyExpression(ASTNode, ExpressionProvider, Annotation) - */ - private interface ExpressionProvider { - Expression getExpression(ASTNode node); - void setExpression(ASTNode node, Expression expression); - } - - private static final ExpressionProvider MEMBER_VALUE_PAIR_EXPRESSION_PROVIDER = new ExpressionProvider() { - public Expression getExpression(ASTNode node) { - return ((MemberValuePair) node).getValue(); - } - public void setExpression(ASTNode node, Expression expression) { - ((MemberValuePair) node).setValue(expression); - } - @Override - public String toString() { - return "MemberValuePairExpressionProvider"; //$NON-NLS-1$ - } - }; - - private static final ExpressionProvider SINGLE_MEMBER_ANNOTATION_EXPRESSION_PROVIDER = new ExpressionProvider() { - public Expression getExpression(ASTNode node) { - return ((SingleMemberAnnotation) node).getValue(); - } - public void setExpression(ASTNode node, Expression expression) { - ((SingleMemberAnnotation) node).setValue(expression); - } - @Override - public String toString() { - return "SingleMemberAnnotationExpressionProvider"; //$NON-NLS-1$ - } - }; - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NullAnnotationEditFormatter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NullAnnotationEditFormatter.java deleted file mode 100644 index 284e9379b4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NullAnnotationEditFormatter.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.TextEdit; - -public final class NullAnnotationEditFormatter - implements AnnotationEditFormatter -{ - - private static final NullAnnotationEditFormatter INSTANCE = new NullAnnotationEditFormatter(); - - /** - * Return the singleton. - */ - public static AnnotationEditFormatter instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private NullAnnotationEditFormatter() { - super(); - } - - public void format(IDocument doc, TextEdit editTree) throws MalformedTreeException, BadLocationException { - // no formatting - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NullDeclarationAnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NullDeclarationAnnotationAdapter.java deleted file mode 100644 index c9fe2d94e4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NullDeclarationAnnotationAdapter.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; - -/** - * Behaviorless implementation. - */ -public final class NullDeclarationAnnotationAdapter - implements IndexedDeclarationAnnotationAdapter -{ - - // singleton - private static final NullDeclarationAnnotationAdapter INSTANCE = new NullDeclarationAnnotationAdapter(); - - /** - * Return the singleton. - */ - public static IndexedDeclarationAnnotationAdapter instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private NullDeclarationAnnotationAdapter() { - super(); - } - - - // ********** DeclarationAnnotationAdapter implementation ********** - - public Annotation getAnnotation(ModifiedDeclaration declaration) { - return null; - } - - public MarkerAnnotation newMarkerAnnotation(ModifiedDeclaration declaration) { - return null; - } - - public SingleMemberAnnotation newSingleMemberAnnotation(ModifiedDeclaration declaration) { - return null; - } - - public NormalAnnotation newNormalAnnotation(ModifiedDeclaration declaration) { - return null; - } - - public void removeAnnotation(ModifiedDeclaration declaration) { - // do nothing - } - - public ASTNode getAstNode(ModifiedDeclaration declaration) { - return declaration.getDeclaration(); - } - - - // ********** IndexedDeclarationAnnotationAdapter implementation ********** - - public int getIndex() { - return -1; - } - - public void moveAnnotation(int newIndex, ModifiedDeclaration declaration) { - // do nothing - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NullDeclarationAnnotationElementAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NullDeclarationAnnotationElementAdapter.java deleted file mode 100644 index dd3e616a2d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NullDeclarationAnnotationElementAdapter.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; - -/** - * Behaviorless implementation. - */ -public class NullDeclarationAnnotationElementAdapter - implements DeclarationAnnotationElementAdapter -{ - - // singleton - @SuppressWarnings("rawtypes") - private static final DeclarationAnnotationElementAdapter INSTANCE - = new NullDeclarationAnnotationElementAdapter(); - - /** - * Return the singleton. - */ - @SuppressWarnings("unchecked") - public static DeclarationAnnotationElementAdapter instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private NullDeclarationAnnotationElementAdapter() { - super(); - } - - public T getValue(ModifiedDeclaration declaration) { - return null; - } - - public void setValue(T value, ModifiedDeclaration declaration) { - // do nothing - } - - public ASTNode getAstNode(ModifiedDeclaration declaration) { - return declaration.getDeclaration(); - } - - public Expression getExpression(ModifiedDeclaration declaration) { - return null; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NullExpressionConverter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NullExpressionConverter.java deleted file mode 100644 index 8245a74a34..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NullExpressionConverter.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * No conversion. - */ -public final class NullExpressionConverter - implements ExpressionConverter -{ - - // singleton - private static final ExpressionConverter INSTANCE = new NullExpressionConverter(); - - /** - * Return the singleton. - */ - public static ExpressionConverter instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private NullExpressionConverter() { - super(); - } - - public Expression convert(Expression expression, AST ast) { - return expression; - } - - public Expression convert(Expression expression) { - return expression; - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NumberIntegerExpressionConverter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NumberIntegerExpressionConverter.java deleted file mode 100644 index 775d2d705a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/NumberIntegerExpressionConverter.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.NumberLiteral; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; - -/** - * Convert a number literal to/from an Integer - * (e.g. 5). - */ -public final class NumberIntegerExpressionConverter - extends AbstractExpressionConverter -{ - private static final ExpressionConverter INSTANCE = new NumberIntegerExpressionConverter(); - - /** - * Return the singleton. - */ - public static ExpressionConverter instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private NumberIntegerExpressionConverter() { - super(); - } - - @Override - protected NumberLiteral convertObject(Integer integer, AST ast) { - return ast.newNumberLiteral(integer.toString()); - } - - @Override - protected Integer convertExpression(Expression expression) { - Object value = expression.resolveConstantExpressionValue(); - return (value instanceof Integer) ? ((Integer) value) : null; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/PrimitiveTypeStringExpressionConverter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/PrimitiveTypeStringExpressionConverter.java deleted file mode 100644 index 7b17501e51..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/PrimitiveTypeStringExpressionConverter.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.PrimitiveType; -import org.eclipse.jdt.core.dom.TypeLiteral; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; - -/** - * Convert a type literal to/from a string representation of a primitive type - * (e.g. "int"). - */ -public final class PrimitiveTypeStringExpressionConverter - extends AbstractExpressionConverter -{ - private static final ExpressionConverter INSTANCE = new PrimitiveTypeStringExpressionConverter(); - - /** - * Return the singleton. - */ - public static ExpressionConverter instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private PrimitiveTypeStringExpressionConverter() { - super(); - } - - @Override - protected TypeLiteral convertObject(String string, AST ast) { - org.eclipse.jdt.core.dom.Type type = ast.newPrimitiveType(PrimitiveType.toCode(string)); - TypeLiteral typeLiteral = ast.newTypeLiteral(); - typeLiteral.setType(type); - return typeLiteral; - } - - @Override - protected String convertExpression(Expression expression) { - if (expression.getNodeType() == ASTNode.TYPE_LITERAL) { - org.eclipse.jdt.core.dom.Type type = ((TypeLiteral) expression).getType(); - if (type.getNodeType() == ASTNode.PRIMITIVE_TYPE) { - return ((PrimitiveType) type).getPrimitiveTypeCode().toString(); - } - } - return null; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ShortCircuitAnnotationElementAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ShortCircuitAnnotationElementAdapter.java deleted file mode 100644 index c9ee5748c8..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ShortCircuitAnnotationElementAdapter.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * Wrap another annotation element adapter and short-circuit the - * #setValue method if the value has not changed. - */ -public class ShortCircuitAnnotationElementAdapter - implements AnnotationElementAdapter -{ - /** the wrapped adapter */ - private final AnnotationElementAdapter adapter; - - - // ********** constructor ********** - - public ShortCircuitAnnotationElementAdapter(AnnotatedElement annotatedElement, DeclarationAnnotationElementAdapter daea) { - this(new AnnotatedElementAnnotationElementAdapter(annotatedElement, daea)); - } - - public ShortCircuitAnnotationElementAdapter(AnnotationElementAdapter adapter) { - super(); - this.adapter = adapter; - } - - - // ********** AnnotationElementAdapter implementation ********** - - public T getValue() { - return this.adapter.getValue(); - } - - public T getValue(CompilationUnit astRoot) { - return this.adapter.getValue(astRoot); - } - - public void setValue(T value) { - this.setValue(this.adapter.getValue(), value); - } - - public Expression getExpression(CompilationUnit astRoot) { - return this.adapter.getExpression(astRoot); - } - - public ASTNode getAstNode(CompilationUnit astRoot) { - return this.adapter.getAstNode(astRoot); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.adapter); - } - - - // ********** internal methods ********** - - /** - * set the adapter's value to the specified new value if it - * is different from the specified old value - */ - protected void setValue(T oldValue, T newValue) { - if (oldValue == null) { - if (newValue == null) { // null => null - // do nothing - } else { // null => object - this.adapter.setValue(newValue); - } - } else { - if (newValue == null) { // object => null - this.adapter.setValue(null); - } else { // object => object - if (this.valuesAreEqual(oldValue, newValue)) { - // do nothing - } else { - this.adapter.setValue(newValue); - } - } - } - } - - /** - * both values are non-null when this method is called - */ - protected boolean valuesAreEqual(T oldValue, T newValue) { - return newValue.equals(oldValue); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ShortCircuitArrayAnnotationElementAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ShortCircuitArrayAnnotationElementAdapter.java deleted file mode 100644 index 0676bc2840..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/ShortCircuitArrayAnnotationElementAdapter.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.util.Arrays; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; - -/** - * Wrap another annotation element adapter and short-circuit the - * #setValue method if the value has not changed. Overrides #valuesAreEqual() - * to check equality on arrays - */ -public class ShortCircuitArrayAnnotationElementAdapter - extends ShortCircuitAnnotationElementAdapter -{ - // ********** constructor ********** - - public ShortCircuitArrayAnnotationElementAdapter(AnnotatedElement annotatedElement, DeclarationAnnotationElementAdapter daea) { - super(annotatedElement, daea); - } - - public ShortCircuitArrayAnnotationElementAdapter(AnnotationElementAdapter adapter) { - super(adapter); - } - - - // ********** AnnotationElementAdapter implementation ********** - - @Override - protected boolean valuesAreEqual(T[] oldValue, T[] newValue) { - return Arrays.equals(newValue, oldValue); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/SimpleDeclarationAnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/SimpleDeclarationAnnotationAdapter.java deleted file mode 100644 index 195dc197ec..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/SimpleDeclarationAnnotationAdapter.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; - -/** - * Manipulate an annotation with a specific name, e.g. - *
- *     @Foo
- *     private int id;
- * 
- * - * NB: - * If the declaration contains more than one annotation with the same - * name, the adapter will correspond to the first annotation with the specified - * name. (Also note that the compiler will not allow a declaration to be - * modified by multiple annotations with the same name, i.e. of the same type; - * so if there *are* multiple annotations of the same type, there are bigger - * problems to worry about than which annotation the adapter manipulates.) - */ -public class SimpleDeclarationAnnotationAdapter extends AbstractDeclarationAnnotationAdapter { - - - // ********** constructors ********** - - public SimpleDeclarationAnnotationAdapter(String annotationName) { - super(annotationName); - } - - - // ********** DeclarationAnnotationAdapter implementation ********** - - public Annotation getAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(this.getAnnotationName()); - } - - public void removeAnnotation(ModifiedDeclaration declaration) { - declaration.removeAnnotationNamed(this.getAnnotationName()); - } - - @Override - protected void addAnnotation(ModifiedDeclaration declaration, Annotation annotation) { - declaration.replaceAnnotationNamed(this.getAnnotationName(), annotation); - } - - public ASTNode getAstNode(ModifiedDeclaration declaration) { - // if the annotation is missing, return the declaration - Annotation annotation = this.getAnnotation(declaration); - return (annotation != null) ? annotation : declaration.getDeclaration(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/SimpleTypeStringExpressionConverter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/SimpleTypeStringExpressionConverter.java deleted file mode 100644 index 156dc5fa73..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/SimpleTypeStringExpressionConverter.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.Name; -import org.eclipse.jdt.core.dom.SimpleType; -import org.eclipse.jdt.core.dom.TypeLiteral; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; - -/** - * Convert a type literal to/from a string representation of a simple type - * (e.g. "java.lang.Object"). - */ -public final class SimpleTypeStringExpressionConverter - extends AbstractExpressionConverter -{ - private static final ExpressionConverter INSTANCE = new SimpleTypeStringExpressionConverter(); - - /** - * Return the singleton. - */ - public static ExpressionConverter instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private SimpleTypeStringExpressionConverter() { - super(); - } - - @Override - protected TypeLiteral convertObject(String string, AST ast) { - Name name = ast.newName(string); - org.eclipse.jdt.core.dom.Type type = ast.newSimpleType(name); - TypeLiteral typeLiteral = ast.newTypeLiteral(); - typeLiteral.setType(type); - return typeLiteral; - } - - @Override - protected String convertExpression(Expression expression) { - if (expression.getNodeType() == ASTNode.TYPE_LITERAL) { - org.eclipse.jdt.core.dom.Type type = ((TypeLiteral) expression).getType(); - if (type.getNodeType() == ASTNode.SIMPLE_TYPE) { - return ((SimpleType) type).getName().getFullyQualifiedName(); - } - } - return null; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/StringArrayExpressionConverter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/StringArrayExpressionConverter.java deleted file mode 100644 index 9ee7e60872..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/StringArrayExpressionConverter.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import java.util.List; -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.ArrayInitializer; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * Convert an array initializer to/from an array of strings (e.g. {"text0", "text1"}). - * - * Do NOT use this class for converting array initializers in annotation elements. - * Java5 has a bit of syntactic sugar that allows a single-element array - * initializer to not have curly braces. This converter will return null if it encounters - * anything other than an array initializer. - * - * Invalid entries in the array initializer will result in null elements in the - * resulting string array. This allows clients to manipulate elements at - * the appropriate index. - */ -public class StringArrayExpressionConverter - extends AbstractExpressionConverter -{ - private final ExpressionConverter elementConverter; - private final boolean removeArrayInitializerWhenEmpty; - - - /** - * The default behavior is to remove the array initializer if it is empty. - */ - public StringArrayExpressionConverter(ExpressionConverter elementConverter) { - this(elementConverter, true); - } - - public StringArrayExpressionConverter(ExpressionConverter elementConverter, boolean removeArrayInitializerWhenEmpty) { - super(); - this.elementConverter = elementConverter; - this.removeArrayInitializerWhenEmpty = removeArrayInitializerWhenEmpty; - } - - /* - * this method is 'public' so it can be called by - * AnnotationStringArrayExpressionConverter - */ - @Override - public ArrayInitializer convertObject(String[] strings, AST ast) { - if ((strings.length == 0) && this.removeArrayInitializerWhenEmpty) { - return null; - } - ArrayInitializer arrayInitializer = ast.newArrayInitializer(); - List expressions = this.expressions(arrayInitializer); - for (String string : strings) { - expressions.add(this.elementConverter.convert(string, ast)); - } - return arrayInitializer; - } - - @SuppressWarnings("unchecked") - private List expressions(ArrayInitializer arrayInitializer) { - return arrayInitializer.expressions(); - } - - /* - * this method is 'public' so it can be called by - * AnnotationStringArrayExpressionConverter - */ - @Override - public String[] convertNull() { - return StringTools.EMPTY_STRING_ARRAY; - } - - @Override - protected String[] convertExpression(Expression expression) { - return (expression.getNodeType() == ASTNode.ARRAY_INITIALIZER) ? - this.convertArrayInitializer((ArrayInitializer) expression) : - StringTools.EMPTY_STRING_ARRAY; - } - - /* - * this method is 'public' so it can be called by - * AnnotationStringArrayExpressionConverter - */ - public String[] convertArrayInitializer(ArrayInitializer arrayInitializer) { - List expressions = this.expressions(arrayInitializer); - int len = expressions.size(); - String[] strings = new String[len]; - for (int i = len; i-- > 0; ) { - strings[i] = this.elementConverter.convert(expressions.get(i)); - } - return strings; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/StringExpressionConverter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/StringExpressionConverter.java deleted file mode 100644 index f0e88b5331..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/StringExpressionConverter.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.StringLiteral; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; - -/** - * Convert a string literal to/from a string (e.g. "text"). - */ -public final class StringExpressionConverter - extends AbstractExpressionConverter -{ - private static final ExpressionConverter INSTANCE = new StringExpressionConverter(); - - /** - * Return the singleton. - */ - public static ExpressionConverter instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private StringExpressionConverter() { - super(); - } - - @Override - protected StringLiteral convertObject(String string, AST ast) { - StringLiteral stringLiteral = ast.newStringLiteral(); - stringLiteral.setLiteralValue(string); - return stringLiteral; - } - - @Override - protected String convertExpression(Expression expression) { - Object value = expression.resolveConstantExpressionValue(); - return (value instanceof String) ? (String) value : null; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/TypeStringExpressionConverter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/TypeStringExpressionConverter.java deleted file mode 100644 index 3ed1b74189..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/jdt/TypeStringExpressionConverter.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.jdt; - -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.PrimitiveType; -import org.eclipse.jdt.core.dom.TypeLiteral; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; - -/** - * Convert a type literal to/from a string representation of a - * simple type (e.g. "java.lang.Object") or primitive type (e.g. "int"). - */ -public final class TypeStringExpressionConverter - extends AbstractExpressionConverter -{ - private static final ExpressionConverter INSTANCE = new TypeStringExpressionConverter(); - - /** - * Return the singleton. - */ - public static ExpressionConverter instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private TypeStringExpressionConverter() { - super(); - } - - @Override - protected TypeLiteral convertObject(String string, AST ast) { - if (PrimitiveType.toCode(string) != null) { - return (TypeLiteral) PrimitiveTypeStringExpressionConverter.instance().convert(string, ast); - } - return (TypeLiteral) SimpleTypeStringExpressionConverter.instance().convert(string, ast); - } - - @Override - protected String convertExpression(Expression expression) { - String name = SimpleTypeStringExpressionConverter.instance().convert(expression); - return name != null ? name : PrimitiveTypeStringExpressionConverter.instance().convert(expression); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/BooleanTranslator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/BooleanTranslator.java deleted file mode 100644 index 7f2825c1a3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/BooleanTranslator.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public class BooleanTranslator - extends Translator -{ - public BooleanTranslator(String domPathAndNames, EStructuralFeature structuralFeature) { - super(domPathAndNames, structuralFeature, BOOLEAN_FEATURE | BOOLEAN_LOWERCASE); - } - - public BooleanTranslator(String domPathAndNames, EStructuralFeature structuralFeature, int style) { - super(domPathAndNames, structuralFeature, BOOLEAN_FEATURE | BOOLEAN_LOWERCASE | style); - } - - @Override - public Object convertStringToValue(String string, EObject owner) { - return Boolean.valueOf(string); - } - - @Override - public String convertValueToString(Object value, EObject owner) { - return ((Boolean) value).toString(); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/EmptyTagBooleanTranslator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/EmptyTagBooleanTranslator.java deleted file mode 100644 index 1d94705cca..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/EmptyTagBooleanTranslator.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * This translator is to be used for empty xml tags that correspond - * to a boolean attribute in the emf model. - * cascade-persist is an example from the orm.xsd: - * - * - * - * ==> cascadePersist == true - * - * vs. - * - * - * ==> cascadePersist == false - * - */ -public class EmptyTagBooleanTranslator - extends Translator -{ - public EmptyTagBooleanTranslator(String domPathAndNames, EStructuralFeature structuralFeature) { - this(domPathAndNames, structuralFeature, NO_STYLE); - } - - public EmptyTagBooleanTranslator(String domPathAndNames, EStructuralFeature structuralFeature, int style) { - super(domPathAndNames, structuralFeature, style | EMPTY_TAG | BOOLEAN_FEATURE); - } - - @Override - public Object getMOFValue(EObject mofObject) { - // I am overriding this method. This is so the tag will be removed when - // the value is false. - // I'm not sure if this is a bug in the ecore or maybe in the translators, - // but I really don't think that we should have to depend on the boolean - // being "unset" to remove the tag. - Boolean value = (Boolean) super.getMOFValue(mofObject); - return (value == null) ? null : value.booleanValue() ? value : null; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/EnumeratedValueTranslator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/EnumeratedValueTranslator.java deleted file mode 100644 index fc74b4a730..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/EnumeratedValueTranslator.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.translators; - -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -public abstract class EnumeratedValueTranslator - extends Translator -{ - public EnumeratedValueTranslator(String domPathAndNames, EStructuralFeature structuralFeature) { - super(domPathAndNames, structuralFeature); - } - - public EnumeratedValueTranslator(String domPathAndNames, EStructuralFeature structuralFeature, int style) { - super(domPathAndNames, structuralFeature, style); - } - - - protected abstract Iterable getEnumeratedObjectValues(); - - @Override - public Object convertStringToValue(String string, EObject owner) { - for (Object each : getEnumeratedObjectValues()) { - if (each.toString().equals(string)) { - return each; - } - } - return null; - } - - @Override - public String convertValueToString(Object value, EObject owner) { - return value.toString(); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/SimpleRootTranslator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/SimpleRootTranslator.java deleted file mode 100644 index 08c20d3b1d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/SimpleRootTranslator.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.translators; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.wst.common.internal.emf.resource.RootTranslator; -import org.eclipse.wst.common.internal.emf.resource.Translator; - -/** - * Root translator that contains a list of child translators and no special - * behavior. - */ -public class SimpleRootTranslator - extends RootTranslator -{ - protected Translator[] children; - - public SimpleRootTranslator(String domPathAndNames, EClass eClass) { - super(domPathAndNames, eClass); - } - - public SimpleRootTranslator(String domPathAndNames, EClass eClass, Translator[] children) { - super(domPathAndNames, eClass); - this.children = children; - } - - /** - * Widen method access to 'public'. - */ - @Override - public Translator[] getChildren() { - return this.children; - } - - protected Translator[] getChildren_() { - return (this.children == null) ? EMPTY_TRANSLATOR_ARRAY : this.children; - } - protected static final Translator[] EMPTY_TRANSLATOR_ARRAY = new Translator[0]; - - /** - * Set the translator's children. - * Return the translator. - */ - public void setChildren(Translator[] children) { - this.children = children; - } - - /** - * Add the specified translator to the translator's list of children. - * Return the translator for method chaining. - */ - public SimpleRootTranslator addChild(Translator translator) { - this.children = ArrayTools.add(this.getChildren_(), translator); - return this; - } - - /** - * Add the specified translators to the translator's list of children. - * Return the translator for method chaining. - */ - public SimpleRootTranslator addChildren(Translator[] translators) { - this.children = ArrayTools.addAll(this.getChildren_(), translators); - return this; - } - - /** - * Remove the specified translator from the translator's list of children. - * Return the translator for method chaining. - */ - public SimpleRootTranslator removeChild(Translator translator) { - this.children = ArrayTools.remove(this.children, translator); - return this; - } - - /** - * Remove the specified translators from the translator's list of children. - * Return the translator for method chaining. - */ - public SimpleRootTranslator removeChildren(Translator[] translators) { - this.children = ArrayTools.removeAll(this.children, (Object[]) translators); - return this; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/SimpleTranslator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/SimpleTranslator.java deleted file mode 100644 index 20db025e8a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/internal/utility/translators/SimpleTranslator.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.internal.utility.translators; - -import org.eclipse.emf.ecore.EClass; -import org.eclipse.emf.ecore.EStructuralFeature; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.wst.common.internal.emf.resource.Translator; -import org.eclipse.wst.common.internal.emf.resource.TranslatorPath; - -/** - * Translator that contains a list of child translators and no special - * behavior. - */ -public class SimpleTranslator - extends Translator -{ - protected Translator[] children; - - - // ********** constructors ********** - - public SimpleTranslator(String domPathAndNames, EClass eClass) { - super(domPathAndNames, eClass); - } - - public SimpleTranslator(String domPathAndNames, EStructuralFeature eStructuralFeature) { - super(domPathAndNames, eStructuralFeature); - } - - public SimpleTranslator(String domPathAndNames, EStructuralFeature eStructuralFeature, Translator[] children) { - super(domPathAndNames, eStructuralFeature); - this.children = children; - } - - public SimpleTranslator(String domPathAndNames, EStructuralFeature eStructuralFeature, EClass eClass) { - super(domPathAndNames, eStructuralFeature, eClass); - } - - public SimpleTranslator(String domPathAndNames, EStructuralFeature eStructuralFeature, EClass eClass, Translator[] children) { - super(domPathAndNames, eStructuralFeature, eClass); - this.children = children; - } - - public SimpleTranslator(String domPathAndNames, EStructuralFeature eStructuralFeature, TranslatorPath translatorPath) { - super(domPathAndNames, eStructuralFeature, translatorPath); - } - - public SimpleTranslator(String domPathAndNames, EStructuralFeature eStructuralFeature, TranslatorPath[] translatorPaths) { - super(domPathAndNames, eStructuralFeature, translatorPaths); - } - - public SimpleTranslator(String domPathAndNames, EStructuralFeature eStructuralFeature, int style) { - super(domPathAndNames, eStructuralFeature, style); - } - - public SimpleTranslator(String domPathAndNames, EStructuralFeature aFeature, int style, EClass eClass, Translator[] children) { - this(domPathAndNames, aFeature, style); - setEMFClass(eClass); - this.children = children; - } - - public SimpleTranslator(String domPathAndNames, EStructuralFeature eStructuralFeature, int style, Translator[] children) { - super(domPathAndNames, eStructuralFeature, style); - this.children = children; - } - - - // ********** children ********** - - /** - * Widen method access to 'public'. - */ - @Override - public Translator[] getChildren() { - return this.children; - } - - protected Translator[] getChildren_() { - return (this.children == null) ? EMPTY_TRANSLATOR_ARRAY : this.children; - } - protected static final Translator[] EMPTY_TRANSLATOR_ARRAY = new Translator[0]; - - /** - * Set the translator's children. - * Return the translator. - */ - public void setChildren(Translator[] children) { - this.children = children; - } - - /** - * Add the specified translator to the translator's list of children. - * Return the translator for method chaining. - */ - public SimpleTranslator addChild(Translator translator) { - this.children = ArrayTools.add(this.getChildren_(), translator); - return this; - } - - /** - * Add the specified translators to the translator's list of children. - * Return the translator for method chaining. - */ - public SimpleTranslator addChildren(Translator[] translators) { - this.children = ArrayTools.addAll(this.getChildren_(), translators); - return this; - } - - /** - * Remove the specified translator from the translator's list of children. - * Return the translator for method chaining. - */ - public SimpleTranslator removeChild(Translator translator) { - this.children = ArrayTools.remove(this.children, translator); - return this; - } - - /** - * Remove the specified translators from the translator's list of children. - * Return the translator for method chaining. - */ - public SimpleTranslator removeChildren(Translator[] translators) { - this.children = ArrayTools.removeAll(this.children, (Object[]) translators); - return this; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/libprov/JptLibraryProviderInstallOperationConfig.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/libprov/JptLibraryProviderInstallOperationConfig.java deleted file mode 100644 index 3e524487f7..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/libprov/JptLibraryProviderInstallOperationConfig.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.libprov; - -import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JptLibraryProviderInstallOperationConfig { - - IFacetedProjectBase getFacetedProject(); - - ILibraryProvider getLibraryProvider(); - - IProjectFacetVersion getProjectFacetVersion(); -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/libval/LibraryValidator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/libval/LibraryValidator.java deleted file mode 100644 index af15c438ce..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/libval/LibraryValidator.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.libval; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig; - -/** - * Interface for extender-supplied library validators. - * Each library validator must have a zero-arg constructor. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface LibraryValidator { - - IStatus validate(JptLibraryProviderInstallOperationConfig config); -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/ResourceLocator.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/ResourceLocator.java deleted file mode 100644 index 491608c147..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/resource/ResourceLocator.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.core.resource; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; - -/** - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface ResourceLocator { - - /** - * Return whether the given container is an acceptable (non-java) resource - * location for the given project - */ - boolean acceptResourceLocation(IProject project, IContainer container); - - /** - * Return the default location in which to create new (non-java) resources - */ - IContainer getDefaultResourceLocation(IProject project); - - /** - * Return the workspace relative absolute resource path best represented by the given - * runtime path for the given project - */ - IPath getResourcePath(IProject project, IPath runtimePath); - - /** - * Return the runtime path best represented by the given workspace relative absolute - * resource path for the given project - */ - IPath getRuntimePath(IProject project, IPath resourcePath); -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/AbstractTextRange.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/AbstractTextRange.java deleted file mode 100644 index 3fc13147fa..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/AbstractTextRange.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility; - -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * Partial implementation of text range. - * - * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public abstract class AbstractTextRange - implements TextRange -{ - - public boolean includes(int index) { - return (this.getOffset() <= index) && (index < this.end()); - } - - public boolean touches(int index) { - return this.includes(index) || (index == this.end()); - } - - /** - * The end offset is "exclusive", i.e. the element at the end offset - * is not included in the range. - */ - protected int end() { - return this.getOffset() + this.getLength(); - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if ( ! (o instanceof TextRange)) { - return false; - } - TextRange r = (TextRange) o; - return (r.getOffset() == this.getOffset()) - && (r.getLength() == this.getLength()); - } - - @Override - public int hashCode() { - return this.getOffset() ^ this.getLength(); - } - - @Override - public String toString() { - String start = String.valueOf(this.getOffset()); - String end = String.valueOf(this.end()); - return StringTools.buildToStringFor(this, start + ", " + end); //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/BodySourceWriter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/BodySourceWriter.java deleted file mode 100644 index 9aabeebdd5..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/BodySourceWriter.java +++ /dev/null @@ -1,303 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility; - -import java.io.Serializable; -import java.io.StringWriter; -import java.util.Comparator; -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.TreeSet; - -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.IndentingPrintWriter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; - -import com.ibm.icu.text.Collator; - -/** - * Extend {@link IndentingPrintWriter} with some methods that facilitate - * building class source code. - */ -@SuppressWarnings("nls") -public class BodySourceWriter - extends IndentingPrintWriter -{ - protected final String packageName; - protected final String className; - // key = short class name; value = import package - protected final HashMap imports = new HashMap(); - - public BodySourceWriter(String packageName, String className) { - super(new StringWriter(2000)); - this.packageName = packageName; - this.className = className; - } - - public String getSource() { - return this.out.toString(); - } - - public int getLength() { - return ((StringWriter) this.out).getBuffer().length(); - } - - protected void printVisibility(String visibilityModifier) { - if (visibilityModifier.length() != 0) { - this.print(visibilityModifier); - this.print(' '); - } - } - - public void printAnnotation(String annotationName) { - this.print('@'); - this.printTypeDeclaration(annotationName); - } - - public void printTypeDeclaration(String typeDeclaration) { - this.print(this.buildImportedTypeDeclaration(typeDeclaration)); - } - - protected void printField(String fieldName, String typeDeclaration, String visibility) { - this.printVisibility(visibility); - this.printTypeDeclaration(typeDeclaration); - this.print(' '); - this.print(fieldName); - this.print(';'); - this.println(); - this.println(); - } - - protected void printParameterizedField(String fieldName, String typeDeclaration, String parameterTypeDeclaration, String visibility) { - this.printVisibility(visibility); - this.printTypeDeclaration(typeDeclaration); - this.print('<'); - this.printTypeDeclaration(parameterTypeDeclaration); - this.print('>'); - this.print(' '); - this.print(fieldName); - this.print(';'); - this.println(); - this.println(); - } - - /** - * Convert the specified string to a String Literal and print it, - * adding the surrounding double-quotes and escaping characters - * as necessary. - */ - public void printStringLiteral(String string) { - StringTools.convertToJavaStringLiteralOn(string, this); - } - - - // ********** imports ********** - - // ***** writing - /** - * Return the specified class's "imported" name. - * The class declaration must be of the form: - * "int" - * "int[]" (not "[I") - * "java.lang.Object" - * "java.lang.Object[]" (not "[Ljava.lang.Object;") - * "java.util.Map.Entry" (not "java.util.Map$Entry") - * "java.util.Map.Entry[][]" (not "[[Ljava.util.Map$Entry;") - * - * To really do this right, we would need to gather all the types from - * the "unamed" (default) package that were referenced in the - * compilation unit beforehand. *Any* collisions with one of these - * types would have to be fully qualified (whether it was from - * 'java.lang' or the same package as the current compilation unit). - * In other words, if we have any types from the "unnamed" package, - * results are unpredictable.... - */ - protected String buildImportedTypeDeclaration(String typeDeclaration) { - if (this.typeDeclarationIsMemberClass(typeDeclaration)) { - // no need for an import, just return the partially-qualified name - return this.buildMemberClassTypeDeclaration(typeDeclaration); - } - int last = typeDeclaration.lastIndexOf('.'); - String currentPackageName = (last == -1) ? "" : typeDeclaration.substring(0, last); - String shortTypeDeclaration = typeDeclaration.substring(last + 1); - String shortElementTypeName = shortTypeDeclaration; - while (shortElementTypeName.endsWith("[]")) { - shortElementTypeName = shortElementTypeName.substring(0, shortElementTypeName.length() - 2); - } - ImportPackage prev = this.imports.get(shortElementTypeName); - if (prev == null) { - // this is the first class with this short element type name - this.imports.put(shortElementTypeName, new ImportPackage(currentPackageName)); - return shortTypeDeclaration; - } - if (prev.packageName.equals(currentPackageName)) { - // this element type has already been imported - return shortTypeDeclaration; - } - if (currentPackageName.equals(this.packageName) && - prev.packageName.equals("java.lang")) { - // we force the 'java.lang' class to be explicitly imported - prev.collision = true; - } - // another class with the same short element type name has been - // previously imported, so this one must be used fully-qualified - return typeDeclaration; - } - - /** - * e.g. "foo.bar.Employee.PK" will return true - */ - protected boolean typeDeclarationIsMemberClass(String typeDeclaration) { - return (typeDeclaration.length() > this.className.length()) - && typeDeclaration.startsWith(this.className) - && (typeDeclaration.charAt(this.className.length()) == '.'); - } - - /** - * e.g. "foo.bar.Employee.PK" will return "Employee.PK" - * this prevents collisions with other imported classes (e.g. "joo.jar.PK") - */ - protected String buildMemberClassTypeDeclaration(String typeDeclaration) { - int index = this.packageName.length(); - if (index != 0) { - index++; // bump past the '.' - } - return typeDeclaration.substring(index); - } - - // ***** reading - public Iterable getImports() { - return this.getSortedRequiredImports(); - } - - /** - * transform our map entries to class names - */ - protected Iterable getSortedRequiredImports() { - return new TransformationIterable, String>(this.getSortedRequiredImportEntries(), this.buildImportEntriesTransformer()); - } - - protected Transformer, String> buildImportEntriesTransformer() { - return IMPORT_ENTRIES_TRANSFORMER; - } - - protected static final Transformer, String> IMPORT_ENTRIES_TRANSFORMER = new ImportEntriesTransformer(); - - protected static class ImportEntriesTransformer - implements Transformer, String> - { - public String transform(Entry importEntry) { - String pkg = importEntry.getValue().packageName; - String type = importEntry.getKey(); - StringBuilder sb = new StringBuilder(pkg.length() + 1 + type.length()); - sb.append(pkg); - sb.append('.'); - sb.append(type); - return sb.toString(); - } - } - - /** - * sort by package first, then class (*not* by fully-qualified class name) - */ - protected Iterable> getSortedRequiredImportEntries() { - TreeSet> sortedEntries = new TreeSet>(this.buildImportEntriesComparator()); - CollectionTools.addAll(sortedEntries, this.getRequiredImportEntries()); - return sortedEntries; - } - - protected Comparator> buildImportEntriesComparator() { - return IMPORT_ENTRIES_COMPARATOR; - } - - protected static final Comparator> IMPORT_ENTRIES_COMPARATOR = new ImportEntriesComparator(); - - protected static class ImportEntriesComparator - implements Comparator>, Serializable - { - public int compare(Map.Entry e1, Map.Entry e2) { - Collator collator = Collator.getInstance(); - int pkg = collator.compare(e1.getValue().packageName, e2.getValue().packageName); - return (pkg == 0) ? collator.compare(e1.getKey(), e2.getKey()) : pkg; - } - } - - /** - * strip off any non-required imports (e.g. "java.lang.Object') - */ - protected Iterable> getRequiredImportEntries() { - return new FilteringIterable>(this.imports.entrySet(), this.buildRequiredImportEntriesFilter()); - } - - protected Filter> buildRequiredImportEntriesFilter() { - return new RequiredImportEntriesFilter(); - } - - protected class RequiredImportEntriesFilter - implements Filter> - { - public boolean accept(Map.Entry importEntry) { - return this.packageMustBeImported(importEntry.getValue()); - } - - protected boolean packageMustBeImported(ImportPackage importPackage) { - String pkg = importPackage.packageName; - if (pkg.equals("")) { - // cannot import a type from the "unnamed" package - return false; - } - if (pkg.equals("java.lang")) { - // we must import from 'java.lang' if we also have a class in the same package - return importPackage.collision; - } - if (pkg.equals(BodySourceWriter.this.packageName)) { - // we never need to import a class from the same package - return false; - } - return true; - } - } - - /** - * We need a 'collision' flag for when we encounter a class from - * 'java.lang' followed by a class from the current compilation unit's - * package. We will need to include the explicit import of the - * 'java.lang' class and all the references to the other class will - * have to be fully-qualified. - * - * If the classes are encountered in the opposite order (i.e. the class - * from the current compilation unit's package followed by the class - * from 'java.lang'), we do *not* need to import the first class while - * all the references to the 'java.lang' class will be fully-qualified. - * - * Unfortunately, we still have a problem: if we reference a class from - * 'java.lang' and there is a conflicting class from the current - * compilation unit's package (but that class is *not* revealed to us - * here), the simple name will be resolved to the non-'java.lang' class. - * Unless we simply force an import of *all* 'java.lang' classes.... :-( - * - * This shouldn't happen very often. :-) - */ - protected static class ImportPackage { - protected final String packageName; - protected boolean collision = false; - - protected ImportPackage(String packageName) { - super(); - this.packageName = packageName; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/TextRange.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/TextRange.java deleted file mode 100644 index 419c98d0c6..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/TextRange.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility; - -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -/** - * A text range defines the offset into, length of, and line of a piece - * of text. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - * - * @version 2.0 - * @since 2.0 - */ -public interface TextRange { - - /** - * Returns the offset of the text. - * - * @return the offset of the text - */ - int getOffset(); - - /** - * Return the length of the text. - */ - int getLength(); - - /** - * Return whether the range includes the character at the specified index. - */ - boolean includes(int index); - - /** - * Return whether the range touches an insertion cursor at the - * specified index. - */ - boolean touches(int index); - - /** - * Return the line number of the text. - */ - int getLineNumber(); - - /** - * Return true if the offsets and lengths are the same. - */ - boolean equals(Object obj); - - /** - * Return a hash code that corresponds to the #equals() contract. - */ - int hashCode(); - - - /** - * Empty implementation of text range. - */ - final class Empty implements TextRange { - public static final TextRange INSTANCE = new Empty(); - public static TextRange instance() { - return INSTANCE; - } - // ensure single instance - private Empty() { - super(); - } - public int getLineNumber() { - return IMessage.LINENO_UNSET; - } - public int getOffset() { - return IMessage.OFFSET_UNSET; - } - public int getLength() { - return IMessage.OFFSET_UNSET; - } - public boolean includes(int index) { - return false; - } - public boolean touches(int index) { - return index == 0; // ??? - } - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if ( ! (o instanceof TextRange)) { - return false; - } - TextRange r = (TextRange) o; - return (r.getOffset() == 0) - && (r.getLength() == 0); - } - @Override - public int hashCode() { - return 0; - } - @Override - public String toString() { - return "TextRange.Empty"; //$NON-NLS-1$ - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AbstractType.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AbstractType.java deleted file mode 100644 index 8be7a07d97..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AbstractType.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.AbstractTypeDeclaration; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.ITypeBinding; - -/** - * AbstractType: just some covariant overrides. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface AbstractType extends Member { - - /** - * Covariant override. - */ - ITypeBinding getBinding(CompilationUnit astRoot); - - /** - * Covariant override. - */ - AbstractTypeDeclaration getBodyDeclaration(CompilationUnit astRoot); -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotatedElement.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotatedElement.java deleted file mode 100644 index 8ce99cf49c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotatedElement.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IBinding; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Dali manipulates annotations on elements (packages, types, fields, and methods). - * This interface simplifies those manipulations. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface AnnotatedElement { - - String getName(); - - /** - * Return the annotated element's body declaration from the specified AST. - * This can be null if the annotated element is no longer present in the AST - * because the source has been changed in another thread. - */ - ASTNode getBodyDeclaration(CompilationUnit astRoot); - - /** - * Return the annotated element's binding from the specified AST. - */ - IBinding getBinding(CompilationUnit astRoot); - - /** - * Return the annotated element's "modified" declaration from the specified AST. - */ - ModifiedDeclaration getModifiedDeclaration(CompilationUnit astRoot); - - /** - * Return the annotated element's "modified" declaration from a newly-generated AST. - */ - ModifiedDeclaration getModifiedDeclaration(); - - /** - * Return the annotated element's name text range from the specified AST. - */ - TextRange getNameTextRange(CompilationUnit astRoot); - - /** - * Edit the annotated element's declaration using the specified editor. - */ - void edit(Editor editor); - - - // ********** "editor" interface ********** - - /** - * This interface defines a callback that is invoked when the annotated element's - * compilation unit/AST is in a state to be manipulated. - */ - public interface Editor { - - /** - * Edit the specified declaration. Any changes made to the declaration - * will be captured and applied to the annotated element's compilation unit. - */ - void edit(ModifiedDeclaration declaration); - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotatedPackage.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotatedPackage.java deleted file mode 100644 index c0a3ccc098..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotatedPackage.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Red Hat, Inc. - * Distributed under license by Red Hat, Inc. All rights reserved. - * This program is made available under the terms of the - * Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributor: - * Red Hat, Inc. - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IPackageBinding; -import org.eclipse.jdt.core.dom.PackageDeclaration; - -/** - * @author Dmitry Geraskov - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface AnnotatedPackage extends AnnotatedElement { - - /** - * Covariant override. - */ - IPackageBinding getBinding(CompilationUnit astRoot); - - /** - * Covariant override. - */ - PackageDeclaration getBodyDeclaration(CompilationUnit astRoot); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationAdapter.java deleted file mode 100644 index b0b04c4938..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationAdapter.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.CompilationUnit; - -/** - * Adapt a Java annotation with a simple-to-use interface. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface AnnotationAdapter { - - /** - * Given the specified compilation unit, return the value of the - * adapter's annotation. - * @see #getAnnotation() - */ - Annotation getAnnotation(CompilationUnit astRoot); - - /** - * Build a new marker annotation, replacing the original annotation if present. - */ - void newMarkerAnnotation(); - - /** - * Build a new single member annotation, replacing the original annotation if present. - */ - void newSingleMemberAnnotation(); - - /** - * Build a new normal annotation, replacing the original annotation if present. - */ - void newNormalAnnotation(); - - /** - * Remove the annotation. - */ - void removeAnnotation(); - - /** - * Return the AST node corresponding to the annotation. - * If the annotation is missing, return the annotation's parent node. - * @see #getAstNode() - */ - ASTNode getAstNode(CompilationUnit astRoot); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationEditFormatter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationEditFormatter.java deleted file mode 100644 index 77b3ac0682..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationEditFormatter.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jface.text.BadLocationException; -import org.eclipse.jface.text.IDocument; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.TextEdit; - -/** - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface AnnotationEditFormatter { - - /** - * Review the specified edits and format the specified document as needed. - */ - void format(IDocument doc, TextEdit editTree) throws MalformedTreeException, BadLocationException; - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationElementAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationElementAdapter.java deleted file mode 100644 index 3fc6e95434..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/AnnotationElementAdapter.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.Expression; - -/** - * Adapt a Java annotation element with a simple-to-use interface. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface AnnotationElementAdapter { - - /** - * Return the value of the adapter's annotation element. - * Return null if the element is not present. - * If the compilation unit is available, #value(CompilationUnit) - * might be more performant. - * @see #getValue(org.eclipse.jdt.core.dom.CompilationUnit) - */ - T getValue(); - - /** - * Given the specified compilation unit, return the value of the - * adapter's annotation element. - * Return null if the element is not present. - * @see #getValue() - */ - T getValue(CompilationUnit astRoot); - - /** - * Set the value of the adapter's annotation element. - * Setting the value of the element to null will cause - * the element to be removed from its annotation. - */ - void setValue(T value); - - /** - * Given the specified compilation unit, return the expression value of the - * adapter's annotation element. - * Return null if the element is not present. - * @see #getExpression() - */ - Expression getExpression(CompilationUnit astRoot); - - /** - * Return the AST node corresponding to the element. - * If the element is missing, return the annotation's node. - * @see #getAstNode() - */ - ASTNode getAstNode(CompilationUnit astRoot); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Attribute.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Attribute.java deleted file mode 100644 index cce19d5abc..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Attribute.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.ITypeBinding; - -/** - * Attributes are either represented by fields ('foo') or properties/method - * pairs ('getFoo()'/'setFoo()'). - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface Attribute extends Member { - - /** - * Return the attribute's name, as opposed to the member's name - * (e.g. "getFoo()" returns "foo"). - */ - String getAttributeName(); - - /** - * Return the type binding for the attribute's declared type, - * as opposed to its declaring type. - */ - ITypeBinding getTypeBinding(CompilationUnit astRoot); - - /** - * Return whether the attribute is a field. - */ - boolean isField(); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/DeclarationAnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/DeclarationAnnotationAdapter.java deleted file mode 100644 index 9f93a16ffd..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/DeclarationAnnotationAdapter.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; - -/** - * Provide clients with a pluggable way to manipulate an - * annotation modifying a "declaration". - * - * TODO specify how multiple annotations with the same name are to be handled - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface DeclarationAnnotationAdapter { - - /** - * Given the specified declaration, return the annotation. - */ - Annotation getAnnotation(ModifiedDeclaration declaration); - - /** - * Given the specified declaration, modify it with - * a new marker annotation, replacing the original annotation if present. - * Return the new annotation. - */ - MarkerAnnotation newMarkerAnnotation(ModifiedDeclaration declaration); - - /** - * Given the specified declaration, modify it with - * a new single member annotation, replacing the original annotation if present. - * Return the new annotation. - */ - SingleMemberAnnotation newSingleMemberAnnotation(ModifiedDeclaration declaration); - - /** - * Given the specified declaration, modify it with - * a new normal annotation, replacing the original annotation if present. - * Return the new annotation. - */ - NormalAnnotation newNormalAnnotation(ModifiedDeclaration declaration); - - /** - * Remove the annotation from the specified declaration. - */ - void removeAnnotation(ModifiedDeclaration declaration); - - /** - * Given the specified declaration, return the AST node - * corresponding to the annotation. - * If the annotation is missing, return its parent node. - */ - ASTNode getAstNode(ModifiedDeclaration declaration); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/DeclarationAnnotationElementAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/DeclarationAnnotationElementAdapter.java deleted file mode 100644 index 1d5e4ff250..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/DeclarationAnnotationElementAdapter.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Expression; - -/** - * Provide clients with a pluggable way to manipulate an - * annotation element modifying a "declaration". - * T is the type of the object to be passed to and returned by the adapter. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface DeclarationAnnotationElementAdapter { - - /** - * Reduce the number of NLS warnings. - */ - String VALUE = "value"; //$NON-NLS-1$ - - /** - * Given the specified declaration, return the value of the - * annotation element. Return null or an empty array - * if the element is not present. - */ - T getValue(ModifiedDeclaration declaration); - - /** - * Given the specified declaration, set the value of the - * annotation element. Setting the value of the element - * to null will cause the element to be removed from its - * annotation. - */ - void setValue(T value, ModifiedDeclaration declaration); - - /** - * Given the specified declaration, return the element's value expression. - * Return null if the element is not present. - */ - Expression getExpression(ModifiedDeclaration declaration); - - /** - * Given the specified declaration, return the AST node - * corresponding to the element's value. - * If the element is missing, return the annotation's node. - */ - ASTNode getAstNode(ModifiedDeclaration declaration); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Enum.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Enum.java deleted file mode 100644 index da690b148b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Enum.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumConstantDeclaration; -import org.eclipse.jdt.core.dom.EnumDeclaration; - -/** - * Enum: some covariant overrides plus enumConstants - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface Enum extends AbstractType { - - /** - * Covariant override. - */ - EnumDeclaration getBodyDeclaration(CompilationUnit astRoot); - - /** - * Return the enum's constants - */ - EnumConstantDeclaration[] getEnumConstants(CompilationUnit astRoot); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/EnumConstant.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/EnumConstant.java deleted file mode 100644 index 88693d415a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/EnumConstant.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumConstantDeclaration; -import org.eclipse.jdt.core.dom.IVariableBinding; - -/** - * Enum constants are part of Enums - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface EnumConstant extends Member { - - String getName(); - - /** - * Covariant override. - */ - IVariableBinding getBinding(CompilationUnit astRoot); - - /** - * Covariant override. - */ - EnumConstantDeclaration getBodyDeclaration(CompilationUnit astRoot); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/ExpressionConverter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/ExpressionConverter.java deleted file mode 100644 index c5d7ed10e2..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/ExpressionConverter.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.Expression; - -/** - * Define the protocol for converting an AST expression back and forth - * from an arbitrary type (e.g. StringLiteral <=> String). - * T is the type of the object to be converted to and from an expression. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface ExpressionConverter { - - /** - * Convert the specified object to an - * expression that is owned by the specified AST. - * The type of the object is determined by the - * contract specified by the client. - */ - Expression convert(T object, AST ast); - - /** - * Convert the specified expression to an object of some - * pre-determined type. - */ - T convert(Expression expression); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/FieldAttribute.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/FieldAttribute.java deleted file mode 100644 index 4e014ac72b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/FieldAttribute.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.FieldDeclaration; -import org.eclipse.jdt.core.dom.IVariableBinding; - -/** - * Field attribute: just some covariant overrides. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface FieldAttribute extends Attribute { - - /** - * Covariant override. - */ - IVariableBinding getBinding(CompilationUnit astRoot); - - /** - * Covariant override. - */ - FieldDeclaration getBodyDeclaration(CompilationUnit astRoot); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedAnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedAnnotationAdapter.java deleted file mode 100644 index a55e9cbc77..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedAnnotationAdapter.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - - -/** - * Adapt an indexed Java annotation with a simple-to-use interface. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface IndexedAnnotationAdapter extends AnnotationAdapter { - - /** - * Return the the index at which the annotation is situated. - */ - int getIndex(); - - /** - * Move the annotation to the specified index, leaving its original - * position cleared out. - */ - void moveAnnotation(int newIndex); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedDeclarationAnnotationAdapter.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedDeclarationAnnotationAdapter.java deleted file mode 100644 index 438f21e1e6..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/IndexedDeclarationAnnotationAdapter.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - - -/** - * Allow clients to manipulate an annotation within an array of annotations. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface IndexedDeclarationAnnotationAdapter extends DeclarationAnnotationAdapter { - - /** - * Return the the index at which the annotation is situated. - */ - int getIndex(); - - /** - * Move the annotation to the specified index, leaving its original - * position cleared out. - */ - void moveAnnotation(int newIndex, ModifiedDeclaration declaration); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Member.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Member.java deleted file mode 100644 index 8b9f398ea0..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Member.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.CompilationUnit; - -/** - * Dali manipulates annotations on members (types, fields, and methods). - * This interface simplifies those manipulations. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface Member extends AnnotatedElement { - - /** - * Return whether the member is persistable. - */ - boolean isPersistable(CompilationUnit astRoot); - - /** - * Return whether the member matches the specified member - * and occurrence. - */ - boolean matches(String memberName, int occurrence); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/MethodAttribute.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/MethodAttribute.java deleted file mode 100644 index 2eca93d773..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/MethodAttribute.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IMethodBinding; -import org.eclipse.jdt.core.dom.MethodDeclaration; -import org.eclipse.jpt.common.utility.MethodSignature; - -/** - * Method attribute: just some covariant overrides. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface MethodAttribute extends Attribute { - - /** - * Covariant override. - */ - IMethodBinding getBinding(CompilationUnit astRoot); - - /** - * Covariant override. - */ - MethodDeclaration getBodyDeclaration(CompilationUnit astRoot); - - /** - * This method must be used instead of Member#matches(String, int). - */ - boolean matches(MethodSignature signature, int occurrence); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/ModifiedDeclaration.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/ModifiedDeclaration.java deleted file mode 100644 index 331e5391a0..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/ModifiedDeclaration.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; - -/** - * Define a wrapper that provides a common protocol for all the various AST - * declarations that have modifiers (i.e. there are a number of AST node - * classes that implement the method #modifiers(), but they do not implement - * a common interface): - * BodyDeclaration - * SingleVariableDeclaration - * VariableDeclarationExpression - * VariableDeclarationStatement - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface ModifiedDeclaration { - - /** - * Return the "declaration" AST node. - */ - ASTNode getDeclaration(); - - /** - * Return the "declaration" AST. - */ - AST getAst(); - - /** - * Return the *first* annotation with the specified name. - * Return null if the declaration has no such annotation. - */ - Annotation getAnnotationNamed(String annotationName); - - /** - * Remove the *first* annotation with the specified name from the declaration. - */ - void removeAnnotationNamed(String annotationName); - - /** - * Replace the specified old annotation with the specified new annotation. - * If there is no annotation with the specified name, simply add the new - * annotation to the declaration's modifiers. - */ - void replaceAnnotationNamed(String oldAnnotationName, Annotation newAnnotation); - - /** - * Add the specified import to the declaration's compilation unit. - * Return whether the appropriate import was added to or already present in - * the declaration's compilation unit (i.e. the specified class can be - * subsequently referenced using a "short" name). - * Also return true if an import was unnecessary (i.e. the specified class - * is part of the "default" package). - * This does not support adding a "wildcard" import (e.g. "java.util.*"). - */ - boolean addImport(String className); - - /** - * Add the specified static import to the declaration's compilation unit. - * Return whether the appropriate import was added to or already present in - * the declaration's compilation unit (i.e. the specified constant can be - * subsequently referenced using a "short" name). - * Also return true if an import was unnecessary (i.e. the specified enum - * is part of the "default" package). - * This does not support adding a "wildcard" import (e.g. "java.lang.annotation.ElementType.*"). - */ - boolean addStaticImport(String enumConstantName); - - /** - * Add the specified import to the declaration's compilation unit. - * Return whether the appropriate import was added to or already present in - * the declaration's compilation unit (i.e. the specified name can be - * subsequently referenced using a "short" name). - * Also return true if an import was unnecessary (i.e. the specified class - * or enum is part of the "default" package). - * This does not support adding a "wildcard" import (e.g. "java.util.*"). - */ - boolean addImport(String importName, boolean static_); - - /** - * Return whether the specified annotation has the specified - * (fully-qualified) name within the declaration's context; i.e. attempt - * to resolve the annotation's name (using imports etc.) and return - * whether it matches the specified name. - */ - boolean annotationIsNamed(Annotation annotation, String name); - -} diff --git a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Type.java b/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Type.java deleted file mode 100644 index 5a3a6a5a98..0000000000 --- a/common/plugins/org.eclipse.jpt.common.core/src/org/eclipse/jpt/common/core/utility/jdt/Type.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.utility.jdt; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumDeclaration; -import org.eclipse.jdt.core.dom.FieldDeclaration; -import org.eclipse.jdt.core.dom.MethodDeclaration; -import org.eclipse.jdt.core.dom.TypeDeclaration; - -/** - * Type: nestedTypes, nestedEnums, fields, and methods. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * This interface is not intended to be implemented by clients. - */ -public interface Type extends AbstractType { - - /** - * Covariant override. - */ - TypeDeclaration getBodyDeclaration(CompilationUnit astRoot); - - /** - * Return the type's nested types (does not include annotations or enums). - */ - TypeDeclaration[] getTypes(CompilationUnit astRoot); - - /** - * Return the type's nested enums. - */ - EnumDeclaration[] getEnums(CompilationUnit astRoot); - - /** - * Return the type's fields. - */ - FieldDeclaration[] getFields(CompilationUnit astRoot); - - /** - * Return the type's methods. - */ - MethodDeclaration[] getMethods(CompilationUnit astRoot); - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/.classpath b/common/plugins/org.eclipse.jpt.common.ui/.classpath deleted file mode 100644 index 5ee7c76127..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/.classpath +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/common/plugins/org.eclipse.jpt.common.ui/.project b/common/plugins/org.eclipse.jpt.common.ui/.project deleted file mode 100644 index 7fde966914..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.jpt.common.ui - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/common/plugins/org.eclipse.jpt.common.ui/.settings/org.eclipse.jdt.core.prefs b/common/plugins/org.eclipse.jpt.common.ui/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 6e2f42326d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Mon Jan 24 09:48:38 EST 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -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/common/plugins/org.eclipse.jpt.common.ui/META-INF/MANIFEST.MF b/common/plugins/org.eclipse.jpt.common.ui/META-INF/MANIFEST.MF deleted file mode 100644 index f95b3a9ec2..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,36 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.common.ui;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Activator: org.eclipse.jpt.common.ui.JptCommonUiPlugin -Bundle-ActivationPolicy: lazy -Bundle-ClassPath: . -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)", - org.eclipse.draw2d;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jdt.ui;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jface;bundle-version="[3.7.0,4.0.0)", - org.eclipse.jface.text;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jpt.common.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)", - org.eclipse.jst.common.project.facet.core;bundle-version="[1.3.100,2.0.0)", - org.eclipse.jst.common.project.facet.ui;bundle-version="[1.3.100,2.0.0)", - org.eclipse.ui.navigator;bundle-version="[3.3.100,4.0.0)", - org.eclipse.ui.views.properties.tabbed;bundle-version="[3.4.0,4.0.0)", - org.eclipse.wst.common.project.facet.ui;bundle-version="[1.3.0,2.0.0)" -Export-Package: org.eclipse.jpt.common.ui, - org.eclipse.jpt.common.ui.internal;x-friends:="org.eclipse.jpt.jaxb.ui,org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.ui.internal.jface;x-friends:="org.eclipse.jpt.jaxb.ui,org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.ui.internal.listeners;x-friends:="org.eclipse.jpt.jaxb.ui,org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.ui.internal.properties;x-friends:="org.eclipse.jpt.jaxb.ui,org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.ui.internal.swt;x-friends:="org.eclipse.jpt.jaxb.ui,org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.ui.internal.util;x-friends:="org.eclipse.jpt.jaxb.ui,org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.ui.internal.utility;x-friends:="org.eclipse.jpt.jaxb.ui,org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.ui.internal.utility.swt;x-friends:="org.eclipse.jpt.jaxb.ui,org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.ui.internal.widgets;x-friends:="org.eclipse.jpt.jaxb.ui,org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.ui.jface -Import-Package: com.ibm.icu.text;version="4.0.1" diff --git a/common/plugins/org.eclipse.jpt.common.ui/about.html b/common/plugins/org.eclipse.jpt.common.ui/about.html deleted file mode 100644 index be534ba44f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/about.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

May 02, 2008

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- - - diff --git a/common/plugins/org.eclipse.jpt.common.ui/build.properties b/common/plugins/org.eclipse.jpt.common.ui/build.properties deleted file mode 100644 index 87792f2ef5..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/build.properties +++ /dev/null @@ -1,19 +0,0 @@ -################################################################################ -# Copyright (c) 2011 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ -javacSource = 1.5 -javacTarget = 1.5 -source.. = src/,\ - property_files/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - about.html,\ - plugin.properties -jars.compile.order = . diff --git a/common/plugins/org.eclipse.jpt.common.ui/plugin.properties b/common/plugins/org.eclipse.jpt.common.ui/plugin.properties deleted file mode 100644 index 4caf90e773..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/plugin.properties +++ /dev/null @@ -1,23 +0,0 @@ -############################################################################### -# Copyright (c) 2011 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### - -# ==================================================================== -# 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= Dali Java Persistence Tools - Common UI -providerName=Eclipse Web Tools Platform diff --git a/common/plugins/org.eclipse.jpt.common.ui/property_files/jpt_common_ui.properties b/common/plugins/org.eclipse.jpt.common.ui/property_files/jpt_common_ui.properties deleted file mode 100644 index aee4769cae..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/property_files/jpt_common_ui.properties +++ /dev/null @@ -1,28 +0,0 @@ -################################################################################ -# Copyright (c) 2011 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ - -Boolean_True=True -Boolean_False=False - -NoneSelected= -DefaultEmpty=Default -DefaultWithOneParam=Default ({0}) - -AddRemovePane_AddButtonText=Add... -AddRemovePane_RemoveButtonText=Remove -ChooserPane_browseButton=Browse... -ClassChooserPane_dialogMessage=&Enter type name prefix or pattern (*, ?, or camel case): -ClassChooserPane_dialogTitle=Class Selection -PackageChooserPane_dialogTitle=Package Selection -PackageChooserPane_dialogMessage=&Enter package name prefix or pattern (* = any string, ? = any character): -EnumComboViewer_default=Default () -EnumComboViewer_defaultWithDefault=Default ({0}) -NewNameStateObject_nameMustBeSpecified=A name must be specified. -NewNameStateObject_nameAlreadyExists=A query with this name already exists. diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/JptCommonUiPlugin.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/JptCommonUiPlugin.java deleted file mode 100644 index c249775143..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/JptCommonUiPlugin.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.ui.plugin.AbstractUIPlugin; - -public class JptCommonUiPlugin - extends AbstractUIPlugin -{ - - // ********** constants ********** - - /** - * The plug-in identifier of JPT Common UI support (value {@value}). - */ - public static final String PLUGIN_ID = "org.eclipse.jpt.common.ui"; //$NON-NLS-1$ - public static final String PLUGIN_ID_ = PLUGIN_ID + '.'; - - // ********** singleton ********** - - private static JptCommonUiPlugin INSTANCE; - - /** - * Returns the singleton JPT UI plug-in. - */ - public static JptCommonUiPlugin instance() { - return INSTANCE; - } - - - // ********** logging ********** - - public static void log(IStatus status) { - INSTANCE.getLog().log(status); - } - - public static void log(String msg) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null)); - } - - public static void log(Throwable throwable) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable)); - } - - - // ********** construction ********** - - public JptCommonUiPlugin() { - super(); - if (INSTANCE != null) { - throw new IllegalStateException(); - } - INSTANCE = this; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/WidgetFactory.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/WidgetFactory.java deleted file mode 100644 index 4a7154aeee..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/WidgetFactory.java +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui; - -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.DateTime; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Spinner; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.forms.widgets.FormText; -import org.eclipse.ui.forms.widgets.Hyperlink; -import org.eclipse.ui.forms.widgets.Section; - -/** - * A widget factory is responsible for creating an SWT widget based on the right - * style. Some style shows the widgets differently, for instance, the flat style - * shows the widgets with less borders. - *

- * Provisional API: This interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public interface WidgetFactory { - - /** - * Creates a new regular button. - * - * @param parent The parent container - * @param text The button's text - * @return A new Button - */ - Button createButton(Composite parent, String text); - - /** - * Creates a new non-editable custom Combo. - * - * @deprecated - * @param parent The parent container - * @return A new CCombo - */ - @Deprecated - CCombo createCCombo(Composite parent); - - /** - * Creates a new check box button. - * - * @param parent The parent container - * @param text The button's text - * @return A new Button - */ - Button createCheckBox(Composite parent, String text); - - /** - * Creates a new non-editable Combo. - * - * @param parent The parent container - * @return A new Combo - */ - Combo createCombo(Composite parent); - - /** - * Creates a new container. - * - * @param parent The parent container - * @return A new Composite - */ - Composite createComposite(Composite parent); - - /** - * Creates a new DateTime. - * - * @param container The parent container - * @param style The style is to tell the type of widget - * (SWT.DATE or SWT.TIME or SWT.CALENDAR) - * @return A new DateTime - */ - DateTime createDateTime(Composite parent, int style); - - /** - * Creates a new editable custom CCombo. - * - * @deprecated - * @param parent The parent container - * @return A new CCombo - */ - @Deprecated - CCombo createEditableCCombo(Composite parent); - - /** - * Creates a new editable Combo. - * - * @param parent The parent container - * @return A new Combo - */ - Combo createEditableCombo(Composite parent); - - /** - * Creates a new titled pane (group box). - * - * @param parent The parent container - * @param title The group pane's title - * @return A new Group - */ - Group createGroup(Composite parent, String title); - - /** - * Creates a new label that is shown as a hyperlink. - * - * @param parent The parent container - * @param text The label's text - * @return A new Hyperlink - */ - Hyperlink createHyperlink(Composite parent, String text); - - /** - * Creates a new label. - * - * @param container The parent container - * @param labelText The label's text - * @return A new Label - */ - Label createLabel(Composite container, String labelText); - - /** - * Creates a new list. - * - * @param container The parent container - * @param style The style is usually to tell what type of selection - * (SWT.MULTI or SWT.SINGLE) - * @return A new Label - */ - List createList(Composite container, int style); - - /** - * Creates a new label that can be wrapped on multiple lines. - * - * @param container The parent container - * @param labelText The label's text - * @return A new FormText - */ - FormText createMultiLineLabel(Composite container, String labelText); - - /** - * Creates a new editable text area. - * - * @param parent The parent container - * @param parent The number of lines the text area should display - * @return A new Text - */ - Text createMultiLineText(Composite parent); - - /** - * Creates a new editable text field that handles password. - * - * @param container The parent container - * @return A new Text - */ - Text createPasswordText(Composite container); - - /** - * Creates a new push button (toggle between selected and unselected). - * - * @param parent The parent container - * @param text The button's text - * @return A new Button - */ - Button createPushButton(Composite parent, String text); - - /** - * Creates a new radio button. - * - * @param parent The parent container - * @param text The button's text - * @return A new Button - */ - Button createRadioButton(Composite parent, String text); - - /** - * Creates a new section, which is a collapsable pane with a title bar. - * - * @param parent The parent container - * @param style The style of the title bar, which can be - * ExpandableComposite.TWISTIE and - * ExpandableComposite.TITLE_BAR - * @return A new Section - */ - Section createSection(Composite parent, int style); - - /** - * Creates a new spinner. - * - * @param parent The parent container - * @return A new Spinner - */ - Spinner createSpinner(Composite parent); - - /** - * Creates a new table. - * - * @param container The parent container - * @param style The style to apply to the table - * @return A new Table - */ - Table createTable(Composite parent, int style); - - /** - * Creates a new editable text field. - * - * @param container The parent container - * @return A new Text - */ - Text createText(Composite parent); - - /** - * Creates a new tri-state check box. - * - * @param parent The parent container - * @param text The button's text - * @return A new Button that has 3 selection states - */ - Button createTriStateCheckBox(Composite parent, String text); -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/JptCommonUiMessages.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/JptCommonUiMessages.java deleted file mode 100644 index 31a1080af3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/JptCommonUiMessages.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * Localized messages used by Dali UI. - * - * @version 3.0 - * @since 1.0 - */ -public class JptCommonUiMessages { - - - public static String Boolean_True; - public static String Boolean_False; - - public static String DefaultEmpty; - public static String DefaultWithOneParam; - public static String NoneSelected; - - public static String AddRemovePane_AddButtonText; - public static String AddRemovePane_RemoveButtonText; - - public static String ChooserPane_browseButton; - public static String ClassChooserPane_dialogMessage; - public static String ClassChooserPane_dialogTitle; - public static String PackageChooserPane_dialogMessage; - public static String PackageChooserPane_dialogTitle; - public static String EnumComboViewer_default; - public static String EnumComboViewer_defaultWithDefault; - public static String NewNameStateObject_nameAlreadyExists; - public static String NewNameStateObject_nameMustBeSpecified; - - private static final String BUNDLE_NAME = "jpt_common_ui"; //$NON-NLS-1$ - private static final Class BUNDLE_CLASS = JptCommonUiMessages.class; - static { - NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS); - } - - private JptCommonUiMessages() { - throw new UnsupportedOperationException(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/Tracing.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/Tracing.java deleted file mode 100644 index 7826015d18..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/Tracing.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.jpt.common.ui.JptCommonUiPlugin; - -/** - * This tracing class manages to convert the string value into boolean values or - * integer values that are associated with the tracing debug flags. Those flags - * are specified in the .options file. The supported keys are defined here as - * constants for quick reference. - * - * @version 2.0 - * @since 2.0 - */ -@SuppressWarnings("nls") -public final class Tracing -{ - /** - * A constant used to retrieve the value associated with "/debug". - */ - public static final String DEBUG = "/debug"; - - /** - * A constant used to retrieve the value associated with "/debug/ui/db". - */ - public static final String UI_DB = "/debug/ui/db"; - - /** - * A constant used to retrieve the value associated with "/debug/ui/detailsView". - */ - public static final String UI_DETAILS_VIEW = "/debug/ui/detailsView"; - - /** - * A constant used to retrieve the value associated with "/debug/ui/layout". - */ - public static final String UI_LAYOUT = "/debug/ui/layout"; - - /** - * A constant used to retrieve the value associated with "/unit-tests". - */ - public static final String UNIT_TESTS = "/unit-tests"; - - /** - * Can't instantiate this Tracing class. - */ - private Tracing() - { - super(); - throw new UnsupportedOperationException("Tracing cannot be instantiated"); - } - - /** - * Retrieves the debug value associated with the given flag. The default - * value is false. - * - * @param flag The flag to retrieve the debug value, which should be - * contained in the .options file, the flag should start with "/" - * @return true if the given flag is active; false - * otherwise - */ - public static boolean booleanDebugOption(String flag) - { - return booleanDebugOption(flag, false); - } - - /** - * Retrieves the debug value associated with the given flag. - * - * @param flag The flag to retrieve the debug value, which should be - * contained in the .options file, the flag should start with "/" - * @param defaultValue The default value if the value associated with the - * given flag could not be found - * @return true if the given flag is active; false - * otherwise - */ - public static boolean booleanDebugOption(String flag, boolean defaultValue) - { - String string = Platform.getDebugOption(JptCommonUiPlugin.PLUGIN_ID + flag); - return (string == null) ? defaultValue : Boolean.parseBoolean(string.trim()); - } - - /** - * Retrieves the debug value associated with the given flag. The default value - * is 0. - * - * @param flag The flag to retrieve the debug value, which should be - * contained in the .options file, the flag should start with "/" - * @return The value associated with the given flag, or the given default - * value - */ - public static int intDebugOption(String flag) - { - return intDebugOption(flag, 0); - } - - /** - * Retrieves the debug value associated with the given flag. - * - * @param flag The flag to retrieve the debug value, which should be - * contained in the .options file, the flag should start with "/" - * @param defaultValue The default value if the value associated with the - * given flag could not be found - * @return The value associated with the given flag, or the given default - * value - */ - public static int intDebugOption(String flag, int defaultValue) - { - String string = Platform.getDebugOption(JptCommonUiPlugin.PLUGIN_ID + flag); - return (string == null) ? defaultValue : Integer.parseInt(string); - } - - /** - * Logs the given messages, appends it with this plug-in id. - * - * @param message The message to be logged - */ - public static void log(String message) - { - System.out.print("[" + JptCommonUiPlugin.PLUGIN_ID + "] "); - System.out.println(message); - } - - /** - * Retrieves the debug value associated with the given flag. The default value - * is an empty string. - * - * @param flag The flag to retrieve the debug value, which should be - * contained in the .options file, the flag should start with "/" - * @return The value associated with the given flag, or the given default - * value - */ - public static String stringDebugOption(String flag) - { - return stringDebugOption(flag, ""); - } - - /** - * Retrieves the debug value associated with the given flag. - * - * @param flag The flag to retrieve the debug value, which should be - * contained in the .options file, the flag should start with "/" - * @param defaultValue The default value if the value associated with the - * given flag could not be found - * @return The value associated with the given flag, or the given default - * value - */ - public static String stringDebugOption(String flag, String defaultValue) - { - String string = Platform.getDebugOption(JptCommonUiPlugin.PLUGIN_ID + flag); - return (string != null) ? string : defaultValue; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemLabelProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemLabelProvider.java deleted file mode 100644 index 88822ac13a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractItemLabelProvider.java +++ /dev/null @@ -1,224 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.jface; - -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.ItemLabelProvider; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.swt.graphics.Image; - -/** - * Implementation of {@link ItemLabelProvider} that provides updating - * label information for a Model object. - * - * The typical subclass will override the following methods: - * #buildImageModel() - * return a {@link PropertyValueModel} that represents the image for the - * represented model object - * #buildTextModel() - * return a {@link PropertyValueModel} that represents the text for the - * represented model object. - * #buildDescriptionModel() - * return a {@link PropertyValueModel} that represents the description for - * the represented model object - * - * Other methods may be overridden, but take care to preserve the logic provided - * by this class. - */ -public abstract class AbstractItemLabelProvider implements ItemLabelProvider -{ - private DelegatingContentAndLabelProvider labelProvider; - - private Model model; - - private PropertyValueModel imageModel; - - private PropertyValueModel textModel; - - private PropertyValueModel descriptionModel; - - private PropertyChangeListener labelChangeListener; - - - protected AbstractItemLabelProvider( - Model model, DelegatingContentAndLabelProvider labelProvider) { - this.model = model; - this.labelProvider = labelProvider; - this.labelChangeListener = buildLabelChangeListener(); - } - - - /** - * Construct a listener to update the viewer (through the label provider) - * if the text or image changes - */ - protected PropertyChangeListener buildLabelChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - labelProvider().updateLabel(model()); - } - }; - } - - /** - * Return the image value model - * (lazy and just-in-time initialized) - */ - protected synchronized PropertyValueModel imageModel() { - if (this.imageModel == null) { - this.imageModel = buildImageModel(); - engageImageModel(); - } - return this.imageModel; - } - - /** - * Construct an image model - */ - protected abstract PropertyValueModel buildImageModel(); - - /** - * Should only be overridden with a call to super.engageImageModel() before - * subclass logic - */ - protected void engageImageModel() { - this.imageModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.labelChangeListener); - } - - /** - * Should only be overridden with a call to super.disengageImageModel() after - * subclass logic - */ - protected void disengageImageModel() { - this.imageModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.labelChangeListener); - } - - /** - * Return the text value model - * (lazy and just-in-time initialized) - */ - protected synchronized PropertyValueModel textModel() { - if (this.textModel == null) { - this.textModel = buildTextModel(); - engageTextModel(); - } - return this.textModel; - } - - /** - * Construct a text value model - */ - protected abstract PropertyValueModel buildTextModel(); - - /** - * Should only be overridden with a call to super.engageTextModel() before - * subclass logic - */ - protected void engageTextModel() { - this.textModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.labelChangeListener); - } - - /** - * Should only be overridden with a call to super.disengageTextModel() after - * subclass logic - */ - protected void disengageTextModel() { - this.textModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.labelChangeListener); - } - - /** - * Return the description value model - * (lazy and just-in-time initialized) - */ - protected synchronized PropertyValueModel descriptionModel() { - if (this.descriptionModel == null) { - this.descriptionModel = buildDescriptionModel(); - engageDescriptionModel(); - } - return this.descriptionModel; - } - - /** - * Construct a description value model - */ - protected abstract PropertyValueModel buildDescriptionModel(); - - /** - * Should only be overridden with a call to super.engageDescriptionModel() before - * subclass logic - */ - protected void engageDescriptionModel() { - this.descriptionModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.labelChangeListener); - } - - /** - * Should only be overridden with a call to super.disengageDescriptionModel() after - * subclass logic - */ - protected void disengageDescriptionModel() { - this.descriptionModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.labelChangeListener); - } - - /** - * Return the model object represented by this item - */ - public Model model() { - return this.model; - } - - /** - * Return the label provider that delegates to this item - */ - public DelegatingContentAndLabelProvider labelProvider() { - return this.labelProvider; - } - - public Image getImage() { - return imageModel().getValue(); - } - - public String getText() { - return textModel().getValue(); - } - - public String getDescription() { - return descriptionModel().getValue(); - } - - public void dispose() { - disposeTextModel(); - disposeImageModel(); - disposeDescriptionModel(); - } - - protected synchronized void disposeTextModel() { - if (this.textModel != null) { - disengageTextModel(); - this.textModel = null; - } - } - - protected synchronized void disposeImageModel() { - if (this.imageModel != null) { - disengageImageModel(); - this.imageModel = null; - } - } - - protected synchronized void disposeDescriptionModel() { - if (this.descriptionModel != null) { - disengageDescriptionModel(); - this.descriptionModel = null; - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractTreeItemContentProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractTreeItemContentProvider.java deleted file mode 100644 index c5631b8d6a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/AbstractTreeItemContentProvider.java +++ /dev/null @@ -1,204 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.jface; - -import java.util.Iterator; - -import org.eclipse.jpt.common.ui.jface.TreeItemContentProvider; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.model.value.ListCollectionValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.NullCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyListValueModelAdapter; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * Implementation of {@link TreeItemContentProvider} that provides updating - * children information for a Model object. - * - * The typical subclass will override the following methods: - * #getParent() - * the default behavior for this method is to return null. there is no - * property value model for this as this should not be changing for a given - * node. all such changes will be provided by the parent side of the relationship. - * #buildChildrenModel() - * return a {@link ListValueModel} that represents the children for the represented - * model object. #buildChildrenModel(CollectionValueModel) and - * #buildChildrenModel(PropertyValueModel) are provided if the children are more - * easily represented as a collection or as a property (single child) - * the default behavior is to return a {@link NullListValueModel} - * - * Other methods may be overridden, but take care to preserve the logic provided - * by this class. - */ -public abstract class AbstractTreeItemContentProvider - implements TreeItemContentProvider -{ - private DelegatingTreeContentAndLabelProvider treeContentProvider; - - private Model model; - - private CollectionValueModel childrenModel; - - private CollectionChangeListener childrenListener; - - - protected AbstractTreeItemContentProvider( - Model model, DelegatingTreeContentAndLabelProvider treeContentProvider) { - this.model = model; - this.treeContentProvider = treeContentProvider; - this.childrenListener = buildChildrenListener(); - } - - /** - * Construct a listener to refresh the tree (through the tree content provider) - * if the children change - */ - protected CollectionChangeListener buildChildrenListener() { - return new CollectionChangeListener() { - - public void itemsAdded(CollectionAddEvent event) { - getTreeContentProvider().updateContent(getModel()); - } - - public void itemsRemoved(CollectionRemoveEvent event) { - getTreeContentProvider().updateContent(getModel()); - for (Object item : event.getItems()) { - getTreeContentProvider().dispose(item); - } - } - - public void collectionChanged(CollectionChangeEvent event) { - getTreeContentProvider().updateContent(getModel()); - // in the case of a list changed event, we don't have - // access to the removed objects, so we can't dispose them. - // keep a watch on this to see if this becomes a problem. - } - - public void collectionCleared(CollectionClearEvent event) { - getTreeContentProvider().updateContent(getModel()); - // in the case of a list cleared event, we don't have - // access to the removed objects, so we can't dispose them. - // keep a watch on this to see if this becomes a problem. - } - }; - } - - /** - * Return the children model - * (lazy and just-in-time initialized) - */ - protected synchronized Iterator childrenModel() { - if (this.childrenModel == null) { - this.childrenModel = buildChildrenModel(); - engageChildren(); - } - return this.childrenModel.iterator(); - } - - /** - * Construct a children model - */ - protected CollectionValueModel buildChildrenModel() { - return new NullCollectionValueModel(); - } - - /** - * Utility method that can be used if the children model is better represented - * as a collection. - * This wraps the children collection model and uses it internally as a list - * model. - */ - protected CollectionValueModel buildChildrenModel(ListValueModel lvm) { - return new ListCollectionValueModelAdapter(lvm); - } - - /** - * Utility method that can be used if the children model is better represented - * as a single value property. - * This wraps the children (child) property model and uses it internally as a list - * model. - */ - protected ListValueModel buildChildrenModel(PropertyValueModel lvm) { - return new PropertyListValueModelAdapter(lvm); - } - - /** - * Return the model object represented by this node - */ - public Model getModel() { - return this.model; - } - - /** - * Return the tree content provider that delegates to this node - */ - public DelegatingTreeContentAndLabelProvider getTreeContentProvider() { - return this.treeContentProvider; - } - - public Object getParent() { - return null; - } - - public Object[] getElements() { - return getChildren(); - } - - public Object[] getChildren() { - return ArrayTools.array(this.childrenModel()); - } - - /** - * Override with potentially more efficient logic - */ - public boolean hasChildren() { - return this.childrenModel().hasNext(); - } - - /** - * Should only be overridden with a call to super.dispose() - */ - public void dispose() { - for (Object child : getChildren()) { - getTreeContentProvider().dispose(child); - } - disposeChildrenModel(); - } - - /** - * Should only be overridden with a call to super.engageChildren() before - * subclass logic - */ - protected void engageChildren() { - this.childrenModel.addCollectionChangeListener(CollectionValueModel.VALUES, this.childrenListener); - } - - protected synchronized void disposeChildrenModel() { - if (this.childrenModel != null) { - this.disengageChildrenModel(); - this.childrenModel = null; - } - } - /** - * Should only be overridden with a call to super.disengageChildren() after - * subclass logic - */ - protected void disengageChildrenModel() { - this.childrenModel.removeCollectionChangeListener(CollectionValueModel.VALUES, this.childrenListener); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ArchiveFileViewerFilter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ArchiveFileViewerFilter.java deleted file mode 100644 index bbff5516fc..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ArchiveFileViewerFilter.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.jface; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jpt.common.ui.JptCommonUiPlugin; - -/** - * This filter will deny showing any file that are not JAR files or folders - * that don't contain any JAR files in its sub-hierarchy. - */ -public class ArchiveFileViewerFilter - extends ViewerFilter -{ - private static final String[] archiveExtensions= { "jar", "zip" }; //$NON-NLS-1$ //$NON-NLS-2$ - - - public ArchiveFileViewerFilter() { - super(); - } - - - @Override - public boolean select( - Viewer viewer, Object parentElement, Object element) { - if (element instanceof IFile) { - return isArchivePath(((IFile)element).getFullPath()); - } - else if (element instanceof IFolder) { - IFolder folder = (IFolder) element; - try { - for (IResource each : folder.members()) { - if (select(viewer, folder, each)) { - return true; - } - } - } - catch (CoreException ce) { - // just skip this one, then - JptCommonUiPlugin.log(ce); - } - } - return false; - } - - public static boolean isArchivePath(IPath path) { - String ext= path.getFileExtension(); - if (ext != null && ext.length() != 0) { - for (int i= 0; i < archiveExtensions.length; i++) { - if (ext.equalsIgnoreCase(archiveExtensions[i])) { - return true; - } - } - } - return false; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/DelegatingTreeContentAndLabelProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/DelegatingTreeContentAndLabelProvider.java deleted file mode 100644 index d5df216b6e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/DelegatingTreeContentAndLabelProvider.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.jface; - -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.ItemLabelProviderFactory; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProvider; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProviderFactory; - -/** - * Extension of {@link DelegatingContentAndLabelProvider} that provides an extension - * to provide tree content - */ -public class DelegatingTreeContentAndLabelProvider - extends DelegatingContentAndLabelProvider - implements ITreeContentProvider -{ - public DelegatingTreeContentAndLabelProvider( - TreeItemContentProviderFactory treeItemContentProviderFactory) { - super(treeItemContentProviderFactory); - } - - public DelegatingTreeContentAndLabelProvider( - TreeItemContentProviderFactory treeItemContentProviderFactory, - ItemLabelProviderFactory itemLabelProviderFactory) { - super(treeItemContentProviderFactory, itemLabelProviderFactory); - } - - - @Override - protected TreeItemContentProvider itemContentProvider(Object item) { - return (TreeItemContentProvider) super.itemContentProvider(item); - } - - public Object[] getChildren(Object parentElement) { - TreeItemContentProvider provider = itemContentProvider(parentElement); - return (provider == null) ? new Object[0] : provider.getChildren(); - } - - public Object getParent(Object element) { - TreeItemContentProvider provider = itemContentProvider(element); - return (provider == null) ? null : provider.getParent(); - } - - public boolean hasChildren(Object element) { - TreeItemContentProvider provider = itemContentProvider(element); - return (provider == null) ? false : provider.hasChildren(); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ImageImageDescriptor.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ImageImageDescriptor.java deleted file mode 100644 index e2079e0227..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/ImageImageDescriptor.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 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.common.ui.internal.jface; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; - -/** - * Image descriptor for an image. - */ -public class ImageImageDescriptor extends ImageDescriptor -{ - - private Image fImage; - - /** - * Constructor for ImagImageDescriptor. - */ - public ImageImageDescriptor(Image image) { - super(); - this.fImage = image; - } - - @Override - public boolean equals(Object obj) { - return (obj != null) && getClass().equals(obj.getClass()) && this.fImage.equals(((ImageImageDescriptor) obj).fImage); - } - - @Override - public ImageData getImageData() { - return this.fImage.getImageData(); - } - - @Override - public int hashCode() { - return this.fImage.hashCode(); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NullLabelProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NullLabelProvider.java deleted file mode 100644 index 1380b3dac6..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NullLabelProvider.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.jface; - -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.swt.graphics.Image; - -/** - * Null implementation of the ILabelProvider interface. - * Implemented as a singleton. - */ -public final class NullLabelProvider - implements ILabelProvider -{ - public static final NullLabelProvider INSTANCE = new NullLabelProvider(); - - public static ILabelProvider instance() { - return INSTANCE; - } - - /** - * Ensure a single instance. - */ - private NullLabelProvider() { - super(); - } - - public Image getImage(Object element) { - return null; - } - - public String getText(Object element) { - return null; - } - - public void addListener(ILabelProviderListener listener) { - // do nothing - } - - public void dispose() { - // do nothing - } - - public boolean isLabelProperty(Object element, String property) { - return false; - } - - public void removeListener(ILabelProviderListener listener) { - // do nothing - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NullTreeContentProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NullTreeContentProvider.java deleted file mode 100644 index f050ffa226..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/NullTreeContentProvider.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.jface; - -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.Viewer; - -/** - * Null implementation of the ILabelProvider interface. - * Implemented as a singleton. - */ -public final class NullTreeContentProvider - implements ITreeContentProvider -{ - private static final Object[] EMPTY_ARRAY = new Object[0]; - public static final NullTreeContentProvider INSTANCE = new NullTreeContentProvider(); - - public static ITreeContentProvider instance() { - return INSTANCE; - } - - /** - * Ensure a single instance. - */ - private NullTreeContentProvider() { - super(); - } - - public Object[] getChildren(Object parentElement) { - return EMPTY_ARRAY; - } - - public Object getParent(Object element) { - return null; - } - - public boolean hasChildren(Object element) { - return false; - } - - public Object[] getElements(Object inputElement) { - return EMPTY_ARRAY; - } - - public void dispose() { - // do nothing - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - // do nothing - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StructuredContentProviderAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StructuredContentProviderAdapter.java deleted file mode 100644 index ca953012ae..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/jface/StructuredContentProviderAdapter.java +++ /dev/null @@ -1,265 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.jface; - -import org.eclipse.jface.viewers.AbstractListViewer; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jpt.common.ui.internal.listeners.SWTListChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionListValueModelAdapter; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * This adapter can be used to keep an AbstractListViewer - * (e.g. a ListViewer or ComboViewer) in synch with a ListValueModel - * (or a CollectionValueModel). - */ -public class StructuredContentProviderAdapter - implements IStructuredContentProvider -{ - /** The underlying model list. */ - protected ListValueModel listHolder; - - /** The list viewer we keep in synch with the model list. */ - protected final AbstractListViewer listViewer; - - /** A listener that allows us to forward changes made to the underlying model list. */ - protected final ListChangeListener listChangeListener; - - - // ********** static ********** - - /** - * Adapt the specified list viewer to the specified list holder so they - * stay in synch. - */ - public static StructuredContentProviderAdapter adapt(AbstractListViewer listViewer, ListValueModel listHolder) { - // we need only construct the adapter and it will hook up to the list viewer etc. - return new StructuredContentProviderAdapter(listViewer, listHolder); - } - - /** - * Adapt the specified list viewer to the specified list holder so they - * stay in synch. - */ - public static StructuredContentProviderAdapter adapt(AbstractListViewer listViewer, CollectionValueModel collectionHolder) { - // we need only construct the adapter and it will hook up to the list viewer etc. - return new StructuredContentProviderAdapter(listViewer, collectionHolder); - } - - - // ********** constructors ********** - - /** - * Constructor. - */ - protected StructuredContentProviderAdapter(AbstractListViewer listViewer, ListValueModel listHolder) { - super(); - this.listChangeListener = this.buildListChangeListener(); - this.listViewer = listViewer; - this.listViewer.setContentProvider(this); - // the list viewer will call back to #inputChanged(Viewer, Object, Object) - this.listViewer.setInput(listHolder); - } - - /** - * Constructor. - */ - protected StructuredContentProviderAdapter(AbstractListViewer listViewer, CollectionValueModel collectionHolder) { - this(listViewer, new CollectionListValueModelAdapter(collectionHolder)); - } - - - // ********** initialization ********** - - protected ListChangeListener buildListChangeListener() { - return new SWTListChangeListenerWrapper(this.buildListChangeListener_()); - } - - protected ListChangeListener buildListChangeListener_() { - return new ListChangeListener() { - public void itemsAdded(ListAddEvent e) { - StructuredContentProviderAdapter.this.itemsAdded(e); - } - public void itemsRemoved(ListRemoveEvent e) { - StructuredContentProviderAdapter.this.itemsRemoved(e); - } - public void itemsReplaced(ListReplaceEvent e) { - StructuredContentProviderAdapter.this.itemsReplaced(e); - } - public void itemsMoved(ListMoveEvent e) { - StructuredContentProviderAdapter.this.itemsMoved(e); - } - public void listCleared(ListClearEvent e) { - StructuredContentProviderAdapter.this.listCleared(); - } - public void listChanged(ListChangeEvent e) { - StructuredContentProviderAdapter.this.listChanged(); - } - @Override - public String toString() { - return "list listener"; - } - }; - } - - - // ********** IStructuredContentProvider implementation ********** - - public Object[] getElements(Object inputElement) { - if (inputElement != this.listHolder) { - throw new IllegalArgumentException("invalid input element: " + inputElement); - } - return this.listHolder.toArray(); - } - - /** - * This is called by the list viewer, so don't update the list viewer here. - */ - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - if (viewer != this.listViewer) { - throw new IllegalArgumentException("invalid viewer: " + viewer); - } - if (oldInput != this.listHolder) { - throw new IllegalArgumentException("invalid old input: " + oldInput); - } - this.modelChanged((ListValueModel) oldInput, (ListValueModel) newInput); - } - - public void dispose() { - // do nothing - listeners should've already been removed in #inputChanged(Viewer, Object, Object) - } - - - // ********** internal methods ********** - - protected void modelChanged(ListValueModel oldModel, ListValueModel newModel) { - if (oldModel != null) { - this.listHolder.removeListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - } - this.listHolder = newModel; - if (newModel != null) { - this.listHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - } - } - - - // ********** public API ********** - - /** - * Return the underlying list model. - */ - public ListValueModel model() { - return this.listHolder; - } - - /** - * Set the underlying list model. - */ - public void setModel(ListValueModel listHolder) { - // the list viewer will call back to #inputChanged(Viewer, Object, Object) - this.listViewer.setInput(listHolder); - } - - /** - * Set the underlying collection model. - */ - public void setModel(CollectionValueModel collectionHolder) { - this.setModel(new CollectionListValueModelAdapter(collectionHolder)); - } - - - // ********** list change support ********** - - /** - * Items were added to the underlying model list. - * Synchronize the list viewer. - */ - protected void itemsAdded(ListAddEvent e) { - int i = e.getIndex(); - for (Object item : e.getItems()) { - this.listViewer.insert(item, i++); - } - } - - /** - * Items were removed from the underlying model list. - * Synchronize the list viewer. - */ - protected void itemsRemoved(ListRemoveEvent e) { - this.listViewer.remove(ArrayTools.array(e.getItems(), e.getItemsSize())); - } - - /** - * Items were replaced in the underlying model list. - * Synchronize the list viewer. - */ - protected void itemsReplaced(ListReplaceEvent e) { - this.listViewer.remove(ArrayTools.array(e.getOldItems(), e.getItemsSize())); - int i = e.getIndex(); - for (Object item : e.getNewItems()) { - this.listViewer.insert(item, i++); - } - } - - /** - * Items were moved in the underlying model list. - * Synchronize the list viewer. - */ - protected void itemsMoved(ListMoveEvent e) { - int len = e.getLength(); - Object[] items = new Object[len]; - int offset = e.getSourceIndex(); - for (int i = 0; i < len; i++) { - items[i] = this.listHolder.get(offset + i); - } - this.listViewer.remove(items); - - offset = e.getTargetIndex(); - for (int i = 0; i < len; i++) { - this.listViewer.insert(items[i], offset + i); - } - } - - /** - * The underlying model list was cleared. - * Synchronize the list viewer. - */ - protected void listCleared() { - this.listViewer.refresh(); - } - - /** - * The underlying model list has changed "dramatically". - * Synchronize the list viewer. - */ - protected void listChanged() { - this.listViewer.refresh(); - } - - - // ********** Object overrides ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.listHolder); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTCollectionChangeListenerWrapper.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTCollectionChangeListenerWrapper.java deleted file mode 100644 index 8918708bbf..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTCollectionChangeListenerWrapper.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.listeners; - -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.swt.widgets.Display; - -/** - * Wrap another collection change listener and forward events to it on the SWT - * UI thread, asynchronously if necessary. - */ -public class SWTCollectionChangeListenerWrapper - implements CollectionChangeListener -{ - private final CollectionChangeListener listener; - - public SWTCollectionChangeListenerWrapper(CollectionChangeListener listener) { - super(); - if (listener == null) { - throw new NullPointerException(); - } - this.listener = listener; - } - - public void itemsAdded(CollectionAddEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsAdded_(event); - } else { - this.executeOnUIThread(this.buildItemsAddedRunnable(event)); - } - } - - public void itemsRemoved(CollectionRemoveEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsRemoved_(event); - } else { - this.executeOnUIThread(this.buildItemsRemovedRunnable(event)); - } - } - - public void collectionCleared(CollectionClearEvent event) { - if (this.isExecutingOnUIThread()) { - this.collectionCleared_(event); - } else { - this.executeOnUIThread(this.buildCollectionClearedRunnable(event)); - } - } - - public void collectionChanged(CollectionChangeEvent event) { - if (this.isExecutingOnUIThread()) { - this.collectionChanged_(event); - } else { - this.executeOnUIThread(this.buildCollectionChangedRunnable(event)); - } - } - - private Runnable buildItemsAddedRunnable(final CollectionAddEvent event) { - return new Runnable() { - public void run() { - SWTCollectionChangeListenerWrapper.this.itemsAdded_(event); - } - @Override - public String toString() { - return "items added runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildItemsRemovedRunnable(final CollectionRemoveEvent event) { - return new Runnable() { - public void run() { - SWTCollectionChangeListenerWrapper.this.itemsRemoved_(event); - } - @Override - public String toString() { - return "items removed runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildCollectionClearedRunnable(final CollectionClearEvent event) { - return new Runnable() { - public void run() { - SWTCollectionChangeListenerWrapper.this.collectionCleared_(event); - } - @Override - public String toString() { - return "collection cleared runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildCollectionChangedRunnable(final CollectionChangeEvent event) { - return new Runnable() { - public void run() { - SWTCollectionChangeListenerWrapper.this.collectionChanged_(event); - } - @Override - public String toString() { - return "collection changed runnable"; //$NON-NLS-1$ - } - }; - } - - private boolean isExecutingOnUIThread() { - return Display.getCurrent() != null; - } - - /** - * {@link Display#asyncExec(Runnable)} seems to work OK; - * but using {@link Display#syncExec(Runnable)} can somtimes make things - * more predictable when debugging, at the risk of deadlocks. - */ - private void executeOnUIThread(Runnable r) { - Display.getDefault().asyncExec(r); -// Display.getDefault().syncExec(r); - } - - void itemsAdded_(CollectionAddEvent event) { - this.listener.itemsAdded(event); - } - - void itemsRemoved_(CollectionRemoveEvent event) { - this.listener.itemsRemoved(event); - } - - void collectionCleared_(CollectionClearEvent event) { - this.listener.collectionCleared(event); - } - - void collectionChanged_(CollectionChangeEvent event) { - this.listener.collectionChanged(event); - } - - @Override - public String toString() { - return "SWT(" + this.listener.toString() + ')'; //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTListChangeListenerWrapper.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTListChangeListenerWrapper.java deleted file mode 100644 index 321080dfc5..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTListChangeListenerWrapper.java +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.listeners; - -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.swt.widgets.Display; - -/** - * Wrap another list change listener and forward events to it on the SWT - * UI thread, asynchronously if necessary. - */ -public class SWTListChangeListenerWrapper - implements ListChangeListener -{ - private final ListChangeListener listener; - - public SWTListChangeListenerWrapper(ListChangeListener listener) { - super(); - if (listener == null) { - throw new NullPointerException(); - } - this.listener = listener; - } - - public void itemsAdded(ListAddEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsAdded_(event); - } else { - this.executeOnUIThread(this.buildItemsAddedRunnable(event)); - } - } - - public void itemsRemoved(ListRemoveEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsRemoved_(event); - } else { - this.executeOnUIThread(this.buildItemsRemovedRunnable(event)); - } - } - - public void itemsMoved(ListMoveEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsMoved_(event); - } else { - this.executeOnUIThread(this.buildItemsMovedRunnable(event)); - } - } - - public void itemsReplaced(ListReplaceEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsReplaced_(event); - } else { - this.executeOnUIThread(this.buildItemsReplacedRunnable(event)); - } - } - - public void listCleared(ListClearEvent event) { - if (this.isExecutingOnUIThread()) { - this.listCleared_(event); - } else { - this.executeOnUIThread(this.buildListClearedRunnable(event)); - } - } - - public void listChanged(ListChangeEvent event) { - if (this.isExecutingOnUIThread()) { - this.listChanged_(event); - } else { - this.executeOnUIThread(this.buildListChangedRunnable(event)); - } - } - - private Runnable buildItemsAddedRunnable(final ListAddEvent event) { - return new Runnable() { - public void run() { - SWTListChangeListenerWrapper.this.itemsAdded_(event); - } - @Override - public String toString() { - return "items added runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildItemsRemovedRunnable(final ListRemoveEvent event) { - return new Runnable() { - public void run() { - SWTListChangeListenerWrapper.this.itemsRemoved_(event); - } - @Override - public String toString() { - return "items removed runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildItemsMovedRunnable(final ListMoveEvent event) { - return new Runnable() { - public void run() { - SWTListChangeListenerWrapper.this.itemsMoved_(event); - } - @Override - public String toString() { - return "items moved runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildItemsReplacedRunnable(final ListReplaceEvent event) { - return new Runnable() { - public void run() { - SWTListChangeListenerWrapper.this.itemsReplaced_(event); - } - @Override - public String toString() { - return "items replaced runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildListClearedRunnable(final ListClearEvent event) { - return new Runnable() { - public void run() { - SWTListChangeListenerWrapper.this.listCleared_(event); - } - @Override - public String toString() { - return "list cleared runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildListChangedRunnable(final ListChangeEvent event) { - return new Runnable() { - public void run() { - SWTListChangeListenerWrapper.this.listChanged_(event); - } - @Override - public String toString() { - return "list changed runnable"; //$NON-NLS-1$ - } - }; - } - - private boolean isExecutingOnUIThread() { - return Display.getCurrent() != null; - } - - /** - * {@link Display#asyncExec(Runnable)} seems to work OK; - * but using {@link Display#syncExec(Runnable)} can somtimes make things - * more predictable when debugging, at the risk of deadlocks. - */ - private void executeOnUIThread(Runnable r) { - Display.getDefault().asyncExec(r); -// Display.getDefault().syncExec(r); - } - - void itemsAdded_(ListAddEvent event) { - this.listener.itemsAdded(event); - } - - void itemsRemoved_(ListRemoveEvent event) { - this.listener.itemsRemoved(event); - } - - void itemsMoved_(ListMoveEvent event) { - this.listener.itemsMoved(event); - } - - void itemsReplaced_(ListReplaceEvent event) { - this.listener.itemsReplaced(event); - } - - void listCleared_(ListClearEvent event) { - this.listener.listCleared(event); - } - - void listChanged_(ListChangeEvent event) { - this.listener.listChanged(event); - } - - @Override - public String toString() { - return "SWT(" + this.listener.toString() + ')'; //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTPropertyChangeListenerWrapper.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTPropertyChangeListenerWrapper.java deleted file mode 100644 index f95fbe6005..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTPropertyChangeListenerWrapper.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.listeners; - -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.swt.widgets.Display; - -/** - * Wrap another property change listener and forward events to it on the SWT - * UI thread, asynchronously if necessary. If the event arrived on the UI - * thread that is probably because it was initiated by a UI widget; as a - * result, we want to loop back synchronously so the events can be - * short-circuited. (Typically, the adapter(s) between a property and - * its corresponding UI widget are read-write; as opposed to the adapter(s) - * between a collection (or list) and its UI widget, which - * is read-only.) - */ -public class SWTPropertyChangeListenerWrapper - implements PropertyChangeListener -{ - private final PropertyChangeListener listener; - - public SWTPropertyChangeListenerWrapper(PropertyChangeListener listener) { - super(); - if (listener == null) { - throw new NullPointerException(); - } - this.listener = listener; - } - - public void propertyChanged(PropertyChangeEvent event) { - if (this.isExecutingOnUIThread()) { - this.propertyChanged_(event); - } else { - this.executeOnUIThread(this.buildPropertyChangedRunnable(event)); - } - } - - private Runnable buildPropertyChangedRunnable(final PropertyChangeEvent event) { - return new Runnable() { - public void run() { - SWTPropertyChangeListenerWrapper.this.propertyChanged_(event); - } - @Override - public String toString() { - return "property changed runnable"; //$NON-NLS-1$ - } - }; - } - - private boolean isExecutingOnUIThread() { - return Display.getCurrent() != null; - } - - /** - * {@link Display#asyncExec(Runnable)} seems to work OK; - * but using {@link Display#syncExec(Runnable)} can somtimes make things - * more predictable when debugging, at the risk of deadlocks. - */ - private void executeOnUIThread(Runnable r) { - Display.getDefault().asyncExec(r); -// Display.getDefault().syncExec(r); - } - - void propertyChanged_(PropertyChangeEvent event) { - this.listener.propertyChanged(event); - } - - @Override - public String toString() { - return "SWT(" + this.listener.toString() + ')'; //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTStateChangeListenerWrapper.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTStateChangeListenerWrapper.java deleted file mode 100644 index 16bf1194db..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTStateChangeListenerWrapper.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.listeners; - -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; -import org.eclipse.swt.widgets.Display; - -/** - * Wrap another state change listener and forward events to it on the SWT - * UI thread, asynchronously if necessary. If the event arrived on the UI - * thread that is probably because it was initiated by a UI widget; as a - * result, we want to loop back synchronously so the events can be - * short-circuited. - */ -public class SWTStateChangeListenerWrapper - implements StateChangeListener -{ - private final StateChangeListener listener; - - public SWTStateChangeListenerWrapper(StateChangeListener listener) { - super(); - if (listener == null) { - throw new NullPointerException(); - } - this.listener = listener; - } - - public void stateChanged(StateChangeEvent event) { - if (this.isExecutingOnUIThread()) { - this.stateChanged_(event); - } else { - this.executeOnUIThread(this.buildStateChangedRunnable(event)); - } - } - - private Runnable buildStateChangedRunnable(final StateChangeEvent event) { - return new Runnable() { - public void run() { - SWTStateChangeListenerWrapper.this.stateChanged_(event); - } - @Override - public String toString() { - return "state changed runnable"; //$NON-NLS-1$ - } - }; - } - - private boolean isExecutingOnUIThread() { - return Display.getCurrent() != null; - } - - /** - * {@link Display#asyncExec(Runnable)} seems to work OK; - * but using {@link Display#syncExec(Runnable)} can somtimes make things - * more predictable when debugging, at the risk of deadlocks. - */ - private void executeOnUIThread(Runnable r) { - Display.getDefault().asyncExec(r); -// Display.getDefault().syncExec(r); - } - - void stateChanged_(StateChangeEvent event) { - this.listener.stateChanged(event); - } - - @Override - public String toString() { - return "SWT(" + this.listener.toString() + ')'; //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTTreeChangeListenerWrapper.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTTreeChangeListenerWrapper.java deleted file mode 100644 index 84255e6fd9..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/listeners/SWTTreeChangeListenerWrapper.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.listeners; - -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.TreeChangeListener; -import org.eclipse.swt.widgets.Display; - -/** - * Wrap another tree change listener and forward events to it on the SWT - * UI thread, asynchronously if necessary. - */ -public class SWTTreeChangeListenerWrapper - implements TreeChangeListener -{ - private final TreeChangeListener listener; - - public SWTTreeChangeListenerWrapper(TreeChangeListener listener) { - super(); - if (listener == null) { - throw new NullPointerException(); - } - this.listener = listener; - } - - public void nodeAdded(TreeAddEvent event) { - if (this.isExecutingOnUIThread()) { - this.nodeAdded_(event); - } else { - this.executeOnUIThread(this.buildNodeAddedRunnable(event)); - } - } - - public void nodeRemoved(TreeRemoveEvent event) { - if (this.isExecutingOnUIThread()) { - this.nodeRemoved_(event); - } else { - this.executeOnUIThread(this.buildNodeRemovedRunnable(event)); - } - } - - public void treeCleared(TreeClearEvent event) { - if (this.isExecutingOnUIThread()) { - this.treeCleared_(event); - } else { - this.executeOnUIThread(this.buildTreeClearedRunnable(event)); - } - } - - public void treeChanged(TreeChangeEvent event) { - if (this.isExecutingOnUIThread()) { - this.treeChanged_(event); - } else { - this.executeOnUIThread(this.buildTreeChangedRunnable(event)); - } - } - - private Runnable buildNodeAddedRunnable(final TreeAddEvent event) { - return new Runnable() { - public void run() { - SWTTreeChangeListenerWrapper.this.nodeAdded_(event); - } - @Override - public String toString() { - return "node added runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildNodeRemovedRunnable(final TreeRemoveEvent event) { - return new Runnable() { - public void run() { - SWTTreeChangeListenerWrapper.this.nodeRemoved_(event); - } - @Override - public String toString() { - return "node removed runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildTreeClearedRunnable(final TreeClearEvent event) { - return new Runnable() { - public void run() { - SWTTreeChangeListenerWrapper.this.treeCleared_(event); - } - @Override - public String toString() { - return "tree cleared runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildTreeChangedRunnable(final TreeChangeEvent event) { - return new Runnable() { - public void run() { - SWTTreeChangeListenerWrapper.this.treeChanged_(event); - } - @Override - public String toString() { - return "tree changed runnable"; //$NON-NLS-1$ - } - }; - } - - private boolean isExecutingOnUIThread() { - return Display.getCurrent() != null; - } - - /** - * {@link Display#asyncExec(Runnable)} seems to work OK; - * but using {@link Display#syncExec(Runnable)} can somtimes make things - * more predictable when debugging, at the risk of deadlocks. - */ - private void executeOnUIThread(Runnable r) { - Display.getDefault().asyncExec(r); -// Display.getDefault().syncExec(r); - } - - void nodeAdded_(TreeAddEvent event) { - this.listener.nodeAdded(event); - } - - void nodeRemoved_(TreeRemoveEvent event) { - this.listener.nodeRemoved(event); - } - - void treeCleared_(TreeClearEvent event) { - this.listener.treeCleared(event); - } - - void treeChanged_(TreeChangeEvent event) { - this.listener.treeChanged(event); - } - - @Override - public String toString() { - return "SWT(" + this.listener.toString() + ')'; //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/properties/JptProjectPropertiesPage.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/properties/JptProjectPropertiesPage.java deleted file mode 100644 index 421e4987a8..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/properties/JptProjectPropertiesPage.java +++ /dev/null @@ -1,432 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.properties; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.model.value.BufferedWritablePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.SimpleChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.common.project.facet.ui.libprov.LibraryFacetPropertyPage; -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.Point; -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.Link; -import org.eclipse.ui.preferences.IWorkbenchPreferenceContainer; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.ui.internal.FacetsPropertyPage; - - -public abstract class JptProjectPropertiesPage - extends LibraryFacetPropertyPage { - - protected final WritablePropertyValueModel projectModel; - protected final BufferedWritablePropertyValueModel.Trigger trigger; - - protected final ChangeListener validationListener; - - - public JptProjectPropertiesPage() { - super(); - - this.projectModel = new SimplePropertyValueModel(); - this.trigger = new BufferedWritablePropertyValueModel.Trigger(); - - buildModels(); - - this.validationListener = this.buildValidationListener(); - } - - - /** - * Build any additional models needed by this page. The project model has been created at this - * point. - */ - protected abstract void buildModels(); - - - // ********** convenience methods ********** - - protected static boolean flagIsSet(PropertyValueModel flagModel) { - Boolean flag = flagModel.getValue(); - return (flag != null) && flag.booleanValue(); - } - - - // ********** LibraryFacetPropertyPage implementation ********** - - @Override - protected LibraryInstallDelegate createLibraryInstallDelegate(IFacetedProject project, IProjectFacetVersion fv) { - LibraryInstallDelegate lid = new LibraryInstallDelegate(project, fv, null); - lid.addListener(buildLibraryProviderListener()); - return lid; - } - - protected IPropertyChangeListener buildLibraryProviderListener() { - return new IPropertyChangeListener() { - public void propertyChanged(String property, Object oldValue, Object newValue ) { - if (LibraryInstallDelegate.PROP_AVAILABLE_PROVIDERS.equals(property)) { - adjustLibraryProviders(); - } - } - }; - } - - protected abstract void adjustLibraryProviders(); - - - // ********** page ********** - - @Override - protected Control createPageContents(Composite parent) { - if (this.projectModel.getValue() != null) { - disengageListeners(); - } - - this.projectModel.setValue(getProject()); - - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - layout.marginHeight = 0; - composite.setLayout(layout); - - createWidgets(composite); - - Dialog.applyDialogFont(composite); - - adjustLibraryProviders(); - - engageListeners(); - updateValidation(); - - return composite; - } - - /** - * Build specific widgets. Layout and validation will be taken care of. - */ - protected abstract void createWidgets(Composite parent); - - protected void engageListeners() { - engageValidationListener(); - } - - protected void disengageListeners() { - disengageValidationListener(); - } - - protected Link buildFacetsPageLink(Composite parent, String text) { - Link facetsPageLink = buildLink(parent, text); - facetsPageLink.addSelectionListener(buildFacetsPageLinkListener()); // the link will be GCed - return facetsPageLink; - } - - private SelectionListener buildFacetsPageLinkListener() { - return new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - openProjectFacetsPage(); - } - @Override - public String toString() { - return "facets page link listener"; //$NON-NLS-1$ - } - }; - } - - protected void openProjectFacetsPage() { - ((IWorkbenchPreferenceContainer)getContainer()).openPage(FacetsPropertyPage.ID, null); - } - - /** - * Don't allow {@link org.eclipse.jface.preference.PreferencePage#computeSize()} - * to cache the page's size, since the size of the "Library" panel can - * change depending on the user's selection from the drop-down list. - */ - @Override - public Point computeSize() { - return this.doComputeSize(); - } - - - // ********** widgets ********** - - protected Button buildCheckBox(Composite parent, int horizontalSpan, String text) { - return buildButton(parent, horizontalSpan, text, SWT.CHECK); - } - - protected Button buildRadioButton(Composite parent, int horizontalSpan, String text) { - return buildButton(parent, horizontalSpan, text, SWT.RADIO); - } - - protected Button buildButton(Composite parent, int horizontalSpan, String text, int style) { - Button button = new Button(parent, SWT.NONE | style); - button.setText(text); - GridData gd = new GridData(); - gd.horizontalSpan = horizontalSpan; - button.setLayoutData(gd); - return button; - } - - protected Combo buildDropDown(Composite parent) { - return buildDropDown(parent, 1); - } - - protected Combo buildDropDown(Composite parent, int horizontalSpan) { - Combo combo = new Combo(parent, SWT.READ_ONLY); - GridData gd = new GridData(GridData.FILL_HORIZONTAL); - gd.horizontalSpan = horizontalSpan; - combo.setLayoutData(gd); - return combo; - } - - protected Label buildLabel(Composite parent, String text) { - Label label = new Label(parent, SWT.LEFT); - label.setText(text); - GridData gd = new GridData(); - gd.horizontalSpan = 1; - label.setLayoutData(gd); - return label; - } - - protected Link buildLink(Composite parent, String text) { - Link link = new Link(parent, SWT.NONE); - GridData data = new GridData(GridData.END, GridData.CENTER, false, false); - data.horizontalSpan = 2; - link.setLayoutData(data); - link.setText(text); - return link; - } - - - // ********** OK/Revert/Apply behavior ********** - - @Override - public boolean performOk() { - super.performOk(); - - try { - // true=fork; false=uncancellable - this.buildOkProgressMonitorDialog().run(true, false, this.buildOkRunnableWithProgress()); - } - catch (InterruptedException ex) { - return false; - } - catch (InvocationTargetException ex) { - throw new RuntimeException(ex.getTargetException()); - } - - return true; - } - - private IRunnableContext buildOkProgressMonitorDialog() { - return new ProgressMonitorDialog(this.getShell()); - } - - private IRunnableWithProgress buildOkRunnableWithProgress() { - return new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - IWorkspace ws = ResourcesPlugin.getWorkspace(); - try { - // the build we execute in #performOk_() locks the workspace root, - // so we need to use the workspace root as our scheduling rule here - ws.run( - buildOkWorkspaceRunnable(), - ws.getRoot(), - IWorkspace.AVOID_UPDATE, - monitor); - } - catch (CoreException ex) { - throw new InvocationTargetException(ex); - } - } - }; - } - - /* private */ IWorkspaceRunnable buildOkWorkspaceRunnable() { - return new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - performOk_(monitor); - } - }; - } - - // ********** OK/Revert/Apply behavior ********** - - void performOk_(IProgressMonitor monitor) throws CoreException { - if (isBuffering()) { - boolean rebuild = projectRebuildRequired(); - this.trigger.accept(); - if (rebuild) { - rebuildProject(); - } - this.getProject().build(IncrementalProjectBuilder.FULL_BUILD, monitor); - } - } - - protected abstract boolean projectRebuildRequired(); - - protected abstract void rebuildProject(); - - /** - * Return whether any of the models are buffering a change. - */ - private boolean isBuffering() { - for (BufferedWritablePropertyValueModel model : buildBufferedModels()) { - if (model.isBuffering()) { - return true; - } - } - return false; - } - - protected abstract BufferedWritablePropertyValueModel[] buildBufferedModels(); - - @Override - protected void performDefaults() { - super.performDefaults(); - this.trigger.reset(); - } - - - // ********** dispose ********** - - @Override - public void dispose() { - disengageListeners(); - super.dispose(); - } - - - // ********** validation ********** - - private ChangeListener buildValidationListener() { - return new SimpleChangeListener() { - @Override - protected void modelChanged() { - validate(); - } - @Override - public String toString() { - return "validation listener"; //$NON-NLS-1$ - } - }; - } - - protected void validate() { - if ( ! getControl().isDisposed()) { - updateValidation(); - } - } - - private void engageValidationListener() { - for (Model model : buildValidationModels()) { - model.addChangeListener(this.validationListener); - } - } - - protected abstract Model[] buildValidationModels(); - - private void disengageValidationListener() { - for (Model model : buildReverseValidationModels()) { - model.removeChangeListener(this.validationListener); - } - } - - protected Model[] buildReverseValidationModels() { - return ArrayTools.reverse(buildValidationModels()); - } - - protected static final Integer ERROR_STATUS = Integer.valueOf(IStatus.ERROR); - protected static final Integer WARNING_STATUS = Integer.valueOf(IStatus.WARNING); - protected static final Integer INFO_STATUS = Integer.valueOf(IStatus.INFO); - protected static final Integer OK_STATUS = Integer.valueOf(IStatus.OK); - - protected IStatus buildInfoStatus(String message) { - return this.buildStatus(IStatus.INFO, message); - } - - protected IStatus buildWarningStatus(String message) { - return this.buildStatus(IStatus.WARNING, message); - } - - protected IStatus buildErrorStatus(String message) { - return this.buildStatus(IStatus.ERROR, message); - } - - protected IStatus buildStatus(int severity, String message) { - return new Status(severity, JptCommonCorePlugin.PLUGIN_ID, message); - } - - @Override - protected IStatus performValidation() { - HashMap> statuses = new HashMap>(); - statuses.put(ERROR_STATUS, new ArrayList()); - statuses.put(WARNING_STATUS, new ArrayList()); - statuses.put(INFO_STATUS, new ArrayList()); - statuses.put(OK_STATUS, CollectionTools.list(Status.OK_STATUS)); - - performValidation(statuses); - - if ( ! statuses.get(ERROR_STATUS).isEmpty()) { - return statuses.get(ERROR_STATUS).get(0); - } - else if ( ! statuses.get(WARNING_STATUS).isEmpty()) { - return statuses.get(WARNING_STATUS).get(0); - } - else if ( ! statuses.get(INFO_STATUS).isEmpty()) { - return statuses.get(INFO_STATUS).get(0); - } - else { - return statuses.get(OK_STATUS).get(0); - } - } - - protected void performValidation(Map> statuses) { - /* library provider */ - IStatus lpStatus = super.performValidation(); - statuses.get(Integer.valueOf(lpStatus.getSeverity())).add(lpStatus); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/AbstractComboModelAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/AbstractComboModelAdapter.java deleted file mode 100644 index c6d11feed7..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/AbstractComboModelAdapter.java +++ /dev/null @@ -1,699 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.swt; - -import java.util.EventListener; -import java.util.EventObject; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.jpt.common.ui.internal.listeners.SWTListChangeListenerWrapper; -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.ListenerList; -import org.eclipse.jpt.common.utility.internal.StringConverter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; - -/** - * This adapter provides a more object-oriented interface to the items and - * selected item in a combo. - *

- * listHolder contains the items in the combo.
- * selectedItemHolder contains the items in 'listHolder' that are - * selected in the combo. - * - * @param The type of the items in listHolder - * @see ComboModelAdapter - * @see CComboModelAdapter - * - * @version 2.0 - * @since 2.0 - */ -@SuppressWarnings("nls") -public abstract class AbstractComboModelAdapter { - - // ********** model ********** - /** - * A value model on the underlying model list. - */ - protected final ListValueModel listHolder; - - /** - * A listener that allows us to synchronize the combo's contents with - * the model list. - */ - protected final ListChangeListener listChangeListener; - - /** - * A value model on the underlying model selection. - */ - protected final WritablePropertyValueModel selectedItemHolder; - - /** - * A listener that allows us to synchronize the combo's selection with the - * model selection. - */ - protected final PropertyChangeListener selectedItemChangeListener; - - /** - * A converter that converts items in the model list - * to strings that can be put in the combo. - */ - protected StringConverter stringConverter; - - // ********** UI ********** - /** - * The combo we keep synchronized with the model list. - */ - protected final ComboHolder comboHolder; - - /** - * A listener that allows us to synchronize our selection list holder - * with the combo's text. - */ - protected ModifyListener comboModifyListener; - - /** - * A listener that allows us to synchronize our selection list holder - * with the combo's selection. - */ - protected SelectionListener comboSelectionListener; - - /** - * Clients that are interested in selection change events. - */ - @SuppressWarnings("unchecked") - protected final ListenerList selectionChangeListenerList; - - /** - * Clients that are interested in double click events. - */ - @SuppressWarnings("unchecked") - protected final ListenerList doubleClickListenerList; - - /** - * A listener that allows us to stop listening to stuff when the combo - * is disposed. - */ - protected final DisposeListener comboDisposeListener; - - - // ********** constructors ********** - - /** - * Constructor - the list holder, selections holder, combo, and - * string converter are required. - */ - protected AbstractComboModelAdapter( - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - ComboHolder comboHolder, - StringConverter stringConverter) - { - super(); - - Assert.isNotNull(listHolder, "The holder of the items"); - Assert.isNotNull(selectedItemHolder, "The holder of the selected item cannot be null"); - Assert.isNotNull(comboHolder, "The holder of the combo widget cannot be null"); - Assert.isNotNull(stringConverter, "The string converter cannot be null"); - - this.listHolder = listHolder; - this.selectedItemHolder = selectedItemHolder; - this.comboHolder = comboHolder; - this.stringConverter = stringConverter; - - this.listChangeListener = this.buildListChangeListener(); - this.listHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - - this.selectedItemChangeListener = this.buildSelectedItemChangeListener(); - this.selectedItemHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.selectedItemChangeListener); - - if (this.comboHolder.isEditable()) { - this.comboModifyListener = this.buildComboModifyListener(); - this.comboHolder.addModifyListener(this.comboModifyListener); - } - else { - this.comboSelectionListener = this.buildComboSelectionListener(); - this.comboHolder.addSelectionListener(this.comboSelectionListener); - } - - this.selectionChangeListenerList = this.buildSelectionChangeListenerList(); - this.doubleClickListenerList = this.buildDoubleClickListenerList(); - - this.comboDisposeListener = this.buildComboDisposeListener(); - this.comboHolder.addDisposeListener(this.comboDisposeListener); - - this.synchronizeCombo(); - } - - - // ********** initialization ********** - - protected ListChangeListener buildListChangeListener() { - return new SWTListChangeListenerWrapper(this.buildListChangeListener_()); - } - - protected ListChangeListener buildListChangeListener_() { - return new ListChangeListener() { - public void itemsAdded(ListAddEvent event) { - AbstractComboModelAdapter.this.listItemsAdded(event); - } - public void itemsRemoved(ListRemoveEvent event) { - AbstractComboModelAdapter.this.listItemsRemoved(event); - } - public void itemsMoved(ListMoveEvent event) { - AbstractComboModelAdapter.this.listItemsMoved(event); - } - public void itemsReplaced(ListReplaceEvent event) { - AbstractComboModelAdapter.this.listItemsReplaced(event); - } - public void listCleared(ListClearEvent event) { - AbstractComboModelAdapter.this.listCleared(event); - } - public void listChanged(ListChangeEvent event) { - AbstractComboModelAdapter.this.listChanged(event); - } - @Override - public String toString() { - return "list listener"; - } - }; - } - - protected PropertyChangeListener buildSelectedItemChangeListener() { - return new SWTPropertyChangeListenerWrapper(this.buildSelectedItemChangeListener_()); - } - - protected PropertyChangeListener buildSelectedItemChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - AbstractComboModelAdapter.this.selectedItemChanged(e); - } - }; - } - - protected ModifyListener buildComboModifyListener() { - return new ModifyListener() { - public void modifyText(ModifyEvent event) { - AbstractComboModelAdapter.this.comboSelectionChanged(event); - } - - @Override - public String toString() { - return "combo modify listener"; - } - }; - } - - protected SelectionListener buildComboSelectionListener() { - return new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - AbstractComboModelAdapter.this.comboSelectionChanged(event); - } - - @Override - public String toString() { - return "combo modify listener"; - } - }; - } - - @SuppressWarnings("unchecked") - protected ListenerList buildDoubleClickListenerList() { - return new ListenerList(DoubleClickListener.class); - } - - @SuppressWarnings("unchecked") - protected ListenerList buildSelectionChangeListenerList() { - return new ListenerList(SelectionChangeListener.class); - } - - protected DisposeListener buildComboDisposeListener() { - return new DisposeListener() { - public void widgetDisposed(DisposeEvent event) { - AbstractComboModelAdapter.this.comboDisposed(event); - } - - @Override - public String toString() { - return "combo dispose listener"; - } - }; - } - - protected void synchronizeCombo() { - this.synchronizeComboItems(); - this.synchronizeComboSelection(); - } - - - // ********** string converter ********** - - public void setStringConverter(StringConverter stringConverter) { - Assert.isNotNull(stringConverter, "The StringConverter cannot be null"); - this.stringConverter = stringConverter; - this.synchronizeCombo(); - } - - - // ********** list ********** - - /** - * Use the string converter to convert the specified item to a - * string that can be added to the combo. - */ - protected String convert(E item) { - return this.stringConverter.convertToString(item); - } - - /** - * Brute force synchronization of combo with the model list. - */ - protected void synchronizeComboItems() { - if (this.comboHolder.isDisposed()) { - return; - } - int len = this.listHolder.size(); - String[] items = new String[len]; - for (int index = 0; index < len; index++) { - items[index] = this.convert(this.listHolder.get(index)); - } - try { - this.comboHolder.setPopulating(true); - this.comboHolder.setItems(items); - } - finally { - this.comboHolder.setPopulating(false); - } - } - - /** - * The model has changed - synchronize the combo. - */ - protected void listItemsAdded(ListAddEvent event) { - if (this.comboHolder.isDisposed()) { - return; - } - - int count = this.comboHolder.getItemCount(); - int index = event.getIndex(); - - for (E item : this.getItems(event)) { - this.comboHolder.add(this.convert(item), index++); - } - - // When the combo is populated, it's possible the selection was already - // set but no items was found, resync the selected item - synchronizeComboSelection(); - } - - /** - * The model has changed - synchronize the combo. - */ - protected void listItemsRemoved(ListRemoveEvent event) { - if (this.comboHolder.isDisposed()) { - return; - } - this.comboHolder.remove(event.getIndex(), event.getIndex() + event.getItemsSize() - 1); - this.synchronizeComboSelection(); - } - - /** - * The model has changed - synchronize the combo. - */ - protected void listItemsMoved(ListMoveEvent event) { - if (this.comboHolder.isDisposed()) { - return; - } - int target = event.getTargetIndex(); - int source = event.getSourceIndex(); - int len = event.getLength(); - int loStart = Math.min(target, source); - int hiStart = Math.max(target, source); - // make a copy of the affected items... - String[] subArray = ArrayTools.subArray(this.comboHolder.getItems(), loStart, hiStart + len - loStart); - // ...move them around... - subArray = ArrayTools.move(subArray, target - loStart, source - loStart, len); - // ...and then put them back - for (int index = 0; index < subArray.length; index++) { - this.comboHolder.setItem(loStart + index, subArray[index]); - } - } - - /** - * The model has changed - synchronize the combo. - */ - protected void listItemsReplaced(ListReplaceEvent event) { - if (this.comboHolder.isDisposed()) { - return; - } - int index = event.getIndex(); - int selectionIndex = this.comboHolder.getSelectionIndex(); - //fixing bug 269100 by setting the populating flag to true - this.comboHolder.setPopulating(true); - try { - for (E item : this.getNewItems(event)) { - this.comboHolder.setItem(index++, this.convert(item)); - } - if (selectionIndex == 0) { - this.comboHolder.setText(this.comboHolder.getItems()[0]); - } - } - finally { - this.comboHolder.setPopulating(false); - } - } - - /** - * The model has changed - synchronize the combo. - */ - protected void listCleared(ListClearEvent event) { - if (this.comboHolder.isDisposed()) { - return; - } - this.comboHolder.setPopulating(true); - try { - this.comboHolder.removeAll(); - } - finally { - this.comboHolder.setPopulating(false); - } - } - - /** - * The model has changed - synchronize the combo. - */ - protected void listChanged(ListChangeEvent event) { - this.synchronizeCombo(); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getItems(ListAddEvent event) { - return (Iterable) event.getItems(); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getNewItems(ListReplaceEvent event) { - return (Iterable) event.getNewItems(); - } - - - // ********** selected items ********** - - protected int indexOf(E item) { - int length = this.listHolder.size(); - for (int index = 0; index < length; index++) { - if (valuesAreEqual(this.listHolder.get(index), item)) { - return index; - } - } - return -1; - } - - protected void synchronizeComboSelection() { - if (this.comboHolder.isDisposed() || this.comboHolder.isPopulating()) { - return; - } - - E selectedValue = this.selectedItemHolder.getValue(); - if (this.comboHolder.getText().equals(selectedValue)) { - //if the selection is still the same, don't reset it - return; - } - this.comboHolder.setPopulating(true); - try { - this.comboHolder.deselectAll(); - String selectedItem = this.convert(selectedValue); - if (selectedItem == null) { - selectedItem = ""; - } - this.comboHolder.setText(selectedItem); - this.notifyListeners(selectedValue); - } - finally { - this.comboHolder.setPopulating(false); - } - } - - protected void selectedItemChanged(PropertyChangeEvent event) { - this.synchronizeComboSelection(); - } - - /** - * Return whether the values are equal, with the appropriate null checks. - * Convenience method for checking whether an attribute value has changed. - */ - protected final boolean valuesAreEqual(Object value1, Object value2) { - if ((value1 == null) && (value2 == null)) { - return true; // both are null - } - if ((value1 == null) || (value2 == null)) { - return false; // one is null but the other is not - } - return value1.equals(value2); - } - - // ********** combo events ********** - - protected void comboSelectionChanged(SelectionEvent event) { - this.selectionChanged(); - } - - protected void comboSelectionChanged(ModifyEvent event) { - this.selectionChanged(); - } - - protected void selectionChanged() { - if (!this.comboHolder.isPopulating()) { - E selectedItem = this.selectedItem(); - this.comboHolder.setPopulating(true); - try { - this.selectedItemHolder.setValue(selectedItem); - this.notifyListeners(selectedItem); - } - finally { - this.comboHolder.setPopulating(false); - } - } - } - - private void notifyListeners(E selectedItem) { - if (this.selectionChangeListenerList.size() > 0) { - SelectionChangeEvent scEvent = new SelectionChangeEvent(this, selectedItem); - for (SelectionChangeListener selectionChangeListener : this.selectionChangeListenerList.getListeners()) { - selectionChangeListener.selectionChanged(scEvent); - } - } - } - - @SuppressWarnings("unchecked") - protected E selectedItem() { - if (this.comboHolder.isDisposed()) { - return null; - } - - if (this.comboHolder.isEditable()) { - String text = this.comboHolder.getText(); - - if (text.length() == 0) { - return null; - } - - for (int index = this.listHolder.size(); --index >= 0; ) { - E item = this.listHolder.get(index); - String value = this.convert(item); - if (valuesAreEqual(text, value)) { - return item; - } - } - - // TODO: Find a way to prevent this type cast (it'll work if E is - // String but it won't work if E is something else), maybe use a - // BidiStringConverter instead of StringConverter - try { - return (E) text; - } - catch (ClassCastException e) { - return null; - } - } - - int index = this.comboHolder.getSelectionIndex(); - - if (index == -1) { - return null; - } - - return this.listHolder.get(index); - } - - protected void comboDoubleClicked(SelectionEvent event) { - if (this.comboHolder.isDisposed()) { - return; - } - if (this.doubleClickListenerList.size() > 0) { - // there should be only a single item selected during a double-click(?) - E selection = this.listHolder.get(this.comboHolder.getSelectionIndex()); - DoubleClickEvent dcEvent = new DoubleClickEvent(this, selection); - for (DoubleClickListener doubleClickListener : this.doubleClickListenerList.getListeners()) { - doubleClickListener.doubleClick(dcEvent); - } - } - } - - - // ********** dispose ********** - - protected void comboDisposed(DisposeEvent event) { - // the combo is not yet "disposed" when we receive this event - // so we can still remove our listeners - this.comboHolder.removeDisposeListener(this.comboDisposeListener); - if (this.comboHolder.isEditable()) { - this.comboHolder.removeModifyListener(this.comboModifyListener); - } - else { - this.comboHolder.removeSelectionListener(this.comboSelectionListener); - } - this.selectedItemHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.selectedItemChangeListener); - this.listHolder.removeListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - } - - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.listHolder); - } - - - // ********** double click support ********** - - public void addDoubleClickListener(DoubleClickListener listener) { - this.doubleClickListenerList.add(listener); - } - - public void removeDoubleClickListener(DoubleClickListener listener) { - this.doubleClickListenerList.remove(listener); - } - - public interface DoubleClickListener extends EventListener { - void doubleClick(DoubleClickEvent event); - } - - public static class DoubleClickEvent extends EventObject { - private final E selection; - private static final long serialVersionUID = 1L; - - protected DoubleClickEvent(AbstractComboModelAdapter source, E selection) { - super(source); - if (selection == null) { - throw new NullPointerException(); - } - this.selection = selection; - } - - @Override - @SuppressWarnings("unchecked") - public AbstractComboModelAdapter getSource() { - return (AbstractComboModelAdapter) super.getSource(); - } - - public E selection() { - return this.selection; - } - } - - - // ********** selection support ********** - - public void addSelectionChangeListener(SelectionChangeListener listener) { - this.selectionChangeListenerList.add(listener); - } - - public void removeSelectionChangeListener(SelectionChangeListener listener) { - this.selectionChangeListenerList.remove(listener); - } - - public interface SelectionChangeListener extends EventListener { - void selectionChanged(SelectionChangeEvent event); - } - - public static class SelectionChangeEvent extends EventObject { - private final E selectedItem; - private static final long serialVersionUID = 1L; - - protected SelectionChangeEvent(AbstractComboModelAdapter source, E selectedItem) { - super(source); - this.selectedItem = selectedItem; - } - - @Override - @SuppressWarnings("unchecked") - public AbstractComboModelAdapter getSource() { - return (AbstractComboModelAdapter) super.getSource(); - } - - public E selectedItem() { - return this.selectedItem; - } - } - - // ********** Internal member ********** - - /** - * This holder is required for supporting Combo and - * CCombo transparently. - */ - protected static interface ComboHolder { - void add(String item, int index); - void addDisposeListener(DisposeListener disposeListener); - void addModifyListener(ModifyListener modifyListener); - void addSelectionListener(SelectionListener selectionListener); - void deselectAll(); - int getItemCount(); - String[] getItems(); - int getSelectionIndex(); - String getText(); - boolean isDisposed(); - boolean isEditable(); - boolean isPopulating(); - void removeDisposeListener(DisposeListener disposeListener); - void removeModifyListener(ModifyListener modifyListener); - void removeSelectionListener(SelectionListener selectionListener); - void setItem(int index, String item); - void setItems(String[] items); - void setPopulating(boolean populating); - void setText(String item); - void remove(int start, int end); - void removeAll(); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/ColumnAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/ColumnAdapter.java deleted file mode 100644 index 775bf91e4c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/ColumnAdapter.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.swt; - -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * This adapter is used by the table model adapter to convert a model object - * into the models used for each of the cells for the object's corresponding row - * in the table. - * - * @version 2.0 - * @since 2.0 - */ -public interface ColumnAdapter { - - /** - * Return the cell models for the specified subject - * that corresponds to a single row in the table. - */ - WritablePropertyValueModel[] cellModels(V subject); - - /** - * Returns the number of columns in the table. Typically this is static. - * - * @return The number of columns - */ - int columnCount(); - - /** - * Returns the name of the column at the specified index. - * - * @param columnIndex The index of the column to retrieve its display text - * @return The display text of the column - */ - String columnName(int columnIndex); - - /** - * Returns whether the specified column is editable. Typically this is the - * same for every row. - * - * @param columnIndex The index of the column for which we determine if - * the content can be modified - * @return true to allow editing of the cell at the given - * column index; false to keep it not editable - */ -// boolean columnIsEditable(int columnIndex); -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/ComboModelAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/ComboModelAdapter.java deleted file mode 100644 index 39794a9cc7..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/ComboModelAdapter.java +++ /dev/null @@ -1,210 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.swt; - -import org.eclipse.jpt.common.utility.internal.StringConverter; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Combo; - -/** - * This adapter provides a more object-oriented interface to the items and - * selected item in a Combo. - *

- * listHolder contains the items in the Combo.
- * selectedItemHolder contains the items in 'listHolder' that are - * selected in the Combo. - * - * @param The type of the items in listHolder - * @version 2.0 - * @since 2.0 - */ -@SuppressWarnings("nls") -public class ComboModelAdapter extends AbstractComboModelAdapter { - - // ********** static methods ********** - - /** - * Adapt the specified model list and selection to the specified combo. - * Use the default string converter to convert the model items to strings - * to be displayed in the combo, which calls #toString() on the - * items in the model list. - */ - public static ComboModelAdapter adapt( - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - Combo combo) - { - return adapt( - listHolder, - selectedItemHolder, - combo, - StringConverter.Default.instance() - ); - } - - /** - * Adapt the specified model list and selection to the specified combo. - * Use the specified string converter to convert the model items to strings - * to be displayed in the combo. - */ - public static ComboModelAdapter adapt( - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - Combo combo, - StringConverter stringConverter) - { - return new ComboModelAdapter( - listHolder, - selectedItemHolder, - combo, - stringConverter - ); - } - - - // ********** constructors ********** - - /** - * Constructor - the list holder, selections holder, combo, and - * string converter are required. - */ - protected ComboModelAdapter( - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - Combo combo, - StringConverter stringConverter) - { - super(listHolder, - selectedItemHolder, - new SWTComboHolder(combo), - stringConverter); - } - - - // ********** Internal member ********** - - private static class SWTComboHolder implements ComboHolder { - private final Combo combo; - private final boolean editable; - private String selectedItem; - - SWTComboHolder(Combo combo) { - super(); - this.combo = combo; - this.editable = (combo.getStyle() & SWT.READ_ONLY) == 0; - } - - public void add(String item, int index) { - this.combo.add(item, index); - - // It is possible the selected item was set before the combo is being - // populated, update the selected item if it's matches the item being - // added - if ((this.selectedItem != null) && this.selectedItem.equals(item)) { - this.setText(this.selectedItem); - this.selectedItem = null; - } - } - - public void addDisposeListener(DisposeListener disposeListener) { - this.combo.addDisposeListener(disposeListener); - } - - public void addModifyListener(ModifyListener modifyListener) { - this.combo.addModifyListener(modifyListener); - } - - public void addSelectionListener(SelectionListener selectionListener) { - this.combo.addSelectionListener(selectionListener); - } - - public void deselectAll() { - this.combo.deselectAll(); - } - - public int getItemCount() { - return this.combo.getItemCount(); - } - - public String[] getItems() { - return this.combo.getItems(); - } - - public int getSelectionIndex() { - return this.combo.getSelectionIndex(); - } - - public String getText() { - return this.combo.getText(); - } - - public boolean isDisposed() { - return this.combo.isDisposed(); - } - - public boolean isEditable() { - return this.editable; - } - - public boolean isPopulating() { - return this.combo.getData("populating") == Boolean.TRUE; - } - - public void remove(int start, int end) { - this.combo.remove(start, end); - } - - public void removeAll() { - this.combo.removeAll(); - } - - public void removeDisposeListener(DisposeListener disposeListener) { - this.combo.removeDisposeListener(disposeListener); - } - - public void removeModifyListener(ModifyListener modifyListener) { - this.combo.removeModifyListener(modifyListener); - } - - public void removeSelectionListener(SelectionListener selectionListener) { - this.combo.removeSelectionListener(selectionListener); - } - - public void setItem(int index, String item) { - this.combo.setItem(index, item); - } - - public void setItems(String[] items) { - this.combo.setItems(items); - } - - public void setPopulating(boolean populating) { - this.combo.setData("populating", Boolean.valueOf(populating)); - } - - public void setText(String item) { - - // Keep track of the selected item since it's possible the selected - // item is before the combo is populated - if (this.combo.getItemCount() == 0) { - this.selectedItem = item; - } - else { - this.selectedItem = null; - } - this.combo.setText(item); - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/DateTimeModelAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/DateTimeModelAdapter.java deleted file mode 100644 index 7347f3e70b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/DateTimeModelAdapter.java +++ /dev/null @@ -1,352 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.swt; - -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.DateTime; - -/** - * This adapter can be used to keep a DateTime widget in synch with - * model integers hours, minutes, and seconds. Has default hours, - * minutes and seconds of 0 which corresponds to 12:00:00 AM. This model - * adapter can only be used for a DateTime widget with the style SWT.TIME - */ -@SuppressWarnings("nls") -public class DateTimeModelAdapter { - - /** - * A value model on the underlying model hours integer. - */ - protected final WritablePropertyValueModel hoursHolder; - - /** - * A value model on the underlying model minutes integer. - */ - protected final WritablePropertyValueModel minutesHolder; - - /** - * A value model on the underlying model seconds integer. - */ - protected final WritablePropertyValueModel secondsHolder; - - /** - * A listener that allows us to synchronize the dateTime's selection state with - * the model hours integer. - */ - protected final PropertyChangeListener hoursPropertyChangeListener; - - /** - * A listener that allows us to synchronize the dateTime's selection state with - * the model minutes integer. - */ - protected final PropertyChangeListener minutesPropertyChangeListener; - - /** - * A listener that allows us to synchronize the dateTime's selection state with - * the model seconds integer. - */ - protected final PropertyChangeListener secondsPropertyChangeListener; - - /** - * The dateTime we keep synchronized with the model integers. - */ - protected final DateTime dateTime; - - /** - * A listener that allows us to synchronize our selection number holder - * with the spinner's value. - */ - protected final SelectionListener dateTimeSelectionListener; - - /** - * A listener that allows us to stop listening to stuff when the dateTime - * is disposed. - */ - protected final DisposeListener dateTimeDisposeListener; - - /** - * This lock is used to prevent the listeners to be notified when the value - * changes from the spinner or from the holder. - */ - private boolean locked; - - // ********** static methods ********** - - /** - * Adapt the specified model integer holders to the specified dateTime. - */ - public static DateTimeModelAdapter adapt( - WritablePropertyValueModel hoursHolder, - WritablePropertyValueModel minutesHolder, - WritablePropertyValueModel secondsHolder, - DateTime dateTime) - { - return new DateTimeModelAdapter(hoursHolder, minutesHolder, secondsHolder, dateTime); - } - - - // ********** constructors ********** - - /** - * Constructor - the hoursHolder, minutesHolder, secondsHolder, and dateTime are required - */ - protected DateTimeModelAdapter(WritablePropertyValueModel hoursHolder, - WritablePropertyValueModel minutesHolder, - WritablePropertyValueModel secondsHolder, - DateTime dateTime) { - super(); - if ((hoursHolder == null) - || (minutesHolder == null) - || (secondsHolder == null) - || (dateTime == null)) { - throw new NullPointerException(); - } - this.hoursHolder = hoursHolder; - this.minutesHolder = minutesHolder; - this.secondsHolder = secondsHolder; - this.dateTime = dateTime; - - this.hoursPropertyChangeListener = this.buildHoursPropertyChangeListener(); - this.hoursHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.hoursPropertyChangeListener); - - this.minutesPropertyChangeListener = this.buildMinutesPropertyChangeListener(); - this.minutesHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.minutesPropertyChangeListener); - - this.secondsPropertyChangeListener = this.buildSecondsPropertyChangeListener(); - this.secondsHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.secondsPropertyChangeListener); - - this.dateTimeSelectionListener = this.buildDateTimeSelectionListener(); - this.dateTime.addSelectionListener(this.dateTimeSelectionListener); - - this.dateTimeDisposeListener = this.buildDateTimeDisposeListener(); - this.dateTime.addDisposeListener(this.dateTimeDisposeListener); - - this.updateDateTimeHours(hoursHolder.getValue()); - this.updateDateTimeMinutes(minutesHolder.getValue()); - this.updateDateTimeSeconds(secondsHolder.getValue()); - } - - - // ********** initialization ********** - - protected PropertyChangeListener buildHoursPropertyChangeListener() { - return new SWTPropertyChangeListenerWrapper(this.buildHoursPropertyChangeListener_()); - } - - protected PropertyChangeListener buildHoursPropertyChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - DateTimeModelAdapter.this.hoursChanged(event); - } - @Override - public String toString() { - return "dateTime hours listener"; - } - }; - } - - protected PropertyChangeListener buildMinutesPropertyChangeListener() { - return new SWTPropertyChangeListenerWrapper(this.buildMinutesPropertyChangeListener_()); - } - - protected PropertyChangeListener buildMinutesPropertyChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - DateTimeModelAdapter.this.minutesChanged(event); - } - @Override - public String toString() { - return "dateTime minutes listener"; - } - }; - } - - protected PropertyChangeListener buildSecondsPropertyChangeListener() { - return new SWTPropertyChangeListenerWrapper(this.buildSecondsPropertyChangeListener_()); - } - - protected PropertyChangeListener buildSecondsPropertyChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - DateTimeModelAdapter.this.secondsChanged(event); - } - @Override - public String toString() { - return "dateTime seconds listener"; - } - }; - } - - protected SelectionListener buildDateTimeSelectionListener() { - return new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - DateTimeModelAdapter.this.dateTimeSelected(e); - } - - public void widgetDefaultSelected(SelectionEvent e) { - } - - @Override - public String toString() { - return "dateTime selection listener"; - } - }; - } - - protected DisposeListener buildDateTimeDisposeListener() { - return new DisposeListener() { - public void widgetDisposed(DisposeEvent event) { - DateTimeModelAdapter.this.dateTimeDisposed(event); - } - @Override - public String toString() { - return "dateTime dispose listener"; - } - }; - } - - - // ********** model events ********** - - protected void hoursChanged(PropertyChangeEvent event) { - if (!this.locked) { - this.updateDateTimeHours((Integer) event.getNewValue()); - } - } - - protected void minutesChanged(PropertyChangeEvent event) { - if (!this.locked) { - this.updateDateTimeMinutes((Integer) event.getNewValue()); - } - } - - protected void secondsChanged(PropertyChangeEvent event) { - if (!this.locked) { - this.updateDateTimeSeconds((Integer) event.getNewValue()); - } - } - - // ********** dateTime events ********** - - protected void dateTimeSelected(SelectionEvent event) { - if (!this.locked) { - this.locked = true; - try { - //too bad they didn't split the event up - hoursSelected(); - minutesSelected(); - secondsSelected(); - } - finally { - this.locked = false; - } - } - } - - protected void hoursSelected() { - Integer hours = null; - if (this.dateTime.getHours() != 0) { - hours = Integer.valueOf(this.dateTime.getHours()); - } - this.hoursHolder.setValue(hours); - } - - protected void minutesSelected() { - Integer minutes = null; - if (this.dateTime.getMinutes() != 0) { - minutes = Integer.valueOf(this.dateTime.getMinutes()); - } - this.minutesHolder.setValue(minutes); - } - - protected void secondsSelected() { - Integer seconds = null; - if (this.dateTime.getSeconds() != 0) { - seconds = Integer.valueOf(this.dateTime.getSeconds()); - } - this.secondsHolder.setValue(seconds); - } - - protected void dateTimeDisposed(DisposeEvent event) { - // the dateTime is not yet "disposed" when we receive this event - // so we can still remove our listeners - this.dateTime.removeDisposeListener(this.dateTimeDisposeListener); - this.dateTime.removeSelectionListener(this.dateTimeSelectionListener); - this.hoursHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.hoursPropertyChangeListener); - this.minutesHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.minutesPropertyChangeListener); - this.secondsHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.secondsPropertyChangeListener); - } - - // ********** update ********** - - protected void updateDateTimeHours(Integer hours) { - if (this.dateTime.isDisposed()) { - return; - } - if (hours == null) { - hours = Integer.valueOf(0);//TODO defaultHours - } - this.locked = true; - try { - this.dateTime.setHours(hours.intValue()); - } - finally { - this.locked = false; - } - } - - protected void updateDateTimeMinutes(Integer minutes) { - if (this.dateTime.isDisposed()) { - return; - } - if (minutes == null) { - minutes = Integer.valueOf(0);//TODO defaultMinutes - } - this.locked = true; - try { - this.dateTime.setMinutes(minutes.intValue()); - } - finally { - this.locked = false; - } - } - - protected void updateDateTimeSeconds(Integer seconds) { - if (this.dateTime.isDisposed()) { - return; - } - if (seconds == null) { - seconds = Integer.valueOf(0);//TODO defaultSeconds - } - this.locked = true; - try { - this.dateTime.setSeconds(seconds.intValue()); - } - finally { - this.locked = false; - } - } - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.hoursHolder); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/SpinnerModelAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/SpinnerModelAdapter.java deleted file mode 100644 index dabb63eb3a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/SpinnerModelAdapter.java +++ /dev/null @@ -1,214 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.swt; - -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.widgets.Spinner; - -/** - * - */ -@SuppressWarnings("nls") -public class SpinnerModelAdapter { - - /** - * A value model on the underlying model list. - */ - protected final WritablePropertyValueModel numberHolder; - - /** - * A listener that allows us to synchronize the spinner's contents with - * the model list. - */ - protected final PropertyChangeListener propertyChangeListener; - - /** - * The spinner we keep synchronized with the model string. - */ - protected final Spinner spinner; - - /** - * A listener that allows us to synchronize our selection number holder - * with the spinner's value. - */ - protected final ModifyListener spinnerModifyListener; - - /** - * A listener that allows us to stop listening to stuff when the spinner - * is disposed. - */ - protected final DisposeListener spinnerDisposeListener; - - /** - * The value shown when the number holder's value is null. - */ - protected final int defaultValue; - - /** - * This lock is used to prevent the listeners to be notified when the value - * changes from the spinner or from the holder. - */ - private boolean locked; - - // ********** static methods ********** - - /** - * Adapt the specified model list and selections to the specified spinner. - * Use the specified string converter to convert the model items to strings - * to be displayed in the spinner. - */ - public static SpinnerModelAdapter adapt( - WritablePropertyValueModel numberHolder, - Spinner spinner, - int defaultValue) - { - return new SpinnerModelAdapter(numberHolder, spinner, defaultValue); - } - - - // ********** constructors ********** - - /** - * Constructor - the list holder, selections holder, list box, and - * string converter are required. - */ - protected SpinnerModelAdapter(WritablePropertyValueModel numberHolder, - Spinner spinner, - int defaultValue) { - super(); - if ((numberHolder == null) || (spinner == null)) { - throw new NullPointerException(); - } - this.numberHolder = numberHolder; - this.spinner = spinner; - this.defaultValue = defaultValue; - - this.propertyChangeListener = this.buildPropertyChangeListener(); - this.numberHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.propertyChangeListener); - - this.spinnerModifyListener = this.buildSpinnerModifyListener(); - this.spinner.addModifyListener(this.spinnerModifyListener); - - this.spinnerDisposeListener = this.buildSpinnerDisposeListener(); - this.spinner.addDisposeListener(this.spinnerDisposeListener); - - this.updateSpinner(numberHolder.getValue()); - } - - - // ********** initialization ********** - - protected PropertyChangeListener buildPropertyChangeListener() { - return new SWTPropertyChangeListenerWrapper(this.buildPropertyChangeListener_()); - } - - protected PropertyChangeListener buildPropertyChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - SpinnerModelAdapter.this.valueChanged(event); - } - @Override - public String toString() { - return "spinner listener"; - } - }; - } - - protected ModifyListener buildSpinnerModifyListener() { - return new ModifyListener() { - public void modifyText(ModifyEvent e) { - SpinnerModelAdapter.this.spinnerModified(e); - } - @Override - public String toString() { - return "spinner selection listener"; - } - }; - } - - protected DisposeListener buildSpinnerDisposeListener() { - return new DisposeListener() { - public void widgetDisposed(DisposeEvent event) { - SpinnerModelAdapter.this.spinnerDisposed(event); - } - @Override - public String toString() { - return "spinner dispose listener"; - } - }; - } - - - // ********** model events ********** - - protected void valueChanged(PropertyChangeEvent event) { - if (!this.locked) { - this.updateSpinner((Integer) event.getNewValue()); - } - } - - - // ********** spinner events ********** - - protected void spinnerModified(ModifyEvent event) { - if (!this.locked) { - this.locked = true; - try { - this.numberHolder.setValue(this.spinner.getSelection()); - } - finally { - this.locked = false; - } - } - } - - protected void spinnerDisposed(DisposeEvent event) { - // the spinner is not yet "disposed" when we receive this event - // so we can still remove our listeners - this.spinner.removeDisposeListener(this.spinnerDisposeListener); - this.spinner.removeModifyListener(this.spinnerModifyListener); - this.numberHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.propertyChangeListener); - } - - // ********** update ********** - - protected void updateSpinner(Integer value) { - if (this.spinner.isDisposed()) { - return; - } - // the model can be null, but the spinner cannot - if (value == null) { - value = defaultValue; - } - this.locked = true; - try { - this.spinner.setSelection(value); - } - finally { - this.locked = false; - } - } - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.numberHolder); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/TableItemModelAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/TableItemModelAdapter.java deleted file mode 100644 index cc1a67ec4c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/TableItemModelAdapter.java +++ /dev/null @@ -1,209 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.swt; - -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableItem; - -/** - * This adapter can be used to keep a table item in synch with the properties of - * a model. - */ -@SuppressWarnings("nls") -public class TableItemModelAdapter { - - /** The table item we synchronize with the model. */ - protected final TableItem tableItem; - - /** - * A listener that allows us to stop listening to stuff when the button - * is disposed. - */ - protected final DisposeListener tableItemDisposeListener; - - /** - * Client-supplied adapter that provides with the various column settings and - * converts the objects in the LVM into an array of cell models. - */ - private ColumnAdapter columnAdapter; - - /** - * The value models used to listen to each property that are display by the - * table item. - */ - private WritablePropertyValueModel[] valueHolders; - - /** - * The list of PropertyChangeListeners used to be notified when - * the properties of the model being display into a row change. - */ - private PropertyChangeListener[] propertyChangeListeners; - - /** - * The label used to format the objects into a string representation. - */ - private ITableLabelProvider labelProvider; - - // ********** static methods ********** - - /** - * Adapt the specified boolean to the specified button. - * If the boolean is null, the button's value will be "unselected". - */ - public static TableItemModelAdapter adapt(TableItem tableItem, ColumnAdapter columnAdapter, ITableLabelProvider labelProvider) { - return new TableItemModelAdapter(tableItem, columnAdapter, labelProvider); - } - - - // ********** constructors ********** - - /** - * Constructor - the boolean holder and button are required. - */ - @SuppressWarnings("unchecked") - protected TableItemModelAdapter(TableItem tableItem, ColumnAdapter columnAdapter, ITableLabelProvider labelProvider) { - super(); - if (tableItem == null || columnAdapter == null || labelProvider == null) { - throw new NullPointerException(); - } - this.tableItem = tableItem; - this.labelProvider = labelProvider; - this.columnAdapter = (ColumnAdapter) columnAdapter; - - this.tableItemDisposeListener = this.buildTableItemDisposeListener(); - this.tableItem.addDisposeListener(this.tableItemDisposeListener); - - this.valueHolders = this.columnAdapter.cellModels(tableItem.getData()); - this.propertyChangeListeners = this.buildPropertyChangeListeners(); - - for (int index = this.columnAdapter.columnCount(); --index >= 0; ) { - tableItemChanged(index, tableItem.getData(), false); - valueHolders[index].addPropertyChangeListener(PropertyValueModel.VALUE, propertyChangeListeners[index]); - } - } - - - // ********** initialization ********** - - private PropertyChangeListener[] buildPropertyChangeListeners() { - PropertyChangeListener[] listeners = new PropertyChangeListener[columnAdapter.columnCount()]; - for (int index = listeners.length; --index >= 0; ) { - listeners[index] = buildPropertyChangeListener(index); - } - return listeners; - } - - - protected PropertyChangeListener buildPropertyChangeListener(int index) { - return new SWTPropertyChangeListenerWrapper( - this.buildPropertyChangeListener_(index) - ); - } - - protected PropertyChangeListener buildPropertyChangeListener_(int index) { - return new TableItemPropertyChangeListener(index); - } - - protected DisposeListener buildTableItemDisposeListener() { - return new DisposeListener() { - public void widgetDisposed(DisposeEvent event) { - TableItemModelAdapter.this.tableItemDisposed(event); - } - @Override - public String toString() { - return "TableItem dispose listener"; - } - }; - } - - - // ********** behavior ********** - - protected void tableItemChanged(int index, Object subject, boolean revalidate) { - - if (!this.tableItem.isDisposed()) { - this.updateTableItemText(index, subject); - this.updateTableItemImage(index, subject); - - if (revalidate) { - this.layoutTable(); - } - } - } - - private void updateTableItemText(int index, Object subject) { - String text = this.labelProvider.getColumnText(subject, index); - if (text == null) { - text = ""; - } - this.tableItem.setText(index, text); - } - - private void updateTableItemImage(int index, Object subject) { - Image image = this.labelProvider.getColumnImage(subject, index); - this.tableItem.setImage(index, image); - } - - private void layoutTable() { - // Refresh the table in order to show the scrollbar if required - Composite container = this.tableItem.getParent().getParent(); - container.computeSize(SWT.DEFAULT, SWT.DEFAULT); - container.layout(); - } - - // ********** dispose ********** - - protected void tableItemDisposed(DisposeEvent event) { - // the button is not yet "disposed" when we receive this event - // so we can still remove our listeners - this.tableItem.removeDisposeListener(this.tableItemDisposeListener); - - for (int index = valueHolders.length; --index >= 0; ) { - valueHolders[index].removePropertyChangeListener(PropertyValueModel.VALUE, propertyChangeListeners[index]); - } - } - - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - - private class TableItemPropertyChangeListener implements PropertyChangeListener { - - private final int index; - - TableItemPropertyChangeListener(int index) { - super(); - this.index = index; - } - - public void propertyChanged(PropertyChangeEvent event) { - if (!tableItem.isDisposed()) { - Table table = tableItem.getParent(); - tableItemChanged(index, tableItem.getData(), table.getColumnCount() == 0); - } - } - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/TableModelAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/TableModelAdapter.java deleted file mode 100644 index 8d3b4e3af9..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/TableModelAdapter.java +++ /dev/null @@ -1,746 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.swt; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.EventListener; -import java.util.EventObject; -import java.util.Iterator; -import java.util.List; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jpt.common.ui.internal.listeners.SWTCollectionChangeListenerWrapper; -import org.eclipse.jpt.common.ui.internal.listeners.SWTListChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.ListenerList; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyCollectionValueModelAdapter; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritableCollectionValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.TableItem; - -/** - * This adapter provides a more object-oriented interface to the items and - * selected items in a table. - * {@link #listHolder} contains the data of a single column in the table. - * {@link #selectedItemsHolder} contains the data of a single column in - * {@link #listHolder} that are selected in the table. - */ -// TODO bjv -@SuppressWarnings("nls") -public class TableModelAdapter { - - // ********** model ********** - /** - * A value model on the underlying model list. - */ - protected final ListValueModel listHolder; - - /** - * A listener that allows us to synchronize the table's contents with - * the model list. - */ - protected final ListChangeListener listChangeListener; - - /** - * A value model on the underlying model selections. - */ - protected final CollectionValueModel selectedItemsHolder; - - /** - * A listener that allows us to synchronize the table's selection with - * the model selections. - */ - protected final CollectionChangeListener selectedItemsChangeListener; - - /** - * The table we keep synchronized with the model list. - */ - protected final Table table; - - /** - * A listener that allows us to synchronize our selection list holder - * with the table's selection. - */ - protected final SelectionListener tableSelectionListener; - - /** - * Clients that are interested in selection change events. - */ - protected final ListenerList> selectionChangeListenerList; - - /** - * Clients that are interested in double click events. - */ - protected final ListenerList> doubleClickListenerList; - - /** - * A listener that allows us to stop listening to stuff when the table - * is disposed. - */ - protected final DisposeListener tableDisposeListener; - - /** - * This label provider is responsible to convert a property at a column index - * to a string value. - */ - protected final ITableLabelProvider labelProvider; - - /** - * The column adapter is responsible to return the count of columns and to - * create the value holders for all the properties. - */ - private ColumnAdapter columnAdapter; - - /** - * Keeps track of the TableItemModelAdapters that were created - * for each item of the list holder. - */ - private List tableItemModelAdapters; - - - // ********** static methods ********** - - /** - * Adapt the specified list model and selection to the specified table. - * Use the specified string converter to convert the model items to strings - * to be displayed in the table. - */ - public static TableModelAdapter adapt( - ListValueModel listHolder, - PropertyValueModel selectedItemHolder, - Table table, - ColumnAdapter columnAdapter, - ITableLabelProvider labelProvider) { - - return new TableModelAdapter( - listHolder, - new PropertyCollectionValueModelAdapter(selectedItemHolder), - table, - columnAdapter, - labelProvider); - } - - /** - * Adapt the specified list model and selection to the specified table. - * The specified selection model will be kept in sync with the table. - * Use the specified string converter to convert the model items to strings - * to be displayed in the table. - */ - public static TableModelAdapter adapt( - ListValueModel listHolder, - WritableCollectionValueModel selectionModel, - Table table, - ColumnAdapter columnAdapter, - ITableLabelProvider labelProvider) { - - TableModelAdapter adapter = - new TableModelAdapter( - listHolder, - selectionModel, - table, - columnAdapter, - labelProvider); - adapter.addSelectionChangeListener(buildSyncListener(selectionModel)); - return adapter; - } - - private static SelectionChangeListener buildSyncListener( - final WritableCollectionValueModel selectionModel) { - - return new SelectionChangeListener() { - public void selectionChanged(SelectionChangeEvent event) { - selectionModel.setValues(CollectionTools.iterable(event.selection())); - } - }; - } - - - // ********** constructors ********** - - /** - * Constructor - the list holder, selections holder, table, and - * string converter are required. - */ - protected TableModelAdapter( - ListValueModel listHolder, - CollectionValueModel selectedItemsHolder, - Table table, - ColumnAdapter columnAdapter, - ITableLabelProvider labelProvider) - { - super(); - if ((listHolder == null) || (selectedItemsHolder == null) || (table == null) || (labelProvider == null)) { - throw new NullPointerException(); - } - this.listHolder = listHolder; - this.selectedItemsHolder = selectedItemsHolder; - this.table = table; - this.columnAdapter = columnAdapter; - this.labelProvider = labelProvider; - this.tableItemModelAdapters = new ArrayList(columnAdapter.columnCount()); - - this.listChangeListener = this.buildListChangeListener(); - this.listHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - - this.selectedItemsChangeListener = this.buildSelectedItemsChangeListener(); - this.selectedItemsHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.selectedItemsChangeListener); - - this.tableSelectionListener = this.buildTableSelectionListener(); - this.table.addSelectionListener(this.tableSelectionListener); - - this.selectionChangeListenerList = this.buildSelectionChangeListenerList(); - this.doubleClickListenerList = this.buildDoubleClickListenerList(); - - this.tableDisposeListener = this.buildTableDisposeListener(); - this.table.addDisposeListener(this.tableDisposeListener); - - this.synchronizeTable(); - } - - - // ********** initialization ********** - - protected ListChangeListener buildListChangeListener() { - return new SWTListChangeListenerWrapper(this.buildListChangeListener_()); - } - - protected ListChangeListener buildListChangeListener_() { - return new ListChangeListener() { - public void itemsAdded(ListAddEvent event) { - TableModelAdapter.this.listItemsAdded(event); - } - public void itemsRemoved(ListRemoveEvent event) { - TableModelAdapter.this.listItemsRemoved(event); - } - public void itemsMoved(ListMoveEvent event) { - TableModelAdapter.this.listItemsMoved(event); - } - public void itemsReplaced(ListReplaceEvent event) { - TableModelAdapter.this.listItemsReplaced(event); - } - public void listCleared(ListClearEvent event) { - TableModelAdapter.this.listCleared(event); - } - public void listChanged(ListChangeEvent event) { - TableModelAdapter.this.listChanged(event); - } - @Override - public String toString() { - return "TableModelAdapter list listener"; - } - }; - } - - protected CollectionChangeListener buildSelectedItemsChangeListener() { - return new SWTCollectionChangeListenerWrapper(this.buildSelectedItemsChangeListener_()); - } - - protected CollectionChangeListener buildSelectedItemsChangeListener_() { - return new CollectionChangeListener() { - public void itemsAdded(CollectionAddEvent event) { - TableModelAdapter.this.selectedItemsAdded(event); - } - public void itemsRemoved(CollectionRemoveEvent event) { - TableModelAdapter.this.selectedItemsRemoved(event); - } - public void collectionCleared(CollectionClearEvent event) { - TableModelAdapter.this.selectedItemsCleared(event); - } - public void collectionChanged(CollectionChangeEvent event) { - TableModelAdapter.this.selectedItemsChanged(event); - } - @Override - public String toString() { - return "TableModelAdapter selected items listener"; - } - }; - } - - protected SelectionListener buildTableSelectionListener() { - return new SelectionListener() { - public void widgetSelected(SelectionEvent event) { - TableModelAdapter.this.tableSelectionChanged(event); - } - public void widgetDefaultSelected(SelectionEvent event) { - TableModelAdapter.this.tableDoubleClicked(event); - } - @Override - public String toString() { - return "TableModelAdapter table selection listener"; - } - }; - } - - @SuppressWarnings({"rawtypes", "unchecked"}) - protected ListenerList> buildDoubleClickListenerList() { - return new ListenerList(DoubleClickListener.class); - } - - @SuppressWarnings({"rawtypes", "unchecked"}) - protected ListenerList> buildSelectionChangeListenerList() { - return new ListenerList(SelectionChangeListener.class); - } - - protected DisposeListener buildTableDisposeListener() { - return new DisposeListener() { - public void widgetDisposed(DisposeEvent event) { - TableModelAdapter.this.tableDisposed(event); - } - @Override - public String toString() { - return "TableModelAdapter table dispose listener"; - } - }; - } - - protected void synchronizeTable() { - this.synchronizeTableColumns(); - this.synchronizeTableItems(); - this.synchronizeTableSelection(); - } - - - // ********** list ********** - - /** - * Creates the table colums. - */ - protected void synchronizeTableColumns() { - if (this.table.isDisposed()) { - return; - } - - int columnCount = this.columnAdapter.columnCount(); - - for (int index = 0; index < columnCount; index++) { - TableColumn tableColumn = new TableColumn(this.table, SWT.NULL, index); - tableColumn.setMoveable(false); - tableColumn.setResizable(true); - tableColumn.setWidth(100); - - String columnName = this.columnAdapter.columnName(index); - - if (columnName == null) { - columnName = ""; - } - - tableColumn.setText(columnName); - } - } - - /** - * Brute force synchronization of table with the model list. - */ - protected void synchronizeTableItems() { - if (this.table.isDisposed()) { - return; - } - - for (int index = this.table.getItemCount(); --index >= 0; ) { - this.table.remove(index); - this.tableItemModelAdapters.remove(index); - } - - int itemCount = this.listHolder.size(); - - for (int index = 0; index < itemCount; index++) { - - TableItem tableItem = new TableItem(this.table, SWT.NULL, index); - tableItem.setData(this.listHolder.get(index)); - - TableItemModelAdapter adapter = this.buildItemModel(tableItem); - this.tableItemModelAdapters.add(adapter); - } - } - - /** - * The model has changed - synchronize the table. - */ - protected void listItemsAdded(ListAddEvent event) { - - if (this.table.isDisposed()) { - return; - } - - int index = event.getIndex(); - - for (E item : this.getItems(event)) { - - TableItem tableItem = new TableItem(this.table, SWT.NULL, index); - tableItem.setData(item); - - TableItemModelAdapter adapter = this.buildItemModel(tableItem); - this.tableItemModelAdapters.add(index++, adapter); - } - } - - /** - * The model has changed - synchronize the table. - */ - protected void listItemsRemoved(ListRemoveEvent event) { - - if (this.table.isDisposed()) { - return; - } - - this.table.remove(event.getIndex(), event.getIndex() + event.getItemsSize() - 1); - - for (int index = event.getIndex() + event.getItemsSize(); --index >= event.getIndex(); ) { - this.tableItemModelAdapters.remove(index); - } - } - - /** - * The model has changed - synchronize the table. - */ - protected void listItemsMoved(ListMoveEvent event) { - - if (this.table.isDisposed()) { - return; - } - - int length = event.getLength(); - int sourceIndex = event.getSourceIndex(); - int targetIndex = event.getTargetIndex(); - int lowStartIndex = Math.min(targetIndex, sourceIndex); - int hiStartIndex = Math.max(targetIndex, sourceIndex); - - Object[] items = new Object[hiStartIndex - lowStartIndex + length]; - int itemsIndex = items.length; - - // Remove the TableItems wrapping the moved items - for (int index = hiStartIndex + length; --index >= lowStartIndex; ) { - - TableItemModelAdapter tableItemModel = this.tableItemModelAdapters.get(index); - items[--itemsIndex] = tableItemModel.tableItem.getData(); - - // Remove the TableItem, which will also dispose TableItemModelAdapter - this.table.remove(index); - } - - // Move the items so they can retrieved in the right order when - // re-creating the TableItems - ArrayTools.move( - items, - targetIndex - lowStartIndex, - sourceIndex - lowStartIndex, - length - ); - - itemsIndex = 0; - - // Add TableItems for the moved items - for (int index = lowStartIndex; index <= hiStartIndex + length - 1; index++) { - - // Create the new TableItem - TableItem tableItem = new TableItem(this.table, SWT.NULL, index); - tableItem.setData(items[itemsIndex++]); - - // Adapt it with a model adapter - TableItemModelAdapter adapter = this.buildItemModel(tableItem); - this.tableItemModelAdapters.set(index, adapter); - } - } - - - private TableItemModelAdapter buildItemModel(TableItem tableItem) { - return TableItemModelAdapter.adapt( - tableItem, - this.columnAdapter, - this.labelProvider - ); - } - - /** - * The model has changed - synchronize the table. - */ - protected void listItemsReplaced(ListReplaceEvent event) { - if (this.table.isDisposed()) { - return; - } - - int rowIndex = event.getIndex(); - - for (E item : this.getNewItems(event)) { - TableItem tableItem = this.table.getItem(rowIndex); - tableItem.setData(item); - - TableItemModelAdapter adapter = this.tableItemModelAdapters.get(rowIndex); - - int columnCount = this.columnAdapter.columnCount(); - boolean revalidate = (columnCount == 1); - - for (int columnIndex = columnCount; --columnIndex >= 0; ) { - adapter.tableItemChanged(columnIndex, tableItem.getData(), revalidate); - } - - rowIndex++; - } - } - - /** - * The model has changed - synchronize the table. - */ - protected void listCleared(@SuppressWarnings("unused") ListClearEvent event) { - if (this.table.isDisposed()) { - return; - } - this.table.removeAll(); - } - - /** - * The model has changed - synchronize the table. - */ - protected void listChanged(@SuppressWarnings("unused") ListChangeEvent event) { - this.synchronizeTableItems(); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getItems(ListAddEvent event) { - return (Iterable) event.getItems(); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getNewItems(ListReplaceEvent event) { - return (Iterable) event.getNewItems(); - } - - - // ********** selected items ********** - - protected int indexOf(E item) { - int len = this.listHolder.size(); - for (int i = 0; i < len; i++) { - if (this.listHolder.get(i) == item) { - return i; - } - } - return -1; - } - - protected void synchronizeTableSelection() { - if (this.table.isDisposed()) { - return; - } - int[] indices = new int[this.selectedItemsHolder.size()]; - int i = 0; - for (E selectedItemHolder : this.selectedItemsHolder) { - indices[i++] = this.indexOf(selectedItemHolder); - } - this.table.deselectAll(); - this.table.select(indices); - } - - protected void selectedItemsAdded(CollectionAddEvent event) { - if (this.table.isDisposed()) { - return; - } - this.table.select(this.getIndices(event.getItemsSize(), this.getItems(event))); - } - - protected void selectedItemsRemoved(CollectionRemoveEvent event) { - if (this.table.isDisposed()) { - return; - } - this.table.deselect(this.getIndices(event.getItemsSize(), this.getItems(event))); - } - - protected int[] getIndices(int itemsSize, Iterable items) { - int[] indices = new int[itemsSize]; - int i = 0; - for (E item : items) { - indices[i++] = this.indexOf(item); - } - return indices; - } - - protected void selectedItemsCleared(@SuppressWarnings("unused") CollectionClearEvent event) { - if (this.table.isDisposed()) { - return; - } - this.table.deselectAll(); - } - - protected void selectedItemsChanged(@SuppressWarnings("unused") CollectionChangeEvent event) { - this.synchronizeTableSelection(); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getItems(CollectionAddEvent event) { - return (Iterable) event.getItems(); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getItems(CollectionRemoveEvent event) { - return (Iterable) event.getItems(); - } - - - // ********** list box events ********** - - protected void tableSelectionChanged(@SuppressWarnings("unused") SelectionEvent event) { - if (this.selectionChangeListenerList.size() > 0) { - SelectionChangeEvent scEvent = new SelectionChangeEvent(this, this.selectedItems()); - for (SelectionChangeListener selectionChangeListener : this.selectionChangeListenerList.getListeners()) { - selectionChangeListener.selectionChanged(scEvent); - } - } - } - - protected Collection selectedItems() { - if (this.table.isDisposed()) { - return Collections.emptySet(); - } - ArrayList selectedItems = new ArrayList(this.table.getSelectionCount()); - for (int selectionIndex : this.table.getSelectionIndices()) { - selectedItems.add(this.listHolder.get(selectionIndex)); - } - return selectedItems; - } - - protected void tableDoubleClicked(@SuppressWarnings("unused") SelectionEvent event) { - if (this.table.isDisposed()) { - return; - } - if (this.doubleClickListenerList.size() > 0) { - // there should be only a single item selected during a double-click(?) - E selection = this.listHolder.get(this.table.getSelectionIndex()); - DoubleClickEvent dcEvent = new DoubleClickEvent(this, selection); - for (DoubleClickListener doubleClickListener : this.doubleClickListenerList.getListeners()) { - doubleClickListener.doubleClick(dcEvent); - } - } - } - - - // ********** dispose ********** - - protected void tableDisposed(@SuppressWarnings("unused") DisposeEvent event) { - // the table is not yet "disposed" when we receive this event - // so we can still remove our listeners - this.table.removeDisposeListener(this.tableDisposeListener); - this.table.removeSelectionListener(this.tableSelectionListener); - this.selectedItemsHolder.removeCollectionChangeListener(CollectionValueModel.VALUES, this.selectedItemsChangeListener); - this.listHolder.removeListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - } - - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.listHolder); - } - - - // ********** double click support ********** - - public void addDoubleClickListener(DoubleClickListener listener) { - this.doubleClickListenerList.add(listener); - } - - public void removeDoubleClickListener(DoubleClickListener listener) { - this.doubleClickListenerList.remove(listener); - } - - public interface DoubleClickListener extends EventListener { - void doubleClick(DoubleClickEvent event); - } - - public static class DoubleClickEvent extends EventObject { - private final E selection; - private static final long serialVersionUID = 1L; - - protected DoubleClickEvent(TableModelAdapter source, E selection) { - super(source); - if (selection == null) { - throw new NullPointerException(); - } - this.selection = selection; - } - - @Override - @SuppressWarnings("unchecked") - public TableModelAdapter getSource() { - return (TableModelAdapter) super.getSource(); - } - - public E selection() { - return this.selection; - } - - } - - - // ********** selection support ********** - - public void addSelectionChangeListener(SelectionChangeListener listener) { - this.selectionChangeListenerList.add(listener); - } - - public void removeSelectionChangeListener(SelectionChangeListener listener) { - this.selectionChangeListenerList.remove(listener); - } - - public interface SelectionChangeListener extends EventListener { - void selectionChanged(SelectionChangeEvent event); - } - - public static class SelectionChangeEvent extends EventObject { - private final Collection selection; - private static final long serialVersionUID = 1L; - - protected SelectionChangeEvent(TableModelAdapter source, Collection selection) { - super(source); - if (selection == null) { - throw new NullPointerException(); - } - this.selection = selection; - } - - @Override - @SuppressWarnings("unchecked") - public TableModelAdapter getSource() { - return (TableModelAdapter) super.getSource(); - } - - public Iterator selection() { - return this.selection.iterator(); - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/TriStateCheckBoxModelAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/TriStateCheckBoxModelAdapter.java deleted file mode 100644 index 2c16b5b31c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/swt/TriStateCheckBoxModelAdapter.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.swt; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.ui.internal.widgets.TriStateCheckBox; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; - -/** - * This adapter can be used to keep a tri-state check box in synch with - * a model Boolean where the value can be null. - */ -@SuppressWarnings("nls") -public class TriStateCheckBoxModelAdapter { - - /** A value model on the underlying model boolean. */ - protected final WritablePropertyValueModel booleanHolder; - - /** - * A listener that allows us to synchronize the button's selection state with - * the model boolean. - */ - protected final PropertyChangeListener booleanChangeListener; - - /** The check box/toggle button we synchronize with the model boolean. */ - protected final TriStateCheckBox button; - - /** - * A listener that allows us to synchronize the model boolean with - * the button's selection state. - */ - protected final SelectionListener buttonSelectionListener; - - /** - * A listener that allows us to stop listening to stuff when the button - * is disposed. - */ - protected final DisposeListener buttonDisposeListener; - - - // ********** static methods ********** - - /** - * Adapt the specified boolean to the specified button. - * If the boolean is null, the button's value will be "partially checked" - * (i.e. the button will be checked but grayed out). - */ - public static TriStateCheckBoxModelAdapter adapt(WritablePropertyValueModel booleanHolder, TriStateCheckBox button) { - return new TriStateCheckBoxModelAdapter(booleanHolder, button); - } - - - // ********** constructors ********** - - /** - * Constructor - the boolean holder and button are required. - */ - protected TriStateCheckBoxModelAdapter(WritablePropertyValueModel booleanHolder, TriStateCheckBox button) { - super(); - - Assert.isNotNull(booleanHolder, "The boolean holder cannot be null"); - Assert.isNotNull(button, "The check box cannot be null"); - - this.booleanHolder = booleanHolder; - this.button = button; - - this.booleanChangeListener = this.buildBooleanChangeListener(); - this.booleanHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.booleanChangeListener); - - this.buttonDisposeListener = this.buildButtonDisposeListener(); - this.button.addDisposeListener(this.buttonDisposeListener); - - this.buttonSelectionListener = this.buildButtonSelectionListener(); - this.button.addSelectionListener(this.buttonSelectionListener); - - this.setButtonSelection(this.booleanHolder.getValue()); - } - - - // ********** initialization ********** - - protected PropertyChangeListener buildBooleanChangeListener() { - return new SWTPropertyChangeListenerWrapper(this.buildBooleanChangeListener_()); - } - - protected PropertyChangeListener buildBooleanChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - TriStateCheckBoxModelAdapter.this.booleanChanged(event); - } - @Override - public String toString() { - return "tri-state boolean listener"; - } - }; - } - - protected SelectionListener buildButtonSelectionListener() { - return new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - TriStateCheckBoxModelAdapter.this.buttonSelected(event); - } - @Override - public String toString() { - return "tri-state button selection listener"; - } - }; - } - - protected DisposeListener buildButtonDisposeListener() { - return new DisposeListener() { - public void widgetDisposed(DisposeEvent event) { - TriStateCheckBoxModelAdapter.this.buttonDisposed(event); - } - @Override - public String toString() { - return "tri-state button dispose listener"; - } - }; - } - - - // ********** behavior ********** - - /** - * The model has changed - synchronize the button. - * If the new model value is null, use the adapter's default value - * (which is typically false). - */ - protected void booleanChanged(PropertyChangeEvent event) { - this.setButtonSelection((Boolean) event.getNewValue()); - } - - protected void setButtonSelection(Boolean selection) { - if (this.button.isDisposed()) { - return; - } - this.button.setSelection(selection); - } - - /** - * The button has been "selected" - synchronize the model. - */ - protected void buttonSelected(SelectionEvent event) { - if (this.button.isDisposed()) { - return; - } - this.booleanHolder.setValue(button.getSelection()); - } - - - // ********** dispose ********** - - protected void buttonDisposed(DisposeEvent event) { - // the button is not yet "disposed" when we receive this event - // so we can still remove our listeners - this.button.removeSelectionListener(this.buttonSelectionListener); - this.button.removeDisposeListener(this.buttonDisposeListener); - this.booleanHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.booleanChangeListener); - } - - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.booleanHolder); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/ControlAligner.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/ControlAligner.java deleted file mode 100644 index ebbd1eed4c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/ControlAligner.java +++ /dev/null @@ -1,913 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import org.eclipse.core.runtime.Assert; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Event; -import org.eclipse.swt.widgets.Listener; - -/** - * This class is responsible to set a preferred width on the registered widgets - * (either Control or ControlAligner) based on the - * widest widget. - *

- * Important: The layout data has to be a GridData. If none is set, - * then a new GridData is automatically created. - *

- * Here an example of the result if this aligner is used to align controls - * within either one or two group boxes, the controls added are the labels in - * this case. It is also possible to align controls on the right side of the - * main component, a spacer can be used for extra space. - *

- * Here's an example: - *

- * - Group Box 1 --------------------------------------------------------------
- * |                     -------------------------------------- ------------- |
- * | Name:               | I                                  | | Browse... | |
- * |                     -------------------------------------- ------------- |
- * |                     ---------                                            |
- * | Preallocation Size: |     |I|                                            |
- * |                     ---------                                            |
- * |                     --------------------------------------               |
- * | Descriptor:         |                                  |v|               |
- * |                     --------------------------------------               |
- * ----------------------------------------------------------------------------
- *
- * - Group Box 2 --------------------------------------------------------------
- * |                     --------------------------------------               |
- * | Mapping Type:       |                                  |V|               |
- * |                     --------------------------------------               |
- * |                     --------------------------------------               |
- * | Check in Script:    | I                                  |               |
- * |                     --------------------------------------               |
- * ----------------------------------------------------------------------------
- * - * @version 2.0 - * @since 2.0 - */ -@SuppressWarnings("nls") -public final class ControlAligner -{ - /** - * Flag used to prevent a validation so it can be done after an operation - * completed. - */ - private boolean autoValidate; - - /** - * The utility class used to support bound properties. - */ - private Collection changeSupport; - - /** - * The listener added to each of the controls that listens only to a text - * change. - */ - private Listener listener; - - /** - * Prevents infinite recursion when recalculating the preferred width. - * This happens in an hierarchy of ControlAligners. The lock - * has to be placed here and not in the {@link ControlAlignerWrapper}. - */ - private boolean locked; - - /** - * The length of the widest control. If the length was not calculated, then - * this value is 0. - */ - private int maximumWidth; - - /** - * The collection of {@link Wrapper}s encapsulating either Controls - * or {@link ControlAligner}s. - */ - private Collection wrappers; - - /** - * A null-Point object used to clear the preferred size. - */ - private static final Point DEFAULT_SIZE = new Point(SWT.DEFAULT, SWT.DEFAULT); - - /** - * The types of events to listen in order to properly adjust the size of all - * the widgets. - */ - private static final int[] EVENT_TYPES = { - SWT.Dispose, - SWT.Hide, - SWT.Resize, - SWT.Show - }; - - /** - * Creates a new ControlAligner. - */ - public ControlAligner() { - super(); - initialize(); - } - - /** - * Creates a new ControlAligner. - * - * @param controls The collection of Controls - */ - public ControlAligner(Collection controls) { - this(); - addAllControls(controls); - } - - /** - * Adds the given control. Its width will be used along with the width of all - * the other registered controls in order to get the greater witdh and use - * it as the width for all the controls. - * - * @param control The Control to be added - */ - public void add(Control control) { - - Assert.isNotNull(control, "Can't add null to this ControlAligner"); - - Wrapper wrapper = buildWrapper(control); - wrapper.addListener(listener); - wrappers.add(wrapper); - - revalidate(false); - } - - /** - * Adds the given control. Its width will be used along with the width of all - * the other registered controls in order to get the greater witdh and use - * it as the width for all the controls. - * - * @param controlAligner The ControlAligner to be added - * @exception IllegalArgumentException Can't add the ControlAligner - * to itself - */ - public void add(ControlAligner controlAligner) { - - Assert.isNotNull(controlAligner, "Can't add null to this ControlAligner"); - Assert.isLegal(controlAligner != this, "Can't add the ControlAligner to itself"); - - Wrapper wrapper = buildWrapper(controlAligner); - wrapper.addListener(listener); - wrappers.add(wrapper); - - if (!controlAligner.wrappers.isEmpty()) { - revalidate(false); - } - } - - /** - * Adds the items contained in the given collection into this - * ControlAligner. The preferred width of each item will be - * used along with the width of all the other items in order to get the - * widest control and use its width as the width for all the controls. - * - * @param aligners The collection of ControlAligners - */ - public void addAllControlAligners(Collection aligners) { - - // Deactivate the auto validation while adding all the Controls and/or - // ControlAligners in order to improve performance - boolean oldAutoValidate = autoValidate; - autoValidate = false; - - for (ControlAligner aligner : aligners) { - add(aligner); - } - - autoValidate = oldAutoValidate; - revalidate(false); - } - - /** - * Adds the items contained in the given collection into this - * ControlAligner. The preferred width of each item will be - * used along with the width of all the other items in order to get the - * widest control and use its width as the width for all the controls. - * - * @param controls The collection of Controls - */ - public void addAllControls(Collection controls) { - - // Deactivate the auto validation while adding all the Controls and/or - // ControlAligners in order to improve performance - boolean oldAutoValidate = autoValidate; - autoValidate = false; - - for (Control control : controls) { - add(control); - } - - autoValidate = oldAutoValidate; - revalidate(false); - } - - /** - * Adds the given ControListener. - * - * @param listener The Listener to be added - */ - private void addListener(Listener listener) { - - if (changeSupport == null) { - changeSupport = new ArrayList(); - } - - changeSupport.add(listener); - } - - /** - * Creates a new Wrapper that encapsulates the given source. - * - * @param control The control to be wrapped - * @return A new {@link Wrapper} - */ - private Wrapper buildWrapper(Control control) { - return new ControlWrapper(control); - } - - /** - * Creates a new Wrapper that encapsulates the given source. - * - * @param ControlAligner The ControlAligner to be wrapped - * @return A new {@link ControlAlignerWrapper} - */ - private Wrapper buildWrapper(ControlAligner ControlAligner) { - return new ControlAlignerWrapper(ControlAligner); - } - - /** - * Calculates the width taken by the widgets and returns the maximum width. - * - * @param recalculateSize true to recalculate the preferred size - * of all the wrappers contained within them rather than using the cached - * size; false to use the cached size - */ - private int calculateWidth(boolean recalculateSize) { - - int width = 0; - - for (Wrapper wrapper : wrappers) { - Point size = wrapper.cachedSize(); - - // The size has not been calculated yet - if (recalculateSize || (size.x == 0)) { - size = wrapper.calculateSize(); - } - - // Only keep the greatest width - width = Math.max(size.x, width); - } - - return width; - } - - /** - * Reports a bound property change. - * - * @param oldValue the old value of the property (as an int) - * @param newValue the new value of the property (as an int) - */ - private void controlResized(int oldValue, int newValue) { - - if ((changeSupport != null) && (oldValue != newValue)) { - Event event = new Event(); - event.widget = SWTUtil.getShell(); - event.data = this; - - for (Listener listener : changeSupport) { - listener.handleEvent(event); - } - } - } - - /** - * Disposes this ControlAligner, this can improve the speed of - * disposing a pane. When a pane is disposed, this aligner doesn't need to - * revalidate its size upon dispose of its widgets. - */ - public void dispose() { - - for (Iterator iter = wrappers.iterator(); iter.hasNext(); ) { - Wrapper wrapper = iter.next(); - wrapper.removeListener(listener); - iter.remove(); - } - - this.wrappers.clear(); - } - - /** - * Returns the length of the widest control. If the length was not - * calculated, then this value is 0. - * - * @return The width of the widest control or 0 if the length has not been - * calculated yet - */ - public int getMaximumWidth() { - return maximumWidth; - } - - /** - * Initializes this ControlAligner. - */ - private void initialize() { - - this.autoValidate = true; - this.maximumWidth = 0; - this.listener = new ListenerHandler(); - this.wrappers = new ArrayList(); - } - - /** - * Invalidates the size of the given object. - * - * @param source The source object to be invalidated - */ - private void invalidate(Object source) { - - Wrapper wrapper = retrieveWrapper(source); - - if (!wrapper.locked()) { - Point size = wrapper.cachedSize(); - size.x = size.y = 0; - wrapper.setSize(DEFAULT_SIZE); - } - } - - /** - * Updates the maximum length based on the widest control. This methods - * does not update the width of the controls. - * - * @param recalculateSize true to recalculate the preferred size - * of all the wrappers contained within them rather than using the cached - * size; false to use the cached size - */ - private void recalculateWidth(boolean recalculateSize) { - - int width = calculateWidth(recalculateSize); - - try { - locked = true; - setMaximumWidth(width); - } - finally { - locked = false; - } - } - - /** - * Removes the given control. Its preferred width will not be used when - * calculating the preferred width. - * - * @param control The control to be removed - * @exception AssertionFailedException If the given Control is - * null - */ - public void remove(Control control) { - - Assert.isNotNull(control, "The Control to remove cannot be null"); - - Wrapper wrapper = retrieveWrapper(control); - wrapper.removeListener(listener); - wrappers.remove(wrapper); - - revalidate(true); - } - - /** - * Removes the given ControlAligner. Its preferred width - * will not be used when calculating the preferred witdh. - * - * @param controlAligner The ControlAligner to be removed - * @exception AssertionFailedException If the given ControlAligner - * is null - */ - public void remove(ControlAligner controlAligner) { - - Assert.isNotNull(controlAligner, "The ControlAligner to remove cannot be null"); - - Wrapper wrapper = retrieveWrapper(controlAligner); - wrapper.removeListener(listener); - wrappers.remove(wrapper); - - revalidate(true); - } - - /** - * Removes the given Listener. - * - * @param listener The Listener to be removed - */ - private void removeListener(Listener listener) { - - changeSupport.remove(listener); - - if (changeSupport.isEmpty()) { - changeSupport = null; - } - } - - /** - * Retrieves the Wrapper that is encapsulating the given object. - * - * @param source Either a Control or a ControlAligner - * @return Its Wrapper - */ - private Wrapper retrieveWrapper(Object source) { - - for (Wrapper wrapper : wrappers) { - if (wrapper.source() == source) { - return wrapper; - } - } - - throw new IllegalArgumentException("Can't retrieve the Wrapper for " + source); - } - - /** - * If the count of control is greater than one and {@link #isAutoValidate()} - * returns true, then the size of all the registered - * Controls will be udpated. - * - * @param recalculateSize true to recalculate the preferred size - * of all the wrappers contained within them rather than using the cached - * size; false to use the cached size - */ - private void revalidate(boolean recalculateSize) { - - if (autoValidate) { - recalculateWidth(recalculateSize); - updateWrapperSize(recalculateSize); - } - } - - /** - * Bases on the information contained in the given Event, - * resize the controls. - * - * @param event The Event sent by the UI thread when the state - * of a widget changed - */ - private void revalidate(Event event) { - - // We don't need to revalidate during a revalidation process - if (locked) { - return; - } - - Object source; - - if (event.widget != SWTUtil.getShell()) { - source = event.widget; - Control control = (Control) source; - - // When a dialog is opened, we need to actually force a layout of - // the controls, this is required because the control is actually - // not visible when the preferred width is caculated - if (control == control.getShell()) { - if (event.type == SWT.Dispose) { - return; - } - - source = null; - } - } - else { - source = event.data; - } - - // Either remove the ControlWrapper if the widget was disposed or - // invalidate the widget in order to recalculate the preferred size - if (source != null) { - if (event.type == SWT.Dispose) { - Wrapper wrapper = retrieveWrapper(source); - wrappers.remove(wrapper); - } - else { - invalidate(source); - } - } - - // Now revalidate all the Controls and ControlAligners - revalidate(true); - } - - /** - * Sets the length of the widest control. If the length was not calulcated, - * then this value is 0. - * - * @param maximumWidth The width of the widest control - */ - private void setMaximumWidth(int maximumWidth) { - - int oldMaximumWidth = this.maximumWidth; - this.maximumWidth = maximumWidth; - controlResized(oldMaximumWidth, maximumWidth); - } - - /** - * Returns a string representation of this ControlAligner. - * - * @return Information about this object - */ - @Override - public String toString() { - - StringBuffer sb = new StringBuffer(); - sb.append("maximumWidth="); - sb.append(maximumWidth); - sb.append(", wrappers="); - sb.append(wrappers); - return StringTools.buildToStringFor(this, sb); - } - - /** - * Updates the size of every Wrapper based on the maximum width. - * - * @param forceRevalidate true to revalidate the wrapper's size - * even though its current size might be the same as the maximum width; - * false to only revalidate the wrappers with a different width - */ - private void updateWrapperSize(boolean forceRevalidate) { - - for (Wrapper wrapper : wrappers) { - Point cachedSize = wrapper.cachedSize(); - - // No need to change the size of the wrapper since it's always using - // the maximum width - if (forceRevalidate || (cachedSize.x != maximumWidth)) { - Point size = new Point(maximumWidth, cachedSize.y); - wrapper.setSize(size); - } - } - } - - /** - * This Wrapper encapsulates a {@link ControlAligner}. - */ - private class ControlAlignerWrapper implements Wrapper { - /** - * The cached size, which is {@link ControlAligner#maximumWidth}. - */ - private final Point cachedSize; - - /** - * The ControlAligner encapsulated by this - * Wrapper. - */ - private final ControlAligner controlAligner; - - /** - * Creates a new ControlAlignerWrapper that encapsulates - * the given ControlAligner. - * - * @param controlAligner The ControlAligner to be - * encapsulated by this Wrapper - */ - private ControlAlignerWrapper(ControlAligner controlAligner) { - super(); - this.controlAligner = controlAligner; - this.cachedSize = new Point(controlAligner.maximumWidth, 0); - } - - /* - * (non-Javadoc) - */ - public void addListener(Listener listener) { - controlAligner.addListener(listener); - } - - /* - * (non-Javadoc) - */ - public Point cachedSize() { - cachedSize.x = controlAligner.maximumWidth; - return cachedSize; - } - - /* - * (non-Javadoc) - */ - public Point calculateSize() { - - Point size = new Point(controlAligner.calculateWidth(false), 0); - - if (size.x != SWT.DEFAULT) { - cachedSize.x = size.x; - } - else { - cachedSize.x = 0; - } - - if (size.y != SWT.DEFAULT) { - cachedSize.y = size.y; - } - else { - cachedSize.y = 0; - } - - return size; - } - - /* - * (non-Javadoc) - */ - public boolean locked() { - return controlAligner.locked; - } - - /* - * (non-Javadoc) - */ - public void removeListener(Listener listener) { - controlAligner.removeListener(listener); - } - - /* - * (non-Javadoc) - */ - public void setSize(Point size) { - - if (size == DEFAULT_SIZE) { - controlAligner.maximumWidth = 0; - } - else if (controlAligner.maximumWidth != size.x) { - controlAligner.maximumWidth = size.x; - controlAligner.updateWrapperSize(true); - } - } - - /* - * (non-Javadoc) - */ - public Object source() { - return controlAligner; - } - - /* - * (non-Javadoc) - */ - @Override - public String toString() { - - StringBuffer sb = new StringBuffer(); - sb.append("Cached size="); - sb.append(cachedSize); - sb.append(", ControlAligner="); - sb.append(controlAligner); - return StringTools.buildToStringFor(this, sb); - } - } - - /** - * This Wrapper encapsulates a {@link Control}. - */ - private class ControlWrapper implements Wrapper { - /** - * The cached size, which is control's size. - */ - private Point cachedSize; - - /** - * The control to be encapsulated by this Wrapper. - */ - private final Control control; - - /** - * Creates a new controlWrapper that encapsulates the given - * control. - * - * @param control The control to be encapsulated by this Wrapper - */ - private ControlWrapper(Control control) { - super(); - - this.control = control; - this.cachedSize = new Point(0, 0); - } - - /* - * (non-Javadoc) - */ - public void addListener(Listener listener) { - - for (int eventType : EVENT_TYPES) { - control.addListener(eventType, listener); - } - } - - /* - * (non-Javadoc) - */ - public Point cachedSize() { - return cachedSize; - } - - /* - * (non-Javadoc) - */ - public Point calculateSize() { - - cachedSize = control.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); - - // Update right away the control's GridData - GridData gridData = (GridData) control.getLayoutData(); - - if (gridData == null) { - gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); - control.setLayoutData(gridData); - } - - gridData.widthHint = cachedSize.x; - gridData.heightHint = cachedSize.y; - - // Make sure the size is not -1 - if (cachedSize.x == SWT.DEFAULT) { - cachedSize.x = 0; - } - - if (cachedSize.y == SWT.DEFAULT) { - cachedSize.y = 0; - } - - return cachedSize; - } - - /* - * (non-Javadoc) - */ - public boolean locked() { - return false; - } - - /* - * (non-Javadoc) - */ - public void removeListener(Listener listener) { - - for (int eventType : EVENT_TYPES) { - control.removeListener(eventType, listener); - } - } - - /* - * (non-Javadoc) - */ - public void setSize(Point size) { - - if (control.isDisposed()) { - return; - } - - // Update the GridData with the new size - GridData gridData = (GridData) control.getLayoutData(); - - if (gridData == null) { - gridData = new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING); - control.setLayoutData(gridData); - } - - gridData.widthHint = size.x; - gridData.heightHint = size.y; - - // Force the control to be resized, and tell its parent to layout - // its widgets - if (size.x > 0) { -// locked = true; -// try { -//// control.getParent().layout(new Control[] { control }); -// control.getParent().layout(true); -// } -// finally { -// locked = false; -// } - Rectangle bounds = control.getBounds(); - - // Only update the control's width if it's - // different from the current size - if (bounds.width != size.x) { - locked = true; - - try { -// control.setBounds(bounds.x, bounds.y, size.x, size.y); - control.getParent().layout(true); - } - finally - { - locked = false; - } - } - } - } - - /* - * (non-Javadoc) - */ - public Control source() { - return control; - } - - /* - * (non-Javadoc) - */ - @Override - public String toString() { - - StringBuffer sb = new StringBuffer(); - sb.append("Cached size="); - sb.append(cachedSize); - sb.append(", Control="); - sb.append(control); - return StringTools.buildToStringFor(this, sb); - } - } - - /** - * The listener added to each of the control that is notified in order to - * revalidate the preferred size. - */ - private class ListenerHandler implements Listener { - public void handleEvent(Event event) { - ControlAligner.this.revalidate(event); - } - } - - /** - * This Wrapper helps to encapsulate heterogeneous objects and - * apply the same behavior on them. - */ - private interface Wrapper { - /** - * Adds the given Listener to wrapped object in order to - * receive notification when its property changed. - * - * @param listener The Listener to be added - */ - void addListener(Listener listener); - - /** - * Returns the cached size of the encapsulated source. - * - * @return A non-null Point where the x is the - * width and the y is the height of the widget - */ - Point cachedSize(); - - /** - * Calculates the preferred size the wrapped object would take by itself. - * - * @return The calculated size - */ - Point calculateSize(); - - /** - * Prevents infinite recursion when recalculating the preferred width. - * This happens in an hierarchy of ControlAligners. - * - * @return true to prevent this Wrapper from - * being invalidated; otherwise false - */ - boolean locked(); - - /** - * Removes the given Listener. - * - * @param listener The Listener to be removed - */ - void removeListener(Listener listener); - - /** - * Sets the size on the encapsulated source. - * - * @param size The new size - */ - void setSize(Point size); - - /** - * Returns the encapsulated object. - * - * @return The object that is been wrapped - */ - Object source(); - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/ControlSwitcher.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/ControlSwitcher.java deleted file mode 100644 index 1d527ff73f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/ControlSwitcher.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.util; - -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; -import org.eclipse.ui.part.PageBook; - -/** - * This controller is responsible to switch the active page based on a value. A - * Transformer is used to transformed that value into a - * Control. - * - * @version 2.3 - * @since 2.0 - */ -public final class ControlSwitcher -{ - /** - * The widget that is used to show the active Control. - */ - private PageBook pageBook; - - /** - * The Transformer used to transform the value into a - * Control. - */ - private Transformer paneTransformer; - - private Label emptyLabel; - - /** - * Creates a new ControlSwitcher. - * - * @param switchHolder The holder of the value that will be used to retrieve - * the right Control when passed to the given transformer - * @param paneTransformer The Transformer used to transform the value into a - * Control - * @param pageBook The Transformer used to transform the value - * into a Control - */ - public ControlSwitcher(PropertyValueModel switchHolder, - Transformer paneTransformer, - PageBook pageBook) - { - super(); - initialize(switchHolder, paneTransformer, pageBook); - } - - private void initialize(PropertyValueModel switchHolder, - Transformer paneTransformer, - PageBook pageBook) - { - this.pageBook = pageBook; - this.paneTransformer = paneTransformer; - - this.emptyLabel = this.buildEmptyLabel(); - - switchHolder.addPropertyChangeListener( - PropertyValueModel.VALUE, - buildPropertyChangeListener() - ); - - switchPages(switchHolder.getValue()); - } - - //Build an empty label to display in the page book when the paneTransformer returns null. - //SWT.SHADOW_NONE makes the line separator not visible - //This is the best we can come up with for an empty page - private Label buildEmptyLabel() { - return new Label(this.pageBook, SWT.SEPARATOR | SWT.SHADOW_NONE | SWT.HORIZONTAL); - } - - private PropertyChangeListener buildPropertyChangeListener() { - return new SWTPropertyChangeListenerWrapper( - buildPropertyChangeListener_() - ); - } - - private PropertyChangeListener buildPropertyChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - switchPages(e.getNewValue()); - } - }; - } - - /** - * Switches the active page by transforming the given value into its - * corresponding pane. - * - * @param value The state passed to the transformer in order to retrieve the - * new pane - */ - private void switchPages(Object value) { - if (this.pageBook.isDisposed()) { - return; - } - - // Retrieve the Control for the new value - Control page = transform(value); - - if (page == null) { - //Note: We can't pass in null due to a bug in PageBook - page = this.emptyLabel; - } - this.pageBook.showPage(page); - - // Revalidate the parents in order to update the layout - SWTUtil.reflow(this.pageBook); - } - - @SuppressWarnings("unchecked") - private Control transform(Object value) { - return ((Transformer) this.paneTransformer).transform(value); - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/LabeledButton.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/LabeledButton.java deleted file mode 100644 index a1d6d2979a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/LabeledButton.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.util; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Button; - -/** - * A default implementation of LabeledControl that updates a - * Button when required. - * - * @version 2.0 - * @since 2.0 - */ -@SuppressWarnings("nls") -public final class LabeledButton implements LabeledControl -{ - /** - * The button to be updated with a different icon and text. - */ - private final Button button; - - /** - * Creates a new LabeledButton. - * - * @param button The button that will have its text and icon updated when - * required - * @exception AssertionFailedException If the given Button is - * null - */ - public LabeledButton(Button button) { - super(); - - Assert.isNotNull(button, "The button cannot be null"); - this.button = button; - } - - /* - * (non-Javadoc) - */ - public void setImage(Image image) { - if (!this.button.isDisposed()) { - this.button.setImage(image); - this.button.getParent().layout(true); - } - } - - /* - * (non-Javadoc) - */ - public void setText(String text) { - if (!this.button.isDisposed()) { - this.button.setText(text); - this.button.getParent().layout(true); - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/LabeledControl.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/LabeledControl.java deleted file mode 100644 index 2cef0dc8b2..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/LabeledControl.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.util; - -import org.eclipse.swt.graphics.Image; - -/** - * This LabeledControl is used to encapsulate a widget and update - * its properties (icon and text). - * - * @see LabeledButton - * @see LabeledLabel - * - * @version 2.0 - * @since 2.0 - */ -public interface LabeledControl { - /** - * Passes the image so the wrapped component can receive it. - * - * @param image The new Image - */ - void setImage(Image image); - - /** - * Passes the text so the wrapped component can receive it. - * - * @param text The new text - */ - void setText(String text); -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/LabeledControlUpdater.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/LabeledControlUpdater.java deleted file mode 100644 index 8be981398a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/LabeledControlUpdater.java +++ /dev/null @@ -1,130 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.util; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.swt.graphics.Image; - -/** - * This updater is responsible to update the LabeledControl when - * the text and the icon need to change. - * - * @version 2.0 - * @since 2.0 - */ -@SuppressWarnings("nls") -public final class LabeledControlUpdater { - - /** - * The wrapper around a control that has text and icon. - */ - private LabeledControl labeledControl; - - /** - * Creates a new LabeledControlUpdater. - * - * @param labeledControl The wrapper around the control that needs to - * have its text updated - * @param textHolder The holder this class will listen for changes - */ - public LabeledControlUpdater(LabeledControl labeledControl, - PropertyValueModel textHolder) - { - this(labeledControl, textHolder, null); - } - - /** - * Creates a new LabeledControlUpdater. - * - * @param labeledControl The wrapper around the control that needs to - * have its image and text updated - * @param imageHolder The holder this class will listen for changes or - * null if the text never changes - * @param textHolder The holder this class will listen for changes or - * null if the image never changes - */ - public LabeledControlUpdater(LabeledControl labeledControl, - PropertyValueModel textHolder, - PropertyValueModel imageHolder) - { - super(); - initialize(labeledControl, textHolder, imageHolder); - } - - private PropertyChangeListener buildIconListener() { - return new SWTPropertyChangeListenerWrapper(buildIconListener_()); - } - - private PropertyChangeListener buildIconListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - LabeledControlUpdater.this.setImage((Image) e.getNewValue()); - } - - @Override - public String toString() { - return "LabeledControlUpdater.imageListener"; - } - }; - } - - private PropertyChangeListener buildTextListener() { - return new SWTPropertyChangeListenerWrapper(buildTextListener_()); - } - - private PropertyChangeListener buildTextListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - LabeledControlUpdater.this.setText((String) e.getNewValue()); - } - - @Override - public String toString() { - return "LabeledControlUpdater.textListener"; - } - }; - } - - private void initialize(LabeledControl labeledControl, - PropertyValueModel textHolder, - PropertyValueModel imageHolder) - { - Assert.isNotNull(labeledControl, "The LabeledControl cannot be null"); - - this.labeledControl = labeledControl; - - if (textHolder != null) { - textHolder.addPropertyChangeListener(PropertyValueModel.VALUE, buildTextListener()); - setText(textHolder.getValue()); - } - - if (imageHolder != null) { - imageHolder.addPropertyChangeListener(PropertyValueModel.VALUE, buildIconListener()); - setImage(imageHolder.getValue()); - } - } - - private void setImage(Image icon) { - labeledControl.setImage(icon); - } - - private void setText(String text) { - - if (text == null) { - text = ""; - } - - labeledControl.setText(text); - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/LabeledLabel.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/LabeledLabel.java deleted file mode 100644 index c74ef06559..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/LabeledLabel.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.util; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Label; - -/** - * A default implementation of LabeledControl that updates an - * Label when required. - * - * @version 2.0 - * @since 2.0 - */ -@SuppressWarnings("nls") -public final class LabeledLabel implements LabeledControl -{ - /** - * The label to be updated with a different icon and text. - */ - private final Label label; - - /** - * Creates a new LabeledButton. - * - * @param label The label that will have its text and icon updated when - * required - * @exception AssertionFailedException If the given Label is - * null - */ - public LabeledLabel(Label label) { - super(); - - Assert.isNotNull(label, "The label cannot be null"); - this.label = label; - } - - /* - * (non-Javadoc) - */ - public void setImage(Image image) { - if (!this.label.isDisposed()) { - this.label.setImage(image); - this.label.getParent().layout(true); - } - } - - /* - * (non-Javadoc) - */ - public void setText(String text) { - if (!this.label.isDisposed()) { - this.label.setText(text); - this.label.getParent().layout(true); - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/PaneEnabler.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/PaneEnabler.java deleted file mode 100644 index 6615c72127..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/PaneEnabler.java +++ /dev/null @@ -1,175 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.util; - -import java.util.Collection; -import java.util.Iterator; -import org.eclipse.jpt.common.ui.internal.widgets.Pane; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * This PaneEnabler keeps the "enabled" state of a collection of - * controls in synch with the provided boolean holder. - * - * @version 2.0 - * @since 2.0 - */ -public class PaneEnabler extends StateController -{ - /** - * Creates a new PaneEnabler with a default value of - * false (i.e. disabled). - * - * @param booleanHolder A value model on the underlying boolean model - * @param pane The pane whose "enabled" state is kept in sync with the - * boolean holder's value - */ - public PaneEnabler(PropertyValueModel booleanHolder, - Pane pane) { - - this(booleanHolder, pane, false); - } - - /** - * Creates a new PaneEnabler with a default value of - * false (i.e. disabled). - * - * @param booleanHolder A value model on the underlying boolean model - * @param panes The collection of panes whose "enabled" state is kept in sync - * with the boolean holder's value - */ - public PaneEnabler(PropertyValueModel booleanHolder, - Pane... panes) { - - this(booleanHolder, CollectionTools.collection(panes), false); - } - - /** - * Creates a new PaneEnabler. - * - * @param booleanHolder A value model on the underlying boolean model - * @param pane The pane whose "enabled" state is kept in sync with the - * boolean holder's value - * @param defaultValue The value to use when the underlying model is - * null - */ - public PaneEnabler(PropertyValueModel booleanHolder, - Pane pane, - boolean defaultValue) { - - this(booleanHolder, CollectionTools.singletonIterator(pane), false); - } - - /** - * Creates a new PaneEnabler. - * - * @param booleanHolder A value model on the underlying boolean model - * @param panes The collection of panes whose "enabled" state is kept in sync - * with the boolean holder's value - * @param defaultValue The value to use when the underlying model is - * null - */ - public PaneEnabler(PropertyValueModel booleanHolder, - Pane[] panes, - boolean defaultValue) { - - this(booleanHolder, CollectionTools.iterator(panes), defaultValue); - } - - /** - * Creates a new BaseJpaControllerEnabler with a default value - * of* false (i.e. disabled). - * - * @param booleanHolder A value model on the underlying boolean model - * @param panes The collection of panes whose "enabled" state is kept in sync - * with the boolean holder's value - */ - public PaneEnabler(PropertyValueModel booleanHolder, - Collection> panes) { - - this(booleanHolder, panes, false); - } - - /** - * Creates a new BaseJpaControllerEnabler. - * - * @param booleanHolder A value model on the underlying boolean model - * @param panes The collection of panes whose "enabled" state is kept in sync - * with the boolean holder's value - * @param defaultValue The value to use when the underlying model is - * null - */ - public PaneEnabler(PropertyValueModel booleanHolder, - Collection> panes, - boolean defaultValue) { - - this(booleanHolder, panes.iterator(), defaultValue); - } - - /** - * Creates a new BaseJpaControllerEnabler with a default value of - * false (i.e. disabled). - * - * @param booleanHolder A value model on the underlying boolean model - * @param panes An iterator on the collection of panes whose "enabled" state - * is kept in sync with the boolean holder's value - */ - public PaneEnabler(PropertyValueModel booleanHolder, - Iterator> panes) { - - this(booleanHolder, panes, false); - } - - /** - * Creates a new BaseJpaControllerEnabler. - * - * @param booleanHolder A value model on the underlying boolean model - * @param panes An iterator on the collection of panes whose "enabled" state - * is kept in sync with the boolean holder's value - * @param defaultValue The value to use when the underlying model is - * null - */ - public PaneEnabler(PropertyValueModel booleanHolder, - Iterator> panes, - boolean defaultValue) { - - super(booleanHolder, wrap(panes), defaultValue); - } - - private static Collection wrap(Iterator> panes) { - return CollectionTools.collection(new TransformationIterator, ControlHolder>(panes) { - @Override - protected ControlHolder transform(Pane pane) { - return new PaneHolder(pane); - } - }); - } - - /** - * This holder holds onto an Pane and update its enabled - * state. - */ - private static class PaneHolder implements ControlHolder { - private final Pane pane; - - PaneHolder(Pane pane) { - super(); - this.pane = pane; - } - - public void updateState(boolean state) { - if (!this.pane.getControl().isDisposed()) { - this.pane.enableWidgets(state); - } - } - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/PaneVisibilityEnabler.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/PaneVisibilityEnabler.java deleted file mode 100644 index c081839b5f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/PaneVisibilityEnabler.java +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.util; - -import java.util.Collection; -import java.util.Iterator; -import org.eclipse.jpt.common.ui.internal.widgets.Pane; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * This PaneVisibilityEnabler keeps the "visible" state of a - * collection of controls in synch with the provided boolean holder. - * - * @version 2.0 - * @since 2.0 - */ -public class PaneVisibilityEnabler extends StateController -{ - /** - * Creates a new PaneVisibilityEnabler with a default value of - * false (i.e. not visible). - * - * @param booleanHolder A value model on the underlying boolean model - * @param pane The pane whose "visible" state is kept in sync with the - * boolean holder's value - */ - public PaneVisibilityEnabler(PropertyValueModel booleanHolder, - Pane pane) { - - this(booleanHolder, pane, false); - } - - /** - * Creates a new PaneVisibilityEnabler with a default value of - * false (i.e. not visible). - * - * @param booleanHolder A value model on the underlying boolean model - * @param panes The collection of panes whose "visible" state is kept in sync - * with the boolean holder's value - */ - public PaneVisibilityEnabler(PropertyValueModel booleanHolder, - Pane... panes) { - - this(booleanHolder, CollectionTools.collection(panes), false); - } - - /** - * Creates a new PaneVisibilityEnabler. - * - * @param booleanHolder A value model on the underlying boolean model - * @param pane The pane whose "visible" state is kept in sync with the - * boolean holder's value - * @param defaultValue The value to use when the underlying model is - * null - */ - public PaneVisibilityEnabler(PropertyValueModel booleanHolder, - Pane pane, - boolean defaultValue) { - - this(booleanHolder, CollectionTools.singletonIterator(pane), false); - } - - /** - * Creates a new PaneVisibilityEnabler. - * - * @param booleanHolder A value model on the underlying boolean model - * @param panes The collection of panes whose "visible" state is kept in sync - * with the boolean holder's value - * @param defaultValue The value to use when the underlying model is - * null - */ - public PaneVisibilityEnabler(PropertyValueModel booleanHolder, - Pane[] panes, - boolean defaultValue) { - - this(booleanHolder, CollectionTools.iterator(panes), defaultValue); - } - - /** - * Creates a new PaneVisibilityEnabler with a default value of - * false (i.e. not visible). - * - * @param booleanHolder A value model on the underlying boolean model - * @param panes The collection of panes whose "visible" state is kept in sync - * with the boolean holder's value - */ - public PaneVisibilityEnabler(PropertyValueModel booleanHolder, - Collection> panes) { - - this(booleanHolder, panes, false); - } - - /** - * Creates a new PaneVisibilityEnabler. - * - * @param booleanHolder A value model on the underlying boolean model - * @param panes The collection of panes whose "visible" state is kept in sync - * with the boolean holder's value - * @param defaultValue The value to use when the underlying model is - * null - */ - public PaneVisibilityEnabler(PropertyValueModel booleanHolder, - Collection> panes, - boolean defaultValue) { - - this(booleanHolder, panes.iterator(), defaultValue); - } - - /** - * Creates a new PaneVisibilityEnabler with a default value of - * false (i.e. not visible). - * - * @param booleanHolder A value model on the underlying boolean model - * @param panes An iterator on the collection of panes whose "visible" state - * is kept in sync with the boolean holder's value - */ - public PaneVisibilityEnabler(PropertyValueModel booleanHolder, - Iterator> panes) { - - this(booleanHolder, panes, false); - } - - /** - * Creates a new PaneVisibilityEnabler. - * - * @param booleanHolder A value model on the underlying boolean model - * @param panes An iterator on the collection of panes whose "visible" state - * is kept in sync with the boolean holder's value - * @param defaultValue The value to use when the underlying model is - * null - */ - public PaneVisibilityEnabler(PropertyValueModel booleanHolder, - Iterator> panes, - boolean defaultValue) { - - super(booleanHolder, wrap(panes), defaultValue); - } - - private static Collection wrap(Iterator> panes) { - return CollectionTools.collection(new TransformationIterator, ControlHolder>(panes) { - @Override - protected ControlHolder transform(Pane pane) { - return new PaneHolder(pane); - } - }); - } - - /** - * This holder holds onto an Pane and update its visible - * state. - */ - private static class PaneHolder implements ControlHolder { - private final Pane pane; - - PaneHolder(Pane pane) { - super(); - this.pane = pane; - } - - public void updateState(boolean state) { - this.pane.setVisible(state); - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java deleted file mode 100644 index efc6584919..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/SWTUtil.java +++ /dev/null @@ -1,447 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.util; - -import java.util.Locale; -import org.eclipse.core.runtime.Assert; -import org.eclipse.core.runtime.AssertionFailedException; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.resource.JFaceResources; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jpt.common.ui.internal.widgets.NullPostExecution; -import org.eclipse.jpt.common.ui.internal.widgets.PostExecution; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.swt.events.FocusEvent; -import org.eclipse.swt.events.FocusListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Widget; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.forms.widgets.ScrolledForm; - -/** - * A suite of utility methods related to the user interface. - * - * @version 2.0 - * @since 1.0 - */ -@SuppressWarnings("nls") -public class SWTUtil { - - /** - * Causes the run() method of the given runnable to be invoked - * by the user-interface thread at the next reasonable opportunity. The caller - * of this method continues to run in parallel, and is not notified when the - * runnable has completed. - * - * @param runnable Code to run on the user-interface thread - * @exception org.eclipse.swt.SWTException - *
    - *
  • ERROR_DEVICE_DISPOSED - if the receiver has been disposed
  • - *
- * @see #syncExec - */ - public static void asyncExec(Runnable runnable) { - getStandardDisplay().asyncExec(runnable); - } - - /** - * Tweaks the given Combo to remove the default value when the - * widget receives the focus and to show the default when the widget loses - * the focus. - * - * @param combo The widget having a default value that is always at the - * beginning of the list - */ - public static void attachDefaultValueHandler(Combo combo) { - ComboHandler handler = new ComboHandler(); - combo.addFocusListener(handler); - combo.addModifyListener(handler); - } - - /** - * Retrieves the localized string from the given NLS class by creating the - * key. That key is the concatenation of the composite's short class name - * with the toString() of the given value separated by an underscore. - * - * @param nlsClass The NLS class used to retrieve the localized text - * @param compositeClass The class used for creating the key, its short class - * name is the beginning of the key - * @param value The value used to append its toString() to the generated key - * @return The localized text associated with the value - */ - public static String buildDisplayString(Class nlsClass, - Class compositeClass, - Object value) { - - StringBuilder sb = new StringBuilder(); - sb.append(compositeClass.getSimpleName()); - sb.append("_"); - sb.append(value.toString().toLowerCase(Locale.ENGLISH));//bug 234953 - //TODO in a future release we should not be converting the key using toLowerCase() - - return (String) ReflectionTools.getStaticFieldValue(nlsClass, sb.toString()); - } - - /** - * Retrieves the localized string from the given NLS class by creating the - * key. That key is the concatenation of the composite's short class name - * with the toString() of the given value separated by an underscore. - * - * @param nlsClass The NLS class used to retrieve the localized text - * @param composite The object used to retrieve the short class name that is - * the beginning of the key - * @param value The value used to append its toString() to the generated key - * @return The localized text associated with the value - */ - public static final String buildDisplayString(Class nlsClass, - Object composite, - Object value) { - - return buildDisplayString(nlsClass, composite.getClass(), value); - } - - /** - * Creates the Runnable that will invoke the given - * PostExecution in order to its execution to be done in the - * UI thread. - * - * @param dialog The dialog that was just diposed - * @param postExecution The post execution once the dialog is disposed - * @return The Runnable that will invoke - * {@link PostExecution#execute(Dialog)} - */ - @SuppressWarnings("unchecked") - private static - Runnable buildPostExecutionRunnable( - final D1 dialog, - final PostExecution postExecution) { - - return new Runnable() { - public void run() { - setUserInterfaceActive(false); - try { - postExecution.execute((D2) dialog); - } - finally { - setUserInterfaceActive(true); - } - } - }; - } - - /** - * Convenience method for getting the current shell. If the current thread is - * not the UI thread, then an invalid thread access exception will be thrown. - * - * @return The shell, never null - */ - public static Shell getShell() { - - // Retrieve the active shell, which can be the shell from any window - Shell shell = getStandardDisplay().getActiveShell(); - - // No shell could be found, revert back to the active workbench window - if (shell == null) { - shell = getWorkbench().getActiveWorkbenchWindow().getShell(); - } - - // Make sure it's never null - if (shell == null) { - shell = new Shell(getStandardDisplay().getActiveShell()); - } - - return shell; - } - - /** - * Returns the standard display to be used. The method first checks, if the - * thread calling this method has an associated display. If so, this display - * is returned. Otherwise the method returns the default display. - * - * @return The current display if not null otherwise the default - * display is returned - */ - public static Display getStandardDisplay() - { - Display display = Display.getCurrent(); - - if (display == null) { - display = Display.getDefault(); - } - - return display; - } - - 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; - } - - /** - * Returns the Platform UI workbench. - * - * @return The workbench for this plug-in - */ - public static IWorkbench getWorkbench() { - return PlatformUI.getWorkbench(); - } - - /** - * Relays out the parents of the Control. This was taken from - * the widget Section. - * - * @param pane The pane to revalidate as well as its parents - */ - public static void reflow(Composite pane) { - - for (Composite composite = pane; composite != null; ) { - composite.setRedraw(false); - composite = composite.getParent(); - - if (composite instanceof ScrolledForm || composite instanceof Shell) { - break; - } - } - - for (Composite composite = pane; composite != null; ) { - composite.layout(true); - composite = composite.getParent(); - - if (composite instanceof ScrolledForm) { - ((ScrolledForm) composite).reflow(true); - break; - } - } - - for (Composite composite = pane; composite != null; ) { - composite.setRedraw(true); - composite = composite.getParent(); - - if (composite instanceof ScrolledForm || composite instanceof Shell) { - break; - } - } - } - - /** - * Sets whether the entire shell and its widgets should be enabled or - * everything should be unaccessible. - * - * @param active true to make all the UI active otherwise - * false to deactivate it - */ - public static void setUserInterfaceActive(boolean active) { - Shell[] shells = getStandardDisplay().getShells(); - - for (Shell shell : shells) { - shell.setEnabled(active); - } - } - - /** - * Asynchronously launches the specified dialog in the UI thread. - * - * @param dialog The dialog to show on screen - * @param postExecution This interface let the caller to invoke a piece of - * code once the dialog is disposed - */ - public static - void show(final D1 dialog, final PostExecution postExecution) { - - try { - Assert.isNotNull(dialog, "The dialog cannot be null"); - Assert.isNotNull(postExecution, "The PostExecution cannot be null"); - } - catch (AssertionFailedException e) { - // Make sure the UI is interactive - setUserInterfaceActive(true); - throw e; - } - - new Thread() { - @Override - public void run() { - asyncExec( - new Runnable() { - public void run() { - showImp(dialog, postExecution); - } - } - ); - } - }.start(); - } - - /** - * Asynchronously launches the specified dialog in the UI thread. - * - * @param dialog The dialog to show on screen - */ - public static void show(Dialog dialog) { - show(dialog, NullPostExecution.instance()); - } - - /** - * Asynchronously launches the specified dialog in the UI thread. - * - * @param dialog The dialog to show on screen - * @param postExecution This interface let the caller to invoke a piece of - * code once the dialog is disposed - */ - private static - void showImp(D1 dialog, PostExecution postExecution) { - - setUserInterfaceActive(true); - dialog.open(); - - if (postExecution != NullPostExecution.instance()) { - asyncExec(buildPostExecutionRunnable(dialog, postExecution)); - } - } - - /** - * Causes the run() method of the given runnable to be invoked - * by the user-interface thread at the next reasonable opportunity. The - * thread which calls this method is suspended until the runnable completes. - * - * @param runnable code to run on the user-interface thread. - * @see #asyncExec - */ - public static void syncExec(Runnable runnable) { - getStandardDisplay().syncExec(runnable); - } - - /** - * Determines if the current thread is the UI event thread. - * - * @return true if it's the UI event thread, false - * otherwise - */ - public static boolean uiThread() { - return getStandardDisplay().getThread() == Thread.currentThread(); - } - - /** - * Determines if the current thread is the UI event thread by using the - * thread from which the given viewer's display was instantiated. - * - * @param viewer The viewer used to determine if the current thread - * is the UI event thread - * @return true if the current thread is the UI event thread; - * false otherwise - */ - public static boolean uiThread(Viewer viewer) { - return uiThread(viewer.getControl()); - } - - /** - * Determines if the current thread is the UI event thread by using the - * thread from which the given widget's display was instantiated. - * - * @param widget The widget used to determine if the current thread - * is the UI event thread - * @return true if the current thread is the UI event thread; - * false otherwise - */ - public static boolean uiThread(Widget widget) { - return widget.getDisplay().getThread() == Thread.currentThread(); - } - - - /** - * This handler is responsible for removing the default value when the combo - * has the focus or when the selected item is the default value and to select - * it when the combo loses the focus. - */ - private static class ComboHandler implements ModifyListener, - FocusListener { - - public void focusGained(FocusEvent e) { - Combo combo = (Combo) e.widget; - - if (combo.getSelectionIndex() == 0) { - // The text selection has to be changed outside of the context of this - // listener otherwise the combo won't update because it's currently - // notifying its listeners - asyncExec(new SelectText(combo)); - } - } - - public void focusLost(FocusEvent e) { - //do nothing - } - - public void modifyText(ModifyEvent e) { - - Combo combo = (Combo) e.widget; - - if (combo.isFocusControl() && - combo.getSelectionIndex() == 0) { - - // The text has to be changed outside of the context of this - // listener otherwise the combo won't update because it's currently - // notifying its listeners - asyncExec(new ModifyText(combo)); - } - } - - private class ModifyText implements Runnable { - private final Combo combo; - - public ModifyText(Combo combo) { - super(); - this.combo = combo; - } - - public void run() { - if (this.combo.isDisposed()) { - return; - } - String text = this.combo.getText(); - - if (text.length() == 0) { - text = this.combo.getItem(0); - this.combo.setText(text); - } - - this.combo.setSelection(new Point(0, text.length())); - } - } - - private class SelectText implements Runnable { - private final Combo combo; - - public SelectText(Combo combo) { - super(); - this.combo = combo; - } - - public void run() { - if (this.combo.isDisposed()) { - return; - } - String text = this.combo.getText(); - this.combo.setSelection(new Point(0, text.length())); - } - } - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/StateController.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/StateController.java deleted file mode 100644 index 5c313e6603..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/StateController.java +++ /dev/null @@ -1,320 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.util; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import org.eclipse.core.runtime.Assert; -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * A StateController keeps the state of a collection of widgets in - * synch with the provided boolean holder. - * - * @see ControlEnabler - * @see ControlVisibilityEnabler - * @see PaneEnabler - * @see PaneVisibilityEnabler - * - * @version 2.0 - * @since 2.0 - */ -@SuppressWarnings("nls") -abstract class StateController -{ - /** - * A listener that allows us to synchronize the controlHolders with changes - * made to the underlying boolean model. - */ - private PropertyChangeListener booleanChangeListener; - - /** - * A value model on the underlying boolean model - */ - private PropertyValueModel booleanHolder; - - /** - * The collection of ControlHolders whose state is kept in sync - * with the boolean holder's value. - */ - private Collection controlHolders; - - /** - * The default setting for the state; for when the underlying model is - * null. The default [default value] is false. - */ - private boolean defaultValue; - - /** - * Creates a new StateController. - */ - StateController() { - super(); - initialize(); - } - - /** - * Creates a new StateController with a default value of - * false. - * - * @param booleanHolder A value model on the underlying boolean model - * @param controlHolders The collection of ControlHolders whose - * state is kept in sync with the boolean holder's value - */ - StateController(PropertyValueModel booleanHolder, - Collection controlHolders) { - - this(booleanHolder, controlHolders, false); - } - - /** - * Creates a new StateController with a default value of - * false. - * - * @param booleanHolder A value model on the underlying boolean model - * @param controlHolders The collection of ControlHolders whose - * state is kept in sync with the boolean holder's value - * @param defaultValue The value to use when the underlying model is - * null - */ - StateController(PropertyValueModel booleanHolder, - Collection controlHolders, - boolean defaultValue) { - - this(); - initialize(booleanHolder, controlHolders, defaultValue); - } - - /** - * Creates a new StateController with a default value of - * false. - * - * @param booleanHolder A value model on the underlying boolean model - * @param controlHolder The ControlHolder whose state is kept - * in sync with the boolean holder's value - */ - StateController(PropertyValueModel booleanHolder, - ControlHolder controlHolder) { - - this(booleanHolder, controlHolder, false); - } - - /** - * Creates a new StateController with a default value of - * false. - * - * @param booleanHolder A value model on the underlying boolean model - * @param controlHolders The collection of ControlHolders whose - * state is kept in sync with the boolean holder's value - */ - StateController(PropertyValueModel booleanHolder, - ControlHolder... controlHolders) { - - this(booleanHolder, CollectionTools.collection(controlHolders), false); - } - - /** - * Creates a new StateController with a default value of - * false. - * - * @param booleanHolder A value model on the underlying boolean model - * @param controlHolder The ControlHolder whose state is kept - * in sync with the boolean holder's value - * @param defaultValue The value to use when the underlying model is - * null - */ - StateController(PropertyValueModel booleanHolder, - ControlHolder controlHolder, - boolean defaultValue) { - - this(booleanHolder, new ControlHolder[] { controlHolder }, false); - } - - /** - * Creates a new StateController. - * - * @param booleanHolder A value model on the underlying boolean model - * @param controlHolders The collection of ControlHolders whose - * state is kept in sync with the boolean holder's value - * @param defaultValue The value to use when the underlying model is - * null - */ - StateController(PropertyValueModel booleanHolder, - ControlHolder[] controlHolders, - boolean defaultValue) { - - this(); - this.initialize(booleanHolder, CollectionTools.collection(controlHolders), defaultValue); - } - - /** - * Creates a new StateController with a default value of - * false. - * - * @param booleanHolder A value model on the underlying boolean model - * @param controlHolders An iterator on the collection of - * ControlHolders whose state is kept in sync with the boolean - * holder's value - */ - StateController(PropertyValueModel booleanHolder, - Iterator controlHolders) { - - this(booleanHolder, CollectionTools.collection(controlHolders), false); - } - - /** - * Creates a new StateController. - * - * @param booleanHolder A value model on the underlying boolean model - * @param controlHolders An iterator on the collection of - * ControlHolders whose state is kept in sync with the boolean - * holder's value - * @param defaultValue The value to use when the underlying model is - * null - */ - StateController(PropertyValueModel booleanHolder, - Iterator controlHolders, - boolean defaultValue) { - - this(); - initialize(booleanHolder, CollectionTools.collection(controlHolders), defaultValue); - } - - /** - * Returns the boolean primitive of the given Boolean value but - * also checks for null, if that is the case, then - * {@link #defaultValue} is returned. - * - * @param value The Boolean value to be returned as a primitive - * @return The primitive of the given value or {@link #defaultValue}when the - * value is null - */ - protected boolean booleanValue(Boolean value) { - return (value == null) ? this.defaultValue : value.booleanValue(); - } - - /** - * Creates a listener for the boolean holder. - * - * @return A new PropertyChangeListener - */ - private PropertyChangeListener buildBooleanChangeListener() { - return new SWTPropertyChangeListenerWrapper( - buildBooleanChangeListener_() - ) - { - @Override - public String toString() { - return "StateController.SWTPropertyChangeListenerWrapper"; - } - }; - } - - /** - * Creates a listener for the boolean holder. - * - * @return A new PropertyChangeListener - */ - private PropertyChangeListener buildBooleanChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - updateState(); - } - - @Override - public String toString() { - return "StateController.PropertyChangeListener"; - } - }; - } - - /** - * Returns an Iterator over the collection of - * ControlHolders. - * - * @return The iteration of ControlHolders - */ - protected final Iterator controlHolders() { - return new CloneIterator(this.controlHolders); - } - - /** - * Initializes this StateController by building the appropriate - * listeners. - */ - protected void initialize() { - this.booleanChangeListener = this.buildBooleanChangeListener(); - } - - /** - * Initializes this StateController with the given state. - * - * @param booleanHolder A value model on the underlying boolean model - * @param controlHolders A ControlHolders whose enablement state - * is kept in sync with the boolean holder's value - * @param defaultValue The value to use when the underlying model is - * null - */ - protected void initialize(PropertyValueModel booleanHolder, - Collection controlHolders, - boolean defaultValue) { - - Assert.isNotNull(booleanHolder, "The holder of the boolean value cannot be null"); - Assert.isNotNull(controlHolders, "The collection of ControlHolders cannot be null"); - - this.controlHolders = new ArrayList(controlHolders); - this.defaultValue = defaultValue; - this.booleanHolder = booleanHolder; - - this.booleanHolder.addPropertyChangeListener( - PropertyValueModel.VALUE, - this.booleanChangeListener - ); - - this.updateState(); - } - - /** - * Updates the state of the control holders. - */ - protected void updateState() { - this.updateState(booleanValue(this.booleanHolder.getValue())); - } - - /** - * Updates the state of the Controls. - * - * @param state The new state the widgets need to have - */ - protected void updateState(boolean state) { - for (ControlHolder controlHolder : this.controlHolders) { - controlHolder.updateState(state); - } - } - - /** - * The holder of the actual widget. - */ - static interface ControlHolder { - - /** - * Updates the state of the wrapped control. - * - * @param state The new state the control should have - */ - void updateState(boolean state); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/TableLayoutComposite.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/TableLayoutComposite.java deleted file mode 100644 index 9a8790c941..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/util/TableLayoutComposite.java +++ /dev/null @@ -1,207 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2009 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 - *******************************************************************************/ -// copied from org.eclipse.jdt.internal.ui.util.TableLayoutComposite -package org.eclipse.jpt.common.ui.internal.util; - -import java.util.ArrayList; -import java.util.List; - -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.core.runtime.Assert; - -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. - *

- * XXX: Should switch to use {@link org.eclipse.jface.layout.TableColumnLayout}. - *

- */ -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. - *

- * XXX: Should either switch to use {@link org.eclipse.jface.layout.TableColumnLayout} or get API from JFace or SWT, see: https://bugs.eclipse.org/bugs/show_bug.cgi?id=218483 - *

- * - * @since 3.1 - */ - private static int COLUMN_TRIM; - static { - String platform= SWT.getPlatform(); - if ("win32".equals(platform)) //$NON-NLS-1$ - COLUMN_TRIM= 4; - else if ("carbon".equals(platform)) //$NON-NLS-1$ - COLUMN_TRIM= 24; - else - COLUMN_TRIM= 3; - } - - private List columns= new ArrayList(); - - /** - * Creates a new TableLayoutComposite. - * - * @param parent the parent composite - * @param style the SWT style - */ - 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/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AsynchronousUiCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AsynchronousUiCommandExecutor.java deleted file mode 100644 index 9a8b3aa0d8..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/AsynchronousUiCommandExecutor.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.utility; - -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.internal.CommandRunnable; -import org.eclipse.swt.widgets.Display; - -/** - * 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) { - this.getDisplay().asyncExec(this.buildRunnable(command)); - } - - private Runnable buildRunnable(Command command) { - return new CommandRunnable(command); - } - - private Display getDisplay() { - Display display = Display.getCurrent(); - return (display != null) ? display : Display.getDefault(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/SynchronousUiCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/SynchronousUiCommandExecutor.java deleted file mode 100644 index 895dd212f3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/SynchronousUiCommandExecutor.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.utility; - -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.internal.CommandRunnable; -import org.eclipse.swt.widgets.Display; - -/** - * 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) { - this.getDisplay().syncExec(this.buildRunnable(command)); - } - - private Runnable buildRunnable(Command command) { - return new CommandRunnable(command); - } - - private Display getDisplay() { - Display display = Display.getCurrent(); - return (display != null) ? display : Display.getDefault(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/AbstractListWidgetAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/AbstractListWidgetAdapter.java deleted file mode 100644 index 50df45253c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/AbstractListWidgetAdapter.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.utility.swt; - -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.widgets.Widget; - -/** - * All the "list widgets" are subclasses of {@link Widget}; so we can provide - * a smidgen of common behavior here. - */ -abstract class AbstractListWidgetAdapter - implements ListWidgetModelBinding.ListWidget -{ - final W widget; - - AbstractListWidgetAdapter(W widget) { - super(); - this.widget = widget; - } - - public boolean isDisposed() { - return this.widget.isDisposed(); - } - - public void addDisposeListener(DisposeListener listener) { - this.widget.addDisposeListener(listener); - } - - public void removeDisposeListener(DisposeListener listener) { - this.widget.removeDisposeListener(listener); - } - -} - diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/BooleanButtonModelBinding.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/BooleanButtonModelBinding.java deleted file mode 100644 index 5967029a51..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/BooleanButtonModelBinding.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.utility.swt; - -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Button; - -/** - * This binding can be used to keep a check-box, toggle button, or radio button - * "selection" synchronized with a model boolean. - * - * @see WritablePropertyValueModel - * @see Button - */ -@SuppressWarnings("nls") -final class BooleanButtonModelBinding { - - // ***** model - /** A value model on the underlying model boolean. */ - private final WritablePropertyValueModel booleanModel; - - /** - * A listener that allows us to synchronize the button's selection state with - * the model boolean. - */ - private final PropertyChangeListener booleanChangeListener; - - /** - * The default setting for the check-box/toggle button/radio button; - * for when the underlying model is null. - * The default [default value] is false (i.e. the check-box - * is unchecked/toggle button popped out/radio button unchecked). - */ - private final boolean defaultValue; - - // ***** UI - /** The check-box/toggle button/radio button we synchronize with the model boolean. */ - private final Button button; - - /** - * A listener that allows us to synchronize the model boolean with - * the button's selection state. - */ - private final SelectionListener buttonSelectionListener; - - /** - * A listener that allows us to stop listening to stuff when the button - * is disposed. (Critical for preventing memory leaks.) - */ - private final DisposeListener buttonDisposeListener; - - - // ********** constructor ********** - - /** - * Constructor - the boolean model and button are required. - */ - BooleanButtonModelBinding(WritablePropertyValueModel booleanModel, Button button, boolean defaultValue) { - super(); - if ((booleanModel == null) || (button == null)) { - throw new NullPointerException(); - } - this.booleanModel = booleanModel; - this.button = button; - this.defaultValue = defaultValue; - - this.booleanChangeListener = this.buildBooleanChangeListener(); - this.booleanModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.booleanChangeListener); - - this.buttonSelectionListener = this.buildButtonSelectionListener(); - this.button.addSelectionListener(this.buttonSelectionListener); - - this.buttonDisposeListener = this.buildButtonDisposeListener(); - this.button.addDisposeListener(this.buttonDisposeListener); - - this.setButtonSelection(this.booleanModel.getValue()); - } - - - // ********** initialization ********** - - private PropertyChangeListener buildBooleanChangeListener() { - return new SWTPropertyChangeListenerWrapper(this.buildBooleanChangeListener_()); - } - - private PropertyChangeListener buildBooleanChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - BooleanButtonModelBinding.this.booleanChanged(event); - } - @Override - public String toString() { - return "boolean listener"; - } - }; - } - - private SelectionListener buildButtonSelectionListener() { - return new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent event) { - BooleanButtonModelBinding.this.buttonSelected(); - } - @Override - public String toString() { - return "button selection listener"; - } - }; - } - - private DisposeListener buildButtonDisposeListener() { - return new DisposeListener() { - public void widgetDisposed(DisposeEvent event) { - BooleanButtonModelBinding.this.buttonDisposed(); - } - @Override - public String toString() { - return "button dispose listener"; - } - }; - } - - - // ********** boolean model events ********** - - /** - * The model has changed - synchronize the button. - * If the new model value is null, use the binding's default value - * (which is typically false). - */ - /* CU private */ void booleanChanged(PropertyChangeEvent event) { - this.setButtonSelection((Boolean) event.getNewValue()); - } - - private void setButtonSelection(Boolean b) { - if ( ! this.button.isDisposed()) { - this.button.setSelection(this.booleanValue(b)); - } - } - - private boolean booleanValue(Boolean b) { - return (b != null) ? b.booleanValue() : this.defaultValue; - } - - - // ********** button events ********** - - /** - * The button has been "selected" - synchronize the model. - */ - /* CU private */ void buttonSelected() { - if ( ! this.button.isDisposed()) { - this.booleanModel.setValue(Boolean.valueOf(this.button.getSelection())); - } - } - - /* CU private */ void buttonDisposed() { - // the button is not yet "disposed" when we receive this event - // so we can still remove our listeners - this.button.removeSelectionListener(this.buttonSelectionListener); - this.button.removeDisposeListener(this.buttonDisposeListener); - this.booleanModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.booleanChangeListener); - } - - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.booleanModel); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/BooleanStateController.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/BooleanStateController.java deleted file mode 100644 index 5ea988de7c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/BooleanStateController.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.utility.swt; - -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.widgets.Control; - -/** - * This controller enables a boolean model to control either the - * enabled or visible properties of SWT controls; i.e. the - * controls' properties are kept in synch with the boolean model, - * but not vice-versa. - *

- * Subclasses must manage the listeners; i.e. the engaging and disengaging of - * the boolean model and the control(s). - * - * @see PropertyValueModel - * @see Control#setEnabled(boolean) - * @see Control#setVisible(boolean) - */ -abstract class BooleanStateController { - - /** - * The controlling boolean model. - */ - private final PropertyValueModel booleanModel; - - /** - * A listener that allows us to synchronize the control states with - * changes in the value of the boolean model. - */ - private final PropertyChangeListener booleanChangeListener; - - /** - * A listener that allows us to stop listening to stuff when all the - * controls are disposed. (Critical for preventing memory leaks.) - */ - private final DisposeListener controlDisposeListener; - - /** - * The default setting for the state; for when the underlying boolean model is - * null. The default [default value] is false. - */ - private final boolean defaultValue; - - /** - * The adapter determines whether the 'enabled' or 'visible' property is - * controlled. - */ - private final Adapter adapter; - - - // ********** constructor ********** - - /** - * Constructor - the boolean model and the adapter are required. - */ - BooleanStateController(PropertyValueModel booleanModel, boolean defaultValue, Adapter adapter) { - super(); - if ((booleanModel == null) || (adapter == null)) { - throw new NullPointerException(); - } - this.booleanModel = booleanModel; - this.defaultValue = defaultValue; - this.adapter = adapter; - - this.booleanChangeListener = this.buildBooleanChangeListener(); - this.controlDisposeListener = this.buildControlDisposeListener(); - } - - - // ********** initialization ********** - - private PropertyChangeListener buildBooleanChangeListener() { - return new SWTPropertyChangeListenerWrapper(this.buildBooleanChangeListener_()); - } - - private PropertyChangeListener buildBooleanChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - BooleanStateController.this.booleanChanged(event); - } - @Override - public String toString() { - return "boolean listener"; //$NON-NLS-1$ - } - }; - } - - private DisposeListener buildControlDisposeListener() { - return new DisposeListener() { - public void widgetDisposed(DisposeEvent event) { - // the control is not yet "disposed" when we receive this event - // so we can still remove our listener - BooleanStateController.this.controlDisposed((Control) event.widget); - } - @Override - public String toString() { - return "control dispose listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** boolean model ********** - - void engageBooleanModel() { - this.booleanModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.booleanChangeListener); - } - - void disengageBooleanModel() { - this.booleanModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.booleanChangeListener); - } - - /** - * The boolean model has changed - synchronize the controls. - * If the new boolean model value is null, use the controller's - * default value (which is typically false). - */ - /* CU private */ void booleanChanged(PropertyChangeEvent event) { - this.setControlState((Boolean) event.getNewValue()); - } - - - boolean getBooleanValue() { - return this.booleanValue(this.booleanModel.getValue()); - } - - private boolean booleanValue(Boolean b) { - return (b != null) ? b.booleanValue() : this.defaultValue; - } - - - // ********** control ********** - - void engageControl(Control control) { - control.addDisposeListener(this.controlDisposeListener); - } - - void disengageControl(Control control) { - control.removeDisposeListener(this.controlDisposeListener); - } - - private void setControlState(Boolean b) { - this.setControlState(this.booleanValue(b)); - } - - abstract void setControlState(boolean b); - - void setControlState(Control control, boolean b) { - if ( ! control.isDisposed()) { - this.adapter.setState(control, b); - } - } - - void controlDisposed(Control control) { - this.disengageControl(control); - } - - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.booleanModel); - } - - - // ********** adapter interface ********** - - interface Adapter { - void setState(Control control, boolean b); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/DropDownListBoxSelectionBinding.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/DropDownListBoxSelectionBinding.java deleted file mode 100644 index ccfb8bdaed..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/DropDownListBoxSelectionBinding.java +++ /dev/null @@ -1,283 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.utility.swt; - -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; - -/** - * This binding can be used to keep a drop-down list box's selection - * synchronized with a model. The selection can be modified by either the - * drop-down list box or the model, so changes must be coordinated. - *

- * NB: A selected item value of null can be used - * to clear the drop-down list box's selection. If null is a - * valid item in the model list, an invalid selected item can be used to clear - * the selection. - * - * @see ListValueModel - * @see WritablePropertyValueModel - * @see DropDownListBox - * @see SWTTools - */ -@SuppressWarnings("nls") -final class DropDownListBoxSelectionBinding - implements ListWidgetModelBinding.SelectionBinding -{ - // ***** model - /** - * The underlying list model. - */ - private final ListValueModel listModel; - - /** - * A writable value model on the underlying model selection. - */ - private final WritablePropertyValueModel selectedItemModel; - - /** - * A listener that allows us to synchronize the drop-down list box's - * selection with the model selection. - */ - private final PropertyChangeListener selectedItemChangeListener; - - // ***** UI - /** - * The drop-down list box whose selection we keep synchronized - * with the model selection. - */ - private final DropDownListBox dropdownListBox; - - /** - * A listener that allows us to synchronize our selected item holder - * with the drop-down list box's selection. - */ - private final SelectionListener dropdownListBoxSelectionListener; - - - // ********** constructor ********** - - /** - * Constructor - all parameters are required. - */ - DropDownListBoxSelectionBinding( - ListValueModel listModel, - WritablePropertyValueModel selectedItemModel, - DropDownListBox dropdownListBox - ) { - super(); - if ((listModel == null) || (selectedItemModel == null) || (dropdownListBox == null)) { - throw new NullPointerException(); - } - this.listModel = listModel; - this.selectedItemModel = selectedItemModel; - this.dropdownListBox = dropdownListBox; - - this.selectedItemChangeListener = this.buildSelectedItemChangeListener(); - this.selectedItemModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.selectedItemChangeListener); - - this.dropdownListBoxSelectionListener = this.buildDropDownListBoxSelectionListener(); - this.dropdownListBox.addSelectionListener(this.dropdownListBoxSelectionListener); - } - - - // ********** initialization ********** - - private PropertyChangeListener buildSelectedItemChangeListener() { - return new SWTPropertyChangeListenerWrapper(this.buildSelectedItemChangeListener_()); - } - - private PropertyChangeListener buildSelectedItemChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - DropDownListBoxSelectionBinding.this.selectedItemChanged(event); - } - @Override - public String toString() { - return "selected item listener"; - } - }; - } - - private SelectionListener buildDropDownListBoxSelectionListener() { - return new SelectionListener() { - public void widgetSelected(SelectionEvent event) { - DropDownListBoxSelectionBinding.this.dropDownListBoxSelectionChanged(event); - } - public void widgetDefaultSelected(SelectionEvent event) { - DropDownListBoxSelectionBinding.this.dropDownListBoxDoubleClicked(event); - } - @Override - public String toString() { - return "drop-down list box selection listener"; - } - }; - } - - - // ********** ListWidgetModelBinding.SelectionBinding implementation ********** - - /** - * Modifying the drop-down lisb box's selected item programmatically does - * not trigger a SelectionEvent. - *

- * Pre-condition: The drop-down list box is not disposed. - */ - public void synchronizeListWidgetSelection() { - int oldIndex = this.dropdownListBox.getSelectionIndex(); - E value = this.selectedItemModel.getValue(); - int newIndex = this.indexOf(value); - if ((oldIndex != -1) && (newIndex != -1) && (newIndex != oldIndex)) { - this.dropdownListBox.deselect(oldIndex); - } - if (newIndex == -1) { - this.dropdownListBox.deselectAll(); - } else { - if (newIndex != oldIndex) { - this.dropdownListBox.select(newIndex); - } - } - } - - public void dispose() { - this.dropdownListBox.removeSelectionListener(this.dropdownListBoxSelectionListener); - this.selectedItemModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.selectedItemChangeListener); - } - - - // ********** selected item ********** - - void selectedItemChanged(PropertyChangeEvent event) { - if ( ! this.dropdownListBox.isDisposed()) { - this.selectedItemChanged_(event); - } - } - - /** - * Modifying the drop-down list box's selected item programmatically does - * not trigger a SelectionEvent. - */ - private void selectedItemChanged_(@SuppressWarnings("unused") PropertyChangeEvent event) { - this.synchronizeListWidgetSelection(); - } - - private int indexOf(E item) { - int len = this.listModel.size(); - for (int i = 0; i < len; i++) { - if (Tools.valuesAreEqual(this.listModel.get(i), item)) { - return i; - } - } - // if 'null' is not in the list, use it to clear the selection - if (item == null) { - return -1; - } - // We can get here via one of the following: - // 1. The selected item model is invalid and not in sync with the list - // model. This is not good and we don't make this (programming - // error) obvious (e.g. via an exception). :-( - // 2. If both the selected item model and the list model are dependent - // on the same underlying model, the selected item model may receive - // its event first, resulting in a missing item. This will resolve - // itself once the list model receives its event and synchronizes - // with the same underlying model. This situation is acceptable. - return -1; - -// This is what we used to do: -// throw new IllegalStateException("selected item not found: " + item); - } - - - // ********** combo-box events ********** - - void dropDownListBoxSelectionChanged(SelectionEvent event) { - if ( ! this.dropdownListBox.isDisposed()) { - this.dropDownListBoxSelectionChanged_(event); - } - } - - void dropDownListBoxDoubleClicked(SelectionEvent event) { - if ( ! this.dropdownListBox.isDisposed()) { - this.dropDownListBoxSelectionChanged_(event); - } - } - - private void dropDownListBoxSelectionChanged_(@SuppressWarnings("unused") SelectionEvent event) { - this.selectedItemModel.setValue(this.getDropDownListBoxSelectedItem()); - } - - private E getDropDownListBoxSelectedItem() { - int selectionIndex = this.dropdownListBox.getSelectionIndex(); - return (selectionIndex == -1) ? null : this.listModel.get(selectionIndex); - } - - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.selectedItemModel); - } - - - // ********** adapter interface ********** - - /** - * Adapter used by the drop-down list box selection binding to query and manipulate - * the drop-down list box. - */ - interface DropDownListBox { - - /** - * Return whether the combo-box is "disposed". - */ - boolean isDisposed(); - - /** - * Add the specified selection listener to the combo-box. - */ - void addSelectionListener(SelectionListener listener); - - /** - * Remove the specified selection listener from the combo-box. - */ - void removeSelectionListener(SelectionListener listener); - - /** - * Return the index of the combo-box's selection. - */ - int getSelectionIndex(); - - /** - * Select the item at the specified index in the combo-box. - */ - void select(int index); - - /** - * Deselect the item at the specified index in the combo-box. - */ - void deselect(int index); - - /** - * Clear the combo-box's selection. - */ - void deselectAll(); - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/ListBoxSelectionBinding.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/ListBoxSelectionBinding.java deleted file mode 100644 index 1c5c28bcab..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/ListBoxSelectionBinding.java +++ /dev/null @@ -1,305 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.utility.swt; - -import java.util.ArrayList; -import java.util.Arrays; - -import org.eclipse.jpt.common.ui.internal.listeners.SWTCollectionChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.WritableCollectionValueModel; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.List; - -/** - * This binding can be used to keep a list box's selection - * synchronized with a model. The selection can be modified by either the list - * box or the model, so changes must be coordinated. - * - * @see ListValueModel - * @see WritableCollectionValueModel - * @see List - * @see SWTTools - */ -@SuppressWarnings("nls") -final class ListBoxSelectionBinding - implements ListWidgetModelBinding.SelectionBinding -{ - // ***** model - /** - * The underlying list model. - */ - private final ListValueModel listModel; - - /** - * A writable value model on the underlying model selections. - */ - private final WritableCollectionValueModel selectedItemsModel; - - /** - * A listener that allows us to synchronize the list box's selection with - * the model selections. - */ - private final CollectionChangeListener selectedItemsChangeListener; - - // ***** UI - /** - * The list box whose selection we keep synchronized with the model selections. - */ - private final List listBox; - - /** - * A listener that allows us to synchronize our selected items holder - * with the list box's selection. - */ - private final SelectionListener listBoxSelectionListener; - - - // ********** constructor ********** - - /** - * Constructor - all parameters are required. - */ - ListBoxSelectionBinding( - ListValueModel listModel, - WritableCollectionValueModel selectedItemsModel, - List listBox - ) { - super(); - if ((listModel == null) || (selectedItemsModel == null) || (listBox == null)) { - throw new NullPointerException(); - } - this.listModel = listModel; - this.selectedItemsModel = selectedItemsModel; - this.listBox = listBox; - - this.selectedItemsChangeListener = this.buildSelectedItemsChangeListener(); - this.selectedItemsModel.addCollectionChangeListener(CollectionValueModel.VALUES, this.selectedItemsChangeListener); - - this.listBoxSelectionListener = this.buildListBoxSelectionListener(); - this.listBox.addSelectionListener(this.listBoxSelectionListener); - } - - - // ********** initialization ********** - - private CollectionChangeListener buildSelectedItemsChangeListener() { - return new SWTCollectionChangeListenerWrapper(this.buildSelectedItemsChangeListener_()); - } - - private CollectionChangeListener buildSelectedItemsChangeListener_() { - return new CollectionChangeListener() { - public void itemsAdded(CollectionAddEvent event) { - ListBoxSelectionBinding.this.selectedItemsAdded(event); - } - public void itemsRemoved(CollectionRemoveEvent event) { - ListBoxSelectionBinding.this.selectedItemsRemoved(event); - } - public void collectionCleared(CollectionClearEvent event) { - ListBoxSelectionBinding.this.selectedItemsCleared(event); - } - public void collectionChanged(CollectionChangeEvent event) { - ListBoxSelectionBinding.this.selectedItemsChanged(event); - } - @Override - public String toString() { - return "selected items listener"; - } - }; - } - - private SelectionListener buildListBoxSelectionListener() { - return new SelectionListener() { - public void widgetSelected(SelectionEvent event) { - ListBoxSelectionBinding.this.listBoxSelectionChanged(event); - } - public void widgetDefaultSelected(SelectionEvent event) { - ListBoxSelectionBinding.this.listBoxDoubleClicked(event); - } - @Override - public String toString() { - return "list box selection listener"; - } - }; - } - - - // ********** ListWidgetModelBinding.SelectionBinding implementation ********** - - /** - * Modifying the list box's selected items programmatically does not - * trigger a SelectionEvent. - * - * Pre-condition: The list-box is not disposed. - */ - public void synchronizeListWidgetSelection() { - int selectedItemsSize = this.selectedItemsModel.size(); - int[] select = new int[selectedItemsSize]; - int i = 0; - for (E item : this.selectedItemsModel) { - select[i++] = this.indexOf(item); - } - - int listSize = this.listModel.size(); - int[] deselect = new int[listSize - selectedItemsSize]; - i = 0; - for (int j = 0; j < listSize; j++) { - if ( ! ArrayTools.contains(select, j)) { - deselect[i++] = j; - } - } - - int[] old = ArrayTools.sort(this.listBox.getSelectionIndices()); - select = ArrayTools.sort(select); - if ( ! Arrays.equals(select, old)) { - this.listBox.deselect(deselect); - this.listBox.select(select); - } - } - - public void dispose() { - this.listBox.removeSelectionListener(this.listBoxSelectionListener); - this.selectedItemsModel.removeCollectionChangeListener(CollectionValueModel.VALUES, this.selectedItemsChangeListener); - } - - - // ********** selected items ********** - - void selectedItemsAdded(CollectionAddEvent event) { - if ( ! this.listBox.isDisposed()) { - this.selectedItemsAdded_(event); - } - } - - /** - * Modifying the list box's selected items programmatically does not - * trigger a SelectionEvent. - */ - private void selectedItemsAdded_(CollectionAddEvent event) { - int[] indices = new int[event.getItemsSize()]; - int i = 0; - for (E item : this.getItems(event)) { - indices[i++] = this.indexOf(item); - } - this.listBox.select(indices); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - private Iterable getItems(CollectionAddEvent event) { - return (Iterable) event.getItems(); - } - - void selectedItemsRemoved(CollectionRemoveEvent event) { - if ( ! this.listBox.isDisposed()) { - this.selectedItemsRemoved_(event); - } - } - - /** - * Modifying the list box's selected items programmatically does not - * trigger a SelectionEvent. - */ - private void selectedItemsRemoved_(CollectionRemoveEvent event) { - int[] indices = new int[event.getItemsSize()]; - int i = 0; - for (E item : this.getItems(event)) { - indices[i++] = this.indexOf(item); - } - this.listBox.deselect(indices); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - private Iterable getItems(CollectionRemoveEvent event) { - return (Iterable) event.getItems(); - } - - void selectedItemsCleared(CollectionClearEvent event) { - if ( ! this.listBox.isDisposed()) { - this.selectedItemsCleared_(event); - } - } - - /** - * Modifying the list box's selected items programmatically does not - * trigger a SelectionEvent. - */ - private void selectedItemsCleared_(@SuppressWarnings("unused") CollectionClearEvent event) { - this.listBox.deselectAll(); - } - - void selectedItemsChanged(CollectionChangeEvent event) { - if ( ! this.listBox.isDisposed()) { - this.selectedItemsChanged_(event); - } - } - - private void selectedItemsChanged_(@SuppressWarnings("unused") CollectionChangeEvent event) { - this.synchronizeListWidgetSelection(); - } - - private int indexOf(E item) { - int len = this.listModel.size(); - for (int i = 0; i < len; i++) { - if (Tools.valuesAreEqual(this.listModel.get(i), item)) { - return i; - } - } - // see comment in DropDownListBoxSelectionBinding.indexOf(E) - return -1; - } - - - // ********** list box events ********** - - void listBoxSelectionChanged(SelectionEvent event) { - if ( ! this.listBox.isDisposed()) { - this.listBoxSelectionChanged_(event); - } - } - - void listBoxDoubleClicked(SelectionEvent event) { - if ( ! this.listBox.isDisposed()) { - this.listBoxSelectionChanged_(event); - } - } - - private void listBoxSelectionChanged_(@SuppressWarnings("unused") SelectionEvent event) { - this.selectedItemsModel.setValues(this.getListBoxSelectedItems()); - } - - private Iterable getListBoxSelectedItems() { - ArrayList selectedItems = new ArrayList(this.listBox.getSelectionCount()); - for (int selectionIndex : this.listBox.getSelectionIndices()) { - selectedItems.add(this.listModel.get(selectionIndex)); - } - return selectedItems; - } - - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.selectedItemsModel); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/ListWidgetModelBinding.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/ListWidgetModelBinding.java deleted file mode 100644 index 18b9e7c2d8..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/ListWidgetModelBinding.java +++ /dev/null @@ -1,428 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.utility.swt; - -import java.util.ArrayList; - -import org.eclipse.jpt.common.ui.internal.listeners.SWTListChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.StringConverter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; - -/** - * This binding can be used to keep a list widget's contents - * synchronized with a model. The list widget never alters - * its contents directly; all changes are driven by the model. - * - * @see ListValueModel - * @see StringConverter - * @see ListWidget - * @see SelectionBinding - * @see SWTTools - */ -@SuppressWarnings("nls") -final class ListWidgetModelBinding { - - // ***** model - /** - * The underlying list model. - */ - private final ListValueModel listModel; - - /** - * A listener that allows us to synchronize the list widget's contents with - * the model list. - */ - private final ListChangeListener listChangeListener; - - /** - * A converter that converts items in the model list - * to strings that can be put in the list widget. - */ - private final StringConverter stringConverter; - - // ***** UI - /** - * An adapter on the list widget we keep synchronized with the model list. - */ - private final ListWidget listWidget; - - /** - * A listener that allows us to stop listening to stuff when the list widget - * is disposed. (Critical for preventing memory leaks.) - */ - private final DisposeListener listWidgetDisposeListener; - - // ***** selection - /** - * Widget-specific selection binding. - */ - private final SelectionBinding selectionBinding; - - - // ********** constructor ********** - - /** - * Constructor - all parameters are required. - */ - ListWidgetModelBinding( - ListValueModel listModel, - ListWidget listWidget, - StringConverter stringConverter, - SelectionBinding selectionBinding - ) { - super(); - if ((listModel == null) || (listWidget == null) || (stringConverter == null) || (selectionBinding == null)) { - throw new NullPointerException(); - } - this.listModel = listModel; - this.listWidget = listWidget; - this.stringConverter = stringConverter; - this.selectionBinding = selectionBinding; - - this.listChangeListener = this.buildListChangeListener(); - this.listModel.addListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - - this.listWidgetDisposeListener = this.buildListWidgetDisposeListener(); - this.listWidget.addDisposeListener(this.listWidgetDisposeListener); - - this.synchronizeListWidget(); - } - - - // ********** initialization ********** - - private ListChangeListener buildListChangeListener() { - return new SWTListChangeListenerWrapper(this.buildListChangeListener_()); - } - - private ListChangeListener buildListChangeListener_() { - return new ListChangeListener() { - public void itemsAdded(ListAddEvent event) { - ListWidgetModelBinding.this.listItemsAdded(event); - } - public void itemsRemoved(ListRemoveEvent event) { - ListWidgetModelBinding.this.listItemsRemoved(event); - } - public void itemsMoved(ListMoveEvent event) { - ListWidgetModelBinding.this.listItemsMoved(event); - } - public void itemsReplaced(ListReplaceEvent event) { - ListWidgetModelBinding.this.listItemsReplaced(event); - } - public void listCleared(ListClearEvent event) { - ListWidgetModelBinding.this.listCleared(event); - } - public void listChanged(ListChangeEvent event) { - ListWidgetModelBinding.this.listChanged(event); - } - @Override - public String toString() { - return "list listener"; - } - }; - } - - private DisposeListener buildListWidgetDisposeListener() { - return new DisposeListener() { - public void widgetDisposed(DisposeEvent event) { - ListWidgetModelBinding.this.listWidgetDisposed(event); - } - @Override - public String toString() { - return "list widget dispose listener"; - } - }; - } - - - // ********** list ********** - - /** - * Brute force synchronization of list widget with the model list. - */ - private void synchronizeListWidget() { - if ( ! this.listWidget.isDisposed()) { - this.synchronizeListWidget_(); - } - } - - private void synchronizeListWidget_() { - ArrayList items = new ArrayList(this.listModel.size()); - for (E item : this.listModel) { - items.add(this.convert(item)); - } - this.listWidget.setItems(items.toArray(new String[items.size()])); - - // now that the list has changed, we need to synch the selection - this.selectionBinding.synchronizeListWidgetSelection(); - } - - /** - * The model has changed - synchronize the list widget. - */ - void listItemsAdded(ListAddEvent event) { - if ( ! this.listWidget.isDisposed()) { - this.listItemsAdded_(event); - } - } - - private void listItemsAdded_(ListAddEvent event) { - int i = event.getIndex(); - for (E item : this.getItems(event)) { - this.listWidget.add(this.convert(item), i++); - } - - // now that the list has changed, we need to synch the selection - this.selectionBinding.synchronizeListWidgetSelection(); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - private Iterable getItems(ListAddEvent event) { - return (Iterable) event.getItems(); - } - - /** - * The model has changed - synchronize the list widget. - */ - void listItemsRemoved(ListRemoveEvent event) { - if ( ! this.listWidget.isDisposed()) { - this.listItemsRemoved_(event); - } - } - - private void listItemsRemoved_(ListRemoveEvent event) { - this.listWidget.remove(event.getIndex(), event.getIndex() + event.getItemsSize() - 1); - - // now that the list has changed, we need to synch the selection - this.selectionBinding.synchronizeListWidgetSelection(); - } - - /** - * The model has changed - synchronize the list widget. - */ - void listItemsMoved(ListMoveEvent event) { - if ( ! this.listWidget.isDisposed()) { - this.listItemsMoved_(event); - } - } - - private void listItemsMoved_(ListMoveEvent event) { - int target = event.getTargetIndex(); - int source = event.getSourceIndex(); - int len = event.getLength(); - int loStart = Math.min(target, source); - int hiStart = Math.max(target, source); - // make a copy of the affected items... - String[] subArray = ArrayTools.subArray(this.listWidget.getItems(), loStart, hiStart + len); - // ...move them around... - subArray = ArrayTools.move(subArray, target - loStart, source - loStart, len); - // ...and then put them back - int i = loStart; - for (String item : subArray) { - this.listWidget.setItem(i++, item); - } - - // now that the list has changed, we need to synch the selection - this.selectionBinding.synchronizeListWidgetSelection(); - } - - /** - * The model has changed - synchronize the list widget. - */ - void listItemsReplaced(ListReplaceEvent event) { - if ( ! this.listWidget.isDisposed()) { - this.listItemsReplaced_(event); - } - } - - private void listItemsReplaced_(ListReplaceEvent event) { - int i = event.getIndex(); - for (E item : this.getNewItems(event)) { - this.listWidget.setItem(i++, this.convert(item)); - } - - // now that the list has changed, we need to synch the selection - this.selectionBinding.synchronizeListWidgetSelection(); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - private Iterable getNewItems(ListReplaceEvent event) { - return (Iterable) event.getNewItems(); - } - - /** - * The model has changed - synchronize the list widget. - */ - void listCleared(ListClearEvent event) { - if ( ! this.listWidget.isDisposed()) { - this.listCleared_(event); - } - } - - private void listCleared_(@SuppressWarnings("unused") ListClearEvent event) { - this.listWidget.removeAll(); - } - - /** - * The model has changed - synchronize the list widget. - */ - void listChanged(ListChangeEvent event) { - if ( ! this.listWidget.isDisposed()) { - this.listChanged_(event); - } - } - - private void listChanged_(@SuppressWarnings("unused") ListChangeEvent event) { - this.synchronizeListWidget_(); - } - - /** - * Use the string converter to convert the specified item to a - * string that can be added to the list widget. - */ - private String convert(E item) { - return this.stringConverter.convertToString(item); - } - - - // ********** list widget events ********** - - void listWidgetDisposed(@SuppressWarnings("unused") DisposeEvent event) { - // the list widget is not yet "disposed" when we receive this event - // so we can still remove our listeners - this.listWidget.removeDisposeListener(this.listWidgetDisposeListener); - this.listModel.removeListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - this.selectionBinding.dispose(); - } - - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.listModel); - } - - - // ********** adapter interfaces ********** - - /** - * Adapter used by the list widget model binding to query and manipulate - * the widget. - */ - interface ListWidget { - - /** - * Return whether the list widget is "disposed". - */ - boolean isDisposed(); - - /** - * Add the specified dispose listener to the list widget. - */ - void addDisposeListener(DisposeListener listener); - - /** - * Remove the specified dispose listener from the list widget. - */ - void removeDisposeListener(DisposeListener listener); - - /** - * Return the list widget's items. - */ - String[] getItems(); - - /** - * Set the list widget's item at the specified index to the specified item. - */ - void setItem(int index, String item); - - /** - * Set the list widget's items. - */ - void setItems(String[] items); - - /** - * Add the specified item to the list widget's items at the specified index. - */ - void add(String item, int index); - - /** - * Remove the specified range of items from the list widget's items. - */ - void remove(int start, int end); - - /** - * Remove all the items from the list widget. - */ - void removeAll(); - - } - - - /** - * Widget-specific selection binding that is controlled by the list widget - * model binding. - */ - interface SelectionBinding { - - /** - * Synchronize the selection binding's widget with the selection model. - *

- * Pre-condition: The widget is not disposed. - */ - void synchronizeListWidgetSelection(); - - /** - * The widget has been disposed; dispose the selection binding. - */ - void dispose(); - - - /** - * Useful for list boxes that ignore the selection. - */ - final class Null implements SelectionBinding { - public static final SelectionBinding INSTANCE = new Null(); - public static SelectionBinding instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - public void synchronizeListWidgetSelection() { - // do nothing - } - public void dispose() { - // do nothing - } - @Override - public String toString() { - return "SelectionBinding.Null"; //$NON-NLS-1$ - } - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/MultiControlBooleanStateController.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/MultiControlBooleanStateController.java deleted file mode 100644 index aa52a80af1..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/MultiControlBooleanStateController.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.utility.swt; - -import java.util.HashSet; - -import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Control; - -/** - * This controller enables a boolean model to control either the - * enabled or visible properties of a set of SWT controls; - * i.e. the controls' properties are kept in synch with the boolean model, - * but not vice-versa. - * - * @see PropertyValueModel - * @see CollectionValueModel - * @see Control#setEnabled(boolean) - * @see Control#setVisible(boolean) - */ -final class MultiControlBooleanStateController - extends BooleanStateController -{ - /** - * The set of controls whose state is kept in sync with the boolean model. - */ - private final CollectionValueModel controlsModel; - - /** - * A listener that allows clients to add/remove controls. - */ - private final CollectionChangeListener controlsListener; - - /** - * Cache of controls. - */ - private final HashSet controls = new HashSet(); - - - // ********** constructor ********** - - /** - * Constructor - the boolean model, the controls model, and the adapter are required. - */ - MultiControlBooleanStateController( - PropertyValueModel booleanModel, - CollectionValueModel controlsModel, - boolean defaultValue, - Adapter adapter - ) { - super(booleanModel, defaultValue, adapter); - if (controlsModel == null) { - throw new NullPointerException(); - } - this.controlsModel = controlsModel; - this.controlsListener = this.buildControlsListener(); - this.addControls(controlsModel); - } - - - // ********** initialization ********** - - private CollectionChangeListener buildControlsListener() { - return new CollectionChangeListener() { - @SuppressWarnings("unchecked") - public void itemsAdded(CollectionAddEvent event) { - MultiControlBooleanStateController.this.addControls((Iterable) event.getItems()); - } - @SuppressWarnings("unchecked") - public void itemsRemoved(CollectionRemoveEvent event) { - MultiControlBooleanStateController.this.removeControls((Iterable) event.getItems()); - } - public void collectionCleared(CollectionClearEvent event) { - MultiControlBooleanStateController.this.clearControls(); - } - @SuppressWarnings("unchecked") - public void collectionChanged(CollectionChangeEvent event) { - MultiControlBooleanStateController.this.clearControls(); - MultiControlBooleanStateController.this.addControls((Iterable) event.getCollection()); - } - @Override - public String toString() { - return "controls listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** controls ********** - - @Override - void setControlState(boolean b) { - for (Control control : this.controls) { - this.setControlState(control, b); - } - } - - /* CU private */ void addControls(Iterable controls_) { - boolean b = this.getBooleanValue(); - for (Control control : controls_) { - this.addControl(control, b); - } - } - - private void addControl(Control control, boolean b) { - if (this.controls.isEmpty()) { - this.engageBooleanModel(); - this.controlsModel.addCollectionChangeListener(CollectionValueModel.VALUES, this.controlsListener); - } - if (this.controls.add(control)) { - this.engageControl(control); - this.setControlState(control, b); - } else { - throw new IllegalArgumentException("duplicate control: " + control); //$NON-NLS-1$ - } - } - - /* CU private */ void clearControls() { - this.removeControls(new SnapshotCloneIterable(this.controls)); - } - - /* CU private */ void removeControls(Iterable controls_) { - for (Control control : controls_) { - this.disengageControl(control); - this.removeControl(control); - } - } - - private void removeControl(Control control) { - this.controls.remove(control); - if (this.controls.isEmpty()) { - this.controlsModel.removeCollectionChangeListener(CollectionValueModel.VALUES, this.controlsListener); - this.disengageBooleanModel(); - } - } - - @Override - void controlDisposed(Control control) { - super.controlDisposed(control); - this.removeControl(control); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SWTComboAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SWTComboAdapter.java deleted file mode 100644 index 672524d2d2..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SWTComboAdapter.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.utility.swt; - -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.Combo; - -/** - * Adapt an SWT {@link Combo} to the list widget expected by - * {@link ListWidgetModelBinding} and the - * drop-down list box expected by {@link DropDownListBoxSelectionBinding}. - */ -final class SWTComboAdapter - extends AbstractListWidgetAdapter - implements DropDownListBoxSelectionBinding.DropDownListBox -{ - SWTComboAdapter(Combo combo) { - super(combo); - } - - // ********** ListWidgetModelBinding.ListWidget implementation ********** - public String[] getItems() { - return this.widget.getItems(); - } - public void setItem(int index, String item) { - this.widget.setItem(index, item); - } - public void setItems(String[] items) { - this.widget.setItems(items); - } - public void add(String item, int index) { - this.widget.add(item, index); - } - public void remove(int start, int end) { - this.widget.remove(start, end); - } - public void removeAll() { - this.widget.removeAll(); - } - - // ********** ComboBoxSelectionBinding.ComboBox implementation ********** - public void addSelectionListener(SelectionListener listener) { - this.widget.addSelectionListener(listener); - } - public void removeSelectionListener(SelectionListener listener) { - this.widget.removeSelectionListener(listener); - } - public int getSelectionIndex() { - return this.widget.getSelectionIndex(); - } - public void select(int index) { - this.widget.select(index); - } - public void deselect(int index) { - this.widget.deselect(index); - } - public void deselectAll() { - this.widget.deselectAll(); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SWTListAdapter.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SWTListAdapter.java deleted file mode 100644 index 767be1bb86..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SWTListAdapter.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.utility.swt; - -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.widgets.List; - -/** - * Adapt an SWT {@link List} to the list widget expected by - * {@link ListWidgetModelBinding}. - */ -final class SWTListAdapter - extends AbstractListWidgetAdapter -{ - SWTListAdapter(List list) { - super(list); - } - public void addSelectionListener(SelectionListener listener) { - this.widget.addSelectionListener(listener); - } - public void removeSelectionListener(SelectionListener listener) { - this.widget.removeSelectionListener(listener); - } - public String[] getItems() { - return this.widget.getItems(); - } - public void setItem(int index, String item) { - this.widget.setItem(index, item); - } - public void setItems(String[] items) { - this.widget.setItems(items); - } - public void add(String item, int index) { - this.widget.add(item, index); - } - public void remove(int start, int end) { - this.widget.remove(start, end); - } - public void removeAll() { - this.widget.removeAll(); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SWTTools.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SWTTools.java deleted file mode 100644 index f5b9358a74..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SWTTools.java +++ /dev/null @@ -1,392 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.utility.swt; - -import java.util.Arrays; - -import org.eclipse.jpt.common.utility.internal.BitTools; -import org.eclipse.jpt.common.utility.internal.StringConverter; -import org.eclipse.jpt.common.utility.internal.model.value.StaticCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.WritablePropertyCollectionValueModelAdapter; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritableCollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Text; -import org.eclipse.swt.widgets.Widget; - -/** - * Various SWT tools. - */ -@SuppressWarnings("nls") -public final class SWTTools { - - // ********** check-box/radio button/toggle button ********** - - /** - * Bind the specified button (check-box, radio button, or toggle button) - * to the specified boolean model. - * If the boolean model is null, the button's 'selection' state will - * be false. - */ - public static void bind(WritablePropertyValueModel booleanModel, Button button) { - bind(booleanModel, button, false); - } - - /** - * Bind the specified button (check-box, radio button, or toggle button) - * to the specified boolean model. - * If the boolean model is null, the button's 'selection' state will - * be the specified default value. - */ - public static void bind(WritablePropertyValueModel booleanModel, Button button, boolean defaultValue) { - // the new binding will add itself as a listener to the boolean model and the button - new BooleanButtonModelBinding(booleanModel, button, defaultValue); - } - - - // ********** text field ********** - - /** - * Bind the specified text model to the specified text field. - */ - public static void bind(WritablePropertyValueModel textModel, Text textField) { - // the new binding will add itself as a listener to the text model and the text field - new TextFieldModelBinding(textModel, textField); - } - - - // ********** list box ********** - - /** - * Bind the specified model list to the specified list box. - * The list box selection is ignored. - * Use the default string converter to convert the model items to strings - * to be displayed in the list box, which calls {@link Object#toString()} - * on the items in the model list. - */ - public static void bind(ListValueModel listModel, List listBox) { - bind(listModel, listBox, StringConverter.Default.instance()); - } - - /** - * Bind the specified model list to the specified list box. - * The list box selection is ignored. - * Use the specified string converter to convert the model items to strings - * to be displayed in the list box. - */ - public static void bind(ListValueModel listModel, List listBox, StringConverter stringConverter) { - bind(listModel, new SWTListAdapter(listBox), stringConverter); - } - - /** - * Bind the specified model list and selection to the specified list box. - * Use the default string converter to convert the model items to strings - * to be displayed in the list box, which calls {@link Object#toString()} - * on the items in the model list. - */ - public static void bind(ListValueModel listModel, WritablePropertyValueModel selectedItemModel, List listBox) { - bind(listModel, selectedItemModel, listBox, StringConverter.Default.instance()); - } - - /** - * Adapt the specified model list and selection to the specified list box. - * Use the specified string converter to convert the model items to strings - * to be displayed in the list box. - */ - public static void bind(ListValueModel listModel, WritablePropertyValueModel selectedItemModel, List listBox, StringConverter stringConverter) { - checkForSingleSelectionStyle(listBox); - bind(listModel, new WritablePropertyCollectionValueModelAdapter(selectedItemModel), listBox, stringConverter); - } - - /** - * Bind the specified model list and selections to the specified list box. - * Use the default string converter to convert the model items to strings - * to be displayed in the list box, which calls {@link Object#toString()} - * on the items in the model list. - */ - public static void bind(ListValueModel listModel, WritableCollectionValueModel selectedItemsModel, List listBox) { - bind(listModel, selectedItemsModel, listBox, StringConverter.Default.instance()); - } - - /** - * Bind the specified model list and selections to the specified list box. - * Use the specified string converter to convert the model items to strings - * to be displayed in the list box. - */ - public static void bind(ListValueModel listModel, WritableCollectionValueModel selectedItemsModel, List listBox, StringConverter stringConverter) { - bind( - listModel, - new SWTListAdapter(listBox), - stringConverter, - new ListBoxSelectionBinding(listModel, selectedItemsModel, listBox) - ); - } - - private static void checkForSingleSelectionStyle(List listBox) { - if ( ! BitTools.flagIsSet(listBox.getStyle(), SWT.SINGLE)) { - throw new IllegalStateException("list box must be single-selection: " + listBox); - } - } - - - // ********** drop-down list box ********** - - /** - * Bind the specified model list and selection to the specified drop-down list box. - * Use the default string converter to convert the model items to strings - * to be displayed in the drop-down list box, which calls {@link Object#toString()} - * on the items in the model list. - */ - public static void bind(ListValueModel listModel, WritablePropertyValueModel selectedItemModel, Combo dropDownListBox) { - bind(listModel, selectedItemModel, dropDownListBox, StringConverter.Default.instance()); - } - - /** - * Adapt the specified model list and selection to the specified drop-down list box. - * Use the specified string converter to convert the model items to strings - * to be displayed in the drop-down list box. - */ - public static void bind(ListValueModel listModel, WritablePropertyValueModel selectedItemModel, Combo dropDownListBox, StringConverter stringConverter) { - checkForReadOnlyStyle(dropDownListBox); - SWTComboAdapter comboAdapter = new SWTComboAdapter(dropDownListBox); - bind( - listModel, - comboAdapter, - stringConverter, - new DropDownListBoxSelectionBinding(listModel, selectedItemModel, comboAdapter) - ); - } - - private static void checkForReadOnlyStyle(Widget comboBox) { - if ( ! BitTools.flagIsSet(comboBox.getStyle(), SWT.READ_ONLY)) { - throw new IllegalStateException("combo-box must be read-only: " + comboBox); - } - } - - - // ********** list "widget" ********** - - /** - * Bind the specified model list to the specified list widget. - * The list widget's selection is ignored. - * Use the specified string converter to convert the model items to strings - * to be displayed in the list box. - */ - private static void bind(ListValueModel listModel, ListWidgetModelBinding.ListWidget listWidget, StringConverter stringConverter) { - bind(listModel, listWidget, stringConverter, ListWidgetModelBinding.SelectionBinding.Null.instance()); - } - - /** - * Bind the specified model list to the specified list widget. - * Use the specified selection binding to control the list widget's selection. - * Use the specified string converter to convert the model items to strings - * to be displayed in the list box. - */ - private static void bind(ListValueModel listModel, ListWidgetModelBinding.ListWidget listWidget, StringConverter stringConverter, ListWidgetModelBinding.SelectionBinding selectionBinding) { - // the new binding will add itself as a listener to the value models and the list box - new ListWidgetModelBinding(listModel, listWidget, stringConverter, selectionBinding); - } - - - // ********** 'enabled' state ********** - - /** - * Control the enabled state of the specified controls with the - * specified boolean. If the boolean is null, the controls' - * enabled states will be false. - */ - public static void controlEnabledState(PropertyValueModel booleanModel, Control... controls) { - controlEnabledState(booleanModel, controls, false); - } - - /** - * Control the enabled state of the specified controls with the - * specified boolean. If the boolean is null, the controls' - * enabled states will be the specified default value. - */ - public static void controlEnabledState(PropertyValueModel booleanModel, Control[] controls, boolean defaultValue) { - switch (controls.length) { - case 0: - throw new IllegalArgumentException("empty controls array: " + Arrays.toString(controls)); - case 1: - controlEnabledState(booleanModel, controls[0], defaultValue); - break; - default: - controlEnabledState(booleanModel, new StaticCollectionValueModel(controls), defaultValue); - break; - } - } - - /** - * Control the enabled state of the specified controls with the - * specified boolean. If the boolean is null, the controls' - * enabled states will be false. - */ - public static void controlEnabledState(PropertyValueModel booleanModel, Iterable controls) { - controlEnabledState(booleanModel, controls, false); - } - - /** - * Control the enabled state of the specified controls with the - * specified boolean. If the boolean is null, the controls' - * enabled states will be the specified default value. - */ - public static void controlEnabledState(PropertyValueModel booleanModel, Iterable controls, boolean defaultValue) { - controlEnabledState(booleanModel, new StaticCollectionValueModel(controls), defaultValue); - } - - /** - * Control the enabled state of the specified controls with the - * specified boolean. If the boolean is null, the controls' - * enabled states will be false. - */ - public static void controlEnabledState(PropertyValueModel booleanModel, CollectionValueModel controlsModel) { - controlEnabledState(booleanModel, controlsModel, false); - } - - /** - * Control the enabled state of the specified controls with the - * specified boolean. If the boolean is null, the controls' - * enabled states will be the specified default value. - */ - public static void controlEnabledState(PropertyValueModel booleanModel, CollectionValueModel controlsModel, boolean defaultValue) { - control(booleanModel, controlsModel, defaultValue, ENABLED_ADAPTER); - } - - /** - * Control the enabled state of the specified control with the - * specified boolean. If the boolean is null, the control's - * enabled state will be the specified default value. - */ - public static void controlEnabledState(PropertyValueModel booleanModel, Control control, boolean defaultValue) { - control(booleanModel, control, defaultValue, ENABLED_ADAPTER); - } - - private static final BooleanStateController.Adapter ENABLED_ADAPTER = - new BooleanStateController.Adapter() { - public void setState(Control control, boolean b) { - control.setEnabled(b); - } - }; - - - // ********** 'visible' state ********** - - /** - * Control the visible state of the specified controls with the - * specified boolean. If the boolean is null, the controls' - * visible states will be false. - */ - public static void controlVisibleState(PropertyValueModel booleanModel, Control... controls) { - controlVisibleState(booleanModel, controls, false); - } - - /** - * Control the visible state of the specified controls with the - * specified boolean. If the boolean is null, the controls' - * visible states will be the specified default value. - */ - public static void controlVisibleState(PropertyValueModel booleanModel, Control[] controls, boolean defaultValue) { - switch (controls.length) { - case 0: - throw new IllegalArgumentException("empty controls array: " + Arrays.toString(controls)); - case 1: - controlVisibleState(booleanModel, controls[0], defaultValue); - break; - default: - controlVisibleState(booleanModel, new StaticCollectionValueModel(controls), defaultValue); - break; - } - } - - /** - * Control the visible state of the specified controls with the - * specified boolean. If the boolean is null, the controls' - * visible states will be false. - */ - public static void controlVisibleState(PropertyValueModel booleanModel, Iterable controls) { - controlVisibleState(booleanModel, controls, false); - } - - /** - * Control the visible state of the specified controls with the - * specified boolean. If the boolean is null, the controls' - * visible states will be the specified default value. - */ - public static void controlVisibleState(PropertyValueModel booleanModel, Iterable controls, boolean defaultValue) { - controlVisibleState(booleanModel, new StaticCollectionValueModel(controls), defaultValue); - } - - /** - * Control the visible state of the specified controls with the - * specified boolean. If the boolean is null, the controls' - * visible states will be false. - */ - public static void controlVisibleState(PropertyValueModel booleanModel, CollectionValueModel controlsModel) { - controlVisibleState(booleanModel, controlsModel, false); - } - - /** - * Control the visible state of the specified controls with the - * specified boolean. If the boolean is null, the controls' - * visible states will be the specified default value. - */ - public static void controlVisibleState(PropertyValueModel booleanModel, CollectionValueModel controlsModel, boolean defaultValue) { - control(booleanModel, controlsModel, defaultValue, VISIBLE_ADAPTER); - } - - /** - * Control the visible state of the specified control with the - * specified boolean. If the boolean is null, the control's - * visible state will be the specified default value. - */ - public static void controlVisibleState(PropertyValueModel booleanModel, Control control, boolean defaultValue) { - control(booleanModel, control, defaultValue, VISIBLE_ADAPTER); - } - - private static final BooleanStateController.Adapter VISIBLE_ADAPTER = - new BooleanStateController.Adapter() { - public void setState(Control control, boolean b) { - control.setVisible(b); - } - }; - - - // ********** boolean state controller ********** - - private static void control(PropertyValueModel booleanModel, CollectionValueModel controlsModel, boolean defaultValue, BooleanStateController.Adapter adapter) { - // the new controller will add itself as a listener to the value model and the controls - new MultiControlBooleanStateController(booleanModel, controlsModel, defaultValue, adapter); - } - - private static void control(PropertyValueModel booleanModel, Control control, boolean defaultValue, BooleanStateController.Adapter adapter) { - // the new controller will add itself as a listener to the value model and the controls - new SimpleBooleanStateController(booleanModel, control, defaultValue, adapter); - } - - - // ********** constructor ********** - - /** - * Suppress default constructor, ensuring non-instantiability. - */ - private SWTTools() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SimpleBooleanStateController.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SimpleBooleanStateController.java deleted file mode 100644 index 0b38bb3c1d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/SimpleBooleanStateController.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.utility.swt; - -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Control; - -/** - * This controller enables a boolean model to control either the - * enabled or visible properties of an SWT control; i.e. the - * control's property is kept in synch with the boolean model, - * but not vice-versa. - *

- * Once the control is disposed, this controller is kaput. - * - * @see PropertyValueModel - * @see Control#setEnabled(boolean) - * @see Control#setVisible(boolean) - */ -final class SimpleBooleanStateController - extends BooleanStateController -{ - private final Control control; - - - // ********** constructor ********** - - /** - * Constructor - the boolean model, the control, and the adapter are required. - */ - SimpleBooleanStateController( - PropertyValueModel booleanModel, - Control control, - boolean defaultValue, - Adapter adapter - ) { - super(booleanModel, defaultValue, adapter); - if (control == null) { - throw new NullPointerException(); - } - this.control = control; - this.engageBooleanModel(); - this.engageControl(control); - this.setControlState(control, this.getBooleanValue()); - } - - - // ********** controls ********** - - @Override - void setControlState(boolean b) { - this.setControlState(this.control, b); - } - - @Override - void controlDisposed(Control c) { - super.controlDisposed(c); - this.disengageBooleanModel(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/TextFieldModelBinding.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/TextFieldModelBinding.java deleted file mode 100644 index 12c0ce1b3e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/utility/swt/TextFieldModelBinding.java +++ /dev/null @@ -1,196 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.utility.swt; - -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.events.DisposeEvent; -import org.eclipse.swt.events.DisposeListener; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.widgets.Text; - -/** - * This binding can be used to keep a text field - * synchronized with a model text/string. - * - * @see WritablePropertyValueModel - * @see Text - */ -@SuppressWarnings("nls") -class TextFieldModelBinding { - - /** - * The text model we keep synchronized with the text field. - */ - private final WritablePropertyValueModel textModel; - - /** - * A listener that allows us to synchronize the text field's contents with - * the text model. - */ - private final PropertyChangeListener textModelChangeListener; - - /** - * The text field we keep synchronized with the text model. - */ - private final Text textField; - - /** - * A listener that allows us to synchronize our text model - * with the text field's contents. - */ - private final ModifyListener textFieldModifyListener; - - /** - * A listener that allows us to stop listening to stuff when the text field - * is disposed. - */ - private final DisposeListener textFieldDisposeListener; - - /** - * Hmm... - */ - private boolean settingTextFieldText = false; - - - // ********** constructor ********** - - /** - * Constructor - the text model and text field are required. - */ - TextFieldModelBinding(WritablePropertyValueModel textModel, Text textField) { - super(); - if ((textModel == null) || (textField == null)) { - throw new NullPointerException(); - } - this.textModel = textModel; - this.textField = textField; - - this.textModelChangeListener = this.buildTextModelChangeListener(); - this.textModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.textModelChangeListener); - - this.textFieldModifyListener = this.buildTextFieldModifyListener(); - this.textField.addModifyListener(this.textFieldModifyListener); - - this.textFieldDisposeListener = this.buildTextFieldDisposeListener(); - this.textField.addDisposeListener(this.textFieldDisposeListener); - - this.setTextFieldText(textModel.getValue()); - } - - - // ********** initialization ********** - - private PropertyChangeListener buildTextModelChangeListener() { - return new SWTPropertyChangeListenerWrapper(this.buildTextModelChangeListener_()); - } - - private PropertyChangeListener buildTextModelChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - TextFieldModelBinding.this.textModelChanged(event); - } - @Override - public String toString() { - return "text listener"; - } - }; - } - - private ModifyListener buildTextFieldModifyListener() { - return new ModifyListener() { - public void modifyText(ModifyEvent event) { - TextFieldModelBinding.this.textFieldModified(); - } - @Override - public String toString() { - return "text field modify listener"; - } - }; - } - - private DisposeListener buildTextFieldDisposeListener() { - return new DisposeListener() { - public void widgetDisposed(DisposeEvent event) { - TextFieldModelBinding.this.textFieldDisposed(); - } - @Override - public String toString() { - return "text field dispose listener"; - } - }; - } - - - // ********** text model events ********** - - /* CU private */ void textModelChanged(PropertyChangeEvent event) { - if ( ! this.textField.isDisposed()) { // ??? - this.setTextFieldText((String) event.getNewValue()); - } - } - - private void setTextFieldText(String text) { - // the text model can be null, but the text field cannot - this.setTextFieldText_((text == null) ? "" : text); - } - - private void setTextFieldText_(String text) { - if ( ! text.equals(this.textField.getText())) { // ??? - this.setTextFieldText__(text); - } - } - - private void setTextFieldText__(String text) { - this.settingTextFieldText = true; - try { - this.textField.setText(text); - } finally { - this.settingTextFieldText = false; - } - } - - - // ********** text field events ********** - - /* CU private */ void textFieldModified() { - if ( ! this.settingTextFieldText) { - this.setTextModelText(this.textField.getText()); - } - } - - private void setTextModelText(String text) { - if ( ! text.equals(this.textModel.getValue())) { // ??? - this.textModel.setValue(text); - } - } - - /* CU private */ void textFieldDisposed() { - // the text field is not yet "disposed" when we receive this event - // so we can still remove our listeners - this.textField.removeDisposeListener(this.textFieldDisposeListener); - this.textField.removeModifyListener(this.textFieldModifyListener); - this.textModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.textModelChangeListener); - } - - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.textModel); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemoveListPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemoveListPane.java deleted file mode 100644 index 3aefe2adfe..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemoveListPane.java +++ /dev/null @@ -1,554 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.jface.viewers.IBaseLabelProvider; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.ui.internal.swt.ColumnAdapter; -import org.eclipse.jpt.common.ui.internal.swt.TableModelAdapter; -import org.eclipse.jpt.common.ui.internal.swt.TableModelAdapter.SelectionChangeEvent; -import org.eclipse.jpt.common.ui.internal.swt.TableModelAdapter.SelectionChangeListener; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ObjectListSelectionModel; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Layout; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; - -/** - * This implementation of the AddRemovePane uses a Table - * as its main widget, a List can't be used because it doesn't - * support showing images. However, the table is displayed like a list. - *

- * Here the layot of this pane: - *

- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------- ----------- |
- * | | Item 1                                                    | | Add...  | |
- * | | ...                                                       | ----------- |
- * | | Item n                                                    | ----------- |
- * | |                                                           | | Edit... | |
- * | |                                                           | ----------- |
- * | |                                                           | ----------- |
- * | |                                                           | | Remove  | |
- * | |                                                           | ----------- |
- * | -------------------------------------------------------------             |
- * -----------------------------------------------------------------------------
- * - * @version 2.0 - * @since 1.0 - */ -@SuppressWarnings("nls") -public class AddRemoveListPane extends AddRemovePane -{ - - /** - * The main widget of this add/remove pane. - */ - private Table table; - - /** - * Creates a new AddRemoveListPane. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param adapter - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the table holder's items - */ - public AddRemoveListPane(Pane parentPane, - Composite parent, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - ILabelProvider labelProvider) { - - super(parentPane, - parent, - adapter, - listHolder, - selectedItemHolder, - labelProvider); - } - - /** - * Creates a new AddRemoveListPane. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param adapter - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the table holder's items - * @param helpId The topic help ID to be registered with this pane - */ - public AddRemoveListPane(Pane parentPane, - Composite parent, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - ILabelProvider labelProvider, - String helpId) { - - super(parentPane, - parent, - adapter, - listHolder, - selectedItemHolder, - labelProvider, - helpId); - } - - /** - * Creates a new AddRemoveListPane. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param adapter - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the table holder's items - * @param helpId The topic help ID to be registered with this pane - * @param parentManagePane true to have the parent pane manage - * the enabled state of this pane - */ - public AddRemoveListPane(Pane parentPane, - Composite parent, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - ILabelProvider labelProvider, - String helpId, - boolean parentManagePane) { - - super(parentPane, - parent, - adapter, - listHolder, - selectedItemHolder, - labelProvider, - helpId, - parentManagePane); - } - - /** - * Creates a new AddRemoveListPane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of the subject - * @param adapter - * @param parent The parent container - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the table holder's items - */ - public AddRemoveListPane(Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - ILabelProvider labelProvider) { - - super(parentPane, - subjectHolder, - parent, - adapter, - listHolder, - selectedItemHolder, - labelProvider); - } - - /** - * Creates a new AddRemoveListPane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of the subject - * @param adapter - * @param parent The parent container - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the table holder's items - * @param helpId The topic help ID to be registered with this pane - */ - public AddRemoveListPane(Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - ILabelProvider labelProvider, - String helpId) { - - super(parentPane, - subjectHolder, - parent, - adapter, - listHolder, - selectedItemHolder, - labelProvider, - helpId); - } - - private ColumnAdapter buildColumnAdapter() { - return new ColumnAdapter() { - public WritablePropertyValueModel[] cellModels(Object subject) { - WritablePropertyValueModel[] valueHolders = new WritablePropertyValueModel[1]; - valueHolders[0] = new SimplePropertyValueModel(subject); - return valueHolders; - } - - public int columnCount() { - return 1; - } - - public String columnName(int columnIndex) { - return ""; - } - }; - } - - @Override - protected void itemsAdded(ListAddEvent e) { - super.itemsAdded(e); - revalidateLayout(); - } - - @Override - protected void itemsMoved(ListMoveEvent e) { - super.itemsMoved(e); - revalidateLayout(); - } - - @Override - protected void itemsRemoved(ListRemoveEvent e) { - super.itemsRemoved(e); - revalidateLayout(); - } - - @Override - protected void itemsReplaced(ListReplaceEvent e) { - super.itemsReplaced(e); - revalidateLayout(); - } - - @Override - protected void listChanged(ListChangeEvent e) { - super.listChanged(e); - revalidateLayout(); - } - - @Override - protected void listCleared(ListClearEvent e) { - super.listCleared(e); - revalidateLayout(); - } - - /** - * Revalidates the table layout after the list of items has changed. The - * layout has to be done in a new UI thread because our listener might be - * notified before the table has been updated (table column added or removed). - */ - private void revalidateLayout() { - SWTUtil.asyncExec(new Runnable() { public void run() { - if (!table.isDisposed()) { - table.getParent().computeSize(SWT.DEFAULT, SWT.DEFAULT); - table.getParent().layout(); - } - }}); - } - - private PropertyChangeListener buildSelectedItemPropertyChangeListener() { - return new SWTPropertyChangeListenerWrapper( - buildSelectedItemPropertyChangeListener_() - ); - } - - private PropertyChangeListener buildSelectedItemPropertyChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - if (table.isDisposed()) { - return; - } - getSelectionModel().setSelectedValue(e.getNewValue()); - updateButtons(); - } - }; - } - - private SelectionChangeListener buildSelectionListener() { - return new SelectionChangeListener() { - public void selectionChanged(SelectionChangeEvent e) { - AddRemoveListPane.this.selectionChanged(); - } - }; - } - - private Composite addTableContainer(Composite container) { - - container = addPane(container, buildTableContainerLayout()); - container.setLayoutData(new GridData(GridData.FILL_BOTH)); - return container; - } - - private Layout buildTableContainerLayout() { - return new Layout() { - @Override - protected Point computeSize(Composite composite, - int widthHint, - int heightHint, - boolean flushCache) { - - Table table = (Table) composite.getChildren()[0]; - TableColumn tableColumn = table.getColumn(0); - int columnWidth = tableColumn.getWidth(); - packColumn(table); - - // Calculate the table size and adjust it with the hints - Point size = table.computeSize(SWT.DEFAULT, SWT.DEFAULT); - - if (widthHint != SWT.DEFAULT) { - size.x = widthHint; - } - - if (heightHint != SWT.DEFAULT) { - size.y = heightHint; - } - - // Revert the column's width to its current value - table.setRedraw(false); - table.setLayoutDeferred(true); - tableColumn.setWidth(columnWidth); - table.setLayoutDeferred(false); - table.setRedraw(true); - - return size; - } - - private boolean isVerticalScrollbarBarVisible(Table table, - Rectangle clientArea) { - - // Get the height of all the rows - int height = table.getItemCount() * table.getItemHeight(); - - // Remove the border from the height - height += (table.getBorderWidth() * 2); - - return (clientArea.height < height); - } - - @Override - protected void layout(Composite composite, boolean flushCache) { - - Rectangle bounds = composite.getClientArea(); - - if (bounds.width > 0) { - - Table table = (Table) composite.getChildren()[0]; - table.setBounds(0, 0, bounds.width, bounds.height); - - updateTableColumnWidth( - table, - bounds.width, - isVerticalScrollbarBarVisible(table, bounds) - ); - } - } - - private void packColumn(Table table) { - - TableColumn tableColumn = table.getColumn(0); - - table.setRedraw(false); - table.setLayoutDeferred(true); - tableColumn.pack(); - table.setLayoutDeferred(false); - table.setRedraw(true); - - // Cache the column width so it can be used in - // updateTableColumnWidth() when determine which width to use - table.setData( - "column.width", - Integer.valueOf(tableColumn.getWidth()) - ); - } - - private void updateTableColumnWidth(Table table, - int width, - boolean verticalScrollbarBarVisible) { - - // Remove the border from the width - width -= (table.getBorderWidth() * 2); - - // Remove the scrollbar from the width if it is shown - if (verticalScrollbarBarVisible) { - width -= table.getVerticalBar().getSize().x; - } - - TableColumn tableColumn = table.getColumn(0); - - // Retrieve the cached column width, which is required for - // determining which width to use (the column width or the - // calculated width) - Integer columnWitdh = (Integer) table.getData("column.width"); - - // Use the calculated width if the column is smaller, otherwise - // use the column width and a horizontal scroll bar will show up - width = Math.max(width, columnWitdh); - - // Adjust the column width - tableColumn.setWidth(width); - } - }; - } - - private ITableLabelProvider buildTableLabelProvider(IBaseLabelProvider labelProvider) { - return new TableLabelProvider((ILabelProvider) labelProvider); - } - - /* - * (non-Javadoc) - */ - @Override - public Table getMainControl() { - return table; - } - - /* - * (non-Javadoc) - */ - @Override - @SuppressWarnings("unchecked") - protected void initializeMainComposite(Composite container, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - IBaseLabelProvider labelProvider, - String helpId) { - - table = addUnmanagedTable( - addTableContainer(container), - SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.MULTI, - helpId - ); - - - TableModelAdapter model = TableModelAdapter.adapt( - (ListValueModel) listHolder, - getSelectedItemHolder(), - table, - buildColumnAdapter(), - buildTableLabelProvider(labelProvider) - ); - - model.addSelectionChangeListener(buildSelectionListener()); - - selectedItemHolder.addPropertyChangeListener( - PropertyValueModel.VALUE, - buildSelectedItemPropertyChangeListener() - ); - - initializeTable(table); - } - - /** - * Initializes the given table, which acts like a list in our case. - * - * @param table The main widget of this pane - */ - protected void initializeTable(Table table) { - - table.setData("column.width", new Integer(0)); - table.setHeaderVisible(false); - table.setLinesVisible(false); - } - - /** - * The selection has changed, update (1) the selected item holder, (2) the - * selection model and (3) the buttons. - */ - private void selectionChanged() { - WritablePropertyValueModel selectedItemHolder = getSelectedItemHolder(); - ObjectListSelectionModel selectionModel = getSelectionModel(); - int selectionCount = this.table.getSelectionCount(); - - if (selectionCount == 0) { - selectedItemHolder.setValue(null); - selectionModel.clearSelection(); - } - else if (selectionCount != 1) { - selectedItemHolder.setValue(null); - selectionModel.clearSelection(); - - for (int index : this.table.getSelectionIndices()) { - selectionModel.addSelectionInterval(index, index); - } - } - else { - int selectedIndex = this.table.getSelectionIndex(); - Object selectedItem = getListHolder().get(selectedIndex); - - selectedItemHolder.setValue(selectedItem); - selectionModel.setSelectedValue(selectedItem); - } - - updateButtons(); - } - - /** - * This label provider simply delegates the rendering to the provided - * ILabelProvider. - */ - private class TableLabelProvider extends LabelProvider - implements ITableLabelProvider { - - private ILabelProvider labelProvider; - - TableLabelProvider(ILabelProvider labelProvider) { - super(); - this.labelProvider = labelProvider; - } - - public Image getColumnImage(Object element, int columnIndex) { - return labelProvider.getImage(element); - } - - public String getColumnText(Object element, int columnIndex) { - return labelProvider.getText(element); - } - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemovePane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemovePane.java deleted file mode 100644 index 79d6175759..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemovePane.java +++ /dev/null @@ -1,923 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import java.util.Arrays; - -import org.eclipse.jface.viewers.IBaseLabelProvider; -import org.eclipse.jpt.common.ui.internal.JptCommonUiMessages; -import org.eclipse.jpt.common.ui.internal.listeners.SWTListChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ListModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ObjectListSelectionModel; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -/** - * The abstract definition of a pane that has buttons for adding, removing and - * possibly editing the items. - * - * @see AddRemoveListPane - * - * @version 1.0 - * @since 2.0 - */ -public abstract class AddRemovePane extends Pane -{ - private Adapter adapter; - private Button addButton; - private Composite container; - private boolean enabled; - private IBaseLabelProvider labelProvider; - private ListValueModel listHolder; - private Button optionalButton; - private Button removeButton; - private WritablePropertyValueModel selectedItemHolder; - private ObjectListSelectionModel selectionModel; - - /** - * Creates a new AddRemovePane. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param adapter This Adapter is used to dictacte the behavior - * of this AddRemovePane and by delegating to it some of the - * behavior - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the list holder's items - */ - protected AddRemovePane(Pane parentPane, - Composite parent, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - IBaseLabelProvider labelProvider) { - - this(parentPane, - parent, - adapter, - listHolder, - selectedItemHolder, - labelProvider, - null); - } - - /** - * Creates a new AddRemovePane. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param adapter This Adapter is used to dictacte the behavior - * of this AddRemovePane and by delegating to it some of the - * behavior - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the list holder's items - * @param helpId The topic help ID to be registered with this pane - */ - protected AddRemovePane(Pane parentPane, - Composite parent, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - IBaseLabelProvider labelProvider, - String helpId) { - - this(parentPane, - parent, - adapter, - listHolder, - selectedItemHolder, - labelProvider, - helpId, - true); - } - /** - * Creates a new AddRemovePane. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param adapter This Adapter is used to dictacte the behavior - * of this AddRemovePane and by delegating to it some of the - * behavior - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the list holder's items - * @param helpId The topic help ID to be registered with this pane - * @param parentManagePane true to have the parent pane manage - * the enabled state of this pane - */ - protected AddRemovePane(Pane parentPane, - Composite parent, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - IBaseLabelProvider labelProvider, - String helpId, - boolean parentManagePane) { - - super(parentPane, parent, true, parentManagePane); - - initialize( - adapter, - listHolder, - selectedItemHolder, - labelProvider - ); - - initializeLayout( - adapter, - listHolder, - selectedItemHolder, - labelProvider, - helpId - ); - } - - /** - * Creates a new AddRemovePane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of the subject - * @param adapter This Adapter is used to dictacte the behavior - * of this AddRemovePane and by delegating to it some of the - * behavior - * @param parent The parent container - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the list holder's items - */ - protected AddRemovePane(Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - IBaseLabelProvider labelProvider) { - - this(parentPane, - subjectHolder, - parent, - adapter, - listHolder, - selectedItemHolder, - labelProvider, - null); - } - - /** - * Creates a new AddRemovePane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of the subject - * @param adapter This Adapter is used to dictacte the behavior - * of this AddRemovePane and by delegating to it some of the - * behavior - * @param parent The parent container - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the list holder's items - * @param helpId The topic help ID to be registered with this pane - */ - protected AddRemovePane(Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - IBaseLabelProvider labelProvider, - String helpId) { - - super(parentPane, subjectHolder, parent); - - initialize( - adapter, - listHolder, - selectedItemHolder, - labelProvider - ); - - initializeLayout( - adapter, - listHolder, - selectedItemHolder, - labelProvider, - helpId - ); - } - - /** - * Gives the possibility to add buttons after the Add button and before the - * optional button. - * - * @param container The parent container - * @param helpId The topic help ID to be registered with the buttons - * - * @category Layout - */ - protected void addCustomButtonAfterAddButton(Composite container, - String helpId) { - } - - /** - * Gives the possibility to add buttons after the optional button and before - * the Remove button. - * - * @param container The parent container - * @param helpId The topic help ID to be registered with the buttons - * - * @category Layout - */ - protected void addCustomButtonAfterOptionalButton(Composite container, - String helpId) { - } - - /** - * @category Add - */ - protected void addItem() { - adapter.addNewItem(selectionModel); - } - - /** - * @category Initialize - */ - protected Adapter buildAdapter() { - return adapter; - } - - /** - * @category Add - */ - protected Button addAddButton(Composite parent) { - return addUnmanagedButton( - parent, - adapter.addButtonText(), - buildAddItemAction() - ); - } - - /** - * @category Add - */ - private Runnable buildAddItemAction() { - return new Runnable() { - public void run() { - AddRemovePane.this.addItem(); - } - }; - } - - private ListChangeListener buildListChangeListener() { - return new SWTListChangeListenerWrapper(buildListChangeListener_()); - } - - private ListChangeListener buildListChangeListener_() { - return new ListChangeListener() { - - public void itemsAdded(ListAddEvent e) { - AddRemovePane.this.itemsAdded(e); - } - - public void itemsMoved(ListMoveEvent e) { - AddRemovePane.this.itemsMoved(e); - } - - public void itemsRemoved(ListRemoveEvent e) { - AddRemovePane.this.itemsRemoved(e); - } - - public void itemsReplaced(ListReplaceEvent e) { - AddRemovePane.this.itemsReplaced(e); - } - - public void listChanged(ListChangeEvent e) { - AddRemovePane.this.listChanged(e); - } - - public void listCleared(ListClearEvent e) { - AddRemovePane.this.listCleared(e); - } - }; - } - - protected void itemsAdded(ListAddEvent e) { - - } - - protected void itemsMoved(ListMoveEvent e) { - - } - - protected void itemsRemoved(ListRemoveEvent e) { - Object selectedItem = this.selectedItemHolder.getValue(); - - if (selectedItem == null) { - updateButtons(); - return; - } - - if (CollectionTools.contains(e.getItems(), selectedItem)) { - this.selectedItemHolder.setValue(null); - updateButtons(); - } - } - - protected void itemsReplaced(ListReplaceEvent e) { - - } - - protected void listChanged(ListChangeEvent e) { - - } - - protected void listCleared(ListClearEvent e) { - this.selectedItemHolder.setValue(null); - updateButtons(); - } - - - /** - * @category Option - */ - private Runnable buildOptionalAction() { - return new Runnable() { - public void run() { - AddRemovePane.this.editItem(); - } - }; - } - - /** - * @category Option - */ - protected Button addOptionalButton(Composite container) { - return addUnmanagedButton( - container, - adapter.optionalButtonText(), - buildOptionalAction() - ); - } - - /** - * @category Add - */ - protected Button addRemoveButton(Composite parent) { - return addUnmanagedButton( - parent, - adapter.removeButtonText(), - buildRemoveItemsAction() - ); - } - - /** - * @category Remove - */ - private Runnable buildRemoveItemsAction() { - return new Runnable() { - public void run() { - AddRemovePane.this.removeItems(); - } - }; - } - - protected ObjectListSelectionModel buildRowSelectionModel(ListValueModel listModel) { - return new ObjectListSelectionModel(new ListModelAdapter(listModel)); - } - - /** - * @category Option - */ - protected void editItem() { - this.adapter.optionOnSelection(getSelectionModel()); - } - - /* - * (non-Javadoc) - */ - @Override - public void enableWidgets(boolean enabled) { - - super.enableWidgets(enabled); - this.enabled = enabled; - - if (!this.getMainControl().isDisposed()) { - this.getMainControl().setEnabled(enabled); - } - - this.updateButtons(); - } - - protected final Composite getContainer() { - return container; - } - - protected IBaseLabelProvider getLabelProvider() { - return labelProvider; - } - - protected final ListValueModel getListHolder() { - return listHolder; - } - - /** - * Returns - * - * @return - */ - public abstract Composite getMainControl(); - - protected final WritablePropertyValueModel getSelectedItemHolder() { - return selectedItemHolder; - } - - public final ObjectListSelectionModel getSelectionModel() { - return selectionModel; - } - - /** - * Initializes this add/remove pane. - * - * @param adapter This Adapter is used to dictacte the behavior - * of this AddRemovePane and by delegating to it some of the - * behavior - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the list holder's items - * - * @category Initialization - */ - @SuppressWarnings("unchecked") - protected void initialize(Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - IBaseLabelProvider labelProvider) - { - this.listHolder = listHolder; - this.labelProvider = labelProvider; - this.adapter = (adapter == null) ? buildAdapter() : adapter; - this.selectedItemHolder = (WritablePropertyValueModel) selectedItemHolder; - this.selectionModel = new ObjectListSelectionModel(new ListModelAdapter(listHolder)); - - this.listHolder.addListChangeListener( - ListValueModel.LIST_VALUES, - buildListChangeListener() - ); - } - - /** - * Initializes the pane containing the buttons (Add, optional (if required) - * and Remove). - * - * @param container The parent container - * @param helpId The topic help ID to be registered with the buttons - * - * @category Layout - */ - protected void initializeButtonPane(Composite container, String helpId) { - - container = addSubPane(container); - - GridData gridData = new GridData(); - gridData.grabExcessVerticalSpace = true; - gridData.verticalAlignment = SWT.TOP; - container.setLayoutData(gridData); - - // Add button - this.addButton = addAddButton(container); - addAlignRight(this.addButton); - - // Custom button - addCustomButtonAfterAddButton(container, helpId); - - // Optional button - if (this.adapter.hasOptionalButton()) { - this.optionalButton = addOptionalButton(container); - addAlignRight(this.optionalButton); - } - - // Custom button - addCustomButtonAfterOptionalButton(container, helpId); - - // Remove button - removeButton = addRemoveButton(container); - addAlignRight(removeButton); - - // Update the help topic ID - if (helpId != null) { - getHelpSystem().setHelp(addButton, helpId); - getHelpSystem().setHelp(removeButton, helpId); - - if (optionalButton != null) { - getHelpSystem().setHelp(optionalButton, helpId); - } - } - } - - /** - * Initializes this add/remove pane by creating the widgets. The subclass is - * required to build the main widget. - * - * @param adapter This Adapter is used to dictacte the behavior - * of this AddRemovePane and by delegating to it some of the - * behavior - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the list holder's items - * @param helpId The topic help ID to be registered with this pane - * - * @category Layout - */ - protected void initializeLayout(Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - IBaseLabelProvider labelProvider, - String helpId) { - - initializeMainComposite( - container, - adapter, - listHolder, - selectedItemHolder, - labelProvider, - helpId); - - initializeButtonPane(container, helpId); - enableWidgets(getSubject() != null); - } - - /** - * {@inheritDoc} - */ - @Override - protected void initializeLayout(Composite container) { - this.container = addSubPane(container, 2, 0, 0, 0, 0); - } - - /** - * Initializes the main widget of this add/remove pane. - * - * @param container The parent container - * @param adapter This Adapter is used to dictacte the behavior - * of this AddRemovePane and by delegating to it some of the - * behavior - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the list holder's items - * @param helpId The topic help ID to be registered with this pane or - * null if it was not specified - * - * @category Layout - */ - protected abstract void initializeMainComposite(Composite container, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - IBaseLabelProvider labelProvider, - String helpId); - - /** - * @category Remove - */ - protected void removeItems() { - - // Keep track of the selected indices so we can select an item - // before the lowest index - int[] indices = selectionModel.selectedIndices(); - Arrays.sort(indices); - - // Notify the adapter to remove the selected items - adapter.removeSelectedItems(selectionModel); - - // Select a new item - if (getListHolder().size() > 0) { - int index = Math.min(indices[0], getListHolder().size() - 1); - Object item = getListHolder().get(index); - selectedItemHolder.setValue(item); - } - // The list is empty, clear the value - else { - selectedItemHolder.setValue(null); - } - } - - /** - * Selects the given value, which can be null. - * - * @param value The new selected value - */ - public void setSelectedItem(Object value) { - selectedItemHolder.setValue(value); - } - - /** - * @category UpdateButtons - */ - protected void updateAddButton(Button addButton) { - addButton.setEnabled(enabled); - } - - /** - * @category UpdateButtons - */ - protected void updateButtons() { - if (!container.isDisposed()) { - updateAddButton(addButton); - updateRemoveButton(removeButton); - updateOptionalButton(optionalButton); - } - } - - /** - * @category UpdateButtons - */ - protected void updateOptionalButton(Button optionalButton) { - if (optionalButton != null) { - optionalButton.setEnabled( - enabled && - adapter.enableOptionOnSelectionChange(selectionModel) - ); - } - } - - /** - * @category UpdateButtons - */ - protected void updateRemoveButton(Button removeButton) { - removeButton.setEnabled( - enabled && - adapter.enableRemoveOnSelectionChange(selectionModel) - ); - } - - /** - * An abstract implementation of Adapter. - */ - public static abstract class AbstractAdapter implements Adapter { - - /** - * The text of the add button. - */ - private String addButtonText; - - /** - * Determines whether the optional button should be shown or not. - */ - private boolean hasOptionalButton; - - /** - * The text of the optional button, if used. - */ - private String optionalButtonText; - - /** - * The text of the remove button. - */ - private String removeButtonText; - - /** - * Creates a new AbstractAdapter with default text for the - * add and remove buttons. - */ - public AbstractAdapter() { - this(JptCommonUiMessages.AddRemovePane_AddButtonText, - JptCommonUiMessages.AddRemovePane_RemoveButtonText); - } - - /** - * Creates a new AbstractAdapter with default text for the - * add and remove buttons. - * - * @param hasOptionalButton true to show an optional button - * and to use the behavior related to the optional button; - * false to not use it - */ - public AbstractAdapter(boolean hasOptionalButton) { - this(); - this.setHasOptionalButton(hasOptionalButton); - } - - /** - * Creates a new AbstractAdapter with default text for the - * add and remove buttons. - * - * @param optionalButtonText The text of the optional button, which means - * the optional button will be shown - */ - public AbstractAdapter(String optionalButtonText) { - this(true); - this.setOptionalButtonText(optionalButtonText); - } - - /** - * Creates a new AbstractAdapter. - * - * @param addButtonText The add button's text - * @param removeButtonText The remove button's text - */ - public AbstractAdapter(String addButtonText, - String removeButtonText) { - - super(); - this.addButtonText = addButtonText; - this.removeButtonText = removeButtonText; - } - - /** - * Creates a new AbstractAdapter. - * - * @param addButtonText The add button's text - * @param removeButtonText The remove button's text - * @param optionalButtonText The text of the optional button, which means - * the optional button will be shown - */ - public AbstractAdapter(String addButtonText, - String removeButtonText, - String optionalButtonText) { - - this(optionalButtonText); - this.setAddButtonText(addButtonText); - this.setRemoveButtonText(removeButtonText); - } - - /* - * (non-Javadoc) - */ - public String addButtonText() { - return addButtonText; - } - - /* - * (non-Javadoc) - */ - public boolean enableOptionOnSelectionChange(ObjectListSelectionModel listSelectionModel) { - return listSelectionModel.selectedValuesSize() == 1; - } - - public boolean enableRemoveOnSelectionChange(ObjectListSelectionModel listSelectionModel) { - return listSelectionModel.selectedValue() != null; - } - - /* - * (non-Javadoc) - */ - public boolean hasOptionalButton() { - return hasOptionalButton; - } - - /* - * (non-Javadoc) - */ - public String optionalButtonText() { - return optionalButtonText; - } - - /* - * (non-Javadoc) - */ - public void optionOnSelection(ObjectListSelectionModel listSelectionModel) { - } - - /* - * (non-Javadoc) - */ - public String removeButtonText() { - return removeButtonText; - } - - /** - * Changes the text of the add button. This method has to be called before - * the AddRemoveListPane is initialized. - * - * @param addButtonText The add button's text - */ - public void setAddButtonText(String addButtonText) { - this.addButtonText = addButtonText; - } - - /** - * Changes the state of the optional button, meaning if it should be shown - * between the add and remove buttons or not. - * - * @param hasOptionalButton true to show an optional button - * and to use the behavior related to the optional button; - * false to not use it - */ - public void setHasOptionalButton(boolean hasOptionalButton) { - this.hasOptionalButton = hasOptionalButton; - } - - /** - * Changes the text of the optional button. This method has to be called - * before the AddRemoveListPane is initialized. This does not - * make the optional button visible. - * - * @param optionalButtonText The optional button's text - */ - public void setOptionalButtonText(String optionalButtonText) { - this.optionalButtonText = optionalButtonText; - } - - /** - * Changes the text of the remove button. This method has to be called - * before the AddRemoveListPane is initialized. - * - * @param removeButtonText The remove button's text - */ - public void setRemoveButtonText(String removeButtonText) { - this.removeButtonText = removeButtonText; - } - } - - /** - * This adapter is used to perform the actual action when adding a new item - * or removing the selected items. It is possible to add an optional button. - */ - public static interface Adapter { - - /** - * The add button's text. - * - * @return The text shown on the add button - */ - String addButtonText(); - - /** - * Invoked when the user selects the Add button. - */ - void addNewItem(ObjectListSelectionModel listSelectionModel); - - /** - * Invoked when selection changes. Implementation dictates whether button - * should be enabled. - */ - boolean enableOptionOnSelectionChange(ObjectListSelectionModel listSelectionModel); - - /** - * Invoked when selection changes. Implementation dictates whether remove button - * should be enabled. - */ - boolean enableRemoveOnSelectionChange(ObjectListSelectionModel listSelectionModel); - - /** - * Determines whether an optional button should be added between the add - * and remove buttons. - * - * @return true to show an optional button and to use the - * behavior related to the optional button; false to not use - * it - */ - boolean hasOptionalButton(); - - /** - * Resource string key for the optional button. - */ - String optionalButtonText(); - - /** - * Invoked when the user selects the optional button - */ - void optionOnSelection(ObjectListSelectionModel listSelectionModel); - - /** - * The remove button's text. - * - * @return The text shown on the remove button - */ - String removeButtonText(); - - /** - * Invoked when the user selects the Remove button. - */ - void removeSelectedItems(ObjectListSelectionModel listSelectionModel); - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemoveTablePane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemoveTablePane.java deleted file mode 100644 index 05a7eda6be..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/AddRemoveTablePane.java +++ /dev/null @@ -1,314 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.jface.viewers.IBaseLabelProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.ui.internal.swt.ColumnAdapter; -import org.eclipse.jpt.common.ui.internal.swt.TableModelAdapter; -import org.eclipse.jpt.common.ui.internal.swt.TableModelAdapter.SelectionChangeEvent; -import org.eclipse.jpt.common.ui.internal.swt.TableModelAdapter.SelectionChangeListener; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ObjectListSelectionModel; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Table; - -/** - * This implementation of the AddRemovePane uses a Table - * as its main widget. - *

- * Here the layout of this pane: - *

- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------- ----------- |
- * | | Column 1 | Column 2 | ...   | Column i | ...   | Colunm n | | Add...  | |
- * | |-----------------------------------------------------------| ----------- |
- * | |          |          |       |          |       |          | ----------- |
- * | |-----------------------------------------------------------| | Edit... | |
- * | |          |          |       |          |       |          | ----------- |
- * | |-----------------------------------------------------------| ----------- |
- * | |          |          |       |          |       |          | | Remove  | |
- * | |-----------------------------------------------------------| ----------- |
- * | -------------------------------------------------------------             |
- * -----------------------------------------------------------------------------
- * - * @version 2.0 - * @since 1.0 - */ -public abstract class AddRemoveTablePane extends AddRemovePane -{ - /** - * Flag used to prevent circular - */ - private boolean locked; - - /** - * The main widget of this add/remove pane. - */ - private Table table; - - /** - * Creates a new AddRemoveTablePane. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param adapter - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the list holder's items - */ - public AddRemoveTablePane(Pane parentPane, - Composite parent, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - ITableLabelProvider labelProvider) { - - super(parentPane, - parent, - adapter, - listHolder, - selectedItemHolder, - labelProvider); - - } - - /** - * Creates a new AddRemoveTablePane. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param adapter - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the list holder's items - * @param helpId The topic help ID to be registered with this pane - */ - public AddRemoveTablePane(Pane parentPane, - Composite parent, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - ITableLabelProvider labelProvider, - String helpId) { - - super(parentPane, - parent, - adapter, - listHolder, - selectedItemHolder, - labelProvider, - helpId); - } - - /** - * Creates a new AddRemoveTablePane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of the subject - * @param adapter - * @param parent The parent container - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the list holder's items - */ - public AddRemoveTablePane(Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - ITableLabelProvider labelProvider) { - - super(parentPane, - subjectHolder, - parent, - adapter, - listHolder, - selectedItemHolder, - labelProvider); - } - - /** - * Creates a new AddRemoveTablePane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of the subject - * @param adapter - * @param parent The parent container - * @param listHolder The ListValueModel containing the items - * @param selectedItemHolder The holder of the selected item, if more than - * one item or no items are selected, then null will be passed - * @param labelProvider The renderer used to format the list holder's items - * @param helpId The topic help ID to be registered with this pane - */ - public AddRemoveTablePane(Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - ITableLabelProvider labelProvider, - String helpId) { - - super(parentPane, - subjectHolder, - parent, - adapter, - listHolder, - selectedItemHolder, - labelProvider, - helpId); - } - - protected abstract ColumnAdapter buildColumnAdapter(); - - private WritablePropertyValueModel buildSelectedItemHolder() { - return new SimplePropertyValueModel(); - } - - private PropertyChangeListener buildSelectedItemPropertyChangeListener() { - return new SWTPropertyChangeListenerWrapper( - buildSelectedItemPropertyChangeListener_() - ); - } - - private PropertyChangeListener buildSelectedItemPropertyChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - if (table.isDisposed()) { - return; - } - - if (!locked) { - locked = true; - - try { - Object value = e.getNewValue(); - getSelectionModel().setSelectedValue(e.getNewValue()); - int index = -1; - - if (value != null) { - index = CollectionTools.indexOf(getListHolder().iterator(), value); - } - - table.select(index); - updateButtons(); - } - finally { - locked = false; - } - } - } - }; - } - - private SelectionChangeListener buildSelectionListener() { - return new SelectionChangeListener() { - public void selectionChanged(SelectionChangeEvent e) { - AddRemoveTablePane.this.selectionChanged(); - } - }; - } - - /* - * (non-Javadoc) - */ - @Override - public Table getMainControl() { - return table; - } - - /* - * (non-Javadoc) - */ - @Override - @SuppressWarnings("unchecked") - protected void initializeMainComposite(Composite container, - Adapter adapter, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - IBaseLabelProvider labelProvider, - String helpId) - { - table = addUnmanagedTable(container, helpId); - table.setHeaderVisible(true); - - TableModelAdapter tableModel = TableModelAdapter.adapt( - (ListValueModel) listHolder, - buildSelectedItemHolder(), - table, - (ColumnAdapter) buildColumnAdapter(), - (ITableLabelProvider) labelProvider - ); - - tableModel.addSelectionChangeListener(buildSelectionListener()); - - selectedItemHolder.addPropertyChangeListener( - PropertyValueModel.VALUE, - buildSelectedItemPropertyChangeListener() - ); - } - - /** - * The selection has changed, update (1) the selected item holder, (2) the - * selection model and (3) the buttons. - */ - private void selectionChanged() { - - if (locked) { - return; - } - - locked = true; - - try { - WritablePropertyValueModel selectedItemHolder = getSelectedItemHolder(); - ObjectListSelectionModel selectionModel = getSelectionModel(); - int selectionCount = table.getSelectionCount(); - - if (selectionCount == 0) { - selectedItemHolder.setValue(null); - selectionModel.clearSelection(); - } - else if (selectionCount != 1) { - selectedItemHolder.setValue(null); - selectionModel.clearSelection(); - - for (int index : table.getSelectionIndices()) { - selectionModel.addSelectionInterval(index, index); - } - } - else { - int selectedIndex = table.getSelectionIndex(); - Object selectedItem = getListHolder().get(selectedIndex); - - selectedItemHolder.setValue(selectedItem); - selectionModel.setSelectedValue(selectedItem); - } - - updateButtons(); - } - finally { - locked = false; - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ChooserPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ChooserPane.java deleted file mode 100644 index a652562257..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ChooserPane.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.jpt.common.ui.internal.JptCommonUiMessages; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** - * A chooser is simply a pane with three widgets, the label on the left, a main - * widget, usually a text field, and a right widget which is usually a browse - * button. - * - * @see ClassChooserPane - * @see PackageChooserPane - * - * @version 3.0 - * @since 2.0 - */ -public abstract class ChooserPane extends Pane -{ - /** - * The control shown after the label (left control). - */ - private Control mainControl; - - /** - * The control shown after the main control. - */ - private Control rightControl; - - /** - * Creates a new ChooserPane. - * - * @param parentPane The parent pane of this one - * @param parent The parent container - */ - public ChooserPane(Pane parentPane, - Composite parent) { - - super(parentPane, parent); - } - - /** - * Creates a new ChooserPane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - */ - public ChooserPane(Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - @Override - protected void initializeLayout(Composite container) { - - this.mainControl = addMainControl(container); - this.rightControl = addRightControl(container); - - addLabeledComposite( - container, - addLeftControl(container), - this.mainControl, - this.rightControl, - getHelpId() - ); - } - - /** - * Creates the left control. By default a label is created and its text is - * retrieved by {@link #getLabelText()}. - * - * @param container The parent container - * @return The newly created left control - */ - protected Control addLeftControl(Composite container) { - return addLabel(container, getLabelText()); - } - - /** - * The text of the label. This method is called by - * {@link #buildLeftControl(Composite)}. - * - * @return The localized text of the left control (which is a label by - * default) - */ - protected abstract String getLabelText(); - - /** - * Creates the main control of this pane. - * - * @param container The parent container - * @return The newly created main control - */ - protected abstract Control addMainControl(Composite container); - - /** - * Creates the right control. By default a browse button is created and its - * action is performed by {@link #buildBrowseAction()} and its text is - * retrieved by {@link #getBrowseButtonText()}. - * - * @param container The parent container - * @return The newly created right control - */ - protected Control addRightControl(Composite container) { - return addButton( - container, - getBrowseButtonText(), - buildBrowseAction() - ); - } - - /** - * Returns the text of the browse button. This method is called by - * {@link #buildRightControl(Composite)}. - * - * @return "Browse..." - */ - protected String getBrowseButtonText() { - return JptCommonUiMessages.ChooserPane_browseButton; - } - - /** - * Creates the action responsible to perform the action when the Browse is - * clicked. - * - * @return A new Runnable performing the actual action of the - * button - */ - protected abstract Runnable buildBrowseAction(); - - /** - * Returns the help topic ID for the controls of this pane. - * - * @return null is returned otherwise the subclass can return an ID - */ - protected String getHelpId() { - return null; - } - - @Override - public void enableWidgets(boolean enabled) { - - super.enableWidgets(enabled); - - if (!this.mainControl.isDisposed()) { - this.mainControl.setEnabled(enabled); - } - - if (!this.rightControl.isDisposed()) { - this.rightControl.setEnabled(enabled); - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserComboPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserComboPane.java deleted file mode 100644 index f50eb3b64f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserComboPane.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.jdt.internal.ui.refactoring.contentassist.ControlContentAssistHelper; -import org.eclipse.jpt.common.utility.internal.StringConverter; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** - * This chooser allows the user to choose a type when browsing and it adds code - * completion support to the text field, which is the main component. - *

- * Here the layout of this pane: - *

- * -----------------------------------------------------------------------------
- * |        ---------------------------------------------------- ------------- |
- * | Label: | I                                             X  | | Browse... | |
- * |        ---------------------------------------------------- ------------- |
- * -----------------------------------------------------------------------------
- * - * @version 2.0 - * @since 2.0 - */ -public abstract class ClassChooserComboPane extends ClassChooserPane -{ - - /** - * Creates a new ClassChooserPane. - * - * @param parentPane The parent pane of this one - * @param parent The parent container - */ - public ClassChooserComboPane(Pane parentPane, - Composite parent) { - - super(parentPane, parent); - } - - /** - * Creates a new ClassChooserPane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - */ - public ClassChooserComboPane(Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - @Override - protected Control addMainControl(Composite container) { - Composite subPane = addSubPane(container); - Combo combo = this.addClassCombo(subPane); - - ControlContentAssistHelper.createComboContentAssistant( - combo, - javaTypeCompletionProcessor - ); - - return subPane; - } - - protected Combo addClassCombo(Composite container) { - return this.addEditableCombo( - container, - this.buildClassListHolder(), - this.buildTextHolder(), - this.buildClassConverter() - ); - } - - protected abstract ListValueModel buildClassListHolder(); - - protected StringConverter buildClassConverter() { - return StringConverter.Default.instance(); - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserPane.java deleted file mode 100644 index cbc61848f7..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ClassChooserPane.java +++ /dev/null @@ -1,368 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -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.internal.ui.refactoring.contentassist.ControlContentAssistHelper; -import org.eclipse.jdt.internal.ui.refactoring.contentassist.JavaTypeCompletionProcessor; -import org.eclipse.jdt.internal.ui.wizards.NewClassCreationWizard; -import org.eclipse.jdt.ui.IJavaElementSearchConstants; -import org.eclipse.jdt.ui.JavaUI; -import org.eclipse.jdt.ui.wizards.NewClassWizardPage; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTTools; -import org.eclipse.jpt.common.ui.JptCommonUiPlugin; -import org.eclipse.jpt.common.ui.internal.JptCommonUiMessages; -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.ClassName; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PartInitException; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.SelectionDialog; -import org.eclipse.ui.forms.widgets.Hyperlink; - -/** - * This chooser allows the user to choose a type when browsing and it adds code - * completion support to the text field, which is the main component. - *

- * Here the layout of this pane: - *

- * -----------------------------------------------------------------------------
- * |        ---------------------------------------------------- ------------- |
- * | Label: | I                                                | | Browse... | |
- * |        ---------------------------------------------------- ------------- |
- * -----------------------------------------------------------------------------
- * - * @version 2.3 - * @since 2.0 - */ -@SuppressWarnings("nls") -public abstract class ClassChooserPane extends ChooserPane -{ - /** - * The code completion manager. - */ - protected JavaTypeCompletionProcessor javaTypeCompletionProcessor; - - private PropertyChangeListener subjectChangeListener; - - /** - * Creates a new ClassChooserPane. - * - * @param parentPane The parent pane of this one - * @param parent The parent container - */ - public ClassChooserPane(Pane parentPane, - Composite parent) { - - super(parentPane, parent); - } - - /** - * Creates a new ClassChooserPane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - */ - public ClassChooserPane(Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - @Override - protected void initialize() { - super.initialize(); - - // TODO bug 156185 - when this is fixed there should be api for this - this.javaTypeCompletionProcessor = new JavaTypeCompletionProcessor(false, false); - - this.subjectChangeListener = this.buildSubjectChangeListener(); - this.getSubjectHolder().addPropertyChangeListener(PropertyValueModel.VALUE, this.subjectChangeListener); - - this.classChooserSubjectChanged(getSubject()); - } - - private PropertyChangeListener buildSubjectChangeListener() { - return new SWTPropertyChangeListenerWrapper(this.buildSubjectChangeListener_()); - } - - private PropertyChangeListener buildSubjectChangeListener_() { - return new PropertyChangeListener() { - @SuppressWarnings("unchecked") - public void propertyChanged(PropertyChangeEvent e) { - ClassChooserPane.this.classChooserSubjectChanged((T) e.getNewValue()); - } - }; - } - - protected void classChooserSubjectChanged(T newSubject) { - IPackageFragment packageFragment = null; - if (newSubject != null) { - IPackageFragmentRoot root = getPackageFragmentRoot(); - if (root != null) { - packageFragment = root.getPackageFragment(""); - } - } - this.javaTypeCompletionProcessor.setPackageFragment(packageFragment); - } - - @Override - protected Control addLeftControl(Composite container) { - if( ! this.allowTypeCreation()) { - return super.addLeftControl(container); - } - Hyperlink labelLink = this.addHyperlink(container, - this.getLabelText(), - this.buildHyperLinkAction() - ); - return labelLink; - } - - private Runnable buildHyperLinkAction() { - return new Runnable() { - public void run() { - ClassChooserPane.this.hyperLinkSelected(); - } - }; - } - - protected void hyperLinkSelected() { - IType type = getType(); - if (type != null) { - openInEditor(type); - } - else if (allowTypeCreation()){ - createType(); - } - } - - protected IType getType() { - if (getClassName() == null) { - return null; - } - IType type = null; - try { - type = getJavaProject().findType(getClassName().replace('$', '.')); - } - catch (JavaModelException e) { - JptCommonUiPlugin.log(e); - } - return type; - } - - protected void createType() { - StructuredSelection selection = new StructuredSelection(getJavaProject().getProject()); - - NewClassWizardPage newClassWizardPage = new NewClassWizardPage(); - newClassWizardPage.init(selection); - newClassWizardPage.setSuperClass(getSuperclassName(), true); - newClassWizardPage.setSuperInterfaces(getSuperInterfaceNames(), true); - if (!StringTools.stringIsEmpty(getClassName())) { - newClassWizardPage.setTypeName(ClassName.getSimpleName(getClassName()), true); - String packageName = ClassName.getPackageName(getClassName()); - newClassWizardPage.setPackageFragment(getFirstJavaSourceFolder().getPackageFragment(packageName), true); - } - NewClassCreationWizard wizard = new NewClassCreationWizard(newClassWizardPage, false); - wizard.init(PlatformUI.getWorkbench(), selection); - - WizardDialog dialog = new WizardDialog(getShell(), wizard); - dialog.create(); - int dResult = dialog.open(); - if (dResult == Window.OK) { - String className = (newClassWizardPage.getCreatedType()).getFullyQualifiedName(getEnclosingTypeSeparator()); - setClassName(className); - } - } - - protected abstract void setClassName(String className); - - /** - * Override this to change the enclosing type separator - */ - protected char getEnclosingTypeSeparator() { - return '$'; - } - - /** - * Override this to set a superclass in the New Class wizard. If no class is chosen, - * clicking the hyperlink label will open the new class wizard. - */ - protected String getSuperclassName() { - return ""; - } - - /** - * Override this to set a super interface in the New Class wizard. If no class is chosen, - * clicking the hyperlink label will open the new class wizard. - * @see getSuperInterfaceName - */ - protected List getSuperInterfaceNames() { - return getSuperInterfaceName() != null ? Collections.singletonList(getSuperInterfaceName()) : Collections.emptyList(); - } - - /** - * Override this to set a super interface in the New Class wizard. If no class is chosen, - * clicking the hyperlink label will open the new class wizard. - */ - protected String getSuperInterfaceName() { - return null; - } - - /** - * Override this if it does not make sense to allow the user to create a new type. - * This will determine whether clicking the hyperlink opens the New Class wizard - * @return - */ - protected boolean allowTypeCreation() { - return true; - } - - protected void openInEditor(IType type) { - IJavaElement javaElement = type.getParent(); - try { - JavaUI.openInEditor(javaElement, true, true); - } - catch (JavaModelException e) { - JptCommonUiPlugin.log(e); - } - catch (PartInitException e) { - JptCommonUiPlugin.log(e); - } - } - - protected abstract IJavaProject getJavaProject(); - - @Override - protected final Runnable buildBrowseAction() { - return new Runnable() { - public void run() { - promptType(); - } - }; - } - - @Override - protected Control addMainControl(Composite container) { - Composite subPane = addSubPane(container); - Text text = addText(subPane, buildTextHolder()); - - ControlContentAssistHelper.createTextContentAssistant( - text, - javaTypeCompletionProcessor - ); - - return subPane; - } - - /** - * Creates the value holder of the subject's property. - * - * @return The holder of the class name - */ - protected abstract WritablePropertyValueModel buildTextHolder(); - - /** - * Prompts the user the Open Type dialog. - * - * @return Either the selected type or null if the user - * cancelled the dialog - */ - protected IType chooseType() { - IJavaElement[] elements = new IJavaElement[] { getJavaProject() }; - IJavaSearchScope scope = SearchEngine.createJavaSearchScope(elements); - SelectionDialog typeSelectionDialog; - - try { - typeSelectionDialog = JavaUI.createTypeDialog( - getShell(), - PlatformUI.getWorkbench().getProgressService(), - scope, - getTypeDialogStyle(), - false, - StringTools.stringIsEmpty(getClassName()) ? "" : ClassName.getSimpleName(getClassName()) - ); - } - catch (JavaModelException e) { - JptCommonUiPlugin.log(e); - return null; - } - - typeSelectionDialog.setTitle(JptCommonUiMessages.ClassChooserPane_dialogTitle); - typeSelectionDialog.setMessage(JptCommonUiMessages.ClassChooserPane_dialogMessage); - - if (typeSelectionDialog.open() == Window.OK) { - return (IType) typeSelectionDialog.getResult()[0]; - } - - return null; - } - - protected int getTypeDialogStyle() { - return IJavaElementSearchConstants.CONSIDER_CLASSES; - } - - /** - * Returns the class name from its subject. - * - * @return The class name or null if none is defined - */ - protected abstract String getClassName(); - - protected IPackageFragmentRoot getFirstJavaSourceFolder() { - Iterator i = JDTTools.getJavaSourceFolders(getJavaProject()).iterator(); - return i.hasNext() ? i.next() : null; - } - - /** - * The browse button was clicked, its action invokes this action which should - * prompt the user to select a class and set it. - */ - protected void promptType() { - IType type = this.chooseType(); - - if (type != null) { - String className = type.getFullyQualifiedName(getEnclosingTypeSeparator()); - setClassName(className); - } - } - - protected IPackageFragmentRoot getPackageFragmentRoot() { - return JDTTools.getCodeCompletionContextRoot(getJavaProject()); - } - - @Override - public void dispose() { - this.getSubjectHolder().removePropertyChangeListener(PropertyValueModel.VALUE, this.subjectChangeListener); - super.dispose(); - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ComboPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ComboPane.java deleted file mode 100644 index 4046ed13ba..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ComboPane.java +++ /dev/null @@ -1,289 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.jpt.common.ui.internal.JptCommonUiMessages; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.events.ModifyEvent; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; - -/** - * Pane with combo box support for automatic updating of: - * - selected value - * - default value - * - value choices - */ -public abstract class ComboPane - extends Pane -{ - /** - * The main (only) widget of this pane. - */ - protected Combo comboBox; - - - // **************** constructors ****************************************** - - protected ComboPane( - Pane parentPane, - Composite parent) { - - super(parentPane, parent); - } - - protected ComboPane( - Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - protected ComboPane( - Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent, - PropertyValueModel enabledModel) { - - super(parentPane, subjectHolder, parent, enabledModel); - } - - - // **************** initialization **************************************** - - @Override - protected void initializeLayout(Composite container) { - this.comboBox = this.addEditableCombo(container); - this.comboBox.addModifyListener(this.buildModifyListener()); - SWTUtil.attachDefaultValueHandler(this.comboBox); - } - - protected ModifyListener buildModifyListener() { - return new ModifyListener() { - public void modifyText(ModifyEvent e) { - ComboPane.this.comboBoxModified(); - } - }; - } - - - // **************** typical overrides ************************************* - - /** - * Return the possible values to be added to the combo during - * population. - */ - protected abstract Iterable getValues(); - - /** - * Return whether the combo is to add a default value to the choices - */ - protected boolean usesDefaultValue() { - // default response is 'true' - return true; - } - - /** - * Return the default value, or null if no default is - * specified. This method is only called when the subject is non-null. - */ - protected abstract String getDefaultValue(); - - /** - * Return the current value from the subject. - * This method is only called when the subject is non-null. - */ - protected abstract String getValue(); - - /** - * Set the specified value as the new value on the subject. - */ - protected abstract void setValue(String value); - - - // **************** overrides ********************************************* - - @Override - protected void propertyChanged(String propertyName) { - super.propertyChanged(propertyName); - this.updateSelectedItem(); - } - - @Override - protected void doPopulate() { - super.doPopulate(); - this.populateComboBox(); - } - - - // **************** populating ******************************************** - - /** - * Populate the combo-box list by clearing it, then adding first the default - * value, if available, and then the possible choices. - */ - protected void populateComboBox() { - this.comboBox.removeAll(); - - if (usesDefaultValue()) { - this.comboBox.add(this.buildDefaultValueEntry()); - } - - for (String value : this.getValues()) { - this.comboBox.add(value); - } - - this.updateSelectedItem_(); - } - - protected String buildDefaultValueEntry() { - if (getSubject() == null) { - return JptCommonUiMessages.NoneSelected; - } - String defaultValue = this.getDefaultValue(); - return (defaultValue == null) ? this.buildNullDefaultValueEntry() : this.buildNonNullDefaultValueEntry(defaultValue); - } - - protected String buildNullDefaultValueEntry() { - return JptCommonUiMessages.DefaultEmpty; - } - - protected String buildNonNullDefaultValueEntry(String defaultValue) { - return NLS.bind( - JptCommonUiMessages.DefaultWithOneParam, - defaultValue); - } - - protected void updateSelectedItem() { - // make sure the default value is up to date (??? ~bjv) - if (usesDefaultValue()) { - String defaultValueEntry = this.buildDefaultValueEntry(); - if ( ! this.comboBox.getItem(0).equals(defaultValueEntry)) { - this.comboBox.remove(0); - this.comboBox.add(defaultValueEntry, 0); - } - } - - this.updateSelectedItem_(); - } - - /** - * Updates the selected item by selecting the current value, if not - * null, or select the default value if one is available, - * otherwise remove the selection. - */ - protected void updateSelectedItem_() { - String value = (this.getSubject() == null) ? null : this.getValue(); - if (value == null) { - if (usesDefaultValue()) { - // select the default value - this.comboBox.select(0); - } - else { - this.comboBox.setText(""); - } - } else { - // select the new value - if ( ! value.equals(this.comboBox.getText())) { - // This prevents the cursor from being set back to the beginning of the line (bug 234418). - // The reason we are hitting this method at all is because the - // context model is updating from the resource model in a way - // that causes change notifications to be fired (the annotation - // is added to the resource model, change notification occurs - // on the update thread, and then the name is set, these 2 - // threads can get in the wrong order). - // The #valueChanged() method sets the populating flag to true, - // but in this case it is already set back to false when we - // receive notification back from the model because it has - // moved to the update thread and then jumps back on the UI thread. - this.comboBox.setText(value); - } - } - } - - protected void repopulateComboBox() { - if ( ! this.comboBox.isDisposed()) { - this.repopulate(); - } - } - - - // **************** combo-box listener callback *************************** - - protected void comboBoxModified() { - if ( ! this.isPopulating()) { - this.valueChanged(this.comboBox.getText()); - } - } - - /** - * The combo-box selection has changed, update the model if necessary. - * If the value has changed and the subject is null, we can build a subject - * before setting the value. - */ - protected void valueChanged(String newValue) { - T subject = this.getSubject(); - String oldValue; - if (subject == null) { - if (this.nullSubjectIsNotAllowed()) { - return; // no subject to set the value on - } - oldValue = null; - } else { - oldValue = this.getValue(); - } - - // convert empty string or default to null - if (StringTools.stringIsEmpty(newValue) || this.valueIsDefault(newValue)) { - newValue = null; - } - - // set the new value if it is different from the old value - if (Tools.valuesAreDifferent(oldValue, newValue)) { - this.setPopulating(true); - - try { - this.setValue(newValue); - } finally { - this.setPopulating(false); - } - } - } - - /** - * Return whether we can set the value when the subject is null - * (i.e. #setValue(String) will construct the subject if necessary). - */ - protected boolean nullSubjectIsAllowed() { - return false; - } - - protected final boolean nullSubjectIsNotAllowed() { - return ! this.nullSubjectIsAllowed(); - } - - /** - * pre-condition: value is not null - */ - protected boolean valueIsDefault(String value) { - if (! usesDefaultValue()) { - return false; - } - return (this.comboBox.getItemCount() > 0) - && value.equals(this.comboBox.getItem(0)); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/DefaultWidgetFactory.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/DefaultWidgetFactory.java deleted file mode 100644 index 97f4dc388c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/DefaultWidgetFactory.java +++ /dev/null @@ -1,260 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.jpt.common.ui.WidgetFactory; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.DateTime; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Spinner; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.forms.widgets.FormText; -import org.eclipse.ui.forms.widgets.FormToolkit; -import org.eclipse.ui.forms.widgets.Hyperlink; -import org.eclipse.ui.forms.widgets.Section; -import org.eclipse.ui.forms.widgets.TableWrapData; -import org.eclipse.ui.forms.widgets.TableWrapLayout; - -/** - * This WidgetFactory simply creates plain SWT widgets. - * - * @version 2.0 - * @since 2.0 - */ -public class DefaultWidgetFactory implements WidgetFactory { - - /** - * The singleton instance of this IWidgetFactory - */ - private static final WidgetFactory INSTANCE = new DefaultWidgetFactory(); - - /** - * Creates a new DefaultWidgetFactory. - */ - private DefaultWidgetFactory() { - super(); - } - - /** - * Returns the singleton instance of this IWidgetFactory. - * - * @return The singleton instance of this IWidgetFactory - */ - public static WidgetFactory instance() { - return INSTANCE; - } - - /** - * {@inheritDoc} - */ - public Button createButton(Composite parent, String text) { - return this.createButton(parent, text, SWT.NULL); - } - - /** - * Creates a new button. - * - * @param parent The parent container - * @param text The button's text - * @param style The style to apply to the button, which determines its type: - * toggle, push, check box, radio - * @return The newly created Button - */ - private Button createButton(Composite parent, String text, int style) { - Button button = new Button(parent, style); - button.setText(text); - return button; - } - - /** - * {@inheritDoc} - */ - @Deprecated - public CCombo createCCombo(Composite parent) { - return new CCombo(parent, SWT.BORDER | SWT.READ_ONLY); - } - - /** - * {@inheritDoc} - */ - public Button createCheckBox(Composite parent, String text) { - return this.createButton(parent, text, SWT.CHECK); - } - - /** - * {@inheritDoc} - */ - public Combo createCombo(Composite parent) { - return new Combo(parent, SWT.BORDER | SWT.READ_ONLY); - } - - /** - * {@inheritDoc} - */ - public Composite createComposite(Composite parent) { - return new Composite(parent, SWT.NULL); - } - - /** - * {@inheritDoc} - */ - public DateTime createDateTime(Composite parent, int style) { - return new DateTime(parent, style); - } - - /** - * {@inheritDoc} - */ - @Deprecated - public CCombo createEditableCCombo(Composite parent) { - return new CCombo(parent, SWT.BORDER); - } - - /** - * {@inheritDoc} - */ - public Combo createEditableCombo(Composite parent) { - return new Combo(parent, SWT.BORDER); - } - - /** - * {@inheritDoc} - */ - public Group createGroup(Composite parent, String title) { - Group group = new Group(parent, SWT.NULL); - group.setText(title); - return group; - } - - /** - * {@inheritDoc} - */ - public Hyperlink createHyperlink(Composite parent, String text) { - Hyperlink hyperlink = new Hyperlink(parent, SWT.NULL); - hyperlink.setText(text); - return hyperlink; - } - - /** - * {@inheritDoc} - */ - public Label createLabel(Composite parent, String labelText) { - Label label = new Label(parent, SWT.WRAP); - label.setText(labelText); - return label; - } - - /** - * {@inheritDoc} - */ - public List createList(Composite parent, int style) { - return new List(parent, SWT.BORDER | style); - } - - /** - * {@inheritDoc} - */ - public FormText createMultiLineLabel(Composite parent, String labelText) { - - Composite container = new Composite(parent, SWT.NONE); - - GridData gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.grabExcessHorizontalSpace = true; - container.setLayoutData(gridData); - - TableWrapLayout layout = new TableWrapLayout(); - layout.numColumns = 1; - layout.bottomMargin = 0; - layout.leftMargin = 0; - layout.rightMargin = 0; - layout.topMargin = 0; - container.setLayout(layout); - - FormToolkit widgetFactory = new FormToolkit(parent.getDisplay()); - FormText text = widgetFactory.createFormText(container, true); - text.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); - text.setText(labelText, false, false); - - return text; - } - - /** - * {@inheritDoc} - */ - public Text createMultiLineText(Composite parent) { - return new Text(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL); - } - - /** - * {@inheritDoc} - */ - public Text createPasswordText(Composite parent) { - return new Text(parent, SWT.BORDER | SWT.PASSWORD); - } - - /** - * {@inheritDoc} - */ - public Button createPushButton(Composite parent, String text) { - return this.createButton(parent, text, SWT.PUSH); - } - - /** - * {@inheritDoc} - */ - public Button createRadioButton(Composite parent, String text) { - return this.createButton(parent, text, SWT.RADIO); - } - - /** - * {@inheritDoc} - */ - public Section createSection(Composite parent, int style) { - return new Section(parent, style); - } - - /** - * {@inheritDoc} - */ - public Spinner createSpinner(Composite parent) { - return new Spinner(parent, SWT.NULL); - } - - /** - * {@inheritDoc} - */ - public Table createTable(Composite parent, int style) { - return new Table(parent, SWT.BORDER | style); - } - - /** - * {@inheritDoc} - */ - public Text createText(Composite parent) { - return new Text(parent, SWT.BORDER); - } - - /** - * {@inheritDoc} - */ - public Button createTriStateCheckBox(Composite parent, String text) { - TriStateCheckBox checkBox = new TriStateCheckBox(parent, text, this); - return checkBox.getCheckBox(); - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Dialog.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Dialog.java deleted file mode 100644 index 1c6509ed1b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Dialog.java +++ /dev/null @@ -1,350 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.node.Node; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -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.Shell; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.help.IWorkbenchHelpSystem; - -/** - * The abstract implementation of a dialog using a "state object" (model object) - * for behavior. - *

- * The main pane of this dialog should be extending DialogPane - * for creating the right type of widgets and it has the "state object" (subject) - * behavior built-in. - * - * @see Node - * @see DialogPane - * - * @version 2.0 - * @since 2.0 - */ -@SuppressWarnings("nls") -public abstract class Dialog extends TitleAreaDialog -{ - /** - * The main content pane of this dialog. - */ - private DialogPane pane; - - /** - * The holder of the "state object" used by this dialog. - */ - private WritablePropertyValueModel subjectHolder; - - /** - * Caches the title text until the dialog is created and the dialog's shell - * needs to be configured. - */ - private String title; - - /** - * Creates a new Dialog. - * - * @param parent The parent shell - */ - protected Dialog(Shell parent) { - this(parent, ""); - } - - /** - * Creates a new Dialog. - * - * @param parent The parent shell - * @param title The dialog's title - */ - protected Dialog(Shell parent, String title) { - super(parent); - this.title = title; - initialize(); - } - - /** - * Initializes the main pane of this dialog. This method is invoked only - * when the dialog is requested to show on screen and not during - * initialization. - * - * @param container The container to which the widgets should be added to, - * the layout is already set - */ - protected abstract DialogPane buildLayout(Composite container); - - /** - * Creates the state object (model object) that will be used to keep track - * of the information entered in this dialog. The state object will be stored - * in the subject holder and can be retrieved using {@link #subject()}. - * - * @return A new state object - */ - protected T buildStateObject() { - return null; - } - - /** - * Creates the Validator that will be notified when changes are - * made to the state object. - * - * @return The validator that will be set on the state object - */ - Node.Validator buildValidator() { - return Node.NULL_VALIDATOR; - } - - /* - * (non-Javadoc) - */ - @Override - public boolean close() { - - // Dispose the pane in order to remove any listeners that could - // have been installed outside the scrope of the state object - if (pane != null) { - pane.dispose(); - pane = null; - } - - return super.close(); - } - - /** - * {@inheritDoc} - */ - @Override - protected void configureShell(Shell shell) { - super.configureShell(shell); - shell.setText(getTitle()); - } - - /** - * {@inheritDoc} - */ - @Override - public void create() { - super.create(); - installSubject(); - } - - /* - * (non-Javadoc) - */ - @Override - protected Control createContents(Composite parent) { - if (hasTitleArea()) { - return super.createContents(parent); - } - - return createDefaultContent(parent); - } - - /** - * Creates the default main container of this dialog when the title area is - * not required. The top part is the dialog area populated by the subclass - * and the lower part is the button pane having the OK and Cancel buttons. - * - * @param parent The parent container - * @return The - */ - private Composite createDefaultContent(Composite parent) { - - Composite composite = new Composite(parent, SWT.NULL); - - GridLayout layout = new GridLayout(1, false); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.verticalSpacing = 0; - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - - applyDialogFont(composite); - initializeDialogUnits(composite); - dialogArea = createDialogArea(composite); - buttonBar = createButtonBar(composite); - - return composite; - } - - /* - * (non-Javadoc) - */ - @Override - protected Composite createDialogArea(Composite parent) { - - // If the title area needs to be shown, then leave the superclass to - // create the necessary widgets - if (hasTitleArea()) { - parent = (Composite) super.createDialogArea(parent); - } - - // Create the main area's container - Composite container = new Composite(parent, SWT.NULL); - container.setLayout(new GridLayout(1, false)); - - GridData gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.verticalAlignment = GridData.FILL; - gridData.grabExcessHorizontalSpace = true; - gridData.grabExcessVerticalSpace = true; - container.setLayoutData(gridData); - - // Initialize the content pane - pane = buildLayout(container); - - // Initialize the UI part, which requires the widgets being created - initializeUI(); - - return parent; - } - - /** - * Determines whether the description area (where a title, description and - * image) should be visible or hidden. ValidatingDialog - * automatically show the description area in order to show problems. - * - * @return false by default, which means the methods used to - * update the title, description and image shouldn't be called; true - * to make the description pane visible - */ - protected boolean hasTitleArea() { - return false; - } - - /** - * Returns the helps system. - * - * @return The platform's help system - * - * @category Helper - */ - protected final IWorkbenchHelpSystem getHelpSystem() { - return PlatformUI.getWorkbench().getHelpSystem(); - } - - /** - * Initializes this dialog. - */ - protected void initialize() { - this.subjectHolder = new SimplePropertyValueModel(); - } - - /** - * Initializes the UI part of this dialog, this is called after the widgets - * have been created. - */ - protected void initializeUI() { - } - - /** - * Creates the state object, if one is needed and install a Validator - * in order to receive notification of changes done to that state object. The - * subject can be retrieved from the subject holder. - */ - private void installSubject() { - - T subject = buildStateObject(); - - if (subject != null) { - subject.setValidator(buildValidator()); - } - - subjectHolder.setValue(subject); - } - - /** - * Asynchronously launches this dialog in the UI thread. - */ - public final void openDialog() { - SWTUtil.setUserInterfaceActive(false); - SWTUtil.show(this); - } - - /** - * Asynchronously launches this dialog in the UI thread and invoke the given - * PostExecution to perform any post-task. - * - * @param postExecution This interface let the caller to invoke a piece of - * code once the dialog is disposed - */ - public final void openDialog(PostExecution> execution) { - SWTUtil.setUserInterfaceActive(false); - SWTUtil.show(this, execution); - } - - /** - * Gives access to the dialog's main pane. - * - * @return The pane showing the custom widgets - */ - protected DialogPane getPane() { - return pane; - } - - /** - * Returns the subject of this dialog. - * - * @return The subject of this dialog or null if no subject was - * used - */ - public T getSubject() { - return subjectHolder.getValue(); - } - - /** - * Returns the holder of the subject. - * - * @return The subject holder used to be passed to the dialog pane, which is - * an instance of DialogPane - */ - protected final PropertyValueModel getSubjectHolder() { - return subjectHolder; - } - - /** - * Retrieves the dialog's title. The title passed to the constructor will be - * returned by default but if it wasn't specified, this method can be used - * to return it. - * - * @return Either the title passed to the constructor or a different title - */ - protected String getTitle() { - return title; - } - - /** - * Determines whether the dialog was cancelled or not. - * - * @return true if the dialog was cancelled; false - * if it was confirmed - */ - public final boolean wasCancelled() { - return getReturnCode() == CANCEL; - } - - /** - * Determines whether the dialog was confirmed or not. - * - * @return true if the dialog was confirmed; false - * if it was cancelled - */ - public final boolean wasConfirmed() { - return getReturnCode() == OK; - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/DialogPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/DialogPane.java deleted file mode 100644 index 823cd0c183..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/DialogPane.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.jpt.common.utility.internal.node.Node; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; - -/** - * The abstract pane to use when the pane is shown in an Dialog. - * - * @see Dialog - * - * @version 2.0 - * @since 2.0 - */ -public abstract class DialogPane extends Pane { - - /** - * Creates a new DialogPane. - * - * @param parentPane The parent controller of this one - * @param parent The parent container - * - * @category Constructor - */ - protected DialogPane(DialogPane parentPane, - Composite parent) { - - super(parentPane, parent); - } - - /** - * Creates a new DialogPane. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param widgetFactory The factory used to create various widgets - * @param automaticallyAlignWidgets true to make the widgets - * this pane aligned with the widgets of the given parent controller; - * false to not align them - * - * @category Constructor - */ - protected DialogPane(DialogPane parentPane, - Composite parent, - boolean automaticallyAlignWidgets) { - - super(parentPane, parent, automaticallyAlignWidgets); - } - - /** - * Creates a new DialogPane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - * - * @category Constructor - */ - protected DialogPane(DialogPane parentPane, - PropertyValueModel subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - /** - * Creates a new DialogPane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - * @param widgetFactory The factory used to create various widgets - * @param automaticallyAlignWidgets true to make the widgets - * this pane aligned with the widgets of the given parent controller; - * false to not align them - * - * @category Constructor - */ - protected DialogPane(DialogPane parentPane, - PropertyValueModel subjectHolder, - Composite parent, - boolean automaticallyAlignWidgets) { - - super(parentPane, subjectHolder, parent, automaticallyAlignWidgets); - } - - /** - * Creates a new DialogPane. - * - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - * - * @category Constructor - */ - protected DialogPane(PropertyValueModel subjectHolder, - Composite parent) { - - super(subjectHolder, parent, DefaultWidgetFactory.instance()); - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/EnumComboViewer.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/EnumComboViewer.java deleted file mode 100644 index f3069c5311..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/EnumComboViewer.java +++ /dev/null @@ -1,369 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import java.util.Arrays; -import java.util.Comparator; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.ISelection; -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.common.ui.WidgetFactory; -import org.eclipse.jpt.common.ui.internal.JptCommonUiMessages; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.widgets.Composite; -import com.ibm.icu.text.Collator; - -/** - * This pane simply shows a combo where its data is populating through - * {@link #choices()} and a default value can also be added. - *

- * Here the layout of this pane: - *

- * -----------------------------------------------------------------------------
- * | ------------------------------------------------------------------------- |
- * | | I                                                                   |v| |
- * | ------------------------------------------------------------------------- |
- * -----------------------------------------------------------------------------
- * - * @version 2.0 - * @since 1.0 - */ -@SuppressWarnings("nls") -abstract class EnumComboViewer extends Pane -{ - /** - * The main widget of this pane. - */ - private ComboViewer comboViewer; - - /** - * A constant used to represent the null value. - */ - public static final String NULL_VALUE = "null"; - - /** - * Creates a new EnumComboViewer. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param widgetFactory The factory used to create various widgets - */ - EnumComboViewer(Pane parentPane, - Composite parent) { - - super(parentPane, parent); - } - - /** - * Creates a new EnumComboViewer. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param widgetFactory The factory used to create various widgets - */ - EnumComboViewer(Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - /** - * Creates a new EnumComboViewer. - * - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - * @param widgetFactory The factory used to create various widgets - */ - EnumComboViewer(PropertyValueModel subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(subjectHolder, parent, widgetFactory); - } - - /** - * Creates the list of choices and add an extra element that represents the - * default value. - * - * @return The combo's choices including the default value - */ - private Object[] buildChoices() { - V[] choices = getChoices(); - if (sortChoices()) { - Arrays.sort(choices, buildComparator()); - } - - Object[] extendedChoices = new Object[choices.length + 1]; - System.arraycopy(choices, 0, extendedChoices, 1, choices.length); - extendedChoices[0] = NULL_VALUE; - - return extendedChoices; - } - - /** - * Return true to sort the choices in alphabetical order - * @return - */ - protected boolean sortChoices() { - return true; - } - - /** - * Creates the ComboViewer with the right combo widgets. - * - * @param container The container of the combo - * @return A new ComboViewer containing the right combo widget - */ - protected ComboViewer addComboViewer(Composite container) { - return addComboViewer(container, buildLabelProvider()); - } - - private Comparator buildComparator() { - return new Comparator() { - final LabelProvider labelProvider = buildLabelProvider(); - - public int compare(Object value1, Object value2) { - String displayString1 = labelProvider.getText(value1); - String displayString2 = labelProvider.getText(value2); - return Collator.getInstance().compare(displayString1, displayString2); - } - }; - } - - /** - * Retrieves the localized string from the given NLS class by creating the - * key. That key is the concatenation of the composite's short class name - * with the toString() of the given value separated by an underscore. - * - * @param nlsClass The NLS class used to retrieve the localized text - * @param compositeClass The class used for creating the key, its short class - * name is the beginning of the key - * @param value The value used to append its toString() to the generated key - * @return The localized text associated with the value - */ - protected final String buildDisplayString(Class nlsClass, - Class compositeClass, - Object value) { - - return SWTUtil.buildDisplayString(nlsClass, compositeClass, value); - } - - /** - * Retrieves the localized string from the given NLS class by creating the - * key. That key is the concatenation of the composite's short class name - * with the toString() of the given value separated by an underscore. - * - * @param nlsClass The NLS class used to retrieve the localized text - * @param composite The object used to retrieve the short class name that is - * the beginning of the key - * @param value The value used to append its toString() to the generated key - * @return The localized text associated with the value - */ - protected final String buildDisplayString(Class nlsClass, - Object composite, - Object value) { - - return SWTUtil.buildDisplayString(nlsClass, composite, value); - } - - /** - * Creates the display string for the given element. If the element is the - * virtual null value then its display string will be "Default" - * appended by the actual default value, if it exists. - * - * @param value The value to convert into a human readable string - * @return The string representation of the given element - */ - @SuppressWarnings("unchecked") - private String buildDisplayString(Object value) { - if (value == NULL_VALUE) { - V defaultValue = (getSubject() != null) ? getDefaultValue() : null; - - if (defaultValue != null) { - String displayString = displayString(defaultValue); - return NLS.bind(JptCommonUiMessages.EnumComboViewer_defaultWithDefault, displayString); - } - return nullDisplayString(); - } - - return displayString((V) value); - } - - final LabelProvider buildLabelProvider() { - return new LabelProvider() { - @Override - public String getText(Object element) { - return buildDisplayString(element); - } - }; - } - - private ISelection buildSelection() { - Object value = (getSubject() != null) ? getValue() : null; - - if (value == null) { - value = NULL_VALUE; - } - - return new StructuredSelection(value); - } - - private ISelectionChangedListener buildSelectionChangedListener() { - return new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent e) { - if (!isPopulating()) { - StructuredSelection selection = (StructuredSelection) e.getSelection(); - valueChanged(selection.getFirstElement()); - } - } - }; - } - - /** - * Returns the possible choices to show in the viewer. - * - * @return The items to show in the combos - */ - protected abstract V[] getChoices(); - - /** - * Returns the default value, this method is not called if the subject is - * null. - * - * @return The value that is declared as being the default when it is not - * defined or null if there is no default value - */ - protected abstract V getDefaultValue(); - - /** - * Returns the displayable string for the given value. - * - * @param value The value to translate into a human readable string - * @return The localized text representing the given value - */ - protected abstract String displayString(V value); - - /** - * Returns the displayable string for a null value. - */ - protected String nullDisplayString() { - return null; //I would rather display nothing than "Default()" - } - - /* - * (non-Javadoc) - */ - @Override - protected void doPopulate() { - super.doPopulate(); - this.populateCombo(); - } - - /** - * Returns - * - * @return - */ - final ComboViewer getComboViewer() { - return comboViewer; - } - - /** - * Retrieves the subject's value. The subject is never null. - * - * @return The subject' value, which can be null - */ - protected abstract V getValue(); - - /* - * (non-Javadoc) - */ - @Override - protected final void initializeLayout(Composite container) { - - this.comboViewer = this.addComboViewer(container); - this.comboViewer.addSelectionChangedListener(buildSelectionChangedListener()); - } - - /** - * Populates the combo by re-adding all the items. - */ - private void populateCombo() { - - removeAll(); - comboViewer.add(buildChoices()); - updateSelection(); - } - - /* - * (non-Javadoc) - */ - @Override - protected void propertyChanged(String propertyName) { - super.propertyChanged(propertyName); - this.populateCombo(); - } - - /** - * Removes all the items from the combo. - */ - abstract void removeAll(); - - /** - * Requests the given new value be set on the subject. - * - * @param value The new value to be set - */ - protected abstract void setValue(V value); - - /** - * Updates the cursor, which is required to show the entire selected item - * within the combo's area. - */ - abstract void updateCursor(); - - /** - * Updates the combo's selected item. - */ - private void updateSelection() { - comboViewer.setSelection(buildSelection()); - updateCursor(); - } - - /** - * The selection changes, notify the subclass to set the value. - * - * @param value The new selected item - */ - @SuppressWarnings("unchecked") - private void valueChanged(Object value) { - - // Convert the default "null" value to a real null - if (value == NULL_VALUE) { - value = null; - } - - setPopulating(true); - - try { - setValue((V) value); - } - finally { - setPopulating(false); - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/EnumDialogComboViewer.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/EnumDialogComboViewer.java deleted file mode 100644 index 85d6b19518..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/EnumDialogComboViewer.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; - -/** - * This EnumComboViewer should be used within a dialog pane. - * - * @version 2.0 - * @since 2.0 - */ -public abstract class EnumDialogComboViewer - extends EnumComboViewer -{ - /** - * Creates a new EnumDialogComboViewer. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param widgetFactory The factory used to create various widgets - */ - protected EnumDialogComboViewer(DialogPane parentPane, - Composite parent - ) { - super(parentPane, parent); - } - - /** - * Creates a new EnumDialogComboViewer. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param widgetFactory The factory used to create various widgets - */ - protected EnumDialogComboViewer(DialogPane parentPane, - PropertyValueModel subjectHolder, - Composite parent - ) { - super(parentPane, subjectHolder, parent); - } - - @Override - public void enableWidgets(boolean enabled) { - super.enableWidgets(enabled); - - Combo combo = getCombo(); - if ( ! combo.isDisposed()) { - combo.setEnabled(enabled); - } - } - - protected final Combo getCombo() { - return getComboViewer().getCombo(); - } - - @Override - void removeAll() { - getCombo().removeAll(); - } - - @Override - void updateCursor() { - getCombo().setSelection(new Point(0, 0)); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/EnumFormComboViewer.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/EnumFormComboViewer.java deleted file mode 100644 index b6ee89f7ec..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/EnumFormComboViewer.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; - -/** - * This EnumComboViewer should be used within a form pane. - * - * @version 2.3 - * @since 1.0 - */ -public abstract class EnumFormComboViewer - extends EnumComboViewer -{ - /** - * Creates a new EnumFormComboViewer. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param widgetFactory The factory used to create various widgets - */ - protected EnumFormComboViewer(Pane parentPane, - Composite parent - ) { - super(parentPane, parent); - } - - /** - * Creates a new EnumFormComboViewer. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param widgetFactory The factory used to create various widgets - */ - protected EnumFormComboViewer(Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent - ) { - super(parentPane, subjectHolder, parent); - } - - @Override - public void enableWidgets(boolean enabled) { - super.enableWidgets(enabled); - - Combo combo = getCombo(); - if ( ! combo.isDisposed()) { - combo.setEnabled(enabled); - } - } - - protected final Combo getCombo() { - return this.getComboViewer().getCombo(); - } - - @Override - void removeAll() { - getCombo().removeAll(); - } - - @Override - void updateCursor() { - getCombo().setSelection(new Point(0, 0)); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FileChooserComboPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FileChooserComboPane.java deleted file mode 100644 index 4b47bad407..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FileChooserComboPane.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import java.util.Arrays; -import java.util.List; - -import org.eclipse.jpt.common.utility.internal.StringConverter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - -/** - * This chooser allows the user to choose a file when browsing. - *

- * Here the layout of this pane: - *

- * -----------------------------------------------------------------------------
- * |        ---------------------------------------------------- ------------- |
- * | Label: | I                                            |v| | | Browse... | |
- * |        ---------------------------------------------------- ------------- |
- * -----------------------------------------------------------------------------
- * - * @version 3.0 - * @since 3.0 - */ -public abstract class FileChooserComboPane extends FileChooserPane -{ - /** - * Creates a new FileChooserComboPane. - * - * @param parentPane The parent pane of this one - * @param parent The parent container - */ - public FileChooserComboPane(Pane parentPane, - Composite parent) { - - super(parentPane, parent); - } - - /** - * Creates a new FileChooserComboPane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - */ - public FileChooserComboPane(Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - @Override - protected Control addMainControl(Composite container) { - - return addEditableCombo( - container, - this.buildListHolder(), - this.getTextHolder(), - this.buildStringConverter() - ); - } - - /** - * Creates the list holder of the combo box. - */ - protected ListValueModel buildListHolder() { - return new SimpleListValueModel( - this.buildDefaultList() - ); - } - - /** - * Creates the default list of the combo box. - */ - protected List buildDefaultList() { - return Arrays.asList(this.getDefaultString()); - } - - /** - * Returns the default value of the combo box. - */ - protected abstract String getDefaultString(); - - /** - * The converter responsible to transform each combo box item - * into a string representation - */ - protected StringConverter buildStringConverter() { - return StringConverter.Default.instance(); - } - -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FileChooserPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FileChooserPane.java deleted file mode 100644 index bcaec6dca9..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FileChooserPane.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jpt.common.ui.JptCommonUiPlugin; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.ui.dialogs.ISelectionStatusValidator; - -/** - * This chooser allows the user to choose a file when browsing. - *

- * Here the layout of this pane: - *

- * -----------------------------------------------------------------------------
- * |        ---------------------------------------------------- ------------- |
- * | Label: | I                                                | | Browse... | |
- * |        ---------------------------------------------------- ------------- |
- * -----------------------------------------------------------------------------
- * - * @version 2.0 - * @since 2.0 - */ -@SuppressWarnings("nls") -public abstract class FileChooserPane extends ChooserPane -{ - private WritablePropertyValueModel textHolder; - - /** - * Creates a new FileChooserPane. - * - * @param parentPane The parent pane of this one - * @param parent The parent container - */ - public FileChooserPane(Pane parentPane, - Composite parent) { - - super(parentPane, parent); - } - - /** - * Creates a new FileChooserPane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - */ - public FileChooserPane(Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - @Override - protected final Runnable buildBrowseAction() { - return new Runnable() { - public void run() { - promptFile(); - } - }; - } - - /** - * Creates the ViewerFilter that will filter the content of the - * dialog and only displays what is valid. - * - * @return A new ViewerFilter - */ - protected ViewerFilter buildFilter() { - return new ViewerFilter() { - @Override - public boolean select(Viewer viewer, - Object parentElement, - Object element) { - - return true; - } - }; - } - - @Override - protected Control addMainControl(Composite container) { - return this.addText(container, this.textHolder); - } - - /** - * Creates the value holder of the subject's property. - * - * @return The holder of the class name - */ - protected abstract WritablePropertyValueModel buildTextHolder(); - - /** - * Creates the validator that will show a status message based on what is - * selected in the selection dialog. - * - * @return A new ISelectionStatusValidator - */ - protected ISelectionStatusValidator buildValidator() { - return new ISelectionStatusValidator() { - public IStatus validate(Object[] selection) { - - if (selection.length != 1) { - return new Status(IStatus.ERROR, JptCommonUiPlugin.PLUGIN_ID, ""); - } - - return new Status(IStatus.OK, JptCommonUiPlugin.PLUGIN_ID, ""); - } - }; - } - - /** - * Returns the selection dialog's title. - * - * @return A non-null string - */ - protected abstract String getDialogTitle(); - - /** - * Retrieves the project path that will be used by the selection dialog. - * - * @return The project path used to display its content in a selection dialog - */ - protected abstract String getProjectPath(); - - protected WritablePropertyValueModel getTextHolder() { - return this.textHolder; - } - - @Override - protected void initialize() { - super.initialize(); - this.textHolder = this.buildTextHolder(); - } - - /** - * The browse button was clicked, its action invokes this action which should - * prompt the user to select a file and set it. - */ - protected void promptFile() { - String projectPath= this.getProjectPath(); - - FileDialog dialog = new FileDialog(getShell()); - dialog.setText(this.getDialogTitle()); - dialog.setFilterPath(projectPath); - String filePath = dialog.open(); - if (filePath != null) { - FileChooserPane.this.textHolder.setValue(filePath); - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FolderChooserComboPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FolderChooserComboPane.java deleted file mode 100644 index d7cce8ab4d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FolderChooserComboPane.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import java.util.Arrays; -import java.util.List; - -import org.eclipse.jpt.common.utility.internal.StringConverter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; - - -/** - * This chooser allows the user to choose a folder when browsing. - *

- * Here the layout of this pane: - *

- * -----------------------------------------------------------------------------
- * |        ---------------------------------------------------- ------------- |
- * | Label: | I                                            |v| | | Browse... | |
- * |        ---------------------------------------------------- ------------- |
- * -----------------------------------------------------------------------------
- * - * @version 3.0 - * @since 3.0 - */ -public abstract class FolderChooserComboPane extends FolderChooserPane -{ - /** - * Creates a new FolderChooserComboPane. - * - * @param parentPane The parent pane of this one - * @param parent The parent container - */ - public FolderChooserComboPane(Pane parentPane, - Composite parent) { - - super(parentPane, parent); - } - - /** - * Creates a new FolderChooserComboPane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - */ - public FolderChooserComboPane(Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - @Override - protected Control addMainControl(Composite container) { - - return addEditableCombo( - container, - this.buildListHolder(), - this.getTextHolder(), - this.buildStringConverter() - ); - } - - /** - * Creates the list holder of the combo box. - */ - protected ListValueModel buildListHolder() { - return new SimpleListValueModel( - this.buildDefaultList() - ); - } - - /** - * Creates the default list of the combo box. - */ - protected List buildDefaultList() { - return Arrays.asList(this.getDefaultString()); - } - - /** - * Returns the default value of the combo box. - */ - protected abstract String getDefaultString(); - - /** - * The converter responsible to transform each combo box item - * into a string representation - */ - protected StringConverter buildStringConverter() { - return StringConverter.Default.instance(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FolderChooserPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FolderChooserPane.java deleted file mode 100644 index 0aa4142d4a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FolderChooserPane.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 20010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.DirectoryDialog; - -/** - * This chooser allows the user to choose a folder when browsing. - *

- * Here the layout of this pane: - *

- * -----------------------------------------------------------------------------
- * |        ---------------------------------------------------- ------------- |
- * | Label: | I                                                | | Browse... | |
- * |        ---------------------------------------------------- ------------- |
- * -----------------------------------------------------------------------------
- * - * @version 3.0 - * @since 2.0 - */ -public abstract class FolderChooserPane extends ChooserPane -{ - private WritablePropertyValueModel textHolder; - - /** - * Creates a new FolderChooserPane. - * - * @param parentPane The parent pane of this one - * @param parent The parent container - */ - public FolderChooserPane(Pane parentPane, - Composite parent) { - - super(parentPane, parent); - } - - /** - * Creates a new FolderChooserPane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - */ - public FolderChooserPane(Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - @Override - protected final Runnable buildBrowseAction() { - return new Runnable() { - public void run() { - promptFolder(); - } - }; - } - - @Override - protected Control addMainControl(Composite container) { - return this.addText(container, this.textHolder); - } - - /** - * Creates the value holder of the subject's property. - * - * @return The holder of the class name - */ - protected abstract WritablePropertyValueModel buildTextHolder(); - - /** - * Returns the message to be shown in the selection dialog. - * - * @return A non-null string shown above the text field of the - * selection dialog - */ - protected abstract String getDialogMessage(); - - /** - * Returns the selection dialog's title. - * - * @return A non-null string - */ - protected abstract String getDialogTitle(); - - /** - * Returns the path that the dialog will use to filter the directories it - * shows to the argument, which may be null. If the string is null, then the - * operating system's default filter path will be used. - *

- * Note that the path string is platform dependent. For convenience, either - * '/' or '\' can be used as a path separator. - *

- * - * @return The filter path - */ - protected String filterPath() { - return null; - } - - protected WritablePropertyValueModel getTextHolder() { - return this.textHolder; - } - - @Override - protected void initialize() { - super.initialize(); - this.textHolder = this.buildTextHolder(); - } - - /** - * The browse button was clicked, its action invokes this action which should - * prompt the user to select a folder and set it. - */ - protected void promptFolder() { - - DirectoryDialog dialog = new DirectoryDialog(getShell()); - dialog.setMessage(this.getDialogMessage()); - dialog.setText(this.getDialogTitle()); - dialog.setFilterPath(this.filterPath()); - String directory = dialog.open(); - - if (directory != null) { - this.textHolder.setValue(directory); - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FormWidgetFactory.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FormWidgetFactory.java deleted file mode 100644 index ea1302f7df..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/FormWidgetFactory.java +++ /dev/null @@ -1,338 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.core.runtime.Assert; -import org.eclipse.jpt.common.ui.WidgetFactory; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.CCombo; -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.DateTime; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Spinner; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.forms.widgets.FormText; -import org.eclipse.ui.forms.widgets.FormToolkit; -import org.eclipse.ui.forms.widgets.Hyperlink; -import org.eclipse.ui.forms.widgets.Section; -import org.eclipse.ui.forms.widgets.TableWrapData; -import org.eclipse.ui.forms.widgets.TableWrapLayout; - -/** - * This WidgetFactory is responsible to create the widgets - * using the FormToolkit in order use the form style (flat-style) - * look and feel. - * - * @see FormToolkit - * - * @version 2.0 - * @since 2.0 - */ -@SuppressWarnings("nls") -public class FormWidgetFactory implements WidgetFactory { - - /** - * The actual factory responsible for creating the new widgets. - */ - private final FormToolkit widgetFactory; - - /** - * Creates a new FormWidgetFactory. - * - * @param widgetFactory The actual factory responsible for creating the new - * widgets - */ - public FormWidgetFactory(FormToolkit widgetFactory) { - super(); - - Assert.isNotNull(widgetFactory, "The widget factory cannot be null"); - this.widgetFactory = widgetFactory; - } - - /** - * Wraps the given Composite into a new Composite - * in order to have the widgets' border painted. Except for CCombo, - * the top and bottom margins have to be 2 pixel and the left and right - * margins have to be 1 pixel. - * - * @param container The parent of the sub-pane - * @return A new Composite that has the necessary space to paint - * the border - */ - protected Composite createBorderContainer(Composite container) { - return createBorderContainer(container, 2, 1); - } - - protected Composite createBorderContainer(Composite container, int marginHeight, int marginWidth) { - - GridLayout layout = new GridLayout(1, false); - layout.marginHeight = marginHeight; - layout.marginWidth = marginWidth; - - GridData gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.grabExcessHorizontalSpace = true; - - container = widgetFactory.createComposite(container); - container.setLayoutData(gridData); - container.setLayout(layout); - - return container; - } - - /** - * {@inheritDoc} - */ - public Button createButton(Composite parent, String text) { - return createButton(parent, text, SWT.NULL); - } - - /** - * Creates a new button. - * - * @param parent The parent container - * @param text The button's text - * @param style The style to apply to the button, which determines its type: - * toggle, push, check box, radio - * @return The newly created Button - */ - protected Button createButton(Composite parent, String text, int style) { - return widgetFactory.createButton(parent, text, SWT.FLAT | style); - } - - /** - * {@inheritDoc} - */ - @Deprecated - public CCombo createCCombo(Composite parent) { - return createCCombo(parent, SWT.READ_ONLY); - } - - /** - * Creates a new combo. - * - * @param parent The parent container - * @param style The style to apply to the combo, usually read-only, flat - * @return The newly created CCombo - */ - protected CCombo createCCombo(Composite parent, int style) { - parent = createBorderContainer(parent, 1, 1); - - CCombo combo = new CCombo(parent, style); - widgetFactory.adapt(combo, true, false); - - // Bugzilla 145837 - workaround for no borders on Windows XP - if (widgetFactory.getBorderStyle() == SWT.BORDER) { - combo.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); - } - - return combo; - } - - /** - * {@inheritDoc} - */ - public Button createCheckBox(Composite parent, String text) { - return createButton(parent, text, SWT.CHECK); - } - - /** - * {@inheritDoc} - */ - public Combo createCombo(Composite parent) { - return new Combo(parent, SWT.READ_ONLY | SWT.FLAT); - } - - /** - * {@inheritDoc} - */ - public Composite createComposite(Composite parent) { - return this.widgetFactory.createComposite(parent); - } - /** - * {@inheritDoc} - */ - public DateTime createDateTime(Composite parent, int style) { - parent = createBorderContainer(parent); - - DateTime dateTime = new DateTime(parent, style | SWT.FLAT); - dateTime.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); - this.widgetFactory.adapt(dateTime, true, false); - - return dateTime; - } - - /** - * {@inheritDoc} - */ - @Deprecated - public CCombo createEditableCCombo(Composite parent) { - return createCCombo(parent, SWT.NULL); - } - - /** - * {@inheritDoc} - */ - public Combo createEditableCombo(Composite parent) { - Combo combo = new Combo(parent, SWT.FLAT); - return combo; - } - - /** - * {@inheritDoc} - */ - public Group createGroup(Composite parent, String title) { - Group group = new Group(parent, SWT.NULL); - group.setText(title); - return group; - } - - /** - * {@inheritDoc} - */ - public Hyperlink createHyperlink(Composite parent, String text) { - return widgetFactory.createHyperlink(parent, text, SWT.FLAT); - } - - /** - * {@inheritDoc} - */ - public Label createLabel(Composite container, String labelText) { - return widgetFactory.createLabel(container, labelText, SWT.WRAP); - } - - /** - * {@inheritDoc} - */ - public List createList(Composite container, int style) { - List list = new List(container, SWT.FLAT | style); - list.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); - return list; - } - - /** - * {@inheritDoc} - */ - public FormText createMultiLineLabel(Composite parent, String labelText) { - - Composite container = widgetFactory.createComposite(parent, SWT.NONE); - - GridData gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.grabExcessHorizontalSpace = true; - container.setLayoutData(gridData); - - TableWrapLayout layout = new TableWrapLayout(); - layout.numColumns = 1; - layout.bottomMargin = 0; - layout.leftMargin = 0; - layout.rightMargin = 0; - layout.topMargin = 0; - container.setLayout(layout); - - FormText text = widgetFactory.createFormText(container, true); - text.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); - text.setText(labelText, false, false); - - return text; - } - - /** - * {@inheritDoc} - */ - public Text createMultiLineText(Composite parent) { - return createText(parent, SWT.MULTI | SWT.V_SCROLL); - } - - /** - * {@inheritDoc} - */ - public Text createPasswordText(Composite parent) { - return createText(parent, SWT.PASSWORD); - } - - /** - * {@inheritDoc} - */ - public Button createPushButton(Composite parent, String text) { - return createButton(parent, text, SWT.PUSH); - } - - /** - * {@inheritDoc} - */ - public Button createRadioButton(Composite parent, String text) { - return createButton(parent, text, SWT.RADIO); - } - - /** - * {@inheritDoc} - */ - public Section createSection(Composite parent, int style) { - return widgetFactory.createSection(parent, SWT.FLAT | style); - } - - /** - * {@inheritDoc} - */ - public Spinner createSpinner(Composite parent) { - parent = createBorderContainer(parent); - - Spinner spinner = new Spinner(parent, SWT.FLAT); - spinner.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); - widgetFactory.adapt(spinner, true, false); - - return spinner; - } - - /** - * {@inheritDoc} - */ - public Table createTable(Composite parent, int style) { - Table table = this.widgetFactory.createTable(parent, SWT.BORDER | style); - table.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); - return table; - } - - /** - * {@inheritDoc} - */ - public Text createText(Composite parent) { - return createText(parent, SWT.NONE); - } - - protected Text createText(Composite parent, int style) { - return widgetFactory.createText(parent, null, SWT.BORDER | SWT.FLAT | style); - } - - /** - * {@inheritDoc} - */ - public Button createTriStateCheckBox(Composite parent, String text) { - TriStateCheckBox checkBox = new TriStateCheckBox(parent, text, this); - return checkBox.getCheckBox(); - } - - /** - * Returns the actual factory responsible for creating the new widgets. - * - * @return The factory creating the widgets with the form style (flat-style) - */ - public FormToolkit getWidgetFactory() { - return widgetFactory; - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java deleted file mode 100644 index 6703d6a3a0..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/IntegerCombo.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.jface.fieldassist.FieldDecorationRegistry; -import org.eclipse.jpt.common.ui.internal.JptCommonUiMessages; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyListValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.TransformationWritablePropertyValueModel; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.events.VerifyEvent; -import org.eclipse.swt.events.VerifyListener; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; - -/** - * This is a replacement for a Spinner. It is a combo that only accepts integers. - * It also includes a Default option in the combo. - */ -public abstract class IntegerCombo - extends Pane -{ - - /** - * The main (only) widget of this pane. - */ - private Combo comboBox; - - - private PropertyValueModel defaultValueHolder; - - // ********** constructors ********** - - protected IntegerCombo( - Pane parentPane, - Composite parent - ) { - super(parentPane, parent); - } - - protected IntegerCombo( - Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent - ) { - super(parentPane, subjectHolder, parent); - } - - public Combo getCombo() { - return this.comboBox; - } - - // ********** initialization ********** - - @Override - protected void initializeLayout(Composite container) { - this.defaultValueHolder = buildDefaultStringHolder(); - this.comboBox = this.addIntegerCombo(container); - - int margin = FieldDecorationRegistry.getDefault().getMaximumDecorationWidth(); - GridData gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL_HORIZONTAL; - gridData.horizontalIndent = margin; - gridData.grabExcessHorizontalSpace = false; - this.comboBox.setLayoutData(gridData); - - this.comboBox.addVerifyListener(this.buildVerifyListener()); - SWTUtil.attachDefaultValueHandler(this.comboBox); - } - - protected Combo addIntegerCombo(Composite container) { - return this.addLabeledEditableCombo( - container, - getLabelText(), - buildDefaultListHolder(), - buildSelectedItemStringHolder(), - getHelpId() - ); - - } - - protected VerifyListener buildVerifyListener() { - return new VerifyListener() { - public void verifyText(VerifyEvent e) { - IntegerCombo.this.verifyComboBox(e); - } - }; - } - - protected ListValueModel buildDefaultListHolder() { - return new PropertyListValueModelAdapter(this.defaultValueHolder); - } - - private PropertyValueModel buildDefaultStringHolder() { - return new TransformationPropertyValueModel(buildDefaultHolder()) { - @Override - protected String transform(Integer value) { - if (value == null) { - return JptCommonUiMessages.NoneSelected; - } - return super.transform(value); - } - @Override - protected String transform_(Integer value) { - return getDefaultValueString(value); - } - }; - } - - private String getDefaultValueString(Integer defaultValue) { - return NLS.bind( - JptCommonUiMessages.DefaultWithOneParam, - defaultValue - ); - } - - private String getDefaultValueString() { - return this.defaultValueHolder.getValue(); - } - - protected WritablePropertyValueModel buildSelectedItemStringHolder() { - return new TransformationWritablePropertyValueModel(buildSelectedItemHolder()) { - @Override - protected String transform(Integer value) { - return value == null ? - getDefaultValueString() - : - value.toString(); - } - - @Override - protected Integer reverseTransform_(String value) { - int intLength; - try { - intLength = Integer.parseInt(value); - } - catch (NumberFormatException e) { - //if the default is selected from the combo, set length to null - return null; - } - return Integer.valueOf(intLength); - } - }; - } - - // ********** abstract methods ********** - - protected abstract String getLabelText(); - - protected abstract String getHelpId(); - - protected abstract PropertyValueModel buildDefaultHolder(); - - protected abstract WritablePropertyValueModel buildSelectedItemHolder(); - - // ********** combo-box verify listener callback ********** - - protected void verifyComboBox(VerifyEvent e) { - if (e.character == '\b') { - //ignore backspace - return; - } - if (e.text.equals("") //DefaultValueHandler sets the text to "" //$NON-NLS-1$ - || e.text.equals(this.defaultValueHolder.getValue())) { - return; - } - try { - Integer.parseInt(e.text); - } - catch (NumberFormatException exception) { - e.doit = false; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/NewNameDialog.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/NewNameDialog.java deleted file mode 100644 index 3dd63559cb..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/NewNameDialog.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import java.util.Collection; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * The dialog used to requests a name from the user. - * - * @version 2.0 - * @since 2.0 - */ -public class NewNameDialog extends ValidatingDialog -{ - private String description; - private Image descriptionImage; - private String descriptionTitle; - private String labelText; - private String name; - private Collection names; - - /** - * Creates a new NewNameDialog. - * - * @param parentShell - * @param dialogTitle - * @param descriptionTitle - * @param descriptionImage - * @param description - * @param labelText - * @param name - * @param names - */ - NewNameDialog(Shell parentShell, - String dialogTitle, - String descriptionTitle, - Image descriptionImage, - String description, - String labelText, - String name, - Collection names) - { - super(parentShell, dialogTitle); - - this.name = name; - this.names = names; - this.labelText = labelText; - this.description = description; - this.descriptionImage = descriptionImage; - this.descriptionTitle = descriptionTitle; - } - - /* - * (non-Javadoc) - */ - @Override - protected DialogPane buildLayout(Composite container) { - return new NewNameDialogPane(container); - } - - /* - * (non-Javadoc) - */ - @Override - protected NewNameStateObject buildStateObject() { - return new NewNameStateObject(name, names); - } - - /* - * (non-Javadoc) - */ - @Override - public void create() { - super.create(); - - NewNameDialogPane pane = (NewNameDialogPane) getPane(); - pane.selectAll(); - - getButton(OK).setEnabled(false); - } - - /* - * (non-Javadoc) - */ - @Override - protected String getDescription() { - return description; - } - - /* - * (non-Javadoc) - */ - @Override - protected Image getDescriptionImage() { - return descriptionImage; - } - - /* (non-Javadoc) - */ - @Override - protected String getDescriptionTitle() { - return descriptionTitle; - } - - /** - * Returns the text field's input, which is the new name the user entered. - * - * @return The name the user entered - */ - public String getName() { - return getSubject().getName(); - } - - private class NewNameDialogPane extends DialogPane { - - private Text text; - - NewNameDialogPane(Composite parent) { - super(NewNameDialog.this.getSubjectHolder(), parent); - } - - private WritablePropertyValueModel buildNameHolder() { - return new PropertyAspectAdapter(getSubjectHolder(), NewNameStateObject.NAME_PROPERTY) { - @Override - protected String buildValue_() { - return subject.getName(); - } - - @Override - protected void setValue_(String value) { - subject.setName(value); - } - }; - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeLayout(Composite container) { - - text = addLabeledText( - container, - labelText, - buildNameHolder() - ); - } - - void selectAll() { - text.selectAll(); - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/NewNameDialogBuilder.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/NewNameDialogBuilder.java deleted file mode 100644 index 4142c07709..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/NewNameDialogBuilder.java +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import org.eclipse.core.runtime.Assert; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Shell; - -/** - * This builder is responsible to create a fully initialized - * NewNameDialog once all the properties have been set. - * - * @see NewNameDialog - * - * @version 2.0 - * @since 2.0 - */ -@SuppressWarnings("nls") -public final class NewNameDialogBuilder { - - /** - * The message to show in the description area. - */ - private String description; - - /** - * The image of the description area. - */ - private Image descriptionImage; - - /** - * The title to show in the description area. - */ - private String descriptionTitle; - - /** - * The title of the new name dialog. - */ - private String dialogTitle; - - /** - * The text field's label. - */ - private String labelText; - - /** - * The initial input or null if no initial value can be - * specified. - */ - private String name; - - /** - * The collection of names that can't be used or an empty collection if none - * are available. - */ - private Collection names; - - /** - * The parent shell of the new name dialog. - */ - private Shell parentShell; - - /** - * Creates a new NewNameDialogBuilder. - * - * @param parentShell The parent shell of the new name dialog - */ - public NewNameDialogBuilder(Shell parentShell) { - super(); - initialize(parentShell); - } - - /** - * Creates the dialog that will be used to request a new name from the user. - * - * @return The initialized dialog - */ - public NewNameDialog buildDialog() { - return new NewNameDialog( - parentShell, - dialogTitle, - descriptionTitle, - descriptionImage, - description, - labelText, - name, - names - ); - } - - /** - * Initializes this builder. - * - * @param parentShell The parent shell of the new name dialog - */ - protected void initialize(Shell parentShell) { - - Assert.isNotNull(parentShell, "The parent shell cannot be null"); - - this.parentShell = parentShell; - this.names = Collections.emptyList(); - } - - /** - * Sets the description to be shown in the description area under the title. - * - * @param description The message to show in the description area - */ - public void setDescription(String description) { - this.description = description; - } - - /** - * Sets the image to be shown to the right side of the description area. - * - * @param descriptionImage The image of the description area - */ - public void setDescriptionImage(Image descriptionImage) { - this.descriptionImage = descriptionImage; - } - - /** - * Sets the title to be shown in the description area. - * - * @param descriptionTitle The title to show in the description area - */ - public void setDescriptionTitle(String descriptionTitle) { - this.descriptionTitle = descriptionTitle; - } - - /** - * Sets the dialog's title. - * - * @param dialogTitle The title of the new name dialog - */ - public void setDialogTitle(String dialogTitle) { - this.dialogTitle = dialogTitle; - } - - /** - * Sets the existing names that will be used to validate the text field's - * input and prevent the user from using it. - * - * @param names The collection of names that can't be used - */ - public void setExistingNames(Iterator names) { - this.names = CollectionTools.collection(names); - } - - /** - * Sets the text to label the text field. - * - * @param labelText The text field's label - */ - public void setLabelText(String labelText) { - this.labelText = labelText; - } - - /** - * Sets the initial name if one exists. It is valid to leave this - * null when the user has to enter something. - * - * @param name The initial input - */ - public void setName(String name) { - this.name = name; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/NewNameStateObject.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/NewNameStateObject.java deleted file mode 100644 index f86bae2e11..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/NewNameStateObject.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import java.util.Collection; -import java.util.List; -import org.eclipse.jface.dialogs.IMessageProvider; -import org.eclipse.jpt.common.ui.internal.JptCommonUiMessages; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.node.AbstractNode; -import org.eclipse.jpt.common.utility.internal.node.Node; -import org.eclipse.jpt.common.utility.internal.node.Problem; - -/** - * This is the state object used by the NewNameDialog, which stores - * the current name and validates it when it is modified. - * - * @see NewNameDialog - * - * @version 2.0 - * @since 2.0 - */ -@SuppressWarnings("nls") -final class NewNameStateObject extends AbstractNode -{ - /** - * The initial input or null if no initial value can be - * specified. - */ - private String name; - - /** - * The collection of names that can't be used or an empty collection if none - * are available. - */ - private Collection names; - - /** - * The Validator used to validate this state object. - */ - private Validator validator; - - /** - * Notifies a change in the name property. - */ - static final String NAME_PROPERTY = "name"; - - /** - * Creates a new NewNameStateObject. - * - * @param name The initial input or null if no initial value can - * be specified - * @param names The collection of names that can't be used or an empty - * collection if none are available - */ - NewNameStateObject(String name, Collection names) { - super(null); - - this.name = name; - this.names = names; - } - - /** - * Validates the name property. - * - * @param currentProblems The list to which Problems can be - * added - */ - private void addNameProblems(List currentProblems) { - - if (StringTools.stringIsEmpty(name)) { - currentProblems.add(buildProblem(JptCommonUiMessages.NewNameStateObject_nameMustBeSpecified, IMessageProvider.ERROR)); - } - else if (names.contains(name.trim())) { - currentProblems.add(buildProblem(JptCommonUiMessages.NewNameStateObject_nameAlreadyExists, IMessageProvider.ERROR)); - } - } - - /* - * (non-Javadoc) - */ - @Override - protected void addProblemsTo(List currentProblems) - { - super.addProblemsTo(currentProblems); - addNameProblems(currentProblems); - } - - /* - * (non-Javadoc) - */ - @Override - protected void checkParent(Node parentNode) { - } - - /* - * (non-Javadoc) - */ - public String displayString() { - return null; - } - - /** - * Returns the current name stored in this state object. - * - * @return The current name or null - */ - String getName() { - return name; - } - - /** - * Sets the current name stored in this state object or null to - * clear it. - * - * @param name The new name or null - */ - public void setName(String name) { - String oldName = this.name; - this.name = name; - firePropertyChanged(NAME_PROPERTY, oldName, name); - } - - /* - * (non-Javadoc) - */ - @Override - public void setValidator(Validator validator) { - this.validator = validator; - } - - /* - * (non-Javadoc) - */ - @Override - public Validator getValidator() { - return validator; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/NullPostExecution.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/NullPostExecution.java deleted file mode 100644 index 21e7420523..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/NullPostExecution.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.jface.dialogs.Dialog; - -/** - * A null instance of PostExecution. - * - * @version 2.0 - * @since 1.0 - */ -public final class NullPostExecution implements PostExecution { - - /** - * The singleton instance of this NullPostExecution. - */ - private static PostExecution INSTANCE; - - /** - * Creates a new NullPostExecution. - */ - private NullPostExecution() { - super(); - } - - /** - * Returns the singleton instance of this NullPostExecution. - * - * @param The dialog where this PostExecution will be used - * @return The singleton instance with the proper type - */ - @SuppressWarnings("unchecked") - public static synchronized PostExecution instance() { - - if (INSTANCE == null) { - INSTANCE = new NullPostExecution(); - } - - return (PostExecution) INSTANCE; - } - - /* - * (non-Javadoc) - */ - public void execute(Dialog dialog) { - // Nothing to do - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PackageChooserPane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PackageChooserPane.java deleted file mode 100644 index cc9453c147..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PackageChooserPane.java +++ /dev/null @@ -1,237 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -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.fieldassist.FieldDecorationRegistry; -import org.eclipse.jface.window.Window; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTTools; -import org.eclipse.jpt.common.ui.JptCommonUiPlugin; -import org.eclipse.jpt.common.ui.internal.JptCommonUiMessages; -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.SelectionDialog; - -/** - * This chooser allows the user to choose a package when browsing and it adds - * code completion support to the text field, which is the main component. - *

- * Here the layout of this pane: - *

- * -----------------------------------------------------------------------------
- * |       !---------------------------------------------------- ------------- |
- * | Label: | I                                                | | Browse... | |
- * |        ---------------------------------------------------- ------------- |
- * -----------------------------------------------------------------------------
- * - * @version 2.0 - * @since 2.0 - */ -public abstract class PackageChooserPane extends ChooserPane -{ - /** - * The code completion manager. - */ - private JavaPackageCompletionProcessor javaPackageCompletionProcessor; - - private PropertyChangeListener subjectChangeListener; - - /** - * Creates a new PackageChooserPane. - * - * @param parentPane The parent pane of this one - * @param parent The parent container - */ - public PackageChooserPane(Pane parentPane, - Composite parent) { - - super(parentPane, parent); - } - - /** - * Creates a new PackageChooserPane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - */ - public PackageChooserPane(Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent) { - - super(parentPane, subjectHolder, parent); - } - - @Override - protected void initialize() { - super.initialize(); - - // TODO bug 156185 - when this is fixed there should be api for this - this.javaPackageCompletionProcessor = new JavaPackageCompletionProcessor( - new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_ROOT) - ); - this.subjectChangeListener = this.buildSubjectChangeListener(); - this.getSubjectHolder().addPropertyChangeListener(PropertyValueModel.VALUE, this.subjectChangeListener); - this.packageChooserSubjectChanged(getSubject()); - } - - private PropertyChangeListener buildSubjectChangeListener() { - return new SWTPropertyChangeListenerWrapper(this.buildSubjectChangeListener_()); - } - - private PropertyChangeListener buildSubjectChangeListener_() { - return new PropertyChangeListener() { - @SuppressWarnings("unchecked") - public void propertyChanged(PropertyChangeEvent e) { - PackageChooserPane.this.packageChooserSubjectChanged((T) e.getNewValue()); - } - }; - } - - protected void packageChooserSubjectChanged(T newSubject) { - IPackageFragmentRoot root = null; - if (newSubject != null) { - root = getPackageFragmentRoot(); - } - this.javaPackageCompletionProcessor.setPackageFragmentRoot(root); - } - - @Override - protected final Runnable buildBrowseAction() { - return new Runnable() { - public void run() { - promptPackage(); - } - }; - } - - @Override - protected Control addMainControl(Composite container) { - Composite subPane = addSubPane(container); - - Text text = addText(subPane, buildTextHolder()); - - Image image = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_CONTENT_PROPOSAL).getImage(); - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalIndent = image.getBounds().width; - text.setLayoutData(data); - - ControlContentAssistHelper.createTextContentAssistant( - text, - javaPackageCompletionProcessor - ); - - return subPane; - } - - /** - * Creates the value holder of the subject's property. - * - * @return The holder of the package name - */ - protected abstract WritablePropertyValueModel buildTextHolder(); - - /** - * Prompts the user the Open Package dialog. - * - * @return Either the selected package or null if the user - * cancelled the dialog - */ - protected IPackageFragment choosePackage() { - - SelectionDialog selectionDialog; - - try { - selectionDialog = JavaUI.createPackageDialog( - getShell(), - getPackageFragmentRoot() - ); - } - catch (JavaModelException e) { - JptCommonUiPlugin.log(e); - return null; - } - - selectionDialog.setTitle(JptCommonUiMessages.PackageChooserPane_dialogTitle); - selectionDialog.setMessage(JptCommonUiMessages.PackageChooserPane_dialogMessage); - - IPackageFragment pack = getPackageFragment(); - - if (pack != null) { - selectionDialog.setInitialSelections(new Object[] { pack }); - } - - if (selectionDialog.open() == Window.OK) { - return (IPackageFragment) selectionDialog.getResult()[0]; - } - - return null; - } - - protected abstract IJavaProject getJavaProject(); - - /** - * Returns the package name from its subject. - * - * @return The package name or null if none is defined - */ - protected abstract String getPackageName(); - - /** - * The browse button was clicked, its action invokes this action which should - * prompt the user to select a package and set it. - */ - protected void promptPackage() { - IPackageFragment packageFragment = choosePackage(); - - if (packageFragment != null) { - String packageName = packageFragment.getElementName(); - this.setPackageName(packageName); - } - } - - protected abstract void setPackageName(String packageName); - - private IPackageFragment getPackageFragment() { - String packageName = getPackageName(); - - if (packageName == null) { - return null; - } - - return getPackageFragmentRoot().getPackageFragment(packageName); - } - - protected IPackageFragmentRoot getPackageFragmentRoot() { - return JDTTools.getCodeCompletionContextRoot(getJavaProject()); - } - - @Override - public void dispose() { - this.getSubjectHolder().removePropertyChangeListener(PropertyValueModel.VALUE, this.subjectChangeListener); - super.dispose(); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Pane.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Pane.java deleted file mode 100644 index e1c0863359..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/Pane.java +++ /dev/null @@ -1,3722 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import java.util.ArrayList; -import java.util.Collection; -import org.eclipse.core.runtime.Assert; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.fieldassist.FieldDecorationRegistry; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.IBaseLabelProvider; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jpt.common.ui.WidgetFactory; -import org.eclipse.jpt.common.ui.internal.Tracing; -import org.eclipse.jpt.common.ui.internal.listeners.SWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.ui.internal.swt.ComboModelAdapter; -import org.eclipse.jpt.common.ui.internal.swt.DateTimeModelAdapter; -import org.eclipse.jpt.common.ui.internal.swt.SpinnerModelAdapter; -import org.eclipse.jpt.common.ui.internal.swt.TriStateCheckBoxModelAdapter; -import org.eclipse.jpt.common.ui.internal.util.ControlAligner; -import org.eclipse.jpt.common.ui.internal.util.LabeledButton; -import org.eclipse.jpt.common.ui.internal.util.LabeledControlUpdater; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools; -import org.eclipse.jpt.common.utility.internal.NonNullBooleanTransformer; -import org.eclipse.jpt.common.utility.internal.StringConverter; -import org.eclipse.jpt.common.utility.internal.model.value.CompositeBooleanPropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.TransformationPropertyValueModel; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.ModifyListener; -import org.eclipse.swt.events.MouseAdapter; -import org.eclipse.swt.events.MouseEvent; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.events.SelectionListener; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -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.DateTime; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Layout; -import org.eclipse.swt.widgets.List; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Spinner; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.forms.widgets.ExpandableComposite; -import org.eclipse.ui.forms.widgets.FormText; -import org.eclipse.ui.forms.widgets.Hyperlink; -import org.eclipse.ui.forms.widgets.Section; -import org.eclipse.ui.help.IWorkbenchHelpSystem; -import org.eclipse.ui.part.PageBook; - -/** - * The abstract definition of a pane which holds onto a PropertyValueModel - * that contains the subject of this pane. - *

- * It also contains convenience methods for building buttons, labels, check - * boxes, and radio buttons, etc. - *

- * It is possible to easily listen to any property changes coming from the - * subject, {@link #addPropertyNames(Collection)} is specify which properties - * are of interest and {@link #propertyChanged(String)} is used to notify the - * pane when the property has changed. - * - * @see FormPane - * @see DialogPane - * - * @version 2.0 - * @since 2.0 - */ -@SuppressWarnings("nls") -public abstract class Pane -{ - /** - * The listener registered with the subject in order to be notified when a - * property has changed, the property names are determined by - * {@link #propertyNames()}. - */ - private PropertyChangeListener aspectChangeListener; - - /** - * The container of this composite. - */ - private final Composite container; - - /** - * The aligner responsible to align the left controls. - */ - private ControlAligner leftControlAligner; - - /** - * Flag used to stop the circular population of widgets. - */ - private boolean populating; - - /** - * The aligner responsible to align the left controls. - */ - private ControlAligner rightControlAligner; - - /** - * This listener is registered with the subject holder in order to - * automatically repopulate this pane with the new subject. - */ - private PropertyChangeListener subjectChangeListener; - - /** - * The subject of this pane. - */ - private PropertyValueModel subjectHolder; - - /** - * The collection of registered sub-panes will be automatically notified - * when listeners need to be engaged or disengaged or when to populate its - * widgets. - */ - private Collection> subPanes; - - /** - * The factory used to create various common widgets. - */ - private WidgetFactory widgetFactory; - - /** - * The collection of Controls that are displayed in this pane, - * which will have their enablement state updated when - * {@link #enableWidgets(boolean)} is called. - */ - private ArrayList managedWidgets; - - /** - * The collection of Panes that are displayed in this pane, - * which will have their enablement state updated when - * {@link #enableWidgets(boolean)} is called. - */ - private ArrayList> managedSubPanes; - - /** - * This enabled model is used to store the pane's base enablement state. - * If API is called to set the pane enabled, this model gets updated. If the pane is thereby - * fully enabled (controller enabled model is also in agreement) the pane's widgets are set - * enabled. - * @see #getCombinedEnabledModel() - */ - private final WritablePropertyValueModel baseEnabledModel - = new SimplePropertyValueModel(Boolean.TRUE); - - /** - * This enabled model is used to define the pane's enablement as controlled by other widgets, - * tests, etc. (for example a radio button) - * If this model is changed, and the pane is thereby fully enabled (base enabled model is also - * in agreement) the pane's widgets are set enabled. - * @see #getCombinedEnabledModel() - */ - private PropertyValueModel controllerEnabledModel; - - /** - * The "and" combination of {@link #baseEnabledModel} and {@link #controllerEnabledModel} - */ - private PropertyValueModel combinedEnabledModel; - - private PropertyChangeListener combinedEnabledModelListener; - - /** - * Creates a new Pane. - * - * @param parentPane The parent pane of this one - * @param parent The parent container - * - * @category Constructor - */ - protected Pane( - Pane parentPane, - Composite parent) { - - this(parentPane, parent, true); - } - - /** - * Creates a new Pane. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param widgetFactory The factory used to create various widgets - * @param automaticallyAlignWidgets true to make the widgets - * this pane aligned with the widgets of the given parent pane; - * false to not align them - * - * @category Constructor - */ - protected Pane( - Pane parentPane, - Composite parent, - boolean automaticallyAlignWidgets) { - - this( - parentPane, - parentPane.getSubjectHolder(), - parent, - automaticallyAlignWidgets); - } - - /** - * Creates a new Pane. - * - * @param parentPane The parent container of this one - * @param parent The parent container - * @param widgetFactory The factory used to create various widgets - * @param automaticallyAlignWidgets true to make the widgets - * this pane aligned with the widgets of the given parent pane; - * false to not align them - * - * @category Constructor - */ - protected Pane( - Pane parentPane, - Composite parent, - boolean automaticallyAlignWidgets, - boolean parentManagePane) { - - this( - parentPane, - parentPane.getSubjectHolder(), - parent, - automaticallyAlignWidgets, - parentManagePane); - } - - /** - * Creates a new Pane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - * - * @category Constructor - */ - protected Pane( - Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent) { - - this(parentPane, subjectHolder, parent, true); - } - - protected Pane( - Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent, - PropertyValueModel enabledModel) { - - this(parentPane, subjectHolder, parent, true, enabledModel); - } - - /** - * Creates a new Pane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - * @param widgetFactory The factory used to create various widgets - * @param automaticallyAlignWidgets true to make the widgets - * this pane aligned with the widgets of the given parent pane; - * false to not align them - * - * @category Constructor - */ - protected Pane( - Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent, - boolean automaticallyAlignWidgets) { - - this(parentPane, subjectHolder, parent, automaticallyAlignWidgets, true); - } - - protected Pane( - Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent, - boolean automaticallyAlignWidgets, - PropertyValueModel enabledModel) { - - this(parentPane, subjectHolder, parent, automaticallyAlignWidgets, true, enabledModel); - } - - /** - * Creates a new Pane. - * - * @param parentPane The parent container of this one - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - * @param widgetFactory The factory used to create various widgets - * @param automaticallyAlignWidgets true to make the widgets - * this pane aligned with the widgets of the given parent pane; - * false to not align them - * @param parentManagePane true to have the parent pane manage - * the enabled state of this pane - * - * @category Constructor - */ - protected Pane( - Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent, - boolean automaticallyAlignWidgets, - boolean parentManagePane) { - - this(subjectHolder, parent, parentPane.getWidgetFactory()); - this.initialize(parentPane, automaticallyAlignWidgets, parentManagePane); - } - - protected Pane( - Pane parentPane, - PropertyValueModel subjectHolder, - Composite parent, - boolean automaticallyAlignWidgets, - boolean parentManagePane, - PropertyValueModel enabledModel) { - - this(subjectHolder, parent, parentPane.getWidgetFactory()); - this.initialize(parentPane, automaticallyAlignWidgets, parentManagePane); - this.initializeEnabledModel(enabledModel); - } - - /** - * Creates a new Pane. - * - * @param subjectHolder The holder of this pane's subject - * @param parent The parent container - * @param widgetFactory The factory used to create various common widgets - * - * @category Constructor - */ - protected Pane( - PropertyValueModel subjectHolder, - Composite parent, - WidgetFactory widgetFactory) { - - super(); - this.initialize(subjectHolder, widgetFactory); - this.container = this.addContainer(parent); - this.initializeLayout(this.container); - this.engageSubjectHolder(); - this.engageListeners(getSubject()); - this.populate(); - } - - - // ********** initialization ********** - - @SuppressWarnings("unchecked") - private void initialize( - PropertyValueModel subjectHolder, - WidgetFactory widgetFactory) { - - Assert.isNotNull(subjectHolder, "The subject holder cannot be null"); - - this.subjectHolder = (PropertyValueModel) subjectHolder; - this.widgetFactory = widgetFactory; - this.subPanes = new ArrayList>(); - this.managedWidgets = new ArrayList(); - this.managedSubPanes = new ArrayList>(); - this.leftControlAligner = new ControlAligner(); - this.rightControlAligner = new ControlAligner(); - this.subjectChangeListener = this.buildSubjectChangeListener(); - this.aspectChangeListener = this.buildAspectChangeListener(); - - this.initialize(); - } - - protected void initialize() { - // do nothing by default - } - - /** - * Registers this pane with the parent pane. - * - * @param parentPane The parent pane - * @param automaticallyAlignWidgets true to make the widgets - * this pane aligned with the widgets of the given parent pane; - * false to not align them - * @param parentManagePane true to have the parent pane manage - * the enabled state of this pane - * - * @category Initialization - */ - private void initialize( - Pane parentPane, - boolean automaticallyAlignWidgets, - boolean parentManagePane) { - - // Register this pane with the parent pane, it will call the methods - // automatically (engageListeners(), disengageListeners(), populate(), - // dispose(), etc) - parentPane.registerSubPane(this); - - if (parentManagePane) { - parentPane.manageSubPane(this); - } - - // Align the left and right controls with the controls from the parent - // pane - if (automaticallyAlignWidgets) { - parentPane.addAlignLeft(this); - parentPane.addAlignRight(this); - } - } - - private void initializeEnabledModel(PropertyValueModel enabledModel) { - this.controllerEnabledModel = enabledModel; - this.combinedEnabledModel = - CompositeBooleanPropertyValueModel.and(this.baseEnabledModel, this.controllerEnabledModel); - this.combinedEnabledModelListener = buildCombinedEnabledModelListener(); - this.combinedEnabledModel.addPropertyChangeListener( - PropertyValueModel.VALUE, this.combinedEnabledModelListener); - enableWidgets_(getCombinedEnablement()); - } - - private PropertyChangeListener buildCombinedEnabledModelListener() { - return new SWTPropertyChangeListenerWrapper(buildControllerEnabledModelListener_()); - } - - private PropertyChangeListener buildControllerEnabledModelListener_() { - return new PropertyChangeListener() { - @SuppressWarnings("unchecked") - public void propertyChanged(PropertyChangeEvent e) { - Pane.this.controllerEnablementChanged(); - } - }; - } - - /** - * Initializes the layout of this pane. - * - * @param container The parent container - * - * @category Layout - */ - protected abstract void initializeLayout(Composite container); - - private void manageWidget(Control control) { - if (this.managedWidgets.contains(control)) { - throw new IllegalStateException(); - } - this.managedWidgets.add(control); - } - - private void manageSubPane(Pane subPane) { - if (this.managedSubPanes.contains(subPane)) { - throw new IllegalStateException(); - } - this.managedSubPanes.add(subPane); - } - - /** - * Adds the given pane's widgets (those that were registered with its - * left ControlAligner) to this pane's left - * ControlAligner so that their width can be adjusted to have - * the width of the widest widget. - * - * @param pane The pane containing the widgets to add - * - * @category Layout - */ - protected final void addAlignLeft(Pane container) { - this.leftControlAligner.add(container.leftControlAligner); - } - - /** - * Adds the given control to the collection of widgets that have their width - * adjust with the width of the widest widget. The left alignment is usually - * used for labels. - * - * @param pane The pane to add - * - * @category Layout - */ - protected final void addAlignLeft(Control control) { - this.leftControlAligner.add(control); - } - - /** - * Adds the given pane's widgets (those that were registered with its - * right ControlAligner) to this pane's right - * ControlAligner so that their width can be adjusted to have - * the width of the widest widget. - * - * @param pane The pane containing the widgets to add - * - * @category Layout - */ - protected final void addAlignRight(Pane container) { - this.rightControlAligner.add(container.rightControlAligner); - } - - /** - * Adds the given control to the collection of widgets that have their width - * adjust with the width of the widest widget. The left alignment is usually - * used for buttons. - * - * @param pane The pane to add - * - * @category Layout - */ - protected final void addAlignRight(Control control) { - this.rightControlAligner.add(control); - } - - /** - * Adds the given pane's controls (those that were registered for - * alignment) from this pane. - * - * @param pane The pane containing the widgets to add for - * alignment - * - * @category Layout - */ - protected final void addPaneForAlignment(Pane container) { - addAlignLeft(container); - addAlignRight(container); - } - - /** - * Adds any property names to the given collection in order to be notified - * when the actual property changes in the subject. - * - * @param propertyNames The collection of property names to register with the - * subject - */ - protected void addPropertyNames(Collection propertyNames) { - } - - private PropertyChangeListener buildAspectChangeListener() { - return new SWTPropertyChangeListenerWrapper(buildAspectChangeListener_()); - } - - private PropertyChangeListener buildAspectChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - //subject() could have changed or is null because of the possibility of - //"jumping" on the UI thread here and a selection change occuring - if (e.getSource() == getSubject()) { - updatePane(e.getPropertyName()); - } - } - }; - } - - /** - * Creates a new button using the given information. - * - * @param parent The parent container - * @param buttonText The button's text - * @param buttonAction The action to be invoked when the button is pressed - * @return The newly created Button - * - * @category Layout - */ - protected final Button addButton(Composite container, - String text, - final Runnable buttonAction) { - - return this.addButton(container, text, null, buttonAction); - } - - /** - * Creates a new unmanaged Button widget. Unmanaged means - * that this Pane will not handle the enabling/disabling of this widget. - * The owning object will handle it with its own PaneEnabler or ControlEnabler. - * - * @param parent The parent container - * @param buttonText The button's text - * @param buttonAction The action to be invoked when the button is pressed - * @return The newly created Button - * - * @category Layout - */ - protected final Button addUnmanagedButton(Composite container, - String text, - final Runnable buttonAction) { - - return this.addUnmanagedButton(container, text, null, buttonAction); - } - - /** - * Creates a new button using the given information. - * - * @param parent The parent container - * @param buttonText The button's text - * @param helpId The topic help ID to be registered for the new check box - * @param buttonAction The action to be invoked when the button is pressed - * @return The newly created Button - * - * @category Layout - */ - protected final Button addButton(Composite container, - String text, - String helpId, - final Runnable buttonAction) { - - Button button = addUnmanagedButton(container, text, helpId, buttonAction); - this.manageWidget(button); - - return button; - } - - /** - * Creates a new unmanaged Button widget. Unmanaged means - * that this Pane will not handle the enabling/disabling of this widget. - * The owning object will handle it with its own PaneEnabler or ControlEnabler. - * - * @param parent The parent container - * @param buttonText The button's text - * @param helpId The topic help ID to be registered for the new check box - * @param buttonAction The action to be invoked when the button is pressed - * @return The newly created Button - * - * @category Layout - */ - private Button addUnmanagedButton(Composite container, - String text, - String helpId, - final Runnable buttonAction) { - - Button button = this.widgetFactory.createButton(container, text); - button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - SWTUtil.asyncExec(buttonAction); - } - }); - - if (helpId != null) { - getHelpSystem().setHelp(button, helpId); - } - - GridData gridData = new GridData(); - gridData.grabExcessHorizontalSpace = false; - gridData.horizontalAlignment = GridData.FILL; - button.setLayoutData(gridData); - - return button; - } - - /** - * This layout will leave space for decorations on widgets. - * Whether decorated or not, all of the widgets need the same indent - * so that they align properly. - */ - protected GridData getFieldGridData() { - int margin = FieldDecorationRegistry.getDefault() - .getMaximumDecorationWidth(); - GridData data = new GridData(); - data.horizontalAlignment = SWT.FILL; - data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH + margin; - data.horizontalIndent = margin; - data.grabExcessHorizontalSpace = true; - return data; - } - - /** - * Creates a new check box using the given information. - * - * @param parent The parent container - * @param buttonText The button's text - * @param booleanHolder The holder of the selection state - * @param helpId The topic help ID to be registered for the new check box - * @return The newly created Button - * - * @category Layout - */ - protected final Button addCheckBox( - Composite parent, - String buttonText, - WritablePropertyValueModel booleanHolder, - String helpId) { - - return this.addToggleButton( - parent, - buttonText, - booleanHolder, - helpId, - SWT.CHECK); - } - - protected final Button addCheckBox( - Composite parent, - String buttonText, - WritablePropertyValueModel booleanHolder, - String helpId, - PropertyValueModel enabledModel) { - - Button button = this.addUnmanagedToggleButton(parent, buttonText, booleanHolder, helpId, SWT.CHECK); - this.controlEnabledState(enabledModel, button); - return button; - } - - /** - * Creates a new Section that can be collapsed. A sub-pane is - * automatically added as its client and is the returned Composite. - * - * @param container The container of the new widget - * @param sectionText The text of the new section - * @return The Section's sub-pane - * - * @category Layout - */ - protected final Composite addCollapsibleSection( - Composite container, - String sectionText) { - - return this.addCollapsibleSection( - container, - sectionText, - new SimplePropertyValueModel(Boolean.FALSE)); - } - - /** - * Creates a new Section that can be collapsed. A sub-pane is - * automatically added as its client and is the returned Composite. - * - * @param container The container of the new widget - * @param sectionText The text of the new section - * @param description The section's description or null if none - * @return The Section's sub-pane - * - * @category Layout - */ - protected final Composite addCollapsibleSection(Composite container, - String sectionText, - String description) { - - return this.addCollapsibleSection( - container, - sectionText, - description, - new SimplePropertyValueModel(Boolean.FALSE) - ); - } - - /** - * Creates a new Section. A sub-pane is automatically added as - * its client and is the returned Composite. - * - * @param container The container of the new widget - * @param sectionText The text of the new section - * @param type The type of section to create - * @param expandedStateHolder The holder of the boolean that will dictate - * when to expand or collapse the section - * @return The Section's sub-pane - * - * @category Layout - */ - private Composite addCollapsibleSection(Composite container, - String sectionText, - int type, - PropertyValueModel expandedStateHolder) { - - return addCollapsibleSection(container, sectionText, null, type, expandedStateHolder); - } - - /** - * Creates a new Section. A sub-pane is automatically added as - * its client and is the returned Composite. - * - * @param container The container of the new widget - * @param sectionText The text of the new section - * @param description The section's description or null if none - * was provided - * @param type The type of section to create - * @param expandedStateHolder The holder of the boolean that will dictate - * when to expand or collapse the section - * @return The Section's sub-pane - * - * @category Layout - */ - private Composite addCollapsibleSection(Composite container, - String sectionText, - String description, - int type, - PropertyValueModel expandedStateHolder) { - - Composite subPane = this.addSection( - container, - sectionText, - description, - ExpandableComposite.TWISTIE | type - ); - - Section section = (Section) subPane.getParent(); - - expandedStateHolder.addPropertyChangeListener( - PropertyValueModel.VALUE, - buildExpandedStateChangeListener(section) - ); - - section.setExpanded( - expandedStateHolder.getValue() != null ? expandedStateHolder.getValue() : true - ); - - return subPane; - } - - /** - * Creates a new Section. A sub-pane is automatically added as - * its client and is the returned Composite. - * - * @param container The container of the new widget - * @param sectionText The text of the new section - * @param expandedStateHolder The holder of the boolean that will dictate - * when to expand or collapse the section - * @return The Section's sub-pane - * - * @category Layout - */ - protected final Composite addCollapsibleSection(Composite container, - String sectionText, - PropertyValueModel expandedStateHolder) { - - return this.addCollapsibleSection( - container, - sectionText, - ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE, - expandedStateHolder - ); - } - - /** - * Creates a new Section. A sub-pane is automatically added as - * its client and is the returned Composite. - * - * @param container The container of the new widget - * @param sectionText The text of the new section - * @param description The section's description or null if none - * @param expandedStateHolder The holder of the boolean that will dictate - * when to expand or collapse the section - * @return The Section's sub-pane - * - * @category Layout - */ - protected final Composite addCollapsibleSection(Composite container, - String sectionText, - String description, - PropertyValueModel expandedStateHolder) { - - return this.addCollapsibleSection( - container, - sectionText, - description, - ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE, - expandedStateHolder - ); - } - - /** - * Creates a new Section. A sub-pane is automatically added as - * its client which can be typed cast directly as a Composite. - * - * @param container The container of the new widget - * @param sectionText The text of the new section - * @param expandedStateHolder The holder of the boolean that will dictate - * when to expand or collapse the section - * @return The Section's sub-pane - * - * @category Layout - */ - protected final Composite addCollapsibleSubSection(Composite container, - String sectionText, - PropertyValueModel expandedStateHolder) { - - return this.addCollapsibleSection( - container, - sectionText, - SWT.NULL, - expandedStateHolder - ); - } - - /** - * Creates a new non-editable Combo. - * - * @param container The parent container - * @return The newly created Combo - * - * @category Layout - */ - protected final Combo addCombo(Composite container) { - Combo combo = this.addUnmanagedCombo(container); - this.manageWidget(combo); - return combo; - } - - /** - * Creates a new non-editable Combo. - * - * @param container The parent container - * @return The newly created Combo - * - * @category Layout - */ - private Combo addUnmanagedCombo(Composite container) { - Combo combo = this.widgetFactory.createCombo(container); - combo.setLayoutData(getFieldGridData()); - return combo; - } - - /** - * Creates a new non-editable Combo. - * - * @param container The parent container - * @param listHolder The ListValueHolder - * @param selectedItemHolder The holder of the selected item - * @param stringConverter The converter responsible to transform each item - * into a string representation - * @return The newly created Combo - * - * @category Layout - */ - protected final Combo addCombo(Composite container, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - StringConverter stringConverter) { - - Combo combo = this.addCombo(container); - - ComboModelAdapter.adapt( - listHolder, - selectedItemHolder, - combo, - stringConverter - ); - - return combo; - } - - /** - * Creates a new non-editable Combo. - * - * @param container The parent container - * @param listHolder The ListValueHolder - * @param selectedItemHolder The holder of the selected item - * @param stringConverter The converter responsible to transform each item - * into a string representation - * @return The newly created Combo - * - * @category Layout - */ - private Combo addUnmanagedCombo(Composite container, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - StringConverter stringConverter) { - - Combo combo = this.addUnmanagedCombo(container); - - ComboModelAdapter.adapt( - listHolder, - selectedItemHolder, - combo, - stringConverter - ); - - return combo; - } - - protected final Combo addCombo( - Composite container, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - StringConverter stringConverter, - PropertyValueModel enabledModel) { - - Combo combo = this.addUnmanagedCombo(container, listHolder, selectedItemHolder, stringConverter); - this.controlEnabledState(enabledModel, combo); - return combo; - } - - /** - * Creates a new ComboViewer using a Combo. - * - * @param container The parent container - * @param labelProvider The provider responsible to convert the combo's items - * into human readable strings - * @return The newly created ComboViewer - * - * @category Layout - */ - protected final ComboViewer addComboViewer(Composite container, - IBaseLabelProvider labelProvider) { - - Combo combo = this.addCombo(container); - ComboViewer viewer = new ComboViewer(combo); - viewer.setLabelProvider(labelProvider); - return viewer; - } - - /** - * Creates the main container of this pane. The layout and layout data are - * automatically set. - * - * @param parent The parent container - * @return The newly created Composite that will holds all the - * widgets created by this pane through {@link #initializeLayout(Composite)} - * - * @category Layout - */ - protected Composite addContainer(Composite parent) { - return this.addSubPane(parent); - } - - protected final Combo addEditableCombo( - Composite container, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - StringConverter stringConverter, - PropertyValueModel enabledModel) { - - Combo combo = this.addUnmanagedEditableCombo(container, listHolder, selectedItemHolder, stringConverter); - this.controlEnabledState(enabledModel, combo); - return combo; - } - - protected final Combo addEditableCombo( - Composite container) { - - Combo combo = this.widgetFactory.createEditableCombo(container); - combo.setLayoutData(getFieldGridData()); - this.manageWidget(combo); - return combo; - } - - /** - * Creates a new editable Combo. - * - * @param container The parent container - * @param listHolder The ListValueHolder - * @param selectedItemHolder The holder of the selected item - * @param stringConverter The converter responsible to transform each item - * into a string representation - * @return The newly created Combo - * - * @category Layout - */ - protected final Combo addEditableCombo(Composite container, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - StringConverter stringConverter) { - - Combo combo = this.addEditableCombo(container); - - ComboModelAdapter.adapt( - listHolder, - selectedItemHolder, - combo, - stringConverter - ); - - return combo; - } - - /** - * Creates a new editable ComboViewer using a Combo. - * - * @param container The parent container - * @param labelProvider The provider responsible to convert the combo's items - * into human readable strings - * @return The newly created ComboViewer - * - * @category Layout - */ - protected final ComboViewer addEditableComboViewer(Composite container, - IBaseLabelProvider labelProvider) { - - Combo combo = this.addEditableCombo(container); - ComboViewer viewer = new ComboViewer(combo); - viewer.setLabelProvider(labelProvider); - return viewer; - } - - private PropertyChangeListener buildExpandedStateChangeListener(final Section section) { - return new SWTPropertyChangeListenerWrapper(buildExpandedStateChangeListener_(section)); - } - - private PropertyChangeListener buildExpandedStateChangeListener_(final Section section) { - return new PropertyChangeListener() { - public void propertyChanged(final PropertyChangeEvent e) { - Boolean value = (Boolean) e.getNewValue(); - if (value == null) { - value = Boolean.TRUE; - } - section.setExpanded(value); - } - }; - } - - /** - * Creates a new Hyperlink that will invoked the given - * Runnable when selected. The given action is always invoked - * from the UI thread. - * - * @param parent The parent container - * @param text The hyperlink's text - * @param hyperLinkAction The action to be invoked when the link was selected - * return The newly created Hyperlink - * - * @category Layout - */ - protected final Hyperlink addHyperlink(Composite parent, - String text, - final Runnable hyperLinkAction) { - - Hyperlink link = this.widgetFactory.createHyperlink(parent, text); - this.manageWidget(link); - - link.addMouseListener(new MouseAdapter() { - @Override - public void mouseUp(MouseEvent e) { - - Hyperlink hyperLink = (Hyperlink) e.widget; - - if (hyperLink.isEnabled()) { - SWTUtil.asyncExec(hyperLinkAction); - } - } - }); - - return link; - } - - /** - * Creates a new label using the given information. - * - * @param parent The parent container - * @param labelText The label's text - * - * @category Layout - */ - protected final Label addLabel(Composite container, - String labelText) { - - Label label = addUnmanagedLabel(container, labelText); - manageWidget(label); - return label; - } - - protected final Label addLabel( - Composite container, - String labelText, - PropertyValueModel enabledModel - ) { - Label label = this.addUnmanagedLabel(container, labelText); - this.controlEnabledState(enabledModel, label); - return label; - } - - /** - * Creates a new unmanaged Label widget. Unmanaged means - * that this Pane will not handle the enabling/disabling of this widget. - * The owning object will handle it with its own PaneEnabler or ControlEnabler. - * - * @param parent The parent container - * @param labelText The label's text - * - * @category Layout - */ - private Label addUnmanagedLabel(Composite container, - String labelText) { - - return this.widgetFactory.createLabel(container, labelText); - } - - /** - * Creates a new container that will have a non-editable combo labeled with - * the given text. - * - * @param container The parent container - * @param labelText The text of the label - * @param listHolder The ListValueHolder - * @param selectedItemHolder The holder of the selected item - * @param rightControl The control shown to the right of the main widget - * @param helpId The topic help ID to be registered for the given center - * compositer - * @return The container of the label and the given center control - * - * @category Layout - */ - protected final Combo addLabeledCombo(Composite container, - String labelText, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - StringConverter stringConverter, - Control rightControl, - String helpId) { - - Combo combo = this.addCombo( - container, - listHolder, - selectedItemHolder, - stringConverter - ); - - this.addLabeledComposite( - container, - labelText, - (combo.getParent() != container) ? combo.getParent() : combo, - rightControl, - helpId - ); - - return combo; - } - - /** - * Creates a new container that will have a non-editable combo labeled with - * the given text. - * - * @param container The parent container - * @param labelText The text of the label - * @param listHolder The ListValueHolder - * @param selectedItemHolder The holder of the selected item - * @param helpId The topic help ID to be registered for the given center - * compositer - * @return The container of the label and the given center control - * - * @category Layout - */ - protected final Combo addLabeledCombo(Composite container, - String labelText, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - StringConverter stringConverter, - String helpId) { - - return this.addLabeledCombo( - container, - labelText, - listHolder, - selectedItemHolder, - stringConverter, - null, - helpId - ); - } - - /** - * Creates a new container that will have the given center control labeled - * with the given label. - * - * @param container The parent container - * @param leftControl The widget shown to the left of the main widget - * @param centerControl The main widget - * @param rightControl The control shown to the right of the main widget - * @param helpId The topic help ID to be registered for the given center - * compositer - * @return The container of the label and the given center control - * - * @category Layout - */ - protected final Composite addLabeledComposite(Composite container, - Control leftControl, - Control centerControl, - Control rightControl, - String helpId) { - - // Container for the label and main composite - container = this.addSubPane(container, 3, 0, 0, 0, 0); - - // Left control - GridData gridData = new GridData(); - gridData.horizontalAlignment = GridData.BEGINNING; - gridData.grabExcessHorizontalSpace = false; - leftControl.setLayoutData(gridData); - - // Re-parent the left control to the new sub pane - leftControl.setParent(container); - this.addAlignLeft(leftControl); - - - // Re-parent the center control to the new sub pane - centerControl.setParent(container); - - // Register the help id for the center control - if (helpId != null) { - getHelpSystem().setHelp(centerControl, helpId); - } - - // Right control - if (rightControl == null) { - Composite spacer = this.addPane(container); - spacer.setLayout(this.buildSpacerLayout()); - rightControl = spacer; - } - else { - rightControl.setParent(container); - - // Register the help id for the right control - if (helpId != null) { - getHelpSystem().setHelp(rightControl, helpId); - } - } - - gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL_HORIZONTAL; - gridData.grabExcessHorizontalSpace = false; - - rightControl.setLayoutData(gridData); - this.addAlignRight(rightControl); - - return container; - } - - /** - * Creates a new container that will have the given center control labeled - * with the given label. - * - * @param container The parent container - * @param label The label used to describe the center control - * @param centerControl The main widget - * @param helpId The topic help ID to be registered for the given center - * control - * @return The container of the label and the given center control - * - * @category Layout - */ - protected final Composite addLabeledComposite(Composite container, - Control label, - Control centerControl, - String helpId) { - - return this.addLabeledComposite( - container, - label, - centerControl, - null, - helpId - ); - } - - /** - * Creates a new container that will have the given center composite labeled - * with the given label text. - * - * @param container The parent container - * @param labelText The text to label the main composite - * @param centerPane The main widget - * @param helpId The topic help ID to be registered for the given center - * compositer - * @return The container of the label and the given center control - * - * @category Layout - */ - protected final Composite addLabeledComposite(Composite container, - String labelText, - Pane centerPane, - String helpId) { - - return this.addLabeledComposite( - container, - labelText, - centerPane.getControl(), - helpId - ); - } - - /** - * Creates a new container that will have the given center composite labeled - * with the given label text. - * - * @param container The parent container - * @param labelText The text to label the main composite - * @param centerControl The main widget - * @return The container of the label and the given center control - * - * @category Layout - */ - protected final Composite addLabeledComposite(Composite container, - String labelText, - Control centerControl) { - - - return this.addLabeledComposite( - container, - labelText, - centerControl, - null, - null - ); - } - - /** - * Creates a new container that will have the given center composite labeled - * with the given label text. - * - * @param container The parent container - * @param labelText The text to label the main composite - * @param centerControl The main widget - * @param rightControl The control shown to the right of the main widget - * @param helpId The topic help ID to be registered for the given center - * compositer - * @return The container of the label and the given center control - * - * @category Layout - */ - protected final Composite addLabeledComposite(Composite container, - String labelText, - Control centerControl, - Control rightControl, - String helpId) { - - return this.addLabeledComposite( - container, - this.addLabel(container, labelText), - centerControl, - rightControl, - helpId - ); - } - - /** - * Creates a new container that will have the given center composite labeled - * with the given label text. - * - * @param container The parent container - * @param labelText The text to label the main composite - * @param centerControl The main widget - * @param helpId The topic help ID to be registered for the given center - * compositer - * @return The container of the label and the given center control - * - * @category Layout - */ - protected final Composite addLabeledComposite(Composite container, - String labelText, - Control centerControl, - String helpId) { - - Label label = this.addLabel(container, labelText); - - return this.addLabeledComposite( - container, - label, - centerControl, - helpId - ); - } - - /** - * Creates a new container that will have the given center control labeled - * with the given label. - * - * @param container The parent container - * @param leftControl The widget shown to the left of the main widget - * @param centerControl The main widget - * @param rightControl The control shown to the right of the main widget - * @param helpId The topic help ID to be registered for the given center - * compositer - * @return The newly created CCombo - * - * @category Layout - */ - protected final Combo addLabeledEditableCombo(Composite container, - String labelText, - ModifyListener comboListener, - Control rightControl, - String helpId) { - - Combo combo = this.addEditableCombo(container); - combo.addModifyListener(comboListener); - - this.addLabeledComposite( - container, - labelText, - (combo.getParent() != container) ? combo.getParent() : combo, - rightControl, - helpId - ); - - return combo; - } - - /** - * Creates a new container that will have an editable combo labeled with the - * given text. - * - * @param container The parent container - * @param labelText The text of the label - * @param comboListener The listener that will be notified when the selection - * changes - * @param helpId The topic help ID to be registered for the given center - * compositer - * @return The newly created CCombo - * - * @category Layout - */ - protected final Combo addLabeledEditableCombo(Composite container, - String labelText, - ModifyListener comboListener, - String helpId) { - - return this.addLabeledEditableCombo( - container, - labelText, - comboListener, - null, - helpId - ); - } - - /** - * Creates a new container that will have the given center control labeled - * with the given label. - * - * @param container The parent container - * @param leftControl The widget shown to the left of the main widget - * @param centerControl The main widget - * @param labelProvider The provider responsible to convert the combo's items - * into human readable strings - * @param rightControl The control shown to the right of the main widget - * @param helpId The topic help ID to be registered for the given center - * compositer - * @return The newly created CCombo - * - * @category Layout - */ - protected final Combo addLabeledEditableComboViewer(Composite container, - String labelText, - ModifyListener comboListener, - ILabelProvider labelProvider, - Control rightControl, - String helpId) { - - ComboViewer comboViewer = this.addEditableComboViewer( - container, - labelProvider - ); - - Combo combo = comboViewer.getCombo(); - combo.addModifyListener(comboListener); - - this.addLabeledComposite( - container, - labelText, - (combo.getParent() != container) ? combo.getParent() : combo, - rightControl, - helpId - ); - - return combo; - } - - /** - * Creates a new container that will have an editable combo labeled with the - * given text. - * - * @param container The parent container - * @param labelText The text of the label - * @param comboListener The listener that will be notified when the selection - * changes - * @param labelProvider The provider responsible to convert the combo's items - * into human readable strings - * @param helpId The topic help ID to be registered for the given center - * compositer - * @return The newly created CCombo - * - * @category Layout - */ - protected final Combo addLabeledEditableComboViewer(Composite container, - String labelText, - ModifyListener comboListener, - ILabelProvider labelProvider, - String helpId) { - - return this.addLabeledEditableComboViewer( - container, - labelText, - comboListener, - labelProvider, - null, - helpId - ); - } - - /** - * Creates a new container that will have an editable combo labeled with the - * given text. - * - * @param container The parent container - * @param labelText The text of the label - * @param listHolder The ListValueHolder - * @param selectedItemHolder The holder of the selected item - * @param helpId The topic help ID to be registered for the given center - * composite - * @return The newly created CCombo - * - * @category Layout - */ - protected final Combo addLabeledEditableCombo(Composite container, - String labelText, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - String helpId) { - - return this.addLabeledEditableCombo( - container, - labelText, - listHolder, - selectedItemHolder, - StringConverter.Default.instance(), - null, - helpId - ); - } - - /** - * Creates a new container that will have the given center control labeled - * with the given label. - * - * @param container The parent container - * @param labelText The text of the label - * @param listHolder The ListValueHolder - * @param selectedItemHolder The holder of the selected item - * @param stringConverter The converter responsible to transform each item - * into a string representation - * @param rightControl The control shown to the right of the main widget - * @param helpId The topic help ID to be registered for the given center - * compositer - * @return The newly created Combo - * - * @category Layout - */ - protected final Combo addLabeledEditableCombo(Composite container, - String labelText, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - StringConverter stringConverter, - Control rightControl, - String helpId) { - - Combo combo = this.addEditableCombo( - container, - listHolder, - selectedItemHolder, - stringConverter - ); - - this.addLabeledComposite( - container, - labelText, - (combo.getParent() != container) ? combo.getParent() : combo, - rightControl, - helpId - ); - - return combo; - } - - /** - * Creates a new container that will have an editable combo labeled with the - * given text. - * - * @param container The parent container - * @param labelText The text of the label - * @param listHolder The ListValueHolder - * @param selectedItemHolder The holder of the selected item - * @param stringConverter The converter responsible to transform each item - * into a string representation - * @param helpId The topic help ID to be registered for the given center - * compositer - * @return The newly created Combo - * - * @category Layout - */ - protected final Combo addLabeledEditableCombo(Composite container, - String labelText, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - StringConverter stringConverter, - String helpId) { - - return this.addLabeledEditableCombo( - container, - labelText, - listHolder, - selectedItemHolder, - stringConverter, - null, - helpId - ); - } - - /** - * Creates a new container that will have a text field as the center control - * labeled with the given label. - * - * @param container The parent container - * @param labelText The text area's label - * @param textHolder The holder of the text field's input - * @param lineCount The number of lines the text area should display - * @param helpId The topic help ID to be registered for the text field - * @return The newly created Text - * - * @category Layout - */ - protected final Text addLabeledMultiLineText(Composite container, - String labelText, - WritablePropertyValueModel textHolder, - int lineCount, - String helpId) { - - Text text = this.addMultiLineText(container, textHolder, lineCount); - - container = this.addLabeledComposite( - container, - labelText, - text, - helpId - ); - - int textHeight = text.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; - - // Specify the number of lines the text area should display - GridData gridData = (GridData) text.getLayoutData(); - gridData.heightHint = text.getLineHeight() * lineCount; - - // Move the label to the top of its cell - Control label = container.getChildren()[0]; - int labelHeight = label.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; - - gridData = (GridData) label.getLayoutData(); - gridData.verticalAlignment = SWT.TOP; - gridData.verticalIndent += (Math.abs(textHeight - labelHeight) / 2); - - return text; - } - - /** - * Creates a new container that will have a text field as the center control - * labeled with the given label. - * - * @param container The parent container - * @param textHolder The holder of the text field's input - * @return The newly created Text - * - * @category Layout - */ - protected final Text addLabeledPasswordText(Composite container, - String labelText, - WritablePropertyValueModel textHolder) { - - return this.addLabeledPasswordText( - container, - labelText, - textHolder, - null - ); - } - - /** - * Creates a new container that will have a text field as the center control - * labeled with the given label. - * - * @param container The parent container - * @param labelText The text field's label - * @param rightComponent The component to be placed to the right of the text - * field - * @param textHolder The holder of the text field's input - * @param helpId The topic help ID to be registered for the text field - * @return The newly created Text - * - * @category Layout - */ - protected final Text addLabeledPasswordText(Composite container, - String labelText, - WritablePropertyValueModel textHolder, - Control rightControl, - String helpId) { - - Text text = this.addPasswordText(container, textHolder); - - this.addLabeledComposite( - container, - labelText, - text, - rightControl, - helpId - ); - - return text; - } - - /** - * Creates a new container that will have a text field as the center control - * labeled with the given label. - * - * @param container The parent container - * @param textHolder The holder of the text field's input - * @param helpId The topic help ID to be registered for the text field - * @return The newly created Text - * - * @category Layout - */ - protected final Text addLabeledPasswordText(Composite container, - String labelText, - WritablePropertyValueModel textHolder, - String helpId) { - - return this.addLabeledPasswordText( - container, - labelText, - textHolder, - null, - helpId - ); - } - - /** - * Creates a new spinner. - * - * @param parent The parent container - * @param labelText The label's text - * @param numberHolder The holder of the integer value - * @param defaultValue The value shown when the holder has null - * @param minimumValue The minimum value that the spinner will allow - * @param maximumValue The maximum value that the spinner will allow - * @param rightControl The widget to be placed to the right of spinner - * @param helpId The topic help ID to be registered for the spinner - * @return The newly created Spinner - * - * @category Layout - */ - protected final Spinner addLabeledSpinner(Composite parent, - String labelText, - WritablePropertyValueModel numberHolder, - int defaultValue, - int minimumValue, - int maximumValue, - Control rightControl, - String helpId) { - - Spinner spinner = this.addSpinner( - parent, - numberHolder, - defaultValue, - minimumValue, - maximumValue, - helpId - ); - Label label = addLabel(parent, labelText); - addLabeledComposite( - parent, - label, - (spinner.getParent() != parent) ? spinner.getParent() : spinner, - rightControl, - helpId - ); - - GridData gridData = (GridData) spinner.getLayoutData(); - gridData.horizontalAlignment = GridData.BEGINNING; - - return spinner; - } - - /** - * Creates a new managed spinner. Managed means that this Pane will - * handle enabling/disabling of this widget if a PaneEnabler is used. - * - * @param parent The parent container - * @param numberHolder The holder of the integer value - * @param defaultValue The value shown when the holder has null - * @param minimumValue The minimum value that the spinner will allow - * @param maximumValue The maximum value that the spinner will allow - * @param helpId The topic help ID to be registered for the new button - * @return The newly created Spinner - * - * @category Layout - */ - protected final Spinner addSpinner(Composite parent, - WritablePropertyValueModel numberHolder, - int defaultValue, - int minimumValue, - int maximumValue, - String helpId) { - - Spinner spinner = addUnmanagedSpinner(parent, numberHolder, defaultValue, minimumValue, maximumValue, helpId); - this.manageWidget(spinner); - return spinner; - } - - /** - * Creates a new unmanaged spinner. Unmanaged means that this Pane will - * not handle the enabling/disabling of this widget. The owning object will handle - * it with its own PaneEnabler or ControlEnabler. - * - * @param parent The parent container - * @param numberHolder The holder of the integer value - * @param defaultValue The value shown when the holder has null - * @param minimumValue The minimum value that the spinner will allow - * @param maximumValue The maximum value that the spinner will allow - * @param helpId The topic help ID to be registered for the new button - * @return The newly created Spinner - * - * @category Layout - */ - private Spinner addUnmanagedSpinner(Composite parent, - WritablePropertyValueModel numberHolder, - int defaultValue, - int minimumValue, - int maximumValue, - String helpId) { - - Spinner spinner = this.widgetFactory.createSpinner(parent); - spinner.setMinimum(minimumValue); - spinner.setMaximum(maximumValue); - GridData gridData = getFieldGridData(); - gridData.grabExcessHorizontalSpace = false; - spinner.setLayoutData(gridData); - - SpinnerModelAdapter.adapt(numberHolder, spinner, defaultValue); - - if (helpId != null) { - getHelpSystem().setHelp(spinner, helpId); - } - - return spinner; - } - - /** - * Creates a new managed DateTime of type SWT.TIME. Managed means that this Pane will - * handle enabling/disabling of this widget if a PaneEnabler is used. - * - * @param parent The parent container - * @param hoursHolder The holder of the hours integer value - * @param minutesHolder The holder of the minutes integer value - * @param secondsHolder The holder of the seconds integer value - * @param helpId The topic help ID to be registered for the new dateTime - * @return The newly created DateTime - * - * @category Layout - */ - protected final DateTime addDateTime(Composite parent, - WritablePropertyValueModel hoursHolder, - WritablePropertyValueModel minutesHolder, - WritablePropertyValueModel secondsHolder, - String helpId) { - - DateTime dateTime = this.addUnmanagedDateTime(parent, hoursHolder, minutesHolder, secondsHolder, helpId); - this.manageWidget(dateTime); - - return dateTime; - } - - protected final DateTime addDateTime( - Composite parent, - WritablePropertyValueModel hoursHolder, - WritablePropertyValueModel minutesHolder, - WritablePropertyValueModel secondsHolder, - String helpId, - PropertyValueModel enabledModel - ) { - DateTime dateTime = this.addUnmanagedDateTime(parent, hoursHolder, minutesHolder, secondsHolder, helpId); - this.controlEnabledState(enabledModel, dateTime); - return dateTime; - } - - /** - * Creates a new unmanaged DateTime of type SWT.TIME. Unmanaged means that this Pane will - * not handle the enabling/disabling of this widget. The owning object will handle - * it with its own PaneEnabler or ControlEnabler. - * - * @param parent The parent container - * @param hoursHolder The holder of the hours integer value - * @param minutesHolder The holder of the minutes integer value - * @param secondsHolder The holder of the seconds integer value - * @param helpId The topic help ID to be registered for the new dateTime - * @return The newly created DateTime - * - * @category Layout - */ - private DateTime addUnmanagedDateTime(Composite parent, - WritablePropertyValueModel hoursHolder, - WritablePropertyValueModel minutesHolder, - WritablePropertyValueModel secondsHolder, - String helpId) { - - DateTime dateTime = this.widgetFactory.createDateTime(parent, SWT.TIME); - - DateTimeModelAdapter.adapt(hoursHolder, minutesHolder, secondsHolder, dateTime); - - if (helpId != null) { - getHelpSystem().setHelp(dateTime, helpId); - } - - return dateTime; - } - /** - * Creates a new editable Combo. - * - * @param container The parent container - * @param listHolder The ListValueHolder - * @param selectedItemHolder The holder of the selected item - * @param stringConverter The converter responsible to transform each item - * into a string representation - * @return The newly created CCombo - * - * @category Layout - */ - private Combo addUnmanagedEditableCombo(Composite container, - ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - StringConverter stringConverter) { - - Combo combo = addUnmanagedEditableCombo(container); - - ComboModelAdapter.adapt( - listHolder, - selectedItemHolder, - combo, - stringConverter - ); - - return combo; - } - - - /** - * Creates a new editable Combo. - * - * @param container The parent container - * @return The newly created CCombo - * - * @category Layout - */ - private Combo addUnmanagedEditableCombo(Composite container) { - - Combo combo = this.widgetFactory.createEditableCombo(container); - combo.setLayoutData(getFieldGridData()); - return combo; - } - - /** - * Creates a new container that will have a text field as the center control - * labeled with the given label. - * - * @param container The parent container - * @param textHolder The holder of the text field's input - * @return The newly created Text - * - * @category Layout - */ - protected final Text addLabeledText(Composite container, - String labelText, - WritablePropertyValueModel textHolder) { - - return this.addLabeledText(container, labelText, textHolder, null); - } - - /** - * Creates a new container that will have a text field as the center control - * labeled with the given label. - * - * @param container The parent container - * @param labelText The text field's label - * @param rightComponent The component to be placed to the right of the text - * field - * @param textHolder The holder of the text field's input - * @param helpId The topic help ID to be registered for the text field - * @return The newly created Text - * - * @category Layout - */ - protected final Text addLabeledText(Composite container, - String labelText, - WritablePropertyValueModel textHolder, - Control rightComponent, - String helpId) { - - Text text = this.addText(container, textHolder); - - this.addLabeledComposite( - container, - labelText, - text, - rightComponent, - helpId - ); - - return text; - } - /** - * - * Creates a new container that will have a text field as the center control - * labeled with the given label. - * - * @param container The parent container - * @param labelText The text field's label - * @param rightComponent The component to be placed to the right of the text - * field - * @param textHolder The holder of the text field's input - * @param helpId The topic help ID to be registered for the text field - * @return The newly created Text - * - * @category Layout - */ - protected final Text addLabeledText(Composite container, - Label label, - WritablePropertyValueModel textHolder, - Control rightComponent, - String helpId) { - - Text text = this.addText(container, textHolder); - - this.addLabeledComposite( - container, - label, - text, - rightComponent, - helpId - ); - - return text; - } - - /** - * Creates a new container that will have a text field as the center control - * labeled with the given label. - * - * @param container The parent container - * @param textHolder The holder of the text field's input - * @param helpId The topic help ID to be registered for the text field - * @return The newly created Text - * - * @category Layout - */ - protected final Text addLabeledText(Composite container, - String labelText, - WritablePropertyValueModel textHolder, - String helpId) { - - return this.addLabeledText( - container, - labelText, - textHolder, - null, - helpId - ); - } - - /** - * Creates a new container that will have a text field as the center control - * labeled with the given label. - * - * @param container The parent container - * @param textHolder The holder of the text field's input - * @param helpId The topic help ID to be registered for the text field - * @return The newly created Text - * - * @category Layout - */ - protected final Text addLabeledText(Composite container, - Label label, - WritablePropertyValueModel textHolder, - String helpId) { - - return this.addLabeledText( - container, - label, - textHolder, - null, - helpId - ); - } - - /** - * Creates a new list and notify the given selection holder when the - * selection changes. If the selection count is different than one than the - * holder will receive null. - * - * @param container The parent container - * @param helpId The topic help ID to be registered for the new radio button - * @return The newly created List - * - * @category Layout - */ - protected final List addList(Composite container, String helpId) { - - return this.addList( - container, - new SimplePropertyValueModel(), - helpId - ); - } - - /** - * Creates a new list and notify the given selection holder when the - * selection changes. If the selection count is different than one than the - * holder will receive null. - * - * @param container The parent container - * @param selectionHolder The holder of the unique selected item - * @param helpId The topic help ID to be registered for the new radio button - * @return The newly created List - * - * @category Layout - */ - protected final List addList(Composite container, - WritablePropertyValueModel selectionHolder, - String helpId) { - - List list = this.addUnmanagedList(container, selectionHolder, helpId); - this.manageWidget(list); - - return list; - } - - /** - * Creates a new unmanaged list and notify the given selection holder when the - * selection changes. If the selection count is different than one than the - * holder will receive null. - * Unmanaged means that this Pane will not handle the enabling/disabling of this widget. - * The owning object will handle it with its own PaneEnabler or ControlEnabler. - * - * @param container The parent container - * @param selectionHolder The holder of the unique selected item - * @param helpId The topic help ID to be registered for the new radio button - * @return The newly created List - * - * @category Layout - */ - private List addUnmanagedList(Composite container, - WritablePropertyValueModel selectionHolder, - String helpId) { - - List list = this.widgetFactory.createList( - container, - SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.MULTI - ); - - list.addSelectionListener(buildSelectionListener(selectionHolder)); - list.setLayoutData(new GridData(GridData.FILL_BOTH)); - - if (helpId != null) { - getHelpSystem().setHelp(list, helpId); - } - - return list; - } - - /** - * Creates a new lable expanding on multiple lines. - * - * @param parent The parent container - * @param labelText The label's text - * - * @category Layout - */ - protected final FormText addMultiLineLabel(Composite container, - String labelText) { - - FormText label = this.widgetFactory.createMultiLineLabel(container, labelText); - manageWidget(label); - return label; - } - - /** - * Creates a new Text widget that has multiple lines. - * - * @param container The parent container - * @return The newly created Text widget - * - */ - protected final Text addMultiLineText(Composite container) { - - Text text = this.widgetFactory.createMultiLineText(container); - text.setLayoutData(getFieldGridData()); - this.manageWidget(text); - - return text; - } - - /** - * Creates a new Text widget that has multiple lines. - * - * @param container The parent container - * @param lineCount The number of lines the text area should display - * @param helpId The topic help ID to be registered for the new text - * @return The newly created Text widget - * - * @category Layout - */ - protected final Text addMultiLineText(Composite container, - int lineCount, - String helpId) { - - Text text = this.addMultiLineText(container); - - GridData gridData = getFieldGridData(); - gridData.heightHint = text.getLineHeight() * lineCount; - text.setLayoutData(gridData); - - if (helpId != null) { - getHelpSystem().setHelp(text, helpId); - } - - return text; - } - - /** - * Creates a new Text widget that has multiple lines. - * - * @param container The parent container - * @param textHolder The holder of the text field's input - * @param lineCount The number of lines the text area should display - * @return The newly created Text widget - * - * @category Layout - */ - protected final Text addMultiLineText(Composite container, - WritablePropertyValueModel textHolder, - int lineCount) { - - return this.addMultiLineText(container, textHolder, lineCount, null); - } - - /** - * Creates a new Text widget that has multiple lines. - * - * @param container The parent container - * @param textHolder The holder of the text field's input - * @param helpId The topic help ID to be registered for the new text - * @return The newly created Text widget - * - * @category Layout - */ - protected final Text addMultiLineText(Composite container, - WritablePropertyValueModel textHolder, - int lineCount, - String helpId) { - - Text text = this.addMultiLineText(container, lineCount, helpId); - SWTTools.bind(textHolder, text); - return text; - } - - /** - * Creates a new PageBook and set the proper layout and layout - * data. - * - * @param container The parent container - * @return The newly created PageBook - * - * @category Layout - */ - protected final PageBook addPageBook(Composite container) { - - PageBook pageBook = new PageBook(container, SWT.NULL); - pageBook.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - return pageBook; - } - - /** - * Creates a new container without specifying any layout manager. - * - * @param container The parent of the new container - * @return The newly created Composite - * - * @category Layout - */ - protected final Composite addPane(Composite parent) { - return this.widgetFactory.createComposite(parent); - } - - /** - * Creates a new container using the given layout manager. - * - * @param parent The parent of the new container - * @param layout The layout manager of the new container - * @return The newly created container - * - * @category Layout - */ - protected final Composite addPane(Composite container, Layout layout) { - - container = this.addPane(container); - container.setLayout(layout); - container.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - return container; - } - - /** - * Creates a new Text widget. - * - * @param container The parent container - * @param textHolder The holder of the text field's input - * @return The newly created Text widget - * - * @category Layout - */ - protected final Text addPasswordText(Composite container, - WritablePropertyValueModel textHolder) { - - Text text = this.addPasswordText(container); - SWTTools.bind(textHolder, text); - - return text; - } - - /** - * Creates a new Text widget. - * - * @param container The parent container - * @param textHolder The holder of the text field's input - * @return The newly created Text widget - * - * @category Layout - */ - protected final Text addPasswordText(Composite container) { - - Text text = this.widgetFactory.createPasswordText(container); - text.setLayoutData(getFieldGridData()); - - this.manageWidget(text); - return text; - } - - /** - * Creates a new push button using the given information. - * - * @param parent The parent container - * @param buttonText The button's text - * @param buttonAction The action to be invoked when the button is pressed - * @return The newly created Button - * - * @category Layout - */ - protected final Button addPushButton(Composite parent, - String buttonText, - final Runnable buttonAction) { - - return this.addPushButton(parent, buttonText, null, buttonAction); - } - - /** - * Creates a new push button using the given information. - * - * @param parent The parent container - * @param buttonText The button's text - * @param buttonAction The action to be invoked when the button is pressed - * @param helpId The topic help ID to be registered for the new radio button - * @return The newly created Button - * - * @category Layout - */ - protected final Button addPushButton(Composite parent, - String buttonText, - String helpId, - final Runnable buttonAction) { - - Button button = this.widgetFactory.createPushButton(parent, buttonText); - manageWidget(button); - button.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - SWTUtil.asyncExec(buttonAction); - } - }); - - button.setLayoutData(new GridData()); - - if (helpId != null) { - getHelpSystem().setHelp(button, helpId); - } - - return button; - } - - /** - * Creates a new check box using the given information. - * - * @param parent The parent container - * @param buttonText The button's text - * @param booleanHolder The holder of the selection state - * @param helpId The topic help ID to be registered for the new radio button - * @return The newly created Button - * - * @category Layout - */ - protected final Button addRadioButton(Composite parent, - String buttonText, - WritablePropertyValueModel booleanHolder, - String helpId) { - - return this.addToggleButton( - parent, - buttonText, - booleanHolder, - helpId, - SWT.RADIO - ); - } - - /** - * Creates a new Section. A sub-pane is automatically added as - * its client and is the returned Composite. - * - * @param container The container of the new widget - * @param sectionText The text of the new section - * @return The Section's sub-pane - * - * @category Layout - */ - protected final Composite addSection(Composite container, - String sectionText) { - - return this.addSection( - container, - sectionText, - ExpandableComposite.TITLE_BAR - ); - } - - /** - * Creates a new Section. A sub-pane is automatically added as - * its client and is the returned Composite. - * - * @param container The container of the new widget - * @param sectionText The text of the new section - * @param type The type of section to create - * @param expandedStateHolder The holder of the boolean that will dictate - * when to expand or collapse the section - * @return The Section's sub-pane - * - * @category Layout - */ - private Composite addSection(Composite container, - String sectionText, - int type) { - - return this.addSection(container, sectionText, null, type); - } - - /** - * Creates a new Section. A sub-pane is automatically added as - * its client and is the returned Composite. - * - * @param container The container of the new widget - * @param sectionText The text of the new section - * @param description The section's description - * @return The Section's sub-pane - * - * @category Layout - */ - protected final Composite addSection(Composite container, - String sectionText, - String description) { - - return this.addSection( - container, - sectionText, - description, - ExpandableComposite.TITLE_BAR - ); - } - - /** - * Creates a new Section. A sub-pane is automatically added as - * its client and is the returned Composite. - * - * @param container The container of the new widget - * @param sectionText The text of the new section - * @param description The section's description or null if none - * was provider - * @param type The type of section to create - * @param expandedStateHolder The holder of the boolean that will dictate - * when to expand or collapse the section - * @return The Section's sub-pane - * - * @category Layout - */ - private Composite addSection(Composite container, - String sectionText, - String description, - int type) { - - Section section = this.widgetFactory.createSection(container, type | ((description != null) ? Section.DESCRIPTION : SWT.NULL)); - section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - section.setText(sectionText); - section.marginWidth = 0; - section.marginHeight = 0; - - if (description != null) { - section.setDescription(description); - } - - Composite subPane = this.addSubPane(section); - section.setClient(subPane); - - return subPane; - } - - private SelectionListener buildSelectionListener(final WritablePropertyValueModel selectionHolder) { - return new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - List list = (List) e.widget; - String[] selectedItems = list.getSelection(); - if ((selectedItems == null) || (selectedItems.length != 1)) { - selectionHolder.setValue(null); - } - else { - selectionHolder.setValue(selectedItems[0]); - } - } - }; - } - - /** - * Creates the layout responsible to compute the size of the spacer created - * for the right control when none was given. The spacer helps to align all - * the right controls. - * - * @category Layout - */ - private Layout buildSpacerLayout() { - return new Layout() { - @Override - protected Point computeSize(Composite composite, - int widthHint, - int heightHint, - boolean flushCache) { - - return new Point(widthHint, heightHint); - } - - @Override - protected void layout(Composite composite, boolean flushCache) { - GridData data = (GridData) composite.getLayoutData(); - composite.setBounds(0, 0, data.widthHint, data.heightHint); - } - }; - } - - private PropertyChangeListener buildSubjectChangeListener() { - return new SWTPropertyChangeListenerWrapper(this.buildSubjectChangeListener_()); - } - - private PropertyChangeListener buildSubjectChangeListener_() { - return new PropertyChangeListener() { - @SuppressWarnings("unchecked") - public void propertyChanged(PropertyChangeEvent e) { - Pane.this.subjectChanged((T) e.getOldValue(), (T) e.getNewValue()); - } - }; - } - - /** - * Creates a new Composite used as a sub-pane. - * - * @param container The parent container - * @return The newly created Composite used as a sub-pane - * - * @category Layout - */ - protected final Composite addSubPane(Composite container) { - return this.addSubPane(container, 0); - } - - /** - * Creates a new Composite used as a sub-pane. - * - * @param container The parent container - * @param topMargin The extra spacing to add at the top of the pane - * @return The newly created Composite used as a sub-pane - * - * @category Layout - */ - protected final Composite addSubPane(Composite container, int topMargin) { - return this.addSubPane(container, topMargin, 0); - } - - /** - * Creates a new Composite used as a sub-pane. - * - * @param container The parent container - * @param topMargin The extra spacing to add at the top of the pane - * @param leftMargin The extra spacing to add to the left of the pane - * @return The newly created Composite used as a sub-pane - * - * @category Layout - */ - protected final Composite addSubPane(Composite container, - int topMargin, - int leftMargin) { - - return this.addSubPane(container, topMargin, leftMargin, 0, 0); - } - - /** - * Creates a new Composite used as a sub-pane, the new widget - * will have its layout and layout data already initialized, the layout will - * be a GridLayout with 1 column. - * - * @param container The parent container - * @param topMargin The extra spacing to add at the top of the pane - * @param leftMargin The extra spacing to add to the left of the pane - * @param bottomMargin The extra spacing to add at the bottom of the pane - * @param rightMargin The extra spacing to add to the right of the pane - * @return The newly created Composite used as a sub-pane - * - * @category Layout - */ - protected final Composite addSubPane(Composite container, - int topMargin, - int leftMargin, - int bottomMargin, - int rightMargin) { - - return this.addSubPane( - container, - 1, - topMargin, - leftMargin, - bottomMargin, - rightMargin); - } - - /** - * Creates a new Composite used as a sub-pane, the new widget - * will have its layout and layout data already initialized, the layout will - * be a GridLayout with 1 column. - * - * @param container The parent container - * @param topMargin The extra spacing to add at the top of the pane - * @param leftMargin The extra spacing to add to the left of the pane - * @param bottomMargin The extra spacing to add at the bottom of the pane - * @param rightMargin The extra spacing to add to the right of the pane - * @return The newly created Composite used as a sub-pane - * - * @category Layout - */ - protected final Composite addSubPane(Composite container, - int columnCount, - int topMargin, - int leftMargin, - int bottomMargin, - int rightMargin) { - - GridLayout layout = new GridLayout(columnCount, false); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.marginTop = topMargin; - layout.marginLeft = leftMargin; - layout.marginBottom = bottomMargin; - layout.marginRight = rightMargin; - - container = this.addPane(container, layout); - - return container; - } - - /** - * Creates a new Section. A sub-pane is automatically added as - * its client which can be typed cast directly as a Composite. - * - * @param container The container of the new widget - * @param sectionText The text of the new section - * @return The Section's sub-pane - * - * @category Layout - */ - protected final Composite addSubSection(Composite container, - String sectionText) { - - return this.addCollapsibleSubSection( - container, - sectionText, - new SimplePropertyValueModel(Boolean.TRUE) - ); - } - - /** - * Creates a new table. - * - * @param container The parent container - * @param style The style to apply to the table - * @param helpId The topic help ID to be registered for the new table or - * null if no help ID is required - * @return The newly created Table - * - * @category Layout - */ - protected final Table addTable(Composite container, - int style, - String helpId) { - - Table table = addUnmanagedTable(container, style, helpId); - this.manageWidget(table); - - return table; - } - /** - * Creates a new unmanaged table. Unmanaged means that this Pane will - * not handle the enabling/disabling of this widget. The owning object will handle - * it with its own PaneEnabler or ControlEnabler. - * - * @param container The parent container - * @param style The style to apply to the table - * @param helpId The topic help ID to be registered for the new table or - * null if no help ID is required - * @return The newly created Table - * - * @category Layout - */ - protected final Table addUnmanagedTable(Composite container, - int style, - String helpId) { - - Table table = this.widgetFactory.createTable(container, style); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - GridData gridData = new GridData(GridData.FILL_BOTH); - gridData.heightHint = table.getItemHeight() * 4; - table.setLayoutData(gridData); - - if (helpId != null) { - getHelpSystem().setHelp(table, helpId); - } - - return table; - } - - /** - * Creates a new table. - * - * @param container The parent container - * @param helpId The topic help ID to be registered for the new table or - * null if no help ID is required - * @return The newly created Table - * - * @category Layout - */ - protected final Table addTable(Composite container, String helpId) { - - return this.addTable( - container, - SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI, - helpId - ); - } - - /** - * Creates a new unmanaged table. Unmanaged means that this Pane will - * not handle the enabling/disabling of this widget. The owning object will handle - * it with its own PaneEnabler or ControlEnabler. - * - * @param container The parent container - * @param helpId The topic help ID to be registered for the new table or - * null if no help ID is required - * @return The newly created Table - * - * @category Layout - */ - protected final Table addUnmanagedTable(Composite container, String helpId) { - - return this.addUnmanagedTable( - container, - SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI, - helpId - ); - } - - /** - * Creates a new managed Text widget. - * - * @param container The parent container - * @return The newly created Text widget - * - * @category Layout - */ - protected final Text addText(Composite container) { - Text text = this.addUnmanagedText(container); - this.manageWidget(text); - return text; - } - - /** - * Creates a new unmanaged Text widget. Unmanaged means - * that this Pane will not handle the enabling/disabling of this widget. - * The owning object will handle it with its own PaneEnabler or ControlEnabler. - * - * @param container The parent container - * @return The newly created Text widget - * - * @category Layout - */ - private Text addUnmanagedText(Composite container) { - Text text = this.widgetFactory.createText(container); - text.setLayoutData(getFieldGridData()); - return text; - } - - /** - * Creates a new Text widget. - * - * @param container The parent container - * @param helpId The topic help ID to be registered for the new text - * @return The newly created Text widget - * - * @category Layout - */ - protected final Text addText(Composite container, String helpId) { - - Text text = this.addText(container); - - if (helpId != null) { - getHelpSystem().setHelp(text, helpId); - } - - return text; - } - - /** - * Creates a new unmanaged Text widget. Unmanaged means - * that this Pane will not handle the enabling/disabling of this widget. - * The owning object will handle it with its own PaneEnabler or ControlEnabler. - * - * @param container The parent container - * @param helpId The topic help ID to be registered for the new text - * @return The newly created Text widget - * - * @category Layout - */ - private Text addUnmanagedText(Composite container, String helpId) { - - Text text = this.addUnmanagedText(container); - - if (helpId != null) { - getHelpSystem().setHelp(text, helpId); - } - - return text; - } - - /** - * Creates a new Text widget. - * - * @param container The parent container - * @param textHolder The holder of the text field's input - * @return The newly created Text widget - * - * @category Layout - */ - protected final Text addText(Composite container, - WritablePropertyValueModel textHolder) { - - return this.addText(container, textHolder, null); - } - - /** - * Creates a new Text widget. - * - * @param container The parent container - * @param textHolder The holder of the text field's input - * @param helpId The topic help ID to be registered for the new text - * @return The newly created Text widget - * - * @category Layout - */ - protected final Text addText(Composite container, - WritablePropertyValueModel textHolder, - String helpId) { - - Text text = this.addText(container, helpId); - SWTTools.bind(textHolder, text); - - return text; - } - - protected final Text addText( - Composite container, - WritablePropertyValueModel textHolder, - String helpId, - PropertyValueModel enabledModel - ) { - Text text = this.addUnmanagedText(container, textHolder, helpId); - this.controlEnabledState(enabledModel, text); - return text; - } - - /** - * Creates a new unmanaged Text widget. Unmanaged means - * that this Pane will not handle the enabling/disabling of this widget. - * The owning object will handle it with its own PaneEnabler or ControlEnabler. - * - * @param container The parent container - * @param textHolder The holder of the text field's input - * @param helpId The topic help ID to be registered for the new text - * @return The newly created Text widget - * - * @category Layout - */ - private Text addUnmanagedText(Composite container, - WritablePropertyValueModel textHolder, - String helpId) { - - Text text = this.addUnmanagedText(container, helpId); - SWTTools.bind(textHolder, text); - - return text; - } - - /** - * Creates a new container with a titled border. - * - * @param title The text of the titled border - * @param container The parent container - * @return The newly created Composite with a titled border - * - * @category Layout - */ - protected final Group addTitledGroup(Composite container, String title) { - return this.addTitledGroup(container, title, null); - } - - /** - * Creates a new container with a titled border. - * - * @param title The text of the titled border - * @param container The parent container - * @param helpId The topic help ID to be registered for the new group - * @return The newly created Composite with a titled border - * - * @category Layout - */ - protected final Group addTitledGroup(Composite container, - String title, - String helpId) { - - return addTitledGroup(container, title, 1, helpId); - } - - /** - * Creates a new container with a titled border. - * - * @param title The text of the titled border - * @param container The parent container - * @param helpId The topic help ID to be registered for the new group - * @return The newly created Composite with a titled border - * - * @category Layout - */ - protected final Group addTitledGroup(Composite container, - String title, - int columnCount, - String helpId) { - - Group group = this.widgetFactory.createGroup(container, title); - //manageWidget(group); TODO unsure if I want to manage groups, - //also should probably rename this addUnmanagedTitledPane - group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - GridLayout layout = new GridLayout(columnCount, false); - layout.marginHeight = 0; - layout.marginWidth = 0; - layout.marginTop = 5; - layout.marginLeft = 5; - layout.marginBottom = 5; - layout.marginRight = 5; - group.setLayout(layout); - - if (helpId != null) { - getHelpSystem().setHelp(group, helpId); - } - - return group; - } - - /** - * Creates a new unmanaged new toggle button (radio button or check box). - * Unmanaged means that this Pane will not handle the enabling/disabling - * of this widget. The owning object will handle it with its own PaneEnabler - * or ControlEnabler. - * - * @param parent The parent container - * @param buttonText The button's text - * @param booleanHolder The holder of the selection state - * @param helpId The topic help ID to be registered for the new button - * @return The newly created Button - * - * @category Layout - */ - private Button addUnmanagedToggleButton( - Composite parent, - String buttonText, - WritablePropertyValueModel booleanHolder, - String helpId, - int toggleButtonType) { - - Button button; - - if (toggleButtonType == SWT.PUSH) { - button = this.widgetFactory.createPushButton(parent, buttonText); - } - else if (toggleButtonType == SWT.RADIO) { - button = this.widgetFactory.createRadioButton(parent, buttonText); - } - else if (toggleButtonType == SWT.CHECK) { - button = this.widgetFactory.createCheckBox(parent, buttonText); - } - else { - button = this.widgetFactory.createButton(parent, buttonText); - } - - button.setLayoutData(new GridData()); - SWTTools.bind(booleanHolder, button); - - if (helpId != null) { - getHelpSystem().setHelp(button, helpId); - } - - return button; - } - - /** - * Creates a new toggle button (radio button or check box) using the given - * information. - * - * @param parent The parent container - * @param buttonText The button's text - * @param booleanHolder The holder of the selection state - * @param helpId The topic help ID to be registered for the new button - * @return The newly created Button - * - * @category Layout - */ - private Button addToggleButton( - Composite parent, - String buttonText, - WritablePropertyValueModel booleanHolder, - String helpId, - int toggleButtonType) { - - Button button = addUnmanagedToggleButton( - parent, - buttonText, - booleanHolder, - helpId, - toggleButtonType); - this.manageWidget(button); - return button; - } - - /** - * Creates a new check box that can have 3 selection states (selected, - * unselected and partially selected. - * - * @param parent The parent container - * @param text The button's text - * @param booleanHolder The holder of the boolean value where null - * means partially selected - * @param helpId The topic help ID to be registered for the new check box - * @return The newly created TriStateCheckBox - * - * @category Layout - */ - protected final TriStateCheckBox addTriStateCheckBox(Composite parent, - String text, - WritablePropertyValueModel booleanHolder, - String helpId) { - - TriStateCheckBox checkBox = new TriStateCheckBox( - parent, - text, - this.getWidgetFactory() - ); - - this.manageWidget(checkBox.getCheckBox()); - - TriStateCheckBoxModelAdapter.adapt( - booleanHolder, - checkBox - ); - - if (helpId != null) { - getHelpSystem().setHelp(checkBox.getCheckBox(), helpId); - } - - return checkBox; - } - - /** - * Creates a new check box that can have 3 selection states (selected, - * unselected and partially selected. - * - * @param parent The parent container - * @param text The button's text - * @param booleanHolder The holder of the boolean value where null - * means partially selected - * @param stringHolder The holder of the string to put in parenthesis after - * the check box's text when it is partially selected - * @param helpId The topic help ID to be registered for the new check box - * @return The newly created TriStateCheckBox - * - * @category Layout - */ - protected final TriStateCheckBox addTriStateCheckBoxWithDefault(Composite parent, - String text, - WritablePropertyValueModel booleanHolder, - PropertyValueModel stringHolder, - String helpId) { - - TriStateCheckBox checkBox = this.addTriStateCheckBox( - parent, - text, - booleanHolder, - helpId - ); - - new LabeledControlUpdater( - new LabeledButton(checkBox.getCheckBox()), - stringHolder - ); - - return checkBox; - } - - /** - * Requests this pane to populate its widgets with the subject's values. - * - * @category Populate - */ - protected void doPopulate() { - this.log(Tracing.UI_LAYOUT, " ->doPopulate()"); - } - - private void controlEnabledState(PropertyValueModel booleanModel, Control... controls) { - this.controlEnabledState_(this.wrapEnabledModel(booleanModel), controls); - } - - /** - * Assume the "enabled" models can return null (which is typical with aspect - * adapters etc.). - */ - private PropertyValueModel wrapEnabledModel(PropertyValueModel booleanModel) { - return new TransformationPropertyValueModel(booleanModel, NonNullBooleanTransformer.FALSE); - } - - private void controlEnabledState_(PropertyValueModel booleanModel, Control... controls) { - SWTTools.controlEnabledState(this.andEnabledModel(booleanModel), controls); - } - - private PropertyValueModel getCombinedEnabledModel() { - return (this.combinedEnabledModel != null) ? this.combinedEnabledModel : this.baseEnabledModel; - } - - private boolean getCombinedEnablement() { - Boolean enabled = getCombinedEnabledModel().getValue(); - return (enabled == null) ? true : enabled.booleanValue(); - } - - private PropertyValueModel andEnabledModel(PropertyValueModel booleanModel) { - return CompositeBooleanPropertyValueModel.and(getCombinedEnabledModel(), booleanModel); - } - - protected void controllerEnablementChanged() { - enableWidgets_(getCombinedEnablement()); - } - - /** - * Changes the enablement state of the widgets of this pane. - * - * @param enabled true to enable the widgets or false - * to disable them - * - * @category Layout - */ - public void enableWidgets(boolean enabled) { - this.baseEnabledModel.setValue(Boolean.valueOf(enabled)); - enableWidgets_(getCombinedEnablement()); - } - - private void enableWidgets_(boolean enabled) { - if (! this.container.isDisposed()) { - for (Control control : this.managedWidgets) { - control.setEnabled(enabled); - } - - for (Pane subPane : this.managedSubPanes) { - subPane.enableWidgets(enabled); - } - } - } - - private void engageSubjectHolder() { - this.subjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.subjectChangeListener); - } - - /** - * engage the specified subject - */ - protected void engageListeners(T subject) { - if (subject != null) { - this.engageListeners_(subject); - } - } - - /** - * specified subject is not null - */ - protected void engageListeners_(T subject) { - this.log(Tracing.UI_LAYOUT, " ->engageListeners_(" + subject + ')'); - - for (String propertyName : this.getPropertyNames()) { - subject.addPropertyChangeListener(propertyName, this.aspectChangeListener); - } - } - - /** - * disengage the specified subject - */ - protected void disengageListeners(T subject) { - if (subject != null) { - this.disengageListeners_(subject); - } - } - - /** - * specified subject is not null - */ - protected void disengageListeners_(T subject) { - this.log(Tracing.UI_LAYOUT, " ->disengageListeners_(" + subject + ')'); - - for (String propertyName : this.getPropertyNames()) { - subject.removePropertyChangeListener(propertyName, this.aspectChangeListener); - } - } - - private void disengageSubjectHolder() { - this.subjectHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.subjectChangeListener); - } - - /** - * Returns the main Control of this pane. - * - * @return The main container - * - * @category Layout - */ - public Composite getControl() { - return this.container; - } - - /** - * Returns the subject holder used by this pane. - * - * @return The holder of the subject - * - * @category Populate - */ - protected final PropertyValueModel getSubjectHolder() { - return this.subjectHolder; - } - - /** - * Returns the factory responsible for creating the widgets. - * - * @return The factory used by this pane to create the widgets - * - * @category Layout - */ - protected final WidgetFactory getWidgetFactory() { - return this.widgetFactory; - } - - /** - * Returns the margin taken by a group box, which is the number of pixel the - * group box border and its margin takes before displaying its widgets plus - * 5 pixels since the widgets inside of the group box and the border should - * have that extra 5 pixels. - * - * @return The width taken by the group box border with its margin - * - * @category Layout - */ - protected final int getGroupBoxMargin() { - Group group = this.widgetFactory.createGroup(SWTUtil.getShell(), ""); - Rectangle clientArea = group.getClientArea(); - group.dispose(); - return clientArea.x + 5; - } - - /** - * Returns the helps system. - * - * @return The platform's help system - * - * @category Helper - */ - protected final IWorkbenchHelpSystem getHelpSystem() { - return PlatformUI.getWorkbench().getHelpSystem(); - } - - - /** - * Determines whether - * - * @return - * - * @category Populate - */ - protected final boolean isPopulating() { - return this.populating; - } - - /** - * Logs the given message if the Tracing.DEBUG_LAYOUT is enabled. - * - * @param flag - * @param message The logging message - */ - protected void log(String flag, String message) { - if (flag.equals(Tracing.UI_LAYOUT) && Tracing.booleanDebugOption(Tracing.UI_LAYOUT)) { - this.log(message); - } - } - - protected void log(String message) { - Class thisClass = this.getClass(); - String className = thisClass.getSimpleName(); - - if (thisClass.isAnonymousClass()) { - className = className.substring(0, className.indexOf('$')); - className += "->" + thisClass.getSuperclass().getSimpleName(); - } - - Tracing.log(className + ": " + message); - } - - /** - * Notifies this pane to populate itself using the subject's information. - * - * @category Populate - */ - private void populate() { - if (!this.container.isDisposed()) { - this.log(Tracing.UI_LAYOUT, "populate()"); - this.repopulate(); - } - } - - /** - * Notifies the subject's property associated with the given property name - * has changed. - * - * @param propertyName The property name associated with the property change - * - * @category Populate - */ - protected void propertyChanged(String propertyName) { - } - - /** - * Returns the list of names to listen for properties changing from the - * subject. - * - * @return A non-null list of property names - * - * @category Populate - */ - protected Collection getPropertyNames() { - ArrayList propertyNames = new ArrayList(); - addPropertyNames(propertyNames); - return propertyNames; - } - - /** - * Removes the given pane's widgets (those that were registered with - * its left ControlAligner) from this pane's left - * ControlAligner so that their width will no longer be adjusted - * with the width of the widest widget. - * - * @param pane The pane containing the widgets to remove - * - * @category Layout - */ - protected final void removeAlignLeft(Pane pane) { - this.leftControlAligner.remove(pane.leftControlAligner); - } - - /** - * Removes the given control from the collection of widgets that are aligned - * to have the same width when they are shown to the left side of the 3 - * widget colums. - * - * @param pane The pane to remove, its width will no longer be - * ajusted to be the width of the longest widget - * - * @category Layout - */ - protected final void removeAlignLeft(Control control) { - this.leftControlAligner.remove(control); - } - - /** - * Removes the given pane's widgets (those that were registered with - * its right ControlAligner) from this pane's right - * ControlAligner so that their width will no longer be adjusted - * with the width of the widest widget. - * - * @param pane The pane containing the widgets to remove - * - * @category Layout - */ - protected final void removeAlignRight(Pane pane) { - this.rightControlAligner.remove(pane.rightControlAligner); - } - - /** - * Removes the given control from the collection of widgets that are aligned - * to have the same width when they are shown to the right side of the 3 - * widget colums. - * - * @param pane The pane to remove, its width will no longer be - * ajusted to be the width of the longest widget - * - * @category Layout - */ - protected final void removeAlignRight(Control control) { - this.rightControlAligner.remove(control); - } - - /** - * Removes the given pane's controls (those that were registered for - * alignment) from this pane. - * - * @param pane The pane containing the widgets that no longer - * requires their width adjusted with the width of the longest widget - * - * @category Layout - */ - protected final void removePaneForAlignment(Pane pane) { - removeAlignLeft(pane); - removeAlignRight(pane); - } - - /** - * This method is called (perhaps internally) when this needs to repopulate - * but the object of interest has not changed. - * - * @category Populate - */ - protected final void repopulate() { - - this.log(Tracing.UI_LAYOUT, " ->repopulate()"); - - // Populate this pane - try { - setPopulating(true); - doPopulate(); - } - finally { - setPopulating(false); - } - - // Ask the sub-panes to repopulate themselves - for (Pane subPane : this.subPanes) { - subPane.repopulate(); - } - } - - /** - * Sets the internal flag that is used to determine whether the pane is being - * populated or not. During population, it is required to not update the - * widgets when the model is updated nor to update the model when the widgets - * are being synchronized with the model's values. - * - * @param populating - * - * @category Populate - */ - protected final void setPopulating(boolean populating) { - this.populating = populating; - } - - /** - * Either show or hides this pane. - * - * @param visible The new visibility state - */ - public void setVisible(boolean visible) { - if (!this.container.isDisposed()) { - this.container.setVisible(visible); - } - } - - /** - * Returns the nearest Shell displaying the main widget of this - * pane. - * - * @return The nearest window displaying this pane - */ - public final Shell getShell() { - return this.container.getShell(); - } - - /** - * Returns the subject of this pane. - * - * @return The subject if this pane was not disposed; null - * if it was - * - * @category Populate - */ - public T getSubject() { - return this.subjectHolder.getValue(); - } - - /** - * The subject has changed, disconnects any listeners from the old subject - * and connects those listeners onto the new subject. - * - * @param oldsubject The old subject or null if none was set - * @param newSubject The new subject or null if none needs to be - * set - * - * @category Populate - */ - protected final void subjectChanged(T oldSubject, T newSubject) { - if (!this.container.isDisposed()) { - - this.log(Tracing.UI_LAYOUT, "subjectChanged()"); - this.disengageListeners(oldSubject); - - this.repopulate(); - - this.engageListeners(newSubject); - } - } - - - /** - * Registers another Pane with this one so it can - * be automatically notified about certain events such as engaging or - * disengaging the listeners, etc. - * - * @param subPane The sub-pane to register - * - * @category Controller - */ - protected final void registerSubPane(Pane subPane) { - this.subPanes.add(subPane); - } - - /** - * Unregisters the given Pane from this one so it - * can no longer be automatically notified about certain events such as - * engaging or disengaging the listeners, etc. - * - * @param subPane The sub-pane to unregister - * - * @category Controller - */ - protected final void unregisterSubPane(Pane subPane) { - this.subPanes.remove(subPane); - } - - private void updatePane(String propertyName) { - if (!isPopulating() && !this.container.isDisposed()) { - this.populating = true; - - try { - propertyChanged(propertyName); - } - finally { - this.populating = false; - } - } - } - - public void dispose() { - this.log(Tracing.UI_LAYOUT, "dispose()"); - - // Dispose this pane - this.disengageListeners(getSubject()); - this.disengageSubjectHolder(); - - if (this.combinedEnabledModel != null && this.combinedEnabledModelListener != null) { - this.combinedEnabledModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.combinedEnabledModelListener); - } - - this.leftControlAligner.dispose(); - this.rightControlAligner.dispose(); - - // Ask the sub-panes to dispose themselves - for (Pane subPane : this.subPanes) { - subPane.dispose(); - } - } - -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PostExecution.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PostExecution.java deleted file mode 100644 index bae4b60382..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PostExecution.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.jface.dialogs.Dialog; - -/** - * This PostExecution is used to post execute a portion of code - * once a dialog, that was launched into a different UI thread, has been - * disposed. - * - * @version 2.0 - * @since 1.0 - */ -public interface PostExecution { - - /** - * Notifies this post exection the dialog that was launched into a different - * UI thread has been disposed. - * - * @param dialog The dialog that was launched into a different thread - */ - public void execute(T dialog); -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PropertySheetWidgetFactory.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PropertySheetWidgetFactory.java deleted file mode 100644 index c841976fc0..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/PropertySheetWidgetFactory.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Group; -import org.eclipse.ui.views.properties.tabbed.TabbedPropertySheetWidgetFactory; - -/** - * This WidgetFactory is responsible to create the widgets using - * TabbedPropertySheetWidgetFactory in order use the form style - * (flat-style) look and feel. - * - * @see TabbedPropertySheetWidgetFactory - * - * @version 2.0 - * @since 2.0 - */ -public class PropertySheetWidgetFactory extends FormWidgetFactory { - - /** - * Creates a new PropertySheetWidgetFactory. - * - * @param widgetFactory The actual factory responsible for creating the new - * widgets - */ - public PropertySheetWidgetFactory(TabbedPropertySheetWidgetFactory widgetFactory) { - super(widgetFactory); - } - - /** - * {@inheritDoc} - */ - @Override - public Composite createComposite(Composite parent) { - return getWidgetFactory().createComposite(parent); - } - - /** - * {@inheritDoc} - */ - @Override - public Group createGroup(Composite parent, String title) { - return getWidgetFactory().createGroup(parent, title); - } - - /** - * {@inheritDoc} - */ - @Override - public TabbedPropertySheetWidgetFactory getWidgetFactory() { - return (TabbedPropertySheetWidgetFactory) super.getWidgetFactory(); - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/TriStateCheckBox.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/TriStateCheckBox.java deleted file mode 100644 index ecb0d2098c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/TriStateCheckBox.java +++ /dev/null @@ -1,287 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import org.eclipse.jpt.common.ui.WidgetFactory; -import org.eclipse.swt.events.DisposeListener; -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.widgets.Button; -import org.eclipse.swt.widgets.Composite; - -/** - * This TriStateCheckBox can display one of three states: - * unchecked, checked, or partially checked. It can be modified via a mouse - * selection, via a keyboard selection, or programmatically. The selection state is - * represented by a Boolean value where a null - * value means partially checked. - *

- * The order of state changes is: unchecked -> partially checked -> checked. - * - * @version 2.0 - * @since 2.0 - */ -@SuppressWarnings("nls") -public final class TriStateCheckBox -{ - /** - * A check box button. - */ - private final Button button; - - /** - * The current selection state. - */ - private TriState state; - - /** - * Creates a new TriStateCheckBox with no text. - * - * @param parent The parent composite - * @param widgetFactory The factory used to create the check box - */ - public TriStateCheckBox(Composite parent, WidgetFactory widgetFactory) { - this(parent, null, widgetFactory); - } - - /** - * Creates a new TriStateCheckBox. - * - * @param parent The parent composite - * @param text The check box's text - * @param widgetFactory The factory used to create the check box - */ - public TriStateCheckBox(Composite parent, - String text, - WidgetFactory widgetFactory) { - super(); - this.state = TriState.UNCHECKED; - this.button = widgetFactory.createCheckBox(parent, text); - this.button.addSelectionListener(this.buildSelectionListener()); - } - - /** - * Convenience method: Adds a dispose listener to the check box. - * The source of any events sent to the listener will be the check box widget. - */ - public void addDisposeListener(DisposeListener disposeListener) { - this.button.addDisposeListener(disposeListener); - } - - /** - * Convenience method: Adds a selection listener to the check box. - * The source of any events sent to the listener will be the check box widget. - */ - public void addSelectionListener(SelectionListener selectionListener) { - this.button.addSelectionListener(selectionListener); - } - - private SelectionListener buildSelectionListener() { - return new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - TriStateCheckBox.this.checkBoxClicked(); - } - }; - } - - /** - * The check box was clicked, change the tri-state to the next value and - * update the check box's state. - */ - void checkBoxClicked() { - this.state = this.nextState(); - this.updateCheckBox(); - } - - /** - * Disposes the check box widget. - */ - public void dispose() { - this.button.dispose(); - } - - /** - * Returns the Button used to show a tri-state check box. - * - * @return The Button used to show a tri-state check box - */ - public Button getCheckBox() { - return this.button; - } - - /** - * Returns the check box's image. - * - * @return The check box's image. - */ - public Image getImage() { - return this.button.getImage(); - } - - /** - * Returns the check box's selection state. - * - * @return Either true or false for checked or - * unchecked; or null for partially selected - */ - public Boolean getSelection() { - return (this.state == TriState.PARTIALLY_CHECKED) ? null : Boolean.valueOf(this.state == TriState.CHECKED); - } - - /** - * Returns the check box's text. - * - * @return The text of the check box - */ - public String getText() { - return this.button.getText(); - } - - /** - * Returns whether the check box is disposed. - * - * @return true if the check box is disposed; false - * otherwise - */ - public boolean isDisposed() { - return this.button.isDisposed(); - } - - /** - * Returns whether the check box is enabled. - * - * @return true if the check box is enabled; false - * otherwise - */ - public boolean isEnabled() { - return this.button.isEnabled(); - } - - /** - * Returns the next state: - * UNCHECKED -> PARTIALLY_CHECKED - * PARTIALLY_CHECKED -> CHECKED - * CHECKED -> UNCHECKED - */ - private TriState nextState() { - switch (this.state) { - case UNCHECKED: - return TriState.PARTIALLY_CHECKED; - case PARTIALLY_CHECKED: - return TriState.CHECKED; - case CHECKED: - return TriState.UNCHECKED; - default: - throw new IllegalStateException("unknown state: " + this.state); - } - } - - /** - * Convenience method: Removes a dispose listener from the check box. - */ - public void removeDisposeListener(DisposeListener disposeListener) { - this.button.removeDisposeListener(disposeListener); - } - - /** - * Convenience method: Removes a selection listener from the check box. - */ - public void removeSelectionListener(SelectionListener selectionListener) { - this.button.removeSelectionListener(selectionListener); - } - - /** - * Changes the check box's enablement state. - * - * @param enabled true to enable the check box or false - * to disable it - */ - public void setEnabled(boolean enabled) { - this.button.setEnabled(enabled); - } - - /** - * Sets the check box's image. - * - * @param image The new image of the check box - */ - public void setImage(Image image) { - this.button.setImage(image); - } - - /** - * Changes the check box's selection state. - * - * @param selection Either true or false for - * checked and unchecked; or null for partially selected - */ - public void setSelection(Boolean selection) { - TriState old = this.state; - this.state = this.stateForBoolean(selection); - if (old != this.state) { - this.updateCheckBox(); - } - } - - /** - * Sets the check box's text. - * - * @param text The new text of the check box - */ - public void setText(String text) { - this.button.setText(text); - } - - /** - * Returns the tri-state corresponding to the boolean. - * - * @param selection The boolean to be converted to a tri-state - */ - private TriState stateForBoolean(Boolean selection) { - return (selection == null) ? TriState.PARTIALLY_CHECKED : - selection.booleanValue() ? TriState.CHECKED : TriState.UNCHECKED; - } - - /** - * Updates the selection state of the of the check box based on the tri-state - * value. - */ - void updateCheckBox() { - switch (this.state) { - case UNCHECKED: - this.button.setSelection(false); - this.button.setGrayed(false); - break; - case PARTIALLY_CHECKED: - this.button.setSelection(true); - this.button.setGrayed(true); - break; - case CHECKED: - this.button.setSelection(true); - this.button.setGrayed(false); - break; - default: - throw new IllegalStateException("unknown state: " + this.state); - } - } - - /** - * An enum containing the possible selections. - */ - enum TriState { - CHECKED, - PARTIALLY_CHECKED, - UNCHECKED - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ValidatingDialog.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ValidatingDialog.java deleted file mode 100644 index b4b6cdf73e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/internal/widgets/ValidatingDialog.java +++ /dev/null @@ -1,233 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.internal.widgets; - -import java.util.ListIterator; -import org.eclipse.jface.dialogs.IMessageProvider; -import org.eclipse.jpt.common.utility.internal.node.Node; -import org.eclipse.jpt.common.utility.internal.node.Problem; -import org.eclipse.osgi.util.NLS; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.widgets.Shell; - -/** - * This dialog is similar to it superclass, Dialog, with - * the added value of an error message label below the main panel. A subclass - * can set this error message as needed so that it can inform the user something - * incorrect has been entered. - *

- * If there is an error message, it will be shown. If there is a warning - * message, it will only be shown if there is no error message. Warning messages - * have a different icon than error messages. - * - * @version 2.0 - * @since 2.0 - */ -public abstract class ValidatingDialog extends Dialog { - - /** - * Creates a new ValidatingDialog. - * - * @param parent The parent shell - */ - public ValidatingDialog(Shell parent) { - super(parent); - } - - /** - * Creates a new ValidatingDialog. - * - * @param parent The parent shell - * @param title The dialog's title - */ - public ValidatingDialog(Shell parent, String title) { - super(parent, title); - } - - /* - * (non-Javadoc) - */ - @Override - final Node.Validator buildValidator() { - return new Node.Validator() { - public void pause() { - } - - public void resume() { - } - - public void validate() { - ValidatingDialog.this.validate(); - } - }; - } - - /** - * Clears the messages from the description pane - */ - protected final void clearMessage(){ - setMessage(getDescription()); - } - - /** - * Clears the error message from the description pane. - */ - protected final void clearErrorMessage() { - setErrorMessage(null); - } - - /** - * Returns the description shown in the description pane. - * - * @return The description under the description's title - */ - protected String getDescription() { - return null; - } - - /** - * Returns the image shown in the description pane. - * - * @return The image of the description pane or null if none is - * required - */ - protected Image getDescriptionImage() { - return null; - } - - /** - * Returns the title of the description pane. - * - * @return The title shown in the description pane - */ - protected String getDescriptionTitle() { - return null; - } - - /* - * (non-Javadoc) - */ - @Override - protected Point getInitialSize() { - Point result = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); - Point paneSize = getPane().getControl().computeSize(SWT.DEFAULT, SWT.DEFAULT); - int width = convertHorizontalDLUsToPixels(400); - result.x = Math.max(width, paneSize.x); - return result; - } - - /* - * (non-Javadoc) - */ - @Override - protected final boolean hasTitleArea() { - return true; - } - - /* - * (non-Javadoc) - */ - @Override - protected void initializeUI() { - - super.initializeUI(); - - // Update the description title - String descriptionTitle = getDescriptionTitle(); - - if (descriptionTitle != null) { - setTitle(descriptionTitle); - } - - // Update the description title - String description = getDescription(); - - if (description != null) { - setMessage(description); - } - - // Update the description image - Image image = getDescriptionImage(); - - if (image != null) { - setTitleImage(image); - } - } - - /** - * Updates the description pane by showing the given error message and format - * the text with the given list of arguments if any exists. - * - * @param errorMessage The error message to show in the description pane - * @param arguments The list of arguments used to format the error message - */ - protected final void setErrorMessage(String errorMessage, Object... arguments) { - setErrorMessage(NLS.bind(errorMessage, arguments)); - } - - /** - * Updates the description pane by showing the given warning message and format - * the text with the given list of arguments if any exists. - * - * @param warningMessage The warning message to show in the description pane - * @param arguments The list of arguments used to format the error message - */ - - protected final void setWarningMessage(String warningMessage, Object... arguments) { - setMessage(NLS.bind(warningMessage, arguments), IMessageProvider.WARNING); - } - - /** - * Updates the error message, either shows the first error problem or hides - * the error pane. If the progress bar is shown, then the error message will - * not be shown. - */ - private void updateMessage() { - if (getSubject().branchProblemsSize() == 0) { - clearMessage(); - } else { - for (ListIterator problems = getSubject().branchProblems(); problems.hasNext();){ - Problem problem = problems.next(); - if (problem.messageType() == IMessageProvider.ERROR){ - this.setErrorMessage(problem.messageKey(), problem.messageArguments()); - } - else if (problem.messageType() == IMessageProvider.WARNING){ - this.setWarningMessage(problem.messageKey(), problem.messageArguments()); - } - } - } - if (!this.containsErrorMessage()){ - clearErrorMessage(); - } - } - - public final boolean containsErrorMessage(){ - boolean error = false; - for (ListIterator problems = getSubject().branchProblems(); problems.hasNext();){ - Problem problem = problems.next(); - if (problem.messageType() ==IMessageProvider.ERROR){ - error = true; - } - } - return error; - } - /** - * Validates the state object and based on its status, update the description - * pane to show the first error if any exists and update the enablement of - * the OK button. - */ - private void validate() { - getSubject().validateBranch(); - updateMessage(); - getButton(OK).setEnabled(!containsErrorMessage()); - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/DelegatingContentAndLabelProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/DelegatingContentAndLabelProvider.java deleted file mode 100644 index 66f3be391d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/DelegatingContentAndLabelProvider.java +++ /dev/null @@ -1,207 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.jface; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.jface.viewers.BaseLabelProvider; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.LabelProviderChangedEvent; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.navigator.IDescriptionProvider; - -/** - * Implementation of {@link IStructuredContentProvider} and {@link ILabelProvider} that - * maintains a collection (Map, actually) of {@link ItemContentProvider} - * delegates that perform the function of providing content and label information - * for each represented item - * - * NB: This class, if used as a label provider *MUST* be used as a content provider - * for the same viewer. It may be used as a content provider with a different - * label provider, however. - * - * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public abstract class DelegatingContentAndLabelProvider - extends BaseLabelProvider - implements IStructuredContentProvider, ILabelProvider, IDescriptionProvider -{ - private final ItemContentProviderFactory itemContentProviderFactory; - - private final ItemLabelProviderFactory itemLabelProviderFactory; - - private final Map itemContentProviders; - - private final Map itemLabelProviders; - - StructuredViewer viewer; - - - protected DelegatingContentAndLabelProvider( - ItemContentProviderFactory itemContentProviderFactory) { - this(itemContentProviderFactory, null); - } - - protected DelegatingContentAndLabelProvider( - ItemContentProviderFactory itemContentProviderFactory, - ItemLabelProviderFactory itemLabelProviderFactory) { - super(); - this.itemContentProviderFactory = itemContentProviderFactory; - this.itemLabelProviderFactory = itemLabelProviderFactory; - this.itemContentProviders = new HashMap(); - this.itemLabelProviders = new HashMap(); - } - - - protected ItemContentProvider itemContentProvider(Object item) { - ItemContentProvider itemContentProvider = this.itemContentProviders.get(item); - if (itemContentProvider != null) { - return itemContentProvider; - } - itemContentProvider = this.itemContentProviderFactory.buildItemContentProvider(item, this); - if (itemContentProvider == null) { - return null; - } - this.itemContentProviders.put(item, itemContentProvider); - return itemContentProvider; - } - - protected ItemLabelProvider itemLabelProvider(Object item) { - if (this.viewer == null) { - throw new IllegalStateException( - "This provider must be used as a content" + //$NON-NLS-1$ - "provider *as well as* a label provider."); //$NON-NLS-1$ - } - ItemLabelProvider itemLabelProvider = this.itemLabelProviders.get(item); - if (itemLabelProvider != null) { - return itemLabelProvider; - } - itemLabelProvider = this.itemLabelProviderFactory.buildItemLabelProvider(item, this); - if (itemLabelProvider == null) { - return null; - } - this.itemLabelProviders.put(item, itemLabelProvider); - return itemLabelProvider; - } - - - public Object[] getElements(Object inputElement) { - return itemContentProvider(inputElement).getElements(); - } - - public Image getImage(Object element) { - ItemLabelProvider provider = itemLabelProvider(element); - return (provider == null) ? null :provider.getImage(); - } - - public String getText(Object element) { - ItemLabelProvider provider = itemLabelProvider(element); - return (provider == null) ? null : provider.getText(); - } - - public String getDescription(Object element) { - ItemLabelProvider provider = itemLabelProvider(element); - return (provider == null) ? null : provider.getDescription(); - } - - /** - * Disposes all items - */ - @Override - public void dispose() { - disposeProviders(); - super.dispose(); - } - - protected void disposeProviders() { - // coded this way to allow some item providers to dispose of their child - // elements without disrupting the entire process - while (! this.itemContentProviders.isEmpty()) { - dispose(this.itemContentProviders.keySet().iterator().next()); - } - // this catches any items that weren't disposed from the content providers, - // though there most likely won't be any items represented here that - // haven't already been disposed - while (! this.itemLabelProviders.isEmpty()) { - dispose(this.itemLabelProviders.keySet().iterator().next()); - } - } - - /** - * Disposes item - */ - public void dispose(Object item) { - if (this.itemContentProviders.containsKey(item)) { - this.itemContentProviders.get(item).dispose(); - this.itemContentProviders.remove(item); - } - if (this.itemLabelProviders.containsKey(item)) { - this.itemLabelProviders.get(item).dispose(); - this.itemLabelProviders.remove(item); - } - } - - public void inputChanged(Viewer structuredViewer, Object oldInput, Object newInput) { - if (oldInput != newInput) { - disposeProviders(); - } - this.viewer = (StructuredViewer) structuredViewer; - } - - /** - * Update the content for the given item - */ - public void updateContent(final Object item) { - Runnable runnable = new Runnable() { - public void run() { - if (viewer != null && viewer.getControl() != null && !viewer.getControl().isDisposed()) { - viewer.refresh(item); - } - } - }; - if (!viewerIsDisposed()) { - this.viewer.getControl().getDisplay().asyncExec(runnable); - } - } - - // open up visibility a bit for inner classes - @Override - protected void fireLabelProviderChanged(LabelProviderChangedEvent event) { - super.fireLabelProviderChanged(event); - } - - /** - * Update the label for the given item - */ - public void updateLabel(final Object item) { - Runnable runnable = new Runnable() { - public void run() { - if (viewer != null && viewer.getControl() != null && !viewer.getControl().isDisposed()) { - fireLabelProviderChanged(new LabelProviderChangedEvent(DelegatingContentAndLabelProvider.this, item)); - } - } - }; - if (!viewerIsDisposed()) { - this.viewer.getControl().getDisplay().asyncExec(runnable); - } - } - - protected boolean viewerIsDisposed() { - return this.viewer.getControl().isDisposed(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemContentProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemContentProvider.java deleted file mode 100644 index 2f21206f8c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemContentProvider.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.jface; - -/** - * Marker interface used in conjunction with DelegatingContentProvider to return - * content information for a particular item. - * @see DelegatingContentProvider - * @see ItemContentProviderFactory - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ItemContentProvider -{ - /** - * Return the elements of the represented item. - * Note that when this is called, the represented item is an input element. - */ - Object[] getElements(); - - /** - * Dispose of this content provider, cleaning up all references, listeners, etc. - */ - void dispose(); -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemContentProviderFactory.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemContentProviderFactory.java deleted file mode 100644 index a9c951d816..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemContentProviderFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.jface; - -/** - * Factory interface used to describe how to build {@link ItemContentProvider}s - * for a {@link DelegatingContentAndLabelProvider} - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ItemContentProviderFactory -{ - ItemContentProvider buildItemContentProvider(Object item, - DelegatingContentAndLabelProvider contentAndLabelProvider); -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemLabelProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemLabelProvider.java deleted file mode 100644 index 592a8a6bbe..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemLabelProvider.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.jface; - -import org.eclipse.swt.graphics.Image; - -/** - * Interface used in conjunction with DelegatingLabelProvider to return - * label information for a particular item. - * @see DelegatingLabelProvider - * @see ItemLabelProviderFactory - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ItemLabelProvider -{ - /** - * Return the image for the item - */ - Image getImage(); - - /** - * Return the text for the item - */ - public String getText(); - - /** - * Return the description for the item - */ - public String getDescription(); - - /** - * Dispose of this label provider, cleaning up all references, listeners, etc. - */ - void dispose(); -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemLabelProviderFactory.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemLabelProviderFactory.java deleted file mode 100644 index db61b3905f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/ItemLabelProviderFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.jface; - -/** - * Factory interface used to describe how to build IItemLabelProviders - * for a DelegatingContentAndLabelProvider - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ItemLabelProviderFactory -{ - ItemLabelProvider buildItemLabelProvider(Object item, - DelegatingContentAndLabelProvider contentAndLabelProvider); -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/TreeItemContentProvider.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/TreeItemContentProvider.java deleted file mode 100644 index 2e978f00b8..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/TreeItemContentProvider.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.jface; - -/** - * Interface used in conjunction with DelegatingTreeContentProvider to return - * tree information for a particular item. - * @see DelegatingTreeContentProvider - * @see TreeItemContentProviderFactory - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface TreeItemContentProvider extends ItemContentProvider -{ - /** - * Return the parent of the represented item - */ - Object getParent(); - - /** - * Return whether the represented item has children - */ - boolean hasChildren(); - - /** - * Return the children of the represented item - */ - Object[] getChildren(); -} diff --git a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/TreeItemContentProviderFactory.java b/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/TreeItemContentProviderFactory.java deleted file mode 100644 index 393a737525..0000000000 --- a/common/plugins/org.eclipse.jpt.common.ui/src/org/eclipse/jpt/common/ui/jface/TreeItemContentProviderFactory.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.jface; - -/** - * Extension of {@link ItemContentProviderFactory} that extends functionality - * for tree content - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface TreeItemContentProviderFactory extends ItemContentProviderFactory -{ - public TreeItemContentProvider buildItemContentProvider(Object item, - DelegatingContentAndLabelProvider contentAndLabelProvider); -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/.classpath b/common/plugins/org.eclipse.jpt.common.utility/.classpath deleted file mode 100644 index 304e86186a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/common/plugins/org.eclipse.jpt.common.utility/.cvsignore b/common/plugins/org.eclipse.jpt.common.utility/.cvsignore deleted file mode 100644 index a128605b1f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -bin -@dot -temp.folder -build.xml \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.utility/.project b/common/plugins/org.eclipse.jpt.common.utility/.project deleted file mode 100644 index dbe6e576b1..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.jpt.common.utility - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/common/plugins/org.eclipse.jpt.common.utility/.settings/org.eclipse.core.resources.prefs b/common/plugins/org.eclipse.jpt.common.utility/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 8e5b2c2b65..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Jan 15 11:12:22 EST 2008 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/common/plugins/org.eclipse.jpt.common.utility/.settings/org.eclipse.jdt.core.prefs b/common/plugins/org.eclipse.jpt.common.utility/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 443826069d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Sun May 27 14:55:37 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/common/plugins/org.eclipse.jpt.common.utility/META-INF/MANIFEST.MF b/common/plugins/org.eclipse.jpt.common.utility/META-INF/MANIFEST.MF deleted file mode 100644 index 3b17d42b88..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/META-INF/MANIFEST.MF +++ /dev/null @@ -1,134 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.common.utility -Bundle-Version: 2.0.0.qualifier -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Export-Package: org.eclipse.jpt.common.utility, - org.eclipse.jpt.common.utility.internal; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.common.core, - org.eclipse.jpt.common.ui, - org.eclipse.jpt.jaxb.core, - org.eclipse.jpt.jaxb.ui, - org.eclipse.jpt.jpa.db, - org.eclipse.jpt.jpa.db.ui, - org.eclipse.jpt.jpa.gen, - org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.utility.internal.enumerations; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.common.core, - org.eclipse.jpt.common.ui, - org.eclipse.jpt.jaxb.core, - org.eclipse.jpt.jaxb.ui, - org.eclipse.jpt.jpa.db, - org.eclipse.jpt.jpa.db.ui, - org.eclipse.jpt.jpa.gen, - org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.utility.internal.iterables; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.common.core, - org.eclipse.jpt.common.ui, - org.eclipse.jpt.jaxb.core, - org.eclipse.jpt.jaxb.ui, - org.eclipse.jpt.jpa.db, - org.eclipse.jpt.jpa.db.ui, - org.eclipse.jpt.jpa.gen, - org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.utility.internal.iterators; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.common.core, - org.eclipse.jpt.common.ui, - org.eclipse.jpt.jaxb.core, - org.eclipse.jpt.jaxb.ui, - org.eclipse.jpt.jpa.db, - org.eclipse.jpt.jpa.db.ui, - org.eclipse.jpt.jpa.gen, - org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.utility.internal.model; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.common.core, - org.eclipse.jpt.common.ui, - org.eclipse.jpt.jaxb.core, - org.eclipse.jpt.jaxb.ui, - org.eclipse.jpt.jpa.db, - org.eclipse.jpt.jpa.db.ui, - org.eclipse.jpt.jpa.gen, - org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.utility.internal.model.listener.awt; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.common.core, - org.eclipse.jpt.common.ui, - org.eclipse.jpt.jaxb.core, - org.eclipse.jpt.jaxb.ui, - org.eclipse.jpt.jpa.db, - org.eclipse.jpt.jpa.db.ui, - org.eclipse.jpt.jpa.gen, - org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.utility.internal.model.value; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.common.core, - org.eclipse.jpt.common.ui, - org.eclipse.jpt.jaxb.core, - org.eclipse.jpt.jaxb.ui, - org.eclipse.jpt.jpa.db, - org.eclipse.jpt.jpa.db.ui, - org.eclipse.jpt.jpa.gen, - org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.utility.internal.model.value.prefs; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.common.core, - org.eclipse.jpt.common.ui, - org.eclipse.jpt.jaxb.core, - org.eclipse.jpt.jaxb.ui, - org.eclipse.jpt.jpa.db, - org.eclipse.jpt.jpa.db.ui, - org.eclipse.jpt.jpa.gen, - org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.utility.internal.model.value.swing; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.common.core, - org.eclipse.jpt.common.ui, - org.eclipse.jpt.jaxb.core, - org.eclipse.jpt.jaxb.ui, - org.eclipse.jpt.jpa.db, - org.eclipse.jpt.jpa.db.ui, - org.eclipse.jpt.jpa.gen, - org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.utility.internal.node; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.common.core, - org.eclipse.jpt.common.ui, - org.eclipse.jpt.jaxb.core, - org.eclipse.jpt.jaxb.ui, - org.eclipse.jpt.jpa.db, - org.eclipse.jpt.jpa.db.ui, - org.eclipse.jpt.jpa.gen, - org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.utility.internal.swing; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.common.core, - org.eclipse.jpt.common.ui, - org.eclipse.jpt.jaxb.core, - org.eclipse.jpt.jaxb.ui, - org.eclipse.jpt.jpa.db, - org.eclipse.jpt.jpa.db.ui, - org.eclipse.jpt.jpa.gen, - org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.utility.internal.synchronizers; - x-friends:="org.eclipse.jpt.jpa.core, - org.eclipse.jpt.common.core, - org.eclipse.jpt.common.ui, - org.eclipse.jpt.jaxb.core, - org.eclipse.jpt.jaxb.ui, - org.eclipse.jpt.jpa.db, - org.eclipse.jpt.jpa.db.ui, - org.eclipse.jpt.jpa.gen, - org.eclipse.jpt.jpa.ui", - org.eclipse.jpt.common.utility.model, - org.eclipse.jpt.common.utility.model.event, - org.eclipse.jpt.common.utility.model.listener, - org.eclipse.jpt.common.utility.model.value, - org.eclipse.jpt.common.utility.synchronizers diff --git a/common/plugins/org.eclipse.jpt.common.utility/about.html b/common/plugins/org.eclipse.jpt.common.utility/about.html deleted file mode 100644 index be534ba44f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/about.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

May 02, 2008

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- - - diff --git a/common/plugins/org.eclipse.jpt.common.utility/build.properties b/common/plugins/org.eclipse.jpt.common.utility/build.properties deleted file mode 100644 index 11ab8d42f6..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/build.properties +++ /dev/null @@ -1,17 +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/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - about.html,\ - plugin.properties diff --git a/common/plugins/org.eclipse.jpt.common.utility/component.xml b/common/plugins/org.eclipse.jpt.common.utility/component.xml deleted file mode 100644 index 80c3a500b9..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/component.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.utility/plugin.properties b/common/plugins/org.eclipse.jpt.common.utility/plugin.properties deleted file mode 100644 index 1693cd4eb6..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/plugin.properties +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ -# Copyright (c) 2006, 2009 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ -# ==================================================================== -# 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 = Dali Java Persistence Tools - Common Utility -providerName = Eclipse Web Tools Platform - diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Command.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Command.java deleted file mode 100644 index f152ba5fa6..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Command.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility; - -import java.io.Serializable; - -/** - * Simple interface for implementing the GOF Command design pattern, - * and it doesn't carry the baggage of {@link java.lang.Runnable}. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface Command { - - /** - * Execute the command. The semantics of the command - * is determined by the contract between the client and server. - */ - void execute(); - - /** - * Singleton implementation of the command interface that will do nothing - * when executed. - */ - final class Null implements Command, Serializable { - public static final Command INSTANCE = new Null(); - public static Command instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - public void execute() { - // do nothing - } - @Override - public String toString() { - return "Command.Null"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - /** - * Singleton implementation of the command interface that will throw an - * exception when executed. - */ - final class Disabled implements Command, Serializable { - public static final Command INSTANCE = new Disabled(); - public static Command instance() { - return INSTANCE; - } - // ensure single instance - private Disabled() { - super(); - } - // throw an exception - public void execute() { - throw new UnsupportedOperationException(); - } - @Override - public String toString() { - return "Command.Disabled"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/CommandExecutor.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/CommandExecutor.java deleted file mode 100644 index 461ab8615d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/CommandExecutor.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility; - -import java.io.Serializable; - -/** - * This interface allows clients to control how a command is executed. - * This is useful when the server provides the command but the client provides - * the context (e.g. the client would like to dispatch the command to the UI - * thread). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface CommandExecutor { - - /** - * Execute the specified command. - */ - void execute(Command command); - - - /** - * Singleton implementation of the command executor interface - * that simply executes the command without any sort of enhancement. - */ - final class Default implements CommandExecutor, Serializable { - public static final CommandExecutor INSTANCE = new Default(); - public static CommandExecutor instance() { - return INSTANCE; - } - // ensure single instance - private Default() { - super(); - } - public void execute(Command command) { - command.execute(); - } - @Override - public String toString() { - return "CommandExecutor.Default"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Filter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Filter.java deleted file mode 100644 index 222185940e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/Filter.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility; - -import java.io.Serializable; - -/** - * Used by various "pluggable" classes to filter objects. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @param the type of objects to be filtered - */ -public interface Filter { - - /** - * Return whether the specified object is "accepted" by the - * filter. The semantics of "accept" is determined by the - * contract between the client and the server. - */ - boolean accept(T o); - - - /** - * Singleton implemetation of the filter interface that accepts all the - * objects (i.e. it does no filtering). - */ - final class Null implements Filter, Serializable { - @SuppressWarnings("rawtypes") - public static final Filter INSTANCE = new Null(); - @SuppressWarnings("unchecked") - public static Filter instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - // nothing is filtered - everything is accepted - public boolean accept(S o) { - return true; - } - @Override - public String toString() { - return "Filter.Null"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - /** - * Singleton implemetation of the filter interface that accepts none of the - * objects (i.e. it filters out all the objects). - */ - final class Opaque implements Filter, Serializable { - @SuppressWarnings("rawtypes") - public static final Filter INSTANCE = new Opaque(); - @SuppressWarnings("unchecked") - public static Filter instance() { - return INSTANCE; - } - // ensure single instance - private Opaque() { - super(); - } - // everything is filtered - nothing is accepted - public boolean accept(S o) { - return false; - } - @Override - public String toString() { - return "Filter.Opaque"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - /** - * Singleton implemetation of the filter interface that throws an exception - * if called. - */ - final class Disabled implements Filter, Serializable { - @SuppressWarnings("rawtypes") - public static final Filter INSTANCE = new Disabled(); - @SuppressWarnings("unchecked") - public static Filter instance() { - return INSTANCE; - } - // ensure single instance - private Disabled() { - super(); - } - // throw an exception - public boolean accept(S o) { - throw new UnsupportedOperationException(); - } - @Override - public String toString() { - return "Filter.Disabled"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/IndentingPrintWriter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/IndentingPrintWriter.java deleted file mode 100644 index 11641aa132..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/IndentingPrintWriter.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility; - -import java.io.PrintWriter; -import java.io.Writer; - -/** - * Extend {@link PrintWriter} to automatically indent new lines. - */ -public class IndentingPrintWriter - extends PrintWriter -{ - private final String indent; - private int indentLevel; - private boolean needsIndent; - - public static String DEFAULT_INDENT = "\t"; //$NON-NLS-1$ - - - /** - * Construct a writer that indents with tabs. - */ - public IndentingPrintWriter(Writer out) { - this(out, DEFAULT_INDENT); - } - - /** - * Construct a writer that indents with the specified string. - */ - public IndentingPrintWriter(Writer out, String indent) { - super(out); - this.indent = indent; - this.indentLevel = 0; - this.needsIndent = true; - } - - /** - * Set flag so following line is indented. - */ - @Override - public void println() { - synchronized (this.lock) { - super.println(); - this.needsIndent = true; - } - } - - /** - * Print the appropriate indent. - * Pre-condition: synchronized - */ - private void printIndent() { - if (this.needsIndent) { - this.needsIndent = false; - for (int i = this.indentLevel; i-- > 0; ) { - this.print(this.indent); - } - } - } - - /** - * Write a portion of an array of characters. - */ - @Override - public void write(char buf[], int off, int len) { - synchronized (this.lock) { - this.printIndent(); - super.write(buf, off, len); - } - } - - /** - * Write a single character. - */ - @Override - public void write(int c) { - synchronized (this.lock) { - this.printIndent(); - super.write(c); - } - } - - /** - * Write a portion of a string. - */ - @Override - public void write(String s, int off, int len) { - synchronized (this.lock) { - this.printIndent(); - super.write(s, off, len); - } - } - - /** - * Bump the indent level. - */ - public void indent() { - this.incrementIndentLevel(); - } - - /** - * Decrement the indent level. - */ - public void undent() { - this.decrementIndentLevel(); - } - - /** - * Bump the indent level. - */ - public void incrementIndentLevel() { - synchronized (this.lock) { - this.indentLevel++; - } - } - - /** - * Decrement the indent level. - */ - public void decrementIndentLevel() { - synchronized (this.lock) { - this.indentLevel--; - } - } - - /** - * Return the current indent level. - */ - public int getIndentLevel() { - synchronized (this.lock) { - return this.indentLevel; - } - } - - /** - * Allow the indent level to be set directly. - * Return the previous indent level. - */ - public int setIndentLevel(int indentLevel) { - synchronized (this.lock) { - int old = this.indentLevel; - this.indentLevel = indentLevel; - return old; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/JavaType.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/JavaType.java deleted file mode 100644 index fb019d5ebe..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/JavaType.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility; - -import java.io.PrintWriter; - -/** - * This interface describes a Java type; i.e. its "element type" - * and its "array depth". The element type is referenced by name, - * allowing us to reference classes that are not (or cannot be) loaded. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - *

- * This interface is not intended to be implemented by clients. - */ -public interface JavaType { - - /** - * Return the name of the type's "element type". - * A member type will have one or more '$' characters in its name. - */ - String getElementTypeName(); - - /** - * Return the type's "array depth". - */ - int getArrayDepth(); - - /** - * Return whether the type is an array (i.e. its "array depth" is greater - * than zero). - */ - boolean isArray(); - - /** - * Return whether the type is a "primitive" (e.g. int, float). - *

- * NB: void.class.isPrimitive() == true - */ - boolean isPrimitive(); - - /** - * Return whether the type is a "primitive wrapper" (e.g. {@link java.lang.Integer}, - * {@link java.lang.Float}). - *

- * NB: void.class.isPrimitive() == true - */ - boolean isPrimitiveWrapper(); - - /** - * Return whether the type is a "variable primitive" (e.g. int, float, - * but not void). - *

- * NB: variables cannot be declared void - */ - boolean isVariablePrimitive(); - - /** - * Return whether the type is a "variable primitive wrapper" (e.g. - * {@link java.lang.Integer}, {@link java.lang.Float}, - * but not {@link java.lang.Void}). - *

- * NB: variables cannot be declared void - */ - boolean isVariablePrimitiveWrapper(); - - /** - * Return the class corresponding to the type's element type and array depth. - */ - Class getJavaClass() throws ClassNotFoundException; - - /** - * Return the version of the type's name that matches that - * returned by {@link java.lang.Class#getName()} - * (e.g. "[[J", "[Ljava.lang.Object;", - * "java.util.Map$Entry"). - */ - String getJavaClassName(); - - /** - * Return whether the type is equal to the specified type. - */ - boolean equals(String otherElementTypeName, int otherArrayDepth); - - /** - * Return whether the type describes to the specified type. - */ - boolean describes(String className); - - /** - * Return whether the type describes to the specified type. - */ - boolean describes(Class javaClass); - - /** - * Return whether the type is equal to the specified type. - */ - boolean equals(JavaType other); - - /** - * Return the version of the type's name that can be used in source code:

    - *
  • "[[J" => "long[][]" - *
  • "java.util.Map$Entry" => "java.util.Map.Entry" - *
- */ - String declaration(); - - /** - * Append the version of the type's name that can be used in source code:
    - *
  • "[[J" => "long[][]" - *
  • "java.util.Map$Entry" => "java.util.Map.Entry" - *
- */ - void appendDeclarationTo(StringBuilder sb); - - /** - * Print the version of the type's name that can be used in source code:
    - *
  • "[[J" => "long[][]" - *
  • "java.util.Map$Entry" => "java.util.Map.Entry" - *
- */ - void printDeclarationOn(PrintWriter pw); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/MethodSignature.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/MethodSignature.java deleted file mode 100644 index 32e793a071..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/MethodSignature.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility; - -import java.io.PrintWriter; -import java.lang.reflect.Method; - -/** - * This interface describes a Java method signature; i.e. its "name" - * and its "parameter types". The parameter types are referenced by name, - * allowing us to reference classes that are not (or cannot be) loaded. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - *

- * This interface is not intended to be implemented by clients. - */ -public interface MethodSignature { - - /** - * Return the method's name. - */ - String getName(); - - /** - * Return the method's parameter types. - */ - JavaType[] getParameterTypes(); - - /** - * Return whether the method signature describes the specified method. - */ - boolean describes(Method method); - - /** - * Return whether the method signature equals the specified signature. - */ - boolean equals(String otherName, JavaType[] otherParameterTypes); - - /** - * Return whether the method signature equals the specified signature. - */ - boolean equals(MethodSignature other); - - /** - * Return a string representation of the method's signature:

- * "foo(int, java.lang.String)" - */ - String getSignature(); - - /** - * Append a string representation of the method's signature:

- * "foo(int, java.lang.String)" - */ - void appendSignatureTo(StringBuilder sb); - - /** - * Print a string representation of the method's signature:

- * "foo(int, java.lang.String)" - */ - void printSignatureOn(PrintWriter pw); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ObjectReference.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ObjectReference.java deleted file mode 100644 index 991c2c97d2..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ObjectReference.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility; - -/** - * Provide a container for passing an object that can be changed by the recipient. - */ -public interface ObjectReference - extends ReadOnlyObjectReference -{ - /** - * Set the value. - * Return the previous value. - */ - V setValue(V value); - - /** - * Set the value to null. - * Return the previous value. - */ - V setNull(); -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ReadOnlyObjectReference.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ReadOnlyObjectReference.java deleted file mode 100644 index 02c4ff6a24..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/ReadOnlyObjectReference.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility; - -/** - * Provide a container for holding an object that cannot be changed. - * - * @see ObjectReference - */ -public interface ReadOnlyObjectReference -{ - /** - * Return the current value. - */ - V getValue(); - - /** - * Return whether the current value is equal to the specified value. - */ - boolean valueEquals(Object object); - - /** - * Return whether the current value is not equal to the specified value. - */ - boolean valueNotEqual(Object object); - - /** - * Return whether the current value is null. - */ - boolean isNull(); - - /** - * Return whether the current value is not null. - */ - boolean isNotNull(); -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AbstractAssociation.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AbstractAssociation.java deleted file mode 100644 index 744d95c727..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AbstractAssociation.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -/** - * Implement some of the methods in {@link Association} that can - * be defined in terms of the other methods. - */ -public abstract class AbstractAssociation - implements Association -{ - /** - * Default constructor. - */ - protected AbstractAssociation() { - super(); - } - - @Override - public synchronized boolean equals(Object o) { - if ( ! (o instanceof Association)) { - return false; - } - Association other = (Association) o; - return this.keyEquals(other) && this.valueEquals(other); - } - - protected boolean keyEquals(Association other) { - Object key = this.getKey(); - return (key == null) ? - (other.getKey() == null) : - key.equals(other.getKey()); - } - - protected boolean valueEquals(Association other) { - Object value = this.getValue(); - return (value == null) ? - (other.getValue() == null) : - value.equals(other.getValue()); - } - - @Override - public synchronized int hashCode() { - return this.keyHashCode() ^ this.valueHashCode(); - } - - protected int keyHashCode() { - Object key = this.getKey(); - return (key == null) ? 0 : key.hashCode(); - } - - protected int valueHashCode() { - Object value = this.getValue(); - return (value == null) ? 0 : value.hashCode(); - } - - @Override - public synchronized String toString() { - return this.getKey() + " => " + this.getValue(); //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ArrayTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ArrayTools.java deleted file mode 100644 index 4f152023e7..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ArrayTools.java +++ /dev/null @@ -1,3122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.lang.reflect.Array; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Random; - -/** - * Array-related utility methods. - */ -public final class ArrayTools { - public static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; - public static final char[] EMPTY_CHAR_ARRAY = new char[0]; - public static final int[] EMPTY_INT_ARRAY = new int[0]; - - // ********** instantiation ********** - - /** - * Return a new array with the same length - * and the same component type as the specified array. - *

- * Arrays.newArray(Object[] array) - */ - public static E[] newArray(E[] array) { - return newArray(array, array.length); - } - - /** - * Return a new array with the specified length - * and the same component type as the specified array. - *

- * Arrays.newArray(Object[] array, int length) - */ - public static E[] newArray(E[] array, int length) { - return newArray(componentType(array), length); - } - - /** - * Return the specified array's component type, with appropriate support - * for generics. - */ - public static Class componentType(E[] array) { - Class rawComponentType = array.getClass().getComponentType(); - @SuppressWarnings("unchecked") - Class componentType = (Class) rawComponentType; - return componentType; - } - - /** - * Return a new array with the specified component type and length, - * with appropriate support for generics. The component type cannot be a - * primitive type. - */ - public static E[] newArray(Class componentType, int length) { - if (componentType.isPrimitive()) { - throw new IllegalArgumentException("Array class cannot be primitive: " + componentType); //$NON-NLS-1$ - } - return newArray_(componentType, length); - } - - /** - * assume the component type is not a primitive class - */ - @SuppressWarnings("unchecked") - private static E[] newArray_(Class componentType, int length) { - return (E[]) ((componentType == OBJECT_CLASS) ? - new Object[length] : - Array.newInstance(componentType, length)); - } - private static final Class OBJECT_CLASS = Object.class; - - - // ********** conversion ********** - - /** - * Return an array corresponding to the specified iterable. - *

- * Iterable.toArray() - * @see Collection#toArray() - */ - public static Object[] array(Iterable iterable) { - return array(iterable.iterator()); - } - - /** - * Return an array corresponding to the specified iterable. - * The specified iterable size is a performance hint. - *

- * Iterable.toArray() - * @see Collection#toArray() - */ - public static Object[] array(Iterable iterable, int iterableSize) { - return array(iterable.iterator(), iterableSize); - } - - /** - * Return an array corresponding to the specified iterable; - * the runtime type of the returned array is that of the specified array. - * If the iterable fits in the specified array, it is returned therein. - * Otherwise, a new array is allocated with the runtime type of the - * specified array and the size of the iterable. - *

- * Iterable.toArray(Object[]) - * @see Collection#toArray(Object[]) - */ - public static E[] array(Iterable iterable, E[] array) { - return array(iterable.iterator(), array); - } - - /** - * Return an array corresponding to the specified iterable; - * the runtime type of the returned array is that of the specified array. - * If the iterable fits in the specified array, it is returned therein. - * Otherwise, a new array is allocated with the runtime type of the - * specified array and the size of the iterable. - * The specified iterable size is a performance hint. - *

- * Iterable.toArray(Object[]) - * @see Collection#toArray(Object[]) - */ - public static E[] array(Iterable iterable, int iterableSize, E[] array) { - return array(iterable.iterator(), iterableSize, array); - } - - /** - * Return an array corresponding to the specified iterator. - *

- * Iterator.toArray() - * @see Collection#toArray() - */ - public static Object[] array(Iterator iterator) { - return iterator.hasNext() ? - CollectionTools.list(iterator).toArray() : - EMPTY_OBJECT_ARRAY; - } - - /** - * Return an array corresponding to the specified iterator. - * The specified iterator size is a performance hint. - *

- * Iterator.toArray() - * @see Collection#toArray() - */ - public static Object[] array(Iterator iterator, int iteratorSize) { - return iterator.hasNext() ? - CollectionTools.list(iterator, iteratorSize).toArray() : - EMPTY_OBJECT_ARRAY; - } - - /** - * Return an array corresponding to the specified iterator; - * the runtime type of the returned array is that of the specified array. - * If the iterator fits in the specified array, it is returned therein. - * Otherwise, a new array is allocated with the runtime type of the - * specified array and the size of the iterator. - *

- * Iterator.toArray(Object[]) - * @see Collection#toArray(Object[]) - */ - public static E[] array(Iterator iterator, E[] array) { - return iterator.hasNext() ? - CollectionTools.list(iterator).toArray(array) : - emptyArray(array); - } - - /** - * Return an array corresponding to the specified iterator; - * the runtime type of the returned array is that of the specified array. - * If the iterator fits in the specified array, it is returned therein. - * Otherwise, a new array is allocated with the runtime type of the - * specified array and the size of the iterator. - * The specified iterator size is a performance hint. - *

- * Iterator.toArray(Object[]) - * @see Collection#toArray(Object[]) - */ - public static E[] array(Iterator iterator, int iteratorSize, E[] array) { - return iterator.hasNext() ? - CollectionTools.list(iterator, iteratorSize).toArray(array) : - emptyArray(array); - } - - /** - * If the specified array is empty, return it; - * otherwise, set its first element to null. - * @see Collection#toArray(Object[]) - */ - private static E[] emptyArray(E[] array) { - return (array.length == 0) ? array : clearFirst(array); - } - - /** - * Set the specified array's first element to null and and return the array. - * Assume the array length > 0. - */ - private static E[] clearFirst(E[] array) { - array[0] = null; - return array; - } - - - // ********** add ********** - - /** - * Return a new array containing the elements in the - * specified array followed by the specified object to be added. - *

- * Arrays.add(Object[] array, Object o) - */ - public static E[] add(E[] array, E value) { - int len = array.length; - E[] result = newArray(array, len + 1); - if (len > 0) { - System.arraycopy(array, 0, result, 0, len); - } - result[len] = value; - return result; - } - - /** - * Return a new array containing the elements in the - * specified array with the specified object added at the specified index. - *

- * Arrays.add(Object[] array, int index, Object o) - */ - public static E[] add(E[] array, int index, E value) { - int len = array.length; - E[] result = newArray(array, len + 1); - if (index > 0) { - System.arraycopy(array, 0, result, 0, index); - } - result[index] = value; - if (index < len) { - System.arraycopy(array, index, result, index + 1, len - index); - } - return result; - } - - /** - * Return a new array containing the elements in the - * specified array followed by the specified value to be added. - *

- * Arrays.add(char[] array, char value) - */ - public static char[] add(char[] array, char value) { - int len = array.length; - char[] result = new char[len + 1]; - if (len > 0) { - System.arraycopy(array, 0, result, 0, len); - } - result[len] = value; - return result; - } - - /** - * Return a new array containing the elements in the - * specified array with the specified value added at the specified index. - *

- * Arrays.add(char[] array, int index, char value) - */ - public static char[] add(char[] array, int index, char value) { - int len = array.length; - char[] result = new char[len + 1]; - if (index > 0) { - System.arraycopy(array, 0, result, 0, index); - } - result[index] = value; - if (index < len) { - System.arraycopy(array, index, result, index + 1, len - index); - } - return result; - } - - /** - * Return a new array containing the elements in the - * specified array followed by the specified value to be added. - *

- * Arrays.add(int[] array, int value) - */ - public static int[] add(int[] array, int value) { - int len = array.length; - int[] result = new int[len + 1]; - if (len > 0) { - System.arraycopy(array, 0, result, 0, len); - } - result[len] = value; - return result; - } - - /** - * Return a new array containing the elements in the - * specified array with the specified value added at the specified index. - *

- * Arrays.add(int[] array, int index, int value) - */ - public static int[] add(int[] array, int index, int value) { - int len = array.length; - int[] result = new int[len + 1]; - if (index > 0) { - System.arraycopy(array, 0, result, 0, index); - } - result[index] = value; - if (index < len) { - System.arraycopy(array, index, result, index + 1, len - index); - } - return result; - } - - - // ********** add all ********** - - /** - * Return an array containing the elements in the - * specified array followed by the elements - * in the specified collection. - *

- * Arrays.addAll(Object[] array, Collection collection) - */ - public static E[] addAll(E[] array, Collection collection) { - return addAll(array, collection, collection.size()); - } - - /** - * check collection size - */ - private static E[] addAll(E[] array, Collection collection, int collectionSize) { - return (collectionSize == 0) ? array : addAll_(array, collection, collectionSize); - } - - /** - * assume the collection is non-empty - */ - private static E[] addAll_(E[] array, Collection collection) { - return addAll_(array, collection, collection.size()); - } - - /** - * assume collection size > zero - */ - private static E[] addAll_(E[] array, Collection collection, int collectionSize) { - return addAll(array, collection, array.length, collectionSize); - } - - /** - * assume collection size > zero; check array length - */ - private static E[] addAll(E[] array, Collection collection, int arrayLength, int collectionSize) { - return (arrayLength == 0) ? - collection.toArray(newArray(array, collectionSize)) : - addAll_(array, collection, arrayLength, collectionSize); - } - - /** - * assume array length and collection size > zero - */ - private static E[] addAll_(E[] array, Collection collection, int arrayLength, int collectionSize) { - E[] result = newArray(array, arrayLength + collectionSize); - System.arraycopy(array, 0, result, 0, arrayLength); - int i = arrayLength; - for (E element : collection) { - result[i++] = element; - } - return result; - } - - /** - * Return an array containing the elements in the - * specified array followed by the elements - * in the specified iterable. - *

- * Arrays.addAll(Object[] array, Iterable iterable) - */ - public static E[] addAll(E[] array, Iterable iterable) { - return addAll(array, iterable.iterator()); - } - - /** - * Return an array containing the elements in the - * specified array followed by the elements - * in the specified iterable. - * The specified iterable size is a performance hint. - *

- * Arrays.addAll(Object[] array, Iterable iterable) - */ - public static E[] addAll(E[] array, Iterable iterable, int iterableSize) { - return addAll(array, iterable.iterator(), iterableSize); - } - - /** - * Return an array containing the elements in the - * specified array followed by the elements - * in the specified iterator. - *

- * Arrays.addAll(Object[] array, Iterator iterator) - */ - public static E[] addAll(E[] array, Iterator iterator) { - return iterator.hasNext() ? addAll_(array, CollectionTools.list(iterator)) : array; - } - - /** - * Return an array containing the elements in the - * specified array followed by the elements - * in the specified iterator. - * The specified iterator size is a performance hint. - *

- * Arrays.addAll(Object[] array, Iterator iterator) - */ - public static E[] addAll(E[] array, Iterator iterator, int iteratorSize) { - return iterator.hasNext() ? addAll_(array, CollectionTools.list(iterator, iteratorSize)) : array; - } - - /** - * Return an array containing the elements in the - * specified array 1 followed by the elements - * in the specified array 2. - *

- * Arrays.addAll(Object[] array1, Object[] array2) - */ - public static E[] addAll(E[] array1, E... array2) { - return addAll(array1, array2, array2.length); - } - - /** - * check array 2 length - */ - private static E[] addAll(E[] array1, E[] array2, int array2Length) { - return (array2Length == 0) ? array1 : addAll_(array1, array2, array2Length); - } - - /** - * assume array 2 length > 0 - */ - private static E[] addAll_(E[] array1, E[] array2, int array2Length) { - return addAll(array1, array2, array1.length, array2Length); - } - - /** - * assume array 2 length > 0; check array 1 length - */ - private static E[] addAll(E[] array1, E[] array2, int array1Length, int array2Length) { - return (array1Length == 0) ? array2 : addAll_(array1, array2, array1Length, array2Length); - } - - /** - * assume both array lengths > 0 - */ - private static E[] addAll_(E[] array1, E[] array2, int array1Length, int array2Length) { - E[] result = newArray(array1, array1Length + array2Length); - System.arraycopy(array1, 0, result, 0, array1Length); - System.arraycopy(array2, 0, result, array1Length, array2Length); - return result; - } - - /** - * Return an array containing the elements in the - * first specified array with the objects in the second - * specified array added at the specified index. - *

- * Arrays.addAll(Object[] array1, int index, Object[] array2) - */ - public static E[] addAll(E[] array1, int index, E... array2) { - return addAll(array1, index, array2, array2.length); - } - - /** - * check array 2 length - */ - private static E[] addAll(E[] array1, int index, E[] array2, int array2Length) { - return (array2Length == 0) ? array1 : addAll_(array1, index, array2, array2Length); - } - - /** - * assume array 2 length > 0 - */ - private static E[] addAll_(E[] array1, int index, E[] array2, int array2Length) { - return addAll(array1, index, array2, array1.length, array2Length); - } - - /** - * assume array 2 length > 0; check array 1 length - */ - private static E[] addAll(E[] array1, int index, E[] array2, int array1Length, int array2Length) { - return (array1Length == 0) ? - array2 : - (index == array1Length) ? // 'array2' added to end of 'array1' - addAll_(array1, array2, array1Length, array2Length) : - addAll_(array1, index, array2, array1Length, array2Length); - } - - /** - * assume both array lengths > 0 and index != array 1 length - */ - private static E[] addAll_(E[] array1, int index, E[] array2, int array1Length, int array2Length) { - E[] result = newArray(array1, array1Length + array2Length); - System.arraycopy(array1, 0, result, 0, index); - System.arraycopy(array2, 0, result, index, array2Length); - System.arraycopy(array1, index, result, index + array2Length, array1Length - index); - return result; - } - - /** - * Return an array containing the elements in the - * specified array with the elements - * in the specified collection inserted at the specified index. - *

- * Arrays.addAll(Object[] array, int index, Collection c) - */ - public static E[] addAll(E[] array, int index, Collection collection) { - return addAll(array, index, collection, collection.size()); - } - - /** - * check collection size - */ - private static E[] addAll(E[] array, int index, Collection collection, int collectionSize) { - return (collectionSize == 0) ? array : addAll_(array, index, collection, collectionSize); - } - - /** - * assume collection size > 0 - */ - private static E[] addAll_(E[] array, int index, Collection collection, int collectionSize) { - return addAll(array, index, collection, array.length, collectionSize); - } - - /** - * assume collection size > 0; check array length - */ - private static E[] addAll(E[] array, int index, Collection collection, int arrayLength, int collectionSize) { - if (arrayLength == 0) { - if (index == 0) { - return collection.toArray(newArray(array, collectionSize)); - } - throw new IndexOutOfBoundsException("Index: " + index + ", Size: 0"); //$NON-NLS-1$ //$NON-NLS-2$ - } - return (index == arrayLength) ? // 'collection' added to end of 'array' - addAll_(array, collection, arrayLength, collectionSize) : - addAll_(array, index, collection, arrayLength, collectionSize); - } - - /** - * assume array length and collection size > 0 and index != array length - */ - private static E[] addAll_(E[] array, int index, Collection collection, int arrayLength, int collectionSize) { - E[] result = newArray(array, arrayLength + collectionSize); - System.arraycopy(array, 0, result, 0, index); - int i = index; - for (E item : collection) { - result[i++] = item; - } - System.arraycopy(array, index, result, index + collectionSize, arrayLength - index); - return result; - } - - /** - * Return an array containing the elements in the - * specified array with the elements - * in the specified iterable inserted at the specified index. - *

- * Arrays.addAll(Object[] array, int index, Iterable iterable) - */ - public static E[] addAll(E[] array, int index, Iterable iterable) { - return addAll(array, index, iterable.iterator()); - } - - /** - * Return an array containing the elements in the - * specified array with the elements - * in the specified iterable inserted at the specified index. - *

- * Arrays.addAll(Object[] array, int index, Iterable iterable) - */ - public static E[] addAll(E[] array, int index, Iterable iterable, int iterableSize) { - return addAll(array, index, iterable.iterator(), iterableSize); - } - - /** - * Return an array containing the elements in the - * specified array with the elements - * in the specified iterator inserted at the specified index. - *

- * Arrays.addAll(Object[] array, int index, Iterator iterator) - */ - public static E[] addAll(E[] array, int index, Iterator iterator) { - return iterator.hasNext() ? addAll_(array, index, CollectionTools.list(iterator)) : array; - } - - /** - * Return an array containing the elements in the - * specified array with the elements - * in the specified iterator inserted at the specified index. - * The specified iterator size is a performance hint. - *

- * Arrays.addAll(Object[] array, int index, Iterator iterator) - */ - public static E[] addAll(E[] array, int index, Iterator iterator, int iteratorSize) { - return iterator.hasNext() ? addAll_(array, index, CollectionTools.list(iterator, iteratorSize)) : array; - } - - /** - * assume collection is non-empty - */ - private static E[] addAll_(E[] array, int index, Collection collection) { - return addAll_(array, index, collection, collection.size()); - } - - /** - * Return an array containing the elements in the - * specified array 1 followed by the elements - * in the specified array 2. - *

- * Arrays.addAll(char[] array1, char[] array2) - */ - public static char[] addAll(char[] array1, char... array2) { - return addAll(array1, array2, array2.length); - } - - /** - * check array 2 length - */ - private static char[] addAll(char[] array1, char[] array2, int array2Length) { - return (array2Length == 0) ? array1 : addAll_(array1, array2, array2Length); - } - - /** - * assume array 2 length > 0 - */ - private static char[] addAll_(char[] array1, char[] array2, int array2Length) { - return addAll(array1, array2, array1.length, array2Length); - } - - /** - * assume array 2 length > 0; check array 1 length - */ - private static char[] addAll(char[] array1, char[] array2, int array1Length, int array2Length) { - return (array1Length == 0) ? array2 : addAll_(array1, array2, array1Length, array2Length); - } - - /** - * assume both array lengths > 0 - */ - private static char[] addAll_(char[] array1, char[] array2, int array1Length, int array2Length) { - char[] result = new char[array1Length + array2Length]; - System.arraycopy(array1, 0, result, 0, array1Length); - System.arraycopy(array2, 0, result, array1Length, array2Length); - return result; - } - - /** - * Return an array containing the elements in the - * first specified array with the objects in the second - * specified array added at the specified index. - *

- * Arrays.add(char[] array1, int index, char[] array2) - */ - public static char[] addAll(char[] array1, int index, char... array2) { - return addAll(array1, index, array2, array2.length); - } - - /** - * check array 2 length - */ - private static char[] addAll(char[] array1, int index, char[] array2, int array2Length) { - return (array2Length == 0) ? array1 : addAll_(array1, index, array2, array2Length); - } - - /** - * assume array 2 length > 0 - */ - private static char[] addAll_(char[] array1, int index, char[] array2, int array2Length) { - return addAll(array1, index, array2, array1.length, array2Length); - } - - /** - * assume array 2 length > 0; check array 1 length - */ - private static char[] addAll(char[] array1, int index, char[] array2, int array1Length, int array2Length) { - return (array1Length == 0) ? - array2 : - (index == array1Length) ? // 'array2' added to end of 'array1' - addAll_(array1, array2, array1Length, array2Length) : - addAll_(array1, index, array2, array1Length, array2Length); - } - - /** - * assume both array lengths > 0 and index != array 1 length - */ - private static char[] addAll_(char[] array1, int index, char[] array2, int array1Length, int array2Length) { - char[] result = new char[array1Length + array2Length]; - System.arraycopy(array1, 0, result, 0, index); - System.arraycopy(array2, 0, result, index, array2Length); - System.arraycopy(array1, index, result, index + array2Length, array1Length - index); - return result; - } - - /** - * Return an array containing the elements in the - * specified array 1 followed by the elements - * in the specified array 2. - *

- * Arrays.addAll(int[] array1, int[] array2) - */ - public static int[] addAll(int[] array1, int... array2) { - return addAll(array1, array2, array2.length); - } - - /** - * check array 2 length - */ - private static int[] addAll(int[] array1, int[] array2, int array2Length) { - return (array2Length == 0) ? array1 : addAll_(array1, array2, array2Length); - } - - /** - * assume array 2 length > 0 - */ - private static int[] addAll_(int[] array1, int[] array2, int array2Length) { - return addAll(array1, array2, array1.length, array2Length); - } - - /** - * assume array 2 length > 0; check array 1 length - */ - private static int[] addAll(int[] array1, int[] array2, int array1Length, int array2Length) { - return (array1Length == 0) ? array2 : addAll_(array1, array2, array1Length, array2Length); - } - - /** - * assume both array lengths > 0 - */ - private static int[] addAll_(int[] array1, int[] array2, int array1Length, int array2Length) { - int[] result = new int[array1Length + array2Length]; - System.arraycopy(array1, 0, result, 0, array1Length); - System.arraycopy(array2, 0, result, array1Length, array2Length); - return result; - } - - /** - * Return an array containing the elements in the - * first specified array with the objects in the second - * specified array added at the specified index. - *

- * Arrays.add(int[] array1, int index, int[] array2) - */ - public static int[] addAll(int[] array1, int index, int... array2) { - return addAll(array1, index, array2, array2.length); - } - - /** - * check array 2 length - */ - private static int[] addAll(int[] array1, int index, int[] array2, int array2Length) { - return (array2Length == 0) ? array1 : addAll_(array1, index, array2, array2Length); - } - - /** - * assume array 2 length > 0 - */ - private static int[] addAll_(int[] array1, int index, int[] array2, int array2Length) { - return addAll(array1, index, array2, array1.length, array2Length); - } - - /** - * assume array 2 length > 0; check array 1 length - */ - private static int[] addAll(int[] array1, int index, int[] array2, int array1Length, int array2Length) { - return (array1Length == 0) ? - array2 : - (index == array1Length) ? // 'array2' added to end of 'array1' - addAll_(array1, array2, array1Length, array2Length) : - addAll_(array1, index, array2, array1Length, array2Length); - } - - /** - * assume both array lengths > 0 and index != array 1 length - */ - private static int[] addAll_(int[] array1, int index, int[] array2, int array1Length, int array2Length) { - int[] result = new int[array1Length + array2Length]; - System.arraycopy(array1, 0, result, 0, index); - System.arraycopy(array2, 0, result, index, array2Length); - System.arraycopy(array1, index, result, index + array2Length, array1Length - index); - return result; - } - - - // ********** clear ********** - - /** - * Return an empty array with the same component type as the specified array. - *

- * Arrays.clear(Object[] array) - */ - public static E[] clear(E[] array) { - return (array.length == 0) ? array : newArray(array, 0); - } - - - // ********** concatenate ********** - - /** - * Return an array containing all the elements in all the - * specified arrays, concatenated in the specified order. - * This is useful for building constant arrays out of other constant arrays. - *

- * Arrays.concatenate(Object[]... arrays) - */ - public static E[] concatenate(E[]... arrays) { - int len = 0; - for (E[] array : arrays) { - len += array.length; - } - E[] result = newArray(arrays[0], len); - if (len == 0) { - return result; - } - int current = 0; - for (E[] array : arrays) { - int arrayLength = array.length; - if (arrayLength > 0) { - System.arraycopy(array, 0, result, current, arrayLength); - current += arrayLength; - } - } - return result; - } - - /** - * Return an array containing all the elements in all the - * specified arrays, concatenated in the specified order. - * This is useful for building constant arrays out other constant arrays. - *

- * Arrays.concatenate(char[]... arrays) - */ - public static char[] concatenate(char[]... arrays) { - int len = 0; - for (char[] array : arrays) { - len += array.length; - } - if (len == 0) { - return EMPTY_CHAR_ARRAY; - } - char[] result = new char[len]; - int current = 0; - for (char[] array : arrays) { - int arrayLength = array.length; - if (arrayLength != 0) { - System.arraycopy(array, 0, result, current, arrayLength); - current += arrayLength; - } - } - return result; - } - - /** - * Return an array containing all the elements in all the - * specified arrays, concatenated in the specified order. - * This is useful for building constant arrays out other constant arrays. - *

- * Arrays.concatenate(int[]... arrays) - */ - public static int[] concatenate(int[]... arrays) { - int len = 0; - for (int[] array : arrays) { - len += array.length; - } - if (len == 0) { - return EMPTY_INT_ARRAY; - } - int[] result = new int[len]; - int current = 0; - for (int[] array : arrays) { - int arrayLength = array.length; - if (arrayLength != 0) { - System.arraycopy(array, 0, result, current, arrayLength); - current += arrayLength; - } - } - return result; - } - - - // ********** contains ********** - - /** - * Return whether the specified array contains the - * specified element. - *

- * Arrays.contains(Object[] array, Object o) - */ - public static boolean contains(Object[] array, Object value) { - return contains(array, value, array.length); - } - - /** - * check array length - */ - private static boolean contains(Object[] array, Object value, int arrayLength) { - return (arrayLength == 0) ? false : contains_(array, value, arrayLength); - } - - /** - * assume array length > 0 - */ - public static boolean contains_(Object[] array, Object value, int arrayLength) { - if (value == null) { - for (int i = arrayLength; i-- > 0; ) { - if (array[i] == null) { - return true; - } - } - } else { - for (int i = arrayLength; i-- > 0; ) { - if (value.equals(array[i])) { - return true; - } - } - } - return false; - } - - /** - * Return whether the specified array contains the - * specified element. - *

- * Arrays.contains(char[] array, char value) - */ - public static boolean contains(char[] array, char value) { - return contains(array, value, array.length); - } - - /** - * check array length - */ - private static boolean contains(char[] array, char value, int arrayLength) { - return (arrayLength == 0) ? false : contains_(array, value, arrayLength); - } - - /** - * assume array length > 0 - */ - private static boolean contains_(char[] array, char value, int arrayLength) { - for (int i = arrayLength; i-- > 0; ) { - if (array[i] == value) { - return true; - } - } - return false; - } - - /** - * Return whether the specified array contains the - * specified element. - *

- * Arrays.contains(int[] array, int value) - */ - public static boolean contains(int[] array, int value) { - return contains(array, value, array.length); - } - - /** - * check array length - */ - private static boolean contains(int[] array, int value, int arrayLength) { - return (arrayLength == 0) ? false : contains_(array, value, arrayLength); - } - - /** - * assume array length > 0 - */ - private static boolean contains_(int[] array, int value, int arrayLength) { - for (int i = arrayLength; i-- > 0; ) { - if (array[i] == value) { - return true; - } - } - return false; - } - - - // ********** contains all ********** - - /** - * Return whether the specified array contains all of the - * elements in the specified collection. - *

- * Arrays.containsAll(Object[] array, Collection collection) - */ - public static boolean containsAll(Object[] array, Collection collection) { - return containsAll(array, collection.iterator()); - } - - /** - * Return whether the specified array contains all of the - * elements in the specified iterable. - *

- * Arrays.containsAll(Object[] array, Iterable iterable) - */ - public static boolean containsAll(Object[] array, Iterable iterable) { - return containsAll(array, iterable.iterator()); - } - - /** - * Return whether the specified array contains all of the - * elements in the specified iterator. - *

- * Arrays.containsAll(Object[] array, Iterator iterator) - */ - public static boolean containsAll(Object[] array, Iterator iterator) { - // use hashed lookup - HashSet set = CollectionTools.set(array); - while (iterator.hasNext()) { - if ( ! set.contains(iterator.next())) { - return false; - } - } - return true; - } - - /** - * Return whether the specified array 1 contains all of the - * elements in the specified array 2. - *

- * Arrays.containsAll(Object[] array1, Object[] array2) - */ - public static boolean containsAll(Object[] array1, Object... array2) { - // use hashed lookup - HashSet set = CollectionTools.set(array1); - for (int i = array2.length; i-- > 0; ) { - if ( ! set.contains(array2[i])) { - return false; - } - } - return true; - } - - /** - * Return whether the specified array 1 contains all of the - * elements in the specified array 2. - *

- * Arrays.containsAll(char[] array1, char[] array2) - */ - public static boolean containsAll(char[] array1, char... array2) { - for (int i = array2.length; i-- > 0; ) { - if ( ! contains(array1, array2[i])) { - return false; - } - } - return true; - } - - /** - * Return whether the specified array 1 contains all of the - * elements in the specified array 2. - *

- * Arrays.containsAll(int[] array1, int[] array2) - */ - public static boolean containsAll(int[] array1, int... array2) { - for (int i = array2.length; i-- > 0; ) { - if ( ! contains(array1, array2[i])) { - return false; - } - } - return true; - } - - - // ********** diff ********** - - /** - * Return the index of the first elements in the specified - * arrays that are different, beginning at the end. - * If the arrays are identical, return -1. - * If the arrays are different sizes, return the index of the - * last element in the longer array. - * Use the elements' {@link Object#equals(Object)} method to compare the - * elements. - */ - public static int diffEnd(Object[] array1, Object[] array2) { - int len1 = array1.length; - int len2 = array2.length; - if (len1 != len2) { - return Math.max(len1, len2) - 1; - } - for (int i = len1 - 1; i > -1; i--) { - Object o = array1[i]; - if (o == null) { - if (array2[i] != null) { - return i; - } - } else { - if ( ! o.equals(array2[i])) { - return i; - } - } - } - return -1; - } - - /** - * Return the range of elements in the specified - * arrays that are different. - * If the arrays are identical, return [size, -1]. - * Use the elements' {@link Object#equals(Object)} method to compare the - * elements. - * @see #diffStart(Object[], Object[]) - * @see #diffEnd(Object[], Object[]) - */ - public static Range diffRange(Object[] array1, Object[] array2) { - int end = diffEnd(array1, array2); - if (end == -1) { - // the lists are identical, the start is the size of the two lists - return new Range(array1.length, end); - } - // the lists are different, calculate the start of the range - return new Range(diffStart(array1, array2), end); - } - - /** - * Return the index of the first elements in the specified - * arrays that are different. If the arrays are identical, return - * the size of the two arrays (i.e. one past the last index). - * If the arrays are different sizes and all the elements in - * the shorter array match their corresponding elements in - * the longer array, return the size of the shorter array - * (i.e. one past the last index of the shorter array). - * Use the elements' {@link Object#equals(Object)} method to compare the - * elements. - */ - public static int diffStart(Object[] array1, Object[] array2) { - int end = Math.min(array1.length, array2.length); - for (int i = 0; i < end; i++) { - Object o = array1[i]; - if (o == null) { - if (array2[i] != null) { - return i; - } - } else { - if ( ! o.equals(array2[i])) { - return i; - } - } - } - return end; - } - - - // ********** identity diff ********** - - /** - * Return the index of the first elements in the specified - * arrays that are different, beginning at the end. - * If the arrays are identical, return -1. - * If the arrays are different sizes, return the index of the - * last element in the longer array. - * Use object identity to compare the elements. - */ - public static int identityDiffEnd(Object[] array1, Object[] array2) { - int len1 = array1.length; - int len2 = array2.length; - if (len1 != len2) { - return Math.max(len1, len2) - 1; - } - for (int i = len1 - 1; i > -1; i--) { - if (array1[i] != array2[i]) { - return i; - } - } - return -1; - } - - /** - * Return the range of elements in the specified - * arrays that are different. - * If the arrays are identical, return [size, -1]. - * Use object identity to compare the elements. - * @see #identityDiffStart(Object[], Object[]) - * @see #identityDiffEnd(Object[], Object[]) - */ - public static Range identityDiffRange(Object[] array1, Object[] array2) { - int end = identityDiffEnd(array1, array2); - if (end == -1) { - // the lists are identical, the start is the size of the two lists - return new Range(array1.length, end); - } - // the lists are different, calculate the start of the range - return new Range(identityDiffStart(array1, array2), end); - } - - /** - * Return the index of the first elements in the specified - * arrays that are different. If the arrays are identical, return - * the size of the two arrays (i.e. one past the last index). - * If the arrays are different sizes and all the elements in - * the shorter array match their corresponding elements in - * the longer array, return the size of the shorter array - * (i.e. one past the last index of the shorter array). - * Use object identity to compare the elements. - */ - public static int identityDiffStart(Object[] array1, Object[] array2) { - int end = Math.min(array1.length, array2.length); - for (int i = 0; i < end; i++) { - if (array1[i] != array2[i]) { - return i; - } - } - return end; - } - - - // ********** elements are identical ********** - - /** - * Return whether the specified arrays contain the same elements. - *

- * Arrays.identical(Object[] array1, Object[] array2) - */ - public static boolean elementsAreIdentical(Object[] array1, Object[] array2) { - if (array1 == array2) { - return true; - } - if (array1 == null || array2 == null) { - return false; - } - int length = array1.length; - if (array2.length != length) { - return false; - } - for (int i = length; i-- > 0; ) { - if (array1[i] != array2[i]) { - return false; - } - } - return true; - } - - - // ********** index of ********** - - /** - * Return the index of the first occurrence of the - * specified element in the specified array, - * or return -1 if there is no such index. - *

- * Arrays.indexOf(Object[] array, Object o) - */ - public static int indexOf(Object[] array, Object value) { - int len = array.length; - if (value == null) { - for (int i = 0; i < len; i++) { - if (array[i] == null) { - return i; - } - } - } else { - for (int i = 0; i < len; i++) { - if (value.equals(array[i])) { - return i; - } - } - } - return -1; - } - - /** - * Return the index of the first occurrence of the - * specified element in the specified array, - * or return -1 if there is no such index. - *

- * Arrays.identityIndexOf(Object[] array, Object o) - */ - public static int identityIndexOf(Object[] array, Object value) { - int len = array.length; - for (int i = 0; i < len; i++) { - if (array[i] == value) { - return i; - } - } - return -1; - } - - /** - * Return the index of the first occurrence of the - * specified element in the specified array, - * or return -1 if there is no such index. - *

- * Arrays.indexOf(char[] array, char value) - */ - public static int indexOf(char[] array, char value) { - int len = array.length; - for (int i = 0; i < len; i++) { - if (array[i] == value) { - return i; - } - } - return -1; - } - - /** - * Return the index of the first occurrence of the - * specified element in the specified array, - * or return -1 if there is no such index. - *

- * Arrays.indexOf(int[] array, int value) - */ - public static int indexOf(int[] array, int value) { - int len = array.length; - for (int i = 0; i < len; i++) { - if (array[i] == value) { - return i; - } - } - return -1; - } - - - // ********** insertion index of ********** - - /** - * Return the maximum index of where the specified comparable object - * should be inserted into the specified sorted array and still keep - * the array sorted. - */ - public static > int insertionIndexOf(E[] sortedArray, Comparable value) { - int len = sortedArray.length; - for (int i = 0; i < len; i++) { - if (value.compareTo(sortedArray[i]) < 0) { - return i; - } - } - return len; - } - - /** - * Return the maximum index of where the specified comparable object - * should be inserted into the specified sorted array and still keep - * the array sorted. - */ - public static int insertionIndexOf(E[] sortedArray, E value, Comparator comparator) { - int len = sortedArray.length; - for (int i = 0; i < len; i++) { - if (comparator.compare(value, sortedArray[i]) < 0) { - return i; - } - } - return len; - } - - - // ********** last index of ********** - - /** - * Return the index of the last occurrence of the - * specified element in the specified array; - * return -1 if there is no such index. - *

- * Arrays.lastIndexOf(Object[] array, Object o) - */ - public static int lastIndexOf(Object[] array, Object value) { - int len = array.length; - if (value == null) { - for (int i = len; i-- > 0; ) { - if (array[i] == null) { - return i; - } - } - } else { - for (int i = len; i-- > 0; ) { - if (value.equals(array[i])) { - return i; - } - } - } - return -1; - } - - /** - * Return the index of the last occurrence of the - * specified element in the specified array, - * or return -1 if there is no such index. - *

- * Arrays.lastIndexOf(char[] array, char value) - */ - public static int lastIndexOf(char[] array, char value) { - for (int i = array.length; i-- > 0; ) { - if (array[i] == value) { - return i; - } - } - return -1; - } - - /** - * Return the index of the last occurrence of the - * specified element in the specified array, - * or return -1 if there is no such index. - *

- * Arrays.lastIndexOf(int[] array, int value) - */ - public static int lastIndexOf(int[] array, int value) { - for (int i = array.length; i-- > 0; ) { - if (array[i] == value) { - return i; - } - } - return -1; - } - - - // ********** min/max ********** - - /** - * Return the character from the specified array with the minimum value. - *

- * Arrays.min(char[] array) - */ - public static char min(char... array) { - int len = array.length; - if (len == 0) { - throw new IndexOutOfBoundsException(); - } - int last = len - 1; - char min = array[last]; - for (int i = last; i-- > 0; ) { - char c = array[i]; - if (c < min) { - min = c; - } - } - return min; - } - - /** - * Return the integer from the specified array with the minimum value. - *

- * Arrays.min(int[] array) - */ - public static int min(int... array) { - int len = array.length; - if (len == 0) { - throw new IndexOutOfBoundsException(); - } - int last = len - 1; - int min = array[last]; - for (int i = last; i-- > 0; ) { - int x = array[i]; - if (x < min) { - min = x; - } - } - return min; - } - - /** - * Return the character from the specified array with the maximum value. - *

- * Arrays.max(char[] array) - */ - public static char max(char... array) { - int len = array.length; - if (len == 0) { - throw new IndexOutOfBoundsException(); - } - int last = len - 1; - char max = array[last]; - for (int i = last; i-- > 0; ) { - char c = array[i]; - if (c > max) { - max = c; - } - } - return max; - } - - /** - * Return the integer from the specified array with the maximum value. - *

- * Arrays.max(int[] array) - */ - public static int max(int... array) { - int len = array.length; - if (len == 0) { - throw new IndexOutOfBoundsException(); - } - int last = len - 1; - int max = array[last]; - for (int i = last; i-- > 0; ) { - int x = array[i]; - if (x > max) { - max = x; - } - } - return max; - } - - - // ********** move ********** - - /** - * Move an element from the specified source index to the specified target - * index. Return the altered array. - *

- * Arrays.move(Object[] array, int targetIndex, int sourceIndex) - */ - public static E[] move(E[] array, int targetIndex, int sourceIndex) { - return (targetIndex == sourceIndex) ? array : move_(array, targetIndex, sourceIndex); - } - - /** - * assume target index != source index - */ - private static E[] move_(E[] array, int targetIndex, int sourceIndex) { - E temp = array[sourceIndex]; - if (targetIndex < sourceIndex) { - System.arraycopy(array, targetIndex, array, targetIndex + 1, sourceIndex - targetIndex); - } else { - System.arraycopy(array, sourceIndex + 1, array, sourceIndex, targetIndex - sourceIndex); - } - array[targetIndex] = temp; - return array; - } - - /** - * Move elements from the specified source index to the specified target - * index. Return the altered array. - *

- * Arrays.move(Object[] array, int targetIndex, int sourceIndex, int length) - */ - public static E[] move(E[] array, int targetIndex, int sourceIndex, int length) { - if ((targetIndex == sourceIndex) || (length == 0)) { - return array; - } - if (length == 1) { - return move_(array, targetIndex, sourceIndex); - } - E[] temp = newArray(array, length); - System.arraycopy(array, sourceIndex, temp, 0, length); - if (targetIndex < sourceIndex) { - System.arraycopy(array, targetIndex, array, targetIndex + length, sourceIndex - targetIndex); - } else { - System.arraycopy(array, sourceIndex + length, array, sourceIndex, targetIndex - sourceIndex); - } - System.arraycopy(temp, 0, array, targetIndex, length); - return array; - } - - /** - * Move an element from the specified source index to the specified target - * index. Return the altered array. - *

- * Arrays.move(int[] array, int targetIndex, int sourceIndex) - */ - public static int[] move(int[] array, int targetIndex, int sourceIndex) { - return (targetIndex == sourceIndex) ? array : move_(array, targetIndex, sourceIndex); - } - - /** - * assume targetIndex != sourceIndex - */ - private static int[] move_(int[] array, int targetIndex, int sourceIndex) { - int temp = array[sourceIndex]; - if (targetIndex < sourceIndex) { - System.arraycopy(array, targetIndex, array, targetIndex + 1, sourceIndex - targetIndex); - } else { - System.arraycopy(array, sourceIndex + 1, array, sourceIndex, targetIndex - sourceIndex); - } - array[targetIndex] = temp; - return array; - } - - /** - * Move elements from the specified source index to the specified target - * index. Return the altered array. - *

- * Arrays.move(int[] array, int targetIndex, int sourceIndex, int length) - */ - public static int[] move(int[] array, int targetIndex, int sourceIndex, int length) { - if ((targetIndex == sourceIndex) || (length == 0)) { - return array; - } - if (length == 1) { - return move_(array, targetIndex, sourceIndex); - } - int[] temp = new int[length]; - System.arraycopy(array, sourceIndex, temp, 0, length); - if (targetIndex < sourceIndex) { - System.arraycopy(array, targetIndex, array, targetIndex + length, sourceIndex - targetIndex); - } else { - System.arraycopy(array, sourceIndex + length, array, sourceIndex, targetIndex - sourceIndex); - } - System.arraycopy(temp, 0, array, targetIndex, length); - return array; - } - - /** - * Move an element from the specified source index to the specified target - * index. Return the altered array. - *

- * Arrays.move(char[] array, int targetIndex, int sourceIndex) - */ - public static char[] move(char[] array, int targetIndex, int sourceIndex) { - return (targetIndex == sourceIndex) ? array : move_(array, targetIndex, sourceIndex); - } - - /** - * assume targetIndex != sourceIndex - */ - private static char[] move_(char[] array, int targetIndex, int sourceIndex) { - char temp = array[sourceIndex]; - if (targetIndex < sourceIndex) { - System.arraycopy(array, targetIndex, array, targetIndex + 1, sourceIndex - targetIndex); - } else { - System.arraycopy(array, sourceIndex + 1, array, sourceIndex, targetIndex - sourceIndex); - } - array[targetIndex] = temp; - return array; - } - - /** - * Move elements from the specified source index to the specified target - * index. Return the altered array. - *

- * Arrays.move(char[] array, int targetIndex, int sourceIndex, int length) - */ - public static char[] move(char[] array, int targetIndex, int sourceIndex, int length) { - if ((targetIndex == sourceIndex) || (length == 0)) { - return array; - } - if (length == 1) { - return move_(array, targetIndex, sourceIndex); - } - char[] temp = new char[length]; - System.arraycopy(array, sourceIndex, temp, 0, length); - if (targetIndex < sourceIndex) { - System.arraycopy(array, targetIndex, array, targetIndex + length, sourceIndex - targetIndex); - } else { - System.arraycopy(array, sourceIndex + length, array, sourceIndex, targetIndex - sourceIndex); - } - System.arraycopy(temp, 0, array, targetIndex, length); - return array; - } - - - // ********** remove ********** - - /** - * Return a new array that contains the elements in the - * specified array with the specified element removed. - *

- * Arrays.remove(Object[] array, Object value) - */ - public static E[] remove(E[] array, Object value) { - return removeElementAtIndex(array, indexOf(array, value)); - } - - /** - * Return a new array that contains the elements in the - * specified array with the specified element removed. - *

- * Arrays.remove(char[] array, char value) - */ - public static char[] remove(char[] array, char value) { - return removeElementAtIndex(array, indexOf(array, value)); - } - - /** - * Return a new array that contains the elements in the - * specified array with the specified element removed. - *

- * Arrays.remove(int[] array, int value) - */ - public static int[] remove(int[] array, int value) { - return removeElementAtIndex(array, indexOf(array, value)); - } - - /** - * Return a new array that contains the elements in the - * specified array with the first element removed. - *

- * Arrays.removeFirst(Object[] array) - */ - public static E[] removeFirst(E[] array) { - return removeElementAtIndex(array, 0); - } - - /** - * Return a new array that contains the elements in the - * specified array with the first element removed. - *

- * Arrays.removeFirst(char[] array) - */ - public static char[] removeFirst(char[] array) { - return removeElementAtIndex(array, 0); - } - - /** - * Return a new array that contains the elements in the - * specified array with the first element removed. - *

- * Arrays.removeFirst(int[] array) - */ - public static int[] removeFirst(int[] array) { - return removeElementAtIndex(array, 0); - } - - /** - * Return a new array that contains the elements in the - * specified array with the last element removed. - *

- * Arrays.removeLast(Object[] array) - */ - public static E[] removeLast(E[] array) { - return removeElementAtIndex(array, array.length - 1); - } - - /** - * Return a new array that contains the elements in the - * specified array with the last element removed. - *

- * Arrays.removeLast(char[] array) - */ - public static char[] removeLast(char[] array) { - return removeElementAtIndex(array, array.length - 1); - } - - /** - * Return a new array that contains the elements in the - * specified array with the last element removed. - *

- * Arrays.removeLast(int[] array) - */ - public static int[] removeLast(int[] array) { - return removeElementAtIndex(array, array.length - 1); - } - - - // ********** remove all ********** - - /** - * Remove from the specified array all the elements in - * the specified iterable and return the result. - *

- * Arrays.removeAll(Object[] array, Iterable iterable) - */ - public static E[] removeAll(E[] array, Iterable iterable) { - return removeAll(array, iterable.iterator()); - } - - /** - * Remove from the specified array all the elements in - * the specified iterable and return the result. - * The specified iterable size is a performance hint. - *

- * Arrays.removeAll(Object[] array, Iterable iterable) - */ - public static E[] removeAll(E[] array, Iterable iterable, int iterableSize) { - return removeAll(array, iterable.iterator(), iterableSize); - } - - /** - * Remove from the specified array all the elements in - * the specified iterator and return the result. - *

- * Arrays.removeAll(Object[] array, Iterator iterator) - */ - public static E[] removeAll(E[] array, Iterator iterator) { - // convert to a set to take advantage of hashed look-up - return iterator.hasNext() ? removeAll_(array, CollectionTools.set(iterator)) : array; - } - - /** - * Remove from the specified array all the elements in - * the specified iterator and return the result. - * The specified iterator size is a performance hint. - *

- * Arrays.removeAll(Object[] array, Iterator iterator) - */ - public static E[] removeAll(E[] array, Iterator iterator, int iteratorSize) { - // convert to a set to take advantage of hashed look-up - return iterator.hasNext() ? removeAll_(array, CollectionTools.set(iterator, iteratorSize)) : array; - } - - /** - * Remove from the specified array all the elements in - * the specified collection and return the result. - *

- * Arrays.removeAll(Object[] array, Collection collection) - */ - public static E[] removeAll(E[] array, Collection collection) { - return collection.isEmpty() ? array : removeAll_(array, collection); - } - - /** - * assume collection is non-empty - */ - private static E[] removeAll_(E[] array, Collection collection) { - return removeAll(array, collection, array.length); - } - - /** - * assume collection is non-empty; check array length - */ - private static E[] removeAll(E[] array, Collection collection, int arrayLength) { - return (arrayLength == 0) ? array : removeAll_(array, collection, arrayLength); - } - - /** - * assume collection is non-empty and array length > 0 - */ - private static E[] removeAll_(E[] array, Collection collection, int arrayLength) { - // build the indices of the elements that are to remain - int[] indices = new int[arrayLength]; - int j = 0; - for (int i = 0; i < arrayLength; i++) { - if ( ! collection.contains(array[i])) { - indices[j++] = i; - } - } - if (j == arrayLength) { - return array; // nothing was removed - } - E[] result = newArray(array, j); - int resultLength = result.length; - for (int i = 0; i < resultLength; i++) { - result[i] = array[indices[i]]; - } - return result; - } - - /** - * Remove from the first specified array all the elements in - * the second specified array and return the result. - *

- * Arrays.removeAll(Object[] array1, Object[] array2) - */ - public static E[] removeAll(E[] array1, Object... array2) { - // convert to a set to take advantage of hashed look-up - return (array2.length == 0) ? array1 : removeAll_(array1, CollectionTools.set(array2)); - } - - /** - * Remove from the first specified array all the elements in - * the second specified array and return the result. - *

- * Arrays#removeAll(char[] array1, char[] array2) - */ - public static char[] removeAll(char[] array1, char... array2) { - if (array2.length == 0) { - return array1; - } - int array1Length = array1.length; - if (array1Length == 0) { - return array1; - } - int[] indices = new int[array1Length]; - int j = 0; - for (int i = 0; i < array1Length; i++) { - if ( ! contains(array2, array1[i])) { - indices[j++] = i; - } - } - if (j == array1Length) { - return array1; // nothing was removed - } - char[] result = new char[j]; - int resultLength = result.length; - for (int i = 0; i < resultLength; i++) { - result[i] = array1[indices[i]]; - } - return result; - } - - /** - * Remove from the first specified array all the elements in - * the second specified array and return the result. - *

- * Arrays#removeAll(int[] array1, int[] array2) - */ - public static int[] removeAll(int[] array1, int... array2) { - if (array2.length == 0) { - return array1; - } - int array1Length = array1.length; - if (array1Length == 0) { - return array1; - } - int[] indices = new int[array1Length]; - int j = 0; - for (int i = 0; i < array1Length; i++) { - if ( ! contains(array2, array1[i])) { - indices[j++] = i; - } - } - if (j == array1Length) { - return array1; // nothing was removed - } - int[] result = new int[j]; - int resultLength = result.length; - for (int i = 0; i < resultLength; i++) { - result[i] = array1[indices[i]]; - } - return result; - } - - - // ********** remove all occurrences ********** - - /** - * Remove from the specified array all occurrences of - * the specified element and return the result. - *

- * Arrays.removeAllOccurrences(Object[] array, Object value) - */ - public static E[] removeAllOccurrences(E[] array, Object value) { - int arrayLength = array.length; - if (arrayLength == 0) { - return array; - } - int[] indices = new int[arrayLength]; - int j = 0; - if (value == null) { - for (int i = arrayLength; i-- > 0; ) { - if (array[i] != null) { - indices[j++] = i; - } - } - } else { - for (int i = array.length; i-- > 0; ) { - if ( ! value.equals(array[i])) { - indices[j++] = i; - } - } - } - if (j == arrayLength) { - return array; // nothing was removed - } - E[] result = newArray(array, j); - int resultLength = result.length; - for (int i = 0; i < resultLength; i++) { - result[i] = array[indices[i]]; - } - return result; - } - - /** - * Remove from the specified array all occurrences of - * the specified element and return the result. - *

- * Arrays.removeAllOccurrences(char[] array, char value) - */ - public static char[] removeAllOccurrences(char[] array, char value) { - int arrayLength = array.length; - if (arrayLength == 0) { - return array; - } - int[] indices = new int[arrayLength]; - int j = 0; - for (int i = arrayLength; i-- > 0; ) { - if (array[i] != value) { - indices[j++] = i; - } - } - if (j == arrayLength) { - return array; // nothing was removed - } - char[] result = new char[j]; - int resultLength = result.length; - for (int i = 0; i < resultLength; i++) { - result[i] = array[indices[i]]; - } - return result; - } - - /** - * Remove from the specified array all occurrences of - * the specified element and return the result. - *

- * Arrays.removeAllOccurrences(int[] array, int value) - */ - public static int[] removeAllOccurrences(int[] array, int value) { - int arrayLength = array.length; - if (arrayLength == 0) { - return array; - } - int[] indices = new int[arrayLength]; - int j = 0; - for (int i = arrayLength; i-- > 0; ) { - if (array[i] != value) { - indices[j++] = i; - } - } - if (j == arrayLength) { - return array; // nothing was removed - } - int[] result = new int[j]; - int resultLength = result.length; - for (int i = 0; i < resultLength; i++) { - result[i] = array[indices[i]]; - } - return result; - } - - - // ********** remove duplicate elements ********** - - /** - * Remove any duplicate elements from the specified array, - * while maintaining the order. - */ - public static E[] removeDuplicateElements(E... array) { - int len = array.length; - if ((len == 0) || (len == 1)) { - return array; - } - ArrayList temp = CollectionTools.list(array); - return CollectionTools.removeDuplicateElements(temp, len) ? - temp.toArray(newArray(array, temp.size())) : - array; - } - - - // ********** remove element at index ********** - - /** - * Return a new array that contains the elements in the - * specified array with the specified element removed. - *

- * Arrays.removeElementAtIndex(Object[] array, int index) - */ - public static E[] removeElementAtIndex(E[] array, int index) { - return removeElementsAtIndex(array, index, 1); - } - - /** - * Return a new array that contains the elements in the - * specified array with the specified element removed. - *

- * Arrays.removeElementAtIndex(char[] array, int index) - */ - public static char[] removeElementAtIndex(char[] array, int index) { - return removeElementsAtIndex(array, index, 1); - } - - /** - * Return a new array that contains the elements in the - * specified array with the specified element removed. - *

- * Arrays.removeElementAtIndex(int[] array, int index) - */ - public static int[] removeElementAtIndex(int[] array, int index) { - return removeElementsAtIndex(array, index, 1); - } - - - // ********** remove elements at index ********** - - /** - * Return a new array that contains the elements in the - * specified array with the specified elements removed. - *

- * Arrays.removeElementsAtIndex(Object[] array, int index, int length) - */ - public static E[] removeElementsAtIndex(E[] array, int index, int length) { - if (length == 0) { - return array; - } - int arrayLength = array.length; - int newLength = arrayLength - length; - E[] result = newArray(array, newLength); - if ((newLength == 0) && (index == 0)) { - return result; // performance tweak - } - if (index != 0) { - System.arraycopy(array, 0, result, 0, index); - } - int length2 = newLength - index; - if (length2 != 0) { - System.arraycopy(array, index + length, result, index, length2); - } - return result; - } - - /** - * Return a new array that contains the elements in the - * specified array with the specified elements removed. - *

- * Arrays.removeElementsAtIndex(char[] array, int index, int length) - */ - public static char[] removeElementsAtIndex(char[] array, int index, int length) { - if (length == 0) { - return array; - } - int arrayLength = array.length; - int newLength = arrayLength - length; - if ((newLength == 0) && (index == 0)) { - return EMPTY_CHAR_ARRAY; // performance tweak - } - char[] result = new char[newLength]; - if (index != 0) { - System.arraycopy(array, 0, result, 0, index); - } - int length2 = newLength - index; - if (length2 != 0) { - System.arraycopy(array, index + length, result, index, length2); - } - return result; - } - - /** - * Return a new array that contains the elements in the - * specified array with the specified elements removed. - *

- * Arrays.removeElementsAtIndex(int[] array, int index, int length) - */ - public static int[] removeElementsAtIndex(int[] array, int index, int length) { - if (length == 0) { - return array; - } - int arrayLength = array.length; - int newLength = arrayLength - length; - if ((newLength == 0) && (index == 0)) { - return EMPTY_INT_ARRAY; // performance tweak - } - int[] result = new int[newLength]; - if (index != 0) { - System.arraycopy(array, 0, result, 0, index); - } - int length2 = newLength - index; - if (length2 != 0) { - System.arraycopy(array, index + length, result, index, length2); - } - return result; - } - - - // ********** replace all ********** - - /** - * Replace all occurrences of the specified old value with - * the specified new value. Return the altered array. - *

- * Arrays.replaceAll(Object[] array, Object oldValue, Object newValue) - */ - public static E[] replaceAll(E[] array, Object oldValue, E newValue) { - if (oldValue == null) { - for (int i = array.length; i-- > 0; ) { - if (array[i] == null) { - array[i] = newValue; - } - } - } else { - for (int i = array.length; i-- > 0; ) { - if (oldValue.equals(array[i])) { - array[i] = newValue; - } - } - } - return array; - } - - /** - * Replace all occurrences of the specified old value with - * the specified new value. Return the altered array. - *

- * Arrays.replaceAll(int[] array, int oldValue, int newValue) - */ - public static int[] replaceAll(int[] array, int oldValue, int newValue) { - for (int i = array.length; i-- > 0; ) { - if (array[i] == oldValue) { - array[i] = newValue; - } - } - return array; - } - - /** - * Replace all occurrences of the specified old value with - * the specified new value. Return the altered array. - *

- * Arrays.replaceAll(char[] array, char oldValue, char newValue) - */ - public static char[] replaceAll(char[] array, char oldValue, char newValue) { - for (int i = array.length; i-- > 0; ) { - if (array[i] == oldValue) { - array[i] = newValue; - } - } - return array; - } - - - // ********** retain all ********** - - /** - * Retain in the specified array all the elements in - * the specified iterable and return the result. - *

- * Arrays.retainAll(Object[] array, Iterable iterable) - */ - public static E[] retainAll(E[] array, Iterable iterable) { - int arrayLength = array.length; - return (arrayLength == 0) ? array : retainAll(array, arrayLength, iterable.iterator()); - } - - /** - * Retain in the specified array all the elements in - * the specified iterable and return the result. - * The specified iterable size is a performance hint. - *

- * Arrays.retainAll(Object[] array, Iterable iterable) - */ - public static E[] retainAll(E[] array, Iterable iterable, int iterableSize) { - int arrayLength = array.length; - return (arrayLength == 0) ? array : retainAll(array, arrayLength, iterable.iterator(), iterableSize); - } - - /** - * Retain in the specified array all the elements in - * the specified iterator and return the result. - *

- * Arrays.retainAll(Object[] array, Iterator iterator) - */ - public static E[] retainAll(E[] array, Iterator iterator) { - int arrayLength = array.length; - return (arrayLength == 0) ? array : retainAll(array, arrayLength, iterator); - } - - /** - * Retain in the specified array all the elements in - * the specified iterator and return the result. - * The specified iterator size is a performance hint. - *

- * Arrays.retainAll(Object[] array, Iterator iterator) - */ - public static E[] retainAll(E[] array, Iterator iterator, int iteratorSize) { - int arrayLength = array.length; - return (arrayLength == 0) ? array : retainAll(array, arrayLength, iterator, iteratorSize); - } - - /** - * assume array length > 0 - */ - private static E[] retainAll(E[] array, int arrayLength, Iterator iterator) { - return iterator.hasNext() ? - retainAll_(array, CollectionTools.set(iterator), arrayLength) : - newArray(array, 0); - } - - /** - * assume array length > 0 - */ - private static E[] retainAll(E[] array, int arrayLength, Iterator iterator, int iteratorSize) { - return iterator.hasNext() ? - retainAll_(array, CollectionTools.set(iterator, iteratorSize), arrayLength) : - newArray(array, 0); - } - - /** - * Retain in the specified array all the elements in - * the specified collection and return the result. - *

- * Arrays.retainAll(Object[] array, Collection collection) - */ - public static E[] retainAll(E[] array, Collection collection) { - int arrayLength = array.length; - return (arrayLength == 0) ? array : retainAll(array, collection, arrayLength); - } - - /** - * assume array length > 0 - */ - private static E[] retainAll(E[] array, Collection collection, int arrayLength) { - return collection.isEmpty() ? - newArray(array, 0) : - retainAll_(array, collection, arrayLength); - } - - /** - * assume collection is non-empty and array length > 0 - */ - private static E[] retainAll_(E[] array, Collection collection, int arrayLength) { - int[] indices = new int[arrayLength]; - int j = 0; - for (int i = 0; i < arrayLength; i++) { - if (collection.contains(array[i])) { - indices[j++] = i; - } - } - if (j == arrayLength) { - return array; // everything was retained - } - E[] result = newArray(array, j); - int resultLength = result.length; - for (int i = 0; i < resultLength; i++) { - result[i] = array[indices[i]]; - } - return result; - } - - /** - * Remove from the first specified array all the elements in - * the second specified array and return the result. - *

- * Arrays.retainAll(Object[] array1, Object[] array2) - */ - public static E[] retainAll(E[] array1, Object[] array2) { - int array1Length = array1.length; - return (array1Length == 0) ? - array1 : - (array2.length == 0) ? - newArray(array1, 0) : - retainAll(array1, CollectionTools.set(array2), array1Length); - } - - /** - * Remove from the first specified array all the elements in - * the second specified array and return the result. - *

- * Arrays.retainAll(char[] array1, char[] array2) - */ - public static char[] retainAll(char[] array1, char... array2) { - int array1Length = array1.length; - return (array1Length == 0) ? array1 : retainAll(array1, array2, array1Length); - } - - /** - * assume array 1 length > 0 - */ - private static char[] retainAll(char[] array1, char[] array2, int array1Length) { - int array2Length = array2.length; - return (array2Length == 0) ? EMPTY_CHAR_ARRAY : retainAll(array1, array2, array1Length, array2Length); - } - - /** - * assume both array lengths > 0 - */ - private static char[] retainAll(char[] array1, char[] array2, int array1Length, int array2Length) { - int[] indices = new int[array1Length]; - int j = 0; - for (int i = 0; i < array1Length; i++) { - if (contains_(array2, array1[i], array2Length)) { - indices[j++] = i; - } - } - if (j == array1Length) { - return array1; // everything was retained - } - char[] result = new char[j]; - int resultLength = result.length; - for (int i = 0; i < resultLength; i++) { - result[i] = array1[indices[i]]; - } - return result; - } - - /** - * Remove from the first specified array all the elements in - * the second specified array and return the result. - *

- * Arrays.retainAll(int[] array1, int[] array2) - */ - public static int[] retainAll(int[] array1, int... array2) { - int array1Length = array1.length; - return (array1Length == 0) ? array1 : retainAll(array1, array2, array1Length); - } - - /** - * assume array 1 length > 0 - */ - private static int[] retainAll(int[] array1, int[] array2, int array1Length) { - int array2Length = array2.length; - return (array2Length == 0) ? EMPTY_INT_ARRAY : retainAll(array1, array2, array1Length, array2Length); - } - - /** - * assume both array lengths > 0 - */ - private static int[] retainAll(int[] array1, int[] array2, int array1Length, int array2Length) { - int[] indices = new int[array1Length]; - int j = 0; - for (int i = 0; i < array1Length; i++) { - if (contains_(array2, array1[i], array2Length)) { - indices[j++] = i; - } - } - if (j == array1Length) { - return array1; // everything was retained - } - int[] result = new int[j]; - int resultLength = result.length; - for (int i = 0; i < resultLength; i++) { - result[i] = array1[indices[i]]; - } - return result; - } - - - // ********** reverse ********** - - /** - * Return the array, reversed. - *

- * Arrays.reverse(Object... array) - */ - public static E[] reverse(E... array) { - int len = array.length; - if ((len == 0) || (len == 1)) { - return array; - } - for (int i = 0, mid = len >> 1, j = len - 1; i < mid; i++, j--) { - swap(array, i, j); - } - return array; - } - - /** - * Return the array, reversed. - *

- * Arrays.reverse(char... array) - */ - public static char[] reverse(char... array) { - int len = array.length; - if ((len == 0) || (len == 1)) { - return array; - } - for (int i = 0, mid = len >> 1, j = len - 1; i < mid; i++, j--) { - swap(array, i, j); - } - return array; - } - - /** - * Return the array, reversed. - *

- * Arrays.reverse(int... array) - */ - public static int[] reverse(int... array) { - int len = array.length; - if ((len == 0) || (len == 1)) { - return array; - } - for (int i = 0, mid = len >> 1, j = len - 1; i < mid; i++, j--) { - swap(array, i, j); - } - return array; - } - - - // ********** rotate ********** - - /** - * Return the rotated array after rotating it one position. - *

- * Arrays.rotate(Object[] array) - */ - public static E[] rotate(E... array) { - return rotate(array, 1); - } - - /** - * Return the rotated array after rotating it the specified distance. - *

- * Arrays.rotate(Object[] array, int distance) - */ - public static E[] rotate(E[] array, int distance) { - int len = array.length; - if ((len == 0) || (len == 1)) { - return array; - } - distance = distance % len; - if (distance < 0) { - distance += len; - } - if (distance == 0) { - return array; - } - for (int cycleStart = 0, nMoved = 0; nMoved != len; cycleStart++) { - E displaced = array[cycleStart]; - int i = cycleStart; - do { - i += distance; - if (i >= len) { - i -= len; - } - E temp = array[i]; - array[i] = displaced; - displaced = temp; - nMoved ++; - } while (i != cycleStart); - } - return array; - } - - /** - * Return the rotated array after rotating it one position. - *

- * Arrays.rotate(char[] array) - */ - public static char[] rotate(char... array) { - return rotate(array, 1); - } - - /** - * Return the rotated array after rotating it the specified distance. - *

- * Arrays.rotate(char[] array, int distance) - */ - public static char[] rotate(char[] array, int distance) { - int len = array.length; - if ((len == 0) || (len == 1)) { - return array; - } - distance = distance % len; - if (distance < 0) { - distance += len; - } - if (distance == 0) { - return array; - } - for (int cycleStart = 0, nMoved = 0; nMoved != len; cycleStart++) { - char displaced = array[cycleStart]; - int i = cycleStart; - do { - i += distance; - if (i >= len) { - i -= len; - } - char temp = array[i]; - array[i] = displaced; - displaced = temp; - nMoved ++; - } while (i != cycleStart); - } - return array; - } - - /** - * Return the rotated array after rotating it one position. - *

- * Arrays.rotate(int[] array) - */ - public static int[] rotate(int... array) { - return rotate(array, 1); - } - - /** - * Return the rotated array after rotating it the specified distance. - *

- * Arrays.rotate(int[] array, int distance) - */ - public static int[] rotate(int[] array, int distance) { - int len = array.length; - if ((len == 0) || (len == 1)) { - return array; - } - distance = distance % len; - if (distance < 0) { - distance += len; - } - if (distance == 0) { - return array; - } - for (int cycleStart = 0, nMoved = 0; nMoved != len; cycleStart++) { - int displaced = array[cycleStart]; - int i = cycleStart; - do { - i += distance; - if (i >= len) { - i -= len; - } - int temp = array[i]; - array[i] = displaced; - displaced = temp; - nMoved ++; - } while (i != cycleStart); - } - return array; - } - - - // ********** shuffle ********** - - private static final Random RANDOM = new Random(); - - /** - * Return the array after "shuffling" it. - *

- * Arrays.shuffle(Object... array) - */ - public static E[] shuffle(E... array) { - return shuffle(array, RANDOM); - } - - /** - * Return the array after "shuffling" it. - *

- * Arrays.shuffle(Object[] array, Random r) - */ - public static E[] shuffle(E[] array, Random random) { - int len = array.length; - if ((len == 0) || (len == 1)) { - return array; - } - for (int i = len; i-- > 0; ) { - swap(array, i, random.nextInt(len)); - } - return array; - } - - /** - * Return the array after "shuffling" it. - *

- * Arrays.shuffle(char... array) - */ - public static char[] shuffle(char... array) { - return shuffle(array, RANDOM); - } - - /** - * Return the array after "shuffling" it. - *

- * Arrays.shuffle(char[] array, Random r) - */ - public static char[] shuffle(char[] array, Random random) { - int len = array.length; - if ((len == 0) || (len == 1)) { - return array; - } - for (int i = len; i-- > 0; ) { - swap(array, i, random.nextInt(len)); - } - return array; - } - - /** - * Return the array after "shuffling" it. - *

- * Arrays.shuffle(int... array) - */ - public static int[] shuffle(int... array) { - return shuffle(array, RANDOM); - } - - /** - * Return the array after "shuffling" it. - *

- * Arrays.shuffle(int[] array, Random r) - */ - public static int[] shuffle(int[] array, Random random) { - int len = array.length; - if ((len == 0) || (len == 1)) { - return array; - } - for (int i = len; i-- > 0; ) { - swap(array, i, random.nextInt(len)); - } - return array; - } - - - // ********** sub-array ********** - - /** - * Return a sub-array of the specified array with elements copied from - * the specified range. The "from" index is inclusive; the "to" index is exclusive. - *

- * Arrays.subArray(E[] array, int fromIndex, int toIndex) - */ - public static E[] subArray(E[] array, int fromIndex, int toIndex) { - int len = toIndex - fromIndex; - E[] result = newArray(array, len); - if (len > 0) { - System.arraycopy(array, fromIndex, result, 0, len); - } - return result; - } - - /** - * Return a sub-array of the specified array with elements copied from - * the specified range. The "from" index is inclusive; the "to" index is exclusive. - *

- * Arrays.subArray(int[] array, int fromIndex, int toIndex) - */ - public static int[] subArray(int[] array, int fromIndex, int toIndex) { - int len = toIndex - fromIndex; - if (len == 0) { - return EMPTY_INT_ARRAY; - } - int[] result = new int[len]; - System.arraycopy(array, fromIndex, result, 0, len); - return result; - } - - /** - * Return a sub-array of the specified array with elements copied from - * the specified range. The "from" index is inclusive; the "to" index is exclusive. - *

- * - * Arrays.subArray(char[] array, int fromIndex, int toIndex) - * - */ - public static char[] subArray(char[] array, int fromIndex, int toIndex) { - int len = toIndex - fromIndex; - if (len == 0) { - return EMPTY_CHAR_ARRAY; - } - char[] result = new char[len]; - System.arraycopy(array, fromIndex, result, 0, len); - return result; - } - - - // ********** swap ********** - - /** - * Return the array after the specified elements have been "swapped". - *

- * Arrays.swap(Object[] array, int i, int j) - */ - public static E[] swap(E[] array, int i, int j) { - return (i == j) ? array : swap_(array, i, j); - } - - /** - * assume the indices are different - */ - private static E[] swap_(E[] array, int i, int j) { - E temp = array[i]; - array[i] = array[j]; - array[j] = temp; - return array; - } - - /** - * Return the array after the specified elements have been "swapped". - *

- * Arrays.swap(char[] array, int i, int j) - */ - public static char[] swap(char[] array, int i, int j) { - return (i == j) ? array : swap_(array, i, j); - } - - /** - * assume the indices are different - */ - private static char[] swap_(char[] array, int i, int j) { - char temp = array[i]; - array[i] = array[j]; - array[j] = temp; - return array; - } - - /** - * Return the array after the specified elements have been "swapped". - *

- * Arrays.swap(int[] array, int i, int j) - */ - public static int[] swap(int[] array, int i, int j) { - return (i == j) ? array : swap_(array, i, j); - } - - /** - * assume the indices are different - */ - private static int[] swap_(int[] array, int i, int j) { - int temp = array[i]; - array[i] = array[j]; - array[j] = temp; - return array; - } - - - // ********** Arrays enhancements ********** - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(boolean[], boolean) - */ - public static boolean[] fill(boolean[] array, boolean value) { - Arrays.fill(array, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(boolean[], int, int, boolean) - */ - public static boolean[] fill(boolean[] array, int fromIndex, int toIndex, boolean value) { - Arrays.fill(array, fromIndex, toIndex, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(byte[], byte) - */ - public static byte[] fill(byte[] array, byte value) { - Arrays.fill(array, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(byte[], int, int, byte) - */ - public static byte[] fill(byte[] array, int fromIndex, int toIndex, byte value) { - Arrays.fill(array, fromIndex, toIndex, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(char[], char) - */ - public static char[] fill(char[] array, char value) { - Arrays.fill(array, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(char[], int, int, char) - */ - public static char[] fill(char[] array, int fromIndex, int toIndex, char value) { - Arrays.fill(array, fromIndex, toIndex, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(double[], double) - */ - public static double[] fill(double[] array, double value) { - Arrays.fill(array, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(double[], int, int, double) - */ - public static double[] fill(double[] array, int fromIndex, int toIndex, double value) { - Arrays.fill(array, fromIndex, toIndex, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(float[], float) - */ - public static float[] fill(float[] array, float value) { - Arrays.fill(array, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(float[], int, int, float) - */ - public static float[] fill(float[] array, int fromIndex, int toIndex, float value) { - Arrays.fill(array, fromIndex, toIndex, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(int[], int) - */ - public static int[] fill(int[] array, int value) { - Arrays.fill(array, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(int[], int, int, int) - */ - public static int[] fill(int[] array, int fromIndex, int toIndex, int value) { - Arrays.fill(array, fromIndex, toIndex, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(Object[], Object) - */ - public static E[] fill(E[] array, E value) { - Arrays.fill(array, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(Object[], int, int, Object) - */ - public static E[] fill(E[] array, int fromIndex, int toIndex, E value) { - Arrays.fill(array, fromIndex, toIndex, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(long[], long) - */ - public static long[] fill(long[] array, long value) { - Arrays.fill(array, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(long[], int, int, long) - */ - public static long[] fill(long[] array, int fromIndex, int toIndex, long value) { - Arrays.fill(array, fromIndex, toIndex, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(short[], short) - */ - public static short[] fill(short[] array, short value) { - Arrays.fill(array, value); - return array; - } - - /** - * Return the array after it has been "filled". - * @see Arrays#fill(short[], int, int, short) - */ - public static short[] fill(short[] array, int fromIndex, int toIndex, short value) { - Arrays.fill(array, fromIndex, toIndex, value); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(byte[]) - */ - public static byte[] sort(byte... array) { - Arrays.sort(array); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(byte[], int, int) - */ - public static byte[] sort(byte[] array, int fromIndex, int toIndex) { - Arrays.sort(array, fromIndex, toIndex); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(char[]) - */ - public static char[] sort(char... array) { - Arrays.sort(array); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(char[], int, int) - */ - public static char[] sort(char[] array, int fromIndex, int toIndex) { - Arrays.sort(array, fromIndex, toIndex); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(double[]) - */ - public static double[] sort(double... array) { - Arrays.sort(array); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(double[], int, int) - */ - public static double[] sort(double[] array, int fromIndex, int toIndex) { - Arrays.sort(array, fromIndex, toIndex); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(float[]) - */ - public static float[] sort(float... array) { - Arrays.sort(array); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(float[], int, int) - */ - public static float[] sort(float[] array, int fromIndex, int toIndex) { - Arrays.sort(array, fromIndex, toIndex); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(int[]) - */ - public static int[] sort(int... array) { - Arrays.sort(array); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(int[], int, int) - */ - public static int[] sort(int[] array, int fromIndex, int toIndex) { - Arrays.sort(array, fromIndex, toIndex); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(Object[]) - */ - public static E[] sort(E... array) { - Arrays.sort(array); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(Object[], Comparator) - */ - public static E[] sort(E[] array, Comparator comparator) { - Arrays.sort(array, comparator); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(Object[], int, int) - */ - public static E[] sort(E[] array, int fromIndex, int toIndex) { - Arrays.sort(array, fromIndex, toIndex); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(Object[], int, int, Comparator) - */ - public static E[] sort(E[] array, int fromIndex, int toIndex, Comparator comparator) { - Arrays.sort(array, fromIndex, toIndex, comparator); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(long[]) - */ - public static long[] sort(long... array) { - Arrays.sort(array); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(long[], int, int) - */ - public static long[] sort(long[] array, int fromIndex, int toIndex) { - Arrays.sort(array, fromIndex, toIndex); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(short[]) - */ - public static short[] sort(short... array) { - Arrays.sort(array); - return array; - } - - /** - * Return the array after it has been "sorted". - * @see Arrays#sort(short[], int, int) - */ - public static short[] sort(short[] array, int fromIndex, int toIndex) { - Arrays.sort(array, fromIndex, toIndex); - return array; - } - - - // ********** constructor ********** - - /** - * Suppress default constructor, ensuring non-instantiability. - */ - private ArrayTools() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Association.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Association.java deleted file mode 100644 index 02226b4333..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Association.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -/** - * Straightforward definition of an object pairing. - * The key is immutable. - */ -public interface Association { - - /** - * Return the association's key. - */ - K getKey(); - - /** - * Return the association's value. - */ - V getValue(); - - /** - * Set the association's value. - * Return the previous value. - */ - V setValue(V value); - - /** - * Return true if the associations' keys and values - * are equal. - */ - boolean equals(Object o); - - /** - * Return a hash code based on the association's - * key and value. - */ - int hashCode(); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AsynchronousCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AsynchronousCommandExecutor.java deleted file mode 100644 index 62b2e70653..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/AsynchronousCommandExecutor.java +++ /dev/null @@ -1,168 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.util.concurrent.ThreadFactory; - -import org.eclipse.jpt.common.utility.Command; - -/** - * This command executor will dispatch commands to be executed in a separate - * thread, allowing calls to {@link CommandExecutor#execute(Command)} to return - * immediately. - *

- * NB: The client-supplied commands should handle any - * exception appropriately (e.g. log the exception and return gracefully) so - * the command execution thread can continue executing. - */ -public class AsynchronousCommandExecutor - implements StatefulCommandExecutor -{ - /** - * This command queue is shared with the command execution/consumer thread. - * Adding a command to it will trigger the command to be executed by the - * command execution thread or, if another command is currently executing, - * to execute the new command once the currently executing command has - * finished executing. - */ - final SynchronizedQueue commands = new SynchronizedQueue(); - - /** - * Most of the thread-related behavior is delegated to this coordinator. - */ - private final ConsumerThreadCoordinator consumerThreadCoordinator; - - - // ********** construction ********** - - /** - * Construct an asynchronous command executor. - * Use simple JDK thread(s) for the command execution thread(s). - * Allow the command execution thread(s) to be assigned JDK-generated names. - */ - public AsynchronousCommandExecutor() { - this(SimpleThreadFactory.instance(), null); - } - - /** - * Construct an asynchronous command executor. - * Use the specified thread factory to construct the command execution thread(s). - * Allow the command execution thread(s) to be assigned JDK-generated names. - */ - public AsynchronousCommandExecutor(ThreadFactory threadFactory) { - this(threadFactory, null); - } - - /** - * Construct an asynchronous command executor. - * Use simple JDK thread(s) for the command execution thread(s). - * Assign the command execution thread(s) the specified name. - */ - public AsynchronousCommandExecutor(String threadName) { - this(SimpleThreadFactory.instance(), threadName); - } - - /** - * Construct an asynchronous command executor. - * Assign the command execution thread(s) the specified name. - */ - public AsynchronousCommandExecutor(ThreadFactory threadFactory, String threadName) { - super(); - this.consumerThreadCoordinator = this.buildConsumerThreadCoordinator(threadFactory, threadName); - } - - private ConsumerThreadCoordinator buildConsumerThreadCoordinator(ThreadFactory threadFactory, String threadName) { - return new ConsumerThreadCoordinator(this.buildConsumer(), threadFactory, threadName); - } - - private ConsumerThreadCoordinator.Consumer buildConsumer() { - return new Consumer(); - } - - - // ********** CallbackStatefulCommandExecutor implementation ********** - - /** - * Build and start the command execution/consumer thread. - *

- * Note: We don't clear the command queue here; so if a command has been - * added to the queue before getting here, the first command will - * be executed promptly (albeit, asynchronously). - * The command queue will be non-empty if:

    - *
  • {@link #execute(Command)} was called after the command executor was - * constructed but before {@link #start()} was called; or - *
  • {@link #execute(Command)} was called after {@link #stop()} was called - * but before {@link #start()} was called (to restart the command executor); or - *
  • {@link #stop()} was called when there were still outstanding commands - * remaining in the command queue - *
- */ - public void start() { - this.consumerThreadCoordinator.start(); - } - - /** - * Put the specified command on the command queue, to be consumed by the - * command execution thread. - */ - public void execute(Command command) { - this.commands.enqueue(command); - } - - /** - * Interrupt the command execution thread so that it stops executing at the - * end of the current command. Suspend the current thread until - * the command execution thread is finished executing. If any uncaught - * exceptions were thrown while the execution thread was executing, - * wrap them in a composite exception and throw the composite exception. - */ - public void stop() { - this.consumerThreadCoordinator.stop(); - } - - - // ********** consumer ********** - - /** - * This implementation of {@link ConsumerThreadCoordinator.Consumer} - * will execute the commands enqueued by the asynchronous command executor. - * It will wait until the shared command queue is non-empty to begin executing the - * commands in the queue. Once a comand is executed, the thread will quiesce until - * another command is placed in the command queue. If a new command is - * enqueued during the execution of another command (either recursively by - * the command itself or by another thread), - * the new command will be executed immediately after the currently - * executing command is finished. - * Stop the thread by calling {@link Thread#interrupt()}. - */ - class Consumer - implements ConsumerThreadCoordinator.Consumer - { - Consumer() { - super(); - } - - /** - * Wait until a command has been placed in the queue. - */ - public void waitForProducer() throws InterruptedException { - AsynchronousCommandExecutor.this.commands.waitUntilNotEmpty(); - } - - /** - * Execute the first command in the queue and notify our listeners. - */ - public void execute() { - AsynchronousCommandExecutor.this.commands.dequeue().execute(); - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Bag.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Bag.java deleted file mode 100644 index 0cecf9718c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Bag.java +++ /dev/null @@ -1,197 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import java.util.AbstractCollection; -import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; - -/** - * A collection that allows duplicate elements. - *

- * The Bag interface places additional stipulations, - * beyond those inherited from the {@link java.util.Collection} interface, - * on the contracts of the {@link #equals(Object)} and {@link #hashCode()} methods. - * - * @see HashBag - */ - -public interface Bag extends java.util.Collection { - - /** - * Compares the specified object with this bag for equality. Returns - * true if the specified object is also a bag, the two bags - * have the same size, and every member of the specified bag is - * contained in this bag with the same number of occurrences (or equivalently, - * every member of this bag is contained in the specified bag with the same - * number of occurrences). This definition ensures that the - * equals method works properly across different implementations of the - * bag interface. - */ - boolean equals(Object o); - - /** - * Returns the hash code value for this bag. The hash code of a bag is - * defined to be the sum of the hash codes of the elements in the bag, - * where the hashcode of a null element is defined to be zero. - * This ensures that b1.equals(b2) implies that - * b1.hashCode() == b2.hashCode() for any two bags - * b1 and b2, as required by the general - * contract of the {@link Object#hashCode()} method. - */ - int hashCode(); - - /** - * Return the number of times the specified object occurs in the bag. - */ - int count(Object o); - - /** - * Add the specified object the specified number of times to the bag. - * Return whether the bag changed. - */ - boolean add(E o, int count); - - /** - * Remove the specified number of occurrences of the specified object - * from the bag. Return whether the bag changed. - */ - boolean remove(Object o, int count); - - /** - * Return an iterator that returns each item in the bag - * once and only once, irrespective of how many times - * the item was added to the bag. - */ - java.util.Iterator uniqueIterator(); - - /** - * Return the number of unique items in the bag. - */ - int uniqueCount(); - - /** - * Return an iterator that returns an entry for each item in the bag - * once and only once, irrespective of how many times - * the item was added to the bag. The entry will indicate the item's - * count. - */ - java.util.Iterator> entries(); - - - /** - * A bag entry (element-count pair). - * The {@link Bag#entries()} method returns an iterator whose - * elements are of this class. The only way to obtain a reference - * to a bag entry is from the iterator returned by this method. These - * Bag.Entry objects are valid only for the duration - * of the iteration; more formally, the behavior of a bag entry is - * undefined if the backing bag has been modified after the entry was - * returned by the iterator, except through the {@link #setCount(int)} - * operation on the bag entry. - */ - interface Entry { - - /** - * Return the entry's element. - */ - E getElement(); - - /** - * Return entry's count; i.e. the number of times the entry's element - * occurs in the bag. - * @see Bag#count(Object) - */ - int getCount(); - - /** - * Set the entry's count; i.e. the number of times the entry's element - * occurs in the bag. The new count must be a positive number. - * Return the previous count of the entry's element. - * NB: Use {@link Iterator#remove()} to set the - * count to zero. - */ - int setCount(int count); - - /** - * Return whether the entry is equal to the specified object; - * i.e. the specified object is a Bag.Entry and its - * element and count are the same as the entry's. - */ - boolean equals(Object obj); - - /** - * Return the entry's hash code. - */ - int hashCode(); - - } - - - final class Empty extends AbstractCollection implements Bag, Serializable { - @SuppressWarnings("rawtypes") - public static final Bag INSTANCE = new Empty(); - @SuppressWarnings("unchecked") - public static Bag instance() { - return INSTANCE; - } - // ensure single instance - private Empty() { - super(); - } - @Override - public Iterator iterator() { - return EmptyIterator.instance(); - } - @Override - public int size() { - return 0; - } - public Iterator uniqueIterator() { - return EmptyIterator.instance(); - } - public int uniqueCount() { - return 0; - } - public int count(Object o) { - return 0; - } - public Iterator> entries() { - return EmptyIterator.instance(); - } - public boolean remove(Object o, int count) { - return false; - } - public boolean add(E o, int count) { - throw new UnsupportedOperationException(); - } - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if ( ! (o instanceof Bag)) { - return false; - } - return ((Bag) o).size() == 0; - } - @Override - public int hashCode() { - return 0; - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiFilter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiFilter.java deleted file mode 100644 index 2894793ffd..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiFilter.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; - -import org.eclipse.jpt.common.utility.Filter; - -/** - * Used by various "pluggable" classes to filter objects - * in both directions. - * - * If anyone can come up with a better class name - * and/or method name, I would love to hear it. ~bjv - */ -public interface BidiFilter extends Filter { - - /** - * Return whether the specified object is "accepted" by the - * "reverse" filter. What that means is determined by the client. - */ - boolean reverseAccept(T o); - - - final class Null implements BidiFilter, Serializable { - @SuppressWarnings("rawtypes") - public static final BidiFilter INSTANCE = new Null(); - @SuppressWarnings("unchecked") - public static BidiFilter instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - // nothing is filtered - everything is accepted - public boolean accept(S o) { - return true; - } - // nothing is "reverse-filtered" - everything is accepted - public boolean reverseAccept(S o) { - return true; - } - @Override - public String toString() { - return "BidiFilter.Null"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - final class Opaque implements BidiFilter, Serializable { - @SuppressWarnings("rawtypes") - public static final BidiFilter INSTANCE = new Opaque(); - @SuppressWarnings("unchecked") - public static BidiFilter instance() { - return INSTANCE; - } - // ensure single instance - private Opaque() { - super(); - } - // everything is filtered - nothing is accepted - public boolean accept(S o) { - return false; - } - // everything is "reverse-filtered" - nothing is accepted - public boolean reverseAccept(S o) { - return false; - } - @Override - public String toString() { - return "BidiFilter.Opaque"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - final class Disabled implements BidiFilter, Serializable { - @SuppressWarnings("rawtypes") - public static final BidiFilter INSTANCE = new Disabled(); - @SuppressWarnings("unchecked") - public static BidiFilter instance() { - return INSTANCE; - } - // ensure single instance - private Disabled() { - super(); - } - // throw an exception - public boolean accept(S o) { - throw new UnsupportedOperationException(); - } - // throw an exception - public boolean reverseAccept(S o) { - throw new UnsupportedOperationException(); - } - @Override - public String toString() { - return "BidiFilter.Disabled"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiStringConverter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiStringConverter.java deleted file mode 100644 index 056b29ae9f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiStringConverter.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; - -/** - * Used by various "pluggable" classes to transform objects - * into strings and vice versa. - * - * If anyone can come up with a better class name - * and/or method name, I would love to hear it. ~bjv - */ -public interface BidiStringConverter extends StringConverter { - - /** - * Convert the specified string into an object. - * The semantics of "convert to object" is determined by the - * contract between the client and the server. - * Typically, if the string is null, null is returned. - */ - T convertToObject(String s); - - - final class Default implements BidiStringConverter, Serializable { - @SuppressWarnings("rawtypes") - public static final BidiStringConverter INSTANCE = new Default(); - @SuppressWarnings("unchecked") - public static BidiStringConverter instance() { - return INSTANCE; - } - // ensure single instance - private Default() { - super(); - } - // simply return the object's #toString() result - public String convertToString(S o) { - return (o == null) ? null : o.toString(); - } - // simply return the string - @SuppressWarnings("unchecked") - public S convertToObject(String s) { - return (S) s; - } - @Override - public String toString() { - return "BidiStringConverter.Default"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - final class Disabled implements BidiStringConverter, Serializable { - @SuppressWarnings("rawtypes") - public static final BidiStringConverter INSTANCE = new Disabled(); - @SuppressWarnings("unchecked") - public static BidiStringConverter instance() { - return INSTANCE; - } - // ensure single instance - private Disabled() { - super(); - } - // throw an exception - public String convertToString(S o) { - throw new UnsupportedOperationException(); - } - // throw an exception - public S convertToObject(String s) { - throw new UnsupportedOperationException(); - } - @Override - public String toString() { - return "BidiStringConverter.Disabled"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - final class BooleanConverter implements BidiStringConverter, Serializable { - public static final BidiStringConverter INSTANCE = new BooleanConverter(); - public static BidiStringConverter instance() { - return INSTANCE; - } - // ensure single instance - private BooleanConverter() { - super(); - } - /** Return "true" if the Boolean is true, otherwise return "false". */ - public String convertToString(Boolean b) { - return (b == null) ? null : b.toString(); - } - /** Return Boolean.TRUE if the string is "true" (case-insensitive), otherwise return Boolean.FALSE. */ - public Boolean convertToObject(String s) { - return (s == null) ? null : Boolean.valueOf(s); - } - @Override - public String toString() { - return "BidiStringConverter.BooleanConverter"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - final class IntegerConverter implements BidiStringConverter, Serializable { - public static final BidiStringConverter INSTANCE = new IntegerConverter(); - public static BidiStringConverter instance() { - return INSTANCE; - } - // ensure single instance - private IntegerConverter() { - super(); - } - /** Integer's #toString() works well. */ - public String convertToString(Integer integer) { - return (integer == null) ? null : integer.toString(); - } - /** Convert the string to an Integer, if possible. */ - public Integer convertToObject(String s) { - return (s == null) ? null : Integer.valueOf(s); - } - @Override - public String toString() { - return "BidiStringConverter.IntegerConverter"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiTransformer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiTransformer.java deleted file mode 100644 index c105d9d50a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BidiTransformer.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; - -/** - * Used by various "pluggable" classes to transform objects - * in both directions. - * - * If anyone can come up with a better class name - * and/or method name, I would love to hear it. ~bjv - */ -public interface BidiTransformer extends Transformer { - - /** - * Return the "reverse-transformed" object. - * The semantics of "reverse-transform" is determined by the - * contract between the client and the server. - */ - T1 reverseTransform(T2 o); - - - final class Null implements BidiTransformer, Serializable { - @SuppressWarnings("rawtypes") - public static final BidiTransformer INSTANCE = new Null(); - @SuppressWarnings("unchecked") - public static BidiTransformer instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - // simply return the object, unchanged - @SuppressWarnings("unchecked") - public S2 transform(S1 o) { - return (S2) o; - } - // simply return the object, unchanged - @SuppressWarnings("unchecked") - public S1 reverseTransform(S2 o) { - return (S1) o; - } - @Override - public String toString() { - return "BidiTransformer.Null"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - final class Disabled implements BidiTransformer, Serializable { - @SuppressWarnings("rawtypes") - public static final BidiTransformer INSTANCE = new Disabled(); - @SuppressWarnings("unchecked") - public static BidiTransformer instance() { - return INSTANCE; - } - // ensure single instance - private Disabled() { - super(); - } - // throw an exception - public S2 transform(S1 o) { - throw new UnsupportedOperationException(); - } - // throw an exception - public S1 reverseTransform(S2 o) { - throw new UnsupportedOperationException(); - } - @Override - public String toString() { - return "BidiTransformer.Disabled"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BitTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BitTools.java deleted file mode 100644 index 20cbf7c9f0..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BitTools.java +++ /dev/null @@ -1,214 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -/** - * Assorted bit tools - */ -public final class BitTools { - - /** - * Return whether the specified 'flags' has the specified - * 'flagToCheck' set. - */ - public static boolean flagIsSet(int flags, int flagToCheck) { - return allFlagsAreSet(flags, flagToCheck); - } - - /** - * Return whether the specified 'flags' has the specified - * 'flagToCheck' turned off. - */ - public static boolean flagIsOff(int flags, int flagToCheck) { - return allFlagsAreOff(flags, flagToCheck); - } - - /** - * Return whether the specified 'flags' has ONLY the specified - * 'flagToCheck' set. - */ - public static boolean onlyFlagIsSet(int flags, int flagToCheck) { - return onlyFlagsAreSet(flags, flagToCheck); - } - - /** - * Return whether the specified 'flags' has ONLY the specified - * 'flagToCheck' turned off. - */ - public static boolean onlyFlagIsOff(int flags, int flagToCheck) { - return onlyFlagsAreOff(flags, flagToCheck); - } - - /** - * Return whether the specified 'flags' has all the specified - * 'flagsToCheck' set. - */ - public static boolean allFlagsAreSet(int flags, int flagsToCheck) { - return (flags & flagsToCheck) == flagsToCheck; - } - - /** - * Return whether the specified 'flags' has all the specified - * 'flagsToCheck' turned off. - */ - public static boolean allFlagsAreOff(int flags, int flagsToCheck) { - return (flags & flagsToCheck) == 0; - } - - /** - * Return whether the specified 'flags' has ONLY the specified - * 'flagsToCheck' set. - */ - public static boolean onlyFlagsAreSet(int flags, int flagsToCheck) { - return allFlagsAreSet(flags, flagsToCheck) && allFlagsAreOff(flags, ~flagsToCheck); - } - - /** - * Return whether the specified 'flags' has ONLY the specified - * 'flagsToCheck' turned off. - */ - public static boolean onlyFlagsAreOff(int flags, int flagsToCheck) { - return allFlagsAreOff(flags, flagsToCheck) && allFlagsAreSet(flags, ~flagsToCheck); - } - - /** - * Return whether the specified 'flags' has any one of the specified - * 'flagsToCheck' set. - */ - public static boolean anyFlagsAreSet(int flags, int flagsToCheck) { - return (flags & flagsToCheck) != 0; - } - - /** - * Return whether the specified 'flags' has any one of the specified - * 'flagsToCheck' turned off. - */ - public static boolean anyFlagsAreOff(int flags, int flagsToCheck) { - return (flags & flagsToCheck) != flagsToCheck; - } - - /** - * Return whether the specified 'flags' has all the specified - * 'flagsToCheck' set. - */ - public static boolean allFlagsAreSet(int flags, int... flagsToCheck) { - for (int i = flagsToCheck.length; i-- > 0; ) { - if ( ! allFlagsAreSet(flags, flagsToCheck[i])) { - return false; - } - } - return true; - } - - /** - * Return whether the specified 'flags' has all the specified - * 'flagsToCheck' turned off. - */ - public static boolean allFlagsAreOff(int flags, int... flagsToCheck) { - for (int i = flagsToCheck.length; i-- > 0; ) { - if ( ! allFlagsAreOff(flags, flagsToCheck[i])) { - return false; - } - } - return true; - } - - /** - * Return whether the specified 'flags' has ONLY the specified - * 'flagsToCheck' set. - */ - public static boolean onlyFlagsAreSet(int flags, int... flagsToCheck) { - int combinedFlags = orFlags(flagsToCheck); - return allFlagsAreSet(flags, combinedFlags) && allFlagsAreOff(flags, ~combinedFlags); - } - - /** - * Return whether the specified 'flags' has ONLY the specified - * 'flagsToCheck' turned off. - */ - public static boolean onlyFlagsAreOff(int flags, int... flagsToCheck) { - int combinedFlags = orFlags(flagsToCheck); - return allFlagsAreOff(flags, combinedFlags) && allFlagsAreSet(flags, ~combinedFlags); - } - - /** - * Return whether the specified 'flags' has any one of the specified - * 'flagsToCheck' set. - */ - public static boolean anyFlagsAreSet(int flags, int... flagsToCheck) { - for (int i = flagsToCheck.length; i-- > 0; ) { - if (anyFlagsAreSet(flags, flagsToCheck[i])) { - return true; - } - } - return false; - } - - /** - * Return whether the specified 'flags' has any one of the specified - * 'flagsToCheck' turned off. - */ - public static boolean anyFlagsAreOff(int flags, int... flagsToCheck) { - for (int i = flagsToCheck.length; i-- > 0; ) { - if (anyFlagsAreOff(flags, flagsToCheck[i])) { - return true; - } - } - return false; - } - - /** - * OR all the specified 'flags' together and return the result. - */ - public static int orFlags(int... flags) { - int last = flags.length - 1; - int result = flags[last]; - for (int i = last; i-- > 0; ) { - result |= flags[i]; - } - return result; - } - - /** - * AND all the specified 'flags' together and return the result. - */ - public static int andFlags(int... flags) { - int last = flags.length - 1; - int result = flags[last]; - for (int i = last; i-- > 0; ) { - result &= flags[i]; - } - return result; - } - - /** - * XOR all the specified 'flags' together and return the result. - */ - public static int xorFlags(int... flags) { - int last = flags.length - 1; - int result = flags[last]; - for (int i = last; i-- > 0; ) { - result ^= flags[i]; - } - return result; - } - - - // ********** constructor ********** - - /** - * Suppress default constructor, ensuring non-instantiability. - */ - private BitTools() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanReference.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanReference.java deleted file mode 100644 index 9d114257d1..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanReference.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -/** - * Interface for a container for passing a flag that can be changed by - * the recipient. - */ -public interface BooleanReference - extends ReadOnlyBooleanReference -{ - /** - * Set the boolean value. - * Return the previous value. - */ - boolean setValue(boolean value); - - /** - * Set the boolean value to the NOT of its current value. - * Return the new value. - */ - boolean flip(); - - /** - * Set the boolean value to the NOT of the specified value. - * Return the previous value. - */ - boolean setNot(boolean v); - - /** - * Set the boolean value to true. - * Return the previous value. - */ - boolean setTrue(); - - /** - * Set the boolean value to false. - * Return the previous value. - */ - boolean setFalse(); -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanTools.java deleted file mode 100644 index 783c0f1299..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/BooleanTools.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -/** - * Assorted "Capital-B Boolean" operations. - */ - // commented code is just playing around with building *everything* from NAND -public final class BooleanTools { - - /** - * Return the NOT of the specified Boolean. - * Boolean#not() - */ - public static Boolean not(Boolean b) { - return Boolean.valueOf( ! b.booleanValue()); -// return nand(b, b); - } - - /** - * Return the AND of the specified Booleans. - * Boolean#and(Boolean) - */ - public static Boolean and(Boolean b1, Boolean b2) { - return Boolean.valueOf(b1.booleanValue() && b2.booleanValue()); -// Boolean nand = nand(b1, b2); -// return nand(nand, nand); - } - - /** - * Return the OR of the specified Booleans. - * Boolean#or(Boolean) - */ - public static Boolean or(Boolean b1, Boolean b2) { - return Boolean.valueOf(b1.booleanValue() || b2.booleanValue()); -// Boolean nand = nand(b1, b2); -// Boolean xor = nand(nand(b1, nand), nand(b2, nand)); -// Boolean and = nand(nand, nand); -// Boolean nand2 = nand(xor, and); -// return nand(nand(xor, nand2), nand(and, nand2)); - } - - /** - * Return the XOR of the specified Booleans. - * Boolean#xor(Boolean) - */ - public static Boolean xor(Boolean b1, Boolean b2) { - return and(or(b1, b2), nand(b1, b2)); -// Boolean nand = nand(b1, b2); -// return nand(nand(b1, nand), nand(b2, nand)); - } - - /** - * Return the NAND of the specified Booleans. - * Boolean#nand(Boolean) - */ - public static Boolean nand(Boolean b1, Boolean b2) { - return not(and(b1, b2)); -// return Boolean.valueOf( ! (b1.booleanValue() && b2.booleanValue())); - } - - /** - * Return the NOR of the specified Booleans. - * Boolean#nor(Boolean) - */ - public static Boolean nor(Boolean b1, Boolean b2) { - return not(or(b1, b2)); -// Boolean nand = nand(b1, b2); -// Boolean xor = nand(nand(b1, nand), nand(b2, nand)); -// Boolean and = nand(nand, nand); -// Boolean nand2 = nand(xor, and); -// Boolean nand3 = nand(nand(xor, nand2), nand(and, nand2)); -// return nand(nand3, nand3); - } - - /** - * Return the XNOR of the specified Booleans. - * Boolean#xnor(Boolean) - */ - public static Boolean xnor(Boolean b1, Boolean b2) { - return not(xor(b1, b2)); -// Boolean nand = nand(b1, b2); -// Boolean xor = nand(nand(b1, nand), nand(b2, nand)); -// return nand(xor, xor); - } - - - // ********** constructor ********** - - /** - * Suppress default constructor, ensuring non-instantiability. - */ - private BooleanTools() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ClassName.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ClassName.java deleted file mode 100644 index aaf4be351c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ClassName.java +++ /dev/null @@ -1,431 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -/** - * Convenience methods related to Java class names as returned by - * {@link java.lang.Class#getName()}. - */ -public final class ClassName { - - public static final String VOID_CLASS_NAME = ReflectionTools.VOID_CLASS.getName(); - public static final String VOID_WRAPPER_CLASS_NAME = ReflectionTools.VOID_WRAPPER_CLASS.getName(); - - public static final char REFERENCE_CLASS_CODE = 'L'; - public static final char REFERENCE_CLASS_NAME_DELIMITER = ';'; - - /** - * Return whether the specified class is an array type. - * @see java.lang.Class#getName() - */ - public static boolean isArray(String className) { - return className.charAt(0) == '['; - } - - /** - * Return the "element type" of the specified class. - * The element type is the base type held by an array type. - * Non-array types simply return themselves. - * @see java.lang.Class#getName() - */ - public static String getElementTypeName(String className) { - int depth = getArrayDepth(className); - if (depth == 0) { - // the name is in the form: "java.lang.Object" or "int" - return className; - } - return getElementTypeName_(className, depth); - } - - /** - * pre-condition: array depth is not zero - */ - private static String getElementTypeName_(String className, int arrayDepth) { - int last = className.length() - 1; - if (className.charAt(arrayDepth) == REFERENCE_CLASS_CODE) { - // the name is in the form: "[[[Ljava.lang.Object;" - return className.substring(arrayDepth + 1, last); // drop the trailing ';' - } - // the name is in the form: "[[[I" - return forCode(className.charAt(last)); - } - - /** - * Return the "array depth" of the specified class. - * The depth is the number of dimensions for an array type. - * Non-array types have a depth of zero. - * @see java.lang.Class#getName() - */ - public static int getArrayDepth(String className) { - int depth = 0; - while (className.charAt(depth) == '[') { - depth++; - } - return depth; - } - - /** - * Return the specified class's component type. - * Return null if the specified class is not an array type. - * @see java.lang.Class#getName() - */ - public static String getComponentTypeName(String className) { - switch (getArrayDepth(className)) { - case 0: - return null; - case 1: - return getElementTypeName_(className, 1); - default: - return className.substring(1); - } - } - - /** - * Return the specified class's simple name. - * Return an empty string if the specified class is anonymous. - *

- * The simple name of an array type is the simple name of the - * component type with "[]" appended. In particular, - * the simple name of an array type whose component type is - * anonymous is simply "[]". - * @see java.lang.Class#getSimpleName() - */ - public static String getSimpleName(String className) { - return isArray(className) ? - getSimpleName(getComponentTypeName(className)) + "[]" : //$NON-NLS-1$ - getSimpleName_(className); - } - - /** - * pre-condition: specified class is not an array type - */ - private static String getSimpleName_(String className) { - int index = className.lastIndexOf('$'); - if (index == -1) { // "top-level" class - strip package name - return className.substring(className.lastIndexOf('.') + 1); - } - - int len = className.length(); - for (int i = ++index; i < len; i++) { - if ( ! charIsAsciiDigit(className.charAt(i))) { - return className.substring(i); // "member" or "local" class - } - } - // all the characters past the '$' are ASCII digits ("anonymous" class) - return ""; //$NON-NLS-1$ - } - - /** - * Return the specified class's package name (e.g. - * "java.lang.Object" returns - * "java.lang"). - * Return an empty string if the specified class is:

    - *
  • in the "default" package - *
  • an array class - *
  • a primtive class - *
- * @see java.lang.Class#getPackage() - * @see java.lang.Package#getName() - */ - public static String getPackageName(String className) { - if (isArray(className)) { - return ""; //$NON-NLS-1$ - } - int lastPeriod = className.lastIndexOf('.'); - return (lastPeriod == -1) ? "" : className.substring(0, lastPeriod); //$NON-NLS-1$ - } - - /** - * Return whether the specified class is a "top-level" class, - * as opposed to a "member", "local", or "anonymous" class, - * using the standard JDK naming conventions (i.e. the class - * name does NOT contain a '$'). - * A "top-level" class can be either the "primary" (public) class defined - * in a file/compilation unit (i.e. the class with the same name as its - * file's simple base name) or a "non-primary" (package visible) class - * (i.e. the other top-level classes defined in a file). - * A "top-level" class can contain any of the other types of classes. - * @see java.lang.Class#getName() - */ - public static boolean isTopLevel(String className) { - if (isArray(className)) { - return false; - } - return className.lastIndexOf('$') == -1; - } - - /** - * Return whether the specified class is a "member" class, - * as opposed to a "top-level", "local", or "anonymous" class, - * using the standard JDK naming convention (i.e. the class - * name ends with a '$' followed by a legal class name; e.g. - * "TopLevelClass$1LocalClass$MemberClass"). - * A "member" class can be either "nested" (static) or "inner"; - * but there is no way to determine which from the class's name. - * A "member" class can contain "local", "anonymous", or other - * "member" classes; and vice-versa. - * @see java.lang.Class#getName() - */ - public static boolean isMember(String className) { - if (isArray(className)) { - return false; - } - int index = className.lastIndexOf('$'); - if (index == -1) { - return false; // "top-level" class - } - // the character immediately after the dollar sign cannot be an ASCII digit - return ! charIsAsciiDigit(className.charAt(++index)); - } - - /** - * Return whether the specified class is a "local" class, - * as opposed to a "top-level", "member", or "anonymous" class, - * using the standard JDK naming convention (i.e. the class name - * ends with "$nnnXXX", - * where the '$' is - * followed by a series of numeric digits which are followed by the - * local class name; e.g. "TopLevelClass$1LocalClass"). - * A "local" class can contain "member", "anonymous", or other - * "local" classes; and vice-versa. - * @see java.lang.Class#getName() - */ - public static boolean isLocal(String className) { - if (isArray(className)) { - return false; - } - int index = className.lastIndexOf('$'); - if (index == -1) { - return false; // "top-level" class - } - if ( ! charIsAsciiDigit(className.charAt(++index))) { - return false; // "member" class - } - int len = className.length(); - for (int i = ++index; i < len; i++) { - if ( ! charIsAsciiDigit(className.charAt(i))) { - return true; - } - } - // all the characters past the '$' are ASCII digits ("anonymous" class) - return false; - } - - /** - * Return whether the specified class is an "anonymous" class, - * as opposed to a "top-level", "member", or "local" class, - * using the standard JDK naming convention (i.e. the class - * name ends with "$nnn" where all the characters past the - * last '$' are ASCII numeric digits; - * e.g. "TopLevelClass$1"). - * An "anonymous" class can contain "member", "local", or other - * "anonymous" classes; and vice-versa. - * @see java.lang.Class#getName() - */ - public static boolean isAnonymous(String className) { - if (isArray(className)) { - return false; - } - int index = className.lastIndexOf('$'); - if (index == -1) { - return false; // "top-level" class - } - if ( ! charIsAsciiDigit(className.charAt(++index))) { - return false; // "member" class - } - int len = className.length(); - for (int i = ++index; i < len; i++) { - if ( ! charIsAsciiDigit(className.charAt(i))) { - return false; // "local" class - } - } - // all the characters past the '$' are ASCII digits ("anonymous" class) - return true; - } - - /** - * {@link Character#isDigit(char)} returns true for some non-ASCII - * digits. This method does not. - */ - private static boolean charIsAsciiDigit(char c) { - return ('0' <= c) && (c <= '9'); - } - - /** - * Return whether the specified class is a "reference" - * class (i.e. neither void nor one of the primitive variable classes, - * boolean, int, float, etc.). - *

- * NB: void.class.isPrimitive() == true - */ - public static boolean isReference(String className) { - return ! isPrimitive(className); - } - - /** - * Return whether the specified class is a primitive - * class (i.e. void or one of the primitive variable classes, - * boolean, int, float, etc.). - *

- * NB: void.class.isPrimitive() == true - */ - public static boolean isPrimitive(String className) { - if (isArray(className) || (className.length() > ReflectionTools.MAX_PRIMITIVE_CLASS_NAME_LENGTH)) { - return false; // performance tweak - } - for (ReflectionTools.Primitive primitive : ReflectionTools.PRIMITIVES) { - if (className.equals(primitive.javaClass.getName())) { - return true; - } - } - return false; - } - - /** - * Return whether the specified class is a primitive wrapper - * class (i.e. java.lang.Void or one of the primitive - * variable wrapper classes, java.lang.Boolean, - * java.lang.Integer, java.lang.Float, etc.). - *

- * NB: void.class.isPrimitive() == true - */ - public static boolean isPrimitiveWrapper(String className) { - if (isArray(className) || (className.length() > ReflectionTools.MAX_PRIMITIVE_WRAPPER_CLASS_NAME_LENGTH)) { - return false; // performance tweak - } - for (ReflectionTools.Primitive primitive : ReflectionTools.PRIMITIVES) { - if (className.equals(primitive.wrapperClass.getName())) { - return true; - } - } - return false; - } - - /** - * Return whether the specified class is a "variable" primitive - * class (i.e. boolean, int, float, etc., - * but not void). - *

- * NB: void.class.isPrimitive() == true - */ - public static boolean isVariablePrimitive(String className) { - return isPrimitive(className) - && ( ! className.equals(VOID_CLASS_NAME)); - } - - /** - * Return whether the specified class is a "variable" primitive wrapper - * class (i.e. java.lang.Boolean, - * java.lang.Integer, java.lang.Float, etc., - * but not java.lang.Void). - *

- * NB: void.class.isPrimitive() == true - */ - public static boolean isVariablePrimitiveWrapper(String className) { - return isPrimitiveWrapper(className) - && ( ! className.equals(VOID_WRAPPER_CLASS_NAME)); - } - - /** - * Return the name of the primitive wrapper class corresponding to the specified - * primitive class. Return null if the specified class is not a primitive. - */ - public static String getWrapperClassName(String primitiveClassName) { - for (ReflectionTools.Primitive primitive : ReflectionTools.PRIMITIVES) { - if (primitive.javaClass.getName().equals(primitiveClassName)) { - return primitive.wrapperClass.getName(); - } - } - return null; - } - - /** - * Return the name of the primitive class corresponding to the specified - * primitive wrapper class. Return null if the specified class - * is not a primitive wrapper. - */ - public static String getPrimitiveClassName(String primitiveWrapperClassName) { - for (ReflectionTools.Primitive primitive : ReflectionTools.PRIMITIVES) { - if (primitive.wrapperClass.getName().equals(primitiveWrapperClassName)) { - return primitive.javaClass.getName(); - } - } - return null; - } - - /** - * Return whether the two class names are equivalent, given autoboxing. - * (e.g. "java.lang.Integer" and "int" should be equivalent) - */ - public static boolean areAutoboxEquivalents(String className1, String className2) { - return Tools.valuesAreEqual(className1, className2) - || Tools.valuesAreEqual(getPrimitiveClassName(className1), className2) - || Tools.valuesAreEqual(getWrapperClassName(className1), className2); - } - - - // ********** primitive codes ********** - - /** - * Return the primitive class name for the specified primitive class code. - * Return null if the specified code - * is not a primitive class code. - * @see java.lang.Class#getName() - */ - public static String forCode(int classCode) { - return forCode((char) classCode); - } - - /** - * Return the primitive class name for the specified primitive class code. - * Return null if the specified code - * is not a primitive class code. - * @see java.lang.Class#getName() - */ - public static String forCode(char classCode) { - Class primitiveClass = ReflectionTools.getClassForCode(classCode); - return (primitiveClass == null) ? null : primitiveClass.getName(); - } - - /** - * Return the class code for the specified primitive class. - * Return 0 if the specified class - * is not a primitive class. - * @see java.lang.Class#getName() - */ - public static char getCodeForClassName(String primitiveClassName) { - if (( ! isArray(primitiveClassName)) && (primitiveClassName.length() <= ReflectionTools.MAX_PRIMITIVE_CLASS_NAME_LENGTH)) { - for (ReflectionTools.Primitive primitive : ReflectionTools.PRIMITIVES) { - if (primitive.javaClass.getName().equals(primitiveClassName)) { - return primitive.code; - } - } - } - return 0; - } - - static void append(String className, StringBuilder sb) { - sb.append(REFERENCE_CLASS_CODE); - sb.append(className); - sb.append(REFERENCE_CLASS_NAME_DELIMITER); - } - - - // ********** suppressed constructor ********** - - /** - * Suppress default constructor, ensuring non-instantiability. - */ - private ClassName() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Classpath.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Classpath.java deleted file mode 100644 index dcf03bd2cf..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Classpath.java +++ /dev/null @@ -1,939 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.File; -import java.io.FileFilter; -import java.io.IOException; -import java.io.Serializable; -import java.net.URISyntaxException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.zip.ZipEntry; -import java.util.zip.ZipFile; - -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; - -/** - * Classpath models a Java classpath, which consists of a list of - * {@link Entry}s, each of which contain Java classes. The classpath can return - * the names of classes found in it etc. There are a number of static - * convenience methods that can be use to construct Classpaths - * corresponding to the Java classpath etc. - */ -public class Classpath - implements Serializable -{ - /** The entries in the classpath */ - private final Entry[] entries; - - private static final long serialVersionUID = 1L; - - - // ********** static methods ********** - - // ***** factory methods for "standard" classpaths ***** - - /** - * Return the Java "boot" classpath. This includes rt.jar. - */ - public static Classpath bootClasspath() { - return new Classpath(System.getProperty("sun.boot.class.path")); //$NON-NLS-1$ - } - - /** - * Return a "virtual classpath" that contains all the jars - * that would be used by the Java Extension Mechanism. - */ - public static Classpath javaExtensionClasspath() { - File[] dirs = javaExtensionDirectories(); - List jarFileNames = new ArrayList(); - for (File dir : dirs) { - if (dir.isDirectory()) { - addJarFileNamesTo(dir, jarFileNames); - } - } - return new Classpath(jarFileNames); - } - - /** - * Return the Java "system" classpath. - */ - public static Classpath javaClasspath() { - return new Classpath(System.getProperty("java.class.path")); //$NON-NLS-1$ - } - - /** - * Return the unretouched "complete" classpath. - * This includes the boot classpath, the Java Extension - * Mechanism classpath, and the normal "system" classpath. - */ - public static Classpath completeClasspath() { - return new Classpath(new Classpath[] { - bootClasspath(), - javaExtensionClasspath(), - javaClasspath() - }); - } - - /** - * Return a classpath that contains the location of the specified class. - */ - public static Classpath classpathFor(Class javaClass) { - return new Classpath(locationFor(javaClass)); - } - - - // ***** file => class ***** - - /** - * Convert a relative file name to a class name; this will work for - * any file that has a single extension beyond the base - * class name:

    - *
  • "java/lang/String.class" is converted to "java.lang.String" - *
  • "java/lang/String.java" is converted to "java.lang.String" - *
- */ - public static String convertToClassName(String classFileName) { - String className = FileTools.stripExtension(classFileName); - // do this for archive entry names - className = className.replace('/', '.'); - // do this for O/S-specific file names - if (File.separatorChar != '/') { - className = className.replace(File.separatorChar, '.'); - } - return className; - } - - /** - * Convert a file to a class name; - * e.g. File(java/lang/String.class) is converted to - * "java.lang.String". - */ - public static String convertToClassName(File classFile) { - return convertToClassName(classFile.getPath()); - } - - /** - * Convert a relative file name to a class; - * e.g. "java/lang/String.class" is converted to - * java.lang.String.class. - */ - public static Class convertToClass(String classFileName) throws ClassNotFoundException { - return Class.forName(convertToClassName(classFileName)); - } - - /** - * Convert a relative file to a class; - * e.g. File(java/lang/String.class) is converted to - * java.lang.String.class. - */ - public static Class convertToClass(File classFile) throws ClassNotFoundException { - return convertToClass(classFile.getPath()); - } - - - // ***** class => JAR entry ***** - - /** - * Convert a class name to an archive entry name base; - * e.g. "java.lang.String" is converted to - * "java/lang/String". - */ - public static String convertToArchiveEntryNameBase(String className) { - return className.replace('.', '/'); - } - - /** - * Convert a class to an archive entry name base; - * e.g. java.lang.String.class is converted to - * "java/lang/String". - */ - public static String convertToArchiveEntryNameBase(Class javaClass) { - return convertToArchiveEntryNameBase(javaClass.getName()); - } - - /** - * Convert a class name to an archive class file entry name; - * e.g. "java.lang.String" is converted to - * "java/lang/String.class". - */ - public static String convertToArchiveClassFileEntryName(String className) { - return convertToArchiveEntryNameBase(className) + ".class"; //$NON-NLS-1$ - } - - /** - * Convert a class to an archive class file entry name; - * e.g. java.lang.String.class is converted to - * "java/lang/String.class". - */ - public static String convertToArchiveClassFileEntryName(Class javaClass) { - return convertToArchiveClassFileEntryName(javaClass.getName()); - } - - - // ***** class => file (.class or .java) ***** - - /** - * Convert a class name to a file name base for the current O/S; - * e.g. "java.lang.String" is converted to - * "java/lang/String" on Unix and - * "java\\lang\\String" on Windows. - */ - public static String convertToFileNameBase(String className) { - return className.replace('.', File.separatorChar); - } - - /** - * Convert a class to a file name base for the current O/S; - * e.g. java.lang.String.class is converted to - * "java/lang/String" on Unix and - * "java\\lang\\String" on Windows. - */ - public static String convertToFileNameBase(Class javaClass) { - return convertToFileNameBase(javaClass.getName()); - } - - /** - * Convert a class name to a class file name for the current O/S; - * e.g. "java.lang.String" is converted to - * "java/lang/String.class" on Unix and - * "java\\lang\\String.class" on Windows. - */ - public static String convertToClassFileName(String className) { - return convertToFileNameBase(className) + ".class"; //$NON-NLS-1$ - } - - /** - * Convert a class to a class file name for the current O/S; - * e.g. java.lang.String.class is converted to - * "java/lang/String.class" on Unix and - * "java\\lang\\String.class" on Windows. - */ - public static String convertToClassFileName(Class javaClass) { - return convertToClassFileName(javaClass.getName()); - } - - /** - * Convert a class name to a class file for the current O/S; - * e.g. "java.lang.String" is converted to - * File(java/lang/String.class). - */ - public static File convertToClassFile(String className) { - return new File(convertToClassFileName(className)); - } - - /** - * Convert a class to a class file for the current O/S; - * e.g. java.lang.String.class is converted to - * File(java/lang/String.class). - */ - public static File convertToClassFile(Class javaClass) { - return convertToClassFile(javaClass.getName()); - } - - /** - * Convert a class name to a java file name for the current O/S; - * e.g. "java.lang.String" is converted to - * "java/lang/String.java" on Unixl and - * "java\\lang\\String.java" on Windows. - */ - public static String convertToJavaFileName(String className) { - return convertToFileNameBase(className) + ".java"; //$NON-NLS-1$ - } - - /** - * Convert a class to a java file name for the current O/S; - * e.g. java.lang.String.class is converted to - * "java/lang/String.java" on Unix and - * "java\\lang\\String.java" on Windows. - */ - public static String convertToJavaFileName(Class javaClass) { - return convertToJavaFileName(javaClass.getName()); - } - - /** - * Convert a class name to a java file for the current O/S; - * e.g. "java.lang.String" is converted to - * File(java/lang/String.java). - */ - public static File convertToJavaFile(String className) { - return new File(convertToJavaFileName(className)); - } - - /** - * Convert a class to a java file for the current O/S; - * e.g. java.lang.String.class is converted to - * File(java/lang/String.java). - */ - public static File convertToJavaFile(Class javaClass) { - return convertToJavaFile(javaClass.getName()); - } - - - // ***** class => resource ***** - - /** - * Convert a class to a resource name; - * e.g. java.lang.String.class is converted to - * "/java/lang/String.class". - */ - public static String convertToResourceName(Class javaClass) { - return '/' + convertToArchiveClassFileEntryName(javaClass); - } - - /** - * Convert a class to a resource; - * e.g. java.lang.String.class is converted to - * URL(jar:file:/C:/jdk/1.4.2_04/jre/lib/rt.jar!/java/lang/String.class). - */ - public static URL convertToResource(Class javaClass) { - return javaClass.getResource(convertToResourceName(javaClass)); - } - - - // ***** utilities ***** - - /** - * Return whether the specified file is an archive file; - * i.e. its name ends with ".zip" or ".jar". - */ - public static boolean fileNameIsArchive(String fileName) { - String ext = FileTools.extension(fileName).toLowerCase(); - return ext.equals(".jar") || ext.equals(".zip"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Return whether the specified file is an archive file; - * i.e. its name ends with ".zip" or ".jar". - */ - public static boolean fileIsArchive(File file) { - return fileNameIsArchive(file.getName()); - } - - /** - * Return what should be the fully-qualified file name - * for the JRE runtime JAR; - * e.g. "C:\jdk1.4.2_04\jre\lib\rt.jar". - */ - public static String rtJarName() { - return locationFor(java.lang.Object.class); - } - - /** - * Return the location from where the specified class was loaded. - */ - public static String locationFor(Class javaClass) { - URL url = convertToResource(javaClass); - String path; - try { - path = FileTools.buildFile(url).getPath(); - } catch (URISyntaxException ex) { - throw new RuntimeException(ex); - } - String protocol = url.getProtocol().toLowerCase(); - if (protocol.equals("jar")) { //$NON-NLS-1$ - // if the class is in a JAR, the URL will look something like this: - // jar:file:/C:/jdk/1.4.2_04/jre/lib/rt.jar!/java/lang/String.class - return path.substring(0, path.indexOf('!')); - } else if (protocol.equals("file")) { //$NON-NLS-1$ - // if the class is in a directory, the URL will look something like this: - // file:/C:/dev/main/mwdev/class/org/eclipse/dali/utility/Classpath.class - return path.substring(0, path.length() - convertToClassFileName(javaClass).length() - 1); - } else if (protocol.equals("bundleresource")) { //$NON-NLS-1$ - // if the class is in a bundle resource (Eclipse?), the URL will look something like this: - // bundleresource://43/org/eclipse/dali/utility/Classpath.class - return path.substring(0, path.length() - convertToClassFileName(javaClass).length() - 1); - } - - throw new IllegalStateException(url.toString()); - } - - /** - * Return the directories used by the Java Extension Mechanism. - */ - public static File[] javaExtensionDirectories() { - return convertToFiles(javaExtensionDirectoryNames()); - } - - /** - * Return the directory names used by the Java Extension Mechanism. - */ - public static String[] javaExtensionDirectoryNames() { - return System.getProperty("java.ext.dirs").split(File.pathSeparator); //$NON-NLS-1$ - } - - - // ***** internal ***** - - private static File[] convertToFiles(String[] fileNames) { - File[] files = new File[fileNames.length]; - for (int i = fileNames.length; i-- > 0; ) { - files[i] = new File(fileNames[i]); - } - return files; - } - - private static void addJarFileNamesTo(File dir, List jarFileNames) { - File[] jarFiles = jarFilesIn(dir); - for (File jarFile : jarFiles) { - jarFileNames.add(FileTools.canonicalFile(jarFile).getPath()); - } - } - - private static File[] jarFilesIn(File directory) { - return directory.listFiles(jarFileFilter()); - } - - private static FileFilter jarFileFilter() { - return new FileFilter() { - public boolean accept(File file) { - return FileTools.extension(file.getName()).toLowerCase().equals(".jar"); //$NON-NLS-1$ - } - }; - } - - - // ********** constructors ********** - - /** - * Construct a classpath with the specified entries. - */ - private Classpath(Entry[] entries) { - super(); - this.entries = entries; - } - - /** - * Construct a classpath with the specified entries. - */ - public Classpath(String... fileNames) { - this(buildEntries(fileNames)); - } - - /** - * Skip empty file names because they will end up expanding to the current - * working directory, which is not what we want. Empty file names actually - * occur with some frequency; such as when the classpath has been built up - * dynamically with too many separators. For example:
-	 *     "C:\dev\foo.jar;;C:\dev\bar.jar"
-	 * 
will be parsed into three file names:
-	 *     { "C:\dev\foo.jar", "", "C:\dev\bar.jar" }
-	 * 
- */ - private static Entry[] buildEntries(String[] fileNames) { - List entries = new ArrayList(); - for (String fileName : fileNames) { - if ((fileName != null) && (fileName.length() != 0)) { - entries.add(new Entry(fileName)); - } - } - return entries.toArray(new Entry[entries.size()]); - } - - /** - * Construct a classpath with the specified path. - */ - public Classpath(String path) { - this(path.split(File.pathSeparator)); - } - - /** - * Construct a classpath with the specified entries. - */ - public Classpath(Iterable fileNames) { - this(ArrayTools.array(fileNames, StringTools.EMPTY_STRING_ARRAY)); - } - - /** - * Consolidate the specified classpaths into a single classpath. - */ - public Classpath(Classpath... classpaths) { - this(consolidateEntries(classpaths)); - } - - private static Entry[] consolidateEntries(Classpath[] classpaths) { - List entries = new ArrayList(); - for (Classpath classpath : classpaths) { - CollectionTools.addAll(entries, classpath.getEntries()); - } - return entries.toArray(new Entry[entries.size()]); - } - - - // ********** public API ********** - - /** - * Return the classpath's entries. - */ - public Iterable getEntries() { - return new ArrayIterable(this.entries); - } - - /** - * Return the classpath's path. - */ - public String getPath() { - int max = this.entries.length - 1; - if (max == -1) { - return ""; //$NON-NLS-1$ - } - StringBuilder sb = new StringBuilder(2000); - // stop one short of the end of the array - for (int i = 0; i < max; i++) { - sb.append(this.entries[i].getFileName()); - sb.append(File.pathSeparatorChar); - } - sb.append(this.entries[max].getFileName()); - return sb.toString(); - } - - /** - * Search the classpath for the specified (unqualified) file - * and return its entry. Return null if an entry is not found. - * For example, you could use this method to find the entry - * for "rt.jar" or "toplink.jar". - */ - public Entry getEntryForFileNamed(String shortFileName) { - for (Entry entry : this.entries) { - if (entry.getFile().getName().equals(shortFileName)) { - return entry; - } - } - return null; - } - - /** - * Return the first entry file in the classpath - * that contains the specified class. - * Return null if an entry is not found. - */ - public Entry getEntryForClassNamed(String className) { - String relativeClassFileName = convertToClassFileName(className); - String archiveEntryName = convertToArchiveClassFileEntryName(className); - for (Entry entry : this.entries) { - if (entry.contains(relativeClassFileName, archiveEntryName)) { - return entry; - } - } - return null; - } - - /** - * Return the names of all the classes discovered on the classpath, - * with duplicates removed. - * @see #classNames() - */ - public Iterable getClassNames() { - return this.getClassNames(Filter.Null.instance()); - } - - /** - * Return the names of all the classes discovered on the classpath - * and accepted by the specified filter, with duplicates removed. - * @see #classNames(Filter) - */ - public Iterable getClassNames(Filter filter) { - Collection classNames = new HashSet(10000); - this.addClassNamesTo(classNames, filter); - return classNames; - } - - /** - * Add the names of all the classes discovered on the classpath - * to the specified collection. - */ - public void addClassNamesTo(Collection classNames) { - this.addClassNamesTo(classNames, Filter.Null.instance()); - } - - /** - * Add the names of all the classes discovered on the classpath - * and accepted by the specified filter to the specified collection. - */ - public void addClassNamesTo(Collection classNames, Filter filter) { - for (Entry entry : this.entries) { - entry.addClassNamesTo(classNames, filter); - } - } - - /** - * Return the names of all the classes discovered on the classpath. - * Just a bit more performant than {@link #getClassNames()}. - */ - public Iterator classNames() { - return this.classNames(Filter.Null.instance()); - } - - /** - * Return the names of all the classes discovered on the classpath - * that are accepted by the specified filter. - * Just a bit more performant than {@link #getClassNames(Filter)}. - */ - public Iterator classNames(Filter filter) { - return new CompositeIterator(this.entryClassNamesIterators(filter)); - } - - private Iterator> entryClassNamesIterators(final Filter filter) { - return new TransformationIterator>(new ArrayIterator(this.entries)) { - @Override - protected Iterator transform(Entry entry) { - return entry.classNames(filter); - } - }; - } - - /** - * Return a "compressed" version of the classpath with its - * duplicate entries eliminated. - */ - public Classpath compressed() { - return new Classpath(ArrayTools.removeDuplicateElements(this.entries)); - } - - /** - * Convert the classpath to an array of URLs - * (that can be used to instantiate a {@link java.net.URLClassLoader}). - */ - public Iterable getURLs() { - int len = this.entries.length; - URL[] urls = new URL[len]; - for (int i = 0; i < len; i++) { - urls[i] = this.entries[i].getURL(); - } - return new ArrayIterable(urls); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.getPath()); - } - - - // ********** inner class ********** - - /** - * Entry models a Java classpath entry, which can be either a - * directory containing .class files or a JAR file (or, - * similarly, a .zip file). The entry can return the names of - * classes found in it etc. - */ - public static class Entry implements Serializable { - private final String fileName; - private final File file; - private final File canonicalFile; - - private static final long serialVersionUID = 1L; - - Entry(String fileName) { - super(); - if ((fileName == null) || (fileName.length() == 0)) { - throw new IllegalArgumentException("'fileName' must be non-empty"); //$NON-NLS-1$ - } - this.fileName = fileName; - this.file = new File(fileName); - this.canonicalFile = FileTools.canonicalFile(this.file); - } - - public String getFileName() { - return this.fileName; - } - - public File getFile() { - return this.file; - } - - public File getCanonicalFile() { - return this.canonicalFile; - } - - public String getCanonicalFileName() { - return this.canonicalFile.getAbsolutePath(); - } - - @Override - public boolean equals(Object o) { - if ( ! (o instanceof Entry)) { - return false; - } - return ((Entry) o).canonicalFile.equals(this.canonicalFile); - } - - @Override - public int hashCode() { - return this.canonicalFile.hashCode(); - } - - /** - * Return the entry's "canonical" URL. - */ - public URL getURL() { - try { - return this.canonicalFile.toURI().toURL(); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - - /** - * Return whether the entry contains the specified class. - */ - public boolean contains(Class javaClass) { - return this.contains(javaClass.getName()); - } - - /** - * Return whether the entry contains the specified class. - */ - public boolean contains(String className) { - return this.contains(convertToClassFileName(className), convertToArchiveClassFileEntryName(className)); - } - - /** - * Return whether the entry contains either the specified relative - * class file or the specified archive entry. - * Not the prettiest signature, but it's internal.... - */ - boolean contains(String relativeClassFileName, String archiveEntryName) { - if ( ! this.canonicalFile.exists()) { - return false; - } - if (this.canonicalFile.isDirectory() && (new File(this.canonicalFile, relativeClassFileName)).exists()) { - return true; - } - return (fileIsArchive(this.canonicalFile) && this.archiveContainsEntry(archiveEntryName)); - } - - /** - * Return whether the entry's archive contains the specified entry. - */ - private boolean archiveContainsEntry(String zipEntryName) { - ZipFile zipFile = null; - ZipEntry zipEntry = null; - try { - zipFile = new ZipFile(this.canonicalFile); - zipEntry = zipFile.getEntry(zipEntryName); - } catch (IOException ex) { - // something is wrong, leave the entry null - } finally { - try { - if (zipFile != null) { - zipFile.close(); - } - } catch (IOException ex) { - zipEntry = null; // something is wrong, clear out the entry - } - } - return zipEntry != null; - } - - /** - * Return the names of all the classes discovered in the entry. - * @see #classNames() - */ - public Iterable getClassNames() { - return this.getClassNames(Filter.Null.instance()); - } - - /** - * Return the names of all the classes discovered in the entry - * and accepted by the specified filter. - * @see #classNames(Filter) - */ - public Iterable getClassNames(Filter filter) { - Collection classNames = new ArrayList(2000); - this.addClassNamesTo(classNames, filter); - return classNames; - } - - /** - * Add the names of all the classes discovered in the entry - * to the specified collection. - */ - public void addClassNamesTo(Collection classNames) { - this.addClassNamesTo(classNames, Filter.Null.instance()); - } - - /** - * Add the names of all the classes discovered in the entry - * and accepted by the specified filter to the specified collection. - */ - public void addClassNamesTo(Collection classNames, Filter filter) { - if (this.canonicalFile.exists()) { - if (this.canonicalFile.isDirectory()) { - this.addClassNamesForDirectoryTo(classNames, filter); - } else if (fileIsArchive(this.canonicalFile)) { - this.addClassNamesForArchiveTo(classNames, filter); - } - } - } - - /** - * Add the names of all the classes discovered - * under the entry's directory and accepted by - * the specified filter to the specified collection. - */ - private void addClassNamesForDirectoryTo(Collection classNames, Filter filter) { - int start = this.canonicalFile.getAbsolutePath().length() + 1; - for (Iterator stream = this.classFilesForDirectory(); stream.hasNext(); ) { - String className = convertToClassName(stream.next().getAbsolutePath().substring(start)); - if (filter.accept(className)) { - classNames.add(className); - } - } - } - - /** - * Return an iterator on all the class files discovered - * under the entry's directory. - */ - private Iterator classFilesForDirectory() { - return new FilteringIterator(FileTools.filesInTree(this.canonicalFile)) { - @Override - protected boolean accept(File next) { - return Entry.this.fileNameMightBeForClassFile(next.getName()); - } - }; - } - - /** - * Add the names of all the classes discovered - * in the entry's archive file and accepted by the - * specified filter to the specified collection. - */ - private void addClassNamesForArchiveTo(Collection classNames, Filter filter) { - ZipFile zipFile = null; - try { - zipFile = new ZipFile(this.canonicalFile); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - for (Enumeration stream = zipFile.entries(); stream.hasMoreElements(); ) { - ZipEntry zipEntry = stream.nextElement(); - String zipEntryName = zipEntry.getName(); - if (this.fileNameMightBeForClassFile(zipEntryName)) { - String className = convertToClassName(zipEntryName); - if (filter.accept(className)) { - classNames.add(className); - } - } - } - try { - zipFile.close(); - } catch (IOException ex) { - return; - } - } - - /** - * Return whether the specified file might be a Java class file. - * The file name must at least end with ".class" and contain no spaces. - * (Neither class names nor package names may contain spaces.) - * Whether it actually is a class file will need to be determined by - * a class loader. - */ - boolean fileNameMightBeForClassFile(String name) { - return FileTools.extension(name).toLowerCase().equals(".class") //$NON-NLS-1$ - && (name.indexOf(' ') == -1); - } - - /** - * Return the names of all the classes discovered on the classpath. - * Just a bit more performant than {@link #getClassNames()}. - */ - public Iterator classNames() { - return this.classNames(Filter.Null.instance()); - } - - /** - * Return the names of all the classes discovered on the classpath - * that are accepted by the specified filter. - * Just a bit more performant than {@link #getClassNames(Filter)}. - */ - public Iterator classNames(Filter filter) { - if (this.canonicalFile.exists()) { - if (this.canonicalFile.isDirectory()) { - return this.classNamesForDirectory(filter); - } - if (fileIsArchive(this.canonicalFile)) { - return this.classNamesForArchive(filter); - } - } - return EmptyIterator.instance(); - } - - /** - * Return the names of all the classes discovered - * under the entry's directory and accepted by - * the specified filter. - */ - private Iterator classNamesForDirectory(Filter filter) { - return new FilteringIterator(this.classNamesForDirectory(), filter); - } - - /** - * Transform the class files to class names. - */ - private Iterator classNamesForDirectory() { - final int start = this.canonicalFile.getAbsolutePath().length() + 1; - return new TransformationIterator(this.classFilesForDirectory()) { - @Override - protected String transform(File f) { - return convertToClassName(f.getAbsolutePath().substring(start)); - } - }; - } - - /** - * Return the names of all the classes discovered - * in the entry's archive file and accepted by the - * specified filter. - */ - private Iterator classNamesForArchive(Filter filter) { - // we can't simply wrap iterators here because we need to close the archive file... - ZipFile zipFile = null; - try { - zipFile = new ZipFile(this.canonicalFile); - } catch (IOException ex) { - return EmptyIterator.instance(); - } - Collection classNames = new HashSet(zipFile.size()); - for (Enumeration stream = zipFile.entries(); stream.hasMoreElements(); ) { - ZipEntry zipEntry = stream.nextElement(); - String zipEntryName = zipEntry.getName(); - if (this.fileNameMightBeForClassFile(zipEntryName)) { - String className = convertToClassName(zipEntryName); - if (filter.accept(className)) { - classNames.add(className); - } - } - } - try { - zipFile.close(); - } catch (IOException ex) { - return EmptyIterator.instance(); - } - return classNames.iterator(); - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CollectionTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CollectionTools.java deleted file mode 100644 index aca8d2c354..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CollectionTools.java +++ /dev/null @@ -1,1957 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.Enumeration; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedHashSet; -import java.util.List; -import java.util.ListIterator; -import java.util.Random; -import java.util.RandomAccess; -import java.util.TreeSet; -import java.util.Vector; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.SingleElementIterator; -import org.eclipse.jpt.common.utility.internal.iterators.SingleElementListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.SuperIteratorWrapper; - -/** - * {@link Collection}-related utility methods. - */ -public final class CollectionTools { - - // ********** add all ********** - - /** - * Add all the elements returned by the specified iterable - * to the specified collection. - * Return whether the collection changed as a result. - *

- * Collection.addAll(Iterable iterable) - */ - public static boolean addAll(Collection collection, Iterable iterable) { - return addAll(collection, iterable.iterator()); - } - - /** - * Add all the elements returned by the specified iterable - * to the specified collection. - * Return whether the collection changed as a result. - *

- * Collection.addAll(Iterable iterable) - */ - public static boolean addAll(Collection collection, Iterable iterable, int size) { - return addAll(collection, iterable.iterator(), size); - } - - /** - * Add all the elements returned by the specified iterator - * to the specified collection. - * Return whether the collection changed as a result. - *

- * Collection.addAll(Iterator iterator) - */ - public static boolean addAll(Collection collection, Iterator iterator) { - return iterator.hasNext() ? addAll_(collection, iterator) : false; - } - - /** - * assume the iterator is not empty - */ - private static boolean addAll_(Collection collection, Iterator iterator) { - boolean modified = false; - while (iterator.hasNext()) { - modified |= collection.add(iterator.next()); - } - return modified; - } - - /** - * Add all the elements returned by the specified iterator - * to the specified collection. - * Return whether the collection changed as a result. - *

- * Collection.addAll(Iterator iterator) - */ - public static boolean addAll(Collection collection, Iterator iterator, int size) { - return iterator.hasNext() ? collection.addAll(list(iterator, size)) : false; - } - - /** - * Add all the elements in the specified array - * to the specified collection. - * Return whether the collection changed as a result. - *

- * Collection.addAll(Object[] array) - */ - public static boolean addAll(Collection collection, E... array) { - return (array.length == 0) ? false : addAll_(collection, array); - } - - /** - * assume the array is not empty - */ - private static boolean addAll_(Collection collection, E... array) { - boolean modified = false; - for (E element : array) { - modified |= collection.add(element); - } - return modified; - } - - /** - * Add all the elements returned by the specified iterable - * to the specified list at the specified index. - * Return whether the list changed as a result. - *

- * List.addAll(Iterable iterable) - */ - public static boolean addAll(List list, int index, Iterable iterable) { - return addAll(list, index, iterable.iterator()); - } - - /** - * Add all the elements returned by the specified iterable - * to the specified list at the specified index. - * Return whether the list changed as a result. - *

- * List.addAll(Iterable iterable) - */ - public static boolean addAll(List list, int index, Iterable iterable, int size) { - return addAll(list, index, iterable.iterator(), size); - } - - /** - * Add all the elements returned by the specified iterator - * to the specified list at the specified index. - * Return whether the list changed as a result. - *

- * List.addAll(Iterator iterator) - */ - public static boolean addAll(List list, int index, Iterator iterator) { - return iterator.hasNext() ? list.addAll(index, list(iterator)) : false; - } - - /** - * Add all the elements returned by the specified iterator - * to the specified list at the specified index. - * Return whether the list changed as a result. - *

- * List.addAll(Iterator iterator) - */ - public static boolean addAll(List list, int index, Iterator iterator, int size) { - return iterator.hasNext() ? list.addAll(index, list(iterator, size)) : false; - } - - /** - * Add all the elements in the specified array - * to the specified list at the specified index. - * Return whether the list changed as a result. - *

- * List.addAll(Object[] array) - */ - public static boolean addAll(List list, int index, E... array) { - return (array.length == 0) ? false : list.addAll(index, Arrays.asList(array)); - } - - - // ********** bag ********** - - /** - * Return a bag corresponding to the specified enumeration. - *

- * HashBag(Enumeration enumeration) - */ - public static HashBag bag(Enumeration enumeration) { - return bag(enumeration, new HashBag()); - } - - /** - * Return a bag corresponding to the specified enumeration. - * The specified enumeration size is a performance hint. - *

- * HashBag(Enumeration enumeration) - */ - public static HashBag bag(Enumeration enumeration, int enumerationSize) { - return bag(enumeration, new HashBag(enumerationSize)); - } - - private static HashBag bag(Enumeration enumeration, HashBag bag) { - while (enumeration.hasMoreElements()) { - bag.add(enumeration.nextElement()); - } - return bag; - } - - /** - * Return a bag corresponding to the specified iterable. - *

- * HashBag(Iterable iterable) - */ - public static HashBag bag(Iterable iterable) { - return bag(iterable.iterator()); - } - - /** - * Return a bag corresponding to the specified iterable. - * The specified iterable size is a performance hint. - *

- * HashBag(Iterable iterable) - */ - public static HashBag bag(Iterable iterable, int iterableSize) { - return bag(iterable.iterator(), iterableSize); - } - - /** - * Return a bag corresponding to the specified iterator. - *

- * HashBag(Iterator iterator) - */ - public static HashBag bag(Iterator iterator) { - return bag(iterator, new HashBag()); - } - - /** - * Return a bag corresponding to the specified iterator. - * The specified iterator size is a performance hint. - *

- * HashBag(Iterator iterator) - */ - public static HashBag bag(Iterator iterator, int iteratorSize) { - return bag(iterator, new HashBag(iteratorSize)); - } - - private static HashBag bag(Iterator iterator, HashBag bag) { - while (iterator.hasNext()) { - bag.add(iterator.next()); - } - return bag; - } - - /** - * Return a bag corresponding to the specified array. - *

- * HashBag(Object[] array) - */ - public static HashBag bag(E... array) { - int len = array.length; - HashBag bag = new HashBag(len); - for (E item : array) { - bag.add(item); - } - return bag; - } - - - // ********** collection ********** - - /** - * Return a collection corresponding to the specified enumeration. - */ - public static HashBag collection(Enumeration enumeration) { - return bag(enumeration); - } - - /** - * Return a collection corresponding to the specified enumeration. - * The specified enumeration size is a performance hint. - */ - public static HashBag collection(Enumeration enumeration, int enumerationSize) { - return bag(enumeration, enumerationSize); - } - - /** - * Return a collection corresponding to the specified iterable. - */ - public static HashBag collection(Iterable iterable) { - return collection(iterable.iterator()); - } - - /** - * Return a collection corresponding to the specified iterable. - * The specified iterable size is a performance hint. - */ - public static HashBag collection(Iterable iterable, int iterableSize) { - return collection(iterable.iterator(), iterableSize); - } - - /** - * Return a collection corresponding to the specified iterator. - */ - public static HashBag collection(Iterator iterator) { - return bag(iterator); - } - - /** - * Return a collection corresponding to the specified iterator. - * The specified iterator size is a performance hint. - */ - public static HashBag collection(Iterator iterator, int iteratorSize) { - return bag(iterator, iteratorSize); - } - - /** - * Return a collection corresponding to the specified array. - */ - public static HashBag collection(E... array) { - return bag(array); - } - - - // ********** contains ********** - - /** - * Return whether the specified enumeration contains the - * specified element. - *

- * Enumeration.contains(Object o) - */ - public static boolean contains(Enumeration enumeration, Object value) { - if (value == null) { - while (enumeration.hasMoreElements()) { - if (enumeration.nextElement() == null) { - return true; - } - } - } else { - while (enumeration.hasMoreElements()) { - if (value.equals(enumeration.nextElement())) { - return true; - } - } - } - return false; - } - - /** - * Return whether the specified iterable contains the - * specified element. - *

- * Iterable.contains(Object o) - */ - public static boolean contains(Iterable iterable, Object value) { - return contains(iterable.iterator(), value); - } - - /** - * Return whether the specified iterator contains the - * specified element. - *

- * Iterator.contains(Object o) - */ - public static boolean contains(Iterator iterator, Object value) { - if (value == null) { - while (iterator.hasNext()) { - if (iterator.next() == null) { - return true; - } - } - } else { - while (iterator.hasNext()) { - if (value.equals(iterator.next())) { - return true; - } - } - } - return false; - } - - - // ********** contains all ********** - - /** - * Return whether the specified collection contains all of the - * elements in the specified iterable. - *

- * Collection.containsAll(Iterable iterable) - */ - public static boolean containsAll(Collection collection, Iterable iterable) { - return containsAll(collection, iterable.iterator()); - } - - /** - * Return whether the specified collection contains all of the - * elements in the specified iterator. - *

- * Collection.containsAll(Iterator iterator) - */ - public static boolean containsAll(Collection collection, Iterator iterator) { - while (iterator.hasNext()) { - if ( ! collection.contains(iterator.next())) { - return false; - } - } - return true; - } - - /** - * Return whether the specified collection contains all of the - * elements in the specified array. - *

- * Collection.containsAll(Object[] array) - */ - public static boolean containsAll(Collection collection, Object... array) { - for (int i = array.length; i-- > 0; ) { - if ( ! collection.contains(array[i])) { - return false; - } - } - return true; - } - - /** - * Return whether the specified iterable contains all of the - * elements in the specified collection. - *

- * Iterable.containsAll(Collection collection) - */ - public static boolean containsAll(Iterable iterable, Collection collection) { - return containsAll(iterable.iterator(), collection); - } - - /** - * Return whether the specified iterable contains all of the - * elements in the specified collection. - * The specified iterable size is a performance hint. - *

- * Iterable.containsAll(Collection collection) - */ - public static boolean containsAll(Iterable iterable, int iterableSize, Collection collection) { - return containsAll(iterable.iterator(), iterableSize, collection); - } - - /** - * Return whether the specified iterable 1 contains all of the - * elements in the specified iterable 2. - *

- * Iterable.containsAll(Iterable iterable) - */ - public static boolean containsAll(Iterable iterable1, Iterable iterable2) { - return containsAll(iterable1.iterator(), iterable2.iterator()); - } - - /** - * Return whether the specified iterable 1 contains all of the - * elements in the specified iterable 2. - * The specified iterable 1 size is a performance hint. - *

- * Iterable.containsAll(Iterable iterable) - */ - public static boolean containsAll(Iterable iterable1, int iterable1Size, Iterable iterable2) { - return containsAll(iterable1.iterator(), iterable1Size, iterable2.iterator()); - } - - /** - * Return whether the specified iterable contains all of the - * elements in the specified iterator. - *

- * Iterable.containsAll(Iterator iterator) - */ - public static boolean containsAll(Iterable iterable, Iterator iterator) { - return containsAll(iterable.iterator(), iterator); - } - - /** - * Return whether the specified iterable contains all of the - * elements in the specified iterator. - * The specified iterable size is a performance hint. - *

- * Iterable.containsAll(Iterator iterator) - */ - public static boolean containsAll(Iterable iterable, int iterableSize, Iterator iterator) { - return containsAll(iterable.iterator(), iterableSize, iterator); - } - - /** - * Return whether the specified iterable contains all of the - * elements in the specified array. - *

- * Iterable.containsAll(Object[] array) - */ - public static boolean containsAll(Iterable iterable, Object... array) { - return containsAll(iterable.iterator(), array); - } - - /** - * Return whether the specified iterable contains all of the - * elements in the specified array. - * The specified iterable size is a performance hint. - *

- * Iterable.containsAll(Object[] array) - */ - public static boolean containsAll(Iterable iterable, int iterableSize, Object... array) { - return containsAll(iterable.iterator(), iterableSize, array); - } - - /** - * Return whether the specified iterator contains all of the - * elements in the specified collection. - *

- * Iterator.containsAll(Collection collection) - */ - public static boolean containsAll(Iterator iterator, Collection collection) { - return set(iterator).containsAll(collection); - } - - /** - * Return whether the specified iterator contains all of the - * elements in the specified collection. - * The specified iterator size is a performance hint. - *

- * Iterator.containsAll(Collection collection) - */ - public static boolean containsAll(Iterator iterator, int iteratorSize, Collection collection) { - return set(iterator, iteratorSize).containsAll(collection); - } - - /** - * Return whether the specified iterator contains all of the - * elements in the specified iterable. - *

- * Iterator.containsAll(Iterable iterable) - */ - public static boolean containsAll(Iterator iterator, Iterable iterable) { - return containsAll(set(iterator), iterable); - } - - /** - * Return whether the specified iterator contains all of the - * elements in the specified iterable. - * The specified iterator size is a performance hint. - *

- * Iterator.containsAll(Iterable iterable) - */ - public static boolean containsAll(Iterator iterator, int iteratorSize, Iterable iterable) { - return containsAll(set(iterator, iteratorSize), iterable); - } - - /** - * Return whether the specified iterator 1 contains all of the - * elements in the specified iterator 2. - *

- * Iterator.containsAll(Iterator iterator) - */ - public static boolean containsAll(Iterator iterator1, Iterator iterator2) { - return containsAll(set(iterator1), iterator2); - } - - /** - * Return whether the specified iterator 1 contains all of the - * elements in the specified iterator 2. - * The specified iterator 1 size is a performance hint. - *

- * Iterator.containsAll(Iterator iterator) - */ - public static boolean containsAll(Iterator iterator1, int iterator1Size, Iterator iterator2) { - return containsAll(set(iterator1, iterator1Size), iterator2); - } - - /** - * Return whether the specified iterator contains all of the - * elements in the specified array. - *

- * Iterator.containsAll(Object[] array) - */ - public static boolean containsAll(Iterator iterator, Object... array) { - return containsAll(set(iterator), array); - } - - /** - * Return whether the specified iterator contains all of the - * elements in the specified array. - * The specified iterator size is a performance hint. - *

- * Iterator.containsAll(Object[] array) - */ - public static boolean containsAll(Iterator iterator, int iteratorSize, Object... array) { - return containsAll(set(iterator, iteratorSize), array); - } - - - // ********** diff ********** - - /** - * Return the index of the first elements in the specified - * lists that are different, beginning at the end. - * If the lists are identical, return -1. - * If the lists are different sizes, return the index of the - * last element in the longer list. - * Use the elements' {@link Object#equals(Object)} method to compare the - * elements. - *

- * Collections.diffEnd(List list1, List list2) - */ - public static int diffEnd(List list1, List list2) { - return ArrayTools.diffEnd(list1.toArray(), list2.toArray()); - } - - /** - * Return the range of elements in the specified - * arrays that are different. - * If the arrays are identical, return [size, -1]. - * Use the elements' {@link Object#equals(Object)} method to compare the - * elements. - *

- * Collections.diffRange(List list1, List list2) - * @see #diffStart(List, List) - * @see #diffEnd(List, List) - */ - public static Range diffRange(List list1, List list2) { - return ArrayTools.diffRange(list1.toArray(), list2.toArray()); - } - - /** - * Return the index of the first elements in the specified - * lists that are different. If the lists are identical, return - * the size of the two lists (i.e. one past the last index). - * If the lists are different sizes and all the elements in - * the shorter list match their corresponding elements in - * the longer list, return the size of the shorter list - * (i.e. one past the last index of the shorter list). - * Use the elements' {@link Object#equals(Object)} method to compare the - * elements. - *

- * Collections.diffStart(List list1, List list2) - */ - public static int diffStart(List list1, List list2) { - return ArrayTools.diffStart(list1.toArray(), list2.toArray()); - } - - - // ********** identity diff ********** - - /** - * Return the index of the first elements in the specified - * lists that are different, beginning at the end. - * If the lists are identical, return -1. - * If the lists are different sizes, return the index of the - * last element in the longer list. - * Use object identity to compare the elements. - *

- * Collections.identityDiffEnd(List list1, List list2) - */ - public static int identityDiffEnd(List list1, List list2) { - return ArrayTools.identityDiffEnd(list1.toArray(), list2.toArray()); - } - - /** - * Return the range of elements in the specified - * arrays that are different. - * If the arrays are identical, return [size, -1]. - * Use object identity to compare the elements. - *

- * Collections.identityDiffStart(List list1, List list2) - * @see #identityDiffStart(List, List) - * @see #identityDiffEnd(List, List) - */ - public static Range identityDiffRange(List list1, List list2) { - return ArrayTools.identityDiffRange(list1.toArray(), list2.toArray()); - } - - /** - * Return the index of the first elements in the specified - * lists that are different. If the lists are identical, return - * the size of the two lists (i.e. one past the last index). - * If the lists are different sizes and all the elements in - * the shorter list match their corresponding elements in - * the longer list, return the size of the shorter list - * (i.e. one past the last index of the shorter list). - * Use object identity to compare the elements. - *

- * Collections.identityDiffStart(List list1, List list2) - */ - public static int identityDiffStart(List list1, List list2) { - return ArrayTools.identityDiffStart(list1.toArray(), list2.toArray()); - } - - - // ********** elements are equal ********** - - /** - * Return whether the specified iterables do not return the same elements - * in the same order. - */ - public static boolean elementsAreDifferent(Iterable iterable1, Iterable iterable2) { - return elementsAreDifferent(iterable1.iterator(), iterable2.iterator()); - } - - /** - * Return whether the specified iterators do not return the same elements - * in the same order. - */ - public static boolean elementsAreDifferent(Iterator iterator1, Iterator iterator2) { - return ! elementsAreEqual(iterator1, iterator2); - } - - /** - * Return whether the specified iterables return equal elements - * in the same order. - *

- * Iterable.elementsAreEqual(Iterable iterable) - */ - public static boolean elementsAreEqual(Iterable iterable1, Iterable iterable2) { - return elementsAreEqual(iterable1.iterator(), iterable2.iterator()); - } - - /** - * Return whether the specified iterators return equal elements - * in the same order. - *

- * Iterator.elementsAreEqual(Iterator iterator) - */ - public static boolean elementsAreEqual(Iterator iterator1, Iterator iterator2) { - while (iterator1.hasNext() && iterator2.hasNext()) { - if (Tools.valuesAreDifferent(iterator1.next(), iterator2.next())) { - return false; - } - } - return ! (iterator1.hasNext() || iterator2.hasNext()); - } - - - // ********** elements are identical ********** - - /** - * Return whether the specified iterables return the same elements. - *

- * Iterable.identical(Iterable iterable) - */ - public static boolean elementsAreIdentical(Iterable iterable1, Iterable iterable2) { - return elementsAreIdentical(iterable1.iterator(), iterable2.iterator()); - } - - /** - * Return whether the specified iterators return the same elements. - *

- * Iterator.identical(Iterator iterator) - */ - public static boolean elementsAreIdentical(Iterator iterator1, Iterator iterator2) { - while (iterator1.hasNext() && iterator2.hasNext()) { - if (iterator1.next() != iterator2.next()) { - return false; - } - } - return ! (iterator1.hasNext() || iterator2.hasNext()); - } - - - // ********** get ********** - - /** - * Return the element corresponding to the specified index - * in the specified iterable. - *

- * Iterable.get(int index) - */ - public static E get(Iterable iterable, int index) { - return get(iterable.iterator(), index); - } - - /** - * Return the element corresponding to the specified index - * in the specified iterator. - *

- * Iterator.get(int index) - */ - public static E get(Iterator iterator, int index) { - int i = 0; - while (iterator.hasNext()) { - E next = iterator.next(); - if (i++ == index) { - return next; - } - } - throw new IndexOutOfBoundsException(String.valueOf(index) + ':' + String.valueOf(i)); - } - - - // ********** hash code ********** - - public static int hashCode(Iterable iterable) { - if (iterable == null) { - return 0; - } - int hash = 1; - for (Object element : iterable) { - hash = 31 * hash + (element == null ? 0 : element.hashCode()); - } - return hash; - } - - - // ********** index of ********** - - /** - * Return the index of the first occurrence of the - * specified element in the specified iterable; - * return -1 if there is no such index. - *

- * Iterable.indexOf(Object o) - */ - public static int indexOf(Iterable iterable, Object value) { - return indexOf(iterable.iterator(), value); - } - - /** - * Return the index of the first occurrence of the - * specified element in the specified iterator; - * return -1 if there is no such index. - *

- * Iterator.indexOf(Object o) - */ - public static int indexOf(Iterator iterator, Object value) { - if (value == null) { - for (int i = 0; iterator.hasNext(); i++) { - if (iterator.next() == null) { - return i; - } - } - } else { - for (int i = 0; iterator.hasNext(); i++) { - if (value.equals(iterator.next())) { - return i; - } - } - } - return -1; - } - - - // ********** insertion index of ********** - - /** - * Return an index of where the specified comparable object - * can be inserted into the specified sorted list and still keep - * the list sorted. If the specified sorted list is an instance of - * {@link RandomAccess} return the maximum insertion index; - * otherwise return the minimum insertion index. - */ - public static > int insertionIndexOf(List sortedList, Comparable value) { - if (sortedList instanceof RandomAccess) { - for (int i = sortedList.size(); i-- > 0; ) { - if (value.compareTo(sortedList.get(i)) >= 0) { - return i + 1; - } - } - return 0; - } - int i = 0; - for (E element : sortedList) { - if (value.compareTo(element) <= 0) { - return i; - } - i++; - } - return i; - } - - /** - * Return an index of where the specified comparable object - * can be inserted into the specified sorted list and still keep - * the list sorted. If the specified sorted list is an instance of - * {@link RandomAccess} return the maximum insertion index; - * otherwise return the minimum insertion index. - */ - public static int insertionIndexOf(List sortedList, E value, Comparator comparator) { - if (sortedList instanceof RandomAccess) { - for (int i = sortedList.size(); i-- > 0; ) { - if (comparator.compare(value, sortedList.get(i)) >= 0) { - return i + 1; - } - } - return 0; - } - int i = 0; - for (E element : sortedList) { - if (comparator.compare(value, element) <= 0) { - return i; - } - i++; - } - return i; - } - - - // ********** iterable/iterator ********** - - /** - * Return an iterable on the elements in the specified array. - *

- * Arrays.iterable(Object[] array) - */ - public static Iterable iterable(E... array) { - return new ArrayIterable(array); - } - - /** - * Return an iterator on the elements in the specified array. - *

- * Arrays.iterator(Object[] array) - */ - public static Iterator iterator(E... array) { - return new ArrayIterator(array); - } - - - // ********** last ********** - - /** - * Return the specified iterable's last element. - *

- * Iterable.last() - * - * @exception java.util.NoSuchElementException iterable is empty. - */ - public static E last(Iterable iterable) { - return last(iterable.iterator()); - } - - /** - * Return the specified iterator's last element. - *

- * Iterator.last() - * - * @exception java.util.NoSuchElementException iterator is empty. - */ - public static E last(Iterator iterator) { - E last; - do { - last = iterator.next(); - } while (iterator.hasNext()); - return last; - } - - - // ********** last index of ********** - - /** - * Return the index of the last occurrence of the - * specified element in the specified iterable; - * return -1 if there is no such index. - *

- * Iterable.lastIndexOf(Object o) - */ - public static int lastIndexOf(Iterable iterable, Object value) { - return lastIndexOf(iterable.iterator(), value); - } - - /** - * Return the index of the last occurrence of the - * specified element in the specified iterable; - * return -1 if there is no such index. - * The specified iterable size is a performance hint. - *

- * Iterable.lastIndexOf(Object o) - */ - public static int lastIndexOf(Iterable iterable, int iterableSize, Object value) { - return lastIndexOf(iterable.iterator(), iterableSize, value); - } - - /** - * Return the index of the last occurrence of the - * specified element in the specified iterator; - * return -1 if there is no such index. - *

- * Iterator.lastIndexOf(Object o) - */ - public static int lastIndexOf(Iterator iterator, Object value) { - return iterator.hasNext() ? list(iterator).lastIndexOf(value) : -1; - } - - /** - * Return the index of the last occurrence of the - * specified element in the specified iterator; - * return -1 if there is no such index. - * The specified iterator size is a performance hint. - *

- * Iterator.lastIndexOf(Object o) - */ - public static int lastIndexOf(Iterator iterator, int iteratorSize, Object value) { - return iterator.hasNext() ? list(iterator, iteratorSize).lastIndexOf(value) : -1; - } - - - // ********** list ********** - - /** - * Return a list corresponding to the specified iterable. - *

- * Iterable.toList() - */ - public static ArrayList list(Iterable iterable) { - return list(iterable.iterator()); - } - - /** - * Return a list corresponding to the specified iterable. - * The specified iterable size is a performance hint. - *

- * Iterable.toList() - */ - public static ArrayList list(Iterable iterable, int iterableSize) { - return list(iterable.iterator(), iterableSize); - } - - /** - * Return a list corresponding to the specified iterator. - *

- * Iterator.toList() - */ - public static ArrayList list(Iterator iterator) { - return list(iterator, new ArrayList()); - } - - /** - * Return a list corresponding to the specified iterator. - * The specified iterator size is a performance hint. - *

- * Iterator.toList() - */ - public static ArrayList list(Iterator iterator, int iteratorSize) { - return list(iterator, new ArrayList(iteratorSize)); - } - - private static ArrayList list(Iterator iterator, ArrayList list) { - while (iterator.hasNext()) { - list.add(iterator.next()); - } - return list; - } - - /** - * Return a list corresponding to the specified array. - * Unlike {@link Arrays#asList(Object[])}, the list - * is modifiable and is not backed by the array. - */ - public static ArrayList list(E... array) { - return new ArrayList(Arrays.asList(array)); - } - - /** - * Return a list iterator for the specified array. - *

- * Arrays.listIterator(Object[] array) - */ - public static ListIterator listIterator(E... array) { - return listIterator(array, 0); - } - - /** - * Return a list iterator for the specified array - * starting at the specified position in the array. - *

- * Arrays.listIterator(Object[] array, int index) - */ - public static ListIterator listIterator(E[] array, int start) { - return listIterator(array, start, array.length - start); - } - - /** - * Return a list iterator for the specified array - * starting at the specified position in the array. - *

- * Arrays.listIterator(Object[] array, int index, int length) - */ - public static ListIterator listIterator(E[] array, int start, int length) { - return new ArrayListIterator(array, start, length); - } - - - // ********** move ********** - - /** - * Move an element from the specified source index to the specified target - * index. Return the altered list. - *

- * List.move(int targetIndex, int sourceIndex) - */ - public static List move(List list, int targetIndex, int sourceIndex) { - return (targetIndex == sourceIndex) ? list : move_(list, targetIndex, sourceIndex); - } - - /** - * assume targetIndex != sourceIndex - */ - private static List move_(List list, int targetIndex, int sourceIndex) { - if (list instanceof RandomAccess) { - // move elements, leaving the list in place - E temp = list.get(sourceIndex); - if (targetIndex < sourceIndex) { - for (int i = sourceIndex; i-- > targetIndex; ) { - list.set(i + 1, list.get(i)); - } - } else { - for (int i = sourceIndex; i < targetIndex; i++) { - list.set(i, list.get(i + 1)); - } - } - list.set(targetIndex, temp); - } else { - // remove the element and re-add it at the target index - list.add(targetIndex, list.remove(sourceIndex)); - } - return list; - } - - /** - * Move elements from the specified source index to the specified target - * index. Return the altered list. - *

- * List.move(int targetIndex, int sourceIndex, int length) - */ - public static List move(List list, int targetIndex, int sourceIndex, int length) { - if ((targetIndex == sourceIndex) || (length == 0)) { - return list; - } - if (length == 1) { - return move_(list, targetIndex, sourceIndex); - } - if (list instanceof RandomAccess) { - // move elements, leaving the list in place - ArrayList temp = new ArrayList(list.subList(sourceIndex, sourceIndex + length)); - if (targetIndex < sourceIndex) { - for (int i = sourceIndex; i-- > targetIndex; ) { - list.set(i + length, list.get(i)); - } - } else { - for (int i = sourceIndex; i < targetIndex; i++) { - list.set(i, list.get(i + length)); - } - } - for (int i = 0; i < length; i++) { - list.set(targetIndex + i, temp.get(i)); - } - } else { - // remove the elements and re-add them at the target index - list.addAll(targetIndex, removeElementsAtIndex(list, sourceIndex, length)); - } - return list; - } - - - // ********** remove all ********** - - /** - * Remove all the elements returned by the specified iterable - * from the specified collection. - * Return whether the collection changed as a result. - *

- * Collection.removeAll(Iterable iterable) - */ - public static boolean removeAll(Collection collection, Iterable iterable) { - return removeAll(collection, iterable.iterator()); - } - - /** - * Remove all the elements returned by the specified iterable - * from the specified collection. - * Return whether the collection changed as a result. - * The specified iterable size is a performance hint. - *

- * Collection.removeAll(Iterable iterable) - */ - public static boolean removeAll(Collection collection, Iterable iterable, int iterableSize) { - return removeAll(collection, iterable.iterator(), iterableSize); - } - - /** - * Remove all the elements returned by the specified iterator - * from the specified collection. - * Return whether the collection changed as a result. - *

- * Collection.removeAll(Iterator iterator) - */ - public static boolean removeAll(Collection collection, Iterator iterator) { - return iterator.hasNext() ? collection.removeAll(set(iterator)) : false; - } - - /** - * Remove all the elements returned by the specified iterator - * from the specified collection. - * Return whether the collection changed as a result. - * The specified iterator size is a performance hint. - *

- * Collection.removeAll(Iterator iterator) - */ - public static boolean removeAll(Collection collection, Iterator iterator, int iteratorSize) { - return iterator.hasNext() ? collection.removeAll(set(iterator, iteratorSize)) : false; - } - - /** - * Remove all the elements in the specified array - * from the specified collection. - * Return whether the collection changed as a result. - *

- * Collection.removeAll(Object[] array) - */ - public static boolean removeAll(Collection collection, Object... array) { - return (array.length == 0) ? false : collection.removeAll(set(array)); - } - - - // ********** remove all occurrences ********** - - /** - * Remove all occurrences of the specified element - * from the specified collection. - * Return whether the collection changed as a result. - *

- * Collection.removeAllOccurrences(Object value) - */ - public static boolean removeAllOccurrences(Collection collection, Object value) { - boolean modified = false; - Iterator stream = collection.iterator(); - if (value == null) { - while (stream.hasNext()) { - if (stream.next() == null) { - stream.remove(); - modified = true; - } - } - } else { - while (stream.hasNext()) { - if (value.equals(stream.next())) { - stream.remove(); - modified = true; - } - } - } - return modified; - } - - - // ********** remove elements at index ********** - - /** - * Remove the elements at the specified index. - * Return the removed elements. - *

- * List.remove(int index, int length) - */ - public static ArrayList removeElementsAtIndex(List list, int index, int length) { - List subList = list.subList(index, index + length); - ArrayList result = new ArrayList(subList); - subList.clear(); - return result; - } - - - // ********** remove duplicate elements ********** - - /** - * Remove any duplicate elements from the specified list, - * while maintaining the order. - * Return whether the list changed as a result. - */ - public static boolean removeDuplicateElements(List list) { - int size = list.size(); - if ((size == 0) || (size == 1)) { - return false; - } - return removeDuplicateElements(list, size); - } - - /** - * assume list is non-empty - */ - static boolean removeDuplicateElements(List list, int size) { - LinkedHashSet temp = new LinkedHashSet(size); // take advantage of hashed look-up - boolean modified = false; - for (E item : list) { - if ( ! temp.add(item)) { - modified = true; // duplicate item - } - } - if (modified) { - int i = 0; - for (E e : temp) { - list.set(i, e); - i++; - } - int tempSize = temp.size(); - for (i = list.size(); i-- > tempSize; ) { - list.remove(i); // pull off the end - } - } - return modified; - } - - - // ********** retain all ********** - - /** - * Retain only the elements in the specified iterable - * in the specified collection. - * Return whether the collection changed as a result. - *

- * Collection.retainAll(Iterable iterable) - */ - public static boolean retainAll(Collection collection, Iterable iterable) { - return retainAll(collection, iterable.iterator()); - } - - /** - * Retain only the elements in the specified iterable - * in the specified collection. - * Return whether the collection changed as a result. - * The specified iterable size is a performance hint. - *

- * Collection.retainAll(Iterable iterable) - */ - public static boolean retainAll(Collection collection, Iterable iterable, int iterableSize) { - return retainAll(collection, iterable.iterator(), iterableSize); - } - - /** - * Retain only the elements in the specified iterator - * in the specified collection. - * Return whether the collection changed as a result. - *

- * Collection.retainAll(Iterator iterator) - */ - public static boolean retainAll(Collection collection, Iterator iterator) { - if (iterator.hasNext()) { - return collection.retainAll(set(iterator)); - } - if (collection.isEmpty()) { - return false; - } - collection.clear(); - return true; - } - - /** - * Retain only the elements in the specified iterator - * in the specified collection. - * Return whether the collection changed as a result. - * The specified iterator size is a performance hint. - *

- * Collection.retainAll(Iterator iterator) - */ - public static boolean retainAll(Collection collection, Iterator iterator, int iteratorSize) { - if (iterator.hasNext()) { - return collection.retainAll(set(iterator, iteratorSize)); - } - if (collection.isEmpty()) { - return false; - } - collection.clear(); - return true; - } - - /** - * Retain only the elements in the specified array - * in the specified collection. - * Return whether the collection changed as a result. - *

- * Collection.retainAll(Object[] array) - */ - public static boolean retainAll(Collection collection, Object... array) { - if (array.length > 0) { - return collection.retainAll(set(array)); - } - if (collection.isEmpty()) { - return false; - } - collection.clear(); - return true; - } - - - // ********** reverse list ********** - - /** - * Return a list with entries in reverse order from those - * returned by the specified iterable. - *

- * Iterable.reverseList() - */ - public static ArrayList reverseList(Iterable iterable) { - return reverseList(iterable.iterator()); - } - - /** - * Return a list with entries in reverse order from those - * returned by the specified iterable. - * The specified iterable size is a performance hint. - *

- * Iterable.reverseList() - */ - public static ArrayList reverseList(Iterable iterable, int iterableSize) { - return reverseList(iterable.iterator(), iterableSize); - } - - /** - * Return a list with entries in reverse order from those - * returned by the specified iterator. - *

- * Iterator.reverseList() - */ - public static ArrayList reverseList(Iterator iterator) { - return (ArrayList) reverse(list(iterator)); - } - - /** - * Return a list with entries in reverse order from those - * returned by the specified iterator. - * The specified iterator size is a performance hint. - *

- * Iterator.reverseList() - */ - public static ArrayList reverseList(Iterator iterator, int size) { - return (ArrayList) reverse(list(iterator, size)); - } - - - // ********** rotate ********** - - /** - * Return the list after it has been "rotated" by one position. - *

- * List.rotate() - */ - public static List rotate(List list) { - return rotate(list, 1); - } - - - // ********** set ********** - - /** - * Return a set corresponding to the specified iterable. - *

- * HashSet(Iterable iterable) - */ - public static HashSet set(Iterable iterable) { - return set(iterable.iterator()); - } - - /** - * Return a set corresponding to the specified iterable. - * The specified iterable size is a performance hint. - *

- * HashSet(Iterable iterable) - */ - public static HashSet set(Iterable iterable, int iterableSize) { - return set(iterable.iterator(), iterableSize); - } - - /** - * Return a set corresponding to the specified iterator. - *

- * HashSet(Iterator iterator) - */ - public static HashSet set(Iterator iterator) { - return set(iterator, new HashSet()); - } - - /** - * Return a set corresponding to the specified iterator. - * The specified iterator size is a performance hint. - *

- * HashSet(Iterator iterator) - */ - public static HashSet set(Iterator iterator, int iteratorSize) { - return set(iterator, new HashSet(iteratorSize)); - } - - private static HashSet set(Iterator iterator, HashSet set) { - while (iterator.hasNext()) { - set.add(iterator.next()); - } - return set; - } - - /** - * Return a set corresponding to the specified array. - *

- * HashSet(Object[] array) - */ - public static HashSet set(E... array) { - HashSet set = new HashSet(array.length); - for (int i = array.length; i-- > 0;) { - set.add(array[i]); - } - return set; - } - - - // ********** singleton iterator ********** - - /** - * Return an iterator that returns only the single, - * specified object. - *

- * Object.toIterator() - */ - public static Iterator singletonIterator(E value) { - return new SingleElementIterator(value); - } - - /** - * Return a list iterator that returns only the single, - * specified object. - *

- * Object.toListIterator() - */ - public static ListIterator singletonListIterator(E value) { - return new SingleElementListIterator(value); - } - - - // ********** size ********** - - /** - * Return the number of elements returned by the specified iterable. - *

- * Iterable.size() - */ - public static int size(Iterable iterable) { - return size(iterable.iterator()); - } - - /** - * Return the number of elements returned by the specified iterator. - *

- * Iterator.size() - */ - public static int size(Iterator iterator) { - int size = 0; - while (iterator.hasNext()) { - iterator.next(); - size++; - } - return size; - } - - /** - * Return whether the specified iterable is empty - * (Shortcuts the iterator rather than calculating the entire size) - */ - public static boolean isEmpty(Iterable iterable) { - return isEmpty(iterable.iterator()); - } - - /** - * Return whether the specified iterator is empty - * (Shortcuts the iterator rather than calculating the entire size) - */ - public static boolean isEmpty(Iterator iterator) { - return ! iterator.hasNext(); - } - - - // ********** sort ********** - - /** - * Return an iterable containing the sorted elements of the specified iterable. - *

- * Iterable.sort() - */ - public static > Iterable sort(Iterable iterable) { - return sort(iterable, null); - } - - /** - * Return an iterable containing the sorted elements of the specified iterable. - * The specified iterable size is a performance hint. - *

- * Iterable.sort() - */ - public static > Iterable sort(Iterable iterable, int iterableSize) { - return sort(iterable, null, iterableSize); - } - - /** - * Return an iterable containing the sorted elements of the specified iterable. - *

- * Iterable.sort(Comparator comparator) - */ - public static Iterable sort(Iterable iterable, Comparator comparator) { - return sort(list(iterable), comparator); - } - - /** - * Return an iterable containing the sorted elements of the specified iterable. - * The specified iterable size is a performance hint. - *

- * Iterable.sort(Comparator comparator) - */ - public static Iterable sort(Iterable iterable, Comparator comparator, int iterableSize) { - return sort(list(iterable, iterableSize), comparator); - } - - /** - * Return the iterator after it has been "sorted". - *

- * Iterator.sort() - */ - public static > ListIterator sort(Iterator iterator) { - return sort(iterator, null); - } - - /** - * Return the iterator after it has been "sorted". - * The specified iterator size is a performance hint. - *

- * Iterator.sort() - */ - public static > ListIterator sort(Iterator iterator, int iteratorSize) { - return sort(iterator, null, iteratorSize); - } - - /** - * Return the iterator after it has been "sorted". - *

- * Iterator.sort(Comparator comparator) - */ - public static ListIterator sort(Iterator iterator, Comparator comparator) { - return sort(list(iterator), comparator).listIterator(); - } - - /** - * Return the iterator after it has been "sorted". - * The specified iterator size is a performance hint. - *

- * Iterator.sort(Comparator comparator) - */ - public static ListIterator sort(Iterator iterator, Comparator comparator, int iteratorSize) { - return sort(list(iterator, iteratorSize), comparator).listIterator(); - } - - - // ********** sorted set ********** - - /** - * Return a sorted set corresponding to the specified iterable. - *

- * TreeSet(Iterable iterable) - */ - public static > TreeSet sortedSet(Iterable iterable) { - return sortedSet(iterable.iterator()); - } - - /** - * Return a sorted set corresponding to the specified iterable. - * The specified iterable size is a performance hint. - *

- * TreeSet(Iterable iterable) - */ - public static > TreeSet sortedSet(Iterable iterable, int iterableSize) { - return sortedSet(iterable.iterator(), iterableSize); - } - - /** - * Return a sorted set corresponding to the specified iterable - * and comparator. - *

- * TreeSet(Iterable iterable, Comparator c) - */ - public static TreeSet sortedSet(Iterable iterable, Comparator comparator) { - return sortedSet(iterable.iterator(), comparator); - } - - /** - * Return a sorted set corresponding to the specified iterable - * and comparator. - * The specified iterable size is a performance hint. - *

- * TreeSet(Iterable iterable, Comparator c) - */ - public static TreeSet sortedSet(Iterable iterable, Comparator comparator, int iterableSize) { - return sortedSet(iterable.iterator(), comparator, iterableSize); - } - - /** - * Return a sorted set corresponding to the specified iterator. - *

- * TreeSet(Iterator iterator) - */ - public static > TreeSet sortedSet(Iterator iterator) { - return sortedSet(iterator, null); - } - - /** - * Return a sorted set corresponding to the specified iterator. - * The specified iterator size is a performance hint. - *

- * TreeSet(Iterator iterator) - */ - public static > TreeSet sortedSet(Iterator iterator, int iteratorSize) { - return sortedSet(iterator, null, iteratorSize); - } - - /** - * Return a sorted set corresponding to the specified iterator - * and comparator. - *

- * TreeSet(Iterator iterator, Comparator c) - */ - public static TreeSet sortedSet(Iterator iterator, Comparator comparator) { - return sortedSet(list(iterator), comparator); - } - - /** - * Return a sorted set corresponding to the specified iterator - * and comparator. - * The specified iterator size is a performance hint. - *

- * TreeSet(Iterator iterator, Comparator c) - */ - public static TreeSet sortedSet(Iterator iterator, Comparator comparator, int iteratorSize) { - return sortedSet(list(iterator, iteratorSize), comparator); - } - - private static TreeSet sortedSet(List list, Comparator comparator) { - TreeSet sortedSet = new TreeSet(comparator); - sortedSet.addAll(list); - return sortedSet; - } - - /** - * Return a sorted set corresponding to the specified array. - *

- * TreeSet(Object[] array) - */ - public static > TreeSet sortedSet(E... array) { - return sortedSet(array, null); - } - - /** - * Return a sorted set corresponding to the specified array - * and comparator. - *

- * TreeSet(Object[] array, Comparator c) - */ - public static TreeSet sortedSet(E[] array, Comparator comparator) { - TreeSet sortedSet = new TreeSet(comparator); - sortedSet.addAll(Arrays.asList(array)); - return sortedSet; - } - - - // ********** Old School Vector ********** - - /** - * Return a vector corresponding to the specified iterable. - * This is useful for legacy code that requires a {@link Vector}. - *

- * Vector(Iterable iterable) - */ - public static Vector vector(Iterable iterable) { - return vector(iterable.iterator()); - } - - /** - * Return a vector corresponding to the specified iterable. - * This is useful for legacy code that requires a {@link Vector}. - *

- * Vector(Iterable iterable, int size) - */ - public static Vector vector(Iterable iterable, int size) { - return vector(iterable.iterator(), size); - } - - /** - * Return a vector corresponding to the specified iterator. - * This is useful for legacy code that requires a {@link Vector}. - *

- * Vector(Iterator iterator) - */ - public static Vector vector(Iterator iterator) { - return vector(iterator, new Vector()); - } - - /** - * Return a vector corresponding to the specified iterator. - * This is useful for legacy code that requires a {@link Vector}. - *

- * Vector(Iterator iterator, int size) - */ - public static Vector vector(Iterator iterator, int size) { - return vector(iterator, new Vector(size)); - } - - private static Vector vector(Iterator iterator, Vector v) { - while (iterator.hasNext()) { - v.addElement(iterator.next()); - } - return v; - } - - /** - * Return a vector corresponding to the specified array. - * This is useful for legacy code that requires a {@link Vector}. - *

- * Vector(Object... array) - */ - public static Vector vector(E... array) { - Vector v = new Vector(array.length); - for (E item : array) { - v.addElement(item); - } - return v; - } - - - // ********** single-use Iterable ********** - - /** - * Return a one-use {@link Iterable} for the specified {@link Iterator}. - * Throw an {@link IllegalStateException} if {@link Iterable#iterator()} - * is called more than once. - * As such, this utility should only be used in one-use situations, such as - * a foreach loop. - */ - public static Iterable iterable(Iterator iterator) { - return new SingleUseIterable(iterator); - } - - /** - * This is a one-time use iterable that can return a single iterator. - * Once the iterator is returned the iterable is no longer valid. - * As such, this utility should only be used in one-time use situations, - * such as a 'for-each' loop. - */ - public static class SingleUseIterable implements Iterable { - private Iterator iterator; - - public SingleUseIterable(Iterator iterator) { - super(); - if (iterator == null) { - throw new NullPointerException(); - } - this.iterator = new SuperIteratorWrapper(iterator); - } - - public Iterator iterator() { - if (this.iterator == null) { - throw new IllegalStateException("This method has already been called."); //$NON-NLS-1$ - } - Iterator result = this.iterator; - this.iterator = null; - return result; - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterator); - } - - } - - - // ********** java.util.Collections enhancements ********** - - /** - * Return the destination list after the source list has been copied into it. - * @see Collections#copy(List, List) - */ - public static List copy(List dest, List src) { - Collections.copy(dest, src); - return dest; - } - - /** - * Return the list after it has been "filled". - * @see Collections#fill(List, Object) - */ - public static List fill(List list, E value) { - Collections.fill(list, value); - return list; - } - - /** - * Return the list after it has been "reversed". - * @see Collections#reverse(List) - */ - public static List reverse(List list) { - Collections.reverse(list); - return list; - } - - /** - * Return the list after it has been "rotated". - * @see Collections#rotate(List, int) - */ - public static List rotate(List list, int distance) { - Collections.rotate(list, distance); - return list; - } - - /** - * Return the list after it has been "shuffled". - * @see Collections#shuffle(List) - */ - public static List shuffle(List list) { - Collections.shuffle(list); - return list; - } - - /** - * Return the list after it has been "shuffled". - * @see Collections#shuffle(List, Random) - */ - public static List shuffle(List list, Random random) { - Collections.shuffle(list, random); - return list; - } - - /** - * Return the list after it has been "sorted". - * NB: The list is sorted in place as a side-effect. - * @see Collections#sort(List) - */ - public static > List sort(List list) { - Collections.sort(list); - return list; - } - - /** - * Return the list after it has been "sorted". - * NB: The list is sorted in place as a side-effect. - * @see Collections#sort(List, Comparator) - */ - public static List sort(List list, Comparator comparator) { - Collections.sort(list, comparator); - return list; - } - - /** - * Return the list after the specified elements have been "swapped". - * @see Collections#swap(List, int, int) - */ - public static List swap(List list, int i, int j) { - Collections.swap(list, i, j); - return list; - } - - - // ********** constructor ********** - - /** - * Suppress default constructor, ensuring non-instantiability. - */ - private CollectionTools() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CommandRunnable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CommandRunnable.java deleted file mode 100644 index 8f66ef255c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CommandRunnable.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import org.eclipse.jpt.common.utility.Command; - -/** - * Wrap a Command so it can be used as a Runnable. - */ -public class CommandRunnable implements Runnable { - protected final Command command; - - public CommandRunnable(Command command) { - super(); - if (command == null) { - throw new NullPointerException(); - } - this.command = command; - } - - public void run() { - this.command.execute(); - } - - @Override - public String toString() { - return "Runnable[" + this.command.toString() +']'; //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CompositeCommand.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CompositeCommand.java deleted file mode 100644 index fce6610235..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CompositeCommand.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; - -/** - * CompositeCommand provides support for treating a collection of - * {@link Command}s as a single command. - */ -public class CompositeCommand - implements Command -{ - private final Iterable commands; - - public CompositeCommand(Command... commands) { - this(new ArrayIterable(commands)); - } - - public CompositeCommand(Iterable commands) { - super(); - this.commands = commands; - } - - public void execute() { - for (Command command : this.commands) { - command.execute(); - } - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.commands); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CompositeException.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CompositeException.java deleted file mode 100644 index dcb51283cd..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/CompositeException.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.PrintStream; -import java.io.PrintWriter; -import java.util.Collection; - -/** - * Provide a way for multiple exceptions to be packaged and reported. - */ -public class CompositeException - extends RuntimeException -{ - private final Throwable[] exceptions; - private static final long serialVersionUID = 1L; - - - /** - * The specified exceptions list must not be empty. - */ - public CompositeException(Collection exceptions) { - this(exceptions.toArray(new Throwable[exceptions.size()])); - } - - /** - * The specified exceptions list must not be empty. - */ - public CompositeException(Throwable[] exceptions) { - // provide a list of the nested exceptions and - // grab the first exception and make it the "cause" - super(buildMessage(exceptions)); - this.exceptions = exceptions; - } - - public Throwable[] getExceptions() { - return this.exceptions; - } - - private static String buildMessage(Throwable[] exceptions) { - StringBuilder sb = new StringBuilder(); - sb.append(exceptions.length); - sb.append(" exceptions: "); //$NON-NLS-1$ - sb.append('['); - for (Throwable ex : exceptions) { - sb.append(ex.getClass().getSimpleName()); - sb.append(", "); //$NON-NLS-1$ - } - sb.setLength(sb.length() - 2); // chop off trailing comma - sb.append(']'); - return sb.toString(); - } - - @Override - public void printStackTrace(PrintStream s) { - synchronized (s) { - s.println(this); - for (StackTraceElement element : this.getStackTrace()) { - s.print("\tat "); //$NON-NLS-1$ - s.println(element); - } - int i = 1; - for (Throwable ex : this.exceptions) { - s.print("Nested exception "); //$NON-NLS-1$ - s.print(i++); - s.print(": "); //$NON-NLS-1$ - ex.printStackTrace(s); - } - } - } - - @Override - public void printStackTrace(PrintWriter s) { - synchronized (s) { - s.println(this); - for (StackTraceElement element : this.getStackTrace()) { - s.print("\tat "); //$NON-NLS-1$ - s.println(element); - } - int i = 1; - for (Throwable ex : this.exceptions) { - s.print("Nested exception "); //$NON-NLS-1$ - s.print(i++); - s.print(": "); //$NON-NLS-1$ - ex.printStackTrace(s); - } - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ConsumerThreadCoordinator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ConsumerThreadCoordinator.java deleted file mode 100644 index 8dc34e968d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ConsumerThreadCoordinator.java +++ /dev/null @@ -1,253 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.util.Vector; -import java.util.concurrent.ThreadFactory; - -/** - * A ConsumerThreadCoordinator controls the creation, - * starting, and stopping of a general purpose "consumer" thread. Construct - * the coordinator with a {@link Consumer} that both waits for the producer - * to "produce" something to "consume" and, once the wait is over, - * "consumes" whatever is available. - *

- * NB: The client-supplied consumer should handle any - * exception appropriately (e.g. log the exception and return gracefully) so - * the thread can continue executing. - */ -public class ConsumerThreadCoordinator { - /** - * The runnable passed to the consumer thread each time it is built. - */ - private final Runnable runnable; - - /** - * Client-supplied thread factory. Defaults to a straightforward - * implementation. - */ - private final ThreadFactory threadFactory; - - /** - * Optional, client-supplied name for the consumer thread. - * If null, the JDK assigns a name. - */ - private final String threadName; - - /** - * The consumer is executed on this thread. A new thread is built - * for every start/stop cycle (since a thread cannot be started more than - * once). - */ - private volatile Thread thread; - - /** - * A list of the uncaught exceptions thrown by the consumer - * during the current start/stop cycle. - */ - final Vector exceptions = new Vector(); - - - // ********** construction ********** - - /** - * Construct a consumer thread coordinator for the specified consumer. - * Use simple JDK thread(s) for the consumer thread(s). - * Allow the consumer thread(s) to be assigned JDK-generated names. - */ - public ConsumerThreadCoordinator(Consumer consumer) { - this(consumer, SimpleThreadFactory.instance()); - } - - /** - * Construct a consumer thread coordinator for the specified consumer. - * Use the specified thread factory to construct the consumer thread(s). - * Allow the consumer thread(s) to be assigned JDK-generated names. - */ - public ConsumerThreadCoordinator(Consumer consumer, ThreadFactory threadFactory) { - this(consumer, threadFactory, null); - } - - /** - * Construct a consumer thread coordinator for the specified consumer. - * Assign the consumer thread(s) the specified name. - * Use simple JDK thread(s) for the consumer thread(s). - */ - public ConsumerThreadCoordinator(Consumer consumer, String threadName) { - this(consumer, SimpleThreadFactory.instance(), threadName); - } - - /** - * Construct a consumer thread coordinator for the specified consumer. - * Use the specified thread factory to construct the consumer thread(s). - * Assign the consumer thread(s) the specified name. - */ - public ConsumerThreadCoordinator(Consumer consumer, ThreadFactory threadFactory, String threadName) { - super(); - this.runnable = this.buildRunnable(consumer); - this.threadFactory = threadFactory; - this.threadName = threadName; - } - - private Runnable buildRunnable(Consumer consumer) { - return new RunnableConsumer(consumer); - } - - - // ********** Lifecycle support ********** - - /** - * Build and start the consumer thread. - */ - public synchronized void start() { - if (this.thread != null) { - throw new IllegalStateException("Not stopped."); //$NON-NLS-1$ - } - this.thread = this.buildThread(); - this.thread.start(); - } - - private Thread buildThread() { - Thread t = this.threadFactory.newThread(this.runnable); - if (this.threadName != null) { - t.setName(this.threadName); - } - return t; - } - - /** - * Interrupt the consumer thread so that it stops executing at the - * end of its current iteration. Suspend the current thread until - * the consumer thread is finished executing. If any uncaught - * exceptions were thrown while the consumer thread was executing, - * wrap them in a composite exception and throw the composite exception. - */ - public synchronized void stop() { - if (this.thread == null) { - throw new IllegalStateException("Not started."); //$NON-NLS-1$ - } - this.thread.interrupt(); - try { - this.thread.join(); - } catch (InterruptedException ex) { - // the thread that called #stop() was interrupted while waiting to - // join the consumer thread - ignore; - // 'thread' is still "interrupted", so its #run() loop will still stop - // after its current execution - we just won't wait around for it... - } - this.thread = null; - - if (this.exceptions.size() > 0) { - Throwable[] temp = this.exceptions.toArray(new Throwable[this.exceptions.size()]); - this.exceptions.clear(); - throw new CompositeException(temp); - } - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.thread); - } - - - // ********** consumer thread runnable ********** - - /** - * This implementation of {@link Runnable} is a long-running consumer that - * will repeatedly execute the consumer {@link Consumer#execute()} method. - * With each iteration, the consumer thread will wait - * until the other consumer method, {@link Consumer#waitForProducer()}, allows the - * consumer thread to proceed (i.e. there is something for the consumer to - * consume). Once {@link Consumer#execute()} is finished, the thread will quiesce - * until {@link Consumer#waitForProducer()} returns again. - * Stop the thread by calling {@link Thread#interrupt()}. - */ - private class RunnableConsumer - implements Runnable - { - /** - * Client-supplied consumer that controls waiting for something to consume - * and the consuming itself. - */ - private final Consumer consumer; - - RunnableConsumer(Consumer consumer) { - super(); - this.consumer = consumer; - } - - /** - * Loop while this thread has not been interrupted by another thread. - * In each loop: Pause execution until {@link Consumer#waitForProducer()} - * allows us to proceed. - *

- * If this thread is interrupted during {@link Consumer#execute()}, - * the call to {@link Thread#interrupted()} will stop the loop. If this thread is - * interrupted during the call to {@link Consumer#waitForProducer()}, - * we will catch the {@link InterruptedException} and stop the loop also. - */ - public void run() { - while ( ! Thread.interrupted()) { - try { - this.consumer.waitForProducer(); - } catch (InterruptedException ex) { - // we were interrupted while waiting, must be Quittin' Time - return; - } - this.execute(); - } - } - - /** - * Execute the consumer {@link Consumer#execute()} method. - * Do not allow any unhandled exceptions to kill the thread. - * Store them up for later pain. - * @see ConsumerThreadCoordinator#stop() - */ - private void execute() { - try { - this.execute_(); - } catch (Throwable ex) { - ConsumerThreadCoordinator.this.exceptions.add(ex); - } - } - - /** - * Subclass-implemented behavior: consume stuff. - */ - private void execute_() { - this.consumer.execute(); - } - - } - - - // ********** consumer interface ********** - - /** - * Interface implemented by clients that controls:

    - *
  • when the consumer thread suspends, waiting for something to consume - *
  • the consuming of whatever is being produced - *
- */ - public interface Consumer { - /** - * Wait for something to consume. - * Throw an {@link InterruptedException} if the thread is interrupted. - */ - void waitForProducer() throws InterruptedException; - - /** - * Consume whatever is currently available. - */ - void execute(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ExceptionHandler.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ExceptionHandler.java deleted file mode 100644 index 9c32f555a9..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ExceptionHandler.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; - -/** - * Simple interface for allowing clients to pass an exception handler to a - * service (e.g. to log the exception). This is particularly helpful if the - * service executes on another, possibly inaccessible, thread. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ExceptionHandler { - - /** - * The specified exception was thrown. Handle it appropriately. - */ - void handleException(Throwable t); - - /** - * Singleton implementation of the exception handler interface that does - * nothing with the exception. - */ - final class Null implements ExceptionHandler, Serializable { - public static final ExceptionHandler INSTANCE = new Null(); - public static ExceptionHandler instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - public void handleException(Throwable t) { - // do nothing - } - @Override - public String toString() { - return "ExceptionHandler.Null"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - /** - * Singleton implementation of the exception handler interface that - * wraps the exception in a runtime exception and throws it. - */ - final class Runtime implements ExceptionHandler, Serializable { - public static final ExceptionHandler INSTANCE = new Runtime(); - public static ExceptionHandler instance() { - return INSTANCE; - } - // ensure single instance - private Runtime() { - super(); - } - public void handleException(Throwable t) { - // re-throw the exception unchecked - throw new RuntimeException(t); - } - @Override - public String toString() { - return "ExceptionHandler.Runtime"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/FileTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/FileTools.java deleted file mode 100644 index cfe93a64b7..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/FileTools.java +++ /dev/null @@ -1,1002 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.File; -import java.io.FileFilter; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.net.URI; -import java.net.URISyntaxException; -import java.net.URL; -import java.nio.channels.FileChannel; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; - -/** - * Assorted file tools: - * - delete entire trees of directories and files - * - build iterators on entire trees of directories and files - * - build a temporary directory - * - "canonize" files - */ -public final class FileTools { - - public static final String USER_HOME_DIRECTORY_NAME = System.getProperty("user.home"); //$NON-NLS-1$ - public static final String USER_TEMPORARY_DIRECTORY_NAME = System.getProperty("java.io.tmpdir"); //$NON-NLS-1$ - public static String DEFAULT_TEMPORARY_DIRECTORY_NAME = "tmpdir"; //$NON-NLS-1$ - public static final String CURRENT_WORKING_DIRECTORY_NAME = System.getProperty("user.dir"); //$NON-NLS-1$ - - /** A list of some invalid file name characters. - : is the filename separator in MacOS and the drive indicator in DOS - * is a DOS wildcard character - | is a DOS redirection character - & is our own escape character - / is the filename separator in Unix and the command option tag in DOS - \ is the filename separator in DOS/Windows and the escape character in Unix - ; is ??? - ? is a DOS wildcard character - [ is ??? - ] is ??? - = is ??? - + is ??? - < is a DOS redirection character - > is a DOS redirection character - " is used by DOS to delimit file names with spaces - , is ??? - */ - public static final char[] INVALID_FILENAME_CHARACTERS = { ':', '*', '|', '&', '/', '\\', ';', '?', '[', ']', '=', '+', '<', '>', '"', ',' }; - - /** This encoder will convert strings into valid file names. */ - public static final XMLStringEncoder FILE_NAME_ENCODER = new XMLStringEncoder(INVALID_FILENAME_CHARACTERS); - - /** Windows files that are redirected to devices etc. */ - @SuppressWarnings("nls") - private static final String[] WINDOWS_RESERVED_FILE_NAMES = { - "con", - "aux", - "com1", "com2", "com3", "com4", "com5", "com6", "com7", "com8", "com9", - "lpt1", "lpt2", "lpt3", "lpt4", "lpt5", "lpt6", "lpt7", "lpt8", "lpt9", - "prn", - "nul" - }; - - /** The default length of a shortened file name. */ - public static final int MAXIMUM_SHORTENED_FILE_NAME_LENGTH = 60; - - - // ********** deleting directories ********** - - /** - * Delete the specified directory and all of its contents. - * USE WITH CARE. - * File#deleteAll()? - */ - public static void deleteDirectory(String directoryName) { - deleteDirectory(new File(directoryName)); - } - - /** - * Delete the specified directory and all of its contents. - * USE WITH CARE. - * File#deleteAll()? - */ - public static void deleteDirectory(File directory) { - deleteDirectoryContents(directory); - if ( ! directory.delete()) { - throw new RuntimeException("unable to delete directory: " + directory.getAbsolutePath()); //$NON-NLS-1$ - } - } - - /** - * Delete the contents of the specified directory - * (but not the directory itself). - * USE WITH CARE. - * File#deleteFiles() - */ - public static void deleteDirectoryContents(String directoryName) { - deleteDirectoryContents(new File(directoryName)); - } - - /** - * Delete the contents of the specified directory - * (but not the directory itself). - * USE WITH CARE. - * File#deleteFiles() - */ - public static void deleteDirectoryContents(File directory) { - for (File file : directory.listFiles()) { - if (file.isDirectory()) { - deleteDirectory(file); // recurse through subdirectories - } else { - if ( ! file.delete()) { - throw new RuntimeException("unable to delete file: " + file.getAbsolutePath()); //$NON-NLS-1$ - } - } - } - } - - - // ********** copying files ********** - - /** - * Copies the content of the source file to the destination file. - * File#copy(File destinationFile) - */ - public static void copyToFile(File sourceFile, File destinationFile) - throws IOException - { - FileChannel sourceChannel = new FileInputStream(sourceFile).getChannel(); - FileChannel destinationChannel = new FileOutputStream(destinationFile).getChannel(); - try { - destinationChannel.transferFrom(sourceChannel, 0, sourceChannel.size()); - } finally { - sourceChannel.close(); - destinationChannel.close(); - } - } - - /** - * Copies the content of the source file to a file by - * the same name in the destination directory. - * File#copyToDirectory(File destinationDirectory) - */ - public static void copyToDirectory(File sourceFile, File destinationDirectory) - throws IOException - { - File destinationFile = new File(destinationDirectory, sourceFile.getName()); - if ( ! destinationFile.exists() && ! destinationFile.createNewFile()) { - throw new RuntimeException("createNewFile() failed: " + destinationFile); //$NON-NLS-1$ - } - copyToFile(sourceFile, destinationFile); - } - - - // ********** iteratoring over files and directories ********** - - /** - * Return an iterator on all the files in the specified directory. - * The iterator will skip over subdirectories. - * File#files() - */ - public static Iterator filesIn(String directoryName) { - return filesIn(new File(directoryName)); - } - - /** - * Return an iterator on all the files in the specified directory. - * The iterator will skip over subdirectories. - * File#files() - */ - public static Iterator filesIn(File directory) { - return filesIn(directory.listFiles()); - } - - private static Iterator filesIn(File[] files) { - return new FilteringIterator(new ArrayIterator(files)) { - @Override - protected boolean accept(File next) { - return next.isFile(); - } - }; - } - - /** - * Return an iterator on all the subdirectories - * in the specified directory. - * File#subDirectories() - */ - public static Iterator directoriesIn(String directoryName) { - return directoriesIn(new File(directoryName)); - } - - /** - * Return an iterator on all the subdirectories - * in the specified directory. - * File#subDirectories() - */ - public static Iterator directoriesIn(File directory) { - return directoriesIn(directory.listFiles()); - } - - private static Iterator directoriesIn(File[] files) { - return new FilteringIterator(new ArrayIterator(files)) { - @Override - protected boolean accept(File next) { - return next.isDirectory(); - } - }; - } - - /** - * Return an iterator on all the files under the specified - * directory, recursing into subdirectories. - * The iterator will skip over the subdirectories themselves. - * File#filesRecurse() - */ - public static Iterator filesInTree(String directoryName) { - return filesInTree(new File(directoryName)); - } - - /** - * Return an iterator on all the files under the specified - * directory, recursing into subdirectories. - * The iterator will skip over the subdirectories themselves. - * File#filesRecurse() - */ - public static Iterator filesInTree(File directory) { - return filesInTreeAsSet(directory).iterator(); - } - - private static Set filesInTreeAsSet(File directory) { - Set files = new HashSet(10000); - addFilesInTreeTo(directory, files); - return files; - } - - private static void addFilesInTreeTo(File directory, Collection allFiles) { - for (File file : directory.listFiles()) { - if (file.isFile()) { - allFiles.add(file); - } else if (file.isDirectory()) { - addFilesInTreeTo(file, allFiles); - } - } - } - - /** - * Return an iterator on all the directories under the specified - * directory, recursing into subdirectories. - * File#subDirectoriesRecurse() - */ - public static Iterator directoriesInTree(String directoryName) { - return directoriesInTree(new File(directoryName)); - } - - /** - * Return an iterator on all the directories under the specified - * directory, recursing into subdirectories. - * File#subDirectoriesRecurse() - */ - @SuppressWarnings("unchecked") - public static Iterator directoriesInTree(File directory) { - File[] files = directory.listFiles(); - return new CompositeIterator(directoriesIn(files), directoriesInTrees(directoriesIn(files))); - } - - private static Iterator directoriesInTrees(Iterator directories) { - return new CompositeIterator( - new TransformationIterator>(directories) { - @Override - protected Iterator transform(File next) { - return FileTools.directoriesInTree(next); - } - } - ); - } - - - // ********** short file name manipulation ********** - - /** - * Strip the extension from the specified file name - * and return the result. If the file name has no - * extension, it is returned unchanged - * File#basePath() - */ - public static String stripExtension(String fileName) { - int index = fileName.lastIndexOf('.'); - if (index == -1) { - return fileName; - } - return fileName.substring(0, index); - } - - /** - * Strip the extension from the specified file's name - * and return the result. If the file's name has no - * extension, it is returned unchanged - * File#basePath() - */ - public static String stripExtension(File file) { - return stripExtension(file.getPath()); - } - - /** - * Return the extension, including the dot, of the specified file name. - * If the file name has no extension, return an empty string. - * File#extension() - */ - public static String extension(String fileName) { - int index = fileName.lastIndexOf('.'); - if (index == -1) { - return ""; //$NON-NLS-1$ - } - return fileName.substring(index); - } - - /** - * Return the extension, including the dot, of the specified file's name. - * If the file's name has no extension, return an empty string. - * File#extension() - */ - public static String extension(File file) { - return extension(file.getPath()); - } - - - // ********** temporary directories ********** - - /** - * Build and return an empty temporary directory with the specified - * name. If the directory already exists, it will be cleared out. - * This directory will be a subdirectory of the Java temporary directory, - * as indicated by the System property "java.io.tmpdir". - */ - public static File emptyTemporaryDirectory(String name) { - File dir = new File(userTemporaryDirectory(), name); - if (dir.exists()) { - deleteDirectoryContents(dir); - } else { - mkdirs(dir); - } - return dir; - } - - private static void mkdirs(File dir) { - if ( ! dir.mkdirs()) { - throw new RuntimeException("mkdirs() failed: " + dir); //$NON-NLS-1$ - } - } - - /** - * Build and return an empty temporary directory with a - * name of "tmpdir". If the directory already exists, it will be cleared out. - * This directory will be a subdirectory of the Java temporary directory, - * as indicated by the System property "java.io.tmpdir". - */ - public static File emptyTemporaryDirectory() { - return emptyTemporaryDirectory(DEFAULT_TEMPORARY_DIRECTORY_NAME); - } - - /** - * Build and return a temporary directory with the specified - * name. If the directory already exists, it will be left unchanged; - * if it does not already exist, it will be created. - * This directory will be a subdirectory of the Java temporary directory, - * as indicated by the System property "java.io.tmpdir". - */ - public static File temporaryDirectory(String name) { - File dir = new File(userTemporaryDirectory(), name); - if ( ! dir.exists()) { - mkdirs(dir); - } - return dir; - } - - /** - * Build and return a temporary directory with a name of - * "tmpdir". If the directory already exists, it will be left unchanged; - * if it does not already exist, it will be created. - * This directory will be a subdirectory of the Java temporary directory, - * as indicated by the System property "java.io.tmpdir". - */ - public static File temporaryDirectory() { - return temporaryDirectory(DEFAULT_TEMPORARY_DIRECTORY_NAME); - } - - /** - * Build and return a *new* temporary directory with the specified - * prefix. The prefix will be appended with a number that - * is incremented, starting with 1, until a non-pre-existing directory - * is found and successfully created. This directory will be a - * subdirectory of the Java temporary directory, as indicated by - * the System property "java.io.tmpdir". - */ - public static File newTemporaryDirectory(String prefix) { - if ( ! prefix.endsWith(".")) { //$NON-NLS-1$ - prefix = prefix + '.'; - } - File dir; - int i = 0; - do { - i++; - dir = new File(userTemporaryDirectory(), prefix + i); - } while ( ! dir.mkdirs()); - return dir; - } - - /** - * Build and return a *new* temporary directory with a - * prefix of "tmpdir". This prefix will be appended with a number that - * is incremented, starting with 1, until a non-pre-existing directory - * is found and successfully created. This directory will be a - * subdirectory of the Java temporary directory, as indicated by - * the System property "java.io.tmpdir". - */ - public static File newTemporaryDirectory() { - return newTemporaryDirectory(DEFAULT_TEMPORARY_DIRECTORY_NAME); - } - - - // ********** resource files ********** - - /** - * Build and return a file for the specified resource. - * The resource name must be fully-qualified, i.e. it cannot be relative - * to the package name/directory. - * NB: There is a bug in jdk1.4.x the prevents us from getting - * a resource that has spaces (or other special characters) in - * its name.... (see Sun's Java bug 4466485) - */ - public static File resourceFile(String resourceName) throws URISyntaxException { - if ( ! resourceName.startsWith("/")) { //$NON-NLS-1$ - throw new IllegalArgumentException(resourceName); - } - return resourceFile(resourceName, FileTools.class); - } - - /** - * Build and return a file for the specified resource. - * NB: There is a bug in jdk1.4.x the prevents us from getting - * a resource that has spaces (or other special characters) in - * its name.... (see Sun's Java bug 4466485) - */ - public static File resourceFile(String resourceName, Class javaClass) throws URISyntaxException { - URL url = javaClass.getResource(resourceName); - return buildFile(url); - } - - /** - * Build and return a file for the specified URL. - * NB: There is a bug in jdk1.4.x the prevents us from getting - * a resource that has spaces (or other special characters) in - * its name.... (see Sun's Java bug 4466485) - */ - public static File buildFile(URL url) throws URISyntaxException { - return buildFile(url.getFile()); - } - - /** - * Build and return a file for the specified file name. - * NB: There is a bug in jdk1.4.x the prevents us from getting - * a resource that has spaces (or other special characters) in - * its name.... (see Sun's Java bug 4466485) - */ - public static File buildFile(String fileName) throws URISyntaxException { - URI uri = new URI(fileName); - File file = new File(uri.getPath()); - return file; - } - - - // ********** "canonical" files ********** - - /** - * Convert the specified file into a "canonical" file. - */ - public static File canonicalFile(File file) { - try { - return file.getCanonicalFile(); - } catch (IOException ioexception) { - // settle for the absolute file - return file.getAbsoluteFile(); - } - } - - /** - * Build an iterator that will convert the specified files - * into "canonical" files. - */ - public static Iterator canonicalFiles(Iterator files) { - return new TransformationIterator(files) { - @Override - protected File transform(File next) { - return canonicalFile(next); - } - }; - } - - /** - * Build an iterator that will convert the specified files - * into "canonical" files. - */ - public static Iterator canonicalFiles(Collection files) { - return canonicalFiles(files.iterator()); - } - - /** - * Convert the specified file name into a "canonical" file name. - */ - public static String canonicalFileName(String fileName) { - return canonicalFile(new File(fileName)).getAbsolutePath(); - } - - /** - * Build an iterator that will convert the specified file names - * into "canonical" file names. - */ - public static Iterator canonicalFileNames(Iterator fileNames) { - return new TransformationIterator(fileNames) { - @Override - protected String transform(String next) { - return canonicalFileName(next); - } - }; - } - - /** - * Build an iterator that will convert the specified file names - * into "canonical" file names. - */ - public static Iterator canonicalFileNames(Collection fileNames) { - return canonicalFileNames(fileNames.iterator()); - } - - - // ********** file name validation ********** - - /** - * Return whether the specified file name is invalid. - */ - public static boolean fileNameIsInvalid(String filename) { - return ! fileNameIsValid(filename); - } - - /** - * Return whether the specified file name is valid. - */ - public static boolean fileNameIsValid(String filename) { - int len = filename.length(); - for (int i = 0; i < len; i++) { - char filenameChar = filename.charAt(i); - if (ArrayTools.contains(INVALID_FILENAME_CHARACTERS, filenameChar)) { - return false; - } - } - return true; - } - - /** - * Convert the illegal characters in the specified file name to - * the specified character and return the result. - */ - public static String convertToValidFileName(String filename, char replacementChar) { - int len = filename.length(); - StringBuilder sb = new StringBuilder(len); - for (int i = 0; i < len; i++) { - char filenameChar = filename.charAt(i); - if (ArrayTools.contains(INVALID_FILENAME_CHARACTERS, filenameChar)) { - sb.append(replacementChar); - } else { - sb.append(filenameChar); - } - } - return sb.toString(); - } - - /** - * Convert the illegal characters in the specified file name to - * periods ('.') and return the result. - */ - public static String convertToValidFileName(String filename) { - return convertToValidFileName(filename, '.'); - } - - /** - * Return whether the specified file name is "reserved" - * (i.e. it cannot be used for "user" files). Windows reserves - * a number of file names (e.g. CON, AUX, PRN). - */ - public static boolean fileNameIsReserved(String fileName) { - // Unix/Linux does not have any "reserved" file names (I think...) - return Tools.osIsWindows() && ArrayTools.contains(WINDOWS_RESERVED_FILE_NAMES, fileName.toLowerCase()); - } - - /** - * Return whether the specified file contains any "reserved" - * components. - * Windows reserves a number of file names (e.g. CON, AUX, PRN); - * and these file names cannot be used for either the names of - * files or directories. - */ - public static boolean fileHasAnyReservedComponents(File file) { - File temp = file; - while (temp != null) { - if (fileNameIsReserved(temp.getName())) { - return true; - } - temp = temp.getParentFile(); - } - return false; - } - - - // ********** shortened file names ********** - - /** - * Return a shorter version of the absolute file name for the specified file. - * The shorter version will not be longer than the maximum length. - * The first directory (usually the drive letter) and the file name or the - * last directory will always be added to the generated string regardless of - * the maximum length allowed. - */ - public static String shortenFileName(URL url) { - return shortenFileName(url, MAXIMUM_SHORTENED_FILE_NAME_LENGTH); - } - - /** - * Return a shorter version of the absolute file name for the specified file. - * The shorter version will not be longer than the maximum length. - * The first directory (usually the drive letter) and the file name or the - * last directory will always be added to the generated string regardless of - * the maximum length allowed. - */ - public static String shortenFileName(URL url, int maxLength) { - File file; - try { - file = buildFile(url); - } catch (URISyntaxException e) { - file = new File(url.getFile()); - } - return shortenFileName(file, maxLength); - } - - /** - * Return a shorter version of the absolute file name for the specified file. - * The shorter version will not be longer than the maximum length. - * The first directory (usually the drive letter) and the file name or the - * last directory will always be added to the generated string regardless of - * the maximum length allowed. - */ - public static String shortenFileName(File file) { - return shortenFileName(file, MAXIMUM_SHORTENED_FILE_NAME_LENGTH); - } - - /** - * Return a shorter version of the absolute file name for the specified file. - * The shorter version will not be longer than the maximum length. - * The first directory (usually the drive letter) and the file name or the - * last directory will always be added to the generated string regardless of - * the maximum length allowed. - */ - public static String shortenFileName(File file, int maxLength) { - String absoluteFileName = canonicalFile(file).getAbsolutePath(); - if (absoluteFileName.length() <= maxLength) { - // no need to shorten - return absoluteFileName; - } - - // break down the path into its components - String fs = File.separator; - String[] paths = absoluteFileName.split('\\' + fs); - - if (paths.length <= 1) { - // e.g. "C:\" - return paths[0]; - } - - if (paths.length == 2) { - // e.g. "C:\MyReallyLongFileName.ext" or "C:\MyReallyLongDirectoryName" - // return the complete file name since this is a minimum requirement, - // regardless of the maximum length allowed - return absoluteFileName; - } - - StringBuilder sb = new StringBuilder(); - sb.append(paths[0]); // always add the first directory, which is usually the drive letter - - // Keep the index of insertion into the string buffer - int insertIndex = sb.length(); - - sb.append(fs); - sb.append(paths[paths.length - 1]); // append the file name or the last directory - - maxLength -= 4; // -4 for "/..." - - int currentLength = sb.length() - 4; // -4 for "/..." - int leftIndex = 1; // 1 to skip the root directory - int rightIndex = paths.length - 2; // -1 for the file name or the last directory - - boolean canAddFromLeft = true; - boolean canAddFromRight = true; - - // Add each directory, the insertion is going in both direction: left and - // right, once a side can't be added, the other side is still continuing - // until both can't add anymore - while (true) { - if (!canAddFromLeft && !canAddFromRight) - break; - - if (canAddFromRight) { - String rightDirectory = paths[rightIndex]; - int rightLength = rightDirectory.length(); - - // Add the directory on the right side of the loop - if (currentLength + rightLength + 1 <= maxLength) { - sb.insert(insertIndex, fs); - sb.insert(insertIndex + 1, rightDirectory); - - currentLength += rightLength + 1; - rightIndex--; - - // The right side is now overlapping the left side, that means - // we can't add from the right side anymore - if (leftIndex >= rightIndex) { - canAddFromRight = false; - } - } else { - canAddFromRight = false; - } - } - - if (canAddFromLeft) { - String leftDirectory = paths[leftIndex]; - int leftLength = leftDirectory.length(); - - // Add the directory on the left side of the loop - if (currentLength + leftLength + 1 <= maxLength) { - sb.insert(insertIndex, fs); - sb.insert(insertIndex + 1, leftDirectory); - - insertIndex += leftLength + 1; - currentLength += leftLength + 1; - leftIndex++; - - // The left side is now overlapping the right side, that means - // we can't add from the left side anymore - if (leftIndex >= rightIndex) { - canAddFromLeft = false; - } - } else { - canAddFromLeft = false; - } - } - } - - if (leftIndex <= rightIndex) { - sb.insert(insertIndex, fs); - sb.insert(insertIndex + 1, "..."); //$NON-NLS-1$ - } - - return sb.toString(); - } - - - // ********** system properties ********** - - /** - * Return a file representing the user's home directory. - */ - public static File userHomeDirectory() { - return new File(USER_HOME_DIRECTORY_NAME); - } - - /** - * Return a file representing the user's temporary directory. - */ - public static File userTemporaryDirectory() { - return new File(USER_TEMPORARY_DIRECTORY_NAME); - } - - /** - * Return a file representing the current working directory. - */ - public static File currentWorkingDirectory() { - return new File(CURRENT_WORKING_DIRECTORY_NAME); - } - - - // ********** miscellaneous ********** - - /** - * Return only the files that fit the filter. - * File#files(FileFilter fileFilter) - */ - public static Iterator filter(Iterator files, final FileFilter fileFilter) { - return new FilteringIterator(files) { - @Override - protected boolean accept(File next) { - return fileFilter.accept(next); - } - }; - } - - /** - * Return a file that is a re-specification of the specified - * file, relative to the specified directory. - * Linux/Unix/Mac: - * convertToRelativeFile(/foo/bar/baz.java, /foo) - * => bar/baz.java - * Windows: - * convertToRelativeFile(C:\foo\bar\baz.java, C:\foo) - * => bar/baz.java - * The file can be either a file or a directory; the directory - * *should* be a directory. - * If the file is already relative or it cannot be made relative - * to the directory, it will be returned unchanged. - * - * NB: This method has been tested on Windows and Linux, - * but not Mac (but the Mac is Unix-based these days, so - * it shouldn't be a problem...). - */ - public static File convertToRelativeFile(final File file, final File dir) { - // check whether the file is already relative - if ( ! file.isAbsolute()) { - return file; // return unchanged - } - - File cFile = canonicalFile(file); - File cDir = canonicalFile(dir); - - // the two are the same directory - if (cFile.equals(cDir)) { - return new File("."); //$NON-NLS-1$ - } - - File[] filePathFiles = pathFiles(cFile); - File[] dirPathFiles = pathFiles(cDir); - - // Windows only (?): the roots are different - e.g. D:\ vs. C:\ - if ( ! dirPathFiles[0].equals(filePathFiles[0])) { - return file; // return unchanged - } - - // at this point we know the root is the same, now find how much is in common - int i = 0; // this will point at the first miscompare - while ((i < dirPathFiles.length) && (i < filePathFiles.length)) { - if (dirPathFiles[i].equals(filePathFiles[i])) { - i++; - } else { - break; - } - } - // save our current position - int firstMismatch = i; - - // check whether the file is ABOVE the directory: ../.. - if (firstMismatch == filePathFiles.length) { - return relativeParentFile(dirPathFiles.length - firstMismatch); - } - - // build a new file from the path beyond the matching portions - File diff = new File(filePathFiles[i].getName()); - while (++i < filePathFiles.length) { - diff = new File(diff, filePathFiles[i].getName()); - } - - // check whether the file is BELOW the directory: subdir1/subdir2/file.ext - if (firstMismatch == dirPathFiles.length) { - return diff; - } - - // the file must be a PEER of the directory: ../../subdir1/subdir2/file.ext - return new File(relativeParentFile(dirPathFiles.length - firstMismatch), diff.getPath()); - } - - /** - * Return a file that is a re-specification of the specified - * file, relative to the current working directory. - * Linux/Unix/Mac (CWD = /foo): - * convertToRelativeFile(/foo/bar/baz.java) - * => bar/baz.java - * Windows (CWD = C:\foo): - * convertToRelativeFile(C:\foo\bar\baz.java) - * => bar/baz.java - * The file can be either a file or a directory. - * If the file is already relative or it cannot be made relative - * to the directory, it will be returned unchanged. - * - * NB: This method has been tested on Windows and Linux, - * but not Mac (but the Mac is Unix-based these days, so - * it shouldn't be a problem...). - */ - public static File convertToRelativeFile(final File file) { - return convertToRelativeFile(file, currentWorkingDirectory()); - } - - /** - * Return an array of files representing the path to the specified - * file. For example: - * C:/foo/bar/baz.txt => - * { C:/, C:/foo, C:/foo/bar, C:/foo/bar/baz.txt } - */ - private static File[] pathFiles(File file) { - List path = new ArrayList(); - for (File f = file; f != null; f = f.getParentFile()) { - path.add(f); - } - Collections.reverse(path); - return path.toArray(new File[path.size()]); - } - - /** - * Return a file with the specified (non-zero) number of relative - * file names, e.g. xxx(3) => ../../.. - */ - private static File relativeParentFile(int len) { - if (len <= 0) { - throw new IllegalArgumentException("length must be greater than zero: " + len); //$NON-NLS-1$ - } - File result = new File(".."); //$NON-NLS-1$ - for (int i = len - 1; i-- > 0; ) { - result = new File(result, ".."); //$NON-NLS-1$ - } - return result; - } - - /** - * Return a file that is a re-specification of the specified - * file, absolute to the specified directory. - * Linux/Unix/Mac: - * convertToAbsoluteFile(bar/baz.java, /foo) - * => /foo/bar/baz.java - * Windows: - * convertToAbsoluteFile(bar/baz.java, C:\foo) - * => C:\foo\bar\baz.java - * The file can be either a file or a directory; the directory - * *should* be a directory. - * If the file is already absolute, it will be returned unchanged. - * - * NB: This method has been tested on Windows and Linux, - * but not Mac (but the Mac is Unix-based these days, so - * it shouldn't be a problem...). - */ - public static File convertToAbsoluteFile(final File file, final File dir) { - // check whether the file is already absolute - if (file.isAbsolute()) { - return file; // return unchanged - } - return canonicalFile(new File(dir, file.getPath())); - } - - /** - * Return a file that is a re-specification of the specified - * file, absolute to the current working directory. - * Linux/Unix/Mac (CWD = /foo): - * convertToAbsoluteFile(bar/baz.java) - * => /foo/bar/baz.java - * Windows (CWD = C:\foo): - * convertToAbsoluteFile(bar/baz.java) - * => C:\foo\bar\baz.java - * The file can be either a file or a directory. - * If the file is already absolute, it will be returned unchanged. - * - * NB: This method has been tested on Windows and Linux, - * but not Mac (but the Mac is Unix-based these days, so - * it shouldn't be a problem...). - */ - public static File convertToAbsoluteFile(final File file) { - return convertToAbsoluteFile(file, currentWorkingDirectory()); - } - - - // ********** constructor ********** - - /** - * Suppress default constructor, ensuring non-instantiability. - */ - private FileTools() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/FlaggedObjectReference.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/FlaggedObjectReference.java deleted file mode 100644 index 84d06c6552..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/FlaggedObjectReference.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -/** - * Provide a container for passing an object that can be changed by the - * recipient. If the value is set at any time after construction of the - * reference, the reference is marked "set". This allows the client to - * detect whether the server/recipient ever set the value, even if it remains - * unchanged. This is particularly useful when the value can be set to - * null. - *

- * The reference can be set multiple times, but it can - * never be "unset" once it is "set". - */ -public class FlaggedObjectReference - extends SimpleObjectReference -{ - private volatile boolean set = false; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Create an object reference with the specified initial value. - */ - public FlaggedObjectReference(V value) { - super(value); - } - - /** - * Create an object reference with an initial value of - * null. - */ - public FlaggedObjectReference() { - super(); - } - - - // ********** set ********** - - public boolean isSet() { - return this.set; - } - - - // ********** overrides ********** - - @Override - public V setValue(V value) { - this.set = true; - return super.setValue(value); - } - - @Override - public String toString() { - String s = super.toString(); - return (this.set) ? '*' + s : s; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/HashBag.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/HashBag.java deleted file mode 100644 index d394bbb286..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/HashBag.java +++ /dev/null @@ -1,877 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import java.util.AbstractCollection; -import java.util.Collection; -import java.util.ConcurrentModificationException; -import java.util.Iterator; -import java.util.NoSuchElementException; - -/** - * This class implements the {@link Bag} interface, backed by a - * hash table. It makes no guarantees as to the iteration order of - * the bag's elements; in particular, it does not guarantee the order - * will remain constant over time. This class permits the null - * element. - *

- * This class offers constant time performance for the basic operations - * (add, remove, contains and - * size), assuming the hash function disperses the elements - * properly among the buckets. Iterating over this bag requires time - * proportional to the sum of the bag's size (the number of elements) plus the - * "capacity" of the backing hash table (the number of buckets). Thus, it is - * important not to set the initial capacity too high (or the load factor too - * low) if iteration performance is important. - *

- * Note that this implementation is not synchronized. If multiple - * threads access a bag concurrently, and at least one of the threads modifies - * the bag, it must be synchronized externally. This is typically - * accomplished by synchronizing on some object that naturally encapsulates - * the bag. If no such object exists, the bag should be "wrapped" using the - * Collections.synchronizedCollection method. This is - * best done at creation time, to prevent accidental unsynchronized access - * to the bag: - *

- * Collection c = Collections.synchronizedCollection(new HashBag(...));
- * 
- *

- * The iterators returned by this class's iterator method are - * fail-fast: if the bag is modified at any time after the iterator is - * created, in any way except through the iterator's own remove - * method, the iterator throws a {@link ConcurrentModificationException}. - * Thus, in the face of concurrent modification, the iterator fails quickly - * and cleanly, rather than risking arbitrary, non-deterministic behavior at - * an undetermined time in the future. - *

- * Note that the fail-fast behavior of an iterator cannot be guaranteed - * as it is, generally speaking, impossible to make any hard guarantees in the - * presence of unsynchronized concurrent modification. Fail-fast iterators - * throw ConcurrentModificationException on a best-effort basis. - * Therefore, it would be wrong to write a program that depended on this - * exception for its correctness: the fail-fast behavior of iterators - * should be used only to detect bugs. - * - * @param the type of elements maintained by the bag - * - * @see Collection - * @see Bag - * @see SynchronizedBag - * @see Collections#synchronizedCollection(Collection) - * @see IdentityHashBag - */ -public class HashBag - extends AbstractCollection - implements Bag, Cloneable, Serializable -{ - /** The hash table. Resized as necessary. Length MUST Always be a power of two. */ - transient Entry[] table; - - /** The total number of entries in the bag. */ - transient int size = 0; - - /** The number of UNIQUE entries in the bag. */ - transient int uniqueCount = 0; - - /** - * The hash table is rehashed when its size exceeds this threshold. (The - * value of this field is (int) (capacity * loadFactor).) - * - * @serial - */ - private int threshold; - - /** - * The load factor for the hash table. - * - * @serial - */ - private final float loadFactor; - - /** - * The number of times this bag has been structurally modified. - * Structural modifications are those that change the number of entries in - * the bag or otherwise modify its internal structure (e.g. rehash). - * This field is used to make iterators on this bag fail-fast. - * - * @see java.util.ConcurrentModificationException - */ - transient int modCount = 0; - - /** - * The default initial capacity - MUST be a power of two. - */ - private static final int DEFAULT_INITIAL_CAPACITY = 16; - - /** - * The maximum capacity, used if a higher value is implicitly specified - * by either of the constructors with arguments. - * MUST be a power of two <= (1 << 30). - */ - private static final int MAXIMUM_CAPACITY = 1 << 30; - - /** - * The load factor used when none specified in constructor. - */ - private static final float DEFAULT_LOAD_FACTOR = 0.75f; - - /** - * Construct a new, empty bag with the - * default capacity, which is 16, and load factor, which is 0.75. - */ - public HashBag() { - this(DEFAULT_INITIAL_CAPACITY); - } - - /** - * Construct a new, empty bag with the specified initial capacity - * and the default load factor, which is 0.75. - * - * @param initialCapacity the initial capacity - * @throws IllegalArgumentException if the initial capacity is less - * than zero - */ - public HashBag(int initialCapacity) { - this(initialCapacity, DEFAULT_LOAD_FACTOR, false); // false = do not validate parms - } - - /** - * Construct a new, empty bag with - * the specified initial capacity and load factor. - * - * @param initialCapacity the initial capacity - * @param loadFactor the load factor - * @throws IllegalArgumentException if the initial capacity is less - * than zero or if the load factor is non-positive - */ - public HashBag(int initialCapacity, float loadFactor) { - this(initialCapacity, loadFactor, true); // true = validate parms - } - - private HashBag(int initialCapacity, float loadFactor, boolean validateParms) { - super(); - int capacity = initialCapacity; - if (validateParms) { - if (capacity < 0) { - throw new IllegalArgumentException("Illegal Initial Capacity: " + capacity); //$NON-NLS-1$ - } - if (capacity > MAXIMUM_CAPACITY) { - capacity = MAXIMUM_CAPACITY; - } - if (loadFactor <= 0 || Float.isNaN(loadFactor)) { - throw new IllegalArgumentException("Illegal Load factor: " + loadFactor); //$NON-NLS-1$ - } - - // find a power of 2 >= 'initialCapacity' - capacity = 1; - while (capacity < initialCapacity) { - capacity <<= 1; - } - } - - this.loadFactor = loadFactor; - this.table = this.buildTable(capacity); - this.threshold = (int) (capacity * loadFactor); - } - - /** - * Construct a new bag containing the elements in the specified - * collection. The bag's load factor will be the default, which is 0.75, - * and its initial capacity will be sufficient to hold all the elements in - * the specified collection. - * - * @param c the collection whose elements are to be placed into this bag. - */ - public HashBag(Collection c) { - this(Math.max((int) (c.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); - this.addAll_(c); - } - - /** - * Return a hash for the specified object. - */ - private int hash(Object o) { - return (o == null) ? 0 : this.tweakHash(o.hashCode()); - } - - /** - * Tweak the specified hash, to defend against poor implementations - * of {@link Object#hashCode()}. - */ - private int tweakHash(int h) { - h ^= (h >>> 20) ^ (h >>> 12); - return h ^ (h >>> 7) ^ (h >>> 4); - } - - /** - * Return the index for the specified hash. - */ - private int index(int hash) { - return this.index(hash, this.table.length); - } - - /** - * Return the index for the specified hash - * within a table with the specified length. - */ - int index(int hash, int length) { - return hash & (length - 1); - } - - /** - * Internal {@link #addAll(Collection)} for construction and cloning. - * (No check for re-hash; no change to mod count; no return value.) - */ - private void addAll_(Iterable c) { - for (E e : c) { - this.add_(e); - } - } - - /** - * Internal {@link #add(Object)} for construction and cloning. - * (No check for re-hash; no change to mod count; no return value.) - */ - private void add_(E o) { - this.add_(o, 1); - } - - /** - * Internal {@link #add(Object, int)} for construction, cloning, and serialization. - * (No check for re-hash; no change to mod count; no return value.) - */ - private void add_(E o, int cnt) { - int hash = this.hash(o); - int index = this.index(hash); - for (Entry e = this.table[index]; e != null; e = e.next) { - Object eo; - if ((e.hash == hash) && (((eo = e.object) == o) || ((o != null) && o.equals(eo)))) { - e.count += cnt; - this.size += cnt; - return; - } - } - - // create the new entry and put it in the table - Entry e = this.buildEntry(hash, o, cnt, this.table[index]); - this.table[index] = e; - this.size += cnt; - this.uniqueCount++; - } - - /** - * This implementation simply returns the maintained size. - */ - @Override - public int size() { - return this.size; - } - - /** - * This implementation simply compares the maintained size to zero. - */ - @Override - public boolean isEmpty() { - return this.size == 0; - } - - /** - * Search for the object's entry in the hash table by calculating - * the object's hash code and examining the entries in the corresponding hash - * table bucket. - */ - private Entry getEntry(Object o) { - int hash = this.hash(o); - for (Entry e = this.table[this.index(hash)]; e != null; e = e.next) { - Object eo; - if ((e.hash == hash) && (((eo = e.object) == o) || ((o != null) && o.equals(eo)))) { - return e; - } - } - return null; - } - - @Override - public boolean contains(Object o) { - return this.getEntry(o) != null; - } - - public int count(Object o) { - Entry e = this.getEntry(o); - return (e == null) ? 0 : e.count; - } - - /** - * Rehash the contents of the bag into a new hash table - * with a larger capacity. This method is called when the - * number of different elements in the bag exceeds its - * capacity and load factor. - */ - private void rehash() { - Entry[] oldTable = this.table; - int oldCapacity = oldTable.length; - - if (oldCapacity == MAXIMUM_CAPACITY) { - this.threshold = Integer.MAX_VALUE; - return; - } - - int newCapacity = 2 * oldCapacity; - Entry[] newTable = this.buildTable(newCapacity); - - for (int i = oldCapacity; i-- > 0; ) { - for (Entry old = oldTable[i]; old != null; ) { - Entry e = old; - old = old.next; - - int index = this.index(e.hash, newCapacity); - e.next = newTable[index]; - newTable[index] = e; - } - } - - this.table = newTable; - this.threshold = (int) (newCapacity * this.loadFactor); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - private Entry[] buildTable(int capacity) { - return new Entry[capacity]; - } - - /** - * This implementation searches for the object in the hash table by calculating - * the object's hash code and examining the entries in the corresponding hash - * table bucket. - */ - @Override - public boolean add(E o) { - return this.add(o, 1); - } - - /** - * This implementation searches for the object in the hash table by calculating - * the object's hash code and examining the entries in the corresponding hash - * table bucket. - */ - public boolean add(E o, int cnt) { - if (cnt <= 0) { - return false; - } - this.modCount++; - int hash = this.hash(o); - int index = this.index(hash); - - // if the object is already in the bag, simply bump its count - for (Entry e = this.table[index]; e != null; e = e.next) { - Object eo; - if ((e.hash == hash) && (((eo = e.object) == o) || ((o != null) && o.equals(eo)))) { - e.count += cnt; - this.size += cnt; - return true; - } - } - - // rehash the table if we are going to exceed the threshold - if (this.uniqueCount >= this.threshold) { - this.rehash(); - index = this.index(hash); // need to re-calculate the index - } - - // create the new entry and put it in the table - Entry e = this.buildEntry(hash, o, cnt, this.table[index]); - this.table[index] = e; - this.size += cnt; - this.uniqueCount++; - return true; - } - - // minimize scope of suppressed warnings - @SuppressWarnings({ "rawtypes", "unchecked" } ) - private Entry buildEntry(int hash, Object o, int cnt, Entry next) { - return new Entry(hash, (E) o, cnt, (Entry) next); - } - - /** - * This implementation searches for the object in the hash table by calculating - * the object's hash code and examining the entries in the corresponding hash - * table bucket. - */ - @Override - public boolean remove(Object o) { - return this.remove(o, 1); - } - - /** - * This implementation searches for the object in the hash table by calculating - * the object's hash code and examining the entries in the corresponding hash - * table bucket. - */ - public boolean remove(Object o, int cnt) { - if (cnt <= 0) { - return false; - } - int hash = this.hash(o); - int index = this.index(hash); - - for (Entry e = this.table[index], prev = null; e != null; prev = e, e = e.next) { - Object eo; - if ((e.hash == hash) && (((eo = e.object) == o) || ((o != null) && o.equals(eo)))) { - this.modCount++; - cnt = (cnt < e.count) ? cnt : e.count; - e.count -= cnt; - // if we are removing the last element(s), remove the entry from the table - if (e.count == 0) { - if (prev == null) { - this.table[index] = e.next; - } else { - prev.next = e.next; - } - this.uniqueCount--; - } - this.size -= cnt; - return true; - } - } - - return false; - } - - /** - * This implementation simply clears out all of the hash table buckets. - */ - @Override - public void clear() { - Entry[] tab = this.table; - this.modCount++; - for (int i = tab.length; i-- > 0; ) { - tab[i] = null; - } - this.size = 0; - this.uniqueCount = 0; - } - - /** - * Returns a shallow copy of this bag: the elements - * themselves are not cloned. - * - * @return a shallow copy of this bag. - */ - @Override - public HashBag clone() { - try { - @SuppressWarnings("unchecked") - HashBag clone = (HashBag) super.clone(); - clone.table = this.buildTable(this.table.length); - clone.size = 0; - clone.uniqueCount = 0; - clone.modCount = 0; - clone.addAll_(this); - return clone; - } catch (CloneNotSupportedException e) { - throw new InternalError(); - } - } - - - /** - * Hash table collision list entry. - */ - private static class Entry implements Bag.Entry { - final int hash; - final E object; - int count; - Entry next; - - Entry(int hash, E object, int count, Entry next) { - this.hash = hash; - this.object = object; - this.count = count; - this.next = next; - } - - // ***** Bag.Entry implementation - public E getElement() { - return this.object; - } - - public int getCount() { - return this.count; - } - - public int setCount(int count) { - if (count <= 0) { - throw new IllegalArgumentException("count must be greater than zero: " + count); //$NON-NLS-1$ - } - int old = this.count; - this.count = count; - return old; - } - - @Override - public boolean equals(Object o) { - if ( ! (o instanceof Bag.Entry)) { - return false; - } - @SuppressWarnings("rawtypes") - Bag.Entry e = (Bag.Entry) o; - return (this.count == e.getCount()) && - Tools.valuesAreEqual(this.object, e.getElement()); - } - - @Override - public int hashCode() { - E o = this.object; - return (o == null) ? 0 : (this.count * o.hashCode()); - } - - @Override - public String toString() { - return this.object + "=>" + this.count; //$NON-NLS-1$ - } - } - - - @Override - @SuppressWarnings("unchecked") - public Iterator iterator() { - return (this.size == 0) ? EMPTY_ITERATOR : new HashIterator(); - } - - @SuppressWarnings("unchecked") - public Iterator uniqueIterator() { - return (this.size == 0) ? EMPTY_ITERATOR : new UniqueIterator(); - } - - public int uniqueCount() { - return this.uniqueCount; - } - - @SuppressWarnings("unchecked") - public Iterator> entries() { - return (this.size == 0) ? EMPTY_ITERATOR : new EntryIterator(); - } - - - /** - * Empty iterator that does just about nothing. - */ - @SuppressWarnings("rawtypes") - private static final Iterator EMPTY_ITERATOR = new EmptyIterator(); - - @SuppressWarnings("rawtypes") - private static class EmptyIterator implements Iterator { - - EmptyIterator() { - super(); - } - - public boolean hasNext() { - return false; - } - - public Object next() { - throw new NoSuchElementException(); - } - - public void remove() { - throw new IllegalStateException(); - } - } - - - private class HashIterator implements Iterator { - private int index = HashBag.this.table.length; // start at the end of the table - private Entry nextEntry = null; - private int nextEntryCount = 0; - private Entry lastReturnedEntry = null; - - /** - * The modCount value that the iterator believes that the backing - * bag should have. If this expectation is violated, the iterator - * has detected a concurrent modification. - */ - private int expectedModCount = HashBag.this.modCount; - - HashIterator() { - super(); - } - - public boolean hasNext() { - Entry e = this.nextEntry; - int i = this.index; - Entry[] tab = HashBag.this.table; - // Use locals for faster loop iteration - while ((e == null) && (i > 0)) { - e = tab[--i]; // move backwards through the table - } - this.nextEntry = e; - this.index = i; - return e != null; - } - - public E next() { - if (HashBag.this.modCount != this.expectedModCount) { - throw new ConcurrentModificationException(); - } - Entry et = this.nextEntry; - int i = this.index; - Entry[] tab = HashBag.this.table; - // Use locals for faster loop iteration - while ((et == null) && (i > 0)) { - et = tab[--i]; // move backwards through the table - } - this.nextEntry = et; - this.index = i; - if (et == null) { - throw new NoSuchElementException(); - } - Entry e = this.lastReturnedEntry = this.nextEntry; - this.nextEntryCount++; - if (this.nextEntryCount == e.count) { - this.nextEntry = e.next; - this.nextEntryCount = 0; - } - return e.object; - } - - public void remove() { - if (this.lastReturnedEntry == null) { - throw new IllegalStateException(); - } - if (HashBag.this.modCount != this.expectedModCount) { - throw new ConcurrentModificationException(); - } - int slot = HashBag.this.index(this.lastReturnedEntry.hash, HashBag.this.table.length); - for (Entry e = HashBag.this.table[slot], prev = null; e != null; prev = e, e = e.next) { - if (e == this.lastReturnedEntry) { - HashBag.this.modCount++; - this.expectedModCount++; - e.count--; - if (e.count == 0) { - // if we are removing the last one, remove the entry from the table - if (prev == null) { - HashBag.this.table[slot] = e.next; - } else { - prev.next = e.next; - } - HashBag.this.uniqueCount--; - } else { - // slide back the count to account for the just-removed element - this.nextEntryCount--; - } - HashBag.this.size--; - this.lastReturnedEntry = null; // it cannot be removed again - return; - } - } - throw new ConcurrentModificationException(); - } - - } - - - private class EntryIterator implements Iterator> { - private int index = HashBag.this.table.length; // start at the end of the table - private Entry nextEntry = null; - private Entry lastReturnedEntry = null; - - /** - * The modCount value that the iterator believes that the backing - * bag should have. If this expectation is violated, the iterator - * has detected a concurrent modification. - */ - private int expectedModCount = HashBag.this.modCount; - - EntryIterator() { - super(); - } - - public boolean hasNext() { - Entry e = this.nextEntry; - int i = this.index; - Entry[] tab = HashBag.this.table; - // Use locals for faster loop iteration - while ((e == null) && (i > 0)) { - e = tab[--i]; // move backwards through the table - } - this.nextEntry = e; - this.index = i; - return e != null; - } - - public Entry next() { - if (HashBag.this.modCount != this.expectedModCount) { - throw new ConcurrentModificationException(); - } - Entry et = this.nextEntry; - int i = this.index; - Entry[] tab = HashBag.this.table; - // Use locals for faster loop iteration - while ((et == null) && (i > 0)) { - et = tab[--i]; // move backwards through the table - } - this.nextEntry = et; - this.index = i; - if (et == null) { - throw new NoSuchElementException(); - } - Entry e = this.lastReturnedEntry = this.nextEntry; - this.nextEntry = e.next; - return e; - } - - public void remove() { - if (this.lastReturnedEntry == null) { - throw new IllegalStateException(); - } - if (HashBag.this.modCount != this.expectedModCount) { - throw new ConcurrentModificationException(); - } - int slot = HashBag.this.index(this.lastReturnedEntry.hash, HashBag.this.table.length); - for (Entry e = HashBag.this.table[slot], prev = null; e != null; prev = e, e = e.next) { - if (e == this.lastReturnedEntry) { - HashBag.this.modCount++; - this.expectedModCount++; - // remove the entry from the table - if (prev == null) { - HashBag.this.table[slot] = e.next; - } else { - prev.next = e.next; - } - HashBag.this.uniqueCount--; - HashBag.this.size -= this.lastReturnedEntry.count; - this.lastReturnedEntry = null; // it cannot be removed again - return; - } - } - throw new ConcurrentModificationException(); - } - - } - - - private class UniqueIterator implements Iterator { - private EntryIterator entryIterator = new EntryIterator(); - - UniqueIterator() { - super(); - } - - public boolean hasNext() { - return this.entryIterator.hasNext(); - } - - public E next() { - return this.entryIterator.next().object; - } - - public void remove() { - this.entryIterator.remove(); - } - - } - - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if ( ! (o instanceof Bag)) { - return false; - } - @SuppressWarnings("unchecked") - Bag b = (Bag) o; - if (b.size() != this.size()) { - return false; - } - if (b.uniqueCount() != this.uniqueCount()) { - return false; - } - for (Iterator> stream = b.entries(); stream.hasNext(); ) { - Bag.Entry entry = stream.next(); - if (entry.getCount() != this.count(entry.getElement())) { - return false; - } - } - return true; - } - - @Override - public int hashCode() { - int h = 0; - for (E o : this) { - if (o != null) { - h += o.hashCode(); - } - } - return h; - } - - /** - * Save the state of this bag to a stream (i.e. serialize it). - * - * @serialData Emit the capacity of the bag (int), - * followed by the number of unique elements in the bag (int), - * followed by all of the bag's elements (each an Object) and - * their counts (each an int), in no particular order. - */ - private void writeObject(java.io.ObjectOutputStream s) - throws java.io.IOException { - // write out the threshold, load factor, and any hidden stuff - s.defaultWriteObject(); - - // write out number of buckets - s.writeInt(this.table.length); - - // write out number of unique elements - s.writeInt(this.uniqueCount); - - // write out elements and counts (alternating) - if (this.uniqueCount > 0) { - for (Entry entry : this.table) { - while (entry != null) { - s.writeObject(entry.object); - s.writeInt(entry.count); - entry = entry.next; - } - } - } - } - - private static final long serialVersionUID = 1L; - - /** - * Reconstitute the bag from a stream (i.e. deserialize it). - */ - private void readObject(java.io.ObjectInputStream s) - throws java.io.IOException, ClassNotFoundException { - // read in the threshold, loadfactor, and any hidden stuff - s.defaultReadObject(); - - // read in number of buckets and allocate the bucket array - this.table = this.buildTable(s.readInt()); - - // read in number of unique elements - int unique = s.readInt(); - - // read the elements and counts, and put the elements in the bag - for (int i = 0; i < unique; i++) { - @SuppressWarnings("unchecked") - E element = (E) s.readObject(); - int elementCount = s.readInt(); - this.add_(element, elementCount); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/IdentityHashBag.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/IdentityHashBag.java deleted file mode 100644 index 7c2fbc4a5c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/IdentityHashBag.java +++ /dev/null @@ -1,924 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import java.util.AbstractCollection; -import java.util.Collection; -import java.util.ConcurrentModificationException; -import java.util.Iterator; -import java.util.NoSuchElementException; - -/** - * This class implements the {@link Bag} interface with a - * hash table, using object-identity in place of object-equality when - * comparing elements. In other words, in an IdentityHashBag, - * two objects o1 and o2 are considered - * equal if and only if (o1 == o2). (In normal {@link Bag} - * implementations (like {@link HashBag}) two objects o1 - * and o2 are considered equal if and only if - * (o1 == null ? o2 == null : o1.equals(o2)).) - *

- * - * This class is not a general-purpose {@link Bag} - * implementation! While this class implements the {@link Bag} interface, it - * intentionally violates {@link Bag}'s general contract, which mandates the - * use of the equals method when comparing objects. This class is - * designed for use only in the rare cases wherein object-identity - * semantics are required. - * - *

- * This class makes no guarantees as to the iteration order of - * the bag's elements; in particular, it does not guarantee that the order - * will remain constant over time. This class permits the null - * element. - *

- * This class offers constant time performance for the basic operations - * (add, remove, contains and - * size), assuming the system identity hash function - * ({@link System#identityHashCode(Object)}) disperses elements properly - * among the buckets. Iterating over this bag requires time - * proportional to the sum of the bag's size (the number of elements) plus the - * "capacity" of the backing hash table (the number of buckets). Thus, it is - * important not to set the initial capacity too high (or the load factor too - * low) if iteration performance is important. - *

- * Note that this implementation is not synchronized. If multiple - * threads access a bag concurrently, and at least one of the threads modifies - * the bag, it must be synchronized externally. This is typically - * accomplished by synchronizing on some object that naturally encapsulates - * the bag. If no such object exists, the bag should be "wrapped" using the - * Collections.synchronizedCollection method. This is - * best done at creation time, to prevent accidental unsynchronized access - * to the bag: - *

- * Collection c = Collections.synchronizedCollection(new IdentityHashBag(...));
- * 
- *

- * The iterators returned by this class's iterator method are - * fail-fast: if the bag is modified at any time after the iterator is - * created, in any way except through the iterator's own remove - * method, the iterator throws a {@link ConcurrentModificationException}. - * Thus, in the face of concurrent modification, the iterator fails quickly - * and cleanly, rather than risking arbitrary, non-deterministic behavior at - * an undetermined time in the future. - *

- * Note that the fail-fast behavior of an iterator cannot be guaranteed - * as it is, generally speaking, impossible to make any hard guarantees in the - * presence of unsynchronized concurrent modification. Fail-fast iterators - * throw ConcurrentModificationException on a best-effort basis. - * Therefore, it would be wrong to write a program that depended on this - * exception for its correctness: the fail-fast behavior of iterators - * should be used only to detect bugs. - * - * @param the type of elements maintained by the bag - * - * @see Collection - * @see Bag - * @see SynchronizedBag - * @see Collections#synchronizedCollection(Collection) - * @see HashBag - */ -public class IdentityHashBag - extends AbstractCollection - implements Bag, Cloneable, Serializable -{ - /** The hash table. Resized as necessary. Length MUST Always be a power of two. */ - transient Entry[] table; - - /** The total number of entries in the bag. */ - transient int size = 0; - - /** The number of UNIQUE entries in the bag. */ - transient int uniqueCount = 0; - - /** - * The hash table is rehashed when its size exceeds this threshold. (The - * value of this field is (int) (capacity * loadFactor).) - * - * @serial - */ - private int threshold; - - /** - * The load factor for the hash table. - * - * @serial - */ - private final float loadFactor; - - /** - * The number of times this bag has been structurally modified. - * Structural modifications are those that change the number of entries in - * the bag or otherwise modify its internal structure (e.g. rehash). - * This field is used to make iterators on this bag fail-fast. - * - * @see java.util.ConcurrentModificationException - */ - transient int modCount = 0; - - /** - * The default initial capacity - MUST be a power of two. - */ - private static final int DEFAULT_INITIAL_CAPACITY = 16; - - /** - * The maximum capacity, used if a higher value is implicitly specified - * by either of the constructors with arguments. - * MUST be a power of two <= (1 << 30). - */ - private static final int MAXIMUM_CAPACITY = 1 << 30; - - /** - * The load factor used when none specified in constructor. - */ - private static final float DEFAULT_LOAD_FACTOR = 0.75f; - - /** - * Construct a new, empty bag with the - * default capacity, which is 16, and load factor, which is 0.75. - */ - public IdentityHashBag() { - this(DEFAULT_INITIAL_CAPACITY); - } - - /** - * Construct a new, empty bag with the specified initial capacity - * and the default load factor, which is 0.75. - * - * @param initialCapacity the initial capacity - * @throws IllegalArgumentException if the initial capacity is less - * than zero - */ - public IdentityHashBag(int initialCapacity) { - this(initialCapacity, DEFAULT_LOAD_FACTOR, false); // false = do not validate parms - } - - /** - * Construct a new, empty bag with - * the specified initial capacity and load factor. - * - * @param initialCapacity the initial capacity - * @param loadFactor the load factor - * @throws IllegalArgumentException if the initial capacity is less - * than zero or if the load factor is non-positive - */ - public IdentityHashBag(int initialCapacity, float loadFactor) { - this(initialCapacity, loadFactor, true); // true = validate parms - } - - private IdentityHashBag(int initialCapacity, float loadFactor, boolean validateParms) { - super(); - int capacity = initialCapacity; - if (validateParms) { - if (capacity < 0) { - throw new IllegalArgumentException("Illegal Initial Capacity: " + capacity); //$NON-NLS-1$ - } - if (capacity > MAXIMUM_CAPACITY) { - capacity = MAXIMUM_CAPACITY; - } - if (loadFactor <= 0 || Float.isNaN(loadFactor)) { - throw new IllegalArgumentException("Illegal Load factor: " + loadFactor); //$NON-NLS-1$ - } - - // find a power of 2 >= 'initialCapacity' - capacity = 1; - while (capacity < initialCapacity) { - capacity <<= 1; - } - } - - this.loadFactor = loadFactor; - this.table = this.buildTable(capacity); - this.threshold = (int) (capacity * loadFactor); - } - - /** - * Construct a new bag containing the elements in the specified - * collection. The bag's load factor will be the default, which is 0.75, - * and its initial capacity will be sufficient to hold all the elements in - * the specified collection. - * - * @param c the collection whose elements are to be placed into this bag. - */ - public IdentityHashBag(Collection c) { - this(Math.max((int) (c.size() / DEFAULT_LOAD_FACTOR) + 1, DEFAULT_INITIAL_CAPACITY), DEFAULT_LOAD_FACTOR); - this.addAll_(c); - } - - /** - * Return a index for the specified object. - */ - private int index(Object o) { - return this.index(this.hash(o)); - } - - /** - * Return a hash for the specified object. - */ - private int hash(Object o) { - return (o == null) ? 0 : this.tweakHash(System.identityHashCode(o)); - } - - /** - * Tweak the specified hash. - */ - private int tweakHash(int h) { - return h; -// h ^= (h >>> 20) ^ (h >>> 12); -// return h ^ (h >>> 7) ^ (h >>> 4); - } - - /** - * Return the index for the specified hash. - */ - private int index(int hash) { - return this.index(hash, this.table.length); - } - - /** - * Return the index for the specified hash - * within a table with the specified length. - */ - int index(int hash, int length) { - return hash & (length - 1); - } - - /** - * Internal {@link #addAll(Collection)} for construction and cloning. - * (No check for re-hash; no change to mod count; no return value.) - */ - private void addAll_(Iterable c) { - for (E e : c) { - this.add_(e); - } - } - - /** - * Internal {@link #add(Object)} for construction and cloning. - * (No check for re-hash; no change to mod count; no return value.) - */ - private void add_(E o) { - this.add_(o, 1); - } - - /** - * Internal {@link #add(Object, int)} for construction, cloning, and serialization. - * (No check for re-hash; no change to mod count; no return value.) - */ - private void add_(E o, int cnt) { - int hash = this.hash(o); - int index = this.index(hash); - for (Entry e = this.table[index]; e != null; e = e.next) { - if (e.object == o) { - e.count += cnt; - this.size += cnt; - return; - } - } - - // create the new entry and put it in the table - Entry e = this.buildEntry(hash, o, cnt, this.table[index]); - this.table[index] = e; - this.size += cnt; - this.uniqueCount++; - } - - /** - * This implementation simply returns the maintained size. - */ - @Override - public int size() { - return this.size; - } - - /** - * This implementation simply compares the maintained size to zero. - */ - @Override - public boolean isEmpty() { - return this.size == 0; - } - - /** - * Search for the object's entry in the hash table by calculating - * the object's identity hash code and examining the entries in the corresponding hash - * table bucket. - */ - private Entry getEntry(Object o) { - for (Entry e = this.table[this.index(o)]; e != null; e = e.next) { - if (e.object == o) { - return e; - } - } - return null; - } - - @Override - public boolean contains(Object o) { - return this.getEntry(o) != null; - } - - public int count(Object o) { - Entry e = this.getEntry(o); - return (e == null) ? 0 : e.count; - } - - /** - * Rehash the contents of the bag into a new hash table - * with a larger capacity. This method is called when the - * number of different elements in the bag exceeds its - * capacity and load factor. - */ - private void rehash() { - Entry[] oldTable = this.table; - int oldCapacity = oldTable.length; - - if (oldCapacity == MAXIMUM_CAPACITY) { - this.threshold = Integer.MAX_VALUE; - return; - } - - int newCapacity = 2 * oldCapacity; - Entry[] newTable = this.buildTable(newCapacity); - - for (int i = oldCapacity; i-- > 0; ) { - for (Entry old = oldTable[i]; old != null; ) { - Entry e = old; - old = old.next; - - int index = this.index(e.hash, newCapacity); - e.next = newTable[index]; - newTable[index] = e; - } - } - - this.table = newTable; - this.threshold = (int) (newCapacity * this.loadFactor); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - private Entry[] buildTable(int capacity) { - return new Entry[capacity]; - } - - /** - * This implementation searches for the object in the hash table by calculating - * the object's identity hash code and examining the entries in the corresponding hash - * table bucket. - */ - @Override - public boolean add(E o) { - return this.add(o, 1); - } - - /** - * This implementation searches for the object in the hash table by calculating - * the object's identity hash code and examining the entries in the corresponding hash - * table bucket. - */ - public boolean add(E o, int cnt) { - if (cnt <= 0) { - return false; - } - this.modCount++; - int hash = this.hash(o); - int index = this.index(hash); - - // if the object is already in the bag, simply bump its count - for (Entry e = this.table[index]; e != null; e = e.next) { - if (e.object == o) { - e.count += cnt; - this.size += cnt; - return true; - } - } - - // rehash the table if we are going to exceed the threshold - if (this.uniqueCount >= this.threshold) { - this.rehash(); - index = this.index(hash); // need to re-calculate the index - } - - // create the new entry and put it in the table - Entry e = this.buildEntry(hash, o, cnt, this.table[index]); - this.table[index] = e; - this.size += cnt; - this.uniqueCount++; - return true; - } - - // minimize scope of suppressed warnings - @SuppressWarnings({ "unchecked", "rawtypes" }) - private Entry buildEntry(int hash, Object o, int cnt, Entry next) { - return new Entry(hash, (E) o, cnt, (Entry) next); - } - - /** - * This implementation searches for the object in the hash table by calculating - * the object's identity hash code and examining the entries in the corresponding hash - * table bucket. - */ - @Override - public boolean remove(Object o) { - return this.remove(o, 1); - } - - /** - * This implementation searches for the object in the hash table by calculating - * the object's identity hash code and examining the entries in the corresponding hash - * table bucket. - */ - public boolean remove(Object o, int cnt) { - if (cnt <= 0) { - return false; - } - int index = this.index(o); - - for (Entry e = this.table[index], prev = null; e != null; prev = e, e = e.next) { - if (e.object == o) { - this.modCount++; - cnt = (cnt < e.count) ? cnt : e.count; - e.count -= cnt; - // if we are removing the last element(s), remove the entry from the table - if (e.count == 0) { - if (prev == null) { - this.table[index] = e.next; - } else { - prev.next = e.next; - } - this.uniqueCount--; - } - this.size -= cnt; - return true; - } - } - - return false; - } - - /** - * This implementation uses object-identity to determine whether the - * specified collection contains a particular element. - */ - @Override - public boolean removeAll(Collection c) { - return super.removeAll(new IdentityHashBag(c)); - } - - /** - * This implementation uses object-identity to determine whether the - * specified collection contains a particular element. - */ - @Override - public boolean retainAll(Collection c) { - return super.retainAll(new IdentityHashBag(c)); - } - - /** - * This implementation simply clears out all of the hash table buckets. - */ - @Override - public void clear() { - Entry[] tab = this.table; - this.modCount++; - for (int i = tab.length; i-- > 0; ) { - tab[i] = null; - } - this.size = 0; - this.uniqueCount = 0; - } - - /** - * Returns a shallow copy of this bag: the elements - * themselves are not cloned. - * - * @return a shallow copy of this bag. - */ - @Override - public IdentityHashBag clone() { - try { - @SuppressWarnings("unchecked") - IdentityHashBag clone = (IdentityHashBag) super.clone(); - clone.table = this.buildTable(this.table.length); - clone.size = 0; - clone.uniqueCount = 0; - clone.modCount = 0; - clone.addAll_(this); - return clone; - } catch (CloneNotSupportedException e) { - throw new InternalError(); - } - } - - - /** - * Hash table collision list entry. - */ - private static class Entry implements Bag.Entry { - final int hash; // cache the hash for re-hashes - final E object; - int count; - Entry next; - - Entry(int hash, E object, int count, Entry next) { - this.hash = hash; - this.object = object; - this.count = count; - this.next = next; - } - - // ***** Bag.Entry implementation - public E getElement() { - return this.object; - } - - public int getCount() { - return this.count; - } - - public int setCount(int count) { - if (count <= 0) { - throw new IllegalArgumentException("count must be greater than zero: " + count); //$NON-NLS-1$ - } - int old = this.count; - this.count = count; - return old; - } - - @Override - public boolean equals(Object o) { - if ( ! (o instanceof Bag.Entry)) { - return false; - } - @SuppressWarnings("rawtypes") - Bag.Entry e = (Bag.Entry) o; - return (this.object == e.getElement()) - && (this.count == e.getCount()); - } - - @Override - public int hashCode() { - E o = this.object; - return (o == null) ? 0 : (this.count * o.hashCode()); - } - - @Override - public String toString() { - return this.object + "=>" + this.count; //$NON-NLS-1$ - } - } - - - @Override - @SuppressWarnings("unchecked") - public Iterator iterator() { - return (this.size == 0) ? EMPTY_ITERATOR : new HashIterator(); - } - - @SuppressWarnings("unchecked") - public Iterator uniqueIterator() { - return (this.size == 0) ? EMPTY_ITERATOR : new UniqueIterator(); - } - - public int uniqueCount() { - return this.uniqueCount; - } - - @SuppressWarnings("unchecked") - public Iterator> entries() { - return (this.size == 0) ? EMPTY_ITERATOR : new EntryIterator(); - } - - - /** - * Empty iterator that does just about nothing. - */ - @SuppressWarnings("rawtypes") - private static final Iterator EMPTY_ITERATOR = new EmptyIterator(); - - @SuppressWarnings("rawtypes") - private static class EmptyIterator implements Iterator { - - EmptyIterator() { - super(); - } - - public boolean hasNext() { - return false; - } - - public Object next() { - throw new NoSuchElementException(); - } - - public void remove() { - throw new IllegalStateException(); - } - } - - - private class HashIterator implements Iterator { - private int index = IdentityHashBag.this.table.length; // start at the end of the table - private Entry nextEntry = null; - private int nextEntryCount = 0; - private Entry lastReturnedEntry = null; - - /** - * The modCount value that the iterator believes that the backing - * bag should have. If this expectation is violated, the iterator - * has detected a concurrent modification. - */ - private int expectedModCount = IdentityHashBag.this.modCount; - - HashIterator() { - super(); - } - - public boolean hasNext() { - Entry e = this.nextEntry; - int i = this.index; - Entry[] tab = IdentityHashBag.this.table; - // Use locals for faster loop iteration - while ((e == null) && (i > 0)) { - e = tab[--i]; // move backwards through the table - } - this.nextEntry = e; - this.index = i; - return e != null; - } - - public E next() { - if (IdentityHashBag.this.modCount != this.expectedModCount) { - throw new ConcurrentModificationException(); - } - Entry et = this.nextEntry; - int i = this.index; - Entry[] tab = IdentityHashBag.this.table; - // Use locals for faster loop iteration - while ((et == null) && (i > 0)) { - et = tab[--i]; // move backwards through the table - } - this.nextEntry = et; - this.index = i; - if (et == null) { - throw new NoSuchElementException(); - } - Entry e = this.lastReturnedEntry = this.nextEntry; - this.nextEntryCount++; - if (this.nextEntryCount == e.count) { - this.nextEntry = e.next; - this.nextEntryCount = 0; - } - return e.object; - } - - public void remove() { - if (this.lastReturnedEntry == null) { - throw new IllegalStateException(); - } - if (IdentityHashBag.this.modCount != this.expectedModCount) { - throw new ConcurrentModificationException(); - } - int slot = IdentityHashBag.this.index(this.lastReturnedEntry.hash, IdentityHashBag.this.table.length); - for (Entry e = IdentityHashBag.this.table[slot], prev = null; e != null; prev = e, e = e.next) { - if (e == this.lastReturnedEntry) { - IdentityHashBag.this.modCount++; - this.expectedModCount++; - e.count--; - if (e.count == 0) { - // if we are removing the last one, remove the entry from the table - if (prev == null) { - IdentityHashBag.this.table[slot] = e.next; - } else { - prev.next = e.next; - } - IdentityHashBag.this.uniqueCount--; - } else { - // slide back the count to account for the just-removed element - this.nextEntryCount--; - } - IdentityHashBag.this.size--; - this.lastReturnedEntry = null; // it cannot be removed again - return; - } - } - throw new ConcurrentModificationException(); - } - - } - - - private class EntryIterator implements Iterator> { - private int index = IdentityHashBag.this.table.length; // start at the end of the table - private Entry nextEntry = null; - private Entry lastReturnedEntry = null; - - /** - * The modCount value that the iterator believes that the backing - * bag should have. If this expectation is violated, the iterator - * has detected a concurrent modification. - */ - private int expectedModCount = IdentityHashBag.this.modCount; - - EntryIterator() { - super(); - } - - public boolean hasNext() { - Entry e = this.nextEntry; - int i = this.index; - Entry[] tab = IdentityHashBag.this.table; - // Use locals for faster loop iteration - while ((e == null) && (i > 0)) { - e = tab[--i]; // move backwards through the table - } - this.nextEntry = e; - this.index = i; - return e != null; - } - - public Entry next() { - if (IdentityHashBag.this.modCount != this.expectedModCount) { - throw new ConcurrentModificationException(); - } - Entry et = this.nextEntry; - int i = this.index; - Entry[] tab = IdentityHashBag.this.table; - // Use locals for faster loop iteration - while ((et == null) && (i > 0)) { - et = tab[--i]; // move backwards through the table - } - this.nextEntry = et; - this.index = i; - if (et == null) { - throw new NoSuchElementException(); - } - Entry e = this.lastReturnedEntry = this.nextEntry; - this.nextEntry = e.next; - return e; - } - - public void remove() { - if (this.lastReturnedEntry == null) { - throw new IllegalStateException(); - } - if (IdentityHashBag.this.modCount != this.expectedModCount) { - throw new ConcurrentModificationException(); - } - int slot = IdentityHashBag.this.index(this.lastReturnedEntry.hash, IdentityHashBag.this.table.length); - for (Entry e = IdentityHashBag.this.table[slot], prev = null; e != null; prev = e, e = e.next) { - if (e == this.lastReturnedEntry) { - IdentityHashBag.this.modCount++; - this.expectedModCount++; - // remove the entry from the table - if (prev == null) { - IdentityHashBag.this.table[slot] = e.next; - } else { - prev.next = e.next; - } - IdentityHashBag.this.uniqueCount--; - IdentityHashBag.this.size -= this.lastReturnedEntry.count; - this.lastReturnedEntry = null; // it cannot be removed again - return; - } - } - throw new ConcurrentModificationException(); - } - - } - - - private class UniqueIterator implements Iterator { - private EntryIterator entryIterator = new EntryIterator(); - - UniqueIterator() { - super(); - } - - public boolean hasNext() { - return this.entryIterator.hasNext(); - } - - public E next() { - return this.entryIterator.next().object; - } - - public void remove() { - this.entryIterator.remove(); - } - - } - - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } else if (o instanceof IdentityHashBag) { - @SuppressWarnings("unchecked") - IdentityHashBag b = (IdentityHashBag) o; - if (b.size() != this.size()) { - return false; - } - if (b.uniqueCount() != this.uniqueCount()) { - return false; - } - for (Iterator> stream = b.entries(); stream.hasNext(); ) { - Bag.Entry entry = stream.next(); - if (entry.getCount() != this.count(entry.getElement())) { - return false; - } - } - return true; - } else { - return this.equals_(o); - } -// } else if (o instanceof Bag) { -// // hmmm... -// return new HashBag(this).equals(o); -// } else { -// return false; -// } - } - - private boolean equals_(Object o) { - // hmmm... - return (o instanceof Bag) && - new HashBag(this).equals(o); - } - - @Override - public int hashCode() { - int h = 0; - for (E o : this) { - h += System.identityHashCode(o); - } - return h; - } - - /** - * Save the state of this bag to a stream (i.e. serialize it). - * - * @serialData Emit the capacity of the bag (int), - * followed by the number of unique elements in the bag (int), - * followed by all of the bag's elements (each an Object) and - * their counts (each an int), in no particular order. - */ - private void writeObject(java.io.ObjectOutputStream s) - throws java.io.IOException { - // write out the threshold, load factor, and any hidden stuff - s.defaultWriteObject(); - - // write out number of buckets - s.writeInt(this.table.length); - - // write out number of unique elements - s.writeInt(this.uniqueCount); - - // write out elements and counts (alternating) - if (this.uniqueCount > 0) { - for (Entry entry : this.table) { - while (entry != null) { - s.writeObject(entry.object); - s.writeInt(entry.count); - entry = entry.next; - } - } - } - } - - private static final long serialVersionUID = 1L; - - /** - * Reconstitute the bag from a stream (i.e. deserialize it). - */ - private void readObject(java.io.ObjectInputStream s) - throws java.io.IOException, ClassNotFoundException { - // read in the threshold, loadfactor, and any hidden stuff - s.defaultReadObject(); - - // read in number of buckets and allocate the bucket array - this.table = this.buildTable(s.readInt()); - - // read in number of unique elements - int unique = s.readInt(); - - // read the elements and counts, and put the elements in the bag - for (int i = 0; i < unique; i++) { - @SuppressWarnings("unchecked") - E element = (E) s.readObject(); - int elementCount = s.readInt(); - this.add_(element, elementCount); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/IntReference.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/IntReference.java deleted file mode 100644 index ad989b4fda..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/IntReference.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -/** - * Interface for a container for passing an integer that can be changed by - * the recipient. - */ -public interface IntReference - extends ReadOnlyIntReference -{ - /** - * Set the int value. - * Return the previous value. - */ - int setValue(int value); - - /** - * Set the int value to zero. - * Return the previous value. - */ - int setZero(); - - /** - * Increment and return the int value. - */ - int increment(); - - /** - * Decrement and return the int value. - */ - int decrement(); -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/JDBCTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/JDBCTools.java deleted file mode 100644 index 1663a8e493..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/JDBCTools.java +++ /dev/null @@ -1,349 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.sql.Types; -import java.util.HashMap; -import org.eclipse.jpt.common.utility.JavaType; - -/** - * Helper methods for dealing with the JDBC API. - */ -public final class JDBCTools { - - - /** - * Return the JDBC type corresponding to the specified class. - * @see java.sql.Types - */ - public static JDBCType jdbcTypeForClassNamed(String className) { - JavaToJDBCTypeMapping mapping = javaToJDBCTypeMapping(className); - return (mapping == null) ? DEFAULT_JDBC_TYPE : mapping.getJDBCType(); - } - - /** - * Return the JDBC type corresponding to the specified class. - * @see java.sql.Types - */ - public static JDBCType jdbcTypeFor(Class javaClass) { - return jdbcTypeForClassNamed(javaClass.getName()); - } - - /** - * Return the JDBC type corresponding to the specified class. - * @see java.sql.Types - */ - public static JDBCType jdbcTypeFor(JavaType javaType) { - return jdbcTypeForClassNamed(javaType.getJavaClassName()); - } - - /** - * Return the Java type corresponding to the specified JDBC type. - * @see java.sql.Types - */ - public static JavaType javaTypeForJDBCTypeNamed(String jdbcTypeName) { - JDBCToJavaTypeMapping mapping = jdbcToJavaTypeMapping(jdbcTypeName); - return (mapping == null) ? DEFAULT_JAVA_TYPE : mapping.getJavaType(); - } - - /** - * Return the Java type corresponding to the specified JDBC type. - * @see java.sql.Types - */ - public static JavaType javaTypeFor(JDBCType jdbcType) { - return javaTypeForJDBCTypeNamed(jdbcType.name()); - } - - /** - * Return the Java type corresponding to the specified JDBC type. - * @see java.sql.Types - */ - public static JavaType javaTypeForJDBCTypeCode(int jdbcTypeCode) { - return javaTypeFor(JDBCType.type(jdbcTypeCode)); - } - - - // ********** internal stuff ********** - - - // ********** JDBC => Java ********** - - /** - * JDBC => Java type mappings, keyed by JDBC type name (e.g. "VARCHAR") - */ - private static HashMap JDBC_TO_JAVA_TYPE_MAPPINGS; // pseudo 'final' - lazy-initialized - private static final JavaType DEFAULT_JAVA_TYPE = new SimpleJavaType(java.lang.Object.class); // TODO Object is the default? - - - private static JDBCToJavaTypeMapping jdbcToJavaTypeMapping(String jdbcTypeName) { - return jdbcToJavaTypeMappings().get(jdbcTypeName); - } - - private static synchronized HashMap jdbcToJavaTypeMappings() { - if (JDBC_TO_JAVA_TYPE_MAPPINGS == null) { - JDBC_TO_JAVA_TYPE_MAPPINGS = buildJDBCToJavaTypeMappings(); - } - return JDBC_TO_JAVA_TYPE_MAPPINGS; - } - - private static HashMap buildJDBCToJavaTypeMappings() { - HashMap mappings = new HashMap(); - addJDBCToJavaTypeMappingsTo(mappings); - return mappings; - } - - /** - * hard code the default mappings from the JDBC types to the - * appropriate Java types - * @see java.sql.Types - * see "JDBC 3.0 Specification" Appendix B - */ - private static void addJDBCToJavaTypeMappingsTo(HashMap mappings) { - addJDBCToJavaTypeMappingTo(Types.ARRAY, java.sql.Array.class, mappings); - addJDBCToJavaTypeMappingTo(Types.BIGINT, long.class, mappings); - addJDBCToJavaTypeMappingTo(Types.BINARY, byte[].class, mappings); - addJDBCToJavaTypeMappingTo(Types.BIT, boolean.class, mappings); - addJDBCToJavaTypeMappingTo(Types.BLOB, java.sql.Blob.class, mappings); - addJDBCToJavaTypeMappingTo(Types.BOOLEAN, boolean.class, mappings); - addJDBCToJavaTypeMappingTo(Types.CHAR, java.lang.String.class, mappings); - addJDBCToJavaTypeMappingTo(Types.CLOB, java.sql.Clob.class, mappings); - addJDBCToJavaTypeMappingTo(Types.DATALINK, java.net.URL.class, mappings); - addJDBCToJavaTypeMappingTo(Types.DATE, java.sql.Date.class, mappings); - addJDBCToJavaTypeMappingTo(Types.DECIMAL, java.math.BigDecimal.class, mappings); - addJDBCToJavaTypeMappingTo(Types.DISTINCT, java.lang.Object.class, mappings); // ??? - addJDBCToJavaTypeMappingTo(Types.DOUBLE, double.class, mappings); - addJDBCToJavaTypeMappingTo(Types.FLOAT, double.class, mappings); - addJDBCToJavaTypeMappingTo(Types.INTEGER, int.class, mappings); - addJDBCToJavaTypeMappingTo(Types.JAVA_OBJECT, java.lang.Object.class, mappings); // ??? - addJDBCToJavaTypeMappingTo(Types.LONGVARBINARY, byte[].class, mappings); - addJDBCToJavaTypeMappingTo(Types.LONGVARCHAR, java.lang.String.class, mappings); - // not sure why this is defined in java.sql.Types -// addJDBCToJavaTypeMappingTo(Types.NULL, java.lang.Object.class, mappings); - addJDBCToJavaTypeMappingTo(Types.NUMERIC, java.math.BigDecimal.class, mappings); - addJDBCToJavaTypeMappingTo(Types.OTHER, java.lang.Object.class, mappings); // ??? - addJDBCToJavaTypeMappingTo(Types.REAL, float.class, mappings); - addJDBCToJavaTypeMappingTo(Types.REF, java.sql.Ref.class, mappings); - addJDBCToJavaTypeMappingTo(Types.SMALLINT, short.class, mappings); - addJDBCToJavaTypeMappingTo(Types.STRUCT, java.sql.Struct.class, mappings); - addJDBCToJavaTypeMappingTo(Types.TIME, java.sql.Time.class, mappings); - addJDBCToJavaTypeMappingTo(Types.TIMESTAMP, java.sql.Timestamp.class, mappings); - addJDBCToJavaTypeMappingTo(Types.TINYINT, byte.class, mappings); - addJDBCToJavaTypeMappingTo(Types.VARBINARY, byte[].class, mappings); - addJDBCToJavaTypeMappingTo(Types.VARCHAR, java.lang.String.class, mappings); - } - - private static void addJDBCToJavaTypeMappingTo(int jdbcTypeCode, Class javaClass, HashMap mappings) { - // check for duplicates - JDBCType jdbcType = JDBCType.type(jdbcTypeCode); - Object prev = mappings.put(jdbcType.name(), buildJDBCToJavaTypeMapping(jdbcType, javaClass)); - if (prev != null) { - throw new IllegalArgumentException("duplicate JDBC type: " + jdbcType.name()); //$NON-NLS-1$ - } - } - - private static JDBCToJavaTypeMapping buildJDBCToJavaTypeMapping(JDBCType jdbcType, Class javaClass) { - return new JDBCToJavaTypeMapping(jdbcType, new SimpleJavaType(javaClass)); - } - - - // ********** Java => JDBC ********** - - /** - * Java => JDBC type mappings, keyed by Java class name (e.g. "java.lang.Object") - */ - private static HashMap JAVA_TO_JDBC_TYPE_MAPPINGS; // pseudo 'final' - lazy-initialized - private static final JDBCType DEFAULT_JDBC_TYPE = JDBCType.type(Types.VARCHAR); // TODO VARCHAR is the default? - - - private static JavaToJDBCTypeMapping javaToJDBCTypeMapping(String className) { - return javaToJDBCTypeMappings().get(className); - } - - private static synchronized HashMap javaToJDBCTypeMappings() { - if (JAVA_TO_JDBC_TYPE_MAPPINGS == null) { - JAVA_TO_JDBC_TYPE_MAPPINGS = buildJavaToJDBCTypeMappings(); - } - return JAVA_TO_JDBC_TYPE_MAPPINGS; - } - - private static HashMap buildJavaToJDBCTypeMappings() { - HashMap mappings = new HashMap(); - addJavaToJDBCTypeMappingsTo(mappings); - return mappings; - } - - /** - * hard code the default mappings from the Java types to the - * appropriate JDBC types - * @see java.sql.Types - * see "JDBC 3.0 Specification" Appendix B - */ - private static void addJavaToJDBCTypeMappingsTo(HashMap mappings) { - // primitives - addJavaToJDBCTypeMappingTo(boolean.class, Types.BIT, mappings); - addJavaToJDBCTypeMappingTo(byte.class, Types.TINYINT, mappings); - addJavaToJDBCTypeMappingTo(double.class, Types.DOUBLE, mappings); - addJavaToJDBCTypeMappingTo(float.class, Types.REAL, mappings); - addJavaToJDBCTypeMappingTo(int.class, Types.INTEGER, mappings); - addJavaToJDBCTypeMappingTo(long.class, Types.BIGINT, mappings); - addJavaToJDBCTypeMappingTo(short.class, Types.SMALLINT, mappings); - - // reference classes - addJavaToJDBCTypeMappingTo(java.lang.Boolean.class, Types.BIT, mappings); - addJavaToJDBCTypeMappingTo(java.lang.Byte.class, Types.TINYINT, mappings); - addJavaToJDBCTypeMappingTo(java.lang.Double.class, Types.DOUBLE, mappings); - addJavaToJDBCTypeMappingTo(java.lang.Float.class, Types.REAL, mappings); - addJavaToJDBCTypeMappingTo(java.lang.Integer.class, Types.INTEGER, mappings); - addJavaToJDBCTypeMappingTo(java.lang.Long.class, Types.BIGINT, mappings); - addJavaToJDBCTypeMappingTo(java.lang.Short.class, Types.SMALLINT, mappings); - addJavaToJDBCTypeMappingTo(java.lang.String.class, Types.VARCHAR, mappings); - addJavaToJDBCTypeMappingTo(java.math.BigDecimal.class, Types.NUMERIC, mappings); - addJavaToJDBCTypeMappingTo(java.net.URL.class, Types.DATALINK, mappings); - addJavaToJDBCTypeMappingTo(java.sql.Array.class, Types.ARRAY, mappings); - addJavaToJDBCTypeMappingTo(java.sql.Blob.class, Types.BLOB, mappings); - addJavaToJDBCTypeMappingTo(java.sql.Clob.class, Types.CLOB, mappings); - addJavaToJDBCTypeMappingTo(java.sql.Date.class, Types.DATE, mappings); - addJavaToJDBCTypeMappingTo(java.sql.Ref.class, Types.REF, mappings); - addJavaToJDBCTypeMappingTo(java.sql.Struct.class, Types.STRUCT, mappings); - addJavaToJDBCTypeMappingTo(java.sql.Time.class, Types.TIME, mappings); - addJavaToJDBCTypeMappingTo(java.sql.Timestamp.class, Types.TIMESTAMP, mappings); - - // arrays - addJavaToJDBCTypeMappingTo(byte[].class, Types.VARBINARY, mappings); - addJavaToJDBCTypeMappingTo(java.lang.Byte[].class, Types.VARBINARY, mappings); - } - - private static void addJavaToJDBCTypeMappingTo(Class javaClass, int jdbcTypeCode, HashMap mappings) { - // check for duplicates - Object prev = mappings.put(javaClass.getName(), buildJavaToJDBCTypeMapping(javaClass, jdbcTypeCode)); - if (prev != null) { - throw new IllegalArgumentException("duplicate Java class: " + ((JavaToJDBCTypeMapping) prev).getJavaType().declaration()); //$NON-NLS-1$ - } - } - - private static JavaToJDBCTypeMapping buildJavaToJDBCTypeMapping(Class javaClass, int jdbcTypeCode) { - return new JavaToJDBCTypeMapping(new SimpleJavaType(javaClass), JDBCType.type(jdbcTypeCode)); - } - - - // ********** constructor ********** - - /** - * Suppress default constructor, ensuring non-instantiability. - */ - private JDBCTools() { - super(); - throw new UnsupportedOperationException(); - } - - - // ********** member classes ********** - - /** - * JDBC => Java - */ - static class JDBCToJavaTypeMapping { - private final JDBCType jdbcType; - private final JavaType javaType; - - JDBCToJavaTypeMapping(JDBCType jdbcType, JavaType javaType) { - super(); - this.jdbcType = jdbcType; - this.javaType = javaType; - } - - public JDBCType getJDBCType() { - return this.jdbcType; - } - - public JavaType getJavaType() { - return this.javaType; - } - - public boolean maps(int jdbcTypeCode) { - return this.jdbcType.code() == jdbcTypeCode; - } - - public boolean maps(String jdbcTypeName) { - return this.jdbcType.name().equals(jdbcTypeName); - } - - public boolean maps(JDBCType type) { - return this.jdbcType == type; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - this.appendTo(sb); - return sb.toString(); - } - - public void appendTo(StringBuilder sb) { - this.jdbcType.appendTo(sb); - sb.append(" => "); //$NON-NLS-1$ - this.javaType.appendDeclarationTo(sb); - } - - } - - /** - * Java => JDBC - */ - static class JavaToJDBCTypeMapping { - private final JavaType javaType; - private final JDBCType jdbcType; - - JavaToJDBCTypeMapping(JavaType javaType, JDBCType jdbcType) { - super(); - this.javaType = javaType; - this.jdbcType = jdbcType; - } - - public JavaType getJavaType() { - return this.javaType; - } - - public JDBCType getJDBCType() { - return this.jdbcType; - } - - public boolean maps(JavaType jt) { - return this.javaType.equals(jt); - } - - public boolean maps(String elementTypeName, int arrayDepth) { - return this.javaType.equals(elementTypeName, arrayDepth); - } - - public boolean maps(String javaClassName) { - return this.javaType.describes(javaClassName); - } - - public boolean maps(Class javaClass) { - return this.javaType.describes(javaClass); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - this.appendTo(sb); - return sb.toString(); - } - - public void appendTo(StringBuilder sb) { - this.javaType.appendDeclarationTo(sb); - sb.append(" => "); //$NON-NLS-1$ - this.jdbcType.appendTo(sb); - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/JDBCType.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/JDBCType.java deleted file mode 100644 index 96fd283a7d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/JDBCType.java +++ /dev/null @@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import java.lang.reflect.Field; -import java.sql.Types; - -/** - * Associate the Java constant and the JDBC type name. - * These are derived from java.sql.Types. - * - * @see java.sql.Types - */ -public final class JDBCType - implements Cloneable, Serializable -{ - - /** - * the constant name (e.g. VARCHAR) - */ - private final String name; - - /** - * the JDBC code used by JDBC drivers - */ - private final int code; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a JDBC type with the specified name and type code. - * This is private because all the possible JDBC types are built and - * stored in the static array TYPES. - * @see #types() - */ - private JDBCType(String name, int code) { - super(); - this.name = name; - this.code = code; - } - - - // ********** accessors ********** - - /** - * Return the name of the type, as defined in java.sql.Types. - */ - public String name() { - return this.name; - } - - - /** - * Return the type code, as defined in java.sql.Types. - */ - public int code() { - return this.code; - } - - - // ********** printing and displaying ********** - - public void appendTo(StringBuilder sb) { - sb.append(this.name); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(this.getClass().getSimpleName()); - sb.append('('); - this.appendTo(sb); - sb.append(')'); - return sb.toString(); - } - - @Override - public JDBCType clone() { - try { - return (JDBCType) super.clone(); - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - - // ********** static stuff ********** - - /** - * all the JDBC type defined in java.sql.Types - */ - private static JDBCType[] TYPES; // pseudo 'final' - lazy-initialized - - - public synchronized static JDBCType[] types() { - if (TYPES == null) { - TYPES = buildTypes(); - } - return TYPES; - } - - /** - * Return the JDBC type for the specified type code (e.g. Types.VARCHAR). - * @see java.sql.Types - */ - public static JDBCType type(int code) { - JDBCType[] types = types(); - for (int i = types.length; i-- > 0; ) { - if (types[i].code() == code) { - return types[i]; - } - } - throw new IllegalArgumentException("invalid JDBC type code: " + code); //$NON-NLS-1$ - } - - /** - * Return the JDBC type for the specified type name (e.g. "VARCHAR"). - * @see java.sql.Types - */ - public static JDBCType type(String name) { - JDBCType[] types = types(); - for (int i = types.length; i-- > 0; ) { - if (types[i].name().equals(name)) { - return types[i]; - } - } - throw new IllegalArgumentException("invalid JDBC type name: " + name); //$NON-NLS-1$ - } - - /** - * build up the JDBC types via reflection - * @see java.sql.Types - */ - private static JDBCType[] buildTypes() { - Field[] fields = Types.class.getDeclaredFields(); - int len = fields.length; - JDBCType[] types = new JDBCType[len]; - for (int i = len; i-- > 0; ) { - String name = fields[i].getName(); - int code; - try { - code = ((Integer) fields[i].get(null)).intValue(); - } catch (IllegalAccessException ex) { - throw new RuntimeException(ex); // shouldn't happen... - } - types[i] = new JDBCType(name, code); - } - return types; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/KeyedSet.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/KeyedSet.java deleted file mode 100644 index cf471f4bb8..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/KeyedSet.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; - -/** - * This class maintains a {@link Set} of items, and a {@link Map} of keys to those items. - * An item may have multiple keys, but an item may have no keys and remain in the set. Once an - * item's last key is removed, the item is also removed. - */ -public class KeyedSet { - - private final Set itemSet; - private final Set unmodifiableItemSet; - private final Map map; - - - public KeyedSet() { - this.itemSet = new HashSet(); - this.unmodifiableItemSet = Collections.unmodifiableSet(this.itemSet); - this.map = new HashMap(); - } - - /** - * Return an unmodifiable representation of the set of items. - */ - public Set getItemSet() { - return this.unmodifiableItemSet; - } - - /** - * Return the item stored under the given key. - */ - public V getItem(K key) { - return this.map.get(key); - } - - /** - * Return whether an item is stored under the given key. - */ - public boolean containsKey(K key) { - return this.map.containsKey(key); - } - - /** - * Return whether the item is stored under *any* key. - */ - public boolean containsItem(V item) { - return this.itemSet.contains(item); - } - - /** - * Add an item to be stored under the given key. - * The item must not already be stored. - */ - public void addItem(K key, V item) { - addItem(item); - addKey(key, item); - } - - private void addItem(V item) { - if (item == null) { - throw new IllegalArgumentException(); - } - this.itemSet.add(item); - } - - /** - * Add an additional key to an item already stored under an alternate key. - */ - public void addKey(K key, V item) { - if (key == null || item == null) { - throw new IllegalArgumentException(); - } - if (! this.itemSet.contains(item)) { - throw new IllegalArgumentException(); - } - this.map.put(key, item); - } - - /** - * Remove the given item and remove any key-to-item mapping it may have. - */ - public boolean removeItem(V item) { - if (this.itemSet.remove(item)) { - for (Map.Entry entry : CollectionTools.collection(this.map.entrySet())) { - if (entry.getValue() == item) { - map.remove(entry.getKey()); - } - } - return true; - } - return false; - } - - /** - * Remove the key-to-item mapping for the given key. - * If it is the last key to the item, also remove the item. - */ - public boolean removeKey(K key) { - final V item = this.map.get(key); - if (item != null) { - this.map.remove(key); - boolean otherKey = false; - for (Map.Entry entry : CollectionTools.collection(this.map.entrySet())) { - if (otherKey | entry.getValue() == item) { - otherKey = true; - } - } - if (! otherKey) { - removeItem(item); - } - return true; - } - return false; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/LazyReadOnlyObjectReference.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/LazyReadOnlyObjectReference.java deleted file mode 100644 index 84d01e34c3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/LazyReadOnlyObjectReference.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import org.eclipse.jpt.common.utility.ReadOnlyObjectReference; - -/** - * Provide a thread-safe, reasonably performing container for holding an - * object that will be "lazy-initialized" upon its first reference. This is - * also useful for preventing direct references (accidental or otherwise) to - * lazy-initialized state. - *

- * There are some penalties:

    - *
  • The reference's use of generics will require casting (and the requisite - * VM testing) with every access - *
  • If the value calculated during lazy initialization is null, - * access will be synchronized every time. - *
- * @see SimpleObjectReference - * @see SynchronizedObject - */ -public abstract class LazyReadOnlyObjectReference - implements ReadOnlyObjectReference, Cloneable, Serializable -{ - /** Backing value. */ - private volatile V value = null; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Create a lazy object reference. - */ - public LazyReadOnlyObjectReference() { - super(); - } - - - // ********** value ********** - - /** - * In JDK 5 and later, this "double-checked locking" idiom works as long - * as the instance variable is marked volatile. - */ - public V getValue() { - V result = this.value; - if (result == null) { - synchronized (this) { - result = this.value; - if (result == null) { - this.value = result = this.buildValue(); - } - } - } - return result; - } - - protected abstract V buildValue(); - - public boolean valueEquals(Object object) { - return Tools.valuesAreEqual(this.getValue(), object); - } - - public boolean valueNotEqual(Object object) { - return Tools.valuesAreDifferent(this.getValue(), object); - } - - public boolean isNull() { - return this.getValue() == null; - } - - public boolean isNotNull() { - return this.getValue() != null; - } - - - // ********** standard methods ********** - - @Override - public LazyReadOnlyObjectReference clone() { - try { - @SuppressWarnings("unchecked") - LazyReadOnlyObjectReference clone = (LazyReadOnlyObjectReference) super.clone(); - return clone; - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - /** - * This method will not trigger the "lazy-initialization". - */ - @Override - public String toString() { - return '[' + String.valueOf(this.value) + ']'; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ListenerList.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ListenerList.java deleted file mode 100644 index 632b3fd5df..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ListenerList.java +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.lang.reflect.Array; -import java.util.Arrays; -import java.util.EventListener; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; - -/** - * Maintain a thread-safe list of listeners that does not allow adding - * duplicate listeners or removing non-listeners. - */ -public class ListenerList - implements Serializable -{ - /** - * We can mark this volatile and not synchronize the read methods because - * we never change the contents of the array. - */ - private transient volatile L[] listeners; - - private static final long serialVersionUID = 1L; - - - /** - * Construct a listener list for listeners of the specified type. - */ - public ListenerList(Class listenerClass) { - super(); - this.listeners = this.buildListenerArray(listenerClass, 0); - } - - /** - * Construct a listener list for listeners of the specified type. - * Add the specified listener to the list. - */ - public ListenerList(Class listenerClass, L listener) { - super(); - if (listener == null) { - throw new NullPointerException(); - } - this.listeners = this.buildListenerArray(listenerClass, 1); - this.listeners[0] = listener; - } - - @SuppressWarnings("unchecked") - private L[] buildListenerArray(Class listenerClass, int length) { - return (L[]) Array.newInstance(listenerClass, length); - } - - /** - * Return the listeners. - */ - public Iterable getListeners() { - return new ArrayIterable(this.listeners); - } - - /** - * Return the number of listeners. - */ - public int size() { - return this.listeners.length; - } - - /** - * Return whether the listener list has no listeners. - */ - public boolean isEmpty() { - return this.listeners.length == 0; - } - - /** - * Add the specified listener to the listener list. - * Duplicate listeners are not allowed. - */ - public synchronized void add(L listener) { - if (listener == null) { - throw new NullPointerException(); - } - if (ArrayTools.contains(this.listeners, listener)) { - throw new IllegalArgumentException("duplicate listener: " + listener); //$NON-NLS-1$ - } - this.listeners = ArrayTools.add(this.listeners, listener); - } - - /** - * Remove the specified listener from the listener list. - * Removing a listener that is not on the list is not allowed. - */ - public synchronized void remove(L listener) { - if (listener == null) { - throw new NullPointerException(); - } - int index = ArrayTools.indexOf(this.listeners, listener); - if (index == -1) { - throw new IllegalArgumentException("unregistered listener: " + listener); //$NON-NLS-1$ - } - this.listeners = ArrayTools.removeElementAtIndex(this.listeners, index); - } - - /** - * Clear the listener list. - */ - public synchronized void clear() { - this.listeners = ArrayTools.clear(this.listeners); - } - - /** - * Return the type of listeners held by the listener list. - */ - @SuppressWarnings("unchecked") - public Class getListenerType() { - return (Class) this.listeners.getClass().getComponentType(); - } - - @Override - public String toString() { - return Arrays.toString(this.listeners); - } - - - // ********** serialization ********** - - /** - * Silently drop any non-serializable listeners. - */ - private synchronized void writeObject(ObjectOutputStream s) throws IOException { - // write out any hidden stuff - s.defaultWriteObject(); - - @SuppressWarnings("unchecked") - Class listenerClass = (Class) this.listeners.getClass().getComponentType(); - s.writeObject(listenerClass); - - // only write out serializable listeners - for (L listener : this.listeners) { - if (listener instanceof Serializable) { - s.writeObject(listener); - } - } - - s.writeObject(null); - } - - @SuppressWarnings("unchecked") - private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException { - // read in any hidden stuff - s.defaultReadObject(); - - Class listenerClass = (Class) s.readObject(); - this.listeners = this.buildListenerArray(listenerClass, 0); - Object o; - while ((o = s.readObject()) != null) { - this.listeners = ArrayTools.add(this.listeners, (L) o); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NameTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NameTools.java deleted file mode 100644 index dd7d65f0bf..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NameTools.java +++ /dev/null @@ -1,376 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.beans.Introspector; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.Iterator; -import java.util.SortedSet; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; - -/** - * Various helper methods for generating names. - */ -public final class NameTools { - - /** - * Given a "root" name and a set of existing names, generate a unique - * name that is either the "root" name or some variation on the "root" - * name (e.g. "root2", "root3",...). The names are case-sensitive - * (i.e. "Root" and "root" are both allowed). - */ - public static String uniqueNameFor(String rootName, Iterator existingNames) { - return uniqueNameFor(rootName, CollectionTools.set(existingNames)); - } - - /** - * Given a "root" name and a set of existing names, generate a unique - * name that is either the "root" name or some variation on the "root" - * name (e.g. "root2", "root3",...). The names are case-sensitive - * (i.e. "Root" and "root" are both allowed). - */ - public static String uniqueNameFor(String rootName, Collection existingNames) { - return uniqueNameFor(rootName, existingNames, rootName); - } - - /** - * Given a "root" name and a set of existing names, generate a unique - * name that is either the "root" name or some variation on the "root" - * name (e.g. "root2", "root3",...). The names are NOT case-sensitive - * (i.e. "Root" and "root" are NOT both allowed). - */ - public static String uniqueNameForIgnoreCase(String rootName, Iterator existingNames) { - return uniqueNameForIgnoreCase(rootName, CollectionTools.set(existingNames)); - } - - /** - * Given a "root" name and a set of existing names, generate a unique - * name that is either the "root" name or some variation on the "root" - * name (e.g. "root2", "root3",...). The names are NOT case-sensitive - * (i.e. "Root" and "root" are NOT both allowed). - */ - public static String uniqueNameForIgnoreCase(String rootName, Collection existingNames) { - return uniqueNameFor(rootName, convertToLowerCase(existingNames), rootName.toLowerCase()); - } - - /** - * use the suffixed "template" name to perform the comparisons, but RETURN - * the suffixed "root" name; this allows case-insensitive comparisons - * (i.e. the "template" name has been morphed to the same case as - * the "existing" names, while the "root" name has not, but the "root" name - * is what the client wants morphed to be unique) - */ - private static String uniqueNameFor(String rootName, Collection existingNames, String templateName) { - if ( ! existingNames.contains(templateName)) { - return rootName; - } - String uniqueName = templateName; - for (int suffix = 2; true; suffix++) { - if ( ! existingNames.contains(uniqueName + suffix)) { - return rootName.concat(String.valueOf(suffix)); - } - } - } - - /** - * Convert the specified collection of strings to a collection of the same - * strings converted to lower case. - */ - private static HashSet convertToLowerCase(Collection strings) { - HashSet result = new HashSet(strings.size()); - for (String string : strings) { - result.add(string.toLowerCase()); - } - return result; - } - - /** - * Build a fully-qualified name for the specified database object. - * Variations: - * catalog.schema.name - * catalog..name - * schema.name - * name - */ - public static String buildQualifiedDatabaseObjectName(String catalog, String schema, String name) { - if (name == null) { - return null; - } - if ((catalog == null) && (schema == null)) { - return name; - } - - StringBuilder sb = new StringBuilder(100); - if (catalog != null) { - sb.append(catalog); - sb.append('.'); - } - if (schema != null) { - sb.append(schema); - } - sb.append('.'); - sb.append(name); - return sb.toString(); - } - - /** - * The set of reserved words in the Java programming language. - * These words cannot be used as identifiers (i.e. names). - * http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html - */ - @SuppressWarnings("nls") - public static final String[] JAVA_RESERVED_WORDS = new String[] { - "abstract", - "assert", // jdk 1.4 - "boolean", - "break", - "byte", - "case", - "catch", - "char", - "class", - "const", // unused - "continue", - "default", - "do", - "double", - "else", - "enum", // jdk 1.5 - "extends", - "false", - "final", - "finally", - "float", - "for", - "goto", // unused - "if", - "implements", - "import", - "instanceof", - "int", - "interface", - "long", - "native", - "new", - "null", - "package", - "private", - "protected", - "public", - "return", - "short", - "static", - "strictfp", // jdk 1.2 - "super", - "switch", - "synchronized", - "this", - "throw", - "throws", - "transient", - "true", - "try", - "void", - "volatile", - "while" - }; - - /** - * The set of reserved words in the Java programming language. - * These words cannot be used as identifiers (i.e. names). - * http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html - */ - public static final SortedSet JAVA_RESERVED_WORDS_SET = - Collections.unmodifiableSortedSet(CollectionTools.sortedSet(JAVA_RESERVED_WORDS)); - - /** - * Return the set of Java programming language reserved words. - * These words cannot be used as identifiers (i.e. names). - * http://java.sun.com/docs/books/tutorial/java/nutsandbolts/_keywords.html - */ - public static Iterator javaReservedWords() { - return new ArrayIterator(JAVA_RESERVED_WORDS); - } - - /** - * Return whether the specified string consists of Java identifier - * characters (but may be a reserved word). - */ - public static boolean stringConsistsOfJavaIdentifierCharacters(String string) { - if (string.length() == 0) { - return false; - } - return stringConsistsOfJavaIdentifierCharacters_(string.toCharArray()); - } - - /** - * Return whether the specified string consists of Java identifier - * characters (but may be a reserved word). - */ - public static boolean stringConsistsOfJavaIdentifierCharacters(char[] string) { - if (string.length == 0) { - return false; - } - return stringConsistsOfJavaIdentifierCharacters_(string); - } - - /** - * The specified string must not be empty. - */ - private static boolean stringConsistsOfJavaIdentifierCharacters_(char[] string) { - if ( ! Character.isJavaIdentifierStart(string[0])) { - return false; - } - for (int i = string.length; i-- > 1; ) { // NB: end with 1 - if ( ! Character.isJavaIdentifierPart(string[i])) { - return false; - } - } - return true; - } - - /** - * Return whether the specified string is a valid Java identifier. - */ - public static boolean stringIsLegalJavaIdentifier(String string) { - return stringConsistsOfJavaIdentifierCharacters(string) - && ! JAVA_RESERVED_WORDS_SET.contains(string); - } - - /** - * Return whether the specified string is a valid Java identifier. - */ - public static boolean stringIsLegalJavaIdentifier(char[] string) { - return stringConsistsOfJavaIdentifierCharacters(string) - && ! JAVA_RESERVED_WORDS_SET.contains(new String(string)); - } - - /** - * Convert the specified string to a valid Java identifier - * by substituting an underscore '_' for any invalid characters - * in the string and appending an underscore '_' to the string if - * it is a Java reserved word. - */ - public static String convertToJavaIdentifier(String string) { - return convertToJavaIdentifier(string, '_'); - } - - /** - * Convert the specified string to a valid Java identifier - * by substituting the specified character for any invalid characters - * in the string and, if necessary, appending the specified character - * to the string until it is not a Java reserved word. - */ - public static String convertToJavaIdentifier(String string, char c) { - if (string.length() == 0) { - return string; - } - if (JAVA_RESERVED_WORDS_SET.contains(string)) { - // a reserved word is a valid identifier, we just need to tweak it a bit - checkCharIsJavaIdentifierPart(c); - return convertToJavaIdentifier(string + c, c); - } - char[] array = string.toCharArray(); - return convertToJavaIdentifier_(array, c) ? new String(array) : string; - } - - /** - * Convert the specified string to a valid Java identifier - * by substituting an underscore '_' for any invalid characters - * in the string and appending an underscore '_' to the string if - * it is a Java reserved word. - */ - public static char[] convertToJavaIdentifier(char[] string) { - return convertToJavaIdentifier(string, '_'); - } - - /** - * Convert the specified string to a valid Java identifier - * by substituting the specified character for any invalid characters - * in the string and, if necessary, appending the specified character - * to the string until it is not a Java reserved word. - */ - public static char[] convertToJavaIdentifier(char[] string, char c) { - if (string.length == 0) { - return string; - } - if (JAVA_RESERVED_WORDS_SET.contains(new String(string))) { - // a reserved word is a valid identifier, we just need to tweak it a bit - checkCharIsJavaIdentifierPart(c); - return convertToJavaIdentifier(ArrayTools.add(string, c), c); - } - convertToJavaIdentifier_(string, c); - return string; - } - - /** - * The specified string must not be empty. - * Return whether the string was modified. - */ - private static boolean convertToJavaIdentifier_(char[] string, char c) { - boolean mod = false; - if ( ! Character.isJavaIdentifierStart(string[0])) { - checkCharIsJavaIdentifierStart(c); - string[0] = c; - mod = true; - } - checkCharIsJavaIdentifierPart(c); - for (int i = string.length; i-- > 1; ) { // NB: end with 1 - if ( ! Character.isJavaIdentifierPart(string[i])) { - string[i] = c; - mod = true; - } - } - return mod; - } - - private static void checkCharIsJavaIdentifierStart(char c) { - if ( ! Character.isJavaIdentifierStart(c)) { - throw new IllegalArgumentException("invalid Java identifier start char: '" + c + '\''); //$NON-NLS-1$ - } - } - - private static void checkCharIsJavaIdentifierPart(char c) { - if ( ! Character.isJavaIdentifierPart(c)) { - throw new IllegalArgumentException("invalid Java identifier part char: '" + c + '\''); //$NON-NLS-1$ - } - } - - /** - * Convert the specified method name to a property name. - */ - public static String convertGetterSetterMethodNameToPropertyName(String methodName) { - int beginIndex = 0; - if (methodName.startsWith("get")) { //$NON-NLS-1$ - beginIndex = 3; - } else if (methodName.startsWith("set")) { //$NON-NLS-1$ - beginIndex = 3; - } else if (methodName.startsWith("is")) { //$NON-NLS-1$ - beginIndex = 2; - } else { - return methodName; // return method name unchanged? - } - return Introspector.decapitalize(methodName.substring(beginIndex)); - } - - - // ********** constructor ********** - - /** - * Suppress default constructor, ensuring non-instantiability. - */ - private NameTools() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NonNullBooleanTransformer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NonNullBooleanTransformer.java deleted file mode 100644 index 0c9749fcd3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NonNullBooleanTransformer.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -/** - * A NonNullBooleanTransformer will transform a possibly-null - * {@link Boolean} to a non-null {@link Boolean}:
    - *
  • When the original {@link Boolean} is not null, - * the transformer will return it unchanged. - *
  • When the original {@link Boolean} is null, - * the transformer will return its client-specified "null value" - * ({@link Boolean#TRUE} or {@link Boolean#FALSE}). - *
- */ -public final class NonNullBooleanTransformer - implements Transformer -{ - // not null - private final Boolean nullValue; - - /** - * A {@link Transformer} that will return the original {@link Boolean} when - * it is non-null; otherwise the {@link Transformer} will return - * {@link Boolean#TRUE}. - */ - public static final Transformer TRUE = new NonNullBooleanTransformer(Boolean.TRUE); - - /** - * A {@link Transformer} that will return the original {@link Boolean} when - * it is non-null; otherwise the {@link Transformer} will return - * {@link Boolean#FALSE}. - */ - public static final Transformer FALSE = new NonNullBooleanTransformer(Boolean.FALSE); - - /** - * Return a transformer that will return the specified value if the original - * value is null. Throw a {@link NullPointerException} if the - * specified value is null. - */ - public Transformer valueOf(Boolean b) { - return valueOf(b.booleanValue()); - } - - /** - * Return a transformer that will return the {@link Boolean} corresponding - * to the specified value if the original value is null. - */ - public Transformer valueOf(boolean b) { - return b ? TRUE : FALSE; - } - - /** - * Ensure only 2 constant versions. - */ - private NonNullBooleanTransformer(Boolean nullValue) { - super(); - if (nullValue == null) { - throw new NullPointerException(); - } - this.nullValue = nullValue; - } - - public Boolean transform(Boolean b) { - return (b != null) ? b : this.nullValue; - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.nullValue); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NotBooleanTransformer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NotBooleanTransformer.java deleted file mode 100644 index c234ac7f73..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NotBooleanTransformer.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -/** - * A NotBooleanTransformer will transform a - * {@link Boolean} to its NOT value:
    - *
  • If the original {@link Boolean} is {@link Boolean#TRUE}, - * the transformer will return {@link Boolean#FALSE}. - *
  • If the original {@link Boolean} is {@link Boolean#FALSE}, - * the transformer will return {@link Boolean#TRUE}. - *
  • If the original {@link Boolean} is null, - * the transformer will return null. - *
- */ -public class NotBooleanTransformer - implements BidiTransformer -{ - public static final BidiTransformer INSTANCE = new NotBooleanTransformer(); - - public static BidiTransformer instance() { - return INSTANCE; - } - - // ensure single instance - private NotBooleanTransformer() { - super(); - } - - public Boolean transform(Boolean b) { - return (b == null) ? null : BooleanTools.not(b); - } - - public Boolean reverseTransform(Boolean b) { - return (b == null) ? null : BooleanTools.not(b); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } - - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NotNullFilter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NotNullFilter.java deleted file mode 100644 index c1e27e45b9..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NotNullFilter.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; - -import org.eclipse.jpt.common.utility.Filter; - -/** - * This filter accepts only non-null objects. - */ -public final class NotNullFilter - implements Filter, Serializable -{ - @SuppressWarnings("rawtypes") - public static final Filter INSTANCE = new NotNullFilter(); - - @SuppressWarnings("unchecked") - public static Filter instance() { - return INSTANCE; - } - - // ensure single instance - private NotNullFilter() { - super(); - } - - // accept only non-null objects - public boolean accept(T o) { - return o != null; - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } - - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NullList.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NullList.java deleted file mode 100644 index 547a882c58..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/NullList.java +++ /dev/null @@ -1,153 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator; - -/** - * A "null" list is a bit different from an "empty" list: it allows clients to - * add/remove elements to/from it but never changes. This is useful - * for passing to methods that require a "collecting parameter" but the - * client will ignore the resulting "collection". - */ -public final class NullList - implements List, Serializable -{ - - // singleton - @SuppressWarnings("rawtypes") - private static final NullList INSTANCE = new NullList(); - - /** - * Return the singleton. - */ - @SuppressWarnings("unchecked") - public static List instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private NullList() { - super(); - } - - public boolean add(E o) { - return false; // the list did not change - } - - public void add(int index, E element) { - // ignore - } - - public boolean addAll(Collection c) { - return false; // the list did not change - } - - public boolean addAll(int index, Collection c) { - return false; // the list did not change - } - - public void clear() { - // ignore - } - - public boolean contains(Object o) { - return false; - } - - public boolean containsAll(Collection c) { - return c.isEmpty(); - } - - public E get(int index) { - throw new IndexOutOfBoundsException("Index: " + index + ", Size: 0"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public int indexOf(Object o) { - return -1; - } - - public boolean isEmpty() { - return true; - } - - public Iterator iterator() { - return EmptyIterator.instance(); - } - - public int lastIndexOf(Object o) { - return -1; - } - - public ListIterator listIterator() { - return EmptyListIterator.instance(); - } - - public ListIterator listIterator(int index) { - return EmptyListIterator.instance(); - } - - public boolean remove(Object o) { - return false; // the list did not change - } - - public E remove(int index) { - throw new IndexOutOfBoundsException("Index: " + index + ", Size: 0"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public boolean removeAll(Collection c) { - return false; // the list did not change - } - - public boolean retainAll(Collection c) { - return false; // the list did not change - } - - public E set(int index, E element) { - throw new IndexOutOfBoundsException("Index: " + index + ", Size: 0"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public int size() { - return 0; - } - - public List subList(int fromIndex, int toIndex) { - return this; - } - - private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; - public Object[] toArray() { - return EMPTY_OBJECT_ARRAY; - } - - public T[] toArray(T[] a) { - return a; - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Queue.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Queue.java deleted file mode 100644 index 9cc4bc5ce3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Queue.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import java.util.NoSuchElementException; - -/** - * Interface defining the classic queue behavior, - * without the backdoors allowed by {@link java.util.Queue}. - * - * @param the type of elements contained by the queue - */ -public interface Queue { - - /** - * "Enqueue" the specified item to the tail of the queue. - */ - void enqueue(E o); - - /** - * "Dequeue" an item from the head of the queue. - */ - E dequeue(); - - /** - * Return the item on the head of the queue - * without removing it from the queue. - */ - E peek(); - - /** - * Return whether the queue is empty. - */ - boolean isEmpty(); - - - final class Empty implements Queue, Serializable { - @SuppressWarnings("rawtypes") - public static final Queue INSTANCE = new Empty(); - @SuppressWarnings("unchecked") - public static Queue instance() { - return INSTANCE; - } - // ensure single instance - private Empty() { - super(); - } - public void enqueue(E o) { - throw new UnsupportedOperationException(); - } - public E dequeue() { - throw new NoSuchElementException(); - } - public E peek() { - throw new NoSuchElementException(); - } - public boolean isEmpty() { - return true; - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Range.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Range.java deleted file mode 100644 index bc66046c0a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Range.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; - -/** - * This simple container class simply puts a bit of semantics - * around a pair of numbers. - */ -public class Range - implements Cloneable, Serializable -{ - /** The starting index of the range. */ - public final int start; - - /** The ending index of the range. */ - public final int end; - - /** - * The size can be negative if the ending index - * is less than the starting index. - */ - public final int size; - - private static final long serialVersionUID = 1L; - - - /** - * Construct with the specified start and end, - * both of which are immutable. - */ - public Range(int start, int end) { - super(); - this.start = start; - this.end = end; - this.size = end - start + 1; - } - - /** - * Return whether the range includes the specified - * index. - */ - public boolean includes(int index) { - return (this.start <= index) && (index <= this.end); - } - - @Override - public boolean equals(Object o) { - if (this == o) { - return true; - } - if ( ! (o instanceof Range)) { - return false; - } - Range otherRange = (Range) o; - return (this.start == otherRange.start) - && (this.end == otherRange.end); - } - - @Override - public int hashCode() { - return this.start ^ this.end; - } - - @Override - public Range clone() { - try { - return (Range) super.clone(); - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - @Override - public String toString() { - return '[' + this.start + ", " + this.end + ']'; //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReadOnlyBooleanReference.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReadOnlyBooleanReference.java deleted file mode 100644 index 0d2c56a3bf..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReadOnlyBooleanReference.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -/** - * Interface for a container for holding a boolean that cannot be - * changed by clients. - */ -public interface ReadOnlyBooleanReference -{ - /** - * Return the current boolean value. - */ - boolean getValue(); - - /** - * Return whether the current boolean value is equal to the - * specified value. - */ - boolean is(boolean value); - - /** - * Return whether the current boolean value is not equal to - * the specified value. - */ - boolean isNot(boolean value); - - /** - * Return whether the current boolean value is - * true. - */ - boolean isTrue(); - - /** - * Return whether the current boolean value is - * false. - */ - boolean isFalse(); -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReadOnlyIntReference.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReadOnlyIntReference.java deleted file mode 100644 index 50e5154669..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReadOnlyIntReference.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -/** - * Interface for a container for holding an int that cannot be - * changed by clients. - */ -public interface ReadOnlyIntReference - extends Comparable -{ - /** - * Return the current int value. - */ - int getValue(); - - /** - * Return whether the current int value is equal to the - * specified value. - */ - boolean equals(int v); - - /** - * Return whether the current int value is not equal to - * the specified value. - */ - boolean notEqual(int v); - - /** - * Return whether the current int value is zero. - */ - boolean isZero(); - - /** - * Return whether the current int value is not zero. - */ - boolean isNotZero(); - - /** - * Return whether the current int value is greater than - * the specified value. - */ - boolean isGreaterThan(int v); - - /** - * Return whether the current int value is greater than - * or equal to the specified value. - */ - boolean isGreaterThanOrEqual(int v); - - /** - * Return whether the current int value is less than - * the specified value. - */ - boolean isLessThan(int v); - - /** - * Return whether the current int value is less than - * or equal to the specified value. - */ - boolean isLessThanOrEqual(int v); - - /** - * Return whether the current int value is positive. - */ - boolean isPositive(); - - /** - * Return whether the current int value is not positive - * (i.e. negative or zero). - */ - boolean isNotPositive(); - - /** - * Return whether the current int value is negative. - */ - boolean isNegative(); - - /** - * Return whether the current int value is not negative - * (i.e. zero or positive). - */ - boolean isNotNegative(); - - /** - * Return the absolute value of the current int value. - */ - int abs(); - - /** - * Return the negative value of the current int value. - */ - int neg(); - - /** - * Return the current int value plus the specified value. - */ - int add(int v); - - /** - * Return current int value minus the specified value. - */ - int subtract(int v); - - /** - * Return current int value multiplied by the specified value. - */ - int multiply(int v); - - /** - * Return current int value divided by the specified value. - */ - int divide(int v); - - /** - * Return the remainder of the current int value divided by - * the specified value. - */ - int remainder(int v); - - /** - * Return the minimum of the current int value and - * the specified value. - */ - int min(int v); - - /** - * Return the maximum of the current int value and - * the specified value. - */ - int max(int v); - - /** - * Return the current int value raised to the power - * of the specified value. - */ - double pow(int v); -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReflectionTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReflectionTools.java deleted file mode 100644 index 6fb33c7f8c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReflectionTools.java +++ /dev/null @@ -1,1544 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.ArrayList; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; - -/** - * Convenience methods related to the java.lang.reflect package. - * These methods provide shortcuts for manipulating objects via - * reflection; particularly when dealing with fields and/or methods that - * are not publicly accessible or are inherited. - *

- * In most cases, all exceptions are handled and wrapped in - * {@link java.lang.RuntimeException}s; so these methods should - * be used when there should be no problems using reflection (i.e. - * the referenced members are presumably present etc.). - *

- * There are also a number of methods whose names - * end with an underscore. These methods declare the expected checked - * exceptions (e.g. {@link NoSuchMethodException}, {@link NoSuchFieldException}). - * These methods can be used to probe - * for methods, fields, etc. that should be present but might not be. - */ -public final class ReflectionTools { - - public static final Class[] ZERO_PARAMETER_TYPES = new Class[0]; - public static final Object[] ZERO_ARGUMENTS = new Object[0]; - private static final String CR = StringTools.CR; - - public static final Class VOID_CLASS = void.class; - public static final Class VOID_WRAPPER_CLASS = java.lang.Void.class; - - - // ********** fields ********** - - /** - * Get a field value, given the containing object and field name. - * Return its result. - * Useful for accessing private, package, or protected fields. - *

- * Object.getFieldValue(String fieldName) - */ - public static Object getFieldValue(Object object, String fieldName) { - try { - return getFieldValue_(object, fieldName); - } catch (NoSuchFieldException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedFieldName(object, fieldName), ex); - } catch (IllegalAccessException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedFieldName(object, fieldName), ex); - } - } - - /** - * Get a field value, given the containing object and field name. - * Return its result. - * Useful for accessing private, package, or protected fields. - *

- * Object.getFieldValue(String fieldName) - */ - public static Object getFieldValue_(Object object, String fieldName) - throws NoSuchFieldException, IllegalAccessException - { - return getField_(object, fieldName).get(object); - } - - /** - * Get a static field value, given the containing class and field name. - * Return its result. - * Useful for accessing private, package, or protected fields. - *

- * Class.getStaticFieldValue(String fieldName) - */ - public static Object getStaticFieldValue(Class javaClass, String fieldName) { - try { - return getStaticFieldValue_(javaClass, fieldName); - } catch (NoSuchFieldException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedFieldName(javaClass, fieldName), ex); - } catch (IllegalAccessException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedFieldName(javaClass, fieldName), ex); - } - } - - /** - * Get a static field value, given the containing class and field name. - * Return its result. - * Useful for accessing private, package, or protected fields. - *

- * Class.getStaticFieldValue(String fieldName) - */ - public static Object getStaticFieldValue_(Class javaClass, String fieldName) - throws NoSuchFieldException, IllegalAccessException - { - return getField_(javaClass, fieldName).get(null); - } - - /** - * Set a field value, given the containing object, field name, and new value. - * Useful for accessing private, package, or protected fields. - *

- * Object.setFieldValue(String fieldName, Object value) - */ - public static void setFieldValue(Object object, String fieldName, Object value) { - try { - setFieldValue_(object, fieldName, value); - } catch (NoSuchFieldException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedFieldName(object, fieldName), ex); - } catch (IllegalAccessException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedFieldName(object, fieldName), ex); - } - } - - /** - * Set a field value, given the containing object, field name, and new value. - * Useful for accessing private, package, or protected fields. - *

- * Object.setFieldValue(String fieldName, Object value) - */ - public static void setFieldValue_(Object object, String fieldName, Object value) - throws NoSuchFieldException, IllegalAccessException - { - getField_(object, fieldName).set(object, value); - } - - /** - * Set a static field value, given the containing class, field name, and new value. - * Useful for accessing private, package, or protected fields. - *

- * Class.setStaticFieldValue(String fieldName, Object value) - */ - public static void setStaticFieldValue(Class javaClass, String fieldName, Object value) { - try { - setStaticFieldValue_(javaClass, fieldName, value); - } catch (NoSuchFieldException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedFieldName(javaClass, fieldName), ex); - } catch (IllegalAccessException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedFieldName(javaClass, fieldName), ex); - } - } - - /** - * Set a static field value, given the containing class, field name, and new value. - * Useful for accessing private, package, or protected fields. - *

- * Class.setStaticFieldValue(String fieldName, Object value) - */ - public static void setStaticFieldValue_(Class javaClass, String fieldName, Object value) - throws NoSuchFieldException, IllegalAccessException - { - getField_(javaClass, fieldName).set(null, value); - } - - /** - * Convenience method. - * Return a field for the specified object and field name. - * If the object's class does not directly - * define the field, look for it in the class's superclasses. - * Make any private/package/protected field accessible. - *

- * Object.getField(String fieldName) - */ - public static Field getField(Object object, String fieldName) { - try { - return getField_(object, fieldName); - } catch (NoSuchFieldException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedFieldName(object, fieldName), ex); - } - } - - /** - * Convenience method. - * Return a field for the specified object and field name. - * If the object's class does not directly - * define the field, look for it in the class's superclasses. - * Make any private/package/protected field accessible. - *

- * Object.getField(String fieldName) - */ - public static Field getField_(Object object, String fieldName) - throws NoSuchFieldException - { - return getField_(object.getClass(), fieldName); - } - - /** - * Return a field for the specified class and field name. - * If the class does not directly - * define the field, look for it in the class's superclasses. - * Make any private/package/protected field accessible. - */ - public static Field getField(Class javaClass, String fieldName) { - try { - return getField_(javaClass, fieldName); - } catch (NoSuchFieldException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedFieldName(javaClass, fieldName), ex); - } - } - - /** - * Return a field for the specified class and field name. - * If the class does not directly - * define the field, look for it in the class's superclasses. - * Make any private/package/protected field accessible. - */ - public static Field getField_(Class javaClass, String fieldName) - throws NoSuchFieldException - { - Field field = null; - try { - field = javaClass.getDeclaredField(fieldName); - } catch (NoSuchFieldException ex) { - Class superclass = javaClass.getSuperclass(); - if (superclass == null) { - throw ex; - } - return getField_(superclass, fieldName); // recurse - } - field.setAccessible(true); - return field; - } - - /** - * Return all the fields for the - * specified class, including inherited fields. - * Make any private/package/protected fields accessible. - *

- * Class.getAllFields() - */ - public static Iterable getAllFields(Class javaClass) { - ArrayList fields = new ArrayList(); - for (Class tempClass = javaClass; tempClass != null; tempClass = tempClass.getSuperclass()) { - addDeclaredFieldsTo(tempClass, fields); - } - return fields; - } - - /* - * Add the declared fields for the specified class - * to the specified list. - */ - private static void addDeclaredFieldsTo(Class javaClass, ArrayList fields) { - for (Field field : getDeclaredFields(javaClass)) { - fields.add(field); - } - } - - /** - * Return the declared fields for the specified class. - * Make any private/package/protected fields accessible. - *

- * Class.getAccessibleDeclaredFields() - */ - public static Iterable getDeclaredFields(Class javaClass) { - Field[] fields = javaClass.getDeclaredFields(); - for (Field field : fields) { - field.setAccessible(true); - } - return new ArrayIterable(fields); - } - - - // ********** methods ********** - - /** - * Convenience method. - * Execute a zero-argument method, given the receiver and method name. - * Return its result. - * Useful for invoking private, package, or protected methods. - *

- * Object.execute(String methodName) - */ - public static Object executeMethod(Object receiver, String methodName) { - return executeMethod(receiver, methodName, ZERO_PARAMETER_TYPES, ZERO_ARGUMENTS); - } - - /** - * Convenience method. - * Execute a one-argument method, given the receiver, - * method name, parameter type, and argument. - * Return its result. - * Useful for invoking private, package, or protected methods. - *

- * Object.execute(String methodName, Class parameterType, Object argument) - */ - public static Object executeMethod(Object receiver, String methodName, Class parameterType, Object argument) { - return executeMethod(receiver, methodName, new Class[] {parameterType}, new Object[] {argument}); - } - - /** - * Execute a method, given the receiver, - * method name, parameter types, and arguments. - * Return its result. - * Useful for invoking private, package, or protected methods. - *

- * Object.execute(String methodName, Class[] parameterTypes, Object[] arguments) - */ - public static Object executeMethod(Object receiver, String methodName, Class[] parameterTypes, Object[] arguments) { - return executeMethod(getMethod(receiver, methodName, parameterTypes), receiver, arguments); - } - - /** - * Execute the specified method, given the receiver and arguments. - * Return its result. - * Useful for invoking cached methods. - */ - public static Object executeMethod(Method method, Object receiver, Object[] arguments) { - try { - return method.invoke(receiver, arguments); - } catch (IllegalAccessException ex) { - throw new RuntimeException(ex + CR + method, ex); - } catch (InvocationTargetException ex) { - throw new RuntimeException(method + CR + ex.getTargetException(), ex); - } - } - - /** - * Convenience method. - * Execute a zero-argument method, - * given the receiver and method name. - * Return its result. - * Throw an exception if the method is not defined. - * Useful for invoking private, package, or protected methods. - *

- * Object.execute(String methodName) - */ - public static Object executeMethod_(Object receiver, String methodName) - throws NoSuchMethodException, IllegalAccessException, InvocationTargetException - { - return executeMethod_(receiver, methodName, ZERO_PARAMETER_TYPES, ZERO_ARGUMENTS); - } - - /** - * Convenience method. - * Execute a method, given the receiver, - * method name, parameter type, and argument. - * Return its result. - * Throw an exception if the method is not defined. - * Useful for invoking private, package, or protected methods. - *

- * Object.execute(String methodName, Class parameterType, Object argument) - */ - public static Object executeMethod_(Object receiver, String methodName, Class parameterType, Object argument) - throws NoSuchMethodException, IllegalAccessException, InvocationTargetException - { - return executeMethod_(receiver, methodName, new Class[] {parameterType}, new Object[] {argument}); - } - - /** - * Execute a method, given the receiver, - * method name, parameter types, and arguments. - * Return its result. - * Throw an exception if the method is not defined. - * Useful for invoking private, package, or protected methods. - *

- * Object.execute(String methodName, Class[] parameterTypes, Object[] arguments) - */ - public static Object executeMethod_(Object receiver, String methodName, Class[] parameterTypes, Object[] arguments) - throws NoSuchMethodException, IllegalAccessException, InvocationTargetException - { - return getMethod_(receiver, methodName, parameterTypes).invoke(receiver, arguments); - } - - /** - * Convenience method. - * Execute a zero-argument static method, - * given the class and method name. - * Return its result. - * Useful for invoking private, package, or protected methods. - *

- * Class.executeStaticMethod(String methodName) - */ - public static Object executeStaticMethod(Class javaClass, String methodName) { - return executeStaticMethod(javaClass, methodName, ZERO_PARAMETER_TYPES, ZERO_ARGUMENTS); - } - - /** - * Convenience method. - * Execute a static method, given the class, - * method name, parameter type, and argument. - * Return its result. - * Useful for invoking private, package, or protected methods. - *

- * Class.executeStaticMethod(String methodName, Class parameterType, Object argument) - */ - public static Object executeStaticMethod(Class javaClass, String methodName, Class parameterType, Object argument) { - return executeStaticMethod(javaClass, methodName, new Class[] {parameterType}, new Object[] {argument}); - } - - /** - * Execute a static method, given the class, - * method name, parameter types, and arguments. - * Return its result. - * Useful for invoking private, package, or protected methods. - *

- * Class.executeStaticMethod(String methodName, Class[] parameterTypes, Object[] arguments) - */ - public static Object executeStaticMethod(Class javaClass, String methodName, Class[] parameterTypes, Object[] arguments) { - try { - return executeStaticMethod_(javaClass, methodName, parameterTypes, arguments); - } catch (NoSuchMethodException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedMethodSignature(javaClass, methodName, parameterTypes), ex); - } catch (IllegalAccessException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedMethodSignature(javaClass, methodName, parameterTypes), ex); - } catch (InvocationTargetException ex) { - throw new RuntimeException(buildFullyQualifiedMethodSignature(javaClass, methodName, parameterTypes) + CR + ex.getTargetException(), ex); - } - } - - /** - * Convenience method. - * Execute a zero-argument static method, - * given the class and method name. - * Return its result. - * Useful for invoking private, package, or protected methods. - *

- * Class.executeStaticMethod(String methodName) - */ - public static Object executeStaticMethod_(Class javaClass, String methodName) - throws NoSuchMethodException, IllegalAccessException, InvocationTargetException - { - return executeStaticMethod_(javaClass, methodName, ZERO_PARAMETER_TYPES, ZERO_ARGUMENTS); - } - - /** - * Convenience method. - * Execute a static method, given the class, - * method name, parameter type, and argument. - * Return its result. - * Useful for invoking private, package, or protected methods. - *

- * Class.executeStaticMethod(String methodName, Class parameterType, Object argument) - */ - public static Object executeStaticMethod_(Class javaClass, String methodName, Class parameterType, Object argument) - throws NoSuchMethodException, IllegalAccessException, InvocationTargetException - { - return executeStaticMethod_(javaClass, methodName, new Class[] {parameterType}, new Object[] {argument}); - } - - /** - * Execute a static method, given the class, - * method name, parameter types, and arguments. - * Return its result. - * Useful for invoking private, package, or protected methods. - *

- * Class.executeStaticMethod(String methodName, Class[] parameterTypes, Object[] arguments) - */ - public static Object executeStaticMethod_(Class javaClass, String methodName, Class[] parameterTypes, Object[] arguments) - throws NoSuchMethodException, IllegalAccessException, InvocationTargetException - { - return getStaticMethod_(javaClass, methodName, parameterTypes).invoke(null, arguments); - } - - /** - * Convenience method. - * Return a zero-argument method for the specified class - * and method name. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getMethod(Class javaClass, String methodName) { - return getMethod(javaClass, methodName, ZERO_PARAMETER_TYPES); - } - - /** - * Convenience method. - * Return a zero-argument method for the specified class - * and method name. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getMethod_(Class javaClass, String methodName) - throws NoSuchMethodException - { - return getMethod_(javaClass, methodName, ZERO_PARAMETER_TYPES); - } - - /** - * Convenience method. - * Return a method for the specified class, method name, - * and formal parameter type. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getMethod(Class javaClass, String methodName, Class parameterType) { - return getMethod(javaClass, methodName, new Class[] {parameterType}); - } - - /** - * Convenience method. - * Return a method for the specified class, method name, - * and formal parameter type. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getMethod_(Class javaClass, String methodName, Class parameterType) - throws NoSuchMethodException - { - return getMethod_(javaClass, methodName, new Class[] {parameterType}); - } - - /** - * Return a method for the specified class, method name, - * and formal parameter types. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getMethod(Class javaClass, String methodName, Class[] parameterTypes) { - try { - return getMethod_(javaClass, methodName, parameterTypes); - } catch (NoSuchMethodException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedMethodSignature(javaClass, methodName, parameterTypes), ex); - } - } - - /** - * Return a method for the specified class, method name, - * and formal parameter types. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getMethod_(Class javaClass, String methodName, Class[] parameterTypes) - throws NoSuchMethodException - { - Method method = null; - try { - method = javaClass.getDeclaredMethod(methodName, parameterTypes); - } catch (NoSuchMethodException ex) { - Class superclass = javaClass.getSuperclass(); - if (superclass == null) { - throw ex; - } - // recurse - return getMethod_(superclass, methodName, parameterTypes); - } - method.setAccessible(true); - return method; - } - - /** - * Convenience method. - * Return a zero-argument method for the specified object - * and method name. If the object's class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getMethod(Object object, String methodName) { - return getMethod(object.getClass(), methodName); - } - - /** - * Convenience method. - * Return a zero-argument method for the specified object - * and method name. If the object's class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getMethod_(Object object, String methodName) - throws NoSuchMethodException - { - return getMethod_(object.getClass(), methodName); - } - - /** - * Convenience method. - * Return a method for the specified object, method name, - * and formal parameter types. If the object's class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getMethod(Object object, String methodName, Class[] parameterTypes) { - return getMethod(object.getClass(), methodName, parameterTypes); - } - - /** - * Convenience method. - * Return a method for the specified object, method name, - * and formal parameter types. If the object's class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getMethod_(Object object, String methodName, Class[] parameterTypes) - throws NoSuchMethodException - { - return getMethod_(object.getClass(), methodName, parameterTypes); - } - - /** - * Convenience method. - * Return a method for the specified object, method name, - * and formal parameter type. If the object's class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getMethod(Object object, String methodName, Class parameterType) { - return getMethod(object.getClass(), methodName, parameterType); - } - - /** - * Convenience method. - * Return a method for the specified object, method name, - * and formal parameter type. If the object's class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getMethod_(Object object, String methodName, Class parameterType) - throws NoSuchMethodException - { - return getMethod_(object.getClass(), methodName, parameterType); - } - - /** - * Convenience method. - * Return a zero-argument static method for the specified class - * and method name. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getStaticMethod(Class javaClass, String methodName) { - return getStaticMethod(javaClass, methodName, ZERO_PARAMETER_TYPES); - } - - /** - * Convenience method. - * Return a static method for the specified class, method name, - * and formal parameter type. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getStaticMethod(Class javaClass, String methodName, Class parameterTypes) { - return getStaticMethod(javaClass, methodName, new Class[] {parameterTypes}); - } - - /** - * Return a static method for the specified class, method name, - * and formal parameter types. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getStaticMethod(Class javaClass, String methodName, Class[] parameterTypes) { - try { - return getStaticMethod_(javaClass, methodName, parameterTypes); - } catch (NoSuchMethodException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedMethodSignature(javaClass, methodName, parameterTypes), ex); - } - } - - /** - * Convenience method. - * Return a zero-argument static method for the specified class - * and method name. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getStaticMethod_(Class javaClass, String methodName) - throws NoSuchMethodException - { - return getStaticMethod_(javaClass, methodName, ZERO_PARAMETER_TYPES); - } - - /** - * Convenience method. - * Return a static method for the specified class, method name, - * and formal parameter type. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getStaticMethod_(Class javaClass, String methodName, Class parameterTypes) - throws NoSuchMethodException - { - return getStaticMethod_(javaClass, methodName, new Class[] {parameterTypes}); - } - - /** - * Return a static method for the specified class, method name, - * and formal parameter types. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Make any private/package/protected method accessible. - */ - public static Method getStaticMethod_(Class javaClass, String methodName, Class[] parameterTypes) - throws NoSuchMethodException - { - Method method = getMethod_(javaClass, methodName, parameterTypes); - if (Modifier.isStatic(method.getModifiers())) { - return method; - } - throw new NoSuchMethodException(buildFullyQualifiedMethodSignature(javaClass, methodName, parameterTypes)); - } - - /** - * Return all the methods for the - * specified class, including inherited methods. - * Make any private/package/protected methods accessible. - *

- * Class.getAllMethods() - */ - public static Iterable getAllMethods(Class javaClass) { - ArrayList methods = new ArrayList(); - for (Class tempClass = javaClass; tempClass != null; tempClass = tempClass.getSuperclass()) { - addDeclaredMethodsTo(tempClass, methods); - } - return methods; - } - - /* - * Add the declared methods for the specified class - * to the specified list. - */ - private static void addDeclaredMethodsTo(Class javaClass, ArrayList methods) { - for (Method method : getDeclaredMethods(javaClass)) { - methods.add(method); - } - } - - /** - * Return the declared methods for the specified class. - * Make any private/package/protected methods accessible. - *

- * Class.getAccessibleDeclaredMethods() - */ - public static Iterable getDeclaredMethods(Class javaClass) { - Method[] methods = javaClass.getDeclaredMethods(); - for (Method method : methods) { - method.setAccessible(true); - } - return new ArrayIterable(methods); - } - - - // ********** constructors ********** - - /** - * Return the default (zero-argument) constructor - * for the specified class. - * Make any private/package/protected constructor accessible. - *

- * Class.getDefaultConstructor() - */ - public static Constructor getDefaultConstructor(Class javaClass) { - return getConstructor(javaClass); - } - - /** - * Convenience method. - * Return the default (zero-argument) constructor - * for the specified class. - * Make any private/package/protected constructor accessible. - *

- * Class.getConstructor() - */ - public static Constructor getConstructor(Class javaClass) { - return getConstructor(javaClass, ZERO_PARAMETER_TYPES); - } - - /** - * Convenience method. - * Return the constructor for the specified class - * and formal parameter type. - * Make any private/package/protected constructor accessible. - *

- * Class.getConstructor(Class parameterType) - */ - public static Constructor getConstructor(Class javaClass, Class parameterType) { - return getConstructor(javaClass, new Class[] {parameterType}); - } - - /** - * Return the constructor for the specified class - * and formal parameter types. - * Make any private/package/protected constructor accessible. - *

- * Class.getConstructor(Class[] parameterTypes) - */ - public static Constructor getConstructor(Class javaClass, Class[] parameterTypes) { - try { - return getConstructor_(javaClass, parameterTypes); - } catch (NoSuchMethodException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedConstructorSignature(javaClass, parameterTypes), ex); - } - } - - /** - * Return the default (zero-argument) constructor - * for the specified class. - * Make any private/package/protected constructor accessible. - *

- * Class.getDefaultConstructor() - */ - public static Constructor getDefaultConstructor_(Class javaClass) - throws NoSuchMethodException - { - return getConstructor_(javaClass); - } - - /** - * Convenience method. - * Return the default (zero-argument) constructor - * for the specified class. - * Make any private/package/protected constructor accessible. - *

- * Class.getConstructor() - */ - public static Constructor getConstructor_(Class javaClass) - throws NoSuchMethodException - { - return getConstructor_(javaClass, ZERO_PARAMETER_TYPES); - } - - /** - * Convenience method. - * Return the constructor for the specified class - * and formal parameter type. - * Make any private/package/protected constructor accessible. - *

- * Class.getConstructor(Class parameterType) - */ - public static Constructor getConstructor_(Class javaClass, Class parameterType) - throws NoSuchMethodException - { - return getConstructor_(javaClass, new Class[] {parameterType}); - } - - /** - * Return the constructor for the specified class - * and formal parameter types. - * Make any private/package/protected constructor accessible. - *

- * Class.getConstructor(Class[] parameterTypes) - */ - public static Constructor getConstructor_(Class javaClass, Class[] parameterTypes) - throws NoSuchMethodException - { - Constructor constructor = javaClass.getDeclaredConstructor(parameterTypes); - constructor.setAccessible(true); - return constructor; - } - - /** - * Return the declared constructors for the specified class. - * Make any private/package/protected constructors accessible. - *

- * Class.getAccessibleDeclaredConstructors() - */ - public static Iterable> getDeclaredConstructors(Class javaClass) { - @SuppressWarnings("unchecked") - Constructor[] constructors = (Constructor[]) javaClass.getDeclaredConstructors(); - for (Constructor constructor : constructors) { - constructor.setAccessible(true); - } - return new ArrayIterable>(constructors); - } - - - // ********** classes ********** - - /** - * Convenience method. - * Return the specified class (without the checked exception). - */ - public static Class classForName(String className) { - try { - return Class.forName(className); - } catch (ClassNotFoundException ex) { - throw new RuntimeException(className, ex); - } - } - - /** - * Convenience method. - * Return the specified class (without the checked exception). - */ - public static Class classForName(String className, boolean initialize, ClassLoader classLoader) { - try { - return Class.forName(className, initialize, classLoader); - } catch (ClassNotFoundException ex) { - throw new RuntimeException(className, ex); - } - } - - /** - * Return the "array depth" of the specified class. - * The depth is the number of dimensions for an array type. - * Non-array types have a depth of zero. - *

- * Class.getArrayDepth() - */ - public static int getArrayDepth(Class javaClass) { - int depth = 0; - while (javaClass.isArray()) { - depth++; - javaClass = javaClass.getComponentType(); - } - return depth; - } - - /** - * Return the "element type" of the specified class. - * The element type is the base type held by an array type. - * A non-array type simply returns itself. - *

- * Class.getElementType() - */ - public static Class getElementType(Class javaClass) { - while (javaClass.isArray()) { - javaClass = javaClass.getComponentType(); - } - return javaClass; - } - - /** - * Return the wrapper class corresponding to the specified - * primitive class. Return null if the specified class - * is not a primitive class. - *

- * Class.getWrapperClass() - */ - public static Class getWrapperClass(Class primitiveClass) { - for (Primitive primitive : PRIMITIVES) { - if (primitive.javaClass == primitiveClass) { - return primitive.wrapperClass; - } - } - return null; - } - - /** - * Return whether the specified class is a primitive wrapper - * class (i.e. java.lang.Void or one of the primitive - * variable wrapper classes, java.lang.Boolean, - * java.lang.Integer, java.lang.Float, etc.). - *

- * NB: void.class.isPrimitive() == true - *

- * Class.isPrimitiveWrapper() - */ - public static boolean classIsPrimitiveWrapper(Class javaClass) { - if (javaClass.isArray() || (javaClass.getName().length() > MAX_PRIMITIVE_WRAPPER_CLASS_NAME_LENGTH)) { - return false; // performance tweak - } - for (Primitive primitive : PRIMITIVES) { - if (javaClass == primitive.wrapperClass) { - return true; - } - } - return false; - } - - /** - * Return whether the specified class is a "variable" primitive wrapper - * class (i.e. java.lang.Boolean, - * java.lang.Integer, java.lang.Float, etc., - * but not java.lang.Void). - *

- * NB: void.class.isPrimitive() == true - *

- * Class.isVariablePrimitiveWrapper() - */ - public static boolean classIsVariablePrimitiveWrapper(Class javaClass) { - return classIsPrimitiveWrapper(javaClass) - && (javaClass != VOID_WRAPPER_CLASS); - } - - /** - * Return whether the specified class is a "variable" primitive - * class (i.e. boolean, int, - * float, etc., but not void). - *

- * NB: void.class.isPrimitive() == true - *

- * Class.isVariablePrimitive() - */ - public static boolean classIsVariablePrimitive(Class javaClass) { - return javaClass.isPrimitive() && (javaClass != VOID_CLASS); - } - - /** - * Return the primitive class for the specified primitive class code. - * Return null if the specified code - * is not a primitive class code. - * @see java.lang.Class#getName() - */ - public static Class getClassForCode(int classCode) { - return getClassForCode((char) classCode); - } - - /** - * Return the primitive class for the specified primitive class code. - * Return null if the specified code - * is not a primitive class code. - * @see java.lang.Class#getName() - */ - public static Class getClassForCode(char classCode) { - for (Primitive primitive : PRIMITIVES) { - if (primitive.code == classCode) { - return primitive.javaClass; - } - } - return null; - } - - /** - * Return the class code for the specified primitive class. - * Return 0 if the specified class - * is not a primitive class. - * @see java.lang.Class#getName() - */ - public static char getCodeForClass(Class primitiveClass) { - if (( ! primitiveClass.isArray()) && (primitiveClass.getName().length() <= MAX_PRIMITIVE_CLASS_NAME_LENGTH)) { - for (Primitive primitive : PRIMITIVES) { - if (primitive.javaClass == primitiveClass) { - return primitive.code; - } - } - } - return 0; - } - - - // ********** instantiation ********** - - /** - * Convenience method. - * Return a new instance of the specified class, - * using the class's default (zero-argument) constructor. - *

- * Class.newInstance() - */ - public static Object newInstance(String className) { - return newInstance(className, null); - } - - /** - * Return a new instance of the specified class, - * given the constructor parameter type and argument. - *

- * Class.newInstance(Class parameterType, Object argument) - */ - public static Object newInstance(String className, Class parameterType, Object argument) { - return newInstance(className, parameterType, argument, null); - } - - /** - * Return a new instance of the specified class, - * given the constructor parameter types and arguments. - *

- * Class.newInstance(Class[] parameterTypes, Object[] arguments) - */ - public static Object newInstance(String className, Class[] parameterTypes, Object[] arguments) { - return newInstance(className, parameterTypes, arguments, null); - } - - /** - * Convenience method. - * Return a new instance of the specified class, - * using the class's default (zero-argument) constructor. - * Use the specified class loader to load the class. - *

- * Class.newInstance() - */ - public static Object newInstance(String className, ClassLoader classLoader) { - return newInstance(classForName(className, false, classLoader)); - } - - /** - * Return a new instance of the specified class, - * given the constructor parameter type and argument. - *

- * Class.newInstance(Class parameterType, Object argument) - */ - public static Object newInstance(String className, Class parameterType, Object argument, ClassLoader classLoader) { - return newInstance(classForName(className, false, classLoader), parameterType, argument); - } - - /** - * Return a new instance of the specified class, - * given the constructor parameter types and arguments. - *

- * Class.newInstance(Class[] parameterTypes, Object[] arguments) - */ - public static Object newInstance(String className, Class[] parameterTypes, Object[] arguments, ClassLoader classLoader) { - return newInstance(classForName(className, false, classLoader), parameterTypes, arguments); - } - - /** - * Convenience method. - * Return a new instance of the specified class, - * using the class's default (zero-argument) constructor. - *

- * Class.newInstance() - */ - public static T newInstance(Class javaClass) { - return newInstance(javaClass, ZERO_PARAMETER_TYPES, ZERO_ARGUMENTS); - } - - /** - * Convenience method. - * Return a new instance of the specified class, - * given the constructor parameter type and argument. - *

- * Class.newInstance(Class parameterType, Object argument) - */ - public static T newInstance(Class javaClass, Class parameterType, Object argument) { - return newInstance(javaClass, new Class[] {parameterType}, new Object[] {argument}); - } - - /** - * Return a new instance of the specified class, - * given the constructor parameter types and arguments. - *

- * Class.newInstance(Class[] parameterTypes, Object[] arguments) - */ - public static T newInstance(Class javaClass, Class[] parameterTypes, Object[] arguments) { - try { - return newInstance_(javaClass, parameterTypes, arguments); - } catch (InstantiationException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedConstructorSignature(javaClass, parameterTypes), ex); - } catch (IllegalAccessException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedConstructorSignature(javaClass, parameterTypes), ex); - } catch (InvocationTargetException ex) { - throw new RuntimeException(buildFullyQualifiedConstructorSignature(javaClass, parameterTypes) + CR + ex.getTargetException(), ex); - } catch (NoSuchMethodException ex) { - throw new RuntimeException(ex + CR + buildFullyQualifiedConstructorSignature(javaClass, parameterTypes), ex); - } - } - - /** - * Convenience method. - * Return a new instance of the specified class, - * using the class's default (zero-argument) constructor. - *

- * Class.newInstance() - */ - public static T newInstance_(Class javaClass) - throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException - { - return newInstance_(javaClass, ZERO_PARAMETER_TYPES, ZERO_ARGUMENTS); - } - - /** - * Convenience method. - * Return a new instance of the specified class, - * given the constructor parameter type and argument. - *

- * Class.newInstance(Class parameterType, Object argument) - */ - public static T newInstance_(Class javaClass, Class parameterType, Object argument) - throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException - { - return newInstance_(javaClass, new Class[] {parameterType}, new Object[] {argument}); - } - - /** - * Return a new instance of the specified class, - * given the constructor parameter types and arguments. - *

- * Class.newInstance(Class[] parameterTypes, Object[] arguments) - */ - public static T newInstance_(Class javaClass, Class[] parameterTypes, Object[] arguments) - throws NoSuchMethodException, InstantiationException, IllegalAccessException, InvocationTargetException - { - return getConstructor_(javaClass, parameterTypes).newInstance(arguments); - } - - - // ********** type declarations ********** - - /** - * Return the class for the specified "type declaration". - */ - public static Class getClassForTypeDeclaration(String typeDeclaration) { - return getClassForTypeDeclaration(typeDeclaration, null); - } - - /** - * Return the class for the specified "type declaration". - */ - public static Class getClassForTypeDeclaration_(String typeDeclaration) - throws ClassNotFoundException - { - return getClassForTypeDeclaration_(typeDeclaration, null); - } - - /** - * Return the class for the specified "type declaration", - * using the specified class loader. - */ - public static Class getClassForTypeDeclaration(String typeDeclaration, ClassLoader classLoader) { - TypeDeclaration td = buildTypeDeclaration(typeDeclaration); - return getClassForTypeDeclaration(td.elementTypeName, td.arrayDepth, classLoader); - } - - /** - * Return the class for the specified "type declaration", - * using the specified class loader. - */ - public static Class getClassForTypeDeclaration_(String typeDeclaration, ClassLoader classLoader) - throws ClassNotFoundException - { - TypeDeclaration td = buildTypeDeclaration(typeDeclaration); - return getClassForTypeDeclaration_(td.elementTypeName, td.arrayDepth, classLoader); - } - - private static TypeDeclaration buildTypeDeclaration(String typeDeclaration) { - typeDeclaration = StringTools.removeAllWhitespace(typeDeclaration); - int arrayDepth = getArrayDepthForTypeDeclaration_(typeDeclaration); - String elementTypeName = getElementTypeNameForTypeDeclaration_(typeDeclaration, arrayDepth); - return new TypeDeclaration(elementTypeName, arrayDepth); - } - - /** - * Return the array depth for the specified "type declaration"; e.g.

    - *
  • "int[]" returns 1 - *
  • "java.lang.String[][][]" returns 3 - *
- */ - public static int getArrayDepthForTypeDeclaration(String typeDeclaration) { - return getArrayDepthForTypeDeclaration_(StringTools.removeAllWhitespace(typeDeclaration)); - } - - /** - * pre-condition: no whitespace in the type declaration. - */ - private static int getArrayDepthForTypeDeclaration_(String typeDeclaration) { - int last = typeDeclaration.length() - 1; - int depth = 0; - int close = last; - while (typeDeclaration.charAt(close) == ']') { - if (typeDeclaration.charAt(close - 1) == '[') { - depth++; - } else { - throw new IllegalArgumentException("invalid type declaration: " + typeDeclaration); //$NON-NLS-1$ - } - close = last - (depth * 2); - } - return depth; - } - - /** - * Return the element type name for the specified "type declaration"; e.g.
    - *
  • "int[]" returns "int" - *
  • "java.lang.String[][][]" returns "java.lang.String" - *
- */ - public static String getElementTypeNameForTypeDeclaration(String typeDeclaration) { - typeDeclaration = StringTools.removeAllWhitespace(typeDeclaration); - return getElementTypeNameForTypeDeclaration_(typeDeclaration, getArrayDepthForTypeDeclaration_(typeDeclaration)); - } - - /** - * Return the element type name for the specified "type declaration"; e.g.
    - *
  • "int[]" returns "int" - *
  • "java.lang.String[][][]" returns "java.lang.String" - *
- * Useful for clients that have already queried the type declaration's array depth. - */ - public static String getElementTypeNameForTypeDeclaration(String typeDeclaration, int arrayDepth) { - return getElementTypeNameForTypeDeclaration_(StringTools.removeAllWhitespace(typeDeclaration), arrayDepth); - } - - /** - * pre-condition: no whitespace in the type declaration. - */ - private static String getElementTypeNameForTypeDeclaration_(String typeDeclaration, int arrayDepth) { - return typeDeclaration.substring(0, typeDeclaration.length() - (arrayDepth * 2)); - } - - /** - * Return the class for the specified "type declaration". - */ - public static Class getClassForTypeDeclaration(String elementTypeName, int arrayDepth) { - return getClassForTypeDeclaration(elementTypeName, arrayDepth, null); - } - - /** - * Return the class for the specified "type declaration". - */ - public static Class getClassForTypeDeclaration_(String elementTypeName, int arrayDepth) - throws ClassNotFoundException - { - return getClassForTypeDeclaration_(elementTypeName, arrayDepth, null); - } - - /** - * Return the class for the specified "type declaration", - * using the specified class loader. - */ - public static Class getClassForTypeDeclaration(String elementTypeName, int arrayDepth, ClassLoader classLoader) { - try { - return getClassForTypeDeclaration_(elementTypeName, arrayDepth, classLoader); - } catch (ClassNotFoundException ex) { - throw new RuntimeException(ex); - } - } - - /** - * Return the class for the specified "type declaration", - * using the specified class loader. - */ - // see the "Evaluation" of JDK bug 6446627 for a discussion of loading classes - public static Class getClassForTypeDeclaration_(String elementTypeName, int arrayDepth, ClassLoader classLoader) - throws ClassNotFoundException - { - // primitives cannot be loaded via Class.forName(), - // so check for a primitive class name first - Primitive pcc = null; - if (elementTypeName.length() <= MAX_PRIMITIVE_CLASS_NAME_LENGTH) { // performance tweak - for (Primitive primitive : PRIMITIVES) { - if (primitive.javaClass.getName().equals(elementTypeName)) { - pcc = primitive; - break; - } - } - } - - // non-array - if (arrayDepth == 0) { - return (pcc == null) ? Class.forName(elementTypeName, false, classLoader) : pcc.javaClass; - } - - // array - StringBuilder sb = new StringBuilder(100); - for (int i = arrayDepth; i-- > 0; ) { - sb.append('['); - } - if (pcc == null) { - ClassName.append(elementTypeName, sb); - } else { - sb.append(pcc.code); - } - return Class.forName(sb.toString(), false, classLoader); - } - - /** - * Return the class name for the specified "type declaration"; e.g.
    - *
  • "int" returns "int" - *
  • "int[]" returns "[I" - *
  • "java.lang.String" returns "java.lang.String" - *
  • "java.lang.String[][][]" returns "[[[Ljava.lang.String;" - *
- * @see java.lang.Class#getName() - */ - public static String getClassNameForTypeDeclaration(String typeDeclaration) { - TypeDeclaration td = buildTypeDeclaration(typeDeclaration); - return getClassNameForTypeDeclaration(td.elementTypeName, td.arrayDepth); - } - - /** - * Return the class name for the specified "type declaration". - * @see java.lang.Class#getName() - */ - public static String getClassNameForTypeDeclaration(String elementTypeName, int arrayDepth) { - // non-array - if (arrayDepth == 0) { - return elementTypeName; - } - - if (elementTypeName.equals(ClassName.VOID_CLASS_NAME)) { - throw new IllegalArgumentException('\'' + ClassName.VOID_CLASS_NAME + "' must have an array depth of zero: " + arrayDepth + '.'); //$NON-NLS-1$ - } - // array - StringBuilder sb = new StringBuilder(100); - for (int i = arrayDepth; i-- > 0; ) { - sb.append('['); - } - - // look for a primitive first - Primitive pcc = null; - if (elementTypeName.length() <= MAX_PRIMITIVE_CLASS_NAME_LENGTH) { // performance tweak - for (Primitive primitive : PRIMITIVES) { - if (primitive.javaClass.getName().equals(elementTypeName)) { - pcc = primitive; - break; - } - } - } - - if (pcc == null) { - ClassName.append(elementTypeName, sb); - } else { - sb.append(pcc.code); - } - - return sb.toString(); - } - - - // ********** exception messages ********** - - /** - * Return a string representation of the specified constructor. - */ - private static String buildFullyQualifiedConstructorSignature(Class javaClass, Class[] parameterTypes) { - return buildFullyQualifiedMethodSignature(javaClass, null, parameterTypes); - } - - /** - * Return a string representation of the specified field. - */ - private static String buildFullyQualifiedFieldName(Class javaClass, String fieldName) { - StringBuilder sb = new StringBuilder(200); - sb.append(javaClass.getName()); - sb.append('.'); - sb.append(fieldName); - return sb.toString(); - } - - /** - * Return a string representation of the specified field. - */ - private static String buildFullyQualifiedFieldName(Object object, String fieldName) { - return buildFullyQualifiedFieldName(object.getClass(), fieldName); - } - - /** - * Return a string representation of the specified method. - */ - private static String buildFullyQualifiedMethodSignature(Class javaClass, String methodName, Class[] parameterTypes) { - StringBuilder sb = new StringBuilder(200); - sb.append(javaClass.getName()); - // this check allows us to use this code for constructors, where the methodName is null - if (methodName != null) { - sb.append('.'); - sb.append(methodName); - } - sb.append('('); - int max = parameterTypes.length - 1; - if (max != -1) { - // stop one short of the end of the array - for (int i = 0; i < max; i++) { - sb.append(parameterTypes[i].getName()); - sb.append(", "); //$NON-NLS-1$ - } - sb.append(parameterTypes[max].getName()); - } - sb.append(')'); - return sb.toString(); - } - - - // ********** primitive constants ********** - - static final Iterable PRIMITIVES = buildPrimitives(); - - public static final char BYTE_CODE = 'B'; - public static final char CHAR_CODE = 'C'; - public static final char DOUBLE_CODE = 'D'; - public static final char FLOAT_CODE = 'F'; - public static final char INT_CODE = 'I'; - public static final char LONG_CODE = 'J'; - public static final char SHORT_CODE = 'S'; - public static final char BOOLEAN_CODE = 'Z'; - public static final char VOID_CODE = 'V'; - - static final int MAX_PRIMITIVE_CLASS_NAME_LENGTH = calculateMaxPrimitiveClassNameLength(); - static final int MAX_PRIMITIVE_WRAPPER_CLASS_NAME_LENGTH = calculateMaxPrimitiveWrapperClassNameLength(); - - private static int calculateMaxPrimitiveClassNameLength() { - int max = -1; - for (Primitive primitive : PRIMITIVES) { - int len = primitive.javaClass.getName().length(); - if (len > max) { - max = len; - } - } - return max; - } - - private static int calculateMaxPrimitiveWrapperClassNameLength() { - int max = -1; - for (Primitive primitive : PRIMITIVES) { - int len = primitive.wrapperClass.getName().length(); - if (len > max) { - max = len; - } - } - return max; - } - - /** - * NB: void.class.isPrimitive() == true - */ - private static Iterable buildPrimitives() { - Primitive[] array = new Primitive[9]; - array[0] = new Primitive(BYTE_CODE, java.lang.Byte.class); - array[1] = new Primitive(CHAR_CODE, java.lang.Character.class); - array[2] = new Primitive(DOUBLE_CODE, java.lang.Double.class); - array[3] = new Primitive(FLOAT_CODE, java.lang.Float.class); - array[4] = new Primitive(INT_CODE, java.lang.Integer.class); - array[5] = new Primitive(LONG_CODE, java.lang.Long.class); - array[6] = new Primitive(SHORT_CODE, java.lang.Short.class); - array[7] = new Primitive(BOOLEAN_CODE, java.lang.Boolean.class); - array[8] = new Primitive(VOID_CODE, java.lang.Void.class); - return new ArrayIterable(array); - } - - - // ********** member classes ********** - - static class Primitive { - final char code; - final Class javaClass; - final Class wrapperClass; - private static final String WRAPPER_CLASS_TYPE_FIELD_NAME = "TYPE"; //$NON-NLS-1$ - // e.g. java.lang.Boolean.TYPE => boolean.class - Primitive(char code, Class wrapperClass) { - this.code = code; - this.wrapperClass = wrapperClass; - this.javaClass = (Class) getStaticFieldValue(wrapperClass, WRAPPER_CLASS_TYPE_FIELD_NAME); - } - } - - private static class TypeDeclaration { - final String elementTypeName; - final int arrayDepth; - TypeDeclaration(String elementTypeName, int arrayDepth) { - this.elementTypeName = elementTypeName; - this.arrayDepth = arrayDepth; - } - } - - - // ********** suppressed constructor ********** - - /** - * Suppress default constructor, ensuring non-instantiability. - */ - private ReflectionTools() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReverseComparator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReverseComparator.java deleted file mode 100644 index 948b8588e4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ReverseComparator.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import java.util.Comparator; - -/** - * This comparator will reverse the order of the specified comparator. - * If the comparator is null, the natural ordering of the objects will be used. - */ -public class ReverseComparator> - implements Comparator, Serializable -{ - private final Comparator comparator; - - public ReverseComparator() { - this(null); - } - - public ReverseComparator(Comparator comparator) { - super(); - this.comparator = comparator; - } - - public int compare(E e1, E e2) { - return (this.comparator == null) ? - e2.compareTo(e1) - : - this.comparator.compare(e2, e1); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/RunnableCommand.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/RunnableCommand.java deleted file mode 100644 index 997996b5ff..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/RunnableCommand.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import org.eclipse.jpt.common.utility.Command; - -/** - * Wrap a Runnable so it can be used as a Command. - */ -public class RunnableCommand implements Command { - protected final Runnable runnable; - - public RunnableCommand(Runnable runnable) { - super(); - if (runnable == null) { - throw new NullPointerException(); - } - this.runnable = runnable; - } - - public void execute() { - this.runnable.run(); - } - - @Override - public String toString() { - return "Command[" + this.runnable.toString() +']'; //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleAssociation.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleAssociation.java deleted file mode 100644 index 8490c267b4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleAssociation.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; - -/** - * Straightforward implementation of {@link Association}. - */ -public class SimpleAssociation - extends AbstractAssociation - implements Cloneable, Serializable -{ - private final K key; - private V value; - - private static final long serialVersionUID = 1L; - - - /** - * Construct an association with the specified key - * and a null value. - */ - public SimpleAssociation(K key) { - super(); - this.key = key; - } - - /** - * Construct an association with the specified key and value. - */ - public SimpleAssociation(K key, V value) { - this(key); - this.value = value; - } - - - public K getKey() { - return this.key; - } - - public synchronized V getValue() { - return this.value; - } - - public synchronized V setValue(V value) { - V old = this.value; - this.value = value; - return old; - } - - @Override - @SuppressWarnings("unchecked") - public synchronized SimpleAssociation clone() { - try { - return (SimpleAssociation) super.clone(); - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleBooleanReference.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleBooleanReference.java deleted file mode 100644 index 9dabf58f59..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleBooleanReference.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; - -/** - * Provide a container for passing a flag that can be changed by the recipient. - * - * @see SynchronizedBoolean - */ -public class SimpleBooleanReference - implements BooleanReference, Cloneable, Serializable -{ - /** Backing boolean. */ - protected volatile boolean value; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Create a boolean reference with the specified initial value. - */ - public SimpleBooleanReference(boolean value) { - super(); - this.value = value; - } - - /** - * Create a boolean reference with an initial value of - * false. - */ - public SimpleBooleanReference() { - this(false); - } - - - // ********** accessors ********** - - public boolean getValue() { - return this.value; - } - - public boolean is(boolean v) { - return this.value == v; - } - - public boolean isNot(boolean v) { - return this.value != v; - } - - public boolean isTrue() { - return this.value; - } - - public boolean isFalse() { - return ! this.value; - } - - public boolean setValue(boolean value) { - boolean old = this.value; - this.value = value; - return old; - } - - public boolean flip() { - return this.value = ! this.value; - } - - public boolean setNot(boolean v) { - return this.setValue( ! v); - } - - public boolean setTrue() { - return this.setValue(true); - } - - public boolean setFalse() { - return this.setValue(false); - } - - - // ********** standard methods ********** - - @Override - public SimpleBooleanReference clone() { - try { - return (SimpleBooleanReference) super.clone(); - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - @Override - public String toString() { - return '[' + String.valueOf(this.value) + ']'; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleCommandExecutor.java deleted file mode 100644 index 169654a766..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleCommandExecutor.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import org.eclipse.jpt.common.utility.Command; - -/** - * Straightforward implementation of {@link StatefulCommandExecutor}. - */ -public class SimpleCommandExecutor - implements StatefulCommandExecutor -{ - private boolean active = false; - - public SimpleCommandExecutor() { - super(); - } - - public void start() { - if (this.active) { - throw new IllegalStateException("Not stopped."); //$NON-NLS-1$ - } - this.active = true; - } - - public void execute(Command command) { - if (this.active) { - command.execute(); - } - } - - public void stop() { - if ( ! this.active) { - throw new IllegalStateException("Not started."); //$NON-NLS-1$ - } - this.active = false; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleFilter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleFilter.java deleted file mode 100644 index 7cff1214c6..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleFilter.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import org.eclipse.jpt.common.utility.Filter; - -/** - * Simple, abstract implementation of Filter - * that holds on to a criterion object that can be used in the - * accept(Object) or reject(Object) - * methods. Subclasses can override either of these methods, - * depending on which is easier to implement. Note that at least - * one of these methods must be overridden or - * an infinite loop will occur. If both of them are overridden, - * only the accept(Object) method will be used. - *

- * Simplifies the implementation of straightforward inner classes. - * Here is an example of a filter that can be used by a - * FilteringIterator to return only those strings - * in the nested iterator start with "prefix": - *

- *	Filter filter = new SimpleFilter("prefix") {
- *		public boolean accept(String o) {
- *			return o.startsWith((String) criterion);
- *		}
- *	};
- * 
- */ -public abstract class SimpleFilter - implements Filter, Cloneable, Serializable -{ - protected final S criterion; - - private static final long serialVersionUID = 1L; - - - /** - * More useful constructor. The specified criterion can - * be used by a subclass to "accept" or "reject" objects. - */ - protected SimpleFilter(S criterion) { - super(); - this.criterion = criterion; - } - - /** - * Construct a simple filter with a null criterion - */ - protected SimpleFilter() { - this(null); - } - - /** - * Return whether the the specified object should be "rejected". - * The semantics of "rejected" is determined by the client. - */ - protected boolean reject(T o) { - return ! this.accept(o); - } - - /** - * Return whether the the specified object should be "accepted". - * The semantics of "accepted" is determined by the client. - */ - public boolean accept(T o) { - return ! this.reject(o); - } - - @Override - @SuppressWarnings("unchecked") - public SimpleFilter clone() { - try { - return (SimpleFilter) super.clone(); - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - @Override - public boolean equals(Object o) { - if ( ! (o instanceof SimpleFilter)) { - return false; - } - SimpleFilter other = (SimpleFilter) o; - return (this.criterion == null) ? - (other.criterion == null) : this.criterion.equals(other.criterion); - } - - @Override - public int hashCode() { - return (this.criterion == null) ? 0 : this.criterion.hashCode(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.criterion); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleIntReference.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleIntReference.java deleted file mode 100644 index fa7a3b452d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleIntReference.java +++ /dev/null @@ -1,186 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; - -/** - * This class can be used wherever a mutable integer object is needed. - * It is a cross between an int and an {@link Integer}. - * It can be stored in a standard container (e.g. {@link java.util.Collection}) - * but can be modified. It is also useful passing a value that can be changed - * by the recipient. - * - * @see SynchronizedInt - */ -public final class SimpleIntReference - implements IntReference, Cloneable, Serializable -{ - /** Backing int. */ - private volatile int value = 0; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a int reference with the specified initial value. - */ - public SimpleIntReference(int count) { - super(); - this.value = count; - } - - /** - * Construct a int reference with an initial value of zero. - */ - public SimpleIntReference() { - this(0); - } - - - // ********** methods ********** - - public int getValue() { - return this.value; - } - - public boolean equals(int v) { - return this.value == v; - } - - public boolean notEqual(int v) { - return this.value != v; - } - - public boolean isZero() { - return this.value == 0; - } - - public boolean isNotZero() { - return this.value != 0; - } - - public boolean isGreaterThan(int v) { - return this.value > v; - } - - public boolean isGreaterThanOrEqual(int v) { - return this.value >= v; - } - - public boolean isLessThan(int v) { - return this.value < v; - } - - public boolean isLessThanOrEqual(int v) { - return this.value <= v; - } - - public boolean isPositive() { - return this.isGreaterThan(0); - } - - public boolean isNotPositive() { - return this.isLessThanOrEqual(0); - } - - public boolean isNegative() { - return this.isLessThan(0); - } - - public boolean isNotNegative() { - return this.isGreaterThanOrEqual(0); - } - - public int abs() { - return Math.abs(this.value); - } - - public int neg() { - return -this.value; - } - - public int add(int v) { - return this.value + v; - } - - public int subtract(int v) { - return this.value - v; - } - - public int multiply(int v) { - return this.value * v; - } - - public int divide(int v) { - return this.value / v; - } - - public int remainder(int v) { - return this.value % v; - } - - public int min(int v) { - return Math.min(this.value, v); - } - - public int max(int v) { - return Math.max(this.value, v); - } - - public double pow(int v) { - return Math.pow(this.value, v); - } - - public int setValue(int value) { - int old = this.value; - this.value = value; - return old; - } - - public int setZero() { - return this.setValue(0); - } - - public int increment() { - return ++this.value; - } - - public int decrement() { - return --this.value; - } - - - // ********** Comparable implementation ********** - - public int compareTo(ReadOnlyIntReference ref) { - int v = ref.getValue(); - return (this.value < v) ? -1 : ((this.value == v) ? 0 : 1); - } - - - // ********** standard methods ********** - - @Override - public SimpleIntReference clone() { - try { - return (SimpleIntReference) super.clone(); - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - @Override - public String toString() { - return '[' + String.valueOf(this.value) + ']'; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleJavaType.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleJavaType.java deleted file mode 100644 index ef47ba3097..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleJavaType.java +++ /dev/null @@ -1,213 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.PrintWriter; -import java.io.Serializable; - -import org.eclipse.jpt.common.utility.JavaType; - -/** - * Straightforward implementation of the {@link JavaType} interface. - */ -public final class SimpleJavaType - implements JavaType, Cloneable, Serializable -{ - - /** - * store the type as a name, so we can reference classes - * that are not loaded - */ - private final String elementTypeName; - - /** - * non-array types have an array depth of zero - */ - private final int arrayDepth; - - private static final String BRACKETS = "[]"; //$NON-NLS-1$ - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a Java type with the specified element type and array depth. - */ - public SimpleJavaType(String elementTypeName, int arrayDepth) { - super(); - if ((elementTypeName == null) || (elementTypeName.length() == 0)) { - throw new IllegalArgumentException("The element type name is required."); //$NON-NLS-1$ - } - if (ClassName.getArrayDepth(elementTypeName) != 0) { // e.g. "[Ljava.lang.Object;" - throw new IllegalArgumentException("The element type must not be an array: " + elementTypeName + '.'); //$NON-NLS-1$ - } - if (arrayDepth < 0) { - throw new IllegalArgumentException("The array depth must be greater than or equal to zero: " + arrayDepth + '.'); //$NON-NLS-1$ - } - if (elementTypeName.equals(void.class.getName()) && (arrayDepth != 0)) { - throw new IllegalArgumentException("'void' must have an array depth of zero: " + arrayDepth + '.'); //$NON-NLS-1$ - } - this.elementTypeName = elementTypeName; - this.arrayDepth = arrayDepth; - } - - /** - * Construct a Java type for the specified class. - * The class name can be in one of the following forms:
    - *
  • java.lang.Object - *
  • int - *
  • java.util.Map$Entry - *
  • [Ljava.lang.Object; - *
  • [I - *
  • [Ljava.util.Map$Entry; - *
- */ - public SimpleJavaType(String javaClassName) { - this(ClassName.getElementTypeName(javaClassName), ClassName.getArrayDepth(javaClassName)); - } - - /** - * Construct a Java type for the specified class. - */ - public SimpleJavaType(Class javaClass) { - this(javaClass.getName()); - } - - - // ********** accessors ********** - - public String getElementTypeName() { - return this.elementTypeName; - } - - public int getArrayDepth() { - return this.arrayDepth; - } - - - // ********** queries ********** - - public boolean isArray() { - return this.arrayDepth > 0; - } - - public boolean isPrimitive() { - return (this.arrayDepth == 0) && ClassName.isPrimitive(this.elementTypeName); - } - - public boolean isPrimitiveWrapper() { - return (this.arrayDepth == 0) && ClassName.isPrimitiveWrapper(this.elementTypeName); - } - - public boolean isVariablePrimitive() { - return (this.arrayDepth == 0) && ClassName.isVariablePrimitive(this.elementTypeName); - } - - public boolean isVariablePrimitiveWrapper() { - return (this.arrayDepth == 0) && ClassName.isVariablePrimitiveWrapper(this.elementTypeName); - } - - public Class getJavaClass() throws ClassNotFoundException { - return ReflectionTools.getClassForTypeDeclaration(this.elementTypeName, this.arrayDepth); - } - - public String getJavaClassName() { - return ReflectionTools.getClassNameForTypeDeclaration(this.elementTypeName, this.arrayDepth); - } - - - // ********** comparison ********** - - public boolean equals(String otherElementTypeName, int otherArrayDepth) { - return (this.arrayDepth == otherArrayDepth) - && this.elementTypeName.equals(otherElementTypeName); - } - - public boolean describes(String className) { - return this.equals(ClassName.getElementTypeName(className), ClassName.getArrayDepth(className)); - } - - public boolean describes(Class javaClass) { - return this.describes(javaClass.getName()); - } - - public boolean equals(JavaType other) { - return this.equals(other.getElementTypeName(), other.getArrayDepth()); - } - - @Override - public boolean equals(Object o) { - return (this == o) ? true : (o instanceof JavaType) ? this.equals((JavaType) o) : false; - } - - @Override - public int hashCode() { - return this.elementTypeName.hashCode() ^ this.arrayDepth; - } - - - // ********** printing and displaying ********** - - public String declaration() { - if (this.arrayDepth == 0) { - return this.getElementTypeNameDeclaration(); - } - StringBuilder sb = new StringBuilder(this.elementTypeName.length() + (2 * this.arrayDepth)); - this.appendDeclarationTo(sb); - return sb.toString(); - } - - public void appendDeclarationTo(StringBuilder sb) { - sb.append(this.getElementTypeNameDeclaration()); - for (int i = this.arrayDepth; i-- > 0; ) { - sb.append(BRACKETS); - } - } - - public void printDeclarationOn(PrintWriter pw) { - pw.print(this.getElementTypeNameDeclaration()); - for (int i = this.arrayDepth; i-- > 0; ) { - pw.print(BRACKETS); - } - } - - /** - * The '$' version of the name is used in {@link Class#forName(String)}, - * but the '.' version of the name is used in source code. - * Very irritating.... - */ - private String getElementTypeNameDeclaration() { - return this.elementTypeName.replace('$', '.'); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(this.getClass().getSimpleName()); - sb.append('('); - this.appendDeclarationTo(sb); - sb.append(')'); - return sb.toString(); - } - - - // ********** cloning ********** - - @Override - public Object clone() { - try { - return super.clone(); - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleMethodSignature.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleMethodSignature.java deleted file mode 100644 index 0a4b523c3e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleMethodSignature.java +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.PrintWriter; -import java.io.Serializable; -import java.lang.reflect.Method; -import java.util.Arrays; - -import org.eclipse.jpt.common.utility.JavaType; -import org.eclipse.jpt.common.utility.MethodSignature; - -/** - * Straightforward implementation of the MethodSignature interface. - */ -public final class SimpleMethodSignature - implements MethodSignature, Cloneable, Serializable -{ - private final String name; - - /** - * store the parameter types as names, so we can reference classes - * that are not loaded - */ - private final JavaType[] parameterTypes; - - public static final JavaType[] EMPTY_PARAMETER_TYPES = new JavaType[0]; - - private static final String PARAMETER_SEPARATOR = ", "; //$NON-NLS-1$ - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a method signature with the specified name and - * no parameter types. - */ - public SimpleMethodSignature(String name) { - this(name, EMPTY_PARAMETER_TYPES); - } - - /** - * Construct a method signature with the specified name and parameter - * types. - */ - public SimpleMethodSignature(String name, JavaType... parameterTypes) { - super(); - if ((name == null) || (name.length() == 0)) { - throw new IllegalArgumentException("The name is required."); //$NON-NLS-1$ - } - if (parameterTypes == null) { - throw new IllegalArgumentException("The parameter types are required."); //$NON-NLS-1$ - } - checkParameterTypes(parameterTypes); - this.name = name; - this.parameterTypes = parameterTypes; - } - - private static void checkParameterTypes(JavaType[] parameterTypes) { - for (int i = 0; i < parameterTypes.length; i++) { - if (parameterTypes[i] == null) { - throw new IllegalArgumentException("Missing parameter type: " + i); //$NON-NLS-1$ - } - if (parameterTypes[i].getElementTypeName().equals(void.class.getName())) { - throw new IllegalArgumentException("A parameter type of 'void' is not allowed: " + i); //$NON-NLS-1$ - } - } - } - - /** - * Construct a method signature with the specified name and parameter - * types. - */ - public SimpleMethodSignature(String name, String... parameterTypeNames) { - this(name, buildParameterTypes(parameterTypeNames)); - } - - private static JavaType[] buildParameterTypes(String[] parameterTypeNames) { - if (parameterTypeNames == null) { - throw new IllegalArgumentException("The parameter type names are required."); //$NON-NLS-1$ - } - JavaType[] parameterTypes = new JavaType[parameterTypeNames.length]; - for (int i = 0; i < parameterTypeNames.length; i++) { - if (parameterTypeNames[i] == null) { - throw new IllegalArgumentException("Missing parameter type name: " + i); //$NON-NLS-1$ - } - parameterTypes[i] = new SimpleJavaType(parameterTypeNames[i]); - } - return parameterTypes; - } - - /** - * Construct a method signature with the specified name and parameter - * types. - */ - public SimpleMethodSignature(String name, Class... parameterJavaClasses) { - this(name, buildParameterTypeNames(parameterJavaClasses)); - } - - private static String[] buildParameterTypeNames(Class[] parameterJavaClasses) { - if (parameterJavaClasses == null) { - throw new IllegalArgumentException("The parameter Java classes are required."); //$NON-NLS-1$ - } - String[] parameterTypeNames = new String[parameterJavaClasses.length]; - for (int i = 0; i < parameterJavaClasses.length; i++) { - if (parameterJavaClasses[i] == null) { - throw new IllegalArgumentException("Missing parameter Java class: " + i); //$NON-NLS-1$ - } - parameterTypeNames[i] = parameterJavaClasses[i].getName(); - } - return parameterTypeNames; - } - - /** - * Construct a method signature for the specified Java method. - */ - public SimpleMethodSignature(Method method) { - this(method.getName(), method.getParameterTypes()); - } - - - // ********** accessors ********** - - public String getName() { - return this.name; - } - - public JavaType[] getParameterTypes() { - return this.parameterTypes; - } - - - // ********** comparison ********** - - public boolean describes(Method method) { - return this.name.equals(method.getName()) - && this.parameterTypesDescribe(method.getParameterTypes()); - } - - private boolean parameterTypesDescribe(Class[] otherParameterTypes) { - JavaType[] localParameterTypes = this.parameterTypes; - int len = localParameterTypes.length; - if (otherParameterTypes.length != len) { - return false; - } - for (int i = len; i-- > 0; ) { - if ( ! localParameterTypes[i].describes(otherParameterTypes[i])) { - return false; - } - } - return true; - } - - public boolean equals(String otherName, JavaType[] otherParameterTypes) { - return this.name.equals(otherName) - && Arrays.equals(this.parameterTypes, otherParameterTypes); - } - - public boolean equals(MethodSignature other) { - return this.equals(other.getName(), other.getParameterTypes()); - } - - @Override - public boolean equals(Object o) { - return (this == o) ? true : (o instanceof MethodSignature) ? this.equals((MethodSignature) o) : false; - } - - @Override - public int hashCode() { - return this.name.hashCode() ^ Arrays.hashCode(this.parameterTypes); - } - - - // ********** printing and displaying ********** - - public String getSignature() { - StringBuilder sb = new StringBuilder(200); - this.appendSignatureTo(sb); - return sb.toString(); - } - - public void appendSignatureTo(StringBuilder sb) { - sb.append(this.name); - sb.append('('); - JavaType[] localParameterTypes = this.parameterTypes; - int len = localParameterTypes.length; - for (int i = 0; i < len; i++) { - if (i != 0) { - sb.append(PARAMETER_SEPARATOR); - } - localParameterTypes[i].appendDeclarationTo(sb); - } - sb.append(')'); - } - - public void printSignatureOn(PrintWriter pw) { - pw.print(this.name); - pw.print('('); - JavaType[] localParameterTypes = this.parameterTypes; - int len = localParameterTypes.length; - for (int i = 0; i < len; i++) { - if (i != 0) { - pw.print(PARAMETER_SEPARATOR); - } - localParameterTypes[i].printDeclarationOn(pw); - } - pw.print(')'); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(200); - sb.append(this.getClass().getSimpleName()); - sb.append('('); - this.appendSignatureTo(sb); - sb.append(')'); - return sb.toString(); - } - - - // ********** cloning ********** - - @Override - public Object clone() { - try { - return super.clone(); - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleObjectReference.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleObjectReference.java deleted file mode 100644 index 5134aa98a3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleObjectReference.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import org.eclipse.jpt.common.utility.ObjectReference; - -/** - * Provide a container for passing an object that can be changed by the recipient. - * - * @see SynchronizedObject - */ -public class SimpleObjectReference - implements ObjectReference, Cloneable, Serializable -{ - /** Backing value. */ - private volatile V value; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Create an object reference with the specified initial value. - */ - public SimpleObjectReference(V value) { - super(); - this.value = value; - } - - /** - * Create an object reference with an initial value of - * null. - */ - public SimpleObjectReference() { - this(null); - } - - - // ********** value ********** - - public V getValue() { - return this.value; - } - - public boolean valueEquals(Object object) { - return Tools.valuesAreEqual(this.value, object); - } - - public boolean valueNotEqual(Object object) { - return Tools.valuesAreDifferent(this.value, object); - } - - public boolean isNull() { - return this.value == null; - } - - public boolean isNotNull() { - return this.value != null; - } - - public V setValue(V value) { - V old = this.value; - this.value = value; - return old; - } - - public V setNull() { - return this.setValue(null); - } - - - // ********** standard methods ********** - - @Override - public SimpleObjectReference clone() { - try { - @SuppressWarnings("unchecked") - SimpleObjectReference clone = (SimpleObjectReference) super.clone(); - return clone; - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - @Override - public String toString() { - return '[' + String.valueOf(this.value) + ']'; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleQueue.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleQueue.java deleted file mode 100644 index 02e026c7db..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleQueue.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import java.util.Collection; -import java.util.LinkedList; - -/** - * Straightforward implementation of the {@link Queue} interface. - */ -public class SimpleQueue - implements Queue, Cloneable, Serializable -{ - private LinkedList elements; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct an empty queue. - */ - public SimpleQueue() { - super(); - this.elements = new LinkedList(); - } - - /** - * Construct a queue containing the elements of the specified - * collection. The queue will dequeue its elements in the same - * order they are returned by the collection's iterator (i.e. the - * first element returned by the collection's iterator will be the - * first element returned by {@link #dequeue()}). - */ - public SimpleQueue(Collection c) { - super(); - this.elements = new LinkedList(c); - } - - - // ********** Queue implementation ********** - - public void enqueue(E o) { - this.elements.addLast(o); - } - - public E dequeue() { - return this.elements.removeFirst(); - } - - public E peek() { - return this.elements.getFirst(); - } - - public boolean isEmpty() { - return this.elements.isEmpty(); - } - - - // ********** Cloneable implementation ********** - - @Override - public SimpleQueue clone() { - try { - @SuppressWarnings("unchecked") - SimpleQueue clone = (SimpleQueue) super.clone(); - @SuppressWarnings("unchecked") - LinkedList ll = (LinkedList) this.elements.clone(); - clone.elements = ll; - return clone; - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.peek()); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleStack.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleStack.java deleted file mode 100644 index 3816b49a87..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleStack.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import java.util.Collection; -import java.util.EmptyStackException; -import java.util.LinkedList; -import java.util.NoSuchElementException; - -/** - * Straightforward implementation of the {@link Stack} interface. - */ -public class SimpleStack - implements Stack, Cloneable, Serializable -{ - private LinkedList elements; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct an empty stack. - */ - public SimpleStack() { - super(); - this.elements = new LinkedList(); - } - - /** - * Construct a stack containing the elements of the specified - * collection. The stack will pop its elements in reverse of the - * order they are returned by the collection's iterator (i.e. the - * last element returned by the collection's iterator will be the - * first element returned by {@link #pop()}). - */ - public SimpleStack(Collection collection) { - super(); - this.elements = new LinkedList(collection); - } - - - // ********** Stack implementation ********** - - public void push(E element) { - this.elements.addLast(element); - } - - public E pop() { - try { - return this.elements.removeLast(); - } catch (NoSuchElementException ex) { - throw new EmptyStackException(); - } - } - - public E peek() { - try { - return this.elements.getLast(); - } catch (NoSuchElementException ex) { - throw new EmptyStackException(); - } - } - - public boolean isEmpty() { - return this.elements.isEmpty(); - } - - - // ********** standard methods ********** - - @Override - public SimpleStack clone() { - try { - @SuppressWarnings("unchecked") - SimpleStack clone = (SimpleStack) super.clone(); - @SuppressWarnings("unchecked") - LinkedList ll = (LinkedList) this.elements.clone(); - clone.elements = ll; - return clone; - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.peek()); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleStringMatcher.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleStringMatcher.java deleted file mode 100644 index 5f85f7895c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleStringMatcher.java +++ /dev/null @@ -1,259 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import java.util.regex.Pattern; -import org.eclipse.jpt.common.utility.Filter; - -// TODO the regex code is not very fast - we could probably do better, -// hand-coding the matching algorithm (eclipse StringMatcher?) -/** - * This class implements a simple string-matching algorithm that is a little - * more user-friendly than standard regular expressions. Instantiate a - * string matcher with a filter pattern and then you can use the matcher - * to determine whether another string (or object) matches the pattern. - * You can also specify whether the matching should be case-sensitive. - * - * The pattern can contain two "meta-characters": - * '*' will match any set of zero or more characters - * '?' will match any single character - * - * Subclasses can override #prefix() and/or #suffix() to change what - * strings are prepended or appended to the original pattern string. - * This can offer a slight performance improvement over concatenating - * strings before calling #setPatternString(String). - * By default, a '*' is appended to every string. - * - * This class also uses the string-matching algorithm to "filter" objects - * (and, as a result, also implements the Filter interface). - * A string converter is used to determine what string aspect of the - * object is compared to the pattern. By default the string returned - * by the object's #toString() method is passed to the pattern matcher. - */ -public class SimpleStringMatcher - implements StringMatcher, Filter, Serializable -{ - - /** An adapter that converts the objects into strings to be matched with the pattern. */ - private StringConverter stringConverter; - - /** The string used to construct the regular expression pattern. */ - private String patternString; - - /** Whether the matcher ignores case - the default is true. */ - private boolean ignoresCase; - - /** The regular expression pattern built from the pattern string. */ - private Pattern pattern; - - /** A list of the meta-characters we need to escape if found in the pattern string. */ - public static final char[] REG_EX_META_CHARS = { '(', '[', '{', '\\', '^', '$', '|', ')', '?', '*', '+', '.' }; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a string matcher with an pattern that will match - * any string and ignore case. - */ - public SimpleStringMatcher() { - this("*"); //$NON-NLS-1$ - } - - /** - * Construct a string matcher with the specified pattern - * that will ignore case. - */ - public SimpleStringMatcher(String patternString) { - this(patternString, true); - } - - /** - * Construct a string matcher with the specified pattern that will - * ignore case as specified. - */ - public SimpleStringMatcher(String patternString, boolean ignoresCase) { - super(); - this.patternString = patternString; - this.ignoresCase = ignoresCase; - this.initialize(); - } - - - // ********** initialization ********** - - protected void initialize() { - this.stringConverter = StringConverter.Default.instance(); - this.rebuildPattern(); - } - - /** - * Given the current pattern string and case-sensitivity setting, - * re-build the regular expression pattern. - */ - protected synchronized void rebuildPattern() { - this.pattern = this.buildPattern(); - } - - /** - * Given the current pattern string and case-sensitivity setting, - * build and return a regular expression pattern that can be used - * to match strings. - */ - protected Pattern buildPattern() { - int patternFlags = 0x0; - if (this.ignoresCase) { - patternFlags = Pattern.UNICODE_CASE | Pattern.CASE_INSENSITIVE; - } - return Pattern.compile(this.convertToRegEx(this.patternString), patternFlags); - } - - - // ********** StringMatcher implementation ********** - - public synchronized void setPatternString(String patternString) { - this.patternString = patternString; - this.rebuildPattern(); - } - - /** - * Return whether the specified string matches the pattern. - */ - public synchronized boolean matches(String string) { - return this.pattern.matcher(string).matches(); - } - - - // ********** Filter implementation ********** - - public synchronized boolean accept(T o) { - return this.matches(this.stringConverter.convertToString(o)); - } - - - // ********** accessors ********** - - /** - * Return the string converter used to convert the objects - * passed to the matcher into strings. - */ - public synchronized StringConverter stringConverter() { - return this.stringConverter; - } - - /** - * Set the string converter used to convert the objects - * passed to the matcher into strings. - */ - public synchronized void setStringConverter(StringConverter stringConverter) { - this.stringConverter = stringConverter; - } - - /** - * Return the original pattern string. - */ - public synchronized String patternString() { - return this.patternString; - } - - /** - * Return whether the matcher ignores case. - */ - public synchronized boolean ignoresCase() { - return this.ignoresCase; - } - - /** - * Set whether the matcher ignores case. - */ - public synchronized void setIgnoresCase(boolean ignoresCase) { - this.ignoresCase = ignoresCase; - this.rebuildPattern(); - } - - /** - * Return the regular expression pattern. - */ - public synchronized Pattern pattern() { - return this.pattern; - } - - - // ********** other public API ********** - - /** - * Return the regular expression corresponding to - * the original pattern string. - */ - public synchronized String regularExpression() { - return this.convertToRegEx(this.patternString); - } - - - // ********** converting ********** - - /** - * Convert the specified string to a regular expression. - */ - protected String convertToRegEx(String string) { - StringBuffer sb = new StringBuffer(string.length() + 10); - this.convertToRegExOn(this.prefix(), sb); - this.convertToRegExOn(string, sb); - this.convertToRegExOn(this.suffix(), sb); - return sb.toString(); - } - - /** - * Return any prefix that should be prepended to the original - * string. By default, there is no prefix. - */ - protected String prefix() { - return ""; //$NON-NLS-1$ - } - - /** - * Return any suffix that should be appended to the original - * string. Since this class is typically used in UI situation where - * the user is typing in a pattern used to filter a list, the default - * suffix is a wildcard character. - */ - protected String suffix() { - return "*"; //$NON-NLS-1$ - } - - /** - * Convert the specified string to a regular expression. - */ - protected void convertToRegExOn(String string, StringBuffer sb) { - char[] charArray = string.toCharArray(); - int length = charArray.length; - for (int i = 0; i < length; i++) { - char c = charArray[i]; - // convert user-friendly meta-chars into regex meta-chars - if (c == '*') { - sb.append(".*"); //$NON-NLS-1$ - continue; - } - if (c == '?') { - sb.append('.'); - continue; - } - // escape regex meta-chars - if (ArrayTools.contains(REG_EX_META_CHARS, c)) { - sb.append('\\'); - } - sb.append(c); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleThreadFactory.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleThreadFactory.java deleted file mode 100644 index 4c2bbb037d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SimpleThreadFactory.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.util.concurrent.ThreadFactory; - -/** - * A SimpleThreadFactory is a straightforward implementation of - * the JDK {@link ThreadFactory}. - */ -public class SimpleThreadFactory - implements ThreadFactory -{ - // singleton - private static final SimpleThreadFactory INSTANCE = new SimpleThreadFactory(); - - /** - * Return the singleton. - */ - public static ThreadFactory instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private SimpleThreadFactory() { - super(); - } - - public Thread newThread(Runnable r) { - return new Thread(r); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Stack.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Stack.java deleted file mode 100644 index 88186bffe3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Stack.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import java.util.EmptyStackException; - -/** - * Interface defining the classic stack behavior, - * without the backdoors allowed by {@link java.util.Stack}. - * - * @param the type of elements contained by the stack - */ -public interface Stack { - - /** - * "Push" the specified item on to the top of the stack. - */ - void push(E element); - - /** - * "Pop" an item from the top of the stack. - */ - E pop(); - - /** - * Return the item on the top of the stack - * without removing it from the stack. - */ - E peek(); - - /** - * Return whether the stack is empty. - */ - boolean isEmpty(); - - - final class Empty implements Stack, Serializable { - @SuppressWarnings("rawtypes") - public static final Stack INSTANCE = new Empty(); - @SuppressWarnings("unchecked") - public static Stack instance() { - return INSTANCE; - } - // ensure single instance - private Empty() { - super(); - } - public void push(E element) { - throw new UnsupportedOperationException(); - } - public E pop() { - throw new EmptyStackException(); - } - public E peek() { - throw new EmptyStackException(); - } - public boolean isEmpty() { - return true; - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StatefulCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StatefulCommandExecutor.java deleted file mode 100644 index 97e99de81c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StatefulCommandExecutor.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import org.eclipse.jpt.common.utility.CommandExecutor; - -/** - * This interface allows clients to control how a command is executed. - * This is useful when the server provides the command but the client provides - * the context (e.g. the client would like to dispatch the command to the UI - * thread). - */ -public interface StatefulCommandExecutor - extends CommandExecutor -{ - /** - * Start the command executor. - */ - void start(); - - /** - * Stop the command executor. - */ - void stop(); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringConverter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringConverter.java deleted file mode 100644 index 412c9c199f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringConverter.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; - -/** - * Used by various "pluggable" classes to transform objects - * into strings. - */ -public interface StringConverter { - - /** - * Convert the specified object into a string. - * The semantics of "convert" is determined by the - * contract between the client and the server. - */ - String convertToString(T o); - - - final class Default implements StringConverter, Serializable { - @SuppressWarnings("rawtypes") - public static final StringConverter INSTANCE = new Default(); - @SuppressWarnings("unchecked") - public static StringConverter instance() { - return INSTANCE; - } - // ensure single instance - private Default() { - super(); - } - // simply return the object's #toString() result - public String convertToString(S o) { - return (o == null) ? null : o.toString(); - } - @Override - public String toString() { - return "StringConverter.Default"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - final class Disabled implements StringConverter, Serializable { - @SuppressWarnings("rawtypes") - public static final StringConverter INSTANCE = new Disabled(); - @SuppressWarnings("unchecked") - public static StringConverter instance() { - return INSTANCE; - } - // ensure single instance - private Disabled() { - super(); - } - // throw an exception - public String convertToString(S o) { - throw new UnsupportedOperationException(); - } - @Override - public String toString() { - return "StringConverter.Disabled"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringMatcher.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringMatcher.java deleted file mode 100644 index c66900e3cb..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringMatcher.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; - -/** - * This interface defines a simple API for allowing "pluggable" - * string matchers that can be configured with a pattern string - * then used to determine what strings match the pattern. - */ -public interface StringMatcher { - - /** - * Set the pattern string used to determine future - * matches. The format and semantics of the pattern - * string are determined by the contract between the - * client and the server. - */ - void setPatternString(String patternString); - - /** - * Return whether the specified string matches the - * established pattern string. The semantics of a match - * is determined by the contract between the - * client and the server. - */ - boolean matches(String string); - - - final class Null implements StringMatcher, Serializable { - public static final StringMatcher INSTANCE = new Null(); - public static StringMatcher instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - public void setPatternString(String patternString) { - // ignore the pattern string - } - public boolean matches(String string) { - // everything is a match - return true; - } - @Override - public String toString() { - return "StringMatcher.Null"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringTools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringTools.java deleted file mode 100644 index 0eab3b6e26..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/StringTools.java +++ /dev/null @@ -1,4708 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.IOException; -import java.io.Writer; -import java.util.Arrays; -import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; - -/** - * Convenience methods related to the java.lang.String class. - * - * As of jdk 1.5, it's tempting to convert all of these methods to use - * java.lang.Appendable (instead of StringBuffer, StringBuilder, and Writer); - * but all the Appendable methods throw java.io.IOException (yech) and we - * [might?] get a bit better performance invoking methods on classes than - * we get on interfaces. :-) - */ -public final class StringTools { - - /** carriage return */ - public static final String CR = System.getProperty("line.separator"); //$NON-NLS-1$ - - /** double quote */ - public static final char QUOTE = '"'; - - /** parenthesis */ - public static final char OPEN_PARENTHESIS = '('; - public static final char CLOSE_PARENTHESIS = ')'; - - /** brackets */ - public static final char OPEN_BRACKET = '['; - public static final char CLOSE_BRACKET = ']'; - - /** brackets */ - public static final char OPEN_BRACE = '{'; - public static final char CLOSE_BRACE = '}'; - - /** brackets */ - public static final char OPEN_CHEVRON = '<'; - public static final char CLOSE_CHEVRON = '>'; - - /** empty string */ - public static final String EMPTY_STRING = ""; //$NON-NLS-1$ - - /** empty char array */ - public static final char[] EMPTY_CHAR_ARRAY = new char[0]; - - /** empty string array */ - public static final String[] EMPTY_STRING_ARRAY = new String[0]; - - - - // ********** padding/truncating ********** - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with spaces at the end. - * String#pad(int) - */ - public static String pad(String string, int length) { - return pad(string, length, ' '); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with spaces at the end. - * String#padOn(int, Writer) - */ - public static void padOn(String string, int length, Writer writer) { - padOn(string, length, ' ', writer); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with spaces at the end. - * String#padOn(int, StringBuffer) - */ - public static void padOn(String string, int length, StringBuffer sb) { - padOn(string, length, ' ', sb); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with spaces at the end. - * String#padOn(int, StringBuilder) - */ - public static void padOn(String string, int length, StringBuilder sb) { - padOn(string, length, ' ', sb); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with the - * specified character at the end. - * String#pad(int, char) - */ - public static String pad(String string, int length, char c) { - int stringLength = string.length(); - if (stringLength > length) { - throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (stringLength == length) { - return string; - } - return pad_(string, length, c); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with the - * specified character at the end. - * String#padOn(int, char, Writer) - */ - public static void padOn(String string, int length, char c, Writer writer) { - int stringLength = string.length(); - if (stringLength > length) { - throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (stringLength == length) { - writeStringOn(string, writer); - } else { - padOn_(string, length, c, writer); - } - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with the - * specified character at the end. - * String#padOn(int, char, StringBuffer) - */ - public static void padOn(String string, int length, char c, StringBuffer sb) { - int stringLength = string.length(); - if (stringLength > length) { - throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (stringLength == length) { - sb.append(string); - } else { - padOn_(string, length, c, sb); - } - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with the - * specified character at the end. - * String#padOn(int, char, StringBuilder) - */ - public static void padOn(String string, int length, char c, StringBuilder sb) { - int stringLength = string.length(); - if (stringLength > length) { - throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (stringLength == length) { - sb.append(string); - } else { - padOn_(string, length, c, sb); - } - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with spaces at the end. - * String#pad(int) - */ - public static char[] pad(char[] string, int length) { - return pad(string, length, ' '); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with spaces at the end. - * String#padOn(int, writer) - */ - public static void padOn(char[] string, int length, Writer writer) { - padOn(string, length, ' ', writer); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with spaces at the end. - * String#padOn(int, StringBuffer) - */ - public static void padOn(char[] string, int length, StringBuffer sb) { - padOn(string, length, ' ', sb); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with spaces at the end. - * String#padOn(int, StringBuilder) - */ - public static void padOn(char[] string, int length, StringBuilder sb) { - padOn(string, length, ' ', sb); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with the - * specified character at the end. - * String#pad(int, char) - */ - public static char[] pad(char[] string, int length, char c) { - int stringLength = string.length; - if (stringLength > length) { - throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (stringLength == length) { - return string; - } - return pad_(string, length, c); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with the - * specified character at the end. - * String#padOn(int, char, Writer) - */ - public static void padOn(char[] string, int length, char c, Writer writer) { - int stringLength = string.length; - if (stringLength > length) { - throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (stringLength == length) { - writeStringOn(string, writer); - } else { - padOn_(string, length, c, writer); - } - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with the - * specified character at the end. - * String#padOn(int, char, StringBuffer) - */ - public static void padOn(char[] string, int length, char c, StringBuffer sb) { - int stringLength = string.length; - if (stringLength > length) { - throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (stringLength == length) { - sb.append(string); - } else { - padOn_(string, length, c, sb); - } - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with the - * specified character at the end. - * String#padOn(int, char, StringBuilder) - */ - public static void padOn(char[] string, int length, char c, StringBuilder sb) { - int stringLength = string.length; - if (stringLength > length) { - throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (stringLength == length) { - sb.append(string); - } else { - padOn_(string, length, c, sb); - } - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, it is truncated. - * If it is shorter than the specified length, it is padded with spaces at the end. - * String#padOrTruncate(int) - */ - public static String padOrTruncate(String string, int length) { - return padOrTruncate(string, length, ' '); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, it is truncated. - * If it is shorter than the specified length, it is padded with spaces at the end. - * String#padOrTruncateOn(int, Writer) - */ - public static void padOrTruncateOn(String string, int length, Writer writer) { - padOrTruncateOn(string, length, ' ', writer); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, it is truncated. - * If it is shorter than the specified length, it is padded with spaces at the end. - * String#padOrTruncateOn(int, StringBuffer) - */ - public static void padOrTruncateOn(String string, int length, StringBuffer sb) { - padOrTruncateOn(string, length, ' ', sb); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, it is truncated. - * If it is shorter than the specified length, it is padded with spaces at the end. - * String#padOrTruncateOn(int, StringBuilder) - */ - public static void padOrTruncateOn(String string, int length, StringBuilder sb) { - padOrTruncateOn(string, length, ' ', sb); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, it is truncated. - * If it is shorter than the specified length, it is padded with the - * specified character at the end. - * String#padOrTruncate(int, char) - */ - public static String padOrTruncate(String string, int length, char c) { - int stringLength = string.length(); - if (stringLength == length) { - return string; - } - if (stringLength > length) { - return string.substring(0, length); - } - return pad_(string, length, c); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, it is truncated. - * If it is shorter than the specified length, it is padded with the - * specified character at the end. - * String#padOrTruncateOn(int, char, Writer) - */ - public static void padOrTruncateOn(String string, int length, char c, Writer writer) { - int stringLength = string.length(); - if (stringLength == length) { - writeStringOn(string, writer); - } else if (stringLength > length) { - writeStringOn(string.substring(0, length), writer); - } else { - padOn_(string, length, c, writer); - } - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, it is truncated. - * If it is shorter than the specified length, it is padded with the - * specified character at the end. - * String#padOrTruncateOn(int, char, StringBuffer) - */ - public static void padOrTruncateOn(String string, int length, char c, StringBuffer sb) { - int stringLength = string.length(); - if (stringLength == length) { - sb.append(string); - } else if (stringLength > length) { - sb.append(string.substring(0, length)); - } else { - padOn_(string, length, c, sb); - } - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, it is truncated. - * If it is shorter than the specified length, it is padded with the - * specified character at the end. - * String#padOrTruncateOn(int, char, StringBuilder) - */ - public static void padOrTruncateOn(String string, int length, char c, StringBuilder sb) { - int stringLength = string.length(); - if (stringLength == length) { - sb.append(string); - } else if (stringLength > length) { - sb.append(string.substring(0, length)); - } else { - padOn_(string, length, c, sb); - } - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, it is truncated. - * If it is shorter than the specified length, it is padded with spaces at the end. - * String#padOrTruncate(int) - */ - public static char[] padOrTruncate(char[] string, int length) { - return padOrTruncate(string, length, ' '); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, it is truncated. - * If it is shorter than the specified length, it is padded with spaces at the end. - * String#padOrTruncateOn(int, Writer) - */ - public static void padOrTruncateOn(char[] string, int length, Writer writer) { - padOrTruncateOn(string, length, ' ', writer); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, it is truncated. - * If it is shorter than the specified length, it is padded with spaces at the end. - * String#padOrTruncateOn(int, StringBuffer) - */ - public static void padOrTruncate(char[] string, int length, StringBuffer sb) { - padOrTruncateOn(string, length, ' ', sb); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, it is truncated. - * If it is shorter than the specified length, it is padded with spaces at the end. - * String#padOrTruncateOn(int, StringBuilder) - */ - public static void padOrTruncate(char[] string, int length, StringBuilder sb) { - padOrTruncateOn(string, length, ' ', sb); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, it is truncated. - * If it is shorter than the specified length, it is padded with the - * specified character at the end. - * String#padOrTruncate(int, char) - */ - public static char[] padOrTruncate(char[] string, int length, char c) { - int stringLength = string.length; - if (stringLength == length) { - return string; - } - if (stringLength > length) { - char[] result = new char[length]; - System.arraycopy(string, 0, result, 0, length); - return result; - } - return pad_(string, length, c); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, it is truncated. - * If it is shorter than the specified length, it is padded with the - * specified character at the end. - * String#padOrTruncateOn(int, char, Writer) - */ - public static void padOrTruncateOn(char[] string, int length, char c, Writer writer) { - int stringLength = string.length; - if (stringLength == length) { - writeStringOn(string, writer); - } else if (stringLength > length) { - writeStringOn(string, 0, length, writer); - } else { - padOn_(string, length, c, writer); - } - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, it is truncated. - * If it is shorter than the specified length, it is padded with the - * specified character at the end. - * String#padOrTruncateOn(int, char, StringBuffer) - */ - public static void padOrTruncateOn(char[] string, int length, char c, StringBuffer sb) { - int stringLength = string.length; - if (stringLength == length) { - sb.append(string); - } else if (stringLength > length) { - sb.append(string, 0, length); - } else { - padOn_(string, length, c, sb); - } - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, it is truncated. - * If it is shorter than the specified length, it is padded with the - * specified character at the end. - * String#padOrTruncateOn(int, char, StringBuilder) - */ - public static void padOrTruncateOn(char[] string, int length, char c, StringBuilder sb) { - int stringLength = string.length; - if (stringLength == length) { - sb.append(string); - } else if (stringLength > length) { - sb.append(string, 0, length); - } else { - padOn_(string, length, c, sb); - } - } - - /* - * Pad the specified string without validating the parms. - */ - private static String pad_(String string, int length, char c) { - return new String(pad_(string.toCharArray(), length, c)); - } - - /* - * Pad the specified string without validating the parms. - */ - private static void padOn_(String string, int length, char c, Writer writer) { - writeStringOn(string, writer); - fill_(string, length, c, writer); - } - - /* - * Add enough characters to the specified writer to compensate for - * the difference between the specified string and specified length. - */ - private static void fill_(String string, int length, char c, Writer writer) { - fill_(string.length(), length, c, writer); - } - - /* - * Add enough characters to the specified writer to compensate for - * the difference between the specified string and specified length. - */ - private static void fill_(char[] string, int length, char c, Writer writer) { - fill_(string.length, length, c, writer); - } - - /* - * Add enough characters to the specified writer to compensate for - * the difference between the specified string and specified length. - */ - private static void fill_(int stringLength, int length, char c, Writer writer) { - writeStringOn(ArrayTools.fill(new char[length - stringLength], c), writer); - } - - /* - * Pad the specified string without validating the parms. - */ - private static void padOn_(String string, int length, char c, StringBuffer sb) { - sb.append(string); - fill_(string, length, c, sb); - } - - /* - * Add enough characters to the specified string buffer to compensate for - * the difference between the specified string and specified length. - */ - private static void fill_(String string, int length, char c, StringBuffer sb) { - fill_(string.length(), length, c, sb); - } - - /* - * Add enough characters to the specified string buffer to compensate for - * the difference between the specified string and specified length. - */ - private static void fill_(char[] string, int length, char c, StringBuffer sb) { - fill_(string.length, length, c, sb); - } - - /* - * Add enough characters to the specified string buffer to compensate for - * the difference between the specified string and specified length. - */ - private static void fill_(int stringLength, int length, char c, StringBuffer sb) { - sb.append(ArrayTools.fill(new char[length - stringLength], c)); - } - - /* - * Pad the specified string without validating the parms. - */ - private static void padOn_(String string, int length, char c, StringBuilder sb) { - sb.append(string); - fill_(string, length, c, sb); - } - - /* - * Add enough characters to the specified string builder to compensate for - * the difference between the specified string and specified length. - */ - private static void fill_(String string, int length, char c, StringBuilder sb) { - fill_(string.length(), length, c, sb); - } - - /* - * Add enough characters to the specified string builder to compensate for - * the difference between the specified string and specified length. - */ - private static void fill_(char[] string, int length, char c, StringBuilder sb) { - fill_(string.length, length, c, sb); - } - - /* - * Add enough characters to the specified string builder to compensate for - * the difference between the specified string and specified length. - */ - private static void fill_(int stringLength, int length, char c, StringBuilder sb) { - sb.append(ArrayTools.fill(new char[length - stringLength], c)); - } - - /* - * Pad the specified string without validating the parms. - */ - private static char[] pad_(char[] string, int length, char c) { - char[] result = new char[length]; - int stringLength = string.length; - System.arraycopy(string, 0, result, 0, stringLength); - Arrays.fill(result, stringLength, length, c); - return result; - } - - /* - * Pad the specified string without validating the parms. - */ - private static void padOn_(char[] string, int length, char c, Writer writer) { - writeStringOn(string, writer); - fill_(string, length, c, writer); - } - - /* - * Pad the specified string without validating the parms. - */ - private static void padOn_(char[] string, int length, char c, StringBuffer sb) { - sb.append(string); - fill_(string, length, c, sb); - } - - /* - * Pad the specified string without validating the parms. - */ - private static void padOn_(char[] string, int length, char c, StringBuilder sb) { - sb.append(string); - fill_(string, length, c, sb); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with zeros at the front. - * String#zeroPad(int) - */ - public static String zeroPad(String string, int length) { - return frontPad(string, length, '0'); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with zeros at the front. - * String#zeroPadOn(int, Writer) - */ - public static void zeroPadOn(String string, int length, Writer writer) { - frontPadOn(string, length, '0', writer); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with zeros at the front. - * String#zeroPadOn(int, StringBuffer) - */ - public static void zeroPadOn(String string, int length, StringBuffer sb) { - frontPadOn(string, length, '0', sb); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with zeros at the front. - * String#zeroPadOn(int, StringBuilder) - */ - public static void zeroPadOn(String string, int length, StringBuilder sb) { - frontPadOn(string, length, '0', sb); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with the - * specified character at the front. - * String#frontPad(int, char) - */ - public static String frontPad(String string, int length, char c) { - int stringLength = string.length(); - if (stringLength > length) { - throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (stringLength == length) { - return string; - } - return frontPad_(string, length, c); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with the - * specified character at the front. - * String#frontPadOn(int, char, Writer) - */ - public static void frontPadOn(String string, int length, char c, Writer writer) { - int stringLength = string.length(); - if (stringLength > length) { - throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (stringLength == length) { - writeStringOn(string, writer); - } else { - frontPadOn_(string, length, c, writer); - } - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with the - * specified character at the front. - * String#frontPadOn(int, char, StringBuffer) - */ - public static void frontPadOn(String string, int length, char c, StringBuffer sb) { - int stringLength = string.length(); - if (stringLength > length) { - throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (stringLength == length) { - sb.append(string); - } else { - frontPadOn_(string, length, c, sb); - } - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with the - * specified character at the front. - * String#frontPadOn(int, char, StringBuilder) - */ - public static void frontPadOn(String string, int length, char c, StringBuilder sb) { - int stringLength = string.length(); - if (stringLength > length) { - throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (stringLength == length) { - sb.append(string); - } else { - frontPadOn_(string, length, c, sb); - } - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with zeros at the front. - * String#zeroPad(int) - */ - public static char[] zeroPad(char[] string, int length) { - return frontPad(string, length, '0'); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with zeros at the front. - * String#zeroPadOn(int, Writer) - */ - public static void zeroPadOn(char[] string, int length, Writer writer) { - frontPadOn(string, length, '0', writer); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with zeros at the front. - * String#zeroPadOn(int, StringBuffer) - */ - public static void zeroPadOn(char[] string, int length, StringBuffer sb) { - frontPadOn(string, length, '0', sb); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with zeros at the front. - * String#zeroPadOn(int, StringBuilder) - */ - public static void zeroPadOn(char[] string, int length, StringBuilder sb) { - frontPadOn(string, length, '0', sb); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with the - * specified character at the front. - * String#frontPad(int, char) - */ - public static char[] frontPad(char[] string, int length, char c) { - int stringLength = string.length; - if (stringLength > length) { - throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (stringLength == length) { - return string; - } - return frontPad_(string, length, c); - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with the - * specified character at the front. - * String#frontPadOn(int, char, Writer) - */ - public static void frontPadOn(char[] string, int length, char c, Writer writer) { - int stringLength = string.length; - if (stringLength > length) { - throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (stringLength == length) { - writeStringOn(string, writer); - } else { - frontPadOn_(string, length, c, writer); - } - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with the - * specified character at the front. - * String#frontPadOn(int, char, StringBuffer) - */ - public static void frontPadOn(char[] string, int length, char c, StringBuffer sb) { - int stringLength = string.length; - if (stringLength > length) { - throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (stringLength == length) { - sb.append(string); - } else { - frontPadOn_(string, length, c, sb); - } - } - - /** - * Pad the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, an IllegalArgumentException is thrown. - * If it is shorter than the specified length, it is padded with the - * specified character at the front. - * String#frontPadOn(int, char, StringBuilder) - */ - public static void frontPadOn(char[] string, int length, char c, StringBuilder sb) { - int stringLength = string.length; - if (stringLength > length) { - throw new IllegalArgumentException("String is too long: " + stringLength + " > " + length); //$NON-NLS-1$ //$NON-NLS-2$ - } - if (stringLength == length) { - sb.append(string); - } else { - frontPadOn_(string, length, c, sb); - } - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, only the last part of the string is returned. - * If it is shorter than the specified length, it is padded with zeros at the front. - * String#zeroPadOrTruncate(int) - */ - public static String zeroPadOrTruncate(String string, int length) { - return frontPadOrTruncate(string, length, '0'); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, only the last part of the string is returned. - * If it is shorter than the specified length, it is padded with zeros at the front. - * String#zeroPadOrTruncateOn(int, Writer) - */ - public static void zeroPadOrTruncateOn(String string, int length, Writer writer) { - frontPadOrTruncateOn(string, length, '0', writer); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, only the last part of the string is returned. - * If it is shorter than the specified length, it is padded with zeros at the front. - * String#zeroPadOrTruncateOn(int, StringBuffer) - */ - public static void zeroPadOrTruncateOn(String string, int length, StringBuffer sb) { - frontPadOrTruncateOn(string, length, '0', sb); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, only the last part of the string is returned. - * If it is shorter than the specified length, it is padded with zeros at the front. - * String#zeroPadOrTruncateOn(int, StringBuilder) - */ - public static void zeroPadOrTruncateOn(String string, int length, StringBuilder sb) { - frontPadOrTruncateOn(string, length, '0', sb); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, only the last part of the string is returned. - * If it is shorter than the specified length, it is padded with the - * specified character at the front. - * String#frontPadOrTruncate(int, char) - */ - public static String frontPadOrTruncate(String string, int length, char c) { - int stringLength = string.length(); - if (stringLength == length) { - return string; - } - if (stringLength > length) { - return string.substring(stringLength - length); - } - return frontPad_(string, length, c); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, only the last part of the string is returned. - * If it is shorter than the specified length, it is padded with the - * specified character at the front. - * String#frontPadOrTruncateOn(int, char, Writer) - */ - public static void frontPadOrTruncateOn(String string, int length, char c, Writer writer) { - int stringLength = string.length(); - if (stringLength == length) { - writeStringOn(string, writer); - } else if (stringLength > length) { - writeStringOn(string.substring(stringLength - length), writer); - } else { - frontPadOn_(string, length, c, writer); - } - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, only the last part of the string is returned. - * If it is shorter than the specified length, it is padded with the - * specified character at the front. - * String#frontPadOrTruncateOn(int, char, StringBuffer) - */ - public static void frontPadOrTruncateOn(String string, int length, char c, StringBuffer sb) { - int stringLength = string.length(); - if (stringLength == length) { - sb.append(string); - } else if (stringLength > length) { - sb.append(string.substring(stringLength - length)); - } else { - frontPadOn_(string, length, c, sb); - } - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, only the last part of the string is returned. - * If it is shorter than the specified length, it is padded with the - * specified character at the front. - * String#frontPadOrTruncateOn(int, char, StringBuilder) - */ - public static void frontPadOrTruncateOn(String string, int length, char c, StringBuilder sb) { - int stringLength = string.length(); - if (stringLength == length) { - sb.append(string); - } else if (stringLength > length) { - sb.append(string.substring(stringLength - length)); - } else { - frontPadOn_(string, length, c, sb); - } - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, only the last part of the string is returned. - * If it is shorter than the specified length, it is padded with zeros at the front. - * String#zeroPadOrTruncate(int) - */ - public static char[] zeroPadOrTruncate(char[] string, int length) { - return frontPadOrTruncate(string, length, '0'); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, only the last part of the string is returned. - * If it is shorter than the specified length, it is padded with zeros at the front. - * String#zeroPadOrTruncateOn(int, Writer) - */ - public static void zeroPadOrTruncateOn(char[] string, int length, Writer writer) { - frontPadOrTruncateOn(string, length, '0', writer); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, only the last part of the string is returned. - * If it is shorter than the specified length, it is padded with zeros at the front. - * String#zeroPadOrTruncateOn(int, StringBuffer) - */ - public static void zeroPadOrTruncateOn(char[] string, int length, StringBuffer sb) { - frontPadOrTruncateOn(string, length, '0', sb); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, only the last part of the string is returned. - * If it is shorter than the specified length, it is padded with zeros at the front. - * String#zeroPadOrTruncateOn(int, StringBuilder) - */ - public static void zeroPadOrTruncateOn(char[] string, int length, StringBuilder sb) { - frontPadOrTruncateOn(string, length, '0', sb); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, only the last part of the string is returned. - * If it is shorter than the specified length, it is padded with the - * specified character at the front. - * String#frontPadOrTruncate(int, char) - */ - public static char[] frontPadOrTruncate(char[] string, int length, char c) { - int stringLength = string.length; - if (stringLength == length) { - return string; - } - if (stringLength > length) { - char[] result = new char[length]; - System.arraycopy(string, stringLength - length, result, 0, length); - return result; - } - return frontPad_(string, length, c); - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, only the last part of the string is returned. - * If it is shorter than the specified length, it is padded with the - * specified character at the front. - * String#frontPadOrTruncateOn(int, char, Writer) - */ - public static void frontPadOrTruncateOn(char[] string, int length, char c, Writer writer) { - int stringLength = string.length; - if (stringLength == length) { - writeStringOn(string, writer); - } else if (stringLength > length) { - writeStringOn(string, stringLength - length, length, writer); - } else { - frontPadOn_(string, length, c, writer); - } - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, only the last part of the string is returned. - * If it is shorter than the specified length, it is padded with the - * specified character at the front. - * String#frontPadOrTruncateOn(int, char, StringBuffer) - */ - public static void frontPadOrTruncateOn(char[] string, int length, char c, StringBuffer sb) { - int stringLength = string.length; - if (stringLength == length) { - sb.append(string); - } else if (stringLength > length) { - sb.append(string, stringLength - length, length); - } else { - frontPadOn_(string, length, c, sb); - } - } - - /** - * Pad or truncate the specified string to the specified length. - * If the string is already the specified length, it is returned unchanged. - * If it is longer than the specified length, only the last part of the string is returned. - * If it is shorter than the specified length, it is padded with the - * specified character at the front. - * String#frontPadOrTruncateOn(int, char, StringBuilder) - */ - public static void frontPadOrTruncateOn(char[] string, int length, char c, StringBuilder sb) { - int stringLength = string.length; - if (stringLength == length) { - sb.append(string); - } else if (stringLength > length) { - sb.append(string, stringLength - length, length); - } else { - frontPadOn_(string, length, c, sb); - } - } - - /* - * Front-pad the specified string without validating the parms. - */ - private static String frontPad_(String string, int length, char c) { - return new String(frontPad_(string.toCharArray(), length, c)); - } - - /* - * Zero-pad the specified string without validating the parms. - */ - private static char[] frontPad_(char[] string, int length, char c) { - char[] result = new char[length]; - int stringLength = string.length; - int padLength = length - stringLength; - System.arraycopy(string, 0, result, padLength, stringLength); - Arrays.fill(result, 0, padLength, c); - return result; - } - - /* - * Pad the specified string without validating the parms. - */ - private static void frontPadOn_(String string, int length, char c, Writer writer) { - fill_(string, length, c, writer); - writeStringOn(string, writer); - } - - /* - * Pad the specified string without validating the parms. - */ - private static void frontPadOn_(char[] string, int length, char c, Writer writer) { - fill_(string, length, c, writer); - writeStringOn(string, writer); - } - - /* - * Pad the specified string without validating the parms. - */ - private static void frontPadOn_(String string, int length, char c, StringBuffer sb) { - fill_(string, length, c, sb); - sb.append(string); - } - - /* - * Pad the specified string without validating the parms. - */ - private static void frontPadOn_(char[] string, int length, char c, StringBuffer sb) { - fill_(string, length, c, sb); - sb.append(string); - } - - /* - * Pad the specified string without validating the parms. - */ - private static void frontPadOn_(String string, int length, char c, StringBuilder sb) { - fill_(string, length, c, sb); - sb.append(string); - } - - /* - * Pad the specified string without validating the parms. - */ - private static void frontPadOn_(char[] string, int length, char c, StringBuilder sb) { - fill_(string, length, c, sb); - sb.append(string); - } - - - // ********** separating ********** - - /** - * Separate the segments of the specified string with the specified - * separator:
-	 *     separate("012345", '-', 2) => "01-23-45"
-	 * 
- */ - public static String separate(String string, char separator, int segmentSize) { - if (segmentSize <= 0) { - throw new IllegalArgumentException("segment size must be positive: " + segmentSize); //$NON-NLS-1$ - } - int len = string.length(); - return (len <= segmentSize) ? string : new String(separate(string.toCharArray(), separator, segmentSize, len)); - } - - /** - * Separate the segments of the specified string with the specified - * separator:
-	 *     separate("012345", '-', 2) => "01-23-45"
-	 * 
- */ - public static void separateOn(String string, char separator, int segmentSize, Writer writer) { - if (segmentSize <= 0) { - throw new IllegalArgumentException("segment size must be positive: " + segmentSize); //$NON-NLS-1$ - } - if (string.length() <= segmentSize) { - writeStringOn(string, writer); - } else { - separateOn_(string.toCharArray(), separator, segmentSize, writer); - } - } - - /** - * Separate the segments of the specified string with the specified - * separator:
-	 *     separate("012345", '-', 2) => "01-23-45"
-	 * 
- */ - public static void separateOn(String string, char separator, int segmentSize, StringBuffer sb) { - if (segmentSize <= 0) { - throw new IllegalArgumentException("segment size must be positive: " + segmentSize); //$NON-NLS-1$ - } - if (string.length() <= segmentSize) { - sb.append(string); - } else { - separateOn_(string.toCharArray(), separator, segmentSize, sb); - } - } - - /** - * Separate the segments of the specified string with the specified - * separator:
-	 *     separate("012345", '-', 2) => "01-23-45"
-	 * 
- */ - public static void separateOn(String string, char separator, int segmentSize, StringBuilder sb) { - if (segmentSize <= 0) { - throw new IllegalArgumentException("segment size must be positive: " + segmentSize); //$NON-NLS-1$ - } - if (string.length() <= segmentSize) { - sb.append(string); - } else { - separateOn_(string.toCharArray(), separator, segmentSize, sb); - } - } - - /** - * Separate the segments of the specified string with the specified - * separator:
-	 *     separate("012345", '-', 2) => "01-23-45"
-	 * 
- */ - public static char[] separate(char[] string, char separator, int segmentSize) { - if (segmentSize <= 0) { - throw new IllegalArgumentException("segment size must be positive: " + segmentSize); //$NON-NLS-1$ - } - int len = string.length; - return (len <= segmentSize) ? string : separate(string, separator, segmentSize, len); - } - - /** - * pre-conditions: string is longer than segment size; segment size is positive - */ - private static char[] separate(char[] string, char separator, int segmentSize, int len) { - int resultLen = len + (len / segmentSize); - if ((len % segmentSize) == 0) { - resultLen--; // no separator after the final segment if nothing following it - } - char[] result = new char[resultLen]; - int j = 0; - int segCount = 0; - for (char c : string) { - if (segCount == segmentSize) { - result[j++] = separator; - segCount = 0; - } - segCount++; - result[j++] = c; - } - return result; - } - - /** - * Separate the segments of the specified string with the specified - * separator:
-	 *     separate("012345", '-', 2) => "01-23-45"
-	 * 
- */ - public static void separateOn(char[] string, char separator, int segmentSize, Writer writer) { - if (segmentSize <= 0) { - throw new IllegalArgumentException("segment size must be positive: " + segmentSize); //$NON-NLS-1$ - } - if (string.length <= segmentSize) { - writeStringOn(string, writer); - } else { - separateOn_(string, separator, segmentSize, writer); - } - } - - /** - * pre-conditions: string is longer than segment size; segment size is positive - */ - private static void separateOn_(char[] string, char separator, int segmentSize, Writer writer) { - int segCount = 0; - for (char c : string) { - if (segCount == segmentSize) { - writeCharOn(separator, writer); - segCount = 0; - } - segCount++; - writeCharOn(c, writer); - } - } - - /** - * Separate the segments of the specified string with the specified - * separator:
-	 *     separate("012345", '-', 2) => "01-23-45"
-	 * 
- */ - public static void separateOn(char[] string, char separator, int segmentSize, StringBuffer sb) { - if (segmentSize <= 0) { - throw new IllegalArgumentException("segment size must be positive: " + segmentSize); //$NON-NLS-1$ - } - if (string.length <= segmentSize) { - sb.append(string); - } else { - separateOn_(string, separator, segmentSize, sb); - } - } - - /** - * pre-conditions: string is longer than segment size; segment size is positive - */ - private static void separateOn_(char[] string, char separator, int segmentSize, StringBuffer sb) { - int segCount = 0; - for (char c : string) { - if (segCount == segmentSize) { - sb.append(separator); - segCount = 0; - } - segCount++; - sb.append(c); - } - } - - /** - * Separate the segments of the specified string with the specified - * separator:
-	 *     separate("012345", '-', 2) => "01-23-45"
-	 * 
- */ - public static void separateOn(char[] string, char separator, int segmentSize, StringBuilder sb) { - if (segmentSize <= 0) { - throw new IllegalArgumentException("segment size must be positive: " + segmentSize); //$NON-NLS-1$ - } - if (string.length <= segmentSize) { - sb.append(string); - } else { - separateOn_(string, separator, segmentSize, sb); - } - } - - /** - * pre-conditions: string is longer than segment size; segment size is positive - */ - private static void separateOn_(char[] string, char separator, int segmentSize, StringBuilder sb) { - int segCount = 0; - for (char c : string) { - if (segCount == segmentSize) { - sb.append(separator); - segCount = 0; - } - segCount++; - sb.append(c); - } - } - - - // ********** delimiting/quoting ********** - - /** - * Delimit the specified string with double quotes. - * Escape any occurrences of a double quote in the string with another - * double quote. - */ - public static String quote(String string) { - return delimit(string, QUOTE); - } - - /** - * Delimit the specified string with double quotes. - * Escape any occurrences of a double quote in the string with another - * double quote. - */ - public static void quoteOn(String string, Writer writer) { - delimitOn(string, QUOTE, writer); - } - - /** - * Delimit the specified string with double quotes. - * Escape any occurrences of a double quote in the string with another - * double quote. - */ - public static void quoteOn(String string, StringBuffer sb) { - delimitOn(string, QUOTE, sb); - } - - /** - * Delimit the specified string with double quotes. - * Escape any occurrences of a double quote in the string with another - * double quote. - */ - public static void quoteOn(String string, StringBuilder sb) { - delimitOn(string, QUOTE, sb); - } - - /** - * Delimit each of the specified strings with double quotes. - * Escape any occurrences of a double quote in a string with another - * double quote. - */ - public static Iterator quote(Iterator strings) { - return delimit(strings, QUOTE); - } - - /** - * Delimit the specified string with the specified delimiter; i.e. put a copy of - * the delimiter at the front and back of the resulting string. - * Escape any occurrences of the delimiter in the string with another delimiter. - */ - public static String delimit(String string, char delimiter) { - return new String(delimit(string.toCharArray(), delimiter)); - } - - /** - * Delimit the specified string with the specified delimiter; i.e. put a copy of - * the delimiter at the front and back of the resulting string. - * Escape any occurrences of the delimiter in the string with another delimiter. - */ - public static void delimitOn(String string, char delimiter, Writer writer) { - delimitOn(string.toCharArray(), delimiter, writer); - } - - /** - * Delimit the specified string with the specified delimiter; i.e. put a copy of - * the delimiter at the front and back of the resulting string. - * Escape any occurrences of the delimiter in the string with another delimiter. - */ - public static void delimitOn(String string, char delimiter, StringBuffer sb) { - delimitOn(string.toCharArray(), delimiter, sb); - } - - /** - * Delimit the specified string with the specified delimiter; i.e. put a copy of - * the delimiter at the front and back of the resulting string. - * Escape any occurrences of the delimiter in the string with another delimiter. - */ - public static void delimitOn(String string, char delimiter, StringBuilder sb) { - delimitOn(string.toCharArray(), delimiter, sb); - } - - /** - * Delimit each of the specified strings with the specified delimiter; i.e. put a - * copy of the delimiter at the front and back of the resulting string. - * Escape any occurrences of the delimiter in a string with another delimiter. - */ - public static Iterable delimit(Iterable strings, char delimiter) { - return new TransformationIterable(strings, new CharStringDelimiter(delimiter)); - } - - /** - * Delimit each of the specified strings with the specified delimiter; i.e. put a - * copy of the delimiter at the front and back of the resulting string. - * Escape any occurrences of the delimiter in a string with another delimiter. - */ - public static Iterator delimit(Iterator strings, char delimiter) { - return new TransformationIterator(strings, new CharStringDelimiter(delimiter)); - } - - private static class CharStringDelimiter implements Transformer { - private char delimiter; - CharStringDelimiter(char delimiter) { - super(); - this.delimiter = delimiter; - } - public String transform(String string) { - return StringTools.delimit(string, this.delimiter); - } - } - - /** - * Delimit the specified string with the specified delimiter; i.e. put a copy of - * the delimiter at the front and back of the resulting string. - * Escape any occurrences of a single-character delimiter in the string with - * another delimiter. - */ - public static String delimit(String string, String delimiter) { - if (delimiter.length() == 1) { - return delimit(string, delimiter.charAt(0)); - } - return new String(delimit(string.toCharArray(), delimiter.toCharArray())); - } - - /** - * Delimit the specified string with the specified delimiter; i.e. put a copy of - * the delimiter at the front and back of the resulting string. - * Escape any occurrences of a single-character delimiter in the string with - * another delimiter. - */ - public static void delimitOn(String string, String delimiter, Writer writer) { - if (delimiter.length() == 1) { - delimitOn(string, delimiter.charAt(0), writer); - } else { - delimitOn(string.toCharArray(), delimiter.toCharArray(), writer); - } - } - - /** - * Delimit the specified string with the specified delimiter; i.e. put a copy of - * the delimiter at the front and back of the resulting string. - * Escape any occurrences of a single-character delimiter in the string with - * another delimiter. - */ - public static void delimitOn(String string, String delimiter, StringBuffer sb) { - if (delimiter.length() == 1) { - delimitOn(string, delimiter.charAt(0), sb); - } else { - delimitOn(string.toCharArray(), delimiter.toCharArray(), sb); - } - } - - /** - * Delimit the specified string with the specified delimiter; i.e. put a copy of - * the delimiter at the front and back of the resulting string. - * Escape any occurrences of a single-character delimiter in the string with - * another delimiter. - */ - public static void delimitOn(String string, String delimiter, StringBuilder sb) { - if (delimiter.length() == 1) { - delimitOn(string, delimiter.charAt(0), sb); - } else { - delimitOn(string.toCharArray(), delimiter.toCharArray(), sb); - } - } - - /** - * Delimit each of the specified strings with the specified delimiter; i.e. put a - * copy of the delimiter at the front and back of the resulting string. - * Escape any occurrences of a single-character delimiter in a string with - * another delimiter. - */ - public static Iterable delimit(Iterable strings, String delimiter) { - return (delimiter.length() == 1) ? - delimit(strings, delimiter.charAt(0)) : - new TransformationIterable(strings, new StringStringDelimiter(delimiter)); - } - - /** - * Delimit each of the specified strings with the specified delimiter; i.e. put a - * copy of the delimiter at the front and back of the resulting string. - * Escape any occurrences of a single-character delimiter in a string with - * another delimiter. - */ - public static Iterator delimit(Iterator strings, String delimiter) { - return (delimiter.length() == 1) ? - delimit(strings, delimiter.charAt(0)) : - new TransformationIterator(strings, new StringStringDelimiter(delimiter)); - } - - private static class StringStringDelimiter implements Transformer { - private String delimiter; - StringStringDelimiter(String delimiter) { - super(); - this.delimiter = delimiter; - } - public String transform(String string) { - return StringTools.delimit(string, this.delimiter); - } - } - - /** - * Delimit the specified string with double quotes. - * Escape any occurrences of a double quote in the string with another - * double quote. - */ - public static char[] quote(char[] string) { - return delimit(string, QUOTE); - } - - /** - * Delimit the specified string with double quotes. - * Escape any occurrences of a double quote in the string with another - * double quote. - */ - public static void quoteOn(char[] string, Writer writer) { - delimitOn(string, QUOTE, writer); - } - - /** - * Delimit the specified string with double quotes. - * Escape any occurrences of a double quote in the string with another - * double quote. - */ - public static void quoteOn(char[] string, StringBuffer sb) { - delimitOn(string, QUOTE, sb); - } - - /** - * Delimit the specified string with double quotes. - * Escape any occurrences of a double quote in the string with another - * double quote. - */ - public static void quoteOn(char[] string, StringBuilder sb) { - delimitOn(string, QUOTE, sb); - } - - /** - * Delimit each of the specified strings with double quotes. - * Escape any occurrences of a double quote in a string with another - * double quote. - */ - // cannot name method simply 'quote' because of type-erasure... - public static Iterator quoteCharArrays(Iterator strings) { - return delimitCharArrays(strings, QUOTE); - } - - /** - * Delimit the specified string with the specified delimiter; i.e. put a copy of - * the delimiter at the front and back of the resulting string. - * Escape any occurrences of the delimiter in the string with another delimiter. - */ - public static char[] delimit(char[] string, char delimiter) { - StringBuilder sb = new StringBuilder(string.length + 2); - delimitOn(string, delimiter, sb); - return convertToCharArray(sb); - } - - /** - * Delimit the specified string with the specified delimiter; i.e. put a copy of - * the delimiter at the front and back of the resulting string. - * Escape any occurrences of the delimiter in the string with another delimiter. - */ - public static void delimitOn(char[] string, char delimiter, Writer writer) { - writeCharOn(delimiter, writer); - writeStringOn(string, delimiter, writer); - writeCharOn(delimiter, writer); - } - - /** - * Delimit the specified string with the specified delimiter; i.e. put a copy of - * the delimiter at the front and back of the resulting string. - * Escape any occurrences of the delimiter in the string with another delimiter. - */ - public static void delimitOn(char[] string, char delimiter, StringBuffer sb) { - sb.append(delimiter); - for (char c : string) { - if (c == delimiter) { - sb.append(c); - } - sb.append(c); - } - sb.append(delimiter); - } - - /** - * Delimit the specified string with the specified delimiter; i.e. put a copy of - * the delimiter at the front and back of the resulting string. - * Escape any occurrences of the delimiter in the string with another delimiter. - */ - public static void delimitOn(char[] string, char delimiter, StringBuilder sb) { - sb.append(delimiter); - for (char c : string) { - if (c == delimiter) { - sb.append(c); - } - sb.append(c); - } - sb.append(delimiter); - } - - /** - * Delimit each of the specified strings with the specified delimiter; i.e. put a - * copy of the delimiter at the front and back of the resulting string. - * Escape any occurrences of the delimiter in a string with another delimiter. - */ - // cannot name method simply 'delimit' because of type-erasure... - public static Iterable delimitCharArrays(Iterable strings, char delimiter) { - return new TransformationIterable(strings, new CharCharArrayDelimiter(delimiter)); - } - - /** - * Delimit each of the specified strings with the specified delimiter; i.e. put a - * copy of the delimiter at the front and back of the resulting string. - * Escape any occurrences of the delimiter in a string with another delimiter. - */ - // cannot name method simply 'delimit' because of type-erasure... - public static Iterator delimitCharArrays(Iterator strings, char delimiter) { - return new TransformationIterator(strings, new CharCharArrayDelimiter(delimiter)); - } - - private static class CharCharArrayDelimiter implements Transformer { - private char delimiter; - CharCharArrayDelimiter(char delimiter) { - super(); - this.delimiter = delimiter; - } - public char[] transform(char[] string) { - return StringTools.delimit(string, this.delimiter); - } - } - - /** - * Delimit the specified string with the specified delimiter; i.e. put a copy of - * the delimiter at the front and back of the resulting string. - * Escape any occurrences of a single-character delimiter in the string with - * another delimiter. - */ - public static char[] delimit(char[] string, char[] delimiter) { - int delimiterLength = delimiter.length; - if (delimiterLength == 1) { - return delimit(string, delimiter[0]); - } - int stringLength = string.length; - char[] result = new char[stringLength+(2*delimiterLength)]; - System.arraycopy(delimiter, 0, result, 0, delimiterLength); - System.arraycopy(string, 0, result, delimiterLength, stringLength); - System.arraycopy(delimiter, 0, result, stringLength+delimiterLength, delimiterLength); - return result; - } - - /** - * Delimit the specified string with the specified delimiter; i.e. put a copy of - * the delimiter at the front and back of the resulting string. - * Escape any occurrences of a single-character delimiter in the string with - * another delimiter. - */ - public static void delimitOn(char[] string, char[] delimiter, Writer writer) { - if (delimiter.length == 1) { - delimitOn(string, delimiter[0], writer); - } else { - writeStringOn(delimiter, writer); - writeStringOn(string, writer); - writeStringOn(delimiter, writer); - } - } - - /** - * Delimit the specified string with the specified delimiter; i.e. put a copy of - * the delimiter at the front and back of the resulting string. - * Escape any occurrences of a single-character delimiter in the string with - * another delimiter. - */ - public static void delimitOn(char[] string, char[] delimiter, StringBuffer sb) { - if (delimiter.length == 1) { - delimitOn(string, delimiter[0], sb); - } else { - sb.append(delimiter); - sb.append(string); - sb.append(delimiter); - } - } - - /** - * Delimit the specified string with the specified delimiter; i.e. put a copy of - * the delimiter at the front and back of the resulting string. - * Escape any occurrences of a single-character delimiter in the string with - * another delimiter. - */ - public static void delimitOn(char[] string, char[] delimiter, StringBuilder sb) { - if (delimiter.length == 1) { - delimitOn(string, delimiter[0], sb); - } else { - sb.append(delimiter); - sb.append(string); - sb.append(delimiter); - } - } - - /** - * Delimit each of the specified strings with the specified delimiter; i.e. put a - * copy of the delimiter at the front and back of the resulting string. - * Escape any occurrences of a single-character delimiter in a string with - * another delimiter. - */ - // cannot name method simply 'delimit' because of type-erasure... - public static Iterable delimitCharArrays(Iterable strings, char[] delimiter) { - return new TransformationIterable(strings, new CharArrayCharArrayDelimiter(delimiter)); - } - - /** - * Delimit each of the specified strings with the specified delimiter; i.e. put a - * copy of the delimiter at the front and back of the resulting string. - * Escape any occurrences of a single-character delimiter in a string with - * another delimiter. - */ - // cannot name method simply 'delimit' because of type-erasure... - public static Iterator delimitCharArrays(Iterator strings, char[] delimiter) { - return new TransformationIterator(strings, new CharArrayCharArrayDelimiter(delimiter)); - } - - private static class CharArrayCharArrayDelimiter implements Transformer { - private char[] delimiter; - CharArrayCharArrayDelimiter(char[] delimiter) { - super(); - this.delimiter = delimiter; - } - public char[] transform(char[] string) { - return StringTools.delimit(string, this.delimiter); - } - } - - - // ********** delimiting queries ********** - - /** - * Return whether the specified string is quoted: "\"foo\"". - */ - public static boolean stringIsQuoted(String string) { - return stringIsDelimited(string, QUOTE); - } - - /** - * Return whether the specified string is parenthetical: "(foo)". - */ - public static boolean stringIsParenthetical(String string) { - return stringIsDelimited(string, OPEN_PARENTHESIS, CLOSE_PARENTHESIS); - } - - /** - * Return whether the specified string is bracketed: "[foo]". - */ - public static boolean stringIsBracketed(String string) { - return stringIsDelimited(string, OPEN_BRACKET, CLOSE_BRACKET); - } - - /** - * Return whether the specified string is braced: "{foo}". - */ - public static boolean stringIsBraced(String string) { - return stringIsDelimited(string, OPEN_BRACE, CLOSE_BRACE); - } - - /** - * Return whether the specified string is chevroned: "". - */ - public static boolean stringIsChevroned(String string) { - return stringIsDelimited(string, OPEN_CHEVRON, CLOSE_CHEVRON); - } - - /** - * Return whether the specified string is delimited by the specified - * character. - */ - public static boolean stringIsDelimited(String string, char c) { - return stringIsDelimited(string, c, c); - } - - /** - * Return whether the specified string is delimited by the specified - * characters. - */ - public static boolean stringIsDelimited(String string, char start, char end) { - int len = string.length(); - if (len < 2) { - return false; - } - return stringIsDelimited(string.toCharArray(), start, end, len); - } - - /** - * Return whether the specified string is quoted: "\"foo\"". - */ - public static boolean stringIsQuoted(char[] string) { - return stringIsDelimited(string, QUOTE); - } - - /** - * Return whether the specified string is parenthetical: "(foo)". - */ - public static boolean stringIsParenthetical(char[] string) { - return stringIsDelimited(string, OPEN_PARENTHESIS, CLOSE_PARENTHESIS); - } - - /** - * Return whether the specified string is bracketed: "[foo]". - */ - public static boolean stringIsBracketed(char[] string) { - return stringIsDelimited(string, OPEN_BRACKET, CLOSE_BRACKET); - } - - /** - * Return whether the specified string is braced: "{foo}". - */ - public static boolean stringIsBraced(char[] string) { - return stringIsDelimited(string, OPEN_BRACE, CLOSE_BRACE); - } - - /** - * Return whether the specified string is chevroned: "". - */ - public static boolean stringIsChevroned(char[] string) { - return stringIsDelimited(string, OPEN_CHEVRON, CLOSE_CHEVRON); - } - - /** - * Return whether the specified string is delimited by the specified - * character. - */ - public static boolean stringIsDelimited(char[] string, char c) { - return stringIsDelimited(string, c, c); - } - - /** - * Return whether the specified string is delimited by the specified - * characters. - */ - public static boolean stringIsDelimited(char[] string, char start, char end) { - int len = string.length; - if (len < 2) { - return false; - } - return stringIsDelimited(string, start, end, len); - } - - private static boolean stringIsDelimited(char[] s, char start, char end, int len) { - return (s[0] == start) && (s[len - 1] == end); - } - - - // ********** undelimiting ********** - - /** - * Remove the delimiters from the specified string, removing any escape - * characters. Throw an IllegalArgumentException if the string is too short - * to undelimit (i.e. length < 2). - */ - public static String undelimit(String string) { - int len = string.length() - 2; - if (len < 0) { - throw new IllegalArgumentException("invalid string: \"" + string + '"'); //$NON-NLS-1$ - } - if (len == 0) { - return EMPTY_STRING; - } - return new String(undelimit_(string.toCharArray(), len)); - } - - /** - * Remove the first and last count characters from the specified string. - * If the string is too short to be undelimited, throw an - * IllegalArgumentException. - * Use this method to undelimit strings that do not escape embedded - * delimiters. - */ - public static String undelimit(String string, int count) { - int len = string.length() - (2 * count); - if (len < 0) { - throw new IllegalArgumentException("invalid string: \"" + string + '"'); //$NON-NLS-1$ - } - if (len == 0) { - return EMPTY_STRING; - } - return new String(undelimit(string.toCharArray(), len, count)); - } - - /** - * Remove the delimiters from the specified string, removing any escape - * characters. Throw an IllegalArgumentException if the string is too short - * to undelimit (i.e. length < 2). - */ - public static char[] undelimit(char[] string) { - int len = string.length - 2; - if (len < 0) { - throw new IllegalArgumentException("invalid string: \"" + new String(string) + '"'); //$NON-NLS-1$ - } - if (len == 0) { - return EMPTY_CHAR_ARRAY; - } - return undelimit_(string, len); - } - - private static char[] undelimit_(char[] string, int length) { - StringBuilder sb = new StringBuilder(length); - undelimitOn_(string, sb); - return convertToCharArray(sb); - } - - /** - * Remove the first and last count characters from the specified string. - * If the string is too short to be undelimited, throw an - * IllegalArgumentException. - * Use this method to undelimit strings that do not escape embedded - * delimiters. - */ - public static char[] undelimit(char[] string, int count) { - int len = string.length - (2 * count); - if (len < 0) { - throw new IllegalArgumentException("invalid string: \"" + new String(string) + '"'); //$NON-NLS-1$ - } - if (len == 0) { - return EMPTY_CHAR_ARRAY; - } - return undelimit(string, len, count); - } - - private static char[] undelimit(char[] string, int len, int count) { - char[] result = new char[len]; - System.arraycopy(string, count, result, 0, len); - return result; - } - - /** - * Remove the delimiters from the specified string, removing any escape - * characters. Throw an IllegalArgumentException if the string is too short - * to undelimit (i.e. length < 2). - */ - public static void undelimitOn(String string, Writer writer) { - undelimitOn(string.toCharArray(), writer); - } - - /** - * Remove the first and last count characters from the specified string. - * If the string is too short to be undelimited, throw an - * IllegalArgumentException. - * Use this method to undelimit strings that do not escape embedded - * delimiters. - */ - public static void undelimitOn(String string, int count, Writer writer) { - int len = string.length() - (2 * count); - if (len < 0) { - throw new IllegalArgumentException("invalid string: \"" + string + '"'); //$NON-NLS-1$ - } - if (len == 0) { - return; - } - writeStringOn(string, count, len, writer); - } - - /** - * Remove the delimiters from the specified string, removing any escape - * characters. Throw an IllegalArgumentException if the string is too short - * to undelimit (i.e. length < 2). - */ - public static void undelimitOn(String string, StringBuffer sb) { - undelimitOn(string.toCharArray(), sb); - } - - /** - * Remove the first and last count characters from the specified string. - * If the string is too short to be undelimited, throw an - * IllegalArgumentException. - * Use this method to undelimit strings that do not escape embedded - * delimiters. - */ - public static void undelimitOn(String string, int count, StringBuffer sb) { - int len = string.length() - (2 * count); - if (len < 0) { - throw new IllegalArgumentException("invalid string: \"" + string + '"'); //$NON-NLS-1$ - } - if (len == 0) { - return; - } - sb.append(string, count, count + len); - } - - /** - * Remove the delimiters from the specified string, removing any escape - * characters. Throw an IllegalArgumentException if the string is too short - * to undelimit (i.e. length < 2). - */ - public static void undelimitOn(String string, StringBuilder sb) { - undelimitOn(string.toCharArray(), sb); - } - - /** - * Remove the first and last count characters from the specified string. - * If the string is too short to be undelimited, throw an - * IllegalArgumentException. - * Use this method to undelimit strings that do not escape embedded - * delimiters. - */ - public static void undelimitOn(String string, int count, StringBuilder sb) { - int len = string.length() - (2 * count); - if (len < 0) { - throw new IllegalArgumentException("invalid string: \"" + string + '"'); //$NON-NLS-1$ - } - if (len == 0) { - return; - } - sb.append(string, count, count + len); - } - - /** - * Remove the delimiters from the specified string, removing any escape - * characters. Throw an IllegalArgumentException if the string is too short - * to undelimit (i.e. length < 2). - */ - public static void undelimitOn(char[] string, Writer writer) { - int len = string.length - 2; - if (len < 0) { - throw new IllegalArgumentException("invalid string: \"" + new String(string) + '"'); //$NON-NLS-1$ - } - if (len == 0) { - return; - } - undelimitOn_(string, writer); - } - - /** - * pre-condition: string is at least 3 characters long - */ - private static void undelimitOn_(char[] string, Writer writer) { - char delimiter = string[0]; // the first char is the delimiter - char c = string[0]; - char next = string[1]; - int i = 1; - int last = string.length - 1; - do { - c = next; - writeCharOn(c, writer); - i++; - next = string[i]; - if (c == delimiter) { - if ((next != delimiter) || (i == last)) { - // an embedded delimiter must be followed by another delimiter - return; - } - i++; - next = string[i]; - } - } while (i != last); - } - - /** - * Remove the first and last count characters from the specified string. - * If the string is too short to be undelimited, throw an - * IllegalArgumentException. - * Use this method to undelimit strings that do not escape embedded - * delimiters. - */ - public static void undelimitOn(char[] string, int count, Writer writer) { - int len = string.length - (2 * count); - if (len < 0) { - throw new IllegalArgumentException("invalid string: \"" + new String(string) + '"'); //$NON-NLS-1$ - } - if (len == 0) { - return; - } - writeStringOn(string, count, len, writer); - } - - /** - * Remove the delimiters from the specified string, removing any escape - * characters. Throw an IllegalArgumentException if the string is too short - * to undelimit (i.e. length < 2). - */ - public static void undelimitOn(char[] string, StringBuffer sb) { - int len = string.length - 2; - if (len < 0) { - throw new IllegalArgumentException("invalid string: \"" + new String(string) + '"'); //$NON-NLS-1$ - } - if (len == 0) { - return; - } - undelimitOn_(string, sb); - } - - /** - * pre-condition: string is at least 3 characters long - */ - private static void undelimitOn_(char[] string, StringBuffer sb) { - char delimiter = string[0]; // the first char is the delimiter - char c = string[0]; - char next = string[1]; - int i = 1; - int last = string.length - 1; - do { - c = next; - sb.append(c); - i++; - next = string[i]; - if (c == delimiter) { - if ((next != delimiter) || (i == last)) { - // an embedded delimiter must be followed by another delimiter - return; - } - i++; - next = string[i]; - } - } while (i != last); - } - - /** - * Remove the first and last count characters from the specified string. - * If the string is too short to be undelimited, throw an - * IllegalArgumentException. - * Use this method to undelimit strings that do not escape embedded - * delimiters. - */ - public static void undelimitOn(char[] string, int count, StringBuffer sb) { - int len = string.length - (2 * count); - if (len < 0) { - throw new IllegalArgumentException("invalid string: \"" + new String(string) + '"'); //$NON-NLS-1$ - } - if (len == 0) { - return; - } - sb.append(string, count, len); - } - - /** - * Remove the delimiters from the specified string, removing any escape - * characters. Throw an IllegalArgumentException if the string is too short - * to undelimit (i.e. length < 2). - */ - public static void undelimitOn(char[] string, StringBuilder sb) { - int len = string.length - 2; - if (len < 0) { - throw new IllegalArgumentException("invalid string: \"" + new String(string) + '"'); //$NON-NLS-1$ - } - if (len == 0) { - return; - } - undelimitOn_(string, sb); - } - - /** - * pre-condition: string is at least 3 characters long - */ - private static void undelimitOn_(char[] string, StringBuilder sb) { - char delimiter = string[0]; // the first char is the delimiter - char c = string[0]; - char next = string[1]; - int i = 1; - int last = string.length - 1; - do { - c = next; - sb.append(c); - i++; - next = string[i]; - if (c == delimiter) { - if ((next != delimiter) || (i == last)) { - // an embedded delimiter must be followed by another delimiter - return; - } - i++; - next = string[i]; - } - } while (i != last); - } - - /** - * Remove the first and last count characters from the specified string. - * If the string is too short to be undelimited, throw an - * IllegalArgumentException. - * Use this method to undelimit strings that do not escape embedded - * delimiters. - */ - public static void undelimitOn(char[] string, int count, StringBuilder sb) { - int len = string.length - (2 * count); - if (len < 0) { - throw new IllegalArgumentException("invalid string: \"" + new String(string) + '"'); //$NON-NLS-1$ - } - if (len == 0) { - return; - } - sb.append(string, count, len); - } - - - // ********** removing characters ********** - - /** - * Remove the first occurrence of the specified character - * from the specified string and return the result. - * String#removeFirstOccurrence(char) - */ - public static String removeFirstOccurrence(String string, char c) { - int index = string.indexOf(c); - if (index == -1) { - // character not found - return string; - } - if (index == 0) { - // character found at the front of string - return string.substring(1); - } - int last = string.length() - 1; - if (index == last) { - // character found at the end of string - return string.substring(0, last); - } - // character found somewhere in the middle of the string - return string.substring(0, index).concat(string.substring(index + 1)); - } - - /** - * Remove the first occurrence of the specified character - * from the specified string and print the result on the specified stream. - * String#removeFirstOccurrenceOn(char, Writer) - */ - public static void removeFirstOccurrenceOn(String string, char c, Writer writer) { - int index = string.indexOf(c); - if (index == -1) { - writeStringOn(string, writer); - } else { - removeCharAtIndexOn(string.toCharArray(), index, writer); - } - } - - /** - * Remove the first occurrence of the specified character - * from the specified string and print the result on the specified stream. - * String#removeFirstOccurrenceOn(char, StringBuffer) - */ - public static void removeFirstOccurrenceOn(String string, char c, StringBuffer sb) { - int index = string.indexOf(c); - if (index == -1) { - sb.append(string); - } else { - removeCharAtIndexOn(string.toCharArray(), index, sb); - } - } - - /** - * Remove the first occurrence of the specified character - * from the specified string and print the result on the specified stream. - * String#removeFirstOccurrenceOn(char, StringBuilder) - */ - public static void removeFirstOccurrenceOn(String string, char c, StringBuilder sb) { - int index = string.indexOf(c); - if (index == -1) { - sb.append(string); - } else { - removeCharAtIndexOn(string.toCharArray(), index, sb); - } - } - - /** - * Remove the first occurrence of the specified character - * from the specified string and return the result. - * String#removeFirstOccurrence(char) - */ - public static char[] removeFirstOccurrence(char[] string, char c) { - int index = ArrayTools.indexOf(string, c); - if (index == -1) { - // character not found - return string; - } - int last = string.length - 1; - char[] result = new char[last]; - if (index == 0) { - // character found at the front of string - System.arraycopy(string, 1, result, 0, last); - } else if (index == last) { - // character found at the end of string - System.arraycopy(string, 0, result, 0, last); - } else { - // character found somewhere in the middle of the string - System.arraycopy(string, 0, result, 0, index); - System.arraycopy(string, index + 1, result, index, last - index); - } - return result; - } - - /** - * Remove the first occurrence of the specified character - * from the specified string and print the result on the specified stream. - * String#removeFirstOccurrenceOn(char, Writer) - */ - public static void removeFirstOccurrenceOn(char[] string, char c, Writer writer) { - int index = ArrayTools.indexOf(string, c); - if (index == -1) { - writeStringOn(string, writer); - } else { - removeCharAtIndexOn(string, index, writer); - } - } - - private static void removeCharAtIndexOn(char[] string, int index, Writer writer) { - int last = string.length - 1; - if (index == 0) { - // character found at the front of string - writeStringOn(string, 1, last, writer); - } else if (index == last) { - // character found at the end of string - writeStringOn(string, 0, last, writer); - } else { - // character found somewhere in the middle of the string - writeStringOn(string, 0, index, writer); - writeStringOn(string, index + 1, last - index, writer); - } - } - - /** - * Remove the first occurrence of the specified character - * from the specified string and print the result on the specified stream. - * String#removeFirstOccurrenceOn(char, StringBuffer) - */ - public static void removeFirstOccurrenceOn(char[] string, char c, StringBuffer sb) { - int index = ArrayTools.indexOf(string, c); - if (index == -1) { - sb.append(string); - } else { - removeCharAtIndexOn(string, index, sb); - } - } - - private static void removeCharAtIndexOn(char[] string, int index, StringBuffer sb) { - int last = string.length - 1; - if (index == 0) { - // character found at the front of string - sb.append(string, 1, last); - } else if (index == last) { - // character found at the end of string - sb.append(string, 0, last); - } else { - // character found somewhere in the middle of the string - sb.append(string, 0, index); - sb.append(string, index + 1, last - index); - } - } - - /** - * Remove the first occurrence of the specified character - * from the specified string and print the result on the specified stream. - * String#removeFirstOccurrenceOn(char, StringBuilder) - */ - public static void removeFirstOccurrenceOn(char[] string, char c, StringBuilder sb) { - int index = ArrayTools.indexOf(string, c); - if (index == -1) { - sb.append(string); - } else { - removeCharAtIndexOn(string, index, sb); - } - } - - private static void removeCharAtIndexOn(char[] string, int index, StringBuilder sb) { - int last = string.length - 1; - if (index == 0) { - // character found at the front of string - sb.append(string, 1, last); - } else if (index == last) { - // character found at the end of string - sb.append(string, 0, last); - } else { - // character found somewhere in the middle of the string - sb.append(string, 0, index); - sb.append(string, index + 1, last - index); - } - } - - /** - * Remove all occurrences of the specified character - * from the specified string and return the result. - * String#removeAllOccurrences(char) - */ - public static String removeAllOccurrences(String string, char c) { - int first = string.indexOf(c); - return (first == -1) ? string : new String(removeAllOccurrences_(string.toCharArray(), c, first)); - } - - /** - * Remove all occurrences of the specified character - * from the specified string and write the result to the specified stream. - * String#removeAllOccurrencesOn(char, Writer) - */ - public static void removeAllOccurrencesOn(String string, char c, Writer writer) { - int first = string.indexOf(c); - if (first == -1) { - writeStringOn(string, writer); - } else { - removeAllOccurrencesOn_(string.toCharArray(), c, first, writer); - } - } - - /** - * Remove all occurrences of the specified character - * from the specified string and write the result to the specified stream. - * String#removeAllOccurrencesOn(char, StringBuffer) - */ - public static void removeAllOccurrencesOn(String string, char c, StringBuffer sb) { - int first = string.indexOf(c); - if (first == -1) { - sb.append(string); - } else { - removeAllOccurrencesOn_(string.toCharArray(), c, first, sb); - } - } - - /** - * Remove all occurrences of the specified character - * from the specified string and write the result to the specified stream. - * String#removeAllOccurrencesOn(char, StringBuilder) - */ - public static void removeAllOccurrencesOn(String string, char c, StringBuilder sb) { - int first = string.indexOf(c); - if (first == -1) { - sb.append(string); - } else { - removeAllOccurrencesOn_(string.toCharArray(), c, first, sb); - } - } - - /** - * Remove all occurrences of the specified character - * from the specified string and return the result. - * String#removeAllOccurrences(char) - */ - public static char[] removeAllOccurrences(char[] string, char c) { - int first = ArrayTools.indexOf(string, c); - return (first == -1) ? string : removeAllOccurrences_(string, c, first); - } - - /* - * The index of the first matching character is passed in. - */ - private static char[] removeAllOccurrences_(char[] string, char c, int first) { - StringBuilder sb = new StringBuilder(string.length); - removeAllOccurrencesOn_(string, c, first, sb); - return convertToCharArray(sb); - } - - /** - * Remove all occurrences of the specified character - * from the specified string and write the result to the - * specified writer. - * String#removeAllOccurrencesOn(char, Writer) - */ - public static void removeAllOccurrencesOn(char[] string, char c, Writer writer) { - int first = ArrayTools.indexOf(string, c); - if (first == -1) { - writeStringOn(string, writer); - } else { - removeAllOccurrencesOn_(string, c, first, writer); - } - } - - /* - * The index of the first matching character is passed in. - */ - private static void removeAllOccurrencesOn_(char[] string, char c, int first, Writer writer) { - writeStringOn(string, 0, first, writer); - int len = string.length; - for (int i = first; i < len; i++) { - char d = string[i]; - if (d != c) { - writeCharOn(d, writer); - } - } - } - - /** - * Remove all occurrences of the specified character - * from the specified string and append the result to the - * specified string buffer. - * String#removeAllOccurrencesOn(char, StringBuffer) - */ - public static void removeAllOccurrencesOn(char[] string, char c, StringBuffer sb) { - int first = ArrayTools.indexOf(string, c); - if (first == -1) { - sb.append(string); - } else { - removeAllOccurrencesOn_(string, c, first, sb); - } - } - - /* - * The index of the first matching character is passed in. - */ - private static void removeAllOccurrencesOn_(char[] string, char c, int first, StringBuffer sb) { - sb.append(string, 0, first); - int len = string.length; - for (int i = first; i < len; i++) { - char d = string[i]; - if (d != c) { - sb.append(d); - } - } - } - - /** - * Remove all occurrences of the specified character - * from the specified string and append the result to the - * specified string builder. - * String#removeAllOccurrencesOn(char, StringBuilder) - */ - public static void removeAllOccurrencesOn(char[] string, char c, StringBuilder sb) { - int first = ArrayTools.indexOf(string, c); - if (first == -1) { - sb.append(string); - } else { - removeAllOccurrencesOn_(string, c, first, sb); - } - } - - /* - * The index of the first matching character is passed in. - */ - private static void removeAllOccurrencesOn_(char[] string, char c, int first, StringBuilder sb) { - sb.append(string, 0, first); - int len = string.length; - for (int i = first; i < len; i++) { - char d = string[i]; - if (d != c) { - sb.append(d); - } - } - } - - /** - * Remove all the spaces from the specified string and return the result. - * String#removeAllSpaces() - */ - public static String removeAllSpaces(String string) { - return removeAllOccurrences(string, ' '); - } - - /** - * Remove all the spaces - * from the specified string and write the result to the specified writer. - * String#removeAllSpacesOn(Writer) - */ - public static void removeAllSpacesOn(String string, Writer writer) { - removeAllOccurrencesOn(string, ' ', writer); - } - - /** - * Remove all the spaces - * from the specified string and write the result to the specified - * string buffer. - * String#removeAllSpacesOn(StringBuffer) - */ - public static void removeAllSpacesOn(String string, StringBuffer sb) { - removeAllOccurrencesOn(string, ' ', sb); - } - - /** - * Remove all the spaces - * from the specified string and write the result to the specified - * string builder. - * String#removeAllSpacesOn(StringBuilder) - */ - public static void removeAllSpacesOn(String string, StringBuilder sb) { - removeAllOccurrencesOn(string, ' ', sb); - } - - /** - * Remove all the spaces from the specified string and return the result. - * String#removeAllSpaces() - */ - public static char[] removeAllSpaces(char[] string) { - return removeAllOccurrences(string, ' '); - } - - /** - * Remove all the spaces - * from the specified string and write the result to the - * specified writer. - * String#removeAllSpacesOn(Writer) - */ - public static void removeAllSpacesOn(char[] string, Writer writer) { - removeAllOccurrencesOn(string, ' ', writer); - } - - /** - * Remove all the spaces - * from the specified string and append the result to the - * specified string buffer. - * String#removeAllSpacesOn(StringBuffer) - */ - public static void removeAllSpacesOn(char[] string, StringBuffer sb) { - removeAllOccurrencesOn(string, ' ', sb); - } - - /** - * Remove all the spaces - * from the specified string and append the result to the - * specified string builder. - * String#removeAllSpacesOn(StringBuilder) - */ - public static void removeAllSpacesOn(char[] string, StringBuilder sb) { - removeAllOccurrencesOn(string, ' ', sb); - } - - /** - * Remove all the whitespace from the specified string and return the result. - * String#removeAllWhitespace() - */ - public static String removeAllWhitespace(String string) { - char[] string2 = string.toCharArray(); - int first = indexOfWhitespace_(string2); - return (first == -1) ? string : new String(removeAllWhitespace_(string2, first)); - } - - /** - * Remove all the whitespace - * from the specified string and append the result to the - * specified writer. - * String#removeAllWhitespaceOn(Writer) - */ - public static void removeAllWhitespaceOn(String string, Writer writer) { - char[] string2 = string.toCharArray(); - int first = indexOfWhitespace_(string2); - if (first == -1) { - writeStringOn(string, writer); - } else { - removeAllWhitespaceOn_(string2, first, writer); - } - } - - /** - * Remove all the whitespace - * from the specified string and append the result to the - * specified string buffer. - * String#removeAllWhitespaceOn(StringBuffer) - */ - public static void removeAllWhitespaceOn(String string, StringBuffer sb) { - char[] string2 = string.toCharArray(); - int first = indexOfWhitespace_(string2); - if (first == -1) { - sb.append(string); - } else { - removeAllWhitespaceOn_(string2, first, sb); - } - } - - /** - * Remove all the whitespace - * from the specified string and append the result to the - * specified string builder. - * String#removeAllWhitespaceOn(StringBuilder) - */ - public static void removeAllWhitespaceOn(String string, StringBuilder sb) { - char[] string2 = string.toCharArray(); - int first = indexOfWhitespace_(string2); - if (first == -1) { - sb.append(string); - } else { - removeAllWhitespaceOn_(string2, first, sb); - } - } - - /** - * Remove all the whitespace from the specified string and return the result. - * String#removeAllWhitespace() - */ - public static char[] removeAllWhitespace(char[] string) { - int first = indexOfWhitespace_(string); - return (first == -1) ? string : removeAllWhitespace_(string, first); - } - - private static int indexOfWhitespace_(char[] string) { - int len = string.length; - for (int i = 0; i < len; i++) { - if (Character.isWhitespace(string[i])) { - return i; - } - } - return -1; - } - - /* - * The index of the first non-whitespace character is passed in. - */ - private static char[] removeAllWhitespace_(char[] string, int first) { - StringBuilder sb = new StringBuilder(string.length); - removeAllWhitespaceOn_(string, first, sb); - return convertToCharArray(sb); - } - - /** - * Remove all the whitespace - * from the specified string and append the result to the - * specified writer. - * String#removeAllWhitespaceOn(Writer) - */ - public static void removeAllWhitespaceOn(char[] string, Writer writer) { - int first = indexOfWhitespace_(string); - if (first == -1) { - writeStringOn(string, writer); - } else { - removeAllWhitespaceOn_(string, first, writer); - } - } - - /* - * The index of the first whitespace character is passed in. - */ - private static void removeAllWhitespaceOn_(char[] string, int first, Writer writer) { - writeStringOn(string, 0, first, writer); - int len = string.length; - for (int i = first; i < len; i++) { - char c = string[i]; - if ( ! Character.isWhitespace(c)) { - writeCharOn(c, writer); - } - } - } - - /** - * Remove all the whitespace - * from the specified string and append the result to the - * specified string buffer. - * String#removeAllWhitespaceOn(StringBuffer) - */ - public static void removeAllWhitespaceOn(char[] string, StringBuffer sb) { - int first = indexOfWhitespace_(string); - if (first == -1) { - sb.append(string); - } else { - removeAllWhitespaceOn_(string, first, sb); - } - } - - /* - * The index of the first whitespace character is passed in. - */ - private static void removeAllWhitespaceOn_(char[] string, int first, StringBuffer sb) { - sb.append(string, 0, first); - int len = string.length; - for (int i = first; i < len; i++) { - char c = string[i]; - if ( ! Character.isWhitespace(c)) { - sb.append(c); - } - } - } - - /** - * Remove all the whitespace - * from the specified string and append the result to the - * specified string builder. - * String#removeAllWhitespaceOn(StringBuilder) - */ - public static void removeAllWhitespaceOn(char[] string, StringBuilder sb) { - int first = indexOfWhitespace_(string); - if (first == -1) { - sb.append(string); - } else { - removeAllWhitespaceOn_(string, first, sb); - } - } - - /* - * The index of the first whitespace character is passed in. - */ - private static void removeAllWhitespaceOn_(char[] string, int first, StringBuilder sb) { - sb.append(string, 0, first); - int len = string.length; - for (int i = first; i < len; i++) { - char c = string[i]; - if ( ! Character.isWhitespace(c)) { - sb.append(c); - } - } - } -//=============================== - /** - * Compress the whitespace in the specified string and return the result. - * The whitespace is compressed by replacing any occurrence of one or more - * whitespace characters with a single space. - * String#compressWhitespace() - */ - public static String compressWhitespace(String string) { - char[] string2 = string.toCharArray(); - int first = indexOfWhitespace_(string2); - return (first == -1) ? string : new String(compressWhitespace_(string2, first)); - } - - /** - * Compress the whitespace - * in the specified string and append the result to the - * specified writer. - * The whitespace is compressed by replacing any occurrence of one or more - * whitespace characters with a single space. - * String#compressWhitespaceOn(Writer) - */ - public static void compressWhitespaceOn(String string, Writer writer) { - char[] string2 = string.toCharArray(); - int first = indexOfWhitespace_(string2); - if (first == -1) { - writeStringOn(string, writer); - } else { - compressWhitespaceOn_(string2, first, writer); - } - } - - /** - * Compress the whitespace - * in the specified string and append the result to the - * specified string buffer. - * The whitespace is compressed by replacing any occurrence of one or more - * whitespace characters with a single space. - * String#compressWhitespaceOn(StringBuffer) - */ - public static void compressWhitespaceOn(String string, StringBuffer sb) { - char[] string2 = string.toCharArray(); - int first = indexOfWhitespace_(string2); - if (first == -1) { - sb.append(string); - } else { - compressWhitespaceOn_(string2, first, sb); - } - } - - /** - * Compress the whitespace - * in the specified string and append the result to the - * specified string builder. - * The whitespace is compressed by replacing any occurrence of one or more - * whitespace characters with a single space. - * String#compressWhitespaceOn(StringBuilder) - */ - public static void compressWhitespaceOn(String string, StringBuilder sb) { - char[] string2 = string.toCharArray(); - int first = indexOfWhitespace_(string2); - if (first == -1) { - sb.append(string); - } else { - compressWhitespaceOn_(string2, first, sb); - } - } - - /** - * Compress the whitespace in the specified string and return the result. - * The whitespace is compressed by replacing any occurrence of one or more - * whitespace characters with a single space. - * String#compressWhitespace() - */ - public static char[] compressWhitespace(char[] string) { - int first = indexOfWhitespace_(string); - return (first == -1) ? string : compressWhitespace_(string, first); - } - - /* - * The index of the first whitespace character is passed in. - */ - private static char[] compressWhitespace_(char[] string, int first) { - StringBuilder sb = new StringBuilder(string.length); - compressWhitespaceOn_(string, first, sb); - return convertToCharArray(sb); - } - - /** - * Compress the whitespace - * in the specified string and append the result to the - * specified writer. - * The whitespace is compressed by replacing any occurrence of one or more - * whitespace characters with a single space. - * String#compressWhitespaceOn(Writer) - */ - public static void compressWhitespaceOn(char[] string, Writer writer) { - int first = indexOfWhitespace_(string); - if (first == -1) { - writeStringOn(string, writer); - } else { - compressWhitespaceOn_(string, first, writer); - } - } - - /* - * The index of the first whitespace character is passed in. - */ - private static void compressWhitespaceOn_(char[] string, int first, Writer writer) { - writeStringOn(string, 0, first, writer); - boolean spaceWritten = false; - int len = string.length; - for (int i = first; i < len; i++) { - char c = string[i]; - if (Character.isWhitespace(c)) { - if (spaceWritten) { - // skip subsequent whitespace characters - } else { - // replace first whitespace character with a space - spaceWritten = true; - writeCharOn(' ', writer); - } - } else { - spaceWritten = false; - writeCharOn(c, writer); - } - } - } - - /** - * Compress the whitespace - * in the specified string and append the result to the - * specified string buffer. - * The whitespace is compressed by replacing any occurrence of one or more - * whitespace characters with a single space. - * String#compressWhitespaceOn(StringBuffer) - */ - public static void compressWhitespaceOn(char[] string, StringBuffer sb) { - int first = indexOfWhitespace_(string); - if (first == -1) { - sb.append(string); - } else { - compressWhitespaceOn_(string, first, sb); - } - } - - /* - * The index of the first whitespace character is passed in. - */ - private static void compressWhitespaceOn_(char[] string, int first, StringBuffer sb) { - sb.append(string, 0, first); - boolean spaceWritten = false; - int len = string.length; - for (int i = first; i < len; i++) { - char c = string[i]; - if (Character.isWhitespace(c)) { - if (spaceWritten) { - // skip subsequent whitespace characters - } else { - // replace first whitespace character with a space - spaceWritten = true; - sb.append(' '); - } - } else { - spaceWritten = false; - sb.append(c); - } - } - } - - /** - * Compress the whitespace - * in the specified string and append the result to the - * specified string builder. - * The whitespace is compressed by replacing any occurrence of one or more - * whitespace characters with a single space. - * String#compressWhitespaceOn(StringBuilder) - */ - public static void compressWhitespaceOn(char[] string, StringBuilder sb) { - int first = indexOfWhitespace_(string); - if (first == -1) { - sb.append(string); - } else { - compressWhitespaceOn_(string, first, sb); - } - } - - /* - * The index of the first whitespace character is passed in. - */ - private static void compressWhitespaceOn_(char[] string, int first, StringBuilder sb) { - sb.append(string, 0, first); - boolean spaceWritten = false; - int len = string.length; - for (int i = first; i < len; i++) { - char c = string[i]; - if (Character.isWhitespace(c)) { - if (spaceWritten) { - // skip subsequent whitespace characters - } else { - // replace first whitespace character with a space - spaceWritten = true; - sb.append(' '); - } - } else { - spaceWritten = false; - sb.append(c); - } - } - } - - - // ********** common prefix ********** - - /** - * Return the length of the common prefix shared by the specified strings. - * String#commonPrefixLength(String) - */ - public static int commonPrefixLength(String s1, String s2) { - return commonPrefixLength(s1.toCharArray(), s2.toCharArray()); - } - - /** - * Return the length of the common prefix shared by the specified strings. - */ - public static int commonPrefixLength(char[] s1, char[] s2) { - return commonPrefixLength_(s1, s2, Math.min(s1.length, s2.length)); - } - - /** - * Return the length of the common prefix shared by the specified strings; - * but limit the length to the specified maximum. - * String#commonPrefixLength(String, int) - */ - public static int commonPrefixLength(String s1, String s2, int max) { - return commonPrefixLength(s1.toCharArray(), s2.toCharArray(), max); - } - - /** - * Return the length of the common prefix shared by the specified strings; - * but limit the length to the specified maximum. - */ - public static int commonPrefixLength(char[] s1, char[] s2, int max) { - return commonPrefixLength_(s1, s2, Math.min(max, Math.min(s1.length, s2.length))); - } - - /* - * Return the length of the common prefix shared by the specified strings; - * but limit the length to the specified maximum. Assume the specified - * maximum is less than the lengths of the specified strings. - */ - private static int commonPrefixLength_(char[] s1, char[] s2, int max) { - for (int i = 0; i < max; i++) { - if (s1[i] != s2[i]) { - return i; - } - } - return max; // all the characters up to 'max' are the same - } - - - // ********** capitalization ********** - - /* - * no zero-length check or lower case check - */ - private static char[] capitalize_(char[] string) { - string[0] = Character.toUpperCase(string[0]); - return string; - } - - /** - * Modify and return the specified string with - * its first letter capitalized. - */ - public static char[] capitalize(char[] string) { - if ((string.length == 0) || Character.isUpperCase(string[0])) { - return string; - } - return capitalize_(string); - } - - /** - * Return the specified string with its first letter capitalized. - * String#capitalize() - */ - public static String capitalize(String string) { - if ((string.length() == 0) || Character.isUpperCase(string.charAt(0))) { - return string; - } - return new String(capitalize_(string.toCharArray())); - } - - /** - * Modify each of the specified strings, capitalizing the first letter of - * each. - */ - public static Iterable capitalize(Iterable strings) { - return new TransformationIterable(strings, STRING_CAPITALIZER); - } - - /** - * Modify each of the specified strings, capitalizing the first letter of - * each. - */ - public static Iterator capitalize(Iterator strings) { - return new TransformationIterator(strings, STRING_CAPITALIZER); - } - - private static final Transformer STRING_CAPITALIZER = new Transformer() { - public String transform(String string) { - return StringTools.capitalize(string); - } - }; - - /** - * Modify each of the specified strings, capitalizing the first letter of - * each. - */ - // cannot name method simply 'capitalize' because of type-erasure... - public static Iterable capitalizeCharArrays(Iterable strings) { - return new TransformationIterable(strings, CHAR_ARRAY_CAPITALIZER); - } - - /** - * Modify each of the specified strings, capitalizing the first letter of - * each. - */ - // cannot name method simply 'capitalize' because of type-erasure... - public static Iterator capitalizeCharArrays(Iterator strings) { - return new TransformationIterator(strings, CHAR_ARRAY_CAPITALIZER); - } - - private static final Transformer CHAR_ARRAY_CAPITALIZER = new Transformer() { - public char[] transform(char[] string) { - return StringTools.capitalize(string); - } - }; - - /* - * no zero-length check or upper case check - */ - private static void capitalizeOn_(char[] string, StringBuffer sb) { - sb.append(Character.toUpperCase(string[0])); - sb.append(string, 1, string.length - 1); - } - - /** - * Append the specified string to the specified string buffer - * with its first letter capitalized. - */ - public static void capitalizeOn(char[] string, StringBuffer sb) { - if (string.length == 0) { - return; - } - if (Character.isUpperCase(string[0])) { - sb.append(string); - } else { - capitalizeOn_(string, sb); - } - } - - /** - * Append the specified string to the specified string buffer - * with its first letter capitalized. - * String#capitalizeOn(StringBuffer) - */ - public static void capitalizeOn(String string, StringBuffer sb) { - if (string.length() == 0) { - return; - } - if (Character.isUpperCase(string.charAt(0))) { - sb.append(string); - } else { - capitalizeOn_(string.toCharArray(), sb); - } - } - - /* - * no zero-length check or upper case check - */ - private static void capitalizeOn_(char[] string, StringBuilder sb) { - sb.append(Character.toUpperCase(string[0])); - sb.append(string, 1, string.length - 1); - } - - /** - * Append the specified string to the specified string builder - * with its first letter capitalized. - */ - public static void capitalizeOn(char[] string, StringBuilder sb) { - if (string.length == 0) { - return; - } - if (Character.isUpperCase(string[0])) { - sb.append(string); - } else { - capitalizeOn_(string, sb); - } - } - - /** - * Append the specified string to the specified string builder - * with its first letter capitalized. - * String#capitalizeOn(StringBuffer) - */ - public static void capitalizeOn(String string, StringBuilder sb) { - if (string.length() == 0) { - return; - } - if (Character.isUpperCase(string.charAt(0))) { - sb.append(string); - } else { - capitalizeOn_(string.toCharArray(), sb); - } - } - - /* - * no zero-length check or upper case check - */ - private static void capitalizeOn_(char[] string, Writer writer) { - writeCharOn(Character.toUpperCase(string[0]), writer); - writeStringOn(string, 1, string.length - 1, writer); - } - - /** - * Append the specified string to the specified string buffer - * with its first letter capitalized. - */ - public static void capitalizeOn(char[] string, Writer writer) { - if (string.length == 0) { - return; - } - if (Character.isUpperCase(string[0])) { - writeStringOn(string, writer); - } else { - capitalizeOn_(string, writer); - } - } - - /** - * Append the specified string to the specified string buffer - * with its first letter capitalized. - * String#capitalizeOn(Writer) - */ - public static void capitalizeOn(String string, Writer writer) { - if (string.length() == 0) { - return; - } - if (Character.isUpperCase(string.charAt(0))) { - writeStringOn(string, writer); - } else { - capitalizeOn_(string.toCharArray(), writer); - } - } - - /* - * no zero-length check or lower case check - */ - private static char[] uncapitalize_(char[] string) { - string[0] = Character.toLowerCase(string[0]); - return string; - } - - private static boolean stringNeedNotBeUncapitalized_(char[] string) { - if (string.length == 0) { - return true; - } - if (Character.isLowerCase(string[0])) { - return true; - } - // if both the first and second characters are capitalized, - // return the string unchanged - if ((string.length > 1) - && Character.isUpperCase(string[1]) - && Character.isUpperCase(string[0])){ - return true; - } - return false; - } - - /** - * Modify and return the specified string with its - * first letter converted to lower case. - * (Unless both the first and second letters are upper case, - * in which case the string is returned unchanged.) - */ - public static char[] uncapitalize(char[] string) { - if (stringNeedNotBeUncapitalized_(string)) { - return string; - } - return uncapitalize_(string); - } - - private static boolean stringNeedNotBeUncapitalized_(String string) { - if (string.length() == 0) { - return true; - } - if (Character.isLowerCase(string.charAt(0))) { - return true; - } - // if both the first and second characters are capitalized, - // return the string unchanged - if ((string.length() > 1) - && Character.isUpperCase(string.charAt(1)) - && Character.isUpperCase(string.charAt(0))){ - return true; - } - return false; - } - - /** - * Return the specified string with its first letter converted to lower case. - * (Unless both the first and second letters are upper case, - * in which case the string is returned unchanged.) - * String#uncapitalize() - */ - public static String uncapitalize(String string) { - if (stringNeedNotBeUncapitalized_(string)) { - return string; - } - return new String(uncapitalize_(string.toCharArray())); - } - - /* - * no zero-length check or lower case check - */ - private static void uncapitalizeOn_(char[] string, StringBuffer sb) { - sb.append(Character.toLowerCase(string[0])); - sb.append(string, 1, string.length - 1); - } - - /** - * Append the specified string to the specified string buffer - * with its first letter converted to lower case. - * (Unless both the first and second letters are upper case, - * in which case the string is returned unchanged.) - */ - public static void uncapitalizeOn(char[] string, StringBuffer sb) { - if (stringNeedNotBeUncapitalized_(string)) { - sb.append(string); - } else { - uncapitalizeOn_(string, sb); - } - } - - /** - * Append the specified string to the specified string buffer - * with its first letter converted to lower case. - * (Unless both the first and second letters are upper case, - * in which case the string is returned unchanged.) - * String#uncapitalizeOn(StringBuffer) - */ - public static void uncapitalizeOn(String string, StringBuffer sb) { - if (stringNeedNotBeUncapitalized_(string)) { - sb.append(string); - } else { - uncapitalizeOn_(string.toCharArray(), sb); - } - } - - /* - * no zero-length check or lower case check - */ - private static void uncapitalizeOn_(char[] string, StringBuilder sb) { - sb.append(Character.toLowerCase(string[0])); - sb.append(string, 1, string.length - 1); - } - - /** - * Append the specified string to the specified string builder - * with its first letter converted to lower case. - * (Unless both the first and second letters are upper case, - * in which case the string is returned unchanged.) - */ - public static void uncapitalizeOn(char[] string, StringBuilder sb) { - if (stringNeedNotBeUncapitalized_(string)) { - sb.append(string); - } else { - uncapitalizeOn_(string, sb); - } - } - - /** - * Append the specified string to the specified string builder - * with its first letter converted to lower case. - * (Unless both the first and second letters are upper case, - * in which case the string is returned unchanged.) - * String#uncapitalizeOn(StringBuffer) - */ - public static void uncapitalizeOn(String string, StringBuilder sb) { - if (stringNeedNotBeUncapitalized_(string)) { - sb.append(string); - } else { - uncapitalizeOn_(string.toCharArray(), sb); - } - } - - /* - * no zero-length check or upper case check - */ - private static void uncapitalizeOn_(char[] string, Writer writer) { - writeCharOn(Character.toLowerCase(string[0]), writer); - writeStringOn(string, 1, string.length - 1, writer); - } - - /** - * Append the specified string to the specified string buffer - * with its first letter converted to lower case. - * (Unless both the first and second letters are upper case, - * in which case the string is returned unchanged.) - */ - public static void uncapitalizeOn(char[] string, Writer writer) { - if (stringNeedNotBeUncapitalized_(string)) { - writeStringOn(string, writer); - } else { - uncapitalizeOn_(string, writer); - } - } - - /** - * Append the specified string to the specified string buffer - * with its first letter converted to lower case. - * (Unless both the first and second letters are upper case, - * in which case the string is returned unchanged.) - * String#uncapitalizeOn(Writer) - */ - public static void uncapitalizeOn(String string, Writer writer) { - if (stringNeedNotBeUncapitalized_(string)) { - writeStringOn(string, writer); - } else { - uncapitalizeOn_(string.toCharArray(), writer); - } - } - - - // ********** #toString() helper methods ********** - - /** - * Build a "standard" {@link Object#toString() toString()} result for the - * specified object and additional information:
-	 *     ClassName[00-F3-EE-42](add'l info)
-	 * 
- */ - public static String buildToStringFor(Object o, Object additionalInfo) { - StringBuilder sb = new StringBuilder(); - buildSimpleToStringOn(o, sb); - sb.append('('); - sb.append(additionalInfo); - sb.append(')'); - return sb.toString(); - } - - /** - * Build a "standard" {@link Object#toString() toString()} result for the - * specified object:
-	 *     ClassName[00-F3-EE-42]
-	 * 
- */ - public static String buildToStringFor(Object o) { - StringBuilder sb = new StringBuilder(); - buildSimpleToStringOn(o, sb); - return sb.toString(); - } - - /** - * Append a "standard" {@link Object#toString() toString()} result for the - * specified object to the specified buffer:
-	 *     ClassName[00-F3-EE-42]
-	 * 
- */ - public static void buildSimpleToStringOn(Object o, StringBuffer sb) { - sb.append(buildToStringClassName(o.getClass())); - sb.append('['); - separateOn(buildHashCode(o), '-', 2, sb); - sb.append(']'); - } - - private static String buildHashCode(Object o) { - // use System#identityHashCode(Object), since Object#hashCode() may be overridden - return zeroPad(Integer.toHexString(System.identityHashCode(o)).toUpperCase(), 8); - } - - /** - * Append a "standard" {@link Object#toString() toString()} result for the - * specified object to the specified string builder:
-	 *     ClassName[00-F3-EE-42]
-	 * 
- */ - public static void buildSimpleToStringOn(Object o, StringBuilder sb) { - sb.append(buildToStringClassName(o.getClass())); - sb.append('['); - separateOn(buildHashCode(o), '-', 2, sb); - sb.append(']'); - } - - /** - * Return a name suitable for a {@link Object#toString() toString()} implementation. - * {@link Class#getSimpleName()} isn't quite good enough for anonymous - * classes; since it returns an empty string. This method will return the - * name of the anonymous class's super class, which is a bit more helpful. - */ - public static String buildToStringClassName(Class javaClass) { - String simpleName = javaClass.getSimpleName(); - return simpleName.equals("") ? //$NON-NLS-1$ - buildToStringClassName(javaClass.getSuperclass()) : // recurse - simpleName; - } - - /** - * Append the string representations of the objects in the specified array - * to the specified string builder:
-	 *     ["foo", "bar", "baz"]
-	 * 
- */ - public static String append(StringBuilder sb, T[] array) { - return append(sb, new ArrayListIterator(array)); - } - - /** - * Append the string representations of the objects in the specified iterable - * to the specified string builder:
-	 *     ["foo", "bar", "baz"]
-	 * 
- */ - public static String append(StringBuilder sb, Iterable iterable) { - return append(sb, iterable.iterator()); - } - - /** - * Append the string representations of the objects in the specified iterator - * to the specified string builder:
-	 *     ["foo", "bar", "baz"]
-	 * 
- */ - public static String append(StringBuilder sb, Iterator iterator) { - sb.append('['); - while (iterator.hasNext()) { - sb.append(iterator.next()); - if (iterator.hasNext()) { - sb.append(", "); //$NON-NLS-1$ - } - } - sb.append(']'); - return sb.toString(); - } - - - // ********** queries ********** - - /** - * Return whether the specified string is null, empty, or contains - * only whitespace characters. - */ - public static boolean stringIsEmpty(String string) { - if (string == null) { - return true; - } - int len = string.length(); - if (len == 0) { - return true; - } - return stringIsEmpty_(string.toCharArray(), len); - } - - /** - * Return whether the specified string is null, empty, or contains - * only whitespace characters. - */ - public static boolean stringIsEmpty(char[] string) { - if (string == null) { - return true; - } - int len = string.length; - if (len == 0) { - return true; - } - return stringIsEmpty_(string, len); - } - - private static boolean stringIsEmpty_(char[] s, int len) { - for (int i = len; i-- > 0; ) { - if ( ! Character.isWhitespace(s[i])) { - return false; - } - } - return true; - } - - /** - * Return whether the specified string is non-null, non-empty, and does - * not contain only whitespace characters. - */ - public static boolean stringIsNotEmpty(String string) { - return ! stringIsEmpty(string); - } - - /** - * Return whether the specified string is non-null, non-empty, and does - * not contain only whitespace characters. - */ - public static boolean stringIsNotEmpty(char[] string) { - return ! stringIsEmpty(string); - } - - /** - * Return whether the specified strings are equal. - * Check for nulls. - */ - public static boolean stringsAreEqual(String s1, String s2) { - return Tools.valuesAreEqual(s1, s2); - } - - /** - * Return whether the specified strings are equal. - * Check for nulls. - */ - public static boolean stringsAreEqual(char[] s1, char[] s2) { - return (s1 == null) ? - (s2 == null) : - ((s2 != null) && stringsAreEqual_(s1, s2)); - } - - /** - * no null checks - */ - private static boolean stringsAreEqual_(char[] s1, char[] s2) { - int len = s1.length; - if (len != s2.length) { - return false; - } - for (int i = len; i-- > 0; ) { - if (s1[i] != s2[i]) { - return false; - } - } - return true; - } - - /** - * Return whether the specified strings are equal, ignoring case. - * Check for nulls. - */ - public static boolean stringsAreEqualIgnoreCase(String s1, String s2) { - return (s1 == null) ? - (s2 == null) : - ((s2 != null) && s1.equalsIgnoreCase(s2)); - } - - /** - * Return whether the specified strings are equal, ignoring case. - * Check for nulls. - */ - public static boolean stringsAreEqualIgnoreCase(char[] s1, char[] s2) { - return (s1 == null) ? - (s2 == null) : - ((s2 != null) && stringsAreEqualIgnoreCase_(s1, s2)); - } - - /** - * no null checks - */ - private static boolean stringsAreEqualIgnoreCase_(char[] s1, char[] s2) { - int len = s1.length; - if (len != s2.length) { - return false; - } - for (int i = len; i-- > 0; ) { - if ( ! charactersAreEqualIgnoreCase(s1[i], s2[i])) { - return false; - } - } - return true; - } - - /** - * Return whether the specified string starts with the specified prefix, - * ignoring case. - */ - public static boolean stringStartsWithIgnoreCase(char[] string, char[] prefix) { - int prefixLength = prefix.length; - if (string.length < prefixLength) { - return false; - } - for (int i = prefixLength; i-- > 0; ) { - if ( ! charactersAreEqualIgnoreCase(string[i], prefix[i])) { - return false; - } - } - return true; - } - - /** - * Return whether the specified string starts with the specified prefix, - * ignoring case. - */ - public static boolean stringStartsWithIgnoreCase(String string, String prefix) { - return string.regionMatches(true, 0, prefix, 0, prefix.length()); - } - - /** - * Return whether the specified characters are are equal, ignoring case. - * @see java.lang.String#regionMatches(boolean, int, String, int, int) - */ - public static boolean charactersAreEqualIgnoreCase(char c1, char c2) { - // something about the Georgian alphabet requires us to check lower case also - return (c1 == c2) - || (Character.toUpperCase(c1) == Character.toUpperCase(c2)) - || (Character.toLowerCase(c1) == Character.toLowerCase(c2)); - } - - /** - * Return whether the specified string is uppercase. - */ - public static boolean stringIsUppercase(String string) { - return (string.length() == 0) ? false : stringIsUppercase_(string); - } - - /** - * Return whether the specified string is uppercase. - */ - public static boolean stringIsUppercase(char[] string) { - return (string.length == 0) ? false : stringIsUppercase_(new String(string)); - } - - private static boolean stringIsUppercase_(String string) { - return string.equals(string.toUpperCase()); - } - - /** - * Return whether the specified string is lowercase. - */ - public static boolean stringIsLowercase(String string) { - return (string.length() == 0) ? false : stringIsLowercase_(string); - } - - /** - * Return whether the specified string is lowercase. - */ - public static boolean stringIsLowercase(char[] string) { - return (string.length == 0) ? false : stringIsLowercase_(new String(string)); - } - - private static boolean stringIsLowercase_(String string) { - return string.equals(string.toLowerCase()); - } - - - // ********** convert camel case to all caps ********** - - /** - * Convert the specified "camel case" string to an "all caps" string: - * "largeProject" -> "LARGE_PROJECT" - */ - public static String convertCamelCaseToAllCaps(String camelCaseString) { - int len = camelCaseString.length(); - if (len == 0) { - return camelCaseString; - } - return new String(convertCamelCaseToAllCaps_(camelCaseString.toCharArray(), len)); - } - - /** - * Convert the specified "camel case" string to an "all caps" string: - * "largeProject" -> "LARGE_PROJECT" - */ - public static char[] convertCamelCaseToAllCaps(char[] camelCaseString) { - int len = camelCaseString.length; - if (len == 0) { - return camelCaseString; - } - return convertCamelCaseToAllCaps_(camelCaseString, len); - } - - private static char[] convertCamelCaseToAllCaps_(char[] camelCaseString, int len) { - StringBuilder sb = new StringBuilder(len * 2); - convertCamelCaseToAllCapsOn_(camelCaseString, len, sb); - return convertToCharArray(sb); - } - - /** - * Convert the specified "camel case" string to an "all caps" string: - * "largeProject" -> "LARGE_PROJECT" - */ - public static void convertCamelCaseToAllCapsOn(String camelCaseString, StringBuffer sb) { - int len = camelCaseString.length(); - if (len != 0) { - convertCamelCaseToAllCapsOn_(camelCaseString.toCharArray(), len, sb); - } - } - - /** - * Convert the specified "camel case" string to an "all caps" string: - * "largeProject" -> "LARGE_PROJECT" - */ - public static void convertCamelCaseToAllCapsOn(char[] camelCaseString, StringBuffer sb) { - int len = camelCaseString.length; - if (len != 0) { - convertCamelCaseToAllCapsOn_(camelCaseString, len, sb); - } - } - - private static void convertCamelCaseToAllCapsOn_(char[] camelCaseString, int len, StringBuffer sb) { - char prev = 0; // assume 0 is not a valid char - char c = 0; - char next = camelCaseString[0]; - for (int i = 1; i <= len; i++) { // NB: start at 1 and end at len! - c = next; - next = ((i == len) ? 0 : camelCaseString[i]); - if (camelCaseWordBreak_(prev, c, next)) { - sb.append('_'); - } - sb.append(Character.toUpperCase(c)); - prev = c; - } - } - - /** - * Convert the specified "camel case" string to an "all caps" string: - * "largeProject" -> "LARGE_PROJECT" - */ - public static void convertCamelCaseToAllCapsOn(String camelCaseString, StringBuilder sb) { - int len = camelCaseString.length(); - if (len != 0) { - convertCamelCaseToAllCapsOn_(camelCaseString.toCharArray(), len, sb); - } - } - - /** - * Convert the specified "camel case" string to an "all caps" string: - * "largeProject" -> "LARGE_PROJECT" - */ - public static void convertCamelCaseToAllCapsOn(char[] camelCaseString, StringBuilder sb) { - int len = camelCaseString.length; - if (len != 0) { - convertCamelCaseToAllCapsOn_(camelCaseString, len, sb); - } - } - - private static void convertCamelCaseToAllCapsOn_(char[] camelCaseString, int len, StringBuilder sb) { - char prev = 0; // assume 0 is not a valid char - char c = 0; - char next = camelCaseString[0]; - for (int i = 1; i <= len; i++) { // NB: start at 1 and end at len! - c = next; - next = ((i == len) ? 0 : camelCaseString[i]); - if (camelCaseWordBreak_(prev, c, next)) { - sb.append('_'); - } - sb.append(Character.toUpperCase(c)); - prev = c; - } - } - - /** - * Convert the specified "camel case" string to an "all caps" string: - * "largeProject" -> "LARGE_PROJECT" - */ - public static void convertCamelCaseToAllCapsOn(String camelCaseString, Writer writer) { - int len = camelCaseString.length(); - if (len != 0) { - convertCamelCaseToAllCapsOn_(camelCaseString.toCharArray(), len, writer); - } - } - - /** - * Convert the specified "camel case" string to an "all caps" string: - * "largeProject" -> "LARGE_PROJECT" - */ - public static void convertCamelCaseToAllCapsOn(char[] camelCaseString, Writer writer) { - int len = camelCaseString.length; - if (len != 0) { - convertCamelCaseToAllCapsOn_(camelCaseString, len, writer); - } - } - - private static void convertCamelCaseToAllCapsOn_(char[] camelCaseString, int len, Writer writer) { - char prev = 0; // assume 0 is not a valid char - char c = 0; - char next = camelCaseString[0]; - for (int i = 1; i <= len; i++) { // NB: start at 1 and end at len! - c = next; - next = ((i == len) ? 0 : camelCaseString[i]); - if (camelCaseWordBreak_(prev, c, next)) { - writeCharOn('_', writer); - } - writeCharOn(Character.toUpperCase(c), writer); - prev = c; - } - } - - /** - * Convert the specified "camel case" string to an "all caps" string: - * "largeProject" -> "LARGE_PROJECT" - * Limit the resulting string to the specified maximum length. - */ - public static String convertCamelCaseToAllCaps(String camelCaseString, int maxLength) { - int len = camelCaseString.length(); - if ((len == 0) || (maxLength == 0)) { - return camelCaseString; - } - return new String(convertCamelCaseToAllCaps_(camelCaseString.toCharArray(), maxLength, len)); - } - - /** - * Convert the specified "camel case" string to an "all caps" string: - * "largeProject" -> "LARGE_PROJECT" - * Limit the resulting string to the specified maximum length. - */ - public static char[] convertCamelCaseToAllCaps(char[] camelCaseString, int maxLength) { - int len = camelCaseString.length; - if ((len == 0) || (maxLength == 0)) { - return camelCaseString; - } - return convertCamelCaseToAllCaps_(camelCaseString, maxLength, len); - } - - private static char[] convertCamelCaseToAllCaps_(char[] camelCaseString, int maxLength, int len) { - StringBuilder sb = new StringBuilder(maxLength); - convertCamelCaseToAllCapsOn_(camelCaseString, maxLength, len, sb); - return convertToCharArray(sb); - } - - /** - * Convert the specified "camel case" string to an "all caps" string: - * "largeProject" -> "LARGE_PROJECT" - * Limit the resulting string to the specified maximum length. - */ - public static void convertCamelCaseToAllCapsOn(String camelCaseString, int maxLength, StringBuffer sb) { - int len = camelCaseString.length(); - if ((len != 0) && (maxLength != 0)) { - convertCamelCaseToAllCapsOn_(camelCaseString.toCharArray(), maxLength, len, sb); - } - } - - /** - * Convert the specified "camel case" string to an "all caps" string: - * "largeProject" -> "LARGE_PROJECT" - * Limit the resulting string to the specified maximum length. - */ - public static void convertCamelCaseToAllCapsOn(char[] camelCaseString, int maxLength, StringBuffer sb) { - int len = camelCaseString.length; - if ((len != 0) && (maxLength != 0)) { - convertCamelCaseToAllCapsOn_(camelCaseString, maxLength, len, sb); - } - } - - private static void convertCamelCaseToAllCapsOn_(char[] camelCaseString, int maxLength, int len, StringBuffer sb) { - char prev = 0; // assume 0 is not a valid char - char c = 0; - char next = camelCaseString[0]; - for (int i = 1; i <= len; i++) { // NB: start at 1 and end at len! - c = next; - next = ((i == len) ? 0 : camelCaseString[i]); - if (camelCaseWordBreak_(prev, c, next)) { - sb.append('_'); - if (sb.length() == maxLength) { - return; - } - } - sb.append(Character.toUpperCase(c)); - if (sb.length() == maxLength) { - return; - } - prev = c; - } - } - - /** - * Convert the specified "camel case" string to an "all caps" string: - * "largeProject" -> "LARGE_PROJECT" - * Limit the resulting string to the specified maximum length. - */ - public static void convertCamelCaseToAllCapsOn(String camelCaseString, int maxLength, StringBuilder sb) { - int len = camelCaseString.length(); - if ((len != 0) && (maxLength != 0)) { - convertCamelCaseToAllCapsOn_(camelCaseString.toCharArray(), maxLength, len, sb); - } - } - - /** - * Convert the specified "camel case" string to an "all caps" string: - * "largeProject" -> "LARGE_PROJECT" - * Limit the resulting string to the specified maximum length. - */ - public static void convertCamelCaseToAllCapsOn(char[] camelCaseString, int maxLength, StringBuilder sb) { - int len = camelCaseString.length; - if ((len != 0) && (maxLength != 0)) { - convertCamelCaseToAllCapsOn_(camelCaseString, maxLength, len, sb); - } - } - - private static void convertCamelCaseToAllCapsOn_(char[] camelCaseString, int maxLength, int len, StringBuilder sb) { - char prev = 0; // assume 0 is not a valid char - char c = 0; - char next = camelCaseString[0]; - for (int i = 1; i <= len; i++) { // NB: start at 1 and end at len! - c = next; - next = ((i == len) ? 0 : camelCaseString[i]); - if (camelCaseWordBreak_(prev, c, next)) { - sb.append('_'); - if (sb.length() == maxLength) { - return; - } - } - sb.append(Character.toUpperCase(c)); - if (sb.length() == maxLength) { - return; - } - prev = c; - } - } - - /** - * Convert the specified "camel case" string to an "all caps" string: - * "largeProject" -> "LARGE_PROJECT" - * Limit the resulting string to the specified maximum length. - */ - public static void convertCamelCaseToAllCapsOn(String camelCaseString, int maxLength, Writer writer) { - int len = camelCaseString.length(); - if ((len != 0) && (maxLength != 0)) { - convertCamelCaseToAllCapsOn_(camelCaseString.toCharArray(), maxLength, len, writer); - } - } - - /** - * Convert the specified "camel case" string to an "all caps" string: - * "largeProject" -> "LARGE_PROJECT" - * Limit the resulting string to the specified maximum length. - */ - public static void convertCamelCaseToAllCapsOn(char[] camelCaseString, int maxLength, Writer writer) { - int len = camelCaseString.length; - if ((len != 0) && (maxLength != 0)) { - convertCamelCaseToAllCapsOn_(camelCaseString, maxLength, len, writer); - } - } - - private static void convertCamelCaseToAllCapsOn_(char[] camelCaseString, int maxLength, int len, Writer writer) { - char prev = 0; // assume 0 is not a valid char - char c = 0; - char next = camelCaseString[0]; - int writerLength = 0; - for (int i = 1; i <= len; i++) { // NB: start at 1 and end at len! - c = next; - next = ((i == len) ? 0 : camelCaseString[i]); - if (camelCaseWordBreak_(prev, c, next)) { - writeCharOn('_', writer); - if (++writerLength == maxLength) { - return; - } - } - writeCharOn(Character.toUpperCase(c), writer); - if (++writerLength == maxLength) { - return; - } - prev = c; - } - } - - /* - * Return whether the specified series of characters occur at - * a "camel case" work break: - * "*aa" -> false - * "*AA" -> false - * "*Aa" -> false - * "AaA" -> false - * "AAA" -> false - * "aa*" -> false - * "AaA" -> false - * "aAa" -> true - * "AA*" -> false - * "AAa" -> true - * where '*' == any char - */ - private static boolean camelCaseWordBreak_(char prev, char c, char next) { - if (prev == 0) { // start of string - return false; - } - if (Character.isLowerCase(c)) { - return false; - } - if (Character.isLowerCase(prev)) { - return true; - } - if (next == 0) { // end of string - return false; - } - return Character.isLowerCase(next); - } - - - // ********** convert underscores to camel case ********** - - /** - * Convert the specified "underscore" string to a "camel case" string: - * "LARGE_PROJECT" -> "LargeProject" - * Capitalize the first letter. - */ - public static String convertUnderscoresToCamelCase(String underscoreString) { - return convertUnderscoresToCamelCase(underscoreString, true); - } - - /** - * Convert the specified "underscore" string to a "camel case" string: - * "LARGE_PROJECT" -> "LargeProject" - * Capitalize the first letter. - */ - public static char[] convertUnderscoresToCamelCase(char[] underscoreString) { - return convertUnderscoresToCamelCase(underscoreString, true); - } - - /** - * Convert the specified "underscore" string to a "camel case" string: - * "LARGE_PROJECT" -> "largeProject" - * Optionally capitalize the first letter. - */ - public static String convertUnderscoresToCamelCase(String underscoreString, boolean capitalizeFirstLetter) { - int len = underscoreString.length(); - if (len == 0) { - return underscoreString; - } - return new String(convertUnderscoresToCamelCase_(underscoreString.toCharArray(), capitalizeFirstLetter, len)); - } - - /** - * Convert the specified "underscore" string to a "camel case" string: - * "LARGE_PROJECT" -> "largeProject" - * Optionally capitalize the first letter. - */ - public static char[] convertUnderscoresToCamelCase(char[] underscoreString, boolean capitalizeFirstLetter) { - int len = underscoreString.length; - if (len == 0) { - return underscoreString; - } - return convertUnderscoresToCamelCase_(underscoreString, capitalizeFirstLetter, len); - } - - private static char[] convertUnderscoresToCamelCase_(char[] underscoreString, boolean capitalizeFirstLetter, int len) { - StringBuilder sb = new StringBuilder(len); - convertUnderscoresToCamelCaseOn_(underscoreString, capitalizeFirstLetter, len, sb); - return convertToCharArray(sb); - } - - /** - * Convert the specified "underscore" string to a "camel case" string: - * "LARGE_PROJECT" -> "largeProject" - * Optionally capitalize the first letter. - */ - public static void convertUnderscoresToCamelCaseOn(String underscoreString, boolean capitalizeFirstLetter, StringBuffer sb) { - int len = underscoreString.length(); - if (len != 0) { - convertUnderscoresToCamelCaseOn_(underscoreString.toCharArray(), capitalizeFirstLetter, len, sb); - } - } - - /** - * Convert the specified "underscore" string to a "camel case" string: - * "LARGE_PROJECT" -> "largeProject" - * Optionally capitalize the first letter. - */ - public static void convertUnderscoresToCamelCaseOn(char[] underscoreString, boolean capitalizeFirstLetter, StringBuffer sb) { - int len = underscoreString.length; - if (len != 0) { - convertUnderscoresToCamelCaseOn_(underscoreString, capitalizeFirstLetter, len, sb); - } - } - - private static void convertUnderscoresToCamelCaseOn_(char[] underscoreString, boolean capitalizeFirstLetter, int len, StringBuffer sb) { - char prev = 0; - char c = 0; - boolean first = true; - for (int i = 0; i < len; i++) { - prev = c; - c = underscoreString[i]; - if (c == '_') { - continue; - } - if (first) { - first = false; - sb.append(capitalizeFirstLetter ? Character.toUpperCase(c) : Character.toLowerCase(c)); - } else { - sb.append((prev == '_') ? Character.toUpperCase(c) : Character.toLowerCase(c)); - } - } - } - - /** - * Convert the specified "underscore" string to a "camel case" string: - * "LARGE_PROJECT" -> "largeProject" - * Optionally capitalize the first letter. - */ - public static void convertUnderscoresToCamelCaseOn(String underscoreString, boolean capitalizeFirstLetter, StringBuilder sb) { - int len = underscoreString.length(); - if (len != 0) { - convertUnderscoresToCamelCaseOn_(underscoreString.toCharArray(), capitalizeFirstLetter, len, sb); - } - } - - /** - * Convert the specified "underscore" string to a "camel case" string: - * "LARGE_PROJECT" -> "largeProject" - * Optionally capitalize the first letter. - */ - public static void convertUnderscoresToCamelCaseOn(char[] underscoreString, boolean capitalizeFirstLetter, StringBuilder sb) { - int len = underscoreString.length; - if (len != 0) { - convertUnderscoresToCamelCaseOn_(underscoreString, capitalizeFirstLetter, len, sb); - } - } - - private static void convertUnderscoresToCamelCaseOn_(char[] underscoreString, boolean capitalizeFirstLetter, int len, StringBuilder sb) { - char prev = 0; - char c = 0; - boolean first = true; - for (int i = 0; i < len; i++) { - prev = c; - c = underscoreString[i]; - if (c == '_') { - continue; - } - if (first) { - first = false; - sb.append(capitalizeFirstLetter ? Character.toUpperCase(c) : Character.toLowerCase(c)); - } else { - sb.append((prev == '_') ? Character.toUpperCase(c) : Character.toLowerCase(c)); - } - } - } - - /** - * Convert the specified "underscore" string to a "camel case" string: - * "LARGE_PROJECT" -> "largeProject" - * Optionally capitalize the first letter. - */ - public static void convertUnderscoresToCamelCaseOn(String underscoreString, boolean capitalizeFirstLetter, Writer writer) { - int len = underscoreString.length(); - if (len != 0) { - convertUnderscoresToCamelCaseOn_(underscoreString.toCharArray(), capitalizeFirstLetter, len, writer); - } - } - - /** - * Convert the specified "underscore" string to a "camel case" string: - * "LARGE_PROJECT" -> "largeProject" - * Optionally capitalize the first letter. - */ - public static void convertUnderscoresToCamelCaseOn(char[] underscoreString, boolean capitalizeFirstLetter, Writer writer) { - int len = underscoreString.length; - if (len != 0) { - convertUnderscoresToCamelCaseOn_(underscoreString, capitalizeFirstLetter, len, writer); - } - } - - private static void convertUnderscoresToCamelCaseOn_(char[] underscoreString, boolean capitalizeFirstLetter, int len, Writer writer) { - char prev = 0; - char c = 0; - boolean first = true; - for (int i = 0; i < len; i++) { - prev = c; - c = underscoreString[i]; - if (c == '_') { - continue; - } - if (first) { - first = false; - writeCharOn(capitalizeFirstLetter ? Character.toUpperCase(c) : Character.toLowerCase(c), writer); - } else { - writeCharOn((prev == '_') ? Character.toUpperCase(c) : Character.toLowerCase(c), writer); - } - } - } - - - // ********** convert to Java string literal ********** - - public static final String EMPTY_JAVA_STRING_LITERAL = "\"\""; //$NON-NLS-1$ - public static final char[] EMPTY_JAVA_STRING_LITERAL_CHAR_ARRAY = EMPTY_JAVA_STRING_LITERAL.toCharArray(); - - public static String convertToJavaStringLiteral(String string) { - int len = string.length(); - if (len == 0) { - return EMPTY_JAVA_STRING_LITERAL; - } - StringBuilder sb = new StringBuilder(len + 5); - convertToJavaStringLiteralOn_(string.toCharArray(), sb, len); - return sb.toString(); - } - - public static char[] convertToJavaStringLiteral(char[] string) { - int len = string.length; - if (len == 0) { - return EMPTY_JAVA_STRING_LITERAL_CHAR_ARRAY; - } - StringBuilder sb = new StringBuilder(len + 5); - convertToJavaStringLiteralOn_(string, sb, len); - len = sb.length(); - char[] result = new char[len]; - sb.getChars(0, len, result, 0); - return result; - } - - public static Iterable convertToJavaStringLiterals(Iterable strings) { - return new TransformationIterable(strings, STRING_TO_JAVA_STRING_LITERAL_TRANSFORMER); - } - - public static Iterator convertToJavaStringLiterals(Iterator strings) { - return new TransformationIterator(strings, STRING_TO_JAVA_STRING_LITERAL_TRANSFORMER); - } - - private static final Transformer STRING_TO_JAVA_STRING_LITERAL_TRANSFORMER = new Transformer() { - public String transform(String string) { - return StringTools.convertToJavaStringLiteral(string); - } - }; - - // cannot name method simply 'convertToJavaStringLiterals' because of type-erasure... - public static Iterable convertToJavaCharArrayLiterals(Iterable strings) { - return new TransformationIterable(strings, CHAR_ARRAY_TO_JAVA_STRING_LITERAL_TRANSFORMER); - } - - // cannot name method simply 'convertToJavaStringLiterals' because of type-erasure... - public static Iterator convertToJavaCharArrayLiterals(Iterator strings) { - return new TransformationIterator(strings, CHAR_ARRAY_TO_JAVA_STRING_LITERAL_TRANSFORMER); - } - - private static final Transformer CHAR_ARRAY_TO_JAVA_STRING_LITERAL_TRANSFORMER = new Transformer() { - public char[] transform(char[] string) { - return StringTools.convertToJavaStringLiteral(string); - } - }; - - public static void convertToJavaStringLiteralOn(String string, StringBuffer sb) { - int len = string.length(); - if (len == 0) { - sb.append(EMPTY_JAVA_STRING_LITERAL); - } else { - convertToJavaStringLiteralOn_(string.toCharArray(), sb, len); - } - } - - public static void convertToJavaStringLiteralOn(char[] string, StringBuffer sb) { - int len = string.length; - if (len == 0) { - sb.append(EMPTY_JAVA_STRING_LITERAL); - } else { - convertToJavaStringLiteralOn_(string, sb, len); - } - } - - /* - * no length checks - */ - private static void convertToJavaStringLiteralOn_(char[] string, StringBuffer sb, int len) { - sb.ensureCapacity(sb.length() + len + 5); - sb.append(QUOTE); - for (char c : string) { - switch (c) { - case '\b': // backspace - sb.append("\\b"); //$NON-NLS-1$ - break; - case '\t': // horizontal tab - sb.append("\\t"); //$NON-NLS-1$ - break; - case '\n': // line-feed LF - sb.append("\\n"); //$NON-NLS-1$ - break; - case '\f': // form-feed FF - sb.append("\\f"); //$NON-NLS-1$ - break; - case '\r': // carriage-return CR - sb.append("\\r"); //$NON-NLS-1$ - break; - case '"': // double-quote - sb.append("\\\""); //$NON-NLS-1$ - break; -// case '\'': // single-quote -// sb.append("\\'"); //$NON-NLS-1$ -// break; - case '\\': // backslash - sb.append("\\\\"); //$NON-NLS-1$ - break; - default: - sb.append(c); - break; - } - } - sb.append(QUOTE); - } - - public static void convertToJavaStringLiteralOn(String string, StringBuilder sb) { - int len = string.length(); - if (len == 0) { - sb.append(EMPTY_JAVA_STRING_LITERAL); - } else { - convertToJavaStringLiteralOn_(string.toCharArray(), sb, len); - } - } - - public static void convertToJavaStringLiteralOn(char[] string, StringBuilder sb) { - int len = string.length; - if (len == 0) { - sb.append(EMPTY_JAVA_STRING_LITERAL); - } else { - convertToJavaStringLiteralOn_(string, sb, len); - } - } - - /* - * no length checks - */ - private static void convertToJavaStringLiteralOn_(char[] string, StringBuilder sb, int len) { - sb.ensureCapacity(sb.length() + len + 5); - sb.append(QUOTE); - for (char c : string) { - switch (c) { - case '\b': // backspace - sb.append("\\b"); //$NON-NLS-1$ - break; - case '\t': // horizontal tab - sb.append("\\t"); //$NON-NLS-1$ - break; - case '\n': // line-feed LF - sb.append("\\n"); //$NON-NLS-1$ - break; - case '\f': // form-feed FF - sb.append("\\f"); //$NON-NLS-1$ - break; - case '\r': // carriage-return CR - sb.append("\\r"); //$NON-NLS-1$ - break; - case '"': // double-quote - sb.append("\\\""); //$NON-NLS-1$ - break; -// case '\'': // single-quote -// sb.append("\\'"); //$NON-NLS-1$ -// break; - case '\\': // backslash - sb.append("\\\\"); //$NON-NLS-1$ - break; - default: - sb.append(c); - break; - } - } - sb.append(QUOTE); - } - - public static void convertToJavaStringLiteralOn(String string, Writer writer) { - if (string.length() == 0) { - writeStringOn(EMPTY_JAVA_STRING_LITERAL, writer); - } else { - convertToJavaStringLiteralOn_(string.toCharArray(), writer); - } - } - - public static void convertToJavaStringLiteralOn(char[] string, Writer writer) { - if (string.length == 0) { - writeStringOn(EMPTY_JAVA_STRING_LITERAL, writer); - } else { - convertToJavaStringLiteralOn_(string, writer); - } - } - - /* - * no length checks - */ - private static void convertToJavaStringLiteralOn_(char[] string, Writer writer) { - writeCharOn(QUOTE, writer); - for (char c : string) { - switch (c) { - case '\b': // backspace - writeStringOn("\\b", writer); //$NON-NLS-1$ - break; - case '\t': // horizontal tab - writeStringOn("\\t", writer); //$NON-NLS-1$ - break; - case '\n': // line-feed LF - writeStringOn("\\n", writer); //$NON-NLS-1$ - break; - case '\f': // form-feed FF - writeStringOn("\\f", writer); //$NON-NLS-1$ - break; - case '\r': // carriage-return CR - writeStringOn("\\r", writer); //$NON-NLS-1$ - break; - case '"': // double-quote - writeStringOn("\\\"", writer); //$NON-NLS-1$ - break; -// case '\'': // single-quote -// writeStringOn("\\'", writer); //$NON-NLS-1$ -// break; - case '\\': // backslash - writeStringOn("\\\\", writer); //$NON-NLS-1$ - break; - default: - writeCharOn(c, writer); - break; - } - } - writeCharOn(QUOTE, writer); - } - - - // ********** convenience ********** - - public static char[] convertToCharArray(StringBuffer sb) { - int len = sb.length(); - char[] result = new char[len]; - sb.getChars(0, len, result, 0); - return result; - } - - public static char[] convertToCharArray(StringBuilder sb) { - int len = sb.length(); - char[] result = new char[len]; - sb.getChars(0, len, result, 0); - return result; - } - - private static void writeStringOn(char[] string, Writer writer) { - try { - writer.write(string); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - - private static void writeStringOn(char[] string, char escape, Writer writer) { - try { - for (char c : string) { - if (c == escape) { - writer.write(c); - } - writer.write(c); - } - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - - private static void writeStringOn(char[] string, int off, int len, Writer writer) { - try { - writer.write(string, off, len); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - - private static void writeStringOn(String string, int off, int len, Writer writer) { - try { - writer.write(string, off, len); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - - private static void writeStringOn(String string, Writer writer) { - try { - writer.write(string); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - - private static void writeCharOn(char c, Writer writer) { - try { - writer.write(c); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - - - // ********** constructor ********** - - /* - * Suppress default constructor, ensuring non-instantiability. - */ - private StringTools() { - super(); - throw new UnsupportedOperationException(); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedBag.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedBag.java deleted file mode 100644 index 5bcce38db1..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedBag.java +++ /dev/null @@ -1,220 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import java.util.Collection; -import java.util.Iterator; - -/** - * Thread-safe implementation of the {@link Bag} interface. - */ -public class SynchronizedBag - implements Bag, Serializable -{ - /** Backing bag. */ - private final Bag bag; - - /** Object to synchronize on. */ - private final Object mutex; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a synchronized bag that wraps the - * specified bag and locks on the specified mutex. - */ - public SynchronizedBag(Bag bag, Object mutex) { - super(); - if (bag == null) { - throw new NullPointerException(); - } - this.bag = bag; - this.mutex = mutex; - } - - /** - * Construct a synchronized bag that wraps the - * specified bag and locks on itself. - */ - public SynchronizedBag(Bag bag) { - super(); - if (bag == null) { - throw new NullPointerException(); - } - this.bag = bag; - this.mutex = this; - } - - /** - * Construct a synchronized bag that locks on the specified mutex. - */ - public SynchronizedBag(Object mutex) { - this(new HashBag(), mutex); - } - - /** - * Construct a synchronized bag that locks on itself. - */ - public SynchronizedBag() { - this(new HashBag()); - } - - - // ********** Bag implementation ********** - - public boolean add(E o, int count) { - synchronized (this.mutex) { - return this.bag.add(o, count); - } - } - - public int count(Object o) { - synchronized (this.mutex) { - return this.bag.count(o); - } - } - - public Iterator> entries() { - synchronized (this.mutex) { - return this.bag.entries(); - } - } - - public boolean remove(Object o, int count) { - synchronized (this.mutex) { - return this.bag.remove(o, count); - } - } - - public int uniqueCount() { - synchronized (this.mutex) { - return this.bag.uniqueCount(); - } - } - - public Iterator uniqueIterator() { - synchronized (this.mutex) { - return this.bag.uniqueIterator(); - } - } - - - // ********** Collection implementation ********** - - public boolean add(E e) { - synchronized (this.mutex) { - return this.bag.add(e); - } - } - - public boolean addAll(Collection c) { - synchronized (this.mutex) { - return this.bag.addAll(c); - } - } - - public void clear() { - synchronized (this.mutex) { - this.bag.clear(); - } - } - - public boolean contains(Object o) { - synchronized (this.mutex) { - return this.bag.contains(o); - } - } - - public boolean containsAll(Collection c) { - synchronized (this.mutex) { - return this.bag.containsAll(c); - } - } - - public boolean isEmpty() { - synchronized (this.mutex) { - return this.bag.isEmpty(); - } - } - - public Iterator iterator() { - synchronized (this.mutex) { - return this.bag.iterator(); - } - } - - public boolean remove(Object o) { - synchronized (this.mutex) { - return this.bag.remove(o); - } - } - - public boolean removeAll(Collection c) { - synchronized (this.mutex) { - return this.bag.removeAll(c); - } - } - - public boolean retainAll(Collection c) { - synchronized (this.mutex) { - return this.bag.retainAll(c); - } - } - - public int size() { - synchronized (this.mutex) { - return this.bag.size(); - } - } - - public Object[] toArray() { - synchronized (this.mutex) { - return this.bag.toArray(); - } - } - - public T[] toArray(T[] a) { - synchronized (this.mutex) { - return this.bag.toArray(a); - } - } - - - // ********** additional public protocol ********** - - /** - * Return the object the stack locks on while performing - * its operations. - */ - public Object getMutex() { - return this.mutex; - } - - - // ********** Object overrides ********** - - @Override - public String toString() { - synchronized (this.mutex) { - return this.bag.toString(); - } - } - - private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { - synchronized (this.mutex) { - s.defaultWriteObject(); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedBoolean.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedBoolean.java deleted file mode 100644 index e42a7e6691..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedBoolean.java +++ /dev/null @@ -1,437 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import org.eclipse.jpt.common.utility.Command; - -/** - * This class provides synchronized access to a boolean value. - * It also provides protocol for suspending a thread until the - * boolean value is set to true or false, - * with optional time-outs. - * - * @see SimpleBooleanReference - */ -public class SynchronizedBoolean - implements BooleanReference, Cloneable, Serializable -{ - /** Backing boolean. */ - private boolean value; - - /** Object to synchronize on. */ - private final Object mutex; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Create a synchronized boolean with the specified - * initial value and mutex. - */ - public SynchronizedBoolean(boolean value, Object mutex) { - super(); - this.value = value; - this.mutex = mutex; - } - - /** - * Create a synchronized boolean with the - * specified initial value. - * The synchronized boolean itself will be the mutex. - */ - public SynchronizedBoolean(boolean value) { - super(); - this.value = value; - this.mutex = this; - } - - /** - * Create a synchronized boolean - * with an initial value of false - * and specified mutex. - */ - public SynchronizedBoolean(Object mutex) { - this(false, mutex); - } - - /** - * Create a synchronized boolean - * with an initial value of false. - * The synchronized boolean itself will be the mutex. - */ - public SynchronizedBoolean() { - this(false); - } - - - // ********** accessors ********** - - public boolean getValue() { - synchronized (this.mutex) { - return this.value; - } - } - - public boolean is(boolean v) { - synchronized (this.mutex) { - return this.value == v; - } - } - - public boolean isNot(boolean v) { - synchronized (this.mutex) { - return this.value != v; - } - } - - public boolean isTrue() { - synchronized (this.mutex) { - return this.value; - } - } - - public boolean isFalse() { - synchronized (this.mutex) { - return ! this.value; - } - } - - /** - * If the value changes, all waiting threads are notified. - */ - public boolean setValue(boolean value) { - synchronized (this.mutex) { - return this.setValue_(value); - } - } - - /** - * Pre-condition: synchronized - */ - private boolean setValue_(boolean v) { - return (v == this.value) ? v : this.setChangedValue_(v); - } - - /** - * Pre-condition: synchronized and new value is different - */ - private boolean setChangedValue_(boolean v) { - this.value = v; - this.mutex.notifyAll(); - return ! v; - } - - /** - * If the value changes, all waiting threads are notified. - */ - public boolean flip() { - synchronized (this.mutex) { - return ! this.setChangedValue_( ! this.value); - } - } - - /** - * If the value changes, all waiting threads are notified. - */ - public boolean setNot(boolean v) { - return this.setValue( ! v); - } - - /** - * If the value changes, all waiting threads are notified. - */ - public boolean setTrue() { - return this.setValue(true); - } - - /** - * If the value changes, all waiting threads are notified. - */ - public boolean setFalse() { - return this.setValue(false); - } - - /** - * Return the object this object locks on while performing - * its operations. - */ - public Object getMutex() { - return this.mutex; - } - - - // ********** indefinite waits ********** - - /** - * Suspend the current thread until the boolean value changes - * to the specified value. If the boolean value is already the - * specified value, return immediately. - */ - public void waitUntilValueIs(boolean v) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilValueIs_(v); - } - } - - /** - * Pre-condition: synchronized - */ - private void waitUntilValueIs_(boolean v) throws InterruptedException { - while (this.value != v) { - this.mutex.wait(); - } - } - - /** - * Suspend the current thread until the boolean value - * changes to the NOT of the specified value. - * If the boolean value is already the NOT of the specified - * value, return immediately. - */ - public void waitUntilValueIsNot(boolean v) throws InterruptedException { - this.waitUntilValueIs( ! v); - } - - /** - * Suspend the current thread until the boolean value - * changes to true. - * If the boolean value is already true, - * return immediately. - */ - public void waitUntilTrue() throws InterruptedException { - this.waitUntilValueIs(true); - } - - /** - * Suspend the current thread until the boolean value - * changes to false. - * If the boolean value is already false, - * return immediately. - */ - public void waitUntilFalse() throws InterruptedException { - this.waitUntilValueIs(false); - } - - /** - * Suspend the current thread until the boolean value changes to - * not the specified value, then change it back to the specified - * value and continue executing. If the boolean value is already - * not the specified value, set the value to the specified value - * immediately. - */ - public void waitToSetValue(boolean v) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilValueIs_( ! v); - this.setChangedValue_(v); - } - } - - /** - * Suspend the current thread until the boolean value - * changes to false, - * then change it back to true and continue executing. - * If the boolean value is already false, - * set the value to true immediately. - */ - public void waitToSetTrue() throws InterruptedException { - this.waitToSetValue(true); - } - - /** - * Suspend the current thread until the boolean value - * changes to true, - * then change it back to false and continue executing. - * If the boolean value is already true, - * set the value to false immediately. - */ - public void waitToSetFalse() throws InterruptedException { - this.waitToSetValue(false); - } - - - // ********** timed waits ********** - - /** - * Suspend the current thread until the boolean value changes - * to the specified value or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true if - * the specified value was achieved; - * return false if a time-out occurred. - * If the boolean value is already the specified value, - * return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilValueIs(boolean v, long timeout) throws InterruptedException { - synchronized (this.mutex) { - return this.waitUntilValueIs_(v, timeout); - } - } - - /** - * Pre-condition: synchronized - */ - private boolean waitUntilValueIs_(boolean v, long timeout) throws InterruptedException { - if (timeout == 0L) { - this.waitUntilValueIs_(v); // wait indefinitely until notified - return true; // if it ever comes back, the condition was met - } - - long stop = System.currentTimeMillis() + timeout; - long remaining = timeout; - while ((this.value != v) && (remaining > 0L)) { - this.mutex.wait(remaining); - remaining = stop - System.currentTimeMillis(); - } - return (this.value == v); - } - - /** - * Suspend the current thread until the boolean value - * changes to the NOT of the specified value or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true if - * the NOT of the specified value was achieved; - * return false if a time-out occurred. - * If the boolean value is already the NOT of the specified - * value, return immediately. - * If the time-out is zero, wait indefinitely. - */ - public void waitUntilValueIsNot(boolean v, long timeout) throws InterruptedException { - this.waitUntilValueIs( ! v, timeout); - } - - /** - * Suspend the current thread until the boolean value changes - * to true or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true if - * true was achieved; - * return false if a time-out occurred. - * If the boolean value is already true, - * return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilTrue(long timeout) throws InterruptedException { - return this.waitUntilValueIs(true, timeout); - } - - /** - * Suspend the current thread until the boolean value changes - * to false or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true if - * false was achieved; - * return false if a time-out occurred. - * If the boolean value is already true, - * return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilFalse(long timeout) throws InterruptedException { - return this.waitUntilValueIs(false, timeout); - } - - /** - * Suspend the current thread until the boolean value changes - * to not the specified value, then change it back to the specified - * value and continue executing. If the boolean value does not - * change to false before the time-out, simply continue - * executing without changing the value. - * The time-out is specified in milliseconds. Return true - * if the value was set to the specified value; return false - * if a time-out occurred. If the boolean value is already - * not the specified value, set the value to the specified value - * immediately and return true. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitToSetValue(boolean v, long timeout) throws InterruptedException { - synchronized (this.mutex) { - boolean success = this.waitUntilValueIs_( ! v, timeout); - if (success) { - this.setChangedValue_(v); - } - return success; - } - } - - /** - * Suspend the current thread until the boolean value changes - * to false, then change it back to true and - * continue executing. If the boolean value does not change to - * false before the time-out, simply continue executing without - * changing the value. The time-out is specified in milliseconds. Return - * true if the value was set to true; - * return false if a time-out occurred. If the - * boolean value is already false, set the - * value to true immediately and return true. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitToSetTrue(long timeout) throws InterruptedException { - return this.waitToSetValue(true, timeout); - } - - /** - * Suspend the current thread until the boolean value changes - * to true, then change it back to false and - * continue executing. If the boolean value does not change to - * true before the time-out, simply continue executing without - * changing the value. The time-out is specified in milliseconds. Return - * true if the value was set to false; - * return false if a time-out occurred. If the - * boolean value is already true, set the - * value to false immediately and return true. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitToSetFalse(long timeout) throws InterruptedException { - return this.waitToSetValue(false, timeout); - } - - - // ********** synchronized behavior ********** - - /** - * If the current thread is not interrupted, execute the specified command - * with the mutex locked. This is useful for initializing the value from another - * thread. - */ - public void execute(Command command) throws InterruptedException { - if (Thread.interrupted()) { - throw new InterruptedException(); - } - synchronized (this.mutex) { - command.execute(); - } - } - - - // ********** standard methods ********** - - @Override - public SynchronizedBoolean clone() { - try { - synchronized (this.mutex) { - return (SynchronizedBoolean) super.clone(); - } - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - @Override - public String toString() { - return '[' + String.valueOf(this.getValue()) + ']'; - } - - private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { - synchronized (this.mutex) { - s.defaultWriteObject(); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedInt.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedInt.java deleted file mode 100644 index 999aa44aa8..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedInt.java +++ /dev/null @@ -1,914 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; - -import org.eclipse.jpt.common.utility.Command; - -/** - * This class provides synchronized access to an int. - * It also provides protocol for suspending a thread until the - * value is set to a specified value, with optional time-outs. - * - * @see SimpleIntReference - */ -public class SynchronizedInt - implements IntReference, Cloneable, Serializable -{ - /** Backing int. */ - private int value; - - /** Object to synchronize on. */ - private final Object mutex; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Create a synchronized integer with the specified initial value - * and mutex. - */ - public SynchronizedInt(int value, Object mutex) { - super(); - this.value = value; - this.mutex = mutex; - } - - /** - * Create a synchronized integer with the specified initial value. - * The synchronized integer itself will be the mutex. - */ - public SynchronizedInt(int value) { - super(); - this.value = value; - this.mutex = this; - } - - /** - * Create a synchronized integer with an initial value of zero - * and the specified mutex. - */ - public SynchronizedInt(Object mutex) { - this(0, mutex); - } - - /** - * Create a synchronized object with an initial value of zero. - * The synchronized integer itself will be the mutex. - */ - public SynchronizedInt() { - this(0); - } - - - // ********** methods ********** - - public int getValue() { - synchronized (this.mutex) { - return this.value; - } - } - - public boolean equals(int v) { - synchronized (this.mutex) { - return this.value == v; - } - } - - public boolean notEqual(int v) { - synchronized (this.mutex) { - return this.value != v; - } - } - - public boolean isZero() { - synchronized (this.mutex) { - return this.value == 0; - } - } - - public boolean isNotZero() { - synchronized (this.mutex) { - return this.value != 0; - } - } - - public boolean isGreaterThan(int v) { - synchronized (this.mutex) { - return this.value > v; - } - } - - public boolean isGreaterThanOrEqual(int v) { - synchronized (this.mutex) { - return this.value >= v; - } - } - - public boolean isLessThan(int v) { - synchronized (this.mutex) { - return this.value < v; - } - } - - public boolean isLessThanOrEqual(int v) { - synchronized (this.mutex) { - return this.value <= v; - } - } - - public boolean isPositive() { - return this.isGreaterThan(0); - } - - public boolean isNotPositive() { - return this.isLessThanOrEqual(0); - } - - public boolean isNegative() { - return this.isLessThan(0); - } - - public boolean isNotNegative() { - return this.isGreaterThanOrEqual(0); - } - - public int abs() { - synchronized (this.mutex) { - return Math.abs(this.value); - } - } - - public int neg() { - synchronized (this.mutex) { - return -this.value; - } - } - - public int add(int v) { - synchronized (this.mutex) { - return this.value + v; - } - } - - public int subtract(int v) { - synchronized (this.mutex) { - return this.value - v; - } - } - - public int multiply(int v) { - synchronized (this.mutex) { - return this.value * v; - } - } - - public int divide(int v) { - synchronized (this.mutex) { - return this.value / v; - } - } - - public int remainder(int v) { - synchronized (this.mutex) { - return this.value % v; - } - } - - public int min(int v) { - synchronized (this.mutex) { - return Math.min(this.value, v); - } - } - - public int max(int v) { - synchronized (this.mutex) { - return Math.max(this.value, v); - } - } - - public double pow(int v) { - synchronized (this.mutex) { - return Math.pow(this.value, v); - } - } - - /** - * If the value changes, all waiting threads are notified. - */ - public int setValue(int value) { - synchronized (this.mutex) { - return this.setValue_(value); - } - } - - /** - * Pre-condition: synchronized - */ - private int setValue_(int v) { - int old = this.value; - return (old == v) ? old : this.setValue_(v, old); - } - - /** - * Pre-condition: synchronized and new value is different - */ - private int setChangedValue_(int v) { - return this.setValue_(v, this.value); - } - - /** - * Pre-condition: synchronized and new value is different - */ - private int setValue_(int v, int old) { - this.value = v; - this.mutex.notifyAll(); - return old; - } - - /** - * Set the value to zero. If the value changes, all waiting - * threads are notified. Return the previous value. - */ - public int setZero() { - return this.setValue(0); - } - - /** - * Increment the value by one. - * Return the new value. - */ - public int increment() { - synchronized (this.mutex) { - this.value++; - this.mutex.notifyAll(); - return this.value; - } - } - - /** - * Decrement the value by one. - * Return the new value. - */ - public int decrement() { - synchronized (this.mutex) { - this.value--; - this.mutex.notifyAll(); - return this.value; - } - } - - /** - * If the current value is the specified expected value, set it to the - * specified new value. Return the previous value. - */ - public int compareAndSwap(int expectedValue, int newValue) { - synchronized (this.mutex) { - return this.compareAndSwap_(expectedValue, newValue); - } - } - - /** - * Pre-condition: synchronized - */ - private int compareAndSwap_(int expectedValue, int newValue) { - return (this.value == expectedValue) ? this.setValue_(newValue) : this.value; - } - - /** - * Return the object the synchronized integer locks on while performing - * its operations. - */ - public Object getMutex() { - return this.mutex; - } - - - // ********** indefinite waits ********** - - /** - * Suspend the current thread until the value changes - * to the specified value. If the value is already the - * specified value, return immediately. - */ - public void waitUntilEqual(int v) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilEqual_(v); - } - } - - /** - * Pre-condition: synchronized - */ - private void waitUntilEqual_(int v) throws InterruptedException { - while (this.value != v) { - this.mutex.wait(); - } - } - - /** - * Suspend the current thread until the value changes - * to something other than the specified value. If the - * value is already not the specified value, - * return immediately. - */ - public void waitUntilNotEqual(int v) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilNotEqual_(v); - } - } - - /** - * Pre-condition: synchronized - */ - private void waitUntilNotEqual_(int v) throws InterruptedException { - while (this.value == v) { - this.mutex.wait(); - } - } - - /** - * Suspend the current thread until the value changes to zero. - * If the value is already zero, return immediately. - */ - public void waitUntilZero() throws InterruptedException { - this.waitUntilEqual(0); - } - - /** - * Suspend the current thread until the value changes - * to something other than zero. - * If the value is already not zero, - * return immediately. - */ - public void waitUntilNotZero() throws InterruptedException { - this.waitUntilNotEqual(0); - } - - /** - * Suspend the current thread until the value changes - * to a value greater than the specified value. If the value is already - * greater than the specified value, return immediately. - */ - public void waitUntilGreaterThan(int v) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilGreaterThan_(v); - } - } - - /** - * Pre-condition: synchronized - */ - private void waitUntilGreaterThan_(int v) throws InterruptedException { - while (this.value <= v) { - this.mutex.wait(); - } - } - - /** - * Suspend the current thread until the value changes - * to a value greater than or equal to the specified value. If the value is already - * greater than or equal the specified value, return immediately. - */ - public void waitUntilGreaterThanOrEqual(int v) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilGreaterThanOrEqual_(v); - } - } - - /** - * Pre-condition: synchronized - */ - private void waitUntilGreaterThanOrEqual_(int v) throws InterruptedException { - while (this.value < v) { - this.mutex.wait(); - } - } - - /** - * Suspend the current thread until the value changes - * to a value less than the specified value. If the value is already - * less than the specified value, return immediately. - */ - public void waitUntilLessThan(int v) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilLessThan_(v); - } - } - - /** - * Pre-condition: synchronized - */ - private void waitUntilLessThan_(int v) throws InterruptedException { - while (this.value >= v) { - this.mutex.wait(); - } - } - - /** - * Suspend the current thread until the value changes - * to a value less than or equal to the specified value. If the value is already - * less than or equal the specified value, return immediately. - */ - public void waitUntilLessThanOrEqual(int v) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilLessThanOrEqual_(v); - } - } - - /** - * Pre-condition: synchronized - */ - private void waitUntilLessThanOrEqual_(int v) throws InterruptedException { - while (this.value > v) { - this.mutex.wait(); - } - } - - /** - * Suspend the current thread until the value is positive. - * If the value is already positive, return immediately. - */ - public void waitUntilPositive() throws InterruptedException { - this.waitUntilGreaterThan(0); - } - - /** - * Suspend the current thread until the value is not positive - * (i.e. negative or zero). - * If the value is already not positive, - * return immediately. - */ - public void waitUntilNotPositive() throws InterruptedException { - this.waitUntilLessThanOrEqual(0); - } - - /** - * Suspend the current thread until the value is negative. - * If the value is already negative, return immediately. - */ - public void waitUntilNegative() throws InterruptedException { - this.waitUntilLessThan(0); - } - - /** - * Suspend the current thread until the value is not negative - * (i.e. zero or positive). - * If the value is already not negative, - * return immediately. - */ - public void waitUntilNotNegative() throws InterruptedException { - this.waitUntilGreaterThanOrEqual(0); - } - - /** - * Suspend the current thread until the value changes to - * something other than the specified value, then change - * it back to the specified value and continue executing. - * If the value is already not the specified value, set - * the value immediately. - * Return the previous value. - */ - public int waitToSetValue(int v) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilNotEqual_(v); - return this.setChangedValue_(v); - } - } - - /** - * Suspend the current thread until the value changes to - * something other than zero, then change it - * back to zero and continue executing. - * If the value is already not zero, - * set the value to zero immediately. - * Return the previous value. - */ - public int waitToSetZero() throws InterruptedException { - return this.waitToSetValue(0); - } - - /** - * Suspend the current thread until the value changes to - * the specified expected value, then change it - * to the specified new value and continue executing. - * If the value is already the specified expected value, - * set the value to the specified new value immediately. - * Return the previous value. - */ - public int waitToSwap(int expectedValue, int newValue) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilEqual_(expectedValue); - return this.setValue_(newValue); - } - } - - - // ********** timed waits ********** - - /** - * Suspend the current thread until the value changes - * to the specified value or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true - * if the specified value was achieved; return false - * if a time-out occurred. - * If the value is already the specified value, return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilEqual(int v, long timeout) throws InterruptedException { - synchronized (this.mutex) { - return this.waitUntilEqual_(v, timeout); - } - } - - /** - * Pre-condition: synchronized - */ - private boolean waitUntilEqual_(int v, long timeout) throws InterruptedException { - if (timeout == 0L) { - this.waitUntilEqual_(v); // wait indefinitely until notified - return true; // if it ever comes back, the condition was met - } - - long stop = System.currentTimeMillis() + timeout; - long remaining = timeout; - while ((this.value != v) && (remaining > 0L)) { - this.mutex.wait(remaining); - remaining = stop - System.currentTimeMillis(); - } - return (this.value == v); - } - - /** - * Suspend the current thread until the value changes to something - * other than the specified value or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true - * if the specified value was removed; return false if a - * time-out occurred. If the value is already not the specified - * value, return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilNotEqual(int v, long timeout) throws InterruptedException { - synchronized (this.mutex) { - return this.waitUntilNotEqual_(v, timeout); - } - } - - /** - * Pre-condition: synchronized - */ - private boolean waitUntilNotEqual_(int v, long timeout) throws InterruptedException { - if (timeout == 0L) { - this.waitUntilNotEqual_(v); // wait indefinitely until notified - return true; // if it ever comes back, the condition was met - } - - long stop = System.currentTimeMillis() + timeout; - long remaining = timeout; - while ((this.value == v) && (remaining > 0L)) { - this.mutex.wait(remaining); - remaining = stop - System.currentTimeMillis(); - } - return (this.value != v); - } - - /** - * Suspend the current thread until the value changes - * to zero or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true - * if the value is now zero; return false - * if a time-out occurred. If the value is already zero, - * return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilZero(long timeout) throws InterruptedException { - return this.waitUntilEqual(0, timeout); - } - - /** - * Suspend the current thread until the value changes - * to something other than zero or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true - * if the value is now not zero; return false - * if a time-out occurred. If the value is already not - * zero, return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilNotZero(long timeout) throws InterruptedException { - return this.waitUntilNotEqual(0, timeout); - } - - /** - * Suspend the current thread until the value changes to a value greater - * than the specified value or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true - * if the specified value was achieved; return false - * if a time-out occurred. - * If the value is already greater than the specified value, return immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilGreaterThan(int v, long timeout) throws InterruptedException { - synchronized (this.mutex) { - return this.waitUntilGreaterThan_(v, timeout); - } - } - - /** - * Pre-condition: synchronized - */ - private boolean waitUntilGreaterThan_(int v, long timeout) throws InterruptedException { - if (timeout == 0L) { - this.waitUntilGreaterThan_(v); // wait indefinitely until notified - return true; // if it ever comes back, the condition was met - } - - long stop = System.currentTimeMillis() + timeout; - long remaining = timeout; - while ((this.value <= v) && (remaining > 0L)) { - this.mutex.wait(remaining); - remaining = stop - System.currentTimeMillis(); - } - return (this.value > v); - } - - /** - * Suspend the current thread until the value changes to a value greater - * than or equal to the specified value or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true - * if the specified value was achieved; return false - * if a time-out occurred. - * If the value is already greater than or equal to the specified value, - * return immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilGreaterThanOrEqual(int v, long timeout) throws InterruptedException { - synchronized (this.mutex) { - return this.waitUntilGreaterThanOrEqual_(v, timeout); - } - } - - /** - * Pre-condition: synchronized - */ - private boolean waitUntilGreaterThanOrEqual_(int v, long timeout) throws InterruptedException { - if (timeout == 0L) { - this.waitUntilGreaterThanOrEqual_(v); // wait indefinitely until notified - return true; // if it ever comes back, the condition was met - } - - long stop = System.currentTimeMillis() + timeout; - long remaining = timeout; - while ((this.value < v) && (remaining > 0L)) { - this.mutex.wait(remaining); - remaining = stop - System.currentTimeMillis(); - } - return (this.value >= v); - } - - /** - * Suspend the current thread until the value changes to a value less - * than the specified value or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true - * if the specified value was achieved; return false - * if a time-out occurred. - * If the value is already less than the specified value, return immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilLessThan(int v, long timeout) throws InterruptedException { - synchronized (this.mutex) { - return this.waitUntilLessThan_(v, timeout); - } - } - - /** - * Pre-condition: synchronized - */ - private boolean waitUntilLessThan_(int v, long timeout) throws InterruptedException { - if (timeout == 0L) { - this.waitUntilLessThan_(v); // wait indefinitely until notified - return true; // if it ever comes back, the condition was met - } - - long stop = System.currentTimeMillis() + timeout; - long remaining = timeout; - while ((this.value >= v) && (remaining > 0L)) { - this.mutex.wait(remaining); - remaining = stop - System.currentTimeMillis(); - } - return (this.value < v); - } - - /** - * Suspend the current thread until the value changes to a value less - * than or equal to the specified value or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true - * if the specified value was achieved; return false - * if a time-out occurred. - * If the value is already less than or equal to the specified value, - * return immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilLessThanOrEqual(int v, long timeout) throws InterruptedException { - synchronized (this.mutex) { - return this.waitUntilLessThanOrEqual_(v, timeout); - } - } - - /** - * Pre-condition: synchronized - */ - private boolean waitUntilLessThanOrEqual_(int v, long timeout) throws InterruptedException { - if (timeout == 0L) { - this.waitUntilLessThanOrEqual_(v); // wait indefinitely until notified - return true; // if it ever comes back, the condition was met - } - - long stop = System.currentTimeMillis() + timeout; - long remaining = timeout; - while ((this.value > v) && (remaining > 0L)) { - this.mutex.wait(remaining); - remaining = stop - System.currentTimeMillis(); - } - return (this.value <= v); - } - - /** - * Suspend the current thread until the value is positive - * or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true - * if the value is now positive; return false - * if a time-out occurred. If the value is already positive, - * return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilPositive(long timeout) throws InterruptedException { - return this.waitUntilGreaterThan(0, timeout); - } - - /** - * Suspend the current thread until the value is not positive - * or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true - * if the value is now not positive; return false - * if a time-out occurred. If the value is already not positive, - * return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilNotPositive(long timeout) throws InterruptedException { - return this.waitUntilLessThanOrEqual(0, timeout); - } - - /** - * Suspend the current thread until the value is negative - * or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true - * if the value is now negative; return false - * if a time-out occurred. If the value is already negative, - * return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilNegative(long timeout) throws InterruptedException { - return this.waitUntilLessThan(0, timeout); - } - - /** - * Suspend the current thread until the value is not negative - * or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true - * if the value is now not negative; return false - * if a time-out occurred. If the value is already not negative, - * return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilNotNegative(long timeout) throws InterruptedException { - return this.waitUntilGreaterThanOrEqual(0, timeout); - } - - /** - * Suspend the current thread until the value changes to - * something other than the specified value, then change - * it back to the specified value and continue executing. - * If the value does not change to something other than the - * specified value before the time-out, simply continue executing - * without changing the value. - * The time-out is specified in milliseconds. Return true - * if the value was set to the specified value; return false - * if a time-out occurred. - * If the value is already something other than the specified value, set - * the value immediately and return true. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitToSetValue(int v, long timeout) throws InterruptedException { - synchronized (this.mutex) { - boolean success = this.waitUntilNotEqual_(v, timeout); - if (success) { - this.setChangedValue_(v); - } - return success; - } - } - - /** - * Suspend the current thread until the value changes to something - * other than zero, then change it back to zero - * and continue executing. If the value does not change to something - * other than zero before the time-out, simply continue - * executing without changing the value. - * The time-out is specified in milliseconds. Return true - * if the value was set to zero; return false - * if a time-out occurred. - * If the value is already something other than zero, set - * the value to zero immediately and return true. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitToSetZero(long timeout) throws InterruptedException { - return this.waitToSetValue(0, timeout); - } - - /** - * Suspend the current thread until the value changes to - * the specified expected value, then change it - * to the specified new value and continue executing. - * If the value does not change to the specified expected value - * before the time-out, simply continue executing without changing - * the value. - * The time-out is specified in milliseconds. Return true - * if the value was set to the specified new value; return - * false if a time-out occurred. - * If the value is already the specified expected value, - * set the value to the specified new value immediately. - * Return the previous value. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitToSwap(int expectedValue, int newValue, long timeout) throws InterruptedException { - synchronized (this.mutex) { - boolean success = this.waitUntilEqual_(expectedValue, timeout); - if (success) { - this.setValue_(newValue); - } - return success; - } - } - - - // ********** synchronized behavior ********** - - /** - * If current thread is not interrupted, execute the specified command - * with the mutex locked. This is useful for initializing the value from another - * thread. - */ - public void execute(Command command) throws InterruptedException { - if (Thread.interrupted()) { - throw new InterruptedException(); - } - synchronized (this.mutex) { - command.execute(); - } - } - - - // ********** Comparable implementation ********** - - public int compareTo(ReadOnlyIntReference ref) { - int thisValue = this.getValue(); - int otherValue = ref.getValue(); - return (thisValue < otherValue) ? -1 : ((thisValue == otherValue) ? 0 : 1); - } - - - // ********** standard methods ********** - - @Override - public SynchronizedInt clone() { - try { - synchronized (this.mutex) { - return (SynchronizedInt) super.clone(); - } - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - @Override - public String toString() { - return '[' + String.valueOf(this.getValue()) + ']'; - } - - private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { - synchronized (this.mutex) { - s.defaultWriteObject(); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedObject.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedObject.java deleted file mode 100644 index f3f2048e01..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedObject.java +++ /dev/null @@ -1,472 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.ObjectReference; - -/** - * This class provides synchronized access to an object of type V. - * It also provides protocol for suspending a thread until the - * value is set to null or a non-null value, - * with optional time-outs. - * - * @parm V the type of the synchronized object's value - * @see SimpleObjectReference - */ -public class SynchronizedObject - implements ObjectReference, Cloneable, Serializable -{ - /** Backing value. */ - private V value; - - /** Object to synchronize on. */ - private final Object mutex; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Create a synchronized object with the specified initial value - * and mutex. - */ - public SynchronizedObject(V value, Object mutex) { - super(); - this.value = value; - this.mutex = mutex; - } - - /** - * Create a synchronized object with the specified initial value. - * The synchronized object itself will be the mutex. - */ - public SynchronizedObject(V value) { - super(); - this.value = value; - this.mutex = this; - } - - /** - * Create a synchronized object with an initial value of null. - * The synchronized object itself will be the mutex. - */ - public SynchronizedObject() { - this(null); - } - - - // ********** accessors ********** - - public V getValue() { - synchronized (this.mutex) { - return this.value; - } - } - - public boolean valueEquals(Object object) { - return Tools.valuesAreEqual(this.getValue(), object); - } - - public boolean valueNotEqual(Object object) { - return Tools.valuesAreDifferent(this.getValue(), object); - } - - public boolean isNull() { - synchronized (this.mutex) { - return this.value == null; - } - } - - public boolean isNotNull() { - synchronized (this.mutex) { - return this.value != null; - } - } - - /** - * Set the value. If the value changes, all waiting - * threads are notified. Return the previous value. - */ - public V setValue(V value) { - synchronized (this.mutex) { - return this.setValue_(value); - } - } - - /** - * Pre-condition: synchronized - */ - private V setValue_(V v) { - V old = this.value; - return Tools.valuesAreEqual(old, v) ? old : this.setValue_(v, old); - } - - /** - * Pre-condition: synchronized and new value is different - */ - private V setChangedValue_(V v) { - return this.setValue_(v, this.value); - } - - /** - * Pre-condition: synchronized and new value is different - */ - private V setValue_(V v, V old) { - this.value = v; - this.mutex.notifyAll(); - return old; - } - - /** - * Set the value to null. If the value changes, all waiting - * threads are notified. Return the previous value. - */ - public V setNull() { - return this.setValue(null); - } - - /** - * If the current value is the specified expected value, set it to the - * specified new value. Return the previous value. - */ - public V compareAndSwap(V expectedValue, V newValue) { - synchronized (this.mutex) { - return this.compareAndSwap_(expectedValue, newValue); - } - } - - /** - * Pre-condition: synchronized - */ - private V compareAndSwap_(V expectedValue, V newValue) { - return Tools.valuesAreEqual(this.value, expectedValue) ? this.setValue_(newValue) : this.value; - } - - /** - * Return the object the synchronized object locks on while performing - * its operations. - */ - public Object getMutex() { - return this.mutex; - } - - - // ********** indefinite waits ********** - - /** - * Suspend the current thread until the value changes - * to the specified value. If the value is already the - * specified value, return immediately. - */ - public void waitUntilValueIs(V v) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilValueIs_(v); - } - } - - /** - * Pre-condition: synchronized - */ - private void waitUntilValueIs_(V v) throws InterruptedException { - while (Tools.valuesAreDifferent(this.value, v)) { - this.mutex.wait(); - } - } - - /** - * Suspend the current thread until the value changes - * to something other than the specified value. If the - * value is already not the specified value, - * return immediately. - */ - public void waitUntilValueIsNot(V v) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilValueIsNot_(v); - } - } - - /** - * Pre-condition: synchronized - */ - private void waitUntilValueIsNot_(V v) throws InterruptedException { - while (Tools.valuesAreEqual(this.value, v)) { - this.mutex.wait(); - } - } - - /** - * Suspend the current thread until the value changes to null. - * If the value is already null, return immediately. - */ - public void waitUntilNull() throws InterruptedException { - this.waitUntilValueIs(null); - } - - /** - * Suspend the current thread until the value changes - * to something other than null. - * If the value is already not null, - * return immediately. - */ - public void waitUntilNotNull() throws InterruptedException { - this.waitUntilValueIsNot(null); - } - - /** - * Suspend the current thread until the value changes to - * something other than the specified value, then change - * it back to the specified value and continue executing. - * If the value is already not the specified value, set - * the value immediately. - * Return the previous value. - */ - public V waitToSetValue(V v) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilValueIsNot_(v); - return this.setChangedValue_(v); - } - } - - /** - * Suspend the current thread until the value changes to - * something other than null, then change it - * back to null and continue executing. - * If the value is already not null, - * set the value to null immediately. - * Return the previous value. - */ - public V waitToSetNull() throws InterruptedException { - return this.waitToSetValue(null); - } - - /** - * Suspend the current thread until the value changes to - * the specified expected value, then change it - * to the specified new value and continue executing. - * If the value is already the specified expected value, - * set the value to the specified new value immediately. - * Return the previous value. - */ - public V waitToSwap(V expectedValue, V newValue) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilValueIs_(expectedValue); - return this.setValue_(newValue); - } - } - - - // ********** timed waits ********** - - /** - * Suspend the current thread until the value changes - * to the specified value or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true - * if the specified value was achieved; return false - * if a time-out occurred. - * If the value is already the specified value, return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilValueIs(V v, long timeout) throws InterruptedException { - synchronized (this.mutex) { - return this.waitUntilValueIs_(v, timeout); - } - } - - /** - * Pre-condition: synchronized - */ - private boolean waitUntilValueIs_(V v, long timeout) throws InterruptedException { - if (timeout == 0L) { - this.waitUntilValueIs_(v); // wait indefinitely until notified - return true; // if it ever comes back, the condition was met - } - - long stop = System.currentTimeMillis() + timeout; - long remaining = timeout; - while (Tools.valuesAreDifferent(this.value, v) && (remaining > 0L)) { - this.mutex.wait(remaining); - remaining = stop - System.currentTimeMillis(); - } - return Tools.valuesAreEqual(this.value, v); - } - - /** - * Suspend the current thread until the value changes to something - * other than the specified value or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true - * if the specified value was removed; return false if a - * time-out occurred. If the value is already not the specified - * value, return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilValueIsNot(V v, long timeout) throws InterruptedException { - synchronized (this.mutex) { - return this.waitUntilValueIsNot_(v, timeout); - } - } - - /** - * Pre-condition: synchronized - */ - private boolean waitUntilValueIsNot_(V v, long timeout) throws InterruptedException { - if (timeout == 0L) { - this.waitUntilValueIsNot_(v); // wait indefinitely until notified - return true; // if it ever comes back, the condition was met - } - - long stop = System.currentTimeMillis() + timeout; - long remaining = timeout; - while (Tools.valuesAreEqual(this.value, v) && (remaining > 0L)) { - this.mutex.wait(remaining); - remaining = stop - System.currentTimeMillis(); - } - return Tools.valuesAreDifferent(this.value, v); - } - - /** - * Suspend the current thread until the value changes - * to null or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true - * if the specified value was achieved; return false - * if a time-out occurred. If the value is already null, - * return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilNull(long timeout) throws InterruptedException { - return this.waitUntilValueIs(null, timeout); - } - - /** - * Suspend the current thread until the value changes - * to something other than null or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true - * if the specified value was achieved; return false - * if a time-out occurred. If the value is already not - * null, return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilNotNull(long timeout) throws InterruptedException { - return this.waitUntilValueIsNot(null, timeout); - } - - /** - * Suspend the current thread until the value changes to - * something other than the specified value, then change - * it back to the specified value and continue executing. - * If the value does not change to something other than the - * specified value before the time-out, simply continue executing - * without changing the value. - * The time-out is specified in milliseconds. Return true - * if the value was set to the specified value; return false - * if a time-out occurred. - * If the value is already something other than the specified value, set - * the value immediately and return true. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitToSetValue(V v, long timeout) throws InterruptedException { - synchronized (this.mutex) { - boolean success = this.waitUntilValueIsNot_(v, timeout); - if (success) { - this.setChangedValue_(v); - } - return success; - } - } - - /** - * Suspend the current thread until the value changes to something - * other than null, then change it back to null - * and continue executing. If the value does not change to something - * other than null before the time-out, simply continue - * executing without changing the value. - * The time-out is specified in milliseconds. Return true - * if the value was set to null; return false - * if a time-out occurred. - * If the value is already something other than null, set - * the value to null immediately and return true. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitToSetNull(long timeout) throws InterruptedException { - return this.waitToSetValue(null, timeout); - } - - /** - * Suspend the current thread until the value changes to - * the specified expected value, then change it - * to the specified new value and continue executing. - * If the value does not change to the specified expected value - * before the time-out, simply continue executing without changing - * the value. - * The time-out is specified in milliseconds. Return true - * if the value was set to the specified new value; return - * false if a time-out occurred. - * If the value is already the specified expected value, - * set the value to the specified new value immediately. - * Return the previous value. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitToSwap(V expectedValue, V newValue, long timeout) throws InterruptedException { - synchronized (this.mutex) { - boolean success = this.waitUntilValueIs_(expectedValue, timeout); - if (success) { - this.setValue_(newValue); - } - return success; - } - } - - - // ********** synchronized behavior ********** - - /** - * If current thread is not interrupted, execute the specified command - * with the mutex locked. This is useful for initializing the value from another - * thread. - */ - public void execute(Command command) throws InterruptedException { - if (Thread.interrupted()) { - throw new InterruptedException(); - } - synchronized (this.mutex) { - command.execute(); - } - } - - - // ********** standard methods ********** - - @Override - public SynchronizedObject clone() { - try { - synchronized (this.mutex) { - @SuppressWarnings("unchecked") - SynchronizedObject clone = (SynchronizedObject) super.clone(); - return clone; - } - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - @Override - public String toString() { - return '[' + String.valueOf(this.getValue()) + ']'; - } - - private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { - synchronized (this.mutex) { - s.defaultWriteObject(); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedQueue.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedQueue.java deleted file mode 100644 index 5abb326021..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedQueue.java +++ /dev/null @@ -1,348 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import java.util.NoSuchElementException; - -import org.eclipse.jpt.common.utility.Command; - -/** - * Thread-safe implementation of the {@link Queue} interface. - * This also provides protocol for suspending a thread until the - * queue is empty or not empty, with optional time-outs. - */ -public class SynchronizedQueue - implements Queue, Serializable -{ - /** Backing queue. */ - private final Queue queue; - - /** Object to synchronize on. */ - private final Object mutex; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a synchronized queue that wraps the - * specified queue and locks on the specified mutex. - */ - public SynchronizedQueue(Queue queue, Object mutex) { - super(); - if (queue == null) { - throw new NullPointerException(); - } - this.queue = queue; - this.mutex = mutex; - } - - /** - * Construct a synchronized queue that wraps the - * specified queue and locks on itself. - */ - public SynchronizedQueue(Queue queue) { - super(); - if (queue == null) { - throw new NullPointerException(); - } - this.queue = queue; - this.mutex = this; - } - - /** - * Construct an empty synchronized queue that locks on the specified mutex. - */ - public SynchronizedQueue(Object mutex) { - this(new SimpleQueue(), mutex); - } - - /** - * Construct an empty synchronized queue that locks on itself. - */ - public SynchronizedQueue() { - this(new SimpleQueue()); - } - - - // ********** Queue implementation ********** - - public void enqueue(E element) { - synchronized (this.mutex) { - this.enqueue_(element); - } - } - - /** - * Pre-condition: synchronized - */ - private void enqueue_(E element) { - this.queue.enqueue(element); - this.mutex.notifyAll(); - } - - public E dequeue() { - synchronized (this.mutex) { - return this.dequeue_(); - } - } - - /** - * Pre-condition: synchronized - */ - private E dequeue_() { - E element = this.queue.dequeue(); - this.mutex.notifyAll(); - return element; - } - - public E peek() { - synchronized (this.mutex) { - return this.queue.peek(); - } - } - - public boolean isEmpty() { - synchronized (this.mutex) { - return this.queue.isEmpty(); - } - } - - - // ********** indefinite waits ********** - - /** - * Suspend the current thread until the queue's empty status changes - * to the specified value. - */ - public void waitUntilEmptyIs(boolean empty) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilEmptyIs_(empty); - } - } - - /** - * Pre-condition: synchronized - */ - private void waitUntilEmptyIs_(boolean empty) throws InterruptedException { - while (this.queue.isEmpty() != empty) { - this.mutex.wait(); - } - } - - /** - * Suspend the current thread until the queue is empty. - */ - public void waitUntilEmpty() throws InterruptedException { - this.waitUntilEmptyIs(true); - } - - /** - * Suspend the current thread until the queue has something on it. - */ - public void waitUntilNotEmpty() throws InterruptedException { - this.waitUntilEmptyIs(false); - } - - /** - * Suspend the current thread until the queue is empty, - * then "enqueue" the specified item to the tail of the queue - * and continue executing. - */ - public void waitToEnqueue(E element) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilEmptyIs_(true); - this.enqueue_(element); - } - } - - /** - * Suspend the current thread until the queue has something on it, - * then "dequeue" an item from the head of the queue and return it. - */ - public Object waitToDequeue() throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilEmptyIs_(false); - return this.dequeue_(); - } - } - - - // ********** timed waits ********** - - /** - * Suspend the current thread until the queue's empty status changes - * to the specified value or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true if the specified - * empty status was achieved; return false if a time-out occurred. - * If the queue's empty status is already the specified value, - * return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilEmptyIs(boolean empty, long timeout) throws InterruptedException { - synchronized (this.mutex) { - return this.waitUntilEmptyIs_(empty, timeout); - } - } - - /** - * Pre-condition: synchronized - */ - private boolean waitUntilEmptyIs_(boolean empty, long timeout) throws InterruptedException { - if (timeout == 0L) { - this.waitUntilEmptyIs_(empty); // wait indefinitely until notified - return true; // if it ever comes back, the condition was met - } - - long stop = System.currentTimeMillis() + timeout; - long remaining = timeout; - while ((this.queue.isEmpty() != empty) && (remaining > 0L)) { - this.mutex.wait(remaining); - remaining = stop - System.currentTimeMillis(); - } - return (this.queue.isEmpty() == empty); - } - - /** - * Suspend the current thread until the queue is empty - * or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true if - * the queue is empty; return false if a time-out occurred. - * If the queue is already empty, return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilEmpty(long timeout) throws InterruptedException { - return this.waitUntilEmptyIs(true, timeout); - } - - /** - * Suspend the current thread until the queue has something on it. - * or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true if - * the queue is not empty; return false if a time-out occurred. - * If the queue already has something on it, return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilNotEmpty(long timeout) throws InterruptedException { - return this.waitUntilEmptyIs(false, timeout); - } - - /** - * Suspend the current thread until the queue is empty, - * then "enqueue" the specified item to the tail of the queue - * and continue executing. If the queue is not emptied out - * before the time-out, simply continue executing without - * "enqueueing" the item. - * The time-out is specified in milliseconds. Return true if the - * item was enqueued; return false if a time-out occurred. - * If the queue is already empty, "enqueue" the specified item and - * return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitToEnqueue(E element, long timeout) throws InterruptedException { - synchronized (this.mutex) { - boolean success = this.waitUntilEmptyIs_(true, timeout); - if (success) { - this.enqueue_(element); - } - return success; - } - } - - /** - * Suspend the current thread until the queue has something on it, - * then "dequeue" an item from the head of the queue and return it. - * If the queue is empty and nothing is "enqueued" on to it before the - * time-out, throw a no such element exception. - * The time-out is specified in milliseconds. - * If the queue is not empty, "dequeue" an item and - * return it immediately. - * If the time-out is zero, wait indefinitely. - */ - public Object waitToDequeue(long timeout) throws InterruptedException { - synchronized (this.mutex) { - boolean success = this.waitUntilEmptyIs_(false, timeout); - if (success) { - return this.dequeue_(); - } - throw new NoSuchElementException(); - } - } - - - // ********** synchronized behavior ********** - - /** - * If the current thread is not interrupted, execute the specified command - * with the mutex locked. This is useful for initializing the queue in another - * thread. - */ - public void execute(Command command) throws InterruptedException { - if (Thread.interrupted()) { - throw new InterruptedException(); - } - synchronized (this.mutex) { - command.execute(); - } - } - - - // ********** additional public protocol ********** - - /** - * "Drain" all the current items from the queue into specified queue. - */ - public void drainTo(Queue q) { - synchronized (this.mutex) { - this.drainTo_(q); - } - } - - /** - * Pre-condition: synchronized - */ - private void drainTo_(Queue q) { - boolean changed = false; - while ( ! this.queue.isEmpty()) { - q.enqueue(this.queue.dequeue()); - changed = true; - } - if (changed) { - this.mutex.notifyAll(); - } - } - - /** - * Return the object the queue locks on while performing - * its operations. - */ - public Object getMutex() { - return this.mutex; - } - - - // ********** standard methods ********** - - @Override - public String toString() { - synchronized (this.mutex) { - return '[' + this.queue.toString() + ']'; - } - } - - private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { - synchronized (this.mutex) { - s.defaultWriteObject(); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedStack.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedStack.java deleted file mode 100644 index 17033fc574..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/SynchronizedStack.java +++ /dev/null @@ -1,325 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; -import java.util.EmptyStackException; - -import org.eclipse.jpt.common.utility.Command; - -/** - * Thread-safe implementation of the {@link Stack} interface. - * This also provides protocol for suspending a thread until the - * stack is empty or not empty, with optional time-outs. - */ -public class SynchronizedStack - implements Stack, Serializable -{ - /** Backing stack. */ - private final Stack stack; - - /** Object to synchronize on. */ - private final Object mutex; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a synchronized stack that wraps the - * specified stack and locks on the specified mutex. - */ - public SynchronizedStack(Stack stack, Object mutex) { - super(); - if (stack == null) { - throw new NullPointerException(); - } - this.stack = stack; - this.mutex = mutex; - } - - /** - * Construct a synchronized stack that wraps the - * specified stack and locks on itself. - */ - public SynchronizedStack(Stack stack) { - super(); - if (stack == null) { - throw new NullPointerException(); - } - this.stack = stack; - this.mutex = this; - } - - /** - * Construct an empty synchronized stack that locks on the specified mutex. - */ - public SynchronizedStack(Object mutex) { - this(new SimpleStack(), mutex); - } - - /** - * Construct an empty synchronized stack that locks on itself. - */ - public SynchronizedStack() { - this(new SimpleStack()); - } - - - // ********** Stack implementation ********** - - public void push(E element) { - synchronized (this.mutex) { - this.push_(element); - } - } - - /** - * Pre-condition: synchronized - */ - private void push_(E element) { - this.stack.push(element); - this.mutex.notifyAll(); - } - - public E pop() { - synchronized (this.mutex) { - return this.pop_(); - } - } - - /** - * Pre-condition: synchronized - */ - private E pop_() { - E o = this.stack.pop(); - this.mutex.notifyAll(); - return o; - } - - public E peek() { - synchronized (this.mutex) { - return this.stack.peek(); - } - } - - public boolean isEmpty() { - synchronized (this.mutex) { - return this.stack.isEmpty(); - } - } - - - // ********** indefinite waits ********** - - /** - * Suspend the current thread until the stack's empty status changes - * to the specified value. - */ - public void waitUntilEmptyIs(boolean empty) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilEmptyIs_(empty); - } - } - - /** - * Pre-condition: synchronized - */ - private void waitUntilEmptyIs_(boolean empty) throws InterruptedException { - while (this.stack.isEmpty() != empty) { - this.mutex.wait(); - } - } - - /** - * Suspend the current thread until the stack is empty. - */ - public void waitUntilEmpty() throws InterruptedException { - this.waitUntilEmptyIs(true); - } - - /** - * Suspend the current thread until the stack has something on it. - */ - public void waitUntilNotEmpty() throws InterruptedException { - this.waitUntilEmptyIs(false); - } - - /** - * Suspend the current thread until the stack is empty, - * then "push" the specified item on to the top of the stack - * and continue executing. - */ - public void waitToPush(E element) throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilEmptyIs_(true); - this.push_(element); - } - } - - /** - * Suspend the current thread until the stack has something on it, - * then "pop" an item from the top of the stack and return it. - */ - public Object waitToPop() throws InterruptedException { - synchronized (this.mutex) { - this.waitUntilEmptyIs_(false); - return this.pop_(); - } - } - - - // ********** timed waits ********** - - /** - * Suspend the current thread until the stack's empty status changes - * to the specified value or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true if the specified - * empty status was achieved; return false if a time-out occurred. - * If the stack's empty status is already the specified value, - * return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilEmptyIs(boolean empty, long timeout) throws InterruptedException { - synchronized (this.mutex) { - return this.waitUntilEmptyIs_(empty, timeout); - } - } - - /** - * Pre-condition: synchronized - */ - private boolean waitUntilEmptyIs_(boolean empty, long timeout) throws InterruptedException { - if (timeout == 0L) { - this.waitUntilEmptyIs_(empty); // wait indefinitely until notified - return true; // if it ever comes back, the condition was met - } - - long stop = System.currentTimeMillis() + timeout; - long remaining = timeout; - while ((this.stack.isEmpty() != empty) && (remaining > 0L)) { - this.mutex.wait(remaining); - remaining = stop - System.currentTimeMillis(); - } - return (this.stack.isEmpty() == empty); - } - - /** - * Suspend the current thread until the stack is empty - * or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true if - * the stack is empty; return false if a time-out occurred. - * If the stack is already empty, return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilEmpty(long timeout) throws InterruptedException { - return this.waitUntilEmptyIs(true, timeout); - } - - /** - * Suspend the current thread until the stack has something on it. - * or the specified time-out occurs. - * The time-out is specified in milliseconds. Return true if - * the stack is not empty; return false if a time-out occurred. - * If the stack already has something on it, return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitUntilNotEmpty(long timeout) throws InterruptedException { - return this.waitUntilEmptyIs(false, timeout); - } - - /** - * Suspend the current thread until the stack is empty, - * then "push" the specified item on to the top of the stack - * and continue executing. If the stack is not emptied out - * before the time-out, simply continue executing without - * "pushing" the item. - * The time-out is specified in milliseconds. Return true if the - * item was pushed; return false if a time-out occurred. - * If the stack is already empty, "push" the specified item and - * return true immediately. - * If the time-out is zero, wait indefinitely. - */ - public boolean waitToPush(E element, long timeout) throws InterruptedException { - synchronized (this.mutex) { - boolean success = this.waitUntilEmptyIs_(true, timeout); - if (success) { - this.push_(element); - } - return success; - } - } - - /** - * Suspend the current thread until the stack has something on it, - * then "pop" an item from the top of the stack and return it. - * If the stack is empty and nothing is "pushed" on to it before the - * time-out, throw an empty stack exception. - * The time-out is specified in milliseconds. - * If the stack is not empty, "pop" an item and - * return it immediately. - * If the time-out is zero, wait indefinitely. - */ - public Object waitToPop(long timeout) throws InterruptedException { - synchronized (this.mutex) { - boolean success = this.waitUntilEmptyIs_(false, timeout); - if (success) { - return this.pop_(); - } - throw new EmptyStackException(); - } - } - - - // ********** synchronized behavior ********** - - /** - * If the current thread is not interrupted, execute the specified command - * with the mutex locked. This is useful for initializing the stack in another - * thread. - */ - public void execute(Command command) throws InterruptedException { - if (Thread.interrupted()) { - throw new InterruptedException(); - } - synchronized (this.mutex) { - command.execute(); - } - } - - - // ********** additional public protocol ********** - - /** - * Return the object the stack locks on while performing - * its operations. - */ - public Object getMutex() { - return this.mutex; - } - - - // ********** standard methods ********** - - @Override - public String toString() { - synchronized (this.mutex) { - return '[' + this.stack.toString() + ']'; - } - } - - private void writeObject(java.io.ObjectOutputStream s) throws java.io.IOException { - synchronized (this.mutex) { - s.defaultWriteObject(); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommand.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommand.java deleted file mode 100644 index 02168fc1b6..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommand.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import org.eclipse.jpt.common.utility.Command; - -/** - * This implementation of the Command interface allows the client to - * specify a different Command for each thread. - */ -public class ThreadLocalCommand implements Command { - protected final ThreadLocal threadLocal; - protected final Command defaultCommand; - - /** - * The default command does nothing. - */ - public ThreadLocalCommand() { - this(Command.Null.instance()); - } - - public ThreadLocalCommand(Command defaultCommand) { - super(); - this.defaultCommand = defaultCommand; - this.threadLocal = this.buildThreadLocal(); - } - - protected ThreadLocal buildThreadLocal() { - return new ThreadLocal(); - } - - public void execute() { - this.get().execute(); - } - - protected Command get() { - Command command = this.threadLocal.get(); - return (command != null) ? command : this.defaultCommand; - } - - /** - * Set the current thread's command to the specified value. - */ - public void set(Command command) { - this.threadLocal.set(command); - } - - /** - * Return the string representation of the current thread's command. - */ - @Override - public String toString() { - return this.get().toString(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommandExecutor.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommandExecutor.java deleted file mode 100644 index e8e5064614..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/ThreadLocalCommandExecutor.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.CommandExecutor; - -/** - * This implementation of the CommandExecutor interface allows the client to - * specify a different Command Executor for each thread. - */ -public class ThreadLocalCommandExecutor implements CommandExecutor { - protected final ThreadLocal threadLocal; - protected final CommandExecutor defaultCommandExecutor; - - /** - * The default command executor simply executes the command directly. - */ - public ThreadLocalCommandExecutor() { - this(CommandExecutor.Default.instance()); - } - - public ThreadLocalCommandExecutor(CommandExecutor defaultCommandExecutor) { - super(); - this.defaultCommandExecutor = defaultCommandExecutor; - this.threadLocal = this.buildThreadLocal(); - } - - protected ThreadLocal buildThreadLocal() { - return new ThreadLocal(); - } - - public void execute(Command command) { - this.getThreadLocalCommandExecutor().execute(command); - } - - protected CommandExecutor getThreadLocalCommandExecutor() { - CommandExecutor ce = this.threadLocal.get(); - return (ce != null) ? ce : this.defaultCommandExecutor; - } - - /** - * Set the current thread's command executor to the specified value. - */ - public void set(CommandExecutor commandExecutor) { - this.threadLocal.set(commandExecutor); - } - - /** - * Return the string representation of the current thread's command - * executor. - */ - @Override - public String toString() { - return this.getThreadLocalCommandExecutor().toString(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Tools.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Tools.java deleted file mode 100644 index e3c238dc4d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Tools.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -/** - * Various utility methods. - */ -@SuppressWarnings("nls") -public final class Tools { - - // ********** object comparison ********** - - /** - * Return whether the specified values are equal, with the appropriate - * null checks. - */ - public static boolean valuesAreEqual(Object value1, Object value2) { - return (value1 == null) ? - (value2 == null) : - ((value2 != null) && value1.equals(value2)); - } - - /** - * Return whether the specified values are different, with the appropriate - * null checks. - */ - public static boolean valuesAreDifferent(Object value1, Object value2) { - return (value1 == null) ? - (value2 != null) : - ((value2 == null) || ! value1.equals(value2)); - } - - - // ********** System properties ********** - - /** - * Return whether the current JVM is Sun's (or Oracle's). - */ - public static boolean jvmIsSun() { - return jvmIs("Sun") || jvmIs("Oracle"); - } - - /** - * Return whether the current JVM is IBM's. - */ - public static boolean jvmIsIBM() { - return jvmIs("IBM"); - } - - private static boolean jvmIs(String jvmVendorName) { - return System.getProperty("java.vendor").startsWith(jvmVendorName); - } - - /** - * Return whether the current operating system is Microsoft Windows. - */ - public static boolean osIsWindows() { - return osIs("Windows"); - } - - /** - * Return whether the current operating system is Linux. - */ - public static boolean osIsLinux() { - return osIs("Linux"); - } - - private static boolean osIs(String osName) { - return System.getProperty("os.name").indexOf(osName) != -1; - } - - - // ********** constructor ********** - - /** - * Suppress default constructor, ensuring non-instantiability. - */ - private Tools() { - super(); - throw new UnsupportedOperationException(); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Transformer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Transformer.java deleted file mode 100644 index d95534e737..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/Transformer.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.Serializable; - -/** - * Used by various "pluggable" classes to transform objects. - * Transform an object of type T1 to an object of type - * T2. - * - * @param the type of the object passed to the transformer - * @param the type of the object returned by the transformer - */ -public interface Transformer { - - /** - * Return the transformed object. - * The semantics of "transform" is determined by the - * contract between the client and the server. - */ - T2 transform(T1 o); - - - /** - * A "null" transformer will perform no transformation at all; - * it will simply return the object "untransformed". - */ - final class Null implements Transformer, Serializable { - @SuppressWarnings("rawtypes") - public static final Transformer INSTANCE = new Null(); - @SuppressWarnings("unchecked") - public static Transformer instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - // simply return the object, unchanged - @SuppressWarnings("unchecked") - public S2 transform(S1 o) { - return (S2) o; - } - @Override - public String toString() { - return "Transformer.Null"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - /** - * A "disabled" transformer will throw an exception if - * {@link #transform(Object)} is called. This is useful in situations - * where a transformer is optional and the default transformer should - * not be used. - */ - final class Disabled implements Transformer, Serializable { - @SuppressWarnings("rawtypes") - public static final Transformer INSTANCE = new Disabled(); - @SuppressWarnings("unchecked") - public static Transformer instance() { - return INSTANCE; - } - // ensure single instance - private Disabled() { - super(); - } - // throw an exception - public S2 transform(S1 o) { - throw new UnsupportedOperationException(); - } - @Override - public String toString() { - return "Transformer.Disabled"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/XMLStringEncoder.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/XMLStringEncoder.java deleted file mode 100644 index baf7d30684..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/XMLStringEncoder.java +++ /dev/null @@ -1,182 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal; - -import java.io.IOException; -import java.io.Reader; -import java.io.StringReader; - -/** - * This encoder will replace any of a specified set of characters with an XML - * "character reference": '/' => "/" - */ -public final class XMLStringEncoder { - - /** The set of characters to be converted into XML character references. */ - private final char[] chars; - - /** Cache the value of the highest character in the set above. */ - private final char maxChar; - - - // ********** constructors/initialization ********** - - /** - * Construct an encoder that converts the specified set of characters - * into XML character references. - */ - public XMLStringEncoder(char[] chars) { - super(); - if (chars == null) { - throw new NullPointerException(); - } - // the ampersand must be included since it is the escape character - if (ArrayTools.contains(chars, '&')) { - this.chars = chars; - } else { - this.chars = ArrayTools.add(chars, '&'); - } - this.maxChar = this.calculateMaxInvalidFileNameChar(); - } - - /** - * Calculate the maximum value of the set of characters to be converted - * into XML character references. This will be used to short-circuit the - * search for a character in the set. - * @see #charIsToBeEncoded(char) - */ - private char calculateMaxInvalidFileNameChar() { - char[] localChars = this.chars; - char max = 0; - for (int i = localChars.length; i-- > 0; ) { - char c = localChars[i]; - if (max < c) { - max = c; - } - } - return max; - } - - - // ********** API ********** - - /** - * Return the specified string with any characters in the set - * replaced with XML character references. - */ - public String encode(String s) { - int len = s.length(); - // allow for a few encoded characters - StringBuilder sb = new StringBuilder(len + 20); - for (int i = 0; i < len; i++) { - this.appendCharacterTo(s.charAt(i), sb); - } - return sb.toString(); - } - - /** - * Return the specified string with any XML character references - * replaced by the characters themselves. - */ - public String decode(String s) { - StringBuilder sb = new StringBuilder(s.length()); - StringBuilder temp = new StringBuilder(); // performance tweak - this.decodeTo(new StringReader(s), sb, temp); - return sb.toString(); - } - - - // ********** internal methods ********** - - /** - * Append the specified character to the string buffer, - * converting it to an XML character reference if necessary. - */ - private void appendCharacterTo(char c, StringBuilder sb) { - if (this.charIsToBeEncoded(c)) { - this.appendCharacterReferenceTo(c, sb); - } else { - sb.append(c); - } - } - - /** - * Return whether the specified character is one of the characters - * to be converted to XML character references. - */ - private boolean charIsToBeEncoded(char c) { - return (c <= this.maxChar) && ArrayTools.contains(this.chars, c); - } - - /** - * Append the specified character's XML character reference to the - * specified string buffer (e.g. '/' => "/"). - */ - private void appendCharacterReferenceTo(char c, StringBuilder sb) { - sb.append("&#x"); //$NON-NLS-1$ - sb.append(Integer.toString(c, 16)); - sb.append(';'); - } - - private void decodeTo(Reader reader, StringBuilder sb, StringBuilder temp) { - try { - this.decodeTo_(reader, sb, temp); - } catch (IOException ex) { - throw new RuntimeException(ex); - } - } - - private void decodeTo_(Reader reader, StringBuilder sb, StringBuilder temp) throws IOException { - int c = reader.read(); - while (c != -1) { - if (c == '&') { - this.decodeCharacterReferenceTo(reader, sb, temp); - } else { - sb.append((char) c); - } - c = reader.read(); - } - reader.close(); - } - - private void decodeCharacterReferenceTo(Reader reader, StringBuilder sb, StringBuilder temp) throws IOException { - int c = reader.read(); - this.checkChar(c, '#'); - c = reader.read(); - this.checkChar(c, 'x'); - - temp.setLength(0); // re-use temp - c = reader.read(); - while (c != ';') { - this.checkEndOfStream(c); - temp.append((char) c); - c = reader.read(); - } - String charValue = temp.toString(); - if (charValue.length() == 0) { - throw new IllegalStateException("missing numeric string"); //$NON-NLS-1$ - } - sb.append((char) Integer.parseInt(charValue, 16)); - } - - private void checkChar(int c, int expected) { - this.checkEndOfStream(c); - if (c != expected) { - throw new IllegalStateException("expected '" + (char) expected + "', but encountered '" + (char) c + "'"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - } - } - - private void checkEndOfStream(int c) { - if (c == -1) { - throw new IllegalStateException("unexpected end of string"); //$NON-NLS-1$ - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/enumerations/EmptyEnumeration.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/enumerations/EmptyEnumeration.java deleted file mode 100644 index 7cd0c023b4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/enumerations/EmptyEnumeration.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.enumerations; - -import java.util.Enumeration; -import java.util.NoSuchElementException; - -/** - * An EmptyEnumeration is just that. - * - * @param the type of elements returned by the enumeration - */ -public final class EmptyEnumeration - implements Enumeration -{ - - // singleton - @SuppressWarnings("rawtypes") - private static final EmptyEnumeration INSTANCE = new EmptyEnumeration(); - - /** - * Return the singleton. - */ - @SuppressWarnings("unchecked") - public static Enumeration instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EmptyEnumeration() { - super(); - } - - public boolean hasMoreElements() { - return false; - } - - public E nextElement() { - throw new NoSuchElementException(); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } - - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/enumerations/IteratorEnumeration.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/enumerations/IteratorEnumeration.java deleted file mode 100644 index ee6000c172..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/enumerations/IteratorEnumeration.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.enumerations; - -import java.util.Enumeration; -import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * An IteratorEnumeration wraps an - * {@link Iterator} so that it can be treated like an - * {@link Enumeration}. - * Hopefully we don't have much need for this.... - * - * @param the type of elements returned by the enumeration - */ -public class IteratorEnumeration - implements Enumeration -{ - private final Iterator iterator; - - /** - * Construct an enumeration that wraps the specified iterable. - */ - public IteratorEnumeration(Iterable iterable) { - this(iterable.iterator()); - } - - /** - * Construct an enumeration that wraps the specified iterator. - */ - public IteratorEnumeration(Iterator iterator) { - super(); - this.iterator = iterator; - } - - public boolean hasMoreElements() { - return this.iterator.hasNext(); - } - - public E nextElement() { - return this.iterator.next(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterator); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ArrayIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ArrayIterable.java deleted file mode 100644 index 5f67e72a49..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ArrayIterable.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.Arrays; -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; - -/** - * An ArrayIterable provides an {@link Iterable} - * for an array of objects of type E. - * - * @param the type of elements returned by the iterable's iterator - * - * @see ArrayIterator - * @see ArrayListIterable - */ -public class ArrayIterable - implements Iterable -{ - final E[] array; - final int start; - final int length; - - /** - * Construct an iterable for the specified array. - */ - public ArrayIterable(E... array) { - this(array, 0, array.length); - } - - /** - * Construct an iterable for the specified array, - * starting at the specified start index and continuing for - * the rest of the array. - */ - public ArrayIterable(E[] array, int start) { - this(array, start, array.length - start); - } - - /** - * Construct an iterable for the specified array, - * starting at the specified start index and continuing for - * the specified length. - */ - public ArrayIterable(E[] array, int start, int length) { - super(); - if ((start < 0) || (start > array.length)) { - throw new IllegalArgumentException("start: " + start); //$NON-NLS-1$ - } - if ((length < 0) || (length > array.length - start)) { - throw new IllegalArgumentException("length: " + length); //$NON-NLS-1$ - } - this.array = array; - this.start = start; - this.length = length; - } - - public Iterator iterator() { - return new ArrayIterator(this.array, this.start, this.length); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, Arrays.toString(this.array)); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ArrayListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ArrayListIterable.java deleted file mode 100644 index 78ceb0e23d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ArrayListIterable.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.iterators.ArrayListIterator; - -/** - * An ArrayListIterable provides a {@link ListIterable} - * for an array of objects of type E. - * - * @param the type of elements returned by the list iterable's list iterator - * - * @see ArrayIterable - * @see ArrayListIterator - */ -public class ArrayListIterable - extends ArrayIterable - implements ListIterable -{ - /** - * Construct a list iterable for the specified array. - */ - public ArrayListIterable(E... array) { - this(array, 0, array.length); - } - - /** - * Construct a list iterable for the specified array, - * starting at the specified start index and continuing for - * the rest of the array. - */ - public ArrayListIterable(E[] array, int start) { - this(array, start, array.length - start); - } - - /** - * Construct a list iterable for the specified array, - * starting at the specified start index and continuing for - * the specified length. - */ - public ArrayListIterable(E[] array, int start, int length) { - super(array, start, length); - } - - @Override - public ListIterator iterator() { - return new ArrayListIterator(this.array, this.start, this.length); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ChainIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ChainIterable.java deleted file mode 100644 index 12dcc76816..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ChainIterable.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.ChainIterator; - -/** - * A ChainIterable provides a pluggable {@link Iterable} - * that loops over a chain of arbitrarily linked objects. The chain - * should be null-terminated (i.e. a call to the {@link #nextLink(Object)} - * method should return null when it is passed the last - * link of the chain). - * To use, supply a starting link and supply a {@link ChainIterator.Linker} or - * subclass ChainIterable and override the - * {@link #nextLink(Object)} method. - * The starting link will be the first object returned by the iterable's iterator. - * If the starting link is null, the iterable will be empty. - * Note this iterable does not support null elements. - * - * @param the type of elements returned by the iterable's iterator - * - * @see ChainIterator - */ -public class ChainIterable - implements Iterable -{ - private final E startLink; - private final ChainIterator.Linker linker; - - - /** - * Construct an iterable with the specified starting link - * and a default linker that calls back to the iterable. - * Use this constructor if you want to override the - * {@link #nextLink(Object)} method instead of building - * a {@link ChainIterator.Linker}. - */ - public ChainIterable(E startLink) { - super(); - this.startLink = startLink; - this.linker = this.buildDefaultLinker(); - } - - /** - * Construct an iterator with the specified starting link - * and linker. - */ - public ChainIterable(E startLink, ChainIterator.Linker linker) { - super(); - this.startLink = startLink; - this.linker = linker; - } - - protected ChainIterator.Linker buildDefaultLinker() { - return new DefaultLinker(); - } - - public Iterator iterator() { - return new ChainIterator(this.startLink, this.linker); - } - - /** - * Return the next link in the chain; null if there are no more links. - *

- * This method can be overridden by a subclass as an alternative to - * building a {@link ChainIterator.Linker}. - */ - protected E nextLink(@SuppressWarnings("unused") E currentLink) { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.startLink); - } - - - //********** default linker ********** - - protected class DefaultLinker implements ChainIterator.Linker { - public E nextLink(E currentLink) { - return ChainIterable.this.nextLink(currentLink); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneIterable.java deleted file mode 100644 index 22a21a4979..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneIterable.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; - -/** - * Pull together remover state and behavior for subclasses. - * - * @param the type of elements returned by the iterable's iterator - * - * @see SnapshotCloneIterable - * @see LiveCloneIterable - */ -public abstract class CloneIterable - implements Iterable -{ - final CloneIterator.Remover remover; - - - // ********** constructors ********** - - protected CloneIterable() { - super(); - this.remover = this.buildDefaultRemover(); - } - - protected CloneIterable(CloneIterator.Remover remover) { - super(); - this.remover = remover; - } - - protected CloneIterator.Remover buildDefaultRemover() { - return new DefaultRemover(); - } - - - // ********** default removal ********** - - /** - * Remove the specified element from the original collection. - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link CloneIterator.Remover}. - */ - protected void remove(@SuppressWarnings("unused") E element) { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - - //********** default mutator ********** - - protected class DefaultRemover implements CloneIterator.Remover { - public void remove(E element) { - CloneIterable.this.remove(element); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneListIterable.java deleted file mode 100644 index b98c42303a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CloneListIterable.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; - -/** - * Pull together mutator state and behavior for subclasses. - * - * @param the type of elements returned by the list iterable's list iterator - * - * @see SnapshotCloneListIterable - * @see LiveCloneListIterable - */ -public abstract class CloneListIterable - implements ListIterable -{ - final CloneListIterator.Mutator mutator; - - - // ********** constructors ********** - - protected CloneListIterable() { - super(); - this.mutator = this.buildDefaultMutator(); - } - - protected CloneListIterable(CloneListIterator.Mutator mutator) { - super(); - this.mutator = mutator; - } - - protected CloneListIterator.Mutator buildDefaultMutator() { - return new DefaultMutator(); - } - - - // ********** default mutations ********** - - /** - * At the specified index, add the specified element to the original list. - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link CloneListIterator.Mutator}. - */ - protected void add(@SuppressWarnings("unused") int index, @SuppressWarnings("unused") E element) { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - /** - * Remove the element at the specified index from the original list. - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link CloneListIterator.Mutator}. - */ - protected void remove(@SuppressWarnings("unused") int index) { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - /** - * At the specified index, set the specified element in the original list. - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link CloneListIterator.Mutator}. - */ - protected void set(@SuppressWarnings("unused") int index, @SuppressWarnings("unused") E element) { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - - //********** default mutator ********** - - protected class DefaultMutator implements CloneListIterator.Mutator { - public void add(int index, E element) { - CloneListIterable.this.add(index, element); - } - public void remove(int index) { - CloneListIterable.this.remove(index); - } - public void set(int index, E element) { - CloneListIterable.this.set(index, element); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeIterable.java deleted file mode 100644 index 442737ede9..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeIterable.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; - -/** - * A CompositeIterable wraps an {@link Iterable} - * of {@link Iterable}s and makes them appear to be a single - * {@link Iterable}. - * - * @param the type of elements returned by the iterable's iterator - * - * @see CompositeIterator - * @see CompositeListIterable - */ -public class CompositeIterable - implements Iterable -{ - private final Iterable> iterables; - - - /** - * Construct an iterable with the specified collection of iterables. - */ - public CompositeIterable(Iterable> iterables) { - super(); - this.iterables = iterables; - } - - /** - * Construct an iterable with the specified object prepended - * to the specified iterable. - */ - @SuppressWarnings("unchecked") - public CompositeIterable(E object, Iterable iterable) { - this(new SingleElementIterable(object), iterable); - } - - /** - * Construct an iterable with the specified object appended - * to the specified iterable. - */ - @SuppressWarnings("unchecked") - public CompositeIterable(Iterable iterable, E object) { - this(iterable, new SingleElementIterable(object)); - } - - /** - * Construct an iterable with the specified iterables. - */ - public CompositeIterable(Iterable... iterables) { - this(new ArrayIterable>(iterables)); - } - - /** - * combined iterators - */ - public Iterator iterator() { - return new CompositeIterator(this.iterators()); - } - - /** - * iterator of iterators - */ - protected Iterator> iterators() { - return new TransformationIterator, Iterator>(this.iterables()) { - @Override - protected Iterator transform(Iterable next) { - return next.iterator(); - } - }; - } - - /** - * iterator of iterables - */ - protected Iterator> iterables() { - return this.iterables.iterator(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterables); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeListIterable.java deleted file mode 100644 index 66f75626ef..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/CompositeListIterable.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationListIterator; - -/** - * A CompositeListIterable wraps a {@link ListIterable} - * of {@link ListIterable}s and makes them appear to be a single - * {@link ListIterable}. - * - * @param the type of elements returned by the list iterable's list iterator - * - * @see CompositeListIterator - * @see CompositeIterable - * @see ReadOnlyCompositeListIterable - */ -public class CompositeListIterable - implements ListIterable -{ - private final ListIterable> iterables; - - - /** - * Construct a list iterable with the specified list of list iterables. - */ - public CompositeListIterable(List> iterables) { - this(new ListListIterable>(iterables)); - } - - /** - * Construct a list iterable with the specified list of list iterables. - */ - public CompositeListIterable(ListIterable> iterables) { - super(); - this.iterables = iterables; - } - - /** - * Construct a list iterable with the specified object prepended - * to the specified list. - */ - public CompositeListIterable(E object, List list) { - this(object, new ListListIterable(list)); - } - - /** - * Construct a list iterable with the specified object prepended - * to the specified list iterable. - */ - @SuppressWarnings("unchecked") - public CompositeListIterable(E object, ListIterable iterable) { - this(new SingleElementListIterable(object), iterable); - } - - /** - * Construct a list iterable with the specified object appended - * to the specified list. - */ - public CompositeListIterable(List list, E object) { - this(new ListListIterable(list), object); - } - - /** - * Construct a list iterable with the specified object appended - * to the specified list iterable. - */ - @SuppressWarnings("unchecked") - public CompositeListIterable(ListIterable iterable, E object) { - this(iterable, new SingleElementListIterable(object)); - } - - /** - * Construct a list iterable with the specified list iterables. - */ - public CompositeListIterable(ListIterable... iterables) { - this(new ArrayListIterable>(iterables)); - } - - /** - * Construct a list iterable with the specified lists. - */ - public CompositeListIterable(List... lists) { - this(new TransformationListIterable, ListIterable>(new ArrayListIterable>(lists)) { - @Override - protected ListIterable transform(List list) { - return new ListListIterable(list); - } - }); - } - - /** - * combined list iterators - */ - public ListIterator iterator() { - return new CompositeListIterator(this.iterators()); - } - - /** - * list iterator of list iterators - */ - protected ListIterator> iterators() { - return new TransformationListIterator, ListIterator>(this.iterables()) { - @Override - protected ListIterator transform(ListIterable next) { - return next.iterator(); - } - }; - } - - /** - * list iterator of list iterables - */ - protected ListIterator> iterables() { - return this.iterables.iterator(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterables); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyIterable.java deleted file mode 100644 index c3ed1c49dc..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyIterable.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.io.Serializable; -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; - -/** - * An EmptyIterable is just that. - * Maybe just a touch better-performing than {@link java.util.Collections#EMPTY_SET} - * since we don't create a new {@link Iterator} every time {@link #iterator()} is called. - * (Not sure why they do that....) - * - * @param the type of elements returned by the iterable's iterator - * - * @see EmptyIterator - * @see EmptyListIterable - */ -public final class EmptyIterable - implements Iterable, Serializable -{ - // singleton - @SuppressWarnings("rawtypes") - private static final Iterable INSTANCE = new EmptyIterable(); - - /** - * Return the singleton. - */ - @SuppressWarnings("unchecked") - public static Iterable instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EmptyIterable() { - super(); - } - - public Iterator iterator() { - return EmptyIterator.instance(); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } - - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyListIterable.java deleted file mode 100644 index eb6613c071..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/EmptyListIterable.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.io.Serializable; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator; - -/** - * An EmptyListIterable is just that. - * Maybe just a touch better-performing than {@link java.util.Collections#EMPTY_LIST} - * since we don't create a new {@link Iterator} every time {@link #iterator()} is called. - * (Not sure why they do that....) - * - * @param the type of elements returned by the list iterable's list iterator - * - * @see EmptyListIterator - * @see EmptyIterable - */ -public final class EmptyListIterable - implements ListIterable, Serializable -{ - // singleton - @SuppressWarnings("rawtypes") - private static final ListIterable INSTANCE = new EmptyListIterable(); - - /** - * Return the singleton. - */ - @SuppressWarnings("unchecked") - public static ListIterable instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EmptyListIterable() { - super(); - } - - public ListIterator iterator() { - return EmptyListIterator.instance(); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } - - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/FilteringIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/FilteringIterable.java deleted file mode 100644 index 897f0d908e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/FilteringIterable.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; - -/** - * A FilteringIterable wraps another {@link Iterable} - * and uses a {@link Filter} to determine which elements in the - * nested iterable are to be returned by the iterable's iterator. - *

- * As an alternative to building a {@link Filter}, a subclass - * of FilteringIterable can override the - * {@link #accept(Object)} method. - * - * @param the type of elements to be filtered - * - * @see FilteringIterator - */ -public class FilteringIterable - implements Iterable -{ - private final Iterable iterable; - private final Filter filter; - - - /** - * Construct an iterable with the specified nested - * iterable and a default filter that calls back to the iterable. - * Use this constructor if you want to override the - * {@link #accept(Object)} method instead of building - * a {@link Filter}. - */ - public FilteringIterable(Iterable iterable) { - super(); - this.iterable = iterable; - this.filter = this.buildDefaultFilter(); - } - - /** - * Construct an iterable with the specified nested - * iterable and filter. - */ - public FilteringIterable(Iterable iterable, Filter filter) { - super(); - this.iterable = iterable; - this.filter = filter; - } - - protected Filter buildDefaultFilter() { - return new DefaultFilter(); - } - - public Iterator iterator() { - return new FilteringIterator(this.iterable.iterator(), this.filter); - } - - /** - * Return whether the iterable's iterator - * should return the specified next element from a call to the - * {@link Iterator#next()} method. - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link Filter}. - */ - protected boolean accept(@SuppressWarnings("unused") E o) { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterable); - } - - - //********** default filter ********** - - protected class DefaultFilter implements Filter { - public boolean accept(E o) { - return FilteringIterable.this.accept(o); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/GraphIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/GraphIterable.java deleted file mode 100644 index 01912a47b5..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/GraphIterable.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.Arrays; -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.GraphIterator; - -/** - * A GraphIterable is similar to a {@link TreeIterable} - * except that it cannot be assumed that all nodes assume a strict tree - * structure. For instance, in a tree, a node cannot be a descendent of - * itself, but a graph may have a cyclical structure. - * - * A GraphIterable simplifies the traversal of a - * graph of objects, where the objects' protocol(s) provides - * a method for getting the next collection of nodes in the graph, - * (or neighbors), but does not provide a method for - * getting all of the nodes in the graph. - * (e.g. a neighbor can return his neighbors, and those neighbors - * can return their neighbors, which might also include the original - * neighbor, but you only want to visit the original neighbor once.) - *

- * If a neighbor has already been visited (determined by using - * {@link #equals(Object)}), that neighbor is not visited again, - * nor are the neighbors of that object. - *

- * It is up to the user of this class to ensure a complete graph. - *

- * To use, supply:

    - *
  • either the initial node of the graph or an {@link Iterable} - * of the initial collection of graph nodes - *
  • a {@link GraphIterator.MisterRogers} that tells who the neighbors are - * of each node - * (alternatively, subclass GraphIterable - * and override the {@link #neighbors(Object)} method) - *
- * The {@link Iterator#remove()} operation is not supported. This behavior, if - * desired, must be implemented by the user of this class. - * - * @param the type of elements returned by the iterable's iterator - * - * @see GraphIterator - */ -public class GraphIterable - implements Iterable -{ - private final Iterable roots; - private final GraphIterator.MisterRogers misterRogers; - - - /** - * Construct an iterable containing the nodes of a graph with the specified root - * and a default Mr. Rogers that calls back to the iterable. - * Use this constructor if you want to override the - * {@link #neighbors(Object)} method instead of building - * a {@link GraphIterator.MisterRogers}. - */ - public GraphIterable(E root) { - this(new SingleElementIterable(root)); - } - - /** - * Construct an iterable containing the nodes of a graph - * with the specified root and Mr. Rogers. - */ - public GraphIterable(E root, GraphIterator.MisterRogers misterRogers) { - this(new SingleElementIterable(root), misterRogers); - } - - /** - * Construct an iterable containing the nodes of a graph - * with the specified collection of roots - * and a default Mr. Rogers that calls back to the iterable. - * Use this constructor if you want to override the - * {@link #neighbors(Object)} method instead of building - * a {@link GraphIterator.MisterRogers}. - */ - public GraphIterable(E... roots) { - this(Arrays.asList(roots)); - } - - /** - * Construct an iterable containing the nodes of a graph - * with the specified roots and Mr. Rogers. - */ - public GraphIterable(E[] roots, GraphIterator.MisterRogers misterRogers) { - this(Arrays.asList(roots), misterRogers); - } - - /** - * Construct an iterable containing the nodes of a graph - * with the specified collection of roots - * and a default Mr. Rogers that calls back to the iterable. - * Use this constructor if you want to override the - * {@link #neighbors(Object)} method instead of building - * a {@link GraphIterator.MisterRogers}. - */ - public GraphIterable(Iterable roots) { - super(); - this.roots = roots; - this.misterRogers = this.buildDefaultMisterRogers(); - } - - /** - * Construct an iterable containing the nodes of a graph - * with the specified roots and Mr. Rogers. - */ - public GraphIterable(Iterable roots, GraphIterator.MisterRogers misterRogers) { - super(); - this.roots = roots; - this.misterRogers = misterRogers; - } - - protected GraphIterator.MisterRogers buildDefaultMisterRogers() { - return new DefaultMisterRogers(); - } - - public Iterator iterator() { - return new GraphIterator(this.roots, this.misterRogers); - } - - /** - * Return the immediate neighbors of the specified object. - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link GraphIterator.MisterRogers}. - */ - protected Iterator neighbors(@SuppressWarnings("unused") E next) { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.roots); - } - - - //********** default Mr. Rogers ********** - - protected class DefaultMisterRogers implements GraphIterator.MisterRogers { - public Iterator neighbors(E node) { - return GraphIterable.this.neighbors(node); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ListIterable.java deleted file mode 100644 index 91bab82950..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ListIterable.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.ListIterator; - -/** - * A ListIterable simply extends {@link Iterable} - * to return a {@link ListIterator} of type E. - * - * @param the type of elements returned by the iterable's iterators - */ -public interface ListIterable - extends Iterable -{ - /** - * Return a list iterator over a set of elements of type E. - */ - ListIterator iterator(); -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ListListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ListListIterable.java deleted file mode 100644 index ad5a5d7926..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ListListIterable.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.List; -import java.util.ListIterator; - -/** - * A ListListIterable adapts a {@link List} - * to the {@link ListIterable} interface. - * - * @param the type of elements returned by the iterable's iterators - */ -public class ListListIterable - implements ListIterable -{ - private final List list; - - public ListListIterable(List list) { - super(); - this.list = list; - } - - public ListIterator iterator() { - return this.list.listIterator(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneIterable.java deleted file mode 100644 index e8aaccff06..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneIterable.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; - -/** - * A LiveCloneIterable returns an iterator on a current copy of a - * collection, allowing for concurrent access to the original collection. A - * copy of the collection is created every time {@link #iterator()} is - * called. As a result, the contents of the collection can be different with - * each call to {@link #iterator()} (i.e. it is "live"). - *

- * The original collection passed to the LiveCloneIterable's - * constructor should be thread-safe (e.g. {@link java.util.Vector}); - * otherwise you run the risk of a corrupted collection. - *

- * By default, the iterator returned by a LiveCloneIterable does not - * support the {@link Iterator#remove()} operation; this is because it does not - * have access to the original collection. But if the LiveCloneIterable - * is supplied with an {@link CloneIterator.Remover} it will delegate the - * {@link Iterator#remove()} operation to the Remover. - * Alternatively, a subclass can override the iterable's {@link #remove(Object)} - * method. - * - * @param the type of elements returned by the iterable's iterator - * - * @see CloneIterator - * @see SnapshotCloneIterable - * @see LiveCloneListIterable - */ -public class LiveCloneIterable - extends CloneIterable -{ - private final Collection collection; - - - // ********** constructors ********** - - /** - * Construct a "live" iterable for the specified collection. - * The {@link Iterator#remove()} operation will not be supported - * by the iterator returned by {@link #iterator()} - * unless a subclass overrides the iterable's {@link #remove(Object)} - * method. - */ - public LiveCloneIterable(Collection collection) { - super(); - this.collection = collection; - } - - /** - * Construct a "live" iterable for the specified collection. - * The specified remover will be used by any generated iterators to - * remove objects from the original collection. - */ - public LiveCloneIterable(Collection collection, CloneIterator.Remover remover) { - super(remover); - this.collection = collection; - } - - - // ********** Iterable implementation ********** - - public Iterator iterator() { - return new CloneIterator(this.collection, this.remover); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.collection); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneListIterable.java deleted file mode 100644 index 9d26554db1..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/LiveCloneListIterable.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; - -/** - * A LiveCloneListIterable returns a list iterator on a current - * copy of a list, allowing for concurrent access to the original list. A - * copy of the list is created every time {@link #iterator()} is - * called. As a result, the contents of the list can be different with - * each call to {@link #iterator()} (i.e. it is "live"). - *

- * The original list passed to the LiveCloneListIterable's - * constructor should be thread-safe (e.g. {@link java.util.Vector}); - * otherwise you run the risk of a corrupted list. - *

- * By default, the list iterator returned by a LiveCloneListIterable - * does not support the modify operations; this is because it does not - * have access to the original list. But if the LiveCloneListIterable - * is supplied with an {@link CloneListIterator.Mutator} it will delegate the - * modify operations to the Mutator. - * Alternatively, a subclass can override the list iterable's mutation - * methods. - * - * @param the type of elements returned by the list iterable's list iterator - * - * @see CloneListIterator - * @see SnapshotCloneListIterable - * @see LiveCloneIterable - */ -public class LiveCloneListIterable - extends CloneListIterable -{ - private final List list; - - - // ********** constructors ********** - - /** - * Construct a "live" list iterable for the specified list. - * The {@link ListIterator} mutation operations will not be supported - * by the list iterator returned by {@link #iterator()} - * unless a subclass overrides the iterable's mutation - * methods. - */ - public LiveCloneListIterable(List list) { - super(); - this.list = list; - } - - /** - * Construct a "live" list iterable for the specified list. - * The specified mutator will be used by any generated list iterators to - * modify the original list. - */ - public LiveCloneListIterable(List list, CloneListIterator.Mutator mutator) { - super(mutator); - this.list = list; - } - - - // ********** ListIterable implementation ********** - - public ListIterator iterator() { - return new CloneListIterator(this.list, this.mutator); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.list); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/PeekableIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/PeekableIterable.java deleted file mode 100644 index ad381ee41c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/PeekableIterable.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.PeekableIterator; - -/** - * A PeekableIterable wraps another {@link Iterable} - * and returns an {@link PeekableIterator} that allows a - * {@link PeekableIterator#peek() peek} at the next element to be - * returned by {@link Iterator#next()}. - *

- * One, possibly undesirable, side-effect of using this iterator is that - * the nested iterator's next() method will be invoked - * before the peekable iterator's {@link Iterator#next()} - * method is invoked. This is because the "next" element must be - * pre-loaded for the {@link PeekableIterator#peek()} method. - * This also prevents a peekable iterator from supporting the optional - * {@link Iterator#remove()} method. - * - * @param the type of elements returned by the iterable's iterator - * - * @see PeekableIterator - */ -public class PeekableIterable - implements Iterable -{ - private final Iterable iterable; - - /** - * Construct a peekable iterable that wraps the specified - * iterable. - */ - public PeekableIterable(Iterable iterable) { - super(); - this.iterable = iterable; - } - - public PeekableIterator iterator() { - return new PeekableIterator(this.iterable); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterable); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/QueueIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/QueueIterable.java deleted file mode 100644 index 5b2aa6d0b4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/QueueIterable.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.Queue; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.QueueIterator; - -/** - * A QueueIterable provides an {@link Iterable} - * for a {@link Queue} of objects of type E. The queue's elements - * are {@link Queue#dequeue() dequeue}d" as the iterable's iterator returns - * them with calls to {@link Iterator#next()}. - * - * @param the type of elements returned by the iterable's iterator - * - * @see Queue - * @see QueueIterator - */ -public class QueueIterable - implements Iterable -{ - private final Queue queue; - - /** - * Construct an iterable for the specified queue. - */ - public QueueIterable(Queue queue) { - super(); - this.queue = queue; - } - - public Iterator iterator() { - return new QueueIterator(this.queue); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.queue); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyCompositeListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyCompositeListIterable.java deleted file mode 100644 index ff2810fdda..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyCompositeListIterable.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyCompositeListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationListIterator; - -/** - * A ReadOnlyCompositeListIterable wraps a {@link ListIterable} - * of {@link ListIterable}s and makes them appear to be a single - * read-only {@link ListIterable}. A read-only composite list - * iterable is more flexible than a normal composite list iterable when it - * comes to the element types of the nested list iterables. - * - * @param the type of elements returned by the list iterable's list iterator - * - * @see ReadOnlyCompositeListIterator - * @see CompositeListIterable - */ -public class ReadOnlyCompositeListIterable - implements ListIterable -{ - private final ListIterable> iterables; - - - /** - * Construct a list iterable with the specified list of list iterables. - */ - public ReadOnlyCompositeListIterable(ListIterable> iterables) { - super(); - this.iterables = iterables; - } - - /** - * Construct a list iterable with the specified object prepended - * to the specified list iterable. - */ - @SuppressWarnings("unchecked") - public ReadOnlyCompositeListIterable(E object, ListIterable iterable) { - this(new SingleElementListIterable(object), iterable); - } - - /** - * Construct a list iterable with the specified object appended - * to the specified list iterable. - */ - @SuppressWarnings("unchecked") - public ReadOnlyCompositeListIterable(ListIterable iterable, E object) { - this(iterable, new SingleElementListIterable(object)); - } - - /** - * Construct a list iterable with the specified list iterables. - */ - public ReadOnlyCompositeListIterable(ListIterable... iterables) { - this(new ArrayListIterable>(iterables)); - } - - /** - * combined list iterators - */ - public ListIterator iterator() { - return new ReadOnlyCompositeListIterator(this.iterators()); - } - - /** - * list iterator of list iterators - */ - protected ListIterator> iterators() { - return new TransformationListIterator, ListIterator>(this.iterables()) { - @Override - protected ListIterator transform(ListIterable next) { - return next.iterator(); - } - }; - } - - /** - * list iterator of list iterables - */ - protected ListIterator> iterables() { - return this.iterables.iterator(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterables); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyIterable.java deleted file mode 100644 index 0483928be6..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyIterable.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyIterator; - -/** - * A ReadOnlyIterable wraps another {@link Iterable} - * and returns a read-only {@link Iterator}. - * - * @param the type of elements returned by the iterable's iterator - * - * @see ReadOnlyIterator - * @see ReadOnlyListIterable - */ -public class ReadOnlyIterable - implements Iterable -{ - private final Iterable iterable; - - - /** - * Construct an iterable the returns a read-only iterator on the elements - * in the specified iterable. - */ - public ReadOnlyIterable(Iterable iterable) { - super(); - this.iterable = iterable; - } - - public Iterator iterator() { - return new ReadOnlyIterator(this.iterable); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterable); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyListIterable.java deleted file mode 100644 index 1efde41a59..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/ReadOnlyListIterable.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyListIterator; - -/** - * A ReadOnlyListIterable wraps another {@link ListIterable} - * and returns a read-only {@link ListIterator}. - * - * @param the type of elements returned by the list iterable's list iterator - * - * @see ReadOnlyListIterator - * @see ReadOnlyIterable - */ -public class ReadOnlyListIterable - implements ListIterable -{ - private final ListIterable listIterable; - - - /** - * Construct a list iterable the returns a read-only list iterator on the elements - * in the specified list iterable. - */ - public ReadOnlyListIterable(ListIterable iterable) { - super(); - this.listIterable = iterable; - } - - public ListIterator iterator() { - return new ReadOnlyListIterator(this.listIterable); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.listIterable); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementIterable.java deleted file mode 100644 index 34ea3a7e24..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementIterable.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.SingleElementIterator; - -/** - * A SingleElementIterable returns an {@link Iterator} - * that holds a single element - * and returns it with the first call to {@link Iterator#next()}, at - * which point it will return false to any subsequent - * call to {@link Iterator#hasNext()}. - *

- * A SingleElementIterable is equivalent to the - * {@link Iterable} returned by: - * {@link java.util.Collections#singleton(Object)}. - * - * @param the type of elements returned by the iterable's iterator - * - * @see SingleElementIterator - * @see SingleElementListIterable - */ -public class SingleElementIterable - implements Iterable -{ - private final E element; - - /** - * Construct an iterable that contains only the specified element. - */ - public SingleElementIterable(E element) { - super(); - this.element = element; - } - - public Iterator iterator() { - return new SingleElementIterator(this.element); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.element); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementListIterable.java deleted file mode 100644 index c6e2100367..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SingleElementListIterable.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.SingleElementListIterator; - -/** - * A SingleElementListIterable returns a {@link ListIterator} - * that holds a single element - * and returns it with the first call to {@link ListIterator#next()}, at - * which point it will return false to any subsequent - * call to {@link ListIterator#hasNext()}. Likewise, it will return false - * to a call to {@link ListIterator#hasPrevious()} until a call to {@link ListIterator#next()}, - * at which point a call to {@link ListIterator#previous()} will return the - * single element. - *

- * A SingleElementListIterable is equivalent to the - * {@link Iterable} returned by: - * {@link java.util.Collections#singletonList(Object)}. - * - * @param the type of elements returned by the list iterable's list iterator - * - * @see SingleElementListIterator - * @see SingleElementIterable - */ -public class SingleElementListIterable - implements ListIterable -{ - private final E element; - - /** - * Construct a list iterable that contains only the specified element. - */ - public SingleElementListIterable(E element) { - super(); - this.element = element; - } - - public ListIterator iterator() { - return new SingleElementListIterator(this.element); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.element); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneIterable.java deleted file mode 100644 index 72beebec70..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneIterable.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; - -/** - * A SnapshotCloneIterable returns an iterator on a "snapshot" of a - * collection, allowing for concurrent access to the original collection. A - * copy of the collection is created when the iterable is constructed. - * As a result, the contents of the collection will be the same with - * every call to {@link #iterator()}. - *

- * The original collection passed to the SnapshotCloneIterable's - * constructor should be thread-safe (e.g. {@link java.util.Vector}); - * otherwise you run the risk of a corrupted collection. - *

- * By default, the iterator returned by a SnapshotCloneIterable does not - * support the {@link Iterator#remove()} operation; this is because it does not - * have access to the original collection. But if the SnapshotCloneIterable - * is supplied with a {@link CloneIterator.Remover} it will delegate the - * {@link Iterator#remove()} operation to the Remover. - * Alternatively, a subclass can override the iterable's {@link #remove(Object)} - * method. - *

- * This iterable is useful for multiple passes over a collection that should not - * be changed (e.g. by another thread) between passes. - * - * @param the type of elements returned by the iterable's iterator - * - * @see CloneIterator - * @see LiveCloneIterable - * @see SnapshotCloneListIterable - */ -public class SnapshotCloneIterable - extends CloneIterable -{ - private final Object[] array; - - - // ********** constructors ********** - - /** - * Construct a "snapshot" iterable for the specified iterator. - * The {@link Iterator#remove()} operation will not be supported - * by the iterator returned by {@link #iterator()} - * unless a subclass overrides the iterable's {@link #remove(Object)} - * method. - */ - public SnapshotCloneIterable(Iterator iterator) { - super(); - this.array = ArrayTools.array(iterator); - } - - /** - * Construct a "snapshot" iterable for the specified iterator. - * The specified remover will be used by any generated iterators to - * remove objects from the original collection. - */ - public SnapshotCloneIterable(Iterator iterator, CloneIterator.Remover remover) { - super(remover); - this.array = ArrayTools.array(iterator); - } - - /** - * Construct a "snapshot" iterable for the specified collection. - * The {@link Iterator#remove()} operation will not be supported - * by the iterator returned by {@link #iterator()} - * unless a subclass overrides the iterable's {@link #remove(Object)} - * method. - */ - public SnapshotCloneIterable(Collection collection) { - super(); - this.array = collection.toArray(); - } - - /** - * Construct a "snapshot" iterable for the specified collection. - * The specified remover will be used by any generated iterators to - * remove objects from the original collection. - */ - public SnapshotCloneIterable(Collection collection, CloneIterator.Remover remover) { - super(remover); - this.array = collection.toArray(); - } - - - // ********** Iterable implementation ********** - - public Iterator iterator() { - return new LocalCloneIterator(this.remover, this.array); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, Arrays.toString(this.array)); - } - - - // ********** clone iterator ********** - - /** - * provide access to "internal" constructor - */ - protected static class LocalCloneIterator extends CloneIterator { - protected LocalCloneIterator(Remover remover, Object[] array) { - super(remover, array); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneListIterable.java deleted file mode 100644 index f242ab70f5..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SnapshotCloneListIterable.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.Arrays; -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; - -/** - * A SnapshotCloneListIterable returns a list iterator on a - * "snapshot" of a list, allowing for concurrent access to the original list. - * A copy of the list is created when the list iterable is constructed. - * As a result, the contents of the list will be the same with - * every call to {@link #iterator()}, even if the original list is modified via - * the list iterator's mutation methods. - *

- * The original list passed to the SnapshotCloneListIterable's - * constructor should be thread-safe (e.g. {@link java.util.Vector}); - * otherwise you run the risk of a corrupted list. - *

- * By default, the list iterator returned by a SnapshotCloneListIterable does not - * support the {@link ListIterator} mutation operations; this is because it does not - * have access to the original list. But if the SnapshotCloneListIterable - * is supplied with a {@link CloneListIterator.Mutator} it will delegate the - * {@link ListIterator} mutation operations to the Mutator. - * Alternatively, a subclass can override the list iterable's mutation - * methods. - *

- * This list iterable is useful for multiple passes over a list that should not - * be changed (e.g. by another thread) between passes. - * - * @param the type of elements returned by the list iterable's list iterator - * - * @see CloneListIterator - * @see LiveCloneListIterable - * @see SnapshotCloneIterable - */ -public class SnapshotCloneListIterable - extends CloneListIterable -{ - private final Object[] array; - - - // ********** constructors ********** - - /** - * Construct a "snapshot" list iterable for the specified list. - * The {@link ListIterator} modify operations will not be supported - * by the list iterator returned by {@link #iterator()} - * unless a subclass overrides the list iterable's modify - * method. - */ - public SnapshotCloneListIterable(List list) { - super(); - this.array = list.toArray(); - } - - /** - * Construct a "snapshot" list iterable for the specified list. - * The specified mutator will be used by any generated list iterators to - * modify the original list. - */ - public SnapshotCloneListIterable(List list, CloneListIterator.Mutator mutator) { - super(mutator); - this.array = list.toArray(); - } - - - // ********** ListIterable implementation ********** - - public ListIterator iterator() { - return new LocalCloneListIterator(this.mutator, this.array); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, Arrays.toString(this.array)); - } - - - // ********** clone iterator ********** - - /** - * provide access to "internal" constructor - */ - protected static class LocalCloneListIterator extends CloneListIterator { - protected LocalCloneListIterator(Mutator mutator, Object[] array) { - super(mutator, array); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/StackIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/StackIterable.java deleted file mode 100644 index 211fe3f61a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/StackIterable.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.Stack; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.StackIterator; - -/** - * A StackIterable provides an {@link Iterable} - * for a {@link Stack} of objects of type E. The stack's elements - * are {@link Stack#pop() "popped"} as the iterable's iterator returns - * them with calls to {@link Iterator#next()}. - * - * @param the type of elements returned by the iterable's iterator - * - * @see Stack - * @see StackIterator - */ -public class StackIterable - implements Iterable -{ - private final Stack stack; - - /** - * Construct an iterable for the specified stack. - */ - public StackIterable(Stack stack) { - super(); - this.stack = stack; - } - - public Iterator iterator() { - return new StackIterator(this.stack); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.stack); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubIterableWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubIterableWrapper.java deleted file mode 100644 index c6108d5c22..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubIterableWrapper.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper; - -/** - * Wrap an iterable of elements of type E1, converting it into an - * iterable of elements of type E2. Assume the wrapped - * iterable contains only elements of type E2. - * - * @param input: the type of elements contained by the wrapped iterable - * @param output: the type of elements returned by the iterable's iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper - */ -public class SubIterableWrapper - implements Iterable -{ - private final Iterable iterable; - - - public SubIterableWrapper(Iterable iterable) { - super(); - this.iterable = iterable; - } - - public Iterator iterator() { - return new SubIteratorWrapper(this.iterable.iterator()); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterable); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubListIterableWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubListIterableWrapper.java deleted file mode 100644 index 2213ce0559..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SubListIterableWrapper.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.SubListIteratorWrapper; - -/** - * Wrap a list iterable of elements of type E1, converting it into - * a list iterable of elements of type E2. Assume the wrapped - * iterable contains only elements of type E2. - * - * @param input: the type of elements contained by the wrapped list iterable - * @param output: the type of elements returned by the iterable's list iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterators.SubListIteratorWrapper - */ -public class SubListIterableWrapper - implements ListIterable -{ - private final ListIterable iterable; - - - public SubListIterableWrapper(List list) { - this(new ListListIterable(list)); - } - - public SubListIterableWrapper(ListIterable iterable) { - super(); - this.iterable = iterable; - } - - public ListIterator iterator() { - return new SubListIteratorWrapper(this.iterable.iterator()); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterable); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperIterableWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperIterableWrapper.java deleted file mode 100644 index bae5e1e52a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperIterableWrapper.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * Wrap an iterable of elements of any sub-type of E, converting it into an - * iterable of elements of type E. This shouldn't be a problem since there - * is no way to add invalid elements to the iterable. - * - * @param the type of elements returned by the iterable's iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterators.SuperIteratorWrapper - */ -public class SuperIterableWrapper - implements Iterable -{ - private final Iterable iterable; - - - @SuppressWarnings("unchecked") - public SuperIterableWrapper(Iterable iterable) { - super(); - // this should be a safe cast - the iterator will only ever - // return E (or a sub-type) from #next() - this.iterable = (Iterable) iterable; - } - - public Iterator iterator() { - return this.iterable.iterator(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterable); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperListIterableWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperListIterableWrapper.java deleted file mode 100644 index 2d5fa24f03..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/SuperListIterableWrapper.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.SuperListIteratorWrapper; - -/** - * Wrap a list iterable of elements of any sub-type of E, - * converting it into a list iterable of elements of type E. - * This shouldn't be a problem since the resulting list iterable's list - * iterator disables the methods that would put invalid elements in the list - * iterator's backing list (i.e. {@link SuperListIteratorWrapper#set(Object)} - * and {@link SuperListIteratorWrapper#add(Object)}). - * - * @param the type of elements returned by the iterable's iterators - * - * @see org.eclipse.jpt.common.utility.internal.iterators.SuperListIteratorWrapper - */ -public class SuperListIterableWrapper - implements ListIterable -{ - private final ListIterable iterable; - - - public SuperListIterableWrapper(List list) { - this(new ListListIterable(list)); - } - - public SuperListIterableWrapper(ListIterable iterable) { - super(); - this.iterable = iterable; - } - - public ListIterator iterator() { - return new SuperListIteratorWrapper(this.iterable.iterator()); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterable); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationIterable.java deleted file mode 100644 index 124c15d07d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationIterable.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; - -/** - * A TransformationIterable wraps another {@link Iterable} - * and transforms its elements for client consumption. To use, supply a - * {@link Transformer} or subclass TransformationIterable - * and override the {@link #transform(Object)} method. - * Objects of type E1 are transformed into objects of type E2; - * i.e. the iterable's iterator returns objects of type E2. - * - * @param input: the type of elements to be transformed - * @param output: the type of elements returned by the iterable's iterator - * - * @see TransformationIterator - * @see TransformationListIterable - */ -public class TransformationIterable - implements Iterable -{ - private final Iterable iterable; - private final Transformer transformer; - - - /** - * Construct an iterable with the specified nested iterable - * and a default transformer that calls back to the iterable. - * Use this constructor if you want to override the - * {@link #transform(Object)} method instead of building - * a {@link Transformer}. - */ - public TransformationIterable(Iterable iterable) { - super(); - this.iterable = iterable; - this.transformer = this.buildDefaultTransformer(); - } - - /** - * Construct an iterable with the specified nested iterable - * and transformer. - */ - public TransformationIterable(Iterable iterable, Transformer transformer) { - super(); - this.iterable = iterable; - this.transformer = transformer; - } - - protected Transformer buildDefaultTransformer() { - return new DefaultTransformer(); - } - - public Iterator iterator() { - return new TransformationIterator(this.iterable.iterator(), this.transformer); - } - - /** - * Transform the specified object and return the result. - */ - protected E2 transform(@SuppressWarnings("unused") E1 o) { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterable); - } - - - //********** default linker ********** - - protected class DefaultTransformer implements Transformer { - public E2 transform(E1 o) { - return TransformationIterable.this.transform(o); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationListIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationListIterable.java deleted file mode 100644 index 0f2d058f57..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TransformationListIterable.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationListIterator; - -/** - * A TransformationListIterable wraps another {@link ListIterable} - * and transforms its elements for client consumption. To use, supply a - * {@link Transformer} or subclass TransformationListIterable - * and override the {@link #transform(Object)} method. - * Objects of type E1 are transformed into objects of type E2; - * i.e. the list iterable's list iterator returns objects of type E2. - * - * @param input: the type of elements to be transformed - * @param output: the type of elements returned by the iterable's iterator - * - * @see TransformationListIterator - * @see TransformationIterable - */ -public class TransformationListIterable - implements ListIterable -{ - private final ListIterable iterable; - private final Transformer transformer; - - - /** - * Construct a list iterable with the specified nested list - * and a default transformer that calls back to the list iterable. - * Use this constructor if you want to override the - * {@link #transform(Object)} method instead of building - * a {@link Transformer}. - */ - public TransformationListIterable(List list) { - this(new ListListIterable(list)); - } - - /** - * Construct a list iterable with the specified nested list iterable - * and a default transformer that calls back to the list iterable. - * Use this constructor if you want to override the - * {@link #transform(Object)} method instead of building - * a {@link Transformer}. - */ - public TransformationListIterable(ListIterable iterable) { - super(); - this.iterable = iterable; - this.transformer = this.buildDefaultTransformer(); - } - - /** - * Construct a list iterable with the specified nested list - * and transformer. - */ - public TransformationListIterable(List list, Transformer transformer) { - this(new ListListIterable(list), transformer); - } - - /** - * Construct a list iterable with the specified nested list iterable - * and transformer. - */ - public TransformationListIterable(ListIterable iterable, Transformer transformer) { - super(); - this.iterable = iterable; - this.transformer = transformer; - } - - protected Transformer buildDefaultTransformer() { - return new DefaultTransformer(); - } - - public ListIterator iterator() { - return new TransformationListIterator(this.iterable.iterator(), this.transformer); - } - - /** - * Transform the specified object and return the result. - */ - protected E2 transform(@SuppressWarnings("unused") E1 o) { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterable); - } - - - //********** default linker ********** - - protected class DefaultTransformer implements Transformer { - public E2 transform(E1 o) { - return TransformationListIterable.this.transform(o); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TreeIterable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TreeIterable.java deleted file mode 100644 index 8e3e1ff336..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterables/TreeIterable.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterables; - -import java.util.Arrays; -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.TreeIterator; - -/** - * A TreeIterable simplifies the traversal of a - * tree of objects, where the objects' protocol(s) provides - * a method for getting the immediate children of the given - * node but does not provide a method for getting all the - * descendants (children, grandchildren, etc.) of the given node. - *

- * To use, supply:

    - *
  • either the root element of the tree or, if the tree has - * multiple roots, an {@link Iterable} of the set of roots - *
  • a {@link TreeIterator.Midwife} that delivers the children of each child - * (alternatively, subclass TreeIterable - * and override the {@link #children(Object)} method) - *
- * - * @param the type of elements returned by the iterable's iterator - * - * @see TreeIterator - */ -public class TreeIterable - implements Iterable -{ - private final Iterable roots; - private final TreeIterator.Midwife midwife; - - - /** - * Construct an iterable containing the nodes of a tree with the specified root - * and a default midwife that calls back to the iterable. - * Use this constructor if you want to override the - * {@link #children(Object)} method instead of building - * a {@link TreeIterator.Midwife}. - */ - public TreeIterable(E root) { - this(new SingleElementIterable(root)); - } - - /** - * Construct an iterable containing the nodes of a tree with the specified root - * and midwife. - */ - public TreeIterable(E root, TreeIterator.Midwife midwife) { - this(new SingleElementIterable(root), midwife); - } - - /** - * Construct an iterable containing the nodes of a tree with the specified roots - * and a default midwife that calls back to the iterable. - * Use this constructor if you want to override the - * {@link #children(Object)} method instead of building - * a {@link TreeIterator.Midwife}. - */ - public TreeIterable(E... roots) { - this(Arrays.asList(roots)); - } - - /** - * Construct an iterable containing the nodes of a tree with the specified roots - * and midwife. - */ - public TreeIterable(E[] roots, TreeIterator.Midwife midwife) { - this(Arrays.asList(roots), midwife); - } - - /** - * Construct an iterable containing the nodes of a tree with the specified roots - * and a default midwife that calls back to the iterable. - * Use this constructor if you want to override the - * {@link #children(Object)} method instead of building - * a {@link TreeIterator.Midwife}. - */ - public TreeIterable(Iterable roots) { - super(); - this.roots = roots; - this.midwife = this.buildDefaultMidwife(); - } - - /** - * Construct an iterable containing the nodes of a tree with the specified roots - * and midwife. - */ - public TreeIterable(Iterable roots, TreeIterator.Midwife midwife) { - super(); - this.roots = roots; - this.midwife = midwife; - } - - protected TreeIterator.Midwife buildDefaultMidwife() { - return new DefaultMidwife(); - } - - public Iterator iterator() { - return new TreeIterator(this.roots, this.midwife); - } - - /** - * Return the immediate children of the specified object. - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link TreeIterator.Midwife}. - */ - protected Iterator children(@SuppressWarnings("unused") E next) { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.roots); - } - - - //********** default midwife ********** - - protected class DefaultMidwife implements TreeIterator.Midwife { - public Iterator children(E node) { - return TreeIterable.this.children(node); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ArrayIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ArrayIterator.java deleted file mode 100644 index 4b0e277339..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ArrayIterator.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Arrays; -import java.util.Iterator; -import java.util.NoSuchElementException; - -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * An ArrayIterator provides an {@link Iterator} - * for an array of objects of type E. - * - * @param the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable - */ -public class ArrayIterator - implements Iterator -{ - final E[] array; // private-protected - int cursor; // private-protected - private final int max; - - - /** - * Construct an iterator for the specified array. - */ - public ArrayIterator(E... array) { - this(array, 0, array.length); - } - - /** - * Construct an iterator for the specified array, - * starting at the specified start index and continuing for - * the rest of the array. - */ - public ArrayIterator(E[] array, int start) { - this(array, start, array.length - start); - } - - /** - * Construct an iterator for the specified array, - * starting at the specified start index and continuing for - * the specified length. - */ - public ArrayIterator(E[] array, int start, int length) { - super(); - if ((start < 0) || (start > array.length)) { - throw new IllegalArgumentException("start: " + start); //$NON-NLS-1$ - } - if ((length < 0) || (length > array.length - start)) { - throw new IllegalArgumentException("length: " + length); //$NON-NLS-1$ - } - this.array = array; - this.cursor = start; - this.max = start + length; - } - - public boolean hasNext() { - return this.cursor != this.max; - } - - public E next() { - if (this.hasNext()) { - return this.array[this.cursor++]; - } - throw new NoSuchElementException(); - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, Arrays.toString(this.array)); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ArrayListIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ArrayListIterator.java deleted file mode 100644 index b08cfe9092..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ArrayListIterator.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.ListIterator; -import java.util.NoSuchElementException; - -/** - * An ArrayListIterator provides a {@link ListIterator} - * for an array of objects. - *

- * The name might be a bit confusing: - * This is a {@link ListIterator} for an Array; - * not an {@link java.util.Iterator Iterator} for an - * {@link java.util.ArrayList ArrayList}. - * - * @param the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.ArrayListIterable - */ -public class ArrayListIterator - extends ArrayIterator - implements ListIterator -{ - private final int min; - - - /** - * Construct a list iterator for the specified array. - */ - public ArrayListIterator(E... array) { - this(array, 0, array.length); - } - - /** - * Construct a list iterator for the specified array, - * starting at the specified start index and continuing for - * the rest of the array. - */ - public ArrayListIterator(E[] array, int start) { - this(array, start, array.length - start); - } - - /** - * Construct a list iterator for the specified array, - * starting at the specified start index and continuing for - * the specified length. - */ - public ArrayListIterator(E[] array, int start, int length) { - super(array, start, length); - this.min = start; - } - - public int nextIndex() { - return this.cursor; - } - - public int previousIndex() { - return this.cursor - 1; - } - - public boolean hasPrevious() { - return this.cursor != this.min; - } - - public E previous() { - if (this.hasPrevious()) { - return this.array[--this.cursor]; - } - throw new NoSuchElementException(); - } - - public void add(E e) { - throw new UnsupportedOperationException(); - } - - public void set(E e) { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - return super.toString(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ChainIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ChainIterator.java deleted file mode 100644 index baf6710cb7..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ChainIterator.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Iterator; -import java.util.NoSuchElementException; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * A ChainIterator provides a pluggable {@link Iterator} - * that loops over a chain of arbitrarily linked objects. The chain - * should be null-terminated (i.e. a call to the {@link #nextLink(Object)} - * method should return null when it is passed the last - * link of the chain). - * To use, supply a starting link and supply a {@link Linker} or - * subclass ChainIterator and override the - * {@link #nextLink(Object)} method. - * The starting link will be the first object returned by the iterator. - * If the starting link is null, the iterator will be empty. - * Note this iterator does not support null elements. - * - * @param the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.ChainIterable - */ -public class ChainIterator - implements Iterator -{ - private E nextLink; - private final Linker linker; - - - /** - * Construct an iterator with the specified starting link - * and a disabled linker. - * Use this constructor if you want to override the - * {@link #nextLink(Object)} method instead of building - * a {@link Linker}. - */ - public ChainIterator(E startLink) { - this(startLink, Linker.Disabled.instance()); - } - - /** - * Construct an iterator with the specified starting link - * and linker. - */ - public ChainIterator(E startLink, Linker linker) { - super(); - this.nextLink = startLink; - this.linker = linker; - } - - public boolean hasNext() { - return this.nextLink != null; - } - - public E next() { - if (this.nextLink == null) { - throw new NoSuchElementException(); - } - E result = this.nextLink; - this.nextLink = this.nextLink(this.nextLink); - return result; - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - /** - * Return the next link in the chain; null if there are no more links. - */ - protected E nextLink(E currentLink) { - return this.linker.nextLink(currentLink); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.nextLink); - } - - - //********** member interface ********** - - /** - * Used by {@link ChainIterator} to link - * the elements in the chain. - */ - public interface Linker { - - /** - * Return the next link in the chain; null if there are no more links. - */ - T nextLink(T currentLink); - - - final class Null implements Linker { - @SuppressWarnings("rawtypes") - public static final Linker INSTANCE = new Null(); - @SuppressWarnings("unchecked") - public static Linker instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - // simply return null, indicating the chain is ended - public S nextLink(S currentLink) { - return null; - } - @Override - public String toString() { - return "ChainIterator.Linker.Null"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - final class Disabled implements Linker { - @SuppressWarnings("rawtypes") - public static final Linker INSTANCE = new Disabled(); - @SuppressWarnings("unchecked") - public static Linker instance() { - return INSTANCE; - } - // ensure single instance - private Disabled() { - super(); - } - // throw an exception - public S nextLink(S currentLink) { - throw new UnsupportedOperationException(); // ChainIterator.nextLink(Object) was not implemented - } - @Override - public String toString() { - return "ChainIterator.Linker.Disabled"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CloneIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CloneIterator.java deleted file mode 100644 index 8e31ddea73..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CloneIterator.java +++ /dev/null @@ -1,191 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Collection; -import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * A CloneIterator iterates over a copy of a collection, - * allowing for concurrent access to the original collection. - *

- * The original collection passed to the CloneIterator's - * constructor should be synchronized (e.g. {@link java.util.Vector}); - * otherwise you run the risk of a corrupted collection. - *

- * By default, a CloneIterator does not support the - * {@link #remove()} operation; this is because it does not have - * access to the original collection. But if the CloneIterator - * is supplied with an {@link Remover} it will delegate the - * {@link #remove()} operation to the {@link Remover}. - * Alternatively, a subclass can override the {@link #remove(Object)} - * method. - * - * @param the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable - * @see org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable - */ -public class CloneIterator - implements Iterator -{ - private final Iterator iterator; - private E current; - private final Remover remover; - private boolean removeAllowed; - - - // ********** constructors ********** - - /** - * Construct an iterator on a copy of the specified collection. - * The {@link #remove()} method will not be supported, - * unless a subclass overrides the {@link #remove(Object)}. - */ - public CloneIterator(Collection collection) { - this(collection, Remover.ReadOnly.instance()); - } - - /** - * Construct an iterator on a copy of the specified array. - * The {@link #remove()} method will not be supported, - * unless a subclass overrides the {@link #remove(Object)}. - */ - public CloneIterator(E[] array) { - this(array, Remover.ReadOnly.instance()); - } - - /** - * Construct an iterator on a copy of the specified collection. - * Use the specified remover to remove objects from the - * original collection. - */ - public CloneIterator(Collection collection, Remover remover) { - this(remover, collection.toArray()); - } - - /** - * Construct an iterator on a copy of the specified array. - * Use the specified remover to remove objects from the - * original array. - */ - public CloneIterator(E[] array, Remover remover) { - this(remover, array.clone()); - } - - /** - * Internal constructor used by subclasses. - * Swap order of arguments to prevent collision with other constructor. - * The passed in array will *not* be cloned. - */ - protected CloneIterator(Remover remover, Object... array) { - super(); - this.iterator = new ArrayIterator(array); - this.current = null; - this.remover = remover; - this.removeAllowed = false; - } - - - // ********** Iterator implementation ********** - - public boolean hasNext() { - return this.iterator.hasNext(); - } - - public E next() { - this.current = this.nestedNext(); - this.removeAllowed = true; - return this.current; - } - - public void remove() { - if ( ! this.removeAllowed) { - throw new IllegalStateException(); - } - this.remove(this.current); - this.removeAllowed = false; - } - - - // ********** internal methods ********** - - /** - * The collection passed in during construction held elements of type E, - * so this cast is not a problem. We need this cast because - * all the elements of the original collection were copied into - * an object array (Object[]). - */ - @SuppressWarnings("unchecked") - protected E nestedNext() { - return (E) this.iterator.next(); - } - - /** - * Remove the specified element from the original collection. - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link Remover}. - */ - protected void remove(E e) { - this.remover.remove(e); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - - - //********** member interface ********** - - /** - * Used by {@link CloneIterator} to remove - * elements from the original collection; since the iterator - * does not have direct access to the original collection. - */ - public interface Remover { - - /** - * Remove the specified object from the original collection. - */ - void remove(T element); - - - final class ReadOnly implements Remover { - @SuppressWarnings("rawtypes") - public static final Remover INSTANCE = new ReadOnly(); - @SuppressWarnings("unchecked") - public static Remover instance() { - return INSTANCE; - } - // ensure single instance - private ReadOnly() { - super(); - } - // remove is not supported - public void remove(Object element) { - throw new UnsupportedOperationException(); - } - @Override - public String toString() { - return "CloneIterator.Remover.ReadOnly"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CloneListIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CloneListIterator.java deleted file mode 100644 index 91536a0794..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CloneListIterator.java +++ /dev/null @@ -1,291 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * A CloneListIterator iterates over a copy of a list, - * allowing for concurrent access to the original list. - *

- * The original list passed to the CloneListIterator's - * constructor should be synchronized; otherwise you run the risk of - * a corrupted list (e.g. {@link java.util.Vector}. - *

- * By default, a CloneListIterator does not support the - * modification operations; this is because it does not have - * access to the original list. But if the CloneListIterator - * is supplied with a {@link Mutator} it will delegate the - * modification operations to the {@link Mutator}. - * Alternatively, a subclass can override the modification methods. - * - * @param the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable - * @see org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneListIterable - */ -public class CloneListIterator - implements ListIterator -{ - private final ListIterator listIterator; - private int cursor; - private State state; - private final Mutator mutator; - - private enum State { - UNKNOWN, - PREVIOUS, - NEXT - } - - - // ********** constructors ********** - - /** - * Construct a list iterator on a copy of the specified list. - * The modification methods will not be supported, - * unless a subclass overrides them. - */ - public CloneListIterator(List list) { - this(list, Mutator.ReadOnly.instance()); - } - - /** - * Construct a list iterator on a copy of the specified array. - * The modification methods will not be supported, - * unless a subclass overrides them. - */ - public CloneListIterator(E[] array) { - this(array, Mutator.ReadOnly.instance()); - } - - /** - * Construct a list iterator on a copy of the specified list. - * Use the specified list mutator to modify the original list. - */ - public CloneListIterator(List list, Mutator mutator) { - this(mutator, list.toArray()); - } - - /** - * Construct a list iterator on a copy of the specified array. - * Use the specified list mutator to modify the original list. - */ - public CloneListIterator(E[] array, Mutator mutator) { - this(mutator, array.clone()); - } - - /** - * Internal constructor used by subclasses. - * Swap order of arguments to prevent collision with other constructor. - * The passed in array will *not* be cloned. - */ - protected CloneListIterator(Mutator mutator, Object... array) { - super(); - // build a copy of the list and keep it in synch with original (if the mutator allows changes) - // that way the nested list iterator will maintain some of our state - this.listIterator = CollectionTools.list(array).listIterator(); - this.mutator = mutator; - this.cursor = 0; - this.state = State.UNKNOWN; - } - - - // ********** ListIterator implementation ********** - - public boolean hasNext() { - return this.listIterator.hasNext(); - } - - public E next() { - // allow the nested iterator to throw an exception before we modify the index - E next = this.nestedNext(); - this.cursor++; - this.state = State.NEXT; - return next; - } - - public void remove() { - // allow the nested iterator to throw an exception before we modify the original list - this.listIterator.remove(); - if (this.state == State.PREVIOUS) { - this.remove(this.cursor); - } else { - this.cursor--; - this.remove(this.cursor); - } - } - - public int nextIndex() { - return this.listIterator.nextIndex(); - } - - public int previousIndex() { - return this.listIterator.previousIndex(); - } - - public boolean hasPrevious() { - return this.listIterator.hasPrevious(); - } - - public E previous() { - // allow the nested iterator to throw an exception before we modify the index - E previous = this.nestedPrevious(); - this.cursor--; - this.state = State.PREVIOUS; - return previous; - } - - public void add(E o) { - // allow the nested iterator to throw an exception before we modify the original list - this.listIterator.add(o); - this.add(this.cursor, o); - this.cursor++; - } - - public void set(E o) { - // allow the nested iterator to throw an exception before we modify the original list - this.listIterator.set(o); - if (this.state == State.PREVIOUS) { - this.set(this.cursor, o); - } else { - this.set(this.cursor - 1, o); - } - } - - - // ********** internal methods ********** - - /** - * The list passed in during construction held elements of type E, - * so this cast is not a problem. We need this cast because - * all the elements of the original collection were copied into - * an object array (Object[]). - */ - @SuppressWarnings("unchecked") - protected E nestedNext() { - return (E) this.listIterator.next(); - } - - /** - * The list passed in during construction held elements of type E, - * so this cast is not a problem. We need this cast because - * all the elements of the original collection were copied into - * an object array (Object[]). - */ - @SuppressWarnings("unchecked") - protected E nestedPrevious() { - return (E) this.listIterator.previous(); - } - - /** - * Add the specified element to the original list. - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link Mutator}. - */ - protected void add(int index, E o) { - this.mutator.add(index, o); - } - - /** - * Remove the specified element from the original list. - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link Mutator}. - */ - protected void remove(int index) { - this.mutator.remove(index); - } - - /** - * Set the specified element in the original list. - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link Mutator}. - */ - protected void set(int index, E o) { - this.mutator.set(index, o); - } - - - // ********** overrides ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - - - //********** member interface ********** - - /** - * Used by {@link CloneListIterator} to remove - * elements from the original list; since the list iterator - * does not have direct access to the original list. - */ - public interface Mutator { - - /** - * Add the specified object to the original list. - */ - void add(int index, T o); - - /** - * Remove the specified object from the original list. - */ - void remove(int index); - - /** - * Set the specified object in the original list. - */ - void set(int index, T o); - - - final class ReadOnly implements Mutator { - @SuppressWarnings("rawtypes") - public static final Mutator INSTANCE = new ReadOnly(); - @SuppressWarnings("unchecked") - public static Mutator instance() { - return INSTANCE; - } - // ensure single instance - private ReadOnly() { - super(); - } - // add is not supported - public void add(int index, Object o) { - throw new UnsupportedOperationException(); - } - // remove is not supported - public void remove(int index) { - throw new UnsupportedOperationException(); - } - // set is not supported - public void set(int index, Object o) { - throw new UnsupportedOperationException(); - } - @Override - public String toString() { - return "CloneListIterator.Mutator.ReadOnly"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CompositeIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CompositeIterator.java deleted file mode 100644 index 02ad76d9d0..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CompositeIterator.java +++ /dev/null @@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Iterator; -import java.util.NoSuchElementException; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; - -/** - * A CompositeIterator wraps a collection - * of {@link Iterator}s and makes them appear to be a single - * {@link Iterator}. - * - * @param the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable - */ -public class CompositeIterator - implements Iterator -{ - private final Iterator> iterators; - private Iterator currentIterator; - private Iterator lastIteratorToReturnNext; - - - // ********** constructors ********** - - /** - * Construct an iterator that returns all the elements held by the - * specified iterables. - */ - public CompositeIterator(Iterable> iterables) { - this( - new TransformationIterator, Iterator>(iterables.iterator()) { - @Override - protected Iterator transform(Iterable iterable) { - return iterable.iterator(); - } - } - ); - } - - /** - * Construct an iterator with the specified collection of iterators. - */ - public CompositeIterator(Iterator> iterators) { - super(); - this.iterators = iterators; - } - - /** - * Construct an iterator with the specified object prepended - * to the specified iterable. - */ - public CompositeIterator(E object, Iterable iterable) { - this(object, iterable.iterator()); - } - - /** - * Construct an iterator with the specified object prepended - * to the specified iterator. - */ - @SuppressWarnings("unchecked") - public CompositeIterator(E object, Iterator iterator) { - this(new SingleElementIterator(object), iterator); - } - - /** - * Construct an iterator with the specified object appended - * to the specified iterable. - */ - public CompositeIterator(Iterable iterable, E object) { - this(iterable.iterator(), object); - } - - /** - * Construct an iterator with the specified object appended - * to the specified iterator. - */ - @SuppressWarnings("unchecked") - public CompositeIterator(Iterator iterator, E object) { - this(iterator, new SingleElementIterator(object)); - } - - /** - * Construct an iterator with the specified iterables. - */ - public CompositeIterator(Iterable... iterables) { - this(new ArrayIterable>(iterables)); - } - - /** - * Construct an iterator with the specified iterators. - */ - public CompositeIterator(Iterator... iterators) { - this(new ArrayIterator>(iterators)); - } - - - // ********** Iterator implementation ********** - - public boolean hasNext() { - try { - this.loadCurrentIterator(); - } catch (NoSuchElementException ex) { - // this occurs if there are no iterators at all - return false; - } - return this.currentIterator.hasNext(); - } - - public E next() { - this.loadCurrentIterator(); - E result = this.currentIterator.next(); - - // the statement above will throw a NoSuchElementException - // if the current iterator is at the end of the line; - // so if we get here, we can set 'lastIteratorToReturnNext' - this.lastIteratorToReturnNext = this.currentIterator; - - return result; - } - - public void remove() { - if (this.lastIteratorToReturnNext == null) { - // CompositeIterator#next() has never been called - throw new IllegalStateException(); - } - this.lastIteratorToReturnNext.remove(); - } - - /** - * Load {@link #currentIterator} with the first iterator that {@link Iterator#hasNext()} - * or the final iterator if all the elements have already been retrieved. - */ - private void loadCurrentIterator() { - if (this.currentIterator == null) { - this.currentIterator = this.iterators.next(); - } - while (( ! this.currentIterator.hasNext()) && this.iterators.hasNext()) { - this.currentIterator = this.iterators.next(); - } - } - - - // ********** overrides ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterators); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CompositeListIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CompositeListIterator.java deleted file mode 100644 index 3111451a92..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/CompositeListIterator.java +++ /dev/null @@ -1,270 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Arrays; -import java.util.List; -import java.util.ListIterator; -import java.util.NoSuchElementException; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; - -/** - * A CompositeListIterator wraps a list - * of {@link ListIterator}s and makes them appear to be a single - * {@link ListIterator}. - * - * @param the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable - */ -public class CompositeListIterator - implements ListIterator -{ - private final ListIterator> iterators; - private ListIterator nextIterator; - private int nextIndex; - /** - * true if "next" was last returned; - * false if "previous" was last returned; - * this determines the effect of {@link #remove()} on {@link #nextIndex} - */ - private boolean nextReturned; - private ListIterator lastIteratorToReturnElement; - - - /** - * Construct a list iterator on the elements in the specified list of lists. - */ - public CompositeListIterator(List> lists) { - this( - new TransformationListIterator, ListIterator>(lists.listIterator()) { - @Override - protected ListIterator transform(List list) { - return list.listIterator(); - } - } - ); - } - - /** - * Construct a list iterator on the elements in the specified list of lists. - */ - public CompositeListIterator(ListIterable> listIterables) { - this( - new TransformationListIterator, ListIterator>(listIterables.iterator()) { - @Override - protected ListIterator transform(ListIterable list) { - return list.iterator(); - } - } - ); - } - - /** - * Construct a list iterator with the specified list of list iterators. - */ - public CompositeListIterator(ListIterator> iterators) { - super(); - this.iterators = iterators; - this.nextIndex = 0; - this.nextReturned = false; - } - - /** - * Construct a list iterator with the specified object prepended - * to the specified list. - */ - public CompositeListIterator(E object, List list) { - this(object, list.listIterator()); - } - - /** - * Construct a list iterator with the specified object prepended - * to the specified list. - */ - public CompositeListIterator(E object, ListIterable listIterable) { - this(object, listIterable.iterator()); - } - - /** - * Construct a list iterator with the specified object prepended - * to the specified iterator. - */ - @SuppressWarnings("unchecked") - public CompositeListIterator(E object, ListIterator iterator) { - this(new SingleElementListIterator(object), iterator); - } - - /** - * Construct a list iterator with the specified object appended - * to the specified list. - */ - public CompositeListIterator(List list, E object) { - this(list.listIterator(), object); - } - - /** - * Construct a list iterator with the specified object appended - * to the specified list. - */ - public CompositeListIterator(ListIterable listIterable, E object) { - this(listIterable.iterator(), object); - } - - /** - * Construct a list iterator with the specified object appended - * to the specified iterator. - */ - @SuppressWarnings("unchecked") - public CompositeListIterator(ListIterator iterator, E object) { - this(iterator, new SingleElementListIterator(object)); - } - - /** - * Construct a list iterator with the specified lists. - */ - public CompositeListIterator(List... lists) { - this(Arrays.asList(lists)); - } - - /** - * Construct a list iterator with the specified lists. - */ - public CompositeListIterator(ListIterable... listIterables) { - this(new ArrayListIterable>(listIterables)); - } - - /** - * Construct a list iterator with the specified list iterators. - */ - public CompositeListIterator(ListIterator... iterators) { - this(new ArrayListIterator>(iterators)); - } - - public void add(E o) { - this.checkNextIterator(); - this.nextIterator.add(o); - this.nextIndex++; - } - - public boolean hasNext() { - try { - this.loadNextIterator(); - } catch (NoSuchElementException ex) { - // this occurs if there are no iterators at all - return false; - } - return this.nextIterator.hasNext(); - } - - public boolean hasPrevious() { - try { - this.loadPreviousIterator(); - } catch (NoSuchElementException ex) { - // this occurs if there are no iterators at all - return false; - } - return this.nextIterator.hasPrevious(); - } - - public E next() { - this.loadNextIterator(); - E result = this.nextIterator.next(); - - // the statement above will throw a NoSuchElementException - // if the current iterator is at the end of the line; - // so if we get here, we can set the 'lastIteratorToReturnElement' - this.lastIteratorToReturnElement = this.nextIterator; - this.nextIndex++; - this.nextReturned = true; - - return result; - } - - public int nextIndex() { - return this.nextIndex; - } - - public E previous() { - this.loadPreviousIterator(); - E result = this.nextIterator.previous(); - - // the statement above will throw a NoSuchElementException - // if the current iterator is at the end of the line; - // so if we get here, we can set the 'lastIteratorToReturnElement' - this.lastIteratorToReturnElement = this.nextIterator; - this.nextIndex--; - this.nextReturned = false; - - return result; - } - - public int previousIndex() { - return this.nextIndex - 1; - } - - public void remove() { - if (this.lastIteratorToReturnElement == null) { - throw new IllegalStateException(); - } - this.lastIteratorToReturnElement.remove(); - if (this.nextReturned) { - // decrement the index because the "next" element has moved forward in the list - this.nextIndex--; - } - } - - public void set(E e) { - if (this.lastIteratorToReturnElement == null) { - throw new IllegalStateException(); - } - this.lastIteratorToReturnElement.set(e); - } - - /** - * Load 'nextIterator' with the first iterator that hasNext() - * or the final iterator if all the elements have already been retrieved. - */ - private void loadNextIterator() { - this.checkNextIterator(); - while (( ! this.nextIterator.hasNext()) && this.iterators.hasNext()) { - this.nextIterator = this.iterators.next(); - } - } - - /** - * Load 'nextIterator' with the first iterator that hasPrevious() - * or the first iterator if all the elements have already been retrieved. - */ - private void loadPreviousIterator() { - this.checkNextIterator(); - while (( ! this.nextIterator.hasPrevious()) && this.iterators.hasPrevious()) { - this.nextIterator = this.iterators.previous(); - } - } - - /** - * If 'nextIterator' is null, load it with the first iterator. - */ - private void checkNextIterator() { - if (this.nextIterator == null) { - this.nextIterator = this.iterators.next(); - } - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterators); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/EmptyIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/EmptyIterator.java deleted file mode 100644 index f06e2e03d8..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/EmptyIterator.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Iterator; -import java.util.NoSuchElementException; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * An EmptyIterator is just that. - * - * @param the type of elements (not) returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable - */ -public final class EmptyIterator - implements Iterator -{ - - // singleton - @SuppressWarnings("rawtypes") - private static final EmptyIterator INSTANCE = new EmptyIterator(); - - /** - * Return the singleton. - */ - @SuppressWarnings("unchecked") - public static Iterator instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EmptyIterator() { - super(); - } - - public boolean hasNext() { - return false; - } - - public E next() { - throw new NoSuchElementException(); - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/EmptyListIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/EmptyListIterator.java deleted file mode 100644 index 73e23766a1..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/EmptyListIterator.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.ListIterator; -import java.util.NoSuchElementException; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * An EmptyListIterator is just that. - * - * @param the type of elements (not) returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable - */ -public final class EmptyListIterator - implements ListIterator -{ - - // singleton - @SuppressWarnings("rawtypes") - private static final EmptyListIterator INSTANCE = new EmptyListIterator(); - - /** - * Return the singleton. - */ - @SuppressWarnings("unchecked") - public static ListIterator instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EmptyListIterator() { - super(); - } - - public void add(E e) { - throw new UnsupportedOperationException(); - } - - public boolean hasNext() { - return false; - } - - public boolean hasPrevious() { - return false; - } - - public E next() { - throw new NoSuchElementException(); - } - - public int nextIndex() { - return 0; - } - - public E previous() { - throw new NoSuchElementException(); - } - - public int previousIndex() { - return -1; - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - public void set(E e) { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/EnumerationIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/EnumerationIterator.java deleted file mode 100644 index d8e9d38e25..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/EnumerationIterator.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Enumeration; -import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * An EnumerationIterator wraps an - * {@link Enumeration} so that it can be treated like an - * {@link Iterator}. - * - * @param the type of elements returned by the iterator - */ -public class EnumerationIterator - implements Iterator -{ - private final Enumeration enumeration; - - /** - * Construct an iterator that wraps the specified enumeration. - */ - public EnumerationIterator(Enumeration enumeration) { - this.enumeration = enumeration; - } - - public boolean hasNext() { - return this.enumeration.hasMoreElements(); - } - - public E next() { - return this.enumeration.nextElement(); - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.enumeration); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/FilteringIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/FilteringIterator.java deleted file mode 100644 index 4c3176c9d4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/FilteringIterator.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Iterator; -import java.util.NoSuchElementException; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * A FilteringIterator wraps another {@link Iterator} - * and uses a {@link Filter} to determine which elements in the - * nested iterator are to be returned by calls to {@link #next()}. - *

- * As an alternative to building a {@link Filter}, a subclass - * of FilteringIterator can override the - * {@link #accept(Object)} method. - *

- * One, possibly undesirable, side-effect of using this iterator is that - * the nested iterator's next() method will be invoked - * before the filtered iterator's {@link #next()} - * method is invoked. This is because the "next" element must be - * checked for whether it is to be accepted before the filtered iterator - * can determine whether it has a "next" element (i.e. that the - * {@link #hasNext()} method should return true). - * This also prevents a filtered iterator from supporting the optional - * remove() method. - * - * @param the type of elements to be filtered - * - * @see org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable - */ -public class FilteringIterator - implements Iterator -{ - private final Iterator iterator; - private final Filter filter; - private E next; - private boolean done; - - - /** - * Construct an iterator with the specified - * iterable and a disabled filter. - * Use this constructor if you want to override the - * {@link #accept(Object)} method instead of building - * a {@link Filter}. - */ - public FilteringIterator(Iterable iterable) { - this(iterable.iterator()); - } - - /** - * Construct an iterator with the specified nested - * iterator and a disabled filter. - * Use this constructor if you want to override the - * {@link #accept(Object)} method instead of building - * a {@link Filter}. - */ - public FilteringIterator(Iterator iterator) { - this(iterator, Filter.Disabled.instance()); - } - - /** - * Construct an iterator with the specified - * iterable and filter. - */ - public FilteringIterator(Iterable iterable, Filter filter) { - this(iterable.iterator(), filter); - } - - /** - * Construct an iterator with the specified nested - * iterator and filter. - */ - public FilteringIterator(Iterator iterator, Filter filter) { - super(); - this.iterator = iterator; - this.filter = filter; - this.loadNext(); - } - - public boolean hasNext() { - return ! this.done; - } - - public E next() { - if (this.done) { - throw new NoSuchElementException(); - } - E result = this.next; - this.loadNext(); - return result; - } - - /** - * Because we need to pre-load the next element - * to be returned, we cannot support the remove() - * method. - */ - public void remove() { - throw new UnsupportedOperationException(); - } - - /** - * Load next with the next valid entry from the nested - * iterator. If there are none, next is set to END. - */ - private void loadNext() { - this.done = true; - while (this.iterator.hasNext() && (this.done)) { - E temp = this.iterator.next(); - if (this.accept(temp)) { - // assume that if the object was accepted it is of type E - this.next = temp; - this.done = false; - } else { - this.next = null; - this.done = true; - } - } - } - - /** - * Return whether the {@link FilteringIterator} - * should return the specified next element from a call to the - * {@link #next()} method. - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link Filter}. - */ - protected boolean accept(E o) { - return this.filter.accept(o); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterator); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/GraphIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/GraphIterator.java deleted file mode 100644 index ff50f16ce4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/GraphIterator.java +++ /dev/null @@ -1,283 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.NoSuchElementException; - -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * A GraphIterator is similar to a {@link TreeIterator} - * except that it cannot be assumed that all nodes assume a strict tree - * structure. For instance, in a tree, a node cannot be a descendent of - * itself, but a graph may have a cyclical structure. - * - * A GraphIterator simplifies the traversal of a - * graph of objects, where the objects' protocol(s) provides - * a method for getting the next collection of nodes in the graph, - * (or neighbors), but does not provide a method for - * getting all of the nodes in the graph. - * (e.g. a neighbor can return his neighbors, and those neighbors - * can return their neighbors, which might also include the original - * neighbor, but you only want to visit the original neighbor once.) - *

- * If a neighbor has already been visited (determined by using - * {@link #equals(Object)}), that neighbor is not visited again, - * nor are the neighbors of that object. - *

- * It is up to the user of this class to ensure a complete graph. - *

- * To use, supply:

    - *
  • either the initial node of the graph or an {@link Iterator} - * over an initial collection of graph nodes - *
  • a {@link MisterRogers} that tells who the neighbors are - * of each node - * (alternatively, subclass GraphIterator - * and override the {@link #neighbors(Object)} method) - *
- * {@link #remove()} is not supported. This behavior, if - * desired, must be implemented by the user of this class. - * - * @param the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.GraphIterable - */ -public class GraphIterator - implements Iterator -{ - // use a LinkedList since we will be pulling off the front and adding to the end - private final LinkedList> iterators = new LinkedList>(); - private final HashSet visitedNeighbors = new HashSet(); - private final MisterRogers misterRogers; - - private Iterator currentIterator; - - private E nextNeighbor; - private boolean done; - - - /** - * Construct an iterator that returns the nodes of a graph - * with the specified collection of roots - * and a disabled Mr. Rogers. - * Use this constructor if you want to override the - * {@link #neighbors(Object)} method instead of building - * a {@link MisterRogers}. - */ - public GraphIterator(E... roots) { - this(new ArrayIterator(roots)); - } - - /** - * Construct an iterator that returns the nodes of a graph - * with the specified collection of roots - * and a disabled Mr. Rogers. - * Use this constructor if you want to override the - * {@link #neighbors(Object)} method instead of building - * a {@link MisterRogers}. - */ - public GraphIterator(Iterable roots) { - this(roots.iterator()); - } - - /** - * Construct an iterator that returns the nodes of a graph - * with the specified collection of roots - * and a disabled Mr. Rogers. - * Use this constructor if you want to override the - * {@link #neighbors(Object)} method instead of building - * a {@link MisterRogers}. - */ - public GraphIterator(Iterator roots) { - this(roots, MisterRogers.Disabled.instance()); - } - - /** - * Construct an iterator that returns the nodes of a graph - * with the specified root - * and a disabled Mr. Rogers. - * Use this constructor if you want to override the - * neighbors(Object) method instead of building - * a MisterRogers. - */ - public GraphIterator(E root) { - this(root, MisterRogers.Disabled.instance()); - } - - /** - * Construct an iterator that returns the nodes of a graph - * with the specified root and Mr. Rogers. - */ - public GraphIterator(E root, MisterRogers misterRogers) { - this(new SingleElementIterator(root), misterRogers); - } - - /** - * Construct an iterator that returns the nodes of a graph - * with the specified collection of roots and Mr. Rogers. - */ - public GraphIterator(E[] roots, MisterRogers misterRogers) { - this(new ArrayIterator(roots), misterRogers); - } - - /** - * Construct an iterator that returns the nodes of a graph - * with the specified roots and Mr. Rogers. - */ - public GraphIterator(Iterable roots, MisterRogers misterRogers) { - this(roots.iterator(), misterRogers); - } - - /** - * Construct an iterator that returns the nodes of a graph - * with the specified roots and Mr. Rogers. - */ - public GraphIterator(Iterator roots, MisterRogers misterRogers) { - super(); - this.currentIterator = roots; - this.misterRogers = misterRogers; - this.loadNextNeighbor(); - } - - /** - * Load next neighbor with the next entry from the current iterator. - * If the current iterator has none, load the next iterator. - * If there are no more, the {@link #done} flag is set. - */ - private void loadNextNeighbor() { - if (this.currentIterator == EmptyIterator.instance()) { - this.done = true; - } - else if (this.currentIterator.hasNext()) { - E nextPossibleNeighbor = this.currentIterator.next(); - if (this.visitedNeighbors.contains(nextPossibleNeighbor)) { - this.loadNextNeighbor(); // recurse - } else { - this.nextNeighbor = nextPossibleNeighbor; - this.visitedNeighbors.add(nextPossibleNeighbor); - this.iterators.add(this.neighbors(nextPossibleNeighbor)); - } - } - else { - for (Iterator> stream = this.iterators.iterator(); ! this.currentIterator.hasNext() && stream.hasNext(); ) { - this.currentIterator = stream.next(); - stream.remove(); - } - if ( ! this.currentIterator.hasNext()) { - this.currentIterator = EmptyIterator.instance(); - } - this.loadNextNeighbor(); // recurse - } - } - - public boolean hasNext() { - return ! this.done; - } - - public E next() { - if (this.done) { - throw new NoSuchElementException(); - } - E next = this.nextNeighbor; - this.loadNextNeighbor(); - return next; - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - /** - * Return the immediate neighbors of the specified object. - */ - protected Iterator neighbors(E next) { - return this.misterRogers.neighbors(next); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.currentIterator); - } - - - //********** inner classes ********** - - /** - * Used by {@link GraphIterator} to retrieve - * the immediate neighbors of a node in the graph. - * "These are the people in your neighborhood..." - */ - public interface MisterRogers { - - /** - * Return the immediate neighbors of the specified object. - */ - Iterator neighbors(T next); - - - final class Null implements MisterRogers { - @SuppressWarnings("rawtypes") - public static final MisterRogers INSTANCE = new Null(); - @SuppressWarnings("unchecked") - public static MisterRogers instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - // return no neighbors - public Iterator neighbors(S next) { - return EmptyIterator.instance(); - } - @Override - public String toString() { - return "GraphIterator.MisterRogers.Null"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - /** The Mr. Rogers used when the {@link GraphIterator#neighbors(Object)} method is overridden. */ - final class Disabled implements MisterRogers { - @SuppressWarnings("rawtypes") - public static final MisterRogers INSTANCE = new Disabled(); - @SuppressWarnings("unchecked") - public static MisterRogers instance() { - return INSTANCE; - } - // ensure single instance - private Disabled() { - super(); - } - // throw an exception - public Iterator neighbors(S next) { - throw new UnsupportedOperationException(); // GraphIterator.neighbors(Object) was not implemented - } - @Override - public String toString() { - return "GraphIterator.MisterRogers.Disabled"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/PeekableIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/PeekableIterator.java deleted file mode 100644 index 1a1f6284ae..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/PeekableIterator.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Iterator; -import java.util.NoSuchElementException; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * A PeekableIterator wraps another {@link Iterator} - * and allows a {@link #peek()} at the next element to be - * returned by {@link #next()}. - *

- * One, possibly undesirable, side-effect of using this iterator is that - * the nested iterator's next() method will be invoked - * before the peekable iterator's {@link #next()} - * method is invoked. This is because the "next" element must be - * pre-loaded for the {@link #peek()} method. - * This also prevents a peekable iterator from supporting the optional - * {@link #remove()} method. - * - * @param the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.PeekableIterable - */ -public class PeekableIterator - implements Iterator -{ - private final Iterator iterator; - private E next; - private boolean done; - - - /** - * Construct a peekable iterator that wraps the specified - * iterable. - */ - public PeekableIterator(Iterable iterable) { - this(iterable.iterator()); - } - - /** - * Construct a peekable iterator that wraps the specified nested - * iterator. - */ - public PeekableIterator(Iterator iterator) { - super(); - this.iterator = iterator; - this.done = false; - this.loadNext(); - } - - public boolean hasNext() { - return ! this.done; - } - - public E next() { - if (this.done) { - throw new NoSuchElementException(); - } - E result = this.next; - this.loadNext(); - return result; - } - - /** - * Return the element that will be returned by the next call to the - * {@link #next()} method, without advancing past it. - */ - public E peek() { - if (this.done) { - throw new NoSuchElementException(); - } - return this.next; - } - - /** - * Because we need to pre-load the next element - * to be returned, we cannot support the {@link #remove()} - * method. - */ - public void remove() { - throw new UnsupportedOperationException(); - } - - /** - * Load next with the next entry from the nested - * iterator. If there are none, {@link #next} is set to null - * and {@link #done} is set to true. - */ - private void loadNext() { - if (this.iterator.hasNext()) { - this.next = this.iterator.next(); - } else { - this.next = null; - this.done = true; - } - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterator); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/QueueIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/QueueIterator.java deleted file mode 100644 index 4f946237b0..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/QueueIterator.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.Queue; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * A QueueIterator provides an {@link Iterator} - * for a {@link Queue} of objects of type E. The queue's elements - * are {@link Queue#dequeue() dequeue}d" as the iterator returns them with - * calls to {@link #next()}. - * - * @param the type of elements returned by the iterator - * - * @see Queue - * @see org.eclipse.jpt.common.utility.internal.iterables.QueueIterable - */ -public class QueueIterator - implements Iterator -{ - private final Queue queue; - - - /** - * Construct an iterator for the specified queue. - */ - public QueueIterator(Queue queue) { - super(); - this.queue = queue; - } - - public boolean hasNext() { - return ! this.queue.isEmpty(); - } - - public E next() { - return this.queue.dequeue(); - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.queue); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReadOnlyCompositeListIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReadOnlyCompositeListIterator.java deleted file mode 100644 index 425788548e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReadOnlyCompositeListIterator.java +++ /dev/null @@ -1,252 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Arrays; -import java.util.List; -import java.util.ListIterator; -import java.util.NoSuchElementException; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; - -/** - * A ReadOnlyCompositeListIterator wraps a list - * of {@link ListIterator}s and makes them appear to be a single - * read-only {@link ListIterator}. A read-only composite list - * iterator is more flexible than a normal composite list iterator when it - * comes to the element types of the nested iterators. - * - * @param the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.ReadOnlyCompositeListIterable - */ -public class ReadOnlyCompositeListIterator - implements ListIterator -{ - private final ListIterator> iterators; - private ListIterator nextIterator; - private int nextIndex; - - - /** - * Construct a read-only list iterator with the specified list of lists. - */ - public ReadOnlyCompositeListIterator(List> lists) { - this( - new TransformationListIterator, ListIterator>(lists.listIterator()) { - @Override - protected ListIterator transform(List list) { - return list.listIterator(); - } - } - ); - } - - /** - * Construct a read-only list iterator with the specified list of lists. - */ - public ReadOnlyCompositeListIterator(ListIterable> listIterables) { - this( - new TransformationListIterator, ListIterator>(listIterables.iterator()) { - @Override - protected ListIterator transform(ListIterable listIterable) { - return listIterable.iterator(); - } - } - ); - } - - /** - * Construct a read-only list iterator with the specified list of - * list iterators. - */ - public ReadOnlyCompositeListIterator(ListIterator> iterators) { - super(); - this.iterators = iterators; - this.nextIndex = 0; - } - - /** - * Construct a read-only list iterator with the specified object prepended - * to the specified list. - */ - public ReadOnlyCompositeListIterator(E object, List list) { - this(object, list.listIterator()); - } - - /** - * Construct a read-only list iterator with the specified object prepended - * to the specified list. - */ - public ReadOnlyCompositeListIterator(E object, ListIterable listIterable) { - this(object, listIterable.iterator()); - } - - /** - * Construct a read-only list iterator with the specified object prepended - * to the specified iterator. - */ - @SuppressWarnings("unchecked") - public ReadOnlyCompositeListIterator(E object, ListIterator iterator) { - this(new SingleElementListIterator(object), iterator); - } - - /** - * Construct a read-only list iterator with the specified object appended - * to the specified list. - */ - public ReadOnlyCompositeListIterator(List list, E object) { - this(list.listIterator(), object); - } - - /** - * Construct a read-only list iterator with the specified object appended - * to the specified list. - */ - public ReadOnlyCompositeListIterator(ListIterable listIterable, E object) { - this(listIterable.iterator(), object); - } - - /** - * Construct a read-only list iterator with the specified object appended - * to the specified iterator. - */ - @SuppressWarnings("unchecked") - public ReadOnlyCompositeListIterator(ListIterator iterator, E object) { - this(iterator, new SingleElementListIterator(object)); - } - - /** - * Construct a read-only list iterator with the specified lists. - */ - public ReadOnlyCompositeListIterator(List... lists) { - this(Arrays.asList(lists)); - } - - /** - * Construct a read-only list iterator with the specified lists. - */ - public ReadOnlyCompositeListIterator(ListIterable... listIterables) { - this(new ArrayListIterable>(listIterables)); - } - - /** - * Construct a read-only list iterator with the specified list iterators. - */ - public ReadOnlyCompositeListIterator(ListIterator... iterators) { - this(new ArrayListIterator>(iterators)); - } - - public boolean hasNext() { - try { - this.loadNextIterator(); - } catch (NoSuchElementException ex) { - // this occurs if there are no iterators at all - return false; - } - return this.nextIterator.hasNext(); - } - - public boolean hasPrevious() { - try { - this.loadPreviousIterator(); - } catch (NoSuchElementException ex) { - // this occurs if there are no iterators at all - return false; - } - return this.nextIterator.hasPrevious(); - } - - public E next() { - this.loadNextIterator(); - E result = this.nextIterator.next(); - - // the statement above will throw a NoSuchElementException - // if the current iterator is at the end of the line; - // so if we get here, we can increment 'nextIndex' - this.nextIndex++; - - return result; - } - - public int nextIndex() { - return this.nextIndex; - } - - public E previous() { - this.loadPreviousIterator(); - E result = this.nextIterator.previous(); - - // the statement above will throw a NoSuchElementException - // if the current iterator is at the end of the line; - // so if we get here, we can decrement 'nextIndex' - this.nextIndex--; - - return result; - } - - public int previousIndex() { - return this.nextIndex - 1; - } - - public void add(E o) { - // the list iterator is read-only - throw new UnsupportedOperationException(); - } - - public void remove() { - // the list iterator is read-only - throw new UnsupportedOperationException(); - } - - public void set(E e) { - // the list iterator is read-only - throw new UnsupportedOperationException(); - } - - /** - * Load {@link #nextIterator} with the first iterator that {@link #hasNext()} - * or the final iterator if all the elements have already been retrieved. - */ - private void loadNextIterator() { - this.checkNextIterator(); - while (( ! this.nextIterator.hasNext()) && this.iterators.hasNext()) { - this.nextIterator = this.iterators.next(); - } - } - - /** - * Load {@link #nextIterator} with the first iterator that {@link #hasPrevious()} - * or the first iterator if all the elements have already been retrieved. - */ - private void loadPreviousIterator() { - this.checkNextIterator(); - while (( ! this.nextIterator.hasPrevious()) && this.iterators.hasPrevious()) { - this.nextIterator = this.iterators.previous(); - } - } - - /** - * If {@link #nextIterator} is null, load it with the first iterator. - */ - private void checkNextIterator() { - if (this.nextIterator == null) { - this.nextIterator = this.iterators.next(); - } - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterators); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReadOnlyIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReadOnlyIterator.java deleted file mode 100644 index 5673d3d190..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReadOnlyIterator.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * A ReadOnlyIterator wraps another {@link Iterator} - * and removes support for {@link #remove()}. - * - * @param the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.ReadOnlyIterable - */ -public class ReadOnlyIterator - implements Iterator -{ - private final Iterator iterator; - - /** - * Construct an iterator on the specified collection that - * disallows removes. - */ - public ReadOnlyIterator(Iterable c) { - this(c.iterator()); - } - - /** - * Construct an iterator with the specified nested iterator - * and disallow removes. - */ - public ReadOnlyIterator(Iterator iterator) { - super(); - this.iterator = iterator; - } - - public boolean hasNext() { - // delegate to the nested iterator - return this.iterator.hasNext(); - } - - public E next() { - // delegate to the nested iterator - return this.iterator.next(); - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterator); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReadOnlyListIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReadOnlyListIterator.java deleted file mode 100644 index ac09133a5d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReadOnlyListIterator.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; - -/** - * A ReadOnlyListIterator wraps another - * {@link ListIterator} and removes support for:

    - *
  • {@link #remove()} - *
  • {@link #set(Object)} - *
  • {@link #add(Object)} - *
- * - * @param the type of elements returned by the list iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.ReadOnlyListIterable - */ -public class ReadOnlyListIterator - implements ListIterator -{ - private final ListIterator listIterator; - - - /** - * Construct a list iterator on the specified list that - * disallows removes, sets, and adds. - */ - public ReadOnlyListIterator(List list) { - this(list.listIterator()); - } - - /** - * Construct a list iterator on the specified list that - * disallows removes, sets, and adds. - */ - public ReadOnlyListIterator(ListIterable listIterable) { - this(listIterable.iterator()); - } - - /** - * Construct a list iterator on the specified list iterator that - * disallows removes, sets, and adds. - */ - public ReadOnlyListIterator(ListIterator listIterator) { - super(); - this.listIterator = listIterator; - } - - public boolean hasNext() { - // delegate to the nested iterator - return this.listIterator.hasNext(); - } - - public E next() { - // delegate to the nested iterator - return this.listIterator.next(); - } - - public boolean hasPrevious() { - // delegate to the nested iterator - return this.listIterator.hasPrevious(); - } - - public E previous() { - // delegate to the nested iterator - return this.listIterator.previous(); - } - - public int nextIndex() { - // delegate to the nested iterator - return this.listIterator.nextIndex(); - } - - public int previousIndex() { - // delegate to the nested iterator - return this.listIterator.previousIndex(); - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - public void set(E o) { - throw new UnsupportedOperationException(); - } - - public void add(E o) { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.listIterator); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ResultSetIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ResultSetIterator.java deleted file mode 100644 index 03cf8c8863..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ResultSetIterator.java +++ /dev/null @@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.sql.ResultSet; -import java.sql.SQLException; -import java.util.Iterator; -import java.util.NoSuchElementException; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * A ResultSetIterator wraps an SQL {@link ResultSet} - * and transforms its rows for client consumption. Subclasses can override - * {@link #buildNext(ResultSet)} to build the expected object from - * the current row of the result set. - *

- * To use, supply:

    - *
  • a {@link ResultSet} - *
  • an {@link Adapter} that converts a row in the {@link ResultSet} - * into the desired object - * (alternatively, subclass ResultSetIterator - * and override the {@link #buildNext(ResultSet)} method) - *
- * - * @param the type of elements returned by the iterator - * - * @see java.sql.ResultSet - */ -public class ResultSetIterator - implements Iterator -{ - private final ResultSet resultSet; - private final Adapter adapter; - private E next; - private boolean done; - - - /** - * Construct an iterator on the specified result set that returns - * the objects produced by the specified adapter. - */ - public ResultSetIterator(ResultSet resultSet, Adapter adapter) { - super(); - this.resultSet = resultSet; - this.adapter = adapter; - this.done = false; - this.next = this.buildNext(); - } - - /** - * Construct an iterator on the specified result set that returns - * the first object in each row of the result set. - */ - public ResultSetIterator(ResultSet resultSet) { - this(resultSet, Adapter.Default.instance()); - } - - /** - * Build the next object for the iterator to return. - * Close the result set when we reach the end. - */ - private E buildNext() { - try { - if (this.resultSet.next()) { - return this.buildNext(this.resultSet); - } - this.resultSet.close(); - this.done = true; - return null; - } catch (SQLException ex) { - throw new RuntimeException(ex); - } - } - - /** - * By default, return the first object in the current row - * of the result set. Any {@link SQLException}s will - * be caught and wrapped in a {@link RuntimeException}. - */ - protected E buildNext(ResultSet rs) throws SQLException { - return this.adapter.buildNext(rs); - } - - public boolean hasNext() { - return ! this.done; - } - - public E next() { - if (this.done) { - throw new NoSuchElementException(); - } - E temp = this.next; - this.next = this.buildNext(); - return temp; - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.resultSet); - } - - - // ********** interface ********** - - /** - * Used by {@link ResultSetIterator} to convert a - * {@link ResultSet}'s current row into the next object - * to be returned by the {@link Iterator}. - */ - public interface Adapter { - - /** - * Return an object corresponding to the result set's - * "current" row. Any {@link SQLException}s will - * be caught and wrapped in a {@link RuntimeException}. - * @see java.sql.ResultSet - */ - T buildNext(ResultSet rs) throws SQLException; - - - final class Default implements Adapter { - @SuppressWarnings("rawtypes") - public static final Adapter INSTANCE = new Default(); - @SuppressWarnings("unchecked") - public static Adapter instance() { - return INSTANCE; - } - // ensure single instance - private Default() { - super(); - } - // return the first object in the current row of the result set - @SuppressWarnings("unchecked") - public S buildNext(ResultSet rs) throws SQLException { - // result set columns are indexed starting with 1 - return (S) rs.getObject(1); - } - @Override - public String toString() { - return "ResultSetIterator.Adapter.Default"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReverseIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReverseIterator.java deleted file mode 100644 index 7b8bfb4a07..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/ReverseIterator.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.ArrayList; -import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * A ReverseIterator wraps another {@link Iterator} and returns - * its elements in the reverse order in which the wrapped {@link Iterator} - * returns the elements. - * - * @param the type of elements returned by the iterator - */ -public class ReverseIterator - implements Iterator -{ - /** - * The elements in this iterator are already reversed. - */ - private final Iterator iterator; - - - /** - * Construct a reverse iterator for the specified iterator. - */ - public ReverseIterator(Iterator iterator) { - this(CollectionTools.reverseList(iterator)); - } - - /** - * Construct a reverse iterator for the specified iterator. - */ - public ReverseIterator(Iterator iterator, int size) { - this(CollectionTools.reverseList(iterator, size)); - } - - /** - * Construct a reverse iterator for the specified iterable. - */ - public ReverseIterator(Iterable iterable) { - this(CollectionTools.reverseList(iterable)); - } - - /** - * Construct a reverse iterator for the specified iterable. - */ - public ReverseIterator(Iterable iterable, int size) { - this(CollectionTools.reverseList(iterable, size)); - } - - private ReverseIterator(ArrayList reverseList) { - super(); - this.iterator = reverseList.iterator(); - } - - public boolean hasNext() { - return this.iterator.hasNext(); - } - - public E next() { - return this.iterator.next(); - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SingleElementIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SingleElementIterator.java deleted file mode 100644 index a6a743d1c7..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SingleElementIterator.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Iterator; -import java.util.NoSuchElementException; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * A SingleElementIterator holds a single element - * and returns it with the first call to {@link #next()}, at - * which point it will return false to any subsequent - * call to {@link #hasNext()}. - *

- * A SingleElementIterator is equivalent to the - * {@link Iterator} returned by: - * {@link java.util.Collections#singleton(Object element)}.iterator() - * - * @param the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable - */ -public class SingleElementIterator - implements Iterator -{ - private final E element; - private boolean done; - - - /** - * Construct an iterator that returns only the specified element. - */ - public SingleElementIterator(E element) { - super(); - this.element = element; - this.done = false; - } - - public boolean hasNext() { - return ! this.done; - } - - public E next() { - if (this.done) { - throw new NoSuchElementException(); - } - this.done = true; - return this.element; - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.element); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SingleElementListIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SingleElementListIterator.java deleted file mode 100644 index 9363cd0be7..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SingleElementListIterator.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.ListIterator; -import java.util.NoSuchElementException; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * A SingleElementListIterator holds a single element - * and returns it with the first call to {@link #next()}, at - * which point it will return false to any subsequent - * call to {@link #hasNext()}. Likewise, it will return false - * to a call to {@link #hasPrevious()} until a call to {@link #next()}, - * at which point a call to {@link #previous()} will return the - * single element. - *

- * A SingleElementListIterator is equivalent to the - * {@link ListIterator} returned by: - * {@link java.util.Collections#singletonList(Object element)}.listIterator() - * - * @param the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable - */ -public class SingleElementListIterator - implements ListIterator -{ - private final E element; - private boolean hasNext; - - - /** - * Construct a list iterator that returns only the specified element. - */ - public SingleElementListIterator(E element) { - super(); - this.element = element; - this.hasNext = true; - } - - public boolean hasNext() { - return this.hasNext; - } - - public E next() { - if (this.hasNext) { - this.hasNext = false; - return this.element; - } - throw new NoSuchElementException(); - } - - public int nextIndex() { - return this.hasNext ? 0 : 1; - } - - public boolean hasPrevious() { - return ! this.hasNext; - } - - public E previous() { - if (this.hasNext) { - throw new NoSuchElementException(); - } - this.hasNext = true; - return this.element; - } - - public int previousIndex() { - return this.hasNext ? -1 : 0; - } - - public void add(E e) { - throw new UnsupportedOperationException(); - } - - public void set(E e) { - throw new UnsupportedOperationException(); - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.element); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/StackIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/StackIterator.java deleted file mode 100644 index d8106d037a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/StackIterator.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.Stack; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * A StackIterator provides an {@link Iterator} - * for a {@link Stack} of objects of type E. The stack's elements - * are {@link Stack#pop() pop}ped" as the iterator returns them with - * calls to {@link #next()}. - * - * @param the type of elements returned by the iterator - * - * @see Stack - * @see org.eclipse.jpt.common.utility.internal.iterables.StackIterable - */ -public class StackIterator - implements Iterator -{ - private final Stack stack; - - - /** - * Construct an iterator for the specified stack. - */ - public StackIterator(Stack stack) { - super(); - this.stack = stack; - } - - public boolean hasNext() { - return ! this.stack.isEmpty(); - } - - public E next() { - return this.stack.pop(); - } - - public void remove() { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.stack); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubIteratorWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubIteratorWrapper.java deleted file mode 100644 index 3f7b3447f6..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubIteratorWrapper.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * Wrap an iterator on elements of type E1, converting it into an - * iterator on elements of type E2. Assume the wrapped - * iterator returns only elements of type E2. - * - * @param input: the type of elements returned by the wrapped iterator - * @param output: the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper - */ -public class SubIteratorWrapper - implements Iterator -{ - private final Iterator iterator; - - - public SubIteratorWrapper(Iterable iterable) { - this(iterable.iterator()); - } - - public SubIteratorWrapper(Iterator iterator) { - super(); - this.iterator = iterator; - } - - public boolean hasNext() { - return this.iterator.hasNext(); - } - - @SuppressWarnings("unchecked") - public E2 next() { - return (E2) this.iterator.next(); - } - - public void remove() { - this.iterator.remove(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterator); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubListIteratorWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubListIteratorWrapper.java deleted file mode 100644 index 534926384f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SubListIteratorWrapper.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; - -/** - * Wrap a list iterator on elements of type E1, converting it into - * a list iterator on elements of type E2. Assume the wrapped - * list iterator returns only elements of type E2. - * - * @param input: the type of elements returned by the wrapped list iterator - * @param output: the type of elements returned by the list iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.SubListIterableWrapper - */ -public class SubListIteratorWrapper - implements ListIterator -{ - private final ListIterator listIterator; - - - public SubListIteratorWrapper(List list) { - this(list.listIterator()); - } - - public SubListIteratorWrapper(ListIterable listIterable) { - this(listIterable.iterator()); - } - - public SubListIteratorWrapper(ListIterator iterator) { - super(); - this.listIterator = iterator; - } - - public boolean hasNext() { - return this.listIterator.hasNext(); - } - - @SuppressWarnings("unchecked") - public E2 next() { - return (E2) this.listIterator.next(); - } - - public int nextIndex() { - return this.listIterator.nextIndex(); - } - - public boolean hasPrevious() { - return this.listIterator.hasPrevious(); - } - - @SuppressWarnings("unchecked") - public E2 previous() { - return (E2) this.listIterator.previous(); - } - - public int previousIndex() { - return this.listIterator.previousIndex(); - } - - public void remove() { - this.listIterator.remove(); - } - - public void set(E2 e) { - throw new UnsupportedOperationException(); - } - - public void add(E2 e) { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.listIterator); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperIteratorWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperIteratorWrapper.java deleted file mode 100644 index 2bd19a9d96..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperIteratorWrapper.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * Wrap an iterator on elements of any sub-type of E, converting - * it into an iterator on elements of type E. This shouldn't be a - * problem since there is no way to add invalid elements to the iterator's - * backing collection. (Note the lack of compiler warnings, suppressed or - * otherwise.) - * - * @param the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper - */ -public class SuperIteratorWrapper - implements Iterator -{ - private final Iterator iterator; - - - public SuperIteratorWrapper(Iterable iterable) { - this(iterable.iterator()); - } - - public SuperIteratorWrapper(Iterator iterator) { - super(); - this.iterator = iterator; - } - - public boolean hasNext() { - return this.iterator.hasNext(); - } - - public E next() { - return this.iterator.next(); - } - - public void remove() { - this.iterator.remove(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterator); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperListIteratorWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperListIteratorWrapper.java deleted file mode 100644 index d12773a57c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SuperListIteratorWrapper.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; - -/** - * Wrap a list iterator on elements of any sub-type of E, converting it into a - * list iterator on elements of type E. This shouldn't be a problem since the - * resulting list iterator disables the methods that would put invalid elements - * in the iterator's backing list (i.e. {@link #set(Object)} and {@link #add(Object)}). - * - * @param the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper - */ -public class SuperListIteratorWrapper - implements ListIterator -{ - private final ListIterator listIterator; - - - public SuperListIteratorWrapper(List list) { - this(list.listIterator()); - } - - public SuperListIteratorWrapper(ListIterable listIterable) { - this(listIterable.iterator()); - } - - public SuperListIteratorWrapper(ListIterator listIterator) { - super(); - this.listIterator = listIterator; - } - - public boolean hasNext() { - return this.listIterator.hasNext(); - } - - public E next() { - return this.listIterator.next(); - } - - public int nextIndex() { - return this.listIterator.nextIndex(); - } - - public boolean hasPrevious() { - return this.listIterator.hasPrevious(); - } - - public E previous() { - return this.listIterator.previous(); - } - - public int previousIndex() { - return this.listIterator.previousIndex(); - } - - public void remove() { - this.listIterator.remove(); - } - - public void set(E e) { - throw new UnsupportedOperationException(); - } - - public void add(E e) { - throw new UnsupportedOperationException(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.listIterator); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SynchronizedIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SynchronizedIterator.java deleted file mode 100644 index 8efef7eb2e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SynchronizedIterator.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * Wrap an iterator and synchronize all its methods so it can be safely shared - * among multiple threads. - * - * @param the type of elements returned by the iterator - */ -public class SynchronizedIterator - implements Iterator -{ - private final Iterator iterator; - - /** Object to synchronize on. */ - private final Object mutex; - - - public SynchronizedIterator(Iterable iterable) { - this(iterable.iterator()); - } - - public SynchronizedIterator(Iterable iterable, Object mutex) { - this(iterable.iterator(), mutex); - } - - public SynchronizedIterator(Iterator iterator) { - super(); - this.iterator = iterator; - this.mutex = this; - } - - public SynchronizedIterator(Iterator iterator, Object mutex) { - super(); - this.iterator = iterator; - this.mutex = mutex; - } - - public synchronized boolean hasNext() { - synchronized (this.mutex) { - return this.iterator.hasNext(); - } - } - - public synchronized E next() { - synchronized (this.mutex) { - return this.iterator.next(); - } - } - - public synchronized void remove() { - synchronized (this.mutex) { - this.iterator.remove(); - } - } - - @Override - public String toString() { - synchronized (this.mutex) { - return StringTools.buildToStringFor(this, this.iterator); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SynchronizedListIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SynchronizedListIterator.java deleted file mode 100644 index 87e6384bf5..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/SynchronizedListIterator.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; - -/** - * Wrap a list iterator and synchronize all its methods so it can be safely shared - * among multiple threads. - * - * @param the type of elements returned by the iterator - */ -public class SynchronizedListIterator - implements ListIterator -{ - private final ListIterator listIterator; - - /** Object to synchronize on. */ - private final Object mutex; - - - public SynchronizedListIterator(List list) { - this(list.listIterator()); - } - - public SynchronizedListIterator(List list, Object mutex) { - this(list.listIterator(), mutex); - } - - public SynchronizedListIterator(ListIterable listIterable) { - this(listIterable.iterator()); - } - - public SynchronizedListIterator(ListIterable listIterable, Object mutex) { - this(listIterable.iterator(), mutex); - } - - public SynchronizedListIterator(ListIterator listIterator) { - super(); - this.listIterator = listIterator; - this.mutex = this; - } - - public SynchronizedListIterator(ListIterator listIterator, Object mutex) { - super(); - this.listIterator = listIterator; - this.mutex = mutex; - } - - public synchronized boolean hasNext() { - synchronized (this.mutex) { - return this.listIterator.hasNext(); - } - } - - public synchronized E next() { - synchronized (this.mutex) { - return this.listIterator.next(); - } - } - - public synchronized int nextIndex() { - synchronized (this.mutex) { - return this.listIterator.nextIndex(); - } - } - - public synchronized boolean hasPrevious() { - synchronized (this.mutex) { - return this.listIterator.hasPrevious(); - } - } - - public synchronized E previous() { - synchronized (this.mutex) { - return this.listIterator.previous(); - } - } - - public synchronized int previousIndex() { - synchronized (this.mutex) { - return this.listIterator.previousIndex(); - } - } - - public synchronized void remove() { - synchronized (this.mutex) { - this.listIterator.remove(); - } - } - - public synchronized void add(E e) { - synchronized (this.mutex) { - this.listIterator.add(e); - } - } - - public synchronized void set(E e) { - synchronized (this.mutex) { - this.listIterator.set(e); - } - } - - @Override - public String toString() { - synchronized (this.mutex) { - return StringTools.buildToStringFor(this, this.listIterator); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/TransformationIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/TransformationIterator.java deleted file mode 100644 index 7b6aa41bd2..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/TransformationIterator.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Transformer; - - -/** - * A TransformationIterator wraps another {@link Iterator} - * and transforms its results for client consumption. To use, supply a - * {@link Transformer} or subclass TransformationIterator - * and override the {@link #transform(Object)} method. - * Objects of type E1 are transformed into objects of type E2; - * i.e. the iterator returns objects of type E2. - * - * @param input: the type of elements to be transformed - * @param output: the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable - */ -public class TransformationIterator - implements Iterator -{ - private final Iterator iterator; - private final Transformer transformer; - - - /** - * Construct an iterator with the specified iterable - * and a disabled transformer. - * Use this constructor if you want to override the - * {@link #transform(Object)} method instead of building - * a {@link Transformer}. - */ - public TransformationIterator(Iterable iterable) { - this(iterable.iterator()); - } - - /** - * Construct an iterator with the specified nested iterator - * and a disabled transformer. - * Use this constructor if you want to override the - * {@link #transform(Object)} method instead of building - * a {@link Transformer}. - */ - public TransformationIterator(Iterator iterator) { - this(iterator, Transformer.Disabled.instance()); - } - - /** - * Construct an iterator with the specified iterable and transformer. - */ - public TransformationIterator(Iterable iterable, Transformer transformer) { - this(iterable.iterator(), transformer); - } - - /** - * Construct an iterator with the specified nested iterator - * and transformer. - */ - public TransformationIterator(Iterator iterator, Transformer transformer) { - super(); - this.iterator = iterator; - this.transformer = transformer; - } - - public boolean hasNext() { - // delegate to the nested iterator - return this.iterator.hasNext(); - } - - public E2 next() { - // transform the object returned by the nested iterator before returning it - return this.transform(this.iterator.next()); - } - - public void remove() { - // delegate to the nested iterator - this.iterator.remove(); - } - - /** - * Transform the specified object and return the result. - */ - protected E2 transform(E1 next) { - return this.transformer.transform(next); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.iterator); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/TransformationListIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/TransformationListIterator.java deleted file mode 100644 index 01455cd3d2..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/TransformationListIterator.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; - -/** - * A TransformationListIterator wraps another {@link ListIterator} - * and transforms its results for client consumption. To use, supply a - * {@link Transformer} or subclass TransformationIterator - * and override the {@link #transform(Object)} method. - *

- * The methods {@link #set(Object)} and {@link #add(Object)} - * are left unsupported in this class. - * - * @param input: the type of elements to be transformed - * @param output: the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.TransformationListIterable - */ -public class TransformationListIterator - implements ListIterator -{ - private final ListIterator listIterator; - private final Transformer transformer; - - - /** - * Construct an iterator with the specified list - * and a disabled transformer. - * Use this constructor if you want to override the - * {@link #transform(Object)} method instead of building - * a {@link Transformer}. - */ - public TransformationListIterator(List list) { - this(list.listIterator()); - } - - /** - * Construct an iterator with the specified nested listed iterator - * and a disabled transformer. - * Use this constructor if you want to override the - * {@link #transform(Object)} method instead of building - * a {@link Transformer}. - */ - public TransformationListIterator(ListIterator listIterator) { - this(listIterator, Transformer.Disabled.instance()); - } - - /** - * Construct an iterator with the specified list - * and a disabled transformer. - * Use this constructor if you want to override the - * {@link #transform(Object)} method instead of building - * a {@link Transformer}. - */ - public TransformationListIterator(ListIterable listIterable) { - this(listIterable.iterator()); - } - - /** - * Construct an iterator with the specified list and transformer. - */ - public TransformationListIterator(List list, Transformer transformer) { - this(list.listIterator(), transformer); - } - - /** - * Construct an iterator with the specified list and transformer. - */ - public TransformationListIterator(ListIterable listIterable, Transformer transformer) { - this(listIterable.iterator(), transformer); - } - - /** - * Construct an iterator with the specified nested iterator - * and transformer. - */ - public TransformationListIterator(ListIterator listIterator, Transformer transformer) { - super(); - this.listIterator = listIterator; - this.transformer = transformer; - } - - public boolean hasNext() { - // delegate to the nested iterator - return this.listIterator.hasNext(); - } - - public E2 next() { - // transform the object returned by the nested iterator before returning it - return this.transform(this.listIterator.next()); - } - - public int nextIndex() { - // delegate to the nested iterator - return this.listIterator.nextIndex(); - } - - public boolean hasPrevious() { - // delegate to the nested iterator - return this.listIterator.hasPrevious(); - } - - public E2 previous() { - // transform the object returned by the nested iterator before returning it - return this.transform(this.listIterator.previous()); - } - - public int previousIndex() { - // delegate to the nested iterator - return this.listIterator.previousIndex(); - } - - public void add(E2 o) { - throw new UnsupportedOperationException(); - } - - public void set(E2 o) { - throw new UnsupportedOperationException(); - } - - public void remove() { - // delegate to the nested iterator - this.listIterator.remove(); - } - - /** - * Transform the specified object and return the result. - */ - protected E2 transform(E1 next) { - return this.transformer.transform(next); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.listIterator); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/TreeIterator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/TreeIterator.java deleted file mode 100644 index 1103af97f4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/iterators/TreeIterator.java +++ /dev/null @@ -1,254 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.iterators; - -import java.util.Iterator; -import java.util.LinkedList; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * A TreeIterator simplifies the traversal of a - * tree of objects, where the objects' protocol(s) provides - * a method for getting the immediate children of the given - * node but does not provide a method for getting all the - * descendants (children, grandchildren, etc.) of the given node. - *

- * To use, supply:

    - *
  • either the root element of the tree or, if the tree has - * multiple roots, an {@link Iterator} over the set of roots - *
  • a {@link Midwife} that delivers the children - * of each child - * (alternatively, subclass TreeIterator - * and override the {@link #children(Object)} method) - *
- * - * @param the type of elements returned by the iterator - * - * @see org.eclipse.jpt.common.utility.internal.iterables.TreeIterable - */ -public class TreeIterator - implements Iterator -{ - private final LinkedList> iterators; - private final Midwife midwife; - private Iterator currentIterator; - - - /** - * Construct an iterator that returns the nodes of a tree - * with the specified collection of roots - * and a disabled midwife. - * Use this constructor if you want to override the - * {@link #children(Object)} method instead of building - * a {@link Midwife}. - */ - public TreeIterator(E... roots) { - this(new ArrayIterator(roots)); - } - - /** - * Construct an iterator that returns the nodes of a tree - * with the specified collection of roots - * and a disabled midwife. - * Use this constructor if you want to override the - * {@link #children(Object)} method instead of building - * a {@link Midwife}. - */ - public TreeIterator(Iterable roots) { - this(roots.iterator()); - } - - /** - * Construct an iterator that returns the nodes of a tree - * with the specified collection of roots - * and a disabled midwife. - * Use this constructor if you want to override the - * {@link #children(Object)} method instead of building - * a {@link Midwife}. - */ - public TreeIterator(Iterator roots) { - this(roots, Midwife.Disabled.instance()); - } - - /** - * Construct an iterator that returns the nodes of a tree - * with the specified root and a disabled midwife. - * Use this constructor if you want to override the - * {@link #children(Object)} method instead of building - * a {@link Midwife}. - */ - public TreeIterator(E root) { - this(root, Midwife.Disabled.instance()); - } - - /** - * Construct an iterator that returns the nodes of a tree - * with the specified root and midwife. - */ - public TreeIterator(E root, Midwife midwife) { - this(new SingleElementIterator(root), midwife); - } - - /** - * Construct an iterator that returns the nodes of a tree - * with the specified roots and midwife. - */ - public TreeIterator(E[] roots, Midwife midwife) { - this(new ArrayIterator(roots), midwife); - } - - /** - * Construct an iterator that returns the nodes of a tree - * with the specified roots and midwife. - */ - public TreeIterator(Iterable roots, Midwife midwife) { - this(roots.iterator(), midwife); - } - - /** - * Construct an iterator that returns the nodes of a tree - * with the specified roots and midwife. - */ - public TreeIterator(Iterator roots, Midwife midwife) { - super(); - this.currentIterator = roots; - // use a LinkedList since we will be pulling off the front and adding to the end - this.iterators = new LinkedList>(); - this.midwife = midwife; - } - - public boolean hasNext() { - if (this.currentIterator.hasNext()) { - return true; - } - for (Iterator iterator : this.iterators) { - if (iterator.hasNext()) { - return true; - } - } - return false; - } - - public E next() { - if (this.currentIterator.hasNext()) { - return this.nextInternal(); - } - for (Iterator> stream = this.iterators.iterator(); stream.hasNext(); ) { - this.currentIterator = stream.next(); - if (this.currentIterator.hasNext()) { - break; - } - stream.remove(); - } - return this.nextInternal(); - } - - /** - * Fetch the children of the next node before returning it. - */ - private E nextInternal() { - E next = this.currentIterator.next(); - this.iterators.add(this.children(next)); - return next; - } - - public void remove() { - this.currentIterator.remove(); - } - - /** - * Return the immediate children of the specified object. - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link Midwife}. - */ - protected Iterator children(E next) { - return this.midwife.children(next); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.currentIterator); - } - - - //********** inner classes ********** - - /** - * Used by {@link TreeIterator} to retrieve - * the immediate children of a node in the tree. - */ - public interface Midwife { - - /** - * Return the immediate children of the specified object. - */ - Iterator children(T o); - - - final class Null implements Midwife { - @SuppressWarnings("rawtypes") - public static final Midwife INSTANCE = new Null(); - @SuppressWarnings("unchecked") - public static Midwife instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - // return no neighbors - public Iterator children(S next) { - return EmptyIterator.instance(); - } - @Override - public String toString() { - return "TreeIterator.Midwife.Null"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - /** - * The midwife used when the {@link TreeIterator#children(Object)} - * method is overridden. - */ - final class Disabled implements Midwife { - @SuppressWarnings("rawtypes") - public static final Midwife INSTANCE = new Disabled(); - @SuppressWarnings("unchecked") - public static Midwife instance() { - return INSTANCE; - } - // ensure single instance - private Disabled() { - super(); - } - // throw an exception - public Iterator children(S next) { - throw new UnsupportedOperationException(); // TreeIterator.children(Object) was not implemented - } - @Override - public String toString() { - return "TreeIterator.Midwife.Disabled"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/AbstractModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/AbstractModel.java deleted file mode 100644 index e880beb71f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/AbstractModel.java +++ /dev/null @@ -1,1007 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; -import org.eclipse.jpt.common.utility.model.listener.TreeChangeListener; - -/** - * Reasonable implementation of the {@link Model} protocol - * with numerous convenience methods. - * - * @see ChangeSupport - */ -public abstract class AbstractModel - implements Model -{ - /** - * Delegate state/property/collection/list/tree change support to this - * helper object. The change support object is lazily-initialized; - * so it may be null. The method {@link #getChangeSupport()} - * will initialize this field if it is null. - *

- * NB: We instantiate this when we fire events, even when - * we do not have any listeners (which is be implied if this is null). - * This allows the change support to have behavior tied to events even when - * we have no listeners. - * - * @see AspectChangeSupport#aspectChanged(String) - */ - protected ChangeSupport changeSupport; - - - // ********** constructors/initialization ********** - - /** - * Default constructor. - */ - protected AbstractModel() { - super(); - } - - /** - * This accessor will build the change support when required. - * This only helps reduce the footprint of a model that neither has any - * listeners added to it nor ever changes (fires any events). - */ - protected synchronized ChangeSupport getChangeSupport() { - if (this.changeSupport == null) { - this.changeSupport = this.buildChangeSupport(); - } - return this.changeSupport; - } - - /** - * Allow subclasses to tweak the change support used. - */ - protected ChangeSupport buildChangeSupport() { - return new ChangeSupport(this); - } - - - // ********** change support ********** - - /** - * @see ChangeSupport#addChangeListener(ChangeListener) - */ - public void addChangeListener(ChangeListener listener) { - this.getChangeSupport().addChangeListener(listener); - } - - /** - * @see ChangeSupport#removeChangeListener(ChangeListener) - */ - public void removeChangeListener(ChangeListener listener) { - this.getChangeSupport().removeChangeListener(listener); - } - - /** - * @see ChangeSupport#hasAnyChangeListeners() - */ - public boolean hasAnyChangeListeners() { - return (this.changeSupport != null) && this.changeSupport.hasAnyChangeListeners(); - } - - /** - * Return whether the model has no change listeners. - */ - public boolean hasNoChangeListeners() { - return ! this.hasAnyChangeListeners(); - } - - - // ********** state change support ********** - - /** - * @see ChangeSupport#addStateChangeListener(StateChangeListener) - */ - public void addStateChangeListener(StateChangeListener listener) { - this.getChangeSupport().addStateChangeListener(listener); - } - - /** - * @see ChangeSupport#removeStateChangeListener(StateChangeListener) - */ - public void removeStateChangeListener(StateChangeListener listener) { - this.getChangeSupport().removeStateChangeListener(listener); - } - - /** - * @see ChangeSupport#hasAnyStateChangeListeners() - */ - public boolean hasAnyStateChangeListeners() { - return (this.changeSupport != null) && this.changeSupport.hasAnyStateChangeListeners(); - } - - /** - * Return whether the model has no state change listeners. - */ - public boolean hasNoStateChangeListeners() { - return ! this.hasAnyStateChangeListeners(); - } - - /** - * @see ChangeSupport#fireStateChanged(StateChangeEvent) - */ - protected final void fireStateChanged(StateChangeEvent event) { - this.getChangeSupport().fireStateChanged(event); - } - - /** - * @see ChangeSupport#fireStateChanged() - */ - protected final void fireStateChanged() { - this.getChangeSupport().fireStateChanged(); - } - - - // ********** property change support ********** - - /** - * @see ChangeSupport#addPropertyChangeListener(String, PropertyChangeListener) - */ - public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - this.getChangeSupport().addPropertyChangeListener(propertyName, listener); - } - - /** - * @see ChangeSupport#removePropertyChangeListener(String, PropertyChangeListener) - */ - public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { - this.getChangeSupport().removePropertyChangeListener(propertyName, listener); - } - - /** - * @see ChangeSupport#hasAnyPropertyChangeListeners(String) - */ - public boolean hasAnyPropertyChangeListeners(String propertyName) { - return (this.changeSupport != null) && this.changeSupport.hasAnyPropertyChangeListeners(propertyName); - } - - /** - * Return whether the model has no property change listeners that will - * be notified when the specified property has changed. - */ - public boolean hasNoPropertyChangeListeners(String propertyName) { - return ! this.hasAnyPropertyChangeListeners(propertyName); - } - - /** - * @see ChangeSupport#firePropertyChanged(PropertyChangeEvent) - */ - protected final boolean firePropertyChanged(PropertyChangeEvent event) { - return this.getChangeSupport().firePropertyChanged(event); - } - - /** - * @see ChangeSupport#firePropertyChanged(String, Object, Object) - */ - protected final boolean firePropertyChanged(String propertyName, Object oldValue, Object newValue) { - return this.getChangeSupport().firePropertyChanged(propertyName, oldValue, newValue); - } - - /** - * @see ChangeSupport#firePropertyChanged(String, int, int) - */ - protected final boolean firePropertyChanged(String propertyName, int oldValue, int newValue) { - return this.getChangeSupport().firePropertyChanged(propertyName, oldValue, newValue); - } - - /** - * @see ChangeSupport#firePropertyChanged(String, boolean, boolean) - */ - protected final boolean firePropertyChanged(String propertyName, boolean oldValue, boolean newValue) { - return this.getChangeSupport().firePropertyChanged(propertyName, oldValue, newValue); - } - - /** - * Implied null "old" value. - * @see #firePropertyChanged(String, Object, Object) - */ - protected final boolean firePropertyChanged(String propertyName, Object newValue) { - return this.firePropertyChanged(propertyName, null, newValue); - } - - - // ********** collection change support ********** - - /** - * @see ChangeSupport#addCollectionChangeListener(String, CollectionChangeListener) - */ - public void addCollectionChangeListener(String collectionName, CollectionChangeListener listener) { - this.getChangeSupport().addCollectionChangeListener(collectionName, listener); - } - - /** - * @see ChangeSupport#removeCollectionChangeListener(String, CollectionChangeListener) - */ - public void removeCollectionChangeListener(String collectionName, CollectionChangeListener listener) { - this.getChangeSupport().removeCollectionChangeListener(collectionName, listener); - } - - /** - * @see ChangeSupport#hasAnyCollectionChangeListeners(String) - */ - public boolean hasAnyCollectionChangeListeners(String collectionName) { - return (this.changeSupport != null) && this.changeSupport.hasAnyCollectionChangeListeners(collectionName); - } - - /** - * Return whether the model has no collection change listeners that will - * be notified when the specified collection has changed. - */ - public boolean hasNoCollectionChangeListeners(String collectionName) { - return ! this.hasAnyCollectionChangeListeners(collectionName); - } - - /** - * @see ChangeSupport#fireItemsAdded(CollectionAddEvent) - */ - protected final boolean fireItemsAdded(CollectionAddEvent event) { - return this.getChangeSupport().fireItemsAdded(event); - } - - /** - * @see ChangeSupport#fireItemsAdded(String, Collection) - */ - protected final boolean fireItemsAdded(String collectionName, Collection addedItems) { - return this.getChangeSupport().fireItemsAdded(collectionName, addedItems); - } - - /** - * @see ChangeSupport#fireItemAdded(String, Object) - */ - protected final void fireItemAdded(String collectionName, Object addedItem) { - this.getChangeSupport().fireItemAdded(collectionName, addedItem); - } - - /** - * @see ChangeSupport#fireItemsRemoved(CollectionRemoveEvent) - */ - protected final boolean fireItemsRemoved(CollectionRemoveEvent event) { - return this.getChangeSupport().fireItemsRemoved(event); - } - - /** - * @see ChangeSupport#fireItemsRemoved(String, Collection) - */ - protected final boolean fireItemsRemoved(String collectionName, Collection removedItems) { - return this.getChangeSupport().fireItemsRemoved(collectionName, removedItems); - } - - /** - * @see ChangeSupport#fireItemRemoved(String, Object) - */ - protected final void fireItemRemoved(String collectionName, Object removedItem) { - this.getChangeSupport().fireItemRemoved(collectionName, removedItem); - } - - /** - * @see ChangeSupport#fireCollectionCleared(CollectionClearEvent) - */ - protected final void fireCollectionCleared(CollectionClearEvent event) { - this.getChangeSupport().fireCollectionCleared(event); - } - - /** - * @see ChangeSupport#fireCollectionCleared(String) - */ - protected final void fireCollectionCleared(String collectionName) { - this.getChangeSupport().fireCollectionCleared(collectionName); - } - - protected final void fireCollectionChanged(CollectionChangeEvent event) { - this.getChangeSupport().fireCollectionChanged(event); - } - - protected final void fireCollectionChanged(String collectionName, Collection collection) { - this.getChangeSupport().fireCollectionChanged(collectionName, collection); - } - - /** - * @see ChangeSupport#addItemToCollection(Object, Collection, String) - */ - protected boolean addItemToCollection(E item, Collection collection, String collectionName) { - return this.getChangeSupport().addItemToCollection(item, collection, collectionName); - } - - /** - * @see ChangeSupport#addItemsToCollection(Object[], Collection, String) - */ - protected boolean addItemsToCollection(E[] items, Collection collection, String collectionName) { - return this.getChangeSupport().addItemsToCollection(items, collection, collectionName); - } - - /** - * @see ChangeSupport#addItemsToCollection(Collection, Collection, String) - */ - protected boolean addItemsToCollection(Collection items, Collection collection, String collectionName) { - return this.getChangeSupport().addItemsToCollection(items, collection, collectionName); - } - - /** - * @see ChangeSupport#addItemsToCollection(Iterable, Collection, String) - */ - protected boolean addItemsToCollection(Iterable items, Collection collection, String collectionName) { - return this.getChangeSupport().addItemsToCollection(items, collection, collectionName); - } - - /** - * @see ChangeSupport#addItemsToCollection(Iterator, Collection, String) - */ - protected boolean addItemsToCollection(Iterator items, Collection collection, String collectionName) { - return this.getChangeSupport().addItemsToCollection(items, collection, collectionName); - } - - /** - * @see ChangeSupport#removeItemFromCollection(Object, Collection, String) - */ - protected boolean removeItemFromCollection(Object item, Collection collection, String collectionName) { - return this.getChangeSupport().removeItemFromCollection(item, collection, collectionName); - } - - /** - * @see ChangeSupport#removeItemsFromCollection(Object[], Collection, String) - */ - protected boolean removeItemsFromCollection(Object[] items, Collection collection, String collectionName) { - return this.getChangeSupport().removeItemsFromCollection(items, collection, collectionName); - } - - /** - * @see ChangeSupport#removeItemsFromCollection(Collection, Collection, String) - */ - protected boolean removeItemsFromCollection(Collection items, Collection collection, String collectionName) { - return this.getChangeSupport().removeItemsFromCollection(items, collection, collectionName); - } - - /** - * @see ChangeSupport#removeItemsFromCollection(Iterable, Collection, String) - */ - protected boolean removeItemsFromCollection(Iterable items, Collection collection, String collectionName) { - return this.getChangeSupport().removeItemsFromCollection(items, collection, collectionName); - } - - /** - * @see ChangeSupport#removeItemsFromCollection(Iterator, Collection, String) - */ - protected boolean removeItemsFromCollection(Iterator items, Collection collection, String collectionName) { - return this.getChangeSupport().removeItemsFromCollection(items, collection, collectionName); - } - - /** - * @see ChangeSupport#retainItemsInCollection(Object[], Collection, String) - */ - protected boolean retainItemsInCollection(Object[] items, Collection collection, String collectionName) { - return this.getChangeSupport().retainItemsInCollection(items, collection, collectionName); - } - - /** - * @see ChangeSupport#retainItemsInCollection(Collection, Collection, String) - */ - protected boolean retainItemsInCollection(Collection items, Collection collection, String collectionName) { - return this.getChangeSupport().retainItemsInCollection(items, collection, collectionName); - } - - /** - * @see ChangeSupport#retainItemsInCollection(Iterable, Collection, String) - */ - protected boolean retainItemsInCollection(Iterable items, Collection collection, String collectionName) { - return this.getChangeSupport().retainItemsInCollection(items, collection, collectionName); - } - - /** - * @see ChangeSupport#retainItemsInCollection(Iterator, Collection, String) - */ - protected boolean retainItemsInCollection(Iterator items, Collection collection, String collectionName) { - return this.getChangeSupport().retainItemsInCollection(items, collection, collectionName); - } - - /** - * @see ChangeSupport#clearCollection(Collection, String) - */ - protected boolean clearCollection(Collection collection, String collectionName) { - return this.getChangeSupport().clearCollection(collection, collectionName); - } - - /** - * @see ChangeSupport#synchronizeCollection(Collection, Collection, String) - */ - protected boolean synchronizeCollection(Collection newCollection, Collection collection, String collectionName) { - return this.getChangeSupport().synchronizeCollection(newCollection, collection, collectionName); - } - - /** - * @see ChangeSupport#synchronizeCollection(Iterable, Collection, String) - */ - protected boolean synchronizeCollection(Iterable newCollection, Collection collection, String collectionName) { - return this.getChangeSupport().synchronizeCollection(newCollection, collection, collectionName); - } - - /** - * @see ChangeSupport#synchronizeCollection(Iterator, Collection, String) - */ - protected boolean synchronizeCollection(Iterator newCollection, Collection collection, String collectionName) { - return this.getChangeSupport().synchronizeCollection(newCollection, collection, collectionName); - } - - - // ********** list change support ********** - - /** - * @see ChangeSupport#addListChangeListener(String, ListChangeListener) - */ - public void addListChangeListener(String listName, ListChangeListener listener) { - this.getChangeSupport().addListChangeListener(listName, listener); - } - - /** - * @see ChangeSupport#removeListChangeListener(String, ListChangeListener) - */ - public void removeListChangeListener(String listName, ListChangeListener listener) { - this.getChangeSupport().removeListChangeListener(listName, listener); - } - - /** - * @see ChangeSupport#hasAnyListChangeListeners(String) - */ - public boolean hasAnyListChangeListeners(String listName) { - return (this.changeSupport != null) && this.changeSupport.hasAnyListChangeListeners(listName); - } - - /** - * Return whether the model has no list change listeners that will - * be notified when the specified list has changed. - */ - public boolean hasNoListChangeListeners(String listName) { - return ! this.hasAnyListChangeListeners(listName); - } - - /** - * @see ChangeSupport#fireItemsAdded(ListAddEvent) - */ - protected final boolean fireItemsAdded(ListAddEvent event) { - return this.getChangeSupport().fireItemsAdded(event); - } - - /** - * @see ChangeSupport#fireItemsAdded(String, int, List) - */ - protected final boolean fireItemsAdded(String listName, int index, List addedItems) { - return this.getChangeSupport().fireItemsAdded(listName, index, addedItems); - } - - /** - * @see ChangeSupport#fireItemAdded(String, int, Object) - */ - protected final void fireItemAdded(String listName, int index, Object addedItem) { - this.getChangeSupport().fireItemAdded(listName, index, addedItem); - } - - /** - * @see ChangeSupport#fireItemsRemoved(ListRemoveEvent) - */ - protected final boolean fireItemsRemoved(ListRemoveEvent event) { - return this.getChangeSupport().fireItemsRemoved(event); - } - - /** - * @see ChangeSupport#fireItemsRemoved(String, int, List) - */ - protected final boolean fireItemsRemoved(String listName, int index, List removedItems) { - return this.getChangeSupport().fireItemsRemoved(listName, index, removedItems); - } - - /** - * @see ChangeSupport#fireItemRemoved(String, int, Object) - */ - protected final void fireItemRemoved(String listName, int index, Object removedItem) { - this.getChangeSupport().fireItemRemoved(listName, index, removedItem); - } - - /** - * @see ChangeSupport#fireItemsReplaced(ListReplaceEvent) - */ - protected final boolean fireItemsReplaced(ListReplaceEvent event) { - return this.getChangeSupport().fireItemsReplaced(event); - } - - /** - * @see ChangeSupport#fireItemsReplaced(String, int, List, List) - */ - protected final boolean fireItemsReplaced(String listName, int index, List newItems, List replacedItems) { - return this.getChangeSupport().fireItemsReplaced(listName, index, newItems, replacedItems); - } - - /** - * @see ChangeSupport#fireItemReplaced(String, int, Object, Object) - */ - protected final boolean fireItemReplaced(String listName, int index, Object newItem, Object replacedItem) { - return this.getChangeSupport().fireItemReplaced(listName, index, newItem, replacedItem); - } - - /** - * @see ChangeSupport#fireItemsMoved(ListMoveEvent) - */ - protected final boolean fireItemsMoved(ListMoveEvent event) { - return this.getChangeSupport().fireItemsMoved(event); - } - - /** - * @see ChangeSupport#fireItemsMoved(String, int, int, int) - */ - protected final boolean fireItemsMoved(String listName, int targetIndex, int sourceIndex, int length) { - return this.getChangeSupport().fireItemsMoved(listName, targetIndex, sourceIndex, length); - } - - /** - * @see ChangeSupport#fireItemMoved(String, int, int) - */ - protected final boolean fireItemMoved(String listName, int targetIndex, int sourceIndex) { - return this.getChangeSupport().fireItemMoved(listName, targetIndex, sourceIndex); - } - - /** - * @see ChangeSupport#fireListCleared(ListClearEvent) - */ - protected final void fireListCleared(ListClearEvent event) { - this.getChangeSupport().fireListCleared(event); - } - - /** - * @see ChangeSupport#fireListCleared(String) - */ - protected final void fireListCleared(String listName) { - this.getChangeSupport().fireListCleared(listName); - } - - protected final void fireListChanged(ListChangeEvent event) { - this.getChangeSupport().fireListChanged(event); - } - - protected final void fireListChanged(String listName, List list) { - this.getChangeSupport().fireListChanged(listName, list); - } - - /** - * @see ChangeSupport#addItemToList(int, Object, List, String) - */ - protected void addItemToList(int index, E item, List list, String listName) { - this.getChangeSupport().addItemToList(index, item, list, listName); - } - - /** - * @see ChangeSupport#addItemToList(Object, List, String) - */ - protected boolean addItemToList(E item, List list, String listName) { - return this.getChangeSupport().addItemToList(item, list, listName); - } - - /** - * @see ChangeSupport#addItemsToList(int, Object[], List, String) - */ - protected boolean addItemsToList(int index, E[] items, List list, String listName) { - return this.getChangeSupport().addItemsToList(index, items, list, listName); - } - - /** - * @see ChangeSupport#addItemsToList(int, Collection, List, String) - */ - protected boolean addItemsToList(int index, Collection items, List list, String listName) { - return this.getChangeSupport().addItemsToList(index, items, list, listName); - } - - /** - * @see ChangeSupport#addItemsToList(int, Iterable, List, String) - */ - protected boolean addItemsToList(int index, Iterable items, List list, String listName) { - return this.getChangeSupport().addItemsToList(index, items, list, listName); - } - - /** - * @see ChangeSupport#addItemsToList(int, Iterator, List, String) - */ - protected boolean addItemsToList(int index, Iterator items, List list, String listName) { - return this.getChangeSupport().addItemsToList(index, items, list, listName); - } - - /** - * @see ChangeSupport#addItemsToList(Object[], List, String) - */ - protected boolean addItemsToList(E[] items, List list, String listName) { - return this.getChangeSupport().addItemsToList(items, list, listName); - } - - /** - * @see ChangeSupport#addItemsToList(Collection, List, String) - */ - protected boolean addItemsToList(Collection items, List list, String listName) { - return this.getChangeSupport().addItemsToList(items, list, listName); - } - - /** - * @see ChangeSupport#addItemsToList(Iterable, List, String) - */ - protected boolean addItemsToList(Iterable items, List list, String listName) { - return this.getChangeSupport().addItemsToList(items, list, listName); - } - - /** - * @see ChangeSupport#addItemsToList(Iterator, List, String) - */ - protected boolean addItemsToList(Iterator items, List list, String listName) { - return this.getChangeSupport().addItemsToList(items, list, listName); - } - - /** - * @see ChangeSupport#removeItemFromList(int, List, String) - */ - protected E removeItemFromList(int index, List list, String listName) { - return this.getChangeSupport().removeItemFromList(index, list, listName); - } - - /** - * @see ChangeSupport#removeItemFromList(Object, List, String) - */ - protected boolean removeItemFromList(Object item, List list, String listName) { - return this.getChangeSupport().removeItemFromList(item, list, listName); - } - - /** - * @see ChangeSupport#removeRangeFromList(int, int, List, String) - */ - protected List removeRangeFromList(int beginIndex, int endIndex, List list, String listName) { - return this.getChangeSupport().removeRangeFromList(beginIndex, endIndex, list, listName); - } - - /** - * @see ChangeSupport#removeItemsFromList(int, List, String) - */ - protected List removeItemsFromList(int index, List list, String listName) { - return this.getChangeSupport().removeItemsFromList(index, list, listName); - } - - /** - * @see ChangeSupport#removeItemsFromList(int, int, List, String) - */ - protected List removeItemsFromList(int index, int length, List list, String listName) { - return this.getChangeSupport().removeItemsFromList(index, length, list, listName); - } - - /** - * @see ChangeSupport#removeItemsFromList(Object[], List, String) - */ - protected boolean removeItemsFromList(Object[] items, List list, String listName) { - return this.getChangeSupport().removeItemsFromList(items, list, listName); - } - - /** - * @see ChangeSupport#removeItemsFromList(Collection, List, String) - */ - protected boolean removeItemsFromList(Collection items, List list, String listName) { - return this.getChangeSupport().removeItemsFromList(items, list, listName); - } - - /** - * @see ChangeSupport#removeItemsFromList(Iterable, List, String) - */ - protected boolean removeItemsFromList(Iterable items, List list, String listName) { - return this.getChangeSupport().removeItemsFromList(items, list, listName); - } - - /** - * @see ChangeSupport#removeItemsFromList(Iterator, List, String) - */ - protected boolean removeItemsFromList(Iterator items, List list, String listName) { - return this.getChangeSupport().removeItemsFromList(items, list, listName); - } - - /** - * @see ChangeSupport#retainItemsInList(Object[], List, String) - */ - protected boolean retainItemsInList(Object[] items, List list, String listName) { - return this.getChangeSupport().retainItemsInList(items, list, listName); - } - - /** - * @see ChangeSupport#retainItemsInList(Collection, List, String) - */ - protected boolean retainItemsInList(Collection items, List list, String listName) { - return this.getChangeSupport().retainItemsInList(items, list, listName); - } - - /** - * @see ChangeSupport#retainItemsInList(Iterable, List, String) - */ - protected boolean retainItemsInList(Iterable items, List list, String listName) { - return this.getChangeSupport().retainItemsInList(items, list, listName); - } - - /** - * @see ChangeSupport#retainItemsInList(Iterator, List, String) - */ - protected boolean retainItemsInList(Iterator items, List list, String listName) { - return this.getChangeSupport().retainItemsInList(items, list, listName); - } - - /** - * @see ChangeSupport#setItemInList(int, Object, List, String) - */ - protected E setItemInList(int index, E item, List list, String listName) { - return this.getChangeSupport().setItemInList(index, item, list, listName); - } - - /** - * @see ChangeSupport#replaceItemInList(Object, Object, List, String) - */ - protected int replaceItemInList(E oldItem, E newItem, List list, String listName) { - return this.getChangeSupport().replaceItemInList(oldItem, newItem, list, listName); - } - - /** - * @see ChangeSupport#setItemsInList(int, Object[], List, String) - */ - protected List setItemsInList(int index, E[] items, List list, String listName) { - return this.getChangeSupport().setItemsInList(index, items, list, listName); - } - - /** - * @see ChangeSupport#setItemsInList(int, List, List, String) - */ - protected List setItemsInList(int index, List items, List list, String listName) { - return this.getChangeSupport().setItemsInList(index, items, list, listName); - } - - /** - * @see ChangeSupport#moveItemsInList(int, int, int, List, String) - */ - protected void moveItemsInList(int targetIndex, int sourceIndex, int length, List list, String listName) { - this.getChangeSupport().moveItemsInList(targetIndex, sourceIndex, length, list, listName); - } - - /** - * @see ChangeSupport#moveItemInList(int, int, List, String) - */ - protected void moveItemInList(int targetIndex, int sourceIndex, List list, String listName) { - this.getChangeSupport().moveItemInList(targetIndex, sourceIndex, list, listName); - } - - /** - * @see ChangeSupport#moveItemInList(int, Object, List, String) - */ - protected void moveItemInList(int targetIndex, E item, List list, String listName) { - this.getChangeSupport().moveItemInList(targetIndex, item, list, listName); - } - - /** - * @see ChangeSupport#clearList(List, String) - */ - protected boolean clearList(List list, String listName) { - return this.getChangeSupport().clearList(list, listName); - } - - /** - * @see ChangeSupport#synchronizeList(List, List, String) - */ - protected boolean synchronizeList(List newList, List list, String listName) { - return this.getChangeSupport().synchronizeList(newList, list, listName); - } - - /** - * @see ChangeSupport#synchronizeList(Iterable, List, String) - */ - protected boolean synchronizeList(Iterable newList, List list, String listName) { - return this.getChangeSupport().synchronizeList(newList, list, listName); - } - - /** - * @see ChangeSupport#synchronizeList(Iterator, List, String) - */ - protected boolean synchronizeList(Iterator newList, List list, String listName) { - return this.getChangeSupport().synchronizeList(newList, list, listName); - } - - - // ********** tree change support ********** - - /** - * @see ChangeSupport#addTreeChangeListener(String, TreeChangeListener) - */ - public void addTreeChangeListener(String treeName, TreeChangeListener listener) { - this.getChangeSupport().addTreeChangeListener(treeName, listener); - } - - /** - * @see ChangeSupport#removeTreeChangeListener(String, TreeChangeListener) - */ - public void removeTreeChangeListener(String treeName, TreeChangeListener listener) { - this.getChangeSupport().removeTreeChangeListener(treeName, listener); - } - - /** - * @see ChangeSupport#hasAnyTreeChangeListeners(String) - */ - public boolean hasAnyTreeChangeListeners(String treeName) { - return (this.changeSupport != null) && this.changeSupport.hasAnyTreeChangeListeners(treeName); - } - - /** - * Return whether the model has no tree change listeners that will - * be notified when the specified tree has changed. - */ - public boolean hasNoTreeChangeListeners(String treeName) { - return ! this.hasAnyTreeChangeListeners(treeName); - } - - /** - * @see ChangeSupport#fireNodeAdded(TreeAddEvent) - */ - protected final void fireNodeAdded(TreeAddEvent event) { - this.getChangeSupport().fireNodeAdded(event); - } - - /** - * @see ChangeSupport#fireNodeAdded(String, List) - */ - protected final void fireNodeAdded(String treeName, List path) { - this.getChangeSupport().fireNodeAdded(treeName, path); - } - - /** - * @see ChangeSupport#fireNodeRemoved(TreeRemoveEvent) - */ - protected final void fireNodeRemoved(TreeRemoveEvent event) { - this.getChangeSupport().fireNodeRemoved(event); - } - - /** - * @see ChangeSupport#fireNodeRemoved(String, List) - */ - protected final void fireNodeRemoved(String treeName, List path) { - this.getChangeSupport().fireNodeRemoved(treeName, path); - } - - /** - * @see ChangeSupport#fireTreeCleared(TreeClearEvent) - */ - protected final void fireTreeCleared(TreeClearEvent event) { - this.getChangeSupport().fireTreeCleared(event); - } - - /** - * @see ChangeSupport#fireTreeCleared(String) - */ - protected final void fireTreeCleared(String treeName) { - this.getChangeSupport().fireTreeCleared(treeName); - } - - /** - * @see ChangeSupport#fireTreeChanged(TreeChangeEvent) - */ - protected final void fireTreeChanged(TreeChangeEvent event) { - this.getChangeSupport().fireTreeChanged(event); - } - - /** - * @see ChangeSupport#fireTreeChanged(String, Collection) - */ - protected final void fireTreeChanged(String treeName, Collection nodes) { - this.getChangeSupport().fireTreeChanged(treeName, nodes); - } - - - // ********** convenience methods ********** - - /** - * Return whether the specified values are equal, with the appropriate null checks. - * Convenience method for checking whether an attribute value has changed. - *

- * Do not use this to determine whether to fire a change notification, - * {@link ChangeSupport} already does that. - */ - protected final boolean valuesAreEqual(Object value1, Object value2) { - return this.getChangeSupport().valuesAreEqual(value1, value2); - } - - /** - * @see #valuesAreEqual(Object, Object) - */ - protected final boolean attributeValueHasNotChanged(Object oldValue, Object newValue) { - return this.valuesAreEqual(oldValue, newValue); - } - - - /** - * Do not use this to determine whether to fire a change notification, - * {@link ChangeSupport} already does that. - *

- * For example, after firing the change notification, you can use this method - * to decide if some other, related, piece of state needs to be synchronized - * with the state that just changed. - * - * @see ChangeSupport#valuesAreDifferent(Object, Object) - */ - protected final boolean valuesAreDifferent(Object value1, Object value2) { - return this.getChangeSupport().valuesAreDifferent(value1, value2); - } - - /** - * @see #valuesAreDifferent(Object, Object) - */ - protected final boolean attributeValueHasChanged(Object oldValue, Object newValue) { - return this.valuesAreDifferent(oldValue, newValue); - } - - - // ********** Object overrides ********** - - /** - * Although cloning models is usually not a Good Idea, - * we should at least support it properly. - */ - @Override - protected AbstractModel clone() throws CloneNotSupportedException { - AbstractModel clone = (AbstractModel) super.clone(); - // clear out change support - models do not share listeners - clone.changeSupport = null; - return clone; - } - - /** - * e.g. "ClassName[00-F3-EE-42](add'l info)" - */ - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - StringTools.buildSimpleToStringOn(this, sb); - sb.append('('); - int len = sb.length(); - this.toString(sb); - if (sb.length() == len) { - sb.deleteCharAt(len - 1); - } else { - sb.append(')'); - } - return sb.toString(); - } - - /** - * This method is public so one model can call a nested abstract model's - * #toString(StringBuilder). - */ - public void toString(@SuppressWarnings("unused") StringBuilder sb) { - // subclasses should override this to do something a bit more helpful - } -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/AspectChangeSupport.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/AspectChangeSupport.java deleted file mode 100644 index d98f4438fd..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/AspectChangeSupport.java +++ /dev/null @@ -1,349 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model; - -import java.util.Collection; -import java.util.EventListener; -import java.util.List; -import org.eclipse.jpt.common.utility.internal.ListenerList; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; - -/** - * This change support class will notify listeners whenever one of the source's - * aspects has changed. Only the aspect name is passed to the listener; no - * event is generated. This allows the listeners to delegate to the change - * support object verification that an aspect as actually changed. This is - * useful for simple things like setting dirty flags, blanket validation, and - * blanket sychronization; i.e. things that might be interested in the name - * of the aspect that changed but not so much how the aspect changed. - */ -public class AspectChangeSupport - extends ChangeSupport -{ - private static final long serialVersionUID = 1L; - protected static final Class LISTENER_CLASS = Listener.class; - - - public AspectChangeSupport(Model source, Listener listener) { - this(source); - this.addListener(listener); - } - - public AspectChangeSupport(Model source) { - super(source); - } - - protected void aspectChanged(String aspectName) { - Iterable listeners = this.getListeners(); - if (listeners != null) { - for (Listener listener : listeners) { - listener.aspectChanged(aspectName); - } - } - } - - public void addListener(Listener listener) { - this.addListener(LISTENER_CLASS, listener); - } - - public void removeListener(Listener listener) { - this.removeListener(LISTENER_CLASS, listener); - } - - private Iterable getListeners() { - ListenerList listenerList = this.getListenerList(); - return (listenerList == null) ? null : listenerList.getListeners(); - } - - private ListenerList getListenerList() { - return this.getListenerList(LISTENER_CLASS); - } - - - // ********** listener interface ********** - - /** - * Listener that will be notified of any aspect changes. - */ - public interface Listener extends EventListener { - - /** - * The specified aspect changed. - */ - void aspectChanged(String aspectName); - - } - - - // ********** state change support ********** - - @Override - public void fireStateChanged(StateChangeEvent event) { - super.fireStateChanged(event); - this.aspectChanged(null); - } - - @Override - public void fireStateChanged() { - super.fireStateChanged(); - this.aspectChanged(null); - } - - - // ********** property change support ********** - - @Override - protected void firePropertyChanged_(PropertyChangeEvent event) { - super.firePropertyChanged_(event); - this.aspectChanged(event.getPropertyName()); - } - - @Override - protected void firePropertyChanged_(String propertyName, Object oldValue, Object newValue) { - super.firePropertyChanged_(propertyName, oldValue, newValue); - this.aspectChanged(propertyName); - } - - @Override - protected void firePropertyChanged_(String propertyName, int oldValue, int newValue) { - super.firePropertyChanged_(propertyName, oldValue, newValue); - this.aspectChanged(propertyName); - } - - @Override - protected void firePropertyChanged_(String propertyName, boolean oldValue, boolean newValue) { - super.firePropertyChanged_(propertyName, oldValue, newValue); - this.aspectChanged(propertyName); - } - - - // ********** collection change support ********** - - @Override - protected void fireItemsAdded_(CollectionAddEvent event) { - super.fireItemsAdded_(event); - this.aspectChanged(event.getCollectionName()); - } - - @Override - protected void fireItemsAdded_(String collectionName, Collection addedItems) { - super.fireItemsAdded_(collectionName, addedItems); - this.aspectChanged(collectionName); - } - - @Override - public void fireItemAdded(String collectionName, Object addedItem) { - super.fireItemAdded(collectionName, addedItem); - this.aspectChanged(collectionName); - } - - @Override - protected void fireItemsRemoved_(CollectionRemoveEvent event) { - super.fireItemsRemoved_(event); - this.aspectChanged(event.getCollectionName()); - } - - @Override - protected void fireItemsRemoved_(String collectionName, Collection removedItems) { - super.fireItemsRemoved_(collectionName, removedItems); - this.aspectChanged(collectionName); - } - - @Override - public void fireItemRemoved(String collectionName, Object removedItem) { - super.fireItemRemoved(collectionName, removedItem); - this.aspectChanged(collectionName); - } - - @Override - public void fireCollectionCleared(CollectionClearEvent event) { - super.fireCollectionCleared(event); - this.aspectChanged(event.getCollectionName()); - } - - @Override - public void fireCollectionCleared(String collectionName) { - super.fireCollectionCleared(collectionName); - this.aspectChanged(collectionName); - } - - @Override - public void fireCollectionChanged(CollectionChangeEvent event) { - super.fireCollectionChanged(event); - this.aspectChanged(event.getCollectionName()); - } - - @Override - public void fireCollectionChanged(String collectionName, Collection collection) { - super.fireCollectionChanged(collectionName, collection); - this.aspectChanged(collectionName); - } - - - // ********** list change support ********** - - @Override - protected void fireItemsAdded_(ListAddEvent event) { - super.fireItemsAdded_(event); - this.aspectChanged(event.getListName()); - } - - @Override - protected void fireItemsAdded_(String listName, int index, List addedItems) { - super.fireItemsAdded_(listName, index, addedItems); - this.aspectChanged(listName); - } - - @Override - public void fireItemAdded(String listName, int index, Object addedItem) { - super.fireItemAdded(listName, index, addedItem); - this.aspectChanged(listName); - } - - @Override - protected void fireItemsRemoved_(ListRemoveEvent event) { - super.fireItemsRemoved_(event); - this.aspectChanged(event.getListName()); - } - - @Override - protected void fireItemsRemoved_(String listName, int index, List removedItems) { - super.fireItemsRemoved_(listName, index, removedItems); - this.aspectChanged(listName); - } - - @Override - public void fireItemRemoved(String listName, int index, Object removedItem) { - super.fireItemRemoved(listName, index, removedItem); - this.aspectChanged(listName); - } - - @Override - protected void fireItemsReplaced_(ListReplaceEvent event) { - super.fireItemsReplaced_(event); - this.aspectChanged(event.getListName()); - } - - @Override - protected void fireItemsReplaced_(String listName, int index, List newItems, List replacedItems) { - super.fireItemsReplaced_(listName, index, newItems, replacedItems); - this.aspectChanged(listName); - } - - @Override - protected void fireItemReplaced_(String listName, int index, Object newItem, Object replacedItem) { - super.fireItemReplaced_(listName, index, newItem, replacedItem); - this.aspectChanged(listName); - } - - @Override - protected void fireItemsMoved_(ListMoveEvent event) { - super.fireItemsMoved_(event); - this.aspectChanged(event.getListName()); - } - - @Override - protected void fireItemsMoved_(String listName, int targetIndex, int sourceIndex, int length) { - super.fireItemsMoved_(listName, targetIndex, sourceIndex, length); - this.aspectChanged(listName); - } - - @Override - public void fireListCleared(ListClearEvent event) { - super.fireListCleared(event); - this.aspectChanged(event.getListName()); - } - - @Override - public void fireListCleared(String listName) { - super.fireListCleared(listName); - this.aspectChanged(listName); - } - - @Override - public void fireListChanged(ListChangeEvent event) { - super.fireListChanged(event); - this.aspectChanged(event.getListName()); - } - - @Override - public void fireListChanged(String listName, List list) { - super.fireListChanged(listName, list); - this.aspectChanged(listName); - } - - - // ********** tree change support ********** - - @Override - public void fireNodeAdded(TreeAddEvent event) { - super.fireNodeAdded(event); - this.aspectChanged(event.getTreeName()); - } - - @Override - public void fireNodeAdded(String treeName, List path) { - super.fireNodeAdded(treeName, path); - this.aspectChanged(treeName); - } - - @Override - public void fireNodeRemoved(TreeRemoveEvent event) { - super.fireNodeRemoved(event); - this.aspectChanged(event.getTreeName()); - } - - @Override - public void fireNodeRemoved(String treeName, List path) { - super.fireNodeRemoved(treeName, path); - this.aspectChanged(treeName); - } - - @Override - public void fireTreeCleared(TreeClearEvent event) { - super.fireTreeCleared(event); - this.aspectChanged(event.getTreeName()); - } - - @Override - public void fireTreeCleared(String treeName) { - super.fireTreeCleared(treeName); - this.aspectChanged(treeName); - } - - @Override - public void fireTreeChanged(TreeChangeEvent event) { - super.fireTreeChanged(event); - this.aspectChanged(event.getTreeName()); - } - - @Override - public void fireTreeChanged(String treeName, Collection nodes) { - super.fireTreeChanged(treeName, nodes); - this.aspectChanged(treeName); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/ChangeSupport.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/ChangeSupport.java deleted file mode 100644 index af4b952a2b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/ChangeSupport.java +++ /dev/null @@ -1,2844 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model; - -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.EventListener; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.ListenerList; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; -import org.eclipse.jpt.common.utility.model.listener.TreeChangeListener; - -/** - * Support object that can be used by implementors of the {@link Model} interface. - * It provides for state, property, collection, list, and tree change notifications to - * listeners. - *

- * NB1: There is lots of copy-n-paste code in this class. Nearly all of this duplication - * is an effort to prevent the unnecessary creation of new objects (typically event - * objects). Since many events are fired when there are no listeners, we postpone - * the creation of event objects until we know we have interested listeners. - * Most methods have the "non-duplicated" version of the method body commented - * out at the top of the current method body. - * The hope was that this class would prove to be fairly static and the duplicated - * code would not prove onerous; but that has not proven to be - * the case, as we have added support for "state" changes, "dirty" notification, - * and custom "notifiers", with more to come, I'm sure.... ~bjv - *

- * NB2: This class will check to see if, during the firing of events, a listener - * on the original, cloned, list of listeners has been removed from the master - * list of listeners before it is notified. If the listener has been removed - * "concurrently" it will not be notified. - *

- * NB3: Any listener that is added during the firing of events will not be - * also notified. This is a bit inconsistent with NB2, but seems reasonable - * since any added listener should already be in synch with the model. - *

- * NB4: This class is serializable, but it will only write out listeners that - * are also serializable while silently leaving behind listeners that are not. - * - * @see Model - * @see AbstractModel - */ -public class ChangeSupport - implements Serializable -{ - /** The object to be provided as the "source" for any generated events. */ - protected final Model source; - - /** Associate aspect names to class-specific listener lists. */ - private AspectListenerListPair[] aspectListenerListPairs = EMPTY_ASPECT_LISTENER_LIST_PAIR_ARRAY; - private static final AspectListenerListPair[] EMPTY_ASPECT_LISTENER_LIST_PAIR_ARRAY = new AspectListenerListPair[0]; - - private static final long serialVersionUID = 1L; - - - // ********** constructor ********** - - /** - * Construct support for the specified source of change events. - * The source cannot be null. - */ - public ChangeSupport(Model source) { - super(); - if (source == null) { - throw new NullPointerException(); - } - this.source = source; - } - - - // ********** internal implementation ********** - - /** - * Add a listener that listens to all the events of the specified type and - * carrying the specified aspect name. - * Neither the aspect name nor the listener can be null. - */ - protected synchronized void addListener(Class listenerClass, String aspectName, L listener) { - ListenerList aspectListenerList = this.getListenerList(listenerClass, aspectName); - if (aspectListenerList == null) { - this.aspectListenerListPairs = ArrayTools.add(this.aspectListenerListPairs, new SimpleAspectListenerListPair(listenerClass, aspectName, listener)); - } else { - aspectListenerList.add(listener); - } - } - - /** - * Add a listener that listens to all the events of the specified type. - * The listener cannot be null. - */ - protected synchronized void addListener(Class listenerClass, L listener) { - ListenerList listenerList = this.getListenerList(listenerClass); - if (listenerList == null) { - this.aspectListenerListPairs = ArrayTools.add(this.aspectListenerListPairs, new NullAspectListenerListPair(listenerClass, listener)); - } else { - listenerList.add(listener); - } - } - - /** - * Remove a listener that has been registered for all the - * events of the specified type and carrying the specified aspect name. - * Neither the aspect name nor the listener can be null. - */ - protected synchronized void removeListener(Class listenerClass, String aspectName, L listener) { - ListenerList aspectListenerList = this.getListenerList(listenerClass, aspectName); - if (aspectListenerList == null) { - throw new IllegalArgumentException("unregistered listener: " + listener); //$NON-NLS-1$ - } - aspectListenerList.remove(listener); // leave the pair, even if the listener list is empty? - } - - /** - * Remove a listener that has been registered for all the events of the specified type. - * The listener cannot be null. - */ - protected synchronized void removeListener(Class listenerClass, L listener) { - ListenerList listenerList = this.getListenerList(listenerClass); - if (listenerList == null) { - throw new IllegalArgumentException("unregistered listener: " + listener); //$NON-NLS-1$ - } - listenerList.remove(listener); // leave the pair, even if the listener list is empty? - } - - /** - * Return the listener list for the specified listener class and aspect name. - * Return null if the listener list is not present. - * The aspect name cannot be null. - */ - protected ListenerList getListenerList(Class listenerClass, String aspectName) { - // put in a null check to simplify calling code - if (aspectName == null) { - throw new NullPointerException(); - } - return this.getListenerList_(listenerClass, aspectName); - } - - /** - * Return the listener list for the specified listener class. - * Return null if the listener list is not present. - */ - protected ListenerList getListenerList(Class listenerClass) { - return this.getListenerList_(listenerClass, null); - } - - /** - * Return the listener list for the specified listener class and aspect name. - * Return null if the listener list is not present. - */ - protected synchronized ListenerList getListenerList_(Class listenerClass, String aspectName) { - for (AspectListenerListPair pair : this.aspectListenerListPairs) { - if (pair.matches(listenerClass, aspectName)) { - @SuppressWarnings("unchecked") ListenerList aspectListenerList = (ListenerList) pair.listenerList; - return aspectListenerList; - } - } - return null; - } - - /** - * Return whether there are any listeners for the specified listener class - * and aspect name. - */ - protected boolean hasAnyListeners(Class listenerClass, String aspectName) { - ListenerList aspectListenerList = this.getListenerList(listenerClass, aspectName); - if ((aspectListenerList != null) && ! aspectListenerList.isEmpty()) { - return true; - } - return this.hasAnyChangeListeners(); // check for any general purpose listeners - } - - /** - * Return whether there are no listeners for the specified listener class - * and aspect name. - */ - protected boolean hasNoListeners(Class listenerClass, String aspectName) { - return ! this.hasAnyListeners(listenerClass, aspectName); - } - - /** - * Return whether there are any listeners for the specified listener class. - */ - protected boolean hasAnyListeners(Class listenerClass) { - ListenerList aspectListenerList = this.getListenerList(listenerClass); - if ((aspectListenerList != null) && ! aspectListenerList.isEmpty()) { - return true; - } - // check for any general purpose listeners (unless that's what we're already doing) - return (listenerClass == this.getChangeListenerClass()) ? false : this.hasAnyChangeListeners(); - } - - /** - * Return whether there are no listeners for the specified listener class. - */ - protected boolean hasNoListeners(Class listenerClass) { - return ! this.hasAnyListeners(listenerClass); - } - - - // ********** general purpose change support ********** - - /** - * Subclasses that add other types of listeners should override this method - * to return the extension to ChangeListener that also extends whatever new - * listener types are supported. - */ - @SuppressWarnings("unchecked") - protected Class getChangeListenerClass() { - // not sure why I need to cast here... - return (Class) CHANGE_LISTENER_CLASS; - } - - protected static final Class CHANGE_LISTENER_CLASS = ChangeListener.class; - - /** - * Add a general purpose listener that listens to all events, - * regardless of the aspect name associated with that event. - * The listener cannot be null. - */ - public void addChangeListener(ChangeListener listener) { - this.addListener(this.getChangeListenerClass(), listener); - } - - /** - * Remove a general purpose listener. - * The listener cannot be null. - */ - public void removeChangeListener(ChangeListener listener) { - this.removeListener(this.getChangeListenerClass(), listener); - } - - /** - * Return whether there are any general purpose listeners that will be - * notified of any changes. - */ - public boolean hasAnyChangeListeners() { - return this.hasAnyListeners(this.getChangeListenerClass()); - } - - private ListenerList getChangeListenerList() { - return this.getListenerList(CHANGE_LISTENER_CLASS); - } - - private Iterable getChangeListeners() { - ListenerList listenerList = this.getChangeListenerList(); - return (listenerList == null) ? null : listenerList.getListeners(); - } - - private boolean hasChangeListener(ChangeListener listener) { - return CollectionTools.contains(this.getChangeListeners(), listener); - } - - - // ********** state change support ********** - - protected static final Class STATE_CHANGE_LISTENER_CLASS = StateChangeListener.class; - - /** - * Add a state change listener. - */ - public void addStateChangeListener(StateChangeListener listener) { - this.addListener(STATE_CHANGE_LISTENER_CLASS, listener); - } - - /** - * Remove a state change listener. - */ - public void removeStateChangeListener(StateChangeListener listener) { - this.removeListener(STATE_CHANGE_LISTENER_CLASS, listener); - } - - /** - * Return whether there are any state change listeners. - */ - public boolean hasAnyStateChangeListeners() { - return this.hasAnyListeners(STATE_CHANGE_LISTENER_CLASS); - } - - private ListenerList getStateChangeListenerList() { - return this.getListenerList(STATE_CHANGE_LISTENER_CLASS); - } - - private Iterable getStateChangeListeners() { - ListenerList listenerList = this.getStateChangeListenerList(); - return (listenerList == null) ? null : listenerList.getListeners(); - } - - private boolean hasStateChangeListener(StateChangeListener listener) { - return CollectionTools.contains(this.getStateChangeListeners(), listener); - } - - /** - * Fire the specified state change event to any registered listeners. - */ - public void fireStateChanged(StateChangeEvent event) { - Iterable listeners = this.getStateChangeListeners(); - if (listeners != null) { - for (StateChangeListener listener : listeners) { - if (this.hasStateChangeListener(listener)) { // verify listener is still listening - listener.stateChanged(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - changeListener.stateChanged(event); - } - } - } - } - - /** - * Report a generic state change event to any registered state change - * listeners. - */ - public void fireStateChanged() { -// this.fireStateChanged(new StateChangeEvent(this.source)); - StateChangeEvent event = null; - Iterable listeners = this.getStateChangeListeners(); - if (listeners != null) { - for (StateChangeListener listener : listeners) { - if (this.hasStateChangeListener(listener)) { // verify listener is still listening - if (event == null) { - event = new StateChangeEvent(this.source); - } - listener.stateChanged(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new StateChangeEvent(this.source); - } - changeListener.stateChanged(event); - } - } - } - } - - - // ********** property change support ********** - - protected static final Class PROPERTY_CHANGE_LISTENER_CLASS = PropertyChangeListener.class; - - /** - * Add a property change listener for the specified property. The listener - * will be notified only for changes to the specified property. - */ - public void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - this.addListener(PROPERTY_CHANGE_LISTENER_CLASS, propertyName, listener); - } - - /** - * Remove a property change listener that was registered for a specific property. - */ - public void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { - this.removeListener(PROPERTY_CHANGE_LISTENER_CLASS, propertyName, listener); - } - - /** - * Return whether there are any property change listeners that will - * be notified when the specified property has changed. - */ - public boolean hasAnyPropertyChangeListeners(String propertyName) { - return this.hasAnyListeners(PROPERTY_CHANGE_LISTENER_CLASS, propertyName); - } - - private ListenerList getPropertyChangeListenerList(String propertyName) { - return this.getListenerList(PROPERTY_CHANGE_LISTENER_CLASS, propertyName); - } - - private Iterable getPropertyChangeListeners(String propertyName) { - ListenerList listenerList = this.getPropertyChangeListenerList(propertyName); - return (listenerList == null) ? null : listenerList.getListeners(); - } - - private boolean hasPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - return CollectionTools.contains(this.getPropertyChangeListeners(propertyName), listener); - } - - /** - * Fire the specified property change event to any registered listeners. - * No event is fired if the specified event's old and new values are the same; - * this includes when both values are null. Use a state change event - * for general purpose notification of changes. - * Return whether the old and new values are different. - */ - public boolean firePropertyChanged(PropertyChangeEvent event) { - if (this.valuesAreDifferent(event.getOldValue(), event.getNewValue())) { - this.firePropertyChanged_(event); - return true; - } - return false; - } - - /** - * pre-condition: the specified event's old and new values are different - */ - protected void firePropertyChanged_(PropertyChangeEvent event) { - String propertyName = event.getPropertyName(); - Iterable listeners = this.getPropertyChangeListeners(propertyName); - if (listeners != null) { - for (PropertyChangeListener listener : listeners) { - if (this.hasPropertyChangeListener(propertyName, listener)) { // verify listener is still listening - listener.propertyChanged(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - changeListener.propertyChanged(event); - } - } - } - } - - /** - * Report a bound property update to any registered property change listeners. - * No event is fired if the specified old and new values are the same; - * this includes when both values are null. Use a state change event - * for general purpose notification of changes. - * Return whether the old and new values are different. - */ - public boolean firePropertyChanged(String propertyName, Object oldValue, Object newValue) { -// return this.firePropertyChanged(new PropertyChangeEvent(this.source, propertyName, oldValue, newValue)); - if (this.valuesAreDifferent(oldValue, newValue)) { - this.firePropertyChanged_(propertyName, oldValue, newValue); - return true; - } - return false; - } - - /** - * pre-condition: the specified old and new values are different - */ - protected void firePropertyChanged_(String propertyName, Object oldValue, Object newValue) { - PropertyChangeEvent event = null; - Iterable listeners = this.getPropertyChangeListeners(propertyName); - if (listeners != null) { - for (PropertyChangeListener listener : listeners) { - if (this.hasPropertyChangeListener(propertyName, listener)) { // verify listener is still listening - if (event == null) { - event = new PropertyChangeEvent(this.source, propertyName, oldValue, newValue); - } - listener.propertyChanged(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new PropertyChangeEvent(this.source, propertyName, oldValue, newValue); - } - changeListener.propertyChanged(event); - } - } - } - } - - /** - * Report an int bound property update to any registered listeners. - * No event is fired if the specified old and new values are equal. - * Return whether the old and new values are different. - *

- * This is merely a convenience wrapper around the more general method - * {@link #firePropertyChanged(String, Object, Object)}. - */ - public boolean firePropertyChanged(String propertyName, int oldValue, int newValue) { -// return this.firePropertyChanged(propertyName, Integer.valueOf(oldValue), Integer.valueOf(newValue)); - if (oldValue != newValue) { - this.firePropertyChanged_(propertyName, oldValue, newValue); - return true; - } - return false; - } - - /** - * pre-condition: the specified old and new values are different - */ - protected void firePropertyChanged_(String propertyName, int oldValue, int newValue) { - PropertyChangeEvent event = null; - Iterable listeners = this.getPropertyChangeListeners(propertyName); - if (listeners != null) { - for (PropertyChangeListener listener : listeners) { - if (this.hasPropertyChangeListener(propertyName, listener)) { // verify listener is still listening - if (event == null) { - event = new PropertyChangeEvent(this.source, propertyName, Integer.valueOf(oldValue), Integer.valueOf(newValue)); - } - listener.propertyChanged(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new PropertyChangeEvent(this.source, propertyName, Integer.valueOf(oldValue), Integer.valueOf(newValue)); - } - changeListener.propertyChanged(event); - } - } - } - } - - /** - * Report a boolean bound property update to any registered listeners. - * No event is fired if the specified old and new values are equal. - * Return whether the old and new values are different. - *

- * This is merely a convenience wrapper around the more general method - * {@link #firePropertyChanged(String, Object, Object)}. - */ - public boolean firePropertyChanged(String propertyName, boolean oldValue, boolean newValue) { -// return this.firePropertyChanged(propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue)); - if (oldValue != newValue) { - this.firePropertyChanged_(propertyName, oldValue, newValue); - return true; - } - return false; - } - - /** - * pre-condition: the specified old and new values are different - */ - protected void firePropertyChanged_(String propertyName, boolean oldValue, boolean newValue) { - PropertyChangeEvent event = null; - Iterable listeners = this.getPropertyChangeListeners(propertyName); - if (listeners != null) { - for (PropertyChangeListener listener : listeners) { - if (this.hasPropertyChangeListener(propertyName, listener)) { // verify listener is still listening - if (event == null) { - event = new PropertyChangeEvent(this.source, propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue)); - } - listener.propertyChanged(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new PropertyChangeEvent(this.source, propertyName, Boolean.valueOf(oldValue), Boolean.valueOf(newValue)); - } - changeListener.propertyChanged(event); - } - } - } - } - - - // ********** collection change support ********** - - protected static final Class COLLECTION_CHANGE_LISTENER_CLASS = CollectionChangeListener.class; - - /** - * Add a collection change listener for the specified collection. The listener - * will be notified only for changes to the specified collection. - */ - public void addCollectionChangeListener(String collectionName, CollectionChangeListener listener) { - this.addListener(COLLECTION_CHANGE_LISTENER_CLASS, collectionName, listener); - } - - /** - * Remove a collection change listener that was registered for a specific collection. - */ - public void removeCollectionChangeListener(String collectionName, CollectionChangeListener listener) { - this.removeListener(COLLECTION_CHANGE_LISTENER_CLASS, collectionName, listener); - } - - /** - * Return whether there are any collection change listeners that will - * be notified when the specified collection has changed. - */ - public boolean hasAnyCollectionChangeListeners(String collectionName) { - return this.hasAnyListeners(COLLECTION_CHANGE_LISTENER_CLASS, collectionName); - } - - private ListenerList getCollectionChangeListenerList(String collectionName) { - return this.getListenerList(COLLECTION_CHANGE_LISTENER_CLASS, collectionName); - } - - private Iterable getCollectionChangeListeners(String collectionName) { - ListenerList listenerList = this.getCollectionChangeListenerList(collectionName); - return (listenerList == null) ? null : listenerList.getListeners(); - } - - private boolean hasCollectionChangeListener(String collectionName, CollectionChangeListener listener) { - return CollectionTools.contains(this.getCollectionChangeListeners(collectionName), listener); - } - - /** - * Report a bound collection update to any registered listeners. - * Return whether the event has any items. - */ - public boolean fireItemsAdded(CollectionAddEvent event) { - if (event.getItemsSize() != 0) { - this.fireItemsAdded_(event); - return true; - } - return false; - } - - /** - * pre-condition: the specified event contains items - */ - protected void fireItemsAdded_(CollectionAddEvent event) { - String collectionName = event.getCollectionName(); - Iterable listeners = this.getCollectionChangeListeners(collectionName); - if (listeners != null) { - for (CollectionChangeListener listener : listeners) { - if (this.hasCollectionChangeListener(collectionName, listener)) { // verify listener is still listening - listener.itemsAdded(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - changeListener.itemsAdded(event); - } - } - } - } - - /** - * Report a bound collection update to any registered listeners. - * Return whether there are any added items. - */ - public boolean fireItemsAdded(String collectionName, Collection addedItems) { -// return this.fireItemsAdded(new CollectionAddEvent(this.source, collectionName, addedItems)); - if ( ! addedItems.isEmpty()) { - this.fireItemsAdded_(collectionName, addedItems); - return true; - } - return false; - } - - /** - * pre-condition: 'addedItems' is not empty - */ - protected void fireItemsAdded_(String collectionName, Collection addedItems) { - CollectionAddEvent event = null; - Iterable listeners = this.getCollectionChangeListeners(collectionName); - if (listeners != null) { - for (CollectionChangeListener listener : listeners) { - if (this.hasCollectionChangeListener(collectionName, listener)) { // verify listener is still listening - if (event == null) { - event = new CollectionAddEvent(this.source, collectionName, addedItems); - } - listener.itemsAdded(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new CollectionAddEvent(this.source, collectionName, addedItems); - } - changeListener.itemsAdded(event); - } - } - } - } - - /** - * Report a bound collection update to any registered listeners. - */ - public void fireItemAdded(String collectionName, Object addedItem) { -// this.fireItemsAdded(collectionName, Collections.singleton(addedItem)); - - CollectionAddEvent event = null; - Iterable listeners = this.getCollectionChangeListeners(collectionName); - if (listeners != null) { - for (CollectionChangeListener listener : listeners) { - if (this.hasCollectionChangeListener(collectionName, listener)) { // verify listener is still listening - if (event == null) { - event = new CollectionAddEvent(this.source, collectionName, addedItem); - } - listener.itemsAdded(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new CollectionAddEvent(this.source, collectionName, addedItem); - } - changeListener.itemsAdded(event); - } - } - } - } - - /** - * Report a bound collection update to any registered listeners. - * Return whether the event has any items. - */ - public boolean fireItemsRemoved(CollectionRemoveEvent event) { - if (event.getItemsSize() != 0) { - this.fireItemsRemoved_(event); - return true; - } - return false; - } - - /** - * pre-condition: the specified event contains items - */ - protected void fireItemsRemoved_(CollectionRemoveEvent event) { - String collectionName = event.getCollectionName(); - Iterable listeners = this.getCollectionChangeListeners(collectionName); - if (listeners != null) { - for (CollectionChangeListener listener : listeners) { - if (this.hasCollectionChangeListener(collectionName, listener)) { // verify listener is still listening - listener.itemsRemoved(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - changeListener.itemsRemoved(event); - } - } - } - } - - /** - * Report a bound collection update to any registered listeners. - * Return whether there are any removed items. - */ - public boolean fireItemsRemoved(String collectionName, Collection removedItems) { -// return this.fireItemsRemoved(new CollectionRemoveEvent(this.source, collectionName, removedItems)); - if ( ! removedItems.isEmpty()) { - this.fireItemsRemoved_(collectionName, removedItems); - return true; - } - return false; - } - - /** - * pre-condition: 'removedItems' is not empty - */ - protected void fireItemsRemoved_(String collectionName, Collection removedItems) { - CollectionRemoveEvent event = null; - Iterable listeners = this.getCollectionChangeListeners(collectionName); - if (listeners != null) { - for (CollectionChangeListener listener : listeners) { - if (this.hasCollectionChangeListener(collectionName, listener)) { // verify listener is still listening - if (event == null) { - event = new CollectionRemoveEvent(this.source, collectionName, removedItems); - } - listener.itemsRemoved(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new CollectionRemoveEvent(this.source, collectionName, removedItems); - } - changeListener.itemsRemoved(event); - } - } - } - } - - /** - * Report a bound collection update to any registered listeners. - */ - public void fireItemRemoved(String collectionName, Object removedItem) { -// this.fireItemsRemoved(collectionName, Collections.singleton(removedItem)); - - CollectionRemoveEvent event = null; - Iterable listeners = this.getCollectionChangeListeners(collectionName); - if (listeners != null) { - for (CollectionChangeListener listener : listeners) { - if (this.hasCollectionChangeListener(collectionName, listener)) { // verify listener is still listening - if (event == null) { - event = new CollectionRemoveEvent(this.source, collectionName, removedItem); - } - listener.itemsRemoved(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new CollectionRemoveEvent(this.source, collectionName, removedItem); - } - changeListener.itemsRemoved(event); - } - } - } - } - - /** - * Report a bound collection update to any registered listeners. - */ - public void fireCollectionCleared(CollectionClearEvent event) { - String collectionName = event.getCollectionName(); - Iterable listeners = this.getCollectionChangeListeners(collectionName); - if (listeners != null) { - for (CollectionChangeListener listener : listeners) { - if (this.hasCollectionChangeListener(collectionName, listener)) { // verify listener is still listening - listener.collectionCleared(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - changeListener.collectionCleared(event); - } - } - } - } - - /** - * Report a bound collection update to any registered listeners. - */ - public void fireCollectionCleared(String collectionName) { -// this.fireCollectionCleared(new CollectionClearEvent(this.source, collectionName)); - - CollectionClearEvent event = null; - Iterable listeners = this.getCollectionChangeListeners(collectionName); - if (listeners != null) { - for (CollectionChangeListener listener : listeners) { - if (this.hasCollectionChangeListener(collectionName, listener)) { // verify listener is still listening - if (event == null) { - event = new CollectionClearEvent(this.source, collectionName); - } - listener.collectionCleared(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new CollectionClearEvent(this.source, collectionName); - } - changeListener.collectionCleared(event); - } - } - } - } - - /** - * Report a bound collection update to any registered listeners. - */ - public void fireCollectionChanged(CollectionChangeEvent event) { - String collectionName = event.getCollectionName(); - Iterable listeners = this.getCollectionChangeListeners(collectionName); - if (listeners != null) { - for (CollectionChangeListener listener : listeners) { - if (this.hasCollectionChangeListener(collectionName, listener)) { // verify listener is still listening - listener.collectionChanged(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - changeListener.collectionChanged(event); - } - } - } - } - - /** - * Report a bound collection update to any registered listeners. - */ - public void fireCollectionChanged(String collectionName, Collection collection) { -// this.fireCollectionChanged(new CollectionChangeEvent(this.source, collectionName, collection)); - - CollectionChangeEvent event = null; - Iterable listeners = this.getCollectionChangeListeners(collectionName); - if (listeners != null) { - for (CollectionChangeListener listener : listeners) { - if (this.hasCollectionChangeListener(collectionName, listener)) { // verify listener is still listening - if (event == null) { - event = new CollectionChangeEvent(this.source, collectionName, collection); - } - listener.collectionChanged(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new CollectionChangeEvent(this.source, collectionName, collection); - } - changeListener.collectionChanged(event); - } - } - } - } - - /** - * Add the specified item to the specified bound collection - * and fire the appropriate event if necessary. - * Return whether the collection changed. - * @see Collection#add(Object) - */ - public boolean addItemToCollection(E item, Collection collection, String collectionName) { - if (collection.add(item)) { - this.fireItemAdded(collectionName, item); - return true; - } - return false; - } - - /** - * Add the specified items to the specified bound collection - * and fire the appropriate event if necessary. - * Return whether collection changed. - * @see Collection#addAll(Collection) - */ - public boolean addItemsToCollection(E[] items, Collection collection, String collectionName) { - return (items.length != 0) - && this.addItemsToCollection_(new ArrayIterator(items), collection, collectionName); - } - - /** - * Add the specified items to the specified bound collection - * and fire the appropriate event if necessary. - * Return whether collection changed. - * @see Collection#addAll(Collection) - */ - public boolean addItemsToCollection(Collection items, Collection collection, String collectionName) { - return ( ! items.isEmpty()) - && this.addItemsToCollection_(items.iterator(), collection, collectionName); - } - - /** - * Add the specified items to the specified bound collection - * and fire the appropriate event if necessary. - * Return whether collection changed. - * @see Collection#addAll(Collection) - */ - public boolean addItemsToCollection(Iterable items, Collection collection, String collectionName) { - return this.addItemsToCollection(items.iterator(), collection, collectionName); - } - - /** - * Add the specified items to the specified bound collection - * and fire the appropriate event if necessary. - * Return whether collection changed. - * @see Collection#addAll(Collection) - */ - public boolean addItemsToCollection(Iterator items, Collection collection, String collectionName) { - return items.hasNext() - && this.addItemsToCollection_(items, collection, collectionName); - } - - /** - * no empty check - */ - protected boolean addItemsToCollection_(Iterator items, Collection collection, String collectionName) { - Collection addedItems = null; - while (items.hasNext()) { - E item = items.next(); - if (collection.add(item)) { - if (addedItems == null) { - addedItems = new ArrayList(); - } - addedItems.add(item); - } - } - if (addedItems != null) { - this.fireItemsAdded_(collectionName, addedItems); - return true; - } - return false; - } - - /** - * Remove the specified item from the specified bound collection - * and fire the appropriate event if necessary. - * Return whether the collection changed. - * @see Collection#remove(Object) - */ - public boolean removeItemFromCollection(Object item, Collection collection, String collectionName) { - if (collection.remove(item)) { - this.fireItemRemoved(collectionName, item); - return true; - } - return false; - } - - /** - * Remove the specified items from the specified bound collection - * and fire the appropriate event if necessary. - * Return whether the collection changed. - * @see Collection#removeAll(Collection) - */ - public boolean removeItemsFromCollection(Object[] items, Collection collection, String collectionName) { - return (items.length != 0) - && ( ! collection.isEmpty()) - && this.removeItemsFromCollection_(new ArrayIterator(items), collection, collectionName); - } - - /** - * Remove the specified items from the specified bound collection - * and fire the appropriate event if necessary. - * Return whether the collection changed. - * @see Collection#removeAll(Collection) - */ - public boolean removeItemsFromCollection(Collection items, Collection collection, String collectionName) { - return ( ! items.isEmpty()) - && ( ! collection.isEmpty()) - && this.removeItemsFromCollection_(items.iterator(), collection, collectionName); - } - - /** - * Remove the specified items from the specified bound collection - * and fire the appropriate event if necessary. - * Return whether the collection changed. - * @see Collection#removeAll(Collection) - */ - public boolean removeItemsFromCollection(Iterable items, Collection collection, String collectionName) { - return this.removeItemsFromCollection(items.iterator(), collection, collectionName); - } - - /** - * Remove the specified items from the specified bound collection - * and fire the appropriate event if necessary. - * Return whether the collection changed. - * @see Collection#removeAll(Collection) - */ - public boolean removeItemsFromCollection(Iterator items, Collection collection, String collectionName) { - return items.hasNext() - && ( ! collection.isEmpty()) - && this.removeItemsFromCollection_(items, collection, collectionName); - } - - /** - * no empty checks - */ - protected boolean removeItemsFromCollection_(Iterator items, Collection collection, String collectionName) { - HashBag removedItems = CollectionTools.collection(items); - removedItems.retainAll(collection); - boolean changed = collection.removeAll(removedItems); - - if ( ! removedItems.isEmpty()) { - this.fireItemsRemoved_(collectionName, removedItems); - } - return changed; - } - - /** - * Retain the specified items in the specified bound collection - * and fire the appropriate event if necessary. - * Return whether the collection changed. - * @see Collection#retainAll(Collection) - */ - public boolean retainItemsInCollection(Object[] items, Collection collection, String collectionName) { - if (collection.isEmpty()) { - return false; - } - if (items.length == 0) { - return this.clearCollection_(collection, collectionName); - } - return this.retainItemsInCollection_(new ArrayIterator(items), collection, collectionName); - } - - /** - * Retain the specified items in the specified bound collection - * and fire the appropriate event if necessary. - * Return whether the collection changed. - * @see Collection#retainAll(Collection) - */ - public boolean retainItemsInCollection(Collection items, Collection collection, String collectionName) { - if (collection.isEmpty()) { - return false; - } - if (items.isEmpty()) { - return this.clearCollection_(collection, collectionName); - } - return this.retainItemsInCollection_(items.iterator(), collection, collectionName); - } - - /** - * Retain the specified items in the specified bound collection - * and fire the appropriate event if necessary. - * Return whether the collection changed. - * @see Collection#retainAll(Collection) - */ - public boolean retainItemsInCollection(Iterable items, Collection collection, String collectionName) { - return this.retainItemsInCollection(items.iterator(), collection, collectionName); - } - - /** - * Retain the specified items in the specified bound collection - * and fire the appropriate event if necessary. - * Return whether the collection changed. - * @see Collection#retainAll(Collection) - */ - public boolean retainItemsInCollection(Iterator items, Collection collection, String collectionName) { - if (collection.isEmpty()) { - return false; - } - if ( ! items.hasNext()) { - return this.clearCollection_(collection, collectionName); - } - return this.retainItemsInCollection_(items, collection, collectionName); - } - - /** - * no empty checks - */ - protected boolean retainItemsInCollection_(Iterator items, Collection collection, String collectionName) { - HashBag retainedItems = CollectionTools.collection(items); - HashBag removedItems = CollectionTools.collection(collection); - removedItems.removeAll(retainedItems); - boolean changed = collection.retainAll(retainedItems); - - if ( ! removedItems.isEmpty()) { - this.fireItemsRemoved_(collectionName, removedItems); - } - return changed; - } - - /** - * Clear the entire collection - * and fire the appropriate event if necessary. - * Return whether the collection changed. - * @see Collection#clear() - */ - public boolean clearCollection(Collection collection, String collectionName) { - if (collection.isEmpty()) { - return false; - } - return this.clearCollection_(collection, collectionName); - } - - /** - * no empty check - */ - protected boolean clearCollection_(Collection collection, String collectionName) { - collection.clear(); - this.fireCollectionCleared(collectionName); - return true; - } - - /** - * Synchronize the collection with the specified new collection, - * making a minimum number of removes and adds. - * Return whether the collection changed. - */ - public boolean synchronizeCollection(Collection newCollection, Collection collection, String collectionName) { - if (newCollection.isEmpty()) { - return this.clearCollection(collection, collectionName); - } - - if (collection.isEmpty()) { - return this.addItemsToCollection_(newCollection.iterator(), collection, collectionName); - } - - return this.synchronizeCollection_(newCollection, collection, collectionName); - } - - /** - * Synchronize the collection with the specified new collection, - * making a minimum number of removes and adds. - * Return whether the collection changed. - */ - public boolean synchronizeCollection(Iterable newCollection, Collection collection, String collectionName) { - return this.synchronizeCollection(newCollection.iterator(), collection, collectionName); - } - - /** - * Synchronize the collection with the specified new collection, - * making a minimum number of removes and adds. - * Return whether the collection changed. - */ - public boolean synchronizeCollection(Iterator newCollection, Collection collection, String collectionName) { - if ( ! newCollection.hasNext()) { - return this.clearCollection(collection, collectionName); - } - - if (collection.isEmpty()) { - return this.addItemsToCollection_(newCollection, collection, collectionName); - } - - return this.synchronizeCollection_(CollectionTools.collection(newCollection), collection, collectionName); - } - - /** - * no empty checks - */ - protected boolean synchronizeCollection_(Collection newCollection, Collection collection, String collectionName) { - boolean changed = false; - Collection removeItems = new HashBag(collection); - removeItems.removeAll(newCollection); - changed |= this.removeItemsFromCollection(removeItems, collection, collectionName); - - Collection addItems = new HashBag(newCollection); - addItems.removeAll(collection); - changed |= this.addItemsToCollection(addItems, collection, collectionName); - - return changed; - } - - - // ********** list change support ********** - - protected static final Class LIST_CHANGE_LISTENER_CLASS = ListChangeListener.class; - - /** - * Add a list change listener for the specified list. The listener - * will be notified only for changes to the specified list. - */ - public void addListChangeListener(String listName, ListChangeListener listener) { - this.addListener(LIST_CHANGE_LISTENER_CLASS, listName, listener); - } - - /** - * Remove a list change listener that was registered for a specific list. - */ - public void removeListChangeListener(String listName, ListChangeListener listener) { - this.removeListener(LIST_CHANGE_LISTENER_CLASS, listName, listener); - } - - /** - * Return whether there are any list change listeners that will - * be notified when the specified list has changed. - */ - public boolean hasAnyListChangeListeners(String listName) { - return this.hasAnyListeners(LIST_CHANGE_LISTENER_CLASS, listName); - } - - private ListenerList getListChangeListenerList(String listName) { - return this.getListenerList(LIST_CHANGE_LISTENER_CLASS, listName); - } - - private Iterable getListChangeListeners(String listName) { - ListenerList listenerList = this.getListChangeListenerList(listName); - return (listenerList == null) ? null : listenerList.getListeners(); - } - - private boolean hasListChangeListener(String listName, ListChangeListener listener) { - return CollectionTools.contains(this.getListChangeListeners(listName), listener); - } - - /** - * Report a bound list update to any registered listeners. - * Return whether there are any added items. - */ - public boolean fireItemsAdded(ListAddEvent event) { - if (event.getItemsSize() != 0) { - this.fireItemsAdded_(event); - return true; - } - return false; - } - - /** - * pre-condition: the specified event contains items - */ - protected void fireItemsAdded_(ListAddEvent event) { - String listName = event.getListName(); - Iterable listeners = this.getListChangeListeners(listName); - if (listeners != null) { - for (ListChangeListener listener : listeners) { - if (this.hasListChangeListener(listName, listener)) { // verify listener is still listening - listener.itemsAdded(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - changeListener.itemsAdded(event); - } - } - } - } - - /** - * Report a bound list update to any registered listeners. - * Return whether there are any added items. - */ - public boolean fireItemsAdded(String listName, int index, List addedItems) { -// return this.fireItemsAdded(new ListAddEvent(this.source, listName, index, addedItems)); - if ( ! addedItems.isEmpty()) { - this.fireItemsAdded_(listName, index, addedItems); - return true; - } - return false; - } - - /** - * pre-condition: 'addedItems' is not empty - */ - protected void fireItemsAdded_(String listName, int index, List addedItems) { - ListAddEvent event = null; - Iterable listeners = this.getListChangeListeners(listName); - if (listeners != null) { - for (ListChangeListener listener : listeners) { - if (this.hasListChangeListener(listName, listener)) { // verify listener is still listening - if (event == null) { - event = new ListAddEvent(this.source, listName, index, addedItems); - } - listener.itemsAdded(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new ListAddEvent(this.source, listName, index, addedItems); - } - changeListener.itemsAdded(event); - } - } - } - } - - /** - * Report a bound list update to any registered listeners. - */ - public void fireItemAdded(String listName, int index, Object addedItem) { -// this.fireItemsAdded(listName, index, Collections.singletonList(addedItem)); - - ListAddEvent event = null; - Iterable listeners = this.getListChangeListeners(listName); - if (listeners != null) { - for (ListChangeListener listener : listeners) { - if (this.hasListChangeListener(listName, listener)) { // verify listener is still listening - if (event == null) { - event = new ListAddEvent(this.source, listName, index, addedItem); - } - listener.itemsAdded(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new ListAddEvent(this.source, listName, index, addedItem); - } - changeListener.itemsAdded(event); - } - } - } - } - - /** - * Report a bound list update to any registered listeners. - * Return whether there are any removed items. - */ - public boolean fireItemsRemoved(ListRemoveEvent event) { - if (event.getItemsSize() != 0) { - this.fireItemsRemoved_(event); - return true; - } - return false; - } - - /** - * pre-condition: the specified event contains items - */ - protected void fireItemsRemoved_(ListRemoveEvent event) { - String listName = event.getListName(); - Iterable listeners = this.getListChangeListeners(listName); - if (listeners != null) { - for (ListChangeListener listener : listeners) { - if (this.hasListChangeListener(listName, listener)) { // verify listener is still listening - listener.itemsRemoved(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - changeListener.itemsRemoved(event); - } - } - } - } - - /** - * Report a bound list update to any registered listeners. - * Return whether there are any removed items. - */ - public boolean fireItemsRemoved(String listName, int index, List removedItems) { -// return this.fireItemsRemoved(new ListRemoveEvent(this.source, listName, index, removedItems)); - if ( ! removedItems.isEmpty()) { - this.fireItemsRemoved_(listName, index, removedItems); - return true; - } - return false; - } - - /** - * pre-condition: 'removedItems' is not empty - */ - protected void fireItemsRemoved_(String listName, int index, List removedItems) { - ListRemoveEvent event = null; - Iterable listeners = this.getListChangeListeners(listName); - if (listeners != null) { - for (ListChangeListener listener : listeners) { - if (this.hasListChangeListener(listName, listener)) { // verify listener is still listening - if (event == null) { - event = new ListRemoveEvent(this.source, listName, index, removedItems); - } - listener.itemsRemoved(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new ListRemoveEvent(this.source, listName, index, removedItems); - } - changeListener.itemsRemoved(event); - } - } - } - } - - /** - * Report a bound list update to any registered listeners. - */ - public void fireItemRemoved(String listName, int index, Object removedItem) { -// this.fireItemsRemoved(listName, index, Collections.singletonList(removedItem)); - - ListRemoveEvent event = null; - Iterable listeners = this.getListChangeListeners(listName); - if (listeners != null) { - for (ListChangeListener listener : listeners) { - if (this.hasListChangeListener(listName, listener)) { // verify listener is still listening - if (event == null) { - event = new ListRemoveEvent(this.source, listName, index, removedItem); - } - listener.itemsRemoved(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new ListRemoveEvent(this.source, listName, index, removedItem); - } - changeListener.itemsRemoved(event); - } - } - } - } - - /** - * Report a bound list update to any registered listeners. - * Return whether there are any replaced items. - */ - public boolean fireItemsReplaced(ListReplaceEvent event) { - if ((event.getItemsSize() != 0) && this.elementsAreDifferent(event.getNewItems(), event.getOldItems())) { - this.fireItemsReplaced_(event); - return true; - } - return false; - } - - /** - * pre-condition: the specified event contains new items - */ - protected void fireItemsReplaced_(ListReplaceEvent event) { - String listName = event.getListName(); - Iterable listeners = this.getListChangeListeners(listName); - if (listeners != null) { - for (ListChangeListener listener : listeners) { - if (this.hasListChangeListener(listName, listener)) { // verify listener is still listening - listener.itemsReplaced(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - changeListener.itemsReplaced(event); - } - } - } - } - - /** - * Report a bound list update to any registered listeners. - * Return whether there are any replaced items. - */ - public boolean fireItemsReplaced(String listName, int index, List newItems, List oldItems) { -// return this.fireItemsReplaced(new ListReplaceEvent(this.source, listName, index, newItems, oldItems)); - if (( ! newItems.isEmpty()) && this.elementsAreDifferent(newItems, oldItems)) { - this.fireItemsReplaced_(listName, index, newItems, oldItems); - return true; - } - return false; - } - - /** - * pre-condition: 'newItems' is not empty and unequal to 'oldItems' - */ - protected void fireItemsReplaced_(String listName, int index, List newItems, List oldItems) { - ListReplaceEvent event = null; - Iterable listeners = this.getListChangeListeners(listName); - if (listeners != null) { - for (ListChangeListener listener : listeners) { - if (this.hasListChangeListener(listName, listener)) { // verify listener is still listening - if (event == null) { - event = new ListReplaceEvent(this.source, listName, index, newItems, oldItems); - } - listener.itemsReplaced(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new ListReplaceEvent(this.source, listName, index, newItems, oldItems); - } - changeListener.itemsReplaced(event); - } - } - } - } - - /** - * Report a bound list update to any registered listeners. - * Return whether the item changed. - */ - public boolean fireItemReplaced(String listName, int index, Object newItem, Object oldItem) { -// return this.fireItemsReplaced(listName, index, Collections.singletonList(newItem), Collections.singletonList(oldItem)); - if (this.valuesAreDifferent(newItem, oldItem)) { - this.fireItemReplaced_(listName, index, newItem, oldItem); - return true; - } - return false; - } - - /** - * pre-condition: the specified old and new items are different - */ - protected void fireItemReplaced_(String listName, int index, Object newItem, Object oldItem) { - ListReplaceEvent event = null; - Iterable listeners = this.getListChangeListeners(listName); - if (listeners != null) { - for (ListChangeListener listener : listeners) { - if (this.hasListChangeListener(listName, listener)) { // verify listener is still listening - if (event == null) { - event = new ListReplaceEvent(this.source, listName, index, newItem, oldItem); - } - listener.itemsReplaced(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new ListReplaceEvent(this.source, listName, index, newItem, oldItem); - } - changeListener.itemsReplaced(event); - } - } - } - } - - /** - * Report a bound list update to any registered listeners. - * Return whether there are any moved items. - */ - // it's unlikely but possible the list is unchanged by the move... - // e.g. any moves within ["foo", "foo", "foo"] - public boolean fireItemsMoved(ListMoveEvent event) { - if (event.getTargetIndex() != event.getSourceIndex()) { - this.fireItemsMoved_(event); - return true; - } - return false; - } - - /** - * pre-condition: the specified event indicates a move - */ - protected void fireItemsMoved_(ListMoveEvent event) { - String listName = event.getListName(); - Iterable listeners = this.getListChangeListeners(listName); - if (listeners != null) { - for (ListChangeListener listener : listeners) { - if (this.hasListChangeListener(listName, listener)) { // verify listener is still listening - listener.itemsMoved(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - changeListener.itemsMoved(event); - } - } - } - } - - /** - * Report a bound list update to any registered listeners. - * Return whether there are any moved items. - */ - // it's unlikely but possible the list is unchanged by the move... - // e.g. any moves within ["foo", "foo", "foo"] - public boolean fireItemsMoved(String listName, int targetIndex, int sourceIndex, int length) { -// return this.fireItemsMoved(new ListMoveEvent(this.source, listName, targetIndex, sourceIndex, length)); - if (targetIndex != sourceIndex) { - this.fireItemsMoved_(listName, targetIndex, sourceIndex, length); - return true; - } - return false; - } - - /** - * pre-condition: the specified indices indicate a move - */ - protected void fireItemsMoved_(String listName, int targetIndex, int sourceIndex, int length) { - ListMoveEvent event = null; - Iterable listeners = this.getListChangeListeners(listName); - if (listeners != null) { - for (ListChangeListener listener : listeners) { - if (this.hasListChangeListener(listName, listener)) { // verify listener is still listening - if (event == null) { - event = new ListMoveEvent(this.source, listName, targetIndex, sourceIndex, length); - } - listener.itemsMoved(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new ListMoveEvent(this.source, listName, targetIndex, sourceIndex, length); - } - changeListener.itemsMoved(event); - } - } - } - } - - /** - * Report a bound list update to any registered listeners. - * Return whether there are any moved items. - */ - // it's unlikely but possible the list is unchanged by the move... - // e.g. any moves within ["foo", "foo", "foo"] - public boolean fireItemMoved(String listName, int targetIndex, int sourceIndex) { - if (targetIndex != sourceIndex) { - this.fireItemMoved_(listName, targetIndex, sourceIndex); - return true; - } - return false; - } - - /** - * pre-condition: the specified indices indicate a move - */ - protected void fireItemMoved_(String listName, int targetIndex, int sourceIndex) { - this.fireItemsMoved_(listName, targetIndex, sourceIndex, 1); - } - - /** - * Report a bound list update to any registered listeners. - */ - public void fireListCleared(ListClearEvent event) { - String listName = event.getListName(); - Iterable listeners = this.getListChangeListeners(listName); - if (listeners != null) { - for (ListChangeListener listener : listeners) { - if (this.hasListChangeListener(listName, listener)) { // verify listener is still listening - listener.listCleared(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - changeListener.listCleared(event); - } - } - } - } - - /** - * Report a bound list update to any registered listeners. - */ - public void fireListCleared(String listName) { -// this.fireListCleared(new ListClearEvent(this.source, listName)); - - ListClearEvent event = null; - Iterable listeners = this.getListChangeListeners(listName); - if (listeners != null) { - for (ListChangeListener listener : listeners) { - if (this.hasListChangeListener(listName, listener)) { // verify listener is still listening - if (event == null) { - event = new ListClearEvent(this.source, listName); - } - listener.listCleared(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new ListClearEvent(this.source, listName); - } - changeListener.listCleared(event); - } - } - } - } - - /** - * Report a bound list update to any registered listeners. - */ - public void fireListChanged(ListChangeEvent event) { - String listName = event.getListName(); - Iterable listeners = this.getListChangeListeners(listName); - if (listeners != null) { - for (ListChangeListener listener : listeners) { - if (this.hasListChangeListener(listName, listener)) { // verify listener is still listening - listener.listChanged(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - changeListener.listChanged(event); - } - } - } - } - - /** - * Report a bound list update to any registered listeners. - */ - public void fireListChanged(String listName, List list) { -// this.fireListChanged(new ListChangeEvent(this.source, listName)); - - ListChangeEvent event = null; - Iterable listeners = this.getListChangeListeners(listName); - if (listeners != null) { - for (ListChangeListener listener : listeners) { - if (this.hasListChangeListener(listName, listener)) { // verify listener is still listening - if (event == null) { - event = new ListChangeEvent(this.source, listName, list); - } - listener.listChanged(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new ListChangeEvent(this.source, listName, list); - } - changeListener.listChanged(event); - } - } - } - } - - /** - * Add the specified item to the specified bound list at the specified index - * and fire the appropriate event. - * @see List#add(int, Object) - */ - public void addItemToList(int index, E item, List list, String listName) { - list.add(index, item); - this.fireItemAdded(listName, index, item); - } - - /** - * Add the specified item to the end of the specified bound list - * and fire the appropriate event. - * Return whether the list changed (i.e. 'true'). - * @see List#add(Object) - */ - public boolean addItemToList(E item, List list, String listName) { - if (list.add(item)) { - this.fireItemAdded(listName, list.size() - 1, item); - return true; - } - return false; // List#add(Object) should always return 'true', so we should never get here... - } - - /** - * Add the specified items to the specified bound list at the specified index - * and fire the appropriate event if necessary. - * Return whether the list changed. - * @see List#addAll(int, Collection) - */ - public boolean addItemsToList(int index, E[] items, List list, String listName) { - return (items.length != 0) - && this.addItemsToList_(index, Arrays.asList(items), list, listName); - } - - /** - * Add the specified items to the specified bound list at the specified index - * and fire the appropriate event if necessary. - * Return whether the list changed. - * @see List#addAll(int, Collection) - */ - public boolean addItemsToList(int index, Collection items, List list, String listName) { - return ( ! items.isEmpty()) - && this.addItemsToList_(index, this.convertToList(items), list, listName); - } - - /** - * no empty check - */ - protected boolean addItemsToList_(int index, List items, List list, String listName) { - if (list.addAll(index, items)) { - this.fireItemsAdded(listName, index, items); - return true; - } - return false; // 'items' should not be empty, so we should never get here... - } - - /** - * Add the specified items to the specified bound list - * and fire the appropriate event if necessary. - * Return whether the list changed. - * @see List#addAll(int, Collection) - */ - public boolean addItemsToList(int index, Iterable items, List list, String listName) { - return this.addItemsToList(index, items.iterator(), list, listName); - } - - /** - * Add the specified items to the specified bound list - * and fire the appropriate event if necessary. - * Return whether the list changed. - * @see List#addAll(int, Collection) - */ - public boolean addItemsToList(int index, Iterator items, List list, String listName) { - if ( ! items.hasNext()) { - return false; - } - - ArrayList addedItems = CollectionTools.list(items); - if (list.addAll(index, addedItems)) { - this.fireItemsAdded(listName, index, addedItems); - return true; - } - return false; // 'items' should not be empty, so we should never get here... - } - - /** - * Add the specified items to the end of to the specified bound list - * and fire the appropriate event if necessary. - * Return whether the list changed. - * @see List#addAll(Collection) - */ - public boolean addItemsToList(E[] items, List list, String listName) { - return (items.length != 0) - && this.addItemsToList_(Arrays.asList(items), list, listName); - } - - /** - * Add the specified items to the end of the specified bound list - * and fire the appropriate event if necessary. - * Return whether the list changed. - * @see List#addAll(int, Collection) - */ - public boolean addItemsToList(Collection items, List list, String listName) { - return ( ! items.isEmpty()) - && this.addItemsToList_(this.convertToList(items), list, listName); - } - - protected List convertToList(Collection collection) { - return (collection instanceof List) ? (List) collection : new ArrayList(collection); - } - - /** - * no empty check - */ - protected boolean addItemsToList_(List items, List list, String listName) { - int index = list.size(); - if (list.addAll(items)) { - this.fireItemsAdded(listName, index, items); - return true; - } - return false; // 'items' should not be empty, so we should never get here... - } - - /** - * Add the specified items to the end of to the specified bound list - * and fire the appropriate event if necessary. - * Return whether the list changed. - * @see List#addAll(Collection) - */ - public boolean addItemsToList(Iterable items, List list, String listName) { - return this.addItemsToList(items.iterator(), list, listName); - } - - /** - * Add the specified items to the end of to the specified bound list - * and fire the appropriate event if necessary. - * Return whether the list changed. - * @see List#addAll(Collection) - */ - public boolean addItemsToList(Iterator items, List list, String listName) { - if ( ! items.hasNext()) { - return false; - } - return this.addItemsToList_(items, list, listName); - } - - /** - * no empty check - */ - protected boolean addItemsToList_(Iterator items, List list, String listName) { - ArrayList addedItems = CollectionTools.list(items); - int index = list.size(); - if (list.addAll(addedItems)) { - this.fireItemsAdded(listName, index, addedItems); - return true; - } - return false; // 'items' should not be empty, so we should never get here... - } - - /** - * Remove the specified item from the specified bound list - * and fire the appropriate event if necessary. - * Return the removed item. - * @see List#remove(int) - */ - public E removeItemFromList(int index, List list, String listName) { - E item = list.remove(index); - this.fireItemRemoved(listName, index, item); - return item; - } - - /** - * Remove the specified item from the specified bound list - * and fire the appropriate event if necessary. - * Return whether the list changed. - * @see List#remove(Object) - */ - public boolean removeItemFromList(Object item, List list, String listName) { - int index = list.indexOf(item); - if (index == -1) { - return false; - } - list.remove(index); - this.fireItemRemoved(listName, index, item); - return true; - } - - /** - * Remove the items from the specified index to the end of the list - * from the specified bound list - * and fire the appropriate event if necessary. - * Return the removed items. - * @see List#remove(int) - */ - public List removeItemsFromList(int index, List list, String listName) { - return this.removeRangeFromList(index, list.size(), list, listName); - } - - /** - * Remove the specified items from the specified bound list - * and fire the appropriate event if necessary. - * Return the removed items. - * @see List#remove(int) - */ - public List removeItemsFromList(int index, int length, List list, String listName) { - return this.removeRangeFromList(index, index + length, list, listName); - } - - /** - * Remove the specified items from the specified bound list - * and fire the appropriate event if necessary. The begin index - * is inclusive, while the end index is exclusive. - * Return the removed items. - * @see List#remove(int) - * @see List#subList(int, int) - */ - public List removeRangeFromList(int beginIndex, int endIndex, List list, String listName) { - if (beginIndex == endIndex) { - return Collections.emptyList(); - } - return this.removeRangeFromList_(beginIndex, endIndex, list, listName); - } - - /** - * no empty check - */ - protected List removeRangeFromList_(int beginIndex, int endIndex, List list, String listName) { - List subList = list.subList(beginIndex, endIndex); - List removedItems = new ArrayList(subList); - subList.clear(); - this.fireItemsRemoved(listName, beginIndex, removedItems); - return removedItems; - } - - /** - * Remove the specified items from the specified bound list - * and fire the appropriate event(s) if necessary. - * Return whether the list changed. - * @see List#removeAll(Collection) - */ - public boolean removeItemsFromList(Object[] items, List list, String listName) { - return (items.length != 0) - && ( ! list.isEmpty()) - && this.removeItemsFromList_(new ArrayIterator(items), list, listName); - } - - /** - * Remove the specified items from the specified bound list - * and fire the appropriate event(s) if necessary. - * Return whether the list changed. - * @see List#removeAll(Collection) - */ - public boolean removeItemsFromList(Collection items, List list, String listName) { - return ( ! items.isEmpty()) - && ( ! list.isEmpty()) - && this.removeItemsFromList_(items.iterator(), list, listName); - } - - /** - * Remove the specified items from the specified bound list - * and fire the appropriate event(s) if necessary. - * Return whether the list changed. - * @see List#removeAll(Collection) - */ - public boolean removeItemsFromList(Iterable items, List list, String listName) { - return this.removeItemsFromList(items.iterator(), list, listName); - } - - /** - * Remove the specified items from the specified bound list - * and fire the appropriate event(s) if necessary. - * Return whether the list changed. - * @see List#removeAll(Collection) - */ - public boolean removeItemsFromList(Iterator items, List list, String listName) { - return (items.hasNext()) - && ( ! list.isEmpty()) - && this.removeItemsFromList_(items, list, listName); - } - - /** - * no empty checks - */ - protected boolean removeItemsFromList_(Iterator items, List list, String listName) { - boolean changed = false; - while (items.hasNext()) { - changed |= this.removeItemFromList(items.next(), list, listName); - } - return changed; - } - - /** - * Retain the specified items in the specified bound list - * and fire the appropriate event(s) if necessary. - * Return whether the list changed. - * @see List#retainAll(Collection) - */ - public boolean retainItemsInList(Object[] items, List list, String listName) { - if (list.isEmpty()) { - return false; - } - if (items.length == 0) { - return this.clearList_(list, listName); - } - return this.retainItemsInList_(new ArrayIterator(items), list, listName); - } - - /** - * Retain the specified items in the specified bound list - * and fire the appropriate event(s) if necessary. - * Return whether the list changed. - * @see List#retainAll(Collection) - */ - public boolean retainItemsInList(Collection items, List list, String listName) { - if (list.isEmpty()) { - return false; - } - if (items.isEmpty()) { - return this.clearList_(list, listName); - } - return this.retainItemsInList_(items.iterator(), list, listName); - } - - /** - * Retain the specified items in the specified bound list - * and fire the appropriate event(s) if necessary. - * Return whether the list changed. - * @see List#retainAll(Collection) - */ - public boolean retainItemsInList(Iterable items, List list, String listName) { - return this.retainItemsInList(items.iterator(), list, listName); - } - - /** - * Retain the specified items in the specified bound list - * and fire the appropriate event(s) if necessary. - * Return whether the list changed. - * @see List#retainAll(Collection) - */ - public boolean retainItemsInList(Iterator items, List list, String listName) { - if (list.isEmpty()) { - return false; - } - if ( ! items.hasNext()) { - return this.clearList_(list, listName); - } - return this.retainItemsInList_(items, list, listName); - } - - /** - * no empty checks - */ - protected boolean retainItemsInList_(Iterator items, List list, String listName) { - HashBag retainedItems = CollectionTools.collection(items); - HashBag removedItems = CollectionTools.collection(list); - removedItems.removeAll(retainedItems); - return this.removeItemsFromList(removedItems, list, listName); - } - - /** - * Set the specified item in the specified bound list - * and fire the appropriate event if necessary. - * Return the replaced item. - * @see List#set(int, Object) - */ - public E setItemInList(int index, E item, List list, String listName) { - E oldItem = list.set(index, item); - this.fireItemReplaced(listName, index, item, oldItem); - return oldItem; - } - - /** - * Replace the first occurrence of the specified item - * in the specified bound list - * and fire the appropriate event if necessary. - * Return the index of the replaced item. - * Return -1 if the item was not found in the list. - * @see List#set(int, Object) - */ - public int replaceItemInList(E oldItem, E newItem, List list, String listName) { - if (list.isEmpty()) { - return -1; - } - - int index = list.indexOf(oldItem); - if ((index != -1) && this.valuesAreDifferent(oldItem, newItem)) { - list.set(index, newItem); - this.fireItemReplaced_(listName, index, newItem, oldItem); - } - return index; - } - - /** - * Set the specified items in the specified bound list - * and fire the appropriate event if necessary. - * Return the replaced items. - * @see List#set(int, Object) - */ - public List setItemsInList(int index, E[] items, List list, String listName) { - if (items.length == 0) { - return Collections.emptyList(); - } - return this.setItemsInList_(index, Arrays.asList(items), list, listName); - } - - /** - * Set the specified items in the specified bound list - * and fire the appropriate event if necessary. - * Return the replaced items. - * @see List#set(int, Object) - */ - public List setItemsInList(int index, List items, List list, String listName) { - if (items.isEmpty()) { - return Collections.emptyList(); - } - return this.setItemsInList_(index, items, list, listName); - } - - /** - * no empty check - */ - protected List setItemsInList_(int index, List items, List list, String listName) { - List subList = list.subList(index, index + items.size()); - List oldItems = new ArrayList(subList); - for (int i = 0; i < items.size(); i++) { - E newItem = items.get(i); - E oldItem = subList.set(i, newItem); - this.fireItemReplaced(listName, index + i, newItem, oldItem); - } - return oldItems; - } - - /** - * Move items in the specified list from the specified source index to the - * specified target index for the specified length. - * Return whether the list changed. - */ - public boolean moveItemsInList(int targetIndex, int sourceIndex, int length, List list, String listName) { - if ((targetIndex == sourceIndex) || (length == 0)) { - return false; - } - // it's unlikely but possible the list is unchanged by the move... (e.g. any moves within ["foo", "foo", "foo"]...) - CollectionTools.move(list, targetIndex, sourceIndex, length); - this.fireItemsMoved(listName, targetIndex, sourceIndex, length); - return true; - } - - /** - * Move the specified item in the specified list to the - * specified target index. - * Return whether the list changed. - */ - public boolean moveItemInList(int targetIndex, E item, List list, String listName) { - return this.moveItemInList(targetIndex, list.indexOf(item), list, listName); - } - - /** - * Move an item in the specified list from the specified source index to the - * specified target index. - * Return whether the list changed. - */ - public boolean moveItemInList(int targetIndex, int sourceIndex, List list, String listName) { - if (targetIndex == sourceIndex) { - return false; - } - if (this.valuesAreEqual(list.get(targetIndex), list.get(sourceIndex))) { - return false; - } - CollectionTools.move(list, targetIndex, sourceIndex); - this.fireItemMoved_(listName, targetIndex, sourceIndex); - return true; - } - - /** - * Clear the entire list - * and fire the appropriate event if necessary. - * Return whether the list changed. - * @see List#clear() - */ - public boolean clearList(List list, String listName) { - return ( ! list.isEmpty()) && this.clearList_(list, listName); - } - - /** - * no empty check - */ - protected boolean clearList_(List list, String listName) { - list.clear(); - this.fireListCleared(listName); - return true; - } - - /** - * Synchronize the list with the specified new list, - * making a minimum number of sets, removes, and/or adds. - * Return whether the list changed. - */ - public boolean synchronizeList(List newList, List list, String listName) { - if (newList.isEmpty()) { - return this.clearList(list, listName); - } - if (list.isEmpty()) { - return this.addItemsToList_(newList, list, listName); - } - return this.synchronizeList_(newList, list, listName); - } - - /** - * Synchronize the list with the specified new list, - * making a minimum number of sets, removes, and/or adds. - * Return whether the list changed. - */ - public boolean synchronizeList(Iterable newList, List list, String listName) { - return this.synchronizeList(newList.iterator(), list, listName); - } - - /** - * Synchronize the list with the specified new list, - * making a minimum number of sets, removes, and/or adds. - * Return whether the list changed. - */ - public boolean synchronizeList(Iterator newList, List list, String listName) { - if ( ! newList.hasNext()) { - return this.clearList(list, listName); - } - if (list.isEmpty()) { - return this.addItemsToList_(newList, list, listName); - } - return this.synchronizeList_(CollectionTools.list(newList), list, listName); - } - - /** - * no empty checks - */ - protected boolean synchronizeList_(List newList, List oldList, String listName) { - int newSize = newList.size(); - int oldSize = oldList.size(); - - boolean changed = false; - // TODO check for RandomAccess - int min = Math.min(newSize, oldSize); - for (int i = 0; i < min; i++) { - E newItem = newList.get(i); - E oldItem = oldList.set(i, newItem); - if (this.valuesAreDifferent(newItem, oldItem)) { - changed = true; - this.fireItemReplaced_(listName, i, newItem, oldItem); - } - } - - if (newSize == oldSize) { - return changed; - } - - if (newSize < oldSize) { - this.removeRangeFromList_(newSize, oldSize, oldList, listName); - return true; - } - - // newSize > oldSize - this.addItemsToList_(newList.subList(oldSize, newSize), oldList, listName); - return true; - } - - - // ********** tree change support ********** - - protected static final Class TREE_CHANGE_LISTENER_CLASS = TreeChangeListener.class; - - /** - * Add a tree change listener for the specified tree. The listener - * will be notified only for changes to the specified tree. - */ - public void addTreeChangeListener(String treeName, TreeChangeListener listener) { - this.addListener(TREE_CHANGE_LISTENER_CLASS, treeName, listener); - } - - /** - * Remove a tree change listener that was registered for a specific tree. - */ - public void removeTreeChangeListener(String treeName, TreeChangeListener listener) { - this.removeListener(TREE_CHANGE_LISTENER_CLASS, treeName, listener); - } - - /** - * Return whether there are any tree change listeners that will - * be notified when the specified tree has changed. - */ - public boolean hasAnyTreeChangeListeners(String treeName) { - return this.hasAnyListeners(TREE_CHANGE_LISTENER_CLASS, treeName); - } - - private ListenerList getTreeChangeListenerList(String treeName) { - return this.getListenerList(TREE_CHANGE_LISTENER_CLASS, treeName); - } - - private Iterable getTreeChangeListeners(String treeName) { - ListenerList listenerList = this.getTreeChangeListenerList(treeName); - return (listenerList == null) ? null : listenerList.getListeners(); - } - - private boolean hasTreeChangeListener(String treeName, TreeChangeListener listener) { - return CollectionTools.contains(this.getTreeChangeListeners(treeName), listener); - } - - /** - * Report a bound tree update to any registered listeners. - */ - public void fireNodeAdded(TreeAddEvent event) { - String treeName = event.getTreeName(); - Iterable listeners = this.getTreeChangeListeners(treeName); - if (listeners != null) { - for (TreeChangeListener listener : listeners) { - if (this.hasTreeChangeListener(treeName, listener)) { // verify listener is still listening - listener.nodeAdded(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - changeListener.nodeAdded(event); - } - } - } - } - - /** - * Report a bound tree update to any registered listeners. - */ - public void fireNodeAdded(String treeName, List path) { -// this.fireNodeAdded(new TreeAddEvent(this.source, treeName, path)); - TreeAddEvent event = null; - Iterable listeners = this.getTreeChangeListeners(treeName); - if (listeners != null) { - for (TreeChangeListener listener : listeners) { - if (this.hasTreeChangeListener(treeName, listener)) { // verify listener is still listening - if (event == null) { - event = new TreeAddEvent(this.source, treeName, path); - } - listener.nodeAdded(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new TreeAddEvent(this.source, treeName, path); - } - changeListener.nodeAdded(event); - } - } - } - } - - /** - * Report a bound tree update to any registered listeners. - */ - public void fireNodeRemoved(TreeRemoveEvent event) { - String treeName = event.getTreeName(); - Iterable listeners = this.getTreeChangeListeners(treeName); - if (listeners != null) { - for (TreeChangeListener listener : listeners) { - if (this.hasTreeChangeListener(treeName, listener)) { // verify listener is still listening - listener.nodeRemoved(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - changeListener.nodeRemoved(event); - } - } - } - } - - /** - * Report a bound tree update to any registered listeners. - */ - public void fireNodeRemoved(String treeName, List path) { -// this.fireNodeRemoved(new TreeRemoveEvent(this.source, treeName, path)); - - TreeRemoveEvent event = null; - Iterable listeners = this.getTreeChangeListeners(treeName); - if (listeners != null) { - for (TreeChangeListener listener : listeners) { - if (this.hasTreeChangeListener(treeName, listener)) { // verify listener is still listening - if (event == null) { - event = new TreeRemoveEvent(this.source, treeName, path); - } - listener.nodeRemoved(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new TreeRemoveEvent(this.source, treeName, path); - } - changeListener.nodeRemoved(event); - } - } - } - } - - /** - * Report a bound tree update to any registered listeners. - */ - public void fireTreeCleared(TreeClearEvent event) { - String treeName = event.getTreeName(); - Iterable listeners = this.getTreeChangeListeners(treeName); - if (listeners != null) { - for (TreeChangeListener listener : listeners) { - if (this.hasTreeChangeListener(treeName, listener)) { // verify listener is still listening - listener.treeCleared(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - changeListener.treeCleared(event); - } - } - } - } - - /** - * Report a bound tree update to any registered listeners. - */ - public void fireTreeCleared(String treeName) { -// this.fireTreeCleared(new TreeClearEvent(this.source, treeName)); - - TreeClearEvent event = null; - Iterable listeners = this.getTreeChangeListeners(treeName); - if (listeners != null) { - for (TreeChangeListener listener : listeners) { - if (this.hasTreeChangeListener(treeName, listener)) { // verify listener is still listening - if (event == null) { - event = new TreeClearEvent(this.source, treeName); - } - listener.treeCleared(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new TreeClearEvent(this.source, treeName); - } - changeListener.treeCleared(event); - } - } - } - } - - /** - * Report a bound tree update to any registered listeners. - */ - public void fireTreeChanged(TreeChangeEvent event) { - String treeName = event.getTreeName(); - Iterable listeners = this.getTreeChangeListeners(treeName); - if (listeners != null) { - for (TreeChangeListener listener : listeners) { - if (this.hasTreeChangeListener(treeName, listener)) { // verify listener is still listening - listener.treeChanged(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - changeListener.treeChanged(event); - } - } - } - } - - /** - * Report a bound tree update to any registered listeners. - */ - public void fireTreeChanged(String treeName, Collection nodes) { -// this.fireTreeChanged(new TreeChangeEvent(this.source, treeName, nodes)); - - TreeChangeEvent event = null; - Iterable listeners = this.getTreeChangeListeners(treeName); - if (listeners != null) { - for (TreeChangeListener listener : listeners) { - if (this.hasTreeChangeListener(treeName, listener)) { // verify listener is still listening - if (event == null) { - event = new TreeChangeEvent(this.source, treeName, nodes); - } - listener.treeChanged(event); - } - } - } - - Iterable changeListeners = this.getChangeListeners(); - if (changeListeners != null) { - for (ChangeListener changeListener : changeListeners) { - if (this.hasChangeListener(changeListener)) { // verify listener is still listening - if (event == null) { - event = new TreeChangeEvent(this.source, treeName, nodes); - } - changeListener.treeChanged(event); - } - } - } - } - - - // ********** misc ********** - - /** - * Convenience method for checking whether an attribute value has changed. - * @see Tools#valuesAreEqual(Object, Object) - */ - public boolean valuesAreEqual(Object value1, Object value2) { - return Tools.valuesAreEqual(value1, value2); - } - - /** - * Convenience method for checking whether an attribute value has changed. - * @see Tools#valuesAreDifferent(Object, Object) - */ - public boolean valuesAreDifferent(Object value1, Object value2) { - return Tools.valuesAreDifferent(value1, value2); - } - - /** - * @see CollectionTools#elementsAreEqual(Iterable, Iterable) - */ - public boolean elementsAreEqual(Iterable iterable1, Iterable iterable2) { - return CollectionTools.elementsAreEqual(iterable1, iterable2); - } - - /** - * @see CollectionTools#elementsAreDifferent(Iterable, Iterable) - */ - public boolean elementsAreDifferent(Iterable iterable1, Iterable iterable2) { - return CollectionTools.elementsAreDifferent(iterable1, iterable2); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.source); - } - - - // ********** member classes ********** - - /** - * Pair a possibly null aspect name with its associated - * listeners. - */ - static abstract class AspectListenerListPair - implements Serializable - { - final ListenerList listenerList; - - private static final long serialVersionUID = 1L; - - AspectListenerListPair(Class listenerClass, L listener) { - super(); - this.listenerList = new ListenerList(listenerClass, listener); - } - - boolean matches(Class listenerClass, @SuppressWarnings("unused") String aspectName) { - return this.listenerList.getListenerType() == listenerClass; - } - - boolean matches(Class listenerClass) { - return this.matches(listenerClass, null); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.getAspectName()); - } - - abstract String getAspectName(); - } - - /** - * Pair a non-null aspect name with its associated listeners. - */ - static class SimpleAspectListenerListPair - extends AspectListenerListPair - { - final String aspectName; - - private static final long serialVersionUID = 1L; - - SimpleAspectListenerListPair(Class listenerClass, String aspectName, L listener) { - super(listenerClass, listener); - if (aspectName == null) { - throw new NullPointerException(); - } - this.aspectName = aspectName; - } - - @Override - boolean matches(Class listenerClass, @SuppressWarnings("hiding") String aspectName) { - return this.aspectName.equals(aspectName) - && super.matches(listenerClass, aspectName); - } - - @Override - String getAspectName() { - return this.aspectName; - } - } - - /** - * Pair a null aspect name with its associated listeners. - */ - static class NullAspectListenerListPair - extends AspectListenerListPair - { - private static final long serialVersionUID = 1L; - - NullAspectListenerListPair(Class listenerClass, L listener) { - super(listenerClass, listener); - } - - @Override - boolean matches(Class listenerClass, String aspectName) { - return (aspectName == null) - && super.matches(listenerClass, null); - } - - @Override - String getAspectName() { - return null; - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/SingleAspectChangeSupport.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/SingleAspectChangeSupport.java deleted file mode 100644 index ef13a67927..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/SingleAspectChangeSupport.java +++ /dev/null @@ -1,380 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model; - -import java.util.Collection; -import java.util.EventListener; -import java.util.List; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; - -/** - * This change support class changes the behavior of the standard - * change support in several ways:
    - *
  • All events fired by the source must specify the single aspect. - *
  • Listeners are required to be either "general purpose" listeners or - * listeners of the single aspect. - *
- */ -public class SingleAspectChangeSupport - extends ChangeSupport -{ - protected final Class validListenerClass; - protected final String validAspectName; - - private static final long serialVersionUID = 1L; - - - // ********** constructor ********** - - public SingleAspectChangeSupport(Model source, Class validListenerClass, String validAspectName) { - super(source); - if ( ! validListenerClass.isAssignableFrom(this.getChangeListenerClass())) { - throw new IllegalArgumentException("The change support's change listener class (" + this.getChangeListenerClass().getName() + //$NON-NLS-1$ - ") does not extend the valid listener class: " + validListenerClass.getName()); //$NON-NLS-1$ - } - this.validListenerClass = validListenerClass; - this.validAspectName = validAspectName; - } - - - // ********** internal implementation ********** - - private UnsupportedOperationException buildUnsupportedOperationException() { - return new UnsupportedOperationException( - "This Model supports only changes for the listener type \"" + this.validListenerClass.getName() //$NON-NLS-1$ - + "\" and the aspect \"" + this.validAspectName + '"' //$NON-NLS-1$ - ); - } - - /** - * The listener can be either an instance of the valid listener class or - * the "general-purpose" change listener class (which should extend the - * the valid listener class). - */ - private void check(Class listenerClass) { - if ((listenerClass != this.getChangeListenerClass()) && (listenerClass != this.validListenerClass)) { - throw new IllegalArgumentException( - "This Model supports only changes for the listener type \"" + this.validListenerClass.getName() //$NON-NLS-1$ - + "\" : \"" + listenerClass.getName() + '"' //$NON-NLS-1$ - ); - } - } - - private void check(Class listenerClass, String aspectName) { - this.check(listenerClass); - if ( ! aspectName.equals(this.validAspectName)) { - throw new IllegalArgumentException( - "This Model supports only changes for the aspect \"" + this.validAspectName //$NON-NLS-1$ - + "\" : \"" + aspectName + '"' //$NON-NLS-1$ - ); - } - } - - @Override - protected synchronized void addListener(Class listenerClass, String aspectName, L listener) { - this.check(listenerClass, aspectName); - super.addListener(listenerClass, aspectName, listener); - } - - @Override - protected synchronized void addListener(Class listenerClass, L listener) { - this.check(listenerClass); - super.addListener(listenerClass, listener); - } - - @Override - protected synchronized void removeListener(Class listenerClass, String aspectName, L listener) { - this.check(listenerClass, aspectName); - super.removeListener(listenerClass, aspectName, listener); - } - - @Override - protected synchronized void removeListener(Class listenerClass, L listener) { - this.check(listenerClass); - super.removeListener(listenerClass, listener); - } - - @Override - protected boolean hasAnyListeners(Class listenerClass, String aspectName) { - this.check(listenerClass, aspectName); - return super.hasAnyListeners(listenerClass, aspectName); - } - - @Override - protected boolean hasAnyListeners(Class listenerClass) { - this.check(listenerClass); - return super.hasAnyListeners(listenerClass); - } - - - // ********** state change support ********** - - @Override - public void fireStateChanged(StateChangeEvent event) { - throw this.buildUnsupportedOperationException(); - } - - @Override - public void fireStateChanged() { - throw this.buildUnsupportedOperationException(); - } - - - // ********** property change support ********** - - @Override - public boolean firePropertyChanged(PropertyChangeEvent event) { - this.check(PROPERTY_CHANGE_LISTENER_CLASS, event.getPropertyName()); - return super.firePropertyChanged(event); - } - - @Override - public boolean firePropertyChanged(String propertyName, Object oldValue, Object newValue) { - this.check(PROPERTY_CHANGE_LISTENER_CLASS, propertyName); - return super.firePropertyChanged(propertyName, oldValue, newValue); - } - - @Override - public boolean firePropertyChanged(String propertyName, int oldValue, int newValue) { - this.check(PROPERTY_CHANGE_LISTENER_CLASS, propertyName); - return super.firePropertyChanged(propertyName, oldValue, newValue); - } - - @Override - public boolean firePropertyChanged(String propertyName, boolean oldValue, boolean newValue) { - this.check(PROPERTY_CHANGE_LISTENER_CLASS, propertyName); - return super.firePropertyChanged(propertyName, oldValue, newValue); - } - - - // ********** collection change support ********** - - @Override - public boolean fireItemsAdded(CollectionAddEvent event) { - this.check(COLLECTION_CHANGE_LISTENER_CLASS, event.getCollectionName()); - return super.fireItemsAdded(event); - } - - @Override - public boolean fireItemsAdded(String collectionName, Collection addedItems) { - this.check(COLLECTION_CHANGE_LISTENER_CLASS, collectionName); - return super.fireItemsAdded(collectionName, addedItems); - } - - @Override - public void fireItemAdded(String collectionName, Object addedItem) { - this.check(COLLECTION_CHANGE_LISTENER_CLASS, collectionName); - super.fireItemAdded(collectionName, addedItem); - } - - @Override - public boolean fireItemsRemoved(CollectionRemoveEvent event) { - this.check(COLLECTION_CHANGE_LISTENER_CLASS, event.getCollectionName()); - return super.fireItemsRemoved(event); - } - - @Override - public boolean fireItemsRemoved(String collectionName, Collection removedItems) { - this.check(COLLECTION_CHANGE_LISTENER_CLASS, collectionName); - return super.fireItemsRemoved(collectionName, removedItems); - } - - @Override - public void fireItemRemoved(String collectionName, Object removedItem) { - this.check(COLLECTION_CHANGE_LISTENER_CLASS, collectionName); - super.fireItemRemoved(collectionName, removedItem); - } - - @Override - public void fireCollectionCleared(CollectionClearEvent event) { - this.check(COLLECTION_CHANGE_LISTENER_CLASS, event.getCollectionName()); - super.fireCollectionCleared(event); - } - - @Override - public void fireCollectionCleared(String collectionName) { - this.check(COLLECTION_CHANGE_LISTENER_CLASS, collectionName); - super.fireCollectionCleared(collectionName); - } - - @Override - public void fireCollectionChanged(CollectionChangeEvent event) { - this.check(COLLECTION_CHANGE_LISTENER_CLASS, event.getCollectionName()); - super.fireCollectionChanged(event); - } - - @Override - public void fireCollectionChanged(String collectionName, Collection collection) { - this.check(COLLECTION_CHANGE_LISTENER_CLASS, collectionName); - super.fireCollectionChanged(collectionName, collection); - } - - - // ********** list change support ********** - - @Override - public boolean fireItemsAdded(ListAddEvent event) { - this.check(LIST_CHANGE_LISTENER_CLASS, event.getListName()); - return super.fireItemsAdded(event); - } - - @Override - public boolean fireItemsAdded(String listName, int index, List addedItems) { - this.check(LIST_CHANGE_LISTENER_CLASS, listName); - return super.fireItemsAdded(listName, index, addedItems); - } - - @Override - public void fireItemAdded(String listName, int index, Object addedItem) { - this.check(LIST_CHANGE_LISTENER_CLASS, listName); - super.fireItemAdded(listName, index, addedItem); - } - - @Override - public boolean fireItemsRemoved(ListRemoveEvent event) { - this.check(LIST_CHANGE_LISTENER_CLASS, event.getListName()); - return super.fireItemsRemoved(event); - } - - @Override - public boolean fireItemsRemoved(String listName, int index, List removedItems) { - this.check(LIST_CHANGE_LISTENER_CLASS, listName); - return super.fireItemsRemoved(listName, index, removedItems); - } - - @Override - public void fireItemRemoved(String listName, int index, Object removedItem) { - this.check(LIST_CHANGE_LISTENER_CLASS, listName); - super.fireItemRemoved(listName, index, removedItem); - } - - @Override - public boolean fireItemsReplaced(ListReplaceEvent event) { - this.check(LIST_CHANGE_LISTENER_CLASS, event.getListName()); - return super.fireItemsReplaced(event); - } - - @Override - public boolean fireItemsReplaced(String listName, int index, List newItems, List replacedItems) { - this.check(LIST_CHANGE_LISTENER_CLASS, listName); - return super.fireItemsReplaced(listName, index, newItems, replacedItems); - } - - @Override - public boolean fireItemReplaced(String listName, int index, Object newItem, Object replacedItem) { - this.check(LIST_CHANGE_LISTENER_CLASS, listName); - return super.fireItemReplaced(listName, index, newItem, replacedItem); - } - - @Override - public boolean fireItemsMoved(ListMoveEvent event) { - this.check(LIST_CHANGE_LISTENER_CLASS, event.getListName()); - return super.fireItemsMoved(event); - } - - @Override - public boolean fireItemsMoved(String listName, int targetIndex, int sourceIndex, int length) { - this.check(LIST_CHANGE_LISTENER_CLASS, listName); - return super.fireItemsMoved(listName, targetIndex, sourceIndex, length); - } - - @Override - public void fireListCleared(ListClearEvent event) { - this.check(LIST_CHANGE_LISTENER_CLASS, event.getListName()); - super.fireListCleared(event); - } - - @Override - public void fireListCleared(String listName) { - this.check(LIST_CHANGE_LISTENER_CLASS, listName); - super.fireListCleared(listName); - } - - @Override - public void fireListChanged(ListChangeEvent event) { - this.check(LIST_CHANGE_LISTENER_CLASS, event.getListName()); - super.fireListChanged(event); - } - - @Override - public void fireListChanged(String listName, List list) { - this.check(LIST_CHANGE_LISTENER_CLASS, listName); - super.fireListChanged(listName, list); - } - - - // ********** tree change support ********** - - @Override - public void fireNodeAdded(TreeAddEvent event) { - this.check(TREE_CHANGE_LISTENER_CLASS, event.getTreeName()); - super.fireNodeAdded(event); - } - - @Override - public void fireNodeAdded(String treeName, List path) { - this.check(TREE_CHANGE_LISTENER_CLASS, treeName); - super.fireNodeAdded(treeName, path); - } - - @Override - public void fireNodeRemoved(TreeRemoveEvent event) { - this.check(TREE_CHANGE_LISTENER_CLASS, event.getTreeName()); - super.fireNodeRemoved(event); - } - - @Override - public void fireNodeRemoved(String treeName, List path) { - this.check(TREE_CHANGE_LISTENER_CLASS, treeName); - super.fireNodeRemoved(treeName, path); - } - - @Override - public void fireTreeCleared(TreeClearEvent event) { - this.check(TREE_CHANGE_LISTENER_CLASS, event.getTreeName()); - super.fireTreeCleared(event); - } - - @Override - public void fireTreeCleared(String treeName) { - this.check(TREE_CHANGE_LISTENER_CLASS, treeName); - super.fireTreeCleared(treeName); - } - - @Override - public void fireTreeChanged(TreeChangeEvent event) { - this.check(TREE_CHANGE_LISTENER_CLASS, event.getTreeName()); - super.fireTreeChanged(event); - } - - @Override - public void fireTreeChanged(String treeName, Collection nodes) { - this.check(TREE_CHANGE_LISTENER_CLASS, treeName); - super.fireTreeChanged(treeName, nodes); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTChangeListenerWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTChangeListenerWrapper.java deleted file mode 100644 index 5f16ea4650..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTChangeListenerWrapper.java +++ /dev/null @@ -1,454 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.listener.awt; - -import java.awt.EventQueue; - -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; - -/** - * Wrap another change listener and forward events to it on the AWT - * event queue, asynchronously if necessary. If the event arrived on the UI - * thread that is probably because it was initiated by a UI widget; as a - * result, we want to loop back synchronously so the events can be - * short-circuited. - */ -public final class AWTChangeListenerWrapper - implements ChangeListener -{ - private final ChangeListener listener; - - - public AWTChangeListenerWrapper(ChangeListener listener) { - super(); - if (listener == null) { - throw new NullPointerException(); - } - this.listener = listener; - } - - public void stateChanged(StateChangeEvent event) { - if (this.isExecutingOnUIThread()) { - this.stateChanged_(event); - } else { - this.executeOnEventQueue(this.buildStateChangedRunnable(event)); - } - } - - public void propertyChanged(PropertyChangeEvent event) { - if (this.isExecutingOnUIThread()) { - this.propertyChanged_(event); - } else { - this.executeOnEventQueue(this.buildPropertyChangedRunnable(event)); - } - } - - public void itemsAdded(CollectionAddEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsAdded_(event); - } else { - this.executeOnEventQueue(this.buildItemsAddedRunnable(event)); - } - } - - public void itemsRemoved(CollectionRemoveEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsRemoved_(event); - } else { - this.executeOnEventQueue(this.buildItemsRemovedRunnable(event)); - } - } - - public void collectionCleared(CollectionClearEvent event) { - if (this.isExecutingOnUIThread()) { - this.collectionCleared_(event); - } else { - this.executeOnEventQueue(this.buildCollectionClearedRunnable(event)); - } - } - - public void collectionChanged(CollectionChangeEvent event) { - if (this.isExecutingOnUIThread()) { - this.collectionChanged_(event); - } else { - this.executeOnEventQueue(this.buildCollectionChangedRunnable(event)); - } - } - - public void itemsAdded(ListAddEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsAdded_(event); - } else { - this.executeOnEventQueue(this.buildItemsAddedRunnable(event)); - } - } - - public void itemsRemoved(ListRemoveEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsRemoved_(event); - } else { - this.executeOnEventQueue(this.buildItemsRemovedRunnable(event)); - } - } - - public void itemsMoved(ListMoveEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsMoved_(event); - } else { - this.executeOnEventQueue(this.buildItemsMovedRunnable(event)); - } - } - - public void itemsReplaced(ListReplaceEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsReplaced_(event); - } else { - this.executeOnEventQueue(this.buildItemsReplacedRunnable(event)); - } - } - - public void listCleared(ListClearEvent event) { - if (this.isExecutingOnUIThread()) { - this.listCleared_(event); - } else { - this.executeOnEventQueue(this.buildListClearedRunnable(event)); - } - } - - public void listChanged(ListChangeEvent event) { - if (this.isExecutingOnUIThread()) { - this.listChanged_(event); - } else { - this.executeOnEventQueue(this.buildListChangedRunnable(event)); - } - } - - public void nodeAdded(TreeAddEvent event) { - if (this.isExecutingOnUIThread()) { - this.nodeAdded_(event); - } else { - this.executeOnEventQueue(this.buildNodeAddedRunnable(event)); - } - } - - public void nodeRemoved(TreeRemoveEvent event) { - if (this.isExecutingOnUIThread()) { - this.nodeRemoved_(event); - } else { - this.executeOnEventQueue(this.buildNodeRemovedRunnable(event)); - } - } - - public void treeCleared(TreeClearEvent event) { - if (this.isExecutingOnUIThread()) { - this.treeCleared_(event); - } else { - this.executeOnEventQueue(this.buildTreeClearedRunnable(event)); - } - } - - public void treeChanged(TreeChangeEvent event) { - if (this.isExecutingOnUIThread()) { - this.treeChanged_(event); - } else { - this.executeOnEventQueue(this.buildTreeChangedRunnable(event)); - } - } - - private Runnable buildStateChangedRunnable(final StateChangeEvent event) { - return new Runnable() { - public void run() { - AWTChangeListenerWrapper.this.stateChanged_(event); - } - }; - } - - private Runnable buildPropertyChangedRunnable(final PropertyChangeEvent event) { - return new Runnable() { - public void run() { - AWTChangeListenerWrapper.this.propertyChanged_(event); - } - }; - } - - private Runnable buildItemsAddedRunnable(final CollectionAddEvent event) { - return new Runnable() { - public void run() { - AWTChangeListenerWrapper.this.itemsAdded_(event); - } - @Override - public String toString() { - return "items added runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildItemsRemovedRunnable(final CollectionRemoveEvent event) { - return new Runnable() { - public void run() { - AWTChangeListenerWrapper.this.itemsRemoved_(event); - } - @Override - public String toString() { - return "items removed runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildCollectionClearedRunnable(final CollectionClearEvent event) { - return new Runnable() { - public void run() { - AWTChangeListenerWrapper.this.collectionCleared_(event); - } - @Override - public String toString() { - return "collection cleared runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildCollectionChangedRunnable(final CollectionChangeEvent event) { - return new Runnable() { - public void run() { - AWTChangeListenerWrapper.this.collectionChanged_(event); - } - @Override - public String toString() { - return "collection changed runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildItemsAddedRunnable(final ListAddEvent event) { - return new Runnable() { - public void run() { - AWTChangeListenerWrapper.this.itemsAdded_(event); - } - @Override - public String toString() { - return "items added runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildItemsRemovedRunnable(final ListRemoveEvent event) { - return new Runnable() { - public void run() { - AWTChangeListenerWrapper.this.itemsRemoved_(event); - } - @Override - public String toString() { - return "items removed runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildItemsMovedRunnable(final ListMoveEvent event) { - return new Runnable() { - public void run() { - AWTChangeListenerWrapper.this.itemsMoved_(event); - } - @Override - public String toString() { - return "items moved runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildItemsReplacedRunnable(final ListReplaceEvent event) { - return new Runnable() { - public void run() { - AWTChangeListenerWrapper.this.itemsReplaced_(event); - } - @Override - public String toString() { - return "items replaced runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildListClearedRunnable(final ListClearEvent event) { - return new Runnable() { - public void run() { - AWTChangeListenerWrapper.this.listCleared_(event); - } - @Override - public String toString() { - return "list cleared runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildListChangedRunnable(final ListChangeEvent event) { - return new Runnable() { - public void run() { - AWTChangeListenerWrapper.this.listChanged_(event); - } - @Override - public String toString() { - return "list changed runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildNodeAddedRunnable(final TreeAddEvent event) { - return new Runnable() { - public void run() { - AWTChangeListenerWrapper.this.nodeAdded_(event); - } - @Override - public String toString() { - return "node added runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildNodeRemovedRunnable(final TreeRemoveEvent event) { - return new Runnable() { - public void run() { - AWTChangeListenerWrapper.this.nodeRemoved_(event); - } - @Override - public String toString() { - return "node removed runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildTreeClearedRunnable(final TreeClearEvent event) { - return new Runnable() { - public void run() { - AWTChangeListenerWrapper.this.treeCleared_(event); - } - @Override - public String toString() { - return "tree cleared runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildTreeChangedRunnable(final TreeChangeEvent event) { - return new Runnable() { - public void run() { - AWTChangeListenerWrapper.this.treeChanged_(event); - } - @Override - public String toString() { - return "tree changed runnable"; //$NON-NLS-1$ - } - }; - } - - private boolean isExecutingOnUIThread() { - return EventQueue.isDispatchThread(); - } - - /** - * {@link EventQueue#invokeLater(Runnable)} seems to work OK; - * but using {@link EventQueue#invokeAndWait(Runnable)} can sometimes make - * things more predictable when debugging, at the risk of deadlocks. - */ - private void executeOnEventQueue(Runnable r) { - EventQueue.invokeLater(r); -// try { -// EventQueue.invokeAndWait(r); -// } catch (InterruptedException ex) { -// throw new RuntimeException(ex); -// } catch (java.lang.reflect.InvocationTargetException ex) { -// throw new RuntimeException(ex); -// } - } - - void stateChanged_(StateChangeEvent event) { - this.listener.stateChanged(event); - } - - void propertyChanged_(PropertyChangeEvent event) { - this.listener.propertyChanged(event); - } - - void itemsAdded_(CollectionAddEvent event) { - this.listener.itemsAdded(event); - } - - void itemsRemoved_(CollectionRemoveEvent event) { - this.listener.itemsRemoved(event); - } - - void collectionCleared_(CollectionClearEvent event) { - this.listener.collectionCleared(event); - } - - void collectionChanged_(CollectionChangeEvent event) { - this.listener.collectionChanged(event); - } - - void itemsAdded_(ListAddEvent event) { - this.listener.itemsAdded(event); - } - - void itemsRemoved_(ListRemoveEvent event) { - this.listener.itemsRemoved(event); - } - - void itemsMoved_(ListMoveEvent event) { - this.listener.itemsMoved(event); - } - - void itemsReplaced_(ListReplaceEvent event) { - this.listener.itemsReplaced(event); - } - - void listCleared_(ListClearEvent event) { - this.listener.listCleared(event); - } - - void listChanged_(ListChangeEvent event) { - this.listener.listChanged(event); - } - - void nodeAdded_(TreeAddEvent event) { - this.listener.nodeAdded(event); - } - - void nodeRemoved_(TreeRemoveEvent event) { - this.listener.nodeRemoved(event); - } - - void treeCleared_(TreeClearEvent event) { - this.listener.treeCleared(event); - } - - void treeChanged_(TreeChangeEvent event) { - this.listener.treeChanged(event); - } - - @Override - public String toString() { - return "AWT(" + this.listener.toString() + ')'; //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTCollectionChangeListenerWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTCollectionChangeListenerWrapper.java deleted file mode 100644 index b8af52a34e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTCollectionChangeListenerWrapper.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.listener.awt; - -import java.awt.EventQueue; - -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; - -/** - * Wrap another collection change listener and forward events to it on the AWT - * event queue, asynchronously if necessary. If the event arrived on the UI - * thread that is probably because it was initiated by a UI widget; as a - * result, we want to loop back synchronously so the events can be - * short-circuited. - */ -public final class AWTCollectionChangeListenerWrapper - implements CollectionChangeListener -{ - private final CollectionChangeListener listener; - - public AWTCollectionChangeListenerWrapper(CollectionChangeListener listener) { - super(); - if (listener == null) { - throw new NullPointerException(); - } - this.listener = listener; - } - - public void itemsAdded(CollectionAddEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsAdded_(event); - } else { - this.executeOnEventQueue(this.buildItemsAddedRunnable(event)); - } - } - - public void itemsRemoved(CollectionRemoveEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsRemoved_(event); - } else { - this.executeOnEventQueue(this.buildItemsRemovedRunnable(event)); - } - } - - public void collectionCleared(CollectionClearEvent event) { - if (this.isExecutingOnUIThread()) { - this.collectionCleared_(event); - } else { - this.executeOnEventQueue(this.buildCollectionClearedRunnable(event)); - } - } - - public void collectionChanged(CollectionChangeEvent event) { - if (this.isExecutingOnUIThread()) { - this.collectionChanged_(event); - } else { - this.executeOnEventQueue(this.buildCollectionChangedRunnable(event)); - } - } - - private Runnable buildItemsAddedRunnable(final CollectionAddEvent event) { - return new Runnable() { - public void run() { - AWTCollectionChangeListenerWrapper.this.itemsAdded_(event); - } - @Override - public String toString() { - return "items added runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildItemsRemovedRunnable(final CollectionRemoveEvent event) { - return new Runnable() { - public void run() { - AWTCollectionChangeListenerWrapper.this.itemsRemoved_(event); - } - @Override - public String toString() { - return "items removed runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildCollectionClearedRunnable(final CollectionClearEvent event) { - return new Runnable() { - public void run() { - AWTCollectionChangeListenerWrapper.this.collectionCleared_(event); - } - @Override - public String toString() { - return "collection cleared runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildCollectionChangedRunnable(final CollectionChangeEvent event) { - return new Runnable() { - public void run() { - AWTCollectionChangeListenerWrapper.this.collectionChanged_(event); - } - @Override - public String toString() { - return "collection changed runnable"; //$NON-NLS-1$ - } - }; - } - - private boolean isExecutingOnUIThread() { - return EventQueue.isDispatchThread(); - } - - /** - * {@link EventQueue#invokeLater(Runnable)} seems to work OK; - * but using {@link EventQueue#invokeAndWait(Runnable)} can sometimes make - * things more predictable when debugging, at the risk of deadlocks. - */ - private void executeOnEventQueue(Runnable r) { - EventQueue.invokeLater(r); -// try { -// EventQueue.invokeAndWait(r); -// } catch (InterruptedException ex) { -// throw new RuntimeException(ex); -// } catch (java.lang.reflect.InvocationTargetException ex) { -// throw new RuntimeException(ex); -// } - } - - void itemsAdded_(CollectionAddEvent event) { - this.listener.itemsAdded(event); - } - - void itemsRemoved_(CollectionRemoveEvent event) { - this.listener.itemsRemoved(event); - } - - void collectionCleared_(CollectionClearEvent event) { - this.listener.collectionCleared(event); - } - - void collectionChanged_(CollectionChangeEvent event) { - this.listener.collectionChanged(event); - } - - @Override - public String toString() { - return "AWT(" + this.listener.toString() + ')'; //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTListChangeListenerWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTListChangeListenerWrapper.java deleted file mode 100644 index bc477f4f7a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTListChangeListenerWrapper.java +++ /dev/null @@ -1,211 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.listener.awt; - -import java.awt.EventQueue; - -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; - -/** - * Wrap another list change listener and forward events to it on the AWT - * event queue, asynchronously if necessary. If the event arrived on the UI - * thread that is probably because it was initiated by a UI widget; as a - * result, we want to loop back synchronously so the events can be - * short-circuited. - */ -public final class AWTListChangeListenerWrapper - implements ListChangeListener -{ - private final ListChangeListener listener; - - public AWTListChangeListenerWrapper(ListChangeListener listener) { - super(); - if (listener == null) { - throw new NullPointerException(); - } - this.listener = listener; - } - - public void itemsAdded(ListAddEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsAdded_(event); - } else { - this.executeOnEventQueue(this.buildItemsAddedRunnable(event)); - } - } - - public void itemsRemoved(ListRemoveEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsRemoved_(event); - } else { - this.executeOnEventQueue(this.buildItemsRemovedRunnable(event)); - } - } - - public void itemsMoved(ListMoveEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsMoved_(event); - } else { - this.executeOnEventQueue(this.buildItemsMovedRunnable(event)); - } - } - - public void itemsReplaced(ListReplaceEvent event) { - if (this.isExecutingOnUIThread()) { - this.itemsReplaced_(event); - } else { - this.executeOnEventQueue(this.buildItemsReplacedRunnable(event)); - } - } - - public void listCleared(ListClearEvent event) { - if (this.isExecutingOnUIThread()) { - this.listCleared_(event); - } else { - this.executeOnEventQueue(this.buildListClearedRunnable(event)); - } - } - - public void listChanged(ListChangeEvent event) { - if (this.isExecutingOnUIThread()) { - this.listChanged_(event); - } else { - this.executeOnEventQueue(this.buildListChangedRunnable(event)); - } - } - - private Runnable buildItemsAddedRunnable(final ListAddEvent event) { - return new Runnable() { - public void run() { - AWTListChangeListenerWrapper.this.itemsAdded_(event); - } - @Override - public String toString() { - return "items added runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildItemsRemovedRunnable(final ListRemoveEvent event) { - return new Runnable() { - public void run() { - AWTListChangeListenerWrapper.this.itemsRemoved_(event); - } - @Override - public String toString() { - return "items removed runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildItemsMovedRunnable(final ListMoveEvent event) { - return new Runnable() { - public void run() { - AWTListChangeListenerWrapper.this.itemsMoved_(event); - } - @Override - public String toString() { - return "items moved runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildItemsReplacedRunnable(final ListReplaceEvent event) { - return new Runnable() { - public void run() { - AWTListChangeListenerWrapper.this.itemsReplaced_(event); - } - @Override - public String toString() { - return "items replaced runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildListClearedRunnable(final ListClearEvent event) { - return new Runnable() { - public void run() { - AWTListChangeListenerWrapper.this.listCleared_(event); - } - @Override - public String toString() { - return "list cleared runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildListChangedRunnable(final ListChangeEvent event) { - return new Runnable() { - public void run() { - AWTListChangeListenerWrapper.this.listChanged_(event); - } - @Override - public String toString() { - return "list changed runnable"; //$NON-NLS-1$ - } - }; - } - - private boolean isExecutingOnUIThread() { - return EventQueue.isDispatchThread(); - } - - /** - * {@link EventQueue#invokeLater(Runnable)} seems to work OK; - * but using {@link EventQueue#invokeAndWait(Runnable)} can sometimes make - * things more predictable when debugging, at the risk of deadlocks. - */ - private void executeOnEventQueue(Runnable r) { - EventQueue.invokeLater(r); -// try { -// EventQueue.invokeAndWait(r); -// } catch (InterruptedException ex) { -// throw new RuntimeException(ex); -// } catch (java.lang.reflect.InvocationTargetException ex) { -// throw new RuntimeException(ex); -// } - } - - void itemsAdded_(ListAddEvent event) { - this.listener.itemsAdded(event); - } - - void itemsRemoved_(ListRemoveEvent event) { - this.listener.itemsRemoved(event); - } - - void itemsMoved_(ListMoveEvent event) { - this.listener.itemsMoved(event); - } - - void itemsReplaced_(ListReplaceEvent event) { - this.listener.itemsReplaced(event); - } - - void listCleared_(ListClearEvent event) { - this.listener.listCleared(event); - } - - void listChanged_(ListChangeEvent event) { - this.listener.listChanged(event); - } - - @Override - public String toString() { - return "AWT(" + this.listener.toString() + ')'; //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTPropertyChangeListenerWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTPropertyChangeListenerWrapper.java deleted file mode 100644 index a46bd8bc64..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTPropertyChangeListenerWrapper.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.listener.awt; - -import java.awt.EventQueue; - -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; - -/** - * Wrap another property change listener and forward events to it on the AWT - * event queue, asynchronously if necessary. If the event arrived on the UI - * thread that is probably because it was initiated by a UI widget; as a - * result, we want to loop back synchronously so the events can be - * short-circuited. - */ -public final class AWTPropertyChangeListenerWrapper - implements PropertyChangeListener -{ - private final PropertyChangeListener listener; - - - public AWTPropertyChangeListenerWrapper(PropertyChangeListener listener) { - super(); - if (listener == null) { - throw new NullPointerException(); - } - this.listener = listener; - } - - public void propertyChanged(PropertyChangeEvent event) { - if (this.isExecutingOnUIThread()) { - this.propertyChanged_(event); - } else { - this.executeOnEventQueue(this.buildPropertyChangedRunnable(event)); - } - } - - private Runnable buildPropertyChangedRunnable(final PropertyChangeEvent event) { - return new Runnable() { - public void run() { - AWTPropertyChangeListenerWrapper.this.propertyChanged_(event); - } - @Override - public String toString() { - return "property changed runnable"; //$NON-NLS-1$ - } - }; - } - - private boolean isExecutingOnUIThread() { - return EventQueue.isDispatchThread(); - } - - /** - * {@link EventQueue#invokeLater(Runnable)} seems to work OK; - * but using {@link EventQueue#invokeAndWait(Runnable)} can sometimes make - * things more predictable when debugging, at the risk of deadlocks. - */ - private void executeOnEventQueue(Runnable r) { - EventQueue.invokeLater(r); -// try { -// EventQueue.invokeAndWait(r); -// } catch (InterruptedException ex) { -// throw new RuntimeException(ex); -// } catch (java.lang.reflect.InvocationTargetException ex) { -// throw new RuntimeException(ex); -// } - } - - void propertyChanged_(PropertyChangeEvent event) { - this.listener.propertyChanged(event); - } - - @Override - public String toString() { - return "AWT(" + this.listener.toString() + ')'; //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTStateChangeListenerWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTStateChangeListenerWrapper.java deleted file mode 100644 index c1ecf2b2ee..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTStateChangeListenerWrapper.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.listener.awt; - -import java.awt.EventQueue; - -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; - -/** - * Wrap another state change listener and forward events to it on the AWT - * event queue, asynchronously if necessary. If the event arrived on the UI - * thread that is probably because it was initiated by a UI widget; as a - * result, we want to loop back synchronously so the events can be - * short-circuited. - */ -public final class AWTStateChangeListenerWrapper - implements StateChangeListener -{ - private final StateChangeListener listener; - - public AWTStateChangeListenerWrapper(StateChangeListener listener) { - super(); - if (listener == null) { - throw new NullPointerException(); - } - this.listener = listener; - } - - public void stateChanged(StateChangeEvent event) { - if (this.isExecutingOnUIThread()) { - this.stateChanged_(event); - } else { - this.executeOnEventQueue(this.buildStateChangedRunnable(event)); - } - } - - private Runnable buildStateChangedRunnable(final StateChangeEvent event) { - return new Runnable() { - public void run() { - AWTStateChangeListenerWrapper.this.stateChanged_(event); - } - @Override - public String toString() { - return "state changed runnable"; //$NON-NLS-1$ - } - }; - } - - private boolean isExecutingOnUIThread() { - return EventQueue.isDispatchThread(); - } - - /** - * {@link EventQueue#invokeLater(Runnable)} seems to work OK; - * but using {@link EventQueue#invokeAndWait(Runnable)} can sometimes make - * things more predictable when debugging, at the risk of deadlocks. - */ - private void executeOnEventQueue(Runnable r) { - EventQueue.invokeLater(r); -// try { -// EventQueue.invokeAndWait(r); -// } catch (InterruptedException ex) { -// throw new RuntimeException(ex); -// } catch (java.lang.reflect.InvocationTargetException ex) { -// throw new RuntimeException(ex); -// } - } - - void stateChanged_(StateChangeEvent event) { - this.listener.stateChanged(event); - } - - @Override - public String toString() { - return "AWT(" + this.listener.toString() + ')'; //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTTreeChangeListenerWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTTreeChangeListenerWrapper.java deleted file mode 100644 index ea60469d1a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/listener/awt/AWTTreeChangeListenerWrapper.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.listener.awt; - -import java.awt.EventQueue; - -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.TreeChangeListener; - -/** - * Wrap another tree change listener and forward events to it on the AWT - * event queue, asynchronously if necessary. If the event arrived on the UI - * thread that is probably because it was initiated by a UI widget; as a - * result, we want to loop back synchronously so the events can be - * short-circuited. - */ -public final class AWTTreeChangeListenerWrapper - implements TreeChangeListener -{ - private final TreeChangeListener listener; - - public AWTTreeChangeListenerWrapper(TreeChangeListener listener) { - super(); - if (listener == null) { - throw new NullPointerException(); - } - this.listener = listener; - } - - public void nodeAdded(TreeAddEvent event) { - if (this.isExecutingOnUIThread()) { - this.nodeAdded_(event); - } else { - this.executeOnEventQueue(this.buildNodeAddedRunnable(event)); - } - } - - public void nodeRemoved(TreeRemoveEvent event) { - if (this.isExecutingOnUIThread()) { - this.nodeRemoved_(event); - } else { - this.executeOnEventQueue(this.buildNodeRemovedRunnable(event)); - } - } - - public void treeCleared(TreeClearEvent event) { - if (this.isExecutingOnUIThread()) { - this.treeCleared_(event); - } else { - this.executeOnEventQueue(this.buildTreeClearedRunnable(event)); - } - } - - public void treeChanged(TreeChangeEvent event) { - if (this.isExecutingOnUIThread()) { - this.treeChanged_(event); - } else { - this.executeOnEventQueue(this.buildTreeChangedRunnable(event)); - } - } - - private Runnable buildNodeAddedRunnable(final TreeAddEvent event) { - return new Runnable() { - public void run() { - AWTTreeChangeListenerWrapper.this.nodeAdded_(event); - } - @Override - public String toString() { - return "node added runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildNodeRemovedRunnable(final TreeRemoveEvent event) { - return new Runnable() { - public void run() { - AWTTreeChangeListenerWrapper.this.nodeRemoved_(event); - } - @Override - public String toString() { - return "node removed runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildTreeClearedRunnable(final TreeClearEvent event) { - return new Runnable() { - public void run() { - AWTTreeChangeListenerWrapper.this.treeCleared_(event); - } - @Override - public String toString() { - return "tree cleared runnable"; //$NON-NLS-1$ - } - }; - } - - private Runnable buildTreeChangedRunnable(final TreeChangeEvent event) { - return new Runnable() { - public void run() { - AWTTreeChangeListenerWrapper.this.treeChanged_(event); - } - @Override - public String toString() { - return "tree changed runnable"; //$NON-NLS-1$ - } - }; - } - - private boolean isExecutingOnUIThread() { - return EventQueue.isDispatchThread(); - } - - /** - * {@link EventQueue#invokeLater(Runnable)} seems to work OK; - * but using {@link EventQueue#invokeAndWait(Runnable)} can sometimes make - * things more predictable when debugging, at the risk of deadlocks. - */ - private void executeOnEventQueue(Runnable r) { - EventQueue.invokeLater(r); -// try { -// EventQueue.invokeAndWait(r); -// } catch (InterruptedException ex) { -// throw new RuntimeException(ex); -// } catch (java.lang.reflect.InvocationTargetException ex) { -// throw new RuntimeException(ex); -// } - } - - void nodeAdded_(TreeAddEvent event) { - this.listener.nodeAdded(event); - } - - void nodeRemoved_(TreeRemoveEvent event) { - this.listener.nodeRemoved(event); - } - - void treeCleared_(TreeClearEvent event) { - this.listener.treeCleared(event); - } - - void treeChanged_(TreeChangeEvent event) { - this.listener.treeChanged(event); - } - - @Override - public String toString() { - return "AWT(" + this.listener.toString() + ')'; //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractCollectionValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractCollectionValueModel.java deleted file mode 100644 index 31aad85651..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractCollectionValueModel.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.common.utility.internal.model.SingleAspectChangeSupport; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; - -/** - * This abstract class provides the infrastructure for "lazily" adding listeners - * to an underlying model as necessary. Subclasses will need to engage and - * disegage the underlying model and fire the appropriate collection change - * events. Subclasses must implement the appropriate {@link CollectionValueModel}. - *

- * Subclasses must implement the following methods:

    - *
  • {@link #engageModel()}

    - * implement this method to add the appropriate listener to the underlying model - *

  • {@link #disengageModel()}

    - * implement this method to remove the appropriate listener from the underlying model - *

- */ -public abstract class AbstractCollectionValueModel - extends AbstractModel -{ - - // ********** constructor/initialization ********** - - protected AbstractCollectionValueModel() { - super(); - } - - @Override - protected ChangeSupport buildChangeSupport() { - return new SingleAspectChangeSupport(this, CollectionChangeListener.class, CollectionValueModel.VALUES); - } - - - // ********** extend change support ********** - - /** - * Extend to start listening to the underlying model if necessary. - */ - @Override - public synchronized void addChangeListener(ChangeListener listener) { - if (this.hasNoListeners()) { - this.engageModel(); - } - super.addChangeListener(listener); - } - - /** - * Extend to start listening to the underlying model if necessary. - */ - @Override - public synchronized void addCollectionChangeListener(String collectionName, CollectionChangeListener listener) { - if (collectionName.equals(CollectionValueModel.VALUES) && this.hasNoListeners()) { - this.engageModel(); - } - super.addCollectionChangeListener(collectionName, listener); - } - - /** - * Extend to stop listening to the underlying model if necessary. - */ - @Override - public synchronized void removeChangeListener(ChangeListener listener) { - super.removeChangeListener(listener); - if (this.hasNoListeners()) { - this.disengageModel(); - } - } - - /** - * Extend to stop listening to the underlying model if necessary. - */ - @Override - public synchronized void removeCollectionChangeListener(String collectionName, CollectionChangeListener listener) { - super.removeCollectionChangeListener(collectionName, listener); - if (collectionName.equals(CollectionValueModel.VALUES) && this.hasNoListeners()) { - this.disengageModel(); - } - } - - - // ********** queries ********** - - /** - * Return whether the model has no collection value listeners. - */ - protected boolean hasNoListeners() { - return ! this.hasListeners(); - } - - /** - * Return whether the model has any collection value listeners. - */ - protected boolean hasListeners() { - return this.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES); - } - - - // ********** behavior ********** - - /** - * Engage the underlying model. - */ - protected abstract void engageModel(); - - /** - * Stop listening to the underlying model. - */ - protected abstract void disengageModel(); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractListValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractListValueModel.java deleted file mode 100644 index b182a52764..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractListValueModel.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.common.utility.internal.model.SingleAspectChangeSupport; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * This abstract class provides the infrastructure for "lazily" adding listeners - * to an underlying model as necessary. Subclasses will need to engage and - * disegage the underlying model and fire the appropriate list change - * events. Subclasses must implement the appropriate {@link ListValueModel}. - *

- * Subclasses must implement the following methods:

    - *
  • {@link #engageModel()}

    - * implement this method to add the appropriate listener to the underlying model - *

  • {@link #disengageModel()}

    - * implement this method to remove the appropriate listener from the underlying model - *

- */ -public abstract class AbstractListValueModel - extends AbstractModel -{ - - // ********** constructor/initialization ********** - - protected AbstractListValueModel() { - super(); - } - - @Override - protected ChangeSupport buildChangeSupport() { - return new SingleAspectChangeSupport(this, ListChangeListener.class, ListValueModel.LIST_VALUES); - } - - - // ********** extend change support ********** - - /** - * Extend to start listening to the underlying model if necessary. - */ - @Override - public void addChangeListener(ChangeListener listener) { - if (this.hasNoListeners()) { - this.engageModel(); - } - super.addChangeListener(listener); - } - - /** - * Extend to start listening to the underlying model if necessary. - */ - @Override - public void addListChangeListener(String listName, ListChangeListener listener) { - if (listName.equals(ListValueModel.LIST_VALUES) && this.hasNoListeners()) { - this.engageModel(); - } - super.addListChangeListener(listName, listener); - } - - /** - * Extend to stop listening to the underlying model if necessary. - */ - @Override - public void removeChangeListener(ChangeListener listener) { - super.removeChangeListener(listener); - if (this.hasNoListeners()) { - this.disengageModel(); - } - } - - /** - * Extend to stop listening to the underlying model if necessary. - */ - @Override - public void removeListChangeListener(String listName, ListChangeListener listener) { - super.removeListChangeListener(listName, listener); - if (listName.equals(ListValueModel.LIST_VALUES) && this.hasNoListeners()) { - this.disengageModel(); - } - } - - - // ********** queries ********** - - /** - * Return whether the model has no collection value listeners. - */ - protected boolean hasNoListeners() { - return ! this.hasListeners(); - } - - /** - * Return whether the model has any collection value listeners. - */ - protected boolean hasListeners() { - return this.hasAnyListChangeListeners(ListValueModel.LIST_VALUES); - } - - - // ********** behavior ********** - - /** - * Engage the underlying model. - */ - protected abstract void engageModel(); - - /** - * Stop listening to the underlying model. - */ - protected abstract void disengageModel(); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractPropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractPropertyValueModel.java deleted file mode 100644 index af624292d6..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractPropertyValueModel.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.common.utility.internal.model.SingleAspectChangeSupport; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * This abstract class provides the infrastructure for "lazily" adding listeners - * to an underlying model as necessary. Subclasses will need to engage and - * disegage the underlying model and fire the appropriate property change - * events. Subclasses must implement the appropriate {@link PropertyValueModel}. - *

- * Subclasses must implement the following methods:

    - *
  • {@link #engageModel()}

    - * implement this method to add the appropriate listener to the underlying model - *

  • {@link #disengageModel()}

    - * implement this method to remove the appropriate listener from the underlying model - *

- */ -public abstract class AbstractPropertyValueModel - extends AbstractModel -{ - - // ********** constructor/initialization ********** - - protected AbstractPropertyValueModel() { - super(); - } - - @Override - protected ChangeSupport buildChangeSupport() { - return new SingleAspectChangeSupport(this, PropertyChangeListener.class, PropertyValueModel.VALUE); - } - - - // ********** extend change support ********** - - /** - * Extend to start listening to the underlying model if necessary. - */ - @Override - public synchronized void addChangeListener(ChangeListener listener) { - if (this.hasNoListeners()) { - this.engageModel(); - } - super.addChangeListener(listener); - } - - /** - * Extend to stop listening to the underlying model if necessary. - */ - @Override - public synchronized void removeChangeListener(ChangeListener listener) { - super.removeChangeListener(listener); - if (this.hasNoListeners()) { - this.disengageModel(); - } - } - - /** - * Extend to start listening to the underlying model if necessary. - */ - @Override - public synchronized void addPropertyChangeListener(String propertyName, PropertyChangeListener listener) { - if (propertyName.equals(PropertyValueModel.VALUE) && this.hasNoListeners()) { - this.engageModel(); - } - super.addPropertyChangeListener(propertyName, listener); - } - - /** - * Extend to stop listening to the underlying model if necessary. - */ - @Override - public synchronized void removePropertyChangeListener(String propertyName, PropertyChangeListener listener) { - super.removePropertyChangeListener(propertyName, listener); - if (propertyName.equals(PropertyValueModel.VALUE) && this.hasNoListeners()) { - this.disengageModel(); - } - } - - - // ********** queries ********** - - /** - * Return whether the model has no property value listeners. - */ - protected boolean hasNoListeners() { - return ! this.hasListeners(); - } - - /** - * Return whether the model has any property value listeners. - */ - protected boolean hasListeners() { - return this.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE); - } - - - // ********** behavior ********** - - /** - * Engage the underlying model. - */ - protected abstract void engageModel(); - - /** - * Stop listening to the underlying model. - */ - protected abstract void disengageModel(); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractPropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractPropertyValueModelAdapter.java deleted file mode 100644 index b2dde293a2..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractPropertyValueModelAdapter.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * This abstract class provides the infrastructure needed to wrap - * a model, "lazily" listen to it, and convert - * its change notifications into property value model change - * notifications. - *

- * Subclasses must implement:

    - *
  • {@link #buildValue()}

    - * to return the current property value, as derived from the - * current model - *

  • {@link #engageModel_()}

    - * to start listening to the adapted model - *

  • {@link #disengageModel_()}

    - * to stop listening to the adapted model - *

- * Subclasses can call {@link #propertyChanged()} whenever the calculated - * value of the property changes (as determined by the subclass). - */ -public abstract class AbstractPropertyValueModelAdapter - extends AbstractPropertyValueModel - implements PropertyValueModel -{ - /** - * Cache the current value so we can pass an "old value" when - * we fire a property change event. - * We need this because the value may be calculated and we may - * not able to derive the "old value" from any fired events. - */ - protected V value; - - - // ********** constructor/initialization ********** - - protected AbstractPropertyValueModelAdapter() { - super(); - // our value is null when we are not listening to the model - this.value = null; - } - - - // ********** PropertyValueModel implementation ********** - - /** - * Return the cached value. - */ - public V getValue() { - return this.value; - } - - - // ********** behavior ********** - - /** - * Start listening to the model and build the value. - */ - @Override - protected void engageModel() { - this.engageModel_(); - // synch our value *after* we start listening to the model, - // since the model's value might change when a listener is added - this.value = this.buildValue(); - } - - /** - * Start listening to the model. - */ - protected abstract void engageModel_(); - - /** - * Build and return the current value, as derived from the - * current state of the underlying model. - */ - protected abstract V buildValue(); - - /** - * Stop listening to the model and clear the value. - */ - @Override - protected void disengageModel() { - this.disengageModel_(); - // clear out our value when we are not listening to the model - this.value = null; - } - - /** - * Stop listening to the model. - */ - protected abstract void disengageModel_(); - - /** - * The underlying model changed in some fashion. - * Recalculate the value and notify any listeners. - */ - protected void propertyChanged() { - Object old = this.value; - this.firePropertyChanged(VALUE, old, this.value = this.buildValue()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractTreeNodeValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractTreeNodeValueModel.java deleted file mode 100644 index 657676e34d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AbstractTreeNodeValueModel.java +++ /dev/null @@ -1,194 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ChainIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.TreeNodeValueModel; - -/** - * Subclasses need only implement the following methods: - * - * #value() - * return the user-determined "value" of the node, - * i.e. the object "wrapped" by the node - * - * #setValue(Object) - * set the user-determined "value" of the node, - * i.e. the object "wrapped" by the node; - * typically only overridden for nodes with "primitive" values - * - * #parent() - * return the parent of the node, which should be another - * TreeNodeValueModel - * - * #childrenModel() - * return a ListValueModel for the node's children - * - * #engageValue() and #disengageValue() - * override these methods to listen to the node's value if - * it can change in a way that should be reflected in the tree - */ -public abstract class AbstractTreeNodeValueModel - extends AbstractModel - implements TreeNodeValueModel -{ - - - // ********** constructors ********** - - /** - * Default constructor. - */ - protected AbstractTreeNodeValueModel() { - super(); - } - - @Override - protected ChangeSupport buildChangeSupport() { - // this model fires *both* "value property change" and "state change" events... -// return new SingleAspectChangeSupport(this, PropertyChangeListener.class, PropertyValueModel.VALUE); - return super.buildChangeSupport(); - } - - - // ********** extend AbstractModel implementation ********** - - /** - * Clients should be adding both "state change" and "value property change" - * listeners. - */ - @Override - public void addStateChangeListener(StateChangeListener listener) { - if (this.hasNoStateChangeListeners()) { - this.engageValue(); - } - super.addStateChangeListener(listener); - } - - /** - * Begin listening to the node's value's state. If the state of the node changes - * in a way that should be reflected in the tree, fire a "state change" event. - */ - protected abstract void engageValue(); - - /** - * @see #addStateChangeListener(StateChangeListener) - */ - @Override - public void removeStateChangeListener(StateChangeListener listener) { - super.removeStateChangeListener(listener); - if (this.hasNoStateChangeListeners()) { - this.disengageValue(); - } - } - - /** - * Stop listening to the node's value. - * @see #engageValue() - */ - protected abstract void disengageValue(); - - - // ********** WritablePropertyValueModel implementation ********** - - public void setValue(T value) { - throw new UnsupportedOperationException(); - } - - - // ********** TreeNodeValueModel implementation ********** - - @SuppressWarnings("unchecked") - public TreeNodeValueModel[] path() { - List> path = CollectionTools.reverseList(this.backPath()); - return path.toArray(new TreeNodeValueModel[path.size()]); - } - - /** - * Return an iterator that climbs up the node's path, - * starting with, and including, the node - * and up to, and including, the root node. - */ - protected Iterator> backPath() { - return new ChainIterator>(this) { - @Override - protected TreeNodeValueModel nextLink(TreeNodeValueModel currentLink) { - return currentLink.parent(); - } - }; - } - - public TreeNodeValueModel child(int index) { - return this.childrenModel().get(index); - } - - public int childrenSize() { - return this.childrenModel().size(); - } - - public int indexOfChild(TreeNodeValueModel child) { - ListValueModel> children = this.childrenModel(); - int size = children.size(); - for (int i = 0; i < size; i++) { - if (children.get(i) == child) { - return i; - } - } - return -1; - } - - public boolean isLeaf() { - return this.childrenModel().size() == 0; - } - - - // ********** standard methods ********** - - /** - * We implement #equals(Object) so that TreePaths containing these nodes - * will resolve properly when the nodes contain the same values. This is - * necessary because nodes are dropped and rebuilt willy-nilly when dealing - * with a sorted list of children; and this allows us to save and restore - * a tree's expanded paths. The nodes in the expanded paths that are - * saved before any modification (e.g. renaming a node) will be different - * from the nodes in the tree's paths after the modification, if the modification - * results in a possible change in the node sort order. ~bjv - */ - @Override - public boolean equals(Object o) { - if (o == null) { - return false; - } - if (o.getClass() != this.getClass()) { - return false; - } - @SuppressWarnings("unchecked") - AbstractTreeNodeValueModel other = (AbstractTreeNodeValueModel) o; - return this.getValue().equals(other.getValue()); - } - - @Override - public int hashCode() { - return this.getValue().hashCode(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getValue()); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectAdapter.java deleted file mode 100644 index 99f17918c3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectAdapter.java +++ /dev/null @@ -1,266 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.EventListener; - -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.common.utility.internal.model.SingleAspectChangeSupport; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * This abstract extension of {@link AbstractModel} provides a base for adding - * change listeners (property change, collection change, list change, tree change) - * to a subject and converting the subject's change notifications into a single - * set of change notifications for a common aspect (e.g. VALUE). - *

- * The adapter will only listen to the subject (and subject holder) when the - * adapter itself actually has listeners. This will allow the adapter to be - * garbage collected when appropriate - */ -public abstract class AspectAdapter - extends AbstractModel -{ - /** - * The subject that holds the aspect and fires - * change notification when the aspect changes. - * We need to hold on to this directly so we can - * disengage it when it changes. - */ - protected S subject; - - /** - * A value model that holds the subject - * that holds the aspect and provides change notification. - * This is useful when there are a number of aspect adapters - * that have the same subject and that subject can change. - * All the aspect adapters should share the same subject holder. - * For now, this is can only be set upon construction and is - * immutable. - */ - protected final PropertyValueModel subjectHolder; - - /** A listener that keeps us in synch with the subject holder. */ - protected final PropertyChangeListener subjectChangeListener; - - - // ********** constructors ********** - - /** - * Construct an aspect adapter for the specified subject. - */ - protected AspectAdapter(S subject) { - this(new StaticPropertyValueModel(subject)); - } - - /** - * Construct an aspect adapter for the specified subject holder. - * The subject holder cannot be null. - */ - protected AspectAdapter(PropertyValueModel subjectHolder) { - super(); - if (subjectHolder == null) { - throw new NullPointerException(); - } - this.subjectHolder = subjectHolder; - this.subjectChangeListener = this.buildSubjectChangeListener(); - // the subject is null when we are not listening to it - // this will typically result in our value being null - this.subject = null; - } - - - // ********** initialization ********** - - @Override - protected ChangeSupport buildChangeSupport() { - return new LocalChangeSupport(this, this.getListenerClass(), this.getListenerAspectName()); - } - - /** - * The subject holder's value has changed, keep our subject in synch. - */ - protected PropertyChangeListener buildSubjectChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - AspectAdapter.this.subjectChanged(); - } - @Override - public String toString() { - return "subject change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** behavior ********** - - /** - * The subject has changed. Notify listeners that the value has changed. - */ - protected synchronized void subjectChanged() { - Object oldValue = this.getValue(); - boolean hasListeners = this.hasListeners(); - if (hasListeners) { - this.disengageSubject(); - } - this.subject = this.subjectHolder.getValue(); - if (hasListeners) { - this.engageSubject(); - this.fireAspectChanged(oldValue, this.getValue()); - } - } - - /** - * Return the aspect's current value. - */ - protected abstract Object getValue(); - - /** - * Return the class of listener that is interested in the aspect adapter's - * changes. - */ - protected abstract Class getListenerClass(); - - /** - * Return the name of the aspect adapter's aspect (e.g. VALUE). - * This is the name of the aspect adapter's single aspect, not the - * name of the subject's aspect the aspect adapter is adapting. - */ - protected abstract String getListenerAspectName(); - - /** - * Return whether there are any listeners for the aspect. - */ - protected abstract boolean hasListeners(); - - /** - * Return whether there are no listeners for the aspect. - */ - protected boolean hasNoListeners() { - return ! this.hasListeners(); - } - - /** - * The aspect has changed, notify listeners appropriately. - */ - protected abstract void fireAspectChanged(Object oldValue, Object newValue); - - protected void engageSubject() { - // check for nothing to listen to - if (this.subject != null) { - this.engageSubject_(); - } - } - - /** - * The subject is not null - add our listener. - */ - protected abstract void engageSubject_(); - - protected void disengageSubject() { - // check for nothing to listen to - if (this.subject != null) { - this.disengageSubject_(); - } - } - - /** - * The subject is not null - remove our listener. - */ - protected abstract void disengageSubject_(); - - protected void engageSubjectHolder() { - this.subjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.subjectChangeListener); - // synch our subject *after* we start listening to the subject holder, - // since its value might change when a listener is added - this.subject = this.subjectHolder.getValue(); - } - - protected void disengageSubjectHolder() { - this.subjectHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.subjectChangeListener); - // clear out the subject when we are not listening to its holder - this.subject = null; - } - - protected void engageModels() { - this.engageSubjectHolder(); - this.engageSubject(); - } - - protected void disengageModels() { - this.disengageSubject(); - this.disengageSubjectHolder(); - } - - - // ********** local change support ********** - - /** - * Extend change support to start listening to the aspect adapter's - * models (the subject holder and the subject itself) when the first - * relevant listener is added. - * Conversely, stop listening to the aspect adapter's models when the - * last relevant listener is removed. - * A relevant listener is a listener of the relevant type and aspect or a - * general-purpose listener. - */ - protected class LocalChangeSupport extends SingleAspectChangeSupport { - private static final long serialVersionUID = 1L; - - public LocalChangeSupport(AspectAdapter source, Class validListenerClass, String validAspectName) { - super(source, validListenerClass, validAspectName); - } - - protected boolean hasNoListeners() { - return this.hasNoListeners(this.validListenerClass, this.validAspectName); - } - - - // ********** overrides ********** - - @Override - protected synchronized void addListener(Class listenerClass, T listener) { - if (this.hasNoListeners()) { - AspectAdapter.this.engageModels(); - } - super.addListener(listenerClass, listener); - } - - @Override - protected synchronized void addListener(Class listenerClass, String aspectName, T listener) { - if (this.hasNoListeners()) { - AspectAdapter.this.engageModels(); - } - super.addListener(listenerClass, aspectName, listener); - } - - @Override - protected synchronized void removeListener(Class listenerClass, T listener) { - super.removeListener(listenerClass, listener); - if (this.hasNoListeners()) { - AspectAdapter.this.disengageModels(); - } - } - - @Override - protected synchronized void removeListener(Class listenerClass, String aspectName, T listener) { - super.removeListener(listenerClass, aspectName, listener); - if (this.hasNoListeners()) { - AspectAdapter.this.disengageModels(); - } - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectCollectionValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectCollectionValueModelAdapter.java deleted file mode 100644 index 9c7f316629..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectCollectionValueModelAdapter.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Collection; -import java.util.EventListener; -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * This {@link AspectAdapter} provides basic collection change support. - * This converts an "aspect" (as defined by subclasses) into - * a single {@link #VALUES} collection. - *

- * The typical subclass will override the following methods:

    - *
  • {@link #engageSubject_()}

    - * implement this method to add the appropriate listener to the subject - *

  • {@link #disengageSubject_()}

    - * implement this method to remove the appropriate listener from the subject - *

  • {@link #getIterable()}

    - * at the very minimum, override this method to return an iterable containing the - * subject's collection aspect; it does not need to be overridden if either - * {@link #iterator_()} or {@link #iterator()} is overridden and its behavior changed - *

  • {@link #size_()}

    - * override this method to improve performance; it does not need to be overridden if - * {@link #size()} is overridden and its behavior changed - *

  • {@link #iterator_()}

    - * override this method to return an iterator on the - * subject's collection aspect if it is not possible to implement {@link #getIterable()}; - * it does not need to be overridden if - * {@link #iterator()} is overridden and its behavior changed - *

  • {@link #iterator()}

    - * override this method only if returning an empty iterator when the - * subject is null is unacceptable - *

  • {@link #size()}

    - * override this method only if returning a zero when the - * subject is null is unacceptable - *

- * To notify listeners, subclasses can call {@link #collectionChanged()} - * whenever the aspect has changed. - */ -public abstract class AspectCollectionValueModelAdapter - extends AspectAdapter - implements CollectionValueModel -{ - - // ********** constructors ********** - - /** - * Construct a collection value model adapter for an aspect of the - * specified subject. - */ - protected AspectCollectionValueModelAdapter(PropertyValueModel subjectHolder) { - super(subjectHolder); - } - - - // ********** CollectionValueModel implementation ********** - - /** - * Return the elements of the subject's collection aspect. - */ - public Iterator iterator() { - return (this.subject == null) ? EmptyIterator.instance() : this.iterator_(); - } - - /** - * Return the elements of the subject's collection aspect. - * At this point we can be sure the subject is not null. - * @see #iterator() - */ - protected Iterator iterator_() { - return this.getIterable().iterator(); - } - - /** - * Return the elements of the subject's collection aspect. - * At this point we can be sure the subject is not null. - * @see #iterator_() - */ - protected Iterable getIterable() { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - /** - * Return the size of the subject's collection aspect. - */ - public int size() { - return (this.subject == null) ? 0 : this.size_(); - } - - /** - * Return the size of the subject's collection aspect. - * At this point we can be sure the subject is not null. - * @see #size() - */ - protected int size_() { - return CollectionTools.size(this.iterator()); - } - - - // ********** AspectAdapter implementation ********** - - @Override - protected Object getValue() { - return this.buildValueCollection(); - } - - @Override - protected Class getListenerClass() { - return CollectionChangeListener.class; - } - - @Override - protected String getListenerAspectName() { - return VALUES; - } - - @Override - protected boolean hasListeners() { - return this.hasAnyCollectionChangeListeners(VALUES); - } - - @Override - protected void fireAspectChanged(Object oldValue, Object newValue) { - @SuppressWarnings("unchecked") Collection newCollection = (Collection) newValue; - this.fireCollectionChanged(VALUES, newCollection); - } - - protected void collectionChanged() { - this.fireCollectionChanged(VALUES, this.buildValueCollection()); - } - - protected Collection buildValueCollection() { - return CollectionTools.collection(this.iterator()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.buildValueCollection()); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectListValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectListValueModelAdapter.java deleted file mode 100644 index 41d36a066c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectListValueModelAdapter.java +++ /dev/null @@ -1,197 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.EventListener; -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * This {@link AspectAdapter} provides basic list change support. - * This converts an "aspect" (as defined by subclasses) into - * a single {@link #LIST_VALUES} list. - *

- * The typical subclass will override the following methods:

    - *
  • {@link #engageSubject_()}

    - * implement this method to add the appropriate listener to the subject - *

  • {@link #disengageSubject_()}

    - * implement this method to remove the appropriate listener from the subject - *

  • {@link #getListIterable()}

    - * at the very minimum, override this method to return a list iterable containing the - * subject's list aspect; it does not need to be overridden if either - * {@link #listIterator_()} or {@link #listIterator()} is overridden and its behavior changed - *

  • {@link #get(int)}

    - * override this method to improve performance - *

  • {@link #size_()}

    - * override this method to improve performance; it does not need to be overridden if - * {@link #size()} is overridden and its behavior changed - *

  • {@link #toArray_()}

    - * override this method to improve performance; it does not need to be overridden if - * {@link #toArray()} is overridden and its behavior changed - *

  • {@link #listIterator_()}

    - * override this method to return a list iterator on the subject's list - * aspect if it is not possible to implement {@link #getListIterable()}; - * it does not need to be overridden if - * {@link #listIterator()} is overridden and its behavior changed - *

  • {@link #listIterator()}

    - * override this method only if returning an empty list iterator when the - * subject is null is unacceptable - *

  • {@link #size()}

    - * override this method only if returning a zero when the - * subject is null is unacceptable - *

  • {@link #toArray()}

    - * override this method only if returning an empty array when the - * subject is null is unacceptable - *

- * To notify listeners, subclasses can call {@link #listChanged()} - * whenever the aspect has changed. - */ -public abstract class AspectListValueModelAdapter - extends AspectAdapter - implements ListValueModel -{ - private static final Object[] EMPTY_ARRAY = new Object[0]; - - - // ********** constructors ********** - - /** - * Construct a list value model adapter for an aspect of the - * specified subject. - */ - protected AspectListValueModelAdapter(PropertyValueModel subjectHolder) { - super(subjectHolder); - } - - - // ********** ListValueModel implementation ********** - - /** - * Return the elements of the subject's list aspect. - */ - public ListIterator iterator() { - return this.listIterator(); - } - - /** - * Return the elements of the subject's list aspect. - */ - public ListIterator listIterator() { - return (this.subject == null) ? EmptyListIterator.instance() : this.listIterator_(); - } - - /** - * Return the elements of the subject's list aspect. - * At this point we can be sure the subject is not null. - * @see #listIterator() - */ - protected ListIterator listIterator_() { - return this.getListIterable().iterator(); - } - - /** - * Return the elements of the subject's list aspect. - * At this point we can be sure the subject is not null. - * @see #listIterator_() - */ - protected ListIterable getListIterable() { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - /** - * Return the element at the specified index of the subject's list aspect. - */ - public E get(int index) { - return CollectionTools.get(this.listIterator(), index); - } - - /** - * Return the size of the subject's list aspect. - */ - public int size() { - return this.subject == null ? 0 : this.size_(); - } - - /** - * Return the size of the subject's list aspect. - * At this point we can be sure the subject is not null. - * @see #size() - */ - protected int size_() { - return CollectionTools.size(this.listIterator()); - } - - /** - * Return an array manifestation of the subject's list aspect. - */ - public Object[] toArray() { - return this.subject == null ? EMPTY_ARRAY : this.toArray_(); - } - - /** - * Return an array manifestation of the subject's list aspect. - * At this point we can be sure the subject is not null. - * @see #toArray() - */ - protected Object[] toArray_() { - return ArrayTools.array(this.listIterator(), this.size()); - } - - - // ********** AspectAdapter implementation ********** - - @Override - protected List getValue() { - return this.buildValueList(); - } - - @Override - protected Class getListenerClass() { - return ListChangeListener.class; - } - - @Override - protected String getListenerAspectName() { - return LIST_VALUES; - } - - @Override - protected boolean hasListeners() { - return this.hasAnyListChangeListeners(LIST_VALUES); - } - - @Override - protected void fireAspectChanged(Object oldValue, Object newValue) { - @SuppressWarnings("unchecked") List newList = (List) newValue; - this.fireListChanged(LIST_VALUES, newList); - } - - protected void listChanged() { - this.fireListChanged(LIST_VALUES, this.buildValueList()); - } - - protected List buildValueList() { - return CollectionTools.list(this.iterator()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.buildValueList()); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectPropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectPropertyValueModelAdapter.java deleted file mode 100644 index 180153a586..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectPropertyValueModelAdapter.java +++ /dev/null @@ -1,178 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.EventListener; - -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * This {@link AspectAdapter} provides basic property change support. - * This converts an "aspect" (as defined by subclasses) into - * a single {@link #VALUE} property. - *

- * The typical subclass will override the following methods:

    - *
  • {@link #engageSubject_()}

    - * implement this method to add the appropriate listener to the subject - *

  • {@link #disengageSubject_()}

    - * implement this method to remove the appropriate listener from the subject - *

  • {@link #buildValue_()}

    - * at the very minimum, override this method to return the value of the - * subject's aspect (or "virtual" aspect); it does not need to be - * overridden if {@link #buildValue()} is overridden and its behavior changed - *

  • {@link #setValue_(Object)}

    - * override this method if the client code needs to set the value of - * the subject's aspect; oftentimes, though, the client code (e.g. UI) - * will need only to get the value; it does not need to be - * overridden if {@link #setValue(Object)} is overridden and its behavior changed - *

  • {@link #buildValue()}

    - * override this method only if returning a null value when - * the subject is null is unacceptable - *

  • {@link #setValue(Object)}

    - * override this method only if something must be done when the subject - * is null (e.g. throw an exception) - *

- * To notify listeners, subclasses can call {@link #propertyChanged()} - * whenever the aspect has changed. - */ -public abstract class AspectPropertyValueModelAdapter - extends AspectAdapter - implements WritablePropertyValueModel -{ - /** - * Cache the current value of the aspect so we - * can pass an "old value" when we fire a property change event. - * We need this because the value may be calculated and may - * not be in the property change event fired by the subject, - * especially when dealing with multiple aspects. - */ - protected V value; - - - // ********** constructors ********** - - /** - * Construct a property value model adapter for an aspect of the - * specified subject. - */ - protected AspectPropertyValueModelAdapter(PropertyValueModel subjectHolder) { - super(subjectHolder); - // our value is null when we are not listening to the subject - this.value = null; - } - - - // ********** PropertyValueModel implementation ********** - - /** - * Return the value of the subject's aspect. - */ - @Override - public final V getValue() { - return this.value; - } - - - // ********** WritablePropertyValueModel implementation ********** - - /** - * Set the value of the subject's aspect. - */ - public void setValue(V value) { - if (this.subject != null) { - this.setValue_(value); - } - } - - /** - * Set the value of the subject's aspect. - * At this point we can be sure the subject is not null. - * @see #setValue(Object) - */ - protected void setValue_(@SuppressWarnings("unused") V value) { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - - // ********** AspectAdapter implementation ********** - - @Override - protected Class getListenerClass() { - return PropertyChangeListener.class; - } - - @Override - protected String getListenerAspectName() { - return VALUE; - } - - @Override - protected boolean hasListeners() { - return this.hasAnyPropertyChangeListeners(VALUE); - } - - @Override - protected void fireAspectChanged(Object oldValue, Object newValue) { - this.firePropertyChanged(VALUE, oldValue, newValue); - } - - @Override - protected void engageSubject() { - super.engageSubject(); - // synch our value *after* we start listening to the subject, - // since its value might change when a listener is added - this.value = this.buildValue(); - } - - @Override - protected void disengageSubject() { - super.disengageSubject(); - // clear out our value when we are not listening to the subject - this.value = null; - } - - - // ********** behavior ********** - - /** - * Return the aspect's value. - * At this point the subject may be null. - */ - protected V buildValue() { - return (this.subject == null) ? null : this.buildValue_(); - } - - /** - * Return the value of the subject's aspect. - * At this point we can be sure the subject is not null. - * @see #buildValue() - */ - protected V buildValue_() { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - /** - * This method can be called by subclasses whenever the subject's aspect - * has changed; listeners will be notified appropriately. - */ - protected void propertyChanged() { - V old = this.value; - this.value = this.buildValue(); - this.fireAspectChanged(old, this.value); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectTreeValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectTreeValueModelAdapter.java deleted file mode 100644 index 6989991744..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/AspectTreeValueModelAdapter.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Collection; -import java.util.EventListener; -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.model.listener.TreeChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.TreeValueModel; - -/** - * This {@link AspectAdapter} provides basic tree change support. - * This converts an "aspect" (as defined by subclasses) into - * a single {@link #NODES} tree. - *

- * The typical subclass will override the following methods:

    - *
  • {@link #engageSubject_()}

    - * implement this method to add the appropriate listener to the subject - *

  • {@link #disengageSubject_()}

    - * implement this method to remove the appropriate listener from the subject - *

  • {@link #nodes_()}

    - * at the very minimum, override this method to return an iterator - * on the subject's tree aspect; it does not need to be overridden if - * {@link #nodes()} is overridden and its behavior changed - *

  • {@link #nodes()}

    - * override this method only if returning an empty iterator when the - * subject is null is unacceptable - *

- * To notify listeners, subclasses can call {@link #treeChanged()} - * whenever the aspect has changed. - */ -public abstract class AspectTreeValueModelAdapter - extends AspectAdapter - implements TreeValueModel -{ - - // ********** constructors ********** - - /** - * Construct a tree value model adapter for an aspect of the - * specified subject. - */ - protected AspectTreeValueModelAdapter(PropertyValueModel subjectHolder) { - super(subjectHolder); - } - - - // ********** TreeValueModel implementation ********** - - /** - * Return the nodes of the subject's tree aspect. - */ - public Iterator nodes() { - return (this.subject == null) ? EmptyIterator.instance() : this.nodes_(); - } - - /** - * Return the nodes of the subject's tree aspect. - * At this point we can be sure the subject is not null. - * @see #nodes() - */ - protected Iterator nodes_() { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - - // ********** AspectAdapter implementation ********** - - @Override - protected Object getValue() { - return this.buildValueCollection(); - } - - @Override - protected Class getListenerClass() { - return TreeChangeListener.class; - } - - @Override - protected String getListenerAspectName() { - return NODES; - } - - @Override - protected boolean hasListeners() { - return this.hasAnyTreeChangeListeners(NODES); - } - - @Override - protected void fireAspectChanged(Object oldValue, Object newValue) { - @SuppressWarnings("unchecked") Collection newNodes = (Collection) newValue; - this.fireTreeChanged(NODES, newNodes); - } - - protected void treeChanged() { - this.fireTreeChanged(NODES, this.buildValueCollection()); - } - - protected Collection buildValueCollection() { - return CollectionTools.collection(this.nodes()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.buildValueCollection()); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedWritablePropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedWritablePropertyValueModel.java deleted file mode 100644 index 87d191ca6a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/BufferedWritablePropertyValueModel.java +++ /dev/null @@ -1,392 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * A BufferedWritablePropertyValueModel is used to hold a temporary copy of the value - * in another property value model (the "wrapped" value holder). The application - * can modify this temporary copy, ad nauseam; but the temporary copy is only - * passed through to the "wrapped" value holder when the trigger "accepts" the - * buffered value. Alternatively, the application can "reset" the buffered value - * to the original, "wrapped" value. - *

- * The trigger is another {@link PropertyValueModel} that holds a {@link Boolean} - * and the application changes the trigger's value to true on "accept", false on "reset". - * Typically, in a dialog:

    - *
  • pressing the "OK" button will trigger an "accept" and close the dialog - *
  • pressing the "Cancel" button will simply close the dialog, - * dropping the "buffered" values into the bit bucket - *
  • pressing the "Apply" button will trigger an "accept" and leave the dialog open - *
  • pressing the "Restore" button will trigger a "reset" and leave the dialog open - *
- *

- * A number of buffered property value models can wrap another set of - * property aspect adapters that adapt the various aspects of a single - * domain model. All the bufferd property value models can be hooked to the - * same trigger, and that trigger is controlled by the application, typically - * via the OK button in a dialog. - * - * @see PropertyAspectAdapter - */ -public class BufferedWritablePropertyValueModel - extends PropertyValueModelWrapper - implements WritablePropertyValueModel -{ - - /** - * We cache the value here until it is accepted and passed - * through to the wrapped value holder. - */ - protected T bufferedValue; - - /** - * This is set to true when we are "accepting" the buffered value - * and passing it through to the wrapped value holder. This allows - * us to ignore the property change event fired by the wrapped - * value holder. - * (We can't stop listening to the wrapped value holder, because - * if we are the only listener that could "deactivate" the wrapped - * value holder.) - */ - protected boolean accepting; - - /** - * This is the trigger that indicates whether the buffered value - * should be accepted or reset. - */ - protected final PropertyValueModel triggerHolder; - - /** This listens to the trigger holder. */ - protected final PropertyChangeListener triggerChangeListener; - - /** - * This flag indicates whether our buffered value has been assigned - * a value and is possibly out of synch with the wrapped value. - */ - protected boolean buffering; - - - // ********** constructors ********** - - /** - * Construct a buffered property value model with the specified wrapped - * property value model and trigger holder. - */ - public BufferedWritablePropertyValueModel(WritablePropertyValueModel valueHolder, PropertyValueModel triggerHolder) { - super(valueHolder); - if (triggerHolder == null) { - throw new NullPointerException(); - } - this.triggerHolder = triggerHolder; - this.bufferedValue = null; - this.buffering = false; - this.accepting = false; - this.triggerChangeListener = this.buildTriggerChangeListener(); - } - - - // ********** initialization ********** - - protected PropertyChangeListener buildTriggerChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - BufferedWritablePropertyValueModel.this.triggerChanged(event); - } - @Override - public String toString() { - return "trigger change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** ValueModel implementation ********** - - /** - * If we are currently "buffering" a value, return that; - * otherwise, return the wrapped value. - */ - public T getValue() { - return this.buffering ? this.bufferedValue : this.valueHolder.getValue(); - } - - /** - * Assign the new value to our "buffered" value. - * It will be pushed to the wrapped value holder - * when the trigger is "accepted". - */ - public void setValue(T value) { - if (this.buffering) { - if (this.valuesAreEqual(value, this.valueHolder.getValue())) { - // the buffered value is being set back to the original value - this.reset(); - } else { - // the buffered value is being changed - Object old = this.bufferedValue; - this.bufferedValue = value; - this.firePropertyChanged(VALUE, old, value); - } - } else { - if (this.valuesAreEqual(value, this.valueHolder.getValue())) { - // the buffered value is being set to the same value as the original value - ignore - } else { - // the buffered value is being set for the first time - Object old = this.valueHolder.getValue(); - this.bufferedValue = value; - this.buffering = true; - this.firePropertyChanged(VALUE, old, value); - } - } - } - - - // ********** PropertyValueModelWrapper extensions ********** - - /** - * extend to engage the trigger holder also - */ - @Override - protected void engageModel() { - super.engageModel(); - this.triggerHolder.addPropertyChangeListener(VALUE, this.triggerChangeListener); - } - - /** - * extend to disengage the trigger holder also - */ - @Override - protected void disengageModel() { - this.triggerHolder.removePropertyChangeListener(VALUE, this.triggerChangeListener); - super.disengageModel(); - } - - - // ********** behavior ********** - - /** - * If we are currently "accepting" the value (i.e passing it on to the - * "wrapped" model), ignore change notifications, since we caused - * them and our own listeners are already aware of the change. - */ - @Override - protected void valueChanged(PropertyChangeEvent event) { - if ( ! this.accepting) { - this.valueChanged_(event); - } - } - - /** - * If we have a "buffered" value, check whether the "wrapped" value has - * changed to be the same as the "buffered" value. If it has, stop "buffering"; - * if not, do nothing. - * If we do not yet have a "buffered" value, simply propagate the - * change notification with the buffered model as the source. - */ - protected void valueChanged_(PropertyChangeEvent event) { - if (this.buffering) { - if (this.valuesAreEqual(event.getNewValue(), this.bufferedValue)) { - // the buffered value is being set back to the original value - this.reset(); - } else { - this.handleChangeConflict(event); - } - } else { - this.firePropertyChanged(event.clone(this)); - } - } - - /** - * By default, if we have a "buffered" value and the "wrapped" value changes, - * we simply ignore the new "wrapped" value and simply overlay it with the - * "buffered" value if it is "accepted". ("Last One In Wins" concurrency model) - * Subclasses can override this method to change that behavior with a - * different concurrency model. For example, you could drop the "buffered" value - * and replace it with the new "wrapped" value, or you could throw an - * exception. - */ - protected void handleChangeConflict(@SuppressWarnings("unused") PropertyChangeEvent event) { - // the default is to do nothing - } - - /** - * The trigger changed:

    - *
  • If it is now true, "accept" the buffered value and push - * it to the wrapped value holder. - *
  • If it is now false, "reset" the buffered value to its original value. - *
- */ - protected void triggerChanged(PropertyChangeEvent event) { - // if nothing has been "buffered", we don't need to do anything: - // nothing needs to be passed through; nothing needs to be reset; - if (this.buffering) { - if (((Boolean) event.getNewValue()).booleanValue()) { - this.accept(); - } else { - this.reset(); - } - } - } - - protected void accept() { - // set the accepting flag so we ignore any events - // fired by the wrapped value holder - this.accepting = true; - try { - this.getValueHolder().setValue(this.bufferedValue); - } finally { - this.bufferedValue = null; - this.buffering = false; - // clear the flag once the "accept" is complete - this.accepting = false; - } - } - - protected void reset() { - // notify our listeners that our value has been reset - Object old = this.bufferedValue; - this.bufferedValue = null; - this.buffering = false; - this.firePropertyChanged(VALUE, old, this.valueHolder.getValue()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getValue()); - } - - - // ********** convenience methods ********** - - /** - * Return whether the buffered model is currently "buffering" - * a value. - */ - public boolean isBuffering() { - return this.buffering; - } - - /** - * Our constructor accepts only a {@link WritablePropertyValueModel}{@code}. - */ - @SuppressWarnings("unchecked") - protected WritablePropertyValueModel getValueHolder() { - return (WritablePropertyValueModel) this.valueHolder; - } - - - // ********** inner class ********** - - /** - * Trigger is a special property value model that only maintains its - * value (of true or false) during the change notification caused by - * {@link #setValue(T)}. In other words, a Trigger - * only has a valid value when it is being set. - */ - public static class Trigger extends SimplePropertyValueModel { - - - // ********** constructor ********** - - /** - * Construct a trigger with a null value. - */ - public Trigger() { - super(); - } - - - // ********** ValueModel implementation ********** - - /** - * Extend so that this method can only be invoked during - * change notification triggered by {@link #setValue(Object)}. - */ - @Override - public Boolean getValue() { - if (this.value == null) { - throw new IllegalStateException("The method Trigger.getValue() may only be called during change notification."); //$NON-NLS-1$ - } - return this.value; - } - - /** - * Extend to reset the value to null once all the - * listeners have been notified. - */ - @Override - public void setValue(Boolean value) { - super.setValue(value); - this.value = null; - } - - - // ********** convenience methods ********** - - /** - * Set the trigger's value:
    - *
  • true indicates "accept" - *
  • false indicates "reset" - *
- */ - public void setValue(boolean value) { - this.setValue(Boolean.valueOf(value)); - } - - /** - * Return the trigger's value:
    - *
  • true indicates "accept" - *
  • false indicates "reset" - *
- * This method can only be invoked during change notification. - */ - public boolean booleanValue() { - return this.getValue().booleanValue(); - } - - /** - * Accept the trigger (i.e. set its value to true). - */ - public void accept() { - this.setValue(true); - } - - /** - * Return whether the trigger has been accepted - * (i.e. its value was changed to true). - * This method can only be invoked during change notification. - */ - public boolean isAccepted() { - return this.booleanValue(); - } - - /** - * Reset the trigger (i.e. set its value to false). - */ - public void reset() { - this.setValue(false); - } - - /** - * Return whether the trigger has been reset - * (i.e. its value was changed to false). - * This method can only be invoked during change notification. - */ - public boolean isReset() { - return ! this.booleanValue(); - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CachingTransformationPropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CachingTransformationPropertyValueModel.java deleted file mode 100644 index c62e6853bf..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CachingTransformationPropertyValueModel.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * A CachingTransformationPropertyValueModel wraps another - * {@link PropertyValueModel} and uses a {@link Transformer} - * to transform the wrapped value before it is returned by {@link #getValue()}. - * The transformed value is calculated and cached during initialization and every - * time the wrapped value changes. This can be useful when the old value - * passed in to {@link #valueChanged(org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent)} - * can no longer be "transformed" because its state is no longer valid. - * This caching can also improve time performance in some situations. - *

- * As an alternative to building a {@link Transformer}, - * a subclass of CachingTransformationPropertyValueModel can - * either override {@link #transform_(Object)} or, - * if something other than null should be returned when the wrapped value - * is null, override {@link #transform(Object)}. - */ -public class CachingTransformationPropertyValueModel - extends TransformationPropertyValueModel -{ - /** - * Cache the transformed value so that during property change event notification - * we do not have to transform the old value. The old value could no longer be valid in - * the model; as a result, transforming it would not be valid. - */ - protected T2 cachedValue; - - - // ********** constructors/initialization ********** - - /** - * Construct a property value model with the specified nested - * property value model and the default transformer. - * Use this constructor if you want to override - * {@link #transform_(Object)} or {@link #transform(Object)} - * instead of building a {@link Transformer}. - */ - public CachingTransformationPropertyValueModel(PropertyValueModel valueHolder) { - super(valueHolder); - } - - /** - * Construct an property value model with the specified nested - * property value model and transformer. - */ - public CachingTransformationPropertyValueModel(PropertyValueModel valueHolder, Transformer transformer) { - super(valueHolder, transformer); - } - - - // ********** behavior ********** - - /** - * We have listeners, transform the nested value and cache the result. - */ - @Override - protected void engageModel() { - super.engageModel(); - this.cachedValue = this.transform(this.valueHolder.getValue()); - } - - /** - * We have no more listeners, clear the cached value. - */ - @Override - protected void disengageModel() { - this.cachedValue = null; - super.disengageModel(); - } - - /** - * No need to transform the nested value, simply return the cached value, - * which is already transformed. - */ - @Override - public T2 getValue() { - return this.cachedValue; - } - - /** - * Transform the specified new value, caching it before returning it. - * A bit of a side-effect, but it seems reasonable. - */ - @Override - protected T2 transformNew(T1 value) { - this.cachedValue = super.transformNew(value); - return this.cachedValue; - } - - /** - * No need to transform the old value, simply return the cached value, - * which is already transformed. - */ - @Override - protected T2 transformOld(T1 value) { - return this.cachedValue; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CachingTransformationWritablePropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CachingTransformationWritablePropertyValueModel.java deleted file mode 100644 index 1560367c3e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CachingTransformationWritablePropertyValueModel.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.internal.BidiTransformer; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * A CachingTransformationWritablePropertyValueModel augments the - * behavior of a {@link TransformationWritablePropertyValueModel} by caching - * the transformed value. - * The transformed value is calculated and cached during initialization and every - * time the wrapped value changes. This can be useful when the old value - * passed in to {@link #valueChanged(org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent)} - * can no longer be "transformed" because its state is no longer valid. - * This caching can also improve time performance in some situations. - */ -public class CachingTransformationWritablePropertyValueModel - extends TransformationWritablePropertyValueModel -{ - /** - * Cache the transformed value so that during property change event notification - * we do not have to transform the old value. The old value could no longer be valid in - * the model; as a result, transforming it would not be valid. - */ - protected T2 cachedValue; - - - // ********** constructors/initialization ********** - - /** - * Construct a writable property value model with the specified nested - * writable property value model and the default bidi transformer. - * Use this constructor if you want to override - * {@link #transform_(Object)} and {@link reverseTransform_(Object)} - * (or {@link #transform(Object)} and {@link #reverseTransform(Object)}) - * methods instead of building a {@link BidiTransformer}. - */ - public CachingTransformationWritablePropertyValueModel(WritablePropertyValueModel valueHolder) { - super(valueHolder); - } - - /** - * Construct a writable property value model with the specified nested - * writable property value model and bidi transformer. - */ - public CachingTransformationWritablePropertyValueModel(WritablePropertyValueModel valueHolder, BidiTransformer transformer) { - super(valueHolder, transformer); - } - - - // ********** behavior ********** - - /** - * We have listeners, transform the nested value and cache the result. - */ - @Override - protected void engageModel() { - super.engageModel(); - this.cachedValue = this.transform(this.valueHolder.getValue()); - } - - /** - * We have no more listeners, clear the cached value. - */ - @Override - protected void disengageModel() { - this.cachedValue = null; - super.disengageModel(); - } - - /** - * No need to transform the nested value, simply return the cached value, - * which is already transformed. - */ - @Override - public T2 getValue() { - return this.cachedValue; - } - - /** - * Transform the specified new value, caching it before returning it. - * A bit of a side-effect, but it seems reasonable. - */ - @Override - protected T2 transformNew(T1 value) { - this.cachedValue = super.transformNew(value); - return this.cachedValue; - } - - /** - * No need to transform the old value, simply return the cached value, - * which is already transformed. - */ - @Override - protected T2 transformOld(T1 value) { - return this.cachedValue; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ChangePropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ChangePropertyValueModelAdapter.java deleted file mode 100644 index 56d8ddd85e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ChangePropertyValueModelAdapter.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.ChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.SimpleChangeListener; - -/** - * This abstract class provides the infrastructure needed to wrap - * a model, "lazily" listen to it, and convert - * its change notifications into property value model change - * notifications. - *

- * Subclasses must override:

    - *
  • {@link #buildValue()}

    - * to return the current property value, as derived from the - * current model - *

- * Subclasses might want to override the following methods - * to improve performance (by not recalculating the value, if possible):
    - *
  • {@link #modelChanged(ChangeEvent event)} - *
  • {@link #buildChangeListener()} - *
- */ -public abstract class ChangePropertyValueModelAdapter - extends AbstractPropertyValueModelAdapter -{ - /** The wrapped model. */ - protected final Model model; - - /** A listener that allows us to synch with changes to the wrapped collection holder. */ - protected final ChangeListener changeListener; - - - // ********** constructor/initialization ********** - - /** - * Construct a property value model with the specified wrapped model. - */ - protected ChangePropertyValueModelAdapter(Model model) { - super(); - this.model = model; - this.changeListener = this.buildChangeListener(); - } - - protected ChangeListener buildChangeListener() { - return new SimpleChangeListener() { - @Override - protected void modelChanged(ChangeEvent event) { - ChangePropertyValueModelAdapter.this.modelChanged(event); - } - @Override - public String toString() { - return "change listener command"; //$NON-NLS-1$ - } - }; - } - - - // ********** behavior ********** - - /** - * Start listening to the model. - */ - @Override - protected void engageModel_() { - this.model.addChangeListener(this.changeListener); - } - - /** - * Stop listening to the model. - */ - @Override - protected void disengageModel_() { - this.model.removeChangeListener(this.changeListener); - } - - - // ********** change support ********** - - /** - * The wrapped model has changed; - * propagate the change notification appropriately. - */ - protected void modelChanged(@SuppressWarnings("unused") ChangeEvent event) { - // by default, simply recalculate the value and fire an event - this.propertyChanged(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionAspectAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionAspectAdapter.java deleted file mode 100644 index b9a0cf9362..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionAspectAdapter.java +++ /dev/null @@ -1,158 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Arrays; -import java.util.Collection; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * This extension of {@link AspectCollectionValueModelAdapter} provides - * basic collection change support. - * This converts a set of one or more collections into - * a single {@link #VALUES} collection. - *

- * The typical subclass will override the following methods (see the descriptions - * in {@link AspectCollectionValueModelAdapter}):

    - *
  • {@link #getIterable()} - *
  • {@link #size_()} - *
  • {@link #iterator_()} - *
  • {@link #iterator()} - *
  • {@link #size()} - *
- */ -public abstract class CollectionAspectAdapter - extends AspectCollectionValueModelAdapter -{ - /** - * The name of the subject's collections that we use for the value. - */ - protected final String[] collectionNames; - protected static final String[] EMPTY_COLLECTION_NAMES = new String[0]; - - /** A listener that listens to the subject's collection aspects. */ - protected final CollectionChangeListener collectionChangeListener; - - - // ********** constructors ********** - - /** - * Construct a collection aspect adapter for the specified subject - * and collection. - */ - protected CollectionAspectAdapter(String collectionName, S subject) { - this(new String[] {collectionName}, subject); - } - - /** - * Construct a collection aspect adapter for the specified subject - * and collections. - */ - protected CollectionAspectAdapter(String[] collectionNames, S subject) { - this(new StaticPropertyValueModel(subject), collectionNames); - } - - /** - * Construct a collection aspect adapter for the specified subject holder - * and collections. - */ - protected CollectionAspectAdapter(PropertyValueModel subjectHolder, String... collectionNames) { - super(subjectHolder); - this.collectionNames = collectionNames; - this.collectionChangeListener = this.buildCollectionChangeListener(); - } - - /** - * Construct a collection aspect adapter for the specified subject holder - * and collections. - */ - protected CollectionAspectAdapter(PropertyValueModel subjectHolder, Collection collectionNames) { - this(subjectHolder, collectionNames.toArray(new String[collectionNames.size()])); - } - - /** - * Construct a collection aspect adapter for an "unchanging" collection in - * the specified subject. This is useful for a collection aspect that does not - * change for a particular subject; but the subject will change, resulting in - * a new collection. - */ - protected CollectionAspectAdapter(PropertyValueModel subjectHolder) { - this(subjectHolder, EMPTY_COLLECTION_NAMES); - } - - - // ********** initialization ********** - - protected CollectionChangeListener buildCollectionChangeListener() { - // transform the subject's collection change events into VALUES collection change events - return new CollectionChangeListener() { - public void itemsAdded(CollectionAddEvent event) { - CollectionAspectAdapter.this.itemsAdded(event); - } - public void itemsRemoved(CollectionRemoveEvent event) { - CollectionAspectAdapter.this.itemsRemoved(event); - } - public void collectionCleared(CollectionClearEvent event) { - CollectionAspectAdapter.this.collectionCleared(event); - } - public void collectionChanged(CollectionChangeEvent event) { - CollectionAspectAdapter.this.collectionChanged(event); - } - @Override - public String toString() { - return "collection change listener: " + Arrays.asList(CollectionAspectAdapter.this.collectionNames); //$NON-NLS-1$ - } - }; - } - - - // ********** AspectAdapter implementation ********** - - @Override - protected void engageSubject_() { - for (String collectionName : this.collectionNames) { - ((Model) this.subject).addCollectionChangeListener(collectionName, this.collectionChangeListener); - } - } - - @Override - protected void disengageSubject_() { - for (String collectionName : this.collectionNames) { - ((Model) this.subject).removeCollectionChangeListener(collectionName, this.collectionChangeListener); - } - } - - - // ********** behavior ********** - - protected void itemsAdded(CollectionAddEvent event) { - this.fireItemsAdded(event.clone(this, VALUES)); - } - - protected void itemsRemoved(CollectionRemoveEvent event) { - this.fireItemsRemoved(event.clone(this, VALUES)); - } - - protected void collectionCleared(CollectionClearEvent event) { - this.fireCollectionCleared(event.clone(this, VALUES)); - } - - protected void collectionChanged(CollectionChangeEvent event) { - this.fireCollectionChanged(event.clone(this, VALUES)); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionListValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionListValueModelAdapter.java deleted file mode 100644 index 4c3d8b4cca..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionListValueModelAdapter.java +++ /dev/null @@ -1,217 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyListIterator; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * An adapter that allows us to make a {@link CollectionValueModel} behave like - * a read-only {@link ListValueModel}, sorta. - *

- * To maintain a reasonably consistent appearance to client code, we - * keep an internal list somewhat in synch with the wrapped collection. - *

- * NB: Since we only listen to the wrapped collection when we have - * listeners ourselves and we can only stay in synch with the wrapped - * collection while we are listening to it, results to various methods - * (e.g. {@link #size()}, {@link #get(int)}) will be unpredictable whenever - * we do not have any listeners. This should not be too painful since, - * most likely, clients will also be listeners. - */ -public class CollectionListValueModelAdapter - extends AbstractListValueModel - implements ListValueModel -{ - /** The wrapped collection value model. */ - protected final CollectionValueModel collectionHolder; - - /** A listener that forwards any events fired by the collection holder. */ - protected final CollectionChangeListener collectionChangeListener; - - /** - * Our internal list, which holds the same elements as - * the wrapped collection, but keeps them in order. - */ - // we declare this an ArrayList so we can use #clone() and #ensureCapacity(int) - protected final ArrayList list; - - - // ********** constructors ********** - - /** - * Wrap the specified collection value model. - */ - public CollectionListValueModelAdapter(CollectionValueModel collectionHolder) { - super(); - if (collectionHolder == null) { - throw new NullPointerException(); - } - this.collectionHolder = collectionHolder; - this.collectionChangeListener = this.buildCollectionChangeListener(); - this.list = new ArrayList(collectionHolder.size()); - // postpone building the list and listening to the underlying collection - // until we have listeners ourselves... - } - - - // ********** initialization ********** - - /** - * The wrapped collection has changed, forward an equivalent - * list change event to our listeners. - */ - protected CollectionChangeListener buildCollectionChangeListener() { - return new CollectionChangeListener() { - public void itemsAdded(CollectionAddEvent event) { - CollectionListValueModelAdapter.this.itemsAdded(event); - } - public void itemsRemoved(CollectionRemoveEvent event) { - CollectionListValueModelAdapter.this.itemsRemoved(event); - } - public void collectionCleared(CollectionClearEvent event) { - CollectionListValueModelAdapter.this.collectionCleared(event); - } - public void collectionChanged(CollectionChangeEvent event) { - CollectionListValueModelAdapter.this.collectionChanged(event); - } - @Override - public String toString() { - return "collection change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** ListValueModel implementation ********** - - public Iterator iterator() { - return this.listIterator(); - } - - public ListIterator listIterator() { - return new ReadOnlyListIterator(this.list); - } - - public E get(int index) { - return this.list.get(index); - } - - public int size() { - return this.list.size(); - } - - public Object[] toArray() { - return this.list.toArray(); - } - - - // ********** behavior ********** - - @Override - protected void engageModel() { - this.collectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.collectionChangeListener); - // synch our list *after* we start listening to the collection holder, - // since its value might change when a listener is added - this.buildList(); - } - - @Override - protected void disengageModel() { - this.collectionHolder.removeCollectionChangeListener(CollectionValueModel.VALUES, this.collectionChangeListener); - // clear out the list when we are not listening to the collection holder - this.list.clear(); - } - - protected void buildList() { - // if the new collection is empty, do nothing - int size = this.collectionHolder.size(); - if (size != 0) { - this.buildList(size); - } - } - - protected void buildList(int size) { - this.list.ensureCapacity(size); - for (E each : this.collectionHolder) { - this.list.add(each); - } - } - - protected void itemsAdded(CollectionAddEvent event) { - this.addItemsToList(this.indexToAddItems(), this.getItems(event), this.list, LIST_VALUES); - } - - protected int indexToAddItems() { - return this.list.size(); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getItems(CollectionAddEvent event) { - return (Iterable) event.getItems(); - } - - protected void itemsRemoved(CollectionRemoveEvent event) { - this.removeItemsFromList(this.getItems(event), this.list, LIST_VALUES); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getItems(CollectionRemoveEvent event) { - return (Iterable) event.getItems(); - } - - protected void collectionCleared(@SuppressWarnings("unused") CollectionClearEvent event) { - this.clearList(this.list, LIST_VALUES); - } - - /** - * synchronize our internal list with the wrapped collection - * and fire the appropriate events - */ - protected void collectionChanged(@SuppressWarnings("unused") CollectionChangeEvent event) { - int size = this.collectionHolder.size(); - if (size == 0) { - if (this.list.isEmpty()) { - // no change - } else { - this.clearList(this.list, LIST_VALUES); - } - } else { - if (this.list.isEmpty()) { - this.buildList(size); - this.fireItemsAdded(LIST_VALUES, 0, this.list); - } else { - this.synchronizeList(this.buildSyncList(), this.list, LIST_VALUES); - } - } - } - - protected Iterable buildSyncList() { - return this.collectionHolder; - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.list); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionPropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionPropertyValueModelAdapter.java deleted file mode 100644 index 24d18b27ab..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionPropertyValueModelAdapter.java +++ /dev/null @@ -1,139 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; - -/** - * This abstract class provides the infrastructure needed to wrap - * a collection value model, "lazily" listen to it, and convert - * its change notifications into property value model change - * notifications. - *

- * Subclasses must override:

    - *
  • {@link #buildValue()}

    - * to return the current property value, as derived from the - * current collection value - *

- * Subclasses might want to override the following methods - * to improve performance (by not recalculating the value, if possible):
    - *
  • {@link #itemsAdded(CollectionAddEvent event)} - *
  • {@link #itemsRemoved(CollectionRemoveEvent event)} - *
  • {@link #collectionCleared(CollectionClearEvent event)} - *
  • {@link #collectionChanged(CollectionChangeEvent event)} - *
- */ -public abstract class CollectionPropertyValueModelAdapter - extends AbstractPropertyValueModelAdapter -{ - /** The wrapped collection value model. */ - protected final CollectionValueModel collectionModel; - - /** A listener that allows us to synch with changes to the wrapped collection holder. */ - protected final CollectionChangeListener collectionChangeListener; - - - // ********** constructor/initialization ********** - - /** - * Construct a property value model with the specified wrapped - * collection value model. - */ - protected CollectionPropertyValueModelAdapter(CollectionValueModel collectionModel) { - super(); - this.collectionModel = collectionModel; - this.collectionChangeListener = this.buildCollectionChangeListener(); - } - - protected CollectionChangeListener buildCollectionChangeListener() { - return new CollectionChangeListener() { - public void itemsAdded(CollectionAddEvent event) { - CollectionPropertyValueModelAdapter.this.itemsAdded(event); - } - public void itemsRemoved(CollectionRemoveEvent event) { - CollectionPropertyValueModelAdapter.this.itemsRemoved(event); - } - public void collectionCleared(CollectionClearEvent event) { - CollectionPropertyValueModelAdapter.this.collectionCleared(event); - } - public void collectionChanged(CollectionChangeEvent event) { - CollectionPropertyValueModelAdapter.this.collectionChanged(event); - } - @Override - public String toString() { - return "collection change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** behavior ********** - - /** - * Start listening to the collection holder. - */ - @Override - protected void engageModel_() { - this.collectionModel.addCollectionChangeListener(CollectionValueModel.VALUES, this.collectionChangeListener); - } - - /** - * Stop listening to the collection holder. - */ - @Override - protected void disengageModel_() { - this.collectionModel.removeCollectionChangeListener(CollectionValueModel.VALUES, this.collectionChangeListener); - } - - - // ********** collection change support ********** - - /** - * Items were added to the wrapped collection holder; - * propagate the change notification appropriately. - */ - protected void itemsAdded(@SuppressWarnings("unused") CollectionAddEvent event) { - // by default, simply recalculate the value and fire an event - this.propertyChanged(); - } - - /** - * Items were removed from the wrapped collection holder; - * propagate the change notification appropriately. - */ - protected void itemsRemoved(@SuppressWarnings("unused") CollectionRemoveEvent event) { - // by default, simply recalculate the value and fire an event - this.propertyChanged(); - } - - /** - * The wrapped collection holder was cleared; - * propagate the change notification appropriately. - */ - protected void collectionCleared(@SuppressWarnings("unused") CollectionClearEvent event) { - // by default, simply recalculate the value and fire an event - this.propertyChanged(); - } - - /** - * The value of the wrapped collection holder has changed; - * propagate the change notification appropriately. - */ - protected void collectionChanged(@SuppressWarnings("unused") CollectionChangeEvent event) { - // by default, simply recalculate the value and fire an event - this.propertyChanged(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionValueModelWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionValueModelWrapper.java deleted file mode 100644 index a791dcb3d3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CollectionValueModelWrapper.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; - -/** - * This abstract class provides the infrastructure needed to wrap - * another collection value model, "lazily" listen to it, and propagate - * its change notifications. Subclasses must implement the appropriate - * {@link CollectionValueModel}. - */ -public abstract class CollectionValueModelWrapper - extends AbstractCollectionValueModel -{ - /** The wrapped collection value model. */ - protected final CollectionValueModel collectionHolder; - - /** A listener that allows us to synch with changes to the wrapped collection holder. */ - protected final CollectionChangeListener collectionChangeListener; - - - // ********** constructors ********** - - /** - * Construct a collection value model with the specified wrapped - * collection value model. - */ - protected CollectionValueModelWrapper(CollectionValueModel collectionHolder) { - super(); - this.collectionHolder = collectionHolder; - this.collectionChangeListener = this.buildCollectionChangeListener(); - } - - - // ********** initialization ********** - - protected CollectionChangeListener buildCollectionChangeListener() { - return new CollectionChangeListener() { - public void itemsAdded(CollectionAddEvent event) { - CollectionValueModelWrapper.this.itemsAdded(event); - } - public void itemsRemoved(CollectionRemoveEvent event) { - CollectionValueModelWrapper.this.itemsRemoved(event); - } - public void collectionCleared(CollectionClearEvent event) { - CollectionValueModelWrapper.this.collectionCleared(event); - } - public void collectionChanged(CollectionChangeEvent event) { - CollectionValueModelWrapper.this.collectionChanged(event); - } - @Override - public String toString() { - return "collection change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** AbstractCollectionValueModel implementation ********** - - /** - * Start listening to the collection holder. - */ - @Override - protected void engageModel() { - this.collectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.collectionChangeListener); - } - - /** - * Stop listening to the collection holder. - */ - @Override - protected void disengageModel() { - this.collectionHolder.removeCollectionChangeListener(CollectionValueModel.VALUES, this.collectionChangeListener); - } - - - // ********** helper methods ********** - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getItems(CollectionAddEvent event) { - return (Iterable) event.getItems(); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getItems(CollectionRemoveEvent event) { - return (Iterable) event.getItems(); - } - - - // ********** collection change support ********** - - /** - * Items were added to the wrapped collection holder; - * propagate the change notification appropriately. - */ - protected abstract void itemsAdded(CollectionAddEvent event); - - /** - * Items were removed from the wrapped collection holder; - * propagate the change notification appropriately. - */ - protected abstract void itemsRemoved(CollectionRemoveEvent event); - - /** - * The wrapped collection holder was cleared; - * propagate the change notification appropriately. - */ - protected abstract void collectionCleared(CollectionClearEvent event); - - /** - * The value of the wrapped collection holder has changed; - * propagate the change notification appropriately. - */ - protected abstract void collectionChanged(CollectionChangeEvent event); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeBooleanPropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeBooleanPropertyValueModel.java deleted file mode 100644 index acedc5ebb4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeBooleanPropertyValueModel.java +++ /dev/null @@ -1,338 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Collection; - -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * A CompositeBooleanPropertyValueModel adapts a - * {@link CollectionValueModel} holding boolean {@link PropertyValueModel}s - * to a single boolean {@link PropertyValueModel}. The composite value is - * determined by the {@link CompositeBooleanPropertyValueModel.Adapter} provided - * at construction. Typically the composite will be either an AND or an OR of - * all the boolean values. - *

- * If there are no boolean {@link PropertyValueModel}s, the composite - * will return its default value; which, by default, is null. - *

- * NB: None of the wrapped boolean models can return a - * null value or this class will throw an exception. The assumption - * is that all the wrapped boolean models are configured with "default" values - * that determine the model's value (TRUE or FALSE) when null. - */ -public class CompositeBooleanPropertyValueModel - extends CompositePropertyValueModel -{ - /** - * Calculation of the model's value is delegated to this adapter. - */ - protected final Adapter adapter; - - /** - * The default setting for the composite boolean property value model; - * for when the underlying collection model is empty. - * The default [default value] is null. - */ - private final Boolean defaultValue; - - - // ********** AND factory methods ********** - - /** - * Construct a boolean property value model that is a composite AND of the - * specified boolean property value models; i.e. the model's value is true - * if all the contained models are true, otherwise its value is false. - * The model's default value, when it contains no nested models, is - * null. - */ - public static CompositeBooleanPropertyValueModel and(PropertyValueModel... array) { - return new CompositeBooleanPropertyValueModel(AND_ADAPTER, array); - } - - /** - * Construct a boolean property value model that is a composite AND of the - * specified boolean property value models; i.e. the model's value is true - * if all the contained models are true, otherwise its value is false. - * When the model contains no nested models, its value will be the - * specified default. - */ - public static CompositeBooleanPropertyValueModel and(Boolean defaultValue, PropertyValueModel... array) { - return new CompositeBooleanPropertyValueModel(AND_ADAPTER, defaultValue, array); - } - - /** - * Construct a boolean property value model that is a composite AND of the - * specified boolean property value models; i.e. the model's value is true - * if all the contained models are true, otherwise its value is false. - * The model's default value, when it contains no nested models, is - * null. - */ - public static > CompositeBooleanPropertyValueModel and(Collection collection) { - return new CompositeBooleanPropertyValueModel(AND_ADAPTER, collection); - } - - /** - * Construct a boolean property value model that is a composite AND of the - * specified boolean property value models; i.e. the model's value is true - * if all the contained models are true, otherwise its value is false. - * When the model contains no nested models, its value will be the - * specified default. - */ - public static > CompositeBooleanPropertyValueModel and(Boolean defaultValue, Collection collection) { - return new CompositeBooleanPropertyValueModel(AND_ADAPTER, defaultValue, collection); - } - - /** - * Construct a boolean property value model that is a composite AND of the - * specified boolean property value models; i.e. the model's value is true - * if all the contained models are true, otherwise its value is false. - * The model's default value, when it contains no nested models, is - * null. - */ - public static CompositeBooleanPropertyValueModel and(CollectionValueModel> collectionModel) { - return new CompositeBooleanPropertyValueModel(AND_ADAPTER, collectionModel); - } - - /** - * Construct a boolean property value model that is a composite AND of the - * specified boolean property value models; i.e. the model's value is true - * if all the contained models are true, otherwise its value is false. - * When the model contains no nested models, its value will be the - * specified default. - */ - public static CompositeBooleanPropertyValueModel and(Boolean defaultValue, CollectionValueModel> collectionModel) { - return new CompositeBooleanPropertyValueModel(AND_ADAPTER, defaultValue, collectionModel); - } - - - // ********** OR factory methods ********** - - /** - * Construct a boolean property value model that is a composite OR of the - * specified boolean property value models; i.e. the model's value is false - * if all the contained models are false, otherwise its value is true. - * The model's default value, when it contains no nested models, is - * null. - */ - public static CompositeBooleanPropertyValueModel or(PropertyValueModel... array) { - return new CompositeBooleanPropertyValueModel(OR_ADAPTER, array); - } - - /** - * Construct a boolean property value model that is a composite OR of the - * specified boolean property value models; i.e. the model's value is false - * if all the contained models are false, otherwise its value is true. - * When the model contains no nested models, its value will be the - * specified default. - */ - public static CompositeBooleanPropertyValueModel or(Boolean defaultValue, PropertyValueModel... array) { - return new CompositeBooleanPropertyValueModel(OR_ADAPTER, defaultValue, array); - } - - /** - * Construct a boolean property value model that is a composite OR of the - * specified boolean property value models; i.e. the model's value is false - * if all the contained models are false, otherwise its value is true. - * The model's default value, when it contains no nested models, is - * null. - */ - public static > CompositeBooleanPropertyValueModel or(Collection collection) { - return new CompositeBooleanPropertyValueModel(OR_ADAPTER, collection); - } - - /** - * Construct a boolean property value model that is a composite OR of the - * specified boolean property value models; i.e. the model's value is false - * if all the contained models are false, otherwise its value is true. - * When the model contains no nested models, its value will be the - * specified default. - */ - public static > CompositeBooleanPropertyValueModel or(Boolean defaultValue, Collection collection) { - return new CompositeBooleanPropertyValueModel(OR_ADAPTER, defaultValue, collection); - } - - /** - * Construct a boolean property value model that is a composite OR of the - * specified boolean property value models; i.e. the model's value is false - * if all the contained models are false, otherwise its value is true. - * The model's default value, when it contains no nested models, is - * null. - */ - public static CompositeBooleanPropertyValueModel or(CollectionValueModel> collectionModel) { - return new CompositeBooleanPropertyValueModel(OR_ADAPTER, collectionModel); - } - - /** - * Construct a boolean property value model that is a composite OR of the - * specified boolean property value models; i.e. the model's value is false - * if all the contained models are false, otherwise its value is true. - * When the model contains no nested models, its value will be the - * specified default. - */ - public static CompositeBooleanPropertyValueModel or(Boolean defaultValue, CollectionValueModel> collectionModel) { - return new CompositeBooleanPropertyValueModel(OR_ADAPTER, defaultValue, collectionModel); - } - - - // ********** constructors ********** - - /** - * Construct a boolean property value model that is a composite of the specified - * boolean property value models, as defined by the specified adapter. - * The model's default value, when it contains no nested models, is - * null. - */ - public CompositeBooleanPropertyValueModel(Adapter adapter, PropertyValueModel... array) { - this(adapter, null, array); - } - - /** - * Construct a boolean property value model that is a composite of the specified - * boolean property value models, as defined by the specified adapter. - * When the model contains no nested models, its value will be the - * specified default. - */ - public CompositeBooleanPropertyValueModel(Adapter adapter, Boolean defaultValue, PropertyValueModel... array) { - super(array); - this.adapter = adapter; - this.defaultValue = defaultValue; - } - - /** - * Construct a boolean property value model that is a composite of the specified - * boolean property value models, as defined by the specified adapter. - * The model's default value, when it contains no nested models, is - * null. - */ - public > CompositeBooleanPropertyValueModel(Adapter adapter, Collection collection) { - this(adapter, null, collection); - } - - /** - * Construct a boolean property value model that is a composite of the specified - * boolean property value models, as defined by the specified adapter. - * When the model contains no nested models, its value will be the - * specified default. - */ - public > CompositeBooleanPropertyValueModel(Adapter adapter, Boolean defaultValue, Collection collection) { - super(collection); - this.adapter = adapter; - this.defaultValue = defaultValue; - } - - /** - * Construct a boolean property value model that is a composite of the specified - * boolean property value models, as defined by the specified adapter. - * The model's default value, when it contains no nested models, is - * null. - */ - public CompositeBooleanPropertyValueModel(Adapter adapter, CollectionValueModel> collectionModel) { - this(adapter, null, collectionModel); - } - - /** - * Construct a boolean property value model that is a composite of the specified - * boolean property value models, as defined by the specified adapter. - * When the model contains no nested models, its value will be the - * specified default. - */ - public CompositeBooleanPropertyValueModel(Adapter adapter, Boolean defaultValue, CollectionValueModel> collectionModel) { - super(collectionModel); - this.adapter = adapter; - this.defaultValue = defaultValue; - } - - - // ********** implementation ********** - - /** - * Return true if all the contained booleans are true; otherwise return - * false. - */ - @Override - protected Boolean buildValue() { - return (this.collectionModel.size() == 0) ? this.defaultValue : this.buildValue_(); - } - - protected Boolean buildValue_() { - return this.adapter.buildValue(this.getBooleans()); - } - - protected Iterable getBooleans() { - return new TransformationIterable, Boolean>(this.getCollectionModel()) { - @Override - protected Boolean transform(PropertyValueModel booleanModel) { - return booleanModel.getValue(); - } - }; - } - - @Override - @SuppressWarnings("unchecked") - protected CollectionValueModel> getCollectionModel() { - return (CollectionValueModel>) super.getCollectionModel(); - } - - - // ********** adapter ********** - - /** - * This adapter allows the {@link CompositeBooleanPropertyValueModel} to be - * pluggable. - */ - public interface Adapter { - /** - * Return the composite boolean value of the specified collection - * of boolean models. - */ - Boolean buildValue(Iterable booleans); - } - - /** - * Return true if all the booleans are true; otherwise return false. - */ - public static final Adapter AND_ADAPTER = new Adapter() { - public Boolean buildValue(Iterable booleans) { - for (Boolean b : booleans) { - if ( ! b.booleanValue()) { - return Boolean.FALSE; - } - } - return Boolean.TRUE; - } - @Override - public String toString() { - return "AND_ADAPTER"; //$NON-NLS-1$ - } - }; - - /** - * Return false if all the booleans are false; otherwise return true. - */ - public static final Adapter OR_ADAPTER = new Adapter() { - public Boolean buildValue(Iterable booleans) { - for (Boolean b : booleans) { - if (b.booleanValue()) { - return Boolean.TRUE; - } - } - return Boolean.FALSE; - } - @Override - public String toString() { - return "OR_ADAPTER"; //$NON-NLS-1$ - } - }; - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeCollectionValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeCollectionValueModel.java deleted file mode 100644 index 72f16a3344..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeCollectionValueModel.java +++ /dev/null @@ -1,448 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.IdentityHashMap; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.NullList; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * A CompositeCollectionValueModel wraps another - * {@link CollectionValueModel} and uses a {@link Transformer} - * to convert each item in the wrapped collection to yet another - * {@link CollectionValueModel}. This composite collection contains - * the combined items from all these component collections. - *

- * NB: The wrapped collection must be an "identity set" that does not - * contain the same item twice or this class will throw an exception. - *

- * Terminology:

    - *
  • sources - the items in the wrapped collection value model; these - * are converted into component CVMs by the transformer - *
  • component CVMs - the component collection value models that are combined - * by this composite collection value model - *
  • items - the items held by the component CVMs - *
- */ -public class CompositeCollectionValueModel - extends CollectionValueModelWrapper - implements CollectionValueModel -{ - /** - * This is the (optional) user-supplied object that transforms - * the items in the wrapped collection to collection value models. - */ - private final Transformer> transformer; - - /** - * Cache of the component collection value models that - * were generated by the transformer; keyed by the item - * in the wrapped collection that was passed to the transformer. - */ - private final IdentityHashMap> componentCVMs = - new IdentityHashMap>(); - - /** - * Cache of the collections corresponding to the component - * collection value models above; keyed by the component - * collection value models. - * Use {@link ArrayList}s so we can use {@link ArrayList}-specific methods - * (e.g. {@link ArrayList#clone()} and {@link ArrayList#ensureCapacity(int)}). - */ - private final IdentityHashMap, ArrayList> collections = - new IdentityHashMap, ArrayList>(); - - /** Listener that listens to all the component collection value models. */ - private final CollectionChangeListener componentCVMListener; - - /** Cache the size of the composite collection. */ - private int size; - - - // ********** constructors ********** - - /** - * Construct a collection value model with the specified wrapped - * collection value model. Use this constructor if
    - *
  • the wrapped collection value model already contains other - * collection value models, or - *
  • you want to override {@link #transform(E1)} - * instead of building a {@link Transformer} - *
- */ - public CompositeCollectionValueModel(CollectionValueModel collectionHolder) { - this(collectionHolder, Transformer.Null.>instance()); - } - - /** - * Construct a collection value model with the specified wrapped - * collection value model and transformer. - */ - public CompositeCollectionValueModel(CollectionValueModel collectionHolder, Transformer> transformer) { - super(collectionHolder); - this.transformer = transformer; - this.componentCVMListener = this.buildComponentListener(); - this.size = 0; - } - - /** - * Construct a collection value model with the specified wrapped - * list value model. Use this constructor if
    - *
  • the wrapped collection value model already contains other - * collection value models, or - *
  • you want to override {@link #transform(E1)} - * instead of building a {@link Transformer} - *
- */ - public CompositeCollectionValueModel(ListValueModel listHolder) { - this(new ListCollectionValueModelAdapter(listHolder)); - } - - /** - * Construct a collection value model with the specified wrapped - * list value model and transformer. - */ - public CompositeCollectionValueModel(ListValueModel listHolder, Transformer> transformer) { - this(new ListCollectionValueModelAdapter(listHolder), transformer); - } - - /** - * Construct a collection value model with the specified, unchanging, wrapped - * collection. Use this constructor if
    - *
  • the wrapped collection value model already contains other - * collection value models, or - *
  • you want to override {@link #transform(E1)} - * instead of building a {@link Transformer} - *
- */ - public CompositeCollectionValueModel(Collection collection) { - this(new StaticCollectionValueModel(collection)); - } - - /** - * Construct a collection value model with the specified, unchanging, wrapped - * collection and transformer. - */ - public CompositeCollectionValueModel(Collection collection, Transformer> transformer) { - this(new StaticCollectionValueModel(collection), transformer); - } - - /** - * Construct a collection value model with the specified, unchanging, wrapped - * collection. Use this constructor if
    - *
  • the wrapped collection value model already contains other - * collection value models, or - *
  • you want to override {@link #transform(E1)} - * instead of building a {@link Transformer} - *
- */ - public CompositeCollectionValueModel(E1... collection) { - this(new StaticCollectionValueModel(collection)); - } - - /** - * Construct a collection value model with the specified, unchanging, wrapped - * collection and transformer. - */ - public CompositeCollectionValueModel(E1[] collection, Transformer> transformer) { - this(new StaticCollectionValueModel(collection), transformer); - } - - - // ********** initialization ********** - - protected CollectionChangeListener buildComponentListener() { - return new CollectionChangeListener() { - public void itemsAdded(CollectionAddEvent event) { - CompositeCollectionValueModel.this.componentItemsAdded(event); - } - public void itemsRemoved(CollectionRemoveEvent event) { - CompositeCollectionValueModel.this.componentItemsRemoved(event); - } - public void collectionCleared(CollectionClearEvent event) { - CompositeCollectionValueModel.this.componentCollectionCleared(event); - } - public void collectionChanged(CollectionChangeEvent event) { - CompositeCollectionValueModel.this.componentCollectionChanged(event); - } - @Override - public String toString() { - return "component listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** CollectionValueModel implementation ********** - - public Iterator iterator() { - return new CompositeIterator(this.buildCollectionsIterators()); - } - - protected Iterator> buildCollectionsIterators() { - return new TransformationIterator, Iterator>(this.collections.values().iterator()) { - @Override - protected Iterator transform(ArrayList next) { - return next.iterator(); - } - }; - } - - public int size() { - return this.size; - } - - - // ********** CollectionValueModelWrapper overrides/implementation ********** - - @Override - protected void engageModel() { - super.engageModel(); - // synch our cache *after* we start listening to the wrapped collection, - // since its value might change when a listener is added - this.addAllComponentSources(); - } - - /** - * Transform all the sources to collection value models - * and add their items to our cache, with no event notification. - */ - protected void addAllComponentSources() { - for (E1 source : this.collectionHolder) { - this.addComponentSource(source, NullList.instance()); - } - } - - @Override - protected void disengageModel() { - super.disengageModel(); - // stop listening to the components... - for (CollectionValueModel componentCVM : this.componentCVMs.values()) { - componentCVM.removeCollectionChangeListener(VALUES, this.componentCVMListener); - } - // ...and clear the cache - this.componentCVMs.clear(); - this.collections.clear(); - this.size = 0; - } - - /** - * Some component sources were added; - * add their corresponding items to our cache. - */ - @Override - protected void itemsAdded(CollectionAddEvent event) { - ArrayList addedItems = new ArrayList(); - for (E1 item : this.getItems(event)) { - this.addComponentSource(item, addedItems); - } - this.fireItemsAdded(VALUES, addedItems); - } - - /** - * Transform the specified source to a collection value model - * and add its items to our cache and the "collecting parameter". - */ - protected void addComponentSource(E1 source, List addedItems) { - CollectionValueModel componentCVM = this.transform(source); - if (this.componentCVMs.put(source, componentCVM) != null) { - throw new IllegalStateException("duplicate component: " + source); //$NON-NLS-1$ - } - componentCVM.addCollectionChangeListener(VALUES, this.componentCVMListener); - ArrayList componentCollection = new ArrayList(componentCVM.size()); - if (this.collections.put(componentCVM, componentCollection) != null) { - throw new IllegalStateException("duplicate collection: " + source); //$NON-NLS-1$ - } - this.addComponentItems(componentCVM, componentCollection); - addedItems.addAll(componentCollection); - } - - /** - * Add the items in the specified component CVM to the specified component - * collection. - */ - protected void addComponentItems(CollectionValueModel componentCVM, ArrayList componentCollection) { - int itemsSize = componentCVM.size(); - this.size += itemsSize; - componentCollection.ensureCapacity(componentCollection.size() + itemsSize); - CollectionTools.addAll(componentCollection, componentCVM); - } - - /** - * Some component sources were removed; - * remove their corresponding items from our cache. - */ - @Override - protected void itemsRemoved(CollectionRemoveEvent event) { - ArrayList removedItems = new ArrayList(); - for (E1 item : this.getItems(event)) { - this.removeComponentSource(item, removedItems); - } - this.fireItemsRemoved(VALUES, removedItems); - } - - /** - * Remove the items corresponding to the specified source - * from our cache. - */ - protected void removeComponentSource(E1 source, List removedItems) { - CollectionValueModel componentCVM = this.componentCVMs.remove(source); - if (componentCVM == null) { - throw new IllegalStateException("missing component: " + source); //$NON-NLS-1$ - } - componentCVM.removeCollectionChangeListener(VALUES, this.componentCVMListener); - ArrayList componentCollection = this.collections.remove(componentCVM); - if (componentCollection == null) { - throw new IllegalStateException("missing collection: " + source); //$NON-NLS-1$ - } - removedItems.addAll(componentCollection); - this.removeComponentItems(componentCollection); - } - - /** - * Update our size and collection cache. - */ - protected void removeComponentItems(ArrayList componentCollection) { - this.size -= componentCollection.size(); - componentCollection.clear(); - } - - /** - * The component sources cleared; - * clear our cache. - */ - @Override - protected void collectionCleared(CollectionClearEvent event) { - this.removeAllComponentSources(); - this.fireCollectionCleared(VALUES); - } - - protected void removeAllComponentSources() { - // copy the keys so we don't eat our own tail - ArrayList copy = new ArrayList(this.componentCVMs.keySet()); - for (E1 source : copy) { - this.removeComponentSource(source, NullList.instance()); - } - } - - /** - * The component sources changed; - * rebuild our cache. - */ - @Override - protected void collectionChanged(CollectionChangeEvent event) { - this.removeAllComponentSources(); - this.addAllComponentSources(); - this.fireCollectionChanged(VALUES, CollectionTools.collection(this.iterator())); - } - - - // ********** internal methods ********** - - /** - * Transform the specified object into a collection value model. - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link Transformer}. - */ - protected CollectionValueModel transform(E1 value) { - return this.transformer.transform(value); - } - - /** - * One of the component collections had items added; - * synchronize our caches. - */ - protected void componentItemsAdded(CollectionAddEvent event) { - int itemsSize = event.getItemsSize(); - this.size += itemsSize; - - ArrayList componentCollection = this.collections.get(this.componentCVM(event)); - componentCollection.ensureCapacity(componentCollection.size() + itemsSize); - - this.addItemsToCollection(this.getComponentItems(event), componentCollection, VALUES); - } - - /** - * One of the component collections had items removed; - * synchronize our caches. - */ - protected void componentItemsRemoved(CollectionRemoveEvent event) { - this.size -= event.getItemsSize(); - ArrayList componentCollection = this.collections.get(this.componentCVM(event)); - this.removeItemsFromCollection(this.getComponentItems(event), componentCollection, VALUES); - } - - /** - * One of the component collections was cleared; - * synchronize our caches by clearing out the appropriate - * collection. - */ - protected void componentCollectionCleared(CollectionClearEvent event) { - ArrayList componentCollection = this.collections.get(this.componentCVM(event)); - ArrayList removedItems = new ArrayList(componentCollection); - this.removeComponentItems(componentCollection); - this.fireItemsRemoved(VALUES, removedItems); - } - - /** - * One of the component collections changed; - * synchronize our caches by clearing out the appropriate - * collection and then rebuilding it. - */ - protected void componentCollectionChanged(CollectionChangeEvent event) { - CollectionValueModel componentCVM = this.componentCVM(event); - ArrayList componentCollection = this.collections.get(componentCVM); - this.removeComponentItems(componentCollection); - this.addComponentItems(componentCVM, componentCollection); - this.fireCollectionChanged(VALUES, CollectionTools.collection(this.iterator())); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getComponentItems(CollectionAddEvent event) { - return (Iterable) event.getItems(); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getComponentItems(CollectionRemoveEvent event) { - return (Iterable) event.getItems(); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - protected CollectionValueModel componentCVM(CollectionEvent event) { - return (CollectionValueModel) event.getSource(); - } - - @Override - public void toString(StringBuilder sb) { - StringTools.append(sb, this); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeListValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeListValueModel.java deleted file mode 100644 index 3b017b08c9..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositeListValueModel.java +++ /dev/null @@ -1,683 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyCompositeListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationListIterator; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * A CompositeListValueModel wraps another - * {@link ListValueModel} and uses a {@link Transformer} - * to convert each item in the wrapped list to yet another - * {@link ListValueModel}. This composite list contains - * the combined items from all these component lists. - *

- * Terminology:

    - *
  • sources - the items in the wrapped list value model; these - * are converted into component LVMs by the transformer - *
  • component LVMs - the component list value models that are combined - * by this composite list value model - *
  • items - the items held by the component LVMs - *
- */ -public class CompositeListValueModel - extends ListValueModelWrapper - implements ListValueModel -{ - /** - * This is the (optional) user-supplied object that transforms - * the items in the wrapped list to list value models. - */ - private final Transformer> transformer; - - /** - * Cache of the sources, component LVMs, lists. - */ - private final ArrayList infoList = new ArrayList(); - protected class Info { - // the object passed to the transformer - final E1 source; - // the list value model generated by the transformer - final ListValueModel componentLVM; - // cache of the items held by the component LVM - final ArrayList items; - // the component LVM's beginning index within the composite LVM - int begin; - protected Info(E1 source, ListValueModel componentLVM, ArrayList items, int begin) { - super(); - this.source = source; - this.componentLVM = componentLVM; - this.items = items; - this.begin = begin; - } - } - - /** Listener that listens to all the component list value models. */ - private final ListChangeListener componentLVMListener; - - /** Cache the size of the composite list. */ - private int size; - - - // ********** constructors ********** - - /** - * Construct a list value model with the specified wrapped - * list value model. Use this constructor if
    - *
  • the wrapped list value model already contains other - * list value models, or - *
  • you want to override {@link #transform(E1)} - * instead of building a {@link Transformer} - *
- */ - public CompositeListValueModel(ListValueModel listHolder) { - this(listHolder, Transformer.Null.>instance()); - } - - /** - * Construct a list value model with the specified wrapped - * list value model and transformer. - */ - public CompositeListValueModel(ListValueModel listHolder, Transformer> transformer) { - super(listHolder); - this.transformer = transformer; - this.componentLVMListener = this.buildComponentLVMListener(); - this.size = 0; - } - - /** - * Construct a list value model with the specified, unchanging, wrapped - * list. Use this constructor if
    - *
  • the wrapped list value model already contains other - * list value models, or - *
  • you want to override {@link #transform(E1)} - * instead of building a {@link Transformer} - *
- */ - public CompositeListValueModel(List list) { - this(new StaticListValueModel(list)); - } - - /** - * Construct a list value model with the specified, unchanging, wrapped - * list and transformer. - */ - public CompositeListValueModel(List list, Transformer> transformer) { - this(new StaticListValueModel(list), transformer); - } - - /** - * Construct a list value model with the specified, unchanging, wrapped - * list. Use this constructor if
    - *
  • the wrapped list value model already contains other - * list value models, or - *
  • you want to override {@link #transform(E1)} - * instead of building a {@link Transformer} - *
- */ - public CompositeListValueModel(E1... list) { - this(new StaticListValueModel(list)); - } - - /** - * Construct a list value model with the specified, unchanging, wrapped - * list and transformer. - */ - public CompositeListValueModel(E1[] list, Transformer> transformer) { - this(new StaticListValueModel(list), transformer); - } - - - // ********** initialization ********** - - protected ListChangeListener buildComponentLVMListener() { - return new ListChangeListener() { - public void itemsAdded(ListAddEvent event) { - CompositeListValueModel.this.componentItemsAdded(event); - } - public void itemsRemoved(ListRemoveEvent event) { - CompositeListValueModel.this.componentItemsRemoved(event); - } - public void itemsReplaced(ListReplaceEvent event) { - CompositeListValueModel.this.componentItemsReplaced(event); - } - public void itemsMoved(ListMoveEvent event) { - CompositeListValueModel.this.componentItemsMoved(event); - } - public void listCleared(ListClearEvent event) { - CompositeListValueModel.this.componentListCleared(event); - } - public void listChanged(ListChangeEvent event) { - CompositeListValueModel.this.componentListChanged(event); - } - @Override - public String toString() { - return "component LVM listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** ListValueModel implementation ********** - - public E2 get(int index) { - if ((index < 0) || (index >= this.size)) { - throw new IndexOutOfBoundsException("Index: " + index + ", Size: " + this.size); //$NON-NLS-1$ //$NON-NLS-2$ - } - // move backwards through the info list - for (int i = this.infoList.size(); i-- > 0; ) { - Info info = this.infoList.get(i); - if (index >= info.begin) { - return info.items.get(index - info.begin); - } - } - throw new IllegalStateException(); // something is wack - } - - public Iterator iterator() { - return this.listIterator(); - } - - public ListIterator listIterator() { - return new ReadOnlyCompositeListIterator(this.buildListsIterators()); - } - - protected ListIterator> buildListsIterators() { - return new TransformationListIterator>(this.infoList.listIterator()) { - @Override - protected ListIterator transform(Info info) { - return info.items.listIterator(); - } - }; - } - - public int size() { - return this.size; - } - - public Object[] toArray() { - return ArrayTools.array(this.listIterator(), this.size); - } - - - // ********** ListValueModelWrapper overrides/implementation ********** - - @Override - protected void engageModel() { - super.engageModel(); - // synch our cache *after* we start listening to the wrapped list, - // since its value might change when a listener is added - this.addComponentSources(0, this.listHolder, this.listHolder.size(), false); // false = do not fire event - } - - @Override - protected void disengageModel() { - super.disengageModel(); - // stop listening to the component LVMs... - for (Info info : this.infoList) { - info.componentLVM.removeListChangeListener(LIST_VALUES, this.componentLVMListener); - } - // ...and clear the cache - this.infoList.clear(); - this.size = 0; - } - - /** - * Some component sources were added; update our cache. - */ - @Override - protected void itemsAdded(ListAddEvent event) { - this.addComponentSources(event.getIndex(), this.getItems(event), event.getItemsSize(), true); // true = fire event - } - - /** - * Add infos corresponding to the specified sources to our cache. - * Fire the appropriate event if requested. - */ - protected void addComponentSources(int addedSourcesIndex, Iterable addedSources, int addedSourcesSize, boolean fireEvent) { - ArrayList newInfoList = new ArrayList(addedSourcesSize); - // the 'items' are either tacked on to the end or - // at the 'begin' index of the first 'info' that is being pushed back - int newItemsIndex = (addedSourcesIndex == this.infoList.size()) ? this.size : this.infoList.get(addedSourcesIndex).begin; - - int begin = newItemsIndex; - for (E1 source : addedSources) { - ListValueModel componentLVM = this.transform(source); - componentLVM.addListChangeListener(LIST_VALUES, this.componentLVMListener); - ArrayList items = new ArrayList(componentLVM.size()); - CollectionTools.addAll(items, componentLVM.listIterator()); - newInfoList.add(new Info(source, componentLVM, items, begin)); - begin += items.size(); - } - this.infoList.addAll(addedSourcesIndex, newInfoList); - int newItemsSize = begin - newItemsIndex; - this.size += newItemsSize; - - // bump the 'begin' index for all the infos that were pushed back by the insert - int movedInfosIndex = addedSourcesIndex + addedSourcesSize; - for (int i = movedInfosIndex; i < this.infoList.size(); i++) { - this.infoList.get(i).begin += newItemsSize; - } - - if (fireEvent) { - ArrayList newItems = new ArrayList(newItemsSize); - for (int i = addedSourcesIndex; i < movedInfosIndex; i++) { - newItems.addAll(this.infoList.get(i).items); - } - this.fireItemsAdded(LIST_VALUES, newItemsIndex, newItems); - } - } - - /** - * Some component sources were removed; update our cache. - */ - @Override - protected void itemsRemoved(ListRemoveEvent event) { - this.removeComponentSources(event.getIndex(), event.getItemsSize(), true); // true = fire event - } - - /** - * Remove the infos corresponding to the specified sources from our cache. - */ - protected void removeComponentSources(int removedSourcesIndex, int removedSourcesSize, boolean fireEvent) { - int removedItemsIndex = this.infoList.get(removedSourcesIndex).begin; - int movedSourcesIndex = removedSourcesIndex + removedSourcesSize; - int movedItemsIndex = (movedSourcesIndex == this.infoList.size()) ? this.size : this.infoList.get(movedSourcesIndex).begin; - int removedItemsSize = movedItemsIndex - removedItemsIndex; - this.size -= removedItemsSize; - - List subList = this.infoList.subList(removedSourcesIndex, removedSourcesIndex + removedSourcesSize); - ArrayList removedInfoList = new ArrayList(subList); // make a copy - subList.clear(); - - // decrement the 'begin' index for all the infos that were moved forward by the deletes - for (int i = removedSourcesIndex; i < this.infoList.size(); i++) { - this.infoList.get(i).begin -= removedItemsSize; - } - - for (Info removedInfo : removedInfoList) { - removedInfo.componentLVM.removeListChangeListener(LIST_VALUES, this.componentLVMListener); - } - - if (fireEvent) { - ArrayList removedItems = new ArrayList(removedItemsSize); - for (Info removedInfo : removedInfoList) { - removedItems.addAll(removedInfo.items); - } - this.fireItemsRemoved(LIST_VALUES, removedItemsIndex, removedItems); - } - } - - /** - * Some component sources were replaced; update our cache. - */ - @Override - protected void itemsReplaced(ListReplaceEvent event) { - this.replaceComponentSources(event.getIndex(), this.getNewItems(event), event.getItemsSize(), true); // true = fire event - } - - /** - * Replaced component sources will not (typically) map to a set of replaced - * items, so we remove and add the corresponding lists of items, resulting in - * two events. - */ - protected void replaceComponentSources(int replacedSourcesIndex, Iterable newSources, int replacedSourcesSize, boolean fireEvent) { - this.removeComponentSources(replacedSourcesIndex, replacedSourcesSize, fireEvent); - this.addComponentSources(replacedSourcesIndex, newSources, replacedSourcesSize, fireEvent); - } - - /** - * Some component sources were moved; update our cache. - */ - @Override - protected void itemsMoved(ListMoveEvent event) { - this.moveComponentSources(event.getTargetIndex(), event.getSourceIndex(), event.getLength(), true); // true = fire event - } - - protected void moveComponentSources(int targetSourcesIndex, int sourceSourcesIndex, int movedSourcesLength, boolean fireEvent) { - int sourceItemsIndex = this.infoList.get(sourceSourcesIndex).begin; - - int nextSourceSourceIndex = sourceSourcesIndex + movedSourcesLength; - int nextSourceItemIndex = (nextSourceSourceIndex == this.infoList.size()) ? this.size : this.infoList.get(nextSourceSourceIndex).begin; - int moveItemsLength = nextSourceItemIndex - sourceItemsIndex; - - int targetItemsIndex = -1; - if (sourceSourcesIndex > targetSourcesIndex) { - // move from high to low index - targetItemsIndex = this.infoList.get(targetSourcesIndex).begin; - } else { - // move from low to high index (higher items move down during move) - int nextTargetSourceIndex = targetSourcesIndex + movedSourcesLength; - targetItemsIndex = (nextTargetSourceIndex == this.infoList.size()) ? this.size : this.infoList.get(nextTargetSourceIndex).begin; - targetItemsIndex = targetItemsIndex - moveItemsLength; - } - - CollectionTools.move(this.infoList, targetSourcesIndex, sourceSourcesIndex, movedSourcesLength); - - // update the 'begin' indexes of all the affected 'infos' - int min = Math.min(targetSourcesIndex, sourceSourcesIndex); - int max = Math.max(targetSourcesIndex, sourceSourcesIndex) + movedSourcesLength; - int begin = Math.min(targetItemsIndex, sourceItemsIndex); - for (int i = min; i < max; i++) { - Info info = this.infoList.get(i); - info.begin = begin; - begin += info.componentLVM.size(); - } - - if (fireEvent) { - this.fireItemsMoved(LIST_VALUES, targetItemsIndex, sourceItemsIndex, moveItemsLength); - } - } - - /** - * The component sources were cleared; clear our cache. - */ - @Override - protected void listCleared(ListClearEvent event) { - this.clearComponentSources(); - } - - protected void clearComponentSources() { - this.removeComponentSources(0, this.infoList.size(), false); // false = do not fire event - this.fireListCleared(LIST_VALUES); - } - - /** - * The component sources changed; rebuild our cache. - */ - @Override - protected void listChanged(ListChangeEvent event) { - int newSize = this.listHolder.size(); - if (newSize == 0) { - this.clearComponentSources(); - return; - } - - int oldSize = this.infoList.size(); - if (oldSize == 0) { - this.addComponentSources(0, this.listHolder, newSize, true); // true = fire event - return; - } - - int min = Math.min(newSize, oldSize); - // handle replaced sources individually so we don't fire events for unchanged sources - for (int i = 0; i < min; i++) { - E1 newSource = this.listHolder.get(i); - E1 oldSource = this.infoList.get(i).source; - if (this.valuesAreDifferent(newSource, oldSource)) { - this.replaceComponentSources(i, new SingleElementIterable(newSource), 1, true); // true = fire event - } - } - - if (newSize == oldSize) { - return; - } - - if (newSize < oldSize) { - this.removeComponentSources(min, oldSize - newSize, true); // true = fire event - return; - } - - // newSize > oldSize - this.addComponentSources(min, this.buildSubListHolder(min), newSize - oldSize, true); // true = fire event - } - - protected Iterable buildSubListHolder(int fromIndex) { - int listHolderSize = this.listHolder.size(); - return CollectionTools.list(this.listHolder, listHolderSize).subList(fromIndex, listHolderSize); - } - - protected Iterable buildSubListHolder(int fromIndex, int toIndex) { - int listHolderSize = this.listHolder.size(); - return ((fromIndex == 0) && (toIndex == listHolderSize)) ? - this.listHolder : - CollectionTools.list(this.listHolder, listHolderSize).subList(fromIndex, toIndex); - } - - @Override - public void toString(StringBuilder sb) { - StringTools.append(sb, this); - } - - - // ********** internal methods ********** - - /** - * Transform the specified object into a list value model. - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link Transformer}. - */ - protected ListValueModel transform(E1 value) { - return this.transformer.transform(value); - } - - /** - * Return the index of the specified component LVM. - */ - protected int indexOf(ListValueModel componentLVM) { - for (int i = 0; i < this.infoList.size(); i++) { - if (this.infoList.get(i).componentLVM == componentLVM) { - return i; - } - } - throw new IllegalArgumentException("invalid component LVM: " + componentLVM); //$NON-NLS-1$ - } - - /** - * Return the index of the specified event's component LVM. - */ - protected int indexFor(ListEvent event) { - return this.indexOf(this.getComponentLVM(event)); - } - - /** - * Items were added to one of the component lists; - * synchronize our cache. - */ - protected void componentItemsAdded(ListAddEvent event) { - int componentLVMIndex = this.indexFor(event); - this.addComponentItems(componentLVMIndex, this.infoList.get(componentLVMIndex), event.getIndex(), this.getComponentItems(event), event.getItemsSize()); - } - - protected void addComponentItems(int componentLVMIndex, Info info, int addedItemsIndex, Iterable addedItems, int addedItemsSize) { - // update the affected 'begin' indices - for (int i = componentLVMIndex + 1; i < this.infoList.size(); i++) { - this.infoList.get(i).begin += addedItemsSize; - } - this.size += addedItemsSize; - - // synchronize the cached list - CollectionTools.addAll(info.items, addedItemsIndex, addedItems, addedItemsSize); - - // translate the event - this.fireItemsAdded(LIST_VALUES, info.begin + addedItemsIndex, info.items.subList(addedItemsIndex, addedItemsIndex + addedItemsSize)); - } - - /** - * Items were removed from one of the component lists; - * synchronize our cache. - */ - protected void componentItemsRemoved(ListRemoveEvent event) { - // update the affected 'begin' indices - int componentLVMIndex = this.indexFor(event); - int removedItemsSize = event.getItemsSize(); - for (int i = componentLVMIndex + 1; i < this.infoList.size(); i++) { - this.infoList.get(i).begin -= removedItemsSize; - } - this.size -= removedItemsSize; - - // synchronize the cached list - Info info = this.infoList.get(componentLVMIndex); - int itemIndex = event.getIndex(); - info.items.subList(itemIndex, itemIndex + event.getItemsSize()).clear(); - - // translate the event - this.fireItemsRemoved(event.clone(this, LIST_VALUES, info.begin)); - } - - /** - * Items were replaced in one of the component lists; - * synchronize our cache. - */ - protected void componentItemsReplaced(ListReplaceEvent event) { - // no changes to the 'begin' indices or size - - // synchronize the cached list - int componentLVMIndex = this.indexFor(event); - Info info = this.infoList.get(componentLVMIndex); - int i = event.getIndex(); - for (E2 item : this.getComponentItems(event)) { - info.items.set(i++, item); - } - - // translate the event - this.fireItemsReplaced(event.clone(this, LIST_VALUES, info.begin)); - } - - /** - * Items were moved in one of the component lists; - * synchronize our cache. - */ - protected void componentItemsMoved(ListMoveEvent event) { - // no changes to the 'begin' indices or size - - // synchronize the cached list - int componentLVMIndex = this.indexFor(event); - Info info = this.infoList.get(componentLVMIndex); - CollectionTools.move(info.items, event.getTargetIndex(), event.getSourceIndex(), event.getLength()); - - // translate the event - this.fireItemsMoved(event.clone(this, LIST_VALUES, info.begin)); - } - - /** - * One of the component lists was cleared; - * synchronize our cache. - */ - protected void componentListCleared(ListClearEvent event) { - int componentLVMIndex = this.indexFor(event); - this.clearComponentList(componentLVMIndex, this.infoList.get(componentLVMIndex)); - } - - protected void clearComponentList(int componentLVMIndex, Info info) { - // update the affected 'begin' indices - int removedItemsSize = info.items.size(); - if (removedItemsSize == 0) { - return; - } - - for (int i = componentLVMIndex + 1; i < this.infoList.size(); i++) { - this.infoList.get(i).begin -= removedItemsSize; - } - this.size -= removedItemsSize; - - // synchronize the cached list - ArrayList items = new ArrayList(info.items); // make a copy - info.items.clear(); - - // translate the event - this.fireItemsRemoved(LIST_VALUES, info.begin, items); - } - - /** - * One of the component lists changed; - * synchronize our cache by synchronizing the appropriate - * list and firing the appropriate events. - */ - protected void componentListChanged(ListChangeEvent event) { - int componentLVMIndex = this.indexFor(event); - Info info = this.infoList.get(componentLVMIndex); - - int newItemsSize = info.componentLVM.size(); - if (newItemsSize == 0) { - this.clearComponentList(componentLVMIndex, info); - return; - } - - int oldItemsSize = info.items.size(); - if (oldItemsSize == 0) { - this.addComponentItems(componentLVMIndex, info, 0, info.componentLVM, newItemsSize); - return; - } - - int min = Math.min(newItemsSize, oldItemsSize); - // handle replaced items individually so we don't fire events for unchanged items - for (int i = 0; i < min; i++) { - E2 newItem = info.componentLVM.get(i); - E2 oldItem = info.items.set(i, newItem); - this.fireItemReplaced(LIST_VALUES, info.begin + i, newItem, oldItem); - } - - int delta = newItemsSize - oldItemsSize; - if (delta == 0) { // newItemsSize == oldItemsSize - return; - } - - for (int i = componentLVMIndex + 1; i < this.infoList.size(); i++) { - this.infoList.get(i).begin += delta; - } - this.size += delta; - - if (delta < 0) { // newItemsSize < oldItemsSize - List subList = info.items.subList(newItemsSize, oldItemsSize); - ArrayList removedItems = new ArrayList(subList); // make a copy - subList.clear(); - this.fireItemsRemoved(LIST_VALUES, info.begin + newItemsSize, removedItems); - return; - } - - // newItemsSize > oldItemsSize - ArrayList addedItems = new ArrayList(delta); - for (int i = oldItemsSize; i < newItemsSize; i++) { - addedItems.add(info.componentLVM.get(i)); - } - info.items.addAll(addedItems); - this.fireItemsAdded(LIST_VALUES, info.begin + oldItemsSize, addedItems); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getComponentItems(ListAddEvent event) { - return (Iterable) event.getItems(); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getComponentItems(ListReplaceEvent event) { - return (Iterable) event.getNewItems(); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - protected ListValueModel getComponentLVM(ListEvent event) { - return (ListValueModel) event.getSource(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositePropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositePropertyValueModel.java deleted file mode 100644 index 0654c0694c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/CompositePropertyValueModel.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; - -import org.eclipse.jpt.common.utility.internal.IdentityHashBag; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * A CompositePropertyValueModel adapts a - * {@link CollectionValueModel} holding other {@link PropertyValueModel}s - * to a single {@link PropertyValueModel}. - *

- * Subclasses must implement:

    - *
  • {@link #buildValue()}

    - * to return the current property value, as derived from the - * component values - *

- * NB: The wrapped collection must not contain any duplicates - * or this class will throw an exception. - */ -public abstract class CompositePropertyValueModel - extends CollectionPropertyValueModelAdapter -{ - /** - * Cache the component property value models so we can stop listening to - * them when they are removed from the collection value model. - */ - protected final IdentityHashBag> componentPVMs = - new IdentityHashBag>(); - - /** - * Listen to every property value model in the collection value model. - * If one changes, we need to re-calculate our value. - */ - protected final PropertyChangeListener propertyChangeListener; - - - // ********** constructors ********** - - /** - * Construct a property value model that is a composite of the specified - * property value models. - */ - public CompositePropertyValueModel(PropertyValueModel... collection) { - this(Arrays.asList(collection)); - } - - /** - * Construct a property value model that is a composite of the specified - * property value models. - */ - public > CompositePropertyValueModel(Collection collection) { - this(new StaticCollectionValueModel(collection)); - } - - /** - * Construct a property value model that is a composite of the specified - * property value models. - */ - public CompositePropertyValueModel(CollectionValueModel> collectionModel) { - super(collectionModel); - this.propertyChangeListener = this.buildPropertyChangeListener(); - } - - - // ********** initialization ********** - - protected PropertyChangeListener buildPropertyChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - CompositePropertyValueModel.this.propertyChanged(event); - } - @Override - public String toString() { - return "property change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** behavior ********** - - /** - * Subclasses can override this method if the event can be used to improve - * the performance of building a new value (e.g. some property changes may - * not necessitate the re-calculation of the value). - */ - protected void propertyChanged(@SuppressWarnings("unused") PropertyChangeEvent event) { - this.propertyChanged(); - } - - - // ********** CollectionPropertyValueModelAdapter overrides ********** - - @Override - protected void engageModel_() { - super.engageModel_(); - this.addComponentPVMs(this.getCollectionModel()); - } - - protected > void addComponentPVMs(Iterable pvms) { - for (PropertyValueModel each : pvms) { - this.componentPVMs.add(each); - each.addPropertyChangeListener(VALUE, this.propertyChangeListener); - } - } - - @Override - protected void disengageModel_() { - this.removeComponentPVMs(this.getCollectionModel()); - super.disengageModel_(); - } - - protected > void removeComponentPVMs(Iterable pvms) { - for (PropertyValueModel each : pvms) { - each.removePropertyChangeListener(VALUE, this.propertyChangeListener); - this.componentPVMs.remove(each); - } - } - - @Override - protected void itemsAdded(CollectionAddEvent event) { - this.addComponentPVMs(this.getItems(event)); - super.itemsAdded(event); - } - - @Override - protected void itemsRemoved(CollectionRemoveEvent event) { - this.removeComponentPVMs(this.getItems(event)); - super.itemsRemoved(event); - } - - @Override - protected void collectionCleared(CollectionClearEvent event) { - this.removeAllComponentPVMs(); - super.collectionCleared(event); - } - - protected void removeAllComponentPVMs() { - // copy the list so we don't eat our own tail - ArrayList> copy = new ArrayList>(this.componentPVMs); - this.removeComponentPVMs(copy); - } - - @Override - protected void collectionChanged(CollectionChangeEvent event) { - this.removeAllComponentPVMs(); - this.addComponentPVMs(this.getCollectionModel()); - super.collectionChanged(event); - } - - - // ********** convenience methods ********** - - /** - * Our constructor accepts only a {@link CollectionValueModel}{@code>}. - */ - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - protected CollectionValueModel> getCollectionModel() { - return (CollectionValueModel>) this.collectionModel; - } - - /** - * Our constructor accepts only a {@link CollectionValueModel}{@code>}. - */ - @SuppressWarnings("unchecked") - protected Iterable> getItems(CollectionAddEvent event) { - return (Iterable>) event.getItems(); - } - - /** - * Our constructor accepts only a {@link CollectionValueModel}{@code>}. - */ - @SuppressWarnings("unchecked") - protected Iterable> getItems(CollectionRemoveEvent event) { - return (Iterable>) event.getItems(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ExtendedListValueModelWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ExtendedListValueModelWrapper.java deleted file mode 100644 index 6601615cc4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ExtendedListValueModelWrapper.java +++ /dev/null @@ -1,211 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyCompositeListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyListIterator; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * This wrapper extends a {@link ListValueModel} (or {@link CollectionValueModel}) - * with fixed collections of items on either end. - *

- * NB: Be careful using or wrapping this list value model, since the - * "extended" items may be unexpected by the client code or wrapper. - */ -public class ExtendedListValueModelWrapper - extends ListValueModelWrapper - implements ListValueModel -{ - /** the items "prepended" to the wrapped list */ - protected List prefix; - - /** the items "appended" to the wrapped list */ - protected List suffix; - - - // ********** lots o' constructors ********** - - /** - * Extend the specified list with a prefix and suffix. - */ - public ExtendedListValueModelWrapper(List prefix, ListValueModel listHolder, List suffix) { - super(listHolder); - this.prefix = new ArrayList(prefix); - this.suffix = new ArrayList(suffix); - } - - /** - * Extend the specified list with a prefix and suffix. - */ - public ExtendedListValueModelWrapper(E prefix, ListValueModel listHolder, E suffix) { - super(listHolder); - this.prefix = Collections.singletonList(prefix); - this.suffix = Collections.singletonList(suffix); - } - - /** - * Extend the specified list with a prefix. - */ - public ExtendedListValueModelWrapper(List prefix, ListValueModel listHolder) { - super(listHolder); - this.prefix = new ArrayList(prefix); - this.suffix = Collections.emptyList(); - } - - /** - * Extend the specified list with a prefix. - */ - public ExtendedListValueModelWrapper(E prefix, ListValueModel listHolder) { - super(listHolder); - this.prefix = Collections.singletonList(prefix); - this.suffix = Collections.emptyList(); - } - - /** - * Extend the specified list with a suffix. - */ - public ExtendedListValueModelWrapper(ListValueModel listHolder, List suffix) { - super(listHolder); - this.prefix = Collections.emptyList(); - this.suffix = new ArrayList(suffix); - } - - /** - * Extend the specified list with a suffix. - */ - public ExtendedListValueModelWrapper(ListValueModel listHolder, E suffix) { - super(listHolder); - this.prefix = Collections.emptyList(); - this.suffix = Collections.singletonList(suffix); - } - - /** - * Extend the specified list with a prefix containing a single null item. - */ - public ExtendedListValueModelWrapper(ListValueModel listHolder) { - super(listHolder); - this.prefix = Collections.singletonList(null); - this.suffix = Collections.emptyList(); - } - - - // ********** ListValueModel implementation ********** - - public Iterator iterator() { - return this.listIterator(); - } - - public ListIterator listIterator() { - return new ReadOnlyListIterator(this.listIterator_()); - } - - @SuppressWarnings("unchecked") - protected ListIterator listIterator_() { - return new ReadOnlyCompositeListIterator( - this.prefix.listIterator(), - this.listHolder.listIterator(), - this.suffix.listIterator() - ); - } - - public E get(int index) { - int prefixSize = this.prefix.size(); - if (index < prefixSize) { - return this.prefix.get(index); - } else if (index >= prefixSize + this.listHolder.size()) { - return this.suffix.get(index - (prefixSize + this.listHolder.size())); - } else { - return this.listHolder.get(index - prefixSize); - } - } - - public int size() { - return this.prefix.size() + this.listHolder.size() + this.suffix.size(); - } - - public Object[] toArray() { - ArrayList list = new ArrayList(this.size()); - list.addAll(this.prefix); - CollectionTools.addAll(list, this.listHolder.iterator()); - list.addAll(this.suffix); - return list.toArray(); - } - - - // ********** ListValueModelWrapper implementation/overrides ********** - - @Override - protected void itemsAdded(ListAddEvent event) { - this.fireItemsAdded(event.clone(this, LIST_VALUES, this.prefix.size())); - } - - @Override - protected void itemsRemoved(ListRemoveEvent event) { - this.fireItemsRemoved(event.clone(this, LIST_VALUES, this.prefix.size())); - } - - @Override - protected void itemsReplaced(ListReplaceEvent event) { - this.fireItemsReplaced(event.clone(this, LIST_VALUES, this.prefix.size())); - } - - @Override - protected void itemsMoved(ListMoveEvent event) { - this.fireItemsMoved(event.clone(this, LIST_VALUES, this.prefix.size())); - } - - @Override - protected void listCleared(ListClearEvent event) { - this.fireListChanged(LIST_VALUES, this.buildList()); // not "cleared" - } - - @Override - protected void listChanged(ListChangeEvent event) { - this.fireListChanged(LIST_VALUES, this.buildList()); - } - - @Override - public void toString(StringBuilder sb) { - StringTools.append(sb, this); - } - - - // ********** miscellaneous ********** - - public void setPrefix(List prefix) { - this.prefix = prefix; - this.fireListChanged(LIST_VALUES, this.buildList()); - } - - public void setSuffix(List suffix) { - this.suffix = suffix; - this.fireListChanged(LIST_VALUES, this.buildList()); - } - - private List buildList() { - return CollectionTools.list(this.listIterator_()); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringCollectionValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringCollectionValueModel.java deleted file mode 100644 index 3defd4f00d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringCollectionValueModel.java +++ /dev/null @@ -1,179 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyIterator; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * A FilteringCollectionValueModel wraps another - * {@link CollectionValueModel} and uses a {@link Filter} - * to determine which items in the collection are returned by calls - * to {@link #iterator()}. - *

- * The filter can be changed at any time; allowing the same - * adapter to be used with different filter criteria (e.g. when the user - * wants to view a list of .java files). - *

- * NB: If the objects in the "filtered" collection can change in such a way - * that they should be removed from the "filtered" collection, you will - * need to wrap the original collection in an {@link ItemAspectListValueModelAdapter}. - * For example, if the filter only "accepts" items whose names begin - * with "X" and the names of the items can change, you will need to - * wrap the original list of unfiltered items with an - * {@link ItemPropertyListValueModelAdapter} that listens for changes to each - * item's name and fires the appropriate event whenever an item's name - * changes. The event will cause this wrapper to re-filter the changed - * item and add or remove it from the "filtered" collection as appropriate. - */ -public class FilteringCollectionValueModel - extends CollectionValueModelWrapper - implements CollectionValueModel -{ - /** This filters the items in the nested collection. */ - private Filter filter; - - /** Cache the items that were accepted by the filter */ - private final Collection filteredItems = new ArrayList(); - - - // ********** constructors ********** - - /** - * Construct a collection value model with the specified wrapped - * collection value model and a filter that simply accepts every object. - */ - public FilteringCollectionValueModel(CollectionValueModel collectionHolder) { - this(collectionHolder, Filter.Null.instance()); - } - - /** - * Construct a collection value model with the specified wrapped - * collection value model and filter. - */ - public FilteringCollectionValueModel(CollectionValueModel collectionHolder, Filter filter) { - super(collectionHolder); - this.filter = filter; - } - - /** - * Construct a collection value model with the specified wrapped - * list value model and a filter that simply accepts every object. - */ - public FilteringCollectionValueModel(ListValueModel listHolder) { - this(new ListCollectionValueModelAdapter(listHolder)); - } - - /** - * Construct a collection value model with the specified wrapped - * list value model and filter. - */ - public FilteringCollectionValueModel(ListValueModel listHolder, Filter filter) { - this(new ListCollectionValueModelAdapter(listHolder), filter); - } - - - // ********** CollectionValueModel implementation ********** - - public Iterator iterator() { - return new ReadOnlyIterator(this.filteredItems); - } - - public int size() { - return this.filteredItems.size(); - } - - - // ********** CollectionValueModelWrapper overrides/implementation ********** - - @Override - protected void engageModel() { - super.engageModel(); - // synch our cache *after* we start listening to the nested collection, - // since its value might change when a listener is added - CollectionTools.addAll(this.filteredItems, this.filter(this.collectionHolder)); - } - - @Override - protected void disengageModel() { - super.disengageModel(); - // clear out the cache when we are not listening to the nested collection - this.filteredItems.clear(); - } - - @Override - protected void itemsAdded(CollectionAddEvent event) { - // filter the values before propagating the change event - this.addItemsToCollection(this.filter(this.getItems(event)), this.filteredItems, VALUES); - } - - @Override - protected void itemsRemoved(CollectionRemoveEvent event) { - // do *not* filter the values, because they may no longer be - // "accepted" and that might be why they were removed in the first place; - // anyway, any extraneous items are harmless - this.removeItemsFromCollection(event.getItems(), this.filteredItems, VALUES); - } - - @Override - protected void collectionCleared(CollectionClearEvent event) { - this.clearCollection(this.filteredItems, VALUES); - } - - @Override - protected void collectionChanged(CollectionChangeEvent event) { - this.rebuildFilteredItems(); - } - - - // ********** miscellaneous ********** - - /** - * Change the filter and rebuild the collection. - */ - public void setFilter(Filter filter) { - this.filter = filter; - this.rebuildFilteredItems(); - } - - /** - * Return an iterable that filters the specified iterable. - */ - protected Iterable filter(Iterable items) { - return new FilteringIterable(items, this.filter); - } - - /** - * Synchronize our cache with the wrapped collection. - */ - protected void rebuildFilteredItems() { - this.filteredItems.clear(); - CollectionTools.addAll(this.filteredItems, this.filter(this.collectionHolder)); - this.fireCollectionChanged(VALUES, this.filteredItems); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.filteredItems); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringPropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringPropertyValueModel.java deleted file mode 100644 index 56935822d8..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringPropertyValueModel.java +++ /dev/null @@ -1,142 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * A FilteringPropertyValueModel wraps another - * {@link PropertyValueModel} and uses a {@link Filter} - * to determine when the wrapped value is to be returned by calls - * to {@link #getValue()}. - *

- * As an alternative to building a {@link Filter}, a subclass - * can override {@link #accept(T)}. - *

- * One, possibly undesirable, side-effect of using this value model is that - * it must return *something* as the value. The default behavior is - * to return null whenever the wrapped value is not "accepted", - * which can be configured and/or overridden ({@link #getDefaultValue()}). - */ -public class FilteringPropertyValueModel - extends PropertyValueModelWrapper - implements PropertyValueModel -{ - protected final Filter filter; - protected final T defaultValue; - - - // ********** constructors ********** - - /** - * Construct a filtering property value model with the specified nested - * property value model and a disabled filter. - * Use this constructor if you want to override {@link #accept(T)} - * instead of building a {@link Filter}. - * The default value will be null. - */ - public FilteringPropertyValueModel(PropertyValueModel valueHolder) { - this(valueHolder, Filter.Disabled.instance(), null); - } - - /** - * Construct a filtering property value model with the specified nested - * property value model, specified default value, and a disabled filter. - * Use this constructor if you want to override {@link #accept(T)} - * instead of building a {@link Filter} - * and you need to specify - * a default value other than null. - */ - public FilteringPropertyValueModel(PropertyValueModel valueHolder, T defaultValue) { - this(valueHolder, Filter.Disabled.instance(), defaultValue); - } - - /** - * Construct a filtering property value model with the specified nested - * property value model and filter. - * The default value will be null. - */ - public FilteringPropertyValueModel(PropertyValueModel valueHolder, Filter filter) { - this(valueHolder, filter, null); - } - - /** - * Construct a filtering property value model with the specified nested - * property value model, filter, and default value. - */ - public FilteringPropertyValueModel(PropertyValueModel valueHolder, Filter filter, T defaultValue) { - super(valueHolder); - this.filter = filter; - this.defaultValue = defaultValue; - } - - - // ********** PropertyValueModel implementation ********** - - public T getValue() { - return this.filterValue(this.valueHolder.getValue()); - } - - - // ********** PropertyValueModelWrapper implementation ********** - - @Override - protected void valueChanged(PropertyChangeEvent event) { - // filter the values before propagating the change event - @SuppressWarnings("unchecked") - T eventOldValue = (T) event.getOldValue(); - Object oldValue = this.filterValue(eventOldValue); - @SuppressWarnings("unchecked") - T eventNewValue = (T) event.getNewValue(); - Object newValue = this.filterValue(eventNewValue); - this.firePropertyChanged(VALUE, oldValue, newValue); - } - - - // ********** queries ********** - - /** - * If the specified value is "accepted" simply return it, - * otherwise return the default value. - */ - protected T filterValue(T value) { - return this.accept(value) ? value : this.getDefaultValue(); - } - - /** - * Return whether the filtering property value model should - * return the specified value from a call to - * {@link #getValue()}; the value came - * from the nested property value model - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link Filter}. - */ - protected boolean accept(T value) { - return this.filter.accept(value); - } - - /** - * Return the object that should be returned if - * the nested value was rejected by the filter. - * The default is null. - */ - protected T getDefaultValue() { - return this.defaultValue; - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getValue()); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringWritablePropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringWritablePropertyValueModel.java deleted file mode 100644 index 61eac0eec9..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/FilteringWritablePropertyValueModel.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.internal.BidiFilter; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * A FilteringWritablePropertyValueModel wraps another - * {@link WritablePropertyValueModel} and uses a {@link BidiFilter} - * to determine when the wrapped value is to be returned by calls - * to {@link FilteringPropertyValueModel#getValue() getValue()} and modified by calls to - * {@link #setValue(T)}. - *

- * As an alternative to building a {@link BidiFilter}, a subclass - * can override {@link FilteringPropertyValueModel#accept(T) accept(T)} and {@link #reverseAccept(T)}. - *

- * One, possibly undesirable, side-effect of using this value model is that - * it must return *something* as the value. The default behavior is - * to return null whenever the wrapped value is not "accepted", - * which can be configured and/or overridden ({@link FilteringPropertyValueModel#getDefaultValue() getDefaultValue()}). - *

- * Similarly, if an incoming value is not "reverse accepted", nothing - * will passed through to the wrapped value holder, not even null. - */ -public class FilteringWritablePropertyValueModel - extends FilteringPropertyValueModel - implements WritablePropertyValueModel -{ - - - // ********** constructors ********** - - /** - * Construct a filtering property value model with the specified nested - * property value model and a disabled filter. - * Use this constructor if you want to override - * {@link #accept(T)} and {@link #reverseAccept(T)} - * instead of building a {@link BidiFilter}. - * The default value will be null. - */ - public FilteringWritablePropertyValueModel(WritablePropertyValueModel valueHolder) { - this(valueHolder, BidiFilter.Disabled.instance(), null); - } - - /** - * Construct a filtering property value model with the specified nested - * property value model, specified default value, and a disabled filter. - * Use this constructor if you want to override - * {@link #accept(T)} and {@link #reverseAccept(T)} - * instead of building a {@link BidiFilter}. - * and you need to specify - * a default value other than null. - */ - public FilteringWritablePropertyValueModel(WritablePropertyValueModel valueHolder, T defaultValue) { - this(valueHolder, BidiFilter.Disabled.instance(), defaultValue); - } - - /** - * Construct an property value model with the specified nested - * property value model and filter. - * The default value will be null. - */ - public FilteringWritablePropertyValueModel(WritablePropertyValueModel valueHolder, BidiFilter filter) { - this(valueHolder, filter, null); - } - - /** - * Construct an property value model with the specified nested - * property value model, filter, and default value. - */ - public FilteringWritablePropertyValueModel(WritablePropertyValueModel valueHolder, BidiFilter filter, T defaultValue) { - super(valueHolder, filter, defaultValue); - } - - - // ********** WritablePropertyValueModel implementation ********** - - public void setValue(T value) { - if (this.reverseAccept(value)) { - this.getValueHolder().setValue(value); - } - } - - - // ********** queries ********** - - /** - * Return whether the filtering writable property value model - * should pass through the specified value to the nested - * writable property value model in a call to - * {@link #setValue(T)}. - *

- * This method can be overridden by a subclass as an - * alternative to building a {@link BidiFilter}. - */ - protected boolean reverseAccept(T value) { - return this.getFilter().reverseAccept(value); - } - - /** - * Our constructor accepts only a {@link WritablePropertyValueModel}{@code}. - */ - @SuppressWarnings("unchecked") - protected WritablePropertyValueModel getValueHolder() { - return (WritablePropertyValueModel) this.valueHolder; - } - - /** - * Our constructors accept only a bidirectional filter. - */ - protected BidiFilter getFilter() { - return (BidiFilter) this.filter; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemAspectListValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemAspectListValueModelAdapter.java deleted file mode 100644 index eff8183982..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemAspectListValueModelAdapter.java +++ /dev/null @@ -1,274 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.EventObject; -import java.util.IdentityHashMap; -import java.util.Iterator; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.SimpleIntReference; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyListIterator; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * Abstract list value model that provides behavior for wrapping a {@link ListValueModel} - * (or {@link CollectionValueModel}) and listening for changes to aspects of the - * items held by the list (or collection). Changes to the actual list - * (or collection) are also monitored. - * - * This is useful if you have a collection of items that can be modified by adding - * or removing items or the items themselves might change in a fashion that - * might change the list or collection's external appearance. - * - * Subclasses need to override two methods:

    - *
  • {@link #engageItem_(Model)}

    - * begin listening to the appropriate aspect of the specified item and call - * {@link #itemAspectChanged(EventObject)} whenever the aspect changes - *

  • {@link #disengageItem_(Model)}

    - * stop listening to the appropriate aspect of the specified item - *

- */ -public abstract class ItemAspectListValueModelAdapter - extends ListValueModelWrapper - implements ListValueModel -{ - - /** - * Maintain a counter for each of the items in the - * wrapped list holder we are listening to. - */ - protected final IdentityHashMap counters; - - - // ********** constructors ********** - - /** - * Constructor - the list holder is required. - */ - protected ItemAspectListValueModelAdapter(ListValueModel listHolder) { - super(listHolder); - this.counters = new IdentityHashMap(); - } - - /** - * Constructor - the collection holder is required. - */ - protected ItemAspectListValueModelAdapter(CollectionValueModel collectionHolder) { - this(new CollectionListValueModelAdapter(collectionHolder)); - } - - - // ********** ListValueModel implementation ********** - - public Iterator iterator() { - return this.listIterator(); - } - - public ListIterator listIterator() { - return new ReadOnlyListIterator(this.listHolder.listIterator()); - } - - public E get(int index) { - return this.listHolder.get(index); - } - - public int size() { - return this.listHolder.size(); - } - - public Object[] toArray() { - return this.listHolder.toArray(); - } - - - // ********** behavior ********** - - /** - * Start listening to the list holder and the items in the list. - */ - @Override - protected void engageModel() { - super.engageModel(); - this.engageAllItems(); - } - - protected void engageAllItems() { - this.engageItems(this.listHolder); - } - - protected void engageItems(Iterable items) { - for (E item : items) { - this.engageItem(item); - } - } - - protected void engageItem(E item) { - // listen to each item only once - SimpleIntReference counter = this.counters.get(item); - if (counter == null) { - counter = new SimpleIntReference(); - this.counters.put(item, counter); - this.engageItem_((Model) item); - } - counter.increment(); - } - - /** - * Start listening to the specified item. - */ - protected abstract void engageItem_(Model item); - - /** - * Stop listening to the list holder and the items in the list. - */ - @Override - protected void disengageModel() { - this.disengageAllItems(); - super.disengageModel(); - } - - protected void disengageAllItems() { - this.disengageItems(this.listHolder); - } - - protected void disengageItems(Iterable items) { - for (E item : items) { - this.disengageItem(item); - } - } - - protected void disengageItem(E item) { - // stop listening to each item only once - SimpleIntReference counter = this.counters.get(item); - if (counter == null) { - // something is wrong if this happens... ~bjv - throw new IllegalStateException("missing counter: " + item); //$NON-NLS-1$ - } - if (counter.decrement() == 0) { - this.counters.remove(item); - this.disengageItem_((Model) item); - } - } - - /** - * Stop listening to the specified item. - */ - protected abstract void disengageItem_(Model item); - - @Override - public void toString(StringBuilder sb) { - StringTools.append(sb, this); - } - - - // ********** list change support ********** - - /** - * Items were added to the wrapped list holder. - * Forward the event and begin listening to the added items. - */ - @Override - protected void itemsAdded(ListAddEvent event) { - // re-fire event with the wrapper as the source - this.fireItemsAdded(event.clone(this, LIST_VALUES)); - this.engageItems(this.getItems(event)); - } - - /** - * Items were removed from the wrapped list holder. - * Stop listening to the removed items and forward the event. - */ - @Override - protected void itemsRemoved(ListRemoveEvent event) { - this.disengageItems(this.getItems(event)); - // re-fire event with the wrapper as the source - this.fireItemsRemoved(event.clone(this, LIST_VALUES)); - } - - /** - * Items were replaced in the wrapped list holder. - * Stop listening to the removed items, forward the event, - * and begin listening to the added items. - */ - @Override - protected void itemsReplaced(ListReplaceEvent event) { - this.disengageItems(this.getOldItems(event)); - // re-fire event with the wrapper as the source - this.fireItemsReplaced(event.clone(this, LIST_VALUES)); - this.engageItems(this.getNewItems(event)); - } - - /** - * Items were moved in the wrapped list holder. - * No need to change any listeners; just forward the event. - */ - @Override - protected void itemsMoved(ListMoveEvent event) { - // re-fire event with the wrapper as the source - this.fireItemsMoved(event.clone(this, LIST_VALUES)); - } - - /** - * The wrapped list holder was cleared. - * Stop listening to the removed items and forward the event. - */ - @Override - protected void listCleared(ListClearEvent event) { - // we should only need to disengage each item once... - // make a copy to prevent a ConcurrentModificationException - Collection keys = new ArrayList(this.counters.keySet()); - this.disengageItems(keys); - this.counters.clear(); - // re-fire event with the wrapper as the source - this.fireListCleared(LIST_VALUES); - } - - /** - * The wrapped list holder has changed in some dramatic fashion. - * Reconfigure our listeners and forward the event. - */ - @Override - protected void listChanged(ListChangeEvent event) { - // we should only need to disengage each item once... - // make a copy to prevent a ConcurrentModificationException - Collection keys = new ArrayList(this.counters.keySet()); - this.disengageItems(keys); - this.counters.clear(); - // re-fire event with the wrapper as the source - this.fireListChanged(event.clone(this)); - this.engageAllItems(); - } - - - // ********** item change support ********** - - /** - * The specified item has a bound property that has changed. - * Notify listeners of the change. The listeners will have to determine - * whether the item aspect change is significant. - */ - protected void itemAspectChanged(@SuppressWarnings("unused") EventObject event) { - this.fireListChanged(LIST_VALUES, CollectionTools.list(this.listHolder, this.listHolder.size())); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemChangeListValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemChangeListValueModelAdapter.java deleted file mode 100644 index b6f817b79c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemChangeListValueModelAdapter.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.ChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.SimpleChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * Extend {@link ItemAspectListValueModelAdapter} to listen to all of the changes - * of each item in the wrapped list model. - */ -public class ItemChangeListValueModelAdapter - extends ItemAspectListValueModelAdapter -{ - /** Listener that listens to all the items in the list. */ - protected final ChangeListener itemChangeListener; - - - // ********** constructors ********** - - /** - * Construct an adapter for the specified items. - */ - public ItemChangeListValueModelAdapter(ListValueModel listHolder) { - super(listHolder); - this.itemChangeListener = this.buildItemChangeListener(); - } - - - // ********** initialization ********** - - protected ChangeListener buildItemChangeListener() { - return new SimpleChangeListener() { - @Override - protected void modelChanged(ChangeEvent event) { - ItemChangeListValueModelAdapter.this.itemAspectChanged(event); - } - @Override - public String toString() { - return "item change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** behavior ********** - - @Override - protected void engageItem_(Model item) { - item.addChangeListener(this.itemChangeListener); - } - - @Override - protected void disengageItem_(Model item) { - item.removeChangeListener(this.itemChangeListener); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemCollectionListValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemCollectionListValueModelAdapter.java deleted file mode 100644 index 8079739d76..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemCollectionListValueModelAdapter.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Arrays; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * Extend {@link ItemAspectListValueModelAdapter} to listen to one or more collection - * aspects of each item in the wrapped list model. - */ -public class ItemCollectionListValueModelAdapter - extends ItemAspectListValueModelAdapter -{ - - /** The names of the items' collections that we listen to. */ - protected final String[] collectionNames; - - /** Listener that listens to all the items in the list. */ - protected final CollectionChangeListener itemCollectionListener; - - - // ********** constructors ********** - - /** - * Construct an adapter for the specified item Collections. - */ - public ItemCollectionListValueModelAdapter(ListValueModel listHolder, String... collectionNames) { - super(listHolder); - this.collectionNames = collectionNames; - this.itemCollectionListener = this.buildItemCollectionListener(); - } - - /** - * Construct an adapter for the specified item Collections. - */ - public ItemCollectionListValueModelAdapter(CollectionValueModel collectionHolder, String... collectionNames) { - this(new CollectionListValueModelAdapter(collectionHolder), collectionNames); - } - - - // ********** initialization ********** - - /** - * All we really care about is the fact that a Collection aspect has - * changed. Do the same thing no matter which event occurs. - */ - protected CollectionChangeListener buildItemCollectionListener() { - return new CollectionChangeListener() { - public void itemsAdded(CollectionAddEvent event) { - ItemCollectionListValueModelAdapter.this.itemAspectChanged(event); - } - public void itemsRemoved(CollectionRemoveEvent event) { - ItemCollectionListValueModelAdapter.this.itemAspectChanged(event); - } - public void collectionCleared(CollectionClearEvent event) { - ItemCollectionListValueModelAdapter.this.itemAspectChanged(event); - } - public void collectionChanged(CollectionChangeEvent event) { - ItemCollectionListValueModelAdapter.this.itemAspectChanged(event); - } - @Override - public String toString() { - return "item collection listener: " + Arrays.asList(ItemCollectionListValueModelAdapter.this.collectionNames); //$NON-NLS-1$ - } - }; - } - - - // ********** behavior ********** - - @Override - protected void engageItem_(Model item) { - for (String collectionName : this.collectionNames) { - item.addCollectionChangeListener(collectionName, this.itemCollectionListener); - } - } - - @Override - protected void disengageItem_(Model item) { - for (String collectionName : this.collectionNames) { - item.removeCollectionChangeListener(collectionName, this.itemCollectionListener); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemListListValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemListListValueModelAdapter.java deleted file mode 100644 index 79cac2cdcc..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemListListValueModelAdapter.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Arrays; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * Extend {@link ItemAspectListValueModelAdapter} to listen to one or more list - * aspects of each item in the wrapped list model. - */ -public class ItemListListValueModelAdapter - extends ItemAspectListValueModelAdapter -{ - - /** The names of the subject's lists that we listen to. */ - protected final String[] listNames; - - /** Listener that listens to all the items in the list. */ - protected final ListChangeListener itemListListener; - - - // ********** constructors ********** - - /** - * Construct an adapter for the specified item List aspects. - */ - public ItemListListValueModelAdapter(ListValueModel listHolder, String... listNames) { - super(listHolder); - this.listNames = listNames; - this.itemListListener = this.buildItemListListener(); - } - - /** - * Construct an adapter for the specified item List aspects. - */ - public ItemListListValueModelAdapter(CollectionValueModel collectionHolder, String... listNames) { - this(new CollectionListValueModelAdapter(collectionHolder), listNames); - } - - - // ********** initialization ********** - - /** - * All we really care about is the fact that the List aspect has - * changed. Do the same thing no matter which event occurs. - */ - protected ListChangeListener buildItemListListener() { - return new ListChangeListener() { - public void itemsAdded(ListAddEvent event) { - ItemListListValueModelAdapter.this.itemAspectChanged(event); - } - public void itemsRemoved(ListRemoveEvent event) { - ItemListListValueModelAdapter.this.itemAspectChanged(event); - } - public void itemsReplaced(ListReplaceEvent event) { - ItemListListValueModelAdapter.this.itemAspectChanged(event); - } - public void itemsMoved(ListMoveEvent event) { - ItemListListValueModelAdapter.this.itemAspectChanged(event); - } - public void listCleared(ListClearEvent event) { - ItemListListValueModelAdapter.this.itemAspectChanged(event); - } - public void listChanged(ListChangeEvent event) { - ItemListListValueModelAdapter.this.itemAspectChanged(event); - } - @Override - public String toString() { - return "item list listener: " + Arrays.asList(ItemListListValueModelAdapter.this.listNames); //$NON-NLS-1$ - } - }; - } - - - // ********** behavior ********** - - @Override - protected void engageItem_(Model item) { - for (String listName : this.listNames) { - item.addListChangeListener(listName, this.itemListListener); - } - } - - @Override - protected void disengageItem_(Model item) { - for (String listName : this.listNames) { - item.removeListChangeListener(listName, this.itemListListener); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemPropertyListValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemPropertyListValueModelAdapter.java deleted file mode 100644 index 870a36590f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemPropertyListValueModelAdapter.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Arrays; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * Extend {@link ItemAspectListValueModelAdapter} to listen to one or more - * properties of each item in the wrapped list model. - */ -public class ItemPropertyListValueModelAdapter - extends ItemAspectListValueModelAdapter -{ - - /** The names of the items' properties that we listen to. */ - protected final String[] propertyNames; - - /** Listener that listens to all the items in the list. */ - protected final PropertyChangeListener itemPropertyListener; - - - // ********** constructors ********** - - /** - * Construct an adapter for the specified item properties. - */ - public ItemPropertyListValueModelAdapter(ListValueModel listHolder, String... propertyNames) { - super(listHolder); - this.propertyNames = propertyNames; - this.itemPropertyListener = this.buildItemPropertyListener(); - } - - /** - * Construct an adapter for the specified item properties. - */ - public ItemPropertyListValueModelAdapter(CollectionValueModel collectionHolder, String... propertyNames) { - this(new CollectionListValueModelAdapter(collectionHolder), propertyNames); - } - - - // ********** initialization ********** - - protected PropertyChangeListener buildItemPropertyListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - ItemPropertyListValueModelAdapter.this.itemAspectChanged(event); - } - @Override - public String toString() { - return "item property listener: " + Arrays.asList(ItemPropertyListValueModelAdapter.this.propertyNames); //$NON-NLS-1$ - } - }; - } - - - // ********** behavior ********** - - @Override - protected void engageItem_(Model item) { - for (String propertyName : this.propertyNames) { - item.addPropertyChangeListener(propertyName, this.itemPropertyListener); - } - } - - @Override - protected void disengageItem_(Model item) { - for (String propertyName : this.propertyNames) { - item.removePropertyChangeListener(propertyName, this.itemPropertyListener); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemStateListValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemStateListValueModelAdapter.java deleted file mode 100644 index b4dc5ee61d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemStateListValueModelAdapter.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * Extend {@link ItemAspectListValueModelAdapter} to listen to the - * "state" of each item in the wrapped list model. - */ -public class ItemStateListValueModelAdapter - extends ItemAspectListValueModelAdapter -{ - /** Listener that listens to all the items in the list. */ - protected final StateChangeListener itemStateListener; - - - // ********** constructors ********** - - /** - * Construct an adapter for the item state. - */ - public ItemStateListValueModelAdapter(ListValueModel listHolder) { - super(listHolder); - this.itemStateListener = this.buildItemStateListener(); - } - - /** - * Construct an adapter for the item state. - */ - public ItemStateListValueModelAdapter(CollectionValueModel collectionHolder) { - this(new CollectionListValueModelAdapter(collectionHolder)); - } - - - // ********** initialization ********** - - protected StateChangeListener buildItemStateListener() { - return new StateChangeListener() { - public void stateChanged(StateChangeEvent event) { - ItemStateListValueModelAdapter.this.itemAspectChanged(event); - } - @Override - public String toString() { - return "item state listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** behavior ********** - - @Override - protected void engageItem_(Model item) { - item.addStateChangeListener(this.itemStateListener); - } - - @Override - protected void disengageItem_(Model item) { - item.removeStateChangeListener(this.itemStateListener); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemTreeListValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemTreeListValueModelAdapter.java deleted file mode 100644 index 5ae5a968bd..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ItemTreeListValueModelAdapter.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Arrays; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.TreeChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * Extend {@link ItemAspectListValueModelAdapter} to listen to one or more tree - * aspects of each item in the wrapped list model. - */ -public class ItemTreeListValueModelAdapter - extends ItemAspectListValueModelAdapter -{ - - /** The names of the items' tree that we listen to. */ - protected final String[] treeNames; - - /** Listener that listens to all the items in the list. */ - protected final TreeChangeListener itemTreeListener; - - - // ********** constructors ********** - - /** - * Construct an adapter for the specified item trees. - */ - public ItemTreeListValueModelAdapter(ListValueModel listHolder, String... treeNames) { - super(listHolder); - this.treeNames = treeNames; - this.itemTreeListener = this.buildItemTreeListener(); - } - - /** - * Construct an adapter for the specified item trees. - */ - public ItemTreeListValueModelAdapter(CollectionValueModel collectionHolder, String... treeNames) { - this(new CollectionListValueModelAdapter(collectionHolder), treeNames); - } - - - // ********** initialization ********** - - /** - * All we really care about is the fact that a tree aspect has - * changed. Do the same thing no matter which event occurs. - */ - protected TreeChangeListener buildItemTreeListener() { - return new TreeChangeListener() { - public void nodeAdded(TreeAddEvent event) { - ItemTreeListValueModelAdapter.this.itemAspectChanged(event); - } - public void nodeRemoved(TreeRemoveEvent event) { - ItemTreeListValueModelAdapter.this.itemAspectChanged(event); - } - public void treeCleared(TreeClearEvent event) { - ItemTreeListValueModelAdapter.this.itemAspectChanged(event); - } - public void treeChanged(TreeChangeEvent event) { - ItemTreeListValueModelAdapter.this.itemAspectChanged(event); - } - @Override - public String toString() { - return "item tree listener: " + Arrays.asList(ItemTreeListValueModelAdapter.this.treeNames); //$NON-NLS-1$ - } - }; - } - - - // ********** behavior ********** - - @Override - protected void engageItem_(Model item) { - for (String treeName : this.treeNames) { - item.addTreeChangeListener(treeName, this.itemTreeListener); - } - } - - @Override - protected void disengageItem_(Model item) { - for (String treeName : this.treeNames) { - item.removeTreeChangeListener(treeName, this.itemTreeListener); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListAspectAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListAspectAdapter.java deleted file mode 100644 index 82b5eb4e9b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListAspectAdapter.java +++ /dev/null @@ -1,176 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Arrays; -import java.util.Collection; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * This extension of {@link AspectListValueModelAdapter} provides - * basic list change support. - * This converts a set of one or more lists into - * a single {@link #LIST_VALUES} list. - *

- * The typical subclass will override the following methods (see the descriptions - * in {@link AspectListValueModelAdapter}):

    - *
  • {@link #listIterator_()} - *
  • {@link #get(int)} - *
  • {@link #size_()} - *
  • {@link #toArray_()} - *
  • {@link #listIterator()} - *
  • {@link #size()} - *
  • {@link #toArray()} - *
- */ -public abstract class ListAspectAdapter - extends AspectListValueModelAdapter -{ - /** - * The name of the subject's lists that we use for the value. - */ - protected final String[] listNames; - protected static final String[] EMPTY_LIST_NAMES = new String[0]; - - /** A listener that listens to the subject's list aspects. */ - protected final ListChangeListener listChangeListener; - - - // ********** constructors ********** - - /** - * Construct a list aspect adapter for the specified subject - * and list. - */ - protected ListAspectAdapter(String listName, S subject) { - this(new String[] {listName}, subject); - } - - /** - * Construct a list aspect adapter for the specified subject - * and lists. - */ - protected ListAspectAdapter(String[] listNames, S subject) { - this(new StaticPropertyValueModel(subject), listNames); - } - - /** - * Construct a list aspect adapter for the specified subject holder - * and lists. - */ - protected ListAspectAdapter(PropertyValueModel subjectHolder, String... listNames) { - super(subjectHolder); - this.listNames = listNames; - this.listChangeListener = this.buildListChangeListener(); - } - - /** - * Construct a list aspect adapter for the specified subject holder - * and lists. - */ - protected ListAspectAdapter(PropertyValueModel subjectHolder, Collection listNames) { - this(subjectHolder, listNames.toArray(new String[listNames.size()])); - } - - /** - * Construct a list aspect adapter for an "unchanging" list in - * the specified subject. This is useful for a list aspect that does not - * change for a particular subject; but the subject will change, resulting in - * a new list. - */ - protected ListAspectAdapter(PropertyValueModel subjectHolder) { - this(subjectHolder, EMPTY_LIST_NAMES); - } - - - // ********** initialization ********** - - protected ListChangeListener buildListChangeListener() { - // transform the subject's list change events into VALUE list change events - return new ListChangeListener() { - public void itemsAdded(ListAddEvent event) { - ListAspectAdapter.this.itemsAdded(event); - } - public void itemsRemoved(ListRemoveEvent event) { - ListAspectAdapter.this.itemsRemoved(event); - } - public void itemsReplaced(ListReplaceEvent event) { - ListAspectAdapter.this.itemsReplaced(event); - } - public void itemsMoved(ListMoveEvent event) { - ListAspectAdapter.this.itemsMoved(event); - } - public void listCleared(ListClearEvent event) { - ListAspectAdapter.this.listCleared(event); - } - public void listChanged(ListChangeEvent event) { - ListAspectAdapter.this.listChanged(event); - } - @Override - public String toString() { - return "list change listener: " + Arrays.asList(ListAspectAdapter.this.listNames); //$NON-NLS-1$ - } - }; - } - - - // ********** AspectAdapter implementation ********** - - @Override - protected void engageSubject_() { - for (String listName : this.listNames) { - ((Model) this.subject).addListChangeListener(listName, this.listChangeListener); - } - } - - @Override - protected void disengageSubject_() { - for (String listName : this.listNames) { - ((Model) this.subject).removeListChangeListener(listName, this.listChangeListener); - } - } - - - // ********** behavior ********** - - protected void itemsAdded(ListAddEvent event) { - this.fireItemsAdded(event.clone(this, LIST_VALUES)); - } - - protected void itemsRemoved(ListRemoveEvent event) { - this.fireItemsRemoved(event.clone(this, LIST_VALUES)); - } - - protected void itemsReplaced(ListReplaceEvent event) { - this.fireItemsReplaced(event.clone(this, LIST_VALUES)); - } - - protected void itemsMoved(ListMoveEvent event) { - this.fireItemsMoved(event.clone(this, LIST_VALUES)); - } - - protected void listCleared(ListClearEvent event) { - this.fireListCleared(event.clone(this, LIST_VALUES)); - } - - protected void listChanged(ListChangeEvent event) { - this.fireListChanged(event.clone(this, LIST_VALUES)); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCollectionValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCollectionValueModelAdapter.java deleted file mode 100644 index e37f223a6f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCollectionValueModelAdapter.java +++ /dev/null @@ -1,233 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.ArrayList; -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyIterator; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * An adapter that allows us to make a {@link ListValueModel} behave like - * a read-only {@link CollectionValueModel}, sorta. - *

- * We keep an internal collection somewhat in synch with the wrapped list. - *

- * NB: Since we only listen to the wrapped list when we have - * listeners ourselves and we can only stay in synch with the wrapped - * list while we are listening to it, results to various methods - * (e.g. {@link #size()}, {@link iterator()}) will be unpredictable whenever - * we do not have any listeners. This should not be too painful since, - * most likely, client objects will also be listeners. - */ -public class ListCollectionValueModelAdapter - extends AbstractCollectionValueModel - implements CollectionValueModel -{ - /** The wrapped list value model. */ - protected final ListValueModel listHolder; - - /** A listener that forwards any events fired by the list holder. */ - protected final ListChangeListener listChangeListener; - - /** - * Our internal collection, which holds the same elements as - * the wrapped list. - */ - // we declare this an ArrayList so we can use #clone() and #ensureCapacity(int) - protected final ArrayList collection; - - - // ********** constructors ********** - - /** - * Wrap the specified list value model. - */ - public ListCollectionValueModelAdapter(ListValueModel listHolder) { - super(); - if (listHolder == null) { - throw new NullPointerException(); - } - this.listHolder = listHolder; - this.listChangeListener = this.buildListChangeListener(); - this.collection = new ArrayList(); - // postpone building the collection and listening to the underlying list - // until we have listeners ourselves... - } - - - // ********** initialization ********** - - /** - * The wrapped list has changed, forward an equivalent - * collection change event to our listeners. - */ - protected ListChangeListener buildListChangeListener() { - return new ListChangeListener() { - public void itemsAdded(ListAddEvent event) { - ListCollectionValueModelAdapter.this.itemsAdded(event); - } - public void itemsRemoved(ListRemoveEvent event) { - ListCollectionValueModelAdapter.this.itemsRemoved(event); - } - public void itemsReplaced(ListReplaceEvent event) { - ListCollectionValueModelAdapter.this.itemsReplaced(event); - } - public void itemsMoved(ListMoveEvent event) { - ListCollectionValueModelAdapter.this.itemsMoved(event); - } - public void listCleared(ListClearEvent event) { - ListCollectionValueModelAdapter.this.listCleared(event); - } - public void listChanged(ListChangeEvent event) { - ListCollectionValueModelAdapter.this.listChanged(event); - } - @Override - public String toString() { - return "list change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** CollectionValueModel implementation ********** - - public Iterator iterator() { - // try to prevent backdoor modification of the list - return new ReadOnlyIterator(this.collection); - } - - public int size() { - return this.collection.size(); - } - - - // ********** AbstractCollectionValueModel implementation ********** - - @Override - protected void engageModel() { - this.listHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - // synch our collection *after* we start listening to the list holder, - // since its value might change when a listener is added - this.buildCollection(); - } - - @Override - protected void disengageModel() { - this.listHolder.removeListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - // clear out the collection when we are not listening to the list holder - this.collection.clear(); - } - - - // ********** behavior ********** - - protected void itemsAdded(ListAddEvent event) { - this.addItemsToCollection(this.getItems(event), this.collection, VALUES); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getItems(ListAddEvent event) { - return (Iterable) event.getItems(); - } - - protected void itemsRemoved(ListRemoveEvent event) { - this.removeItemsFromCollection(this.getItems(event), this.collection, VALUES); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getItems(ListRemoveEvent event) { - return (Iterable) event.getItems(); - } - - protected void itemsReplaced(ListReplaceEvent event) { - this.removeItemsFromCollection(this.getOldItems(event), this.collection, VALUES); - this.addItemsToCollection(this.getNewItems(event), this.collection, VALUES); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getOldItems(ListReplaceEvent event) { - return (Iterable) event.getOldItems(); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getNewItems(ListReplaceEvent event) { - return (Iterable) event.getNewItems(); - } - - protected void itemsMoved(@SuppressWarnings("unused") ListMoveEvent event) { - // do nothing? moving items in a list has no net effect on a collection... - } - - protected void listCleared(@SuppressWarnings("unused") ListClearEvent event) { - // put in empty check so we don't fire events unnecessarily - if ( ! this.collection.isEmpty()) { - this.collection.clear(); - this.fireCollectionCleared(VALUES); - } - } - - /** - * synchronize our internal collection with the wrapped list - * and fire the appropriate events - */ - protected void listChanged(@SuppressWarnings("unused") ListChangeEvent event) { - if (this.listHolder.size() == 0) { - if (this.collection.isEmpty()) { - // no change - } else { - this.clearCollection(this.collection, VALUES); - } - } else { - if (this.collection.isEmpty()) { - this.buildCollection(); - this.fireItemsAdded(VALUES, this.collection); - } else { - this.collection.clear(); - this.buildCollection(); - this.fireCollectionChanged(VALUES, this.collection); - } - } - } - - protected void buildCollection() { - // if the new list is empty, do nothing - int size = this.listHolder.size(); - if (size != 0) { - this.buildCollection(size); - } - } - - protected void buildCollection(int size) { - this.collection.ensureCapacity(size); - for (E each : this.listHolder) { - this.collection.add(each); - } - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.collection); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCurator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCurator.java deleted file mode 100644 index 753638b098..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListCurator.java +++ /dev/null @@ -1,226 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.ArrayList; -import java.util.EventListener; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyListIterator; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * This extension of {@link AspectAdapter} provides list change support - * by adapting a subject's state change events to a minimum set - * of list change events. - */ -public abstract class ListCurator - extends AspectAdapter - implements ListValueModel -{ - /** How the list looked before the last state change */ - private final ArrayList record; - - /** A listener that listens for the subject's state to change */ - private final StateChangeListener stateChangeListener; - - - // ********** constructors ********** - - /** - * Construct a curator for the specified subject. - */ - protected ListCurator(S subject) { - this(new StaticPropertyValueModel(subject)); - } - - /** - * Construct a curator for the specified subject holder. - * The subject holder cannot be null. - */ - protected ListCurator(PropertyValueModel subjectHolder) { - super(subjectHolder); - this.record = new ArrayList(); - this.stateChangeListener = this.buildStateChangeListener(); - } - - - // ********** initialization ********** - - /** - * The subject's state has changed, do inventory and report to listeners. - */ - protected StateChangeListener buildStateChangeListener() { - return new StateChangeListener() { - public void stateChanged(StateChangeEvent event) { - ListCurator.this.submitInventoryReport(); - } - @Override - public String toString() { - return "state change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** ListValueModel implementation ********** - - public ListIterator iterator() { - return this.listIterator(); - } - - public ListIterator listIterator() { - return new ReadOnlyListIterator(this.record); - } - - /** - * Return the item at the specified index of the subject's list aspect. - */ - public E get(int index) { - return this.record.get(index); - } - - /** - * Return the size of the subject's list aspect. - */ - public int size() { - return this.record.size(); - } - - /** - * Return an array manifestation of the subject's list aspect. - */ - public Object[] toArray() { - return this.record.toArray(); - } - - - // ********** AspectAdapter implementation ********** - - @Override - protected ListIterator getValue() { - return this.iterator(); - } - - @Override - protected Class getListenerClass() { - return ListChangeListener.class; - } - - @Override - protected String getListenerAspectName() { - return LIST_VALUES; - } - - @Override - protected boolean hasListeners() { - return this.hasAnyListChangeListeners(LIST_VALUES); - } - - /** - * The aspect has changed, notify listeners appropriately. - */ - @Override - protected void fireAspectChanged(Object oldValue, Object newValue) { - this.fireListChanged(LIST_VALUES, this.record); - } - - /** - * The subject is not null - add our listener. - */ - @Override - protected void engageSubject_() { - ((Model) this.subject).addStateChangeListener(this.stateChangeListener); - // synch our list *after* we start listening to the subject, - // since its value might change when a listener is added - CollectionTools.addAll(this.record, this.iteratorForRecord()); - } - - /** - * The subject is not null - remove our listener. - */ - @Override - protected void disengageSubject_() { - ((Model) this.subject).removeStateChangeListener(this.stateChangeListener); - // clear out the list when we are not listening to the subject - this.record.clear(); - } - - - // ********** ListCurator protocol ********** - - /** - * This is intended to be different from {@link ListValueModel#iterator()}. - * It is intended to be used only when the subject changes or the - * subject's "state" changes (as signified by a state change event). - */ - protected abstract Iterator iteratorForRecord(); - - - // ********** behavior ********** - - void submitInventoryReport() { - List newRecord = CollectionTools.list(this.iteratorForRecord()); - int recordIndex = 0; - - // add items from the new record - for (E newItem : newRecord) { - this.inventoryNewItem(recordIndex, newItem); - recordIndex++; - } - - // clean out items that are no longer in the new record - for (recordIndex = 0; recordIndex < this.record.size(); ) { - E item = this.record.get(recordIndex); - - if (newRecord.contains(item)) { - recordIndex++; - } else { - this.removeItemFromInventory(recordIndex, item); - } - } - } - - private void inventoryNewItem(int recordIndex, E newItem) { - List rec = new ArrayList(this.record); - - if ((recordIndex < rec.size()) && rec.get(recordIndex).equals(newItem)) { - return; - } - if (rec.contains(newItem)) { - this.removeItemFromInventory(recordIndex, rec.get(recordIndex)); - this.inventoryNewItem(recordIndex, newItem); - } else { - this.addItemToInventory(recordIndex, newItem); - } - } - - private void addItemToInventory(int index, E item) { - this.addItemToList(index, item, this.record, LIST_VALUES); - } - - private void removeItemFromInventory(int index, @SuppressWarnings("unused") E item) { - this.removeItemFromList(index, this.record, LIST_VALUES); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.record); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListPropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListPropertyValueModelAdapter.java deleted file mode 100644 index e3f7105771..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListPropertyValueModelAdapter.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * This abstract class provides the infrastructure needed to wrap - * a list value model, "lazily" listen to it, and convert - * its change notifications into property value model change - * notifications. - *

- * Subclasses must override:

    - *
  • {@link #buildValue()}

    - * to return the current property value, as derived from the - * current list value - *

- * Subclasses might want to override the following methods - * to improve performance (by not recalculating the value, if possible):
    - *
  • {@link #itemsAdded(ListAddEvent event)} - *
  • {@link #itemsRemoved(ListRemoveEvent event)} - *
  • {@link #itemsReplaced(ListReplaceEvent event)} - *
  • {@link #itemsMoved(ListMoveEvent event)} - *
  • {@link #listCleared(ListClearEvent event)} - *
  • {@link #listChanged(ListChangeEvent event)} - *
- */ -public abstract class ListPropertyValueModelAdapter - extends AbstractPropertyValueModelAdapter -{ - /** The wrapped list value model. */ - protected final ListValueModel listHolder; - - /** A listener that allows us to synch with changes to the wrapped list holder. */ - protected final ListChangeListener listChangeListener; - - - // ********** constructor/initialization ********** - - /** - * Construct a property value model with the specified wrapped - * list value model. - */ - protected ListPropertyValueModelAdapter(ListValueModel listHolder) { - super(); - this.listHolder = listHolder; - this.listChangeListener = this.buildListChangeListener(); - } - - protected ListChangeListener buildListChangeListener() { - return new ListChangeListener() { - public void itemsAdded(ListAddEvent event) { - ListPropertyValueModelAdapter.this.itemsAdded(event); - } - public void itemsRemoved(ListRemoveEvent event) { - ListPropertyValueModelAdapter.this.itemsRemoved(event); - } - public void itemsReplaced(ListReplaceEvent event) { - ListPropertyValueModelAdapter.this.itemsReplaced(event); - } - public void itemsMoved(ListMoveEvent event) { - ListPropertyValueModelAdapter.this.itemsMoved(event); - } - public void listCleared(ListClearEvent event) { - ListPropertyValueModelAdapter.this.listCleared(event); - } - public void listChanged(ListChangeEvent event) { - ListPropertyValueModelAdapter.this.listChanged(event); - } - @Override - public String toString() { - return "list change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** behavior ********** - - /** - * Start listening to the list holder. - */ - @Override - protected void engageModel_() { - this.listHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - } - - /** - * Stop listening to the list holder. - */ - @Override - protected void disengageModel_() { - this.listHolder.removeListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - } - - - // ********** collection change support ********** - - /** - * Items were added to the wrapped list holder; - * propagate the change notification appropriately. - */ - protected void itemsAdded(@SuppressWarnings("unused") ListAddEvent event) { - // by default, simply recalculate the value and fire an event - this.propertyChanged(); - } - - /** - * Items were removed from the wrapped list holder; - * propagate the change notification appropriately. - */ - protected void itemsRemoved(@SuppressWarnings("unused") ListRemoveEvent event) { - // by default, simply recalculate the value and fire an event - this.propertyChanged(); - } - - /** - * Items were replaced in the wrapped list holder; - * propagate the change notification appropriately. - */ - protected void itemsReplaced(@SuppressWarnings("unused") ListReplaceEvent event) { - // by default, simply recalculate the value and fire an event - this.propertyChanged(); - } - - /** - * Items were moved in the wrapped list holder; - * propagate the change notification appropriately. - */ - protected void itemsMoved(@SuppressWarnings("unused") ListMoveEvent event) { - // by default, simply recalculate the value and fire an event - this.propertyChanged(); - } - - /** - * The wrapped list holder was cleared; - * propagate the change notification appropriately. - */ - protected void listCleared(@SuppressWarnings("unused") ListClearEvent event) { - // by default, simply recalculate the value and fire an event - this.propertyChanged(); - } - - /** - * The value of the wrapped list holder has changed; - * propagate the change notification appropriately. - */ - protected void listChanged(@SuppressWarnings("unused") ListChangeEvent event) { - // by default, simply recalculate the value and fire an event - this.propertyChanged(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListValueModelWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListValueModelWrapper.java deleted file mode 100644 index 7e01a399f3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ListValueModelWrapper.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * This abstract class provides the infrastructure needed to wrap - * another list value model, "lazily" listen to it, and propagate - * its change notifications. Subclasses must implement the appropriate - * {@link ListValueModel}. - */ -public abstract class ListValueModelWrapper - extends AbstractListValueModel -{ - /** The wrapped list value model. */ - protected final ListValueModel listHolder; - - /** A listener that allows us to synch with changes to the wrapped list holder. */ - protected final ListChangeListener listChangeListener; - - - // ********** constructors ********** - - /** - * Construct a list value model with the specified wrapped - * list value model. - */ - protected ListValueModelWrapper(ListValueModel listHolder) { - super(); - if (listHolder == null) { - throw new NullPointerException(); - } - this.listHolder = listHolder; - this.listChangeListener = this.buildListChangeListener(); - } - - - // ********** initialization ********** - - protected ListChangeListener buildListChangeListener() { - return new ListChangeListener() { - public void itemsAdded(ListAddEvent event) { - ListValueModelWrapper.this.itemsAdded(event); - } - public void itemsRemoved(ListRemoveEvent event) { - ListValueModelWrapper.this.itemsRemoved(event); - } - public void itemsReplaced(ListReplaceEvent event) { - ListValueModelWrapper.this.itemsReplaced(event); - } - public void itemsMoved(ListMoveEvent event) { - ListValueModelWrapper.this.itemsMoved(event); - } - public void listCleared(ListClearEvent event) { - ListValueModelWrapper.this.listCleared(event); - } - public void listChanged(ListChangeEvent event) { - ListValueModelWrapper.this.listChanged(event); - } - @Override - public String toString() { - return "list change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** behavior ********** - - /** - * Start listening to the list holder. - */ - @Override - protected void engageModel() { - this.listHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - } - - /** - * Stop listening to the list holder. - */ - @Override - protected void disengageModel() { - this.listHolder.removeListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getItems(ListAddEvent event) { - return (Iterable) event.getItems(); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getItems(ListRemoveEvent event) { - return (Iterable) event.getItems(); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getNewItems(ListReplaceEvent event) { - return (Iterable) event.getNewItems(); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getOldItems(ListReplaceEvent event) { - return (Iterable) event.getOldItems(); - } - - - // ********** list change support ********** - - /** - * Items were added to the wrapped list holder; - * propagate the change notification appropriately. - */ - protected abstract void itemsAdded(ListAddEvent event); - - /** - * Items were removed from the wrapped list holder; - * propagate the change notification appropriately. - */ - protected abstract void itemsRemoved(ListRemoveEvent event); - - /** - * Items were replaced in the wrapped list holder; - * propagate the change notification appropriately. - */ - protected abstract void itemsReplaced(ListReplaceEvent event); - - /** - * Items were moved in the wrapped list holder; - * propagate the change notification appropriately. - */ - protected abstract void itemsMoved(ListMoveEvent event); - - /** - * The wrapped list holder was cleared; - * propagate the change notification appropriately. - */ - protected abstract void listCleared(ListClearEvent event); - - /** - * The value of the wrapped list holder has changed; - * propagate the change notification appropriately. - */ - protected abstract void listChanged(ListChangeEvent event); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullCollectionValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullCollectionValueModel.java deleted file mode 100644 index ba1061b96c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullCollectionValueModel.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; - -/** - * A read-only collection value model for when you - * don't need to support a collection. In particular, this - * is useful for the leaf nodes of a tree that never have - * children. - *

- * We don't use a singleton because we hold on to listeners. - */ -public final class NullCollectionValueModel - extends AbstractModel - implements CollectionValueModel -{ - private static final long serialVersionUID = 1L; - - /** - * Default constructor. - */ - public NullCollectionValueModel() { - super(); - } - - - // ********** CollectionValueModel implementation ********** - - public int size() { - return 0; - } - - public Iterator iterator() { - return EmptyIterator.instance(); - } - - - // ********** Object overrides ********** - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullListValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullListValueModel.java deleted file mode 100644 index 78801cce30..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullListValueModel.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Iterator; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * An empty list value model for when you don't - * need to support a list. - *

- * We don't use a singleton because we hold on to listeners. - */ -public final class NullListValueModel - extends AbstractModel - implements ListValueModel -{ - private static final Object[] EMPTY_ARRAY = new Object[0]; - private static final long serialVersionUID = 1L; - - /** - * Default constructor. - */ - public NullListValueModel() { - super(); - } - - - // ********** ListValueModel implementation ********** - - public Iterator iterator() { - return EmptyIterator.instance(); - } - - public ListIterator listIterator() { - return EmptyListIterator.instance(); - } - - public int size() { - return 0; - } - - public E get(int index) { - throw new IndexOutOfBoundsException("Index: " + index + ", Size: 0"); //$NON-NLS-1$ //$NON-NLS-2$ - } - - public Object[] toArray() { - return EMPTY_ARRAY; - } - - - // ********** Object overrides ********** - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullPropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullPropertyValueModel.java deleted file mode 100644 index f445d96b36..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullPropertyValueModel.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * A property value model for when you - * don't need to support a value. - *

- * We don't use a singleton because we hold on to listeners. - */ -public final class NullPropertyValueModel - extends AbstractModel - implements PropertyValueModel -{ - private static final long serialVersionUID = 1L; - - /** - * Default constructor. - */ - public NullPropertyValueModel() { - super(); - } - - - // ********** PropertyValueModel implementation ********** - - public T getValue() { - return null; - } - - - // ********** Object overrides ********** - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullTreeValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullTreeValueModel.java deleted file mode 100644 index ad4b960b6e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/NullTreeValueModel.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.model.value.TreeValueModel; - -/** - * A tree value model for when you - * don't need to support any nodes. - *

- * We don't use a singleton because we hold on to listeners. - */ -public final class NullTreeValueModel - extends AbstractModel - implements TreeValueModel -{ - private static final long serialVersionUID = 1L; - - /** - * Default constructor. - */ - public NullTreeValueModel() { - super(); - } - - - // ********** TreeValueModel implementation ********** - - public Iterator nodes() { - return EmptyIterator.instance(); - } - - - // ********** Object overrides ********** - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyAspectAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyAspectAdapter.java deleted file mode 100644 index 327a7342d3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyAspectAdapter.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Arrays; -import java.util.Collection; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * This {@link AspectPropertyValueModelAdapter} provides basic property change support. - * This converts a set of one or more standard properties into - * a single {@link #VALUE} property. - *

- * The typical subclass will override the following methods (see the descriptions - * in {@link AspectPropertyValueModelAdapter}):

    - *
  • {@link #buildValue_()} - *
  • {@link #setValue_(Object)} - *
  • {@link #buildValue()} - *
  • {@link #setValue(Object)} - *
- */ -public abstract class PropertyAspectAdapter - extends AspectPropertyValueModelAdapter -{ - /** The name of the subject's properties that we use for the value. */ - protected final String[] propertyNames; - protected static final String[] EMPTY_PROPERTY_NAMES = new String[0]; - - /** A listener that listens to the appropriate properties of the subject. */ - protected final PropertyChangeListener propertyChangeListener; - - - // ********** constructors ********** - - /** - * Construct a property aspect adapter for the specified subject - * and property. - */ - protected PropertyAspectAdapter(String propertyName, S subject) { - this(new String[] {propertyName}, subject); - } - - /** - * Construct a property aspect adapter for the specified subject - * and properties. - */ - protected PropertyAspectAdapter(String[] propertyNames, S subject) { - this(new StaticPropertyValueModel(subject), propertyNames); - } - - /** - * Construct a property aspect adapter for the specified subject holder - * and properties. - */ - protected PropertyAspectAdapter(PropertyValueModel subjectHolder, String... propertyNames) { - super(subjectHolder); - this.propertyNames = propertyNames; - this.propertyChangeListener = this.buildPropertyChangeListener(); - } - - /** - * Construct a property aspect adapter for the specified subject holder - * and properties. - */ - protected PropertyAspectAdapter(PropertyValueModel subjectHolder, Collection propertyNames) { - this(subjectHolder, propertyNames.toArray(new String[propertyNames.size()])); - } - - /** - * Construct a property aspect adapter for an "unchanging" property in - * the specified subject. This is useful for a property aspect that does not - * change for a particular subject; but the subject will change, resulting in - * a new property. (A {@link TransformationPropertyValueModel} could also be - * used in this situation.) - */ - protected PropertyAspectAdapter(PropertyValueModel subjectHolder) { - this(subjectHolder, EMPTY_PROPERTY_NAMES); - } - - - // ********** initialization ********** - - protected PropertyChangeListener buildPropertyChangeListener() { - // transform the subject's property change events into VALUE property change events - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - PropertyAspectAdapter.this.propertyChanged(event); - } - @Override - public String toString() { - return "property change listener: " + Arrays.asList(PropertyAspectAdapter.this.propertyNames); //$NON-NLS-1$ - } - }; - } - - - // ********** AspectAdapter implementation ********** - - @Override - protected void engageSubject_() { - for (String propertyName : this.propertyNames) { - ((Model) this.subject).addPropertyChangeListener(propertyName, this.propertyChangeListener); - } - } - - @Override - protected void disengageSubject_() { - for (String propertyName : this.propertyNames) { - ((Model) this.subject).removePropertyChangeListener(propertyName, this.propertyChangeListener); - } - } - - protected void propertyChanged(@SuppressWarnings("unused") PropertyChangeEvent event) { - this.propertyChanged(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyCollectionValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyCollectionValueModelAdapter.java deleted file mode 100644 index 1d432aeda5..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyCollectionValueModelAdapter.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Collections; -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.SingleElementIterator; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * An adapter that allows us to make a {@link PropertyValueModel} behave like - * a read-only, single-element {@link CollectionValueModel}, sorta. - *

- * If the property's value is null, an empty iterator is returned - * (i.e. you can't have a collection with a null element). - */ -public class PropertyCollectionValueModelAdapter - extends AbstractCollectionValueModel - implements CollectionValueModel -{ - /** The wrapped property value model. */ - protected final PropertyValueModel valueHolder; - - /** A listener that forwards any events fired by the value holder. */ - protected final PropertyChangeListener propertyChangeListener; - - /** Cache the value. */ - protected E value; - - - // ********** constructors/initialization ********** - - /** - * Convert the specified property value model to a collection - * value model. - */ - public PropertyCollectionValueModelAdapter(PropertyValueModel valueHolder) { - super(); - if (valueHolder == null) { - throw new NullPointerException(); - } - this.valueHolder = valueHolder; - this.propertyChangeListener = this.buildPropertyChangeListener(); - this.value = null; - // postpone building the value and listening to the underlying value - // until we have listeners ourselves... - } - - /** - * The wrapped value has changed, forward an equivalent - * collection change event to our listeners. - */ - protected PropertyChangeListener buildPropertyChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - @SuppressWarnings("unchecked") - E eventNewValue = (E) event.getNewValue(); - PropertyCollectionValueModelAdapter.this.valueChanged(eventNewValue); - } - @Override - public String toString() { - return "property change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** CollectionValueModel implementation ********** - - public Iterator iterator() { - return (this.value == null) ? EmptyIterator.instance() : this.iterator_(); - } - - protected Iterator iterator_() { - return new SingleElementIterator(this.value); - } - - public int size() { - return (this.value == null) ? 0 : 1; - } - - - // ********** AbstractCollectionValueModel implementation ********** - - @Override - protected void engageModel() { - this.valueHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.propertyChangeListener); - // synch our value *after* we start listening to the value holder, - // since its value might change when a listener is added - this.value = this.valueHolder.getValue(); - } - - @Override - protected void disengageModel() { - this.valueHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.propertyChangeListener); - // clear out the value when we are not listening to the value holder - this.value = null; - } - - - // ********** behavior ********** - - /** - * synchronize our internal value with the wrapped value - * and fire the appropriate events - */ - protected void valueChanged(E newValue) { - E oldValue = this.value; - this.value = newValue; - if (oldValue == null) { - // we wouldn't get the event if the new value were null too - this.fireItemAdded(VALUES, newValue); - } else { - if (newValue == null) { - this.fireItemRemoved(VALUES, oldValue); - } else { - // we wouldn't get the event if the new value was the same as the old - this.fireCollectionChanged(VALUES, Collections.singleton(newValue)); - } - } - } - - @Override - public void toString(StringBuilder sb) { - StringTools.append(sb, this); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyListValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyListValueModelAdapter.java deleted file mode 100644 index 81fa3cc8a8..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyListValueModelAdapter.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Iterator; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.SingleElementListIterator; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * An adapter that allows us to make a {@link PropertyValueModel} behave like - * a read-only, single-element {@link ListValueModel}, sorta. - *

- * If the property's value is null, an empty iterator is returned - * (i.e. you can't have a collection with a null element). - */ -public class PropertyListValueModelAdapter - extends AbstractListValueModel - implements ListValueModel -{ - /** The wrapped property value model. */ - protected final PropertyValueModel valueHolder; - - /** A listener that forwards any events fired by the value holder. */ - protected final PropertyChangeListener propertyChangeListener; - - /** Cache the value. */ - protected E value; - - - // ********** constructors/initialization ********** - - /** - * Convert the specified property value model to a list - * value model. - */ - public PropertyListValueModelAdapter(PropertyValueModel valueHolder) { - super(); - if (valueHolder == null) { - throw new NullPointerException(); - } - this.valueHolder = valueHolder; - this.propertyChangeListener = this.buildPropertyChangeListener(); - // postpone building the value and listening to the underlying value - // until we have listeners ourselves... - } - - /** - * The wrapped value has changed, forward an equivalent - * list change event to our listeners. - */ - protected PropertyChangeListener buildPropertyChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - @SuppressWarnings("unchecked") - E eventNewValue = (E) event.getNewValue(); - PropertyListValueModelAdapter.this.valueChanged(eventNewValue); - } - @Override - public String toString() { - return "property change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** ListValueModel implementation ********** - - public Iterator iterator() { - return this.listIterator(); - } - - public ListIterator listIterator() { - return (this.value == null) ? - EmptyListIterator.instance() - : - new SingleElementListIterator(this.value); - } - - public int size() { - return (this.value == null) ? 0 : 1; - } - - public E get(int index) { - if (this.value == null) { - throw this.buildIOOBE(index, 0); - } - if (index > 0) { - throw this.buildIOOBE(index, 1); - } - return this.value; - } - - protected static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; - public Object[] toArray() { - return (this.value == null) ? EMPTY_OBJECT_ARRAY : new Object[] {this.value}; - } - - - // ********** behavior ********** - - protected IndexOutOfBoundsException buildIOOBE(int index, int size) { - return new IndexOutOfBoundsException("Index: " + index + ", Size: " + size); //$NON-NLS-1$ //$NON-NLS-2$ - } - - @Override - protected void engageModel() { - this.valueHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.propertyChangeListener); - // synch our value *after* we start listening to the value holder, - // since its value might change when a listener is added - this.value = this.valueHolder.getValue(); - } - - @Override - protected void disengageModel() { - this.valueHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.propertyChangeListener); - // clear out the value when we are not listening to the value holder - this.value = null; - } - - /** - * synchronize our internal value with the wrapped value - * and fire the appropriate events - */ - protected void valueChanged(E newValue) { - E oldValue = this.value; - this.value = newValue; - if (oldValue == null) { - this.fireItemAdded(LIST_VALUES, 0, newValue); - } else { - if (newValue == null) { - this.fireItemRemoved(LIST_VALUES, 0, oldValue); - } else { - this.fireItemReplaced(LIST_VALUES, 0, newValue, oldValue); - } - } - } - - @Override - public void toString(StringBuilder sb) { - StringTools.append(sb, this); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyValueModelWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyValueModelWrapper.java deleted file mode 100644 index 241b85d609..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/PropertyValueModelWrapper.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * This abstract class provides the infrastructure needed to wrap - * another property value model, "lazily" listen to it, and propagate - * its change notifications. Subclasses must implement the appropriate - * {@link PropertyValueModel}. - *

- * Subclasses must implement the following methods:

    - *
  • {@link #valueChanged(PropertyChangeEvent)}

    - * implement this method to propagate the appropriate change notification - *

- */ -public abstract class PropertyValueModelWrapper - extends AbstractPropertyValueModel -{ - /** The wrapped property value model. */ - protected final PropertyValueModel valueHolder; - - /** A listener that allows us to synch with changes to the wrapped value holder. */ - protected final PropertyChangeListener valueChangeListener; - - - // ********** constructors/initialization ********** - - /** - * Construct a property value model with the specified wrapped - * property value model. The value holder is required. - */ - protected PropertyValueModelWrapper(PropertyValueModel valueHolder) { - super(); - if (valueHolder == null) { - throw new NullPointerException(); - } - this.valueHolder = valueHolder; - this.valueChangeListener = this.buildValueChangeListener(); - } - - protected PropertyChangeListener buildValueChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - PropertyValueModelWrapper.this.valueChanged(event); - } - @Override - public String toString() { - return "value change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** behavior ********** - - /** - * Begin listening to the value holder. - */ - @Override - protected void engageModel() { - this.valueHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.valueChangeListener); - } - - /** - * Stop listening to the value holder. - */ - @Override - protected void disengageModel() { - this.valueHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.valueChangeListener); - } - - - // ********** property change support ********** - - /** - * The value of the wrapped value holder has changed; - * propagate the change notification appropriately. - */ - protected abstract void valueChanged(PropertyChangeEvent event); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ReadOnlyWritablePropertyValueModelWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ReadOnlyWritablePropertyValueModelWrapper.java deleted file mode 100644 index dcf7b97594..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ReadOnlyWritablePropertyValueModelWrapper.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * A simple implementation of {@link WritablePropertyValueModel} that actually - * ... isn't ... writable. It can however be used in places that require a - * {@link WritablePropertyValueModel} and where the developer is sure that no - * attempt will be made to write to it. - */ -public class ReadOnlyWritablePropertyValueModelWrapper - extends PropertyValueModelWrapper - implements WritablePropertyValueModel -{ - public ReadOnlyWritablePropertyValueModelWrapper(PropertyValueModel valueHolder) { - super(valueHolder); - } - - - public T getValue() { - return this.valueHolder.getValue(); - } - - public void setValue(T value) { - throw new UnsupportedOperationException(); - } - - @Override - protected void valueChanged(PropertyChangeEvent event) { - this.firePropertyChanged(event.clone(this)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getValue()); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SetCollectionValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SetCollectionValueModel.java deleted file mode 100644 index d04722f9ff..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SetCollectionValueModel.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyIterator; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * A SetCollectionValueModel wraps another - * {@link CollectionValueModel} and returns the items in the collection - * only once. - */ -public class SetCollectionValueModel - extends CollectionValueModelWrapper - implements CollectionValueModel -{ - private final HashBag bag = new HashBag(); - - - // ********** constructors ********** - - /** - * Construct a collection value model with the specified wrapped - * collection value model and a filter that simply accepts every object. - */ - public SetCollectionValueModel(CollectionValueModel collectionHolder) { - super(collectionHolder); - } - - /** - * Construct a collection value model with the specified wrapped - * list value model and a filter that simply accepts every object. - */ - public SetCollectionValueModel(ListValueModel listHolder) { - this(new ListCollectionValueModelAdapter(listHolder)); - } - - - // ********** CollectionValueModel implementation ********** - - public Iterator iterator() { - return new ReadOnlyIterator(this.bag.uniqueIterator()); - } - - public int size() { - return this.bag.uniqueCount(); - } - - - // ********** CollectionValueModelWrapper overrides/implementation ********** - - @Override - protected void engageModel() { - super.engageModel(); - // synch our cache *after* we start listening to the nested collection, - // since its value might change when a listener is added - CollectionTools.addAll(this.bag, this.collectionHolder); - } - - @Override - protected void disengageModel() { - super.disengageModel(); - // clear out the cache when we are not listening to the nested collection - this.bag.clear(); - } - - @Override - protected void itemsAdded(CollectionAddEvent event) { - ArrayList addedItems = new ArrayList(event.getItemsSize()); - int uniqueCount = this.bag.uniqueCount(); - for (E item : this.getItems(event)) { - this.bag.add(item); - if (this.bag.uniqueCount() > uniqueCount) { - uniqueCount = this.bag.uniqueCount(); - addedItems.add(item); - } - } - this.fireItemsAdded(VALUES, addedItems); - } - - @Override - protected void itemsRemoved(CollectionRemoveEvent event) { - ArrayList removedItems = new ArrayList(event.getItemsSize()); - int uniqueCount = this.bag.uniqueCount(); - for (E item : this.getItems(event)) { - if (this.bag.remove(item)) { - if (this.bag.uniqueCount() < uniqueCount) { - uniqueCount = this.bag.uniqueCount(); - removedItems.add(item); - } - } else { - throw new IllegalStateException("missing item: " + item); //$NON-NLS-1$ - } - } - this.fireItemsRemoved(VALUES, removedItems); - } - - @Override - protected void collectionCleared(CollectionClearEvent event) { - this.clearCollection(this.bag, VALUES); - } - - @Override - protected void collectionChanged(CollectionChangeEvent event) { - this.bag.clear(); - CollectionTools.addAll(this.bag, this.collectionHolder); - this.fireCollectionChanged(VALUES, new HashSet(this.bag)); - } - - @Override - public void toString(StringBuilder sb) { - StringTools.append(sb, this); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SimpleCollectionValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SimpleCollectionValueModel.java deleted file mode 100644 index 794eec1e11..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SimpleCollectionValueModel.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Collection; -import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.common.utility.internal.model.SingleAspectChangeSupport; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.WritableCollectionValueModel; - -/** - * Implementation of {@link WritableCollectionValueModel} and {@link Collection} - * that simply holds a collection and notifies listeners of any changes. - */ -public class SimpleCollectionValueModel - extends AbstractModel - implements WritableCollectionValueModel, Collection -{ - /** The collection. */ - protected final Collection collection; - - - // ********** constructors ********** - - /** - * Construct a collection value model for the specified collection. - */ - public SimpleCollectionValueModel(Collection collection) { - super(); - if (collection == null) { - throw new NullPointerException(); - } - this.collection = collection; - } - - /** - * Construct a collection value model with an empty initial collection. - */ - public SimpleCollectionValueModel() { - this(new HashBag()); - } - - @Override - protected ChangeSupport buildChangeSupport() { - return new SingleAspectChangeSupport(this, CollectionChangeListener.class, VALUES); - } - - - // ********** CollectionValueModel implementation ********** - - public Iterator iterator() { - return new LocalIterator(this.collection.iterator()); - } - - public int size() { - return this.collection.size(); - } - - - // ********** WritableCollectionValueModel implementation ********** - - /** - * Allow the collection's elements to be replaced. - */ - public void setValues(Iterable values) { - if (values == null) { - throw new NullPointerException(); - } - this.collection.clear(); - CollectionTools.addAll(this.collection, values); - this.fireCollectionChanged(VALUES, this.collection); - } - - - // ********** Collection implementation ********** - - public boolean isEmpty() { - return this.collection.isEmpty(); - } - - public boolean contains(Object o) { - return this.collection.contains(o); - } - - public Object[] toArray() { - return this.collection.toArray(); - } - - public T[] toArray(T[] a) { - return this.collection.toArray(a); - } - - public boolean add(E o) { - return this.addItemToCollection(o, this.collection, VALUES); - } - - public boolean remove(Object o) { - return this.removeItemFromCollection(o, this.collection, VALUES); - } - - public boolean containsAll(Collection c) { - return this.collection.containsAll(c); - } - - public boolean addAll(Collection c) { - return this.addItemsToCollection(c, this.collection, VALUES); - } - - public boolean removeAll(Collection c) { - return this.removeItemsFromCollection(c, this.collection, VALUES); - } - - public boolean retainAll(Collection c) { - return this.retainItemsInCollection(c, this.collection, VALUES); - } - - public void clear() { - this.clearCollection(this.collection, VALUES); - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if ((o instanceof Collection) && (o instanceof CollectionValueModel)) { - Collection c1 = CollectionTools.collection(this.collection); - @SuppressWarnings("unchecked") - Collection c2 = CollectionTools.collection(((Collection) o).iterator()); - return c1.equals(c2); - } - return false; - } - - @Override - public int hashCode() { - return CollectionTools.collection(this.collection).hashCode(); - } - - - // ********** miscellaneous ********** - - @Override - public void toString(StringBuilder sb) { - sb.append(this.collection); - } - - - // ********** iterator ********** - - private class LocalIterator implements Iterator { - private final Iterator iterator; - private T next; - - LocalIterator(Iterator iterator) { - super(); - this.iterator = iterator; - } - - public boolean hasNext() { - return this.iterator.hasNext(); - } - - public T next() { - return this.next = this.iterator.next(); - } - - @SuppressWarnings("synthetic-access") - public void remove() { - this.iterator.remove(); - SimpleCollectionValueModel.this.fireItemRemoved(VALUES, this.next); - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SimpleListValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SimpleListValueModel.java deleted file mode 100644 index 90943f9af1..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SimpleListValueModel.java +++ /dev/null @@ -1,322 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.common.utility.internal.model.SingleAspectChangeSupport; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.WritableListValueModel; - -/** - * Implementation of {@link ListValueModel} and {@link List} that simply holds a - * list and notifies listeners of any changes. - */ -public class SimpleListValueModel - extends AbstractModel - implements WritableListValueModel, List -{ - /** The list. */ - protected List list; - - - // ********** constructors ********** - - /** - * Construct a list value model for the specified list. - */ - public SimpleListValueModel(List list) { - super(); - if (list == null) { - throw new NullPointerException(); - } - this.list = list; - } - - /** - * Construct a list value model with an empty initial list. - */ - public SimpleListValueModel() { - this(new ArrayList()); - } - - @Override - protected ChangeSupport buildChangeSupport() { - return new SingleAspectChangeSupport(this, ListChangeListener.class, LIST_VALUES); - } - - - // ********** ListValueModel implementation ********** - - public Iterator iterator() { - return new LocalIterator(this.list.iterator()); - } - - public ListIterator listIterator() { - return new LocalListIterator(this.list.listIterator()); - } - - public int size() { - return this.list.size(); - } - - public E get(int index) { - return this.list.get(index); - } - - - // ********** WritableListValueModel implementation ********** - - /** - * Allow the list's elements to be replaced. - */ - public void setListValues(Iterable list) { - if (list == null) { - throw new NullPointerException(); - } - this.list.clear(); - CollectionTools.addAll(this.list, list); - this.fireListChanged(LIST_VALUES, this.list); - } - - - // ********** List implementation ********** - - public boolean isEmpty() { - return this.list.isEmpty(); - } - - public boolean contains(Object o) { - return this.list.contains(o); - } - - public Object[] toArray() { - return this.list.toArray(); - } - - public T[] toArray(T[] a) { - return this.list.toArray(a); - } - - public boolean add(E o) { - return this.addItemToList(o, this.list, LIST_VALUES); - } - - public boolean remove(Object o) { - return this.removeItemFromList(o, this.list, LIST_VALUES); - } - - public boolean containsAll(Collection c) { - return this.list.containsAll(c); - } - - public boolean addAll(Collection c) { - return this.addItemsToList(c, this.list, LIST_VALUES); - } - - public boolean addAll(int index, Collection c) { - return this.addItemsToList(index, c, this.list, LIST_VALUES); - } - - public boolean removeAll(Collection c) { - return this.removeItemsFromList(c, this.list, LIST_VALUES); - } - - public boolean retainAll(Collection c) { - return this.retainItemsInList(c, this.list, LIST_VALUES); - } - - public void clear() { - this.clearList(this.list, LIST_VALUES); - } - - @Override - public boolean equals(Object o) { - if (o == this) { - return true; - } - if ((o instanceof List) && (o instanceof ListValueModel)) { - List l1 = CollectionTools.list(this.list); - @SuppressWarnings("unchecked") - List l2 = CollectionTools.list(((List) o).iterator()); - return l1.equals(l2); - } - return false; - } - - @Override - public int hashCode() { - return this.list.hashCode(); - } - - public E set(int index, E element) { - return this.setItemInList(index, element, this.list, LIST_VALUES); - } - - public void add(int index, E element) { - this.addItemToList(index, element, this.list, LIST_VALUES); - } - - public E remove(int index) { - return this.removeItemFromList(index, this.list, LIST_VALUES); - } - - public int indexOf(Object o) { - return this.list.indexOf(o); - } - - public int lastIndexOf(Object o) { - return this.list.lastIndexOf(o); - } - - public ListIterator listIterator(int index) { - return new LocalListIterator(this.list.listIterator(index)); - } - - public List subList(int fromIndex, int toIndex) { - // TODO hmmm ~bjv - throw new UnsupportedOperationException(); - } - - - // ********** additional behavior ********** - - /** - * Move a single element. - */ - public void move(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.list, LIST_VALUES); - } - - /** - * Move a sub-list of elements. - */ - public void move(int targetIndex, int sourceIndex, int length) { - this.moveItemsInList(targetIndex, sourceIndex, length, this.list, LIST_VALUES); - } - - /** - * Remove a range of elements. - */ - public void remove(int index, int length) { - this.removeItemsFromList(index, length, this.list, LIST_VALUES); - } - - /** - * Set a range of elements. - */ - public void set(int index, List elements) { - this.setItemsInList(index, elements, this.list, LIST_VALUES); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.list); - } - - - // ********** iterators ********** - - private class LocalIterator implements Iterator { - private final Iterator iterator; - private int index = -1; - private T next; - - LocalIterator(Iterator iterator) { - super(); - this.iterator = iterator; - } - - public boolean hasNext() { - return this.iterator.hasNext(); - } - - public T next() { - this.next = this.iterator.next(); - this.index++; - return this.next; - } - - @SuppressWarnings("synthetic-access") - public void remove() { - this.iterator.remove(); - SimpleListValueModel.this.fireItemRemoved(LIST_VALUES, this.index, this.next); - } - - } - - private class LocalListIterator implements ListIterator { - private final ListIterator iterator; - private int last = -1; - private int next = 0; - private T current; - - LocalListIterator(ListIterator iterator) { - super(); - this.iterator = iterator; - } - - public boolean hasNext() { - return this.iterator.hasNext(); - } - - public T next() { - this.current = this.iterator.next(); - this.last = this.next++; - return this.current; - } - - public int nextIndex() { - return this.iterator.nextIndex(); - } - - public boolean hasPrevious() { - return this.iterator.hasPrevious(); - } - - public T previous() { - this.current = this.iterator.previous(); - this.last = --this.next; - return this.current; - } - - public int previousIndex() { - return this.iterator.previousIndex(); - } - - @SuppressWarnings("synthetic-access") - public void set(T o) { - this.iterator.set(o); - SimpleListValueModel.this.fireItemReplaced(LIST_VALUES, this.last, o, this.current); - } - - @SuppressWarnings("synthetic-access") - public void add(T o) { - this.iterator.add(o); - SimpleListValueModel.this.fireItemAdded(LIST_VALUES, this.next, o); - } - - @SuppressWarnings("synthetic-access") - public void remove() { - this.iterator.remove(); - SimpleListValueModel.this.fireItemRemoved(LIST_VALUES, this.last, this.current); - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SimplePropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SimplePropertyValueModel.java deleted file mode 100644 index 844d1c693e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SimplePropertyValueModel.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.common.utility.internal.model.SingleAspectChangeSupport; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * Implementation of {@link WritablePropertyValueModel} that simply holds on to an - * object and uses it as the value. - */ -public class SimplePropertyValueModel - extends AbstractModel - implements WritablePropertyValueModel -{ - /** The value. */ - protected T value; - - - /** - * Construct a property value model for the specified value. - */ - public SimplePropertyValueModel(T value) { - super(); - this.value = value; - } - - /** - * Construct a property value model with a starting value of null. - */ - public SimplePropertyValueModel() { - this(null); - } - - @Override - protected ChangeSupport buildChangeSupport() { - return new SingleAspectChangeSupport(this, PropertyChangeListener.class, VALUE); - } - - - public T getValue() { - return this.value; - } - - public void setValue(T value) { - T old = this.value; - this.value = value; - this.firePropertyChanged(VALUE, old, value); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SortedListValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SortedListValueModelAdapter.java deleted file mode 100644 index 0f1ff4cf55..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SortedListValueModelAdapter.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.Range; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; - -/** - * An adapter that allows us to make a {@link CollectionValueModel} - * (or {@link ListValueModel}) behave like a {@link ListValueModel} - * that keeps its contents sorted and notifies listeners appropriately. - *

- * The {@link Comparator} can be changed at any time; allowing the same - * adapter to be used with different sort criteria (e.g. when the user - * wants to sort a list of files first by name, then by date, then by size). - *

- * NB: Since we only listen to the wrapped collection when we have - * listeners ourselves and we can only stay in synch with the wrapped - * collection while we are listening to it, results to various methods - * (e.g. {@link #size()}, {@link #get(int)}) will be - * unpredictable whenever - * we do not have any listeners. This should not be too painful since, - * most likely, client objects will also be listeners. - * - * @see SortedListValueModelWrapper - */ -public class SortedListValueModelAdapter - extends CollectionListValueModelAdapter -{ - /** - * A comparator used for sorting the elements; - * if it is null, we use "natural ordering". - */ - protected Comparator comparator; - - - // ********** constructors ********** - - /** - * Wrap the specified collection value model and sort its contents - * using the specified comparator. - */ - public SortedListValueModelAdapter(CollectionValueModel collectionHolder, Comparator comparator) { - super(collectionHolder); - this.comparator = comparator; - } - - /** - * Wrap the specified collection value model and sort its contents - * based on the elements' "natural ordering". - */ - public SortedListValueModelAdapter(CollectionValueModel collectionHolder) { - this(collectionHolder, null); - } - - - // ********** accessors ********** - - public void setComparator(Comparator comparator) { - this.comparator = comparator; - this.sortList(); - } - - - // ********** behavior ********** - - /** - * Sort the internal list before the superclass - * sends out change notification. - */ - @Override - protected void buildList(int size) { - super.buildList(size); - Collections.sort(this.list, this.comparator); - } - - /** - * Sort the list after adding the items. - */ - @Override - protected void itemsAdded(CollectionAddEvent event) { - @SuppressWarnings("unchecked") - ArrayList newList = (ArrayList) this.list.clone(); - newList.ensureCapacity(newList.size() + event.getItemsSize()); - CollectionTools.addAll(newList, this.getItems(event)); - Collections.sort(newList, this.comparator); - this.synchronizeList(newList, this.list, LIST_VALUES); - } - - @Override - protected Iterable buildSyncList() { - return CollectionTools.sortedSet(this.collectionHolder, this.comparator, this.collectionHolder.size()); - } - - /** - * sort the list and notify our listeners, if necessary; - */ - protected void sortList() { - // save the unsorted state of the sorted list so we can minimize the number of "replaced" items - @SuppressWarnings("unchecked") - ArrayList unsortedList = (ArrayList) this.list.clone(); - Collections.sort(this.list, this.comparator); - Range diffRange = CollectionTools.identityDiffRange(unsortedList, this.list); - if (diffRange.size > 0) { - List unsortedItems = unsortedList.subList(diffRange.start, diffRange.end + 1); - List sortedItems = this.list.subList(diffRange.start, diffRange.end + 1); - this.fireItemsReplaced(LIST_VALUES, diffRange.start, sortedItems, unsortedItems); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SortedListValueModelWrapper.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SortedListValueModelWrapper.java deleted file mode 100644 index 8514f37266..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/SortedListValueModelWrapper.java +++ /dev/null @@ -1,250 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.Range; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyListIterator; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * A wrapper that keeps the contents of a {@link ListValueModel} sorted - * and notifies listeners appropriately. - *

- * The {@link Comparator} can be changed at any time; allowing the same - * adapter to be used with different sort criteria (e.g. when the user - * wants to sort a list of files first by name, then by date, then by size). - *

- * NB: Since we only listen to the wrapped collection when we have - * listeners ourselves and we can only stay in synch with the wrapped - * collection while we are listening to it, results to various methods - * (e.g. {@link #size()}, {@link #get(int)}) will be unpredictable whenever - * we do not have any listeners. This should not be too painful since, - * most likely, client objects will also be listeners. - * - * @see SortedListValueModelAdapter - */ -public class SortedListValueModelWrapper - extends ListValueModelWrapper - implements ListValueModel -{ - /** - * A comparator used for sorting the elements; - * if it is null, we use "natural ordering". - */ - protected Comparator comparator; - - /** - * Our internal list, which holds the same elements as - * the wrapped list, but keeps them sorted. - */ - // we declare this an ArrayList so we can use #clone() and #ensureCapacity(int) - protected final ArrayList sortedList; - - - // ********** constructors ********** - - /** - * Wrap the specified list value model and sort its contents - * using the specified comparator. - */ - public SortedListValueModelWrapper(ListValueModel listHolder, Comparator comparator) { - super(listHolder); - this.comparator = comparator; - this.sortedList = new ArrayList(listHolder.size()); - // postpone building the sorted list and listening to the wrapped list - // until we have listeners ourselves... - } - - /** - * Wrap the specified list value model and sort its contents - * based on the elements' "natural ordering". - */ - public SortedListValueModelWrapper(ListValueModel listHolder) { - this(listHolder, null); - } - - - // ********** ListValueModel implementation ********** - - public Iterator iterator() { - return this.listIterator(); - } - - public ListIterator listIterator() { - return new ReadOnlyListIterator(this.sortedList); - } - - public E get(int index) { - return this.sortedList.get(index); - } - - public int size() { - return this.sortedList.size(); - } - - public Object[] toArray() { - return this.sortedList.toArray(); - } - - - // ********** accessors ********** - - public void setComparator(Comparator comparator) { - this.comparator = comparator; - this.sortList(); - } - - - // ********** behavior ********** - - @Override - protected void engageModel() { - super.engageModel(); - // synch the sorted list *after* we start listening to the wrapped list holder, - // since its value might change when a listener is added - this.buildSortedList(); - } - - @Override - protected void disengageModel() { - super.disengageModel(); - // clear out the sorted list when we are not listening to the wrapped list holder - this.sortedList.clear(); - } - - protected void buildSortedList() { - // if the new list is empty, do nothing - int size = this.listHolder.size(); - if (size != 0) { - this.buildSortedList(size); - } - } - - protected void buildSortedList(int size) { - this.sortedList.ensureCapacity(size); - for (E each : this.listHolder) { - this.sortedList.add(each); - } - Collections.sort(this.sortedList, this.comparator); - } - - - // ********** list change support ********** - - /** - * Items were added to the wrapped list. - */ - @Override - protected void itemsAdded(ListAddEvent event) { - // first add the items and notify our listeners... - this.addItemsToList(this.getItems(event), this.sortedList, LIST_VALUES); - // ...then sort the list and notify our listeners - this.sortList(); - } - - /** - * Items were removed from the wrapped list. - */ - @Override - protected void itemsRemoved(ListRemoveEvent event) { - this.removeItemsFromList(this.getItems(event), this.sortedList, LIST_VALUES); - // no sorting needed - } - - /** - * Items were replaced in the wrapped list. - */ - @Override - protected void itemsReplaced(ListReplaceEvent event) { - // first remove the old items and notify our listeners... - this.removeItemsFromList(this.getOldItems(event), this.sortedList, LIST_VALUES); - // then add the new items and notify our listeners... - this.addItemsToList(this.getNewItems(event), this.sortedList, LIST_VALUES); - // ...then sort the list and notify our listeners - this.sortList(); - } - - /** - * Items were moved in the wrapped list. - */ - @Override - protected void itemsMoved(ListMoveEvent event) { - // do nothing - sort order should remain unchanged - } - - /** - * The wrapped list was cleared. - */ - @Override - protected void listCleared(ListClearEvent event) { - this.clearList(this.sortedList, LIST_VALUES); - } - - /** - * The wrapped list has changed in some dramatic fashion. - * Rebuild our sorted list and notify our listeners. - */ - @Override - protected void listChanged(ListChangeEvent event) { - int size = this.listHolder.size(); - if (size == 0) { - if (this.sortedList.isEmpty()) { - // no change - } else { - this.clearList(this.sortedList, LIST_VALUES); - } - } else { - if (this.sortedList.isEmpty()) { - this.buildSortedList(size); - this.fireItemsAdded(LIST_VALUES, 0, this.sortedList); - } else { - this.sortedList.clear(); - this.buildSortedList(size); - this.fireListChanged(LIST_VALUES, this.sortedList); - } - } - } - - /** - * sort the sorted list and notify our listeners, if necessary; - */ - protected void sortList() { - // save the unsorted state of the sorted list so we can minimize the number of "replaced" items - @SuppressWarnings("unchecked") - ArrayList unsortedList = (ArrayList) this.sortedList.clone(); - Collections.sort(this.sortedList, this.comparator); - Range diffRange = CollectionTools.identityDiffRange(unsortedList, this.sortedList); - if (diffRange.size > 0) { - List unsortedItems = unsortedList.subList(diffRange.start, diffRange.end + 1); - List sortedItems = this.sortedList.subList(diffRange.start, diffRange.end + 1); - this.fireItemsReplaced(LIST_VALUES, diffRange.start, sortedItems, unsortedItems); - } - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.sortedList); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StatePropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StatePropertyValueModelAdapter.java deleted file mode 100644 index 6d179ffa63..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StatePropertyValueModelAdapter.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; - -/** - * This abstract class provides the infrastructure needed to wrap - * a model, "lazily" listen to it, and convert - * its state change notifications into property value model change - * notifications. - *

- * Subclasses must implement:

    - *
  • {@link #buildValue()}

    - * to return the current property value, as derived from the - * current model - *

- * Subclasses might want to override the following methods - * to improve performance (by not recalculating the value, if possible):
    - *
  • {@link #stateChanged(StateChangeEvent event)} - *
- */ -public abstract class StatePropertyValueModelAdapter - extends AbstractPropertyValueModelAdapter -{ - /** The wrapped model. */ - protected final Model model; - - /** A listener that allows us to synch with changes to the wrapped model. */ - protected final StateChangeListener stateChangeListener; - - - // ********** constructor/initialization ********** - - /** - * Construct a property value model with the specified wrapped model. - */ - protected StatePropertyValueModelAdapter(Model model) { - super(); - this.model = model; - this.stateChangeListener = this.buildStateChangeListener(); - } - - protected StateChangeListener buildStateChangeListener() { - return new StateChangeListener() { - public void stateChanged(StateChangeEvent event) { - StatePropertyValueModelAdapter.this.stateChanged(event); - } - @Override - public String toString() { - return "state change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** behavior ********** - - /** - * Start listening to the model. - */ - @Override - protected void engageModel_() { - this.model.addStateChangeListener(this.stateChangeListener); - } - - /** - * Stop listening to the model. - */ - @Override - protected void disengageModel_() { - this.model.removeStateChangeListener(this.stateChangeListener); - } - - - // ********** state change support ********** - - /** - * The model's state changed; - * propagate the change notification appropriately. - */ - protected void stateChanged(@SuppressWarnings("unused") StateChangeEvent event) { - // by default, simply recalculate the value and fire an event - this.propertyChanged(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticCollectionValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticCollectionValueModel.java deleted file mode 100644 index 854528690a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticCollectionValueModel.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Arrays; -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; - -/** - * Implementation of {@link CollectionValueModel} that can be used for - * returning an iterator on a static collection, but still allows listeners to be added. - * Listeners will never be notified of any changes, because there should be none. - */ -public class StaticCollectionValueModel - extends AbstractModel - implements CollectionValueModel -{ - /** The elements. */ - protected final Object[] elements; - - private static final long serialVersionUID = 1L; - - - /** - * Construct a static collection value model for the specified array. - */ - public StaticCollectionValueModel(E... elements) { - super(); - this.elements = elements.clone(); - } - - /** - * Construct a static collection value model for the specified elements. - */ - public StaticCollectionValueModel(Iterable elements) { - super(); - this.elements = ArrayTools.array(elements); - } - - - // ********** CollectionValueModel implementation ********** - - public int size() { - return this.elements.length; - } - - @SuppressWarnings("unchecked") - public Iterator iterator() { - // we can cast here since our constructors require the elements to be - // of type E and ArrayIterator is read-only - return (Iterator) new ArrayIterator(this.elements); - } - - - // ********** Object overrides ********** - - @Override - public void toString(StringBuilder sb) { - sb.append(Arrays.toString(this.elements)); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticListValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticListValueModel.java deleted file mode 100644 index c08b6f42e8..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticListValueModel.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Arrays; -import java.util.Iterator; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayListIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * Implementation of {@link ListValueModel} that can be used for - * returning a list iterator on a static list, but still allows listeners to be added. - * Listeners will never be notified of any changes, because there should be none. - */ -public class StaticListValueModel - extends AbstractModel - implements ListValueModel -{ - /** The elements. */ - protected final Object[] elements; - - private static final long serialVersionUID = 1L; - - - /** - * Construct a static list value model for the specified elements. - */ - public StaticListValueModel(E... elements) { - super(); - this.elements = elements.clone(); - } - - /** - * Construct a static list value model for the specified elements. - */ - public StaticListValueModel(Iterable elements) { - super(); - this.elements = ArrayTools.array(elements); - } - - - // ********** ListValueModel implementation ********** - - @SuppressWarnings("unchecked") - public Iterator iterator() { - // we can cast here since our constructors require the elements to be - // of type E and ArrayIterator is read-only - return (Iterator) new ArrayIterator(this.elements); - } - - @SuppressWarnings("unchecked") - public ListIterator listIterator() { - // we can cast here since our constructors require the elements to be - // of type E and ArrayListIterator is read-only - return (ListIterator) new ArrayListIterator(this.elements); - } - - public int size() { - return this.elements.length; - } - - @SuppressWarnings("unchecked") - public E get(int index) { - // we can cast here since our constructors require the elements to be - // of type E - return (E) this.elements[index]; - } - - public Object[] toArray() { - return this.elements.clone(); - } - - - // ********** Object overrides ********** - - @Override - public void toString(StringBuilder sb) { - sb.append(Arrays.toString(this.elements)); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticPropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticPropertyValueModel.java deleted file mode 100644 index 678f5aaefd..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticPropertyValueModel.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * Implementation of {@link PropertyValueModel} that can be used for - * returning a static value, but still allows listeners to be added. - * Listeners will never be notified of any changes, because there should be none. - */ -public class StaticPropertyValueModel - extends AbstractModel - implements PropertyValueModel -{ - /** The value. */ - protected final T value; - - private static final long serialVersionUID = 1L; - - - /** - * Construct a static property value model for the specified value. - */ - public StaticPropertyValueModel(T value) { - super(); - this.value = value; - } - - - // ********** PropertyValueModel implementation ********** - - public T getValue() { - return this.value; - } - - - // ********** Object overrides ********** - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticTreeValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticTreeValueModel.java deleted file mode 100644 index 576e608985..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/StaticTreeValueModel.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.model.value.TreeValueModel; - -/** - * Implementation of {@link TreeValueModel} that can be used for - * returning an iterator on a static tree, but still allows listeners to be added. - * Listeners will never be notified of any changes, because there should be none. - */ -public class StaticTreeValueModel - extends AbstractModel - implements TreeValueModel -{ - /** The tree's nodes. */ - protected final Iterable nodes; - - private static final long serialVersionUID = 1L; - - - /** - * Construct a read-only tree value model for the specified nodes. - */ - public StaticTreeValueModel(Iterable nodes) { - super(); - if (nodes == null) { - throw new NullPointerException(); - } - this.nodes = nodes; - } - - // ********** TreeValueModel implementation ********** - - public Iterator nodes() { - return new ReadOnlyIterator(this.nodes.iterator()); - } - - - // ********** Object overrides ********** - - @Override - public void toString(StringBuilder sb) { - sb.append(this.nodes); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationListValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationListValueModel.java deleted file mode 100644 index 4a241b3004..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationListValueModel.java +++ /dev/null @@ -1,309 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyListIterator; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * An adapter that allows us to transform a {@link ListValueModel} - * (or adapted {@link CollectionValueModel}) into a read-only {@link ListValueModel} - * whose items are tranformations of the items in the wrapped - * {@link ListValueModel}. It will keep its contents in synch with - * the contents of the wrapped {@link ListValueModel} and notifies its - * listeners of any changes. - *

- * The {@link Transformer} can be changed at any time; allowing the same - * adapter to be used with different transformations. - *

- * As an alternative to building a {@link Transformer}, - * a subclass of TransformationListValueModelAdapter can - * either override {@link #transformItem_(Object)} or, - * if something other than null should be returned when the wrapped item - * is null, override {@link #transformItem(Object)}. - *

- * NB: Since we only listen to the wrapped list when we have - * listeners ourselves and we can only stay in synch with the wrapped - * list while we are listening to it, results to various methods - * (e.g. {@link #size()}, {@link #get(int)}) will be unpredictable whenever - * we do not have any listeners. This should not be too painful since, - * most likely, clients will also be listeners. - * - * @see Transformer - */ -public class TransformationListValueModel - extends ListValueModelWrapper - implements ListValueModel -{ - - /** This transforms the items, unless the subclass overrides {@link #transformItem(Object)}). */ - protected Transformer transformer; - - /** The list of transformed items. */ - protected final List transformedList; - - - // ********** constructors ********** - - /** - * Construct a list value model with the specified nested - * list value model and transformer. - */ - public TransformationListValueModel(ListValueModel listHolder, Transformer transformer) { - super(listHolder); - this.transformer = transformer; - this.transformedList = new ArrayList(); - } - - /** - * Construct a list value model with the specified nested - * list value model and the default transformer. - * Use this constructor if you want to override - * {@link #transformItem_(Object)} or {@link #transformItem(Object)} - * method instead of building a {@link Transformer}. - */ - public TransformationListValueModel(ListValueModel listHolder) { - super(listHolder); - this.transformer = this.buildTransformer(); - this.transformedList = new ArrayList(); - } - - /** - * Construct a list value model with the specified nested - * collection value model and transformer. - */ - public TransformationListValueModel(CollectionValueModel collectionHolder, Transformer transformer) { - this(new CollectionListValueModelAdapter(collectionHolder), transformer); - } - - /** - * Construct a list value model with the specified nested - * collection value model and the default transformer. - * Use this constructor if you want to override - * {@link #transformItem_(Object)} or {@link #transformItem(Object)} - * method instead of building a {@link Transformer}. - */ - public TransformationListValueModel(CollectionValueModel collectionHolder) { - this(new CollectionListValueModelAdapter(collectionHolder)); - } - - protected Transformer buildTransformer() { - return new DefaultTransformer(); - } - - - // ********** ListValueModel implementation ********** - - public Iterator iterator() { - return this.listIterator(); - } - - public ListIterator listIterator() { - return new ReadOnlyListIterator(this.transformedList); - } - - public E2 get(int index) { - return this.transformedList.get(index); - } - - public int size() { - return this.transformedList.size(); - } - - public Object[] toArray() { - return this.transformedList.toArray(); - } - - // ********** behavior ********** - - @Override - protected void engageModel() { - super.engageModel(); - // synch the transformed list *after* we start listening to the list holder, - // since its value might change when a listener is added - this.transformedList.addAll(this.transformItems(this.listHolder)); - } - - @Override - protected void disengageModel() { - super.disengageModel(); - // clear out the list when we are not listening to the collection holder - this.transformedList.clear(); - } - - /** - * Transform the items in the specified list value model. - */ - protected List transformItems(ListValueModel lvm) { - return this.transformItems(lvm, lvm.size()); - } - - /** - * Transform the items associated with the specified event. - */ - protected List transformItems(ListAddEvent event) { - return this.transformItems(this.getItems(event), event.getItemsSize()); - } - - /** - * Transform the items associated with the specified event. - */ - protected List transformItems(ListRemoveEvent event) { - return this.transformItems(this.getItems(event), event.getItemsSize()); - } - - /** - * Transform the new items associated with the specified event. - */ - protected List transformNewItems(ListReplaceEvent event) { - return this.transformItems(this.getNewItems(event), event.getItemsSize()); - } - - /** - * Transform the old items associated with the specified event. - */ - protected List transformOldItems(ListReplaceEvent event) { - return this.transformItems(this.getOldItems(event), event.getItemsSize()); - } - - /** - * Transform the specified items. - */ - protected List transformItems(Iterable items, int size) { - List result = new ArrayList(size); - for (E1 item : items) { - result.add(this.transformItem(item)); - } - return result; - } - - /** - * Transform the specified item. - */ - protected E2 transformItem(E1 item) { - return this.transformer.transform(item); - } - - /** - * Transform the specified, non-null, item and return the result. - */ - protected E2 transformItem_(@SuppressWarnings("unused") E1 item) { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - /** - * Change the transformer and rebuild the collection. - */ - public void setTransformer(Transformer transformer) { - this.transformer = transformer; - this.rebuildTransformedList(); - } - - /** - * Synchronize our cache with the wrapped collection. - */ - protected void rebuildTransformedList() { - this.synchronizeList(this.transformItems(this.listHolder), this.transformedList, LIST_VALUES); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.transformedList); - } - - - // ********** list change support ********** - - /** - * Items were added to the wrapped list holder. - * Transform them, add them to our transformation list, - * and notify our listeners. - */ - @Override - protected void itemsAdded(ListAddEvent event) { - this.addItemsToList(event.getIndex(), this.transformItems(event), this.transformedList, LIST_VALUES); - } - - /** - * Items were removed from the wrapped list holder. - * Remove the corresponding items from our transformation list - * and notify our listeners. - */ - @Override - protected void itemsRemoved(ListRemoveEvent event) { - this.removeItemsFromList(event.getIndex(), event.getItemsSize(), this.transformedList, LIST_VALUES); - } - - /** - * Items were replaced in the wrapped list holder. - * Replace the corresponding items in our transformation list - * and notify our listeners. - */ - @Override - protected void itemsReplaced(ListReplaceEvent event) { - this.setItemsInList(event.getIndex(), this.transformNewItems(event), this.transformedList, LIST_VALUES); - } - - /** - * Items were moved in the wrapped list holder. - * Move the corresponding items in our transformation list - * and notify our listeners. - */ - @Override - protected void itemsMoved(ListMoveEvent event) { - this.moveItemsInList(event.getTargetIndex(), event.getSourceIndex(), event.getLength(), this.transformedList, LIST_VALUES); - } - - /** - * The wrapped list holder was cleared. - * Clear our transformation list and notify our listeners. - */ - @Override - protected void listCleared(ListClearEvent event) { - this.clearList(this.transformedList, LIST_VALUES); - } - - /** - * The wrapped list holder has changed in some dramatic fashion. - * Rebuild our transformation list and notify our listeners. - */ - @Override - protected void listChanged(ListChangeEvent event) { - this.rebuildTransformedList(); - } - - - // ********** default transformer ********** - - /** - * The default transformer will return null if the wrapped item is null. - * If the wrapped item is not null, it is transformed by a subclass - * implementation of {@link TransformationListValueModel#transformItem_(Object)}. - */ - protected class DefaultTransformer implements Transformer { - public E2 transform(E1 item) { - return (item == null) ? null : TransformationListValueModel.this.transformItem_(item); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationPropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationPropertyValueModel.java deleted file mode 100644 index 6c7dadb7c4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationPropertyValueModel.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * A TransformationPropertyValueModel wraps another - * {@link PropertyValueModel} and uses a {@link Transformer} - * to transform the wrapped value before it is returned by {@link #getValue()}. - *

- * As an alternative to building a {@link Transformer}, - * a subclass of TransformationPropertyValueModel can - * either override {@link #transform_(Object)} or, - * if something other than null should be returned when the wrapped value - * is null, override {@link #transform(Object)}. - * - * @see Transformer - */ -public class TransformationPropertyValueModel - extends PropertyValueModelWrapper - implements PropertyValueModel -{ - protected final Transformer transformer; - - - // ********** constructors/initialization ********** - - /** - * Construct a property value model with the specified nested - * property value model and the default transformer. - * Use this constructor if you want to override - * {@link #transform_(Object)} or {@link #transform(Object)} - * method instead of building a {@link Transformer}. - */ - public TransformationPropertyValueModel(PropertyValueModel valueHolder) { - super(valueHolder); - this.transformer = this.buildTransformer(); - } - - /** - * Construct a property value model with the specified nested - * property value model and transformer. - */ - public TransformationPropertyValueModel(PropertyValueModel valueHolder, Transformer transformer) { - super(valueHolder); - this.transformer = transformer; - } - - protected Transformer buildTransformer() { - return new DefaultTransformer(); - } - - - // ********** PropertyValueModel implementation ********** - - public T2 getValue() { - // transform the object returned by the nested value model before returning it - return this.transform(this.valueHolder.getValue()); - } - - - // ********** PropertyValueModelWrapper implementation ********** - - @Override - protected void valueChanged(PropertyChangeEvent event) { - // transform the values before propagating the change event - @SuppressWarnings("unchecked") - T1 eventOldValue = (T1) event.getOldValue(); - Object oldValue = this.transformOld(eventOldValue); - @SuppressWarnings("unchecked") - T1 eventNewValue = (T1) event.getNewValue(); - Object newValue = this.transformNew(eventNewValue); - this.firePropertyChanged(VALUE, oldValue, newValue); - } - - - // ********** behavior ********** - - /** - * Transform the specified value and return the result. - * This is called by - * {@link #getValue()}, - * {@link #transformOld(Object)}, and - * {@link #transformNew(Object)}. - */ - protected T2 transform(T1 value) { - return this.transformer.transform(value); - } - - /** - * Transform the specified, non-null, value and return the result. - */ - protected T2 transform_(@SuppressWarnings("unused") T1 value) { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - /** - * Transform the specified old value and return the result. - * By default, call {@link #transform(Object)}. - * This is called by {@link #valueChanged(PropertyChangeEvent)}. - */ - protected T2 transformOld(T1 value) { - return this.transform(value); - } - - /** - * Transform the specified new value and return the result. - * By default, call {@link #transform(Object)}. - * This is called by {@link #valueChanged(PropertyChangeEvent)}. - */ - protected T2 transformNew(T1 value) { - return this.transform(value); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getValue()); - } - - - // ********** default transformer ********** - - /** - * The default transformer will return null if the wrapped value is null. - * If the wrapped value is not null, it is transformed by a subclass - * implementation of {@link TransformationPropertyValueModel#transform_(Object)}. - */ - protected class DefaultTransformer implements Transformer { - public T2 transform(T1 value) { - return (value == null) ? null : TransformationPropertyValueModel.this.transform_(value); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationWritablePropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationWritablePropertyValueModel.java deleted file mode 100644 index 1d42d4c54e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TransformationWritablePropertyValueModel.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.internal.BidiTransformer; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * A TransformationWritablePropertyValueModel wraps another - * {@link WritablePropertyValueModel} and uses a {@link BidiTransformer} - * to:

    - *
  • transform the wrapped value before it is returned by {@link #getValue()} - *
  • "reverse-transform" the new value that comes in via - * {@link #setValue(Object)} - *
- * As an alternative to building a {@link BidiTransformer}, - * a subclass of TransformationWritablePropertyValueModel can - * override {@link #transform_(Object)} and {@link #reverseTransform_(Object)}; - * or, if something other than null should be returned when the wrapped value - * is null or the new value is null, override {@link #transform(Object)} - * and {@link #reverseTransform(Object)}. - */ -public class TransformationWritablePropertyValueModel - extends TransformationPropertyValueModel - implements WritablePropertyValueModel -{ - - // ********** constructors/initialization ********** - - /** - * Construct a writable property value model with the specified nested - * writable property value model and the default bidi transformer. - * Use this constructor if you want to override the - * {@link #transform_(Object)} and {@link #reverseTransform_(Object)} - * (or {@link #transform(Object)} and {@link #reverseTransform(Object)}) - * methods instead of building a {@link BidiTransformer}. - */ - public TransformationWritablePropertyValueModel(WritablePropertyValueModel valueHolder) { - super(valueHolder); - } - - /** - * Construct a writable property value model with the specified nested - * writable property value model and bidi transformer. - */ - public TransformationWritablePropertyValueModel(WritablePropertyValueModel valueHolder, BidiTransformer transformer) { - super(valueHolder, transformer); - } - - @Override - protected BidiTransformer buildTransformer() { - return new DefaultBidiTransformer(); - } - - - // ********** WritablePropertyValueModel implementation ********** - - public void setValue(T2 value) { - // "reverse-transform" the object before passing it to the the nested value model - this.getValueHolder().setValue(this.reverseTransform(value)); - } - - - // ********** behavior ********** - - /** - * "Reverse-transform" the specified value and return the result. - * This is called by {@link #setValue(Object)}. - */ - protected T1 reverseTransform(T2 value) { - return this.getTransformer().reverseTransform(value); - } - - /** - * "Reverse-transform" the specified, non-null, - * value and return the result. - */ - protected T1 reverseTransform_(@SuppressWarnings("unused") T2 value) { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - - - // ********** queries ********** - - /** - * Our constructors accept only a {@link WritablePropertyValueModel}, - * so this cast should be safe. - */ - @SuppressWarnings("unchecked") - protected WritablePropertyValueModel getValueHolder() { - return (WritablePropertyValueModel) this.valueHolder; - } - - /** - * Our constructors accept only a {@link BidiTransformer}, - * so this cast should be safe. - */ - protected BidiTransformer getTransformer() { - return (BidiTransformer) this.transformer; - } - - - // ********** default bidi transformer ********** - - /** - * The default bidi transformer will return null if the - * wrapped value is null. - * If the wrapped value is not null, it is transformed by a subclass - * implementation of {@link #transform_(Object)}. - * The default bidi transformer will also return null - * if the new value is null. - * If the new value is not null, it is reverse-transformed - * by a subclass implementation of {@link #reverseTransform_(Object)}. - */ - protected class DefaultBidiTransformer - extends DefaultTransformer - implements BidiTransformer - { - public T1 reverseTransform(T2 value) { - return (value == null) ? null : TransformationWritablePropertyValueModel.this.reverseTransform_(value); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TreeAspectAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TreeAspectAdapter.java deleted file mode 100644 index 178d1ed2bb..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TreeAspectAdapter.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Arrays; -import java.util.Collection; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.TreeChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * This extension of {@link AspectTreeValueModelAdapter} provides - * basic tree change support. - * This converts a set of one or more trees into - * a single {@link #NODES} tree. - *

- * The typical subclass will override the following methods (see the descriptions - * in {@link AspectTreeValueModelAdapter}):

    - *
  • {@link #nodes_()} - *
  • {@link #nodes()} - *
- */ -public abstract class TreeAspectAdapter - extends AspectTreeValueModelAdapter -{ - /** - * The name of the subject's trees that we use for the value. - */ - protected final String[] treeNames; - protected static final String[] EMPTY_TREE_NAMES = new String[0]; - - /** A listener that listens to the subject's tree aspects. */ - protected final TreeChangeListener treeChangeListener; - - - // ********** constructors ********** - - /** - * Construct a tree aspect adapter for the specified subject - * and tree. - */ - protected TreeAspectAdapter(String treeName, S subject) { - this(new String[] {treeName}, subject); - } - - /** - * Construct a tree aspect adapter for the specified subject - * and trees. - */ - protected TreeAspectAdapter(String[] treeNames, S subject) { - this(new StaticPropertyValueModel(subject), treeNames); - } - - /** - * Construct a tree aspect adapter for the specified subject holder - * and trees. - */ - protected TreeAspectAdapter(PropertyValueModel subjectHolder, String... treeNames) { - super(subjectHolder); - this.treeNames = treeNames; - this.treeChangeListener = this.buildTreeChangeListener(); - } - - /** - * Construct a tree aspect adapter for the specified subject holder - * and trees. - */ - protected TreeAspectAdapter(PropertyValueModel subjectHolder, Collection treeNames) { - this(subjectHolder, treeNames.toArray(new String[treeNames.size()])); - } - - /** - * Construct a tree aspect adapter for an "unchanging" tree in - * the specified subject. This is useful for a tree aspect that does not - * change for a particular subject; but the subject will change, resulting in - * a new tree. - */ - protected TreeAspectAdapter(PropertyValueModel subjectHolder) { - this(subjectHolder, EMPTY_TREE_NAMES); - } - - - // ********** initialization ********** - - protected TreeChangeListener buildTreeChangeListener() { - // transform the subject's tree change events into VALUE tree change events - return new TreeChangeListener() { - public void nodeAdded(TreeAddEvent event) { - TreeAspectAdapter.this.nodeAdded(event); - } - public void nodeRemoved(TreeRemoveEvent event) { - TreeAspectAdapter.this.nodeRemoved(event); - } - public void treeCleared(TreeClearEvent event) { - TreeAspectAdapter.this.treeCleared(event); - } - public void treeChanged(TreeChangeEvent event) { - TreeAspectAdapter.this.treeChanged(event); - } - @Override - public String toString() { - return "tree change listener: " + Arrays.asList(TreeAspectAdapter.this.treeNames); //$NON-NLS-1$ - } - }; - } - - - // ********** AspectAdapter implementation ********** - - @Override - protected void engageSubject_() { - for (String treeName : this.treeNames) { - ((Model) this.subject).addTreeChangeListener(treeName, this.treeChangeListener); - } - } - - @Override - protected void disengageSubject_() { - for (String treeName : this.treeNames) { - ((Model) this.subject).removeTreeChangeListener(treeName, this.treeChangeListener); - } - } - - - // ********** behavior ********** - - protected void nodeAdded(TreeAddEvent event) { - this.fireNodeAdded(event.clone(this, NODES)); - } - - protected void nodeRemoved(TreeRemoveEvent event) { - this.fireNodeRemoved(event.clone(this, NODES)); - } - - protected void treeCleared(TreeClearEvent event) { - this.fireTreeCleared(event.clone(this, NODES)); - } - - protected void treeChanged(TreeChangeEvent event) { - this.fireTreeChanged(event.clone(this, NODES)); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TreePropertyValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TreePropertyValueModelAdapter.java deleted file mode 100644 index 66258c2108..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/TreePropertyValueModelAdapter.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.TreeChangeListener; -import org.eclipse.jpt.common.utility.model.value.TreeValueModel; - -/** - * This abstract class provides the infrastructure needed to wrap - * a tree value model, "lazily" listen to it, and convert - * its change notifications into property value model change - * notifications. - *

- * Subclasses must override:

    - *
  • {@link #buildValue()}

    - * to return the current property value, as derived from the - * current collection value - *

- * Subclasses might want to override the following methods - * to improve performance (by not recalculating the value, if possible):
    - *
  • {@link #nodeAdded(TreeChangeEvent event)} - *
  • {@link #nodeRemoved(TreeChangeEvent event)} - *
  • {@link #treeCleared(TreeChangeEvent event)} - *
  • {@link #treeChanged(TreeChangeEvent event)} - *
- */ -public abstract class TreePropertyValueModelAdapter - extends AbstractPropertyValueModelAdapter -{ - /** The wrapped tree value model. */ - protected final TreeValueModel treeHolder; - - /** A listener that allows us to synch with changes to the wrapped tree holder. */ - protected final TreeChangeListener treeChangeListener; - - - // ********** constructor/initialization ********** - - /** - * Construct a property value model with the specified wrapped - * tree value model. - */ - protected TreePropertyValueModelAdapter(TreeValueModel treeHolder) { - super(); - this.treeHolder = treeHolder; - this.treeChangeListener = this.buildTreeChangeListener(); - } - - protected TreeChangeListener buildTreeChangeListener() { - return new TreeChangeListener() { - public void nodeAdded(TreeAddEvent event) { - TreePropertyValueModelAdapter.this.nodeAdded(event); - } - public void nodeRemoved(TreeRemoveEvent event) { - TreePropertyValueModelAdapter.this.nodeRemoved(event); - } - public void treeCleared(TreeClearEvent event) { - TreePropertyValueModelAdapter.this.treeCleared(event); - } - public void treeChanged(TreeChangeEvent event) { - TreePropertyValueModelAdapter.this.treeChanged(event); - } - @Override - public String toString() { - return "tree change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** behavior ********** - - /** - * Start listening to the tree holder. - */ - @Override - protected void engageModel_() { - this.treeHolder.addTreeChangeListener(TreeValueModel.NODES, this.treeChangeListener); - } - - /** - * Stop listening to the tree holder. - */ - @Override - protected void disengageModel_() { - this.treeHolder.removeTreeChangeListener(TreeValueModel.NODES, this.treeChangeListener); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.treeHolder); - } - - - // ********** state change support ********** - - /** - * Nodes were added to the wrapped tree holder; - * propagate the change notification appropriately. - */ - protected void nodeAdded(@SuppressWarnings("unused") TreeAddEvent event) { - // by default, simply recalculate the value and fire an event - this.propertyChanged(); - } - - /** - * Nodes were removed from the wrapped tree holder; - * propagate the change notification appropriately. - */ - protected void nodeRemoved(@SuppressWarnings("unused") TreeRemoveEvent event) { - // by default, simply recalculate the value and fire an event - this.propertyChanged(); - } - - /** - * The wrapped tree holder was cleared; - * propagate the change notification appropriately. - */ - protected void treeCleared(@SuppressWarnings("unused") TreeClearEvent event) { - // by default, simply recalculate the value and fire an event - this.propertyChanged(); - } - - /** - * The wrapped tree holder changed; - * propagate the change notification appropriately. - */ - protected void treeChanged(@SuppressWarnings("unused") TreeChangeEvent event) { - // by default, simply recalculate the value and fire an event - this.propertyChanged(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueAspectAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueAspectAdapter.java deleted file mode 100644 index 5876d5e444..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueAspectAdapter.java +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * Abstract class that provides support for wrapping a {@link WritablePropertyValueModel} - * and listening for changes to aspects of the value contained - * by the {@link WritablePropertyValueModel}. Changes to the {@link WritablePropertyValueModel}'s - * value are also monitored. - *

- * This is useful if you have a value that may change, but whose aspects can also - * change in a fashion that might be of interest to the client. - *

- * NB: Clients will need to listen for two different change notifications: - * a property change event will be be fired when the value changes; - * a state change event will be fired when an aspect of the value changes. - *

- * Subclasses need to override two methods:

    - *
  • {@link #engageValue_()}

    - * begin listening to the appropriate aspect of the value and call - * {@link #valueAspectChanged()} whenever the aspect changes - * (this will fire a state change event) - *

  • {@link #disengageValue_()}

    - * stop listening to the appropriate aspect of the value - *

- */ -public abstract class ValueAspectAdapter - extends PropertyValueModelWrapper - implements WritablePropertyValueModel -{ - /** Cache the value so we can disengage. Null until we have a listener*/ - protected V value; - - - // ********** constructors/initialization ********** - - /** - * Constructor - the value holder is required. - */ - protected ValueAspectAdapter(WritablePropertyValueModel valueHolder) { - super(valueHolder); - this.value = null; - } - - /** - * Override to allow both property and state change listeners. - */ - @Override - protected ChangeSupport buildChangeSupport() { - return new ChangeSupport(this); - } - - - // ********** PropertyValueModel implementation ********** - - public V getValue() { - return this.value; - } - - - // ********** WritablePropertyValueModel implementation ********** - - public void setValue(V value) { - this.getValueHolder().setValue(value); - } - - - // ********** PropertyValueModelWrapper implementation ********** - - @Override - protected void valueChanged(PropertyChangeEvent event) { - this.disengageValue(); - this.engageValue(); - this.firePropertyChanged(event.clone(this)); - } - - - // ********** extend change support ********** - - /** - * Extend to start listening to the underlying model if necessary. - */ - @Override - public synchronized void addStateChangeListener(StateChangeListener listener) { - if (this.hasNoListeners()) { - this.engageModel(); - } - super.addStateChangeListener(listener); - } - - /** - * Extend to stop listening to the underlying model if necessary. - */ - @Override - public synchronized void removeStateChangeListener(StateChangeListener listener) { - super.removeStateChangeListener(listener); - if (this.hasNoListeners()) { - this.disengageModel(); - } - } - - - // ********** AbstractPropertyValueModel overrides ********** - - /** - * Extend to check for state change listeners. - */ - @Override - protected boolean hasListeners() { - return this.hasAnyStateChangeListeners() || super.hasListeners(); - } - - - // ********** PropertyValueModelWrapper overrides ********** - - /** - * Extend to engage an aspect of the value model's value. - */ - @Override - protected void engageModel() { - super.engageModel(); - this.engageValue(); - } - - /** - * Extend to disengage an aspect of the value model's value. - */ - @Override - protected void disengageModel() { - this.disengageValue(); - super.disengageModel(); - } - - - // ********** behavior ********** - - /** - * Start listening to an aspect of the current value. - */ - protected void engageValue() { - this.value = this.valueHolder.getValue(); - if (this.value != null) { - this.engageValue_(); - } - } - - /** - * Start listening to some aspect of the current value. - * At this point we can be sure the value is not null. - */ - protected abstract void engageValue_(); - - /** - * Stop listening to an aspect of the current value. - */ - protected void disengageValue() { - if (this.value != null) { - this.disengageValue_(); - this.value = null; - } - } - - /** - * Stop listening to an aspect of the current value. - * At this point we can be sure the value is not null. - */ - protected abstract void disengageValue_(); - - /** - * Subclasses should call this method whenever the value's aspect changes. - */ - protected void valueAspectChanged() { - this.fireStateChanged(); - } - - /** - * Our constructor accepts only a {@link WritablePropertyValueModel}{@code}. - */ - @SuppressWarnings("unchecked") - protected WritablePropertyValueModel getValueHolder() { - return (WritablePropertyValueModel) this.valueHolder; - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getValue()); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueChangeAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueChangeAdapter.java deleted file mode 100644 index 36dca8e8dd..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueChangeAdapter.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.ChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.SimpleChangeListener; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * Extend {@link ValueAspectAdapter} to listen to all the aspects - * of the value in the wrapped value model. - */ -public class ValueChangeAdapter - extends ValueAspectAdapter -{ - /** Listener that listens to the value. */ - protected final ChangeListener valueAspectListener; - - - // ********** constructors ********** - - /** - * Construct a change adapter for the specified value. - */ - public ValueChangeAdapter(WritablePropertyValueModel valueHolder) { - super(valueHolder); - this.valueAspectListener = this.buildValueAspectListener(); - } - - - // ********** initialization ********** - - protected ChangeListener buildValueAspectListener() { - return new SimpleChangeListener() { - @Override - protected void modelChanged(ChangeEvent event) { - ValueChangeAdapter.this.valueAspectChanged(event); - } - @Override - public String toString() { - return "value change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** ValueAspectAdapter implementation ********** - - @Override - protected void engageValue_() { - this.value.addChangeListener(this.valueAspectListener); - } - - @Override - protected void disengageValue_() { - this.value.removeChangeListener(this.valueAspectListener); - } - - - // ********** change events ********** - - protected void valueAspectChanged(@SuppressWarnings("unused") ChangeEvent event) { - this.valueAspectChanged(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueCollectionAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueCollectionAdapter.java deleted file mode 100644 index a06dfbb2f3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueCollectionAdapter.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Arrays; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * Extend {@link ValueAspectAdapter} to listen to one or more collection - * aspects of the value in the wrapped value model. - */ -public class ValueCollectionAdapter - extends ValueAspectAdapter -{ - /** The names of the value's collections that we listen to. */ - protected final String[] collectionNames; - - /** Listener that listens to the value. */ - protected final CollectionChangeListener valueCollectionListener; - - - // ********** constructors ********** - - /** - * Construct an adapter for the specified value collections. - */ - public ValueCollectionAdapter(WritablePropertyValueModel valueHolder, String... collectionNames) { - super(valueHolder); - this.collectionNames = collectionNames; - this.valueCollectionListener = this.buildValueCollectionListener(); - } - - - // ********** initialization ********** - - protected CollectionChangeListener buildValueCollectionListener() { - return new CollectionChangeListener() { - public void itemsAdded(CollectionAddEvent event) { - ValueCollectionAdapter.this.itemsAdded(event); - } - public void itemsRemoved(CollectionRemoveEvent event) { - ValueCollectionAdapter.this.itemsRemoved(event); - } - public void collectionCleared(CollectionClearEvent event) { - ValueCollectionAdapter.this.collectionCleared(event); - } - public void collectionChanged(CollectionChangeEvent event) { - ValueCollectionAdapter.this.collectionChanged(event); - } - @Override - public String toString() { - return "value collection listener: " + Arrays.asList(ValueCollectionAdapter.this.collectionNames); //$NON-NLS-1$ - } - }; - } - - - // ********** ValueAspectAdapter implementation ********** - - @Override - protected void engageValue_() { - for (String collectionName : this.collectionNames) { - this.value.addCollectionChangeListener(collectionName, this.valueCollectionListener); - } - } - - @Override - protected void disengageValue_() { - for (String collectionName : this.collectionNames) { - this.value.removeCollectionChangeListener(collectionName, this.valueCollectionListener); - } - } - - - // ********** change events ********** - - protected void itemsAdded(@SuppressWarnings("unused") CollectionAddEvent event) { - this.valueAspectChanged(); - } - - protected void itemsRemoved(@SuppressWarnings("unused") CollectionRemoveEvent event) { - this.valueAspectChanged(); - } - - protected void collectionCleared(@SuppressWarnings("unused") CollectionClearEvent event) { - this.valueAspectChanged(); - } - - protected void collectionChanged(@SuppressWarnings("unused") CollectionChangeEvent event) { - this.valueAspectChanged(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueListAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueListAdapter.java deleted file mode 100644 index ba69a17da3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueListAdapter.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Arrays; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * Extend {@link ValueAspectAdapter} to listen to one or more list - * aspects of the value in the wrapped value model. - */ -public class ValueListAdapter - extends ValueAspectAdapter -{ - /** The names of the value's lists that we listen to. */ - protected final String[] listNames; - - /** Listener that listens to the value. */ - protected final ListChangeListener valueListListener; - - - // ********** constructors ********** - - /** - * Construct an adapter for the specified value lists. - */ - public ValueListAdapter(WritablePropertyValueModel valueHolder, String... listNames) { - super(valueHolder); - this.listNames = listNames; - this.valueListListener = this.buildValueListListener(); - } - - - // ********** initialization ********** - - protected ListChangeListener buildValueListListener() { - return new ListChangeListener() { - public void itemsAdded(ListAddEvent event) { - ValueListAdapter.this.itemsAdded(event); - } - public void itemsRemoved(ListRemoveEvent event) { - ValueListAdapter.this.itemsRemoved(event); - } - public void itemsReplaced(ListReplaceEvent event) { - ValueListAdapter.this.itemsReplaced(event); - } - public void itemsMoved(ListMoveEvent event) { - ValueListAdapter.this.itemsMoved(event); - } - public void listCleared(ListClearEvent event) { - ValueListAdapter.this.listCleared(event); - } - public void listChanged(ListChangeEvent event) { - ValueListAdapter.this.listChanged(event); - } - @Override - public String toString() { - return "value list listener: " + Arrays.asList(ValueListAdapter.this.listNames); //$NON-NLS-1$ - } - }; - } - - - // ********** ValueAspectAdapter implementation ********** - - @Override - protected void engageValue_() { - for (String listName : this.listNames) { - this.value.addListChangeListener(listName, this.valueListListener); - } - } - - @Override - protected void disengageValue_() { - for (String listName : this.listNames) { - this.value.removeListChangeListener(listName, this.valueListListener); - } - } - - - // ********** change events ********** - - protected void itemsAdded(@SuppressWarnings("unused") ListAddEvent event) { - this.valueAspectChanged(); - } - - protected void itemsRemoved(@SuppressWarnings("unused") ListRemoveEvent event) { - this.valueAspectChanged(); - } - - protected void itemsReplaced(@SuppressWarnings("unused") ListReplaceEvent event) { - this.valueAspectChanged(); - } - - protected void itemsMoved(@SuppressWarnings("unused") ListMoveEvent event) { - this.valueAspectChanged(); - } - - protected void listCleared(@SuppressWarnings("unused") ListClearEvent event) { - this.valueAspectChanged(); - } - - protected void listChanged(@SuppressWarnings("unused") ListChangeEvent event) { - this.valueAspectChanged(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValuePropertyAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValuePropertyAdapter.java deleted file mode 100644 index cbb6be7df8..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValuePropertyAdapter.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Arrays; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * Extend {@link ValueAspectAdapter} to listen to one or more - * properties of the value in the wrapped value model. - */ -public class ValuePropertyAdapter - extends ValueAspectAdapter -{ - /** The names of the value's properties we listen to. */ - protected final String[] propertyNames; - - /** Listener that listens to the value. */ - protected final PropertyChangeListener valuePropertyListener; - - - // ********** constructors ********** - - /** - * Construct an adapter for the specified value properties. - */ - public ValuePropertyAdapter(WritablePropertyValueModel valueHolder, String... propertyNames) { - super(valueHolder); - this.propertyNames = propertyNames; - this.valuePropertyListener = this.buildValuePropertyListener(); - } - - - // ********** initialization ********** - - protected PropertyChangeListener buildValuePropertyListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - ValuePropertyAdapter.this.propertyChanged(event); - } - @Override - public String toString() { - return "value property listener: " + Arrays.asList(ValuePropertyAdapter.this.propertyNames); //$NON-NLS-1$ - } - }; - } - - - // ********** ValueAspectAdapter implementation ********** - - @Override - protected void engageValue_() { - for (String propertyName : this.propertyNames) { - this.value.addPropertyChangeListener(propertyName, this.valuePropertyListener); - } - } - - @Override - protected void disengageValue_() { - for (String propertyName : this.propertyNames) { - this.value.removePropertyChangeListener(propertyName, this.valuePropertyListener); - } - } - - - // ********** change events ********** - - protected void propertyChanged(@SuppressWarnings("unused") PropertyChangeEvent event) { - this.valueAspectChanged(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueStateAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueStateAdapter.java deleted file mode 100644 index ed9e6372c2..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueStateAdapter.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * Extend {@link ValueAspectAdapter} to listen to the - * "state" of the value in the wrapped value model. - */ -public class ValueStateAdapter - extends ValueAspectAdapter -{ - /** Listener that listens to value. */ - protected final StateChangeListener valueStateListener; - - - // ********** constructors ********** - - /** - * Construct an adapter for the value state. - */ - public ValueStateAdapter(WritablePropertyValueModel valueHolder) { - super(valueHolder); - this.valueStateListener = this.buildValueStateListener(); - } - - - // ********** initialization ********** - - protected StateChangeListener buildValueStateListener() { - return new StateChangeListener() { - public void stateChanged(StateChangeEvent event) { - ValueStateAdapter.this.stateChanged(event); - } - @Override - public String toString() { - return "value state listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** ValueAspectAdapter implementation ********** - - @Override - protected void engageValue_() { - this.value.addStateChangeListener(this.valueStateListener); - } - - @Override - protected void disengageValue_() { - this.value.removeStateChangeListener(this.valueStateListener); - } - - - // ********** change events ********** - - protected void stateChanged(@SuppressWarnings("unused") StateChangeEvent event) { - this.valueAspectChanged(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueTreeAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueTreeAdapter.java deleted file mode 100644 index a8ec0af59a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/ValueTreeAdapter.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Arrays; - -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.TreeChangeListener; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * Extend {@link ValueAspectAdapter} to listen to one or more - * tree aspects of the value in the wrapped value model. - */ -public class ValueTreeAdapter - extends ValueAspectAdapter -{ - /** The names of the value's trees that we listen to. */ - protected final String[] treeNames; - - /** Listener that listens to the value. */ - protected final TreeChangeListener valueTreeListener; - - - // ********** constructors ********** - - /** - * Construct an adapter for the specified value trees. - */ - public ValueTreeAdapter(WritablePropertyValueModel valueHolder, String... treeNames) { - super(valueHolder); - this.treeNames = treeNames; - this.valueTreeListener = this.buildValueTreeListener(); - } - - - // ********** initialization ********** - - protected TreeChangeListener buildValueTreeListener() { - return new TreeChangeListener() { - public void nodeAdded(TreeAddEvent event) { - ValueTreeAdapter.this.nodeAdded(event); - } - public void nodeRemoved(TreeRemoveEvent event) { - ValueTreeAdapter.this.nodeRemoved(event); - } - public void treeCleared(TreeClearEvent event) { - ValueTreeAdapter.this.treeCleared(event); - } - public void treeChanged(TreeChangeEvent event) { - ValueTreeAdapter.this.treeChanged(event); - } - @Override - public String toString() { - return "value tree listener: " + Arrays.asList(ValueTreeAdapter.this.treeNames); //$NON-NLS-1$ - } - }; - } - - - // ********** ValueAspectAdapter implementation ********** - - @Override - protected void engageValue_() { - for (String treeName : this.treeNames) { - this.value.addTreeChangeListener(treeName, this.valueTreeListener); - } - } - - @Override - protected void disengageValue_() { - for (String treeName : this.treeNames) { - this.value.removeTreeChangeListener(treeName, this.valueTreeListener); - } - } - - - // ********** change events ********** - - protected void nodeAdded(@SuppressWarnings("unused") TreeAddEvent event) { - this.valueAspectChanged(); - } - - protected void nodeRemoved(@SuppressWarnings("unused") TreeRemoveEvent event) { - this.valueAspectChanged(); - } - - protected void treeCleared(@SuppressWarnings("unused") TreeClearEvent event) { - this.valueAspectChanged(); - } - - protected void treeChanged(@SuppressWarnings("unused") TreeChangeEvent event) { - this.valueAspectChanged(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/WritablePropertyCollectionValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/WritablePropertyCollectionValueModelAdapter.java deleted file mode 100644 index be61d4904b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/WritablePropertyCollectionValueModelAdapter.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.model.value.WritableCollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * An adapter that allows us to make a {@link WritablePropertyValueModel} behave like - * a single-element {@link WritableCollectionValueModel}, sorta. - *

- * If the property's value is null, an empty iterator is returned - * (i.e. you can't have a collection with a null element). - * Also, only a single-element collection can be written to the adapter. - */ -public class WritablePropertyCollectionValueModelAdapter - extends PropertyCollectionValueModelAdapter - implements WritableCollectionValueModel -{ - - // ********** constructor ********** - - /** - * Convert the specified writable property value model to a writable - * collection value model. - */ - public WritablePropertyCollectionValueModelAdapter(WritablePropertyValueModel valueHolder) { - super(valueHolder); - } - - - // ********** WritableCollectionValueModel implementation ********** - - public void setValues(Iterable values) { - Iterator stream = values.iterator(); - if (stream.hasNext()) { - E newValue = stream.next(); - if (stream.hasNext()) { - throw new IllegalArgumentException("non-singleton collection: " + values); //$NON-NLS-1$ - } - this.getValueHolder().setValue(newValue); - } else { - this.getValueHolder().setValue(null); - } - } - - // our constructor takes only writable property value models - @SuppressWarnings("unchecked") - protected WritablePropertyValueModel getValueHolder() { - return (WritablePropertyValueModel) this.valueHolder; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/WritablePropertyListValueModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/WritablePropertyListValueModelAdapter.java deleted file mode 100644 index c9f30847cd..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/WritablePropertyListValueModelAdapter.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value; - -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.model.value.WritableListValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * An adapter that allows us to make a {@link WritablePropertyValueModel} behave like - * a single-element {@link WritableListValueModel}, sorta. - *

- * If the property's value is null, an empty iterator is returned - * (i.e. you can't have a list with a null element). - * Also, only a single-element list can be written to the adapter. - */ -public class WritablePropertyListValueModelAdapter - extends PropertyListValueModelAdapter - implements WritableListValueModel -{ - - // ********** constructor ********** - - /** - * Convert the specified writable property value model to a writable - * collection value model. - */ - public WritablePropertyListValueModelAdapter(WritablePropertyValueModel valueHolder) { - super(valueHolder); - } - - - // ********** WritableListValueModel implementation ********** - - public void setListValues(Iterable listValues) { - Iterator stream = listValues.iterator(); - if (stream.hasNext()) { - E newValue = stream.next(); - if (stream.hasNext()) { - throw new IllegalArgumentException("non-singleton list: " + listValues); //$NON-NLS-1$ - } - this.getValueHolder().setValue(newValue); - } else { - this.getValueHolder().setValue(null); - } - } - - // our constructor takes only writable property value models - @SuppressWarnings("unchecked") - protected WritablePropertyValueModel getValueHolder() { - return (WritablePropertyValueModel) this.valueHolder; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/prefs/PreferencePropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/prefs/PreferencePropertyValueModel.java deleted file mode 100644 index 2b6670abe4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/prefs/PreferencePropertyValueModel.java +++ /dev/null @@ -1,346 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.prefs; - -import java.util.EventListener; -import java.util.prefs.PreferenceChangeEvent; -import java.util.prefs.PreferenceChangeListener; -import java.util.prefs.Preferences; - -import org.eclipse.jpt.common.utility.internal.BidiStringConverter; -import org.eclipse.jpt.common.utility.internal.model.value.AspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * This adapter wraps a Preference and converts it into a PropertyValueModel. - * It listens for the appropriate "preference" changes and converts them into - * VALUE property changes. It also allows the specification of a default value - * for the Preference, which, by default, is null (and is probably *not* a very - * good default). - * - * You can configure whether the preference's value is returned, - * unchanged, as a string or as some other object (e.g. an Integer) by - * setting the adapter's converter. Internally, the preference's value - * is stored as the converted object; and the conversions take place - * when reading or writing from the preferences node or retrieving the - * value from an event fired by the preferences node. - * - * This adapter is a bit different from most other adapters because the - * change events fired off by a Preferences node are asynchronous from - * the change itself. (AbstractPreferences uses an event dispatch daemon.) - * As a result, a client can set our value with #setValue(Object) and we - * will return from that method before we ever receive notification from - * the Preferences node that *it* has changed. This means we cannot - * rely on that event to keep our internally cached value in synch. - */ -public class PreferencePropertyValueModel

- extends AspectAdapter - implements WritablePropertyValueModel

-{ - /** The key to the preference we use for the value. */ - protected final String key; - - /** - * Cache the current (object) value of the preference so we - * can pass an "old value" when we fire a property change event. - */ - protected P value; - - /** - * The default (object) value returned if there is no value - * associated with the preference. - */ - protected final P defaultValue; - - /** - * This converter is used to convert the preference's - * string value to and from an object. - */ - protected final BidiStringConverter

converter; - - /** A listener that listens to the appropriate preference. */ - protected final PreferenceChangeListener preferenceChangeListener; - - - // ********** constructors ********** - - /** - * Construct an adapter for the specified preference. - * The default value of the preference will be null. - */ - public PreferencePropertyValueModel(Preferences preferences, String key) { - this(preferences, key, null); - } - - /** - * Construct an adapter for the specified preference with - * the specified default value for the preference. - */ - public PreferencePropertyValueModel(Preferences preferences, String key, P defaultValue) { - this(preferences, key, defaultValue, BidiStringConverter.Default.

instance()); - } - - /** - * Construct an adapter for the specified preference with - * the specified default value for the preference. - */ - public PreferencePropertyValueModel(Preferences preferences, String key, P defaultValue, BidiStringConverter

converter) { - this(new StaticPropertyValueModel(preferences), key, defaultValue, converter); - } - - /** - * Construct an adapter for the specified preference with - * the specified default value for the preference. - */ - public static PreferencePropertyValueModel forBoolean(Preferences preferences, String key, boolean defaultValue) { - return new PreferencePropertyValueModel( - preferences, - key, - defaultValue ? Boolean.TRUE : Boolean.FALSE, - BidiStringConverter.BooleanConverter.instance() - ); - } - - /** - * Construct an adapter for the specified preference with - * the specified default value for the preference. - */ - public static PreferencePropertyValueModel forInteger(Preferences preferences, String key, int defaultValue) { - return new PreferencePropertyValueModel( - preferences, - key, - Integer.valueOf(defaultValue), - BidiStringConverter.IntegerConverter.instance() - ); - } - - /** - * Construct an adapter for the specified preference. - * The default value of the preference will be null. - */ - public PreferencePropertyValueModel(PropertyValueModel preferencesHolder, String key) { - this(preferencesHolder, key, null); - } - - /** - * Construct an adapter for the specified preference with - * the specified default value for the preference. - */ - public PreferencePropertyValueModel(PropertyValueModel preferencesHolder, String key, P defaultValue) { - this(preferencesHolder, key, defaultValue, BidiStringConverter.Default.

instance()); - } - - /** - * Construct an adapter for the specified preference with - * the specified default value for the preference. - */ - public PreferencePropertyValueModel(PropertyValueModel preferencesHolder, String key, P defaultValue, BidiStringConverter

converter) { - super(preferencesHolder); - this.key = key; - this.defaultValue = defaultValue; - this.converter = converter; - this.preferenceChangeListener = this.buildPreferenceChangeListener(); - // our value is null when we are not listening to the preference - this.value = null; - } - - - // ********** initialization ********** - - /** - * A preference has changed, notify the listeners if necessary. - */ - protected PreferenceChangeListener buildPreferenceChangeListener() { - // transform the preference change events into VALUE property change events - return new PreferenceChangeListener() { - public void preferenceChange(PreferenceChangeEvent event) { - PreferencePropertyValueModel.this.preferenceChanged(event.getKey(), event.getNewValue()); - } - @Override - public String toString() { - return "preference change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** ValueModel implementation ********** - - /** - * Return the cached (converted) value. - */ - @Override - public synchronized P getValue() { - return this.value; - } - - - // ********** PropertyValueModel implementation ********** - - /** - * Set the cached value, then set the appropriate preference value. - */ - public synchronized void setValue(P value) { - if (this.hasNoListeners()) { - return; // no changes allowed when we have no listeners - } - - Object old = this.value; - this.value = value; - this.fireAspectChanged(old, value); - - if ((this.subject != null) && this.preferenceIsToBeSet(old, value)) { - this.setValue_(value); - } - } - - - // ********** AspectAdapter implementation ********** - - @Override - protected Class getListenerClass() { - return PropertyChangeListener.class; - } - - @Override - protected String getListenerAspectName() { - return VALUE; - } - - @Override - protected boolean hasListeners() { - return this.hasAnyPropertyChangeListeners(VALUE); - } - - @Override - protected void fireAspectChanged(Object oldValue, Object newValue) { - this.firePropertyChanged(VALUE, oldValue, newValue); - } - - @Override - protected synchronized void engageSubject_() { - this.subject.addPreferenceChangeListener(this.preferenceChangeListener); - this.value = this.buildValue(); - } - - @Override - protected synchronized void disengageSubject_() { - try { - this.subject.removePreferenceChangeListener(this.preferenceChangeListener); - } catch (IllegalStateException ex) { - // for some odd reason, we are not allowed to remove a listener from a "dead" - // preferences node; so handle the exception that gets thrown here - if ( ! ex.getMessage().equals("Node has been removed.")) { //$NON-NLS-1$ - // if it is not the expected exception, re-throw it - throw ex; - } - } - this.value = null; - } - - - // ********** AbstractModel implementation ********** - - @Override - public void toString(StringBuilder sb) { - sb.append(this.key); - sb.append(" => "); //$NON-NLS-1$ - sb.append(this.value); - } - - - // ********** public API ********** - - /** - * Return the preference's key. - */ - public String getKey() { - return this.key; - } - - - // ********** internal methods ********** - - /** - * Return the preference's value. - * At this point the subject may be null. - */ - protected P buildValue() { - return (this.subject == null) ? null : this.buildValue_(); - } - - /** - * Return the appropriate preference, converted to the appropriate object. - * At this point we can be sure that the subject is not null. - */ - protected P buildValue_() { - return this.convertToObject(this.subject.get(this.key, this.convertToString(this.defaultValue))); - } - - /** - * Set the appropriate preference after converting the value to a string. - * At this point we can be sure that the subject is not null. - */ - protected void setValue_(P value) { - this.subject.put(this.key, this.convertToString(value)); - } - - /** - * Return whether the specified new value should be passed - * through to the preference. By default, only if the value has changed, - * will it be passed through to the preference. This also has the - * effect of not creating new preferences in the "backing store" - * if the new value is the same as the default value. - * - * Subclasses can override this method to return true if they - * would like to ALWAYS pass through the new value to the preference. - */ - protected boolean preferenceIsToBeSet(Object oldValue, Object newValue) { - return this.attributeValueHasChanged(oldValue, newValue); - } - - /** - * Convert the specified object to a string that can be stored as - * the value of the preference. - */ - protected String convertToString(P o) { - return this.converter.convertToString(o); - } - - /** - * Convert the specified preference value string to an - * appropriately-typed object to be returned to the client. - */ - protected P convertToObject(String s) { - return this.converter.convertToObject(s); - } - - protected void preferenceChanged(String prefKey, @SuppressWarnings("unused") String newValue) { - if (prefKey.equals(this.key)) { - this.preferenceChanged(); - } - } - - /** - * The underlying preference changed; either because we changed it - * in #setValue_(Object) or a third-party changed it. - * If this is called because of our own change, the event will be - * swallowed because the old and new values are the same. - */ - protected synchronized void preferenceChanged() { - Object old = this.value; - this.value = this.buildValue(); - this.fireAspectChanged(old, this.value); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/prefs/PreferencesCollectionValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/prefs/PreferencesCollectionValueModel.java deleted file mode 100644 index f12a84f138..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/prefs/PreferencesCollectionValueModel.java +++ /dev/null @@ -1,203 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.prefs; - -import java.util.EventListener; -import java.util.HashMap; -import java.util.Iterator; -import java.util.prefs.BackingStoreException; -import java.util.prefs.PreferenceChangeEvent; -import java.util.prefs.PreferenceChangeListener; -import java.util.prefs.Preferences; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.common.utility.internal.model.value.AspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; - -/** - * This adapter wraps a Preferences node and converts its preferences into a - * CollectionValueModel of PreferencePropertyValueModels. It listens for - * "preference" changes and converts them into VALUE collection changes. - */ -public class PreferencesCollectionValueModel

- extends AspectAdapter - implements CollectionValueModel> -{ - - /** Cache the current preferences, stored in models and keyed by name. */ - protected final HashMap> preferences; - - /** A listener that listens to the preferences node for added or removed preferences. */ - protected final PreferenceChangeListener preferenceChangeListener; - - - // ********** constructors ********** - - /** - * Construct an adapter for the specified preferences node. - */ - public PreferencesCollectionValueModel(Preferences preferences) { - this(new StaticPropertyValueModel(preferences)); - } - - /** - * Construct an adapter for the specified preferences node. - */ - public PreferencesCollectionValueModel(PropertyValueModel preferencesHolder) { - super(preferencesHolder); - this.preferences = new HashMap>(); - this.preferenceChangeListener = this.buildPreferenceChangeListener(); - } - - - // ********** initialization ********** - - /** - * A preferences have changed, notify the listeners. - */ - protected PreferenceChangeListener buildPreferenceChangeListener() { - // transform the preference change events into VALUE collection change events - return new PreferenceChangeListener() { - public void preferenceChange(PreferenceChangeEvent event) { - PreferencesCollectionValueModel.this.preferenceChanged(event.getKey(), event.getNewValue()); - } - @Override - public String toString() { - return "preference change listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** CollectionValueModel implementation ********** - - /** - * Return an iterator on the preference models. - */ - public synchronized Iterator> iterator() { - return this.preferences.values().iterator(); - } - - public synchronized int size() { - return this.preferences.size(); - } - - - // ********** AspectAdapter implementation ********** - - @Override - protected Object getValue() { - return this.iterator(); - } - - @Override - protected Class getListenerClass() { - return CollectionChangeListener.class; - } - - @Override - protected String getListenerAspectName() { - return VALUES; - } - - @Override - protected boolean hasListeners() { - return this.hasAnyCollectionChangeListeners(VALUES); - } - - @Override - protected void fireAspectChanged(Object oldValue, Object newValue) { - @SuppressWarnings("unchecked") Iterator> iterator = (Iterator>) newValue; - this.fireCollectionChanged(VALUES, CollectionTools.collection(iterator)); - } - - @Override - protected void engageSubject_() { - this.subject.addPreferenceChangeListener(this.preferenceChangeListener); - for (Iterator> stream = this.preferenceModels(); stream.hasNext(); ) { - PreferencePropertyValueModel

preferenceModel = stream.next(); - this.preferences.put(preferenceModel.getKey(), preferenceModel); - } - } - - @Override - protected void disengageSubject_() { - try { - this.subject.removePreferenceChangeListener(this.preferenceChangeListener); - } catch (IllegalStateException ex) { - // for some odd reason, we are not allowed to remove a listener from a "dead" - // preferences node; so handle the exception that gets thrown here - if ( ! ex.getMessage().equals("Node has been removed.")) { //$NON-NLS-1$ - // if it is not the expected exception, re-throw it - throw ex; - } - } - this.preferences.clear(); - } - - - // ********** AbstractModel implementation ********** - - @Override - public void toString(StringBuilder sb) { - sb.append(this.subject); - } - - - // ********** internal methods ********** - - /** - * Return an iterator on the preference models. - * At this point we can be sure that the subject is not null. - */ - protected Iterator> preferenceModels() { - String[] keys; - try { - keys = this.subject.keys(); - } catch (BackingStoreException ex) { - throw new RuntimeException(ex); - } - return new TransformationIterator>(new ArrayIterator(keys)) { - @Override - protected PreferencePropertyValueModel

transform(String key) { - return PreferencesCollectionValueModel.this.buildPreferenceModel(key); - } - }; - } - - /** - * Override this method to tweak the model used to wrap the - * specified preference (e.g. to customize the model's converter). - */ - protected PreferencePropertyValueModel

buildPreferenceModel(String key) { - return new PreferencePropertyValueModel

(this.subjectHolder, key); - } - - protected synchronized void preferenceChanged(String key, String newValue) { - if (newValue == null) { - // a preference was removed - PreferencePropertyValueModel

preferenceModel = this.preferences.remove(key); - this.fireItemRemoved(VALUES, preferenceModel); - } else if ( ! this.preferences.containsKey(key)) { - // a preference was added - PreferencePropertyValueModel

preferenceModel = this.buildPreferenceModel(key); - this.preferences.put(key, preferenceModel); - this.fireItemAdded(VALUES, preferenceModel); - } else { - // a preference's value changed - do nothing - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/AbstractTreeModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/AbstractTreeModel.java deleted file mode 100644 index 0a3ab42d06..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/AbstractTreeModel.java +++ /dev/null @@ -1,216 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.swing; - -import java.io.Serializable; -import javax.swing.event.EventListenerList; -import javax.swing.event.TreeModelEvent; -import javax.swing.event.TreeModelListener; -import javax.swing.tree.TreeModel; - -/** - * Abstract class that should have been provided by the JDK - * (à la javax.swing.AbstractListModel). This class provides: - * - support for a collection of listeners - * - a number of convenience methods for firing events for those listeners - */ -public abstract class AbstractTreeModel - implements TreeModel, Serializable -{ - /** Our listeners. */ - protected final EventListenerList listenerList; - - - // ********** constructors/initialization ********** - - protected AbstractTreeModel() { - super(); - this.listenerList = new EventListenerList(); - } - - - // ********** partial TreeModel implementation ********** - - public void addTreeModelListener(TreeModelListener l) { - this.listenerList.add(TreeModelListener.class, l); - } - - public void removeTreeModelListener(TreeModelListener l) { - this.listenerList.remove(TreeModelListener.class, l); - } - - - // ********** queries ********** - - /** - * Return the model's current collection of listeners. - * (There seems to be a pattern of making this type of method public; - * although it should probably be protected....) - */ - public TreeModelListener[] treeModelListeners() { - return this.listenerList.getListeners(TreeModelListener.class); - } - - /** - * Return whether this model has no listeners. - */ - protected boolean hasNoTreeModelListeners() { - return this.listenerList.getListenerCount(TreeModelListener.class) == 0; - } - - /** - * Return whether this model has any listeners. - */ - protected boolean hasTreeModelListeners() { - return ! this.hasNoTreeModelListeners(); - } - - - // ********** behavior ********** - - /** - * Notify listeners of a model change. - * A significant property of the nodes changed, but the nodes themselves - * are still the same objects. - * @see javax.swing.event.TreeModelEvent - * @see javax.swing.event.TreeModelListener - */ - protected void fireTreeNodesChanged(Object[] path, int[] childIndices, Object[] children) { - // guaranteed to return a non-null array - Object[] listeners = this.listenerList.getListenerList(); - TreeModelEvent event = null; - // process the listeners last to first, notifying - // those that are interested in this event - for (int i = listeners.length-2; i>=0; i-=2) { - if (listeners[i]==TreeModelListener.class) { - // lazily create the event - if (event == null) { - event = new TreeModelEvent(this, path, childIndices, children); - } - ((TreeModelListener) listeners[i+1]).treeNodesChanged(event); - } - } - } - - - /** - * Notify listeners of a model change. - * A significant property of the node changed, but the node itself is the same object. - * @see javax.swing.event.TreeModelEvent - * @see javax.swing.event.TreeModelListener - */ - protected void fireTreeNodeChanged(Object[] path, int childIndex, Object child) { - this.fireTreeNodesChanged(path, new int[] {childIndex}, new Object[] {child}); - } - - /** - * Notify listeners of a model change. - * A significant property of the root changed, but the root itself is the same object. - * @see javax.swing.event.TreeModelEvent - * @see javax.swing.event.TreeModelListener - */ - protected void fireTreeRootChanged(Object root) { - this.fireTreeNodesChanged(new Object[] {root}, null, null); - } - - /** - * Notify listeners of a model change. - * @see javax.swing.event.TreeModelEvent - * @see javax.swing.event.TreeModelListener - */ - protected void fireTreeNodesInserted(Object[] path, int[] childIndices, Object[] children) { - // guaranteed to return a non-null array - Object[] listeners = this.listenerList.getListenerList(); - TreeModelEvent event = null; - // process the listeners last to first, notifying - // those that are interested in this event - for (int i = listeners.length-2; i>=0; i-=2) { - if (listeners[i]==TreeModelListener.class) { - // lazily create the event - if (event == null) { - event = new TreeModelEvent(this, path, childIndices, children); - } - ((TreeModelListener) listeners[i+1]).treeNodesInserted(event); - } - } - } - - /** - * Notify listeners of a model change. - * @see javax.swing.event.TreeModelEvent - * @see javax.swing.event.TreeModelListener - */ - protected void fireTreeNodeInserted(Object[] path, int childIndex, Object child) { - this.fireTreeNodesInserted(path, new int[] {childIndex}, new Object[] {child}); - } - - /** - * Notify listeners of a model change. - * @see javax.swing.event.TreeModelEvent - * @see javax.swing.event.TreeModelListener - */ - protected void fireTreeNodesRemoved(Object[] path, int[] childIndices, Object[] children) { - // guaranteed to return a non-null array - Object[] listeners = this.listenerList.getListenerList(); - TreeModelEvent event = null; - // process the listeners last to first, notifying - // those that are interested in this event - for (int i = listeners.length-2; i>=0; i-=2) { - if (listeners[i]==TreeModelListener.class) { - // lazily create the event - if (event == null) { - event = new TreeModelEvent(this, path, childIndices, children); - } - ((TreeModelListener) listeners[i+1]).treeNodesRemoved(event); - } - } - } - - /** - * Notify listeners of a model change. - * @see javax.swing.event.TreeModelEvent - * @see javax.swing.event.TreeModelListener - */ - protected void fireTreeNodeRemoved(Object[] path, int childIndex, Object child) { - this.fireTreeNodesRemoved(path, new int[] {childIndex}, new Object[] {child}); - } - - /** - * Notify listeners of a model change. - * @see javax.swing.event.TreeModelEvent - * @see javax.swing.event.TreeModelListener - */ - protected void fireTreeStructureChanged(Object[] path) { - // guaranteed to return a non-null array - Object[] listeners = this.listenerList.getListenerList(); - TreeModelEvent event = null; - // process the listeners last to first, notifying - // those that are interested in this event - for (int i = listeners.length-2; i>=0; i-=2) { - if (listeners[i]==TreeModelListener.class) { - // lazily create the event - if (event == null) { - event = new TreeModelEvent(this, path); - } - ((TreeModelListener) listeners[i+1]).treeStructureChanged(event); - } - } - } - - /** - * Notify listeners of a model change. - * @see javax.swing.event.TreeModelEvent - * @see javax.swing.event.TreeModelListener - */ - protected void fireTreeRootReplaced(Object newRoot) { - this.fireTreeStructureChanged(new Object[] {newRoot}); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/CheckBoxModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/CheckBoxModelAdapter.java deleted file mode 100644 index 78069cd6b0..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/CheckBoxModelAdapter.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.swing; - -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * This javax.swing.ButtonModel can be used to keep a listener - * (e.g. a JCheckBox) in synch with a PropertyValueModel that - * holds a boolean. - * - * Maybe not the richest class in our toolbox, but it was the - * victim of refactoring.... ~bjv - */ -public class CheckBoxModelAdapter - extends ToggleButtonModelAdapter -{ - - // ********** constructors ********** - - /** - * Constructor - the boolean holder is required. - */ - public CheckBoxModelAdapter(WritablePropertyValueModel booleanHolder, boolean defaultValue) { - super(booleanHolder, defaultValue); - } - - /** - * Constructor - the boolean holder is required. - * The default value will be false. - */ - public CheckBoxModelAdapter(WritablePropertyValueModel booleanHolder) { - super(booleanHolder); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ColumnAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ColumnAdapter.java deleted file mode 100644 index e101823abc..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ColumnAdapter.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.swing; - -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - - -/** - * This adapter is used by the table model adapter to - * convert a model object into the models used for each of - * the cells for the object's corresponding row in the table. - */ -public interface ColumnAdapter { - /** - * Return the number of columns in the table. - * Typically this is static. - */ - int columnCount(); - - /** - * Return the name of the specified column. - */ - String columnName(int index); - - /** - * Return the class of the specified column. - */ - Class columnClass(int index); - - /** - * Return whether the specified column is editable. - * Typically this is the same for every row. - */ - boolean columnIsEditable(int index); - - /** - * Return the cell models for the specified subject - * that corresponds to a single row in the table. - */ - WritablePropertyValueModel[] cellModels(Object subject); - -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ComboBoxModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ComboBoxModelAdapter.java deleted file mode 100644 index 7cb5f7d88e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ComboBoxModelAdapter.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.swing; - -import javax.swing.ComboBoxModel; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.model.listener.awt.AWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * This javax.swing.ComboBoxModel can be used to keep a ListDataListener - * (e.g. a JComboBox) in synch with a ListValueModel (or a CollectionValueModel). - * For combo boxes, the model object that holds the current selection is - * typically a different model object than the one that holds the collection - * of choices. - * - * For example, a MWReference (the selectionOwner) has an attribute - * "sourceTable" (the collectionOwner) - * which holds on to a collection of MWDatabaseFields. When the selection - * is changed this model will keep the listeners aware of the changes. - * The inherited list model will keep its listeners aware of changes to the - * collection model - * - * In addition to the collection holder required by the superclass, - * an instance of this ComboBoxModel must be supplied with a - * selection holder, which is a PropertyValueModel that provides access - * to the selection (typically a PropertyAspectAdapter). - */ -public class ComboBoxModelAdapter - extends ListModelAdapter - implements ComboBoxModel -{ - protected final WritablePropertyValueModel selectionHolder; - protected final PropertyChangeListener selectionListener; - - - // ********** constructors ********** - - /** - * Constructor - the list holder and selection holder are required; - */ - public ComboBoxModelAdapter(ListValueModel listHolder, WritablePropertyValueModel selectionHolder) { - super(listHolder); - if (selectionHolder == null) { - throw new NullPointerException(); - } - this.selectionHolder = selectionHolder; - this.selectionListener = this.buildSelectionListener(); - } - - /** - * Constructor - the collection holder and selection holder are required; - */ - public ComboBoxModelAdapter(CollectionValueModel collectionHolder, WritablePropertyValueModel selectionHolder) { - super(collectionHolder); - if (selectionHolder == null) { - throw new NullPointerException(); - } - this.selectionHolder = selectionHolder; - this.selectionListener = this.buildSelectionListener(); - } - - - // ********** initialization ********** - - protected PropertyChangeListener buildSelectionListener() { - return new AWTPropertyChangeListenerWrapper(this.buildSelectionListener_()); - } - - protected PropertyChangeListener buildSelectionListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - // notify listeners that the selection has changed - ComboBoxModelAdapter.this.fireSelectionChanged(); - } - @Override - public String toString() { - return "selection listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** ComboBoxModel implementation ********** - - public Object getSelectedItem() { - return this.selectionHolder.getValue(); - } - - public void setSelectedItem(Object selectedItem) { - this.selectionHolder.setValue(selectedItem); - } - - - // ********** behavior ********** - - /** - * Extend to engage the selection holder. - */ - @Override - protected void engageModel() { - super.engageModel(); - this.selectionHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.selectionListener); - } - - /** - * Extend to disengage the selection holder. - */ - @Override - protected void disengageModel() { - this.selectionHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.selectionListener); - super.disengageModel(); - } - - /** - * Notify the listeners that the selection has changed. - */ - protected void fireSelectionChanged() { - // I guess this will work... - this.fireContentsChanged(this, -1, -1); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.selectionHolder + ":" + this.listHolder); //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/DateSpinnerModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/DateSpinnerModelAdapter.java deleted file mode 100644 index 61ef8cee8f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/DateSpinnerModelAdapter.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.swing; - -import java.util.Calendar; -import java.util.Date; -import javax.swing.SpinnerDateModel; -import javax.swing.event.ChangeListener; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.model.listener.awt.AWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * This javax.swing.SpinnerDateModel can be used to keep a ChangeListener - * (e.g. a JSpinner) in synch with a PropertyValueModel that holds a date. - * - * This class must be a sub-class of SpinnerDateModel because of some - * crappy jdk code.... ~bjv - * @see javax.swing.JSpinner#createEditor(javax.swing.SpinnerModel) - * - * If this class needs to be modified, it would behoove us to review the - * other, similar classes: - * @see ListSpinnerModelAdapter - * @see NumberSpinnerModelAdapter - */ -public class DateSpinnerModelAdapter - extends SpinnerDateModel -{ - - /** - * The default spinner value; used when the underlying model date value is null. - * The default is the current date. - */ - private final Date defaultValue; - - /** A value model on the underlying date. */ - private final WritablePropertyValueModel dateHolder; - - /** A listener that allows us to synchronize with changes made to the underlying date. */ - private final PropertyChangeListener dateChangeListener; - - - // ********** constructors ********** - - /** - * Constructor - the date holder is required. - * The default spinner value is the current date. - */ - public DateSpinnerModelAdapter(WritablePropertyValueModel dateHolder) { - this(dateHolder, new Date()); - } - - /** - * Constructor - the date holder and default value are required. - */ - public DateSpinnerModelAdapter(WritablePropertyValueModel dateHolder, Date defaultValue) { - this(dateHolder, null, null, Calendar.DAY_OF_MONTH, defaultValue); - } - - /** - * Constructor - the date holder is required. - * The default spinner value is the current date. - */ - public DateSpinnerModelAdapter(WritablePropertyValueModel dateHolder, Comparable start, Comparable end, int calendarField) { - this(dateHolder, start, end, calendarField, new Date()); - } - - /** - * Constructor - the date holder is required. - */ - public DateSpinnerModelAdapter(WritablePropertyValueModel dateHolder, Comparable start, Comparable end, int calendarField, Date defaultValue) { - super(dateHolder.getValue() == null ? defaultValue : (Date) dateHolder.getValue(), start, end, calendarField); - this.dateHolder = dateHolder; - this.dateChangeListener = this.buildDateChangeListener(); - // postpone listening to the underlying date - // until we have listeners ourselves... - this.defaultValue = defaultValue; - } - - - // ********** initialization ********** - - protected PropertyChangeListener buildDateChangeListener() { - return new AWTPropertyChangeListenerWrapper(this.buildDateChangeListener_()); - } - - protected PropertyChangeListener buildDateChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - DateSpinnerModelAdapter.this.synchronize(event.getNewValue()); - } - @Override - public String toString() { - return "date listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** SpinnerModel implementation ********** - - /** - * Extend to check whether this method is being called before we - * have any listeners. - * This is necessary because some crappy jdk code gets the value - * from the model *before* listening to the model. ~bjv - * @see javax.swing.JSpinner.DefaultEditor(javax.swing.JSpinner) - */ - @Override - public Object getValue() { - if (this.getChangeListeners().length == 0) { - // sorry about this "lateral" call to super ~bjv - super.setValue(this.spinnerValueOf(this.dateHolder.getValue())); - } - return super.getValue(); - } - - /** - * Extend to update the underlying date directly. - * The resulting event will be ignored: @see #synchronize(Object). - */ - @Override - public void setValue(Object value) { - super.setValue(value); - this.dateHolder.setValue(value); - } - - /** - * Extend to start listening to the underlying date if necessary. - */ - @Override - public void addChangeListener(ChangeListener listener) { - if (this.getChangeListeners().length == 0) { - this.dateHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.dateChangeListener); - this.synchronize(this.dateHolder.getValue()); - } - super.addChangeListener(listener); - } - - /** - * Extend to stop listening to the underlying date if appropriate. - */ - @Override - public void removeChangeListener(ChangeListener listener) { - super.removeChangeListener(listener); - if (this.getChangeListeners().length == 0) { - this.dateHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.dateChangeListener); - } - } - - - // ********** queries ********** - - protected Date getDefaultValue() { - return this.defaultValue; - } - - /** - * Convert to a non-null value. - */ - protected Object spinnerValueOf(Object value) { - return (value == null) ? this.getDefaultValue() : value; - } - - - // ********** behavior ********** - - /** - * Set the spinner value if it has changed. - */ - void synchronize(Object value) { - Object newValue = this.spinnerValueOf(value); - // check to see whether the spinner date has already been synchronized - // (via #setValue()) - if ( ! this.getValue().equals(newValue)) { - this.setValue(newValue); - } - } - - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.dateHolder); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/DocumentAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/DocumentAdapter.java deleted file mode 100644 index 1f7f4043de..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/DocumentAdapter.java +++ /dev/null @@ -1,375 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.swing; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.Serializable; -import java.util.EventObject; - -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import javax.swing.event.EventListenerList; -import javax.swing.event.UndoableEditEvent; -import javax.swing.event.UndoableEditListener; -import javax.swing.text.AttributeSet; -import javax.swing.text.BadLocationException; -import javax.swing.text.Document; -import javax.swing.text.Element; -import javax.swing.text.PlainDocument; -import javax.swing.text.Position; -import javax.swing.text.Segment; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.model.listener.awt.AWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * This javax.swing.text.Document can be used to keep a DocumentListener - * (e.g. a JTextField) in synch with a PropertyValueModel that holds a string. - * - * NB: This model should only be used for "small" documents; - * i.e. documents used by text fields, not text panes. - * @see #synchronizeDelegate(String) - */ -public class DocumentAdapter - implements Document, Serializable -{ - - /** The delegate document whose behavior we "enhance". */ - protected final Document delegate; - - /** A listener that allows us to forward any changes made to the delegate document. */ - protected final CombinedListener delegateListener; - - /** A value model on the underlying model string. */ - protected final WritablePropertyValueModel stringHolder; - - /** A listener that allows us to synchronize with changes made to the underlying model string. */ - protected transient PropertyChangeListener stringListener; - - /** The event listener list for the document. */ - protected final EventListenerList listenerList = new EventListenerList(); - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Constructor - the string holder is required. - * Wrap the specified document. - */ - public DocumentAdapter(WritablePropertyValueModel stringHolder, Document delegate) { - super(); - if (stringHolder == null || delegate == null) { - throw new NullPointerException(); - } - this.stringHolder = stringHolder; - // postpone listening to the underlying model string - // until we have listeners ourselves... - this.delegate = delegate; - this.stringListener = this.buildStringListener(); - this.delegateListener = this.buildDelegateListener(); - } - - /** - * Constructor - the string holder is required. - * Wrap a plain document. - */ - public DocumentAdapter(WritablePropertyValueModel stringHolder) { - this(stringHolder, new PlainDocument()); - } - - - // ********** initialization ********** - - protected PropertyChangeListener buildStringListener() { - return new AWTPropertyChangeListenerWrapper(this.buildStringListener_()); - } - - protected PropertyChangeListener buildStringListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - DocumentAdapter.this.stringChanged(event); - } - @Override - public String toString() { - return "string listener"; //$NON-NLS-1$ - } - }; - } - - protected CombinedListener buildDelegateListener() { - return new InternalListener(); - } - - - // ********** Document implementation ********** - - public int getLength() { - return this.delegate.getLength(); - } - - /** - * Extend to start listening to the underlying models if necessary. - */ - public void addDocumentListener(DocumentListener listener) { - if (this.listenerList.getListenerCount(DocumentListener.class) == 0) { - this.delegate.addDocumentListener(this.delegateListener); - this.engageStringHolder(); - } - this.listenerList.add(DocumentListener.class, listener); - } - - /** - * Extend to stop listening to the underlying models if appropriate. - */ - public void removeDocumentListener(DocumentListener listener) { - this.listenerList.remove(DocumentListener.class, listener); - if (this.listenerList.getListenerCount(DocumentListener.class) == 0) { - this.disengageStringHolder(); - this.delegate.removeDocumentListener(this.delegateListener); - } - } - - /** - * Extend to start listening to the delegate document if necessary. - */ - public void addUndoableEditListener(UndoableEditListener listener) { - if (this.listenerList.getListenerCount(UndoableEditListener.class) == 0) { - this.delegate.addUndoableEditListener(this.delegateListener); - } - this.listenerList.add(UndoableEditListener.class, listener); - } - - /** - * Extend to stop listening to the delegate document if appropriate. - */ - public void removeUndoableEditListener(UndoableEditListener listener) { - this.listenerList.remove(UndoableEditListener.class, listener); - if (this.listenerList.getListenerCount(UndoableEditListener.class) == 0) { - this.delegate.removeUndoableEditListener(this.delegateListener); - } - } - - public Object getProperty(Object key) { - return this.delegate.getProperty(key); - } - - public void putProperty(Object key, Object value) { - this.delegate.putProperty(key, value); - } - - /** - * Extend to update the underlying model string directly. - * The resulting event will be ignored: @see #synchronizeDelegate(String). - */ - public void remove(int offset, int len) throws BadLocationException { - this.delegate.remove(offset, len); - this.stringHolder.setValue(this.delegate.getText(0, this.delegate.getLength())); - } - - /** - * Extend to update the underlying model string directly. - * The resulting event will be ignored: @see #synchronizeDelegate(String). - */ - public void insertString(int offset, String insertedString, AttributeSet a) throws BadLocationException { - this.delegate.insertString(offset, insertedString, a); - this.stringHolder.setValue(this.delegate.getText(0, this.delegate.getLength())); - } - - public String getText(int offset, int length) throws BadLocationException { - return this.delegate.getText(offset, length); - } - - public void getText(int offset, int length, Segment txt) throws BadLocationException { - this.delegate.getText(offset, length, txt); - } - - public Position getStartPosition() { - return this.delegate.getStartPosition(); - } - - public Position getEndPosition() { - return this.delegate.getEndPosition(); - } - - public Position createPosition(int offs) throws BadLocationException { - return this.delegate.createPosition(offs); - } - - public Element[] getRootElements() { - return this.delegate.getRootElements(); - } - - public Element getDefaultRootElement() { - return this.delegate.getDefaultRootElement(); - } - - public void render(Runnable r) { - this.delegate.render(r); - } - - - // ********** queries ********** - - public DocumentListener[] documentListeners() { - return this.listenerList.getListeners(DocumentListener.class); - } - - public UndoableEditListener[] undoableEditListeners() { - return this.listenerList.getListeners(UndoableEditListener.class); - } - - - // ********** behavior ********** - - /** - * A third party has modified the underlying model string. - * Synchronize the delegate document accordingly. - */ - protected void stringChanged(PropertyChangeEvent event) { - this.synchronizeDelegate((String) event.getNewValue()); - } - - /** - * Replace the document's entire text string with the new string. - */ - protected void synchronizeDelegate(String s) { - try { - int len = this.delegate.getLength(); - // check to see whether the delegate has already been synchronized - // (via #insertString() or #remove()) - if ( ! this.delegate.getText(0, len).equals(s)) { - this.delegate.remove(0, len); - this.delegate.insertString(0, s, null); - } - } catch (BadLocationException ex) { - throw new IllegalStateException(ex.getMessage()); // this should not happen... - } - } - - protected void engageStringHolder() { - this.stringHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.stringListener); - this.synchronizeDelegate(this.stringHolder.getValue()); - } - - protected void disengageStringHolder() { - this.stringHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.stringListener); - } - - protected void delegateChangedUpdate(DocumentEvent event) { - // no need to lazy-initialize the event; - // we wouldn't get here if we did not have listeners... - DocumentEvent ee = new InternalDocumentEvent(this, event); - DocumentListener[] listeners = this.documentListeners(); - for (int i = listeners.length; i-- > 0; ) { - listeners[i].changedUpdate(ee); - } - } - - protected void delegateInsertUpdate(DocumentEvent event) { - // no need to lazy-initialize the event; - // we wouldn't get here if we did not have listeners... - DocumentEvent ee = new InternalDocumentEvent(this, event); - DocumentListener[] listeners = this.documentListeners(); - for (int i = listeners.length; i-- > 0; ) { - listeners[i].insertUpdate(ee); - } - } - - protected void delegateRemoveUpdate(DocumentEvent event) { - // no need to lazy-initialize the event; - // we wouldn't get here if we did not have listeners... - DocumentEvent ee = new InternalDocumentEvent(this, event); - DocumentListener[] listeners = this.documentListeners(); - for (int i = listeners.length; i-- > 0; ) { - listeners[i].removeUpdate(ee); - } - } - - protected void delegateUndoableEditHappened(UndoableEditEvent event) { - // no need to lazy-initialize the event; - // we wouldn't get here if we did not have listeners... - UndoableEditEvent ee = new UndoableEditEvent(this, event.getEdit()); - UndoableEditListener[] listeners = this.undoableEditListeners(); - for (int i = listeners.length; i-- > 0; ) { - listeners[i].undoableEditHappened(ee); - } - } - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.stringHolder); - } - - private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException { - // read in any hidden stuff - s.defaultReadObject(); - this.stringListener = this.buildStringListener(); - } - - -// ********** inner class ********** - - protected interface CombinedListener extends DocumentListener, UndoableEditListener, Serializable { - // just consolidate the two interfaces - } - - protected class InternalListener implements CombinedListener { - private static final long serialVersionUID = 1L; - public void changedUpdate(DocumentEvent event) { - DocumentAdapter.this.delegateChangedUpdate(event); - } - public void insertUpdate(DocumentEvent event) { - DocumentAdapter.this.delegateInsertUpdate(event); - } - public void removeUpdate(DocumentEvent event) { - DocumentAdapter.this.delegateRemoveUpdate(event); - } - public void undoableEditHappened(UndoableEditEvent event) { - DocumentAdapter.this.delegateUndoableEditHappened(event); - } - } - - protected static class InternalDocumentEvent - extends EventObject - implements DocumentEvent - { - protected DocumentEvent delegate; - - protected InternalDocumentEvent(Document document, DocumentEvent delegate) { - super(document); - this.delegate = delegate; - } - public ElementChange getChange(Element elem) { - return this.delegate.getChange(elem); - } - public Document getDocument() { - return (Document) this.source; - } - public int getLength() { - return this.delegate.getLength(); - } - public int getOffset() { - return this.delegate.getOffset(); - } - public EventType getType() { - return this.delegate.getType(); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ListModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ListModelAdapter.java deleted file mode 100644 index 2d1c1e4b5d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ListModelAdapter.java +++ /dev/null @@ -1,292 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.swing; - -import javax.swing.AbstractListModel; -import javax.swing.event.ListDataListener; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.model.listener.awt.AWTListChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionListValueModelAdapter; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * This javax.swing.ListModel can be used to keep a ListDataListener - * (e.g. a JList) in synch with a ListValueModel (or a CollectionValueModel). - * - * An instance of this ListModel *must* be supplied with a value model, - * which is a ListValueModel on the bound list or a CollectionValueModel - * on the bound collection. This is required - the list (or collection) - * itself can be null, but the value model that holds it cannot. - */ -public class ListModelAdapter - extends AbstractListModel -{ - /** A value model on the underlying model list. */ - protected ListValueModel listHolder; - - /** - * Cache the size of the list for "dramatic" changes. - * @see #listChanged(ListChangeEvent) - */ - protected int listSize; - - /** A listener that allows us to forward changes made to the underlying model list. */ - protected final ListChangeListener listChangeListener; - - - // ********** constructors ********** - - /** - * Default constructor - initialize stuff. - */ - private ListModelAdapter() { - super(); - this.listSize = 0; - this.listChangeListener = this.buildListChangeListener(); - } - - /** - * Constructor - the list holder is required. - */ - public ListModelAdapter(ListValueModel listHolder) { - this(); - this.setModel(listHolder); - } - - /** - * Constructor - the collection holder is required. - */ - public ListModelAdapter(CollectionValueModel collectionHolder) { - this(); - this.setModel(collectionHolder); - } - - - // ********** initialization ********** - - protected ListChangeListener buildListChangeListener() { - return new AWTListChangeListenerWrapper(this.buildListChangeListener_()); - } - - protected ListChangeListener buildListChangeListener_() { - return new ListChangeListener() { - public void itemsAdded(ListAddEvent event) { - ListModelAdapter.this.itemsAdded(event); - } - public void itemsRemoved(ListRemoveEvent event) { - ListModelAdapter.this.itemsRemoved(event); - } - public void itemsReplaced(ListReplaceEvent event) { - ListModelAdapter.this.itemsReplaced(event); - } - public void itemsMoved(ListMoveEvent event) { - ListModelAdapter.this.itemsMoved(event); - } - public void listCleared(ListClearEvent event) { - ListModelAdapter.this.listCleared(); - } - public void listChanged(ListChangeEvent event) { - ListModelAdapter.this.listChanged(); - } - @Override - public String toString() { - return "list listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** ListModel implementation ********** - - public int getSize() { - return this.listHolder.size(); - } - - public Object getElementAt(int index) { - return this.listHolder.get(index); - } - - /** - * Extend to start listening to the underlying model list if necessary. - */ - @Override - public void addListDataListener(ListDataListener l) { - if (this.hasNoListDataListeners()) { - this.engageModel(); - this.listSize = this.listHolder.size(); - } - super.addListDataListener(l); - } - - /** - * Extend to stop listening to the underlying model list if appropriate. - */ - @Override - public void removeListDataListener(ListDataListener l) { - super.removeListDataListener(l); - if (this.hasNoListDataListeners()) { - this.disengageModel(); - this.listSize = 0; - } - } - - - // ********** public API ********** - - /** - * Return the underlying list model. - */ - public ListValueModel model() { - return this.listHolder; - } - - /** - * Set the underlying list model. - */ - public void setModel(ListValueModel listHolder) { - if (listHolder == null) { - throw new NullPointerException(); - } - boolean hasListeners = this.hasListDataListeners(); - if (hasListeners) { - this.disengageModel(); - } - this.listHolder = listHolder; - if (hasListeners) { - this.engageModel(); - this.listChanged(); - } - } - - /** - * Set the underlying collection model. - */ - @SuppressWarnings({ "unchecked", "rawtypes" }) - public void setModel(CollectionValueModel collectionHolder) { - this.setModel(new CollectionListValueModelAdapter(collectionHolder)); - } - - - // ********** queries ********** - - /** - * Return whether this model has no listeners. - */ - protected boolean hasNoListDataListeners() { - return this.getListDataListeners().length == 0; - } - - /** - * Return whether this model has any listeners. - */ - protected boolean hasListDataListeners() { - return ! this.hasNoListDataListeners(); - } - - - // ********** behavior ********** - - protected void engageModel() { - this.listHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - } - - protected void disengageModel() { - this.listHolder.removeListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - } - - - - // ********** list change support ********** - - /** - * Items were added to the underlying model list. - * Notify listeners of the changes. - */ - protected void itemsAdded(ListAddEvent event) { - int start = event.getIndex(); - int end = start + event.getItemsSize() - 1; - this.fireIntervalAdded(this, start, end); - this.listSize += event.getItemsSize(); - } - - /** - * Items were removed from the underlying model list. - * Notify listeners of the changes. - */ - protected void itemsRemoved(ListRemoveEvent event) { - int start = event.getIndex(); - int end = start + event.getItemsSize() - 1; - this.fireIntervalRemoved(this, start, end); - this.listSize -= event.getItemsSize(); - } - - /** - * Items were replaced in the underlying model list. - * Notify listeners of the changes. - */ - protected void itemsReplaced(ListReplaceEvent event) { - int start = event.getIndex(); - int end = start + event.getItemsSize() - 1; - this.fireContentsChanged(this, start, end); - } - - /** - * Items were moved in the underlying model list. - * Notify listeners of the changes. - */ - protected void itemsMoved(ListMoveEvent event) { - int start = Math.min(event.getSourceIndex(), event.getTargetIndex()); - int end = Math.max(event.getSourceIndex(), event.getTargetIndex()) + event.getLength() - 1; - this.fireContentsChanged(this, start, end); - } - - /** - * The underlying model list was cleared. - * Notify listeners of the changes. - */ - protected void listCleared() { - if (this.listSize != 0) { - this.fireIntervalRemoved(this, 0, this.listSize - 1); - this.listSize = 0; - } - } - - /** - * The underlying model list has changed "dramatically". - * Notify listeners of the changes. - */ - protected void listChanged() { - if (this.listSize != 0) { - this.fireIntervalRemoved(this, 0, this.listSize - 1); - } - this.listSize = this.listHolder.size(); - if (this.listSize != 0) { - this.fireIntervalAdded(this, 0, this.listSize - 1); - } - } - - - // ********** Object overrides ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.listHolder); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ListSpinnerModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ListSpinnerModelAdapter.java deleted file mode 100644 index af3e0b0187..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ListSpinnerModelAdapter.java +++ /dev/null @@ -1,218 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.swing; - -import java.util.Arrays; -import java.util.List; -import javax.swing.SpinnerListModel; -import javax.swing.event.ChangeListener; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.model.listener.awt.AWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * This javax.swing.SpinnerListModel can be used to keep a ChangeListener - * (e.g. a JSpinner) in synch with a PropertyValueModel that holds a value - * in the list. - * - * This class must be a sub-class of SpinnerListModel because of some - * crappy jdk code.... ~bjv - * @see javax.swing.JSpinner#createEditor(javax.swing.SpinnerModel) - * - * NB: This model should only be used for values that have a reasonably - * inexpensive #equals() implementation. - * @see #synchronize(Object) - * - * If this class needs to be modified, it would behoove us to review the - * other, similar classes: - * @see DateSpinnerModelAdapter - * @see NumberSpinnerModelAdapter - */ -public class ListSpinnerModelAdapter - extends SpinnerListModel -{ - - /** - * The default spinner value; used when the underlying model value is null. - * The default is the first item on the list. - */ - private final Object defaultValue; - - /** A value model on the underlying value. */ - private final WritablePropertyValueModel valueHolder; - - /** A listener that allows us to synchronize with changes made to the underlying value. */ - private final PropertyChangeListener valueChangeListener; - - - // ********** constructors ********** - - /** - * Constructor - the value holder is required. - * Use the model value itself as the default spinner value. - */ - public ListSpinnerModelAdapter(WritablePropertyValueModel valueHolder) { - this(valueHolder, valueHolder.getValue()); - } - - /** - * Constructor - the value holder is required. - */ - public ListSpinnerModelAdapter(WritablePropertyValueModel valueHolder, Object defaultValue) { - this(valueHolder, new Object[] {defaultValue}, defaultValue); - } - - /** - * Constructor - the value holder is required. - * Use the first item in the list of values as the default spinner value. - */ - public ListSpinnerModelAdapter(WritablePropertyValueModel valueHolder, Object[] values) { - this(valueHolder, values, values[0]); - } - - /** - * Constructor - the value holder is required. - */ - public ListSpinnerModelAdapter(WritablePropertyValueModel valueHolder, Object[] values, Object defaultValue) { - this(valueHolder, Arrays.asList(values), defaultValue); - } - - /** - * Constructor - the value holder is required. - * Use the first item in the list of values as the default spinner value. - */ - public ListSpinnerModelAdapter(WritablePropertyValueModel valueHolder, List values) { - this(valueHolder, values, values.get(0)); - } - - /** - * Constructor - the value holder is required. - */ - public ListSpinnerModelAdapter(WritablePropertyValueModel valueHolder, List values, Object defaultValue) { - super(values); - this.valueHolder = valueHolder; - this.valueChangeListener = this.buildValueChangeListener(); - // postpone listening to the underlying value - // until we have listeners ourselves... - this.defaultValue = defaultValue; - } - - - // ********** initialization ********** - - protected PropertyChangeListener buildValueChangeListener() { - return new AWTPropertyChangeListenerWrapper(this.buildValueChangeListener_()); - } - - protected PropertyChangeListener buildValueChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - ListSpinnerModelAdapter.this.synchronize(event.getNewValue()); - } - @Override - public String toString() { - return "value listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** SpinnerModel implementation ********** - - /** - * Extend to check whether this method is being called before we - * have any listeners. - * This is necessary because some crappy jdk code gets the value - * from the model *before* listening to the model. ~bjv - * @see javax.swing.JSpinner.DefaultEditor(javax.swing.JSpinner) - */ - @Override - public Object getValue() { - if (this.getChangeListeners().length == 0) { - // sorry about this "lateral" call to super ~bjv - super.setValue(this.spinnerValueOf(this.valueHolder.getValue())); - } - return super.getValue(); - } - - /** - * Extend to update the underlying value directly. - * The resulting event will be ignored: @see #synchronize(Object). - */ - @Override - public void setValue(Object value) { - super.setValue(value); - this.valueHolder.setValue(value); - } - - /** - * Extend to start listening to the underlying value if necessary. - */ - @Override - public void addChangeListener(ChangeListener listener) { - if (this.getChangeListeners().length == 0) { - this.valueHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.valueChangeListener); - this.synchronize(this.valueHolder.getValue()); - } - super.addChangeListener(listener); - } - - /** - * Extend to stop listening to the underlying value if appropriate. - */ - @Override - public void removeChangeListener(ChangeListener listener) { - super.removeChangeListener(listener); - if (this.getChangeListeners().length == 0) { - this.valueHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.valueChangeListener); - } - } - - - // ********** queries ********** - - protected Object getDefaultValue() { - return this.defaultValue; - } - - /** - * Convert to a non-null value. - */ - protected Object spinnerValueOf(Object value) { - return (value == null) ? this.getDefaultValue() : value; - } - - - // ********** behavior ********** - - /** - * Set the spinner value if it has changed. - */ - void synchronize(Object value) { - Object newValue = this.spinnerValueOf(value); - // check to see whether the spinner value has already been synchronized - // (via #setValue()) - if ( ! this.getValue().equals(newValue)) { - this.setValue(newValue); - } - } - - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.valueHolder); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/NumberSpinnerModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/NumberSpinnerModelAdapter.java deleted file mode 100644 index 4a624639b5..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/NumberSpinnerModelAdapter.java +++ /dev/null @@ -1,223 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.swing; - -import javax.swing.SpinnerNumberModel; -import javax.swing.event.ChangeListener; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.model.listener.awt.AWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * This javax.swing.SpinnerNumberModel can be used to keep a ChangeListener - * (e.g. a JSpinner) in synch with a PropertyValueModel that holds a number. - * - * This class must be a sub-class of SpinnerNumberModel because of some - * crappy jdk code.... ~bjv - * @see javax.swing.JSpinner#createEditor(javax.swing.SpinnerModel) - * - * If this class needs to be modified, it would behoove us to review the - * other, similar classes: - * @see DateSpinnerModelAdapter - * @see ListSpinnerModelAdapter - */ -public class NumberSpinnerModelAdapter - extends SpinnerNumberModel -{ - - /** - * The default spinner value; used when the - * underlying model number value is null. - */ - private final Number defaultValue; - - /** A value model on the underlying number. */ - private final WritablePropertyValueModel numberHolder; - - /** - * A listener that allows us to synchronize with - * changes made to the underlying number. - */ - private final PropertyChangeListener numberChangeListener; - - - // ********** constructors ********** - - /** - * Constructor - the number holder is required. - * The default spinner value is zero. - * The step size is one. - */ - public NumberSpinnerModelAdapter(WritablePropertyValueModel numberHolder) { - this(numberHolder, 0); - } - - /** - * Constructor - the number holder is required. - * The step size is one. - */ - public NumberSpinnerModelAdapter(WritablePropertyValueModel numberHolder, int defaultValue) { - this(numberHolder, null, null, Integer.valueOf(1), Integer.valueOf(defaultValue)); - } - - /** - * Constructor - the number holder is required. - * Use the minimum value as the default spinner value. - */ - public NumberSpinnerModelAdapter(WritablePropertyValueModel numberHolder, int minimum, int maximum, int stepSize) { - this(numberHolder, minimum, maximum, stepSize, minimum); - } - - /** - * Constructor - the number holder is required. - */ - public NumberSpinnerModelAdapter(WritablePropertyValueModel numberHolder, int minimum, int maximum, int stepSize, int defaultValue) { - this(numberHolder, Integer.valueOf(minimum), Integer.valueOf(maximum), Integer.valueOf(stepSize), Integer.valueOf(defaultValue)); - } - - /** - * Constructor - the number holder is required. - * Use the minimum value as the default spinner value. - */ - public NumberSpinnerModelAdapter(WritablePropertyValueModel numberHolder, double minimum, double maximum, double stepSize) { - this(numberHolder, minimum, maximum, stepSize, minimum); - } - - /** - * Constructor - the number holder is required. - */ - public NumberSpinnerModelAdapter(WritablePropertyValueModel numberHolder, double minimum, double maximum, double stepSize, double defaultValue) { - this(numberHolder, Double.valueOf(minimum), Double.valueOf(maximum), Double.valueOf(stepSize), Double.valueOf(defaultValue)); - } - - /** - * Constructor - the number holder is required. - */ - public NumberSpinnerModelAdapter(WritablePropertyValueModel numberHolder, Comparable minimum, Comparable maximum, Number stepSize, Number defaultValue) { - super(numberHolder.getValue() == null ? defaultValue : (Number) numberHolder.getValue(), minimum, maximum, stepSize); - this.numberHolder = numberHolder; - this.numberChangeListener = this.buildNumberChangeListener(); - // postpone listening to the underlying number - // until we have listeners ourselves... - this.defaultValue = defaultValue; - } - - - // ********** initialization ********** - - protected PropertyChangeListener buildNumberChangeListener() { - return new AWTPropertyChangeListenerWrapper(this.buildNumberChangeListener_()); - } - - protected PropertyChangeListener buildNumberChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - NumberSpinnerModelAdapter.this.synchronize(event.getNewValue()); - } - @Override - public String toString() { - return "number listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** SpinnerModel implementation ********** - - /** - * Extend to check whether this method is being called before we - * have any listeners. - * This is necessary because some crappy jdk code gets the value - * from the model *before* listening to the model. ~bjv - * @see javax.swing.JSpinner.DefaultEditor(javax.swing.JSpinner) - */ - @Override - public Object getValue() { - if (this.getChangeListeners().length == 0) { - // sorry about this "lateral" call to super ~bjv - super.setValue(this.spinnerValueOf(this.numberHolder.getValue())); - } - return super.getValue(); - } - - /** - * Extend to update the underlying number directly. - * The resulting event will be ignored: @see #synchronizeDelegate(Object). - */ - @Override - public void setValue(Object value) { - super.setValue(value); - this.numberHolder.setValue((Number) value); - } - - /** - * Extend to start listening to the underlying number if necessary. - */ - @Override - public void addChangeListener(ChangeListener listener) { - if (this.getChangeListeners().length == 0) { - this.numberHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.numberChangeListener); - this.synchronize(this.numberHolder.getValue()); - } - super.addChangeListener(listener); - } - - /** - * Extend to stop listening to the underlying number if appropriate. - */ - @Override - public void removeChangeListener(ChangeListener listener) { - super.removeChangeListener(listener); - if (this.getChangeListeners().length == 0) { - this.numberHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.numberChangeListener); - } - } - - - // ********** queries ********** - - protected Number getDefaultValue() { - return this.defaultValue; - } - - /** - * Convert to a non-null value. - */ - protected Object spinnerValueOf(Object value) { - return (value == null) ? this.getDefaultValue() : value; - } - - - // ********** behavior ********** - - /** - * Set the spinner value if it has changed. - */ - void synchronize(Object value) { - Object newValue = this.spinnerValueOf(value); - // check to see whether the date has already been synchronized - // (via #setValue()) - if ( ! this.getValue().equals(newValue)) { - this.setValue(newValue); - } - } - - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.numberHolder); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ObjectListSelectionModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ObjectListSelectionModel.java deleted file mode 100644 index 81647b2842..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ObjectListSelectionModel.java +++ /dev/null @@ -1,427 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.swing; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; -import javax.swing.DefaultListSelectionModel; -import javax.swing.ListModel; -import javax.swing.event.ListDataEvent; -import javax.swing.event.ListDataListener; -import javax.swing.event.ListSelectionListener; -import org.eclipse.jpt.common.utility.internal.CollectionTools; - -/** - * This ListSelectionModel is aware of the ListModel and - * provides convenience methods to access and set the - * selected *objects*, as opposed to the selected *indexes*. - */ -public class ObjectListSelectionModel - extends DefaultListSelectionModel -{ - /** The list model referenced by the list selection model. */ - private final ListModel listModel; - - /** A listener that allows us to clear the selection when the list model has changed. */ - private final ListDataListener listDataListener; - - - // ********** constructors ********** - - /** - * Construct a list selection model for the specified list model. - */ - public ObjectListSelectionModel(ListModel listModel) { - super(); - this.listModel = listModel; - this.listDataListener = this.buildListDataListener(); - } - - - // ********** initialization ********** - - private ListDataListener buildListDataListener() { - return new ListDataListener() { - public void intervalAdded(ListDataEvent event) { - // this does not affect the selection - } - public void intervalRemoved(ListDataEvent event) { - // this does not affect the selection - } - public void contentsChanged(ListDataEvent event) { - ObjectListSelectionModel.this.listModelContentsChanged(event); - } - @Override - public String toString() { - return "list data listener"; //$NON-NLS-1$ - } - }; - } - - /** - * Typically, the selection does not need to be cleared when the - * contents of the list have changed. Most of the time this just - * means an item has changed in a way that affects its display string - * or icon. We typically only use the class for edits involving - * single selection. - * A subclass can override this method if the selection - * should be cleared because a change could mean the selection is invalid. - */ - protected void listModelContentsChanged(@SuppressWarnings("unused") ListDataEvent event) { - /**this.clearSelection();*/ - } - - - // ********** ListSelectionModel implementation ********** - - @Override - public void addListSelectionListener(ListSelectionListener l) { - if (this.hasNoListSelectionListeners()) { - this.listModel.addListDataListener(this.listDataListener); - } - super.addListSelectionListener(l); - } - - @Override - public void removeListSelectionListener(ListSelectionListener l) { - super.removeListSelectionListener(l); - if (this.hasNoListSelectionListeners()) { - this.listModel.removeListDataListener(this.listDataListener); - } - } - - - // ********** queries ********** - - /** - * Return whether this model has no listeners. - */ - protected boolean hasNoListSelectionListeners() { // private-protected - return this.getListSelectionListeners().length == 0; - } - - /** - * Return the list model referenced by the list selection model. - */ - public ListModel getListModel() { - return this.listModel; - } - - public int selectedValuesSize() { - int min = this.getMinSelectionIndex(); - int max = this.getMaxSelectionIndex(); - - if ((min < 0) || (max < 0)) { - return 0; - } - - int n = 0; - int count = this.getListModel().getSize(); - for (int i = min; i <= max; i++) { - if (this.isSelectedIndex(i) && (i < count)) { - n++; - } - } - return n; - } - - /** - * Return the first selected value. - * Return null if the selection is empty. - */ - public Object selectedValue() { - int index = this.getMinSelectionIndex(); - if (index == -1) { - return null; - } - if (this.getListModel().getSize() <= index) { - return null; - } - return this.getListModel().getElementAt(index); - } - - /** - * Return an array of the selected values. - */ - public Object[] selectedValues() { - int min = this.getMinSelectionIndex(); - int max = this.getMaxSelectionIndex(); - - if ((min < 0) || (max < 0)) { - return new Object[0]; - } - - int maxSize = (max - min) + 1; - Object[] temp = new Object[maxSize]; - int n = 0; - int count = this.getListModel().getSize(); - for (int i = min; i <= max; i++) { - if (this.isSelectedIndex(i) && (i < count)) { - temp[n++] = this.getListModel().getElementAt(i); - } - } - if (n == maxSize) { - // all the elements in the range were selected - return temp; - } - // only some of the elements in the range were selected - Object[] result = new Object[n]; - System.arraycopy(temp, 0, result, 0, n); - return result; - } - - /** - * Return an array of the selected indices in order. - */ - public int[] selectedIndices() { - int min = this.getMinSelectionIndex(); - int max = this.getMaxSelectionIndex(); - - if ((min < 0) || (max < 0)) { - return new int[0]; - } - - int maxSize = (max - min) + 1; - int[] temp = new int[maxSize]; - int n = 0; - int count = this.getListModel().getSize(); - for (int i = min; i <= max; i++) { - if (this.isSelectedIndex(i) && (i < count)) { - temp[n++] = i; - } - } - if (n == maxSize) { - // all the elements in the range were selected - Arrays.sort(temp); - return temp; - } - // only some of the elements in the range were selected - int[] result = new int[n]; - System.arraycopy(temp, 0, result, 0, n); - Arrays.sort(result); - return result; - } - - /** - * Set the selected value. - */ - public void setSelectedValue(Object object) { - this.setSelectedValues(CollectionTools.singletonIterator(object)); - } - - /** - * Set the current set of selected objects to the specified objects. - * @see javax.swing.ListSelectionModel#setSelectionInterval(int, int) - */ - public void setSelectedValues(Iterator objects) { - this.setValueIsAdjusting(true); - this.clearSelection(); - this.addSelectedValuesInternal(objects); - this.setValueIsAdjusting(false); - } - - /** - * Set the current set of selected objects to the specified objects. - * @see javax.swing.ListSelectionModel#setSelectionInterval(int, int) - */ - public void setSelectedValues(Collection objects) { - this.setSelectedValues(objects.iterator()); - } - - /** - * Set the current set of selected objects to the specified objects. - * @see javax.swing.ListSelectionModel#setSelectionInterval(int, int) - */ - public void setSelectedValues(Object[] objects) { - this.setSelectedValues(CollectionTools.iterator(objects)); - } - - /** - * Add the specified object to the current set of selected objects. - * @see javax.swing.ListSelectionModel#addSelectionInterval(int, int) - */ - public void addSelectedValue(Object object) { - this.addSelectedValues(CollectionTools.singletonIterator(object)); - } - - /** - * Add the specified objects to the current set of selected objects. - * @see javax.swing.ListSelectionModel#addSelectionInterval(int, int) - */ - public void addSelectedValues(Iterator objects) { - this.setValueIsAdjusting(true); - this.addSelectedValuesInternal(objects); - this.setValueIsAdjusting(false); - } - - /** - * Add the specified objects to the current set of selected objects. - * @see javax.swing.ListSelectionModel#addSelectionInterval(int, int) - */ - public void addSelectedValues(Collection objects) { - this.addSelectedValues(objects.iterator()); - } - - /** - * Add the specified objects to the current set of selected objects. - * @see javax.swing.ListSelectionModel#addSelectionInterval(int, int) - */ - public void addSelectedValues(Object[] objects) { - this.addSelectedValues(CollectionTools.iterator(objects)); - } - - /** - * Remove the specified object from the current set of selected objects. - * @see javax.swing.ListSelectionModel#removeSelectionInterval(int, int) - */ - public void removeSelectedValue(Object object) { - this.removeSelectedValues(CollectionTools.singletonIterator(object)); - } - - /** - * Remove the specified objects from the current set of selected objects. - * @see javax.swing.ListSelectionModel#removeSelectionInterval(int, int) - */ - public void removeSelectedValues(Iterator objects) { - this.setValueIsAdjusting(true); - ListModel lm = this.getListModel(); - int lmSize = lm.getSize(); - while (objects.hasNext()) { - int index = this.indexOf(objects.next(), lm, lmSize); - this.removeSelectionInterval(index, index); - } - this.setValueIsAdjusting(false); - } - - /** - * Remove the specified objects from the current set of selected objects. - * @see javax.swing.ListSelectionModel#removeSelectionInterval(int, int) - */ - public void removeSelectedValues(Collection objects) { - this.removeSelectedValues(objects.iterator()); - } - - /** - * Remove the specified objects from the current set of selected objects. - * @see javax.swing.ListSelectionModel#removeSelectionInterval(int, int) - */ - public void removeSelectedValues(Object[] objects) { - this.removeSelectedValues(CollectionTools.iterator(objects)); - } - - /** - * @see javax.swing.ListSelectionModel#getAnchorSelectionIndex() - * Return null if the anchor selection is empty. - */ - public Object getAnchorSelectedValue() { - int index = this.getAnchorSelectionIndex(); - if (index == -1) { - return null; - } - return this.getListModel().getElementAt(index); - } - - /** - * @see javax.swing.ListSelectionModel#setAnchorSelectionIndex(int) - */ - public void setAnchorSelectedValue(Object object) { - this.setAnchorSelectionIndex(this.indexOf(object)); - } - - /** - * @see javax.swing.ListSelectionModel#getLeadSelectionIndex() - * Return null if the lead selection is empty. - */ - public Object getLeadSelectedValue() { - int index = this.getLeadSelectionIndex(); - if (index == -1) { - return null; - } - return this.getListModel().getElementAt(index); - } - - /** - * @see javax.swing.ListSelectionModel#setLeadSelectionIndex(int) - */ - public void setLeadSelectedValue(Object object) { - this.setLeadSelectionIndex(this.indexOf(object)); - } - - /** - * @see javax.swing.ListSelectionModel#getMaxSelectionIndex() - * Return null if the max selection is empty. - */ - public Object getMaxSelectedValue() { - int index = this.getMaxSelectionIndex(); - if (index == -1) { - return null; - } - return this.getListModel().getElementAt(index); - } - - /** - * @see javax.swing.ListSelectionModel#getMinSelectionIndex() - * Return null if the min selection is empty. - */ - public Object getMinSelectedValue() { - int index = this.getMinSelectionIndex(); - if (index == -1) { - return null; - } - return this.getListModel().getElementAt(index); - } - - /** - * @see javax.swing.ListSelectionModel#isSelectedIndex(int) - */ - public boolean valueIsSelected(Object object) { - return this.isSelectedIndex(this.indexOf(object)); - } - - /** - * Add the specified objects to the current set of selected objects, - * without wrapping the actions in "adjusting" events. - */ - private void addSelectedValuesInternal(Iterator objects) { - ListModel lm = this.getListModel(); - int listModelSize = lm.getSize(); - while (objects.hasNext()) { - int index = this.indexOf(objects.next(), lm, listModelSize); - this.addSelectionInterval(index, index); - } - } - - /** - * Return the index in the list model of the specified object. - * Return -1 if the object is not in the list model. - */ - private int indexOf(Object object) { - ListModel lm = this.getListModel(); - return this.indexOf(object, lm, lm.getSize()); - } - - /** - * Return the index in the list model of the specified object. - * Return -1 if the object is not in the list model. - */ - // we're just jerking around with performance optimizations here - // (in memory of Phil...); - // call this method inside loops that do not modify the listModel - private int indexOf(Object object, ListModel lm, int listModelSize) { - for (int i = listModelSize; i-- > 0; ) { - if (lm.getElementAt(i).equals(object)) { - return i; - } - } - return -1; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/PrimitiveListTreeModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/PrimitiveListTreeModel.java deleted file mode 100644 index 9fe9fca0e8..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/PrimitiveListTreeModel.java +++ /dev/null @@ -1,239 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.swing; - -import java.util.ArrayList; -import java.util.Iterator; - -import javax.swing.event.TreeModelListener; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.DefaultTreeModel; -import javax.swing.tree.MutableTreeNode; -import javax.swing.tree.TreeNode; -import javax.swing.tree.TreePath; - -import org.eclipse.jpt.common.utility.internal.model.listener.awt.AWTListChangeListenerWrapper; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * This TreeModel implementation provides a tree with a "null" root that - * has a set of "primitive" children. These "primitive" children do not have - * children themselves, making the tree a maximum of 2 levels deep. - * This model automatically synchronizes the root's children with a - * ListValueModel that holds a collection of primitive (non-model) objects - * (e.g. Strings). - * - * This is useful for providing an "editable" list of primitives. Since the JDK - * does not provide us with an editable listbox, we must use an editable tree. - * We wrap everything in DefaultMutableTreeNodes. - * - * Subclasses must implement #primitiveChanged(int, Object) and update - * the model appropriately. This method is called when the user edits the - * list directly and presses . - * - * The JTree using this model must be configured as "editable": - * tree.setEditable(true); - */ -// TODO convert to use an adapter instead of requiring subclass -public abstract class PrimitiveListTreeModel - extends DefaultTreeModel -{ - /** a model on the list of primitives */ - private final ListValueModel listHolder; - - /** a listener that handles the adding, removing, and replacing of the primitives */ - private final ListChangeListener listChangeListener; - - - // ********** constructors ********** - - /** - * Public constructor - the list holder is required - */ - public PrimitiveListTreeModel(ListValueModel listHolder) { - super(new DefaultMutableTreeNode(null, true)); // true = the root can have children - if (listHolder == null) { - throw new NullPointerException(); - } - this.listHolder = listHolder; - this.listChangeListener = this.buildListChangeListener(); - // postpone listening to the model until we have listeners ourselves - } - - protected ListChangeListener buildListChangeListener() { - return new AWTListChangeListenerWrapper(this.buildListChangeListener_()); - } - - protected ListChangeListener buildListChangeListener_() { - return new PrimitiveListChangeListener(); - } - - - // ********** behavior ********** - - /** - * Subclasses should override this method to update the - * model appropriately. The primitive at the specified index was - * edited directly by the user and the new value is as specified. - * Convert the value appropriately and place it in the model. - */ - protected abstract void primitiveChanged(int index, Object newValue); - - - // ********** TreeModel implementation ********** - - /** - * Override to change the underlying model instead of changing the node directly. - */ - @Override - public void valueForPathChanged(TreePath path, Object newValue) { - TreeNode node = (TreeNode) path.getLastPathComponent(); - int index = ((TreeNode) this.getRoot()).getIndex(node); - this.primitiveChanged(index, newValue); - } - - /** - * Extend to start listening to the underlying model if necessary. - */ - @Override - public void addTreeModelListener(TreeModelListener l) { - if (this.getTreeModelListeners().length == 0) { - this.listHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - this.synchronizeList(); - } - super.addTreeModelListener(l); - } - - /** - * Extend to stop listening to the underlying model if appropriate. - */ - @Override - public void removeTreeModelListener(TreeModelListener l) { - super.removeTreeModelListener(l); - if (this.getTreeModelListeners().length == 0) { - this.listHolder.removeListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - } - } - - - // ********** behavior ********** - - /** - * Synchronize our list of nodes with the list of primitives - */ - void synchronizeList() { - this.clearList(); - this.buildList(); - } - - void clearList() { - int childcount = this.root.getChildCount(); - for (int i = childcount - 1; i >= 0; i--) { - this.removeNodeFromParent((MutableTreeNode)this.root.getChildAt(i)); - } - } - - private void buildList() { - for (Iterator stream = this.listHolder.iterator(); stream.hasNext(); ) { - this.addPrimitive(stream.next()); - } - } - - /** - * Add the specified primitive to the end of the list. - */ - private void addPrimitive(Object primitive) { - this.insertPrimitive(this.root.getChildCount(), primitive); - } - - /** - * Create a node for the specified primitive - * and insert it as a child of the root. - */ - void insertPrimitive(int index, Object primitive) { - DefaultMutableTreeNode node = new DefaultMutableTreeNode(primitive, false); // don't allow children on the child node - this.insertNodeInto(node, (MutableTreeNode) this.root, index); - } - - /** - * Remove node at the specified index. - */ - MutableTreeNode removeNode(int index) { - MutableTreeNode node = (MutableTreeNode) this.root.getChildAt(index); - this.removeNodeFromParent(node); - return node; - } - - /** - * Replace the user object of the node at childIndex. - */ - void replacePrimitive(int index, Object primitive) { - MutableTreeNode node = (MutableTreeNode) this.root.getChildAt(index); - node.setUserObject(primitive); - this.nodeChanged(node); - } - - - // ********** inner class ********** - - private class PrimitiveListChangeListener implements ListChangeListener { - PrimitiveListChangeListener() { - super(); - } - - public void itemsAdded(ListAddEvent event) { - int i = event.getIndex(); - for (Object item : event.getItems()) { - PrimitiveListTreeModel.this.insertPrimitive(i++, item); - } - } - - public void itemsRemoved(ListRemoveEvent event) { - for (int i = 0; i < event.getItemsSize(); i++) { - PrimitiveListTreeModel.this.removeNode(event.getIndex()); - } - } - - public void itemsReplaced(ListReplaceEvent event) { - int i = event.getIndex(); - for (Object item : event.getNewItems()) { - PrimitiveListTreeModel.this.replacePrimitive(i++, item); - } - } - - public void itemsMoved(ListMoveEvent event) { - ArrayList temp = new ArrayList(event.getLength()); - for (int i = 0; i < event.getLength(); i++) { - temp.add(PrimitiveListTreeModel.this.removeNode(event.getSourceIndex())); - } - int i = event.getTargetIndex(); - for (MutableTreeNode node : temp) { - PrimitiveListTreeModel.this.insertPrimitive(i++, node); - } - } - - public void listCleared(ListClearEvent event) { - PrimitiveListTreeModel.this.clearList(); - } - - public void listChanged(ListChangeEvent event) { - PrimitiveListTreeModel.this.synchronizeList(); - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/RadioButtonModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/RadioButtonModelAdapter.java deleted file mode 100644 index 83d3113454..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/RadioButtonModelAdapter.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.swing; - -import org.eclipse.jpt.common.utility.internal.BidiFilter; -import org.eclipse.jpt.common.utility.internal.BidiTransformer; -import org.eclipse.jpt.common.utility.internal.model.value.FilteringWritablePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.TransformationWritablePropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * This javax.swing.ButtonModel can be used to keep a listener - * (e.g. a JRadioButton) in synch with a (typically shared) - * PropertyValueModel that holds one value out of a set of values. - * - * NOTE: Do *not* use this model with a ButtonGroup, since the - * shared value holder and the wrappers built by this adapter will - * keep the appropriate radio button checked. Also, this allows - * us to uncheck all the radio buttons in a group when the shared - * value is null. - */ -public class RadioButtonModelAdapter - extends ToggleButtonModelAdapter -{ - - // ********** constructors ********** - - /** - * Constructor - the value holder is required. - */ - public RadioButtonModelAdapter(WritablePropertyValueModel valueHolder, Object buttonValue, boolean defaultValue) { - super(buildBooleanHolder(valueHolder, buttonValue), defaultValue); - } - - /** - * Constructor - the value holder is required. - * The default value will be false. - */ - public RadioButtonModelAdapter(WritablePropertyValueModel valueHolder, Object buttonValue) { - super(buildBooleanHolder(valueHolder, buttonValue)); - } - - - // ********** static methods ********** - - /** - * Build up a set of wrappers that will convert the - * specified value holder and button value to/from a boolean. - * - * If the value holder's value matches the button value, - * the wrapper will return true. Likewise, if the value holder's - * value is set to true, the wrapper will set the value holder's - * value to the button value. - */ - public static WritablePropertyValueModel buildBooleanHolder(WritablePropertyValueModel valueHolder, Object buttonValue) { - WritablePropertyValueModel filteringPVM = new FilteringWritablePropertyValueModel(valueHolder, new RadioButtonFilter(buttonValue)); - return new TransformationWritablePropertyValueModel(filteringPVM, new RadioButtonTransformer(buttonValue)); - } - - - // ********** overrides ********** - - /** - * The user cannot de-select a radio button - the user - * can only *select* a radio button. Only the model can - * cause a radio button to be de-selected. We use the - * ARMED flag to indicate whether we are being de-selected - * by the user. - */ - @Override - public void setSelected(boolean b) { - // do not allow the user to de-select a radio button - // radio buttons can - if ((b == false) && this.isArmed()) { - return; - } - super.setSelected(b); - } - - - // ********** inner classes ********** - - /** - * This filter will only pass through a new value to the wrapped - * value holder when it matches the configured button value. - */ - public static class RadioButtonFilter implements BidiFilter { - private Object buttonValue; - - public RadioButtonFilter(Object buttonValue) { - super(); - this.buttonValue = buttonValue; - } - - /** - * always return the wrapped value - */ - public boolean accept(Object value) { - return true; - } - - /** - * pass through the value to the wrapped property value model - * *only* when it matches our button value - */ - public boolean reverseAccept(Object value) { - return (value != null) && value.equals(this.buttonValue); - } - - } - - /** - * This transformer will convert the wrapped value to Boolean.TRUE - * when it matches the configured button value. - */ - public static class RadioButtonTransformer implements BidiTransformer { - private Object buttonValue; - - public RadioButtonTransformer(Object buttonValue) { - super(); - this.buttonValue = buttonValue; - } - - /** - * if the wrapped value matches our button value return true, - * if it is some other value return false; - * but if it is null simply pass it through because it will cause the - * button model's default value to be used - */ - public Boolean transform(Object value) { - return (value == null) ? null : Boolean.valueOf(value.equals(this.buttonValue)); - } - - /** - * if the new value is true, pass through the our button value; - * otherwise pass through null - */ - public Object reverseTransform(Boolean value) { - return (value.booleanValue()) ? this.buttonValue : null; - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/SpinnerModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/SpinnerModelAdapter.java deleted file mode 100644 index 2490cae9d4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/SpinnerModelAdapter.java +++ /dev/null @@ -1,207 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.swing; - -import javax.swing.AbstractSpinnerModel; -import javax.swing.SpinnerModel; -import javax.swing.SpinnerNumberModel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.model.listener.awt.AWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * This javax.swing.SpinnerModel can be used to keep a ChangeListener - * (e.g. a JSpinner) in synch with a PropertyValueModel that holds a value. - * - * Note: it is likely you want to use one of the following classes instead of - * this one: - * DateSpinnerModelAdapter - * NumberSpinnerModelAdapter - * ListSpinnerModelAdapter - * - * NB: This model should only be used for values that have a fairly - * inexpensive #equals() implementation. - * @see #synchronizeDelegate(Object) - */ -public class SpinnerModelAdapter - extends AbstractSpinnerModel -{ - /** The delegate spinner model whose behavior we "enhance". */ - protected final SpinnerModel delegate; - - /** A listener that allows us to forward any changes made to the delegate spinner model. */ - protected final ChangeListener delegateListener; - - /** A value model on the underlying value. */ - protected final WritablePropertyValueModel valueHolder; - - /** A listener that allows us to synchronize with changes made to the underlying value. */ - protected final PropertyChangeListener valueListener; - - - // ********** constructors ********** - - /** - * Constructor - the value holder and delegate are required. - */ - public SpinnerModelAdapter(WritablePropertyValueModel valueHolder, SpinnerModel delegate) { - super(); - if (valueHolder == null || delegate == null) { - throw new NullPointerException(); - } - this.valueHolder = valueHolder; - this.delegate = delegate; - // postpone listening to the underlying value - // until we have listeners ourselves... - this.valueListener = this.buildValueListener(); - this.delegateListener = this.buildDelegateListener(); - } - - /** - * Constructor - the value holder is required. - * This will wrap a simple number spinner model. - */ - public SpinnerModelAdapter(WritablePropertyValueModel valueHolder) { - this(valueHolder, new SpinnerNumberModel()); - } - - - // ********** initialization ********** - - protected PropertyChangeListener buildValueListener() { - return new AWTPropertyChangeListenerWrapper(this.buildValueListener_()); - } - - protected PropertyChangeListener buildValueListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - SpinnerModelAdapter.this.valueChanged(event); - } - @Override - public String toString() { - return "value listener"; //$NON-NLS-1$ - } - }; - } - - /** - * expand access a bit for inner class - */ - @Override - protected void fireStateChanged() { - super.fireStateChanged(); - } - - protected ChangeListener buildDelegateListener() { - return new ChangeListener() { - public void stateChanged(ChangeEvent event) { - // forward the event, with this as the source - SpinnerModelAdapter.this.fireStateChanged(); - } - @Override - public String toString() { - return "delegate listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** SpinnerModel implementation ********** - - public Object getValue() { - return this.delegate.getValue(); - } - - /** - * Extend to update the underlying value directly. - * The resulting event will be ignored: @see #synchronizeDelegate(Object). - */ - public void setValue(Object value) { - this.delegate.setValue(value); - this.valueHolder.setValue(value); - } - - public Object getNextValue() { - return this.delegate.getNextValue(); - } - - public Object getPreviousValue() { - return this.delegate.getPreviousValue(); - } - - /** - * Extend to start listening to the underlying value if necessary. - */ - @Override - public void addChangeListener(ChangeListener listener) { - if (this.listenerList.getListenerCount(ChangeListener.class) == 0) { - this.delegate.addChangeListener(this.delegateListener); - this.engageValueHolder(); - } - super.addChangeListener(listener); - } - - /** - * Extend to stop listening to the underlying value if appropriate. - */ - @Override - public void removeChangeListener(ChangeListener listener) { - super.removeChangeListener(listener); - if (this.listenerList.getListenerCount(ChangeListener.class) == 0) { - this.disengageValueHolder(); - this.delegate.removeChangeListener(this.delegateListener); - } - } - - - // ********** behavior ********** - - /** - * A third party has modified the underlying value. - * Synchronize the delegate model accordingly. - */ - protected void valueChanged(PropertyChangeEvent event) { - this.synchronizeDelegate(event.getNewValue()); - } - - /** - * Set the delegate's value if it has changed. - */ - protected void synchronizeDelegate(Object value) { - // check to see whether the delegate has already been synchronized - // (via #setValue()) - if ( ! this.delegate.getValue().equals(value)) { - this.delegate.setValue(value); - } - } - - protected void engageValueHolder() { - this.valueHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.valueListener); - this.synchronizeDelegate(this.valueHolder.getValue()); - } - - protected void disengageValueHolder() { - this.valueHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.valueListener); - } - - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.valueHolder); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/TableModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/TableModelAdapter.java deleted file mode 100644 index 8c29c1364b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/TableModelAdapter.java +++ /dev/null @@ -1,420 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.swing; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import javax.swing.event.TableModelListener; -import javax.swing.table.AbstractTableModel; - -import org.eclipse.jpt.common.utility.internal.model.listener.awt.AWTListChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.model.listener.awt.AWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionListValueModelAdapter; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * This TableModel can be used to keep a TableModelListener (e.g. a JTable) - * in synch with a ListValueModel that holds a collection of model objects, - * each of which corresponds to a row in the table. - * Typically, each column of the table will be bound to a different aspect - * of the contained model objects. - * - * For example, a MWTable has an attribute 'databaseFields' that holds - * a collection of MWDatabaseFields that would correspond to the rows of - * a JTable; and each MWDatabaseField has a number - * of attributes (e.g. name, type, size) that can be bound to the columns of - * a row in the JTable. As these database fields are added, removed, and - * changed, this model will keep the listeners aware of the changes. - * - * An instance of this TableModel must be supplied with a - * list holder (e.g. the 'databaseFields'), which is a value - * model on the bound collection This is required - the - * collection itself can be null, but the list value model that - * holds it is required. Typically this list will be sorted (@see - * SortedListValueModelAdapter). - * - * This TableModel must also be supplied with a ColumnAdapter that - * will be used to configure the headers, renderers, editors, and contents - * of the various columns. - * - * Design decision: - * Cell listener options (from low space/high time to high space/low time): - * - 1 cell listener listening to every cell (this is the current implementation) - * - 1 cell listener per row - * - 1 cell listener per cell - */ -public class TableModelAdapter - extends AbstractTableModel -{ - /** - * a list of user objects that are converted to - * rows via the column adapter - */ - private ListValueModel listHolder; - private final ListChangeListener listChangeListener; - - /** - * each row is an array of cell models - */ - // declare as ArrayList so we can use #ensureCapacity(int) - private final ArrayList[]> rows; - - /** - * client-supplied adapter that provides with the various column - * settings and converts the objects in the LVM - * into an array of cell models - */ - private final ColumnAdapter columnAdapter; - - /** - * the single listener that listens to every cell's model - */ - private final PropertyChangeListener cellListener; - - - // ********** constructors ********** - - /** - * Construct a table model adapter for the specified objects - * and adapter. - */ - public TableModelAdapter(ListValueModel listHolder, ColumnAdapter columnAdapter) { - super(); - if (listHolder == null) { - throw new NullPointerException(); - } - this.listHolder = listHolder; - this.columnAdapter = columnAdapter; - this.listChangeListener = this.buildListChangeListener(); - this.rows = new ArrayList[]>(); - this.cellListener = this.buildCellListener(); - } - - /** - * Construct a table model adapter for the specified objects - * and adapter. - */ - public TableModelAdapter(CollectionValueModel collectionHolder, ColumnAdapter columnAdapter) { - this(new CollectionListValueModelAdapter(collectionHolder), columnAdapter); - } - - - // ********** initialization ********** - - protected ListChangeListener buildListChangeListener() { - return new AWTListChangeListenerWrapper(this.buildListChangeListener_()); - } - - protected ListChangeListener buildListChangeListener_() { - return new ListChangeListener() { - public void itemsAdded(ListAddEvent event) { - TableModelAdapter.this.addRows(event.getIndex(), event.getItemsSize(), this.getItems(event)); - } - public void itemsRemoved(ListRemoveEvent event) { - TableModelAdapter.this.removeRows(event.getIndex(), event.getItemsSize()); - } - public void itemsReplaced(ListReplaceEvent event) { - TableModelAdapter.this.replaceRows(event.getIndex(), this.getNewItems(event)); - } - public void itemsMoved(ListMoveEvent event) { - TableModelAdapter.this.moveRows(event.getTargetIndex(), event.getSourceIndex(), event.getLength()); - } - public void listCleared(ListClearEvent event) { - TableModelAdapter.this.clearTable(); - } - public void listChanged(ListChangeEvent event) { - TableModelAdapter.this.rebuildTable(); - } - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getItems(ListAddEvent event) { - return (Iterable) event.getItems(); - } - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable getNewItems(ListReplaceEvent event) { - return (Iterable) event.getNewItems(); - } - @Override - public String toString() { - return "list listener"; //$NON-NLS-1$ - } - }; - } - - - protected PropertyChangeListener buildCellListener() { - return new AWTPropertyChangeListenerWrapper(this.buildCellListener_()); - } - - protected PropertyChangeListener buildCellListener_() { - return new PropertyChangeListener() { - @SuppressWarnings("unchecked") - public void propertyChanged(PropertyChangeEvent event) { - TableModelAdapter.this.cellChanged((WritablePropertyValueModel) event.getSource()); - } - @Override - public String toString() { - return "cell listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** TableModel implementation ********** - - public int getColumnCount() { - return this.columnAdapter.columnCount(); - } - - public int getRowCount() { - return this.rows.size(); - } - - @Override - public String getColumnName(int column) { - return this.columnAdapter.columnName(column); - } - - @Override - public Class getColumnClass(int columnIndex) { - return this.columnAdapter.columnClass(columnIndex); - } - - @Override - public boolean isCellEditable(int rowIndex, int columnIndex) { - return this.columnAdapter.columnIsEditable(columnIndex); - } - - public Object getValueAt(int rowIndex, int columnIndex) { - WritablePropertyValueModel[] row = this.rows.get(rowIndex); - return row[columnIndex].getValue(); - } - - @Override - public void setValueAt(Object value, int rowIndex, int columnIndex) { - WritablePropertyValueModel[] row = this.rows.get(rowIndex); - row[columnIndex].setValue(value); - } - - /** - * Extend to start listening to the underlying model if necessary. - */ - @Override - public void addTableModelListener(TableModelListener l) { - if (this.hasNoTableModelListeners()) { - this.engageModel(); - } - super.addTableModelListener(l); - } - - /** - * Extend to stop listening to the underlying model if necessary. - */ - @Override - public void removeTableModelListener(TableModelListener l) { - super.removeTableModelListener(l); - if (this.hasNoTableModelListeners()) { - this.disengageModel(); - } - } - - - // ********** public API ********** - - /** - * Return the underlying list model. - */ - public ListValueModel getModel() { - return this.listHolder; - } - - /** - * Set the underlying list model. - */ - public void setModel(ListValueModel listHolder) { - if (listHolder == null) { - throw new NullPointerException(); - } - boolean hasListeners = this.hasTableModelListeners(); - if (hasListeners) { - this.disengageModel(); - } - this.listHolder = listHolder; - if (hasListeners) { - this.engageModel(); - this.fireTableDataChanged(); - } - } - - /** - * Set the underlying collection model. - */ - public void setModel(CollectionValueModel collectionHolder) { - this.setModel(new CollectionListValueModelAdapter(collectionHolder)); - } - - - // ********** queries ********** - - /** - * Return whether this model has no listeners. - */ - protected boolean hasNoTableModelListeners() { - return this.listenerList.getListenerCount(TableModelListener.class) == 0; - } - - /** - * Return whether this model has any listeners. - */ - protected boolean hasTableModelListeners() { - return ! this.hasNoTableModelListeners(); - } - - - // ********** behavior ********** - - /** - * Start listening to the list of objects and the various aspects - * of the objects that make up the rows. - */ - private void engageModel() { - this.listHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - this.engageAllCells(); - } - - /** - * Convert the objects into rows and listen to the cells. - */ - private void engageAllCells() { - this.rows.ensureCapacity(this.listHolder.size()); - for (Iterator stream = this.listHolder.iterator(); stream.hasNext(); ) { - WritablePropertyValueModel[] row = this.columnAdapter.cellModels(stream.next()); - this.engageRow(row); - this.rows.add(row); - } - } - - /** - * Listen to the cells in the specified row. - */ - private void engageRow(WritablePropertyValueModel[] row) { - for (int i = row.length; i-- > 0; ) { - row[i].addPropertyChangeListener(PropertyValueModel.VALUE, this.cellListener); - } - } - - /** - * Stop listening. - */ - private void disengageModel() { - this.disengageAllCells(); - this.listHolder.removeListChangeListener(ListValueModel.LIST_VALUES, this.listChangeListener); - } - - private void disengageAllCells() { - for (WritablePropertyValueModel[] row : this.rows) { - this.disengageRow(row); - } - this.rows.clear(); - } - - private void disengageRow(WritablePropertyValueModel[] row) { - for (int i = row.length; i-- > 0; ) { - row[i].removePropertyChangeListener(PropertyValueModel.VALUE, this.cellListener); - } - } - - /** - * brute-force search for the cell(s) that changed... - */ - void cellChanged(WritablePropertyValueModel cellHolder) { - for (int i = this.rows.size(); i-- > 0; ) { - WritablePropertyValueModel[] row = this.rows.get(i); - for (int j = row.length; j-- > 0; ) { - if (row[j] == cellHolder) { - this.fireTableCellUpdated(i, j); - } - } - } - } - - /** - * convert the items to rows - */ - void addRows(int index, int size, Iterable items) { - List[]> newRows = new ArrayList[]>(size); - for (Object item : items) { - WritablePropertyValueModel[] row = this.columnAdapter.cellModels(item); - this.engageRow(row); - newRows.add(row); - } - this.rows.addAll(index, newRows); - this.fireTableRowsInserted(index, index + size - 1); - } - - void removeRows(int index, int size) { - for (int i = 0; i < size; i++) { - this.disengageRow(this.rows.remove(index)); - } - this.fireTableRowsDeleted(index, index + size - 1); - } - - void replaceRows(int index, Iterable items) { - int i = index; - for (Object item : items) { - WritablePropertyValueModel[] row = this.rows.get(i); - this.disengageRow(row); - row = this.columnAdapter.cellModels(item); - this.engageRow(row); - this.rows.set(i, row); - i++; - } - this.fireTableRowsUpdated(index, i - 1); - } - - void moveRows(int targetIndex, int sourceIndex, int length) { - ArrayList[]> temp = new ArrayList[]>(length); - for (int i = 0; i < length; i++) { - temp.add(this.rows.remove(sourceIndex)); - } - this.rows.addAll(targetIndex, temp); - - int start = Math.min(targetIndex, sourceIndex); - int end = Math.max(targetIndex, sourceIndex) + length - 1; - this.fireTableRowsUpdated(start, end); - } - - void clearTable() { - this.disengageAllCells(); - this.fireTableDataChanged(); - } - - void rebuildTable() { - this.disengageAllCells(); - this.engageAllCells(); - this.fireTableDataChanged(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ToggleButtonModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ToggleButtonModelAdapter.java deleted file mode 100644 index 044b2658a5..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/ToggleButtonModelAdapter.java +++ /dev/null @@ -1,224 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.swing; - -import java.awt.event.ActionListener; -import java.awt.event.ItemListener; -import javax.swing.JToggleButton.ToggleButtonModel; -import javax.swing.event.ChangeListener; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.model.listener.awt.AWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * This javax.swing.ButtonModel can be used to keep a listener - * (e.g. a JCheckBox or a JRadioButton) in synch with a PropertyValueModel - * on a boolean. - */ -public class ToggleButtonModelAdapter - extends ToggleButtonModel -{ - /** - * The default setting for the toggle button; for when the underlying model is null. - * The default [default value] is false (i.e. the toggle button is unchecked/empty). - */ - protected final boolean defaultValue; - - /** A value model on the underlying model boolean. */ - protected final WritablePropertyValueModel booleanHolder; - - /** - * A listener that allows us to synchronize with - * changes made to the underlying model boolean. - */ - protected final PropertyChangeListener booleanChangeListener; - - - // ********** constructors ********** - - /** - * Constructor - the boolean holder is required. - */ - public ToggleButtonModelAdapter(WritablePropertyValueModel booleanHolder, boolean defaultValue) { - super(); - if (booleanHolder == null) { - throw new NullPointerException(); - } - this.booleanHolder = booleanHolder; - this.booleanChangeListener = this.buildBooleanChangeListener(); - // postpone listening to the underlying model - // until we have listeners ourselves... - this.defaultValue = defaultValue; - } - - /** - * Constructor - the boolean holder is required. - * The default value will be false. - */ - public ToggleButtonModelAdapter(WritablePropertyValueModel booleanHolder) { - this(booleanHolder, false); - } - - - // ********** initialization ********** - - protected PropertyChangeListener buildBooleanChangeListener() { - return new AWTPropertyChangeListenerWrapper(this.buildBooleanChangeListener_()); - } - - protected PropertyChangeListener buildBooleanChangeListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - ToggleButtonModelAdapter.this.booleanChanged(event); - } - @Override - public String toString() { - return "boolean listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** ButtonModel implementation ********** - - /** - * Extend to update the underlying model if necessary. - */ - @Override - public void setSelected(boolean b) { - if (this.isSelected() != b) { // stop the recursion! - super.setSelected(b);//put the super call first, otherwise the following gets called twice - this.booleanHolder.setValue(Boolean.valueOf(b)); - } - } - - /** - * Extend to start listening to the underlying model if necessary. - */ - @Override - public void addActionListener(ActionListener l) { - if (this.hasNoListeners()) { - this.engageModel(); - } - super.addActionListener(l); - } - - /** - * Extend to stop listening to the underlying model if appropriate. - */ - @Override - public void removeActionListener(ActionListener l) { - super.removeActionListener(l); - if (this.hasNoListeners()) { - this.disengageModel(); - } - } - - /** - * Extend to start listening to the underlying model if necessary. - */ - @Override - public void addItemListener(ItemListener l) { - if (this.hasNoListeners()) { - this.engageModel(); - } - super.addItemListener(l); - } - - /** - * Extend to stop listening to the underlying model if appropriate. - */ - @Override - public void removeItemListener(ItemListener l) { - super.removeItemListener(l); - if (this.hasNoListeners()) { - this.disengageModel(); - } - } - - /** - * Extend to start listening to the underlying model if necessary. - */ - @Override - public void addChangeListener(ChangeListener l) { - if (this.hasNoListeners()) { - this.engageModel(); - } - super.addChangeListener(l); - } - - /** - * Extend to stop listening to the underlying model if appropriate. - */ - @Override - public void removeChangeListener(ChangeListener l) { - super.removeChangeListener(l); - if (this.hasNoListeners()) { - this.disengageModel(); - } - } - - - // ********** queries ********** - - /** - * Return whether we have no listeners at all. - */ - protected boolean hasNoListeners() { - return this.listenerList.getListenerCount() == 0; - } - - protected boolean getDefaultValue() { - return this.defaultValue; - } - - - // ********** behavior ********** - - /** - * Synchronize with the specified value. - * If it is null, use the default value (which is typically false). - */ - protected void setSelected(Boolean value) { - if (value == null) { - this.setSelected(this.getDefaultValue()); - } else { - this.setSelected(value.booleanValue()); - } - } - - /** - * The underlying model has changed - synchronize accordingly. - */ - protected void booleanChanged(PropertyChangeEvent event) { - this.setSelected((Boolean) event.getNewValue()); - } - - protected void engageModel() { - this.booleanHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.booleanChangeListener); - this.setSelected(this.booleanHolder.getValue()); - } - - protected void disengageModel() { - this.booleanHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.booleanChangeListener); - } - - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.booleanHolder); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/TreeModelAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/TreeModelAdapter.java deleted file mode 100644 index 12f0faf3a7..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/model/value/swing/TreeModelAdapter.java +++ /dev/null @@ -1,914 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.model.value.swing; - -import java.util.ArrayList; -import java.util.IdentityHashMap; -import java.util.List; - -import javax.swing.event.TreeModelListener; -import javax.swing.tree.TreePath; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.model.listener.awt.AWTListChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.model.listener.awt.AWTPropertyChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.model.listener.awt.AWTStateChangeListenerWrapper; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.TreeNodeValueModel; - -/** - * This javax.swing.tree.TreeModel can be used to keep a TreeModelListener - * (e.g. a JTree) in synch with a tree of TreeNodeValueModel objects. Unlike - * javax.swing.tree.DefaultTreeModel, you do not add and remove nodes with - * methods implemented here. You can add and remove nodes by adding and - * removing them directly to/from the nodes (or, more typically, the domain - * objects the nodes are wrapping and listening to). - * - * Due to limitations in JTree, the root of the tree can never be null, - * which, typically, should not be a problem. (If you want to display an empty - * tree you can set the JTree's treeModel to null.) - */ -public class TreeModelAdapter - extends AbstractTreeModel -{ - /** - * A value model on the underlying tree's root node and its - * corresponding listener. This allows clients to swap out - * the entire tree. Due to limitations in JTree, the root should - * never be set to null while we have listeners. - */ - private final PropertyValueModel> rootHolder; - private final PropertyChangeListener rootListener; - - /** - * A listener that notifies us when a node's internal - * "state" changes (as opposed to the node's value or list of - * children), allowing us to forward notification to our listeners. - */ - private final StateChangeListener nodeStateListener; - - /** - * A listener that notifies us when a node's "value" - * changes (as opposed to the node's state or list of - * children), allowing us to forward notification to our listeners. - * Typically, this will only happen with nodes that hold - * primitive data. - */ - private final PropertyChangeListener nodeValueListener; - - /** - * A listener that notifies us when an underlying node's - * "list" of children changes, allowing us to keep our - * internal tree in synch with the underlying tree model. - */ - private final ListChangeListener childrenListener; - - /* these attributes make up our internal tree */ - /** - * The root cannot be null while we have listeners, which is - * most of the time. The root is cached so we can disengage - * from it when it has been swapped out. - */ - private TreeNodeValueModel root; - - /** - * Map the nodes to their lists of children. - * We cache these so we can swap out the entire list of children - * when we receive a #listChanged() event (which does not include - * the items that were affected). - * @see EventChangePolicy#rebuildChildren() - */ - final IdentityHashMap, List>> childrenLists; - - /** - * Map the children models to their parents. - * We cache these so we can figure out the "real" source of the - * list change events (the parent). - * @see EventChangePolicy#parent() - */ - final IdentityHashMap>, TreeNodeValueModel> parents; - - - // ********** constructors ********** - - /** - * Construct a tree model for the specified root. - */ - public TreeModelAdapter(PropertyValueModel> rootHolder) { - super(); - if (rootHolder == null) { - throw new NullPointerException(); - } - this.rootHolder = rootHolder; - this.rootListener = this.buildRootListener(); - this.nodeStateListener = this.buildNodeStateListener(); - this.nodeValueListener = this.buildNodeValueListener(); - this.childrenListener = this.buildChildrenListener(); - this.childrenLists = new IdentityHashMap, List>>(); - this.parents = new IdentityHashMap>, TreeNodeValueModel>(); - } - - /** - * Construct a tree model for the specified root. - */ - public TreeModelAdapter(TreeNodeValueModel root) { - this(new StaticPropertyValueModel>(root)); - } - - - // ********** initialization ********** - - protected PropertyChangeListener buildRootListener() { - return new AWTPropertyChangeListenerWrapper(this.buildRootListener_()); - } - - protected PropertyChangeListener buildRootListener_() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - TreeModelAdapter.this.rootChanged(); - } - @Override - public String toString() { - return "root listener"; //$NON-NLS-1$ - } - }; - } - - protected PropertyChangeListener buildNodeValueListener() { - return new AWTPropertyChangeListenerWrapper(this.buildNodeValueListener_()); - } - - protected PropertyChangeListener buildNodeValueListener_() { - return new PropertyChangeListener() { - @SuppressWarnings("unchecked") - public void propertyChanged(PropertyChangeEvent event) { - TreeModelAdapter.this.nodeChanged((TreeNodeValueModel) event.getSource()); - } - @Override - public String toString() { - return "node value listener"; //$NON-NLS-1$ - } - }; - } - - protected StateChangeListener buildNodeStateListener() { - return new AWTStateChangeListenerWrapper(this.buildNodeStateListener_()); - } - - protected StateChangeListener buildNodeStateListener_() { - return new StateChangeListener() { - @SuppressWarnings("unchecked") - public void stateChanged(StateChangeEvent event) { - TreeModelAdapter.this.nodeChanged((TreeNodeValueModel) event.getSource()); - } - @Override - public String toString() { - return "node state listener"; //$NON-NLS-1$ - } - }; - } - - protected ListChangeListener buildChildrenListener() { - return new AWTListChangeListenerWrapper(this.buildChildrenListener_()); - } - - protected ListChangeListener buildChildrenListener_() { - return new ListChangeListener() { - public void itemsAdded(ListAddEvent event) { - new AddEventChangePolicy(event).addChildren(); - } - public void itemsRemoved(ListRemoveEvent event) { - new RemoveEventChangePolicy(event).removeChildren(); - } - public void itemsReplaced(ListReplaceEvent event) { - new ReplaceEventChangePolicy(event).replaceChildren(); - } - public void itemsMoved(ListMoveEvent event) { - new MoveEventChangePolicy(event).moveChildren(); - } - public void listCleared(ListClearEvent event) { - new ClearEventChangePolicy(event).clearChildren(); - } - public void listChanged(ListChangeEvent event) { - new ChangeEventChangePolicy(event).rebuildChildren(); - } - @Override - public String toString() { - return "children listener"; //$NON-NLS-1$ - } - }; - } - - - // ********** TreeModel implementation ********** - - public Object getRoot() { - return this.root; - } - - @SuppressWarnings("unchecked") - public Object getChild(Object parent, int index) { - return ((TreeNodeValueModel) parent).child(index); - } - - @SuppressWarnings("unchecked") - public int getChildCount(Object parent) { - return ((TreeNodeValueModel) parent).childrenSize(); - } - - @SuppressWarnings("unchecked") - public boolean isLeaf(Object node) { - return ((TreeNodeValueModel) node).isLeaf(); - } - - @SuppressWarnings("unchecked") - public void valueForPathChanged(TreePath path, Object newValue) { - ((TreeNodeValueModel) path.getLastPathComponent()).setValue((T) newValue); - } - - @SuppressWarnings("unchecked") - public int getIndexOfChild(Object parent, Object child) { - return ((TreeNodeValueModel) parent).indexOfChild((TreeNodeValueModel) child); - } - - /** - * Extend to start listening to the underlying model if necessary. - */ - @Override - public void addTreeModelListener(TreeModelListener l) { - if (this.hasNoTreeModelListeners()) { - this.engageModel(); - } - super.addTreeModelListener(l); - } - - /** - * Extend to stop listening to the underlying model if appropriate. - */ - @Override - public void removeTreeModelListener(TreeModelListener l) { - super.removeTreeModelListener(l); - if (this.hasNoTreeModelListeners()) { - this.disengageModel(); - } - } - - - // ********** behavior ********** - - /** - * Listen to the root and all the other nodes - * in the underlying tree model. - */ - private void engageModel() { - this.rootHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.rootListener); - this.root = this.rootHolder.getValue(); - if (this.root == null) { - throw new NullPointerException(); // the root cannot be null while we have listeners - } - this.engageNode(this.root); - this.addRoot(); - } - - /** - * Add the root and all of the nodes to the underlying tree. - */ - private void addRoot() { - this.addNode(0, this.root); - } - - /** - * Stop listening to the root and all the other - * nodes in the underlying tree model. - */ - private void disengageModel() { - this.removeRoot(); - this.disengageNode(this.root); - this.root = null; - this.rootHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.rootListener); - } - - /** - * Remove the root and all of the nodes from the underlying tree. - */ - private void removeRoot() { - this.removeNode(0, this.root); - } - - /** - * The root has been swapped. - * This method is a bit gnarly because the API for notifying listeners - * that the root has changed is a bit inconsistent with that used for - * non-root nodes. - */ - void rootChanged() { - TreeNodeValueModel newRoot = this.rootHolder.getValue(); - if (newRoot == null) { - throw new NullPointerException(); // the root cannot be null while we have listeners - } - // remove all the current root's children from the tree - // and remove the it from the internal tree - this.removeRoot(); - - // save the old root and swap in the new root - TreeNodeValueModel oldRoot = this.root; - this.root = newRoot; - - // we must be listening to both the old and new roots when we fire the event - // because their values can be affected by whether they have listeners - this.engageNode(this.root); - this.fireTreeRootReplaced(this.root); - // now we can stop listening to the old root - this.disengageNode(oldRoot); - - // add the new root to the internal tree and - // add all its children to the tree also - this.addRoot(); - } - - /** - * Either the "value" or the "state" of the specified node has changed, - * forward notification to our listeners. - */ - void nodeChanged(TreeNodeValueModel node) { - TreeNodeValueModel parent = node.parent(); - if (parent == null) { - this.fireTreeRootChanged(node); - } else { - this.fireTreeNodeChanged(parent.path(), parent.indexOfChild(node), node); - } - } - - /** - * Listen to the nodes, notify our listeners that the nodes were added, - * and then add the nodes to our internal tree. - * We must listen to the nodes before notifying anybody, because - * adding a listener can change the value of a node. - */ - void addChildren(TreeNodeValueModel[] path, int[] childIndices, TreeNodeValueModel[] children) { - int len = childIndices.length; - for (int i = 0; i < len; i++) { - this.engageNode(children[i]); - } - this.fireTreeNodesInserted(path, childIndices, children); - for (int i = 0; i < len; i++) { - this.addNode(childIndices[i], children[i]); - } - } - - /** - * Listen to the node and its children model. - */ - private void engageNode(TreeNodeValueModel node) { - node.addStateChangeListener(this.nodeStateListener); - node.addPropertyChangeListener(PropertyValueModel.VALUE, this.nodeValueListener); - node.childrenModel().addListChangeListener(ListValueModel.LIST_VALUES, this.childrenListener); - } - - /** - * Add the node to our internal tree; - * then recurse down through the node's children, - * adding them to the internal tree also. - */ - private void addNode(int index, TreeNodeValueModel node) { - this.addNodeToInternalTree(node.parent(), index, node, node.childrenModel()); - new NodeChangePolicy(node).addChildren(); - } - - /** - * Add the specified node to our internal tree. - */ - private void addNodeToInternalTree(TreeNodeValueModel parent, int index, TreeNodeValueModel node, ListValueModel> childrenModel) { - List> siblings = this.childrenLists.get(parent); - if (siblings == null) { - siblings = new ArrayList>(); - this.childrenLists.put(parent, siblings); - } - siblings.add(index, node); - - this.parents.put(childrenModel, node); - } - - /** - * Remove nodes from our internal tree, notify our listeners that the - * nodes were removed, then stop listening to the nodes. - * We must listen to the nodes until after notifying anybody, because - * removing a listener can change the value of a node. - */ - void removeChildren(TreeNodeValueModel[] path, int[] childIndices, TreeNodeValueModel[] children) { - int len = childIndices.length; - for (int i = 0; i < len; i++) { - // the indices slide down a notch each time we remove a child - this.removeNode(childIndices[i] - i, children[i]); - } - this.fireTreeNodesRemoved(path, childIndices, children); - for (int i = 0; i < len; i++) { - this.disengageNode(children[i]); - } - } - - /** - * First, recurse down through the node's children, - * removing them from our internal tree; - * then remove the node itself from our internal tree. - */ - private void removeNode(int index, TreeNodeValueModel node) { - new NodeChangePolicy(node).removeChildren(); - this.removeNodeFromInternalTree(node.parent(), index, node.childrenModel()); - } - - /** - * Remove the specified node from our internal tree. - */ - private void removeNodeFromInternalTree(TreeNodeValueModel parent, int index, ListValueModel> childrenModel) { - this.parents.remove(childrenModel); - - List> siblings = this.childrenLists.get(parent); - siblings.remove(index); - if (siblings.isEmpty()) { - this.childrenLists.remove(parent); - } - } - - /** - * Stop listening to the node and its children model. - */ - private void disengageNode(TreeNodeValueModel node) { - node.childrenModel().removeListChangeListener(ListValueModel.LIST_VALUES, this.childrenListener); - node.removePropertyChangeListener(PropertyValueModel.VALUE, this.nodeValueListener); - node.removeStateChangeListener(this.nodeStateListener); - } - - void moveChildren(TreeNodeValueModel parent, int targetIndex, int sourceIndex, int length) { - List> childrenList = this.childrenLists.get(parent); - ArrayList> temp = new ArrayList>(length); - for (int i = 0; i < length; i++) { - temp.add(childrenList.remove(sourceIndex)); - } - childrenList.addAll(targetIndex, temp); - - this.fireTreeStructureChanged(parent.path()); - } - - - // ********** standard methods ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.root); - } - - - // ********** inner classes ********** - - /** - * Coalesce some of the common change policy behavior. - */ - abstract class ChangePolicy { - - ChangePolicy() { - super(); - } - - /** - * Add the current set of children. - */ - void addChildren() { - TreeModelAdapter.this.addChildren(this.parent().path(), this.childIndices(), this.childArray()); - } - - /** - * Remove the current set of children. - */ - void removeChildren() { - TreeModelAdapter.this.removeChildren(this.parent().path(), this.childIndices(), this.childArray()); - } - - /** - * Return an array of the indices of the current set of children, - * which should be contiguous. - */ - int[] childIndices() { - return this.buildIndices(this.childrenStartIndex(), this.childrenSize()); - } - - /** - * Return an array of the current set of children. - */ - TreeNodeValueModel[] childArray() { - return this.buildArray(this.getChildren(), this.childrenSize()); - } - - /** - * Build an array to hold the elements in the specified iterator. - * If they are different sizes, something is screwed up... - */ - TreeNodeValueModel[] buildArray(Iterable> elements, int size) { - @SuppressWarnings("unchecked") - TreeNodeValueModel[] array = new TreeNodeValueModel[size]; - int i = 0; - for (TreeNodeValueModel element : elements) { - array[i++] = element; - } - return array; - } - - /** - * Return a set of indices, starting at zero and - * continuing for the specified size. - */ - int[] buildIndices(int size) { - return buildIndices(0, size); - } - - /** - * Return a set of indices, starting at the specified index and - * continuing for the specified size. - */ - int[] buildIndices(int start, int size) { - int[] indices = new int[size]; - int index = start; - for (int i = 0; i < size; i++) { - indices[i] = index++; - } - return indices; - } - - /** - * Return the parent of the current set of children. - */ - abstract TreeNodeValueModel parent(); - - /** - * Return the starting index for the current set of children. - */ - abstract int childrenStartIndex(); - - /** - * Return the size of the current set of children. - */ - abstract int childrenSize(); - - /** - * Return the current set of children. - */ - abstract Iterable> getChildren(); - - } - - - /** - * Wraps a ListEvent for adding, removing, replacing, - * and changing children. - */ - abstract class EventChangePolicy extends ChangePolicy { - final ListEvent event; - - EventChangePolicy(ListEvent event) { - super(); - this.event = event; - } - - /** - * Map the ListChangeEvent's source to the corresponding parent. - */ - @Override - TreeNodeValueModel parent() { - return TreeModelAdapter.this.parents.get(this.event.getSource()); - } - - } - - - /** - * Wraps a ListAddEvent for adding children. - */ - class AddEventChangePolicy extends EventChangePolicy { - - AddEventChangePolicy(ListAddEvent event) { - super(event); - } - - private ListAddEvent getEvent() { - return (ListAddEvent) this.event; - } - - /** - * The ListAddEvent's item index is the children start index. - */ - @Override - int childrenStartIndex() { - return this.getEvent().getIndex(); - } - - /** - * The ListAddEvent's size is the children size. - */ - @Override - int childrenSize() { - return this.getEvent().getItemsSize(); - } - - /** - * The ListAddEvent's items are the children. - */ - @Override - @SuppressWarnings("unchecked") - Iterable> getChildren() { - return (Iterable>) this.getEvent().getItems(); - } - - } - - - /** - * Wraps a ListRemoveEvent for adding children. - */ - class RemoveEventChangePolicy extends EventChangePolicy { - - RemoveEventChangePolicy(ListRemoveEvent event) { - super(event); - } - - private ListRemoveEvent getEvent() { - return (ListRemoveEvent) this.event; - } - - /** - * The ListRemoveEvent's item index is the children start index. - */ - @Override - int childrenStartIndex() { - return this.getEvent().getIndex(); - } - - /** - * The ListRemoveEvent's size is the children size. - */ - @Override - int childrenSize() { - return this.getEvent().getItemsSize(); - } - - /** - * The ListRemoveEvent's items are the children. - */ - @Override - @SuppressWarnings("unchecked") - Iterable> getChildren() { - return (Iterable>) this.getEvent().getItems(); - } - - } - - - /** - * Wraps a ListReplaceEvent for replacing children. - */ - class ReplaceEventChangePolicy extends EventChangePolicy { - - ReplaceEventChangePolicy(ListReplaceEvent event) { - super(event); - } - - private ListReplaceEvent getEvent() { - return (ListReplaceEvent) this.event; - } - - /** - * The ListReplaceEvent's item index is the children start index. - */ - @Override - int childrenStartIndex() { - return this.getEvent().getIndex(); - } - - /** - * The ListReplaceEvent's size is the children size. - */ - @Override - int childrenSize() { - return this.getEvent().getItemsSize(); - } - - /** - * The ListReplaceEvent's items are the children. - */ - @Override - @SuppressWarnings("unchecked") - Iterable> getChildren() { - return (Iterable>) this.getEvent().getNewItems(); - } - - /** - * Remove the old nodes and add the new ones. - */ - void replaceChildren() { - TreeNodeValueModel[] parentPath = this.parent().path(); - int[] childIndices = this.childIndices(); - TreeModelAdapter.this.removeChildren(parentPath, childIndices, this.getOldChildren()); - TreeModelAdapter.this.addChildren(parentPath, childIndices, this.childArray()); - } - - TreeNodeValueModel[] getOldChildren() { - return this.buildArray(this.getOldItems(), this.getEvent().getItemsSize()); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - protected Iterable> getOldItems() { - return (Iterable>) this.getEvent().getOldItems(); - } - - } - - - /** - * Wraps a ListMoveEvent for moving children. - */ - class MoveEventChangePolicy extends EventChangePolicy { - - MoveEventChangePolicy(ListMoveEvent event) { - super(event); - } - - private ListMoveEvent getEvent() { - return (ListMoveEvent) this.event; - } - - void moveChildren() { - TreeModelAdapter.this.moveChildren(this.parent(), this.getEvent().getTargetIndex(), this.getEvent().getSourceIndex(), this.getEvent().getLength()); - } - - @Override - int childrenStartIndex() { - throw new UnsupportedOperationException(); - } - - @Override - int childrenSize() { - throw new UnsupportedOperationException(); - } - - @Override - Iterable> getChildren() { - throw new UnsupportedOperationException(); - } - - } - - - /** - * Wraps a ListClearEvent for clearing children. - */ - class ClearEventChangePolicy extends EventChangePolicy { - - ClearEventChangePolicy(ListClearEvent event) { - super(event); - } - - /** - * Clear all the nodes. - */ - void clearChildren() { - TreeNodeValueModel parent = this.parent(); - TreeNodeValueModel[] parentPath = parent.path(); - List> childrenList = TreeModelAdapter.this.childrenLists.get(parent); - int[] childIndices = this.buildIndices(childrenList.size()); - TreeNodeValueModel[] childArray = this.buildArray(childrenList, childrenList.size()); - TreeModelAdapter.this.removeChildren(parentPath, childIndices, childArray); - } - - @Override - int childrenStartIndex() { - throw new UnsupportedOperationException(); - } - - @Override - int childrenSize() { - throw new UnsupportedOperationException(); - } - - @Override - Iterable> getChildren() { - throw new UnsupportedOperationException(); - } - - } - - - /** - * Wraps a ListChangeEvent for clearing children. - */ - class ChangeEventChangePolicy extends EventChangePolicy { - - ChangeEventChangePolicy(ListChangeEvent event) { - super(event); - } - - /** - * Remove all the old nodes and add all the new nodes. - */ - void rebuildChildren() { - TreeNodeValueModel parent = this.parent(); - TreeNodeValueModel[] parentPath = parent.path(); - List> childrenList = TreeModelAdapter.this.childrenLists.get(parent); - int[] childIndices = this.buildIndices(childrenList.size()); - TreeNodeValueModel[] childArray = this.buildArray(childrenList, childrenList.size()); - TreeModelAdapter.this.removeChildren(parentPath, childIndices, childArray); - - childIndices = this.buildIndices(parent.childrenModel().size()); - childArray = this.buildArray(parent.childrenModel(), parent.childrenSize()); - TreeModelAdapter.this.addChildren(parentPath, childIndices, childArray); - } - - @Override - int childrenStartIndex() { - throw new UnsupportedOperationException(); - } - - @Override - int childrenSize() { - throw new UnsupportedOperationException(); - } - - @Override - Iterable> getChildren() { - throw new UnsupportedOperationException(); - } - - } - - - /** - * Wraps a TreeNodeValueModel for adding and removing its children. - */ - class NodeChangePolicy extends ChangePolicy { - private final TreeNodeValueModel node; - - NodeChangePolicy(TreeNodeValueModel node) { - super(); - this.node = node; - } - - /** - * The node itself is the parent. - */ - @Override - TreeNodeValueModel parent() { - return this.node; - } - - /** - * Since we will always be dealing with all of the node's - * children, the children start index is always zero. - */ - @Override - int childrenStartIndex() { - return 0; - } - - /** - * Since we will always be dealing with all of the node's - * children, the children size is always equal to the size - * of the children model. - */ - @Override - int childrenSize() { - return this.node.childrenModel().size(); - } - - /** - * Since we will always be dealing with all of the node's - * children, the children are all the objects held by - * the children model. - */ - @Override - Iterable> getChildren() { - return this.node.childrenModel(); - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/AbstractNode.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/AbstractNode.java deleted file mode 100644 index 3f32a57bfd..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/AbstractNode.java +++ /dev/null @@ -1,941 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.node; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Set; -import java.util.Vector; - -import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.AspectChangeSupport; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; - -/** - * Base class for Node classes. - * Provides support for the following: - * initialization - * enforced object identity wrt #equals()/#hashCode() - * containment hierarchy (parent/child) - * user comment - * dirty flag - * problems - * sorting - * - * Typically, subclasses should consider implementing the following methods: - * the appropriate constructors - * (with the appropriately-restrictive type declaration for parent) - * #initialize() - * #initialize(Node parentNode) - * #checkParent(Node parentNode) - * #addChildrenTo(List list) - * #nodeRemoved(Node) - * #validator() - * #transientAspectNames() or - * #addTransientAspectNamesTo(Set transientAspectNames) - * #addProblemsTo(List currentProblems) - * #nonValidatedAspectNames() - * #addNonValidatedAspectNamesTo(Set nonValidatedAspectNames) - * #displayString() - * #toString(StringBuilder sb) - */ -public abstract class AbstractNode - extends AbstractModel - implements Node -{ - - /** Containment hierarchy. */ - private Node parent; // pseudo-final - - /** Track whether the node has changed. */ - private volatile boolean dirty; - private volatile boolean dirtyBranch; - - /** - * The node's problems, as calculated during validation. - * This list should only be modified via a ProblemSynchronizer, - * allowing for asynchronous modification from another thread. - */ - private Vector problems; // pseudo-final - private static final Object[] EMPTY_PROBLEM_MESSAGE_ARGUMENTS = new Object[0]; - - /** - * Cache the node's "branch" problems, as calculated during validation. - * This list should only be modified via a ProblemSynchronizer, - * allowing for asynchronous modification from another thread. - * This must be recalculated every time this node or one of its - * descendants changes it problems. - */ - private Vector branchProblems; // pseudo-final - - /** User comment. */ - private volatile String comment; - - - // ********** static fields ********** - - /** - * Sets of transient aspect names, keyed by class. - * This is built up lazily, as the objects are modified. - */ - private static final HashMap, HashSet> transientAspectNameSets = new HashMap, HashSet>(); - - /** - * Sets of non-validated aspect names, keyed by class. - * This is built up lazily, as the objects are modified. - */ - private static final HashMap, HashSet> nonValidatedAspectNameSets = new HashMap, HashSet>(); - - - // ********** constructors ********** - - /** - * Most objects must have a parent. - * Use this constructor to create a new node. - * @see #initialize(Node) - */ - protected AbstractNode(Node parent) { - super(); - this.initialize(); - this.initialize(parent); - } - - - // ********** initialization ********** - - /** - * Initialize a newly-created instance. - * @see #initialize(Node) - */ - protected void initialize() { - this.comment = ""; //$NON-NLS-1$ - - // a new object is dirty, by definition - this.dirty = true; - this.dirtyBranch = true; - - this.problems = new Vector(); - this.branchProblems = new Vector(); - - // when you override this method, don't forget to include: - // super.initialize(); - } - - /** - * Initialize a newly-created instance. - * @see #initialize() - */ - protected void initialize(Node parentNode) { - this.checkParent(parentNode); - this.parent = parentNode; - // when you override this method, don't forget to include: - // super.initialize(parentNode); - } - - @Override - protected ChangeSupport buildChangeSupport() { - return new AspectChangeSupport(this, this.buildChangeSupportListener()); - } - - protected AspectChangeSupport.Listener buildChangeSupportListener() { - return new AspectChangeSupport.Listener() { - public void aspectChanged(String aspectName) { - AbstractNode.this.aspectChanged(aspectName); - } - }; - } - - - // ********** equality ********** - - /** - * Enforce object identity - do not allow objects to be equal unless - * they are the same object. - * Do NOT override this method - we rely on object identity extensively. - */ - @Override - public final boolean equals(Object o) { - return this == o; - } - - /** - * Enforce object identity - do not allow objects to be equal unless - * they are the same object. - * Do NOT override this method - we rely on object identity extensively. - */ - @Override - public final int hashCode() { - return super.hashCode(); - } - - - // ********** containment hierarchy (parent/children) ********** - - /** - * INTRA-TREE API? - * Return the node's parent in the containment hierarchy. - * Most nodes must have a parent. - * @see #children() - */ - public Node getParent() { - return this.parent; - } - - /** - * Throw an IllegalArgumentException if the parent is not valid - * for the node. - * By default require a non-null parent. Override if other restrictions exist - * or the parent should be null. - * NB: Root node model implementations will need to override this method. - */ - protected void checkParent(Node parentNode) { - if (parentNode == null) { - throw new IllegalArgumentException("The parent node cannot be null"); //$NON-NLS-1$ - } - } - - /** - * INTRA-TREE API? - * Return the node's children, which are also nodes. - * Do NOT override this method. - * Override #addChildrenTo(List). - * @see #getParent() - * @see #addChildrenTo(java.util.List) - */ - public final Iterator children() { - List children = new ArrayList(); - this.addChildrenTo(children); - return children.iterator(); - } - - /** - * Subclasses should override this method to add their children - * to the specified list. - * @see #children() - */ - protected void addChildrenTo(@SuppressWarnings("unused") List list) { - // this class has no children, subclasses will... - // when you override this method, don't forget to include: - // super.addChildrenTo(list); - } - - /** - * INTRA-TREE API? - * Return the containment hierarchy's root node. - * Most nodes must have a root. - * @see #getParent() - * NB: Assume the root has no parent. - */ - public Node root() { - Node p = this.parent; - return (p == null) ? this : p.root(); - } - - /** - * Return whether the node is a descendant of the specified node. - * By definition, a node is a descendant of itself. - */ - public boolean isDescendantOf(Node node) { - return (this == node) || this.parentIsDescendantOf(node); - } - - protected boolean parentIsDescendantOf(Node node) { - return (this.parent != null) && this.parent.isDescendantOf(node); - } - - /** - * Return a collection holding all the node's "references", and all - * the node's descendants' "references". "References" are - * objects that are "referenced" by another object, as opposed - * to "owned" by another object. - */ - public Iterator branchReferences() { - Collection branchReferences = new ArrayList(1000); // start big - this.addBranchReferencesTo(branchReferences); - return branchReferences.iterator(); - } - - /** - * INTRA-TREE API - * Add the node's "references", and all the node's descendants' - * "references", to the specified collection. "References" are - * objects that are "referenced" by another object, as opposed - * to "owned" by another object. - * This method is of particular concern to Handles, since most - * (hopefully all) "references" are held by Handles. - * @see Reference - * @see #children() - */ - public void addBranchReferencesTo(Collection branchReferences) { - for (Iterator stream = this.children(); stream.hasNext(); ) { - Node child = stream.next(); // pull out the child to ease debugging - child.addBranchReferencesTo(branchReferences); - } - } - - /** - * Return all the nodes in the object's branch of the tree, - * including the node itself. The nodes will probably returned - * in "depth-first" order. - * Only really used for testing and debugging. - */ - public Iterator allNodes() { - Collection nodes = new ArrayList(1000); // start big - this.addAllNodesTo(nodes); - return nodes.iterator(); - } - - /** - * INTRA-TREE API? - * Add all the nodes in the object's branch of the tree, - * including the node itself, to the specified collection. - * Only really used for testing and debugging. - */ - public void addAllNodesTo(Collection nodes) { - nodes.add(this); - for (Iterator stream = this.children(); stream.hasNext(); ) { - Node child = stream.next(); // pull out the child to ease debugging - child.addAllNodesTo(nodes); - } - } - - - // ********** model synchronization support ********** - - /** - * INTRA-TREE API - * This is a general notification that the specified node has been - * removed from the tree. The node receiving this notification - * should perform any necessary updates to remain in synch - * with the tree (e.g. clearing out or replacing any references - * to the removed node or any of the removed node's descendants). - * @see #isDescendantOf(Node) - */ - public void nodeRemoved(Node node) { - for (Iterator stream = this.children(); stream.hasNext(); ) { - Node child = stream.next(); // pull out the child to ease debugging - child.nodeRemoved(node); - } - // when you override this method, don't forget to include: - // super.nodeRemoved(node); - } - - /** - * convenience method - * return whether node1 is a descendant of node2; - * node1 can be null - */ - protected boolean nodeIsDescendantOf(Node node1, Node node2) { - return (node1 != null) && node1.isDescendantOf(node2); - } - - /** - * INTRA-TREE API - * This is a general notification that the specified node has been - * renamed. The node receiving this notification should mark its - * branch dirty if necessary (i.e. it references the renamed node - * or one of its descendants). This method is of particular concern - * to Handles. - * @see #isDescendantOf(Node) - */ - public void nodeRenamed(Node node) { - for (Iterator stream = this.children(); stream.hasNext(); ) { - Node child = stream.next(); // pull out the child to ease debugging - child.nodeRenamed(node); - } - // when you override this method, don't forget to include: - // super.nodeRenamed(node); - } - - - // ********** user comment ********** - - /** - * Return the object's user comment. - */ - public final String comment() { - return this.comment; - } - - /** - * Set the object's user comment. - */ - public final void setComment(String comment) { - Object old = this.comment; - this.comment = comment; - this.firePropertyChanged(COMMENT_PROPERTY, old, comment); - } - - - // ********** change support ********** - - /** - * An aspect of the node has changed: - * - if it is a persistent aspect, mark the object dirty - * - if it is a significant aspect, validate the object - */ - protected void aspectChanged(String aspectName) { - if (this.aspectIsPersistent(aspectName)) { - // System.out.println(Thread.currentThread() + " dirty change: " + this + ": " + aspectName); - this.markDirty(); - } - if (this.aspectChangeRequiresValidation(aspectName)) { - // System.out.println(Thread.currentThread() + " validation change: " + this + ": " + aspectName); - this.validate(); - } - } - - protected void validate() { - this.getValidator().validate(); - } - - /** - * INTRA-TREE API - * Return a validator that will be invoked whenever a - * "validated" aspect of the node tree changes. - * Typically only the root node directly holds a validator. - * NB: Root node model implementations will need to override this method. - */ - public Node.Validator getValidator() { - if (this.parent == null) { - throw new IllegalStateException("This node should not be firing change events during its construction."); //$NON-NLS-1$ - } - return this.parent.getValidator(); - } - - /** - * Set a validator that will be invoked whenever a - * "validated" aspect of the node tree changes. - * Typically only the root node directly holds a validator. - * NB: Root node model implementations will need to override this method. - */ - public void setValidator(Node.Validator validator) { - if (this.parent == null) { - throw new IllegalStateException("This root node should implement #setValidator(Node.Validator)."); //$NON-NLS-1$ - } - throw new UnsupportedOperationException("Only root nodes implement #setValidator(Node.Validator)."); //$NON-NLS-1$ - } - - - // ********** dirty flag support ********** - - /** - * Return whether any persistent aspects of the object - * have changed since the object was last read or saved. - * This does NOT include changes to the object's descendants. - */ - public final boolean isDirty() { - return this.dirty; - } - - /** - * Return whether any persistent aspects of the object, - * or any of its descendants, have changed since the object and - * its descendants were last read or saved. - */ - public final boolean isDirtyBranch() { - return this.dirtyBranch; - } - - /** - * Return whether the object is unmodified - * since it was last read or saved. - * This does NOT include changes to the object's descendants. - */ - public final boolean isClean() { - return ! this.dirty; - } - - /** - * Return whether the object and all of its descendants - * are unmodified since the object and - * its descendants were last read or saved. - */ - public final boolean isCleanBranch() { - return ! this.dirtyBranch; - } - - /** - * Set the dirty branch flag setting. This is set to true - * when either the object or one of its descendants becomes dirty. - */ - private void setIsDirtyBranch(boolean dirtyBranch) { - boolean old = this.dirtyBranch; - this.dirtyBranch = dirtyBranch; - this.firePropertyChanged(DIRTY_BRANCH_PROPERTY, old, dirtyBranch); - } - - /** - * Mark the object as dirty and as a dirty branch. - * An object is marked dirty when either a "persistent" attribute - * has changed or its save location has changed. - */ - private void markDirty() { - this.dirty = true; - this.markBranchDirty(); - } - - /** - * INTRA-TREE API - * Mark the node and its parent as dirty branches. - * This message is propagated up the containment - * tree when a particular node becomes dirty. - */ - public void markBranchDirty() { - // short-circuit any unnecessary propagation - if (this.dirtyBranch) { - // if this is already a dirty branch, the parent must be also - return; - } - - this.setIsDirtyBranch(true); - this.markParentBranchDirty(); - } - - protected void markParentBranchDirty() { - if (this.parent != null) { - this.parent.markBranchDirty(); - } - } - - /** - * Mark the object and all its descendants as dirty. - * This is used when the save location of some - * top-level object is changed and the entire - * containment tree must be marked dirty so it - * will be written out. - */ - public final void markEntireBranchDirty() { - this.markDirty(); - for (Iterator stream = this.children(); stream.hasNext(); ) { - Node child = stream.next(); // pull out the child to ease debugging - child.markEntireBranchDirty(); - } - } - - /** - * Mark the object and all its descendants as clean. - * Then notify the object's parent that it (the parent) - * might now be a clean branch also. - * Typically used when the object has just been - * read in or written out. - */ - public final void markEntireBranchClean() { - this.cascadeMarkEntireBranchClean(); - this.markParentBranchCleanIfPossible(); - } - - protected void markParentBranchCleanIfPossible() { - if (this.parent != null) { - this.parent.markBranchCleanIfPossible(); - } - } - - /** - * INTRA-TREE API - * Mark the node and all its descendants as clean. - * Typically used when the node has just been - * read in or written out. - * This method is for internal use only; it is not for - * client use. - * Not the best of method names.... :-( - */ - public final void cascadeMarkEntireBranchClean() { - for (Iterator stream = this.children(); stream.hasNext(); ) { - Node child = stream.next(); // pull out the child to ease debugging - child.cascadeMarkEntireBranchClean(); - } - this.dirty = false; - this.setIsDirtyBranch(false); - } - - /** - * INTRA-TREE API - * A child node's branch has been marked clean. If the node - * itself is clean and if all of its children are also clean, the - * node's branch can be marked clean. Then, if the node's - * branch is clean, the node will notify its parent that it might - * be clean also. This message is propagated up the containment - * tree when a particular node becomes clean. - */ - public final void markBranchCleanIfPossible() { - // short-circuit any unnecessary propagation - if (this.dirty) { - // if the object is "locally" dirty, it is still a dirty branch - return; - } - - for (Iterator stream = this.children(); stream.hasNext(); ) { - Node child = stream.next(); // pull out the child to ease debugging - if (child.isDirtyBranch()) { - return; - } - } - - this.setIsDirtyBranch(false); - this.markParentBranchCleanIfPossible(); - } - - private boolean aspectIsPersistent(String aspectName) { - return ! this.aspectIsTransient(aspectName); - } - - private boolean aspectIsTransient(String aspectName) { - return this.transientAspectNames().contains(aspectName); - } - - /** - * Return a set of the object's transient aspect names. - * These are the aspects that, when they change, will NOT cause the - * object to be marked dirty. - * If you need instance-based calculation of your transient aspects, - * override this method. If class-based calculation is sufficient, - * override #addTransientAspectNamesTo(Set). - */ - protected final Set transientAspectNames() { - synchronized (transientAspectNameSets) { - HashSet transientAspectNames = transientAspectNameSets.get(this.getClass()); - if (transientAspectNames == null) { - transientAspectNames = new HashSet(); - this.addTransientAspectNamesTo(transientAspectNames); - transientAspectNameSets.put(this.getClass(), transientAspectNames); - } - return transientAspectNames; - } - } - - /** - * Add the object's transient aspect names to the specified set. - * These are the aspects that, when they change, will NOT cause the - * object to be marked dirty. - * If class-based calculation of your transient aspects is sufficient, - * override this method. If you need instance-based calculation, - * override #transientAspectNames(). - */ - protected void addTransientAspectNamesTo(Set transientAspectNames) { - transientAspectNames.add(DIRTY_BRANCH_PROPERTY); - transientAspectNames.add(BRANCH_PROBLEMS_LIST); - transientAspectNames.add(HAS_BRANCH_PROBLEMS_PROPERTY); - // when you override this method, don't forget to include: - // super.addTransientAspectNamesTo(transientAspectNames); - } - - /** - * Return the dirty nodes in the object's branch of the tree, - * including the node itself (if appropriate). - * Only really used for testing and debugging. - */ - public final Iterator allDirtyNodes() { - return new FilteringIterator(this.allNodes()) { - @Override - protected boolean accept(Node node) { - return (node instanceof AbstractNode) && ((AbstractNode) node).isDirty(); - } - }; - } - - - // ********** problems ********** - - /** - * Return the node's problems. - * This does NOT include the problems of the node's descendants. - * @see #branchProblems() - */ - public final Iterator problems() { - return new CloneIterator(this.problems); // removes are not allowed - } - - /** - * Return the size of the node's problems. - * This does NOT include the problems of the node's descendants. - * @see #branchProblemsSize() - */ - public final int problemsSize() { - return this.problems.size(); - } - - /** - * Return whether the node has problems - * This does NOT include the problems of the node's descendants. - * @see #hasBranchProblems() - */ - public final boolean hasProblems() { - return ! this.problems.isEmpty(); - } - - /** - * Return all the node's problems along with all the - * node's descendants' problems. - */ - public final ListIterator branchProblems() { - return new CloneListIterator(this.branchProblems); // removes are not allowed - } - - /** - * Return the size of all the node's problems along with all the - * node's descendants' problems. - */ - public final int branchProblemsSize() { - return this.branchProblems.size(); - } - - /** - * Return whether the node or any of its descendants have problems. - */ - public final boolean hasBranchProblems() { - return ! this.branchProblems.isEmpty(); - } - - public final boolean containsBranchProblem(Problem problem) { - return this.branchProblems.contains(problem); - } - - protected final Problem buildProblem(String messageKey, int messageType, Object... messageArguments) { - return new DefaultProblem(this, messageKey, messageType, messageArguments); - } - - protected final Problem buildProblem(String messageKey, int messageType) { - return this.buildProblem(messageKey, messageType, EMPTY_PROBLEM_MESSAGE_ARGUMENTS); - } - - /** - * Validate the node and all of its descendants, - * and update their sets of "branch" problems. - * If the node's "branch" problems have changed, - * notify the node's parent. - */ - public void validateBranch() { - if (this.validateBranchInternal()) { - // if our "branch" problems have changed, then - // our parent must rebuild its "branch" problems also - this.rebuildParentBranchProblems(); - } - } - - protected void rebuildParentBranchProblems() { - if (this.parent != null) { - this.parent.rebuildBranchProblems(); - } - } - - /** - * INTRA-TREE API - * Validate the node and all of its descendants, - * and update their sets of "branch" problems. - * Return true if the collection of "branch" problems has changed. - * This method is for internal use only; it is not for - * client use. - */ - public boolean validateBranchInternal() { - // rebuild "branch" problems in children first - for (Iterator stream = this.children(); stream.hasNext(); ) { - Node child = stream.next(); // pull out the child to ease debugging - // ignore the return value because we are going to rebuild our "branch" - // problems no matter what, to see if they have changed - child.validateBranchInternal(); - } - - this.problems.clear(); - this.addProblemsTo(this.problems); - - return this.checkBranchProblems(); - } - - /** - * Check for any problems and add them to the specified list. - * This method should ONLY add problems for this particular node; - * it should NOT add problems for any of this node's descendants - * or ancestors. (Although there will be times when it is debatable - * as to which node a problem "belongs" to....) - * - * NB: This method should NOT modify ANY part of the node's state! - * It is a READ-ONLY behavior. ONLY the list of current problems - * passed in to the method should be modified. - */ - protected void addProblemsTo(@SuppressWarnings("unused") List currentProblems) { - // The default is to do nothing. - // When you override this method, don't forget to include: - // super.addProblemsTo(currentProblems); - } - - /** - * Rebuild the "branch" problems and return whether they have - * changed. - * NB: The entire collection of "branch" problems must be re-calculated - * with EVERY "significant" change - we cannot keep it in synch via - * change notifications because if a descendant with problems is - * removed or replaced we will not receive notification that its - * problems were removed from our "branch" problems. - */ - private boolean checkBranchProblems() { - Vector oldBranchProblems = new Vector(this.branchProblems); - int oldSize = this.branchProblems.size(); - - this.branchProblems.clear(); - this.branchProblems.addAll(this.problems); - for (Iterator stream = this.children(); stream.hasNext(); ) { - Node child = stream.next(); // pull out the child to ease debugging - child.addBranchProblemsTo(this.branchProblems); - } - - // if the size has changed to or from zero, our virtual flag has changed - int newSize = this.branchProblems.size(); - if ((oldSize == 0) && (newSize != 0)) { - this.firePropertyChanged(HAS_BRANCH_PROBLEMS_PROPERTY, false, true); - } else if ((oldSize != 0) && (newSize == 0)) { - this.firePropertyChanged(HAS_BRANCH_PROBLEMS_PROPERTY, true, false); - } - - if (oldBranchProblems.equals(this.branchProblems)) { - return false; // our "branch" problems did not change - } - // our "branch" problems changed - this.fireListChanged(BRANCH_PROBLEMS_LIST, this.branchProblems); - return true; - } - - /** - * INTRA-TREE API - * Add all the problems of the node and all - * the problems of its descendants to the - * specified collection. - */ - public final void addBranchProblemsTo(List list) { - list.addAll(this.branchProblems); - } - - /** - * INTRA-TREE API - * A child node's "branch" problems changed; - * therefore the node's "branch" problems have changed also and - * must be rebuilt. - */ - public final void rebuildBranchProblems() { - if ( ! this.checkBranchProblems()) { - throw new IllegalStateException("we should not get here unless our \"branch\" problems have changed"); //$NON-NLS-1$ - } - this.rebuildParentBranchProblems(); - } - - /** - * Clear the node's "branch" problems and the "branch" - * problems of all of its descendants. - * If the node's "branch" problems have changed, - * notify the node's parent. - */ - public final void clearAllBranchProblems() { - if (this.clearAllBranchProblemsInternal()) { - // if our "branch" problems have changed, then - // our parent must rebuild its "branch" problems also - this.rebuildParentBranchProblems(); - } - } - - /** - * INTRA-TREE API - * Clear the node's "branch" problems and the "branch" - * problems of all of its descendants. - * Return true if the collection of "branch" problems has changed. - * This method is for internal use only; it is not for - * client use. - */ - public final boolean clearAllBranchProblemsInternal() { - if (this.branchProblems.isEmpty()) { - return false; - } - for (Iterator stream = this.children(); stream.hasNext(); ) { - Node child = stream.next(); // pull out the child to ease debugging - // ignore the return value because we are going to clear our "branch" - // problems no matter what - child.clearAllBranchProblemsInternal(); - } - this.problems.clear(); - this.branchProblems.clear(); - this.firePropertyChanged(HAS_BRANCH_PROBLEMS_PROPERTY, true, false); - this.fireListChanged(BRANCH_PROBLEMS_LIST, this.branchProblems); - return true; - } - - /** - * Return whether a change to specified aspect requires a re-validation - * of the node's tree. - */ - private boolean aspectChangeRequiresValidation(String aspectName) { - return ! this.aspectChangeDoesNotRequireValidation(aspectName); - } - - private boolean aspectChangeDoesNotRequireValidation(String aspectName) { - return this.nonValidatedAspectNames().contains(aspectName); - } - - /** - * Return a set of the object's "non-validated" aspect names. - * These are the aspects that, when they change, will NOT cause the - * object (or its containing tree) to be validated, i.e. checked for problems. - * If you need instance-based calculation of your "non-validated" aspects, - * override this method. If class-based calculation is sufficient, - * override #addNonValidatedAspectNamesTo(Set). - */ - protected final Set nonValidatedAspectNames() { - synchronized (nonValidatedAspectNameSets) { - HashSet nonValidatedAspectNames = nonValidatedAspectNameSets.get(this.getClass()); - if (nonValidatedAspectNames == null) { - nonValidatedAspectNames = new HashSet(); - this.addNonValidatedAspectNamesTo(nonValidatedAspectNames); - nonValidatedAspectNameSets.put(this.getClass(), nonValidatedAspectNames); - } - return nonValidatedAspectNames; - } - } - - /** - * Add the object's "non-validated" aspect names to the specified set. - * These are the aspects that, when they change, will NOT cause the - * object (or its containing tree) to be validated, i.e. checked for problems. - * If class-based calculation of your "non-validated" aspects is sufficient, - * override this method. If you need instance-based calculation, - * override #nonValidatedAspectNames(). - */ - protected void addNonValidatedAspectNamesTo(Set nonValidatedAspectNames) { - nonValidatedAspectNames.add(COMMENT_PROPERTY); - nonValidatedAspectNames.add(DIRTY_BRANCH_PROPERTY); - nonValidatedAspectNames.add(BRANCH_PROBLEMS_LIST); - nonValidatedAspectNames.add(HAS_BRANCH_PROBLEMS_PROPERTY); - // when you override this method, don't forget to include: - // super.addNonValidatedAspectNamesTo(nonValidatedAspectNames); - } - - - // ********** display methods ********** - - /** - * Return a developer-friendly String. If you want something useful for - * displaying in a user interface, use #displayString(). - * If you want to give more information in your #toString(), - * override #toString(StringBuilder sb). - * Whatever you add to that string buffer will show up between the parentheses. - * @see AbstractModel#toString(StringBuilder sb) - * @see #displayString() - */ - @Override - public final String toString() { - return super.toString(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/AsynchronousValidator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/AsynchronousValidator.java deleted file mode 100644 index 88a06f1b08..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/AsynchronousValidator.java +++ /dev/null @@ -1,50 +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.common.utility.internal.node; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.SynchronizedBoolean; - -/** - * This implementation of the PluggableValidator.Delegate interface - * simply sets a shared "validate" flag to true. This should trigger a - * separate "validation" thread to begin validating the appropriate - * branch of nodes. - */ -public class AsynchronousValidator - implements PluggableValidator.Delegate -{ - private SynchronizedBoolean validateFlag; - - /** - * Construct a validator delegate with the specified shared - * "validate" flag. This flag should be shared with - * another thread that will perform the actual validation. - */ - public AsynchronousValidator(SynchronizedBoolean validateFlag) { - super(); - this.validateFlag = validateFlag; - } - - /** - * Set the shared "validate" flag to true, triggering - * an asynchronous validation of the appropriate - * branch of nodes. - */ - public void validate() { - this.validateFlag.setTrue(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.validateFlag); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/DefaultProblem.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/DefaultProblem.java deleted file mode 100644 index 6ba2f3a7ad..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/DefaultProblem.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.node; - -import java.util.Arrays; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * This class is a straightforward implementation of the Problem interface. - */ -public class DefaultProblem - implements Problem -{ - private final Node source; - private final String messageKey; - private final int messageType; - private final Object[] messageArguments; - - - DefaultProblem(Node source, String messageKey, int messageType, Object[] messageArguments) { - super(); - this.source = source; - this.messageKey = messageKey; - this.messageType = messageType; - this.messageArguments = messageArguments; - } - - - // ********** Problem implementation ********** - - public Node source() { - return this.source; - } - - public String messageKey() { - return this.messageKey; - } - - public int messageType() { - return this.messageType; - } - - public Object[] messageArguments() { - return this.messageArguments; - } - - - // ********** Object overrides ********** - - /** - * We implement #equals(Object) because problems are repeatedly - * re-calculated and the resulting problems merged with the existing - * set of problems; and we want to keep the original problems and - * ignore any freshly-generated duplicates. - * Also, problems are not saved to disk.... - */ - @Override - public boolean equals(Object o) { - if ( ! (o instanceof Problem)) { - return false; - } - Problem other = (Problem) o; - return this.source == other.source() - && this.messageKey.equals(other.messageKey()) - && Arrays.equals(this.messageArguments, other.messageArguments()); - } - - @Override - public int hashCode() { - return this.source.hashCode() ^ this.messageKey.hashCode(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.messageKey); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/Node.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/Node.java deleted file mode 100644 index 2eab200247..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/Node.java +++ /dev/null @@ -1,377 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.node; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * This interface defines the methods that must be implemented - * by any class whose instances are to be part of a containment hierarchy - * that supports a "dirty" state and validation "problems". - * - * Note: Methods marked "INTRA-TREE API" are typically only used by - * the nodes themselves, as opposed to clients of the nodes. These - * methods are called by a node on either its parent or its children. - */ -public interface Node extends Model { - - - // ********** containment hierarchy (parent/children) ********** - - /** - * INTRA-TREE API? - * Return the node's parent in the containment hierarchy. - * Most nodes must have a parent. The parent is immutable. - * @see #children() - */ - Node getParent(); - - /** - * INTRA-TREE API? - * Return the node's children, which are also nodes. - * @see #getParent() - */ - Iterator children(); - - /** - * INTRA-TREE API? - * Return the containment hierarchy's root node. - * Most nodes must have a root. - * @see #getParent() - */ - Node root(); - - /** - * Return whether the node is a descendant of the specified node. - * By definition, a node is a descendant of itself. - */ - boolean isDescendantOf(Node node); - - /** - * INTRA-TREE API - * Add the node's "references", and all the node's descendants' - * "references", to the specified collection. "References" are - * objects that are "referenced" by another object, as opposed - * to "owned" by another object. - * This method is of particular concern to Handles, since most - * (hopefully all) "references" are held by Handles. - * @see Reference - * @see #children() - */ - void addBranchReferencesTo(Collection branchReferences); - - /** - * INTRA-TREE API? - * Add all the nodes in the object's branch of the tree, - * including the node itself, to the specified collection. - * Only really used for testing and debugging. - */ - void addAllNodesTo(Collection nodes); - - - // ********** model synchronization support ********** - - /** - * INTRA-TREE API - * This is a general notification that the specified node has been - * removed from the tree. The node receiving this notification - * should perform any necessary updates to remain in synch - * with the tree (e.g. clearing out or replacing any references - * to the removed node or any of the removed node's descendants). - * @see #isDescendantOf(Node) - */ - void nodeRemoved(Node node); - - /** - * INTRA-TREE API - * This is a general notification that the specified node has been - * renamed. The node receiving this notification should mark its - * branch dirty if necessary (i.e. it references the renamed node - * or one of its descendants). This method is of particular concern - * to Handles. - * @see #isDescendantOf(Node) - */ - void nodeRenamed(Node node); - - - // ********** dirty flag support ********** - - /** - * Return whether any persistent aspects of the node, - * or any of its descendants, have changed since the node and - * its descendants were last read or saved. - */ - boolean isDirtyBranch(); - String DIRTY_BRANCH_PROPERTY = "dirtyBranch"; //$NON-NLS-1$ - - /** - * INTRA-TREE API - * Mark the node and its parent as dirty branches. - * This message is propagated up the containment - * tree when a particular node becomes dirty. - */ - void markBranchDirty(); - - /** - * Mark the node and all its descendants as dirty. - * This is used when the save location of some - * top-level node is changed and the entire - * containment tree must be marked dirty so it - * will be written out. - */ - void markEntireBranchDirty(); - - /** - * INTRA-TREE API - * A child node's branch has been marked clean. If the node - * itself is clean and if all of its children are also clean, the - * node's branch can be marked clean. Then, if the node's - * branch is clean, the node will notify its parent that it might - * be clean also. This message is propagated up the containment - * tree when a particular node becomes clean. - */ - void markBranchCleanIfPossible(); - - /** - * INTRA-TREE API - * Mark the node and all its descendants as clean. - * Typically used when the node has just been - * read in or written out. - * This method is for internal use only; it is not for - * client use. - * Not the best of method names.... :-( - */ - void cascadeMarkEntireBranchClean(); - - - // ********** problems ********** - - /** - * INTRA-TREE API - * Return a validator that will be invoked whenever a - * "validated" aspect of the node tree changes. - * Typically only the root node directly holds a validator. - */ - Validator getValidator(); - - /** - * Set a validator that will be invoked whenever a - * "validated" aspect of the node tree changes. - * Typically only the root node directly holds a validator. - */ - void setValidator(Validator validator); - - /** - * Validate the node and its descendants. - * This is an explicit request invoked by a client; and it will - * typically be followed by a call to one of the following methods: - * #branchProblems() - * #hasBranchProblems() - * Whether the node maintains its problems on the fly - * or waits until this method is called is determined by the - * implementation. - * @see Problem - */ - void validateBranch(); - - /** - * INTRA-TREE API - * Validate the node and all of its descendants, - * and update their sets of "branch" problems. - * Return true if the collection of "branch" problems has changed. - * This method is for internal use only; it is not for - * client use. - */ - boolean validateBranchInternal(); - - /** - * Return all the node's problems along with all the - * node's descendants' problems. - */ - ListIterator branchProblems(); - String BRANCH_PROBLEMS_LIST = "branchProblems"; //$NON-NLS-1$ - - /** - * Return the size of all the node's problems along with all the - * node's descendants' problems. - */ - int branchProblemsSize(); - - /** - * Return whether the node or any of its descendants have problems. - */ - boolean hasBranchProblems(); - String HAS_BRANCH_PROBLEMS_PROPERTY = "hasBranchProblems"; //$NON-NLS-1$ - - /** - * Return whether the node contains the specified branch problem. - */ - boolean containsBranchProblem(Problem problem); - - /** - * INTRA-TREE API - * Something changed, rebuild the node's collection of branch problems. - */ - void rebuildBranchProblems(); - - /** - * INTRA-TREE API - * Add the node's problems, and all the node's descendants' - * problems, to the specified list. - * A call to this method should be immediately preceded by a call to - * #validateBranch() or all of the problems might not be - * added to the list. - * @see Problem - */ - void addBranchProblemsTo(List branchProblems); - - /** - * Clear the node's "branch" problems and the "branch" - * problems of all of its descendants. - */ - void clearAllBranchProblems(); - - /** - * INTRA-TREE API - * Clear the node's "branch" problems and the "branch" - * problems of all of its descendants. - * Return true if the collection of "branch" problems has changed. - * This method is for internal use only; it is not for - * client use. - */ - boolean clearAllBranchProblemsInternal(); - - - // ********** comment ********** - - /** - * Return the user comment concerning the node. - */ - String comment(); - String COMMENT_PROPERTY = "comment"; //$NON-NLS-1$ - - /** - * Set the user comment concerning the node. - */ - void setComment(String comment); - - - // ********** displaying/sorting ********** - - /** - * Return a string representation of the model, suitable for sorting. - */ - String displayString(); - - - // ********** sub-interfaces ********** - - /** - * Simple interface defining a "reference" between two nodes. - * @see Node#addBranchReferencesTo(java.util.Collection) - */ - interface Reference { - - /** - * Return the "source" node of the reference, i.e. the node that - * references the "target" node. - */ - Node source(); - - /** - * Return the "target" node of the reference, i.e. the node that - * is referenced by the "source" node. - */ - Node target(); - - } - - - /** - * A validator will validate a node as appropriate. - * Typically the validation will - * - occur whenever a node has changed - * - encompass the entire tree containing the node - * - execute asynchronously - */ - interface Validator { - - /** - * A "significant" aspect has changed; - * validate the node as appropriate - */ - void validate(); - - /** - * Stop all validation of the node until #resume() is called. - * This can be used to improve the performance of any long-running - * action that triggers numerous changes to the node. Be sure to - * match a call to this method with a corresponding call to - * #resume(). - */ - void pause(); - - /** - * Resume validation of the node. This method can only be - * called after a matching call to #pause(). - */ - void resume(); - - } - - - // ********** helper implementations ********** - - /** - * Straightforward implementation of the Reference interface - * defined above. - */ - public class SimpleReference implements Reference { - private Node source; - private Node target; - public SimpleReference(Node source, Node target) { - super(); - if (source == null || target == null) { - throw new NullPointerException(); - } - this.source = source; - this.target = target; - } - public Node source() { - return this.source; - } - public Node target() { - return this.target; - } - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.source + " => " + this.target); //$NON-NLS-1$ - } - } - - - /** - * This validator does nothing to validate the node. - */ - Validator NULL_VALIDATOR = - new PluggableValidator(PluggableValidator.Delegate.Null.instance()) { - @Override - public String toString() { - return "Node.NULL_VALIDATOR"; //$NON-NLS-1$ - } - }; - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/PluggableValidator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/PluggableValidator.java deleted file mode 100644 index 33a283c0bf..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/PluggableValidator.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.node; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.SynchronizedBoolean; - -/** - * This implementation of the Validator interface implements the - * pause/resume portion of the protocol, but delegates the actual - * validation to a "pluggable" delegate. - */ -public class PluggableValidator - implements Node.Validator -{ - private boolean pause; - private boolean validateOnResume; - private final Delegate delegate; - - - /** - * Convenience factory method. - */ - public static Node.Validator buildAsynchronousValidator(SynchronizedBoolean validateFlag) { - return new PluggableValidator(new AsynchronousValidator(validateFlag)); - } - - /** - * Convenience factory method. - */ - public static Node.Validator buildSynchronousValidator(Node node) { - return new PluggableValidator(new SynchronousValidator(node)); - } - - /** - * Construct a validator with the specified delegate. - */ - public PluggableValidator(Delegate delegate) { - super(); - this.pause = false; - this.validateOnResume = false; - this.delegate = delegate; - } - - public synchronized void validate() { - if (this.pause) { - this.validateOnResume = true; - } else { - this.delegate.validate(); - } - } - - public synchronized void pause() { - if (this.pause) { - throw new IllegalStateException("already paused"); //$NON-NLS-1$ - } - this.pause = true; - } - - public synchronized void resume() { - if ( ! this.pause) { - throw new IllegalStateException("not paused"); //$NON-NLS-1$ - } - this.pause = false; - // validate any changes that occurred while the validation was paused - if (this.validateOnResume) { - this.validateOnResume = false; - this.delegate.validate(); - } - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.delegate); - } - - - // ********** member interface ********** - - /** - * Interface implemented by any delegates of a pluggable validator. - */ - public interface Delegate { - - /** - * The validator is not "paused" - perform the appropriate validation. - */ - void validate(); - - - /** - * This delegate does nothing. - */ - final class Null implements Delegate { - public static final Delegate INSTANCE = new Null(); - public static Delegate instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - public void validate() { - // do nothing - } - @Override - public String toString() { - return "PluggableValidator.Delegate.Null"; //$NON-NLS-1$ - } - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/Problem.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/Problem.java deleted file mode 100644 index 13b4778a71..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/Problem.java +++ /dev/null @@ -1,51 +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.common.utility.internal.node; - -/** - * Define an interface describing the problems associated with a node. - */ -public interface Problem { - - /** - * Return the node most closely associated with the problem. - */ - Node source(); - - /** - * Return a key that can be used to uniquely identify the problem's message. - */ - String messageKey(); - - /** - * Return the arguments associate with the problem's message. - */ - Object[] messageArguments(); - - /** - * Return the type of the identified problem's message - */ - int messageType(); - - /** - * Return whether the problem is equal to the specified object. - * It is equal if the specified object is a implementation of the - * Problem interface and its source, message key, and message - * arguments are all equal to this problem's. - */ - boolean equals(Object o); - - /** - * Return the problem's hash code, which should calculated as an - * XOR of the source's hash code and the message key's hash code. - */ - int hashCode(); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/SynchronousValidator.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/SynchronousValidator.java deleted file mode 100644 index b176685613..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/node/SynchronousValidator.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.common.utility.internal.node; - -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * This implementation of the PluggableValidator.Delegate interface - * will validate the node immediately. - * - * This is useful for debugging in a single thread or generating - * problem reports. - */ -public class SynchronousValidator - implements PluggableValidator.Delegate -{ - private final Node node; - - /** - * Construct a validator that will immediately validate the - * specified node. - */ - public SynchronousValidator(Node node) { - super(); - this.node = node; - } - - public void validate() { - this.node.validateBranch(); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.node); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/CachingComboBoxModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/CachingComboBoxModel.java deleted file mode 100644 index cd6412e91e..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/CachingComboBoxModel.java +++ /dev/null @@ -1,42 +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.common.utility.internal.swing; - -import javax.swing.ComboBoxModel; - -/** - * This interface allows a client to better control the performance of - * a combo box model by allowing the client to specify when it is - * acceptable for the model to "cache" and "uncache" its list of elements. - * The model may ignore these hints if appropriate. - */ -public interface CachingComboBoxModel extends ComboBoxModel { - - /** - * Cache the comboBoxModel List. If you call this, you - * must make sure to call uncacheList() as well. Otherwise - * stale data will be in the ComboBox until cacheList() is - * called again or uncacheList() is called. - */ - void cacheList(); - - /** - * Clear the cached list. Next time the list is needed it will - * be built when it is not cached. - */ - void uncacheList(); - - /** - * Check to see if the list is already cached. This can be used for - * MouseEvents, since they are not terribly predictable. - */ - boolean isCached(); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/CheckBoxTableCellRenderer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/CheckBoxTableCellRenderer.java deleted file mode 100644 index 87a2b2e5ef..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/CheckBoxTableCellRenderer.java +++ /dev/null @@ -1,206 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.swing; - -import java.awt.Color; -import java.awt.Component; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import javax.swing.BorderFactory; -import javax.swing.Icon; -import javax.swing.JCheckBox; -import javax.swing.JTable; -import javax.swing.SwingConstants; -import javax.swing.UIManager; -import javax.swing.border.Border; -import org.eclipse.jpt.common.utility.internal.swing.TableCellEditorAdapter.ImmediateEditListener; - -/** - * Make the cell look like a check box. - */ -public class CheckBoxTableCellRenderer implements TableCellEditorAdapter.Renderer { - - /** the component used to paint the cell */ - private final JCheckBox checkBox; - - /** the listener to be notified on an immediate edit */ - protected TableCellEditorAdapter.ImmediateEditListener immediateEditListener; - - /** "normal" border - assume the default table "focus" border is 1 pixel thick */ - private static final Border NO_FOCUS_BORDER = BorderFactory.createEmptyBorder(1, 1, 1, 1); - - - // ********** constructors/initialization ********** - - /** - * Construct a cell renderer with no label or icon. - */ - public CheckBoxTableCellRenderer() { - super(); - this.checkBox = this.buildCheckBox(); - // by default, check boxes do not paint their borders - this.checkBox.setBorderPainted(true); - // this setting is recommended for check boxes inside of trees and tables - this.checkBox.setBorderPaintedFlat(true); - } - - /** - * Construct a cell renderer with the specified text and icon, - * either of which may be null. - */ - public CheckBoxTableCellRenderer(String text, Icon icon) { - this(); - this.setText(text); - this.setIcon(icon); - } - - /** - * Construct a cell renderer with the specified text. - */ - public CheckBoxTableCellRenderer(String text) { - this(text, null); - } - - /** - * Construct a cell renderer with the specified icon. - */ - public CheckBoxTableCellRenderer(Icon icon) { - this(null, icon); - } - - protected JCheckBox buildCheckBox() { - JCheckBox cb = new JCheckBox(); - cb.addActionListener(this.buildActionListener()); - return cb; - } - - private ActionListener buildActionListener() { - return new ActionListener() { - public void actionPerformed(ActionEvent e) { - if (CheckBoxTableCellRenderer.this.immediateEditListener != null) { - CheckBoxTableCellRenderer.this.immediateEditListener.immediateEdit(); - } - } - }; - } - - - // ********** TableCellRenderer implementation ********** - - public Component getTableCellRendererComponent(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) { - this.checkBox.setHorizontalAlignment(SwingConstants.CENTER); - this.checkBox.setComponentOrientation(table.getComponentOrientation()); - this.checkBox.setFont(table.getFont()); - this.checkBox.setEnabled(table.isEnabled()); - - this.checkBox.setForeground(this.foregroundColor(table, value, selected, hasFocus, row, column)); - this.checkBox.setBackground(this.backgroundColor(table, value, selected, hasFocus, row, column)); - // once the colors are set, calculate opaque setting - this.checkBox.setOpaque(this.cellIsOpaqueIn(table, value, selected, hasFocus, row, column)); - this.checkBox.setBorder(this.border(table, value, selected, hasFocus, row, column)); - - this.setValue(value); - return this.checkBox; - } - - /** - * Return the cell's foreground color. - */ - protected Color foregroundColor(JTable table, @SuppressWarnings("unused") Object value, boolean selected, boolean hasFocus, int row, int column) { - if (selected) { - if (hasFocus && table.isCellEditable(row, column)) { - return UIManager.getColor("Table.focusCellForeground"); //$NON-NLS-1$ - } - return table.getSelectionForeground(); - } - return table.getForeground(); - } - - /** - * Return the cell's background color. - */ - protected Color backgroundColor(JTable table, @SuppressWarnings("unused") Object value, boolean selected, boolean hasFocus, int row, int column) { - if (selected) { - if (hasFocus && table.isCellEditable(row, column)) { - return UIManager.getColor("Table.focusCellBackground"); //$NON-NLS-1$ - } - return table.getSelectionBackground(); - } - return table.getBackground(); - } - - /** - * Return the cell's border. - */ - protected Border border(@SuppressWarnings("unused") JTable table, @SuppressWarnings("unused") Object value, @SuppressWarnings("unused") boolean selected, boolean hasFocus, @SuppressWarnings("unused") int row, @SuppressWarnings("unused") int column) { - return hasFocus ? UIManager.getBorder("Table.focusCellHighlightBorder") : NO_FOCUS_BORDER; //$NON-NLS-1$ - } - - /** - * Return whether the cell should be opaque in the table. - * If the cell's background is the same as the table's background - * and table is opaque, we don't need to paint the background - - * the table will do it. - */ - protected boolean cellIsOpaqueIn(JTable table, @SuppressWarnings("unused") Object value, @SuppressWarnings("unused") boolean selected, @SuppressWarnings("unused") boolean hasFocus, @SuppressWarnings("unused") int row, @SuppressWarnings("unused") int column) { - Color cellBackground = this.checkBox.getBackground(); - Color tableBackground = table.getBackground(); - return ! (table.isOpaque() && cellBackground.equals(tableBackground)); - } - - /** - * Set the check box's value. - */ - protected void setValue(Object value) { - // CR#3999318 - This null check needs to be removed once JDK bug is fixed - if (value == null) { - value = Boolean.FALSE; - } - this.checkBox.setSelected(((Boolean) value).booleanValue()); - } - - - // ********** TableCellEditorAdapter.Renderer implementation ********** - - public Object getValue() { - return Boolean.valueOf(this.checkBox.isSelected()); - } - - public void setImmediateEditListener(ImmediateEditListener listener) { - this.immediateEditListener = listener; - } - - // ********** public API ********** - - /** - * Set the check box's text; which by default is blank. - */ - public void setText(String text) { - this.checkBox.setText(text); - } - - /** - * Set the check box's icon; which by default is not present. - */ - public void setIcon(Icon icon) { - this.checkBox.setIcon(icon); - } - - /** - * Return the renderer's preferred height. This allows you - * to set the table's row height to something the check box - * will look good in.... - */ - public int preferredHeight() { - // add in space for the border top and bottom - return (int) this.checkBox.getPreferredSize().getHeight() + 2; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/ComboBoxTableCellRenderer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/ComboBoxTableCellRenderer.java deleted file mode 100644 index 055a43b09b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/ComboBoxTableCellRenderer.java +++ /dev/null @@ -1,328 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.swing; - -import java.awt.Color; -import java.awt.Component; -import java.awt.Graphics; -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import javax.swing.BorderFactory; -import javax.swing.ComboBoxModel; -import javax.swing.JComboBox; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JTable; -import javax.swing.ListCellRenderer; -import javax.swing.SwingConstants; -import javax.swing.UIManager; -import javax.swing.border.Border; -import javax.swing.event.PopupMenuEvent; -import javax.swing.event.PopupMenuListener; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; - -/** - * Make the cell look like a combo-box. - */ -public class ComboBoxTableCellRenderer implements TableCellEditorAdapter.Renderer { - - /* caching the combo box because we are caching the comboBoxModel. - * Everytime we rebuilt the comboBox we would set the model on it and not - * remove the model from the old combo box. This meant that new listeners - * kept being added to the comboBoxModel for every comboBox build. - * Not sure if there is a way to clear out the old combo box, or why - * we were buildig a new combo box every time so I went with caching it. - */ - private JComboBox comboBox; - - /** the items used to populate the combo box */ - private CachingComboBoxModel model; - private ListCellRenderer renderer; - Object value; - private static int height = -1; - boolean fakeFocusFlag; - - /** the listener to be notified on an immediate edit */ - protected TableCellEditorAdapter.ImmediateEditListener immediateEditListener; - - /** hold the original colors of the combo-box */ - private static Color defaultForeground; - private static Color defaultBackground; - - /** "normal" border - assume the default table "focus" border is 1 pixel thick */ - private static final Border NO_FOCUS_BORDER = BorderFactory.createEmptyBorder(1, 1, 1, 1); - - - // ********** constructors/initialization ********** - - /** - * Default constructor. - */ - private ComboBoxTableCellRenderer() { - super(); - initialize(); - } - - /** - * Construct a cell renderer that uses the specified combo-box model. - */ - public ComboBoxTableCellRenderer(ComboBoxModel model) { - this(new NonCachingComboBoxModel(model)); - } - - /** - * Construct a cell renderer that uses the specified caching combo-box model. - */ - public ComboBoxTableCellRenderer(CachingComboBoxModel model) { - this(); - this.model = model; - } - - /** - * Construct a cell renderer that uses the specified - * combo-box model and renderer. - */ - public ComboBoxTableCellRenderer(ComboBoxModel model, ListCellRenderer renderer) { - this(new NonCachingComboBoxModel(model), renderer); - } - - /** - * Construct a cell renderer that uses the specified - * caching combo-box model and renderer. - */ - public ComboBoxTableCellRenderer(CachingComboBoxModel model, ListCellRenderer renderer) { - this(model); - this.renderer = renderer; - } - - protected void initialize() { - // save the original colors of the combo-box, so we - // can use them to paint non-selected cells - if (height == -1) { - JComboBox cb = new JComboBox(); - cb.addItem("m"); //$NON-NLS-1$ - - // add in space for the border top and bottom - height = cb.getPreferredSize().height + 2; - - defaultForeground = cb.getForeground(); - defaultBackground = cb.getBackground(); - } - } - - static JLabel prototypeLabel = new JLabel("Prototype", new EmptyIcon(16), SwingConstants.LEADING); //$NON-NLS-1$ - - protected JComboBox buildComboBox() { - - final JComboBox result = new JComboBox() { - private boolean fakeFocus; - @Override - public boolean hasFocus() { - return fakeFocus || super.hasFocus(); - } - @Override - public void paint(Graphics g) { - fakeFocus = ComboBoxTableCellRenderer.this.fakeFocusFlag; - super.paint(g); - fakeFocus = false; - } - //wrap the renderer to deal with the prototypeDisplayValue - @Override - public void setRenderer(final ListCellRenderer aRenderer) { - super.setRenderer(new ListCellRenderer(){ - public Component getListCellRendererComponent(JList list, Object v, int index, boolean isSelected, boolean cellHasFocus) { - if (v == prototypeLabel) { - return prototypeLabel; - } - return aRenderer.getListCellRendererComponent(list, v, index, isSelected, cellHasFocus); - } - }); - } - @Override - public int getSelectedIndex() { - boolean listNotCached = !listIsCached(); - if (listNotCached) { - cacheList(); - } - - int index = super.getSelectedIndex(); - - if (listNotCached) { - uncacheList(); - } - return index; - } - - }; - // stole this code from javax.swing.DefaultCellEditor - result.putClientProperty("JComboBox.isTableCellEditor", Boolean.TRUE); //$NON-NLS-1$ - result.addActionListener(this.buildActionListener()); - result.addPopupMenuListener(this.buildPopupMenuListener()); - - //These are used to workaround problems with Swing trying to - //determine the size of a comboBox with a large model - result.setPrototypeDisplayValue(prototypeLabel); - getListBox(result).setPrototypeCellValue(prototypeLabel); - - return result; - } - - - private JList getListBox(JComboBox result) { - return (JList) ReflectionTools.getFieldValue(result.getUI(), "listBox"); //$NON-NLS-1$ - } - - - private ActionListener buildActionListener() { - return new ActionListener() { - public void actionPerformed(ActionEvent e) { - JComboBox cb = (JComboBox) e.getSource(); - Object selectedItem = cb.getSelectedItem(); - - // Only update the selected item and invoke immediateEdit() if the - // selected item actually changed, during the initialization of the - // editing, the model changes and causes this method to be invoked, - // it causes CR#3963675 to occur because immediateEdit() stop the - // editing, which is done at the wrong time - if (ComboBoxTableCellRenderer.this.value != selectedItem) { - ComboBoxTableCellRenderer.this.value = cb.getSelectedItem(); - ComboBoxTableCellRenderer.this.immediateEdit(); - } - } - }; - } - - void immediateEdit() { - if (this.immediateEditListener != null) { - this.immediateEditListener.immediateEdit(); - } - } - - private PopupMenuListener buildPopupMenuListener() { - return new PopupMenuListener() { - - public void popupMenuWillBecomeVisible(PopupMenuEvent e) { - if (listIsCached()) { - uncacheList(); - } - cacheList(); - } - - public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { - if (listIsCached()) { - uncacheList(); - } - - } - - public void popupMenuCanceled(PopupMenuEvent e) { - if (listIsCached()) { - uncacheList(); - } - } - }; - } - - - void cacheList() { - this.model.cacheList(); - } - - void uncacheList() { - this.model.uncacheList(); - } - - boolean listIsCached() { - return this.model.isCached(); - } - // ********** TableCellRenderer implementation ********** - - public Component getTableCellRendererComponent(JTable table, Object val, boolean selected, boolean hasFocus, int row, int column) { - this.fakeFocusFlag = selected || hasFocus; - if (this.comboBox == null) { - this.comboBox = this.buildComboBox(); - - this.comboBox.setComponentOrientation(table.getComponentOrientation()); - this.comboBox.setModel(this.model); - if (this.renderer != null) { - this.comboBox.setRenderer(this.renderer); - } - this.comboBox.setFont(table.getFont()); - this.comboBox.setEnabled(table.isEnabled()); - this.comboBox.setBorder(this.border(table, val, selected, hasFocus, row, column)); - } - - // We need to go through the model since JComboBox might prevent us from - // selecting the value. This can happen when the value is not contained - // in the model, see CR#3950044 for an example - this.model.setSelectedItem(val); - - return this.comboBox; - } - - /** - * Return the cell's foreground color. - */ - protected Color foregroundColor(JTable table, @SuppressWarnings("unused") Object val, boolean selected, boolean hasFocus, int row, int column) { - if (selected) { - if (hasFocus && table.isCellEditable(row, column)) { - return defaultForeground; - } - return table.getSelectionForeground(); - } - return defaultForeground; - } - - /** - * Return the cell's background color. - */ - protected Color backgroundColor(JTable table, @SuppressWarnings("unused") Object val, boolean selected, boolean hasFocus, int row, int column) { - if (selected) { - if (hasFocus && table.isCellEditable(row, column)) { - return defaultBackground; - } - return table.getSelectionBackground(); - } - return defaultBackground; - } - - /** - * Return the cell's border. - */ - protected Border border(@SuppressWarnings("unused") JTable table, @SuppressWarnings("unused") Object val, @SuppressWarnings("unused") boolean selected, boolean hasFocus, @SuppressWarnings("unused") int row, @SuppressWarnings("unused") int column) { - return hasFocus ? - UIManager.getBorder("Table.focusCellHighlightBorder") //$NON-NLS-1$ - : - NO_FOCUS_BORDER; - } - - - // ********** TableCellEditorAdapter.Renderer implementation ********** - - public Object getValue() { - return this.value; - } - - public void setImmediateEditListener(TableCellEditorAdapter.ImmediateEditListener listener) { - this.immediateEditListener = listener; - } - - - // ********** public API ********** - - /** - * Return the renderer's preferred height. This allows you - * to set the row height to something the combo-box will look good in.... - */ - public int preferredHeight() { - return height; - } - -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/Displayable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/Displayable.java deleted file mode 100644 index 5a3adb7cc4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/Displayable.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.swing; - -import javax.swing.Icon; - -import org.eclipse.jpt.common.utility.model.Model; - -/** - * Used by general-purpose UI models and renderers to cast - * application model objects to something displayable. - */ -public interface Displayable - extends Model -{ - - /** - * Return a string that can be used to identify the model - * in a textual UI setting (typically the object's name). - * When the display string changes, the model should fire - * the appropriate change notification: - * this.firePropertyChanged(DISPLAY_STRING_PROPERTY, oldDisplayString, this.displayString()); - */ - String displayString(); - String DISPLAY_STRING_PROPERTY = "displayString"; //$NON-NLS-1$ - - /** - * Return an icon that can be used to identify the model - * in a UI component that supports icons (the icon can be null). - * When the icon changes, the model should fire - * the appropriate change notification: - * this.firePropertyChanged(ICON_PROPERTY, oldIcon, this.icon()); - */ - Icon icon(); - String ICON_PROPERTY = "icon"; //$NON-NLS-1$ - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/EmptyIcon.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/EmptyIcon.java deleted file mode 100644 index b04fbcf4b0..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/EmptyIcon.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.swing; - -import java.awt.Component; -import java.awt.Graphics; -import javax.swing.Icon; - -/** - * Implement the Icon interface with an icon that has a size but - * does not paint anything on the graphics context. - */ -public class EmptyIcon - implements Icon -{ - private final int width; - private final int height; - - public static final EmptyIcon NULL_INSTANCE = new EmptyIcon(0); - - - public EmptyIcon(int width, int height) { - super(); - this.width = width; - this.height = height; - } - - public EmptyIcon(int size) { - this(size, size); - } - - - // ********** Icon implementation ********** - - public void paintIcon(Component c, Graphics g, int x, int y) { - // don't paint anything for an empty icon - } - - public int getIconWidth() { - return this.width; - } - - public int getIconHeight() { - return this.height; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/FilteringListBrowser.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/FilteringListBrowser.java deleted file mode 100644 index 68ee9aa0ec..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/FilteringListBrowser.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.swing; - -import javax.swing.Icon; -import javax.swing.JComboBox; -import javax.swing.JOptionPane; -import javax.swing.ListModel; - -/** - * This implementation of LongListComponent.Browser uses a - * JOptionPane to prompt the user for the selection. The JOPtionPane - * is passed a FilteringListPanel to assist the user in making - * a selection. - */ -public class FilteringListBrowser - implements ListChooser.ListBrowser -{ - private FilteringListPanel panel; - - /** - * Default constructor. - */ - public FilteringListBrowser() { - super(); - this.panel = this.buildPanel(); - } - - protected FilteringListPanel buildPanel() { - return new LocalFilteringListPanel(); - } - - /** - * Prompt the user using a JOptionPane with a filtering - * list panel. - */ - public void browse(ListChooser chooser) { - this.initializeCellRenderer(chooser); - - int option = - JOptionPane.showOptionDialog( - chooser, - this.message(chooser), - this.title(chooser), - this.optionType(chooser), - this.messageType(chooser), - this.icon(chooser), - this.selectionValues(chooser), - this.initialSelectionValue(chooser) - ); - - if (option == JOptionPane.OK_OPTION) { - chooser.getModel().setSelectedItem(this.panel.selection()); - } - - // clear the text field so the list box is re-filtered - this.panel.textField().setText(""); //$NON-NLS-1$ - } - - protected void initializeCellRenderer(JComboBox comboBox) { - // default behavior should be to use the cell renderer from the combobox. - this.panel.listBox().setCellRenderer(comboBox.getRenderer()); - } - - /** - * the message can be anything - here we build a component - */ - protected Object message(JComboBox comboBox) { - this.panel.setCompleteList(this.convertToArray(comboBox.getModel())); - this.panel.setSelection(comboBox.getModel().getSelectedItem()); - return this.panel; - } - - protected String title(@SuppressWarnings("unused") JComboBox comboBox) { - return null; - } - - protected int optionType(@SuppressWarnings("unused") JComboBox comboBox) { - return JOptionPane.OK_CANCEL_OPTION; - } - - protected int messageType(@SuppressWarnings("unused") JComboBox comboBox) { - return JOptionPane.QUESTION_MESSAGE; - } - - protected Icon icon(@SuppressWarnings("unused") JComboBox comboBox) { - return null; - } - - protected Object[] selectionValues(@SuppressWarnings("unused") JComboBox comboBox) { - return null; - } - - protected Object initialSelectionValue(@SuppressWarnings("unused") JComboBox comboBox) { - return null; - } - - /** - * Convert the list of objects in the specified list model - * into an array. - */ - protected Object[] convertToArray(ListModel model) { - int size = model.getSize(); - Object[] result = new Object[size]; - for (int i = 0; i < size; i++) { - result[i] = model.getElementAt(i); - } - return result; - } - - - // ********** custom panel ********** - - protected static class LocalFilteringListPanel extends FilteringListPanel { - protected static final Object[] EMPTY_ARRAY = new Object[0]; - - protected LocalFilteringListPanel() { - super(EMPTY_ARRAY, null); - } - - /** - * Disable the performance tweak because JOptionPane - * will try open wide enough to disable the horizontal scroll bar; - * and it looks a bit clumsy. - */ - @Override - protected String prototypeCellValue() { - return null; - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/FilteringListPanel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/FilteringListPanel.java deleted file mode 100644 index e58608c9e4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/FilteringListPanel.java +++ /dev/null @@ -1,455 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.swing; - -import java.awt.BorderLayout; -import java.awt.Font; -import javax.swing.AbstractListModel; -import javax.swing.BorderFactory; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTextField; -import javax.swing.ListCellRenderer; -import javax.swing.ListModel; -import javax.swing.ListSelectionModel; -import javax.swing.border.Border; -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import org.eclipse.jpt.common.utility.internal.SimpleStringMatcher; -import org.eclipse.jpt.common.utility.internal.StringConverter; -import org.eclipse.jpt.common.utility.internal.StringMatcher; - -/** - * This panel presents an entry field and a list box of choices that - * allows the user to filter the entries in the list box by entering - * a pattern in the entry field. - * - * By default, two wildcards are allowed in the pattern: - * '*' will match any set of zero or more characters - * '?' will match any single character - * - * The panel consists of 4 components that can be customized: - * - 1 text field - * - 1 list box - * - 2 labels, one for each of the above - * - * Other aspects of the panel's behavior can be changed: - * - the string converter determines how the objects in the - * list are converted to strings and compared to the pattern - * entered in the text field; by default the converter simply - * uses the result of the object's #toString() method - * (if you replace the string converter, you will probably - * want to replace the list box's cell renderer also) - * - the string matcher can also be changed if you would - * like different pattern matching behavior than that - * described above - * - you can specify the maximum size of the list - this may - * force the user to enter a pattern restrictive enough - * to result in a list smaller than the maximum size; the - * default is -1, which disables the restriction - * - * This panel is not a typical panel, in the sense that it does not share - * its model with clients via value models. Instead, this panel's model - * is set and queried directly because it is designed to be used in a - * dialog that directs the user's behavior (as opposed to a "normal" - * window). - */ -public class FilteringListPanel extends JPanel { - - /** - * The complete list of available choices - * (as opposed to the partial list held by the list box). - */ - private Object[] completeList; - - /** - * An adapter used to convert the objects in the list - * to strings so they can be run through the matcher - * and displayed in the text field. - */ - StringConverter stringConverter; - - /** The text field. */ - private JTextField textField; - private JLabel textFieldLabel; - private DocumentListener textFieldListener; - - /** The list box. */ - private JList listBox; - private JLabel listBoxLabel; - - /** The maximum number of entries displayed in the list box. */ - private int maxListSize; - - /** - * The matcher used to filter the list against - * the pattern entered in the text field. By default, - * this allows the two wildcard characters described in - * the class comment. - */ - private StringMatcher stringMatcher; - - /** - * Performance tweak: We use this buffer instead of - * a temporary variable during filtering so we don't have - * to keep re-allocating it. - */ - private Object[] buffer; - - private static final Border TEXT_FIELD_LABEL_BORDER = BorderFactory.createEmptyBorder(0, 0, 5, 0); - private static final Border LIST_BOX_LABEL_BORDER = BorderFactory.createEmptyBorder(5, 0, 5, 0); - - - // ********** constructors ********** - - /** - * Construct a FilteringListPanel with the specified list of choices - * and initial selection. Use the default string converter to convert the - * choices and selection to strings (which simply calls #toString() on - * the objects). - */ - public FilteringListPanel(Object[] completeList, Object initialSelection) { - this(completeList, initialSelection, StringConverter.Default.instance()); - } - - /** - * Construct a FilteringListPanel with the specified list of choices - * and initial selection. Use the specified string converter to convert the - * choices and selection to strings. - */ - public FilteringListPanel(Object[] completeList, Object initialSelection, StringConverter stringConverter) { - super(new BorderLayout()); - this.completeList = completeList; - this.stringConverter = stringConverter; - this.initialize(initialSelection); - } - - - // ********** initialization ********** - - private void initialize(Object initialSelection) { - this.maxListSize = this.defaultMaxListSize(); - this.buffer = this.buildBuffer(); - - this.textFieldListener = this.buildTextFieldListener(); - - this.stringMatcher = this.buildStringMatcher(); - - this.initializeLayout(initialSelection); - } - - private Object[] buildBuffer() { - return new Object[this.max()]; - } - - /** - * Return the current max number of entries allowed in the list box. - */ - private int max() { - if (this.maxListSize == -1) { - return this.completeList.length; - } - return Math.min(this.maxListSize, this.completeList.length); - } - - /** - * Build a listener that will listen to changes in the text field - * and filter the list appropriately. - */ - private DocumentListener buildTextFieldListener() { - return new DocumentListener() { - public void insertUpdate(DocumentEvent e) { - FilteringListPanel.this.filterList(); - } - public void changedUpdate(DocumentEvent e) { - FilteringListPanel.this.filterList(); - } - public void removeUpdate(DocumentEvent e) { - FilteringListPanel.this.filterList(); - } - @Override - public String toString() { - return "text field listener"; //$NON-NLS-1$ - } - }; - } - - private int defaultMaxListSize() { - return -1; - } - - private StringMatcher buildStringMatcher() { - return new SimpleStringMatcher(); - } - - private void initializeLayout(Object initialSelection) { - // text field - JPanel textFieldPanel = new JPanel(new BorderLayout()); - this.textFieldLabel = new JLabel(); - this.textFieldLabel.setBorder(TEXT_FIELD_LABEL_BORDER); - textFieldPanel.add(this.textFieldLabel, BorderLayout.NORTH); - - this.textField = new JTextField(); - this.textField.getDocument().addDocumentListener(this.textFieldListener); - this.textFieldLabel.setLabelFor(this.textField); - textFieldPanel.add(this.textField, BorderLayout.CENTER); - - this.add(textFieldPanel, BorderLayout.NORTH); - - // list box - JPanel listBoxPanel = new JPanel(new BorderLayout()); - this.listBoxLabel = new JLabel(); - this.listBoxLabel.setBorder(LIST_BOX_LABEL_BORDER); - listBoxPanel.add(this.listBoxLabel, BorderLayout.NORTH); - - this.listBox = new JList(); - this.listBox.setDoubleBuffered(true); - this.listBox.setModel(this.buildPartialArrayListModel(this.completeList, this.max())); - this.listBox.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - // performance tweak(?) - this.listBox.setPrototypeCellValue(this.prototypeCellValue()); - this.listBox.setPrototypeCellValue(null); - this.listBox.setCellRenderer(this.buildDefaultCellRenderer()); - this.listBoxLabel.setLabelFor(this.listBox); - // bug 2777802 - scroll bars shouldn't be on the tab sequence - JScrollPane listBoxScrollPane = new JScrollPane(this.listBox); - listBoxScrollPane.getHorizontalScrollBar().setFocusable(false); - listBoxScrollPane.getVerticalScrollBar().setFocusable(false); - listBoxPanel.add(listBoxScrollPane, BorderLayout.CENTER); - - // initialize the widgets - this.listBox.setSelectedValue(initialSelection, true); - this.textField.select(0, this.textField.getText().length()); - - this.add(listBoxPanel, BorderLayout.CENTER); - } - - - // ********** public API ********** - - public Object selection() { - return this.listBox.getSelectedValue(); - } - - public void setSelection(Object selection) { - this.listBox.setSelectedValue(selection, true); - } - - public Object[] completeList() { - return this.completeList; - } - - /** - * rebuild the filtering buffer and re-apply the filter - * to the new list - */ - public void setCompleteList(Object[] completeList) { - this.completeList = completeList; - if (this.buffer.length < this.max()) { - // the buffer will never shrink - might want to re-consider... ~bjv - this.buffer = this.buildBuffer(); - } - this.filterList(); - } - - public int maxListSize() { - return this.maxListSize; - } - - public void setMaxListSize(int maxListSize) { - this.maxListSize = maxListSize; - if (this.buffer.length < this.max()) { - // the buffer will never shrink - might want to re-consider... ~bjv - this.buffer = this.buildBuffer(); - } - this.filterList(); - } - - public StringConverter stringConverter() { - return this.stringConverter; - } - - /** - * apply the new filter to the list - */ - public void setStringConverter(StringConverter stringConverter) { - this.stringConverter = stringConverter; - this.filterList(); - } - - /** - * allow client code to access the text field - * (so we can set the focus) - */ - public JTextField textField() { - return this.textField; - } - - /** - * allow client code to access the text field label - */ - public JLabel textFieldLabel() { - return this.textFieldLabel; - } - - /** - * convenience method - */ - public void setTextFieldLabelText(String text) { - this.textFieldLabel.setText(text); - } - - /** - * allow client code to access the list box - * (so we can add mouse listeners for double-clicking) - */ - public JList listBox() { - return this.listBox; - } - - /** - * convenience method - */ - public void setListBoxCellRenderer(ListCellRenderer renderer) { - this.listBox.setCellRenderer(renderer); - } - - /** - * allow client code to access the list box label - */ - public JLabel listBoxLabel() { - return this.listBoxLabel; - } - - /** - * convenience method - */ - public void setListBoxLabelText(String text) { - this.listBoxLabel.setText(text); - } - - /** - * convenience method - */ - public void setComponentsFont(Font font) { - this.textFieldLabel.setFont(font); - this.textField.setFont(font); - this.listBoxLabel.setFont(font); - this.listBox.setFont(font); - } - - public StringMatcher stringMatcher() { - return this.stringMatcher; - } - - /** - * re-apply the filter to the list - */ - public void setStringMatcher(StringMatcher stringMatcher) { - this.stringMatcher = stringMatcher; - this.filterList(); - } - - - // ********** internal methods ********** - - /** - * Allow subclasses to disable performance tweak - * by returning null here. - */ - protected String prototypeCellValue() { - return "==========> A_STRING_THAT_IS_DEFINITELY_LONGER_THAN_EVERY_STRING_IN_THE_LIST <=========="; //$NON-NLS-1$ - } - - /** - * By default, use the string converter to build the text - * used by the list box's cell renderer. - */ - protected ListCellRenderer buildDefaultCellRenderer() { - return new SimpleListCellRenderer() { - @Override - @SuppressWarnings("unchecked") - protected String buildText(Object value) { - return FilteringListPanel.this.stringConverter.convertToString((T) value); - } - }; - } - - /** - * Something has changed that requires us to filter the list. - * - * This method is synchronized because a fast typist can - * generate events quicker than we can filter the list. (? ~bjv) - */ - synchronized void filterList() { - // temporarily stop listening to the list box selection, since we will - // be changing the selection during the filtering and don't want - // that to affect the text field - this.filterList(this.textField.getText()); - } - - /** - * Filter the contents of the list box to match the - * specified pattern. - */ - private void filterList(String pattern) { - if (pattern.length() == 0) { - this.listBox.setModel(this.buildPartialArrayListModel(this.completeList, this.max())); - } else { - this.stringMatcher.setPatternString(pattern); - int j = 0; - int len = this.completeList.length; - int max = this.max(); - for (int i = 0; i < len; i++) { - if (this.stringMatcher.matches(this.stringConverter.convertToString(this.entry(i)))) { - this.buffer[j++] = this.completeList[i]; - } - if (j == max) { - break; - } - } - this.listBox.setModel(this.buildPartialArrayListModel(this.buffer, j)); - } - - // after filtering the list, determine the appropriate selection - if (this.listBox.getModel().getSize() == 0) { - this.listBox.getSelectionModel().clearSelection(); - } else { - this.listBox.getSelectionModel().setAnchorSelectionIndex(0); - this.listBox.getSelectionModel().setLeadSelectionIndex(0); - this.listBox.ensureIndexIsVisible(0); - } - } - - /** - * minimize scope of suppressed warnings - */ - @SuppressWarnings("unchecked") - private T entry(int index) { - return (T) this.completeList[index]; - } - - /** - * Build a list model that wraps only a portion of the specified array. - * The model will include the array entries from 0 to (size - 1). - */ - private ListModel buildPartialArrayListModel(final Object[] array, final int size) { - return new AbstractListModel() { - public int getSize() { - return size; - } - public Object getElementAt(int index) { - return array[index]; - } - }; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/ListChooser.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/ListChooser.java deleted file mode 100644 index 84bad23fc9..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/ListChooser.java +++ /dev/null @@ -1,430 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.swing; - -import java.awt.AWTEvent; -import java.awt.AWTException; -import java.awt.Component; -import java.awt.EventQueue; -import java.awt.Point; -import java.awt.Robot; -import java.awt.event.KeyAdapter; -import java.awt.event.KeyEvent; -import java.awt.event.KeyListener; -import java.awt.event.MouseEvent; -import javax.swing.ComboBoxModel; -import javax.swing.DefaultListCellRenderer; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JComponent; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.ListCellRenderer; -import javax.swing.SwingConstants; -import javax.swing.event.PopupMenuEvent; -import javax.swing.event.PopupMenuListener; -import javax.swing.plaf.basic.BasicComboBoxUI; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; - -/** - * This component provides a way to handle selecting an item from a - * list that may grow too large to be handled conveniently by a combo-box. - * If the list's size is less than the designated "long" list size, - * the choice list will be displayed in a normal combo-box popup; - * otherwise, a dialog will be used to prompt the user to choose a selection. - * - * To change the browse mechanism, subclasses may - * - override the method #buildBrowser() - * - override the method #browse(), in which case the method - * #buildBrowser() may be ignored. - */ -public class ListChooser - extends JComboBox -{ - - /** the size of a "long" list - anything smaller is a "short" list */ - int longListSize = DEFAULT_LONG_LIST_SIZE; - - /** the default size of a "long" list, which is 20 (to match JOptionPane's behavior) */ - public static final int DEFAULT_LONG_LIST_SIZE = 20; - - /** property change associated with long list size */ - public static final String LONG_LIST_SIZE_PROPERTY = "longListSize"; //$NON-NLS-1$ - - static JLabel prototypeLabel = new JLabel("Prototype", new EmptyIcon(17), SwingConstants.LEADING); //$NON-NLS-1$ - - /** - * whether the chooser is choosable. if a chooser is not choosable, - * it only serves as a display widget. a user may not change its - * selected value. - */ - boolean choosable = true; - - /** property change associated with choosable */ - public static final String CHOOSABLE_PROPERTY = "choosable"; //$NON-NLS-1$ - - /** the browser used to make a selection from the long list - typically via a dialog */ - private ListBrowser browser; - - private NodeSelector nodeSelector; - - /** INTERNAL - The popup is being shown. Used to prevent infinite loop. */ - boolean popupAlreadyInProgress; - - - // **************** Constructors ****************************************** - - /** - * Construct a list chooser for the specified model. - */ - public ListChooser(ComboBoxModel model) { - this(model, new NodeSelector.DefaultNodeSelector()); - } - - public ListChooser(CachingComboBoxModel model) { - this(model, new NodeSelector.DefaultNodeSelector()); - } - - public ListChooser(ComboBoxModel model, NodeSelector nodeSelector) { - this(new NonCachingComboBoxModel(model), nodeSelector); - } - - public ListChooser(CachingComboBoxModel model, NodeSelector nodeSelector) { - super(model); - this.initialize(); - this.nodeSelector = nodeSelector; - } - // **************** Initialization **************************************** - - protected void initialize() { - this.addPopupMenuListener(this.buildPopupMenuListener()); - this.setRenderer(new DefaultListCellRenderer()); - this.addKeyListener(buildF3KeyListener()); - - //These are used to workaround problems with Swing trying to - //determine the size of a comboBox with a large model - setPrototypeDisplayValue(prototypeLabel); - listBox().setPrototypeCellValue(prototypeLabel); - } - - - private JList listBox() { - return (JList) ReflectionTools.getFieldValue(this.ui, "listBox"); //$NON-NLS-1$ - } - - /** - * When the popup is about to be shown, the event is consumed, and - * PopupHandler determines whether to reshow the popup or to show - * the long list browser. - */ - private PopupMenuListener buildPopupMenuListener() { - return new PopupMenuListener() { - public void popupMenuWillBecomeVisible(PopupMenuEvent e) { - ListChooser.this.aboutToShowPopup(); - } - public void popupMenuWillBecomeInvisible(PopupMenuEvent e) { - // do nothing - } - public void popupMenuCanceled(PopupMenuEvent e) { - // do nothing - } - @Override - public String toString() { - return "pop-up menu listener"; //$NON-NLS-1$ - } - }; - } - - /** - * If this code is being reached due to the PopupHandler already being in progress, - * then do nothing. Otherwise, set the flag to true and launch the PopupHandler. - */ - void aboutToShowPopup() { - if (this.popupAlreadyInProgress) { - return; - } - - this.popupAlreadyInProgress = true; - EventQueue.invokeLater(new PopupHandler()); - } - - - private KeyListener buildF3KeyListener() { - return new KeyAdapter() { - @Override - public void keyPressed(KeyEvent e) { - if (e.getKeyCode() == KeyEvent.VK_F3) { - goToSelectedItem(); - } - } - @Override - public String toString() { - return "F3 key listener"; //$NON-NLS-1$ - } - }; - } - - public void goToSelectedItem() { - if (getSelectedItem() != null) { - ListChooser.this.nodeSelector.selectNodeFor(getSelectedItem()); - } - } - - // **************** Browsing ********************************************** - - /** - * Lazily initialize because subclasses may have further initialization to do - * before browser can be built. - */ - protected void browse() { - if (this.browser == null) { - this.browser = this.buildBrowser(); - } - - this.browser.browse(this); - } - - /** - * Return the "browser" used to make a selection from the long list, - * typically via a dialog. - */ - protected ListChooser.ListBrowser buildBrowser() { - return new SimpleListBrowser(); - } - - - // **************** Choosable functionality ******************************* - - /** override behavior - consume selection if chooser is not choosable */ - @Override - public void setSelectedIndex(int anIndex) { - if (this.choosable) { - super.setSelectedIndex(anIndex); - } - } - - private void updateArrowButton() { - try { - BasicComboBoxUI comboBoxUi = (BasicComboBoxUI) ListChooser.this.getUI(); - JButton arrowButton = (JButton) ReflectionTools.getFieldValue(comboBoxUi, "arrowButton"); //$NON-NLS-1$ - arrowButton.setEnabled(this.isEnabled() && this.choosable); - } - catch (Exception e) { - // this is a huge hack to try and make the combo box look right, - // so if it doesn't work, just swallow the exception - } - } - - - // **************** List Caching ******************************* - - void cacheList() { - ((CachingComboBoxModel) getModel()).cacheList(); - } - - void uncacheList() { - ((CachingComboBoxModel) getModel()).uncacheList(); - } - - boolean listIsCached() { - return ((CachingComboBoxModel) getModel()).isCached(); - } - - // **************** Public ************************************************ - - public int longListSize() { - return this.longListSize; - } - - public void setLongListSize(int newLongListSize) { - int oldLongListSize = this.longListSize; - this.longListSize = newLongListSize; - this.firePropertyChange(LONG_LIST_SIZE_PROPERTY, oldLongListSize, newLongListSize); - } - - public boolean isChoosable() { - return this.choosable; - } - - public void setChoosable(boolean newValue) { - boolean oldValue = this.choosable; - this.choosable = newValue; - this.firePropertyChange(CHOOSABLE_PROPERTY, oldValue, newValue); - this.updateArrowButton(); - } - - // **************** Handle selecting null as a value ********************** - - private boolean selectedIndexIsNoneSelectedItem(int index) { - return index == -1 && - getModel().getSize() > 0 && - getModel().getElementAt(0) == null; - } - - @Override - public int getSelectedIndex() { - boolean listNotCached = !listIsCached(); - if (listNotCached) { - cacheList(); - } - - int index = super.getSelectedIndex(); - - // Use index 0 to show the item since the actual value is - // null and JComboBox does not handle null values - if (selectedIndexIsNoneSelectedItem(index)) { - index = 0; - } - - if (listNotCached) { - uncacheList(); - } - return index; - } - - //wrap the renderer to deal with the prototypeDisplayValue - @Override - public void setRenderer(final ListCellRenderer aRenderer) { - super.setRenderer(new ListCellRenderer(){ - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - if (value == prototypeLabel) { - return prototypeLabel; - } - return aRenderer.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - } - }); - } - - - // **************** Member classes **************************************** - - /** - * Define the API required by this ListChooser when it must - * prompt the user to select an item from the "long" list. - */ - public interface ListBrowser - { - /** - * Prompt the user to make a selection from the specified - * combo-box's model. - */ - void browse(ListChooser parentChooser); - } - - - /** - * Runnable class that consumes popup window and determines whether - * to reshow popup or to launch browser, based on the size of the list. - */ - private class PopupHandler - implements Runnable - { - /** The mouse event */ - private MouseEvent lastMouseEvent; - - /** The component from which the last mouse event was thrown */ - private JComponent eventComponent; - - /** The location of the component at the time the last mouse event was thrown */ - private Point componentLocation; - - /** The location of the mouse at the time the last mouse event was thrown */ - private Point mouseLocation; - - - PopupHandler() { - this.initialize(); - } - - private void initialize() { - AWTEvent event = EventQueue.getCurrentEvent(); - - if (event instanceof MouseEvent) { - this.lastMouseEvent = (MouseEvent) event; - this.eventComponent = (JComponent) this.lastMouseEvent.getSource(); - this.componentLocation = this.eventComponent.getLocationOnScreen(); - this.mouseLocation = this.lastMouseEvent.getPoint(); - } - else { - this.eventComponent = null; - this.componentLocation = null; - this.mouseLocation = null; - } - } - - public void run() { - ListChooser.this.hidePopup(); - - cacheList(); - if (ListChooser.this.choosable == true) { - // If the combo box model is of sufficient length, the browser will be shown. - // Asking the combo box model for its size should be enough to ensure that - // its size is recalculated. - if (ListChooser.this.getModel().getSize() > ListChooser.this.longListSize) { - this.checkComboBoxButton(); - ListChooser.this.browse(); - } - else { - ListChooser.this.showPopup(); - this.checkMousePosition(); - } - } - if (listIsCached()) { - uncacheList(); - } - - ListChooser.this.popupAlreadyInProgress = false; - } - - /** If this is not done, the button never becomes un-pressed */ - private void checkComboBoxButton() { - try { - BasicComboBoxUI comboBoxUi = (BasicComboBoxUI) ListChooser.this.getUI(); - JButton arrowButton = (JButton) ReflectionTools.getFieldValue(comboBoxUi, "arrowButton"); //$NON-NLS-1$ - arrowButton.getModel().setPressed(false); - } - catch (Exception ex) { - // this is a huge hack to try and make the combo box look right, - // so if it doesn't work, just swallow the exception - this.handleException(ex); - } - } - - private void handleException(@SuppressWarnings("unused") Exception ex) { - // do nothing for now - } - - /** - * Moves the mouse back to its original position before any jiggery pokery that we've done. - */ - private void checkMousePosition() { - if (this.eventComponent == null) { - return; - } - - final Point newComponentLocation = this.eventComponent.getLocationOnScreen(); - boolean componentMoved = - newComponentLocation.x - this.componentLocation.x != 0 - || newComponentLocation.y - this.componentLocation.y != 0; - - if (componentMoved) { - try { - new Robot().mouseMove( - newComponentLocation.x + this.mouseLocation.x, - newComponentLocation.y + this.mouseLocation.y - ); - } - catch (AWTException ex) { - // move failed - do nothing - } - } - } - } -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/NodeSelector.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/NodeSelector.java deleted file mode 100644 index 64079be527..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/NodeSelector.java +++ /dev/null @@ -1,32 +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.common.utility.internal.swing; - -/** - * This will be called when the user presses F3 or chooses - * 'Go To' in the context menu - */ -public interface NodeSelector -{ - /** - * Select the appropriate Node in the tree or the editor panel. - */ - void selectNodeFor(Object item); - - /** - * This NodeSelector will do nothing when selectNodeFor(Object) is called - */ - class DefaultNodeSelector implements NodeSelector { - - public void selectNodeFor(Object item) { - //default is to do nothing - } - } -} \ No newline at end of file diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/NonCachingComboBoxModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/NonCachingComboBoxModel.java deleted file mode 100644 index aef9a7c6ed..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/NonCachingComboBoxModel.java +++ /dev/null @@ -1,73 +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.common.utility.internal.swing; - -import javax.swing.ComboBoxModel; -import javax.swing.event.ListDataListener; - -/** - * This implementation of the CachingComboBoxModel interface can be used - * whenever there is no need for caching (i.e. the contents of the selection - * list can be generated with little latency). All the normal ComboBoxModel - * behavior is delegated to a client-supplied ComboBoxModel. - */ -public class NonCachingComboBoxModel implements CachingComboBoxModel { - private ComboBoxModel wrappedComboBoxModel; - - public NonCachingComboBoxModel(ComboBoxModel wrappedComboBoxModel) { - this.wrappedComboBoxModel = wrappedComboBoxModel; - } - - - // ********** CachingComboBoxModel implementation ********** - - public void cacheList() { - //do nothing - } - - public void uncacheList() { - //do nothing - } - - public boolean isCached() { - return false; - } - - - // ********** ComboBoxModel implementation ********** - - public void setSelectedItem(Object anItem) { - this.wrappedComboBoxModel.setSelectedItem(anItem); - } - - public Object getSelectedItem() { - return this.wrappedComboBoxModel.getSelectedItem(); - } - - - // ********** ListModel implementation ********** - - public int getSize() { - return this.wrappedComboBoxModel.getSize(); - } - - public Object getElementAt(int index) { - return this.wrappedComboBoxModel.getElementAt(index); - } - - public void addListDataListener(ListDataListener l) { - this.wrappedComboBoxModel.addListDataListener(l); - } - - public void removeListDataListener(ListDataListener l) { - this.wrappedComboBoxModel.removeListDataListener(l); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SimpleDisplayable.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SimpleDisplayable.java deleted file mode 100644 index d10b6b44db..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SimpleDisplayable.java +++ /dev/null @@ -1,170 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.swing; - -import javax.swing.Icon; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; - -/** - * This implementation of Displayable converts any Object - * to a Displayable. Subclass it to override #displayString() and - * #icon() if necessary. Change notification will be fired if the - * object is changed. - * - * This can be used for Strings - the display string - * will simply be the String itself. - */ -public class SimpleDisplayable - extends AbstractModel - implements Displayable -{ - /** The object to be converted to a Displayable. */ - protected Object object; - - - /** - * Construct a displayable for the specified object. - */ - public SimpleDisplayable(Object object) { - super(); - this.object = object; - } - - public SimpleDisplayable(boolean b) { - this(Boolean.valueOf(b)); - } - - public SimpleDisplayable(char c) { - this(Character.valueOf(c)); - } - - public SimpleDisplayable(byte b) { - this(Byte.valueOf(b)); - } - - public SimpleDisplayable(short s) { - this(Short.valueOf(s)); - } - - public SimpleDisplayable(int i) { - this(Integer.valueOf(i)); - } - - public SimpleDisplayable(long l) { - this(Long.valueOf(l)); - } - - public SimpleDisplayable(float f) { - this(Float.valueOf(f)); - } - - public SimpleDisplayable(double d) { - this(Double.valueOf(d)); - } - - - // ********** Displayable implementation ********** - - public String displayString() { - return this.object.toString(); - } - - public Icon icon() { - return null; - } - - - // ********** accessors ********** - - public Object getObject() { - return this.object; - } - - public void setObject(Object object) { - String oldDisplayString = this.displayString(); - Icon oldIcon = this.icon(); - this.object = object; - this.firePropertyChanged(DISPLAY_STRING_PROPERTY, oldDisplayString, this.displayString()); - this.firePropertyChanged(ICON_PROPERTY, oldIcon, this.icon()); - } - - public boolean getBoolean() { - return ((Boolean) this.object).booleanValue(); - } - - public void setBoolean(boolean b) { - this.setObject(Boolean.valueOf(b)); - } - - public char getChar() { - return ((Character) this.object).charValue(); - } - - public void setChar(char c) { - this.setObject(Character.valueOf(c)); - } - - public byte getByte() { - return ((Byte) this.object).byteValue(); - } - - public void setByte(byte b) { - this.setObject(Byte.valueOf(b)); - } - - public short getShort() { - return ((Short) this.object).shortValue(); - } - - public void setShort(short s) { - this.setObject(Short.valueOf(s)); - } - - public int getInt() { - return ((Integer) this.object).intValue(); - } - - public void setInt(int i) { - this.setObject(Integer.valueOf(i)); - } - - public long getLong() { - return ((Long) this.object).longValue(); - } - - public void setLong(long l) { - this.setObject(Long.valueOf(l)); - } - - public float getFloat() { - return ((Float) this.object).floatValue(); - } - - public void setFloat(float f) { - this.setObject(Float.valueOf(f)); - } - - public double getDouble() { - return ((Double) this.object).doubleValue(); - } - - public void setDouble(double d) { - this.setObject(Double.valueOf(d)); - } - - - // ********** override methods ********** - - @Override - public void toString(StringBuilder sb) { - sb.append(this.object); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SimpleListBrowser.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SimpleListBrowser.java deleted file mode 100644 index a600532a12..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SimpleListBrowser.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.swing; - -import javax.swing.Icon; -import javax.swing.JComboBox; -import javax.swing.JOptionPane; -import javax.swing.ListModel; - -/** - * This implementation of ListChooser.Browser uses a - * JOptionPane to prompt the user for the selection. Subclasses - * can change the dialog's title, message, and/or icon. - */ -public class SimpleListBrowser - implements ListChooser.ListBrowser -{ - /** Default constructor */ - protected SimpleListBrowser() { - super(); - } - - /** - * Prompt the user using a JOptionPane. - */ - public void browse(ListChooser chooser) { - Object selection = - JOptionPane.showInputDialog( - chooser, - this.message(chooser), - this.title(chooser), - this.messageType(chooser), - this.icon(chooser), - this.selectionValues(chooser), - this.initialSelectionValue(chooser) - ); - - if (selection != null) { - chooser.getModel().setSelectedItem(selection); - } - } - - protected Object message(@SuppressWarnings("unused") JComboBox comboBox) { - return null; - } - - protected String title(@SuppressWarnings("unused") JComboBox comboBox) { - return null; - } - - protected int messageType(@SuppressWarnings("unused") JComboBox comboBox) { - return JOptionPane.QUESTION_MESSAGE; - } - - protected Icon icon(@SuppressWarnings("unused") JComboBox comboBox) { - return null; - } - - protected Object[] selectionValues(JComboBox comboBox) { - return this.convertToArray(comboBox.getModel()); - } - - protected Object initialSelectionValue(JComboBox comboBox) { - return comboBox.getModel().getSelectedItem(); - } - - /** - * Convert the list of objects in the specified list model - * into an array. - */ - protected Object[] convertToArray(ListModel model) { - int size = model.getSize(); - Object[] result = new Object[size]; - for (int i = 0; i < size; i++) { - result[i] = model.getElementAt(i); - } - return result; - } -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SimpleListCellRenderer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SimpleListCellRenderer.java deleted file mode 100644 index 6bbd290d0f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SimpleListCellRenderer.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.swing; - -import java.awt.Component; -import javax.swing.DefaultListCellRenderer; -import javax.swing.Icon; -import javax.swing.JList; - -/** - * This renderer should behave the same as the DefaultListCellRenderer; - * but it slightly refactors the calculation of the icon and text of the list - * cell so that subclasses can easily override the methods that build - * the icon and text. - * - * In most cases, you need only override: - * #buildIcon(Object value) - * #buildText(Object value) - */ -public class SimpleListCellRenderer - extends DefaultListCellRenderer -{ - - /** - * Construct a simple renderer. - */ - public SimpleListCellRenderer() { - super(); - } - - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - // substitute null for the cell value so nothing is drawn initially... - super.getListCellRendererComponent(list, null, index, isSelected, cellHasFocus); - this.setOpaque(true); - - // ...then set the icon and text manually - this.setIcon(this.buildIcon(list, value, index, isSelected, cellHasFocus)); - this.setText(this.buildText(list, value, index, isSelected, cellHasFocus)); - - this.setToolTipText(this.buildToolTipText(list, value, index, isSelected, cellHasFocus)); - - // the context will be initialized only if a reader is running - if (this.accessibleContext != null) { - this.accessibleContext.setAccessibleName(this.buildAccessibleName(list, value, index, isSelected, cellHasFocus)); - } - - return this; - } - - /** - * Return the icon representation of the specified cell - * value and other settings. (Even more settings are - * accessible via inherited getters: hasFocus, isEnabled, etc.) - */ - protected Icon buildIcon(@SuppressWarnings("unused") JList list, Object value, @SuppressWarnings("unused") int index, @SuppressWarnings("unused") boolean isSelected, @SuppressWarnings("unused") boolean cellHasFocus) { - return this.buildIcon(value); - } - - /** - * Return the icon representation of the specified cell - * value. The default is to display no icon at all unless the - * value itself is an icon. - */ - protected Icon buildIcon(Object value) { - // replicate the default behavior - return (value instanceof Icon) ? (Icon) value : null; - } - - /** - * Return the textual representation of the specified cell - * value and other settings. (Even more settings are - * accessible via inherited getters: hasFocus, isEnabled, etc.) - */ - protected String buildText(@SuppressWarnings("unused") JList list, Object value, @SuppressWarnings("unused") int index, @SuppressWarnings("unused") boolean isSelected, @SuppressWarnings("unused") boolean cellHasFocus) { - return this.buildText(value); - } - - /** - * Return the textual representation of the specified cell - * value. The default is to display the object's default string - * representation (as returned by #toString()); unless the - * value itself is an icon, in which case no text is displayed. - */ - protected String buildText(Object value) { - return (value instanceof Icon) ? "" : ((value == null) ? "" : value.toString()); //$NON-NLS-1$ //$NON-NLS-2$ - } - - /** - * Return the text displayed when the cursor lingers over the specified cell. - * (Even more settings are accessible via inherited getters: hasFocus, isEnabled, etc.) - */ - protected String buildToolTipText(@SuppressWarnings("unused") JList list, Object value, @SuppressWarnings("unused") int index, @SuppressWarnings("unused") boolean isSelected, @SuppressWarnings("unused") boolean cellHasFocus) { - return this.buildToolTipText(value); - } - - /** - * Return the text displayed when the cursor lingers over the specified cell. - */ - protected String buildToolTipText(@SuppressWarnings("unused") Object value) { - return null; - } - - /** - * Return the accessible name to be given to the component used to render - * the given value and other settings. (Even more settings are accessible via - * inherited getters: hasFocus, isEnabled, etc.) - */ - protected String buildAccessibleName(@SuppressWarnings("unused") JList list, Object value, @SuppressWarnings("unused") int index, @SuppressWarnings("unused") boolean isSelected, @SuppressWarnings("unused") boolean cellHasFocus) { - return this.buildAccessibleName(value); - } - - /** - * Return the accessible name to be given to the component used to render - * the given value. - */ - protected String buildAccessibleName(@SuppressWarnings("unused") Object value) { - return null; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SpinnerTableCellRenderer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SpinnerTableCellRenderer.java deleted file mode 100644 index f97ada2066..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/SpinnerTableCellRenderer.java +++ /dev/null @@ -1,186 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.swing; - -import java.awt.Color; -import java.awt.Component; -import javax.swing.BorderFactory; -import javax.swing.JComponent; -import javax.swing.JSpinner; -import javax.swing.JTable; -import javax.swing.SpinnerModel; -import javax.swing.UIManager; -import javax.swing.border.Border; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; - -/** - * Make the cell look like a spinner. - */ -public class SpinnerTableCellRenderer implements TableCellEditorAdapter.Renderer { - - /** the component used to paint the cell */ - protected JSpinner spinner; - - /** the listener to be notified on an immediate edit */ - protected TableCellEditorAdapter.ImmediateEditListener immediateEditListener; - - - // ********** constructors/initialization ********** - - /** - * Construct a cell renderer that uses the default - * spinner model, which is a "number" model. - */ - public SpinnerTableCellRenderer() { - super(); - this.initialize(); - } - - /** - * Construct a cell renderer that uses the specified - * spinner model, which will determine how the values are displayed. - */ - public SpinnerTableCellRenderer(SpinnerModel model) { - this(); - this.setModel(model); - } - - protected void initialize() { - this.spinner = this.buildSpinner(); - } - - protected JSpinner buildSpinner() { - JSpinner s = new JSpinner(); - s.addChangeListener(this.buildChangeListener()); - return s; - } - - private ChangeListener buildChangeListener() { - return new ChangeListener() { - public void stateChanged(ChangeEvent e) { - if (SpinnerTableCellRenderer.this.immediateEditListener != null) { - SpinnerTableCellRenderer.this.immediateEditListener.immediateEdit(); - } - } - }; - } - - - // ********** TableCellRenderer implementation ********** - - public Component getTableCellRendererComponent(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) { - this.spinner.setComponentOrientation(table.getComponentOrientation()); - this.spinner.setFont(table.getFont()); - this.spinner.setEnabled(table.isEnabled()); - - JComponent editor = this.editor(); - editor.setForeground(this.foregroundColor(table, value, selected, hasFocus, row, column)); - editor.setBackground(this.backgroundColor(table, value, selected, hasFocus, row, column)); - this.spinner.setBorder(this.border(table, value, selected, hasFocus, row, column)); - - this.setValue(value); - return this.spinner; - } - - /** - * Return the cell's foreground color. - */ - protected Color foregroundColor(JTable table, @SuppressWarnings("unused") Object value, boolean selected, boolean hasFocus, int row, int column) { - if (selected) { - if (hasFocus && table.isCellEditable(row, column)) { - return UIManager.getColor("Table.focusCellForeground"); //$NON-NLS-1$ - } - return table.getSelectionForeground(); - } - return table.getForeground(); - } - - /** - * Return the cell's background color. - */ - protected Color backgroundColor(JTable table, @SuppressWarnings("unused") Object value, boolean selected, boolean hasFocus, int row, int column) { - if (selected) { - if (hasFocus && table.isCellEditable(row, column)) { - return UIManager.getColor("Table.focusCellBackground"); //$NON-NLS-1$ - } - return table.getSelectionBackground(); - } - return table.getBackground(); - } - - /** - * Return the cell's border. - */ - protected Border border(JTable table, @SuppressWarnings("unused") Object value, boolean selected, boolean hasFocus, @SuppressWarnings("unused") int row, @SuppressWarnings("unused") int column) { - if (hasFocus) { - return UIManager.getBorder("Table.focusCellHighlightBorder"); //$NON-NLS-1$ - } - if (selected) { - return BorderFactory.createLineBorder(table.getSelectionBackground(), 1); - } - return BorderFactory.createLineBorder(table.getBackground(), 1); - } - - /** - * Return the editor component whose colors should be set - * by the renderer. - */ - protected JComponent editor() { - JComponent editor = this.spinner.getEditor(); - if (editor instanceof JSpinner.DefaultEditor) { - // typically, the editor will be the default or one of its subclasses... - editor = ((JSpinner.DefaultEditor) editor).getTextField(); - } - return editor; - } - - /** - * Set the spinner's value - */ - protected void setValue(Object value) { - // CR#3999318 - This null check needs to be removed once JDK bug is fixed - if (value == null) { - value = Integer.valueOf(0); - } - this.spinner.setValue(value); - } - - - // ********** TableCellEditorAdapter.Renderer implementation ********** - - public Object getValue() { - return this.spinner.getValue(); - } - - public void setImmediateEditListener(TableCellEditorAdapter.ImmediateEditListener listener) { - this.immediateEditListener = listener; - } - - - // ********** public API ********** - - /** - * Set the spinner's model. - */ - public void setModel(SpinnerModel model) { - this.spinner.setModel(model); - } - - /** - * Return the renderer's preferred height. This allows you - * to set the row height to something the spinner will look good in.... - */ - public int preferredHeight() { - // add in space for the border top and bottom - return (int) this.spinner.getPreferredSize().getHeight() + 2; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/TableCellEditorAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/TableCellEditorAdapter.java deleted file mode 100644 index bfe82bbf6b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/swing/TableCellEditorAdapter.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.swing; - -import java.awt.Component; -import javax.swing.AbstractCellEditor; -import javax.swing.JTable; -import javax.swing.table.TableCellEditor; -import javax.swing.table.TableCellRenderer; - -/** - * A table cell editor that wraps a table cell renderer. - */ -public class TableCellEditorAdapter extends AbstractCellEditor implements TableCellEditor { - - /** delegate to a renderer */ - private Renderer renderer; - - - // ********** constructors/initialization ********** - - private TableCellEditorAdapter() { - super(); - } - - /** - * Construct a cell editor that behaves like the specified renderer. - */ - public TableCellEditorAdapter(Renderer renderer) { - this(); - this.initialize(renderer); - } - - protected void initialize(Renderer r) { - this.renderer = r; - r.setImmediateEditListener(this.buildImmediateEditListener()); - } - - private ImmediateEditListener buildImmediateEditListener() { - return new ImmediateEditListener() { - public void immediateEdit() { - TableCellEditorAdapter.this.stopCellEditing(); - } - }; - } - - - // ********** CellEditor implementation ********** - - public Object getCellEditorValue() { - return this.renderer.getValue(); - } - - - // ********** TableCellEditor implementation ********** - - public Component getTableCellEditorComponent(JTable table, Object value, boolean selected, int row, int column) { - return this.renderer.getTableCellRendererComponent(table, value, selected, true, row, column); - } - - - // ********** Member classes ********************************************** - - /** - * This interface defines the methods that must be implemented by a renderer - * that can be wrapped by a TableCellEditorAdapter. - */ - public interface Renderer extends TableCellRenderer { - - /** - * Return the current value of the renderer. - */ - Object getValue(); - - /** - * Set the immediate edit listener - */ - void setImmediateEditListener(ImmediateEditListener listener); - } - - - public interface ImmediateEditListener { - - /** - * Called when the renderer does an "immediate edit" - */ - void immediateEdit(); - } -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/AsynchronousSynchronizer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/AsynchronousSynchronizer.java deleted file mode 100644 index da4a234623..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/AsynchronousSynchronizer.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.synchronizers; - -import java.util.concurrent.ThreadFactory; - -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.internal.ConsumerThreadCoordinator; -import org.eclipse.jpt.common.utility.internal.SynchronizedBoolean; -import org.eclipse.jpt.common.utility.synchronizers.Synchronizer; - -/** - * This synchronizer will perform synchronizations in a separate thread, - * allowing calls to {@link Synchronizer#synchronize()} to return immediately. - *

- * NB: The client-supplied command should handle any exceptions - * appropriately (e.g. log the exception and return gracefully so the thread - * can continue the synchronization process). - */ -public class AsynchronousSynchronizer - implements Synchronizer -{ - /** - * This flag is shared with the synchronization/consumer thread. Setting it to true - * will trigger the synchronization to begin or, if the synchronization is - * currently executing, to execute again, once the current execution is - * complete. - */ - final SynchronizedBoolean synchronizeFlag = new SynchronizedBoolean(false); - - /** - * Most of the thread-related behavior is delegated to this coordinator. - */ - private final ConsumerThreadCoordinator consumerThreadCoordinator; - - - // ********** construction ********** - - /** - * Construct an asynchronous synchronizer that uses the specified command to - * perform the synchronization. - * Use simple JDK thread(s) for the synchronization thread(s). - * Allow the synchronization thread(s) to be assigned - * JDK-generated names. - */ - public AsynchronousSynchronizer(Command command) { - this(command, null, null); - } - - /** - * Construct an asynchronous synchronizer that uses the specified command to - * perform the synchronization. - * Use the specified thread factory to construct the synchronization thread(s). - * Allow the synchronization thread(s) to be assigned - * JDK-generated names. - */ - public AsynchronousSynchronizer(Command command, ThreadFactory threadFactory) { - this(command, threadFactory, null); - } - - /** - * Construct an asynchronous synchronizer that uses the specified command to - * perform the synchronization. Assign the synchronization thread(s) the specified - * name. - * Use simple JDK thread(s) for the synchronization thread(s). - */ - public AsynchronousSynchronizer(Command command, String threadName) { - this(command, null, threadName); - } - - /** - * Construct an asynchronous synchronizer that uses the specified command to - * perform the synchronization. - * Use the specified thread factory to construct the synchronization thread(s). - * Assign the synchronization thread(s) the specified - * name. - */ - public AsynchronousSynchronizer(Command command, ThreadFactory threadFactory, String threadName) { - super(); - if (command == null) { - throw new NullPointerException(); - } - this.consumerThreadCoordinator = new ConsumerThreadCoordinator(this.buildConsumer(command), threadFactory, threadName); - } - - ConsumerThreadCoordinator.Consumer buildConsumer(Command command) { - return new Consumer(command); - } - - - // ********** Synchronizer implementation ********** - - /** - * Build and start the synchronization thread, but postpone the first - * synchronization until requested, i.e. via a call to - * {@link #synchronize()}. - *

- * Note: We don't clear the "synchronize" flag here; so if the flag has - * been set before getting here, the first synchronization will - * start promptly (albeit, asynchronously). - * The "synchronize" flag will be set if:

    - *
  • {@link #synchronize()} was called after the synchronizer was - * constructed but before {@link #start()} was called; or - *
  • {@link #synchronize()} was called after {@link #stop()} was called - * but before {@link #start()} was called (to restart the synchronizer); or - *
  • {@link #stop()} was called when there was an outstanding request - * for a synchronization (i.e. the "synchronization" flag was set at - * the time {@link #stop()} was called) - *
- */ - public void start() { - this.consumerThreadCoordinator.start(); - } - - /** - * Set the "synchronize" flag so the synchronization thread will either
    - *
  • if the thread is quiesced, start a synchronization immediately, or - *
  • if the thread is currently executing a synchronization, execute another - * synchronization once the current synchronization is complete - *
- */ - public void synchronize() { - this.synchronizeFlag.setTrue(); - } - - /** - * Interrupt the synchronization thread so that it stops executing at the - * end of the current synchronization. Suspend the current thread until - * the synchronization thread is finished executing. If any uncaught - * exceptions were thrown while the synchronization thread was executing, - * wrap them in a composite exception and throw the composite exception. - */ - public void stop() { - this.consumerThreadCoordinator.stop(); - } - - - // ********** consumer ********** - - /** - * This implementation of {@link ConsumerThreadCoordinator.Consumer} - * will execute the client-supplied "synchronize" command. - * It will wait until the shared "synchronize" flag is set to execute the - * command. Once the comand is executed, the thread will quiesce until - * the flag is set again. If the flag was set during the execution of the - * command (either recursively by the command itself or by another thread), - * the command will be re-executed immediately. Stop the thread by calling - * {@link Thread#interrupt()}. - */ - class Consumer - implements ConsumerThreadCoordinator.Consumer - { - /** - * The client-supplied command that executes on the - * synchronization/consumer thread. - */ - private final Command command; - - Consumer(Command command) { - super(); - this.command = command; - } - - /** - * Wait until the "synchronize" flag is set, - * then clear it and allow the "synchronize" command to execute. - */ - public void waitForProducer() throws InterruptedException { - AsynchronousSynchronizer.this.synchronizeFlag.waitToSetFalse(); - } - - /** - * Execute the client-supplied command. - */ - public void execute() { - this.command.execute(); - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/CallbackAsynchronousSynchronizer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/CallbackAsynchronousSynchronizer.java deleted file mode 100644 index 06af819213..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/CallbackAsynchronousSynchronizer.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.synchronizers; - -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.internal.ConsumerThreadCoordinator; -import org.eclipse.jpt.common.utility.internal.ListenerList; -import org.eclipse.jpt.common.utility.synchronizers.CallbackSynchronizer; - -/** - * Extend the asynchronous synchronizer to notify listeners - * when a synchronization "cycle" is complete; i.e. the synchronization has, - * for the moment, handled every outstanding "synchronize" request and quiesced. - * This notification is not guaranteed to occur with every - * synchronization "cycle"; since other, unrelated, synchronizations can be - * triggered concurrently. - *

- * NB: Listeners should handle any exceptions - * appropriately (e.g. log the exception and return gracefully so the thread - * can continue the synchronization process). - */ -public class CallbackAsynchronousSynchronizer - extends AsynchronousSynchronizer - implements CallbackSynchronizer -{ - private final ListenerList listenerList = new ListenerList(Listener.class); - - - // ********** construction ********** - - /** - * Construct a callback asynchronous synchronizer that uses the specified - * command to perform the synchronization. Allow the synchronization thread(s) - * to be assigned JDK-generated names. - */ - public CallbackAsynchronousSynchronizer(Command command) { - super(command); - } - - /** - * Construct a callback asynchronous synchronizer that uses the specified - * command to perform the synchronization. Assign the synchronization thread(s) - * the specified name. - */ - public CallbackAsynchronousSynchronizer(Command command, String threadName) { - super(command, threadName); - } - - /** - * Build a consumer that will let us know when the synchronization has - * quiesced. - */ - @Override - ConsumerThreadCoordinator.Consumer buildConsumer(Command command) { - return new CallbackConsumer(command); - } - - - // ********** CallbackSynchronizer implementation ********** - - public void addListener(Listener listener) { - this.listenerList.add(listener); - } - - public void removeListener(Listener listener) { - this.listenerList.remove(listener); - } - - /** - * Notify our listeners. - */ - void synchronizationQuiesced() { - for (Listener listener : this.listenerList.getListeners()) { - listener.synchronizationQuiesced(this); - } - } - - - // ********** synchronization thread runnable ********** - - /** - * Extend {@link AsynchronousSynchronizer.Consumer} - * to notify the synchronizer when the synchronization has quiesced - * (i.e. the command has finished executing and there are no further - * requests for synchronization). - * Because synchronization is asynchronous, no other thread will be able to - * initiate another synchronization until the synchronizer's listeners have been - * notified. Note also, the synchronizer's listeners can, themselves, - * trigger another synchronization (by directly or indirectly calling - * {@link org.eclipse.jpt.common.utility.synchronizers.Synchronizer#synchronize()}); - * but this synchronization will not occur until after all the - * listeners have been notified. - */ - class CallbackConsumer - extends Consumer - { - CallbackConsumer(Command command) { - super(command); - } - - @Override - public void execute() { - super.execute(); - // hmmm - we will notify listeners even when we our thread is "interrupted"; - // that seems ok... ~bjv - if (CallbackAsynchronousSynchronizer.this.synchronizeFlag.isFalse()) { - CallbackAsynchronousSynchronizer.this.synchronizationQuiesced(); - } - } - - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/CallbackSynchronousSynchronizer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/CallbackSynchronousSynchronizer.java deleted file mode 100644 index d811067b8b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/CallbackSynchronousSynchronizer.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.synchronizers; - -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.internal.ListenerList; -import org.eclipse.jpt.common.utility.synchronizers.CallbackSynchronizer; - -/** - * Extend the synchronous synchronizer to notify listeners - * when a synchronization "cycle" is complete; i.e. the synchronization has, - * for the moment, handled every "synchronize" request and quiesced. - * This notification is not guaranteed to occur with every - * synchronization "cycle"; - * since other, unrelated, synchronizations can be triggered concurrently. - *

- * NB: If another synchronization is initiated while we are - * notifying the synchronizer's listeners (i.e. the 'again' flag is set), it will not - * start until all the listeners are notified. - * Note also, the synchronizer's listeners can, themselves, - * trigger another synchronization (by directly or indirectly calling - * {@link org.eclipse.jpt.common.utility.synchronizers.Synchronizer#synchronize()}); - * but this synchronization will not occur until after all the - * listeners have been notified. - */ -public class CallbackSynchronousSynchronizer - extends SynchronousSynchronizer - implements CallbackSynchronizer -{ - private final ListenerList listenerList = new ListenerList(Listener.class); - - - // ********** construction ********** - - /** - * Construct a callback synchronous synchronizer that uses the specified - * command to perform the synchronization. - */ - public CallbackSynchronousSynchronizer(Command command) { - super(command); - } - - - // ********** CallbackSynchronizer implementation ********** - - public void addListener(Listener listener) { - this.listenerList.add(listener); - } - - public void removeListener(Listener listener) { - this.listenerList.remove(listener); - } - - /** - * Notify our listeners. - */ - private void synchronizationQuiesced() { - for (Listener listener : this.listenerList.getListeners()) { - listener.synchronizationQuiesced(this); - } - } - - - // ********** override ********** - - @Override - void execute_() { - super.execute_(); - if (this.state.getValue() != State.REPEAT) { - // hmmm - we will notify listeners even when we are "stopped"; - // that seems ok... ~bjv - this.synchronizationQuiesced(); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/SynchronousSynchronizer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/SynchronousSynchronizer.java deleted file mode 100644 index 7a232f6c0b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/internal/synchronizers/SynchronousSynchronizer.java +++ /dev/null @@ -1,263 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.internal.synchronizers; - -import java.util.Vector; -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.internal.CompositeException; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.SynchronizedObject; -import org.eclipse.jpt.common.utility.synchronizers.Synchronizer; - -/** - * This synchronizer will synchronize immediately and not return until the - * synchronization and any nested (recursive) synchronizations are complete. - * In some situations this implementation should be used sparingly, and for as - * short a time as possible, as it increases the probability of deadlocks. A - * deadlock can occur when {@link Synchronizer#synchronize()} is called from multiple - * threads and multiple resources are locked by the synchronization in varying - * orders. - *

- * As defined in the {@link Synchronizer} interface, {@link Synchronizer#start()} - * and {@link Synchronizer#stop()} - * should be called in the same thread, but it is not required. - * {@link Synchronizer#synchronize()} should - * always be called in the same thread (i.e. only recursively, beyond the - * initial call); although, this too is not required. - * This thread need not be the same thread that executes - * {@link Synchronizer#start()} and {@link Synchronizer#stop()}. - */ -public class SynchronousSynchronizer - implements Synchronizer -{ - /** - * The client-supplied command that performs the synchronization. It may - * trigger further calls to {@link #synchronize()} (i.e. the - * synchronization may recurse). - */ - private final Command command; - - /** - * The synchronizer's current state. - */ - final SynchronizedObject state; - - /** - * The synchronizer's initial state is {@link #STOPPED}. - */ - enum State { - STOPPED, - READY, - EXECUTING, - REPEAT, - STOPPING - } - - /** - * A list of the uncaught exceptions thrown by the command. - */ - final Vector exceptions = new Vector(); - - - // ********** construction ********** - - /** - * Construct a synchronous synchronizer that uses the specified command to - * perform the synchronization. - */ - public SynchronousSynchronizer(Command command) { - super(); - if (command == null) { - throw new NullPointerException(); - } - this.command = command; - // use the synchronizer as the mutex so it is freed up by the wait in #stop() - this.state = new SynchronizedObject(State.STOPPED, this); - } - - - // ********** Synchronizer implementation ********** - - /** - * Set the synchronizer's {@link #state} to {@link State#READY READY} - * and execute the first synchronization. Throw an exception if the - * synchronizer is not {@link State#STOPPED STOPPED}. - */ - public synchronized void start() { - switch (this.state.getValue()) { - case STOPPED: - this.state.setValue(State.READY); - this.synchronize(); - break; - case READY: - case EXECUTING: - case REPEAT: - case STOPPING: - default: - throw this.buildIllegalStateException(); - } - } - - /** - * It's possible to come back here if the synchronization command recurses - * and triggers another synchronization. - */ - public void synchronize() { - if (this.beginSynchronization()) { - this.synchronize_(); - } - } - - /** - * A client has requested a synchronization. - * Return whether we can begin a new synchronization. - * If a synchronization is already under way, return false; - * but set the {@link #state} to {@link State#REPEAT REPEAT} - * so another synchronization will occur once the current - * synchronization is complete. - */ - private synchronized boolean beginSynchronization() { - switch (this.state.getValue()) { - case STOPPED: - // synchronization is not allowed - return false; - case READY: - // begin a new synchronization - this.state.setValue(State.EXECUTING); - return true; - case EXECUTING: - // set flag so a new synchronization will occur once the current one is finished - this.state.setValue(State.REPEAT); - return false; - case REPEAT: - // the "repeat" flag is already set - return false; - case STOPPING: - // no further synchronizations are allowed - return false; - default: - throw this.buildIllegalStateException(); - } - } - - /** - * This method should be called only once per set of "recursing" - * synchronizations. Any recursive call to {@link #synchronize()} will - * simply set the {@link #state} to {@link State#REPEAT REPEAT}, - * causing the command to execute again. - */ - private void synchronize_() { - do { - this.execute(); - } while (this.repeatSynchronization()); - } - - /** - * Execute the client-supplied command. Do not allow any unhandled - * exceptions to kill the thread. Store them up for later pain. - */ - private void execute() { - try { - this.execute_(); - } catch (Throwable ex) { - this.exceptions.add(ex); - } - } - - /** - * By default, just execute the command. - */ - void execute_() { - this.command.execute(); - } - - /** - * The current synchronization has finished. - * Return whether we should begin another synchronization. - */ - private synchronized boolean repeatSynchronization() { - switch (this.state.getValue()) { - case STOPPED: - case READY: - throw this.buildIllegalStateException(); - case EXECUTING: - // synchronization has finished and there are no outstanding requests for another; return to "ready" - this.state.setValue(State.READY); - return false; - case REPEAT: - // the "repeat" flag was set; clear it and start another synchronization - this.state.setValue(State.EXECUTING); - return true; - case STOPPING: - // a client has initiated a "stop"; mark the "stop" complete and perform no more synchronizations - this.state.setValue(State.STOPPED); - return false; - default: - throw this.buildIllegalStateException(); - } - } - - /** - * Set the flags so that no further synchronizations occur. If any uncaught - * exceptions were thrown while the synchronization was executing, - * wrap them in a composite exception and throw the composite exception. - */ - public synchronized void stop() { - switch (this.state.getValue()) { - case STOPPED: - throw this.buildIllegalStateException(); - case READY: - // simply return to "stopped" state - this.state.setValue(State.STOPPED); - break; - case EXECUTING: - case REPEAT: - // set the "stopping" flag and wait until the synchronization has finished - this.state.setValue(State.STOPPING); - this.waitUntilStopped(); - break; - case STOPPING: - throw this.buildIllegalStateException(); - default: - throw this.buildIllegalStateException(); - } - - if (this.exceptions.size() > 0) { - Throwable[] temp = this.exceptions.toArray(new Throwable[this.exceptions.size()]); - this.exceptions.clear(); - throw new CompositeException(temp); - } - } - - /** - * This wait will free up the synchronizer's synchronized methods - * (since the synchronizer is the state's mutex). - */ - private void waitUntilStopped() { - try { - this.state.waitUntilValueIs(State.STOPPED); - } catch (InterruptedException ex) { - // the thread that called #stop() was interrupted while waiting - // for the synchronization to finish - ignore; - // 'state' is still set to 'STOPPING', so the #synchronize_() loop - // will still stop - we just won't wait around for it... - } - } - - private IllegalStateException buildIllegalStateException() { - return new IllegalStateException("state: " + this.state); //$NON-NLS-1$ - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.state); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/Model.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/Model.java deleted file mode 100644 index 050cb25eb1..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/Model.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model; - -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; -import org.eclipse.jpt.common.utility.model.listener.TreeChangeListener; - -/** - * Interface to be implemented by models that notify listeners of - * changes to bound properties, collections, lists, and/or trees. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see ChangeListener - * @see StateChangeListener - * @see PropertyChangeListener - * @see CollectionChangeListener - * @see ListChangeListener - * @see TreeChangeListener - * @see org.eclipse.jpt.common.utility.internal.model.AbstractModel - */ -// TODO use objects (IDs?) instead of strings to identify aspects? -public interface Model { - - // ********** change ********** - - /** - * Add a listener that listens to all change events. - * Throw an exception if the same listener is added more than once. - * The listener cannot be null. - */ - void addChangeListener(ChangeListener listener); - - /** - * Remove the specified change listener. - * Throw an exception if the listener is null or if the listener was never added. - */ - void removeChangeListener(ChangeListener listener); - - - // ********** state change ********** - - /** - * Add a listener that listens to all state change events. - * Throw an exception if the same listener is added more than once. - * The listener cannot be null. - */ - void addStateChangeListener(StateChangeListener listener); - - /** - * Remove the specified state change listener. - * Throw an exception if the listener is null or if the listener was never added. - */ - void removeStateChangeListener(StateChangeListener listener); - - - // ********** property change ********** - - /** - * Add a listener that listens to all property change events with - * the specified property name. - * Throw an exception if the same listener is added more than once. - * The listener cannot be null. - */ - void addPropertyChangeListener(String propertyName, PropertyChangeListener listener); - - /** - * Remove a listener that listens to all property change events, - * with the specified property name. - * Throw an exception if the listener is null or if the listener was never added. - */ - void removePropertyChangeListener(String propertyName, PropertyChangeListener listener); - - - // ********** collection change ********** - - /** - * Add a listener that listens to all collection change events with - * the specified collection name. - * Throw an exception if the same listener is added more than once. - * The listener cannot be null. - */ - void addCollectionChangeListener(String collectionName, CollectionChangeListener listener); - - /** - * Remove a listener that listens to all collection change events, - * with the specified collection name. - * Throw an exception if the listener is null or if the listener was never added. - */ - void removeCollectionChangeListener(String collectionName, CollectionChangeListener listener); - - - // ********** list change ********** - - /** - * Add a listener that listens to all list change events with - * the specified list name. - * Throw an exception if the same listener is added more than once. - * The listener cannot be null. - */ - void addListChangeListener(String listName, ListChangeListener listener); - - /** - * Remove a listener that listens to all list change events, - * with the specified list name. - * Throw an exception if the listener is null or if the listener was never added. - */ - void removeListChangeListener(String listName, ListChangeListener listener); - - - // ********** tree change ********** - - /** - * Add a listener that listens to all tree change events with - * the specified tree name. - * Throw an exception if the same listener is added more than once. - * The listener cannot be null. - */ - void addTreeChangeListener(String treeName, TreeChangeListener listener); - - /** - * Remove a listener that listens to all tree change events, - * with the specified tree name. - * Throw an exception if the listener is null or if the listener was never added. - */ - void removeTreeChangeListener(String treeName, TreeChangeListener listener); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ChangeEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ChangeEvent.java deleted file mode 100644 index 9d702bac6c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ChangeEvent.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import java.util.EventObject; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * Abstract class for all the change events that can be fired by models. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public abstract class ChangeEvent extends EventObject { - - private static final long serialVersionUID = 1L; - - - /** - * Construct a new change event. - * - * @param source The object on which the event initially occurred. - */ - protected ChangeEvent(Model source) { - super(source); - } - - /** - * Covariant override. - */ - @Override - public Model getSource() { - return (Model) super.getSource(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - StringTools.buildSimpleToStringOn(this, sb); - sb.append('('); - int len = sb.length(); - this.toString(sb); - if (sb.length() == len) { - sb.deleteCharAt(len - 1); - } else { - sb.append(')'); - } - return sb.toString(); - } - - protected void toString(@SuppressWarnings("unused") StringBuilder sb) { - // subclasses should override this to do something a bit more helpful - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionAddEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionAddEvent.java deleted file mode 100644 index c2a2e7bc9c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionAddEvent.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import java.util.Collection; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A "collection add" event gets delivered whenever a model adds items to a - * "bound" or "constrained" collection. A CollectionAddEvent is sent as an - * argument to the {@link org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -/* - * Design options: - * - create a collection to wrap a single added or removed item - * (this is the option we implemented below and in collaborating code) - * since there is no way to optimize downstream code for - * single items, we take another performance hit by building - * a collection each time (@see Collections#singleton(Object)) - * and forcing downstream code to use an iterator every time - * - * - fire a separate event for each item added or removed - * eliminates any potential for optimizations to downstream code - * - * - add protocol to support both single items and collections - * adds conditional logic to downstream code - */ -public final class CollectionAddEvent extends CollectionEvent { - - /** The items added to the collection. */ - private final Object[] items; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new collection add event. - * - * @param source The object on which the event initially occurred. - * @param collectionName The programmatic name of the collection that was changed. - * @param item The item added to the collection. - */ - public CollectionAddEvent(Model source, String collectionName, Object item) { - this(source, collectionName, new Object[] {item}); - } - - /** - * Construct a new collection add event. - * - * @param source The object on which the event initially occurred. - * @param collectionName The programmatic name of the collection that was changed. - * @param items The items added to the collection. - */ - public CollectionAddEvent(Model source, String collectionName, Collection items) { - this(source, collectionName, items.toArray()); // NPE if 'items' is null - } - - private CollectionAddEvent(Model source, String collectionName, Object[] items) { - super(source, collectionName); - this.items = items; - } - - - // ********** standard state ********** - - /** - * Return the items added to the collection. - */ - public Iterable getItems() { - return new ArrayIterable(this.items); - } - - /** - * Return the number of items added to the collection. - */ - public int getItemsSize() { - return this.items.length; - } - - @Override - protected void toString(StringBuilder sb) { - super.toString(sb); - sb.append(": "); //$NON-NLS-1$ - StringTools.append(sb, this.items); - } - - - // ********** cloning ********** - - /** - * Return a copy of the event with the specified source - * replacing the current source. - */ - public CollectionAddEvent clone(Model newSource) { - return this.clone(newSource, this.collectionName); - } - - /** - * Return a copy of the event with the specified source and collection name - * replacing the current source and collection name. - */ - public CollectionAddEvent clone(Model newSource, String newCollectionName) { - return new CollectionAddEvent(newSource, newCollectionName, this.items); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionChangeEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionChangeEvent.java deleted file mode 100644 index 5c2c75903c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionChangeEvent.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import java.util.Collection; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A "collection change" event gets delivered whenever a model changes a "bound" - * or "constrained" collection in a manner that is not easily characterized by - * the other collection events. - * A CollectionChangeEvent is sent as an - * argument to the {@link org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener}. - * A CollectionChangeEvent is accompanied by the collection name and - * the current state of the collection. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public final class CollectionChangeEvent extends CollectionEvent { - - /** - * The the collection in its current state. - * Clients will need to calculate the necessary changes to synchronize - * with the collection. - */ - private final Object[] collection; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new collection change event. - * - * @param source The object on which the event initially occurred. - * @param collectionName The programmatic name of the collection that was changed. - */ - public CollectionChangeEvent(Model source, String collectionName, Collection collection) { - this(source, collectionName, collection.toArray()); // NPE if 'collection' is null - } - - private CollectionChangeEvent(Model source, String collectionName, Object[] collection) { - super(source, collectionName); - this.collection = collection; - } - - - // ********** standard state ********** - - /** - * Return the current state of the collection. - */ - public Iterable getCollection() { - return new ArrayIterable(this.collection); - } - - /** - * Return the number of items in the current state of the collection. - */ - public int getCollectionSize() { - return this.collection.length; - } - - @Override - protected void toString(StringBuilder sb) { - super.toString(sb); - sb.append(": "); //$NON-NLS-1$ - StringTools.append(sb, this.collection); - } - - - // ********** cloning ********** - - /** - * Return a copy of the event with the specified source - * replacing the current source. - */ - public CollectionChangeEvent clone(Model newSource) { - return this.clone(newSource, this.collectionName); - } - - /** - * Return a copy of the event with the specified source and collection name - * replacing the current source and collection name. - */ - public CollectionChangeEvent clone(Model newSource, String newCollectionName) { - return new CollectionChangeEvent(newSource, newCollectionName, this.collection); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionClearEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionClearEvent.java deleted file mode 100644 index 0fb2adce58..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionClearEvent.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A "collection clear" event gets delivered whenever a model clears - * a "bound" or "constrained" collection. A CollectionClearEvent is sent - * as an argument to the {@link org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public final class CollectionClearEvent extends CollectionEvent { - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new collection clear event. - * - * @param source The object on which the event initially occurred. - * @param collectionName The programmatic name of the collection that was changed. - */ - public CollectionClearEvent(Model source, String collectionName) { - super(source, collectionName); - } - - - // ********** cloning ********** - - /** - * Return a copy of the event with the specified source - * replacing the current source. - */ - public CollectionClearEvent clone(Model newSource) { - return this.clone(newSource, this.collectionName); - } - - /** - * Return a copy of the event with the specified source and collection name - * replacing the current source and collection name. - */ - public CollectionClearEvent clone(Model newSource, String newCollectionName) { - return new CollectionClearEvent(newSource, newCollectionName); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionEvent.java deleted file mode 100644 index d3e0bda965..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionEvent.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import org.eclipse.jpt.common.utility.model.Model; -// TODO add "item/original/nested event" for item changed? -/** - * A "collection" event gets delivered whenever a model changes a "bound" - * or "constrained" collection. A CollectionEvent is sent as an - * argument to the {@link org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener}. - * The intent is that any listener - * can keep itself synchronized with the model's collection via the collection - * events it receives and need not maintain a reference to the original - * collection. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public abstract class CollectionEvent extends ChangeEvent { - - /** Name of the collection that changed. */ - final String collectionName; - - private static final long serialVersionUID = 1L; - - - /** - * Construct a new collection event. - * - * @param source The object on which the event initially occurred. - * @param collectionName The programmatic name of the collection that was changed. - */ - public CollectionEvent(Model source, String collectionName) { - super(source); - if (collectionName == null) { - throw new NullPointerException(); - } - this.collectionName = collectionName; - } - - /** - * Return the programmatic name of the collection that was changed. - */ - public String getCollectionName() { - return this.collectionName; - } - - @Override - protected void toString(StringBuilder sb) { - sb.append(this.collectionName); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionRemoveEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionRemoveEvent.java deleted file mode 100644 index a12218d9b3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/CollectionRemoveEvent.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import java.util.Collection; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A "collection remove" event gets delivered whenever a model removes items - * from a "bound" or "constrained" collection. A CollectionRemoveEvent is sent - * as an argument to the {@link org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -/* - * See design discussion in CollectionAddEvent - */ -public final class CollectionRemoveEvent extends CollectionEvent { - - /** The items removed from the collection. */ - private final Object[] items; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new collection remove event. - * - * @param source The object on which the event initially occurred. - * @param collectionName The programmatic name of the collection that was changed. - * @param item The item removed from the collection. - */ - public CollectionRemoveEvent(Model source, String collectionName, Object item) { - this(source, collectionName, new Object[] {item}); - } - - /** - * Construct a new collection remove event. - * - * @param source The object on which the event initially occurred. - * @param collectionName The programmatic name of the collection that was changed. - * @param items The items removed from the collection. - */ - public CollectionRemoveEvent(Model source, String collectionName, Collection items) { - this(source, collectionName, items.toArray()); // NPE if 'items' is null - } - - private CollectionRemoveEvent(Model source, String collectionName, Object[] items) { - super(source, collectionName); - this.items = items; - } - - - // ********** standard state ********** - - /** - * Return the items removed from the collection. - */ - public Iterable getItems() { - return new ArrayIterable(this.items); - } - - /** - * Return the number of items removed from the collection. - */ - public int getItemsSize() { - return this.items.length; - } - - @Override - protected void toString(StringBuilder sb) { - super.toString(sb); - sb.append(": "); //$NON-NLS-1$ - StringTools.append(sb, this.items); - } - - - // ********** cloning ********** - - /** - * Return a copy of the event with the specified source - * replacing the current source. - */ - public CollectionRemoveEvent clone(Model newSource) { - return this.clone(newSource, this.collectionName); - } - - /** - * Return a copy of the event with the specified source and collection name - * replacing the current source and collection name. - */ - public CollectionRemoveEvent clone(Model newSource, String newCollectionName) { - return new CollectionRemoveEvent(newSource, newCollectionName, this.items); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListAddEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListAddEvent.java deleted file mode 100644 index 900740add7..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListAddEvent.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import java.util.List; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A "list add" event gets delivered whenever a model adds items to a - * "bound" or "constrained" list. A ListAddEvent is sent as an - * argument to the {@link org.eclipse.jpt.common.utility.model.listener.ListChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -/* - * See design discussion in CollectionAddEvent - */ -public final class ListAddEvent extends ListEvent { - - /** The index at which the items were added. */ - private final int index; - - /** The items added to the list. */ - private final Object[] items; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new list add event. - * - * @param source The object on which the event initially occurred. - * @param listName The programmatic name of the list that was changed. - * @param index The index at which the items were added. - * @param item The item added to the list. - */ - public ListAddEvent(Model source, String listName, int index, Object item) { - this(source, listName, index, new Object[] {item}); - } - - /** - * Construct a new list add event. - * - * @param source The object on which the event initially occurred. - * @param listName The programmatic name of the list that was changed. - * @param index The index at which the items were added. - * @param items The items added to the list. - */ - public ListAddEvent(Model source, String listName, int index, List items) { - this(source, listName, index, items.toArray()); // NPE if 'items' is null - } - - private ListAddEvent(Model source, String listName, int index, Object[] items) { - super(source, listName); - this.index = index; - this.items = items; - } - - - // ********** standard state ********** - - /** - * Return the index at which the items were added to the list. - */ - public int getIndex() { - return this.index; - } - - /** - * Return the items added to the list. - */ - public Iterable getItems() { - return new ArrayIterable(this.items); - } - - /** - * Return the number of items added to the list. - */ - public int getItemsSize() { - return this.items.length; - } - - @Override - protected void toString(StringBuilder sb) { - super.toString(sb); - sb.append(": "); //$NON-NLS-1$ - StringTools.append(sb, this.items); - } - - - // ********** cloning ********** - - /** - * Return a copy of the event with the specified source - * replacing the current source. - */ - public ListAddEvent clone(Model newSource) { - return this.clone(newSource, this.listName); - } - - /** - * Return a copy of the event with the specified source and list name - * replacing the current source and list name. - */ - public ListAddEvent clone(Model newSource, String newListName) { - return this.clone(newSource, newListName, 0); - } - - /** - * Return a copy of the event with the specified source and list name - * replacing the current source and list name and displacing - * the index by the specified amount. - */ - public ListAddEvent clone(Model newSource, String newListName, int offset) { - return new ListAddEvent(newSource, newListName, this.index + offset, this.items); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListChangeEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListChangeEvent.java deleted file mode 100644 index ebcf2919c6..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListChangeEvent.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import java.util.List; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A "list change" event gets delivered whenever a model changes a "bound" - * or "constrained" list in a manner that is not easily characterized by - * the other list events. - * A ListChangeEvent is sent as an - * argument to the {@link org.eclipse.jpt.common.utility.model.listener.ListChangeListener}. - * A ListChangeEvent is accompanied by the list name and - * the current state of the list. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public final class ListChangeEvent extends ListEvent { - - /** - * The the list in its current state. - * Clients will need to calculate the necessary changes to synchronize - * with the list. - */ - private final Object[] list; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new list change event. - * - * @param source The object on which the event initially occurred. - * @param listName The programmatic name of the list that was changed. - */ - public ListChangeEvent(Model source, String listName, List list) { - this(source, listName, list.toArray()); // NPE if 'list' is null - } - - private ListChangeEvent(Model source, String listName, Object[] list) { - super(source, listName); - this.list = list; - } - - - // ********** standard state ********** - - /** - * Return the current state of the list. - */ - public Iterable getList() { - return new ArrayIterable(this.list); - } - - /** - * Return the number of items in the current state of the list. - */ - public int getListSize() { - return this.list.length; - } - - @Override - protected void toString(StringBuilder sb) { - super.toString(sb); - sb.append(": "); //$NON-NLS-1$ - StringTools.append(sb, this.list); - } - - - // ********** cloning ********** - - /** - * Return a copy of the event with the specified source - * replacing the current source. - */ - public ListChangeEvent clone(Model newSource) { - return this.clone(newSource, this.listName); - } - - /** - * Return a copy of the event with the specified source and list name - * replacing the current source and list name. - */ - public ListChangeEvent clone(Model newSource, String newListName) { - return new ListChangeEvent(newSource, newListName, this.list); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListClearEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListClearEvent.java deleted file mode 100644 index 8faf558131..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListClearEvent.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A "list clear" event gets delivered whenever a model clears - * a "bound" or "constrained" list. A ListClearEvent is sent - * as an argument to the {@link org.eclipse.jpt.common.utility.model.listener.ListChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public final class ListClearEvent extends ListEvent { - - private static final long serialVersionUID = 1L; - - - // ********** constructor ********** - - /** - * Construct a new list clear event. - * - * @param source The object on which the event initially occurred. - * @param listName The programmatic name of the list that was changed. - */ - public ListClearEvent(Model source, String listName) { - super(source, listName); - } - - - // ********** cloning ********** - - /** - * Return a copy of the event with the specified source - * replacing the current source. - */ - public ListClearEvent clone(Model newSource) { - return this.clone(newSource, this.listName); - } - - /** - * Return a copy of the event with the specified source and list name - * replacing the current source and list name. - */ - public ListClearEvent clone(Model newSource, String newListName) { - return new ListClearEvent(newSource, newListName); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListEvent.java deleted file mode 100644 index acd345845c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListEvent.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import org.eclipse.jpt.common.utility.model.Model; - -// TODO add "item/original/nested event" for item changed? -/** - * A "list" event gets delivered whenever a model changes a "bound" - * or "constrained" list. A ListEvent is sent as an - * argument to the {@link org.eclipse.jpt.common.utility.model.listener.ListChangeListener}. - * The intent is that any listener - * can keep itself synchronized with the model's list via the list - * events it receives and need not maintain a reference to the original - * list. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class ListEvent extends ChangeEvent { - - /** Name of the list that changed. */ - final String listName; - - private static final long serialVersionUID = 1L; - - - /** - * Construct a new list event. - * - * @param source The object on which the event initially occurred. - * @param listName The programmatic name of the list that was changed. - */ - public ListEvent(Model source, String listName) { - super(source); - if (listName == null) { - throw new NullPointerException(); - } - this.listName = listName; - } - - /** - * Return the programmatic name of the list that was changed. - */ - public String getListName() { - return this.listName; - } - - @Override - protected void toString(StringBuilder sb) { - sb.append(this.listName); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListMoveEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListMoveEvent.java deleted file mode 100644 index 4627edb5b3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListMoveEvent.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A "list move" event gets delivered whenever a model moves the elements in - * a "bound" or "constrained" list. A ListMoveEvent is sent - * as an argument to the {@link org.eclipse.jpt.common.utility.model.listener.ListChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public final class ListMoveEvent extends ListEvent { - - /** The index to which the items were moved. */ - private final int targetIndex; - - /** The index from which the items were moved. */ - private final int sourceIndex; - - /** The number of items moved. */ - private final int length; - - private static final long serialVersionUID = 1L; - - - // ********** constructor ********** - - /** - * Construct a new list move event. - * - * @param source The object on which the event initially occurred. - * @param listName The programmatic name of the list that was changed. - * @param targetIndex The index to which the items were moved. - * @param sourceIndex The index from which the items were moved. - * @param length The number of items moved. - */ - public ListMoveEvent(Model source, String listName, int targetIndex, int sourceIndex, int length) { - super(source, listName); - this.targetIndex = targetIndex; - this.sourceIndex = sourceIndex; - this.length = length; - } - - - // ********** standard state ********** - - /** - * Return the index to which the items were moved. - */ - public int getTargetIndex() { - return this.targetIndex; - } - - /** - * Return the index from which the items were moved. - */ - public int getSourceIndex() { - return this.sourceIndex; - } - - /** - * Return the number of items moved. - */ - public int getLength() { - return this.length; - } - - @Override - protected void toString(StringBuilder sb) { - super.toString(sb); - sb.append(": "); //$NON-NLS-1$ - sb.append(this.sourceIndex); - sb.append(" => "); //$NON-NLS-1$ - sb.append(this.targetIndex); - sb.append(" length="); //$NON-NLS-1$ - sb.append(this.length); - } - - - // ********** cloning ********** - - /** - * Return a copy of the event with the specified source - * replacing the current source. - */ - public ListMoveEvent clone(Model newSource) { - return this.clone(newSource, this.listName); - } - - /** - * Return a copy of the event with the specified source and list name - * replacing the current source and list name. - */ - public ListMoveEvent clone(Model newSource, String newListName) { - return this.clone(newSource, newListName, 0); - } - - /** - * Return a copy of the event with the specified source and list name - * replacing the current source and list name and displacing - * the index by the specified amount. - */ - public ListMoveEvent clone(Model newSource, String newListName, int offset) { - return new ListMoveEvent(newSource, newListName, this.targetIndex + offset, this.sourceIndex + offset, this.length); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListRemoveEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListRemoveEvent.java deleted file mode 100644 index 41b82d8ca6..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListRemoveEvent.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import java.util.Collection; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A "list remove" event gets delivered whenever a model removes items - * from a "bound" or "constrained" list. A ListRemoveEvent is sent - * as an argument to the {@link org.eclipse.jpt.common.utility.model.listener.ListChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -/* - * See design discussion in CollectionAddEvent - */ -public final class ListRemoveEvent extends ListEvent { - - /** The index at which the items were removed. */ - private final int index; - - /** The items removed from the list. */ - private final Object[] items; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new list remove event. - * - * @param source The object on which the event initially occurred. - * @param collectionName The programmatic name of the list that was changed. - * @param index The index at which the items were removed. - * @param item The item removed from the list. - */ - public ListRemoveEvent(Model source, String listName, int index, Object item) { - this(source, listName, index, new Object[] {item}); - } - - /** - * Construct a new list remove event. - * - * @param source The object on which the event initially occurred. - * @param collectionName The programmatic name of the list that was changed. - * @param index The index at which the items were removed. - * @param items The items removed from the list. - */ - public ListRemoveEvent(Model source, String listName, int index, Collection items) { - this(source, listName, index, items.toArray()); // NPE if 'items' is null - } - - private ListRemoveEvent(Model source, String listName, int index, Object[] items) { - super(source, listName); - this.index = index; - this.items = items; - } - - - // ********** standard state ********** - - /** - * Return the index at which the items were removed from the list. - */ - public int getIndex() { - return this.index; - } - - /** - * Return the items removed from the list. - */ - public Iterable getItems() { - return new ArrayIterable(this.items); - } - - /** - * Return the number of items removed from the list. - */ - public int getItemsSize() { - return this.items.length; - } - - @Override - protected void toString(StringBuilder sb) { - super.toString(sb); - sb.append(": "); //$NON-NLS-1$ - StringTools.append(sb, this.items); - } - - - // ********** cloning ********** - - /** - * Return a copy of the event with the specified source - * replacing the current source. - */ - public ListRemoveEvent clone(Model newSource) { - return this.clone(newSource, this.listName); - } - - /** - * Return a copy of the event with the specified source and list name - * replacing the current source and list name. - */ - public ListRemoveEvent clone(Model newSource, String newListName) { - return this.clone(newSource, newListName, 0); - } - - /** - * Return a copy of the event with the specified source and list name - * replacing the current source and list name and displacing - * the index by the specified amount. - */ - public ListRemoveEvent clone(Model newSource, String newListName, int offset) { - return new ListRemoveEvent(newSource, newListName, this.index + offset, this.items); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListReplaceEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListReplaceEvent.java deleted file mode 100644 index dd6f3760e0..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/ListReplaceEvent.java +++ /dev/null @@ -1,150 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import java.util.List; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A "list replace" event gets delivered whenever a model replaces items in a - * "bound" or "constrained" list. A ListReplaceEvent is sent as an - * argument to the {@link org.eclipse.jpt.common.utility.model.listener.ListChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public final class ListReplaceEvent extends ListEvent { - - /** The index at which the items were replaced. */ - private final int index; - - /** The new items that replaced the old items in the list. */ - private final Object[] newItems; - - /** The old items that were replaced by the new items in the list. */ - private final Object[] oldItems; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new list replace event for a list of replaced items. - * - * @param source The object on which the event initially occurred. - * @param listName The programmatic name of the list that was changed. - * @param index The index at which the item in the list was replaced. - * @param newItem The new item in the list. - * @param oldItem The old item in the list that were replaced. - */ - public ListReplaceEvent(Model source, String listName, int index, Object newItem, Object oldItem) { - this(source, listName, index, new Object[] {newItem}, new Object[] {oldItem}); - } - - /** - * Construct a new list replace event for a list of replaced items. - * - * @param source The object on which the event initially occurred. - * @param listName The programmatic name of the list that was changed. - * @param index The index at which the items in the list were replaced. - * @param newItems The new items in the list. - * @param oldItems The old items in the list that were replaced. - */ - public ListReplaceEvent(Model source, String listName, int index, List newItems, List oldItems) { - this(source, listName, index, newItems.toArray(), oldItems.toArray()); // NPE if either 'newItems' or 'oldItems' is null - } - - private ListReplaceEvent(Model source, String listName, int index, Object[] newItems, Object[] oldItems) { - super(source, listName); - if (newItems.length != oldItems.length) { - throw new IllegalArgumentException("sizes must match - new items size: " + newItems.length //$NON-NLS-1$ - + " old items size: " + oldItems.length); //$NON-NLS-1$ - } - this.index = index; - this.newItems = newItems; - this.oldItems = oldItems; - } - - - // ********** standard state ********** - - /** - * Return the index at which the items were replaced in the list. - */ - public int getIndex() { - return this.index; - } - - /** - * Return the new items that replaced the old items in the list. - */ - public Iterable getNewItems() { - return new ArrayIterable(this.newItems); - } - - /** - * Return the old items that were replaced by the new items in the list. - */ - public Iterable getOldItems() { - return new ArrayIterable(this.oldItems); - } - - /** - * Return the number of items that were replaced. - */ - public int getItemsSize() { - return this.newItems.length; - } - - @Override - protected void toString(StringBuilder sb) { - super.toString(sb); - sb.append(": "); //$NON-NLS-1$ - StringTools.append(sb, this.oldItems); - sb.append(" => "); //$NON-NLS-1$ - StringTools.append(sb, this.newItems); - } - - - // ********** cloning ********** - - /** - * Return a copy of the event with the specified source - * replacing the current source. - */ - public ListReplaceEvent clone(Model newSource) { - return this.clone(newSource, this.listName); - } - - /** - * Return a copy of the event with the specified source and list name - * replacing the current source and list name. - */ - public ListReplaceEvent clone(Model newSource, String newListName) { - return this.clone(newSource, newListName, 0); - } - - /** - * Return a copy of the event with the specified source and list name - * replacing the current source and list name and displacing - * the index by the specified amount. - */ - public ListReplaceEvent clone(Model newSource, String newListName, int offset) { - return new ListReplaceEvent(newSource, newListName, this.index + offset, this.newItems, this.oldItems); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/PropertyChangeEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/PropertyChangeEvent.java deleted file mode 100644 index 55c7475e85..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/PropertyChangeEvent.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A "property change" event gets delivered whenever a model changes a "bound" - * or "constrained" property. A PropertyChangeEvent is sent as an - * argument to the {@link org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener}. - * A PropertyChangeEvent is accompanied by the old and new values - * of the property. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public final class PropertyChangeEvent extends ChangeEvent { - - /** Name of the property that changed. */ - private final String propertyName; - - /** The property's old value, before the change. */ - private final Object oldValue; - - /** The property's new value, after the change. */ - private final Object newValue; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new property change event. - * - * @param source The object on which the event initially occurred. - * @param propertyName The programmatic name of the property that was changed. - * @param oldValue The old value of the property. - * @param newValue The new value of the property. - */ - public PropertyChangeEvent(Model source, String propertyName, Object oldValue, Object newValue) { - super(source); - if (propertyName == null) { - throw new NullPointerException(); - } - this.propertyName = propertyName; - this.oldValue = oldValue; - this.newValue = newValue; - } - - - // ********** standard state ********** - - /** - * Return the programmatic name of the property that was changed. - */ - public String getPropertyName() { - return this.propertyName; - } - - /** - * Return the old value of the property. - */ - public Object getOldValue() { - return this.oldValue; - } - - /** - * Return the new value of the property. - */ - public Object getNewValue() { - return this.newValue; - } - - @Override - protected void toString(StringBuilder sb) { - sb.append(this.propertyName); - sb.append(": "); //$NON-NLS-1$ - sb.append(this.oldValue); - sb.append(" => "); //$NON-NLS-1$ - sb.append(this.newValue); - } - - - // ********** cloning ********** - - public PropertyChangeEvent clone(Model newSource) { - return new PropertyChangeEvent(newSource, this.propertyName, this.oldValue, this.newValue); - } - - /** - * Return a copy of the event with the specified source and property name - * replacing the current source and property name. - */ - public PropertyChangeEvent clone(Model newSource, String newPropertyName) { - return new PropertyChangeEvent(newSource, newPropertyName, this.oldValue, this.newValue); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/StateChangeEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/StateChangeEvent.java deleted file mode 100644 index fdac399c4b..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/StateChangeEvent.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A generic "state change" event gets delivered whenever a model changes to - * such extent that it cannot be delineated all aspects of it that have changed. - * Any listener can synchronize with the model as necessary since the model is - * available as the event's 'source'. - * A StateChangeEvent is sent as an argument to the - * {@link org.eclipse.jpt.common.utility.model.listener.StateChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public final class StateChangeEvent extends ChangeEvent { - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new state change event. - * - * @param source The object on which the event initially occurred. - */ - public StateChangeEvent(Model source) { - super(source); - } - - - // ********** cloning ********** - - public StateChangeEvent clone(Model newSource) { - return new StateChangeEvent(newSource); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeAddEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeAddEvent.java deleted file mode 100644 index 0550271a5d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeAddEvent.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import java.util.List; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A "tree add" event gets delivered whenever a model adds a node to a "bound" - * or "constrained" tree. A TreeChangeEvent is sent as an - * argument to the {@link org.eclipse.jpt.common.utility.model.listener.TreeChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public final class TreeAddEvent extends TreeEvent { - - /** - * Path to the node added to the tree. - */ - protected final Object[] path; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new tree add event. - * - * @param source The object on which the event initially occurred. - * @param treeName The programmatic name of the tree that was changed. - * @param path The path to the part of the tree that was added. - */ - public TreeAddEvent(Model source, String treeName, List path) { - this(source, treeName, path.toArray()); // NPE if 'path' is null - } - - private TreeAddEvent(Model source, String treeName, Object[] path) { - super(source, treeName); - this.path = path; - } - - - // ********** standard state ********** - - /** - * Return the path to the part of the tree that was added. - */ - public Iterable getPath() { - return new ArrayIterable(this.path); - } - - - // ********** cloning ********** - - public TreeAddEvent clone(Model newSource) { - return this.clone(newSource, this.treeName); - } - - /** - * Return a copy of the event with the specified source and tree name - * replacing the current source and tree name. - */ - public TreeAddEvent clone(Model newSource, String newTreeName) { - return new TreeAddEvent(newSource, newTreeName, this.path); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeChangeEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeChangeEvent.java deleted file mode 100644 index 7ad7e03db5..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeChangeEvent.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import java.util.Collection; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A "tree change" event gets delivered whenever a model changes a "bound" - * or "constrained" tree in a manner that is not easily characterized by - * the other tree events. - * A TreeChangeEvent is sent as an - * argument to the {@link org.eclipse.jpt.common.utility.model.listener.TreeChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public final class TreeChangeEvent extends TreeEvent { - - /** - * The current nodes in the changed tree. - */ - protected final Object[] nodes; - - private static final long serialVersionUID = 1L; - - - // ********** constructor ********** - - /** - * Construct a new tree change event. - * - * @param source The object on which the event initially occurred. - * @param treeName The programmatic name of the tree that was changed. - * @param nodes The current nodes in the changed tree. - */ - public TreeChangeEvent(Model source, String treeName, Collection nodes) { - this(source, treeName, nodes.toArray()); // NPE if 'nodes' is null - } - - private TreeChangeEvent(Model source, String treeName, Object[] nodes) { - super(source, treeName); - this.nodes = nodes; - } - - - // ********** standard state ********** - - /** - * Return the current nodes in the changed tree. - */ - public Iterable getNodes() { - return new ArrayIterable(this.nodes); - } - - /** - * Return the current nodes in the changed tree. - */ - public int getNodesSize() { - return this.nodes.length; - } - - - // ********** cloning ********** - - public TreeChangeEvent clone(Model newSource) { - return this.clone(newSource, this.treeName); - } - - /** - * Return a copy of the event with the specified source and tree name - * replacing the current source and tree name. - */ - public TreeChangeEvent clone(Model newSource, String newTreeName) { - return new TreeChangeEvent(newSource, newTreeName, this.nodes); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeClearEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeClearEvent.java deleted file mode 100644 index 6d96568a7f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeClearEvent.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A "tree clear" event gets delivered whenever a model clears - * a "bound" or "constrained" tree. A TreeClearEvent is sent - * as an argument to the {@link org.eclipse.jpt.common.utility.model.listener.TreeChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public final class TreeClearEvent extends TreeEvent { - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new tree clear event. - * - * @param source The object on which the event initially occurred. - * @param collectionName The programmatic name of the tree that was changed. - */ - public TreeClearEvent(Model source, String treeName) { - super(source, treeName); - } - - - // ********** cloning ********** - - /** - * Return a copy of the event with the specified source - * replacing the current source. - */ - public TreeClearEvent clone(Model newSource) { - return this.clone(newSource, this.treeName); - } - - /** - * Return a copy of the event with the specified source and collection name - * replacing the current source and collection name. - */ - public TreeClearEvent clone(Model newSource, String newCollectionName) { - return new TreeClearEvent(newSource, newCollectionName); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeEvent.java deleted file mode 100644 index e57777aef1..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeEvent.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A "tree" event gets delivered whenever a model changes a "bound" - * or "constrained" tree. A TreeEvent is sent as an - * argument to the {@link org.eclipse.jpt.common.utility.model.listener.TreeChangeListener}. - * The intent is that any listener - * can keep itself synchronized with the model's tree via the tree events - * it receives and need not maintain a reference to the original tree. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public abstract class TreeEvent extends ChangeEvent { - - /** Name of the tree that changed. */ - final String treeName; - - private static final long serialVersionUID = 1L; - - - /** - * Construct a new tree event. - * - * @param source The object on which the event initially occurred. - * @param treeName The programmatic name of the tree that was changed. - */ - public TreeEvent(Model source, String treeName) { - super(source); - if (treeName == null) { - throw new NullPointerException(); - } - this.treeName = treeName; - } - - /** - * Return the programmatic name of the tree that was changed. - */ - public String getTreeName() { - return this.treeName; - } - - @Override - protected void toString(StringBuilder sb) { - sb.append(this.treeName); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeRemoveEvent.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeRemoveEvent.java deleted file mode 100644 index afa3157678..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/event/TreeRemoveEvent.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.event; - -import java.util.List; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * A "tree remove" event gets delivered whenever a model removes a node rom a - * "bound" or "constrained" tree. A TreeChangeEvent is sent as an - * argument to the {@link org.eclipse.jpt.common.utility.model.listener.TreeChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public final class TreeRemoveEvent extends TreeEvent { - - /** - * Path to the node removed from the tree. - */ - protected final Object[] path; - - private static final long serialVersionUID = 1L; - - - // ********** constructors ********** - - /** - * Construct a new tree remove event. - * - * @param source The object on which the event initially occurred. - * @param treeName The programmatic name of the tree that was changed. - * @param path The path to the part of the tree that was removed. - */ - public TreeRemoveEvent(Model source, String treeName, List path) { - this(source, treeName, path.toArray()); // NPE if 'path' is null - } - - private TreeRemoveEvent(Model source, String treeName, Object[] path) { - super(source, treeName); - this.path = path; - } - - - // ********** standard state ********** - - /** - * Return the path to the part of the tree that was removed. - */ - public Iterable getPath() { - return new ArrayIterable(this.path); - } - - - // ********** cloning ********** - - public TreeRemoveEvent clone(Model newSource) { - return this.clone(newSource, this.treeName); - } - - /** - * Return a copy of the event with the specified source and tree name - * replacing the current source and tree name. - */ - public TreeRemoveEvent clone(Model newSource, String newTreeName) { - return new TreeRemoveEvent(newSource, newTreeName, this.path); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ChangeAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ChangeAdapter.java deleted file mode 100644 index 51dcbd0391..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ChangeAdapter.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; - -/** - * Convenience implementation of {@link ChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class ChangeAdapter implements ChangeListener { - - // ***** state - public void stateChanged(StateChangeEvent event) { - // do nothing - } - - // ***** property - public void propertyChanged(PropertyChangeEvent event) { - // do nothing - } - - // ***** collection - public void itemsAdded(CollectionAddEvent event) { - // do nothing - } - - public void itemsRemoved(CollectionRemoveEvent event) { - // do nothing - } - - public void collectionCleared(CollectionClearEvent event) { - // do nothing - } - - public void collectionChanged(CollectionChangeEvent event) { - // do nothing - } - - // ***** list - public void itemsAdded(ListAddEvent event) { - // do nothing - } - - public void itemsRemoved(ListRemoveEvent event) { - // do nothing - } - - public void itemsReplaced(ListReplaceEvent event) { - // do nothing - } - - public void itemsMoved(ListMoveEvent event) { - // do nothing - } - - public void listCleared(ListClearEvent event) { - // do nothing - } - - public void listChanged(ListChangeEvent event) { - // do nothing - } - - // ***** tree - public void nodeAdded(TreeAddEvent event) { - // do nothing - } - - public void nodeRemoved(TreeRemoveEvent event) { - // do nothing - } - - public void treeCleared(TreeClearEvent event) { - // do nothing - } - - public void treeChanged(TreeChangeEvent event) { - // do nothing - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ChangeListener.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ChangeListener.java deleted file mode 100644 index c5c6203fac..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ChangeListener.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -/** - * General purpose change listener. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ChangeListener - extends StateChangeListener, PropertyChangeListener, CollectionChangeListener, ListChangeListener, TreeChangeListener -{ - // combine the other listener interfaces -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CollectionChangeAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CollectionChangeAdapter.java deleted file mode 100644 index 99ca881f23..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CollectionChangeAdapter.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; - -/** - * Convenience implementation of {@link CollectionChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class CollectionChangeAdapter implements CollectionChangeListener { - - /** - * Default constructor. - */ - public CollectionChangeAdapter() { - super(); - } - - public void itemsAdded(CollectionAddEvent event) { - // do nothing - } - - public void itemsRemoved(CollectionRemoveEvent event) { - // do nothing - } - - public void collectionCleared(CollectionClearEvent event) { - // do nothing - } - - public void collectionChanged(CollectionChangeEvent event) { - // do nothing - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CollectionChangeListener.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CollectionChangeListener.java deleted file mode 100644 index a8ff66487c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CollectionChangeListener.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -import java.util.EventListener; - -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; - -/** - * A "collection change" event gets fired whenever a model changes a "bound" - * collection. You can register a CollectionChangeListener with a source - * model so as to be notified of any bound collection updates. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface CollectionChangeListener extends EventListener { - - /** - * This method gets called when items are added to a bound collection. - * - * @param event An event describing the event source, - * the collection that changed, and the items that were added. - */ - void itemsAdded(CollectionAddEvent event); - - /** - * This method gets called when items are removed from a bound collection. - * - * @param event An event describing the event source, - * the collection that changed, and the items that were removed. - */ - void itemsRemoved(CollectionRemoveEvent event); - - /** - * This method gets called when a bound collection is cleared. - * - * @param event An event describing the event source - * and the collection that changed. - */ - void collectionCleared(CollectionClearEvent event); - - /** - * This method gets called when a bound collection is changed in a manner - * that is not easily characterized by the other methods in this interface. - * - * @param event An event describing the event source - * and the collection that changed. - */ - void collectionChanged(CollectionChangeEvent event); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CommandChangeListener.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CommandChangeListener.java deleted file mode 100644 index 5b3fd4a76f..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/CommandChangeListener.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -import org.eclipse.jpt.common.utility.Command; - -/** - * Convenience implementation of {@link ChangeListener}. - * All change notifications are funneled through a single command. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class CommandChangeListener - extends SimpleChangeListener -{ - protected final Command command; - - /** - * Construct a change listener that executes the specified command whenever - * it receives any change notification from the model to which it is added - * as a listener. - */ - public CommandChangeListener(Command command) { - super(); - this.command = command; - } - - @Override - protected void modelChanged() { - this.command.execute(); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ListChangeAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ListChangeAdapter.java deleted file mode 100644 index a2b85b47f7..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ListChangeAdapter.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; - -/** - * Convenience implementation of {@link ListChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class ListChangeAdapter implements ListChangeListener { - - /** - * Default constructor. - */ - public ListChangeAdapter() { - super(); - } - - public void itemsAdded(ListAddEvent event) { - // do nothing - } - - public void itemsRemoved(ListRemoveEvent event) { - // do nothing - } - - public void itemsReplaced(ListReplaceEvent event) { - // do nothing - } - - public void itemsMoved(ListMoveEvent event) { - // do nothing - } - - public void listCleared(ListClearEvent event) { - // do nothing - } - - public void listChanged(ListChangeEvent event) { - // do nothing - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ListChangeListener.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ListChangeListener.java deleted file mode 100644 index 0680c551bb..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ListChangeListener.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -import java.util.EventListener; - -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; - -/** - * A "list change" event gets fired whenever a model changes a "bound" - * list. You can register a ListChangeListener with a source - * model so as to be notified of any bound list updates. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ListChangeListener extends EventListener { - - /** - * This method gets called when items are added to a bound list. - * - * @param event An event describing the event source, - * the list that changed, the items that were added, and the index - * at which the items were added. - */ - void itemsAdded(ListAddEvent event); - - /** - * This method gets called when items are removed from a bound list. - * - * @param event An event describing the event source, - * the list that changed, the items that were removed, and the index - * at which the items were removed. - */ - void itemsRemoved(ListRemoveEvent event); - - /** - * This method gets called when items in a bound list are replaced. - * - * @param event An event describing the event source, - * the list that changed, the items that were added, the items that were - * replaced, and the index at which the items were replaced. - */ - void itemsReplaced(ListReplaceEvent event); - - /** - * This method gets called when items in a bound list are moved. - * - * @param event An event describing the event source, - * the list that changed, and the indices of where items were moved - * from and to. - */ - void itemsMoved(ListMoveEvent event); - - /** - * This method gets called when a bound list is cleared. - * - * @param event A ListClearEvent object describing the event source - * and the list that changed. - */ - void listCleared(ListClearEvent event); - - /** - * This method gets called when a bound list is changed in a manner - * that is not easily characterized by the other methods in this interface. - * - * @param event A ListChangeEvent object describing the event source - * and the list that changed. - */ - void listChanged(ListChangeEvent event); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/MultiMethodReflectiveChangeListener.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/MultiMethodReflectiveChangeListener.java deleted file mode 100644 index 45762bf06c..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/MultiMethodReflectiveChangeListener.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -import java.lang.reflect.Method; - -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; - -/** - * This class is used by {@link ReflectiveChangeListener} when the requested listener - * needs to implement multiple methods (i.e. {@link CollectionChangeListener}, - * {@link ListChangeListener}, or {@link TreeChangeListener}). - */ -class MultiMethodReflectiveChangeListener - extends ReflectiveChangeListener - implements CollectionChangeListener, ListChangeListener, TreeChangeListener -{ - /** the methods we will invoke on the target object */ - private final Method addMethod; - private final Method removeMethod; - private final Method replaceMethod; // this can be null - private final Method moveMethod; // this can be null - private final Method clearMethod; - private final Method changeMethod; - - - /** - * The "replace" and "move" methods are optional. - */ - MultiMethodReflectiveChangeListener(Object target, Method addMethod, Method removeMethod, Method replaceMethod, Method moveMethod, Method clearMethod, Method changeMethod) { - super(target); - this.addMethod = addMethod; - this.removeMethod = removeMethod; - this.replaceMethod = replaceMethod; - this.moveMethod = moveMethod; - this.clearMethod = clearMethod; - this.changeMethod = changeMethod; - } - - /** - * No "replace" or "move" methods. - */ - MultiMethodReflectiveChangeListener(Object target, Method addMethod, Method removeMethod, Method clearMethod, Method changeMethod) { - this(target, addMethod, removeMethod, null, null, clearMethod, changeMethod); - } - - - // ********** CollectionChangeListener implementation ********** - - private void invoke(Method method, CollectionEvent event) { - if (method.getParameterTypes().length == 0) { - ReflectionTools.executeMethod(method, this.target, EMPTY_OBJECT_ARRAY); - } else { - ReflectionTools.executeMethod(method, this.target, new CollectionEvent[] {event}); - } - } - - public void itemsAdded(CollectionAddEvent event) { - this.invoke(this.addMethod, event); - } - - public void itemsRemoved(CollectionRemoveEvent event) { - this.invoke(this.removeMethod, event); - } - - public void collectionCleared(CollectionClearEvent event) { - this.invoke(this.clearMethod, event); - } - - public void collectionChanged(CollectionChangeEvent event) { - this.invoke(this.changeMethod, event); - } - - - // ********** ListChangeListener implementation ********** - - private void invoke(Method method, ListEvent event) { - if (method.getParameterTypes().length == 0) { - ReflectionTools.executeMethod(method, this.target, EMPTY_OBJECT_ARRAY); - } else { - ReflectionTools.executeMethod(method, this.target, new ListEvent[] {event}); - } - } - - public void itemsAdded(ListAddEvent event) { - this.invoke(this.addMethod, event); - } - - public void itemsRemoved(ListRemoveEvent event) { - this.invoke(this.removeMethod, event); - } - - public void itemsReplaced(ListReplaceEvent event) { - this.invoke(this.replaceMethod, event); - } - - public void itemsMoved(ListMoveEvent event) { - this.invoke(this.moveMethod, event); - } - - public void listCleared(ListClearEvent event) { - this.invoke(this.clearMethod, event); - } - - public void listChanged(ListChangeEvent event) { - this.invoke(this.changeMethod, event); - } - - - // ********** TreeChangeListener implementation ********** - - private void invoke(Method method, TreeEvent event) { - if (method.getParameterTypes().length == 0) { - ReflectionTools.executeMethod(method, this.target, EMPTY_OBJECT_ARRAY); - } else { - ReflectionTools.executeMethod(method, this.target, new TreeEvent[] {event}); - } - } - - public void nodeAdded(TreeAddEvent event) { - this.invoke(this.addMethod, event); - } - - public void nodeRemoved(TreeRemoveEvent event) { - this.invoke(this.removeMethod, event); - } - - public void treeCleared(TreeClearEvent event) { - this.invoke(this.clearMethod, event); - } - - public void treeChanged(TreeChangeEvent event) { - this.invoke(this.changeMethod, event); - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/PropertyChangeAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/PropertyChangeAdapter.java deleted file mode 100644 index c492353133..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/PropertyChangeAdapter.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; - -/** - * Convenience implementation of {@link PropertyChangeListener}. - * This is probably of limited use, since there only a single method to implement; - * maybe as a null implementation. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class PropertyChangeAdapter implements PropertyChangeListener { - - public void propertyChanged(PropertyChangeEvent event) { - // do nothing - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/PropertyChangeListener.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/PropertyChangeListener.java deleted file mode 100644 index 4bb488f14a..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/PropertyChangeListener.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -import java.util.EventListener; - -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; - -/** - * A "property change" event gets fired whenever a model changes a "bound" - * property. You can register a PropertyChangeListener with a source - * model so as to be notified of any bound property updates. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface PropertyChangeListener extends EventListener { - - /** - * This method gets called when a model has changed a bound property. - * - * @param event An event describing the event source - * and the property's old and new values. - */ - void propertyChanged(PropertyChangeEvent event); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ReflectiveChangeListener.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ReflectiveChangeListener.java deleted file mode 100644 index 8a24cd5073..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/ReflectiveChangeListener.java +++ /dev/null @@ -1,377 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -import java.lang.reflect.Method; - -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.model.event.ChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; - -/** - * This factory builds listeners that reflectively forward change events. - * If you are worried about having too many little classes that have to be - * loaded and maintained by the class loader, you can use one of these. - * Of course, this comes with the additional overhead of reflection.... - * Also note that the validity of the method name is not checked at compile - * time, but at runtime; although we do check the method as soon as the - * listener is instantiated. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public abstract class ReflectiveChangeListener { - - /** the target object on which we will invoke the method */ - protected final Object target; - - - protected static final Class STATE_CHANGE_EVENT_CLASS = StateChangeEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] STATE_CHANGE_EVENT_CLASS_ARRAY = new Class[] {STATE_CHANGE_EVENT_CLASS}; - - - protected static final Class PROPERTY_CHANGE_EVENT_CLASS = PropertyChangeEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] PROPERTY_CHANGE_EVENT_CLASS_ARRAY = new Class[] {PROPERTY_CHANGE_EVENT_CLASS}; - - - protected static final Class COLLECTION_EVENT_CLASS = CollectionEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] COLLECTION_EVENT_CLASS_ARRAY = new Class[] {COLLECTION_EVENT_CLASS}; - - protected static final Class COLLECTION_ADD_EVENT_CLASS = CollectionAddEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] COLLECTION_ADD_EVENT_CLASS_ARRAY = new Class[] {COLLECTION_ADD_EVENT_CLASS}; - - protected static final Class COLLECTION_REMOVE_EVENT_CLASS = CollectionRemoveEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] COLLECTION_REMOVE_EVENT_CLASS_ARRAY = new Class[] {COLLECTION_REMOVE_EVENT_CLASS}; - - protected static final Class COLLECTION_CLEAR_EVENT_CLASS = CollectionClearEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] COLLECTION_CLEAR_EVENT_CLASS_ARRAY = new Class[] {COLLECTION_CLEAR_EVENT_CLASS}; - - protected static final Class COLLECTION_CHANGE_EVENT_CLASS = CollectionChangeEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] COLLECTION_CHANGE_EVENT_CLASS_ARRAY = new Class[] {COLLECTION_CHANGE_EVENT_CLASS}; - - - protected static final Class LIST_EVENT_CLASS = ListEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] LIST_EVENT_CLASS_ARRAY = new Class[] {LIST_EVENT_CLASS}; - - protected static final Class LIST_ADD_EVENT_CLASS = ListAddEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] LIST_ADD_EVENT_CLASS_ARRAY = new Class[] {LIST_ADD_EVENT_CLASS}; - - protected static final Class LIST_REMOVE_EVENT_CLASS = ListRemoveEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] LIST_REMOVE_EVENT_CLASS_ARRAY = new Class[] {LIST_REMOVE_EVENT_CLASS}; - - protected static final Class LIST_REPLACE_EVENT_CLASS = ListReplaceEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] LIST_REPLACE_EVENT_CLASS_ARRAY = new Class[] {LIST_REPLACE_EVENT_CLASS}; - - protected static final Class LIST_MOVE_EVENT_CLASS = ListMoveEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] LIST_MOVE_EVENT_CLASS_ARRAY = new Class[] {LIST_MOVE_EVENT_CLASS}; - - protected static final Class LIST_CLEAR_EVENT_CLASS = ListClearEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] LIST_CLEAR_EVENT_CLASS_ARRAY = new Class[] {LIST_CLEAR_EVENT_CLASS}; - - protected static final Class LIST_CHANGE_EVENT_CLASS = ListChangeEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] LIST_CHANGE_EVENT_CLASS_ARRAY = new Class[] {LIST_CHANGE_EVENT_CLASS}; - - - protected static final Class TREE_EVENT_CLASS = TreeEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] TREE_EVENT_CLASS_ARRAY = new Class[] {TREE_EVENT_CLASS}; - - protected static final Class TREE_ADD_EVENT_CLASS = TreeAddEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] TREE_ADD_EVENT_CLASS_ARRAY = new Class[] {TREE_ADD_EVENT_CLASS}; - - protected static final Class TREE_REMOVE_EVENT_CLASS = TreeRemoveEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] TREE_REMOVE_EVENT_CLASS_ARRAY = new Class[] {TREE_REMOVE_EVENT_CLASS}; - - protected static final Class TREE_CLEAR_EVENT_CLASS = TreeClearEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] TREE_CLEAR_EVENT_CLASS_ARRAY = new Class[] {TREE_CLEAR_EVENT_CLASS}; - - protected static final Class TREE_CHANGE_EVENT_CLASS = TreeChangeEvent.class; - @SuppressWarnings("unchecked") - protected static final Class[] TREE_CHANGE_EVENT_CLASS_ARRAY = new Class[] {TREE_CHANGE_EVENT_CLASS}; - - protected static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; - - - // ********** helper methods ********** - - /** - * Find and return a method implemented by the target that can be invoked - * reflectively when a change event occurs. - */ - private static Method findChangeListenerMethod(Object target, String methodName, Class[] eventClassArray) { - try { - return ReflectionTools.getMethod(target, methodName, eventClassArray); - } catch (RuntimeException ex1) { - return ReflectionTools.getMethod(target, methodName); - } - } - - /** - * Check whether the specified method is suitable for being invoked when a - * change event has occurred. Throw an exception if it is not suitable. - */ - private static void checkChangeListenerMethod(Method method, Class eventClass) { - Class[] parmTypes = method.getParameterTypes(); - int parmTypesLength = parmTypes.length; - if (parmTypesLength == 0) { - return; - } - if ((parmTypesLength == 1) && parmTypes[0].isAssignableFrom(eventClass)) { - return; - } - throw new IllegalArgumentException(method.toString()); - } - - - // ********** factory methods: StateChangeListener ********** - - /** - * Construct a state change listener that will invoke the specified method - * on the specified target. - */ - public static StateChangeListener buildStateChangeListener(Object target, Method method) { - checkChangeListenerMethod(method, STATE_CHANGE_EVENT_CLASS); - return new SingleMethodReflectiveChangeListener(target, method); - } - - /** - * Construct a state change listener that will invoke the specified method - * on the specified target. If a single-argument method with the specified - * name and appropriate argument is found, it will be invoked; otherwise, - * a zero-argument method with the specified name will be invoked. - */ - public static StateChangeListener buildStateChangeListener(Object target, String methodName) { - return buildStateChangeListener(target, findChangeListenerMethod(target, methodName, STATE_CHANGE_EVENT_CLASS_ARRAY)); - } - - - // ********** factory methods: PropertyChangeListener ********** - - /** - * Construct a property change listener that will invoke the specified method - * on the specified target. - */ - public static PropertyChangeListener buildPropertyChangeListener(Object target, Method method) { - checkChangeListenerMethod(method, PROPERTY_CHANGE_EVENT_CLASS); - return new SingleMethodReflectiveChangeListener(target, method); - } - - /** - * Construct a property change listener that will invoke the specified method - * on the specified target. If a single-argument method with the specified - * name and appropriate argument is found, it will be invoked; otherwise, - * a zero-argument method with the specified name will be invoked. - */ - public static PropertyChangeListener buildPropertyChangeListener(Object target, String methodName) { - return buildPropertyChangeListener(target, findChangeListenerMethod(target, methodName, PROPERTY_CHANGE_EVENT_CLASS_ARRAY)); - } - - - // ********** factory methods: CollectionChangeListener ********** - - /** - * Construct a collection change listener that will invoke the specified methods - * on the specified target. - */ - public static CollectionChangeListener buildCollectionChangeListener(Object target, Method addMethod, Method removeMethod, Method clearMethod, Method changeMethod) { - checkChangeListenerMethod(addMethod, COLLECTION_ADD_EVENT_CLASS); - checkChangeListenerMethod(removeMethod, COLLECTION_REMOVE_EVENT_CLASS); - checkChangeListenerMethod(clearMethod, COLLECTION_CLEAR_EVENT_CLASS); - checkChangeListenerMethod(changeMethod, COLLECTION_CHANGE_EVENT_CLASS); - return new MultiMethodReflectiveChangeListener(target, addMethod, removeMethod, clearMethod, changeMethod); - } - - /** - * Construct a collection change listener that will invoke the specified method - * on the specified target for any change event. - */ - public static CollectionChangeListener buildCollectionChangeListener(Object target, Method method) { - return buildCollectionChangeListener(target, method, method, method, method); - } - - /** - * Construct a collection change listener that will invoke the specified methods - * on the specified target for change events. If a single-argument method - * with the specified name and appropriate argument is found, it will be invoked; - * otherwise, a zero-argument method with the specified name will be invoked. - */ - public static CollectionChangeListener buildCollectionChangeListener(Object target, String addMethodName, String removeMethodName, String clearMethodName, String changeMethodName) { - return buildCollectionChangeListener( - target, - findChangeListenerMethod(target, addMethodName, COLLECTION_ADD_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, removeMethodName, COLLECTION_REMOVE_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, clearMethodName, COLLECTION_CLEAR_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, changeMethodName, COLLECTION_CHANGE_EVENT_CLASS_ARRAY) - ); - } - - /** - * Construct a collection change listener that will invoke the specified method - * on the specified target for any change event. If a single-argument method - * with the specified name and appropriate argument is found, it will be invoked; - * otherwise, a zero-argument method with the specified name will be invoked. - */ - public static CollectionChangeListener buildCollectionChangeListener(Object target, String methodName) { - return buildCollectionChangeListener(target, findChangeListenerMethod(target, methodName, COLLECTION_EVENT_CLASS_ARRAY)); - } - - - // ********** factory methods: ListChangeListener ********** - - /** - * Construct a list change listener that will invoke the specified methods - * on the specified target. - */ - public static ListChangeListener buildListChangeListener(Object target, Method addMethod, Method removeMethod, Method replaceMethod, Method moveMethod, Method clearMethod, Method changeMethod) { - checkChangeListenerMethod(addMethod, LIST_ADD_EVENT_CLASS); - checkChangeListenerMethod(removeMethod, LIST_REMOVE_EVENT_CLASS); - checkChangeListenerMethod(replaceMethod, LIST_REPLACE_EVENT_CLASS); - checkChangeListenerMethod(moveMethod, LIST_MOVE_EVENT_CLASS); - checkChangeListenerMethod(clearMethod, LIST_CLEAR_EVENT_CLASS); - checkChangeListenerMethod(changeMethod, LIST_CHANGE_EVENT_CLASS); - return new MultiMethodReflectiveChangeListener(target, addMethod, removeMethod, replaceMethod, moveMethod, clearMethod, changeMethod); - } - - /** - * Construct a list change listener that will invoke the specified method - * on the specified target for any change event. - */ - public static ListChangeListener buildListChangeListener(Object target, Method method) { - return buildListChangeListener(target, method, method, method, method, method, method); - } - - /** - * Construct a list change listener that will invoke the specified methods - * on the specified target for change events. If a single-argument method - * with the specified name and appropriate argument is found, it will be invoked; - * otherwise, a zero-argument method with the specified name will be invoked. - */ - public static ListChangeListener buildListChangeListener(Object target, String addMethodName, String removeMethodName, String replaceMethodName, String moveMethodName, String clearMethodName, String changeMethodName) { - return buildListChangeListener( - target, - findChangeListenerMethod(target, addMethodName, LIST_ADD_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, removeMethodName, LIST_REMOVE_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, replaceMethodName, LIST_REPLACE_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, moveMethodName, LIST_MOVE_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, clearMethodName, LIST_CLEAR_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, changeMethodName, LIST_CHANGE_EVENT_CLASS_ARRAY) - ); - } - - /** - * Construct a list change listener that will invoke the specified method - * on the specified target for any change event. If a single-argument method - * with the specified name and appropriate argument is found, it will be invoked; - * otherwise, a zero-argument method with the specified name will be invoked. - */ - public static ListChangeListener buildListChangeListener(Object target, String methodName) { - return buildListChangeListener(target, findChangeListenerMethod(target, methodName, LIST_EVENT_CLASS_ARRAY)); - } - - - // ********** factory methods: TreeChangeListener ********** - - /** - * Construct a tree change listener that will invoke the specified methods - * on the specified target. - */ - public static TreeChangeListener buildTreeChangeListener(Object target, Method addMethod, Method removeMethod, Method clearMethod, Method changeMethod) { - checkChangeListenerMethod(addMethod, TREE_ADD_EVENT_CLASS); - checkChangeListenerMethod(removeMethod, TREE_REMOVE_EVENT_CLASS); - checkChangeListenerMethod(clearMethod, TREE_CLEAR_EVENT_CLASS); - checkChangeListenerMethod(changeMethod, TREE_CHANGE_EVENT_CLASS); - return new MultiMethodReflectiveChangeListener(target, addMethod, removeMethod, clearMethod, changeMethod); - } - - /** - * Construct a tree change listener that will invoke the specified method - * on the specified target for any change event. - */ - public static TreeChangeListener buildTreeChangeListener(Object target, Method method) { - return buildTreeChangeListener(target, method, method, method, method); - } - - /** - * Construct a tree change listener that will invoke the specified methods - * on the specified target for change events. If a single-argument method - * with the specified name and appropriate argument is found, it will be invoked; - * otherwise, a zero-argument method with the specified name will be invoked. - */ - public static TreeChangeListener buildTreeChangeListener(Object target, String addMethodName, String removeMethodName, String clearMethodName, String changeMethodName) { - return buildTreeChangeListener( - target, - findChangeListenerMethod(target, addMethodName, TREE_ADD_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, removeMethodName, TREE_REMOVE_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, clearMethodName, TREE_CLEAR_EVENT_CLASS_ARRAY), - findChangeListenerMethod(target, changeMethodName, TREE_CHANGE_EVENT_CLASS_ARRAY) - ); - } - - /** - * Construct a tree change listener that will invoke the specified method - * on the specified target for any change event. If a single-argument method - * with the specified name and appropriate argument is found, it will be invoked; - * otherwise, a zero-argument method with the specified name will be invoked. - */ - public static TreeChangeListener buildTreeChangeListener(Object target, String methodName) { - return buildTreeChangeListener(target, findChangeListenerMethod(target, methodName, TREE_EVENT_CLASS_ARRAY)); - } - - - // ********** constructor ********** - - /** - * Construct a listener that will invoke the specified method - * on the specified target. - */ - protected ReflectiveChangeListener(Object target) { - super(); - this.target = target; - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/SimpleChangeListener.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/SimpleChangeListener.java deleted file mode 100644 index cc82b775bf..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/SimpleChangeListener.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -import org.eclipse.jpt.common.utility.model.event.ChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; - -/** - * Convenience abstract implementation of {@link ChangeListener}. - * All change notifications are funneled through a single method. - * This class can be used by - * subclassing it and overriding either {@link #modelChanged(ChangeEvent)} - * (if access to the event is required) or {@link #modelChanged()} (if access - * to the event is not required). - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public abstract class SimpleChangeListener - implements ChangeListener -{ - public SimpleChangeListener() { - super(); - } - - public void stateChanged(StateChangeEvent event) { - this.modelChanged(event); - } - - public void propertyChanged(PropertyChangeEvent event) { - this.modelChanged(event); - } - - public void collectionChanged(CollectionChangeEvent event) { - this.modelChanged(event); - } - - public void collectionCleared(CollectionClearEvent event) { - this.modelChanged(event); - } - - public void itemsAdded(CollectionAddEvent event) { - this.modelChanged(event); - } - - public void itemsRemoved(CollectionRemoveEvent event) { - this.modelChanged(event); - } - - public void itemsAdded(ListAddEvent event) { - this.modelChanged(event); - } - - public void itemsMoved(ListMoveEvent event) { - this.modelChanged(event); - } - - public void itemsRemoved(ListRemoveEvent event) { - this.modelChanged(event); - } - - public void itemsReplaced(ListReplaceEvent event) { - this.modelChanged(event); - } - - public void listChanged(ListChangeEvent event) { - this.modelChanged(event); - } - - public void listCleared(ListClearEvent event) { - this.modelChanged(event); - } - - public void nodeAdded(TreeAddEvent event) { - this.modelChanged(event); - } - - public void nodeRemoved(TreeRemoveEvent event) { - this.modelChanged(event); - } - - public void treeChanged(TreeChangeEvent event) { - this.modelChanged(event); - } - - public void treeCleared(TreeClearEvent event) { - this.modelChanged(event); - } - - /** - * The model has notified the listener of the change described by the - * specified change event. By default the listener executes {@link #modelChanged()}. - */ - protected void modelChanged(@SuppressWarnings("unused") ChangeEvent event) { - this.modelChanged(); - } - - /** - * The model has notified the listener of a change. - * By default the listener throws an exception. - */ - protected void modelChanged() { - throw new RuntimeException("This method was not overridden."); //$NON-NLS-1$ - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/SingleMethodReflectiveChangeListener.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/SingleMethodReflectiveChangeListener.java deleted file mode 100644 index 146e75ffd3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/SingleMethodReflectiveChangeListener.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -import java.lang.reflect.Method; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; - -/** - * This class is used by {@link ReflectiveChangeListener} when the requested listener - * need only implement a single method (i.e. {@link StateChangeListener} or - * {@link PropertyChangeListener}). - */ -class SingleMethodReflectiveChangeListener - extends ReflectiveChangeListener - implements StateChangeListener, PropertyChangeListener -{ - - /** the method we will invoke on the target object */ - private final Method method; - /** cache the number of arguments */ - private final boolean methodIsZeroArgument; - - SingleMethodReflectiveChangeListener(Object target, Method method) { - super(target); - this.method = method; - this.methodIsZeroArgument = method.getParameterTypes().length == 0; - } - - - // ********** StateChangeListener implementation ********** - - public void stateChanged(StateChangeEvent event) { - if (this.methodIsZeroArgument) { - ReflectionTools.executeMethod(this.method, this.target, EMPTY_OBJECT_ARRAY); - } else { - ReflectionTools.executeMethod(this.method, this.target, new StateChangeEvent[] {event}); - } - } - - - // ********** PropertyChangeListener implementation ********** - - public void propertyChanged(PropertyChangeEvent event) { - if (this.methodIsZeroArgument) { - ReflectionTools.executeMethod(this.method, this.target, EMPTY_OBJECT_ARRAY); - } else { - ReflectionTools.executeMethod(this.method, this.target, new PropertyChangeEvent[] {event}); - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/StateChangeAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/StateChangeAdapter.java deleted file mode 100644 index 3cc5f185f2..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/StateChangeAdapter.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; - -/** - * Convenience implementation of {@link StateChangeListener}. - * This is probably of limited use, since there only a single method to implement; - * maybe as a null implementation. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class StateChangeAdapter implements StateChangeListener { - - public void stateChanged(StateChangeEvent event) { - // do nothing - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/StateChangeListener.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/StateChangeListener.java deleted file mode 100644 index f9c599edee..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/StateChangeListener.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -import java.util.EventListener; - -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; - -/** - * A generic "state change" event gets delivered whenever a model changes to - * such extent that it cannot be delineated all aspects of it that have changed. - * You can register a StateChangeListener with a source model so as to be notified - * of any such changes. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface StateChangeListener extends EventListener { - - /** - * This method gets called when a model has changed in some general fashion. - * - * @param event An event describing the event source. - */ - void stateChanged(StateChangeEvent event); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/TreeChangeAdapter.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/TreeChangeAdapter.java deleted file mode 100644 index 8d7ccee3d4..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/TreeChangeAdapter.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; - -/** - * Convenience implementation of {@link TreeChangeListener}. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public class TreeChangeAdapter implements TreeChangeListener { - - /** - * Default constructor. - */ - public TreeChangeAdapter() { - super(); - } - - public void nodeAdded(TreeAddEvent event) { - // do nothing - } - - public void nodeRemoved(TreeRemoveEvent event) { - // do nothing - } - - public void treeCleared(TreeClearEvent event) { - // do nothing - } - - public void treeChanged(TreeChangeEvent event) { - // do nothing - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/TreeChangeListener.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/TreeChangeListener.java deleted file mode 100644 index de8c898fb5..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/listener/TreeChangeListener.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.listener; - -import java.util.EventListener; - -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; - -/** - * A "tree change" event gets fired whenever a model changes a "bound" - * tree. You can register a TreeChangeListener with a source - * model so as to be notified of any bound tree updates. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface TreeChangeListener extends EventListener { - - /** - * This method gets called when a node is added to a bound tree. - * - * @param event An event describing the event source, - * the tree that changed, and the path to the node that was added. - */ - void nodeAdded(TreeAddEvent event); - - /** - * This method gets called when a node is removed from a bound tree. - * - * @param event An event describing the event source, - * the tree that changed, and the path to the node that was removed. - */ - void nodeRemoved(TreeRemoveEvent event); - - /** - * This method gets called when a bound tree is cleared. - * - * @param event An event describing the event source, - * the tree that changed, and an empty path. - */ - void treeCleared(TreeClearEvent event); - - /** - * This method gets called when a portion of a bound tree is changed in - * a manner that is not easily characterized by the other methods in this - * interface. - * - * @param event An event describing the event source, - * the tree that changed, and the current state of the - * tree that changed. - */ - void treeChanged(TreeChangeEvent event); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/CollectionValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/CollectionValueModel.java deleted file mode 100644 index d7adf509aa..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/CollectionValueModel.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.value; - -import java.util.Iterator; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * Interface used to abstract collection accessing and - * change notification and make it more pluggable. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @param the type of values held by the model - */ -public interface CollectionValueModel - extends Model, Iterable -{ - - /** - * Return the collection's values. - */ - Iterator iterator(); - String VALUES = "values"; //$NON-NLS-1$ - - /** - * Return the size of the collection. - */ - int size(); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/ListValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/ListValueModel.java deleted file mode 100644 index 16d88283b8..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/ListValueModel.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.value; - -import java.util.Iterator; -import java.util.ListIterator; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * Interface used to abstract list accessing and - * change notification and make it more pluggable. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @param the type of values held by the list model - */ -public interface ListValueModel - extends Model, Iterable -{ - /** - * Return the list's values. - */ - Iterator iterator(); - String LIST_VALUES = "list values"; //$NON-NLS-1$ - - /** - * Return the list's values. - */ - ListIterator listIterator(); - - /** - * Return the size of the list. - */ - int size(); - - /** - * Return the item at the specified index of the list. - */ - E get(int index); - - /** - * Return the list's values. - */ - Object[] toArray(); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/PropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/PropertyValueModel.java deleted file mode 100644 index 180be43f1d..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/PropertyValueModel.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.value; - -import org.eclipse.jpt.common.utility.model.Model; - -/** - * Interface used to abstract property accessing and - * change notification and make it more pluggable. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @param the type of value held by the model - */ -public interface PropertyValueModel - extends Model -{ - - /** - * Return the property's value. - */ - T getValue(); - String VALUE = "value"; //$NON-NLS-1$ - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/TreeNodeValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/TreeNodeValueModel.java deleted file mode 100644 index f9281b00e9..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/TreeNodeValueModel.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.value; - -/** - * Extend {@link WritablePropertyValueModel} to better support - * {@link org.eclipse.jpt.common.utility.internal.model.value.swing.TreeModelAdapter}. - *

- * Implementors of this interface should fire a "state change" event - * whenever the node's internal state changes in a way that the - * tree listeners should be notified. - *

- * Implementors of this interface should also fire a "value property change" - * event whenever the node's value changes. Typically, only nodes that - * hold "primitive" data will fire this event. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @param the type of values held by the model - * - * @see org.eclipse.jpt.common.utility.internal.model.value.AbstractTreeNodeValueModel - */ -public interface TreeNodeValueModel - extends WritablePropertyValueModel -{ - - /** - * Return the node's parent node; null if the node - * is the root. - */ - TreeNodeValueModel parent(); - - /** - * Return the path to the node. - */ - TreeNodeValueModel[] path(); - - /** - * Return a list value model of the node's child nodes. - */ - ListValueModel> childrenModel(); - - /** - * Return the node's child at the specified index. - */ - TreeNodeValueModel child(int index); - - /** - * Return the size of the node's list of children. - */ - int childrenSize(); - - /** - * Return the index in the node's list of children of the specified child. - */ - int indexOfChild(TreeNodeValueModel child); - - /** - * Return whether the node is a leaf (i.e. it has no children) - */ - boolean isLeaf(); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/TreeValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/TreeValueModel.java deleted file mode 100644 index 7a3e44d765..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/TreeValueModel.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.value; - -import java.util.Iterator; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * Interface used to abstract tree accessing and - * change notification and make it more pluggable. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @param the type of values held by the model - */ -public interface TreeValueModel - extends Model -{ - /** - * Return the tree's nodes. - */ - Iterator nodes(); - String NODES = "nodes"; //$NON-NLS-1$ - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/WritableCollectionValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/WritableCollectionValueModel.java deleted file mode 100644 index 6fe5fa7bc1..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/WritableCollectionValueModel.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.value; - -/** - * Extend {@link CollectionValueModel} to allow the setting of the - * collection's values. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @param the type of values held by the model - */ -public interface WritableCollectionValueModel - extends CollectionValueModel -{ - - /** - * Set the values and fire a collection change notification. - * @see CollectionValueModel#VALUES - */ - void setValues(Iterable values); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/WritableListValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/WritableListValueModel.java deleted file mode 100644 index df8e5366b9..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/WritableListValueModel.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.value; - -/** - * Extend {@link ListValueModel} to allow the setting of the - * lists's values. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @param the type of values held by the model - */ -public interface WritableListValueModel - extends ListValueModel -{ - - /** - * Set the list values and fire a list change notification. - * @see ListValueModel#LIST_VALUES - */ - void setListValues(Iterable values); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/WritablePropertyValueModel.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/WritablePropertyValueModel.java deleted file mode 100644 index fe35c351f2..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/model/value/WritablePropertyValueModel.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.model.value; - -/** - * Extend {@link PropertyValueModel} to allow the setting of the property's value. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @param the type of value held by the model - */ -public interface WritablePropertyValueModel - extends PropertyValueModel -{ - - /** - * Set the value and fire a property change notification. - * @see PropertyValueModel#VALUE - */ - void setValue(T value); - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/synchronizers/CallbackSynchronizer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/synchronizers/CallbackSynchronizer.java deleted file mode 100644 index 029227a8c7..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/synchronizers/CallbackSynchronizer.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.synchronizers; - -import java.io.Serializable; -import java.util.EventListener; - -/** - * Extend {@link Synchronizer} to notify listeners - * when a synchronization "cycle" is complete; i.e. the synchronization has, - * for the moment, quiesced. - */ -public interface CallbackSynchronizer - extends Synchronizer -{ - /** - * Add the specified listener to be notified whenever the synchronizer has - * quiesced. - * @see #removeListener(Listener) - */ - void addListener(Listener listener); - - /** - * Remove the specified listener. - * @see #addListener(Listener) - */ - void removeListener(Listener listener); - - - // ********** listener ********** - - /** - * Interface implemented by listeners to be notified whenever the - * synchronizer has quiesced. - */ - public interface Listener - extends EventListener - { - /** - * The specified synchronizer has quiesced. - */ - void synchronizationQuiesced(CallbackSynchronizer synchronizer); - } - - - /** - * Singleton implementation of the {@link CallbackSynchronizer} interface that will do - * nothing. - */ - final class Null implements CallbackSynchronizer, Serializable { - public static final CallbackSynchronizer INSTANCE = new Null(); - public static CallbackSynchronizer instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - public void start() { - // do nothing - } - public void synchronize() { - // do nothing - } - public void stop() { - // do nothing - } - public void addListener(Listener listener) { - // do nothing - } - public void removeListener(Listener listener) { - // do nothing - } - @Override - public String toString() { - return "CallbackSynchronizer.Null"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - -} diff --git a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/synchronizers/Synchronizer.java b/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/synchronizers/Synchronizer.java deleted file mode 100644 index 230fb86eb3..0000000000 --- a/common/plugins/org.eclipse.jpt.common.utility/src/org/eclipse/jpt/common/utility/synchronizers/Synchronizer.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.synchronizers; - -import java.io.Serializable; - -/** - * This interface defines the protocol for starting, stopping, and executing a - * long-running, repeatable, and possibly recursive "synchronization" process. - * The intent is for the synchronizer to synchronize a "secondary" model with - * a "primary" model. Any change to the "primary" model will trigger the - * synchronization. The synchronizer implementation will determine whether the - * "secondary" model remains in sync synchronously or asynchronously. - *

- * The assumption is that the {@link #start()} and {@link #stop()} methods will be called from - * a single master thread that would control the synchronizer's lifecycle and - * the {@link #synchronize()} method will be called multiple times, possibly from - * multiple threads. - */ -public interface Synchronizer { - - /** - * Enable the synchronizer to allow future synchronizations as requested - * by calls to {@link #synchronize()}. - */ - void start(); - - /** - * Synchronize the dependent model with the primary model. Do nothing if - * {@link #start()} has not previously been called. Do nothing if {@link #stop} - * has been called (without any intermediate call to {@link #start()}. - */ - void synchronize(); - - /** - * Stop the synchronizer immediately or, if a synchronization is currently - * in progress, when it completes. Return when the synchronizer is stopped. - * No further synchonizations will performed until {@link #start()} is called. - */ - void stop(); - - - /** - * Singleton implementation of the {@link Synchronizer} interface that will do - * nothing. - */ - final class Null implements Synchronizer, Serializable { - public static final Synchronizer INSTANCE = new Null(); - public static Synchronizer instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - public void start() { - // do nothing - } - public void synchronize() { - // do nothing - } - public void stop() { - // do nothing - } - @Override - public String toString() { - return "Synchronizer.Null"; //$NON-NLS-1$ - } - private static final long serialVersionUID = 1L; - private Object readResolve() { - // replace this object with the singleton - return INSTANCE; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.core.tests/.classpath b/common/tests/org.eclipse.jpt.common.core.tests/.classpath deleted file mode 100644 index e5feab661b..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/.classpath +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/common/tests/org.eclipse.jpt.common.core.tests/.project b/common/tests/org.eclipse.jpt.common.core.tests/.project deleted file mode 100644 index 0839d137f9..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.jpt.common.core.tests - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/common/tests/org.eclipse.jpt.common.core.tests/.settings/org.eclipse.jdt.core.prefs b/common/tests/org.eclipse.jpt.common.core.tests/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 1a95809005..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Tue Jan 25 12:48:40 EST 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -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/common/tests/org.eclipse.jpt.common.core.tests/META-INF/MANIFEST.MF b/common/tests/org.eclipse.jpt.common.core.tests/META-INF/MANIFEST.MF deleted file mode 100644 index 728ab395c7..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/META-INF/MANIFEST.MF +++ /dev/null @@ -1,20 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.common.core.tests;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Bundle-ActivationPolicy: lazy -Require-Bundle: org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)", - org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jpt.common.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)", - org.eclipse.jpt.common.utility.tests;bundle-version="[2.0.0,3.0.0)", - org.eclipse.wst.common.project.facet.core;bundle-version="[1.3.0,2.0.0)", - org.junit;bundle-version="3.8.0" -Export-Package: org.eclipse.jpt.common.core.tests.internal;x-internal:=true, - org.eclipse.jpt.common.core.tests.internal.projects;x-internal:=true, - org.eclipse.jpt.common.core.tests.internal.utility.jdt;x-internal:=true diff --git a/common/tests/org.eclipse.jpt.common.core.tests/about.html b/common/tests/org.eclipse.jpt.common.core.tests/about.html deleted file mode 100644 index be534ba44f..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/about.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

May 02, 2008

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- - - diff --git a/common/tests/org.eclipse.jpt.common.core.tests/build.properties b/common/tests/org.eclipse.jpt.common.core.tests/build.properties deleted file mode 100644 index 320b3f239d..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/build.properties +++ /dev/null @@ -1,18 +0,0 @@ -################################################################################ -# Copyright (c) 2011 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ -javacSource = 1.5 -javacTarget = 1.5 -bin.includes = .,\ - META-INF/,\ - about.html,\ - test.xml,\ - plugin.properties -source.. = src/ -output.. = bin/ diff --git a/common/tests/org.eclipse.jpt.common.core.tests/plugin.properties b/common/tests/org.eclipse.jpt.common.core.tests/plugin.properties deleted file mode 100644 index b22b820267..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/plugin.properties +++ /dev/null @@ -1,23 +0,0 @@ -################################################################################ -# Copyright (c) 2011 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ -# ==================================================================== -# 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=Dali Java Persistence Tools - Common Core Tests -providerName=Eclipse Web Tools Platform diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/JptCommonCoreTests.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/JptCommonCoreTests.java deleted file mode 100644 index 93596840d1..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/JptCommonCoreTests.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.tests.internal; - -import junit.framework.Test; -import junit.framework.TestSuite; -import org.eclipse.jpt.common.core.tests.internal.utility.jdt.JptCommonCoreUtilityJdtTests; - -public class JptCommonCoreTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptCommonCoreTests.class.getPackage().getName()); - suite.addTest(JptCommonCoreUtilityJdtTests.suite()); - return suite; - } - - private JptCommonCoreTests() { - super(); - throw new UnsupportedOperationException(); - } -} diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/projects/TestFacetedProject.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/projects/TestFacetedProject.java deleted file mode 100644 index a2ba74b0b3..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/projects/TestFacetedProject.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.tests.internal.projects; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -/** - * This builds and holds a "faceted" project. - * Support for installing facets. - */ -public class TestFacetedProject extends TestPlatformProject { - private final IFacetedProject facetedProject; - - - // ********** builders ***************************** - - public static TestFacetedProject buildFacetedProject(String baseProjectName, boolean autoBuild) - throws CoreException { - return new TestFacetedProject(baseProjectName, autoBuild); - } - - - // ********** constructors/initialization ********** - - public TestFacetedProject(String projectName) throws CoreException { - this(projectName, true); - } - - public TestFacetedProject(String projectName, boolean autoBuild) throws CoreException { - super(projectName, autoBuild); - this.facetedProject = this.createFacetedProject(); - } - - private IFacetedProject createFacetedProject() throws CoreException { - return ProjectFacetsManager.create(this.getProject(), true, null); // true = "convert if necessary" - } - - - // ********** public methods ********** - - public IFacetedProject getFacetedProject() { - return this.facetedProject; - } - - public void installFacet(String facetName, String versionName) throws CoreException { - this.installFacet(facetName, versionName, null); - } - - public void uninstallFacet(String facetName, String versionName) throws CoreException { - this.uninstallFacet(facetName, versionName, null); - } - - /** - * if 'config' is null (and 'facetName' is "jpt.jpa"), the JPA project will be built with the defaults - * defined in JpaFacetInstallDataModelProvider#getDefaultProperty(String) - * In JPA the config object will be an IDataModel - * In JAXB the config object will be a JaxbFacetInstallConfig - */ - public void installFacet(String facetName, String versionName, Object config) throws CoreException { - this.facetedProject.installProjectFacet(this.facetVersion(facetName, versionName), config, null); - } - - /** - * In JPA the config object will be an IDataModel - * In JAXB the config object will be a JaxbFacetUninstallConfig - */ - public void uninstallFacet(String facetName, String versionName, Object config) throws CoreException { - this.facetedProject.uninstallProjectFacet(this.facetVersion(facetName, versionName), config, null); - } - - private IProjectFacetVersion facetVersion(String facetName, String versionName) { - return ProjectFacetsManager.getProjectFacet(facetName).getVersion(versionName); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/projects/TestJavaProject.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/projects/TestJavaProject.java deleted file mode 100644 index 7ea7e3813a..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/projects/TestJavaProject.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.tests.internal.projects; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.ICompilationUnit; -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.jpt.common.utility.internal.ArrayTools; - -/** - * This builds and holds a "Java" project. - * Support for adding packages and types. - * - * "Java" projects aren't required to be "faceted" projects, but for JPA - * testing they are. - */ -@SuppressWarnings("nls") -public class TestJavaProject extends TestFacetedProject { - private final IJavaProject javaProject; - private final IPackageFragmentRoot sourceFolder; - - - // ********** builders ***************************** - - public static TestJavaProject buildJavaProject(String baseProjectName, boolean autoBuild) - throws CoreException { - return new TestJavaProject(baseProjectName, autoBuild); - } - - - // ********** constructors/initialization ********** - - public TestJavaProject(String projectName) throws CoreException { - this(projectName, false); - } - - public TestJavaProject(String projectName, boolean autoBuild) throws CoreException { - super(projectName, autoBuild); - this.installFacet("jst.java", "5.0"); - this.javaProject = JavaCore.create(this.getProject()); - this.sourceFolder = this.javaProject.getPackageFragmentRoot(this.getProject().getFolder("src")); - } - - public void addJar(String jarPath) throws JavaModelException { - this.addClasspathEntry(JavaCore.newLibraryEntry(new Path(jarPath), null, null)); - } - - private void addClasspathEntry(IClasspathEntry entry) throws JavaModelException { - this.javaProject.setRawClasspath(ArrayTools.add(this.javaProject.getRawClasspath(), entry), null); - } - - - // ********** public methods ********** - - public IJavaProject getJavaProject() { - return this.javaProject; - } - - public IPackageFragment createPackage(String packageName) throws CoreException { - return this.sourceFolder.createPackageFragment(packageName, false, null); // false = "no force" - } - - /** - * The source should NOT contain a package declaration; - * it will be added here. - */ - public ICompilationUnit createCompilationUnit(String packageName, String compilationUnitName, String source) throws CoreException { - return this.createCompilationUnit(this.createPackage(packageName), compilationUnitName, new SimpleSourceWriter(source)); - } - - /** - * The source should NOT contain a package declaration; - * it will be added here. - */ - public ICompilationUnit createCompilationUnit(String packageName, String compilationUnitName, SourceWriter sourceWriter) throws CoreException { - return this.createCompilationUnit(this.createPackage(packageName), compilationUnitName, sourceWriter); - } - - /** - * The source should NOT contain a package declaration; - * it will be added here. - */ - public ICompilationUnit createCompilationUnit(IPackageFragment packageFragment, String compilationUnitName, SourceWriter sourceWriter) throws CoreException { - StringBuilder sb = new StringBuilder(2000); - sourceWriter.appendSourceTo(sb); - String source = sb.toString(); - return packageFragment.createCompilationUnit(compilationUnitName, source, false, null); // false = "no force" - } - - - // ********** member classes ********** - - public interface SourceWriter { - void appendSourceTo(StringBuilder sb); - } - - public class SimpleSourceWriter implements SourceWriter { - private final String source; - public SimpleSourceWriter(String source) { - super(); - this.source = source; - } - public void appendSourceTo(StringBuilder sb) { - sb.append(this.source); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/projects/TestPlatformProject.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/projects/TestPlatformProject.java deleted file mode 100644 index 1c9c2dfa16..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/projects/TestPlatformProject.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.tests.internal.projects; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IProjectDescription; -import org.eclipse.core.resources.IWorkspaceDescription; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * This builds and holds a "general" Eclipse project. - * Support for adding natures, folders, and files. - */ -public class TestPlatformProject { - private final IProject project; - - /** carriage return */ - public static final String CR = StringTools.CR; - - - // ********** builders ********** - - public static TestPlatformProject buildPlatformProject(String baseProjectName, boolean autoBuild) - throws CoreException { - return new TestPlatformProject(baseProjectName, autoBuild); - } - - - // ********** constructors/initialization ********** - - public TestPlatformProject(String projectName, boolean autoBuild) throws CoreException { - super(); - this.setAutoBuild(autoBuild); // workspace-wide setting - this.project = this.buildPlatformProject(projectName); - } - - private void setAutoBuild(boolean autoBuild) throws CoreException { - IWorkspaceDescription description = ResourcesPlugin.getWorkspace().getDescription(); - description.setAutoBuilding(autoBuild); - ResourcesPlugin.getWorkspace().setDescription(description); - } - - private IProject buildPlatformProject(String projectName) throws CoreException { - IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - p.create(null); - p.open(null); - return p; - } - - - // ********** public methods ********** - - public IProject getProject() { - return this.project; - } - - public void addProjectNature(String natureID) throws CoreException { - IProjectDescription description = this.project.getDescription(); - description.setNatureIds(ArrayTools.add(description.getNatureIds(), natureID)); - this.project.setDescription(description, null); - } - - public void removeProjectNature(String natureID) throws CoreException { - IProjectDescription description = this.project.getDescription(); - description.setNatureIds(ArrayTools.removeAllOccurrences(description.getNatureIds(), natureID)); - this.project.setDescription(description, null); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/ASTToolsTests.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/ASTToolsTests.java deleted file mode 100644 index 648bfe230f..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/ASTToolsTests.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.tests.internal.utility.jdt; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.Name; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTFieldAttribute; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; - -@SuppressWarnings("nls") -public class ASTToolsTests extends AnnotationTestCase { - - public ASTToolsTests(String name) { - super(name); - } - - private void createEnumAndMembers(String enumName, String enumBody) throws Exception { - this.javaProject.createCompilationUnit("enums", enumName + ".java", "public enum " + enumName + " { " + enumBody + " }"); - } - - private void createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception { - this.javaProject.createCompilationUnit("annot", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }"); - } - - public void testResolveEnum1() throws Exception { - this.createEnumAndMembers("TestEnum", "FOO, BAR, BAZ"); - this.createAnnotationAndMembers("TestAnnotation", "TestEnum foo();"); - - ICompilationUnit cu = this.createTestType("@annot.TestAnnotation(foo=enums.TestEnum.BAZ)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.TestAnnotation"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "foo"); - JDTFieldAttribute field = this.idField(cu); - - String actual = ASTTools.resolveEnum((Name) daea.getExpression(field.getModifiedDeclaration(this.buildASTRoot(cu)))); - assertEquals("enums.TestEnum.BAZ", actual); - } - - public void testResolveEnum2() throws Exception { - this.createEnumAndMembers("TestEnum", "FOO, BAR, BAZ"); - this.createAnnotationAndMembers("TestAnnotation", "TestEnum foo();"); - - ICompilationUnit cu = this.createTestType("static enums.TestEnum.BAZ", "@annot.TestAnnotation(foo=BAZ)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.TestAnnotation"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "foo"); - JDTFieldAttribute field = this.idField(cu); - - String actual = ASTTools.resolveEnum((Name) daea.getExpression(field.getModifiedDeclaration(this.buildASTRoot(cu)))); - assertEquals("enums.TestEnum.BAZ", actual); - } - - public void testResolveEnum3() throws Exception { - this.createEnumAndMembers("TestEnum", "FOO, BAR, BAZ"); - this.createAnnotationAndMembers("TestAnnotation", "TestEnum foo();"); - - ICompilationUnit cu = this.createTestType("static enums.TestEnum.*", "@annot.TestAnnotation(foo=BAZ)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.TestAnnotation"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "foo"); - JDTFieldAttribute field = this.idField(cu); - - String actual = ASTTools.resolveEnum((Name)daea.getExpression(field.getModifiedDeclaration(this.buildASTRoot(cu)))); - assertEquals("enums.TestEnum.BAZ", actual); - } - - public void testResolveEnum4() throws Exception { - this.createEnumAndMembers("TestEnum", "FOO, BAR, BAZ"); - this.createAnnotationAndMembers("TestAnnotation", "TestEnum foo();"); - - ICompilationUnit cu = this.createTestType("enums.TestEnum", "@annot.TestAnnotation(foo=TestEnum.BAZ)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.TestAnnotation"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "foo"); - JDTFieldAttribute field = this.idField(cu); - - String actual = ASTTools.resolveEnum((Name) daea.getExpression(field.getModifiedDeclaration(this.buildASTRoot(cu)))); - assertEquals("enums.TestEnum.BAZ", actual); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/AnnotationTestCase.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/AnnotationTestCase.java deleted file mode 100644 index 9ff4f59e38..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/AnnotationTestCase.java +++ /dev/null @@ -1,1052 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.tests.internal.utility.jdt; - -import java.io.File; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import junit.framework.TestCase; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.ArrayInitializer; -import org.eclipse.jdt.core.dom.BodyDeclaration; -import org.eclipse.jdt.core.dom.BooleanLiteral; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumConstantDeclaration; -import org.eclipse.jdt.core.dom.EnumDeclaration; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.IExtendedModifier; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jdt.core.dom.MemberValuePair; -import org.eclipse.jdt.core.dom.Name; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.NumberLiteral; -import org.eclipse.jdt.core.dom.PackageDeclaration; -import org.eclipse.jdt.core.dom.SimpleName; -import org.eclipse.jdt.core.dom.SimpleType; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jdt.core.dom.StringLiteral; -import org.eclipse.jdt.core.dom.TypeLiteral; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTFieldAttribute; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTMethodAttribute; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTType; -import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject; -import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.SingleElementIterator; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -/** - * Provide an easy(?) way to build an annotated source file. - * The type must be created by calling one of the {@link #createTestType()} - * methods before calling any of the various helper methods (i.e. the type is - * not created during {@link #setUp()}). - */ -@SuppressWarnings("nls") -public abstract class AnnotationTestCase - extends TestCase -{ - protected TestJavaProject javaProject; - - public static final String CR = System.getProperty("line.separator"); - public static final String SEP = File.separator; - public static final String PROJECT_NAME = "AnnotationTestProject"; - public static final String PACKAGE_NAME = "test"; - public static final String PACKAGE_NAME_ = PACKAGE_NAME + '.'; - public static final String PACKAGE_INFO_FILE_NAME = "package-info.java"; - public static final IPath PACKAGE_INFO_FILE_PATH = new Path("src" + SEP + PACKAGE_NAME + SEP + PACKAGE_INFO_FILE_NAME); - public static final String TYPE_NAME = "AnnotationTestType"; - public static final String FULLY_QUALIFIED_TYPE_NAME = PACKAGE_NAME_ + TYPE_NAME; - public static final String FILE_NAME = TYPE_NAME + ".java"; - public static final IPath FILE_PATH = new Path("src" + SEP + PACKAGE_NAME + SEP + FILE_NAME); - - public static final String[] EMPTY_STRING_ARRAY = new String[0]; - - - // ********** TestCase behavior ********** - - protected AnnotationTestCase(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.javaProject = this.buildJavaProject(false); // false = no auto-build - } - - protected TestJavaProject buildJavaProject(boolean autoBuild) throws Exception { - return this.buildJavaProject(PROJECT_NAME, autoBuild); - } - - protected TestJavaProject buildJavaProject(String projectName, boolean autoBuild) throws Exception { - return new TestJavaProject(projectName, autoBuild); - } - - @Override - protected void tearDown() throws Exception { -// this.dumpSource(); - this.deleteProject(); - TestTools.clear(this); - super.tearDown(); - } - - protected void deleteProject() throws Exception { - int i = 1; - boolean deleted = false; - while ( ! deleted) { - try { - this.javaProject.getProject().delete(true, true, null); - deleted = true; - } catch (CoreException ex) { - if (i == 4) { - throw new RuntimeException(this.getName() + " - unable to delete project", ex); - } - Thread.sleep(1000); - i++; - } - } - } - - protected void dumpSource(ICompilationUnit cu) throws Exception { - System.out.println("*** " + this.getName() + " ****"); - System.out.println(this.getSource(cu)); - System.out.println(); - } - - - // ********** package creation ********* - - /** - * create an un-annotated package-info - */ - protected ICompilationUnit createTestPackageInfo() throws CoreException { - return this.createTestPackageInfo(new DefaultAnnotationWriter()); - } - - /** - * create an un-annotated package-info in a package the given name - */ - protected ICompilationUnit createTestPackageInfo(String packageName) throws CoreException { - return this.createTestPackageInfo(packageName, new DefaultAnnotationWriter()); - } - - /** - * shortcut for simply adding an annotation to the package declaration - */ - protected ICompilationUnit createTestPackageInfo( - final String packageAnnotation, final String ... imports) - throws CoreException { - - return createTestPackageInfo( - new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(imports); - } - - @Override - public void appendPackageAnnotationTo(StringBuilder sb) { - sb.append(packageAnnotation); - } - }); - } - - protected ICompilationUnit createTestPackageInfo(AnnotationWriter annotationWriter) throws CoreException { - return this.createTestPackageInfo(PACKAGE_NAME, annotationWriter); - } - - protected ICompilationUnit createTestPackageInfo(String packageName, AnnotationWriter annotationWriter) throws CoreException { - return this.javaProject.createCompilationUnit( - packageName, PACKAGE_INFO_FILE_NAME, this.createSourceWriter(annotationWriter, packageName, null)); - } - - - // ********** type creation ********** - - /** - * create an un-annotated type - */ - protected ICompilationUnit createTestType() throws CoreException { - return this.createTestType(new DefaultAnnotationWriter()); - } - - /** - * shortcut for simply adding an annotation to the 'id' field - */ - protected ICompilationUnit createTestType(final String annotationImport, final String idFieldAnnotation) throws CoreException { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return (annotationImport == null) ? - EmptyIterator.instance() : - new SingleElementIterator(annotationImport); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append(idFieldAnnotation); - } - }); - } - - /** - * shortcut for simply adding a fully-qualified annotation to the 'id' field - */ - protected ICompilationUnit createTestType(final String idFieldAnnotation) throws CoreException { - return this.createTestType(null, idFieldAnnotation); - } - - protected ICompilationUnit createTestType(AnnotationWriter annotationWriter) throws CoreException { - return this.javaProject.createCompilationUnit(PACKAGE_NAME, FILE_NAME, this.createSourceWriter(annotationWriter)); - } - - protected ICompilationUnit createTestType(String packageName, String fileName, String typeName, AnnotationWriter annotationWriter) throws CoreException { - return this.javaProject.createCompilationUnit(packageName, fileName, this.createSourceWriter(annotationWriter, typeName)); - } - - protected SourceWriter createSourceWriter(AnnotationWriter annotationWriter) { - return new AnnotatedSourceWriter(annotationWriter); - } - - protected SourceWriter createSourceWriter(AnnotationWriter annotationWriter, String typeName) { - return new AnnotatedSourceWriter(annotationWriter, typeName); - } - - protected SourceWriter createSourceWriter(AnnotationWriter annotationWriter, String packageName, String typeName) { - return new AnnotatedSourceWriter(annotationWriter, packageName, typeName); - } - - protected ICompilationUnit createTestEnum(EnumAnnotationWriter annotationWriter) throws CoreException { - return this.javaProject.createCompilationUnit(PACKAGE_NAME, FILE_NAME, this.createEnumSourceWriter(annotationWriter)); - } - - protected ICompilationUnit createTestEnum(String packageName, String fileName, String enumName, EnumAnnotationWriter annotationWriter) throws CoreException { - return this.javaProject.createCompilationUnit(packageName, fileName, this.createEnumSourceWriter(annotationWriter, enumName)); - } - - protected SourceWriter createEnumSourceWriter(EnumAnnotationWriter annotationWriter) { - return new EnumAnnotatedSourceWriter(annotationWriter); - } - - protected SourceWriter createEnumSourceWriter(EnumAnnotationWriter annotationWriter, String enumName) { - return new EnumAnnotatedSourceWriter(annotationWriter, enumName); - } - - protected SourceWriter createEnumSourceWriter(EnumAnnotationWriter annotationWriter, String packageName, String enumName) { - return new EnumAnnotatedSourceWriter(annotationWriter, packageName, enumName); - } - - protected ICompilationUnit createAnnotatedEnumAndMembers(String enumName, String enumBody) throws Exception { - StringBuilder sb = new StringBuilder(); - sb.append("package ").append(PACKAGE_NAME).append(";").append(CR); - sb.append(CR); - sb.append("import javax.xml.bind.annotation.XmlEnum;"); - sb.append(CR); - sb.append(CR); - sb.append("@XmlEnum"); - sb.append(CR); - sb.append("public enum ").append(enumName).append(" { ").append(enumBody).append(" }"); - - return this.javaProject.createCompilationUnit(PACKAGE_NAME, enumName + ".java", sb.toString()); - } - - /** - * writes source for package-info java files - */ - protected void appendSourceTo( - StringBuilder sb, AnnotationWriter annotationWriter, String packageName) { - - annotationWriter.appendPackageAnnotationTo(sb); - sb.append(CR); - sb.append("package ").append(packageName).append(";").append(CR); - sb.append(CR); - for (Iterator stream = annotationWriter.imports(); stream.hasNext(); ) { - sb.append("import ").append(stream.next()).append(";").append(CR); - } - } - - /** - * writes source for typical java files - */ - protected void appendSourceTo( - StringBuilder sb, AnnotationWriter annotationWriter, - String packageName, String typeName) { - - sb.append("package ").append(packageName).append(";").append(CR); - sb.append(CR); - for (Iterator stream = annotationWriter.imports(); stream.hasNext(); ) { - sb.append("import "); - sb.append(stream.next()); - sb.append(";"); - sb.append(CR); - } - sb.append(CR); - annotationWriter.appendTypeAnnotationTo(sb); - sb.append(CR); - sb.append("public class ").append(typeName).append(" "); - annotationWriter.appendExtendsImplementsTo(sb); - sb.append("{").append(CR); - sb.append(CR); - sb.append(" "); - annotationWriter.appendIdFieldAnnotationTo(sb); - sb.append(CR); - sb.append(" private int id;").append(CR); - sb.append(CR); - sb.append(" "); - annotationWriter.appendNameFieldAnnotationTo(sb); - sb.append(CR); - sb.append(" private String name;").append(CR); - sb.append(CR); - sb.append(" "); - annotationWriter.appendGetIdMethodAnnotationTo(sb); - sb.append(CR); - sb.append(" public int getId() {").append(CR); - sb.append(" return this.id;").append(CR); - sb.append(" }").append(CR); - sb.append(CR); - sb.append(" "); - annotationWriter.appendSetIdMethodAnnotationTo(sb); - sb.append(CR); - sb.append(" public void setId(int id) {").append(CR); - sb.append(" this.id = id;").append(CR); - sb.append(" }").append(CR); - sb.append(CR); - sb.append(" "); - annotationWriter.appendGetNameMethodAnnotationTo(sb); - sb.append(CR); - sb.append(" public String getName() {").append(CR); - sb.append(" return this.name;").append(CR); - sb.append(" }").append(CR); - sb.append(CR); - sb.append(" "); - annotationWriter.appendSetNameMethodAnnotationTo(sb); - sb.append(CR); - sb.append(" public void setTestField(String testField) {").append(CR); - sb.append(" this.testField = testField;").append(CR); - sb.append(" }").append(CR); - sb.append(CR); - annotationWriter.appendMemberTypeTo(sb); - sb.append(CR); - sb.append("}").append(CR); - annotationWriter.appendTopLevelTypesTo(sb); - sb.append(CR); - } - - - /** - * writes source for typical java enum files - */ - protected void appendEnumSourceTo( - StringBuilder sb, EnumAnnotationWriter annotationWriter, - String packageName, String enumName) { - - sb.append("package ").append(packageName).append(";").append(CR); - sb.append(CR); - for (Iterator stream = annotationWriter.imports(); stream.hasNext(); ) { - sb.append("import "); - sb.append(stream.next()); - sb.append(";"); - sb.append(CR); - } - sb.append(CR); - annotationWriter.appendEnumAnnotationTo(sb); - sb.append(CR); - sb.append("public enum ").append(enumName).append(" {").append(CR); - sb.append(CR); - sb.append(" "); - annotationWriter.appendSundayEnumConstantAnnotationTo(sb); - sb.append(CR); - sb.append(" SUNDAY, ").append(CR); - sb.append(CR); - sb.append(" "); - annotationWriter.appendMondayEnumConstantAnnotationTo(sb); - sb.append(CR); - sb.append(" MONDAY").append(CR); - sb.append(CR); - sb.append("}").append(CR); - sb.append(CR); - } - - - // ********** queries ********** - - protected TestJavaProject getJavaProject() { - return this.javaProject; - } - - protected JDTType testType(ICompilationUnit cu) { - return this.buildType(TYPE_NAME, cu); - } - - protected JDTType buildType(String name, ICompilationUnit cu) { - return this.buildType(name, 1, cu); - } - - protected JDTType buildType(String name, int occurrence, ICompilationUnit cu) { - return this.buildType(null, name, occurrence, cu); - } - - protected JDTType buildType(Type declaringType, String name, int occurrence, ICompilationUnit cu) { - return new JDTType(declaringType, name, occurrence, cu); - } - - protected JDTFieldAttribute idField(ICompilationUnit cu) { - return this.buildField("id", cu); - } - - protected JDTFieldAttribute nameField(ICompilationUnit cu) { - return this.buildField("name", cu); - } - - protected JDTFieldAttribute buildField(String name, ICompilationUnit cu) { - return this.buildField(name, 1, cu); - } - - protected JDTFieldAttribute buildField(String name, int occurrence, ICompilationUnit cu) { - return this.buildField(this.testType(cu), name, occurrence, cu); - } - - protected JDTFieldAttribute buildField(Type declaringType, String name, int occurrence, ICompilationUnit cu) { - return new JDTFieldAttribute(declaringType, name, occurrence, cu); - } - - protected JDTMethodAttribute idGetMethod(ICompilationUnit cu) { - return this.buildMethod("getId", cu); - } - - protected JDTMethodAttribute idSetMethod(ICompilationUnit cu) { - return this.buildMethod("setId", new String[] {"int"}, cu); - } - - protected JDTMethodAttribute nameGetMethod(ICompilationUnit cu) { - return this.buildMethod("getName", cu); - } - - protected JDTMethodAttribute buildMethod(String name, ICompilationUnit cu) { - return this.buildMethod(name, EMPTY_STRING_ARRAY, cu); - } - - protected JDTMethodAttribute buildMethod(String name, String[] parameterTypeNames, ICompilationUnit cu) { - return this.buildMethod(name, parameterTypeNames, 1, cu); - } - - protected JDTMethodAttribute buildMethod(String name, String[] parameterTypeNames, int occurrence, ICompilationUnit cu) { - return new JDTMethodAttribute(this.testType(cu), name, parameterTypeNames, occurrence, cu); - } - - protected JDTMethodAttribute buildMethod(Type declaringType, String name, String[] parameterTypeNames, int occurrence, ICompilationUnit cu) { - return new JDTMethodAttribute(declaringType, name, parameterTypeNames, occurrence, cu); - } - - protected String getSource(ICompilationUnit cu) throws JavaModelException { - return cu.getBuffer().getContents(); - } - - protected CompilationUnit buildASTRoot(ICompilationUnit cu) { - return ASTTools.buildASTRoot(cu); - } - - - // ********** test validation ********** - - protected void assertSourceContains(String s, ICompilationUnit cu) throws JavaModelException { - String source = this.getSource(cu); - boolean found = source.indexOf(s) > -1; - if ( ! found) { - String msg = "source does not contain the expected string: " + s + " (see System console)"; - System.out.println("*** " + this.getName() + " ****"); - System.out.println(msg); - System.out.println(source); - System.out.println(); - fail(msg); - } - } - - protected void assertSourceDoesNotContain(String s, ICompilationUnit cu) throws JavaModelException { - String source = this.getSource(cu); - int pos = source.indexOf(s); - if (pos != -1) { - String msg = "unexpected string in source (position: " + pos + "): " + s + " (see System console)"; - System.out.println("*** " + this.getName() + " ****"); - System.out.println(msg); - System.out.println(source); - System.out.println(); - fail(msg); - } - } - - - // ********** manipulate annotations ********** - - /** - * Return the *first* member value pair for the specified annotation element - * with the specified name. - * Return null if the annotation has no such element. - */ - protected MemberValuePair memberValuePair(NormalAnnotation annotation, String elementName) { - for (MemberValuePair pair : this.values(annotation)) { - if (pair.getName().getFullyQualifiedName().equals(elementName)) { - return pair; - } - } - return null; - } - - /** - * minimize the scope of the suppressed warnings - */ - @SuppressWarnings("unchecked") - protected List values(NormalAnnotation na) { - return na.values(); - } - - /** - * minimize the scope of the suppressed warnings - */ - @SuppressWarnings("unchecked") - protected List enumConstants(EnumDeclaration ed) { - return ed.enumConstants(); - } - - /** - * check for null member value pair - */ - protected Expression value_(MemberValuePair pair) { - return (pair == null) ? null : pair.getValue(); - } - - /** - * Return the value of the *first* annotation element - * with the specified name. - * Return null if the annotation has no such element. - */ - protected Expression annotationElementValue(NormalAnnotation annotation, String elementName) { - return this.value_(this.memberValuePair(annotation, elementName)); - } - - /** - * Return the value of the *first* annotation element - * with the specified name. - * Return null if the annotation has no such element. - */ - protected Expression annotationElementValue(SingleMemberAnnotation annotation, String elementName) { - return elementName.equals("value") ? annotation.getValue() : null; - } - - /** - * Return the value of the *first* annotation element - * with the specified name. - * Return null if the annotation has no such element. - * (An element name of "value" will return the value of a single - * member annotation.) - */ - protected Expression annotationElementValue(Annotation annotation, String elementName) { - if (annotation.isNormalAnnotation()) { - return this.annotationElementValue((NormalAnnotation) annotation, elementName); - } - if (annotation.isSingleMemberAnnotation()) { - return this.annotationElementValue((SingleMemberAnnotation) annotation, elementName); - } - return null; - } - /** - * Build a number literal and set its initial value to the specified literal. - */ - protected NumberLiteral newNumberLiteral(AST ast, int value) { - return ast.newNumberLiteral(Integer.toString(value)); - } - - /** - * Build a number literal and set its initial value to the specified literal. - */ - protected BooleanLiteral newBooleanLiteral(AST ast, boolean value) { - return ast.newBooleanLiteral(value); - } - - /** - * Build a string literal and set its initial value. - */ - protected StringLiteral newStringLiteral(AST ast, String value) { - StringLiteral stringLiteral = ast.newStringLiteral(); - stringLiteral.setLiteralValue(value); - return stringLiteral; - } - - protected TypeLiteral newTypeLiteral(AST ast, String typeName) { - TypeLiteral typeLiteral = ast.newTypeLiteral(); - typeLiteral.setType(this.newSimpleType(ast, typeName)); - return typeLiteral; - } - - protected SimpleType newSimpleType(AST ast, String typeName) { - return this.newSimpleType(ast, ast.newName(typeName)); - } - - protected SimpleType newSimpleType(AST ast, Name typeName) { - return ast.newSimpleType(typeName); - } - - protected MemberValuePair newMemberValuePair(AST ast, SimpleName name, Expression value) { - MemberValuePair pair = ast.newMemberValuePair(); - pair.setName(name); - pair.setValue(value); - return pair; - } - - protected MemberValuePair newMemberValuePair(AST ast, String name, Expression value) { - return this.newMemberValuePair(ast, ast.newSimpleName(name), value); - } - - protected MemberValuePair newMemberValuePair(AST ast, String name, String value) { - return this.newMemberValuePair(ast, name, this.newStringLiteral(ast, value)); - } - - protected MemberValuePair newMemberValuePair(AST ast, String name, int value) { - return this.newMemberValuePair(ast, name, this.newNumberLiteral(ast, value)); - } - - protected MemberValuePair newMemberValuePair(AST ast, String name, boolean value) { - return this.newMemberValuePair(ast, name, this.newBooleanLiteral(ast, value)); - } - - protected EnumConstantDeclaration newEnumConstantDeclaration(AST ast, String enumConstantName) { - EnumConstantDeclaration enumConstantDeclaration = ast.newEnumConstantDeclaration(); - enumConstantDeclaration.setName(ast.newSimpleName(enumConstantName)); - return enumConstantDeclaration; - } - /** - * Add the specified member value pair to the specified annotation. - * Return the resulting annotation. - */ - protected NormalAnnotation addMemberValuePair(NormalAnnotation annotation, MemberValuePair pair) { - this.values(annotation).add(pair); - return annotation; - } - - /** - * Add the specified member value pair to the specified annotation. - * Return the resulting annotation. - */ - protected NormalAnnotation addMemberValuePair(NormalAnnotation annotation, String name, int value) { - return this.addMemberValuePair(annotation, this.newMemberValuePair(annotation.getAST(), name, value)); - } - - /** - * Add the specified member value pair to the specified annotation. - * Return the resulting annotation. - */ - protected NormalAnnotation addMemberValuePair(NormalAnnotation annotation, String name, String value) { - return this.addMemberValuePair(annotation, this.newMemberValuePair(annotation.getAST(), name, value)); - } - - /** - * Add the specified member value pair to the marker annotation - * by first replacing it with a normal annotation. - * Return the resulting normal annotation. - */ - protected NormalAnnotation addMemberValuePair(MarkerAnnotation annotation, String name, String value) { - NormalAnnotation normalAnnotation = this.replaceMarkerAnnotation(annotation); - this.addMemberValuePair(normalAnnotation, this.newMemberValuePair(annotation.getAST(), name, value)); - return normalAnnotation; - } - - protected NormalAnnotation addMemberValuePair(MarkerAnnotation annotation, String name, boolean value) { - NormalAnnotation normalAnnotation = this.replaceMarkerAnnotation(annotation); - this.addMemberValuePair(normalAnnotation, this.newMemberValuePair(annotation.getAST(), name, value)); - return normalAnnotation; - } - - /** - * Add the specified member value pair to the marker annotation - * by first replacing it with a normal annotation. - * Return the resulting normal annotation. - */ - protected NormalAnnotation addMemberValuePair(MarkerAnnotation annotation, MemberValuePair pair) { - NormalAnnotation normalAnnotation = this.replaceMarkerAnnotation(annotation); - return this.addMemberValuePair(normalAnnotation, pair); - } - - protected void setEnumMemberValuePair(ModifiedDeclaration declaration, String annotationName, String enumValue) { - NormalAnnotation annotation = (NormalAnnotation) declaration.getAnnotationNamed(annotationName); - if (annotation == null) { - annotation = addNormalAnnotation(declaration.getDeclaration(), annotationName); - } - this.setEnumMemberValuePair(annotation, "value", enumValue); - } - - protected void setEnumMemberValuePair(NormalAnnotation annotation, String elementName, String enumValue) { - MemberValuePair memberValuePair = this.memberValuePair(annotation, elementName); - if (memberValuePair == null) { - this.addEnumMemberValuePair(annotation, elementName, enumValue); - } - else { - memberValuePair.setValue(annotation.getAST().newName(enumValue)); - } - } - - protected void addEnumMemberValuePair(MarkerAnnotation markerAnnotation, String elementName, String value) { - this.addEnumMemberValuePair(this.replaceMarkerAnnotation(markerAnnotation), elementName, value); - } - - protected void addEnumMemberValuePair(NormalAnnotation annotation, String elementName, String value) { - this.addMemberValuePair(annotation, elementName, annotation.getAST().newName(value)); - } - - protected void addMemberValuePair(NormalAnnotation annotation, String elementName, Expression value) { - MemberValuePair memberValuePair = this.newMemberValuePair(annotation.getAST(), elementName, value); - this.addMemberValuePair(annotation, memberValuePair); - } - - protected void addMemberValuePair(MarkerAnnotation annotation, String elementName, Expression value) { - MemberValuePair memberValuePair = this.newMemberValuePair(annotation.getAST(), elementName, value); - this.addMemberValuePair(annotation, memberValuePair); - } - - protected void addEnumConstant(EnumDeclaration enumDeclaration, String enumConstantName) { - EnumConstantDeclaration enumConstantDeclaration = this.newEnumConstantDeclaration(enumDeclaration.getAST(), enumConstantName); - this.enumConstants(enumDeclaration).add(enumConstantDeclaration); - } - - protected void removeEnumConstant(EnumDeclaration enumDeclaration, String enumConstantName) { - List enumConstantsList = this.enumConstants(enumDeclaration); - for (EnumConstantDeclaration constant : enumConstantsList) { - if (constant.getName().getFullyQualifiedName().equals(enumConstantName)) { - enumConstantsList.remove(constant); - break; - } - } - } - - protected void changeEnumConstantName(EnumDeclaration enumDeclaration, String oldEnumConstantName, String newEnumConstantName) { - List enumConstantsList = this.enumConstants(enumDeclaration); - for (EnumConstantDeclaration constant : enumConstantsList) { - if (constant.getName().getFullyQualifiedName().equals(oldEnumConstantName)) { - this.changeEnumConstantName(constant, newEnumConstantName); - break; - } - } - } - - protected void changeEnumConstantName(EnumConstantDeclaration enumConstantDeclaration, String newEnumConstantName) { - enumConstantDeclaration.setName(enumConstantDeclaration.getAST().newSimpleName(newEnumConstantName)); - } - - /** - * Add the array element to an annotation that is either a normal annotation or a marker annotation. - * If it is a marker annotation first make it a normal annotation. - */ - protected void addArrayElement(ModifiedDeclaration declaration, String annotationName, int index, String elementName, Expression arrayElement) { - Annotation annotation = declaration.getAnnotationNamed(annotationName); - NormalAnnotation normalAnnotation; - if (annotation == null) { - normalAnnotation = this.addNormalAnnotation(declaration.getDeclaration(), annotationName); - } - else if (annotation.getNodeType() == ASTNode.MARKER_ANNOTATION) { - normalAnnotation = this.replaceMarkerAnnotation((MarkerAnnotation) annotation); - } - else { - normalAnnotation = (NormalAnnotation) annotation; - } - this.addArrayElement(normalAnnotation, index, elementName, arrayElement); - } - - /** - * Add the array element to the given normal annotation's element named elementName. - * Add a new member value pair if one does not exist. - * If the member value pair exists but the value is not yet an array, make it an array. - */ - protected void addArrayElement(NormalAnnotation annotation, int index, String elementName, Expression arrayElement) { - MemberValuePair pair = this.memberValuePair(annotation, elementName); - if (pair == null) { - pair = this.newMemberValuePair(annotation.getAST(), elementName, arrayElement); - this.addMemberValuePair(annotation, pair); - } - else { - Expression value = pair.getValue(); - if (value.getNodeType() == ASTNode.ARRAY_INITIALIZER) { - this.expressions((ArrayInitializer) value).add(index, arrayElement); - } - else { - ArrayInitializer arrayInitializer = annotation.getAST().newArrayInitializer(); - pair.setValue(arrayInitializer); - this.expressions(arrayInitializer).add(value); - this.expressions(arrayInitializer).add(index, arrayElement); - } - } - } - - /** - * This assumes an element with name elementName exists with an array as its value. - * Move the array element at sourceIndex to the targetIndex - */ - protected void moveArrayElement(NormalAnnotation annotation, String elementName, int targetIndex, int sourceIndex) { - MemberValuePair pair = this.memberValuePair(annotation, elementName); - ArrayInitializer array = (ArrayInitializer) pair.getValue(); - CollectionTools.move(this.expressions(array), targetIndex, sourceIndex); - } - - /** - * This assumes an element with name elementName exists with potentially an array as its value. - * If the value is not an array, then the member value pair is removed. - * If the array element is removed and there is only 1 array element left, the array itself is removed - * and the remaining element is set as the value of the member value pair - */ - protected void removeArrayElement(NormalAnnotation annotation, String elementName, int index) { - MemberValuePair pair = this.memberValuePair(annotation, elementName); - if (pair.getValue().getNodeType() == ASTNode.ARRAY_INITIALIZER) { - ArrayInitializer array = (ArrayInitializer) pair.getValue(); - this.expressions(array).remove(index); - if (this.expressions(array).size() == 1) { - pair.setValue(this.expressions(array).remove(0)); - } - } - else { - this.values(annotation).remove(pair); - } - } - - /** - * Replace the given marker annotation with a normal annotation. - * Return the resulting normal annotation. - */ - protected NormalAnnotation replaceMarkerAnnotation(MarkerAnnotation annotation) { - List annotations = this.annotations(annotation.getParent()); - int index = annotations.indexOf(annotation); - NormalAnnotation normalAnnotation = newNormalAnnotation(annotation.getAST(), annotation.getTypeName().getFullyQualifiedName()); - annotations.set(index, normalAnnotation); - return normalAnnotation; - } - - /** - * Build a normal annotation and set its name. - */ - protected NormalAnnotation newNormalAnnotation(AST ast, String name) { - NormalAnnotation annotation = ast.newNormalAnnotation(); - annotation.setTypeName(ast.newName(name)); - return annotation; - } - - /** - * Add the normal annotation to the given AST node. - * This should be a PackageDeclaration or a BodyDeclaration. - * Return the resulting normal annotation. - */ - protected NormalAnnotation addNormalAnnotation(ASTNode astNode, String name) { - NormalAnnotation annotation = this.newNormalAnnotation(astNode.getAST(), name); - this.addAnnotation(astNode, annotation); - return annotation; - } - - /** - * Add the annotation to the given AST node. - * This should be a PackageDeclaration or a BodyDeclaration. - */ - protected void addAnnotation(ASTNode astNode, Annotation annotation) { - this.annotations(astNode).add(annotation); - } - - /** - * Build a marker annotation and set its name. - */ - protected MarkerAnnotation newMarkerAnnotation(AST ast, String name) { - MarkerAnnotation annotation = ast.newMarkerAnnotation(); - annotation.setTypeName(ast.newName(name)); - return annotation; - } - - /** - * Add the normal annotation to the given AST node. - * This should be a PackageDeclaration or a BodyDeclaration. - * Return the resulting normal annotation. - */ - protected MarkerAnnotation addMarkerAnnotation(ASTNode astNode, String name) { - MarkerAnnotation annotation = this.newMarkerAnnotation(astNode.getAST(), name); - this.addAnnotation(astNode, annotation); - return annotation; - } - - /** - * Remove the annotation with the specified name - */ - protected void removeAnnotation(ModifiedDeclaration declaration, String name) { - this.removeAnnotation(declaration.getDeclaration(), declaration.getAnnotationNamed(name)); - } - - /** - * Remove the specified annotation from the AST node. - * This should be a PackageDeclaration or a BodyDeclaration. - */ - protected void removeAnnotation(ASTNode astNode, Annotation annotation) { - this.annotations(astNode).remove(annotation); - } - - /** - * minimize the scope of the suppressed warnings - */ - @SuppressWarnings("unchecked") - protected List annotations(ASTNode astNode) { - if (astNode instanceof BodyDeclaration) { - return ((BodyDeclaration) astNode).modifiers(); - } - else if (astNode instanceof PackageDeclaration) { - return ((PackageDeclaration) astNode).annotations(); - } - return Collections.emptyList(); - } - - /** - * minimize the scope of the suppressed warnings - */ - @SuppressWarnings("unchecked") - protected List expressions(ArrayInitializer arrayInitializer) { - return arrayInitializer.expressions(); - } - - - // ********** member classes ********** - - public interface AnnotationWriter { - Iterator imports(); - void appendPackageAnnotationTo(StringBuilder sb); - void appendTypeAnnotationTo(StringBuilder sb); - void appendExtendsImplementsTo(StringBuilder sb); - void appendIdFieldAnnotationTo(StringBuilder sb); - void appendNameFieldAnnotationTo(StringBuilder sb); - void appendGetIdMethodAnnotationTo(StringBuilder sb); - void appendSetIdMethodAnnotationTo(StringBuilder sb); - void appendGetNameMethodAnnotationTo(StringBuilder sb); - void appendSetNameMethodAnnotationTo(StringBuilder sb); - void appendMemberTypeTo(StringBuilder sb); - void appendTopLevelTypesTo(StringBuilder sb); - } - - public static class DefaultAnnotationWriter implements AnnotationWriter { - public Iterator imports() {return EmptyIterator.instance();} - public void appendPackageAnnotationTo(StringBuilder sb) {/* do nothing */} - public void appendTypeAnnotationTo(StringBuilder sb) {/* do nothing */} - public void appendExtendsImplementsTo(StringBuilder sb) {/* do nothing */} - public void appendIdFieldAnnotationTo(StringBuilder sb) {/* do nothing */} - public void appendNameFieldAnnotationTo(StringBuilder sb) {/* do nothing */} - public void appendGetIdMethodAnnotationTo(StringBuilder sb) {/* do nothing */} - public void appendSetIdMethodAnnotationTo(StringBuilder sb) {/* do nothing */} - public void appendGetNameMethodAnnotationTo(StringBuilder sb) {/* do nothing */} - public void appendSetNameMethodAnnotationTo(StringBuilder sb) {/* do nothing */} - public void appendMemberTypeTo(StringBuilder sb) {/* do nothing */} - public void appendTopLevelTypesTo(StringBuilder sb) {/* do nothing */} - } - - public static class AnnotationWriterWrapper implements AnnotationWriter { - private final AnnotationWriter aw; - public AnnotationWriterWrapper(AnnotationWriter aw) { - super(); - this.aw = aw; - } - public Iterator imports() {return this.aw.imports();} - public void appendPackageAnnotationTo(StringBuilder sb) {this.aw.appendPackageAnnotationTo(sb);} - public void appendTypeAnnotationTo(StringBuilder sb) {this.aw.appendTypeAnnotationTo(sb);} - public void appendExtendsImplementsTo(StringBuilder sb) {this.aw.appendExtendsImplementsTo(sb);} - public void appendIdFieldAnnotationTo(StringBuilder sb) {this.aw.appendIdFieldAnnotationTo(sb);} - public void appendNameFieldAnnotationTo(StringBuilder sb) {this.aw.appendNameFieldAnnotationTo(sb);} - public void appendGetIdMethodAnnotationTo(StringBuilder sb) {this.aw.appendGetIdMethodAnnotationTo(sb);} - public void appendSetIdMethodAnnotationTo(StringBuilder sb) {this.aw.appendSetIdMethodAnnotationTo(sb);} - public void appendGetNameMethodAnnotationTo(StringBuilder sb) {this.aw.appendGetNameMethodAnnotationTo(sb);} - public void appendSetNameMethodAnnotationTo(StringBuilder sb) {this.aw.appendSetNameMethodAnnotationTo(sb);} - public void appendMemberTypeTo(StringBuilder sb) {this.aw.appendMemberTypeTo(sb);} - public void appendTopLevelTypesTo(StringBuilder sb) {this.aw.appendTopLevelTypesTo(sb);} - } - - public class AnnotatedSourceWriter - implements SourceWriter { - - private AnnotationWriter annotationWriter; - private String packageName; - private String typeName; - - public AnnotatedSourceWriter(AnnotationWriter annotationWriter) { - this(annotationWriter, TYPE_NAME); - } - - public AnnotatedSourceWriter(AnnotationWriter annotationWriter, String typeName) { - this(annotationWriter, PACKAGE_NAME, typeName); - } - - public AnnotatedSourceWriter(AnnotationWriter annotationWriter, String packageName, String typeName) { - super(); - this.annotationWriter = annotationWriter; - this.packageName = packageName; - this.typeName = typeName; - } - - public void appendSourceTo(StringBuilder sb) { - if (this.typeName != null) { - AnnotationTestCase.this.appendSourceTo(sb, this.annotationWriter, this.packageName, this.typeName); - } - else { - AnnotationTestCase.this.appendSourceTo(sb, this.annotationWriter, this.packageName); - } - } - } - - public interface EnumAnnotationWriter { - Iterator imports(); - void appendPackageAnnotationTo(StringBuilder sb); - void appendEnumAnnotationTo(StringBuilder sb); - void appendSundayEnumConstantAnnotationTo(StringBuilder sb); - void appendMondayEnumConstantAnnotationTo(StringBuilder sb); - } - - public static class DefaultEnumAnnotationWriter implements EnumAnnotationWriter { - public Iterator imports() {return EmptyIterator.instance();} - public void appendPackageAnnotationTo(StringBuilder sb) {/* do nothing */} - public void appendEnumAnnotationTo(StringBuilder sb) {/* do nothing */} - public void appendSundayEnumConstantAnnotationTo(StringBuilder sb) {/* do nothing */} - public void appendMondayEnumConstantAnnotationTo(StringBuilder sb) {/* do nothing */} - } - - public class EnumAnnotatedSourceWriter - implements SourceWriter { - - private EnumAnnotationWriter annotationWriter; - private String packageName; - private String enumName; - - public EnumAnnotatedSourceWriter(EnumAnnotationWriter annotationWriter) { - this(annotationWriter, TYPE_NAME); - } - - public EnumAnnotatedSourceWriter(EnumAnnotationWriter annotationWriter, String enumName) { - this(annotationWriter, PACKAGE_NAME, enumName); - } - - public EnumAnnotatedSourceWriter(EnumAnnotationWriter annotationWriter, String packageName, String enumName) { - super(); - this.annotationWriter = annotationWriter; - this.packageName = packageName; - this.enumName = enumName; - } - - public void appendSourceTo(StringBuilder sb) { - AnnotationTestCase.this.appendEnumSourceTo(sb, this.annotationWriter, this.packageName, this.enumName); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/CombinationIndexedDeclarationAnnotationAdapterTests.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/CombinationIndexedDeclarationAnnotationAdapterTests.java deleted file mode 100644 index b4f92fa9a7..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/CombinationIndexedDeclarationAnnotationAdapterTests.java +++ /dev/null @@ -1,744 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.tests.internal.utility.jdt; - -import org.eclipse.core.runtime.Platform; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.StringLiteral; -import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.osgi.framework.Version; - -@SuppressWarnings("nls") -public class CombinationIndexedDeclarationAnnotationAdapterTests extends AnnotationTestCase { - - public CombinationIndexedDeclarationAnnotationAdapterTests(String name) { - super(name); - } - - private void createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception { - this.javaProject.createCompilationUnit("annot", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }"); - } - - public void testAnnotation1() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumn(name=\"ADDRESS_ID\")"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 0); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - assertEquals("annot.JoinColumn", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isNormalAnnotation()); - } - - public void testAnnotation2() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumn(name=\"ADDRESS_ID\")"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 1); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - } - - public void testAnnotation3() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(@annot.JoinColumn(name=\"ADDRESS_ID\"))"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 0); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - assertEquals("annot.JoinColumn", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isNormalAnnotation()); - } - - public void testAnnotation4() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(@annot.JoinColumn(name=\"ADDRESS_ID\"))"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 1); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - } - - public void testAnnotation5() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 1); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - assertEquals("annot.JoinColumn", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isNormalAnnotation()); - String value = ((StringLiteral) this.values((NormalAnnotation) annotation).get(0).getValue()).getLiteralValue(); - assertEquals("ADDRESS_ID2", value); - } - - public void testAnnotation6() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - } - - public void testAnnotation7() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - assertEquals("annot.JoinColumn", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isNormalAnnotation()); - String value = ((StringLiteral) this.values(((NormalAnnotation) annotation)).get(0).getValue()).getLiteralValue(); - assertEquals("ADDRESS_ID2", value); - } - - public void testAnnotation8() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 1); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - } - - public void testRemoveAnnotation1() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumn(name=\"ADDRESS_ID\")"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 0); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - aa.removeAnnotation(); - this.assertSourceDoesNotContain("JoinColumn", cu); - } - - public void testRemoveAnnotation2() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(@annot.JoinColumn(name=\"ADDRESS_ID\"))"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 0); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - aa.removeAnnotation(); - this.assertSourceDoesNotContain("ADDRESS_ID", cu); - } - - public void testRemoveAnnotation3() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 1); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - aa.removeAnnotation(); - this.assertSourceDoesNotContain("JoinColumns", cu); - this.assertSourceDoesNotContain("ADDRESS_ID2", cu); - this.assertSourceContains("@JoinColumn(name=\"ADDRESS_ID1\")", cu); - } - - public void testRemoveAnnotation4() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - aa.removeAnnotation(); - this.assertSourceDoesNotContain("JoinColumns", cu); - this.assertSourceDoesNotContain("ADDRESS_ID2", cu); - this.assertSourceContains("@JoinColumn(name=\"ADDRESS_ID1\")", cu); - } - - public void testRemoveAnnotation5() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "String comment(); JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(comment=\"test\",columns={@annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - aa.removeAnnotation(); - this.assertSourceContains("@annot.JoinColumns(comment=\"test\",columns=@annot.JoinColumn(name=\"ADDRESS_ID1\"))", cu); - } - - public void testRemoveAnnotation6() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(null)"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", 0); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - aa.removeAnnotation(); - this.assertSourceContains("@annot.JoinColumns(null)", cu); - } - - public void testRemoveAnnotation12() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - String expected = "@JoinColumn(name=\"ADDRESS_ID0\")"; - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 2); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(expected, cu); - this.assertSourceDoesNotContain("JoinColumns", cu); - } - - public void testRemoveAnnotation13() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns({null, @annot.JoinColumn(name=\"ADDRESS_ID1\")})"); - this.assertSourceContains("@annot.JoinColumn", cu); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 1); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain("ADDRESS_ID", cu); - } - - public void testRemoveAnnotation14() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\"), null})"); - String expected = "@JoinColumn(name=\"ADDRESS_ID0\")"; - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 2); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testRemoveAnnotation15() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\"), @annot.JoinColumn(name=\"ADDRESS_ID3\")})"); - String expected = "@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, null, @annot.JoinColumn(name=\"ADDRESS_ID3\")})"; - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 2); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testRemoveAnnotation16() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\"), @annot.JoinColumn(name=\"ADDRESS_ID3\")})"); - String expected = "@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\")})"; - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 3); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testRemoveAnnotation17() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns({null, null, @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - this.assertSourceContains("@annot.JoinColumn", cu); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 2); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain("ADDRESS_ID2", cu); - } - - public void testNewMarkerAnnotation1() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("JoinColumn", cu); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 0); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("JoinColumn", cu); - this.assertSourceDoesNotContain("JoinColumns", cu); - } - - public void testNewMarkerAnnotation2() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumn"); - this.assertSourceDoesNotContain("JoinColumns", cu); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@JoinColumns(columns = { @JoinColumn, @JoinColumn })", cu); - } - - public void testNewMarkerAnnotation3() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn, @annot.JoinColumn})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 2); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@annot.JoinColumns(columns={@annot.JoinColumn, @annot.JoinColumn," + CR + " @JoinColumn})", cu); - } - - public void testNewMarkerAnnotation4() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumn(77)"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 0); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("JoinColumn", cu); - this.assertSourceDoesNotContain("JoinColumns", cu); - this.assertSourceDoesNotContain("77", cu); - } - - public void testNewMarkerAnnotation5() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns=@annot.JoinColumn(77))"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 0); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@annot.JoinColumns(columns=@JoinColumn)", cu); - this.assertSourceDoesNotContain("77", cu); - } - - public void testNewMarkerAnnotation6() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns=@annot.JoinColumn(77))"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@annot.JoinColumns(columns={@annot.JoinColumn(77),@JoinColumn})", cu); - } - - public void testNewMarkerAnnotation7() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumn(77)"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@JoinColumns(columns = { @JoinColumn(77), @JoinColumn })", cu); - } - - public void testNewMarkerAnnotation8() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(77),@annot.JoinColumn(88)})"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@annot.JoinColumns(columns={@annot.JoinColumn(77),@JoinColumn})", cu); - } - - public void testNewMarkerAnnotation9() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name(); String text(); int num();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumn(text=\"blah\",num=42)"); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@JoinColumns(columns = { @JoinColumn(text = \"blah\", num = 42), @JoinColumn })", cu); - } - - public void testNewMarkerAnnotation23() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name(); String text(); int num();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumn(text=\"b\",num=4)"); - String expected1 = "@JoinColumns(columns = { @JoinColumn(text = \"b\", num = 4), null,"; - String expected2 = "@JoinColumn })"; - this.assertSourceDoesNotContain(expected1, cu); - this.assertSourceDoesNotContain(expected2, cu); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 2); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected1, cu); - this.assertSourceContains(expected2, cu); - } - - public void testNewMarkerAnnotation24() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name(); String text(); int num();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumn(text=\"blah\",num=42)"); - - //Use old formatting if jdt core version is 3.5 or below - see bug 285604 - Version version = Platform.getBundle("org.eclipse.jdt.core").getVersion(); - int majorVersion = version.getMajor(); - int minorVersion = version.getMinor(); - //This condition should be removed and test updated after Dali 3.0 branches - String expected1; - if (majorVersion == 3 && minorVersion <= 5) { - expected1 = "@JoinColumns( {"; - } - else expected1 = "@JoinColumns({"; - - String expected2 = "@JoinColumn(text = \"blah\", num = 42), null,"; - String expected3 = "@JoinColumn " + CR + " })"; - this.assertSourceDoesNotContain(expected1, cu); - this.assertSourceDoesNotContain(expected2, cu); - this.assertSourceDoesNotContain(expected3, cu); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 2); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected1, cu); - this.assertSourceContains(expected2, cu); - this.assertSourceContains(expected3, cu); - } - - public void testNewMarkerAnnotation25() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\")})"); - String expected1 = "@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), null, null,"; // the line gets split - String expected2 = "@JoinColumn})"; - this.assertSourceDoesNotContain(expected1, cu); - this.assertSourceDoesNotContain(expected2, cu); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 4); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected1, cu); - this.assertSourceContains(expected2, cu); - } - - public void testNewMarkerAnnotation26() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\")})"); - String expected1 = "@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), null, null,"; // the line gets split - String expected2 = "@JoinColumn})"; - this.assertSourceDoesNotContain(expected1, cu); - this.assertSourceDoesNotContain(expected2, cu); - DeclarationAnnotationAdapter daa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 4); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected1, cu); - this.assertSourceContains(expected2, cu); - } - - public void testMoveAnnotation1() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumn(name=\"ADDRESS_ID0\")"); - String expected = "@JoinColumns(columns = { null, @JoinColumn(name = \"ADDRESS_ID0\") })"; - this.assertSourceDoesNotContain(expected, cu); - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 0); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), cidaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(1); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation2() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={null,@annot.JoinColumn(name=\"ADDRESS_ID1\")})"); - String expected = "@JoinColumn(name=\"ADDRESS_ID1\")"; - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), cidaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected, cu); - this.assertSourceDoesNotContain("JoinColumns", cu); - } - - public void testMoveAnnotation2a() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns({null,@annot.JoinColumn(name=\"ADDRESS_ID1\")})"); - String expected = "@JoinColumn(name=\"ADDRESS_ID1\")"; - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 1); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), cidaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected, cu); - this.assertSourceDoesNotContain("JoinColumns", cu); - } - - public void testMoveAnnotation3() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), @annot.JoinColumn(name=\"ADDRESS_ID3\")})"); - String expected = "@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID3\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"; - this.assertSourceDoesNotContain(expected, cu); - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 3); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), cidaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation4() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), @annot.JoinColumn(name=\"ADDRESS_ID3\"), @annot.JoinColumn(name=\"ADDRESS_ID4\")})"); - String expected = "@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID3\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), null, @annot.JoinColumn(name=\"ADDRESS_ID4\")})"; - this.assertSourceDoesNotContain(expected, cu); - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 3); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), cidaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation5() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - String expected = "@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\")})"; - this.assertSourceDoesNotContain(expected, cu); - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 2); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), cidaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(3); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation6() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - String expected = "@annot.JoinColumns(columns={null, @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), @annot.JoinColumn(name=\"ADDRESS_ID0\")})"; - this.assertSourceDoesNotContain(expected, cu); - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 0); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), cidaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(3); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation7() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - String expected = "@annot.JoinColumns(columns={null, @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"; - this.assertSourceDoesNotContain(expected, cu); - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 3); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), cidaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation8() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), null, @annot.JoinColumn(name=\"ADDRESS_ID4\")})"); - String expected = "@annot.JoinColumns(columns={null, @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\"), null, @annot.JoinColumn(name=\"ADDRESS_ID4\")})"; - this.assertSourceDoesNotContain(expected, cu); - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 3); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), cidaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation9() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - String expected = "@annot.JoinColumns(columns={null, @annot.JoinColumn(name=\"ADDRESS_ID1\"), @annot.JoinColumn(name=\"ADDRESS_ID2\")})"; - ICompilationUnit cu = this.createTestType(expected); // the source should be unchanged - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 0); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), cidaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - iaa.moveAnnotation(3); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation10() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\")})"); - String expected = "@JoinColumn(name=\"ADDRESS_ID0\")"; - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 2); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), cidaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - iaa.moveAnnotation(1); - this.assertSourceContains(expected, cu); - this.assertSourceDoesNotContain("@annot.JoinColumns", cu); - } - - public void testMoveAnnotation10a() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] value();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns({@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\")})"); - String expected = "@JoinColumn(name=\"ADDRESS_ID0\")"; - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "value", 2); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), cidaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - iaa.moveAnnotation(1); - this.assertSourceContains(expected, cu); - this.assertSourceDoesNotContain("@annot.JoinColumns", cu); - } - - public void testMoveAnnotation11() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumn(name=\"ADDRESS_ID0\")"); - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 1); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), cidaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceDoesNotContain("JoinColumn", cu); - } - - public void testMoveAnnotation12() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), null, @annot.JoinColumn(name=\"ADDRESS_ID2\")})"); - String expected = "@JoinColumn(name=\"ADDRESS_ID2\")"; - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 2); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), cidaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected, cu); - this.assertSourceDoesNotContain("@annot.JoinColumns", cu); - } - - public void testMoveAnnotation13() throws Exception { - this.createAnnotationAndMembers("JoinColumn", "String name();"); - this.createAnnotationAndMembers("JoinColumns", "JoinColumn[] columns();"); - ICompilationUnit cu = this.createTestType("@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID0\"), @annot.JoinColumn(name=\"ADDRESS_ID1\"), null, @annot.JoinColumn(name=\"ADDRESS_ID3\")})"); - String expected = "@annot.JoinColumns(columns={@annot.JoinColumn(name=\"ADDRESS_ID3\"), @annot.JoinColumn(name=\"ADDRESS_ID1\")})"; - IndexedDeclarationAnnotationAdapter cidaa = new CombinationIndexedDeclarationAnnotationAdapter( - "annot.JoinColumn", "annot.JoinColumns", "columns", 3); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), cidaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected, cu); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/DefaultAnnotationEditFormatterTests.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/DefaultAnnotationEditFormatterTests.java deleted file mode 100644 index 1237cc9bf1..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/DefaultAnnotationEditFormatterTests.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.tests.internal.utility.jdt; - -import org.eclipse.jpt.common.core.internal.utility.jdt.DefaultAnnotationEditFormatter; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; - -@SuppressWarnings("nls") -public class DefaultAnnotationEditFormatterTests extends AnnotationTestCase { - - - // ********** TestCase behavior ********** - - public DefaultAnnotationEditFormatterTests(String name) { - super(name); - } - - - // ********** tests ********** - - public void testCommaLength() throws Exception { - assertEquals(1, this.commaLength(",")); - assertEquals(1, this.commaLength(", ")); - assertEquals(1, this.commaLength(", ")); - - assertEquals(2, this.commaLength(" ,")); - assertEquals(2, this.commaLength(" , ")); - assertEquals(2, this.commaLength(" , ")); - - assertEquals(3, this.commaLength(" ,")); - assertEquals(3, this.commaLength(" , ")); - assertEquals(3, this.commaLength(" , ")); - - assertEquals(0, this.commaLength(" ,,,")); - assertEquals(0, this.commaLength(" ,,, ")); - assertEquals(0, this.commaLength(" , ,")); - - assertEquals(0, this.commaLength(" ,x")); - assertEquals(0, this.commaLength(" ,x ")); - assertEquals(0, this.commaLength(" , x")); - - assertEquals(0, this.commaLength("x ,")); - assertEquals(0, this.commaLength("x , ")); - assertEquals(0, this.commaLength("x , ")); - } - - private int commaLength(String s) { - Integer len = (Integer) ReflectionTools.executeMethod(DefaultAnnotationEditFormatter.instance(), "commaLength", String.class, s); - return len.intValue(); - } - - public void testStringIsAnnotation() throws Exception { - assertTrue(this.stringIsAnnotation("@F")); - assertTrue(this.stringIsAnnotation("@Foo")); - assertTrue(this.stringIsAnnotation("@org.bar.Foo")); - - assertFalse(this.stringIsAnnotation("")); - assertFalse(this.stringIsAnnotation("@")); - assertFalse(this.stringIsAnnotation("Foo")); - assertFalse(this.stringIsAnnotation("Foo@")); - } - - private boolean stringIsAnnotation(String s) { - Boolean b = (Boolean) ReflectionTools.executeMethod(DefaultAnnotationEditFormatter.instance(), "stringIsAnnotation", String.class, s); - return b.booleanValue(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/JptCommonCoreUtilityJdtTests.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/JptCommonCoreUtilityJdtTests.java deleted file mode 100644 index df288615f1..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/JptCommonCoreUtilityJdtTests.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.tests.internal.utility.jdt; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class JptCommonCoreUtilityJdtTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptCommonCoreUtilityJdtTests.class.getPackage().getName()); - suite.addTestSuite(CombinationIndexedDeclarationAnnotationAdapterTests.class); - suite.addTestSuite(DefaultAnnotationEditFormatterTests.class); - suite.addTestSuite(ASTToolsTests.class); - suite.addTestSuite(MemberAnnotationElementAdapterTests.class); - suite.addTestSuite(NestedDeclarationAnnotationAdapterTests.class); - suite.addTestSuite(NestedIndexedDeclarationAnnotationAdapterTests.class); - suite.addTestSuite(SimpleDeclarationAnnotationAdapterTests.class); - suite.addTestSuite(TypeTests.class); - return suite; - } - - private JptCommonCoreUtilityJdtTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/MemberAnnotationElementAdapterTests.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/MemberAnnotationElementAdapterTests.java deleted file mode 100644 index 776da5f86a..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/MemberAnnotationElementAdapterTests.java +++ /dev/null @@ -1,1297 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.tests.internal.utility.jdt; - -import java.util.Arrays; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTNodeTextRange; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotationStringArrayExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.CharacterStringExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumArrayDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.NumberIntegerExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.PrimitiveTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.StringExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.TypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; - -@SuppressWarnings("nls") -public class MemberAnnotationElementAdapterTests extends AnnotationTestCase { - - public MemberAnnotationElementAdapterTests(String name) { - super(name); - } - - private void createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception { - this.javaProject.createCompilationUnit("annot", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }"); - } - - private void createEnum(String enumName, String enumBody) throws Exception { - this.createEnum("enums", enumName, enumBody); - } - - private void createEnum(String packageName, String enumName, String enumBody) throws Exception { - this.javaProject.createCompilationUnit(packageName, enumName + ".java", "public enum " + enumName + " { " + enumBody + " }"); - } - - public void testValue1() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=\"xxx\")"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("xxx", aea.getValue()); - } - - public void testValue2() throws Exception { - this.createAnnotationAndMembers("Foo", "int bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=48)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", NumberIntegerExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals(Integer.valueOf(48), aea.getValue()); - } - - public void testValue3() throws Exception { - this.createAnnotationAndMembers("Foo", "char bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar='c')"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", CharacterStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("c", aea.getValue()); - } - - public void testValue4() throws Exception { - this.createAnnotationAndMembers("Foo", "boolean bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=false)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", BooleanExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals(Boolean.FALSE, aea.getValue()); - } - - public void testValue5() throws Exception { - this.createAnnotationAndMembers("Baz", "boolean fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.Bar(jimmy=@annot.Baz(fred=false)))"); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa3, "fred", BooleanExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals(Boolean.FALSE, aea.getValue()); - } - - public void testValue6() throws Exception { - this.createAnnotationAndMembers("Foo", "boolean value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(false)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, BooleanExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals(Boolean.FALSE, aea.getValue()); - } - - public void testValueNull1() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertNull(aea.getValue()); - } - - public void testValueNull2() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - ICompilationUnit cu = this.createTestType(); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertNull(aea.getValue()); - } - - public void testValueNull3() throws Exception { - this.createAnnotationAndMembers("Baz", "String fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.Bar(jimmy=@annot.Baz))"); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa3, "fred"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertNull(aea.getValue()); - } - - public void testValueStringConcatenation() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=\"xxx\" + \"yyy\" + \"zzz\")"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("xxxyyyzzz", aea.getValue()); - } - - public void testValueStringConstant() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - // just a bit hacky: - ICompilationUnit cu = this.createTestType("private static final String FOO_BAR = \"xxx\"; @annot.Foo(bar=FOO_BAR + \"yyy\" + \"zzz\")"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("xxxyyyzzz", aea.getValue()); - } - - public void testValueNumberArithmetic() throws Exception { - this.createAnnotationAndMembers("Foo", "int bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=47 - 7 + 2 * 1 / 1)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forNumbers(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals(Integer.valueOf(42), aea.getValue()); - } - - public void testValueNumberShift() throws Exception { - this.createAnnotationAndMembers("Foo", "int bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=2 << 2)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forNumbers(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals(Integer.valueOf(8), aea.getValue()); - } - - public void testValueNumberConstant() throws Exception { - this.createAnnotationAndMembers("Foo", "int bar();"); - // just a bit hacky: - ICompilationUnit cu = this.createTestType("private static final int FOO_BAR = 77; @annot.Foo(bar=FOO_BAR)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forNumbers(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals(Integer.valueOf(77), aea.getValue()); - } - - public void testValueCharacterConstant() throws Exception { - this.createAnnotationAndMembers("Foo", "char bar();"); - // just a bit hacky: - ICompilationUnit cu = this.createTestType("private static final char FOO_BAR = 'Q'; @annot.Foo(bar=FOO_BAR)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forCharacters(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("Q", aea.getValue()); - } - - public void testValueCharacterCast() throws Exception { - this.createAnnotationAndMembers("Foo", "char bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=(char) 0x41)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forCharacters(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("A", aea.getValue()); - } - - public void testValueBooleanOperator1() throws Exception { - this.createAnnotationAndMembers("Foo", "boolean bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=7 > 2)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals(Boolean.TRUE, aea.getValue()); - } - - public void testValueBooleanOperator2() throws Exception { - this.createAnnotationAndMembers("Foo", "boolean bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=7 == 2)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals(Boolean.FALSE, aea.getValue()); - } - - public void testValueBooleanOperator3() throws Exception { - this.createAnnotationAndMembers("Foo", "boolean bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=(7 != 2) && false)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals(Boolean.FALSE, aea.getValue()); - } - - public void testValueBooleanOperator4() throws Exception { - this.createAnnotationAndMembers("Foo", "boolean bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=(7 != 2) ? false : true)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals(Boolean.FALSE, aea.getValue()); - } - - public void testValueInvalidValue1() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=77)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertNull(aea.getValue()); - } - - public void testValueInvalidValue2() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=bazzzz)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertNull(aea.getValue()); - } - - public void testValueInvalidValue3() throws Exception { - this.createAnnotationAndMembers("Foo", "boolean bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=bazzzz)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertNull(aea.getValue()); - } - - public void testValueInvalidValue4() throws Exception { - this.createAnnotationAndMembers("Foo", "char bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=\"bazzzz\")"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forCharacters(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertNull(aea.getValue()); - } - - public void testValueInvalidValue5() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=\"java.lang.Object\")"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", SimpleTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertNull(aea.getValue()); - } - - public void testValueInvalidValue6() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=enums.TestEnum.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertNull(aea.getValue()); - } - - public void testValueInvalidValue7() throws Exception { - this.createAnnotationAndMembers("Baz", "boolean fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - String value = "\"false\""; - String element = "fred=" + value; - String annotation = "@annot.Foo(@annot.Bar(jimmy=@annot.Baz(" + element + ")))"; - ICompilationUnit cu = this.createTestType(annotation); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa3, "fred", BooleanExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertNull(aea.getValue()); - } - - public void testValueInvalidValue8() throws Exception { - this.createAnnotationAndMembers("Foo", "String[] bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar={true, false})"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertTrue(Arrays.equals(new String[] {null, null}, aea.getValue())); - } - - public void testValueInvalidValue9() throws Exception { - this.createAnnotationAndMembers("Foo", "String[] bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=77)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertTrue(Arrays.equals(new String[] {null}, aea.getValue())); - } - - public void testASTNode1() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - String value = "\"xxx\""; - String element = "bar=" + value; - String annotation = "@annot.Foo(" + element + ")"; - ICompilationUnit cu = this.createTestType(annotation); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - TextRange textRange = new ASTNodeTextRange(aea.getAstNode(this.buildASTRoot(cu))); - assertEquals(this.getSource(cu).indexOf(value), textRange.getOffset()); - assertEquals(value.length(), textRange.getLength()); - assertEquals(7, textRange.getLineNumber()); - } - - public void testASTNode2() throws Exception { - this.createAnnotationAndMembers("Baz", "boolean fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - String value = "false"; - String element = "fred=" + value; - String annotation = "@annot.Foo(@annot.Bar(jimmy=@annot.Baz(" + element + ")))"; - ICompilationUnit cu = this.createTestType(annotation); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa3, "fred", BooleanExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals(Boolean.FALSE, aea.getValue()); - TextRange textRange = new ASTNodeTextRange(aea.getAstNode(this.buildASTRoot(cu))); - assertEquals(value.length(), textRange.getLength()); - } - - public void testASTNode3() throws Exception { - this.createAnnotationAndMembers("Foo", "String value();"); - String element = "\"xxx\""; - String annotation = "@annot.Foo(" + element + ")"; - ICompilationUnit cu = this.createTestType(annotation); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - TextRange textRange = new ASTNodeTextRange(aea.getAstNode(this.buildASTRoot(cu))); - assertEquals(this.getSource(cu).indexOf(element), textRange.getOffset()); - assertEquals(element.length(), textRange.getLength()); - } - - public void testASTNode4() throws Exception { - this.createAnnotationAndMembers("Foo", "String value();"); - String annotation = "@annot.Foo"; - ICompilationUnit cu = this.createTestType(annotation); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - TextRange textRange = new ASTNodeTextRange(aea.getAstNode(this.buildASTRoot(cu))); - assertEquals(this.getSource(cu).indexOf(annotation), textRange.getOffset()); - assertEquals(annotation.length(), textRange.getLength()); - } - - public void testSetValue1() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - String annotation = "@annot.Foo(bar=\"xxx\")"; - ICompilationUnit cu = this.createTestType(annotation); - this.assertSourceContains(annotation, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - aea.setValue(null); - this.assertSourceDoesNotContain("bar", cu); - } - - public void testSetValue2() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - String annotation = "@annot.Foo(bar=\"xxx\")"; - ICompilationUnit cu = this.createTestType(annotation); - this.assertSourceContains(annotation, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - aea.setValue(null); - this.assertSourceDoesNotContain(annotation, cu); - this.assertSourceContains("@Foo", cu); - } - - public void testSetValue3() throws Exception { - this.createAnnotationAndMembers("Baz", "boolean fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - String annotation = "@annot.Foo(@annot.Bar(jimmy=@annot.Baz(fred=false)))"; - ICompilationUnit cu = this.createTestType(annotation); - this.assertSourceContains(annotation, cu); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa3, "fred", BooleanExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - aea.setValue(null); - this.assertSourceDoesNotContain(annotation, cu); - this.assertSourceDoesNotContain("fred", cu); - } - - public void testSetValue3a() throws Exception { - this.createAnnotationAndMembers("Baz", "boolean fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - String annotation = "@annot.Foo(@annot.Bar(jimmy=@annot.Baz(fred=false)))"; - ICompilationUnit cu = this.createTestType(annotation); - this.assertSourceContains(annotation, cu); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa3, "fred", BooleanExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - aea.setValue(null); - this.assertSourceDoesNotContain(annotation, cu); - this.assertSourceDoesNotContain("fred", cu); - this.assertSourceContains("@annot.Foo(@annot.Bar(jimmy=@Baz))", cu); - } - - public void testSetValue4() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - ICompilationUnit cu = this.createTestType(); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - aea.setValue("xxx"); - this.assertSourceContains("@Foo(bar = \"xxx\")", cu); - } - - public void testSetValue5() throws Exception { - this.createAnnotationAndMembers("Baz", "boolean fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - String annotation = "@annot.Foo(@annot.Bar(jimmy=@annot.Baz(fred=false)))"; - ICompilationUnit cu = this.createTestType(annotation); - this.assertSourceContains(annotation, cu); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa3, "fred", BooleanExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - aea.setValue(Boolean.TRUE); - this.assertSourceDoesNotContain(annotation, cu); - this.assertSourceContains("@annot.Foo(@annot.Bar(jimmy=@annot.Baz(fred=true)))", cu); - } - - public void testSetValue6() throws Exception { - this.createAnnotationAndMembers("Baz", "boolean fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - ICompilationUnit cu = this.createTestType(); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "jimmy", "annot.Baz"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa3, "fred", BooleanExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - aea.setValue(Boolean.TRUE); - this.assertSourceContains("@Foo(@Bar(jimmy = @Baz(fred = true)))", cu); - } - - public void testSetValue7() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - String annotation = "@annot.Foo(bar=\"xxx\")"; - ICompilationUnit cu = this.createTestType(annotation); - this.assertSourceContains(annotation, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - aea.setValue("yyy"); - this.assertSourceDoesNotContain(annotation, cu); - this.assertSourceContains("@annot.Foo(bar=\"yyy\")", cu); - } - - public void testSetValue8() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar();"); - String annotation = "@annot.Foo"; - ICompilationUnit cu = this.createTestType(annotation); - this.assertSourceContains(annotation, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - aea.setValue("xxx"); - this.assertSourceContains("@Foo(bar = \"xxx\")", cu); - } - - public void testSetValue9() throws Exception { - this.createAnnotationAndMembers("Foo", "String value(); String bar();"); - String annotation = "@annot.Foo(\"zzz\")"; - ICompilationUnit cu = this.createTestType(annotation); - this.assertSourceContains(annotation, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - aea.setValue("xxx"); - this.assertSourceDoesNotContain(annotation, cu); - this.assertSourceContains("@Foo(value = \"zzz\", bar = \"xxx\")", cu); - } - - public void testSetValue10() throws Exception { - this.createAnnotationAndMembers("Foo", "String bar(); String baz();"); - String annotation = "@annot.Foo(bar=\"xxx\")"; - ICompilationUnit cu = this.createTestType(annotation); - this.assertSourceContains(annotation, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "baz"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - aea.setValue("yyy"); - this.assertSourceDoesNotContain(annotation, cu); - this.assertSourceContains("@annot.Foo(bar=\"xxx\", baz = \"yyy\")", cu); - } - - public void testSetValue11() throws Exception { - this.createAnnotationAndMembers("Baz", "int fred();"); - this.createAnnotationAndMembers("Bar", "annot.Baz[] jimmy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - String annotation = "@annot.Foo(@annot.Bar(jimmy={@annot.Baz(fred=0), @annot.Baz(fred=1), @annot.Baz(fred=2), @annot.Baz(fred=3)}))"; - ICompilationUnit cu = this.createTestType(annotation); - this.assertSourceContains(annotation, cu); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "value", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedIndexedDeclarationAnnotationAdapter(daa2, "jimmy", 2, "annot.Baz"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa3, "fred", NumberIntegerExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - assertEquals(Integer.valueOf(2), aea.getValue()); - aea.setValue(Integer.valueOf(48)); - this.assertSourceContains("@annot.Foo(@annot.Bar(jimmy={@annot.Baz(fred=0), @annot.Baz(fred=1), @annot.Baz(fred=48), @annot.Baz(fred=3)}))", cu); - } - - public void testSetValue12() throws Exception { - this.createAnnotationAndMembers("Foo", "String value();"); - String annotation = "@annot.Foo"; - ICompilationUnit cu = this.createTestType(annotation); - this.assertSourceContains(annotation, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "value"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - aea.setValue("xxx"); - this.assertSourceContains("@Foo(\"xxx\")", cu); - } - - public void testSetValue13() throws Exception { - this.createAnnotationAndMembers("Foo", "String value();"); - String annotation = "@annot.Foo(\"zzz\")"; - ICompilationUnit cu = this.createTestType(annotation); - this.assertSourceContains(annotation, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = ConversionDeclarationAnnotationElementAdapter.forStrings(daa, "value"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - - aea.setValue("xxx"); - this.assertSourceDoesNotContain(annotation, cu); - this.assertSourceContains("@annot.Foo(\"xxx\")", cu); - } - - public void testSimpleTypeLiteral1() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=java.lang.Object.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", SimpleTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("java.lang.Object", aea.getValue()); - } - - public void testSimpleTypeLiteral2() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - ICompilationUnit cu = this.createTestType(); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", SimpleTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - aea.setValue("java.lang.Object"); - this.assertSourceContains("@Foo(bar = java.lang.Object.class)", cu); - } - - public void testSimpleTypeLiteral3() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=int.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", SimpleTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertNull(aea.getValue()); - } - - public void testSimpleTypeLiteral4() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=java.util.Map.Entry.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", SimpleTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("java.util.Map.Entry", aea.getValue()); - } - - public void testPrimitiveTypeLiteral1() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=int.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", PrimitiveTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("int", aea.getValue()); - } - - public void testPrimitiveTypeLiteral2() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - ICompilationUnit cu = this.createTestType(); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", PrimitiveTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - aea.setValue("int"); - this.assertSourceContains("@Foo(bar = int.class)", cu); - } - - public void testPrimitiveTypeLiteral3() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=java.lang.Object.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", PrimitiveTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertNull(aea.getValue()); - } - - public void testPrimitiveTypeLiteral4() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=void.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", PrimitiveTypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("void", aea.getValue()); - } - - public void testTypeLiteral1() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=java.lang.Object.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", TypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("java.lang.Object", aea.getValue()); - } - - public void testTypeLiteral2() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - ICompilationUnit cu = this.createTestType(); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", TypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - aea.setValue("java.lang.Object"); - this.assertSourceContains("@Foo(bar = java.lang.Object.class)", cu); - } - - public void testTypeLiteral3() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=java.util.Map.Entry.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", TypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("java.util.Map.Entry", aea.getValue()); - } - - public void testTypeLiteral14() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=int.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", TypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("int", aea.getValue()); - } - - public void testTypeLiteral5() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - ICompilationUnit cu = this.createTestType(); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", TypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - aea.setValue("int"); - this.assertSourceContains("@Foo(bar = int.class)", cu); - } - - public void testTypeLiteral6() throws Exception { - this.createAnnotationAndMembers("Foo", "Class bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=void.class)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", TypeStringExpressionConverter.instance()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("void", aea.getValue()); - } - - public void testValueEnum1() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=enums.TestEnum.XXX)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("enums.TestEnum.XXX", aea.getValue()); - } - - public void testValueEnum2() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();"); - ICompilationUnit cu = this.createTestType("static enums.TestEnum.XXX", "@annot.Foo(bar=XXX)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("enums.TestEnum.XXX", aea.getValue()); - } - - public void testValueEnum3() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertNull(aea.getValue()); - } - - public void testValueEnum4() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();"); - ICompilationUnit cu = this.createTestType("enums.TestEnum", "@annot.Foo(bar=TestEnum.XXX)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertEquals("enums.TestEnum.XXX", aea.getValue()); - } - - public void testSetValueEnum1() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();"); - String expected = "@annot.Foo(bar=XXX)"; - ICompilationUnit cu = this.createTestType("static enums.TestEnum.XXX", expected); - this.assertSourceContains(expected, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - aea.setValue(null); - this.assertSourceDoesNotContain("bar", cu); - } - - public void testSetValueEnum2() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum bar();"); - String expected = "@Foo(bar = XXX)"; - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain(expected, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - aea.setValue("enums.TestEnum.XXX"); - this.assertSourceContains("import static enums.TestEnum.XXX;", cu); - this.assertSourceContains(expected, cu); - } - - public void testSetValueEnumImportCollision1() throws Exception { - this.createEnum("enums1", "TestEnum", "XXX, YYY, ZZZ"); - this.createEnum("enums2", "TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums1.TestEnum bar1(); enums2.TestEnum bar2();"); - String expected = "@Foo(bar1 = XXX, bar2 = TestEnum.XXX)"; - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - - DeclarationAnnotationElementAdapter daea1 = new EnumDeclarationAnnotationElementAdapter(daa, "bar1"); - AnnotationElementAdapter aea1 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea1); - aea1.setValue("enums1.TestEnum.XXX"); - - DeclarationAnnotationElementAdapter daea2 = new EnumDeclarationAnnotationElementAdapter(daa, "bar2"); - AnnotationElementAdapter aea2 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea2); - aea2.setValue("enums2.TestEnum.XXX"); - - this.assertSourceContains("import static enums1.TestEnum.XXX;", cu); - this.assertSourceDoesNotContain("import static enums2.TestEnum.XXX;", cu); - this.assertSourceContains("import enums2.TestEnum;", cu); - this.assertSourceContains(expected, cu); - } - - public void testSetValueEnumImportCollision2() throws Exception { - this.createEnum("enums1", "TestEnum", "XXX, YYY, ZZZ"); - this.createEnum("enums2", "TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums1.TestEnum bar1(); enums2.TestEnum bar2();"); - String expected = "@annot.Foo(bar1=XXX, bar2 = TestEnum.XXX)"; - ICompilationUnit cu = this.createTestType("static enums1.TestEnum.*", "@annot.Foo(bar1=XXX)"); - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - - DeclarationAnnotationElementAdapter daea1 = new EnumDeclarationAnnotationElementAdapter(daa, "bar1"); - AnnotationElementAdapter aea1 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea1); - assertNotNull(aea1.getValue()); - - DeclarationAnnotationElementAdapter daea2 = new EnumDeclarationAnnotationElementAdapter(daa, "bar2"); - AnnotationElementAdapter aea2 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea2); - aea2.setValue("enums2.TestEnum.XXX"); - - this.assertSourceContains("import static enums1.TestEnum.*;", cu); - this.assertSourceDoesNotContain("import static enums2.TestEnum.XXX;", cu); - this.assertSourceContains("import enums2.TestEnum;", cu); - this.assertSourceContains(expected, cu); - } - - public void testSetValueEnumImportCollision3() throws Exception { - this.createEnum("TestEnum1", "XXX, YYY, ZZZ"); - this.createEnum("TestEnum2", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum1 bar1(); enums.TestEnum2 bar2();"); - String expected = "@Foo(bar1 = XXX, bar2 = TestEnum2.XXX)"; - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - - DeclarationAnnotationElementAdapter daea1 = new EnumDeclarationAnnotationElementAdapter(daa, "bar1"); - AnnotationElementAdapter aea1 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea1); - aea1.setValue("enums.TestEnum1.XXX"); - - DeclarationAnnotationElementAdapter daea2 = new EnumDeclarationAnnotationElementAdapter(daa, "bar2"); - AnnotationElementAdapter aea2 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea2); - aea2.setValue("enums.TestEnum2.XXX"); - - this.assertSourceContains("import static enums.TestEnum1.XXX;", cu); - this.assertSourceContains("import enums.TestEnum2;", cu); - this.assertSourceContains(expected, cu); - } - - public void testSetValueEnumImportCollision4() throws Exception { - this.createEnum("TestEnum1", "XXX, YYY, ZZZ"); - this.createEnum("TestEnum2", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum1 bar1(); enums.TestEnum2 bar2();"); - String expected = "@annot.Foo(bar1=XXX, bar2 = TestEnum2.XXX)"; - ICompilationUnit cu = this.createTestType("static enums.TestEnum1.*", "@annot.Foo(bar1=XXX)"); - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - - DeclarationAnnotationElementAdapter daea1 = new EnumDeclarationAnnotationElementAdapter(daa, "bar1"); - AnnotationElementAdapter aea1 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea1); - assertNotNull(aea1.getValue()); - - DeclarationAnnotationElementAdapter daea2 = new EnumDeclarationAnnotationElementAdapter(daa, "bar2"); - AnnotationElementAdapter aea2 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea2); - aea2.setValue("enums.TestEnum2.XXX"); - - this.assertSourceContains("import static enums.TestEnum1.*;", cu); - this.assertSourceContains("import enums.TestEnum2;", cu); - this.assertSourceContains(expected, cu); - } - - /** - * not sure this is exactly what we want... - * it would be nice if we just skip the static import; but it's a matter of taste... - */ - public void testSetValueEnumImportCollision5() throws Exception { - this.createEnum("TestEnum1", "XXX, YYY, ZZZ"); - this.createEnum("TestEnum2", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum1 bar1(); enums.TestEnum2 bar2();"); - String expected = "@Foo(bar1 = XXX, bar2 = TestEnum2.XXX)"; - ICompilationUnit cu = this.createTestType("enums.*", ""); - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - - DeclarationAnnotationElementAdapter daea1 = new EnumDeclarationAnnotationElementAdapter(daa, "bar1"); - AnnotationElementAdapter aea1 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea1); - aea1.setValue("enums.TestEnum1.XXX"); - - DeclarationAnnotationElementAdapter daea2 = new EnumDeclarationAnnotationElementAdapter(daa, "bar2"); - AnnotationElementAdapter aea2 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea2); - aea2.setValue("enums.TestEnum2.XXX"); - - this.assertSourceContains("import enums.*;", cu); - this.assertSourceContains("import static enums.TestEnum1.XXX;", cu); - this.assertSourceDoesNotContain("import enums.TestEnum2;", cu); - this.assertSourceContains(expected, cu); - } - - public void testSetValueEnumImportCollision6() throws Exception { - this.createEnum("enums1", "TestEnum", "XXX, YYY, ZZZ"); - this.createEnum("enums2", "TestEnum", "XXX, YYY, ZZZ"); - this.createEnum("enums3", "TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums1.TestEnum bar1(); enums2.TestEnum bar2(); enums3.TestEnum bar3();"); - String expected = "@Foo(bar1 = XXX, bar2 = TestEnum.XXX, bar3 = enums3.TestEnum.XXX)"; - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - - DeclarationAnnotationElementAdapter daea1 = new EnumDeclarationAnnotationElementAdapter(daa, "bar1"); - AnnotationElementAdapter aea1 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea1); - aea1.setValue("enums1.TestEnum.XXX"); - - DeclarationAnnotationElementAdapter daea2 = new EnumDeclarationAnnotationElementAdapter(daa, "bar2"); - AnnotationElementAdapter aea2 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea2); - aea2.setValue("enums2.TestEnum.XXX"); - - DeclarationAnnotationElementAdapter daea3 = new EnumDeclarationAnnotationElementAdapter(daa, "bar3"); - AnnotationElementAdapter aea3 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea3); - aea3.setValue("enums3.TestEnum.XXX"); - - this.assertSourceContains("import static enums1.TestEnum.XXX;", cu); - this.assertSourceDoesNotContain("import static enums2.TestEnum.XXX;", cu); - this.assertSourceContains("import enums2.TestEnum;", cu); - this.assertSourceDoesNotContain("import static enums3", cu); - this.assertSourceDoesNotContain("import enums3", cu); - this.assertSourceContains(expected, cu); - } - - public void testValueStringArray() throws Exception { - this.createAnnotationAndMembers("Foo", "String[] bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar={\"string0\", \"string1\"})"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertTrue(Arrays.equals(new String[] {"string0", "string1"}, aea.getValue())); - } - - public void testValueStringArrayConcatenation() throws Exception { - this.createAnnotationAndMembers("Foo", "String[] bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar={\"stri\" + \"ng0\", \"s\" + \"tring1\"})"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertTrue(Arrays.equals(new String[] {"string0", "string1"}, aea.getValue())); - } - - public void testValueStringArrayEmpty() throws Exception { - this.createAnnotationAndMembers("Foo", "String[] bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar={})"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertTrue(Arrays.equals(new String[0], aea.getValue())); - } - - public void testValueStringArraySingleElement() throws Exception { - this.createAnnotationAndMembers("Foo", "String[] bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=\"string0\")"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertTrue(Arrays.equals(new String[] {"string0"}, aea.getValue())); - } - - public void testValueNullStringArray() throws Exception { - this.createAnnotationAndMembers("Foo", "String[] bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo()"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertTrue(Arrays.equals(new String[0], aea.getValue())); - } - - public void testSetValueStringArray() throws Exception { - this.createAnnotationAndMembers("Foo", "String[] bar();"); - String expected = "@Foo(bar = { \"string0\", \"string1\" })"; - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain(expected, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - aea.setValue(new String[] {"string0", "string1"}); - this.assertSourceContains(expected, cu); - } - - public void testSetValueStringArrayEmptyRemove() throws Exception { - this.createAnnotationAndMembers("Foo", "String[] bar();"); - String expected = "@Foo"; - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain(expected, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - aea.setValue(new String[0]); - this.assertSourceDoesNotContain(expected, cu); - } - - public void testSetValueStringArrayEmpty() throws Exception { - this.createAnnotationAndMembers("Foo", "String[] bar();"); - String expected = "@Foo(bar = {})"; - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain(expected, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - ExpressionConverter expressionConverter = new AnnotationStringArrayExpressionConverter(StringExpressionConverter.instance(), false); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", expressionConverter); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - aea.setValue(new String[0]); - this.assertSourceContains(expected, cu); - } - - public void testSetValueStringArraySingleElement() throws Exception { - this.createAnnotationAndMembers("Foo", "String[] bar();"); - String annotation = "@Foo(bar = \"string0\")"; - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain(annotation, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new ConversionDeclarationAnnotationElementAdapter(daa, "bar", AnnotationStringArrayExpressionConverter.forStrings()); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - aea.setValue(new String[] {"string0"}); - this.assertSourceContains(annotation, cu); - } - - public void testValueEnumArray() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar={enums.TestEnum.XXX, enums.TestEnum.YYY})"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertTrue(Arrays.equals(new String[] {"enums.TestEnum.XXX", "enums.TestEnum.YYY"}, aea.getValue())); - } - - public void testValueEnumArrayInvalidEntry() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar={enums.TestEnum.XXX, 88})"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertTrue(Arrays.equals(new String[] {"enums.TestEnum.XXX", null}, aea.getValue())); - } - - public void testValueEnumArrayEmpty() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar={})"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertTrue(Arrays.equals(new String[0], aea.getValue())); - } - - public void testValueEnumArraySingleElement() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=enums.TestEnum.XXX)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertTrue(Arrays.equals(new String[] {"enums.TestEnum.XXX"}, aea.getValue())); - } - - public void testValueEnumArraySingleElementInvalid() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(bar=\"\")"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertTrue(Arrays.equals(new String[] {null}, aea.getValue())); - } - - public void testValueNullEnumArray() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();"); - ICompilationUnit cu = this.createTestType("@annot.Foo()"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - assertTrue(Arrays.equals(new String[0], aea.getValue())); - } - - public void testSetValueEnumArray() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();"); - String expected = "@Foo(bar = { XXX, YYY })"; - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain(expected, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - aea.setValue(new String[] {"enums.TestEnum.XXX", "enums.TestEnum.YYY"}); - this.assertSourceContains("import static enums.TestEnum.XXX;", cu); - this.assertSourceContains("import static enums.TestEnum.YYY;", cu); - this.assertSourceContains(expected, cu); - } - - public void testSetValueEnumArrayEmptyRemove() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();"); - String expected = "@Foo"; - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain(expected, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - aea.setValue(new String[0]); - this.assertSourceDoesNotContain(expected, cu); - } - - public void testSetValueEnumArrayEmpty() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();"); - String expected = "@Foo(bar = {})"; - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain(expected, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar", false); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - aea.setValue(new String[0]); - this.assertSourceContains(expected, cu); - } - - public void testSetValueEnumArraySingleElement() throws Exception { - this.createEnum("TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum[] bar();"); - String expected = "@Foo(bar = XXX)"; - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain(expected, cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationElementAdapter daea = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar"); - AnnotationElementAdapter aea = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea); - aea.setValue(new String[] {"enums.TestEnum.XXX"}); - this.assertSourceContains("import static enums.TestEnum.XXX;", cu); - this.assertSourceContains(expected, cu); - } - - public void testSetValueEnumArrayImportCollision1() throws Exception { - this.createEnum("enums1", "TestEnum", "XXX, YYY, ZZZ"); - this.createEnum("enums2", "TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums1.TestEnum[] bar1(); enums2.TestEnum[] bar2();"); - String expected = "@Foo(bar1 = { XXX, YYY }, bar2 = { TestEnum.XXX, TestEnum.YYY })"; - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - - DeclarationAnnotationElementAdapter daea1 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar1"); - AnnotationElementAdapter aea1 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea1); - aea1.setValue(new String[] {"enums1.TestEnum.XXX", "enums1.TestEnum.YYY"}); - - DeclarationAnnotationElementAdapter daea2 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar2"); - AnnotationElementAdapter aea2 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea2); - aea2.setValue(new String[] {"enums2.TestEnum.XXX", "enums2.TestEnum.YYY"}); - - this.assertSourceContains("import static enums1.TestEnum.XXX;", cu); - this.assertSourceContains("import static enums1.TestEnum.YYY;", cu); - this.assertSourceDoesNotContain("import static enums2.TestEnum.XXX;", cu); - this.assertSourceDoesNotContain("import static enums2.TestEnum.YYY;", cu); - this.assertSourceContains("import enums2.TestEnum;", cu); - this.assertSourceContains(expected, cu); - } - - public void testSetValueEnumArrayImportCollision2() throws Exception { - this.createEnum("enums1", "TestEnum", "XXX, YYY, ZZZ"); - this.createEnum("enums2", "TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums1.TestEnum[] bar1(); enums2.TestEnum[] bar2();"); - String expected = "@annot.Foo(bar1={XXX,YYY}, bar2 = { TestEnum.XXX, TestEnum.YYY })"; - ICompilationUnit cu = this.createTestType("static enums1.TestEnum.*", "@annot.Foo(bar1={XXX,YYY})"); - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - - DeclarationAnnotationElementAdapter daea1 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar1"); - AnnotationElementAdapter aea1 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea1); - assertNotNull(aea1.getValue()); - - DeclarationAnnotationElementAdapter daea2 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar2"); - AnnotationElementAdapter aea2 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea2); - aea2.setValue(new String[] {"enums2.TestEnum.XXX", "enums2.TestEnum.YYY"}); - - this.assertSourceContains("import static enums1.TestEnum.*;", cu); - this.assertSourceDoesNotContain("import static enums2.TestEnum.XXX;", cu); - this.assertSourceDoesNotContain("import static enums2.TestEnum.YYY;", cu); - this.assertSourceContains("import enums2.TestEnum;", cu); - this.assertSourceContains(expected, cu); - } - - public void testSetValueEnumArrayImportCollision3() throws Exception { - this.createEnum("TestEnum1", "XXX, YYY, ZZZ"); - this.createEnum("TestEnum2", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum1[] bar1(); enums.TestEnum2[] bar2();"); - String expected = "@Foo(bar1 = { XXX, YYY }, bar2 = { TestEnum2.XXX, TestEnum2.YYY })"; - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - - DeclarationAnnotationElementAdapter daea1 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar1"); - AnnotationElementAdapter aea1 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea1); - aea1.setValue(new String[] {"enums.TestEnum1.XXX", "enums.TestEnum1.YYY"}); - - DeclarationAnnotationElementAdapter daea2 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar2"); - AnnotationElementAdapter aea2 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea2); - aea2.setValue(new String[] {"enums.TestEnum2.XXX", "enums.TestEnum2.YYY"}); - - this.assertSourceContains("import static enums.TestEnum1.XXX;", cu); - this.assertSourceContains("import static enums.TestEnum1.YYY;", cu); - this.assertSourceDoesNotContain("import static enums.TestEnum2.XXX;", cu); - this.assertSourceDoesNotContain("import static enums.TestEnum2.YYY;", cu); - this.assertSourceContains("import enums.TestEnum2;", cu); - this.assertSourceContains(expected, cu); - } - - public void testSetValueEnumArrayImportCollision4() throws Exception { - this.createEnum("TestEnum1", "XXX, YYY, ZZZ"); - this.createEnum("TestEnum2", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums.TestEnum1[] bar1(); enums.TestEnum2[] bar2();"); - String expected = "@annot.Foo(bar1={XXX,YYY}, bar2 = { TestEnum2.XXX, TestEnum2.YYY })"; - ICompilationUnit cu = this.createTestType("static enums.TestEnum1.*", "@annot.Foo(bar1={XXX,YYY})"); - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - - DeclarationAnnotationElementAdapter daea1 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar1"); - AnnotationElementAdapter aea1 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea1); - assertNotNull(aea1.getValue()); - - DeclarationAnnotationElementAdapter daea2 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar2"); - AnnotationElementAdapter aea2 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea2); - aea2.setValue(new String[] {"enums.TestEnum2.XXX", "enums.TestEnum2.YYY"}); - - this.assertSourceContains("import static enums.TestEnum1.*;", cu); - this.assertSourceDoesNotContain("import static enums.TestEnum2.XXX;", cu); - this.assertSourceDoesNotContain("import static enums.TestEnum2.YYY;", cu); - this.assertSourceContains("import enums.TestEnum2;", cu); - this.assertSourceContains(expected, cu); - } - - public void testSetValueEnumArrayImportCollision6() throws Exception { - this.createEnum("enums1", "TestEnum", "XXX, YYY, ZZZ"); - this.createEnum("enums2", "TestEnum", "XXX, YYY, ZZZ"); - this.createEnum("enums3", "TestEnum", "XXX, YYY, ZZZ"); - this.createAnnotationAndMembers("Foo", "enums1.TestEnum[] bar1(); enums2.TestEnum[] bar2(); enums3.TestEnum[] bar3();"); - String expected = "@Foo(bar1 = { XXX, YYY }, bar2 = { TestEnum.XXX, TestEnum.YYY }, bar3 = { enums3.TestEnum.XXX, enums3.TestEnum.YYY })"; - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - - DeclarationAnnotationElementAdapter daea1 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar1"); - AnnotationElementAdapter aea1 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea1); - aea1.setValue(new String[] {"enums1.TestEnum.XXX", "enums1.TestEnum.YYY"}); - - DeclarationAnnotationElementAdapter daea2 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar2"); - AnnotationElementAdapter aea2 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea2); - aea2.setValue(new String[] {"enums2.TestEnum.XXX", "enums2.TestEnum.YYY"}); - - DeclarationAnnotationElementAdapter daea3 = new EnumArrayDeclarationAnnotationElementAdapter(daa, "bar3"); - AnnotationElementAdapter aea3 = new AnnotatedElementAnnotationElementAdapter(this.idField(cu), daea3); - aea3.setValue(new String[] {"enums3.TestEnum.XXX", "enums3.TestEnum.YYY"}); - - this.assertSourceContains("import static enums1.TestEnum.XXX;", cu); - this.assertSourceContains("import static enums1.TestEnum.YYY;", cu); - this.assertSourceDoesNotContain("import static enums2", cu); - this.assertSourceContains("import enums2.TestEnum;", cu); - this.assertSourceDoesNotContain("import static enums3", cu); - this.assertSourceDoesNotContain("import enums3", cu); - this.assertSourceContains(expected, cu); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/MiscTests.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/MiscTests.java deleted file mode 100644 index 77ef53aa9b..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/MiscTests.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.tests.internal.utility.jdt; - -import org.eclipse.jdt.core.IField; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.Signature; - -@SuppressWarnings("nls") -public class MiscTests extends AnnotationTestCase { - - public MiscTests(String name) { - super(name); - } - - /* - * Signature.toString(...) returns a dot-qualified name for member types - */ - public void testSignature() throws Exception { - IType hashTableType = this.getJavaProject().getJavaProject().findType("java.util.Hashtable"); - IField tableField = hashTableType.getField("table"); - String tableFieldTypeSignature = tableField.getTypeSignature(); - String tableFieldTypeName = Signature.toString(tableFieldTypeSignature); - assertEquals(tableFieldTypeName, "java.util.Hashtable.Entry[]"); - } - - /* - * IType.getFullyQualifiedName() returns a dollar-qualified name for member types - * (but the lookup on IJavaProject takes a dot-qualified name!) - */ - public void testITypeName() throws Exception { - IType hashTableEntryType = this.getJavaProject().getJavaProject().findType("java.util.Hashtable.Entry"); - assertEquals(hashTableEntryType.getFullyQualifiedName(), "java.util.Hashtable$Entry"); - } - - public void testITypeParameterizedName() throws Exception { - IType mapType = this.getJavaProject().getJavaProject().findType("java.util.Map"); - assertEquals(mapType.getFullyQualifiedParameterizedName(), "java.util.Map"); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/NestedDeclarationAnnotationAdapterTests.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/NestedDeclarationAnnotationAdapterTests.java deleted file mode 100644 index f92e2d832f..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/NestedDeclarationAnnotationAdapterTests.java +++ /dev/null @@ -1,763 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.tests.internal.utility.jdt; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jdt.core.dom.StringLiteral; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; - -@SuppressWarnings("nls") -public class NestedDeclarationAnnotationAdapterTests extends AnnotationTestCase { - - public NestedDeclarationAnnotationAdapterTests(String name) { - super(name); - } - - private void createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception { - this.javaProject.createCompilationUnit("annot", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }"); - } - - public void testAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotation=@annot.Bar)"); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - assertEquals("annot.Bar", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isMarkerAnnotation()); - } - - public void testAnnotation2() throws Exception { - this.createAnnotationAndMembers("Baz", "String value();"); - this.createAnnotationAndMembers("Bar", "annot.Baz yana();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotation=@annot.Bar(yana=@annot.Baz))"); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedDeclarationAnnotationAdapter(daa1, "nestedAnnotation", "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedDeclarationAnnotationAdapter(daa2, "yana", "annot.Baz"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa3); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - assertEquals("annot.Baz", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isMarkerAnnotation()); - } - - public void testAnnotationNull1() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - ICompilationUnit cu = this.createTestType("@annot.Foo()"); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - } - - public void testAnnotationNull2() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - ICompilationUnit cu = this.createTestType(); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - } - - public void testAnnotationNull3() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "String nestedAnnotation();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotation=\"annot.Bar\")"); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - } - - public void testAnnotationNull4() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Bar2", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar2 nestedAnnotation();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotation=@annot.Bar2)"); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - } - - public void testRemoveAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - String na = "@annot.Foo(nestedAnnotation=@annot.Bar)"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceDoesNotContain("nestedAnnotation", cu); - } - - public void testRemoveAnnotation1a() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - String na = "@annot.Foo(nestedAnnotation=@annot.Bar)"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceContains("Foo", cu); - } - - public void testRemoveAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("Foo", cu); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain("Foo", cu); - } - - public void testRemoveAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "String nestedAnnotation();"); - String na = "@annot.Foo(nestedAnnotation=\"annot.Bar\")"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(na, cu); - } - - public void testRemoveAnnotation4() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Bar2", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar2 nestedAnnotation();"); - String na = "@annot.Foo(nestedAnnotation=@annot.Bar2)"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(na, cu); - } - - public void testRemoveAnnotation5() throws Exception { - this.createAnnotationAndMembers("Baz", "String value();"); - this.createAnnotationAndMembers("Bar", "annot.Baz nestedAnnotation2();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation1();"); - String na = "@annot.Foo(nestedAnnotation1=@annot.Bar(nestedAnnotation2=@annot.Baz))"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daaFoo = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daaBar = new NestedDeclarationAnnotationAdapter(daaFoo, "nestedAnnotation1", "annot.Bar"); - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(daaBar, "nestedAnnotation2", "annot.Baz"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceDoesNotContain("Baz", cu); - } - - public void testRemoveAnnotation5a() throws Exception { - this.createAnnotationAndMembers("Baz", "String value();"); - this.createAnnotationAndMembers("Bar", "annot.Baz nestedAnnotation2();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation1();"); - String na = "@annot.Foo(nestedAnnotation1=@annot.Bar(nestedAnnotation2=@annot.Baz))"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daaFoo = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daaBar = new NestedDeclarationAnnotationAdapter(daaFoo, "nestedAnnotation1", "annot.Bar"); - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter(daaBar, "nestedAnnotation2", "annot.Baz"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceContains("@annot.Foo(nestedAnnotation1=@Bar)", cu); - } - - public void testNewMarkerAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("Foo", cu); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@Foo(nestedAnnotation = @Bar)", cu); - } - - public void testNewMarkerAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("Foo", cu); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@Foo(@Bar)", cu); - } - - public void testNewMarkerAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - String expected = "@Foo(nestedAnnotation = @Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation4() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - String expected = "@Foo(@Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation5() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation(); String value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")"); - String expected = "@Foo(value = \"something\", nestedAnnotation = @Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation6() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "Object value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")"); - String expected = "@annot.Foo(@Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation7() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar nestedAnnotation();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", nestedAnnotation = @Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation8() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", value = @Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewSingleMemberAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("Foo", cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation1(declaration); - } - }); - this.assertSourceContains("@Foo(nestedAnnotation = @Bar(\"test string literal\"))", cu); - } - - void editNewSingleMemberAnnotation1(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewSingleMemberAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("Foo", cu); - - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation2(declaration); - } - }); - this.assertSourceContains("@Foo(@Bar(\"test string literal\"))", cu); - } - - void editNewSingleMemberAnnotation2(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewSingleMemberAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - String expected = "@Foo(nestedAnnotation = @Bar(\"test string literal\"))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation3(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation3(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewSingleMemberAnnotation4() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - String expected = "@Foo(@Bar(\"test string literal\"))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation4(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation4(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewSingleMemberAnnotation5() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation(); String value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")"); - String expected = "@Foo(value = \"something\", nestedAnnotation = @Bar(\"test string literal\"))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation5(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation5(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewSingleMemberAnnotation6() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "Object value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")"); - String expected = "@annot.Foo(@Bar(\"test string literal\"))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation6(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation6(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewSingleMemberAnnotation7() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation(); String xxx();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", nestedAnnotation = @Bar(\"test string literal\"))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation7(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation7(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewSingleMemberAnnotation8() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value(); String xxx();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", value = @Bar(\"test string literal\"))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation8(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation8(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewNormalAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "String yyy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("Foo", cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation1(declaration); - } - }); - this.assertSourceContains("@Foo(nestedAnnotation = @Bar(yyy = \"test string literal\"))", cu); - } - - void editNewNormalAnnotation1(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "yyy", "test string literal"); - } - - public void testNewNormalAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "String yyy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("Foo", cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation2(declaration); - } - }); - this.assertSourceContains("@Foo(@Bar(yyy = \"test string literal\"))", cu); - } - - void editNewNormalAnnotation2(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "yyy", "test string literal"); - } - - public void testNewNormalAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "String yyy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation();"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - String expected = "@Foo(nestedAnnotation = @Bar(yyy = \"test string literal\"))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation3(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation3(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "yyy", "test string literal"); - } - - public void testNewNormalAnnotation4() throws Exception { - this.createAnnotationAndMembers("Bar", "String yyy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - String expected = "@Foo(@Bar(yyy = \"test string literal\"))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation4(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation4(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "yyy", "test string literal"); - } - - public void testNewNormalAnnotation5() throws Exception { - this.createAnnotationAndMembers("Bar", "String yyy();"); - this.createAnnotationAndMembers("Foo", "annot.Bar nestedAnnotation(); String value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")"); - String expected = "@Foo(value = \"something\", nestedAnnotation = @Bar(yyy = \"test string literal\"))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation5(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation5(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "yyy", "test string literal"); - } - - public void testNewNormalAnnotation6() throws Exception { - this.createAnnotationAndMembers("Bar", "String yyy();"); - this.createAnnotationAndMembers("Foo", "Object value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")"); - String expected = "@annot.Foo(@Bar(yyy = \"test string literal\"))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation6(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation6(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "yyy", "test string literal"); - } - - public void testNewNormalAnnotation7() throws Exception { - this.createAnnotationAndMembers("Bar", "String yyy();"); - this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar nestedAnnotation();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", nestedAnnotation = @Bar(yyy = \"test string literal\"))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation7(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation7(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotation", "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "yyy", "test string literal"); - } - - public void testNewNormalAnnotation8() throws Exception { - this.createAnnotationAndMembers("Bar", "String yyy();"); - this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", value = @Bar(yyy = \"test string literal\"))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation8(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation8(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "yyy", "test string literal"); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/NestedIndexedDeclarationAnnotationAdapterTests.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/NestedIndexedDeclarationAnnotationAdapterTests.java deleted file mode 100644 index ae4f0f9788..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/NestedIndexedDeclarationAnnotationAdapterTests.java +++ /dev/null @@ -1,2229 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.tests.internal.utility.jdt; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.NumberLiteral; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; - -@SuppressWarnings("nls") -public class NestedIndexedDeclarationAnnotationAdapterTests extends AnnotationTestCase { - - public NestedIndexedDeclarationAnnotationAdapterTests(String name) { - super(name); - } - - private void createAnnotation(String annotationName) throws Exception { - this.createAnnotationAndMembers(annotationName, ""); - } - - private void createAnnotationAndMembers(String annotationName, String annotationBody) throws Exception { - this.javaProject.createCompilationUnit("annot", annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }"); - } - - public void testAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations={@annot.Bar, @annot.Bar(\"two\")})"); - // 0 - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - CompilationUnit astRoot = this.buildASTRoot(cu); - Annotation annotation = aa.getAnnotation(astRoot); - assertNotNull(annotation); - assertEquals("annot.Bar", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isMarkerAnnotation()); - - // 1 - daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 1, "annot.Bar"); - aa = new ElementAnnotationAdapter(this.idField(cu), daa); - annotation = aa.getAnnotation(astRoot); - assertNotNull(annotation); - assertEquals("annot.Bar", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isSingleMemberAnnotation()); - } - - public void testAnnotation2() throws Exception { - this.createAnnotation("Baz"); - this.createAnnotationAndMembers("Bar", "annot.Baz[] yana();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(yana=@annot.Baz))"); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedIndexedDeclarationAnnotationAdapter(daa2, "yana", 0, "annot.Baz"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa3); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - assertEquals("annot.Baz", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isMarkerAnnotation()); - } - - public void testAnnotation3() throws Exception { - this.createAnnotation("Baz"); - this.createAnnotationAndMembers("Bar", "annot.Baz[] yana();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(yana={@annot.Baz}))"); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedIndexedDeclarationAnnotationAdapter(daa2, "yana", 0, "annot.Baz"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa3); - CompilationUnit astRoot = this.buildASTRoot(cu); - Annotation annotation = aa.getAnnotation(astRoot); - assertNotNull(annotation); - assertEquals("annot.Baz", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isMarkerAnnotation()); - - // name mismatch - daa3 = new NestedIndexedDeclarationAnnotationAdapter(daa2, "yana", 0, "annot.Xyz"); - aa = new ElementAnnotationAdapter(this.idField(cu), daa3); - annotation = aa.getAnnotation(astRoot); - assertNull(annotation); - } - - public void testAnnotationNull1() throws Exception { - this.createAnnotation("Bar"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo()"); - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - } - - public void testAnnotationNull2() throws Exception { - this.createAnnotation("Bar"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType(); - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - } - - public void testAnnotationNull3() throws Exception { - this.createAnnotation("Bar"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=\"annot.Bar\")"); - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - } - - public void testAnnotationNull4() throws Exception { - this.createAnnotation("NotBar"); - this.createAnnotation("Bar"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)"); - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - } - - public void testAnnotationNull5() throws Exception { - this.createAnnotationAndMembers("Bar", "String value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations={@annot.Bar, @annot.Bar(\"two\")})"); - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 2, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - } - - public void testAnnotationNull6() throws Exception { - this.createAnnotation("Xyz"); - this.createAnnotation("Baz"); - this.createAnnotationAndMembers("Bar", "annot.Baz[] yana();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(yana={@annot.Baz}))"); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("Foo"); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar"); - DeclarationAnnotationAdapter daa3 = new NestedIndexedDeclarationAnnotationAdapter(daa2, "yana", 0, "annot.Xyz"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa3); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - } - - public void testRemoveAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), @annot.Bar(1)})"; - String expected = "@annot.Foo(nestedAnnotations={null, @annot.Bar(1)})"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceDoesNotContain(expected, cu); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa2); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceContains(expected, cu); - } - - public void testRemoveAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("Foo", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain("Foo", cu); - } - - public void testRemoveAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={\"annot.Bar1\", \"annot.Bar2\", \"annot.Bar3\"})"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(na, cu); - } - - public void testRemoveAnnotation4() throws Exception { - this.createAnnotationAndMembers("NotBar", "int value();"); - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.NotBar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={@annot.NotBar(0), @annot.NotBar(1)})"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(na, cu); - } - - public void testRemoveAnnotation5() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations=@annot.Bar)"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa2); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.removeAnnotation(); - assertNull(aa.getAnnotation(this.buildASTRoot(cu))); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceDoesNotContain("nestedAnnotations", cu); - } - - public void testRemoveAnnotation5a() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations=@annot.Bar)"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new ElementAnnotationAdapter(this.idField(cu), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertTrue(aa1.getAnnotation(this.buildASTRoot(cu)).isMarkerAnnotation()); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceContains("import annot.Foo;", cu); - this.assertSourceContains("@Foo", cu); - } - - public void testRemoveAnnotation6() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations=\"annot.Bar\")"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(na, cu); - } - - public void testRemoveAnnotation7() throws Exception { - this.createAnnotationAndMembers("NotBar", "int value();"); - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.NotBar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations=@annot.NotBar)"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.removeAnnotation(); - this.assertSourceContains(na, cu); - } - - public void testRemoveAnnotation8() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), @annot.Bar(1), @annot.Bar(2), @annot.Bar(3)})"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new ElementAnnotationAdapter(this.idField(cu), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 2, "annot.Bar"); - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - CompilationUnit astRoot = this.buildASTRoot(cu); - Annotation annotation = aa2.getAnnotation(astRoot); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertTrue(aa1.getAnnotation(astRoot).isNormalAnnotation()); - assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(astRoot), "nestedAnnotations").getNodeType()); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceContains("@annot.Foo(nestedAnnotations={@annot.Bar(0), @annot.Bar(1), null, @annot.Bar(3)})", cu); - } - - public void testRemoveAnnotation9() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String na = "@annot.Foo({@annot.Bar(0), @annot.Bar(1), @annot.Bar(2), @annot.Bar(3)})"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new ElementAnnotationAdapter(this.idField(cu), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 2, "annot.Bar"); - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - CompilationUnit astRoot = this.buildASTRoot(cu); - Annotation annotation = aa2.getAnnotation(astRoot); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertTrue(aa1.getAnnotation(astRoot).isSingleMemberAnnotation()); - assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(astRoot), "value").getNodeType()); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceContains("@annot.Foo({@annot.Bar(0), @annot.Bar(1), null, @annot.Bar(3)})", cu); - } - - public void testRemoveAnnotation10() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String na = "@annot.Foo({@annot.Bar(0), @annot.Bar(1)})"; - String expected = "@annot.Foo({null, @annot.Bar(1)})"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceDoesNotContain(expected, cu); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 0, "annot.Bar"); - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa2.removeAnnotation(); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceContains(expected, cu); - } - - public void testRemoveAnnotation11() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String na = "@annot.Foo({@annot.Bar(0), @annot.Bar(1)})"; - String expected = "@annot.Foo(@annot.Bar(0))"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceDoesNotContain(expected, cu); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new ElementAnnotationAdapter(this.idField(cu), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 1, "annot.Bar"); - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.SINGLE_MEMBER_ANNOTATION, this.annotationElementValue(aa1.getAnnotation(this.buildASTRoot(cu)), "value").getNodeType()); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceContains(expected, cu); - } - - public void testRemoveAnnotation12() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String na = "@annot.Foo({@annot.Bar(0), null, @annot.Bar(2)})"; - String expected = "@annot.Foo(@annot.Bar(0))"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceDoesNotContain(expected, cu); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new ElementAnnotationAdapter(this.idField(cu), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 2, "annot.Bar"); - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.SINGLE_MEMBER_ANNOTATION, this.annotationElementValue(aa1.getAnnotation(this.buildASTRoot(cu)), "value").getNodeType()); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceContains(expected, cu); - } - - public void testRemoveAnnotation13() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String na = "@annot.Foo({null, @annot.Bar(1)})"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 1, "annot.Bar"); - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa2.removeAnnotation(); - this.assertSourceDoesNotContain("Bar", cu); - } - - public void testRemoveAnnotation14() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String na = "@annot.Foo({@annot.Bar(0), null, @annot.Bar(2), null})"; - String expected = "@annot.Foo(@annot.Bar(0))"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceDoesNotContain(expected, cu); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new ElementAnnotationAdapter(this.idField(cu), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 2, "annot.Bar"); - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.SINGLE_MEMBER_ANNOTATION, this.annotationElementValue(aa1.getAnnotation(this.buildASTRoot(cu)), "value").getNodeType()); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceContains(expected, cu); - } - - public void testRemoveAnnotation15() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String na = "@annot.Foo({@annot.Bar(0), null, @annot.Bar(2), @annot.Bar(3)})"; - String expected = "@annot.Foo({@annot.Bar(0), null, null, @annot.Bar(3)})"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceDoesNotContain(expected, cu); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new ElementAnnotationAdapter(this.idField(cu), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 2, "annot.Bar"); - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - CompilationUnit astRoot = this.buildASTRoot(cu); - Annotation annotation = aa2.getAnnotation(astRoot); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(astRoot), "value").getNodeType()); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceContains(expected, cu); - } - - public void testRemoveAnnotation16() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String na = "@annot.Foo({@annot.Bar(0), null, @annot.Bar(2), @annot.Bar(3)})"; - String expected = "@annot.Foo({@annot.Bar(0), null, @annot.Bar(2)})"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceDoesNotContain(expected, cu); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new ElementAnnotationAdapter(this.idField(cu), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "value", 3, "annot.Bar"); - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - CompilationUnit astRoot = this.buildASTRoot(cu); - Annotation annotation = aa2.getAnnotation(astRoot); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(astRoot), "value").getNodeType()); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceContains(expected, cu); - } - - public void testRemoveAnnotation17() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, @annot.Bar(2)})"; - String expected = "@annot.Foo(nestedAnnotations=@annot.Bar(0))"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceDoesNotContain(expected, cu); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new ElementAnnotationAdapter(this.idField(cu), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 2, "annot.Bar"); - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.SINGLE_MEMBER_ANNOTATION, this.annotationElementValue(aa1.getAnnotation(this.buildASTRoot(cu)), "nestedAnnotations").getNodeType()); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceContains(expected, cu); - } - - public void testRemoveAnnotation18() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={null, @annot.Bar(1)})"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 1, "annot.Bar"); - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa2.removeAnnotation(); - this.assertSourceDoesNotContain("nestedAnnotations", cu); - } - - public void testRemoveAnnotation19() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, @annot.Bar(2), null})"; - String expected = "@annot.Foo(nestedAnnotations=@annot.Bar(0))"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceDoesNotContain(expected, cu); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new ElementAnnotationAdapter(this.idField(cu), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 2, "annot.Bar"); - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - Annotation annotation = aa2.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.SINGLE_MEMBER_ANNOTATION, this.annotationElementValue(aa1.getAnnotation(this.buildASTRoot(cu)), "nestedAnnotations").getNodeType()); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceContains(expected, cu); - } - - public void testRemoveAnnotation20() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, @annot.Bar(2), @annot.Bar(3)})"; - String expected = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, null, @annot.Bar(3)})"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceDoesNotContain(expected, cu); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new ElementAnnotationAdapter(this.idField(cu), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 2, "annot.Bar"); - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - CompilationUnit astRoot = this.buildASTRoot(cu); - Annotation annotation = aa2.getAnnotation(astRoot); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(astRoot), "nestedAnnotations").getNodeType()); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceContains(expected, cu); - } - - public void testRemoveAnnotation21() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - String na = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, @annot.Bar(2), @annot.Bar(3)})"; - String expected = "@annot.Foo(nestedAnnotations={@annot.Bar(0), null, @annot.Bar(2)})"; - ICompilationUnit cu = this.createTestType(na); - this.assertSourceDoesNotContain(expected, cu); - this.assertSourceContains(na, cu); - - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa1 = new ElementAnnotationAdapter(this.idField(cu), daa1); - DeclarationAnnotationAdapter daa2 = new NestedIndexedDeclarationAnnotationAdapter(daa1, "nestedAnnotations", 3, "annot.Bar"); - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - CompilationUnit astRoot = this.buildASTRoot(cu); - Annotation annotation = aa2.getAnnotation(astRoot); - assertNotNull(annotation); - - aa2.removeAnnotation(); - assertEquals(ASTNode.ARRAY_INITIALIZER, this.annotationElementValue(aa1.getAnnotation(astRoot), "nestedAnnotations").getNodeType()); - this.assertSourceDoesNotContain(na, cu); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("Foo", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@Foo(nestedAnnotations = @Bar)", cu); - } - - public void testNewMarkerAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("Foo", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@Foo(@Bar)", cu); - } - - public void testNewMarkerAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - String expected = "@Foo(nestedAnnotations = @Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation4() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - String expected = "@Foo(@Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation5() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String value(); annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")"); - String expected = "@Foo(value = \"something\", nestedAnnotations = @Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation6() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")"); - String expected = "@annot.Foo(@Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation7() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", nestedAnnotations = @Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation8() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", value = @Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation9() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType(); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - assertNull(aa.getAnnotation(this.buildASTRoot(cu))); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@Foo(nestedAnnotations = { null, null, null, null, null, @Bar })", cu); - } - - public void testNewMarkerAnnotation10() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String value(); annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")"); - String expected1 = "@Foo(value = \"something\", nestedAnnotations = { null, null, null, null,"; - String expected2 = "null, @Bar })"; - this.assertSourceDoesNotContain("Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected1, cu); - this.assertSourceContains(expected2, cu); - } - - public void testNewMarkerAnnotation11() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({\"one\", \"two\"})"); - String expected = "@annot.Foo({@Bar, \"two\"})"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation12() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({\"one\", \"two\"})"); - this.assertSourceDoesNotContain("Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("Bar})", cu); // split line - } - - public void testNewMarkerAnnotation13() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(7)"); - String expected = "@annot.Foo(@Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation14() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(7)"); - this.assertSourceDoesNotContain("Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@annot.Foo({7,null,null,null,null,@Bar})", cu); - } - - public void testNewMarkerAnnotation15() throws Exception { - this.createAnnotationAndMembers("NotBar", "int value();"); - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.NotBar)"); - String expected = "@annot.Foo(@Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation16() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.Bar(55))"); - String expected = "@annot.Foo({@annot.Bar(55),@Bar})"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 1, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation17() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations={\"something\"})"); - String expected = "@annot.Foo(nestedAnnotations={@Bar})"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation18() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations={\"something\"})"); - this.assertSourceDoesNotContain("Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("Bar})", cu); // split line - } - - public void testNewMarkerAnnotation19() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=\"something\")"); - String expected = "@annot.Foo(nestedAnnotations=@Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation20() throws Exception { - this.createAnnotationAndMembers("NotBar", "int value();"); - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)"); - String expected = "@annot.Foo(nestedAnnotations=@Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation21() throws Exception { - this.createAnnotationAndMembers("NotBar", "int value();"); - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)"); - this.assertSourceDoesNotContain("@Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("@annot.Foo(nestedAnnotations={@annot.NotBar,null,null,null,null,@Bar})", cu); - } - - public void testNewMarkerAnnotation22() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(88))"); - String expected = "@annot.Foo(nestedAnnotations=@Bar)"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation23() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(88))"); - String expected = "@annot.Foo(nestedAnnotations={@annot.Bar(88),null,@Bar})"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 2, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation24() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.Bar(88))"); - String expected = "@annot.Foo({@annot.Bar(88),null,@Bar})"; - this.assertSourceDoesNotContain(expected, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 2, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected, cu); - } - - public void testNewMarkerAnnotation25() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations={@annot.Bar(88), @annot.Bar(77)})"); - String expected1 = "@annot.Foo(nestedAnnotations={@annot.Bar(88), @annot.Bar(77), null, null,"; // the line gets split - String expected2 = "@Bar})"; - this.assertSourceDoesNotContain(expected1, cu); - this.assertSourceDoesNotContain(expected2, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 4, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected1, cu); - this.assertSourceContains(expected2, cu); - } - - public void testNewMarkerAnnotation26() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(88), @annot.Bar(77)})"); - String expected1 = "@annot.Foo({@annot.Bar(88), @annot.Bar(77), null, null,"; // the line gets split - String expected2 = "@Bar})"; - this.assertSourceDoesNotContain(expected1, cu); - this.assertSourceDoesNotContain(expected2, cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 4, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - aa.newMarkerAnnotation(); - this.assertSourceContains(expected1, cu); - this.assertSourceContains(expected2, cu); - } - - public void testNewSingleMemberAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("@Foo", cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation1(declaration); - } - }); - this.assertSourceContains("@Foo(nestedAnnotations = @Bar(88))", cu); - } - - void editNewSingleMemberAnnotation1(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("@Foo", cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation2(declaration); - } - }); - this.assertSourceContains("@Foo(@Bar(88))", cu); - } - - void editNewSingleMemberAnnotation2(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - String expected = "@Foo(nestedAnnotations = @Bar(88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation3(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation3(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation4() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - String expected = "@Foo(@Bar(88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation4(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation4(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation5() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String value(); annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")"); - String expected = "@Foo(value = \"something\", nestedAnnotations = @Bar(88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation5(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation5(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation6() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")"); - String expected = "@annot.Foo(@Bar(88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation6(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation6(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation7() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", nestedAnnotations = @Bar(88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation7(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation7(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation8() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String xxx(); annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", value = @Bar(88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation8(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation8(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation9() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("@Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newSingleMemberAnnotation(); - this.assertSourceContains("@Foo(nestedAnnotations = { null, null, null, null, null, @Bar(MISSING) })", cu); // ??? - } - - public void testNewSingleMemberAnnotation10() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "String value(); annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")"); - String expected1 = "@Foo(value = \"something\", nestedAnnotations = { null, null, null, null,"; - String expected2 = "null, @Bar(MISSING) })"; // ??? - this.assertSourceDoesNotContain("@Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newSingleMemberAnnotation(); - this.assertSourceContains(expected1, cu); - this.assertSourceContains(expected2, cu); - } - - public void testNewSingleMemberAnnotation11() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({\"one\", \"two\"})"); - String expected = "@annot.Foo({@Bar(88), \"two\"})"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation11(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation11(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation12() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({\"one\", \"two\"})"); - this.assertSourceDoesNotContain("@Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newSingleMemberAnnotation(); - this.assertSourceContains("@Bar(MISSING)})", cu); // split line - } - - public void testNewSingleMemberAnnotation13() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(7)"); - String expected = "@annot.Foo(@Bar(88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation13(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation13(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation14() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(7)"); - this.assertSourceDoesNotContain("@Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newSingleMemberAnnotation(); - this.assertSourceContains("@annot.Foo({7,null,null,null,null,@Bar(MISSING)})", cu); - } - - public void testNewSingleMemberAnnotation15() throws Exception { - this.createAnnotationAndMembers("NotBar", "int value();"); - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.NotBar)"); - String expected = "@annot.Foo(@Bar(88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation15(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation15(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation16() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.Bar(55))"); - String expected = "@annot.Foo({@annot.Bar(55),@Bar(88)})"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation16(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation16(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 1, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation17() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations={\"something\"})"); - String expected = "@annot.Foo(nestedAnnotations={@Bar(88)})"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation17(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation17(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation18() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations={\"something\"})"); - this.assertSourceDoesNotContain("@Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newSingleMemberAnnotation(); - this.assertSourceContains("@Bar(MISSING)})", cu); // ??? - } - - public void testNewSingleMemberAnnotation19() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=\"something\")"); - String expected = "@annot.Foo(nestedAnnotations=@Bar(88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation19(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation19(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation20() throws Exception { - this.createAnnotationAndMembers("NotBar", "int value();"); - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)"); - String expected = "@annot.Foo(nestedAnnotations=@Bar(88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation20(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation20(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewSingleMemberAnnotation21() throws Exception { - this.createAnnotationAndMembers("NotBar", "int value();"); - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)"); - this.assertSourceDoesNotContain("@Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newSingleMemberAnnotation(); - this.assertSourceContains("@annot.Foo(nestedAnnotations={@annot.NotBar,null,null,null,null,@Bar(MISSING)})", cu); - } - - public void testNewSingleMemberAnnotation22() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.Bar(77))"); - String expected = "@annot.Foo(nestedAnnotations=@Bar(88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation22(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewSingleMemberAnnotation22(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - SingleMemberAnnotation annotation = daa.newSingleMemberAnnotation(declaration); - NumberLiteral numberLiteral = annotation.getAST().newNumberLiteral(); - numberLiteral.setToken("88"); - annotation.setValue(numberLiteral); - } - - public void testNewNormalAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("@Foo", cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation1(declaration); - } - }); - this.assertSourceContains("@Foo(nestedAnnotations = @Bar(xxx = 88))", cu); - } - - void editNewNormalAnnotation1(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("@Foo", cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation2(declaration); - } - }); - this.assertSourceContains("@Foo(@Bar(xxx = 88))", cu); - } - - void editNewNormalAnnotation2(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - String expected = "@Foo(nestedAnnotations = @Bar(xxx = 88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation3(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation3(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation4() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - String expected = "@Foo(@Bar(xxx = 88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation4(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation4(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation5() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations(); String value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")"); - String expected = "@Foo(value = \"something\", nestedAnnotations = @Bar(xxx = 88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation5(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation5(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation6() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")"); - String expected = "@annot.Foo(@Bar(xxx = 88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation6(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation6(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation7() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations(); String xxx();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", nestedAnnotations = @Bar(xxx = 88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation7(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation7(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation8() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value(); String xxx();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(xxx=\"something\")"); - String expected = "@annot.Foo(xxx=\"something\", value = @Bar(xxx = 88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation8(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation8(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation9() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations(); String xxx();"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("@Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newNormalAnnotation(); - this.assertSourceContains("@Foo(nestedAnnotations = { null, null, null, null, null, @Bar() })", cu); - } - - public void testNewNormalAnnotation10() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] nestedAnnotations(); String value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(\"something\")"); - String expected1 = "@Foo(value = \"something\", nestedAnnotations = { null, null, null, null,"; - String expected2 = "null, @Bar() })"; - this.assertSourceDoesNotContain("@Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newNormalAnnotation(); - this.assertSourceContains(expected1, cu); - this.assertSourceContains(expected2, cu); - } - - public void testNewNormalAnnotation11() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({ \"one\", \"two\" })"); - String expected = "@annot.Foo({ @Bar(xxx = 88), \"two\" })"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation11(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation11(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation12() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({\"one\", \"two\"})"); - this.assertSourceDoesNotContain("@Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newNormalAnnotation(); - this.assertSourceContains("@Bar()})", cu); // split line - } - - public void testNewNormalAnnotation13() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(7)"); - String expected = "@annot.Foo(@Bar(xxx = 88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation13(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation13(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation14() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(7)"); - this.assertSourceDoesNotContain("@Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newNormalAnnotation(); - this.assertSourceContains("@annot.Foo({7,null,null,null,null,@Bar()})", cu); - } - - public void testNewNormalAnnotation15() throws Exception { - this.createAnnotationAndMembers("NotBar", "int xxx();"); - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.NotBar)"); - String expected = "@annot.Foo(@Bar(xxx = 88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation15(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation15(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation16() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.Bar(55))"); - String expected = "@annot.Foo({@annot.Bar(55),@Bar(xxx=88)})"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation16(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation16(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 1, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation17() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations = { \"something\" })"); - String expected = "@annot.Foo(nestedAnnotations = { @Bar(xxx = 88) })"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation17(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation17(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation18() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations={\"something\"})"); - this.assertSourceDoesNotContain("@Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newNormalAnnotation(); - this.assertSourceContains("@Bar()})", cu); // split line - } - - public void testNewNormalAnnotation19() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations = \"something\")"); - String expected = "@annot.Foo(nestedAnnotations = @Bar(xxx = 88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation19(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation19(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation20() throws Exception { - this.createAnnotationAndMembers("NotBar", "int xxx();"); - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations = @annot.NotBar)"); - String expected = "@annot.Foo(nestedAnnotations = @Bar(xxx = 88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation20(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation20(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testNewNormalAnnotation21() throws Exception { - this.createAnnotationAndMembers("NotBar", "int xxx();"); - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations=@annot.NotBar)"); - this.assertSourceDoesNotContain("@Bar", cu); - - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 5, "annot.Bar"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newNormalAnnotation(); - this.assertSourceContains("@annot.Foo(nestedAnnotations={@annot.NotBar,null,null,null,null,@Bar()})", cu); - } - - public void testNewNormalAnnotation22() throws Exception { - this.createAnnotationAndMembers("Bar", "int xxx();"); - this.createAnnotationAndMembers("Foo", "Object[] nestedAnnotations();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(nestedAnnotations = @annot.Bar(77))"); - String expected = "@annot.Foo(nestedAnnotations = @Bar(xxx = 88))"; - this.assertSourceDoesNotContain(expected, cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NestedIndexedDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation22(declaration); - } - }); - this.assertSourceContains(expected, cu); - } - - void editNewNormalAnnotation22(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "nestedAnnotations", 0, "annot.Bar"); - NormalAnnotation annotation = daa.newNormalAnnotation(declaration); - this.addMemberValuePair(annotation, "xxx", 88); - } - - public void testMoveAnnotation1() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.Bar(00))"); - String expected = "@annot.Foo({null,@annot.Bar(00)})"; - this.assertSourceDoesNotContain(expected, cu); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), idaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(1); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation2() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({null, @annot.Bar(11)})"); - String expected = "@annot.Foo(@annot.Bar(11))"; - this.assertSourceDoesNotContain(expected, cu); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 1, "annot.Bar"); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), idaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation3() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22), @annot.Bar(33)})"); - String expected = "@annot.Foo({@annot.Bar(33), @annot.Bar(11), @annot.Bar(22)})"; - this.assertSourceDoesNotContain(expected, cu); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 3, "annot.Bar"); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), idaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation4() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22), @annot.Bar(33), @annot.Bar(44)})"); - String expected = "@annot.Foo({@annot.Bar(33), @annot.Bar(11), @annot.Bar(22), null, @annot.Bar(44)})"; - this.assertSourceDoesNotContain(expected, cu); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 3, "annot.Bar"); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), idaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation5() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22)})"); - String expected = "@annot.Foo({@annot.Bar(00), @annot.Bar(11), null, @annot.Bar(22)})"; - this.assertSourceDoesNotContain(expected, cu); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 2, "annot.Bar"); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), idaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(3); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation6() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22)})"); - String expected = "@annot.Foo({null, @annot.Bar(11), @annot.Bar(22), @annot.Bar(00)})"; - this.assertSourceDoesNotContain(expected, cu); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), idaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(3); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation7() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22)})"); - String expected = "@annot.Foo({null, @annot.Bar(11), @annot.Bar(22)})"; - this.assertSourceDoesNotContain(expected, cu); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 3, "annot.Bar"); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), idaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation8() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), @annot.Bar(22), null, @annot.Bar(44)})"); - String expected = "@annot.Foo({null, @annot.Bar(11), @annot.Bar(22), null, @annot.Bar(44)})"; - this.assertSourceDoesNotContain(expected, cu); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 3, "annot.Bar"); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), idaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation9() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - String expected = "@annot.Foo({null, @annot.Bar(11), @annot.Bar(22)})"; - ICompilationUnit cu = this.createTestType(expected); // the source should be unchanged - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 0, "annot.Bar"); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), idaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - iaa.moveAnnotation(3); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation10() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11)})"); - String expected = "@annot.Foo(@annot.Bar(00))"; - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 2, "annot.Bar"); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), idaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - iaa.moveAnnotation(1); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation11() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo(@annot.Bar(00))"); - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 1, "annot.Bar"); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), idaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceDoesNotContain("Bar", cu); - } - - public void testMoveAnnotation12() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), null, @annot.Bar(22)})"); - String expected = "@annot.Foo(@annot.Bar(22))"; - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 2, "annot.Bar"); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), idaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected, cu); - } - - public void testMoveAnnotation13() throws Exception { - this.createAnnotationAndMembers("Bar", "int value();"); - this.createAnnotationAndMembers("Foo", "annot.Bar[] value();"); - ICompilationUnit cu = this.createTestType("@annot.Foo({@annot.Bar(00), @annot.Bar(11), null, @annot.Bar(33)})"); - String expected = "@annot.Foo({@annot.Bar(33), @annot.Bar(11)})"; - - IndexedDeclarationAnnotationAdapter idaa = new NestedIndexedDeclarationAnnotationAdapter( - new SimpleDeclarationAnnotationAdapter("annot.Foo"), "value", 3, "annot.Bar"); - IndexedAnnotationAdapter iaa = new ElementIndexedAnnotationAdapter(this.idField(cu), idaa); - Annotation annotation = iaa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - iaa.moveAnnotation(0); - this.assertSourceContains(expected, cu); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/SimpleDeclarationAnnotationAdapterTests.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/SimpleDeclarationAnnotationAdapterTests.java deleted file mode 100644 index 8c86b93406..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/SimpleDeclarationAnnotationAdapterTests.java +++ /dev/null @@ -1,274 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.tests.internal.utility.jdt; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.MemberValuePair; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.NumberLiteral; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jdt.core.dom.StringLiteral; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; - -@SuppressWarnings("nls") -public class SimpleDeclarationAnnotationAdapterTests extends AnnotationTestCase { - - public SimpleDeclarationAnnotationAdapterTests(String name) { - super(name); - } - - private void createAnnotation(String annotationName) throws Exception { - this.createAnnotation("annot", annotationName); - } - - private void createAnnotation(String packageName, String annotationName) throws Exception { - this.javaProject.createCompilationUnit(packageName, annotationName + ".java", "public @interface " + annotationName + " {}"); - } - - public void testAnnotation1() throws Exception { - this.createAnnotation("Foo"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - assertEquals("annot.Foo", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isMarkerAnnotation()); - } - - public void testAnnotation2() throws Exception { - this.createAnnotation("Foo"); - ICompilationUnit cu = this.createTestType("@annot.Foo(1) @annot.Foo(2)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - assertEquals("annot.Foo", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isSingleMemberAnnotation()); - Expression value = ((SingleMemberAnnotation) annotation).getValue(); - assertEquals(ASTNode.NUMBER_LITERAL, value.getNodeType()); - assertEquals("1", ((NumberLiteral) value).getToken()); - } - - public void testAnnotation3() throws Exception { - this.createAnnotation("Foo"); - ICompilationUnit cu = this.createTestType("annot.Foo", "@Foo"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - assertEquals("Foo", annotation.getTypeName().getFullyQualifiedName()); - assertTrue(annotation.isMarkerAnnotation()); - } - - public void testAnnotationNull1() throws Exception { - this.createAnnotation("Foo"); - ICompilationUnit cu = this.createTestType(); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - } - - public void testAnnotationNull2() throws Exception { - this.createAnnotation("Foo"); - this.createAnnotation("Fop"); - ICompilationUnit cu = this.createTestType("@annot.Fop"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - this.assertSourceContains("@annot.Fop", cu); - } - - public void testAnnotationNull3() throws Exception { - this.createAnnotation("Foo"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - // un-qualified name - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("Foo"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - this.assertSourceContains("@annot.Foo", cu); - } - - public void testRemoveAnnotation1() throws Exception { - this.createAnnotation("Foo"); - ICompilationUnit cu = this.createTestType("@annot.Foo"); - this.assertSourceContains("@annot.Foo", cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain("@annot.Foo", cu); - } - - public void testRemoveAnnotation2() throws Exception { - this.createAnnotation("Foo"); - ICompilationUnit cu = this.createTestType("@annot.Foo(1) @annot.Foo(2)"); - this.assertSourceContains("@annot.Foo(1) @annot.Foo(2)", cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.removeAnnotation(); - this.assertSourceDoesNotContain("@annot.Foo(1)", cu); - this.assertSourceContains("@annot.Foo(2)", cu); - } - - public void testNewMarkerAnnotation1() throws Exception { - this.createAnnotation("Foo"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("import annot.Foo;", cu); - this.assertSourceDoesNotContain("@Foo", cu); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("import annot.Foo;", cu); - this.assertSourceContains("@Foo", cu); - } - - public void testNewMarkerAnnotation2() throws Exception { - this.createAnnotation("Foo"); - ICompilationUnit cu = this.createTestType("@annot.Foo(88)"); - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - AnnotationAdapter aa = new ElementAnnotationAdapter(this.idField(cu), daa); - Annotation annotation = aa.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation); - - aa.newMarkerAnnotation(); - this.assertSourceContains("import annot.Foo;", cu); - this.assertSourceContains("@Foo", cu); - this.assertSourceDoesNotContain("@annot.Foo(88)", cu); - } - - public void testNewSingleMemberAnnotation() throws Exception { - this.createAnnotation("Foo"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("@Foo", cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - SimpleDeclarationAnnotationAdapterTests.this.editNewSingleMemberAnnotation(declaration); - } - }); - this.assertSourceContains("import annot.Foo;", cu); - this.assertSourceContains("@Foo(\"test string literal\")", cu); - } - - void editNewSingleMemberAnnotation(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - SingleMemberAnnotation annotation = (SingleMemberAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newSingleMemberAnnotation(declaration); - StringLiteral stringLiteral = annotation.getAST().newStringLiteral(); - stringLiteral.setLiteralValue("test string literal"); - annotation.setValue(stringLiteral); - } - - public void testNewNormalAnnotation() throws Exception { - this.createAnnotation("Foo"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("@Foo", cu); - this.idField(cu).edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - SimpleDeclarationAnnotationAdapterTests.this.editNewNormalAnnotation(declaration); - } - }); - this.assertSourceContains("import annot.Foo;", cu); - this.assertSourceContains("@Foo(bar = \"test string literal\")", cu); - } - - void editNewNormalAnnotation(ModifiedDeclaration declaration) { - DeclarationAnnotationAdapter daa = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - NormalAnnotation annotation = (NormalAnnotation) daa.getAnnotation(declaration); - assertNull(annotation); - annotation = daa.newNormalAnnotation(declaration); - MemberValuePair mvp = this.newMemberValuePair(annotation.getAST(), "bar", "test string literal"); - this.values(annotation).add(mvp); - } - - public void testImportCollision1() throws Exception { - this.createAnnotation("annot1", "Foo"); - this.createAnnotation("annot2", "Foo"); - ICompilationUnit cu = this.createTestType(); - this.assertSourceDoesNotContain("@Foo", cu); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot1.Foo"); - DeclarationAnnotationAdapter daa2 = new SimpleDeclarationAnnotationAdapter("annot2.Foo"); - - AnnotationAdapter aa1 = new ElementAnnotationAdapter(this.idField(cu), daa1); - Annotation annotation1 = aa1.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation1); - - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - Annotation annotation2 = aa2.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation2); - - aa1.newMarkerAnnotation(); - this.assertSourceContains("import annot1.Foo;", cu); - this.assertSourceContains("@Foo", cu); - - aa2.newMarkerAnnotation(); - this.assertSourceDoesNotContain("import annot2.Foo;", cu); - this.assertSourceContains("@annot2.Foo", cu); - } - - public void testImportCollision2() throws Exception { - this.createAnnotation("annot1", "Foo"); - this.createAnnotation("annot2", "Foo"); - ICompilationUnit cu = this.createTestType("annot1.*", "@Foo"); - this.assertSourceContains("import annot1.*;", cu); - this.assertSourceContains("@Foo", cu); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot1.Foo"); - DeclarationAnnotationAdapter daa2 = new SimpleDeclarationAnnotationAdapter("annot2.Foo"); - - AnnotationAdapter aa1 = new ElementAnnotationAdapter(this.idField(cu), daa1); - Annotation annotation1 = aa1.getAnnotation(this.buildASTRoot(cu)); - assertNotNull(annotation1); - - AnnotationAdapter aa2 = new ElementAnnotationAdapter(this.idField(cu), daa2); - Annotation annotation2 = aa2.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation2); - - aa2.newMarkerAnnotation(); - this.assertSourceDoesNotContain("import annot2.Foo;", cu); - this.assertSourceContains("@annot2.Foo", cu); - } - - public void testImportWildCard() throws Exception { - this.createAnnotation("Foo"); - ICompilationUnit cu = this.createTestType("annot.*", ""); - this.assertSourceContains("import annot.*;", cu); - this.assertSourceDoesNotContain("@Foo", cu); - DeclarationAnnotationAdapter daa1 = new SimpleDeclarationAnnotationAdapter("annot.Foo"); - - AnnotationAdapter aa1 = new ElementAnnotationAdapter(this.idField(cu), daa1); - Annotation annotation1 = aa1.getAnnotation(this.buildASTRoot(cu)); - assertNull(annotation1); - - aa1.newMarkerAnnotation(); - this.assertSourceDoesNotContain("import annot.Foo;", cu); - this.assertSourceContains("@Foo", cu); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/TypeTests.java b/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/TypeTests.java deleted file mode 100644 index ebd80a401f..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/src/org/eclipse/jpt/common/core/tests/internal/utility/jdt/TypeTests.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.core.tests.internal.utility.jdt; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.ICompilationUnit; - -@SuppressWarnings("nls") -public class TypeTests extends AnnotationTestCase { - - public TypeTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - } - - protected ICompilationUnit createCompilationUnit(String source) throws CoreException { - return this.javaProject.createCompilationUnit(PACKAGE_NAME, FILE_NAME, source); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - } - - public void test1() throws Exception { - ICompilationUnit jdtCompilationUnit = this.createCompilationUnit(this.buildTest1Source()); - assertNotNull(jdtCompilationUnit); - } - - private String buildTest1Source() { - StringBuilder sb = new StringBuilder(); - sb.append("public class ").append(TYPE_NAME).append(" {").append(CR); - sb.append(" private int id;").append(CR); - sb.append(" public int getId() {").append(CR); - sb.append(" return this.id;").append(CR); - sb.append(" }").append(CR); - sb.append("}").append(CR); - return sb.toString(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.core.tests/test.xml b/common/tests/org.eclipse.jpt.common.core.tests/test.xml deleted file mode 100644 index 0034685b7a..0000000000 --- a/common/tests/org.eclipse.jpt.common.core.tests/test.xml +++ /dev/null @@ -1,45 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/.classpath b/common/tests/org.eclipse.jpt.common.ui.tests/.classpath deleted file mode 100644 index c243c63ab3..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/.classpath +++ /dev/null @@ -1,12 +0,0 @@ - - - - - - - - - - - - diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/.project b/common/tests/org.eclipse.jpt.common.ui.tests/.project deleted file mode 100644 index 0e0633e91a..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.jpt.common.ui.tests - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/.settings/org.eclipse.jdt.core.prefs b/common/tests/org.eclipse.jpt.common.ui.tests/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index c07512e2f6..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Mon Jan 24 14:35:58 EST 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -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/common/tests/org.eclipse.jpt.common.ui.tests/META-INF/MANIFEST.MF b/common/tests/org.eclipse.jpt.common.ui.tests/META-INF/MANIFEST.MF deleted file mode 100644 index 1230d75ca1..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/META-INF/MANIFEST.MF +++ /dev/null @@ -1,21 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.common.ui.tests -Bundle-Version: 1.0.0.qualifier -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: - org.junit;bundle-version="4.3.1", - org.eclipse.core.runtime;bundle-version="[3.6.100,4.0.0)", - org.eclipse.jface;bundle-version="[3.7.0,4.0.0)", - org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)", - org.eclipse.jpt.common.ui;bundle-version="[1.0.0,2.0.0)", - org.eclipse.ui.forms;bundle-version="[3.5.100,4.0.0)", - org.eclipse.ui.workbench;bundle-version="[3.7.0,4.0.0)", - org.eclipse.ui.navigator;bundle-version="[3.5.0,4.0.0)" -Export-Package: org.eclipse.jpt.common.ui.tests, - org.eclipse.jpt.common.ui.tests.internal.jface;x-internal:=true, - org.eclipse.jpt.common.ui.tests.internal.swt;x-internal:=true, - org.eclipse.jpt.common.ui.tests.internal.util;x-internal:=true, - org.eclipse.jpt.common.ui.tests.internal.utility.swt;x-internal:=true diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/build.properties b/common/tests/org.eclipse.jpt.common.ui.tests/build.properties deleted file mode 100644 index 4dce676b59..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/build.properties +++ /dev/null @@ -1,13 +0,0 @@ -################################################################################ -# Copyright (c) 2011 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ -source.. = src/ -output.. = bin/ -bin.includes = META-INF/,\ - . diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/plugin.properties b/common/tests/org.eclipse.jpt.common.ui.tests/plugin.properties deleted file mode 100644 index 7b81997383..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/plugin.properties +++ /dev/null @@ -1,23 +0,0 @@ -################################################################################ -# Copyright (c) 2011 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ -# ==================================================================== -# 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=Dali Java Persistence Tools - Common UI Tests -providerName=Eclipse Web Tools Platform diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/JptCommonUiTests.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/JptCommonUiTests.java deleted file mode 100644 index bb3b72fe07..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/JptCommonUiTests.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests; - -import junit.framework.Test; -import junit.framework.TestSuite; -import org.eclipse.jpt.common.ui.tests.internal.swt.JptUiSWTTests; -import org.eclipse.jpt.common.ui.tests.internal.util.JptUiUtilTests; - -/** - * Runs all JPT UI Tests - */ -public class JptCommonUiTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptCommonUiTests.class.getPackage().getName()); - suite.addTest(JptUiSWTTests.suite()); - suite.addTest(JptUiUtilTests.suite()); - return suite; - } - - private JptCommonUiTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/jface/DelegatingLabelProviderUiTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/jface/DelegatingLabelProviderUiTest.java deleted file mode 100644 index 4b7cec0b14..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/jface/DelegatingLabelProviderUiTest.java +++ /dev/null @@ -1,602 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.jface; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ArrayContentProvider; -import org.eclipse.jface.viewers.BaseLabelProvider; -import org.eclipse.jface.viewers.ComboViewer; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.window.ApplicationWindow; -import org.eclipse.jface.window.Window; -import org.eclipse.jpt.common.ui.internal.jface.AbstractItemLabelProvider; -import org.eclipse.jpt.common.ui.internal.jface.AbstractTreeItemContentProvider; -import org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.ItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.ItemLabelProviderFactory; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProvider; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProviderFactory; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.NullCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.StaticCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.graphics.ImageData; -import org.eclipse.swt.graphics.PaletteData; -import org.eclipse.swt.graphics.RGB; -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.Label; -import org.eclipse.swt.widgets.Shell; - -public class DelegatingLabelProviderUiTest extends ApplicationWindow -{ - private TreeViewer tree; - - private WritablePropertyValueModel selectedVehicle; - - - public static void main(String[] args) { - Window window = new DelegatingLabelProviderUiTest(args); - window.setBlockOnOpen(true); - window.open(); - Display.getCurrent().dispose(); - System.exit(0); - } - - - private DelegatingLabelProviderUiTest(String[] args) { - super(null); - this.selectedVehicle = new SimplePropertyValueModel(); - } - - - @Override - protected Control createContents(Composite parent) { - ((Shell) parent).setText(this.getClass().getSimpleName()); - parent.setSize(400, 400); - parent.setLayout(new GridLayout()); - Composite mainPanel = new Composite(parent, SWT.NONE); - mainPanel.setLayoutData(new GridData(GridData.FILL_BOTH)); - mainPanel.setLayout(new GridLayout()); - buildTreePanel(mainPanel); - buildControlPanel(mainPanel); - return mainPanel; - } - - private void buildTreePanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - panel.setLayoutData(new GridData(GridData.FILL_BOTH)); - panel.setLayout(new GridLayout()); - - Label label = new Label(panel, SWT.NONE); - label.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); - label.setText("My Vehicles"); - - tree = new TreeViewer(panel, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); - tree.getTree().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); - DelegatingContentAndLabelProvider contentAndLabelProvider = - new DelegatingTreeContentAndLabelProvider( - new VehicleContentProviderFactory(), - new VehicleLabelProviderFactory()); - tree.setContentProvider(contentAndLabelProvider); - tree.setLabelProvider(contentAndLabelProvider); - tree.setInput(new Root()); - tree.addSelectionChangedListener(buildTreeSelectionChangedListener()); - } - - private ISelectionChangedListener buildTreeSelectionChangedListener() { - return new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - selectedVehicle.setValue((Vehicle) ((IStructuredSelection) event.getSelection()).getFirstElement()); - } - }; - } - - private void buildControlPanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - panel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - panel.setLayout(new GridLayout()); - buildUpperControlPanel(panel); - buildLowerControlPanel(panel); - } - - private void buildUpperControlPanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - panel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - panel.setLayout(new GridLayout(2, true)); - buildVehicleCombo(panel); - buildColorCombo(panel); - } - - private void buildVehicleCombo(Composite parent) { - final ComboViewer combo = new ComboViewer(parent, SWT.READ_ONLY); - combo.getCombo().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - combo.setContentProvider(new ArrayContentProvider()); - combo.setLabelProvider(new VehicleTypeLabelProvider()); - combo.setInput( - new VehicleType[] { - VehicleType.BICYCLE, VehicleType.CAR, - VehicleType.TRUCK, VehicleType.BOAT - }); - combo.getCombo().setEnabled(false); - combo.addSelectionChangedListener( - new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - selectedVehicle().setVehicleType((VehicleType) ((StructuredSelection) event.getSelection()).getFirstElement()); - } - }); - selectedVehicle.addPropertyChangeListener( - PropertyValueModel.VALUE, - new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - Vehicle vehicle = selectedVehicle(); - combo.getCombo().setEnabled(vehicle != null); - combo.setSelection(new StructuredSelection((vehicle == null) ? null : vehicle.vehicleType())); - } - }); - } - - private void buildColorCombo(Composite parent) { - final ComboViewer combo = new ComboViewer(parent, SWT.READ_ONLY); - combo.getCombo().setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - combo.setContentProvider(new ArrayContentProvider()); - combo.setLabelProvider(new ColorLabelProvider()); - combo.setInput(new Color[] {Color.RED, Color.BLUE, Color.YELLOW, Color.GREEN}); - combo.addSelectionChangedListener( - new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - selectedVehicle().setColor((Color) ((StructuredSelection) event.getSelection()).getFirstElement()); - } - }); - selectedVehicle.addPropertyChangeListener( - PropertyValueModel.VALUE, - new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - Vehicle vehicle = selectedVehicle(); - combo.getCombo().setEnabled(vehicle != null); - combo.setSelection(new StructuredSelection((vehicle == null) ? null : vehicle.color())); - } - }); - } - - private void buildLowerControlPanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - panel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - panel.setLayout(new GridLayout(3, false)); - buildEffectsLabel(panel); - buildGreyedCheckBox(panel); - buildTranslucentCheckBox(panel); - buildActionPanel(panel); - } - - private void buildEffectsLabel(Composite parent) { - Label label = new Label(parent, SWT.LEFT); - label.setText("Color effects: "); - label.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false, 3, 1)); - } - - private void buildGreyedCheckBox(Composite parent) { - final Button button = new Button(parent, SWT.CHECK); - button.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); - button.setText("greyed"); - button.setEnabled(false); - button.addSelectionListener( - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - selectedVehicle().setGreyed(button.getSelection()); - } - }); - selectedVehicle.addPropertyChangeListener( - PropertyValueModel.VALUE, - new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - Vehicle vehicle = selectedVehicle(); - button.setEnabled(vehicle != null); - button.setSelection(vehicle != null && vehicle.isGreyed()); - } - }); - } - - private void buildTranslucentCheckBox(Composite parent) { - final Button button = new Button(parent, SWT.CHECK); - button.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false)); - button.setText("translucent"); - button.setEnabled(false); - button.addSelectionListener( - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - selectedVehicle().setTranslucent(button.getSelection()); - } - }); - selectedVehicle.addPropertyChangeListener( - PropertyValueModel.VALUE, - new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - Vehicle vehicle = selectedVehicle(); - button.setEnabled(vehicle != null); - button.setSelection(vehicle != null && vehicle.isTranslucent()); - } - }); - } - - private void buildActionPanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - panel.setLayoutData(new GridData(GridData.END, GridData.FILL, false, false)); - panel.setLayout(new GridLayout()); - buildRefreshTreeACI().fill(panel); - } - - private ActionContributionItem buildRefreshTreeACI() { - Action action = new Action("Refresh tree", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - refreshTree(); - } - }; - action.setToolTipText("Refresh the tree's labels"); - return new ActionContributionItem(action); - } - - void refreshTree() { - tree.refresh(); - } - - private Vehicle selectedVehicle() { - return selectedVehicle.getValue(); - } - - - private static class VehicleTypeLabelProvider extends BaseLabelProvider - implements ILabelProvider - { - public Image getImage(Object element) { - return null; - } - - public String getText(Object element) { - return ((VehicleType) element).description(); - } - } - - - private static class ColorLabelProvider extends BaseLabelProvider - implements ILabelProvider - { - public Image getImage(Object element) { - return null; - } - - public String getText(Object element) { - return ((Color) element).description(); - } - } - - - private static class VehicleContentProviderFactory - implements TreeItemContentProviderFactory - { - public TreeItemContentProvider buildItemContentProvider(Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) { - if (item instanceof Root) { - return new RootContentProvider( - (Root) item, (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider); - } - return new VehicleContentProvider( - (Vehicle) item, (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider); - } - } - - - private static class RootContentProvider extends AbstractTreeItemContentProvider - { - public RootContentProvider(Root item, DelegatingTreeContentAndLabelProvider contentAndLabelProvider) { - super(item, contentAndLabelProvider); - } - - @Override - public Root getModel() { - return (Root) super.getModel(); - } - - @Override - public Object getParent() { - return null; - } - - @Override - protected CollectionValueModel buildChildrenModel() { - return new StaticCollectionValueModel(this.getModel().vehicles()); - } - } - - @SuppressWarnings("unchecked") - private static class VehicleContentProvider extends AbstractTreeItemContentProvider - { - public VehicleContentProvider(Vehicle item, DelegatingTreeContentAndLabelProvider contentAndLabelProvider) { - super(item, contentAndLabelProvider); - } - - @Override - public Vehicle getModel() { - return (Vehicle) super.getModel(); - } - - @Override - public Object getParent() { - return getModel().parent(); - } - - @Override - protected CollectionValueModel buildChildrenModel() { - return new NullCollectionValueModel(); - } - } - - - private static class VehicleLabelProviderFactory - implements ItemLabelProviderFactory - { - public ItemLabelProvider buildItemLabelProvider(Object element, DelegatingContentAndLabelProvider labelProvider) { - return new VehicleLabelProvider((Vehicle) element, labelProvider); - } - } - - - private static class VehicleLabelProvider extends AbstractItemLabelProvider - { - public VehicleLabelProvider(Vehicle vehicle, DelegatingContentAndLabelProvider labelProvider) { - super(vehicle, labelProvider); - } - - @Override - protected PropertyValueModel buildImageModel() { - return new PropertyAspectAdapter( - new StaticPropertyValueModel((Vehicle) model()), - Vehicle.COLOR_PROPERTY, Vehicle.GREYED_PROPERTY, Vehicle.TRANSLUCENT_PROPERTY) { - @Override - protected Image buildValue_() { - return subject.image(); - } - }; - } - - @Override - protected PropertyValueModel buildTextModel() { - return new PropertyAspectAdapter( - new StaticPropertyValueModel((Vehicle) model()), - Vehicle.VEHICLE_TYPE_PROPERTY, Vehicle.COLOR_PROPERTY) { - @Override - protected String buildValue_() { - return subject.color().description() + ' ' + subject.vehicleType().description(); - } - }; - } - - @Override - protected PropertyValueModel buildDescriptionModel() { - return buildTextModel(); - } - } - - - private static abstract class TreeNode extends AbstractModel - { - private TreeNode parent; - - - public TreeNode(TreeNode parent) { - this.parent = parent; - } - - - public TreeNode parent() { - return parent; - } - } - - - private static class Root extends TreeNode - { - protected final Vehicle[] vehicles; - - - public Root() { - super(null); - vehicles = new Vehicle[] { - new Vehicle(this, VehicleType.BICYCLE, Color.BLUE), - new Vehicle(this, VehicleType.CAR, Color.YELLOW), - new Vehicle(this, VehicleType.TRUCK, Color.RED), - new Vehicle(this, VehicleType.BOAT, Color.GREEN)}; - } - - public Vehicle[] vehicles() { - return vehicles; - } - } - - - private static class Vehicle extends TreeNode - { - private VehicleType vehicleType; - public final static String VEHICLE_TYPE_PROPERTY = "vehicleType"; - - private Color color; - public final static String COLOR_PROPERTY = "color"; - - private boolean greyed = false; - public final static String GREYED_PROPERTY = "greyed"; - - private boolean translucent = false; - public final static String TRANSLUCENT_PROPERTY = "translucent"; - - private Image image; - - - public Vehicle(TreeNode parent, VehicleType vehicleType, Color color) { - super(parent); - this.vehicleType = vehicleType; - this.color = color; - } - - public VehicleType vehicleType() { - return vehicleType; - } - - public void setVehicleType(VehicleType newVehicleType) { - VehicleType oldVehicleType = vehicleType; - vehicleType = newVehicleType; - firePropertyChanged(VEHICLE_TYPE_PROPERTY, oldVehicleType, newVehicleType); - } - - public Color color() { - return color; - } - - public void setColor(Color newColor) { - Color oldColor = color; - color = newColor; - firePropertyChanged(COLOR_PROPERTY, oldColor, newColor); - } - - public boolean isGreyed() { - return greyed; - } - - public void setGreyed(boolean newGreyed) { - boolean oldGreyed = greyed; - greyed = newGreyed; - firePropertyChanged(GREYED_PROPERTY, oldGreyed, newGreyed); - } - - public boolean isTranslucent() { - return translucent; - } - - public void setTranslucent(boolean newTranslucent) { - boolean oldTranslucent = translucent; - translucent = newTranslucent; - firePropertyChanged(TRANSLUCENT_PROPERTY, oldTranslucent, newTranslucent); - } - - public Image image() { - if (image != null) { - image.dispose(); - } - - return ImageFactory.image(color(), greyed, translucent); - } - } - - - private static enum VehicleType - { - BICYCLE("bicycle"), - CAR("car"), - TRUCK("truck"), - BOAT("boat"); - - private final String description; - - private VehicleType(String description) { - this.description = description; - } - - public String description() { - return description; - } - - @Override - public String toString() { - return description(); - } - } - - - private static enum Color - { - RED("red", new RGB(255, 0, 0)), - BLUE("blue", new RGB(0, 0, 255)), - YELLOW("yellow", new RGB(255, 255, 0)), - GREEN("green", new RGB(0, 255, 0)); - - private final String description; - - private final RGB rgb; - - private Color(String description, RGB rgb) { - this.description = description; - this.rgb = rgb; - } - - public String description() { - return description; - } - - public RGB rgb() { - return rgb; - } - - @Override - public String toString() { - return description(); - } - } - - - private static class ImageFactory - { - private static RGB rgb(Color color, boolean greyed, boolean translucent) { - RGB rgb = (greyed) ? new RGB(127, 127, 127) : color.rgb(); - if (translucent) { - rgb = new RGB(translucify(rgb.red), translucify(rgb.green), translucify(rgb.blue)); - } - return rgb; - } - - private static int translucify(int color) { - return 255 - (int) ((255 - color) * 0.3); - } - - public static Image image(Color color, boolean greyed, boolean translucent) { - PaletteData pd = new PaletteData(new RGB[] {rgb(color, greyed, translucent)}); - ImageData id = new ImageData(20, 20, 1, pd); - for (int x = 0; x < 20; x ++) { - for (int y = 0; y < 20; y ++) { - id.setPixel(x, y, 0); - } - } - return new Image(Display.getCurrent(), id); - } - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/jface/DelegatingTreeContentProviderUiTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/jface/DelegatingTreeContentProviderUiTest.java deleted file mode 100644 index 00af4be8e7..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/jface/DelegatingTreeContentProviderUiTest.java +++ /dev/null @@ -1,563 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.jface; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.BaseLabelProvider; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeViewer; -import org.eclipse.jface.window.ApplicationWindow; -import org.eclipse.jface.window.Window; -import org.eclipse.jpt.common.ui.internal.jface.AbstractTreeItemContentProvider; -import org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProvider; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProviderFactory; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.NotNullFilter; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.CompositeCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.ListCollectionValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.StaticCollectionValueModel; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -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; -import org.eclipse.swt.widgets.Text; - -@SuppressWarnings("nls") -public class DelegatingTreeContentProviderUiTest extends ApplicationWindow -{ - private final Root root; - - private WritablePropertyValueModel selectedNode; - - private TreeViewer controlTree; - - private TreeViewer viewTree; - - private Text nodeNameText; - - - public static void main(String[] args) { - Window window = new DelegatingTreeContentProviderUiTest(args); - window.setBlockOnOpen(true); - window.open(); - Display.getCurrent().dispose(); - System.exit(0); - } - - private DelegatingTreeContentProviderUiTest(String[] args) { - super(null); - this.root = new Root(); - this.root.addChild("Parent_1"); - this.selectedNode = new SimplePropertyValueModel(this.root); - } - - @Override - protected Control createContents(Composite parent) { - ((Shell) parent).setText(this.getClass().getSimpleName()); - parent.setSize(800, 400); - parent.setLayout(new GridLayout()); - Composite mainPanel = new Composite(parent, SWT.NONE); - mainPanel.setLayoutData(new GridData(GridData.FILL_BOTH)); - mainPanel.setLayout(new GridLayout()); - buildTreePanel(mainPanel); - buildControlPanel(mainPanel); - return mainPanel; - } - - private void buildTreePanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - panel.setLayoutData(new GridData(GridData.FILL_BOTH)); - panel.setLayout(new GridLayout(2, true)); - buildControlTreePanel(panel); - buildViewTreePanel(panel); - } - - private void buildControlTreePanel(Composite parent) { - controlTree = buildTreePanel( - parent, "Control tree", - new DelegatingTreeContentAndLabelProvider(new ControlTreeItemContentProviderFactory()), - new LabelProvider()); - controlTree.addSelectionChangedListener(buildTreeSelectionChangedListener()); - selectedNode.addPropertyChangeListener( - PropertyValueModel.VALUE, - new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - controlTree.setSelection(new StructuredSelection(event.getNewValue())); - } - } - ); - } - - private void buildViewTreePanel(Composite parent) { - viewTree = buildTreePanel( - parent, "View tree", - new DelegatingTreeContentAndLabelProvider(new ViewTreeItemContentProviderFactory()), - new LabelProvider()); - } - - private TreeViewer buildTreePanel(Composite parent, String labelText, ITreeContentProvider contentProvider, ILabelProvider labelProvider) { - Composite panel = new Composite(parent, SWT.NONE); - panel.setLayoutData(new GridData(GridData.FILL_BOTH)); - panel.setLayout(new GridLayout()); - - Label label = new Label(panel, SWT.LEFT); - label.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false)); - label.setText(labelText); - - final TreeViewer tree = new TreeViewer(panel, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER); - tree.getTree().setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true)); - tree.setContentProvider(contentProvider); - tree.setLabelProvider(labelProvider); - tree.setInput(root); - - return tree; - } - - private ISelectionChangedListener buildTreeSelectionChangedListener() { - return new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - TreeNode selection = (TreeNode) ((IStructuredSelection) event.getSelection()).getFirstElement(); - selectedNode.setValue((selection == null) ? root : selection); - } - }; - } - - private void buildControlPanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - panel.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false)); - panel.setLayout(new GridLayout(6, false)); - buildNodeNameText(panel); - buildAddChildACI().fill(panel); - buildAddNestedChildACI().fill(panel); - buildRemoveACI().fill(panel); - buildClearModelACI().fill(panel); - buildRestoreModelACI().fill(panel); - } - - private void buildNodeNameText(Composite parent) { - nodeNameText = new Text(parent, SWT.SINGLE | SWT.BORDER); - nodeNameText.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false)); - } - - private ActionContributionItem buildAddChildACI() { - final Action action = new Action("Add child", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - addChild(); - } - }; - action.setToolTipText("Add a child with the given name"); - selectedNode.addPropertyChangeListener( - PropertyValueModel.VALUE, - new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - action.setEnabled(((TreeNode) event.getNewValue()).canHaveChildren()); - } - } - ); - return new ActionContributionItem(action); - } - - private ActionContributionItem buildAddNestedChildACI() { - final Action action = new Action("Add nested child", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - addNestedChild(); - } - }; - action.setToolTipText("Add a nested child with the given name"); - action.setEnabled(false); - selectedNode.addPropertyChangeListener( - PropertyValueModel.VALUE, - new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - action.setEnabled(((TreeNode) event.getNewValue()).canHaveNestedChildren()); - } - } - ); - return new ActionContributionItem(action); - } - - private ActionContributionItem buildRemoveACI() { - final Action action = new Action("Remove", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - remove(); - } - }; - action.setToolTipText("Remove the selected node"); - action.setEnabled(false); - selectedNode.addPropertyChangeListener( - PropertyValueModel.VALUE, - new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - action.setEnabled(event.getNewValue() != root); - } - } - ); - return new ActionContributionItem(action); - } - - private ActionContributionItem buildClearModelACI() { - Action action = new Action("Clear model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - clearModel(); - } - }; - action.setToolTipText("Clear the model"); - return new ActionContributionItem(action); - } - - private ActionContributionItem buildRestoreModelACI() { - Action action = new Action("Restore model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - restoreModel(); - } - }; - action.setToolTipText("Restore the model"); - return new ActionContributionItem(action); - } - - void addChild() { - String nodeName = nodeNameText.getText(); - if (nodeName.length() != 0) { - selectedNode.getValue().addChild(nodeName); - } - } - - void addNestedChild() { - String nodeName = nodeNameText.getText(); - if (nodeName.length() != 0) { - selectedNode.getValue().addNestedChild(nodeName); - } - } - - void remove() { - TreeNode node = selectedNode.getValue(); - node.parent().removeChild(node); - } - - void clearModel() { - controlTree.setInput(null); - viewTree.setInput(null); - } - - void restoreModel() { - controlTree.setInput(root); - viewTree.setInput(root); - } - - - static abstract class AbstractTreeItemContentProviderFactory - implements TreeItemContentProviderFactory - { - public TreeItemContentProvider buildItemContentProvider( - Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) { - return new GenericTreeItemContentProvider( - (TreeNode) item, (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider); - } - } - - - static class ControlTreeItemContentProviderFactory extends AbstractTreeItemContentProviderFactory - { - - } - - - static class ViewTreeItemContentProviderFactory - extends AbstractTreeItemContentProviderFactory - { - @Override - public TreeItemContentProvider buildItemContentProvider( - Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) { - if (item instanceof Parent) { - return new ViewTreeParentItemContentProvider( - (Parent) item, (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider); - } - return super.buildItemContentProvider(item, contentAndLabelProvider); - } - } - - - static class GenericTreeItemContentProvider extends AbstractTreeItemContentProvider - { - public GenericTreeItemContentProvider( - TreeNode treeNode, DelegatingTreeContentAndLabelProvider treeContentAndLabelProvider) { - super(treeNode, treeContentAndLabelProvider); - } - - protected TreeNode treeNode() { - return (TreeNode) getModel(); - } - - @Override - public TreeNode getParent() { - return treeNode().parent(); - } - - @Override - protected CollectionValueModel buildChildrenModel() { - return new ListCollectionValueModelAdapter( - new ListAspectAdapter(TreeNode.CHILDREN_LIST, treeNode()) { - @Override - protected ListIterator listIterator_() { - return treeNode().children(); - } - }); - } - } - - static class ViewTreeParentItemContentProvider extends GenericTreeItemContentProvider - { - public ViewTreeParentItemContentProvider( - TreeNode treeNode, DelegatingTreeContentAndLabelProvider treeContentAndLabelProvider) { - super(treeNode, treeContentAndLabelProvider); - } - - @Override - public TreeNode getParent() { - TreeNode parent = super.getParent(); - if (parent instanceof Nest) { - parent = parent.parent(); - } - return parent; - } - - @Override - protected CollectionValueModel buildChildrenModel() { - return new CompositeCollectionValueModel(super.buildChildrenModel()) { - @Override - protected CollectionValueModel transform(TreeNode value) { - if (value instanceof Nest) { - final Nest nest = (Nest) value; - return new ListCollectionValueModelAdapter( - new ListAspectAdapter(TreeNode.CHILDREN_LIST, nest) { - @Override - protected ListIterator listIterator_() { - return nest.children(); - } - } - ); - } - return new StaticCollectionValueModel(CollectionTools.collection(value)); - } - }; - } - } - - - static class LabelProvider extends BaseLabelProvider - implements ILabelProvider - { - public Image getImage(Object element) { - return null; - } - - public String getText(Object element) { - return ((TreeNode) element).getName(); - } - } - - - static abstract class TreeNode extends AbstractModel - { - private TreeNode parent; - - protected final List children; - public final static String CHILDREN_LIST = "children"; - - protected String name; - public final static String NAME_PROPERTY = "name"; - - - public TreeNode(TreeNode parent, String name) { - this.parent = parent; - this.children = new ArrayList(); - this.name = name; - } - - public TreeNode parent() { - return parent; - } - - public ListIterator children() { - return new ReadOnlyListIterator(children); - } - - protected void addChild(TreeNode child) { - addItemToList(child, children, CHILDREN_LIST); - } - - public void removeChild(TreeNode child) { - removeItemFromList(child, children, CHILDREN_LIST); - } - - public void removeChild(int index) { - removeItemFromList(index, children, CHILDREN_LIST); - } - - public String getName() { - return name; - } - - public void setName(String newName) { - String oldName = name; - name = newName; - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - public boolean canHaveChildren() { - return false; - } - - public void addChild(String name) { - throw new UnsupportedOperationException(); - } - - public boolean canHaveNestedChildren() { - return false; - } - - public void addNestedChild(String name) { - throw new UnsupportedOperationException(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(getName()); - } - } - - - static class Root extends TreeNode - { - public Root() { - super(null, null); - } - - @Override - public boolean canHaveChildren() { - return true; - } - - @Override - public void addChild(String name) { - addChild(new Parent(this, name)); - } - } - - - static class Parent extends TreeNode - { - public Parent(TreeNode parent, String name) { - super(parent, name); - } - - @Override - public boolean canHaveChildren() { - return true; - } - - @Override - public void addChild(String name) { - addChild(new Child(this, name)); - } - - @Override - public boolean canHaveNestedChildren() { - return true; - } - - @Override - public void addNestedChild(String name) { - TreeNode nest = new Nest(this); - addChild(nest); - nest.addChild(name); - } - - public Iterator nestlessChildren() { - return new FilteringIterator( - new TransformationIterator(children()) { - @Override - protected Child transform(TreeNode next) { - if (next instanceof Nest) { - return ((Nest) next).child(); - } - return (Child) next; - } - }, - NotNullFilter.instance() - ); - } - } - - - static class Nest extends TreeNode - { - public Nest(TreeNode parent) { - super(parent, "nest"); - } - - @Override - public boolean canHaveChildren() { - return children.size() == 0; - } - - @Override - public void addChild(String name) { - addChild(new Child(this, name)); - } - - /* can only have one child */ - public Child child() { - return (children.isEmpty()) ? null : (Child) children.get(0); - } - } - - - static class Child extends TreeNode - { - public Child(TreeNode parent, String name) { - super(parent, name); - } - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/AbstractComboModelAdapterTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/AbstractComboModelAdapterTest.java deleted file mode 100644 index d987d9e3eb..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/AbstractComboModelAdapterTest.java +++ /dev/null @@ -1,777 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.swt; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertSame; -import static org.junit.Assert.assertTrue; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jpt.common.ui.internal.swt.AbstractComboModelAdapter; -import org.eclipse.jpt.common.ui.internal.swt.AbstractComboModelAdapter.SelectionChangeEvent; -import org.eclipse.jpt.common.ui.internal.swt.AbstractComboModelAdapter.SelectionChangeListener; -import org.eclipse.jpt.common.utility.internal.StringConverter; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.swing.SimpleDisplayable; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -@SuppressWarnings("nls") -public abstract class AbstractComboModelAdapterTest { - - private Model model; - private WritablePropertyValueModel selectedItemHolder; - private Shell shell; - private WritablePropertyValueModel subjectHolder; - - protected abstract AbstractComboModelAdapter buildEditableComboModelAdapter(); - - protected final ListValueModel buildEmptyListHolder() { - return new SimpleListValueModel(); - } - - private List buildList() { - List list = new ArrayList(); - populateCollection(list); - return list; - } - - protected final ListValueModel buildListHolder() { - return new ListAspectAdapter(subjectHolder, Model.ITEMS_LIST) { - @Override - protected ListIterator listIterator_() { - return subject.items(); - } - - @Override - protected int size_() { - return subject.itemsSize(); - } - }; - } - - protected abstract AbstractComboModelAdapter buildReadOnlyComboModelAdapter(); - - private SimpleDisplayable buildSelectedItem() { - return new SimpleDisplayable("baz"); - } - - private WritablePropertyValueModel buildSelectedItemHolder() { - return new PropertyAspectAdapter(subjectHolder, Model.ITEM_PROPERTY) { - @Override - protected SimpleDisplayable buildValue_() { - return subject.getItem(); - } - - @Override - protected void setValue_(SimpleDisplayable value) { - subject.setItem(value); - } - }; - } - - protected final StringConverter buildStringConverter() { - return new StringConverter() { - public String convertToString(SimpleDisplayable value) { - return (value == null) ? "" : value.displayString(); - } - }; - } - - private WritablePropertyValueModel buildSubjectHolder() { - return new SimplePropertyValueModel(); - } - - public abstract String comboSelectedItem(); - - protected abstract boolean emptyComboCanHaveSelectedValue(); - - protected abstract String itemAt(int index); - - protected abstract int itemCounts(); - - private void populateCollection(Collection c) { - c.add(new SimpleDisplayable("foo")); - c.add(new SimpleDisplayable("bar")); - c.add(new SimpleDisplayable("baz")); - c.add(new SimpleDisplayable("joo")); - c.add(new SimpleDisplayable("jar")); - c.add(new SimpleDisplayable("jaz")); - } - - protected final WritablePropertyValueModel selectedItemHolder() { - return selectedItemHolder; - } - - @Before - public void setUp() throws Exception { - - shell = new Shell(Display.getCurrent()); - model = new Model(); - subjectHolder = buildSubjectHolder(); - selectedItemHolder = buildSelectedItemHolder(); - } - - protected final Shell shell() { - return shell; - } - - protected final WritablePropertyValueModel subjectHolder() { - return subjectHolder; - } - - @After - public void tearDown() throws Exception { - - if (!shell.isDisposed()) { - shell.dispose(); - } - - shell = null; - subjectHolder = null; - selectedItemHolder = null; - } - - private void testItems() { - - assertEquals( - "The count of items is not in sync with the model", - model.itemsSize(), - itemCounts() - ); - - for (int index = 0; index < model.itemsSize(); index++) { - assertEquals( - "The item at index " + index + " is not the same between the model and the combo", - model.itemAt(index).displayString(), - itemAt(index) - ); - } - } - - @Test - public void testNonNullSubjectAfter_AddedAfter_ReadOnly() throws Exception { - - buildReadOnlyComboModelAdapter(); - testRemoveItems_AddedAfter(); - } - - @Test - public void testNonNullSubjectAfter_AddedAfter_RemoveItems_Editable() throws Exception { - - buildEditableComboModelAdapter(); - testRemoveItems_AddedAfter(); - } - - @Test - public void testNonNullSubjectAfter_AddedBefore_RemoveItems_Editable() throws Exception { - - subjectHolder.setValue(model); - model.addItems(buildList()); - - buildEditableComboModelAdapter(); - testSelectedItem(null); - testItems(); - - ArrayList items = new ArrayList(); - items.add(model.itemAt(0)); - items.add(model.itemAt(3)); - model.removeItems(items.iterator()); - testItems(); - } - - @Test - public void testNonNullSubjectAfter_AddedBefore_RemoveItems_ReadOnly() throws Exception { - - subjectHolder.setValue(model); - model.addItems(buildList()); - - buildReadOnlyComboModelAdapter(); - testSelectedItem(null); - testItems(); - - ArrayList items = new ArrayList(); - items.add(model.itemAt(0)); - items.add(model.itemAt(3)); - model.removeItems(items.iterator()); - testItems(); - } - - @Test - public void testNonNullSubjectAfter_NullSelectedItem_ItemsAfterAfter_Editable() throws Exception { - - buildEditableComboModelAdapter(); - - subjectHolder.setValue(model); - model.addItems(buildList()); - - testSelectedItem(null); - testItems(); - } - - @Test - public void testNonNullSubjectAfter_NullSelectedItem_ItemsAfterAfter_ReadOnly() throws Exception { - - buildReadOnlyComboModelAdapter(); - - subjectHolder.setValue(model); - model.addItems(buildList()); - - testSelectedItem(null); - testItems(); - } - - @Test - public void testNonNullSubjectAfter_NullSelectedItem_ItemsAfterBefore_Editable() throws Exception { - - buildEditableComboModelAdapter(); - - model.addItems(buildList()); - subjectHolder.setValue(model); - - testSelectedItem(null); - testItems(); - } - - @Test - public void testNonNullSubjectAfter_NullSelectedItem_ItemsAfterBefore_ReadOnly() throws Exception { - - buildReadOnlyComboModelAdapter(); - - model.addItems(buildList()); - subjectHolder.setValue(model); - - testSelectedItem(null); - testItems(); - } - - @Test - public void testNonNullSubjectAfter_NullSelectedItem_ItemsBefore_Editable() throws Exception { - - model.addItems(buildList()); - buildEditableComboModelAdapter(); - - subjectHolder.setValue(model); - testSelectedItem(null); - testItems(); - } - - @Test - public void testNonNullSubjectAfter_NullSelectedItem_ItemsBefore_ReadOnly() throws Exception { - - model.addItems(buildList()); - buildReadOnlyComboModelAdapter(); - - subjectHolder.setValue(model); - testSelectedItem(null); - testItems(); - } - - @Test - public void testNonNullSubjectAfter_NullSelectedItem_NoItems_Editable() throws Exception { - - buildEditableComboModelAdapter(); - - subjectHolder.setValue(model); - testSelectedItem(null); - testItems(); - } - - @Test - public void testNonNullSubjectAfter_NullSelectedItem_NoItems_ReadOnly() throws Exception { - - buildReadOnlyComboModelAdapter(); - - subjectHolder.setValue(model); - testSelectedItem(null); - testItems(); - } - - @Test - public void testNonNullSubjectAfter_SelectedItemChanged_ReadOnly() throws Exception { - - subjectHolder.setValue(model); - model.addItems(buildList()); - - SimpleDisplayable selectedItem = model.itemAt(0); - - AbstractComboModelAdapter adapter = buildEditableComboModelAdapter(); - SelectionListener selectionListener = new SelectionListener(); - adapter.addSelectionChangeListener(selectionListener); - - assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled()); - testSelectedItem(null); - - testSelectedItemChanged(selectedItem, selectionListener); - } - - @Test - public void testNonNullSubjectBefore_NonNullSelectedItemAfter_Editable() throws Exception { - - SimpleDisplayable selectedItem = buildSelectedItem(); - subjectHolder.setValue(model); - - buildEditableComboModelAdapter(); - assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled()); - - model.setItem(selectedItem); - assertTrue("The selected item was supposed to be modified", model.isSetItemCalled()); - assertSame("The selected item wasn't set properly", selectedItem, model.getItem()); - - testSelectedItem(selectedItem); - testItems(); - } - - @Test - public void testNonNullSubjectBefore_NonNullSelectedItemAfter_Items_Editable() throws Exception { - - SimpleDisplayable selectedItem = buildSelectedItem(); - subjectHolder.setValue(model); - - buildEditableComboModelAdapter(); - assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled()); - - model.setItem(selectedItem); - assertTrue("The selected item was supposed to be modified", model.isSetItemCalled()); - assertSame("The selected item wasn't set properly", selectedItem, model.getItem()); - - testSelectedItem(selectedItem); - testItems(); - } - - @Test - public void testNonNullSubjectBefore_NonNullSelectedItemAfter_Items_ReadOnly() throws Exception { - - List list = buildList(); - SimpleDisplayable selectedItem = list.get(0); - subjectHolder.setValue(model); - - buildReadOnlyComboModelAdapter(); - assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled()); - - model.setItem(selectedItem); - assertTrue("The selected item was supposed to be modified", model.isSetItemCalled()); - assertSame("The selected item wasn't set properly", selectedItem, model.getItem()); - - testSelectedItem(selectedItem); - testItems(); - } - - @Test - public void testNonNullSubjectBefore_NonNullSelectedItemAfter_ReadOnly() throws Exception { - - List list = buildList(); - SimpleDisplayable selectedItem = list.get(0); - subjectHolder.setValue(model); - - buildReadOnlyComboModelAdapter(); - assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled()); - - model.setItem(selectedItem); - assertTrue("The selected item was supposed to be modified", model.isSetItemCalled()); - assertSame("The selected item wasn't set properly", selectedItem, model.getItem()); - - testSelectedItem(selectedItem); - testItems(); - } - - @Test - public void testNonNullSubjectBefore_NonNullSelectedItemBefore_Editable() throws Exception { - - model.addItems(buildList()); - SimpleDisplayable selectedItem = model.itemAt(0); - subjectHolder.setValue(model); - - model.setItem(selectedItem); - assertTrue("The selected item was supposed to be modified", model.isSetItemCalled()); - assertSame("The selected item wasn't set properly", selectedItem, model.getItem()); - - model.clearItemCalledFlag(); - buildEditableComboModelAdapter(); - assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled()); - - testSelectedItem(selectedItem); - testItems(); - } - - @Test - public void testNonNullSubjectBefore_NonNullSelectedItemBefore_Items_Editable() throws Exception { - - model.addItems(buildList()); - SimpleDisplayable selectedItem = model.itemAt(0); - subjectHolder.setValue(model); - - model.setItem(selectedItem); - assertTrue("The selected item was supposed to be modified", model.isSetItemCalled()); - assertSame("The selected item wasn't set properly", selectedItem, model.getItem()); - - model.clearItemCalledFlag(); - buildEditableComboModelAdapter(); - assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled()); - - testSelectedItem(selectedItem); - testItems(); - } - - @Test - public void testNonNullSubjectBefore_NonNullSelectedItemBefore_Items_ReadOnly() throws Exception { - - List list = buildList(); - SimpleDisplayable selectedItem = list.get(0); - subjectHolder.setValue(model); - - model.setItem(selectedItem); - assertTrue("The selected item was supposed to be modified", model.isSetItemCalled()); - assertSame("The selected item wasn't set properly", selectedItem, model.getItem()); - - model.clearItemCalledFlag(); - buildReadOnlyComboModelAdapter(); - assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled()); - - testSelectedItem(selectedItem); - testItems(); - } - - @Test - public void testNonNullSubjectBefore_NonNullSelectedItemBefore_ReadOnly() throws Exception { - - List list = buildList(); - SimpleDisplayable selectedItem = list.get(0); - subjectHolder.setValue(model); - - model.setItem(selectedItem); - assertTrue("The selected item was supposed to be modified", model.isSetItemCalled()); - assertSame("The selected item wasn't set properly", selectedItem, model.getItem()); - - model.clearItemCalledFlag(); - buildReadOnlyComboModelAdapter(); - assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled()); - - testSelectedItem(selectedItem); - testItems(); - } - - @Test - public void testNonNullSubjectBefore_NullSelectedItem_Items_Editable() throws Exception { - - subjectHolder.setValue(model); - - buildEditableComboModelAdapter(); - - assertFalse("The item wasn't supposed to be modified", model.isSetItemCalled()); - assertNull("The selected item is supposed to remain null", model.getItem()); - testSelectedItem(null); - testItems(); - } - - @Test - public void testNonNullSubjectBefore_NullSelectedItem_Items_ReadOnly() throws Exception { - - subjectHolder.setValue(model); - - buildEditableComboModelAdapter(); - - assertFalse("The item wasn't supposed to be modified", model.isSetItemCalled()); - assertNull("The selected item is supposed to remain null", model.getItem()); - testSelectedItem(null); - testItems(); - } - - @Test - public void testNonNullSubjectBefore_NullSelectedItem_NoItems_Editable() throws Exception { - - subjectHolder.setValue(model); - - buildEditableComboModelAdapter(); - - assertFalse("The item wasn't supposed to be modified", model.isSetItemCalled()); - assertNull("The selected item is supposed to remain null", model.getItem()); - testSelectedItem(null); - testItems(); - } - - @Test - public void testNonNullSubjectBefore_NullSelectedItem_NoItems_ReadOnly() throws Exception { - - subjectHolder.setValue(model); - - buildEditableComboModelAdapter(); - - assertFalse("The item wasn't supposed to be modified", model.isSetItemCalled()); - assertNull("The selected item is supposed to remain null", model.getItem()); - testSelectedItem(null); - testItems(); - } - - @Test - public void testNonNullSubjectBefore_SelectedItemChanged_Editable() throws Exception { - - model.addItems(buildList()); - - SimpleDisplayable selectedItem = model.itemAt(3); - subjectHolder.setValue(model); - - AbstractComboModelAdapter adapter = buildEditableComboModelAdapter(); - SelectionListener selectionListener = new SelectionListener(); - adapter.addSelectionChangeListener(selectionListener); - - assertFalse("The selected item wasn't supposed to be modified", model.isSetItemCalled()); - testSelectedItem(null); - - testSelectedItemChanged(selectedItem, selectionListener); - } - - private void testNullSubject() throws Exception { - - assertNull("The selected item should be null", selectedItemHolder.getValue()); - - selectedItemHolder.setValue(buildSelectedItem()); - assertFalse("The item wasn't supposed to be modified", model.isSetItemCalled()); - - // Null because the subject holder doesn't have the subject set - testSelectedItem(null); - testItems(); - } - - @Test - public void testNullSubject_NullSelectedItem_Items_Editable() throws Exception { - buildEditableComboModelAdapter(); - testNullSubject(); - testItems(); - testSelectedItem(null); - } - - @Test - public void testNullSubject_NullSelectedItem_Items_ReadOnly() throws Exception { - buildReadOnlyComboModelAdapter(); - testNullSubject(); - testItems(); - testSelectedItem(null); - } - - @Test - public void testNullSubject_NullSelectedItem_NoItems_Editable() throws Exception { - buildEditableComboModelAdapter(); - testNullSubject(); - testItems(); - testSelectedItem(null); - } - - @Test - public void testNullSubject_NullSelectedItem_NoItems_ReadOnly() throws Exception { - buildReadOnlyComboModelAdapter(); - testNullSubject(); - testItems(); - testSelectedItem(null); - } - - private void testRemoveItems_AddedAfter() { - - subjectHolder.setValue(model); - model.addItems(buildList()); - - testSelectedItem(null); - testItems(); - testSelectedItem(null); - - ArrayList items = new ArrayList(); - items.add(model.itemAt(0)); - items.add(model.itemAt(3)); - model.removeItems(items.iterator()); - - testItems(); - testSelectedItem(null); - } - - private void testSelectedItem(SimpleDisplayable selectedItem) { - - if (selectedItem == null) { - - assertNull( - "The selected item is supposed to be null", - model.getItem() - ); - - assertEquals( - "The combo's selected item should be null", - "", - comboSelectedItem() - ); - } - else if (!emptyComboCanHaveSelectedValue()) { - - assertEquals( - "The selected item wasn't set correctly", - selectedItem, - model.getItem() - ); - - assertEquals( - "The combo's selected item should be null", - "", - comboSelectedItem() - ); - } - else { - - assertEquals( - "The selected item wasn't set correctly", - selectedItem, - model.getItem() - ); - - assertEquals( - "The selected item wasn't set correctly", - selectedItem.displayString(), - comboSelectedItem() - ); - } - } - - private void testSelectedItemChanged(SimpleDisplayable selectedItem, - SelectionListener selectionListener) { - - // Test 1 - model.setItem(selectedItem); - assertTrue("The selected item was supposed to be modified", model.isSetItemCalled()); - assertSame("The selected item wasn't set properly", selectedItem, model.getItem()); - assertTrue("The SelectionListener was supposed to be notified", selectionListener.isListenerNotified()); - assertSame("The SelectionListener was supposed to be notified", selectedItem, selectionListener.getItem()); - testSelectedItem(selectedItem); - - // Test 2 - selectedItem = model.itemAt(1); - model.clearItemCalledFlag(); - selectionListener.clearInfo(); - - model.setItem(selectedItem); - assertTrue("The selected item was supposed to be modified", model.isSetItemCalled()); - assertSame("The selected item wasn't set properly", selectedItem, model.getItem()); - assertTrue("The SelectionListener was supposed to be notified", selectionListener.isListenerNotified()); - assertSame("The SelectionListener was supposed to be notified", selectedItem, selectionListener.getItem()); - testSelectedItem(selectedItem); - - // Test 3 - selectedItem = null; - model.clearItemCalledFlag(); - selectionListener.clearInfo(); - - model.setItem(selectedItem); - assertTrue("The selected item was supposed to be modified", model.isSetItemCalled()); - assertNull("The selected item wasn't set properly", model.getItem()); - assertTrue("The SelectionListener was supposed to be notified", selectionListener.isListenerNotified()); - assertSame("The SelectionListener was supposed to be notified", selectedItem, selectionListener.getItem()); - testSelectedItem(selectedItem); - - // Test 3 - selectedItem = model.itemAt(2); - model.clearItemCalledFlag(); - selectionListener.clearInfo(); - - model.setItem(selectedItem); - assertTrue("The selected item was supposed to be modified", model.isSetItemCalled()); - assertSame("The selected item wasn't set properly", selectedItem, model.getItem()); - assertTrue("The SelectionListener was supposed to be notified", selectionListener.isListenerNotified()); - assertSame("The SelectionListener was supposed to be notified", selectedItem, selectionListener.getItem()); - testSelectedItem(selectedItem); - } - - private static class Model extends AbstractModel { - - private SimpleDisplayable item; - private List items = new ArrayList(); - private boolean setItemCalled; - - static final String ITEM_PROPERTY = "item"; - static final String ITEMS_LIST = "items"; - - void addItems(Iterator items) { - addItemsToList(items, this.items, ITEMS_LIST); - } - - void addItems(List items) { - addItemsToList(items, this.items, ITEMS_LIST); - } - - void clearItemCalledFlag() { - setItemCalled = false; - } - - SimpleDisplayable getItem() { - return item; - } - - boolean isSetItemCalled() { - return setItemCalled; - } - - SimpleDisplayable itemAt(int index) { - return this.items.get(index); - } - - ListIterator items() { - return items.listIterator(); - } - - int itemsSize() { - return items.size(); - } - - void removeItems(Iterator items) { - removeItemsFromList(items, this.items, ITEMS_LIST); - } - - void setItem(SimpleDisplayable item) { - setItemCalled = true; - - SimpleDisplayable oldItem = this.item; - this.item = item; - firePropertyChanged(ITEM_PROPERTY, oldItem, item); - } - } - - private class SelectionListener implements SelectionChangeListener { - - private SimpleDisplayable item; - private boolean listenerNotified; - - void clearInfo() { - this.listenerNotified = false; - this.item = null; - } - - SimpleDisplayable getItem() { - return item; - } - - public boolean isListenerNotified() { - return listenerNotified; - } - - public void selectionChanged(SelectionChangeEvent e) { - listenerNotified = true; - item = e.selectedItem(); - } - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/ComboModelAdapterTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/ComboModelAdapterTest.java deleted file mode 100644 index f2379318d9..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/ComboModelAdapterTest.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.swt; - -import org.eclipse.jpt.common.ui.internal.swt.AbstractComboModelAdapter; -import org.eclipse.jpt.common.ui.internal.swt.ComboModelAdapter; -import org.eclipse.jpt.common.utility.internal.swing.SimpleDisplayable; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Combo; -import org.junit.After; - -public class ComboModelAdapterTest extends AbstractComboModelAdapterTest { - - private Combo combo; - private boolean editable; - - @Override - protected AbstractComboModelAdapter buildEditableComboModelAdapter() { - - combo = new Combo(shell(), SWT.NULL); - editable = true; - - return ComboModelAdapter.adapt( - buildListHolder(), - selectedItemHolder(), - combo, - buildStringConverter() - ); - } - - @Override - protected AbstractComboModelAdapter buildReadOnlyComboModelAdapter() { - - combo = new Combo(shell(), SWT.READ_ONLY); - editable = false; - - return ComboModelAdapter.adapt( - buildListHolder(), - selectedItemHolder(), - combo, - buildStringConverter() - ); - } - - @Override - public String comboSelectedItem() { - return combo.getText(); - } - - @Override - protected boolean emptyComboCanHaveSelectedValue() { - return editable; - } - - @Override - protected String itemAt(int index) { - return this.combo.getItem(index); - } - - @Override - protected int itemCounts() { - return combo.getItemCount(); - } - - @After - @Override - public void tearDown() throws Exception { - super.tearDown(); - combo = null; - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/JptUiSWTTests.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/JptUiSWTTests.java deleted file mode 100644 index fb7f5d3d61..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/JptUiSWTTests.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.swt; - -import junit.framework.JUnit4TestAdapter; -import junit.framework.Test; -import junit.framework.TestSuite; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -@SuiteClasses -({ - ComboModelAdapterTest.class, - SpinnerModelAdapterTest.class, - TableModelAdapterTest.class -}) -@RunWith(Suite.class) -public final class JptUiSWTTests { - - private JptUiSWTTests() { - super(); - throw new UnsupportedOperationException(); - } - - public static Test suite() { - TestSuite suite = new TestSuite(); - suite.addTest(new JUnit4TestAdapter(JptUiSWTTests.class)); - return suite; - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/SpinnerModelAdapterTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/SpinnerModelAdapterTest.java deleted file mode 100644 index f8792a4e5f..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/SpinnerModelAdapterTest.java +++ /dev/null @@ -1,342 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.swt; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import org.eclipse.jpt.common.ui.internal.swt.SpinnerModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Spinner; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -@SuppressWarnings("nls") -public class SpinnerModelAdapterTest { - - private Model model; - private Shell shell; - private WritablePropertyValueModel subjectHolder; - - private WritablePropertyValueModel buildSubjectHolder() { - return new SimplePropertyValueModel(); - } - - private WritablePropertyValueModel buildValueHolder() { - return new PropertyAspectAdapter(subjectHolder, Model.VALUE_PROPERTY) { - @Override - protected Integer buildValue_() { - return subject.getValue(); - } - - @Override - protected void setValue_(Integer value) { - subject.setValue(value); - } - }; - } - - @Before - public void setUp() throws Exception { - - shell = new Shell(Display.getCurrent()); - model = new Model(); - subjectHolder = buildSubjectHolder(); - } - - @After - public void tearDown() throws Exception { - - if (!shell.isDisposed()) { - shell.dispose(); - } - - shell = null; - subjectHolder = null; - } - - @Test - public void testDisposed() { - - int value = 2; - model.setValue(value); - model.clearSetValueCalledFlag(); - subjectHolder.setValue(model); - - Spinner spinner = new Spinner(shell, SWT.NULL); - WritablePropertyValueModel numberHolder = buildValueHolder(); - int defaultValue = 1; - - SpinnerModelAdapter.adapt( - numberHolder, - spinner, - defaultValue - ); - - assertEquals( - "The spinner's value should be coming from the model", - value, - spinner.getSelection() - ); - - assertEquals( - "The number holder's value should be the model's value", - model.getValue(), - numberHolder.getValue() - ); - - assertFalse( - "The model should not have received the value during initialization", - model.isSetValueCalled() - ); - - // Change the value in the model - spinner.dispose(); - - value = 4; - model.setValue(value); - - assertEquals( - "The model's value was somehow changed", - Integer.valueOf(value), - model.getValue() - ); - } - - @Test - public void testInitialization_1() { - - Spinner spinner = new Spinner(shell, SWT.NULL); - WritablePropertyValueModel numberHolder = new SimplePropertyValueModel(); - int defaultValue = 1; - - SpinnerModelAdapter.adapt( - numberHolder, - spinner, - defaultValue - ); - - assertEquals( - "The spinner's value should be the default value", - defaultValue, - spinner.getSelection() - ); - - assertNull( - "The number holder's value should be null", - numberHolder.getValue() - ); - } - - @Test - public void testInitialization_2() { - - Spinner spinner = new Spinner(shell, SWT.NULL); - WritablePropertyValueModel numberHolder = buildValueHolder(); - int defaultValue = 1; - - SpinnerModelAdapter.adapt( - numberHolder, - spinner, - defaultValue - ); - - assertEquals( - "The spinner's value should be the default value", - defaultValue, - spinner.getSelection() - ); - - assertNull( - "The number holder's value should be null", - numberHolder.getValue() - ); - } - - @Test - public void testInitialization_3() { - - subjectHolder.setValue(model); - - Spinner spinner = new Spinner(shell, SWT.NULL); - WritablePropertyValueModel numberHolder = buildValueHolder(); - int defaultValue = 1; - - SpinnerModelAdapter.adapt( - numberHolder, - spinner, - defaultValue - ); - - assertEquals( - "The spinner's value should be the default value", - defaultValue, - spinner.getSelection() - ); - - assertNull( - "The number holder's value should be null", - numberHolder.getValue() - ); - - assertFalse( - "The model should not have received the value during initialization", - model.isSetValueCalled() - ); - } - - @Test - public void testInitialization_4() { - - int value = 2; - model.setValue(value); - model.clearSetValueCalledFlag(); - subjectHolder.setValue(model); - - Spinner spinner = new Spinner(shell, SWT.NULL); - WritablePropertyValueModel numberHolder = buildValueHolder(); - int defaultValue = 1; - - SpinnerModelAdapter.adapt( - numberHolder, - spinner, - defaultValue - ); - - assertEquals( - "The spinner's value should be the value coming from the model", - value, - spinner.getSelection() - ); - - assertEquals( - "The number holder's value should be " + value, - Integer.valueOf(value), - numberHolder.getValue() - ); - - assertFalse( - "The model should not have received the value during initialization", - model.isSetValueCalled() - ); - } - - @Test - public void testValueChanged() { - - int value = 2; - model.setValue(value); - model.clearSetValueCalledFlag(); - subjectHolder.setValue(model); - - Spinner spinner = new Spinner(shell, SWT.NULL); - WritablePropertyValueModel numberHolder = buildValueHolder(); - int defaultValue = 1; - - SpinnerModelAdapter.adapt( - numberHolder, - spinner, - defaultValue - ); - - assertEquals( - "The spinner's value should be coming from the model", - value, - spinner.getSelection() - ); - - assertEquals( - "The number holder's value should be the model's value", - model.getValue(), - numberHolder.getValue() - ); - - assertFalse( - "The model should not have received the value during initialization", - model.isSetValueCalled() - ); - - // Change the value in the model - value = 4; - model.setValue(value); - - assertEquals( - "The spinner's value should be coming from the model", - value, - spinner.getSelection() - ); - - assertEquals( - "The model's value was somehow changed", - Integer.valueOf(value), - model.getValue() - ); - - // Change the value from the spinner - value = 6; - spinner.setSelection(value); - - assertEquals( - "The spinner's value should be the new value set", - value, - spinner.getSelection() - ); - - assertEquals( - "The model's value was supposed to be updated", - Integer.valueOf(value), - model.getValue() - ); - - // Disconnect from model - subjectHolder.setValue(null); - - assertEquals( - "The spinner's value should be the default value", - defaultValue, - spinner.getSelection() - ); - } - - private static class Model extends AbstractModel { - - private boolean setValueCalled; - private Integer value; - - static final String VALUE_PROPERTY = "value"; - - void clearSetValueCalledFlag() { - setValueCalled = false; - } - - Integer getValue() { - return value; - } - - boolean isSetValueCalled() { - return setValueCalled; - } - - void setValue(Integer value) { - setValueCalled = true; - - Integer oldValue = this.value; - this.value = value; - firePropertyChanged(VALUE_PROPERTY, oldValue, value); - } - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/TableModelAdapterTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/TableModelAdapterTest.java deleted file mode 100644 index f8e6dd04a9..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/TableModelAdapterTest.java +++ /dev/null @@ -1,1201 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.swt; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jpt.common.ui.internal.swt.ColumnAdapter; -import org.eclipse.jpt.common.ui.internal.swt.TableModelAdapter; -import org.eclipse.jpt.common.ui.internal.swt.TableModelAdapter.SelectionChangeEvent; -import org.eclipse.jpt.common.ui.internal.swt.TableModelAdapter.SelectionChangeListener; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyCollectionValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableItem; -import org.junit.After; -import org.junit.Assert; -import org.junit.Before; -import org.junit.Test; - -@SuppressWarnings("nls") -public class TableModelAdapterTest { - - private Shell shell; - private WritablePropertyValueModel subjectHolder; - - private ColumnAdapter buildColumnAdapter() { - return new TableColumnAdapter(); - } - - private WritablePropertyValueModel buildEmployeeHolder() { - return new SimplePropertyValueModel(); - } - - private SimpleCollectionValueModel buildEmployeeHolders() { - return new SimpleCollectionValueModel(); - } - - private ListValueModel buildEmployeeListHolder() { - return new ListAspectAdapter(subjectHolder, Manager.EMPLOYEES_LIST) { - @Override - protected ListIterator listIterator_() { - return subject.employees(); - } - - @Override - protected int size_() { - return subject.employeesSize(); - } - }; - } - - private ITableLabelProvider buildLabelProvider() { - return new TableLabelProvider(); - } - - private SelectionChangeListener buildSelectionChangeListener(final Collection employees) { - return new SelectionChangeListener() { - public void selectionChanged(SelectionChangeEvent e) { - employees.clear(); - CollectionTools.addAll(employees, e.selection()); - } - }; - } - - private WritablePropertyValueModel buildSubjectHolder() { - return new SimplePropertyValueModel(); - } - - @Before - public void setUp() throws Exception { - - shell = new Shell(Display.getCurrent()); - subjectHolder = buildSubjectHolder(); - } - - @After - public void tearDown() throws Exception { - - if (!shell.isDisposed()) { - shell.dispose(); - } - - shell = null; - subjectHolder = null; - } - - @Test - public void testChanged() { - - Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); - - ListValueModel listHolder = buildEmployeeListHolder(); - WritablePropertyValueModel selectedItemHolder = buildEmployeeHolder(); - - Manager manager = new Manager(); - subjectHolder.setValue(manager); - - new TableModel( - listHolder, - selectedItemHolder, - table, - buildColumnAdapter(), - buildLabelProvider() - ); - - // Create Employees - String expectedName1 = "Dali_1"; - String expectedManager1 = "WTP_1"; - String expectedTitle1 = "plug-in_1"; - - String expectedName2 = "Dali_2"; - String expectedManager2 = "WTP_2"; - String expectedTitle2 = "plug-in_2"; - - String expectedName3 = "Dali_3"; - String expectedManager3 = "WTP_3"; - String expectedTitle3 = "plug-in_3"; - - Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1); - Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2); - Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3); - - manager.addEmployee(employee1); - manager.addEmployee(employee2); - manager.addEmployee(employee3); - - // Make sure the Table was populated - Assert.assertEquals("The number of TableItems should be 3", 3, table.getItemCount()); - - // Change the list of Employees - ArrayList employees = new ArrayList(3); - employees.add(employee3); - employees.add(employee2); - employees.add(employee1); - manager.changeEmployees(employees); - - Assert.assertEquals("The number of TableItems should be 3", 3, table.getItemCount()); - - testTableItemProperties(table, 0, expectedName3, expectedManager3, expectedTitle3); - testTableItemProperties(table, 1, expectedName2, expectedManager2, expectedTitle2); - testTableItemProperties(table, 2, expectedName1, expectedManager1, expectedTitle1); - } - - @Test - public void testCleared() { - - Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); - - ListValueModel listHolder = buildEmployeeListHolder(); - WritablePropertyValueModel selectedItemHolder = buildEmployeeHolder(); - - Manager manager = new Manager(); - subjectHolder.setValue(manager); - - new TableModel( - listHolder, - selectedItemHolder, - table, - buildColumnAdapter(), - buildLabelProvider() - ); - - // Create Employees - String expectedName1 = "Dali_1"; - String expectedManager1 = "WTP_1"; - String expectedTitle1 = "plug-in_1"; - - String expectedName2 = "Dali_2"; - String expectedManager2 = "WTP_2"; - String expectedTitle2 = "plug-in_2"; - - String expectedName3 = "Dali_3"; - String expectedManager3 = "WTP_3"; - String expectedTitle3 = "plug-in_3"; - - Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1); - Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2); - Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3); - - manager.addEmployee(employee1); - manager.addEmployee(employee2); - manager.addEmployee(employee3); - - // Make sure the Table was populated - Assert.assertEquals("The number of TableItems should be 3", 3, table.getItemCount()); - - // Test removing them all - manager.removeAllEmployees(); - - Assert.assertEquals("The list holder should have been cleared", 0, listHolder.size()); - Assert.assertEquals("The Table should have been cleared", 0, table.getItemCount()); - } - - @Test - public void testItemAdded() { - - Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); - - ListValueModel listHolder = buildEmployeeListHolder(); - WritablePropertyValueModel selectedItemHolder = buildEmployeeHolder(); - - Manager manager = new Manager(); - subjectHolder.setValue(manager); - - TableModel tableModel = new TableModel( - listHolder, - selectedItemHolder, - table, - buildColumnAdapter(), - buildLabelProvider() - ); - - // Create a new Employee - String expectedName = "Dali"; - String expectedManager = "WTP"; - String expectedTitle = "plug-in"; - - Employee employee = manager.addEmployee(expectedName, expectedTitle, expectedManager); - Assert.assertNotNull("The new Employee was not created", employee); - - // Retrieve the TableItem representing the new Employee - int index = tableModel.indexOf(employee); - Assert.assertEquals("The new Employee was not added to the table model", 0, index); - Assert.assertEquals("The number of TableItem should be 1", 1, table.getItemCount()); - - testTableItemProperties(table, index, expectedName, expectedManager, expectedTitle); - } - - @Test - public void testItemMoved() { - - Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); - - ListValueModel listHolder = buildEmployeeListHolder(); - WritablePropertyValueModel selectedItemHolder = buildEmployeeHolder(); - - Manager manager = new Manager(); - subjectHolder.setValue(manager); - - TableModel tableModel = new TableModel( - listHolder, - selectedItemHolder, - table, - buildColumnAdapter(), - buildLabelProvider() - ); - - // Create Employees - String expectedName1 = "Dali_1"; - String expectedManager1 = "WTP_1"; - String expectedTitle1 = "plug-in_1"; - - String expectedName2 = "Dali_2"; - String expectedManager2 = "WTP_2"; - String expectedTitle2 = "plug-in_2"; - - String expectedName3 = "Dali_3"; - String expectedManager3 = "WTP_3"; - String expectedTitle3 = "plug-in_3"; - - Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1); - Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2); - Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3); - - manager.addEmployee(employee1); - manager.addEmployee(employee2); - manager.addEmployee(employee3); - - // Make sure the Employees were added to the Table - Assert.assertEquals("The number of TableItem should be 3", 3, table.getItemCount()); - - // Move an Employee up the list - manager.moveEmployeeUp(employee2); - - int index1 = tableModel.indexOf(employee1); - Assert.assertEquals("The Employee 1 was not moved in the table model", 1, index1); - - int index2 = tableModel.indexOf(employee2); - Assert.assertEquals("The Employee 2 was not moved in the table model", 0, index2); - - int index3 = tableModel.indexOf(employee3); - Assert.assertEquals("The Employee 3 should not have been moved in the table model", 2, index3); - - testTableItemProperties(table, index1, expectedName1, expectedManager1, expectedTitle1); - testTableItemProperties(table, index2, expectedName2, expectedManager2, expectedTitle2); - testTableItemProperties(table, index3, expectedName3, expectedManager3, expectedTitle3); - - // Move an Employee down the list - manager.moveEmployeeDown(employee1); - - index1 = tableModel.indexOf(employee1); - Assert.assertEquals("The Employee 1 should not have been moved in the table model", 2, index1); - - index2 = tableModel.indexOf(employee2); - Assert.assertEquals("The Employee 2 was not moved in the table model", 0, index2); - - index3 = tableModel.indexOf(employee3); - Assert.assertEquals("The Employee 3 was not moved in the table model", 1, index3); - - testTableItemProperties(table, index1, expectedName1, expectedManager1, expectedTitle1); - testTableItemProperties(table, index2, expectedName2, expectedManager2, expectedTitle2); - testTableItemProperties(table, index3, expectedName3, expectedManager3, expectedTitle3); - } - - @Test - public void testItemRemoved() { - - Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); - - ListValueModel listHolder = buildEmployeeListHolder(); - WritablePropertyValueModel selectedItemHolder = buildEmployeeHolder(); - - Manager manager = new Manager(); - subjectHolder.setValue(manager); - - TableModel tableModel = new TableModel( - listHolder, - selectedItemHolder, - table, - buildColumnAdapter(), - buildLabelProvider() - ); - - // Create a new Employee - String expectedName = "Dali"; - String expectedManager = "WTP"; - String expectedTitle = "plug-in"; - - Employee employee = manager.addEmployee(expectedName, expectedTitle, expectedManager); - Assert.assertNotNull("The new Employee was not created", employee); - Assert.assertEquals("The number of TableItem should be 1", 1, table.getItemCount()); - - // Make sure it was added to the model - int index = tableModel.indexOf(employee); - Assert.assertEquals("The new Employee was not added to the table model", 0, index); - testTableItemProperties(table, index, expectedName, expectedManager, expectedTitle); - - // Retrieve the TableItem representing the new Employee - TableItem tableItem = table.getItem(index); - Assert.assertNotNull("No TableItem was found for the new Employee", tableItem); - - // Now test the item being removed - manager.removeEmployee(employee); - index = tableModel.indexOf(employee); - Assert.assertEquals("The Employee was not removed from the table model", -1, index); - Assert.assertEquals("The number of TableItem should be 0", 0, table.getItemCount()); - } - - @Test - public void testItemReplaced() { - - Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); - - ListValueModel listHolder = buildEmployeeListHolder(); - WritablePropertyValueModel selectedItemHolder = buildEmployeeHolder(); - - Manager manager = new Manager(); - subjectHolder.setValue(manager); - - TableModel tableModel = new TableModel( - listHolder, - selectedItemHolder, - table, - buildColumnAdapter(), - buildLabelProvider() - ); - - // Create a new Employee - String expectedName1 = "Dali_1"; - String expectedManager1 = "WTP_1"; - String expectedTitle1 = "plug-in_1"; - - Employee employee1 = manager.addEmployee(expectedName1, expectedTitle1, expectedManager1); - Assert.assertNotNull("The new Employee was not created", employee1); - - // Make sure it was added to the model - int index1 = tableModel.indexOf(employee1); - Assert.assertEquals("The new Employee was not added to the table model", 0, index1); - Assert.assertEquals("The number of TableItem should be 1", 1, table.getItemCount()); - - // Retrieve the TableItem representing the new Employee - TableItem tableItem = table.getItem(index1); - Assert.assertNotNull("No TableItem was found for the new Employee", tableItem); - - testTableItemProperties(table, index1, expectedName1, expectedManager1, expectedTitle1); - - // Replace the Employee - String expectedName2 = "Dali_2"; - String expectedManager2 = "WTP_2"; - String expectedTitle2 = "plug-in_2"; - - Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2); - manager.replace(employee1, employee2); - - int index2 = tableModel.indexOf(employee2); - Assert.assertSame("The Employee that got replaced should be at index " + index1, index1, index2); - Assert.assertEquals("The number of TableItem should be 1", 1, table.getItemCount()); - - testTableItemProperties(table, index2, expectedName2, expectedManager2, expectedTitle2); - } - - @Test - public void testItemsAdded() { - - Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); - - ListValueModel listHolder = buildEmployeeListHolder(); - WritablePropertyValueModel selectedItemHolder = buildEmployeeHolder(); - - Manager manager = new Manager(); - subjectHolder.setValue(manager); - - TableModel tableModel = new TableModel( - listHolder, - selectedItemHolder, - table, - buildColumnAdapter(), - buildLabelProvider() - ); - - // Create Employees - String expectedName1 = "Dali_1"; - String expectedManager1 = "WTP_1"; - String expectedTitle1 = "plug-in_1"; - - String expectedName2 = "Dali_2"; - String expectedManager2 = "WTP_2"; - String expectedTitle2 = "plug-in_2"; - - String expectedName3 = "Dali_3"; - String expectedManager3 = "WTP_3"; - String expectedTitle3 = "plug-in_3"; - - Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1); - Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2); - Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3); - - manager.addEmployee(employee1); - manager.addEmployee(employee2); - manager.addEmployee(employee3); - - // Retrieve the TableItems representing the employees - Assert.assertEquals("The number of TableItem should be 3", 3, table.getItemCount()); - - int index = tableModel.indexOf(employee1); - Assert.assertEquals("The Employee 1 was not added to the table model", 0, index); - - index = tableModel.indexOf(employee2); - Assert.assertEquals("The Employee 2 was not added to the table model", 1, index); - - index = tableModel.indexOf(employee3); - Assert.assertEquals("The Employee 3 was not added to the table model", 2, index); - - // Make sure the TableItem was correctly populated - testTableItemProperties(table, 0, expectedName1, expectedManager1, expectedTitle1); - testTableItemProperties(table, 1, expectedName2, expectedManager2, expectedTitle2); - testTableItemProperties(table, 2, expectedName3, expectedManager3, expectedTitle3); - } - - @Test - public void testItemsMoved() { - - Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); - - ListValueModel listHolder = buildEmployeeListHolder(); - WritablePropertyValueModel selectedItemHolder = buildEmployeeHolder(); - - Manager manager = new Manager(); - subjectHolder.setValue(manager); - - TableModel tableModel = new TableModel( - listHolder, - selectedItemHolder, - table, - buildColumnAdapter(), - buildLabelProvider() - ); - - // Create Employees - String expectedName1 = "Dali_1"; - String expectedManager1 = "WTP_1"; - String expectedTitle1 = "plug-in_1"; - - String expectedName2 = "Dali_2"; - String expectedManager2 = "WTP_2"; - String expectedTitle2 = "plug-in_2"; - - String expectedName3 = "Dali_3"; - String expectedManager3 = "WTP_3"; - String expectedTitle3 = "plug-in_3"; - - String expectedName4 = "Dali_4"; - String expectedManager4 = "WTP_4"; - String expectedTitle4 = "plug-in_4"; - - String expectedName5 = "Dali_5"; - String expectedManager5 = "WTP_5"; - String expectedTitle5 = "plug-in_5"; - - String expectedName6 = "Dali_6"; - String expectedManager6 = "WTP_6"; - String expectedTitle6 = "plug-in_6"; - - Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1); - Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2); - Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3); - Employee employee4 = new Employee(expectedName4, expectedTitle4, expectedManager4); - Employee employee5 = new Employee(expectedName5, expectedTitle5, expectedManager5); - Employee employee6 = new Employee(expectedName6, expectedTitle6, expectedManager6); - - manager.addEmployee(employee1); - manager.addEmployee(employee2); - manager.addEmployee(employee3); - manager.addEmployee(employee4); - manager.addEmployee(employee5); - manager.addEmployee(employee6); - - // Make sure the Employees were added to the Table - Assert.assertEquals("The number of TableItem should be 6", 6, table.getItemCount()); - - // Move an Employee up the list - ArrayList employees = new ArrayList(3); - employees.add(employee3); - employees.add(employee4); - employees.add(employee5); - manager.moveEmployees(employees, 0); - - int index1 = tableModel.indexOf(employee1); - int index2 = tableModel.indexOf(employee2); - int index3 = tableModel.indexOf(employee3); - int index4 = tableModel.indexOf(employee4); - int index5 = tableModel.indexOf(employee5); - int index6 = tableModel.indexOf(employee6); - - Assert.assertEquals("The Employee 1 is not at the right index", 3, index1); - Assert.assertEquals("The Employee 2 is not at the right index", 4, index2); - Assert.assertEquals("The Employee 3 is not at the right index", 0, index3); - Assert.assertEquals("The Employee 4 is not at the right index", 1, index4); - Assert.assertEquals("The Employee 5 is not at the right index", 2, index5); - Assert.assertEquals("The Employee 6 is not at the right index", 5, index6); - - testTableItemProperties(table, index1, expectedName1, expectedManager1, expectedTitle1); - testTableItemProperties(table, index2, expectedName2, expectedManager2, expectedTitle2); - testTableItemProperties(table, index3, expectedName3, expectedManager3, expectedTitle3); - testTableItemProperties(table, index4, expectedName4, expectedManager4, expectedTitle4); - testTableItemProperties(table, index5, expectedName5, expectedManager5, expectedTitle5); - testTableItemProperties(table, index6, expectedName6, expectedManager6, expectedTitle6); - - // Move an Employee down the list - employees = new ArrayList(2); - employees.add(employee1); - employees.add(employee2); - manager.moveEmployees(employees, 4); - - index1 = tableModel.indexOf(employee1); - index2 = tableModel.indexOf(employee2); - index3 = tableModel.indexOf(employee3); - index4 = tableModel.indexOf(employee4); - index5 = tableModel.indexOf(employee5); - index6 = tableModel.indexOf(employee6); - - Assert.assertEquals("The Employee 1 is not at the right index", 4, index1); - Assert.assertEquals("The Employee 2 is not at the right index", 5, index2); - Assert.assertEquals("The Employee 3 is not at the right index", 0, index3); - Assert.assertEquals("The Employee 4 is not at the right index", 1, index4); - Assert.assertEquals("The Employee 5 is not at the right index", 2, index5); - Assert.assertEquals("The Employee 6 is not at the right index", 3, index6); - - testTableItemProperties(table, index1, expectedName1, expectedManager1, expectedTitle1); - testTableItemProperties(table, index2, expectedName2, expectedManager2, expectedTitle2); - testTableItemProperties(table, index3, expectedName3, expectedManager3, expectedTitle3); - testTableItemProperties(table, index4, expectedName4, expectedManager4, expectedTitle4); - testTableItemProperties(table, index5, expectedName5, expectedManager5, expectedTitle5); - testTableItemProperties(table, index6, expectedName6, expectedManager6, expectedTitle6); - } - - @Test - public void testItemsRemoved() { - - Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); - - ListValueModel listHolder = buildEmployeeListHolder(); - WritablePropertyValueModel selectedItemHolder = buildEmployeeHolder(); - - Manager manager = new Manager(); - subjectHolder.setValue(manager); - - TableModel tableModel = new TableModel( - listHolder, - selectedItemHolder, - table, - buildColumnAdapter(), - buildLabelProvider() - ); - - // Create Employees - String expectedName1 = "Dali_1"; - String expectedManager1 = "WTP_1"; - String expectedTitle1 = "plug-in_1"; - - String expectedName2 = "Dali_2"; - String expectedManager2 = "WTP_2"; - String expectedTitle2 = "plug-in_2"; - - String expectedName3 = "Dali_3"; - String expectedManager3 = "WTP_3"; - String expectedTitle3 = "plug-in_3"; - - Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1); - Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2); - Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3); - - manager.addEmployee(employee1); - manager.addEmployee(employee2); - manager.addEmployee(employee3); - - // Retrieve the TableItems representing the employees - Assert.assertEquals("The number of TableItem should be 3", 3, table.getItemCount()); - - int index = tableModel.indexOf(employee1); - Assert.assertEquals("The Employee 1 was not added to the table model", 0, index); - - index = tableModel.indexOf(employee2); - Assert.assertEquals("The Employee 2 was not added to the table model", 1, index); - - index = tableModel.indexOf(employee3); - Assert.assertEquals("The Employee 3 was not added to the table model", 2, index); - - // Remove 2 items - ArrayList employees = new ArrayList(2); - employees.add(employee1); - employees.add(employee3); - manager.removeEmployees(employees); - - Assert.assertEquals("The number of TableItem should be 1", 1, table.getItemCount()); - } - - @Test - public void testPropertyChanged() { - - Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); - - ListValueModel listHolder = buildEmployeeListHolder(); - WritablePropertyValueModel selectedItemHolder = buildEmployeeHolder(); - - Manager manager = new Manager(); - subjectHolder.setValue(manager); - - TableModel tableModel = new TableModel( - listHolder, - selectedItemHolder, - table, - buildColumnAdapter(), - buildLabelProvider() - ); - - // Create a new Employee - String expectedName = "Dali"; - String expectedManager = "WTP"; - String expectedTitle = "plug-in"; - - Employee employee = manager.addEmployee(expectedName, expectedTitle, expectedManager); - Assert.assertNotNull("The new Employee was not created", employee); - - // Make sure it was added to the model - int index = tableModel.indexOf(employee); - Assert.assertEquals("The new Employee was not added to the table model", 0, index); - Assert.assertEquals("The number of TableItem should be 1", 1, table.getItemCount()); - - // Retrieve the TableItem representing the new Employee - TableItem tableItem = table.getItem(index); - Assert.assertNotNull("No TableItem was found for the new Employee", tableItem); - - // Name property - String actualName = tableItem.getText(TableColumnAdapter.NAME_COLUMN); - Assert.assertEquals("TableItem[NAME_COLUMN] was not set correctly", expectedName, actualName); - - expectedName = "Jpt"; - employee.setName(expectedName); - - actualName = tableItem.getText(TableColumnAdapter.NAME_COLUMN); - Assert.assertEquals("TableItem[NAME_COLUMN] was not set correctly", expectedName, actualName); - - // Manager property - String actualManager = tableItem.getText(TableColumnAdapter.MANAGER_COLUMN); - Assert.assertEquals("TableItem[MANAGER_COLUMN] was not set correctly", expectedManager, actualManager); - - expectedManager = "boss"; - employee.setManager(expectedManager); - - actualManager = tableItem.getText(TableColumnAdapter.MANAGER_COLUMN); - Assert.assertEquals("TableItem[MANAGER_COLUMN] was not set correctly", expectedManager, actualManager); - - // Title property - String actualTitle = tableItem.getText(TableColumnAdapter.TITLE_COLUMN); - Assert.assertEquals("TableItem[TITLE_COLUMN] was not set correctly", expectedTitle, actualTitle); - - expectedTitle = "EclipseLink"; - employee.setTitle(expectedTitle); - - actualTitle = tableItem.getText(TableColumnAdapter.TITLE_COLUMN); - Assert.assertEquals("TableItem[TITLE_COLUMN] was not set correctly", expectedTitle, actualTitle); - } - - @Test - public void testSelectedItemsAddedRemoved() { - - Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); - - ListValueModel listHolder = buildEmployeeListHolder(); - SimpleCollectionValueModel selectedItemsHolder = buildEmployeeHolders(); - - Manager manager = new Manager(); - subjectHolder.setValue(manager); - - TableModel tableModel = new TableModel( - listHolder, - selectedItemsHolder, - table, - buildColumnAdapter(), - buildLabelProvider() - ); - - // Create Employees - String expectedName1 = "Dali_1"; - String expectedManager1 = "WTP_1"; - String expectedTitle1 = "plug-in_1"; - - String expectedName2 = "Dali_2"; - String expectedManager2 = "WTP_2"; - String expectedTitle2 = "plug-in_2"; - - String expectedName3 = "Dali_3"; - String expectedManager3 = "WTP_3"; - String expectedTitle3 = "plug-in_3"; - - Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1); - Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2); - Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3); - - manager.addEmployee(employee1); - manager.addEmployee(employee2); - manager.addEmployee(employee3); - - // Test adding selected items - ArrayList employees = new ArrayList(2); - employees.add(employee1); - employees.add(employee3); - selectedItemsHolder.addAll(employees); - - Collection actualEmployees = tableModel.selectedItems(); - Assert.assertNotNull("The collection of selected items can't be null", actualEmployees); - Assert.assertEquals("The count of selected items should be 2", 2, actualEmployees.size()); - - actualEmployees.remove(employee1); - actualEmployees.remove(employee3); - - Assert.assertTrue("The selected items was not retrieved correctly", actualEmployees.isEmpty()); - - // Test removing selected items - selectedItemsHolder.remove(employee1); - - actualEmployees = tableModel.selectedItems(); - Assert.assertNotNull("The collection of selected items can't be null", actualEmployees); - Assert.assertEquals("The count of selected items should be 1", 1, actualEmployees.size()); - - actualEmployees.remove(employee3); - - Assert.assertTrue("The selected items was not retrieved correctly", actualEmployees.isEmpty()); - } - - @Test - public void testSelectedItemsCleared() { - - Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); - - ListValueModel listHolder = buildEmployeeListHolder(); - SimpleCollectionValueModel selectedItemsHolder = buildEmployeeHolders(); - - Manager manager = new Manager(); - subjectHolder.setValue(manager); - - TableModel tableModel = new TableModel( - listHolder, - selectedItemsHolder, - table, - buildColumnAdapter(), - buildLabelProvider() - ); - - // Create Employees - String expectedName1 = "Dali_1"; - String expectedManager1 = "WTP_1"; - String expectedTitle1 = "plug-in_1"; - - String expectedName2 = "Dali_2"; - String expectedManager2 = "WTP_2"; - String expectedTitle2 = "plug-in_2"; - - String expectedName3 = "Dali_3"; - String expectedManager3 = "WTP_3"; - String expectedTitle3 = "plug-in_3"; - - Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1); - Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2); - Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3); - - manager.addEmployee(employee1); - manager.addEmployee(employee2); - manager.addEmployee(employee3); - - // Test adding selected items - ArrayList employees = new ArrayList(2); - employees.add(employee1); - employees.add(employee3); - selectedItemsHolder.addAll(employees); - - Collection actualEmployees = tableModel.selectedItems(); - Assert.assertNotNull("The collection of selected items can't be null", actualEmployees); - Assert.assertEquals("The count of selected items should be 2", 2, actualEmployees.size()); - - actualEmployees.remove(employee1); - actualEmployees.remove(employee3); - Assert.assertTrue("The selected items was not retrieved correctly", actualEmployees.isEmpty()); - - // Test removing selected items - selectedItemsHolder.clear(); - - actualEmployees = tableModel.selectedItems(); - Assert.assertNotNull("The collection of selected items can't be null", actualEmployees); - Assert.assertEquals("The count of selected items should be ", 0, actualEmployees.size()); - } - - @Test - public void testSelectionChangeListener() { - - Table table = new Table(shell, SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION | SWT.MULTI); - - Manager manager = new Manager(); - subjectHolder.setValue(manager); - - TableModel tableModel = new TableModel( - buildEmployeeListHolder(), - buildEmployeeHolder(), - table, - buildColumnAdapter(), - buildLabelProvider() - ); - - Collection employees = new ArrayList(); - tableModel.addSelectionChangeListener(buildSelectionChangeListener(employees)); - - // Create Employees - String expectedName1 = "Dali_1"; - String expectedManager1 = "WTP_1"; - String expectedTitle1 = "plug-in_1"; - - String expectedName2 = "Dali_2"; - String expectedManager2 = "WTP_2"; - String expectedTitle2 = "plug-in_2"; - - String expectedName3 = "Dali_3"; - String expectedManager3 = "WTP_3"; - String expectedTitle3 = "plug-in_3"; - - Employee employee1 = new Employee(expectedName1, expectedTitle1, expectedManager1); - Employee employee2 = new Employee(expectedName2, expectedTitle2, expectedManager2); - Employee employee3 = new Employee(expectedName3, expectedTitle3, expectedManager3); - - manager.addEmployee(employee1); - manager.addEmployee(employee2); - manager.addEmployee(employee3); - - // Test adding selected items - table.setSelection(new int[] { 0, 2 }); - - // It seems a manual selection doesn't send any selection event - tableModel.tableSelectionChanged(null); - - Assert.assertNotNull("The collection of selected items can't be null", employees); - Assert.assertEquals("The count of selected items should be 2", 2, employees.size()); - - employees.remove(employee1); - employees.remove(employee3); - Assert.assertTrue("The selected items was not retrieved correctly", employees.isEmpty()); - - // Test adding selected items - employees.add(employee1); - employees.add(employee3); - table.deselectAll(); - - // It seems a manual selection doesn't send any selection event - tableModel.tableSelectionChanged(null); - - Assert.assertNotNull("The collection of selected items can't be null", employees); - Assert.assertEquals("The count of selected items should be 0", 0, employees.size()); - } - - private void testTableItemProperties(Table table, - int index, - String expectedName, - String expectedManager, - String expectedTitle) - { - TableItem tableItem = table.getItem(index); - Assert.assertNotNull("No TableItem was found for the Employee", tableItem); - - String actualName = tableItem.getText(TableColumnAdapter.NAME_COLUMN); - Assert.assertEquals("TableItem[NAME_COLUMN] was not set correctly", expectedName, actualName); - - String actualTitle = tableItem.getText(TableColumnAdapter.TITLE_COLUMN); - Assert.assertEquals("TableItem[TITLE_COLUMN] was not set correctly", expectedTitle, actualTitle); - - String actualManager = tableItem.getText(TableColumnAdapter.MANAGER_COLUMN); - Assert.assertEquals("TableItem[MANAGER_COLUMN] was not set correctly", expectedManager, actualManager); - } - - private class Employee extends AbstractModel { - - private String manager; - private String name; - private String title; - - static final String MANAGER_PROPERTY = "manager"; - static final String NAME_PROPERTY = "name"; - static final String TITLE_PROPERTY = "title"; - - Employee(String name, String title, String manager) { - super(); - - this.name = name; - this.title = title; - this.manager = manager; - } - - String getManager() { - return manager; - } - - String getName() { - return name; - } - - String getTitle() { - return title; - } - - void setManager(String manager) { - String oldManager = this.manager; - this.manager = manager; - firePropertyChanged(MANAGER_PROPERTY, oldManager, manager); - } - - void setName(String name) { - String oldName = this.name; - this.name = name; - firePropertyChanged(NAME_PROPERTY, oldName, name); - } - - void setTitle(String title) { - String oldTitle = this.title; - this.title = title; - firePropertyChanged(TITLE_PROPERTY, oldTitle, title); - } - } - - private class Manager extends AbstractModel { - - private List employees; - - static final String EMPLOYEES_LIST = "employees"; - - Manager() { - super(); - employees = new ArrayList(); - } - - Employee addEmployee(Employee employee) { - addItemToList(employee, employees, EMPLOYEES_LIST); - return employee; - } - - Employee addEmployee(String name, String title, String manager) { - Employee employee = new Employee(name, title, manager); - return addEmployee(employee); - } - - void changeEmployees(List newEmployees) { - this.synchronizeList(newEmployees, this.employees, EMPLOYEES_LIST); - } - - ListIterator employees() { - return new CloneListIterator(employees); - } - - int employeesSize() { - return employees.size(); - } - - void moveEmployeeDown(Employee employee) { - int index = employees.indexOf(employee); - moveItemInList(index + 1, index, employees, EMPLOYEES_LIST); - } - - void moveEmployees(Collection employees, int targetIndex) { - - int sourceIndex = Integer.MAX_VALUE; - - for (Employee employee : employees) { - sourceIndex = Math.min(sourceIndex, this.employees.indexOf(employee)); - } - - moveItemsInList( - targetIndex, - sourceIndex, - employees.size(), - this.employees, - EMPLOYEES_LIST - ); - } - - void moveEmployeeUp(Employee employee) { - int index = employees.indexOf(employee); - moveItemInList(index - 1, index, employees, EMPLOYEES_LIST); - } - - void removeAllEmployees() { - clearList(employees, EMPLOYEES_LIST); - } - - void removeEmployee(Employee employee) { - removeItemFromList(employee, employees, EMPLOYEES_LIST); - } - - void removeEmployees(Collection employees) { - removeItemsFromList(employees.iterator(), this.employees, EMPLOYEES_LIST); - } - - void replace(Employee oldEmployee, Employee newEmployee) { - replaceItemInList(oldEmployee, newEmployee, employees, EMPLOYEES_LIST); - } - } - - private class TableColumnAdapter implements ColumnAdapter { - - static final int COLUMN_COUNT = 3; - static final int MANAGER_COLUMN = 2; - static final int NAME_COLUMN = 0; - static final int TITLE_COLUMN = 1; - - private WritablePropertyValueModel buildManagerHolder(Employee subject) { - return new PropertyAspectAdapter(Employee.MANAGER_PROPERTY, subject) { - @Override - protected String buildValue_() { - return subject.getManager(); - } - - @Override - protected void setValue_(String value) { - subject.setManager(value); - } - }; - } - - private WritablePropertyValueModel buildNameHolder(Employee subject) { - return new PropertyAspectAdapter(Employee.NAME_PROPERTY, subject) { - @Override - protected String buildValue_() { - return subject.getName(); - } - - @Override - protected void setValue_(String value) { - subject.setName(value); - } - }; - } - - private WritablePropertyValueModel buildTitleHolder(Employee subject) { - return new PropertyAspectAdapter(Employee.TITLE_PROPERTY, subject) { - @Override - protected String buildValue_() { - return subject.getTitle(); - } - - @Override - protected void setValue_(String value) { - subject.setTitle(value); - } - }; - } - - public WritablePropertyValueModel[] cellModels(Employee subject) { - WritablePropertyValueModel[] holders = new WritablePropertyValueModel[3]; - holders[NAME_COLUMN] = buildNameHolder(subject); - holders[TITLE_COLUMN] = buildTitleHolder(subject); - holders[MANAGER_COLUMN] = buildManagerHolder(subject); - return holders; - } - - public int columnCount() { - return COLUMN_COUNT; - } - - public String columnName(int columnIndex) { - return String.valueOf(columnIndex); - } - } - - private class TableLabelProvider extends LabelProvider - implements ITableLabelProvider { - - - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - - public String getColumnText(Object element, int columnIndex) { - Employee employee = (Employee) element; - - if (columnIndex == TableColumnAdapter.NAME_COLUMN) { - return employee.getName(); - } - - if (columnIndex == TableColumnAdapter.TITLE_COLUMN) { - return employee.getTitle(); - } - - return employee.getManager(); - } - } - - private class TableModel extends TableModelAdapter { - - TableModel(ListValueModel listHolder, - CollectionValueModel selectedItemsHolder, - Table table, - ColumnAdapter columnAdapter, - ITableLabelProvider labelProvider) { - - super(listHolder, - selectedItemsHolder, - table, - columnAdapter, - labelProvider); - } - - TableModel(ListValueModel listHolder, - WritablePropertyValueModel selectedItemHolder, - Table table, - ColumnAdapter columnAdapter, - ITableLabelProvider labelProvider) { - - super(listHolder, - new PropertyCollectionValueModelAdapter(selectedItemHolder), - table, - columnAdapter, - labelProvider); - } - - @Override - protected int indexOf(Employee item) { - return super.indexOf(item); - } - - @Override - protected Collection selectedItems() { - return super.selectedItems(); - } - - @Override - protected void tableSelectionChanged(SelectionEvent event) { - super.tableSelectionChanged(event); - } - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/TriStateCheckBoxModelAdapterUITest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/TriStateCheckBoxModelAdapterUITest.java deleted file mode 100644 index 810c151526..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/swt/TriStateCheckBoxModelAdapterUITest.java +++ /dev/null @@ -1,319 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.swt; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.window.ApplicationWindow; -import org.eclipse.jface.window.Window; -import org.eclipse.jpt.common.ui.internal.swt.TriStateCheckBoxModelAdapter; -import org.eclipse.jpt.common.ui.internal.widgets.DefaultWidgetFactory; -import org.eclipse.jpt.common.ui.internal.widgets.TriStateCheckBox; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -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.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -/** - * Play around with a set of tri-state check boxes. - */ -public class TriStateCheckBoxModelAdapterUITest - extends ApplicationWindow -{ - private final TestModel testModel; - private final WritablePropertyValueModel testModelHolder; - private final WritablePropertyValueModel flag1Holder; - private final WritablePropertyValueModel flag2Holder; - private final WritablePropertyValueModel notFlag2Holder; - - public static void main(String[] args) throws Exception { - Window window = new TriStateCheckBoxModelAdapterUITest(args); - window.setBlockOnOpen(true); - window.open(); - Display.getCurrent().dispose(); - System.exit(0); - } - - private TriStateCheckBoxModelAdapterUITest(String[] args) { - super(null); - this.testModel = new TestModel(Boolean.TRUE, Boolean.FALSE); - this.testModelHolder = new SimplePropertyValueModel(this.testModel); - this.flag1Holder = this.buildFlag1Holder(this.testModelHolder); - this.flag2Holder = this.buildFlag2Holder(this.testModelHolder); - this.notFlag2Holder = this.buildNotFlag2Holder(this.testModelHolder); - } - - private WritablePropertyValueModel buildFlag1Holder(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapter(subjectHolder, TestModel.FLAG1_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.isFlag1(); - } - @Override - protected void setValue_(Boolean value) { - this.subject.setFlag1(value); - } - }; - } - - private WritablePropertyValueModel buildFlag2Holder(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapter(subjectHolder, TestModel.FLAG2_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.isFlag2(); - } - @Override - protected void setValue_(Boolean value) { - this.subject.setFlag2(value); - } - }; - } - - private WritablePropertyValueModel buildNotFlag2Holder(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapter(subjectHolder, TestModel.NOT_FLAG2_PROPERTY) { - @Override - protected Boolean buildValue_() { - return this.subject.isNotFlag2(); - } - @Override - protected void setValue_(Boolean value) { - this.subject.setNotFlag2(value); - } - }; - } - - @Override - protected Control createContents(Composite parent) { - ((Shell) parent).setText(this.getClass().getSimpleName()); - parent.setSize(400, 100); - Composite mainPanel = new Composite(parent, SWT.NONE); - mainPanel.setLayout(new FormLayout()); - Control checkBoxPanel = this.buildCheckBoxPanel(mainPanel); - this.buildControlPanel(mainPanel, checkBoxPanel); - return mainPanel; - } - - private Control buildCheckBoxPanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(100, -35); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildFlag1CheckBox(panel); - this.buildFlag2CheckBox(panel); - this.buildNotFlag2CheckBox(panel); - this.buildUnattachedCheckBox(panel); - - return panel; - } - - private void buildFlag1CheckBox(Composite parent) { - TriStateCheckBox checkBox = new TriStateCheckBox(parent, "flag 1", DefaultWidgetFactory.instance()); - TriStateCheckBoxModelAdapter.adapt(this.flag1Holder, checkBox); - } - - private void buildFlag2CheckBox(Composite parent) { - TriStateCheckBox checkBox = new TriStateCheckBox(parent, "flag 2", DefaultWidgetFactory.instance()); - TriStateCheckBoxModelAdapter.adapt(this.flag2Holder, checkBox); - } - - private void buildNotFlag2CheckBox(Composite parent) { - TriStateCheckBox checkBox = new TriStateCheckBox(parent, "next flag 2", DefaultWidgetFactory.instance()); - TriStateCheckBoxModelAdapter.adapt(this.notFlag2Holder, checkBox); - } - - private void buildUnattachedCheckBox(Composite parent) { - TriStateCheckBox checkBox = new TriStateCheckBox(parent, "unattached", DefaultWidgetFactory.instance()); - checkBox.addSelectionListener(this.buildUnattachedSelectionListener()); - } - - private SelectionListener buildUnattachedSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) { - System.out.println("unattached default selected: " + e); - } - public void widgetSelected(SelectionEvent e) { - System.out.println("unattached selected: " + e); - } - }; - } - - private void buildControlPanel(Composite parent, Control checkBoxPanel) { - Composite panel = new Composite(parent, SWT.NONE); - FormData fd = new FormData(); - fd.top = new FormAttachment(checkBoxPanel); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildFlipFlag1Button(panel); - this.buildClearModelButton(panel); - this.buildRestoreModelButton(panel); - this.buildPrintModelButton(panel); - } - - private void buildFlipFlag1Button(Composite parent) { - this.buildFlipFlag1ACI().fill(parent); - } - - private ActionContributionItem buildFlipFlag1ACI() { - Action action = new Action("next flag 1", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - TriStateCheckBoxModelAdapterUITest.this.nextFlag1(); - } - }; - action.setToolTipText("next flag 1"); - return new ActionContributionItem(action); - } - - void nextFlag1() { - this.testModel.nextFlag1(); - } - - private void buildClearModelButton(Composite parent) { - this.buildClearModelACI().fill(parent); - } - - private ActionContributionItem buildClearModelACI() { - Action action = new Action("clear model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - TriStateCheckBoxModelAdapterUITest.this.clearModel(); - } - }; - action.setToolTipText("clear model"); - return new ActionContributionItem(action); - } - - void clearModel() { - this.testModelHolder.setValue(null); - } - - private void buildRestoreModelButton(Composite parent) { - this.buildRestoreModelACI().fill(parent); - } - - private ActionContributionItem buildRestoreModelACI() { - Action action = new Action("restore model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - TriStateCheckBoxModelAdapterUITest.this.restoreModel(); - } - }; - action.setToolTipText("restore model"); - return new ActionContributionItem(action); - } - - void restoreModel() { - this.testModelHolder.setValue(this.testModel); - } - - private void buildPrintModelButton(Composite parent) { - this.buildPrintModelACI().fill(parent); - } - - private ActionContributionItem buildPrintModelACI() { - Action action = new Action("print model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - TriStateCheckBoxModelAdapterUITest.this.printModel(); - } - }; - action.setToolTipText("print model"); - return new ActionContributionItem(action); - } - - void printModel() { - System.out.println("flag 1: " + this.testModel.isFlag1()); - System.out.println("flag 2: " + this.testModel.isFlag2()); - System.out.println("not flag 2: " + this.testModel.isNotFlag2()); - System.out.println("***"); - } - - - private class TestModel extends AbstractModel { - private Boolean flag1; - public static final String FLAG1_PROPERTY = "flag1"; - private Boolean flag2; - public static final String FLAG2_PROPERTY = "flag2"; - private Boolean notFlag2; - public static final String NOT_FLAG2_PROPERTY = "notFlag2"; - - public TestModel(Boolean flag1, Boolean flag2) { - this.flag1 = flag1; - this.flag2 = flag2; - this.notFlag2 = this.next(flag2); - } - private Boolean next(Boolean b) { - return (b == null) ? Boolean.TRUE : b.booleanValue() ? Boolean.FALSE : null; - } - public Boolean isFlag1() { - return this.flag1; - } - public void setFlag1(Boolean flag1) { - Boolean old = this.flag1; - this.flag1 = flag1; - this.firePropertyChanged(FLAG1_PROPERTY, old, flag1); - } - public void nextFlag1() { - this.setFlag1(this.next(this.flag1)); - } - public Boolean isFlag2() { - return this.flag2; - } - public void setFlag2(Boolean flag2) { - Boolean old = this.flag2; - this.flag2 = flag2; - this.firePropertyChanged(FLAG2_PROPERTY, old, flag2); - - old = this.notFlag2; - this.notFlag2 = this.next(flag2); - this.firePropertyChanged(NOT_FLAG2_PROPERTY, old, this.notFlag2); - } - public void nextFlag2() { - this.setFlag2(this.next(this.flag2)); - } - public Boolean isNotFlag2() { - return this.notFlag2; - } - public void setNotFlag2(Boolean notFlag2) { - this.setFlag2(this.next(flag2)); - } - public void nextNotFlag2() { - this.setNotFlag2(this.next(this.notFlag2)); - } - @Override - public String toString() { - return "TestModel(" + this.isFlag1() + " - " + this.isFlag2() + ")"; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlAlignerTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlAlignerTest.java deleted file mode 100644 index 1c2904e0e7..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlAlignerTest.java +++ /dev/null @@ -1,803 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.util; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNotSame; -import static org.junit.Assert.fail; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jpt.common.ui.internal.util.ControlAligner; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Point; -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.Event; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Layout; -import org.eclipse.swt.widgets.Shell; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -@SuppressWarnings("nls") -public final class ControlAlignerTest { - - private ControlAligner controlAligner; - private Composite parent; - private Shell shell; - - private Layout buildSpacerLayout() { - return new Layout() { - @Override - protected Point computeSize(Composite composite, - int widthHint, - int heightHint, - boolean flushCache) { - - return new Point(widthHint, heightHint); - } - - @Override - protected void layout(Composite composite, boolean flushCache) { - GridData data = (GridData) composite.getLayoutData(); - composite.setBounds(0, 0, data.widthHint, data.heightHint); - } - }; - } - - @Before - public void setUp() { - - controlAligner = new ControlAligner(); - - shell = new Shell(Display.getCurrent()); - shell.setLayout(new GridLayout(1, false)); - - parent = new Composite(shell, SWT.NONE); - parent.setLayout(new GridLayout(1, false)); - parent.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING)); - } - - @After - public void tearDown() { - - if (controlAligner != null) { - controlAligner.dispose(); - controlAligner = null; - } - - if (shell != null) { - shell.dispose(); - shell = null; - } - } - - @Test - public void testAddControl1() throws Exception { - - Composite pane = new Composite(parent, SWT.NULL); - pane.setLayout(new GridLayout(3, false)); - pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Label label = new Label(pane, SWT.NULL); - updateGridData(label); - - controlAligner.add(label); - - assertEquals( - "The maximum width should be 0,", - 0, - controlAligner.getMaximumWidth() - ); - - label.setText("This is a ControlAligner"); -// parent.layout(true, true); - - Point size = label.getSize(); - - assertEquals( - "The width should be " + size.x + ",", - size.x, - controlAligner.getMaximumWidth() - ); - } - - @Test - public void testAddControl2() throws Exception { - - Composite pane = new Composite(parent, SWT.NULL); - pane.setLayout(new GridLayout(3, false)); - pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Button button = new Button(pane, SWT.NULL); - button.setText("This is a ControlAligner"); - updateGridData(button); - - controlAligner.add(button); - parent.layout(true, true); - - Point size = button.getSize(); - - assertEquals( - "The width should be " + size.x + ",", - size.x, - controlAligner.getMaximumWidth() - ); - } - - @Test - public void testAddControl3() throws Exception { - - Composite pane = new Composite(parent, SWT.NULL); - pane.setLayout(new GridLayout(3, false)); - pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Label label = new Label(pane, SWT.NULL); - label.setText("This is very long text"); - updateGridData(label); - - Button button = new Button(pane, SWT.NULL); - button.setText("Short text"); - updateGridData(button); - -// parent.layout(true, true); - - controlAligner.add(label); - controlAligner.add(button); - - Point labelSize = label.getSize(); - Point buttonSize = button.getSize(); - int max = Math.max(labelSize.x, buttonSize.x); - - assertEquals( - "The width should be " + max + ",", - max, - controlAligner.getMaximumWidth() - ); - } - - @Test - public void testAddControlAligner1() throws Exception { - - Label label1 = new Label(parent, SWT.NULL); - Label label2 = new Label(parent, SWT.NULL); - - updateGridData(label1); - updateGridData(label2); - - controlAligner.add(label1); - - ControlAligner controlAligner2 = new ControlAligner(); - controlAligner.add(controlAligner2); - controlAligner2.add(label2); - - label1.setText("This is a ControlAligner"); - label2.setText("This is a very long ControlAligner"); -// parent.layout(true, true); - - Point size1 = label1.getSize(); - Point size2 = label2.getSize(); - int width = Math.max(size1.x, size2.x); - - assertEquals( - "The width should be " + width + ",", - width, - controlAligner.getMaximumWidth() - ); - - assertEquals( - "The width should be " + width + ",", - width, - controlAligner2.getMaximumWidth() - ); - } - - @Test - public void testAddControlAligner2() throws Exception { - - Label label1 = new Label(parent, SWT.NULL); - Label label2 = new Label(parent, SWT.NULL); - - updateGridData(label1); - updateGridData(label2); - - controlAligner.add(label1); - - ControlAligner controlAligner2 = new ControlAligner(); - controlAligner2.add(label2); - - label1.setText("This is a ControlAligner"); - label2.setText("This is a very long ControlAligner"); - - controlAligner.add(controlAligner2); -// parent.layout(true, true); - - Point size1 = label1.getSize(); - Point size2 = label2.getSize(); - int width = Math.max(size1.x, size2.x); - - assertEquals( - "The width should be " + width + ",", - width, - controlAligner.getMaximumWidth() - ); - - assertEquals( - "The width should be " + width + ",", - width, - controlAligner2.getMaximumWidth() - ); - } - - @Test(expected=IllegalArgumentException.class) - public void testAddControlAlignerToItself() throws Exception { - controlAligner.add(controlAligner); - fail("A ControlAligner can't be added to itself"); - } - - @Test - public void testDialog_AddControl1() throws Exception { - - final int[] maximumWidth = new int[1]; - final int[] size = new int[1]; - - TitleAreaDialog dialog = new TitleAreaDialog(SWTUtil.getShell()) { - - private Label label; - - @Override - protected Control createDialogArea(Composite parent) { - - Composite pane = new Composite(parent, SWT.NULL); - pane.setLayout(new GridLayout(3, false)); - pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - label = new Label(pane, SWT.LEFT); - label.setText("This is a ControlAligner"); - updateGridData(label); - - controlAligner.add(label); - - return parent; - } - - @Override - protected void initializeBounds() { - super.initializeBounds(); - size[0] = label.getSize().x; - maximumWidth[0] = controlAligner.getMaximumWidth(); - } - }; - - dialog.create(); - dialog.close(); - - assertEquals( - "The width should be " + size[0] + ",", - size[0], - maximumWidth[0] - ); - } - - @Test - public void testDialog_AddControl2() throws Exception { - - final int[] maximumWidth = new int[1]; - final int[] sizes = new int[2]; - - TitleAreaDialog dialog = new TitleAreaDialog(SWTUtil.getShell()) { - - private Button button; - private Label label; - - @Override - protected Control createDialogArea(Composite parent) { - - Composite pane = new Composite(parent, SWT.NULL); - pane.setLayout(new GridLayout(3, false)); - pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - label = new Label(pane, SWT.NULL); - label.setText("This is a ControlAligner"); - updateGridData(label); - - controlAligner.add(label); - - button = new Button(pane, SWT.NULL); - button.setText("Short text"); - updateGridData(button); - - controlAligner.add(button); - - return parent; - } - - @Override - protected void initializeBounds() { - super.initializeBounds(); - sizes[0] = label.getSize().x; - sizes[1] = button.getSize().x; - maximumWidth[0] = controlAligner.getMaximumWidth(); - } - }; - - dialog.create(); - dialog.close(); - - int labelSize = sizes[0]; - int buttonSize = sizes[1]; - int max = Math.max(labelSize, buttonSize); - - assertEquals( - "The width should be " + max + ",", - max, - maximumWidth[0] - ); - } - - @Test - public void testDispose() throws Exception { - - Composite pane = new Composite(parent, SWT.NULL); - pane.setLayout(new GridLayout(3, false)); - pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Label label = new Label(pane, SWT.NULL); - label.setText("This is very long text"); - updateGridData(label); - - Button button = new Button(pane, SWT.NULL); - button.setText("Short text"); - updateGridData(button); - - controlAligner.add(label); - controlAligner.add(button); - - Point labelSize = label.getSize(); - Point buttonSize = button.getSize(); - int max = Math.max(labelSize.x, buttonSize.x); - - assertEquals( - "The width should be " + max + ",", - max, - controlAligner.getMaximumWidth() - ); - - label.dispose(); - - Point newButtonSize = button.getSize(); - - assertNotSame( - "The old max and new max should not be the same", - max, - newButtonSize.x - ); - - assertEquals( - "The ControlAligner doesn't have the right maximum width", - newButtonSize.x, - controlAligner.getMaximumWidth() - ); - } - - @Test - public void testHierarchyOfControlAligners() throws Exception { - - // Aligner1 - // ^ - // |-Aligner2 - // ^ - // |-Aligner3 - ControlAligner controlAligner2 = new ControlAligner(); - controlAligner.add(controlAligner2); - - ControlAligner controlAligner3 = new ControlAligner(); - controlAligner2.add(controlAligner3); - - // Test 1 - Label label1 = new Label(parent, SWT.NULL); - label1.setText("This is a label widget"); - parent.layout(true, true); - - int labelWidth1 = label1.getSize().x; - controlAligner3.add(label1); - - assertEquals(controlAligner3.getMaximumWidth(), labelWidth1); - assertEquals(controlAligner2.getMaximumWidth(), labelWidth1); - assertEquals(controlAligner.getMaximumWidth(), labelWidth1); - - // Test 2 - Label label2 = new Label(parent, SWT.NULL); - label2.setText("ShortLabel"); - controlAligner2.add(label2); - parent.layout(true); - - int newLabelWidth1 = label1.getSize().x; - int newLabelWidth2 = label2.getSize().x; - - assertEquals(controlAligner3.getMaximumWidth(), controlAligner2.getMaximumWidth()); - assertEquals(controlAligner2.getMaximumWidth(), controlAligner.getMaximumWidth()); - assertEquals(newLabelWidth1, newLabelWidth2); - assertEquals(newLabelWidth1, controlAligner.getMaximumWidth()); - - // Test 3 - Label label3 = new Label(parent, SWT.NULL); - label3.setText("A very long label that takes a lot of horizontal space"); -// parent.layout(true); - controlAligner.add(label3); - - newLabelWidth1 = label1.getSize().x; - newLabelWidth2 = label2.getSize().x; - int newLabelWidth3 = label3.getSize().x; - - assertEquals(controlAligner3.getMaximumWidth(), controlAligner2.getMaximumWidth()); - assertEquals(controlAligner2.getMaximumWidth(), controlAligner.getMaximumWidth()); - assertEquals(newLabelWidth1, newLabelWidth2); - assertEquals(newLabelWidth2, newLabelWidth3); - assertEquals(newLabelWidth1, controlAligner.getMaximumWidth()); - - // Make sure all the locked are removed - assertEquals(ReflectionTools.getFieldValue_(controlAligner, "locked"), Boolean.FALSE); - assertEquals(ReflectionTools.getFieldValue_(controlAligner2, "locked"), Boolean.FALSE); - assertEquals(ReflectionTools.getFieldValue_(controlAligner3, "locked"), Boolean.FALSE); - - // Change the text of label2 - label2.setText("mm"); -// parent.layout(true); - - newLabelWidth1 = label1.getSize().x; - newLabelWidth2 = label2.getSize().x; - newLabelWidth3 = label3.getSize().x; - - assertEquals(controlAligner3.getMaximumWidth(), controlAligner2.getMaximumWidth()); - assertEquals(controlAligner2.getMaximumWidth(), controlAligner.getMaximumWidth()); - assertEquals(newLabelWidth1, newLabelWidth2); - assertEquals(newLabelWidth2, newLabelWidth3); - assertEquals(newLabelWidth1, controlAligner.getMaximumWidth()); - - assertEquals(ReflectionTools.getFieldValue_(controlAligner, "locked"), Boolean.FALSE); - assertEquals(ReflectionTools.getFieldValue_(controlAligner2, "locked"), Boolean.FALSE); - assertEquals(ReflectionTools.getFieldValue_(controlAligner3, "locked"), Boolean.FALSE); - - // Change the text of label1 - label1.setText("a"); -// parent.layout(true); - - Composite parent1 = new Composite(SWTUtil.getShell(), SWT.NULL); - parent1.setLayout(new GridLayout()); - - Label tempLabel = new Label(parent1, SWT.NULL); - tempLabel.setText("a"); -// parent1.layout(true); - - int realWidth = tempLabel.getSize().x; - - newLabelWidth1 = label1.getSize().x; - newLabelWidth2 = label2.getSize().x; - newLabelWidth3 = label3.getSize().x; - - assertEquals(controlAligner3.getMaximumWidth(), controlAligner2.getMaximumWidth()); - assertEquals(controlAligner2.getMaximumWidth(), controlAligner.getMaximumWidth()); - assertEquals(newLabelWidth1, newLabelWidth2); - assertEquals(newLabelWidth2, newLabelWidth3); - assertEquals(newLabelWidth1, controlAligner.getMaximumWidth()); - assertFalse(newLabelWidth1 == realWidth); - - assertEquals(ReflectionTools.getFieldValue_(controlAligner, "locked"), Boolean.FALSE); - assertEquals(ReflectionTools.getFieldValue_(controlAligner2, "locked"), Boolean.FALSE); - assertEquals(ReflectionTools.getFieldValue_(controlAligner3, "locked"), Boolean.FALSE); - - // Change the text of label1 - label1.setText("Yes another big long long text so that all the labels will have to take the size of this label to make sure ControlAligner works correctly"); -// parent.layout(true); - - // Weird: It seems no notification is sent, fire one manually - Event event = new Event(); - event.widget = label1; - event.type = SWT.Resize; - label1.notifyListeners(SWT.Resize, event); - - Composite parent2 = new Composite(SWTUtil.getShell(), SWT.NULL); - parent2.setLayout(new GridLayout()); - - tempLabel = new Label(parent2, SWT.NULL); - tempLabel.setText(label1.getText()); - parent2.layout(true); - - realWidth = tempLabel.getSize().x; - - newLabelWidth1 = label1.getSize().x; - newLabelWidth2 = label2.getSize().x; - newLabelWidth3 = label3.getSize().x; - - assertEquals(controlAligner3.getMaximumWidth(), controlAligner2.getMaximumWidth()); - assertEquals(controlAligner2.getMaximumWidth(), controlAligner.getMaximumWidth()); - assertEquals(newLabelWidth1, newLabelWidth2); - assertEquals(newLabelWidth2, newLabelWidth3); - assertEquals(controlAligner.getMaximumWidth(), newLabelWidth1); - assertEquals(realWidth, newLabelWidth1); - - assertEquals(ReflectionTools.getFieldValue_(controlAligner, "locked"), Boolean.FALSE); - assertEquals(ReflectionTools.getFieldValue_(controlAligner2, "locked"), Boolean.FALSE); - assertEquals(ReflectionTools.getFieldValue_(controlAligner3, "locked"), Boolean.FALSE); - } - - @Test - public void testRemoveControl1() throws Exception { - - Composite pane = new Composite(parent, SWT.NULL); - pane.setLayout(new GridLayout(3, false)); - pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Button button = new Button(pane, SWT.NULL); - button.setText("This is a ControlAligner"); - updateGridData(button); - - controlAligner.add(button); - parent.layout(true, true); - - Point size = button.getSize(); - - assertEquals( - "The width should be " + size.x + ",", - size.x, - controlAligner.getMaximumWidth() - ); - - controlAligner.remove(button); - - assertEquals( - "The width should be 0, ", - 0, - controlAligner.getMaximumWidth() - ); - } - - @Test - public void testRemoveControl2() throws Exception { - - Composite pane = new Composite(parent, SWT.NULL); - pane.setLayout(new GridLayout(3, false)); - pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Label label = new Label(pane, SWT.NULL); - label.setText("This is very long text"); - updateGridData(label); - - Button button = new Button(pane, SWT.NULL); - button.setText("Short text"); - updateGridData(button); -// parent.layout(true, true); - - controlAligner.add(label); - controlAligner.add(button); - - Point labelSize = label.getSize(); - Point buttonSize = button.getSize(); - int max = Math.max(labelSize.x, buttonSize.x); - - assertEquals( - "The width should be " + max + ",", - max, - controlAligner.getMaximumWidth() - ); - - controlAligner.remove(label); - - Point newButtonSize = button.getSize(); - - assertNotSame( - "The old max and new max should not be the same", - max, - newButtonSize.x - ); - - assertEquals( - "The ControlAligner doesn't have the right maximum width", - newButtonSize.x, - controlAligner.getMaximumWidth() - ); - } - - @Test - public void testRemoveControl4() throws Exception { - - Composite pane = new Composite(parent, SWT.NULL); - pane.setLayout(new GridLayout(3, false)); - pane.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - // Widget 1 - Label label = new Label(pane, SWT.NULL); - label.setText("This is very long text"); - updateGridData(label); - controlAligner.add(label); - - // Widget 2 - Composite spacer = new Composite(pane, SWT.NULL); - spacer.setLayout(buildSpacerLayout()); - updateGridData(spacer); - controlAligner.add(spacer); - - // Widget 3 - Button button = new Button(pane, SWT.NULL); - button.setText("Short text"); - updateGridData(button); - controlAligner.add(button); - -// parent.layout(true, true); - - // Make sure the 3 widgets have the same width - Point labelSize = label.getSize(); - Point spacerSize = spacer.getSize(); - Point buttonSize = button.getSize(); - int max = Math.max(labelSize.x, buttonSize.x); - max = Math.max(max, spacerSize.x); - - assertEquals( - "The width should be " + max + ",", - max, - controlAligner.getMaximumWidth() - ); - - assertEquals( - "The spacer's width should be " + max + ",", - max, - spacerSize.x - ); - - // Remove the label (the widest widget) and make sure the width was - // correctly calculated - controlAligner.remove(label); - - spacerSize = spacer.getSize(); - buttonSize = button.getSize(); - int max2 = Math.max(spacerSize.x, buttonSize.x); - - assertNotSame( - "The old max and new max should not be the same", - max, - max2 - ); - - assertEquals( - "The ControlAligner doesn't have the right maximum width", - max2, - controlAligner.getMaximumWidth() - ); - - assertEquals( - "The spacer's width should have been adjusted", - max2, - spacerSize.x - ); - } - - @Test - public void testRemoveControlAligner1() throws Exception { - - Label label1 = new Label(parent, SWT.NULL); - Label label2 = new Label(parent, SWT.NULL); - - updateGridData(label1); - updateGridData(label2); - - controlAligner.add(label1); - - ControlAligner controlAligner2 = new ControlAligner(); - controlAligner.add(controlAligner2); - controlAligner2.add(label2); - - label1.setText("This is a ControlAligner"); - label2.setText("This is a very long ControlAligner"); -// parent.layout(true, true); - - Point size1 = label1.getSize(); - Point size2 = label2.getSize(); - int width = Math.max(size1.x, size2.x); - - // Test 1 - assertEquals( - "The width should be " + width + ",", - width, - controlAligner.getMaximumWidth() - ); - - assertEquals( - "The width should be " + width + ",", - width, - controlAligner2.getMaximumWidth() - ); - - // Test 2 - controlAligner.remove(label1); - - width = label2.getSize().x; - - assertEquals( - "The width should be " + width + ",", - width, - controlAligner.getMaximumWidth() - ); - - assertEquals( - "The width should be " + width + ",", - width, - controlAligner2.getMaximumWidth() - ); - } - - @Test - public void testRemoveControlAligner2() throws Exception { - - Label label1 = new Label(parent, SWT.NULL); - Label label2 = new Label(parent, SWT.NULL); - - updateGridData(label1); - updateGridData(label2); - - controlAligner.add(label1); - - ControlAligner controlAligner2 = new ControlAligner(); - controlAligner.add(controlAligner2); - controlAligner2.add(label2); - - label1.setText("This is a ControlAligner"); - label2.setText("This is a very long ControlAligner"); -// parent.layout(true, true); - - Point size1 = label1.getSize(); - Point size2 = label2.getSize(); - int width = Math.max(size1.x, size2.x); - - // Test 1 - assertEquals( - "The width should be " + width + ",", - width, - controlAligner.getMaximumWidth() - ); - - assertEquals( - "The width should be " + width + ",", - width, - controlAligner2.getMaximumWidth() - ); - - // Test 2 - controlAligner2.remove(label2); - - width = label1.getSize().x; - - assertEquals( - "The width should be " + width + ",", - width, - controlAligner.getMaximumWidth() - ); - - assertEquals( - "The width should be " + width + ",", - width, - controlAligner2.getMaximumWidth() - ); - } - - private void updateGridData(Control control) { - GridData data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.grabExcessHorizontalSpace = false; - control.setLayoutData(data); - } -} \ No newline at end of file diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlEnablerTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlEnablerTest.java deleted file mode 100644 index d6406a1bb9..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlEnablerTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.util; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -@SuppressWarnings("nls") -public final class ControlEnablerTest { - private Composite parent; - - @Before - public void setUp() { - parent = new Composite(SWTUtil.getShell(), SWT.NONE); - parent.setLayout(new GridLayout()); - } - - @After - public void tearDown() { - if (parent != null) { - parent.dispose(); - } - } - - @Test - public void testSwitchState() { - - SimplePropertyValueModel booleanHolder = - new SimplePropertyValueModel(true); - - Combo combo = new Combo(parent, SWT.BORDER); - - SWTTools.controlEnabledState(booleanHolder, combo); - - assertTrue( - "The Combo should be enabled", - combo.isEnabled() - ); - - // Change state (null) - booleanHolder.setValue(null); - - assertFalse( - "The Combo should not be enabled", - combo.isEnabled() - ); - - // Change state (true) - booleanHolder.setValue(true); - - assertTrue( - "The Combo should be enabled", - combo.isEnabled() - ); - - // Change state (false) - booleanHolder.setValue(false); - - assertFalse( - "The Combo should not be enabled", - combo.isEnabled() - ); - - // Dispose - combo.dispose(); - booleanHolder.setValue(true); - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlSwitcherTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlSwitcherTest.java deleted file mode 100644 index 49111bdef5..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlSwitcherTest.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.util; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertSame; -import org.eclipse.jpt.common.ui.internal.util.ControlSwitcher; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Point; -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.Text; -import org.eclipse.ui.part.PageBook; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -@SuppressWarnings("nls") -public final class ControlSwitcherTest { - - private PageBook pageBook; - private Composite pane1; - private Composite pane2; - private Composite parent; - - private Composite buildPane1() { - - if (pane1 == null) { - - pane1 = new Composite(pageBook, SWT.NULL); - pane1.setLayout(new GridLayout(2, false)); - - Label label = new Label(pane1, SWT.NULL); - label.setText("&Test2:"); - - Text text = new Text(pane1, SWT.BORDER); - text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Combo combo = new Combo(pane1, SWT.BORDER); - - GridData data = new GridData(GridData.FILL_HORIZONTAL); - data.horizontalSpan = 2; - combo.setLayoutData(data); - } - - return pane1; - } - - private Composite buildPane2() { - - if (pane2 == null) { - - pane2 = new Composite(pageBook, SWT.NULL); - pane2.setLayout(new GridLayout(2, false)); - - Label label = new Label(pane2, SWT.NULL); - label.setText("&Test1:"); - - Text text = new Text(pane2, SWT.BORDER); - text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - } - - return pane2; - } - - private Transformer buildTransformer() { - return new Transformer() { - public Control transform(Boolean value) { - return (value == null) ? null : (value ? pane1 : pane2); - } - }; - } - - @Before - public void setUp() { - parent = new Composite(SWTUtil.getShell(), SWT.NONE); - parent.setLayout(new GridLayout()); - - pageBook = new PageBook(parent, SWT.NULL); - pageBook.setLayoutData(new GridData()); - } - - @After - public void tearDown() { - - if (parent != null) { - - parent.dispose(); - - parent = null; - pageBook = null; - } - } - - @Test - public void testSwitch() { - - SimplePropertyValueModel switchHolder = new SimplePropertyValueModel(); - Transformer transformer = buildTransformer(); - - pane1 = buildPane1(); - pane1.setVisible(false); - - pane2 = buildPane2(); - pane2.setVisible(false); - - new ControlSwitcher( - switchHolder, - transformer, - pageBook - ); - - // Test 1 - switchHolder.setValue(true); - Control control = (Control) ReflectionTools.getFieldValue(pageBook, "currentPage"); - - assertNotNull( - "The page book's page shouldn't be null", - control - ); - - assertSame( - "The current pane should be pane1", - pane1, - control - ); - - Point pane1Size = pane1.computeSize(SWT.DEFAULT, SWT.DEFAULT); - Point pageBookSize = pageBook.computeSize(SWT.DEFAULT, SWT.DEFAULT); - - assertEquals( - "The width of the PageBook should be the same as the width of pane1", - pane1Size.x, - pageBookSize.x - ); - - assertEquals( - "The height of the PageBook should be the same as the height of pane1", - pane1Size.y, - pageBookSize.y - ); - - // Test 2 - switchHolder.setValue(false); - control = (Control) ReflectionTools.getFieldValue(pageBook, "currentPage"); - - assertNotNull( - "The page book's page shouldn't be null", - control - ); - - assertSame( - "The current pane should be pane2", - pane2, - control - ); - - Point pane2Size = pane2.computeSize(SWT.DEFAULT, SWT.DEFAULT); - pageBookSize = pageBook.computeSize(SWT.DEFAULT, SWT.DEFAULT); - - assertEquals( - "The width of the PageBook should be the same as the width of pane2", - pane2Size.x, - pageBookSize.x - ); - - assertEquals( - "The height of the PageBook should be the same as the height of pane2", - pane2Size.y, - pageBookSize.y - ); - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlVisibilityEnablerTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlVisibilityEnablerTest.java deleted file mode 100644 index f978ed1618..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/ControlVisibilityEnablerTest.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.util; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Combo; -import org.eclipse.swt.widgets.Composite; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -@SuppressWarnings("nls") -public final class ControlVisibilityEnablerTest { - private Composite parent; - - @Before - public void setUp() { - parent = new Composite(SWTUtil.getShell(), SWT.NONE); - parent.setLayout(new GridLayout()); - } - - @After - public void tearDown() { - if (parent != null) { - parent.dispose(); - } - } - - @Test - public void testSwitchState() { - - SimplePropertyValueModel booleanHolder = - new SimplePropertyValueModel(true); - - Combo combo = new Combo(parent, SWT.BORDER); - - SWTTools.controlVisibleState(booleanHolder, combo); - - assertTrue( - "The Combo should be visible", - combo.isVisible() - ); - - // Change state (null) - booleanHolder.setValue(null); - - assertFalse( - "The Combo should not be visible", - combo.isVisible() - ); - - // Change state (true) - booleanHolder.setValue(true); - - assertTrue( - "The Combo should be visible", - combo.isVisible() - ); - - // Change state (false) - booleanHolder.setValue(false); - - assertFalse( - "The Combo should not be visible", - combo.isVisible() - ); - - // Dispose - combo.dispose(); - booleanHolder.setValue(true); - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/JptUiUtilTests.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/JptUiUtilTests.java deleted file mode 100644 index 38f00d21d0..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/JptUiUtilTests.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.util; - -import junit.framework.JUnit4TestAdapter; -import junit.framework.Test; -import junit.framework.TestSuite; -import org.junit.runner.RunWith; -import org.junit.runners.Suite; -import org.junit.runners.Suite.SuiteClasses; - -@SuiteClasses -({ - ControlAlignerTest.class, - ControlSwitcherTest.class, - ControlEnablerTest.class, - ControlVisibilityEnablerTest.class, - LabeledButtonTest.class, - LabeledLabelTest.class, - LabeledControlUpdaterTest.class, - PaneEnablerTest.class, - PaneVisibilityEnablerTest.class, -}) -@RunWith(Suite.class) -public final class JptUiUtilTests { - - private JptUiUtilTests() { - super(); - throw new UnsupportedOperationException(); - } - - public static Test suite() { - TestSuite suite = new TestSuite(); - suite.addTest(new JUnit4TestAdapter(JptUiUtilTests.class)); - return suite; - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledButtonTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledButtonTest.java deleted file mode 100644 index 52515acb41..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledButtonTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.util; - -import static org.junit.Assert.assertEquals; -import org.eclipse.core.runtime.AssertionFailedException; -import org.eclipse.jpt.common.ui.internal.util.LabeledButton; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -@SuppressWarnings("nls") -public final class LabeledButtonTest { - - private Composite parent; - - @Before - public void setUp() { - parent = new Composite(SWTUtil.getShell(), SWT.NONE); - parent.setLayout(new GridLayout()); - } - - @After - public void tearDown() { - if (parent != null) { - parent.dispose(); - parent = null; - } - } - - @Test - public void testLabeledButton1() { - Button button = new Button(parent, SWT.NULL); - new LabeledButton(button); - } - - @Test(expected=AssertionFailedException.class) - public void testLabeledButton2() { - new LabeledButton(null); - } - - @Test - public void testSetImage() { - - Image expected = new Image(parent.getDisplay(), 16, 16); - - try { - Button button = new Button(parent, SWT.NULL); - LabeledButton labeledButton = new LabeledButton(button); - - labeledButton.setImage(expected); - - assertEquals( - "The Button didn't receive the Image", - expected, - button.getImage() - ); - } - finally { - expected.dispose(); - } - } - - @Test - public void testSetImageDispose() { - - Image expected = new Image(parent.getDisplay(), 16, 16); - - try { - Button button = new Button(parent, SWT.NULL); - LabeledButton labeledButton = new LabeledButton(button); - - button.dispose(); - - // This should not fail but simply do nothing - labeledButton.setImage(expected); - } - finally { - expected.dispose(); - } - } - - @Test - public void testSetText() { - Button button = new Button(parent, SWT.NULL); - LabeledButton labeledButton = new LabeledButton(button); - - String expected = "This is a test"; - labeledButton.setText(expected); - - assertEquals( - "The Button didn't receive the text", - expected, - button.getText() - ); - } - - @Test - public void testSetTextDispose() { - Button button = new Button(parent, SWT.NULL); - LabeledButton labeledButton = new LabeledButton(button); - - button.dispose(); - - // This should not fail but simply do nothing - String expected = "This is a test"; - labeledButton.setText(expected); - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledControlUpdaterTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledControlUpdaterTest.java deleted file mode 100644 index 2238dc972f..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledControlUpdaterTest.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.util; - -import static org.junit.Assert.assertEquals; -import org.eclipse.jpt.common.ui.internal.util.LabeledControlUpdater; -import org.eclipse.jpt.common.ui.internal.util.LabeledLabel; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -@SuppressWarnings("nls") -public final class LabeledControlUpdaterTest { - - private Composite parent; - - @Before - public void setUp() { - parent = new Composite(SWTUtil.getShell(), SWT.NONE); - parent.setLayout(new GridLayout()); - } - - @After - public void tearDown() { - if (parent != null) { - parent.dispose(); - parent = null; - } - } - - @Test - public void testSetImage() { - - Image expected = new Image(parent.getDisplay(), 16, 16); - - try { - Label label = new Label(parent, SWT.NULL); - LabeledLabel labeledLabel = new LabeledLabel(label); - - WritablePropertyValueModel imageHolder = new SimplePropertyValueModel(); - new LabeledControlUpdater(labeledLabel, null, imageHolder); - - labeledLabel.setImage(expected); - - assertEquals( - "The Label didn't receive the Image", - expected, - label.getImage() - ); - } - finally { - expected.dispose(); - } - } - - @Test - public void testSetImageDispose() { - - Image expected = new Image(parent.getDisplay(), 16, 16); - - try { - Label label = new Label(parent, SWT.NULL); - LabeledLabel labeledLabel = new LabeledLabel(label); - - WritablePropertyValueModel imageHolder = new SimplePropertyValueModel(); - new LabeledControlUpdater(labeledLabel, null, imageHolder); - - label.dispose(); - labeledLabel.setImage(expected); - } - finally { - expected.dispose(); - } - } - - @Test - public void testSetText() { - - Label label = new Label(parent, SWT.NULL); - LabeledLabel labeledLabel = new LabeledLabel(label); - - WritablePropertyValueModel textHolder = new SimplePropertyValueModel(); - new LabeledControlUpdater(labeledLabel, textHolder); - - String expected = "This is a test"; - textHolder.setValue(expected); - - assertEquals( - "The Label didn't receive the text", - expected, - label.getText() - ); - } - - @Test - public void testSetTextDispose() { - - Label label = new Label(parent, SWT.NULL); - LabeledLabel labeledLabel = new LabeledLabel(label); - - WritablePropertyValueModel textHolder = new SimplePropertyValueModel(); - new LabeledControlUpdater(labeledLabel, textHolder); - - label.dispose(); - - String expected = "This is a test"; - textHolder.setValue(expected); - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledLabelTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledLabelTest.java deleted file mode 100644 index d43bcee4fb..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/LabeledLabelTest.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.util; - -import static org.junit.Assert.assertEquals; -import org.eclipse.core.runtime.AssertionFailedException; -import org.eclipse.jpt.common.ui.internal.util.LabeledLabel; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -@SuppressWarnings("nls") -public final class LabeledLabelTest { - - private Composite parent; - - @Before - public void setUp() { - parent = new Composite(SWTUtil.getShell(), SWT.NONE); - parent.setLayout(new GridLayout()); - } - - @After - public void tearDown() { - if (parent != null) { - parent.dispose(); - parent = null; - } - } - - @Test - public void testLabeledButton1() { - Label label = new Label(parent, SWT.NULL); - new LabeledLabel(label); - } - - @Test(expected=AssertionFailedException.class) - public void testLabeledButton2() { - new LabeledLabel(null); - } - - @Test - public void testSetImage() { - - Image expected = new Image(parent.getDisplay(), 16, 16); - - try { - Label label = new Label(parent, SWT.NULL); - LabeledLabel labeledLabel = new LabeledLabel(label); - - labeledLabel.setImage(expected); - - assertEquals( - "The Label didn't receive the Image", - expected, - label.getImage() - ); - } - finally { - expected.dispose(); - } - } - - @Test - public void testSetImageDispose() { - - Image expected = new Image(parent.getDisplay(), 16, 16); - - try { - Label label = new Label(parent, SWT.NULL); - LabeledLabel labeledLabel = new LabeledLabel(label); - - label.dispose(); - - // This should not fail but simply do nothing - labeledLabel.setImage(expected); - } - finally { - expected.dispose(); - } - } - - @Test - public void testSetText() { - Label label = new Label(parent, SWT.NULL); - LabeledLabel labeledLabel = new LabeledLabel(label); - - String expected = "This is a test"; - labeledLabel.setText(expected); - - assertEquals( - "The Label didn't receive the text", - expected, - label.getText() - ); - } - - @Test - public void testSetTextDispose() { - Label label = new Label(parent, SWT.NULL); - LabeledLabel labeledLabel = new LabeledLabel(label); - - label.dispose(); - - // This should not fail but simply do nothing - String expected = "This is a test"; - labeledLabel.setText(expected); - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/PaneEnablerTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/PaneEnablerTest.java deleted file mode 100644 index b68fd99686..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/PaneEnablerTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.util; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import org.eclipse.jpt.common.ui.internal.util.PaneEnabler; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.jpt.common.ui.internal.widgets.DialogPane; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.node.Node; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -@SuppressWarnings("nls") -public final class PaneEnablerTest { - private Composite parent; - - @Before - public void setUp() { - parent = new Composite(SWTUtil.getShell(), SWT.NONE); - parent.setLayout(new GridLayout()); - } - - @After - public void tearDown() { - if (parent != null) { - parent.dispose(); - } - } - - @Test - public void testSwitchState() { - - SimplePropertyValueModel booleanHolder = - new SimplePropertyValueModel(true); - - DialogPane pane = new DialogPane( - new SimplePropertyValueModel(), - parent) - { - @Override - protected void initializeLayout(Composite container) { - } - }; - - new PaneEnabler(booleanHolder, pane); - - assertTrue( - "The pane should be enabled", - pane.getControl().isEnabled() - ); - - // Change state (null) - booleanHolder.setValue(null); - - assertFalse( - "The pane should not be enabled", - pane.getControl().isEnabled() - ); - - // Change state (true) - booleanHolder.setValue(true); - - assertTrue( - "The pane should be enabled", - pane.getControl().isEnabled() - ); - - // Change state (false) - booleanHolder.setValue(false); - - assertFalse( - "The pane should not be enabled", - pane.getControl().isEnabled() - ); - - // Dispose - pane.dispose(); - booleanHolder.setValue(true); - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/PaneVisibilityEnablerTest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/PaneVisibilityEnablerTest.java deleted file mode 100644 index e0ac3ce2ad..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/util/PaneVisibilityEnablerTest.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.util; - -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertTrue; -import org.eclipse.jpt.common.ui.internal.util.PaneVisibilityEnabler; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.jpt.common.ui.internal.widgets.DialogPane; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.node.Node; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -@SuppressWarnings("nls") -public final class PaneVisibilityEnablerTest { - private Composite parent; - - @Before - public void setUp() { - parent = new Composite(SWTUtil.getShell(), SWT.NONE); - parent.setLayout(new GridLayout()); - } - - @After - public void tearDown() { - if (parent != null) { - parent.dispose(); - } - } - - @Test - public void testSwitchState() { - - SimplePropertyValueModel booleanHolder = - new SimplePropertyValueModel(true); - - DialogPane pane = new DialogPane( - new SimplePropertyValueModel(), - parent) - { - @Override - protected void initializeLayout(Composite container) { - } - }; - - new PaneVisibilityEnabler(booleanHolder, pane); - - assertTrue( - "The pane should be visible", - pane.getControl().isVisible() - ); - - // Change state (null) - booleanHolder.setValue(null); - - assertFalse( - "The pane should not be visible", - pane.getControl().isVisible() - ); - - // Change state (true) - booleanHolder.setValue(true); - - assertTrue( - "The pane should be visible", - pane.getControl().isVisible() - ); - - // Change state (false) - booleanHolder.setValue(false); - - assertFalse( - "The pane should not be visible", - pane.getControl().isVisible() - ); - - // Dispose - pane.dispose(); - booleanHolder.setValue(true); - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/BooleanStateControllerUITest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/BooleanStateControllerUITest.java deleted file mode 100644 index f1568bd867..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/BooleanStateControllerUITest.java +++ /dev/null @@ -1,278 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.utility.swt; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.window.ApplicationWindow; -import org.eclipse.jface.window.Window; -import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormLayout; -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.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; - -/** - * Play around with boolean state controllers ('enabled' and 'visible'). - *

- * Note the behavior of composites:

    - *
  • When a composite is disabled, its children are disabled but not - * grayed out. - *
  • When a composite is made invisible, its children are also made - * invisible. - *
- */ -@SuppressWarnings("nls") -public class BooleanStateControllerUITest - extends ApplicationWindow -{ - private final WritablePropertyValueModel enabledHolder; - private final WritablePropertyValueModel visibleHolder; - private final SimpleListValueModel listHolder; - private final WritablePropertyValueModel listSelectionHolder; - - public static void main(String[] args) throws Exception { - Window window = new BooleanStateControllerUITest(args); - window.setBlockOnOpen(true); - window.open(); - Display.getCurrent().dispose(); - System.exit(0); - } - - private BooleanStateControllerUITest(@SuppressWarnings("unused") String[] args) { - super(null); - this.enabledHolder = new SimplePropertyValueModel(Boolean.TRUE); - this.visibleHolder = new SimplePropertyValueModel(Boolean.TRUE); - this.listHolder = this.buildListHolder(); - this.listSelectionHolder = new SimplePropertyValueModel(null); - } - - private SimpleListValueModel buildListHolder() { - SimpleListValueModel result = new SimpleListValueModel(); - result.add("zero"); - result.add("one"); - result.add("two"); - result.add("three"); - result.add("four"); - result.add("five"); - result.add("six"); - result.add("seven"); - return result; - } - - @Override - protected Control createContents(Composite parent) { - ((Shell) parent).setText(this.getClass().getSimpleName()); - parent.setSize(500, 150); - Composite mainPanel = new Composite(parent, SWT.NONE); - mainPanel.setLayout(new FormLayout()); - Control widgetPanel = this.buildWidgetPanels(mainPanel); - this.buildControlPanel(mainPanel, widgetPanel); - return mainPanel; - } - - private Control buildWidgetPanels(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(100, -35); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout(SWT.VERTICAL)); - - this.buildWidgetPanel1(panel); - this.buildWidgetPanel2(panel); - - return panel; - } - - private void buildWidgetPanel1(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - panel.setLayout(new FillLayout(SWT.HORIZONTAL)); - - Button enabledComboBoxCheckBox = this.buildEnabledComboBoxCheckBox(panel); - SWTTools.bind(this.enabledHolder, enabledComboBoxCheckBox); - - Button visibleComboBoxCheckBox = this.buildVisibleComboBoxCheckBox(panel); - SWTTools.bind(this.visibleHolder, visibleComboBoxCheckBox); - - Label comboBoxLabel = this.buildComboBoxLabel(panel); - Combo comboBox = this.buildComboBox(panel); - SWTTools.bind(this.listHolder, this.listSelectionHolder, comboBox); - SWTTools.controlEnabledState(this.enabledHolder, comboBoxLabel, comboBox); - SWTTools.controlVisibleState(this.visibleHolder, comboBoxLabel, comboBox); - } - - private Button buildEnabledComboBoxCheckBox(Composite parent) { - return this.buildCheckBox(parent, "enabled"); - } - - private Button buildVisibleComboBoxCheckBox(Composite parent) { - return this.buildCheckBox(parent, "visible"); - } - - private Button buildCheckBox(Composite parent, String text) { - Button checkBox = new Button(parent, SWT.CHECK); - checkBox.setText(text); - return checkBox; - } - - private Label buildComboBoxLabel(Composite parent) { - Label label = new Label(parent, SWT.LEFT); - label.setText("list:"); - return label; - } - - private Combo buildComboBox(Composite parent) { - return new Combo(parent, SWT.READ_ONLY); - } - - private void buildWidgetPanel2(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - panel.setLayout(new FillLayout(SWT.HORIZONTAL)); - - Button checkBox1 = this.buildCheckBox(panel, "one"); - this.buildCheckBox(panel, "two"); - this.buildCheckBox(panel, "three"); - this.buildCheckBox(panel, "four"); - - SWTTools.controlEnabledState(this.enabledHolder, panel, checkBox1); - SWTTools.controlVisibleState(this.visibleHolder, panel); - } - - private void buildControlPanel(Composite parent, Control widgetPanel) { - Composite panel = new Composite(parent, SWT.NONE); - FormData fd = new FormData(); - fd.top = new FormAttachment(widgetPanel); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildClearEnabledModelButton(panel); - this.buildClearVisibleModelButton(panel); - this.buildNullSelectionModelButton(panel); - this.buildNextButton(panel); - } - - private void buildClearEnabledModelButton(Composite parent) { - this.buildClearEnabledModelACI().fill(parent); - } - - private ActionContributionItem buildClearEnabledModelACI() { - Action action = new Action("clear enabled model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - BooleanStateControllerUITest.this.clearEnabledModel(); - } - }; - action.setToolTipText("clear enabled model"); - return new ActionContributionItem(action); - } - - void clearEnabledModel() { - this.enabledHolder.setValue(null); - } - - private void buildClearVisibleModelButton(Composite parent) { - this.buildClearVisibleModelACI().fill(parent); - } - - private ActionContributionItem buildClearVisibleModelACI() { - Action action = new Action("clear visible model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - BooleanStateControllerUITest.this.clearVisibleModel(); - } - }; - action.setToolTipText("clear visible model"); - return new ActionContributionItem(action); - } - - void clearVisibleModel() { - this.visibleHolder.setValue(null); - } - - private void buildNullSelectionModelButton(Composite parent) { - this.buildNullSelectionModelACI().fill(parent); - } - - private ActionContributionItem buildNullSelectionModelACI() { - Action action = new Action("null selection model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - BooleanStateControllerUITest.this.setSelectionModelNull(); - } - }; - action.setToolTipText("null selection model"); - return new ActionContributionItem(action); - } - - void setSelectionModelNull() { - this.listSelectionHolder.setValue(null); - } - - private void buildNextButton(Composite parent) { - this.buildNextACI().fill(parent); - } - - private ActionContributionItem buildNextACI() { - Action action = new Action("next", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - BooleanStateControllerUITest.this.next(); - } - }; - action.setToolTipText("next"); - return new ActionContributionItem(action); - } - - void next() { - this.listSelectionHolder.setValue(this.getNextListSelection()); - } - - private String getNextListSelection() { - return this.listHolder.get(this.getNextListSelectionIndex()); - } - - private int getNextListSelectionIndex() { - int index = this.getListSelectionIndex(); - if (index == -1) { - return 0; - } - index++; - return (index == this.listHolder.size()) ? 0 : index; - } - - private int getListSelectionIndex() { - return this.listHolder.indexOf(this.getListSelection()); - } - - private String getListSelection() { - return this.listSelectionHolder.getValue(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/CheckBoxModelBindingUITest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/CheckBoxModelBindingUITest.java deleted file mode 100644 index 6d211010a9..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/CheckBoxModelBindingUITest.java +++ /dev/null @@ -1,318 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.utility.swt; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.window.ApplicationWindow; -import org.eclipse.jface.window.Window; -import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -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.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormLayout; -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.Shell; - -/** - * Play around with a set of check boxes. - */ -@SuppressWarnings("nls") -public class CheckBoxModelBindingUITest - extends ApplicationWindow -{ - private final TestModel testModel; - private final WritablePropertyValueModel testModelHolder; - private final WritablePropertyValueModel flag1Holder; - private final WritablePropertyValueModel flag2Holder; - private final WritablePropertyValueModel notFlag2Holder; - - public static void main(String[] args) throws Exception { - Window window = new CheckBoxModelBindingUITest(args); - window.setBlockOnOpen(true); - window.open(); - Display.getCurrent().dispose(); - System.exit(0); - } - - private CheckBoxModelBindingUITest(@SuppressWarnings("unused") String[] args) { - super(null); - this.testModel = new TestModel(true, true); - this.testModelHolder = new SimplePropertyValueModel(this.testModel); - this.flag1Holder = this.buildFlag1Holder(this.testModelHolder); - this.flag2Holder = this.buildFlag2Holder(this.testModelHolder); - this.notFlag2Holder = this.buildNotFlag2Holder(this.testModelHolder); - } - - private WritablePropertyValueModel buildFlag1Holder(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapter(subjectHolder, TestModel.FLAG1_PROPERTY) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.isFlag1()); - } - @Override - protected void setValue_(Boolean value) { - this.subject.setFlag1(value.booleanValue()); - } - }; - } - - private WritablePropertyValueModel buildFlag2Holder(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapter(subjectHolder, TestModel.FLAG2_PROPERTY) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.isFlag2()); - } - @Override - protected void setValue_(Boolean value) { - this.subject.setFlag2(value.booleanValue()); - } - }; - } - - private WritablePropertyValueModel buildNotFlag2Holder(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapter(subjectHolder, TestModel.NOT_FLAG2_PROPERTY) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.isNotFlag2()); - } - @Override - protected void setValue_(Boolean value) { - this.subject.setNotFlag2(value.booleanValue()); - } - }; - } - - @Override - protected Control createContents(Composite parent) { - ((Shell) parent).setText(this.getClass().getSimpleName()); - parent.setSize(400, 100); - Composite mainPanel = new Composite(parent, SWT.NONE); - mainPanel.setLayout(new FormLayout()); - Control checkBoxPanel = this.buildCheckBoxPanel(mainPanel); - this.buildControlPanel(mainPanel, checkBoxPanel); - return mainPanel; - } - - private Control buildCheckBoxPanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(100, -35); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildFlag1CheckBox(panel); - this.buildFlag2CheckBox(panel); - this.buildNotFlag2CheckBox(panel); - this.buildUnattachedCheckBox(panel); - - return panel; - } - - private void buildFlag1CheckBox(Composite parent) { - Button checkBox = new Button(parent, SWT.CHECK); - checkBox.setText("flag 1"); - SWTTools.bind(this.flag1Holder, checkBox); - } - - private void buildFlag2CheckBox(Composite parent) { - Button checkBox = new Button(parent, SWT.CHECK); - checkBox.setText("flag 2"); - SWTTools.bind(this.flag2Holder, checkBox); - } - - private void buildNotFlag2CheckBox(Composite parent) { - Button checkBox = new Button(parent, SWT.CHECK); - checkBox.setText("not flag 2"); - SWTTools.bind(this.notFlag2Holder, checkBox); - } - - private void buildUnattachedCheckBox(Composite parent) { - Button checkBox = new Button(parent, SWT.CHECK); - checkBox.setText("unattached"); - checkBox.addSelectionListener(this.buildUnattachedSelectionListener()); - } - - private SelectionListener buildUnattachedSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) { - System.out.println("unattached default selected: " + e); - } - public void widgetSelected(SelectionEvent e) { - System.out.println("unattached selected: " + e); - } - }; - } - - private void buildControlPanel(Composite parent, Control checkBoxPanel) { - Composite panel = new Composite(parent, SWT.NONE); - FormData fd = new FormData(); - fd.top = new FormAttachment(checkBoxPanel); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildFlipFlag1Button(panel); - this.buildNotFlag2ToggleButton(panel); - this.buildClearModelButton(panel); - this.buildRestoreModelButton(panel); - this.buildPrintModelButton(panel); - } - - private void buildFlipFlag1Button(Composite parent) { - this.buildFlipFlag1ACI().fill(parent); - } - - private ActionContributionItem buildFlipFlag1ACI() { - Action action = new Action("flip flag 1", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - CheckBoxModelBindingUITest.this.flipFlag1(); - } - }; - action.setToolTipText("flip flag 1"); - return new ActionContributionItem(action); - } - - void flipFlag1() { - this.testModel.setFlag1( ! this.testModel.isFlag1()); - } - - private void buildNotFlag2ToggleButton(Composite parent) { - Button checkBox = new Button(parent, SWT.TOGGLE); - checkBox.setText("not flag 2"); - SWTTools.bind(this.notFlag2Holder, checkBox); - } - - private void buildClearModelButton(Composite parent) { - this.buildClearModelACI().fill(parent); - } - - private ActionContributionItem buildClearModelACI() { - Action action = new Action("clear model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - CheckBoxModelBindingUITest.this.clearModel(); - } - }; - action.setToolTipText("clear model"); - return new ActionContributionItem(action); - } - - void clearModel() { - this.testModelHolder.setValue(null); - } - - private void buildRestoreModelButton(Composite parent) { - this.buildRestoreModelACI().fill(parent); - } - - private ActionContributionItem buildRestoreModelACI() { - Action action = new Action("restore model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - CheckBoxModelBindingUITest.this.restoreModel(); - } - }; - action.setToolTipText("restore model"); - return new ActionContributionItem(action); - } - - void restoreModel() { - this.testModelHolder.setValue(this.testModel); - } - - private void buildPrintModelButton(Composite parent) { - this.buildPrintModelACI().fill(parent); - } - - private ActionContributionItem buildPrintModelACI() { - Action action = new Action("print model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - CheckBoxModelBindingUITest.this.printModel(); - } - }; - action.setToolTipText("print model"); - return new ActionContributionItem(action); - } - - void printModel() { - System.out.println("flag 1: " + this.testModel.isFlag1()); - System.out.println("flag 2: " + this.testModel.isFlag2()); - System.out.println("not flag 2: " + this.testModel.isNotFlag2()); - System.out.println("***"); - } - - - public static class TestModel extends AbstractModel { - private boolean flag1; - public static final String FLAG1_PROPERTY = "flag1"; - private boolean flag2; - public static final String FLAG2_PROPERTY = "flag2"; - private boolean notFlag2; - public static final String NOT_FLAG2_PROPERTY = "notFlag2"; - - public TestModel(boolean flag1, boolean flag2) { - this.flag1 = flag1; - this.flag2 = flag2; - this.notFlag2 = ! flag2; - } - public boolean isFlag1() { - return this.flag1; - } - public void setFlag1(boolean flag1) { - boolean old = this.flag1; - this.flag1 = flag1; - this.firePropertyChanged(FLAG1_PROPERTY, old, flag1); - } - public boolean isFlag2() { - return this.flag2; - } - public void setFlag2(boolean flag2) { - boolean old = this.flag2; - this.flag2 = flag2; - this.firePropertyChanged(FLAG2_PROPERTY, old, flag2); - - old = this.notFlag2; - this.notFlag2 = ! flag2; - this.firePropertyChanged(NOT_FLAG2_PROPERTY, old, this.notFlag2); - } - public boolean isNotFlag2() { - return this.notFlag2; - } - public void setNotFlag2(boolean notFlag2) { - this.setFlag2( ! notFlag2); - } - @Override - public String toString() { - return "TestModel(" + this.isFlag1() + " - " + this.isFlag2() + ")"; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/DropDownListBoxModelBindingUITest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/DropDownListBoxModelBindingUITest.java deleted file mode 100644 index dad37d9521..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/DropDownListBoxModelBindingUITest.java +++ /dev/null @@ -1,664 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.utility.swt; - -import java.text.Collator; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.window.ApplicationWindow; -import org.eclipse.jface.window.Window; -import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelWrapper; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.widgets.Combo; -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; -import org.eclipse.swt.widgets.Text; - -/** - * Play around with a set of read-only combo-boxes. - */ -@SuppressWarnings("nls") -public class DropDownListBoxModelBindingUITest - extends ApplicationWindow -{ - final TaskList taskList; - private final WritablePropertyValueModel taskListHolder; - private Text taskTextField; - - public static void main(String[] args) throws Exception { - Window window = new DropDownListBoxModelBindingUITest(args); - window.setBlockOnOpen(true); - window.open(); - Display.getCurrent().dispose(); - System.exit(0); - } - - private DropDownListBoxModelBindingUITest(@SuppressWarnings("unused") String[] args) { - super(null); - this.taskList = new TaskList(); - this.taskListHolder = new SimplePropertyValueModel(this.taskList); - this.taskList.addTask("swim"); - this.taskList.addTask("bike"); - this.taskList.addTask("run"); - Task rest = this.taskList.addTask("rest"); - this.taskList.addTask("repeat"); - this.taskList.setPriorityTask(rest); - } - - @Override - protected Control createContents(Composite parent) { - ((Shell) parent).setText(this.getClass().getSimpleName()); - parent.setSize(800, 300); - Composite mainPanel = new Composite(parent, SWT.NONE); - mainPanel.setLayout(new FormLayout()); - Control taskListPanel = this.buildTaskListPanel(mainPanel); - this.buildControlPanel(mainPanel, taskListPanel); - return mainPanel; - } - - private Control buildTaskListPanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(100, -30); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FormLayout()); - this.buildTaskListPanel_(panel); // false = native (Combo) - - return panel; - } - - private Control buildTaskListPanel_(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(50); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FormLayout()); - this.buildPrimitiveTaskListPanel(panel); - this.buildObjectTaskListPanel(panel); - - return panel; - } - - private void buildPrimitiveTaskListPanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(50); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildUnsortedPrimitiveListPanel(panel); - this.buildStandardSortedPrimitiveListPanel(panel); - this.buildCustomSortedPrimitiveListPanel(panel); - } - - private void buildObjectTaskListPanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - - FormData fd = new FormData(); - fd.top = new FormAttachment(50); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildUnsortedObjectListPanel(panel); - this.buildStandardSortedObjectListPanel(panel); - this.buildCustomSortedObjectListPanel(panel); - } - - private void buildUnsortedPrimitiveListPanel(Composite parent) { - String label = "primitive unsorted"; - this.buildComboBoxPanel(parent, label, this.buildUnsortedPrimitiveListModel(), this.buildPriorityTaskNameAdapter()); - } - - private void buildStandardSortedPrimitiveListPanel(Composite parent) { - String label = "primitive sorted"; - this.buildComboBoxPanel(parent, label, this.buildStandardSortedPrimitiveListModel(), this.buildPriorityTaskNameAdapter()); - } - - private void buildCustomSortedPrimitiveListPanel(Composite parent) { - String label = "primitive reverse sorted"; - this.buildComboBoxPanel(parent, label, this.buildCustomSortedPrimitiveListModel(), this.buildPriorityTaskNameAdapter()); - } - - private void buildUnsortedObjectListPanel(Composite parent) { - String label = "object unsorted"; - this.buildComboBoxPanel(parent, label, this.buildUnsortedObjectListModel(), this.buildPriorityTaskAdapter()); - } - - private void buildStandardSortedObjectListPanel(Composite parent) { - String label = "object sorted"; - this.buildComboBoxPanel(parent, label, this.buildStandardSortedObjectListModel(), this.buildPriorityTaskAdapter()); - } - - private void buildCustomSortedObjectListPanel(Composite parent) { - String label = "object reverse sorted"; - this.buildComboBoxPanel(parent, label, this.buildCustomSortedObjectListModel(), this.buildPriorityTaskAdapter()); - } - - private ListValueModel buildUnsortedPrimitiveListModel() { - return this.buildPrimitiveTaskListAdapter(); - } - - private ListValueModel buildStandardSortedPrimitiveListModel() { - return new SortedListValueModelWrapper(this.buildPrimitiveTaskListAdapter()); - } - - private ListValueModel buildCustomSortedPrimitiveListModel() { - return new SortedListValueModelWrapper(this.buildPrimitiveTaskListAdapter(), this.buildCustomStringComparator()); - } - - private ListValueModel buildUnsortedObjectListModel() { - return this.buildObjectTaskListAdapter(); - } - - private ListValueModel buildStandardSortedObjectListModel() { - return new SortedListValueModelWrapper(this.buildObjectTaskListAdapter()); - } - - private ListValueModel buildCustomSortedObjectListModel() { - return new SortedListValueModelWrapper(this.buildObjectTaskListAdapter(), this.buildCustomTaskComparator()); - } - - private void buildComboBoxPanel(Composite parent, String label, ListValueModel model, WritablePropertyValueModel selectedItemModel) { - Composite panel = new Composite(parent, SWT.NONE); - panel.setLayout(new FormLayout()); - - Label comboBoxLabel = new Label(panel, SWT.LEFT | SWT.VERTICAL); - comboBoxLabel.setText(label); - FormData fd = new FormData(); - fd.top = new FormAttachment(0, 3); - fd.bottom = new FormAttachment(0, 20); - fd.left = new FormAttachment(0, 5); - fd.right = new FormAttachment(100); - comboBoxLabel.setLayoutData(fd); - - Combo comboBox = this.buildComboBox(panel); - fd = new FormData(); - fd.top = new FormAttachment(comboBoxLabel); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - comboBox.setLayoutData(fd); - SWTTools.bind(model, selectedItemModel, comboBox); // use #toString() - } - - private Combo buildComboBox(Composite parent) { - return new Combo(parent, SWT.READ_ONLY); - } - - private Comparator buildCustomStringComparator() { - return new Comparator() { - public int compare(String s1, String s2) { - return s2.compareTo(s1); - } - }; - } - - private Comparator buildCustomTaskComparator() { - return new Comparator() { - public int compare(Task to1, Task to2) { - return to2.compareTo(to1); - } - }; - } - - private ListValueModel buildPrimitiveTaskListAdapter() { - return new ListAspectAdapter(this.taskListHolder, TaskList.TASK_NAMES_LIST) { - @Override - protected ListIterator listIterator_() { - return this.subject.taskNames(); - } - }; - } - - private ListValueModel buildObjectTaskListAdapter() { - return new ListAspectAdapter(this.taskListHolder, TaskList.TASKS_LIST) { - @Override - protected ListIterator listIterator_() { - return this.subject.tasks(); - } - }; - } - - private WritablePropertyValueModel buildPriorityTaskAdapter() { - return new PriorityTaskAdapter(this.taskListHolder); - } - - static class PriorityTaskAdapter - extends PropertyAspectAdapter - { - PriorityTaskAdapter(WritablePropertyValueModel taskListHolder) { - super(taskListHolder, TaskList.PRIORITY_TASK_PROPERTY); - } - @Override - protected Task buildValue_() { - return this.subject.getPriorityTask(); - } - @Override - protected void setValue_(Task value) { - this.subject.setPriorityTask(value); - } - } - - private WritablePropertyValueModel buildPriorityTaskNameAdapter() { - return new PriorityTaskNameAdapter(this.taskListHolder); - } - - static class PriorityTaskNameAdapter - extends PropertyAspectAdapter - { - PriorityTaskNameAdapter(WritablePropertyValueModel taskListHolder) { - super(taskListHolder, TaskList.PRIORITY_TASK_NAME_PROPERTY); - } - @Override - protected String buildValue_() { - return this.subject.getPriorityTaskName(); - } - @Override - protected void setValue_(String value) { - // ignore - } - } - - private void buildControlPanel(Composite parent, Control taskListPanel) { - Composite panel = new Composite(parent, SWT.NONE); - FormData fd = new FormData(); - fd.top = new FormAttachment(taskListPanel); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FormLayout()); - Control misc = this.buildMiscTaskPanel(panel); - this.buildAddRemoveTaskPanel(panel, misc); - } - - // is there a better way to associate an ACI with form data? - private Control buildMiscTaskPanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(100, -400); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildClearListACI().fill(panel); - this.buildClearModelACI().fill(panel); - this.buildRestoreModelACI().fill(panel); - this.buildChangePriorityTaskACI().fill(panel); - this.buildClearPriorityTaskACI().fill(panel); - return panel; - } - - private ActionContributionItem buildClearListACI() { - Action action = new Action("clear list", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - DropDownListBoxModelBindingUITest.this.clearTasks(); - } - }; - action.setToolTipText("clear all the tasks"); - return new ActionContributionItem(action); - } - - private ActionContributionItem buildClearModelACI() { - Action action = new Action("clear model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - DropDownListBoxModelBindingUITest.this.clearModel(); - } - }; - action.setToolTipText("clear the task list model"); - return new ActionContributionItem(action); - } - - private ActionContributionItem buildRestoreModelACI() { - Action action = new Action("restore model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - DropDownListBoxModelBindingUITest.this.restoreModel(); - } - }; - action.setToolTipText("restore the task list model"); - return new ActionContributionItem(action); - } - - private ActionContributionItem buildChangePriorityTaskACI() { - Action action = new Action("change priority", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - DropDownListBoxModelBindingUITest.this.changePriorityTask(); - } - }; - action.setToolTipText("change the priority task"); - return new ActionContributionItem(action); - } - - private ActionContributionItem buildClearPriorityTaskACI() { - Action action = new Action("clear priority", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - DropDownListBoxModelBindingUITest.this.clearPriorityTask(); - } - }; - action.setToolTipText("clear the priority task"); - return new ActionContributionItem(action); - } - - private void buildAddRemoveTaskPanel(Composite parent, Control clearButton) { - Composite panel = new Composite(parent, SWT.NONE); - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(clearButton); - panel.setLayoutData(fd); - - panel.setLayout(new FormLayout()); - Control addButton = this.buildAddButton(panel); - Control removeButton = this.buildRemoveButton(panel); - this.buildTaskTextField(panel, addButton, removeButton); - } - - // is there a better way to associate an ACI with form data? - private Control buildAddButton(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(0, 50); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildAddACI().fill(panel); - return panel; - } - - private ActionContributionItem buildAddACI() { - Action action = new Action("add", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - DropDownListBoxModelBindingUITest.this.addTask(); - } - }; - action.setToolTipText("add a task with the name in the entry field"); - return new ActionContributionItem(action); - } - - // is there a better way to associate an ACI with form data? - private Control buildRemoveButton(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(100, -50); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildRemoveACI().fill(panel); - return panel; - } - - private ActionContributionItem buildRemoveACI() { - Action action = new Action("remove", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - DropDownListBoxModelBindingUITest.this.removeTask(); - } - }; - action.setToolTipText("remove the task with the name in the entry field"); - return new ActionContributionItem(action); - } - - private void buildTaskTextField(Composite parent, Control addButton, Control removeButton) { - this.taskTextField = new Text(parent, SWT.SINGLE | SWT.BORDER); - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(addButton); - fd.right = new FormAttachment(removeButton); - this.taskTextField.setLayoutData(fd); - } - - private String taskTextFieldText() { - return this.taskTextField.getText(); - } - - void addTask() { - String taskText = this.taskTextFieldText(); - if (taskText.length() != 0) { - this.taskList.addTask(taskText); - } - } - - void removeTask() { - String task = this.taskTextFieldText(); - if (task.length() != 0) { - this.taskList.removeTask(task); - } - } - - void clearTasks() { - this.taskList.clearTasks(); - } - - void clearModel() { - this.taskListHolder.setValue(null); - } - - void restoreModel() { - this.taskListHolder.setValue(this.taskList); - } - - void changePriorityTask() { - boolean found = false; - for (Task task : this.taskList.getTasks()) { - if (this.taskList.getPriorityTask() == task) { - found = true; - } else { - if (found) { - this.taskList.setPriorityTask(task); - return; - } - } - } - Iterator tasks = this.taskList.tasks(); - if (tasks.hasNext()) { - this.taskList.setPriorityTask(tasks.next()); - } - } - - void clearPriorityTask() { - this.taskList.setPriorityTask(null); - } - - - // ********** TaskList ********** - - // note absence of validation... - public static class TaskList extends AbstractModel { - private final List taskNames = new ArrayList(); - public static final String TASK_NAMES_LIST = "taskNames"; - private final List tasks = new ArrayList(); - public static final String TASKS_LIST = "tasks"; - private String priorityTaskName = null; - public static final String PRIORITY_TASK_NAME_PROPERTY = "priorityTaskName"; - private Task priorityTask = null; - public static final String PRIORITY_TASK_PROPERTY = "priorityTask"; - public TaskList() { - super(); - } - public ListIterator taskNames() { - return this.taskNames.listIterator(); - } - public Iterable getTasks() { - return this.tasks; - } - public ListIterator tasks() { - return this.tasks.listIterator(); - } - public String getPriorityTaskName() { - return this.priorityTaskName; - } - public Task getPriorityTask() { - return this.priorityTask; - } - public Task addTask(String taskName) { - this.addItemToList(taskName, this.taskNames, TASK_NAMES_LIST); - Task task = new Task(taskName); - this.addItemToList(task, this.tasks, TASKS_LIST); - return task; - } - public void removeTask(String taskName) { - int index = this.taskNames.indexOf(taskName); - if (index != -1) { - Task task = this.tasks.get(index); - if (task == this.priorityTask) { - this.setPriorityTask(null); - } - // assume the indexes match... - this.removeItemFromList(index, this.taskNames, TASK_NAMES_LIST); - this.removeItemFromList(index, this.tasks, TASKS_LIST); - } - } - public void clearTasks() { - this.setPriorityTask(null); - this.clearList(this.taskNames, TASK_NAMES_LIST); - this.clearList(this.tasks, TASKS_LIST); - } - private void setPriorityTaskName(String priorityTaskName) { - String old = this.priorityTaskName; - this.priorityTaskName = priorityTaskName; - this.firePropertyChanged(PRIORITY_TASK_NAME_PROPERTY, old, priorityTaskName); - } - public void setPriorityTask(Task priorityTask) { - Task old = this.priorityTask; - this.priorityTask = priorityTask; - this.firePropertyChanged(PRIORITY_TASK_PROPERTY, old, priorityTask); - this.setPriorityTaskName((priorityTask == null) ? null : priorityTask.getName()); - } - } - - - // ********** Task ********** - - public static class Task extends AbstractModel implements Displayable { - private String name; - private int instanceCount; - private static int INSTANCE_COUNT = 1; - public Task(String name) { - this.name = name; - this.instanceCount = INSTANCE_COUNT++; - } - public String displayString() { - return this.name + ": " + this.instanceCount; - } - public int compareTo(Displayable o) { - return DEFAULT_COMPARATOR.compare(this, o); - } - public String getName() { - return this.name; - } - public void setName(String name) { - Object old = this.name; - this.name = name; - this.firePropertyChanged(DISPLAY_STRING_PROPERTY, old, name); - } - @Override - public String toString() { - return this.displayString(); - } - } - - public interface Displayable extends Model, Comparable { - - String displayString(); - String DISPLAY_STRING_PROPERTY = "displayString"; - - - // ********** helper implementations ********** - - Collator DEFAULT_COLLATOR = Collator.getInstance(); - - Comparator DEFAULT_COMPARATOR = - new Comparator() { - public int compare(Displayable d1, Displayable d2) { - // disallow duplicates based on object identity - if (d1 == d2) { - return 0; - } - - // first compare display strings using the default collator - int result = DEFAULT_COLLATOR.compare(d1.displayString(), d2.displayString()); - if (result != 0) { - return result; - } - - // then compare using object-id - result = System.identityHashCode(d1) - System.identityHashCode(d2); - if (result != 0) { - return result; - } - - // It's unlikely that we get to this point; but, just in case, we will return -1. - // Unfortunately, this introduces some mild unpredictability to the sort order - // (unless the objects are always passed into this method in the same order). - return -1; // if all else fails, indicate that o1 < o2 - } - @Override - public String toString() { - return "Displayable.DEFAULT_COMPARATOR"; - } - }; - - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/ListBoxModelBindingUITest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/ListBoxModelBindingUITest.java deleted file mode 100644 index 1cb0d57c62..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/ListBoxModelBindingUITest.java +++ /dev/null @@ -1,626 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.utility.swt; - -import java.text.Collator; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Comparator; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.window.ApplicationWindow; -import org.eclipse.jface.window.Window; -import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelWrapper; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.WritableCollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormLayout; -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; -import org.eclipse.swt.widgets.Text; - -/** - * Play around with a set of list boxes. - */ -@SuppressWarnings("nls") -public class ListBoxModelBindingUITest - extends ApplicationWindow -{ - final TaskList taskList; - private final WritablePropertyValueModel taskListHolder; - private Text taskTextField; - - public static void main(String[] args) throws Exception { - Window window = new ListBoxModelBindingUITest(args); - window.setBlockOnOpen(true); - window.open(); - Display.getCurrent().dispose(); - System.exit(0); - } - - private ListBoxModelBindingUITest(@SuppressWarnings("unused") String[] args) { - super(null); - this.taskList = new TaskList(); - this.taskListHolder = new SimplePropertyValueModel(this.taskList); - this.taskList.addTask("swim"); - this.taskList.addTask("bike"); - this.taskList.addTask("run"); - Task rest = this.taskList.addTask("rest"); - this.taskList.addPriorityTask(rest); - Task repeat = this.taskList.addTask("repeat"); - this.taskList.addPriorityTask(repeat); - } - - @Override - protected Control createContents(Composite parent) { - ((Shell) parent).setText(this.getClass().getSimpleName()); - parent.setSize(800, 400); - Composite mainPanel = new Composite(parent, SWT.NONE); - mainPanel.setLayout(new FormLayout()); - Control taskListPanel = this.buildTaskListPanel(mainPanel); - this.buildControlPanel(mainPanel, taskListPanel); - return mainPanel; - } - - private Control buildTaskListPanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(100, -30); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FormLayout()); - this.buildPrimitiveTaskListPanel(panel); - this.buildObjectTaskListPanel(panel); - - return panel; - } - - private void buildPrimitiveTaskListPanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(50); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildUnsortedPrimitiveListPanel(panel); - this.buildStandardSortedPrimitiveListPanel(panel); - this.buildCustomSortedPrimitiveListPanel(panel); - } - - private void buildObjectTaskListPanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - - FormData fd = new FormData(); - fd.top = new FormAttachment(50); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildUnsortedObjectListPanel(panel); - this.buildStandardSortedObjectListPanel(panel); - this.buildCustomSortedObjectListPanel(panel); - } - - private void buildUnsortedPrimitiveListPanel(Composite parent) { - this.buildListPanel(parent, "primitive unsorted", this.buildUnsortedPrimitiveListModel(), new SimpleCollectionValueModel()); - } - - private void buildStandardSortedPrimitiveListPanel(Composite parent) { - this.buildListPanel(parent, "primitive sorted", this.buildStandardSortedPrimitiveListModel(), new SimpleCollectionValueModel()); - } - - private void buildCustomSortedPrimitiveListPanel(Composite parent) { - this.buildListPanel(parent, "primitive reverse sorted", this.buildCustomSortedPrimitiveListModel(), new SimpleCollectionValueModel()); - } - - private void buildUnsortedObjectListPanel(Composite parent) { - this.buildListPanel(parent, "object unsorted", this.buildUnsortedObjectListModel(), this.buildPriorityTaskListAdapter()); - } - - private void buildStandardSortedObjectListPanel(Composite parent) { - this.buildListPanel(parent, "object sorted", this.buildStandardSortedObjectListModel(), this.buildPriorityTaskListAdapter()); - } - - private void buildCustomSortedObjectListPanel(Composite parent) { - this.buildListPanel(parent, "object reverse sorted", this.buildCustomSortedObjectListModel(), this.buildPriorityTaskListAdapter()); - } - - private ListValueModel buildUnsortedPrimitiveListModel() { - return this.buildPrimitiveTaskListAdapter(); - } - - private ListValueModel buildStandardSortedPrimitiveListModel() { - return new SortedListValueModelWrapper(this.buildPrimitiveTaskListAdapter()); - } - - private ListValueModel buildCustomSortedPrimitiveListModel() { - return new SortedListValueModelWrapper(this.buildPrimitiveTaskListAdapter(), this.buildCustomStringComparator()); - } - - private ListValueModel buildUnsortedObjectListModel() { - return this.buildObjectTaskListAdapter(); - } - - private ListValueModel buildStandardSortedObjectListModel() { - return new SortedListValueModelWrapper(this.buildObjectTaskListAdapter()); - } - - private ListValueModel buildCustomSortedObjectListModel() { - return new SortedListValueModelWrapper(this.buildObjectTaskListAdapter(), this.buildCustomTaskComparator()); - } - - private org.eclipse.swt.widgets.List buildListPanel(Composite parent, String label, ListValueModel model, WritableCollectionValueModel selectedItemsModel) { - Composite panel = new Composite(parent, SWT.NONE); - panel.setLayout(new FormLayout()); - - Label listLabel = new Label(panel, SWT.LEFT | SWT.VERTICAL); - listLabel.setText(label); - FormData fd = new FormData(); - fd.top = new FormAttachment(0, 3); - fd.bottom = new FormAttachment(0, 20); - fd.left = new FormAttachment(0, 5); - fd.right = new FormAttachment(100); - listLabel.setLayoutData(fd); - - org.eclipse.swt.widgets.List listBox = new org.eclipse.swt.widgets.List(panel, SWT.MULTI | SWT.BORDER); - fd = new FormData(); - fd.top = new FormAttachment(listLabel); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - listBox.setLayoutData(fd); - SWTTools.bind(model, selectedItemsModel, listBox); // use #toString() - return listBox; - } - - private Comparator buildCustomStringComparator() { - return new Comparator() { - public int compare(String s1, String s2) { - return s2.compareTo(s1); - } - }; - } - - private Comparator buildCustomTaskComparator() { - return new Comparator() { - public int compare(Task to1, Task to2) { - return to2.compareTo(to1); - } - }; - } - - private ListValueModel buildPrimitiveTaskListAdapter() { - return new ListAspectAdapter(this.taskListHolder, TaskList.TASK_NAMES_LIST) { - @Override - protected ListIterator listIterator_() { - return this.subject.taskNames(); - } - }; - } - - private ListValueModel buildObjectTaskListAdapter() { - return new ListAspectAdapter(this.taskListHolder, TaskList.TASKS_LIST) { - @Override - protected ListIterator listIterator_() { - return this.subject.tasks(); - } - }; - } - - private WritableCollectionValueModel buildPriorityTaskListAdapter() { - return new PriorityTaskListAdapter(this.taskListHolder); - } - - static class PriorityTaskListAdapter - extends CollectionAspectAdapter - implements WritableCollectionValueModel - { - PriorityTaskListAdapter(WritablePropertyValueModel taskListHolder) { - super(taskListHolder, TaskList.PRIORITY_TASKS_COLLECTION); - } - @Override - protected Iterator iterator_() { - return this.subject.priorityTasks(); - } - public void setValues(Iterable values) { - this.subject.setPriorityTasks(values); - } - } - - private void buildControlPanel(Composite parent, Control taskListPanel) { - Composite panel = new Composite(parent, SWT.NONE); - FormData fd = new FormData(); - fd.top = new FormAttachment(taskListPanel); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FormLayout()); - Control misc = this.buildMiscTaskPanel(panel); - this.buildAddRemoveTaskPanel(panel, misc); - } - - // is there a better way to associate an ACI with form data? - private Control buildMiscTaskPanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(100, -400); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildClearListACI().fill(panel); - this.buildClearModelACI().fill(panel); - this.buildRestoreModelACI().fill(panel); - this.buildAddPriorityTaskACI().fill(panel); - this.buildRemovePriorityTaskACI().fill(panel); - this.buildClearPriorityTasksACI().fill(panel); - return panel; - } - - private ActionContributionItem buildClearListACI() { - Action action = new Action("clear list", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - ListBoxModelBindingUITest.this.clearTasks(); - } - }; - action.setToolTipText("clear all the tasks"); - return new ActionContributionItem(action); - } - - private ActionContributionItem buildClearModelACI() { - Action action = new Action("clear model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - ListBoxModelBindingUITest.this.clearModel(); - } - }; - action.setToolTipText("clear the task list model"); - return new ActionContributionItem(action); - } - - private ActionContributionItem buildRestoreModelACI() { - Action action = new Action("restore model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - ListBoxModelBindingUITest.this.restoreModel(); - } - }; - action.setToolTipText("restore the task list model"); - return new ActionContributionItem(action); - } - - private ActionContributionItem buildAddPriorityTaskACI() { - Action action = new Action("add priority", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - ListBoxModelBindingUITest.this.addPriorityTask(); - } - }; - action.setToolTipText("add a task to the priority tasks"); - return new ActionContributionItem(action); - } - - private ActionContributionItem buildRemovePriorityTaskACI() { - Action action = new Action("remove priority", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - ListBoxModelBindingUITest.this.removePriorityTask(); - } - }; - action.setToolTipText("remove a task from the priority tasks"); - return new ActionContributionItem(action); - } - - private ActionContributionItem buildClearPriorityTasksACI() { - Action action = new Action("clear priority", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - ListBoxModelBindingUITest.this.clearPriorityTasks(); - } - }; - action.setToolTipText("clear the priority tasks"); - return new ActionContributionItem(action); - } - - private void buildAddRemoveTaskPanel(Composite parent, Control clearButton) { - Composite panel = new Composite(parent, SWT.NONE); - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(clearButton); - panel.setLayoutData(fd); - - panel.setLayout(new FormLayout()); - Control addButton = this.buildAddButton(panel); - Control removeButton = this.buildRemoveButton(panel); - this.buildTaskTextField(panel, addButton, removeButton); - } - - // is there a better way to associate an ACI with form data? - private Control buildAddButton(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(0, 50); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildAddACI().fill(panel); - return panel; - } - - private ActionContributionItem buildAddACI() { - Action action = new Action("add", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - ListBoxModelBindingUITest.this.addTask(); - } - }; - action.setToolTipText("add a task with the name in the entry field"); - return new ActionContributionItem(action); - } - - // is there a better way to associate an ACI with form data? - private Control buildRemoveButton(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(100, -50); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildRemoveACI().fill(panel); - return panel; - } - - private ActionContributionItem buildRemoveACI() { - Action action = new Action("remove", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - ListBoxModelBindingUITest.this.removeTask(); - } - }; - action.setToolTipText("remove the task with the name in the entry field"); - return new ActionContributionItem(action); - } - - private void buildTaskTextField(Composite parent, Control addButton, Control removeButton) { - this.taskTextField = new Text(parent, SWT.SINGLE | SWT.BORDER); - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(addButton); - fd.right = new FormAttachment(removeButton); - this.taskTextField.setLayoutData(fd); - } - - private String taskTextFieldText() { - return this.taskTextField.getText(); - } - - void addTask() { - String taskText = this.taskTextFieldText(); - if (taskText.length() != 0) { - this.taskList.addTask(taskText); - } - } - - void removeTask() { - String task = this.taskTextFieldText(); - if (task.length() != 0) { - this.taskList.removeTask(task); - } - } - - void clearTasks() { - this.taskList.clearTasks(); - } - - void clearModel() { - this.taskListHolder.setValue(null); - } - - void restoreModel() { - this.taskListHolder.setValue(this.taskList); - } - - void addPriorityTask() { - Iterator tasks = this.taskList.tasks(); - while (tasks.hasNext()) { - if (this.taskList.addPriorityTask(tasks.next())) { - return; - } - } - } - - void removePriorityTask() { - Iterator pTasks = this.taskList.priorityTasks(); - if (pTasks.hasNext()) { - this.taskList.removePriorityTask(pTasks.next()); - } - } - - void clearPriorityTasks() { - this.taskList.clearPriorityTasks(); - } - - - // ********** TaskList ********** - - // note absence of validation... - public static class TaskList extends AbstractModel { - private final List taskNames = new ArrayList(); - public static final String TASK_NAMES_LIST = "taskNames"; - private final List tasks = new ArrayList(); - public static final String TASKS_LIST = "tasks"; - private final Collection priorityTasks = new HashSet(); - public static final String PRIORITY_TASKS_COLLECTION = "priorityTasks"; - public TaskList() { - super(); - } - public ListIterator taskNames() { - return this.taskNames.listIterator(); - } - public ListIterator tasks() { - return this.tasks.listIterator(); - } - public Iterator priorityTasks() { - return this.priorityTasks.iterator(); - } - public Task addTask(String taskName) { - this.addItemToList(taskName, this.taskNames, TASK_NAMES_LIST); - Task task = new Task(taskName); - this.addItemToList(task, this.tasks, TASKS_LIST); - return task; - } - public void removeTask(String taskName) { - int index = this.taskNames.indexOf(taskName); - if (index != -1) { - this.removeItemFromList(index, this.taskNames, TASK_NAMES_LIST); - // assume the indexes match... - Task removedTask = this.removeItemFromList(index, this.tasks, TASKS_LIST); - this.removeItemFromCollection(removedTask, this.priorityTasks, PRIORITY_TASKS_COLLECTION); - } - } - public void clearTasks() { - this.clearCollection(this.priorityTasks, PRIORITY_TASKS_COLLECTION); - this.clearList(this.taskNames, TASK_NAMES_LIST); - this.clearList(this.tasks, TASKS_LIST); - } - public boolean addPriorityTask(Task task) { - return this.addItemToCollection(task, this.priorityTasks, PRIORITY_TASKS_COLLECTION); - } - public void removePriorityTask(Task task) { - this.removeItemFromCollection(task, this.priorityTasks, PRIORITY_TASKS_COLLECTION); - } - public void clearPriorityTasks() { - this.clearCollection(this.priorityTasks, PRIORITY_TASKS_COLLECTION); - } - public void setPriorityTasks(Iterable tasks) { - this.priorityTasks.clear(); - CollectionTools.addAll(this.priorityTasks, tasks); - this.fireCollectionChanged(PRIORITY_TASKS_COLLECTION, this.priorityTasks); - } - } - - - // ********** Task ********** - - public static class Task extends AbstractModel implements Displayable { - private String name; - private int instanceCount; - private static int INSTANCE_COUNT = 1; - public Task(String name) { - this.name = name; - this.instanceCount = INSTANCE_COUNT++; - } - public String displayString() { - return this.name + ": " + this.instanceCount; - } - public int compareTo(Displayable o) { - return DEFAULT_COMPARATOR.compare(this, o); - } - public String getName() { - return this.name; - } - public void setName(String name) { - Object old = this.name; - this.name = name; - this.firePropertyChanged(DISPLAY_STRING_PROPERTY, old, name); - } - @Override - public String toString() { - return this.displayString(); - } - } - - public interface Displayable extends Model, Comparable { - - String displayString(); - String DISPLAY_STRING_PROPERTY = "displayString"; - - - // ********** helper implementations ********** - - Collator DEFAULT_COLLATOR = Collator.getInstance(); - - Comparator DEFAULT_COMPARATOR = - new Comparator() { - public int compare(Displayable d1, Displayable d2) { - // disallow duplicates based on object identity - if (d1 == d2) { - return 0; - } - - // first compare display strings using the default collator - int result = DEFAULT_COLLATOR.compare(d1.displayString(), d2.displayString()); - if (result != 0) { - return result; - } - - // then compare using object-id - result = System.identityHashCode(d1) - System.identityHashCode(d2); - if (result != 0) { - return result; - } - - // It's unlikely that we get to this point; but, just in case, we will return -1. - // Unfortunately, this introduces some mild unpredictability to the sort order - // (unless the objects are always passed into this method in the same order). - return -1; // if all else fails, indicate that o1 < o2 - } - @Override - public String toString() { - return "Displayable.DEFAULT_COMPARATOR"; - } - }; - - } -} diff --git a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/TextFieldModelBindingUITest.java b/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/TextFieldModelBindingUITest.java deleted file mode 100644 index 5bd6f16dd2..0000000000 --- a/common/tests/org.eclipse.jpt.common.ui.tests/src/org/eclipse/jpt/common/ui/tests/internal/utility/swt/TextFieldModelBindingUITest.java +++ /dev/null @@ -1,252 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.ui.tests.internal.utility.swt; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.window.ApplicationWindow; -import org.eclipse.jface.window.Window; -import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.FillLayout; -import org.eclipse.swt.layout.FormAttachment; -import org.eclipse.swt.layout.FormData; -import org.eclipse.swt.layout.FormLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -/** - * Play around with a set of entry fields. - */ -@SuppressWarnings("nls") -public class TextFieldModelBindingUITest - extends ApplicationWindow -{ - private final TestModel testModel; - private static final String DEFAULT_NAME = "Scooby Doo"; - private final WritablePropertyValueModel testModelHolder; - private final WritablePropertyValueModel nameHolder; - private final WritablePropertyValueModel allCapsNameHolder; - - - public static void main(String[] args) throws Exception { - Window window = new TextFieldModelBindingUITest(); - window.setBlockOnOpen(true); - window.open(); - Display.getCurrent().dispose(); - System.exit(0); - } - - private TextFieldModelBindingUITest() { - super(null); - this.testModel = new TestModel(DEFAULT_NAME); - this.testModelHolder = new SimplePropertyValueModel(this.testModel); - this.nameHolder = this.buildNameHolder(this.testModelHolder); - this.allCapsNameHolder = this.buildAllCapsNameHolder(this.testModelHolder); - } - - private WritablePropertyValueModel buildNameHolder(PropertyValueModel vm) { - return new PropertyAspectAdapter(vm, TestModel.NAME_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.name(); - } - @Override - protected void setValue_(String value) { - this.subject.setName(value); - } - }; - } - - private WritablePropertyValueModel buildAllCapsNameHolder(PropertyValueModel vm) { - return new PropertyAspectAdapter(vm, TestModel.NAME_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.name().toUpperCase(); - } - @Override - protected void setValue_(String value) { - // do nothing - } - }; - } - - @Override - protected Control createContents(Composite parent) { - ((Shell) parent).setText(this.getClass().getSimpleName()); - parent.setSize(400, 100); - Composite mainPanel = new Composite(parent, SWT.NONE); - mainPanel.setLayout(new FormLayout()); - Control textFieldPanel = this.buildTextFieldPanel(mainPanel); - this.buildControlPanel(mainPanel, textFieldPanel); - return mainPanel; - } - - private Control buildTextFieldPanel(Composite parent) { - Composite panel = new Composite(parent, SWT.NONE); - - FormData fd = new FormData(); - fd.top = new FormAttachment(0); - fd.bottom = new FormAttachment(100, -35); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildNameTextField(panel); - this.buildReadOnlyNameTextField(panel); - this.buildAllCapsNameTextField(panel); - - return panel; - } - - private void buildNameTextField(Composite parent) { - Text textField = new Text(parent, SWT.SINGLE); - SWTTools.bind(this.nameHolder, textField); - } - - private void buildReadOnlyNameTextField(Composite parent) { - Text textField = new Text(parent, SWT.SINGLE); - textField.setEnabled(false); - SWTTools.bind(this.nameHolder, textField); - } - - private void buildAllCapsNameTextField(Composite parent) { - Text textField = new Text(parent, SWT.SINGLE); - textField.setEnabled(false); - SWTTools.bind(this.allCapsNameHolder, textField); - } - - private void buildControlPanel(Composite parent, Control checkBoxPanel) { - Composite panel = new Composite(parent, SWT.NONE); - FormData fd = new FormData(); - fd.top = new FormAttachment(checkBoxPanel); - fd.bottom = new FormAttachment(100); - fd.left = new FormAttachment(0); - fd.right = new FormAttachment(100); - panel.setLayoutData(fd); - - panel.setLayout(new FillLayout()); - this.buildResetNameButton(panel); - this.buildClearModelButton(panel); - this.buildRestoreModelButton(panel); - this.buildPrintModelButton(panel); - } - - private void buildResetNameButton(Composite parent) { - this.buildResetNameACI().fill(parent); - } - - private ActionContributionItem buildResetNameACI() { - Action action = new Action("reset name", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - TextFieldModelBindingUITest.this.resetName(); - } - }; - action.setToolTipText("reset name"); - return new ActionContributionItem(action); - } - - void resetName() { - this.testModel.setName(DEFAULT_NAME); - } - - private void buildClearModelButton(Composite parent) { - this.buildClearModelACI().fill(parent); - } - - private ActionContributionItem buildClearModelACI() { - Action action = new Action("clear model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - TextFieldModelBindingUITest.this.clearModel(); - } - }; - action.setToolTipText("clear model"); - return new ActionContributionItem(action); - } - - void clearModel() { - this.testModelHolder.setValue(null); - } - - private void buildRestoreModelButton(Composite parent) { - this.buildRestoreModelACI().fill(parent); - } - - private ActionContributionItem buildRestoreModelACI() { - Action action = new Action("restore model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - TextFieldModelBindingUITest.this.restoreModel(); - } - }; - action.setToolTipText("restore model"); - return new ActionContributionItem(action); - } - - void restoreModel() { - this.testModelHolder.setValue(this.testModel); - } - - private void buildPrintModelButton(Composite parent) { - this.buildPrintModelACI().fill(parent); - } - - private ActionContributionItem buildPrintModelACI() { - Action action = new Action("print model", IAction.AS_PUSH_BUTTON) { - @Override - public void run() { - TextFieldModelBindingUITest.this.printModel(); - } - }; - action.setToolTipText("print model"); - return new ActionContributionItem(action); - } - - void printModel() { - System.out.println("name: " + this.testModel.name()); - } - - - // ********** model class ********** - - class TestModel extends AbstractModel { - private String name; - public static final String NAME_PROPERTY = "name"; - - public TestModel(String name) { - this.name = name; - } - public String name() { - return this.name; - } - public void setName(String name) { - Object old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - @Override - public String toString() { - return "TestModel(" + this.name + ")"; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/.classpath b/common/tests/org.eclipse.jpt.common.utility.tests/.classpath deleted file mode 100644 index ef8d91ca94..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/.classpath +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/.cvsignore b/common/tests/org.eclipse.jpt.common.utility.tests/.cvsignore deleted file mode 100644 index c4ba612bad..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -bin -@dot -temp.folder -build.xml -javaCompiler...args \ No newline at end of file diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/.project b/common/tests/org.eclipse.jpt.common.utility.tests/.project deleted file mode 100644 index 898e230aaf..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.jpt.common.utility.tests - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/.settings/org.eclipse.core.resources.prefs b/common/tests/org.eclipse.jpt.common.utility.tests/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index f68f9c2597..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Tue Jan 15 11:12:26 EST 2008 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/.settings/org.eclipse.jdt.core.prefs b/common/tests/org.eclipse.jpt.common.utility.tests/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 84b5c4c710..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Sun May 27 14:55:58 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/common/tests/org.eclipse.jpt.common.utility.tests/META-INF/MANIFEST.MF b/common/tests/org.eclipse.jpt.common.utility.tests/META-INF/MANIFEST.MF deleted file mode 100644 index c3c05fb8ac..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/META-INF/MANIFEST.MF +++ /dev/null @@ -1,21 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.common.utility.tests -Bundle-Version: 2.0.0.qualifier -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)", - org.junit;bundle-version="3.8.0" -Export-Package: org.eclipse.jpt.common.utility.tests.internal;x-internal:=true, - org.eclipse.jpt.common.utility.tests.internal.enumerations;x-internal:=true, - org.eclipse.jpt.common.utility.tests.internal.iterables;x-internal:=true, - org.eclipse.jpt.common.utility.tests.internal.iterators;x-internal:=true, - org.eclipse.jpt.common.utility.tests.internal.model;x-internal:=true, - org.eclipse.jpt.common.utility.tests.internal.model.listener;x-internal:=true, - org.eclipse.jpt.common.utility.tests.internal.model.value;x-internal:=true, - org.eclipse.jpt.common.utility.tests.internal.model.value.prefs;x-internal:=true, - org.eclipse.jpt.common.utility.tests.internal.model.value.swing;x-internal:=true, - org.eclipse.jpt.common.utility.tests.internal.node;x-internal:=true, - org.eclipse.jpt.common.utility.tests.internal.synchronizers;x-internal:=true diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/about.html b/common/tests/org.eclipse.jpt.common.utility.tests/about.html deleted file mode 100644 index be534ba44f..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/about.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

May 02, 2008

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- - - diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/build.properties b/common/tests/org.eclipse.jpt.common.utility.tests/build.properties deleted file mode 100644 index ebe9c08ef9..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/build.properties +++ /dev/null @@ -1,16 +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 -################################################################################ -source.. = src/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - about.html,\ - test.xml,\ - plugin.properties diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/plugin.properties b/common/tests/org.eclipse.jpt.common.utility.tests/plugin.properties deleted file mode 100644 index 8ea447bc75..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/plugin.properties +++ /dev/null @@ -1,24 +0,0 @@ -################################################################################ -# Copyright (c) 2006, 2009 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ -# ==================================================================== -# 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 = Dali Java Persistence Tools - Common Utility Tests -providerName = Eclipse Web Tools Platform - diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/resource/ClassTools.java b/common/tests/org.eclipse.jpt.common.utility.tests/resource/ClassTools.java deleted file mode 100644 index aac17b6044..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/resource/ClassTools.java +++ /dev/null @@ -1,1680 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package test; - -import java.lang.reflect.Constructor; -import java.lang.reflect.Field; -import java.lang.reflect.InvocationTargetException; -import java.lang.reflect.Method; -import java.lang.reflect.Modifier; -import java.util.Collections; -import java.util.Stack; - -/** - * Convenience methods related to the java.lang.reflect package. - * These methods provide shortcuts for manipulating objects via - * reflection; particularly when dealing with fields and/or methods that - * are not publicly accessible or are inherited. - * - * In most cases, all the exceptions are handled and - * wrapped in java.lang.RuntimeExceptions; so these methods should - * be used when you are confident that you will not having any problems - * using reflection. - * - * There are also a number of methods whose names - * begin with "attempt". These methods will throw a NoSuchMethodException - * or NoSuchFieldException when appropriate, allowing you to probe - * for methods that should be present but might not. - */ -public final class ClassTools { - - public static final Class[] ZERO_PARAMETER_TYPES = new Class[0]; - public static final Object[] ZERO_PARAMETERS = new Object[0]; - private static final String CR = StringTools.CR; - - public static final char NESTED_CLASS_NAME_SEPARATOR = '$'; - - public static final char ARRAY_INDICATOR = '['; - public static final char TYPE_DECLARATION_ARRAY_OPEN = '['; - public static final char TYPE_DECLARATION_ARRAY_CLOSE = ']'; - - public static final char REFERENCE_CLASS_CODE = 'L'; - public static final char REFERENCE_CLASS_NAME_DELIMITER = ';'; - - private static Primitive[] PRIMITIVES; // pseudo-'final' - lazy-initialized - public static final char BYTE_CODE = 'B'; - public static final char CHAR_CODE = 'C'; - public static final char DOUBLE_CODE = 'D'; - public static final char FLOAT_CODE = 'F'; - public static final char INT_CODE = 'I'; - public static final char LONG_CODE = 'J'; - public static final char SHORT_CODE = 'S'; - public static final char BOOLEAN_CODE = 'Z'; - public static final char VOID_CODE = 'V'; - private static int MAX_PRIMITIVE_CLASS_NAME_LENGTH = -1; // pseudo-'final' - lazy-initialized - private static int MAX_PRIMITIVE_WRAPPER_CLASS_NAME_LENGTH = -1; // pseudo-'final' - lazy-initialized - - public static final String VOID_CLASS_NAME = void.class.getName(); - public static final String VOID_WRAPPER_CLASS_NAME = java.lang.Void.class.getName(); - - - /** - * Return all the fields for the - * specified class, including inherited fields. - * Class#allFields() - */ - @Deprecated - public static Field[] allFields(Class javaClass) { - Stack stack = new Stack(); - for (Class tempClass = javaClass; tempClass != null; tempClass = tempClass.getSuperclass()) { - pushDeclaredFields(tempClass, stack); - } - Collections.reverse(stack); - return stack.toArray(new Field[stack.size()]); - } - - /** - * Return all the methods for the - * specified class, including inherited methods. - * Class#allMethods() - */ - public static Method[] allMethods(Class javaClass) { - Stack stack = new Stack(); - for (Class tempClass = javaClass; tempClass != null; tempClass = tempClass.getSuperclass()) { - pushDeclaredMethods(tempClass, stack); - } - Collections.reverse(stack); - return stack.toArray(new Method[stack.size()]); - } - - /** - * Convenience method. - * Return a new instance of the specified class, - * using the class's default (zero-argument) constructor. - * Throw an exception if the default constructor is not defined. - * Class#newInstance() throws NoSuchMethodException - */ - @Deprecated - public static T attemptNewInstance(Class javaClass) throws NoSuchMethodException { - return attemptNewInstance(javaClass, ZERO_PARAMETER_TYPES, ZERO_PARAMETERS); - } - - /** - * Return a new instance of the specified class, - * given the constructor parameter types and parameters. - * Throw an exception if the constructor is not defined. - * Class#newInstance(Class[] parameterTypes, Object[] parameters) throws NoSuchMethodException - */ - public static T attemptNewInstance(Class javaClass, Class[] parameterTypes, Object[] parameters) throws NoSuchMethodException { - try { - return constructor(javaClass, parameterTypes).newInstance(parameters); - } catch (InstantiationException ie) { - throw new RuntimeException(ie + CR + fullyQualifiedConstructorSignature(javaClass, parameterTypes), ie); - } catch (IllegalAccessException iae) { - throw new RuntimeException(iae + CR + fullyQualifiedConstructorSignature(javaClass, parameterTypes), iae); - } catch (InvocationTargetException ite) { - throw new RuntimeException(fullyQualifiedConstructorSignature(javaClass, parameterTypes) + CR + ite.getTargetException(), ite); - } - } - - /** - * Convenience method. - * Return a new instance of the specified class, - * given the constructor parameter type and parameter. - * Throw an exception if the constructor is not defined. - * Class#newInstance(Class parameterType, Object parameter) throws NoSuchMethodException - */ - public static T attemptNewInstance(Class javaClass, Class parameterType, Object parameter) throws NoSuchMethodException { - return attemptNewInstance(javaClass, new Class[] {parameterType}, new Object[] {parameter}); - } - - /** - * Attempt to get a field value, given the containing object and field name. - * Return its result. - * Useful for accessing private, package, or protected fields. - * Throw an exception if the field is not defined. - * Object#getFieldValue(String fieldName) throws NoSuchFieldException - */ - public static Object attemptToGetFieldValue(Object object, String fieldName) throws NoSuchFieldException { - try { - return field(object, fieldName).get(object); - } catch (IllegalAccessException iae) { - throw new RuntimeException(iae + CR + fullyQualifiedFieldName(object, fieldName), iae); - } - } - - /** - * Attempt to get a static field value, given the containing object and field name. - * Return its result. - * Useful for accessing private, package, or protected fields. - * Throw an exception if the field is not defined. - * Class#getStaticFieldValue(String fieldName) throws NoSuchFieldException - */ - public static Object attemptToGetStaticFieldValue(Class javaClass, String fieldName) throws NoSuchFieldException { - try { - return field(javaClass, fieldName).get(null); - } catch (IllegalAccessException iae) { - throw new RuntimeException(iae + CR + fullyQualifiedFieldName(javaClass, fieldName), iae); - } - } - - /** - * Convenience method. - * Attempt to execute a zero-argument method, - * given the receiver and method name. - * Return its result. - * Throw an exception if the method is not found. - * Useful for invoking private, package, or protected methods. - * Object#execute(String methodName) throws NoSuchMethodException - */ - public static Object attemptToExecuteMethod(Object receiver, String methodName) throws NoSuchMethodException { - return attemptToExecuteMethod(receiver, methodName, ZERO_PARAMETER_TYPES, ZERO_PARAMETERS); - } - - /** - * Convenience method. - * Attempt to execute a method, given the receiver, - * method name, parameter type, and parameter. - * Return its result. - * Throw an exception if the method is not found. - * Useful for invoking private, package, or protected methods. - * Object#execute(String methodName, Class parameterType, Object parameter) throws NoSuchMethodException - */ - public static Object attemptToExecuteMethod(Object receiver, String methodName, Class parameterType, Object parameter) throws NoSuchMethodException { - return attemptToExecuteMethod(receiver, methodName, new Class[] {parameterType}, new Object[] {parameter}); - } - - /** - * Attempt to execute a method, given the receiver, - * method name, parameter types, and parameters. - * Return its result. - * Throw an exception if the method is not found. - * Useful for invoking private, package, or protected methods. - * Object#execute(String methodName, Class[] parameterTypes, Object[] parameters) throws NoSuchMethodException - */ - public static Object attemptToExecuteMethod(Object receiver, String methodName, Class[] parameterTypes, Object[] parameters) throws NoSuchMethodException { - return executeMethod(method(receiver, methodName, parameterTypes), receiver, parameters); - } - - /** - * Attempt to execute a method, given the receiver, - * method name, parameter types, and parameters. - * Return its result. - * Throw an exception if the method is not found. - * If the executed method throws an exception, rethrow that exception. - * Useful for invoking private, package, or protected methods. - * Object#execute(String methodName, Class[] parameterTypes, Object[] parameters) throws NoSuchMethodException - */ - public static Object attemptToExecuteMethodWithException(Object receiver, String methodName, Class[] parameterTypes, Object[] parameters) - throws Throwable, NoSuchMethodException - { - return executeMethodWithException(method(receiver, methodName, parameterTypes), receiver, parameters); - } - - /** - * Convenience method. - * Attempt to execute a zero-argument static method, - * given the class and method name. - * Return its result. - * Throw an exception if the method is not found. - * Useful for invoking private, package, or protected methods. - * Class#executeStaticMethod(String methodName) throws NoSuchMethodException - */ - public static Object attemptToExecuteStaticMethod(Class javaClass, String methodName) throws NoSuchMethodException { - return attemptToExecuteStaticMethod(javaClass, methodName, ZERO_PARAMETER_TYPES, ZERO_PARAMETERS); - } - - /** - * Attempt to execute a static method, given the class, - * method name, parameter types, and parameters. - * Return its result. - * Throw an exception if the method is not found. - * Useful for invoking private, package, or protected methods. - * Class#executeStaticMethod(String methodName, Class[] parameterTypes, Object[] parameters) throws NoSuchMethodException - */ - public static Object attemptToExecuteStaticMethod(Class javaClass, String methodName, Class[] parameterTypes, Object[] parameters) throws NoSuchMethodException { - return executeStaticMethod(staticMethod(javaClass, methodName, parameterTypes), parameters); - } - - /** - * Convenience method. - * Attempt to execute a static method, given the class, - * method name, parameter type, and parameter. - * Return its result. - * Throw an exception if the method is not found. - * Useful for invoking private, package, or protected methods. - * Class#executeStaticMethod(String methodName, Class parameterType, Object parameter) throws NoSuchMethodException - */ - public static Object attemptToExecuteStaticMethod(Class javaClass, String methodName, Class parameterType, Object parameter) throws NoSuchMethodException { - return attemptToExecuteStaticMethod(javaClass, methodName, new Class[] {parameterType}, new Object[] {parameter}); - } - - /** - * Attempt to set a field value, given the - * containing object, field name, and new field value. - * Useful for accessing private, package, or protected fields. - * Throw an exception if the field is not defined. - * Object#setFieldValue(String fieldName, Object fieldValue) throws NoSuchFieldException - */ - public static void attemptToSetFieldValue(Object object, String fieldName, Object fieldValue) throws NoSuchFieldException { - try { - field(object, fieldName).set(object, fieldValue); - } catch (IllegalAccessException iae) { - throw new RuntimeException(iae + CR + fullyQualifiedFieldName(object, fieldName), iae); - } - } - - /** - * Attempt to set a static field value, given the - * containing class, field name, and new field value. - * Useful for accessing private, package, or protected fields. - * Throw an exception if the field is not defined. - * Class#setStaticFieldValue(String fieldName, Object fieldValue) throws NoSuchFieldException - */ - public static void attemptToSetStaticFieldValue(Class javaClass, String fieldName, Object fieldValue) throws NoSuchFieldException { - try { - field(javaClass, fieldName).set(null, fieldValue); - } catch (IllegalAccessException iae) { - throw new RuntimeException(iae + CR + fullyQualifiedFieldName(javaClass, fieldName), iae); - } - } - - /** - * Convenience method. - * Return the default (zero-argument) constructor - * for the specified class. - * Set accessible to true, so we can access - * private/package/protected constructors. - * Class#constructor() throws NoSuchMethodException - */ - public static Constructor constructor(Class javaClass) throws NoSuchMethodException { - return constructor(javaClass, ZERO_PARAMETER_TYPES); - } - - /** - * Return the constructor for the specified class - * and formal parameter types. - * Set accessible to true, so we can access - * private/package/protected constructors. - * Class#constructor(Class[] parameterTypes) throws NoSuchMethodException - */ - public static Constructor constructor(Class javaClass, Class[] parameterTypes) throws NoSuchMethodException { - Constructor constructor = javaClass.getDeclaredConstructor(parameterTypes); - constructor.setAccessible(true); - return constructor; - } - - /** - * Convenience method. - * Return the constructor for the specified class - * and formal parameter type. - * Set accessible to true, so we can access - * private/package/protected constructors. - * Class#constructor(Class parameterType) throws NoSuchMethodException - */ - public static Constructor constructor(Class javaClass, Class parameterType) throws NoSuchMethodException { - return constructor(javaClass, new Class[] {parameterType}); - } - - /** - * Return the declared fields for the specified class. - * Set accessible to true, so we can access - * private/package/protected fields. - * Class#accessibleDeclaredFields() - */ - public static Field[] declaredFields(Class javaClass) { - Field[] fields = javaClass.getDeclaredFields(); - for (Field field : fields) { - field.setAccessible(true); - } - return fields; - } - - /** - * Return the declared methods for the - * specified class. - * Set accessible to true, so we can access - * private/package/protected methods. - * Class#accessibleDeclaredMethods() - */ - public static Method[] declaredMethods(Class javaClass) { - Method[] methods = javaClass.getDeclaredMethods(); - for (Method method : methods) { - method.setAccessible(true); - } - return methods; - } - - /** - * Return the default (zero-argument) constructor - * for the specified class. - * Set accessible to true, so we can access - * private/package/protected constructors. - * Class#defaultConstructor() - */ - public static Constructor defaultConstructor(Class javaClass) throws NoSuchMethodException { - return constructor(javaClass); - } - - /** - * Return a field for the specified class and field name. - * If the class does not directly - * define the field, look for it in the class's superclasses. - * Set accessible to true, so we can access - * private/package/protected fields. - */ - public static Field field(Class javaClass, String fieldName) throws NoSuchFieldException { - Field field = null; - try { - field = javaClass.getDeclaredField(fieldName); - } catch (NoSuchFieldException ex) { - Class superclass = javaClass.getSuperclass(); - if (superclass == null) { - throw ex; - } - // recurse - return field(superclass, fieldName); - } - field.setAccessible(true); - return field; - } - - /** - * Convenience method. - * Return a field for the specified object and field name. - * If the object's class does not directly - * define the field, look for it in the class's superclasses. - * Set accessible to true, so we can access - * private/package/protected fields. - */ - public static Field field(Object object, String fieldName) throws NoSuchFieldException { - return field(object.getClass(), fieldName); - } - - /* - * Return a string representation of the specified constructor. - */ - private static String fullyQualifiedConstructorSignature(Class javaClass, Class[] parameterTypes) { - return fullyQualifiedMethodSignature(javaClass, null, parameterTypes); - } - - /* - * Return a string representation of the specified field. - */ - private static String fullyQualifiedFieldName(Class javaClass, String fieldName) { - StringBuilder sb = new StringBuilder(200); - sb.append(javaClass.getName()); - sb.append('.'); - sb.append(fieldName); - return sb.toString(); - } - - /* - * Return a string representation of the specified field. - */ - private static String fullyQualifiedFieldName(Object object, String fieldName) { - return fullyQualifiedFieldName(object.getClass(), fieldName); - } - - /* - * Return a string representation of the specified method. - */ - private static String fullyQualifiedMethodSignature(Class javaClass, String methodName, Class[] parameterTypes) { - StringBuilder sb = new StringBuilder(200); - sb.append(javaClass.getName()); - // this check allows us to use this code for constructors, where the methodName is null - if (methodName != null) { - sb.append('.'); - sb.append(methodName); - } - sb.append('('); - int max = parameterTypes.length - 1; - if (max != -1) { - // stop one short of the end of the array - for (int i = 0; i < max; i++) { - sb.append(parameterTypes[i].getName()); - sb.append(", "); - } - sb.append(parameterTypes[max].getName()); - } - sb.append(')'); - return sb.toString(); - } - - /* - * Return a string representation of the specified method. - */ - private static String fullyQualifiedMethodSignature(Object receiver, String methodName, Class[] parameterTypes) { - return fullyQualifiedMethodSignature(receiver.getClass(), methodName, parameterTypes); - } - - /** - * Get a field value, given the containing object and field name. - * Return its result. - * Useful for accessing private, package, or protected fields. - * Object#getFieldValue(String fieldName) - */ - public static Object fieldValue(Object object, String fieldName) { - try { - return attemptToGetFieldValue(object, fieldName); - } catch (NoSuchFieldException nsfe) { - throw new RuntimeException(nsfe + CR + fullyQualifiedFieldName(object, fieldName), nsfe); - } - } - - /** - * Get a static field value, given the containing class and field name. - * Return its result. - * Useful for accessing private, package, or protected fields. - * Class#getStaticFieldValue(String fieldName) - */ - public static Object staticFieldValue(Class javaClass, String fieldName) { - try { - return attemptToGetStaticFieldValue(javaClass, fieldName); - } catch (NoSuchFieldException nsfe) { - throw new RuntimeException(nsfe + CR + fullyQualifiedFieldName(javaClass, fieldName), nsfe); - } - } - - /** - * Convenience method. - * Execute a zero-argument method, given the receiver and method name. - * Return its result. - * Useful for invoking private, package, or protected methods. - * Object#execute(String methodName) - */ - public static Object executeMethod(Object receiver, String methodName) { - return executeMethod(receiver, methodName, ZERO_PARAMETER_TYPES, ZERO_PARAMETERS); - } - - /** - * Execute a method, given the receiver, - * method name, parameter types, and parameters. - * Return its result. - * Useful for invoking private, package, or protected methods. - * Object#execute(String methodName, Class[] parameterTypes, Object[] parameters) - */ - public static Object executeMethod(Object receiver, String methodName, Class[] parameterTypes, Object[] parameters) { - try { - return attemptToExecuteMethod(receiver, methodName, parameterTypes, parameters); - } catch (NoSuchMethodException nsme) { - throw new RuntimeException(nsme + CR + fullyQualifiedMethodSignature(receiver, methodName, parameterTypes), nsme); - } - } - - /** - * Convenience method. - * Execute a one-argument method, given the receiver, - * method name, parameter type, and parameter. - * Return its result. - * Useful for invoking private, package, or protected methods. - * Object#execute(String methodName, Class parameterType, Object parameter) - */ - public static Object executeMethod(Object receiver, String methodName, Class parameterType, Object parameter) { - return executeMethod(receiver, methodName, new Class[] {parameterType}, new Object[] {parameter}); - } - - /** - * Convenience method. - * Execute a zero-argument method, given the receiver and method name. - * Return its result. - * If the method throws an exception, rethrow that exception. - * Useful for invoking private, package, or protected methods. - * Object#execute(String methodName) - */ - public static Object executeMethodWithException(Object receiver, String methodName) - throws Throwable - { - return executeMethodWithException(receiver, methodName, ZERO_PARAMETER_TYPES, ZERO_PARAMETERS); - } - - /** - * Convenience method. - * Execute a one-argument method, given the receiver, - * method name, parameter type, and parameter. - * Return its result. - * If the method throws an exception, rethrow that exception. - * Useful for invoking private, package, or protected methods. - * Object#execute(String methodName, Class parameterType, Object parameter) - */ - public static Object executeMethodWithException(Object receiver, String methodName, Class parameterType, Object parameter) - throws Throwable - { - return executeMethodWithException(receiver, methodName, new Class[] {parameterType}, new Object[] {parameter}); - } - - /** - * Execute a method, given the receiver, - * method name, parameter types, and parameters. - * Return its result. - * If the method throws an exception, rethrow that exception. - * Useful for invoking private, package, or protected methods. - * Object#execute(String methodName, Class[] parameterTypes, Object[] parameters) - */ - public static Object executeMethodWithException(Object receiver, String methodName, Class[] parameterTypes, Object[] parameters) - throws Throwable - { - try { - return attemptToExecuteMethodWithException(receiver, methodName, parameterTypes, parameters); - } catch (NoSuchMethodException nsme) { - throw new RuntimeException(nsme + CR + fullyQualifiedMethodSignature(receiver, methodName, parameterTypes), nsme); - } - } - - /** - * Execute the specified method with the specified parameters. - * Return its result. - * Convert exceptions to RuntimeExceptions. - */ - public static Object executeMethod(Method method, Object receiver, Object[] parameters) { - try { - return method.invoke(receiver, parameters); - } catch (IllegalAccessException iae) { - throw new RuntimeException(iae + CR + method, iae); - } catch (InvocationTargetException ite) { - throw new RuntimeException(method + CR + ite.getTargetException(), ite); - } - } - - /** - * Execute the specified method with the specified parameters. - * Return its result. - * If the method throws an exception, rethrow that exception. - * Convert all other exceptions to RuntimeExceptions. - */ - public static Object executeMethodWithException(Method method, Object receiver, Object[] parameters) - throws Throwable - { - try { - return method.invoke(receiver, parameters); - } catch (IllegalAccessException iae) { - throw new RuntimeException(iae + CR + method, iae); - } catch (InvocationTargetException ite) { - Throwable cause = ite.getCause(); - if (cause == null) { - throw new RuntimeException(method.toString(), ite); - } - throw cause; - } - } - - /** - * Convenience method. - * Execute a zero-argument static method, - * given the class and method name. - * Return its result. - * Useful for invoking private, package, or protected methods. - * Class#executeStaticMethod(String methodName) - */ - public static Object executeStaticMethod(Class javaClass, String methodName) { - return executeStaticMethod(javaClass, methodName, ZERO_PARAMETER_TYPES, ZERO_PARAMETERS); - } - - /** - * Execute a static method, given the class, - * method name, parameter types, and parameters. - * Return its result. - * Useful for invoking private, package, or protected methods. - * Class#executeStaticMethod(String methodName, Class[] parameterTypes, Object[] parameters) - */ - public static Object executeStaticMethod(Class javaClass, String methodName, Class[] parameterTypes, Object[] parameters) { - try { - return attemptToExecuteStaticMethod(javaClass, methodName, parameterTypes, parameters); - } catch (NoSuchMethodException nsme) { - throw new RuntimeException(nsme + CR + fullyQualifiedMethodSignature(javaClass, methodName, parameterTypes), nsme); - } - } - - /** - * Convenience method. - * Execute a static method, given the class, - * method name, parameter type, and parameter. - * Return its result. - * Useful for invoking private, package, or protected methods. - * Class#executeStaticMethod(String methodName, Class parameterType, Object parameter) - */ - public static Object executeStaticMethod(Class javaClass, String methodName, Class parameterType, Object parameter) { - return executeStaticMethod(javaClass, methodName, new Class[] {parameterType}, new Object[] {parameter}); - } - - /** - * Execute the specified static method with the specified parameters. - * Return its result. - * Convert exceptions to RuntimeExceptions. - */ - public static Object executeStaticMethod(Method method, Object[] parameters) { - return executeMethod(method, null, parameters); - } - - /** - * Convenience method. - * Return a zero-argument method for the specified class - * and method name. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Set accessible to true, so we can access - * private/package/protected methods. - */ - public static Method method(Class javaClass, String methodName) throws NoSuchMethodException { - return method(javaClass, methodName, ZERO_PARAMETER_TYPES); - } - - /** - * Return a method for the specified class, method name, - * and formal parameter types. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Set accessible to true, so we can access - * private/package/protected methods. - */ - public static Method method(Class javaClass, String methodName, Class[] parameterTypes) throws NoSuchMethodException { - Method method = null; - try { - method = javaClass.getDeclaredMethod(methodName, parameterTypes); - } catch (NoSuchMethodException ex) { - Class superclass = javaClass.getSuperclass(); - if (superclass == null) { - throw ex; - } - // recurse - return method(superclass, methodName, parameterTypes); - } - method.setAccessible(true); - return method; - } - - /** - * Convenience method. - * Return a method for the specified class, method name, - * and formal parameter type. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Set accessible to true, so we can access - * private/package/protected methods. - */ - public static Method method(Class javaClass, String methodName, Class parameterType) throws NoSuchMethodException { - return method(javaClass, methodName, new Class[] {parameterType}); - } - - /** - * Convenience method. - * Return a zero-argument method for the specified object - * and method name. If the object's class does not directly - * implement the method, look for it in the class's superclasses. - * Set accessible to true, so we can access - * private/package/protected methods. - */ - public static Method method(Object object, String methodName) throws NoSuchMethodException { - return method(object.getClass(), methodName); - } - - /** - * Convenience method. - * Return a method for the specified object, method name, - * and formal parameter types. If the object's class does not directly - * implement the method, look for it in the class's superclasses. - * Set accessible to true, so we can access - * private/package/protected methods. - */ - public static Method method(Object object, String methodName, Class[] parameterTypes) throws NoSuchMethodException { - return method(object.getClass(), methodName, parameterTypes); - } - - /** - * Convenience method. - * Return a method for the specified object, method name, - * and formal parameter type. If the object's class does not directly - * implement the method, look for it in the class's superclasses. - * Set accessible to true, so we can access - * private/package/protected methods. - */ - public static Method method(Object object, String methodName, Class parameterType) throws NoSuchMethodException { - return method(object.getClass(), methodName, parameterType); - } - - /** - * Convenience method. - * Return the specified class (without the checked exception). - */ - public static Class classForName(String className) { - try { - return Class.forName(className); - } catch (ClassNotFoundException ex) { - throw new RuntimeException(className, ex); - } - } - - /** - * Convenience method. - * Return a new instance of the specified class, - * using the class's default (zero-argument) constructor. - * Class#newInstance() - */ - public static T newInstance(Class javaClass) { - return newInstance(javaClass, ZERO_PARAMETER_TYPES, ZERO_PARAMETERS); - } - - /** - * Convenience method. - * Return a new instance of the specified class, - * using the class's default (zero-argument) constructor. - * Class#newInstance() - */ - public static Object newInstance(String className) throws ClassNotFoundException { - return newInstance(className, null); - } - - /** - * Convenience method. - * Return a new instance of the specified class, - * using the class's default (zero-argument) constructor. - * Class#newInstance() - */ - public static Object newInstance(String className, ClassLoader classLoader) throws ClassNotFoundException { - return newInstance(Class.forName(className, true, classLoader)); - } - - /** - * Return a new instance of the specified class, - * given the constructor parameter types and parameters. - * Class#newInstance(Class[] parameterTypes, Object[] parameters) - */ - public static T newInstance(Class javaClass, Class[] parameterTypes, Object[] parameters) { - try { - return attemptNewInstance(javaClass, parameterTypes, parameters); - } catch (NoSuchMethodException nsme) { - throw new RuntimeException(nsme + CR + fullyQualifiedConstructorSignature(javaClass, parameterTypes), nsme); - } - } - - /** - * Return a new instance of the specified class, - * given the constructor parameter types and parameters. - * Class#newInstance(Class[] parameterTypes, Object[] parameters) - */ - public static Object newInstance(String className, Class[] parameterTypes, Object[] parameters) throws ClassNotFoundException { - return newInstance(className, parameterTypes, parameters, null); - } - - /** - * Return a new instance of the specified class, - * given the constructor parameter types and parameters. - * Class#newInstance(Class[] parameterTypes, Object[] parameters) - */ - public static Object newInstance(String className, Class[] parameterTypes, Object[] parameters, ClassLoader classLoader) throws ClassNotFoundException { - return newInstance(Class.forName(className, true, classLoader), parameterTypes, parameters); - } - - /** - * Convenience method. - * Return a new instance of the specified class, - * given the constructor parameter type and parameter. - * Class#newInstance(Class parameterType, Object parameter) - */ - public static T newInstance(Class javaClass, Class parameterType, Object parameter) { - return newInstance(javaClass, new Class[] {parameterType}, new Object[] {parameter}); - } - - /** - * Return a new instance of the specified class, - * given the constructor parameter type and parameter. - * Class#newInstance(Class parameterType, Object parameter) - */ - public static Object newInstance(String className, Class parameterType, Object parameter) throws ClassNotFoundException { - return newInstance(className, parameterType, parameter, null); - } - - /** - * Return a new instance of the specified class, - * given the constructor parameter type and parameter. - * Class#newInstance(Class parameterType, Object parameter) - */ - public static Object newInstance(String className, Class parameterType, Object parameter, ClassLoader classLoader) throws ClassNotFoundException { - return newInstance(Class.forName(className, false, classLoader), parameterType, parameter); - } - - /* - * Push the declared fields for the specified class - * onto the top of the stack. - */ - private static void pushDeclaredFields(Class javaClass, Stack stack) { - Field[] fields = declaredFields(javaClass); - for (int i = fields.length; i-- > 0; ) { - stack.push(fields[i]); - } - } - - /* - * Push the declared methods for the specified class - * onto the top of the stack. - */ - private static void pushDeclaredMethods(Class javaClass, Stack stack) { - Method[] methods = declaredMethods(javaClass); - for (int i = methods.length; i-- > 0; ) { - stack.push(methods[i]); - } - } - - /** - * Set a field value, given the containing object, field name, and new field value. - * Useful for accessing private, package, or protected fields. - * Object#setFieldValue(String fieldName, Object fieldValue) - */ - public static void setFieldValue(Object object, String fieldName, Object fieldValue) { - try { - attemptToSetFieldValue(object, fieldName, fieldValue); - } catch (NoSuchFieldException nsfe) { - throw new RuntimeException(nsfe + CR + fullyQualifiedFieldName(object, fieldName), nsfe); - } - } - - /** - * Set a static field value, given the containing class, field name, and new field value. - * Useful for accessing private, package, or protected fields. - * Class#setStaticFieldValue(String fieldName, Object fieldValue) - */ - public static void setStaticFieldValue(Class javaClass, String fieldName, Object fieldValue) { - try { - attemptToSetStaticFieldValue(javaClass, fieldName, fieldValue); - } catch (NoSuchFieldException nsfe) { - throw new RuntimeException(nsfe + CR + fullyQualifiedFieldName(javaClass, fieldName), nsfe); - } - } - - /** - * Return the short name of the object's class. - * Class#getShortName() - */ - public static String shortClassNameForObject(Object object) { - return shortNameFor(object.getClass()); - } - - /** - * Return the short name of the class (e.g. "Object"). - * Class#getShortName() - */ - public static String shortNameForClassNamed(String className) { - return className.substring(className.lastIndexOf('.') + 1); - } - - /** - * Return the short name of the class (e.g. "Object"). - * Class#getShortName() - */ - public static String shortNameFor(Class javaClass) { - return shortNameForClassNamed(javaClass.getName()); - } - - /** - * Return the nested name of the object's class. - * Class#getNestedName() - */ - public static String nestedClassNameForObject(Object object) { - return nestedNameFor(object.getClass()); - } - - /** - * Return the nested name of the class (e.g. "Entry"). - * Class#getNestedName() - */ - public static String nestedNameForClassNamed(String className) { - return className.substring(className.lastIndexOf(NESTED_CLASS_NAME_SEPARATOR) + 1); - } - - /** - * Return the nested name of the class (e.g. "Entry"). - * Class#getNestedName() - */ - public static String nestedNameFor(Class javaClass) { - return nestedNameForClassNamed(javaClass.getName()); - } - - /** - * Return the "toString()" name of the object's class. - */ - public static String toStringClassNameForObject(Object object) { - return toStringNameFor(object.getClass()); - } - - /** - * Return the "toString()" name of the class. - * "Member" classes will return only the final name: - * "com.foo.bar.TopLevelClass$MemberClass$NestedMemberClass" - * => "NestedMemberClass" - * "Local" and "anonymous" classes will still return the embedded '$'s: - * "com.foo.bar.TopLevelClass$1LocalClass" - * => "TopLevelClass$1LocalClass" - * "com.foo.bar.TopLevelClass$1" - * => "TopLevelClass$1" - */ - public static String toStringNameForClassNamed(String className) { - return classNamedIsMember(className) ? - className.substring(className.lastIndexOf(NESTED_CLASS_NAME_SEPARATOR) + 1) - : - className.substring(className.lastIndexOf('.') + 1); - } - - /** - * Return the "toString()" name of the class. - */ - public static String toStringNameFor(Class javaClass) { - return toStringNameForClassNamed(javaClass.getName()); - } - - /** - * Return the package name of the class (e.g. "java.lang"). - * Class#getPackageName() - */ - public static String packageNameFor(Class javaClass) { - return packageNameForClassNamed(javaClass.getName()); - } - - /** - * Return the package name of the class (e.g. "java.lang"). - * Class#getPackageName() - */ - public static String packageNameForClassNamed(String className) { - int lastPeriod = className.lastIndexOf('.'); - if (lastPeriod == -1) { - return ""; - } - return className.substring(0, lastPeriod); - } - - /** - * Return the short name of the class, - * followed by its package name (e.g. "Object (java.lang)"). - * Class#getShortNameWithPackage() - */ - public static String shortNameWithPackage(Class javaClass) { - StringBuilder sb = new StringBuilder(200); - sb.append(shortNameFor(javaClass)); - if ( ! javaClass.isPrimitive()) { - sb.append(" ("); - sb.append(packageNameFor(javaClass)); - sb.append(')'); - } - return sb.toString(); - } - - /** - * Convenience method. - * Return a zero-argument, static method for the specified class - * and method name. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Set accessible to true, so we can access - * private/package/protected methods. - */ - public static Method staticMethod(Class javaClass, String methodName) throws NoSuchMethodException { - return staticMethod(javaClass, methodName, ZERO_PARAMETER_TYPES); - } - - /** - * Return a static method for the specified class, method name, - * and formal parameter types. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Set accessible to true, so we can access - * private/package/protected methods. - */ - public static Method staticMethod(Class javaClass, String methodName, Class[] parameterTypes) throws NoSuchMethodException { - Method method = method(javaClass, methodName, parameterTypes); - if (Modifier.isStatic(method.getModifiers())) { - return method; - } - throw new NoSuchMethodException(fullyQualifiedMethodSignature(javaClass, methodName, parameterTypes)); - } - - /** - * Convenience method. - * Return a static method for the specified class, method name, - * and formal parameter type. If the class does not directly - * implement the method, look for it in the class's superclasses. - * Set accessible to true, so we can access - * private/package/protected methods. - */ - public static Method staticMethod(Class javaClass, String methodName, Class parameterTypes) throws NoSuchMethodException { - return staticMethod(javaClass, methodName, new Class[] {parameterTypes}); - } - - /** - * Return whether the specified class can be "declared" in code; - * i.e. it is either a "top-level" class or a "member" class, but it - * is not an "array" class. This method rolls together all the checks - * from the other methods for a bit of a performance tweak. - * Class#isDeclarable() - */ - public static boolean classNamedIsDeclarable(String className) { - if (className.charAt(0) == ARRAY_INDICATOR) { - return false; // it is an "array" class - } - int index = className.indexOf(NESTED_CLASS_NAME_SEPARATOR); - if (index == -1) { - return true; // it is a "top-level" class - } - do { - // the character immediately after each dollar sign cannot be a digit - index++; - if (Character.isDigit(className.charAt(index))) { - return false; - } - index = className.indexOf(NESTED_CLASS_NAME_SEPARATOR, index); - } while (index != -1); - return true; - } - - /** - * Return whether the specified class is a "top-level" class, - * as opposed to a "member", "local", or "anonymous" class, - * using the standard jdk naming conventions (i.e. the class - * name does NOT contain a '$': "TopLevelClass"). - * Class#isTopLevel() - */ - public static boolean classNamedIsTopLevel(String className) { - if (classNamedIsArray(className)) { - return false; - } - return className.indexOf(NESTED_CLASS_NAME_SEPARATOR) == -1; - } - - /** - * Return whether the specified class is a "member" class, - * as opposed to a "top-level", "local", or "anonymous" class, - * using the standard jdk naming conventions (i.e. the class - * name contains at least one '$' and all the names between - * each '$' are legal class names: - * "TopLevelClass$MemberClass$NestedMemberClass"). - * Class#isMember() - */ - public static boolean classNamedIsMember(String className) { - if (classNamedIsArray(className)) { - return false; - } - int index = className.indexOf(NESTED_CLASS_NAME_SEPARATOR); - if (index == -1) { - return false; // it is a "top-level" class - } - do { - // the character immediately after each dollar sign cannot be a digit - index++; - if (Character.isDigit(className.charAt(index))) { - return false; - } - index = className.indexOf(NESTED_CLASS_NAME_SEPARATOR, index); - } while (index != -1); - return true; - } - - /** - * Return whether the specified class is a "local" class, - * as opposed to a "top-level", "member", or "anonymous" class, - * using the standard jdk (or Eclipse) naming conventions. - * In the jdk, the class name ends with '$nnnXXX' where the '$' is - * followed by a series of numeric digits which are followed by the - * local class name: "TopLevelClass$1LocalClass". - * In Eclipse, the class name ends with '$nnn$XXX' where the '$' is - * followed by a series of numeric digits which are separated from - * the local class name by another '$': "TopLevelClass$1$LocalClass". - * Class#isLocal() - */ - public static boolean classNamedIsLocal(String className) { - if (classNamedIsArray(className)) { - return false; - } - int dollar = className.indexOf(NESTED_CLASS_NAME_SEPARATOR); - if (dollar == -1) { - return false; - } - if ( ! Character.isDigit(className.charAt(dollar + 1))) { - return false; - } - int len = className.length(); - for (int i = dollar + 2; i < len; i++) { - if (Character.isJavaIdentifierStart(className.charAt(i))) { - return true; - } - } - // all the characters past the $ are digits (anonymous) - return false; - } - - /** - * Return whether the specified class is an "anonymous" class, - * as opposed to a "top-level", "member", or "local" class, - * using the standard jdk naming conventions (i.e. the class - * name ends with '$nnn' where all the characters past the - * last '$' are numeric digits: "TopLevelClass$1"). - * Class#isAnonymous() - */ - public static boolean classNamedIsAnonymous(String className) { - if (classNamedIsArray(className)) { - return false; - } - int dollar = className.indexOf(NESTED_CLASS_NAME_SEPARATOR); - if (dollar == -1) { - return false; - } - int start = dollar + 1; - for (int i = className.length(); i-- > start; ) { - if ( ! Character.isDigit(className.charAt(i))) { - return false; - } - } - // all the characters past the $ are digits - return true; - } - - /** - * Return the "array depth" of the specified class. - * The depth is the number of dimensions for an array type. - * Non-array types have a depth of zero. - * Class#getArrayDepth() - */ - public static int arrayDepthFor(Class javaClass) { - int depth = 0; - while (javaClass.isArray()) { - depth++; - javaClass = javaClass.getComponentType(); - } - return depth; - } - - /** - * Return the "array depth" of the specified object. - * The depth is the number of dimensions for an array. - * Non-arrays have a depth of zero. - */ - public static int arrayDepthForObject(Object object) { - return arrayDepthFor(object.getClass()); - } - - /** - * Return the "array depth" of the specified class. - * The depth is the number of dimensions for an array type. - * Non-array types have a depth of zero. - * @see java.lang.Class#getName() - * Class#getArrayDepth() - */ - public static int arrayDepthForClassNamed(String className) { - int depth = 0; - while (className.charAt(depth) == ARRAY_INDICATOR) { - depth++; - } - return depth; - } - - /** - * Return whether the specified class is an array type. - * @see java.lang.Class#getName() - */ - public static boolean classNamedIsArray(String className) { - return className.charAt(0) == ARRAY_INDICATOR; - } - - /** - * Return the "element type" of the specified class. - * The element type is the base type held by an array type. - * A non-array type simply returns itself. - * Class#getElementType() - */ - public static Class elementTypeFor(Class javaClass) { - while (javaClass.isArray()) { - javaClass = javaClass.getComponentType(); - } - return javaClass; - } - - /** - * Return the "element type" of the specified object. - * The element type is the base type held by an array. - * A non-array simply returns its class. - */ - public static Class elementTypeForObject(Object object) { - return elementTypeFor(object.getClass()); - } - - /** - * Return the "element type" of the specified class. - * The element type is the base type held by an array type. - * Non-array types simply return themselves. - * Class#getElementType() - */ - public static String elementTypeNameFor(Class javaClass) { - return elementTypeFor(javaClass).getName(); - } - - /** - * Return the "element type" of the specified class. - * The element type is the base type held by an array type. - * Non-array types simply return themselves. - * @see java.lang.Class#getName() - * Class#getElementType() - */ - public static String elementTypeNameForClassNamed(String className) { - int depth = arrayDepthForClassNamed(className); - if (depth == 0) { - // the name is in the form: "java.lang.Object" or "int" - return className; - } - int last = className.length() - 1; - if (className.charAt(depth) == REFERENCE_CLASS_CODE) { - // the name is in the form: "[[[Ljava.lang.Object;" - return className.substring(depth + 1, last); // drop the trailing ';' - } - // the name is in the form: "[[[I" - return classNameForCode(className.charAt(last)); - } - - /** - * Return whether the specified class is a "reference" - * class (i.e. neither 'void' nor one of the primitive variable classes, - * ['boolean', 'int', 'float', etc.]). - * NB: void.class.isPrimitive() == true - */ - public static boolean classNamedIsReference(String className) { - return ! classNamedIsPrimitive(className); - } - - /** - * Return whether the specified class is a primitive - * class (i.e. 'void' or one of the primitive variable classes, - * ['boolean', 'int', 'float', etc.]). - * NB: void.class.isPrimitive() == true - */ - public static boolean classNamedIsPrimitive(String className) { - if (classNamedIsArray(className) || (className.length() > maxPrimitiveClassNameLength())) { - return false; // performance tweak - } - Primitive[] codes = primitives(); - for (int i = codes.length; i-- > 0; ) { - if (codes[i].javaClass.getName().equals(className)) { - return true; - } - } - return false; - } - - /** - * Return whether the specified class is a "variable" primitive - * class (i.e. 'boolean', 'int', 'float', etc., but not 'void'). - * NB: void.class.isPrimitive() == true - */ - public static boolean classNamedIsVariablePrimitive(String className) { - return classNamedIsPrimitive(className) - && ( ! className.equals(VOID_CLASS_NAME)); - } - - /** - * Return whether the specified class is a primitive wrapper - * class (i.e. 'java.lang.Void' or one of the primitive variable wrapper classes, - * ['java.lang.Boolean', 'java.lang.Integer', 'java.lang.Float', etc.]). - * NB: void.class.isPrimitive() == true - */ - public static boolean classNamedIsPrimitiveWrapperClass(String className) { - if (classNamedIsArray(className) || (className.length() > maxPrimitiveWrapperClassNameLength())) { - return false; // performance tweak - } - Primitive[] codes = primitives(); - for (int i = codes.length; i-- > 0; ) { - if (codes[i].wrapperClass.getName().equals(className)) { - return true; - } - } - return false; - } - - /** - * Return whether the specified class is a "variable" primitive - * class (i.e. 'boolean', 'int', 'float', etc., but not 'void'). - * NB: void.class.isPrimitive() == true - */ - public static boolean classNamedIsVariablePrimitiveWrapperClass(String className) { - return classNamedIsPrimitiveWrapperClass(className) - && ( ! className.equals(VOID_WRAPPER_CLASS_NAME)); - } - - /** - * Return whether the specified class is a primitive wrapper - * class (i.e. 'java.lang.Void' or one of the primitive variable wrapper classes, - * ['java.lang.Boolean', 'java.lang.Integer', 'java.lang.Float', etc.]). - * NB: void.class.isPrimitive() == true - */ - public static boolean classIsPrimitiveWrapperClass(Class javaClass) { - if (javaClass.isArray() || (javaClass.getName().length() > maxPrimitiveWrapperClassNameLength())) { - return false; // performance tweak - } - Primitive[] codes = primitives(); - for (int i = codes.length; i-- > 0; ) { - if (codes[i].wrapperClass == javaClass) { - return true; - } - } - return false; - } - - /** - * Return whether the specified class is a "variable" primitive - * class (i.e. 'boolean', 'int', 'float', etc., but not 'void'). - * NB: void.class.isPrimitive() == true - */ - public static boolean classIsVariablePrimitiveWrapperClass(Class javaClass) { - return classIsPrimitiveWrapperClass(javaClass) - && (javaClass != java.lang.Void.class); - } - - /** - * Return the class name for the specified class code. - * @see java.lang.Class#getName() - */ - public static String classNameForCode(char classCode) { - return classForCode(classCode).getName(); - } - - /** - * Return the class name for the specified class code. - * @see java.lang.Class#getName() - */ - public static String classNameForCode(int classCode) { - return classNameForCode((char) classCode); - } - - /** - * Return the class for the specified class code. - * @see java.lang.Class#getName() - */ - public static Class classForCode(char classCode) { - Primitive[] codes = primitives(); - for (int i = codes.length; i-- > 0; ) { - if (codes[i].code == classCode) { - return codes[i].javaClass; - } - } - throw new IllegalArgumentException(String.valueOf(classCode)); - } - - /** - * Return the class for the specified class code. - * @see java.lang.Class#getName() - */ - public static Class classForCode(int classCode) { - return classForCode((char) classCode); - } - - /** - * Return the class code for the specified class. - * @see java.lang.Class#getName() - */ - public static char codeForClass(Class javaClass) { - if (( ! javaClass.isArray()) && (javaClass.getName().length() <= maxPrimitiveClassNameLength())) { - Primitive[] codes = primitives(); - for (int i = codes.length; i-- > 0; ) { - if (codes[i].javaClass == javaClass) { - return codes[i].code; - } - } - } - throw new IllegalArgumentException(javaClass.getName()); - } - - /** - * Return the class code for the specified class. - * @see java.lang.Class#getName() - */ - public static char codeForClassNamed(String className) { - if (( ! classNamedIsArray(className)) && (className.length() <= maxPrimitiveClassNameLength())) { - Primitive[] codes = primitives(); - for (int i = codes.length; i-- > 0; ) { - if (codes[i].javaClass.getName().equals(className)) { - return codes[i].code; - } - } - } - throw new IllegalArgumentException(className); - } - - /** - * Return the class for the specified "type declaration". - */ - public static Class classForTypeDeclaration(String typeDeclaration) throws ClassNotFoundException { - return classForTypeDeclaration(typeDeclaration, ClassTools.class.getClassLoader()); - } - - /** - * Return the class for the specified "type declaration", - * using the specified class loader. - */ - public static Class classForTypeDeclaration(String typeDeclaration, ClassLoader classLoader) throws ClassNotFoundException { - TypeDeclaration td = typeDeclaration(typeDeclaration); - return classForTypeDeclaration(td.elementTypeName, td.arrayDepth); - } - - private static TypeDeclaration typeDeclaration(String typeDeclaration) { - typeDeclaration = StringTools.removeAllWhitespace(typeDeclaration); - int arrayDepth = arrayDepthForTypeDeclaration_(typeDeclaration); - String elementTypeName = typeDeclaration.substring(0, typeDeclaration.length() - (arrayDepth * 2)); - return new TypeDeclaration(elementTypeName, arrayDepth); - } - - /** - * Return the class for the specified "type declaration". - */ - public static Class classForTypeDeclaration(String elementTypeName, int arrayDepth) throws ClassNotFoundException { - return classForTypeDeclaration(elementTypeName, arrayDepth, null); - } - - /** - * Return the class for the specified "type declaration", - * using the specified class loader. - */ - // see the "Evaluation" of jdk bug 6446627 for a discussion of loading classes - public static Class classForTypeDeclaration(String elementTypeName, int arrayDepth, ClassLoader classLoader) throws ClassNotFoundException { - // primitives cannot be loaded via Class#forName(), - // so check for a primitive class name first - Primitive pcc = null; - if (elementTypeName.length() <= maxPrimitiveClassNameLength()) { // performance tweak - Primitive[] codes = primitives(); - for (int i = codes.length; i-- > 0; ) { - if (codes[i].javaClass.getName().equals(elementTypeName)) { - pcc = codes[i]; - break; - } - } - } - - // non-array - if (arrayDepth == 0) { - return (pcc == null) ? Class.forName(elementTypeName, false, classLoader) : pcc.javaClass; - } - - // array - StringBuilder sb = new StringBuilder(100); - for (int i = arrayDepth; i-- > 0; ) { - sb.append(ARRAY_INDICATOR); - } - if (pcc == null) { - sb.append(REFERENCE_CLASS_CODE); - sb.append(elementTypeName); - sb.append(REFERENCE_CLASS_NAME_DELIMITER); - } else { - sb.append(pcc.code); - } - return Class.forName(sb.toString(), false, classLoader); - } - - /** - * Return the class name for the specified "type declaration"; e.g. - * "int[]" -> "[I" - * @see java.lang.Class#getName() - */ - public static String classNameForTypeDeclaration(String typeDeclaration) { - TypeDeclaration td = typeDeclaration(typeDeclaration); - return classNameForTypeDeclaration(td.elementTypeName, td.arrayDepth); - } - - /** - * Return the array depth for the specified "type declaration"; e.g. - * "int[]" -> 1 - */ - public static int arrayDepthForTypeDeclaration(String typeDeclaration) { - return arrayDepthForTypeDeclaration_(StringTools.removeAllWhitespace(typeDeclaration)); - } - - /* - * Assume no whitespace in the type declaration. - */ - private static int arrayDepthForTypeDeclaration_(String typeDeclaration) { - int last = typeDeclaration.length() - 1; - int depth = 0; - int close = last; - while (typeDeclaration.charAt(close) == TYPE_DECLARATION_ARRAY_CLOSE) { - if (typeDeclaration.charAt(close - 1) == TYPE_DECLARATION_ARRAY_OPEN) { - depth++; - } else { - throw new IllegalArgumentException("invalid type declaration: " + typeDeclaration); - } - close = last - (depth * 2); - } - return depth; - } - - /** - * Return the class name for the specified "type declaration". - * @see java.lang.Class#getName() - */ - public static String classNameForTypeDeclaration(String elementTypeName, int arrayDepth) { - // non-array - if (arrayDepth == 0) { - return elementTypeName; - } - - if (elementTypeName.equals(VOID_CLASS_NAME)) { - throw new IllegalArgumentException("'" + VOID_CLASS_NAME + "' must have an array depth of zero: " + arrayDepth + '.'); - } - // array - StringBuilder sb = new StringBuilder(100); - for (int i = arrayDepth; i-- > 0; ) { - sb.append(ARRAY_INDICATOR); - } - - // look for a primitive first - Primitive pcc = null; - if (elementTypeName.length() <= maxPrimitiveClassNameLength()) { // performance tweak - Primitive[] codes = primitives(); - for (int i = codes.length; i-- > 0; ) { - if (codes[i].javaClass.getName().equals(elementTypeName)) { - pcc = codes[i]; - break; - } - } - } - - if (pcc == null) { - sb.append(REFERENCE_CLASS_CODE); - sb.append(elementTypeName); - sb.append(REFERENCE_CLASS_NAME_DELIMITER); - } else { - sb.append(pcc.code); - } - - return sb.toString(); - } - - private static int maxPrimitiveClassNameLength() { - if (MAX_PRIMITIVE_CLASS_NAME_LENGTH == -1) { - MAX_PRIMITIVE_CLASS_NAME_LENGTH = calculateMaxPrimitiveClassNameLength(); - } - return MAX_PRIMITIVE_CLASS_NAME_LENGTH; - } - - private static int calculateMaxPrimitiveClassNameLength() { - int max = -1; - Primitive[] codes = primitives(); - for (int i = codes.length; i-- > 0; ) { - int len = codes[i].javaClass.getName().length(); - if (len > max) { - max = len; - } - } - return max; - } - - private static int maxPrimitiveWrapperClassNameLength() { - if (MAX_PRIMITIVE_WRAPPER_CLASS_NAME_LENGTH == -1) { - MAX_PRIMITIVE_WRAPPER_CLASS_NAME_LENGTH = calculateMaxPrimitiveWrapperClassNameLength(); - } - return MAX_PRIMITIVE_WRAPPER_CLASS_NAME_LENGTH; - } - - private static int calculateMaxPrimitiveWrapperClassNameLength() { - int max = -1; - Primitive[] codes = primitives(); - for (int i = codes.length; i-- > 0; ) { - int len = codes[i].wrapperClass.getName().length(); - if (len > max) { - max = len; - } - } - return max; - } - - private static Primitive[] primitives() { - if (PRIMITIVES == null) { - PRIMITIVES = buildPrimitives(); - } - return PRIMITIVES; - } - - /** - * NB: void.class.isPrimitive() == true - */ - private static Primitive[] buildPrimitives() { - Primitive[] result = new Primitive[9]; - result[0] = new Primitive(BYTE_CODE, java.lang.Byte.class); - result[1] = new Primitive(CHAR_CODE, java.lang.Character.class); - result[2] = new Primitive(DOUBLE_CODE, java.lang.Double.class); - result[3] = new Primitive(FLOAT_CODE, java.lang.Float.class); - result[4] = new Primitive(INT_CODE, java.lang.Integer.class); - result[5] = new Primitive(LONG_CODE, java.lang.Long.class); - result[6] = new Primitive(SHORT_CODE, java.lang.Short.class); - result[7] = new Primitive(BOOLEAN_CODE, java.lang.Boolean.class); - result[8] = new Primitive(VOID_CODE, java.lang.Void.class); - return result; - } - - /** - * Suppress default constructor, ensuring non-instantiability. - */ - private ClassTools() { - super(); - throw new UnsupportedOperationException(); - } - - - // ********** member classes ********** - - private static class Primitive { - final char code; - final Class javaClass; - final Class wrapperClass; - private static final String WRAPPER_CLASS_TYPE_FIELD_NAME = "TYPE"; - // e.g. java.lang.Boolean.TYPE => boolean.class - Primitive(char code, Class wrapperClass) { - this.code = code; - this.wrapperClass = wrapperClass; - this.javaClass = (Class) staticFieldValue(wrapperClass, WRAPPER_CLASS_TYPE_FIELD_NAME); - } - } - - private static class TypeDeclaration { - final String elementTypeName; - final int arrayDepth; - TypeDeclaration(String elementTypeName, int arrayDepth) { - this.elementTypeName = elementTypeName; - this.arrayDepth = arrayDepth; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ArrayToolsTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ArrayToolsTests.java deleted file mode 100644 index b5f840729f..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ArrayToolsTests.java +++ /dev/null @@ -1,3523 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.Range; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.ReverseComparator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; - -@SuppressWarnings("nls") -public class ArrayToolsTests extends TestCase { - - public ArrayToolsTests(String name) { - super(name); - } - - - // ********** instantiation ********** - - public void testNewArrayObjectArray() { - String[] array1 = new String[2]; - String[] array2 = ArrayTools.newArray(array1); - array2[0] = "foo"; - array2[1] = "bar"; - assertEquals(String.class, array2.getClass().getComponentType()); - assertEquals(2, array2.length); - } - - public void testNewArrayObjectArrayInt() { - String[] array1 = new String[2]; - String[] array2 = ArrayTools.newArray(array1, 5); - array2[0] = "foo"; - array2[4] = "bar"; - assertEquals(String.class, array2.getClass().getComponentType()); - assertEquals(5, array2.length); - } - - public void testNewArrayObjectArrayInt_Exception() { - String[] array1 = new String[2]; - Object[] array2 = ArrayTools.newArray(array1, 5); - boolean exCaught = false; - try { - array2[1] = Integer.valueOf(7); - fail("bogus array: " + Arrays.toString(array2)); - } catch (ArrayStoreException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testComponentType() { - String[] array = new String[2]; - Class javaClass = ArrayTools.componentType(array); - assertEquals(String.class, javaClass); - } - - public void testNewArrayClassInt() { - String[] array = ArrayTools.newArray(String.class, 5); - array[0] = "foo"; - array[4] = "bar"; - assertEquals(String.class, array.getClass().getComponentType()); - assertEquals(5, array.length); - } - - public void testNewArrayClassInt_Exception() { - Object[] array = ArrayTools.newArray(String.class, 5); - boolean exCaught = false; - try { - array[1] = Integer.valueOf(7); - fail("bogus array: " + Arrays.toString(array)); - } catch (ArrayStoreException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testNewArrayClassInt_Primitive() { - boolean exCaught = false; - try { - Object[] array = ArrayTools.newArray(int.class, 5); - fail("bogus array: " + Arrays.toString(array)); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - - // ********** conversion ********** - - public void testArrayIterable() { - Iterable iterable = this.buildStringList1(); - Object[] a = ArrayTools.array(iterable); - assertEquals(3, a.length); - assertTrue(ArrayTools.containsAll(a, this.buildStringList1().iterator())); - } - - public void testArrayIterableInt() { - Iterable iterable = this.buildStringList1(); - Object[] a = ArrayTools.array(iterable, 3); - assertEquals(3, a.length); - assertTrue(ArrayTools.containsAll(a, this.buildStringList1().iterator())); - } - - public void testArrayIterableObjectArray_String() { - Iterable iterable = this.buildStringList1(); - String[] a = ArrayTools.array(iterable, new String[0]); - assertEquals(3, a.length); - assertTrue(ArrayTools.containsAll(a, this.buildStringList1().iterator())); - } - - public void testArrayIterableObjectArray_Object() { - Iterable iterable = this.buildStringList1(); - Object[] a = ArrayTools.array(iterable, new Object[0]); - assertEquals(3, a.length); - assertTrue(ArrayTools.containsAll(a, this.buildStringList1().iterator())); - } - - public void testArrayIterableIntObjectArray() { - Iterable iterable = this.buildStringList1(); - String[] a = ArrayTools.array(iterable, 3, new String[0]); - assertEquals(3, a.length); - assertTrue(ArrayTools.containsAll(a, this.buildStringList1().iterator())); - } - - public void testArrayIterator() { - Object[] a = ArrayTools.array(this.buildStringList1().iterator()); - assertEquals(3, a.length); - assertTrue(ArrayTools.containsAll(a, this.buildStringList1().iterator())); - } - - public void testArrayIterator_Empty() { - Object[] a = ArrayTools.array(EmptyIterator.instance()); - assertEquals(0, a.length); - } - - public void testArrayIteratorInt() { - Object[] a = ArrayTools.array(this.buildStringList1().iterator(), 3); - assertEquals(3, a.length); - assertTrue(ArrayTools.containsAll(a, this.buildStringList1().iterator())); - } - - public void testArrayIteratorInt_Empty() { - Object[] a = ArrayTools.array(EmptyIterator.instance(), 3); - assertEquals(0, a.length); - } - - public void testArrayIteratorObjectArray_String() { - String[] a = ArrayTools.array(this.buildStringList1().iterator(), new String[0]); - assertEquals(3, a.length); - assertTrue(ArrayTools.containsAll(a, this.buildStringList1().iterator())); - } - - public void testArrayIteratorObjectArray_Empty() { - String[] a = ArrayTools.array(EmptyIterator.instance(), new String[0]); - assertEquals(0, a.length); - } - - public void testArrayIteratorObjectArray_Empty_ClearArray() { - String[] a = ArrayTools.array(EmptyIterator.instance(), new String[5]); - assertEquals(5, a.length); - assertNull(a[0]); - } - - public void testArrayIteratorObjectArray_Object() { - Object[] a = ArrayTools.array(this.buildStringList1().iterator(), new Object[0]); - assertEquals(3, a.length); - assertTrue(ArrayTools.containsAll(a, this.buildStringList1().iterator())); - } - - public void testArrayIteratorIntObjectArray() { - String[] a = ArrayTools.array(this.buildStringList1().iterator(), 3, new String[0]); - assertEquals(3, a.length); - assertTrue(ArrayTools.containsAll(a, this.buildStringList1().iterator())); - } - - public void testArrayIteratorIntObjectArray_Empty() { - String[] a = ArrayTools.array(EmptyIterator.instance(), 3, new String[0]); - assertEquals(0, a.length); - } - - - // ********** add ********** - - public void testAddObjectArrayObject_Object() { - Object[] a = ArrayTools.add(this.buildObjectArray1(), "twenty"); - assertEquals(4, a.length); - assertTrue(ArrayTools.contains(a, "twenty")); - assertEquals("twenty", a[a.length-1]); - } - - public void testAddObjectArrayObject_String() { - String[] a = ArrayTools.add(this.buildStringArray1(), "twenty"); - assertEquals(4, a.length); - assertTrue(ArrayTools.contains(a, "twenty")); - assertEquals("twenty", a[a.length-1]); - } - - public void testAddObjectArrayObject_EmptyArray() { - String[] a = new String[0]; - a = ArrayTools.add(a, "twenty"); - assertEquals(1, a.length); - assertTrue(ArrayTools.contains(a, "twenty")); - assertEquals("twenty", a[0]); - } - - public void testAddObjectArrayIntObject_Object() { - Object[] a = new Object[] { "a", "b", "c", "d" }; - a = ArrayTools.add(a, 2, "X"); - assertEquals(5, a.length); - assertTrue(ArrayTools.contains(a, "X")); - assertTrue(Arrays.equals(new Object[] { "a", "b", "X", "c", "d" }, a)); - } - - public void testAddObjectArrayIntObject_String() { - String[] a = new String[] { "a", "b", "c", "d" }; - a = ArrayTools.add(a, 2, "X"); - assertEquals(5, a.length); - assertTrue(ArrayTools.contains(a, "X")); - assertTrue(Arrays.equals(new String[] { "a", "b", "X", "c", "d" }, a)); - } - - public void testAddObjectArrayIntObject_End() { - String[] a = new String[] { "a", "b", "c", "d" }; - a = ArrayTools.add(a, 4, "X"); - assertEquals(5, a.length); - assertTrue(ArrayTools.contains(a, "X")); - assertTrue(Arrays.equals(new String[] { "a", "b", "c", "d", "X" }, a)); - } - - public void testAddObjectArrayIntObject_Zero() { - String[] a = new String[] { "a", "b", "c", "d" }; - a = ArrayTools.add(a, 0, "X"); - assertEquals(5, a.length); - assertTrue(ArrayTools.contains(a, "X")); - assertTrue(Arrays.equals(new String[] { "X", "a", "b", "c", "d" }, a)); - } - - public void testAddObjectArrayIntObject_Exception() { - Object[] a = new Object[] { "a", "b", "c", "d" }; - boolean exCaught = false; - try { - a = ArrayTools.add(a, 33, "X"); - } catch (IndexOutOfBoundsException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testAddCharArrayChar() { - char[] a = ArrayTools.add(this.buildCharArray(), 'd'); - assertEquals(4, a.length); - assertTrue(ArrayTools.contains(a, 'd')); - } - - public void testAddCharArrayChar_Empty() { - char[] a = new char[0]; - a = ArrayTools.add(a, 'd'); - assertEquals(1, a.length); - assertTrue(ArrayTools.contains(a, 'd')); - assertTrue(Arrays.equals(new char[] { 'd' }, a)); - } - - public void testAddCharArrayIntChar() { - char[] a = new char[] { 'a', 'b', 'c', 'd' }; - a = ArrayTools.add(a, 2, 'X'); - assertEquals(5, a.length); - assertTrue(ArrayTools.contains(a, 'X')); - assertTrue(Arrays.equals(new char[] { 'a', 'b', 'X', 'c', 'd' }, a)); - } - - public void testAddCharArrayIntChar_Zero() { - char[] a = new char[] { 'a', 'b', 'c', 'd' }; - a = ArrayTools.add(a, 0, 'X'); - assertEquals(5, a.length); - assertTrue(ArrayTools.contains(a, 'X')); - assertTrue(Arrays.equals(new char[] { 'X', 'a', 'b', 'c', 'd' }, a)); - } - - public void testAddCharArrayIntChar_End() { - char[] a = new char[] { 'a', 'b', 'c', 'd' }; - a = ArrayTools.add(a, 4, 'X'); - assertEquals(5, a.length); - assertTrue(ArrayTools.contains(a, 'X')); - assertTrue(Arrays.equals(new char[] { 'a', 'b', 'c', 'd', 'X' }, a)); - } - - public void testAddIntArrayInt() { - int[] a = ArrayTools.add(this.buildIntArray(), 30); - assertEquals(4, a.length); - assertTrue(ArrayTools.contains(a, 30)); - } - - public void testAddIntArrayInt_Empty() { - int[] a = new int[0]; - a = ArrayTools.add(a, 30); - assertEquals(1, a.length); - assertTrue(ArrayTools.contains(a, 30)); - assertTrue(Arrays.equals(new int[] { 30 }, a)); - } - - public void testAddIntArrayIntInt() { - int[] a = new int[] { 1, 2, 3, 4 }; - a = ArrayTools.add(a, 2, 99); - assertEquals(5, a.length); - assertTrue(ArrayTools.contains(a, 99)); - assertTrue(Arrays.equals(new int[] { 1, 2, 99, 3, 4 }, a)); - } - - public void testAddIntArrayIntInt_Zero() { - int[] a = new int[] { 1, 2, 3, 4 }; - a = ArrayTools.add(a, 0, 99); - assertEquals(5, a.length); - assertTrue(ArrayTools.contains(a, 99)); - assertTrue(Arrays.equals(new int[] { 99, 1, 2, 3, 4 }, a)); - } - - public void testAddIntArrayIntInt_End() { - int[] a = new int[] { 1, 2, 3, 4 }; - a = ArrayTools.add(a, 4, 99); - assertEquals(5, a.length); - assertTrue(ArrayTools.contains(a, 99)); - assertTrue(Arrays.equals(new int[] { 1, 2, 3, 4, 99 }, a)); - } - - - // ********** add all ********** - - public void testAddAllObjectArrayCollection_String() { - String[] a = this.buildStringArray1(); - Collection c = this.buildStringList2(); - String[] newArray = ArrayTools.addAll(a, c); - - assertEquals(6, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, c)); - } - - public void testAddAllObjectArrayCollection_Object() { - Object[] a = this.buildObjectArray1(); - Collection c = this.buildStringList2(); - Object[] newArray = ArrayTools.addAll(a, c); - - assertEquals(6, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, c)); - } - - public void testAddAllObjectArrayCollection_EmptyArray() { - String[] a = new String[0]; - Collection c = this.buildStringList2(); - String[] newArray = ArrayTools.addAll(a, c); - - assertEquals(3, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, c)); - } - - public void testAddAllObjectArrayCollection_EmptyCollection() { - String[] a = this.buildStringArray1(); - Collection c = new ArrayList(); - String[] newArray = ArrayTools.addAll(a, c); - - assertEquals(3, newArray.length); - } - - public void testAddAllObjectArrayIntCollection_String() { - String[] a = this.buildStringArray1(); - Collection c = this.buildStringList2(); - String[] newArray = ArrayTools.addAll(a, 1, c); - - assertEquals(6, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, c)); - } - - public void testAddAllObjectArrayIntCollection_String_End() { - String[] a = this.buildStringArray1(); - Collection c = this.buildStringList2(); - String[] newArray = ArrayTools.addAll(a, 3, c); - - assertEquals(6, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, c)); - } - - public void testAddAllObjectArrayIntCollection_EmptyArray() { - String[] a = new String[0]; - Collection c = this.buildStringList2(); - String[] newArray = ArrayTools.addAll(a, 0, c); - - assertEquals(3, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, c)); - } - - public void testAddAllObjectArrayIntCollection_EmptyArray_Exception() { - String[] a = new String[0]; - Collection c = this.buildStringList2(); - boolean exCaught = false; - try { - String[] newArray = ArrayTools.addAll(a, 3, c); - fail("bogus array: " + Arrays.toString(newArray)); - } catch (IndexOutOfBoundsException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testAddAllObjectArrayIntCollection_EmptyCollection() { - String[] a = this.buildStringArray1(); - Collection c = new ArrayList(); - String[] newArray = ArrayTools.addAll(a, 1, c); - - assertEquals(3, newArray.length); - } - - public void testAddAllObjectArrayIntIterable_String() { - String[] a = this.buildStringArray1(); - Iterable iterable = this.buildStringList2(); - String[] newArray = ArrayTools.addAll(a, 1, iterable); - - assertEquals(6, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, iterable)); - } - - public void testAddAllObjectArrayIntIterable_EmptyArray() { - String[] a = new String[0]; - Iterable iterable = this.buildStringList2(); - String[] newArray = ArrayTools.addAll(a, 0, iterable); - - assertEquals(3, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, iterable)); - } - - public void testAddAllObjectArrayIntIterable_EmptyIterable() { - String[] a = this.buildStringArray1(); - Iterable iterable = new ArrayList(); - String[] newArray = ArrayTools.addAll(a, 1, iterable); - - assertEquals(3, newArray.length); - } - - public void testAddAllObjectArrayIntIterableInt_String() { - String[] a = this.buildStringArray1(); - Iterable iterable = this.buildStringList2(); - String[] newArray = ArrayTools.addAll(a, 1, iterable, 3); - - assertEquals(6, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, iterable)); - } - - public void testAddAllObjectArrayIntIterableInt_EmptyArray() { - String[] a = new String[0]; - Iterable iterable = this.buildStringList2(); - String[] newArray = ArrayTools.addAll(a, 0, iterable, 3); - - assertEquals(3, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, iterable)); - } - - public void testAddAllObjectArrayIntIterableInt_EmptyIterable() { - String[] a = this.buildStringArray1(); - Iterable iterable = new ArrayList(); - String[] newArray = ArrayTools.addAll(a, 1, iterable, 0); - - assertEquals(3, newArray.length); - } - - public void testAddAllObjectArrayIntIterator_String() { - String[] a = this.buildStringArray1(); - Iterator iterator = this.buildStringList2().iterator(); - String[] newArray = ArrayTools.addAll(a, 1, iterator); - - assertEquals(6, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, this.buildStringList2())); - } - - public void testAddAllObjectArrayIntIterator_EmptyArray() { - String[] a = new String[0]; - Iterator iterator = this.buildStringList2().iterator(); - String[] newArray = ArrayTools.addAll(a, 0, iterator); - - assertEquals(3, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, this.buildStringList2())); - } - - public void testAddAllObjectArrayIntIterator_EmptyIterable() { - String[] a = this.buildStringArray1(); - Iterator iterator = EmptyIterator.instance(); - String[] newArray = ArrayTools.addAll(a, 1, iterator); - - assertEquals(3, newArray.length); - } - - public void testAddAllObjectArrayIntIteratorInt_String() { - String[] a = this.buildStringArray1(); - Iterator iterator = this.buildStringList2().iterator(); - String[] newArray = ArrayTools.addAll(a, 1, iterator, 3); - - assertEquals(6, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, this.buildStringList2())); - } - - public void testAddAllObjectArrayIntIteratorInt_EmptyArray() { - String[] a = new String[0]; - Iterator iterator = this.buildStringList2().iterator(); - String[] newArray = ArrayTools.addAll(a, 0, iterator, 3); - - assertEquals(3, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, this.buildStringList2())); - } - - public void testAddAllObjectArrayIntIteratorInt_EmptyIterator() { - String[] a = this.buildStringArray1(); - Iterator iterator = EmptyIterator.instance(); - String[] newArray = ArrayTools.addAll(a, 1, iterator, 0); - - assertEquals(3, newArray.length); - } - - public void testAddAllObjectArrayIterable() { - String[] a = this.buildStringArray1(); - Iterable iterable = this.buildStringList1(); - String[] newArray = ArrayTools.addAll(a, iterable); - - assertEquals(6, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, this.buildStringList1())); - } - - public void testAddAllObjectArrayIterableInt() { - String[] a = this.buildStringArray1(); - Iterable iterable = this.buildStringList1(); - String[] newArray = ArrayTools.addAll(a, iterable, 33); - - assertEquals(6, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, this.buildStringList1())); - } - - public void testAddAllObjectArrayIterator_String() { - String[] a = this.buildStringArray1(); - Iterator iterator = this.buildStringList1().iterator(); - String[] newArray = ArrayTools.addAll(a, iterator); - - assertEquals(6, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, this.buildStringList1())); - } - - public void testAddAllObjectArrayIterator_Object() { - String[] a = this.buildStringArray1(); - Iterator iterator = this.buildObjectList1().iterator(); - Object[] newArray = ArrayTools.addAll(a, iterator); - - assertEquals(6, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, this.buildObjectList1())); - } - - public void testAddAllObjectArrayIterator_EmptyIterator() { - String[] a = this.buildStringArray1(); - Iterator iterator = EmptyIterator.instance(); - String[] newArray = ArrayTools.addAll(a, iterator); - - assertEquals(3, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, this.buildStringList1())); - } - - public void testAddAllObjectArrayIteratorInt() { - String[] a = this.buildStringArray1(); - Iterator iterator = this.buildObjectList1().iterator(); - Object[] newArray = ArrayTools.addAll(a, iterator, 3); - - assertEquals(6, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, this.buildObjectList1())); - } - - public void testAddAllObjectArrayIteratorInt_EmptyIterator() { - String[] a = this.buildStringArray1(); - Iterator iterator = EmptyIterator.instance(); - String[] newArray = ArrayTools.addAll(a, iterator, 0); - - assertEquals(3, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, this.buildStringList1())); - } - - public void testAddAllObjectArrayObjectArray_Object() { - Object[] a1 = this.buildObjectArray1(); - Object[] a2 = this.buildObjectArray2(); - Object[] newArray = ArrayTools.addAll(a1, a2); - - assertEquals(6, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, a1)); - assertTrue(ArrayTools.containsAll(newArray, a2)); - } - - public void testAddAllObjectArrayObjectArray_String() { - String[] a1 = this.buildStringArray1(); - String[] a2 = this.buildStringArray2(); - String[] newArray = ArrayTools.addAll(a1, a2); - - assertEquals(6, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, (Object[]) a1)); - assertTrue(ArrayTools.containsAll(newArray, (Object[]) a2)); - } - - public void testAddAllObjectArrayObjectArray_ObjectString() { - Object[] a1 = this.buildObjectArray1(); - String[] a2 = this.buildStringArray2(); - Object[] newArray = ArrayTools.addAll(a1, (Object[]) a2); - - assertEquals(6, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, a1)); - assertTrue(ArrayTools.containsAll(newArray, (Object[]) a2)); - } - - public void testAddAllObjectArrayObjectArray_EmptyArray1() { - Object[] a1 = new Object[0]; - Object[] a2 = this.buildObjectArray2(); - Object[] newArray = ArrayTools.addAll(a1, a2); - - assertEquals(3, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, a2)); - } - - public void testAddAllObjectArrayObjectArray_EmptyArray2() { - Object[] a1 = this.buildObjectArray1(); - Object[] a2 = new Object[0]; - Object[] newArray = ArrayTools.addAll(a1, a2); - - assertEquals(3, newArray.length); - assertTrue(ArrayTools.containsAll(newArray, a1)); - } - - public void testAddAllObjectArrayIntObjectArray_Object() { - Object[] a = new Object[] { "a", "b", "c", "d" }; - a = ArrayTools.addAll(a, 2, new Object[] { "X", "X", "X" }); - assertEquals(7, a.length); - assertTrue(ArrayTools.contains(a, "X")); - assertTrue(Arrays.equals(new Object[] { "a", "b", "X", "X", "X", "c", "d" }, a)); - } - - public void testAddAllObjectArrayIntObjectArray_String() { - String[] a = new String[] { "a", "b", "c", "d" }; - a = ArrayTools.addAll(a, 2, new String[] { "X", "X", "X" }); - assertEquals(7, a.length); - assertTrue(ArrayTools.contains(a, "X")); - assertTrue(Arrays.equals(new String[] { "a", "b", "X", "X", "X", "c", "d" }, a)); - } - - public void testAddAllObjectArrayIntObjectArray_ObjectString() { - Object[] a = new Object[] { "a", "b", "c", "d" }; - a = ArrayTools.addAll(a, 2, (Object[]) new String[] { "X", "X", "X" }); - assertEquals(7, a.length); - assertTrue(ArrayTools.contains(a, "X")); - assertTrue(Arrays.equals(new Object[] { "a", "b", "X", "X", "X", "c", "d" }, a)); - } - - public void testAddAllObjectArrayIntObjectArray_End() { - Object[] a = new Object[] { "a", "b", "c", "d" }; - a = ArrayTools.addAll(a, 4, (Object[]) new String[] { "X", "X", "X" }); - assertEquals(7, a.length); - assertTrue(ArrayTools.contains(a, "X")); - assertTrue(Arrays.equals(new Object[] { "a", "b", "c", "d", "X", "X", "X" }, a)); - } - - public void testAddAllObjectArrayIntObjectArray_Zero() { - Object[] a = new Object[0]; - a = ArrayTools.addAll(a, 0, (Object[]) new String[] { "X", "X", "X" }); - assertEquals(3, a.length); - assertTrue(ArrayTools.contains(a, "X")); - assertTrue(Arrays.equals(new Object[] { "X", "X", "X" }, a)); - } - - public void testAddAllObjectArrayIntObjectArray_EmptyArray2() { - Object[] a = new Object[] { "a", "b", "c", "d" }; - a = ArrayTools.addAll(a, 4, (Object[]) new String[0]); - assertEquals(4, a.length); - assertTrue(Arrays.equals(new Object[] { "a", "b", "c", "d" }, a)); - } - - public void testAddAllObjectArrayIntObjectArray_EmptyArray1() { - Object[] a = new String[0]; - a = ArrayTools.addAll(a, 0, new Object[] { "a", "b", "c", "d" }); - assertEquals(4, a.length); - assertTrue(Arrays.equals(new Object[] { "a", "b", "c", "d" }, a)); - } - - public void testAddAllCharArrayCharArray() { - char[] a = ArrayTools.addAll(this.buildCharArray(), new char[] { 'd', 'e' }); - assertEquals(5, a.length); - assertTrue(ArrayTools.contains(a, 'd')); - assertTrue(ArrayTools.contains(a, 'e')); - } - - public void testAddAllCharArrayCharArray_EmptyArray2() { - char[] a = ArrayTools.addAll(this.buildCharArray(), new char[0]); - assertEquals(3, a.length); - } - - public void testAddAllCharArrayCharArrayEmptyArray1() { - char[] a = ArrayTools.addAll(new char[0], new char[] { 'd', 'e' }); - assertEquals(2, a.length); - assertTrue(ArrayTools.contains(a, 'd')); - assertTrue(ArrayTools.contains(a, 'e')); - } - - public void testAddAllCharArrayIntCharArray() { - char[] a = new char[] { 'a', 'b', 'c', 'd' }; - a = ArrayTools.addAll(a, 2, new char[] { 'X', 'X', 'X' }); - assertEquals(7, a.length); - assertTrue(ArrayTools.contains(a, 'X')); - assertTrue(Arrays.equals(new char[] { 'a', 'b', 'X', 'X', 'X', 'c', 'd' }, a)); - } - - public void testAddAllCharArrayIntCharArray_End() { - char[] a = new char[] { 'a', 'b', 'c', 'd' }; - a = ArrayTools.addAll(a, 4, new char[] { 'X', 'X', 'X' }); - assertEquals(7, a.length); - assertTrue(ArrayTools.contains(a, 'X')); - assertTrue(Arrays.equals(new char[] { 'a', 'b', 'c', 'd', 'X', 'X', 'X' }, a)); - } - - public void testAddAllCharArrayIntCharArray_EmptyArray1() { - char[] a = new char[0]; - a = ArrayTools.addAll(a, 0, new char[] { 'X', 'X', 'X' }); - assertEquals(3, a.length); - assertTrue(ArrayTools.contains(a, 'X')); - assertTrue(Arrays.equals(new char[] { 'X', 'X', 'X' }, a)); - } - - public void testAddAllCharArrayIntCharArray_EmptyArray2() { - char[] a = new char[] { 'a', 'b', 'c', 'd' }; - a = ArrayTools.addAll(a, 2, new char[0]); - assertEquals(4, a.length); - assertTrue(Arrays.equals(new char[] { 'a', 'b', 'c', 'd' }, a)); - } - - public void testAddAllIntArrayIntArray() { - int[] a = ArrayTools.addAll(this.buildIntArray(), new int[] { 30, 40 }); - assertEquals(5, a.length); - assertTrue(ArrayTools.contains(a, 30)); - assertTrue(ArrayTools.contains(a, 40)); - } - - public void testAddAllIntArrayIntArray_EmptyArray2() { - int[] a = ArrayTools.addAll(this.buildIntArray(), new int[0]); - assertEquals(3, a.length); - } - - public void testAddAllIntArrayIntArray_EmptyArray1() { - int[] a = ArrayTools.addAll(new int[0], new int[] { 30, 40 }); - assertEquals(2, a.length); - assertTrue(ArrayTools.contains(a, 30)); - assertTrue(ArrayTools.contains(a, 40)); - } - - public void testAddAllIntArrayIntIntArray() { - int[] a = new int[] { 1, 2, 3, 4 }; - a = ArrayTools.addAll(a, 2, new int[] { 99, 99, 99 }); - assertEquals(7, a.length); - assertTrue(ArrayTools.contains(a, 99)); - assertTrue(Arrays.equals(new int[] { 1, 2, 99, 99, 99, 3, 4 }, a)); - } - - public void testAddAllIntArrayIntIntArray_End() { - int[] a = new int[] { 1, 2, 3, 4 }; - a = ArrayTools.addAll(a, 4, new int[] { 99, 99, 99 }); - assertEquals(7, a.length); - assertTrue(ArrayTools.contains(a, 99)); - assertTrue(Arrays.equals(new int[] { 1, 2, 3, 4, 99, 99, 99 }, a)); - } - - public void testAddAllIntArrayIntIntArray_EmptyArray2() { - int[] a = new int[] { 1, 2, 3, 4 }; - a = ArrayTools.addAll(a, 2, new int[0]); - assertEquals(4, a.length); - assertTrue(Arrays.equals(new int[] { 1, 2, 3, 4 }, a)); - } - - public void testAddAllIntArrayIntIntArray_EmptyArray1() { - int[] a = new int[0]; - a = ArrayTools.addAll(a, 0, new int[] { 99, 99, 99 }); - assertEquals(3, a.length); - assertTrue(ArrayTools.contains(a, 99)); - assertTrue(Arrays.equals(new int[] { 99, 99, 99 }, a)); - } - - - // ********** clear ********** - - public void testClearObjectArray() { - String[] a = this.buildStringArray1(); - assertEquals(3, a.length); - a = ArrayTools.clear(a); - assertEquals(0, a.length); - } - - public void testClearObjectArray_Empty() { - String[] a = new String[0]; - assertEquals(0, a.length); - a = ArrayTools.clear(a); - assertEquals(0, a.length); - } - - - // ********** concatenate ********** - - public void testConcatenateObjectArrayArray() { - String[] aArray = new String[] { "a", "b", "c", "d" }; - String[] eArray = new String[] { "e", "f", "g", "h" }; - String[] iArray = new String[] { "i", "j", "k", "l" }; - - String[] expected = new String[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l" }; - String[] actual = ArrayTools.concatenate(aArray, eArray, iArray); - assertTrue(Arrays.equals(expected, actual)); - } - - public void testConcatenateObjectArrayArray_Empty() { - String[] aArray = new String[] { }; - String[] eArray = new String[0]; - String[] iArray = new String[0]; - - String[] expected = new String[0]; - String[] actual = ArrayTools.concatenate(aArray, eArray, iArray); - assertEquals(0, actual.length); - assertTrue(Arrays.equals(expected, actual)); - } - - public void testConcatenateCharArrayArray() { - char[] aArray = new char[] { 'a', 'b', 'c', 'd' }; - char[] eArray = new char[] { 'e', 'f', 'g', 'h' }; - char[] iArray = new char[] { 'i', 'j', 'k', 'l' }; - - char[] expected = new char[] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l' }; - char[] actual = ArrayTools.concatenate(aArray, eArray, iArray); - assertTrue(Arrays.equals(expected, actual)); - } - - public void testConcatenateCharArrayArray_Empty() { - char[] aArray = new char[] { }; - char[] eArray = new char[0]; - char[] iArray = new char[0]; - - char[] expected = new char[0]; - char[] actual = ArrayTools.concatenate(aArray, eArray, iArray); - assertEquals(0, actual.length); - assertTrue(Arrays.equals(expected, actual)); - } - - public void testConcatenateIntArrayArray() { - int[] aArray = new int[] { 'a', 'b', 'c', 'd' }; - int[] eArray = new int[] { 'e', 'f', 'g', 'h' }; - int[] iArray = new int[] { 'i', 'j', 'k', 'l' }; - - int[] expected = new int[] { 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l' }; - int[] actual = ArrayTools.concatenate(aArray, eArray, iArray); - assertTrue(Arrays.equals(expected, actual)); - } - - public void testConcatenateIntArrayArray_Empty() { - int[] aArray = new int[] { }; - int[] eArray = new int[0]; - int[] iArray = new int[0]; - - int[] expected = new int[0]; - int[] actual = ArrayTools.concatenate(aArray, eArray, iArray); - assertEquals(0, actual.length); - assertTrue(Arrays.equals(expected, actual)); - } - - - // ********** contains ********** - - public void testContainsObjectArrayObject() { - Object[] a = this.buildObjectArray1(); - assertTrue(ArrayTools.contains(a, "one")); - assertFalse(ArrayTools.contains(a, null)); - Object[] a2 = ArrayTools.add(a, null); - assertTrue(ArrayTools.contains(a2, null)); - } - - public void testContainsObjectArrayObject_EmptyArray() { - Object[] a = new Object[0]; - assertFalse(ArrayTools.contains(a, "one")); - assertFalse(ArrayTools.contains(a, null)); - } - - public void testContainsCharArrayChar() { - char[] a = this.buildCharArray(); - assertTrue(ArrayTools.contains(a, 'a')); - assertFalse(ArrayTools.contains(a, 'z')); - char[] a2 = ArrayTools.add(a, 'z'); - assertTrue(ArrayTools.contains(a2, 'z')); - } - - public void testContainsCharArrayObject_EmptyArray() { - char[] a = new char[0]; - assertFalse(ArrayTools.contains(a, 'a')); - } - - public void testContainsIntArrayInt() { - int[] a = this.buildIntArray(); - assertTrue(ArrayTools.contains(a, 10)); - assertFalse(ArrayTools.contains(a, 55)); - int[] a2 = ArrayTools.add(a, 55); - assertTrue(ArrayTools.contains(a2, 55)); - } - - public void testContainsIntArrayObject_EmptyArray() { - int[] a = new int[0]; - assertFalse(ArrayTools.contains(a, 'a')); - } - - - // ********** contains all ********** - - public void testContainsAllObjectArrayCollection() { - assertTrue(ArrayTools.containsAll(this.buildObjectArray1(), this.buildStringList1())); - assertFalse(ArrayTools.containsAll(this.buildObjectArray1(), this.buildStringList2())); - } - - public void testContainsAllObjectArrayIterable() { - Iterable iterable = this.buildStringList1(); - assertTrue(ArrayTools.containsAll(this.buildObjectArray1(), iterable)); - iterable = this.buildStringList2(); - assertFalse(ArrayTools.containsAll(this.buildObjectArray1(), iterable)); - } - - public void testContainsAllObjectArrayIterator() { - assertTrue(ArrayTools.containsAll(this.buildObjectArray1(), this.buildStringList1().iterator())); - assertFalse(ArrayTools.containsAll(this.buildObjectArray1(), this.buildStringList2().iterator())); - } - - public void testContainsAllObjectArrayIterator_Empty() { - assertTrue(ArrayTools.containsAll(this.buildObjectArray1(), EmptyIterator.instance())); - } - - public void testContainsAllObjectArrayObjectArray() { - assertTrue(ArrayTools.containsAll(this.buildObjectArray1(), this.buildObjectArray1())); - assertFalse(ArrayTools.containsAll(this.buildObjectArray1(), this.buildObjectArray2())); - } - - public void testContainsAllCharArrayCharArray() { - assertTrue(ArrayTools.containsAll(this.buildCharArray(), this.buildCharArray())); - assertFalse(ArrayTools.containsAll(this.buildCharArray(), new char[] { 'x', 'y' })); - } - - public void testContainsAllIntArrayIntArray() { - assertTrue(ArrayTools.containsAll(this.buildIntArray(), this.buildIntArray())); - assertFalse(ArrayTools.containsAll(this.buildIntArray(), new int[] { 444, 888 })); - } - - - // ********** diff ********** - - public void testDiffEnd() { - String a = "a"; - String b = "b"; - String c = "c"; - String d = "d"; - String e = "e"; - String a_ = new String("a"); - String b_ = new String("b"); - String c_ = new String("c"); - String d_ = new String("d"); - String e_ = new String("e"); - assertTrue((a != a_) && a.equals(a_)); - assertTrue((b != b_) && b.equals(b_)); - assertTrue((c != c_) && c.equals(c_)); - assertTrue((d != d_) && d.equals(d_)); - assertTrue((e != e_) && e.equals(e_)); - String[] array1; - String[] array2; - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(-1, ArrayTools.diffEnd(array1, array2)); - - array1 = new String[] { a }; - array2 = new String[] { a_ }; - assertEquals(-1, ArrayTools.diffEnd(array1, array2)); - - array1 = new String[] { b, c, d, e }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(4, ArrayTools.diffEnd(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { b_, c_, d_, e_ }; - assertEquals(4, ArrayTools.diffEnd(array1, array2)); - - array1 = new String[0]; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(4, ArrayTools.diffEnd(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[0]; - assertEquals(4, ArrayTools.diffEnd(array1, array2)); - - array1 = new String[0]; - array2 = new String[0]; - assertEquals(-1, ArrayTools.diffEnd(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { b_, c_, a_, d_, e_ }; - assertEquals(2, ArrayTools.diffEnd(array1, array2)); - - array1 = new String[] { b, c, d, e }; - array2 = new String[] { a_, c_, d_, e_ }; - assertEquals(0, ArrayTools.diffEnd(array1, array2)); - - array1 = new String[] { a, b, c, e }; - array2 = new String[] { a_, b_, c_, d_ }; - assertEquals(3, ArrayTools.diffEnd(array1, array2)); - - String c__ = new String(c); - assertTrue((c != c__) && c.equals(c_)); - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { a_, b_, c__, d_, e_ }; - assertEquals(-1, ArrayTools.diffEnd(array1, array2)); - - array1 = new String[] { a, b, null, d, e }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(2, ArrayTools.diffEnd(array1, array2)); - - array1 = new String[] { a, b, null, d, e }; - array2 = new String[] { a_, b_, null, d_, e_ }; - assertEquals(-1, ArrayTools.diffEnd(array1, array2)); - } - - public void testDiffRange() { - String a = "a"; - String b = "b"; - String c = "c"; - String d = "d"; - String e = "e"; - String a_ = a; - String b_ = b; - String c_ = c; - String d_ = d; - String e_ = e; - assertTrue((a == a_) && a.equals(a_)); - assertTrue((b == b_) && b.equals(b_)); - assertTrue((c == c_) && c.equals(c_)); - assertTrue((d == d_) && d.equals(d_)); - assertTrue((e == e_) && e.equals(e_)); - String[] array1; - String[] array2; - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(new Range(5, -1), ArrayTools.diffRange(array1, array2)); - - array1 = new String[] { a }; - array2 = new String[] { a_ }; - assertEquals(new Range(1, -1), ArrayTools.diffRange(array1, array2)); - - array1 = new String[] { b, c, d, e }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(new Range(0, 4), ArrayTools.diffRange(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { b_, c_, d_, e_ }; - assertEquals(new Range(0, 4), ArrayTools.diffRange(array1, array2)); - - array1 = new String[0]; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(new Range(0, 4), ArrayTools.diffRange(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[0]; - assertEquals(new Range(0, 4), ArrayTools.diffRange(array1, array2)); - - array1 = new String[0]; - array2 = new String[0]; - assertEquals(new Range(0, -1), ArrayTools.diffRange(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { b_, c_, a_, d_, e_ }; - assertEquals(new Range(0, 2), ArrayTools.diffRange(array1, array2)); - - array1 = new String[] { b, c, d, e }; - array2 = new String[] { a_, c_, d_, e_ }; - assertEquals(new Range(0, 0), ArrayTools.diffRange(array1, array2)); - - array1 = new String[] { a, b, c, e }; - array2 = new String[] { a_, b_, c_, d_ }; - assertEquals(new Range(3, 3), ArrayTools.diffRange(array1, array2)); - - String c__ = new String(c); - assertTrue((c != c__) && c.equals(c_)); - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { a_, b_, c__, d_, e_ }; - assertEquals(new Range(5, -1), ArrayTools.diffRange(array1, array2)); - - array1 = new String[] { a, b, null, d, e }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(new Range(2, 2), ArrayTools.diffRange(array1, array2)); - - array1 = new String[] { a, b, null, d, e }; - array2 = new String[] { a_, b_, null, d_, e_ }; - assertEquals(new Range(5, -1), ArrayTools.diffRange(array1, array2)); - } - - public void testDiffStart() { - String a = "a"; - String b = "b"; - String c = "c"; - String d = "d"; - String e = "e"; - String a_ = new String("a"); - String b_ = new String("b"); - String c_ = new String("c"); - String d_ = new String("d"); - String e_ = new String("e"); - assertTrue((a != a_) && a.equals(a_)); - assertTrue((b != b_) && b.equals(b_)); - assertTrue((c != c_) && c.equals(c_)); - assertTrue((d != d_) && d.equals(d_)); - assertTrue((e != e_) && e.equals(e_)); - String[] array1; - String[] array2; - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(5, ArrayTools.diffStart(array1, array2)); - - array1 = new String[] { a }; - array2 = new String[] { a_ }; - assertEquals(1, ArrayTools.diffStart(array1, array2)); - - array1 = new String[] { a, b, c, d }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(4, ArrayTools.diffStart(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { a_, b_, c_, d_ }; - assertEquals(4, ArrayTools.diffStart(array1, array2)); - - array1 = new String[0]; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(0, ArrayTools.diffStart(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[0]; - assertEquals(0, ArrayTools.diffStart(array1, array2)); - - array1 = new String[0]; - array2 = new String[0]; - assertEquals(0, ArrayTools.diffStart(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { a_, b_, e_, c_, d_ }; - assertEquals(2, ArrayTools.diffStart(array1, array2)); - - array1 = new String[] { a, b, c, e }; - array2 = new String[] { a_, b_, c_, d_ }; - assertEquals(3, ArrayTools.diffStart(array1, array2)); - - array1 = new String[] { b, c, d, e }; - array2 = new String[] { a_, c_, d_, e_ }; - assertEquals(0, ArrayTools.diffStart(array1, array2)); - - String c__ = new String(c); - assertTrue((c != c__) && c.equals(c__)); - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { a_, b_, c__, d_, e_ }; - assertEquals(5, ArrayTools.diffStart(array1, array2)); - - array1 = new String[] { a, b, null, d, e }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(2, ArrayTools.diffStart(array1, array2)); - - array1 = new String[] { a, b, null, d, e }; - array2 = new String[] { a_, b_, null, d_, e_ }; - assertEquals(5, ArrayTools.diffStart(array1, array2)); - } - - - // ********** identity diff ********** - - public void testIdentityDiffEnd() { - String a = "a"; - String b = "b"; - String c = "c"; - String d = "d"; - String e = "e"; - String a_ = a; - String b_ = b; - String c_ = c; - String d_ = d; - String e_ = e; - assertTrue((a == a_) && a.equals(a_)); - assertTrue((b == b_) && b.equals(b_)); - assertTrue((c == c_) && c.equals(c_)); - assertTrue((d == d_) && d.equals(d_)); - assertTrue((e == e_) && e.equals(e_)); - String[] array1; - String[] array2; - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(-1, ArrayTools.identityDiffEnd(array1, array2)); - - array1 = new String[] { a }; - array2 = new String[] { a_ }; - assertEquals(-1, ArrayTools.identityDiffEnd(array1, array2)); - - array1 = new String[] { b, c, d, e }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(4, ArrayTools.identityDiffEnd(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { b_, c_, d_, e_ }; - assertEquals(4, ArrayTools.identityDiffEnd(array1, array2)); - - array1 = new String[0]; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(4, ArrayTools.identityDiffEnd(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[0]; - assertEquals(4, ArrayTools.identityDiffEnd(array1, array2)); - - array1 = new String[0]; - array2 = new String[0]; - assertEquals(-1, ArrayTools.identityDiffEnd(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { b_, c_, a_, d_, e_ }; - assertEquals(2, ArrayTools.identityDiffEnd(array1, array2)); - - array1 = new String[] { b, c, d, e }; - array2 = new String[] { a_, c_, d_, e_ }; - assertEquals(0, ArrayTools.identityDiffEnd(array1, array2)); - - array1 = new String[] { a, b, c, e }; - array2 = new String[] { a_, b_, c_, d_ }; - assertEquals(3, ArrayTools.identityDiffEnd(array1, array2)); - - String c__ = new String(c); - assertTrue((c != c__) && c.equals(c_)); - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { a_, b_, c__, d_, e_ }; - assertEquals(2, ArrayTools.identityDiffEnd(array1, array2)); - - array1 = new String[] { a, b, null, d, e }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(2, ArrayTools.identityDiffEnd(array1, array2)); - - array1 = new String[] { a, b, null, d, e }; - array2 = new String[] { a_, b_, null, d_, e_ }; - assertEquals(-1, ArrayTools.identityDiffEnd(array1, array2)); - } - - public void testIdentityDiffRange() { - String a = "a"; - String b = "b"; - String c = "c"; - String d = "d"; - String e = "e"; - String a_ = a; - String b_ = b; - String c_ = c; - String d_ = d; - String e_ = e; - assertTrue((a == a_) && a.equals(a_)); - assertTrue((b == b_) && b.equals(b_)); - assertTrue((c == c_) && c.equals(c_)); - assertTrue((d == d_) && d.equals(d_)); - assertTrue((e == e_) && e.equals(e_)); - String[] array1; - String[] array2; - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(new Range(5, -1), ArrayTools.identityDiffRange(array1, array2)); - - array1 = new String[] { a }; - array2 = new String[] { a_ }; - assertEquals(new Range(1, -1), ArrayTools.identityDiffRange(array1, array2)); - - array1 = new String[] { b, c, d, e }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(new Range(0, 4), ArrayTools.identityDiffRange(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { b_, c_, d_, e_ }; - assertEquals(new Range(0, 4), ArrayTools.identityDiffRange(array1, array2)); - - array1 = new String[0]; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(new Range(0, 4), ArrayTools.identityDiffRange(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[0]; - assertEquals(new Range(0, 4), ArrayTools.identityDiffRange(array1, array2)); - - array1 = new String[0]; - array2 = new String[0]; - assertEquals(new Range(0, -1), ArrayTools.identityDiffRange(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { b_, c_, a_, d_, e_ }; - assertEquals(new Range(0, 2), ArrayTools.identityDiffRange(array1, array2)); - - array1 = new String[] { b, c, d, e }; - array2 = new String[] { a_, c_, d_, e_ }; - assertEquals(new Range(0, 0), ArrayTools.identityDiffRange(array1, array2)); - - array1 = new String[] { a, b, c, e }; - array2 = new String[] { a_, b_, c_, d_ }; - assertEquals(new Range(3, 3), ArrayTools.identityDiffRange(array1, array2)); - - String c__ = new String(c); - assertTrue((c != c__) && c.equals(c_)); - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { a_, b_, c__, d_, e_ }; - assertEquals(new Range(2, 2), ArrayTools.identityDiffRange(array1, array2)); - - array1 = new String[] { a, b, null, d, e }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(new Range(2, 2), ArrayTools.identityDiffRange(array1, array2)); - - array1 = new String[] { a, b, null, d, e }; - array2 = new String[] { a_, b_, null, d_, e_ }; - assertEquals(new Range(5, -1), ArrayTools.identityDiffRange(array1, array2)); - } - - public void testIdentityDiffStart() { - String a = "a"; - String b = "b"; - String c = "c"; - String d = "d"; - String e = "e"; - String a_ = a; - String b_ = b; - String c_ = c; - String d_ = d; - String e_ = e; - assertTrue((a == a_) && a.equals(a_)); - assertTrue((b == b_) && b.equals(b_)); - assertTrue((c == c_) && c.equals(c_)); - assertTrue((d == d_) && d.equals(d_)); - assertTrue((e == e_) && e.equals(e_)); - String[] array1; - String[] array2; - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(5, ArrayTools.identityDiffStart(array1, array2)); - - array1 = new String[] { a }; - array2 = new String[] { a_ }; - assertEquals(1, ArrayTools.identityDiffStart(array1, array2)); - - array1 = new String[] { a, b, c, d }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(4, ArrayTools.identityDiffStart(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { a_, b_, c_, d_ }; - assertEquals(4, ArrayTools.identityDiffStart(array1, array2)); - - array1 = new String[0]; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(0, ArrayTools.identityDiffStart(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[0]; - assertEquals(0, ArrayTools.identityDiffStart(array1, array2)); - - array1 = new String[0]; - array2 = new String[0]; - assertEquals(0, ArrayTools.identityDiffStart(array1, array2)); - - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { a_, b_, e_, c_, d_ }; - assertEquals(2, ArrayTools.identityDiffStart(array1, array2)); - - array1 = new String[] { a, b, c, e }; - array2 = new String[] { a_, b_, c_, d_ }; - assertEquals(3, ArrayTools.identityDiffStart(array1, array2)); - - array1 = new String[] { b, c, d, e }; - array2 = new String[] { a_, c_, d_, e_ }; - assertEquals(0, ArrayTools.identityDiffStart(array1, array2)); - - String c__ = new String(c); - assertTrue((c != c__) && c.equals(c_)); - array1 = new String[] { a, b, c, d, e }; - array2 = new String[] { a_, b_, c__, d_, e_ }; - assertEquals(2, ArrayTools.identityDiffStart(array1, array2)); - - array1 = new String[] { a, b, null, d, e }; - array2 = new String[] { a_, b_, c_, d_, e_ }; - assertEquals(2, ArrayTools.identityDiffStart(array1, array2)); - - array1 = new String[] { a, b, null, d, e }; - array2 = new String[] { a_, b_, null, d_, e_ }; - assertEquals(5, ArrayTools.identityDiffStart(array1, array2)); - } - - - // ********** elements are identical ********** - - public void testElementsAreIdenticalObjectArrayObjectArray() { - Object[] a1 = new Object[4]; - for (int i = 0; i < a1.length; i++) { - a1[i] = String.valueOf(i * 1000); - } - - Object[] a2 = new Object[a1.length]; - for (int i = 0; i < a2.length; i++) { - a2[i] = a1[i]; - } - - assertTrue(ArrayTools.elementsAreIdentical(a1, a2)); - a2[2] = "2000"; - assertFalse(ArrayTools.elementsAreIdentical(a1, a2)); - assertTrue(Arrays.equals(a1, a2)); - } - - public void testElementsAreIdenticalObjectArrayObjectArray_BothNull() { - Object[] a1 = null; - Object[] a2 = null; - assertTrue(ArrayTools.elementsAreIdentical(a1, a2)); - } - - public void testElementsAreIdenticalObjectArrayObjectArray_OneNull() { - Object[] a1 = null; - Object[] a2 = new Object[0]; - assertFalse(ArrayTools.elementsAreIdentical(a1, a2)); - } - - public void testElementsAreIdenticalObjectArrayObjectArray_DifferentLengths() { - Object[] a1 = new String[] {"foo", "bar"}; - Object[] a2 = new String[] {"foo", "bar", "baz"}; - assertFalse(ArrayTools.elementsAreIdentical(a1, a2)); - } - - - // ********** index of ********** - - public void testIndexOfObjectArrayObject() { - Object[] a = this.buildObjectArray1(); - assertEquals(1, ArrayTools.indexOf(a, "one")); - } - - public void testIndexOfObjectArrayObject_NotFound() { - Object[] a = this.buildObjectArray1(); - assertEquals(-1, ArrayTools.indexOf(a, "twenty")); - } - - public void testIndexOfObjectArrayObject_Null() { - Object[] a = this.buildObjectArray1(); - a = ArrayTools.add(a, null); - assertEquals(a.length - 1, ArrayTools.indexOf(a, null)); - } - - public void testIndexOfObjectArrayObject_Null_NotFound() { - Object[] a = this.buildObjectArray1(); - assertEquals(-1, ArrayTools.indexOf(a, null)); - } - - public void testIdentityIndexOfObjectArrayObject() { - String foo = "foo"; - String bar = "bar"; - String baz = "baz"; - Object[] a = new Object[3]; - a[0] = foo; - a[1] = bar; - a[2] = baz; - assertEquals(1, ArrayTools.identityIndexOf(a, bar)); - } - - public void testIdentityIndexOfObjectArrayObject_NotFound() { - String foo = "foo"; - String bar = "bar"; - String baz = "baz"; - Object[] a = new Object[3]; - a[0] = foo; - a[1] = bar; - a[2] = baz; - assertEquals(-1, ArrayTools.identityIndexOf(a, new String("bar"))); - } - - public void testIndexOfCharArrayChar() { - char[] a = this.buildCharArray(); - assertEquals(1, ArrayTools.indexOf(a, 'b')); - a = ArrayTools.add(a, 'd'); - assertEquals(a.length - 1, ArrayTools.indexOf(a, 'd')); - } - - public void testIndexOfCharArrayChar_NotFound() { - char[] a = this.buildCharArray(); - assertEquals(-1, ArrayTools.indexOf(a, 'z')); - } - - public void testIndexOfIntArrayInt() { - int[] a = this.buildIntArray(); - assertEquals(1, ArrayTools.indexOf(a, 10)); - a = ArrayTools.add(a, 30); - assertEquals(a.length - 1, ArrayTools.indexOf(a, 30)); - } - - public void testIndexOfIntArrayInt_NotFound() { - int[] a = this.buildIntArray(); - assertEquals(-1, ArrayTools.indexOf(a, 1000)); - } - - - // ********** insertion index of ********** - - public void testInsertionIndexOfObjectArrayComparable() { - String[] a = new String[] { "A", "C", "D" }; - assertEquals(1, ArrayTools.insertionIndexOf(a, "B")); - - a = new String[] { "A", "B", "C", "D" }; - assertEquals(2, ArrayTools.insertionIndexOf(a, "B")); - - a = new String[] { "A", "B", "B", "B", "C", "D" }; - assertEquals(4, ArrayTools.insertionIndexOf(a, "B")); - - a = new String[] { "A", "B", "B", "B", "C", "D" }; - assertEquals(6, ArrayTools.insertionIndexOf(a, "E")); - - a = new String[] { "B", "B", "B", "C", "D" }; - assertEquals(0, ArrayTools.insertionIndexOf(a, "A")); - - a = new String[] { "A", "A", "B", "B", "C", "D" }; - assertEquals(2, ArrayTools.insertionIndexOf(a, "A")); - } - - public void testInsertionIndexOfObjectArrayObjectComparator() { - Comparator c = new ReverseComparator(); - String[] a = new String[] { "D", "C", "A" }; - assertEquals(2, ArrayTools.insertionIndexOf(a, "B", c)); - - a = new String[] { "D", "C", "B", "A" }; - assertEquals(3, ArrayTools.insertionIndexOf(a, "B", c)); - - a = new String[] { "D", "C", "B", "B", "B", "A" }; - assertEquals(5, ArrayTools.insertionIndexOf(a, "B", c)); - - a = new String[] { "D", "C", "B", "B", "B", "A" }; - assertEquals(0, ArrayTools.insertionIndexOf(a, "E", c)); - - a = new String[] { "D", "C", "B", "B", "B" }; - assertEquals(5, ArrayTools.insertionIndexOf(a, "A", c)); - - a = new String[] { "D", "C", "B", "B", "A", "A" }; - assertEquals(6, ArrayTools.insertionIndexOf(a, "A", c)); - } - - - // ********** last index of ********** - - public void testLastIndexOfObjectArrayObject() { - Object[] a = this.buildObjectArray1(); - assertEquals(1, ArrayTools.lastIndexOf(a, "one")); - } - - public void testLastIndexOfObjectArrayObject_NotFound() { - Object[] a = this.buildObjectArray1(); - assertEquals(-1, ArrayTools.lastIndexOf(a, "twenty")); - } - - public void testLastIndexOfObjectArrayObject_Null() { - Object[] a = this.buildObjectArray1(); - a = ArrayTools.add(a, null); - assertEquals(a.length - 1, ArrayTools.lastIndexOf(a, null)); - } - - public void testLastIndexOfObjectArrayObject_Null_NotFound() { - Object[] a = this.buildObjectArray1(); - assertEquals(-1, ArrayTools.lastIndexOf(a, null)); - } - - public void testLastIndexOfCharArrayChar() { - char[] a = this.buildCharArray(); - assertEquals(1, ArrayTools.lastIndexOf(a, 'b')); - a = ArrayTools.add(a, 'd'); - assertEquals(a.length - 1, ArrayTools.lastIndexOf(a, 'd')); - } - - public void testLastIndexOfCharArrayChar_NotFound() { - char[] a = this.buildCharArray(); - assertEquals(-1, ArrayTools.lastIndexOf(a, 'z')); - } - - public void testLastIndexOfIntArrayInt() { - int[] a = this.buildIntArray(); - assertEquals(1, ArrayTools.lastIndexOf(a, 10)); - a = ArrayTools.add(a, 30); - assertEquals(a.length - 1, ArrayTools.lastIndexOf(a, 30)); - } - - public void testLastIndexOfIntArrayInt_NotFound() { - int[] a = this.buildIntArray(); - assertEquals(-1, ArrayTools.lastIndexOf(a, 1000)); - } - - - // ********** min/max ********** - - public void testMinCharArray() { - assertEquals('a', ArrayTools.min(this.buildCharArray())); - } - - public void testMinCharArray_Exception() { - char[] array = new char[0]; - boolean exCaught = false; - try { - char c = ArrayTools.min(array); - fail("bogus char: " + c); - } catch (IndexOutOfBoundsException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testMinIntArray() { - assertEquals(0, ArrayTools.min(this.buildIntArray())); - } - - public void testMinIntArray_Exception() { - int[] array = new int[0]; - boolean exCaught = false; - try { - int i = ArrayTools.min(array); - fail("bogus int: " + i); - } catch (IndexOutOfBoundsException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testMaxCharArray1() { - assertEquals('c', ArrayTools.max(this.buildCharArray())); - } - - public void testMaxCharArray2() { - char[] array = new char[] { 'x', 'a', 'b', 'c' }; - assertEquals('x', ArrayTools.max(array)); - } - - public void testMaxCharArray_Exception() { - char[] array = new char[0]; - boolean exCaught = false; - try { - char c = ArrayTools.max(array); - fail("bogus char: " + c); - } catch (IndexOutOfBoundsException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testMaxIntArray1() { - assertEquals(20, ArrayTools.max(this.buildIntArray())); - } - - public void testMaxIntArray2() { - int[] array = new int[] { 77, 3, 1, -3 }; - assertEquals(77, ArrayTools.max(array)); - } - - public void testMaxIntArray_Exception() { - int[] array = new int[0]; - boolean exCaught = false; - try { - int i = ArrayTools.max(array); - fail("bogus int: " + i); - } catch (IndexOutOfBoundsException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - - // ********** move ********** - - public void testMoveObjectArrayIntInt() { - String[] array = new String[] { "0", "1", "2", "3", "4", "5" }; - - String[] result = ArrayTools.move(array, 4, 2); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "0", "1", "3", "4", "2", "5" }, result)); - - result = ArrayTools.move(array, 0, 5); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "1", "3", "4", "2" }, result)); - - result = ArrayTools.move(array, 2, 4); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "4", "1", "3", "2" }, result)); - - result = ArrayTools.move(array, 4, 4); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "4", "1", "3", "2" }, result)); - } - - public void testMoveObjectArrayIntIntInt() { - String[] array = new String[] { "0", "1", "2", "3", "4", "5" }; - - String[] result = ArrayTools.move(array, 4, 2, 1); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "0", "1", "3", "4", "2", "5" }, result)); - - result = ArrayTools.move(array, 0, 5, 1); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "1", "3", "4", "2" }, result)); - - result = ArrayTools.move(array, 2, 4, 1); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "4", "1", "3", "2" }, result)); - - result = ArrayTools.move(array, 2, 4, 2); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "3", "2", "4", "1" }, result)); - - result = ArrayTools.move(array, 0, 1, 4); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "0", "3", "2", "4", "5", "1" }, result)); - - result = ArrayTools.move(array, 1, 0, 4); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "3", "2", "4", "1" }, result)); - - result = ArrayTools.move(array, 1, 1, 4); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "3", "2", "4", "1" }, result)); - - result = ArrayTools.move(array, 1, 0, 0); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "3", "2", "4", "1" }, result)); - } - - public void testMoveIntArrayIntInt() { - int[] array = new int[] { 0, 1, 2, 3, 4, 5 }; - - int[] result = ArrayTools.move(array, 4, 2); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new int[] { 0, 1, 3, 4, 2, 5 }, result)); - - result = ArrayTools.move(array, 0, 5); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new int[] { 5, 0, 1, 3, 4, 2 }, result)); - - result = ArrayTools.move(array, 2, 4); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new int[] { 5, 0, 4, 1, 3, 2 }, result)); - - result = ArrayTools.move(array, 2, 2); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new int[] { 5, 0, 4, 1, 3, 2 }, result)); - } - - public void testMoveIntArrayIntIntInt() { - int[] array = new int[] { 0, 1, 2, 3, 4, 5 }; - - int[] result = ArrayTools.move(array, 4, 2, 1); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new int[] { 0, 1, 3, 4, 2, 5 }, result)); - - result = ArrayTools.move(array, 0, 5, 1); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new int[] { 5, 0, 1, 3, 4, 2 }, result)); - - result = ArrayTools.move(array, 2, 4, 1); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new int[] { 5, 0, 4, 1, 3, 2 }, result)); - - result = ArrayTools.move(array, 2, 4, 2); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new int[] { 5, 0, 3, 2, 4, 1 }, result)); - - result = ArrayTools.move(array, 0, 1, 4); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new int[] { 0, 3, 2, 4, 5, 1 }, result)); - - result = ArrayTools.move(array, 1, 0, 4); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new int[] { 5, 0, 3, 2, 4, 1 }, result)); - - result = ArrayTools.move(array, 1, 1, 4); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new int[] { 5, 0, 3, 2, 4, 1 }, result)); - - result = ArrayTools.move(array, 1, 0, 0); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new int[] { 5, 0, 3, 2, 4, 1 }, result)); - } - - public void testMoveCharArrayIntInt() { - char[] array = new char[] { 'a', 'b', 'c', 'd', 'e', 'f' }; - - char[] result = ArrayTools.move(array, 4, 2); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new char[] { 'a', 'b', 'd', 'e', 'c', 'f' }, result)); - - result = ArrayTools.move(array, 0, 5); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new char[] { 'f', 'a', 'b', 'd', 'e', 'c' }, result)); - - result = ArrayTools.move(array, 2, 4); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new char[] { 'f', 'a', 'e', 'b', 'd', 'c' }, result)); - - result = ArrayTools.move(array, 2, 2); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new char[] { 'f', 'a', 'e', 'b', 'd', 'c' }, result)); - } - - public void testMoveCharArrayIntIntInt() { - char[] array = new char[] { 'a', 'b', 'b', 'c', 'd', 'e' }; - - char[] result = ArrayTools.move(array, 4, 2, 1); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new char[] { 'a', 'b', 'c', 'd', 'b', 'e' }, result)); - - result = ArrayTools.move(array, 0, 5, 1); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new char[] { 'e', 'a', 'b', 'c', 'd', 'b' }, result)); - - result = ArrayTools.move(array, 2, 4, 1); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new char[] { 'e', 'a', 'd', 'b', 'c', 'b' }, result)); - - result = ArrayTools.move(array, 2, 4, 2); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new char[] { 'e', 'a', 'c', 'b', 'd', 'b' }, result)); - - result = ArrayTools.move(array, 0, 1, 4); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new char[] { 'a', 'c', 'b', 'd', 'e', 'b' }, result)); - - result = ArrayTools.move(array, 1, 0, 4); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new char[] { 'e', 'a', 'c', 'b', 'd', 'b' }, result)); - - result = ArrayTools.move(array, 1, 1, 4); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new char[] { 'e', 'a', 'c', 'b', 'd', 'b' }, result)); - - result = ArrayTools.move(array, 1, 0, 0); - assertSame(array, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new char[] { 'e', 'a', 'c', 'b', 'd', 'b' }, result)); - } - - - // ********** remove ********** - - public void testRemoveObjectArrayObject_Object() { - Object[] a = this.buildObjectArray1(); - a = ArrayTools.add(a, "three"); - a = ArrayTools.add(a, "four"); - a = ArrayTools.add(a, "five"); - - assertEquals(6, a.length); - assertTrue(ArrayTools.contains(a, "three")); - a = ArrayTools.remove(a, "three"); - assertEquals(5, a.length); - assertFalse(ArrayTools.contains(a, "three")); - assertTrue(ArrayTools.contains(a, "four")); - assertTrue(ArrayTools.contains(a, "five")); - } - - public void testRemoveObjectArrayObject_String() { - String[] a = this.buildStringArray1(); - a = ArrayTools.add(a, "three"); - a = ArrayTools.add(a, "four"); - a = ArrayTools.add(a, "five"); - - assertEquals(6, a.length); - assertTrue(ArrayTools.contains(a, "three")); - a = ArrayTools.remove(a, "three"); - assertEquals(5, a.length); - assertFalse(ArrayTools.contains(a, "three")); - assertTrue(ArrayTools.contains(a, "four")); - assertTrue(ArrayTools.contains(a, "five")); - } - - public void testRemoveCharArrayChar() { - char[] a = this.buildCharArray(); - a = ArrayTools.add(a, 'd'); - a = ArrayTools.add(a, 'e'); - a = ArrayTools.add(a, 'f'); - - assertEquals(6, a.length); - assertTrue(ArrayTools.contains(a, 'd')); - a = ArrayTools.remove(a, 'd'); - assertEquals(5, a.length); - assertFalse(ArrayTools.contains(a, 'd')); - assertTrue(ArrayTools.contains(a, 'e')); - assertTrue(ArrayTools.contains(a, 'f')); - } - - public void testRemoveIntArrayInt() { - int[] a = this.buildIntArray(); - a = ArrayTools.add(a, 30); - a = ArrayTools.add(a, 40); - a = ArrayTools.add(a, 50); - - assertEquals(6, a.length); - assertTrue(ArrayTools.contains(a, 30)); - a = ArrayTools.remove(a, 30); - assertEquals(5, a.length); - assertFalse(ArrayTools.contains(a, 30)); - assertTrue(ArrayTools.contains(a, 40)); - assertTrue(ArrayTools.contains(a, 50)); - } - - - // ********** remove all ********** - - public void testRemoveAllObjectArrayObjectArray() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - String[] a2 = new String[] { "E", "B" }; - String[] a3 = ArrayTools.removeAll(a1, (Object[]) a2); - assertTrue(Arrays.equals(new String[] { "A", "A", "C", "C", "D", "D", "F", "F" }, a3)); - } - - public void testRemoveAllObjectArrayObjectArray_Empty() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - String[] a2 = new String[0]; - String[] a3 = ArrayTools.removeAll(a1, (Object[]) a2); - assertTrue(Arrays.equals(a1, a3)); - } - - public void testRemoveAllObjectArrayObjectArray_NoMatches() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - String[] a2 = new String[] { "X", "Y", "Z" }; - String[] a3 = ArrayTools.removeAll(a1, (Object[]) a2); - assertTrue(Arrays.equals(a1, a3)); - } - - public void testRemoveAllObjectArrayIterable() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - Iterable iterable = Arrays.asList(new String[] { "E", "B" }); - String[] a3 = ArrayTools.removeAll(a1, iterable); - assertTrue(Arrays.equals(new String[] { "A", "A", "C", "C", "D", "D", "F", "F" }, a3)); - } - - public void testRemoveAllObjectArrayIterableInt() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - Iterable iterable = Arrays.asList(new String[] { "E", "B" }); - String[] a3 = ArrayTools.removeAll(a1, iterable, 7); - assertTrue(Arrays.equals(new String[] { "A", "A", "C", "C", "D", "D", "F", "F" }, a3)); - } - - public void testRemoveAllObjectArrayIterator() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - Iterable iterable = Arrays.asList(new String[] { "E", "B" }); - String[] a3 = ArrayTools.removeAll(a1, iterable.iterator()); - assertTrue(Arrays.equals(new String[] { "A", "A", "C", "C", "D", "D", "F", "F" }, a3)); - } - - public void testRemoveAllObjectArrayIterator_Empty() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - String[] a3 = ArrayTools.removeAll(a1, EmptyIterator.instance()); - assertTrue(Arrays.equals(a1, a3)); - } - - public void testRemoveAllObjectArrayIteratorInt() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - Iterable iterable = Arrays.asList(new String[] { "E", "B" }); - String[] a3 = ArrayTools.removeAll(a1, iterable.iterator(), 7); - assertTrue(Arrays.equals(new String[] { "A", "A", "C", "C", "D", "D", "F", "F" }, a3)); - } - - public void testRemoveAllObjectArrayIteratorInt_Empty() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - String[] a3 = ArrayTools.removeAll(a1, EmptyIterator.instance(), 7); - assertTrue(Arrays.equals(a1, a3)); - } - - public void testRemoveAllObjectArrayCollection() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - Collection collection = Arrays.asList(new String[] { "E", "B" }); - String[] a3 = ArrayTools.removeAll(a1, collection); - assertTrue(Arrays.equals(new String[] { "A", "A", "C", "C", "D", "D", "F", "F" }, a3)); - } - - public void testRemoveAllObjectArrayCollection_Empty() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - Collection collection = new ArrayList(); - String[] a3 = ArrayTools.removeAll(a1, collection); - assertTrue(Arrays.equals(a1, a3)); - } - - public void testRemoveAllObjectArrayCollection_EmptyArray() { - String[] a1 = new String[0]; - Collection collection = Arrays.asList(new String[] { "E", "B" }); - String[] a3 = ArrayTools.removeAll(a1, collection); - assertTrue(Arrays.equals(a1, a3)); - assertEquals(0, a3.length); - } - - public void testRemoveAllObjectArrayCollection_NoMatches() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - Collection collection = Arrays.asList(new String[] { "X", "Y", "Z" }); - String[] a3 = ArrayTools.removeAll(a1, collection); - assertTrue(Arrays.equals(a1, a3)); - } - - public void testRemoveAllCharArrayCharArray() { - char[] a1 = new char[] { 'A', 'A', 'B', 'B', 'C', 'C', 'D', 'D', 'E', 'E', 'F', 'F' }; - char[] a2 = new char[] { 'E', 'B' }; - assertTrue(Arrays.equals(new char[] { 'A', 'A', 'C', 'C', 'D', 'D', 'F', 'F' }, ArrayTools.removeAll(a1, a2))); - } - - public void testRemoveAllCharArrayCharArray_Empty1() { - char[] a1 = new char[0]; - char[] a2 = new char[] { 'E', 'B' }; - assertTrue(Arrays.equals(a1, ArrayTools.removeAll(a1, a2))); - } - - public void testRemoveAllCharArrayCharArray_Empty2() { - char[] a1 = new char[] { 'A', 'A', 'B', 'B', 'C', 'C', 'D', 'D', 'E', 'E', 'F', 'F' }; - char[] a2 = new char[0]; - assertTrue(Arrays.equals(a1, ArrayTools.removeAll(a1, a2))); - } - - public void testRemoveAllCharArrayCharArray_NoMatches() { - char[] a1 = new char[] { 'A', 'A', 'B', 'B', 'C', 'C', 'D', 'D', 'E', 'E', 'F', 'F' }; - char[] a2 = new char[] { 'X', 'Z' }; - assertTrue(Arrays.equals(a1, ArrayTools.removeAll(a1, a2))); - } - - public void testRemoveAllIntArrayIntArray() { - int[] a1 = new int[] { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 }; - int[] a2 = new int[] { 5, 2 }; - assertTrue(Arrays.equals(new int[] { 1, 1, 3, 3, 4, 4, 6, 6 }, ArrayTools.removeAll(a1, a2))); - } - - public void testRemoveAllIntArrayIntArray_Empty1() { - int[] a1 = new int[0]; - int[] a2 = new int[] { 5, 2 }; - assertTrue(Arrays.equals(a1, ArrayTools.removeAll(a1, a2))); - } - - public void testRemoveAllIntArrayIntArray_Empty2() { - int[] a1 = new int[] { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 }; - int[] a2 = new int[0]; - assertTrue(Arrays.equals(a1, ArrayTools.removeAll(a1, a2))); - } - - public void testRemoveAllIntArrayIntArray_NoMatches() { - int[] a1 = new int[] { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 }; - int[] a2 = new int[] { 52, 67 }; - assertTrue(Arrays.equals(a1, ArrayTools.removeAll(a1, a2))); - } - - - // ********** remove all occurrences ********** - - public void testRemoveAllOccurrencesObjectArrayObject() { - String[] a = this.buildStringArray1(); - assertEquals(3, a.length); - a = ArrayTools.removeAllOccurrences(a, "three"); - assertEquals(3, a.length); - a = ArrayTools.removeAllOccurrences(a, "two"); - assertEquals(2, a.length); - a = ArrayTools.removeAllOccurrences(a, "two"); - assertEquals(2, a.length); - - a = ArrayTools.add(a, "five"); - a = ArrayTools.add(a, "five"); - a = ArrayTools.add(a, "five"); - assertEquals(5, a.length); - a = ArrayTools.removeAllOccurrences(a, "five"); - assertEquals(2, a.length); - a = ArrayTools.removeAllOccurrences(a, "five"); - assertEquals(2, a.length); - - a = ArrayTools.add(a, null); - a = ArrayTools.add(a, null); - a = ArrayTools.add(a, null); - assertEquals(5, a.length); - a = ArrayTools.removeAllOccurrences(a, null); - assertEquals(2, a.length); - a = ArrayTools.removeAllOccurrences(a, null); - assertEquals(2, a.length); - } - - public void testRemoveAllOccurrencesObjectArrayObject_Empty() { - String[] a = new String[0]; - a = ArrayTools.removeAllOccurrences(a, "three"); - assertEquals(0, a.length); - } - - public void testRemoveAllOccurrencesCharArrayChar() { - char[] a = this.buildCharArray(); - assertEquals(3, a.length); - a = ArrayTools.removeAllOccurrences(a, 'd'); - assertEquals(3, a.length); - a = ArrayTools.removeAllOccurrences(a, 'b'); - assertEquals(2, a.length); - a = ArrayTools.removeAllOccurrences(a, 'b'); - assertEquals(2, a.length); - - a = ArrayTools.add(a, 'g'); - a = ArrayTools.add(a, 'g'); - a = ArrayTools.add(a, 'g'); - assertEquals(5, a.length); - a = ArrayTools.removeAllOccurrences(a, 'g'); - assertEquals(2, a.length); - a = ArrayTools.removeAllOccurrences(a, 'g'); - assertEquals(2, a.length); - } - - public void testRemoveAllOccurrencesCharArrayChar_Empty() { - char[] a = new char[0]; - a = ArrayTools.removeAllOccurrences(a, 'a'); - assertEquals(0, a.length); - } - - public void testRemoveAllOccurrencesIntArrayInt() { - int[] a = this.buildIntArray(); - assertEquals(3, a.length); - a = ArrayTools.removeAllOccurrences(a, 55); - assertEquals(3, a.length); - a = ArrayTools.removeAllOccurrences(a, 10); - assertEquals(2, a.length); - a = ArrayTools.removeAllOccurrences(a, 10); - assertEquals(2, a.length); - - a = ArrayTools.add(a, 77); - a = ArrayTools.add(a, 77); - a = ArrayTools.add(a, 77); - assertEquals(5, a.length); - a = ArrayTools.removeAllOccurrences(a, 77); - assertEquals(2, a.length); - a = ArrayTools.removeAllOccurrences(a, 77); - assertEquals(2, a.length); - } - - public void testRemoveAllOccurrencesIntArrayInt_Empty() { - int[] a = new int[0]; - a = ArrayTools.removeAllOccurrences(a, 22); - assertEquals(0, a.length); - } - - - // ********** remove duplicate elements ********** - - public void testRemoveDuplicateElementsObjectArray() { - List list = this.buildStringVector1(); - list.add("zero"); - list.add("zero"); - list.add("two"); - list.add("zero"); - String[] array = ArrayTools.removeDuplicateElements(list.toArray(new String[list.size()])); - int i = 0; - assertEquals("zero", array[i++]); - assertEquals("one", array[i++]); - assertEquals("two", array[i++]); - assertEquals(i, array.length); - } - - public void testRemoveDuplicateElementsObjectArray_Empty() { - String[] array = ArrayTools.removeDuplicateElements(new String[0]); - assertEquals(0, array.length); - } - - public void testRemoveDuplicateElementsObjectArray_SingleElement() { - String[] array = ArrayTools.removeDuplicateElements(new String[] { "foo" }); - assertEquals(1, array.length); - } - - public void testRemoveDuplicateElementsObjectArray_NoDuplicates() { - String[] a1 = new String[] { "foo", "bar", "baz" }; - String[] a2 = ArrayTools.removeDuplicateElements(a1); - assertEquals(3, a2.length); - assertTrue(Arrays.equals(a1, a2)); - } - - - // ********** remove element at index ********** - - public void testRemoveElementAtIndexObjectArrayInt() { - String[] a = new String[] { "A", "B", "A", "C", "A", "D" }; - a = ArrayTools.removeElementAtIndex(a, 3); - assertTrue(Arrays.equals(new String[] { "A", "B", "A", "A", "D" }, a)); - } - - public void testRemoveElementAtIndexCharArrayInt() { - char[] a = new char[] { 'A', 'B', 'A', 'C', 'A', 'D' }; - a = ArrayTools.removeElementAtIndex(a, 3); - assertTrue(Arrays.equals(new char[] { 'A', 'B', 'A', 'A', 'D' }, a)); - } - - public void testRemoveElementAtIndexIntArrayInt() { - int[] a = new int[] { 8, 6, 7, 33, 2, 11 }; - a = ArrayTools.removeElementsAtIndex(a, 3, 3); - assertTrue(Arrays.equals(new int[] { 8, 6, 7 }, a)); - } - - public void testRemoveFirstObjectArray() { - String[] a = new String[] { "A", "B", "A", "C", "A", "D" }; - a = ArrayTools.removeFirst(a); - assertTrue(Arrays.equals(new String[] { "B", "A", "C", "A", "D" }, a)); - } - - public void testRemoveFirstCharArray() { - char[] a = new char[] { 'A', 'B', 'A', 'C', 'A', 'D' }; - a = ArrayTools.removeFirst(a); - assertTrue(Arrays.equals(new char[] { 'B', 'A', 'C', 'A', 'D' }, a)); - } - - public void testRemoveFirstIntArray() { - int[] a = new int[] { 8, 6, 7, 33, 2, 11 }; - a = ArrayTools.removeFirst(a); - assertTrue(Arrays.equals(new int[] { 6, 7, 33, 2, 11 }, a)); - } - - public void testRemoveLastObjectArray() { - String[] a = new String[] { "A", "B", "A", "C", "A", "D" }; - a = ArrayTools.removeLast(a); - assertTrue(Arrays.equals(new String[] { "A", "B", "A", "C", "A" }, a)); - } - - public void testRemoveLastCharArray() { - char[] a = new char[] { 'A', 'B', 'A', 'C', 'A', 'D' }; - a = ArrayTools.removeLast(a); - assertTrue(Arrays.equals(new char[] { 'A', 'B', 'A', 'C', 'A' }, a)); - } - - public void testRemoveLastIntArray() { - int[] a = new int[] { 8, 6, 7, 33, 2, 11 }; - a = ArrayTools.removeLast(a); - assertTrue(Arrays.equals(new int[] { 8, 6, 7, 33, 2 }, a)); - } - - - // ********** remove elements at index ********** - - public void testRemoveElementsAtIndexObjectArrayIntInt() { - String[] a = new String[] { "A", "B", "A", "C", "A", "D" }; - a = ArrayTools.removeElementsAtIndex(a, 3, 2); - assertTrue(Arrays.equals(new String[] { "A", "B", "A", "D" }, a)); - } - - public void testRemoveElementsAtIndexObjectArrayIntInt_ZeroLength() { - String[] a1 = new String[] { "A", "B", "A", "C", "A", "D" }; - String[] a2 = ArrayTools.removeElementsAtIndex(a1, 3, 0); - assertTrue(Arrays.equals(a1, a2)); - } - - public void testRemoveElementsAtIndexObjectArrayIntInt_Empty() { - String[] a = new String[] { "A", "B", "A", "C", "A", "D" }; - a = ArrayTools.removeElementsAtIndex(a, 0, 6); - assertEquals(0, a.length); - } - - public void testRemoveElementsAtIndexCharArrayIntInt() { - char[] a = new char[] { 'A', 'B', 'A', 'C', 'A', 'D' }; - a = ArrayTools.removeElementsAtIndex(a, 0, 5); - assertTrue(Arrays.equals(new char[] { 'D' }, a)); - } - - public void testRemoveElementsAtIndexCharArrayIntInt_ZeroLength() { - char[] a1 = new char[] { 'A', 'B', 'A', 'C', 'A', 'D' }; - char[] a2 = ArrayTools.removeElementsAtIndex(a1, 3, 0); - assertTrue(Arrays.equals(a1, a2)); - } - - public void testRemoveElementsAtIndexCharArrayIntInt_Empty() { - char[] a = new char[] { 'A', 'B', 'A', 'C', 'A', 'D' }; - a = ArrayTools.removeElementsAtIndex(a, 0, 6); - assertEquals(0, a.length); - } - - public void testRemoveElementsAtIndexIntArrayIntInt() { - int[] a = new int[] { 8, 6, 7, 33, 2, 11 }; - a = ArrayTools.removeElementsAtIndex(a, 3, 3); - assertTrue(Arrays.equals(new int[] { 8, 6, 7 }, a)); - } - - public void testRemoveElementsAtIndexIntArrayIntInt_ZeroLength() { - int[] a1 = new int[] { 8, 6, 7, 33, 2, 11 }; - int[] a2 = ArrayTools.removeElementsAtIndex(a1, 3, 0); - assertTrue(Arrays.equals(a1, a2)); - } - - public void testRemoveElementsAtIndexIntArrayIntInt_Empty() { - int[] a = new int[] { 8, 6, 7, 33, 2, 11 }; - a = ArrayTools.removeElementsAtIndex(a, 0, 6); - assertEquals(0, a.length); - } - - - // ********** replace all ********** - - public void testReplaceAllObjectArrayObjectObject_Object() { - Object[] a = new Object[] { "A", "B", "A", "C", "A", "D" }; - a = ArrayTools.replaceAll(a, "A", "Z"); - assertTrue(Arrays.equals(new Object[] { "Z", "B", "Z", "C", "Z", "D" }, a)); - } - - public void testReplaceAllObjectArrayObjectObject_String() { - String[] a = new String[] { "A", "B", "A", "C", "A", "D" }; - a = ArrayTools.replaceAll(a, "A", "Z"); - assertTrue(Arrays.equals(new String[] { "Z", "B", "Z", "C", "Z", "D" }, a)); - } - - public void testReplaceAllObjectArrayObjectObject_Null() { - String[] a = new String[] { null, "B", null, "C", null, "D" }; - a = ArrayTools.replaceAll(a, null, "Z"); - assertTrue(Arrays.equals(new String[] { "Z", "B", "Z", "C", "Z", "D" }, a)); - } - - public void testReplaceAllCharArrayCharChar() { - char[] a = new char[] { 'A', 'B', 'A', 'C', 'A', 'D' }; - a = ArrayTools.replaceAll(a, 'A', 'Z'); - assertTrue(Arrays.equals(new char[] { 'Z', 'B', 'Z', 'C', 'Z', 'D' }, a)); - } - - public void testReplaceAllIntArrayIntInt() { - int[] a = new int[] { 0, 1, 0, 7, 0, 99 }; - a = ArrayTools.replaceAll(a, 0, 13); - assertTrue(Arrays.equals(new int[] { 13, 1, 13, 7, 13, 99 }, a)); - } - - - // ********** retain all ********** - - public void testRetainAllObjectArrayObjectArray() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - Object[] a2 = new Object[] { "E", "B", new Integer(7) }; - assertTrue(Arrays.equals(new String[] { "B", "B", "E", "E" }, ArrayTools.retainAll(a1, a2))); - } - - public void testRetainAllObjectArrayObjectArray_EmptyObjectArray1() { - String[] a1 = new String[0]; - String[] a2 = new String[] { "E", "B", "" }; - String[] a3 = ArrayTools.retainAll(a1, a2); - assertEquals(0, a3.length); - } - - public void testRetainAllObjectArrayObjectArray_EmptyObjectArray2() { - String[] a1 = new String[] { "E", "B", "" }; - String[] a2 = new String[0]; - String[] a3 = ArrayTools.retainAll(a1, a2); - assertEquals(0, a3.length); - } - - public void testRetainAllObjectArrayObjectArray_BothEmpty() { - String[] a1 = new String[0]; - String[] a2 = new String[0]; - String[] a3 = ArrayTools.retainAll(a1, a2); - assertEquals(0, a3.length); - } - - public void testRetainAllObjectArrayIterable() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - Iterable iterable = Arrays.asList(new String[] { "E", "B", "" }); - assertTrue(Arrays.equals(new String[] { "B", "B", "E", "E" }, ArrayTools.retainAll(a1, iterable))); - } - - public void testRetainAllObjectArrayIterable_EmptyObjectArray() { - String[] a1 = new String[0]; - Iterable iterable = Arrays.asList(new String[] { "E", "B", "" }); - String[] a3 = ArrayTools.retainAll(a1, iterable); - assertEquals(0, a3.length); - } - - public void testRetainAllObjectArrayIterableInt() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - Iterable iterable = Arrays.asList(new String[] { "E", "B", "" }); - assertTrue(Arrays.equals(new String[] { "B", "B", "E", "E" }, ArrayTools.retainAll(a1, iterable, 3))); - } - - public void testRetainAllObjectArrayIterableInt_EmptyObjectArray() { - String[] a1 = new String[0]; - Iterable iterable = Arrays.asList(new String[] { "E", "B", "" }); - String[] a3 = ArrayTools.retainAll(a1, iterable, 3); - assertEquals(0, a3.length); - } - - public void testRetainAllObjectArrayIterator() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - Iterator iterator = Arrays.asList(new String[] { "E", "B", "" }).iterator(); - assertTrue(Arrays.equals(new String[] { "B", "B", "E", "E" }, ArrayTools.retainAll(a1, iterator))); - } - - public void testRetainAllObjectArrayIterator_EmptyObjectArray() { - String[] a1 = new String[0]; - Iterator iterator = Arrays.asList(new String[] { "E", "B", "" }).iterator(); - String[] a3 = ArrayTools.retainAll(a1, iterator); - assertEquals(0, a3.length); - } - - public void testRetainAllObjectArrayIterator_EmptyIterator() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - assertTrue(Arrays.equals(new String[0], ArrayTools.retainAll(a1, EmptyIterator.instance()))); - } - - public void testRetainAllObjectArrayIteratorInt() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - Iterator iterator = Arrays.asList(new String[] { "E", "B", "" }).iterator(); - assertTrue(Arrays.equals(new String[] { "B", "B", "E", "E" }, ArrayTools.retainAll(a1, iterator, 3))); - } - - public void testRetainAllObjectArrayIteratorInt_EmptyIterator() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - assertTrue(Arrays.equals(new String[0], ArrayTools.retainAll(a1, EmptyIterator.instance(), 3))); - } - - public void testRetainAllObjectArrayIteratorInt_EmptyObjectArray() { - String[] a1 = new String[0]; - Iterator iterator = Arrays.asList(new String[] { "E", "B", "" }).iterator(); - String[] a3 = ArrayTools.retainAll(a1, iterator, 3); - assertEquals(0, a3.length); - } - - public void testRetainAllObjectArrayCollection() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - Collection collection = Arrays.asList(new String[] { "E", "B", "" }); - assertTrue(Arrays.equals(new String[] { "B", "B", "E", "E" }, ArrayTools.retainAll(a1, collection))); - } - - public void testRetainAllObjectArrayCollection_EmptyObjectArray() { - String[] a1 = new String[0]; - Collection collection = Arrays.asList(new String[] { "E", "B", "" }); - String[] a3 = ArrayTools.retainAll(a1, collection); - assertEquals(0, a3.length); - } - - public void testRetainAllObjectArrayCollection_EmptyCollection() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - Collection collection = new ArrayList(); - String[] a3 = ArrayTools.retainAll(a1, collection); - assertEquals(0, a3.length); - } - - public void testRetainAllObjectArrayCollection_All() { - String[] a1 = new String[] { "A", "A", "B", "B", "C", "C", "D", "D", "E", "E", "F", "F" }; - Collection collection = Arrays.asList(new String[] { "A", "B", "C", "D", "E", "F" }); - assertTrue(Arrays.equals(a1, ArrayTools.retainAll(a1, collection))); - } - - public void testRetainAllCharArrayCharArray() { - char[] a1 = new char[] { 'A', 'A', 'B', 'B', 'C', 'C', 'D', 'D', 'E', 'E', 'F', 'F' }; - char[] a2 = new char[] { 'E', 'B' }; - assertTrue(Arrays.equals(new char[] { 'B', 'B', 'E', 'E' }, ArrayTools.retainAll(a1, a2))); - } - - public void testRetainAllCharArrayCharArray_EmptyCharArray1() { - char[] a1 = new char[0]; - char[] a2 = new char[] { 'E', 'B' }; - assertSame(a1, ArrayTools.retainAll(a1, a2)); - } - - public void testRetainAllCharArrayCharArray_EmptyCharArray2() { - char[] a1 = new char[] { 'E', 'B' }; - char[] a2 = new char[0]; - assertEquals(0, ArrayTools.retainAll(a1, a2).length); - } - - public void testRetainAllCharArrayCharArray_RetainAll() { - char[] a1 = new char[] { 'E', 'B', 'E', 'B', 'E', 'B', 'E', 'B', 'E' }; - char[] a2 = new char[] { 'E', 'B' }; - assertSame(a1, ArrayTools.retainAll(a1, a2)); - } - - public void testRetainAllIntArrayIntArray() { - int[] a1 = new int[] { 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6 }; - int[] a2 = new int[] { 5, 2 }; - assertTrue(Arrays.equals(new int[] { 2, 2, 5, 5 }, ArrayTools.retainAll(a1, a2))); - } - - public void testRetainAllIntArrayIntArray_EmptyIntArray1() { - int[] a1 = new int[0]; - int[] a2 = new int[] { 5, 2 }; - assertSame(a1, ArrayTools.retainAll(a1, a2)); - } - - public void testRetainAllIntArrayIntArray_EmptyIntArray2() { - int[] a1 = new int[] { 5, 2 }; - int[] a2 = new int[0]; - assertEquals(0, ArrayTools.retainAll(a1, a2).length); - } - - public void testRetainAllIntArrayIntArray_RetainAll() { - int[] a1 = new int[] { 5, 2, 5, 2, 5, 2, 5, 2, 5, 2, 5 }; - int[] a2 = new int[] { 5, 2 }; - assertSame(a1, ArrayTools.retainAll(a1, a2)); - } - - - // ********** reverse ********** - - public void testReverseObjectArray_Object() { - Object[] a = this.buildObjectArray1(); - a = ArrayTools.reverse(a); - assertEquals("two", a[0]); - assertEquals("one", a[1]); - assertEquals("zero", a[2]); - } - - public void testReverseObjectArray_String() { - String[] a = this.buildStringArray1(); - a = ArrayTools.reverse(a); - assertEquals("two", a[0]); - assertEquals("one", a[1]); - assertEquals("zero", a[2]); - } - - public void testReverseObjectArray_Singleton() { - String[] a1 = new String[] { "foo" }; - String[] a2 = ArrayTools.reverse(a1); - assertTrue(Arrays.equals(a1, a2)); - } - - public void testReverseCharArray() { - char[] a = this.buildCharArray(); - a = ArrayTools.reverse(a); - assertEquals('c', a[0]); - assertEquals('b', a[1]); - assertEquals('a', a[2]); - } - - public void testReverseCharArray_Singleton() { - char[] a1 = new char[] { 'f' }; - char[] a2 = ArrayTools.reverse(a1); - assertTrue(Arrays.equals(a1, a2)); - } - - public void testReverseIntArray() { - int[] a = this.buildIntArray(); - a = ArrayTools.reverse(a); - assertEquals(20, a[0]); - assertEquals(10, a[1]); - assertEquals(0, a[2]); - } - - public void testReverseIntArray_Singleton() { - int[] a1 = new int[] { 7 }; - int[] a2 = ArrayTools.reverse(a1); - assertTrue(Arrays.equals(a1, a2)); - } - - - // ********** rotate ********** - - public void testRotateObjectArray() { - String[] a = this.buildStringArray1(); - a = ArrayTools.rotate(a); - assertEquals("two", a[0]); - assertEquals("zero", a[1]); - assertEquals("one", a[2]); - } - - public void testRotateObjectArray_Zero() { - String[] a1 = new String[0]; - String[] a2 = ArrayTools.rotate(a1); - assertSame(a1, a2); - } - - public void testRotateObjectArray_One() { - String[] a1 = new String[] { "foo " }; - String[] a2 = ArrayTools.rotate(a1); - assertSame(a1, a2); - } - - public void testRotateObjectArrayInt() { - String[] a = this.buildStringArray1(); - a = ArrayTools.rotate(a, 2); - assertEquals("one", a[0]); - assertEquals("two", a[1]); - assertEquals("zero", a[2]); - } - - public void testRotateObjectArrayInt_ZeroDistance() { - String[] a1 = this.buildStringArray1(); - String[] a2 = ArrayTools.rotate(a1, 0); - assertSame(a1, a2); - } - - public void testRotateObjectArrayInt_NegativeDistance() { - String[] a1 = this.buildStringArray1(); - String[] a2 = ArrayTools.rotate(a1, -1); - assertEquals("one", a2[0]); - assertEquals("two", a2[1]); - assertEquals("zero", a2[2]); - } - - public void testRotateObjectArrayInt_Zero() { - String[] a1 = new String[0]; - String[] a2 = ArrayTools.rotate(a1, 7); - assertSame(a1, a2); - } - - public void testRotateObjectArrayInt_One() { - String[] a1 = new String[] { "foo " }; - String[] a2 = ArrayTools.rotate(a1, 8); - assertSame(a1, a2); - } - - public void testRotateCharArray() { - char[] a = this.buildCharArray(); - a = ArrayTools.rotate(a); - assertEquals('c', a[0]); - assertEquals('a', a[1]); - assertEquals('b', a[2]); - } - - public void testRotateCharArray_Zero() { - char[] a1 = new char[0]; - char[] a2 = ArrayTools.rotate(a1); - assertSame(a1, a2); - } - - public void testRotateCharArray_One() { - char[] a1 = new char[] { 'a' }; - char[] a2 = ArrayTools.rotate(a1); - assertSame(a1, a2); - } - - public void testRotateCharArrayInt() { - char[] a = this.buildCharArray(); - a = ArrayTools.rotate(a, 2); - assertEquals('b', a[0]); - assertEquals('c', a[1]); - assertEquals('a', a[2]); - } - - public void testRotateCharArrayInt_ZeroDistance() { - char[] a1 = new char[] { 'a', 'b', 'c' }; - char[] a2 = ArrayTools.rotate(a1, 0); - assertSame(a1, a2); - } - - public void testRotateCharArrayInt_NegativeDistance() { - char[] a = this.buildCharArray(); - a = ArrayTools.rotate(a, -1); - assertEquals('b', a[0]); - assertEquals('c', a[1]); - assertEquals('a', a[2]); - } - - public void testRotateCharArrayInt_Zero() { - char[] a1 = new char[0]; - char[] a2 = ArrayTools.rotate(a1, 2001); - assertSame(a1, a2); - } - - public void testRotateCharArrayInt_One() { - char[] a1 = new char[] { 'a' }; - char[] a2 = ArrayTools.rotate(a1, 22); - assertSame(a1, a2); - } - - public void testRotateIntArray() { - int[] a = this.buildIntArray(); - a = ArrayTools.rotate(a); - assertEquals(20, a[0]); - assertEquals(0, a[1]); - assertEquals(10, a[2]); - } - - public void testRotateIntArray_Zero() { - int[] a1 = new int[0]; - int[] a2 = ArrayTools.rotate(a1); - assertSame(a1, a2); - } - - public void testRotateIntArray_One() { - int[] a1 = new int[] { 77 }; - int[] a2 = ArrayTools.rotate(a1); - assertSame(a1, a2); - } - - public void testRotateIntArrayInt() { - int[] a = this.buildIntArray(); - a = ArrayTools.rotate(a, 2); - assertEquals(10, a[0]); - assertEquals(20, a[1]); - assertEquals(0, a[2]); - } - - public void testRotateIntArrayInt_ZeroDistance() { - int[] a1 = new int[] { 3, 2, 1 }; - int[] a2 = ArrayTools.rotate(a1, 0); - assertSame(a1, a2); - } - - public void testRotateIntArrayInt_NegativeDistance() { - int[] a = this.buildIntArray(); - a = ArrayTools.rotate(a, -1); - assertEquals(10, a[0]); - assertEquals(20, a[1]); - assertEquals(0, a[2]); - } - - public void testRotateIntArrayInt_Zero() { - int[] a1 = new int[0]; - int[] a2 = ArrayTools.rotate(a1, 3); - assertSame(a1, a2); - } - - public void testRotateIntArrayInt_One() { - int[] a1 = new int[] { 77 }; - int[] a2 = ArrayTools.rotate(a1, 44); - assertSame(a1, a2); - } - - - // ********** shuffle ********** - - public void testShuffleObjectArray() { - String[] array1 = this.buildStringArray1(); - String[] array2 = ArrayTools.shuffle(this.buildStringArray1()); - assertEquals(array1.length, array2.length); - assertTrue(ArrayTools.containsAll(array1, (Object[]) array2)); - } - - public void testShuffleObjectArray_Singleton() { - String[] array1 = new String[] { "foo" }; - String[] array2 = ArrayTools.shuffle(new String[] { "foo" }); - assertEquals(array1.length, array2.length); - assertTrue(ArrayTools.containsAll(array1, (Object[]) array2)); - } - - public void testShuffleCharArray() { - char[] array1 = this.buildCharArray(); - char[] array2 = ArrayTools.shuffle(this.buildCharArray()); - assertEquals(array1.length, array2.length); - assertTrue(ArrayTools.containsAll(array1, array2)); - } - - public void testShuffleCharArray_Singleton() { - char[] array1 = new char[] { 'f' }; - char[] array2 = ArrayTools.shuffle(new char[] { 'f' }); - assertEquals(array1.length, array2.length); - assertTrue(ArrayTools.containsAll(array1, array2)); - } - - public void testShuffleIntArray() { - int[] array1 = this.buildIntArray(); - int[] array2 = ArrayTools.shuffle(this.buildIntArray()); - assertEquals(array1.length, array2.length); - assertTrue(ArrayTools.containsAll(array1, array2)); - } - - public void testShuffleIntArray_Singleton() { - int[] array1 = new int[] { 7 }; - int[] array2 = ArrayTools.shuffle(new int[] { 7 }); - assertEquals(array1.length, array2.length); - assertTrue(ArrayTools.containsAll(array1, array2)); - } - - - // ********** sub-array ********** - - public void testSubArrayObjectArrayIntInt() { - String[] array = new String[] {"foo", "bar", "baz", "joo", "jar", "jaz"}; - String[] result = new String[] {"foo", "bar", "baz", "joo"}; - assertTrue(Arrays.equals(result, ArrayTools.subArray(array, 0, 4))); - - result = new String[] {"jar"}; - assertTrue(Arrays.equals(result, ArrayTools.subArray(array, 4, 5))); - - result = new String[0]; - assertTrue(Arrays.equals(result, ArrayTools.subArray(array, 5, 5))); - - result = new String[] {"joo", "jar", "jaz"}; - assertTrue(Arrays.equals(result, ArrayTools.subArray(array, 3, 6))); - } - - public void testSubArrayIntArrayIntInt() { - int[] array = new int[] {77, 99, 333, 4, 9090, 42}; - int[] result = new int[] {77, 99, 333, 4}; - assertTrue(Arrays.equals(result, ArrayTools.subArray(array, 0, 4))); - - result = new int[] {9090}; - assertTrue(Arrays.equals(result, ArrayTools.subArray(array, 4, 5))); - - result = new int[0]; - assertTrue(Arrays.equals(result, ArrayTools.subArray(array, 5, 5))); - - result = new int[] {4, 9090, 42}; - assertTrue(Arrays.equals(result, ArrayTools.subArray(array, 3, 6))); - } - - public void testSubArrayCharArrayIntInt() { - char[] array = new char[] {'a', 'b', 'c', 'd', 'e', 'f'}; - char[] result = new char[] {'a', 'b', 'c', 'd'}; - assertTrue(Arrays.equals(result, ArrayTools.subArray(array, 0, 4))); - - result = new char[] {'e'}; - assertTrue(Arrays.equals(result, ArrayTools.subArray(array, 4, 5))); - - result = new char[0]; - assertTrue(Arrays.equals(result, ArrayTools.subArray(array, 5, 5))); - - result = new char[] {'d', 'e', 'f'}; - assertTrue(Arrays.equals(result, ArrayTools.subArray(array, 3, 6))); - } - - - // ********** swap ********** - - public void testSwapObjectArray() { - String[] a = this.buildStringArray1(); - a = ArrayTools.swap(a, 1, 2); - assertEquals("zero", a[0]); - assertEquals("two", a[1]); - assertEquals("one", a[2]); - } - - public void testSwapObjectArray_SameIndices() { - String[] a1 = this.buildStringArray1(); - String[] a2 = this.buildStringArray1(); - a1 = ArrayTools.swap(a1, 1, 1); - assertTrue(Arrays.equals(a1, a2)); - } - - public void testSwapCharArray() { - char[] a = this.buildCharArray(); - a = ArrayTools.swap(a, 1, 2); - assertEquals('a', a[0]); - assertEquals('c', a[1]); - assertEquals('b', a[2]); - } - - public void testSwapCharArray_SameIndices() { - char[] a1 = this.buildCharArray(); - char[] a2 = this.buildCharArray(); - a1 = ArrayTools.swap(a1, 1, 1); - assertTrue(Arrays.equals(a1, a2)); - } - - public void testSwapIntArray() { - int[] a = this.buildIntArray(); - a = ArrayTools.swap(a, 1, 2); - assertEquals(0, a[0]); - assertEquals(20, a[1]); - assertEquals(10, a[2]); - } - - public void testSwapIntArray_SameIndices() { - int[] a1 = this.buildIntArray(); - int[] a2 = this.buildIntArray(); - a1 = ArrayTools.swap(a1, 1, 1); - assertTrue(Arrays.equals(a1, a2)); - } - - - // ********** Arrays enhancements ********** - - public void testFillBooleanArrayBoolean() { - boolean[] a1 = new boolean[9]; - boolean[] a2 = ArrayTools.fill(a1, true); - for (boolean x : a1) { - assertTrue(x); - } - assertSame(a1, a2); - } - - public void testFillBooleanArrayIntIntBoolean() { - boolean[] a1 = new boolean[9]; - boolean[] a2 = ArrayTools.fill(a1, false); - int from = 3; - int to = 6; - boolean[] a3 = ArrayTools.fill(a2, from, to, true); - for (int i = 0; i < a1.length; i++) { - boolean x = a1[i]; - if (i < from || i >= to) { - assertFalse(x); - } else { - assertTrue(x); - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testFillByteArrayByte() { - byte[] a1 = new byte[9]; - byte[] a2 = ArrayTools.fill(a1, (byte) 77); - for (byte x : a1) { - assertEquals(77, x); - } - assertSame(a1, a2); - } - - public void testFillByteArrayIntIntByte() { - byte[] a1 = new byte[9]; - byte[] a2 = ArrayTools.fill(a1, (byte) 3); - int from = 3; - int to = 6; - byte[] a3 = ArrayTools.fill(a2, from, to, (byte) 77); - for (int i = 0; i < a1.length; i++) { - byte x = a1[i]; - if (i < from || i >= to) { - assertEquals(3, x); - } else { - assertEquals(77, x); - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testFillCharArrayChar() { - char[] a1 = new char[9]; - char[] a2 = ArrayTools.fill(a1, 'c'); - for (char x : a1) { - assertEquals('c', x); - } - assertSame(a1, a2); - } - - public void testFillCharArrayIntIntChar() { - char[] a1 = new char[9]; - char[] a2 = ArrayTools.fill(a1, 'a'); - int from = 3; - int to = 6; - char[] a3 = ArrayTools.fill(a2, from, to, 'c'); - for (int i = 0; i < a1.length; i++) { - char x = a1[i]; - if (i < from || i >= to) { - assertEquals('a', x); - } else { - assertEquals('c', x); - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testFillDoubleArrayDouble() { - double[] a1 = new double[9]; - double[] a2 = ArrayTools.fill(a1, 77.77); - for (double x : a1) { - assertEquals(77.77, x, 0.0); - } - assertSame(a1, a2); - } - - public void testFillDoubleArrayIntIntDouble() { - double[] a1 = new double[9]; - double[] a2 = ArrayTools.fill(a1, 3.3); - int from = 3; - int to = 6; - double[] a3 = ArrayTools.fill(a2, from, to, 77.77); - for (int i = 0; i < a1.length; i++) { - double x = a1[i]; - if (i < from || i >= to) { - assertEquals(3.3, x, 0.0); - } else { - assertEquals(77.77, x, 0.0); - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testFillFloatArrayFloat() { - float[] a1 = new float[9]; - float[] a2 = ArrayTools.fill(a1, 77.77f); - for (float x : a1) { - assertEquals(77.77f, x, 0.0); - } - assertSame(a1, a2); - } - - public void testFillFloatArrayIntIntFloat() { - float[] a1 = new float[9]; - float[] a2 = ArrayTools.fill(a1, 3.3f); - int from = 3; - int to = 6; - float[] a3 = ArrayTools.fill(a2, from, to, 77.77f); - for (int i = 0; i < a1.length; i++) { - float x = a1[i]; - if (i < from || i >= to) { - assertEquals(3.3f, x, 0.0); - } else { - assertEquals(77.77f, x, 0.0); - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testFillIntArrayInt() { - int[] a1 = new int[9]; - int[] a2 = ArrayTools.fill(a1, 77); - for (int x : a1) { - assertEquals(77, x); - } - assertSame(a1, a2); - } - - public void testFillIntArrayIntIntInt() { - int[] a1 = new int[9]; - int[] a2 = ArrayTools.fill(a1, 3); - int from = 3; - int to = 6; - int[] a3 = ArrayTools.fill(a2, from, to, 77); - for (int i = 0; i < a1.length; i++) { - int x = a1[i]; - if (i < from || i >= to) { - assertEquals(3, x); - } else { - assertEquals(77, x); - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testFillObjectArrayObject() { - String[] a1 = new String[9]; - String[] a2 = ArrayTools.fill(a1, "77"); - for (String x : a1) { - assertEquals("77", x); - } - assertSame(a1, a2); - } - - public void testFillObjectArrayIntIntObject() { - String[] a1 = new String[9]; - String[] a2 = ArrayTools.fill(a1, "3"); - int from = 3; - int to = 6; - String[] a3 = ArrayTools.fill(a2, from, to, "77"); - for (int i = 0; i < a1.length; i++) { - String x = a1[i]; - if (i < from || i >= to) { - assertEquals("3", x); - } else { - assertEquals("77", x); - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testFillLongArrayLong() { - long[] a1 = new long[9]; - long[] a2 = ArrayTools.fill(a1, 77); - for (long x : a1) { - assertEquals(77, x); - } - assertSame(a1, a2); - } - - public void testFillLongArrayIntIntLong() { - long[] a1 = new long[9]; - long[] a2 = ArrayTools.fill(a1, 3); - int from = 3; - int to = 6; - long[] a3 = ArrayTools.fill(a2, from, to, 77); - for (int i = 0; i < a1.length; i++) { - long x = a1[i]; - if (i < from || i >= to) { - assertEquals(3, x); - } else { - assertEquals(77, x); - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testFillShortArrayShort() { - short[] a1 = new short[9]; - short[] a2 = ArrayTools.fill(a1, (short) 77); - for (short x : a1) { - assertEquals(77, x); - } - assertSame(a1, a2); - } - - public void testFillShortArrayIntIntShort() { - short[] a1 = new short[9]; - short[] a2 = ArrayTools.fill(a1, (short) 3); - int from = 3; - int to = 6; - short[] a3 = ArrayTools.fill(a2, from, to, (short) 77); - for (int i = 0; i < a1.length; i++) { - short x = a1[i]; - if (i < from || i >= to) { - assertEquals(3, x); - } else { - assertEquals(77, x); - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testSortByteArray() { - byte[] a1 = new byte[3]; - a1[0] = (byte) 33; - a1[1] = (byte) 11; - a1[2] = (byte) 22; - byte[] a2 = ArrayTools.sort(a1); - byte last = (byte) 0; - for (byte x : a1) { - assertTrue(last < x); - last = x; - } - assertSame(a1, a2); - } - - public void testSortByteArrayIntInt() { - byte[] a1 = new byte[9]; - byte[] a2 = ArrayTools.fill(a1, (byte) 3); - a2[3] = (byte) 33; - a2[4] = (byte) 11; - a2[5] = (byte) 22; - int from = 3; - int to = 6; - byte[] a3 = ArrayTools.sort(a2, from, to); - byte last = (byte) 0; - for (int i = 0; i < a1.length; i++) { - byte x = a1[i]; - if (i < from || i >= to) { - assertEquals(3, x); - } else { - assertTrue(last < x); - last = x; - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testSortCharArray() { - char[] a1 = new char[3]; - a1[0] = 'z'; - a1[1] = 'b'; - a1[2] = 'm'; - char[] a2 = ArrayTools.sort(a1); - char last = 'a'; - for (char x : a1) { - assertTrue(last < x); - last = x; - } - assertSame(a1, a2); - } - - public void testSortCharArrayIntInt() { - char[] a1 = new char[9]; - char[] a2 = ArrayTools.fill(a1, 'c'); - a2[3] = 'z'; - a2[4] = 'b'; - a2[5] = 'm'; - int from = 3; - int to = 6; - char[] a3 = ArrayTools.sort(a2, from, to); - char last = 'a'; - for (int i = 0; i < a1.length; i++) { - char x = a1[i]; - if (i < from || i >= to) { - assertEquals('c', x); - } else { - assertTrue(last < x); - last = x; - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testSortDoubleArray() { - double[] a1 = new double[3]; - a1[0] = 33.33; - a1[1] = 11.11; - a1[2] = 22.22; - double[] a2 = ArrayTools.sort(a1); - double last = 0; - for (double x : a1) { - assertTrue(last < x); - last = x; - } - assertSame(a1, a2); - } - - public void testSortDoubleArrayIntInt() { - double[] a1 = new double[9]; - double[] a2 = ArrayTools.fill(a1, 3.3); - a2[3] = 33.33; - a2[4] = 11.11; - a2[5] = 22.22; - int from = 3; - int to = 6; - double[] a3 = ArrayTools.sort(a2, from, to); - double last = 0; - for (int i = 0; i < a1.length; i++) { - double x = a1[i]; - if (i < from || i >= to) { - assertEquals(3.3, x, 0.0); - } else { - assertTrue(last < x); - last = x; - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testSortFloatArray() { - float[] a1 = new float[3]; - a1[0] = 33.33f; - a1[1] = 11.11f; - a1[2] = 22.22f; - float[] a2 = ArrayTools.sort(a1); - float last = 0; - for (float x : a1) { - assertTrue(last < x); - last = x; - } - assertSame(a1, a2); - } - - public void testSortFloatArrayIntInt() { - float[] a1 = new float[9]; - float[] a2 = ArrayTools.fill(a1, 3.3f); - a2[3] = 33.33f; - a2[4] = 11.11f; - a2[5] = 22.22f; - int from = 3; - int to = 6; - float[] a3 = ArrayTools.sort(a2, from, to); - float last = 0; - for (int i = 0; i < a1.length; i++) { - float x = a1[i]; - if (i < from || i >= to) { - assertEquals(3.3f, x, 0.0); - } else { - assertTrue(last < x); - last = x; - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testSortIntArray() { - int[] a1 = new int[3]; - a1[0] = 33; - a1[1] = 11; - a1[2] = 22; - int[] a2 = ArrayTools.sort(a1); - int last = 0; - for (int x : a1) { - assertTrue(last < x); - last = x; - } - assertSame(a1, a2); - } - - public void testSortIntArrayIntInt() { - int[] a1 = new int[9]; - int[] a2 = ArrayTools.fill(a1, 3); - a2[3] = 33; - a2[4] = 11; - a2[5] = 22; - int from = 3; - int to = 6; - int[] a3 = ArrayTools.sort(a2, from, to); - int last = 0; - for (int i = 0; i < a1.length; i++) { - int x = a1[i]; - if (i < from || i >= to) { - assertEquals(3, x); - } else { - assertTrue(last < x); - last = x; - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testSortObjectArray() { - String[] a1 = new String[3]; - a1[0] = "y"; - a1[1] = "b"; - a1[2] = "m"; - String[] a2 = ArrayTools.sort(a1); - String last = "a"; - for (String x : a1) { - assertTrue(last.compareTo(x) < 0); - last = x; - } - assertSame(a1, a2); - } - - public void testSortObjectArrayComparator() { - String[] a1 = new String[3]; - a1[0] = "y"; - a1[1] = "b"; - a1[2] = "m"; - String[] a2 = ArrayTools.sort(a1, new ReverseComparator()); - String last = "z"; - for (String x : a1) { - assertTrue(last.compareTo(x) > 0); - last = x; - } - assertSame(a1, a2); - } - - public void testSortObjectArrayIntInt() { - String[] a1 = new String[9]; - String[] a2 = ArrayTools.fill(a1, "c"); - a2[3] = "y"; - a2[4] = "b"; - a2[5] = "m"; - int from = 3; - int to = 6; - String[] a3 = ArrayTools.sort(a2, from, to); - String last = "a"; - for (int i = 0; i < a1.length; i++) { - String x = a1[i]; - if (i < from || i >= to) { - assertEquals("c", x); - } else { - assertTrue(last.compareTo(x) < 0); - last = x; - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testSortObjectArrayIntIntComparator() { - String[] a1 = new String[9]; - String[] a2 = ArrayTools.fill(a1, "c"); - a2[3] = "y"; - a2[4] = "b"; - a2[5] = "m"; - int from = 3; - int to = 6; - String[] a3 = ArrayTools.sort(a2, from, to, new ReverseComparator()); - String last = "z"; - for (int i = 0; i < a1.length; i++) { - String x = a1[i]; - if (i < from || i >= to) { - assertEquals("c", x); - } else { - assertTrue(last.compareTo(x) > 0); - last = x; - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testSortLongArray() { - long[] a1 = new long[3]; - a1[0] = 33; - a1[1] = 11; - a1[2] = 22; - long[] a2 = ArrayTools.sort(a1); - long last = 0; - for (long x : a1) { - assertTrue(last < x); - last = x; - } - assertSame(a1, a2); - } - - public void testSortLongArrayIntInt() { - long[] a1 = new long[9]; - long[] a2 = ArrayTools.fill(a1, 3); - a2[3] = 33; - a2[4] = 11; - a2[5] = 22; - int from = 3; - int to = 6; - long[] a3 = ArrayTools.sort(a2, from, to); - long last = 0; - for (int i = 0; i < a1.length; i++) { - long x = a1[i]; - if (i < from || i >= to) { - assertEquals(3, x); - } else { - assertTrue(last < x); - last = x; - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - public void testSortShortArray() { - short[] a1 = new short[3]; - a1[0] = (short) 33; - a1[1] = (short) 11; - a1[2] = (short) 22; - short[] a2 = ArrayTools.sort(a1); - short last = (short) 0; - for (short x : a1) { - assertTrue(last < x); - last = x; - } - assertSame(a1, a2); - } - - public void testSortShortArrayIntInt() { - short[] a1 = new short[9]; - short[] a2 = ArrayTools.fill(a1, (short) 3); - a2[3] = (short) 33; - a2[4] = (short) 11; - a2[5] = (short) 22; - int from = 3; - int to = 6; - short[] a3 = ArrayTools.sort(a2, from, to); - short last = (short) 0; - for (int i = 0; i < a1.length; i++) { - short x = a1[i]; - if (i < from || i >= to) { - assertEquals(3, x); - } else { - assertTrue(last < x); - last = x; - } - } - assertSame(a1, a2); - assertSame(a1, a3); - } - - - // ********** constructor ********** - - public void testConstructor() { - boolean exCaught = false; - try { - Object at = ReflectionTools.newInstance(ArrayTools.class); - fail("bogus: " + at); - } catch (RuntimeException ex) { - if (ex.getCause() instanceof InvocationTargetException) { - if (ex.getCause().getCause() instanceof UnsupportedOperationException) { - exCaught = true; - } - } - } - assertTrue(exCaught); - } - - - // ********** utility ********** - - private Object[] buildObjectArray1() { - return new Object[] { "zero", "one", "two" }; - } - - private String[] buildStringArray1() { - return new String[] { "zero", "one", "two" }; - } - - private char[] buildCharArray() { - return new char[] { 'a', 'b', 'c' }; - } - - private int[] buildIntArray() { - return new int[] { 0, 10, 20 }; - } - - private Object[] buildObjectArray2() { - return new Object[] { "three", "four", "five" }; - } - - private String[] buildStringArray2() { - return new String[] { "three", "four", "five" }; - } - - private List buildStringList1() { - List l = new ArrayList(); - this.addToCollection1(l); - return l; - } - - private List buildObjectList1() { - List l = new ArrayList(); - this.addToCollection1(l); - return l; - } - - private void addToCollection1(Collection c) { - c.add("zero"); - c.add("one"); - c.add("two"); - } - - private List buildStringList2() { - List l = new ArrayList(); - this.addToCollection2(l); - return l; - } - - private void addToCollection2(Collection c) { - c.add("three"); - c.add("four"); - c.add("five"); - } - - private Vector buildStringVector1() { - Vector v = new Vector(); - this.addToCollection1(v); - return v; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/AsynchronousCommandExecutorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/AsynchronousCommandExecutorTests.java deleted file mode 100644 index f8b32dcd28..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/AsynchronousCommandExecutorTests.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.internal.AsynchronousCommandExecutor; -import org.eclipse.jpt.common.utility.internal.StatefulCommandExecutor; - -public class AsynchronousCommandExecutorTests - extends MultiThreadedTestCase -{ - public AsynchronousCommandExecutorTests(String name) { - super(name); - } - - public void testExecution() throws Exception { - TestCommand command = new TestCommand(); - StatefulCommandExecutor commandExecutor = new AsynchronousCommandExecutor(this.buildThreadFactory()); - commandExecutor.start(); - commandExecutor.execute(command); - commandExecutor.execute(command); - commandExecutor.execute(command); - Thread.sleep(TWO_TICKS); // wait for the command to execute - commandExecutor.stop(); - assertEquals(3, command.count); - } - - static class TestCommand implements Command { - int count = 0; - public void execute() { - this.count++; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BagTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BagTests.java deleted file mode 100644 index e018dfaeea..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BagTests.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.Bag; -import org.eclipse.jpt.common.utility.internal.HashBag; - -@SuppressWarnings("nls") -public class BagTests extends TestCase { - - public BagTests(String name) { - super(name); - } - - public void testEmptyBag_iterator() throws Exception { - assertFalse(Bag.Empty.instance().iterator().hasNext()); - } - - public void testEmptyBag_size() throws Exception { - assertEquals(0, Bag.Empty.instance().size()); - } - - public void testEmptyBag_uniqueIterator() throws Exception { - assertFalse(Bag.Empty.instance().uniqueIterator().hasNext()); - } - - public void testEmptyBag_uniqueCount() throws Exception { - assertEquals(0, Bag.Empty.instance().uniqueCount()); - } - - public void testEmptyBag_count() throws Exception { - assertEquals(0, Bag.Empty.instance().count("foo")); - } - - public void testEmptyBag_entries() throws Exception { - assertFalse(Bag.Empty.instance().entries().hasNext()); - } - - public void testEmptyBag_remove() throws Exception { - assertFalse(Bag.Empty.instance().remove("foo", 3)); - } - - public void testEmptyBag_add() throws Exception { - boolean exCaught = false; - try { - Bag.Empty.instance().add("foo", 3); - fail(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testEmptyBag_equals() throws Exception { - assertTrue(Bag.Empty.instance().equals(Bag.Empty.instance())); - assertFalse(Bag.Empty.instance().equals("foo")); - - Bag bag = new HashBag(); - assertTrue(Bag.Empty.instance().equals(bag)); - bag.add("foo"); - assertFalse(Bag.Empty.instance().equals(bag)); - } - - public void testEmptyBag_hashCode() throws Exception { - assertEquals(0, Bag.Empty.instance().hashCode()); - } - - public void testEmptyBag_serialization() throws Exception { - Bag xxx = TestTools.serialize(Bag.Empty.instance()); - assertSame(Bag.Empty.instance(), xxx); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BidiFilterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BidiFilterTests.java deleted file mode 100644 index b2d1564479..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BidiFilterTests.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.BidiFilter; - -@SuppressWarnings("nls") -public class BidiFilterTests extends TestCase { - - public BidiFilterTests(String name) { - super(name); - } - - public void testNullBidiFilter_accept() throws Exception { - assertTrue(BidiFilter.Null.instance().accept("foo")); - } - - public void testNullBidiFilter_reverseAccept() throws Exception { - assertTrue(BidiFilter.Null.instance().reverseAccept("foo")); - } - - public void testNullBidiFilter_toString() throws Exception { - assertNotNull(BidiFilter.Null.instance().toString()); - } - - public void testNullBidiFilter_serialization() throws Exception { - BidiFilter xxx = TestTools.serialize(BidiFilter.Null.instance()); - assertSame(BidiFilter.Null.instance(), xxx); - } - - public void testOpaqueBidiFilter_accept() throws Exception { - assertFalse(BidiFilter.Opaque.instance().accept("foo")); - } - - public void testOpaqueBidiFilter_reverseAccept() throws Exception { - assertFalse(BidiFilter.Opaque.instance().reverseAccept("foo")); - } - - public void testOpaqueBidiFilter_toString() throws Exception { - assertNotNull(BidiFilter.Opaque.instance().toString()); - } - - public void testOpaqueBidiFilter_serialization() throws Exception { - BidiFilter xxx = TestTools.serialize(BidiFilter.Opaque.instance()); - assertSame(BidiFilter.Opaque.instance(), xxx); - } - - public void testDisabledBidiFilter_accept() throws Exception { - boolean exCaught = false; - try { - BidiFilter.Disabled.instance().accept("foo"); - fail(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testDisabledBidiFilter_reverseAccept() throws Exception { - boolean exCaught = false; - try { - BidiFilter.Disabled.instance().reverseAccept("foo"); - fail(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testDisabledBidiFilter_toString() throws Exception { - assertNotNull(BidiFilter.Disabled.instance().toString()); - } - - public void testDisabledBidiFilter_serialization() throws Exception { - BidiFilter xxx = TestTools.serialize(BidiFilter.Disabled.instance()); - assertSame(BidiFilter.Disabled.instance(), xxx); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BidiStringConverterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BidiStringConverterTests.java deleted file mode 100644 index cf0400b104..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BidiStringConverterTests.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.BidiStringConverter; - -@SuppressWarnings("nls") -public class BidiStringConverterTests extends TestCase { - - public BidiStringConverterTests(String name) { - super(name); - } - - public void testDefaultBidiStringConverter_convertToString() throws Exception { - assertEquals("foo", BidiStringConverter.Default.instance().convertToString("foo")); - assertNull(BidiStringConverter.Default.instance().convertToString(null)); - } - - public void testDefaultBidiStringConverter_convertToObject() throws Exception { - assertEquals("foo", BidiStringConverter.Default.instance().convertToObject("foo")); - assertNull(BidiStringConverter.Default.instance().convertToString(null)); - } - - public void testDefaultBidiStringConverter_toString() throws Exception { - assertNotNull(BidiStringConverter.Default.instance().toString()); - } - - public void testDefaultBidiStringConverter_serialization() throws Exception { - BidiStringConverter xxx = TestTools.serialize(BidiStringConverter.Default.instance()); - assertSame(BidiStringConverter.Default.instance(), xxx); - } - - public void testDisabledBidiStringConverter_convertToString() throws Exception { - boolean exCaught = false; - try { - BidiStringConverter.Disabled.instance().convertToString("foo"); - fail(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testDisabledBidiStringConverter_convertToObject() throws Exception { - boolean exCaught = false; - try { - BidiStringConverter.Disabled.instance().convertToObject("foo"); - fail(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testDisabledBidiStringConverter_toString() throws Exception { - assertNotNull(BidiStringConverter.Disabled.instance().toString()); - } - - public void testDisabledBidiStringConverter_serialization() throws Exception { - BidiStringConverter xxx = TestTools.serialize(BidiStringConverter.Disabled.instance()); - assertSame(BidiStringConverter.Disabled.instance(), xxx); - } - - public void testBooleanBidiStringConverter_convertToString() throws Exception { - assertEquals("true", BidiStringConverter.BooleanConverter.instance().convertToString(Boolean.TRUE)); - assertEquals("false", BidiStringConverter.BooleanConverter.instance().convertToString(Boolean.FALSE)); - assertNull(BidiStringConverter.BooleanConverter.instance().convertToString(null)); - } - - public void testBooleanBidiStringConverter_convertToObject() throws Exception { - assertEquals(Boolean.TRUE, BidiStringConverter.BooleanConverter.instance().convertToObject("true")); - assertEquals(Boolean.TRUE, BidiStringConverter.BooleanConverter.instance().convertToObject("TRUE")); - assertEquals(Boolean.FALSE, BidiStringConverter.BooleanConverter.instance().convertToObject("false")); - assertEquals(Boolean.FALSE, BidiStringConverter.BooleanConverter.instance().convertToObject("xxxx")); - assertNull(BidiStringConverter.BooleanConverter.instance().convertToObject(null)); - } - - public void testBooleanBidiStringConverter_toString() throws Exception { - assertNotNull(BidiStringConverter.BooleanConverter.instance().toString()); - } - - public void testBooleanBidiStringConverter_serialization() throws Exception { - BidiStringConverter xxx = TestTools.serialize(BidiStringConverter.BooleanConverter.instance()); - assertSame(BidiStringConverter.BooleanConverter.instance(), xxx); - } - - public void testIntegerBidiStringConverter_convertToString() throws Exception { - assertEquals("7", BidiStringConverter.IntegerConverter.instance().convertToString(Integer.valueOf(7))); - assertNull(BidiStringConverter.IntegerConverter.instance().convertToString(null)); - } - - public void testIntegerBidiStringConverter_convertToObject() throws Exception { - assertEquals(Integer.valueOf(7), BidiStringConverter.IntegerConverter.instance().convertToObject("7")); - assertNull(BidiStringConverter.IntegerConverter.instance().convertToObject(null)); - } - - public void testIntegerBidiStringConverter_toString() throws Exception { - assertNotNull(BidiStringConverter.IntegerConverter.instance().toString()); - } - - public void testIntegerBidiStringConverter_serialization() throws Exception { - BidiStringConverter xxx = TestTools.serialize(BidiStringConverter.IntegerConverter.instance()); - assertSame(BidiStringConverter.IntegerConverter.instance(), xxx); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BidiTransformerTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BidiTransformerTests.java deleted file mode 100644 index 973f153f45..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BidiTransformerTests.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.BidiTransformer; - -@SuppressWarnings("nls") -public class BidiTransformerTests extends TestCase { - - public BidiTransformerTests(String name) { - super(name); - } - - public void testNullBidiTransformer_transform() throws Exception { - assertEquals("foo", BidiTransformer.Null.instance().transform("foo")); - assertNull(BidiTransformer.Null.instance().transform(null)); - } - - public void testNullBidiTransformer_reverseTransform() throws Exception { - assertEquals("foo", BidiTransformer.Null.instance().reverseTransform("foo")); - assertNull(BidiTransformer.Null.instance().transform(null)); - } - - public void testNullBidiTransformer_toString() throws Exception { - assertNotNull(BidiTransformer.Null.instance().toString()); - } - - public void testNullBidiTransformer_serialization() throws Exception { - BidiTransformer xxx = TestTools.serialize(BidiTransformer.Null.instance()); - assertSame(BidiTransformer.Null.instance(), xxx); - } - - public void testDisabledBidiTransformer_transform() throws Exception { - boolean exCaught = false; - try { - BidiTransformer.Disabled.instance().transform("foo"); - fail(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testDisabledBidiTransformer_reverseTransform() throws Exception { - boolean exCaught = false; - try { - BidiTransformer.Disabled.instance().reverseTransform("foo"); - fail(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testDisabledBidiTransformer_toString() throws Exception { - assertNotNull(BidiTransformer.Disabled.instance().toString()); - } - - public void testDisabledBidiTransformer_serialization() throws Exception { - BidiTransformer xxx = TestTools.serialize(BidiTransformer.Disabled.instance()); - assertSame(BidiTransformer.Disabled.instance(), xxx); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BitToolsTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BitToolsTests.java deleted file mode 100644 index dd1941237b..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BitToolsTests.java +++ /dev/null @@ -1,262 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.lang.reflect.InvocationTargetException; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.BitTools; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; - -public class BitToolsTests extends TestCase { - - public BitToolsTests(String name) { - super(name); - } - - public void testFlagIsSetIntInt() { - assertTrue(BitTools.flagIsSet(0x0003, 0x0001)); - assertTrue(BitTools.flagIsSet(0x0303, 0x0001)); - assertTrue(BitTools.flagIsSet(0x0303, 0x0101)); - assertTrue(BitTools.flagIsSet(0x0303, 0x0103)); - - assertFalse(BitTools.flagIsSet(0x0303, 0x1103)); - assertFalse(BitTools.flagIsSet(0x0000, 0x1103)); - } - - public void testFlagIsOffIntInt() { - assertFalse(BitTools.flagIsOff(0x0003, 0x0001)); - assertFalse(BitTools.flagIsOff(0x0303, 0x0001)); - assertFalse(BitTools.flagIsOff(0x0303, 0x0101)); - assertFalse(BitTools.flagIsOff(0x0303, 0x0103)); - - assertTrue(BitTools.flagIsOff(0x2204, 0x1103)); - assertTrue(BitTools.flagIsOff(0x0000, 0x1103)); - } - - public void testOnlyFlagIsSetIntInt() { - assertFalse(BitTools.onlyFlagIsSet(0x0003, 0x0001)); - assertTrue(BitTools.onlyFlagIsSet(0x0001, 0x0001)); - - assertFalse(BitTools.onlyFlagIsSet(0x0303, 0x0001)); - assertTrue(BitTools.onlyFlagIsSet(0x0001, 0x0001)); - - assertFalse(BitTools.onlyFlagIsSet(0x0303, 0x0101)); - assertTrue(BitTools.onlyFlagIsSet(0x0101, 0x0101)); - - assertFalse(BitTools.onlyFlagIsSet(0x0303, 0x0103)); - assertTrue(BitTools.onlyFlagIsSet(0x0103, 0x0103)); - - assertFalse(BitTools.onlyFlagIsSet(0x0303, 0x1103)); - assertTrue(BitTools.onlyFlagIsSet(0x1103, 0x1103)); - - assertFalse(BitTools.onlyFlagIsSet(0x0000, 0x1103)); - assertTrue(BitTools.onlyFlagIsSet(0x0103, 0x0103)); - } - - public void testOnlyFlagIsOffIntInt() { - assertFalse(BitTools.onlyFlagIsOff(0x0003, 0x0001)); - assertFalse(BitTools.onlyFlagIsOff(0x0303, 0x0001)); - assertTrue(BitTools.onlyFlagIsOff(0xFFFFFFFE, 0x0001)); - - assertFalse(BitTools.onlyFlagIsOff(0x0303, 0x0101)); - assertTrue(BitTools.onlyFlagIsOff(0xFFFFFEFE, 0x0101)); - - assertFalse(BitTools.onlyFlagIsOff(0x0303, 0x0103)); - assertTrue(BitTools.onlyFlagIsOff(0xFFFFFEFC, 0x0103)); - - assertFalse(BitTools.onlyFlagIsOff(0x0303, 0x1103)); - assertTrue(BitTools.onlyFlagIsOff(0xFFFFEEFC, 0x1103)); - } - - public void testAllFlagsAreSetIntInt() { - assertTrue(BitTools.allFlagsAreSet(0x0003, 0x0001)); - assertTrue(BitTools.allFlagsAreSet(0x0303, 0x0001)); - assertTrue(BitTools.allFlagsAreSet(0x0303, 0x0101)); - assertTrue(BitTools.allFlagsAreSet(0x0303, 0x0103)); - - assertFalse(BitTools.allFlagsAreSet(0x0303, 0x1103)); - assertFalse(BitTools.allFlagsAreSet(0x0000, 0x1103)); - } - - public void testAllFlagsAreOffIntInt() { - assertFalse(BitTools.allFlagsAreOff(0x0003, 0x0001)); - assertFalse(BitTools.allFlagsAreOff(0x0303, 0x0001)); - assertFalse(BitTools.allFlagsAreOff(0x0303, 0x0101)); - assertFalse(BitTools.allFlagsAreOff(0x0303, 0x0103)); - - assertTrue(BitTools.allFlagsAreOff(0x2204, 0x1103)); - assertTrue(BitTools.allFlagsAreOff(0x0000, 0x1103)); - } - - public void testOnlyFlagsAreSetIntInt() { - assertFalse(BitTools.onlyFlagsAreSet(0x0003, 0x0001)); - assertTrue(BitTools.onlyFlagsAreSet(0x0001, 0x0001)); - - assertFalse(BitTools.onlyFlagsAreSet(0x0303, 0x0001)); - assertTrue(BitTools.onlyFlagsAreSet(0x0001, 0x0001)); - - assertFalse(BitTools.onlyFlagsAreSet(0x0303, 0x0101)); - assertTrue(BitTools.onlyFlagsAreSet(0x0101, 0x0101)); - - assertFalse(BitTools.onlyFlagsAreSet(0x0303, 0x0103)); - assertTrue(BitTools.onlyFlagsAreSet(0x0103, 0x0103)); - - assertFalse(BitTools.onlyFlagsAreSet(0x0303, 0x1103)); - assertTrue(BitTools.onlyFlagsAreSet(0x1103, 0x1103)); - - assertFalse(BitTools.onlyFlagsAreSet(0x0000, 0x1103)); - assertTrue(BitTools.onlyFlagsAreSet(0x0103, 0x0103)); - } - - public void testOnlyFlagsAreOffIntInt() { - assertFalse(BitTools.onlyFlagsAreOff(0x0003, 0x0001)); - assertFalse(BitTools.onlyFlagsAreOff(0x0303, 0x0001)); - assertTrue(BitTools.onlyFlagsAreOff(0xFFFFFFFE, 0x0001)); - - assertFalse(BitTools.onlyFlagsAreOff(0x0303, 0x0101)); - assertTrue(BitTools.onlyFlagsAreOff(0xFFFFFEFE, 0x0101)); - - assertFalse(BitTools.onlyFlagsAreOff(0x0303, 0x0103)); - assertTrue(BitTools.onlyFlagsAreOff(0xFFFFFEFC, 0x0103)); - - assertFalse(BitTools.onlyFlagsAreOff(0x0303, 0x1103)); - assertTrue(BitTools.onlyFlagsAreOff(0xFFFFEEFC, 0x1103)); - } - - public void testAnyFlagsAreSetIntInt() { - assertTrue(BitTools.anyFlagsAreSet(0x0003, 0x0001)); - assertTrue(BitTools.anyFlagsAreSet(0xFFFF, 0x0001)); - assertTrue(BitTools.anyFlagsAreSet(0x0003, 0xFFFF)); - - assertFalse(BitTools.anyFlagsAreSet(0x0303, 0x1010)); - assertFalse(BitTools.anyFlagsAreSet(0x0000, 0xFFFF)); - } - - public void testAnyFlagsAreOffIntInt() { - assertTrue(BitTools.anyFlagsAreOff(0x333E, 0x0001)); - assertTrue(BitTools.anyFlagsAreOff(0xFFFE, 0x0001)); - assertTrue(BitTools.anyFlagsAreOff(0x0003, 0xFFFF)); - - assertFalse(BitTools.anyFlagsAreOff(0x7373, 0x1010)); - assertFalse(BitTools.anyFlagsAreOff(0xFFFF, 0xFFFF)); - } - - public void testAllFlagsAreSetIntIntArray() { - assertTrue(BitTools.allFlagsAreSet(0x0003, new int[] { 0x0001 })); - assertTrue(BitTools.allFlagsAreSet(0x0303, new int[] { 0x0001 })); - assertTrue(BitTools.allFlagsAreSet(0x0303, new int[] { 0x0100, 0x0001 })); - assertTrue(BitTools.allFlagsAreSet(0x0303, new int[] { 0x0100, 0x0002, 0x0001 })); - - assertFalse(BitTools.allFlagsAreSet(0x0303, new int[] { 0x1000, 0x0100, 0x0002, 0x0001 })); - assertFalse(BitTools.allFlagsAreSet(0x0000, new int[] { 0x1000, 0x0100, 0x0002, 0x0001 })); - } - - public void testAllFlagsAreOffIntIntArray() { - assertFalse(BitTools.allFlagsAreOff(0x0003, new int[] { 0x0001 })); - assertFalse(BitTools.allFlagsAreOff(0x0303, new int[] { 0x0001 })); - assertFalse(BitTools.allFlagsAreOff(0x0303, new int[] { 0x0100, 0x0001 })); - assertFalse(BitTools.allFlagsAreOff(0x0303, new int[] { 0x0100, 0x0002, 0x0001 })); - - assertTrue(BitTools.allFlagsAreOff(0x0303, new int[] { 0x1000, 0x0400, 0x0020, 0x0000 })); - assertTrue(BitTools.allFlagsAreOff(0x0000, new int[] { 0x1000, 0x0100, 0x0002, 0x0001 })); - } - - public void testOnlyFlagsAreSetIntIntArray() { - assertFalse(BitTools.onlyFlagsAreSet(0x0003, new int[] { 0x001, 0x0000, 0x0000, 0x0001 })); - assertTrue(BitTools.onlyFlagsAreSet(0x0001, new int[] { 0x001, 0x0000, 0x0000, 0x0001 })); - - assertFalse(BitTools.onlyFlagsAreSet(0x0303, new int[] { 0x001, 0x0000, 0x0000, 0x0001 })); - assertTrue(BitTools.onlyFlagsAreSet(0x0001, new int[] { 0x001, 0x0000, 0x0000, 0x0001 })); - - assertFalse(BitTools.onlyFlagsAreSet(0x0303, new int[] { 0x001, 0x0100, 0x0000, 0x0001 })); - assertTrue(BitTools.onlyFlagsAreSet(0x0101, new int[] { 0x001, 0x0100, 0x0000, 0x0001 })); - - assertFalse(BitTools.onlyFlagsAreSet(0x0303, new int[] { 0x001, 0x0100, 0x0002, 0x0001 })); - assertTrue(BitTools.onlyFlagsAreSet(0x0103, new int[] { 0x001, 0x0100, 0x0002, 0x0001 })); - - assertFalse(BitTools.onlyFlagsAreSet(0x0303, new int[] { 0x011, 0x0100, 0x0002, 0x0001 })); - assertTrue(BitTools.onlyFlagsAreSet(0x1103, new int[] { 0x1100, 0x0100, 0x0002, 0x0001 })); - - assertFalse(BitTools.onlyFlagsAreSet(0x0000, new int[] { 0x011, 0x0100, 0x0002, 0x0001 })); - assertTrue(BitTools.onlyFlagsAreSet(0x0103, new int[] { 0x0101, 0x0100, 0x0002, 0x0001 })); - } - - public void testOnlyFlagsAreOffIntIntArray() { - assertFalse(BitTools.onlyFlagsAreOff(0x0003, new int[] { 0x001, 0x0000, 0x0000, 0x0001 })); - assertFalse(BitTools.onlyFlagsAreOff(0x0303, new int[] { 0x001, 0x0000, 0x0000, 0x0001 })); - assertTrue(BitTools.onlyFlagsAreOff(0xFFFFFFFE, new int[] { 0x001, 0x0000, 0x0000, 0x0001 })); - - assertFalse(BitTools.onlyFlagsAreOff(0x0303, new int[] { 0x001, 0x0100, 0x0000, 0x0001 })); - assertTrue(BitTools.onlyFlagsAreOff(0xFFFFFEFE, new int[] { 0x001, 0x0100, 0x0000, 0x0001 })); - - assertFalse(BitTools.onlyFlagsAreOff(0x0303, new int[] { 0x001, 0x0100, 0x0002, 0x0001 })); - assertTrue(BitTools.onlyFlagsAreOff(0xFFFFFEFC, new int[] { 0x001, 0x0100, 0x0002, 0x0001 })); - - assertFalse(BitTools.onlyFlagsAreOff(0x0303, new int[] { 0x1100, 0x0100, 0x0002, 0x0001 })); - assertTrue(BitTools.onlyFlagsAreOff(0xFFFFEEFC, new int[] { 0x1100, 0x0100, 0x0002, 0x0001 })); - } - - public void testAnyFlagsAreSetIntIntArray() { - assertTrue(BitTools.anyFlagsAreSet(0x0003, new int[] { 0x0001 })); - assertTrue(BitTools.anyFlagsAreSet(0xFFFF, new int[] { 0x0001 })); - assertTrue(BitTools.anyFlagsAreSet(0x0303, new int[] { 0xF000, 0x0F00, 0x00F0, 0x000F })); - - assertFalse(BitTools.anyFlagsAreSet(0x0303, new int[] { 0x1000, 0x0010 })); - assertFalse(BitTools.anyFlagsAreSet(0x0000, new int[] { 0xF000, 0x0F00, 0x00F0, 0x000F })); - } - - public void testAnyFlagsAreOffIntIntArray() { - assertFalse(BitTools.anyFlagsAreOff(0x0003, new int[] { 0x0001 })); - assertFalse(BitTools.anyFlagsAreOff(0xFFFF, new int[] { 0x0001 })); - assertFalse(BitTools.anyFlagsAreOff(0x0303, new int[] { 0x0100, 0x0200, 0x0003, 0x0002 })); - - assertTrue(BitTools.anyFlagsAreOff(0x0303, new int[] { 0x0100, 0x0010 })); - assertTrue(BitTools.anyFlagsAreOff(0x0000, new int[] { 0xF000, 0x0F00, 0x00F0, 0x000F })); - } - - public void testOrFlags() { - assertEquals(0x0001, BitTools.orFlags(new int[] { 0x0001, 0x0000 })); - assertEquals(0x0011, BitTools.orFlags(new int[] { 0x0001, 0x0011 })); - assertEquals(0xF011, BitTools.orFlags(new int[] { 0x0001, 0x0011, 0xF000 })); - } - - public void testAndFlags() { - assertEquals(0x0001, BitTools.andFlags(new int[] { 0x0001, 0x0001 })); - assertEquals(0x0001, BitTools.andFlags(new int[] { 0x0001, 0x0011 })); - assertEquals(0x0000, BitTools.andFlags(new int[] { 0x0001, 0x0011, 0xF000 })); - assertEquals(0x0001, BitTools.andFlags(new int[] { 0x0001, 0x0011, 0xF001 })); - } - - public void testXorFlags() { - assertEquals(0x0001, BitTools.xorFlags(new int[] { 0x0001, 0x0000 })); - assertEquals(0x0010, BitTools.xorFlags(new int[] { 0x0001, 0x0011 })); - assertEquals(0xF010, BitTools.xorFlags(new int[] { 0x0001, 0x0011, 0xF000 })); - assertEquals(0xFF11, BitTools.xorFlags(new int[] { 0x0001, 0x0011, 0xF000, 0x0F01 })); - assertEquals(0xF010, BitTools.xorFlags(new int[] { 0x0001, 0x0011, 0xF000, 0x0F01, 0x0F01 })); - } - - public void testConstructor() { - boolean exCaught = false; - try { - Object at = ReflectionTools.newInstance(BitTools.class); - fail("bogus: " + at); //$NON-NLS-1$ - } catch (RuntimeException ex) { - if (ex.getCause() instanceof InvocationTargetException) { - if (ex.getCause().getCause() instanceof UnsupportedOperationException) { - exCaught = true; - } - } - } - assertTrue(exCaught); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BooleanToolsTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BooleanToolsTests.java deleted file mode 100644 index f134a70e87..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/BooleanToolsTests.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.lang.reflect.InvocationTargetException; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.BooleanTools; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; - -public class BooleanToolsTests extends TestCase { - private static final Boolean TRUE = Boolean.TRUE; - private static final Boolean FALSE = Boolean.FALSE; - - public BooleanToolsTests(String name) { - super(name); - } - - public void testNOT() { - assertEquals(FALSE, BooleanTools.not(TRUE)); - assertEquals(TRUE, BooleanTools.not(FALSE)); - } - - public void testAND() { - assertEquals(TRUE, BooleanTools.and(TRUE, TRUE)); - assertEquals(FALSE, BooleanTools.and(TRUE, FALSE)); - assertEquals(FALSE, BooleanTools.and(FALSE, TRUE)); - assertEquals(FALSE, BooleanTools.and(FALSE, FALSE)); - } - - public void testOR() { - assertEquals(TRUE, BooleanTools.or(TRUE, TRUE)); - assertEquals(TRUE, BooleanTools.or(TRUE, FALSE)); - assertEquals(TRUE, BooleanTools.or(FALSE, TRUE)); - assertEquals(FALSE, BooleanTools.or(FALSE, FALSE)); - } - - public void testXOR() { - assertEquals(FALSE, BooleanTools.xor(TRUE, TRUE)); - assertEquals(TRUE, BooleanTools.xor(TRUE, FALSE)); - assertEquals(TRUE, BooleanTools.xor(FALSE, TRUE)); - assertEquals(FALSE, BooleanTools.xor(FALSE, FALSE)); - } - - public void testNAND() { - assertEquals(FALSE, BooleanTools.nand(TRUE, TRUE)); - assertEquals(TRUE, BooleanTools.nand(TRUE, FALSE)); - assertEquals(TRUE, BooleanTools.nand(FALSE, TRUE)); - assertEquals(TRUE, BooleanTools.nand(FALSE, FALSE)); - } - - public void testNOR() { - assertEquals(FALSE, BooleanTools.nor(TRUE, TRUE)); - assertEquals(FALSE, BooleanTools.nor(TRUE, FALSE)); - assertEquals(FALSE, BooleanTools.nor(FALSE, TRUE)); - assertEquals(TRUE, BooleanTools.nor(FALSE, FALSE)); - } - - public void testXNOR() { - assertEquals(TRUE, BooleanTools.xnor(TRUE, TRUE)); - assertEquals(FALSE, BooleanTools.xnor(TRUE, FALSE)); - assertEquals(FALSE, BooleanTools.xnor(FALSE, TRUE)); - assertEquals(TRUE, BooleanTools.xnor(FALSE, FALSE)); - } - - public void testConstructor() { - boolean exCaught = false; - try { - Object at = ReflectionTools.newInstance(BooleanTools.class); - fail("bogus: " + at); //$NON-NLS-1$ - } catch (RuntimeException ex) { - if (ex.getCause() instanceof InvocationTargetException) { - if (ex.getCause().getCause() instanceof UnsupportedOperationException) { - exCaught = true; - } - } - } - assertTrue(exCaught); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ClassNameTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ClassNameTests.java deleted file mode 100644 index 8e070b6d18..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ClassNameTests.java +++ /dev/null @@ -1,368 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.lang.reflect.Array; -import java.lang.reflect.InvocationTargetException; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.ClassName; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; - -@SuppressWarnings("nls") -public class ClassNameTests extends TestCase { - - public ClassNameTests(String name) { - super(name); - } - - public void testIsArray() { - assertFalse(ClassName.isArray(int.class.getName())); - assertTrue(ClassName.isArray(int[].class.getName())); - assertTrue(ClassName.isArray(int[][].class.getName())); - - assertFalse(ClassName.isArray(java.lang.String.class.getName())); - assertTrue(ClassName.isArray(java.lang.String[].class.getName())); - assertTrue(ClassName.isArray(java.lang.String[][].class.getName())); - } - - public void testGetElementTypeName() { - assertEquals(java.util.Vector.class.getName(), ClassName.getElementTypeName(java.util.Vector.class.getName())); - assertEquals(int.class.getName(), ClassName.getElementTypeName(int.class.getName())); - assertEquals(void.class.getName(), ClassName.getElementTypeName(void.class.getName())); - assertEquals(java.util.Vector.class.getName(), ClassName.getElementTypeName(java.util.Vector[].class.getName())); - assertEquals(int.class.getName(), ClassName.getElementTypeName(int[].class.getName())); - assertEquals(java.util.Vector.class.getName(), ClassName.getElementTypeName(java.util.Vector[][][].class.getName())); - assertEquals(int.class.getName(), ClassName.getElementTypeName(int[][][].class.getName())); - } - - public void testGetArrayDepth() { - assertEquals(0, ClassName.getArrayDepth(java.util.Vector.class.getName())); - assertEquals(0, ClassName.getArrayDepth(int.class.getName())); - assertEquals(0, ClassName.getArrayDepth(void.class.getName())); - assertEquals(1, ClassName.getArrayDepth(java.util.Vector[].class.getName())); - assertEquals(1, ClassName.getArrayDepth(int[].class.getName())); - assertEquals(3, ClassName.getArrayDepth(java.util.Vector[][][].class.getName())); - assertEquals(3, ClassName.getArrayDepth(int[][][].class.getName())); - } - - public void testGetComponentTypeName() { - assertEquals(null, ClassName.getComponentTypeName(java.lang.Object.class.getName())); - assertEquals(java.lang.Object.class.getName(), ClassName.getComponentTypeName(java.lang.Object[].class.getName())); - assertEquals(java.lang.Object[].class.getName(), ClassName.getComponentTypeName(java.lang.Object[][].class.getName())); - - assertEquals(null, ClassName.getComponentTypeName(int.class.getName())); - assertEquals(int.class.getName(), ClassName.getComponentTypeName(int[].class.getName())); - assertEquals(int[].class.getName(), ClassName.getComponentTypeName(int[][].class.getName())); - } - - public void testGetSimpleName() throws Exception { - assertEquals("Object", ClassName.getSimpleName(java.lang.Object.class.getName())); - assertEquals("Object[]", ClassName.getSimpleName(java.lang.Object[].class.getName())); - assertEquals("Object[][]", ClassName.getSimpleName(java.lang.Object[][].class.getName())); - - assertEquals(java.util.Map.class.getSimpleName(), ClassName.getSimpleName(java.util.Map.class.getName())); - assertEquals(java.util.Map.Entry.class.getSimpleName(), ClassName.getSimpleName(java.util.Map.Entry.class.getName())); - - assertEquals("int", ClassName.getSimpleName(int.class.getName())); - assertEquals("int[]", ClassName.getSimpleName(int[].class.getName())); - assertEquals("int[][]", ClassName.getSimpleName(int[][].class.getName())); - - Object anonObject = new Object() { - // anonymous class - }; - assertEquals("", ClassName.getSimpleName(anonObject.getClass().getName())); - - class Local { - // anonymous class - } - Local localObject = new Local(); - assertEquals("Local", ClassName.getSimpleName(localObject.getClass().getName())); - } - - public void testGetPackageName() throws Exception { - assertEquals(java.lang.Object.class.getPackage().getName(), ClassName.getPackageName(java.lang.Object.class.getName())); - assertEquals("", ClassName.getPackageName(java.lang.Object[].class.getName())); - assertEquals("", ClassName.getPackageName(java.lang.Object[][].class.getName())); - - assertEquals(java.util.Map.class.getPackage().getName(), ClassName.getPackageName(java.util.Map.class.getName())); - assertEquals(java.util.Map.Entry.class.getPackage().getName(), ClassName.getPackageName(java.util.Map.Entry.class.getName())); - - assertEquals("", ClassName.getPackageName(int.class.getName())); - assertEquals("", ClassName.getPackageName(int[].class.getName())); - assertEquals("", ClassName.getPackageName(int[][].class.getName())); - - assertEquals("", ClassName.getPackageName(void.class.getName())); - - Object anonObject = new Object() { - // anonymous class - }; - assertEquals(anonObject.getClass().getPackage().getName(), ClassName.getPackageName(anonObject.getClass().getName())); - } - - public void testIsTopLevel() throws Exception { - assertTrue(ClassName.isTopLevel(java.util.Map.class.getName())); // top-level - assertFalse(ClassName.isTopLevel(java.util.Map.Entry.class.getName())); // member - assertFalse(ClassName.isTopLevel(Class.forName(this.getClass().getName() + "$1LocalClass").getName())); // local - assertFalse(ClassName.isTopLevel(Class.forName("java.util.Vector$1").getName())); // anonymous - - Object[] array = new java.util.Map[0]; // top-level - assertFalse(ClassName.isTopLevel(array.getClass().getName())); - array = new java.util.Map.Entry[0]; // member - assertFalse(ClassName.isTopLevel(array.getClass().getName())); - Class localClass = Class.forName(this.getClass().getName() + "$1LocalClass"); // local - array = (Object[]) Array.newInstance(localClass, 0); - assertFalse(ClassName.isTopLevel(array.getClass().getName())); - Class anonClass = Class.forName("java.util.Vector$1"); // local - array = (Object[]) Array.newInstance(anonClass, 0); - assertFalse(ClassName.isTopLevel(array.getClass().getName())); - } - - public void testIsMember() throws Exception { - assertFalse(ClassName.isMember(java.util.Map.class.getName())); // top-level - assertTrue(ClassName.isMember(java.util.Map.Entry.class.getName())); // member - assertFalse(ClassName.isMember(Class.forName(this.getClass().getName() + "$1LocalClass").getName())); // local - assertFalse(ClassName.isMember(Class.forName("java.util.Vector$1").getName())); // anonymous - - Object[] array = new java.util.Map[0]; // top-level - assertFalse(ClassName.isMember(array.getClass().getName())); - array = new java.util.Map.Entry[0]; // member - assertFalse(ClassName.isMember(array.getClass().getName())); - Class localClass = Class.forName(this.getClass().getName() + "$1LocalClass"); // local - array = (Object[]) Array.newInstance(localClass, 0); - assertFalse(ClassName.isMember(array.getClass().getName())); - Class anonClass = Class.forName("java.util.Vector$1"); // local - array = (Object[]) Array.newInstance(anonClass, 0); - assertFalse(ClassName.isMember(array.getClass().getName())); - - // test a few edge cases - assertTrue(ClassName.isMember("java.util.Map$a1")); - assertTrue(ClassName.isMember("java.util.Map$1aa$aaa")); // member inside local - assertTrue(ClassName.isMember("java.util.Map$1$aaa")); // member inside anonymous - assertTrue(ClassName.isMember("java.util.Map$a1$aaa$bbb")); - assertTrue(ClassName.isMember("java.util.Map$1a1$aaa")); // member inside local - assertFalse(ClassName.isMember("java.util.Map$1a")); - assertTrue(ClassName.isMember("java.util.Map$a12345$b12345")); - assertFalse(ClassName.isMember("java.util.Map$12345a")); - assertFalse(ClassName.isMember("java.util.Map$333")); - assertFalse(ClassName.isMember("java.util.Map3$333")); - } - - public void testIsLocal() throws Exception { - class LocalClass { - void foo() { - System.getProperty("foo"); - } - } - new LocalClass().foo(); - assertFalse(ClassName.isLocal(java.util.Map.class.getName())); // top-level - assertFalse(ClassName.isLocal(java.util.Map.Entry.class.getName())); // member - assertTrue(ClassName.isLocal(Class.forName(this.getClass().getName() + "$1LocalClass").getName())); // local - assertFalse(ClassName.isLocal(Class.forName("java.util.Vector$1").getName())); // anonymous - - Object[] array = new java.util.Map[0]; // top-level - assertFalse(ClassName.isLocal(array.getClass().getName())); - array = new java.util.Map.Entry[0]; // member - assertFalse(ClassName.isLocal(array.getClass().getName())); - Class localClass = Class.forName(this.getClass().getName() + "$1LocalClass"); // local - array = (Object[]) Array.newInstance(localClass, 0); - assertFalse(ClassName.isLocal(array.getClass().getName())); - Class anonClass = Class.forName("java.util.Vector$1"); // local - array = (Object[]) Array.newInstance(anonClass, 0); - assertFalse(ClassName.isLocal(array.getClass().getName())); - - // test a few edge cases - assertFalse(ClassName.isLocal("java.util.Map$a1")); - assertFalse(ClassName.isLocal("java.util.Map$a1$aaa$bbb")); - assertFalse(ClassName.isLocal("java.util.Map$11$aaa")); - assertTrue(ClassName.isLocal("java.util.Map$1a")); - assertTrue(ClassName.isLocal("java.util.Map$2abc")); - assertTrue(ClassName.isLocal("java.util.Map$2abc1")); - assertFalse(ClassName.isLocal("java.util.Map$a12345$b12345")); - assertTrue(ClassName.isLocal("java.util.Map$12345$1234a")); - assertFalse(ClassName.isLocal("java.util.Map$333")); - assertFalse(ClassName.isLocal("java.util.Map3$333")); - } - - public void testIsAnonymous() throws Exception { - assertFalse(ClassName.isAnonymous(java.util.Map.class.getName())); // top-level - assertFalse(ClassName.isAnonymous(java.util.Map.Entry.class.getName())); // member - assertFalse(ClassName.isAnonymous(Class.forName(this.getClass().getName() + "$1LocalClass").getName())); // local - assertTrue(ClassName.isAnonymous(Class.forName("java.util.Vector$1").getName())); // anonymous - - Object[] array = new java.util.Map[0]; // top-level - assertFalse(ClassName.isAnonymous(array.getClass().getName())); - array = new java.util.Map.Entry[0]; // member - assertFalse(ClassName.isAnonymous(array.getClass().getName())); - Class localClass = Class.forName(this.getClass().getName() + "$1LocalClass"); // local - array = (Object[]) Array.newInstance(localClass, 0); - assertFalse(ClassName.isAnonymous(array.getClass().getName())); - Class anonClass = Class.forName("java.util.Vector$1"); // local - array = (Object[]) Array.newInstance(anonClass, 0); - assertFalse(ClassName.isAnonymous(array.getClass().getName())); - - // test a few edge cases - assertFalse(ClassName.isAnonymous("java.util.Map$a1")); - assertFalse(ClassName.isAnonymous("java.util.Map$a1$aaa$bbb")); - assertFalse(ClassName.isAnonymous("java.util.Map$1a1$aaa")); - assertFalse(ClassName.isAnonymous("java.util.Map$1$a")); - assertFalse(ClassName.isAnonymous("java.util.Map$1a")); - assertFalse(ClassName.isAnonymous("java.util.Map$a12345$b12345")); - assertFalse(ClassName.isAnonymous("java.util.Map$12345$a1234")); - assertTrue(ClassName.isAnonymous("java.util.Map$333")); - assertTrue(ClassName.isAnonymous("java.util.Map3$333")); - } - - public void testIsReference() throws Exception { - assertFalse(ClassName.isReference(int.class.getName())); // top-level - - assertTrue(ClassName.isReference(java.util.Map.class.getName())); // top-level - assertTrue(ClassName.isReference(java.util.Map.Entry.class.getName())); // member - assertTrue(ClassName.isReference(Class.forName(this.getClass().getName() + "$1LocalClass").getName())); // local - assertTrue(ClassName.isReference(Class.forName("java.util.Vector$1").getName())); // anonymous - - Object[] array = new java.util.Map[0]; // top-level - assertTrue(ClassName.isReference(array.getClass().getName())); - array = new java.util.Map.Entry[0]; // member - assertTrue(ClassName.isReference(array.getClass().getName())); - Class localClass = Class.forName(this.getClass().getName() + "$1LocalClass"); // local - array = (Object[]) Array.newInstance(localClass, 0); - assertTrue(ClassName.isReference(array.getClass().getName())); - Class anonClass = Class.forName("java.util.Vector$1"); // local - array = (Object[]) Array.newInstance(anonClass, 0); - assertTrue(ClassName.isReference(array.getClass().getName())); - } - - public void testIsPrimitive() { - assertTrue(void.class.isPrimitive()); - - assertTrue(ClassName.isPrimitive(void.class.getName())); - assertTrue(ClassName.isPrimitive(int.class.getName())); - assertTrue(ClassName.isPrimitive(float.class.getName())); - assertTrue(ClassName.isPrimitive(boolean.class.getName())); - - assertFalse(ClassName.isPrimitive(java.lang.Number.class.getName())); - assertFalse(ClassName.isPrimitive(java.lang.String.class.getName())); - assertFalse(ClassName.isPrimitive(java.lang.Boolean.class.getName())); - assertFalse(ClassName.isPrimitive(java.lang.Integer.class.getName())); - } - - public void testIsPrimitiveWrapper() { - assertFalse(ClassName.isPrimitiveWrapper(void.class.getName())); - assertFalse(ClassName.isPrimitiveWrapper(int.class.getName())); - assertFalse(ClassName.isPrimitiveWrapper(float.class.getName())); - assertFalse(ClassName.isPrimitiveWrapper(boolean.class.getName())); - - assertFalse(ClassName.isPrimitiveWrapper(java.lang.reflect.Field.class.getName())); - assertFalse(ClassName.isPrimitiveWrapper(java.lang.String.class.getName())); - assertTrue(ClassName.isPrimitiveWrapper(java.lang.Boolean.class.getName())); - assertTrue(ClassName.isPrimitiveWrapper(java.lang.Integer.class.getName())); - } - - public void testIsVariablePrimitive() { - assertFalse(ClassName.isVariablePrimitive(void.class.getName())); - - assertTrue(ClassName.isVariablePrimitive(int.class.getName())); - assertTrue(ClassName.isVariablePrimitive(float.class.getName())); - assertTrue(ClassName.isVariablePrimitive(boolean.class.getName())); - - assertFalse(ClassName.isVariablePrimitive(java.lang.Number.class.getName())); - assertFalse(ClassName.isVariablePrimitive(java.lang.String.class.getName())); - assertFalse(ClassName.isVariablePrimitive(java.lang.Boolean.class.getName())); - } - - public void testIsVariablePrimitiveWrapper() { - assertFalse(ClassName.isVariablePrimitiveWrapper(java.lang.Void.class.getName())); - - assertTrue(ClassName.isVariablePrimitiveWrapper(java.lang.Integer.class.getName())); - assertTrue(ClassName.isVariablePrimitiveWrapper(java.lang.Float.class.getName())); - assertTrue(ClassName.isVariablePrimitiveWrapper(java.lang.Boolean.class.getName())); - - assertFalse(ClassName.isVariablePrimitiveWrapper(java.lang.Number.class.getName())); - assertFalse(ClassName.isVariablePrimitiveWrapper(java.lang.String.class.getName())); - assertFalse(ClassName.isVariablePrimitiveWrapper(java.lang.Object.class.getName())); - } - - public void testGetWrapperClassName() { - assertEquals(java.lang.Void.class.getName(), ClassName.getWrapperClassName(void.class.getName())); - assertEquals(java.lang.Integer.class.getName(), ClassName.getWrapperClassName(int.class.getName())); - assertEquals(java.lang.Float.class.getName(), ClassName.getWrapperClassName(float.class.getName())); - assertEquals(java.lang.Boolean.class.getName(), ClassName.getWrapperClassName(boolean.class.getName())); - - assertNull(ClassName.getWrapperClassName(java.lang.String.class.getName())); - } - - public void testGetPrimitiveClassName() { - assertEquals(void.class.getName(), ClassName.getPrimitiveClassName(java.lang.Void.class.getName())); - assertEquals(int.class.getName(), ClassName.getPrimitiveClassName(java.lang.Integer.class.getName())); - assertEquals(float.class.getName(), ClassName.getPrimitiveClassName(java.lang.Float.class.getName())); - assertEquals(boolean.class.getName(), ClassName.getPrimitiveClassName(java.lang.Boolean.class.getName())); - - assertNull(ClassName.getPrimitiveClassName(java.lang.String.class.getName())); - } - - public void testAreAutoboxEquivalents() { - assertTrue(ClassName.areAutoboxEquivalents(Integer.class.getName(), Integer.class.getName())); - assertTrue(ClassName.areAutoboxEquivalents(int.class.getName(), Integer.class.getName())); - assertTrue(ClassName.areAutoboxEquivalents(Integer.class.getName(), int.class.getName())); - assertFalse(ClassName.areAutoboxEquivalents(int.class.getName(), Boolean.class.getName())); - assertTrue(ClassName.areAutoboxEquivalents(String.class.getName(), String.class.getName())); - } - - public void testForCode() { - assertEquals("byte", ClassName.forCode('B')); - assertEquals("char", ClassName.forCode('C')); - assertEquals("double", ClassName.forCode('D')); - assertEquals("float", ClassName.forCode('F')); - assertEquals("int", ClassName.forCode('I')); - assertEquals("long", ClassName.forCode('J')); - assertEquals("short", ClassName.forCode('S')); - assertEquals("boolean", ClassName.forCode('Z')); - assertEquals("void", ClassName.forCode('V')); - - assertNull(ClassName.forCode('X')); - - assertEquals("byte", ClassName.forCode((int) 'B')); - assertEquals("char", ClassName.forCode((int) 'C')); - assertEquals("double", ClassName.forCode((int) 'D')); - assertEquals("float", ClassName.forCode((int) 'F')); - assertEquals("int", ClassName.forCode((int) 'I')); - assertEquals("long", ClassName.forCode((int) 'J')); - assertEquals("short", ClassName.forCode((int) 'S')); - assertEquals("boolean", ClassName.forCode((int) 'Z')); - assertEquals("void", ClassName.forCode((int) 'V')); - - assertNull(ClassName.forCode((int) 'X')); - } - - public void testGetCodeForClassName() { - assertEquals('I', ClassName.getCodeForClassName(int.class.getName())); - assertEquals('I', ClassName.getCodeForClassName("int")); - assertEquals('B', ClassName.getCodeForClassName(byte.class.getName())); - assertEquals('B', ClassName.getCodeForClassName("byte")); - - assertEquals((char) 0, ClassName.getCodeForClassName(java.lang.Object.class.getName())); - } - - public void testConstructor() { - boolean exCaught = false; - try { - Object at = ReflectionTools.newInstance(ClassName.class); - fail("bogus: " + at); //$NON-NLS-1$ - } catch (RuntimeException ex) { - if (ex.getCause() instanceof InvocationTargetException) { - if (ex.getCause().getCause() instanceof UnsupportedOperationException) { - exCaught = true; - } - } - } - assertTrue(exCaught); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ClasspathTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ClasspathTests.java deleted file mode 100644 index 6542662416..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ClasspathTests.java +++ /dev/null @@ -1,402 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.io.File; -import java.io.IOException; -import java.net.URL; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.jar.JarEntry; -import java.util.jar.JarFile; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.Classpath; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.Tools; - -@SuppressWarnings("nls") -public class ClasspathTests extends TestCase { - private static final String JAVA_HOME = System.getProperty("java.home"); - - public ClasspathTests(String name) { - super(name); - } - - public void testCompressed() { - String path = ""; - - // no changes - path = new Classpath(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar")).compressed().getPath(); - assertEquals(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar"), path); - - path = new Classpath(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar")).compressed().getPath(); - assertEquals(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar"), path); - - path = new Classpath(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\i18n.jar;C:\\jdk\\jaws.jar")).compressed().getPath(); - assertEquals(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar"), path); - - path = new Classpath(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar;C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar")).compressed().getPath(); - assertEquals(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar"), path); - - path = new Classpath(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\i18n.jar;C:\\jdk\\i18n.jar;C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar")).compressed().getPath(); - assertEquals(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar"), path); - - path = new Classpath(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar;C:\\jdk\\rt.jar;;;;C:\\jdk\\jaws.jar;C:\\jdk\\jaws.jar;C:\\jdk\\rt.jar;;;")).compressed().getPath(); - assertEquals(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar"), path); - - // no changes - path = new Classpath(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar")).compressed().getPath(); - assertEquals(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar"), path); - - path = new Classpath(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar")).compressed().getPath(); - assertEquals(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar"), path); - - path = new Classpath(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\..\\jdk\\i18n.jar;C:\\jdk\\jaws.jar")).compressed().getPath(); - assertEquals(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar"), path); - - path = new Classpath(this.morph("C:\\jdk1\\jdk2\\jdk3\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk1\\jdk2\\jdk3\\..\\..\\..\\jdk1\\jdk2\\jdk3\\i18n.jar;C:\\jdk\\jaws.jar")).compressed().getPath(); - assertEquals(this.morph("C:\\jdk1\\jdk2\\jdk3\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar"), path); - - } - - public void testConvertToClassName() { - String fileName = "java/lang/String.class"; - File file = new File(fileName); - String className = Classpath.convertToClassName(file); - assertEquals(java.lang.String.class.getName(), className); - } - - public void testConvertToClass() throws ClassNotFoundException { - String fileName = "java/lang/String.class"; - File file = new File(fileName); - Class javaClass = Classpath.convertToClass(file); - assertEquals(java.lang.String.class, javaClass); - } - - public void testConvertToArchiveClassFileEntryName() { - String fileName = Classpath.convertToArchiveClassFileEntryName(java.lang.String.class); - assertEquals("java/lang/String.class", fileName); - } - - public void testConvertToArchiveEntryNameBase() { - String fileName = Classpath.convertToArchiveEntryNameBase(java.lang.String.class); - assertEquals("java/lang/String", fileName); - } - - public void testConvertToClassFileName() { - char sc = File.separatorChar; - String fileName = Classpath.convertToClassFileName(java.lang.String.class); - assertEquals("java" + sc + "lang" + sc + "String.class", fileName); - } - - public void testConvertToClassFileString() { - char sc = File.separatorChar; - File file = Classpath.convertToClassFile(java.lang.String.class.getName()); - assertEquals("java" + sc + "lang" + sc + "String.class", file.getPath()); - } - - public void testConvertToClassFileClass() { - char sc = File.separatorChar; - File file = Classpath.convertToClassFile(java.lang.String.class); - assertEquals("java" + sc + "lang" + sc + "String.class", file.getPath()); - } - - public void testConvertToJavaFileName() { - char sc = File.separatorChar; - String fileName = Classpath.convertToJavaFileName(java.lang.String.class); - assertEquals("java" + sc + "lang" + sc + "String.java", fileName); - } - - public void testConvertToJavaFileString() { - char sc = File.separatorChar; - File file = Classpath.convertToJavaFile(java.lang.String.class.getName()); - assertEquals("java" + sc + "lang" + sc + "String.java", file.getPath()); - } - - public void testConvertToJavaFileClass() { - char sc = File.separatorChar; - File file = Classpath.convertToJavaFile(java.lang.String.class); - assertEquals("java" + sc + "lang" + sc + "String.java", file.getPath()); - } - - public void testConvertToFileNameBase() { - char sc = File.separatorChar; - String fileName = Classpath.convertToFileNameBase(java.lang.String.class); - assertEquals("java" + sc + "lang" + sc + "String", fileName); - } - - public void testConvertToURLs() { - Iterator entries = new Classpath(this.morph("C:\\jdk\\rt.jar;C:\\jdk\\i18n.jar;C:\\jdk\\jaws.jar;C:\\foo\\classes;C:\\bar\\bar.jar")).getURLs().iterator(); - assertEquals(this.morphURL("/C:/jdk/rt.jar"), entries.next().getPath()); - assertEquals(this.morphURL("/C:/jdk/i18n.jar"), entries.next().getPath()); - assertEquals(this.morphURL("/C:/jdk/jaws.jar"), entries.next().getPath()); - assertEquals(this.morphURL("/C:/foo/classes"), entries.next().getPath()); - assertEquals(this.morphURL("/C:/bar/bar.jar"), entries.next().getPath()); - assertFalse(entries.hasNext()); - } - - public void testGetEntries() { - Classpath cp = new Classpath(this.morph("C:\\jdk\\rt.jar;;.;C:\\jdk\\i18n.jar;;;C:\\jdk\\jaws.jar;;C:\\foo\\classes;C:\\bar\\bar.jar;C:\\bar\\bar.jar;")); - Iterator entries = cp.getEntries().iterator(); - assertEquals(this.morph("C:\\jdk\\rt.jar"), entries.next().getFileName()); - assertEquals(this.morph("."), entries.next().getFileName()); - assertEquals(this.morph("C:\\jdk\\i18n.jar"), entries.next().getFileName()); - assertEquals(this.morph("C:\\jdk\\jaws.jar"), entries.next().getFileName()); - assertEquals(this.morph("C:\\foo\\classes"), entries.next().getFileName()); - assertEquals(this.morph("C:\\bar\\bar.jar"), entries.next().getFileName()); - assertEquals(this.morph("C:\\bar\\bar.jar"), entries.next().getFileName()); - assertFalse(entries.hasNext()); - - cp = cp.compressed(); - entries = cp.getEntries().iterator(); - assertEquals(this.morph("C:\\jdk\\rt.jar"), entries.next().getFileName()); - assertEquals(this.morph("."), entries.next().getFileName()); - assertEquals(this.morph("C:\\jdk\\i18n.jar"), entries.next().getFileName()); - assertEquals(this.morph("C:\\jdk\\jaws.jar"), entries.next().getFileName()); - assertEquals(this.morph("C:\\foo\\classes"), entries.next().getFileName()); - assertEquals(this.morph("C:\\bar\\bar.jar"), entries.next().getFileName()); - assertFalse(entries.hasNext()); - } - - public void testGetEntryForFileNamed() { - Classpath.Entry entry = null; - - // in the middle - qualified - entry = new Classpath(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\rt.jar;C:\\jdk\\jaws.jar;C:\\foo\\classes;C:\\bar\\bar.jar")).getEntryForFileNamed("rt.jar"); - assertEquals(this.morph("C:\\jdk\\rt.jar"), entry.getFileName()); - - // in the middle - unqualified - entry = new Classpath(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\jaws.jar;rt.jar;C:\\foo\\classes;C:\\bar\\bar.jar")).getEntryForFileNamed("rt.jar"); - assertEquals("rt.jar", entry.getFileName()); - - // at the beginning - qualified - entry = new Classpath(this.morph("C:\\jdk\\rt.jar;C:\\jdk\\i18n.jar;C:\\jdk\\jaws.jar;C:\\foo\\classes;C:\\bar\\bar.jar")).getEntryForFileNamed("rt.jar"); - assertEquals(this.morph("C:\\jdk\\rt.jar"), entry.getFileName()); - - // at the beginning - unqualified - entry = new Classpath(this.morph("rt.jar;C:\\jdk\\i18n.jar;C:\\jdk\\jaws.jar;C:\\foo\\classes;C:\\bar\\bar.jar")).getEntryForFileNamed("rt.jar"); - assertEquals("rt.jar", entry.getFileName()); - - // at the end - qualified - entry = new Classpath(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\jaws.jar;C:\\foo\\classes;C:\\bar\\bar.jar;C:\\jdk\\rt.jar")).getEntryForFileNamed("rt.jar"); - assertEquals(this.morph("C:\\jdk\\rt.jar"), entry.getFileName()); - - // at the end - unqualified - entry = new Classpath(this.morph("C:\\jdk\\i18n.jar;C:\\jdk\\jaws.jar;C:\\foo\\classes;C:\\bar\\bar.jar;rt.jar")).getEntryForFileNamed("rt.jar"); - assertEquals("rt.jar", entry.getFileName()); - - // alone - qualified - entry = new Classpath(this.morph("C:\\jdk\\rt.jar")).getEntryForFileNamed("rt.jar"); - assertEquals(this.morph("C:\\jdk\\rt.jar"), entry.getFileName()); - - // alone - unqualified - entry = new Classpath("rt.jar").getEntryForFileNamed("rt.jar"); - assertEquals("rt.jar", entry.getFileName()); - - // trick entry at the beginning - entry = new Classpath(this.morph("rt.jar.new;C:\\jdk\\rt.jar;C:\\jdk\\i18n.jar;C:\\jdk\\jaws.jar;C:\\foo\\classes;C:\\bar\\bar.jar")).getEntryForFileNamed("rt.jar"); - assertEquals(this.morph("C:\\jdk\\rt.jar"), entry.getFileName()); - - // trick entry in the middle - entry = new Classpath(this.morph("rt.jar.new;C:\\jdk\\rtrtrt.jar;C:\\jdk\\rt.jar;C:\\jdk\\i18n.jar;C:\\jdk\\jaws.jar;C:\\foo\\classes;C:\\bar\\bar.jar")).getEntryForFileNamed("rt.jar"); - assertEquals(this.morph("C:\\jdk\\rt.jar"), entry.getFileName()); - - // trick entry at the end - entry = new Classpath(this.morph("rt.jar.new;C:\\jdk\\rtrtrt.jar;C:\\jdk\\rt.jar;C:\\jdk\\i18n.jar;C:\\jdk\\jaws.jar;C:\\foo\\classes;C:\\bar\\bar.jar;C:\\jdk\\rtrtrt.jar")).getEntryForFileNamed("rt.jar"); - assertEquals(this.morph("C:\\jdk\\rt.jar"), entry.getFileName()); - - // missing - entry = new Classpath(this.morph("rt.jar.new;C:\\jdk\\rtrtrt.jar;C:\\jdk\\i18n.jar;C:\\jdk\\jaws.jar;C:\\foo\\classes;C:\\bar\\bar.jar;C:\\jdk\\rtrtrt.jar")).getEntryForFileNamed("rt.jar"); - assertEquals("path entry should not be found", null, entry); - - } - - public void testGetEntryForClassNamed() { - assertNotNull(Classpath.completeClasspath().getEntryForClassNamed(java.lang.String.class.getName())); - assertNull(Classpath.completeClasspath().getEntryForClassNamed("foo.bar.Baz")); - } - - public void testLocationForClass() { - Class javaClass = Classpath.class; - File entry = new File(Classpath.locationFor(javaClass)); - if (entry.isFile() || entry.isDirectory()) { - assertTrue(entry.exists()); - } - if (entry.isDirectory()) { - assertTrue(new File(entry, Classpath.convertToClassFileName(javaClass)).exists()); - } - } - - public void testRtJarName() throws IOException { - File rtFile = new File(Classpath.rtJarName()); - assertTrue("rt.jar does not exist", rtFile.exists()); - - JarFile rtJarFile = new JarFile(rtFile); - JarEntry entry = rtJarFile.getJarEntry("java/lang/Object.class"); - rtJarFile.close(); - assertTrue("bogus rt.jar", entry != null); - } - - public void testJREClassNames() { - assertTrue("Vector is missing from JRE class names", CollectionTools.contains(Classpath.bootClasspath().getClassNames(), java.util.Vector.class.getName())); - assertTrue("File is missing from JRE class names", CollectionTools.contains(Classpath.bootClasspath().getClassNames(), java.io.File.class.getName())); - } - - public void testJavaExtensionDirectoryNames() { - char sep = File.separatorChar; - String stdExtDirName = JAVA_HOME + sep + "lib" + sep + "ext"; - assertTrue("standard extension dir name missing: " + stdExtDirName, ArrayTools.contains(Classpath.javaExtensionDirectoryNames(), stdExtDirName)); - } - - public void testJavaExtensionDirectories() { - char sep = File.separatorChar; - File stdExtDir = new File(JAVA_HOME + sep + "lib" + sep + "ext"); - assertTrue("standard extension dir missing: " + stdExtDir.getParent(), ArrayTools.contains(Classpath.javaExtensionDirectories(), stdExtDir)); - } - - public void testJavaExtensionClasspathEntries() { - char sep = File.separatorChar; - String jdk = System.getProperty("java.version"); - if (jdk.startsWith("1.4") || jdk.startsWith("1.5") || jdk.startsWith("1.6")) { - Collection jarNames = new ArrayList(); - Iterable entries = Classpath.javaExtensionClasspath().getEntries(); - for (Classpath.Entry entry : entries) { - jarNames.add(entry.getFileName()); - } - String stdExtJarName = JAVA_HOME + sep + "lib" + sep + "ext" + sep + "dnsns.jar"; - String msg = "jdk 1.4.x standard extension jar missing: " + stdExtJarName; - boolean jarPresent = jarNames.contains(stdExtJarName); - if (Tools.jvmIsSun() || (Tools.jvmIsIBM() && jdk.startsWith("1.6"))) { - assertTrue(msg, jarPresent); - } - } else { - fail("we need to update this test for the current jdk"); - } - } - - public void testJavaExtensionClassNames() { - String jdk = System.getProperty("java.version"); - if (jdk.startsWith("1.4") || jdk.startsWith("1.5") || jdk.startsWith("1.6")) { - String className = "sun.net.spi.nameservice.dns.DNSNameService"; - String msg = "jdk 1.4.x standard extension class missing: " + className; - boolean classPresent = CollectionTools.contains(Classpath.javaExtensionClasspath().classNames(), className); - if (Tools.jvmIsSun() || (Tools.jvmIsIBM() && jdk.startsWith("1.6"))) { - assertTrue(msg, classPresent); - } - } else { - fail("we need to update this test for the current jdk"); - } - } - - public void testJavaClasspathClassNames() { - String className = this.getClass().getName(); - ClassLoader cl = this.getClass().getClassLoader(); - // make sure we are running under the "normal" class loader; - // when the tests are executed as an ANT task, they are run under - // an ANT class loader and the "Java" classpath does not include this class - if (cl.getClass().getName().startsWith("sun.misc")) { - assertTrue("class missing: " + className, CollectionTools.contains(Classpath.javaClasspath().getClassNames(), className)); - } - } - - public void testCompleteClasspathClassNames() { - String className = this.getClass().getName(); - ClassLoader cl = this.getClass().getClassLoader(); - // make sure we are running under the "normal" class loader; - // when the tests are executed as an ANT task, they are run under - // an ANT class loader and the "Java" classpath does not include this class - if (cl.getClass().getName().startsWith("sun.misc")) { - assertTrue("class missing: " + className, CollectionTools.contains(Classpath.completeClasspath().getClassNames(), className)); - } - } - - public void testClasspathForClass() { - assertNotNull(Classpath.classpathFor(java.lang.String.class)); - } - - public void testAddClassNamesTo() { - Collection classNames = new ArrayList(1000); - Classpath.bootClasspath().addClassNamesTo(classNames); - assertTrue(classNames.contains(java.util.Vector.class.getName())); - } - - public void testToString() { - assertNotNull(Classpath.bootClasspath().toString()); - } - - public void testEntry_getCanonicalFile() { - Classpath.Entry entry = Classpath.bootClasspath().getEntryForClassNamed(java.lang.String.class.getName()); - assertTrue(entry.getCanonicalFile().getPath().endsWith(".jar")); - } - - public void testEntry_getCanonicalFileName() { - Classpath.Entry entry = Classpath.bootClasspath().getEntryForClassNamed(java.lang.String.class.getName()); - String name = entry.getCanonicalFileName(); - if (Tools.jvmIsSun()) { - assertTrue(name.endsWith("rt.jar")); - } else if (Tools.jvmIsIBM()) { - assertTrue(name.endsWith("vm.jar")); - } - } - - public void testEntry_equals() { - Classpath.Entry entry = Classpath.bootClasspath().getEntryForClassNamed(java.lang.String.class.getName()); - assertFalse(entry.equals("foo")); - } - - public void testEntry_containsClass() { - Classpath.Entry entry = Classpath.bootClasspath().getEntryForClassNamed(java.lang.String.class.getName()); - assertTrue(entry.contains(java.lang.String.class)); - } - - public void testEntry_containsString() { - Classpath.Entry entry = Classpath.bootClasspath().getEntryForClassNamed(java.lang.String.class.getName()); - assertTrue(entry.contains(java.lang.String.class.getName())); - } - - public void testEntry_getClassNames() { - Classpath.Entry entry = Classpath.bootClasspath().getEntryForClassNamed(java.lang.String.class.getName()); - assertTrue(CollectionTools.contains(entry.getClassNames(), java.lang.String.class.getName())); - } - - public void testEntry_classNames() { - Classpath.Entry entry = Classpath.bootClasspath().getEntryForClassNamed(java.lang.String.class.getName()); - assertTrue(CollectionTools.contains(entry.classNames(), java.lang.String.class.getName())); - } - - /** - * morph the specified path to a platform-independent path - */ - private String morph(String path) { - String result = path; - result = result.replace('\\', File.separatorChar); - result = result.replace(';', File.pathSeparatorChar); - if (!ArrayTools.contains(File.listRoots(), new File("C:\\"))) { - result = result.replaceAll("C:", ""); - } - return result; - } - - /** - * morph the specified URL to a platform-independent path - */ - private String morphURL(String url) { - String result = url; - if (!ArrayTools.contains(File.listRoots(), new File("C:\\"))) { - result = result.replaceAll("/C:", ""); - } - return result; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CollectionToolsTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CollectionToolsTests.java deleted file mode 100644 index a397d85f30..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CollectionToolsTests.java +++ /dev/null @@ -1,2354 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.Comparator; -import java.util.HashSet; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.ListIterator; -import java.util.NoSuchElementException; -import java.util.Random; -import java.util.Set; -import java.util.SortedSet; -import java.util.TreeSet; -import java.util.Vector; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.Bag; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.Range; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.ReverseComparator; -import org.eclipse.jpt.common.utility.internal.enumerations.EmptyEnumeration; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; - -@SuppressWarnings("nls") -public class CollectionToolsTests extends TestCase { - - public CollectionToolsTests(String name) { - super(name); - } - - - // ********** add all ********** - - public void testAddAllCollectionIterable_StringModified() { - List list1 = this.buildStringList1(); - Iterable iterable2 = this.buildStringList2(); - assertTrue(CollectionTools.addAll(list1, iterable2.iterator())); - assertEquals(6, list1.size()); - assertTrue(list1.containsAll(this.buildStringList2())); - } - - public void testAddAllCollectionIterable_StringUnmodified() { - Set set1 = this.buildStringSet1(); - Iterable iterable3 = this.buildStringList1(); // same elements as set1 - assertFalse(CollectionTools.addAll(set1, iterable3.iterator())); - assertEquals(3, set1.size()); - assertTrue(set1.containsAll(this.buildStringList1())); - } - - public void testAddAllCollectionIterable_ObjectModified() { - List list1 = this.buildObjectList1(); - Iterable iterable2 = this.buildStringList2(); - assertTrue(CollectionTools.addAll(list1, iterable2)); - assertEquals(6, list1.size()); - assertTrue(list1.containsAll((List) iterable2)); - } - - public void testAddAllCollectionIterable_ObjectUnmodified() { - Set set1 = this.buildObjectSet1(); - Iterable iterable3 = this.buildStringList1(); // same elements as set1 - assertFalse(CollectionTools.addAll(set1, iterable3)); - assertEquals(3, set1.size()); - assertTrue(set1.containsAll((List) iterable3)); - } - - public void testAddAllCollectionIterable_EmptyIterable() { - Set set1 = this.buildObjectSet1(); - assertFalse(CollectionTools.addAll(set1, EmptyIterable.instance())); - assertEquals(3, set1.size()); - } - - public void testAddAllCollectionIterableInt_Modified() { - List list1 = this.buildStringList1(); - List list2 = this.buildStringList2(); - Iterable iterable2 = list2; - assertTrue(CollectionTools.addAll(list1, iterable2, list2.size())); - assertEquals(6, list1.size()); - assertTrue(list1.containsAll(this.buildStringList2())); - } - - public void testAddAllCollectionIterableInt_Unmodified() { - Set set1 = this.buildStringSet1(); - List list1 = this.buildStringList1(); // same elements as set1 - Iterable iterable3 = list1; - assertFalse(CollectionTools.addAll(set1, iterable3, list1.size())); - assertEquals(3, set1.size()); - assertTrue(set1.containsAll(this.buildStringList1())); - } - - public void testAddAllCollectionIterator_StringModified() { - List list1 = this.buildStringList1(); - List list2 = this.buildStringList2(); - assertTrue(CollectionTools.addAll(list1, list2.iterator())); - assertEquals(6, list1.size()); - assertTrue(list1.containsAll(list2)); - } - - public void testAddAllCollectionIterator_StringUnmodified() { - Set set1 = this.buildStringSet1(); - List list3 = this.buildStringList1(); // same elements as s1 - assertFalse(CollectionTools.addAll(set1, list3.iterator())); - assertEquals(3, set1.size()); - assertTrue(set1.containsAll(list3)); - } - - public void testAddAllCollectionIterator_ObjectModified() { - List list1 = this.buildObjectList1(); - List list2 = this.buildStringList2(); - assertTrue(CollectionTools.addAll(list1, list2.iterator())); - assertEquals(6, list1.size()); - assertTrue(list1.containsAll(list2)); - } - - public void testAddAllCollectionIterator_ObjectUnmodified() { - Set set1 = this.buildObjectSet1(); - List list3 = this.buildStringList1(); // same elements as s1 - assertFalse(CollectionTools.addAll(set1, list3.iterator())); - assertEquals(3, set1.size()); - assertTrue(set1.containsAll(list3)); - } - - public void testAddAllCollectionIterator_EmptyIterator() { - List list1 = this.buildStringList1(); - assertFalse(CollectionTools.addAll(list1, EmptyIterator.instance())); - assertEquals(3, list1.size()); - } - - public void testAddAllCollectionIteratorInt_Modified() { - List list1 = this.buildStringList1(); - List list2 = this.buildStringList2(); - assertTrue(CollectionTools.addAll(list1, list2.iterator(), 3)); - assertEquals(6, list1.size()); - assertTrue(list1.containsAll(list2)); - } - - public void testAddAllCollectionIteratorInt_Unmodified() { - Set set1 = this.buildStringSet1(); - List list3 = this.buildStringList1(); // same elements as s1 - assertFalse(CollectionTools.addAll(set1, list3.iterator(), 3)); - assertEquals(3, set1.size()); - assertTrue(set1.containsAll(list3)); - } - - public void testAddAllCollectionIteratorInt_EmptyIterator() { - List list1 = this.buildStringList1(); - assertFalse(CollectionTools.addAll(list1, EmptyIterator.instance(), 0)); - assertEquals(3, list1.size()); - } - - public void testAddAllCollectionObjectArray_StringModified() { - List list = this.buildStringList1(); - String[] a = this.buildStringArray1(); - assertTrue(CollectionTools.addAll(list, a)); - assertEquals(6, list.size()); - assertTrue(list.containsAll(CollectionTools.collection(a))); - } - - public void testAddAllCollectionObjectArray_StringListEmptyArray() { - List list = this.buildStringList1(); - assertFalse(CollectionTools.addAll(list, new String[0])); - } - - public void testAddAllCollectionObjectArray_StringUnmodified() { - Set set = this.buildStringSet1(); - String[] a = this.buildStringArray1(); - assertFalse(CollectionTools.addAll(set, a)); - assertEquals(3, set.size()); - assertTrue(set.containsAll(CollectionTools.collection(a))); - - assertFalse(CollectionTools.addAll(set, new String[0])); - } - - public void testAddAllCollectionObjectArray_StringSetEmptyArray() { - Set set = this.buildStringSet1(); - assertFalse(CollectionTools.addAll(set, new String[0])); - } - - public void testAddAllCollectionObjectArray_ObjectModified() { - List list = this.buildObjectList1(); - String[] a = this.buildStringArray1(); - - assertTrue(CollectionTools.addAll(list, a)); - assertEquals(6, list.size()); - assertTrue(list.containsAll(CollectionTools.collection(a))); - } - - public void testAddAllCollectionObjectArray_ObjectUnmodified() { - String[] a = this.buildStringArray1(); - Set set = this.buildObjectSet1(); - assertFalse(CollectionTools.addAll(set, a)); - assertEquals(3, set.size()); - assertTrue(set.containsAll(CollectionTools.collection(a))); - } - - public void testAddAllListIntObjectArray() { - List list = this.buildStringList1(); - CollectionTools.addAll(list, 2, new String[] { "X", "X", "X" }); - assertEquals(6, list.size()); - assertTrue(list.contains("X")); - assertTrue(Arrays.equals(new Object[] { "zero", "one", "X", "X", "X", "two" }, list.toArray())); - } - - public void testAddAllListIntObjectArray_Zero() { - List list = new ArrayList(); - CollectionTools.addAll(list, 0, new String[] { "X", "X", "X" }); - assertEquals(3, list.size()); - assertTrue(list.contains("X")); - assertTrue(Arrays.equals(new Object[] { "X", "X", "X" }, list.toArray())); - } - - public void testAddAllListIntObjectArray_EmptyArray() { - List list = this.buildStringList1(); - CollectionTools.addAll(list, 2, new String[0]); - assertEquals(3, list.size()); - assertTrue(Arrays.equals(new Object[] { "zero", "one", "two" }, list.toArray())); - } - - public void testAddAllListIntIterable() { - List list = this.buildStringList1(); - Iterable iterable = Arrays.asList(new String[] { "X", "X", "X" }); - CollectionTools.addAll(list, 2, iterable); - assertEquals(6, list.size()); - assertTrue(list.contains("X")); - assertTrue(Arrays.equals(new Object[] { "zero", "one", "X", "X", "X", "two" }, list.toArray())); - } - - public void testAddAllListIntIterable_Zero() { - List list = new ArrayList(); - Iterable iterable = Arrays.asList(new String[] { "X", "X", "X" }); - CollectionTools.addAll(list, 0, iterable); - assertEquals(3, list.size()); - assertTrue(list.contains("X")); - assertTrue(Arrays.equals(new Object[] { "X", "X", "X" }, list.toArray())); - } - - public void testAddAllListIntIterable_EmptyIterable() { - List list = this.buildStringList1(); - Iterable iterable = EmptyIterable.instance(); - CollectionTools.addAll(list, 2, iterable); - assertEquals(3, list.size()); - assertTrue(Arrays.equals(new Object[] { "zero", "one", "two" }, list.toArray())); - } - - public void testAddAllListIntIterableInt() { - List list = this.buildStringList1(); - Iterable iterable = Arrays.asList(new String[] { "X", "X", "X" }); - CollectionTools.addAll(list, 2, iterable, 3); - assertEquals(6, list.size()); - assertTrue(list.contains("X")); - assertTrue(Arrays.equals(new Object[] { "zero", "one", "X", "X", "X", "two" }, list.toArray())); - } - - public void testAddAllListIntIterableInt_Zero() { - List list = new ArrayList(); - Iterable iterable = Arrays.asList(new String[] { "X", "X", "X" }); - CollectionTools.addAll(list, 0, iterable, 3); - assertEquals(3, list.size()); - assertTrue(list.contains("X")); - assertTrue(Arrays.equals(new Object[] { "X", "X", "X" }, list.toArray())); - } - - public void testAddAllListIntIterableInt_EmptyIterable() { - List list = this.buildStringList1(); - Iterable iterable = EmptyIterable.instance(); - CollectionTools.addAll(list, 2, iterable, 0); - assertEquals(3, list.size()); - assertTrue(Arrays.equals(new Object[] { "zero", "one", "two" }, list.toArray())); - } - - public void testAddAllListIntIterator() { - List list = this.buildStringList1(); - Iterator iterator = Arrays.asList(new String[] { "X", "X", "X" }).iterator(); - CollectionTools.addAll(list, 2, iterator); - assertEquals(6, list.size()); - assertTrue(list.contains("X")); - assertTrue(Arrays.equals(new Object[] { "zero", "one", "X", "X", "X", "two" }, list.toArray())); - } - - public void testAddAllListIntIterator_Zero() { - List list = new ArrayList(); - Iterator iterator = Arrays.asList(new String[] { "X", "X", "X" }).iterator(); - CollectionTools.addAll(list, 0, iterator); - assertEquals(3, list.size()); - assertTrue(list.contains("X")); - assertTrue(Arrays.equals(new Object[] { "X", "X", "X" }, list.toArray())); - } - - public void testAddAllListIntIterator_EmptyIterator() { - List list = this.buildStringList1(); - Iterator iterator = EmptyIterator.instance(); - CollectionTools.addAll(list, 2, iterator); - assertEquals(3, list.size()); - assertTrue(Arrays.equals(new Object[] { "zero", "one", "two" }, list.toArray())); - } - - public void testAddAllListIntIteratorInt() { - List list = this.buildStringList1(); - Iterator iterator = Arrays.asList(new String[] { "X", "X", "X" }).iterator(); - CollectionTools.addAll(list, 2, iterator, 3); - assertEquals(6, list.size()); - assertTrue(list.contains("X")); - assertTrue(Arrays.equals(new Object[] { "zero", "one", "X", "X", "X", "two" }, list.toArray())); - } - - public void testAddAllListIntIteratorInt_Zero() { - List list = new ArrayList(); - Iterator iterator = Arrays.asList(new String[] { "X", "X", "X" }).iterator(); - CollectionTools.addAll(list, 0, iterator, 3); - assertEquals(3, list.size()); - assertTrue(list.contains("X")); - assertTrue(Arrays.equals(new Object[] { "X", "X", "X" }, list.toArray())); - } - - public void testAddAllListIntIteratorInt_EmptyIterator() { - List list = this.buildStringList1(); - Iterator iterator = EmptyIterator.instance(); - CollectionTools.addAll(list, 2, iterator, 0); - assertEquals(3, list.size()); - assertTrue(Arrays.equals(new Object[] { "zero", "one", "two" }, list.toArray())); - } - - - // ********** bag ********** - - public void testBagEnumeration_String() { - Bag b = CollectionTools.bag(this.buildStringVector1().elements()); - assertEquals(3, b.size()); - assertTrue(b.containsAll(this.buildStringVector1())); - } - - public void testBagEnumeration_Object() { - Bag b = CollectionTools.bag(this.buildStringVector1().elements()); - assertEquals(3, b.size()); - assertTrue(b.containsAll(this.buildStringVector1())); - } - - public void testBagEnumeration_Empty() { - Bag b = CollectionTools.bag(EmptyEnumeration.instance()); - assertEquals(0, b.size()); - } - - public void testBagEnumerationInt() { - Bag b = CollectionTools.bag(this.buildStringVector1().elements(), 3); - assertEquals(3, b.size()); - assertTrue(b.containsAll(this.buildStringVector1())); - } - - public void testBagEnumerationInt_Empty() { - Bag b = CollectionTools.bag(EmptyEnumeration.instance(), 3); - assertEquals(0, b.size()); - } - - public void testBagIterable() { - Iterable iterable = this.buildStringList1(); - Bag b = CollectionTools.bag(iterable); - assertEquals(3, b.size()); - assertTrue(b.containsAll(this.buildStringList1())); - } - - public void testBagIterableInt() { - Iterable iterable = this.buildStringList1(); - Bag b = CollectionTools.bag(iterable, 3); - assertEquals(3, b.size()); - assertTrue(b.containsAll(this.buildStringList1())); - } - - public void testBagIterator_String() { - Bag b = CollectionTools.bag(this.buildStringList1().iterator()); - assertEquals(3, b.size()); - assertTrue(b.containsAll(this.buildStringList1())); - } - - public void testBagIterator_StringObject() { - Collection c = new ArrayList(); - c.add("zero"); - c.add("one"); - c.add("two"); - c.add("three"); - Bag b = CollectionTools.bag(c.iterator()); - assertEquals(4, b.size()); - assertTrue(b.containsAll(c)); - } - - public void testBagIterator_Empty() { - Bag b = CollectionTools.bag(EmptyIterator.instance()); - assertEquals(0, b.size()); - } - - public void testBagIteratorInt() { - Bag b = CollectionTools.bag(this.buildStringList1().iterator(), 3); - assertEquals(3, b.size()); - assertTrue(b.containsAll(this.buildStringList1())); - } - - public void testBagIteratorInt_Empty() { - Bag b = CollectionTools.bag(EmptyIterator.instance(), 3); - assertEquals(0, b.size()); - } - - public void testBagObjectArray() { - Bag b = CollectionTools.bag(this.buildStringArray1()); - assertEquals(3, b.size()); - assertTrue(CollectionTools.containsAll(b, (Object[]) this.buildStringArray1())); - } - - public void testBagObjectArray_Vararg() { - Bag b = CollectionTools.bag("foo", "bar", "baz"); - assertEquals(3, b.size()); - assertTrue(CollectionTools.containsAll(b, new Object[]{"foo", "bar", "baz"})); - } - - public void testBagObjectArray_Empty() { - Bag b = CollectionTools.bag(Bag.Empty.instance()); - assertEquals(0, b.size()); - } - - - // ********** collection ********** - - public void testCollectionEnumeration() { - Collection c = CollectionTools.collection(this.buildStringVector1().elements()); - assertEquals(3, c.size()); - assertTrue(c.containsAll(this.buildStringVector1())); - } - - public void testCollectionEnumeration_ObjectString() { - Collection c = CollectionTools.collection(this.buildStringVector1().elements()); - assertEquals(3, c.size()); - assertTrue(c.containsAll(this.buildStringVector1())); - } - - public void testCollectionEnumerationInt() { - Collection c = CollectionTools.collection(this.buildStringVector1().elements(), 3); - assertEquals(3, c.size()); - assertTrue(c.containsAll(this.buildStringVector1())); - } - - public void testCollectionIterable() { - Iterable iterable = this.buildStringList1(); - Collection c = CollectionTools.collection(iterable); - assertEquals(3, c.size()); - assertTrue(c.containsAll(this.buildStringList1())); - } - - public void testCollectionIterableInt() { - Iterable iterable = this.buildStringList1(); - Collection c = CollectionTools.collection(iterable, 3); - assertEquals(3, c.size()); - assertTrue(c.containsAll(this.buildStringList1())); - } - - public void testCollectionIterator() { - Collection c = CollectionTools.collection(this.buildStringList1().iterator()); - assertEquals(3, c.size()); - assertTrue(c.containsAll(this.buildStringList1())); - } - - public void testCollectionIterator_ObjectString() { - Collection c = CollectionTools.collection(this.buildStringList1().iterator()); - assertEquals(3, c.size()); - assertTrue(c.containsAll(this.buildStringList1())); - } - - public void testCollectionIteratorInt() { - Collection c = CollectionTools.collection(this.buildStringList1().iterator(), 3); - assertEquals(3, c.size()); - assertTrue(c.containsAll(this.buildStringList1())); - } - - public void testCollectionObjectArray() { - Collection c = CollectionTools.collection(this.buildStringArray1()); - assertEquals(3, c.size()); - assertTrue(CollectionTools.containsAll(c, (Object[]) this.buildStringArray1())); - } - - - // ********** contains ********** - - public void testContainsEnumerationObject_String() { - Vector v = this.buildStringVector1(); - assertTrue(CollectionTools.contains(v.elements(), "one")); - assertFalse(CollectionTools.contains(v.elements(), null)); - v.add(null); - assertTrue(CollectionTools.contains(v.elements(), null)); - } - - public void testContainsEnumerationObject_Object() { - Vector c = new Vector(); - c.add("zero"); - c.add("one"); - c.add("two"); - c.add("three"); - String one = "one"; - assertTrue(CollectionTools.contains(c.elements(), one)); - assertFalse(CollectionTools.contains(c.elements(), null)); - c.add(null); - assertTrue(CollectionTools.contains(c.elements(), null)); - } - - public void testContainsIterableObject() { - Collection c = this.buildStringList1(); - Iterable iterable = c; - assertTrue(CollectionTools.contains(iterable, "one")); - assertFalse(CollectionTools.contains(iterable, null)); - c.add(null); - assertTrue(CollectionTools.contains(iterable, null)); - } - - public void testContainsIteratorObject_String() { - Collection c = this.buildStringList1(); - assertTrue(CollectionTools.contains(c.iterator(), "one")); - assertFalse(CollectionTools.contains(c.iterator(), null)); - c.add(null); - assertTrue(CollectionTools.contains(c.iterator(), null)); - } - - public void testContainsIteratorObject_Object() { - Collection c = new HashBag(); - c.add("zero"); - c.add("one"); - c.add("two"); - c.add("three"); - String one = "one"; - assertTrue(CollectionTools.contains(c.iterator(), one)); - assertFalse(CollectionTools.contains(c.iterator(), null)); - c.add(null); - assertTrue(CollectionTools.contains(c.iterator(), null)); - } - - - // ********** contains all ********** - - public void testContainsAllCollectionIterable() { - Iterable iterable = this.buildStringList1(); - assertTrue(CollectionTools.containsAll(this.buildStringList1(), iterable)); - } - - public void testContainsAllCollectionIterator_String() { - assertTrue(CollectionTools.containsAll(this.buildStringList1(), this.buildStringList1().iterator())); - } - - public void testContainsAllCollectionIterator_Object() { - Collection c1 = new ArrayList(); - c1.add("zero"); - c1.add("one"); - c1.add("two"); - Collection c2 = new ArrayList(); - c2.add("two"); - c2.add("zero"); - c2.add("one"); - assertTrue(CollectionTools.containsAll(c1, c2.iterator())); - } - - public void testContainsAllCollectionObjectArray_StringObject() { - assertTrue(CollectionTools.containsAll(this.buildStringList1(), this.buildObjectArray1())); - } - - public void testContainsAllCollectionObjectArray() { - Object[] a = new Object[] { "zero", "one", "two" }; - assertTrue(CollectionTools.containsAll(this.buildStringList1(), a)); - } - - public void testContainsAllIterableCollection() { - Iterable iterable = this.buildStringList1(); - assertTrue(CollectionTools.containsAll(iterable, this.buildStringList1())); - } - - public void testContainsAllIterableIntCollection() { - Iterable iterable = this.buildStringList1(); - assertTrue(CollectionTools.containsAll(iterable, 3, this.buildStringList1())); - } - - public void testContainsAllIterableIterable() { - Iterable iterable1 = this.buildStringList1(); - Iterable iterable2 = this.buildStringList1(); - assertTrue(CollectionTools.containsAll(iterable1, iterable2)); - } - - public void testContainsAllIterableIntIterable() { - Iterable iterable1 = this.buildStringList1(); - Iterable iterable2 = this.buildStringList1(); - assertTrue(CollectionTools.containsAll(iterable1, 3, iterable2)); - } - - public void testContainsAllIterableIterator() { - Iterable iterable = this.buildStringList1(); - assertTrue(CollectionTools.containsAll(iterable, this.buildStringList1().iterator())); - } - - public void testContainsAllIterableIntIterator() { - Iterable iterable = this.buildStringList1(); - assertTrue(CollectionTools.containsAll(iterable, 3, this.buildStringList1().iterator())); - } - - public void testContainsAllIterableObjectArray() { - Iterable iterable = this.buildStringList1(); - assertTrue(CollectionTools.containsAll(iterable, this.buildObjectArray1())); - iterable = this.buildStringList2(); - assertFalse(CollectionTools.containsAll(iterable, this.buildObjectArray1())); - } - - public void testContainsAllIterableIntObjectArray() { - Iterable iterable = this.buildStringList1(); - assertTrue(CollectionTools.containsAll(iterable, 3, this.buildObjectArray1())); - iterable = this.buildStringList2(); - assertFalse(CollectionTools.containsAll(iterable, 3, this.buildObjectArray1())); - } - - public void testContainsAllIteratorCollection_StringString() { - assertTrue(CollectionTools.containsAll(this.buildStringList1().iterator(), this.buildStringList1())); - assertFalse(CollectionTools.containsAll(this.buildStringList1().iterator(), this.buildStringList2())); - } - - public void testContainsAllIteratorCollection_ObjectString() { - Collection c1 = new ArrayList(); - c1.add("zero"); - c1.add("one"); - c1.add("two"); - Collection c2 = new ArrayList(); - c2.add("zero"); - c2.add("one"); - c2.add("two"); - assertTrue(CollectionTools.containsAll(c1.iterator(), c2)); - } - - public void testContainsAllIteratorIntCollection() { - assertTrue(CollectionTools.containsAll(this.buildStringList1().iterator(), 5, this.buildStringList1())); - assertFalse(CollectionTools.containsAll(this.buildStringList1().iterator(), 5, this.buildStringList2())); - } - - public void testContainsAllIteratorIterable() { - Iterable iterable = this.buildStringList1(); - assertTrue(CollectionTools.containsAll(this.buildStringList1().iterator(), iterable)); - iterable = this.buildStringList2(); - assertFalse(CollectionTools.containsAll(this.buildStringList1().iterator(), iterable)); - } - - public void testContainsAllIteratorIntIterable() { - Iterable iterable = this.buildStringList1(); - assertTrue(CollectionTools.containsAll(this.buildStringList1().iterator(), 3, iterable)); - iterable = this.buildStringList2(); - assertFalse(CollectionTools.containsAll(this.buildStringList1().iterator(), 3, iterable)); - } - - public void testContainsAllIteratorIterator_StringString() { - assertTrue(CollectionTools.containsAll(this.buildStringList1().iterator(), this.buildStringList1().iterator())); - assertFalse(CollectionTools.containsAll(this.buildStringList1().iterator(), this.buildStringList2().iterator())); - } - - public void testContainsAllIteratorIterator_ObjectString() { - Collection c1 = new ArrayList(); - c1.add("zero"); - c1.add("one"); - c1.add("two"); - Collection c2 = new ArrayList(); - c2.add("zero"); - c2.add("one"); - c2.add("two"); - assertTrue(CollectionTools.containsAll(c1.iterator(), c2.iterator())); - } - - public void testContainsAllIteratorIntIterator() { - assertTrue(CollectionTools.containsAll(this.buildStringList1().iterator(), 3, this.buildStringList1().iterator())); - assertFalse(CollectionTools.containsAll(this.buildStringList1().iterator(), 3, this.buildStringList2().iterator())); - } - - public void testContainsAllIteratorObjectArray() { - assertTrue(CollectionTools.containsAll(this.buildStringList1().iterator(), this.buildObjectArray1())); - assertFalse(CollectionTools.containsAll(this.buildStringList1().iterator(), this.buildObjectArray2())); - } - - public void testContainsAllIteratorIntObjectArray() { - assertTrue(CollectionTools.containsAll(this.buildStringList1().iterator(), 3, this.buildObjectArray1())); - assertFalse(CollectionTools.containsAll(this.buildStringList1().iterator(), 3, this.buildObjectArray2())); - } - - - // ********** diff ********** - - public void testDiffEndListList() { - List list1 = new ArrayList(); - list1.add("a"); - list1.add("b"); - list1.add("c"); - List list2 = new ArrayList(); - list2.add(new String("a")); - list2.add(new String("b")); - list2.add(new String("c")); - assertEquals(-1, CollectionTools.diffEnd(list1, list2)); - } - - public void testDiffRangeListList() { - List list1 = new ArrayList(); - list1.add("a"); - list1.add("b"); - list1.add("c"); - List list2 = new ArrayList(); - list2.add(new String("a")); - list2.add(new String("b")); - list2.add(new String("c")); - assertEquals(new Range(3, -1), CollectionTools.diffRange(list1, list2)); - } - - public void testDiffStartListList() { - List list1 = new ArrayList(); - list1.add("a"); - list1.add("b"); - list1.add("c"); - List list2 = new ArrayList(); - list2.add(new String("a")); - list2.add(new String("b")); - list2.add(new String("c")); - assertEquals(3, CollectionTools.diffStart(list1, list2)); - } - - - // ********** identity diff ********** - - public void testIdentityDiffEndListList() { - List list1 = new ArrayList(); - list1.add("a"); - list1.add("b"); - list1.add("c"); - List list2 = new ArrayList(); - list2.add("a"); - list2.add("b"); - list2.add("c"); - assertEquals(-1, CollectionTools.identityDiffEnd(list1, list2)); - } - - public void testIdentityDiffRangeListList() { - List list1 = new ArrayList(); - list1.add("a"); - list1.add("b"); - list1.add("c"); - List list2 = new ArrayList(); - list2.add("a"); - list2.add("b"); - list2.add("c"); - assertEquals(new Range(3, -1), CollectionTools.identityDiffRange(list1, list2)); - } - - public void testIdentityDiffStartListList() { - List list1 = new ArrayList(); - list1.add("a"); - list1.add("b"); - list1.add("c"); - List list2 = new ArrayList(); - list2.add("a"); - list2.add("b"); - list2.add("c"); - assertEquals(3, CollectionTools.identityDiffStart(list1, list2)); - } - - - // ********** elements are equal ********** - - public void testElementsAreDifferentIterableIterable() { - List list1 = new ArrayList(); - list1.add("1000"); - list1.add("2000"); - list1.add("3000"); - list1.add("4000"); - - List list2 = new ArrayList(); - - assertTrue(CollectionTools.elementsAreDifferent(list1, list2)); - assertFalse(CollectionTools.elementsAreEqual(list1, list2)); - } - - public void testElementsAreDifferentIteratorIterator() { - List list1 = new ArrayList(); - list1.add("1000"); - list1.add("2000"); - list1.add("3000"); - list1.add("4000"); - - List list2 = new ArrayList(); - - assertTrue(CollectionTools.elementsAreDifferent(list1.iterator(), list2.iterator())); - assertFalse(CollectionTools.elementsAreEqual(list1, list2)); - } - - public void testElementsAreEqualIterableIterable() { - List list1 = new ArrayList(); - list1.add("1000"); - list1.add("2000"); - list1.add("3000"); - list1.add("4000"); - - List list2 = new ArrayList(); - for (int i = 0; i < list1.size(); i++) { - list2.add(String.valueOf((i + 1) * 1000)); - } - assertFalse(CollectionTools.elementsAreIdentical(list1, list2)); - assertFalse(CollectionTools.elementsAreDifferent(list1, list2)); - assertTrue(CollectionTools.elementsAreEqual(list1, list2)); - } - - public void testElementsAreEqualIteratorIterator() { - List list1 = new ArrayList(); - list1.add("1000"); - list1.add("2000"); - list1.add("3000"); - list1.add("4000"); - - List list2 = new ArrayList(); - for (int i = 0; i < list1.size(); i++) { - list2.add(String.valueOf((i + 1) * 1000)); - } - assertFalse(CollectionTools.elementsAreIdentical(list1.iterator(), list2.iterator())); - assertFalse(CollectionTools.elementsAreDifferent(list1.iterator(), list2.iterator())); - assertTrue(CollectionTools.elementsAreEqual(list1.iterator(), list2.iterator())); - } - - - // ********** elements are identical ********** - - public void testElementsAreIdenticalIterableIterable() { - List list1 = new ArrayList(); - list1.add("0"); - list1.add("1"); - list1.add("2"); - list1.add("3"); - Iterable iterable1 = list1; - - List list2 = new ArrayList(); - for (String s : list1) { - list2.add(s); - } - Iterable iterable2 = list2; - assertTrue(CollectionTools.elementsAreIdentical(iterable1, iterable2)); - assertTrue(CollectionTools.elementsAreEqual(iterable1, iterable2)); - } - - public void testElementsAreIdenticalIteratorIterator() { - List list1 = new ArrayList(); - list1.add("0"); - list1.add("1"); - list1.add("2"); - list1.add("3"); - - List list2 = new ArrayList(); - for (String s : list1) { - list2.add(s); - } - assertTrue(CollectionTools.elementsAreIdentical(list1.iterator(), list2.iterator())); - assertTrue(CollectionTools.elementsAreEqual(list1.iterator(), list2.iterator())); - } - - public void testElementsAreIdenticalIteratorIterator_Not() { - List list1 = new ArrayList(); - list1.add("0"); - list1.add("1"); - list1.add("2"); - list1.add("3"); - - List list2 = new ArrayList(); - for (String s : list1) { - list2.add(s); - } - list2.remove(0); - assertFalse(CollectionTools.elementsAreIdentical(list1.iterator(), list2.iterator())); - assertFalse(CollectionTools.elementsAreEqual(list1.iterator(), list2.iterator())); - } - - public void testElementsAreIdenticalIteratorIterator_DifferentSizes() { - List list1 = new ArrayList(); - list1.add("0"); - list1.add("1"); - list1.add("2"); - list1.add("3"); - - List list2 = new ArrayList(); - for (String s : list1) { - list2.add(s); - } - list2.remove(3); - assertFalse(CollectionTools.elementsAreIdentical(list1.iterator(), list2.iterator())); - assertFalse(CollectionTools.elementsAreEqual(list1.iterator(), list2.iterator())); - } - - - // ********** get ********** - - public void testGetIterableInt() { - List list = this.buildStringList1(); - Iterable iterable = list; - String o = CollectionTools.get(iterable, 1); - assertEquals("one", o); - list.add(null); - o = CollectionTools.get(iterable, 3); - assertNull(o); - } - - public void testGetIteratorInt1() { - List list = this.buildStringList1(); - String o = CollectionTools.get(list.iterator(), 1); - assertEquals("one", o); - list.add(null); - o = CollectionTools.get(list.iterator(), list.size() - 1); - assertNull(o); - } - - public void testGetIteratorInt2() { - List list = this.buildStringList1(); - boolean exCaught = false; - try { - CollectionTools.get(list.iterator(), list.size()); - fail(); - } catch (IndexOutOfBoundsException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - - // ********** hash code ********** - - public void testHashCodeIterable1() { - Iterable iterable = null; - assertEquals(0, CollectionTools.hashCode(iterable)); - } - - public void testHashCodeIterable2() { - List list = this.buildStringList1(); - Iterable iterable = list; - int hashCode = CollectionTools.hashCode(iterable); - assertEquals(list.hashCode(), hashCode); - - list.add(null); - hashCode = CollectionTools.hashCode(iterable); - assertEquals(list.hashCode(), hashCode); - } - - - // ********** index of ********** - - public void testIndexOfIterableObject_String() { - Iterable iterable = this.buildStringList1(); - assertEquals(1, CollectionTools.indexOf(iterable, "one")); - } - - public void testIndexOfIteratorObject_String() { - List list = this.buildStringList1(); - assertEquals(1, CollectionTools.indexOf(list.iterator(), "one")); - } - - public void testIndexOfIteratorObject_String_Not() { - List list = this.buildStringList1(); - assertEquals(-1, CollectionTools.indexOf(list.iterator(), null)); - assertEquals(-1, CollectionTools.indexOf(list.iterator(), "shazam")); - } - - public void testIndexOfIteratorObject_Null() { - List list = this.buildStringList1(); - list.add(null); - assertEquals(list.size() - 1, CollectionTools.indexOf(list.iterator(), null)); - } - - public void testIndexOfIteratorObject_Object() { - List list = new ArrayList(); - list.add("0"); - list.add("1"); - list.add("2"); - list.add("3"); - - String one = "1"; - assertEquals(1, CollectionTools.indexOf(list.iterator(), one)); - list.add(null); - assertEquals(list.size() - 1, CollectionTools.indexOf(list.iterator(), null)); - } - - - // ********** insertion index of ********** - - public void testInsertionIndexOfListComparableRandomAccess() { - List list = Arrays.asList(new String[] { "A", "C", "D" }); - assertEquals(1, CollectionTools.insertionIndexOf(list, "B")); - - list = Arrays.asList(new String[] { "A", "B", "C", "D" }); - assertEquals(2, CollectionTools.insertionIndexOf(list, "B")); - - list = Arrays.asList(new String[] { "A", "B", "B", "B", "C", "D" }); - assertEquals(4, CollectionTools.insertionIndexOf(list, "B")); - - list = Arrays.asList(new String[] { "A", "B", "B", "B", "C", "D" }); - assertEquals(6, CollectionTools.insertionIndexOf(list, "E")); - - list = Arrays.asList(new String[] { "B", "B", "B", "C", "D" }); - assertEquals(0, CollectionTools.insertionIndexOf(list, "A")); - - list = Arrays.asList(new String[] { "A", "A", "B", "B", "C", "D" }); - assertEquals(2, CollectionTools.insertionIndexOf(list, "A")); - } - - public void testInsertionIndexOfListComparableNonRandomAccess() { - List list = new LinkedList(Arrays.asList(new String[] { "A", "C", "D" })); - assertEquals(1, CollectionTools.insertionIndexOf(list, "B")); - - list = new LinkedList(Arrays.asList(new String[] { "A", "B", "C", "D" })); - assertEquals(1, CollectionTools.insertionIndexOf(list, "B")); - - list = new LinkedList(Arrays.asList(new String[] { "A", "B", "B", "B", "C", "D" })); - assertEquals(1, CollectionTools.insertionIndexOf(list, "B")); - - list = new LinkedList(Arrays.asList(new String[] { "A", "B", "B", "B", "C", "D" })); - assertEquals(6, CollectionTools.insertionIndexOf(list, "E")); - - list = new LinkedList(Arrays.asList(new String[] { "B", "B", "B", "C", "D" })); - assertEquals(0, CollectionTools.insertionIndexOf(list, "A")); - - list = new LinkedList(Arrays.asList(new String[] { "A", "A", "B", "B", "C", "D" })); - assertEquals(0, CollectionTools.insertionIndexOf(list, "A")); - } - - public void testInsertionIndexOfListObjectComparatorRandomAccess() { - Comparator c = new ReverseComparator(); - List list = Arrays.asList(new String[] { "D", "C", "A" }); - assertEquals(2, CollectionTools.insertionIndexOf(list, "B", c)); - - list = Arrays.asList(new String[] { "D", "C", "B", "A" }); - assertEquals(3, CollectionTools.insertionIndexOf(list, "B", c)); - - list = Arrays.asList(new String[] { "D", "C", "B", "B", "B", "A" }); - assertEquals(5, CollectionTools.insertionIndexOf(list, "B", c)); - - list = Arrays.asList(new String[] { "D", "C", "B", "B", "B", "A" }); - assertEquals(0, CollectionTools.insertionIndexOf(list, "E", c)); - - list = Arrays.asList(new String[] { "D", "C", "B", "B", "B" }); - assertEquals(5, CollectionTools.insertionIndexOf(list, "A", c)); - - list = Arrays.asList(new String[] { "D", "C", "B", "B", "A", "A" }); - assertEquals(6, CollectionTools.insertionIndexOf(list, "A", c)); - } - - public void testInsertionIndexOfListObjectComparatorNonRandomAccess() { - Comparator c = new ReverseComparator(); - List list = new LinkedList(Arrays.asList(new String[] { "D", "C", "A" })); - assertEquals(2, CollectionTools.insertionIndexOf(list, "B", c)); - - list = new LinkedList(Arrays.asList(new String[] { "D", "C", "B", "A" })); - assertEquals(2, CollectionTools.insertionIndexOf(list, "B", c)); - - list = new LinkedList(Arrays.asList(new String[] { "D", "C", "B", "B", "B", "A" })); - assertEquals(2, CollectionTools.insertionIndexOf(list, "B", c)); - - list = new LinkedList(Arrays.asList(new String[] { "D", "C", "B", "B", "B", "A" })); - assertEquals(0, CollectionTools.insertionIndexOf(list, "E", c)); - - list = new LinkedList(Arrays.asList(new String[] { "D", "C", "B", "B", "B" })); - assertEquals(5, CollectionTools.insertionIndexOf(list, "A", c)); - - list = new LinkedList(Arrays.asList(new String[] { "D", "C", "B", "B", "A", "A" })); - assertEquals(4, CollectionTools.insertionIndexOf(list, "A", c)); - } - - - // ********** is empty ********** - - public void testIsEmptyIterable() { - assertFalse(CollectionTools.isEmpty(buildObjectList1())); - assertTrue(CollectionTools.isEmpty(EmptyIterable.instance())); - } - - public void testIsEmptyIterator() { - assertFalse(CollectionTools.isEmpty(buildObjectList1().iterator())); - assertTrue(CollectionTools.isEmpty(EmptyIterator.instance())); - } - - - // ********** iterable/iterator ********** - - public void testIterableObjectArray() { - String[] strings = this.buildStringArray1(); - int i = 0; - for (String string : CollectionTools.iterable(strings)) { - assertEquals(strings[i++], string); - } - } - - public void testIteratorObjectArray() { - String[] a = this.buildStringArray1(); - int i = 0; - for (Iterator stream = CollectionTools.iterator(a); stream.hasNext(); i++) { - assertEquals(a[i], stream.next()); - } - } - - - // ********** last ********** - - public void testLastIterable1() { - List list = this.buildStringList1(); - Iterable iterable = list; - assertEquals("two", CollectionTools.last(iterable)); - list.add(null); - assertEquals(null, CollectionTools.last(iterable)); - } - - public void testLastIterable2() { - Iterable iterable = new ArrayList(); - boolean exCaught = false; - try { - CollectionTools.last(iterable); - fail(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testLastIterator1() { - List list = this.buildStringList1(); - assertEquals("two", CollectionTools.last(list.iterator())); - list.add(null); - assertEquals(null, CollectionTools.last(list.iterator())); - } - - public void testLastIterator2() { - List list = new ArrayList(); - boolean exCaught = false; - try { - CollectionTools.last(list.iterator()); - fail(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - - // ********** last index of ********** - - public void testLastIndexOfIterableObject() { - List list = this.buildStringList1(); - Iterable iterable = list; - assertEquals(1, CollectionTools.lastIndexOf(iterable, "one")); - list.add(null); - assertEquals(list.size() - 1, CollectionTools.lastIndexOf(iterable, null)); - } - - public void testLastIndexOfIterableIntObject() { - List list = this.buildStringList1(); - Iterable iterable = list; - assertEquals(1, CollectionTools.lastIndexOf(iterable, 23, "one")); - list.add(null); - assertEquals(list.size() - 1, CollectionTools.lastIndexOf(iterable, 42, null)); - } - - public void testLastIndexOfIteratorObject() { - List list = this.buildStringList1(); - assertEquals(1, CollectionTools.lastIndexOf(list.iterator(), "one")); - list.add(null); - assertEquals(list.size() - 1, CollectionTools.lastIndexOf(list.iterator(), null)); - } - - public void testLastIndexOfIteratorObject_Empty() { - assertEquals(-1, CollectionTools.lastIndexOf(EmptyIterator.instance(), "foo")); - } - - public void testLastIndexOfIteratorIntObject() { - List list = this.buildStringList1(); - assertEquals(1, CollectionTools.lastIndexOf(list.iterator(), 3, "one")); - list.add(null); - assertEquals(list.size() - 1, CollectionTools.lastIndexOf(list.iterator(), 4, null)); - } - - public void testLastIndexOfIteratorIntObject_Empty() { - assertEquals(-1, CollectionTools.lastIndexOf(EmptyIterator.instance(), 42, "foo")); - } - - - // ********** list ********** - - public void testListIterable() { - Iterable iterable = this.buildStringList1(); - assertEquals(this.buildStringList1(), CollectionTools.list(iterable)); - } - - public void testListIterableInt() { - Iterable iterable = this.buildStringList1(); - assertEquals(this.buildStringList1(), CollectionTools.list(iterable, 3)); - } - - public void testListIterator_String() { - List list = CollectionTools.list(this.buildStringList1().iterator()); - assertEquals(this.buildStringList1(), list); - } - - public void testListIterator_StringObject() { - List list1 = new ArrayList(); - list1.add("0"); - list1.add("1"); - list1.add("2"); - list1.add("3"); - - List list2 = CollectionTools.list(list1.iterator()); - assertEquals(list1, list2); - } - - public void testListIterator_Empty() { - assertEquals(0, CollectionTools.list(EmptyIterator.instance()).size()); - } - - public void testListIteratorInt() { - List list = CollectionTools.list(this.buildStringList1().iterator(), 3); - assertEquals(this.buildStringList1(), list); - } - - public void testListIteratorInt_Empty() { - assertEquals(0, CollectionTools.list(EmptyIterator.instance(), 5).size()); - } - - public void testListObjectArray() { - List list = CollectionTools.list(this.buildStringArray1()); - assertEquals(this.buildStringList1(), list); - } - - public void testListIteratorObjectArray() { - String[] a = this.buildStringArray1(); - int i = 0; - for (ListIterator stream = CollectionTools.listIterator(a); stream.hasNext(); i++) { - assertEquals(a[i], stream.next()); - } - } - - public void testListIteratorObjectArrayInt() { - String[] a = this.buildStringArray1(); - int i = 1; - for (ListIterator stream = CollectionTools.listIterator(a, 1); stream.hasNext(); i++) { - assertEquals(a[i], stream.next()); - } - } - - - // ********** move ********** - - public void testMoveListIntIntRandomAccess() { - List list = new ArrayList(); - CollectionTools.addAll(list, new String[] { "0", "1", "2", "3", "4", "5" }); - - List result = CollectionTools.move(list, 4, 2); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "0", "1", "3", "4", "2", "5" }, result.toArray())); - - result = CollectionTools.move(list, 0, 5); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "1", "3", "4", "2" }, result.toArray())); - - result = CollectionTools.move(list, 2, 4); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "4", "1", "3", "2" }, result.toArray())); - - result = CollectionTools.move(list, 2, 2); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "4", "1", "3", "2" }, result.toArray())); - } - - public void testMoveListIntIntSequentialAccess() { - List list = new LinkedList(); - CollectionTools.addAll(list, new String[] { "0", "1", "2", "3", "4", "5" }); - - List result = CollectionTools.move(list, 4, 2); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "0", "1", "3", "4", "2", "5" }, result.toArray())); - - result = CollectionTools.move(list, 0, 5); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "1", "3", "4", "2" }, result.toArray())); - - result = CollectionTools.move(list, 2, 4); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "4", "1", "3", "2" }, result.toArray())); - - result = CollectionTools.move(list, 2, 2); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "4", "1", "3", "2" }, result.toArray())); - } - - public void testMoveListIntIntIntRandomAccess() { - List list = new ArrayList(Arrays.asList(new String[] { "0", "1", "2", "3", "4", "5" })); - - List result = CollectionTools.move(list, 4, 2, 1); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "0", "1", "3", "4", "2", "5" }, result.toArray())); - - result = CollectionTools.move(list, 0, 5, 1); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "1", "3", "4", "2" }, result.toArray())); - - result = CollectionTools.move(list, 2, 4, 1); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "4", "1", "3", "2" }, result.toArray())); - - result = CollectionTools.move(list, 2, 4, 2); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "3", "2", "4", "1" }, result.toArray())); - - result = CollectionTools.move(list, 0, 1, 4); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "0", "3", "2", "4", "5", "1" }, result.toArray())); - - result = CollectionTools.move(list, 1, 0, 4); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "3", "2", "4", "1" }, result.toArray())); - - result = CollectionTools.move(list, 1, 1, 4); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "3", "2", "4", "1" }, result.toArray())); - - result = CollectionTools.move(list, 1, 0, 0); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "3", "2", "4", "1" }, result.toArray())); - } - - public void testMoveListIntIntIntSequentialAccess() { - List list = new LinkedList(Arrays.asList(new String[] { "0", "1", "2", "3", "4", "5" })); - - List result = CollectionTools.move(list, 4, 2, 1); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "0", "1", "3", "4", "2", "5" }, result.toArray())); - - result = CollectionTools.move(list, 0, 5, 1); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "1", "3", "4", "2" }, result.toArray())); - - result = CollectionTools.move(list, 2, 4, 1); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "4", "1", "3", "2" }, result.toArray())); - - result = CollectionTools.move(list, 2, 4, 2); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "3", "2", "4", "1" }, result.toArray())); - - result = CollectionTools.move(list, 0, 1, 4); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "0", "3", "2", "4", "5", "1" }, result.toArray())); - - result = CollectionTools.move(list, 1, 0, 4); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "3", "2", "4", "1" }, result.toArray())); - - result = CollectionTools.move(list, 1, 1, 4); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "3", "2", "4", "1" }, result.toArray())); - - result = CollectionTools.move(list, 1, 0, 0); - assertSame(list, result); // the array is modified in place and returned - assertTrue(Arrays.equals(new String[] { "5", "0", "3", "2", "4", "1" }, result.toArray())); - } - - - // ********** remove all ********** - - public void testRemoveAllCollectionIterable() { - Collection c = this.buildStringList1(); - Iterable iterable = this.buildStringList1(); - assertTrue(CollectionTools.removeAll(c, iterable)); - assertEquals(0, c.size()); - assertFalse(c.contains("one")); - assertFalse(c.contains("two")); - assertFalse(c.contains("three")); - - c = this.buildStringList1(); - iterable = this.buildStringList2(); - assertFalse(CollectionTools.removeAll(c, iterable)); - assertEquals(this.buildStringList1().size(), c.size()); - assertEquals(this.buildStringList1(), c); - } - - public void testRemoveAllCollectionIterableInt() { - Collection c = this.buildStringList1(); - Iterable iterable = this.buildStringList1(); - assertTrue(CollectionTools.removeAll(c, iterable, 4)); - assertEquals(0, c.size()); - assertFalse(c.contains("one")); - assertFalse(c.contains("two")); - assertFalse(c.contains("three")); - - c = this.buildStringList1(); - iterable = this.buildStringList2(); - assertFalse(CollectionTools.removeAll(c, iterable, 55)); - assertEquals(this.buildStringList1().size(), c.size()); - assertEquals(this.buildStringList1(), c); - } - - public void testRemoveAllCollectionIterator_Empty() { - Collection c = this.buildStringList1(); - assertTrue(CollectionTools.removeAll(c, this.buildStringList1().iterator())); - assertEquals(0, c.size()); - assertFalse(c.contains("one")); - assertFalse(c.contains("two")); - assertFalse(c.contains("three")); - - c = this.buildStringList1(); - assertFalse(CollectionTools.removeAll(c, this.buildStringList2().iterator())); - assertEquals(this.buildStringList1().size(), c.size()); - assertEquals(this.buildStringList1(), c); - - c = this.buildStringList1(); - assertFalse(CollectionTools.removeAll(c, EmptyIterator.instance())); - assertEquals(this.buildStringList1().size(), c.size()); - assertEquals(this.buildStringList1(), c); - } - - public void testRemoveAllCollectionIteratorInt_Empty() { - Collection c = this.buildStringList1(); - assertTrue(CollectionTools.removeAll(c, this.buildStringList1().iterator(), 5)); - assertEquals(0, c.size()); - assertFalse(c.contains("one")); - assertFalse(c.contains("two")); - assertFalse(c.contains("three")); - - c = this.buildStringList1(); - assertFalse(CollectionTools.removeAll(c, this.buildStringList2().iterator(), 5)); - assertEquals(this.buildStringList1().size(), c.size()); - assertEquals(this.buildStringList1(), c); - - c = this.buildStringList1(); - assertFalse(CollectionTools.removeAll(c, EmptyIterator.instance(), 0)); - assertEquals(this.buildStringList1().size(), c.size()); - assertEquals(this.buildStringList1(), c); - } - - public void testRemoveAllCollectionIterator_Duplicates() { - Collection c = new ArrayList(); - c.add("a"); - c.add("a"); - c.add("b"); - c.add("c"); - c.add("d"); - c.add("d"); - String[] a = new String[] { "a", "d" }; - Iterator iterator = new ArrayIterator(a); - assertTrue(CollectionTools.removeAll(c, iterator)); - assertEquals(2, c.size()); - assertFalse(c.contains("a")); - assertTrue(c.contains("b")); - assertTrue(c.contains("c")); - assertFalse(c.contains("d")); - - iterator = new ArrayIterator(a); - assertFalse(CollectionTools.removeAll(c, iterator)); - } - - public void testRemoveAllCollectionIterator_ObjectString() { - Collection c = new ArrayList(); - c.add("a"); - c.add("a"); - c.add("b"); - c.add("c"); - c.add("d"); - c.add("d"); - String[] a = new String[] { "a", "d" }; - Iterator iterator = new ArrayIterator(a); - assertTrue(CollectionTools.removeAll(c, iterator)); - assertEquals(2, c.size()); - assertFalse(c.contains("a")); - assertTrue(c.contains("b")); - assertTrue(c.contains("c")); - assertFalse(c.contains("d")); - - iterator = new ArrayIterator(a); - assertFalse(CollectionTools.removeAll(c, iterator)); - } - - public void testRemoveAllCollectionObjectArray_Empty() { - Collection c = this.buildStringList1(); - assertTrue(CollectionTools.removeAll(c, this.buildObjectArray1())); - assertEquals(0, c.size()); - assertFalse(c.contains("one")); - assertFalse(c.contains("two")); - assertFalse(c.contains("three")); - - c = this.buildStringList1(); - assertFalse(CollectionTools.removeAll(c, this.buildObjectArray2())); - assertEquals(this.buildStringList1().size(), c.size()); - assertEquals(this.buildStringList1(), c); - - c = this.buildStringList1(); - assertFalse(CollectionTools.removeAll(c, new Object[0])); - assertEquals(this.buildStringList1().size(), c.size()); - assertEquals(this.buildStringList1(), c); - } - - public void testRemoveAllCollectionObjectArray_Duplicates() { - Collection c = new ArrayList(); - c.add("a"); - c.add("a"); - c.add("b"); - c.add("c"); - c.add("d"); - c.add("d"); - String[] a = new String[] { "a", "d" }; - assertTrue(CollectionTools.removeAll(c, (Object[]) a)); - assertEquals(2, c.size()); - assertFalse(c.contains("a")); - assertTrue(c.contains("b")); - assertTrue(c.contains("c")); - assertFalse(c.contains("d")); - - assertFalse(CollectionTools.removeAll(c,(Object[]) a)); - } - - public void testRemoveAllCollectionObjectArray_MoreDuplicates() { - Collection c = new ArrayList(); - c.add("a"); - c.add("b"); - c.add("c"); - c.add("d"); - c.add("a"); - c.add("d"); - c.add("d"); - c.add("a"); - c.add("c"); - String[] a = new String[] { "a", "d" }; - assertTrue(CollectionTools.removeAll(c, (Object[]) a)); - assertEquals(3, c.size()); - assertFalse(c.contains("a")); - assertTrue(c.contains("b")); - assertTrue(c.contains("c")); - assertFalse(c.contains("d")); - - assertFalse(CollectionTools.removeAll(c, (Object[]) a)); - } - - - // ********** remove all occurrences ********** - - public void testRemoveAllOccurrencesCollectionObject() { - Collection c = this.buildStringList1(); - assertEquals(3, c.size()); - assertFalse(CollectionTools.removeAllOccurrences(c, "three")); - assertTrue(CollectionTools.removeAllOccurrences(c, "two")); - assertFalse(CollectionTools.removeAllOccurrences(c, "two")); - assertEquals(2, c.size()); - - c.add("five"); - c.add("five"); - c.add("five"); - assertEquals(5, c.size()); - assertTrue(CollectionTools.removeAllOccurrences(c, "five")); - assertFalse(CollectionTools.removeAllOccurrences(c, "five")); - assertEquals(2, c.size()); - - c.add(null); - c.add(null); - c.add(null); - assertEquals(5, c.size()); - assertTrue(CollectionTools.removeAllOccurrences(c, null)); - assertFalse(CollectionTools.removeAllOccurrences(c, null)); - assertEquals(2, c.size()); - } - - - // ********** remove elements at index ********** - - public void testRemoveElementsAtIndexListIntInt() { - List list = new ArrayList(Arrays.asList(new String[] { "A", "B", "A", "C", "A", "D" })); - List removed = CollectionTools.removeElementsAtIndex(list, 3, 2); - assertTrue(Arrays.equals(new String[] { "A", "B", "A", "D" }, list.toArray())); - assertTrue(Arrays.equals(new String[] { "C", "A" }, removed.toArray())); - - list = new ArrayList(Arrays.asList(new String[] { "A", "B", "C", "D", "E", "F" })); - removed = CollectionTools.removeElementsAtIndex(list, 3, 3); - assertTrue(Arrays.equals(new String[] { "A", "B", "C" }, list.toArray())); - assertTrue(Arrays.equals(new String[] { "D", "E", "F" }, removed.toArray())); - - list = new ArrayList(Arrays.asList(new String[] { "A", "B", "C", "D", "E", "F" })); - removed = CollectionTools.removeElementsAtIndex(list, 0, 3); - assertTrue(Arrays.equals(new String[] { "D", "E", "F" }, list.toArray())); - assertTrue(Arrays.equals(new String[] { "A", "B", "C" }, removed.toArray())); - } - - - // ********** remove duplicate elements ********** - - public void testRemoveDuplicateElementsList1() { - List list = this.buildStringVector1(); - list.add("zero"); - list.add("zero"); - list.add("two"); - list.add("zero"); - assertTrue(CollectionTools.removeDuplicateElements(list)); - int i = 0; - assertEquals("zero", list.get(i++)); - assertEquals("one", list.get(i++)); - assertEquals("two", list.get(i++)); - assertEquals(i, list.size()); - } - - public void testRemoveDuplicateElementsList2() { - List list = this.buildStringVector1(); - assertFalse(CollectionTools.removeDuplicateElements(list)); - int i = 0; - assertEquals("zero", list.get(i++)); - assertEquals("one", list.get(i++)); - assertEquals("two", list.get(i++)); - assertEquals(i, list.size()); - } - - public void testRemoveDuplicateElementsList_Empty() { - List list = new ArrayList(); - assertFalse(CollectionTools.removeDuplicateElements(list)); - assertEquals(0, list.size()); - } - - public void testRemoveDuplicateElementsList_SingleElement() { - List list = new ArrayList(); - list.add("zero"); - assertFalse(CollectionTools.removeDuplicateElements(list)); - assertEquals(1, list.size()); - } - - - // ********** retain all ********** - - public void testRetainAllCollectionIterable() { - Collection c = this.buildStringList1(); - Iterable iterable = this.buildStringList1(); - assertFalse(CollectionTools.retainAll(c, iterable)); - assertEquals(this.buildStringList1().size(), c.size()); - assertEquals(this.buildStringList1(), c); - - iterable = this.buildStringList2(); - assertTrue(CollectionTools.retainAll(c, iterable)); - assertEquals(0, c.size()); - assertFalse(c.contains("one")); - assertFalse(c.contains("two")); - assertFalse(c.contains("three")); - } - - public void testRetainAllCollectionIterableInt() { - Collection c = this.buildStringList1(); - Iterable iterable = this.buildStringList1(); - assertFalse(CollectionTools.retainAll(c, iterable)); - assertEquals(this.buildStringList1().size(), c.size()); - assertEquals(this.buildStringList1(), c); - - iterable = this.buildStringList2(); - assertTrue(CollectionTools.retainAll(c, iterable, 7)); - assertEquals(0, c.size()); - assertFalse(c.contains("one")); - assertFalse(c.contains("two")); - assertFalse(c.contains("three")); - } - - public void testRetainAllCollectionIterator() { - Collection c = this.buildStringList1(); - assertFalse(CollectionTools.retainAll(c, this.buildStringList1().iterator())); - assertEquals(this.buildStringList1().size(), c.size()); - assertEquals(this.buildStringList1(), c); - - assertTrue(CollectionTools.retainAll(c, this.buildStringList2().iterator())); - assertEquals(0, c.size()); - assertFalse(c.contains("one")); - assertFalse(c.contains("two")); - assertFalse(c.contains("three")); - } - - public void testRetainAllCollectionIterator_ObjectString() { - Collection c1 = new ArrayList(); - c1.add("zero"); - c1.add("one"); - c1.add("two"); - - Collection c2 = new ArrayList(); - c2.add("zero"); - c2.add("one"); - c2.add("two"); - - assertFalse(CollectionTools.retainAll(c1, c2.iterator())); - assertEquals(c2.size(), c1.size()); - assertEquals(c2, c1); - - Collection c3 = new ArrayList(); - c3.add("three"); - c3.add("four"); - c3.add("five"); - } - - public void testRetainAllCollectionIterator_EmptyIterator() { - Collection c = this.buildStringList1(); - assertTrue(CollectionTools.retainAll(c, EmptyIterator.instance())); - assertEquals(0, c.size()); - } - - public void testRetainAllCollectionIterator_EmptyCollection() { - Collection c = new ArrayList(); - assertFalse(CollectionTools.retainAll(c, this.buildStringList1().iterator())); - assertEquals(0, c.size()); - } - - public void testRetainAllCollectionIterator_EmptyCollectionEmptyIterator() { - Collection c = new ArrayList(); - assertFalse(CollectionTools.retainAll(c, EmptyIterator.instance())); - assertEquals(0, c.size()); - } - - public void testRetainAllCollectionIteratorInt() { - Collection c = this.buildStringList1(); - assertFalse(CollectionTools.retainAll(c, this.buildStringList1().iterator(), 8)); - assertEquals(this.buildStringList1().size(), c.size()); - assertEquals(this.buildStringList1(), c); - - assertTrue(CollectionTools.retainAll(c, this.buildStringList2().iterator(), 9)); - assertEquals(0, c.size()); - assertFalse(c.contains("one")); - assertFalse(c.contains("two")); - assertFalse(c.contains("three")); - } - - public void testRetainAllCollectionIteratorInt_EmptyIterator() { - Collection c = this.buildStringList1(); - assertTrue(CollectionTools.retainAll(c, EmptyIterator.instance(), 0)); - assertEquals(0, c.size()); - } - - public void testRetainAllCollectionIteratorInt_EmptyCollection() { - Collection c = new ArrayList(); - assertFalse(CollectionTools.retainAll(c, this.buildStringList1().iterator(), 3)); - assertEquals(0, c.size()); - } - - public void testRetainAllCollectionIteratorInt_EmptyCollectionEmptyIterator() { - Collection c = new ArrayList(); - assertFalse(CollectionTools.retainAll(c, EmptyIterator.instance(), 0)); - assertEquals(0, c.size()); - } - - public void testRetainAllCollectionObjectArray() { - Collection c = this.buildStringList1(); - assertFalse(CollectionTools.retainAll(c, this.buildObjectArray1())); - assertEquals(this.buildStringList1().size(), c.size()); - assertEquals(this.buildStringList1(), c); - - assertTrue(CollectionTools.retainAll(c, this.buildObjectArray2())); - assertEquals(0, c.size()); - assertFalse(c.contains("one")); - assertFalse(c.contains("two")); - assertFalse(c.contains("three")); - } - - public void testRetainAllCollectionObjectArray_EmptyObjectArray() { - Collection c = this.buildStringList1(); - assertTrue(CollectionTools.retainAll(c, new Object[0])); - assertEquals(0, c.size()); - } - - public void testRetainAllCollectionObjectArray_EmptyCollection() { - Collection c = new ArrayList(); - assertFalse(CollectionTools.retainAll(c, (Object[]) new String[] { "foo" })); - assertEquals(0, c.size()); - } - - public void testRetainAllCollectionObjectArray_EmptyCollectionEmptyObjectArray() { - Collection c = new ArrayList(); - assertFalse(CollectionTools.retainAll(c, (Object[]) new String[0])); - assertEquals(0, c.size()); - } - - - // ********** reverse list ********** - - public void testReverseListIterable() { - Iterable iterable = this.buildStringList1(); - List actual = CollectionTools.reverseList(iterable); - List expected = this.buildStringList1(); - Collections.reverse(expected); - assertEquals(expected, actual); - } - - public void testReverseListIterableInt() { - Iterable iterable = this.buildStringList1(); - List actual = CollectionTools.reverseList(iterable, 10); - List expected = this.buildStringList1(); - Collections.reverse(expected); - assertEquals(expected, actual); - } - - public void testReverseListIterator_String() { - List actual = CollectionTools.reverseList(this.buildStringList1().iterator()); - List expected = this.buildStringList1(); - Collections.reverse(expected); - assertEquals(expected, actual); - } - - public void testReverseListIterator_Object() { - List actual = CollectionTools.reverseList(this.buildStringList1().iterator()); - List expected = this.buildObjectList1(); - Collections.reverse(expected); - assertEquals(expected, actual); - } - - public void testReverseListIteratorInt() { - List actual = CollectionTools.reverseList(this.buildStringList1().iterator(), 33); - List expected = this.buildStringList1(); - Collections.reverse(expected); - assertEquals(expected, actual); - } - - - // ********** rotate ********** - - public void testRotateList() { - List actual = CollectionTools.rotate(this.buildStringList1()); - List expected = this.buildStringList1(); - Collections.rotate(expected, 1); - assertEquals(expected, actual); - } - - - // ********** set ********** - - public void testSetIterable() { - Iterable iterable = this.buildStringSet1(); - assertEquals(this.buildStringSet1(), CollectionTools.set(iterable)); - } - - public void testSetIterableInt() { - Iterable iterable = this.buildStringSet1(); - assertEquals(this.buildStringSet1(), CollectionTools.set(iterable, 22)); - } - - public void testSetIterator_String() { - assertEquals(this.buildStringSet1(), CollectionTools.set(this.buildStringSet1().iterator())); - } - - public void testSetIterator_Object() { - List list = new ArrayList(); - list.add("0"); - list.add("1"); - list.add("2"); - list.add("3"); - list.add("0"); - list.add("1"); - list.add("2"); - list.add("3"); - Set set = new HashSet(); - set.addAll(list); - - assertEquals(set, CollectionTools.set(list.iterator())); - } - - public void testSetIteratorInt() { - assertEquals(this.buildStringSet1(), CollectionTools.set(this.buildStringSet1().iterator(), 3)); - } - - public void testSetObjectArray() { - assertEquals(this.buildStringSet1(), CollectionTools.set(this.buildStringSet1().toArray())); - } - - - // ********** singleton iterator ********** - - public void testSingletonIterator_String() { - Iterator stream = CollectionTools.singletonIterator("foo"); - assertTrue(stream.hasNext()); - assertEquals("foo", stream.next()); - } - - public void testSingletonIterator_Object() { - Iterator stream = CollectionTools.singletonIterator("foo"); - assertTrue(stream.hasNext()); - assertEquals("foo", stream.next()); - } - - public void testSingletonIterator_Cast() { - Iterator stream = CollectionTools.singletonIterator((Object) "foo"); - assertTrue(stream.hasNext()); - assertEquals("foo", stream.next()); - } - - public void testSingletonListIterator_String() { - ListIterator stream = CollectionTools.singletonListIterator("foo"); - assertTrue(stream.hasNext()); - assertEquals("foo", stream.next()); - assertFalse(stream.hasNext()); - assertTrue(stream.hasPrevious()); - assertEquals("foo", stream.previous()); - } - - - // ********** size ********** - - public void testSizeIterable() { - Iterable iterable = this.buildObjectList1(); - assertEquals(3, CollectionTools.size(iterable)); - } - - public void testSizeIterator() { - assertEquals(3, CollectionTools.size(this.buildObjectList1().iterator())); - } - - - // ********** sort ********** - - public void testSortIterable() { - ArrayList list = new ArrayList(); - list.add("0"); - list.add("2"); - list.add("3"); - list.add("1"); - - SortedSet ss = new TreeSet(); - ss.addAll(list); - - Iterable iterable1 = list; - Iterable iterable2 = CollectionTools.sort(iterable1); - assertTrue(CollectionTools.elementsAreEqual(ss, iterable2)); - } - - public void testSortIterableInt() { - ArrayList list = new ArrayList(); - list.add("0"); - list.add("2"); - list.add("3"); - list.add("1"); - - SortedSet ss = new TreeSet(); - ss.addAll(list); - - Iterable iterable1 = list; - Iterable iterable2 = CollectionTools.sort(iterable1, 77); - assertTrue(CollectionTools.elementsAreEqual(ss, iterable2)); - } - - public void testSortIterableComparator() { - ArrayList list = new ArrayList(); - list.add("0"); - list.add("2"); - list.add("3"); - list.add("1"); - - SortedSet ss = new TreeSet(new ReverseComparator()); - ss.addAll(list); - - Iterable iterable1 = list; - Iterable iterable2 = CollectionTools.sort(iterable1, new ReverseComparator()); - assertTrue(CollectionTools.elementsAreEqual(ss, iterable2)); - } - - public void testSortIterableComparatorInt() { - ArrayList list = new ArrayList(); - list.add("0"); - list.add("2"); - list.add("3"); - list.add("1"); - - SortedSet ss = new TreeSet(new ReverseComparator()); - ss.addAll(list); - - Iterable iterable1 = list; - Iterable iterable2 = CollectionTools.sort(iterable1, new ReverseComparator(), 77); - assertTrue(CollectionTools.elementsAreEqual(ss, iterable2)); - } - - public void testSortIterator() { - ArrayList list = new ArrayList(); - list.add("0"); - list.add("2"); - list.add("3"); - list.add("1"); - - SortedSet ss = new TreeSet(); - ss.addAll(list); - - Iterator iterator1 = list.iterator(); - Iterator iterator2 = CollectionTools.sort(iterator1); - assertTrue(CollectionTools.elementsAreEqual(ss.iterator(), iterator2)); - } - - public void testSortIteratorInt() { - ArrayList list = new ArrayList(); - list.add("0"); - list.add("2"); - list.add("3"); - list.add("1"); - - SortedSet ss = new TreeSet(); - ss.addAll(list); - - Iterator iterator1 = list.iterator(); - Iterator iterator2 = CollectionTools.sort(iterator1, 77); - assertTrue(CollectionTools.elementsAreEqual(ss.iterator(), iterator2)); - } - - public void testSortIteratorComparator() { - ArrayList list = new ArrayList(); - list.add("0"); - list.add("2"); - list.add("3"); - list.add("1"); - - SortedSet ss = new TreeSet(new ReverseComparator()); - ss.addAll(list); - - Iterator iterator1 = list.iterator(); - Iterator iterator2 = CollectionTools.sort(iterator1, new ReverseComparator()); - assertTrue(CollectionTools.elementsAreEqual(ss.iterator(), iterator2)); - } - - public void testSortIteratorComparatorInt() { - ArrayList list = new ArrayList(); - list.add("0"); - list.add("2"); - list.add("3"); - list.add("1"); - - SortedSet ss = new TreeSet(new ReverseComparator()); - ss.addAll(list); - - Iterator iterator1 = list.iterator(); - Iterator iterator2 = CollectionTools.sort(iterator1, new ReverseComparator(), 77); - assertTrue(CollectionTools.elementsAreEqual(ss.iterator(), iterator2)); - } - - - // ********** sorted set ********** - - public void testSortedSetIterable() { - ArrayList list = new ArrayList(); - list.add("0"); - list.add("2"); - list.add("3"); - list.add("1"); - - SortedSet ss1 = new TreeSet(); - ss1.addAll(list); - - Iterable iterable = list; - SortedSet ss2 = CollectionTools.sortedSet(iterable); - assertEquals(ss1, ss2); - } - - public void testSortedSetIterableInt() { - ArrayList list = new ArrayList(); - list.add("0"); - list.add("2"); - list.add("3"); - list.add("1"); - - SortedSet ss1 = new TreeSet(); - ss1.addAll(list); - - Iterable iterable = list; - SortedSet ss2 = CollectionTools.sortedSet(iterable, 5); - assertEquals(ss1, ss2); - } - - public void testSortedSetIterableComparator() { - ArrayList list = new ArrayList(); - list.add("0"); - list.add("2"); - list.add("3"); - list.add("1"); - - SortedSet ss1 = new TreeSet(new ReverseComparator()); - ss1.addAll(list); - - Iterable iterable = list; - SortedSet ss2 = CollectionTools.sortedSet(iterable, new ReverseComparator()); - assertEquals(ss1, ss2); - } - - public void testSortedSetIterableComparatorInt() { - ArrayList list = new ArrayList(); - list.add("0"); - list.add("2"); - list.add("3"); - list.add("1"); - - SortedSet ss1 = new TreeSet(new ReverseComparator()); - ss1.addAll(list); - - Iterable iterable = list; - SortedSet ss2 = CollectionTools.sortedSet(iterable, new ReverseComparator(), 5); - assertEquals(ss1, ss2); - } - - public void testSortedSetIterator() { - assertEquals(this.buildSortedStringSet1(), CollectionTools.sortedSet(this.buildSortedStringSet1().iterator())); - } - - public void testSortedSetIterator_TreeSet() { - SortedSet ss1 = new TreeSet(); - ss1.add("0"); - ss1.add("2"); - ss1.add("3"); - ss1.add("1"); - - SortedSet set2 = CollectionTools.sortedSet(ss1.iterator()); - assertEquals(ss1, set2); - } - - public void testSortedSetIteratorInt() { - assertEquals(this.buildSortedStringSet1(), CollectionTools.sortedSet(this.buildSortedStringSet1().iterator(), 8)); - } - - public void testSortedSetObjectArray() { - assertEquals(this.buildSortedStringSet1(), CollectionTools.sortedSet(this.buildStringSet1().toArray(new String[0]))); - } - - public void testSortedSetObjectArrayComparator() { - ArrayList list = new ArrayList(); - list.add("0"); - list.add("2"); - list.add("3"); - list.add("1"); - - SortedSet ss1 = new TreeSet(new ReverseComparator()); - ss1.addAll(list); - - String[] array = list.toArray(new String[list.size()]); - SortedSet ss2 = CollectionTools.sortedSet(array, new ReverseComparator()); - assertEquals(ss1, ss2); - } - - - // ********** Old School Vector ********** - - public void testVectorIterable() { - Iterable iterable = this.buildStringList1(); - Vector v = CollectionTools.vector(iterable); - assertEquals(3, v.size()); - assertTrue(v.containsAll(this.buildStringList1())); - } - - public void testVectorIterableInt() { - Iterable iterable = this.buildStringList1(); - Vector v = CollectionTools.vector(iterable, 8); - assertEquals(3, v.size()); - assertTrue(v.containsAll(this.buildStringList1())); - } - - public void testVectorIterator_String() { - Vector v = CollectionTools.vector(this.buildStringList1().iterator()); - assertEquals(3, v.size()); - assertTrue(v.containsAll(this.buildStringList1())); - } - - public void testVectorIterator_Object() { - Vector v = CollectionTools.vector(this.buildStringList1().iterator()); - assertEquals(3, v.size()); - assertTrue(v.containsAll(this.buildStringList1())); - } - - public void testVectorIteratorInt() { - Vector v = CollectionTools.vector(this.buildStringList1().iterator(), 7); - assertEquals(3, v.size()); - assertTrue(v.containsAll(this.buildStringList1())); - } - - public void testVectorObjectArray() { - Vector v = CollectionTools.vector(this.buildStringArray1()); - assertEquals(3, v.size()); - assertTrue(v.containsAll(this.buildStringList1())); - } - - - // ********** single-use iterable ********** - - public void testIterableIterator() { - Iterator emptyIterator = EmptyIterator.instance(); - Iterable emptyIterable = CollectionTools.iterable(emptyIterator); - - assertFalse(emptyIterable.iterator().hasNext()); - - boolean exceptionThrown = false; - try { - emptyIterator = emptyIterable.iterator(); - fail("invalid iterator: " + emptyIterator); - } catch (IllegalStateException ise) { - exceptionThrown = true; - } - assertTrue("IllegalStateException not thrown.", exceptionThrown); - } - - public void testIterableIterator_NPE() { - Iterator nullIterator = null; - boolean exceptionThrown = false; - try { - Iterable emptyIterable = CollectionTools.iterable(nullIterator); - fail("invalid iterable: " + emptyIterable); - } catch (NullPointerException ise) { - exceptionThrown = true; - } - assertTrue(exceptionThrown); - } - - public void testIterableIterator_ToString() { - Iterator emptyIterator = EmptyIterator.instance(); - Iterable emptyIterable = CollectionTools.iterable(emptyIterator); - assertNotNull(emptyIterable.toString()); - } - - - // ********** java.util.Collections enhancements ********** - - public void testCopyListList() { - List src = this.buildStringList1(); - List dest = new ArrayList(); - for (String s : src) { - dest.add(s.toUpperCase()); - } - List result = CollectionTools.copy(dest, src); - assertSame(dest, result); - assertTrue(CollectionTools.elementsAreIdentical(src, dest)); - } - - public void testFillListObject() { - List list = this.buildStringList1(); - List result = CollectionTools.fill(list, "foo"); - assertSame(list, result); - for (String string : result) { - assertEquals("foo", string); - } - } - - public void testShuffleList() { - List list = this.buildStringList1(); - List result = CollectionTools.shuffle(list); - assertSame(list, result); - } - - public void testShuffleListRandom() { - List list = this.buildStringList1(); - List result = CollectionTools.shuffle(list, new Random()); - assertSame(list, result); - } - - public void testSortList() { - List list = this.buildStringList1(); - SortedSet ss = new TreeSet(); - ss.addAll(list); - List result = CollectionTools.sort(list); - assertSame(list, result); - assertTrue(CollectionTools.elementsAreEqual(ss, result)); - } - - public void testSwapListIntInt() { - List list = this.buildStringList1(); - List result = CollectionTools.swap(list, 0, 1); - assertSame(list, result); - List original = this.buildStringList1(); - assertEquals(original.get(0), result.get(1)); - assertEquals(original.get(1), result.get(0)); - assertEquals(original.get(2), result.get(2)); - } - - public void testConstructor() { - boolean exCaught = false; - try { - Object at = ReflectionTools.newInstance(CollectionTools.class); - fail("bogus: " + at); //$NON-NLS-1$ - } catch (RuntimeException ex) { - if (ex.getCause() instanceof InvocationTargetException) { - if (ex.getCause().getCause() instanceof UnsupportedOperationException) { - exCaught = true; - } - } - } - assertTrue(exCaught); - } - - - // ********** test harness ********** - - private Object[] buildObjectArray1() { - return new Object[] { "zero", "one", "two" }; - } - - private String[] buildStringArray1() { - return new String[] { "zero", "one", "two" }; - } - - private Object[] buildObjectArray2() { - return new Object[] { "three", "four", "five" }; - } - - private Vector buildStringVector1() { - Vector v = new Vector(); - this.addToCollection1(v); - return v; - } - - private List buildStringList1() { - List l = new ArrayList(); - this.addToCollection1(l); - return l; - } - - private List buildObjectList1() { - List l = new ArrayList(); - this.addToCollection1(l); - return l; - } - - private void addToCollection1(Collection c) { - c.add("zero"); - c.add("one"); - c.add("two"); - } - - private List buildStringList2() { - List l = new ArrayList(); - this.addToCollection2(l); - return l; - } - - private void addToCollection2(Collection c) { - c.add("three"); - c.add("four"); - c.add("five"); - } - - private Set buildStringSet1() { - Set s = new HashSet(); - this.addToCollection1(s); - return s; - } - - private Set buildObjectSet1() { - Set s = new HashSet(); - this.addToCollection1(s); - return s; - } - - private SortedSet buildSortedStringSet1() { - SortedSet s = new TreeSet(); - this.addToCollection1(s); - return s; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CommandExecutorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CommandExecutorTests.java deleted file mode 100644 index 693b9c91b4..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CommandExecutorTests.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.internal.ThreadLocalCommandExecutor; - -public class CommandExecutorTests - extends MultiThreadedTestCase -{ - - public CommandExecutorTests(String name) { - super(name); - } - - public void testDefaultCommandExecutor_toString() throws Exception { - CommandExecutor commandExecutor = CommandExecutor.Default.instance(); - assertNotNull(commandExecutor.toString()); - } - - public void testDefaultCommandExecutor_serialization() throws Exception { - CommandExecutor commandExecutor1 = CommandExecutor.Default.instance(); - CommandExecutor commandExecutor2 = TestTools.serialize(commandExecutor1); - assertSame(commandExecutor1, commandExecutor2); - } - - public void testDefaultCommandExecutor() { - TestCommand testCommand = new TestCommand(); - assertEquals(0, testCommand.count); - CommandExecutor commandExecutor = CommandExecutor.Default.instance(); - commandExecutor.execute(testCommand); - assertEquals(1, testCommand.count); - } - - static class TestCommand implements Command { - int count = 0; - public void execute() { - this.count++; - } - } - - public void testThreadLocalCommandExecutor_toString() throws Exception { - CommandExecutor commandExecutor = new ThreadLocalCommandExecutor(); - assertNotNull(commandExecutor.toString()); - } - - public void testThreadLocalCommandExecutor() throws Exception { - ThreadLocalCommandExecutor threadLocalCommandExecutor = new ThreadLocalCommandExecutor(); - TestRunnable testRunnable1 = new TestRunnable(threadLocalCommandExecutor, 1); - Thread thread1 = this.buildThread(testRunnable1); - thread1.run(); - - TestRunnable testRunnable2 = new TestRunnable(threadLocalCommandExecutor, 2); - Thread thread2 = this.buildThread(testRunnable2); - thread2.run(); - - TestRunnable testRunnable3 = new TestRunnable(threadLocalCommandExecutor, 3, null); - Thread thread3 = this.buildThread(testRunnable3); - thread3.run(); - - thread1.join(); - thread2.join(); - thread3.join(); - - assertEquals(1, testRunnable1.testCommand.count); - assertEquals(1, testRunnable1.testCommandExecutor.count); - - assertEquals(2, testRunnable2.testCommand.count); - assertEquals(2, testRunnable2.testCommandExecutor.count); - - assertEquals(3, testRunnable3.testCommand.count); - assertNull(testRunnable3.testCommandExecutor); - } - - static class TestCommandExecutor implements CommandExecutor { - int count = 0; - public void execute(Command command) { - this.count++; - command.execute(); - } - } - - static class TestRunnable implements Runnable { - final ThreadLocalCommandExecutor threadLocalCommandExecutor; - final int executionCount; - final TestCommand testCommand = new TestCommand(); - final TestCommandExecutor testCommandExecutor; - TestRunnable(ThreadLocalCommandExecutor threadLocalCommandExecutor, int executionCount) { - this(threadLocalCommandExecutor, executionCount, new TestCommandExecutor()); - } - TestRunnable(ThreadLocalCommandExecutor threadLocalCommandExecutor, int executionCount, TestCommandExecutor testCommandExecutor) { - super(); - this.threadLocalCommandExecutor = threadLocalCommandExecutor; - this.executionCount = executionCount; - this.testCommandExecutor = testCommandExecutor; - } - public void run() { - this.threadLocalCommandExecutor.set(this.testCommandExecutor); - for (int i = 0; i < this.executionCount; i++) { - this.threadLocalCommandExecutor.execute(this.testCommand); - } - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CommandRunnableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CommandRunnableTests.java deleted file mode 100644 index 623b2b2449..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CommandRunnableTests.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.internal.CommandRunnable; - -@SuppressWarnings("nls") -public class CommandRunnableTests extends TestCase { - boolean commandExecuted = false; - - public CommandRunnableTests(String name) { - super(name); - } - - public void testNullCommand() { - boolean exCaught = false; - try { - Runnable runnable = new CommandRunnable(null); - fail("bogus: " + runnable); - } catch (NullPointerException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testRun() { - Runnable runnable = new CommandRunnable(this.buildCommand()); - runnable.run(); - assertTrue(this.commandExecuted); - } - - public void testToString() { - Runnable runnable = new CommandRunnable(this.buildCommand()); - assertNotNull(runnable.toString()); - } - - private Command buildCommand() { - return new Command() { - public void execute() { - CommandRunnableTests.this.commandExecuted = true; - } - }; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CommandTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CommandTests.java deleted file mode 100644 index 0eb8392e8b..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CommandTests.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.internal.CommandRunnable; -import org.eclipse.jpt.common.utility.internal.RunnableCommand; -import org.eclipse.jpt.common.utility.internal.ThreadLocalCommand; - -public class CommandTests - extends MultiThreadedTestCase -{ - public CommandTests(String name) { - super(name); - } - - public void testNullCommand() { - Command command = Command.Null.instance(); - command.execute(); // just make sure it doesn't blow up? - } - - public void testNullCommand_toString() { - Command command = Command.Null.instance(); - assertNotNull(command.toString()); - } - - public void testNullCommand_serialization() throws Exception { - Command command1 = Command.Null.instance(); - Command command2 = TestTools.serialize(command1); - assertSame(command1, command2); - } - - public void testDisabledCommand() { - Command command = Command.Disabled.instance(); - boolean exCaught = false; - try { - command.execute(); - fail(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testDisabledCommand_toString() { - Command command = Command.Disabled.instance(); - assertNotNull(command.toString()); - } - - public void testDisabledCommand_serialization() throws Exception { - Command command1 = Command.Disabled.instance(); - Command command2 = TestTools.serialize(command1); - assertSame(command1, command2); - } - - public void testRunnableCommand() { - SimpleTestRunnable testRunnable = new SimpleTestRunnable(); - assertFalse(testRunnable.ran); - Command command = new RunnableCommand(testRunnable); - command.execute(); - assertTrue(testRunnable.ran); - } - - static class SimpleTestRunnable implements Runnable { - boolean ran = false; - public void run() { - this.ran = true; - } - } - - public void testCommandRunnable() { - TestCommand testCommand = new TestCommand(); - assertEquals(0, testCommand.count); - Runnable runnable = new CommandRunnable(testCommand); - runnable.run(); - assertEquals(1, testCommand.count); - } - - static class TestCommand implements Command { - int count = 0; - public void execute() { - this.count++; - } - } - - public void testThreadLocalCommand() throws Exception { - ThreadLocalCommand threadLocalCommand = new ThreadLocalCommand(); - TestRunnable testRunnable1 = new TestRunnable(threadLocalCommand, 1); - Thread thread1 = this.buildThread(testRunnable1); - thread1.run(); - - TestRunnable testRunnable2 = new TestRunnable(threadLocalCommand, 2); - Thread thread2 = this.buildThread(testRunnable2); - thread2.run(); - - thread1.join(); - thread2.join(); - - assertEquals(1, testRunnable1.testCommand.count); - - assertEquals(2, testRunnable2.testCommand.count); - } - - static class TestCommandExecutor implements CommandExecutor { - int count = 0; - public void execute(Command command) { - this.count++; - command.execute(); - } - } - - static class TestRunnable implements Runnable { - final ThreadLocalCommand threadLocalCommand; - final int executionCount; - final TestCommand testCommand = new TestCommand(); - TestRunnable(ThreadLocalCommand threadLocalCommand, int executionCount) { - super(); - this.threadLocalCommand = threadLocalCommand; - this.executionCount = executionCount; - } - public void run() { - this.threadLocalCommand.set(this.testCommand); - for (int i = 0; i < this.executionCount; i++) { - this.threadLocalCommand.execute(); - } - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CompositeCommandTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CompositeCommandTests.java deleted file mode 100644 index cfabc54bef..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/CompositeCommandTests.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.internal.CommandRunnable; -import org.eclipse.jpt.common.utility.internal.CompositeCommand; - -public class CompositeCommandTests extends TestCase { - boolean command1Executed = false; - boolean command2Executed = false; - - public CompositeCommandTests(String name) { - super(name); - } - - public void testRun() { - Runnable runnable = new CommandRunnable(this.buildCompositeCommand()); - runnable.run(); - assertTrue(this.command1Executed); - assertTrue(this.command2Executed); - } - - public void testToString() { - Runnable runnable = new CommandRunnable(this.buildCompositeCommand()); - assertNotNull(runnable.toString()); - } - - private Command buildCompositeCommand() { - return new CompositeCommand( - this.buildCommand1(), - this.buildCommand2() - ); - } - - private Command buildCommand1() { - return new Command() { - public void execute() { - CompositeCommandTests.this.command1Executed = true; - } - }; - } - - private Command buildCommand2() { - return new Command() { - public void execute() { - CompositeCommandTests.this.command2Executed = true; - } - }; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ExceptionHandlerTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ExceptionHandlerTests.java deleted file mode 100644 index 23097f3ab5..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ExceptionHandlerTests.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.ExceptionHandler; - -public class ExceptionHandlerTests extends TestCase { - - public ExceptionHandlerTests(String name) { - super(name); - } - - public void testNullExceptionHandler() { - ExceptionHandler exceptionHandler = ExceptionHandler.Null.instance(); - exceptionHandler.handleException(new NullPointerException()); // just make sure it doesn't blow up? - } - - public void testNullExceptionHandlerToString() { - ExceptionHandler exceptionHandler = ExceptionHandler.Null.instance(); - assertNotNull(exceptionHandler.toString()); - } - - public void testRuntimeExceptionHandler() { - Exception npe = new NullPointerException(); - ExceptionHandler exceptionHandler = ExceptionHandler.Runtime.instance(); - boolean exCaught = false; - try { - exceptionHandler.handleException(npe); - fail(); - } catch (RuntimeException ex) { - assertSame(npe, ex.getCause()); - exCaught = true; - } - assertTrue(exCaught); - } - - public void testRuntimeExceptionHandlerToString() { - ExceptionHandler exceptionHandler = ExceptionHandler.Runtime.instance(); - assertNotNull(exceptionHandler.toString()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/FileToolsTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/FileToolsTests.java deleted file mode 100644 index 5483b8588d..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/FileToolsTests.java +++ /dev/null @@ -1,593 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.io.File; -import java.io.FileFilter; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.io.InputStreamReader; -import java.io.OutputStreamWriter; -import java.io.Reader; -import java.io.Writer; -import java.lang.reflect.InvocationTargetException; -import java.net.URL; -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.FileTools; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.Tools; - -@SuppressWarnings("nls") -public class FileToolsTests extends TestCase { - private File tempDir; - - public FileToolsTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.tempDir = this.buildTempDir(); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - this.deleteDir(this.tempDir); - } - - public void testFilesIn() { - Collection files = CollectionTools.collection(FileTools.filesIn(this.tempDir.getPath())); - assertEquals("invalid file count", 3, files.size()); - } - - public void testDirectoriesIn() { - Collection files = CollectionTools.collection(FileTools.directoriesIn(this.tempDir.getPath())); - assertEquals("invalid directory count", 2, files.size()); - } - - public void testFilesInTree() { - Collection files = CollectionTools.collection(FileTools.filesInTree(this.tempDir.getPath())); - assertEquals("invalid file count", 9, files.size()); - } - - public void testDirectoriesInTree() { - Collection files = CollectionTools.collection(FileTools.directoriesInTree(this.tempDir.getPath())); - assertEquals("invalid directory count", 3, files.size()); - } - - public void testDeleteDirectory() throws IOException { - // build another temporary directory just for this test - File dir = this.buildTempDir(); - assertTrue("temporary directory not created", dir.exists()); - FileTools.deleteDirectory(dir.getPath()); - assertFalse("temporary directory not deleted", dir.exists()); - } - - public void testDeleteDirectoryContents() throws IOException { - // build another temporary directory just for this test - File dir = this.buildTempDir(); - assertTrue("temporary directory not created", dir.exists()); - FileTools.deleteDirectoryContents(dir.getPath()); - assertTrue("temporary directory should not have been deleted", dir.exists()); - assertTrue("temporary directory contents not deleted", dir.listFiles().length == 0); - dir.delete(); - } - - public void testCopyToFile() throws IOException { - File destFile = new File(this.tempDir, "destfile.txt"); - this.copyToFile(destFile, "testCopyToFile"); - } - - public void testCopyToPreExistingFile() throws IOException { - File destFile = new File(this.tempDir, "destfile.txt"); - Writer writer = new OutputStreamWriter(new FileOutputStream(destFile)); - writer.write("this text should be replaced..."); - writer.close(); - this.copyToFile(destFile, "testCopyToPreExistingFile"); - } - - private void copyToFile(File destFile, String writeString) throws IOException { - File sourceFile = new File(this.tempDir, "sourcefile.txt"); - char[] readBuffer = new char[writeString.length()]; - - Writer writer = new OutputStreamWriter(new FileOutputStream(sourceFile)); - writer.write(writeString); - writer.close(); - - FileTools.copyToFile(sourceFile, destFile); - - Reader reader = new InputStreamReader(new FileInputStream(destFile)); - reader.read(readBuffer); - reader.close(); - String readString = new String(readBuffer); - assertEquals(writeString, readString); - } - - public void testCopyToDirectory() throws IOException { - File sourceFile = new File(this.tempDir, "sourcefile.txt"); - String writeString = "testCopyToDirectory"; - - File destDir = new File(this.tempDir, "destdir"); - destDir.mkdir(); - File destFile = new File(destDir, "sourcefile.txt"); - char[] readBuffer = new char[writeString.length()]; - - Writer writer = new OutputStreamWriter(new FileOutputStream(sourceFile)); - writer.write(writeString); - writer.close(); - - FileTools.copyToDirectory(sourceFile, destDir); - - Reader reader = new InputStreamReader(new FileInputStream(destFile)); - reader.read(readBuffer); - reader.close(); - String readString = new String(readBuffer); - assertEquals(writeString, readString); - - FileTools.copyToDirectory(sourceFile, destDir); //Try again with the directory is already created - reader = new InputStreamReader(new FileInputStream(destFile)); - reader.read(readBuffer); - reader.close(); - readString = new String(readBuffer); - assertEquals(writeString, readString); - } - - public void testFilter() throws IOException { - String prefix = "XXXtestFileXXX"; - File testFile1 = new File(this.tempDir, prefix + "1"); - testFile1.createNewFile(); - File testFile2 = new File(this.tempDir, prefix + "2"); - testFile2.createNewFile(); - - FileFilter filter = this.buildFileFilter(prefix); - Iterator filteredFilesIterator = FileTools.filter(FileTools.filesIn(this.tempDir), filter); - Collection filteredFiles = CollectionTools.collection(filteredFilesIterator); - assertEquals(2, filteredFiles.size()); - assertTrue(filteredFiles.contains(testFile1)); - assertTrue(filteredFiles.contains(testFile2)); - } - - private FileFilter buildFileFilter(final String prefix) { - return new FileFilter() { - public boolean accept(File file) { - return file.getName().startsWith(prefix); - } - }; - } - - public void testStripExtension() { - assertEquals("foo", FileTools.stripExtension("foo.xml")); - assertEquals("foo.bar", FileTools.stripExtension("foo.bar.xml")); - assertEquals("foo", FileTools.stripExtension("foo")); - assertEquals("foo", FileTools.stripExtension("foo.")); - } - - public void testExtension() { - assertEquals(".xml", FileTools.extension("foo.xml")); - assertEquals(".xml", FileTools.extension("foo.bar.xml")); - assertEquals("", FileTools.extension("foo")); - assertEquals("", FileTools.extension("foo,xml")); - assertEquals(".", FileTools.extension("foo.")); - } - - public void testEmptyTemporaryDirectory() throws IOException { - File tempDir1 = FileTools.temporaryDirectory(); - File testFile1 = new File(tempDir1, "junk"); - testFile1.createNewFile(); - - File tempDir2 = FileTools.emptyTemporaryDirectory(); - assertEquals(tempDir1, tempDir2); - assertTrue(tempDir2.isDirectory()); - assertEquals(0, tempDir2.listFiles().length); - tempDir2.delete(); - } - - public void testCanonicalFileName() { - File file1 = new File("foo"); - file1 = new File(file1, "bar"); - file1 = new File(file1, "baz"); - file1 = new File(file1, ".."); - file1 = new File(file1, ".."); - file1 = new File(file1, "bar"); - file1 = new File(file1, "baz"); - File file2 = new File(System.getProperty("user.dir")); - file2 = new File(file2, "foo"); - file2 = new File(file2, "bar"); - file2 = new File(file2, "baz"); - File file3 = FileTools.canonicalFile(file1); - assertEquals(file2, file3); - } - - public void testPathFiles() { - File[] expected; - File[] actual; - - if (Tools.osIsWindows()) { - expected = new File[] { new File("C:/"), new File("C:/foo"), new File("C:/foo/bar"), new File("C:/foo/bar/baz.txt") }; - actual = this.pathFiles(new File("C:/foo/bar/baz.txt")); - assertTrue(Arrays.equals(expected, actual)); - } - - expected = new File[] { new File("/"), new File("/foo"), new File("/foo/bar"), new File("/foo/bar/baz.txt") }; - actual = this.pathFiles(new File("/foo/bar/baz.txt")); - assertTrue(Arrays.equals(expected, actual)); - - expected = new File[] { new File("foo"), new File("foo/bar"), new File("foo/bar/baz.txt") }; - actual = this.pathFiles(new File("foo/bar/baz.txt")); - assertTrue(Arrays.equals(expected, actual)); - - expected = new File[] { new File(".."), new File("../foo"), new File("../foo/bar"), new File("../foo/bar/baz.txt") }; - actual = this.pathFiles(new File("../foo/bar/baz.txt")); - assertTrue(Arrays.equals(expected, actual)); - - expected = new File[] { new File("."), new File("./foo"), new File("./foo/bar"), new File("./foo/bar/baz.txt") }; - actual = this.pathFiles(new File("./foo/bar/baz.txt")); - assertTrue(Arrays.equals(expected, actual)); - } - - private File[] pathFiles(File file) { - return (File[]) ReflectionTools.executeStaticMethod(FileTools.class, "pathFiles", File.class, file); - } - - public void testRelativeParentFile() { - assertEquals(new File(".."), this.relativeParentFile(1)); - assertEquals(new File("../.."), this.relativeParentFile(2)); - assertEquals(new File("../../.."), this.relativeParentFile(3)); - - boolean exCaught = false; - try { - File file = this.relativeParentFile(0); - fail("invalid return: " + file); - } catch (RuntimeException ex) { - if (ex.getCause() instanceof InvocationTargetException) { - InvocationTargetException ite = (InvocationTargetException) ex.getCause(); - if (ite.getTargetException() instanceof IllegalArgumentException) { - exCaught = true; - } - } - } - assertTrue(exCaught); - } - - private File relativeParentFile(int len) { - return (File) ReflectionTools.executeStaticMethod(FileTools.class, "relativeParentFile", int.class, new Integer(len)); - } - - public void testConvertToRelativeFile() { - String prefix = Tools.osIsWindows() ? "C:" : ""; - File file; - File dir; - File relativeFile; - - if (Tools.osIsWindows()) { - // on Windows, a drive must be specified for a file to be absolute (i.e. not relative) - this.verifyUnchangedRelativeFile("/dir1/dir2/file.txt", "C:/dir1/dir2"); - // different drives - this.verifyUnchangedRelativeFile("D:/dir1/dir2/file.txt", "C:/dir1/dir2"); - } - this.verifyUnchangedRelativeFile("dir1/dir2/file.txt", prefix + "/dir1/dir2"); - this.verifyUnchangedRelativeFile("./dir1/dir2/file.txt", prefix + "/dir1/dir2"); - this.verifyUnchangedRelativeFile("../../dir1/dir2/file.txt", prefix + "/dir1/dir2"); - - file = new File(prefix + "/dir1/dir2"); - dir = new File(prefix + "/dir1/dir2"); - relativeFile = FileTools.convertToRelativeFile(file, dir); - assertEquals(new File("."), relativeFile); - - file = new File(prefix + "/dir1/dir2/file.txt"); - dir = new File(prefix + "/dir1/dir2"); - relativeFile = FileTools.convertToRelativeFile(file, dir); - assertEquals(new File("file.txt"), relativeFile); - - file = new File(prefix + "/dir1/dir2/../dir2/file.txt"); - dir = new File(prefix + "/dir1/dir2"); - relativeFile = FileTools.convertToRelativeFile(file, dir); - assertEquals(new File("file.txt"), relativeFile); - - file = new File(prefix + "/dir1/dir2/dir3/dir4/dir5/file.txt"); - dir = new File(prefix + "/dir1/dir2"); - relativeFile = FileTools.convertToRelativeFile(file, dir); - assertEquals(new File("dir3/dir4/dir5/file.txt"), relativeFile); - - file = new File(prefix + "/dir1/dir2/file.txt"); - dir = new File(prefix + "/dir1/dir2/dir3/dir4/dir5"); - relativeFile = FileTools.convertToRelativeFile(file, dir); - assertEquals(new File("../../../file.txt"), relativeFile); - - file = new File(prefix + "/dir1/dir2/file.txt"); - dir = new File(prefix + "/dir1/dir2/dir3"); - relativeFile = FileTools.convertToRelativeFile(file, dir); - assertEquals(new File("../file.txt"), relativeFile); - - file = new File(prefix + "/dir1/dir2/dirA/dirB/dirC/file.txt"); - dir = new File(prefix + "/dir1/dir2/dir3/dir4/dir5"); - relativeFile = FileTools.convertToRelativeFile(file, dir); - assertEquals(new File("../../../dirA/dirB/dirC/file.txt"), relativeFile); - - file = new File(prefix + "/dir1/dir2"); - dir = new File(prefix + "/dir1/dir2/dir3/dir4/dir5"); - relativeFile = FileTools.convertToRelativeFile(file, dir); - assertEquals(new File("../../.."), relativeFile); - - file = new File(prefix + "/My Documents/My Workspace/Project 1/lib/toplink.jar"); - dir = new File(prefix + "/My Documents/My Workspace/Project 1"); - relativeFile = FileTools.convertToRelativeFile(file, dir); - assertEquals(new File("lib/toplink.jar"), relativeFile); - } - - private void verifyUnchangedRelativeFile(String fileName, String dirName) { - File file = new File(fileName); - File dir = new File(dirName); - File relativeFile = FileTools.convertToRelativeFile(file, dir); - assertEquals(file, relativeFile); - } - - public void testConvertToAbsoluteFile() { - String prefix = Tools.osIsWindows() ? "C:" : ""; - File file; - File dir; - File absoluteFile; - - if (Tools.osIsWindows()) { - // on Windows, a drive must be specified for a file to be absolute (i.e. not relative) - this.verifyUnchangedAbsoluteFile("C:/dir1/dir2/file.txt", "C:/dir1/dir2"); - // different drives - this.verifyUnchangedAbsoluteFile("D:/dir1/dir2/file.txt", "C:/dir1/dir2"); - } - this.verifyUnchangedAbsoluteFile(prefix + "/dir1/dir2/file.txt", prefix + "/dir1/dir2"); - this.verifyUnchangedAbsoluteFile(prefix + "/./dir1/dir2/file.txt", prefix + "/dir1/dir2"); - this.verifyUnchangedAbsoluteFile(prefix + "/dir1/dir2/../../dir1/dir2/file.txt", prefix + "/dir1/dir2"); - - file = new File("."); - dir = new File(prefix + "/dir1/dir2"); - absoluteFile = FileTools.convertToAbsoluteFile(file, dir); - assertEquals(new File(prefix + "/dir1/dir2"), absoluteFile); - - file = new File("./file.txt"); - dir = new File(prefix + "/dir1/dir2"); - absoluteFile = FileTools.convertToAbsoluteFile(file, dir); - assertEquals(new File(prefix + "/dir1/dir2/file.txt"), absoluteFile); - - file = new File("file.txt"); - dir = new File(prefix + "/dir1/dir2"); - absoluteFile = FileTools.convertToAbsoluteFile(file, dir); - assertEquals(new File(prefix + "/dir1/dir2/file.txt"), absoluteFile); - - file = new File("../dir2/file.txt"); - dir = new File(prefix + "/dir1/dir2"); - absoluteFile = FileTools.convertToAbsoluteFile(file, dir); - assertEquals(new File(prefix + "/dir1/dir2/file.txt"), absoluteFile); - - file = new File("dir3/dir4/dir5/file.txt"); - dir = new File(prefix + "/dir1/dir2"); - absoluteFile = FileTools.convertToAbsoluteFile(file, dir); - assertEquals(new File(prefix + "/dir1/dir2/dir3/dir4/dir5/file.txt"), absoluteFile); - - file = new File("../../../file.txt"); - dir = new File(prefix + "/dir1/dir2/dir3/dir4/dir5"); - absoluteFile = FileTools.convertToAbsoluteFile(file, dir); - assertEquals(new File(prefix + "/dir1/dir2/file.txt"), absoluteFile); - - // too many ".." directories will resolve to the root; - // this is consistent with Windows and Linux command shells - file = new File("../../../../../../../../file.txt"); - dir = new File(prefix + "/dir1/dir2"); - absoluteFile = FileTools.convertToAbsoluteFile(file, dir); - assertEquals(new File(prefix + "/file.txt"), absoluteFile); - - file = new File("../file.txt"); - dir = new File(prefix + "/dir1/dir2/dir3"); - absoluteFile = FileTools.convertToAbsoluteFile(file, dir); - assertEquals(new File(prefix + "/dir1/dir2/file.txt"), absoluteFile); - - file = new File("../../../dirA/dirB/dirC/file.txt"); - dir = new File(prefix + "/dir1/dir2/dir3/dir4/dir5"); - absoluteFile = FileTools.convertToAbsoluteFile(file, dir); - assertEquals(new File(prefix + "/dir1/dir2/dirA/dirB/dirC/file.txt"), absoluteFile); - - file = new File("../../.."); - dir = new File(prefix + "/dir1/dir2/dir3/dir4/dir5"); - absoluteFile = FileTools.convertToAbsoluteFile(file, dir); - assertEquals(new File(prefix + "/dir1/dir2"), absoluteFile); - - file = new File("lib/toplink.jar"); - dir = new File(prefix + "/My Documents/My Workspace/Project 1"); - absoluteFile = FileTools.convertToAbsoluteFile(file, dir); - assertEquals(new File(prefix + "/My Documents/My Workspace/Project 1/lib/toplink.jar"), absoluteFile); - } - - public void testFileNameIsReserved() { - boolean expected = Tools.osIsWindows(); - assertEquals(expected, FileTools.fileNameIsReserved("CON")); - assertEquals(expected, FileTools.fileNameIsReserved("con")); - assertEquals(expected, FileTools.fileNameIsReserved("cON")); - assertEquals(expected, FileTools.fileNameIsReserved("AUX")); - assertEquals(expected, FileTools.fileNameIsReserved("COM3")); - assertEquals(expected, FileTools.fileNameIsReserved("LPT3")); - assertEquals(expected, FileTools.fileNameIsReserved("nUL")); - assertEquals(expected, FileTools.fileNameIsReserved("Prn")); - } - - public void testFileHasAnyReservedComponents() { - boolean expected = Tools.osIsWindows(); - assertEquals(expected, FileTools.fileHasAnyReservedComponents(new File("C:/CON"))); - assertEquals(expected, FileTools.fileHasAnyReservedComponents(new File("/con/foo"))); - assertEquals(expected, FileTools.fileHasAnyReservedComponents(new File("c:/temp/cON"))); - assertEquals(expected, FileTools.fileHasAnyReservedComponents(new File("bar//baz//AUX"))); - assertEquals(expected, FileTools.fileHasAnyReservedComponents(new File("COM3//ttt"))); - assertEquals(expected, FileTools.fileHasAnyReservedComponents(new File("d:/LPT3/xxx"))); - assertEquals(expected, FileTools.fileHasAnyReservedComponents(new File("c:/my docs and stuff/tuesday/nUL"))); - assertEquals(expected, FileTools.fileHasAnyReservedComponents(new File("Prn"))); - } - - public void testShortenFileNameFile() { - if (Tools.osIsWindows()) { - this.verifyShortenFileNameFileWin(); - } else { - this.verifyShortenFileNameFileNonWin(); - } - } - - private void verifyShortenFileNameFileWin() { - File file = new File("C:\\Documents and Settings\\Administrator\\Desktop\\Project\\Text.txt"); - String fileName = FileTools.shortenFileName(file); - assertEquals("C:\\Documents and Settings\\...\\Desktop\\Project\\Text.txt", fileName); - assertTrue(fileName.length() <= FileTools.MAXIMUM_SHORTENED_FILE_NAME_LENGTH); - - file = new File("C:/"); - fileName = FileTools.shortenFileName(file); - assertEquals("C:\\", fileName); - assertTrue(fileName.length() <= FileTools.MAXIMUM_SHORTENED_FILE_NAME_LENGTH); - } - - private void verifyShortenFileNameFileNonWin() { - File file = new File("/home/administrator/documents and settings/desktop/Project/Text.txt"); - String fileName = FileTools.shortenFileName(file); - assertEquals("/home/administrator/.../desktop/Project/Text.txt", fileName); - assertTrue(fileName.length() <= FileTools.MAXIMUM_SHORTENED_FILE_NAME_LENGTH); - - file = new File("/home"); - fileName = FileTools.shortenFileName(file); - assertEquals("/home", fileName); - assertTrue(fileName.length() <= FileTools.MAXIMUM_SHORTENED_FILE_NAME_LENGTH); - } - - public void testShortenFileNameFileInt() { - if (Tools.osIsWindows()) { - this.verifyShortenFileNameFileIntWin(); - } else { - this.verifyShortenFileNameFileIntNonWin(); - } - } - - private void verifyShortenFileNameFileIntWin() { - File file = new File("C:\\Documents and Settings\\Administrator\\Desktop\\Project\\Text.txt"); - String fileName = FileTools.shortenFileName(file, 31); - assertEquals("C:\\...\\Desktop\\Project\\Text.txt", fileName); - assertEquals(31, fileName.length()); - - file = new File("C:/This is the file name.txt"); - fileName = FileTools.shortenFileName(file, 10); - assertEquals("C:\\This is the file name.txt", fileName); - assertEquals(28, fileName.length()); - } - - private void verifyShortenFileNameFileIntNonWin() { - File file = new File("/home/administrator/documents and settings/desktop/Project/Text.txt"); - String fileName = FileTools.shortenFileName(file, 31); - assertEquals("/home/.../desktop/Project/Text.txt", fileName); - assertEquals(34, fileName.length()); - - file = new File("/This is the file name.txt"); - fileName = FileTools.shortenFileName(file, 10); - assertEquals("/This is the file name.txt", fileName); - assertEquals(26, fileName.length()); - } - - public void testShortenFileNameURL() throws Exception { - if (Tools.osIsWindows()) { - this.verifyShortenFileNameURLWin(); - } else { - this.verifyShortenFileNameURLNonWin(); - } - } - - private void verifyShortenFileNameURLWin() throws Exception { - URL url = new URL("file", "", "C:/Documents and Settings/Administrator/Desktop/Project/Text.txt"); - String fileName = FileTools.shortenFileName(url); - assertEquals("C:\\Documents and Settings\\...\\Desktop\\Project\\Text.txt", fileName); - assertTrue(fileName.length() <= FileTools.MAXIMUM_SHORTENED_FILE_NAME_LENGTH); - } - - private void verifyShortenFileNameURLNonWin() throws Exception { - URL url = new URL("file", "", "/home/administrator/documents and settings/desktop/Project/Text.txt"); - String fileName = FileTools.shortenFileName(url); - assertEquals("/home/administrator/.../desktop/Project/Text.txt", fileName); - assertTrue(fileName.length() <= FileTools.MAXIMUM_SHORTENED_FILE_NAME_LENGTH); - } - - public void testShortenFileNameURLInt() throws Exception { - if (Tools.osIsWindows()) { - this.verifyShortenFileNameURLIntWin(); - } else { - this.verifyShortenFileNameURLIntNonWin(); - } - } - - private void verifyShortenFileNameURLIntWin() throws Exception { - URL url = new URL("file", "", "/C:/Documents and Settings/Administrator/Desktop/Project/Text.txt"); - String fileName = FileTools.shortenFileName(url, 31); - assertEquals("C:\\...\\Desktop\\Project\\Text.txt", fileName); - assertEquals(31, fileName.length()); - } - - private void verifyShortenFileNameURLIntNonWin() throws Exception { - URL url = new URL("file", "", "/home/administrator/documents and settings/desktop/Project/Text.txt"); - String fileName = FileTools.shortenFileName(url, 31); - assertEquals("/home/.../desktop/Project/Text.txt", fileName); - assertEquals(34, fileName.length()); - } - - private void verifyUnchangedAbsoluteFile(String fileName, String dirName) { - File file = new File(fileName); - File dir = new File(dirName); - File absoluteFile = FileTools.convertToAbsoluteFile(file, dir); - assertEquals(file, absoluteFile); - } - - private File buildTempDir() throws IOException { - // build a new directory for each test, to prevent any cross-test effects - File dir = FileTools.newTemporaryDirectory(this.getClass().getSimpleName() + "." + this.getName()); - - File file0a = new File(dir, "file0a"); - file0a.createNewFile(); - File file0b = new File(dir, "file0b"); - file0b.createNewFile(); - File file0c = new File(dir, "file0c"); - file0c.createNewFile(); - - File subdir1 = new File(dir, "subdir1"); - subdir1.mkdir(); - File file1a = new File(subdir1, "file1a"); - file1a.createNewFile(); - File file1b = new File(subdir1, "file1b"); - file1b.createNewFile(); - - File subdir2 = new File(dir, "subdir2"); - subdir2.mkdir(); - File file2a = new File(subdir2, "file2a"); - file2a.createNewFile(); - File file2b = new File(subdir2, "file2b"); - file2b.createNewFile(); - - File subdir3 = new File(subdir2, "subdir3"); - subdir3.mkdir(); - File file3a = new File(subdir3, "file3a"); - file3a.createNewFile(); - File file3b = new File(subdir3, "file3b"); - file3b.createNewFile(); - - return dir; - } - - private void deleteDir(File dir) { - FileTools.deleteDirectory(dir); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/FilterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/FilterTests.java deleted file mode 100644 index b27a0a3543..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/FilterTests.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.Filter; - -@SuppressWarnings("nls") -public class FilterTests extends TestCase { - - public FilterTests(String name) { - super(name); - } - - public void testNullFilter() { - Filter filter = Filter.Null.instance(); - assertTrue(filter.accept("")); - assertTrue(filter.accept("foo")); - assertTrue(filter.accept("bar")); - } - - public void testNullFilter_toString() { - Filter filter = Filter.Null.instance(); - assertNotNull(filter.toString()); - } - - public void testNullFilter_serialization() throws Exception { - Filter filter = Filter.Null.instance(); - assertSame(filter, TestTools.serialize(filter)); - } - - public void testOpaqueFilter() { - Filter filter = Filter.Opaque.instance(); - assertFalse(filter.accept("")); - assertFalse(filter.accept("foo")); - assertFalse(filter.accept("bar")); - } - - public void testOpaqueFilter_toString() { - Filter filter = Filter.Opaque.instance(); - assertNotNull(filter.toString()); - } - - public void testOpaqueFilter_serialization() throws Exception { - Filter filter = Filter.Opaque.instance(); - assertSame(filter, TestTools.serialize(filter)); - } - - public void testDisabledFilter() { - Filter filter = Filter.Disabled.instance(); - boolean exCaught = false; - try { - assertFalse(filter.accept("foo")); - fail(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testDisabledFilter_toString() { - Filter filter = Filter.Disabled.instance(); - assertNotNull(filter.toString()); - } - - public void testDisabledFilter_serialization() throws Exception { - Filter filter = Filter.Disabled.instance(); - assertSame(filter, TestTools.serialize(filter)); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/HashBagTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/HashBagTests.java deleted file mode 100644 index df2a10bd28..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/HashBagTests.java +++ /dev/null @@ -1,555 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.ConcurrentModificationException; -import java.util.Iterator; -import java.util.NoSuchElementException; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.Bag; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.Tools; - -@SuppressWarnings("nls") -public class HashBagTests extends TestCase { - private HashBag bag; - - public HashBagTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.bag = this.buildBag(); - } - - private HashBag buildBag() { - HashBag b = new HashBag(); - b.add(null); - b.add(new String("one")); - b.add(new String("two")); - b.add(new String("two")); - b.add(new String("three")); - b.add(new String("three")); - b.add(new String("three")); - b.add(new String("four")); - b.add(new String("four")); - b.add(new String("four")); - b.add(new String("four")); - return b; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - private Collection buildCollection() { - Collection c = new ArrayList(); - c.add(new String("foo")); - c.add(new String("foo")); - c.add(new String("bar")); - c.add(new String("bar")); - c.add(new String("bar")); - return c; - } - - public void testCtorCollection() { - Collection c = this.buildCollection(); - Bag b = new HashBag(c); - for (String s : c) { - assertTrue(b.contains(s)); - } - } - - public void testCtorIntFloat() { - boolean exCaught; - - exCaught = false; - try { - this.bag = new HashBag(-20, 0.66f); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - exCaught = false; - try { - this.bag = new HashBag(20, -0.66f); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testAdd() { - // the other adds took place in setUp - assertTrue(this.bag.add("five")); - - assertTrue(this.bag.contains("one")); - assertTrue(this.bag.contains("two")); - assertTrue(this.bag.contains("three")); - assertTrue(this.bag.contains("four")); - assertTrue(this.bag.contains("five")); - } - - public void testAddCount() { - // the other adds took place in setUp - this.bag.add("minus3", -3); - this.bag.add("zero", 0); - this.bag.add("five", 5); - - assertFalse(this.bag.contains("minus3")); - assertFalse(this.bag.contains("zero")); - assertEquals(1, this.bag.count("one")); - assertEquals(2, this.bag.count("two")); - assertEquals(3, this.bag.count("three")); - assertEquals(4, this.bag.count("four")); - assertEquals(5, this.bag.count("five")); - - this.bag.add("three", 2); - assertEquals(5, this.bag.count("three")); - } - - public void testAddAll() { - Collection c = this.buildCollection(); - assertTrue(this.bag.addAll(c)); - for (String s : c) { - assertTrue(this.bag.contains(s)); - } - } - - public void testClear() { - assertTrue(this.bag.contains("one")); - assertTrue(this.bag.contains("two")); - assertTrue(this.bag.contains("three")); - assertTrue(this.bag.contains("four")); - assertTrue(this.bag.contains(null)); - assertEquals(11, this.bag.size()); - this.bag.clear(); - assertFalse(this.bag.contains("one")); - assertFalse(this.bag.contains("two")); - assertFalse(this.bag.contains("three")); - assertFalse(this.bag.contains("four")); - assertFalse(this.bag.contains(null)); - assertEquals(0, this.bag.size()); - } - - public void testClone() { - Bag bag2 = this.bag.clone(); - assertTrue(this.bag != bag2); - assertEquals(this.bag, bag2); - assertTrue(this.bag.hashCode() == bag2.hashCode()); - } - - public void testContains() { - assertTrue(this.bag.contains(null)); - assertTrue(this.bag.contains("one")); - assertTrue(this.bag.contains("two")); - assertTrue(this.bag.contains("three")); - assertTrue(this.bag.contains("four")); - assertTrue(this.bag.contains(new String("four"))); - assertTrue(this.bag.contains("fo" + "ur")); - assertFalse(this.bag.contains("five")); - } - - public void testContainsAll() { - Collection c = new ArrayList(); - c.add(null); - c.add(new String("one")); - c.add(new String("two")); - c.add(new String("three")); - c.add(new String("four")); - assertTrue(this.bag.containsAll(c)); - } - - public void testCount() { - assertEquals(0, this.bag.count("zero")); - assertEquals(1, this.bag.count("one")); - assertEquals(2, this.bag.count("two")); - assertEquals(3, this.bag.count("three")); - assertEquals(4, this.bag.count("four")); - assertEquals(0, this.bag.count("five")); - } - - public void testEquals() { - Bag bag2 = this.buildBag(); - assertEquals(this.bag, bag2); - bag2.add("five"); - assertFalse(this.bag.equals(bag2)); - Collection c = new ArrayList(this.bag); - assertFalse(this.bag.equals(c)); - } - - public void testHashCode() { - Bag bag2 = this.buildBag(); - assertEquals(this.bag.hashCode(), bag2.hashCode()); - } - - public void testIsEmpty() { - assertFalse(this.bag.isEmpty()); - this.bag.clear(); - assertTrue(this.bag.isEmpty()); - this.bag.add("foo"); - assertFalse(this.bag.isEmpty()); - } - - public void testEmptyIterator() { - this.bag.clear(); - Iterator iterator = this.bag.iterator(); - assertFalse(iterator.hasNext()); - - boolean exCaught = false; - Object element = null; - try { - element = iterator.next(); - fail(element.toString()); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue(exCaught); - - exCaught = false; - try { - iterator.remove(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testIterator() { - int i = 0; - Iterator iterator = this.bag.iterator(); - assertTrue(iterator.hasNext()); - while (iterator.hasNext()) { - iterator.next(); - i++; - } - assertEquals(11, i); - assertFalse(iterator.hasNext()); - - boolean exCaught = false; - Object element = null; - try { - element = iterator.next(); - fail(element.toString()); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue(exCaught); - - iterator.remove(); - assertEquals(10, this.bag.size()); - - exCaught = false; - try { - iterator.remove(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue(exCaught); - - // start over - iterator = this.bag.iterator(); - this.bag.add("five"); - exCaught = false; - try { - iterator.next(); - } catch (ConcurrentModificationException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testUniqueIterator() { - int i = 0; - Iterator iterator = this.bag.uniqueIterator(); - assertTrue(iterator.hasNext()); - while (iterator.hasNext()) { - iterator.next(); - i++; - } - assertEquals(5, i); - assertFalse(iterator.hasNext()); - - boolean exCaught = false; - Object element = null; - try { - element = iterator.next(); - fail(element.toString()); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue(exCaught); - - // start over - iterator = this.bag.uniqueIterator(); - Object next = null; - while (iterator.hasNext() && !"four".equals(next)) { - next = iterator.next(); - } - iterator.remove(); - assertEquals(7, this.bag.size()); - - exCaught = false; - try { - iterator.remove(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue(exCaught); - - // start over - iterator = this.bag.uniqueIterator(); - this.bag.add("five"); - exCaught = false; - try { - iterator.next(); - } catch (ConcurrentModificationException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testEntries() { - int i = 0; - Iterator> iterator = this.bag.entries(); - assertTrue(iterator.hasNext()); - while (iterator.hasNext()) { - iterator.next(); - i++; - } - assertEquals(5, i); - assertFalse(iterator.hasNext()); - - boolean exCaught = false; - Object element = null; - try { - element = iterator.next(); - fail(element.toString()); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue(exCaught); - - // start over - iterator = this.bag.entries(); - Bag.Entry next = null; - while (iterator.hasNext()) { - next = iterator.next(); - if (next.getElement().equals("four")) { - iterator.remove(); - break; - } - } - assertEquals(7, this.bag.size()); - - exCaught = false; - try { - iterator.remove(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue(exCaught); - - // start over - iterator = this.bag.entries(); - this.bag.add("five"); - exCaught = false; - try { - iterator.next(); - } catch (ConcurrentModificationException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testHashingDistribution() throws Exception { - Bag bigBag = new HashBag(); - for (int i = 0; i < 10000; i++) { - bigBag.add("object" + i); - } - - java.lang.reflect.Field field = bigBag.getClass().getDeclaredField("table"); - field.setAccessible(true); - Object[] table = (Object[]) field.get(bigBag); - int bucketCount = table.length; - int filledBucketCount = 0; - for (Object o : table) { - if (o != null) { - filledBucketCount++; - } - } - float loadFactor = ((float) filledBucketCount) / ((float) bucketCount); - if ((loadFactor < 0.20) || (loadFactor > 0.80)) { - String msg = "poor load factor: " + loadFactor; - if (Tools.jvmIsSun()) { - fail(msg); - } else { - // poor load factor is seen in the Eclipse build environment for some reason... - System.out.println(this.getClass().getName() + '.' + this.getName() + " - " + msg); - TestTools.printSystemProperties(); - } - } - } - - public void testRemove() { - assertTrue(this.bag.remove("one")); - assertFalse(this.bag.contains("one")); - assertFalse(this.bag.remove("one")); - - assertTrue(this.bag.remove("two")); - assertTrue(this.bag.remove("two")); - assertFalse(this.bag.contains("two")); - assertFalse(this.bag.remove("two")); - } - - public void testRemoveCount() { - assertFalse(this.bag.remove("one", 0)); - assertTrue(this.bag.contains("one")); - - assertTrue(this.bag.remove("one", 1)); - assertFalse(this.bag.contains("one")); - assertFalse(this.bag.remove("one")); - - assertFalse(this.bag.remove("two", -3)); - assertTrue(this.bag.remove("two", 1)); - assertTrue(this.bag.contains("two")); - - assertTrue(this.bag.remove("two", 1)); - assertFalse(this.bag.contains("two")); - assertFalse(this.bag.remove("two")); - - assertTrue(this.bag.remove("three", 3)); - assertFalse(this.bag.contains("three")); - assertFalse(this.bag.remove("three")); - } - - public void testRemoveAll() { - Collection c = new ArrayList(); - c.add("one"); - c.add("three"); - assertTrue(this.bag.removeAll(c)); - assertFalse(this.bag.contains("one")); - assertFalse(this.bag.contains("three")); - assertFalse(this.bag.remove("one")); - assertFalse(this.bag.remove("three")); - assertFalse(this.bag.removeAll(c)); - } - - public void testRetainAll() { - Collection c = new ArrayList(); - c.add("one"); - c.add("three"); - assertTrue(this.bag.retainAll(c)); - assertTrue(this.bag.contains("one")); - assertTrue(this.bag.contains("three")); - assertFalse(this.bag.contains("two")); - assertFalse(this.bag.contains("four")); - assertFalse(this.bag.remove("two")); - assertFalse(this.bag.remove("four")); - assertFalse(this.bag.retainAll(c)); - } - - public void testSize() { - assertTrue(this.bag.size() == 11); - this.bag.add("five"); - this.bag.add("five"); - this.bag.add("five"); - this.bag.add("five"); - this.bag.add("five"); - assertEquals(16, this.bag.size()); - } - - public void testSerialization() throws Exception { - Bag bag2 = TestTools.serialize(this.bag); - - assertTrue("same object?", this.bag != bag2); - assertEquals(11, bag2.size()); - assertEquals(this.bag, bag2); - // look for similar elements - assertTrue(bag2.contains(null)); - assertTrue(bag2.contains("one")); - assertTrue(bag2.contains("two")); - assertTrue(bag2.contains("three")); - assertTrue(bag2.contains("four")); - - int nullCount = 0, oneCount = 0, twoCount = 0, threeCount = 0, fourCount = 0; - for (String s : bag2) { - if (s == null) { - nullCount++; - } else if (s.equals("one")) { - oneCount++; - } else if (s.equals("two")) { - twoCount++; - } else if (s.equals("three")) { - threeCount++; - } else if (s.equals("four")) { - fourCount++; - } - } - assertEquals(1, nullCount); - assertEquals(1, oneCount); - assertEquals(2, twoCount); - assertEquals(3, threeCount); - assertEquals(4, fourCount); - } - - public void testToArray() { - Object[] a = this.bag.toArray(); - assertEquals(11, a.length); - assertTrue(ArrayTools.contains(a, null)); - assertTrue(ArrayTools.contains(a, "one")); - assertTrue(ArrayTools.contains(a, "two")); - assertTrue(ArrayTools.contains(a, "three")); - assertTrue(ArrayTools.contains(a, "four")); - } - - public void testToArrayObjectArray() { - String[] a = new String[12]; - a[11] = "not null"; - String[] b = this.bag.toArray(a); - assertEquals(a, b); - assertEquals(12, a.length); - assertTrue(ArrayTools.contains(a, null)); - assertTrue(ArrayTools.contains(a, "one")); - assertTrue(ArrayTools.contains(a, "two")); - assertTrue(ArrayTools.contains(a, "three")); - assertTrue(ArrayTools.contains(a, "four")); - assertTrue(a[11] == null); - } - - public void testToString() { - String s = this.bag.toString(); - assertTrue(s.startsWith("[")); - assertTrue(s.endsWith("]")); - int commaCount = 0; - for (int i = 0; i < s.length(); i++) { - if (s.charAt(i) == ',') { - commaCount++; - } - } - assertEquals(10, commaCount); - assertTrue(s.indexOf("one") != -1); - assertTrue(s.indexOf("two") != -1); - assertTrue(s.indexOf("three") != -1); - assertTrue(s.indexOf("four") != -1); - assertTrue(s.indexOf("null") != -1); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/IdentityHashBagTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/IdentityHashBagTests.java deleted file mode 100644 index f1738bdeb5..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/IdentityHashBagTests.java +++ /dev/null @@ -1,573 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.ConcurrentModificationException; -import java.util.Iterator; -import java.util.NoSuchElementException; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.IdentityHashBag; -import org.eclipse.jpt.common.utility.internal.Tools; - -@SuppressWarnings("nls") -public class IdentityHashBagTests extends TestCase { - private IdentityHashBag bag; - private String one = "one"; - private String two = "two"; - private String three = "three"; - private String four = "four"; - private String foo = "foo"; - private String bar = "bar"; - - public IdentityHashBagTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.bag = this.buildBag(); - } - - protected IdentityHashBag buildBag() { - IdentityHashBag result = new IdentityHashBag(); - result.add(null); - result.add(this.one); - result.add(this.two); - result.add(this.two); - result.add(this.three); - result.add(this.three); - result.add(this.three); - result.add(this.four); - result.add(this.four); - result.add(this.four); - result.add(this.four); - return result; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - private Collection buildCollection() { - Collection c = new ArrayList(); - c.add(this.foo); - c.add(this.foo); - c.add(this.bar); - c.add(this.bar); - c.add(this.bar); - return c; - } - - public void testCtorCollection() { - Collection c = this.buildCollection(); - IdentityHashBag localBag = new IdentityHashBag(c); - for (String s : c) { - assertTrue(localBag.contains(s)); - } - } - - public void testCtorIntFloat() { - boolean exCaught; - - exCaught = false; - try { - this.bag = new IdentityHashBag(-20, 0.66f); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue("IllegalArgumentException not thrown", exCaught); - - exCaught = false; - try { - this.bag = new IdentityHashBag(20, -0.66f); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue("IllegalArgumentException not thrown", exCaught); - } - - public void testAdd() { - // the other adds took place in setUp - String five = "five"; - assertTrue(this.bag.add(five)); - - assertTrue(this.bag.contains(this.one)); - assertTrue(this.bag.contains(this.two)); - assertTrue(this.bag.contains(this.three)); - assertTrue(this.bag.contains(this.four)); - assertTrue(this.bag.contains(five)); - } - - public void testAddCount() { - String minus3 = "minus3"; - String zero = "zero"; - String five = "five"; - // the other adds took place in setUp - this.bag.add(minus3, -3); - this.bag.add(zero, 0); - this.bag.add(five, 5); - - assertFalse(this.bag.contains(minus3)); - assertFalse(this.bag.contains(zero)); - assertEquals(1, this.bag.count(this.one)); - assertEquals(2, this.bag.count(this.two)); - assertEquals(3, this.bag.count(this.three)); - assertEquals(4, this.bag.count(this.four)); - assertEquals(5, this.bag.count(five)); - - this.bag.add(this.three, 2); - assertEquals(5, this.bag.count(this.three)); - } - - public void testAddAll() { - Collection c = this.buildCollection(); - assertTrue(this.bag.addAll(c)); - for (String s : c) { - assertTrue(this.bag.contains(s)); - } - } - - public void testClear() { - assertTrue(this.bag.contains(this.one)); - assertTrue(this.bag.contains(this.two)); - assertTrue(this.bag.contains(this.three)); - assertTrue(this.bag.contains(this.four)); - assertTrue(this.bag.contains(null)); - assertEquals(11, this.bag.size()); - this.bag.clear(); - assertFalse(this.bag.contains(this.one)); - assertFalse(this.bag.contains(this.two)); - assertFalse(this.bag.contains(this.three)); - assertFalse(this.bag.contains(this.four)); - assertFalse(this.bag.contains(null)); - assertEquals(0, this.bag.size()); - } - - public void testClone() { - IdentityHashBag bag2 = this.bag.clone(); - assertTrue("bad clone", this.bag != bag2); - assertEquals("bad clone", this.bag, bag2); - assertTrue("bad clone", this.bag.hashCode() == bag2.hashCode()); - } - - public void testContains() { - assertTrue(this.bag.contains(null)); - assertTrue(this.bag.contains(this.one)); - assertTrue(this.bag.contains(this.two)); - assertTrue(this.bag.contains(this.three)); - assertTrue(this.bag.contains(this.four)); - - assertFalse(this.bag.contains(new String("four"))); - assertFalse(this.bag.contains("five")); - } - - public void testContainsAll() { - Collection c = new ArrayList(); - c.add(null); - c.add(this.one); - c.add(this.two); - c.add(this.three); - c.add(this.four); - assertTrue(this.bag.containsAll(c)); - c.add(new String(this.four)); - assertFalse(this.bag.containsAll(c)); - } - - public void testCount() { - assertEquals(0, this.bag.count("zero")); - assertEquals(1, this.bag.count("one")); - assertEquals(2, this.bag.count("two")); - assertEquals(3, this.bag.count("three")); - assertEquals(4, this.bag.count("four")); - assertEquals(0, this.bag.count("five")); - } - - public void testEquals() { - IdentityHashBag bag2 = this.buildBag(); - assertEquals(this.bag, bag2); - bag2.add("five"); - assertFalse(this.bag.equals(bag2)); - Collection c = new ArrayList(this.bag); - assertFalse(this.bag.equals(c)); - } - - public void testHashCode() { - IdentityHashBag bag2 = this.buildBag(); - assertEquals(this.bag.hashCode(), bag2.hashCode()); - } - - public void testIsEmpty() { - assertFalse(this.bag.isEmpty()); - this.bag.clear(); - assertTrue(this.bag.isEmpty()); - this.bag.add("foo"); - assertFalse(this.bag.isEmpty()); - } - - public void testEmptyIterator() { - this.bag.clear(); - Iterator iterator = this.bag.iterator(); - assertFalse(iterator.hasNext()); - - boolean exCaught = false; - Object element = null; - try { - element = iterator.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + element, exCaught); - - exCaught = false; - try { - iterator.remove(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue("IllegalStateException not thrown", exCaught); - } - - public void testIterator() { - int i = 0; - Iterator iterator = this.bag.iterator(); - assertTrue(iterator.hasNext()); - while (iterator.hasNext()) { - iterator.next(); - i++; - } - assertEquals(11, i); - assertFalse(iterator.hasNext()); - - boolean exCaught = false; - Object element = null; - try { - element = iterator.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + element, exCaught); - - iterator.remove(); - assertEquals(10, this.bag.size()); - - exCaught = false; - try { - iterator.remove(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue("IllegalStateException not thrown", exCaught); - - // start over - iterator = this.bag.iterator(); - this.bag.add("five"); - exCaught = false; - try { - iterator.next(); - } catch (ConcurrentModificationException ex) { - exCaught = true; - } - assertTrue("ConcurrentModificationException not thrown", exCaught); - } - - public void testUniqueIterator() { - int i = 0; - Iterator iterator = this.bag.uniqueIterator(); - assertTrue(iterator.hasNext()); - while (iterator.hasNext()) { - iterator.next(); - i++; - } - assertEquals(5, i); - assertFalse(iterator.hasNext()); - - boolean exCaught = false; - Object element = null; - try { - element = iterator.next(); - fail(element.toString()); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue(exCaught); - - // start over - iterator = this.bag.uniqueIterator(); - Object next = null; - while (iterator.hasNext() && !this.four.equals(next)) { - next = iterator.next(); - } - iterator.remove(); - assertEquals(7, this.bag.size()); - - exCaught = false; - try { - iterator.remove(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue(exCaught); - - // start over - iterator = this.bag.uniqueIterator(); - String five = "five"; - this.bag.add(five); - exCaught = false; - try { - iterator.next(); - } catch (ConcurrentModificationException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testEntries() { - int i = 0; - Iterator> iterator = this.bag.entries(); - assertTrue(iterator.hasNext()); - while (iterator.hasNext()) { - iterator.next(); - i++; - } - assertEquals(5, i); - assertFalse(iterator.hasNext()); - - boolean exCaught = false; - Object element = null; - try { - element = iterator.next(); - fail(element.toString()); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue(exCaught); - - // start over - iterator = this.bag.entries(); - org.eclipse.jpt.common.utility.internal.Bag.Entry next = null; - while (iterator.hasNext()) { - next = iterator.next(); - if (next.getElement().equals(this.four)) { - iterator.remove(); - break; - } - } - assertEquals(7, this.bag.size()); - - exCaught = false; - try { - iterator.remove(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue(exCaught); - - // start over - iterator = this.bag.entries(); - String five = "five"; - this.bag.add(five); - exCaught = false; - try { - iterator.next(); - } catch (ConcurrentModificationException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testHashingDistribution() throws Exception { - IdentityHashBag bigBag = new IdentityHashBag(); - for (int i = 0; i < 10000; i++) { - bigBag.add("object" + i); - } - - java.lang.reflect.Field field = bigBag.getClass().getDeclaredField("table"); - field.setAccessible(true); - Object[] table = (Object[]) field.get(bigBag); - int bucketCount = table.length; - int filledBucketCount = 0; - for (int i = 0; i < bucketCount; i++) { - if (table[i] != null) { - filledBucketCount++; - } - } - float loadFactor = ((float) filledBucketCount) / ((float) bucketCount); - if ((loadFactor < 0.20) || (loadFactor > 0.80)) { - String msg = "poor load factor: " + loadFactor; - if (Tools.jvmIsSun()) { - fail(msg); - } else { - // poor load factor is seen in the Eclipse build environment for some reason... - System.out.println(this.getClass().getName() + '.' + this.getName() + " - " + msg); - TestTools.printSystemProperties(); - } - } - } - - public void testRemove() { - assertTrue(this.bag.remove(this.one)); - assertFalse(this.bag.contains(this.one)); - assertFalse(this.bag.remove(this.one)); - - assertTrue(this.bag.remove(this.two)); - assertTrue(this.bag.remove(this.two)); - assertFalse(this.bag.contains(this.two)); - assertFalse(this.bag.remove(this.two)); - - assertFalse(this.bag.remove(new String(this.three))); - } - - public void testRemoveCount() { - assertFalse(this.bag.remove(this.one, 0)); - assertTrue(this.bag.contains(this.one)); - - assertTrue(this.bag.remove(this.one, 1)); - assertFalse(this.bag.contains(this.one)); - assertFalse(this.bag.remove(this.one)); - - assertFalse(this.bag.remove(this.two, -3)); - assertTrue(this.bag.remove(this.two, 1)); - assertTrue(this.bag.contains(this.two)); - - assertTrue(this.bag.remove(this.two, 1)); - assertFalse(this.bag.contains(this.two)); - assertFalse(this.bag.remove(this.two)); - - assertTrue(this.bag.remove(this.three, 3)); - assertFalse(this.bag.contains(this.three)); - assertFalse(this.bag.remove(this.three)); - } - - public void testRemoveAll() { - Collection c = new ArrayList(); - c.add(this.one); - c.add(new String(this.two)); - c.add(this.three); - assertTrue(this.bag.removeAll(c)); - assertFalse(this.bag.contains(this.one)); - assertTrue(this.bag.contains(this.two)); - assertFalse(this.bag.contains(this.three)); - assertFalse(this.bag.remove(this.one)); - assertTrue(this.bag.remove(this.two)); - assertFalse(this.bag.remove(this.three)); - assertFalse(this.bag.removeAll(c)); - } - - public void testRetainAll() { - Collection c = new ArrayList(); - c.add(this.one); - c.add(new String(this.two)); - c.add(this.three); - assertTrue(this.bag.retainAll(c)); - assertTrue(this.bag.contains(this.one)); - assertFalse(this.bag.contains(this.two)); - assertTrue(this.bag.contains(this.three)); - assertFalse(this.bag.contains(this.four)); - assertFalse(this.bag.remove(this.two)); - assertFalse(this.bag.remove(this.four)); - assertFalse(this.bag.retainAll(c)); - } - - public void testSize() { - assertTrue(this.bag.size() == 11); - String five = "five"; - this.bag.add(five); - this.bag.add(five); - this.bag.add(five); - this.bag.add(five); - this.bag.add(new String(five)); - assertEquals(16, this.bag.size()); - } - - public void testSerialization() throws Exception { - IdentityHashBag bag2 = TestTools.serialize(this.bag); - - assertTrue("same object?", this.bag != bag2); - assertEquals(11, bag2.size()); - assertEquals(CollectionTools.bag(this.bag.iterator()), CollectionTools.bag(bag2.iterator())); - // look for similar elements - assertTrue(CollectionTools.bag(bag2.iterator()).contains(null)); - assertTrue(CollectionTools.bag(bag2.iterator()).contains("one")); - assertTrue(CollectionTools.bag(bag2.iterator()).contains("two")); - assertTrue(CollectionTools.bag(bag2.iterator()).contains("three")); - assertTrue(CollectionTools.bag(bag2.iterator()).contains("four")); - - int nullCount = 0, oneCount = 0, twoCount = 0, threeCount = 0, fourCount = 0; - for (String next : bag2) { - if (next == null) - nullCount++; - else if (next.equals("one")) - oneCount++; - else if (next.equals("two")) - twoCount++; - else if (next.equals("three")) - threeCount++; - else if (next.equals("four")) - fourCount++; - } - assertEquals(1, nullCount); - assertEquals(1, oneCount); - assertEquals(2, twoCount); - assertEquals(3, threeCount); - assertEquals(4, fourCount); - } - - public void testToArray() { - Object[] a = this.bag.toArray(); - assertEquals(11, a.length); - assertTrue(ArrayTools.contains(a, null)); - assertTrue(ArrayTools.contains(a, this.one)); - assertTrue(ArrayTools.contains(a, this.two)); - assertTrue(ArrayTools.contains(a, this.three)); - assertTrue(ArrayTools.contains(a, this.four)); - } - - public void testToArrayObjectArray() { - String[] a = new String[12]; - a[11] = "not null"; - String[] b = this.bag.toArray(a); - assertEquals(a, b); - assertEquals(12, a.length); - assertTrue(ArrayTools.contains(a, null)); - assertTrue(ArrayTools.contains(a, this.one)); - assertTrue(ArrayTools.contains(a, this.two)); - assertTrue(ArrayTools.contains(a, this.three)); - assertTrue(ArrayTools.contains(a, this.four)); - assertTrue(a[11] == null); - } - - public void testToString() { - String s = this.bag.toString(); - assertTrue(s.startsWith("[")); - assertTrue(s.endsWith("]")); - int commaCount = 0; - for (int i = 0; i < s.length(); i++) { - if (s.charAt(i) == ',') { - commaCount++; - } - } - assertEquals("invalid number of commas", 10, commaCount); - assertTrue(s.indexOf("one") != -1); - assertTrue(s.indexOf("two") != -1); - assertTrue(s.indexOf("three") != -1); - assertTrue(s.indexOf("four") != -1); - assertTrue(s.indexOf("null") != -1); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/IndentingPrintWriterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/IndentingPrintWriterTests.java deleted file mode 100644 index 33d331b5f6..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/IndentingPrintWriterTests.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.io.StringWriter; -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.IndentingPrintWriter; - -@SuppressWarnings("nls") -public class IndentingPrintWriterTests extends TestCase { - StringWriter sw1; - StringWriter sw2; - IndentingPrintWriter ipw1; - IndentingPrintWriter ipw2; - - static final String CR = System.getProperty("line.separator"); - - public IndentingPrintWriterTests(String name) { - super(name); - } - - @Override - public void setUp() throws Exception { - super.setUp(); - this.sw1 = new StringWriter(); - this.ipw1 = new IndentingPrintWriter(this.sw1); - this.sw2 = new StringWriter(); - this.ipw2 = new IndentingPrintWriter(this.sw2, " "); // indent with 4 spaces instead of a tab - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testIndent() { - assertEquals("wrong indent level", 0, this.ipw1.getIndentLevel()); - this.ipw1.indent(); - assertEquals("wrong indent level", 1, this.ipw1.getIndentLevel()); - } - - public void testUndent() { - assertEquals("wrong indent level", 0, this.ipw1.getIndentLevel()); - this.ipw1.indent(); - assertEquals("wrong indent level", 1, this.ipw1.getIndentLevel()); - this.ipw1.undent(); - assertEquals("wrong indent level", 0, this.ipw1.getIndentLevel()); - } - - public void testIncrementIndentLevel() { - assertEquals("wrong indent level", 0, this.ipw1.getIndentLevel()); - this.ipw1.incrementIndentLevel(); - assertEquals("wrong indent level", 1, this.ipw1.getIndentLevel()); - } - - public void testDecrementIndentLevel() { - assertEquals("wrong indent level", 0, this.ipw1.getIndentLevel()); - this.ipw1.incrementIndentLevel(); - assertEquals("wrong indent level", 1, this.ipw1.getIndentLevel()); - this.ipw1.decrementIndentLevel(); - assertEquals("wrong indent level", 0, this.ipw1.getIndentLevel()); - } - - public void testPrintTab() { - String expected = "foo0" + CR + "\tfoo1" + CR + "\tfoo1" + CR + "\t\tfoo2" + CR + "\tfoo1" + CR + "\tfoo1" + CR + "foo0" + CR; - - this.ipw1.println("foo0"); - this.ipw1.indent(); - this.ipw1.println("foo1"); - this.ipw1.println("foo1"); - this.ipw1.indent(); - this.ipw1.println("foo2"); - this.ipw1.undent(); - this.ipw1.println("foo1"); - this.ipw1.println("foo1"); - this.ipw1.undent(); - this.ipw1.println("foo0"); - - assertEquals("bogus output", expected, this.sw1.toString()); - } - - public void testPrintSpaces() { - String expected = "foo0" + CR + " foo1" + CR + " foo1" + CR + " foo2" + CR + " foo1" + CR + " foo1" + CR + "foo0" + CR; - - this.ipw2.println("foo0"); - this.ipw2.indent(); - this.ipw2.println("foo1"); - this.ipw2.println("foo1"); - this.ipw2.indent(); - this.ipw2.println("foo2"); - this.ipw2.undent(); - this.ipw2.println("foo1"); - this.ipw2.println("foo1"); - this.ipw2.undent(); - this.ipw2.println("foo0"); - - assertEquals("bogus output", expected, this.sw2.toString()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/JDBCTypeTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/JDBCTypeTests.java deleted file mode 100644 index 7853463449..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/JDBCTypeTests.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.sql.Types; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.JDBCType; - -@SuppressWarnings("nls") -public class JDBCTypeTests extends TestCase { - - public JDBCTypeTests(String name) { - super(name); - } - - public void testTypesSize() { - assertEquals(Types.class.getDeclaredFields().length, JDBCType.types().length); - } - - public void testName() { - JDBCType jdbcType; - jdbcType = JDBCType.type(Types.VARCHAR); - assertEquals("VARCHAR", jdbcType.name()); - - jdbcType = JDBCType.type(Types.INTEGER); - assertEquals("INTEGER", jdbcType.name()); - } - - public void testCode() { - JDBCType jdbcType; - jdbcType = JDBCType.type(Types.VARCHAR); - assertEquals(Types.VARCHAR, jdbcType.code()); - - jdbcType = JDBCType.type(Types.INTEGER); - assertEquals(Types.INTEGER, jdbcType.code()); - } - - public void testInvalidTypeCode() throws Exception { - boolean exCaught = false; - try { - JDBCType jdbcType = JDBCType.type(55); - fail("invalid JDBCType: " + jdbcType); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testInvalidTypeName() throws Exception { - boolean exCaught = false; - try { - JDBCType jdbcType = JDBCType.type("VARCHAR2"); - fail("invalid JDBCType: " + jdbcType); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/JavaTypeTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/JavaTypeTests.java deleted file mode 100644 index da07a02a38..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/JavaTypeTests.java +++ /dev/null @@ -1,252 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.JavaType; -import org.eclipse.jpt.common.utility.internal.SimpleJavaType; - -@SuppressWarnings("nls") -public class JavaTypeTests extends TestCase { - - public JavaTypeTests(String name) { - super(name); - } - - public void testInvalidElementTypeNull() throws Exception { - boolean exCaught = false; - try { - JavaType javaType = new SimpleJavaType(null, 0); - fail("invalid JavaType: " + javaType); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testInvalidElementTypeEmpty() throws Exception { - boolean exCaught = false; - try { - JavaType javaType = new SimpleJavaType("", 0); - fail("invalid JavaType: " + javaType); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testInvalidElementTypeArray() throws Exception { - boolean exCaught = false; - try { - JavaType javaType = new SimpleJavaType(java.lang.Object[].class.getName(), 0); - fail("invalid JavaType: " + javaType); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testInvalidArrayDepthNegative() throws Exception { - boolean exCaught = false; - try { - JavaType javaType = new SimpleJavaType(java.lang.Object.class.getName(), -2); - fail("invalid JavaType: " + javaType); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testInvalidVoidArray() throws Exception { - boolean exCaught = false; - try { - JavaType javaType = new SimpleJavaType(void.class.getName(), 2); - fail("invalid JavaType: " + javaType); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testElementTypeName() throws Exception { - JavaType javaType; - javaType = new SimpleJavaType(java.lang.Object.class); - assertEquals("java.lang.Object", javaType.getElementTypeName()); - - javaType = new SimpleJavaType(java.lang.Object[].class); - assertEquals("java.lang.Object", javaType.getElementTypeName()); - - javaType = new SimpleJavaType(int.class); - assertEquals("int", javaType.getElementTypeName()); - - javaType = new SimpleJavaType(int[].class); - assertEquals("int", javaType.getElementTypeName()); - - javaType = new SimpleJavaType(void.class); - assertEquals("void", javaType.getElementTypeName()); - - javaType = new SimpleJavaType(java.util.Map.Entry.class); - assertEquals("java.util.Map$Entry", javaType.getElementTypeName()); - - javaType = new SimpleJavaType(java.util.Map.Entry[][].class); - assertEquals("java.util.Map$Entry", javaType.getElementTypeName()); - } - - public void testArrayDepth() throws Exception { - JavaType javaType; - javaType = new SimpleJavaType(java.lang.Object.class); - assertEquals(0, javaType.getArrayDepth()); - - javaType = new SimpleJavaType(java.lang.Object[].class); - assertEquals(1, javaType.getArrayDepth()); - - javaType = new SimpleJavaType(int.class); - assertEquals(0, javaType.getArrayDepth()); - - javaType = new SimpleJavaType(int[].class); - assertEquals(1, javaType.getArrayDepth()); - - javaType = new SimpleJavaType(void.class); - assertEquals(0, javaType.getArrayDepth()); - - javaType = new SimpleJavaType(java.util.Map.Entry.class); - assertEquals(0, javaType.getArrayDepth()); - - javaType = new SimpleJavaType(java.util.Map.Entry[][].class); - assertEquals(2, javaType.getArrayDepth()); - } - - public void testIsArray() throws Exception { - JavaType javaType; - javaType = new SimpleJavaType(java.lang.Object.class); - assertFalse(javaType.isArray()); - - javaType = new SimpleJavaType(java.lang.Object[].class); - assertTrue(javaType.isArray()); - - javaType = new SimpleJavaType(int.class); - assertFalse(javaType.isArray()); - - javaType = new SimpleJavaType(int[].class); - assertTrue(javaType.isArray()); - - javaType = new SimpleJavaType(void.class); - assertFalse(javaType.isArray()); - - javaType = new SimpleJavaType(java.util.Map.Entry.class); - assertFalse(javaType.isArray()); - - javaType = new SimpleJavaType(java.util.Map.Entry[][].class); - assertTrue(javaType.isArray()); - } - - public void testJavaClass() throws Exception { - this.verifyJavaClass(java.lang.Object.class); - this.verifyJavaClass(java.lang.Object[].class); - this.verifyJavaClass(int.class); - this.verifyJavaClass(int[].class); - this.verifyJavaClass(void.class); - this.verifyJavaClass(java.util.Map.Entry.class); - this.verifyJavaClass(java.util.Map.Entry[][].class); - } - - private void verifyJavaClass(Class javaClass) throws Exception { - JavaType javaType = new SimpleJavaType(javaClass); - assertEquals(javaClass, javaType.getJavaClass()); - } - - public void testJavaClassName() throws Exception { - JavaType javaType; - javaType = new SimpleJavaType(java.lang.Object.class); - assertEquals("java.lang.Object", javaType.getJavaClassName()); - - javaType = new SimpleJavaType(java.lang.Object[].class); - assertEquals("[Ljava.lang.Object;", javaType.getJavaClassName()); - - javaType = new SimpleJavaType(int.class); - assertEquals("int", javaType.getJavaClassName()); - - javaType = new SimpleJavaType(int[].class); - assertEquals("[I", javaType.getJavaClassName()); - - javaType = new SimpleJavaType(void.class); - assertEquals("void", javaType.getJavaClassName()); - - javaType = new SimpleJavaType(java.util.Map.Entry.class); - assertEquals("java.util.Map$Entry", javaType.getJavaClassName()); - - javaType = new SimpleJavaType(java.util.Map.Entry[][].class); - assertEquals("[[Ljava.util.Map$Entry;", javaType.getJavaClassName()); - } - - public void testDescribes() throws Exception { - this.verifyDescribes(java.lang.Object.class); - this.verifyDescribes(java.lang.Object[].class); - this.verifyDescribes(int.class); - this.verifyDescribes(int[].class); - this.verifyDescribes(void.class); - this.verifyDescribes(java.util.Map.Entry.class); - this.verifyDescribes(java.util.Map.Entry[][].class); - } - - private void verifyDescribes(Class javaClass) throws Exception { - JavaType javaType = new SimpleJavaType(javaClass); - assertTrue(javaType.describes(javaClass)); - } - - public void testDeclaration() throws Exception { - JavaType javaType; - javaType = new SimpleJavaType(java.lang.Object.class); - assertEquals("java.lang.Object", javaType.declaration()); - - javaType = new SimpleJavaType(java.lang.Object[].class); - assertEquals("java.lang.Object[]", javaType.declaration()); - - javaType = new SimpleJavaType(int.class); - assertEquals("int", javaType.declaration()); - - javaType = new SimpleJavaType(int[].class); - assertEquals("int[]", javaType.declaration()); - - javaType = new SimpleJavaType(void.class); - assertEquals("void", javaType.declaration()); - - javaType = new SimpleJavaType(java.util.Map.Entry.class); - assertEquals("java.util.Map.Entry", javaType.declaration()); - - javaType = new SimpleJavaType(java.util.Map.Entry[][].class); - assertEquals("java.util.Map.Entry[][]", javaType.declaration()); - } - - public void testIsPrimitive() throws Exception { - JavaType javaType; - javaType = new SimpleJavaType(java.lang.Object.class); - assertFalse(javaType.isPrimitive()); - - javaType = new SimpleJavaType(java.lang.Object[].class); - assertFalse(javaType.isPrimitive()); - - javaType = new SimpleJavaType(int.class); - assertTrue(javaType.isPrimitive()); - - javaType = new SimpleJavaType(int[].class); - assertFalse(javaType.isPrimitive()); - - javaType = new SimpleJavaType(void.class); - assertTrue(javaType.isPrimitive()); - - javaType = new SimpleJavaType(java.util.Map.Entry.class); - assertFalse(javaType.isPrimitive()); - - javaType = new SimpleJavaType(java.util.Map.Entry[][].class); - assertFalse(javaType.isPrimitive()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/JptCommonUtilityTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/JptCommonUtilityTests.java deleted file mode 100644 index 10b181ba15..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/JptCommonUtilityTests.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.Test; -import junit.framework.TestSuite; -import org.eclipse.jpt.common.utility.tests.internal.enumerations.JptUtilityEnumerationsTests; -import org.eclipse.jpt.common.utility.tests.internal.iterables.JptUtilityIterablesTests; -import org.eclipse.jpt.common.utility.tests.internal.iterators.JptUtilityIteratorsTests; -import org.eclipse.jpt.common.utility.tests.internal.model.JptUtilityModelTests; -import org.eclipse.jpt.common.utility.tests.internal.node.JptUtilityNodeTests; -import org.eclipse.jpt.common.utility.tests.internal.synchronizers.JptUtilitySynchronizersTests; - -/** - * decentralize test creation code - */ -public class JptCommonUtilityTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptCommonUtilityTests.class.getPackage().getName()); - - suite.addTest(JptUtilityEnumerationsTests.suite()); - suite.addTest(JptUtilityIterablesTests.suite()); - suite.addTest(JptUtilityIteratorsTests.suite()); - suite.addTest(JptUtilityModelTests.suite()); - suite.addTest(JptUtilityNodeTests.suite()); - suite.addTest(JptUtilitySynchronizersTests.suite()); - - suite.addTestSuite(ArrayToolsTests.class); - suite.addTestSuite(AsynchronousCommandExecutorTests.class); - suite.addTestSuite(BagTests.class); - suite.addTestSuite(BidiFilterTests.class); - suite.addTestSuite(BidiStringConverterTests.class); - suite.addTestSuite(BidiTransformerTests.class); - suite.addTestSuite(BitToolsTests.class); - suite.addTestSuite(SimpleBooleanReferenceTests.class); - suite.addTestSuite(BooleanToolsTests.class); - suite.addTestSuite(ClasspathTests.class); - suite.addTestSuite(ClassNameTests.class); - suite.addTestSuite(CollectionToolsTests.class); - suite.addTestSuite(CommandExecutorTests.class); - suite.addTestSuite(CommandRunnableTests.class); - suite.addTestSuite(CommandTests.class); - suite.addTestSuite(CompositeCommandTests.class); - suite.addTestSuite(ExceptionHandlerTests.class); - suite.addTestSuite(FileToolsTests.class); - suite.addTestSuite(FilterTests.class); - suite.addTestSuite(HashBagTests.class); - suite.addTestSuite(IdentityHashBagTests.class); - suite.addTestSuite(IndentingPrintWriterTests.class); - suite.addTestSuite(SimpleIntReferenceTests.class); - suite.addTestSuite(JavaTypeTests.class); - suite.addTestSuite(JDBCTypeTests.class); - suite.addTestSuite(KeyedSetTests.class); - suite.addTestSuite(ListenerListTests.class); - suite.addTestSuite(MethodSignatureTests.class); - suite.addTestSuite(NameToolsTests.class); - suite.addTestSuite(NotNullFilterTests.class); - suite.addTestSuite(RangeTests.class); - suite.addTestSuite(ReflectionToolsTests.class); - suite.addTestSuite(ReverseComparatorTests.class); - suite.addTestSuite(SimpleAssociationTests.class); - suite.addTestSuite(SimpleObjectReferenceTests.class); - suite.addTestSuite(SimpleQueueTests.class); - suite.addTestSuite(SimpleStackTests.class); - suite.addTestSuite(StringToolsTests.class); - suite.addTestSuite(SynchronizedBooleanTests.class); - suite.addTestSuite(SynchronizedIntTests.class); - suite.addTestSuite(SynchronizedObjectTests.class); - suite.addTestSuite(SynchronizedQueueTests.class); - suite.addTestSuite(SynchronizedStackTests.class); - suite.addTestSuite(ToolsTests.class); - suite.addTestSuite(XMLStringEncoderTests.class); - - return suite; - } - - private JptCommonUtilityTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/KeyedSetTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/KeyedSetTests.java deleted file mode 100644 index ac134669eb..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/KeyedSetTests.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.KeyedSet; - -public class KeyedSetTests - extends TestCase { - - private KeyedSet nicknames; - - - public KeyedSetTests(String name) { - super(name); - } - - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.nicknames = this.buildNicknames(); - } - - private KeyedSet buildNicknames() { - KeyedSet ks = new KeyedSet(); - ks.addItem("Jimmy", "James Sullivan"); - ks.addKey("Sully", "James Sullivan"); - ks.addItem("Bob", "Robert McKenna"); - ks.addKey("Mac", "Robert McKenna"); - return ks; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testAddItem() { - // items added in setup - assertTrue(this.nicknames.containsItem("James Sullivan")); - assertTrue(this.nicknames.containsItem("Robert McKenna")); - - assertFalse(this.nicknames.containsItem("John Teasdale")); - this.nicknames.addItem("Jack", "John Teasdale"); - assertTrue(this.nicknames.containsItem("John Teasdale")); - - this.nicknames.addItem("Teaser", "John Teasdale"); - assertTrue(this.nicknames.containsItem("John Teasdale")); - assertTrue(this.nicknames.containsKey("Teaser")); - } - - public void testAddKey() { - // items added in setup - assertTrue(this.nicknames.containsKey("Jimmy")); - assertTrue(this.nicknames.containsKey("Sully")); - assertTrue(this.nicknames.containsKey("Bob")); - assertTrue(this.nicknames.containsKey("Mac")); - - assertFalse(this.nicknames.containsKey("Robbie")); - this.nicknames.addKey("Robbie", "Robert McKenna"); - assertTrue(this.nicknames.containsKey("Robbie")); - - boolean exceptionCaught = false; - try { - this.nicknames.addKey("Teaser", "John Teasdale"); - } - catch (IllegalArgumentException iae) { - exceptionCaught = true; - } - assertTrue(exceptionCaught); - } - - public void testGetItem() { - // items added in setup - assertEquals(this.nicknames.getItem("Jimmy"), "James Sullivan"); - assertEquals(this.nicknames.getItem("Sully"), "James Sullivan"); - assertEquals(this.nicknames.getItem("Bob"), "Robert McKenna"); - assertEquals(this.nicknames.getItem("Mac"), "Robert McKenna"); - assertNull(this.nicknames.getItem("Jack")); - } - - public void testRemoveItem() { - // items added in setup - assertTrue(this.nicknames.containsItem("James Sullivan")); - assertTrue(this.nicknames.containsKey("Jimmy")); - assertTrue(this.nicknames.containsKey("Sully")); - - assertTrue(this.nicknames.removeItem("James Sullivan")); - assertFalse(this.nicknames.containsItem("James Sullivan")); - assertFalse(this.nicknames.containsKey("Jimmy")); - assertFalse(this.nicknames.containsKey("Sully")); - - assertFalse(this.nicknames.removeItem("William Goldberg")); - } - - public void testRemoveKey() { - // items added in setup - assertTrue(this.nicknames.containsItem("James Sullivan")); - assertTrue(this.nicknames.containsKey("Jimmy")); - assertTrue(this.nicknames.containsKey("Sully")); - - assertTrue(this.nicknames.removeKey("Jimmy")); - assertTrue(this.nicknames.containsItem("James Sullivan")); - assertFalse(this.nicknames.containsKey("Jimmy")); - assertTrue(this.nicknames.containsKey("Sully")); - - assertTrue(this.nicknames.removeKey("Sully")); - assertFalse(this.nicknames.containsItem("James Sullivan")); - assertFalse(this.nicknames.containsKey("Jimmy")); - assertFalse(this.nicknames.containsKey("Sully")); - - assertFalse(this.nicknames.removeKey("Billy")); - } -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ListenerListTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ListenerListTests.java deleted file mode 100644 index 7dd0f52e9f..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ListenerListTests.java +++ /dev/null @@ -1,194 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.io.Serializable; -import java.util.EventListener; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.ListenerList; -import org.eclipse.jpt.common.utility.internal.Tools; - -@SuppressWarnings("nls") -public class ListenerListTests extends TestCase { - - public ListenerListTests(String name) { - super(name); - } - - public void testGetListeners() throws Exception { - ListenerList listenerList = new ListenerList(Listener.class); - Listener listener1 = new LocalListener(); - Listener listener2 = new LocalListener(); - Iterable listeners = listenerList.getListeners(); - assertEquals(0, CollectionTools.size(listeners)); - - listenerList.add(listener1); - listenerList.add(listener2); - listeners = listenerList.getListeners(); - assertEquals(2, CollectionTools.size(listeners)); - assertTrue(CollectionTools.contains(listeners, listener1)); - assertTrue(CollectionTools.contains(listeners, listener2)); - } - - public void testSize() throws Exception { - ListenerList listenerList = new ListenerList(Listener.class); - Listener listener1 = new LocalListener(); - Listener listener2 = new LocalListener(); - assertEquals(0, listenerList.size()); - - listenerList.add(listener1); - listenerList.add(listener2); - assertEquals(2, listenerList.size()); - } - - public void testIsEmpty() throws Exception { - ListenerList listenerList = new ListenerList(Listener.class); - Listener listener1 = new LocalListener(); - Listener listener2 = new LocalListener(); - assertTrue(listenerList.isEmpty()); - - listenerList.add(listener1); - listenerList.add(listener2); - assertFalse(listenerList.isEmpty()); - } - - public void testAdd_null() throws Exception { - ListenerList listenerList = new ListenerList(Listener.class); - boolean exCaught = false; - try { - listenerList.add(null); - fail("invalid listener list: " + listenerList); - } catch (NullPointerException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testAdd_duplicate() throws Exception { - ListenerList listenerList = new ListenerList(Listener.class); - Listener listener = new LocalListener(); - listenerList.add(listener); - - boolean exCaught = false; - try { - listenerList.add(listener); - fail("invalid listener list: " + listenerList); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testRemove() throws Exception { - ListenerList listenerList = new ListenerList(Listener.class); - Listener listener1 = new LocalListener(); - Listener listener2 = new LocalListener(); - listenerList.add(listener1); - listenerList.add(listener2); - assertTrue(CollectionTools.contains(listenerList.getListeners(), listener1)); - assertTrue(CollectionTools.contains(listenerList.getListeners(), listener2)); - - listenerList.remove(listener1); - assertFalse(CollectionTools.contains(listenerList.getListeners(), listener1)); - assertTrue(CollectionTools.contains(listenerList.getListeners(), listener2)); - - listenerList.remove(listener2); - assertFalse(CollectionTools.contains(listenerList.getListeners(), listener2)); - } - - public void testRemove_null() throws Exception { - ListenerList listenerList = new ListenerList(Listener.class); - boolean exCaught = false; - try { - listenerList.remove(null); - fail("invalid listener list: " + listenerList); - } catch (NullPointerException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testRemove_unregistered() throws Exception { - ListenerList listenerList = new ListenerList(Listener.class); - Listener listener = new LocalListener(); - listenerList.add(listener); - listenerList.remove(listener); - - boolean exCaught = false; - try { - listenerList.remove(listener); - fail("invalid listener list: " + listenerList); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testClear() throws Exception { - ListenerList listenerList = new ListenerList(Listener.class); - Listener listener1 = new LocalListener(); - Listener listener2 = new LocalListener(); - listenerList.add(listener1); - listenerList.add(listener2); - assertTrue(CollectionTools.contains(listenerList.getListeners(), listener1)); - assertTrue(CollectionTools.contains(listenerList.getListeners(), listener2)); - - listenerList.clear(); - assertFalse(CollectionTools.contains(listenerList.getListeners(), listener1)); - assertFalse(CollectionTools.contains(listenerList.getListeners(), listener2)); - } - - public void testSerialization() throws Exception { - // This test doesn't pass in the Eclipse build environment (Linux/IBM VM) for some reason - if (Tools.jvmIsSun()) { - this.verifySerialization(); - } - } - - private void verifySerialization() throws Exception { - ListenerList listenerList = new ListenerList(Listener.class); - Listener listener1 = new LocalListener(); - Listener listener2 = new LocalListener(); - listenerList.add(listener1); - listenerList.add(listener2); - - ListenerList listenerList2 = TestTools.serialize(listenerList); - assertNotSame(listenerList, listenerList2); - assertEquals(2, listenerList2.size()); - - Listener listener3 = new NonSerializableListener(); - listenerList.add(listener3); - - listenerList2 = TestTools.serialize(listenerList); - assertNotSame(listenerList, listenerList2); - assertEquals(2, listenerList2.size()); - - } - - interface Listener extends EventListener { - void somethingHappened(); - } - - static class LocalListener implements Listener, Serializable { - public void somethingHappened() { - // do nothing - } - } - - static class NonSerializableListener implements Listener { - public void somethingHappened() { - // do nothing - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/MethodSignatureTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/MethodSignatureTests.java deleted file mode 100644 index 6558e2f45f..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/MethodSignatureTests.java +++ /dev/null @@ -1,208 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.lang.reflect.Method; -import java.util.Arrays; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.JavaType; -import org.eclipse.jpt.common.utility.MethodSignature; -import org.eclipse.jpt.common.utility.internal.SimpleJavaType; -import org.eclipse.jpt.common.utility.internal.SimpleMethodSignature; - -@SuppressWarnings("nls") -public class MethodSignatureTests extends TestCase { - - public MethodSignatureTests(String name) { - super(name); - } - - public void testInvalidNameNull() throws Exception { - boolean exCaught = false; - try { - MethodSignature methodSignature = new SimpleMethodSignature((String) null); - fail("invalid MethodSignature: " + methodSignature); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testInvalidNameEmpty() throws Exception { - boolean exCaught = false; - try { - MethodSignature methodSignature = new SimpleMethodSignature(""); - fail("invalid MethodSignature: " + methodSignature); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testInvalidParameterTypesNull() throws Exception { - boolean exCaught = false; - try { - MethodSignature methodSignature = new SimpleMethodSignature("foo", (JavaType[]) null); - fail("invalid MethodSignature: " + methodSignature); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testInvalidParameterTypesNullItem() throws Exception { - boolean exCaught = false; - try { - MethodSignature methodSignature = new SimpleMethodSignature("foo", new JavaType[1]); - fail("invalid MethodSignature: " + methodSignature); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testInvalidParameterTypesVoidItem() throws Exception { - JavaType jt = new SimpleJavaType(void.class.getName()); - boolean exCaught = false; - try { - MethodSignature methodSignature = new SimpleMethodSignature("foo", new JavaType[] {jt}); - fail("invalid MethodSignature: " + methodSignature); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testInvalidParameterTypeNamesNull() throws Exception { - boolean exCaught = false; - try { - MethodSignature methodSignature = new SimpleMethodSignature("foo", (String[]) null); - fail("invalid MethodSignature: " + methodSignature); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testInvalidParameterTypeNamesNullItem() throws Exception { - boolean exCaught = false; - try { - MethodSignature methodSignature = new SimpleMethodSignature("foo", new String[1]); - fail("invalid MethodSignature: " + methodSignature); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testInvalidParameterJavaClassesNull() throws Exception { - boolean exCaught = false; - try { - MethodSignature methodSignature = new SimpleMethodSignature("foo", (Class[]) null); - fail("invalid MethodSignature: " + methodSignature); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testInvalidParameterJavaClassesNullItem() throws Exception { - boolean exCaught = false; - try { - MethodSignature methodSignature = new SimpleMethodSignature("foo", new Class[1]); - fail("invalid MethodSignature: " + methodSignature); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testGetSignature0() throws Exception { - MethodSignature ms = new SimpleMethodSignature(this.getMethod("method0")); - assertEquals("method0()", ms.getSignature()); - } - - public void testGetSignature1() throws Exception { - MethodSignature ms = new SimpleMethodSignature(this.getMethod("method1")); - assertEquals("method1(int)", ms.getSignature()); - } - - public void testGetSignature2() throws Exception { - MethodSignature ms = new SimpleMethodSignature(this.getMethod("method2")); - assertEquals("method2(int, java.lang.String)", ms.getSignature()); - } - - public void testGetSignature3() throws Exception { - MethodSignature ms = new SimpleMethodSignature(this.getMethod("method3")); - assertEquals("method3(int, java.lang.String, java.lang.Object[][])", ms.getSignature()); - } - - public void testGetName() throws Exception { - MethodSignature ms = new SimpleMethodSignature(this.getMethod("method2")); - assertEquals("method2", ms.getName()); - } - - public void testGetParameterTypes() throws Exception { - MethodSignature ms = new SimpleMethodSignature(this.getMethod("method3")); - JavaType[] expected = new JavaType[3]; - expected[0] = new SimpleJavaType("int"); - expected[1] = new SimpleJavaType("java.lang.String"); - expected[2] = new SimpleJavaType("java.lang.Object", 2); - assertTrue(Arrays.equals(expected, ms.getParameterTypes())); - } - - public void testEquals() throws Exception { - Object ms1 = new SimpleMethodSignature(this.getMethod("method3")); - Object ms2 = new SimpleMethodSignature(this.getMethod("method3")); - assertNotSame(ms1, ms2); - assertEquals(ms1, ms1); - assertEquals(ms1, ms2); - assertEquals(ms1.hashCode(), ms2.hashCode()); - - Object ms3 = new SimpleMethodSignature(this.getMethod("method2")); - assertNotSame(ms1, ms3); - assertFalse(ms1.equals(ms3)); - } - - public void testClone() throws Exception { - SimpleMethodSignature ms1 = new SimpleMethodSignature(this.getMethod("method3")); - SimpleMethodSignature ms2 = (SimpleMethodSignature) ms1.clone(); - assertNotSame(ms1, ms2); - assertEquals(ms1, ms2); - } - - public void testSerialization() throws Exception { - SimpleMethodSignature ms1 = new SimpleMethodSignature(this.getMethod("method3")); - SimpleMethodSignature ms2 = TestTools.serialize(ms1); - assertNotSame(ms1, ms2); - assertEquals(ms1, ms2); - } - - private Method getMethod(String methodName) { - for (Method method : this.getClass().getMethods()) { - if (method.getName().equals(methodName)) { - return method; - } - } - throw new IllegalArgumentException("method not found: " + methodName); - } - - public void method0() { /* used by tests */ } - @SuppressWarnings("unused") public void method1(int foo) { /* used by tests */ } - @SuppressWarnings("unused") public void method2(int foo, String bar) { /* used by tests */ } - @SuppressWarnings("unused") public void method3(int foo, String bar, Object[][] baz) { /* used by tests */ } - - @SuppressWarnings("unused") public void methodA(int foo, String bar) { /* used by tests */ } - @SuppressWarnings("unused") public void methodA(int foo, String bar, String baz) { /* used by tests */ } - - @SuppressWarnings("unused") public void methodB(int foo, Object bar) { /* used by tests */ } - @SuppressWarnings("unused") public void methodB(int foo, String bar) { /* used by tests */ } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/MultiThreadedTestCase.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/MultiThreadedTestCase.java deleted file mode 100644 index 10ac313cc0..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/MultiThreadedTestCase.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.util.ArrayList; -import java.util.Vector; -import java.util.concurrent.ThreadFactory; - -import org.eclipse.jpt.common.utility.internal.CompositeException; - -import junit.framework.TestCase; - -/** - * This test case helps simplify the testing of multi-threaded code. - */ -@SuppressWarnings("nls") -public abstract class MultiThreadedTestCase - extends TestCase -{ - private final ArrayList threads = new ArrayList(); - /* private */ final Vector exceptions = new Vector(); - - /** - * The default "tick" is one second. - * Specify the appropriate system property to override. - */ - public static final String TICK_SYSTEM_PROPERTY_NAME = "org.eclipse.jpt.common.utility.tests.tick"; - public static final long TICK = Long.getLong(TICK_SYSTEM_PROPERTY_NAME, 1000).longValue(); - public static final long TWO_TICKS = 2 * TICK; - public static final long THREE_TICKS = 3 * TICK; - - /** - * Default constructor. - */ - public MultiThreadedTestCase() { - super(); - } - - /** - * Named constructor. - */ - public MultiThreadedTestCase(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - } - - /** - * Stop all the threads constructed during the test case. - * If any exceptions were thrown by the threads, re-throw them here. - */ - @Override - protected void tearDown() throws Exception { - for (Thread thread : this.threads) { - if (thread.isAlive()) { - throw new IllegalStateException("thread is still alive: " + thread); - } - } - if ( ! this.exceptions.isEmpty()) { - throw new CompositeException(this.exceptions); - } - TestTools.clear(this); - super.tearDown(); - } - - protected Thread buildThread(Runnable runnable) { - return this.buildThread(runnable, null); - } - - protected Thread buildThread(Runnable runnable, String name) { - Thread thread = new Thread(new RunnableWrapper(runnable)); - if (name != null) { - thread.setName(name); - } - this.threads.add(thread); - return thread; - } - - protected ThreadFactory buildThreadFactory() { - return new TestThreadFactory(); - } - - /** - * Convenience method that handles {@link InterruptedException}. - */ - public void sleep(long millis) { - TestTools.sleep(millis); - } - - - /** - * Wrap a runnable and log any exception it throws. - */ - public class TestThreadFactory implements ThreadFactory { - public Thread newThread(Runnable r) { - return MultiThreadedTestCase.this.buildThread(r); - } - } - - /** - * Simplify runnables that execute call that throws checked exceptions. - */ - public abstract class TestRunnable implements Runnable { - public final void run() { - try { - this.run_(); - } catch (Throwable ex) { - throw new RuntimeException(ex); - } - } - protected abstract void run_() throws Throwable; - } - - /** - * Wrap a runnable and log any exception it throws. - */ - private class RunnableWrapper implements Runnable { - private final Runnable runnable; - RunnableWrapper(Runnable runnable) { - super(); - this.runnable = runnable; - } - public void run() { - try { - this.runnable.run(); - } catch (Throwable ex) { - MultiThreadedTestCase.this.exceptions.add(ex); - } - } - } -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/NameToolsTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/NameToolsTests.java deleted file mode 100644 index d486aab6b7..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/NameToolsTests.java +++ /dev/null @@ -1,226 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.NameTools; - -@SuppressWarnings("nls") -public class NameToolsTests extends TestCase { - - public NameToolsTests(String name) { - super(name); - } - - public void testStringAbsentIgnoreCase() { - List colorCollection = this.buildColorCollection(); - String returned = NameTools.uniqueNameForIgnoreCase("Taupe", colorCollection); - assertEquals("Taupe", returned); - } - - public void testStringPresentCaseDiffers() { - List colorCollection = this.buildColorCollection(); - String returned = NameTools.uniqueNameFor("green", colorCollection); - assertEquals("green", returned); - } - - public void testStringPresentIgnoreCase() { - List colorCollection = this.buildColorCollection(); - String returned = NameTools.uniqueNameForIgnoreCase("green", colorCollection); - assertEquals("green2", returned); - } - - public void testStringPresentWithAppendices() { - List colorCollection = this.buildColorCollection(); - colorCollection.add("Red1"); - colorCollection.add("red2"); - String returned = NameTools.uniqueNameForIgnoreCase("red", colorCollection); - colorCollection.remove("Red1"); - colorCollection.remove("red2"); - assertEquals("red3", returned); - } - - private List buildColorCollection() { - List colorCollection = new ArrayList(); - colorCollection.add("Red"); - colorCollection.add("Orange"); - colorCollection.add("Yellow"); - colorCollection.add("Green"); - colorCollection.add("Blue"); - colorCollection.add("Indigo"); - colorCollection.add("Violet"); - return colorCollection; - } - - public void testUniqueNameForCollection1() { - Collection strings = new ArrayList(); - strings.add("Oracle"); - strings.add("Oracle Corporation"); - strings.add("Oracle2"); - strings.add("oracle1"); - strings.add("Oracl"); - - assertEquals("Oracle3", NameTools.uniqueNameFor("Oracle", strings)); - assertEquals("Test", NameTools.uniqueNameFor("Test", strings)); - - assertEquals("Oracle3", NameTools.uniqueNameForIgnoreCase("Oracle", strings)); - assertEquals("oracle3", NameTools.uniqueNameForIgnoreCase("oracle", strings)); - assertEquals("Test", NameTools.uniqueNameForIgnoreCase("Test", strings)); - } - - public void testUniqueNameForCollection2() { - Collection strings = new ArrayList(); - strings.add("Oracle"); - strings.add("oracle"); - strings.add("Oracle2"); - strings.add("Oracle1"); - - assertEquals("Oracle3", NameTools.uniqueNameFor("Oracle", strings)); - assertEquals("Test", NameTools.uniqueNameFor("Test", strings)); - - strings.add("Oracle Corporation"); - assertEquals("Oracle3", NameTools.uniqueNameForIgnoreCase("Oracle", strings)); - assertEquals("oracle3", NameTools.uniqueNameForIgnoreCase("oracle", strings)); - assertEquals("Test", NameTools.uniqueNameForIgnoreCase("Test", strings)); - } - - public void testUniqueNameForCollection3() { - Collection strings = new ArrayList(); - strings.add("Oracle"); - strings.add("Oracle"); - strings.add("Oracle2"); - strings.add("Oracle1"); - - assertEquals("Oracle3", NameTools.uniqueNameFor("Oracle", strings)); - } - - public void testUniqueNameForIterator1() { - Collection strings = new ArrayList(); - strings.add("Oracle"); - strings.add("Oracle Corporation"); - strings.add("Oracle2"); - strings.add("oracle1"); - strings.add("Oracl"); - - assertEquals("Oracle3", NameTools.uniqueNameFor("Oracle", strings.iterator())); - assertEquals("Test", NameTools.uniqueNameFor("Test", strings.iterator())); - - assertEquals("Oracle3", NameTools.uniqueNameForIgnoreCase("Oracle", strings.iterator())); - assertEquals("oracle3", NameTools.uniqueNameForIgnoreCase("oracle", strings.iterator())); - assertEquals("Test", NameTools.uniqueNameForIgnoreCase("Test", strings.iterator())); - } - - public void testUniqueNameForIterator2() { - Collection strings = new ArrayList(); - strings.add("Oracle"); - strings.add("oracle"); - strings.add("Oracle2"); - strings.add("Oracle1"); - - assertEquals("Oracle3", NameTools.uniqueNameFor("Oracle", strings.iterator())); - assertEquals("Test", NameTools.uniqueNameFor("Test", strings.iterator())); - - strings.add("Oracle Corporation"); - assertEquals("Oracle3", NameTools.uniqueNameForIgnoreCase("Oracle", strings.iterator())); - assertEquals("oracle3", NameTools.uniqueNameForIgnoreCase("oracle", strings.iterator())); - assertEquals("Test", NameTools.uniqueNameForIgnoreCase("Test", strings.iterator())); - } - - public void testUniqueNameForIterator3() { - Collection strings = new ArrayList(); - strings.add("Oracle"); - strings.add("Oracle"); - strings.add("Oracle2"); - strings.add("Oracle1"); - - assertEquals("Oracle3", NameTools.uniqueNameFor("Oracle", strings.iterator())); - } - - public void testBuildQualifiedDatabaseObjectName() { - assertEquals("catalog.schema.name", NameTools.buildQualifiedDatabaseObjectName("catalog", "schema", "name")); - assertEquals("catalog..name", NameTools.buildQualifiedDatabaseObjectName("catalog", null, "name")); - assertEquals("schema.name", NameTools.buildQualifiedDatabaseObjectName(null, "schema", "name")); - assertEquals("name", NameTools.buildQualifiedDatabaseObjectName(null, null, "name")); - } - - public void testJavaReservedWords() { - assertTrue(CollectionTools.contains(NameTools.javaReservedWords(), "class")); - assertFalse(CollectionTools.contains(NameTools.javaReservedWords(), "Class")); - assertTrue(CollectionTools.contains(NameTools.javaReservedWords(), "private")); - } - - public void testconvertToJavaIdentifierString() { - assertEquals("foo", NameTools.convertToJavaIdentifier("foo")); - assertEquals("foo1", NameTools.convertToJavaIdentifier("foo1")); - assertEquals("private_", NameTools.convertToJavaIdentifier("private")); - assertEquals("throw_", NameTools.convertToJavaIdentifier("throw")); - assertEquals("_foo", NameTools.convertToJavaIdentifier("1foo")); - assertEquals("foo_", NameTools.convertToJavaIdentifier("foo%")); - assertEquals("foo__bar__", NameTools.convertToJavaIdentifier("foo bar ")); - } - - public void testconvertToJavaIdentifierStringChar() { - assertEquals("foo", NameTools.convertToJavaIdentifier("foo", '$')); - assertEquals("foo1", NameTools.convertToJavaIdentifier("foo1", '$')); - assertEquals("private$", NameTools.convertToJavaIdentifier("private", '$')); - assertEquals("throwss", NameTools.convertToJavaIdentifier("throw", 's')); - assertEquals("$foo", NameTools.convertToJavaIdentifier("1foo", '$')); - assertEquals("foo$", NameTools.convertToJavaIdentifier("foo%", '$')); - assertEquals("foo$$bar$$", NameTools.convertToJavaIdentifier("foo bar ", '$')); - - boolean exCaught = false; - try { - String s = NameTools.convertToJavaIdentifier("1foo", '7'); - fail("invalid string: \"" + s + "\""); - } catch (IllegalArgumentException ex) { - if (ex.getMessage().indexOf('7') != -1) { - exCaught = true; - } - } - assertTrue(exCaught); - - exCaught = false; - try { - String s = NameTools.convertToJavaIdentifier("foo%", '^'); - fail("invalid string: \"" + s + "\""); - } catch (IllegalArgumentException ex) { - if (ex.getMessage().indexOf('^') != -1) { - exCaught = true; - } - } - assertTrue(exCaught); - - exCaught = false; - try { - String s = NameTools.convertToJavaIdentifier("private", '^'); - fail("invalid string: \"" + s + "\""); - } catch (IllegalArgumentException ex) { - if (ex.getMessage().indexOf('^') != -1) { - exCaught = true; - } - } - assertTrue(exCaught); - - } - - public void testStringIsLegalJavaIdentifier() { - assertFalse(NameTools.stringIsLegalJavaIdentifier("class")); - assertTrue(NameTools.stringIsLegalJavaIdentifier("clasS")); - - assertFalse(NameTools.stringIsLegalJavaIdentifier("7foo")); - assertFalse(NameTools.stringIsLegalJavaIdentifier("foo@bar")); - assertTrue(NameTools.stringIsLegalJavaIdentifier("_foo")); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/NotNullFilterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/NotNullFilterTests.java deleted file mode 100644 index caf06708ae..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/NotNullFilterTests.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.NotNullFilter; - -@SuppressWarnings("nls") -public class NotNullFilterTests extends TestCase { - - public NotNullFilterTests(String name) { - super(name); - } - - public void testNotNullFilter() { - Filter filter = NotNullFilter.instance(); - assertTrue(filter.accept("")); - assertFalse(filter.accept(null)); - assertTrue(filter.accept("foo")); - assertTrue(filter.accept("bar")); - } - - public void testToString() { - Filter filter = NotNullFilter.instance(); - assertNotNull(filter.toString()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/RangeTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/RangeTests.java deleted file mode 100644 index dcd959295a..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/RangeTests.java +++ /dev/null @@ -1,74 +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.common.utility.tests.internal; - -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.Range; - -public class RangeTests extends TestCase { - - public RangeTests(String name) { - super(name); - } - - public void testIncludes() { - Range range = new Range(5, 17); - assertFalse(range.includes(-55)); - assertFalse(range.includes(0)); - assertFalse(range.includes(4)); - assertTrue(range.includes(5)); - assertTrue(range.includes(6)); - assertTrue(range.includes(16)); - assertTrue(range.includes(17)); - assertFalse(range.includes(18)); - assertFalse(range.includes(200)); - } - - public void testEquals() { - Range range1 = new Range(5, 17); - Range range2 = new Range(5, 17); - assertNotSame(range1, range2); - assertEquals(range1, range1); - assertEquals(range1, range2); - assertEquals(range2, range1); - assertEquals(range1.hashCode(), range2.hashCode()); - - range2 = new Range(17, 5); - assertFalse(range1.equals(range2)); - assertFalse(range2.equals(range1)); - // although they are unequal, they can have the same hash code - assertEquals(range1.hashCode(), range2.hashCode()); - - range2 = new Range(5, 15); - assertFalse(range1.equals(range2)); - assertFalse(range2.equals(range1)); - } - - public void testClone() { - Range range1 = new Range(5, 17); - Range range2 = range1.clone(); - assertNotSame(range1, range2); - assertEquals(range1, range1); - assertEquals(range1, range2); - assertEquals(range2, range1); - assertEquals(range1.hashCode(), range2.hashCode()); - } - - public void testSerialization() throws Exception { - Range range1 = new Range(5, 17); - Range range2 = TestTools.serialize(range1); - assertNotSame(range1, range2); - assertEquals(range1, range1); - assertEquals(range1, range2); - assertEquals(range2, range1); - assertEquals(range1.hashCode(), range2.hashCode()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ReflectionToolsTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ReflectionToolsTests.java deleted file mode 100644 index d210cb0f5f..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ReflectionToolsTests.java +++ /dev/null @@ -1,440 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.lang.reflect.Field; -import java.lang.reflect.Method; -import java.util.Vector; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; - -@SuppressWarnings("nls") -public class ReflectionToolsTests extends TestCase { - - private static String testStaticField; - - public ReflectionToolsTests(String name) { - super(name); - } - -// this is no longer true - it appears the JLS now defines the generated names... -// /** -// * Return the compiler-generated class name. The Eclipse compiler generates -// * "local" classes with names in the form "com.foo.Outer$1$Local"; while the -// * JDK compiler generates "com.foo.Outer$1Local". There might be other -// * differences.... ~bjv -// */ -// public static String compilerDependentClassNameFor(String className) { -// int index = className.indexOf("$1$"); -// if (index == -1) { -// return className; -// } -// try { -// Class.forName(className); -// } catch (ClassNotFoundException ex) { -// return className.substring(0, index + 2) + className.substring(index + 3); -// } -// return className; -// } -// -// private static String munge(String className) { -// return compilerDependentClassNameFor(className); -// } - - public void testAllFields() { - int fieldCount = 0; - fieldCount += java.util.Vector.class.getDeclaredFields().length; - fieldCount += java.util.AbstractList.class.getDeclaredFields().length; - fieldCount += java.util.AbstractCollection.class.getDeclaredFields().length; - fieldCount += java.lang.Object.class.getDeclaredFields().length; - Iterable fields = ReflectionTools.getAllFields(java.util.Vector.class); - assertEquals(fieldCount, CollectionTools.size(fields)); - assertTrue(CollectionTools.contains(this.fieldNames(fields), "modCount")); - assertTrue(CollectionTools.contains(this.fieldNames(fields), "serialVersionUID")); - assertTrue(CollectionTools.contains(this.fieldNames(fields), "capacityIncrement")); - assertTrue(CollectionTools.contains(this.fieldNames(fields), "elementCount")); - assertTrue(CollectionTools.contains(this.fieldNames(fields), "elementData")); - assertTrue(fields.iterator().next().isAccessible()); - } - - public void testAllMethods() { - int methodCount = 0; - methodCount += java.util.Vector.class.getDeclaredMethods().length; - methodCount += java.util.AbstractList.class.getDeclaredMethods().length; - methodCount += java.util.AbstractCollection.class.getDeclaredMethods().length; - methodCount += java.lang.Object.class.getDeclaredMethods().length; - Iterable methods = ReflectionTools.getAllMethods(java.util.Vector.class); - assertEquals(methodCount, CollectionTools.size(methods)); - assertTrue(CollectionTools.contains(this.methodNames(methods), "wait")); - assertTrue(CollectionTools.contains(this.methodNames(methods), "addElement")); - assertTrue(methods.iterator().next().isAccessible()); - } - - public void testNewInstanceClass() { - Vector v = ReflectionTools.newInstance(java.util.Vector.class); - assertNotNull(v); - assertEquals(0, v.size()); - } - - public void testNewInstanceClassClassObject() { - int initialCapacity = 200; - Vector v = ReflectionTools.newInstance(java.util.Vector.class, int.class, new Integer(initialCapacity)); - assertNotNull(v); - assertEquals(0, v.size()); - Object[] elementData = (Object[]) ReflectionTools.getFieldValue(v, "elementData"); - assertEquals(initialCapacity, elementData.length); - } - - public void testNewInstanceClassClassArrayObjectArray() { - int initialCapacity = 200; - Class[] parmTypes = new Class[1]; - parmTypes[0] = int.class; - Object[] parms = new Object[1]; - parms[0] = new Integer(initialCapacity); - Vector v = ReflectionTools.newInstance(java.util.Vector.class, parmTypes, parms); - assertNotNull(v); - assertEquals(0, v.size()); - Object[] elementData = (Object[]) ReflectionTools.getFieldValue(v, "elementData"); - assertEquals(initialCapacity, elementData.length); - - parms[0] = new Integer(-1); - boolean exCaught = false; - try { - v = ReflectionTools.newInstance(java.util.Vector.class, parmTypes, parms); - } catch (RuntimeException ex) { - exCaught = true; - } - assertTrue("RuntimeException not thrown", exCaught); - - parmTypes[0] = java.lang.String.class; - parms[0] = "foo"; - exCaught = false; - try { - v = ReflectionTools.newInstance(java.util.Vector.class, parmTypes, parms); - } catch (RuntimeException ex) { - if (ex.getCause() instanceof NoSuchMethodException) { - exCaught = true; - } - } - assertTrue("NoSuchMethodException not thrown", exCaught); - } - - public void testFieldValue() { - int initialCapacity = 200; - Vector v = new Vector(initialCapacity); - Object[] elementData = (Object[]) ReflectionTools.getFieldValue(v, "elementData"); - assertEquals(initialCapacity, elementData.length); - - // test inherited field - Integer modCountInteger = (Integer) ReflectionTools.getFieldValue(v, "modCount"); - int modCount = modCountInteger.intValue(); - assertEquals(0, modCount); - - boolean exCaught = false; - Object bogusFieldValue = null; - try { - bogusFieldValue = ReflectionTools.getFieldValue(v, "bogusField"); - } catch (RuntimeException ex) { - if (ex.getCause() instanceof NoSuchFieldException) { - exCaught = true; - } - } - assertTrue("NoSuchFieldException not thrown: " + bogusFieldValue, exCaught); - } - - public void testExecuteMethodObjectString() { - Vector v = new Vector(); - int size = ((Integer) ReflectionTools.executeMethod(v, "size")).intValue(); - assertEquals(0, size); - - v.addElement("foo"); - size = ((Integer) ReflectionTools.executeMethod(v, "size")).intValue(); - assertEquals(1, size); - } - - public void testExecuteMethodObjectStringClassObject() { - Vector v = new Vector(); - boolean booleanResult = ((Boolean) ReflectionTools.executeMethod(v, "add", Object.class, "foo")).booleanValue(); - assertTrue(booleanResult); - assertTrue(v.contains("foo")); - Object voidResult = ReflectionTools.executeMethod(v, "addElement", Object.class, "bar"); - assertNull(voidResult); - } - - public void testExecuteMethodObjectStringClassArrayObjectArray() { - Vector v = new Vector(); - Class[] parmTypes = new Class[1]; - parmTypes[0] = java.lang.Object.class; - Object[] parms = new Object[1]; - parms[0] = "foo"; - boolean booleanResult = ((Boolean) ReflectionTools.executeMethod(v, "add", parmTypes, parms)).booleanValue(); - assertTrue(booleanResult); - assertTrue(v.contains("foo")); - - boolean exCaught = false; - Object bogusMethodReturnValue = null; - try { - bogusMethodReturnValue = ReflectionTools.executeMethod(v, "bogusMethod", parmTypes, parms); - } catch (RuntimeException ex) { - if (ex.getCause() instanceof NoSuchMethodException) { - exCaught = true; - } - } - assertTrue("NoSuchMethodException not thrown: " + bogusMethodReturnValue, exCaught); - } - - public void testExecuteStaticMethodClassString() { - Double randomObject = (Double) ReflectionTools.executeStaticMethod(java.lang.Math.class, "random"); - assertNotNull(randomObject); - double random = randomObject.doubleValue(); - assertTrue(random >= 0); - assertTrue(random < 1); - } - - public void testExecuteStaticMethodClassStringClassObject() { - String s = (String) ReflectionTools.executeStaticMethod(java.lang.String.class, "valueOf", boolean.class, Boolean.TRUE); - assertNotNull(s); - assertEquals("true", s); - } - - public void testExecuteStaticMethodClassStringClassArrayObjectArray() { - Class[] parmTypes = new Class[1]; - parmTypes[0] = boolean.class; - Object[] parms = new Object[1]; - parms[0] = Boolean.TRUE; - String s = (String) ReflectionTools.executeStaticMethod(java.lang.String.class, "valueOf", parmTypes, parms); - assertNotNull(s); - assertEquals("true", s); - - boolean exCaught = false; - Object bogusStaticMethodReturnValue = null; - try { - bogusStaticMethodReturnValue = ReflectionTools.executeStaticMethod(java.lang.String.class, "bogusStaticMethod", parmTypes, parms); - } catch (RuntimeException ex) { - if (ex.getCause() instanceof NoSuchMethodException) { - exCaught = true; - } - } - assertTrue("NoSuchMethodException not thrown: " + bogusStaticMethodReturnValue, exCaught); - - // test non-static method - exCaught = false; - try { - bogusStaticMethodReturnValue = ReflectionTools.executeStaticMethod(java.lang.String.class, "toString"); - } catch (RuntimeException ex) { - if (ex.getCause() instanceof NoSuchMethodException) { - exCaught = true; - } - } - assertTrue("NoSuchMethodException not thrown: " + bogusStaticMethodReturnValue, exCaught); - } - - public void testSetFieldValue() { - Vector v = new Vector(); - Object[] newElementData = new Object[5]; - newElementData[0] = "foo"; - ReflectionTools.setFieldValue(v, "elementData", newElementData); - ReflectionTools.setFieldValue(v, "elementCount", new Integer(1)); - // test inherited field - ReflectionTools.setFieldValue(v, "modCount", new Integer(1)); - assertTrue(v.contains("foo")); - - boolean exCaught = false; - try { - ReflectionTools.setFieldValue(v, "bogusField", "foo"); - } catch (RuntimeException ex) { - if (ex.getCause() instanceof NoSuchFieldException) { - exCaught = true; - } - } - assertTrue("NoSuchFieldException not thrown", exCaught); - } - - public void testSetStaticFieldValue() { - ReflectionTools.setStaticFieldValue(this.getClass(), "testStaticField", "new value"); - assertEquals(testStaticField, "new value"); - - boolean exCaught = false; - try { - ReflectionTools.setStaticFieldValue(this.getClass(), "bogusStaticField", "new value"); - } catch (RuntimeException ex) { - if (ex.getCause() instanceof NoSuchFieldException) { - exCaught = true; - } - } - assertTrue("NoSuchFieldException not thrown", exCaught); - } - - public void testSimpleName() { - assertEquals("Vector", java.util.Vector.class.getSimpleName()); - assertEquals("Entry", java.util.Map.Entry.class.getSimpleName()); - assertEquals("int", int.class.getSimpleName()); - assertEquals("int[]", int[].class.getSimpleName()); - assertEquals("int[][]", int[][].class.getSimpleName()); - assertEquals("void", void.class.getSimpleName()); - } - - public void testPackageName() { - assertEquals("java.util", java.util.Vector.class.getPackage().getName()); - assertEquals("java.util", java.util.Map.Entry.class.getPackage().getName()); - } - - public void testArrayDepthFor() { - assertEquals(0, ReflectionTools.getArrayDepth(java.util.Vector.class)); - assertEquals(0, ReflectionTools.getArrayDepth(int.class)); - assertEquals(0, ReflectionTools.getArrayDepth(void.class)); - assertEquals(1, ReflectionTools.getArrayDepth(java.util.Vector[].class)); - assertEquals(1, ReflectionTools.getArrayDepth(int[].class)); - assertEquals(3, ReflectionTools.getArrayDepth(java.util.Vector[][][].class)); - assertEquals(3, ReflectionTools.getArrayDepth(int[][][].class)); - } - - public void testElementTypeFor() { - assertEquals(java.util.Vector.class, ReflectionTools.getElementType(java.util.Vector.class)); - assertEquals(int.class, ReflectionTools.getElementType(int.class)); - assertEquals(void.class, ReflectionTools.getElementType(void.class)); - assertEquals(java.util.Vector.class, ReflectionTools.getElementType(java.util.Vector[].class)); - assertEquals(int.class, ReflectionTools.getElementType(int[].class)); - assertEquals(java.util.Vector.class, ReflectionTools.getElementType(java.util.Vector[][][].class)); - assertEquals(int.class, ReflectionTools.getElementType(int[][][].class)); - } - - public void testClassIsPrimitiveWrapperClass() { - assertTrue(ReflectionTools.classIsPrimitiveWrapper(java.lang.Void.class)); - assertTrue(ReflectionTools.classIsPrimitiveWrapper(java.lang.Boolean.class)); - assertTrue(ReflectionTools.classIsPrimitiveWrapper(java.lang.Integer.class)); - assertTrue(ReflectionTools.classIsPrimitiveWrapper(java.lang.Float.class)); - - assertFalse(ReflectionTools.classIsPrimitiveWrapper(java.lang.String.class)); - assertFalse(ReflectionTools.classIsPrimitiveWrapper(void.class)); - assertFalse(ReflectionTools.classIsPrimitiveWrapper(int.class)); - } - - public void testClassIsVariablePrimitiveWrapperClass() { - assertFalse(ReflectionTools.classIsVariablePrimitiveWrapper(java.lang.Void.class)); - - assertTrue(ReflectionTools.classIsVariablePrimitiveWrapper(java.lang.Boolean.class)); - assertTrue(ReflectionTools.classIsVariablePrimitiveWrapper(java.lang.Integer.class)); - assertTrue(ReflectionTools.classIsVariablePrimitiveWrapper(java.lang.Float.class)); - - assertFalse(ReflectionTools.classIsVariablePrimitiveWrapper(java.lang.String.class)); - assertFalse(ReflectionTools.classIsVariablePrimitiveWrapper(void.class)); - assertFalse(ReflectionTools.classIsVariablePrimitiveWrapper(int.class)); - } - - public void testWrapperClass() { - assertEquals(java.lang.Void.class, ReflectionTools.getWrapperClass(void.class)); - assertEquals(java.lang.Integer.class, ReflectionTools.getWrapperClass(int.class)); - assertEquals(java.lang.Float.class, ReflectionTools.getWrapperClass(float.class)); - assertEquals(java.lang.Boolean.class, ReflectionTools.getWrapperClass(boolean.class)); - - assertNull(ReflectionTools.getWrapperClass(java.lang.String.class)); - } - - public void testClassForTypeDeclarationStringInt() throws Exception { - assertEquals(int.class, ReflectionTools.getClassForTypeDeclaration("int", 0)); - assertEquals(int[].class, ReflectionTools.getClassForTypeDeclaration("int", 1)); - assertEquals(int[][][].class, ReflectionTools.getClassForTypeDeclaration("int", 3)); - - assertEquals(Object.class, ReflectionTools.getClassForTypeDeclaration("java.lang.Object", 0)); - assertEquals(Object[][][].class, ReflectionTools.getClassForTypeDeclaration("java.lang.Object", 3)); - - assertEquals(void.class, ReflectionTools.getClassForTypeDeclaration("void", 0)); - try { - ReflectionTools.getClassForTypeDeclaration(void.class.getName(), 1); - fail("should not get here..."); - } catch (RuntimeException ex) { - // expected - } - } - - public void testCodeForClass() { - assertEquals('I', ReflectionTools.getCodeForClass(int.class)); - assertEquals('B', ReflectionTools.getCodeForClass(byte.class)); - } - - public void testClassNameForTypeDeclarationString() throws Exception { - assertEquals("int", ReflectionTools.getClassNameForTypeDeclaration("int")); - assertEquals("[I", ReflectionTools.getClassNameForTypeDeclaration("int[]")); - assertEquals("[[I", ReflectionTools.getClassNameForTypeDeclaration("int [ ] [ ]")); - - assertEquals("java.lang.Object", ReflectionTools.getClassNameForTypeDeclaration("java.lang.Object")); - assertEquals("[Ljava.lang.Object;", ReflectionTools.getClassNameForTypeDeclaration("java.lang.Object\t[]")); - assertEquals("[[Ljava.lang.Object;", ReflectionTools.getClassNameForTypeDeclaration("java.lang.Object\t[]\t[]")); - } - - public void testArrayDepthForTypeDeclarationString() throws Exception { - assertEquals(0, ReflectionTools.getArrayDepthForTypeDeclaration("java.lang.Object")); - assertEquals(1, ReflectionTools.getArrayDepthForTypeDeclaration("java.lang.Object[]")); - assertEquals(3, ReflectionTools.getArrayDepthForTypeDeclaration("java.lang.Object[][][]")); - - assertEquals(0, ReflectionTools.getArrayDepthForTypeDeclaration("int")); - assertEquals(1, ReflectionTools.getArrayDepthForTypeDeclaration("int[]")); - assertEquals(3, ReflectionTools.getArrayDepthForTypeDeclaration("int[][][]")); - - assertEquals(0, ReflectionTools.getArrayDepthForTypeDeclaration("float")); - assertEquals(1, ReflectionTools.getArrayDepthForTypeDeclaration("float [ ]")); - assertEquals(3, ReflectionTools.getArrayDepthForTypeDeclaration("float[] [] []")); - } - - public void testElementTypeNameForTypeDeclarationString() throws Exception { - assertEquals("java.lang.Object", ReflectionTools.getElementTypeNameForTypeDeclaration("java.lang.Object")); - assertEquals("java.lang.Object", ReflectionTools.getElementTypeNameForTypeDeclaration("java.lang.Object[]")); - assertEquals("java.lang.Object", ReflectionTools.getElementTypeNameForTypeDeclaration("java.lang.Object[][][]")); - - assertEquals("int", ReflectionTools.getElementTypeNameForTypeDeclaration("int")); - assertEquals("int", ReflectionTools.getElementTypeNameForTypeDeclaration("int[]")); - assertEquals("int", ReflectionTools.getElementTypeNameForTypeDeclaration("int[][][]")); - - assertEquals("float", ReflectionTools.getElementTypeNameForTypeDeclaration("float")); - assertEquals("float", ReflectionTools.getElementTypeNameForTypeDeclaration("float [ ]")); - assertEquals("float", ReflectionTools.getElementTypeNameForTypeDeclaration("float[] [] []")); - } - - public void testClassNameForTypeDeclarationStringInt() throws Exception { - assertEquals(int.class.getName(), ReflectionTools.getClassNameForTypeDeclaration("int", 0)); - assertEquals(int[].class.getName(), ReflectionTools.getClassNameForTypeDeclaration("int", 1)); - assertEquals(int[][][].class.getName(), ReflectionTools.getClassNameForTypeDeclaration("int", 3)); - - assertEquals(Object.class.getName(), ReflectionTools.getClassNameForTypeDeclaration("java.lang.Object", 0)); - assertEquals(Object[][][].class.getName(), ReflectionTools.getClassNameForTypeDeclaration("java.lang.Object", 3)); - - assertEquals(void.class.getName(), ReflectionTools.getClassNameForTypeDeclaration("void", 0)); - try { - ReflectionTools.getClassNameForTypeDeclaration(void.class.getName(), 1); - fail("should not get here..."); - } catch (IllegalArgumentException ex) { - // expected - } - } - - private Iterable fieldNames(Iterable fields) { - return new TransformationIterable(fields) { - @Override - protected String transform(Field field) { - return field.getName(); - } - }; - } - - private Iterable methodNames(Iterable methods) { - return new TransformationIterable(methods) { - @Override - protected String transform(Method method) { - return method.getName(); - } - }; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ReverseComparatorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ReverseComparatorTests.java deleted file mode 100644 index 1287868a13..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ReverseComparatorTests.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Comparator; -import java.util.List; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.ReverseComparator; - -@SuppressWarnings("nls") -public class ReverseComparatorTests extends TestCase { - private Comparator naturalReverseComparator; - private Comparator customComparator; - private Comparator customReverseComparator; - - public ReverseComparatorTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.naturalReverseComparator = new ReverseComparator(); - this.customComparator = this.buildCustomComparator(); - this.customReverseComparator = new ReverseComparator(this.customComparator); - } - - private Comparator buildCustomComparator() { - return new Comparator() { - public int compare(String s1, String s2) { - String lower1 = s1.toLowerCase(); - String lower2 = s2.toLowerCase(); - int result = lower1.compareTo(lower2); - if (result == 0) { - return s1.compareTo(s2); // use case to differentiate "equal" strings - } - return result; - } - }; - } - - private List buildUnsortedList() { - List result = new ArrayList(); - result.add("T"); - result.add("Z"); - result.add("Y"); - result.add("M"); - result.add("m"); - result.add("a"); - result.add("B"); - result.add("b"); - result.add("A"); - return result; - } - - private List buildNaturallySortedList() { - List result = new ArrayList(this.buildUnsortedList()); - Collections.sort(result); - return result; - } - - private List buildCustomSortedList() { - List result = new ArrayList(this.buildUnsortedList()); - Collections.sort(result, this.customComparator); - return result; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testNatural() { - List list = this.buildUnsortedList(); - Collections.sort(list, this.naturalReverseComparator); - this.verifyList(this.buildNaturallySortedList(), list); - } - - public void testCustom() { - List list = this.buildUnsortedList(); - Collections.sort(list, this.customReverseComparator); - this.verifyList(this.buildCustomSortedList(), list); - } - - private void verifyList(List normal, List reverse) { - int size = normal.size(); - int max = size - 1; - for (int i = 0; i < size; i++) { - assertEquals(normal.get(i), reverse.get(max - i)); - } - } -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleAssociationTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleAssociationTests.java deleted file mode 100644 index 96fe163217..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleAssociationTests.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; -import org.eclipse.jpt.common.utility.internal.Association; -import org.eclipse.jpt.common.utility.internal.SimpleAssociation; - -@SuppressWarnings("nls") -public class SimpleAssociationTests extends TestCase { - private SimpleAssociation assoc; - - public static Test suite() { - return new TestSuite(SimpleAssociationTests.class); - } - - public SimpleAssociationTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.assoc = new SimpleAssociation("foo", "bar"); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testGetKey() { - assertEquals("foo", this.assoc.getKey()); - } - - public void testGetValue() { - assertEquals("bar", this.assoc.getValue()); - } - - public void testSetValue() { - assertEquals("bar", this.assoc.getValue()); - this.assoc.setValue("baz"); - assertEquals("baz", this.assoc.getValue()); - } - - public void testEquals() { - assertFalse(this.assoc.equals("foo")); - - assertEquals(this.assoc, this.copy(this.assoc)); - - SimpleAssociation assoc2 = new SimpleAssociation("foo", "baz"); - assertFalse(this.assoc.equals(assoc2)); - - assoc2 = new SimpleAssociation("fop", "bar"); - assertFalse(this.assoc.equals(assoc2)); - - SimpleAssociation assoc3 = new SimpleAssociation(null, null); - SimpleAssociation assoc4 = new SimpleAssociation(null, null); - assertEquals(assoc3, assoc4); - } - - public void testHashCode() { - assertEquals(this.assoc.hashCode(), this.copy(this.assoc).hashCode()); - - SimpleAssociation assoc2 = new SimpleAssociation(null, null); - assertEquals(assoc2.hashCode(), this.copy(assoc2).hashCode()); - } - - public void testToString() { - assertNotNull(this.assoc.toString()); - } - - public void testClone() { - this.verifyClone(this.assoc, this.assoc.clone()); - } - - private void verifyClone(Association expected, Association actual) { - assertEquals(expected, actual); - assertNotSame(expected, actual); - assertEquals(expected.getKey(), actual.getKey()); - assertSame(expected.getKey(), actual.getKey()); - assertEquals(expected.getValue(), actual.getValue()); - assertSame(expected.getValue(), actual.getValue()); - } - - public void testSerialization() throws Exception { - @SuppressWarnings("cast") - Association assoc2 = (Association) TestTools.serialize(this.assoc); - - assertEquals(this.assoc, assoc2); - assertNotSame(this.assoc, assoc2); - assertEquals(this.assoc.getKey(), assoc2.getKey()); - assertNotSame(this.assoc.getKey(), assoc2.getKey()); - assertEquals(this.assoc.getValue(), assoc2.getValue()); - assertNotSame(this.assoc.getValue(), assoc2.getValue()); - } - - private SimpleAssociation copy(SimpleAssociation sa) { - return new SimpleAssociation(sa.getKey(), sa.getValue()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleBooleanReferenceTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleBooleanReferenceTests.java deleted file mode 100644 index 04c06ddde3..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleBooleanReferenceTests.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.SimpleBooleanReference; - -@SuppressWarnings("nls") -public class SimpleBooleanReferenceTests extends TestCase { - - public SimpleBooleanReferenceTests(String name) { - super(name); - } - - public void testGetValue() { - SimpleBooleanReference br = new SimpleBooleanReference(true); - assertTrue(br.getValue()); - } - - public void testGetValueDefault() { - SimpleBooleanReference br = new SimpleBooleanReference(); - assertFalse(br.getValue()); - } - - public void testIs() { - SimpleBooleanReference br = new SimpleBooleanReference(true); - assertTrue(br.is(true)); - assertFalse(br.is(false)); - } - - public void testIsNot() { - SimpleBooleanReference br = new SimpleBooleanReference(true); - assertFalse(br.isNot(true)); - assertTrue(br.isNot(false)); - } - - public void testIsTrue() { - SimpleBooleanReference br = new SimpleBooleanReference(true); - assertTrue(br.isTrue()); - } - - public void testIsFalse() { - SimpleBooleanReference br = new SimpleBooleanReference(true); - assertFalse(br.isFalse()); - br.setFalse(); - assertTrue(br.isFalse()); - } - - public void testSetValue() { - SimpleBooleanReference br = new SimpleBooleanReference(true); - assertTrue(br.getValue()); - br.setValue(false); - assertFalse(br.getValue()); - } - - public void testFlip() { - SimpleBooleanReference br = new SimpleBooleanReference(true); - assertTrue(br.getValue()); - assertFalse(br.flip()); - assertFalse(br.getValue()); - assertTrue(br.flip()); - assertTrue(br.getValue()); - } - - public void testSetNotBoolean() { - SimpleBooleanReference br = new SimpleBooleanReference(false); - assertFalse(br.getValue()); - br.setNot(true); - assertFalse(br.getValue()); - br.setNot(true); - assertFalse(br.getValue()); - br.setNot(false); - assertTrue(br.getValue()); - } - - public void testSetTrue() { - SimpleBooleanReference br = new SimpleBooleanReference(false); - assertFalse(br.getValue()); - br.setTrue(); - assertTrue(br.getValue()); - } - - public void testSetFalse() { - SimpleBooleanReference br = new SimpleBooleanReference(true); - assertTrue(br.getValue()); - br.setFalse(); - assertFalse(br.getValue()); - } - - public void testClone() { - SimpleBooleanReference br = new SimpleBooleanReference(true); - SimpleBooleanReference clone = br.clone(); - assertTrue(clone.getValue()); - } - - public void testToString() { - SimpleBooleanReference br1 = new SimpleBooleanReference(true); - assertEquals("[true]", br1.toString()); - br1.setFalse(); - assertEquals("[false]", br1.toString()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleIntReferenceTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleIntReferenceTests.java deleted file mode 100644 index 196570b6de..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleIntReferenceTests.java +++ /dev/null @@ -1,314 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.SimpleIntReference; - -@SuppressWarnings("nls") -public class SimpleIntReferenceTests extends TestCase { - - public SimpleIntReferenceTests(String name) { - super(name); - } - - public void testCtors() { - SimpleIntReference ir; - ir = new SimpleIntReference(); - assertEquals(0, ir.getValue()); - ir = new SimpleIntReference(7); - assertEquals(7, ir.getValue()); - ir = new SimpleIntReference(-7); - assertEquals(-7, ir.getValue()); - } - - public void testEqualsInt() { - SimpleIntReference ir; - ir = new SimpleIntReference(); - assertTrue(ir.equals(0)); - assertFalse(ir.equals(7)); - - ir = new SimpleIntReference(7); - assertTrue(ir.equals(7)); - assertFalse(ir.equals(0)); - } - - public void testNotEqualInt() { - SimpleIntReference ir; - ir = new SimpleIntReference(); - assertFalse(ir.notEqual(0)); - assertTrue(ir.notEqual(7)); - - ir = new SimpleIntReference(7); - assertFalse(ir.notEqual(7)); - assertTrue(ir.notEqual(0)); - } - - public void testIsZero() { - SimpleIntReference ir; - ir = new SimpleIntReference(); - assertTrue(ir.isZero()); - - ir = new SimpleIntReference(7); - assertFalse(ir.isZero()); - } - - public void testIsNotZero() { - SimpleIntReference ir; - ir = new SimpleIntReference(); - assertFalse(ir.isNotZero()); - - ir = new SimpleIntReference(7); - assertTrue(ir.isNotZero()); - } - - public void testIsGreaterThanInt() { - SimpleIntReference ir; - ir = new SimpleIntReference(); - assertTrue(ir.isGreaterThan(-1)); - assertFalse(ir.isGreaterThan(0)); - assertFalse(ir.isGreaterThan(7)); - } - - public void testIsGreaterThanOrEqualInt() { - SimpleIntReference ir; - ir = new SimpleIntReference(); - assertTrue(ir.isGreaterThanOrEqual(-1)); - assertTrue(ir.isGreaterThanOrEqual(0)); - assertFalse(ir.isGreaterThanOrEqual(7)); - } - - public void testIsLessThanInt() { - SimpleIntReference ir; - ir = new SimpleIntReference(); - assertFalse(ir.isLessThan(-1)); - assertFalse(ir.isLessThan(0)); - assertTrue(ir.isLessThan(7)); - } - - public void testIsLessThanOrEqualInt() { - SimpleIntReference ir; - ir = new SimpleIntReference(); - assertFalse(ir.isLessThanOrEqual(-1)); - assertTrue(ir.isLessThanOrEqual(0)); - assertTrue(ir.isLessThanOrEqual(7)); - } - - public void testIsPositive() { - SimpleIntReference ir; - ir = new SimpleIntReference(-3); - assertFalse(ir.isPositive()); - - ir = new SimpleIntReference(); - assertFalse(ir.isPositive()); - - ir = new SimpleIntReference(7); - assertTrue(ir.isPositive()); - } - - public void testIsNotPositive() { - SimpleIntReference ir; - ir = new SimpleIntReference(-3); - assertTrue(ir.isNotPositive()); - - ir = new SimpleIntReference(); - assertTrue(ir.isNotPositive()); - - ir = new SimpleIntReference(7); - assertFalse(ir.isNotPositive()); - } - - public void testIsNegative() { - SimpleIntReference ir; - ir = new SimpleIntReference(-3); - assertTrue(ir.isNegative()); - - ir = new SimpleIntReference(); - assertFalse(ir.isNegative()); - - ir = new SimpleIntReference(7); - assertFalse(ir.isNegative()); - } - - public void testIsNotNegative() { - SimpleIntReference ir; - ir = new SimpleIntReference(-3); - assertFalse(ir.isNotNegative()); - - ir = new SimpleIntReference(); - assertTrue(ir.isNotNegative()); - - ir = new SimpleIntReference(7); - assertTrue(ir.isNotNegative()); - } - - public void testSetValueInt() { - SimpleIntReference ir; - ir = new SimpleIntReference(-3); - assertEquals(-3, ir.getValue()); - assertEquals(-3, ir.setValue(4)); - assertEquals(4, ir.getValue()); - } - - public void testAbs() { - SimpleIntReference ir; - ir = new SimpleIntReference(-3); - assertEquals(-3, ir.getValue()); - assertEquals(3, ir.abs()); - - ir.setValue(3); - assertEquals(3, ir.getValue()); - assertEquals(3, ir.abs()); - } - - public void testNeg() { - SimpleIntReference ir; - ir = new SimpleIntReference(-3); - assertEquals(-3, ir.getValue()); - assertEquals(3, ir.neg()); - - ir.setValue(3); - assertEquals(3, ir.getValue()); - assertEquals(-3, ir.neg()); - } - - public void testSetZero() { - SimpleIntReference ir; - ir = new SimpleIntReference(-3); - assertEquals(-3, ir.getValue()); - assertEquals(-3, ir.setZero()); - assertEquals(0, ir.getValue()); - } - - public void testAddInt() { - SimpleIntReference ir; - int value; - ir = new SimpleIntReference(); - assertEquals(0, ir.getValue()); - - value = ir.add(3); - assertEquals(3, value); - - ir.setValue(3); - value = ir.add(-7); - assertEquals(-4, value); - } - - public void testIncrement() { - SimpleIntReference ir; - int value; - ir = new SimpleIntReference(); - assertEquals(0, ir.getValue()); - - value = ir.increment(); - assertEquals(1, value); - assertEquals(1, ir.getValue()); - } - - public void testSubtractInt() { - SimpleIntReference ir; - int count; - ir = new SimpleIntReference(); - assertEquals(0, ir.getValue()); - - count = ir.subtract(3); - assertEquals(-3, count); - - ir.setValue(-3); - count = ir.subtract(-7); - assertEquals(4, count); - } - - public void testDecrement() { - SimpleIntReference ir; - int count; - ir = new SimpleIntReference(); - assertEquals(0, ir.getValue()); - - count = ir.decrement(); - assertEquals(-1, count); - assertEquals(-1, ir.getValue()); - } - - public void testMultiplyInt() { - SimpleIntReference ir; - ir = new SimpleIntReference(3); - assertEquals(3, ir.getValue()); - assertEquals(9, ir.multiply(3)); - } - - public void testDivideInt() { - SimpleIntReference ir; - ir = new SimpleIntReference(24); - assertEquals(24, ir.getValue()); - assertEquals(8, ir.divide(3)); - } - - public void testRemainderInt() { - SimpleIntReference ir; - ir = new SimpleIntReference(25); - assertEquals(25, ir.getValue()); - assertEquals(1, ir.remainder(3)); - } - - public void testMinInt() { - SimpleIntReference ir; - ir = new SimpleIntReference(25); - assertEquals(25, ir.getValue()); - assertEquals(3, ir.min(3)); - assertEquals(25, ir.min(33)); - } - - public void testMaxInt() { - SimpleIntReference ir; - ir = new SimpleIntReference(25); - assertEquals(25, ir.getValue()); - assertEquals(25, ir.max(3)); - assertEquals(30, ir.max(30)); - } - - public void testPowInt() { - SimpleIntReference ir; - ir = new SimpleIntReference(5); - assertEquals(5, ir.getValue()); - assertTrue(ir.pow(2) == 25L); - } - - public void testCompareToIntReference() { - SimpleIntReference ir1 = new SimpleIntReference(44); - SimpleIntReference ir2 = new SimpleIntReference(44); - assertTrue(ir1.compareTo(ir2) == 0); - ir2 = new SimpleIntReference(55); - assertTrue(ir1.compareTo(ir2) < 0); - ir2 = new SimpleIntReference(33); - assertTrue(ir1.compareTo(ir2) > 0); - } - - public void testClone() { - SimpleIntReference ir1 = new SimpleIntReference(44); - SimpleIntReference ir2 = ir1.clone(); - assertEquals(44, ir2.getValue()); - assertNotSame(ir1, ir2); - } - - public void testSerialization() throws Exception { - SimpleIntReference ir1 = new SimpleIntReference(44); - SimpleIntReference ir2 = TestTools.serialize(ir1); - assertEquals(44, ir2.getValue()); - assertNotSame(ir1, ir2); - } - - public void testToString() { - SimpleIntReference ir; - ir = new SimpleIntReference(5); - assertEquals("[5]", ir.toString()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleObjectReferenceTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleObjectReferenceTests.java deleted file mode 100644 index ea91ac9f7c..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleObjectReferenceTests.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.SimpleObjectReference; - -@SuppressWarnings("nls") -public class SimpleObjectReferenceTests extends TestCase { - - public SimpleObjectReferenceTests(String name) { - super(name); - } - - public void testGetValue() { - SimpleObjectReference or = new SimpleObjectReference(); - assertNull(or.getValue()); - or.setValue("foo"); - assertEquals("foo", or.getValue()); - } - - public void testValueEqualsObject() { - SimpleObjectReference or = new SimpleObjectReference(); - assertTrue(or.valueEquals(null)); - assertFalse(or.valueEquals("foo")); - - or.setValue("foo"); - assertFalse(or.valueEquals(null)); - assertTrue(or.valueEquals("foo")); - } - - public void testValueNotEqualObject() { - SimpleObjectReference or = new SimpleObjectReference(); - assertFalse(or.valueNotEqual(null)); - assertTrue(or.valueNotEqual("foo")); - - or.setValue("foo"); - assertTrue(or.valueNotEqual(null)); - assertFalse(or.valueNotEqual("foo")); - } - - public void testIsNull() { - SimpleObjectReference or = new SimpleObjectReference(); - assertTrue(or.isNull()); - or.setValue("foo"); - assertFalse(or.isNull()); - } - - public void testIsNotNull() { - SimpleObjectReference or = new SimpleObjectReference(); - assertFalse(or.isNotNull()); - or.setValue("foo"); - assertTrue(or.isNotNull()); - } - - public void testSetNull() { - SimpleObjectReference or = new SimpleObjectReference(); - assertNull(or.getValue()); - or.setValue("foo"); - assertEquals("foo", or.getValue()); - or.setNull(); - assertNull(or.getValue()); - } - - public void testClone() { - SimpleObjectReference or = new SimpleObjectReference("foo"); - @SuppressWarnings("cast") - SimpleObjectReference clone = (SimpleObjectReference) or.clone(); - assertEquals("foo", clone.getValue()); - assertNotSame(or, clone); - } - - public void testToString() { - SimpleObjectReference or = new SimpleObjectReference(); - assertEquals("[null]", or.toString()); - or.setValue("foo"); - assertEquals("[foo]", or.toString()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleQueueTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleQueueTests.java deleted file mode 100644 index 4fb99dbc5a..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleQueueTests.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.util.NoSuchElementException; - -import org.eclipse.jpt.common.utility.internal.Queue; -import org.eclipse.jpt.common.utility.internal.SimpleQueue; - -@SuppressWarnings("nls") -public class SimpleQueueTests - extends MultiThreadedTestCase -{ - - public SimpleQueueTests(String name) { - super(name); - } - - Queue buildQueue() { - return new SimpleQueue(); - } - - public void testIsEmpty() { - Queue queue = this.buildQueue(); - assertTrue(queue.isEmpty()); - queue.enqueue("first"); - assertFalse(queue.isEmpty()); - queue.enqueue("second"); - assertFalse(queue.isEmpty()); - queue.dequeue(); - assertFalse(queue.isEmpty()); - queue.dequeue(); - assertTrue(queue.isEmpty()); - } - - public void testEnqueueAndDequeue() { - Queue queue = this.buildQueue(); - String first = "first"; - String second = "second"; - - queue.enqueue(first); - queue.enqueue(second); - assertEquals(first, queue.dequeue()); - assertEquals(second, queue.dequeue()); - } - - public void testEnqueueAndPeek() { - Queue queue = this.buildQueue(); - String first = "first"; - String second = "second"; - - queue.enqueue(first); - queue.enqueue(second); - assertEquals(first, queue.peek()); - assertEquals(first, queue.peek()); - assertEquals(first, queue.dequeue()); - assertEquals(second, queue.peek()); - assertEquals(second, queue.peek()); - assertEquals(second, queue.dequeue()); - } - - public void testEmptyQueueExceptionPeek() { - Queue queue = this.buildQueue(); - String first = "first"; - String second = "second"; - - queue.enqueue(first); - queue.enqueue(second); - assertEquals(first, queue.peek()); - assertEquals(first, queue.dequeue()); - assertEquals(second, queue.peek()); - assertEquals(second, queue.dequeue()); - - boolean exCaught = false; - try { - queue.peek(); - fail(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testEmptyQueueExceptionDequeue() { - Queue queue = this.buildQueue(); - String first = "first"; - String second = "second"; - - queue.enqueue(first); - queue.enqueue(second); - assertEquals(first, queue.peek()); - assertEquals(first, queue.dequeue()); - assertEquals(second, queue.peek()); - assertEquals(second, queue.dequeue()); - - boolean exCaught = false; - try { - queue.dequeue(); - fail(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testClone() { - SimpleQueue queue = (SimpleQueue) this.buildQueue(); - queue.enqueue("first"); - queue.enqueue("second"); - queue.enqueue("third"); - - this.verifyClone(queue, queue.clone()); - } - - public void testSerialization() throws Exception { - Queue queue = this.buildQueue(); - queue.enqueue("first"); - queue.enqueue("second"); - queue.enqueue("third"); - - this.verifyClone(queue, TestTools.serialize(queue)); - } - - private void verifyClone(Queue original, Queue clone) { - assertNotSame(original, clone); - assertEquals(original.peek(), clone.peek()); - assertEquals(original.dequeue(), clone.dequeue()); - assertEquals(original.peek(), clone.peek()); - assertEquals(original.dequeue(), clone.dequeue()); - assertEquals(original.isEmpty(), clone.isEmpty()); - assertEquals(original.peek(), clone.peek()); - assertEquals(original.dequeue(), clone.dequeue()); - assertTrue(original.isEmpty()); - assertEquals(original.isEmpty(), clone.isEmpty()); - - original.enqueue("fourth"); - assertFalse(original.isEmpty()); - // clone should still be empty - assertTrue(clone.isEmpty()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleStackTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleStackTests.java deleted file mode 100644 index b73d8633e3..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SimpleStackTests.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.util.EmptyStackException; - -import org.eclipse.jpt.common.utility.internal.SimpleStack; -import org.eclipse.jpt.common.utility.internal.Stack; - -@SuppressWarnings("nls") -public class SimpleStackTests - extends MultiThreadedTestCase -{ - public SimpleStackTests(String name) { - super(name); - } - - Stack buildStack() { - return new SimpleStack(); - } - - public void testIsEmpty() { - Stack stack = this.buildStack(); - assertTrue(stack.isEmpty()); - stack.push("first"); - assertFalse(stack.isEmpty()); - stack.push("second"); - assertFalse(stack.isEmpty()); - stack.pop(); - assertFalse(stack.isEmpty()); - stack.pop(); - assertTrue(stack.isEmpty()); - } - - public void testPushAndPop() { - Stack stack = this.buildStack(); - String first = "first"; - String second = "second"; - - stack.push(first); - stack.push(second); - assertEquals(second, stack.pop()); - assertEquals(first, stack.pop()); - } - - public void testPushAndPeek() { - Stack stack = this.buildStack(); - String first = "first"; - String second = "second"; - - stack.push(first); - stack.push(second); - assertEquals(second, stack.peek()); - assertEquals(second, stack.peek()); - assertEquals(second, stack.pop()); - assertEquals(first, stack.peek()); - assertEquals(first, stack.peek()); - assertEquals(first, stack.pop()); - } - - public void testEmptyStackExceptionPeek() { - Stack stack = this.buildStack(); - String first = "first"; - String second = "second"; - - stack.push(first); - stack.push(second); - assertEquals(second, stack.peek()); - assertEquals(second, stack.pop()); - assertEquals(first, stack.peek()); - assertEquals(first, stack.pop()); - - boolean exCaught = false; - try { - stack.peek(); - fail(); - } catch (EmptyStackException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testEmptyStackExceptionPop() { - Stack stack = this.buildStack(); - String first = "first"; - String second = "second"; - - stack.push(first); - stack.push(second); - assertEquals(second, stack.peek()); - assertEquals(second, stack.pop()); - assertEquals(first, stack.peek()); - assertEquals(first, stack.pop()); - - boolean exCaught = false; - try { - stack.pop(); - fail(); - } catch (EmptyStackException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testClone() { - SimpleStack stack = (SimpleStack) this.buildStack(); - stack.push("first"); - stack.push("second"); - stack.push("third"); - - this.verifyClone(stack, stack.clone()); - } - - public void testSerialization() throws Exception { - Stack stack = this.buildStack(); - stack.push("first"); - stack.push("second"); - stack.push("third"); - - this.verifyClone(stack, TestTools.serialize(stack)); - } - - private void verifyClone(Stack original, Stack clone) { - assertNotSame(original, clone); - assertEquals(original.peek(), clone.peek()); - assertEquals(original.pop(), clone.pop()); - assertEquals(original.peek(), clone.peek()); - assertEquals(original.pop(), clone.pop()); - assertEquals(original.isEmpty(), clone.isEmpty()); - assertEquals(original.peek(), clone.peek()); - assertEquals(original.pop(), clone.pop()); - assertTrue(original.isEmpty()); - assertEquals(original.isEmpty(), clone.isEmpty()); - - original.push("fourth"); - assertFalse(original.isEmpty()); - // clone should still be empty - assertTrue(clone.isEmpty()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/StringToolsTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/StringToolsTests.java deleted file mode 100644 index 137b55249a..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/StringToolsTests.java +++ /dev/null @@ -1,1850 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.io.StringWriter; -import java.io.Writer; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.StringTools; - -@SuppressWarnings("nls") -public class StringToolsTests extends TestCase { - - public StringToolsTests(String name) { - super(name); - } - - private static void assertEquals(String expected, char[] actual) { - assertEquals(expected, new String(actual)); - } - - // ********** padding/truncating ********** - - public void testPad() { - assertEquals("fred", StringTools.pad("fred", 4)); - assertEquals("fred ", StringTools.pad("fred", 6)); - boolean exThrown = false; - try { - assertEquals("fr", StringTools.pad("fred", 2)); - } catch (IllegalArgumentException ex) { - exThrown = true; - } - assertTrue(exThrown); - } - - public void testPadCharArray() { - assertEquals("fred", StringTools.pad(new char[] { 'f', 'r', 'e', 'd' }, 4)); - assertEquals("fred ", StringTools.pad(new char[] { 'f', 'r', 'e', 'd' }, 6)); - boolean exThrown = false; - try { - assertEquals("fr", StringTools.pad(new char[] { 'f', 'r', 'e', 'd' }, 2)); - } catch (IllegalArgumentException ex) { - exThrown = true; - } - assertTrue(exThrown); - } - - public void testPadOnWriter() { - Writer writer; - writer = new StringWriter(); - StringTools.padOn("fred", 4, writer); - assertEquals("fred", writer.toString()); - - writer = new StringWriter(); - StringTools.padOn("fred", 6, writer); - assertEquals("fred ", writer.toString()); - - writer = new StringWriter(); - boolean exThrown = false; - try { - StringTools.padOn("fred", 2, writer); - fail(); - } catch (IllegalArgumentException ex) { - exThrown = true; - } - assertTrue(exThrown); - } - - public void testPadOnStringBuffer() { - StringBuffer sb; - sb = new StringBuffer(); - StringTools.padOn("fred", 4, sb); - assertEquals("fred", sb.toString()); - - sb = new StringBuffer(); - StringTools.padOn("fred", 6, sb); - assertEquals("fred ", sb.toString()); - - sb = new StringBuffer(); - boolean exThrown = false; - try { - StringTools.padOn("fred", 2, sb); - fail(); - } catch (IllegalArgumentException ex) { - exThrown = true; - } - assertTrue(exThrown); - } - - public void testPadOnStringBuilder() { - StringBuilder sb; - sb = new StringBuilder(); - StringTools.padOn("fred", 4, sb); - assertEquals("fred", sb.toString()); - - sb = new StringBuilder(); - StringTools.padOn("fred", 6, sb); - assertEquals("fred ", sb.toString()); - - sb = new StringBuilder(); - boolean exThrown = false; - try { - StringTools.padOn("fred", 2, sb); - fail(); - } catch (IllegalArgumentException ex) { - exThrown = true; - } - assertTrue(exThrown); - } - - public void testPadOrTruncate() { - assertEquals("fred", StringTools.padOrTruncate("fred", 4)); - assertEquals("fred ", StringTools.padOrTruncate("fred", 6)); - assertEquals("fr", StringTools.padOrTruncate("fred", 2)); - } - - public void testPadOrTruncateCharArray() { - assertEquals("fred", StringTools.padOrTruncate(new char[] { 'f', 'r', 'e', 'd' }, 4)); - assertEquals("fred ", StringTools.padOrTruncate(new char[] { 'f', 'r', 'e', 'd' }, 6)); - assertEquals("fr", StringTools.padOrTruncate(new char[] { 'f', 'r', 'e', 'd' }, 2)); - } - - public void testPadOrTruncateOnWriter() { - this.verifyPadOrTruncateOnWriter("fred", "fred", 4); - this.verifyPadOrTruncateOnWriter("fred ", "fred", 6); - this.verifyPadOrTruncateOnWriter("fr", "fred", 2); - } - - private void verifyPadOrTruncateOnWriter(String expected, String string, int length) { - Writer writer = new StringWriter(); - StringTools.padOrTruncateOn(string, length, writer); - assertEquals(expected, writer.toString()); - } - - public void testPadOrTruncateOnStringBuffer() { - this.verifyPadOrTruncateOnStringBuffer("fred", "fred", 4); - this.verifyPadOrTruncateOnStringBuffer("fred ", "fred", 6); - this.verifyPadOrTruncateOnStringBuffer("fr", "fred", 2); - } - - private void verifyPadOrTruncateOnStringBuffer(String expected, String string, int length) { - StringBuffer sb = new StringBuffer(); - StringTools.padOrTruncateOn(string, length, sb); - assertEquals(expected, sb.toString()); - } - - public void testPadOrTruncateOnStringBuilder() { - this.verifyPadOrTruncateOnStringBuilder("fred", "fred", 4); - this.verifyPadOrTruncateOnStringBuilder("fred ", "fred", 6); - this.verifyPadOrTruncateOnStringBuilder("fr", "fred", 2); - } - - private void verifyPadOrTruncateOnStringBuilder(String expected, String string, int length) { - StringBuilder sb = new StringBuilder(); - StringTools.padOrTruncateOn(string, length, sb); - assertEquals(expected, sb.toString()); - } - - public void testZeroPad() { - assertEquals("1234", StringTools.zeroPad("1234", 4)); - assertEquals("001234", StringTools.zeroPad("1234", 6)); - boolean exThrown = false; - try { - assertEquals("12", StringTools.zeroPad("1234", 2)); - } catch (IllegalArgumentException ex) { - exThrown = true; - } - assertTrue(exThrown); - } - - public void testZeroPadCharArray() { - assertEquals("1234", StringTools.zeroPad(new char[] { '1', '2', '3', '4' }, 4)); - assertEquals("001234", StringTools.zeroPad(new char[] { '1', '2', '3', '4' }, 6)); - boolean exThrown = false; - try { - assertEquals("12", StringTools.zeroPad(new char[] { '1', '2', '3', '4' }, 2)); - } catch (IllegalArgumentException ex) { - exThrown = true; - } - assertTrue(exThrown); - } - - public void testZeroPadOnWriter() { - Writer writer; - writer = new StringWriter(); - StringTools.zeroPadOn("1234", 4, writer); - assertEquals("1234", writer.toString()); - - writer = new StringWriter(); - StringTools.zeroPadOn("1234", 6, writer); - assertEquals("001234", writer.toString()); - - writer = new StringWriter(); - boolean exThrown = false; - try { - StringTools.zeroPadOn("1234", 2, writer); - fail(); - } catch (IllegalArgumentException ex) { - exThrown = true; - } - assertTrue(exThrown); - } - - public void testZeroPadOnStringBuffer() { - StringBuffer sb; - sb = new StringBuffer(); - StringTools.zeroPadOn("1234", 4, sb); - assertEquals("1234", sb.toString()); - - sb = new StringBuffer(); - StringTools.zeroPadOn("1234", 6, sb); - assertEquals("001234", sb.toString()); - - sb = new StringBuffer(); - boolean exThrown = false; - try { - StringTools.zeroPadOn("1234", 2, sb); - fail(); - } catch (IllegalArgumentException ex) { - exThrown = true; - } - assertTrue(exThrown); - } - - public void testZeroPadOnStringBuilder() { - StringBuilder sb; - sb = new StringBuilder(); - StringTools.zeroPadOn("1234", 4, sb); - assertEquals("1234", sb.toString()); - - sb = new StringBuilder(); - StringTools.zeroPadOn("1234", 6, sb); - assertEquals("001234", sb.toString()); - - sb = new StringBuilder(); - boolean exThrown = false; - try { - StringTools.zeroPadOn("1234", 2, sb); - fail(); - } catch (IllegalArgumentException ex) { - exThrown = true; - } - assertTrue(exThrown); - } - - public void testZeroPadOrTruncate() { - assertEquals("1234", StringTools.zeroPadOrTruncate("1234", 4)); - assertEquals("001234", StringTools.zeroPadOrTruncate("1234", 6)); - assertEquals("34", StringTools.zeroPadOrTruncate("1234", 2)); - } - - public void testZeroPadOrTruncateCharArray() { - assertEquals("1234", StringTools.zeroPadOrTruncate(new char[] { '1', '2', '3', '4' }, 4)); - assertEquals("001234", StringTools.zeroPadOrTruncate(new char[] { '1', '2', '3', '4' }, 6)); - assertEquals("34", StringTools.zeroPadOrTruncate(new char[] { '1', '2', '3', '4' }, 2)); - } - - public void testZeroPadOrTruncateOnWriter() { - this.verifyZeroPadOrTruncateOnWriter("1234", "1234", 4); - this.verifyZeroPadOrTruncateOnWriter("001234", "1234", 6); - this.verifyZeroPadOrTruncateOnWriter("34", "1234", 2); - } - - private void verifyZeroPadOrTruncateOnWriter(String expected, String string, int length) { - Writer writer = new StringWriter(); - StringTools.zeroPadOrTruncateOn(string, length, writer); - assertEquals(expected, writer.toString()); - } - - public void testZeroPadOrTruncateOnStringBuffer() { - this.verifyZeroPadOrTruncateOnStringBuffer("1234", "1234", 4); - this.verifyZeroPadOrTruncateOnStringBuffer("001234", "1234", 6); - this.verifyZeroPadOrTruncateOnStringBuffer("34", "1234", 2); - } - - private void verifyZeroPadOrTruncateOnStringBuffer(String expected, String string, int length) { - StringBuffer sb = new StringBuffer(); - StringTools.zeroPadOrTruncateOn(string, length, sb); - assertEquals(expected, sb.toString()); - } - - public void testZeroPadOrTruncateOnStringBuilder() { - this.verifyZeroPadOrTruncateOnStringBuilder("1234", "1234", 4); - this.verifyZeroPadOrTruncateOnStringBuilder("001234", "1234", 6); - this.verifyZeroPadOrTruncateOnStringBuilder("34", "1234", 2); - } - - private void verifyZeroPadOrTruncateOnStringBuilder(String expected, String string, int length) { - StringBuilder sb = new StringBuilder(); - StringTools.zeroPadOrTruncateOn(string, length, sb); - assertEquals(expected, sb.toString()); - } - - // ********** separating ********** - - public void testSeparateStringCharInt() { - this.verifySeparate("012345", '-', 22, "012345"); - this.verifySeparate("012345", '-', 6, "012345"); - this.verifySeparate("012345", '-', 5, "01234-5"); - this.verifySeparate("012345", '-', 4, "0123-45"); - this.verifySeparate("012345", '-', 3, "012-345"); - this.verifySeparate("012345", '-', 2, "01-23-45"); - this.verifySeparate("012345", '-', 1, "0-1-2-3-4-5"); - } - - private void verifySeparate(String string, char separator, int segmentLength, String expected) { - assertEquals(expected, StringTools.separate(string, separator, segmentLength)); - } - - public void testSeparateOnStringCharIntWriter() { - this.verifySeparateOnWriter("012345", '-', 22, "012345"); - this.verifySeparateOnWriter("012345", '-', 6, "012345"); - this.verifySeparateOnWriter("012345", '-', 5, "01234-5"); - this.verifySeparateOnWriter("012345", '-', 4, "0123-45"); - this.verifySeparateOnWriter("012345", '-', 3, "012-345"); - this.verifySeparateOnWriter("012345", '-', 2, "01-23-45"); - this.verifySeparateOnWriter("012345", '-', 1, "0-1-2-3-4-5"); - } - - private void verifySeparateOnWriter(String string, char separator, int segmentLength, String expected) { - Writer writer = new StringWriter(); - StringTools.separateOn(string, separator, segmentLength, writer); - assertEquals(expected, writer.toString()); - } - - public void testSeparateOnStringCharIntStringBuffer() { - this.verifySeparateOnStringBuffer("012345", '-', 22, "012345"); - this.verifySeparateOnStringBuffer("012345", '-', 6, "012345"); - this.verifySeparateOnStringBuffer("012345", '-', 5, "01234-5"); - this.verifySeparateOnStringBuffer("012345", '-', 4, "0123-45"); - this.verifySeparateOnStringBuffer("012345", '-', 3, "012-345"); - this.verifySeparateOnStringBuffer("012345", '-', 2, "01-23-45"); - this.verifySeparateOnStringBuffer("012345", '-', 1, "0-1-2-3-4-5"); - } - - private void verifySeparateOnStringBuffer(String string, char separator, int segmentLength, String expected) { - StringBuffer sb = new StringBuffer(); - StringTools.separateOn(string, separator, segmentLength, sb); - assertEquals(expected, sb.toString()); - } - - public void testSeparateOnStringCharIntStringBuilder() { - this.verifySeparateOnStringBuilder("012345", '-', 22, "012345"); - this.verifySeparateOnStringBuilder("012345", '-', 6, "012345"); - this.verifySeparateOnStringBuilder("012345", '-', 5, "01234-5"); - this.verifySeparateOnStringBuilder("012345", '-', 4, "0123-45"); - this.verifySeparateOnStringBuilder("012345", '-', 3, "012-345"); - this.verifySeparateOnStringBuilder("012345", '-', 2, "01-23-45"); - this.verifySeparateOnStringBuilder("012345", '-', 1, "0-1-2-3-4-5"); - } - - private void verifySeparateOnStringBuilder(String string, char separator, int segmentLength, String expected) { - StringBuilder sb = new StringBuilder(); - StringTools.separateOn(string, separator, segmentLength, sb); - assertEquals(expected, sb.toString()); - } - - public void testSeparateCharArrayCharInt() { - this.verifySeparateCharArray("012345", '-', 22, "012345"); - this.verifySeparateCharArray("012345", '-', 6, "012345"); - this.verifySeparateCharArray("012345", '-', 5, "01234-5"); - this.verifySeparateCharArray("012345", '-', 4, "0123-45"); - this.verifySeparateCharArray("012345", '-', 3, "012-345"); - this.verifySeparateCharArray("012345", '-', 2, "01-23-45"); - this.verifySeparateCharArray("012345", '-', 1, "0-1-2-3-4-5"); - } - - private void verifySeparateCharArray(String string, char separator, int segmentLength, String expected) { - assertEquals(expected, StringTools.separate(string.toCharArray(), separator, segmentLength)); - } - - public void testSeparateOnCharArrayCharIntWriter() { - this.verifySeparateCharArrayOnWriter("012345", '-', 22, "012345"); - this.verifySeparateCharArrayOnWriter("012345", '-', 6, "012345"); - this.verifySeparateCharArrayOnWriter("012345", '-', 5, "01234-5"); - this.verifySeparateCharArrayOnWriter("012345", '-', 4, "0123-45"); - this.verifySeparateCharArrayOnWriter("012345", '-', 3, "012-345"); - this.verifySeparateCharArrayOnWriter("012345", '-', 2, "01-23-45"); - this.verifySeparateCharArrayOnWriter("012345", '-', 1, "0-1-2-3-4-5"); - } - - private void verifySeparateCharArrayOnWriter(String string, char separator, int segmentLength, String expected) { - Writer writer = new StringWriter(); - StringTools.separateOn(string.toCharArray(), separator, segmentLength, writer); - assertEquals(expected, writer.toString()); - } - - public void testSeparateOnCharArrayCharIntStringBuffer() { - this.verifySeparateCharArrayOnStringBuffer("012345", '-', 22, "012345"); - this.verifySeparateCharArrayOnStringBuffer("012345", '-', 6, "012345"); - this.verifySeparateCharArrayOnStringBuffer("012345", '-', 5, "01234-5"); - this.verifySeparateCharArrayOnStringBuffer("012345", '-', 4, "0123-45"); - this.verifySeparateCharArrayOnStringBuffer("012345", '-', 3, "012-345"); - this.verifySeparateCharArrayOnStringBuffer("012345", '-', 2, "01-23-45"); - this.verifySeparateCharArrayOnStringBuffer("012345", '-', 1, "0-1-2-3-4-5"); - } - - private void verifySeparateCharArrayOnStringBuffer(String string, char separator, int segmentLength, String expected) { - StringBuffer sb = new StringBuffer(); - StringTools.separateOn(string.toCharArray(), separator, segmentLength, sb); - assertEquals(expected, sb.toString()); - } - - public void testSeparateOnCharArrayCharIntStringBuilder() { - this.verifySeparateCharArrayOnStringBuilder("012345", '-', 22, "012345"); - this.verifySeparateCharArrayOnStringBuilder("012345", '-', 6, "012345"); - this.verifySeparateCharArrayOnStringBuilder("012345", '-', 5, "01234-5"); - this.verifySeparateCharArrayOnStringBuilder("012345", '-', 4, "0123-45"); - this.verifySeparateCharArrayOnStringBuilder("012345", '-', 3, "012-345"); - this.verifySeparateCharArrayOnStringBuilder("012345", '-', 2, "01-23-45"); - this.verifySeparateCharArrayOnStringBuilder("012345", '-', 1, "0-1-2-3-4-5"); - } - - private void verifySeparateCharArrayOnStringBuilder(String string, char separator, int segmentLength, String expected) { - StringBuilder sb = new StringBuilder(); - StringTools.separateOn(string.toCharArray(), separator, segmentLength, sb); - assertEquals(expected, sb.toString()); - } - - // ********** delimiting ********** - - public void testDelimit() { - this.verifyDelimit("Employee", "123", "123Employee123"); - this.verifyDelimit("123", "123", "123123123"); - this.verifyDelimit("", "123", "123123"); - } - - private void verifyDelimit(String string, String delimiter, String expectedString) { - assertEquals(expectedString, StringTools.delimit(string, delimiter)); - } - - public void testDelimitOnWriter() { - this.verifyDelimitOnWriter("Employee", "123", "123Employee123"); - this.verifyDelimitOnWriter("123", "123", "123123123"); - this.verifyDelimitOnWriter("", "123", "123123"); - } - - private void verifyDelimitOnWriter(String string, String delimiter, String expectedString) { - Writer writer = new StringWriter(); - StringTools.delimitOn(string, delimiter, writer); - assertEquals(expectedString, writer.toString()); - } - - public void testDelimitOnStringBuffer() { - this.verifyDelimitOnStringBuffer("Employee", "123", "123Employee123"); - this.verifyDelimitOnStringBuffer("123", "123", "123123123"); - this.verifyDelimitOnStringBuffer("", "123", "123123"); - } - - private void verifyDelimitOnStringBuffer(String string, String delimiter, String expectedString) { - StringBuffer sb = new StringBuffer(); - StringTools.delimitOn(string, delimiter, sb); - assertEquals(expectedString, sb.toString()); - } - - public void testDelimitOnStringBuilder() { - this.verifyDelimitOnStringBuilder("Employee", "123", "123Employee123"); - this.verifyDelimitOnStringBuilder("123", "123", "123123123"); - this.verifyDelimitOnStringBuilder("", "123", "123123"); - } - - private void verifyDelimitOnStringBuilder(String string, String delimiter, String expectedString) { - StringBuilder sb = new StringBuilder(); - StringTools.delimitOn(string, delimiter, sb); - assertEquals(expectedString, sb.toString()); - } - - public void testQuote() { - this.verifyQuote("Employee", "\"Employee\""); - this.verifyQuote("123", "\"123\""); - this.verifyQuote("", "\"\""); - this.verifyQuote("Emp\"loyee", "\"Emp\"\"loyee\""); - } - - private void verifyQuote(String string, String expectedString) { - assertEquals(expectedString, StringTools.quote(string)); - } - - public void testQuoteOnWriter() { - this.verifyQuoteOnWriter("Employee", "\"Employee\""); - this.verifyQuoteOnWriter("123", "\"123\""); - this.verifyQuoteOnWriter("", "\"\""); - this.verifyQuoteOnWriter("Emp\"loyee", "\"Emp\"\"loyee\""); - } - - private void verifyQuoteOnWriter(String string, String expectedString) { - Writer writer = new StringWriter(); - StringTools.quoteOn(string, writer); - assertEquals(expectedString, writer.toString()); - } - - public void testQuoteOnStringBuffer() { - this.verifyQuoteOnStringBuffer("Employee", "\"Employee\""); - this.verifyQuoteOnStringBuffer("123", "\"123\""); - this.verifyQuoteOnStringBuffer("", "\"\""); - this.verifyQuoteOnStringBuffer("Emp\"loyee", "\"Emp\"\"loyee\""); - } - - private void verifyQuoteOnStringBuffer(String string, String expectedString) { - StringBuffer sb = new StringBuffer(); - StringTools.quoteOn(string, sb); - assertEquals(expectedString, sb.toString()); - } - - public void testQuoteOnStringBuilder() { - this.verifyQuoteOnStringBuilder("Employee", "\"Employee\""); - this.verifyQuoteOnStringBuilder("123", "\"123\""); - this.verifyQuoteOnStringBuilder("", "\"\""); - this.verifyQuoteOnStringBuilder("Emp\"loyee", "\"Emp\"\"loyee\""); - } - - private void verifyQuoteOnStringBuilder(String string, String expectedString) { - StringBuilder sb = new StringBuilder(); - StringTools.quoteOn(string, sb); - assertEquals(expectedString, sb.toString()); - } - - // ********** removing characters ********** - - public void testRemoveFirstOccurrence() { - this.verifyRemoveFirstOccurrence("Emplo&yee", '&', "Employee"); - this.verifyRemoveFirstOccurrence("Emplo&yee&", '&', "Employee&"); - this.verifyRemoveFirstOccurrence("Employee &Foo", '&', "Employee Foo"); - this.verifyRemoveFirstOccurrence("Employee&", '&', "Employee"); - this.verifyRemoveFirstOccurrence("&Employee", '&', "Employee"); - } - - private void verifyRemoveFirstOccurrence(String string, char charToRemove, String expectedString) { - assertEquals(expectedString, StringTools.removeFirstOccurrence(string, charToRemove)); - } - - public void testRemoveFirstOccurrenceCharArray() { - this.verifyRemoveFirstOccurrenceCharArray("Emplo&yee", '&', "Employee"); - this.verifyRemoveFirstOccurrenceCharArray("Emplo&yee&", '&', "Employee&"); - this.verifyRemoveFirstOccurrenceCharArray("Employee &Foo", '&', "Employee Foo"); - this.verifyRemoveFirstOccurrenceCharArray("Employee&", '&', "Employee"); - this.verifyRemoveFirstOccurrenceCharArray("&Employee", '&', "Employee"); - } - - private void verifyRemoveFirstOccurrenceCharArray(String string, char charToRemove, String expectedString) { - assertEquals(expectedString, StringTools.removeFirstOccurrence(string.toCharArray(), charToRemove)); - } - - public void testRemoveFirstOccurrenceOnWriter() { - this.verifyRemoveFirstOccurrenceOnWriter("Emplo&yee", '&', "Employee"); - this.verifyRemoveFirstOccurrenceOnWriter("Emplo&yee&", '&', "Employee&"); - this.verifyRemoveFirstOccurrenceOnWriter("Employee &Foo", '&', "Employee Foo"); - this.verifyRemoveFirstOccurrenceOnWriter("Employee&", '&', "Employee"); - this.verifyRemoveFirstOccurrenceOnWriter("&Employee", '&', "Employee"); - } - - private void verifyRemoveFirstOccurrenceOnWriter(String string, char charToRemove, String expectedString) { - Writer writer = new StringWriter(); - StringTools.removeFirstOccurrenceOn(string, charToRemove, writer); - assertEquals(expectedString, writer.toString()); - } - - public void testRemoveFirstOccurrenceOnStringBuffer() { - this.verifyRemoveFirstOccurrenceOnStringBuffer("Emplo&yee", '&', "Employee"); - this.verifyRemoveFirstOccurrenceOnStringBuffer("Emplo&yee&", '&', "Employee&"); - this.verifyRemoveFirstOccurrenceOnStringBuffer("Employee &Foo", '&', "Employee Foo"); - this.verifyRemoveFirstOccurrenceOnStringBuffer("Employee&", '&', "Employee"); - this.verifyRemoveFirstOccurrenceOnStringBuffer("&Employee", '&', "Employee"); - } - - private void verifyRemoveFirstOccurrenceOnStringBuffer(String string, char charToRemove, String expectedString) { - StringBuffer sb = new StringBuffer(); - StringTools.removeFirstOccurrenceOn(string, charToRemove, sb); - assertEquals(expectedString, sb.toString()); - } - - public void testRemoveFirstOccurrenceOnStringBuilder() { - this.verifyRemoveFirstOccurrenceOnStringBuilder("Emplo&yee", '&', "Employee"); - this.verifyRemoveFirstOccurrenceOnStringBuilder("Emplo&yee&", '&', "Employee&"); - this.verifyRemoveFirstOccurrenceOnStringBuilder("Employee &Foo", '&', "Employee Foo"); - this.verifyRemoveFirstOccurrenceOnStringBuilder("Employee&", '&', "Employee"); - this.verifyRemoveFirstOccurrenceOnStringBuilder("&Employee", '&', "Employee"); - } - - private void verifyRemoveFirstOccurrenceOnStringBuilder(String string, char charToRemove, String expectedString) { - StringBuilder sb = new StringBuilder(); - StringTools.removeFirstOccurrenceOn(string, charToRemove, sb); - assertEquals(expectedString, sb.toString()); - } - - public void testRemoveAllOccurrences() { - this.verifyRemoveAllOccurrences("Employee Fred", ' ', "EmployeeFred"); - this.verifyRemoveAllOccurrences(" Employee ", ' ', "Employee"); - this.verifyRemoveAllOccurrences("Employee Foo", ' ', "EmployeeFoo"); - this.verifyRemoveAllOccurrences(" Emp loyee Foo", ' ', "EmployeeFoo"); - } - - private void verifyRemoveAllOccurrences(String string, char charToRemove, String expectedString) { - assertEquals(expectedString, StringTools.removeAllOccurrences(string, charToRemove)); - } - - public void testRemoveAllOccurrencesCharArray() { - this.verifyRemoveAllOccurrencesCharArray("Employee Fred", ' ', "EmployeeFred"); - this.verifyRemoveAllOccurrencesCharArray(" Employee ", ' ', "Employee"); - this.verifyRemoveAllOccurrencesCharArray("Employee Foo", ' ', "EmployeeFoo"); - this.verifyRemoveAllOccurrencesCharArray(" Emp loyee Foo", ' ', "EmployeeFoo"); - } - - private void verifyRemoveAllOccurrencesCharArray(String string, char charToRemove, String expectedString) { - assertEquals(expectedString, StringTools.removeAllOccurrences(string.toCharArray(), charToRemove)); - } - - public void testRemoveAllOccurrencesOnWriter() { - this.verifyRemoveAllOccurrencesOnWriter("Employee Fred", ' ', "EmployeeFred"); - this.verifyRemoveAllOccurrencesOnWriter(" Employee ", ' ', "Employee"); - this.verifyRemoveAllOccurrencesOnWriter("Employee Foo", ' ', "EmployeeFoo"); - this.verifyRemoveAllOccurrencesOnWriter(" Emp loyee Foo", ' ', "EmployeeFoo"); - } - - private void verifyRemoveAllOccurrencesOnWriter(String string, char charToRemove, String expectedString) { - Writer writer = new StringWriter(); - StringTools.removeAllOccurrencesOn(string, charToRemove, writer); - assertEquals(expectedString, writer.toString()); - } - - public void testRemoveAllOccurrencesOnStringBuffer() { - this.verifyRemoveAllOccurrencesOnStringBuffer("Employee Fred", ' ', "EmployeeFred"); - this.verifyRemoveAllOccurrencesOnStringBuffer(" Employee ", ' ', "Employee"); - this.verifyRemoveAllOccurrencesOnStringBuffer("Employee Foo", ' ', "EmployeeFoo"); - this.verifyRemoveAllOccurrencesOnStringBuffer(" Emp loyee Foo", ' ', "EmployeeFoo"); - } - - private void verifyRemoveAllOccurrencesOnStringBuffer(String string, char charToRemove, String expectedString) { - StringBuffer sb = new StringBuffer(); - StringTools.removeAllOccurrencesOn(string, charToRemove, sb); - assertEquals(expectedString, sb.toString()); - } - - public void testRemoveAllOccurrencesOnStringBuilder() { - this.verifyRemoveAllOccurrencesOnStringBuilder("Employee Fred", ' ', "EmployeeFred"); - this.verifyRemoveAllOccurrencesOnStringBuilder(" Employee ", ' ', "Employee"); - this.verifyRemoveAllOccurrencesOnStringBuilder("Employee Foo", ' ', "EmployeeFoo"); - this.verifyRemoveAllOccurrencesOnStringBuilder(" Emp loyee Foo", ' ', "EmployeeFoo"); - } - - private void verifyRemoveAllOccurrencesOnStringBuilder(String string, char charToRemove, String expectedString) { - StringBuilder sb = new StringBuilder(); - StringTools.removeAllOccurrencesOn(string, charToRemove, sb); - assertEquals(expectedString, sb.toString()); - } - - public void testRemoveAllWhitespace() { - this.verifyRemoveAllWhitespace("Employee Fred\t", "EmployeeFred"); - this.verifyRemoveAllWhitespace("\tEmployee\n", "Employee"); - this.verifyRemoveAllWhitespace("Employee \t Foo", "EmployeeFoo"); - this.verifyRemoveAllWhitespace(" Emp\tloyee \n Foo", "EmployeeFoo"); - } - - private void verifyRemoveAllWhitespace(String string, String expectedString) { - assertEquals(expectedString, StringTools.removeAllWhitespace(string)); - } - - public void testRemoveAllWhitespaceCharArray() { - this.verifyRemoveAllWhitespaceCharArray("Employee Fred\t", "EmployeeFred"); - this.verifyRemoveAllWhitespaceCharArray("\tEmployee\n", "Employee"); - this.verifyRemoveAllWhitespaceCharArray("Employee \t Foo", "EmployeeFoo"); - this.verifyRemoveAllWhitespaceCharArray(" Emp\tloyee \n Foo", "EmployeeFoo"); - } - - private void verifyRemoveAllWhitespaceCharArray(String string, String expectedString) { - assertEquals(expectedString, StringTools.removeAllWhitespace(string.toCharArray())); - } - - public void testRemoveAllWhitespaceOnWriter() { - this.verifyRemoveAllWhitespaceOnWriter("Employee Fred\t", "EmployeeFred"); - this.verifyRemoveAllWhitespaceOnWriter("\tEmployee\n", "Employee"); - this.verifyRemoveAllWhitespaceOnWriter("Employee \t Foo", "EmployeeFoo"); - this.verifyRemoveAllWhitespaceOnWriter(" Emp\tloyee \n Foo", "EmployeeFoo"); - } - - private void verifyRemoveAllWhitespaceOnWriter(String string, String expectedString) { - Writer writer = new StringWriter(); - StringTools.removeAllWhitespaceOn(string, writer); - assertEquals(expectedString, writer.toString()); - } - - public void testRemoveAllWhitespaceOnStringBuffer() { - this.verifyRemoveAllWhitespaceOnStringBuffer("Employee Fred\t", "EmployeeFred"); - this.verifyRemoveAllWhitespaceOnStringBuffer("\tEmployee\n", "Employee"); - this.verifyRemoveAllWhitespaceOnStringBuffer("Employee \t Foo", "EmployeeFoo"); - this.verifyRemoveAllWhitespaceOnStringBuffer(" Emp\tloyee \n Foo", "EmployeeFoo"); - } - - private void verifyRemoveAllWhitespaceOnStringBuffer(String string, String expectedString) { - StringBuffer sb = new StringBuffer(); - StringTools.removeAllWhitespaceOn(string, sb); - assertEquals(expectedString, sb.toString()); - } - - public void testRemoveAllWhitespaceOnStringBuilder() { - this.verifyRemoveAllWhitespaceOnStringBuilder("Employee Fred\t", "EmployeeFred"); - this.verifyRemoveAllWhitespaceOnStringBuilder("\tEmployee\n", "Employee"); - this.verifyRemoveAllWhitespaceOnStringBuilder("Employee \t Foo", "EmployeeFoo"); - this.verifyRemoveAllWhitespaceOnStringBuilder(" Emp\tloyee \n Foo", "EmployeeFoo"); - } - - private void verifyRemoveAllWhitespaceOnStringBuilder(String string, String expectedString) { - StringBuilder sb = new StringBuilder(); - StringTools.removeAllWhitespaceOn(string, sb); - assertEquals(expectedString, sb.toString()); - } -////////////////////////////// - public void testCompressWhitespace() { - this.verifyCompressWhitespace("Employee Fred\t", "Employee Fred "); - this.verifyCompressWhitespace("\tEmployee \n", " Employee "); - this.verifyCompressWhitespace("Employee \t Foo", "Employee Foo"); - this.verifyCompressWhitespace(" Emp\tloyee \n Foo ", " Emp loyee Foo "); - } - - private void verifyCompressWhitespace(String string, String expectedString) { - assertEquals(expectedString, StringTools.compressWhitespace(string)); - } - - public void testCompressWhitespaceCharArray() { - this.verifyCompressWhitespaceCharArray("Employee Fred\t", "Employee Fred "); - this.verifyCompressWhitespaceCharArray("\tEmployee \n", " Employee "); - this.verifyCompressWhitespaceCharArray("Employee \t Foo", "Employee Foo"); - this.verifyCompressWhitespaceCharArray(" Emp\tloyee \n Foo ", " Emp loyee Foo "); - } - - private void verifyCompressWhitespaceCharArray(String string, String expectedString) { - assertEquals(expectedString, StringTools.compressWhitespace(string.toCharArray())); - } - - public void testCompressWhitespaceOnWriter() { - this.verifyCompressWhitespaceOnWriter("Employee Fred\t", "Employee Fred "); - this.verifyCompressWhitespaceOnWriter("\tEmployee \n", " Employee "); - this.verifyCompressWhitespaceOnWriter("Employee \t Foo", "Employee Foo"); - this.verifyCompressWhitespaceOnWriter(" Emp\tloyee \n Foo ", " Emp loyee Foo "); - } - - private void verifyCompressWhitespaceOnWriter(String string, String expectedString) { - Writer writer = new StringWriter(); - StringTools.compressWhitespaceOn(string, writer); - assertEquals(expectedString, writer.toString()); - } - - public void testCompressWhitespaceOnStringBuffer() { - this.verifyCompressWhitespaceOnStringBuffer("Employee Fred\t", "Employee Fred "); - this.verifyCompressWhitespaceOnStringBuffer("\tEmployee \n", " Employee "); - this.verifyCompressWhitespaceOnStringBuffer("Employee \t Foo", "Employee Foo"); - this.verifyCompressWhitespaceOnStringBuffer(" Emp\tloyee \n Foo ", " Emp loyee Foo "); - } - - private void verifyCompressWhitespaceOnStringBuffer(String string, String expectedString) { - StringBuffer sb = new StringBuffer(); - StringTools.compressWhitespaceOn(string, sb); - assertEquals(expectedString, sb.toString()); - } - - public void testCompressWhitespaceOnStringBuilder() { - this.verifyCompressWhitespaceOnStringBuilder("Employee Fred\t", "Employee Fred "); - this.verifyCompressWhitespaceOnStringBuilder("\tEmployee \n", " Employee "); - this.verifyCompressWhitespaceOnStringBuilder("Employee \t Foo", "Employee Foo"); - this.verifyCompressWhitespaceOnStringBuilder(" Emp\tloyee \n Foo ", " Emp loyee Foo "); - } - - private void verifyCompressWhitespaceOnStringBuilder(String string, String expectedString) { - StringBuilder sb = new StringBuilder(); - StringTools.compressWhitespaceOn(string, sb); - assertEquals(expectedString, sb.toString()); - } - - // ********** common prefix ********** - - public void testCommonPrefixLength() { - assertEquals(3, StringTools.commonPrefixLength("fooZZZ", "fooBBB")); - assertEquals(3, StringTools.commonPrefixLength("foo", "fooBBB")); - assertEquals(3, StringTools.commonPrefixLength("fooZZZ", "foo")); - assertEquals(3, StringTools.commonPrefixLength("foo", "foo")); - } - - public void testCommonPrefixLengthMax() { - assertEquals(2, StringTools.commonPrefixLength("fooZZZ", "fooBBB", 2)); - assertEquals(2, StringTools.commonPrefixLength("foo", "fooBBB", 2)); - assertEquals(2, StringTools.commonPrefixLength("fooZZZ", "foo", 2)); - assertEquals(2, StringTools.commonPrefixLength("foo", "foo", 2)); - } - - // ********** capitalization ********** - - public void testCapitalizeCharArray() { - this.verifyCapitalizeCharArray("Oracle", new char[] { 'O', 'r', 'a', 'c', 'l', 'e' }); - this.verifyCapitalizeCharArray("Oracle", new char[] { 'o', 'r', 'a', 'c', 'l', 'e' }); - this.verifyCapitalizeCharArray(" ", new char[] { ' ', ' ', ' ' }); - this.verifyCapitalizeCharArray("ORACLE", new char[] { 'O', 'R', 'A', 'C', 'L', 'E' }); - this.verifyCapitalizeCharArray("", new char[0]); - this.verifyCapitalizeCharArray("A", new char[] { 'a' }); - this.verifyCapitalizeCharArray("\u00C9cole", new char[] { '\u00E9', 'c', 'o', 'l', 'e' }); - } - - private void verifyCapitalizeCharArray(String expected, char[] string) { - assertEquals(expected, StringTools.capitalize(string)); - } - - public void testCapitalizeString() { - this.verifyCapitalizeString("Oracle", "Oracle"); - this.verifyCapitalizeString("Oracle", "oracle"); - this.verifyCapitalizeString(" ", " "); - this.verifyCapitalizeString("ORACLE", "ORACLE"); - this.verifyCapitalizeString("", ""); - this.verifyCapitalizeString("A", "a"); - this.verifyCapitalizeString("\u00C9cole", "\u00E9cole"); // �cole->�COLE - } - - private void verifyCapitalizeString(String expected, String string) { - assertEquals(expected, StringTools.capitalize(string)); - } - - public void testCapitalizeOnCharArrayStringBuffer() { - this.verifyCapitalizeOnCharArrayStringBuffer("Oracle", new char[] { 'O', 'r', 'a', 'c', 'l', 'e' }); - this.verifyCapitalizeOnCharArrayStringBuffer("Oracle", new char[] { 'o', 'r', 'a', 'c', 'l', 'e' }); - this.verifyCapitalizeOnCharArrayStringBuffer(" ", new char[] { ' ', ' ', ' ' }); - this.verifyCapitalizeOnCharArrayStringBuffer("ORACLE", new char[] { 'O', 'R', 'A', 'C', 'L', 'E' }); - this.verifyCapitalizeOnCharArrayStringBuffer("", new char[0]); - this.verifyCapitalizeOnCharArrayStringBuffer("A", new char[] { 'a' }); - this.verifyCapitalizeOnCharArrayStringBuffer("\u00C9cole", new char[] { '\u00E9', 'c', 'o', 'l', 'e' }); - } - - private void verifyCapitalizeOnCharArrayStringBuffer(String expected, char[] string) { - StringBuffer sb = new StringBuffer(); - StringTools.capitalizeOn(string, sb); - assertEquals(expected, sb.toString()); - } - - public void testCapitalizeOnCharArrayStringBuilder() { - this.verifyCapitalizeOnCharArrayStringBuilder("Oracle", new char[] { 'O', 'r', 'a', 'c', 'l', 'e' }); - this.verifyCapitalizeOnCharArrayStringBuilder("Oracle", new char[] { 'o', 'r', 'a', 'c', 'l', 'e' }); - this.verifyCapitalizeOnCharArrayStringBuilder(" ", new char[] { ' ', ' ', ' ' }); - this.verifyCapitalizeOnCharArrayStringBuilder("ORACLE", new char[] { 'O', 'R', 'A', 'C', 'L', 'E' }); - this.verifyCapitalizeOnCharArrayStringBuilder("", new char[0]); - this.verifyCapitalizeOnCharArrayStringBuilder("A", new char[] { 'a' }); - this.verifyCapitalizeOnCharArrayStringBuilder("\u00C9cole", new char[] { '\u00E9', 'c', 'o', 'l', 'e' }); - } - - private void verifyCapitalizeOnCharArrayStringBuilder(String expected, char[] string) { - StringBuilder sb = new StringBuilder(); - StringTools.capitalizeOn(string, sb); - assertEquals(expected, sb.toString()); - } - - public void testCapitalizeOnStringStringBuffer() { - this.verifyCapitalizeOnStringStringBuffer("Oracle", "Oracle"); - this.verifyCapitalizeOnStringStringBuffer("Oracle", "oracle"); - this.verifyCapitalizeOnStringStringBuffer(" ", " "); - this.verifyCapitalizeOnStringStringBuffer("ORACLE", "ORACLE"); - this.verifyCapitalizeOnStringStringBuffer("", ""); - this.verifyCapitalizeOnStringStringBuffer("A", "a"); - this.verifyCapitalizeOnStringStringBuffer("\u00C9cole", "\u00E9cole"); // �cole->�COLE - } - - private void verifyCapitalizeOnStringStringBuffer(String expected, String string) { - StringBuffer sb = new StringBuffer(); - StringTools.capitalizeOn(string, sb); - assertEquals(expected, sb.toString()); - } - - public void testCapitalizeOnStringStringBuilder() { - this.verifyCapitalizeOnStringStringBuilder("Oracle", "Oracle"); - this.verifyCapitalizeOnStringStringBuilder("Oracle", "oracle"); - this.verifyCapitalizeOnStringStringBuilder(" ", " "); - this.verifyCapitalizeOnStringStringBuilder("ORACLE", "ORACLE"); - this.verifyCapitalizeOnStringStringBuilder("", ""); - this.verifyCapitalizeOnStringStringBuilder("A", "a"); - this.verifyCapitalizeOnStringStringBuilder("\u00C9cole", "\u00E9cole"); // �cole->�COLE - } - - private void verifyCapitalizeOnStringStringBuilder(String expected, String string) { - StringBuilder sb = new StringBuilder(); - StringTools.capitalizeOn(string, sb); - assertEquals(expected, sb.toString()); - } - - public void testCapitalizeOnCharArrayWriter() { - this.verifyCapitalizeOnCharArrayWriter("Oracle", new char[] { 'O', 'r', 'a', 'c', 'l', 'e' }); - this.verifyCapitalizeOnCharArrayWriter("Oracle", new char[] { 'o', 'r', 'a', 'c', 'l', 'e' }); - this.verifyCapitalizeOnCharArrayWriter(" ", new char[] { ' ', ' ', ' ' }); - this.verifyCapitalizeOnCharArrayWriter("ORACLE", new char[] { 'O', 'R', 'A', 'C', 'L', 'E' }); - this.verifyCapitalizeOnCharArrayWriter("", new char[0]); - this.verifyCapitalizeOnCharArrayWriter("A", new char[] { 'a' }); - this.verifyCapitalizeOnCharArrayWriter("\u00C9cole", new char[] { '\u00E9', 'c', 'o', 'l', 'e' }); - } - - private void verifyCapitalizeOnCharArrayWriter(String expected, char[] string) { - Writer writer = new StringWriter(); - StringTools.capitalizeOn(string, writer); - assertEquals(expected, writer.toString()); - } - - public void testCapitalizeOnStringWriter() { - this.verifyCapitalizeOnStringWriter("Oracle", "Oracle"); - this.verifyCapitalizeOnStringWriter("Oracle", "oracle"); - this.verifyCapitalizeOnStringWriter(" ", " "); - this.verifyCapitalizeOnStringWriter("ORACLE", "ORACLE"); - this.verifyCapitalizeOnStringWriter("", ""); - this.verifyCapitalizeOnStringWriter("A", "a"); - this.verifyCapitalizeOnStringWriter("\u00C9cole", "\u00E9cole"); // �cole->�COLE - } - - private void verifyCapitalizeOnStringWriter(String expected, String string) { - Writer writer = new StringWriter(); - StringTools.capitalizeOn(string, writer); - assertEquals(expected, writer.toString()); - } - - public void testUnapitalizeCharArray() { - this.verifyUncapitalizeCharArray("oracle", new char[] { 'O', 'r', 'a', 'c', 'l', 'e' }); - this.verifyUncapitalizeCharArray("oracle", new char[] { 'o', 'r', 'a', 'c', 'l', 'e' }); - this.verifyUncapitalizeCharArray(" ", new char[] { ' ', ' ', ' ' }); - this.verifyUncapitalizeCharArray("ORACLE", new char[] { 'O', 'R', 'A', 'C', 'L', 'E' }); - this.verifyUncapitalizeCharArray("", new char[0]); - this.verifyUncapitalizeCharArray("a", new char[] { 'A' }); - this.verifyUncapitalizeCharArray("\u00E9cole", new char[] { '\u00C9', 'c', 'o', 'l', 'e' }); - } - - private void verifyUncapitalizeCharArray(String expected, char[] string) { - assertEquals(expected, StringTools.uncapitalize(string)); - } - - public void testUncapitalizeString() { - this.verifyUncapitalizeString("oracle", "Oracle"); - this.verifyUncapitalizeString("oracle", "oracle"); - this.verifyUncapitalizeString(" ", " "); - this.verifyUncapitalizeString("ORACLE", "ORACLE"); - this.verifyUncapitalizeString("", ""); - this.verifyUncapitalizeString("a", "A"); - this.verifyUncapitalizeString("\u00E9cole", "\u00C9cole"); // �cole->�COLE - } - - private void verifyUncapitalizeString(String expected, String string) { - assertEquals(expected, StringTools.uncapitalize(string)); - } - - public void testUncapitalizeOnCharArrayStringBuffer() { - this.verifyUncapitalizeOnCharArrayStringBuffer("oracle", new char[] { 'O', 'r', 'a', 'c', 'l', 'e' }); - this.verifyUncapitalizeOnCharArrayStringBuffer("oracle", new char[] { 'o', 'r', 'a', 'c', 'l', 'e' }); - this.verifyUncapitalizeOnCharArrayStringBuffer(" ", new char[] { ' ', ' ', ' ' }); - this.verifyUncapitalizeOnCharArrayStringBuffer("ORACLE", new char[] { 'O', 'R', 'A', 'C', 'L', 'E' }); - this.verifyUncapitalizeOnCharArrayStringBuffer("", new char[0]); - this.verifyUncapitalizeOnCharArrayStringBuffer("a", new char[] { 'A' }); - this.verifyUncapitalizeOnCharArrayStringBuffer("\u00E9cole", new char[] { '\u00C9', 'c', 'o', 'l', 'e' }); - } - - private void verifyUncapitalizeOnCharArrayStringBuffer(String expected, char[] string) { - StringBuffer sb = new StringBuffer(); - StringTools.uncapitalizeOn(string, sb); - assertEquals(expected, sb.toString()); - } - - public void testUncapitalizeOnCharArrayStringBuilder() { - this.verifyUncapitalizeOnCharArrayStringBuilder("oracle", new char[] { 'O', 'r', 'a', 'c', 'l', 'e' }); - this.verifyUncapitalizeOnCharArrayStringBuilder("oracle", new char[] { 'o', 'r', 'a', 'c', 'l', 'e' }); - this.verifyUncapitalizeOnCharArrayStringBuilder(" ", new char[] { ' ', ' ', ' ' }); - this.verifyUncapitalizeOnCharArrayStringBuilder("ORACLE", new char[] { 'O', 'R', 'A', 'C', 'L', 'E' }); - this.verifyUncapitalizeOnCharArrayStringBuilder("", new char[0]); - this.verifyUncapitalizeOnCharArrayStringBuilder("a", new char[] { 'A' }); - this.verifyUncapitalizeOnCharArrayStringBuilder("\u00E9cole", new char[] { '\u00C9', 'c', 'o', 'l', 'e' }); - } - - private void verifyUncapitalizeOnCharArrayStringBuilder(String expected, char[] string) { - StringBuilder sb = new StringBuilder(); - StringTools.uncapitalizeOn(string, sb); - assertEquals(expected, sb.toString()); - } - - public void testUncapitalizeOnStringStringBuffer() { - this.verifyUncapitalizeOnStringStringBuffer("oracle", "Oracle"); - this.verifyUncapitalizeOnStringStringBuffer("oracle", "oracle"); - this.verifyUncapitalizeOnStringStringBuffer(" ", " "); - this.verifyUncapitalizeOnStringStringBuffer("ORACLE", "ORACLE"); - this.verifyUncapitalizeOnStringStringBuffer("", ""); - this.verifyUncapitalizeOnStringStringBuffer("a", "A"); - this.verifyUncapitalizeOnStringStringBuffer("\u00E9cole", "\u00C9cole"); // �cole->�COLE - } - - private void verifyUncapitalizeOnStringStringBuffer(String expected, String string) { - StringBuffer sb = new StringBuffer(); - StringTools.uncapitalizeOn(string, sb); - assertEquals(expected, sb.toString()); - } - - public void testUncapitalizeOnStringStringBuilder() { - this.verifyUncapitalizeOnStringStringBuilder("oracle", "Oracle"); - this.verifyUncapitalizeOnStringStringBuilder("oracle", "oracle"); - this.verifyUncapitalizeOnStringStringBuilder(" ", " "); - this.verifyUncapitalizeOnStringStringBuilder("ORACLE", "ORACLE"); - this.verifyUncapitalizeOnStringStringBuilder("", ""); - this.verifyUncapitalizeOnStringStringBuilder("a", "A"); - this.verifyUncapitalizeOnStringStringBuilder("\u00E9cole", "\u00C9cole"); // �cole->�COLE - } - - private void verifyUncapitalizeOnStringStringBuilder(String expected, String string) { - StringBuilder sb = new StringBuilder(); - StringTools.uncapitalizeOn(string, sb); - assertEquals(expected, sb.toString()); - } - - public void testUncapitalizeOnCharArrayWriter() { - this.verifyUncapitalizeOnCharArrayWriter("oracle", new char[] { 'O', 'r', 'a', 'c', 'l', 'e' }); - this.verifyUncapitalizeOnCharArrayWriter("oracle", new char[] { 'o', 'r', 'a', 'c', 'l', 'e' }); - this.verifyUncapitalizeOnCharArrayWriter(" ", new char[] { ' ', ' ', ' ' }); - this.verifyUncapitalizeOnCharArrayWriter("ORACLE", new char[] { 'O', 'R', 'A', 'C', 'L', 'E' }); - this.verifyUncapitalizeOnCharArrayWriter("", new char[0]); - this.verifyUncapitalizeOnCharArrayWriter("a", new char[] { 'A' }); - this.verifyUncapitalizeOnCharArrayWriter("\u00E9cole", new char[] { '\u00C9', 'c', 'o', 'l', 'e' }); - } - - private void verifyUncapitalizeOnCharArrayWriter(String expected, char[] string) { - Writer writer = new StringWriter(); - StringTools.uncapitalizeOn(string, writer); - assertEquals(expected, writer.toString()); - } - - public void testUncapitalizeOnStringWriter() { - this.verifyUncapitalizeOnStringWriter("oracle", "Oracle"); - this.verifyUncapitalizeOnStringWriter("oracle", "oracle"); - this.verifyUncapitalizeOnStringWriter(" ", " "); - this.verifyUncapitalizeOnStringWriter("ORACLE", "ORACLE"); - this.verifyUncapitalizeOnStringWriter("", ""); - this.verifyUncapitalizeOnStringWriter("a", "A"); - this.verifyUncapitalizeOnStringWriter("\u00E9cole", "\u00C9cole"); // �cole->�COLE - } - - private void verifyUncapitalizeOnStringWriter(String expected, String string) { - Writer writer = new StringWriter(); - StringTools.uncapitalizeOn(string, writer); - assertEquals(expected, writer.toString()); - } - - // ********** #toString() ********** - - public void testBuildToStringClassName_anonymous() { - Object o = new Object(){/*anonymous subclass of Object*/}; - assertEquals("Object", StringTools.buildToStringClassName(o.getClass())); - } - - // ********** queries ********** - - public void testStringIsEmptyString() { - assertTrue(StringTools.stringIsEmpty((String) null)); - assertTrue(StringTools.stringIsEmpty("")); - assertTrue(StringTools.stringIsEmpty(" ")); - assertTrue(StringTools.stringIsEmpty(" \t\t ")); - assertTrue(StringTools.stringIsEmpty(" \t\t " + StringTools.CR)); - } - - public void testStringIsEmptyCharArray() { - assertTrue(StringTools.stringIsEmpty((char[]) null)); - this.verifyStringIsEmptyCharArray(""); - this.verifyStringIsEmptyCharArray(" \t\t "); - this.verifyStringIsEmptyCharArray(" "); - this.verifyStringIsEmptyCharArray(" \t\t " + StringTools.CR); - } - - private void verifyStringIsEmptyCharArray(String string) { - assertTrue(StringTools.stringIsEmpty(string.toCharArray())); - } - - public void testStringsAreEqualStringString() { - assertTrue(StringTools.stringsAreEqual((String) null, (String) null)); - assertFalse(StringTools.stringsAreEqual(null, "asdf")); - assertFalse(StringTools.stringsAreEqual("asdf", null)); - assertTrue(StringTools.stringsAreEqual("asdf", "asdf")); - assertFalse(StringTools.stringsAreEqual("asdf", "ASDF")); - } - - public void testStringsAreEqualCharArrayCharArray() { - assertTrue(StringTools.stringsAreEqual((char[]) null, (char[]) null)); - assertFalse(StringTools.stringsAreEqual((char[]) null, "asdf".toCharArray())); - assertFalse(StringTools.stringsAreEqual("asdf".toCharArray(), (char[]) null)); - assertTrue(StringTools.stringsAreEqual("asdf".toCharArray(), "asdf".toCharArray())); - assertFalse(StringTools.stringsAreEqual("asdf".toCharArray(), "ASDF".toCharArray())); - } - - public void testStringsAreEqualIgnoreCaseStringString() { - assertTrue(StringTools.stringsAreEqualIgnoreCase((String) null, (String) null)); - assertFalse(StringTools.stringsAreEqualIgnoreCase(null, "asdf")); - assertFalse(StringTools.stringsAreEqualIgnoreCase("asdf", null)); - assertTrue(StringTools.stringsAreEqualIgnoreCase("asdf", "asdf")); - assertTrue(StringTools.stringsAreEqualIgnoreCase("asdf", "ASDF")); - } - - public void testStringsAreEqualIgnoreCaseCharArrayCharArray() { - assertTrue(StringTools.stringsAreEqualIgnoreCase((char[]) null, (char[]) null)); - assertFalse(StringTools.stringsAreEqualIgnoreCase((char[]) null, "asdf".toCharArray())); - assertFalse(StringTools.stringsAreEqualIgnoreCase("asdf".toCharArray(), (char[]) null)); - assertTrue(StringTools.stringsAreEqualIgnoreCase("asdf".toCharArray(), "asdf".toCharArray())); - assertTrue(StringTools.stringsAreEqualIgnoreCase("asdf".toCharArray(), "ASDF".toCharArray())); - } - - public void testStringStartsWithIgnoreCaseStringString() { - assertTrue(StringTools.stringStartsWithIgnoreCase("asdf", "as")); - assertTrue(StringTools.stringStartsWithIgnoreCase("asdf", "aS")); - assertTrue(StringTools.stringStartsWithIgnoreCase("asdf", "")); - assertTrue(StringTools.stringStartsWithIgnoreCase("asdf", "A")); - - assertFalse(StringTools.stringStartsWithIgnoreCase("asdf", "bsdf")); - assertFalse(StringTools.stringStartsWithIgnoreCase("asdf", "g")); - assertFalse(StringTools.stringStartsWithIgnoreCase("asdf", "asdg")); - assertFalse(StringTools.stringStartsWithIgnoreCase("asdf", "asdfg")); - assertFalse(StringTools.stringStartsWithIgnoreCase("asdf", "asdfgggggg")); - } - - public void testStringStartsWithIgnoreCaseCharArrayCharArray() { - assertTrue(StringTools.stringStartsWithIgnoreCase("asdf".toCharArray(), "as".toCharArray())); - assertTrue(StringTools.stringStartsWithIgnoreCase("asdf".toCharArray(), "aS".toCharArray())); - assertTrue(StringTools.stringStartsWithIgnoreCase("asdf".toCharArray(), "".toCharArray())); - assertTrue(StringTools.stringStartsWithIgnoreCase("asdf".toCharArray(), "A".toCharArray())); - assertTrue(StringTools.stringStartsWithIgnoreCase("asdf".toCharArray(), "ASDF".toCharArray())); - assertTrue(StringTools.stringStartsWithIgnoreCase("asdf".toCharArray(), "asdf".toCharArray())); - - assertFalse(StringTools.stringStartsWithIgnoreCase("asdf".toCharArray(), "bsdf".toCharArray())); - assertFalse(StringTools.stringStartsWithIgnoreCase("asdf".toCharArray(), "g".toCharArray())); - assertFalse(StringTools.stringStartsWithIgnoreCase("asdf".toCharArray(), "asdg".toCharArray())); - assertFalse(StringTools.stringStartsWithIgnoreCase("asdf".toCharArray(), "asdfg".toCharArray())); - assertFalse(StringTools.stringStartsWithIgnoreCase("asdf".toCharArray(), "asdfgggggg".toCharArray())); - } - - public void testCharactersAreEqualIgnoreCase() { - assertTrue(StringTools.charactersAreEqualIgnoreCase('a', 'a')); - assertTrue(StringTools.charactersAreEqualIgnoreCase('a', 'A')); - assertTrue(StringTools.charactersAreEqualIgnoreCase('A', 'a')); - assertTrue(StringTools.charactersAreEqualIgnoreCase('A', 'A')); - - assertFalse(StringTools.charactersAreEqualIgnoreCase('a', 'b')); - assertFalse(StringTools.charactersAreEqualIgnoreCase('A', 'b')); - } - - public void testStringIsUppercase() { - this.verifyStringIsUppercase("FOO"); - this.verifyStringIsUppercase("FOO2"); - this.verifyStringIsUppercase("F O O"); - this.denyStringIsUppercase("Foo"); - this.denyStringIsUppercase(""); - } - - private void verifyStringIsUppercase(String s) { - assertTrue(StringTools.stringIsUppercase(s)); - assertTrue(StringTools.stringIsUppercase(s.toCharArray())); - } - - private void denyStringIsUppercase(String s) { - assertFalse(StringTools.stringIsUppercase(s)); - assertFalse(StringTools.stringIsUppercase(s.toCharArray())); - } - - public void testStringIsLowercase() { - this.verifyStringIsLowercase("foo"); - this.verifyStringIsLowercase("foo2"); - this.verifyStringIsLowercase("f o o"); - this.denyStringIsLowercase("Foo"); - this.denyStringIsLowercase(""); - } - - private void verifyStringIsLowercase(String s) { - assertTrue(StringTools.stringIsLowercase(s)); - assertTrue(StringTools.stringIsLowercase(s.toCharArray())); - } - - private void denyStringIsLowercase(String s) { - assertFalse(StringTools.stringIsLowercase(s)); - assertFalse(StringTools.stringIsLowercase(s.toCharArray())); - } - - // ********** convert camel-case to all-caps ********** - - public void testConvertCamelCaseToAllCaps() { - assertEquals("TEST", StringTools.convertCamelCaseToAllCaps("test")); - assertEquals("TEST", StringTools.convertCamelCaseToAllCaps("TEST")); - assertEquals("TEST_TEST", StringTools.convertCamelCaseToAllCaps("testTest")); - assertEquals("TEST_TEST", StringTools.convertCamelCaseToAllCaps("TestTest")); - assertEquals("TEST_TEST_TEST", StringTools.convertCamelCaseToAllCaps("testTESTTest")); - assertEquals("TEST_TEST_TEST", StringTools.convertCamelCaseToAllCaps("TestTESTTest")); - assertEquals("TEST_TEST_TEST_T", StringTools.convertCamelCaseToAllCaps("TestTESTTestT")); - } - - public void testConvertCamelCaseToAllCapsOnWriter() { - this.verifyConvertCamelCaseToAllCapsOnWriter("TEST", "test"); - this.verifyConvertCamelCaseToAllCapsOnWriter("TEST", "TEST"); - this.verifyConvertCamelCaseToAllCapsOnWriter("TEST_TEST", "testTest"); - this.verifyConvertCamelCaseToAllCapsOnWriter("TEST_TEST", "TestTest"); - this.verifyConvertCamelCaseToAllCapsOnWriter("TEST_TEST_TEST", "testTESTTest"); - this.verifyConvertCamelCaseToAllCapsOnWriter("TEST_TEST_TEST", "TestTESTTest"); - this.verifyConvertCamelCaseToAllCapsOnWriter("TEST_TEST_TEST_T", "TestTESTTestT"); - } - - private void verifyConvertCamelCaseToAllCapsOnWriter(String expected, String string) { - Writer writer = new StringWriter(); - StringTools.convertCamelCaseToAllCapsOn(string, writer); - assertEquals(expected, writer.toString()); - } - - public void testConvertCamelCaseToAllCapsOnStringBuffer() { - this.verifyConvertCamelCaseToAllCapsOnStringBuffer("TEST", "test"); - this.verifyConvertCamelCaseToAllCapsOnStringBuffer("TEST", "TEST"); - this.verifyConvertCamelCaseToAllCapsOnStringBuffer("TEST_TEST", "testTest"); - this.verifyConvertCamelCaseToAllCapsOnStringBuffer("TEST_TEST", "TestTest"); - this.verifyConvertCamelCaseToAllCapsOnStringBuffer("TEST_TEST_TEST", "testTESTTest"); - this.verifyConvertCamelCaseToAllCapsOnStringBuffer("TEST_TEST_TEST", "TestTESTTest"); - this.verifyConvertCamelCaseToAllCapsOnStringBuffer("TEST_TEST_TEST_T", "TestTESTTestT"); - } - - private void verifyConvertCamelCaseToAllCapsOnStringBuffer(String expected, String string) { - StringBuffer sb = new StringBuffer(); - StringTools.convertCamelCaseToAllCapsOn(string, sb); - assertEquals(expected, sb.toString()); - } - - public void testConvertCamelCaseToAllCapsOnStringBuilder() { - this.verifyConvertCamelCaseToAllCapsOnStringBuilder("TEST", "test"); - this.verifyConvertCamelCaseToAllCapsOnStringBuilder("TEST", "TEST"); - this.verifyConvertCamelCaseToAllCapsOnStringBuilder("TEST_TEST", "testTest"); - this.verifyConvertCamelCaseToAllCapsOnStringBuilder("TEST_TEST", "TestTest"); - this.verifyConvertCamelCaseToAllCapsOnStringBuilder("TEST_TEST_TEST", "testTESTTest"); - this.verifyConvertCamelCaseToAllCapsOnStringBuilder("TEST_TEST_TEST", "TestTESTTest"); - this.verifyConvertCamelCaseToAllCapsOnStringBuilder("TEST_TEST_TEST_T", "TestTESTTestT"); - } - - private void verifyConvertCamelCaseToAllCapsOnStringBuilder(String expected, String string) { - StringBuilder sb = new StringBuilder(); - StringTools.convertCamelCaseToAllCapsOn(string, sb); - assertEquals(expected, sb.toString()); - } - - public void testConvertCamelCaseToAllCapsMaxLength() { - assertEquals("TEST", StringTools.convertCamelCaseToAllCaps("test", 44)); - assertEquals("TEST", StringTools.convertCamelCaseToAllCaps("test", 4)); - assertEquals("TES", StringTools.convertCamelCaseToAllCaps("test", 3)); - assertEquals("TEST", StringTools.convertCamelCaseToAllCaps("TEST", 5)); - assertEquals("TE", StringTools.convertCamelCaseToAllCaps("TEST", 2)); - assertEquals("TEST_TEST", StringTools.convertCamelCaseToAllCaps("testTest", 9)); - assertEquals("TEST_TES", StringTools.convertCamelCaseToAllCaps("testTest", 8)); - assertEquals("TEST_T", StringTools.convertCamelCaseToAllCaps("testTest", 6)); - assertEquals("TEST_", StringTools.convertCamelCaseToAllCaps("testTest", 5)); - assertEquals("TEST", StringTools.convertCamelCaseToAllCaps("testTest", 4)); - assertEquals("TEST_TEST", StringTools.convertCamelCaseToAllCaps("TestTest", 9)); - assertEquals("TEST_TEST", StringTools.convertCamelCaseToAllCaps("TestTest", 1100)); - assertEquals("TEST_TEST_", StringTools.convertCamelCaseToAllCaps("testTESTTest", 10)); - assertEquals("TEST_TEST_TEST", StringTools.convertCamelCaseToAllCaps("TestTESTTest", 14)); - assertEquals("TEST_TEST_TEST_T", StringTools.convertCamelCaseToAllCaps("TestTESTTestT", 16)); - assertEquals("TEST_TEST_TEST_", StringTools.convertCamelCaseToAllCaps("TestTESTTestT", 15)); - } - - public void testConvertCamelCaseToAllCapsMaxLengthOnWriter() { - this.verifyConvertCamelCaseToAllCapsMaxLengthOnWriter("TEST", "test", 44); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnWriter("TEST", "test", 4); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnWriter("TES", "test", 3); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnWriter("TEST", "TEST", 5); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnWriter("TE", "TEST", 2); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnWriter("TEST_TEST", "testTest", 9); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnWriter("TEST_TES", "testTest", 8); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnWriter("TEST_T", "testTest", 6); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnWriter("TEST_", "testTest", 5); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnWriter("TEST", "testTest", 4); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnWriter("TEST_TEST", "TestTest", 9); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnWriter("TEST_TEST", "TestTest", 1100); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnWriter("TEST_TEST_", "testTESTTest", 10); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnWriter("TEST_TEST_TEST", "TestTESTTest", 14); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnWriter("TEST_TEST_TEST_T", "TestTESTTestT", 16); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnWriter("TEST_TEST_TEST_", "TestTESTTestT", 15); - } - - private void verifyConvertCamelCaseToAllCapsMaxLengthOnWriter(String expected, String string, int max) { - Writer writer = new StringWriter(); - StringTools.convertCamelCaseToAllCapsOn(string, max, writer); - assertEquals(expected, writer.toString()); - } - - public void testConvertCamelCaseToAllCapsMaxLengthOnStringBuffer() { - this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST", "test", 44); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST", "test", 4); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TES", "test", 3); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST", "TEST", 5); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TE", "TEST", 2); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_TEST", "testTest", 9); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_TES", "testTest", 8); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_T", "testTest", 6); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_", "testTest", 5); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST", "testTest", 4); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_TEST", "TestTest", 9); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_TEST", "TestTest", 1100); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_TEST_", "testTESTTest", 10); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_TEST_TEST", "TestTESTTest", 14); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_TEST_TEST_T", "TestTESTTestT", 16); - this.verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer("TEST_TEST_TEST_", "TestTESTTestT", 15); - } - - private void verifyConvertCamelCaseToAllCapsMaxLengthOnStringBuffer(String expected, String string, int max) { - StringBuffer sb = new StringBuffer(); - StringTools.convertCamelCaseToAllCapsOn(string, max, sb); - assertEquals(expected, sb.toString()); - } - - // ********** convert underscores to all-caps ********** - - public void testConvertUnderscoresToCamelCase() { - assertEquals("test", StringTools.convertUnderscoresToCamelCase("TEST", false)); - assertEquals("test", StringTools.convertUnderscoresToCamelCase("TEST_", false)); - assertEquals("test", StringTools.convertUnderscoresToCamelCase("TEST____", false)); - assertEquals("Test", StringTools.convertUnderscoresToCamelCase("TEST", true)); - assertEquals("test", StringTools.convertUnderscoresToCamelCase("TeST", false)); - assertEquals("testTest", StringTools.convertUnderscoresToCamelCase("TEST_TEST", false)); - assertEquals("testTest", StringTools.convertUnderscoresToCamelCase("TEST___TEST", false)); - assertEquals("TestTest", StringTools.convertUnderscoresToCamelCase("TEST_TEST", true)); - assertEquals("testTestTest", StringTools.convertUnderscoresToCamelCase("TEST_TEST_TEST", false)); - assertEquals("TestTestTest", StringTools.convertUnderscoresToCamelCase("TEST_TEST_TEST", true)); - assertEquals("testTestTestT", StringTools.convertUnderscoresToCamelCase("TEST_TEST_TEST_T", false)); - assertEquals("testTestTestT", StringTools.convertUnderscoresToCamelCase("_TEST_TEST_TEST_T", false)); - assertEquals("testTestTestT", StringTools.convertUnderscoresToCamelCase("__TEST_TEST_TEST_T", false)); - assertEquals("TestTestTestT", StringTools.convertUnderscoresToCamelCase("TEST_TEST_TEST_T", true)); - assertEquals("TestTestTestT", StringTools.convertUnderscoresToCamelCase("_TEST_TEST_TEST_T", true)); - assertEquals("TestTestTestT", StringTools.convertUnderscoresToCamelCase("__TEST_TEST_TEST_T", true)); - } - - public void testConvertUnderscoresToCamelCaseLowercase() { - assertEquals("test", StringTools.convertUnderscoresToCamelCase("test", false)); - assertEquals("test", StringTools.convertUnderscoresToCamelCase("test_", false)); - assertEquals("test", StringTools.convertUnderscoresToCamelCase("test____", false)); - assertEquals("Test", StringTools.convertUnderscoresToCamelCase("test", true)); - assertEquals("test", StringTools.convertUnderscoresToCamelCase("test", false)); - assertEquals("testTest", StringTools.convertUnderscoresToCamelCase("test_test", false)); - assertEquals("testTest", StringTools.convertUnderscoresToCamelCase("test___test", false)); - assertEquals("TestTest", StringTools.convertUnderscoresToCamelCase("test_test", true)); - assertEquals("testTestTest", StringTools.convertUnderscoresToCamelCase("test_test_test", false)); - assertEquals("TestTestTest", StringTools.convertUnderscoresToCamelCase("test_test_test", true)); - assertEquals("testTestTestT", StringTools.convertUnderscoresToCamelCase("test_test_test_t", false)); - assertEquals("testTestTestT", StringTools.convertUnderscoresToCamelCase("_test_test_test_t", false)); - assertEquals("testTestTestT", StringTools.convertUnderscoresToCamelCase("__test_test_test_t", false)); - assertEquals("TestTestTestT", StringTools.convertUnderscoresToCamelCase("test_test_test_t", true)); - assertEquals("TestTestTestT", StringTools.convertUnderscoresToCamelCase("_test_test_test_t", true)); - assertEquals("TestTestTestT", StringTools.convertUnderscoresToCamelCase("__test_test_test_t", true)); - } - - public void testConvertUnderscoresToCamelCaseOnWriter() { - this.verifyConvertUnderscoresToCamelCaseOnWriter("test", "TEST", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("test", "TEST_", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("test", "TEST____", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("Test", "TEST", true); - this.verifyConvertUnderscoresToCamelCaseOnWriter("test", "TeST", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("testTest", "TEST_TEST", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("testTest", "TEST___TEST", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("TestTest", "TEST_TEST", true); - this.verifyConvertUnderscoresToCamelCaseOnWriter("testTestTest", "TEST_TEST_TEST", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("TestTestTest", "TEST_TEST_TEST", true); - this.verifyConvertUnderscoresToCamelCaseOnWriter("testTestTestT", "TEST_TEST_TEST_T", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("testTestTestT", "_TEST_TEST_TEST_T", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("testTestTestT", "__TEST_TEST_TEST_T", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("TestTestTestT", "TEST_TEST_TEST_T", true); - this.verifyConvertUnderscoresToCamelCaseOnWriter("TestTestTestT", "_TEST_TEST_TEST_T", true); - this.verifyConvertUnderscoresToCamelCaseOnWriter("TestTestTestT", "__TEST_TEST_TEST_T", true); - } - - public void testConvertUnderscoresToCamelCaseOnWriterLowercase() { - this.verifyConvertUnderscoresToCamelCaseOnWriter("test", "test", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("test", "test_", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("test", "test____", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("Test", "test", true); - this.verifyConvertUnderscoresToCamelCaseOnWriter("test", "test", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("testTest", "test_test", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("testTest", "test___test", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("TestTest", "test_test", true); - this.verifyConvertUnderscoresToCamelCaseOnWriter("testTestTest", "test_test_test", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("TestTestTest", "test_test_test", true); - this.verifyConvertUnderscoresToCamelCaseOnWriter("testTestTestT", "test_test_test_t", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("testTestTestT", "_test_test_test_t", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("testTestTestT", "__test_test_test_t", false); - this.verifyConvertUnderscoresToCamelCaseOnWriter("TestTestTestT", "test_test_test_t", true); - this.verifyConvertUnderscoresToCamelCaseOnWriter("TestTestTestT", "_test_test_test_t", true); - this.verifyConvertUnderscoresToCamelCaseOnWriter("TestTestTestT", "__test_test_test_t", true); - } - - private void verifyConvertUnderscoresToCamelCaseOnWriter(String expected, String string, boolean capitalizeFirstLetter) { - Writer writer = new StringWriter(); - StringTools.convertUnderscoresToCamelCaseOn(string, capitalizeFirstLetter, writer); - assertEquals(expected, writer.toString()); - } - - public void testConvertUnderscoresToCamelCaseOnStringBuffer() { - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("test", "TEST", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("test", "TEST_", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("test", "TEST____", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("Test", "TEST", true); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("test", "TeST", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTest", "TEST_TEST", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTest", "TEST___TEST", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTest", "TEST_TEST", true); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTestTest", "TEST_TEST_TEST", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTestTest", "TEST_TEST_TEST", true); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTestTestT", "TEST_TEST_TEST_T", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTestTestT", "_TEST_TEST_TEST_T", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTestTestT", "__TEST_TEST_TEST_T", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTestTestT", "TEST_TEST_TEST_T", true); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTestTestT", "_TEST_TEST_TEST_T", true); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTestTestT", "__TEST_TEST_TEST_T", true); - } - - public void testConvertUnderscoresToCamelCaseOnStringBufferLowercase() { - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("test", "test", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("test", "test_", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("test", "test____", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("Test", "test", true); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("test", "test", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTest", "test_test", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTest", "test___test", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTest", "test_test", true); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTestTest", "test_test_test", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTestTest", "test_test_test", true); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTestTestT", "test_test_test_t", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTestTestT", "_test_test_test_t", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("testTestTestT", "__test_test_test_t", false); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTestTestT", "test_test_test_t", true); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTestTestT", "_test_test_test_t", true); - this.verifyConvertUnderscoresToCamelCaseOnStringBuffer("TestTestTestT", "__test_test_test_t", true); - } - - private void verifyConvertUnderscoresToCamelCaseOnStringBuffer(String expected, String string, boolean capitalizeFirstLetter) { - StringBuffer sb = new StringBuffer(); - StringTools.convertUnderscoresToCamelCaseOn(string, capitalizeFirstLetter, sb); - assertEquals(expected, sb.toString()); - } - - // ********** delimiting ********** - - public void testStringIsQuoted() { - this.denyStringIsQuoted("foo"); - this.verifyStringIsQuoted("\"foo\""); - - this.denyStringIsQuoted(""); - this.verifyStringIsQuoted("\"\""); - - this.denyStringIsQuoted("\""); - this.denyStringIsQuoted(" "); - this.denyStringIsQuoted("''"); - this.denyStringIsQuoted("'foo'"); - } - - private void verifyStringIsQuoted(String s) { - assertTrue(StringTools.stringIsQuoted(s)); - assertTrue(StringTools.stringIsQuoted(s.toCharArray())); - } - - private void denyStringIsQuoted(String s) { - assertFalse(StringTools.stringIsQuoted(s)); - assertFalse(StringTools.stringIsQuoted(s.toCharArray())); - } - - public void testStringIsParenthetical() { - this.denyStringIsParenthetical("foo"); - this.verifyStringIsParenthetical("(foo)"); - - this.denyStringIsParenthetical(""); - this.verifyStringIsParenthetical("()"); - - this.denyStringIsParenthetical("("); - this.denyStringIsParenthetical(" "); - this.denyStringIsParenthetical("''"); - this.denyStringIsParenthetical("'foo'"); - } - - private void verifyStringIsParenthetical(String s) { - assertTrue(StringTools.stringIsParenthetical(s)); - assertTrue(StringTools.stringIsParenthetical(s.toCharArray())); - } - - private void denyStringIsParenthetical(String s) { - assertFalse(StringTools.stringIsParenthetical(s)); - assertFalse(StringTools.stringIsParenthetical(s.toCharArray())); - } - - public void testStringIsBracketed() { - this.denyStringIsBracketed("foo"); - this.verifyStringIsBracketed("[foo]"); - - this.denyStringIsBracketed(""); - this.verifyStringIsBracketed("[]"); - - this.denyStringIsBracketed("["); - this.denyStringIsBracketed(" "); - this.denyStringIsBracketed("''"); - this.denyStringIsBracketed("'foo'"); - } - - private void verifyStringIsBracketed(String s) { - assertTrue(StringTools.stringIsBracketed(s)); - assertTrue(StringTools.stringIsBracketed(s.toCharArray())); - } - - private void denyStringIsBracketed(String s) { - assertFalse(StringTools.stringIsBracketed(s)); - assertFalse(StringTools.stringIsBracketed(s.toCharArray())); - } - - public void testStringIsBraced() { - this.denyStringIsBraced("foo"); - this.verifyStringIsBraced("{foo}"); - - this.denyStringIsBraced(""); - this.verifyStringIsBraced("{}"); - - this.denyStringIsBraced("{"); - this.denyStringIsBraced(" "); - this.denyStringIsBraced("''"); - this.denyStringIsBraced("'foo'"); - } - - private void verifyStringIsBraced(String s) { - assertTrue(StringTools.stringIsBraced(s)); - assertTrue(StringTools.stringIsBraced(s.toCharArray())); - } - - private void denyStringIsBraced(String s) { - assertFalse(StringTools.stringIsBraced(s)); - assertFalse(StringTools.stringIsBraced(s.toCharArray())); - } - - public void testStringIsChevroned() { - this.denyStringIsChevroned("foo"); - this.verifyStringIsChevroned(""); - - this.denyStringIsChevroned(""); - this.verifyStringIsChevroned("<>"); - - this.denyStringIsChevroned("{"); - this.denyStringIsChevroned(" "); - this.denyStringIsChevroned("''"); - this.denyStringIsChevroned("'foo'"); - } - - private void verifyStringIsChevroned(String s) { - assertTrue(StringTools.stringIsChevroned(s)); - assertTrue(StringTools.stringIsChevroned(s.toCharArray())); - } - - private void denyStringIsChevroned(String s) { - assertFalse(StringTools.stringIsChevroned(s)); - assertFalse(StringTools.stringIsChevroned(s.toCharArray())); - } - - public void testStringIsDelimited() { - this.denyStringIsDelimited("foo", '?'); - this.verifyStringIsDelimited("?foo?", '?'); - - this.denyStringIsDelimited("", '?'); - this.verifyStringIsDelimited("\"\"", '"'); - this.verifyStringIsDelimited("?xx?", '?'); - this.denyStringIsDelimited("?xx]", '?'); - - this.denyStringIsDelimited("\"", '"'); - this.denyStringIsDelimited(" ", ' '); - this.denyStringIsDelimited("''", '"'); - this.denyStringIsDelimited("'foo'", '?'); - } - - private void verifyStringIsDelimited(String s, char c) { - assertTrue(StringTools.stringIsDelimited(s, c)); - assertTrue(StringTools.stringIsDelimited(s.toCharArray(), c)); - } - - private void denyStringIsDelimited(String s, char c) { - assertFalse(StringTools.stringIsDelimited(s, c)); - assertFalse(StringTools.stringIsDelimited(s.toCharArray(), c)); - } - - public void testStringIsDelimited2() { - this.denyStringIsDelimited2("foo", '[', ']'); - this.verifyStringIsDelimited2("{foo}", '{', '}'); - - this.denyStringIsDelimited2("", '[', ']'); - this.verifyStringIsDelimited2("[]", '[', ']'); - this.verifyStringIsDelimited2("[xx]", '[', ']'); - this.denyStringIsDelimited2("?xx]", '[', ']'); - - this.denyStringIsDelimited2("\"", '[', ']'); - this.denyStringIsDelimited2(" ", '[', ']'); - this.denyStringIsDelimited2("''", '[', ']'); - this.denyStringIsDelimited2("'foo'", '[', ']'); - } - - private void verifyStringIsDelimited2(String s, char start, char end) { - assertTrue(StringTools.stringIsDelimited(s, start, end)); - assertTrue(StringTools.stringIsDelimited(s.toCharArray(), start, end)); - } - - private void denyStringIsDelimited2(String s, char start, char end) { - assertFalse(StringTools.stringIsDelimited(s, start, end)); - assertFalse(StringTools.stringIsDelimited(s.toCharArray(), start, end)); - } - - // ********** undelimiting ********** - - public void testUndelimit() { - this.verifyUndelimit("\"foo\"", "foo"); - this.verifyUndelimit("\"\"", ""); - this.verifyUndelimit("'foo'", "foo"); - this.verifyUndelimit("\"fo\"\"o\"", "fo\"o"); - this.verifyUndelimit("\"foo\"\"\"", "foo\""); - this.verifyUndelimit("\"\"\"foo\"", "\"foo"); - this.verifyUndelimit("[foo]", "foo"); - this.verifyUndelimit("\"\"\"", "\""); - this.verifyUndelimit("\"foo\"bar\"", "foo\""); - this.verifyUndelimit("\"foo\"\"", "foo\""); - } - - private void verifyUndelimit(String s, String expected) { - assertEquals(expected, StringTools.undelimit(s)); - assertEquals(expected, StringTools.undelimit(s.toCharArray())); - } - - public void testUndelimitInt() { - this.verifyUndelimitInt("\"foo\"", 2, "o"); - this.verifyUndelimitInt("\"\"foo\"\"", 2, "foo"); - this.verifyUndelimitInt("'foo'", 2, "o"); - } - - private void verifyUndelimitInt(String s, int count, String expected) { - assertEquals(expected, StringTools.undelimit(s, count)); - assertEquals(expected, StringTools.undelimit(s.toCharArray(), count)); - } - - public void testUndelimitIntException() { - this.denyUndelimitInt("\"\"", 2); - this.denyUndelimitInt("'o'", 2); - } - - private void denyUndelimitInt(String s, int count) { - boolean exCaught = false; - try { - String bogus = StringTools.undelimit(s, count); - fail("invalid string: " + bogus); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - exCaught = false; - try { - char[] bogus = StringTools.undelimit(s.toCharArray(), count); - fail("invalid string: " + new String(bogus)); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testUndelimitOnWriter() { - this.verifyUndelimitOnWriter("\"foo\"", "foo"); - this.verifyUndelimitOnWriter("\"\"", ""); - this.verifyUndelimitOnWriter("'foo'", "foo"); - this.verifyUndelimitOnWriter("\"fo\"\"o\"", "fo\"o"); - this.verifyUndelimitOnWriter("\"foo\"\"\"", "foo\""); - this.verifyUndelimitOnWriter("\"\"\"foo\"", "\"foo"); - this.verifyUndelimitOnWriter("[foo]", "foo"); - this.verifyUndelimitOnWriter("\"\"\"", "\""); - this.verifyUndelimitOnWriter("\"foo\"bar\"", "foo\""); - this.verifyUndelimitOnWriter("\"foo\"\"", "foo\""); - } - - private void verifyUndelimitOnWriter(String s, String expected) { - Writer writer = new StringWriter(); - StringTools.undelimitOn(s, writer); - assertEquals(expected, writer.toString()); - - writer = new StringWriter(); - StringTools.undelimitOn(s.toCharArray(), writer); - assertEquals(expected, writer.toString()); - } - - public void testUndelimitOnStringBuffer() { - this.verifyUndelimitOnStringBuffer("\"foo\"", "foo"); - this.verifyUndelimitOnStringBuffer("\"\"", ""); - this.verifyUndelimitOnStringBuffer("'foo'", "foo"); - this.verifyUndelimitOnStringBuffer("\"fo\"\"o\"", "fo\"o"); - this.verifyUndelimitOnStringBuffer("\"foo\"\"\"", "foo\""); - this.verifyUndelimitOnStringBuffer("\"\"\"foo\"", "\"foo"); - this.verifyUndelimitOnStringBuffer("[foo]", "foo"); - this.verifyUndelimitOnStringBuffer("\"\"\"", "\""); - this.verifyUndelimitOnStringBuffer("\"foo\"bar\"", "foo\""); - this.verifyUndelimitOnStringBuffer("\"foo\"\"", "foo\""); - } - - private void verifyUndelimitOnStringBuffer(String s, String expected) { - StringBuffer sb = new StringBuffer(); - StringTools.undelimitOn(s, sb); - assertEquals(expected, sb.toString()); - - sb = new StringBuffer(); - StringTools.undelimitOn(s.toCharArray(), sb); - assertEquals(expected, sb.toString()); - } - - public void testUndelimitOnStringBuilder() { - this.verifyUndelimitOnStringBuilder("\"foo\"", "foo"); - this.verifyUndelimitOnStringBuilder("\"\"", ""); - this.verifyUndelimitOnStringBuilder("'foo'", "foo"); - this.verifyUndelimitOnStringBuilder("\"fo\"\"o\"", "fo\"o"); - this.verifyUndelimitOnStringBuilder("\"foo\"\"\"", "foo\""); - this.verifyUndelimitOnStringBuilder("\"\"\"foo\"", "\"foo"); - this.verifyUndelimitOnStringBuilder("[foo]", "foo"); - this.verifyUndelimitOnStringBuilder("\"\"\"", "\""); - this.verifyUndelimitOnStringBuilder("\"foo\"bar\"", "foo\""); - this.verifyUndelimitOnStringBuilder("\"foo\"\"", "foo\""); - } - - private void verifyUndelimitOnStringBuilder(String s, String expected) { - StringBuilder sb = new StringBuilder(); - StringTools.undelimitOn(s, sb); - assertEquals(expected, sb.toString()); - - sb = new StringBuilder(); - StringTools.undelimitOn(s.toCharArray(), sb); - assertEquals(expected, sb.toString()); - } - - public void testUndelimitOnWriterCount() { - this.verifyUndelimitOnWriterCount("\"foo\"", 2, "o"); - this.verifyUndelimitOnWriterCount("\"\"\"\"", 2, ""); - this.verifyUndelimitOnWriterCount("XXfooXX", 2, "foo"); - } - - private void verifyUndelimitOnWriterCount(String s, int count, String expected) { - Writer writer = new StringWriter(); - StringTools.undelimitOn(s, count, writer); - assertEquals(expected, writer.toString()); - - writer = new StringWriter(); - StringTools.undelimitOn(s.toCharArray(), count, writer); - assertEquals(expected, writer.toString()); - } - - public void testUndelimitOnStringBufferCount() { - this.verifyUndelimitOnStringBufferCount("\"foo\"", 2, "o"); - this.verifyUndelimitOnStringBufferCount("\"\"\"\"", 2, ""); - this.verifyUndelimitOnStringBufferCount("XXfooXX", 2, "foo"); - } - - private void verifyUndelimitOnStringBufferCount(String s, int count, String expected) { - StringBuffer sb = new StringBuffer(); - StringTools.undelimitOn(s, count, sb); - assertEquals(expected, sb.toString()); - - sb = new StringBuffer(); - StringTools.undelimitOn(s.toCharArray(), count, sb); - assertEquals(expected, sb.toString()); - } - - public void testUndelimitOnStringBuilderCount() { - this.verifyUndelimitOnStringBuilderCount("\"foo\"", 2, "o"); - this.verifyUndelimitOnStringBuilderCount("\"\"\"\"", 2, ""); - this.verifyUndelimitOnStringBuilderCount("XXfooXX", 2, "foo"); - } - - private void verifyUndelimitOnStringBuilderCount(String s, int count, String expected) { - StringBuilder sb = new StringBuilder(); - StringTools.undelimitOn(s, count, sb); - assertEquals(expected, sb.toString()); - - sb = new StringBuilder(); - StringTools.undelimitOn(s.toCharArray(), count, sb); - assertEquals(expected, sb.toString()); - } - - // ********** converting to Java string literal ********** - - public void testConvertToJavaStringLiteral() { - this.verifyConvertToJavaStringLiteral("", "\"\""); - this.verifyConvertToJavaStringLiteral("\"\"", "\"\\\"\\\"\""); - this.verifyConvertToJavaStringLiteral("'foo'", "\"'foo'\""); - this.verifyConvertToJavaStringLiteral("foo\bbar", "\"foo\\bbar\""); - this.verifyConvertToJavaStringLiteral("foo\n\tbar", "\"foo\\n\\tbar\""); - this.verifyConvertToJavaStringLiteral("foo\"bar", "\"foo\\\"bar\""); - this.verifyConvertToJavaStringLiteral("foo\\bar", "\"foo\\\\bar\""); - } - - private void verifyConvertToJavaStringLiteral(String s, String expected) { - assertEquals(expected, StringTools.convertToJavaStringLiteral(s)); - assertEquals(expected, StringTools.convertToJavaStringLiteral(s.toCharArray())); - } - - public void testConvertToJavaStringLiteralOnStringBuffer() { - this.verifyConvertToJavaStringLiteralOnStringBuffer("", "\"\""); - this.verifyConvertToJavaStringLiteralOnStringBuffer("\"\"", "\"\\\"\\\"\""); - this.verifyConvertToJavaStringLiteralOnStringBuffer("'foo'", "\"'foo'\""); - this.verifyConvertToJavaStringLiteralOnStringBuffer("foo\bbar", "\"foo\\bbar\""); - this.verifyConvertToJavaStringLiteralOnStringBuffer("foo\n\tbar", "\"foo\\n\\tbar\""); - this.verifyConvertToJavaStringLiteralOnStringBuffer("foo\"bar", "\"foo\\\"bar\""); - this.verifyConvertToJavaStringLiteralOnStringBuffer("foo\\bar", "\"foo\\\\bar\""); - } - - private void verifyConvertToJavaStringLiteralOnStringBuffer(String s, String expected) { - StringBuffer sb = new StringBuffer(); - StringTools.convertToJavaStringLiteralOn(s, sb); - assertEquals(expected, sb.toString()); - - sb = new StringBuffer(); - StringTools.convertToJavaStringLiteralOn(s.toCharArray(), sb); - assertEquals(expected, sb.toString()); - } - - public void testConvertToJavaStringLiteralOnStringBuilder() { - this.verifyConvertToJavaStringLiteralOnStringBuilder("", "\"\""); - this.verifyConvertToJavaStringLiteralOnStringBuilder("\"\"", "\"\\\"\\\"\""); - this.verifyConvertToJavaStringLiteralOnStringBuilder("'foo'", "\"'foo'\""); - this.verifyConvertToJavaStringLiteralOnStringBuilder("foo\bbar", "\"foo\\bbar\""); - this.verifyConvertToJavaStringLiteralOnStringBuilder("foo\n\tbar", "\"foo\\n\\tbar\""); - this.verifyConvertToJavaStringLiteralOnStringBuilder("foo\"bar", "\"foo\\\"bar\""); - this.verifyConvertToJavaStringLiteralOnStringBuilder("foo\\bar", "\"foo\\\\bar\""); - } - - private void verifyConvertToJavaStringLiteralOnStringBuilder(String s, String expected) { - StringBuilder sb = new StringBuilder(); - StringTools.convertToJavaStringLiteralOn(s, sb); - assertEquals(expected, sb.toString()); - - sb = new StringBuilder(); - StringTools.convertToJavaStringLiteralOn(s.toCharArray(), sb); - assertEquals(expected, sb.toString()); - } - - public void testConvertToJavaStringLiteralOnWriter() { - this.verifyConvertToJavaStringLiteralOnWriter("", "\"\""); - this.verifyConvertToJavaStringLiteralOnWriter("\"\"", "\"\\\"\\\"\""); - this.verifyConvertToJavaStringLiteralOnWriter("'foo'", "\"'foo'\""); - this.verifyConvertToJavaStringLiteralOnWriter("foo\bbar", "\"foo\\bbar\""); - this.verifyConvertToJavaStringLiteralOnWriter("foo\n\tbar", "\"foo\\n\\tbar\""); - this.verifyConvertToJavaStringLiteralOnWriter("foo\"bar", "\"foo\\\"bar\""); - this.verifyConvertToJavaStringLiteralOnWriter("foo\\bar", "\"foo\\\\bar\""); - } - - private void verifyConvertToJavaStringLiteralOnWriter(String s, String expected) { - Writer writer = new StringWriter(); - StringTools.convertToJavaStringLiteralOn(s, writer); - assertEquals(expected, writer.toString()); - - writer = new StringWriter(); - StringTools.convertToJavaStringLiteralOn(s.toCharArray(), writer); - assertEquals(expected, writer.toString()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedBooleanTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedBooleanTests.java deleted file mode 100644 index 9847bf536f..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedBooleanTests.java +++ /dev/null @@ -1,236 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import org.eclipse.jpt.common.utility.internal.SynchronizedBoolean; - -public class SynchronizedBooleanTests - extends MultiThreadedTestCase -{ - private volatile SynchronizedBoolean sb; - volatile boolean timeoutOccurred; - volatile long startTime; - volatile long endTime; - - - public SynchronizedBooleanTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.sb = new SynchronizedBoolean(); - this.timeoutOccurred = false; - this.startTime = 0; - this.endTime = 0; - } - - public void testGetValue() throws Exception { - assertFalse(this.sb.getValue()); - } - - public void testIs() throws Exception { - assertTrue(this.sb.is(false)); - } - - public void testIsNot() throws Exception { - assertTrue(this.sb.isNot(true)); - } - - public void testIsTrue() throws Exception { - assertFalse(this.sb.isTrue()); - } - - public void testIsFalse() throws Exception { - assertTrue(this.sb.isFalse()); - } - - public void testSetValueFalse() throws Exception { - this.sb.setValue(false); - assertFalse(this.sb.getValue()); - assertFalse(this.sb.isTrue()); - assertTrue(this.sb.isFalse()); - } - - public void testSetValueTrue() throws Exception { - this.sb.setValue(true); - assertTrue(this.sb.getValue()); - assertTrue(this.sb.isTrue()); - assertFalse(this.sb.isFalse()); - } - - public void testFlip() throws Exception { - assertTrue(this.sb.flip()); - assertFalse(this.sb.flip()); - } - - public void testSetNotTrue() throws Exception { - this.sb.setNot(true); - assertFalse(this.sb.getValue()); - assertFalse(this.sb.isTrue()); - assertTrue(this.sb.isFalse()); - } - - public void testSetNotFalse() throws Exception { - this.sb.setNot(false); - assertTrue(this.sb.getValue()); - assertTrue(this.sb.isTrue()); - assertFalse(this.sb.isFalse()); - } - - public void testSetFalse() throws Exception { - this.sb.setFalse(); - assertFalse(this.sb.getValue()); - assertFalse(this.sb.isTrue()); - assertTrue(this.sb.isFalse()); - } - - public void testSetTrue() throws Exception { - this.sb.setTrue(); - assertTrue(this.sb.getValue()); - assertTrue(this.sb.isTrue()); - assertFalse(this.sb.isFalse()); - } - - public void testGetMutexThis() throws Exception { - assertSame(this.sb, this.sb.getMutex()); - } - - public void testGetMutexObject() throws Exception { - Object mutex = new Object(); - SynchronizedBoolean syncBool = new SynchronizedBoolean(mutex); - assertSame(mutex, syncBool.getMutex()); - } - - /** - * t2 will wait indefinitely until t1 sets the value to true - */ - public void testWaitUntilTrue() throws Exception { - this.verifyWaitUntilTrue(0); // 0 = indefinite wait - // no timeout occurs... - assertFalse(this.timeoutOccurred); - // ...and the value should be set to true by t2 - assertTrue(this.sb.getValue()); - // make a reasonable guess about how long t2 took - assertTrue(this.calculateElapsedTime() > TICK); - } - - /** - * t2 will time out waiting for t1 to set the value to true - */ - public void testWaitUntilTrueTimeout() throws Exception { - this.verifyWaitUntilTrue(TICK); - // timeout occurs... - assertTrue(this.timeoutOccurred); - // ...and the value will eventually be set to true by t1 - assertTrue(this.sb.getValue()); - // make a reasonable guess about how long t2 took - assertTrue(this.calculateElapsedTime() < THREE_TICKS); - } - - private void verifyWaitUntilTrue(long t2Timeout) throws Exception { - this.executeThreads(this.buildSetTrueCommand(), this.buildWaitUntilTrueCommand(t2Timeout)); - } - - /** - * t2 will wait indefinitely until t1 sets the value to false - */ - public void testWaitToSetFalse() throws Exception { - this.verifyWaitToSetFalse(0); // 0 = indefinite wait - // no timeout occurs... - assertFalse(this.timeoutOccurred); - // ...and the value should be set to false by t2 - assertFalse(this.sb.getValue()); - // make a reasonable guess about how long t2 took - assertTrue(this.calculateElapsedTime() > TICK); - } - - /** - * t2 will time out waiting for t1 to set the value to false - */ - public void testWaitToSetFalseTimeout() throws Exception { - this.verifyWaitToSetFalse(TICK); - // timeout occurs... - assertTrue(this.timeoutOccurred); - // ...and the value will eventually be set to true by t1 - assertTrue(this.sb.getValue()); - // make a reasonable guess about how long t2 took - assertTrue(this.calculateElapsedTime() < THREE_TICKS); - } - - private void verifyWaitToSetFalse(long t2Timeout) throws Exception { - this.executeThreads(this.buildSetTrueCommand(), this.buildWaitToSetFalseCommand(t2Timeout)); - } - - private void executeThreads(Command t1Command, Command t2Command) throws Exception { - this.sb.setFalse(); - Runnable r1 = this.buildRunnable(t1Command, this.sb, TWO_TICKS); - Runnable r2 = this.buildRunnable(t2Command, this.sb, 0); - Thread t1 = this.buildThread(r1); - Thread t2 = this.buildThread(r2); - t1.start(); - t2.start(); - t1.join(); - t2.join(); - } - - private Command buildSetTrueCommand() { - return new Command() { - public void execute(SynchronizedBoolean syncBool) { - syncBool.setTrue(); - } - }; - } - - private Command buildWaitUntilTrueCommand(final long timeout) { - return new Command() { - public void execute(SynchronizedBoolean syncBool) throws InterruptedException { - SynchronizedBooleanTests.this.startTime = System.currentTimeMillis(); - SynchronizedBooleanTests.this.timeoutOccurred = ! syncBool.waitUntilTrue(timeout); - SynchronizedBooleanTests.this.endTime = System.currentTimeMillis(); - } - }; - } - - private Command buildWaitToSetFalseCommand(final long timeout) { - return new Command() { - public void execute(SynchronizedBoolean syncBool) throws InterruptedException { - SynchronizedBooleanTests.this.startTime = System.currentTimeMillis(); - SynchronizedBooleanTests.this.timeoutOccurred = ! syncBool.waitToSetFalse(timeout); - SynchronizedBooleanTests.this.endTime = System.currentTimeMillis(); - } - }; - } - - private Runnable buildRunnable(final Command command, final SynchronizedBoolean syncBool, final long delay) { - return new TestRunnable() { - @Override - public void run_() throws InterruptedException { - if (delay != 0) { - Thread.sleep(delay); - } - command.execute(syncBool); - } - }; - } - - long calculateElapsedTime() { - return this.endTime - this.startTime; - } - - - // ********** Command interface ********** - - private interface Command { - void execute(SynchronizedBoolean syncBool) throws InterruptedException; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedIntTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedIntTests.java deleted file mode 100644 index 18df9552c5..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedIntTests.java +++ /dev/null @@ -1,362 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import org.eclipse.jpt.common.utility.internal.SynchronizedInt; - -@SuppressWarnings("nls") -public class SynchronizedIntTests - extends MultiThreadedTestCase -{ - private volatile SynchronizedInt si; - volatile boolean timeoutOccurred; - volatile int value = 7; - volatile long startTime; - volatile long endTime; - volatile int sIntValue; - - - public SynchronizedIntTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.si = new SynchronizedInt(); - this.timeoutOccurred = false; - this.startTime = 0; - this.endTime = 0; - this.sIntValue = 0; - } - - public void testGetValue() throws Exception { - assertEquals(0, this.si.getValue()); - } - - public void testEqualsInt() throws Exception { - assertTrue(this.si.equals(0)); - this.si.setValue(this.value); - assertTrue(this.si.equals(7)); - } - - public void testNotEqualInt() throws Exception { - assertTrue(this.si.notEqual(7)); - this.si.setValue(this.value); - assertTrue(this.si.notEqual(0)); - } - - public void testIsZero() throws Exception { - assertTrue(this.si.isZero()); - this.si.setValue(this.value); - assertFalse(this.si.isZero()); - } - - public void testIsNotZero() throws Exception { - assertFalse(this.si.isNotZero()); - this.si.setValue(this.value); - assertTrue(this.si.isNotZero()); - } - - public void testIsGreaterThan() throws Exception { - assertTrue(this.si.isGreaterThan(-1)); - assertFalse(this.si.isGreaterThan(0)); - assertFalse(this.si.isGreaterThan(1)); - this.si.setValue(this.value); - assertTrue(this.si.isGreaterThan(-1)); - assertFalse(this.si.isGreaterThan(7)); - assertFalse(this.si.isGreaterThan(8)); - } - - public void testIsGreaterThanOrEqual() throws Exception { - assertTrue(this.si.isGreaterThanOrEqual(-1)); - assertTrue(this.si.isGreaterThanOrEqual(0)); - assertFalse(this.si.isGreaterThanOrEqual(1)); - this.si.setValue(this.value); - assertTrue(this.si.isGreaterThanOrEqual(-1)); - assertTrue(this.si.isGreaterThanOrEqual(7)); - assertFalse(this.si.isGreaterThanOrEqual(8)); - } - - public void testIsLessThan() throws Exception { - assertFalse(this.si.isLessThan(-1)); - assertFalse(this.si.isLessThan(0)); - assertTrue(this.si.isLessThan(1)); - this.si.setValue(this.value); - assertFalse(this.si.isLessThan(-1)); - assertFalse(this.si.isLessThan(7)); - assertTrue(this.si.isLessThan(8)); - } - - public void testIsLessThanOrEqual() throws Exception { - assertFalse(this.si.isLessThanOrEqual(-1)); - assertTrue(this.si.isLessThanOrEqual(0)); - assertTrue(this.si.isLessThanOrEqual(1)); - this.si.setValue(this.value); - assertFalse(this.si.isLessThanOrEqual(-1)); - assertTrue(this.si.isLessThanOrEqual(7)); - assertTrue(this.si.isLessThanOrEqual(8)); - } - - public void testIsPositive() throws Exception { - assertFalse(this.si.isPositive()); - this.si.setValue(this.value); - assertTrue(this.si.isPositive()); - this.si.setValue(-3); - assertFalse(this.si.isPositive()); - } - - public void testIsNotPositive() throws Exception { - assertTrue(this.si.isNotPositive()); - this.si.setValue(this.value); - assertFalse(this.si.isNotPositive()); - this.si.setValue(-3); - assertTrue(this.si.isNotPositive()); - } - - public void testIsNegative() throws Exception { - assertFalse(this.si.isNegative()); - this.si.setValue(this.value); - assertFalse(this.si.isNegative()); - this.si.setValue(-3); - assertTrue(this.si.isNegative()); - } - - public void testIsNotNegative() throws Exception { - assertTrue(this.si.isNotNegative()); - this.si.setValue(this.value); - assertTrue(this.si.isNotNegative()); - this.si.setValue(-3); - assertFalse(this.si.isNotNegative()); - } - - public void testSetValue() throws Exception { - this.si.setValue(0); - assertEquals(0, this.si.getValue()); - assertFalse(this.si.isNotZero()); - assertTrue(this.si.isZero()); - - this.si.setValue(this.value); - assertEquals(this.value, this.si.getValue()); - assertTrue(this.si.isNotZero()); - assertFalse(this.si.isZero()); - } - - public void testAbs() throws Exception { - assertEquals(0, this.si.abs()); - assertEquals(0, this.si.getValue()); - this.si.setValue(this.value); - assertEquals(this.value, this.si.abs()); - assertEquals(this.value, this.si.getValue()); - this.si.setValue(-this.value); - assertEquals(this.value, this.si.abs()); - } - - public void testNeg() throws Exception { - assertEquals(0, this.si.neg()); - assertEquals(0, this.si.getValue()); - this.si.setValue(this.value); - assertEquals(-this.value, this.si.neg()); - this.si.setValue(-this.value); - assertEquals(this.value, this.si.neg()); - } - - public void testSetZero() throws Exception { - this.si.setZero(); - assertEquals(0, this.si.getValue()); - assertFalse(this.si.isNotZero()); - assertTrue(this.si.isZero()); - } - - public void testGetMutexThis() throws Exception { - assertSame(this.si, this.si.getMutex()); - } - - /** - * t2 will wait indefinitely until t1 sets the value to 0 - */ - public void testWaitUntilZero() throws Exception { - this.verifyWaitUntilZero(0); // 0 = indefinite wait - // no timeout occurs... - assertFalse(this.timeoutOccurred); - // ...and the value should be set to 0 by t2 - assertEquals(0, this.si.getValue()); - // make a reasonable guess about how long t2 took - long time = this.calculateElapsedTime(); - assertTrue("t2 finished a bit early (expected value should be > " + TICK + "): " + time, time > TICK); - } - - /** - * t2 will time out waiting for t1 to set the value to 0 - */ - public void testWaitUntilZeroTimeout() throws Exception { - this.verifyWaitUntilZero(TICK); - // timeout occurs... - assertTrue(this.timeoutOccurred); - // ...and the value will eventually be set to 0 by t1 - assertEquals(0, this.si.getValue()); - // make a reasonable guess about how long t2 took - long time = this.calculateElapsedTime(); - assertTrue("t2 finished a bit late (expected value should be < " + THREE_TICKS + "): " + time, time < THREE_TICKS); - } - - private void verifyWaitUntilZero(long t2Timeout) throws Exception { - this.executeThreads(this.buildSetZeroCommand(), this.buildWaitUntilZeroCommand(t2Timeout)); - } - - /** - * t2 will wait indefinitely until t1 sets the value to 0; - * then t2 will set the value to 7 - */ - public void testWaitToSetValue() throws Exception { - this.verifyWaitToSetValue(0); // 0 = indefinite wait - // no timeout occurs... - assertFalse(this.timeoutOccurred); - // ...and the value should be set to an object by t2 - assertTrue(this.si.isNotZero()); - // make a reasonable guess about how long t2 took - long time = this.calculateElapsedTime(); - assertTrue("t2 finished a bit early (expected value should be > " + TICK + "): " + time, time > TICK); - } - - /** - * t2 will time out waiting for t1 to set the value to 0 - */ - public void testWaitToSetValueTimeout() throws Exception { - this.verifyWaitToSetValue(TICK); - // timeout occurs... - assertTrue(this.timeoutOccurred); - // ...and the value will eventually be set to zero by t1 - assertTrue(this.si.isZero()); - // make a reasonable guess about how long t2 took - long time = this.calculateElapsedTime(); - assertTrue("t2 finished a bit late (expected value should be < " + THREE_TICKS + "): " + time, time < THREE_TICKS); - } - - private void verifyWaitToSetValue(long t2Timeout) throws Exception { - this.executeThreads(this.buildSetZeroCommand(), this.buildWaitToSetValueCommand(t2Timeout)); - } - - /** - * t2 will wait until t1 is finished "initializing" the value; - * then t2 will get the newly-initialized value (42) - */ - public void testExecute() throws Exception { - this.si.setValue(0); - Runnable r1 = this.buildRunnable(this.buildInitializeValueCommand(), this.si, 0); - // give t1 a head start - Runnable r2 = this.buildRunnable(this.buildGetValueCommand(), this.si, TICK); - Thread t1 = this.buildThread(r1); - Thread t2 = this.buildThread(r2); - t1.start(); - t2.start(); - t1.join(); - t2.join(); - assertEquals(42, this.si.getValue()); - assertEquals(42, this.sIntValue); - // make a reasonable guess about how long t2 took - long time = this.calculateElapsedTime(); - assertTrue("t2 finished a bit early (expected value should be > " + TWO_TICKS + "): " + time, time > TWO_TICKS); - } - - private void executeThreads(Command t1Command, Command t2Command) throws Exception { - this.si.setValue(this.value); - Runnable r1 = this.buildRunnable(t1Command, this.si, TWO_TICKS); - Runnable r2 = this.buildRunnable(t2Command, this.si, 0); - Thread t1 = this.buildThread(r1); - Thread t2 = this.buildThread(r2); - t1.start(); - t2.start(); - t1.join(); - t2.join(); - } - - private Command buildSetZeroCommand() { - return new Command() { - public void execute(SynchronizedInt sInt) { - sInt.setZero(); - } - }; - } - - private Command buildWaitUntilZeroCommand(final long timeout) { - return new Command() { - public void execute(SynchronizedInt sInt) throws InterruptedException { - SynchronizedIntTests.this.startTime = System.currentTimeMillis(); - SynchronizedIntTests.this.timeoutOccurred = ! sInt.waitUntilZero(timeout); - SynchronizedIntTests.this.endTime = System.currentTimeMillis(); - } - }; - } - - private Command buildWaitToSetValueCommand(final long timeout) { - return new Command() { - public void execute(SynchronizedInt sInt) throws InterruptedException { - SynchronizedIntTests.this.startTime = System.currentTimeMillis(); - SynchronizedIntTests.this.timeoutOccurred = ! sInt.waitToSetValue(SynchronizedIntTests.this.value, timeout); - SynchronizedIntTests.this.endTime = System.currentTimeMillis(); - } - }; - } - - private Command buildInitializeValueCommand() { - return new Command() { - public void execute(final SynchronizedInt sInt) throws InterruptedException { - sInt.execute( - new org.eclipse.jpt.common.utility.Command() { - public void execute() { - // pretend to perform some long initialization process - try { - Thread.sleep(5 * TICK); - } catch (InterruptedException ex) { - throw new RuntimeException(ex); - } - sInt.setValue(42); - } - } - ); - } - }; - } - - private Command buildGetValueCommand() { - return new Command() { - public void execute(SynchronizedInt sInt) throws InterruptedException { - SynchronizedIntTests.this.startTime = System.currentTimeMillis(); - SynchronizedIntTests.this.sIntValue = sInt.getValue(); - SynchronizedIntTests.this.endTime = System.currentTimeMillis(); - } - }; - } - - private Runnable buildRunnable(final Command command, final SynchronizedInt sInt, final long sleep) { - return new TestRunnable() { - @Override - protected void run_() throws InterruptedException { - if (sleep != 0) { - Thread.sleep(sleep); - } - command.execute(sInt); - } - }; - } - - private long calculateElapsedTime() { - return this.endTime - this.startTime; - } - - - // ********** Command interface ********** - - private interface Command { - void execute(SynchronizedInt sInt) throws InterruptedException; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedObjectTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedObjectTests.java deleted file mode 100644 index cffe99690a..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedObjectTests.java +++ /dev/null @@ -1,239 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import org.eclipse.jpt.common.utility.internal.SynchronizedObject; - -@SuppressWarnings("nls") -public class SynchronizedObjectTests - extends MultiThreadedTestCase -{ - private volatile SynchronizedObject so; - volatile boolean timeoutOccurred; - volatile Object value = new Object(); - volatile long startTime; - volatile long endTime; - volatile Object soValue; - - - public SynchronizedObjectTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.so = new SynchronizedObject(); - this.timeoutOccurred = false; - this.startTime = 0; - this.endTime = 0; - this.soValue = null; - } - - public void testAccessors() throws Exception { - this.so.setValue(null); - assertNull(this.so.getValue()); - assertFalse(this.so.isNotNull()); - assertTrue(this.so.isNull()); - - this.so.setValue(this.value); - assertEquals(this.value, this.so.getValue()); - assertTrue(this.so.isNotNull()); - assertFalse(this.so.isNull()); - - this.so.setNull(); - assertNull(this.so.getValue()); - assertFalse(this.so.isNotNull()); - assertTrue(this.so.isNull()); - - assertSame(this.so, this.so.getMutex()); - } - - /** - * t2 will wait indefinitely until t1 sets the value to null - */ - public void testWaitUntilNull() throws Exception { - this.verifyWaitUntilNull(0); - // no timeout occurs... - assertFalse(this.timeoutOccurred); - // ...and the value should be set to null by t2 - assertNull(this.so.getValue()); - // make a reasonable guess about how long t2 took - long time = this.calculateElapsedTime(); - assertTrue("t2 finished a bit early (expected value should be > " + TICK + "): " + time, time > TICK); - } - - /** - * t2 will time out waiting for t1 to set the value to null - */ - public void testWaitUntilNullTimeout() throws Exception { - this.verifyWaitUntilNull(TICK); - // timeout occurs... - assertTrue(this.timeoutOccurred); - // ...and the value will eventually be set to null by t1 - assertNull(this.so.getValue()); - // make a reasonable guess about how long t2 took - long time = this.calculateElapsedTime(); - assertTrue("t2 finished a bit late (expected value should be < " + THREE_TICKS + "): " + time, time < THREE_TICKS); - } - - private void verifyWaitUntilNull(long t2Timeout) throws Exception { - this.executeThreads(this.buildSetNullCommand(), this.buildWaitUntilNullCommand(t2Timeout)); - } - - /** - * t2 will wait indefinitely until t1 sets the value to null; - * then t2 will set the value to an object - */ - public void testWaitToSetValue() throws Exception { - this.verifyWaitToSetValue(0); - // no timeout occurs... - assertFalse(this.timeoutOccurred); - // ...and the value should be set to an object by t2 - assertTrue(this.so.isNotNull()); - // make a reasonable guess about how long t2 took - long time = this.calculateElapsedTime(); - assertTrue("t2 finished a bit early (expected value should be > " + TICK + "): " + time, time > TICK); - } - - /** - * t2 will time out waiting for t1 to set the value to null - */ - public void testWaitToSetValueTimeout() throws Exception { - this.verifyWaitToSetValue(TICK); - // timeout occurs... - assertTrue(this.timeoutOccurred); - // ...and the value will eventually be set to null by t1 - assertTrue(this.so.isNull()); - // make a reasonable guess about how long t2 took - long time = this.calculateElapsedTime(); - assertTrue("t2 finished a bit late (expected value should be < " + THREE_TICKS + "): " + time, time < THREE_TICKS); - } - - private void verifyWaitToSetValue(long t2Timeout) throws Exception { - this.executeThreads(this.buildSetNullCommand(), this.buildWaitToSetValueCommand(t2Timeout)); - } - - /** - * t2 will wait until t1 is finished "initializing" the value; - * then t2 will get the newly-initialized value ("foo") - */ - public void testExecute() throws Exception { - this.so.setValue(null); - Runnable r1 = this.buildRunnable(this.buildInitializeValueCommand(), this.so, 0); - // give t1 a head start of 100 ms - Runnable r2 = this.buildRunnable(this.buildGetValueCommand(), this.so, TICK); - Thread t1 = this.buildThread(r1); - Thread t2 = this.buildThread(r2); - t1.start(); - t2.start(); - t1.join(); - t2.join(); - assertEquals("foo", this.so.getValue()); - assertEquals("foo", this.soValue); - // make a reasonable guess about how long t2 took - long time = this.calculateElapsedTime(); - assertTrue("t2 finished a bit early (expected value should be > " + TWO_TICKS + "): " + time, time > TWO_TICKS); - } - - private void executeThreads(Command t1Command, Command t2Command) throws Exception { - this.so.setValue(this.value); - Runnable r1 = this.buildRunnable(t1Command, this.so, TWO_TICKS); - Runnable r2 = this.buildRunnable(t2Command, this.so, 0); - Thread t1 = this.buildThread(r1); - Thread t2 = this.buildThread(r2); - t1.start(); - t2.start(); - t1.join(); - t2.join(); - } - - private Command buildSetNullCommand() { - return new Command() { - public void execute(SynchronizedObject sObject) { - sObject.setNull(); - } - }; - } - - private Command buildWaitUntilNullCommand(final long timeout) { - return new Command() { - public void execute(SynchronizedObject sObject) throws InterruptedException { - SynchronizedObjectTests.this.startTime = System.currentTimeMillis(); - SynchronizedObjectTests.this.timeoutOccurred = ! sObject.waitUntilNull(timeout); - SynchronizedObjectTests.this.endTime = System.currentTimeMillis(); - } - }; - } - - private Command buildWaitToSetValueCommand(final long timeout) { - return new Command() { - public void execute(SynchronizedObject sObject) throws InterruptedException { - SynchronizedObjectTests.this.startTime = System.currentTimeMillis(); - SynchronizedObjectTests.this.timeoutOccurred = ! sObject.waitToSetValue(SynchronizedObjectTests.this.value, timeout); - SynchronizedObjectTests.this.endTime = System.currentTimeMillis(); - } - }; - } - - private Command buildInitializeValueCommand() { - return new Command() { - public void execute(final SynchronizedObject sObject) throws InterruptedException { - sObject.execute( - new org.eclipse.jpt.common.utility.Command() { - public void execute() { - // pretend to perform some long initialization process - try { - Thread.sleep(5 * TICK); - } catch (Exception ex) { - throw new RuntimeException(ex); - } - sObject.setValue("foo"); - } - } - ); - } - }; - } - - private Command buildGetValueCommand() { - return new Command() { - public void execute(SynchronizedObject sObject) throws InterruptedException { - SynchronizedObjectTests.this.startTime = System.currentTimeMillis(); - SynchronizedObjectTests.this.soValue = sObject.getValue(); - SynchronizedObjectTests.this.endTime = System.currentTimeMillis(); - } - }; - } - - private Runnable buildRunnable(final Command command, final SynchronizedObject sObject, final long sleep) { - return new TestRunnable() { - @Override - protected void run_() throws InterruptedException { - if (sleep != 0) { - Thread.sleep(sleep); - } - command.execute(sObject); - } - }; - } - - private long calculateElapsedTime() { - return this.endTime - this.startTime; - } - - - // ********** Command interface ********** - - private interface Command { - void execute(SynchronizedObject so) throws InterruptedException; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedQueueTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedQueueTests.java deleted file mode 100644 index c2d7687e17..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedQueueTests.java +++ /dev/null @@ -1,256 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.util.NoSuchElementException; - -import org.eclipse.jpt.common.utility.internal.Queue; -import org.eclipse.jpt.common.utility.internal.SimpleQueue; -import org.eclipse.jpt.common.utility.internal.SynchronizedQueue; - -@SuppressWarnings("nls") -public class SynchronizedQueueTests extends SimpleQueueTests { - private volatile SynchronizedQueue sq; - volatile boolean timeoutOccurred; - volatile long startTime; - volatile long endTime; - volatile Object dequeuedObject; - - static final String ITEM_1 = new String(); - static final String ITEM_2 = new String(); - - public SynchronizedQueueTests(String name) { - super(name); - } - - @Override - Queue buildQueue() { - return new SynchronizedQueue(); - } - - @Override - public void testClone() { - // synchronized queue is not cloneable - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.sq = new SynchronizedQueue(); - this.timeoutOccurred = false; - this.startTime = 0; - this.endTime = 0; - this.dequeuedObject = null; - } - - /** - * test first with an unsynchronized queue, - * then with a synchronized queue - */ - public void testConcurrentAccess() throws Exception { - this.verifyConcurrentAccess(new SlowSimpleQueue(), "first"); - this.verifyConcurrentAccess(new SlowSynchronizedQueue(), "second"); - } - - private void verifyConcurrentAccess(SlowQueue slowQueue, String expected) throws Exception { - slowQueue.enqueue("first"); - slowQueue.enqueue("second"); - - Thread thread = this.buildThread(this.buildRunnable(slowQueue)); - thread.start(); - Thread.sleep(TWO_TICKS); - - assertEquals(expected, slowQueue.dequeue()); - thread.join(); - assertTrue(slowQueue.isEmpty()); - } - - private Runnable buildRunnable(final SlowQueue slowQueue) { - return new Runnable() { - public void run() { - slowQueue.slowDequeue(); - } - }; - } - - - private interface SlowQueue extends Queue { - Object slowDequeue(); - } - - private class SlowSimpleQueue extends SimpleQueue implements SlowQueue { - SlowSimpleQueue() { - super(); - } - public Object slowDequeue() { - try { - Thread.sleep(5 * TICK); - } catch (InterruptedException ex) { - throw new RuntimeException(ex); - } - return this.dequeue(); - } - - } - - private class SlowSynchronizedQueue extends SynchronizedQueue implements SlowQueue { - SlowSynchronizedQueue() { - super(); - } - public synchronized Object slowDequeue() { - try { - Thread.sleep(5 * TICK); - } catch (InterruptedException ex) { - throw new RuntimeException(ex); - } - return this.dequeue(); - } - - } - - - // ********** waits ********** - - public void testWaitToDequeue() throws Exception { - this.verifyWaitToDequeue(0); - // no timeout occurs... - assertFalse(this.timeoutOccurred); - // ...and an item should have been dequeued by t2... - assertSame(ITEM_1, this.dequeuedObject); - // ...and the queue should be empty - assertTrue(this.sq.isEmpty()); - // make a reasonable guess about how long t2 took - assertTrue(this.calculateElapsedTime() > TICK); - } - - public void testWaitToDequeueTimeout() throws Exception { - this.verifyWaitToDequeue(TICK); - // timeout occurs... - assertTrue(this.timeoutOccurred); - // ...and the queue was never dequeued... - assertNull(this.dequeuedObject); - // ...and it still holds the item - assertSame(ITEM_1, this.sq.peek()); - // make a reasonable guess about how long t2 took - assertTrue(this.calculateElapsedTime() < THREE_TICKS); - } - - private void verifyWaitToDequeue(long timeout) throws Exception { - Runnable r1 = this.buildRunnable(this.buildEnqueueCommand(), this.sq, TWO_TICKS); - Runnable r2 = this.buildRunnable(this.buildWaitToDequeueCommand(timeout), this.sq, 0); - Thread t1 = this.buildThread(r1); - Thread t2 = this.buildThread(r2); - t1.start(); - t2.start(); - t1.join(); - t2.join(); - } - - public void testWaitToEnqueue() throws Exception { - this.verifyWaitToEnqueue(0); - // no timeout occurs... - assertFalse(this.timeoutOccurred); - // ...and the queue gets dequeued by t1... - assertSame(ITEM_1, this.dequeuedObject); - // ...and an item is enqueued on to the queue by t2 - assertFalse(this.sq.isEmpty()); - assertSame(ITEM_2, this.sq.peek()); - // make a reasonable guess about how long t2 took - assertTrue(this.calculateElapsedTime() > TICK); - } - - public void testWaitToEnqueueTimeout() throws Exception { - this.verifyWaitToEnqueue(TICK); - // timeout occurs... - assertTrue(this.timeoutOccurred); - // ...and the queue is eventually dequeued by t1... - assertSame(ITEM_1, this.dequeuedObject); - // ...but nothing is enqueued on to the queue by t2 - assertTrue(this.sq.isEmpty()); - // make a reasonable guess about how long t2 took - assertTrue(this.calculateElapsedTime() < THREE_TICKS); - } - - private void verifyWaitToEnqueue(long timeout) throws Exception { - this.sq.enqueue(ITEM_1); - Runnable r1 = this.buildRunnable(this.buildDequeueCommand(), this.sq, TWO_TICKS); - Runnable r2 = this.buildRunnable(this.buildWaitToEnqueueCommand(timeout), this.sq, 0); - Thread t1 = this.buildThread(r1); - Thread t2 = this.buildThread(r2); - t1.start(); - t2.start(); - t1.join(); - t2.join(); - } - - private Command buildEnqueueCommand() { - return new Command() { - public void execute(SynchronizedQueue synchronizedQueue) { - synchronizedQueue.enqueue(ITEM_1); - } - }; - } - - private Command buildWaitToDequeueCommand(final long timeout) { - return new Command() { - public void execute(SynchronizedQueue synchronizedQueue) throws InterruptedException { - SynchronizedQueueTests.this.startTime = System.currentTimeMillis(); - try { - SynchronizedQueueTests.this.dequeuedObject = synchronizedQueue.waitToDequeue(timeout); - } catch (NoSuchElementException ex) { - SynchronizedQueueTests.this.timeoutOccurred = true; - } - SynchronizedQueueTests.this.endTime = System.currentTimeMillis(); - } - }; - } - - private Command buildDequeueCommand() { - return new Command() { - public void execute(SynchronizedQueue synchronizedQueue) { - SynchronizedQueueTests.this.dequeuedObject = synchronizedQueue.dequeue(); - } - }; - } - - private Command buildWaitToEnqueueCommand(final long timeout) { - return new Command() { - public void execute(SynchronizedQueue synchronizedQueue) throws InterruptedException { - SynchronizedQueueTests.this.startTime = System.currentTimeMillis(); - SynchronizedQueueTests.this.timeoutOccurred = ! synchronizedQueue.waitToEnqueue(ITEM_2, timeout); - SynchronizedQueueTests.this.endTime = System.currentTimeMillis(); - } - }; - } - - private Runnable buildRunnable(final Command command, final SynchronizedQueue synchronizedQueue, final long sleep) { - return new TestRunnable() { - @Override - protected void run_() throws Throwable { - if (sleep != 0) { - Thread.sleep(sleep); - } - command.execute(synchronizedQueue); - } - }; - } - - long calculateElapsedTime() { - return this.endTime - this.startTime; - } - - - // ********** Command interface ********** - - private interface Command { - void execute(SynchronizedQueue synchronizedQueue) throws InterruptedException; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedStackTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedStackTests.java deleted file mode 100644 index 16cb62f345..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/SynchronizedStackTests.java +++ /dev/null @@ -1,257 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.util.EmptyStackException; -import org.eclipse.jpt.common.utility.internal.SimpleStack; -import org.eclipse.jpt.common.utility.internal.Stack; -import org.eclipse.jpt.common.utility.internal.SynchronizedStack; - -@SuppressWarnings("nls") -public class SynchronizedStackTests - extends SimpleStackTests -{ - private volatile SynchronizedStack ss; - volatile boolean timeoutOccurred; - volatile long startTime; - volatile long endTime; - volatile Object poppedObject; - - static final String ITEM_1 = new String(); - static final String ITEM_2 = new String(); - - public SynchronizedStackTests(String name) { - super(name); - } - - @Override - Stack buildStack() { - return new SynchronizedStack(); - } - - @Override - public void testClone() { - // synchronized stack is not cloneable - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.ss = new SynchronizedStack(); - this.timeoutOccurred = false; - this.startTime = 0; - this.endTime = 0; - this.poppedObject = null; - } - - /** - * test first with an unsynchronized stack, - * then with a synchronized stack - */ - public void testConcurrentAccess() throws Exception { - this.verifyConcurrentAccess(new SlowSimpleStack(), "second"); - this.verifyConcurrentAccess(new SlowSynchronizedStack(), "first"); - } - - private void verifyConcurrentAccess(SlowStack slowStack, String expected) throws Exception { - slowStack.push("first"); - slowStack.push("second"); - - Thread thread = this.buildThread(this.buildRunnable(slowStack)); - thread.start(); - Thread.sleep(TWO_TICKS); - - assertEquals(expected, slowStack.pop()); - thread.join(); - assertTrue(slowStack.isEmpty()); - } - - private Runnable buildRunnable(final SlowStack slowStack) { - return new Runnable() { - public void run() { - slowStack.slowPop(); - } - }; - } - - - private interface SlowStack extends Stack { - Object slowPop(); - } - - private class SlowSimpleStack extends SimpleStack implements SlowStack { - SlowSimpleStack() { - super(); - } - public Object slowPop() { - try { - Thread.sleep(5 * TICK); - } catch (InterruptedException ex) { - throw new RuntimeException(ex); - } - return this.pop(); - } - - } - - private class SlowSynchronizedStack extends SynchronizedStack implements SlowStack { - SlowSynchronizedStack() { - super(); - } - public synchronized Object slowPop() { - try { - Thread.sleep(5 * TICK); - } catch (InterruptedException ex) { - throw new RuntimeException(ex); - } - return this.pop(); - } - - } - - - // ********** waits ********** - - public void testWaitToPop() throws Exception { - this.verifyWaitToPop(0); - // no timeout occurs... - assertFalse(this.timeoutOccurred); - // ...and an item should have been popped by t2... - assertSame(ITEM_1, this.poppedObject); - // ...and the stack should be empty - assertTrue(this.ss.isEmpty()); - // make a reasonable guess about how long t2 took - assertTrue(this.calculateElapsedTime() > TICK); - } - - public void testWaitToPopTimeout() throws Exception { - this.verifyWaitToPop(TICK); - // timeout occurs... - assertTrue(this.timeoutOccurred); - // ...and the stack was never popped... - assertNull(this.poppedObject); - // ...and it still holds the item - assertSame(ITEM_1, this.ss.peek()); - // make a reasonable guess about how long t2 took - assertTrue(this.calculateElapsedTime() < THREE_TICKS); - } - - private void verifyWaitToPop(long timeout) throws Exception { - Runnable r1 = this.buildRunnable(this.buildPushCommand(), this.ss, TWO_TICKS); - Runnable r2 = this.buildRunnable(this.buildWaitToPopCommand(timeout), this.ss, 0); - Thread t1 = this.buildThread(r1); - Thread t2 = this.buildThread(r2); - t1.start(); - t2.start(); - t1.join(); - t2.join(); - } - - public void testWaitToPush() throws Exception { - this.verifyWaitToPush(0); - // no timeout occurs... - assertFalse(this.timeoutOccurred); - // ...and the stack gets popped by t1... - assertSame(ITEM_1, this.poppedObject); - // ...and an item is pushed on to the stack by t2 - assertFalse(this.ss.isEmpty()); - assertSame(ITEM_2, this.ss.peek()); - // make a reasonable guess about how long t2 took - assertTrue(this.calculateElapsedTime() > TICK); - } - - public void testWaitToPushTimeout() throws Exception { - this.verifyWaitToPush(TICK); - // timeout occurs... - assertTrue(this.timeoutOccurred); - // ...and the stack is eventually popped by t1... - assertSame(ITEM_1, this.poppedObject); - // ...but nothing is pushed on to the stack by t2 - assertTrue(this.ss.isEmpty()); - // make a reasonable guess about how long t2 took - assertTrue(this.calculateElapsedTime() < THREE_TICKS); - } - - private void verifyWaitToPush(long timeout) throws Exception { - this.ss.push(ITEM_1); - Runnable r1 = this.buildRunnable(this.buildPopCommand(), this.ss, TWO_TICKS); - Runnable r2 = this.buildRunnable(this.buildWaitToPushCommand(timeout), this.ss, 0); - Thread t1 = this.buildThread(r1); - Thread t2 = this.buildThread(r2); - t1.start(); - t2.start(); - t1.join(); - t2.join(); - } - - private Command buildPushCommand() { - return new Command() { - public void execute(SynchronizedStack synchronizedStack) { - synchronizedStack.push(ITEM_1); - } - }; - } - - private Command buildWaitToPopCommand(final long timeout) { - return new Command() { - public void execute(SynchronizedStack synchronizedStack) throws InterruptedException { - SynchronizedStackTests.this.startTime = System.currentTimeMillis(); - try { - SynchronizedStackTests.this.poppedObject = synchronizedStack.waitToPop(timeout); - } catch (EmptyStackException ex) { - SynchronizedStackTests.this.timeoutOccurred = true; - } - SynchronizedStackTests.this.endTime = System.currentTimeMillis(); - } - }; - } - - private Command buildPopCommand() { - return new Command() { - public void execute(SynchronizedStack synchronizedStack) { - SynchronizedStackTests.this.poppedObject = synchronizedStack.pop(); - } - }; - } - - private Command buildWaitToPushCommand(final long timeout) { - return new Command() { - public void execute(SynchronizedStack synchronizedStack) throws InterruptedException { - SynchronizedStackTests.this.startTime = System.currentTimeMillis(); - SynchronizedStackTests.this.timeoutOccurred = ! synchronizedStack.waitToPush(ITEM_2, timeout); - SynchronizedStackTests.this.endTime = System.currentTimeMillis(); - } - }; - } - - private Runnable buildRunnable(final Command command, final SynchronizedStack synchronizedStack, final long sleep) { - return new TestRunnable() { - @Override - protected void run_() throws Throwable { - if (sleep != 0) { - Thread.sleep(sleep); - } - command.execute(synchronizedStack); - } - }; - } - - long calculateElapsedTime() { - return this.endTime - this.startTime; - } - - - // ********** Command interface ********** - - private interface Command { - void execute(SynchronizedStack synchronizedStack) throws InterruptedException; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/TestTools.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/TestTools.java deleted file mode 100644 index 6ab45634dd..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/TestTools.java +++ /dev/null @@ -1,184 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import java.io.ByteArrayInputStream; -import java.io.ByteArrayOutputStream; -import java.io.IOException; -import java.io.ObjectInput; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.OutputStream; -import java.io.PrintStream; -import java.io.PrintWriter; -import java.io.StringWriter; -import java.lang.reflect.Field; -import java.lang.reflect.Modifier; -import java.util.SortedSet; -import java.util.TreeSet; - -import junit.framework.TestCase; -import junit.framework.TestFailure; -import junit.framework.TestResult; - -/** - * various tools that can be used by test cases - */ -public final class TestTools { - - /** - * Convenience method that handles {@link InterruptedException}. - */ - public static void sleep(long millis) { - try { - Thread.sleep(millis); - } catch (InterruptedException ex) { - throw new RuntimeException(ex); - } - } - - /** - * test an object's implementation of Serializable by serializing the - * specified object to a byte array; then de-serializing the byte array and - * returning the resultant object - */ - public static T serialize(T o) throws IOException, ClassNotFoundException { - ByteArrayOutputStream baOutStream = new ByteArrayOutputStream(2000); - ObjectOutputStream outStream = new ObjectOutputStream(baOutStream); - outStream.writeObject(o); - outStream.close(); - - ByteArrayInputStream baInStream = new ByteArrayInputStream(baOutStream.toByteArray()); - ObjectInputStream inStream = new ObjectInputStream(baInStream); - T o2 = readObject(inStream); - inStream.close(); - - return o2; - } - - @SuppressWarnings("unchecked") - private static T readObject(ObjectInput objectInput) throws IOException, ClassNotFoundException { - return (T) objectInput.readObject(); - } - - /** - * redirect std out and std err to the specified stream - */ - public static void redirectSystemStreamsTo(OutputStream outputStream) { - redirectSystemStreamsTo(new PrintStream(outputStream)); - } - - /** - * redirect std out and std err to the specified stream - */ - public static void redirectSystemStreamsTo(PrintStream printStream) { - System.setOut(printStream); - System.setErr(printStream); - } - - /** - * Sort and print out all the current Java System properties on the - * console. - */ - public static void printSystemProperties() { - synchronized (System.out) { - printSystemPropertiesOn(System.out); - } - } - - /** - * Sort and print out all the current Java System properties on the - * specified print stream. - */ - public static void printSystemPropertiesOn(PrintStream stream) { - SortedSet sortedKeys = new TreeSet(String.CASE_INSENSITIVE_ORDER); - for (Object key : System.getProperties().keySet()) { - sortedKeys.add((String) key); - } - for (String key : sortedKeys) { - stream.print(key); - stream.print(" => "); //$NON-NLS-1$ - stream.print(System.getProperty(key)); - stream.println(); - } - } - - /** - * execute the specified test and return a text output of its results - */ - public static String execute(TestCase testCase) { - long start = System.currentTimeMillis(); - TestResult result = testCase.run(); - long end = System.currentTimeMillis(); - - StringWriter stringWriter = new StringWriter(); - PrintWriter writer = new PrintWriter(stringWriter); - writer.print(testCase.getName()); - writer.print(": "); //$NON-NLS-1$ - if (result.wasSuccessful()) { - writer.println("OK"); //$NON-NLS-1$ - } else { - TestFailure failure = null; - if (result.failures().hasMoreElements()) { - failure = (TestFailure) result.failures().nextElement(); - } else { - failure = (TestFailure) result.errors().nextElement(); - } - failure.thrownException().printStackTrace(writer); - } - writer.print("elapsed time: "); //$NON-NLS-1$ - long elapsed = end - start; - writer.print(elapsed / 1000L); - writer.println(" sec."); //$NON-NLS-1$ - return stringWriter.toString(); - } - - /** - * Clear out all the instance variable of the specified test case, allowing - * the various test fixtures to be garbage-collected. Typically this is - * called in the #tearDown() method. - */ - public static void clear(TestCase testCase) throws IllegalAccessException { - for (Class clazz = testCase.getClass(); clazz != TestCase_class; clazz = clazz.getSuperclass()) { - for (Field field : clazz.getDeclaredFields()) { - // leave primitives alone - they don't get garbage-collected, and we can't set them to null... - if (field.getType().isPrimitive()) { - continue; - } - // leave static fields alone (?) - if (Modifier.isStatic(field.getModifiers())) { - continue; - } - field.setAccessible(true); - field.set(testCase, null); - } - } - } - - private static final Class TestCase_class = TestCase.class; - - /** - * Workaround for a JUnit bug: JUnit does not configure the testing Thread - * with a context class loader. This should probably happen in - * TestRunner.doRunTest(Test), just before starting the thread. - */ - public static void setUpJUnitThreadContextClassLoader() { - Thread.currentThread().setContextClassLoader(TestTools.class.getClassLoader()); - } - - /** - * suppressed constructor - */ - private TestTools() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ToolsTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ToolsTests.java deleted file mode 100644 index bf7fcba128..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/ToolsTests.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import org.eclipse.jpt.common.utility.internal.Tools; - -import junit.framework.TestCase; - -@SuppressWarnings("nls") -public class ToolsTests extends TestCase { - - public ToolsTests(String name) { - super(name); - } - - public void testValuesAreEqual1() { - assertTrue(Tools.valuesAreEqual(null, null)); - } - - public void testValuesAreEqual2() { - assertFalse(Tools.valuesAreEqual(null, "foo")); - } - - public void testValuesAreEqual3() { - assertFalse(Tools.valuesAreEqual("foo", null)); - } - - public void testValuesAreEqual4() { - assertTrue(Tools.valuesAreEqual("foo", "foo")); - } - - public void testValuesAreEqual5() { - assertFalse(Tools.valuesAreEqual("foo", "bar")); - } - - public void testValuesAreDifferent1() { - assertFalse(Tools.valuesAreDifferent(null, null)); - } - - public void testValuesAreDifferent2() { - assertTrue(Tools.valuesAreDifferent(null, "foo")); - } - - public void testValuesAreDifferent3() { - assertTrue(Tools.valuesAreDifferent("foo", null)); - } - - public void testValuesAreDifferent4() { - assertFalse(Tools.valuesAreDifferent("foo", "foo")); - } - - public void testValuesAreDifferent5() { - assertTrue(Tools.valuesAreDifferent("foo", "bar")); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/XMLStringEncoderTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/XMLStringEncoderTests.java deleted file mode 100644 index 461313cb72..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/XMLStringEncoderTests.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal; - -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.FileTools; -import org.eclipse.jpt.common.utility.internal.XMLStringEncoder; - -@SuppressWarnings("nls") -public class XMLStringEncoderTests extends TestCase { - - public XMLStringEncoderTests(String name) { - super(name); - } - - public void testEncodeNoCharacterSequences() { - XMLStringEncoder encoder = new XMLStringEncoder(FileTools.INVALID_FILENAME_CHARACTERS); - - String s = "foo"; - assertEquals(s, encoder.encode(s)); - - s = "123foo123"; - assertEquals(s, encoder.encode(s)); - } - - public void testEncodeCharacterSequences() { - XMLStringEncoder encoder = new XMLStringEncoder(FileTools.INVALID_FILENAME_CHARACTERS); - - String s = "?foo?"; - String expected = "?foo?"; - assertEquals(expected, encoder.encode(s)); - - s = "?foo&123"; - expected = "?foo&123"; - assertEquals(expected, encoder.encode(s)); - } - - public void testDenormalizeValidFileName() { - XMLStringEncoder encoder = new XMLStringEncoder(FileTools.INVALID_FILENAME_CHARACTERS); - - String s = "foo"; - assertEquals(s, encoder.decode(s)); - - s = "123foo123"; - assertEquals(s, encoder.decode(s)); - } - - public void testDenormalizeInvalidFileName() { - XMLStringEncoder encoder = new XMLStringEncoder(FileTools.INVALID_FILENAME_CHARACTERS); - - String s = "?foo?"; - String expected = "?foo?"; - assertEquals(expected, encoder.decode(s)); - - s = "?foo&123"; - expected = "?foo&123"; - assertEquals(expected, encoder.decode(s)); - } - - public void testRoundTripNoCharacterSequences() { - this.verifyRoundTrip("foo"); - this.verifyRoundTrip("123foo456"); - } - - public void testRoundTripCharacterSequences() { - this.verifyRoundTrip("?foo?"); - this.verifyRoundTrip("?foo&123&&&&&&>>>>"); - } - - private void verifyRoundTrip(String s) { - XMLStringEncoder encoder = new XMLStringEncoder(FileTools.INVALID_FILENAME_CHARACTERS); - String actual = encoder.encode(s); - assertEquals(s, encoder.decode(actual)); - } - - public void testInvalidCharacterSequence1() { - this.verifyIllegalStateException("foo&"); - } - - public void testInvalidCharacterSequence2() { - this.verifyIllegalStateException("foo&#"); - } - - public void testInvalidCharacterSequence3() { - this.verifyIllegalStateException("foo&#x"); - } - - public void testInvalidCharacterSequence4() { - this.verifyIllegalStateException("foo"); - } - - public void testInvalidCharacterSequence5() { - this.verifyIllegalStateException("foo&#x;"); - } - - public void testInvalidCharacterSequence6() { - this.verifyIllegalStateException("foo&A"); - } - - public void testInvalidCharacterSequence7() { - this.verifyIllegalStateException("foo&#A"); - } - - private void verifyIllegalStateException(String s) { - XMLStringEncoder encoder = new XMLStringEncoder(FileTools.INVALID_FILENAME_CHARACTERS); - boolean exCaught = false; - try { - s = encoder.decode(s); - fail(s); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testInvalidCharacterSequence8() { - String s = "foo&#xZZZZ;"; - XMLStringEncoder encoder = new XMLStringEncoder(FileTools.INVALID_FILENAME_CHARACTERS); - boolean exCaught = false; - try { - s = encoder.decode(s); - fail(s); - } catch (NumberFormatException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/enumerations/EmptyEnumerationTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/enumerations/EmptyEnumerationTests.java deleted file mode 100644 index 1efc9c81bb..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/enumerations/EmptyEnumerationTests.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.enumerations; - -import java.util.Enumeration; -import java.util.NoSuchElementException; -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.enumerations.EmptyEnumeration; - -@SuppressWarnings("nls") -public class EmptyEnumerationTests extends TestCase { - - public EmptyEnumerationTests(String name) { - super(name); - } - - public void testHasMoreElements() { - int i = 0; - for (Enumeration stream = EmptyEnumeration.instance(); stream.hasMoreElements();) { - stream.nextElement(); - i++; - } - assertEquals(0, i); - } - - public void testNextElement() { - for (Enumeration stream = EmptyEnumeration.instance(); stream.hasMoreElements();) { - fail("bogus element: " + stream.nextElement()); - } - } - - public void testNoSuchElementException() { - boolean exCaught = false; - Enumeration stream = EmptyEnumeration.instance(); - Object element = null; - while (stream.hasMoreElements()) { - element = stream.nextElement(); - } - try { - element = stream.nextElement(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + element, exCaught); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/enumerations/IteratorEnumerationTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/enumerations/IteratorEnumerationTests.java deleted file mode 100644 index cd6cbaa8af..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/enumerations/IteratorEnumerationTests.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.enumerations; - -import java.util.Enumeration; -import java.util.Iterator; -import java.util.NoSuchElementException; -import java.util.Vector; -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.enumerations.IteratorEnumeration; - -@SuppressWarnings("nls") -public class IteratorEnumerationTests extends TestCase { - - public IteratorEnumerationTests(String name) { - super(name); - } - - public void testHasMoreElements() { - int i = 0; - for (Enumeration stream = this.buildEnumeration(); stream.hasMoreElements();) { - stream.nextElement(); - i++; - } - assertEquals(this.buildVector().size(), i); - } - - public void testHasMoreElementsUpcast() { - int i = 0; - for (Enumeration stream = this.buildEnumerationUpcast(); stream.hasMoreElements();) { - stream.nextElement(); - i++; - } - assertEquals(this.buildVector().size(), i); - } - - public void testNextElement() { - Iterator iterator = this.buildIterator(); - for (Enumeration stream = this.buildEnumeration(); stream.hasMoreElements();) { - assertEquals("bogus element", iterator.next(), stream.nextElement()); - } - } - - public void testNoSuchElementException() { - boolean exCaught = false; - Enumeration stream = this.buildEnumeration(); - String string = null; - while (stream.hasMoreElements()) { - string = stream.nextElement(); - } - try { - string = stream.nextElement(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + string, exCaught); - } - - private Enumeration buildEnumeration() { - return this.buildEnumeration(this.buildIterator()); - } - - private Enumeration buildEnumerationUpcast() { - return this.buildEnumerationUpcast(this.buildIterator()); - } - - private Enumeration buildEnumeration(Iterator iterator) { - return new IteratorEnumeration(iterator); - } - - private Enumeration buildEnumerationUpcast(Iterator iterator) { - return new IteratorEnumeration(iterator); - } - - private Iterator buildIterator() { - return this.buildVector().iterator(); - } - - private Vector buildVector() { - Vector v = new Vector(); - v.addElement("one"); - v.addElement("two"); - v.addElement("three"); - v.addElement("four"); - v.addElement("five"); - v.addElement("six"); - v.addElement("seven"); - v.addElement("eight"); - return v; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/enumerations/JptUtilityEnumerationsTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/enumerations/JptUtilityEnumerationsTests.java deleted file mode 100644 index d5dfb0f0a8..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/enumerations/JptUtilityEnumerationsTests.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.enumerations; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * decentralize test creation code - */ -public class JptUtilityEnumerationsTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptUtilityEnumerationsTests.class.getPackage().getName()); - - suite.addTestSuite(EmptyEnumerationTests.class); - suite.addTestSuite(IteratorEnumerationTests.class); - - return suite; - } - - private JptUtilityEnumerationsTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ArrayIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ArrayIterableTests.java deleted file mode 100644 index 0c6e2da5a2..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ArrayIterableTests.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; - -@SuppressWarnings("nls") -public class ArrayIterableTests extends TestCase { - - public ArrayIterableTests(String name) { - super(name); - } - - public void testIterator() { - int i = 1; - for (String string : this.buildIterable()) { - assertEquals(i++, Integer.parseInt(string)); - } - } - - public void testSubIterator() { - int i = 3; - for (String string : this.buildIterable(2)) { - assertEquals(i++, Integer.parseInt(string)); - } - } - - public void testIllegalArgumentException() { - this.triggerIllegalArgumentException(-1, 1); - this.triggerIllegalArgumentException(8, 1); - this.triggerIllegalArgumentException(0, -1); - this.triggerIllegalArgumentException(0, 9); - } - - private void triggerIllegalArgumentException(int start, int length) { - boolean exCaught = false; - try { - Iterable iterable = this.buildIterable(start, length); - fail("bogus iterable: " + iterable); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - private Iterable buildIterable() { - return this.buildIterable(0); - } - - private Iterable buildIterable(int start) { - return this.buildIterable(this.buildArray(), start); - } - - private Iterable buildIterable(String[] array, int start) { - return new ArrayIterable(array, start); - } - - private Iterable buildIterable(int start, int length) { - return this.buildIterable(this.buildArray(), start, length); - } - - private Iterable buildIterable(String[] array, int start, int length) { - return new ArrayIterable(array, start, length); - } - - private String[] buildArray() { - return new String[] { "1", "2", "3", "4", "5", "6", "7", "8" }; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ArrayListIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ArrayListIterableTests.java deleted file mode 100644 index f7cd40fcb8..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ArrayListIterableTests.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.ListIterator; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; - -@SuppressWarnings("nls") -public class ArrayListIterableTests extends TestCase { - - public ArrayListIterableTests(String name) { - super(name); - } - - public void testIterator() { - int i = 1; - ListIterable iterable = this.buildIterable(); - for (String string : iterable) { - assertEquals(i++, Integer.parseInt(string)); - } - ListIterator stream = iterable.iterator(); - while (stream.hasNext()) { - stream.next(); - } - while (stream.hasPrevious()) { - assertEquals(--i, Integer.parseInt(stream.previous())); - } - } - - public void testSubIterator() { - int i = 3; - for (String string : this.buildIterable(2)) { - assertEquals(i++, Integer.parseInt(string)); - } - } - - public void testIllegalArgumentException() { - this.triggerIllegalArgumentException(-1, 1); - this.triggerIllegalArgumentException(8, 1); - this.triggerIllegalArgumentException(0, -1); - this.triggerIllegalArgumentException(0, 9); - } - - private void triggerIllegalArgumentException(int start, int length) { - boolean exCaught = false; - try { - Iterable iterable = this.buildIterable(start, length); - fail("bogus iterable: " + iterable); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - private ListIterable buildIterable() { - return this.buildIterable(0); - } - - private ListIterable buildIterable(int start) { - return this.buildIterable(this.buildArray(), start); - } - - private ListIterable buildIterable(String[] array, int start) { - return (start == 0) ? - new ArrayListIterable(array) : - new ArrayListIterable(array, start); - } - - private ListIterable buildIterable(int start, int length) { - return this.buildIterable(this.buildArray(), start, length); - } - - private ListIterable buildIterable(String[] array, int start, int length) { - return new ArrayListIterable(array, start, length); - } - - private String[] buildArray() { - return new String[] { "1", "2", "3", "4", "5", "6", "7", "8" }; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ChainIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ChainIterableTests.java deleted file mode 100644 index ae8423bfd5..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ChainIterableTests.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.AbstractCollection; -import java.util.AbstractList; -import java.util.Iterator; -import java.util.Vector; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.iterables.ChainIterable; -import org.eclipse.jpt.common.utility.internal.iterators.ChainIterator; - -@SuppressWarnings("nls") -public class ChainIterableTests extends TestCase { - private final static Class[] VECTOR_HIERARCHY = { Vector.class, AbstractList.class, AbstractCollection.class, Object.class }; - - public ChainIterableTests(String name) { - super(name); - } - - - public void testNextLink() { - int i = 0; - for (Class clazz : this.buildIterable()) { - assertEquals(VECTOR_HIERARCHY[i++], clazz); - } - } - - public void testLinker() { - int i = 0; - for (Class clazz : new ChainIterable>(Vector.class, this.buildLinker())) { - assertEquals(VECTOR_HIERARCHY[i++], clazz); - } - } - - public void testException() { - Iterable> iterable = new ChainIterable>(Vector.class); - Iterator> iterator = iterable.iterator(); - boolean exCaught = false; - try { - Class clazz = iterator.next(); - fail("bogus class: " + clazz); - } catch (RuntimeException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testToString() { - assertNotNull(this.buildIterable().toString()); - } - - private Iterable> buildIterable() { - return this.buildChainIterable(Vector.class); - } - - private Iterable> buildChainIterable(Class startLink) { - // chain up the class's hierarchy - return new ChainIterable>(startLink) { - @Override - protected Class nextLink(Class currentLink) { - return currentLink.getSuperclass(); - } - }; - } - - private ChainIterator.Linker> buildLinker() { - return new ChainIterator.Linker>() { - public Class nextLink(Class currentLink) { - return currentLink.getSuperclass(); - } - }; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/CloneIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/CloneIterableTests.java deleted file mode 100644 index 03292ec25d..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/CloneIterableTests.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import java.util.Iterator; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; - -@SuppressWarnings("nls") -public abstract class CloneIterableTests extends TestCase { - Iterable iterable; - - public CloneIterableTests(String name) { - super(name); - } - - public void testIterator() { - List c = new ArrayList(); - c.add("0"); - c.add("1"); - c.add("2"); - c.add("3"); - assertEquals(4, c.size()); - this.iterable = this.buildIterable(c); - int i = 0; - for (String s : this.iterable) { - assertEquals(String.valueOf(i++), s); - c.remove("3"); - } - assertEquals(4, i); - assertEquals(3, c.size()); - } - - public void testRemove() { - final List collection = this.buildCollection(); - this.iterable = this.buildRemovingIterable(collection); - - Object removed = "three"; - assertTrue(CollectionTools.contains(this.iterable, removed)); - for (Iterator iterator = this.iterable.iterator(); iterator.hasNext(); ) { - if (iterator.next().equals(removed)) { - iterator.remove(); - } - } - assertFalse(collection.contains(removed)); - } - - public void testRemover() { - final List collection = this.buildCollection(); - this.iterable = this.buildIterableWithRemover(collection); - - Object removed = "three"; - assertTrue(CollectionTools.contains(this.iterable, removed)); - for (Iterator iterator = this.iterable.iterator(); iterator.hasNext(); ) { - if (iterator.next().equals(removed)) { - iterator.remove(); - } - } - assertFalse(collection.contains(removed)); - } - - public void testMissingRemover() { - final List collection = this.buildCollection(); - this.iterable = this.buildIterable(collection); - assertNotNull(this.iterable.toString()); - - Object removed = "three"; - assertTrue(CollectionTools.contains(this.iterable, removed)); - boolean exCaught = false; - for (Iterator iterator = this.iterable.iterator(); iterator.hasNext(); ) { - if (iterator.next().equals(removed)) { - try { - iterator.remove(); - fail(); - } catch (RuntimeException ex) { - exCaught = true; - } - } - } - assertTrue(exCaught); - } - - public void testToString() { - final List collection = this.buildCollection(); - this.iterable = this.buildIterable(collection); - assertNotNull(iterable.toString()); - } - - abstract Iterable buildIterable(List c); - - abstract Iterable buildRemovingIterable(List c); - - abstract Iterable buildIterableWithRemover(List c); - - CloneIterator.Remover buildRemover(final Collection c) { - return new CloneIterator.Remover() { - public void remove(String current) { - c.remove(current); - } - }; - } - - CloneListIterator.Mutator buildMutator(final List list) { - return new CloneListIterator.Mutator() { - public void add(int index, String string) { - list.add(index, string); - } - public void set(int index, String string) { - list.set(index, string); - } - public void remove(int index) { - list.remove(index); - } - }; - } - - List buildCollection() { - List c = new ArrayList(); - c.add("one"); - c.add("two"); - c.add("three"); - c.add("four"); - c.add("five"); - c.add("six"); - c.add("seven"); - c.add("eight"); - return c; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/CompositeIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/CompositeIterableTests.java deleted file mode 100644 index bd5516f161..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/CompositeIterableTests.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.ArrayList; -import java.util.Collection; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; - -@SuppressWarnings("nls") -public class CompositeIterableTests extends TestCase { - - public CompositeIterableTests(String name) { - super(name); - } - - public void testIterator() { - Collection c1 = new ArrayList(); - c1.add("0"); - c1.add("1"); - c1.add("2"); - c1.add("3"); - - Collection c2 = new ArrayList(); - c2.add("4"); - c2.add("5"); - c2.add("6"); - c2.add("7"); - - @SuppressWarnings("unchecked") - Iterable composite = new CompositeIterable(c1, c2); - int i = 0; - for (String s : composite) { - assertEquals(String.valueOf(i++), s); - } - } - - public void testExtraElement1() { - Collection c1 = new ArrayList(); - c1.add("0"); - c1.add("1"); - c1.add("2"); - c1.add("3"); - - Iterable composite = new CompositeIterable(c1, "4"); - int i = 0; - for (String s : composite) { - assertEquals(String.valueOf(i++), s); - } - } - - public void testExtraElement2() { - Collection c1 = new ArrayList(); - c1.add("1"); - c1.add("2"); - c1.add("3"); - - Iterable composite = new CompositeIterable("0", c1); - int i = 0; - for (String s : composite) { - assertEquals(String.valueOf(i++), s); - } - } - - public void testCollectionOfIterables() { - Collection c1 = new ArrayList(); - c1.add("0"); - c1.add("1"); - c1.add("2"); - c1.add("3"); - - Collection c2 = new ArrayList(); - c2.add("4"); - c2.add("5"); - c2.add("6"); - c2.add("7"); - - Collection> collection = new ArrayList>(); - collection.add(c1); - collection.add(c2); - Iterable composite = new CompositeIterable(collection); - int i = 0; - for (String s : composite) { - assertEquals(String.valueOf(i++), s); - } - } - - public void testToString() { - Collection c1 = new ArrayList(); - c1.add("0"); - c1.add("1"); - c1.add("2"); - c1.add("3"); - - Collection c2 = new ArrayList(); - c2.add("4"); - c2.add("5"); - c2.add("6"); - c2.add("7"); - - @SuppressWarnings("unchecked") - Iterable composite = new CompositeIterable(c1, c2); - assertNotNull(composite.toString()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/CompositeListIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/CompositeListIterableTests.java deleted file mode 100644 index baf06cf3fb..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/CompositeListIterableTests.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListListIterable; - -@SuppressWarnings("nls") -public class CompositeListIterableTests extends TestCase { - - public CompositeListIterableTests(String name) { - super(name); - } - - public void testIterator() { - List c1 = new ArrayList(); - c1.add("0"); - c1.add("1"); - c1.add("2"); - c1.add("3"); - - List c2 = new ArrayList(); - c2.add("4"); - c2.add("5"); - c2.add("6"); - c2.add("7"); - - @SuppressWarnings("unchecked") - Iterable composite = new CompositeListIterable(c1, c2); - int i = 0; - for (String s : composite) { - assertEquals(String.valueOf(i++), s); - } - } - - public void testExtraElement1() { - List c1 = new ArrayList(); - c1.add("0"); - c1.add("1"); - c1.add("2"); - c1.add("3"); - - Iterable composite = new CompositeListIterable(c1, "4"); - int i = 0; - for (String s : composite) { - assertEquals(String.valueOf(i++), s); - } - } - - public void testExtraElement2() { - List c1 = new ArrayList(); - c1.add("1"); - c1.add("2"); - c1.add("3"); - - Iterable composite = new CompositeListIterable("0", c1); - int i = 0; - for (String s : composite) { - assertEquals(String.valueOf(i++), s); - } - } - - public void testCollectionOfIterables() { - List c1 = new ArrayList(); - c1.add("0"); - c1.add("1"); - c1.add("2"); - c1.add("3"); - - List c2 = new ArrayList(); - c2.add("4"); - c2.add("5"); - c2.add("6"); - c2.add("7"); - - List> collection = new ArrayList>(); - collection.add(new ListListIterable(c1)); - collection.add(new ListListIterable(c2)); - Iterable composite = new CompositeListIterable(collection); - int i = 0; - for (String s : composite) { - assertEquals(String.valueOf(i++), s); - } - } - - public void testToString() { - List c1 = new ArrayList(); - c1.add("0"); - c1.add("1"); - c1.add("2"); - c1.add("3"); - - List c2 = new ArrayList(); - c2.add("4"); - c2.add("5"); - c2.add("6"); - c2.add("7"); - - @SuppressWarnings("unchecked") - Iterable composite = new CompositeListIterable(c1, c2); - assertNotNull(composite.toString()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/EmptyIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/EmptyIterableTests.java deleted file mode 100644 index 1afe2303eb..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/EmptyIterableTests.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class EmptyIterableTests extends TestCase { - - public EmptyIterableTests(String name) { - super(name); - } - - public void testIterator() { - for (String s : EmptyIterable.instance()) { - fail("bogus element: " + s); - } - } - - public void testToString() { - assertNotNull(EmptyIterable.instance().toString()); - } - - public void testSerialization() throws Exception { - Iterable iterable = EmptyIterable.instance(); - assertSame(iterable, TestTools.serialize(iterable)); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/EmptyListIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/EmptyListIterableTests.java deleted file mode 100644 index 761555cbbe..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/EmptyListIterableTests.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class EmptyListIterableTests extends TestCase { - - public EmptyListIterableTests(String name) { - super(name); - } - - public void testIterator() { - for (String s : EmptyListIterable.instance()) { - fail("bogus element: " + s); - } - } - - public void testToString() { - assertNotNull(EmptyListIterable.instance().toString()); - } - - public void testSerialization() throws Exception { - Iterable iterable = EmptyListIterable.instance(); - assertSame(iterable, TestTools.serialize(iterable)); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/FilteringIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/FilteringIterableTests.java deleted file mode 100644 index fa1b5613f3..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/FilteringIterableTests.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; - -@SuppressWarnings("nls") -public class FilteringIterableTests extends TestCase { - private static final String PREFIX = "prefix"; - - public FilteringIterableTests(String name) { - super(name); - } - - public void testAccept() { - int i = 0; - for (String s : this.buildIterable()) { - assertTrue(s.contains(PREFIX)); - i++; - } - assertEquals(6, i); - } - - public void testFilter() { - Filter filter = this.buildFilter(); - int i = 0; - for (String s : new FilteringIterable(this.buildNestedIterable(), filter)) { - assertTrue(s.contains(PREFIX)); - i++; - } - assertEquals(6, i); - } - - public void testToString() { - assertNotNull(this.buildIterable().toString()); - } - - public void testMissingFilter() { - boolean exCaught = false; - Iterable iterable = new FilteringIterable(this.buildNestedIterable()); - try { - Iterator iterator = iterable.iterator(); - fail("bogus iterator: " + iterator); - } catch (RuntimeException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - private Iterable buildIterable() { - return this.buildFilteringIterable(this.buildNestedIterable()); - } - - private Iterable buildFilteringIterable(Iterable nestedIterable) { - return new FilteringIterable(nestedIterable) { - @Override - protected boolean accept(String s) { - return s.startsWith(PREFIX); - } - }; - } - - private Filter buildFilter() { - return new Filter() { - public boolean accept(String s) { - return s.startsWith(PREFIX); - } - }; - } - - private Iterable buildNestedIterable() { - Collection c = new ArrayList(); - c.add(PREFIX + "1"); - c.add(PREFIX + "2"); - c.add(PREFIX + "3"); - c.add("4"); - c.add(PREFIX + "5"); - c.add(PREFIX + "6"); - c.add(PREFIX + "7"); - c.add("8"); - return c; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/GraphIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/GraphIterableTests.java deleted file mode 100644 index bb39c41b85..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/GraphIterableTests.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.GraphIterable; -import org.eclipse.jpt.common.utility.internal.iterators.GraphIterator; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class GraphIterableTests extends TestCase { - /** this will be populated with all the nodes created for the test */ - Collection nodes = new ArrayList(); - - public GraphIterableTests(String name) { - super(name); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testNeighbors1() { - for (GraphNode gn : this.buildGraphIterable1()) { - assertTrue(this.nodes.contains(gn)); - } - } - - private Iterable buildGraphIterable1() { - return new GraphIterable(this.buildGraphRoot()) { - @Override - public Iterator neighbors(GraphNode next) { - return next.neighbors(); - } - }; - } - - public void testNeighbors2() { - for (GraphNode gn : this.buildGraphIterable2()) { - assertTrue(this.nodes.contains(gn)); - } - } - - private Iterable buildGraphIterable2() { - return new GraphIterable(this.buildGraphRoot(), this.buildMisterRogers()); - } - - public void testNeighbors3() { - for (GraphNode gn : this.buildGraphIterable3()) { - assertTrue(this.nodes.contains(gn)); - } - } - - private Iterable buildGraphIterable3() { - return new GraphIterable(new GraphNode[] { this.buildGraphRoot() }) { - @Override - public Iterator neighbors(GraphNode next) { - return next.neighbors(); - } - }; - } - - public void testNeighbors4() { - for (GraphNode gn : this.buildGraphIterable4()) { - assertTrue(this.nodes.contains(gn)); - } - } - - private Iterable buildGraphIterable4() { - return new GraphIterable(new GraphNode[] { this.buildGraphRoot() }, this.buildMisterRogers()); - } - - public void testToString() { - assertNotNull(this.buildGraphIterable1().toString()); - } - - public void testMissingMisterRogers() { - boolean exCaught = false; - try { - for (GraphNode gn : new GraphIterable(this.buildGraphRoot())) { - assertTrue(this.nodes.contains(gn)); - } - fail(); - } catch (RuntimeException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - private GraphIterator.MisterRogers buildMisterRogers() { - return new GraphIterator.MisterRogers() { - public Iterator neighbors(GraphNode next) { - return next.neighbors(); - } - }; - } - - private GraphNode buildGraphRoot() { - GraphNode ncNode = new GraphNode("North Carolina"); - GraphNode vaNode = new GraphNode("Virginia"); - GraphNode scNode = new GraphNode("South Carolina"); - GraphNode gaNode = new GraphNode("Georgia"); - GraphNode flNode = new GraphNode("Florida"); - GraphNode alNode = new GraphNode("Alabama"); - GraphNode msNode = new GraphNode("Mississippi"); - GraphNode tnNode = new GraphNode("Tennessee"); - - ncNode.setNeighbors(new GraphNode[] { vaNode, scNode, gaNode, tnNode }); - vaNode.setNeighbors(new GraphNode[] { ncNode, tnNode }); - scNode.setNeighbors(new GraphNode[] { ncNode, gaNode }); - gaNode.setNeighbors(new GraphNode[] { ncNode, scNode, flNode, alNode, tnNode }); - flNode.setNeighbors(new GraphNode[] { gaNode }); - alNode.setNeighbors(new GraphNode[] { gaNode, msNode, tnNode }); - msNode.setNeighbors(new GraphNode[] { alNode, tnNode }); - tnNode.setNeighbors(new GraphNode[] { vaNode, ncNode, gaNode, alNode, msNode }); - - return ncNode; - } - - public class GraphNode { - private String name; - - private Collection neighbors = new ArrayList(); - - public GraphNode(String name) { - super(); - GraphIterableTests.this.nodes.add(this); // log node - this.name = name; - } - - public String getName() { - return this.name; - } - - void setNeighbors(GraphNode[] neighbors) { - this.neighbors = CollectionTools.list(neighbors); - } - - public Iterator neighbors() { - return this.neighbors.iterator(); - } - - public int neighborsSize() { - return this.neighbors.size(); - } - - @Override - public String toString() { - return "GraphNode(" + this.name + ")"; - } - } -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/JptUtilityIterablesTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/JptUtilityIterablesTests.java deleted file mode 100644 index 6da560d319..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/JptUtilityIterablesTests.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * decentralize test creation code - */ -public class JptUtilityIterablesTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptUtilityIterablesTests.class.getPackage().getName()); - - suite.addTestSuite(ArrayIterableTests.class); - suite.addTestSuite(ArrayListIterableTests.class); - suite.addTestSuite(ChainIterableTests.class); - suite.addTestSuite(CompositeIterableTests.class); - suite.addTestSuite(CompositeListIterableTests.class); - suite.addTestSuite(EmptyIterableTests.class); - suite.addTestSuite(EmptyListIterableTests.class); - suite.addTestSuite(FilteringIterableTests.class); - suite.addTestSuite(SuperIterableWrapperTests.class); - suite.addTestSuite(GraphIterableTests.class); - suite.addTestSuite(LiveCloneIterableTests.class); - suite.addTestSuite(LiveCloneListIterableTests.class); - suite.addTestSuite(PeekableIterableTests.class); - suite.addTestSuite(QueueIterableTests.class); - suite.addTestSuite(ReadOnlyCompositeListIterableTests.class); - suite.addTestSuite(ReadOnlyIterableTests.class); - suite.addTestSuite(ReadOnlyListIterableTests.class); - suite.addTestSuite(SingleElementIterableTests.class); - suite.addTestSuite(SingleElementListIterableTests.class); - suite.addTestSuite(SnapshotCloneIterableTests.class); - suite.addTestSuite(SnapshotCloneListIterableTests.class); - suite.addTestSuite(StackIterableTests.class); - suite.addTestSuite(TransformationIterableTests.class); - suite.addTestSuite(TransformationListIterableTests.class); - suite.addTestSuite(TreeIterableTests.class); - - return suite; - } - - private JptUtilityIterablesTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/LiveCloneIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/LiveCloneIterableTests.java deleted file mode 100644 index 96fde7ffde..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/LiveCloneIterableTests.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.List; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; - -@SuppressWarnings("nls") -public class LiveCloneIterableTests extends CloneIterableTests { - - public LiveCloneIterableTests(String name) { - super(name); - } - - @Override - public void testIterator() { - super.testIterator(); - // iterable should now return only 3 strings (since it's "live") - int i = 0; - for (String s : this.iterable) { - assertEquals(String.valueOf(i++), s); - } - assertEquals(3, i); - } - - @Override - public void testRemove() { - super.testRemove(); - // "live" clone iterable will no longer contain the element removed from the - // original collection - assertFalse(CollectionTools.contains(this.iterable, "three")); - } - - @Override - public void testRemover() { - super.testRemover(); - // "live" clone iterable will no longer contain the element removed from the - // original collection - assertFalse(CollectionTools.contains(this.iterable, "three")); - } - - @Override - Iterable buildIterable(List c) { - return new LiveCloneIterable(c); - } - - @Override - Iterable buildRemovingIterable(final List c) { - return new LiveCloneIterable(c) { - @Override - protected void remove(String current) { - c.remove(current); - } - }; - } - - @Override - Iterable buildIterableWithRemover(List c) { - return new LiveCloneIterable(c, this.buildRemover(c)); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/LiveCloneListIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/LiveCloneListIterableTests.java deleted file mode 100644 index 0d70c000ea..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/LiveCloneListIterableTests.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; - -@SuppressWarnings("nls") -public class LiveCloneListIterableTests extends LiveCloneIterableTests { - - public LiveCloneListIterableTests(String name) { - super(name); - } - - public void testAdd() { - final List collection = this.buildCollection(); - this.iterable = this.buildRemovingIterable(collection); - - String added = "xxxx"; - assertFalse(CollectionTools.contains(this.iterable, added)); - for (ListIterator iterator = (ListIterator) this.iterable.iterator(); iterator.hasNext(); ) { - if (iterator.next().equals("two")) { - iterator.add(added); - } - } - assertTrue(collection.contains(added)); - // "live" clone iterable will contain the element added to the - // original collection - assertTrue(CollectionTools.contains(this.iterable, added)); - } - - public void testMissingMutatorAdd() { - final List collection = this.buildCollection(); - this.iterable = this.buildIterable(collection); - assertNotNull(this.iterable.toString()); - - String added = "xxxx"; - assertFalse(CollectionTools.contains(this.iterable, added)); - boolean exCaught = false; - for (ListIterator iterator = (ListIterator) this.iterable.iterator(); iterator.hasNext(); ) { - if (iterator.next().equals("three")) { - try { - iterator.add(added); - fail(); - } catch (RuntimeException ex) { - exCaught = true; - } - } - } - assertTrue(exCaught); - } - - public void testSet() { - final List collection = this.buildCollection(); - this.iterable = this.buildRemovingIterable(collection); - - String added = "xxxx"; - assertFalse(CollectionTools.contains(this.iterable, added)); - for (ListIterator iterator = (ListIterator) this.iterable.iterator(); iterator.hasNext(); ) { - if (iterator.next().equals("two")) { - iterator.set(added); - } - } - assertTrue(collection.contains(added)); - assertFalse(collection.contains("two")); - // "live" clone iterable will contain the element added to the - // original collection - assertTrue(CollectionTools.contains(this.iterable, added)); - assertFalse(CollectionTools.contains(this.iterable, "two")); - } - - public void testMissingMutatorSet() { - final List collection = this.buildCollection(); - this.iterable = this.buildIterable(collection); - assertNotNull(this.iterable.toString()); - - String added = "xxxx"; - assertFalse(CollectionTools.contains(this.iterable, added)); - boolean exCaught = false; - for (ListIterator iterator = (ListIterator) this.iterable.iterator(); iterator.hasNext(); ) { - if (iterator.next().equals("three")) { - try { - iterator.set(added); - fail(); - } catch (RuntimeException ex) { - exCaught = true; - } - } - } - assertTrue(exCaught); - } - - @Override - Iterable buildIterable(List c) { - return new LiveCloneListIterable(c); - } - - @Override - Iterable buildRemovingIterable(final List c) { - return new LiveCloneListIterable(c) { - @Override - protected void add(int index, String element) { - c.add(index, element); - } - @Override - protected void remove(int index) { - c.remove(index); - } - @Override - protected void set(int index, String element) { - c.set(index, element); - } - }; - } - - @Override - Iterable buildIterableWithRemover(List c) { - return new LiveCloneListIterable(c, this.buildMutator(c)); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/PeekableIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/PeekableIterableTests.java deleted file mode 100644 index 634992e5db..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/PeekableIterableTests.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.PeekableIterable; -import org.eclipse.jpt.common.utility.internal.iterators.PeekableIterator; - -@SuppressWarnings("nls") -public class PeekableIterableTests extends TestCase { - - public PeekableIterableTests(String name) { - super(name); - } - - public void testIterator() { - PeekableIterable iterable = this.buildIterable(); - PeekableIterator iterator = iterable.iterator(); - assertEquals("one", iterator.peek()); - } - - public void testToString() { - assertNotNull(this.buildIterable().toString()); - } - - private PeekableIterable buildIterable() { - return new PeekableIterable(this.buildNestedIterable()); - } - - private Iterable buildNestedIterable() { - return new ArrayIterable(this.buildArray()); - } - - private String[] buildArray() { - return new String[] {"one", "two", "three"}; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/QueueIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/QueueIterableTests.java deleted file mode 100644 index 649f336336..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/QueueIterableTests.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.Queue; -import org.eclipse.jpt.common.utility.internal.SimpleQueue; -import org.eclipse.jpt.common.utility.internal.iterables.QueueIterable; - -@SuppressWarnings("nls") -public class QueueIterableTests extends TestCase { - - public QueueIterableTests(String name) { - super(name); - } - - public void testIterator() { - Iterable iterable = this.buildIterable(); - for (String s : iterable) { - assertNotNull(s); - } - } - - public void testToString() { - assertNotNull(this.buildIterable().toString()); - } - - private Iterable buildIterable() { - return new QueueIterable(this.buildQueue()); - } - - private Queue buildQueue() { - Queue q = new SimpleQueue(); - q.enqueue("foo"); - q.enqueue("bar"); - q.enqueue("baz"); - return q; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ReadOnlyCompositeListIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ReadOnlyCompositeListIterableTests.java deleted file mode 100644 index f217b39b2d..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ReadOnlyCompositeListIterableTests.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ReadOnlyCompositeListIterable; - -@SuppressWarnings("nls") -public class ReadOnlyCompositeListIterableTests extends TestCase { - - public ReadOnlyCompositeListIterableTests(String name) { - super(name); - } - - public void testIterator() { - List c1 = new ArrayList(); - c1.add("0"); - c1.add("1"); - c1.add("2"); - c1.add("3"); - ListIterable li1 = new ListListIterable(c1); - - List c2 = new ArrayList(); - c2.add("4"); - c2.add("5"); - c2.add("6"); - c2.add("7"); - ListIterable li2 = new ListListIterable(c2); - - @SuppressWarnings("unchecked") - Iterable composite = new ReadOnlyCompositeListIterable(li1, li2); - int i = 0; - for (String s : composite) { - assertEquals(String.valueOf(i++), s); - } - } - - public void testExtraElement1() { - List c1 = new ArrayList(); - c1.add("0"); - c1.add("1"); - c1.add("2"); - c1.add("3"); - ListIterable li1 = new ListListIterable(c1); - - Iterable composite = new ReadOnlyCompositeListIterable(li1, "4"); - int i = 0; - for (String s : composite) { - assertEquals(String.valueOf(i++), s); - } - } - - public void testExtraElement2() { - List c1 = new ArrayList(); - c1.add("1"); - c1.add("2"); - c1.add("3"); - ListIterable li1 = new ListListIterable(c1); - - Iterable composite = new ReadOnlyCompositeListIterable("0", li1); - int i = 0; - for (String s : composite) { - assertEquals(String.valueOf(i++), s); - } - } - - public void testCollectionOfIterables() { - List c1 = new ArrayList(); - c1.add("0"); - c1.add("1"); - c1.add("2"); - c1.add("3"); - ListIterable li1 = new ListListIterable(c1); - - List c2 = new ArrayList(); - c2.add("4"); - c2.add("5"); - c2.add("6"); - c2.add("7"); - ListIterable li2 = new ListListIterable(c2); - - List> collection = new ArrayList>(); - collection.add(li1); - collection.add(li2); - ListIterable> li = new ListListIterable>(collection); - - Iterable composite = new ReadOnlyCompositeListIterable(li); - int i = 0; - for (String s : composite) { - assertEquals(String.valueOf(i++), s); - } - } - - public void testToString() { - List c1 = new ArrayList(); - c1.add("0"); - c1.add("1"); - c1.add("2"); - c1.add("3"); - ListIterable li1 = new ListListIterable(c1); - - List c2 = new ArrayList(); - c2.add("4"); - c2.add("5"); - c2.add("6"); - c2.add("7"); - ListIterable li2 = new ListListIterable(c2); - - @SuppressWarnings("unchecked") - Iterable composite = new ReadOnlyCompositeListIterable(li1, li2); - assertNotNull(composite.toString()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ReadOnlyIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ReadOnlyIterableTests.java deleted file mode 100644 index 4399851f65..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ReadOnlyIterableTests.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.Iterator; -import java.util.Vector; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.iterables.ReadOnlyIterable; - -@SuppressWarnings("nls") -public class ReadOnlyIterableTests extends TestCase { - - public ReadOnlyIterableTests(String name) { - super(name); - } - - public void testIterator() { - Iterator nestedIterator = this.buildVector().iterator(); - for (String s : this.buildReadOnlyIterable()) { - assertEquals(nestedIterator.next(), s); - } - } - - public void testRemove() { - boolean exCaught = false; - for (Iterator stream = this.buildReadOnlyIterable().iterator(); stream.hasNext();) { - if (stream.next().equals("three")) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue(exCaught); - } - - public void testToString() { - assertNotNull(this.buildReadOnlyIterable().toString()); - } - - private Iterable buildReadOnlyIterable() { - return new ReadOnlyIterable(this.buildVector()); - } - - private Vector buildVector() { - Vector v = new Vector(); - v.addElement("one"); - v.addElement("two"); - v.addElement("three"); - v.addElement("four"); - v.addElement("five"); - v.addElement("six"); - v.addElement("seven"); - v.addElement("eight"); - return v; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ReadOnlyListIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ReadOnlyListIterableTests.java deleted file mode 100644 index 8a923ff3e4..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/ReadOnlyListIterableTests.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.Iterator; -import java.util.Vector; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ReadOnlyListIterable; - -@SuppressWarnings("nls") -public class ReadOnlyListIterableTests extends TestCase { - - public ReadOnlyListIterableTests(String name) { - super(name); - } - - public void testIterator() { - Iterator nestedIterator = this.buildVector().iterator(); - for (String s : this.buildReadOnlyListIterable()) { - assertEquals(nestedIterator.next(), s); - } - } - - public void testRemove() { - boolean exCaught = false; - for (Iterator stream = this.buildReadOnlyListIterable().iterator(); stream.hasNext();) { - if (stream.next().equals("three")) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue(exCaught); - } - - public void testToString() { - assertNotNull(this.buildReadOnlyListIterable().toString()); - } - - private Iterable buildReadOnlyListIterable() { - return new ReadOnlyListIterable(this.buildNestedListIterable()); - } - - private ListIterable buildNestedListIterable() { - return new ListListIterable(this.buildVector()); - } - - private Vector buildVector() { - Vector v = new Vector(); - v.addElement("one"); - v.addElement("two"); - v.addElement("three"); - v.addElement("four"); - v.addElement("five"); - v.addElement("six"); - v.addElement("seven"); - v.addElement("eight"); - return v; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SingleElementIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SingleElementIterableTests.java deleted file mode 100644 index 49061d3773..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SingleElementIterableTests.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.Iterator; -import java.util.NoSuchElementException; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; - -@SuppressWarnings("nls") -public class SingleElementIterableTests extends TestCase { - - public SingleElementIterableTests(String name) { - super(name); - } - - public void testIterator() { - for (String s : this.buildSingleElementIterable()) { - assertEquals(this.singleElement(), s); - } - } - - public void testNoSuchElementException() { - boolean exCaught = false; - Iterator stream = this.buildSingleElementIterable().iterator(); - String string = stream.next(); - try { - string = stream.next(); - fail("bogus element: " + string); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testRemove() { - boolean exCaught = false; - for (Iterator stream = this.buildSingleElementIterable().iterator(); stream.hasNext(); ) { - if (stream.next().equals(this.singleElement())) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - protected Iterable buildSingleElementIterable() { - return new SingleElementIterable(this.singleElement()); - } - - protected String singleElement() { - return "single element"; - } -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SingleElementListIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SingleElementListIterableTests.java deleted file mode 100644 index d11520f7de..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SingleElementListIterableTests.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.Iterator; -import java.util.NoSuchElementException; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; - -@SuppressWarnings("nls") -public class SingleElementListIterableTests extends TestCase { - - public SingleElementListIterableTests(String name) { - super(name); - } - - public void testIterator() { - for (String s : this.buildSingleElementListIterable()) { - assertEquals(this.singleElement(), s); - } - } - - public void testNoSuchElementException() { - boolean exCaught = false; - Iterator stream = this.buildSingleElementListIterable().iterator(); - String string = stream.next(); - try { - string = stream.next(); - fail("bogus element: " + string); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testRemove() { - boolean exCaught = false; - for (Iterator stream = this.buildSingleElementListIterable().iterator(); stream.hasNext(); ) { - if (stream.next().equals(this.singleElement())) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - public void testToString() { - assertNotNull(this.buildSingleElementListIterable().toString()); - } - - protected Iterable buildSingleElementListIterable() { - return new SingleElementListIterable(this.singleElement()); - } - - protected String singleElement() { - return "single element"; - } -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SnapshotCloneIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SnapshotCloneIterableTests.java deleted file mode 100644 index 384006c45e..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SnapshotCloneIterableTests.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.List; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable; - -@SuppressWarnings("nls") -public class SnapshotCloneIterableTests extends CloneIterableTests { - - public SnapshotCloneIterableTests(String name) { - super(name); - } - - @Override - public void testIterator() { - super.testIterator(); - // "snapshot" iterable should still return 4 strings (since the original collection was cloned) - int i = 0; - for (String s : this.iterable) { - assertEquals(String.valueOf(i++), s); - } - assertEquals(4, i); - } - - @Override - public void testRemove() { - super.testRemove(); - // "snapshot" clone iterable will still contain the element removed from the - // original collection - assertTrue(CollectionTools.contains(this.iterable, "three")); - } - - @Override - public void testRemover() { - super.testRemover(); - // "snapshot" clone iterable will still contain the element removed from the - // original collection - assertTrue(CollectionTools.contains(this.iterable, "three")); - } - - @Override - Iterable buildIterable(List c) { - return new SnapshotCloneIterable(c); - } - - @Override - Iterable buildRemovingIterable(final List c) { - return new SnapshotCloneIterable(c) { - @Override - protected void remove(String current) { - c.remove(current); - } - }; - } - - @Override - Iterable buildIterableWithRemover(List c) { - return new SnapshotCloneIterable(c, this.buildRemover(c)); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SnapshotCloneListIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SnapshotCloneListIterableTests.java deleted file mode 100644 index a6c5c1376b..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SnapshotCloneListIterableTests.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneListIterable; - -@SuppressWarnings("nls") -public class SnapshotCloneListIterableTests extends SnapshotCloneIterableTests { - - public SnapshotCloneListIterableTests(String name) { - super(name); - } - - public void testAdd() { - final List collection = this.buildCollection(); - this.iterable = this.buildRemovingIterable(collection); - - String added = "xxxx"; - assertFalse(CollectionTools.contains(this.iterable, added)); - for (ListIterator iterator = (ListIterator) this.iterable.iterator(); iterator.hasNext(); ) { - if (iterator.next().equals("two")) { - iterator.add(added); - } - } - assertTrue(collection.contains(added)); - // "snapshot" clone iterable not will contain the element added to the - // original collection - assertFalse(CollectionTools.contains(this.iterable, added)); - } - - public void testMissingMutatorAdd() { - final List collection = this.buildCollection(); - this.iterable = this.buildIterable(collection); - assertNotNull(this.iterable.toString()); - - String added = "xxxx"; - assertFalse(CollectionTools.contains(this.iterable, added)); - boolean exCaught = false; - for (ListIterator iterator = (ListIterator) this.iterable.iterator(); iterator.hasNext(); ) { - if (iterator.next().equals("three")) { - try { - iterator.add(added); - fail(); - } catch (RuntimeException ex) { - exCaught = true; - } - } - } - assertTrue(exCaught); - } - - public void testSet() { - final List collection = this.buildCollection(); - this.iterable = this.buildRemovingIterable(collection); - - String added = "xxxx"; - assertFalse(CollectionTools.contains(this.iterable, added)); - assertTrue(CollectionTools.contains(this.iterable, "two")); - for (ListIterator iterator = (ListIterator) this.iterable.iterator(); iterator.hasNext(); ) { - if (iterator.next().equals("two")) { - iterator.set(added); - } - } - assertTrue(collection.contains(added)); - assertFalse(collection.contains("two")); - // "snapshot" clone iterable will not be changed - assertFalse(CollectionTools.contains(this.iterable, added)); - assertTrue(CollectionTools.contains(this.iterable, "two")); - } - - public void testMissingMutatorSet() { - final List collection = this.buildCollection(); - this.iterable = this.buildIterable(collection); - assertNotNull(this.iterable.toString()); - - String added = "xxxx"; - assertFalse(CollectionTools.contains(this.iterable, added)); - boolean exCaught = false; - for (ListIterator iterator = (ListIterator) this.iterable.iterator(); iterator.hasNext(); ) { - if (iterator.next().equals("three")) { - try { - iterator.set(added); - fail(); - } catch (RuntimeException ex) { - exCaught = true; - } - } - } - assertTrue(exCaught); - } - - @Override - Iterable buildIterable(List c) { - return new SnapshotCloneListIterable(c); - } - - @Override - Iterable buildRemovingIterable(final List c) { - return new SnapshotCloneListIterable(c) { - @Override - protected void add(int index, String element) { - c.add(index, element); - } - @Override - protected void remove(int index) { - c.remove(index); - } - @Override - protected void set(int index, String element) { - c.set(index, element); - } - }; - } - - @Override - Iterable buildIterableWithRemover(List c) { - return new SnapshotCloneListIterable(c, this.buildMutator(c)); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/StackIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/StackIterableTests.java deleted file mode 100644 index 70a95bcd8a..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/StackIterableTests.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.Iterator; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.SimpleStack; -import org.eclipse.jpt.common.utility.internal.Stack; -import org.eclipse.jpt.common.utility.internal.iterables.StackIterable; - -@SuppressWarnings("nls") -public class StackIterableTests extends TestCase { - - public StackIterableTests(String name) { - super(name); - } - - public void testIterator() { - Iterator iterator = this.buildIterable().iterator(); - assertEquals("three", iterator.next()); - assertEquals("two", iterator.next()); - assertEquals("one", iterator.next()); - } - - public void testToString() { - assertNotNull(this.buildIterable().toString()); - } - - private Iterable buildIterable() { - return new StackIterable(this.buildStack()); - } - - private Stack buildStack() { - Stack stack = new SimpleStack(); - stack.push("one"); - stack.push("two"); - stack.push("three"); - return stack; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SuperIterableWrapperTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SuperIterableWrapperTests.java deleted file mode 100644 index c65608ef5d..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/SuperIterableWrapperTests.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.ArrayList; -import java.util.Collections; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper; - -@SuppressWarnings("nls") -public class SuperIterableWrapperTests extends TestCase { - - public SuperIterableWrapperTests(String name) { - super(name); - } - - public void testIterator() { - ArrayList list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - String concat = ""; - for (String s : list) { - concat += s; - } - assertEquals("foobarbaz", concat); - - Iterable iterable = new SuperIterableWrapper(list); - concat = ""; - for (Object s : iterable) { - concat += s; - } - assertEquals("foobarbaz", concat); - } - - public void testToString() { - Iterable iterable = new SuperIterableWrapper(Collections.emptyList()); - assertNotNull(iterable.toString()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/TransformationIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/TransformationIterableTests.java deleted file mode 100644 index 5a16de67c8..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/TransformationIterableTests.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.ArrayList; -import java.util.Collection; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; - -@SuppressWarnings("nls") -public class TransformationIterableTests extends TestCase { - - public TransformationIterableTests(String name) { - super(name); - } - - public void testTransform1() { - int i = 1; - for (Integer integer : this.buildIterable1()) { - assertEquals(i++, integer.intValue()); - } - } - - private Iterable buildIterable1() { - return this.buildTransformationIterable1(this.buildNestedIterable()); - } - - private Iterable buildTransformationIterable1(Iterable nestedIterable) { - // transform each string into an integer with a value of the string's length - return new TransformationIterable(nestedIterable) { - @Override - protected Integer transform(String next) { - return new Integer(next.length()); - } - }; - } - - public void testTransform2() { - int i = 1; - for (Integer integer : this.buildIterable2()) { - assertEquals(i++, integer.intValue()); - } - } - - private Iterable buildIterable2() { - return this.buildTransformationIterable2(this.buildNestedIterable()); - } - - private Iterable buildTransformationIterable2(Iterable nestedIterable) { - // transform each string into an integer with a value of the string's length - return new TransformationIterable(nestedIterable, this.buildTransformer()); - } - - private Transformer buildTransformer() { - // transform each string into an integer with a value of the string's length - return new Transformer() { - public Integer transform(String next) { - return new Integer(next.length()); - } - }; - } - - private Iterable buildNestedIterable() { - Collection c = new ArrayList(); - c.add("1"); - c.add("22"); - c.add("333"); - c.add("4444"); - c.add("55555"); - c.add("666666"); - c.add("7777777"); - c.add("88888888"); - return c; - } - - public void testToString() { - assertNotNull(this.buildIterable1().toString()); - } - - public void testMissingTransformer() { - Iterable iterable = new TransformationIterable(this.buildNestedIterable()); - boolean exCaught = false; - try { - int i = 1; - for (Integer integer : iterable) { - assertEquals(i++, integer.intValue()); - } - } catch (RuntimeException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/TransformationListIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/TransformationListIterableTests.java deleted file mode 100644 index 6ac6a16d07..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/TransformationListIterableTests.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationListIterable; - -@SuppressWarnings("nls") -public class TransformationListIterableTests extends TestCase { - - public TransformationListIterableTests(String name) { - super(name); - } - - public void testTransform1() { - int i = 1; - for (Integer integer : this.buildIterable1()) { - assertEquals(i++, integer.intValue()); - } - } - - private Iterable buildIterable1() { - return this.buildTransformationListIterable1(this.buildNestedList()); - } - - private Iterable buildTransformationListIterable1(List nestedList) { - // transform each string into an integer with a value of the string's length - return new TransformationListIterable(nestedList) { - @Override - protected Integer transform(String next) { - return new Integer(next.length()); - } - }; - } - - public void testTransform2() { - int i = 1; - for (Integer integer : this.buildIterable2()) { - assertEquals(i++, integer.intValue()); - } - } - - private Iterable buildIterable2() { - return this.buildTransformationListIterable2(this.buildNestedList()); - } - - private Iterable buildTransformationListIterable2(List nestedList) { - // transform each string into an integer with a value of the string's length - return new TransformationListIterable(nestedList, this.buildTransformer()); - } - - private Transformer buildTransformer() { - // transform each string into an integer with a value of the string's length - return new Transformer() { - public Integer transform(String next) { - return new Integer(next.length()); - } - }; - } - - private List buildNestedList() { - List c = new ArrayList(); - c.add("1"); - c.add("22"); - c.add("333"); - c.add("4444"); - c.add("55555"); - c.add("666666"); - c.add("7777777"); - c.add("88888888"); - return c; - } - - public void testToString() { - assertNotNull(this.buildIterable1().toString()); - } - - public void testMissingTransformer() { - Iterable iterable = new TransformationListIterable(this.buildNestedList()); - boolean exCaught = false; - try { - int i = 1; - for (Integer integer : iterable) { - assertEquals(i++, integer.intValue()); - } - } catch (RuntimeException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/TreeIterableTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/TreeIterableTests.java deleted file mode 100644 index dda3533e2b..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterables/TreeIterableTests.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterables; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.iterables.TreeIterable; -import org.eclipse.jpt.common.utility.internal.iterators.TreeIterator; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class TreeIterableTests extends TestCase { - /** this will be populated with all the nodes created for the test */ - Collection nodes = new ArrayList(); - - public TreeIterableTests(String name) { - super(name); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testIterator1() { - for (TreeNode tn : this.buildTreeIterable1()) { - assertTrue(this.nodes.contains(tn)); - } - } - - public void testIterator2() { - for (TreeNode tn : this.buildTreeIterable2()) { - assertTrue(this.nodes.contains(tn)); - } - } - - public void testMidwife1() { - for (TreeNode tn : new TreeIterable(this.buildTree(), this.buildMidwife())) { - assertTrue(this.nodes.contains(tn)); - } - } - - public void testMidwife2() { - for (TreeNode tn : new TreeIterable(new TreeNode[] { this.buildTree() }, this.buildMidwife())) { - assertTrue(this.nodes.contains(tn)); - } - } - - public void testToString() { - assertNotNull(this.buildTreeIterable1().toString()); - } - - public void testMissingMidwife() { - boolean exCaught = false; - try { - for (TreeNode tn : new TreeIterable(this.buildTree())) { - assertTrue(this.nodes.contains(tn)); - } - } catch (RuntimeException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - private Iterable buildTreeIterable1() { - return new TreeIterable(this.buildTree()) { - @Override - public Iterator children(TreeNode next) { - return next.children(); - } - }; - } - - private Iterable buildTreeIterable2() { - return new TreeIterable(new TreeNode[] { this.buildTree() }) { - @Override - public Iterator children(TreeNode next) { - return next.children(); - } - }; - } - - private TreeIterator.Midwife buildMidwife() { - return new TreeIterator.Midwife() { - public Iterator children(TreeNode next) { - return next.children(); - } - }; - } - - private TreeNode buildTree() { - TreeNode root = new TreeNode("root"); - TreeNode child1 = new TreeNode(root, "child 1"); - new TreeNode(child1, "grandchild 1A"); - TreeNode child2 = new TreeNode(root, "child 2"); - new TreeNode(child2, "grandchild 2A"); - TreeNode grandchild2B = new TreeNode(child2, "grandchild 2B"); - new TreeNode(grandchild2B, "great-grandchild 2B1"); - new TreeNode(grandchild2B, "great-grandchild 2B2"); - TreeNode grandchild2C = new TreeNode(child2, "grandchild 2C"); - new TreeNode(grandchild2C, "great-grandchild 2C1"); - new TreeNode(root, "child 3"); - return root; - } - - public class TreeNode { - private String name; - private Collection children = new ArrayList(); - - public TreeNode(String name) { - super(); - TreeIterableTests.this.nodes.add(this); // log node - this.name = name; - } - - public TreeNode(TreeNode parent, String name) { - this(name); - parent.addChild(this); - } - - public String getName() { - return this.name; - } - - private void addChild(TreeNode child) { - this.children.add(child); - } - - public Iterator children() { - return this.children.iterator(); - } - - public int childrenSize() { - return this.children.size(); - } - - @Override - public String toString() { - return "TreeNode(" + this.name + ")"; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ArrayIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ArrayIteratorTests.java deleted file mode 100644 index 8c8cda0ae7..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ArrayIteratorTests.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.Iterator; -import java.util.NoSuchElementException; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; - -@SuppressWarnings("nls") -public class ArrayIteratorTests extends TestCase { - - public ArrayIteratorTests(String name) { - super(name); - } - - public void testHasNext() { - int i = 0; - for (Iterator stream = this.buildIterator(); stream.hasNext(); ) { - stream.next(); - i++; - } - assertEquals(this.buildArray().length, i); - } - - public void testNext() { - int i = 1; - for (Iterator stream = this.buildIterator(); stream.hasNext(); ) { - assertEquals("bogus element", i++, Integer.parseInt(stream.next())); - } - } - - public void testNoSuchElementException() { - boolean exCaught = false; - Iterator stream = this.buildIterator(); - String string = null; - while (stream.hasNext()) { - string = stream.next(); - } - try { - string = stream.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + string, exCaught); - } - - public void testUnsupportedOperationException() { - boolean exCaught = false; - for (Iterator stream = this.buildIterator(); stream.hasNext(); ) { - if (stream.next().equals("3")) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - public void testIllegalArgumentException() { - this.triggerIllegalArgumentException(-1, 1); - this.triggerIllegalArgumentException(8, 1); - this.triggerIllegalArgumentException(0, -1); - this.triggerIllegalArgumentException(0, 9); - } - - public void testGenerics() { - Integer[] integers = new Integer[3]; - integers[0] = new Integer(0); - integers[1] = new Integer(1); - integers[2] = new Integer(2); - int i = 0; - for (Iterator stream = this.buildGenericIterator(integers); stream.hasNext();) { - assertEquals(i++, stream.next().intValue()); - } - assertEquals(integers.length, i); - } - - Iterator buildGenericIterator(Integer[] integers) { - return new ArrayIterator(integers); - } - - public void testVarargs() { - int i = 0; - for (Iterator stream = this.buildVarArgIterator(); stream.hasNext();) { - assertEquals(i++, stream.next().intValue()); - } - assertEquals(3, i); - } - - Iterator buildVarArgIterator() { - return new ArrayIterator(new Integer(0), new Integer(1), new Integer(2)); - } - - void triggerIllegalArgumentException(int start, int length) { - boolean exCaught = false; - Iterator stream = null; - try { - stream = this.buildIterator(start, length); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue("IllegalArgumentException not thrown: " + stream, exCaught); - } - - Iterator buildIterator() { - return this.buildIterator(this.buildArray()); - } - - Iterator buildIterator(String[] array) { - return new ArrayIterator(array); - } - - Iterator buildIterator(int start, int length) { - return this.buildIterator(this.buildArray(), start, length); - } - - Iterator buildIterator(String[] array, int start, int length) { - return new ArrayIterator(array, start, length); - } - - String[] buildArray() { - return new String[] { "1", "2", "3", "4", "5", "6", "7", "8" }; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ArrayListIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ArrayListIteratorTests.java deleted file mode 100644 index cae1762c27..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ArrayListIteratorTests.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.Iterator; -import java.util.ListIterator; -import java.util.NoSuchElementException; - -import org.eclipse.jpt.common.utility.internal.iterators.ArrayListIterator; - -@SuppressWarnings("nls") -public class ArrayListIteratorTests extends ArrayIteratorTests { - - public ArrayListIteratorTests(String name) { - super(name); - } - - public void testHasPrevious() { - ListIterator stream = this.buildListIterator(); - while (stream.hasNext()) { - stream.next(); - } - int i = 0; - while (stream.hasPrevious()) { - stream.previous(); - i++; - } - assertEquals(this.buildArray().length, i); - } - - public void testPrevious() { - ListIterator stream = this.buildListIterator(); - while (stream.hasNext()) { - stream.next(); - } - int i = this.buildArray().length; - while (stream.hasPrevious()) { - assertEquals("bogus element", i--, Integer.parseInt(stream.previous())); - } - } - - public void testNextIndex() { - int i = 0; - ListIterator stream = this.buildListIterator(); - while (stream.hasNext()) { - assertEquals(i, stream.nextIndex()); - stream.next(); - i++; - } - assertEquals(i, stream.nextIndex()); - } - - public void testPreviousIndex() { - int i = 0; - ListIterator stream = this.buildListIterator(); - while (stream.hasNext()) { - assertEquals(i - 1, stream.previousIndex()); - stream.next(); - i++; - } - assertEquals(i - 1, stream.previousIndex()); - } - - @Override - public void testNoSuchElementException() { - boolean exCaught = false; - ListIterator stream = this.buildListIterator(); - String string = null; - try { - string = stream.previous(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + string, exCaught); - } - - public void testUnsupportedOperationExceptionAdd() { - boolean exCaught = false; - for (ListIterator stream = this.buildListIterator(); stream.hasNext();) { - if (stream.next().equals("3")) { - try { - stream.add("3.5"); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - public void testUnsupportedOperationExceptionSet() { - boolean exCaught = false; - for (ListIterator stream = this.buildListIterator(); stream.hasNext();) { - if (stream.next().equals("3")) { - try { - stream.set("three"); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - @Override - Iterator buildGenericIterator(Integer[] integers) { - return new ArrayListIterator(integers); - } - - @Override - Iterator buildVarArgIterator() { - return new ArrayListIterator(new Integer(0), new Integer(1), new Integer(2)); - } - - private ListIterator buildListIterator() { - return this.buildListIterator(this.buildArray()); - } - - private ListIterator buildListIterator(String[] array) { - return new ArrayListIterator(array); - } - - @Override - Iterator buildIterator(String[] array) { - return new ArrayListIterator(array); - } - - @Override - Iterator buildIterator(String[] array, int start, int length) { - return new ArrayListIterator(array, start, length); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ChainIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ChainIteratorTests.java deleted file mode 100644 index b4cdcf1569..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ChainIteratorTests.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.AbstractCollection; -import java.util.AbstractList; -import java.util.Iterator; -import java.util.NoSuchElementException; -import java.util.Vector; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.iterators.ChainIterator; - -@SuppressWarnings("nls") -public class ChainIteratorTests extends TestCase { - private final static Class[] VECTOR_HIERARCHY = { Vector.class, AbstractList.class, AbstractCollection.class, Object.class }; - - public ChainIteratorTests(String name) { - super(name); - } - - public void testHasNext() { - int i = 0; - for (Iterator> stream = this.buildIterator(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(VECTOR_HIERARCHY.length, i); - } - - public void testInnerHasNext() { - int i = 0; - for (Iterator> stream = this.buildInnerIterator(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(VECTOR_HIERARCHY.length, i); - } - - public void testNext() { - int i = 0; - for (Iterator> stream = this.buildIterator(); stream.hasNext(); i++) { - assertEquals("bogus link", VECTOR_HIERARCHY[i], stream.next()); - } - } - - public void testInnerNext() { - int i = 0; - for (Iterator> stream = this.buildInnerIterator(); stream.hasNext(); i++) { - assertEquals("bogus link", VECTOR_HIERARCHY[i], stream.next()); - } - } - - public void testNoSuchElementException() { - boolean exCaught = false; - Iterator> stream = this.buildIterator(); - Class javaClass = null; - while (stream.hasNext()) { - javaClass = stream.next(); - } - try { - javaClass = stream.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + javaClass, exCaught); - } - - public void testUnsupportedOperationException() { - boolean exCaught = false; - for (Iterator> stream = this.buildIterator(); stream.hasNext();) { - if (stream.next() == AbstractCollection.class) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - private Iterator> buildIterator() { - return this.buildChainIterator(Vector.class, this.buildLinker()); - } - - private Iterator> buildInnerIterator() { - return this.buildInnerChainIterator(Vector.class); - } - - private Iterator> buildChainIterator(Class startLink, ChainIterator.Linker> linker) { - return new ChainIterator>(startLink, linker); - } - - private ChainIterator.Linker> buildLinker() { - // chain up the class's hierarchy - return new ChainIterator.Linker>() { - public Class nextLink(Class currentLink) { - return currentLink.getSuperclass(); - } - }; - } - - private Iterator> buildInnerChainIterator(Class startLink) { - // chain up the class's hierarchy - return new ChainIterator>(startLink) { - @Override - protected Class nextLink(Class currentLink) { - return currentLink.getSuperclass(); - } - }; - } - - public void testInvalidChainIterator() { - // missing method override - Iterator> iterator = new ChainIterator>(Vector.class); - boolean exCaught = false; - try { - Class c = iterator.next(); - fail("invalid class: " + c.getName()); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown", exCaught); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/CloneIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/CloneIteratorTests.java deleted file mode 100644 index 19c45dfd35..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/CloneIteratorTests.java +++ /dev/null @@ -1,237 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.NoSuchElementException; - -import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; -import org.eclipse.jpt.common.utility.tests.internal.MultiThreadedTestCase; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class CloneIteratorTests - extends MultiThreadedTestCase -{ - Collection originalCollection; - - private Collection concurrentCollection; - - public CloneIteratorTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.originalCollection = this.buildCollection(); - } - - public void testHasNext() { - int originalSize = this.originalCollection.size(); - int i = 0; - for (Iterator stream = this.buildCloneIterator(); stream.hasNext();) { - stream.next(); - // should allow concurrent modification - this.originalCollection.add("foo"); - i++; - } - assertTrue(originalSize != this.originalCollection.size()); - assertEquals(originalSize, i); - } - - public void testNext() { - Iterator nestedIterator = this.originalCollection.iterator(); - for (Iterator stream = this.buildCloneIterator(); stream.hasNext();) { - assertEquals("bogus element", nestedIterator.next(), stream.next()); - } - } - - public void testNoSuchElementException() { - boolean exCaught = false; - Iterator stream = this.buildCloneIterator(); - String string = null; - while (stream.hasNext()) { - string = stream.next(); - } - try { - string = stream.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + string, exCaught); - } - - public void testRemoveDefault() { - boolean exCaught = false; - for (Iterator stream = this.buildCloneIterator(); stream.hasNext();) { - if (stream.next().equals("three")) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - public void testRemoveEliminator() { - CloneIterator.Remover eliminator = new CloneIterator.Remover() { - public void remove(String element) { - CloneIteratorTests.this.originalCollection.remove(element); - } - }; - this.verifyRemove(new CloneIterator(this.originalCollection, eliminator)); - } - - public void testRemoveSubclass() { - this.verifyRemove(new CloneIterator(this.originalCollection) { - @Override - protected void remove(String current) { - CloneIteratorTests.this.originalCollection.remove(current); - } - }); - } - - /** - * Test concurrent access: First build a clone iterator in a separate thread - * that hangs momentarily during its construction; then modify the shared - * collection in this thread. This would cause a - * ConcurrentModificationException in the other thread if the clone iterator - * were not synchronized on the original collection. - */ - public void testConcurrentAccess() throws Exception { - SlowCollection slow = new SlowCollection(); - this.populateCollection(slow); - // using the unsynchronized collection will cause the test to fail - // this.originalCollection = slow; - this.originalCollection = Collections.synchronizedCollection(slow); - - this.concurrentCollection = new ArrayList(); - Thread thread = this.buildThread(this.buildRunnable()); - thread.start(); - while ( ! slow.hasStartedClone()) { - // wait for the other thread to start the clone... - Thread.yield(); - } - // ...then sneak in an extra element - this.originalCollection.add("seventeen"); - thread.join(); - Collection expected = new ArrayList(); - this.populateCollection(expected); - assertEquals(expected, this.concurrentCollection); - } - - private Runnable buildRunnable() { - return new TestRunnable() { - @Override - protected void run_() throws Throwable { - CloneIteratorTests.this.loopWithCloneIterator(); - } - }; - } - - /** - * use a clone iterator to loop over the "slow" collection and copy its - * contents to the concurrent collection - */ - void loopWithCloneIterator() { - for (Iterator stream = this.buildCloneIterator(); stream.hasNext();) { - this.concurrentCollection.add(stream.next()); - } - } - - private void verifyRemove(Iterator iterator) { - Object removed = "three"; - assertTrue(this.originalCollection.contains(removed)); - // try to remove before calling #next() - boolean exCaught = false; - try { - iterator.remove(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue("IllegalStateException not thrown", exCaught); - while (iterator.hasNext()) { - if (iterator.next().equals(removed)) { - iterator.remove(); - // try to remove twice - exCaught = false; - try { - iterator.remove(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue("IllegalStateException not thrown", exCaught); - } - } - assertFalse(this.originalCollection.contains(removed)); - } - - private Iterator buildCloneIterator() { - return this.buildCloneIterator(this.originalCollection); - } - - private Iterator buildCloneIterator(Collection c) { - return new CloneIterator(c); - } - - private Collection buildCollection() { - Collection c = this.buildEmptyCollection(); - this.populateCollection(c); - return c; - } - - protected Collection buildEmptyCollection() { - return new ArrayList(); - } - - private void populateCollection(Collection c) { - c.add("one"); - c.add("two"); - c.add("three"); - c.add("four"); - c.add("five"); - c.add("six"); - c.add("seven"); - c.add("eight"); - } - - // ********** custom collection ********** - static class SlowCollection extends ArrayList { - private static final long serialVersionUID = 1L; - private boolean hasStartedClone = false; - - public SlowCollection() { - super(); - } - - @Override - public Object[] toArray() { - this.setHasStartedClone(true); - // take a little snooze before returning the array - TestTools.sleep(100); - return super.toArray(); - } - - synchronized void setHasStartedClone(boolean hasStartedClone) { - this.hasStartedClone = hasStartedClone; - } - - synchronized boolean hasStartedClone() { - return this.hasStartedClone; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/CloneListIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/CloneListIteratorTests.java deleted file mode 100644 index 0f3a841306..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/CloneListIteratorTests.java +++ /dev/null @@ -1,397 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.ListIterator; -import java.util.NoSuchElementException; - -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.common.utility.tests.internal.MultiThreadedTestCase; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class CloneListIteratorTests - extends MultiThreadedTestCase -{ - List originalList; - - private List concurrentList; - - public CloneListIteratorTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.originalList = this.buildList(); - } - - public void testHasNext() { - int originalSize = this.originalList.size(); - int i = 0; - for (ListIterator stream = this.buildCloneListIterator(); stream.hasNext();) { - stream.next(); - // should allow concurrent modification - this.originalList.add("foo"); - i++; - } - assertTrue(originalSize != this.originalList.size()); - assertEquals(originalSize, i); - } - - public void testNext() { - ListIterator nestedListIterator = this.buildNestedListIterator(); - for (ListIterator stream = this.buildCloneListIterator(); stream.hasNext();) { - assertEquals("bogus element", nestedListIterator.next(), stream.next()); - } - } - - public void testIndex() { - ListIterator cloneListIterator = this.buildCloneListIterator(); - ListIterator nestedListIterator = this.buildNestedListIterator(); - for (int i = 0; i < 7; i++) { - nestedListIterator.next(); - cloneListIterator.next(); - assertEquals("bogus index", nestedListIterator.nextIndex(), cloneListIterator.nextIndex()); - assertEquals("bogus index", nestedListIterator.previousIndex(), cloneListIterator.previousIndex()); - } - - for (int i = 0; i < 3; i++) { - nestedListIterator.previous(); - cloneListIterator.previous(); - assertEquals("bogus index", nestedListIterator.nextIndex(), cloneListIterator.nextIndex()); - assertEquals("bogus index", nestedListIterator.previousIndex(), cloneListIterator.previousIndex()); - } - - while (nestedListIterator.hasNext()) { - nestedListIterator.next(); - cloneListIterator.next(); - assertEquals("bogus index", nestedListIterator.nextIndex(), cloneListIterator.nextIndex()); - assertEquals("bogus index", nestedListIterator.previousIndex(), cloneListIterator.previousIndex()); - } - } - - public void testHasPrevious() { - int originalSize = this.originalList.size(); - int i = 0; - ListIterator stream = this.buildCloneListIterator(); - while (stream.hasNext()) { - stream.next(); - this.originalList.add("foo"); - i++; - } - assertTrue(originalSize != this.originalList.size()); - originalSize = this.originalList.size(); - while (stream.hasPrevious()) { - stream.previous(); - // should allow concurrent modification - this.originalList.add("bar"); - i--; - } - assertTrue(originalSize != this.originalList.size()); - assertEquals(0, i); - } - - public void testPrevious() { - ListIterator nestedListIterator = this.buildNestedListIterator(); - ListIterator stream = this.buildCloneListIterator(); - while (stream.hasNext()) { - nestedListIterator.next(); - stream.next(); - } - while (stream.hasPrevious()) { - assertEquals("bogus element", nestedListIterator.previous(), stream.previous()); - } - } - - public void testNoSuchElementException() { - boolean exCaught = false; - ListIterator stream = this.buildCloneListIterator(); - String string = null; - while (stream.hasNext()) { - string = stream.next(); - } - try { - string = stream.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + string, exCaught); - - exCaught = false; - while (stream.hasPrevious()) { - string = stream.previous(); - } - try { - string = stream.previous(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + string, exCaught); - } - - public void testModifyDefault() { - boolean exCaught = false; - for (ListIterator stream = this.buildCloneListIterator(); stream.hasNext();) { - if (stream.next().equals("three")) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - - exCaught = false; - for (ListIterator stream = this.buildCloneListIterator(); stream.hasNext();) { - if (stream.next().equals("three")) { - try { - stream.add("three and a half"); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - - exCaught = false; - for (ListIterator stream = this.buildCloneListIterator(); stream.hasNext();) { - if (stream.next().equals("three")) { - try { - stream.set("another three"); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - public void testModifyMutatorNext() { - this.verifyModifyNext(new CloneListIterator(this.originalList, this.buildMutator())); - } - - public void testModifyMutatorPrevious() { - this.verifyModifyPrevious(new CloneListIterator(this.originalList, this.buildMutator())); - } - - private CloneListIterator.Mutator buildMutator() { - return new CloneListIterator.Mutator() { - public void add(int index, String o) { - CloneListIteratorTests.this.originalList.add(index, o); - } - - public void remove(int index) { - CloneListIteratorTests.this.originalList.remove(index); - } - - public void set(int index, String o) { - CloneListIteratorTests.this.originalList.set(index, o); - } - }; - } - - public void testModifySubclassNext() { - this.verifyModifyNext(this.buildSubclass()); - } - - public void testModifySubclassPrevious() { - this.verifyModifyPrevious(this.buildSubclass()); - } - - private ListIterator buildSubclass() { - return new CloneListIterator(this.originalList) { - @Override - protected void add(int currentIndex, String o) { - CloneListIteratorTests.this.originalList.add(currentIndex, o); - } - - @Override - protected void remove(int currentIndex) { - CloneListIteratorTests.this.originalList.remove(currentIndex); - } - - @Override - protected void set(int currentIndex, String o) { - CloneListIteratorTests.this.originalList.set(currentIndex, o); - } - }; - } - - private void verifyModifyNext(ListIterator iterator) { - String removed = "three"; - String addedAfter = "five"; - String added = "five and a half"; - String replaced = "seven"; - String replacement = "another seven"; - assertTrue(this.originalList.contains(removed)); - assertTrue(this.originalList.contains(addedAfter)); - assertTrue(this.originalList.contains(replaced)); - // try to remove before calling #next() - boolean exCaught = false; - try { - iterator.remove(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue(exCaught); - while (iterator.hasNext()) { - String next = iterator.next(); - if (next.equals(addedAfter)) { - iterator.add(added); - } - if (next.equals(removed)) { - iterator.remove(); - // try to remove twice - exCaught = false; - try { - iterator.remove(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - if (next.equals(replaced)) { - iterator.set(replacement); - } - } - assertTrue(this.originalList.contains(added)); - assertFalse(this.originalList.contains(removed)); - assertFalse(this.originalList.contains(replaced)); - assertTrue(this.originalList.contains(replacement)); - } - - private void verifyModifyPrevious(ListIterator iterator) { - String removed = "three"; - String addedBefore = "five"; - String added = "four and a half"; - String replaced = "seven"; - String replacement = "another seven"; - assertTrue(this.originalList.contains(removed)); - assertTrue(this.originalList.contains(addedBefore)); - assertTrue(this.originalList.contains(replaced)); - while (iterator.hasNext()) { - iterator.next(); - } - while (iterator.hasPrevious()) { - Object previous = iterator.previous(); - if (previous.equals(addedBefore)) { - iterator.add(added); - } - if (previous.equals(removed)) { - iterator.remove(); - // try to remove twice - boolean exCaught = false; - try { - iterator.remove(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue("IllegalStateException not thrown", exCaught); - } - if (previous.equals(replaced)) { - iterator.set(replacement); - } - } - assertTrue(this.originalList.contains(added)); - assertFalse(this.originalList.contains(removed)); - assertFalse(this.originalList.contains(replaced)); - assertTrue(this.originalList.contains(replacement)); - } - - private ListIterator buildCloneListIterator() { - return this.buildCloneListIterator(this.originalList); - } - - private ListIterator buildCloneListIterator(List list) { - return new CloneListIterator(list); - } - - private ListIterator buildNestedListIterator() { - return this.originalList.listIterator(); - } - - private List buildList() { - List list = this.buildEmptyList(); - this.populateList(list); - return list; - } - - private void populateList(List list) { - list.add("zero"); - list.add("one"); - list.add("two"); - list.add("three"); - list.add("four"); - list.add("five"); - list.add("six"); - list.add("seven"); - list.add("eight"); - list.add("nine"); - } - - protected List buildEmptyList() { - return new ArrayList(); - } - - /** - * Test concurrent access: First build a clone iterator in a separate thread - * that hangs momentarily during its construction; then modify the shared - * collection in this thread. This would cause a - * ConcurrentModificationException in the other thread if the clone iterator - * were not synchronized on the original collection. - */ - public void testConcurrentAccess() throws Exception { - CloneIteratorTests.SlowCollection slow = new CloneIteratorTests.SlowCollection(); - this.populateList(slow); - // using the unsynchronized list will cause the test to fail - // this.originalList = slow; - this.originalList = Collections.synchronizedList(slow); - - this.concurrentList = new ArrayList(); - Thread thread = this.buildThread(this.buildRunnable()); - thread.start(); - while ( ! slow.hasStartedClone()) { - // wait for the other thread to start the clone... - Thread.yield(); - } - // ...then sneak in an extra element - this.originalList.add("seventeen"); - thread.join(); - List expected = new ArrayList(); - this.populateList(expected); - assertEquals(expected, this.concurrentList); - } - - private Runnable buildRunnable() { - return new TestRunnable() { - @Override - protected void run_() throws Throwable { - CloneListIteratorTests.this.loopWithCloneListIterator(); - } - }; - } - - /** - * use a clone iterator to loop over the "slow" collection and copy its - * contents to the concurrent collection - */ - void loopWithCloneListIterator() { - for (ListIterator stream = this.buildCloneListIterator(); stream.hasNext();) { - this.concurrentList.add(stream.next()); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/CompositeIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/CompositeIteratorTests.java deleted file mode 100644 index 2a7dbd7c01..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/CompositeIteratorTests.java +++ /dev/null @@ -1,351 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.NoSuchElementException; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; - -@SuppressWarnings("nls") -public class CompositeIteratorTests extends TestCase { - - public CompositeIteratorTests(String name) { - super(name); - } - - public void testHasAnother() { - this.verifyHasAnother(this.buildCompositeIterator()); - } - - public void testHasAnother2() { - this.verifyHasAnother(this.buildCompositeIterator2()); - } - - public void testHasAnother3() { - this.verifyHasAnother(this.buildCompositeIterator3()); - } - - void verifyHasAnother(Iterator stream) { - this.verifyHasAnother(8, stream); - } - - void verifyHasAnother(int expected, Iterator stream) { - int i = 0; - while (stream.hasNext()) { - stream.next(); - i++; - } - assertEquals(expected, i); - } - - public void testAnother() { - this.verifyAnother(this.buildCompositeIterator()); - } - - public void testAnother2() { - this.verifyAnother(this.buildCompositeIterator2()); - } - - public void testAnother3() { - this.verifyAnother(this.buildCompositeIterator3()); - } - - void verifyAnother(Iterator stream) { - this.verifyAnother(1, stream); - } - - void verifyAnother(int start, Iterator stream) { - int index = start; - while (stream.hasNext()) { - assertEquals("bogus element", String.valueOf(index++), stream.next().substring(0, 1)); - } - } - - public void testRemove() { - this.verifyRemove(); - } - - protected void verifyRemove() { - List list1 = this.buildList1(); - Object lastElement1 = list1.get(list1.size() - 1); - List list2 = this.buildList2(); - List list3 = this.buildList3(); - - List> list = new ArrayList>(); - list.add(list1.listIterator()); - list.add(list2.listIterator()); - list.add(list3.listIterator()); - - Iterator stream = this.buildCompositeIterator(list.listIterator()); - while (stream.hasNext()) { - Object next = stream.next(); - if (next.equals("333")) { - stream.remove(); - } - // test special case - where we are between iterators - if (next.equals(lastElement1)) { - // this will trigger the next iterator to be loaded - stream.hasNext(); - // now try to remove from the previous iterator - stream.remove(); - } - } - stream.remove(); - - assertEquals("nothing removed from collection 1", this.buildList1().size() - 2, list1.size()); - assertFalse("element still in collection 1", list1.contains("333")); - assertFalse("last element still in collection 1", list1.contains(lastElement1)); - assertTrue("wrong element removed from collection 1", list1.contains("22")); - - assertEquals("nothing removed from collection 3", this.buildList3().size() - 1, list3.size()); - assertFalse("element still in collection 3", list3.contains("88888888")); - assertTrue("wrong element removed from collection 3", list3.contains("666666")); - } - - public void testSingleElement() { - String item = "0"; - this.verifyHasAnother(9, this.buildCompositeIterator(item, this.buildCompositeIterator())); - this.verifyAnother(0, this.buildCompositeIterator(item, this.buildCompositeIterator())); - } - - public void testNoSuchElementException() { - this.verifyNoSuchElementException(this.buildCompositeIterator()); - } - - void verifyNoSuchElementException(Iterator stream) { - boolean exCaught = false; - String string = null; - while (stream.hasNext()) { - string = stream.next(); - } - try { - string = stream.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + string, exCaught); - } - - public void testUnsupportedOperationException() { - this.verifyUnsupportedOperationException(this.buildUnmodifiableCompositeIterator()); - } - - void verifyUnsupportedOperationException(Iterator stream) { - boolean exCaught = false; - while (stream.hasNext()) { - Object string = stream.next(); - if (string.equals("333")) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - public void testIllegalStateException() { - this.verifyIllegalStateException(); - } - - void verifyIllegalStateException() { - this.verifyIllegalStateException(this.buildCompositeIterator()); - } - - void verifyIllegalStateException(Iterator stream) { - boolean exCaught = false; - try { - stream.remove(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue("IllegalStateException not thrown", exCaught); - } - - public void testEmptyHasAnother1() { - this.verifyEmptyHasAnother(this.buildEmptyCompositeIterator1()); - } - - void verifyEmptyHasAnother(Iterator stream) { - int i = 0; - while (stream.hasNext()) { - stream.next(); - i++; - } - assertEquals(0, i); - } - - public void testEmptyNoSuchElementException1() { - this.verifyNoSuchElementException(this.buildEmptyCompositeIterator1()); - } - - public void testEmptyIllegalStateException1() { - this.verifyEmptyIllegalStateException1(); - } - - void verifyEmptyIllegalStateException1() { - this.verifyIllegalStateException(this.buildEmptyCompositeIterator1()); - } - - public void testEmptyHasAnother2() { - this.verifyEmptyHasAnother(this.buildEmptyCompositeIterator2()); - } - - public void testEmptyNoSuchElementException2() { - this.verifyNoSuchElementException(this.buildEmptyCompositeIterator2()); - } - - public void testEmptyIllegalStateException2() { - this.verifyEmptyIllegalStateException2(); - } - - void verifyEmptyIllegalStateException2() { - this.verifyIllegalStateException(this.buildEmptyCompositeIterator2()); - } - - Iterator buildCompositeIterator() { - return this.buildCompositeIterator(this.buildIterators()); - } - - Iterator buildEmptyCompositeIterator1() { - return this.buildCompositeIterator(this.buildEmptyIterators1()); - } - - Iterator buildEmptyCompositeIterator2() { - return this.buildCompositeIterator(this.buildEmptyIterators2()); - } - - Iterator buildUnmodifiableCompositeIterator() { - return this.buildCompositeIterator(this.buildUnmodifiableIterators()); - } - - // leave unchecked so we can override in subclass - @SuppressWarnings("unchecked") - Iterator buildCompositeIterator(Iterator iterators) { - return new CompositeIterator(iterators); - } - - // use vararg constructor - @SuppressWarnings("unchecked") - Iterator buildCompositeIterator2() { - return new CompositeIterator(this.buildIterator1(), this.buildIterator2(), this.buildIterator3()); - } - - // use vararg constructor - @SuppressWarnings("unchecked") - Iterator buildCompositeIterator3() { - return new CompositeIterator(new Iterator[] { this.buildIterator1(), this.buildIterator2(), this.buildIterator3() }); - } - - Iterator buildCompositeIterator(String string, Iterator iterator) { - return new CompositeIterator(string, iterator); - } - - ListIterator> buildIterators() { - List> list = new ArrayList>(); - list.add(this.buildIterator1()); - list.add(this.buildIterator2()); - list.add(this.buildIterator3()); - return list.listIterator(); - } - - ListIterator> buildEmptyIterators1() { - return this.buildEmptyIteratorIterator(); - } - - ListIterator> buildEmptyIterators2() { - List> list = new ArrayList>(); - list.add(this.buildEmptyStringIterator()); - list.add(this.buildEmptyStringIterator()); - list.add(this.buildEmptyStringIterator()); - return list.listIterator(); - } - - ListIterator> buildUnmodifiableIterators() { - List> list = new ArrayList>(); - list.add(this.buildUnmodifiableIterator1()); - list.add(this.buildUnmodifiableIterator2()); - list.add(this.buildUnmodifiableIterator3()); - return list.listIterator(); - } - - ListIterator buildIterator1() { - return this.buildList1().listIterator(); - } - - ListIterator buildIterator2() { - return this.buildList2().listIterator(); - } - - ListIterator buildIterator3() { - return this.buildList3().listIterator(); - } - - ListIterator buildUnmodifiableIterator1() { - return this.buildUnmodifiableList1().listIterator(); - } - - ListIterator buildUnmodifiableIterator2() { - return this.buildUnmodifiableList2().listIterator(); - } - - ListIterator buildUnmodifiableIterator3() { - return this.buildUnmodifiableList3().listIterator(); - } - - ListIterator> buildEmptyIteratorIterator() { - return (new ArrayList>()).listIterator(); - } - - ListIterator buildEmptyStringIterator() { - return (new ArrayList()).listIterator(); - } - - List buildList1() { - List list = new ArrayList(); - list.add("1"); - list.add("22"); - list.add("333"); - list.add("4444"); - return list; - } - - List buildList2() { - return new ArrayList(); - } - - List buildList3() { - List list = new ArrayList(); - list.add("55555"); - list.add("666666"); - list.add("7777777"); - list.add("88888888"); - return list; - } - - List buildUnmodifiableList1() { - return Collections.unmodifiableList(this.buildList1()); - } - - List buildUnmodifiableList2() { - return Collections.unmodifiableList(this.buildList2()); - } - - List buildUnmodifiableList3() { - return Collections.unmodifiableList(this.buildList3()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/CompositeListIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/CompositeListIteratorTests.java deleted file mode 100644 index 5544e86355..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/CompositeListIteratorTests.java +++ /dev/null @@ -1,331 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeListIterator; - -@SuppressWarnings("nls") -public class CompositeListIteratorTests extends ReadOnlyCompositeListIteratorTests { - - public CompositeListIteratorTests(String name) { - super(name); - } - - @Override - public void testRemove() { - super.testRemove(); - List list1 = this.buildList1(); - List list2 = this.buildList2(); - List list3 = this.buildList3(); - Object firstElement3 = list3.get(0); - - List> list = new ArrayList>(); - list.add(list1.listIterator()); - list.add(list2.listIterator()); - list.add(list3.listIterator()); - - ListIterator stream = (ListIterator) this.buildCompositeIterator(list.listIterator()); - // position to end of stream - while (stream.hasNext()) { - stream.next(); - } - while (stream.hasPrevious()) { - Object previous = stream.previous(); - if (previous.equals("333")) { - stream.remove(); - } - // test special case - where we are between iterators - if (previous.equals(firstElement3)) { - // this will trigger the next iterator to be loaded - stream.hasPrevious(); - // now try to remove from the previous iterator - stream.remove(); - } - } - stream.remove(); - - assertEquals("nothing removed from collection 1", this.buildList1().size() - 2, list1.size()); - assertFalse("element still in collection 1", list1.contains("1")); - assertFalse("element still in collection 1", list1.contains("333")); - - assertEquals("nothing removed from collection 3", this.buildList3().size() - 1, list3.size()); - assertFalse("first element still in collection 3", list3.contains(firstElement3)); - assertTrue("wrong element removed from collection 3", list3.contains("666666")); - } - - public void testAdd() { - List list1 = this.buildList1(); - Object lastElement1 = list1.get(list1.size() - 1); - List list2 = this.buildList2(); - List list3 = this.buildList3(); - Object firstElement3 = list3.get(0); - - List> list = new ArrayList>(); - list.add(list1.listIterator()); - list.add(list2.listIterator()); - list.add(list3.listIterator()); - - ListIterator stream = (ListIterator) this.buildCompositeIterator(list.listIterator()); - while (stream.hasNext()) { - Object next = stream.next(); - if (next.equals("333")) { - stream.add("3.5"); - } - // test special case - where we are between iterators - if (next.equals(lastElement1)) { - // this will trigger the next iterator to be loaded - stream.hasNext(); - // now try to add to the iterator - stream.add("something in 3"); - } - } - stream.add("finale"); - boolean checkForFinale = true; - while (stream.hasPrevious()) { - Object previous = stream.previous(); - if (checkForFinale) { - checkForFinale = false; - assertEquals("added element dropped", "finale", previous); - } - if (previous.equals("333")) { - stream.add("2.5"); - } - // test special case - where we are between iterators - if (previous.equals(firstElement3)) { - // this will trigger the next iterator to be loaded - stream.hasPrevious(); - // now try to remove from the previous iterator - stream.add("old start of 3"); - } - } - stream.add("prelude"); - assertEquals("added element dropped", "prelude", stream.previous()); - - assertEquals("elements not added to collection 1", this.buildList1().size() + 3, list1.size()); - assertEquals("element not added to collection 1", "prelude", list1.get(0)); - assertEquals("element not added to collection 1", "2.5", list1.get(3)); - assertEquals("element not added to collection 1", "3.5", list1.get(5)); - - assertEquals("elements not added to collection 3", this.buildList3().size() + 3, list3.size()); - assertEquals("element not added to collection 3", "something in 3", list3.get(0)); - assertEquals("element not added to collection 3", "old start of 3", list3.get(1)); - assertEquals("element not added to collection 3", "finale", list3.get(list3.size() - 1)); - - // add to the front - stream = (ListIterator) this.buildCompositeIterator(); - stream.add("blah"); - assertFalse("added element should be placed BEFORE the \"cursor\"", stream.next().equals("blah")); - - stream = (ListIterator) this.buildCompositeIterator(); - stream.add("blah"); - assertTrue("added element should be placed BEFORE the \"cursor\"", stream.previous().equals("blah")); - - stream = (ListIterator) this.buildCompositeIterator(); - while (stream.hasNext()) { - stream.next(); - } - while (stream.hasPrevious()) { - stream.previous(); - } - stream.add("blah"); - assertFalse("added element should be placed BEFORE the \"cursor\"", stream.next().equals("blah")); - - stream = (ListIterator) this.buildCompositeIterator(); - while (stream.hasNext()) { - stream.next(); - } - while (stream.hasPrevious()) { - stream.previous(); - } - stream.add("blah"); - assertTrue("added element should be placed BEFORE the \"cursor\"", stream.previous().equals("blah")); - - // add to the middle - stream = (ListIterator) this.buildCompositeIterator(); - stream.next(); - stream.add("blah"); - assertFalse("added element should be placed BEFORE the \"cursor\"", stream.next().equals("blah")); - - stream = (ListIterator) this.buildCompositeIterator(); - stream.next(); - stream.add("blah"); - assertTrue("added element should be placed BEFORE the \"cursor\"", stream.previous().equals("blah")); - - stream = (ListIterator) this.buildCompositeIterator(); - while (stream.hasNext()) { - stream.next(); - } - stream.previous(); - stream.add("blah"); - assertFalse("added element should be placed BEFORE the \"cursor\"", stream.next().equals("blah")); - - stream = (ListIterator) this.buildCompositeIterator(); - while (stream.hasNext()) { - stream.next(); - } - stream.previous(); - stream.add("blah"); - assertTrue("added element should be placed BEFORE the \"cursor\"", stream.previous().equals("blah")); - - // add to the end - stream = (ListIterator) this.buildCompositeIterator(); - while (stream.hasNext()) { - stream.next(); - } - stream.add("blah"); - assertFalse("added element should be placed BEFORE the \"cursor\"", stream.hasNext()); - - stream = (ListIterator) this.buildCompositeIterator(); - while (stream.hasNext()) { - stream.next(); - } - stream.add("blah"); - assertTrue("added element should be placed BEFORE the \"cursor\"", stream.previous().equals("blah")); - } - - public void testSet() { - List list1 = this.buildList1(); - Object lastElement1 = list1.get(list1.size() - 1); - List list2 = this.buildList2(); - List list3 = this.buildList3(); - Object firstElement3 = list3.get(0); - - List> list = new ArrayList>(); - list.add(list1.listIterator()); - list.add(list2.listIterator()); - list.add(list3.listIterator()); - - ListIterator stream = (ListIterator) this.buildCompositeIterator(list.listIterator()); - // position to end of stream - while (stream.hasNext()) { - Object next = stream.next(); - if (next.equals("333")) { - stream.set("333a"); - } - // test special case - where we are between iterators - if (next.equals(lastElement1)) { - // this will trigger the next iterator to be loaded - stream.hasNext(); - // now try to remove from the previous iterator - stream.set("end of 1"); - } - } - while (stream.hasPrevious()) { - Object previous = stream.previous(); - if (previous.equals("22")) { - stream.set("22a"); - } - // test special case - where we are between iterators - if (previous.equals(firstElement3)) { - // this will trigger the next iterator to be loaded - stream.hasPrevious(); - // now try to remove from the previous iterator - stream.set("start of 3"); - } - } - - assertEquals("element(s) added to collection 1", this.buildList1().size(), list1.size()); - assertEquals("element not set in collection 1", "22a", list1.get(1)); - assertFalse("element not set in collection 1", list1.contains("22")); - assertEquals("element not set in collection 1", "333a", list1.get(2)); - assertFalse("element not set in collection 1", list1.contains("333")); - assertEquals("element not set in collection 1", "end of 1", list1.get(list1.size() - 1)); - assertFalse("element not set in collection 1", list1.contains(lastElement1)); - - assertEquals("element(s) added to collection 3", this.buildList3().size(), list3.size()); - assertEquals("element not set in collection 3", "start of 3", list3.get(0)); - assertFalse("element not set in collection 3", list3.contains(firstElement3)); - } - - @Override - public void testNextIndexPreviousIndex() { - int i = 0; - ListIterator stream = (ListIterator) this.buildCompositeIterator(); - assertEquals(i, stream.nextIndex()); - assertEquals(i - 1, stream.previousIndex()); - while (stream.hasNext()) { - Object next = stream.next(); - i++; - if (next.equals("333")) { - stream.remove(); - i--; - } - if (next.equals("7777777")) { - stream.add("7.5"); - i++; - } - assertEquals(i, stream.nextIndex()); - assertEquals(i - 1, stream.previousIndex()); - } - assertEquals("index is corrupt", 8, i); - - assertEquals(i, stream.nextIndex()); - assertEquals(i - 1, stream.previousIndex()); - while (stream.hasPrevious()) { - Object previous = stream.previous(); - i--; - if (previous.equals("666666")) { - stream.remove(); - // removing a previous element, does not change the cursor - } - if (previous.equals("22")) { - stream.add("1.5"); - i++; - } - assertEquals(i, stream.nextIndex()); - assertEquals(i - 1, stream.previousIndex()); - } - assertEquals("index is corrupt", 0, i); - } - - @Override - public void testIllegalStateException() { - this.verifyIllegalStateException(); - } - - @Override - public void testEmptyIllegalStateException1() { - this.verifyEmptyIllegalStateException1(); - } - - @Override - public void testEmptyIllegalStateException2() { - this.verifyEmptyIllegalStateException2(); - } - - // unchecked so we can override the unchecked method in superclass - @Override - @SuppressWarnings("unchecked") - Iterator buildCompositeIterator(Iterator iterators) { - return new CompositeListIterator((ListIterator>) iterators); - } - - @Override - @SuppressWarnings("unchecked") - Iterator buildCompositeIterator2() { - return new CompositeListIterator(this.buildIterator1(), this.buildIterator2(), this.buildIterator3()); - } - - @Override - @SuppressWarnings("unchecked") - Iterator buildCompositeIterator3() { - return new CompositeListIterator(new ListIterator[] { this.buildIterator1(), this.buildIterator2(), this.buildIterator3() }); - } - - @Override - ListIterator buildCompositeListIterator(String string, ListIterator iterator) { - return new CompositeListIterator(string, iterator); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/EmptyIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/EmptyIteratorTests.java deleted file mode 100644 index 511e484849..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/EmptyIteratorTests.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.Iterator; -import java.util.NoSuchElementException; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; - -@SuppressWarnings("nls") -public class EmptyIteratorTests extends TestCase { - - public EmptyIteratorTests(String name) { - super(name); - } - - public void testHasNext() { - int i = 0; - for (Iterator stream = EmptyIterator.instance(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(0, i); - } - - public void testNext() { - for (Iterator stream = EmptyIterator.instance(); stream.hasNext();) { - fail("bogus element: " + stream.next()); - } - } - - public void testNoSuchElementException() { - boolean exCaught = false; - Iterator stream = EmptyIterator.instance(); - Object element = null; - while (stream.hasNext()) { - element = stream.next(); - } - try { - element = stream.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + element, exCaught); - } - - public void testUnsupportedOperationException() { - boolean exCaught = false; - try { - EmptyIterator.instance().remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/EmptyListIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/EmptyListIteratorTests.java deleted file mode 100644 index 1892415b13..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/EmptyListIteratorTests.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.ListIterator; -import java.util.NoSuchElementException; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator; - -@SuppressWarnings("nls") -public class EmptyListIteratorTests extends TestCase { - - public EmptyListIteratorTests(String name) { - super(name); - } - - public void testHasNext() { - int i = 0; - for (ListIterator stream = EmptyListIterator.instance(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(0, i); - } - - public void testNext() { - for (ListIterator stream = EmptyListIterator.instance(); stream.hasNext();) { - fail("bogus element: " + stream.next()); - } - } - - public void testNextIndex() { - ListIterator stream = EmptyListIterator.instance(); - assertEquals(0, stream.nextIndex()); - } - - public void testHasPrevious() { - ListIterator stream = EmptyListIterator.instance(); - int i = 0; - while (stream.hasPrevious()) { - stream.previous(); - i++; - } - assertEquals(0, i); - - while (stream.hasNext()) { - stream.next(); - } - i = 0; - while (stream.hasPrevious()) { - stream.previous(); - i++; - } - assertEquals(0, i); - } - - public void testPrevious() { - ListIterator stream = EmptyListIterator.instance(); - while (stream.hasPrevious()) { - fail("bogus element: " + stream.previous()); - } - while (stream.hasNext()) { - stream.next(); - } - while (stream.hasPrevious()) { - fail("bogus element: " + stream.previous()); - } - } - - public void testPreviousIndex() { - ListIterator stream = EmptyListIterator.instance(); - assertEquals(-1, stream.previousIndex()); - } - - public void testNoSuchElementException() { - boolean exCaught = false; - ListIterator stream = EmptyListIterator.instance(); - Object element = null; - while (stream.hasNext()) { - element = stream.next(); - } - try { - element = stream.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown (next): " + element, exCaught); - while (stream.hasPrevious()) { - element = stream.previous(); - } - try { - element = stream.previous(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown (previous): " + element, exCaught); - } - - public void testUnsupportedOperationException() { - boolean exCaught = false; - try { - EmptyListIterator.instance().remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue("UnsupportedOperationException not thrown (remove)", exCaught); - try { - EmptyListIterator.instance().set(new Object()); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue("UnsupportedOperationException not thrown (set)", exCaught); - try { - EmptyListIterator.instance().add(new Object()); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue("UnsupportedOperationException not thrown (add)", exCaught); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/EnumerationIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/EnumerationIteratorTests.java deleted file mode 100644 index a7c7d289e6..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/EnumerationIteratorTests.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.Enumeration; -import java.util.Iterator; -import java.util.NoSuchElementException; -import java.util.Vector; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.iterators.EnumerationIterator; - -@SuppressWarnings("nls") -public class EnumerationIteratorTests extends TestCase { - - public EnumerationIteratorTests(String name) { - super(name); - } - - public void testHasNext() { - int i = 0; - for (Iterator stream = this.buildIterator(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(this.buildVector().size(), i); - } - - public void testHasNextUpcast() { - int i = 0; - for (Iterator stream = this.buildIteratorUpcast(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(this.buildVector().size(), i); - } - - public void testNext() { - Enumeration enumeration = this.buildEnumeration(); - for (Iterator stream = this.buildIterator(); stream.hasNext();) { - assertEquals("bogus element", enumeration.nextElement(), stream.next()); - } - } - - public void testNextUpcast() { - Enumeration enumeration = this.buildEnumeration(); - for (Iterator stream = this.buildIteratorUpcast(); stream.hasNext();) { - assertEquals("bogus element", enumeration.nextElement(), stream.next()); - } - } - - public void testNoSuchElementException() { - boolean exCaught = false; - Iterator stream = this.buildIterator(); - String string = null; - while (stream.hasNext()) { - string = stream.next(); - } - try { - string = stream.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + string, exCaught); - } - - public void testUnsupportedOperationException() { - boolean exCaught = false; - for (Iterator stream = this.buildIterator(); stream.hasNext();) { - if (stream.next().equals("three")) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - private Iterator buildIterator() { - return this.buildIterator(this.buildEnumeration()); - } - - private Iterator buildIterator(Enumeration enumeration) { - return new EnumerationIterator(enumeration); - } - - private Enumeration buildEnumeration() { - return this.buildVector().elements(); - } - - private Vector buildVector() { - Vector v = new Vector(); - v.addElement("one"); - v.addElement("two"); - v.addElement("three"); - v.addElement("four"); - v.addElement("five"); - v.addElement("six"); - v.addElement("seven"); - v.addElement("eight"); - return v; - } - - private Iterator buildIteratorUpcast() { - return this.buildIteratorUpcast(this.buildEnumeration()); - } - - private Iterator buildIteratorUpcast(Enumeration enumeration) { - return new EnumerationIterator(enumeration); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/FilteringIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/FilteringIteratorTests.java deleted file mode 100644 index 6fe920b713..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/FilteringIteratorTests.java +++ /dev/null @@ -1,266 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.NoSuchElementException; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.SimpleFilter; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; - -@SuppressWarnings("nls") -public class FilteringIteratorTests extends TestCase { - - private static final String PREFIX = "prefix"; - - public FilteringIteratorTests(String name) { - super(name); - } - - public void testUnsupportedOperationException() { - boolean exCaught = false; - for (Iterator stream = this.buildAcceptIterator(); stream.hasNext();) { - String string = stream.next(); - if (string.equals(PREFIX + "3")) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - public void testNoSuchElementException() { - boolean exCaught = false; - Iterator stream = this.buildAcceptIterator(); - String string = null; - while (stream.hasNext()) { - string = stream.next(); - } - try { - string = stream.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + string, exCaught); - } - - public void testAcceptHasNext() { - int i = 0; - for (Iterator stream = this.buildAcceptIterator(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(6, i); - } - - public void testAcceptNext() { - for (Iterator stream = this.buildAcceptIterator(); stream.hasNext();) { - assertTrue("bogus accept", stream.next().startsWith(PREFIX)); - } - } - - public void testInnerHasNext() { - int i = 0; - for (Iterator stream = this.buildInnerIterator(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(6, i); - } - - public void testInnerNext() { - for (Iterator stream = this.buildInnerIterator(); stream.hasNext();) { - assertTrue("bogus accept", stream.next().startsWith(PREFIX)); - } - } - - public void testRejectHasNext() { - int i = 0; - for (Iterator stream = this.buildRejectIterator(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(2, i); - } - - public void testRejectNext() { - for (Iterator stream = this.buildRejectIterator(); stream.hasNext();) { - assertFalse("bogus reject", stream.next().startsWith(PREFIX)); - } - } - - public void testBothHasNext() { - // if both accept() and reject() are overridden, accept() is used - int i = 0; - for (Iterator stream = this.buildBothIterator(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(6, i); - } - - public void testLoadNext() { - // loadNext() used to cause a NPE when executing during the - // constructor because the "outer" class is not bound until completion - // of the constructor - for (Iterator stream = this.buildInnerIterator2(); stream.hasNext();) { - assertTrue("bogus accept", stream.next().startsWith(PREFIX)); - } - } - - public void testFilterHasNext() { - int i = 0; - for (Iterator stream = this.buildFilterIterator(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(6, i); - } - - public void testFilterNext() { - for (Iterator stream = this.buildFilterIterator(); stream.hasNext();) { - assertTrue("bogus accept", stream.next().startsWith(PREFIX)); - } - } - - private Iterator buildFilteredIterator(Iterator nestedIterator, Filter filter) { - return new FilteringIterator(nestedIterator, filter); - } - - private Iterator buildInnerFilteredIterator(Iterator nestedIterator) { - return new FilteringIterator(nestedIterator) { - @Override - protected boolean accept(String s) { - return s.startsWith(PREFIX); - } - }; - } - - String getPrefix() { - return PREFIX; - } - - // this inner iterator will call the "outer" object - private Iterator buildInnerFilteredIterator2(Iterator nestedIterator) { - return new FilteringIterator(nestedIterator) { - @Override - protected boolean accept(String s) { - return s.startsWith(FilteringIteratorTests.this.getPrefix()); - } - }; - } - - private Iterator buildNestedIterator() { - Collection c = new ArrayList(); - c.add(PREFIX + "1"); - c.add(PREFIX + "2"); - c.add(PREFIX + "3"); - c.add("4"); - c.add(PREFIX + "5"); - c.add(PREFIX + "6"); - c.add(PREFIX + "7"); - c.add("8"); - return c.iterator(); - } - - private Iterator buildAcceptIterator() { - return this.buildFilteredIterator(this.buildNestedIterator(), this.buildAcceptFilter(PREFIX)); - } - - private Iterator buildInnerIterator() { - return this.buildInnerFilteredIterator(this.buildNestedIterator()); - } - - // this inner iterator will call the "outer" object - private Iterator buildInnerIterator2() { - return this.buildInnerFilteredIterator2(this.buildNestedIterator()); - } - - private Iterator buildFilterIterator() { - return this.buildFilteredIterator(this.buildNestedIterator(), this.buildFilterFilter(PREFIX)); - } - - private Filter buildAcceptFilter(String prefix) { - return new SimpleFilter(prefix) { - private static final long serialVersionUID = 1L; - - @Override - public boolean accept(String s) { - return s.startsWith(this.criterion); - } - }; - } - - private Iterator buildRejectIterator() { - return this.buildFilteredIterator(this.buildNestedIterator(), this.buildRejectFilter(PREFIX)); - } - - private Filter buildRejectFilter(String prefix) { - return new SimpleFilter(prefix) { - private static final long serialVersionUID = 1L; - - @Override - public boolean reject(String s) { - return s.startsWith(this.criterion); - } - }; - } - - // use anonymous inner Filter - private Filter buildFilterFilter(final String prefix) { - return new Filter() { - public boolean accept(String s) { - return s.startsWith(prefix); - } - }; - } - - private Iterator buildBothIterator() { - return this.buildFilteredIterator(this.buildNestedIterator(), this.buildBothFilter(PREFIX)); - } - - private Filter buildBothFilter(String prefix) { - return new SimpleFilter(prefix) { - private static final long serialVersionUID = 1L; - - @Override - public boolean reject(String s) { - return s.startsWith(this.criterion); - } - - @Override - public boolean accept(String s) { - return s.startsWith(this.criterion); - } - }; - } - - public void testInvalidFilteringIterator() { - boolean exCaught = false; - try { - // missing method override - Iterator iterator = new FilteringIterator(this.buildNestedIterator()); - String s = iterator.next(); - fail("invalid string: " + s); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown", exCaught); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/GraphIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/GraphIteratorTests.java deleted file mode 100644 index e320f28988..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/GraphIteratorTests.java +++ /dev/null @@ -1,197 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.NoSuchElementException; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.GraphIterator; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class GraphIteratorTests extends TestCase { - /** this will be populated with all the nodes created for the test */ - Collection nodes = new ArrayList(); - - public GraphIteratorTests(String name) { - super(name); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testHasNext1() { - this.verifyHasNext(this.buildGraphIterator1()); - } - - public void testHasNext2() { - this.verifyHasNext(this.buildGraphIterator2()); - } - - private void verifyHasNext(Iterator iterator) { - int i = 0; - while (iterator.hasNext()) { - iterator.next(); - i++; - } - assertEquals(this.nodes.size(), i); - } - - public void testNext1() { - this.verifyNext(this.buildGraphIterator1()); - } - - public void testNext2() { - this.verifyNext(this.buildGraphIterator2()); - } - - private void verifyNext(Iterator iterator) { - while (iterator.hasNext()) { - assertTrue("bogus element", this.nodes.contains(iterator.next())); - } - } - - public void testNoSuchElementException1() { - this.verifyNoSuchElementException(this.buildGraphIterator1()); - } - - public void testNoSuchElementException2() { - this.verifyNoSuchElementException(this.buildGraphIterator2()); - } - - private void verifyNoSuchElementException(Iterator iterator) { - boolean exCaught = false; - while (iterator.hasNext()) { - iterator.next(); - } - try { - iterator.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown", exCaught); - } - - public void testSize1() { - this.verifySize(this.buildGraphIterator1()); - } - - public void testSize2() { - this.verifySize(this.buildGraphIterator2()); - } - - private void verifySize(Iterator iterator) { - int iteratorSize = CollectionTools.size(iterator); - int actualSize = this.nodes.size(); - assertTrue("Too few items in iterator.", iteratorSize >= actualSize); - assertTrue("Too many items in iterator.", iteratorSize <= actualSize); - } - - public void testInvalidGraphIterator() { - boolean exCaught = false; - try { - // missing method override - Iterator iterator = new GraphIterator(this.buildGraphRoot()); - GraphNode gn = iterator.next(); - fail("invalid graph node: " + gn); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown", exCaught); - } - - /** - * build a graph iterator with an explicit misterRogers - */ - private Iterator buildGraphIterator1() { - return new GraphIterator(this.buildGraphRoot(), this.buildMisterRogers()); - } - - private GraphIterator.MisterRogers buildMisterRogers() { - return new GraphIterator.MisterRogers() { - public Iterator neighbors(GraphNode next) { - return next.neighbors(); - } - }; - } - - /** - * build a graph iterator with an override - */ - private Iterator buildGraphIterator2() { - return new GraphIterator(this.buildGraphRoot()) { - @Override - public Iterator neighbors(GraphNode next) { - return next.neighbors(); - } - }; - } - - private GraphNode buildGraphRoot() { - GraphNode ncNode = new GraphNode("North Carolina"); - GraphNode vaNode = new GraphNode("Virginia"); - GraphNode scNode = new GraphNode("South Carolina"); - GraphNode gaNode = new GraphNode("Georgia"); - GraphNode flNode = new GraphNode("Florida"); - GraphNode alNode = new GraphNode("Alabama"); - GraphNode msNode = new GraphNode("Mississippi"); - GraphNode tnNode = new GraphNode("Tennessee"); - - ncNode.setNeighbors(new GraphNode[] { vaNode, scNode, gaNode, tnNode }); - vaNode.setNeighbors(new GraphNode[] { ncNode, tnNode }); - scNode.setNeighbors(new GraphNode[] { ncNode, gaNode }); - gaNode.setNeighbors(new GraphNode[] { ncNode, scNode, flNode, alNode, tnNode }); - flNode.setNeighbors(new GraphNode[] { gaNode }); - alNode.setNeighbors(new GraphNode[] { gaNode, msNode, tnNode }); - msNode.setNeighbors(new GraphNode[] { alNode, tnNode }); - tnNode.setNeighbors(new GraphNode[] { vaNode, ncNode, gaNode, alNode, msNode }); - - return ncNode; - } - - public class GraphNode { - private String name; - - private Collection neighbors = new ArrayList(); - - public GraphNode(String name) { - super(); - GraphIteratorTests.this.nodes.add(this); // log node - this.name = name; - } - - public String getName() { - return this.name; - } - - void setNeighbors(GraphNode[] neighbors) { - this.neighbors = CollectionTools.list(neighbors); - } - - public Iterator neighbors() { - return this.neighbors.iterator(); - } - - public int neighborsSize() { - return this.neighbors.size(); - } - - @Override - public String toString() { - return "GraphNode(" + this.name + ")"; - } - } -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/JptUtilityIteratorsTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/JptUtilityIteratorsTests.java deleted file mode 100644 index 54fb276ecb..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/JptUtilityIteratorsTests.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * decentralize test creation code - */ -public class JptUtilityIteratorsTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptUtilityIteratorsTests.class.getPackage().getName()); - - suite.addTestSuite(ArrayIteratorTests.class); - suite.addTestSuite(ArrayListIteratorTests.class); - suite.addTestSuite(ChainIteratorTests.class); - suite.addTestSuite(CloneIteratorTests.class); - suite.addTestSuite(CloneListIteratorTests.class); - suite.addTestSuite(CompositeIteratorTests.class); - suite.addTestSuite(CompositeListIteratorTests.class); - suite.addTestSuite(EmptyIteratorTests.class); - suite.addTestSuite(EmptyListIteratorTests.class); - suite.addTestSuite(EnumerationIteratorTests.class); - suite.addTestSuite(FilteringIteratorTests.class); - suite.addTestSuite(SuperIteratorWrapperTests.class); - suite.addTestSuite(GraphIteratorTests.class); - suite.addTestSuite(PeekableIteratorTests.class); - suite.addTestSuite(ReadOnlyCompositeListIteratorTests.class); - suite.addTestSuite(ReadOnlyIteratorTests.class); - suite.addTestSuite(ReadOnlyListIteratorTests.class); - suite.addTestSuite(SingleElementIteratorTests.class); - suite.addTestSuite(SingleElementListIteratorTests.class); - suite.addTestSuite(SynchronizedIteratorTests.class); - suite.addTestSuite(SynchronizedListIteratorTests.class); - suite.addTestSuite(TransformationIteratorTests.class); - suite.addTestSuite(TransformationListIteratorTests.class); - suite.addTestSuite(TreeIteratorTests.class); - - return suite; - } - - private JptUtilityIteratorsTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/PeekableIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/PeekableIteratorTests.java deleted file mode 100644 index 00a056f9a2..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/PeekableIteratorTests.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.NoSuchElementException; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.iterators.PeekableIterator; - -@SuppressWarnings("nls") -public class PeekableIteratorTests extends TestCase { - - public PeekableIteratorTests(String name) { - super(name); - } - - public void testUnsupportedOperationException() { - boolean exCaught = false; - for (Iterator stream = this.buildPeekableIterator(); stream.hasNext();) { - String string = stream.next(); - if (string.equals("three")) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - public void testNoSuchElementException() { - boolean exCaught = false; - Iterator stream = this.buildPeekableIterator(); - String string = null; - while (stream.hasNext()) { - string = stream.next(); - } - try { - string = stream.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + string, exCaught); - } - - public void testHasNext() { - int i = 0; - for (Iterator stream = this.buildPeekableIterator(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(6, i); - } - - public void testHasNextUpcast() { - int i = 0; - for (Iterator stream = this.buildPeekableIteratorUpcast(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(6, i); - } - - public void testNext() { - Iterator stream = this.buildPeekableIterator(); - assertEquals("zero", stream.next()); - assertEquals("one", stream.next()); - assertEquals("two", stream.next()); - assertEquals("three", stream.next()); - assertEquals("four", stream.next()); - assertEquals("five", stream.next()); - } - - public void testNextUpcast() { - Iterator stream = this.buildPeekableIteratorUpcast(); - assertEquals("zero", stream.next()); - assertEquals("one", stream.next()); - assertEquals("two", stream.next()); - assertEquals("three", stream.next()); - assertEquals("four", stream.next()); - assertEquals("five", stream.next()); - } - - public void testPeek() { - Object next = null; - for (PeekableIterator stream = this.buildPeekableIterator(); stream.hasNext();) { - Object peek = stream.peek(); - assertTrue("peek and next are prematurely identical", peek != next); - next = stream.next(); - assertTrue("peek and next are not identical", peek == next); - } - } - - public void testPeekUpcast() { - Object next = null; - for (PeekableIterator stream = this.buildPeekableIteratorUpcast(); stream.hasNext();) { - Object peek = stream.peek(); - assertTrue("peek and next are prematurely identical", peek != next); - next = stream.next(); - assertTrue("peek and next are not identical", peek == next); - } - } - - private PeekableIterator buildPeekableIterator() { - return this.buildPeekableIterator(this.buildNestedIterator()); - } - - private PeekableIterator buildPeekableIteratorUpcast() { - return this.buildPeekableIteratorUpcast(this.buildNestedIterator()); - } - - private PeekableIterator buildPeekableIterator(Iterator nestedIterator) { - return new PeekableIterator(nestedIterator); - } - - private PeekableIterator buildPeekableIteratorUpcast(Iterator nestedIterator) { - return new PeekableIterator(nestedIterator); - } - - private Iterator buildNestedIterator() { - Collection c = new ArrayList(); - c.add("zero"); - c.add("one"); - c.add("two"); - c.add("three"); - c.add("four"); - c.add("five"); - return c.iterator(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ReadOnlyCompositeListIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ReadOnlyCompositeListIteratorTests.java deleted file mode 100644 index dd1eea6db4..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ReadOnlyCompositeListIteratorTests.java +++ /dev/null @@ -1,205 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.NoSuchElementException; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyCompositeListIterator; - -@SuppressWarnings("nls") -public class ReadOnlyCompositeListIteratorTests extends CompositeIteratorTests { - - public ReadOnlyCompositeListIteratorTests(String name) { - super(name); - } - - @Override - void verifyHasAnother(Iterator stream) { - super.verifyHasAnother(stream); - ListIterator stream2 = (ListIterator) stream; - int i = 0; - while (stream2.hasPrevious()) { - stream2.previous(); - i++; - } - assertEquals(8, i); - } - - @Override - void verifyAnother(Iterator stream) { - super.verifyAnother(stream); - int i = 8; - ListIterator stream2 = (ListIterator) stream; - while (stream2.hasPrevious()) { - assertEquals("bogus element", String.valueOf(i--), stream2.previous().substring(0, 1)); - } - } - - public void testNextIndexPreviousIndex() { - int i = 0; - ListIterator stream = (ListIterator) this.buildCompositeIterator(); - assertEquals(i, stream.nextIndex()); - assertEquals(i - 1, stream.previousIndex()); - while (stream.hasNext()) { - stream.next(); - i++; - assertEquals(i, stream.nextIndex()); - assertEquals(i - 1, stream.previousIndex()); - } - assertEquals("index is corrupt", 8, i); - - assertEquals(i, stream.nextIndex()); - assertEquals(i - 1, stream.previousIndex()); - while (stream.hasPrevious()) { - stream.previous(); - i--; - assertEquals(i, stream.nextIndex()); - assertEquals(i - 1, stream.previousIndex()); - } - assertEquals("index is corrupt", 0, i); - } - - public void testPreviousIndex() { - // TODO - } - - @Override - public void testRemove() { - // #remove() is not supported - } - - @Override - public void testIllegalStateException() { - // #remove() is not supported - } - - @Override - public void testEmptyIllegalStateException1() { - // #remove() is not supported - } - - @Override - public void testEmptyIllegalStateException2() { - // #remove() is not supported - } - - @Override - void verifyNoSuchElementException(Iterator stream) { - super.verifyNoSuchElementException(stream); - ListIterator stream2 = (ListIterator) stream; - boolean exCaught = false; - String string = null; - while (stream2.hasPrevious()) { - string = stream2.previous(); - } - try { - string = stream2.previous(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + string, exCaught); - } - - @Override - void verifyUnsupportedOperationException(Iterator stream) { - super.verifyUnsupportedOperationException(stream); - boolean exCaught = false; - ListIterator stream2 = (ListIterator) stream; - while (stream2.hasPrevious()) { - Object string = stream2.previous(); - if (string.equals("333")) { - try { - stream2.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - @Override - void verifyIllegalStateException(Iterator stream) { - super.verifyIllegalStateException(stream); - ListIterator stream2 = (ListIterator) stream; - boolean exCaught = false; - try { - stream2.set("junk"); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue("IllegalStateException not thrown", exCaught); - } - - @Override - void verifyEmptyHasAnother(Iterator stream) { - super.verifyEmptyHasAnother(stream); - ListIterator stream2 = (ListIterator) stream; - int i = 0; - while (stream2.hasPrevious()) { - stream2.previous(); - i++; - } - assertEquals(0, i); - } - - // unchecked so we can override the unchecked method in superclass - @Override - @SuppressWarnings("unchecked") - Iterator buildCompositeIterator(Iterator iterators) { - return new ReadOnlyCompositeListIterator((ListIterator>) iterators); - } - - @Override - @SuppressWarnings("unchecked") - Iterator buildCompositeIterator2() { - return new ReadOnlyCompositeListIterator(this.buildIterator1(), this.buildIterator2(), this.buildIterator3()); - } - - @Override - @SuppressWarnings("unchecked") - Iterator buildCompositeIterator3() { - return new ReadOnlyCompositeListIterator(new ListIterator[] { this.buildIterator1(), this.buildIterator2(), this.buildIterator3() }); - } - - Iterator buildCompositeIterator(String string, ListIterator iterator) { - return this.buildCompositeListIterator(string, iterator); - } - - ListIterator buildCompositeListIterator(String string, ListIterator iterator) { - return new ReadOnlyCompositeListIterator(string, iterator); - } - - public void testVariedNestedIterators() { - List integerList = new ArrayList(); - integerList.add(new Integer(42)); - integerList.add(new Integer(42)); - integerList.add(new Integer(111)); - integerList.add(new Integer(77)); - - List floatList = new ArrayList(); - floatList.add(new Float(42.42f)); - floatList.add(new Float(22.22f)); - floatList.add(new Float(111.111f)); - floatList.add(new Float(77.77f)); - - List> list = new ArrayList>(); - list.add(integerList); - list.add(floatList); - ListIterator li = new ReadOnlyCompositeListIterator(list); - while (li.hasNext()) { - assertTrue(li.next().intValue() > 0); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ReadOnlyIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ReadOnlyIteratorTests.java deleted file mode 100644 index f00417064d..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ReadOnlyIteratorTests.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.Iterator; -import java.util.NoSuchElementException; -import java.util.Vector; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyIterator; - -@SuppressWarnings("nls") -public class ReadOnlyIteratorTests extends TestCase { - - public ReadOnlyIteratorTests(String name) { - super(name); - } - - public void testHasNext() { - int i = 0; - for (Iterator stream = this.buildReadOnlyIterator(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(this.buildVector().size(), i); - } - - public void testHasNextUpcast() { - int i = 0; - for (Iterator stream = this.buildReadOnlyIteratorUpcast(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(this.buildVector().size(), i); - } - - public void testNext() { - Iterator nestedIterator = this.buildNestedIterator(); - for (Iterator stream = this.buildReadOnlyIterator(); stream.hasNext();) { - assertEquals("bogus element", nestedIterator.next(), stream.next()); - } - } - - public void testNextUpcast() { - Iterator nestedIterator = this.buildNestedIterator(); - for (Iterator stream = this.buildReadOnlyIteratorUpcast(); stream.hasNext();) { - assertEquals("bogus element", nestedIterator.next(), stream.next()); - } - } - - public void testNoSuchElementException() { - boolean exCaught = false; - Iterator stream = this.buildReadOnlyIterator(); - String string = null; - while (stream.hasNext()) { - string = stream.next(); - } - try { - string = stream.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + string, exCaught); - } - - public void testRemove() { - boolean exCaught = false; - for (Iterator stream = this.buildReadOnlyIterator(); stream.hasNext();) { - if (stream.next().equals("three")) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - private Iterator buildReadOnlyIterator() { - return this.buildReadOnlyIterator(this.buildNestedIterator()); - } - - private Iterator buildReadOnlyIteratorUpcast() { - return this.buildReadOnlyIteratorUpcast(this.buildNestedIterator()); - } - - private Iterator buildReadOnlyIterator(Iterator nestedIterator) { - return new ReadOnlyIterator(nestedIterator); - } - - private Iterator buildReadOnlyIteratorUpcast(Iterator nestedIterator) { - return new ReadOnlyIterator(nestedIterator); - } - - private Iterator buildNestedIterator() { - return this.buildVector().iterator(); - } - - private Vector buildVector() { - Vector v = new Vector(); - v.addElement("one"); - v.addElement("two"); - v.addElement("three"); - v.addElement("four"); - v.addElement("five"); - v.addElement("six"); - v.addElement("seven"); - v.addElement("eight"); - return v; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ReadOnlyListIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ReadOnlyListIteratorTests.java deleted file mode 100644 index 9d81a2ad37..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/ReadOnlyListIteratorTests.java +++ /dev/null @@ -1,204 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.ArrayList; -import java.util.List; -import java.util.ListIterator; -import java.util.NoSuchElementException; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyListIterator; - -@SuppressWarnings("nls") -public class ReadOnlyListIteratorTests extends TestCase { - - public ReadOnlyListIteratorTests(String name) { - super(name); - } - - public void testHasNextAndHasPrevious() { - int i = 0; - ListIterator stream = this.buildReadOnlyListIterator(); - while (stream.hasNext()) { - stream.next(); - i++; - } - assertEquals(this.buildList().size(), i); - - while (stream.hasPrevious()) { - stream.previous(); - i--; - } - assertEquals(0, i); - } - - public void testHasNextAndHasPreviousUpcast() { - int i = 0; - ListIterator stream = this.buildReadOnlyListIteratorUpcast(); - while (stream.hasNext()) { - stream.next(); - i++; - } - assertEquals(this.buildList().size(), i); - - while (stream.hasPrevious()) { - stream.previous(); - i--; - } - assertEquals(0, i); - } - - public void testNextAndPrevious() { - ListIterator nestedListIterator = this.buildNestedListIterator(); - ListIterator stream = this.buildReadOnlyListIterator(); - while (stream.hasNext()) { - assertEquals("bogus element", nestedListIterator.next(), stream.next()); - } - while (stream.hasPrevious()) { - assertEquals("bogus element", nestedListIterator.previous(), stream.previous()); - } - } - - public void testNextAndPreviousUpcast() { - ListIterator nestedListIterator = this.buildNestedListIterator(); - ListIterator stream = this.buildReadOnlyListIteratorUpcast(); - while (stream.hasNext()) { - assertEquals("bogus element", nestedListIterator.next(), stream.next()); - } - while (stream.hasPrevious()) { - assertEquals("bogus element", nestedListIterator.previous(), stream.previous()); - } - } - - public void testNextIndexAndPreviousIndex() { - ListIterator nestedListIterator = this.buildNestedListIterator(); - ListIterator stream = this.buildReadOnlyListIterator(); - while (stream.hasNext()) { - assertEquals("bogus index", nestedListIterator.nextIndex(), stream.nextIndex()); - nestedListIterator.next(); - stream.next(); - } - assertEquals("bogus index", this.buildList().size(), stream.nextIndex()); - while (stream.hasPrevious()) { - assertEquals("bogus element", nestedListIterator.previousIndex(), stream.previousIndex()); - nestedListIterator.previous(); - stream.previous(); - } - assertEquals("bogus index", -1, stream.previousIndex()); - } - - public void testNextIndexAndPreviousIndexUpcast() { - ListIterator nestedListIterator = this.buildNestedListIterator(); - ListIterator stream = this.buildReadOnlyListIteratorUpcast(); - while (stream.hasNext()) { - assertEquals("bogus index", nestedListIterator.nextIndex(), stream.nextIndex()); - nestedListIterator.next(); - stream.next(); - } - assertEquals("bogus index", this.buildList().size(), stream.nextIndex()); - while (stream.hasPrevious()) { - assertEquals("bogus element", nestedListIterator.previousIndex(), stream.previousIndex()); - nestedListIterator.previous(); - stream.previous(); - } - assertEquals("bogus index", -1, stream.previousIndex()); - } - - public void testNoSuchElementException() { - boolean exCaught = false; - ListIterator stream = this.buildReadOnlyListIterator(); - String string = null; - while (stream.hasNext()) { - string = stream.next(); - } - try { - string = stream.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + string, exCaught); - } - - public void testRemove() { - boolean exCaught = false; - for (ListIterator stream = this.buildReadOnlyListIterator(); stream.hasNext();) { - if (stream.next().equals("three")) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - public void testSet() { - boolean exCaught = false; - for (ListIterator stream = this.buildReadOnlyListIterator(); stream.hasNext();) { - if (stream.next().equals("three")) { - try { - stream.set("bogus"); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - public void testAdd() { - boolean exCaught = false; - for (ListIterator stream = this.buildReadOnlyListIterator(); stream.hasNext();) { - if (stream.next().equals("three")) { - try { - stream.add("bogus"); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - private ListIterator buildReadOnlyListIterator() { - return this.buildReadOnlyListIterator(this.buildNestedListIterator()); - } - - private ListIterator buildReadOnlyListIteratorUpcast() { - return this.buildReadOnlyListIteratorUpcast(this.buildNestedListIterator()); - } - - private ListIterator buildReadOnlyListIterator(ListIterator nestedListIterator) { - return new ReadOnlyListIterator(nestedListIterator); - } - - private ListIterator buildReadOnlyListIteratorUpcast(ListIterator nestedListIterator) { - return new ReadOnlyListIterator(nestedListIterator); - } - - private ListIterator buildNestedListIterator() { - return this.buildList().listIterator(); - } - - private List buildList() { - List l = new ArrayList(); - l.add("one"); - l.add("two"); - l.add("three"); - l.add("four"); - l.add("five"); - l.add("six"); - l.add("seven"); - l.add("eight"); - return l; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SingleElementIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SingleElementIteratorTests.java deleted file mode 100644 index 4fce5a6826..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SingleElementIteratorTests.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.Iterator; -import java.util.NoSuchElementException; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.iterators.SingleElementIterator; - -@SuppressWarnings("nls") -public class SingleElementIteratorTests extends TestCase { - - public SingleElementIteratorTests(String name) { - super(name); - } - - public void testHasNext() { - int i = 0; - for (Iterator stream = this.buildSingleElementIterator(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(1, i); - } - - public void testNext() { - for (Iterator stream = this.buildSingleElementIterator(); stream.hasNext();) { - assertEquals("bogus element", this.singleElement(), stream.next()); - } - } - - public void testNoSuchElementException() { - boolean exCaught = false; - Iterator stream = this.buildSingleElementIterator(); - String string = stream.next(); - try { - string = stream.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + string, exCaught); - } - - public void testRemove() { - boolean exCaught = false; - for (Iterator stream = this.buildSingleElementIterator(); stream.hasNext();) { - if (stream.next().equals(this.singleElement())) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - protected Iterator buildSingleElementIterator() { - return new SingleElementIterator(this.singleElement()); - } - - protected String singleElement() { - return "single element"; - } -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SingleElementListIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SingleElementListIteratorTests.java deleted file mode 100644 index d393a65201..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SingleElementListIteratorTests.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.Iterator; -import java.util.ListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.SingleElementListIterator; - -@SuppressWarnings("nls") -public class SingleElementListIteratorTests extends SingleElementIteratorTests { - - public SingleElementListIteratorTests(String name) { - super(name); - } - - public void testNextIndex() { - ListIterator stream = this.buildSingleElementListIterator(); - while (stream.hasNext()) { - assertEquals("bogus index", 0, stream.nextIndex()); - stream.next(); - } - assertEquals("bogus index", 1, stream.nextIndex()); - } - - public void testHasPrevious() { - int i = 0; - ListIterator stream = this.buildSingleElementListIterator(); - while (stream.hasNext()) { - stream.next(); - i++; - } - assertEquals(1, i); - - while (stream.hasPrevious()) { - stream.previous(); - i++; - } - assertEquals(2, i); - } - - public void testPrevious() { - ListIterator stream = this.buildSingleElementListIterator(); - - while (stream.hasNext()) { - assertEquals("bogus element", this.singleElement(), stream.next()); - } - - while (stream.hasPrevious()) { - assertEquals("bogus element", this.singleElement(), stream.previous()); - } - } - - public void testPreviousIndex() { - ListIterator stream = this.buildSingleElementListIterator(); - - while (stream.hasNext()) { - assertEquals("bogus index", 0, stream.nextIndex()); - stream.next(); - } - - while (stream.hasPrevious()) { - assertEquals("bogus index", 0, stream.previousIndex()); - stream.previous(); - } - - assertEquals("bogus index", -1, stream.previousIndex()); - } - - public void testAdd() { - boolean exCaught = false; - ListIterator stream = this.buildSingleElementListIterator(); - - try { - stream.add("foo"); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - public void testSet() { - boolean exCaught = false; - for (ListIterator stream = this.buildSingleElementListIterator(); stream.hasNext();) { - if (stream.next().equals(this.singleElement())) { - try { - stream.set("foo"); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - @Override - protected Iterator buildSingleElementIterator() { - return new SingleElementListIterator(this.singleElement()); - } - - protected ListIterator buildSingleElementListIterator() { - return (ListIterator) this.buildSingleElementIterator(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SuperIteratorWrapperTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SuperIteratorWrapperTests.java deleted file mode 100644 index 4bb6dc626d..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SuperIteratorWrapperTests.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.ArrayList; -import java.util.Iterator; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.iterators.SuperIteratorWrapper; - -@SuppressWarnings("nls") -public class SuperIteratorWrapperTests extends TestCase { - - public SuperIteratorWrapperTests(String name) { - super(name); - } - - public void testIterator() { - ArrayList list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - String concat = ""; - for (Iterator stream = list.iterator(); stream.hasNext(); ) { - concat += stream.next(); - } - assertEquals("foobarbaz", concat); - - Iterator iterator = new SuperIteratorWrapper(list); - concat = ""; - while (iterator.hasNext()) { - Object next = iterator.next(); - if (next.equals("bar")) { - iterator.remove(); - } else { - concat += next; - } - } - assertEquals("foobaz", concat); - assertEquals(2, list.size()); - assertFalse(list.contains("bar")); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SynchronizedIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SynchronizedIteratorTests.java deleted file mode 100644 index e30238fe74..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SynchronizedIteratorTests.java +++ /dev/null @@ -1,310 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.NoSuchElementException; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.SynchronizedIterator; -import org.eclipse.jpt.common.utility.tests.internal.MultiThreadedTestCase; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class SynchronizedIteratorTests - extends MultiThreadedTestCase -{ - public SynchronizedIteratorTests(String name) { - super(name); - } - - /** - * test that an unsynchronized iterator will produce corrupt output; - * thread 1 will read the first element from the iterator - * and then sleep for a bit, allowing thread 2 to sneak in and - * read the same element from the iterator - */ - public void testUnsynchronizedNext() throws Exception { - TestIterator iterator = this.buildTestIterator(TWO_TICKS); - - NextTestRunnable runnable1 = new NextTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - NextTestRunnable runnable2 = new NextTestRunnable(iterator); - Thread thread2 = this.buildThread(runnable2); - iterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // both threads should have read the same element from the iterator :-( - assertEquals("foo", runnable1.next); - assertEquals("foo", runnable2.next); - } - - /** - * test that a synchronized iterator will produce valid output; - * thread 1 will read the first element from the iterator - * and then sleep for a bit, but thread 2 will be locked out and - * wait to read the second element from the iterator - */ - public void testSynchronizedNext() throws Exception { - TestIterator nestedIterator = this.buildTestIterator(TWO_TICKS); - Iterator iterator = this.buildSynchronizedIterator(nestedIterator); - - NextTestRunnable runnable1 = new NextTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - NextTestRunnable runnable2 = new NextTestRunnable(iterator); - Thread thread2 = this.buildThread(runnable2); - nestedIterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // the threads should have read the correct elements from the iterator :-) - assertEquals("foo", runnable1.next); - assertEquals("bar", runnable2.next); - } - - public void testUnsynchronizedHasNext() throws Exception { - TestIterator iterator = this.buildTestIterator(TWO_TICKS); - iterator.next(); - iterator.next(); - - NextTestRunnable runnable1 = new NextTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - HasNextTestRunnable runnable2 = new HasNextTestRunnable(iterator); - Thread thread2 = this.buildThread(runnable2); - iterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // thread 1 will have the last element, - // but thread 2 will think there are more elements on the iterator :-( - assertEquals("baz", runnable1.next); - assertEquals(true, runnable2.hasNext); - } - - public void testSynchronizedHasNext() throws Exception { - TestIterator nestedIterator = this.buildTestIterator(TWO_TICKS); - Iterator iterator = this.buildSynchronizedIterator(nestedIterator); - iterator.next(); - iterator.next(); - - NextTestRunnable runnable1 = new NextTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - HasNextTestRunnable runnable2 = new HasNextTestRunnable(iterator); - Thread thread2 = this.buildThread(runnable2); - nestedIterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // thread 1 will have the last element, - // and thread 2 will think there are no more elements on the iterator :-) - assertEquals("baz", runnable1.next); - assertEquals(false, runnable2.hasNext); - } - - public void testUnsynchronizedRemove() throws Exception { - TestIterator iterator = this.buildTestIterator(TWO_TICKS); - iterator.next(); - - NextTestRunnable runnable1 = new NextTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - RemoveTestRunnable runnable2 = new RemoveTestRunnable(iterator); - Thread thread2 = this.buildThread(runnable2); - iterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // the wrong element was removed :-( - assertEquals("bar", runnable1.next); - assertFalse(iterator.list.contains("foo")); - assertTrue(iterator.list.contains("bar")); - assertTrue(iterator.list.contains("baz")); - } - - public void testSynchronizedRemove() throws Exception { - TestIterator nestedIterator = this.buildTestIterator(TWO_TICKS); - Iterator iterator = this.buildSynchronizedIterator(nestedIterator); - iterator.next(); - - NextTestRunnable runnable1 = new NextTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - RemoveTestRunnable runnable2 = new RemoveTestRunnable(iterator); - Thread thread2 = this.buildThread(runnable2); - nestedIterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // the correct element was removed :-) - assertEquals("bar", runnable1.next); - assertTrue(nestedIterator.list.contains("foo")); - assertFalse(nestedIterator.list.contains("bar")); - assertTrue(nestedIterator.list.contains("baz")); - } - - TestIterator buildTestIterator(long delay) { - return new TestIterator(delay, this.buildArray()); - } - - String[] buildArray() { - return new String[] {"foo", "bar", "baz"}; - } - - Iterator buildSynchronizedIterator(Iterator nestedIterator) { - return new SynchronizedIterator(nestedIterator); - } - - - /** - * next runnable - */ - class NextTestRunnable implements Runnable { - final Iterator iterator; - E next; - - NextTestRunnable(Iterator iterator) { - super(); - this.iterator = iterator; - } - - public void run() { - this.next = this.iterator.next(); - } - - } - - /** - * has next runnable - */ - class HasNextTestRunnable implements Runnable { - final Iterator iterator; - boolean hasNext; - - HasNextTestRunnable(Iterator iterator) { - super(); - this.iterator = iterator; - } - - public void run() { - this.hasNext = this.iterator.hasNext(); - } - - } - - /** - * remove runnable - */ - class RemoveTestRunnable implements Runnable { - final Iterator iterator; - - RemoveTestRunnable(Iterator iterator) { - super(); - this.iterator = iterator; - } - - public void run() { - this.iterator.remove(); - } - - } - - /** - * Test iterator: If {@link #next()} is called while executing on the - * {@link slowThread}, the iterator will delay for the configured time. - */ - static class TestIterator implements Iterator { - final long delay; - final ArrayList list = new ArrayList(); - int nextIndex = 0; - int lastIndex = -1; - Thread slowThread; - - TestIterator(long delay, E... array) { - super(); - this.delay = delay; - CollectionTools.addAll(this.list, array); - } - - public boolean hasNext() { - return this.nextIndex != this.list.size(); - } - - public E next() { - if (this.hasNext()) { - E next = this.list.get(this.nextIndex); - if (Thread.currentThread() == this.slowThread) { - TestTools.sleep(this.delay); - } - this.lastIndex = this.nextIndex++; - return next; - } - throw new NoSuchElementException(); - } - - public void remove() { - if (this.lastIndex == -1) { - throw new IllegalStateException(); - } - this.list.remove(this.lastIndex); - if (this.lastIndex < this.nextIndex) { // check necessary for ListIterator - this.nextIndex--; - } - this.lastIndex = -1; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SynchronizedListIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SynchronizedListIteratorTests.java deleted file mode 100644 index dbf0ac5b57..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/SynchronizedListIteratorTests.java +++ /dev/null @@ -1,524 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.Iterator; -import java.util.ListIterator; -import java.util.NoSuchElementException; - -import org.eclipse.jpt.common.utility.internal.iterators.SynchronizedListIterator; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class SynchronizedListIteratorTests - extends SynchronizedIteratorTests -{ - public SynchronizedListIteratorTests(String name) { - super(name); - } - - public void testUnsynchronizedPrevious() throws Exception { - TestListIterator iterator = this.buildTestIterator(TWO_TICKS); - iterator.next(); - iterator.next(); - - PreviousTestRunnable runnable1 = new PreviousTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - PreviousTestRunnable runnable2 = new PreviousTestRunnable(iterator); - Thread thread2 = this.buildThread(runnable2); - iterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // both threads should have read the same element from the iterator :-( - assertEquals("bar", runnable1.previous); - assertEquals("bar", runnable2.previous); - } - - public void testSynchronizedPrevious() throws Exception { - TestListIterator nestedIterator = this.buildTestIterator(TWO_TICKS); - ListIterator iterator = this.buildSynchronizedIterator(nestedIterator); - iterator.next(); - iterator.next(); - - PreviousTestRunnable runnable1 = new PreviousTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - PreviousTestRunnable runnable2 = new PreviousTestRunnable(iterator); - Thread thread2 = this.buildThread(runnable2); - nestedIterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // the threads should have read the correct elements from the iterator :-) - assertEquals("bar", runnable1.previous); - assertEquals("foo", runnable2.previous); - } - - public void testUnsynchronizedHasPrevious() throws Exception { - TestListIterator iterator = this.buildTestIterator(TWO_TICKS); - iterator.next(); - - PreviousTestRunnable runnable1 = new PreviousTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - HasPreviousTestRunnable runnable2 = new HasPreviousTestRunnable(iterator); - Thread thread2 = this.buildThread(runnable2); - iterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // thread 1 will have the first element, - // but thread 2 will think there are more "previous" elements on the iterator :-( - assertEquals("foo", runnable1.previous); - assertEquals(true, runnable2.hasPrevious); - } - - public void testSynchronizedHasPrevious() throws Exception { - TestListIterator nestedIterator = this.buildTestIterator(TWO_TICKS); - ListIterator iterator = this.buildSynchronizedIterator(nestedIterator); - iterator.next(); - - PreviousTestRunnable runnable1 = new PreviousTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - HasPreviousTestRunnable runnable2 = new HasPreviousTestRunnable(iterator); - Thread thread2 = this.buildThread(runnable2); - nestedIterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // thread 1 will have the first element, - // and thread 2 will think there are no more "previous" elements on the iterator :-) - assertEquals("foo", runnable1.previous); - assertEquals(false, runnable2.hasPrevious); - } - - public void testUnsynchronizedNextIndex() throws Exception { - TestListIterator iterator = this.buildTestIterator(TWO_TICKS); - - NextTestRunnable runnable1 = new NextTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - NextIndexTestRunnable runnable2 = new NextIndexTestRunnable(iterator); - Thread thread2 = this.buildThread(runnable2); - iterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // thread 1 will have the first element, - // but thread 2 will think the next index is still 0 :-( - assertEquals("foo", runnable1.next); - assertEquals(0, runnable2.nextIndex); - } - - public void testSynchronizedNextIndex() throws Exception { - TestListIterator nestedIterator = this.buildTestIterator(TWO_TICKS); - ListIterator iterator = this.buildSynchronizedIterator(nestedIterator); - - NextTestRunnable runnable1 = new NextTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - NextIndexTestRunnable runnable2 = new NextIndexTestRunnable(iterator); - Thread thread2 = this.buildThread(runnable2); - nestedIterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // thread 1 will have the first element, - // and thread 2 will think the next index is 1 :-) - assertEquals("foo", runnable1.next); - assertEquals(1, runnable2.nextIndex); - } - - public void testUnsynchronizedPreviousIndex() throws Exception { - TestListIterator iterator = this.buildTestIterator(TWO_TICKS); - iterator.next(); - - PreviousTestRunnable runnable1 = new PreviousTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - PreviousIndexTestRunnable runnable2 = new PreviousIndexTestRunnable(iterator); - Thread thread2 = this.buildThread(runnable2); - iterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // thread 1 will have the first element, - // but thread 2 will think the next index is still 0 :-( - assertEquals("foo", runnable1.previous); - assertEquals(0, runnable2.previousIndex); - } - - public void testSynchronizedPreviousIndex() throws Exception { - TestListIterator nestedIterator = this.buildTestIterator(TWO_TICKS); - ListIterator iterator = this.buildSynchronizedIterator(nestedIterator); - iterator.next(); - - PreviousTestRunnable runnable1 = new PreviousTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - PreviousIndexTestRunnable runnable2 = new PreviousIndexTestRunnable(iterator); - Thread thread2 = this.buildThread(runnable2); - nestedIterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // thread 1 will have the first element, - // and thread 2 will think the next index is -1 :-) - assertEquals("foo", runnable1.previous); - assertEquals(-1, runnable2.previousIndex); - } - - public void testUnsynchronizedSet() throws Exception { - TestListIterator iterator = this.buildTestIterator(TWO_TICKS); - iterator.next(); - - NextTestRunnable runnable1 = new NextTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - SetTestRunnable runnable2 = new SetTestRunnable(iterator, "xxx"); - Thread thread2 = this.buildThread(runnable2); - iterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // the wrong element was set :-( - assertEquals("bar", runnable1.next); - assertFalse(iterator.list.contains("foo")); - assertTrue(iterator.list.contains("xxx")); - assertTrue(iterator.list.contains("bar")); - assertTrue(iterator.list.contains("baz")); - } - - public void testSynchronizedSet() throws Exception { - TestListIterator nestedIterator = this.buildTestIterator(TWO_TICKS); - ListIterator iterator = this.buildSynchronizedIterator(nestedIterator); - iterator.next(); - - NextTestRunnable runnable1 = new NextTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - SetTestRunnable runnable2 = new SetTestRunnable(iterator, "xxx"); - Thread thread2 = this.buildThread(runnable2); - nestedIterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // the right element was set :-) - assertEquals("bar", runnable1.next); - assertTrue(nestedIterator.list.contains("foo")); - assertFalse(nestedIterator.list.contains("bar")); - assertTrue(nestedIterator.list.contains("xxx")); - assertTrue(nestedIterator.list.contains("baz")); - } - - public void testUnsynchronizedAdd() throws Exception { - TestListIterator iterator = this.buildTestIterator(TWO_TICKS); - iterator.next(); - - NextTestRunnable runnable1 = new NextTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - AddTestRunnable runnable2 = new AddTestRunnable(iterator, "xxx"); - Thread thread2 = this.buildThread(runnable2); - iterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // the element was added at the wrong index :-( - assertEquals("bar", runnable1.next); - assertTrue(iterator.list.contains("foo")); - assertEquals(0, iterator.list.indexOf("xxx")); - assertTrue(iterator.list.contains("xxx")); - assertTrue(iterator.list.contains("bar")); - assertTrue(iterator.list.contains("baz")); - } - - public void testSynchronizedAdd() throws Exception { - TestListIterator nestedIterator = this.buildTestIterator(TWO_TICKS); - ListIterator iterator = this.buildSynchronizedIterator(nestedIterator); - iterator.next(); - - NextTestRunnable runnable1 = new NextTestRunnable(iterator); - Thread thread1 = this.buildThread(runnable1); - AddTestRunnable runnable2 = new AddTestRunnable(iterator, "xxx"); - Thread thread2 = this.buildThread(runnable2); - nestedIterator.slowThread = thread1; - - thread1.start(); - - // allow thread 1 to read the first element and get bogged down - this.sleep(TICK); - thread2.start(); - - // wait for the threads to finish - thread1.join(); - thread2.join(); - - // the element was added at the correct index :-) - assertEquals("bar", runnable1.next); - assertTrue(nestedIterator.list.contains("foo")); - assertEquals(1, nestedIterator.list.indexOf("xxx")); - assertTrue(nestedIterator.list.contains("xxx")); - assertTrue(nestedIterator.list.contains("bar")); - assertTrue(nestedIterator.list.contains("baz")); - } - - @Override - ListIterator buildSynchronizedIterator(Iterator nestedIterator) { - return new SynchronizedListIterator((ListIterator) nestedIterator); - } - - @Override - TestListIterator buildTestIterator(long delay) { - return new TestListIterator(delay, this.buildArray()); - } - - /** - * previous runnable - */ - class PreviousTestRunnable implements Runnable { - final ListIterator iterator; - E previous; - - PreviousTestRunnable(ListIterator iterator) { - super(); - this.iterator = iterator; - } - - public void run() { - this.previous = this.iterator.previous(); - } - - } - - /** - * has previous runnable - */ - class HasPreviousTestRunnable implements Runnable { - final ListIterator iterator; - boolean hasPrevious; - - HasPreviousTestRunnable(ListIterator iterator) { - super(); - this.iterator = iterator; - } - - public void run() { - this.hasPrevious = this.iterator.hasPrevious(); - } - - } - - /** - * next index runnable - */ - class NextIndexTestRunnable implements Runnable { - final ListIterator iterator; - int nextIndex; - - NextIndexTestRunnable(ListIterator iterator) { - super(); - this.iterator = iterator; - } - - public void run() { - this.nextIndex = this.iterator.nextIndex(); - } - - } - - /** - * previous index runnable - */ - class PreviousIndexTestRunnable implements Runnable { - final ListIterator iterator; - int previousIndex; - - PreviousIndexTestRunnable(ListIterator iterator) { - super(); - this.iterator = iterator; - } - - public void run() { - this.previousIndex = this.iterator.previousIndex(); - } - - } - - /** - * set runnable - */ - class SetTestRunnable implements Runnable { - final ListIterator iterator; - final E element; - - SetTestRunnable(ListIterator iterator, E element) { - super(); - this.iterator = iterator; - this.element = element; - } - - public void run() { - this.iterator.set(this.element); - } - - } - - /** - * add runnable - */ - class AddTestRunnable implements Runnable { - final ListIterator iterator; - final E element; - - AddTestRunnable(ListIterator iterator, E element) { - super(); - this.iterator = iterator; - this.element = element; - } - - public void run() { - this.iterator.add(this.element); - } - - } - - /** - * Test iterator: If {@link #next()} or {@link #previous()} is called - * while executing on the {@link slowThread}, the iterator will delay - * for the configured time. - */ - static class TestListIterator extends TestIterator implements ListIterator { - - TestListIterator(long delay, E... array) { - super(delay, array); - } - - public int nextIndex() { - return this.nextIndex; - } - - public boolean hasPrevious() { - return this.nextIndex != 0; - } - - public E previous() { - if (this.hasPrevious()) { - E previous = this.list.get(this.previousIndex()); - if (Thread.currentThread() == this.slowThread) { - TestTools.sleep(this.delay); - } - this.nextIndex--; - this.lastIndex = this.nextIndex; - return previous; - } - throw new NoSuchElementException(); - } - - public int previousIndex() { - return this.nextIndex - 1; - } - - public void set(E e) { - if (this.lastIndex == -1) { - throw new IllegalStateException(); - } - this.list.set(this.lastIndex, e); - } - - public void add(E e) { - this.list.add(this.lastIndex, e); - this.lastIndex++; - this.lastIndex = -1; - } - - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/TransformationIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/TransformationIteratorTests.java deleted file mode 100644 index af7185a792..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/TransformationIteratorTests.java +++ /dev/null @@ -1,230 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.NoSuchElementException; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; - -@SuppressWarnings("nls") -public class TransformationIteratorTests extends TestCase { - - public TransformationIteratorTests(String name) { - super(name); - } - - public void testHasNext() { - int i = 0; - for (Iterator stream = this.buildIterator(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(8, i); - } - - public void testHasNextUpcast() { - int i = 0; - for (Iterator stream = this.buildIteratorUpcast(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(8, i); - } - - public void testInnerHasNext() { - int i = 0; - for (Iterator stream = this.buildInnerIterator(); stream.hasNext();) { - stream.next(); - i++; - } - assertEquals(8, i); - } - - public void testNext() { - int i = 0; - for (Iterator stream = this.buildIterator(); stream.hasNext();) { - assertEquals("bogus transformation", ++i, stream.next().intValue()); - } - } - - public void testNextUpcast() { - int i = 0; - for (Iterator stream = this.buildIteratorUpcast(); stream.hasNext();) { - assertEquals("bogus transformation", ++i, ((Integer) stream.next()).intValue()); - } - } - - public void testInnerNext() { - int i = 0; - for (Iterator stream = this.buildInnerIterator(); stream.hasNext();) { - assertEquals("bogus transformation", ++i, stream.next().intValue()); - } - } - - public void testRemove() { - Collection c = this.buildCollection(); - for (Iterator stream = this.buildInnerTransformationIterator(c.iterator()); stream.hasNext();) { - if (stream.next().intValue() == 3) { - stream.remove(); - } - } - assertEquals("nothing removed", this.buildCollection().size() - 1, c.size()); - assertFalse("element still in collection", c.contains("333")); - assertTrue("wrong element removed", c.contains("22")); - } - - public void testInnerRemove() { - Collection c = this.buildCollection(); - for (Iterator stream = this.buildTransformationIterator(c.iterator(), this.buildTransformer()); stream.hasNext();) { - if (stream.next().intValue() == 3) { - stream.remove(); - } - } - assertEquals("nothing removed", this.buildCollection().size() - 1, c.size()); - assertFalse("element still in collection", c.contains("333")); - assertTrue("wrong element removed", c.contains("22")); - } - - public void testNoSuchElementException() { - boolean exCaught = false; - Iterator stream = this.buildIterator(); - Integer integer = null; - while (stream.hasNext()) { - integer = stream.next(); - } - try { - integer = stream.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + integer, exCaught); - } - - public void testUnsupportedOperationException() { - boolean exCaught = false; - for (Iterator stream = this.buildUnmodifiableIterator(); stream.hasNext();) { - int i = stream.next().intValue(); - if (i == 3) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - public void testIllegalStateException() { - boolean exCaught = false; - try { - this.buildIterator().remove(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue("IllegalStateException not thrown", exCaught); - } - - private Iterator buildIterator() { - return this.buildTransformationIterator(this.buildNestedIterator(), this.buildTransformer()); - } - - private Iterator buildIteratorUpcast() { - return this.buildTransformationIteratorUpcast(this.buildNestedIterator(), this.buildTransformerUpcast()); - } - - private Iterator buildInnerIterator() { - return this.buildInnerTransformationIterator(this.buildNestedIterator()); - } - - private Iterator buildUnmodifiableIterator() { - return this.buildTransformationIterator(this.buildUnmodifiableNestedIterator(), this.buildTransformer()); - } - - private Iterator buildTransformationIterator(Iterator nestedIterator, Transformer transformer) { - return new TransformationIterator(nestedIterator, transformer); - } - - private Iterator buildTransformationIteratorUpcast(Iterator nestedIterator, Transformer transformer) { - return new TransformationIterator(nestedIterator, transformer); - } - - private Transformer buildTransformer() { - // transform each string into an integer with a value of the string's length - return new Transformer() { - public Integer transform(String next) { - return new Integer(next.length()); - } - }; - } - - private Transformer buildTransformerUpcast() { - // transform each string into an integer with a value of the string's length - return new Transformer() { - public Integer transform(Object next) { - return new Integer(((String) next).length()); - } - }; - } - - private Iterator buildInnerTransformationIterator(Iterator nestedIterator) { - // transform each string into an integer with a value of the string's length - return new TransformationIterator(nestedIterator) { - @Override - protected Integer transform(String next) { - return new Integer(next.length()); - } - }; - } - - private Iterator buildNestedIterator() { - return this.buildCollection().iterator(); - } - - private Iterator buildUnmodifiableNestedIterator() { - return this.buildUnmodifiableCollection().iterator(); - } - - private Collection buildCollection() { - Collection c = new ArrayList(); - c.add("1"); - c.add("22"); - c.add("333"); - c.add("4444"); - c.add("55555"); - c.add("666666"); - c.add("7777777"); - c.add("88888888"); - return c; - } - - private Collection buildUnmodifiableCollection() { - return Collections.unmodifiableCollection(this.buildCollection()); - } - - public void testInvalidTransformationIterator() { - // missing method override - Iterator iterator = new TransformationIterator(this.buildCollection().iterator()); - boolean exCaught = false; - try { - Integer integer = iterator.next(); - fail("invalid integer: " + integer); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown", exCaught); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/TransformationListIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/TransformationListIteratorTests.java deleted file mode 100644 index 9a438096ba..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/TransformationListIteratorTests.java +++ /dev/null @@ -1,322 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.NoSuchElementException; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationListIterator; - -@SuppressWarnings("nls") -public class TransformationListIteratorTests extends TestCase { - - public TransformationListIteratorTests(String name) { - super(name); - } - - public void testHasNextAndHasPrevious() { - int i = 0; - ListIterator stream = this.buildIterator(); - - while (stream.hasNext()) { - stream.next(); - i++; - } - assertEquals(8, i); - - while (stream.hasPrevious()) { - stream.previous(); - i--; - } - assertEquals(0, i); - } - - public void testHasNextAndHasPreviousUpcast() { - int i = 0; - ListIterator stream = this.buildIteratorUpcast(); - - while (stream.hasNext()) { - stream.next(); - i++; - } - assertEquals(8, i); - - while (stream.hasPrevious()) { - stream.previous(); - i--; - } - assertEquals(0, i); - } - - public void testInnerHasNextAndHasPrevious() { - int i = 0; - ListIterator stream = this.buildInnerIterator(); - - while (stream.hasNext()) { - stream.next(); - i++; - } - assertEquals(8, i); - - while (stream.hasPrevious()) { - stream.previous(); - i--; - } - assertEquals(0, i); - } - - public void testNextAndPrevious() { - int i = 0; - ListIterator stream = this.buildIterator(); - - while (stream.hasNext()) { - assertEquals(++i, stream.next().intValue()); - } - - ++i; - - while (stream.hasPrevious()) { - assertEquals(--i, stream.previous().intValue()); - } - } - - public void testInnerNextAndPrevious() { - int i = 0; - ListIterator stream = this.buildInnerIterator(); - - while (stream.hasNext()) { - assertEquals(++i, stream.next().intValue()); - } - - ++i; - - while (stream.hasPrevious()) { - assertEquals(--i, stream.previous().intValue()); - } - } - - public void testNextIndexAndPreviousIndex() { - int i = -1; - ListIterator stream = this.buildIterator(); - - while (stream.hasNext()) { - assertEquals(++i, stream.nextIndex()); - stream.next(); - } - - ++i; - - while (stream.hasPrevious()) { - assertEquals(--i, stream.previousIndex()); - stream.previous(); - } - } - - public void testInnerNextIndexAndPreviousIndex() { - int i = -1; - ListIterator stream = this.buildInnerIterator(); - - while (stream.hasNext()) { - assertEquals(++i, stream.nextIndex()); - stream.next(); - } - - ++i; - - while (stream.hasPrevious()) { - assertEquals(--i, stream.previousIndex()); - stream.previous(); - } - } - - public void testRemove() { - List l = this.buildList(); - for (ListIterator stream = this.buildInnerTransformationListIterator(l.listIterator()); stream.hasNext();) { - if (stream.next().intValue() == 3) { - stream.remove(); - } - } - assertEquals("nothing removed", this.buildList().size() - 1, l.size()); - assertFalse("element still in list", l.contains("333")); - assertTrue("wrong element removed", l.contains("22")); - } - - public void testInnerRemove() { - List l = this.buildList(); - for (ListIterator stream = this.buildTransformationListIterator(l.listIterator(), this.buildTransformer()); stream.hasNext();) { - if (stream.next().intValue() == 3) { - stream.remove(); - } - } - assertEquals("nothing removed", this.buildList().size() - 1, l.size()); - assertFalse("element still in list", l.contains("333")); - assertTrue("wrong element removed", l.contains("22")); - } - - public void testUnsupportedOperationExceptionOnAdd() { - ListIterator stream = this.buildIterator(); - boolean exCaught = false; - try { - stream.add(new Integer(0)); - fail("exception not thrown"); - } catch (UnsupportedOperationException e) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testUnsupportedOperationExceptionOnSet() { - ListIterator stream = this.buildIterator(); - boolean exCaught = false; - try { - stream.set(new Integer(0)); - fail("exception not thrown"); - } catch (UnsupportedOperationException e) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testNoSuchElementException() { - boolean exCaught = false; - ListIterator stream = this.buildIterator(); - Integer integer = null; - while (stream.hasNext()) { - integer = stream.next(); - } - try { - integer = stream.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown: " + integer, exCaught); - } - - public void testUnsupportedOperationException() { - boolean exCaught = false; - for (Iterator stream = this.buildUnmodifiableIterator(); stream.hasNext();) { - int i = stream.next().intValue(); - if (i == 3) { - try { - stream.remove(); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - } - } - assertTrue("UnsupportedOperationException not thrown", exCaught); - } - - public void testIllegalStateException() { - boolean exCaught = false; - try { - this.buildIterator().remove(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue("IllegalStateException not thrown", exCaught); - } - - private ListIterator buildIterator() { - return this.buildTransformationListIterator(this.buildNestedIterator(), this.buildTransformer()); - } - - private ListIterator buildIteratorUpcast() { - return this.buildTransformationListIteratorUpcast(this.buildNestedIterator(), this.buildTransformerUpcast()); - } - - private ListIterator buildInnerIterator() { - return this.buildInnerTransformationListIterator(this.buildNestedIterator()); - } - - private ListIterator buildUnmodifiableIterator() { - return this.buildTransformationListIterator(this.buildUnmodifiableNestedIterator(), this.buildTransformer()); - } - - private ListIterator buildTransformationListIterator(ListIterator nestedIterator, Transformer transformer) { - return new TransformationListIterator(nestedIterator, transformer); - } - - private ListIterator buildTransformationListIteratorUpcast(ListIterator nestedIterator, Transformer transformer) { - return new TransformationListIterator(nestedIterator, transformer); - } - - private Transformer buildTransformer() { - // transform each string into an integer with a value of the string's length - return new Transformer() { - public Integer transform(String next) { - return new Integer(next.length()); - } - }; - } - - private Transformer buildTransformerUpcast() { - // transform each string into an integer with a value of the string's length - return new Transformer() { - public Integer transform(Object next) { - return new Integer(((String) next).length()); - } - }; - } - - private ListIterator buildInnerTransformationListIterator(ListIterator nestedIterator) { - // transform each string into an integer with a value of the string's length - return new TransformationListIterator(nestedIterator) { - @Override - protected Integer transform(String next) { - return new Integer(next.length()); - } - }; - } - - private ListIterator buildNestedIterator() { - return this.buildList().listIterator(); - } - - private ListIterator buildUnmodifiableNestedIterator() { - return this.buildUnmodifiableList().listIterator(); - } - - private List buildList() { - List l = new ArrayList(); - l.add("1"); - l.add("22"); - l.add("333"); - l.add("4444"); - l.add("55555"); - l.add("666666"); - l.add("7777777"); - l.add("88888888"); - return l; - } - - private List buildUnmodifiableList() { - return Collections.unmodifiableList(this.buildList()); - } - - public void testInvalidTransformationListIterator() { - // missing method override - Iterator iterator = new TransformationListIterator(this.buildList().listIterator()); - boolean exCaught = false; - try { - Integer integer = iterator.next(); - fail("invalid integer: " + integer); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown", exCaught); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/TreeIteratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/TreeIteratorTests.java deleted file mode 100644 index f800e12bde..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/iterators/TreeIteratorTests.java +++ /dev/null @@ -1,211 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.iterators; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.NoSuchElementException; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.iterators.TreeIterator; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class TreeIteratorTests extends TestCase { - /** this will be populated with all the nodes created for the test */ - Collection nodes = new ArrayList(); - - public TreeIteratorTests(String name) { - super(name); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testHasNext1() { - this.verifyHasNext(this.buildTreeIterator1()); - } - - public void testHasNext2() { - this.verifyHasNext(this.buildTreeIterator2()); - } - - private void verifyHasNext(Iterator iterator) { - int i = 0; - while (iterator.hasNext()) { - iterator.next(); - i++; - } - assertEquals(this.nodes.size(), i); - } - - public void testNext1() { - this.verifyNext(this.buildTreeIterator1()); - } - - public void testNext2() { - this.verifyNext(this.buildTreeIterator2()); - } - - private void verifyNext(Iterator iterator) { - while (iterator.hasNext()) { - assertTrue("bogus element", this.nodes.contains(iterator.next())); - } - } - - public void testNoSuchElementException1() { - this.verifyNoSuchElementException(this.buildTreeIterator1()); - } - - public void testNoSuchElementException2() { - this.verifyNoSuchElementException(this.buildTreeIterator2()); - } - - private void verifyNoSuchElementException(Iterator iterator) { - boolean exCaught = false; - while (iterator.hasNext()) { - iterator.next(); - } - try { - iterator.next(); - } catch (NoSuchElementException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown", exCaught); - } - - public void testRemove1() { - this.verifyRemove(this.buildTreeIterator1()); - } - - public void testRemove2() { - this.verifyRemove(this.buildTreeIterator2()); - } - - private void verifyRemove(Iterator iterator) { - String parentName = "child 2"; - String childName = "grandchild 2A"; - int startSize = this.childrenSize(parentName); - while (iterator.hasNext()) { - TreeNode node = iterator.next(); - if (node.getName().equals(childName)) { - iterator.remove(); - } - } - int endSize = this.childrenSize(parentName); - assertEquals(startSize - 1, endSize); - } - - private int childrenSize(String nodeName) { - for (Iterator stream = this.nodes.iterator(); stream.hasNext();) { - TreeNode node = stream.next(); - if (node.getName().equals(nodeName)) { - return node.childrenSize(); - } - } - throw new IllegalArgumentException(nodeName); - } - - /** - * build a tree iterator with an explicit midwife - */ - private Iterator buildTreeIterator1() { - return new TreeIterator(this.buildTree(), this.buildMidwife()); - } - - private TreeIterator.Midwife buildMidwife() { - return new TreeIterator.Midwife() { - public Iterator children(TreeNode next) { - return next.children(); - } - }; - } - - /** - * build a tree iterator with an override - */ - private Iterator buildTreeIterator2() { - return new TreeIterator(this.buildTree()) { - @Override - public Iterator children(TreeNode next) { - return next.children(); - } - }; - } - - public void testInvalidTreeIterator() { - // missing method override - Iterator iterator = new TreeIterator(this.buildTree()); - boolean exCaught = false; - try { - TreeNode tn = iterator.next(); - fail("invalid tree node: " + tn); - } catch (UnsupportedOperationException ex) { - exCaught = true; - } - assertTrue("NoSuchElementException not thrown", exCaught); - } - - private TreeNode buildTree() { - TreeNode root = new TreeNode("root"); - TreeNode child1 = new TreeNode(root, "child 1"); - new TreeNode(child1, "grandchild 1A"); - TreeNode child2 = new TreeNode(root, "child 2"); - new TreeNode(child2, "grandchild 2A"); - TreeNode grandchild2B = new TreeNode(child2, "grandchild 2B"); - new TreeNode(grandchild2B, "great-grandchild 2B1"); - new TreeNode(grandchild2B, "great-grandchild 2B2"); - TreeNode grandchild2C = new TreeNode(child2, "grandchild 2C"); - new TreeNode(grandchild2C, "great-grandchild 2C1"); - new TreeNode(root, "child 3"); - return root; - } - - private class TreeNode { - private String name; - private Collection children = new ArrayList(); - - public TreeNode(String name) { - super(); - TreeIteratorTests.this.nodes.add(this); // log node - this.name = name; - } - - public TreeNode(TreeNode parent, String name) { - this(name); - parent.addChild(this); - } - - public String getName() { - return this.name; - } - - private void addChild(TreeNode child) { - this.children.add(child); - } - - public Iterator children() { - return this.children.iterator(); - } - - public int childrenSize() { - return this.children.size(); - } - - @Override - public String toString() { - return "TreeNode(" + this.name + ")"; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/ChangeSupportTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/ChangeSupportTests.java deleted file mode 100644 index 2166827530..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/ChangeSupportTests.java +++ /dev/null @@ -1,4575 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model; - -import java.io.IOException; -import java.io.ObjectInputStream; -import java.io.ObjectOutputStream; -import java.io.Serializable; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.EventListener; -import java.util.HashSet; -import java.util.List; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.ListenerList; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ListChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.StateChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; -import org.eclipse.jpt.common.utility.model.listener.TreeChangeAdapter; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class ChangeSupportTests - extends TestCase -{ - TestModel testModel; - static final String TEST_TO_STRING = "this is a test"; - - ChangeListener changeListener = new Adapter(); - - StateChangeEvent stateChangeEvent; - boolean stateChangedCalled = false; - - PropertyChangeEvent propertyChangeEvent; - boolean propertyChangeCalled = false; - static final String PROPERTY_NAME = "propertyName"; - static final Object OLD_OBJECT_VALUE = new Object(); - static final Object NEW_OBJECT_VALUE = new Object(); - static final Integer OLD_INT_VALUE = new Integer(27); - static final Boolean OLD_BOOLEAN_VALUE = Boolean.TRUE; - static final Integer NEW_INT_VALUE = new Integer(42); - static final Boolean NEW_BOOLEAN_VALUE = Boolean.FALSE; - - CollectionEvent collectionEvent; - boolean itemsAddedCollectionCalled = false; - boolean itemsRemovedCollectionCalled = false; - boolean collectionChangedCalled = false; - boolean collectionClearedCalled = false; - static final String COLLECTION_NAME = "collectionName"; - static final Object ADDED_OBJECT_VALUE = new Object(); - static final Object ADDED_OBJECT_VALUE_2 = new Object(); - static final Object REMOVED_OBJECT_VALUE = new Object(); - static final int TARGET_INDEX = 7; - static final int SOURCE_INDEX = 22; - - ListEvent listEvent; - boolean itemsAddedListCalled = false; - boolean itemsRemovedListCalled = false; - boolean itemsReplacedListCalled = false; - boolean itemsMovedListCalled = false; - boolean listChangedCalled = false; - boolean listClearedCalled = false; - static final String LIST_NAME = "listName"; - static final int ADD_INDEX = 3; - static final int REMOVE_INDEX = 5; - static final int REPLACE_INDEX = 2; - - TreeEvent treeEvent; - boolean nodeAddedCalled = false; - boolean nodeRemovedCalled = false; - boolean treeChangedCalled = false; - boolean treeClearedCalled = false; - static final String TREE_NAME = "treeName"; - static final List OBJECT_PATH = Arrays.asList(new Object[] {new Object(), new Object(), new String()}); - - - public ChangeSupportTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.testModel = new TestModel(); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - - // ********** general tests ********** - - public void testNullSource() { - boolean exCaught = false; - try { - ChangeSupport cs = new ChangeSupport(null); - fail("bogus change support: " + cs); - } catch (NullPointerException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - // ********** state change tests ********** - - public void testFireStateChange() { - this.stateChangeEvent = null; - this.stateChangedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireStateChange(); - assertNotNull(this.stateChangeEvent); - assertEquals(this.testModel, this.stateChangeEvent.getSource()); - assertTrue(this.stateChangedCalled); - } - - public void testHasAnyStateChangeListeners() { - assertTrue(this.testModel.hasNoStateChangeListeners()); - this.testModel.addChangeListener(this.changeListener); - assertTrue(this.testModel.hasAnyStateChangeListeners()); - this.testModel.removeChangeListener(this.changeListener); - assertTrue(this.testModel.hasNoStateChangeListeners()); - } - - public void testHasAnyStateChangeListenersDuplicate() { - assertTrue(this.testModel.hasNoStateChangeListeners()); - this.testModel.addChangeListener(this.changeListener); - boolean exCaught = false; - try { - this.testModel.addChangeListener(this.changeListener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - assertTrue(this.testModel.hasAnyStateChangeListeners()); - this.testModel.removeChangeListener(this.changeListener); - assertTrue(this.testModel.hasNoStateChangeListeners()); - - exCaught = false; - try { - this.testModel.removeChangeListener(this.changeListener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(this.testModel.hasNoStateChangeListeners()); - } - - public void testAddNullStateListener() { - boolean exCaught = false; - try { - this.testModel.addStateChangeListener(null); - } catch (NullPointerException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testRemoveBogusStateListener() { - boolean exCaught = false; - try { - this.testModel.removeChangeListener(this.changeListener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - this.testModel.addPropertyChangeListener("foo", this.changeListener); - exCaught = false; - try { - this.testModel.removeChangeListener(this.changeListener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - this.testModel.addChangeListener(this.changeListener); - exCaught = false; - try { - this.testModel.removeStateChangeListener(new Adapter()); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - exCaught = false; - try { - this.testModel.removeStateChangeListener(new StateChangeAdapter()); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - - // ********** property change tests ********** - - public void testFirePropertyChangedEvent() { - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedEvent(); - this.verifyPropertyChangeEvent(OLD_OBJECT_VALUE, NEW_OBJECT_VALUE); - assertTrue(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedEvent(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addPropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedEvent(); - this.verifyPropertyChangeEvent(OLD_OBJECT_VALUE, NEW_OBJECT_VALUE); - assertTrue(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removePropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedEvent(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - } - - public void testFirePropertyChangedEventNoChange() { - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedEventNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedEventNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addPropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedEventNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removePropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedEventNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - } - - public void testFirePropertyChangedObjectObject() { - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedObjectObject(); - this.verifyPropertyChangeEvent(OLD_OBJECT_VALUE, NEW_OBJECT_VALUE); - assertTrue(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedObjectObject(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addPropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedObjectObject(); - this.verifyPropertyChangeEvent(OLD_OBJECT_VALUE, NEW_OBJECT_VALUE); - assertTrue(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removePropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedObjectObject(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - } - - public void testFirePropertyChangedObjectObjectNoChange() { - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedObjectObjectNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedObjectObjectNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addPropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedObjectObjectNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removePropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedObjectObjectNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - } - - public void testFirePropertyChangedObject() { - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedObject(); - this.verifyPropertyChangeEvent(null, NEW_OBJECT_VALUE); - assertTrue(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedObject(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addPropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedObject(); - this.verifyPropertyChangeEvent(null, NEW_OBJECT_VALUE); - assertTrue(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removePropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedObject(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - } - - public void testFirePropertyChangedObjectNoChange() { - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedObjectNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedObjectNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addPropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedObjectNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removePropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedObjectNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - } - - public void testFirePropertyChangedIntInt() { - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedIntInt(); - this.verifyPropertyChangeEvent(OLD_INT_VALUE, NEW_INT_VALUE); - assertTrue(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedIntInt(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addPropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedIntInt(); - this.verifyPropertyChangeEvent(OLD_INT_VALUE, NEW_INT_VALUE); - assertTrue(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removePropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedIntInt(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - } - - public void testFirePropertyChangedIntIntNoChange() { - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedIntIntNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedIntIntNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addPropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedIntIntNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removePropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedIntIntNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - } - - public void testFirePropertyChangedBooleanBoolean() { - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedBooleanBoolean(); - this.verifyPropertyChangeEvent(OLD_BOOLEAN_VALUE, NEW_BOOLEAN_VALUE); - assertTrue(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedBooleanBoolean(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addPropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedBooleanBoolean(); - this.verifyPropertyChangeEvent(OLD_BOOLEAN_VALUE, NEW_BOOLEAN_VALUE); - assertTrue(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removePropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedBooleanBoolean(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - } - - public void testFirePropertyChangedBooleanBooleanNoChange() { - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedBooleanBooleanNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFirePropertyChangedBooleanBooleanNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.addPropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedBooleanBooleanNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.removePropertyChangeListener(PROPERTY_NAME, this.changeListener); - this.testModel.testFirePropertyChangedBooleanBooleanNoChange(); - assertNull(this.propertyChangeEvent); - assertFalse(this.propertyChangeCalled); - } - - public void testHasAnyPropertyChangeListeners() { - assertTrue(this.testModel.hasNoPropertyChangeListeners(PROPERTY_NAME)); - this.testModel.addChangeListener(this.changeListener); - assertTrue(this.testModel.hasAnyPropertyChangeListeners(PROPERTY_NAME)); - this.testModel.removeChangeListener(this.changeListener); - assertTrue(this.testModel.hasNoPropertyChangeListeners(PROPERTY_NAME)); - - assertTrue(this.testModel.hasNoPropertyChangeListeners(PROPERTY_NAME)); - this.testModel.addPropertyChangeListener(PROPERTY_NAME, this.changeListener); - assertTrue(this.testModel.hasAnyPropertyChangeListeners(PROPERTY_NAME)); - this.testModel.removePropertyChangeListener(PROPERTY_NAME, this.changeListener); - assertTrue(this.testModel.hasNoPropertyChangeListeners(PROPERTY_NAME)); - } - - public void testAddNullPropertyListener() { - boolean exCaught = false; - try { - this.testModel.addChangeListener(null); - } catch (NullPointerException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testAddNullPropertyListenerName() { - boolean exCaught = false; - try { - this.testModel.addPropertyChangeListener("foo", null); - } catch (NullPointerException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testRemoveBogusPropertyListener() { - boolean exCaught = false; - try { - this.testModel.removePropertyChangeListener("foo", new PropertyChangeAdapter()); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - this.testModel.addCollectionChangeListener("foo", this.changeListener); - exCaught = false; - try { - this.testModel.removePropertyChangeListener("foo", this.changeListener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - this.testModel.addPropertyChangeListener("foo", this.changeListener); - exCaught = false; - try { - this.testModel.removePropertyChangeListener("foo", new PropertyChangeAdapter()); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - exCaught = false; - try { - this.testModel.removePropertyChangeListener("foo", new PropertyChangeAdapter()); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - private void verifyPropertyChangeEvent(Object oldValue, Object newValue) { - this.verifyPropertyChangeEvent(this.testModel, oldValue, newValue); - } - - private void verifyPropertyChangeEvent(Object source, Object oldValue, Object newValue) { - assertNotNull(this.propertyChangeEvent); - assertEquals(source, this.propertyChangeEvent.getSource()); - assertEquals(PROPERTY_NAME, this.propertyChangeEvent.getPropertyName()); - assertEquals(oldValue, this.propertyChangeEvent.getOldValue()); - assertEquals(newValue, this.propertyChangeEvent.getNewValue()); - } - - - // ********** collection change tests ********** - - public void testFireItemsAddedCollectionEvent() { - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsAddedCollectionEvent(); - this.verifyCollectionEvent(ADDED_OBJECT_VALUE); - assertTrue(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsAddedCollectionEvent(); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemsAddedCollectionEvent(); - this.verifyCollectionEvent(ADDED_OBJECT_VALUE); - assertTrue(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemsAddedCollectionEvent(); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - } - - public void testFireItemsAddedCollectionEventNoChange() { - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsAddedCollectionEventNoChange(); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsAddedCollectionEventNoChange(); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemsAddedCollectionEventNoChange(); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemsAddedCollectionEventNoChange(); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - } - - public void testFireItemsAddedCollection() { - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsAddedCollection(); - this.verifyCollectionEvent(ADDED_OBJECT_VALUE); - assertTrue(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsAddedCollection(); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemsAddedCollection(); - this.verifyCollectionEvent(ADDED_OBJECT_VALUE); - assertTrue(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemsAddedCollection(); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - } - - public void testFireItemsAddedCollectionNoChange() { - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsAddedCollectionNoChange(); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsAddedCollectionNoChange(); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemsAddedCollectionNoChange(); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemsAddedCollectionNoChange(); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - } - - public void testFireItemAddedCollection() { - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemAddedCollection(); - this.verifyCollectionEvent(ADDED_OBJECT_VALUE); - assertTrue(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemAddedCollection(); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemAddedCollection(); - this.verifyCollectionEvent(ADDED_OBJECT_VALUE); - assertTrue(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemAddedCollection(); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - } - - public void testFireItemsRemovedCollectionEvent() { - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsRemovedCollectionEvent(); - this.verifyCollectionEvent(REMOVED_OBJECT_VALUE); - assertTrue(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsRemovedCollectionEvent(); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemsRemovedCollectionEvent(); - this.verifyCollectionEvent(REMOVED_OBJECT_VALUE); - assertTrue(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemsRemovedCollectionEvent(); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - } - - public void testFireItemsRemovedCollectionEventNoChange() { - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsRemovedCollectionEventNoChange(); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsRemovedCollectionEventNoChange(); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemsRemovedCollectionEventNoChange(); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemsRemovedCollectionEventNoChange(); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - } - - public void testFireItemsRemovedCollection() { - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsRemovedCollection(); - this.verifyCollectionEvent(REMOVED_OBJECT_VALUE); - assertTrue(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsRemovedCollection(); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemsRemovedCollection(); - this.verifyCollectionEvent(REMOVED_OBJECT_VALUE); - assertTrue(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemsRemovedCollection(); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - } - - public void testFireItemsRemovedCollectionNoChange() { - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsRemovedCollectionNoChange(); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsRemovedCollectionNoChange(); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemsRemovedCollectionNoChange(); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemsRemovedCollectionNoChange(); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - } - - public void testFireItemRemovedCollection() { - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemRemovedCollection(); - this.verifyCollectionEvent(REMOVED_OBJECT_VALUE); - assertTrue(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemRemovedCollection(); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemRemovedCollection(); - this.verifyCollectionEvent(REMOVED_OBJECT_VALUE); - assertTrue(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireItemRemovedCollection(); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - } - - public void testFireCollectionCleared() { - this.collectionEvent = null; - this.collectionClearedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireCollectionCleared(); - this.verifyCollectionEvent(null); - assertTrue(this.collectionClearedCalled); - - this.collectionEvent = null; - this.collectionClearedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireCollectionCleared(); - assertNull(this.collectionEvent); - assertFalse(this.collectionClearedCalled); - - this.collectionEvent = null; - this.collectionClearedCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireCollectionCleared(); - this.verifyCollectionEvent(null); - assertTrue(this.collectionClearedCalled); - - this.collectionEvent = null; - this.collectionClearedCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireCollectionCleared(); - assertNull(this.collectionEvent); - assertFalse(this.collectionClearedCalled); - } - - public void testFireCollectionChangedEvent() { - this.collectionEvent = null; - this.collectionChangedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireCollectionChangedEvent(); - this.verifyCollectionEvent(null); - assertTrue(this.collectionChangedCalled); - - this.collectionEvent = null; - this.collectionChangedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireCollectionChangedEvent(); - assertNull(this.collectionEvent); - assertFalse(this.collectionChangedCalled); - - this.collectionEvent = null; - this.collectionChangedCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireCollectionChangedEvent(); - this.verifyCollectionEvent(null); - assertTrue(this.collectionChangedCalled); - - this.collectionEvent = null; - this.collectionChangedCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireCollectionChangedEvent(); - assertNull(this.collectionEvent); - assertFalse(this.collectionChangedCalled); - } - - public void testFireCollectionChanged() { - this.collectionEvent = null; - this.collectionChangedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireCollectionChanged(); - this.verifyCollectionEvent(null); - assertTrue(this.collectionChangedCalled); - - this.collectionEvent = null; - this.collectionChangedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireCollectionChanged(); - assertNull(this.collectionEvent); - assertFalse(this.collectionChangedCalled); - - this.collectionEvent = null; - this.collectionChangedCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireCollectionChanged(); - this.verifyCollectionEvent(null); - assertTrue(this.collectionChangedCalled); - - this.collectionEvent = null; - this.collectionChangedCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - this.testModel.testFireCollectionChanged(); - assertNull(this.collectionEvent); - assertFalse(this.collectionChangedCalled); - } - - public void testAddItemToCollection() { - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertTrue(this.testModel.testAddItemToCollection()); - this.verifyCollectionEvent(ADDED_OBJECT_VALUE); - assertTrue(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertTrue(this.testModel.testAddItemToCollection()); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.testAddItemToCollection()); - this.verifyCollectionEvent(ADDED_OBJECT_VALUE); - assertTrue(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.testAddItemToCollection()); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - } - - public void testAddItemToCollectionNoChange() { - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertFalse(this.testModel.testAddItemToCollectionNoChange()); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertFalse(this.testModel.testAddItemToCollectionNoChange()); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testAddItemToCollectionNoChange()); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testAddItemToCollectionNoChange()); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - } - - public void testAddItemsToCollection() { - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertTrue(this.testModel.testAddItemsToCollection()); - this.verifyCollectionEvent(ADDED_OBJECT_VALUE); - assertTrue(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertTrue(this.testModel.testAddItemsToCollection()); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.testAddItemsToCollection()); - this.verifyCollectionEvent(ADDED_OBJECT_VALUE); - assertTrue(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.testAddItemsToCollection()); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - } - - public void testAddItemsToCollectionNoChange() { - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertFalse(this.testModel.testAddItemsToCollectionNoChange()); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertFalse(this.testModel.testAddItemsToCollectionNoChange()); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testAddItemsToCollectionNoChange()); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testAddItemsToCollectionNoChange()); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - } - - public void testAddItemsToCollectionMixed() { - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertTrue(this.testModel.testAddItemsToCollectionMixed()); - this.verifyCollectionEvent(ADDED_OBJECT_VALUE_2); - assertTrue(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertTrue(this.testModel.testAddItemsToCollectionMixed()); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.testAddItemsToCollectionMixed()); - this.verifyCollectionEvent(ADDED_OBJECT_VALUE_2); - assertTrue(this.itemsAddedCollectionCalled); - - this.collectionEvent = null; - this.itemsAddedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.testAddItemsToCollectionMixed()); - assertNull(this.collectionEvent); - assertFalse(this.itemsAddedCollectionCalled); - } - - public void testRemoveItemFromCollection() { - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertTrue(this.testModel.testRemoveItemFromCollection()); - this.verifyCollectionEvent(REMOVED_OBJECT_VALUE); - assertTrue(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertTrue(this.testModel.testRemoveItemFromCollection()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.testRemoveItemFromCollection()); - this.verifyCollectionEvent(REMOVED_OBJECT_VALUE); - assertTrue(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.testRemoveItemFromCollection()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - } - - public void testRemoveItemFromCollectionNoChange() { - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertFalse(this.testModel.testRemoveItemFromCollectionNoChange()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertFalse(this.testModel.testRemoveItemFromCollectionNoChange()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testRemoveItemFromCollectionNoChange()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testRemoveItemFromCollectionNoChange()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - } - - public void testRemoveItemsFromCollection() { - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertTrue(this.testModel.testRemoveItemsFromCollection()); - this.verifyCollectionChangeEvent2(REMOVED_OBJECT_VALUE, "foo", "bar"); - assertTrue(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertTrue(this.testModel.testRemoveItemsFromCollection()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.testRemoveItemsFromCollection()); - this.verifyCollectionChangeEvent2(REMOVED_OBJECT_VALUE, "foo", "bar"); - assertTrue(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.testRemoveItemsFromCollection()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - } - - public void testRemoveItemsFromCollectionNoChange1() { - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertFalse(this.testModel.testRemoveItemsFromCollectionNoChange1()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertFalse(this.testModel.testRemoveItemsFromCollectionNoChange1()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testRemoveItemsFromCollectionNoChange1()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testRemoveItemsFromCollectionNoChange1()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - } - - public void testRemoveItemsFromCollectionNoChange2() { - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertFalse(this.testModel.testRemoveItemsFromCollectionNoChange2()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertFalse(this.testModel.testRemoveItemsFromCollectionNoChange2()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testRemoveItemsFromCollectionNoChange2()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testRemoveItemsFromCollectionNoChange2()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - } - - public void testRemoveItemsFromCollectionNoChange3() { - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertFalse(this.testModel.testRemoveItemsFromCollectionNoChange3()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertFalse(this.testModel.testRemoveItemsFromCollectionNoChange3()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testRemoveItemsFromCollectionNoChange3()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testRemoveItemsFromCollectionNoChange3()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - } - - public void testRetainItemsInCollection1() { - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertTrue(this.testModel.testRetainItemsInCollection1()); - this.verifyCollectionEvent(REMOVED_OBJECT_VALUE); - assertTrue(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertTrue(this.testModel.testRetainItemsInCollection1()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.testRetainItemsInCollection1()); - this.verifyCollectionEvent(REMOVED_OBJECT_VALUE); - assertTrue(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.testRetainItemsInCollection1()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - } - - // collection cleared... - public void testRetainItemsInCollection2() { - this.collectionEvent = null; - this.collectionClearedCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertTrue(this.testModel.testRetainItemsInCollection2()); - this.verifyCollectionEvent(null); - assertTrue(this.collectionClearedCalled); - - this.collectionEvent = null; - this.collectionClearedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertTrue(this.testModel.testRetainItemsInCollection2()); - assertNull(this.collectionEvent); - assertFalse(this.collectionClearedCalled); - - this.collectionEvent = null; - this.collectionClearedCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.testRetainItemsInCollection2()); - this.verifyCollectionEvent(null); - assertTrue(this.collectionClearedCalled); - - this.collectionEvent = null; - this.collectionClearedCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.testRetainItemsInCollection2()); - assertNull(this.collectionEvent); - assertFalse(this.collectionClearedCalled); - } - - public void testRetainItemsInCollectionNoChange1() { - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertFalse(this.testModel.testRetainItemsInCollectionNoChange1()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertFalse(this.testModel.testRetainItemsInCollectionNoChange1()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testRetainItemsInCollectionNoChange1()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testRetainItemsInCollectionNoChange1()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - } - - public void testRetainItemsInCollectionNoChange2() { - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertFalse(this.testModel.testRetainItemsInCollectionNoChange2()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertFalse(this.testModel.testRetainItemsInCollectionNoChange2()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testRetainItemsInCollectionNoChange2()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - - this.collectionEvent = null; - this.itemsRemovedCollectionCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testRetainItemsInCollectionNoChange2()); - assertNull(this.collectionEvent); - assertFalse(this.itemsRemovedCollectionCalled); - } - - public void testClearCollection() { - this.collectionEvent = null; - this.collectionClearedCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertTrue(this.testModel.testClearCollection()); - this.verifyCollectionEvent(null); - assertTrue(this.collectionClearedCalled); - - this.collectionEvent = null; - this.collectionClearedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertTrue(this.testModel.testClearCollection()); - assertNull(this.collectionEvent); - assertFalse(this.collectionClearedCalled); - - this.collectionEvent = null; - this.collectionClearedCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.testClearCollection()); - this.verifyCollectionEvent(null); - assertTrue(this.collectionClearedCalled); - - this.collectionEvent = null; - this.collectionClearedCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.testClearCollection()); - assertNull(this.collectionEvent); - assertFalse(this.collectionClearedCalled); - } - - public void testClearCollectionNoChange() { - this.collectionEvent = null; - this.collectionClearedCalled = false; - this.testModel.addChangeListener(this.changeListener); - assertFalse(this.testModel.testClearCollectionNoChange()); - assertNull(this.collectionEvent); - assertFalse(this.collectionClearedCalled); - - this.collectionEvent = null; - this.collectionClearedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - assertFalse(this.testModel.testClearCollectionNoChange()); - assertNull(this.collectionEvent); - assertFalse(this.collectionClearedCalled); - - this.collectionEvent = null; - this.collectionClearedCalled = false; - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testClearCollectionNoChange()); - assertNull(this.collectionEvent); - assertFalse(this.collectionClearedCalled); - - this.collectionEvent = null; - this.collectionClearedCalled = false; - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertFalse(this.testModel.testClearCollectionNoChange()); - assertNull(this.collectionEvent); - assertFalse(this.collectionClearedCalled); - } - - public void testSynchronizeCollection1() { - CollectionSynchListener csl = new CollectionSynchListener(); - this.testModel.addChangeListener(csl); - assertTrue(this.testModel.testSynchronizeCollection1()); - assertTrue(csl.itemsAdded); - assertTrue(csl.itemsRemoved); - assertFalse(csl.collectionChanged); - assertFalse(csl.collectionCleared); - assertEquals(2, csl.addedItems.size()); - assertTrue(CollectionTools.containsAll(csl.addedItems, new Object[] {"joo", "jar"})); - assertEquals(2, csl.removedItems.size()); - assertTrue(CollectionTools.containsAll(csl.removedItems, new Object[] {"foo", "bar"})); - } - - public void testSynchronizeCollection2() { - CollectionSynchListener csl = new CollectionSynchListener(); - this.testModel.addChangeListener(csl); - assertTrue(this.testModel.testSynchronizeCollection2()); - assertFalse(csl.itemsAdded); - assertFalse(csl.itemsRemoved); - assertFalse(csl.collectionChanged); - assertTrue(csl.collectionCleared); - assertTrue(csl.addedItems.isEmpty()); - assertTrue(csl.removedItems.isEmpty()); - } - - public void testSynchronizeCollection3() { - CollectionSynchListener csl = new CollectionSynchListener(); - this.testModel.addChangeListener(csl); - assertTrue(this.testModel.testSynchronizeCollection3()); - assertTrue(csl.itemsAdded); - assertFalse(csl.itemsRemoved); - assertFalse(csl.collectionChanged); - assertFalse(csl.collectionCleared); - assertEquals(3, csl.addedItems.size()); - assertTrue(CollectionTools.containsAll(csl.addedItems, new Object[] {"joo", "jar", "baz"})); - assertTrue(csl.removedItems.isEmpty()); - } - - class CollectionSynchListener extends ChangeAdapter { - boolean itemsAdded = false; - boolean itemsRemoved = false; - boolean collectionChanged = false; - boolean collectionCleared = false; - Collection addedItems = new ArrayList(); - Collection removedItems = new ArrayList(); - @Override - public void collectionChanged(CollectionChangeEvent event) { - this.collectionChanged = true; - } - @Override - public void collectionCleared(CollectionClearEvent event) { - this.collectionCleared = true; - } - @Override - public void itemsAdded(CollectionAddEvent event) { - this.itemsAdded = true; - CollectionTools.addAll(this.addedItems, event.getItems()); - } - @Override - public void itemsRemoved(CollectionRemoveEvent event) { - this.itemsRemoved = true; - CollectionTools.addAll(this.removedItems, event.getItems()); - } - } - - public void testHasAnyCollectionChangeListeners() { - assertTrue(this.testModel.hasNoCollectionChangeListeners(COLLECTION_NAME)); - this.testModel.addChangeListener(this.changeListener); - assertTrue(this.testModel.hasAnyCollectionChangeListeners(COLLECTION_NAME)); - this.testModel.removeChangeListener(this.changeListener); - assertTrue(this.testModel.hasNoCollectionChangeListeners(COLLECTION_NAME)); - - assertTrue(this.testModel.hasNoCollectionChangeListeners(COLLECTION_NAME)); - this.testModel.addCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.hasAnyCollectionChangeListeners(COLLECTION_NAME)); - this.testModel.removeCollectionChangeListener(COLLECTION_NAME, this.changeListener); - assertTrue(this.testModel.hasNoCollectionChangeListeners(COLLECTION_NAME)); - } - - public void testAddNullCollectionListener() { - boolean exCaught = false; - try { - this.testModel.addCollectionChangeListener("foo", null); - } catch (NullPointerException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testRemoveBogusCollectionListener() { - boolean exCaught = false; - try { - this.testModel.removeCollectionChangeListener("foo", this.changeListener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - this.testModel.addPropertyChangeListener("foo", this.changeListener); - exCaught = false; - try { - this.testModel.removeCollectionChangeListener("foo", this.changeListener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - this.testModel.addCollectionChangeListener("foo", this.changeListener); - exCaught = false; - try { - this.testModel.removeCollectionChangeListener("foo", new CollectionChangeAdapter()); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - exCaught = false; - try { - this.testModel.removeCollectionChangeListener("foo", new CollectionChangeAdapter()); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - private void verifyCollectionEvent(Object item) { - assertNotNull(this.collectionEvent); - assertEquals(this.testModel, this.collectionEvent.getSource()); - assertEquals(COLLECTION_NAME, this.collectionEvent.getCollectionName()); - if (item != null) { - assertEquals(item, this.getCollectionEventItems().iterator().next()); - } - } - - private Iterable getCollectionEventItems() { - if (this.collectionEvent instanceof CollectionAddEvent) { - return ((CollectionAddEvent) this.collectionEvent).getItems(); - } else if (this.collectionEvent instanceof CollectionRemoveEvent) { - return ((CollectionRemoveEvent) this.collectionEvent).getItems(); - } - throw new IllegalStateException(); - } - - private void verifyCollectionChangeEvent2(Object... items) { - assertNotNull(this.collectionEvent); - assertEquals(this.testModel, this.collectionEvent.getSource()); - assertEquals(COLLECTION_NAME, this.collectionEvent.getCollectionName()); - assertEquals(items.length, this.getCollectionEventItemsSize()); - for (Object item : items) { - assertTrue(CollectionTools.contains(this.getCollectionEventItems(), item)); - } - } - - private int getCollectionEventItemsSize() { - if (this.collectionEvent instanceof CollectionAddEvent) { - return ((CollectionAddEvent) this.collectionEvent).getItemsSize(); - } else if (this.collectionEvent instanceof CollectionRemoveEvent) { - return ((CollectionRemoveEvent) this.collectionEvent).getItemsSize(); - } - throw new IllegalStateException(); - } - - - // ********** list change tests ********** - - public void testFireItemsAddedListEvent() { - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsAddedListEvent(); - this.verifyListAddEvent(ADD_INDEX, ADDED_OBJECT_VALUE); - assertTrue(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsAddedListEvent(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsAddedListEvent(); - this.verifyListAddEvent(ADD_INDEX, ADDED_OBJECT_VALUE); - assertTrue(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsAddedListEvent(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - } - - public void testFireItemsAddedListEventNoChange() { - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsAddedListEventNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsAddedListEventNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsAddedListEventNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsAddedListEventNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - } - - public void testFireItemsAddedList() { - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsAddedList(); - this.verifyListAddEvent(ADD_INDEX, ADDED_OBJECT_VALUE); - assertTrue(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsAddedList(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsAddedList(); - this.verifyListAddEvent(ADD_INDEX, ADDED_OBJECT_VALUE); - assertTrue(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsAddedList(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - } - - public void testFireItemsAddedListNoChange() { - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsAddedListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsAddedListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsAddedListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsAddedListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - } - - public void testFireItemAddedList() { - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemAddedList(); - this.verifyListAddEvent(ADD_INDEX, ADDED_OBJECT_VALUE); - assertTrue(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemAddedList(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemAddedList(); - this.verifyListAddEvent(ADD_INDEX, ADDED_OBJECT_VALUE); - assertTrue(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemAddedList(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - } - - public void testFireItemsRemovedListEvent() { - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsRemovedListEvent(); - this.verifyListRemoveEvent(REMOVE_INDEX, REMOVED_OBJECT_VALUE); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsRemovedListEvent(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsRemovedListEvent(); - this.verifyListRemoveEvent(REMOVE_INDEX, REMOVED_OBJECT_VALUE); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsRemovedListEvent(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - } - - public void testFireItemsRemovedListEventNoChange() { - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsRemovedListEventNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsRemovedListEventNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsRemovedListEventNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsRemovedListEventNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - } - - public void testFireItemsRemovedList() { - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsRemovedList(); - this.verifyListRemoveEvent(REMOVE_INDEX, REMOVED_OBJECT_VALUE); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsRemovedList(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsRemovedList(); - this.verifyListRemoveEvent(REMOVE_INDEX, REMOVED_OBJECT_VALUE); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsRemovedList(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - } - - public void testFireItemsRemovedListNoChange() { - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsRemovedListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsRemovedListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsRemovedListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsRemovedListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - } - - public void testFireItemRemovedList() { - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemRemovedList(); - this.verifyListRemoveEvent(REMOVE_INDEX, REMOVED_OBJECT_VALUE); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemRemovedList(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemRemovedList(); - this.verifyListRemoveEvent(REMOVE_INDEX, REMOVED_OBJECT_VALUE); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemRemovedList(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - } - - public void testFireItemsReplacedListEvent() { - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsReplacedListEvent(); - this.verifyListReplaceEvent(REPLACE_INDEX, ADDED_OBJECT_VALUE, REMOVED_OBJECT_VALUE); - assertTrue(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsReplacedListEvent(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsReplacedListEvent(); - this.verifyListReplaceEvent(REPLACE_INDEX, ADDED_OBJECT_VALUE, REMOVED_OBJECT_VALUE); - assertTrue(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsReplacedListEvent(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - } - - public void testFireItemsReplacedListEventNoChange() { - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsReplacedListEventNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsReplacedListEventNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsReplacedListEventNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsReplacedListEventNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - } - - public void testFireItemsReplacedList() { - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsReplacedList(); - this.verifyListReplaceEvent(REPLACE_INDEX, ADDED_OBJECT_VALUE, REMOVED_OBJECT_VALUE); - assertTrue(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsReplacedList(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsReplacedList(); - this.verifyListReplaceEvent(REPLACE_INDEX, ADDED_OBJECT_VALUE, REMOVED_OBJECT_VALUE); - assertTrue(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsReplacedList(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - } - - public void testFireItemsReplacedListNoChange() { - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsReplacedListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsReplacedListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsReplacedListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsReplacedListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - } - - public void testFireItemReplacedList() { - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemReplacedList(); - this.verifyListReplaceEvent(REPLACE_INDEX, ADDED_OBJECT_VALUE, REMOVED_OBJECT_VALUE); - assertTrue(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemReplacedList(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemReplacedList(); - this.verifyListReplaceEvent(REPLACE_INDEX, ADDED_OBJECT_VALUE, REMOVED_OBJECT_VALUE); - assertTrue(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemReplacedList(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - } - - public void testFireItemsMovedListEvent() { - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsMovedListEvent(); - this.verifyListMoveEvent(TARGET_INDEX, SOURCE_INDEX); - assertTrue(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsMovedListEvent(); - assertNull(this.listEvent); - assertFalse(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsMovedListEvent(); - this.verifyListMoveEvent(TARGET_INDEX, SOURCE_INDEX); - assertTrue(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsMovedListEvent(); - assertNull(this.listEvent); - assertFalse(this.itemsMovedListCalled); - } - - public void testFireItemsMovedListEventNoChange() { - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsMovedListEventNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsMovedListEventNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsMovedListEventNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsMovedListEventNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsMovedListCalled); - } - - public void testFireItemsMovedList() { - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsMovedList(); - this.verifyListMoveEvent(TARGET_INDEX, SOURCE_INDEX); - assertTrue(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsMovedList(); - assertNull(this.listEvent); - assertFalse(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsMovedList(); - this.verifyListMoveEvent(TARGET_INDEX, SOURCE_INDEX); - assertTrue(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsMovedList(); - assertNull(this.listEvent); - assertFalse(this.itemsMovedListCalled); - } - - public void testFireItemsMovedListNoChange() { - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemsMovedListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemsMovedListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsMovedListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemsMovedListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsMovedListCalled); - } - - public void testFireItemMovedList() { - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireItemMovedList(); - this.verifyListMoveEvent(TARGET_INDEX, SOURCE_INDEX); - assertTrue(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireItemMovedList(); - assertNull(this.listEvent); - assertFalse(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemMovedList(); - this.verifyListMoveEvent(TARGET_INDEX, SOURCE_INDEX); - assertTrue(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireItemMovedList(); - assertNull(this.listEvent); - assertFalse(this.itemsMovedListCalled); - } - - public void testFireListClearedEvent() { - this.listEvent = null; - this.listClearedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireListClearedEvent(); - this.verifyListClearEvent(); - assertTrue(this.listClearedCalled); - - this.listEvent = null; - this.listClearedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireListClearedEvent(); - assertNull(this.listEvent); - assertFalse(this.listClearedCalled); - - this.listEvent = null; - this.listClearedCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireListClearedEvent(); - this.verifyListClearEvent(); - assertTrue(this.listClearedCalled); - - this.listEvent = null; - this.listClearedCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireListClearedEvent(); - assertNull(this.listEvent); - assertFalse(this.listClearedCalled); - } - - public void testFireListCleared() { - this.listEvent = null; - this.listClearedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireListCleared(); - this.verifyListClearEvent(); - assertTrue(this.listClearedCalled); - - this.listEvent = null; - this.listClearedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireListCleared(); - assertNull(this.listEvent); - assertFalse(this.listClearedCalled); - - this.listEvent = null; - this.listClearedCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireListCleared(); - this.verifyListClearEvent(); - assertTrue(this.listClearedCalled); - - this.listEvent = null; - this.listClearedCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireListCleared(); - assertNull(this.listEvent); - assertFalse(this.listClearedCalled); - } - - public void testFireListChangedEvent() { - this.listEvent = null; - this.listChangedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireListChangedEvent(); - this.verifyListChangeEvent(); - assertTrue(this.listChangedCalled); - - this.listEvent = null; - this.listChangedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireListChangedEvent(); - assertNull(this.listEvent); - assertFalse(this.listChangedCalled); - - this.listEvent = null; - this.listChangedCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireListChangedEvent(); - this.verifyListChangeEvent(); - assertTrue(this.listChangedCalled); - - this.listEvent = null; - this.listChangedCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireListChangedEvent(); - assertNull(this.listEvent); - assertFalse(this.listChangedCalled); - } - - public void testFireListChanged() { - this.listEvent = null; - this.listChangedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireListChanged(); - this.verifyListChangeEvent(); - assertTrue(this.listChangedCalled); - - this.listEvent = null; - this.listChangedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireListChanged(); - assertNull(this.listEvent); - assertFalse(this.listChangedCalled); - - this.listEvent = null; - this.listChangedCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireListChanged(); - this.verifyListChangeEvent(); - assertTrue(this.listChangedCalled); - - this.listEvent = null; - this.listChangedCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testFireListChanged(); - assertNull(this.listEvent); - assertFalse(this.listChangedCalled); - } - - public void testAddItemToListIndex() { - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testAddItemToListIndex(); - this.verifyListAddEvent(2, "joo"); - assertTrue(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testAddItemToListIndex(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testAddItemToListIndex(); - this.verifyListAddEvent(2, "joo"); - assertTrue(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testAddItemToListIndex(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - } - - public void testAddItemToList() { - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testAddItemToList(); - this.verifyListAddEvent(3, "joo"); - assertTrue(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testAddItemToList(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testAddItemToList(); - this.verifyListAddEvent(3, "joo"); - assertTrue(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testAddItemToList(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - } - - public void testAddItemsToListIndex() { - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testAddItemsToListIndex(); - this.verifyListAddEvent(2, "joo"); - assertTrue(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testAddItemsToListIndex(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testAddItemsToListIndex(); - this.verifyListAddEvent(2, "joo"); - assertTrue(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testAddItemsToListIndex(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - } - - public void testAddItemsToListIndexNoChange() { - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testAddItemsToListIndexNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testAddItemsToListIndexNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testAddItemsToListIndexNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testAddItemsToListIndexNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - } - - public void testAddItemsToList() { - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testAddItemsToList(); - this.verifyListAddEvent(3, "joo"); - assertTrue(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testAddItemsToList(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testAddItemsToList(); - this.verifyListAddEvent(3, "joo"); - assertTrue(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testAddItemsToList(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - } - - public void testAddItemsToListNoChange() { - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testAddItemsToListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testAddItemsToListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testAddItemsToListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - - this.listEvent = null; - this.itemsAddedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testAddItemsToListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsAddedListCalled); - } - - public void testRemoveItemFromListIndex() { - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testRemoveItemFromListIndex(); - this.verifyListRemoveEvent(1, "bar"); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testRemoveItemFromListIndex(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testRemoveItemFromListIndex(); - this.verifyListRemoveEvent(1, "bar"); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testRemoveItemFromListIndex(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - } - - public void testRemoveItemFromList() { - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testRemoveItemFromList(); - this.verifyListRemoveEvent(1, "bar"); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testRemoveItemFromList(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testRemoveItemFromList(); - this.verifyListRemoveEvent(1, "bar"); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testRemoveItemFromList(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - } - - public void testRemoveItemsFromListIndex() { - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testRemoveItemsFromListIndex(); - this.verifyListRemoveEvent(1, "bar"); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testRemoveItemsFromListIndex(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testRemoveItemsFromListIndex(); - this.verifyListRemoveEvent(1, "bar"); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testRemoveItemsFromListIndex(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - } - - public void testRemoveItemsFromListIndexNoChange() { - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testRemoveItemsFromListIndexNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testRemoveItemsFromListIndexNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testRemoveItemsFromListIndexNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testRemoveItemsFromListIndexNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - } - - public void testRemoveItemsFromList() { - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testRemoveItemsFromList(); - this.verifyListRemoveEvent(1, "bar"); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testRemoveItemsFromList(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testRemoveItemsFromList(); - this.verifyListRemoveEvent(1, "bar"); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testRemoveItemsFromList(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - } - - public void testRemoveItemsFromListNoChange() { - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testRemoveItemsFromListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testRemoveItemsFromListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testRemoveItemsFromListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testRemoveItemsFromListNoChange(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - } - - public void testRetainItemsInList() { - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testRetainItemsInList(); - this.verifyListRemoveEvent(0, "foo"); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testRetainItemsInList(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testRetainItemsInList(); - this.verifyListRemoveEvent(0, "foo"); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsRemovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testRetainItemsInList(); - assertNull(this.listEvent); - assertFalse(this.itemsRemovedListCalled); - } - - public void testReplaceItemInList() { - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testReplaceItemInList(); - this.verifyListReplaceEvent(1, "xxx", "bar"); - assertTrue(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testReplaceItemInList(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testReplaceItemInList(); - this.verifyListReplaceEvent(1, "xxx", "bar"); - assertTrue(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testReplaceItemInList(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - } - - public void testSetItemsInList() { - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testSetItemsInList(); - this.verifyListReplaceEvent(1, "xxx", "bar"); - assertTrue(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testSetItemsInList(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testSetItemsInList(); - this.verifyListReplaceEvent(1, "xxx", "bar"); - assertTrue(this.itemsReplacedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testSetItemsInList(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - } - - public void testMoveItemsInList() { - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testMoveItemsInList(); - this.verifyListMoveEvent(2, 4, 2); - assertTrue(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testMoveItemsInList(); - assertNull(this.listEvent); - assertFalse(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testMoveItemsInList(); - this.verifyListMoveEvent(2, 4, 2); - assertTrue(this.itemsMovedListCalled); - - this.listEvent = null; - this.itemsMovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testMoveItemsInList(); - assertNull(this.listEvent); - assertFalse(this.itemsMovedListCalled); - } - - public void testClearList() { - this.listEvent = null; - this.listClearedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testClearList(); - this.verifyListClearEvent(); - assertTrue(this.listClearedCalled); - - this.listEvent = null; - this.listClearedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testClearList(); - assertNull(this.listEvent); - assertFalse(this.listClearedCalled); - - this.listEvent = null; - this.listClearedCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testClearList(); - this.verifyListClearEvent(); - assertTrue(this.listClearedCalled); - - this.listEvent = null; - this.listClearedCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testClearList(); - assertNull(this.listEvent); - assertFalse(this.listClearedCalled); - } - - public void testSynchronizeList() { - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.itemsRemovedListCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testSynchronizeList(); - assertNotNull(this.listEvent); - assertTrue(this.itemsReplacedListCalled); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.itemsRemovedListCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testSynchronizeList(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - assertFalse(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.itemsRemovedListCalled = false; - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testSynchronizeList(); - assertNotNull(this.listEvent); - assertTrue(this.itemsReplacedListCalled); - assertTrue(this.itemsRemovedListCalled); - - this.listEvent = null; - this.itemsReplacedListCalled = false; - this.itemsRemovedListCalled = false; - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - this.testModel.testSynchronizeList(); - assertNull(this.listEvent); - assertFalse(this.itemsReplacedListCalled); - assertFalse(this.itemsRemovedListCalled); - } - - public void testHasAnyListChangeListeners() { - assertTrue(this.testModel.hasNoListChangeListeners(LIST_NAME)); - this.testModel.addChangeListener(this.changeListener); - assertTrue(this.testModel.hasAnyListChangeListeners(LIST_NAME)); - this.testModel.removeChangeListener(this.changeListener); - assertTrue(this.testModel.hasNoListChangeListeners(LIST_NAME)); - - assertTrue(this.testModel.hasNoListChangeListeners(LIST_NAME)); - this.testModel.addListChangeListener(LIST_NAME, this.changeListener); - assertTrue(this.testModel.hasAnyListChangeListeners(LIST_NAME)); - this.testModel.removeListChangeListener(LIST_NAME, this.changeListener); - assertTrue(this.testModel.hasNoListChangeListeners(LIST_NAME)); - } - - public void testAddNullListListener() { - boolean exCaught = false; - try { - this.testModel.addListChangeListener("foo", null); - } catch (NullPointerException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testRemoveBogusListListener() { - boolean exCaught = false; - try { - this.testModel.removeListChangeListener("foo", this.changeListener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - this.testModel.addPropertyChangeListener("foo", this.changeListener); - exCaught = false; - try { - this.testModel.removeListChangeListener("foo", this.changeListener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - this.testModel.addListChangeListener("foo", this.changeListener); - exCaught = false; - try { - this.testModel.removeListChangeListener("foo", new ListChangeAdapter()); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - exCaught = false; - try { - this.testModel.removeListChangeListener("foo", new ListChangeAdapter()); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - private void verifyListAddEvent(int index, Object item) { - assertNotNull(this.listEvent); - assertEquals(this.testModel, this.listEvent.getSource()); - assertEquals(LIST_NAME, this.listEvent.getListName()); - assertEquals(index, ((ListAddEvent) this.listEvent).getIndex()); - assertEquals(item, ((ListAddEvent) this.listEvent).getItems().iterator().next()); - } - - private void verifyListRemoveEvent(int index, Object item) { - assertNotNull(this.listEvent); - assertEquals(this.testModel, this.listEvent.getSource()); - assertEquals(LIST_NAME, this.listEvent.getListName()); - assertEquals(index, ((ListRemoveEvent) this.listEvent).getIndex()); - assertEquals(item, ((ListRemoveEvent) this.listEvent).getItems().iterator().next()); - } - - private void verifyListReplaceEvent(int index, Object newItem, Object oldItem) { - assertNotNull(this.listEvent); - assertEquals(this.testModel, this.listEvent.getSource()); - assertEquals(LIST_NAME, this.listEvent.getListName()); - assertEquals(index, ((ListReplaceEvent) this.listEvent).getIndex()); - assertEquals(newItem, ((ListReplaceEvent) this.listEvent).getNewItems().iterator().next()); - assertEquals(oldItem, ((ListReplaceEvent) this.listEvent).getOldItems().iterator().next()); - } - - private void verifyListMoveEvent(int targetIndex, int sourceIndex) { - this.verifyListMoveEvent(targetIndex, sourceIndex, 1); - } - - private void verifyListMoveEvent(int targetIndex, int sourceIndex, int length) { - assertNotNull(this.listEvent); - assertEquals(this.testModel, this.listEvent.getSource()); - assertEquals(LIST_NAME, this.listEvent.getListName()); - assertEquals(targetIndex, ((ListMoveEvent) this.listEvent).getTargetIndex()); - assertEquals(sourceIndex, ((ListMoveEvent) this.listEvent).getSourceIndex()); - assertEquals(length, ((ListMoveEvent) this.listEvent).getLength()); - } - - private void verifyListClearEvent() { - assertNotNull(this.listEvent); - assertEquals(this.testModel, this.listEvent.getSource()); - assertEquals(LIST_NAME, this.listEvent.getListName()); - assertEquals(ListClearEvent.class, this.listEvent.getClass()); - } - - private void verifyListChangeEvent() { - assertNotNull(this.listEvent); - assertEquals(this.testModel, this.listEvent.getSource()); - assertEquals(LIST_NAME, this.listEvent.getListName()); - assertEquals(ListChangeEvent.class, this.listEvent.getClass()); - } - - - // ********** tree change tests ********** - - public void testFireNodeAddedTree() { - this.treeEvent = null; - this.nodeAddedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireNodeAddedTree(); - this.verifyTreeEvent(OBJECT_PATH); - assertTrue(this.nodeAddedCalled); - - this.treeEvent = null; - this.nodeAddedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireNodeAddedTree(); - assertNull(this.treeEvent); - assertFalse(this.nodeAddedCalled); - - this.treeEvent = null; - this.nodeAddedCalled = false; - this.testModel.addTreeChangeListener(TREE_NAME, this.changeListener); - this.testModel.testFireNodeAddedTree(); - this.verifyTreeEvent(OBJECT_PATH); - assertTrue(this.nodeAddedCalled); - - this.treeEvent = null; - this.nodeAddedCalled = false; - this.testModel.removeTreeChangeListener(TREE_NAME, this.changeListener); - this.testModel.testFireNodeAddedTree(); - assertNull(this.treeEvent); - assertFalse(this.nodeAddedCalled); - } - - public void testFireNodeAddedTreeEvent() { - this.treeEvent = null; - this.nodeAddedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireNodeAddedTreeEvent(); - this.verifyTreeEvent(OBJECT_PATH); - assertTrue(this.nodeAddedCalled); - - this.treeEvent = null; - this.nodeAddedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireNodeAddedTreeEvent(); - assertNull(this.treeEvent); - assertFalse(this.nodeAddedCalled); - - this.treeEvent = null; - this.nodeAddedCalled = false; - this.testModel.addTreeChangeListener(TREE_NAME, this.changeListener); - this.testModel.testFireNodeAddedTreeEvent(); - this.verifyTreeEvent(OBJECT_PATH); - assertTrue(this.nodeAddedCalled); - - this.treeEvent = null; - this.nodeAddedCalled = false; - this.testModel.removeTreeChangeListener(TREE_NAME, this.changeListener); - this.testModel.testFireNodeAddedTreeEvent(); - assertNull(this.treeEvent); - assertFalse(this.nodeAddedCalled); - } - - public void testFireNodeRemovedTreeEvent() { - this.treeEvent = null; - this.nodeRemovedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireNodeRemovedTreeEvent(); - this.verifyTreeEvent(OBJECT_PATH); - assertTrue(this.nodeRemovedCalled); - - this.treeEvent = null; - this.nodeRemovedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireNodeRemovedTreeEvent(); - assertNull(this.treeEvent); - assertFalse(this.nodeRemovedCalled); - - this.treeEvent = null; - this.nodeRemovedCalled = false; - this.testModel.addTreeChangeListener(TREE_NAME, this.changeListener); - this.testModel.testFireNodeRemovedTreeEvent(); - this.verifyTreeEvent(OBJECT_PATH); - assertTrue(this.nodeRemovedCalled); - - this.treeEvent = null; - this.nodeRemovedCalled = false; - this.testModel.removeTreeChangeListener(TREE_NAME, this.changeListener); - this.testModel.testFireNodeRemovedTreeEvent(); - assertNull(this.treeEvent); - assertFalse(this.nodeRemovedCalled); - } - - public void testFireNodeRemovedTree() { - this.treeEvent = null; - this.nodeRemovedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireNodeRemovedTree(); - this.verifyTreeEvent(OBJECT_PATH); - assertTrue(this.nodeRemovedCalled); - - this.treeEvent = null; - this.nodeRemovedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireNodeRemovedTree(); - assertNull(this.treeEvent); - assertFalse(this.nodeRemovedCalled); - - this.treeEvent = null; - this.nodeRemovedCalled = false; - this.testModel.addTreeChangeListener(TREE_NAME, this.changeListener); - this.testModel.testFireNodeRemovedTree(); - this.verifyTreeEvent(OBJECT_PATH); - assertTrue(this.nodeRemovedCalled); - - this.treeEvent = null; - this.nodeRemovedCalled = false; - this.testModel.removeTreeChangeListener(TREE_NAME, this.changeListener); - this.testModel.testFireNodeRemovedTree(); - assertNull(this.treeEvent); - assertFalse(this.nodeRemovedCalled); - } - - public void testFireTreeClearedEvent() { - this.treeEvent = null; - this.treeClearedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireTreeClearedEvent(); - this.verifyTreeEvent(null); - assertTrue(this.treeClearedCalled); - - this.treeEvent = null; - this.treeClearedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireTreeClearedEvent(); - assertNull(this.treeEvent); - assertFalse(this.treeClearedCalled); - - this.treeEvent = null; - this.treeClearedCalled = false; - this.testModel.addTreeChangeListener(TREE_NAME, this.changeListener); - this.testModel.testFireTreeClearedEvent(); - this.verifyTreeEvent(null); - assertTrue(this.treeClearedCalled); - - this.treeEvent = null; - this.treeClearedCalled = false; - this.testModel.removeTreeChangeListener(TREE_NAME, this.changeListener); - this.testModel.testFireTreeClearedEvent(); - assertNull(this.treeEvent); - assertFalse(this.treeClearedCalled); - } - - public void testFireTreeCleared() { - this.treeEvent = null; - this.treeClearedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireTreeCleared(); - this.verifyTreeEvent(null); - assertTrue(this.treeClearedCalled); - - this.treeEvent = null; - this.treeClearedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireTreeCleared(); - assertNull(this.treeEvent); - assertFalse(this.treeClearedCalled); - - this.treeEvent = null; - this.treeClearedCalled = false; - this.testModel.addTreeChangeListener(TREE_NAME, this.changeListener); - this.testModel.testFireTreeCleared(); - this.verifyTreeEvent(null); - assertTrue(this.treeClearedCalled); - - this.treeEvent = null; - this.treeClearedCalled = false; - this.testModel.removeTreeChangeListener(TREE_NAME, this.changeListener); - this.testModel.testFireTreeCleared(); - assertNull(this.treeEvent); - assertFalse(this.treeClearedCalled); - } - - public void testFireTreeChangedEvent() { - this.treeEvent = null; - this.treeChangedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireTreeChangedEvent(); - this.verifyTreeEvent(null); - assertTrue(this.treeChangedCalled); - - this.treeEvent = null; - this.treeChangedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireTreeChangedEvent(); - assertNull(this.treeEvent); - assertFalse(this.treeChangedCalled); - - this.treeEvent = null; - this.treeChangedCalled = false; - this.testModel.addTreeChangeListener(TREE_NAME, this.changeListener); - this.testModel.testFireTreeChangedEvent(); - this.verifyTreeEvent(null); - assertTrue(this.treeChangedCalled); - - this.treeEvent = null; - this.treeChangedCalled = false; - this.testModel.removeTreeChangeListener(TREE_NAME, this.changeListener); - this.testModel.testFireTreeChangedEvent(); - assertNull(this.treeEvent); - assertFalse(this.treeChangedCalled); - } - - public void testFireTreeChanged() { - this.treeEvent = null; - this.treeChangedCalled = false; - this.testModel.addChangeListener(this.changeListener); - this.testModel.testFireTreeChanged(); - this.verifyTreeEvent(null); - assertTrue(this.treeChangedCalled); - - this.treeEvent = null; - this.treeChangedCalled = false; - this.testModel.removeChangeListener(this.changeListener); - this.testModel.testFireTreeChanged(); - assertNull(this.treeEvent); - assertFalse(this.treeChangedCalled); - - this.treeEvent = null; - this.treeChangedCalled = false; - this.testModel.addTreeChangeListener(TREE_NAME, this.changeListener); - this.testModel.testFireTreeChanged(); - this.verifyTreeEvent(null); - assertTrue(this.treeChangedCalled); - - this.treeEvent = null; - this.treeChangedCalled = false; - this.testModel.removeTreeChangeListener(TREE_NAME, this.changeListener); - this.testModel.testFireTreeChanged(); - assertNull(this.treeEvent); - assertFalse(this.treeChangedCalled); - } - - public void testHasAnyTreeChangeListeners() { - assertTrue(this.testModel.hasNoTreeChangeListeners(TREE_NAME)); - this.testModel.addChangeListener(this.changeListener); - assertTrue(this.testModel.hasAnyTreeChangeListeners(TREE_NAME)); - this.testModel.removeChangeListener(this.changeListener); - assertTrue(this.testModel.hasNoTreeChangeListeners(TREE_NAME)); - - assertTrue(this.testModel.hasNoTreeChangeListeners(TREE_NAME)); - this.testModel.addTreeChangeListener(TREE_NAME, this.changeListener); - assertTrue(this.testModel.hasAnyTreeChangeListeners(TREE_NAME)); - this.testModel.removeTreeChangeListener(TREE_NAME, this.changeListener); - assertTrue(this.testModel.hasNoTreeChangeListeners(TREE_NAME)); - } - - public void testAddNullTreeListener() { - boolean exCaught = false; - try { - this.testModel.addTreeChangeListener("foo", null); - } catch (NullPointerException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testRemoveBogusTreeListener() { - boolean exCaught = false; - try { - this.testModel.removeTreeChangeListener("foo", this.changeListener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - this.testModel.addPropertyChangeListener("foo", this.changeListener); - exCaught = false; - try { - this.testModel.removeTreeChangeListener("foo", this.changeListener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - this.testModel.addTreeChangeListener("foo", this.changeListener); - exCaught = false; - try { - this.testModel.removeTreeChangeListener("foo", new TreeChangeAdapter()); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - - exCaught = false; - try { - this.testModel.removeTreeChangeListener("foo", new TreeChangeAdapter()); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - private void verifyTreeEvent(List path) { - assertNotNull(this.treeEvent); - assertEquals(this.testModel, this.treeEvent.getSource()); - assertEquals(TREE_NAME, this.treeEvent.getTreeName()); - assertEquals(path, this.getListPath()); - } - - private List getListPath() { - Iterable iterable = this.getPath(); - return (iterable == null) ? null : CollectionTools.list(iterable); - } - - private Iterable getPath() { - if (this.treeEvent instanceof TreeAddEvent) { - return ((TreeAddEvent) this.treeEvent).getPath(); - } - if (this.treeEvent instanceof TreeRemoveEvent) { - return ((TreeRemoveEvent) this.treeEvent).getPath(); - } - return null; - } - - - - // ********** convenience method tests ********** - - public void testElementsAreEqual() { - Collection c1 = new ArrayList(); - c1.add("foo"); - c1.add("bar"); - c1.add("baz"); - Collection c2 = new ArrayList(); - c2.add("foo"); - c2.add("bar"); - c2.add("baz"); - assertTrue(this.testModel.testElementsAreEqual(c1, c2)); - } - - public void testElementsAreDifferent() { - Collection c1 = new ArrayList(); - c1.add("foo"); - c1.add("bar"); - c1.add("baz"); - Collection c2 = new ArrayList(); - c2.add("baz"); - c2.add("bar"); - c2.add("foo"); - assertTrue(this.testModel.testElementsAreDifferent(c1, c2)); - } - - - // ********** AbstractModel tests ********** - - public void testAbstractModelValuesAreEqual1() { - assertTrue(this.testModel.testValuesAreEqual(null, null)); - } - - public void testAbstractModelValuesAreEqual2() { - assertTrue(this.testModel.testValuesAreEqual("foo", "foo")); - } - - public void testAbstractModelValuesAreEqual3() { - assertFalse(this.testModel.testValuesAreEqual("foo", null)); - } - - public void testAbstractModelValuesAreEqual4() { - assertFalse(this.testModel.testValuesAreEqual(null, "foo")); - } - - public void testAbstractModelValuesAreEqual5() { - assertFalse(this.testModel.testValuesAreEqual("bar", "foo")); - } - - public void testAbstractModelValuesAreDifferent1() { - assertFalse(this.testModel.testValuesAreDifferent(null, null)); - } - - public void testAbstractModelValuesAreDifferent2() { - assertFalse(this.testModel.testValuesAreDifferent("foo", "foo")); - } - - public void testAbstractModelValuesAreDifferent3() { - assertTrue(this.testModel.testValuesAreDifferent("foo", null)); - } - - public void testAbstractModelValuesAreDifferent4() { - assertTrue(this.testModel.testValuesAreDifferent(null, "foo")); - } - - public void testAbstractModelValuesAreDifferent5() { - assertTrue(this.testModel.testValuesAreDifferent("bar", "foo")); - } - - public void testAbstractModelAttributeValueHasChanged1() { - assertFalse(this.testModel.testAttributeValueHasChanged(null, null)); - } - - public void testAbstractModelAttributeValueHasChanged2() { - assertFalse(this.testModel.testAttributeValueHasChanged("foo", "foo")); - } - - public void testAbstractModelAttributeValueHasChanged3() { - assertTrue(this.testModel.testAttributeValueHasChanged("foo", null)); - } - - public void testAbstractModelAttributeValueHasChanged4() { - assertTrue(this.testModel.testAttributeValueHasChanged(null, "foo")); - } - - public void testAbstractModelAttributeValueHasChanged5() { - assertTrue(this.testModel.testAttributeValueHasChanged("bar", "foo")); - } - - public void testAbstractModelAttributeValueHasNotChanged1() { - assertTrue(this.testModel.testAttributeValueHasNotChanged(null, null)); - } - - public void testAbstractModelAttributeValueHasNotChanged2() { - assertTrue(this.testModel.testAttributeValueHasNotChanged("foo", "foo")); - } - - public void testAbstractModelAttributeValueHasNotChanged3() { - assertFalse(this.testModel.testAttributeValueHasNotChanged("foo", null)); - } - - public void testAbstractModelAttributeValueHasNotChanged4() { - assertFalse(this.testModel.testAttributeValueHasNotChanged(null, "foo")); - } - - public void testAbstractModelAttributeValueHasNotChanged5() { - assertFalse(this.testModel.testAttributeValueHasNotChanged("bar", "foo")); - } - - public void testAbstractModelClone() { - assertFalse(this.testModel.hasAnyPropertyChangeListeners(PROPERTY_NAME)); - this.testModel.addChangeListener(this.changeListener); - assertTrue(this.testModel.hasAnyPropertyChangeListeners(PROPERTY_NAME)); - - // verify that the clone does not have any listeners - TestModel clone = this.testModel.clone(); - assertFalse(clone.hasAnyPropertyChangeListeners(PROPERTY_NAME)); - clone.addChangeListener(this.changeListener); - assertTrue(clone.hasAnyPropertyChangeListeners(PROPERTY_NAME)); - // check original - assertTrue(this.testModel.hasAnyPropertyChangeListeners(PROPERTY_NAME)); - - // now test events fired by original - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - this.testModel.testFirePropertyChangedObjectObject(); - this.verifyPropertyChangeEvent(OLD_OBJECT_VALUE, NEW_OBJECT_VALUE); - assertTrue(this.propertyChangeCalled); - - // now test events fired by clone - this.propertyChangeEvent = null; - this.propertyChangeCalled = false; - clone.testFirePropertyChangedObjectObject(); - this.verifyPropertyChangeEvent(clone, OLD_OBJECT_VALUE, NEW_OBJECT_VALUE); - assertTrue(this.propertyChangeCalled); - } - - public void testAbstractModelToString() { - assertTrue(this.testModel.toString().contains('(' + TEST_TO_STRING + ')')); - } - - - // ********** listener implementations ********** - - class Adapter implements ChangeListener { - public void stateChanged(StateChangeEvent e) { - ChangeSupportTests.this.stateChangedCalled = true; - ChangeSupportTests.this.stateChangeEvent = e; - } - - public void propertyChanged(PropertyChangeEvent e) { - ChangeSupportTests.this.propertyChangeCalled = true; - ChangeSupportTests.this.propertyChangeEvent = e; - } - - - public void itemsAdded(CollectionAddEvent e) { - ChangeSupportTests.this.itemsAddedCollectionCalled = true; - ChangeSupportTests.this.collectionEvent = e; - } - public void itemsRemoved(CollectionRemoveEvent e) { - ChangeSupportTests.this.itemsRemovedCollectionCalled = true; - ChangeSupportTests.this.collectionEvent = e; - } - public void collectionCleared(CollectionClearEvent e) { - ChangeSupportTests.this.collectionClearedCalled = true; - ChangeSupportTests.this.collectionEvent = e; - } - public void collectionChanged(CollectionChangeEvent e) { - ChangeSupportTests.this.collectionChangedCalled = true; - ChangeSupportTests.this.collectionEvent = e; - } - - public void itemsAdded(ListAddEvent e) { - ChangeSupportTests.this.itemsAddedListCalled = true; - ChangeSupportTests.this.listEvent = e; - } - public void itemsRemoved(ListRemoveEvent e) { - ChangeSupportTests.this.itemsRemovedListCalled = true; - ChangeSupportTests.this.listEvent = e; - } - public void itemsReplaced(ListReplaceEvent e) { - ChangeSupportTests.this.itemsReplacedListCalled = true; - ChangeSupportTests.this.listEvent = e; - } - public void itemsMoved(ListMoveEvent e) { - ChangeSupportTests.this.itemsMovedListCalled = true; - ChangeSupportTests.this.listEvent = e; - } - public void listCleared(ListClearEvent e) { - ChangeSupportTests.this.listClearedCalled = true; - ChangeSupportTests.this.listEvent = e; - } - public void listChanged(ListChangeEvent e) { - ChangeSupportTests.this.listChangedCalled = true; - ChangeSupportTests.this.listEvent = e; - } - - public void nodeAdded(TreeAddEvent e) { - ChangeSupportTests.this.nodeAddedCalled = true; - ChangeSupportTests.this.treeEvent = e; - } - public void nodeRemoved(TreeRemoveEvent e) { - ChangeSupportTests.this.nodeRemovedCalled = true; - ChangeSupportTests.this.treeEvent = e; - } - public void treeCleared(TreeClearEvent e) { - ChangeSupportTests.this.treeClearedCalled = true; - ChangeSupportTests.this.treeEvent = e; - } - public void treeChanged(TreeChangeEvent e) { - ChangeSupportTests.this.treeChangedCalled = true; - ChangeSupportTests.this.treeEvent = e; - } - } - - - // ********** inner class ********** - - private static class TestModel extends AbstractModel implements Cloneable { - TestModel() { - super(); - } - - // ***** state - public void testFireStateChange() { - this.fireStateChanged(); - } - - // ***** property - public void testFirePropertyChangedEvent() { - this.firePropertyChanged(new PropertyChangeEvent(this, PROPERTY_NAME, OLD_OBJECT_VALUE, NEW_OBJECT_VALUE)); - } - - public void testFirePropertyChangedEventNoChange() { - this.firePropertyChanged(new PropertyChangeEvent(this, PROPERTY_NAME, OLD_OBJECT_VALUE, OLD_OBJECT_VALUE)); - } - - public void testFirePropertyChangedObjectObject() { - this.firePropertyChanged(PROPERTY_NAME, OLD_OBJECT_VALUE, NEW_OBJECT_VALUE); - } - - public void testFirePropertyChangedObjectObjectNoChange() { - this.firePropertyChanged(PROPERTY_NAME, OLD_OBJECT_VALUE, OLD_OBJECT_VALUE); - } - - public void testFirePropertyChangedObject() { - this.firePropertyChanged(PROPERTY_NAME, NEW_OBJECT_VALUE); - } - - public void testFirePropertyChangedObjectNoChange() { - this.firePropertyChanged(PROPERTY_NAME, null); - } - - public void testFirePropertyChangedIntInt() { - this.firePropertyChanged(PROPERTY_NAME, OLD_INT_VALUE.intValue(), NEW_INT_VALUE.intValue()); - } - - public void testFirePropertyChangedIntIntNoChange() { - this.firePropertyChanged(PROPERTY_NAME, OLD_INT_VALUE.intValue(), OLD_INT_VALUE.intValue()); - } - - public void testFirePropertyChangedBooleanBoolean() { - this.firePropertyChanged(PROPERTY_NAME, OLD_BOOLEAN_VALUE.booleanValue(), NEW_BOOLEAN_VALUE.booleanValue()); - } - - public void testFirePropertyChangedBooleanBooleanNoChange() { - this.firePropertyChanged(PROPERTY_NAME, OLD_BOOLEAN_VALUE.booleanValue(), OLD_BOOLEAN_VALUE.booleanValue()); - } - - // ***** collection - public void testFireItemsAddedCollectionEvent() { - this.fireItemsAdded(new CollectionAddEvent(this, COLLECTION_NAME, ADDED_OBJECT_VALUE)); - } - - public void testFireItemsAddedCollectionEventNoChange() { - this.fireItemsAdded(new CollectionAddEvent(this, COLLECTION_NAME, Collections.emptySet())); - } - - public void testFireItemsAddedCollection() { - this.fireItemsAdded(COLLECTION_NAME, Collections.singleton(ADDED_OBJECT_VALUE)); - } - - public void testFireItemsAddedCollectionNoChange() { - this.fireItemsAdded(COLLECTION_NAME, Collections.emptySet()); - } - - public void testFireItemAddedCollection() { - this.fireItemAdded(COLLECTION_NAME, ADDED_OBJECT_VALUE); - } - - public void testFireItemsRemovedCollectionEvent() { - this.fireItemsRemoved(new CollectionRemoveEvent(this, COLLECTION_NAME, REMOVED_OBJECT_VALUE)); - } - - public void testFireItemsRemovedCollectionEventNoChange() { - this.fireItemsRemoved(new CollectionRemoveEvent(this, COLLECTION_NAME, Collections.emptySet())); - } - - public void testFireItemsRemovedCollection() { - this.fireItemsRemoved(COLLECTION_NAME, Collections.singleton(REMOVED_OBJECT_VALUE)); - } - - public void testFireItemsRemovedCollectionNoChange() { - this.fireItemsRemoved(COLLECTION_NAME, Collections.emptySet()); - } - - public void testFireItemRemovedCollection() { - this.fireItemRemoved(COLLECTION_NAME, REMOVED_OBJECT_VALUE); - } - - public void testFireCollectionCleared() { - this.fireCollectionCleared(COLLECTION_NAME); - } - - public void testFireCollectionChangedEvent() { - this.fireCollectionChanged(new CollectionChangeEvent(this, COLLECTION_NAME, Collections.emptySet())); - } - - public void testFireCollectionChanged() { - this.fireCollectionChanged(COLLECTION_NAME, Collections.emptySet()); - } - - public boolean testAddItemToCollection() { - return this.addItemToCollection(ADDED_OBJECT_VALUE, new ArrayList(), COLLECTION_NAME); - } - - public boolean testAddItemToCollectionNoChange() { - Collection collection = new HashSet(); - collection.add(ADDED_OBJECT_VALUE); - return this.addItemToCollection(ADDED_OBJECT_VALUE, collection, COLLECTION_NAME); - } - - public boolean testAddItemsToCollection() { - return this.addItemsToCollection(Collections.singleton(ADDED_OBJECT_VALUE), new ArrayList(), COLLECTION_NAME); - } - - public boolean testAddItemsToCollectionNoChange() { - Collection collection = new HashSet(); - collection.add(ADDED_OBJECT_VALUE); - return this.addItemsToCollection(Collections.singleton(ADDED_OBJECT_VALUE), collection, COLLECTION_NAME); - } - - public boolean testAddItemsToCollectionMixed() { - Collection collection = new HashSet(); - collection.add(ADDED_OBJECT_VALUE); - return this.addItemsToCollection(new Object[] {ADDED_OBJECT_VALUE, ADDED_OBJECT_VALUE_2}, collection, COLLECTION_NAME); - } - - public boolean testRemoveItemFromCollection() { - Collection collection = new HashSet(); - collection.add(REMOVED_OBJECT_VALUE); - return this.removeItemFromCollection(REMOVED_OBJECT_VALUE, collection, COLLECTION_NAME); - } - - public boolean testRemoveItemFromCollectionNoChange() { - Collection collection = new HashSet(); - collection.add(REMOVED_OBJECT_VALUE); - return this.removeItemFromCollection("foo", collection, COLLECTION_NAME); - } - - public boolean testRemoveItemsFromCollection() { - Collection collection = new HashSet(); - collection.add(REMOVED_OBJECT_VALUE); - collection.add("foo"); - collection.add("bar"); - return this.removeItemsFromCollection(new Object[] {"foo", "bar", REMOVED_OBJECT_VALUE}, collection, COLLECTION_NAME); - } - - public boolean testRemoveItemsFromCollectionNoChange1() { - Collection collection = new HashSet(); - collection.add(REMOVED_OBJECT_VALUE); - return this.removeItemsFromCollection(Collections.emptySet(), collection, COLLECTION_NAME); - } - - public boolean testRemoveItemsFromCollectionNoChange2() { - Collection collection = new HashSet(); - return this.removeItemsFromCollection(Collections.singleton("foo"), collection, COLLECTION_NAME); - } - - public boolean testRemoveItemsFromCollectionNoChange3() { - Collection collection = new HashSet(); - collection.add(REMOVED_OBJECT_VALUE); - return this.removeItemsFromCollection(Collections.singleton("foo"), collection, COLLECTION_NAME); - } - - public boolean testRetainItemsInCollection1() { - Collection collection = new HashSet(); - collection.add(REMOVED_OBJECT_VALUE); - collection.add("foo"); - collection.add("bar"); - return this.retainItemsInCollection(new Object[] {"foo", "bar"}, collection, COLLECTION_NAME); - } - - public boolean testRetainItemsInCollection2() { - Collection collection = new HashSet(); - collection.add(REMOVED_OBJECT_VALUE); - collection.add("foo"); - collection.add("bar"); - return this.retainItemsInCollection(Collections.emptySet(), collection, COLLECTION_NAME); - } - - public boolean testRetainItemsInCollectionNoChange1() { - Collection collection = new HashSet(); - return this.retainItemsInCollection(new Object[] {"foo", "bar"}, collection, COLLECTION_NAME); - } - - public boolean testRetainItemsInCollectionNoChange2() { - Collection collection = new HashSet(); - collection.add(REMOVED_OBJECT_VALUE); - collection.add("foo"); - collection.add("bar"); - return this.retainItemsInCollection(new Object[] {"foo", "bar", REMOVED_OBJECT_VALUE}, collection, COLLECTION_NAME); - } - - public boolean testClearCollection() { - Collection collection = new HashSet(); - collection.add(REMOVED_OBJECT_VALUE); - collection.add("foo"); - collection.add("bar"); - return this.clearCollection(collection, COLLECTION_NAME); - } - - public boolean testClearCollectionNoChange() { - Collection collection = new HashSet(); - return this.clearCollection(collection, COLLECTION_NAME); - } - - public boolean testSynchronizeCollection1() { - Collection collection = new HashSet(); - collection.add("foo"); - collection.add("bar"); - collection.add("baz"); - Collection newCollection = new HashSet(); - newCollection.add("joo"); - newCollection.add("jar"); - newCollection.add("baz"); - boolean result = this.synchronizeCollection(newCollection, collection, COLLECTION_NAME); - assertEquals(newCollection, collection); - return result; - } - - public boolean testSynchronizeCollection2() { - Collection collection = new HashSet(); - collection.add("foo"); - collection.add("bar"); - collection.add("baz"); - Collection newCollection = new HashSet(); - boolean result = this.synchronizeCollection(newCollection, collection, COLLECTION_NAME); - assertEquals(newCollection, collection); - return result; - } - - public boolean testSynchronizeCollection3() { - Collection collection = new HashSet(); - Collection newCollection = new HashSet(); - newCollection.add("joo"); - newCollection.add("jar"); - newCollection.add("baz"); - boolean result = this.synchronizeCollection(newCollection, collection, COLLECTION_NAME); - assertEquals(newCollection, collection); - return result; - } - - // ***** list - public void testFireItemsAddedListEvent() { - this.fireItemsAdded(new ListAddEvent(this, LIST_NAME, ADD_INDEX, ADDED_OBJECT_VALUE)); - } - - public void testFireItemsAddedListEventNoChange() { - this.fireItemsAdded(new ListAddEvent(this, LIST_NAME, ADD_INDEX, Collections.emptyList())); - } - - public void testFireItemsAddedList() { - this.fireItemsAdded(LIST_NAME, ADD_INDEX, Collections.singletonList(ADDED_OBJECT_VALUE)); - } - - public void testFireItemsAddedListNoChange() { - this.fireItemsAdded(LIST_NAME, ADD_INDEX, Collections.emptyList()); - } - - public void testFireItemAddedList() { - this.fireItemAdded(LIST_NAME, ADD_INDEX, ADDED_OBJECT_VALUE); - } - - public void testFireItemsRemovedListEvent() { - this.fireItemsRemoved(new ListRemoveEvent(this, LIST_NAME, REMOVE_INDEX, REMOVED_OBJECT_VALUE)); - } - - public void testFireItemsRemovedListEventNoChange() { - this.fireItemsRemoved(new ListRemoveEvent(this, LIST_NAME, REMOVE_INDEX, Collections.emptyList())); - } - - public void testFireItemsRemovedList() { - this.fireItemsRemoved(LIST_NAME, REMOVE_INDEX, Collections.singletonList(REMOVED_OBJECT_VALUE)); - } - - public void testFireItemsRemovedListNoChange() { - this.fireItemsRemoved(LIST_NAME, REMOVE_INDEX, Collections.emptyList()); - } - - public void testFireItemRemovedList() { - this.fireItemRemoved(LIST_NAME, REMOVE_INDEX, REMOVED_OBJECT_VALUE); - } - - public void testFireItemsReplacedListEvent() { - this.fireItemsReplaced(new ListReplaceEvent(this, LIST_NAME, REPLACE_INDEX, ADDED_OBJECT_VALUE, REMOVED_OBJECT_VALUE)); - } - - public void testFireItemsReplacedListEventNoChange() { - this.fireItemsReplaced(new ListReplaceEvent(this, LIST_NAME, REPLACE_INDEX, Collections.emptyList(), Collections.emptyList())); - } - - public void testFireItemsReplacedList() { - this.fireItemsReplaced(LIST_NAME, REPLACE_INDEX, Collections.singletonList(ADDED_OBJECT_VALUE), Collections.singletonList(REMOVED_OBJECT_VALUE)); - } - - public void testFireItemsReplacedListNoChange() { - this.fireItemsReplaced(LIST_NAME, REPLACE_INDEX, Collections.emptyList(), Collections.emptyList()); - } - - public void testFireItemReplacedList() { - this.fireItemReplaced(LIST_NAME, REPLACE_INDEX, ADDED_OBJECT_VALUE, REMOVED_OBJECT_VALUE); - } - - public void testFireItemsMovedListEvent() { - this.fireItemsMoved(new ListMoveEvent(this, LIST_NAME, TARGET_INDEX, SOURCE_INDEX, 1)); - } - - public void testFireItemsMovedListEventNoChange() { - this.fireItemsMoved(new ListMoveEvent(this, LIST_NAME, SOURCE_INDEX, SOURCE_INDEX, 1)); - } - - public void testFireItemsMovedList() { - this.fireItemsMoved(LIST_NAME, TARGET_INDEX, SOURCE_INDEX, 1); - } - - public void testFireItemsMovedListNoChange() { - this.fireItemsMoved(LIST_NAME, SOURCE_INDEX, SOURCE_INDEX, 1); - } - - public void testFireItemMovedList() { - this.fireItemMoved(LIST_NAME, TARGET_INDEX, SOURCE_INDEX); - } - - public void testFireListClearedEvent() { - this.fireListCleared(new ListClearEvent(this, LIST_NAME)); - } - - public void testFireListCleared() { - this.fireListCleared(LIST_NAME); - } - - public void testFireListChangedEvent() { - this.fireListChanged(new ListChangeEvent(this, LIST_NAME, Collections.emptyList())); - } - - public void testFireListChanged() { - this.fireListChanged(LIST_NAME, Collections.emptyList()); - } - - public void testAddItemToListIndex() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - this.addItemToList(2, "joo", list, LIST_NAME); - } - - public void testAddItemToList() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - this.addItemToList("joo", list, LIST_NAME); - } - - public void testAddItemsToListIndex() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - this.addItemsToList(2, Collections.singletonList("joo"), list, LIST_NAME); - } - - public void testAddItemsToListIndexNoChange() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - this.addItemsToList(2, Collections.emptyList(), list, LIST_NAME); - } - - public void testAddItemsToList() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - this.addItemsToList(Collections.singletonList("joo"), list, LIST_NAME); - } - - public void testAddItemsToListNoChange() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - this.addItemsToList(Collections.emptyList(), list, LIST_NAME); - } - - public void testRemoveItemFromListIndex() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - this.removeItemFromList(1, list, LIST_NAME); - } - - public void testRemoveItemFromList() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - this.removeItemFromList("bar", list, LIST_NAME); - } - - public void testRemoveItemsFromListIndex() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - this.removeItemsFromList(1, 1, list, LIST_NAME); - } - - public void testRemoveItemsFromListIndexNoChange() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - this.removeItemsFromList(2, 0, list, LIST_NAME); - } - - public void testRemoveItemsFromList() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - this.removeItemsFromList(Collections.singletonList("bar"), list, LIST_NAME); - } - - public void testRemoveItemsFromListNoChange() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - this.addItemsToList(Collections.emptyList(), list, LIST_NAME); - } - - public void testRetainItemsInList() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - this.retainItemsInList(new String[] {"bar", "baz"}, list, LIST_NAME); - } - - public void testReplaceItemInList() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - this.replaceItemInList("bar", "xxx", list, LIST_NAME); - } - - public void testSetItemsInList() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - this.setItemsInList(1, new String[] {"xxx"}, list, LIST_NAME); - } - - public void testMoveItemsInList() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - list.add("xxx"); - list.add("yyy"); - list.add("zzz"); - this.moveItemsInList(2, 4, 2, list, LIST_NAME); - } - - public void testClearList() { - List list = new ArrayList(); - list.add("foo"); - list.add("bar"); - list.add("baz"); - this.clearList(list, LIST_NAME); - } - - public void testSynchronizeList() { - List oldList = new ArrayList(); - oldList.add("foo"); - oldList.add("bar"); - oldList.add("baz"); - oldList.add("xxx"); - oldList.add("yyy"); - oldList.add("zzz"); - List newList = new ArrayList(); - newList.add("foo"); - newList.add("ppp"); - newList.add("baz"); - newList.add("xxx"); - newList.add("qqq"); - this.synchronizeList(newList, oldList, LIST_NAME); - assertEquals(newList, oldList); - } - - // ***** tree - public void testFireNodeAddedTreeEvent() { - this.fireNodeAdded(new TreeAddEvent(this, TREE_NAME, OBJECT_PATH)); - } - - public void testFireNodeAddedTree() { - this.fireNodeAdded(TREE_NAME, OBJECT_PATH); - } - - public void testFireNodeRemovedTreeEvent() { - this.fireNodeRemoved(new TreeRemoveEvent(this, TREE_NAME, OBJECT_PATH)); - } - - public void testFireNodeRemovedTree() { - this.fireNodeRemoved(TREE_NAME, OBJECT_PATH); - } - - public void testFireTreeClearedEvent() { - this.fireTreeCleared(new TreeClearEvent(this, TREE_NAME)); - } - - public void testFireTreeCleared() { - this.fireTreeCleared(TREE_NAME); - } - - public void testFireTreeChangedEvent() { - this.fireTreeChanged(new TreeChangeEvent(this, TREE_NAME, OBJECT_PATH)); - } - - public void testFireTreeChanged() { - this.fireTreeChanged(TREE_NAME, OBJECT_PATH); - } - - public boolean testAttributeValueHasChanged(Object value1, Object value2) { - return this.attributeValueHasChanged(value1, value2); - } - - public boolean testAttributeValueHasNotChanged(Object value1, Object value2) { - return this.attributeValueHasNotChanged(value1, value2); - } - - // ***** misc - @Override - public TestModel clone() { - try { - return (TestModel) super.clone(); - } catch (CloneNotSupportedException ex) { - throw new InternalError(); - } - } - - public boolean testValuesAreDifferent(Object value1, Object value2) { - return this.valuesAreDifferent(value1, value2); - } - - public boolean testValuesAreEqual(Object value1, Object value2) { - return this.valuesAreEqual(value1, value2); - } - - public boolean testElementsAreDifferent(Iterable iterable1, Iterable iterable2) { - return this.getChangeSupport().elementsAreDifferent(iterable1, iterable2); - } - - public boolean testElementsAreEqual(Iterable iterable1, Iterable iterable2) { - return this.getChangeSupport().elementsAreEqual(iterable1, iterable2); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(TEST_TO_STRING); - } - - } - - - // ********** serialization test ********** - public void testSerialization() throws java.io.IOException, ClassNotFoundException { - if (Tools.jvmIsSun()) { - // This test doesn't pass in the Eclipse build environment (Linux/IBM JVM) for some reason - this.verifySerialization(); - } - } - - private void verifySerialization() throws java.io.IOException, ClassNotFoundException { - LocalModel model1 = new LocalModel(); - Foo foo1 = new Foo(); - Bar bar1 = new Bar(); - Joo joo1 = new Joo(); - Jar jar1 = new Jar(); - model1.addStateChangeListener(foo1); - model1.addStateChangeListener(bar1); - model1.addListChangeListener("foo", joo1); - model1.addListChangeListener("foo", jar1); - - Iterable listeners1 = this.getListeners(model1, StateChangeListener.class, null); - Object[] listenersArray1 = ArrayTools.array(listeners1); - assertEquals(2, listenersArray1.length); - // the order of these could change... - assertEquals(Foo.class, listenersArray1[0].getClass()); - assertEquals(Bar.class, listenersArray1[1].getClass()); - - listeners1 = this.getListeners(model1, ListChangeListener.class, "foo"); - listenersArray1 = ArrayTools.array(listeners1); - assertEquals(2, listenersArray1.length); - // the order of these could change... - assertEquals(Joo.class, listenersArray1[0].getClass()); - assertEquals(Jar.class, listenersArray1[1].getClass()); - - LocalModel model2 = TestTools.serialize(model1); - - Iterable listeners2 = this.getListeners(model2, StateChangeListener.class, null); - Object[] listenersArray2 = ArrayTools.array(listeners2); - assertEquals(1, listenersArray2.length); - assertEquals(Foo.class, listenersArray2[0].getClass()); - - listeners2 = this.getListeners(model2, ListChangeListener.class, "foo"); - listenersArray2 = ArrayTools.array(listeners2); - assertEquals(1, listenersArray2.length); - assertEquals(Joo.class, listenersArray2[0].getClass()); - } - - private Iterable getListeners(LocalModel model, Class listenerClass, String aspectName) { - return this.getListenerList(model, listenerClass, aspectName).getListeners(); - } - - @SuppressWarnings("unchecked") - private ListenerList getListenerList(LocalModel model, Class listenerClass, String aspectName) { - ChangeSupport changeSupport = (ChangeSupport) ReflectionTools.getFieldValue(model, "changeSupport"); - return (ListenerList) ReflectionTools.executeMethod(changeSupport, "getListenerList_", new Class[] {Class.class, String.class}, new Object[] {listenerClass, aspectName}); - } - - // we have to manually handle 'changeSupport' since AbstractModel is not Serializable - private static class LocalModel extends AbstractModel implements Serializable { - LocalModel() { - super(); - } - private synchronized void writeObject(ObjectOutputStream s) throws IOException { - s.defaultWriteObject(); - s.writeObject(this.changeSupport); - } - private void readObject(ObjectInputStream s) throws ClassNotFoundException, IOException { - s.defaultReadObject(); - this.changeSupport = (ChangeSupport) s.readObject(); - } - } - - private static class Foo implements Serializable, StateChangeListener { - Foo() { - super(); - } - public void stateChanged(StateChangeEvent event) { - // do nothing - } - } - - private static class Bar implements StateChangeListener { - Bar() { - super(); - } - public void stateChanged(StateChangeEvent event) { - // do nothing - } - } - - private static class Joo extends ListChangeAdapter implements Serializable { - Joo() { - super(); - } - } - - private static class Jar extends ListChangeAdapter { - Jar() { - super(); - } - } - - - // ********** bug(?) test ********** - - private static final String ISE_MESSAGE = "this object is no longer listening to localA"; - - /** - * Test the following situation: - * - both B and C are listening to A - * - C is also listening to B - * - when B receives an event from A, it will fire an event to C - * - when C receives an event from B, it will STOP listening to A - * - the event from B to C may be preceded or followed (depending on - * the hash positions of listeners) by an event from A to C: - * - if the A to C event comes first, no problem - * - but if the A to B event comes first, the A to C event should NOT happen - */ - public void testIndirectRemoveStateListener() { - this.verifyIndirectRemoveListener( - new NotifyCommand() { - public void notifyListeners(LocalA localA) { - localA.notifyStateListeners(); - } - } - ); - } - - public void testIndirectRemovePropertyListener() { - this.verifyIndirectRemoveListener( - new NotifyCommand() { - public void notifyListeners(LocalA localA) { - localA.notifyPropertyListeners(); - } - } - ); - } - - public void testIndirectRemoveCollectionListener() { - this.verifyIndirectRemoveListener( - new NotifyCommand() { - public void notifyListeners(LocalA localA) { - localA.notifyCollectionListeners(); - } - } - ); - } - - public void testIndirectRemoveListListener() { - this.verifyIndirectRemoveListener( - new NotifyCommand() { - public void notifyListeners(LocalA localA) { - localA.notifyListListeners(); - } - } - ); - } - - public void testIndirectRemoveTreeListener() { - this.verifyIndirectRemoveListener( - new NotifyCommand() { - public void notifyListeners(LocalA localA) { - localA.notifyTreeListeners(); - } - } - ); - } - - public void verifyIndirectRemoveListener(NotifyCommand command) { - LocalA localA = new LocalA(); - LocalB localB = new LocalB(localA); - - // build a bunch of LocalCs so at least one of them is notified AFTER the LocalB; - // using 1000 seemed to fail very consistently before ChangeSupport was fixed - LocalC[] localCs = new LocalC[1000]; - for (int i = localCs.length; i-- > 0; ) { - localCs[i] = new LocalC(localA, localB); - } - - boolean exCaught = false; - try { - command.notifyListeners(localA); - } catch (IllegalStateException ex) { - if (ex.getMessage() == ISE_MESSAGE) { - exCaught = true; - } else { - throw ex; - } - } - assertFalse(exCaught); - - for (int i = localCs.length; i-- > 0; ) { - assertFalse(localCs[i].isListeningToLocalA()); - } - } - - private interface NotifyCommand { - void notifyListeners(LocalA localA); - } - - /** - * This object simply fires a state change event. Both LocalB and LocalC - * will be listeners. - */ - private static class LocalA extends AbstractModel { - LocalA() { - super(); - } - void notifyStateListeners() { - this.fireStateChanged(); - } - void notifyPropertyListeners() { - this.firePropertyChanged("foo", 1, 2); - } - void notifyCollectionListeners() { - this.fireCollectionChanged("foo", Collections.emptySet()); - } - void notifyListListeners() { - this.fireListChanged("foo", Collections.emptyList()); - } - void notifyTreeListeners() { - this.fireTreeChanged("foo", Collections.emptySet()); - } - } - - /** - * This object will fire state change events whenever it receives - * a state change event from localA. - */ - private static class LocalB - extends AbstractModel - implements ChangeListener - { - LocalB(LocalA localA) { - super(); - localA.addChangeListener(this); - } - - public void stateChanged(StateChangeEvent e) { - this.fireStateChanged(); - } - - public void propertyChanged(PropertyChangeEvent evt) { - this.firePropertyChanged("bar", 1, 2); - } - - public void collectionChanged(CollectionChangeEvent e) { - this.fireCollectionChanged("bar", Collections.emptySet()); - } - public void collectionCleared(CollectionClearEvent e) {/*ignore*/} - public void itemsAdded(CollectionAddEvent e) {/*ignore*/} - public void itemsRemoved(CollectionRemoveEvent e) {/*ignore*/} - - public void listChanged(ListChangeEvent e) { - this.fireListChanged("bar", Collections.emptyList()); - } - public void listCleared(ListClearEvent e) {/*ignore*/} - public void itemsAdded(ListAddEvent e) {/*ignore*/} - public void itemsRemoved(ListRemoveEvent e) {/*ignore*/} - public void itemsReplaced(ListReplaceEvent e) {/*ignore*/} - public void itemsMoved(ListMoveEvent e) {/*ignore*/} - - public void treeChanged(TreeChangeEvent e) { - this.fireTreeChanged("bar", Collections.emptySet()); - } - public void treeCleared(TreeClearEvent e) {/*ignore*/} - public void nodeAdded(TreeAddEvent e) {/*ignore*/} - public void nodeRemoved(TreeRemoveEvent e) {/*ignore*/} - - } - - /** - * This object will listen to two other objects, localA and localB. - * If this object receives notification from localB, it will stop listening to - * localA. If this object receives notification from localA, it will check to - * see whether it still listening to localA. If this object is no longer - * listening to localA, it will complain about receiving the event and - * throw an exception. - */ - private static class LocalC - extends AbstractModel - implements ChangeListener - { - private LocalA localA; - private LocalB localB; - private boolean listeningToLocalA; - - LocalC(LocalA localA, LocalB localB) { - super(); - this.localA = localA; - this.localB = localB; - - localA.addChangeListener(this); - this.listeningToLocalA = true; - - localB.addChangeListener(this); - } - boolean isListeningToLocalA() { - return this.listeningToLocalA; - } - - public void stateChanged(StateChangeEvent e) { - Object source = e.getSource(); - if (source == this.localA) { - if ( ! this.listeningToLocalA) { - throw new IllegalStateException(ISE_MESSAGE); - } - } else if (source == this.localB) { - this.localA.removeChangeListener(this); - this.listeningToLocalA = false; - } else { - throw new IllegalStateException("bogus event source: " + source); - } - } - - public void propertyChanged(PropertyChangeEvent e) { - Object source = e.getSource(); - if (source == this.localA) { - if ( ! this.listeningToLocalA) { - throw new IllegalStateException(ISE_MESSAGE); - } - } else if (source == this.localB) { - this.localA.removeChangeListener(this); - this.listeningToLocalA = false; - } else { - throw new IllegalStateException("bogus event source: " + source); - } - } - - public void collectionChanged(CollectionChangeEvent e) { - Object source = e.getSource(); - if (source == this.localA) { - if ( ! this.listeningToLocalA) { - throw new IllegalStateException(ISE_MESSAGE); - } - } else if (source == this.localB) { - this.localA.removeChangeListener(this); - this.listeningToLocalA = false; - } else { - throw new IllegalStateException("bogus event source: " + source); - } - } - public void collectionCleared(CollectionClearEvent e) {/*ignore*/} - public void itemsAdded(CollectionAddEvent e) {/*ignore*/} - public void itemsRemoved(CollectionRemoveEvent e) {/*ignore*/} - - public void listChanged(ListChangeEvent e) { - Object source = e.getSource(); - if (source == this.localA) { - if ( ! this.listeningToLocalA) { - throw new IllegalStateException(ISE_MESSAGE); - } - } else if (source == this.localB) { - this.localA.removeChangeListener(this); - this.listeningToLocalA = false; - } else { - throw new IllegalStateException("bogus event source: " + source); - } - } - public void listCleared(ListClearEvent e) {/*ignore*/} - public void itemsAdded(ListAddEvent e) {/*ignore*/} - public void itemsRemoved(ListRemoveEvent e) {/*ignore*/} - public void itemsReplaced(ListReplaceEvent e) {/*ignore*/} - public void itemsMoved(ListMoveEvent e) {/*ignore*/} - - public void treeChanged(TreeChangeEvent e) { - Object source = e.getSource(); - if (source == this.localA) { - if ( ! this.listeningToLocalA) { - throw new IllegalStateException(ISE_MESSAGE); - } - } else if (source == this.localB) { - this.localA.removeChangeListener(this); - this.listeningToLocalA = false; - } else { - throw new IllegalStateException("bogus event source: " + source); - } - } - public void treeCleared(TreeClearEvent e) {/*ignore*/} - public void nodeAdded(TreeAddEvent e) {/*ignore*/} - public void nodeRemoved(TreeRemoveEvent e) {/*ignore*/} - - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/JptUtilityModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/JptUtilityModelTests.java deleted file mode 100644 index f4f64ef801..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/JptUtilityModelTests.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model; - -import junit.framework.Test; -import junit.framework.TestSuite; -import org.eclipse.jpt.common.utility.tests.internal.model.listener.JptUtilityModelListenerTests; -import org.eclipse.jpt.common.utility.tests.internal.model.value.JptUtilityModelValueTests; - -public class JptUtilityModelTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptUtilityModelTests.class.getPackage().getName()); - - suite.addTest(JptUtilityModelListenerTests.suite()); - suite.addTest(JptUtilityModelValueTests.suite()); - - suite.addTestSuite(ChangeSupportTests.class); - suite.addTestSuite(NewEventTests.class); - suite.addTestSuite(SingleAspectChangeSupportTests.class); - - return suite; - } - - private JptUtilityModelTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/NewEventTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/NewEventTests.java deleted file mode 100644 index 2ce4ac0c49..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/NewEventTests.java +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model; - -import java.util.EventListener; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.ListenerList; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.ChangeEvent; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -/** - * test what it takes to add a new type of event to - * model and change support - */ -public class NewEventTests extends TestCase { - private Foo foo; - - public NewEventTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.foo = new Foo(); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testHasNoFooChangeListeners() { - assertTrue(this.foo.hasNoFooChangeListeners()); - LocalListener listener = new LocalListener(); - this.foo.addFooChangeListener(listener); - assertFalse(this.foo.hasNoFooChangeListeners()); - this.foo.removeFooChangeListener(listener); - assertTrue(this.foo.hasNoFooChangeListeners()); - } - - public void testHasAnyFooChangeListeners() { - assertFalse(this.foo.hasAnyFooChangeListeners()); - LocalListener listener = new LocalListener(); - this.foo.addFooChangeListener(listener); - assertTrue(this.foo.hasAnyFooChangeListeners()); - this.foo.removeFooChangeListener(listener); - assertFalse(this.foo.hasAnyFooChangeListeners()); - } - - public void testFireFooChangeEvent() { - LocalListener listener = new LocalListener(); - assertFalse(listener.receivedFooEvent); - this.foo.addFooChangeListener(listener); - this.foo.foo(); - assertTrue(listener.receivedFooEvent); - } - - - // ********** harness classes ********** - - class Foo extends AbstractFooModel { - Foo() { - super(); - } - void foo() { - this.fireFooChangeEvent(); - } - } - - class LocalListener implements FooChangeListener { - boolean receivedFooEvent = false; - LocalListener() { - super(); - } - public void fooChanged(FooChangeEvent event) { - this.receivedFooEvent = true; - } - } - - interface FooModel extends Model { - void addFooChangeListener(FooChangeListener listener); - void removeFooChangeListener(FooChangeListener listener); - } - - interface FooChangeListener extends EventListener { - void fooChanged(FooChangeEvent event); - } - - static class FooChangeEvent extends ChangeEvent { - private static final long serialVersionUID = 1L; - public FooChangeEvent(FooModel source) { - super(source); - } - public FooChangeEvent clone(Model newSource) { - return new FooChangeEvent((FooModel) newSource); - } - } - - static class AbstractFooModel extends AbstractModel implements FooModel { - @Override - protected synchronized FooChangeSupport getChangeSupport() { - return (FooChangeSupport) super.getChangeSupport(); - } - @Override - protected ChangeSupport buildChangeSupport() { - return new FooChangeSupport(this); - } - public void addFooChangeListener(FooChangeListener listener) { - this.getChangeSupport().addFooChangeListener(listener); - } - public void removeFooChangeListener(FooChangeListener listener) { - this.getChangeSupport().removeFooChangeListener(listener); - } - protected void fireFooChangeEvent() { - this.getChangeSupport().fireFooChanged(); - } - public boolean hasAnyFooChangeListeners() { - return this.getChangeSupport().hasAnyFooChangeListeners(); - } - public boolean hasNoFooChangeListeners() { - return ! this.hasAnyFooChangeListeners(); - } - } - - static class FooChangeSupport extends ChangeSupport { - FooChangeSupport(FooModel source) { - super(source); - } - protected static final Class FOO_CHANGE_LISTENER_CLASS = FooChangeListener.class; - void addFooChangeListener(FooChangeListener listener) { - this.addListener(FOO_CHANGE_LISTENER_CLASS, listener); - } - void removeFooChangeListener(FooChangeListener listener) { - this.removeListener(FOO_CHANGE_LISTENER_CLASS, listener); - } - public boolean hasAnyFooChangeListeners() { - return this.hasAnyListeners(FOO_CHANGE_LISTENER_CLASS); - } - private ListenerList getFooChangeListenerList() { - return this.getListenerList(FOO_CHANGE_LISTENER_CLASS); - } - private Iterable getFooChangeListeners() { - ListenerList listenerList = this.getFooChangeListenerList(); - return (listenerList == null) ? null : listenerList.getListeners(); - } - private boolean hasFooChangeListener(FooChangeListener listener) { - return CollectionTools.contains(this.getFooChangeListeners(), listener); - } - public void fireFooChanged() { - Iterable listeners = this.getFooChangeListeners(); - if (listeners != null) { - FooChangeEvent event = null; - for (FooChangeListener listener : listeners) { - if (this.hasFooChangeListener(listener)) { - if (event == null) { - // here's the reason for the duplicate code... - event = new FooChangeEvent((FooModel) this.source); - } - listener.fooChanged(event); - } - } - } - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/SingleAspectChangeSupportTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/SingleAspectChangeSupportTests.java deleted file mode 100644 index a0dae05267..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/SingleAspectChangeSupportTests.java +++ /dev/null @@ -1,192 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.common.utility.internal.model.SingleAspectChangeSupport; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ListChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; -import org.eclipse.jpt.common.utility.model.listener.TreeChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.TreeChangeListener; - -@SuppressWarnings("nls") -public class SingleAspectChangeSupportTests extends TestCase { - - public SingleAspectChangeSupportTests(String name) { - super(name); - } - - public void testAddPropertyChangeListenerInvalidClass() { - Model model = new StateTestModel(); - boolean exCaught = false; - PropertyChangeListener listener = new PropertyChangeAdapter(); - try { - model.addPropertyChangeListener("foo", listener); - fail("bogus listener: " + listener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testAddPropertyChangeListenerInvalidAspect() { - Model model = new PropertyTestModel(); - boolean exCaught = false; - PropertyChangeListener listener = new PropertyChangeAdapter(); - try { - model.addPropertyChangeListener("bar", listener); - fail("bogus listener: " + listener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testAddCollectionChangeListenerInvalidClass() { - Model model = new StateTestModel(); - boolean exCaught = false; - CollectionChangeListener listener = new CollectionChangeAdapter(); - try { - model.addCollectionChangeListener("foo", listener); - fail("bogus listener: " + listener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testAddCollectionChangeListenerInvalidAspect() { - Model model = new CollectionTestModel(); - boolean exCaught = false; - CollectionChangeListener listener = new CollectionChangeAdapter(); - try { - model.addCollectionChangeListener("bar", listener); - fail("bogus listener: " + listener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testAddListChangeListenerInvalidClass() { - Model model = new StateTestModel(); - boolean exCaught = false; - ListChangeListener listener = new ListChangeAdapter(); - try { - model.addListChangeListener("foo", listener); - fail("bogus listener: " + listener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testAddListChangeListenerInvalidAspect() { - Model model = new ListTestModel(); - boolean exCaught = false; - ListChangeListener listener = new ListChangeAdapter(); - try { - model.addListChangeListener("bar", listener); - fail("bogus listener: " + listener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testAddTreeChangeListenerInvalidClass() { - Model model = new StateTestModel(); - boolean exCaught = false; - TreeChangeListener listener = new TreeChangeAdapter(); - try { - model.addTreeChangeListener("foo", listener); - fail("bogus listener: " + listener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testAddTreeChangeListenerInvalidAspect() { - Model model = new TreeTestModel(); - boolean exCaught = false; - TreeChangeListener listener = new TreeChangeAdapter(); - try { - model.addTreeChangeListener("bar", listener); - fail("bogus listener: " + listener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - - // ********** test models ********** - - static class StateTestModel extends AbstractModel { - StateTestModel() { - super(); - } - @Override - protected ChangeSupport buildChangeSupport() { - return new SingleAspectChangeSupport(this, StateChangeListener.class, null); - } - } - - static class PropertyTestModel extends AbstractModel { - PropertyTestModel() { - super(); - } - @Override - protected ChangeSupport buildChangeSupport() { - return new SingleAspectChangeSupport(this, PropertyChangeListener.class, "foo"); - } - } - - static class CollectionTestModel extends AbstractModel { - CollectionTestModel() { - super(); - } - @Override - protected ChangeSupport buildChangeSupport() { - return new SingleAspectChangeSupport(this, CollectionChangeListener.class, "foo"); - } - } - - static class ListTestModel extends AbstractModel { - ListTestModel() { - super(); - } - @Override - protected ChangeSupport buildChangeSupport() { - return new SingleAspectChangeSupport(this, ListChangeListener.class, "foo"); - } - } - - static class TreeTestModel extends AbstractModel { - TreeTestModel() { - super(); - } - @Override - protected ChangeSupport buildChangeSupport() { - return new SingleAspectChangeSupport(this, TreeChangeListener.class, "foo"); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/JptUtilityModelListenerTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/JptUtilityModelListenerTests.java deleted file mode 100644 index 1de3f75c49..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/JptUtilityModelListenerTests.java +++ /dev/null @@ -1,34 +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.common.utility.tests.internal.model.listener; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class JptUtilityModelListenerTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptUtilityModelListenerTests.class.getPackage().getName()); - - suite.addTestSuite(ReflectiveCollectionChangeListenerTests.class); - suite.addTestSuite(ReflectiveListChangeListenerTests.class); - suite.addTestSuite(ReflectivePropertyChangeListenerTests.class); - suite.addTestSuite(ReflectiveStateChangeListenerTests.class); - suite.addTestSuite(ReflectiveTreeChangeListenerTests.class); - - return suite; - } - - private JptUtilityModelListenerTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectiveCollectionChangeListenerTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectiveCollectionChangeListenerTests.java deleted file mode 100644 index 96ae5c351a..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectiveCollectionChangeListenerTests.java +++ /dev/null @@ -1,331 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.listener; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ReflectiveChangeListener; - -@SuppressWarnings("nls") -public class ReflectiveCollectionChangeListenerTests extends TestCase { - - public ReflectiveCollectionChangeListenerTests(String name) { - super(name); - } - - private CollectionChangeListener buildZeroArgumentListener(Object target) { - return ReflectiveChangeListener.buildCollectionChangeListener(target, "itemAddedZeroArgument", "itemRemovedZeroArgument", "collectionClearedZeroArgument", "collectionChangedZeroArgument"); - } - - private CollectionChangeListener buildSingleArgumentListener(Object target) { - return ReflectiveChangeListener.buildCollectionChangeListener(target, "itemAddedSingleArgument", "itemRemovedSingleArgument", "collectionClearedSingleArgument", "collectionChangedSingleArgument"); - } - - public void testItemAddedZeroArgumentNamedCollection() { - TestModel testModel = new TestModel(); - String string = "foo"; - Target target = new Target(testModel, TestModel.STRINGS_COLLECTION, string); - testModel.addCollectionChangeListener(TestModel.STRINGS_COLLECTION, this.buildZeroArgumentListener(target)); - testModel.addString(string); - assertTrue(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertFalse(target.collectionClearedZeroArgumentFlag); - assertFalse(target.collectionClearedSingleArgumentFlag); - assertFalse(target.collectionChangedZeroArgumentFlag); - assertFalse(target.collectionChangedSingleArgumentFlag); - } - - public void testItemAddedSingleArgumentNamedCollection() { - TestModel testModel = new TestModel(); - String string = "foo"; - Target target = new Target(testModel, TestModel.STRINGS_COLLECTION, string); - testModel.addCollectionChangeListener(TestModel.STRINGS_COLLECTION, this.buildSingleArgumentListener(target)); - testModel.addString(string); - assertFalse(target.itemAddedZeroArgumentFlag); - assertTrue(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertFalse(target.collectionClearedZeroArgumentFlag); - assertFalse(target.collectionClearedSingleArgumentFlag); - assertFalse(target.collectionChangedZeroArgumentFlag); - assertFalse(target.collectionChangedSingleArgumentFlag); - } - - public void testItemRemovedZeroArgumentNamedCollection() { - TestModel testModel = new TestModel(); - String string = "foo"; - testModel.addString(string); - Target target = new Target(testModel, TestModel.STRINGS_COLLECTION, string); - testModel.addCollectionChangeListener(TestModel.STRINGS_COLLECTION, this.buildZeroArgumentListener(target)); - testModel.removeString(string); - assertFalse(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertTrue(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertFalse(target.collectionClearedZeroArgumentFlag); - assertFalse(target.collectionClearedSingleArgumentFlag); - assertFalse(target.collectionChangedZeroArgumentFlag); - assertFalse(target.collectionChangedSingleArgumentFlag); - } - - public void testItemRemovedSingleArgumentNamedCollection() { - TestModel testModel = new TestModel(); - String string = "foo"; - testModel.addString(string); - Target target = new Target(testModel, TestModel.STRINGS_COLLECTION, string); - testModel.addCollectionChangeListener(TestModel.STRINGS_COLLECTION, this.buildSingleArgumentListener(target)); - testModel.removeString(string); - assertFalse(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertTrue(target.itemRemovedSingleArgumentFlag); - assertFalse(target.collectionClearedZeroArgumentFlag); - assertFalse(target.collectionClearedSingleArgumentFlag); - assertFalse(target.collectionChangedZeroArgumentFlag); - assertFalse(target.collectionChangedSingleArgumentFlag); - } - - public void testCollectionClearedZeroArgumentNamedCollection() { - TestModel testModel = new TestModel(); - String string = "foo"; - testModel.addString(string); - Target target = new Target(testModel, TestModel.STRINGS_COLLECTION, string); - testModel.addCollectionChangeListener(TestModel.STRINGS_COLLECTION, this.buildZeroArgumentListener(target)); - testModel.clearStrings(); - assertFalse(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertTrue(target.collectionClearedZeroArgumentFlag); - assertFalse(target.collectionClearedSingleArgumentFlag); - assertFalse(target.collectionChangedZeroArgumentFlag); - assertFalse(target.collectionChangedSingleArgumentFlag); - } - - public void testCollectionClearedSingleArgumentNamedCollection() { - TestModel testModel = new TestModel(); - String string = "foo"; - testModel.addString(string); - Target target = new Target(testModel, TestModel.STRINGS_COLLECTION, string); - testModel.addCollectionChangeListener(TestModel.STRINGS_COLLECTION, this.buildSingleArgumentListener(target)); - testModel.clearStrings(); - assertFalse(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertFalse(target.collectionClearedZeroArgumentFlag); - assertTrue(target.collectionClearedSingleArgumentFlag); - assertFalse(target.collectionChangedZeroArgumentFlag); - assertFalse(target.collectionChangedSingleArgumentFlag); - } - - public void testCollectionChangedZeroArgumentNamedCollection() { - TestModel testModel = new TestModel(); - String string = "foo"; - testModel.addString(string); - Target target = new Target(testModel, TestModel.STRINGS_COLLECTION, string); - testModel.addCollectionChangeListener(TestModel.STRINGS_COLLECTION, this.buildZeroArgumentListener(target)); - testModel.replaceStrings(new String[] {"bar", "baz"}); - assertFalse(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertFalse(target.collectionClearedZeroArgumentFlag); - assertFalse(target.collectionClearedSingleArgumentFlag); - assertTrue(target.collectionChangedZeroArgumentFlag); - assertFalse(target.collectionChangedSingleArgumentFlag); - } - - public void testCollectionChangedSingleArgumentNamedCollection() { - TestModel testModel = new TestModel(); - String string = "foo"; - testModel.addString(string); - Target target = new Target(testModel, TestModel.STRINGS_COLLECTION, string); - testModel.addCollectionChangeListener(TestModel.STRINGS_COLLECTION, this.buildSingleArgumentListener(target)); - testModel.replaceStrings(new String[] {"bar", "baz"}); - assertFalse(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertFalse(target.collectionClearedZeroArgumentFlag); - assertFalse(target.collectionClearedSingleArgumentFlag); - assertFalse(target.collectionChangedZeroArgumentFlag); - assertTrue(target.collectionChangedSingleArgumentFlag); - } - - public void testBogusDoubleArgument1() { - TestModel testModel = new TestModel(); - String string = "foo"; - Target target = new Target(testModel, TestModel.STRINGS_COLLECTION, string); - boolean exCaught = false; - try { - CollectionChangeListener listener = ReflectiveChangeListener.buildCollectionChangeListener(target, "collectionChangedDoubleArgument"); - fail("bogus listener: " + listener); - } catch (RuntimeException ex) { - if (ex.getCause().getClass() == NoSuchMethodException.class) { - exCaught = true; - } - } - assertTrue(exCaught); - } - - public void testBogusDoubleArgument2() throws Exception { - TestModel testModel = new TestModel(); - String string = "foo"; - Target target = new Target(testModel, TestModel.STRINGS_COLLECTION, string); - Method method = ReflectionTools.getMethod(target, "collectionChangedDoubleArgument", new Class[] {CollectionChangeEvent.class, Object.class}); - boolean exCaught = false; - try { - CollectionChangeListener listener = ReflectiveChangeListener.buildCollectionChangeListener(target, method); - fail("bogus listener: " + listener); - } catch (RuntimeException ex) { - if (ex.getMessage().equals(method.toString())) { - exCaught = true; - } - } - assertTrue(exCaught); - } - - public void testListenerMismatch() { - TestModel testModel = new TestModel(); - String string = "foo"; - Target target = new Target(testModel, TestModel.STRINGS_COLLECTION, string); - // build a COLLECTION change listener and hack it so we - // can add it as a LIST change listener - Object listener = ReflectiveChangeListener.buildCollectionChangeListener(target, "collectionEventSingleArgument"); - testModel.addListChangeListener("bogus list", (ListChangeListener) listener); - - boolean exCaught = false; - try { - testModel.changeList(); - fail("listener mismatch: " + listener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - - class TestModel extends AbstractModel { - private Collection strings = new ArrayList(); - public static final String STRINGS_COLLECTION = "strings"; - TestModel() { - super(); - } - Iterator strings() { - return new CloneIterator(this.strings) { - @Override - protected void remove(String s) { - TestModel.this.removeString(s); - } - }; - } - void addString(String string) { - this.addItemToCollection(string, this.strings, STRINGS_COLLECTION); - } - void removeString(String string) { - this.removeItemFromCollection(string, this.strings, STRINGS_COLLECTION); - } - void clearStrings() { - this.clearCollection(this.strings, STRINGS_COLLECTION); - } - void replaceStrings(String[] newStrings) { - this.strings.clear(); - CollectionTools.addAll(this.strings, newStrings); - this.fireCollectionChanged(STRINGS_COLLECTION, this.strings); - } - void changeList() { - this.fireListChanged("bogus list", Collections.emptyList()); - } - } - - class Target { - TestModel testModel; - String collectionName; - String string; - boolean itemAddedZeroArgumentFlag = false; - boolean itemAddedSingleArgumentFlag = false; - boolean itemRemovedZeroArgumentFlag = false; - boolean itemRemovedSingleArgumentFlag = false; - boolean collectionClearedZeroArgumentFlag = false; - boolean collectionClearedSingleArgumentFlag = false; - boolean collectionChangedZeroArgumentFlag = false; - boolean collectionChangedSingleArgumentFlag = false; - boolean collectionEventSingleArgumentFlag = false; - Target(TestModel testModel, String collectionName, String string) { - super(); - this.testModel = testModel; - this.collectionName = collectionName; - this.string = string; - } - void itemAddedZeroArgument() { - this.itemAddedZeroArgumentFlag = true; - } - void itemAddedSingleArgument(CollectionAddEvent e) { - this.itemAddedSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.collectionName, e.getCollectionName()); - assertEquals(this.string, e.getItems().iterator().next()); - } - void itemRemovedZeroArgument() { - this.itemRemovedZeroArgumentFlag = true; - } - void itemRemovedSingleArgument(CollectionRemoveEvent e) { - this.itemRemovedSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.collectionName, e.getCollectionName()); - assertEquals(this.string, e.getItems().iterator().next()); - } - void collectionClearedZeroArgument() { - this.collectionClearedZeroArgumentFlag = true; - } - void collectionClearedSingleArgument(CollectionClearEvent e) { - this.collectionClearedSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.collectionName, e.getCollectionName()); - } - void collectionChangedZeroArgument() { - this.collectionChangedZeroArgumentFlag = true; - } - void collectionChangedSingleArgument(CollectionChangeEvent e) { - this.collectionChangedSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.collectionName, e.getCollectionName()); - } - void collectionEventSingleArgument(CollectionEvent e) { - this.collectionEventSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.collectionName, e.getCollectionName()); - } - void collectionChangedDoubleArgument(CollectionChangeEvent e, Object o) { - fail("bogus event: " + e + " object: " + o); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectiveListChangeListenerTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectiveListChangeListenerTests.java deleted file mode 100644 index 34f6c9b49f..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectiveListChangeListenerTests.java +++ /dev/null @@ -1,498 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.listener; - -import java.lang.reflect.Method; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.ListIterator; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ReflectiveChangeListener; - -@SuppressWarnings("nls") -public class ReflectiveListChangeListenerTests extends TestCase { - - public ReflectiveListChangeListenerTests(String name) { - super(name); - } - - private ListChangeListener buildZeroArgumentListener(Object target) { - return ReflectiveChangeListener.buildListChangeListener(target, "itemAddedZeroArgument", "itemRemovedZeroArgument", "itemReplacedZeroArgument", "itemMovedZeroArgument", "listClearedZeroArgument", "listChangedZeroArgument"); - } - - private ListChangeListener buildSingleArgumentListener(Object target) { - return ReflectiveChangeListener.buildListChangeListener(target, "itemAddedSingleArgument", "itemRemovedSingleArgument", "itemReplacedSingleArgument", "itemMovedSingleArgument", "listClearedSingleArgument", "listChangedSingleArgument"); - } - - public void testItemAddedZeroArgumentNamedList() { - TestModel testModel = new TestModel(); - String string = "foo"; - Target target = new Target(testModel, TestModel.STRINGS_LIST, string, 0); - testModel.addListChangeListener(TestModel.STRINGS_LIST, this.buildZeroArgumentListener(target)); - testModel.addString(string); - assertTrue(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertFalse(target.itemReplacedZeroArgumentFlag); - assertFalse(target.itemReplacedSingleArgumentFlag); - assertFalse(target.itemMovedZeroArgumentFlag); - assertFalse(target.itemMovedSingleArgumentFlag); - assertFalse(target.listClearedZeroArgumentFlag); - assertFalse(target.listClearedSingleArgumentFlag); - assertFalse(target.listChangedZeroArgumentFlag); - assertFalse(target.listChangedSingleArgumentFlag); - } - - public void testItemAddedSingleArgumentNamedList() { - TestModel testModel = new TestModel(); - String string = "foo"; - Target target = new Target(testModel, TestModel.STRINGS_LIST, string, 0); - testModel.addListChangeListener(TestModel.STRINGS_LIST, this.buildSingleArgumentListener(target)); - testModel.addString(string); - assertFalse(target.itemAddedZeroArgumentFlag); - assertTrue(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertFalse(target.itemReplacedZeroArgumentFlag); - assertFalse(target.itemReplacedSingleArgumentFlag); - assertFalse(target.itemMovedZeroArgumentFlag); - assertFalse(target.itemMovedSingleArgumentFlag); - assertFalse(target.listClearedZeroArgumentFlag); - assertFalse(target.listClearedSingleArgumentFlag); - assertFalse(target.listChangedZeroArgumentFlag); - assertFalse(target.listChangedSingleArgumentFlag); - } - - public void testItemRemovedZeroArgumentNamedList() { - TestModel testModel = new TestModel(); - String string = "foo"; - testModel.addString(string); - Target target = new Target(testModel, TestModel.STRINGS_LIST, string, 0); - testModel.addListChangeListener(TestModel.STRINGS_LIST, this.buildZeroArgumentListener(target)); - testModel.removeString(string); - assertFalse(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertTrue(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertFalse(target.itemReplacedZeroArgumentFlag); - assertFalse(target.itemReplacedSingleArgumentFlag); - assertFalse(target.itemMovedZeroArgumentFlag); - assertFalse(target.itemMovedSingleArgumentFlag); - assertFalse(target.listClearedZeroArgumentFlag); - assertFalse(target.listClearedSingleArgumentFlag); - assertFalse(target.listChangedZeroArgumentFlag); - assertFalse(target.listChangedSingleArgumentFlag); - } - - public void testItemRemovedSingleArgumentNamedList() { - TestModel testModel = new TestModel(); - String string = "foo"; - testModel.addString(string); - Target target = new Target(testModel, TestModel.STRINGS_LIST, string, 0); - testModel.addListChangeListener(TestModel.STRINGS_LIST, this.buildSingleArgumentListener(target)); - testModel.removeString(string); - assertFalse(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertTrue(target.itemRemovedSingleArgumentFlag); - assertFalse(target.itemReplacedZeroArgumentFlag); - assertFalse(target.itemReplacedSingleArgumentFlag); - assertFalse(target.itemMovedZeroArgumentFlag); - assertFalse(target.itemMovedSingleArgumentFlag); - assertFalse(target.listClearedZeroArgumentFlag); - assertFalse(target.listClearedSingleArgumentFlag); - assertFalse(target.listChangedZeroArgumentFlag); - assertFalse(target.listChangedSingleArgumentFlag); - } - - public void testItemReplacedZeroArgumentNamedList() { - TestModel testModel = new TestModel(); - String oldString = "foo"; - String newString = "bar"; - testModel.addString(oldString); - Target target = new Target(testModel, TestModel.STRINGS_LIST, newString, 0, oldString); - testModel.addListChangeListener(TestModel.STRINGS_LIST, this.buildZeroArgumentListener(target)); - testModel.replaceString(oldString, newString); - assertFalse(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertTrue(target.itemReplacedZeroArgumentFlag); - assertFalse(target.itemReplacedSingleArgumentFlag); - assertFalse(target.itemMovedZeroArgumentFlag); - assertFalse(target.itemMovedSingleArgumentFlag); - assertFalse(target.listClearedZeroArgumentFlag); - assertFalse(target.listClearedSingleArgumentFlag); - assertFalse(target.listChangedZeroArgumentFlag); - assertFalse(target.listChangedSingleArgumentFlag); - } - - public void testItemReplacedSingleArgumentNamedList() { - TestModel testModel = new TestModel(); - String oldString = "foo"; - String newString = "bar"; - testModel.addString(oldString); - Target target = new Target(testModel, TestModel.STRINGS_LIST, newString, 0, oldString); - testModel.addListChangeListener(TestModel.STRINGS_LIST, this.buildSingleArgumentListener(target)); - testModel.replaceString(oldString, newString); - assertFalse(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertFalse(target.itemReplacedZeroArgumentFlag); - assertTrue(target.itemReplacedSingleArgumentFlag); - assertFalse(target.itemMovedZeroArgumentFlag); - assertFalse(target.itemMovedSingleArgumentFlag); - assertFalse(target.listClearedZeroArgumentFlag); - assertFalse(target.listClearedSingleArgumentFlag); - assertFalse(target.listChangedZeroArgumentFlag); - assertFalse(target.listChangedSingleArgumentFlag); - } - - public void testItemMovedZeroArgumentNamedList() { - TestModel testModel = new TestModel(); - testModel.addString("zero"); - testModel.addString("one"); - testModel.addString("two"); - testModel.addString("three"); - Target target = new Target(testModel, TestModel.STRINGS_LIST, 0, 2); - testModel.addListChangeListener(TestModel.STRINGS_LIST, this.buildZeroArgumentListener(target)); - testModel.moveString(0, 2); - assertFalse(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertFalse(target.itemReplacedZeroArgumentFlag); - assertFalse(target.itemReplacedSingleArgumentFlag); - assertTrue(target.itemMovedZeroArgumentFlag); - assertFalse(target.itemMovedSingleArgumentFlag); - assertFalse(target.listClearedZeroArgumentFlag); - assertFalse(target.listClearedSingleArgumentFlag); - assertFalse(target.listChangedZeroArgumentFlag); - assertFalse(target.listChangedSingleArgumentFlag); - } - - public void testItemMovedSingleArgumentNamedList() { - TestModel testModel = new TestModel(); - testModel.addString("zero"); - testModel.addString("one"); - testModel.addString("two"); - testModel.addString("three"); - Target target = new Target(testModel, TestModel.STRINGS_LIST, 0, 2); - testModel.addListChangeListener(TestModel.STRINGS_LIST, this.buildSingleArgumentListener(target)); - testModel.moveString(0, 2); - assertFalse(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertFalse(target.itemReplacedZeroArgumentFlag); - assertFalse(target.itemReplacedSingleArgumentFlag); - assertFalse(target.itemMovedZeroArgumentFlag); - assertTrue(target.itemMovedSingleArgumentFlag); - assertFalse(target.listClearedZeroArgumentFlag); - assertFalse(target.listClearedSingleArgumentFlag); - assertFalse(target.listChangedZeroArgumentFlag); - assertFalse(target.listChangedSingleArgumentFlag); - } - - public void testListClearedZeroArgumentNamedList() { - TestModel testModel = new TestModel(); - String string = "foo"; - testModel.addString(string); - Target target = new Target(testModel, TestModel.STRINGS_LIST, null, -1); - testModel.addListChangeListener(TestModel.STRINGS_LIST, this.buildZeroArgumentListener(target)); - testModel.clearStrings(); - assertFalse(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertFalse(target.itemReplacedZeroArgumentFlag); - assertFalse(target.itemReplacedSingleArgumentFlag); - assertFalse(target.itemMovedZeroArgumentFlag); - assertFalse(target.itemMovedSingleArgumentFlag); - assertTrue(target.listClearedZeroArgumentFlag); - assertFalse(target.listClearedSingleArgumentFlag); - assertFalse(target.listChangedZeroArgumentFlag); - assertFalse(target.listChangedSingleArgumentFlag); - } - - public void testListClearedSingleArgumentNamedList() { - TestModel testModel = new TestModel(); - String string = "foo"; - testModel.addString(string); - Target target = new Target(testModel, TestModel.STRINGS_LIST, null, -1); - testModel.addListChangeListener(TestModel.STRINGS_LIST, this.buildSingleArgumentListener(target)); - testModel.clearStrings(); - assertFalse(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertFalse(target.itemReplacedZeroArgumentFlag); - assertFalse(target.itemReplacedSingleArgumentFlag); - assertFalse(target.itemMovedZeroArgumentFlag); - assertFalse(target.itemMovedSingleArgumentFlag); - assertFalse(target.listClearedZeroArgumentFlag); - assertTrue(target.listClearedSingleArgumentFlag); - assertFalse(target.listChangedZeroArgumentFlag); - assertFalse(target.listChangedSingleArgumentFlag); - } - - public void testListChangedZeroArgumentNamedList() { - TestModel testModel = new TestModel(); - String string = "foo"; - testModel.addString(string); - Target target = new Target(testModel, TestModel.STRINGS_LIST, null, -1); - testModel.addListChangeListener(TestModel.STRINGS_LIST, this.buildZeroArgumentListener(target)); - testModel.replaceAllStrings(new String[] {"bar", "baz"}); - assertFalse(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertFalse(target.itemReplacedZeroArgumentFlag); - assertFalse(target.itemReplacedSingleArgumentFlag); - assertFalse(target.itemMovedZeroArgumentFlag); - assertFalse(target.itemMovedSingleArgumentFlag); - assertFalse(target.listClearedZeroArgumentFlag); - assertFalse(target.listClearedSingleArgumentFlag); - assertTrue(target.listChangedZeroArgumentFlag); - assertFalse(target.listChangedSingleArgumentFlag); - } - - public void testListChangedSingleArgumentNamedList() { - TestModel testModel = new TestModel(); - String string = "foo"; - testModel.addString(string); - Target target = new Target(testModel, TestModel.STRINGS_LIST, null, -1); - testModel.addListChangeListener(TestModel.STRINGS_LIST, this.buildSingleArgumentListener(target)); - testModel.replaceAllStrings(new String[] {"bar", "baz"}); - assertFalse(target.itemAddedZeroArgumentFlag); - assertFalse(target.itemAddedSingleArgumentFlag); - assertFalse(target.itemRemovedZeroArgumentFlag); - assertFalse(target.itemRemovedSingleArgumentFlag); - assertFalse(target.itemReplacedZeroArgumentFlag); - assertFalse(target.itemReplacedSingleArgumentFlag); - assertFalse(target.itemMovedZeroArgumentFlag); - assertFalse(target.itemMovedSingleArgumentFlag); - assertFalse(target.listClearedZeroArgumentFlag); - assertFalse(target.listClearedSingleArgumentFlag); - assertFalse(target.listChangedZeroArgumentFlag); - assertTrue(target.listChangedSingleArgumentFlag); - } - - public void testBogusDoubleArgument1() { - TestModel testModel = new TestModel(); - String string = "foo"; - Target target = new Target(testModel, TestModel.STRINGS_LIST, string, 0); - boolean exCaught = false; - try { - ListChangeListener listener = ReflectiveChangeListener.buildListChangeListener(target, "listChangedDoubleArgument"); - fail("bogus listener: " + listener); - } catch (RuntimeException ex) { - if (ex.getCause().getClass() == NoSuchMethodException.class) { - exCaught = true; - } - } - assertTrue(exCaught); - } - - public void testBogusDoubleArgument2() throws Exception { - TestModel testModel = new TestModel(); - String string = "foo"; - Target target = new Target(testModel, TestModel.STRINGS_LIST, string, 0); - Method method = ReflectionTools.getMethod(target, "listChangedDoubleArgument", new Class[] {ListChangeEvent.class, Object.class}); - boolean exCaught = false; - try { - ListChangeListener listener = ReflectiveChangeListener.buildListChangeListener(target, method); - fail("bogus listener: " + listener); - } catch (RuntimeException ex) { - if (ex.getMessage().equals(method.toString())) { - exCaught = true; - } - } - assertTrue(exCaught); - } - - public void testListenerMismatch() { - TestModel testModel = new TestModel(); - String string = "foo"; - Target target = new Target(testModel, TestModel.STRINGS_LIST, string, 0); - // build a LIST change listener and hack it so we - // can add it as a COLLECTION change listener - Object listener = ReflectiveChangeListener.buildListChangeListener(target, "listEventSingleArgument"); - testModel.addCollectionChangeListener("bogus collection", (CollectionChangeListener) listener); - - boolean exCaught = false; - try { - testModel.changeCollection(); - fail("listener mismatch: " + listener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - - class TestModel extends AbstractModel { - private List strings = new ArrayList(); - public static final String STRINGS_LIST = "strings"; - TestModel() { - super(); - } - ListIterator strings() { - return new CloneListIterator(this.strings); - } - void addString(String string) { - this.addItemToList(string, this.strings, STRINGS_LIST); - } - void removeString(String string) { - this.removeItemFromList(this.strings.indexOf(string), this.strings, STRINGS_LIST); - } - void replaceString(String oldString, String newString) { - this.setItemInList(this.strings.indexOf(oldString), newString, this.strings, STRINGS_LIST); - } - void moveString(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.strings, STRINGS_LIST); - } - void clearStrings() { - this.clearList(this.strings, STRINGS_LIST); - } - void replaceAllStrings(String[] newStrings) { - this.strings.clear(); - CollectionTools.addAll(this.strings, newStrings); - this.fireListChanged(STRINGS_LIST, this.strings); - } - void changeCollection() { - this.fireCollectionChanged("bogus collection", Collections.emptySet()); - } - } - - class Target { - TestModel testModel; - String listName; - String string; - int index; - String replacedString; - int sourceIndex; - boolean itemAddedZeroArgumentFlag = false; - boolean itemAddedSingleArgumentFlag = false; - boolean itemRemovedZeroArgumentFlag = false; - boolean itemRemovedSingleArgumentFlag = false; - boolean itemReplacedZeroArgumentFlag = false; - boolean itemReplacedSingleArgumentFlag = false; - boolean itemMovedZeroArgumentFlag = false; - boolean itemMovedSingleArgumentFlag = false; - boolean listClearedZeroArgumentFlag = false; - boolean listClearedSingleArgumentFlag = false; - boolean listChangedZeroArgumentFlag = false; - boolean listChangedSingleArgumentFlag = false; - boolean listEventSingleArgumentFlag = false; - Target(TestModel testModel, String listName, String string, int index) { - super(); - this.testModel = testModel; - this.listName = listName; - this.string = string; - this.index = index; - } - Target(TestModel testModel, String listName, String string, int index, String replacedString) { - this(testModel, listName, string, index); - this.replacedString = replacedString; - } - Target(TestModel testModel, String listName, int targetIndex, int sourceIndex) { - super(); - this.testModel = testModel; - this.listName = listName; - this.index = targetIndex; - this.sourceIndex = sourceIndex; - } - void itemAddedZeroArgument() { - this.itemAddedZeroArgumentFlag = true; - } - void itemAddedSingleArgument(ListAddEvent e) { - this.itemAddedSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.listName, e.getListName()); - assertEquals(this.string, e.getItems().iterator().next()); - assertEquals(this.index, e.getIndex()); - } - void itemRemovedZeroArgument() { - this.itemRemovedZeroArgumentFlag = true; - } - void itemRemovedSingleArgument(ListRemoveEvent e) { - this.itemRemovedSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.listName, e.getListName()); - assertEquals(this.string, e.getItems().iterator().next()); - assertEquals(this.index, e.getIndex()); - } - void itemReplacedZeroArgument() { - this.itemReplacedZeroArgumentFlag = true; - } - void itemReplacedSingleArgument(ListReplaceEvent e) { - this.itemReplacedSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.listName, e.getListName()); - assertEquals(this.string, e.getNewItems().iterator().next()); - assertEquals(this.replacedString, e.getOldItems().iterator().next()); - assertEquals(this.index, e.getIndex()); - } - void itemMovedZeroArgument() { - this.itemMovedZeroArgumentFlag = true; - } - void itemMovedSingleArgument(ListMoveEvent e) { - this.itemMovedSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.listName, e.getListName()); - assertEquals(this.index, e.getTargetIndex()); - assertEquals(this.sourceIndex, e.getSourceIndex()); - } - void listChangedZeroArgument() { - this.listChangedZeroArgumentFlag = true; - } - void listClearedSingleArgument(ListClearEvent e) { - this.listClearedSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.listName, e.getListName()); - } - void listClearedZeroArgument() { - this.listClearedZeroArgumentFlag = true; - } - void listChangedSingleArgument(ListChangeEvent e) { - this.listChangedSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.listName, e.getListName()); - } - void listChangedDoubleArgument(ListChangeEvent e, Object o) { - fail("bogus event: " + e + " - object: " + o); - } - void listEventSingleArgument(ListEvent e) { - this.listEventSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.listName, e.getListName()); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectivePropertyChangeListenerTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectivePropertyChangeListenerTests.java deleted file mode 100644 index 9b27d57fcb..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectivePropertyChangeListenerTests.java +++ /dev/null @@ -1,176 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.listener; - -import java.lang.reflect.Method; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ReflectiveChangeListener; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; - -@SuppressWarnings("nls") -public class ReflectivePropertyChangeListenerTests extends TestCase { - - public ReflectivePropertyChangeListenerTests(String name) { - super(name); - } - - public void testZeroArgumentNamedProperty() { - TestModel testModel = new TestModel(7); - Target target = new Target(testModel, TestModel.VALUE_PROPERTY, 7, 99); - testModel.addPropertyChangeListener(TestModel.VALUE_PROPERTY, ReflectiveChangeListener.buildPropertyChangeListener(target, "propertyChangedZeroArgument")); - testModel.setValue(99); - assertTrue(target.zeroArgumentFlag); - assertFalse(target.singleArgumentFlag); - } - - /** - * test method that has more general method parameter type - */ - public void testSingleArgument2() throws Exception { - TestModel testModel = new TestModel(7); - Target target = new Target(testModel, TestModel.VALUE_PROPERTY, 7, 99); - Method method = ReflectionTools.getMethod(target, "propertyChangedSingleArgument2", new Class[] {Object.class}); - testModel.addPropertyChangeListener(TestModel.VALUE_PROPERTY, ReflectiveChangeListener.buildPropertyChangeListener(target, method)); - testModel.setValue(99); - assertFalse(target.zeroArgumentFlag); - assertTrue(target.singleArgumentFlag); - } - - public void testSingleArgumentNamedProperty() { - TestModel testModel = new TestModel(7); - Target target = new Target(testModel, TestModel.VALUE_PROPERTY, 7, 99); - testModel.addPropertyChangeListener(TestModel.VALUE_PROPERTY, ReflectiveChangeListener.buildPropertyChangeListener(target, "propertyChangedSingleArgument")); - testModel.setValue(99); - assertFalse(target.zeroArgumentFlag); - assertTrue(target.singleArgumentFlag); - } - - /** - * test method that has more general method parameter type - */ - public void testSingleArgumentNamedProperty2() throws Exception { - TestModel testModel = new TestModel(7); - Target target = new Target(testModel, TestModel.VALUE_PROPERTY, 7, 99); - Method method = ReflectionTools.getMethod(target, "propertyChangedSingleArgument2", new Class[] {Object.class}); - testModel.addPropertyChangeListener(TestModel.VALUE_PROPERTY, ReflectiveChangeListener.buildPropertyChangeListener(target, method)); - testModel.setValue(99); - assertFalse(target.zeroArgumentFlag); - assertTrue(target.singleArgumentFlag); - } - - public void testListenerMismatch() { - TestModel testModel = new TestModel(7); - Target target = new Target(testModel, TestModel.VALUE_PROPERTY, 7, 99); - // build a PROPERTY change listener and hack it so we - // can add it as a STATE change listener - Object listener = ReflectiveChangeListener.buildPropertyChangeListener(target, "propertyChangedSingleArgument"); - testModel.addStateChangeListener((StateChangeListener) listener); - - boolean exCaught = false; - try { - testModel.setValue(99); - fail("listener mismatch: " + listener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testBogusDoubleArgument1() { - TestModel testModel = new TestModel(7); - Target target = new Target(testModel, TestModel.VALUE_PROPERTY, 7, 99); - boolean exCaught = false; - try { - PropertyChangeListener listener = ReflectiveChangeListener.buildPropertyChangeListener(target, "stateChangedDoubleArgument"); - fail("bogus listener: " + listener); - } catch (RuntimeException ex) { - if (ex.getCause().getClass() == NoSuchMethodException.class) { - exCaught = true; - } - } - assertTrue(exCaught); - } - - public void testBogusDoubleArgument2() throws Exception { - TestModel testModel = new TestModel(7); - Target target = new Target(testModel, TestModel.VALUE_PROPERTY, 7, 99); - Method method = ReflectionTools.getMethod(target, "propertyChangedDoubleArgument", new Class[] {PropertyChangeEvent.class, Object.class}); - boolean exCaught = false; - try { - PropertyChangeListener listener = ReflectiveChangeListener.buildPropertyChangeListener(target, method); - fail("bogus listener: " + listener); - } catch (RuntimeException ex) { - if (ex.getMessage().equals(method.toString())) { - exCaught = true; - } - } - assertTrue(exCaught); - } - - - class TestModel extends AbstractModel { - private int value = 0; - public static final String VALUE_PROPERTY = "value"; - TestModel(int value) { - super(); - this.value = value; - } - void setValue(int value) { - int old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - if (old != value) { - this.fireStateChanged(); - } - } - } - - class Target { - TestModel testModel; - String propertyName; - Object oldValue; - Object newValue; - boolean zeroArgumentFlag = false; - boolean singleArgumentFlag = false; - Target(TestModel testModel, String propertyName, int oldValue, int newValue) { - super(); - this.testModel = testModel; - this.propertyName = propertyName; - this.oldValue = new Integer(oldValue); - this.newValue = new Integer(newValue); - } - void propertyChangedZeroArgument() { - this.zeroArgumentFlag = true; - } - void propertyChangedSingleArgument(PropertyChangeEvent e) { - this.singleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.propertyName, e.getPropertyName()); - assertEquals(this.oldValue, e.getOldValue()); - assertEquals(this.newValue, e.getNewValue()); - } - void propertyChangedSingleArgument2(Object o) { - PropertyChangeEvent e = (PropertyChangeEvent) o; - this.singleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.propertyName, e.getPropertyName()); - assertEquals(this.oldValue, e.getOldValue()); - assertEquals(this.newValue, e.getNewValue()); - } - void propertyChangedDoubleArgument(PropertyChangeEvent e, Object o) { - fail("bogus event: " + e + " - object: " + o); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectiveStateChangeListenerTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectiveStateChangeListenerTests.java deleted file mode 100644 index 9a799e37db..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectiveStateChangeListenerTests.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.listener; - -import java.lang.reflect.Method; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ReflectiveChangeListener; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; - -@SuppressWarnings("nls") -public class ReflectiveStateChangeListenerTests extends TestCase { - - public ReflectiveStateChangeListenerTests(String name) { - super(name); - } - - public void testZeroArgument() { - TestModel testModel = new TestModel(); - Target target = new Target(testModel); - testModel.addStateChangeListener(ReflectiveChangeListener.buildStateChangeListener(target, "stateChangedZeroArgument")); - testModel.changeState(); - assertTrue(target.zeroArgumentFlag); - assertFalse(target.singleArgumentFlag); - } - - public void testSingleArgument() { - TestModel testModel = new TestModel(); - Target target = new Target(testModel); - testModel.addStateChangeListener(ReflectiveChangeListener.buildStateChangeListener(target, "stateChangedSingleArgument")); - testModel.changeState(); - assertFalse(target.zeroArgumentFlag); - assertTrue(target.singleArgumentFlag); - } - - /** - * test method that has more general method parameter type - */ - public void testSingleArgument2() throws Exception { - TestModel testModel = new TestModel(); - Target target = new Target(testModel); - Method method = ReflectionTools.getMethod(target, "stateChangedSingleArgument2", new Class[] {Object.class}); - testModel.addStateChangeListener(ReflectiveChangeListener.buildStateChangeListener(target, method)); - testModel.changeState(); - assertFalse(target.zeroArgumentFlag); - assertTrue(target.singleArgumentFlag); - } - - public void testListenerMismatch() { - TestModel testModel = new TestModel(); - Target target = new Target(testModel); - // build a STATE change listener and hack it so we - // can add it as a PROPERTY change listener - Object listener = ReflectiveChangeListener.buildStateChangeListener(target, "stateChangedSingleArgument"); - testModel.addPropertyChangeListener("value", (PropertyChangeListener) listener); - - boolean exCaught = false; - try { - testModel.changeProperty(); - fail("listener mismatch: " + listener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testBogusDoubleArgument1() { - TestModel testModel = new TestModel(); - Target target = new Target(testModel); - boolean exCaught = false; - try { - StateChangeListener listener = ReflectiveChangeListener.buildStateChangeListener(target, "stateChangedDoubleArgument"); - fail("bogus listener: " + listener); - } catch (RuntimeException ex) { - if (ex.getCause().getClass() == NoSuchMethodException.class) { - exCaught = true; - } - } - assertTrue(exCaught); - } - - public void testBogusDoubleArgument2() throws Exception { - TestModel testModel = new TestModel(); - Target target = new Target(testModel); - Method method = ReflectionTools.getMethod(target, "stateChangedDoubleArgument", new Class[] {StateChangeEvent.class, Object.class}); - boolean exCaught = false; - try { - StateChangeListener listener = ReflectiveChangeListener.buildStateChangeListener(target, method); - fail("bogus listener: " + listener); - } catch (RuntimeException ex) { - if (ex.getMessage().equals(method.toString())) { - exCaught = true; - } - } - assertTrue(exCaught); - } - - - class TestModel extends AbstractModel { - TestModel() { - super(); - } - void changeState() { - this.fireStateChanged(); - } - void changeProperty() { - this.firePropertyChanged("value", 55, 42); - } - } - - class Target { - TestModel testModel; - boolean zeroArgumentFlag = false; - boolean singleArgumentFlag = false; - Target(TestModel testModel) { - super(); - this.testModel = testModel; - } - void stateChangedZeroArgument() { - this.zeroArgumentFlag = true; - } - void stateChangedSingleArgument(StateChangeEvent e) { - this.singleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - } - void stateChangedSingleArgument2(Object e) { - this.singleArgumentFlag = true; - assertSame(this.testModel, ((StateChangeEvent) e).getSource()); - } - void stateChangedDoubleArgument(StateChangeEvent e, Object o) { - fail("bogus event: " + e + " - object: " + o); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectiveTreeChangeListenerTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectiveTreeChangeListenerTests.java deleted file mode 100644 index e6dbfe7253..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/listener/ReflectiveTreeChangeListenerTests.java +++ /dev/null @@ -1,362 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.listener; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.Iterator; -import java.util.List; -import java.util.Map; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ReflectiveChangeListener; -import org.eclipse.jpt.common.utility.model.listener.TreeChangeListener; - -@SuppressWarnings("nls") -public class ReflectiveTreeChangeListenerTests extends TestCase { - - public ReflectiveTreeChangeListenerTests(String name) { - super(name); - } - - private TreeChangeListener buildZeroArgumentListener(Object target) { - return ReflectiveChangeListener.buildTreeChangeListener(target, "nodeAddedZeroArgument", "nodeRemovedZeroArgument", "treeClearedZeroArgument", "treeChangedZeroArgument"); - } - - private TreeChangeListener buildSingleArgumentListener(Object target) { - return ReflectiveChangeListener.buildTreeChangeListener(target, "nodeAddedSingleArgument", "nodeRemovedSingleArgument", "treeClearedSingleArgument", "treeChangedSingleArgument"); - } - - public void testNodeAddedZeroArgumentNamedTree() { - TestModel testModel = new TestModel("root"); - Target target = new Target(testModel, TestModel.STRINGS_TREE, new String[]{"root", "child"}); - testModel.addTreeChangeListener(TestModel.STRINGS_TREE, this.buildZeroArgumentListener(target)); - testModel.addNode("root", "child"); - assertTrue(target.nodeAddedZeroArgumentFlag); - assertFalse(target.nodeAddedSingleArgumentFlag); - assertFalse(target.nodeRemovedZeroArgumentFlag); - assertFalse(target.nodeRemovedSingleArgumentFlag); - assertFalse(target.treeClearedZeroArgumentFlag); - assertFalse(target.treeClearedSingleArgumentFlag); - assertFalse(target.treeChangedZeroArgumentFlag); - assertFalse(target.treeChangedSingleArgumentFlag); - } - - public void testNodeAddedSingleArgumentNamedTree() { - TestModel testModel = new TestModel("root"); - Target target = new Target(testModel, TestModel.STRINGS_TREE, new String[]{"root", "child"}); - testModel.addTreeChangeListener(TestModel.STRINGS_TREE, this.buildSingleArgumentListener(target)); - testModel.addNode("root", "child"); - assertFalse(target.nodeAddedZeroArgumentFlag); - assertTrue(target.nodeAddedSingleArgumentFlag); - assertFalse(target.nodeRemovedZeroArgumentFlag); - assertFalse(target.nodeRemovedSingleArgumentFlag); - assertFalse(target.treeClearedZeroArgumentFlag); - assertFalse(target.treeClearedSingleArgumentFlag); - assertFalse(target.treeChangedZeroArgumentFlag); - assertFalse(target.treeChangedSingleArgumentFlag); - } - - public void testNodeRemovedZeroArgumentNamedTree() { - TestModel testModel = new TestModel("root"); - testModel.addNode("root", "child"); - Target target = new Target(testModel, TestModel.STRINGS_TREE, new String[]{"root", "child"}); - testModel.addTreeChangeListener(TestModel.STRINGS_TREE, this.buildZeroArgumentListener(target)); - testModel.removeNode("child"); - assertFalse(target.nodeAddedZeroArgumentFlag); - assertFalse(target.nodeAddedSingleArgumentFlag); - assertTrue(target.nodeRemovedZeroArgumentFlag); - assertFalse(target.nodeRemovedSingleArgumentFlag); - assertFalse(target.treeClearedZeroArgumentFlag); - assertFalse(target.treeClearedSingleArgumentFlag); - assertFalse(target.treeChangedZeroArgumentFlag); - assertFalse(target.treeChangedSingleArgumentFlag); - } - - public void testNodeRemovedSingleArgumentNamedTree() { - TestModel testModel = new TestModel("root"); - testModel.addNode("root", "child"); - Target target = new Target(testModel, TestModel.STRINGS_TREE, new String[]{"root", "child"}); - testModel.addTreeChangeListener(TestModel.STRINGS_TREE, this.buildSingleArgumentListener(target)); - testModel.removeNode("child"); - assertFalse(target.nodeAddedZeroArgumentFlag); - assertFalse(target.nodeAddedSingleArgumentFlag); - assertFalse(target.nodeRemovedZeroArgumentFlag); - assertTrue(target.nodeRemovedSingleArgumentFlag); - assertFalse(target.treeClearedZeroArgumentFlag); - assertFalse(target.treeClearedSingleArgumentFlag); - assertFalse(target.treeChangedZeroArgumentFlag); - assertFalse(target.treeChangedSingleArgumentFlag); - } - - public void testTreeClearedZeroArgumentNamedTree() { - TestModel testModel = new TestModel("root"); - testModel.addNode("root", "child"); - testModel.addNode("child", "grandchild"); - Target target = new Target(testModel, TestModel.STRINGS_TREE, new String[0]); - testModel.addTreeChangeListener(TestModel.STRINGS_TREE, this.buildZeroArgumentListener(target)); - testModel.clearTree(); - assertFalse(target.nodeAddedZeroArgumentFlag); - assertFalse(target.nodeAddedSingleArgumentFlag); - assertFalse(target.nodeRemovedZeroArgumentFlag); - assertFalse(target.nodeRemovedSingleArgumentFlag); - assertTrue(target.treeClearedZeroArgumentFlag); - assertFalse(target.treeClearedSingleArgumentFlag); - assertFalse(target.treeChangedZeroArgumentFlag); - assertFalse(target.treeChangedSingleArgumentFlag); - } - - public void testTreeClearedSingleArgumentNamedTree() { - TestModel testModel = new TestModel("root"); - testModel.addNode("root", "child"); - testModel.addNode("child", "grandchild"); - Target target = new Target(testModel, TestModel.STRINGS_TREE, new String[0]); - testModel.addTreeChangeListener(TestModel.STRINGS_TREE, this.buildSingleArgumentListener(target)); - testModel.clearTree(); - assertFalse(target.nodeAddedZeroArgumentFlag); - assertFalse(target.nodeAddedSingleArgumentFlag); - assertFalse(target.nodeRemovedZeroArgumentFlag); - assertFalse(target.nodeRemovedSingleArgumentFlag); - assertFalse(target.treeClearedZeroArgumentFlag); - assertTrue(target.treeClearedSingleArgumentFlag); - assertFalse(target.treeChangedZeroArgumentFlag); - assertFalse(target.treeChangedSingleArgumentFlag); - } - - public void testTreeChangedZeroArgumentNamedTree() { - TestModel testModel = new TestModel("root"); - testModel.addNode("root", "child"); - Target target = new Target(testModel, TestModel.STRINGS_TREE, new String[]{"root", "another child"}); - testModel.addTreeChangeListener(TestModel.STRINGS_TREE, this.buildZeroArgumentListener(target)); - testModel.replaceNode("child", "another child"); - assertFalse(target.nodeAddedZeroArgumentFlag); - assertFalse(target.nodeAddedSingleArgumentFlag); - assertFalse(target.nodeRemovedZeroArgumentFlag); - assertFalse(target.nodeRemovedSingleArgumentFlag); - assertFalse(target.treeClearedZeroArgumentFlag); - assertFalse(target.treeClearedSingleArgumentFlag); - assertTrue(target.treeChangedZeroArgumentFlag); - assertFalse(target.treeChangedSingleArgumentFlag); - } - - public void testTreeChangedSingleArgumentNamedTree() { - TestModel testModel = new TestModel("root"); - testModel.addNode("root", "child"); - Target target = new Target(testModel, TestModel.STRINGS_TREE, new String[]{"root", "another child"}); - testModel.addTreeChangeListener(TestModel.STRINGS_TREE, this.buildSingleArgumentListener(target)); - testModel.replaceNode("child", "another child"); - assertFalse(target.nodeAddedZeroArgumentFlag); - assertFalse(target.nodeAddedSingleArgumentFlag); - assertFalse(target.nodeRemovedZeroArgumentFlag); - assertFalse(target.nodeRemovedSingleArgumentFlag); - assertFalse(target.treeClearedZeroArgumentFlag); - assertFalse(target.treeClearedSingleArgumentFlag); - assertFalse(target.treeChangedZeroArgumentFlag); - assertTrue(target.treeChangedSingleArgumentFlag); - } - - public void testListenerMismatch() { - TestModel testModel = new TestModel("root"); - testModel.addNode("root", "child"); - Target target = new Target(testModel, TestModel.STRINGS_TREE, new String[]{"root", "child"}); - // build a TREE change listener and hack it so we - // can add it as a COLLECTION change listener - Object listener = ReflectiveChangeListener.buildTreeChangeListener(target, "treeEventSingleArgument"); - testModel.addCollectionChangeListener("bogus collection", (CollectionChangeListener) listener); - - boolean exCaught = false; - try { - testModel.changeCollection(); - fail("listener mismatch: " + listener); - } catch (IllegalArgumentException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - - class TestModel extends AbstractModel { - private final String root; - private Map> childrenLists = new HashMap>(); - private Map parents = new HashMap(); - public static final String STRINGS_TREE = "strings"; - TestModel(String root) { - super(); - if (root == null) { - throw new NullPointerException(); - } - this.root = root; - this.childrenLists.put(root, new ArrayList()); - this.parents.put(root, null); - } - String getRoot() { - return this.root; - } - private List path(String node) { - String temp = node; - List reversePath = new ArrayList(); - do { - reversePath.add(temp); - temp = this.parents.get(temp); - } while (temp != null); - return CollectionTools.reverse(reversePath); - } - Iterator strings() { - return new CloneIterator(this.childrenLists.keySet()) { - @Override - protected void remove(String s) { - TestModel.this.removeNode(s); - } - }; - } - void addNode(String parent, String child) { - if ((parent == null) || (child == null)) { - throw new NullPointerException(); - } - - Collection children = this.childrenLists.get(parent); - if (children == null) { - throw new IllegalStateException("cannot add a child to a non-existent parent"); - } - - if (this.childrenLists.get(child) != null) { - throw new IllegalStateException("cannot add a child that is already in the tree"); - } - - children.add(child); - this.childrenLists.put(child, new ArrayList()); - this.parents.put(child, parent); - this.fireNodeAdded(STRINGS_TREE, this.path(child)); - } - void removeNode(String node) { - if (node == null) { - throw new NullPointerException(); - } - - Collection children = this.childrenLists.get(node); - if (children == null) { - throw new IllegalStateException("node is not in tree"); - } - List path = this.path(node); - for (String s : children) { - this.removeNode(s); - } - this.childrenLists.remove(node); - this.parents.remove(node); - this.fireNodeRemoved(STRINGS_TREE, path); - } - void replaceNode(String oldNode, String newNode) { - if ((oldNode == null) || (newNode == null)) { - throw new NullPointerException(); - } - - Collection children = this.childrenLists.remove(oldNode); - if (children == null) { - throw new IllegalStateException("old node is not in tree"); - } - this.childrenLists.put(newNode, children); - for (String child : children) { - this.parents.put(child, newNode); - } - - String parent = this.parents.remove(oldNode); - this.parents.put(newNode, parent); - - this.fireTreeChanged(STRINGS_TREE, this.path(newNode)); - } - void clearTree() { - this.childrenLists.clear(); - this.childrenLists.put(root, new ArrayList()); - this.parents.clear(); - this.parents.put(root, null); - this.fireTreeCleared(STRINGS_TREE); - } - void changeCollection() { - this.fireCollectionChanged("bogus collection", Collections.emptySet()); - } - } - - class Target { - TestModel testModel; - String treeName; - List path; - boolean nodeAddedZeroArgumentFlag = false; - boolean nodeAddedSingleArgumentFlag = false; - boolean nodeRemovedZeroArgumentFlag = false; - boolean nodeRemovedSingleArgumentFlag = false; - boolean treeClearedZeroArgumentFlag = false; - boolean treeClearedSingleArgumentFlag = false; - boolean treeChangedZeroArgumentFlag = false; - boolean treeChangedSingleArgumentFlag = false; - boolean treeEventSingleArgumentFlag = false; - Target(TestModel testModel, String treeName, String[] path) { - super(); - this.testModel = testModel; - this.treeName = treeName; - this.path = Arrays.asList(path); - } - void nodeAddedZeroArgument() { - this.nodeAddedZeroArgumentFlag = true; - } - void nodeAddedSingleArgument(TreeAddEvent e) { - this.nodeAddedSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.treeName, e.getTreeName()); - assertEquals(this.path, CollectionTools.list(e.getPath())); - } - void nodeRemovedZeroArgument() { - this.nodeRemovedZeroArgumentFlag = true; - } - void nodeRemovedSingleArgument(TreeRemoveEvent e) { - this.nodeRemovedSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.treeName, e.getTreeName()); - assertEquals(this.path, CollectionTools.list(e.getPath())); - } - void treeClearedZeroArgument() { - this.treeClearedZeroArgumentFlag = true; - } - void treeClearedSingleArgument(TreeClearEvent e) { - this.treeClearedSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.treeName, e.getTreeName()); - } - void treeChangedZeroArgument() { - this.treeChangedZeroArgumentFlag = true; - } - void treeChangedSingleArgument(TreeChangeEvent e) { - this.treeChangedSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.treeName, e.getTreeName()); - } - void treeEventSingleArgument(TreeEvent e) { - this.treeChangedSingleArgumentFlag = true; - assertSame(this.testModel, e.getSource()); - assertEquals(this.treeName, e.getTreeName()); - } - void collectionChangedDoubleArgument(TreeChangeEvent e, Object o) { - fail("bogus event: " + e + " - object: " + o); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/BufferedWritablePropertyValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/BufferedWritablePropertyValueModelTests.java deleted file mode 100644 index 6bee40b1f2..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/BufferedWritablePropertyValueModelTests.java +++ /dev/null @@ -1,504 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.Date; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.BufferedWritablePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class BufferedWritablePropertyValueModelTests extends TestCase { - private Employee employee; - private WritablePropertyValueModel employeeHolder; - PropertyChangeEvent employeeEvent; - - private WritablePropertyValueModel idAdapter; - private WritablePropertyValueModel nameAdapter; - private WritablePropertyValueModel hireDateAdapter; - PropertyChangeEvent adapterEvent; - - private BufferedWritablePropertyValueModel.Trigger trigger; - private BufferedWritablePropertyValueModel bufferedIDHolder; - private BufferedWritablePropertyValueModel bufferedNameHolder; - private BufferedWritablePropertyValueModel bufferedHireDateHolder; - PropertyChangeEvent bufferedEvent; - - public BufferedWritablePropertyValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - - this.employee = new Employee(17, "Freddy", new Date()); - this.employeeHolder = new SimplePropertyValueModel(this.employee); - - this.trigger = new BufferedWritablePropertyValueModel.Trigger(); - - this.idAdapter = this.buildIDAdapter(this.employeeHolder); - this.bufferedIDHolder = new BufferedWritablePropertyValueModel(this.idAdapter, this.trigger); - - this.nameAdapter = this.buildNameAdapter(this.employeeHolder); - this.bufferedNameHolder = new BufferedWritablePropertyValueModel(this.nameAdapter, this.trigger); - - this.hireDateAdapter = this.buildHireDateAdapter(this.employeeHolder); - this.bufferedHireDateHolder = new BufferedWritablePropertyValueModel(this.hireDateAdapter, this.trigger); - } - - private WritablePropertyValueModel buildIDAdapter(PropertyValueModel eHolder) { - return new PropertyAspectAdapter(eHolder, Employee.ID_PROPERTY) { - @Override - protected Integer buildValue_() { - return new Integer(this.subject.getID()); - } - @Override - protected void setValue_(Integer value) { - this.subject.setID(value.intValue()); - } - }; - } - - private WritablePropertyValueModel buildNameAdapter(PropertyValueModel eHolder) { - return new PropertyAspectAdapter(eHolder, Employee.NAME_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getName(); - } - @Override - protected void setValue_(String value) { - this.subject.setName(value); - } - }; - } - - private WritablePropertyValueModel buildHireDateAdapter(PropertyValueModel eHolder) { - return new PropertyAspectAdapter(eHolder, Employee.HIRE_DATE_PROPERTY) { - @Override - protected Date buildValue_() { - return this.subject.getHireDate(); - } - @Override - protected void setValue_(Date value) { - this.subject.setHireDate(value); - } - }; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testGetValue() { - PropertyChangeListener bufferedListener = this.buildBufferedListener(); - this.bufferedIDHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - this.bufferedNameHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - this.bufferedHireDateHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - - assertEquals(new Integer(17), this.idAdapter.getValue()); - assertEquals(new Integer(17), this.bufferedIDHolder.getValue()); - - assertEquals("Freddy", this.employee.getName()); - assertEquals("Freddy", this.nameAdapter.getValue()); - assertEquals("Freddy", this.bufferedNameHolder.getValue()); - - Date temp = this.employee.getHireDate(); - assertEquals(temp, this.employee.getHireDate()); - assertEquals(temp, this.hireDateAdapter.getValue()); - assertEquals(temp, this.bufferedHireDateHolder.getValue()); - - this.bufferedIDHolder.setValue(new Integer(323)); - assertEquals(17, this.employee.getID()); - assertEquals(new Integer(17), this.idAdapter.getValue()); - assertEquals(new Integer(323), this.bufferedIDHolder.getValue()); - - this.bufferedNameHolder.setValue("Ripley"); - assertEquals("Freddy", this.employee.getName()); - assertEquals("Freddy", this.nameAdapter.getValue()); - assertEquals("Ripley", this.bufferedNameHolder.getValue()); - - this.bufferedHireDateHolder.setValue(null); - assertEquals(temp, this.employee.getHireDate()); - assertEquals(temp, this.hireDateAdapter.getValue()); - assertEquals(null, this.bufferedHireDateHolder.getValue()); - } - - public void testTriggerAccept() { - PropertyChangeListener bufferedListener = this.buildBufferedListener(); - this.bufferedIDHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - this.bufferedNameHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - this.bufferedHireDateHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - - this.bufferedIDHolder.setValue(new Integer(323)); - assertEquals(17, this.employee.getID()); - assertEquals(new Integer(17), this.idAdapter.getValue()); - assertEquals(new Integer(323), this.bufferedIDHolder.getValue()); - - this.bufferedNameHolder.setValue("Ripley"); - assertEquals("Freddy", this.employee.getName()); - assertEquals("Freddy", this.nameAdapter.getValue()); - assertEquals("Ripley", this.bufferedNameHolder.getValue()); - - Date temp = this.employee.getHireDate(); - this.bufferedHireDateHolder.setValue(null); - assertEquals(temp, this.employee.getHireDate()); - assertEquals(temp, this.hireDateAdapter.getValue()); - assertEquals(null, this.bufferedHireDateHolder.getValue()); - - this.trigger.accept(); - - assertEquals(323, this.employee.getID()); - assertEquals(new Integer(323), this.idAdapter.getValue()); - assertEquals(new Integer(323), this.bufferedIDHolder.getValue()); - - assertEquals("Ripley", this.employee.getName()); - assertEquals("Ripley", this.nameAdapter.getValue()); - assertEquals("Ripley", this.bufferedNameHolder.getValue()); - - assertEquals(null, this.employee.getHireDate()); - assertEquals(null, this.hireDateAdapter.getValue()); - assertEquals(null, this.bufferedHireDateHolder.getValue()); - } - - public void testTriggerReset() { - PropertyChangeListener bufferedListener = this.buildBufferedListener(); - this.bufferedIDHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - this.bufferedNameHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - this.bufferedHireDateHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - - this.bufferedIDHolder.setValue(new Integer(323)); - assertEquals(17, this.employee.getID()); - assertEquals(new Integer(17), this.idAdapter.getValue()); - assertEquals(new Integer(323), this.bufferedIDHolder.getValue()); - - this.bufferedNameHolder.setValue("Ripley"); - assertEquals("Freddy", this.employee.getName()); - assertEquals("Freddy", this.nameAdapter.getValue()); - assertEquals("Ripley", this.bufferedNameHolder.getValue()); - - Date temp = this.employee.getHireDate(); - this.bufferedHireDateHolder.setValue(null); - assertEquals(temp, this.employee.getHireDate()); - assertEquals(temp, this.hireDateAdapter.getValue()); - assertEquals(null, this.bufferedHireDateHolder.getValue()); - - this.trigger.reset(); - - assertEquals(17, this.employee.getID()); - assertEquals(new Integer(17), this.idAdapter.getValue()); - assertEquals(new Integer(17), this.bufferedIDHolder.getValue()); - - assertEquals("Freddy", this.employee.getName()); - assertEquals("Freddy", this.nameAdapter.getValue()); - assertEquals("Freddy", this.bufferedNameHolder.getValue()); - - assertEquals(temp, this.employee.getHireDate()); - assertEquals(temp, this.hireDateAdapter.getValue()); - assertEquals(temp, this.bufferedHireDateHolder.getValue()); - } - - public void testLazyListening() { - assertTrue(((AbstractModel) this.bufferedIDHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(((AbstractModel) this.bufferedNameHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(((AbstractModel) this.bufferedHireDateHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - - assertTrue(((AbstractModel) this.idAdapter).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(((AbstractModel) this.nameAdapter).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(((AbstractModel) this.hireDateAdapter).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - - assertTrue(this.employee.hasNoPropertyChangeListeners(Employee.ID_PROPERTY)); - assertTrue(this.employee.hasNoPropertyChangeListeners(Employee.NAME_PROPERTY)); - assertTrue(this.employee.hasNoPropertyChangeListeners(Employee.HIRE_DATE_PROPERTY)); - - PropertyChangeListener bufferedListener = this.buildBufferedListener(); - this.bufferedIDHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - this.bufferedNameHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - this.bufferedHireDateHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - - assertTrue(((AbstractModel) this.bufferedIDHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(((AbstractModel) this.bufferedNameHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(((AbstractModel) this.bufferedHireDateHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - assertTrue(((AbstractModel) this.idAdapter).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(((AbstractModel) this.nameAdapter).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(((AbstractModel) this.hireDateAdapter).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - assertTrue(this.employee.hasAnyPropertyChangeListeners(Employee.ID_PROPERTY)); - assertTrue(this.employee.hasAnyPropertyChangeListeners(Employee.NAME_PROPERTY)); - assertTrue(this.employee.hasAnyPropertyChangeListeners(Employee.HIRE_DATE_PROPERTY)); - - this.bufferedIDHolder.removePropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - this.bufferedNameHolder.removePropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - this.bufferedHireDateHolder.removePropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - - assertTrue(((AbstractModel) this.bufferedIDHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(((AbstractModel) this.bufferedNameHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(((AbstractModel) this.bufferedHireDateHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - - assertTrue(((AbstractModel) this.idAdapter).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(((AbstractModel) this.nameAdapter).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(((AbstractModel) this.hireDateAdapter).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - - assertTrue(this.employee.hasNoPropertyChangeListeners(Employee.ID_PROPERTY)); - assertTrue(this.employee.hasNoPropertyChangeListeners(Employee.NAME_PROPERTY)); - assertTrue(this.employee.hasNoPropertyChangeListeners(Employee.HIRE_DATE_PROPERTY)); - } - - public void testPropertyChange1() { - PropertyChangeListener bufferedListener = this.buildBufferedListener(); - this.bufferedNameHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - - PropertyChangeListener adapterListener = this.buildAdapterListener(); - this.nameAdapter.addPropertyChangeListener(PropertyValueModel.VALUE, adapterListener); - - PropertyChangeListener employeeListener = this.buildEmployeeListener(); - this.employee.addPropertyChangeListener(Employee.NAME_PROPERTY, employeeListener); - - this.verifyPropertyChanges(); - } - - public void testPropertyChange2() { - ChangeListener bufferedListener = this.buildBufferedListener(); - this.bufferedNameHolder.addChangeListener(bufferedListener); - - ChangeListener adapterListener = this.buildAdapterListener(); - this.nameAdapter.addChangeListener(adapterListener); - - ChangeListener employeeListener = this.buildEmployeeListener(); - this.employee.addChangeListener(employeeListener); - - this.verifyPropertyChanges(); - } - - private void verifyPropertyChanges() { - this.bufferedEvent = null; - this.adapterEvent = null; - this.employeeEvent = null; - this.bufferedNameHolder.setValue("Ripley"); - this.verifyEvent(this.bufferedEvent, this.bufferedNameHolder, PropertyValueModel.VALUE, "Freddy", "Ripley"); - assertNull(this.adapterEvent); - assertNull(this.employeeEvent); - - this.bufferedEvent = null; - this.adapterEvent = null; - this.employeeEvent = null; - this.bufferedNameHolder.setValue("Charlie"); - this.verifyEvent(this.bufferedEvent, this.bufferedNameHolder, PropertyValueModel.VALUE, "Ripley", "Charlie"); - assertNull(this.adapterEvent); - assertNull(this.employeeEvent); - - this.bufferedEvent = null; - this.adapterEvent = null; - this.employeeEvent = null; - this.trigger.accept(); - assertNull(this.bufferedEvent); - this.verifyEvent(this.adapterEvent, this.nameAdapter, PropertyValueModel.VALUE, "Freddy", "Charlie"); - this.verifyEvent(this.employeeEvent, this.employee, Employee.NAME_PROPERTY, "Freddy", "Charlie"); - - this.bufferedEvent = null; - this.adapterEvent = null; - this.employeeEvent = null; - this.bufferedNameHolder.setValue("Jason"); - this.verifyEvent(this.bufferedEvent, this.bufferedNameHolder, PropertyValueModel.VALUE, "Charlie", "Jason"); - assertNull(this.adapterEvent); - assertNull(this.employeeEvent); - - this.bufferedEvent = null; - this.adapterEvent = null; - this.employeeEvent = null; - this.trigger.reset(); - this.verifyEvent(this.bufferedEvent, this.bufferedNameHolder, PropertyValueModel.VALUE, "Jason", "Charlie"); - assertNull(this.adapterEvent); - assertNull(this.employeeEvent); - } - - /** - * changing the value should trigger buffering - */ - public void testBuffering1() { - PropertyChangeListener bufferedListener = this.buildBufferedListener(); - this.bufferedNameHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - - this.bufferedNameHolder.setValue("Ripley"); - assertEquals("Freddy", this.nameAdapter.getValue()); - assertEquals("Ripley", this.bufferedNameHolder.getValue()); - assertTrue(this.bufferedNameHolder.isBuffering()); - } - - /** - * setting to the same value should not trigger buffering (?) - */ - public void testBuffering2() { - PropertyChangeListener bufferedListener = this.buildBufferedListener(); - this.bufferedNameHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - - this.bufferedNameHolder.setValue("Freddy"); - assertEquals("Freddy", this.bufferedNameHolder.getValue()); - assertEquals("Freddy", this.nameAdapter.getValue()); - assertFalse(this.bufferedNameHolder.isBuffering()); - } - - /** - * setting to the original value should not trigger buffering (?) - */ - public void testBuffering3() { - PropertyChangeListener bufferedListener = this.buildBufferedListener(); - this.bufferedNameHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - - this.bufferedNameHolder.setValue("Ripley"); - assertEquals("Freddy", this.nameAdapter.getValue()); - assertEquals("Ripley", this.bufferedNameHolder.getValue()); - assertTrue(this.bufferedNameHolder.isBuffering()); - - this.bufferedNameHolder.setValue("Freddy"); - assertEquals("Freddy", this.nameAdapter.getValue()); - assertEquals("Freddy", this.bufferedNameHolder.getValue()); - assertFalse(this.bufferedNameHolder.isBuffering()); - } - - /** - * back-door changes are ignored - "Last One In Wins" - */ - public void testChangeConflict1() { - PropertyChangeListener bufferedListener = this.buildBufferedListener(); - this.bufferedNameHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - - this.bufferedNameHolder.setValue("Ripley"); - assertEquals("Freddy", this.employee.getName()); - assertEquals("Freddy", this.nameAdapter.getValue()); - assertEquals("Ripley", this.bufferedNameHolder.getValue()); - - this.nameAdapter.setValue("Jason"); - assertEquals("Jason", this.employee.getName()); - assertEquals("Jason", this.nameAdapter.getValue()); - assertEquals("Ripley", this.bufferedNameHolder.getValue()); - - this.trigger.accept(); - // "Jason" is dropped on the floor... - assertEquals("Ripley", this.employee.getName()); - assertEquals("Ripley", this.nameAdapter.getValue()); - assertEquals("Ripley", this.bufferedNameHolder.getValue()); - } - - /** - * back-door changes can de-activate buffering (?) - */ - public void testChangeConflict2() { - PropertyChangeListener bufferedListener = this.buildBufferedListener(); - this.bufferedNameHolder.addPropertyChangeListener(PropertyValueModel.VALUE, bufferedListener); - - this.bufferedNameHolder.setValue("Ripley"); - assertEquals("Freddy", this.employee.getName()); - assertEquals("Freddy", this.nameAdapter.getValue()); - assertEquals("Ripley", this.bufferedNameHolder.getValue()); - assertTrue(this.bufferedNameHolder.isBuffering()); - - this.nameAdapter.setValue("Ripley"); - assertEquals("Ripley", this.employee.getName()); - assertEquals("Ripley", this.nameAdapter.getValue()); - assertEquals("Ripley", this.bufferedNameHolder.getValue()); - assertFalse(this.bufferedNameHolder.isBuffering()); - } - - private ChangeListener buildBufferedListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - BufferedWritablePropertyValueModelTests.this.bufferedEvent = e; - } - }; - } - - private ChangeListener buildAdapterListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - BufferedWritablePropertyValueModelTests.this.adapterEvent = e; - } - }; - } - - private ChangeListener buildEmployeeListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - BufferedWritablePropertyValueModelTests.this.employeeEvent = e; - } - }; - } - - private void verifyEvent(PropertyChangeEvent event, Object source, String propertyName, Object oldValue, Object newValue) { - assertEquals(source, event.getSource()); - assertEquals(propertyName, event.getPropertyName()); - assertEquals(oldValue, event.getOldValue()); - assertEquals(newValue, event.getNewValue()); - } - - - // ********** inner class ********** - - class Employee extends AbstractModel { - private int id; - public static final String ID_PROPERTY = "id"; - private String name; - public static final String NAME_PROPERTY = "name"; - private Date hireDate; - public static final String HIRE_DATE_PROPERTY = "hireDate"; - - Employee(int id, String name, Date hireDate) { - super(); - this.id = id; - this.name = name; - this.hireDate = hireDate; - } - int getID() { - return this.id; - } - void setID(int id) { - int old = this.id; - this.id = id; - this.firePropertyChanged(ID_PROPERTY, old, id); - } - String getName() { - return this.name; - } - void setName(String name) { - Object old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - Date getHireDate() { - return this.hireDate; - } - void setHireDate(Date hireDate) { - Object old = this.hireDate; - this.hireDate = hireDate; - this.firePropertyChanged(HIRE_DATE_PROPERTY, old, hireDate); - } - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - } -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CachingTransformationPropertyValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CachingTransformationPropertyValueModelTests.java deleted file mode 100644 index f17f265cf1..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CachingTransformationPropertyValueModelTests.java +++ /dev/null @@ -1,241 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.BidiTransformer; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.CachingTransformationPropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class CachingTransformationPropertyValueModelTests extends TestCase { - private WritablePropertyValueModel objectHolder; - PropertyChangeEvent event; - - private PropertyValueModel transformationObjectHolder; - PropertyChangeEvent transformationEvent; - - public CachingTransformationPropertyValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.objectHolder = new SimplePropertyValueModel(new Person("Karen", "Peggy", null)); - this.transformationObjectHolder = new CachingTransformationPropertyValueModel(this.objectHolder, this.buildTransformer()); - } - - private BidiTransformer buildTransformer() { - return new BidiTransformer() { - public Person transform(Person p) { - return (p == null) ? null : p.getParent(); - } - public Person reverseTransform(Person p) { - return (p == null) ? null : p.getChild(); - } - }; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testValue() { - ChangeListener listener = this.buildTransformationChangeListener(); - this.transformationObjectHolder.addChangeListener(listener); - - Person person = this.objectHolder.getValue(); - assertEquals("Karen", person.getName()); - Person parent = this.transformationObjectHolder.getValue(); - assertEquals(person.getParent().getName(), parent.getName()); - assertNotSame(person.getParent(), this.transformationObjectHolder.getValue()); - assertEquals(parent, this.transformationObjectHolder.getValue()); - - Person person1 = new Person("Matt", "Mitch", null); - this.objectHolder.setValue(person1); - Person parent2 = this.transformationObjectHolder.getValue(); - assertEquals(person1.getParent().getName(), parent2.getName()); - assertNotSame(person1.getParent(), this.transformationObjectHolder.getValue()); - assertEquals(parent2, this.transformationObjectHolder.getValue()); - - - this.objectHolder.setValue(null); - assertNull(this.objectHolder.getValue()); - assertNull(this.transformationObjectHolder.getValue()); - - Person person3 = new Person("Karen", "Peggy", null); - this.objectHolder.setValue(person3); - assertEquals("Karen", person3.getName()); - Person parent3 = this.transformationObjectHolder.getValue(); - assertEquals(person3.getParent().getName(), parent3.getName()); - assertNotSame(person3.getParent(), this.transformationObjectHolder.getValue()); - assertEquals(parent3, this.transformationObjectHolder.getValue()); - } - - public void testLazyListening() { - assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - ChangeListener listener = this.buildTransformationChangeListener(); - this.transformationObjectHolder.addChangeListener(listener); - assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.transformationObjectHolder.removeChangeListener(listener); - assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - - this.transformationObjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, listener); - assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.transformationObjectHolder.removePropertyChangeListener(PropertyValueModel.VALUE, listener); - assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - } - - public void testPropertyChange1() { - this.objectHolder.addChangeListener(this.buildChangeListener()); - this.transformationObjectHolder.addChangeListener(this.buildTransformationChangeListener()); - this.verifyPropertyChanges(); - } - - public void testPropertyChange2() { - this.objectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildListener()); - this.transformationObjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildTransformationListener()); - this.verifyPropertyChanges(); - } - - private void verifyPropertyChanges() { - this.event = null; - this.transformationEvent = null; - Person karen = this.objectHolder.getValue(); - Person peggyParent = this.transformationObjectHolder.getValue(); - Person peggy = new Person("Peggy", "Marian", null); - this.objectHolder.setValue(peggy); - Person marianParent = this.transformationObjectHolder.getValue(); - this.verifyEvent(this.event, this.objectHolder, karen, peggy); - this.verifyEvent(this.transformationEvent, this.transformationObjectHolder, peggyParent, marianParent); - - this.event = null; - this.transformationEvent = null; - Person matt = new Person("Matt", "Mitch", null); - this.objectHolder.setValue(matt); - Person mitchParent = this.transformationObjectHolder.getValue(); - this.verifyEvent(this.event, this.objectHolder, peggy, matt); - this.verifyEvent(this.transformationEvent, this.transformationObjectHolder, marianParent, mitchParent); - - this.event = null; - this.transformationEvent = null; - this.objectHolder.setValue(null); - this.verifyEvent(this.event, this.objectHolder, matt, null); - this.verifyEvent(this.transformationEvent, this.transformationObjectHolder, mitchParent, null); - - this.event = null; - this.transformationEvent = null; - this.objectHolder.setValue(matt); - mitchParent = this.transformationObjectHolder.getValue(); - this.verifyEvent(this.event, this.objectHolder, null, matt); - this.verifyEvent(this.transformationEvent, this.transformationObjectHolder, null, mitchParent); - } - - private PropertyChangeListener buildListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - CachingTransformationPropertyValueModelTests.this.event = e; - } - }; - } - - private PropertyChangeListener buildTransformationListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - CachingTransformationPropertyValueModelTests.this.transformationEvent = e; - } - }; - } - - private ChangeListener buildChangeListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - CachingTransformationPropertyValueModelTests.this.event = e; - } - }; - } - - private ChangeListener buildTransformationChangeListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - CachingTransformationPropertyValueModelTests.this.transformationEvent = e; - } - }; - } - - private void verifyEvent(PropertyChangeEvent e, Object source, Object oldValue, Object newValue) { - assertEquals(source, e.getSource()); - assertEquals(PropertyValueModel.VALUE, e.getPropertyName()); - assertEquals(oldValue, e.getOldValue()); - assertEquals(newValue, e.getNewValue()); - } - - - class Person extends AbstractModel { - - private String name; - public static final String NAME_PROPERTY = "name"; - - private String parentName; - public static final String PARENT_NAME_PROPERTY = "parentName"; - - private Person child; - - public Person(String name, String parentName, Person child) { - this.name = name; - this.parentName = parentName; - this.child = child; - } - - public String getName() { - return this.name; - } - - public void setName(String newName) { - String oldName = this.name; - this.name = newName; - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - public Person getParent() { - return new Person(this.parentName, null, this); - } - - public String getParentName() { - return this.parentName; - } - - public void setParentName(String newParentName) { - String oldParentName = this.parentName; - this.parentName = newParentName; - firePropertyChanged(PARENT_NAME_PROPERTY, oldParentName, newParentName); - } - - public Person getChild() { - return this.child; - } - - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CachingTransformationWritablePropertyValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CachingTransformationWritablePropertyValueModelTests.java deleted file mode 100644 index 3560f4a814..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CachingTransformationWritablePropertyValueModelTests.java +++ /dev/null @@ -1,253 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.BidiTransformer; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.CachingTransformationWritablePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class CachingTransformationWritablePropertyValueModelTests extends TestCase { - private WritablePropertyValueModel objectHolder; - PropertyChangeEvent event; - - private WritablePropertyValueModel transformationObjectHolder; - PropertyChangeEvent transformationEvent; - - public CachingTransformationWritablePropertyValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.objectHolder = new SimplePropertyValueModel(new Person("Karen", "Peggy", null)); - this.transformationObjectHolder = new CachingTransformationWritablePropertyValueModel(this.objectHolder, this.buildTransformer()); - } - - private BidiTransformer buildTransformer() { - return new BidiTransformer() { - public Person transform(Person p) { - return (p == null) ? null : p.getParent(); - } - public Person reverseTransform(Person p) { - return (p == null) ? null : p.getChild(); - } - }; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testValue() { - ChangeListener listener = this.buildTransformationListener(); - this.transformationObjectHolder.addChangeListener(listener); - - - Person person = this.objectHolder.getValue(); - assertEquals("Karen", person.getName()); - Person parent = this.transformationObjectHolder.getValue(); - assertEquals(person.getParent().getName(), parent.getName()); - assertNotSame(person.getParent(), this.transformationObjectHolder.getValue()); - assertEquals(parent, this.transformationObjectHolder.getValue()); - - Person person1 = new Person("Matt", "Mitch", null); - this.objectHolder.setValue(person1); - Person parent2 = this.transformationObjectHolder.getValue(); - assertEquals(person1.getParent().getName(), parent2.getName()); - assertNotSame(person1.getParent(), this.transformationObjectHolder.getValue()); - assertEquals(parent2, this.transformationObjectHolder.getValue()); - - - this.objectHolder.setValue(null); - assertNull(this.objectHolder.getValue()); - assertNull(this.transformationObjectHolder.getValue()); - - Person person3 = new Person("Karen", "Peggy", null); - this.objectHolder.setValue(person3); - assertEquals("Karen", person3.getName()); - Person parent3 = this.transformationObjectHolder.getValue(); - assertEquals(person3.getParent().getName(), parent3.getName()); - assertNotSame(person3.getParent(), this.transformationObjectHolder.getValue()); - assertEquals(parent3, this.transformationObjectHolder.getValue()); - } - - public void testSetValue() { - ChangeListener listener = this.buildTransformationListener(); - this.transformationObjectHolder.addChangeListener(listener); - - Person person = new Person("Chris", "Noel", null); - this.transformationObjectHolder.setValue(person.getParent()); - assertEquals(person, this.objectHolder.getValue()); - assertEquals(person.getParent().getName(), this.transformationObjectHolder.getValue().getName()); - assertNotSame(person.getParent(), this.transformationObjectHolder.getValue()); - - Person person2 = new Person("Jon", "Elizabeth", null); - this.transformationObjectHolder.setValue(person2.getParent()); - assertEquals(person2, this.objectHolder.getValue()); - assertEquals(person2.getParent().getName(), this.transformationObjectHolder.getValue().getName()); - assertNotSame(person2.getParent(), this.transformationObjectHolder.getValue()); - - this.transformationObjectHolder.setValue(null); - assertNull(this.objectHolder.getValue()); - assertNull(this.transformationObjectHolder.getValue()); - - this.transformationObjectHolder.setValue(person.getParent()); - assertEquals(person, this.objectHolder.getValue()); - assertEquals(person.getParent().getName(), this.transformationObjectHolder.getValue().getName()); - assertNotSame(person.getParent(), this.transformationObjectHolder.getValue()); - } - - public void testLazyListening() { - assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - ChangeListener listener = this.buildTransformationListener(); - this.transformationObjectHolder.addChangeListener(listener); - assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.transformationObjectHolder.removeChangeListener(listener); - assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - - this.transformationObjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, listener); - assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.transformationObjectHolder.removePropertyChangeListener(PropertyValueModel.VALUE, listener); - assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - } - - public void testPropertyChange1() { - this.objectHolder.addChangeListener(this.buildListener()); - this.transformationObjectHolder.addChangeListener(this.buildTransformationListener()); - this.verifyPropertyChanges(); - } - - public void testPropertyChange2() { - this.objectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildListener()); - this.transformationObjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildTransformationListener()); - this.verifyPropertyChanges(); - } - - private void verifyPropertyChanges() { - this.event = null; - this.transformationEvent = null; - Person oldPerson = this.objectHolder.getValue(); - Person oldParent = this.transformationObjectHolder.getValue(); - Person newPerson = new Person("Karen" , "Peggy", null); - this.objectHolder.setValue(newPerson); - Person newParent = this.transformationObjectHolder.getValue(); - this.verifyEvent(this.event, this.objectHolder, oldPerson, newPerson); - this.verifyEvent(this.transformationEvent, this.transformationObjectHolder, oldParent, newParent); - -// -// this.event = null; -// this.transformationEvent = null; -// this.objectHolder.setValue("Foo"); -// this.verifyEvent(this.event, this.objectHolder, "baz", "Foo"); -// this.verifyEvent(this.transformationEvent, this.transformationObjectHolder, "BAZ", "FOO"); -// -// this.event = null; -// this.transformationEvent = null; -// this.objectHolder.setValue("FOO"); -// this.verifyEvent(this.event, this.objectHolder, "Foo", "FOO"); -// assertNull(this.transformationEvent); -// -// this.event = null; -// this.transformationEvent = null; -// this.objectHolder.setValue(null); -// this.verifyEvent(this.event, this.objectHolder, "FOO", null); -// this.verifyEvent(this.transformationEvent, this.transformationObjectHolder, "FOO", null); -// -// this.event = null; -// this.transformationEvent = null; -// this.objectHolder.setValue("bar"); -// this.verifyEvent(this.event, this.objectHolder, null, "bar"); -// this.verifyEvent(this.transformationEvent, this.transformationObjectHolder, null, "BAR"); - } - - private ChangeListener buildListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - CachingTransformationWritablePropertyValueModelTests.this.event = e; - } - }; - } - - private ChangeListener buildTransformationListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - CachingTransformationWritablePropertyValueModelTests.this.transformationEvent = e; - } - }; - } - - private void verifyEvent(PropertyChangeEvent e, Object source, Object oldValue, Object newValue) { - assertEquals(source, e.getSource()); - assertEquals(PropertyValueModel.VALUE, e.getPropertyName()); - assertEquals(oldValue, e.getOldValue()); - assertEquals(newValue, e.getNewValue()); - } - - - class Person extends AbstractModel { - - private String name; - public static final String NAME_PROPERTY = "name"; - - private String parentName; - public static final String PARENT_NAME_PROPERTY = "parentName"; - - private Person child; - - public Person(String name, String parentName, Person child) { - this.name = name; - this.parentName = parentName; - this.child = child; - } - - public String getName() { - return this.name; - } - - public void setName(String newName) { - String oldName = this.name; - this.name = newName; - firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - public Person getParent() { - return new Person(this.parentName, null, this); - } - - public String getParentName() { - return this.parentName; - } - - public void setParentName(String newParentName) { - String oldParentName = this.parentName; - this.parentName = newParentName; - firePropertyChanged(PARENT_NAME_PROPERTY, oldParentName, newParentName); - } - - public Person getChild() { - return this.child; - } - } -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CollectionAspectAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CollectionAspectAdapterTests.java deleted file mode 100644 index b9542f9d21..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CollectionAspectAdapterTests.java +++ /dev/null @@ -1,372 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class CollectionAspectAdapterTests extends TestCase { - private TestSubject subject1; - private WritablePropertyValueModel subjectHolder1; - private LocalCollectionAspectAdapter aa1; - private CollectionEvent event1; - private CollectionChangeListener listener1; - private String event1Type; - - private static final String ADD = "add"; - private static final String REMOVE = "remove"; - private static final String CHANGE = "change"; - private static final String CLEAR = "clear"; - - private TestSubject subject2; - - public CollectionAspectAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.subject1 = new TestSubject(); - this.subject1.addNames(this.subject1Names()); - this.subject1.addDescriptions(this.subject1Descriptions()); - this.subjectHolder1 = new SimplePropertyValueModel(this.subject1); - this.aa1 = this.buildAspectAdapter(this.subjectHolder1); - this.listener1 = this.buildValueChangeListener1(); - this.aa1.addCollectionChangeListener(CollectionValueModel.VALUES, this.listener1); - this.event1 = null; - this.event1Type = null; - - this.subject2 = new TestSubject(); - this.subject2.addNames(this.subject2Names()); - this.subject2.addDescriptions(this.subject2Descriptions()); - } - - private Collection subject1Names() { - Collection result = new HashBag(); - result.add("foo"); - result.add("bar"); - return result; - } - - private Collection subject1Descriptions() { - Collection result = new HashBag(); - result.add("this.subject1 description1"); - result.add("this.subject1 description2"); - return result; - } - - private Collection subject2Names() { - Collection result = new HashBag(); - result.add("baz"); - result.add("bam"); - return result; - } - - private Collection subject2Descriptions() { - Collection result = new HashBag(); - result.add("this.subject2 description1"); - result.add("this.subject2 description2"); - return result; - } - - private LocalCollectionAspectAdapter buildAspectAdapter(PropertyValueModel subjectHolder) { - return new LocalCollectionAspectAdapter(subjectHolder); - } - - private CollectionChangeListener buildValueChangeListener1() { - return new CollectionChangeListener() { - public void itemsAdded(CollectionAddEvent e) { - CollectionAspectAdapterTests.this.value1Changed(e, ADD); - } - public void itemsRemoved(CollectionRemoveEvent e) { - CollectionAspectAdapterTests.this.value1Changed(e, REMOVE); - } - public void collectionCleared(CollectionClearEvent e) { - CollectionAspectAdapterTests.this.value1Changed(e, CLEAR); - } - public void collectionChanged(CollectionChangeEvent e) { - CollectionAspectAdapterTests.this.value1Changed(e, CHANGE); - } - }; - } - - void value1Changed(CollectionEvent e, String eventType) { - this.event1 = e; - this.event1Type = eventType; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testSubjectHolder() { - assertEquals(this.subject1Names(), CollectionTools.bag(this.aa1.iterator())); - assertNull(this.event1); - - this.subjectHolder1.setValue(this.subject2); - assertNotNull(this.event1); - assertEquals(this.event1Type, CHANGE); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(CollectionValueModel.VALUES, this.event1.getCollectionName()); - assertEquals(this.subject2Names(), CollectionTools.bag(this.aa1.iterator())); - - this.event1 = null; - this.event1Type = null; - this.subjectHolder1.setValue(null); - assertNotNull(this.event1); - assertEquals(this.event1Type, CHANGE); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(CollectionValueModel.VALUES, this.event1.getCollectionName()); - assertFalse(this.aa1.iterator().hasNext()); - - this.event1 = null; - this.event1Type = null; - this.subjectHolder1.setValue(this.subject1); - assertNotNull(this.event1); - assertEquals(this.event1Type, CHANGE); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(CollectionValueModel.VALUES, this.event1.getCollectionName()); - assertEquals(this.subject1Names(), CollectionTools.bag(this.aa1.iterator())); - } - - public void testAdd() { - assertEquals(this.subject1Names(), CollectionTools.bag(this.aa1.iterator())); - assertNull(this.event1); - - this.subject1.addName("jam"); - assertNotNull(this.event1); - assertEquals(this.event1Type, ADD); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(CollectionValueModel.VALUES, this.event1.getCollectionName()); - assertEquals("jam", ((CollectionAddEvent) this.event1).getItems().iterator().next()); - Collection namesPlus = this.subject1Names(); - namesPlus.add("jam"); - assertEquals(namesPlus, CollectionTools.bag(this.aa1.iterator())); - - this.event1 = null; - this.event1Type = null; - this.aa1.addAll(Collections.singleton("jaz")); - assertNotNull(this.event1); - assertEquals(this.event1Type, ADD); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(CollectionValueModel.VALUES, this.event1.getCollectionName()); - assertEquals("jaz", ((CollectionAddEvent) this.event1).getItems().iterator().next()); - namesPlus.add("jaz"); - assertEquals(namesPlus, CollectionTools.bag(this.aa1.iterator())); - } - - public void testRemove() { - assertEquals(this.subject1Names(), CollectionTools.bag(this.aa1.iterator())); - assertNull(this.event1); - - this.subject1.removeName("foo"); - assertNotNull(this.event1); - assertEquals(this.event1Type, REMOVE); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(CollectionValueModel.VALUES, this.event1.getCollectionName()); - assertEquals("foo", ((CollectionRemoveEvent) this.event1).getItems().iterator().next()); - Collection namesMinus = this.subject1Names(); - namesMinus.remove("foo"); - assertEquals(namesMinus, CollectionTools.bag(this.aa1.iterator())); - - this.event1 = null; - this.event1Type = null; - this.aa1.removeAll(Collections.singleton("bar")); - assertNotNull(this.event1); - assertEquals(this.event1Type, REMOVE); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(CollectionValueModel.VALUES, this.event1.getCollectionName()); - assertEquals("bar", ((CollectionRemoveEvent) this.event1).getItems().iterator().next()); - namesMinus.remove("bar"); - assertEquals(namesMinus, CollectionTools.bag(this.aa1.iterator())); - } - - public void testCollectionChange() { - assertEquals(this.subject1Names(), CollectionTools.bag(this.aa1.iterator())); - assertNull(this.event1); - - this.subject1.addTwoNames("jam", "jaz"); - assertNotNull(this.event1); - assertEquals(this.event1Type, CHANGE); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(CollectionValueModel.VALUES, this.event1.getCollectionName()); - Collection namesPlus2 = this.subject1Names(); - namesPlus2.add("jam"); - namesPlus2.add("jaz"); - assertEquals(namesPlus2, CollectionTools.bag(this.aa1.iterator())); - } - - public void testIterator() { - assertEquals(this.subject1Names(), CollectionTools.bag(this.subject1.names())); - assertEquals(this.subject1Names(), CollectionTools.bag(this.aa1.iterator())); - } - - public void testSize() { - assertEquals(this.subject1Names().size(), CollectionTools.size(this.subject1.names())); - assertEquals(this.subject1Names().size(), CollectionTools.size(this.aa1.iterator())); - } - - public void testHasListeners() { - assertTrue(this.aa1.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - assertTrue(this.subject1.hasAnyCollectionChangeListeners(TestSubject.NAMES_COLLECTION)); - this.aa1.removeCollectionChangeListener(CollectionValueModel.VALUES, this.listener1); - assertFalse(this.subject1.hasAnyCollectionChangeListeners(TestSubject.NAMES_COLLECTION)); - assertFalse(this.aa1.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - - ChangeListener listener2 = new ChangeAdapter(); - this.aa1.addChangeListener(listener2); - assertTrue(this.aa1.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - assertTrue(this.subject1.hasAnyCollectionChangeListeners(TestSubject.NAMES_COLLECTION)); - this.aa1.removeChangeListener(listener2); - assertFalse(this.subject1.hasAnyCollectionChangeListeners(TestSubject.NAMES_COLLECTION)); - assertFalse(this.aa1.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - } - - - // ********** inner class ********** - - private class TestSubject extends AbstractModel { - private Collection names; - public static final String NAMES_COLLECTION = "names"; - private Collection descriptions; - public static final String DESCRIPTIONS_COLLECTION = "descriptions"; - - public TestSubject() { - this.names = new HashBag(); - this.descriptions = new HashBag(); - } - public Iterator names() { - return new ReadOnlyIterator(this.names); - } - public void addName(String name) { - if (this.names.add(name)) { - this.fireItemAdded(NAMES_COLLECTION, name); - } - } - public void addNames(Iterator newNames) { - while (newNames.hasNext()) { - this.addName(newNames.next()); - } - } - public void addNames(Collection newNames) { - this.addNames(newNames.iterator()); - } - public void addTwoNames(String name1, String name2) { - if (this.names.add(name1) | this.names.add(name2)) { - this.fireCollectionChanged(NAMES_COLLECTION, this.names); - } - } - public void removeName(String name) { - if (this.names.remove(name)) { - this.fireItemRemoved(NAMES_COLLECTION, name); - } - } - public Iterator descriptions() { - return new ReadOnlyIterator(this.descriptions); - } - public void addDescription(String description) { - if (this.descriptions.add(description)) { - this.fireItemAdded(DESCRIPTIONS_COLLECTION, description); - } - } - public void addDescriptions(Iterator newDescriptions) { - while (newDescriptions.hasNext()) { - this.addDescription(newDescriptions.next()); - } - } - public void addDescriptions(Collection newDescriptions) { - this.addDescriptions(newDescriptions.iterator()); - } - public void removeDescription(String description) { - if (this.descriptions.remove(description)) { - this.fireItemRemoved(DESCRIPTIONS_COLLECTION, description); - } - } - } - - // this is not a typical aspect adapter - the value is determined by the aspect name - private class LocalCollectionAspectAdapter extends CollectionAspectAdapter { - - LocalCollectionAspectAdapter(PropertyValueModel subjectHolder) { - super(subjectHolder, TestSubject.NAMES_COLLECTION); - } - - @Override - protected Iterator iterator_() { - if (this.collectionNames[0] == TestSubject.NAMES_COLLECTION) { - return this.subject.names(); - } - if (this.collectionNames[0] == TestSubject.DESCRIPTIONS_COLLECTION) { - return this.subject.descriptions(); - } - throw new IllegalStateException("invalid aspect name: " + this.collectionNames[0]); - } - - public void add(String item) { - if (this.collectionNames[0] == TestSubject.NAMES_COLLECTION) { - this.subject.addName(item); - } else if (this.collectionNames[0] == TestSubject.DESCRIPTIONS_COLLECTION) { - this.subject.addDescription(item); - } else { - throw new IllegalStateException("invalid aspect name: " + this.collectionNames[0]); - } - } - - public void addAll(Collection items) { - for (Iterator stream = items.iterator(); stream.hasNext(); ) { - this.add(stream.next()); - } - } - - public void remove(Object item) { - if (this.collectionNames[0] == TestSubject.NAMES_COLLECTION) { - this.subject.removeName((String) item); - } else if (this.collectionNames[0] == TestSubject.DESCRIPTIONS_COLLECTION) { - this.subject.removeDescription((String) item); - } else { - throw new IllegalStateException("invalid aspect name: " + this.collectionNames[0]); - } - } - - public void removeAll(Collection items) { - for (Iterator stream = items.iterator(); stream.hasNext(); ) { - this.remove(stream.next()); - } - } - - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CollectionListValueModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CollectionListValueModelAdapterTests.java deleted file mode 100644 index 7c0a154f5b..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CollectionListValueModelAdapterTests.java +++ /dev/null @@ -1,247 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.Collection; -import java.util.List; - -import javax.swing.JList; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.Bag; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionListValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ListModelAdapter; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class CollectionListValueModelAdapterTests extends TestCase { - private ListValueModel adapter; - private SimpleCollectionValueModel wrappedCollectionHolder; - private Collection wrappedCollection; - - public CollectionListValueModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.wrappedCollection = new HashBag(); - this.wrappedCollectionHolder = new SimpleCollectionValueModel(this.wrappedCollection); - this.adapter = new CollectionListValueModelAdapter(this.wrappedCollectionHolder); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testIterator() { - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() { - @Override - public void itemsAdded(ListAddEvent e) {/* OK */} - }); - this.wrappedCollectionHolder.add("foo"); - this.wrappedCollectionHolder.add("bar"); - this.wrappedCollectionHolder.add("baz"); - Collection adapterCollection = this.adapterCollection(); - assertEquals(3, adapterCollection.size()); - assertEquals(this.wrappedCollection, adapterCollection); - } - - private Collection adapterCollection() { - return CollectionTools.collection(this.adapter.iterator()); - } - - public void testStaleValue() { - ListChangeListener listener = new TestListChangeListener() { - @Override - public void itemsAdded(ListAddEvent e) {/* OK */} - }; - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, listener); - this.wrappedCollectionHolder.add("foo"); - this.wrappedCollectionHolder.add("bar"); - this.wrappedCollectionHolder.add("baz"); - Collection adapterCollection = this.adapterCollection(); - assertEquals(3, adapterCollection.size()); - assertEquals(this.wrappedCollection, adapterCollection); - - this.adapter.removeListChangeListener(ListValueModel.LIST_VALUES, listener); - adapterCollection = this.adapterCollection(); - assertEquals(0, adapterCollection.size()); - assertEquals(new HashBag(), adapterCollection); - - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, listener); - adapterCollection = this.adapterCollection(); - assertEquals(3, adapterCollection.size()); - assertEquals(this.wrappedCollection, adapterCollection); - } - - public void testAdd() { - List synchList = new CoordinatedList(this.adapter); - Bag synchCollection = new CoordinatedBag(this.wrappedCollectionHolder); - this.wrappedCollectionHolder.add("foo"); - assertTrue(this.wrappedCollection.contains("foo")); - this.wrappedCollectionHolder.add("bar"); - this.wrappedCollectionHolder.add("baz"); - this.wrappedCollectionHolder.add("joo"); - this.wrappedCollectionHolder.add("jar"); - this.wrappedCollectionHolder.add("jaz"); - assertEquals(6, this.wrappedCollection.size()); - - Collection adapterCollection = this.adapterCollection(); - assertEquals(this.wrappedCollection, adapterCollection); - assertEquals(this.wrappedCollection, CollectionTools.collection(synchList.iterator())); - assertEquals(this.wrappedCollection, synchCollection); - } - - public void testRemove() { - List synchList = new CoordinatedList(this.adapter); - Bag synchCollection = new CoordinatedBag(this.wrappedCollectionHolder); - this.wrappedCollectionHolder.add("foo"); - this.wrappedCollectionHolder.add("bar"); - this.wrappedCollectionHolder.add("baz"); - this.wrappedCollectionHolder.add("joo"); - this.wrappedCollectionHolder.add("jar"); - this.wrappedCollectionHolder.add("jaz"); - assertTrue(this.wrappedCollection.contains("jaz")); - this.wrappedCollectionHolder.remove("jaz"); - assertFalse(this.wrappedCollection.contains("jaz")); - this.wrappedCollectionHolder.remove("foo"); - assertFalse(this.wrappedCollection.contains("foo")); - assertEquals(4, this.wrappedCollection.size()); - - Collection adapterCollection = this.adapterCollection(); - assertEquals(this.wrappedCollection, adapterCollection); - assertEquals(this.wrappedCollection, CollectionTools.collection(synchList.iterator())); - assertEquals(this.wrappedCollection, synchCollection); - } - - public void testListSynch() { - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() { - @Override - public void itemsAdded(ListAddEvent e) {/* OK */} - @Override - public void itemsRemoved(ListRemoveEvent e) {/* OK */} - }); - this.wrappedCollectionHolder.add("foo"); - this.wrappedCollectionHolder.add("bar"); - this.wrappedCollectionHolder.add("baz"); - this.wrappedCollectionHolder.add("joo"); - this.wrappedCollectionHolder.add("jar"); - this.wrappedCollectionHolder.add("jaz"); - this.wrappedCollectionHolder.remove("jaz"); - assertFalse(this.wrappedCollection.contains("jaz")); - this.wrappedCollectionHolder.remove("foo"); - assertFalse(this.wrappedCollection.contains("foo")); - assertEquals(4, this.wrappedCollection.size()); - - Collection adapterCollection = this.adapterCollection(); - assertEquals(this.wrappedCollection, adapterCollection); - } - - public void testHasListeners() { - assertFalse(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - CoordinatedList synchList = new CoordinatedList(this.adapter); - assertTrue(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - this.adapter.removeListChangeListener(ListValueModel.LIST_VALUES, synchList); - assertFalse(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - ChangeListener cl = new ChangeAdapter(); - this.adapter.addChangeListener(cl); - assertTrue(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - this.adapter.removeChangeListener(cl); - assertFalse(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - } - - public void testCollectionChangedToEmpty() { - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() { - @Override - public void listCleared(ListClearEvent e) {/* OK */} - @Override - public void itemsAdded(ListAddEvent e) {/* OK */} - }); - this.wrappedCollectionHolder.add("foo"); - this.wrappedCollectionHolder.add("bar"); - this.wrappedCollectionHolder.add("baz"); - JList jList = new JList(new ListModelAdapter(this.adapter)); - this.wrappedCollectionHolder.setValues(new HashBag()); - assertEquals(0, jList.getModel().getSize()); - } - - public void testCollectionChangedFromEmpty() { - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() { - @Override - public void itemsAdded(ListAddEvent e) {/* OK */} - @Override - public void itemsRemoved(ListRemoveEvent e) {/* OK */} - }); - JList jList = new JList(new ListModelAdapter(this.adapter)); - - HashBag bag = new HashBag(); - bag.add("foo"); - bag.add("bar"); - this.wrappedCollectionHolder.setValues(bag); - assertEquals(2, jList.getModel().getSize()); - } - - public void testCollectionChangedFromEmptyToEmpty() { - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() { - @Override - public void itemsAdded(ListAddEvent e) {/* OK */} - @Override - public void itemsRemoved(ListRemoveEvent e) {/* OK */} - }); - JList jList = new JList(new ListModelAdapter(this.adapter)); - - HashBag bag = new HashBag(); - this.wrappedCollectionHolder.setValues(bag); - assertEquals(0, jList.getModel().getSize()); - } - - - class TestListChangeListener implements ListChangeListener { - public void itemsAdded(ListAddEvent e) { - fail("unexpected event"); - } - public void itemsRemoved(ListRemoveEvent e) { - fail("unexpected event"); - } - public void itemsReplaced(ListReplaceEvent e) { - fail("unexpected event"); - } - public void itemsMoved(ListMoveEvent e) { - fail("unexpected event"); - } - public void listCleared(ListClearEvent e) { - fail("unexpected event"); - } - public void listChanged(ListChangeEvent e) { - fail("unexpected event"); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CollectionPropertyValueModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CollectionPropertyValueModelAdapterTests.java deleted file mode 100644 index 559c12635d..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CollectionPropertyValueModelAdapterTests.java +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.Collection; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionPropertyValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class CollectionPropertyValueModelAdapterTests extends TestCase { - private WritablePropertyValueModel adapter; - private SimpleCollectionValueModel wrappedCollectionHolder; - PropertyChangeEvent event; - - public CollectionPropertyValueModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.wrappedCollectionHolder = new SimpleCollectionValueModel(); - this.adapter = new LocalAdapter(this.wrappedCollectionHolder, "666"); - this.event = null; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - private boolean booleanValue() { - return this.adapter.getValue().booleanValue(); - } - - private Collection wrappedCollection() { - return CollectionTools.collection(this.wrappedCollectionHolder.iterator()); - } - - public void testValue() { - this.adapter.addPropertyChangeListener(PropertyValueModel.VALUE, new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) {/* OK */} - }); - assertFalse(this.booleanValue()); - assertFalse(this.wrappedCollection().contains("666")); - - this.wrappedCollectionHolder.add("111"); - assertFalse(this.booleanValue()); - - this.wrappedCollectionHolder.add("222"); - assertFalse(this.booleanValue()); - - this.wrappedCollectionHolder.add("666"); - assertTrue(this.booleanValue()); - assertTrue(this.wrappedCollection().contains("666")); - - this.wrappedCollectionHolder.remove("666"); - assertFalse(this.booleanValue()); - assertFalse(this.wrappedCollection().contains("666")); - - this.wrappedCollectionHolder.add("666"); - assertTrue(this.booleanValue()); - assertTrue(this.wrappedCollection().contains("666")); - - this.wrappedCollectionHolder.clear(); - assertFalse(this.booleanValue()); - assertFalse(this.wrappedCollection().contains("666")); - } - - public void testSetValue() { - this.adapter.addPropertyChangeListener(PropertyValueModel.VALUE, new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) {/* OK */} - }); - assertFalse(this.booleanValue()); - assertFalse(this.wrappedCollection().contains("666")); - - this.adapter.setValue(Boolean.TRUE); - assertTrue(this.booleanValue()); - assertTrue(this.wrappedCollection().contains("666")); - - this.adapter.setValue(Boolean.FALSE); - assertFalse(this.booleanValue()); - assertFalse(this.wrappedCollection().contains("666")); - } - - public void testEventFiring() { - this.adapter.addPropertyChangeListener(PropertyValueModel.VALUE, new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - CollectionPropertyValueModelAdapterTests.this.event = e; - } - }); - assertNull(this.event); - - this.wrappedCollectionHolder.add("111"); - assertNull(this.event); - - this.wrappedCollectionHolder.add("222"); - assertNull(this.event); - - this.wrappedCollectionHolder.add("666"); - this.verifyEvent(false, true); - - this.wrappedCollectionHolder.remove("666"); - this.verifyEvent(true, false); - - this.wrappedCollectionHolder.add("666"); - this.verifyEvent(false, true); - - this.wrappedCollectionHolder.clear(); - this.verifyEvent(true, false); - } - - private void verifyEvent(boolean oldValue, boolean newValue) { - assertEquals(this.adapter, this.event.getSource()); - assertEquals(Boolean.valueOf(oldValue), this.event.getOldValue()); - assertEquals(Boolean.valueOf(newValue), this.event.getNewValue()); - this.event = null; - } - - public void testStaleValue() { - PropertyChangeListener listener = new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) {/* OK */} - }; - this.adapter.addPropertyChangeListener(PropertyValueModel.VALUE, listener); - this.wrappedCollectionHolder.add("666"); - assertTrue(this.booleanValue()); - assertTrue(this.wrappedCollection().contains("666")); - - this.adapter.removePropertyChangeListener(PropertyValueModel.VALUE, listener); - assertFalse(this.booleanValue()); - assertTrue(this.wrappedCollection().contains("666")); - - this.adapter.addPropertyChangeListener(PropertyValueModel.VALUE, listener); - assertTrue(this.booleanValue()); - assertTrue(this.wrappedCollection().contains("666")); - } - - public void testHasListeners() { - assertFalse(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertFalse(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - - ChangeListener listener = new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) {/* OK */} - }; - this.adapter.addPropertyChangeListener(PropertyValueModel.VALUE, listener); - assertTrue(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - - this.adapter.removePropertyChangeListener(PropertyValueModel.VALUE, listener); - assertFalse(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertFalse(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - - this.adapter.addChangeListener(listener); - assertTrue(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - - this.adapter.removeChangeListener(listener); - assertFalse(((AbstractModel) this.adapter).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertFalse(((AbstractModel) this.wrappedCollectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - } - - - // ********** member class ********** - - /** - * the value is true if the wrapped collection contains the specified item, - * otherwise the value is false - */ - static class LocalAdapter - extends CollectionPropertyValueModelAdapter - implements WritablePropertyValueModel - { - private String item; - - LocalAdapter(CollectionValueModel collectionHolder, String item) { - super(collectionHolder); - this.item = item; - } - - // ********** CollectionPropertyValueModelAdapter implementation ********** - /** - * always return a Boolean - */ - @Override - public Boolean getValue() { - Boolean result = super.getValue(); - return (result == null) ? Boolean.FALSE : result; - } - @SuppressWarnings("unchecked") - public void setValue(Boolean value) { - if (this.booleanValue()) { - if ( ! this.booleanValueOf(value)) { - // the value is changing from true to false - ((SimpleCollectionValueModel) this.collectionModel).remove(this.item); - } - } else { - if (this.booleanValueOf(value)) { - // the value is changing from false to true - ((SimpleCollectionValueModel) this.collectionModel).add(this.item); - } - } - } - @Override - protected Boolean buildValue() { - return Boolean.valueOf(CollectionTools.contains(this.collectionModel.iterator(), this.item)); - } - - // ********** internal methods ********** - private boolean booleanValue() { - return this.booleanValueOf(this.value); - } - private boolean booleanValueOf(Object b) { - return (b == null) ? false : ((Boolean) b).booleanValue(); - } - - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositeBooleanPropertyValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositeBooleanPropertyValueModelTests.java deleted file mode 100644 index 1cd4bb25cb..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositeBooleanPropertyValueModelTests.java +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.model.value.CompositeBooleanPropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -public class CompositeBooleanPropertyValueModelTests extends TestCase { - private SimplePropertyValueModel pvm1; - private WritablePropertyValueModel pvm2; - private WritablePropertyValueModel pvm3; - private WritablePropertyValueModel pvm4; - private Collection> collection; - private SimpleCollectionValueModel> cvm; - private PropertyValueModel compositePVM; - PropertyChangeEvent event; - - - public CompositeBooleanPropertyValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.pvm1 = new SimplePropertyValueModel(Boolean.TRUE); - this.pvm2 = new SimplePropertyValueModel(Boolean.TRUE); - this.pvm3 = new SimplePropertyValueModel(Boolean.TRUE); - this.pvm4 = new SimplePropertyValueModel(Boolean.TRUE); - this.collection = new ArrayList>(); - this.collection.add(this.pvm1); - this.collection.add(this.pvm2); - this.collection.add(this.pvm3); - this.collection.add(this.pvm4); - this.cvm = new SimpleCollectionValueModel>(this.collection); - - this.compositePVM = this.buildCompositePVM(cvm); - } - - private PropertyValueModel buildCompositePVM(CollectionValueModel> pvms) { - return CompositeBooleanPropertyValueModel.and(pvms); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testGetValue() { - assertNull(this.compositePVM.getValue()); - ChangeListener listener = this.buildListener(); - this.compositePVM.addChangeListener(listener); - assertTrue(this.compositePVM.getValue().booleanValue()); - } - - public void testValueAndListeners1() { - assertNull(this.compositePVM.getValue()); - ChangeListener listener = this.buildListener(); - this.compositePVM.addChangeListener(listener); - assertTrue(this.compositePVM.getValue().booleanValue()); - this.compositePVM.removeChangeListener(listener); - assertNull(this.compositePVM.getValue()); - } - - public void testValueAndListeners2() { - assertNull(this.compositePVM.getValue()); - ChangeListener listener = this.buildListener(); - this.compositePVM.addPropertyChangeListener(PropertyValueModel.VALUE, listener); - assertTrue(this.compositePVM.getValue().booleanValue()); - this.compositePVM.removePropertyChangeListener(PropertyValueModel.VALUE, listener); - assertNull(this.compositePVM.getValue()); - } - - public void testPropertyChange1() { - this.compositePVM.addChangeListener(this.buildListener()); - this.verifyPropertyChange(); - } - - public void testPropertyChange2() { - this.compositePVM.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildListener()); - this.verifyPropertyChange(); - } - - private void verifyPropertyChange() { - this.event = null; - this.pvm1.setValue(Boolean.FALSE); - this.verifyEvent(true, false); - - this.event = null; - this.pvm2.setValue(Boolean.FALSE); - assertNull(this.event); // no change - - this.event = null; - this.pvm2.setValue(Boolean.TRUE); - assertNull(this.event); // no change - - this.event = null; - this.pvm1.setValue(Boolean.TRUE); - this.verifyEvent(false, true); - - this.event = null; - this.pvm4.setValue(Boolean.FALSE); - this.verifyEvent(true, false); - } - - public void testCollectionChange1() { - this.compositePVM.addChangeListener(this.buildListener()); - this.verifyCollectionChange(); - } - - public void testCollectionChange2() { - this.compositePVM.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildListener()); - this.verifyCollectionChange(); - } - - private void verifyCollectionChange() { - this.event = null; - WritablePropertyValueModel pvm = new SimplePropertyValueModel(Boolean.FALSE); - this.cvm.add(pvm); - this.verifyEvent(true, false); - - this.event = null; - this.cvm.remove(pvm); - this.verifyEvent(false, true); - - this.event = null; - this.cvm.clear(); - this.verifyEvent(Boolean.TRUE, null); - - Collection> c2 = new ArrayList>(); - c2.add(this.pvm1); - c2.add(this.pvm2); - this.event = null; - this.cvm.setValues(c2); - this.verifyEvent(null, Boolean.TRUE); - } - - public void testLazyListening1() { - assertFalse(this.pvm1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - ChangeListener listener = this.buildListener(); - - this.compositePVM.addChangeListener(listener); - assertTrue(this.pvm1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - this.compositePVM.removeChangeListener(listener); - assertFalse(this.pvm1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - } - - public void testLazyListening2() { - assertFalse(this.pvm1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - ChangeListener listener = this.buildListener(); - - this.compositePVM.addPropertyChangeListener(PropertyValueModel.VALUE, listener); - assertTrue(this.pvm1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - this.compositePVM.removePropertyChangeListener(PropertyValueModel.VALUE, listener); - assertFalse(this.pvm1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - } - - private ChangeListener buildListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - CompositeBooleanPropertyValueModelTests.this.event = e; - } - }; - } - - private void verifyEvent(boolean oldValue, boolean newValue) { - this.verifyEvent(Boolean.valueOf(oldValue), Boolean.valueOf(newValue)); - } - - private void verifyEvent(Boolean oldValue, Boolean newValue) { - assertEquals(this.compositePVM, this.event.getSource()); - assertEquals(PropertyValueModel.VALUE, this.event.getPropertyName()); - assertEquals(oldValue, this.event.getOldValue()); - assertEquals(newValue, this.event.getNewValue()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositeCollectionValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositeCollectionValueModelTests.java deleted file mode 100644 index 1f0c74218c..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositeCollectionValueModelTests.java +++ /dev/null @@ -1,415 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.Bag; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.CompositeCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class CompositeCollectionValueModelTests extends TestCase { - private Neighborhood neighborhood; - private WritablePropertyValueModel neighborhoodHolder; - - public CompositeCollectionValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.neighborhood = new Neighborhood("Hanna-Barbera"); - this.neighborhoodHolder = new SimplePropertyValueModel(this.neighborhood); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testSynch1() { - this.verifySynch(this.buildAllMembersComposite(this.neighborhoodHolder)); - } - - public void testSynch2() { - this.verifySynch(this.buildAllMembersComposite2(this.neighborhoodHolder)); - } - - private void verifySynch(CollectionValueModel compositeCVM) { - assertEquals(0, CollectionTools.size(compositeCVM.iterator())); - Bag familiesSynch = new CoordinatedBag(this.buildFamiliesAspectAdapter(this.neighborhoodHolder)); - Bag membersSynch = new CoordinatedBag(compositeCVM); - this.populateNeighborhood(this.neighborhood); - - Family jetsons = this.neighborhood.familyNamed("Jetson"); - - assertEquals(3, familiesSynch.size()); - assertEquals(12, CollectionTools.size(this.neighborhood.allMembers())); - assertEquals(12, membersSynch.size()); - assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch); - assertEquals(membersSynch, CollectionTools.bag(compositeCVM.iterator())); - - jetsons.removeMember(jetsons.memberNamed("Astro")); - assertEquals(3, familiesSynch.size()); - assertEquals(11, CollectionTools.size(this.neighborhood.allMembers())); - assertEquals(11, membersSynch.size()); - assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch); - assertEquals(membersSynch, CollectionTools.bag(compositeCVM.iterator())); - - jetsons.removeMember(jetsons.memberNamed("Judy")); - assertEquals(3, familiesSynch.size()); - assertEquals(10, CollectionTools.size(this.neighborhood.allMembers())); - assertEquals(10, membersSynch.size()); - assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch); - assertEquals(membersSynch, CollectionTools.bag(compositeCVM.iterator())); - - jetsons.addMember("Fido"); - assertEquals(3, familiesSynch.size()); - assertEquals(11, CollectionTools.size(this.neighborhood.allMembers())); - assertEquals(11, membersSynch.size()); - assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch); - assertEquals(membersSynch, CollectionTools.bag(compositeCVM.iterator())); - - this.neighborhood.removeFamily(jetsons); - assertEquals(2, familiesSynch.size()); - assertEquals(7, CollectionTools.size(this.neighborhood.allMembers())); - assertEquals(7, membersSynch.size()); - assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch); - assertEquals(membersSynch, CollectionTools.bag(compositeCVM.iterator())); - - Family bears = this.neighborhood.addFamily("Bear"); - bears.addMember("Yogi"); - assertEquals(3, familiesSynch.size()); - assertEquals(8, CollectionTools.size(this.neighborhood.allMembers())); - assertEquals(8, membersSynch.size()); - assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch); - assertEquals(membersSynch, CollectionTools.bag(compositeCVM.iterator())); - - bears.addMember("Boo-Boo"); - assertEquals(3, familiesSynch.size()); - assertEquals(9, CollectionTools.size(this.neighborhood.allMembers())); - assertEquals(9, membersSynch.size()); - assertEquals(CollectionTools.bag(this.neighborhood.allMembers()), membersSynch); - assertEquals(membersSynch, CollectionTools.bag(compositeCVM.iterator())); - - Neighborhood n2 = new Neighborhood("Hanna-Barbera 2"); - this.neighborhoodHolder.setValue(n2); - this.populateNeighborhood(n2); - assertEquals(3, familiesSynch.size()); - assertEquals(12, CollectionTools.size(n2.allMembers())); - assertEquals(12, membersSynch.size()); - assertEquals(CollectionTools.bag(n2.allMembers()), membersSynch); - assertEquals(membersSynch, CollectionTools.bag(compositeCVM.iterator())); - } - - public void testNoTransformer() { - SimpleCollectionValueModel subCVM1 = new SimpleCollectionValueModel(); - SimpleCollectionValueModel subCVM2 = new SimpleCollectionValueModel(); - Collection> collection = new ArrayList>(); - collection.add(subCVM1); - collection.add(subCVM2); - Bag synchBag = new CoordinatedBag(new CompositeCollectionValueModel, String>(collection)); - - assertEquals(0, synchBag.size()); - - subCVM1.add("foo"); - subCVM1.add("bar"); - subCVM1.add("baz"); - assertEquals(3, synchBag.size()); - assertTrue(synchBag.contains("foo")); - - subCVM2.add("joo"); - subCVM2.add("jar"); - subCVM2.add("jaz"); - assertEquals(6, synchBag.size()); - assertTrue(synchBag.contains("foo")); - assertTrue(synchBag.contains("jaz")); - - subCVM1.remove("baz"); - assertEquals(5, synchBag.size()); - assertFalse(synchBag.contains("baz")); - } - - public void testDuplicateItem() { - Bag synchBag = new CoordinatedBag(this.buildAllMembersComposite(this.neighborhoodHolder)); - this.populateNeighborhood(this.neighborhood); - boolean exCaught = false; - try { - this.neighborhood.addFamily(this.neighborhood.familyNamed("Jetson")); - } catch (IllegalStateException ex) { - if (ex.getMessage().indexOf("duplicate component") != -1) { - exCaught = true; - } - } - assertTrue(exCaught); - assertEquals(12, synchBag.size()); - } - - public void testHasListeners() { - CompositeCollectionValueModel compositeCVM = this.buildAllMembersComposite(this.neighborhoodHolder); - CoordinatedBag synchBag = new CoordinatedBag(compositeCVM); - this.populateNeighborhood(this.neighborhood); - Family jetsons = this.neighborhood.familyNamed("Jetson"); - - assertTrue(compositeCVM.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - assertTrue(jetsons.hasAnyCollectionChangeListeners(Family.MEMBERS_COLLECTION)); - - compositeCVM.removeCollectionChangeListener(CollectionValueModel.VALUES, synchBag); - assertFalse(compositeCVM.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - assertFalse(jetsons.hasAnyCollectionChangeListeners(Family.MEMBERS_COLLECTION)); - - compositeCVM.addCollectionChangeListener(CollectionValueModel.VALUES, synchBag); - assertTrue(compositeCVM.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - assertTrue(jetsons.hasAnyCollectionChangeListeners(Family.MEMBERS_COLLECTION)); - } - - private void populateNeighborhood(Neighborhood n) { - Family family1 = n.addFamily("Flintstone"); - family1.addMember("Fred"); - family1.addMember("Wilma"); - family1.addMember("Pebbles"); - family1.addMember("Dino"); - Family family2 = n.addFamily("Rubble"); - family2.addMember("Barney"); - family2.addMember("Betty"); - family2.addMember("Bamm-Bamm"); - Family family3 = n.addFamily("Jetson"); - family3.addMember("George"); - family3.addMember("Jane"); - family3.addMember("Judy"); - family3.addMember("Elroy"); - family3.addMember("Astro"); - } - - private CollectionValueModel buildFamiliesAspectAdapter(PropertyValueModel communeHolder) { - return new CollectionAspectAdapter(communeHolder, Neighborhood.FAMILIES_COLLECTION) { - @Override - protected Iterator iterator_() { - return this.subject.families(); - } - }; - } - - CollectionValueModel buildMembersAdapter(Family family) { - return new CollectionAspectAdapter(Family.MEMBERS_COLLECTION, family) { - @Override - protected Iterator iterator_() { - return this.subject.members(); - } - }; - } - - private CompositeCollectionValueModel buildAllMembersComposite(PropertyValueModel communeHolder) { - // override #transform(Object) - return new CompositeCollectionValueModel(this.buildFamiliesAspectAdapter(communeHolder)) { - @Override - protected CollectionValueModel transform(Family family) { - return CompositeCollectionValueModelTests.this.buildMembersAdapter(family); - } - }; - } - - private CollectionValueModel buildAllMembersComposite2(PropertyValueModel communeHolder) { - // build a custom Transformer - return new CompositeCollectionValueModel(this.buildFamiliesAspectAdapter(communeHolder), this.buildTransformer()); - } - - private Transformer> buildTransformer() { - return new Transformer>() { - public CollectionValueModel transform(Family family) { - return CompositeCollectionValueModelTests.this.buildMembersAdapter(family); - } - @Override - public String toString() { - return "Local Transformer"; - } - }; - } - - -// ********** inner classes ********** - - /** - * inner class - */ - public class Neighborhood extends AbstractModel { - private String name; - public static final String NAME_PROPERTY = "name"; - private Collection families = new ArrayList(); - public static final String FAMILIES_COLLECTION = "families"; - - public Neighborhood(String name) { - super(); - this.name = name; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - Object old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - public Iterator families() { - return this.families.iterator(); - } - - public Family addFamily(String familyName) { - return this.addFamily(new Family(familyName)); - } - - // backdoor to allow duplicates - public Family addFamily(Family family) { - this.addItemToCollection(family, this.families, FAMILIES_COLLECTION); - return family; - } - - public void removeFamily(Family family) { - this.removeItemFromCollection(family, this.families, FAMILIES_COLLECTION); - } - - public Family familyNamed(String familyName) { - for (Family family : this.families) { - if (family.getName().equals(familyName)) { - return family; - } - } - throw new IllegalArgumentException(familyName); - } - - public Iterator allMembers() { - return new CompositeIterator(this.membersIterators()); - } - - private Iterator> membersIterators() { - return new TransformationIterator>(this.families()) { - @Override - protected Iterator transform(Family family) { - return family.members(); - } - }; - } - - public Member memberNamed(String familyName, String memberName) { - return this.familyNamed(familyName).memberNamed(memberName); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - } - - - /** - * inner class - */ - public class Family extends AbstractModel { - private String name; - public static final String NAME_PROPERTY = "name"; - private Collection members = new ArrayList(); - public static final String MEMBERS_COLLECTION = "members"; - - public Family(String name) { - super(); - this.name = name; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - Object old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - public Iterator members() { - return this.members.iterator(); - } - - public Member addMember(String memberName) { - Member member = new Member(memberName); - this.addItemToCollection(member, this.members, MEMBERS_COLLECTION); - return member; - } - - public void removeMember(Member member) { - this.removeItemFromCollection(member, this.members, MEMBERS_COLLECTION); - } - - public Member memberNamed(String memberName) { - for (Member member : this.members) { - if (member.getName().equals(memberName)) { - return member; - } - } - throw new IllegalArgumentException(memberName); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - } - - - /** - * inner class - */ - public class Member extends AbstractModel { - private String name; - public static final String NAME_PROPERTY = "name"; - - public Member(String name) { - super(); - this.name = name; - } - - public String getName() { - return this.name; - } - - public void setName(String name) { - Object old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositeListValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositeListValueModelTests.java deleted file mode 100644 index 82cf531454..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositeListValueModelTests.java +++ /dev/null @@ -1,1248 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.model.value.CompositeListValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class CompositeListValueModelTests extends TestCase { - private LocalListValueModel lvm0; - private LocalListValueModel lvm1; - private LocalListValueModel lvm2; - private LocalListValueModel lvm3; - private LocalListValueModel> uberLVM; - private CompositeListValueModel, String> compositeLVM; - - public CompositeListValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - - this.lvm0 = new LocalListValueModel(); - this.lvm0.add("aaa"); - this.lvm0.add("bbb"); - this.lvm0.add("ccc"); - - this.lvm1 = new LocalListValueModel(); - this.lvm1.add("ddd"); - this.lvm1.add("eee"); - - this.lvm2 = new LocalListValueModel(); - this.lvm2.add("fff"); - - this.lvm3 = new LocalListValueModel(); - this.lvm3.add("ggg"); - this.lvm3.add("hhh"); - this.lvm3.add("iii"); - this.lvm3.add("jjj"); - this.lvm3.add("kkk"); - - this.uberLVM = new LocalListValueModel>(); - this.uberLVM.add(this.lvm0); - this.uberLVM.add(this.lvm1); - this.uberLVM.add(this.lvm2); - this.uberLVM.add(this.lvm3); - - this.compositeLVM = new CompositeListValueModel, String>((ListValueModel>) this.uberLVM); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testGetInt() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - assertEquals("aaa", this.compositeLVM.get(0)); - assertEquals("aaa", coordList.get(0)); - assertEquals("bbb", this.compositeLVM.get(1)); - assertEquals("bbb", coordList.get(1)); - assertEquals("ccc", this.compositeLVM.get(2)); - assertEquals("ccc", coordList.get(2)); - - assertEquals("ddd", this.compositeLVM.get(3)); - assertEquals("ddd", coordList.get(3)); - assertEquals("eee", this.compositeLVM.get(4)); - assertEquals("eee", coordList.get(4)); - - assertEquals("fff", this.compositeLVM.get(5)); - assertEquals("fff", coordList.get(5)); - - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testIterator() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - assertEquals("aaa", this.compositeLVM.iterator().next()); - assertEquals("aaa", coordList.iterator().next()); - Iterator stream1 = coordList.iterator(); - for (Iterator stream2 = this.compositeLVM.iterator(); stream2.hasNext(); ) { - assertEquals(stream1.next(), stream2.next()); - } - assertFalse(stream1.hasNext()); - } - - public void testSize() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - assertEquals(11, this.compositeLVM.size()); - assertEquals(11, coordList.size()); - } - - public void testToArray() { - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - } - - public void testHasListeners() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - assertTrue(this.compositeLVM.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertTrue(this.lvm0.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - this.compositeLVM.removeListChangeListener(ListValueModel.LIST_VALUES, coordList); - assertFalse(this.compositeLVM.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertFalse(this.lvm0.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, coordList); - assertTrue(this.compositeLVM.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertTrue(this.lvm0.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - } - - public void testAddSource_Begin() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - LocalListValueModel lvm = new LocalListValueModel(); - lvm.add("xxx"); - lvm.add("yyy"); - lvm.add("zzz"); - this.uberLVM.add(0, lvm); - - Object[] expected = new Object[] { "xxx", "yyy", "zzz", "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(9)); - assertEquals("ggg", coordList.get(9)); - } - - public void testAddSource_Middle() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - LocalListValueModel lvm = new LocalListValueModel(); - lvm.add("xxx"); - lvm.add("yyy"); - lvm.add("zzz"); - this.uberLVM.add(2, lvm); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "xxx", "yyy", "zzz", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(9)); - assertEquals("ggg", coordList.get(9)); - } - - public void testAddSource_End() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - LocalListValueModel lvm = new LocalListValueModel(); - lvm.add("xxx"); - lvm.add("yyy"); - lvm.add("zzz"); - this.uberLVM.add(lvm); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk", "xxx", "yyy", "zzz" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testAddSources() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - LocalListValueModel lvmA = new LocalListValueModel(); - lvmA.add("xxx"); - lvmA.add("yyy"); - lvmA.add("zzz"); - LocalListValueModel lvmB = new LocalListValueModel(); - lvmB.add("ppp"); - lvmB.add("qqq"); - lvmB.add("rrr"); - Collection> c = new ArrayList>(); - c.add(lvmA); - c.add(lvmB); - this.uberLVM.addAll(2, c); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "xxx", "yyy", "zzz", "ppp", "qqq", "rrr", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(12)); - assertEquals("ggg", coordList.get(12)); - } - - public void testRemoveSource_Begin() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.uberLVM.remove(0); - - Object[] expected = new Object[] { "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(3)); - assertEquals("ggg", coordList.get(3)); - } - - public void testRemoveSource_Middle() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.uberLVM.remove(2); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(5)); - assertEquals("ggg", coordList.get(5)); - } - - public void testRemoveSource_End() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.uberLVM.remove(3); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("fff", this.compositeLVM.get(5)); - assertEquals("fff", coordList.get(5)); - } - - public void testRemoveSources() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.uberLVM.remove(2, 2); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("eee", this.compositeLVM.get(4)); - assertEquals("eee", coordList.get(4)); - } - - public void testReplaceSources() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - LocalListValueModel lvmA = new LocalListValueModel(); - lvmA.add("xxx"); - lvmA.add("yyy"); - lvmA.add("zzz"); - LocalListValueModel lvmB = new LocalListValueModel(); - lvmB.add("ppp"); - lvmB.add("qqq"); - lvmB.add("rrr"); - List> list = new ArrayList>(); - list.add(lvmA); - list.add(lvmB); - this.uberLVM.set(2, list); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "xxx", "yyy", "zzz", "ppp", "qqq", "rrr" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("qqq", this.compositeLVM.get(9)); - assertEquals("qqq", coordList.get(9)); - } - - public void testMoveSources_Begin() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.uberLVM.move(0, 2, 2); - - Object[] expected = new Object[] { "fff", "ggg", "hhh", "iii", "jjj", "kkk", "aaa", "bbb", "ccc", "ddd", "eee" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(1)); - assertEquals("ggg", coordList.get(1)); - } - - public void testMoveSources_Middle() { - LocalListValueModel lvm4 = new LocalListValueModel(); - lvm4.add("lll"); - lvm4.add("mmm"); - this.uberLVM.add(lvm4); - - LocalListValueModel lvm5 = new LocalListValueModel(); - lvm5.add("nnn"); - lvm5.add("ooo"); - lvm5.add("ppp"); - lvm5.add("qqq"); - this.uberLVM.add(lvm5); - - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.uberLVM.move(1, 3, 2); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ggg", "hhh", "iii", "jjj", "kkk", "lll", "mmm", "ddd", "eee", "fff", "nnn", "ooo", "ppp", "qqq" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(3)); - assertEquals("ggg", coordList.get(3)); - } - - public void testMoveSources_End() { - LocalListValueModel lvm4 = new LocalListValueModel(); - lvm4.add("lll"); - lvm4.add("mmm"); - this.uberLVM.add(lvm4); - - LocalListValueModel lvm5 = new LocalListValueModel(); - lvm5.add("nnn"); - lvm5.add("ooo"); - lvm5.add("ppp"); - lvm5.add("qqq"); - this.uberLVM.add(lvm5); - - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.uberLVM.move(3, 0, 3); - - Object[] expected = new Object[] { "ggg", "hhh", "iii", "jjj", "kkk", "lll", "mmm", "nnn", "ooo", "ppp", "qqq", "aaa", "bbb", "ccc", "ddd", "eee", "fff" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(0)); - assertEquals("ggg", coordList.get(0)); - } - - public void testMoveSource() { - LocalListValueModel lvm4 = new LocalListValueModel(); - lvm4.add("lll"); - lvm4.add("mmm"); - this.uberLVM.add(lvm4); - - LocalListValueModel lvm5 = new LocalListValueModel(); - lvm5.add("nnn"); - lvm5.add("ooo"); - lvm5.add("ppp"); - lvm5.add("qqq"); - this.uberLVM.add(lvm5); - - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.uberLVM.move(3, 1); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "fff", "ggg", "hhh", "iii", "jjj", "kkk", "ddd", "eee", "lll", "mmm", "nnn", "ooo", "ppp", "qqq" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ooo", this.compositeLVM.get(14)); - assertEquals("ooo", coordList.get(14)); - } - - public void testClearSources() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.uberLVM.clear(); - - Object[] expected = new Object[0]; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - } - - public void testChangeSources1() { - List> newList = new ArrayList>(); - LocalListValueModel lvm4 = new LocalListValueModel(); - lvm4.add("lll"); - lvm4.add("mmm"); - newList.add(lvm4); - - LocalListValueModel lvm5 = new LocalListValueModel(); - lvm5.add("nnn"); - lvm5.add("ooo"); - lvm5.add("ppp"); - lvm5.add("qqq"); - newList.add(lvm5); - - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.uberLVM.setListValues(newList); - - Object[] expected = new Object[] { "lll", "mmm", "nnn", "ooo", "ppp", "qqq" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ooo", this.compositeLVM.get(3)); - assertEquals("ooo", coordList.get(3)); - } - - public void testChangeSources2() { - List> newList = new ArrayList>(); - LocalListValueModel lvm4 = new LocalListValueModel(); - lvm4.add("lll"); - lvm4.add("mmm"); - newList.add(lvm4); - - LocalListValueModel lvm5 = new LocalListValueModel(); - lvm5.add("nnn"); - lvm5.add("ooo"); - lvm5.add("ppp"); - lvm5.add("qqq"); - newList.add(lvm5); - - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.uberLVM.changeListValues(newList); - - Object[] expected = new Object[] { "lll", "mmm", "nnn", "ooo", "ppp", "qqq" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ooo", this.compositeLVM.get(3)); - assertEquals("ooo", coordList.get(3)); - } - - public void testChangeSources3() { - ListChangeListener listener = new ErrorListener(); - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, listener); - - List> newList = new ArrayList>(); - newList.add(this.lvm0); - newList.add(this.lvm1); - newList.add(this.lvm2); - newList.add(this.lvm3); - - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.uberLVM.changeListValues(newList); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ddd", this.compositeLVM.get(3)); - assertEquals("ddd", coordList.get(3)); - } - - public void testChangeSources4() { - ListChangeListener listener = new ErrorListener() { - @Override - public void itemsAdded(ListAddEvent event) { /* OK */ } - }; - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, listener); - - List> newList = new ArrayList>(); - newList.add(this.lvm0); - newList.add(this.lvm1); - newList.add(this.lvm2); - newList.add(this.lvm3); - LocalListValueModel lvm4 = new LocalListValueModel(); - lvm4.add("lll"); - lvm4.add("mmm"); - newList.add(lvm4); - - - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.uberLVM.changeListValues(newList); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk", "lll", "mmm" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ddd", this.compositeLVM.get(3)); - assertEquals("ddd", coordList.get(3)); - } - - public void testChangeSources5() { - ListChangeListener listener = new ErrorListener() { - @Override - public void itemsRemoved(ListRemoveEvent event) { /* OK */ } - }; - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, listener); - - List> newList = new ArrayList>(); - newList.add(this.lvm0); - newList.add(this.lvm1); - newList.add(this.lvm2); - - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.uberLVM.changeListValues(newList); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ddd", this.compositeLVM.get(3)); - assertEquals("ddd", coordList.get(3)); - } - - public void testChangeSources6() { - ListChangeListener listener = new ErrorListener() { - @Override - public void itemsAdded(ListAddEvent event) { /* OK */ } - @Override - public void itemsRemoved(ListRemoveEvent event) { /* OK */ } - }; - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, listener); - - List> newList = new ArrayList>(); - newList.add(this.lvm0); - newList.add(this.lvm1); - - LocalListValueModel lvm4 = new LocalListValueModel(); - lvm4.add("lll"); - lvm4.add("mmm"); - newList.add(lvm4); - - newList.add(this.lvm3); - - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.uberLVM.changeListValues(newList); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "lll", "mmm", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ddd", this.compositeLVM.get(3)); - assertEquals("ddd", coordList.get(3)); - } - - public void testAddItem_Begin() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm0.add(0, "xxx"); - - Object[] expected = new Object[] { "xxx", "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(7)); - assertEquals("ggg", coordList.get(7)); - } - - public void testAddItem_Middle() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm2.add(1, "xxx"); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "xxx", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(7)); - assertEquals("ggg", coordList.get(7)); - } - - public void testAddItem_End() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm3.add(5, "xxx"); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk", "xxx" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testAddItems_Begin() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm0.addAll(0, Arrays.asList(new String[] { "xxx", "yyy", "zzz" })); - - Object[] expected = new Object[] { "xxx", "yyy", "zzz", "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(9)); - assertEquals("ggg", coordList.get(9)); - } - - public void testAddItems_Middle() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm2.addAll(1, Arrays.asList(new String[] { "xxx", "yyy", "zzz" })); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "xxx", "yyy", "zzz", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(9)); - assertEquals("ggg", coordList.get(9)); - } - - public void testAddItems_End() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm3.addAll(5, Arrays.asList(new String[] { "xxx", "yyy", "zzz" })); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk", "xxx", "yyy", "zzz" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testRemoveItem_Begin() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm0.remove(0); - - Object[] expected = new Object[] { "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(5)); - assertEquals("ggg", coordList.get(5)); - } - - public void testRemoveItem_Middle() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm2.remove(0); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(5)); - assertEquals("ggg", coordList.get(5)); - } - - public void testRemoveItem_End() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm3.remove(4); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testRemoveItems_Begin() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm0.remove(0, 3); - - Object[] expected = new Object[] { "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(3)); - assertEquals("ggg", coordList.get(3)); - } - - public void testRemoveItems_Middle() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm3.remove(1, 3); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("kkk", this.compositeLVM.get(7)); - assertEquals("kkk", coordList.get(7)); - } - - public void testRemoveItems_End() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm3.remove(3, 2); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testReplaceItem_Begin() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm0.set(0, "xxx"); - - Object[] expected = new Object[] { "xxx", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testReplaceItem_Middle() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm2.set(0, "xxx"); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "xxx", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testReplaceItem_End() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm3.set(4, "xxx"); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "xxx" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testReplaceItems_Begin() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm0.set(0, Arrays.asList(new String[] { "xxx", "yyy", "zzz" })); - - Object[] expected = new Object[] { "xxx", "yyy", "zzz", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testReplaceItems_Middle() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm3.set(1, Arrays.asList(new String[] { "xxx", "yyy", "zzz" })); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "xxx", "yyy", "zzz", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("kkk", this.compositeLVM.get(10)); - assertEquals("kkk", coordList.get(10)); - } - - public void testReplaceItems_End() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm3.set(3, Arrays.asList(new String[] { "xxx", "yyy" })); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "xxx", "yyy" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testMoveItem_Begin() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm0.move(2, 0); - - Object[] expected = new Object[] { "bbb", "ccc", "aaa", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testMoveItem_Middle() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm1.move(0, 1); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "eee", "ddd", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testMoveItem_End() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm3.move(0, 4); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "kkk", "ggg", "hhh", "iii", "jjj" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(7)); - assertEquals("ggg", coordList.get(7)); - } - - public void testMoveItems_Begin() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm0.move(1, 0, 2); - - Object[] expected = new Object[] { "ccc", "aaa", "bbb", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testMoveItems_Middle() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm1.add("eee.1"); - this.lvm1.add("eee.2"); - this.lvm1.add("eee.3"); - this.lvm1.move(1, 2, 3); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee.1", "eee.2", "eee.3", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(9)); - assertEquals("ggg", coordList.get(9)); - } - - public void testMoveItems_End() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm3.move(0, 2, 3); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "iii", "jjj", "kkk", "ggg", "hhh" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(9)); - assertEquals("ggg", coordList.get(9)); - } - - public void testClearItems_Begin() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm0.clear(); - - Object[] expected = new Object[] { "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(3)); - assertEquals("ggg", coordList.get(3)); - } - - public void testClearItems_Middle() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm1.clear(); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(4)); - assertEquals("ggg", coordList.get(4)); - } - - public void testClearItems_End() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm3.clear(); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("fff", this.compositeLVM.get(5)); - assertEquals("fff", coordList.get(5)); - } - - public void testChangeItems_Begin1() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm0.setListValues(Arrays.asList(new String[] { "xxx", "yyy", "zzz" })); - - Object[] expected = new Object[] { "xxx", "yyy", "zzz", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testChangeItems_Middle1() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm1.setListValues(Arrays.asList(new String[] { "xxx", "yyy", "zzz" })); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "xxx", "yyy", "zzz", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(7)); - assertEquals("ggg", coordList.get(7)); - } - - public void testChangeItems_End1() { - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm3.setListValues(Arrays.asList(new String[] { "xxx", "yyy", "zzz" })); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "xxx", "yyy", "zzz" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("fff", this.compositeLVM.get(5)); - assertEquals("fff", coordList.get(5)); - } - - public void testChangeItems_Begin2() { - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, new ErrorListener()); - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm0.changeListValues(Arrays.asList(new String[] { "aaa", "bbb", "ccc" })); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testChangeItems_Middle2() { - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, new ErrorListener()); - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm1.changeListValues(Arrays.asList(new String[] { "ddd", "eee" })); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("hhh", this.compositeLVM.get(7)); - assertEquals("hhh", coordList.get(7)); - } - - public void testChangeItems_End2() { - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, new ErrorListener()); - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm3.changeListValues(Arrays.asList(new String[] { "ggg", "hhh", "iii", "jjj", "kkk" })); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("fff", this.compositeLVM.get(5)); - assertEquals("fff", coordList.get(5)); - } - - public void testChangeItems_Begin3() { - ListChangeListener listener = new ErrorListener() { - @Override - public void itemsReplaced(ListReplaceEvent event) { /* OK */ } - }; - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, listener); - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm0.changeListValues(Arrays.asList(new String[] { "aaa", "bbb", "xxx" })); - - Object[] expected = new Object[] { "aaa", "bbb", "xxx", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(6)); - assertEquals("ggg", coordList.get(6)); - } - - public void testChangeItems_Middle3() { - ListChangeListener listener = new ErrorListener() { - @Override - public void itemsReplaced(ListReplaceEvent event) { /* OK */ } - }; - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, listener); - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm1.changeListValues(Arrays.asList(new String[] { "ddd", "xxx" })); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "xxx", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("hhh", this.compositeLVM.get(7)); - assertEquals("hhh", coordList.get(7)); - } - - public void testChangeItems_End3() { - ListChangeListener listener = new ErrorListener() { - @Override - public void itemsReplaced(ListReplaceEvent event) { /* OK */ } - }; - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, listener); - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm3.changeListValues(Arrays.asList(new String[] { "ggg", "hhh", "iii", "xxx", "kkk" })); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "xxx", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("fff", this.compositeLVM.get(5)); - assertEquals("fff", coordList.get(5)); - } - - public void testChangeItems_Begin4() { - ListChangeListener listener = new ErrorListener() { - @Override - public void itemsAdded(ListAddEvent event) { /* OK */ } - }; - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, listener); - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm0.changeListValues(Arrays.asList(new String[] { "aaa", "bbb", "ccc", "xxx" })); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "xxx", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("fff", this.compositeLVM.get(6)); - assertEquals("fff", coordList.get(6)); - } - - public void testChangeItems_Middle4() { - ListChangeListener listener = new ErrorListener() { - @Override - public void itemsAdded(ListAddEvent event) { /* OK */ } - }; - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, listener); - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm1.changeListValues(Arrays.asList(new String[] { "ddd", "eee", "xxx" })); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "xxx", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("ggg", this.compositeLVM.get(7)); - assertEquals("ggg", coordList.get(7)); - } - - public void testChangeItems_End4() { - ListChangeListener listener = new ErrorListener() { - @Override - public void itemsAdded(ListAddEvent event) { /* OK */ } - }; - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, listener); - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm3.changeListValues(Arrays.asList(new String[] { "ggg", "hhh", "iii", "jjj", "kkk", "xxx" })); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk", "xxx" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("fff", this.compositeLVM.get(5)); - assertEquals("fff", coordList.get(5)); - } - - public void testChangeItems_Begin5() { - ListChangeListener listener = new ErrorListener() { - @Override - public void itemsRemoved(ListRemoveEvent event) { /* OK */ } - }; - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, listener); - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm0.changeListValues(Arrays.asList(new String[] { "aaa" })); - - Object[] expected = new Object[] { "aaa", "ddd", "eee", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("iii", this.compositeLVM.get(6)); - assertEquals("iii", coordList.get(6)); - } - - public void testChangeItems_Middle5() { - ListChangeListener listener = new ErrorListener() { - @Override - public void itemsRemoved(ListRemoveEvent event) { /* OK */ } - }; - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, listener); - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm1.changeListValues(Arrays.asList(new String[] { "ddd" })); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "fff", "ggg", "hhh", "iii", "jjj", "kkk" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("iii", this.compositeLVM.get(7)); - assertEquals("iii", coordList.get(7)); - } - - public void testChangeItems_End5() { - ListChangeListener listener = new ErrorListener() { - @Override - public void itemsRemoved(ListRemoveEvent event) { /* OK */ } - }; - this.compositeLVM.addListChangeListener(ListValueModel.LIST_VALUES, listener); - CoordinatedList coordList = new CoordinatedList(this.compositeLVM); - - this.lvm3.changeListValues(Arrays.asList(new String[] { "ggg", "hhh", "iii" })); - - Object[] expected = new Object[] { "aaa", "bbb", "ccc", "ddd", "eee", "fff", "ggg", "hhh", "iii" }; - assertEquals(expected.length, this.compositeLVM.size()); - assertEquals(expected.length, coordList.size()); - assertTrue(Arrays.equals(expected, this.compositeLVM.toArray())); - assertTrue(Arrays.equals(expected, coordList.toArray())); - assertEquals("fff", this.compositeLVM.get(5)); - assertEquals("fff", coordList.get(5)); - } - - class ErrorListener implements ListChangeListener { - public void itemsAdded(ListAddEvent event) { - fail(); - } - public void itemsRemoved(ListRemoveEvent event) { - fail(); - } - public void itemsMoved(ListMoveEvent event) { - fail(); - } - public void itemsReplaced(ListReplaceEvent event) { - fail(); - } - public void listCleared(ListClearEvent event) { - fail(); - } - public void listChanged(ListChangeEvent event) { - fail(); - } - } - - class LocalListValueModel extends SimpleListValueModel { - LocalListValueModel() { - super(); - } - void changeListValues(Iterable listValues) { - if (listValues == null) { - throw new NullPointerException(); - } - this.list.clear(); - CollectionTools.addAll(this.list, listValues); - this.fireListChanged(LIST_VALUES, this.list); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositePropertyValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositePropertyValueModelTests.java deleted file mode 100644 index 5fa2413fea..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CompositePropertyValueModelTests.java +++ /dev/null @@ -1,199 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.model.value.CompositePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -public class CompositePropertyValueModelTests extends TestCase { - private SimplePropertyValueModel pvm1; - private WritablePropertyValueModel pvm2; - private WritablePropertyValueModel pvm3; - private WritablePropertyValueModel pvm4; - private Collection> collection; - private SimpleCollectionValueModel> cvm; - private PropertyValueModel compositePVM; - PropertyChangeEvent event; - - - public CompositePropertyValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.pvm1 = new SimplePropertyValueModel(Integer.valueOf(1)); - this.pvm2 = new SimplePropertyValueModel(Integer.valueOf(2)); - this.pvm3 = new SimplePropertyValueModel(Integer.valueOf(3)); - this.pvm4 = new SimplePropertyValueModel(Integer.valueOf(4)); - this.collection = new ArrayList>(); - this.collection.add(this.pvm1); - this.collection.add(this.pvm2); - this.collection.add(this.pvm3); - this.collection.add(this.pvm4); - this.cvm = new SimpleCollectionValueModel>(this.collection); - - this.compositePVM = this.buildCompositePVM(cvm); - } - - private > PropertyValueModel buildCompositePVM(CollectionValueModel pvms) { - return new CompositePropertyValueModel(pvms) { - @Override - protected Integer buildValue() { - int sum = 0; - for (PropertyValueModel each : this.getCollectionModel()) { - sum += each.getValue().intValue(); - } - return Integer.valueOf(sum); - } - @Override - @SuppressWarnings("unchecked") - protected CollectionValueModel> getCollectionModel() { - return (CollectionValueModel>) super.getCollectionModel(); - } - }; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testGetValue() { - assertNull(this.compositePVM.getValue()); - ChangeListener listener = this.buildListener(); - this.compositePVM.addChangeListener(listener); - assertEquals(10, this.compositePVM.getValue().intValue()); - } - - public void testValueAndListeners1() { - assertNull(this.compositePVM.getValue()); - ChangeListener listener = this.buildListener(); - this.compositePVM.addChangeListener(listener); - assertEquals(10, this.compositePVM.getValue().intValue()); - this.compositePVM.removeChangeListener(listener); - assertNull(this.compositePVM.getValue()); - } - - public void testValueAndListeners2() { - assertNull(this.compositePVM.getValue()); - ChangeListener listener = this.buildListener(); - this.compositePVM.addPropertyChangeListener(PropertyValueModel.VALUE, listener); - assertEquals(10, this.compositePVM.getValue().intValue()); - this.compositePVM.removePropertyChangeListener(PropertyValueModel.VALUE, listener); - assertNull(this.compositePVM.getValue()); - } - - public void testPropertyChange1() { - this.compositePVM.addChangeListener(this.buildListener()); - this.verifyPropertyChange(); - } - - public void testPropertyChange2() { - this.compositePVM.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildListener()); - this.verifyPropertyChange(); - } - - private void verifyPropertyChange() { - this.event = null; - this.pvm1.setValue(Integer.valueOf(5)); - this.verifyEvent(10, 14); - - this.event = null; - this.pvm4.setValue(Integer.valueOf(0)); - this.verifyEvent(14, 10); - } - - public void testCollectionChange1() { - this.compositePVM.addChangeListener(this.buildListener()); - this.verifyCollectionChange(); - } - - public void testCollectionChange2() { - this.compositePVM.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildListener()); - this.verifyCollectionChange(); - } - - private void verifyCollectionChange() { - this.event = null; - WritablePropertyValueModel pvm = new SimplePropertyValueModel(Integer.valueOf(77)); - this.cvm.add(pvm); - this.verifyEvent(10, 87); - - this.event = null; - this.cvm.remove(pvm); - this.verifyEvent(87, 10); - - this.event = null; - this.cvm.clear(); - this.verifyEvent(10, 0); - - Collection> c2 = new ArrayList>(); - c2.add(this.pvm1); - c2.add(this.pvm2); - this.event = null; - this.cvm.setValues(c2); - this.verifyEvent(0, 3); - } - - public void testLazyListening1() { - assertFalse(this.pvm1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - ChangeListener listener = this.buildListener(); - - this.compositePVM.addChangeListener(listener); - assertTrue(this.pvm1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - this.compositePVM.removeChangeListener(listener); - assertFalse(this.pvm1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - } - - public void testLazyListening2() { - assertFalse(this.pvm1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - ChangeListener listener = this.buildListener(); - - this.compositePVM.addPropertyChangeListener(PropertyValueModel.VALUE, listener); - assertTrue(this.pvm1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - this.compositePVM.removePropertyChangeListener(PropertyValueModel.VALUE, listener); - assertFalse(this.pvm1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - } - - private ChangeListener buildListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - CompositePropertyValueModelTests.this.event = e; - } - }; - } - - private void verifyEvent(int oldValue, int newValue) { - assertEquals(this.compositePVM, this.event.getSource()); - assertEquals(PropertyValueModel.VALUE, this.event.getPropertyName()); - assertEquals(Integer.valueOf(oldValue), this.event.getOldValue()); - assertEquals(Integer.valueOf(newValue), this.event.getNewValue()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CoordinatedBag.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CoordinatedBag.java deleted file mode 100644 index 508a4d62f4..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CoordinatedBag.java +++ /dev/null @@ -1,163 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.Collection; -import java.util.Iterator; - -import org.eclipse.jpt.common.utility.internal.Bag; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; - -/** - * Helper class that keeps an internal collection in synch with the - * collection held by a collection value model. - */ -class CoordinatedBag implements Bag, CollectionChangeListener { - - private Bag bag = new HashBag(); - - CoordinatedBag(CollectionValueModel cvm) { - cvm.addCollectionChangeListener(CollectionValueModel.VALUES, this); - } - - - // ********** Collection implementation ********** - - public boolean add(E o) { - return this.bag.add(o); - } - - public boolean addAll(Collection c) { - return this.bag.addAll(c); - } - - public void clear() { - this.bag.clear(); - } - - public boolean contains(Object o) { - return this.bag.contains(o); - } - - public boolean containsAll(Collection c) { - return this.bag.containsAll(c); - } - - public boolean isEmpty() { - return this.bag.isEmpty(); - } - - public Iterator iterator() { - return this.bag.iterator(); - } - - public boolean remove(Object o) { - return this.bag.remove(o); - } - - public boolean removeAll(Collection c) { - return this.bag.removeAll(c); - } - - public boolean retainAll(Collection c) { - return this.bag.retainAll(c); - } - - public int size() { - return this.bag.size(); - } - - public Object[] toArray() { - return this.bag.toArray(); - } - - public T[] toArray(T[] a) { - return this.bag.toArray(a); - } - - - // ********** Bag implementation ********** - - public int count(Object o) { - return this.bag.count(o); - } - - public boolean add(E o, int count) { - return this.bag.add(o, count); - } - - public boolean remove(Object o, int count) { - return this.bag.remove(o, count); - } - - public Iterator uniqueIterator() { - return this.bag.uniqueIterator(); - } - - public int uniqueCount() { - return this.bag.uniqueCount(); - } - - public Iterator> entries() { - return this.bag.entries(); - } - - // ********** CollectionChangeListener implementation ********** - - @SuppressWarnings("unchecked") - public void itemsAdded(CollectionAddEvent event) { - for (E item : (Iterable) event.getItems()) { - this.bag.add(item); - } - } - - @SuppressWarnings("unchecked") - public void itemsRemoved(CollectionRemoveEvent event) { - for (E item : (Iterable) event.getItems()) { - this.bag.remove(item); - } - } - - public void collectionCleared(CollectionClearEvent event) { - this.bag.clear(); - } - - @SuppressWarnings("unchecked") - public void collectionChanged(CollectionChangeEvent event) { - this.bag.clear(); - CollectionTools.addAll(this.bag, ((CollectionValueModel) event.getSource()).iterator()); - } - - - // ********** standard methods ********** - - @Override - public boolean equals(Object o) { - return this.bag.equals(o); - } - - @Override - public int hashCode() { - return this.bag.hashCode(); - } - - @Override - public String toString() { - return this.bag.toString(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CoordinatedList.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CoordinatedList.java deleted file mode 100644 index 95cf02457b..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/CoordinatedList.java +++ /dev/null @@ -1,264 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import javax.swing.ListModel; -import javax.swing.event.ListDataEvent; -import javax.swing.event.ListDataListener; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * Helper class that keeps an internal list in synch with the - * list held by a list value model. - */ -public class CoordinatedList implements List, ListChangeListener, ListDataListener { - private List list = new ArrayList(); - - public CoordinatedList(ListValueModel listValueModel) { - listValueModel.addListChangeListener(ListValueModel.LIST_VALUES, this); - for (Iterator stream = listValueModel.iterator(); stream.hasNext(); ) { - this.add(stream.next()); - } - } - - public CoordinatedList(ListModel listModel) { - listModel.addListDataListener(this); - for (int i = 0; i < listModel.getSize(); i++) { - this.add(i, this.getElementAt(listModel, i)); - } - } - - - // ********** List implementation ********** - - public void add(int index, E element) { - this.list.add(index, element); - } - - public boolean add(E o) { - return this.list.add(o); - } - - public boolean addAll(Collection c) { - return this.list.addAll(c); - } - - public boolean addAll(int index, Collection c) { - return this.list.addAll(index, c); - } - - public void clear() { - this.list.clear(); - } - - public boolean contains(Object o) { - return this.list.contains(o); - } - - public boolean containsAll(Collection c) { - return this.list.containsAll(c); - } - - public E get(int index) { - return this.list.get(index); - } - - public int indexOf(Object o) { - return this.list.indexOf(o); - } - - public boolean isEmpty() { - return this.list.isEmpty(); - } - - public Iterator iterator() { - return this.list.iterator(); - } - - public int lastIndexOf(Object o) { - return this.list.lastIndexOf(o); - } - - public ListIterator listIterator() { - return this.list.listIterator(); - } - - public ListIterator listIterator(int index) { - return this.list.listIterator(index); - } - - public E remove(int index) { - return this.list.remove(index); - } - - public boolean remove(Object o) { - return this.list.remove(o); - } - - public boolean removeAll(Collection c) { - return this.list.removeAll(c); - } - - public boolean retainAll(Collection c) { - return this.list.retainAll(c); - } - - public E set(int index, E element) { - return this.list.set(index, element); - } - - public int size() { - return this.list.size(); - } - - public List subList(int fromIndex, int toIndex) { - return this.list.subList(fromIndex, toIndex); - } - - public Object[] toArray() { - return this.list.toArray(); - } - - public T[] toArray(T[] a) { - return this.list.toArray(a); - } - - - // ********** ListChangeListener implementation ********** - - public void itemsAdded(ListAddEvent e) { - int i = e.getIndex(); - for (E item : this.getItems(e)) { - this.list.add(i++, item); - } - } - - public void itemsRemoved(ListRemoveEvent e) { - int base = e.getIndex(); - for (int i = e.getItemsSize(); i-- > 0; ) { - this.list.remove(base + i); // remove from end - } - } - - public void itemsReplaced(ListReplaceEvent e) { - int i = e.getIndex(); - for (E item : this.getNewItems(e)) { - this.list.set(i++, item); - } - } - - public void itemsMoved(ListMoveEvent e) { - CollectionTools.move(this.list, e.getTargetIndex(), e.getSourceIndex(), e.getLength()); - } - - public void listCleared(ListClearEvent e) { - this.list.clear(); - } - - public void listChanged(ListChangeEvent e) { - this.list.clear(); - CollectionTools.addAll(this.list, this.getSource(e).iterator()); - } - - - // ********** ListDataListener implementation ********** - - public void contentsChanged(ListDataEvent e) { - this.list.clear(); - ListModel lm = (ListModel) e.getSource(); - int size = lm.getSize(); - for (int i = 0; i < size; i++) { - this.list.add(i, this.getElementAt(lm, i)); - } - } - - public void intervalAdded(ListDataEvent e) { - ListModel lm = (ListModel) e.getSource(); - int start = Math.min(e.getIndex0(), e.getIndex1()); - int end = Math.max(e.getIndex0(), e.getIndex1()); - for (int i = start; i <= end; i++) { - this.list.add(i, this.getElementAt(lm, i)); - } - } - - public void intervalRemoved(ListDataEvent e) { - int start = Math.min(e.getIndex0(), e.getIndex1()); - int end = Math.max(e.getIndex0(), e.getIndex1()); - int length = end - start + 1; - for (int i = 1; i <= length; i++) { - this.list.remove(start); - } - } - - - // ********** standard methods ********** - - @Override - public boolean equals(Object o) { - return this.list.equals(o); - } - - @Override - public int hashCode() { - return this.list.hashCode(); - } - - @Override - public String toString() { - return this.list.toString(); - } - - - // ********** internal methods ********** - - /** - * minimize the scope of the suppressed warnings.= - */ - @SuppressWarnings("unchecked") - private E getElementAt(ListModel listModel, int index) { - return (E) listModel.getElementAt(index); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - private Iterable getItems(ListAddEvent event) { - return (Iterable) event.getItems(); - } - - // minimized scope of suppressed warnings - @SuppressWarnings("unchecked") - private Iterable getNewItems(ListReplaceEvent event) { - return (Iterable) event.getNewItems(); - } - - /** - * minimize the scope of the suppressed warnings.= - */ - @SuppressWarnings("unchecked") - private ListValueModel getSource(ListChangeEvent event) { - return (ListValueModel) event.getSource(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ExtendedListValueModelWrapperTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ExtendedListValueModelWrapperTests.java deleted file mode 100644 index 56e1a25d14..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ExtendedListValueModelWrapperTests.java +++ /dev/null @@ -1,313 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.ExtendedListValueModelWrapper; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class ExtendedListValueModelWrapperTests extends TestCase { - private SimpleListValueModel listHolder; - private ListValueModel extendedListHolder; - ListEvent event; - String eventType; - - private static final String ADD = "add"; - private static final String REMOVE = "remove"; - private static final String REPLACE = "replace"; - private static final String MOVE = "move"; - private static final String CLEAR = "clear"; - private static final String CHANGE = "change"; - - public ExtendedListValueModelWrapperTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.listHolder = new SimpleListValueModel(this.buildList()); - this.extendedListHolder = this.buildExtendedListHolder(this.listHolder); - } - - private List buildList() { - List result = new ArrayList(); - result.add("A"); - result.add("B"); - result.add("C"); - result.add("D"); - return result; - } - - private List buildExtendedList() { - List extendedList = new ArrayList(); - extendedList.addAll(this.buildPrefix()); - extendedList.addAll(this.buildList()); - extendedList.addAll(this.buildSuffix()); - return extendedList; - } - - private List buildPrefix() { - List prefix = new ArrayList(); - prefix.add("x"); - prefix.add("y"); - prefix.add("z"); - return prefix; - } - - private List buildSuffix() { - List suffix = new ArrayList(); - suffix.add("i"); - suffix.add("j"); - return suffix; - } - - private ListValueModel buildExtendedListHolder(ListValueModel lvm) { - return new ExtendedListValueModelWrapper(this.buildPrefix(), lvm, this.buildSuffix()); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testIterator() { - this.extendedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.buildListener()); - assertEquals(this.buildExtendedList(), CollectionTools.list(this.extendedListHolder.iterator())); - } - - public void testSize() { - this.extendedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.buildListener()); - assertEquals(this.buildExtendedList().size(), CollectionTools.size(this.extendedListHolder.iterator())); - assertEquals(this.buildExtendedList().size(), this.extendedListHolder.size()); - } - - private boolean extendedListContains(Object item) { - return CollectionTools.contains(this.extendedListHolder.iterator(), item); - } - - private boolean extendedListContainsAll(Collection items) { - return CollectionTools.containsAll(this.extendedListHolder.iterator(), items); - } - - private boolean extendedListContainsAny(Collection items) { - List extendedList = CollectionTools.list(this.extendedListHolder.iterator()); - for (Iterator stream = items.iterator(); stream.hasNext(); ) { - if (extendedList.contains(stream.next())) { - return true; - } - } - return false; - } - - private boolean listContains(Object item) { - return CollectionTools.contains(this.listHolder.iterator(), item); - } - - private boolean listContainsAll(Collection items) { - return CollectionTools.containsAll(this.listHolder.iterator(), items); - } - -// private boolean listContainsAny(Collection items) { -// List extendedList = CollectionTools.list(this.listHolder.iterator()); -// for (Iterator stream = items.iterator(); stream.hasNext(); ) { -// if (extendedList.contains(stream.next())) { -// return true; -// } -// } -// return false; -// } -// - public void testAdd1() { - this.extendedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.buildListener()); - - assertFalse(this.extendedListContains("E")); - this.listHolder.add(4, "E"); - assertTrue(this.extendedListContains("E")); - assertTrue(this.listContains("E")); - } - - public void testAdd2() { - this.extendedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.buildListener()); - - assertFalse(this.extendedListContains(null)); - this.listHolder.add(4, null); - assertTrue(this.extendedListContains(null)); - assertTrue(this.listContains(null)); - } - - private List buildAddList() { - List addList = new ArrayList(); - addList.add("E"); - addList.add("F"); - return addList; - } - - public void testAddAll1() { - this.extendedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.buildListener()); - - assertFalse(this.extendedListContainsAny(this.buildAddList())); - this.listHolder.addAll(4, this.buildAddList()); - assertTrue(this.extendedListContainsAll(this.buildAddList())); - assertTrue(this.listContainsAll(this.buildAddList())); - } - - public void testRemove1() { - this.extendedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.buildListener()); - - assertTrue(this.extendedListContains("B")); - this.listHolder.remove(this.buildList().indexOf("B")); - assertFalse(this.extendedListContains("B")); - assertFalse(this.listContains("B")); - } - - public void testListChangeGeneric() { - this.extendedListHolder.addChangeListener(this.buildListener()); - this.verifyListChange(); - } - - public void testListChangeNamed() { - this.extendedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.buildListener()); - this.verifyListChange(); - } - - private void verifyListChange() { - this.event = null; - this.eventType = null; - this.listHolder.add(4, "E"); - this.verifyEvent(ADD, 7, "E"); - - this.event = null; - this.eventType = null; - this.listHolder.add(5, null); - this.verifyEvent(ADD, 8, null); - - this.event = null; - this.eventType = null; - this.listHolder.remove(5); - this.verifyEvent(REMOVE, 8, null); - - this.event = null; - this.eventType = null; - this.listHolder.remove(4); - this.verifyEvent(REMOVE, 7, "E"); - - this.event = null; - this.eventType = null; - this.listHolder.addAll(0, this.buildList()); - this.verifyEvent(ADD); - assertEquals(this.buildList(), CollectionTools.list(((ListAddEvent) this.event).getItems())); - - this.event = null; - this.eventType = null; - this.listHolder.set(0, "AA"); - this.verifyEvent(REPLACE); - assertFalse(CollectionTools.contains(((ListReplaceEvent) this.event).getNewItems(), "A")); - assertTrue(CollectionTools.contains(((ListReplaceEvent) this.event).getNewItems(), "AA")); - } - - private ChangeListener buildListener() { - return new ChangeAdapter() { - @Override - public void itemsAdded(ListAddEvent e) { - ExtendedListValueModelWrapperTests.this.eventType = ADD; - ExtendedListValueModelWrapperTests.this.event = e; - } - @Override - public void itemsRemoved(ListRemoveEvent e) { - ExtendedListValueModelWrapperTests.this.eventType = REMOVE; - ExtendedListValueModelWrapperTests.this.event = e; - } - @Override - public void itemsReplaced(ListReplaceEvent e) { - ExtendedListValueModelWrapperTests.this.eventType = REPLACE; - ExtendedListValueModelWrapperTests.this.event = e; - } - @Override - public void itemsMoved(ListMoveEvent e) { - ExtendedListValueModelWrapperTests.this.eventType = MOVE; - ExtendedListValueModelWrapperTests.this.event = e; - } - @Override - public void listCleared(ListClearEvent e) { - ExtendedListValueModelWrapperTests.this.eventType = CLEAR; - ExtendedListValueModelWrapperTests.this.event = e; - } - @Override - public void listChanged(ListChangeEvent e) { - ExtendedListValueModelWrapperTests.this.eventType = CHANGE; - ExtendedListValueModelWrapperTests.this.event = e; - } - }; - } - - private void verifyEvent(String type) { - assertEquals(type, this.eventType); - assertEquals(this.extendedListHolder, this.event.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event.getListName()); - } - - private void verifyEvent(String type, int index, Object item) { - this.verifyEvent(type); - if (type == ADD) { - assertEquals(index, ((ListAddEvent) this.event).getIndex()); - assertEquals(item, ((ListAddEvent) this.event).getItems().iterator().next()); - } else if (type == REMOVE) { - assertEquals(index, ((ListRemoveEvent) this.event).getIndex()); - assertEquals(item, ((ListRemoveEvent) this.event).getItems().iterator().next()); - } - } - - public void testHasListeners() { - /* - * adding listeners to the extended list will cause listeners - * to be added to the wrapped list; - * likewise, removing listeners from the extended list will - * cause listeners to be removed from the wrapped list - */ - assertFalse(((AbstractModel) this.listHolder).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - ChangeListener listener = this.buildListener(); - - this.extendedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, listener); - assertTrue(((AbstractModel) this.listHolder).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - this.extendedListHolder.removeListChangeListener(ListValueModel.LIST_VALUES, listener); - assertFalse(((AbstractModel) this.listHolder).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - this.extendedListHolder.addChangeListener(listener); - assertTrue(((AbstractModel) this.listHolder).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - this.extendedListHolder.removeChangeListener(listener); - assertFalse(((AbstractModel) this.listHolder).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/FilteringCollectionValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/FilteringCollectionValueModelTests.java deleted file mode 100644 index df0787fe93..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/FilteringCollectionValueModelTests.java +++ /dev/null @@ -1,348 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.Collection; -import java.util.Iterator; -import java.util.Vector; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.FilteringCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class FilteringCollectionValueModelTests extends TestCase { - private SimpleCollectionValueModel collectionHolder; - CollectionAddEvent addEvent; - CollectionRemoveEvent removeEvent; - CollectionClearEvent collectionClearedEvent; - CollectionChangeEvent collectionChangedEvent; - - private CollectionValueModel filteredCollectionHolder; - CollectionAddEvent filteredAddEvent; - CollectionRemoveEvent filteredRemoveEvent; - CollectionClearEvent filteredCollectionClearedEvent; - CollectionChangeEvent filteredCollectionChangedEvent; - - public FilteringCollectionValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.collectionHolder = new SimpleCollectionValueModel(buildCollection()); - this.filteredCollectionHolder = new FilteringCollectionValueModel(this.collectionHolder, this.buildFilter()); - } - - private Collection buildCollection() { - Collection collection = new Vector(); - collection.add("foo"); - return collection; - } - - private Filter buildFilter() { - return new Filter() { - public boolean accept(String s) { - return s.startsWith("b"); - } - }; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testIterator() { - // add a listener to "activate" the wrapper - this.filteredCollectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildFilteredListener()); - - assertEquals("foo", this.collectionHolder.iterator().next()); - assertFalse(this.filteredCollectionHolder.iterator().hasNext()); - - this.collectionHolder.add("bar"); - Iterator collectionHolderValue = this.collectionHolder.iterator(); - assertEquals("foo", collectionHolderValue.next()); - assertEquals("bar", collectionHolderValue.next()); - assertTrue(this.filteredCollectionHolder.iterator().hasNext()); - assertEquals("bar", this.filteredCollectionHolder.iterator().next()); - - this.collectionHolder.remove("bar"); - assertEquals("foo", this.collectionHolder.iterator().next()); - assertFalse(this.filteredCollectionHolder.iterator().hasNext()); - - this.collectionHolder.remove("foo"); - assertFalse(this.collectionHolder.iterator().hasNext()); - assertFalse(this.filteredCollectionHolder.iterator().hasNext()); - - this.collectionHolder.add("foo"); - assertEquals("foo", this.collectionHolder.iterator().next()); - assertFalse(this.filteredCollectionHolder.iterator().hasNext()); - } - - public void testSetValue() { - // add a listener to "activate" the wrapper - this.filteredCollectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildFilteredListener()); - - Collection newCollection = new Vector(); - newCollection.add("fox"); - newCollection.add("baz"); - - this.collectionHolder.setValues(newCollection); - - Iterator collectionValues = this.collectionHolder.iterator(); - assertEquals("fox", collectionValues.next()); - assertEquals("baz", collectionValues.next()); - Iterator filteredCollectionValues = this.filteredCollectionHolder.iterator(); - assertEquals("baz", filteredCollectionValues.next()); - assertFalse(filteredCollectionValues.hasNext()); - } - - public void testLazyListening() { - assertTrue(((AbstractModel) this.collectionHolder).hasNoCollectionChangeListeners(CollectionValueModel.VALUES)); - ChangeListener listener = this.buildFilteredChangeListener(); - this.filteredCollectionHolder.addChangeListener(listener); - assertTrue(((AbstractModel) this.collectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - this.filteredCollectionHolder.removeChangeListener(listener); - assertTrue(((AbstractModel) this.collectionHolder).hasNoCollectionChangeListeners(CollectionValueModel.VALUES)); - - this.filteredCollectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, listener); - assertTrue(((AbstractModel) this.collectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - this.filteredCollectionHolder.removeCollectionChangeListener(CollectionValueModel.VALUES, listener); - assertTrue(((AbstractModel) this.collectionHolder).hasNoCollectionChangeListeners(CollectionValueModel.VALUES)); - } - - public void testCollectionChange1() { - this.collectionHolder.addChangeListener(this.buildChangeListener()); - this.filteredCollectionHolder.addChangeListener(this.buildFilteredChangeListener()); - this.verifyCollectionChanges(); - } - - public void testCollectionChange2() { - this.collectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildListener()); - this.filteredCollectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildFilteredListener()); - this.verifyCollectionChanges(); - } - - private void clearEvents() { - this.addEvent = null; - this.removeEvent = null; - this.collectionClearedEvent = null; - this.collectionChangedEvent = null; - this.filteredAddEvent = null; - this.filteredRemoveEvent = null; - this.filteredCollectionClearedEvent = null; - this.filteredCollectionChangedEvent = null; - } - - private void verifyCollectionChanges() { - clearEvents(); - this.collectionHolder.add("bar"); - Collection tempCollection = new Vector(); - tempCollection.add("bar"); - this.verifyEvent(this.addEvent, this.collectionHolder, tempCollection); - this.verifyEvent(this.filteredAddEvent, this.filteredCollectionHolder, tempCollection); - - clearEvents(); - this.collectionHolder.remove("foo"); - tempCollection.remove("bar"); - tempCollection.add("foo"); - this.verifyEvent(this.removeEvent, this.collectionHolder, tempCollection); - assertNull(this.filteredRemoveEvent); - - - clearEvents(); - this.collectionHolder.remove("bar"); - tempCollection.add("bar"); - tempCollection.remove("foo"); - this.verifyEvent(this.removeEvent, this.collectionHolder, tempCollection); - this.verifyEvent(this.filteredRemoveEvent, this.filteredCollectionHolder, tempCollection); - - - clearEvents(); - this.collectionHolder.add("foo"); - tempCollection.remove("bar"); - tempCollection.add("foo"); - this.verifyEvent(this.addEvent, this.collectionHolder, tempCollection); - assertNull(this.filteredAddEvent); - - - clearEvents(); - Collection newCollection = new Vector(); - newCollection.add("fox"); - newCollection.add("baz"); - - this.collectionHolder.setValues(newCollection); - - this.verifyEvent(this.collectionChangedEvent, this.collectionHolder); - - tempCollection.remove("foo"); - tempCollection.add("baz"); - this.verifyEvent(this.filteredCollectionChangedEvent, this.filteredCollectionHolder); - - } - - private CollectionChangeListener buildListener() { - return new CollectionChangeListener() { - public void itemsAdded(CollectionAddEvent e) { - FilteringCollectionValueModelTests.this.addEvent = e; - } - public void itemsRemoved(CollectionRemoveEvent e) { - FilteringCollectionValueModelTests.this.removeEvent = e; - } - public void collectionCleared(CollectionClearEvent e) { - FilteringCollectionValueModelTests.this.collectionClearedEvent = e; - } - public void collectionChanged(CollectionChangeEvent e) { - FilteringCollectionValueModelTests.this.collectionChangedEvent = e; - } - }; - } - - private ChangeListener buildChangeListener() { - return new ChangeAdapter() { - @Override - public void itemsAdded(CollectionAddEvent e) { - FilteringCollectionValueModelTests.this.addEvent = e; - } - @Override - public void itemsRemoved(CollectionRemoveEvent e) { - FilteringCollectionValueModelTests.this.removeEvent = e; - } - @Override - public void collectionCleared(CollectionClearEvent e) { - FilteringCollectionValueModelTests.this.collectionClearedEvent = e; - } - @Override - public void collectionChanged(CollectionChangeEvent e) { - FilteringCollectionValueModelTests.this.collectionChangedEvent = e; - } - }; - } - - private CollectionChangeListener buildFilteredListener() { - return new CollectionChangeListener() { - public void itemsAdded(CollectionAddEvent e) { - FilteringCollectionValueModelTests.this.filteredAddEvent = e; - } - public void itemsRemoved(CollectionRemoveEvent e) { - FilteringCollectionValueModelTests.this.filteredRemoveEvent = e; - } - public void collectionCleared(CollectionClearEvent e) { - FilteringCollectionValueModelTests.this.filteredCollectionClearedEvent = e; - } - public void collectionChanged(CollectionChangeEvent e) { - FilteringCollectionValueModelTests.this.filteredCollectionChangedEvent = e; - } - }; - } - - private ChangeListener buildFilteredChangeListener() { - return new ChangeAdapter() { - @Override - public void itemsAdded(CollectionAddEvent e) { - FilteringCollectionValueModelTests.this.filteredAddEvent = e; - } - @Override - public void itemsRemoved(CollectionRemoveEvent e) { - FilteringCollectionValueModelTests.this.filteredRemoveEvent = e; - } - @Override - public void collectionCleared(CollectionClearEvent e) { - FilteringCollectionValueModelTests.this.filteredCollectionClearedEvent = e; - } - @Override - public void collectionChanged(CollectionChangeEvent e) { - FilteringCollectionValueModelTests.this.filteredCollectionChangedEvent = e; - } - }; - } - - private void verifyEvent(CollectionChangeEvent event, Object source) { - assertEquals(source, event.getSource()); - assertEquals(CollectionValueModel.VALUES, event.getCollectionName()); - } - - private void verifyEvent(CollectionAddEvent event, Object source, Object items) { - assertEquals(source, event.getSource()); - assertEquals(CollectionValueModel.VALUES, event.getCollectionName()); - assertEquals(items, CollectionTools.vector(event.getItems())); - } - - private void verifyEvent(CollectionRemoveEvent event, Object source, Object items) { - assertEquals(source, event.getSource()); - assertEquals(CollectionValueModel.VALUES, event.getCollectionName()); - assertEquals(items, CollectionTools.vector(event.getItems())); - } - - public void testRemoveFilteredItem() { - // build collection with TestItems - SimpleCollectionValueModel tiHolder = new SimpleCollectionValueModel(this.buildCollection2()); - CollectionValueModel filteredTIHolder = new FilteringCollectionValueModel(tiHolder, this.buildFilter2()); - // add a listener to "activate" the wrapper - filteredTIHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildFilteredListener()); - - assertEquals(0, filteredTIHolder.size()); - - tiHolder.add(new TestItem("bar")); - assertEquals(1, filteredTIHolder.size()); - - TestItem baz = new TestItem("baz"); - tiHolder.add(baz); - assertEquals(2, filteredTIHolder.size()); - // before removing it, change the item so that it is filtered - baz.name = "jaz"; - tiHolder.remove(baz); - // this would fail because the item was not removed from - // the filtered collection cache... but we've fixed it now - assertEquals(1, filteredTIHolder.size()); - } - - private Collection buildCollection2() { - Collection collection = new Vector(); - collection.add(new TestItem("foo")); - return collection; - } - - private Filter buildFilter2() { - return new Filter() { - public boolean accept(TestItem ti) { - return ti.name.startsWith("b"); - } - }; - } - - - // ********** TestItem inner class ********** - - private class TestItem { - String name; - TestItem(String name) { - super(); - this.name = name; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/FilteringPropertyValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/FilteringPropertyValueModelTests.java deleted file mode 100644 index a20db7f063..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/FilteringPropertyValueModelTests.java +++ /dev/null @@ -1,191 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.BidiFilter; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.FilteringWritablePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class FilteringPropertyValueModelTests extends TestCase { - private WritablePropertyValueModel objectHolder; - PropertyChangeEvent event; - - private WritablePropertyValueModel filteredObjectHolder; - PropertyChangeEvent filteredEvent; - - public FilteringPropertyValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.objectHolder = new SimplePropertyValueModel("foo"); - this.filteredObjectHolder = new FilteringWritablePropertyValueModel(this.objectHolder, this.buildFilter()); - } - - private BidiFilter buildFilter() { - return new BidiFilter() { - public boolean accept(String s) { - return (s != null) && s.startsWith("b"); - } - public boolean reverseAccept(String s) { - return (s != null) && s.startsWith("b"); - } - }; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testValue() { - assertEquals("foo", this.objectHolder.getValue()); - assertNull(this.filteredObjectHolder.getValue()); - - this.objectHolder.setValue("bar"); - assertEquals("bar", this.objectHolder.getValue()); - assertNotNull(this.filteredObjectHolder.getValue()); - assertEquals("bar", this.filteredObjectHolder.getValue()); - - this.objectHolder.setValue("baz"); - assertEquals("baz", this.objectHolder.getValue()); - assertNotNull(this.filteredObjectHolder.getValue()); - assertEquals("baz", this.filteredObjectHolder.getValue()); - - this.objectHolder.setValue(null); - assertNull(this.objectHolder.getValue()); - assertNull(this.filteredObjectHolder.getValue()); - - this.objectHolder.setValue("foo"); - assertEquals("foo", this.objectHolder.getValue()); - assertNull(this.filteredObjectHolder.getValue()); - } - - public void testSetValue() { - this.filteredObjectHolder.setValue("bar"); - assertEquals("bar", this.objectHolder.getValue()); - assertEquals("bar", this.filteredObjectHolder.getValue()); - - this.filteredObjectHolder.setValue("foo"); - assertEquals("bar", this.objectHolder.getValue()); - assertEquals("bar", this.filteredObjectHolder.getValue()); - - this.filteredObjectHolder.setValue(null); - assertEquals("bar", this.objectHolder.getValue()); - assertEquals("bar", this.filteredObjectHolder.getValue()); - - this.filteredObjectHolder.setValue("baz"); - assertEquals("baz", this.objectHolder.getValue()); - assertEquals("baz", this.filteredObjectHolder.getValue()); - } - - public void testLazyListening() { - assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - ChangeListener listener = this.buildFilteredListener(); - this.filteredObjectHolder.addChangeListener(listener); - assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.filteredObjectHolder.removeChangeListener(listener); - assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - - this.filteredObjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, listener); - assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.filteredObjectHolder.removePropertyChangeListener(PropertyValueModel.VALUE, listener); - assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - } - - public void testPropertyChange1() { - this.objectHolder.addChangeListener(this.buildListener()); - this.filteredObjectHolder.addChangeListener(this.buildFilteredListener()); - this.verifyPropertyChanges(); - } - - public void testPropertyChange2() { - this.objectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildListener()); - this.filteredObjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildFilteredListener()); - this.verifyPropertyChanges(); - } - - private void verifyPropertyChanges() { - this.event = null; - this.filteredEvent = null; - this.objectHolder.setValue("bar"); - this.verifyEvent(this.event, this.objectHolder, "foo", "bar"); - this.verifyEvent(this.filteredEvent, this.filteredObjectHolder, null, "bar"); - - this.event = null; - this.filteredEvent = null; - this.objectHolder.setValue("baz"); - this.verifyEvent(this.event, this.objectHolder, "bar", "baz"); - this.verifyEvent(this.filteredEvent, this.filteredObjectHolder, "bar", "baz"); - - this.event = null; - this.filteredEvent = null; - this.objectHolder.setValue("foo"); - this.verifyEvent(this.event, this.objectHolder, "baz", "foo"); - this.verifyEvent(this.filteredEvent, this.filteredObjectHolder, "baz", null); - - this.event = null; - this.filteredEvent = null; - this.objectHolder.setValue("fop"); - this.verifyEvent(this.event, this.objectHolder, "foo", "fop"); - assertNull(this.filteredEvent); - - this.event = null; - this.filteredEvent = null; - this.objectHolder.setValue(null); - this.verifyEvent(this.event, this.objectHolder, "fop", null); - assertNull(this.filteredEvent); - - this.event = null; - this.filteredEvent = null; - this.objectHolder.setValue("bar"); - this.verifyEvent(this.event, this.objectHolder, null, "bar"); - this.verifyEvent(this.filteredEvent, this.filteredObjectHolder, null, "bar"); - } - - private ChangeListener buildListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - FilteringPropertyValueModelTests.this.event = e; - } - }; - } - - private ChangeListener buildFilteredListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - FilteringPropertyValueModelTests.this.filteredEvent = e; - } - }; - } - - private void verifyEvent(PropertyChangeEvent e, Object source, Object oldValue, Object newValue) { - assertEquals(source, e.getSource()); - assertEquals(PropertyValueModel.VALUE, e.getPropertyName()); - assertEquals(oldValue, e.getOldValue()); - assertEquals(newValue, e.getNewValue()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ItemCollectionListValueModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ItemCollectionListValueModelAdapterTests.java deleted file mode 100644 index 7ede9fcd6a..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ItemCollectionListValueModelAdapterTests.java +++ /dev/null @@ -1,243 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import javax.swing.Icon; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.Bag; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.ItemCollectionListValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelWrapper; -import org.eclipse.jpt.common.utility.internal.swing.Displayable; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class ItemCollectionListValueModelAdapterTests extends TestCase { - private Junk foo; - private Junk bar; - private Junk baz; - private Junk joo; - private Junk jar; - private Junk jaz; - - private Junk tom; - private Junk dick; - private Junk harry; - - public ItemCollectionListValueModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.foo = new Junk("foo"); - this.bar = new Junk("bar"); - this.baz = new Junk("baz"); - this.joo = new Junk("joo"); - this.jar = new Junk("jar"); - this.jaz = new Junk("jaz"); - - this.tom = new Junk("tom"); - this.dick = new Junk("dick"); - this.harry = new Junk("harry"); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testCollectionSynchronization() { - SimpleCollectionValueModel collectionHolder = this.buildCollectionHolder(); - ListValueModel listValueModel = new ItemCollectionListValueModelAdapter(collectionHolder, Junk.STUFF_COLLECTION); - CoordinatedList synchList = new CoordinatedList(listValueModel); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - - collectionHolder.add(this.tom); - collectionHolder.add(this.dick); - collectionHolder.add(this.harry); - assertEquals(9, synchList.size()); - this.compare(listValueModel, synchList); - - collectionHolder.remove(this.foo); - collectionHolder.remove(this.jar); - collectionHolder.remove(this.harry); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - } - - public void testListSynchronization() { - SimpleListValueModel listHolder = this.buildListHolder(); - ListValueModel listValueModel = new ItemCollectionListValueModelAdapter(listHolder, Junk.STUFF_COLLECTION); - CoordinatedList synchList = new CoordinatedList(listValueModel); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - - listHolder.add(6, this.tom); - listHolder.add(7, this.dick); - listHolder.add(8, this.harry); - assertEquals(9, synchList.size()); - this.compare(listValueModel, synchList); - - listHolder.remove(8); - listHolder.remove(0); - listHolder.remove(4); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - } - - private void compare(ListValueModel listValueModel, List list) { - assertEquals(listValueModel.size(), list.size()); - for (int i = 0; i < listValueModel.size(); i++) { - assertEquals(listValueModel.get(i), list.get(i)); - } - } - - - public void testHasListeners() throws Exception { - SimpleListValueModel listHolder = this.buildListHolder(); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertFalse(this.foo.hasAnyListChangeListeners(Junk.STUFF_COLLECTION)); - assertFalse(this.jaz.hasAnyListChangeListeners(Junk.STUFF_COLLECTION)); - - ListValueModel listValueModel = new ItemCollectionListValueModelAdapter(listHolder, Junk.STUFF_COLLECTION); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertFalse(this.foo.hasAnyCollectionChangeListeners(Junk.STUFF_COLLECTION)); - assertFalse(this.jaz.hasAnyCollectionChangeListeners(Junk.STUFF_COLLECTION)); - this.verifyHasNoListeners(listValueModel); - - CoordinatedList synchList = new CoordinatedList(listValueModel); - assertTrue(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertTrue(this.foo.hasAnyCollectionChangeListeners(Junk.STUFF_COLLECTION)); - assertTrue(this.jaz.hasAnyCollectionChangeListeners(Junk.STUFF_COLLECTION)); - this.verifyHasListeners(listValueModel); - - listValueModel.removeListChangeListener(ListValueModel.LIST_VALUES, synchList); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertFalse(this.foo.hasAnyCollectionChangeListeners(Junk.STUFF_COLLECTION)); - assertFalse(this.jaz.hasAnyCollectionChangeListeners(Junk.STUFF_COLLECTION)); - this.verifyHasNoListeners(listValueModel); - } - - public void testGetSize() throws Exception { - SimpleListValueModel listHolder = this.buildListHolder(); - ListValueModel listValueModel = new ItemCollectionListValueModelAdapter(listHolder, Junk.STUFF_COLLECTION); - CoordinatedList synchList = new CoordinatedList(listValueModel); - this.verifyHasListeners(listValueModel); - assertEquals(6, listValueModel.size()); - assertEquals(6, synchList.size()); - } - - public void testGet() throws Exception { - SimpleListValueModel listHolder = this.buildListHolder(); - ListValueModel listValueModel = new SortedListValueModelWrapper(new ItemCollectionListValueModelAdapter(listHolder, Junk.STUFF_COLLECTION)); - CoordinatedList synchList = new CoordinatedList(listValueModel); - this.verifyHasListeners(listValueModel); - assertEquals(this.bar, listValueModel.get(0)); - assertEquals(this.bar, synchList.get(0)); - this.bar.removeStuff("bar"); - this.bar.addStuff("zzz"); - this.bar.addStuff("bar"); - assertEquals(this.bar, listValueModel.get(5)); - assertEquals(this.bar, synchList.get(5)); - this.bar.removeStuff("zzz"); - } - - private void verifyHasNoListeners(ListValueModel listValueModel) throws Exception { - assertTrue(((AbstractModel) listValueModel).hasNoListChangeListeners(ListValueModel.LIST_VALUES)); - } - - private void verifyHasListeners(ListValueModel listValueModel) throws Exception { - assertTrue(((AbstractModel) listValueModel).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - } - - private SimpleCollectionValueModel buildCollectionHolder() { - return new SimpleCollectionValueModel(this.buildCollection()); - } - - private Collection buildCollection() { - Bag bag = new HashBag(); - this.populateCollection(bag); - return bag; - } - - private SimpleListValueModel buildListHolder() { - return new SimpleListValueModel(this.buildList()); - } - - private List buildList() { - List list = new ArrayList(); - this.populateCollection(list); - return list; - } - - private void populateCollection(Collection c) { - c.add(this.foo); - c.add(this.bar); - c.add(this.baz); - c.add(this.joo); - c.add(this.jar); - c.add(this.jaz); - } - - - // ********** Junk class ********** - - private class Junk extends AbstractModel implements Displayable, Comparable { - private Collection stuff; - public static final String STUFF_COLLECTION = "stuff"; - - - public Junk(String stuffItem) { - this.stuff = new ArrayList(); - this.stuff.add(stuffItem); - } - - public void addStuff(String stuffItem) { - this.addItemToCollection(stuffItem, this.stuff, STUFF_COLLECTION); - } - - public void removeStuff(String stuffItem) { - this.removeItemFromCollection(stuffItem, this.stuff, STUFF_COLLECTION); - } - - public String displayString() { - return toString(); - } - - public Icon icon() { - return null; - } - - public int compareTo(Junk o) { - return this.displayString().compareTo(o.displayString()); - } - - @Override - public String toString() { - return "Junk(" + this.stuff + ")"; - } - - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ItemListListValueModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ItemListListValueModelAdapterTests.java deleted file mode 100644 index d566ece7d8..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ItemListListValueModelAdapterTests.java +++ /dev/null @@ -1,244 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import javax.swing.Icon; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.Bag; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.ItemListListValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelWrapper; -import org.eclipse.jpt.common.utility.internal.swing.Displayable; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class ItemListListValueModelAdapterTests extends TestCase { - private Junk foo; - private Junk bar; - private Junk baz; - private Junk joo; - private Junk jar; - private Junk jaz; - - private Junk tom; - private Junk dick; - private Junk harry; - - public ItemListListValueModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.foo = new Junk("foo"); - this.bar = new Junk("bar"); - this.baz = new Junk("baz"); - this.joo = new Junk("joo"); - this.jar = new Junk("jar"); - this.jaz = new Junk("jaz"); - - this.tom = new Junk("tom"); - this.dick = new Junk("dick"); - this.harry = new Junk("harry"); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testCollectionSynchronization() { - SimpleCollectionValueModel collectionHolder = this.buildCollectionHolder(); - ListValueModel listValueModel = new ItemListListValueModelAdapter(collectionHolder, Junk.STUFF_LIST); - CoordinatedList synchList = new CoordinatedList(listValueModel); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - - collectionHolder.add(this.tom); - collectionHolder.add(this.dick); - collectionHolder.add(this.harry); - assertEquals(9, synchList.size()); - this.compare(listValueModel, synchList); - - collectionHolder.remove(this.foo); - collectionHolder.remove(this.jar); - collectionHolder.remove(this.harry); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - } - - public void testListSynchronization() { - SimpleListValueModel listHolder = this.buildListHolder(); - ListValueModel listValueModel = new ItemListListValueModelAdapter(listHolder, Junk.STUFF_LIST); - CoordinatedList synchList = new CoordinatedList(listValueModel); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - - listHolder.add(6, this.tom); - listHolder.add(7, this.dick); - listHolder.add(8, this.harry); - assertEquals(9, synchList.size()); - this.compare(listValueModel, synchList); - - listHolder.remove(8); - listHolder.remove(0); - listHolder.remove(4); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - } - - private void compare(ListValueModel listValueModel, List list) { - assertEquals(listValueModel.size(), list.size()); - for (int i = 0; i < listValueModel.size(); i++) { - assertEquals(listValueModel.get(i), list.get(i)); - } - } - - - public void testHasListeners() throws Exception { - SimpleListValueModel listHolder = this.buildListHolder(); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertFalse(this.foo.hasAnyListChangeListeners(Junk.STUFF_LIST)); - assertFalse(this.jaz.hasAnyListChangeListeners(Junk.STUFF_LIST)); - - ListValueModel listValueModel = new ItemListListValueModelAdapter(listHolder, Junk.STUFF_LIST); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertFalse(this.foo.hasAnyListChangeListeners(Junk.STUFF_LIST)); - assertFalse(this.jaz.hasAnyListChangeListeners(Junk.STUFF_LIST)); - this.verifyHasNoListeners(listValueModel); - - CoordinatedList synchList = new CoordinatedList(listValueModel); - assertTrue(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertTrue(this.foo.hasAnyListChangeListeners(Junk.STUFF_LIST)); - assertTrue(this.jaz.hasAnyListChangeListeners(Junk.STUFF_LIST)); - this.verifyHasListeners(listValueModel); - - listValueModel.removeListChangeListener(ListValueModel.LIST_VALUES, synchList); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertFalse(this.foo.hasAnyListChangeListeners(Junk.STUFF_LIST)); - assertFalse(this.jaz.hasAnyListChangeListeners(Junk.STUFF_LIST)); - this.verifyHasNoListeners(listValueModel); - } - - public void testGetSize() throws Exception { - SimpleListValueModel listHolder = this.buildListHolder(); - ListValueModel listValueModel = new ItemListListValueModelAdapter(listHolder, Junk.STUFF_LIST); - CoordinatedList synchList = new CoordinatedList(listValueModel); - this.verifyHasListeners(listValueModel); - assertEquals(6, listValueModel.size()); - assertEquals(6, synchList.size()); - } - - public void testGet() throws Exception { - SimpleListValueModel listHolder = this.buildListHolder(); - ListValueModel listValueModel = new SortedListValueModelWrapper(new ItemListListValueModelAdapter(listHolder, Junk.STUFF_LIST)); - CoordinatedList synchList = new CoordinatedList(listValueModel); - this.verifyHasListeners(listValueModel); - assertEquals(this.bar, listValueModel.get(0)); - assertEquals(this.bar, synchList.get(0)); - this.bar.removeStuff("bar"); - this.bar.addStuff("zzz"); - this.bar.addStuff("bar"); - assertEquals(this.bar, listValueModel.get(5)); - assertEquals(this.bar, synchList.get(5)); - this.bar.removeStuff("zzz"); - } - - private void verifyHasNoListeners(ListValueModel listValueModel) throws Exception { - assertTrue(((AbstractModel) listValueModel).hasNoListChangeListeners(ListValueModel.LIST_VALUES)); - } - - private void verifyHasListeners(ListValueModel listValueModel) throws Exception { - assertTrue(((AbstractModel) listValueModel).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - } - - private SimpleCollectionValueModel buildCollectionHolder() { - return new SimpleCollectionValueModel(this.buildCollection()); - } - - private Collection buildCollection() { - Bag bag = new HashBag(); - this.populateCollection(bag); - return bag; - } - - private SimpleListValueModel buildListHolder() { - return new SimpleListValueModel(this.buildList()); - } - - private List buildList() { - List list = new ArrayList(); - this.populateCollection(list); - return list; - } - - private void populateCollection(Collection c) { - c.add(this.foo); - c.add(this.bar); - c.add(this.baz); - c.add(this.joo); - c.add(this.jar); - c.add(this.jaz); - } - - - // ********** Junk class ********** - - private class Junk extends AbstractModel implements Displayable, Comparable { - private List stuff; - public static final String STUFF_LIST = "stuff"; - - - public Junk(String stuffItem) { - this.stuff = new ArrayList(); - this.stuff.add(stuffItem); - } - public void addStuff(String stuffItem) { - this.stuff.add(stuffItem); - fireItemAdded(STUFF_LIST, this.stuff.indexOf(stuffItem), stuffItem); - } - - public void removeStuff(String stuffItem) { - int index = this.stuff.indexOf(stuffItem); - this.stuff.remove(stuffItem); - fireItemRemoved(STUFF_LIST, index, stuffItem); - } - - public String displayString() { - return toString(); - } - - public Icon icon() { - return null; - } - - public int compareTo(Junk o) { - return this.displayString().compareTo(o.displayString()); - } - - @Override - public String toString() { - return "Junk(" + this.stuff + ")"; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ItemPropertyListValueModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ItemPropertyListValueModelAdapterTests.java deleted file mode 100644 index 35fce2a3e9..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ItemPropertyListValueModelAdapterTests.java +++ /dev/null @@ -1,335 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.SortedSet; -import java.util.TreeSet; - -import javax.swing.Icon; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.Bag; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.ItemPropertyListValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelWrapper; -import org.eclipse.jpt.common.utility.internal.swing.Displayable; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class ItemPropertyListValueModelAdapterTests extends TestCase { - private Junk foo; - private Junk bar; - private Junk baz; - private Junk joo; - private Junk jar; - private Junk jaz; - - private Junk tom; - private Junk dick; - private Junk harry; - - public ItemPropertyListValueModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.foo = new Junk("this.foo"); - this.bar = new Junk("this.bar"); - this.baz = new Junk("this.baz"); - this.joo = new Junk("this.joo"); - this.jar = new Junk("this.jar"); - this.jaz = new Junk("this.jaz"); - - this.tom = new Junk("this.tom"); - this.dick = new Junk("this.dick"); - this.harry = new Junk("this.harry"); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testCollectionSynchronization() { - SimpleCollectionValueModel collectionHolder = this.buildCollectionHolder(); - ListValueModel listValueModel = new ItemPropertyListValueModelAdapter(collectionHolder, Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY); - CoordinatedList synchList = new CoordinatedList(listValueModel); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - - collectionHolder.add(this.tom); - collectionHolder.add(this.dick); - collectionHolder.add(this.harry); - assertEquals(9, synchList.size()); - this.compare(listValueModel, synchList); - - collectionHolder.remove(this.foo); - collectionHolder.remove(this.jar); - collectionHolder.remove(this.harry); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - - collectionHolder.setValues(this.buildCollection()); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - } - - public void testListSynchronization() { - SimpleListValueModel listHolder = this.buildListHolder(); - ListValueModel listValueModel = new ItemPropertyListValueModelAdapter(listHolder, Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY); - CoordinatedList synchList = new CoordinatedList(listValueModel); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - - listHolder.add(6, this.tom); - listHolder.add(7, this.dick); - listHolder.add(8, this.harry); - assertEquals(9, synchList.size()); - this.compare(listValueModel, synchList); - - listHolder.remove(8); - listHolder.remove(0); - listHolder.remove(4); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - - // test concurrent modification exception - listHolder.setListValues(this.buildList()); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - } - - private void compare(ListValueModel listValueModel, List list) { - assertEquals(listValueModel.size(), list.size()); - for (int i = 0; i < listValueModel.size(); i++) { - assertEquals(listValueModel.get(i), list.get(i)); - } - } - - public void testCollectionSort() { - this.verifyCollectionSort(null); - } - - public void testListSort() { - this.verifyListSort(null); - } - - public void testCustomCollectionSort() { - this.verifyCollectionSort(this.buildCustomComparator()); - } - - public void testCustomListSort() { - this.verifyListSort(this.buildCustomComparator()); - } - - private Comparator buildCustomComparator() { - // sort with reverse order - return new Comparator() { - public int compare(Junk o1, Junk o2) { - return o2.displayString().compareTo(o1.displayString()); - } - }; - } - - private void verifyCollectionSort(Comparator comparator) { - SimpleCollectionValueModel collectionHolder = this.buildCollectionHolder(); - ListValueModel listValueModel = new ItemPropertyListValueModelAdapter(new SortedListValueModelAdapter(collectionHolder, comparator), Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY); - CoordinatedList synchList = new CoordinatedList(listValueModel); - assertEquals(6, synchList.size()); - this.compareSort(listValueModel, synchList, comparator); - - collectionHolder.add(this.tom); - collectionHolder.add(this.dick); - collectionHolder.add(this.harry); - assertEquals(9, synchList.size()); - this.compareSort(listValueModel, synchList, comparator); - - collectionHolder.remove(this.foo); - collectionHolder.remove(this.jar); - collectionHolder.remove(this.harry); - assertEquals(6, synchList.size()); - this.compareSort(listValueModel, synchList, comparator); - - collectionHolder.setValues(this.buildCollection()); - assertEquals(6, synchList.size()); - this.compareSort(listValueModel, synchList, comparator); - } - - private void verifyListSort(Comparator comparator) { - SimpleListValueModel listHolder = this.buildListHolder(); - ListValueModel listValueModel = new ItemPropertyListValueModelAdapter(new SortedListValueModelWrapper(listHolder, comparator), Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY); - CoordinatedList synchList = new CoordinatedList(listValueModel); - assertEquals(6, synchList.size()); - this.compareSort(listValueModel, synchList, comparator); - - listHolder.add(0, this.tom); - listHolder.add(0, this.dick); - listHolder.add(0, this.harry); - assertEquals(9, synchList.size()); - this.compareSort(listValueModel, synchList, comparator); - - listHolder.remove(8); - listHolder.remove(4); - listHolder.remove(0); - listHolder.remove(5); - assertEquals(5, synchList.size()); - this.compareSort(listValueModel, synchList, comparator); - - listHolder.setListValues(this.buildList()); - assertEquals(6, synchList.size()); - this.compareSort(listValueModel, synchList, comparator); - } - - private void compareSort(ListValueModel listValueModel, List list, Comparator comparator) { - SortedSet ss = new TreeSet(comparator); - for (int i = 0; i < listValueModel.size(); i++) { - ss.add(listValueModel.get(i)); - } - assertEquals(ss.size(), list.size()); - for (Iterator stream1 = ss.iterator(), stream2 = list.iterator(); stream1.hasNext(); ) { - assertEquals(stream1.next(), stream2.next()); - } - } - - public void testHasListeners() throws Exception { - SimpleListValueModel listHolder = this.buildListHolder(); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertFalse(this.foo.hasAnyPropertyChangeListeners(Displayable.DISPLAY_STRING_PROPERTY)); - assertFalse(this.foo.hasAnyPropertyChangeListeners(Displayable.ICON_PROPERTY)); - assertFalse(this.jaz.hasAnyPropertyChangeListeners(Displayable.DISPLAY_STRING_PROPERTY)); - assertFalse(this.jaz.hasAnyPropertyChangeListeners(Displayable.ICON_PROPERTY)); - - ListValueModel listValueModel = new ItemPropertyListValueModelAdapter(new SortedListValueModelWrapper(listHolder), Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertFalse(this.foo.hasAnyPropertyChangeListeners(Displayable.DISPLAY_STRING_PROPERTY)); - assertFalse(this.foo.hasAnyPropertyChangeListeners(Displayable.ICON_PROPERTY)); - assertFalse(this.jaz.hasAnyPropertyChangeListeners(Displayable.DISPLAY_STRING_PROPERTY)); - assertFalse(this.jaz.hasAnyPropertyChangeListeners(Displayable.ICON_PROPERTY)); - this.verifyHasNoListeners(listValueModel); - - CoordinatedList synchList = new CoordinatedList(listValueModel); - assertTrue(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertTrue(this.foo.hasAnyPropertyChangeListeners(Displayable.DISPLAY_STRING_PROPERTY)); - assertTrue(this.foo.hasAnyPropertyChangeListeners(Displayable.ICON_PROPERTY)); - assertTrue(this.jaz.hasAnyPropertyChangeListeners(Displayable.DISPLAY_STRING_PROPERTY)); - assertTrue(this.jaz.hasAnyPropertyChangeListeners(Displayable.ICON_PROPERTY)); - this.verifyHasListeners(listValueModel); - - listValueModel.removeListChangeListener(ListValueModel.LIST_VALUES, synchList); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertFalse(this.foo.hasAnyPropertyChangeListeners(Displayable.DISPLAY_STRING_PROPERTY)); - assertFalse(this.foo.hasAnyPropertyChangeListeners(Displayable.ICON_PROPERTY)); - assertFalse(this.jaz.hasAnyPropertyChangeListeners(Displayable.DISPLAY_STRING_PROPERTY)); - assertFalse(this.jaz.hasAnyPropertyChangeListeners(Displayable.ICON_PROPERTY)); - this.verifyHasNoListeners(listValueModel); - } - - public void testGetSize() throws Exception { - SimpleListValueModel listHolder = this.buildListHolder(); - ListValueModel listValueModel = new ItemPropertyListValueModelAdapter(new SortedListValueModelWrapper(listHolder), Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY); - CoordinatedList synchList = new CoordinatedList(listValueModel); - this.verifyHasListeners(listValueModel); - assertEquals(6, listValueModel.size()); - assertEquals(6, synchList.size()); - } - - public void testGet() throws Exception { - SimpleListValueModel listHolder = this.buildListHolder(); - ListValueModel listValueModel = new SortedListValueModelWrapper(new ItemPropertyListValueModelAdapter(listHolder, Displayable.DISPLAY_STRING_PROPERTY, Displayable.ICON_PROPERTY)); - CoordinatedList synchList = new CoordinatedList(listValueModel); - this.verifyHasListeners(listValueModel); - assertEquals(this.bar, listValueModel.get(0)); - assertEquals(this.bar, synchList.get(0)); - this.bar.setName("zzz"); - assertEquals(this.bar, listValueModel.get(5)); - assertEquals(this.bar, synchList.get(5)); - this.bar.setName("this.bar"); - } - - private void verifyHasNoListeners(ListValueModel listValueModel) throws Exception { - assertTrue(((AbstractModel) listValueModel).hasNoListChangeListeners(ListValueModel.LIST_VALUES)); - } - - private void verifyHasListeners(ListValueModel listValueModel) throws Exception { - assertTrue(((AbstractModel) listValueModel).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - } - - private SimpleCollectionValueModel buildCollectionHolder() { - return new SimpleCollectionValueModel(this.buildCollection()); - } - - private Collection buildCollection() { - Bag bag = new HashBag(); - this.populateCollection(bag); - return bag; - } - - private SimpleListValueModel buildListHolder() { - return new SimpleListValueModel(this.buildList()); - } - - private List buildList() { - List list = new ArrayList(); - this.populateCollection(list); - return list; - } - - private void populateCollection(Collection c) { - c.add(this.foo); - c.add(this.bar); - c.add(this.baz); - c.add(this.joo); - c.add(this.jar); - c.add(this.jaz); - } - - - // ********** Junk class ********** - - private class Junk extends AbstractModel implements Displayable, Comparable { - private String name; - public Junk(String name) { - this.name = name; - } - public String displayString() { - return this.name; - } - public Icon icon() { - return null; - } - public void setName(String name) { - Object old = this.name; - this.name = name; - this.firePropertyChanged(DISPLAY_STRING_PROPERTY, old, name); - } - public int compareTo(Junk o) { - return this.displayString().compareTo(o.displayString()); - } - @Override - public String toString() { - return "Junk(" + this.name + ")"; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ItemStateListValueModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ItemStateListValueModelAdapterTests.java deleted file mode 100644 index 18730739e9..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ItemStateListValueModelAdapterTests.java +++ /dev/null @@ -1,306 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.SortedSet; -import java.util.TreeSet; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.Bag; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.ItemStateListValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelWrapper; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class ItemStateListValueModelAdapterTests extends TestCase { - private Junk foo; - private Junk bar; - private Junk baz; - private Junk joo; - private Junk jar; - private Junk jaz; - - private Junk tom; - private Junk dick; - private Junk harry; - - public ItemStateListValueModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.foo = new Junk("this.foo"); - this.bar = new Junk("this.bar"); - this.baz = new Junk("this.baz"); - this.joo = new Junk("this.joo"); - this.jar = new Junk("this.jar"); - this.jaz = new Junk("this.jaz"); - - this.tom = new Junk("this.tom"); - this.dick = new Junk("this.dick"); - this.harry = new Junk("this.harry"); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testCollectionSynchronization() { - SimpleCollectionValueModel collectionHolder = this.buildCollectionHolder(); - ListValueModel listValueModel = new ItemStateListValueModelAdapter(collectionHolder); - CoordinatedList synchList = new CoordinatedList(listValueModel); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - - collectionHolder.add(this.tom); - collectionHolder.add(this.dick); - collectionHolder.add(this.harry); - assertEquals(9, synchList.size()); - this.compare(listValueModel, synchList); - - collectionHolder.remove(this.foo); - collectionHolder.remove(this.jar); - collectionHolder.remove(this.harry); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - } - - public void testListSynchronization() { - SimpleListValueModel listHolder = this.buildListHolder(); - ListValueModel listValueModel = new ItemStateListValueModelAdapter(listHolder); - CoordinatedList synchList = new CoordinatedList(listValueModel); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - - listHolder.add(6, this.tom); - listHolder.add(7, this.dick); - listHolder.add(8, this.harry); - assertEquals(9, synchList.size()); - this.compare(listValueModel, synchList); - - listHolder.remove(8); - listHolder.remove(0); - listHolder.remove(4); - assertEquals(6, synchList.size()); - this.compare(listValueModel, synchList); - } - - private void compare(ListValueModel listValueModel, List list) { - assertEquals(listValueModel.size(), list.size()); - for (int i = 0; i < listValueModel.size(); i++) { - assertEquals(listValueModel.get(i), list.get(i)); - } - } - - public void testCollectionSort() { - this.verifyCollectionSort(null); - } - - public void testListSort() { - this.verifyListSort(null); - } - - public void testCustomCollectionSort() { - this.verifyCollectionSort(this.buildCustomComparator()); - } - - public void testCustomListSort() { - this.verifyListSort(this.buildCustomComparator()); - } - - private Comparator buildCustomComparator() { - // sort with reverse order - return new Comparator() { - public int compare(Junk o1, Junk o2) { - return o2.compareTo(o1); - } - }; - } - - private void verifyCollectionSort(Comparator comparator) { - SimpleCollectionValueModel collectionHolder = this.buildCollectionHolder(); - ListValueModel listValueModel = new ItemStateListValueModelAdapter(new SortedListValueModelAdapter(collectionHolder, comparator)); - CoordinatedList synchList = new CoordinatedList(listValueModel); - assertEquals(6, synchList.size()); - this.compareSort(listValueModel, synchList, comparator); - - collectionHolder.add(this.tom); - collectionHolder.add(this.dick); - collectionHolder.add(this.harry); - assertEquals(9, synchList.size()); - this.compareSort(listValueModel, synchList, comparator); - - collectionHolder.remove(this.foo); - collectionHolder.remove(this.jar); - collectionHolder.remove(this.harry); - assertEquals(6, synchList.size()); - this.compareSort(listValueModel, synchList, comparator); - } - - private void verifyListSort(Comparator comparator) { - SimpleListValueModel listHolder = this.buildListHolder(); - ListValueModel listValueModel = new ItemStateListValueModelAdapter(new SortedListValueModelWrapper(listHolder, comparator)); - CoordinatedList synchList = new CoordinatedList(listValueModel); - assertEquals(6, synchList.size()); - this.compareSort(listValueModel, synchList, comparator); - - listHolder.add(0, this.tom); - listHolder.add(0, this.dick); - listHolder.add(0, this.harry); - assertEquals(9, synchList.size()); - this.compareSort(listValueModel, synchList, comparator); - - listHolder.remove(8); - listHolder.remove(4); - listHolder.remove(0); - listHolder.remove(5); - assertEquals(5, synchList.size()); - this.compareSort(listValueModel, synchList, comparator); - } - - private void compareSort(ListValueModel listValueModel, List list, Comparator comparator) { - SortedSet ss = new TreeSet(comparator); - for (int i = 0; i < listValueModel.size(); i++) { - ss.add(listValueModel.get(i)); - } - assertEquals(ss.size(), list.size()); - for (Iterator stream1 = ss.iterator(), stream2 = list.iterator(); stream1.hasNext(); ) { - assertEquals(stream1.next(), stream2.next()); - } - } - - public void testHasListeners() throws Exception { - SimpleListValueModel listHolder = this.buildListHolder(); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertFalse(this.foo.hasAnyStateChangeListeners()); - assertFalse(this.foo.hasAnyStateChangeListeners()); - assertFalse(this.jaz.hasAnyStateChangeListeners()); - assertFalse(this.jaz.hasAnyStateChangeListeners()); - - ListValueModel listValueModel = new ItemStateListValueModelAdapter(new SortedListValueModelWrapper(listHolder)); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertFalse(this.foo.hasAnyStateChangeListeners()); - assertFalse(this.foo.hasAnyStateChangeListeners()); - assertFalse(this.jaz.hasAnyStateChangeListeners()); - assertFalse(this.jaz.hasAnyStateChangeListeners()); - this.verifyHasNoListeners(listValueModel); - - CoordinatedList synchList = new CoordinatedList(listValueModel); - assertTrue(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertTrue(this.foo.hasAnyStateChangeListeners()); - assertTrue(this.foo.hasAnyStateChangeListeners()); - assertTrue(this.jaz.hasAnyStateChangeListeners()); - assertTrue(this.jaz.hasAnyStateChangeListeners()); - this.verifyHasListeners(listValueModel); - - listValueModel.removeListChangeListener(ListValueModel.LIST_VALUES, synchList); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertFalse(this.foo.hasAnyStateChangeListeners()); - assertFalse(this.foo.hasAnyStateChangeListeners()); - assertFalse(this.jaz.hasAnyStateChangeListeners()); - assertFalse(this.jaz.hasAnyStateChangeListeners()); - this.verifyHasNoListeners(listValueModel); - } - - public void testGetSize() throws Exception { - SimpleListValueModel listHolder = this.buildListHolder(); - ListValueModel listValueModel = new ItemStateListValueModelAdapter(new SortedListValueModelWrapper(listHolder)); - CoordinatedList synchList = new CoordinatedList(listValueModel); - this.verifyHasListeners(listValueModel); - assertEquals(6, listValueModel.size()); - assertEquals(6, synchList.size()); - } - - public void testGet() throws Exception { - SimpleListValueModel listHolder = this.buildListHolder(); - ListValueModel listValueModel = new SortedListValueModelWrapper(new ItemStateListValueModelAdapter(listHolder)); - CoordinatedList synchList = new CoordinatedList(listValueModel); - this.verifyHasListeners(listValueModel); - assertEquals(this.bar, listValueModel.get(0)); - assertEquals(this.bar, synchList.get(0)); - this.bar.setName("zzz"); - assertEquals(this.bar, listValueModel.get(5)); - assertEquals(this.bar, synchList.get(5)); - this.bar.setName("this.bar"); - } - - private void verifyHasNoListeners(ListValueModel listValueModel) throws Exception { - assertTrue(((AbstractModel) listValueModel).hasNoListChangeListeners(ListValueModel.LIST_VALUES)); - } - - private void verifyHasListeners(ListValueModel listValueModel) throws Exception { - assertTrue(((AbstractModel) listValueModel).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - } - - private SimpleCollectionValueModel buildCollectionHolder() { - return new SimpleCollectionValueModel(this.buildCollection()); - } - - private Collection buildCollection() { - Bag bag = new HashBag(); - this.populateCollection(bag); - return bag; - } - - private SimpleListValueModel buildListHolder() { - return new SimpleListValueModel(this.buildList()); - } - - private List buildList() { - List list = new ArrayList(); - this.populateCollection(list); - return list; - } - - private void populateCollection(Collection c) { - c.add(this.foo); - c.add(this.bar); - c.add(this.baz); - c.add(this.joo); - c.add(this.jar); - c.add(this.jaz); - } - - // ********** Junk class ********** - private class Junk extends AbstractModel implements Comparable { - private String name; - public Junk(String name) { - this.name = name; - } - public void setName(String name) { - this.name = name; - this.fireStateChanged(); - } - public int compareTo(Junk j) { - return this.name.compareTo(j.name); - } - @Override - public String toString() { - return "Junk(" + this.name + ")"; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/JptUtilityModelValueTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/JptUtilityModelValueTests.java deleted file mode 100644 index 9812dd32bd..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/JptUtilityModelValueTests.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import junit.framework.Test; -import junit.framework.TestSuite; -import org.eclipse.jpt.common.utility.tests.internal.model.value.prefs.JptUtilityModelValuePrefsTests; -import org.eclipse.jpt.common.utility.tests.internal.model.value.swing.JptUtilityModelValueSwingTests; - -public class JptUtilityModelValueTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptUtilityModelValueTests.class.getPackage().getName()); - - suite.addTest(JptUtilityModelValuePrefsTests.suite()); - suite.addTest(JptUtilityModelValueSwingTests.suite()); - - suite.addTestSuite(BufferedWritablePropertyValueModelTests.class); - suite.addTestSuite(CachingTransformationPropertyValueModelTests.class); - suite.addTestSuite(CachingTransformationWritablePropertyValueModelTests.class); - suite.addTestSuite(CollectionAspectAdapterTests.class); - suite.addTestSuite(CollectionListValueModelAdapterTests.class); - suite.addTestSuite(CollectionPropertyValueModelAdapterTests.class); - suite.addTestSuite(CompositeBooleanPropertyValueModelTests.class); - suite.addTestSuite(CompositeCollectionValueModelTests.class); - suite.addTestSuite(CompositeListValueModelTests.class); - suite.addTestSuite(CompositePropertyValueModelTests.class); - suite.addTestSuite(ExtendedListValueModelWrapperTests.class); - suite.addTestSuite(FilteringCollectionValueModelTests.class); - suite.addTestSuite(FilteringPropertyValueModelTests.class); - suite.addTestSuite(ItemCollectionListValueModelAdapterTests.class); - suite.addTestSuite(ItemListListValueModelAdapterTests.class); - suite.addTestSuite(ItemPropertyListValueModelAdapterTests.class); - suite.addTestSuite(ItemStateListValueModelAdapterTests.class); - suite.addTestSuite(ListAspectAdapterTests.class); - suite.addTestSuite(ListCollectionValueModelAdapterTests.class); - suite.addTestSuite(ListCuratorTests.class); - suite.addTestSuite(NullCollectionValueModelTests.class); - suite.addTestSuite(NullListValueModelTests.class); - suite.addTestSuite(NullPropertyValueModelTests.class); - suite.addTestSuite(PropertyAspectAdapterTests.class); - suite.addTestSuite(PropertyCollectionValueModelAdapterTests.class); - suite.addTestSuite(PropertyListValueModelAdapterTests.class); - suite.addTestSuite(ReadOnlyWritablePropertyValueModelWrapperTests.class); - suite.addTestSuite(SetCollectionValueModelTests.class); - suite.addTestSuite(SimpleCollectionValueModelTests.class); - suite.addTestSuite(SimpleListValueModelTests.class); - suite.addTestSuite(SimplePropertyValueModelTests.class); - suite.addTestSuite(SortedListValueModelAdapterTests.class); - suite.addTestSuite(SortedListValueModelWrapperTests.class); - suite.addTestSuite(StaticCollectionValueModelTests.class); - suite.addTestSuite(StaticListValueModelTests.class); - suite.addTestSuite(StaticValueModelTests.class); - suite.addTestSuite(TransformationListValueModelTests.class); - suite.addTestSuite(TransformationListValueModelTests.TransformerTests.class); - suite.addTestSuite(TransformationPropertyValueModelTests.class); - suite.addTestSuite(TreeAspectAdapterTests.class); - suite.addTestSuite(ValueCollectionAdapterTests.class); - suite.addTestSuite(ValueListAdapterTests.class); - suite.addTestSuite(ValuePropertyAdapterTests.class); - suite.addTestSuite(ValueStateAdapterTests.class); - - return suite; - } - - private JptUtilityModelValueTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ListAspectAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ListAspectAdapterTests.java deleted file mode 100644 index d6f3fd2999..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ListAspectAdapterTests.java +++ /dev/null @@ -1,476 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.List; -import java.util.ListIterator; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyListIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class ListAspectAdapterTests extends TestCase { - private TestSubject subject1; - private WritablePropertyValueModel subjectHolder1; - private LocalListAspectAdapter aa1; - private ListEvent event1; - private ListChangeListener listener1; - - private TestSubject subject2; - - public ListAspectAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.subject1 = new TestSubject(); - this.subject1.addNames(this.subject1Names()); - this.subject1.addDescriptions(this.subject1Descriptions()); - this.subjectHolder1 = new SimplePropertyValueModel(this.subject1); - this.aa1 = this.buildAspectAdapter(this.subjectHolder1); - this.listener1 = this.buildValueChangeListener1(); - this.aa1.addListChangeListener(ListValueModel.LIST_VALUES, this.listener1); - this.event1 = null; - - this.subject2 = new TestSubject(); - this.subject2.addNames(this.subject2Names()); - this.subject2.addDescriptions(this.subject2Descriptions()); - } - - private List subject1Names() { - List result = new ArrayList(); - result.add("foo"); - result.add("bar"); - result.add("baz"); - result.add("bam"); - return result; - } - - private List subject1Descriptions() { - List result = new ArrayList(); - result.add("this.subject1 description1"); - result.add("this.subject1 description2"); - return result; - } - - private List subject2Names() { - List result = new ArrayList(); - result.add("joo"); - result.add("jar"); - result.add("jaz"); - result.add("jam"); - return result; - } - - private List subject2Descriptions() { - List result = new ArrayList(); - result.add("this.subject2 description1"); - result.add("this.subject2 description2"); - return result; - } - - private LocalListAspectAdapter buildAspectAdapter(PropertyValueModel subjectHolder) { - return new LocalListAspectAdapter(subjectHolder); - } - - private ListChangeListener buildValueChangeListener1() { - return new ListChangeListener() { - public void itemsAdded(ListAddEvent e) { - ListAspectAdapterTests.this.value1Changed(e); - } - public void itemsRemoved(ListRemoveEvent e) { - ListAspectAdapterTests.this.value1Changed(e); - } - public void itemsReplaced(ListReplaceEvent e) { - ListAspectAdapterTests.this.value1Changed(e); - } - public void itemsMoved(ListMoveEvent e) { - ListAspectAdapterTests.this.value1Changed(e); - } - public void listCleared(ListClearEvent e) { - ListAspectAdapterTests.this.value1Changed(e); - } - public void listChanged(ListChangeEvent e) { - ListAspectAdapterTests.this.value1Changed(e); - } - }; - } - - void value1Changed(ListEvent e) { - this.event1 = e; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testSubjectHolder() { - assertEquals(this.subject1Names(), CollectionTools.list(this.aa1.listIterator())); - assertNull(this.event1); - - this.subjectHolder1.setValue(this.subject2); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(this.subject2Names(), CollectionTools.list(this.aa1.listIterator())); - - this.event1 = null; - this.subjectHolder1.setValue(null); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertFalse(this.aa1.iterator().hasNext()); - - this.event1 = null; - this.subjectHolder1.setValue(this.subject1); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(this.subject1Names(), CollectionTools.list(this.aa1.listIterator())); - } - - public void testAdd() { - assertEquals(this.subject1Names(), CollectionTools.list(this.aa1.listIterator())); - assertNull(this.event1); - - this.subject1.addName("jam"); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(this.subject1Names().size(), ((ListAddEvent) this.event1).getIndex()); - assertEquals("jam", ((ListAddEvent) this.event1).getItems().iterator().next()); - List namesPlus = this.subject1Names(); - namesPlus.add("jam"); - assertEquals(namesPlus, CollectionTools.list(this.aa1.listIterator())); - - this.event1 = null; - this.aa1.add(2, "jaz"); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(2, ((ListAddEvent) this.event1).getIndex()); - assertEquals("jaz", ((ListAddEvent) this.event1).getItems().iterator().next()); - namesPlus.add(2, "jaz"); - assertEquals(namesPlus, CollectionTools.list(this.aa1.listIterator())); - } - - public void testDefaultAdd() { - assertEquals(this.subject1Names(), CollectionTools.list(this.aa1.listIterator())); - assertNull(this.event1); - - List items = new ArrayList(); - items.add("joo"); - items.add("jar"); - items.add("jaz"); - items.add("jam"); - - this.event1 = null; - this.aa1.addAll(2, items); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(5, ((ListAddEvent) this.event1).getIndex()); // only the last "add" event will still be there - assertEquals("jam", ((ListAddEvent) this.event1).getItems().iterator().next()); - List namesPlus = this.subject1Names(); - namesPlus.addAll(2, items); - assertEquals(namesPlus, CollectionTools.list(this.aa1.listIterator())); - } - - public void testRemove() { - assertEquals(this.subject1Names(), CollectionTools.list(this.aa1.listIterator())); - assertNull(this.event1); - - String removedName = this.subject1.removeName(0); // should be "foo" - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(0, ((ListRemoveEvent) this.event1).getIndex()); - assertEquals(removedName, ((ListRemoveEvent) this.event1).getItems().iterator().next()); - List namesMinus = this.subject1Names(); - namesMinus.remove(0); - assertEquals(namesMinus, CollectionTools.list(this.aa1.listIterator())); - - this.event1 = null; - Object removedItem = this.aa1.remove(0); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(0, ((ListRemoveEvent) this.event1).getIndex()); - assertEquals(removedItem, ((ListRemoveEvent) this.event1).getItems().iterator().next()); - namesMinus.remove(0); - assertEquals(namesMinus, CollectionTools.list(this.aa1.listIterator())); - } - - public void testDefaultLength() { - assertEquals(this.subject1Names(), CollectionTools.list(this.aa1.listIterator())); - assertNull(this.event1); - - List items = new ArrayList(); - items.add("bar"); - items.add("baz"); - - this.event1 = null; - this.aa1.remove(1, 2); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(1, ((ListRemoveEvent) this.event1).getIndex()); // only the last "remove" event will still be there - assertEquals("baz", ((ListRemoveEvent) this.event1).getItems().iterator().next()); - List namesPlus = this.subject1Names(); - namesPlus.remove(1); - namesPlus.remove(1); - assertEquals(namesPlus, CollectionTools.list(this.aa1.listIterator())); - } - - public void testReplace() { - assertEquals(this.subject1Names(), CollectionTools.list(this.aa1.listIterator())); - assertNull(this.event1); - - String replacedName = this.subject1.setName(0, "jelly"); // should be "foo" - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(0, ((ListReplaceEvent) this.event1).getIndex()); - assertEquals("jelly", ((ListReplaceEvent) this.event1).getNewItems().iterator().next()); - assertEquals(replacedName, ((ListReplaceEvent) this.event1).getOldItems().iterator().next()); - List namesChanged = this.subject1Names(); - namesChanged.set(0, "jelly"); - assertEquals(namesChanged, CollectionTools.list(this.aa1.listIterator())); - - this.event1 = null; - replacedName = this.subject1.setName(1, "roll"); // should be "bar" - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(1, ((ListReplaceEvent) this.event1).getIndex()); - assertEquals("roll", ((ListReplaceEvent) this.event1).getNewItems().iterator().next()); - assertEquals(replacedName, ((ListReplaceEvent) this.event1).getOldItems().iterator().next()); - namesChanged = this.subject1Names(); - namesChanged.set(0, "jelly"); - namesChanged.set(1, "roll"); - assertEquals(namesChanged, CollectionTools.list(this.aa1.listIterator())); - } - - public void testListChange() { - assertEquals(this.subject1Names(), CollectionTools.list(this.aa1.listIterator())); - assertNull(this.event1); - - this.subject1.addTwoNames("jam", "jaz"); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - List namesPlus2 = this.subject1Names(); - namesPlus2.add(0, "jaz"); - namesPlus2.add(0, "jam"); - assertEquals(namesPlus2, CollectionTools.list(this.aa1.listIterator())); - } - - public void testIterator() { - assertEquals(this.subject1Names(), CollectionTools.list(this.subject1.names())); - assertEquals(this.subject1Names(), CollectionTools.list(this.aa1.listIterator())); - } - - public void testGet() { - assertEquals(this.subject1Names().get(0), this.subject1.getName(0)); - assertEquals(this.subject1Names().get(0), this.aa1.get(0)); - } - - public void testSize() { - assertEquals(this.subject1Names().size(), CollectionTools.size(this.subject1.names())); - assertEquals(this.subject1Names().size(), CollectionTools.size(this.aa1.listIterator())); - } - - public void testHasListeners() { - assertTrue(this.aa1.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertTrue(this.subject1.hasAnyListChangeListeners(TestSubject.NAMES_LIST)); - this.aa1.removeListChangeListener(ListValueModel.LIST_VALUES, this.listener1); - assertFalse(this.subject1.hasAnyListChangeListeners(TestSubject.NAMES_LIST)); - assertFalse(this.aa1.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - ChangeListener listener2 = new ChangeAdapter(); - this.aa1.addChangeListener(listener2); - assertTrue(this.aa1.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertTrue(this.subject1.hasAnyListChangeListeners(TestSubject.NAMES_LIST)); - this.aa1.removeChangeListener(listener2); - assertFalse(this.subject1.hasAnyListChangeListeners(TestSubject.NAMES_LIST)); - assertFalse(this.aa1.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - } - - - // ********** inner class ********** - - class TestSubject extends AbstractModel { - private List names; - public static final String NAMES_LIST = "names"; - private List descriptions; - public static final String DESCRIPTIONS_LIST = "descriptions"; - - public TestSubject() { - this.names = new ArrayList(); - this.descriptions = new ArrayList(); - } - public ListIterator names() { - return new ReadOnlyListIterator(this.names); - } - public String getName(int index) { - return this.names.get(index); - } - public void addName(int index, String name) { - this.names.add(index, name); - this.fireItemAdded(NAMES_LIST, index, name); - } - public void addName(String name) { - this.addName(this.names.size(), name); - } - public void addNames(ListIterator newNames) { - while (newNames.hasNext()) { - this.addName(newNames.next()); - } - } - public void addNames(List newNames) { - this.addNames(newNames.listIterator()); - } - public void addTwoNames(String name1, String name2) { - this.names.add(0, name2); - this.names.add(0, name1); - this.fireListChanged(NAMES_LIST, this.names); - } - public String removeName(int index) { - String removedName = this.names.remove(index); - this.fireItemRemoved(NAMES_LIST, index, removedName); - return removedName; - } - public String setName(int index, String name) { - String replacedName = this.names.set(index, name); - this.fireItemReplaced(NAMES_LIST, index, name, replacedName); - return replacedName; - } - public ListIterator descriptions() { - return new ReadOnlyListIterator(this.descriptions); - } - public String getDescription(int index) { - return this.descriptions.get(index); - } - public void addDescription(int index, String description) { - this.descriptions.add(index, description); - this.fireItemAdded(DESCRIPTIONS_LIST, index, description); - } - public void addDescription(String description) { - this.addDescription(this.descriptions.size(), description); - } - public void addDescriptions(ListIterator newDescriptions) { - while (newDescriptions.hasNext()) { - this.addDescription(newDescriptions.next()); - } - } - public void addDescriptions(List newDescriptions) { - this.addDescriptions(newDescriptions.listIterator()); - } - public String removeDescription(int index) { - String removedDescription = this.descriptions.remove(index); - this.fireItemRemoved(DESCRIPTIONS_LIST, index, removedDescription); - return removedDescription; - } - public String setDescription(int index, String description) { - String replacedDescription = this.descriptions.set(index, description); - this.fireItemReplaced(DESCRIPTIONS_LIST, index, description, replacedDescription); - return replacedDescription; - } - } - - - // this is not a typical aspect adapter - the value is determined by the aspect name - class LocalListAspectAdapter extends ListAspectAdapter { - - LocalListAspectAdapter(PropertyValueModel subjectHolder) { - super(subjectHolder, TestSubject.NAMES_LIST); - } - - @Override - protected ListIterator listIterator_() { - if (this.listNames[0] == TestSubject.NAMES_LIST) { - return this.subject.names(); - } else if (this.listNames[0] == TestSubject.DESCRIPTIONS_LIST) { - return this.subject.descriptions(); - } else { - throw new IllegalStateException("invalid aspect name: " + this.listNames[0]); - } - } - - public void add(int index, Object item) { - if (this.listNames[0] == TestSubject.NAMES_LIST) { - this.subject.addName(index, (String) item); - } else if (this.listNames[0] == TestSubject.DESCRIPTIONS_LIST) { - this.subject.addDescription(index, (String) item); - } else { - throw new IllegalStateException("invalid aspect name: " + this.listNames[0]); - } - } - - public void addAll(int index, List items) { - for (int i = 0; i < items.size(); i++) { - this.add(index + i, items.get(i)); - } - } - - public String remove(int index) { - if (this.listNames[0] == TestSubject.NAMES_LIST) { - return this.subject.removeName(index); - } else if (this.listNames[0] == TestSubject.DESCRIPTIONS_LIST) { - return this.subject.removeDescription(index); - } else { - throw new IllegalStateException("invalid aspect name: " + this.listNames[0]); - } - } - - public List remove(int index, int length) { - List removedItems = new ArrayList(length); - for (int i = 0; i < length; i++) { - removedItems.add(this.remove(index)); - } - return removedItems; - } - - public Object replace(int index, Object item) { - if (this.listNames[0] == TestSubject.NAMES_LIST) { - return this.subject.setName(index, (String) item); - } else if (this.listNames[0] == TestSubject.DESCRIPTIONS_LIST) { - return this.subject.setDescription(index, (String) item); - } else { - throw new IllegalStateException("invalid aspect name: " + this.listNames[0]); - } - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ListCollectionValueModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ListCollectionValueModelAdapterTests.java deleted file mode 100644 index c499ad37ab..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ListCollectionValueModelAdapterTests.java +++ /dev/null @@ -1,282 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import javax.swing.JList; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.Bag; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.ListCollectionValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ListModelAdapter; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class ListCollectionValueModelAdapterTests extends TestCase { - CollectionValueModel adapter; - private SimpleListValueModel wrappedListHolder; - private List wrappedList; - - public ListCollectionValueModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.wrappedList = new ArrayList(); - this.wrappedListHolder = new SimpleListValueModel(this.wrappedList); - this.adapter = new ListCollectionValueModelAdapter(this.wrappedListHolder); - } - - private Collection wrappedCollection() { - return CollectionTools.collection(this.wrappedList.iterator()); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testIterator() { - this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { - @Override - public void itemsAdded(CollectionAddEvent e) { - // override failure - } - }); - this.wrappedListHolder.add(0, "foo"); - this.wrappedListHolder.add(1, "bar"); - this.wrappedListHolder.add(2, "baz"); - Collection adapterCollection = CollectionTools.collection(this.adapter.iterator()); - assertEquals(3, adapterCollection.size()); - assertEquals(this.wrappedCollection(), adapterCollection); - } - - public void testStaleValues() { - CollectionChangeListener listener = new TestListener() { - @Override - public void itemsAdded(CollectionAddEvent e) {/* OK */} - }; - this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, listener); - this.wrappedListHolder.add(0, "foo"); - this.wrappedListHolder.add(1, "bar"); - this.wrappedListHolder.add(2, "baz"); - Collection adapterCollection = CollectionTools.collection(this.adapter.iterator()); - assertEquals(3, adapterCollection.size()); - assertEquals(this.wrappedCollection(), adapterCollection); - - this.adapter.removeCollectionChangeListener(CollectionValueModel.VALUES, listener); - adapterCollection = CollectionTools.collection(this.adapter.iterator()); - assertEquals(0, adapterCollection.size()); - assertEquals(new HashBag(), adapterCollection); - - this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, listener); - adapterCollection = CollectionTools.collection(this.adapter.iterator()); - assertEquals(3, adapterCollection.size()); - assertEquals(this.wrappedCollection(), adapterCollection); - } - - public void testAdd() { - Bag synchCollection = new CoordinatedBag(this.adapter); - List synchList = new CoordinatedList(this.wrappedListHolder); - this.wrappedListHolder.add(0, "foo"); - assertTrue(this.wrappedList.contains("foo")); - this.wrappedListHolder.add(1, "bar"); - this.wrappedListHolder.add(2, "baz"); - this.wrappedListHolder.add(3, "joo"); - this.wrappedListHolder.add(4, "jar"); - this.wrappedListHolder.add(5, "jaz"); - assertEquals(6, this.wrappedList.size()); - - Collection adapterCollection = CollectionTools.collection(this.adapter.iterator()); - assertEquals(this.wrappedCollection(), adapterCollection); - assertEquals(this.wrappedCollection(), CollectionTools.collection(synchList.iterator())); - assertEquals(this.wrappedCollection(), synchCollection); - } - - public void testRemove() { - Bag synchCollection = new CoordinatedBag(this.adapter); - List synchList = new CoordinatedList(this.wrappedListHolder); - this.wrappedListHolder.add(0, "foo"); - this.wrappedListHolder.add(1, "bar"); - this.wrappedListHolder.add(2, "baz"); - this.wrappedListHolder.add(3, "joo"); - this.wrappedListHolder.add(4, "jar"); - this.wrappedListHolder.add(5, "jaz"); - assertEquals("jaz", this.wrappedListHolder.remove(5)); - assertFalse(this.wrappedList.contains("jaz")); - assertEquals("foo", this.wrappedListHolder.remove(0)); - assertFalse(this.wrappedList.contains("foo")); - assertEquals(4, this.wrappedList.size()); - - Collection adapterCollection = CollectionTools.collection(this.adapter.iterator()); - assertEquals(this.wrappedCollection(), adapterCollection); - assertEquals(this.wrappedCollection(), CollectionTools.collection(synchList.iterator())); - assertEquals(this.wrappedCollection(), synchCollection); - } - - public void testListSynch() { - this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { - @Override - public void itemsAdded(CollectionAddEvent e) { - // override failure - } - @Override - public void itemsRemoved(CollectionRemoveEvent e) { - // override failure - } - }); - this.wrappedListHolder.add(0, "foo"); - this.wrappedListHolder.add(1, "bar"); - this.wrappedListHolder.add(2, "baz"); - this.wrappedListHolder.add(3, "joo"); - this.wrappedListHolder.add(4, "jar"); - this.wrappedListHolder.add(5, "jaz"); - this.wrappedListHolder.remove(5); - assertFalse(this.wrappedList.contains("jaz")); - this.wrappedListHolder.remove(0); - assertFalse(this.wrappedList.contains("foo")); - assertEquals(4, this.wrappedList.size()); - - Collection adapterCollection = CollectionTools.collection(this.adapter.iterator()); - assertEquals(this.wrappedCollection(), adapterCollection); - } - - public void testReplace() { - this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { - @Override - public void itemsAdded(CollectionAddEvent e) { - // override failure - } - @Override - public void itemsRemoved(CollectionRemoveEvent e) { - // override failure - } - }); - this.wrappedListHolder.add(0, "foo"); - this.wrappedListHolder.add(1, "bar"); - this.wrappedListHolder.add(2, "baz"); - Collection adapterCollection = CollectionTools.collection(this.adapter.iterator()); - assertEquals(3, adapterCollection.size()); - this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { - @Override - public void itemsRemoved(CollectionRemoveEvent e) { - assertEquals("foo", e.getItems().iterator().next()); - assertFalse(CollectionTools.contains(ListCollectionValueModelAdapterTests.this.adapter.iterator(), "joo")); - assertEquals(2, ListCollectionValueModelAdapterTests.this.adapter.size()); - } - @Override - public void itemsAdded(CollectionAddEvent e) { - assertEquals("joo", e.getItems().iterator().next()); - assertEquals(3, ListCollectionValueModelAdapterTests.this.adapter.size()); - } - }); - this.wrappedListHolder.set(0, "joo"); - adapterCollection = CollectionTools.collection(this.adapter.iterator()); - assertEquals(3, adapterCollection.size()); - assertEquals(this.wrappedCollection(), adapterCollection); - } - - public void testHasListeners() { - assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - CoordinatedBag synchCollection = new CoordinatedBag(this.adapter); - assertTrue(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - this.adapter.removeCollectionChangeListener(CollectionValueModel.VALUES, synchCollection); - assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - - ChangeListener cl = new ChangeAdapter(); - this.adapter.addChangeListener(cl); - assertTrue(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - this.adapter.removeChangeListener(cl); - assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - } - - public void testListChangedToEmpty() { - this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { - @Override - public void itemsAdded(CollectionAddEvent e) {/* OK */} - @Override - public void collectionCleared(CollectionClearEvent e) {/* OK */} - }); - this.wrappedListHolder.add(0, "foo"); - this.wrappedListHolder.add(1, "bar"); - this.wrappedListHolder.add(2, "baz"); - JList jList = new JList(new ListModelAdapter(this.adapter)); - this.wrappedListHolder.setListValues(new ArrayList()); - assertEquals(0, jList.getModel().getSize()); - } - - public void testCollectionChangedFromEmpty() { - this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { - @Override - public void itemsAdded(CollectionAddEvent e) {/* OK */} - @Override - public void itemsRemoved(CollectionRemoveEvent e) {/* OK */} - }); - JList jList = new JList(new ListModelAdapter(this.adapter)); - - ArrayList list = new ArrayList(); - list.add("foo"); - list.add("bar"); - this.wrappedListHolder.setListValues(list); - assertEquals(2, jList.getModel().getSize()); - } - - public void testCollectionChangedFromEmptyToEmpty() { - this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { - @Override - public void itemsAdded(CollectionAddEvent e) {/* OK */} - @Override - public void itemsRemoved(CollectionRemoveEvent e) {/* OK */} - }); - JList jList = new JList(new ListModelAdapter(this.adapter)); - - ArrayList list = new ArrayList(); - this.wrappedListHolder.setListValues(list); - assertEquals(0, jList.getModel().getSize()); - } - - - // ********** inner class ********** - - class TestListener implements CollectionChangeListener { - public void itemsAdded(CollectionAddEvent e) { - fail("unexpected event"); - } - public void itemsRemoved(CollectionRemoveEvent e) { - fail("unexpected event"); - } - public void collectionCleared(CollectionClearEvent e) { - fail("unexpected event"); - } - public void collectionChanged(CollectionChangeEvent e) { - fail("unexpected event"); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ListCuratorTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ListCuratorTests.java deleted file mode 100644 index 8aa2573750..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ListCuratorTests.java +++ /dev/null @@ -1,348 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyListIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.ListCurator; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public final class ListCuratorTests - extends TestCase -{ - private TestSubject subject1; - private WritablePropertyValueModel subjectHolder1; - - private ListCurator curator; - private ListChangeListener listener1; - private ListEvent event1; - - private TestSubject subject2; - - public ListCuratorTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.subject1 = new TestSubject(this.subject1Names()); - this.subjectHolder1 = new SimplePropertyValueModel(this.subject1); - this.curator = this.buildListCurator(this.subjectHolder1); - this.listener1 = this.buildListChangeListener1(); - this.curator.addListChangeListener(ListValueModel.LIST_VALUES, this.listener1); - this.event1 = null; - - this.subject2 = new TestSubject(this.subject2Names()); - } - - private List subject1Names() { - ArrayList list = new ArrayList(); - list.add("alpha"); - list.add("bravo"); - list.add("charlie"); - list.add("delta"); - return list; - } - - private List subject2Names() { - ArrayList list = new ArrayList(); - list.add("echo"); - list.add("foxtrot"); - list.add("glove"); - list.add("hotel"); - return list; - } - - private ListCurator buildListCurator(PropertyValueModel subjectHolder) { - return new ListCurator(subjectHolder) { - @Override - public Iterator iteratorForRecord() { - return this.subject.strings(); - } - }; - } - - private ListChangeListener buildListChangeListener1() { - return new ListChangeListener() { - public void itemsAdded(ListAddEvent e) { - ListCuratorTests.this.value1Changed(e); - } - public void itemsRemoved(ListRemoveEvent e) { - ListCuratorTests.this.value1Changed(e); - } - public void itemsReplaced(ListReplaceEvent e) { - ListCuratorTests.this.value1Changed(e); - } - public void itemsMoved(ListMoveEvent e) { - ListCuratorTests.this.value1Changed(e); - } - public void listCleared(ListClearEvent e) { - ListCuratorTests.this.value1Changed(e); - } - public void listChanged(ListChangeEvent e) { - ListCuratorTests.this.value1Changed(e); - } - }; - } - - void value1Changed(ListEvent e) { - this.event1 = e; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testSubjectHolder() { - assertEquals(this.subject1Names(), CollectionTools.list(this.curator.listIterator())); - assertNull(this.event1); - - this.subjectHolder1.setValue(this.subject2); - assertNotNull(this.event1); - assertEquals(this.curator, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(this.subject2Names(), CollectionTools.list(this.curator.listIterator())); - - this.event1 = null; - this.subjectHolder1.setValue(null); - assertNotNull(this.event1); - assertEquals(this.curator, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertFalse(this.curator.iterator().hasNext()); - - this.event1 = null; - this.subjectHolder1.setValue(this.subject1); - assertNotNull(this.event1); - assertEquals(this.curator, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(this.subject1Names(), CollectionTools.list(this.curator.listIterator())); - } - - public void testAdd() { - assertEquals(this.subject1Names(), CollectionTools.list(this.curator.listIterator())); - assertNull(this.event1); - - this.subject1.addString("echo"); - assertNotNull(this.event1); - assertEquals(this.curator, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(this.subject1Names().size(), ((ListAddEvent) this.event1).getIndex()); - assertEquals("echo", ((ListAddEvent) this.event1).getItems().iterator().next()); - List stringsPlus = this.subject1Names(); - stringsPlus.add("echo"); - assertEquals(stringsPlus, CollectionTools.list(this.curator.listIterator())); - - this.event1 = null; - this.subject1.addString(0, "zulu"); - assertNotNull(this.event1); - assertEquals(this.curator, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(0, ((ListAddEvent) this.event1).getIndex()); - assertEquals("zulu", ((ListAddEvent) this.event1).getItems().iterator().next()); - stringsPlus.add(0, "zulu"); - assertEquals(stringsPlus, CollectionTools.list(this.curator.listIterator())); - } - - public void testRemove() { - assertEquals(this.subject1Names(), CollectionTools.list(this.curator.listIterator())); - assertNull(this.event1); - - String removedString = this.subject1.removeString(0); // should be "alpha" - assertNotNull(this.event1); - assertEquals(this.curator, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(0, ((ListRemoveEvent) this.event1).getIndex()); - assertEquals(removedString, ((ListRemoveEvent) this.event1).getItems().iterator().next()); - List stringsMinus = this.subject1Names(); - stringsMinus.remove(0); - assertEquals(stringsMinus, CollectionTools.list(this.curator.listIterator())); - - removedString = this.subject1.removeString(2); // should be "delta" - assertNotNull(this.event1); - assertEquals(this.curator, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(2, ((ListRemoveEvent) this.event1).getIndex()); - assertEquals(removedString, ((ListRemoveEvent) this.event1).getItems().iterator().next()); - stringsMinus.remove(2); - assertEquals(stringsMinus, CollectionTools.list(this.curator.listIterator())); - } - - public void testCompleteListChange() { - assertEquals(this.subject1Names(), CollectionTools.list(this.curator.listIterator())); - assertNull(this.event1); - - this.subject1.setStrings(this.subject2Names()); - assertNotNull(this.event1); - assertEquals(this.curator, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - List newStrings = this.subject2Names(); - assertEquals(newStrings, CollectionTools.list(this.curator.listIterator())); - } - - public void testPartialListChange() { - List startingList = CollectionTools.list(this.curator.listIterator()); - assertEquals(this.subject1Names(), startingList); - assertNull(this.event1); - - String identicalString = startingList.get(1); // should be "bravo" - String nonidenticalString = startingList.get(0); // should be "alpha" - List newStrings = CollectionTools.list(new String[] {new String("bravo"), new String("alpha"), "echo", "delta", "foxtrot"}); - this.subject1.setStrings(newStrings); - - List finalList = CollectionTools.list(this.curator.listIterator()); - assertNotNull(this.event1); - assertEquals(this.curator, this.event1.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event1.getListName()); - assertEquals(newStrings, finalList); - assertTrue(identicalString == finalList.get(0)); - assertTrue(nonidenticalString != finalList.get(1)); - } - - public void testIterator() { - assertEquals(this.subject1Names(), CollectionTools.list(this.subject1.strings())); - assertEquals(this.subject1Names(), CollectionTools.list(this.curator.listIterator())); - } - - public void testGet() { - assertEquals(this.subject1Names().get(0), this.subject1.getString(0)); - assertEquals(this.subject1Names().get(0), this.curator.get(0)); - } - - public void testSize() { - assertEquals(this.subject1Names().size(), CollectionTools.size(this.subject1.strings())); - assertEquals(this.subject1Names().size(), CollectionTools.size(this.curator.listIterator())); - assertEquals(this.subject1Names().size(), this.curator.size()); - } - - public void testHasListeners() { - assertTrue(this.curator.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertTrue(this.subject1.hasAnyStateChangeListeners()); - this.curator.removeListChangeListener(ListValueModel.LIST_VALUES, this.listener1); - assertFalse(this.subject1.hasAnyStateChangeListeners()); - assertFalse(this.curator.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - ChangeListener listener2 = this.buildChangeListener(); - this.curator.addChangeListener(listener2); - assertTrue(this.curator.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertTrue(this.subject1.hasAnyStateChangeListeners()); - this.curator.removeChangeListener(listener2); - assertFalse(this.subject1.hasAnyStateChangeListeners()); - assertFalse(this.curator.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - } - - private ChangeListener buildChangeListener() { - return new ChangeAdapter() { - @Override - public void itemsAdded(ListAddEvent e) { - ListCuratorTests.this.value1Changed(e); - } - @Override - public void itemsRemoved(ListRemoveEvent e) { - ListCuratorTests.this.value1Changed(e); - } - @Override - public void itemsReplaced(ListReplaceEvent e) { - ListCuratorTests.this.value1Changed(e); - } - @Override - public void itemsMoved(ListMoveEvent e) { - ListCuratorTests.this.value1Changed(e); - } - @Override - public void listCleared(ListClearEvent e) { - ListCuratorTests.this.value1Changed(e); - } - @Override - public void listChanged(ListChangeEvent e) { - ListCuratorTests.this.value1Changed(e); - } - }; - } - - - // **************** Inner Class ******************************************* - - class TestSubject extends AbstractModel { - private List strings; - - public TestSubject() { - this.strings = new ArrayList(); - } - - public TestSubject(List strings) { - this(); - this.setStrings(strings); - } - - public String getString(int index) { - return this.strings.get(index); - } - - public ListIterator strings() { - return new ReadOnlyListIterator(this.strings); - } - - public void addString(int index, String string) { - this.strings.add(index, string); - this.fireStateChanged(); - } - - public void addString(String string) { - this.addString(this.strings.size(), string); - } - - public String removeString(int index) { - String string = this.strings.get(index); - this.removeString(string); - return string; - } - - public void removeString(String string) { - this.strings.remove(string); - this.fireStateChanged(); - } - - public void setStrings(List strings) { - this.strings = new ArrayList(strings); - this.fireStateChanged(); - } - - public void setStrings(String[] strings) { - this.strings = CollectionTools.list(strings); - this.fireStateChanged(); - } - } -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/NullCollectionValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/NullCollectionValueModelTests.java deleted file mode 100644 index 786bd931eb..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/NullCollectionValueModelTests.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.model.value.NullCollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -public class NullCollectionValueModelTests extends TestCase { - private CollectionValueModel collectionHolder; - - public NullCollectionValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.collectionHolder = new NullCollectionValueModel(); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testSize() { - assertEquals(0, this.collectionHolder.size()); - } - - public void testIterator() { - assertFalse(this.collectionHolder.iterator().hasNext()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/NullListValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/NullListValueModelTests.java deleted file mode 100644 index 63ba4ac5cf..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/NullListValueModelTests.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.model.value.NullListValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -public class NullListValueModelTests extends TestCase { - private ListValueModel listHolder; - - public NullListValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.listHolder = new NullListValueModel(); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testGet() { - boolean exCaught = false; - try { - this.listHolder.get(0); - } catch (IndexOutOfBoundsException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testSize() { - assertEquals(0, this.listHolder.size()); - } - - public void testIterator() { - assertFalse(this.listHolder.iterator().hasNext()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/NullPropertyValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/NullPropertyValueModelTests.java deleted file mode 100644 index eaf6422b9b..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/NullPropertyValueModelTests.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.model.value.NullPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -public class NullPropertyValueModelTests extends TestCase { - private PropertyValueModel valueHolder; - - public NullPropertyValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.valueHolder = new NullPropertyValueModel(); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testValue() { - assertNull(this.valueHolder.getValue()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyAspectAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyAspectAdapterTests.java deleted file mode 100644 index a9a4ec6c28..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyAspectAdapterTests.java +++ /dev/null @@ -1,344 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class PropertyAspectAdapterTests extends TestCase { - private TestSubject subject1; - private WritablePropertyValueModel subjectHolder1; - private PropertyAspectAdapter aa1; - private PropertyChangeEvent event1; - private PropertyChangeListener listener1; - - private TestSubject subject2; - - private PropertyChangeEvent multipleValueEvent; - - private PropertyChangeEvent customValueEvent; - - - public PropertyAspectAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.subject1 = new TestSubject("foo", "test subject 1"); - this.subjectHolder1 = new SimplePropertyValueModel (this.subject1); - this.aa1 = this.buildAspectAdapter(this.subjectHolder1); - this.listener1 = this.buildValueChangeListener1(); - this.aa1.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener1); - this.event1 = null; - - this.subject2 = new TestSubject("bar", "test subject 2"); - } - - private PropertyAspectAdapter buildAspectAdapter(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapter(subjectHolder, TestSubject.NAME_PROPERTY) { - // this is not a aspect adapter - the value is determined by the aspect name - @Override - protected String buildValue_() { - if (this.propertyNames[0] == TestSubject.NAME_PROPERTY) { - return this.subject.getName(); - } else if (this.propertyNames[0] == TestSubject.DESCRIPTION_PROPERTY) { - return this.subject.getDescription(); - } else { - throw new IllegalStateException("invalid aspect name: " + this.propertyNames[0]); - } - } - @Override - protected void setValue_(String value) { - if (this.propertyNames[0] == TestSubject.NAME_PROPERTY) { - this.subject.setName(value); - } else if (this.propertyNames[0] == TestSubject.DESCRIPTION_PROPERTY) { - this.subject.setDescription(value); - } else { - throw new IllegalStateException("invalid aspect name: " + this.propertyNames[0]); - } - } - }; - } - - private ChangeListener buildValueChangeListener1() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - PropertyAspectAdapterTests.this.value1Changed(e); - } - }; - } - - void value1Changed(PropertyChangeEvent e) { - this.event1 = e; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testSubjectHolder() { - assertEquals("foo", this.aa1.getValue()); - assertNull(this.event1); - - this.subjectHolder1.setValue(this.subject2); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(PropertyValueModel.VALUE, this.event1.getPropertyName()); - assertEquals("foo", this.event1.getOldValue()); - assertEquals("bar", this.event1.getNewValue()); - assertEquals("bar", this.aa1.getValue()); - - this.event1 = null; - this.subjectHolder1.setValue(null); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(PropertyValueModel.VALUE, this.event1.getPropertyName()); - assertEquals("bar", this.event1.getOldValue()); - assertNull(this.event1.getNewValue()); - assertNull(this.aa1.getValue()); - - this.event1 = null; - this.subjectHolder1.setValue(this.subject1); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(PropertyValueModel.VALUE, this.event1.getPropertyName()); - assertEquals(null, this.event1.getOldValue()); - assertEquals("foo", this.event1.getNewValue()); - assertEquals("foo", this.aa1.getValue()); - } - - public void testPropertyChange() { - assertEquals("foo", this.aa1.getValue()); - assertNull(this.event1); - - this.subject1.setName("baz"); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(PropertyValueModel.VALUE, this.event1.getPropertyName()); - assertEquals("foo", this.event1.getOldValue()); - assertEquals("baz", this.event1.getNewValue()); - assertEquals("baz", this.aa1.getValue()); - - this.event1 = null; - this.subject1.setName(null); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(PropertyValueModel.VALUE, this.event1.getPropertyName()); - assertEquals("baz", this.event1.getOldValue()); - assertEquals(null, this.event1.getNewValue()); - assertEquals(null, this.aa1.getValue()); - - this.event1 = null; - this.subject1.setName("foo"); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(PropertyValueModel.VALUE, this.event1.getPropertyName()); - assertEquals(null, this.event1.getOldValue()); - assertEquals("foo", this.event1.getNewValue()); - assertEquals("foo", this.aa1.getValue()); - } - - public void testValue() { - assertEquals("foo", this.subject1.getName()); - assertEquals("foo", this.aa1.getValue()); - } - - public void testStaleValue() { - assertEquals("foo", this.subject1.getName()); - assertEquals("foo", this.aa1.getValue()); - - this.aa1.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener1); - assertEquals(null, this.aa1.getValue()); - - this.aa1.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener1); - assertEquals("foo", this.aa1.getValue()); - - this.aa1.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener1); - this.subjectHolder1.setValue(this.subject2); - assertEquals(null, this.aa1.getValue()); - - this.aa1.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener1); - assertEquals("bar", this.aa1.getValue()); - } - - public void testSetValue() { - this.aa1.setValue("baz"); - assertEquals("baz", this.aa1.getValue()); - assertEquals("baz", this.subject1.getName()); - } - - public void testHasListeners() { - assertTrue(this.aa1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(this.subject1.hasAnyPropertyChangeListeners(TestSubject.NAME_PROPERTY)); - this.aa1.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener1); - assertFalse(this.subject1.hasAnyPropertyChangeListeners(TestSubject.NAME_PROPERTY)); - assertFalse(this.aa1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - ChangeListener listener2 = this.buildValueChangeListener1(); - this.aa1.addChangeListener(listener2); - assertTrue(this.aa1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(this.subject1.hasAnyPropertyChangeListeners(TestSubject.NAME_PROPERTY)); - this.aa1.removeChangeListener(listener2); - assertFalse(this.subject1.hasAnyPropertyChangeListeners(TestSubject.NAME_PROPERTY)); - assertFalse(this.aa1.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - } - - public void testMultipleAspectAdapter() { - TestSubject testSubject = new TestSubject("fred", "husband"); - WritablePropertyValueModel testSubjectHolder = new SimplePropertyValueModel(testSubject); - WritablePropertyValueModel testAA = this.buildMultipleAspectAdapter(testSubjectHolder); - PropertyChangeListener testListener = this.buildMultipleValueChangeListener(); - testAA.addPropertyChangeListener(PropertyValueModel.VALUE, testListener); - assertEquals("fred:husband", testAA.getValue()); - - this.multipleValueEvent = null; - testSubject.setName("wilma"); - assertEquals("wilma:husband", testAA.getValue()); - assertEquals("fred:husband", this.multipleValueEvent.getOldValue()); - assertEquals("wilma:husband", this.multipleValueEvent.getNewValue()); - - this.multipleValueEvent = null; - testSubject.setDescription("wife"); - assertEquals("wilma:wife", testAA.getValue()); - assertEquals("wilma:husband", this.multipleValueEvent.getOldValue()); - assertEquals("wilma:wife", this.multipleValueEvent.getNewValue()); - } - - private WritablePropertyValueModel buildMultipleAspectAdapter(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapter(subjectHolder, TestSubject.NAME_PROPERTY, TestSubject.DESCRIPTION_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getName() + ":" + this.subject.getDescription(); - } - }; - } - - private PropertyChangeListener buildMultipleValueChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - PropertyAspectAdapterTests.this.multipleValueChanged(e); - } - }; - } - - void multipleValueChanged(PropertyChangeEvent e) { - this.multipleValueEvent = e; - } - - /** - * test a bug where we would call #buildValue() in - * #engageNonNullSubject(), when we needed to call - * it in #engageSubject(), so the cached value would - * be rebuilt when the this.subject was set to null - */ - public void testCustomBuildValueWithNullSubject() { - TestSubject customSubject = new TestSubject("fred", "laborer"); - WritablePropertyValueModel customSubjectHolder = new SimplePropertyValueModel(customSubject); - WritablePropertyValueModel customAA = this.buildCustomAspectAdapter(customSubjectHolder); - PropertyChangeListener customListener = this.buildCustomValueChangeListener(); - customAA.addPropertyChangeListener(PropertyValueModel.VALUE, customListener); - assertEquals("fred", customAA.getValue()); - - this.customValueEvent = null; - customSubject.setName("wilma"); - assertEquals("wilma", customAA.getValue()); - assertEquals("fred", this.customValueEvent.getOldValue()); - assertEquals("wilma", this.customValueEvent.getNewValue()); - - this.customValueEvent = null; - customSubjectHolder.setValue(null); - // this would fail - the value would be null... - assertEquals("", customAA.getValue()); - assertEquals("wilma", this.customValueEvent.getOldValue()); - assertEquals("", this.customValueEvent.getNewValue()); - } - - /** - * Test a bug: - * If two listeners were added to an aspect adapter, one with an - * aspect name and one without, the aspect adapter would add its - * 'subjectChangeListener' to its 'subjectHolder' twice. As a result, - * the following code will trigger an IllegalArgumentException - * if the bug is present; otherwise, it completes silently. - */ - public void testDuplicateListener() { - ChangeListener listener2 = new ChangeAdapter(); - this.aa1.addChangeListener(listener2); - } - - private WritablePropertyValueModel buildCustomAspectAdapter(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapter(subjectHolder, TestSubject.NAME_PROPERTY) { - @Override - protected String buildValue() { - return (this.subject == null) ? "" : this.subject.getName(); - } - }; - } - - private PropertyChangeListener buildCustomValueChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - PropertyAspectAdapterTests.this.customValueChanged(e); - } - }; - } - - void customValueChanged(PropertyChangeEvent e) { - this.customValueEvent = e; - } - - - // ********** test model ********** - - private static class TestSubject extends AbstractModel { - private String name; - public static final String NAME_PROPERTY = "name"; - private String description; - public static final String DESCRIPTION_PROPERTY = "description"; - - public TestSubject(String name, String description) { - this.name = name; - this.description = description; - } - public String getName() { - return this.name; - } - public void setName(String name) { - Object old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - public String getDescription() { - return this.description; - } - public void setDescription(String description) { - Object old = this.description; - this.description = description; - this.firePropertyChanged(DESCRIPTION_PROPERTY, old, description); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyCollectionValueModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyCollectionValueModelAdapterTests.java deleted file mode 100644 index 1ef4cddd88..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyCollectionValueModelAdapterTests.java +++ /dev/null @@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.Collection; - -import javax.swing.JList; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.iterators.SingleElementIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyCollectionValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ListModelAdapter; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class PropertyCollectionValueModelAdapterTests extends TestCase { - private CollectionValueModel adapter; - private WritablePropertyValueModel wrappedValueHolder; - - public PropertyCollectionValueModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.wrappedValueHolder = new SimplePropertyValueModel(); - this.adapter = new PropertyCollectionValueModelAdapter(this.wrappedValueHolder); - } - - private Collection wrappedCollection() { - return CollectionTools.collection(new SingleElementIterator(this.wrappedValueHolder.getValue())); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testIterator() { - this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { - @Override - public void itemsAdded(CollectionAddEvent e) {/* OK */} - }); - this.wrappedValueHolder.setValue("foo"); - Collection adapterCollection = CollectionTools.collection(this.adapter.iterator()); - assertEquals(1, adapterCollection.size()); - assertEquals(this.wrappedCollection(), adapterCollection); - assertEquals("foo", adapterCollection.iterator().next()); - } - - public void testStaleValue() { - CollectionChangeListener listener = new TestListener() { - @Override - public void itemsAdded(CollectionAddEvent e) {/* OK */} - }; - this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, listener); - this.wrappedValueHolder.setValue("foo"); - Collection adapterCollection = CollectionTools.collection(this.adapter.iterator()); - assertEquals(1, adapterCollection.size()); - assertEquals(this.wrappedCollection(), adapterCollection); - assertEquals("foo", adapterCollection.iterator().next()); - - this.adapter.removeCollectionChangeListener(CollectionValueModel.VALUES, listener); - adapterCollection = CollectionTools.collection(this.adapter.iterator()); - assertEquals(0, adapterCollection.size()); - assertEquals(new HashBag(), adapterCollection); - - this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, listener); - adapterCollection = CollectionTools.collection(this.adapter.iterator()); - assertEquals(1, adapterCollection.size()); - assertEquals(this.wrappedCollection(), adapterCollection); - assertEquals("foo", adapterCollection.iterator().next()); - } - - public void testHasListeners() { - assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - CoordinatedBag synchCollection = new CoordinatedBag(this.adapter); - assertTrue(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - this.adapter.removeCollectionChangeListener(CollectionValueModel.VALUES, synchCollection); - assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - - ChangeListener cl = new ChangeAdapter(); - this.adapter.addChangeListener(cl); - assertTrue(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - this.adapter.removeChangeListener(cl); - assertFalse(((AbstractModel) this.adapter).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - } - - public void testListChangedToEmpty() { - this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { - @Override - public void itemsAdded(CollectionAddEvent e) {/* OK */} - @Override - public void itemsRemoved(CollectionRemoveEvent e) {/* OK */} - }); - this.wrappedValueHolder.setValue("foo"); - JList jList = new JList(new ListModelAdapter(this.adapter)); - this.wrappedValueHolder.setValue(null); - assertEquals(0, jList.getModel().getSize()); - } - - public void testCollectionChangedFromEmpty() { - this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener() { - @Override - public void itemsAdded(CollectionAddEvent e) {/* OK */} - }); - JList jList = new JList(new ListModelAdapter(this.adapter)); - - this.wrappedValueHolder.setValue("foo"); - assertEquals(1, jList.getModel().getSize()); - } - - public void testCollectionChangedFromEmptyToEmpty() { - this.adapter.addCollectionChangeListener(CollectionValueModel.VALUES, new TestListener()); - JList jList = new JList(new ListModelAdapter(this.adapter)); - - this.wrappedValueHolder.setValue(null); - assertEquals(0, jList.getModel().getSize()); - } - - - // ********** member class ********** - - static class TestListener implements CollectionChangeListener { - public void collectionChanged(CollectionChangeEvent event) { - fail("unexpected event"); - } - public void collectionCleared(CollectionClearEvent event) { - fail("unexpected event"); - } - public void itemsAdded(CollectionAddEvent event) { - fail("unexpected event"); - } - public void itemsRemoved(CollectionRemoveEvent event) { - fail("unexpected event"); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyListValueModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyListValueModelAdapterTests.java deleted file mode 100644 index 180cfe55dc..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/PropertyListValueModelAdapterTests.java +++ /dev/null @@ -1,211 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; - -import javax.swing.JList; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.SingleElementIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyListValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ListModelAdapter; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class PropertyListValueModelAdapterTests extends TestCase { - private ListValueModel adapter; - private WritablePropertyValueModel wrappedValueHolder; - - public PropertyListValueModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.wrappedValueHolder = new SimplePropertyValueModel(); - this.adapter = new PropertyListValueModelAdapter(this.wrappedValueHolder); - } - - private Collection wrappedList() { - return CollectionTools.list(new SingleElementIterator(this.wrappedValueHolder.getValue())); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testIterator() { - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListener() { - @Override - public void itemsAdded(ListAddEvent event) {/* OK */} - }); - assertFalse(this.adapter.iterator().hasNext()); - this.wrappedValueHolder.setValue("foo"); - List adapterList = CollectionTools.list(this.adapter.iterator()); - assertEquals(1, adapterList.size()); - assertEquals(this.wrappedList(), adapterList); - assertEquals("foo", adapterList.iterator().next()); - } - - public void testGetInt() { - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListener() { - @Override - public void itemsAdded(ListAddEvent event) {/* OK */} - }); - this.wrappedValueHolder.setValue("foo"); - assertEquals("foo", this.adapter.get(0)); - } - - public void testToArray1() { - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListener() { - @Override - public void itemsAdded(ListAddEvent event) {/* OK */} - }); - this.wrappedValueHolder.setValue("foo"); - Object[] array = this.adapter.toArray(); - assertEquals("foo", array[0]); - assertEquals(1, array.length); - } - - public void testToArray2() { - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListener()); - Object[] array = this.adapter.toArray(); - assertEquals(0, array.length); - } - - public void testStaleValue() { - ListChangeListener listener = new TestListener() { - @Override - public void itemsAdded(ListAddEvent event) {/* OK */} - }; - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, listener); - this.wrappedValueHolder.setValue("foo"); - List adapterList = CollectionTools.list(this.adapter.iterator()); - assertEquals(1, adapterList.size()); - assertEquals(this.wrappedList(), adapterList); - assertEquals("foo", adapterList.iterator().next()); - - this.adapter.removeListChangeListener(ListValueModel.LIST_VALUES, listener); - adapterList = CollectionTools.list(this.adapter.iterator()); - assertEquals(0, adapterList.size()); - assertEquals(new ArrayList(), adapterList); - - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, listener); - adapterList = CollectionTools.list(this.adapter.iterator()); - assertEquals(1, adapterList.size()); - assertEquals(this.wrappedList(), adapterList); - assertEquals("foo", adapterList.iterator().next()); - } - - public void testHasListeners() { - assertFalse(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - CoordinatedList synchList = new CoordinatedList(this.adapter); - assertTrue(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - this.adapter.removeListChangeListener(ListValueModel.LIST_VALUES, synchList); - assertFalse(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - ChangeListener cl = new ChangeAdapter(); - this.adapter.addChangeListener(cl); - assertTrue(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - this.adapter.removeChangeListener(cl); - assertFalse(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - } - - public void testListChangedToEmpty() { - this.wrappedValueHolder.setValue("foo"); - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListener() { - @Override - public void itemsRemoved(ListRemoveEvent event) {/* OK */} - }); - JList jList = new JList(new ListModelAdapter(this.adapter)); - this.wrappedValueHolder.setValue(null); - assertEquals(0, jList.getModel().getSize()); - } - - public void testListChangedFromEmpty() { - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListener() { - @Override - public void itemsAdded(ListAddEvent event) {/* OK */} - }); - JList jList = new JList(new ListModelAdapter(this.adapter)); - - this.wrappedValueHolder.setValue("foo"); - assertEquals(1, jList.getModel().getSize()); - } - - public void testListItemChanged() { - this.wrappedValueHolder.setValue("foo"); - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListener() { - @Override - public void itemsReplaced(ListReplaceEvent event) {/* OK */} - }); - JList jList = new JList(new ListModelAdapter(this.adapter)); - assertEquals(1, jList.getModel().getSize()); - assertEquals("foo", jList.getModel().getElementAt(0)); - - this.wrappedValueHolder.setValue("bar"); - assertEquals(1, jList.getModel().getSize()); - assertEquals("bar", jList.getModel().getElementAt(0)); - } - - public void testListChangedFromEmptyToEmpty() { - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListener()); - JList jList = new JList(new ListModelAdapter(this.adapter)); - - this.wrappedValueHolder.setValue(null); - assertEquals(0, jList.getModel().getSize()); - } - - - // ********** member class ********** - - static class TestListener implements ListChangeListener { - public void listChanged(ListChangeEvent event) { - fail("unexpected event"); - } - public void listCleared(ListClearEvent event) { - fail("unexpected event"); - } - public void itemsAdded(ListAddEvent event) { - fail("unexpected event"); - } - public void itemsRemoved(ListRemoveEvent event) { - fail("unexpected event"); - } - public void itemsMoved(ListMoveEvent event) { - fail("unexpected event"); - } - public void itemsReplaced(ListReplaceEvent event) { - fail("unexpected event"); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ReadOnlyWritablePropertyValueModelWrapperTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ReadOnlyWritablePropertyValueModelWrapperTests.java deleted file mode 100644 index 938f6e9073..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ReadOnlyWritablePropertyValueModelWrapperTests.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.ReadOnlyWritablePropertyValueModelWrapper; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class ReadOnlyWritablePropertyValueModelWrapperTests - extends TestCase -{ - private WritablePropertyValueModel objectHolder; - - PropertyChangeEvent event; - - private WritablePropertyValueModel wrapperObjectHolder; - - PropertyChangeEvent wrapperEvent; - - - public ReadOnlyWritablePropertyValueModelWrapperTests(String name) { - super(name); - } - - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.objectHolder = new SimplePropertyValueModel("foo"); - this.wrapperObjectHolder = new ReadOnlyWritablePropertyValueModelWrapper(this.objectHolder); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - - public void testValue() { - assertEquals("foo", this.objectHolder.getValue()); - assertEquals("foo", this.wrapperObjectHolder.getValue()); - - this.objectHolder.setValue("bar"); - assertEquals("bar", this.objectHolder.getValue()); - assertEquals("bar", this.wrapperObjectHolder.getValue()); - - this.objectHolder.setValue(null); - assertNull(this.objectHolder.getValue()); - assertNull(this.wrapperObjectHolder.getValue()); - - this.objectHolder.setValue("foo"); - assertEquals("foo", this.objectHolder.getValue()); - assertEquals("foo", this.wrapperObjectHolder.getValue()); - } - - public void testSetValue() { - boolean exceptionOccurred = false; - try { - this.wrapperObjectHolder.setValue("bar"); - } - catch (UnsupportedOperationException uoe) { - exceptionOccurred = true; - } - - assertTrue(exceptionOccurred); - assertEquals("foo", this.objectHolder.getValue()); - assertEquals("foo", this.wrapperObjectHolder.getValue()); - } - - public void testLazyListening() { - assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - ChangeListener listener = buildWrapperListener(); - this.wrapperObjectHolder.addChangeListener(listener); - assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.wrapperObjectHolder.removeChangeListener(listener); - assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - - this.wrapperObjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, listener); - assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.wrapperObjectHolder.removePropertyChangeListener(PropertyValueModel.VALUE, listener); - assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - } - - public void testPropertyChange1() { - this.objectHolder.addChangeListener(this.buildListener()); - this.wrapperObjectHolder.addChangeListener(this.buildWrapperListener()); - this.verifyPropertyChanges(); - } - - public void testPropertyChange2() { - this.objectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildListener()); - this.wrapperObjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildWrapperListener()); - this.verifyPropertyChanges(); - } - - private void verifyPropertyChanges() { - this.event = null; - this.wrapperEvent = null; - this.objectHolder.setValue("bar"); - verifyEvent(this.event, this.objectHolder, "foo", "bar"); - verifyEvent(this.wrapperEvent, this.wrapperObjectHolder, "foo", "bar"); - - this.event = null; - this.wrapperEvent = null; - this.objectHolder.setValue(null); - verifyEvent(this.event, this.objectHolder, "bar", null); - verifyEvent(this.wrapperEvent, this.wrapperObjectHolder, "bar", null); - - this.event = null; - this.wrapperEvent = null; - this.objectHolder.setValue("foo"); - verifyEvent(this.event, this.objectHolder, null, "foo"); - verifyEvent(this.wrapperEvent, this.wrapperObjectHolder, null, "foo"); - } - - private ChangeListener buildListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - ReadOnlyWritablePropertyValueModelWrapperTests.this.event = e; - } - }; - } - - private ChangeListener buildWrapperListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - ReadOnlyWritablePropertyValueModelWrapperTests.this.wrapperEvent = e; - } - }; - } - - private void verifyEvent(PropertyChangeEvent e, Object source, Object oldValue, Object newValue) { - assertEquals(source, e.getSource()); - assertEquals(PropertyValueModel.VALUE, e.getPropertyName()); - assertEquals(oldValue, e.getOldValue()); - assertEquals(newValue, e.getNewValue()); - } -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SetCollectionValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SetCollectionValueModelTests.java deleted file mode 100644 index cddfb7d38b..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SetCollectionValueModelTests.java +++ /dev/null @@ -1,328 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.Bag; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.SetCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class SetCollectionValueModelTests extends TestCase { - private SimpleCollectionValueModel collectionHolder; - CollectionAddEvent addEvent; - CollectionRemoveEvent removeEvent; - CollectionClearEvent collectionClearedEvent; - CollectionChangeEvent collectionChangedEvent; - - private CollectionValueModel setHolder; - CollectionAddEvent setAddEvent; - CollectionRemoveEvent setRemoveEvent; - CollectionClearEvent setClearedEvent; - CollectionChangeEvent setChangedEvent; - - public SetCollectionValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.collectionHolder = new SimpleCollectionValueModel(this.buildCollection()); - this.setHolder = new SetCollectionValueModel(this.collectionHolder); - } - - private Collection buildCollection() { - Collection collection = new ArrayList(); - collection.add("foo"); - collection.add("foo"); - return collection; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testIterator() { - // add a listener to "activate" the wrapper - this.setHolder.addChangeListener(this.buildSetChangeListener()); - - this.verify(this.collectionHolder, "foo", "foo"); - this.verify(this.setHolder, "foo"); - - this.collectionHolder.add("bar"); - this.collectionHolder.add("bar"); - this.verify(this.collectionHolder, "foo", "foo", "bar", "bar"); - this.verify(this.setHolder, "foo", "bar"); - - this.collectionHolder.remove("bar"); - this.verify(this.collectionHolder, "foo", "foo", "bar"); - this.verify(this.setHolder, "foo", "bar"); - - this.collectionHolder.remove("bar"); - this.verify(this.collectionHolder, "foo", "foo"); - this.verify(this.setHolder, "foo"); - - this.collectionHolder.remove("foo"); - this.verify(this.collectionHolder, "foo"); - this.verify(this.setHolder, "foo"); - - this.collectionHolder.remove("foo"); - assertFalse(this.collectionHolder.iterator().hasNext()); - assertFalse(this.setHolder.iterator().hasNext()); - } - - public void testSize() { - // add a listener to "activate" the wrapper - this.setHolder.addChangeListener(this.buildSetChangeListener()); - - assertEquals(2, this.collectionHolder.size()); - assertEquals(1, this.setHolder.size()); - - this.collectionHolder.add("bar"); - this.collectionHolder.add("bar"); - assertEquals(4, this.collectionHolder.size()); - assertEquals(2, this.setHolder.size()); - - this.collectionHolder.remove("bar"); - assertEquals(3, this.collectionHolder.size()); - assertEquals(2, this.setHolder.size()); - - this.collectionHolder.remove("bar"); - assertEquals(2, this.collectionHolder.size()); - assertEquals(1, this.setHolder.size()); - - this.collectionHolder.remove("foo"); - assertEquals(1, this.collectionHolder.size()); - assertEquals(1, this.setHolder.size()); - - this.collectionHolder.remove("foo"); - assertEquals(0, this.collectionHolder.size()); - assertEquals(0, this.setHolder.size()); - } - - public void testBulkChange() { - // add a listener to "activate" the wrapper - this.setHolder.addChangeListener(this.buildSetChangeListener()); - - Collection newCollection = new ArrayList(); - newCollection.add("fox"); - newCollection.add("fox"); - newCollection.add("bat"); - - this.collectionHolder.setValues(newCollection); - this.verify(this.collectionHolder, "fox", "fox", "bat"); - this.verify(this.setHolder, "fox", "bat"); - } - - public void testLazyListening() { - assertTrue(((AbstractModel) this.collectionHolder).hasNoCollectionChangeListeners(CollectionValueModel.VALUES)); - ChangeListener listener = this.buildSetChangeListener(); - this.setHolder.addChangeListener(listener); - assertTrue(((AbstractModel) this.collectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - this.setHolder.removeChangeListener(listener); - assertTrue(((AbstractModel) this.collectionHolder).hasNoCollectionChangeListeners(CollectionValueModel.VALUES)); - - this.setHolder.addCollectionChangeListener(CollectionValueModel.VALUES, listener); - assertTrue(((AbstractModel) this.collectionHolder).hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - this.setHolder.removeCollectionChangeListener(CollectionValueModel.VALUES, listener); - assertTrue(((AbstractModel) this.collectionHolder).hasNoCollectionChangeListeners(CollectionValueModel.VALUES)); - } - - public void testEvents1() { - this.collectionHolder.addChangeListener(this.buildChangeListener()); - this.setHolder.addChangeListener(this.buildSetChangeListener()); - this.verifyEvents(); - } - - public void testEvents2() { - this.collectionHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildCollectionChangeListener()); - this.setHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildSetCollectionChangeListener()); - this.verifyEvents(); - } - - private void clearEvents() { - this.addEvent = null; - this.removeEvent = null; - this.collectionClearedEvent = null; - this.collectionChangedEvent = null; - this.setAddEvent = null; - this.setRemoveEvent = null; - this.setClearedEvent = null; - this.setChangedEvent = null; - } - - private void verifyEvents() { - this.clearEvents(); - this.collectionHolder.add("bar"); - this.verifyEvent(this.addEvent, this.collectionHolder, "bar"); - this.verifyEvent(this.setAddEvent, this.setHolder, "bar"); - - this.clearEvents(); - this.collectionHolder.remove("foo"); - this.verifyEvent(this.removeEvent, this.collectionHolder, "foo"); - assertNull(this.setRemoveEvent); - - this.clearEvents(); - this.collectionHolder.add("bar"); - this.verifyEvent(this.addEvent, this.collectionHolder, "bar"); - assertNull(this.setAddEvent); - - this.clearEvents(); - this.collectionHolder.remove("foo"); - this.verifyEvent(this.removeEvent, this.collectionHolder, "foo"); - this.verifyEvent(this.setRemoveEvent, this.setHolder, "foo"); - - this.clearEvents(); - this.collectionHolder.add("foo"); - this.verifyEvent(this.addEvent, this.collectionHolder, "foo"); - this.verifyEvent(this.setAddEvent, this.setHolder, "foo"); - - this.clearEvents(); - this.collectionHolder.clear(); - this.verifyEvent(this.collectionClearedEvent, this.collectionHolder); - this.verifyEvent(this.setClearedEvent, this.setHolder); - - this.clearEvents(); - Collection newCollection = new ArrayList(); - newCollection.add("fox"); - newCollection.add("fox"); - newCollection.add("bat"); - newCollection.add("bat"); - newCollection.add("bat"); - this.collectionHolder.setValues(newCollection); - this.verifyEvent(this.collectionChangedEvent, this.collectionHolder, "fox", "fox", "bat", "bat", "bat"); - this.verifyEvent(this.setChangedEvent, this.setHolder, "fox", "bat"); - - } - - private CollectionChangeListener buildCollectionChangeListener() { - return new CollectionChangeListener() { - public void itemsAdded(CollectionAddEvent event) { - SetCollectionValueModelTests.this.addEvent = event; - } - public void itemsRemoved(CollectionRemoveEvent event) { - SetCollectionValueModelTests.this.removeEvent = event; - } - public void collectionCleared(CollectionClearEvent event) { - SetCollectionValueModelTests.this.collectionClearedEvent = event; - } - public void collectionChanged(CollectionChangeEvent event) { - SetCollectionValueModelTests.this.collectionChangedEvent = event; - } - }; - } - - private ChangeListener buildChangeListener() { - return new ChangeAdapter() { - @Override - public void itemsAdded(CollectionAddEvent event) { - SetCollectionValueModelTests.this.addEvent = event; - } - @Override - public void itemsRemoved(CollectionRemoveEvent event) { - SetCollectionValueModelTests.this.removeEvent = event; - } - @Override - public void collectionCleared(CollectionClearEvent event) { - SetCollectionValueModelTests.this.collectionClearedEvent = event; - } - @Override - public void collectionChanged(CollectionChangeEvent event) { - SetCollectionValueModelTests.this.collectionChangedEvent = event; - } - }; - } - - private CollectionChangeListener buildSetCollectionChangeListener() { - return new CollectionChangeListener() { - public void itemsAdded(CollectionAddEvent event) { - SetCollectionValueModelTests.this.setAddEvent = event; - } - public void itemsRemoved(CollectionRemoveEvent event) { - SetCollectionValueModelTests.this.setRemoveEvent = event; - } - public void collectionCleared(CollectionClearEvent event) { - SetCollectionValueModelTests.this.setClearedEvent = event; - } - public void collectionChanged(CollectionChangeEvent event) { - SetCollectionValueModelTests.this.setChangedEvent = event; - } - }; - } - - private ChangeListener buildSetChangeListener() { - return new ChangeAdapter() { - @Override - public void itemsAdded(CollectionAddEvent event) { - SetCollectionValueModelTests.this.setAddEvent = event; - } - @Override - public void itemsRemoved(CollectionRemoveEvent event) { - SetCollectionValueModelTests.this.setRemoveEvent = event; - } - @Override - public void collectionCleared(CollectionClearEvent event) { - SetCollectionValueModelTests.this.setClearedEvent = event; - } - @Override - public void collectionChanged(CollectionChangeEvent event) { - SetCollectionValueModelTests.this.setChangedEvent = event; - } - }; - } - - private void verify(CollectionValueModel cvm, String... expectedItems) { - Bag actual = CollectionTools.bag(cvm); - Bag expected = CollectionTools.bag(expectedItems); - assertEquals(expected, actual); - } - - private void verifyEvent(CollectionAddEvent event, Object source, Object... expectedItems) { - assertEquals(source, event.getSource()); - assertEquals(CollectionValueModel.VALUES, event.getCollectionName()); - assertEquals(CollectionTools.bag(expectedItems), CollectionTools.bag(event.getItems())); - } - - private void verifyEvent(CollectionRemoveEvent event, Object source, Object... expectedItems) { - assertEquals(source, event.getSource()); - assertEquals(CollectionValueModel.VALUES, event.getCollectionName()); - assertEquals(CollectionTools.bag(expectedItems), CollectionTools.bag(event.getItems())); - } - - private void verifyEvent(CollectionClearEvent event, Object source) { - assertEquals(source, event.getSource()); - assertEquals(CollectionValueModel.VALUES, event.getCollectionName()); - } - - private void verifyEvent(CollectionChangeEvent event, Object source, Object... expectedItems) { - assertEquals(source, event.getSource()); - assertEquals(CollectionValueModel.VALUES, event.getCollectionName()); - assertEquals(CollectionTools.bag(expectedItems), CollectionTools.bag(event.getCollection())); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SimpleCollectionValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SimpleCollectionValueModelTests.java deleted file mode 100644 index e3e4a70a58..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SimpleCollectionValueModelTests.java +++ /dev/null @@ -1,443 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Set; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.Bag; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class SimpleCollectionValueModelTests extends TestCase { - private SimpleCollectionValueModel bagHolder; - CollectionEvent bagEvent; - String bagEventType; - - private SimpleCollectionValueModel setHolder; - CollectionEvent setEvent; - String setEventType; - - private static final String ADD = "add"; - private static final String REMOVE = "remove"; - private static final String CHANGE = "change"; - private static final String CLEAR = "clear"; - - - public SimpleCollectionValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.bagHolder = new SimpleCollectionValueModel(this.buildBag()); - this.setHolder = new SimpleCollectionValueModel(this.buildSet()); - } - - private Bag buildBag() { - Bag result = new HashBag(); - this.addItemsTo(result); - return result; - } - - private Set buildSet() { - Set result = new HashSet(); - this.addItemsTo(result); - return result; - } - - private void addItemsTo(Collection c) { - c.add("foo"); - c.add("bar"); - c.add("baz"); - } - - private Bag buildAddItems() { - Bag result = new HashBag(); - result.add("joo"); - result.add("jar"); - result.add("jaz"); - return result; - } - - private Bag buildRemoveItems() { - Bag result = new HashBag(); - result.add("foo"); - result.add("baz"); - return result; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testIterator() { - assertEquals(this.buildBag(), CollectionTools.bag(this.bagHolder.iterator())); - assertEquals(this.buildSet(), CollectionTools.set(this.setHolder.iterator())); - } - - public void testSize() { - assertEquals(this.buildBag().size(), CollectionTools.size(this.bagHolder.iterator())); - assertEquals(this.buildSet().size(), CollectionTools.size(this.setHolder.iterator())); - } - - private boolean bagHolderContains(Object item) { - return CollectionTools.contains(this.bagHolder.iterator(), item); - } - - private boolean setHolderContains(Object item) { - return CollectionTools.contains(this.setHolder.iterator(), item); - } - - private boolean bagHolderContainsAll(Collection items) { - return CollectionTools.containsAll(this.bagHolder.iterator(), items); - } - - private boolean setHolderContainsAll(Collection items) { - return CollectionTools.containsAll(this.setHolder.iterator(), items); - } - - private boolean bagHolderContainsAny(Collection items) { - Bag bag = CollectionTools.bag(this.bagHolder.iterator()); - for (String string : items) { - if (bag.contains(string)) { - return true; - } - } - return false; - } - - private boolean setHolderContainsAny(Collection items) { - Set set = CollectionTools.set(this.setHolder.iterator()); - for (String string : items) { - if (set.contains(string)) { - return true; - } - } - return false; - } - - public void testAdd() { - assertFalse(this.bagHolderContains("joo")); - this.bagHolder.add("joo"); - assertTrue(this.bagHolderContains("joo")); - - assertFalse(this.bagHolderContains(null)); - this.bagHolder.add(null); - assertTrue(this.bagHolderContains(null)); - - assertFalse(this.setHolderContains("joo")); - this.setHolder.add("joo"); - assertTrue(this.setHolderContains("joo")); - - assertFalse(this.setHolderContains(null)); - this.setHolder.add(null); - assertTrue(this.setHolderContains(null)); - } - - public void testAddAll() { - assertFalse(this.bagHolderContainsAny(this.buildAddItems())); - this.bagHolder.addAll(this.buildAddItems()); - assertTrue(this.bagHolderContainsAll(this.buildAddItems())); - - assertFalse(this.setHolderContainsAny(this.buildAddItems())); - this.setHolder.addAll(this.buildAddItems()); - assertTrue(this.setHolderContainsAll(this.buildAddItems())); - } - - public void testRemove() { - assertTrue(this.bagHolderContains("bar")); - this.bagHolder.remove("bar"); - assertFalse(this.bagHolderContains("bar")); - - this.bagHolder.add(null); - assertTrue(this.bagHolderContains(null)); - this.bagHolder.remove(null); - assertFalse(this.bagHolderContains(null)); - - assertTrue(this.setHolderContains("bar")); - this.setHolder.remove("bar"); - assertFalse(this.setHolderContains("bar")); - - this.setHolder.add(null); - assertTrue(this.setHolderContains(null)); - this.setHolder.remove(null); - assertFalse(this.setHolderContains(null)); - } - - public void testRemoveAll() { - assertTrue(this.bagHolderContainsAll(this.buildRemoveItems())); - this.bagHolder.removeAll(this.buildRemoveItems()); - assertFalse(this.bagHolderContainsAny(this.buildRemoveItems())); - - assertTrue(this.setHolderContainsAll(this.buildRemoveItems())); - this.setHolder.removeAll(this.buildRemoveItems()); - assertFalse(this.setHolderContainsAny(this.buildRemoveItems())); - } - - public void testSetValues() { - assertTrue(this.bagHolderContains("bar")); - assertFalse(this.bagHolderContains("jar")); - this.bagHolder.setValues(this.buildAddItems()); - assertFalse(this.bagHolderContains("bar")); - assertTrue(this.bagHolderContains("jar")); - - this.bagHolder.add(null); - assertTrue(this.bagHolderContains(null)); - this.bagHolder.remove(null); - assertFalse(this.bagHolderContains(null)); - - this.bagHolder.setValues(new HashBag()); - assertFalse(this.bagHolderContains("jar")); - - assertTrue(this.setHolderContains("bar")); - assertFalse(this.setHolderContains("jar")); - this.setHolder.setValues(this.buildAddItems()); - assertFalse(this.setHolderContains("bar")); - assertTrue(this.setHolderContains("jar")); - - this.setHolder.add(null); - assertTrue(this.setHolderContains(null)); - this.setHolder.remove(null); - assertFalse(this.setHolderContains(null)); - - this.setHolder.setValues(new HashBag()); - assertFalse(this.setHolderContains("jar")); - } - - public void testCollectionChange1() { - this.bagHolder.addChangeListener(this.buildBagListener()); - this.verifyBagChange(); - - this.setHolder.addChangeListener(this.buildSetListener()); - this.verifySetChange(); - } - - public void testCollectionChange2() { - this.bagHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildBagListener()); - this.verifyBagChange(); - - this.setHolder.addCollectionChangeListener(CollectionValueModel.VALUES, this.buildSetListener()); - this.verifySetChange(); - } - - private void verifyBagChange() { - this.bagEvent = null; - this.bagEventType = null; - this.bagHolder.add("foo"); - this.verifyBagEvent(ADD, "foo"); - - this.bagEvent = null; - this.bagEventType = null; - this.bagHolder.add("foo"); - this.verifyBagEvent(ADD, "foo"); - - this.bagEvent = null; - this.bagEventType = null; - this.bagHolder.add("joo"); - this.verifyBagEvent(ADD, "joo"); - - this.bagEvent = null; - this.bagEventType = null; - this.bagHolder.add(null); - this.verifyBagEvent(ADD, null); - - this.bagEvent = null; - this.bagEventType = null; - this.bagHolder.add(null); - this.verifyBagEvent(ADD, null); - - this.bagEvent = null; - this.bagEventType = null; - this.bagHolder.remove("joo"); - this.verifyBagEvent(REMOVE, "joo"); - - this.bagEvent = null; - this.bagEventType = null; - this.bagHolder.remove(null); - this.verifyBagEvent(REMOVE, null); - - this.bagEvent = null; - this.bagEventType = null; - this.bagHolder.setValues(this.buildBag()); - this.verifyBagEvent(CHANGE); - - this.bagEvent = null; - this.bagEventType = null; - this.bagHolder.addAll(this.buildBag()); - this.verifyBagEvent(ADD); - assertEquals(this.buildBag(), CollectionTools.bag(((CollectionAddEvent) this.bagEvent).getItems())); - } - - private void verifySetChange() { - this.setEvent = null; - this.setEventType = null; - this.setHolder.add("foo"); - assertNull(this.setEvent); - assertNull(this.setEventType); - - this.setEvent = null; - this.setEventType = null; - this.setHolder.add("joo"); - this.verifySetEvent(ADD, "joo"); - - this.setEvent = null; - this.setEventType = null; - this.setHolder.add("joo"); - assertNull(this.setEvent); - assertNull(this.setEventType); - - this.setEvent = null; - this.setEventType = null; - this.setHolder.add(null); - this.verifySetEvent(ADD, null); - - this.setEvent = null; - this.setEventType = null; - this.setHolder.add(null); - assertNull(this.setEvent); - assertNull(this.setEventType); - - this.setEvent = null; - this.setEventType = null; - this.setHolder.remove("joo"); - this.verifySetEvent(REMOVE, "joo"); - - this.setEvent = null; - this.setEventType = null; - this.setHolder.remove("joo"); - assertNull(this.setEvent); - assertNull(this.setEventType); - - this.setEvent = null; - this.setEventType = null; - this.setHolder.remove(null); - this.verifySetEvent(REMOVE, null); - - this.setEvent = null; - this.setEventType = null; - this.setHolder.setValues(this.buildSet()); - this.verifySetEvent(CHANGE); - - this.setEvent = null; - this.setEventType = null; - this.setHolder.addAll(this.buildSet()); - assertNull(this.setEvent); - assertNull(this.setEventType); - } - - private ChangeListener buildBagListener() { - return new ChangeAdapter() { - @Override - public void itemsAdded(CollectionAddEvent e) { - SimpleCollectionValueModelTests.this.bagEventType = ADD; - SimpleCollectionValueModelTests.this.bagEvent = e; - } - @Override - public void itemsRemoved(CollectionRemoveEvent e) { - SimpleCollectionValueModelTests.this.bagEventType = REMOVE; - SimpleCollectionValueModelTests.this.bagEvent = e; - } - @Override - public void collectionCleared(CollectionClearEvent e) { - SimpleCollectionValueModelTests.this.bagEventType = CLEAR; - SimpleCollectionValueModelTests.this.bagEvent = e; - } - @Override - public void collectionChanged(CollectionChangeEvent e) { - SimpleCollectionValueModelTests.this.bagEventType = CHANGE; - SimpleCollectionValueModelTests.this.bagEvent = e; - } - }; - } - - private ChangeListener buildSetListener() { - return new ChangeAdapter() { - @Override - public void itemsAdded(CollectionAddEvent e) { - SimpleCollectionValueModelTests.this.setEventType = ADD; - SimpleCollectionValueModelTests.this.setEvent = e; - } - @Override - public void itemsRemoved(CollectionRemoveEvent e) { - SimpleCollectionValueModelTests.this.setEventType = REMOVE; - SimpleCollectionValueModelTests.this.setEvent = e; - } - @Override - public void collectionCleared(CollectionClearEvent e) { - SimpleCollectionValueModelTests.this.setEventType = CLEAR; - SimpleCollectionValueModelTests.this.setEvent = e; - } - @Override - public void collectionChanged(CollectionChangeEvent e) { - SimpleCollectionValueModelTests.this.setEventType = CHANGE; - SimpleCollectionValueModelTests.this.setEvent = e; - } - }; - } - - private void verifyBagEvent(String eventType) { - assertEquals(eventType, this.bagEventType); - assertEquals(this.bagHolder, this.bagEvent.getSource()); - assertEquals(CollectionValueModel.VALUES, this.bagEvent.getCollectionName()); - } - - private void verifyBagEvent(String eventType, Object item) { - this.verifyBagEvent(eventType); - assertEquals(item, this.getBagEventItems().iterator().next()); - } - - private Iterable getBagEventItems() { - if (this.bagEvent instanceof CollectionAddEvent) { - return ((CollectionAddEvent) this.bagEvent).getItems(); - } else if (this.bagEvent instanceof CollectionRemoveEvent) { - return ((CollectionRemoveEvent) this.bagEvent).getItems(); - } - throw new IllegalStateException(); - } - - private void verifySetEvent(String eventType) { - assertEquals(eventType, this.setEventType); - assertEquals(this.setHolder, this.setEvent.getSource()); - assertEquals(CollectionValueModel.VALUES, this.setEvent.getCollectionName()); - } - - private void verifySetEvent(String eventType, Object item) { - this.verifySetEvent(eventType); - assertEquals(item, this.getSetEventItems().iterator().next()); - } - - private Iterable getSetEventItems() { - if (this.setEvent instanceof CollectionAddEvent) { - return ((CollectionAddEvent) this.setEvent).getItems(); - } else if (this.setEvent instanceof CollectionRemoveEvent) { - return ((CollectionRemoveEvent) this.setEvent).getItems(); - } - throw new IllegalStateException(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SimpleListValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SimpleListValueModelTests.java deleted file mode 100644 index 50db81128b..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SimpleListValueModelTests.java +++ /dev/null @@ -1,378 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.Set; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class SimpleListValueModelTests extends TestCase { - private SimpleListValueModel listHolder; - ListEvent event; - String eventType; - - private static final String ADD = "add"; - private static final String REMOVE = "remove"; - private static final String REPLACE = "replace"; - private static final String MOVE = "move"; - private static final String CLEAR = "clear"; - private static final String CHANGE = "change"; - - - public SimpleListValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.listHolder = new SimpleListValueModel(this.buildList()); - } - - private List buildList() { - List result = new ArrayList(); - result.add("foo"); - result.add("bar"); - result.add("baz"); - return result; - } - - private List buildAddList() { - List result = new ArrayList(); - result.add("joo"); - result.add("jar"); - result.add("jaz"); - return result; - } - -// private List buildRemoveList() { -// List result = new ArrayList(); -// result.add("foo"); -// result.add("bar"); -// return result; -// } -// - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testIterator() { - assertEquals(this.buildList(), CollectionTools.list(this.listHolder.iterator())); - } - - public void testListIterator() { - assertEquals(this.buildList(), CollectionTools.list(this.listHolder.listIterator())); - } - - public void testListIteratorInt() { - assertEquals(CollectionTools.list(this.buildList().listIterator(1)), CollectionTools.list(this.listHolder.listIterator(1))); - } - - public void testSize() { - assertEquals(this.buildList().size(), this.listHolder.size()); - } - - private boolean listContains(Object item) { - return CollectionTools.contains(this.listHolder.listIterator(), item); - } - - private boolean listContainsAll(Collection items) { - return CollectionTools.containsAll(this.listHolder.listIterator(), items); - } - - private boolean listContainsAny(Collection items) { - Set set = CollectionTools.set(this.listHolder.iterator()); - for (Iterator stream = items.iterator(); stream.hasNext(); ) { - if (set.contains(stream.next())) { - return true; - } - } - return false; - } - - public void testAddObject() { - assertFalse(this.listContains("joo")); - this.listHolder.add("joo"); - assertTrue(this.listContains("joo")); - - assertFalse(this.listContains(null)); - this.listHolder.add(null); - assertTrue(this.listContains(null)); - } - - public void testAddIntObject() { - assertFalse(this.listContains("joo")); - this.listHolder.add(2, "joo"); - assertTrue(this.listContains("joo")); - - assertFalse(this.listContains(null)); - this.listHolder.add(0, null); - assertTrue(this.listContains(null)); - } - - public void testAddAllCollection() { - assertFalse(this.listContainsAny(this.buildAddList())); - this.listHolder.addAll(this.buildAddList()); - assertTrue(this.listContainsAll(this.buildAddList())); - } - - public void testAddAllIntCollection() { - assertFalse(this.listContainsAny(this.buildAddList())); - this.listHolder.addAll(2, this.buildAddList()); - assertTrue(this.listContainsAll(this.buildAddList())); - } - - public void testClear() { - assertFalse(this.listHolder.isEmpty()); - this.listHolder.clear(); - assertTrue(this.listHolder.isEmpty()); - } - - public void testContainsObject() { - assertTrue(this.listHolder.contains("foo")); - assertFalse(this.listHolder.contains("joo")); - } - - public void testContainsAllCollection() { - Collection c = new ArrayList(); - c.add("foo"); - c.add("bar"); - assertTrue(this.listHolder.containsAll(c)); - - c.add("joo"); - assertFalse(this.listHolder.containsAll(c)); - } - - public void testEquals() { - assertEquals(new SimpleListValueModel(this.buildList()), this.listHolder); - assertFalse(this.listHolder.equals(new SimpleListValueModel(this.buildAddList()))); - assertFalse(this.listHolder.equals(this.buildList())); - assertFalse(this.listHolder.equals(new SimpleListValueModel())); - } - - public void testGetInt() { - assertEquals("foo", this.listHolder.get(0)); - assertEquals("bar", this.listHolder.get(1)); - assertEquals("baz", this.listHolder.get(2)); - } - - public void testHashCode() { - assertEquals(new SimpleListValueModel(this.buildList()).hashCode(), this.listHolder.hashCode()); - } - - public void testIndexOfObject() { - assertEquals(0, this.listHolder.indexOf("foo")); - assertEquals(1, this.listHolder.indexOf("bar")); - assertEquals(2, this.listHolder.indexOf("baz")); - assertEquals(-1, this.listHolder.indexOf("joo")); - } - - public void testLastIndexOfObject() { - assertEquals(0, this.listHolder.lastIndexOf("foo")); - assertEquals(1, this.listHolder.lastIndexOf("bar")); - assertEquals(2, this.listHolder.lastIndexOf("baz")); - assertEquals(-1, this.listHolder.lastIndexOf("joo")); - - this.listHolder.add("foo"); - assertEquals(3, this.listHolder.lastIndexOf("foo")); - } - - public void testIsEmpty() { - assertFalse(this.listHolder.isEmpty()); - this.listHolder.clear(); - assertTrue(this.listHolder.isEmpty()); - } - - public void testRemove() { - assertTrue(this.listContains("bar")); - this.listHolder.remove(this.buildList().indexOf("bar")); - assertFalse(this.listContains("bar")); - - this.listHolder.add(1, null); - assertTrue(this.listContains(null)); - this.listHolder.remove(1); - assertFalse(this.listContains(null)); - } - - public void testSetValues() { - List newList = new ArrayList(); - newList.add("joo"); - newList.add("jar"); - newList.add("jaz"); - - assertTrue(this.listContains("bar")); - assertFalse(this.listContains("jar")); - this.listHolder.setListValues(newList); - assertFalse(this.listContains("bar")); - assertTrue(this.listContains("jar")); - - this.listHolder.add(1, null); - assertTrue(this.listContains(null)); - this.listHolder.remove(1); - assertFalse(this.listContains(null)); - - this.listHolder.setListValues(new ArrayList()); - assertFalse(this.listContains("jar")); - } - - public void testListChange1() { - this.listHolder.addChangeListener(this.buildChangeListener()); - this.verifyListChange(); - } - - public void testListChange2() { - this.listHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.buildListener()); - this.verifyListChange(); - } - - private void verifyListChange() { - this.event = null; - this.eventType = null; - this.listHolder.add(1, "joo"); - this.verifyEvent(ADD, 1, "joo"); - - this.event = null; - this.eventType = null; - this.listHolder.add(1, null); - this.verifyEvent(ADD, 1, null); - - this.event = null; - this.eventType = null; - this.listHolder.remove(1); - this.verifyEvent(REMOVE, 1, null); - - this.event = null; - this.eventType = null; - this.listHolder.remove(1); - this.verifyEvent(REMOVE, 1, "joo"); - - this.event = null; - this.eventType = null; - this.listHolder.setListValues(this.buildList()); - this.verifyEvent(CHANGE); - - this.event = null; - this.eventType = null; - this.listHolder.addAll(0, this.buildList()); - this.verifyEvent(ADD); - assertEquals(this.buildList(), CollectionTools.list(((ListAddEvent) this.event).getItems())); - - this.event = null; - this.eventType = null; - this.listHolder.set(0, "joo"); - this.verifyEvent(REPLACE); - assertFalse(CollectionTools.contains(((ListReplaceEvent) this.event).getNewItems(), "foo")); - assertTrue(CollectionTools.contains(((ListReplaceEvent) this.event).getNewItems(), "joo")); - } - - private ListChangeListener buildListener() { - return new ListChangeListener() { - public void itemsAdded(ListAddEvent e) { - SimpleListValueModelTests.this.eventType = ADD; - SimpleListValueModelTests.this.event = e; - } - public void itemsRemoved(ListRemoveEvent e) { - SimpleListValueModelTests.this.eventType = REMOVE; - SimpleListValueModelTests.this.event = e; - } - public void itemsReplaced(ListReplaceEvent e) { - SimpleListValueModelTests.this.eventType = REPLACE; - SimpleListValueModelTests.this.event = e; - } - public void itemsMoved(ListMoveEvent e) { - SimpleListValueModelTests.this.eventType = MOVE; - SimpleListValueModelTests.this.event = e; - } - public void listCleared(ListClearEvent e) { - SimpleListValueModelTests.this.eventType = CLEAR; - SimpleListValueModelTests.this.event = e; - } - public void listChanged(ListChangeEvent e) { - SimpleListValueModelTests.this.eventType = CHANGE; - SimpleListValueModelTests.this.event = e; - } - }; - } - - private ChangeListener buildChangeListener() { - return new ChangeAdapter() { - @Override - public void itemsAdded(ListAddEvent e) { - SimpleListValueModelTests.this.eventType = ADD; - SimpleListValueModelTests.this.event = e; - } - @Override - public void itemsRemoved(ListRemoveEvent e) { - SimpleListValueModelTests.this.eventType = REMOVE; - SimpleListValueModelTests.this.event = e; - } - @Override - public void itemsReplaced(ListReplaceEvent e) { - SimpleListValueModelTests.this.eventType = REPLACE; - SimpleListValueModelTests.this.event = e; - } - @Override - public void itemsMoved(ListMoveEvent e) { - SimpleListValueModelTests.this.eventType = MOVE; - SimpleListValueModelTests.this.event = e; - } - @Override - public void listCleared(ListClearEvent e) { - SimpleListValueModelTests.this.eventType = CLEAR; - SimpleListValueModelTests.this.event = e; - } - @Override - public void listChanged(ListChangeEvent e) { - SimpleListValueModelTests.this.eventType = CHANGE; - SimpleListValueModelTests.this.event = e; - } - }; - } - - private void verifyEvent(String e) { - assertEquals(e, this.eventType); - assertEquals(this.listHolder, this.event.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event.getListName()); - } - - private void verifyEvent(String e, int index, Object item) { - this.verifyEvent(e); - if (e == ADD) { - assertEquals(index, ((ListAddEvent) this.event).getIndex()); - assertEquals(item, ((ListAddEvent) this.event).getItems().iterator().next()); - } else if (e == REMOVE) { - assertEquals(index, ((ListRemoveEvent) this.event).getIndex()); - assertEquals(item, ((ListRemoveEvent) this.event).getItems().iterator().next()); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SimplePropertyValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SimplePropertyValueModelTests.java deleted file mode 100644 index 48f61d5273..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SimplePropertyValueModelTests.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class SimplePropertyValueModelTests extends TestCase { - private WritablePropertyValueModel objectHolder; - PropertyChangeEvent event; - - - public SimplePropertyValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.objectHolder = new SimplePropertyValueModel("foo"); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testValue() { - assertEquals("foo", this.objectHolder.getValue()); - } - - public void testSetValue() { - this.objectHolder.setValue("bar"); - assertEquals("bar", this.objectHolder.getValue()); - this.objectHolder.setValue(null); - assertEquals(null, this.objectHolder.getValue()); - this.objectHolder.setValue("baz"); - assertEquals("baz", this.objectHolder.getValue()); - } - - public void testPropertyChange1() { - this.objectHolder.addChangeListener(this.buildListener()); - this.verifyPropertyChange(); - } - - public void testPropertyChange2() { - this.objectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildListener()); - this.verifyPropertyChange(); - } - - private void verifyPropertyChange() { - this.event = null; - this.objectHolder.setValue("bar"); - this.verifyEvent("foo", "bar"); - - this.event = null; - this.objectHolder.setValue(null); - this.verifyEvent("bar", null); - - this.event = null; - this.objectHolder.setValue("baz"); - this.verifyEvent(null, "baz"); - } - - private ChangeListener buildListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - SimplePropertyValueModelTests.this.event = e; - } - }; - } - - private void verifyEvent(Object oldValue, Object newValue) { - assertEquals(this.objectHolder, this.event.getSource()); - assertEquals(PropertyValueModel.VALUE, this.event.getPropertyName()); - assertEquals(oldValue, this.event.getOldValue()); - assertEquals(newValue, this.event.getNewValue()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SortedListValueModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SortedListValueModelAdapterTests.java deleted file mode 100644 index 46607e8921..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SortedListValueModelAdapterTests.java +++ /dev/null @@ -1,222 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; -import java.util.List; -import java.util.TreeSet; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.Bag; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.ReverseComparator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelAdapter; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class SortedListValueModelAdapterTests extends TestCase { - private SortedListValueModelAdapter adapter; - private SimpleCollectionValueModel wrappedCollectionHolder; - private Collection wrappedCollection; - - - public SortedListValueModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.wrappedCollection = new HashBag(); - this.wrappedCollectionHolder = new SimpleCollectionValueModel(this.wrappedCollection); - this.adapter = new SortedListValueModelAdapter(this.wrappedCollectionHolder); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - private void verifyList(Collection expected, ListValueModel actual) { - this.verifyList(expected, actual, null); - } - - private void verifyList(Collection expected, ListValueModel actual, Comparator comparator) { - Collection sortedSet = new TreeSet(comparator); - sortedSet.addAll(expected); - List expectedList = new ArrayList(sortedSet); - List actualList = CollectionTools.list(actual.iterator()); - assertEquals(expectedList, actualList); - } - - public void testAdd() { - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() { - @Override - public void itemsAdded(ListAddEvent e) {/* OK */} - @Override - public void itemsReplaced(ListReplaceEvent e) {/* OK */} - }); - this.wrappedCollectionHolder.add("foo"); - this.wrappedCollectionHolder.add("bar"); - this.wrappedCollectionHolder.add("baz"); - assertEquals(3, this.adapter.size()); - this.verifyList(this.wrappedCollection, this.adapter); - } - - public void testAddItem() { - List synchList = new CoordinatedList(this.adapter); - Bag synchCollection = new CoordinatedBag(this.wrappedCollectionHolder); - this.wrappedCollectionHolder.add("foo"); - assertTrue(this.wrappedCollection.contains("foo")); - this.wrappedCollectionHolder.add("bar"); - this.wrappedCollectionHolder.add("baz"); - this.wrappedCollectionHolder.add("joo"); - this.wrappedCollectionHolder.add("jar"); - this.wrappedCollectionHolder.add("jaz"); - assertEquals(6, this.wrappedCollection.size()); - - this.verifyList(this.wrappedCollection, this.adapter); - assertEquals(this.wrappedCollection, CollectionTools.collection(synchList.iterator())); - assertEquals(this.wrappedCollection, synchCollection); - } - - public void testRemoveItem() { - List synchList = new CoordinatedList(this.adapter); - Bag synchCollection = new CoordinatedBag(this.wrappedCollectionHolder); - this.wrappedCollectionHolder.add("foo"); - this.wrappedCollectionHolder.add("bar"); - this.wrappedCollectionHolder.add("baz"); - this.wrappedCollectionHolder.add("joo"); - this.wrappedCollectionHolder.add("jar"); - this.wrappedCollectionHolder.add("jaz"); - this.wrappedCollectionHolder.remove("jaz"); - assertFalse(this.wrappedCollection.contains("jaz")); - this.wrappedCollectionHolder.remove("foo"); - assertFalse(this.wrappedCollection.contains("foo")); - assertEquals(4, this.wrappedCollection.size()); - - this.verifyList(this.wrappedCollection, this.adapter); - assertEquals(this.wrappedCollection, CollectionTools.collection(synchList.iterator())); - assertEquals(this.wrappedCollection, synchCollection); - } - - public void testListSynch() { - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() { - @Override - public void itemsAdded(ListAddEvent e) {/* OK */} - @Override - public void itemsRemoved(ListRemoveEvent e) {/* OK */} - @Override - public void itemsReplaced(ListReplaceEvent e) {/* OK */} - }); - this.wrappedCollectionHolder.add("foo"); - this.wrappedCollectionHolder.add("bar"); - this.wrappedCollectionHolder.add("baz"); - this.wrappedCollectionHolder.add("joo"); - this.wrappedCollectionHolder.add("jar"); - this.wrappedCollectionHolder.add("jaz"); - this.wrappedCollectionHolder.remove("jaz"); - assertFalse(this.wrappedCollection.contains("jaz")); - this.wrappedCollectionHolder.remove("foo"); - assertFalse(this.wrappedCollection.contains("foo")); - assertEquals(4, this.wrappedCollection.size()); - - this.verifyList(this.wrappedCollection, this.adapter); - } - - public void testSetComparator() { - List synchList = new CoordinatedList(this.adapter); - Bag synchCollection = new CoordinatedBag(this.wrappedCollectionHolder); - this.wrappedCollectionHolder.add("foo"); - assertTrue(this.wrappedCollection.contains("foo")); - this.wrappedCollectionHolder.add("bar"); - this.wrappedCollectionHolder.add("baz"); - this.wrappedCollectionHolder.add("joo"); - this.wrappedCollectionHolder.add("jar"); - this.wrappedCollectionHolder.add("jaz"); - assertEquals(6, this.wrappedCollection.size()); - - this.verifyList(this.wrappedCollection, this.adapter); - assertEquals(this.wrappedCollection, CollectionTools.collection(synchList.iterator())); - assertEquals(this.wrappedCollection, synchCollection); - - this.adapter.setComparator(new ReverseComparator()); - this.verifyList(this.wrappedCollection, this.adapter, new ReverseComparator()); - assertEquals(this.wrappedCollection, CollectionTools.collection(synchList.iterator())); - assertEquals(this.wrappedCollection, synchCollection); - } - - public void testHasListeners() { - assertFalse(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - CoordinatedList synchList = new CoordinatedList(this.adapter); - assertTrue(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - this.adapter.removeListChangeListener(ListValueModel.LIST_VALUES, synchList); - assertFalse(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - ChangeListener cl = new ChangeAdapter(); - this.adapter.addChangeListener(cl); - assertTrue(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - this.adapter.removeChangeListener(cl); - assertFalse(((AbstractModel) this.adapter).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - } - - public void testCollectionChange() { - this.wrappedCollectionHolder.add("fred"); - this.adapter.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() { - @Override - public void itemsAdded(ListAddEvent e) {/* OK */} - @Override - public void itemsReplaced(ListReplaceEvent e) {/* OK */} - }); - this.wrappedCollectionHolder.setValues(Arrays.asList(new String[] {"foo", "bar", "baz"})); - assertEquals(3, this.adapter.size()); - this.verifyList(this.wrappedCollection, this.adapter); - } - - class TestListChangeListener implements ListChangeListener { - public void itemsAdded(ListAddEvent e) { - fail("unexpected event"); - } - public void itemsRemoved(ListRemoveEvent e) { - fail("unexpected event"); - } - public void itemsReplaced(ListReplaceEvent e) { - fail("unexpected event"); - } - public void itemsMoved(ListMoveEvent e) { - fail("unexpected event"); - } - public void listCleared(ListClearEvent e) { - fail("unexpected event"); - } - public void listChanged(ListChangeEvent e) { - fail("unexpected event"); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SortedListValueModelWrapperTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SortedListValueModelWrapperTests.java deleted file mode 100644 index 0f4f945eec..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/SortedListValueModelWrapperTests.java +++ /dev/null @@ -1,237 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; -import java.util.List; -import java.util.TreeSet; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.ReverseComparator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelWrapper; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class SortedListValueModelWrapperTests extends TestCase { - private List list; - private SimpleListValueModel listModel; - private SortedListValueModelWrapper sortedListModel; - - - public SortedListValueModelWrapperTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.list = new ArrayList(); - this.listModel = new SimpleListValueModel(this.list); - this.sortedListModel = new SortedListValueModelWrapper(this.listModel); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - private void verifyList(Collection expected, ListValueModel actual) { - this.verifyList(expected, actual, null); - } - - private void verifyList(Collection expected, ListValueModel actual, Comparator comparator) { - Collection sortedSet = new TreeSet(comparator); - sortedSet.addAll(expected); - List expectedList = new ArrayList(sortedSet); - List actualList = CollectionTools.list(actual); - assertEquals(expectedList, actualList); - } - - public void testAdd() { - this.sortedListModel.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() { - @Override - public void itemsAdded(ListAddEvent e) {/* OK */} - @Override - public void itemsReplaced(ListReplaceEvent e) {/* OK */} - }); - this.listModel.add("foo"); - this.listModel.add("bar"); - this.listModel.add("baz"); - assertEquals(3, this.sortedListModel.size()); - this.verifyList(this.list, this.sortedListModel); - } - - public void testAddItem() { - List sortedSynchList = new CoordinatedList(this.sortedListModel); - List synchList = new CoordinatedList(this.listModel); - this.listModel.add("foo"); - assertTrue(this.list.contains("foo")); - this.listModel.add("bar"); - this.listModel.add("baz"); - this.listModel.add("joo"); - this.listModel.add("jar"); - this.listModel.add("jaz"); - assertEquals(6, this.list.size()); - - this.verifyList(this.list, this.sortedListModel); - assertEquals(this.list, synchList); - assertEquals(CollectionTools.list(this.sortedListModel), sortedSynchList); - } - - public void testRemoveItem() { - List sortedSynchList = new CoordinatedList(this.sortedListModel); - List synchList = new CoordinatedList(this.listModel); - this.listModel.add("foo"); - this.listModel.add("bar"); - this.listModel.add("baz"); - this.listModel.add("joo"); - this.listModel.add("jar"); - this.listModel.add("jaz"); - this.listModel.remove("jaz"); - assertFalse(this.list.contains("jaz")); - this.listModel.remove("foo"); - assertFalse(this.list.contains("foo")); - assertEquals(4, this.list.size()); - - this.verifyList(this.list, this.sortedListModel); - assertEquals(this.list, synchList); - assertEquals(CollectionTools.list(this.sortedListModel), sortedSynchList); - } - - public void testReplaceItem() { - List sortedSynchList = new CoordinatedList(this.sortedListModel); - List synchList = new CoordinatedList(this.listModel); - this.listModel.add("foo"); - assertTrue(this.list.contains("foo")); - this.listModel.add("bar"); - this.listModel.add("baz"); - this.listModel.add("joo"); - this.listModel.add("jar"); - this.listModel.add("jaz"); - assertEquals(6, this.list.size()); - this.listModel.set(3, "ttt"); - this.listModel.set(4, "xxx"); - assertTrue(this.list.contains("xxx")); - - this.verifyList(this.list, this.sortedListModel); - assertEquals(this.list, synchList); - assertEquals(CollectionTools.list(this.sortedListModel), sortedSynchList); - } - - public void testListSynch() { - this.sortedListModel.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() { - @Override - public void itemsAdded(ListAddEvent e) {/* OK */} - @Override - public void itemsRemoved(ListRemoveEvent e) {/* OK */} - @Override - public void itemsReplaced(ListReplaceEvent e) {/* OK */} - }); - this.listModel.add("foo"); - this.listModel.add("bar"); - this.listModel.add("baz"); - this.listModel.add("joo"); - this.listModel.add("jar"); - this.listModel.add("jaz"); - this.listModel.remove("jaz"); - assertFalse(this.list.contains("jaz")); - this.listModel.remove("foo"); - assertFalse(this.list.contains("foo")); - assertEquals(4, this.list.size()); - - this.verifyList(this.list, this.sortedListModel); - } - - public void testSetComparator() { - List sortedSynchList = new CoordinatedList(this.sortedListModel); - List synchList = new CoordinatedList(this.listModel); - this.listModel.add("foo"); - assertTrue(this.list.contains("foo")); - this.listModel.add("bar"); - this.listModel.add("baz"); - this.listModel.add("joo"); - this.listModel.add("jar"); - this.listModel.add("jaz"); - assertEquals(6, this.list.size()); - - this.verifyList(this.list, this.sortedListModel); - assertEquals(this.list, synchList); - assertEquals(CollectionTools.list(this.sortedListModel), sortedSynchList); - - this.sortedListModel.setComparator(new ReverseComparator()); - this.verifyList(this.list, this.sortedListModel, new ReverseComparator()); - assertEquals(this.list, synchList); - } - - public void testHasListeners() { - assertFalse(((AbstractModel) this.sortedListModel).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - CoordinatedList sortedSynchList = new CoordinatedList(this.sortedListModel); - assertTrue(((AbstractModel) this.sortedListModel).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - this.sortedListModel.removeListChangeListener(ListValueModel.LIST_VALUES, sortedSynchList); - assertFalse(((AbstractModel) this.sortedListModel).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - ChangeListener cl = new ChangeAdapter(); - this.sortedListModel.addChangeListener(cl); - assertTrue(((AbstractModel) this.sortedListModel).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - this.sortedListModel.removeChangeListener(cl); - assertFalse(((AbstractModel) this.sortedListModel).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - } - - public void testListChange() { - this.listModel.add("fred"); - this.sortedListModel.addListChangeListener(ListValueModel.LIST_VALUES, new TestListChangeListener() { - @Override - public void listChanged(ListChangeEvent e) {/* OK */} - }); - this.listModel.setListValues(Arrays.asList(new String[] {"foo", "bar", "baz"})); - assertEquals(3, this.sortedListModel.size()); - this.verifyList(this.list, this.sortedListModel); - } - - class TestListChangeListener implements ListChangeListener { - public void itemsAdded(ListAddEvent e) { - fail("unexpected event"); - } - public void itemsRemoved(ListRemoveEvent e) { - fail("unexpected event"); - } - public void itemsReplaced(ListReplaceEvent e) { - fail("unexpected event"); - } - public void itemsMoved(ListMoveEvent e) { - fail("unexpected event"); - } - public void listCleared(ListClearEvent e) { - fail("unexpected event"); - } - public void listChanged(ListChangeEvent e) { - fail("unexpected event"); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/StaticCollectionValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/StaticCollectionValueModelTests.java deleted file mode 100644 index 920f57d506..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/StaticCollectionValueModelTests.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.Collection; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.model.value.StaticCollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class StaticCollectionValueModelTests extends TestCase { - - private static final Collection COLLECTION = buildCollection(); - private static Collection buildCollection() { - Collection result = new HashBag(); - result.add("foo"); - result.add("bar"); - return result; - } - - private CollectionValueModel collectionHolder; - - - public StaticCollectionValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.collectionHolder = this.buildCollectionHolder(); - } - - private CollectionValueModel buildCollectionHolder() { - return new StaticCollectionValueModel(COLLECTION); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testIterator() { - assertEquals(buildCollection(), CollectionTools.bag(this.collectionHolder.iterator())); - } - - public void testSize() { - assertEquals(buildCollection().size(), this.collectionHolder.size()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/StaticListValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/StaticListValueModelTests.java deleted file mode 100644 index 620a4ab071..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/StaticListValueModelTests.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.List; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.model.value.StaticListValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class StaticListValueModelTests extends TestCase { - - private static final List LIST = buildList(); - private static List buildList() { - List result = new ArrayList(); - result.add("foo"); - result.add("bar"); - return result; - } - - private ListValueModel listHolder; - - - public StaticListValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.listHolder = new StaticListValueModel(LIST); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testGet() { - List expected = buildList(); - for (int i = 0; i < this.listHolder.size(); i++) { - assertEquals(expected.get(i), this.listHolder.get(i)); - } - } - - public void testIterator() { - assertEquals(buildList(), CollectionTools.list(this.listHolder.listIterator())); - } - - public void testSize() { - assertEquals(buildList().size(), this.listHolder.size()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/StaticValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/StaticValueModelTests.java deleted file mode 100644 index 535a700f52..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/StaticValueModelTests.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class StaticValueModelTests extends TestCase { - private PropertyValueModel objectHolder; - private static final PropertyValueModel OBJECT_HOLDER = new StaticPropertyValueModel("foo"); - - - public StaticValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.objectHolder = OBJECT_HOLDER; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testValue() { - assertEquals("foo", this.objectHolder.getValue()); - } - - public void testToString() { - assertTrue(this.objectHolder.toString().indexOf("foo") >= 0); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationListValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationListValueModelTests.java deleted file mode 100644 index 78963bc685..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationListValueModelTests.java +++ /dev/null @@ -1,339 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.TransformationListValueModel; -import org.eclipse.jpt.common.utility.model.event.ListAddEvent; -import org.eclipse.jpt.common.utility.model.event.ListChangeEvent; -import org.eclipse.jpt.common.utility.model.event.ListClearEvent; -import org.eclipse.jpt.common.utility.model.event.ListEvent; -import org.eclipse.jpt.common.utility.model.event.ListMoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.ListReplaceEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class TransformationListValueModelTests extends TestCase { - private SimpleListValueModel listHolder; - private ListValueModel transformedListHolder; - ListEvent event; - String eventType; - - private static final String ADD = "add"; - private static final String REMOVE = "remove"; - private static final String REPLACE = "replace"; - private static final String MOVE = "move"; - private static final String CLEAR = "clear"; - private static final String CHANGE = "change"; - - - public TransformationListValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.listHolder = new SimpleListValueModel(this.buildList()); - this.transformedListHolder = this.buildTransformedListHolder(this.listHolder); - } - - private List buildList() { - List result = new ArrayList(); - result.add("foo"); - result.add("bar"); - result.add("baz"); - return result; - } - - private List buildTransformedList() { - return this.transform(this.buildList()); - } - - private List transform(List list) { - List result = new ArrayList(list.size()); - for (String string : list) { - if (string == null) { - result.add(null); - } else { - result.add(string.toUpperCase()); - } - } - return result; - } - - private List buildAddList() { - List result = new ArrayList(); - result.add("joo"); - result.add("jar"); - result.add("jaz"); - return result; - } - - private List buildTransformedAddList() { - return this.transform(this.buildAddList()); - } - -// private List buildRemoveList() { -// List result = new ArrayList(); -// result.add("foo"); -// result.add("bar"); -// return result; -// } -// -// private List buildTransformedRemoveList() { -// return this.transform(this.buildRemoveList()); -// } -// - ListValueModel buildTransformedListHolder(ListValueModel lvm) { - return new TransformationListValueModel(lvm) { - @Override - protected String transformItem_(String s) { - return s.toUpperCase(); - } - }; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testIterator() { - this.transformedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.buildListener()); - assertEquals(this.buildTransformedList(), CollectionTools.list(this.transformedListHolder.iterator())); - } - - public void testStaleValues() { - ListChangeListener listener = this.buildListener(); - this.transformedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, listener); - assertEquals(this.buildTransformedList(), CollectionTools.list(this.transformedListHolder.iterator())); - - this.transformedListHolder.removeListChangeListener(ListValueModel.LIST_VALUES, listener); - assertEquals(Collections.EMPTY_LIST, CollectionTools.list(this.transformedListHolder.iterator())); - } - - public void testSize() { - this.transformedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.buildListener()); - assertEquals(this.buildTransformedList().size(), CollectionTools.size(this.transformedListHolder.iterator())); - } - - private boolean transformedListContains(Object item) { - return CollectionTools.contains(this.transformedListHolder.iterator(), item); - } - - private boolean transformedListContainsAll(Collection items) { - return CollectionTools.containsAll(this.transformedListHolder.iterator(), items); - } - - private boolean transformedListContainsAny(Collection items) { - List transformedList = CollectionTools.list(this.transformedListHolder.iterator()); - for (Iterator stream = items.iterator(); stream.hasNext(); ) { - if (transformedList.contains(stream.next())) { - return true; - } - } - return false; - } - - public void testAdd() { - this.transformedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.buildListener()); - - assertFalse(this.transformedListContains("JOO")); - this.listHolder.add(2, "joo"); - assertTrue(this.transformedListContains("JOO")); - - assertFalse(this.transformedListContains(null)); - this.listHolder.add(0, null); - assertTrue(this.transformedListContains(null)); - } - - public void testAddAll() { - this.transformedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.buildListener()); - - assertFalse(this.transformedListContainsAny(this.buildTransformedAddList())); - this.listHolder.addAll(2, this.buildAddList()); - assertTrue(this.transformedListContainsAll(this.buildTransformedAddList())); - } - - public void testRemove() { - this.transformedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.buildListener()); - - assertTrue(this.transformedListContains("BAR")); - this.listHolder.remove(this.buildList().indexOf("bar")); - assertFalse(this.transformedListContains("BAR")); - - this.listHolder.add(1, null); - assertTrue(this.transformedListContains(null)); - this.listHolder.remove(1); - assertFalse(this.transformedListContains(null)); - } - - public void testListChangeGeneric() { - this.transformedListHolder.addChangeListener(this.buildListener()); - this.verifyListChange(); - } - - public void testListChangeNamed() { - this.transformedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, this.buildListener()); - this.verifyListChange(); - } - - private void verifyListChange() { - this.event = null; - this.eventType = null; - this.listHolder.add(1, "joo"); - this.verifyEvent(ADD, 1, "JOO"); - - this.event = null; - this.eventType = null; - this.listHolder.add(1, null); - this.verifyEvent(ADD, 1, null); - - this.event = null; - this.eventType = null; - this.listHolder.remove(1); - this.verifyEvent(REMOVE, 1, null); - - this.event = null; - this.eventType = null; - this.listHolder.remove(1); - this.verifyEvent(REMOVE, 1, "JOO"); - - this.event = null; - this.eventType = null; - this.listHolder.addAll(0, this.buildList()); - this.verifyEvent(ADD); - assertEquals(this.buildTransformedList(), CollectionTools.list(((ListAddEvent) this.event).getItems())); - - this.event = null; - this.eventType = null; - this.listHolder.set(0, "joo"); - this.verifyEvent(REPLACE); - assertFalse(CollectionTools.contains(((ListReplaceEvent) this.event).getNewItems(), "FOO")); - assertTrue(CollectionTools.contains(((ListReplaceEvent) this.event).getNewItems(), "JOO")); - } - - private ChangeListener buildListener() { - return new ChangeAdapter() { - @Override - public void itemsAdded(ListAddEvent e) { - TransformationListValueModelTests.this.eventType = ADD; - TransformationListValueModelTests.this.event = e; - } - @Override - public void itemsRemoved(ListRemoveEvent e) { - TransformationListValueModelTests.this.eventType = REMOVE; - TransformationListValueModelTests.this.event = e; - } - @Override - public void itemsReplaced(ListReplaceEvent e) { - TransformationListValueModelTests.this.eventType = REPLACE; - TransformationListValueModelTests.this.event = e; - } - @Override - public void itemsMoved(ListMoveEvent e) { - TransformationListValueModelTests.this.eventType = MOVE; - TransformationListValueModelTests.this.event = e; - } - @Override - public void listCleared(ListClearEvent e) { - TransformationListValueModelTests.this.eventType = CLEAR; - TransformationListValueModelTests.this.event = e; - } - @Override - public void listChanged(ListChangeEvent e) { - TransformationListValueModelTests.this.eventType = CHANGE; - TransformationListValueModelTests.this.event = e; - } - }; - } - - private void verifyEvent(String type) { - assertEquals(type, this.eventType); - assertEquals(this.transformedListHolder, this.event.getSource()); - assertEquals(ListValueModel.LIST_VALUES, this.event.getListName()); - } - - private void verifyEvent(String type, int index, Object item) { - this.verifyEvent(type); - if (type == ADD) { - assertEquals(index, ((ListAddEvent) this.event).getIndex()); - assertEquals(item, ((ListAddEvent) this.event).getItems().iterator().next()); - } else if (type == REMOVE) { - assertEquals(index, ((ListRemoveEvent) this.event).getIndex()); - assertEquals(item, ((ListRemoveEvent) this.event).getItems().iterator().next()); - } - } - - public void testHasListeners() { - /* - * adding listeners to the transformed list will cause listeners - * to be added to the wrapped list; - * likewise, removing listeners from the transformed list will - * cause listeners to be removed from the wrapped list - */ - assertFalse(((AbstractModel) this.listHolder).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - ChangeListener listener = this.buildListener(); - - this.transformedListHolder.addListChangeListener(ListValueModel.LIST_VALUES, listener); - assertTrue(((AbstractModel) this.listHolder).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - this.transformedListHolder.removeListChangeListener(ListValueModel.LIST_VALUES, listener); - assertFalse(((AbstractModel) this.listHolder).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - this.transformedListHolder.addChangeListener(listener); - assertTrue(((AbstractModel) this.listHolder).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - this.transformedListHolder.removeChangeListener(listener); - assertFalse(((AbstractModel) this.listHolder).hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - } - - - /** - * execute the same set of tests again, but by passing a Transformer to the adapter - * (as opposed to overriding #transformItem(Object)) - */ - public static class TransformerTests extends TransformationListValueModelTests { - public TransformerTests(String name) { - super(name); - } - @Override - ListValueModel buildTransformedListHolder(ListValueModel lvm) { - return new TransformationListValueModel(lvm, this.buildTransformer()); - } - private Transformer buildTransformer() { - return new Transformer() { - public String transform(String s) { - return (s == null) ? null : s.toUpperCase(); - } - }; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationPropertyValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationPropertyValueModelTests.java deleted file mode 100644 index 8344919d69..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TransformationPropertyValueModelTests.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.BidiTransformer; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.TransformationWritablePropertyValueModel; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class TransformationPropertyValueModelTests extends TestCase { - private WritablePropertyValueModel objectHolder; - PropertyChangeEvent event; - - private WritablePropertyValueModel transformationObjectHolder; - PropertyChangeEvent transformationEvent; - - public TransformationPropertyValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.objectHolder = new SimplePropertyValueModel("foo"); - this.transformationObjectHolder = new TransformationWritablePropertyValueModel(this.objectHolder, this.buildTransformer()); - } - - private BidiTransformer buildTransformer() { - return new BidiTransformer() { - public String transform(String s) { - return (s == null) ? null : s.toUpperCase(); - } - public String reverseTransform(String s) { - return (s == null) ? null : s.toLowerCase(); - } - }; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testValue() { - assertEquals("foo", this.objectHolder.getValue()); - assertEquals("FOO", this.transformationObjectHolder.getValue()); - - this.objectHolder.setValue("bar"); - assertEquals("bar", this.objectHolder.getValue()); - assertEquals("BAR", this.transformationObjectHolder.getValue()); - - this.objectHolder.setValue("baz"); - assertEquals("baz", this.objectHolder.getValue()); - assertEquals("BAZ", this.transformationObjectHolder.getValue()); - - this.objectHolder.setValue(null); - assertNull(this.objectHolder.getValue()); - assertNull(this.transformationObjectHolder.getValue()); - - this.objectHolder.setValue("foo"); - assertEquals("foo", this.objectHolder.getValue()); - assertEquals("FOO", this.transformationObjectHolder.getValue()); - } - - public void testSetValue() { - this.transformationObjectHolder.setValue("BAR"); - assertEquals("bar", this.objectHolder.getValue()); - assertEquals("BAR", this.transformationObjectHolder.getValue()); - - this.transformationObjectHolder.setValue("Foo"); - assertEquals("foo", this.objectHolder.getValue()); - assertEquals("FOO", this.transformationObjectHolder.getValue()); - - this.transformationObjectHolder.setValue(null); - assertNull(this.objectHolder.getValue()); - assertNull(this.transformationObjectHolder.getValue()); - - this.transformationObjectHolder.setValue("baz"); - assertEquals("baz", this.objectHolder.getValue()); - assertEquals("BAZ", this.transformationObjectHolder.getValue()); - } - - public void testLazyListening() { - assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - ChangeListener listener = this.buildTransformationListener(); - this.transformationObjectHolder.addChangeListener(listener); - assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.transformationObjectHolder.removeChangeListener(listener); - assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - - this.transformationObjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, listener); - assertTrue(((AbstractModel) this.objectHolder).hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.transformationObjectHolder.removePropertyChangeListener(PropertyValueModel.VALUE, listener); - assertTrue(((AbstractModel) this.objectHolder).hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - } - - public void testPropertyChange1() { - this.objectHolder.addChangeListener(this.buildListener()); - this.transformationObjectHolder.addChangeListener(this.buildTransformationListener()); - this.verifyPropertyChanges(); - } - - public void testPropertyChange2() { - this.objectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildListener()); - this.transformationObjectHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.buildTransformationListener()); - this.verifyPropertyChanges(); - } - - private void verifyPropertyChanges() { - this.event = null; - this.transformationEvent = null; - this.objectHolder.setValue("bar"); - this.verifyEvent(this.event, this.objectHolder, "foo", "bar"); - this.verifyEvent(this.transformationEvent, this.transformationObjectHolder, "FOO", "BAR"); - - this.event = null; - this.transformationEvent = null; - this.objectHolder.setValue("baz"); - this.verifyEvent(this.event, this.objectHolder, "bar", "baz"); - this.verifyEvent(this.transformationEvent, this.transformationObjectHolder, "BAR", "BAZ"); - - this.event = null; - this.transformationEvent = null; - this.objectHolder.setValue("Foo"); - this.verifyEvent(this.event, this.objectHolder, "baz", "Foo"); - this.verifyEvent(this.transformationEvent, this.transformationObjectHolder, "BAZ", "FOO"); - - this.event = null; - this.transformationEvent = null; - this.objectHolder.setValue("FOO"); - this.verifyEvent(this.event, this.objectHolder, "Foo", "FOO"); - assertNull(this.transformationEvent); - - this.event = null; - this.transformationEvent = null; - this.objectHolder.setValue(null); - this.verifyEvent(this.event, this.objectHolder, "FOO", null); - this.verifyEvent(this.transformationEvent, this.transformationObjectHolder, "FOO", null); - - this.event = null; - this.transformationEvent = null; - this.objectHolder.setValue("bar"); - this.verifyEvent(this.event, this.objectHolder, null, "bar"); - this.verifyEvent(this.transformationEvent, this.transformationObjectHolder, null, "BAR"); - } - - private ChangeListener buildListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - TransformationPropertyValueModelTests.this.event = e; - } - }; - } - - private ChangeListener buildTransformationListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - TransformationPropertyValueModelTests.this.transformationEvent = e; - } - }; - } - - private void verifyEvent(PropertyChangeEvent e, Object source, Object oldValue, Object newValue) { - assertEquals(source, e.getSource()); - assertEquals(PropertyValueModel.VALUE, e.getPropertyName()); - assertEquals(oldValue, e.getOldValue()); - assertEquals(newValue, e.getNewValue()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TreeAspectAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TreeAspectAdapterTests.java deleted file mode 100644 index 22ffb59825..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/TreeAspectAdapterTests.java +++ /dev/null @@ -1,362 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.iterators.ChainIterator; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TreeIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.TreeAspectAdapter; -import org.eclipse.jpt.common.utility.model.event.TreeAddEvent; -import org.eclipse.jpt.common.utility.model.event.TreeChangeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeClearEvent; -import org.eclipse.jpt.common.utility.model.event.TreeEvent; -import org.eclipse.jpt.common.utility.model.event.TreeRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.TreeChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.TreeValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class TreeAspectAdapterTests extends TestCase { - private TestSubject subject1; - private WritablePropertyValueModel subjectHolder1; - private TreeAspectAdapter> aa1; - private TreeEvent event1; - private TreeChangeListener listener1; - - private TestSubject subject2; - - - public TreeAspectAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.subject1 = new TestSubject(); - TestNode root, node; - - root = this.subject1.getRootNameNode(); - node = this.subject1.addName(root, "name 1.1"); - this.subject1.addName(node, "name 1.1.1"); - this.subject1.addName(node, "name 1.1.2"); - node = this.subject1.addName(root, "name 1.2"); - this.subject1.addName(node, "name 1.2.1"); - node = this.subject1.addName(root, "name 1.3"); - - root = this.subject1.getRootDescriptionNode(); - node = this.subject1.addDescription(root, "description 1.1"); - this.subject1.addDescription(node, "description 1.1.1"); - this.subject1.addDescription(node, "description 1.1.2"); - node = this.subject1.addDescription(root, "description 1.2"); - this.subject1.addDescription(node, "description 1.2.1"); - node = this.subject1.addDescription(root, "description 1.3"); - - this.subjectHolder1 = new SimplePropertyValueModel(this.subject1); - this.aa1 = this.buildAspectAdapter(this.subjectHolder1); - this.listener1 = this.buildValueChangeListener1(); - this.aa1.addTreeChangeListener(TreeValueModel.NODES, this.listener1); - this.event1 = null; - - this.subject2 = new TestSubject(); - - root = this.subject2.getRootNameNode(); - node = this.subject2.addName(root, "name 2.1"); - this.subject2.addName(node, "name 2.1.1"); - this.subject2.addName(node, "name 2.1.2"); - node = this.subject2.addName(root, "name 2.2"); - this.subject2.addName(node, "name 2.2.1"); - node = this.subject2.addName(root, "name 2.3"); - - root = this.subject2.getRootDescriptionNode(); - node = this.subject2.addDescription(root, "description 2.1"); - this.subject2.addDescription(node, "description 2.1.1"); - this.subject2.addDescription(node, "description 2.1.2"); - node = this.subject2.addDescription(root, "description 2.2"); - this.subject2.addDescription(node, "description 2.2.1"); - node = this.subject2.addDescription(root, "description 2.3"); - } - - private TreeAspectAdapter> buildAspectAdapter(PropertyValueModel subjectHolder) { - return new TreeAspectAdapter>(subjectHolder, TestSubject.NAMES_TREE) { - // this is not a typical aspect adapter - the value is determined by the aspect name - @Override - protected Iterator> nodes_() { - if (this.treeNames[0] == TestSubject.NAMES_TREE) { - return this.subject.namePaths(); - } - if (this.treeNames[0] == TestSubject.DESCRIPTIONS_TREE) { - return this.subject.descriptionPaths(); - } - throw new IllegalStateException("invalid aspect name: " + this.treeNames[0]); - } - }; - } - - private ChangeListener buildValueChangeListener1() { - return new ChangeAdapter() { - @Override - public void nodeAdded(TreeAddEvent e) { - TreeAspectAdapterTests.this.value1Changed(e); - } - @Override - public void nodeRemoved(TreeRemoveEvent e) { - TreeAspectAdapterTests.this.value1Changed(e); - } - @Override - public void treeCleared(TreeClearEvent e) { - TreeAspectAdapterTests.this.value1Changed(e); - } - @Override - public void treeChanged(TreeChangeEvent e) { - TreeAspectAdapterTests.this.value1Changed(e); - } - }; - } - - void value1Changed(TreeEvent e) { - this.event1 = e; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testSubjectHolder() { - assertNull(this.event1); - - this.subjectHolder1.setValue(this.subject2); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(TreeValueModel.NODES, this.event1.getTreeName()); - - this.event1 = null; - this.subjectHolder1.setValue(null); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(TreeValueModel.NODES, this.event1.getTreeName()); - - this.event1 = null; - this.subjectHolder1.setValue(this.subject1); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(TreeValueModel.NODES, this.event1.getTreeName()); - } - - public void testTreeStructureChange() { - assertNull(this.event1); - - this.subject1.addTwoNames(this.subject1.getRootNameNode(), "jam", "jaz"); - assertNotNull(this.event1); - assertEquals(this.aa1, this.event1.getSource()); - assertEquals(TreeValueModel.NODES, this.event1.getTreeName()); - assertTrue(this.subject1.containsNameNode("jam")); - assertTrue(this.subject1.containsNameNode("jaz")); - } - - public void testNodes() { - assertEquals(this.convertToNames(this.subject1.namePaths()), this.convertToNames(this.aa1.nodes())); - } - - private Collection convertToNames(Iterator> namePaths) { - Collection result = new HashBag(); - while (namePaths.hasNext()) { - List path = namePaths.next(); - StringBuffer sb = new StringBuffer(); - sb.append('['); - for (int i = 0; i < path.size(); i++) { - sb.append(path.get(i).getText()); - if (i < path.size() - 1) { - sb.append(':'); - } - } - sb.append(']'); - result.add(sb.toString()); - } - return result; - } - - public void testHasListeners() { - assertTrue(this.aa1.hasAnyTreeChangeListeners(TreeValueModel.NODES)); - assertTrue(this.subject1.hasAnyTreeChangeListeners(TestSubject.NAMES_TREE)); - this.aa1.removeTreeChangeListener(TreeValueModel.NODES, this.listener1); - assertFalse(this.subject1.hasAnyTreeChangeListeners(TestSubject.NAMES_TREE)); - assertFalse(this.aa1.hasAnyTreeChangeListeners(TreeValueModel.NODES)); - - ChangeListener listener2 = this.buildValueChangeListener1(); - this.aa1.addChangeListener(listener2); - assertTrue(this.aa1.hasAnyTreeChangeListeners(TreeValueModel.NODES)); - assertTrue(this.subject1.hasAnyTreeChangeListeners(TestSubject.NAMES_TREE)); - this.aa1.removeChangeListener(listener2); - assertFalse(this.subject1.hasAnyTreeChangeListeners(TestSubject.NAMES_TREE)); - assertFalse(this.aa1.hasAnyTreeChangeListeners(TreeValueModel.NODES)); - } - - // ********** inner classes ********** - - class TestSubject extends AbstractModel { - private TestNode rootNameNode; - public static final String NAMES_TREE = "names"; - private TestNode rootDescriptionNode; - public static final String DESCRIPTIONS_TREE = "descriptions"; - - public TestSubject() { - this.rootNameNode = new TestNode("root name"); - this.rootDescriptionNode = new TestNode("root description"); - } - public TestNode getRootNameNode() { - return this.rootNameNode; - } - public Iterator nameNodes() { - return new TreeIterator(this.rootNameNode) { - @Override - public Iterator children(TestNode next) { - return next.children(); - } - }; - } - public Iterator> namePaths() { - return new TransformationIterator>(this.nameNodes()) { - @Override - protected List transform(TestNode next) { - return next.getPath(); - } - }; - } - public TestNode addName(TestNode parent, String name) { - TestNode child = new TestNode(name); - parent.addChild(child); - this.fireNodeAdded(NAMES_TREE, child.getPath()); - return child; - } - public void addTwoNames(TestNode parent, String name1, String name2) { - parent.addChild(new TestNode(name1)); - parent.addChild(new TestNode(name2)); - this.fireTreeChanged(NAMES_TREE, parent.getPath()); - } - public void removeNameNode(TestNode nameNode) { - nameNode.getParent().removeChild(nameNode); - this.fireNodeRemoved(NAMES_TREE, nameNode.getPath()); - } - public boolean containsNameNode(String name) { - return this.nameNode(name) != null; - } - public TestNode nameNode(String name) { - for (Iterator stream = this.nameNodes(); stream.hasNext(); ) { - TestNode node = stream.next(); - if (node.getText().equals(name)) { - return node; - } - } - return null; - } - public TestNode getRootDescriptionNode() { - return this.rootDescriptionNode; - } - public Iterator descriptionNodes() { - return new TreeIterator(this.rootDescriptionNode) { - @Override - public Iterator children(TestNode next) { - return next.children(); - } - }; - } - public Iterator> descriptionPaths() { - return new TransformationIterator>(this.descriptionNodes()) { - @Override - protected List transform(TestNode next) { - return next.getPath(); - } - }; - } - public TestNode addDescription(TestNode parent, String description) { - TestNode child = new TestNode(description); - parent.addChild(child); - this.fireNodeAdded(DESCRIPTIONS_TREE, child.getPath()); - return child; - } - public void removeDescriptionNode(TestNode descriptionNode) { - descriptionNode.getParent().removeChild(descriptionNode); - this.fireNodeRemoved(DESCRIPTIONS_TREE, descriptionNode.getPath()); - } - public boolean containsDescriptionNode(String name) { - for (Iterator stream = this.descriptionNodes(); stream.hasNext(); ) { - TestNode node = stream.next(); - if (node.getText().equals(name)) { - return true; - } - } - return false; - } - } - - class TestNode { - private final String text; - private TestNode parent; - private final Collection children; - - public TestNode(String text) { - this.text = text; - this.children = new HashBag(); - } - public String getText() { - return this.text; - } - public TestNode getParent() { - return this.parent; - } - private void setParent(TestNode parent) { - this.parent = parent; - } - public Iterator children() { - return new ReadOnlyIterator(this.children); - } - public void addChild(TestNode child) { - this.children.add(child); - child.setParent(this); - } - public void removeChild(TestNode child) { - this.children.remove(child); - } - public List getPath() { - return CollectionTools.reverseList(this.buildAntiPath()); - } - private Iterator buildAntiPath() { - return new ChainIterator(this) { - @Override - protected TestNode nextLink(TestNode currentLink) { - return currentLink.getParent(); - } - }; - } - @Override - public String toString() { - return "TestNode(" + this.text + ")"; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ValueCollectionAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ValueCollectionAdapterTests.java deleted file mode 100644 index 316c2c4812..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ValueCollectionAdapterTests.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.Collection; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.ValueCollectionAdapter; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class ValueCollectionAdapterTests extends TestCase { - private Junk junk; - private SimplePropertyValueModel junkHolder; - private ValueCollectionAdapter junkHolder2; - - - public ValueCollectionAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.junk = new Junk("foo"); - this.junkHolder = new SimplePropertyValueModel(this.junk); - this.junkHolder2 = new ValueCollectionAdapter(this.junkHolder, Junk.STUFF_COLLECTION); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testWrappedPVM() { - Junk junk2 = new Junk("bar"); - LocalListener l = new LocalListener(this.junkHolder2, this.junk, junk2); - this.junkHolder2.addChangeListener(l); - this.junkHolder.setValue(junk2); - assertTrue(l.eventReceived()); - } - - public void testHasPropertyChangeListeners() throws Exception { - assertFalse(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertFalse(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - LocalListener l = new LocalListener(this.junkHolder2, null, this.junk); - this.junkHolder2.addChangeListener(l); - assertTrue(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - this.junkHolder2.removeChangeListener(l); - assertFalse(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertFalse(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - } - - public void testHasStateChangeListeners() throws Exception { - assertFalse(this.junk.hasAnyCollectionChangeListeners(Junk.STUFF_COLLECTION)); - assertFalse(this.junkHolder2.hasAnyStateChangeListeners()); - - LocalListener l = new LocalListener(this.junkHolder2, null, this.junk); - this.junkHolder2.addStateChangeListener(l); - assertTrue(this.junk.hasAnyCollectionChangeListeners(Junk.STUFF_COLLECTION)); - assertTrue(this.junkHolder2.hasAnyStateChangeListeners()); - - this.junkHolder2.removeStateChangeListener(l); - assertFalse(this.junk.hasAnyCollectionChangeListeners(Junk.STUFF_COLLECTION)); - assertFalse(this.junkHolder2.hasAnyStateChangeListeners()); - } - - public void testCollectionAdd() { - LocalListener l = new LocalListener(this.junkHolder2); - this.junkHolder2.addStateChangeListener(l); - this.junk.addStuff("bar"); - assertTrue(l.eventReceived()); - } - - public void testCollectionRemove() { - LocalListener l = new LocalListener(this.junkHolder2); - this.junkHolder2.addStateChangeListener(l); - this.junk.removeStuff("foo"); - assertTrue(l.eventReceived()); - } - - - class LocalListener extends ChangeAdapter { - private boolean eventReceived = false; - private final Object source; - private final Object oldValue; - private final Object newValue; - LocalListener(Object source) { - this(source, null, null); - } - LocalListener(Object source, Object oldValue, Object newValue) { - super(); - this.source = source; - this.oldValue = oldValue; - this.newValue = newValue; - } - @Override - public void propertyChanged(PropertyChangeEvent e) { - this.eventReceived = true; - assertEquals(this.source, e.getSource()); - assertEquals(this.oldValue, e.getOldValue()); - assertEquals(this.newValue, e.getNewValue()); - assertEquals(PropertyValueModel.VALUE, e.getPropertyName()); - } - @Override - public void stateChanged(StateChangeEvent e) { - this.eventReceived = true; - assertEquals(this.source, e.getSource()); - } - boolean eventReceived() { - return this.eventReceived; - } - } - - - private class Junk extends AbstractModel { - private Collection stuff; - public static final String STUFF_COLLECTION = "stuff"; - - public Junk(String stuffItem) { - this.stuff = new ArrayList(); - this.stuff.add(stuffItem); - } - - public void addStuff(String stuffItem) { - this.addItemToCollection(stuffItem, this.stuff, STUFF_COLLECTION); - } - - public void removeStuff(String stuffItem) { - this.removeItemFromCollection(stuffItem, this.stuff, STUFF_COLLECTION); - } - - @Override - public String toString() { - return "Junk(" + this.stuff + ")"; - } - - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ValueListAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ValueListAdapterTests.java deleted file mode 100644 index 4a447a431c..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ValueListAdapterTests.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import java.util.ArrayList; -import java.util.List; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.ValueListAdapter; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class ValueListAdapterTests extends TestCase { - private Junk junk; - private SimplePropertyValueModel junkHolder; - private ValueListAdapter junkHolder2; - - - public ValueListAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.junk = new Junk("foo"); - this.junkHolder = new SimplePropertyValueModel(this.junk); - this.junkHolder2 = new ValueListAdapter(this.junkHolder, Junk.STUFF_LIST); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testWrappedPVM() { - Junk junk2 = new Junk("bar"); - LocalListener l = new LocalListener(this.junkHolder2, this.junk, junk2); - this.junkHolder2.addChangeListener(l); - this.junkHolder.setValue(junk2); - assertTrue(l.eventReceived()); - } - - public void testHasPropertyChangeListeners() throws Exception { - assertFalse(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertFalse(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - LocalListener l = new LocalListener(this.junkHolder2, null, this.junk); - this.junkHolder2.addChangeListener(l); - assertTrue(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - this.junkHolder2.removeChangeListener(l); - assertFalse(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertFalse(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - } - - public void testHasStateChangeListeners() throws Exception { - assertFalse(this.junk.hasAnyListChangeListeners(Junk.STUFF_LIST)); - assertFalse(this.junkHolder2.hasAnyStateChangeListeners()); - - LocalListener l = new LocalListener(this.junkHolder2, null, this.junk); - this.junkHolder2.addStateChangeListener(l); - assertTrue(this.junk.hasAnyListChangeListeners(Junk.STUFF_LIST)); - assertTrue(this.junkHolder2.hasAnyStateChangeListeners()); - - this.junkHolder2.removeStateChangeListener(l); - assertFalse(this.junk.hasAnyListChangeListeners(Junk.STUFF_LIST)); - assertFalse(this.junkHolder2.hasAnyStateChangeListeners()); - } - - public void testListAdd() { - LocalListener l = new LocalListener(this.junkHolder2, null, this.junk); - this.junkHolder2.addStateChangeListener(l); - this.junk.addStuff("bar"); - assertTrue(l.eventReceived()); - } - - public void testListRemove() { - LocalListener l = new LocalListener(this.junkHolder2, null, this.junk); - this.junkHolder2.addStateChangeListener(l); - this.junk.removeStuff("foo"); - assertTrue(l.eventReceived()); - } - - public void testListReplace() { - LocalListener l = new LocalListener(this.junkHolder2, null, this.junk); - this.junkHolder2.addStateChangeListener(l); - this.junk.replaceStuff("foo", "bar"); - assertTrue(l.eventReceived()); - } - - - class LocalListener extends ChangeAdapter { - private boolean eventReceived = false; - private final Object source; - private final Object oldValue; - private final Object newValue; - LocalListener(Object source) { - this(source, null, null); - } - LocalListener(Object source, Object oldValue, Object newValue) { - super(); - this.source = source; - this.oldValue = oldValue; - this.newValue = newValue; - } - @Override - public void propertyChanged(PropertyChangeEvent e) { - this.eventReceived = true; - assertEquals(this.source, e.getSource()); - assertEquals(this.oldValue, e.getOldValue()); - assertEquals(this.newValue, e.getNewValue()); - assertEquals(PropertyValueModel.VALUE, e.getPropertyName()); - } - @Override - public void stateChanged(StateChangeEvent e) { - this.eventReceived = true; - assertEquals(this.source, e.getSource()); - } - boolean eventReceived() { - return this.eventReceived; - } - } - - private class Junk extends AbstractModel { - private List stuff; - public static final String STUFF_LIST = "stuff"; - - public Junk(String stuffItem) { - this.stuff = new ArrayList(); - this.stuff.add(stuffItem); - } - - public void addStuff(String stuffItem) { - this.addItemToList(stuffItem, this.stuff, STUFF_LIST); - } - - public void removeStuff(String stuffItem) { - this.removeItemFromList(stuffItem, this.stuff, STUFF_LIST); - } - - public void replaceStuff(String oldStuffItem, String newStuffItem) { - this.replaceItemInList(oldStuffItem, newStuffItem, this.stuff, STUFF_LIST); - } - - @Override - public String toString() { - return "Junk(" + this.stuff + ")"; - } - - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ValuePropertyAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ValuePropertyAdapterTests.java deleted file mode 100644 index c3f5be6675..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ValuePropertyAdapterTests.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.ValuePropertyAdapter; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class ValuePropertyAdapterTests extends TestCase { - private Junk junk; - private SimplePropertyValueModel junkHolder; - private ValuePropertyAdapter junkHolder2; - - - public ValuePropertyAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.junk = new Junk("foo"); - this.junkHolder = new SimplePropertyValueModel(this.junk); - this.junkHolder2 = new ValuePropertyAdapter(this.junkHolder, Junk.NAME_PROPERTY); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testWrappedPVM() { - Junk junk2 = new Junk("bar"); - LocalListener l = new LocalListener(this.junkHolder2, this.junk, junk2); - this.junkHolder2.addChangeListener(l); - this.junkHolder.setValue(junk2); - assertTrue(l.eventReceived()); - } - - public void testHasPropertyChangeListeners() throws Exception { - assertFalse(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertFalse(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - LocalListener l = new LocalListener(this.junkHolder2, null, this.junk); - this.junkHolder2.addChangeListener(l); - assertTrue(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - this.junkHolder2.removeChangeListener(l); - assertFalse(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertFalse(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - } - - public void testHasStateChangeListeners() throws Exception { - assertFalse(this.junk.hasAnyPropertyChangeListeners(Junk.NAME_PROPERTY)); - assertFalse(this.junkHolder2.hasAnyStateChangeListeners()); - - LocalListener l = new LocalListener(this.junkHolder2, null, this.junk); - this.junkHolder2.addStateChangeListener(l); - assertTrue(this.junk.hasAnyPropertyChangeListeners(Junk.NAME_PROPERTY)); - assertTrue(this.junkHolder2.hasAnyStateChangeListeners()); - - this.junkHolder2.removeStateChangeListener(l); - assertFalse(this.junk.hasAnyPropertyChangeListeners(Junk.NAME_PROPERTY)); - assertFalse(this.junkHolder2.hasAnyStateChangeListeners()); - } - - public void testChangeProperty() { - LocalListener l = new LocalListener(this.junkHolder2, null, this.junk); - this.junkHolder2.addStateChangeListener(l); - this.junk.setName("bar"); - assertTrue(l.eventReceived()); - } - - - class LocalListener extends ChangeAdapter { - private boolean eventReceived = false; - private final Object source; - private final Object oldValue; - private final Object newValue; - LocalListener(Object source) { - this(source, null, null); - } - LocalListener(Object source, Object oldValue, Object newValue) { - super(); - this.source = source; - this.oldValue = oldValue; - this.newValue = newValue; - } - @Override - public void propertyChanged(PropertyChangeEvent e) { - this.eventReceived = true; - assertEquals(this.source, e.getSource()); - assertEquals(this.oldValue, e.getOldValue()); - assertEquals(this.newValue, e.getNewValue()); - assertEquals(PropertyValueModel.VALUE, e.getPropertyName()); - } - @Override - public void stateChanged(StateChangeEvent e) { - this.eventReceived = true; - assertEquals(this.source, e.getSource()); - } - boolean eventReceived() { - return this.eventReceived; - } - } - - class Junk extends AbstractModel { - private String name; - public static final String NAME_PROPERTY = "name"; - - public Junk(String name) { - this.name = name; - } - - public void setName(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - @Override - public String toString() { - return "Junk(" + this.name + ")"; - } - - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ValueStateAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ValueStateAdapterTests.java deleted file mode 100644 index d23581257a..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/ValueStateAdapterTests.java +++ /dev/null @@ -1,145 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.ValueStateAdapter; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class ValueStateAdapterTests extends TestCase { - private Junk junk; - private SimplePropertyValueModel junkHolder; - private ValueStateAdapter junkHolder2; - - - public ValueStateAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.junk = new Junk("foo"); - this.junkHolder = new SimplePropertyValueModel(this.junk); - this.junkHolder2 = new ValueStateAdapter(this.junkHolder); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testWrappedPVM() { - Junk junk2 = new Junk("bar"); - LocalListener l = new LocalListener(this.junkHolder2, this.junk, junk2); - this.junkHolder2.addChangeListener(l); - this.junkHolder.setValue(junk2); - assertTrue(l.eventReceived()); - } - - public void testHasPropertyChangeListeners() throws Exception { - assertFalse(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertFalse(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - LocalListener l = new LocalListener(this.junkHolder2, null, this.junk); - this.junkHolder2.addChangeListener(l); - assertTrue(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - this.junkHolder2.removeChangeListener(l); - assertFalse(this.junkHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertFalse(this.junkHolder2.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - } - - public void testHasStateChangeListeners() throws Exception { - assertFalse(this.junk.hasAnyStateChangeListeners()); - assertFalse(this.junkHolder2.hasAnyStateChangeListeners()); - - LocalListener l = new LocalListener(this.junkHolder2, null, this.junk); - this.junkHolder2.addStateChangeListener(l); - assertTrue(this.junk.hasAnyStateChangeListeners()); - assertTrue(this.junkHolder2.hasAnyStateChangeListeners()); - - this.junkHolder2.removeStateChangeListener(l); - assertFalse(this.junk.hasAnyStateChangeListeners()); - assertFalse(this.junkHolder2.hasAnyStateChangeListeners()); - } - - public void testChangeState() { - LocalListener l = new LocalListener(this.junkHolder2, null, this.junk); - this.junkHolder2.addChangeListener(l); - this.junkHolder2.addStateChangeListener(l); - this.junk.setName("bar"); - assertTrue(l.eventReceived()); - } - - - class LocalListener extends ChangeAdapter { - private boolean eventReceived = false; - private final Object source; - private final Object oldValue; - private final Object newValue; - LocalListener(Object source) { - this(source, null, null); - } - LocalListener(Object source, Object oldValue, Object newValue) { - super(); - this.source = source; - this.oldValue = oldValue; - this.newValue = newValue; - } - @Override - public void propertyChanged(PropertyChangeEvent e) { - this.eventReceived = true; - assertEquals(this.source, e.getSource()); - assertEquals(this.oldValue, e.getOldValue()); - assertEquals(this.newValue, e.getNewValue()); - assertEquals(PropertyValueModel.VALUE, e.getPropertyName()); - } - @Override - public void stateChanged(StateChangeEvent e) { - this.eventReceived = true; - assertEquals(this.source, e.getSource()); - } - boolean eventReceived() { - return this.eventReceived; - } - } - - class Junk extends AbstractModel { - private String name; - public static final String NAME_PROPERTY = "name"; - - public Junk(String name) { - this.name = name; - } - - public void setName(String name) { - this.name = name; - this.fireStateChanged(); - } - - @Override - public String toString() { - return "Junk(" + this.name + ")"; - } - - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/prefs/JptUtilityModelValuePrefsTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/prefs/JptUtilityModelValuePrefsTests.java deleted file mode 100644 index ad966a9607..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/prefs/JptUtilityModelValuePrefsTests.java +++ /dev/null @@ -1,31 +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.common.utility.tests.internal.model.value.prefs; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class JptUtilityModelValuePrefsTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptUtilityModelValuePrefsTests.class.getPackage().getName()); - - suite.addTestSuite(PreferencesCollectionValueModelTests.class); - suite.addTestSuite(PreferencePropertyValueModelTests.class); - - return suite; - } - - private JptUtilityModelValuePrefsTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/prefs/PreferencePropertyValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/prefs/PreferencePropertyValueModelTests.java deleted file mode 100644 index 35ea6e729f..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/prefs/PreferencePropertyValueModelTests.java +++ /dev/null @@ -1,398 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.prefs; - -import java.util.prefs.NodeChangeEvent; -import java.util.prefs.NodeChangeListener; -import java.util.prefs.PreferenceChangeEvent; -import java.util.prefs.PreferenceChangeListener; -import java.util.prefs.Preferences; - -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.prefs.PreferencePropertyValueModel; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -@SuppressWarnings("nls") -public class PreferencePropertyValueModelTests extends PreferencesTestCase { - private WritablePropertyValueModel nodeHolder; - PreferencePropertyValueModel preferenceAdapter; - PropertyChangeEvent event; - PropertyChangeListener listener; - boolean listenerRemoved = false; - PreferenceChangeEvent preferenceEvent; - private static final String KEY_NAME = "foo"; - private static final String STRING_VALUE = "original string value"; - - public PreferencePropertyValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.testNode.put(KEY_NAME, STRING_VALUE); - - this.nodeHolder = new SimplePropertyValueModel(this.testNode); - this.preferenceAdapter = new PreferencePropertyValueModel(this.nodeHolder, KEY_NAME); - this.listener = this.buildValueChangeListener(); - this.preferenceAdapter.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener); - this.event = null; - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - } - - private PropertyChangeListener buildValueChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - if (PreferencePropertyValueModelTests.this.event != null) { - throw new IllegalStateException("unexpected this.event: " + e); - } - PreferencePropertyValueModelTests.this.event = e; - } - }; - } - - public void testSubjectHolder() throws Exception { - assertEquals(STRING_VALUE, this.preferenceAdapter.getValue()); - assertNull(this.event); - - String ANOTHER_STRING_VALUE = "some other value"; - Preferences anotherNode = this.classNode.node("another test node"); - anotherNode.put(KEY_NAME, ANOTHER_STRING_VALUE); - - this.nodeHolder.setValue(anotherNode); - this.verifyEvent(STRING_VALUE, ANOTHER_STRING_VALUE); - assertEquals(ANOTHER_STRING_VALUE, this.preferenceAdapter.getValue()); - - this.event = null; - this.nodeHolder.setValue(null); - this.verifyEvent(ANOTHER_STRING_VALUE, null); - assertNull(this.preferenceAdapter.getValue()); - - this.event = null; - this.nodeHolder.setValue(this.testNode); - this.verifyEvent(null, STRING_VALUE); - assertEquals(STRING_VALUE, this.preferenceAdapter.getValue()); - } - - public void testPreferenceChange() throws Exception { - assertEquals(STRING_VALUE, this.preferenceAdapter.getValue()); - assertNull(this.event); - - this.testNode.put(KEY_NAME, STRING_VALUE + STRING_VALUE); - this.waitForEventQueueToClear(); - this.verifyEvent(STRING_VALUE, STRING_VALUE + STRING_VALUE); - assertEquals(STRING_VALUE + STRING_VALUE, this.preferenceAdapter.getValue()); - - this.event = null; - this.testNode.remove(KEY_NAME); - this.waitForEventQueueToClear(); - this.verifyEvent(STRING_VALUE + STRING_VALUE, null); - assertNull(this.preferenceAdapter.getValue()); - - this.event = null; - this.testNode.put(KEY_NAME, STRING_VALUE); - this.waitForEventQueueToClear(); - this.verifyEvent(null, STRING_VALUE); - assertEquals(STRING_VALUE, this.preferenceAdapter.getValue()); - } - - public void testValue() throws Exception { - assertEquals(STRING_VALUE, this.testNode.get(KEY_NAME, "")); - assertEquals(STRING_VALUE, this.preferenceAdapter.getValue()); - } - - public void testSetValue() throws Exception { - String ANOTHER_STRING_VALUE = "some other value"; - this.preferenceAdapter.setValue(ANOTHER_STRING_VALUE); - assertEquals(ANOTHER_STRING_VALUE, this.preferenceAdapter.getValue()); - assertEquals(ANOTHER_STRING_VALUE, this.testNode.get(KEY_NAME, "")); - } - - public void testHasListeners() throws Exception { - assertTrue(this.preferenceAdapter.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(this.nodeHasAnyPrefListeners(this.testNode)); - this.preferenceAdapter.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener); - assertFalse(this.nodeHasAnyPrefListeners(this.testNode)); - assertFalse(this.preferenceAdapter.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - ChangeListener listener2 = this.buildChangeListener(); - this.preferenceAdapter.addChangeListener(listener2); - assertTrue(this.preferenceAdapter.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - assertTrue(this.nodeHasAnyPrefListeners(this.testNode)); - this.preferenceAdapter.removeChangeListener(listener2); - assertFalse(this.nodeHasAnyPrefListeners(this.testNode)); - assertFalse(this.preferenceAdapter.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - } - - private ChangeListener buildChangeListener() { - return new ChangeAdapter() { - @Override - public void propertyChanged(PropertyChangeEvent e) { - if (PreferencePropertyValueModelTests.this.event != null) { - throw new IllegalStateException("unexpected this.event: " + e); - } - PreferencePropertyValueModelTests.this.event = e; - } - }; - } - - public void testRemoveAndReAddPreference() throws Exception { - assertEquals(STRING_VALUE, this.testNode.get(KEY_NAME, null)); - assertEquals(STRING_VALUE, this.preferenceAdapter.getValue()); - assertNull(this.event); - - // remove the preference entirely... - this.testNode.remove(KEY_NAME); - this.waitForEventQueueToClear(); - assertNull(this.testNode.get(KEY_NAME, null)); - this.verifyEvent(STRING_VALUE, null); - assertNull(this.preferenceAdapter.getValue()); - - // ...then re-add it with the same key - this.event = null; - this.testNode.put(KEY_NAME, STRING_VALUE); - this.waitForEventQueueToClear(); - assertEquals(STRING_VALUE, this.testNode.get(KEY_NAME, null)); - this.verifyEvent(null, STRING_VALUE); - assertEquals(STRING_VALUE, this.preferenceAdapter.getValue()); - } - - public void testDefaultValue() throws Exception { - // rebuild the adapter with a default value - String DEFAULT_VALUE = "default value"; - this.preferenceAdapter.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener); - this.preferenceAdapter = new PreferencePropertyValueModel(this.nodeHolder, KEY_NAME, DEFAULT_VALUE); - this.preferenceAdapter.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener); - - assertEquals(STRING_VALUE, this.testNode.get(KEY_NAME, null)); - assertEquals(STRING_VALUE, this.preferenceAdapter.getValue()); - assertNull(this.event); - - // remove the preference entirely... - this.testNode.remove(KEY_NAME); - this.waitForEventQueueToClear(); - assertNull(this.testNode.get(KEY_NAME, null)); - this.verifyEvent(STRING_VALUE, DEFAULT_VALUE); - assertEquals(DEFAULT_VALUE, this.preferenceAdapter.getValue()); - - // ...then re-add it with the same key - this.event = null; - this.testNode.put(KEY_NAME, STRING_VALUE); - this.waitForEventQueueToClear(); - assertEquals(STRING_VALUE, this.testNode.get(KEY_NAME, null)); - this.verifyEvent(DEFAULT_VALUE, STRING_VALUE); - assertEquals(STRING_VALUE, this.preferenceAdapter.getValue()); - } - - public void testUnsynchronizedValue() throws Exception { - assertEquals(STRING_VALUE, this.preferenceAdapter.getValue()); - assertNull(this.event); - - // remove the this.listener so the adapter no longer listens to the preference - this.preferenceAdapter.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener); - - this.testNode.put(KEY_NAME, STRING_VALUE + STRING_VALUE); - this.waitForEventQueueToClear(); - // no this.event should have been fired... - assertNull(this.event); - // ...and the adapter's value should be null - assertNull(this.preferenceAdapter.getValue()); - - this.testNode.remove(KEY_NAME); - this.waitForEventQueueToClear(); - assertNull(this.event); - assertNull(this.preferenceAdapter.getValue()); - - this.testNode.put(KEY_NAME, STRING_VALUE); - this.waitForEventQueueToClear(); - assertNull(this.event); - assertNull(this.preferenceAdapter.getValue()); - - // add the this.listener so the adapter synchs - this.preferenceAdapter.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener); - assertEquals(STRING_VALUE, this.preferenceAdapter.getValue()); - } - - public void testIntegerPreference() throws Exception { - // stop listening to the node and convert it to an integer - this.preferenceAdapter.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener); - - PreferencePropertyValueModel integerPreferenceAdapter = new PreferencePropertyValueModel(this.nodeHolder, KEY_NAME); - this.testNode.putInt(KEY_NAME, 123); - integerPreferenceAdapter = PreferencePropertyValueModel.forInteger(this.testNode, KEY_NAME, 0); - integerPreferenceAdapter.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener); - assertEquals(new Integer(123), integerPreferenceAdapter.getValue()); - assertNull(this.event); - - this.testNode.putInt(KEY_NAME, 246); - this.waitForEventQueueToClear(); - this.verifyEvent(integerPreferenceAdapter, new Integer(123), new Integer(246)); - assertEquals(new Integer(246), integerPreferenceAdapter.getValue()); - - this.event = null; - this.testNode.remove(KEY_NAME); - this.waitForEventQueueToClear(); - this.verifyEvent(integerPreferenceAdapter, new Integer(246), new Integer(0)); - assertEquals(new Integer(0), integerPreferenceAdapter.getValue()); - - this.event = null; - this.testNode.putInt(KEY_NAME, 123); - this.waitForEventQueueToClear(); - this.verifyEvent(integerPreferenceAdapter, new Integer(0), new Integer(123)); - assertEquals(new Integer(123), integerPreferenceAdapter.getValue()); - } - - /** - * test a situation where - * - we are listening to the node when it gets removed from the preferences "repository" - * - we get notification that it has been removed - * - we try to remove our this.listener - * - the node will throw an IllegalStateException - the adapter should handle it OK... - */ - public void testRemoveNode() throws Exception { - assertTrue(this.preferenceAdapter.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - Preferences parent = this.testNode.parent(); - parent.addNodeChangeListener(this.buildParentNodeChangeListener()); - this.testNode.removeNode(); - this.testNode.flush(); // this seems to be required for the this.event to trigger... - this.waitForEventQueueToClear(); - - assertTrue(this.listenerRemoved); - assertTrue(this.preferenceAdapter.hasNoPropertyChangeListeners(PropertyValueModel.VALUE)); - } - - private NodeChangeListener buildParentNodeChangeListener() { - return new NodeChangeListener() { - public void childAdded(NodeChangeEvent e) { - throw new IllegalStateException("unexpected this.event: " + e); - } - public void childRemoved(NodeChangeEvent e) { - if (e.getChild() == PreferencePropertyValueModelTests.this.testNode) { - PreferencePropertyValueModelTests.this.preferenceAdapter.removePropertyChangeListener(PropertyValueModel.VALUE, PreferencePropertyValueModelTests.this.listener); - // this line of code will not execute if the line above triggers an exception - PreferencePropertyValueModelTests.this.listenerRemoved = true; - } - } - }; - } - - public void testSetSameValue() { - assertNull(this.event); - assertNull(this.preferenceEvent); - this.testNode.addPreferenceChangeListener(this.buildPreferenceChangeListener()); - - String ANOTHER_STRING_VALUE = "some other value"; - this.preferenceAdapter.setValue(ANOTHER_STRING_VALUE); - - this.verifyEvent(STRING_VALUE, ANOTHER_STRING_VALUE); - this.waitForEventQueueToClear(); - this.verifyPreferenceEvent(ANOTHER_STRING_VALUE); - - // now set to *same* value - nothing should happen... - this.event = null; - this.preferenceEvent = null; - this.preferenceAdapter.setValue(ANOTHER_STRING_VALUE); - - assertNull(this.event); - assertNull(this.preferenceEvent); - } - - public void testSetSameValueForcePassThrough() throws Exception { - assertNull(this.event); - assertNull(this.preferenceEvent); - - this.preferenceAdapter.removePropertyChangeListener(PropertyValueModel.VALUE, this.listener); - this.preferenceAdapter = new AlwaysUpdatePreferencePropertyValueModel(this.nodeHolder, KEY_NAME); - this.preferenceAdapter.addPropertyChangeListener(PropertyValueModel.VALUE, this.listener); - - this.testNode.addPreferenceChangeListener(this.buildPreferenceChangeListener()); - - String ANOTHER_STRING_VALUE = "some other value"; - this.preferenceAdapter.setValue(ANOTHER_STRING_VALUE); - - this.verifyEvent(STRING_VALUE, ANOTHER_STRING_VALUE); - this.waitForEventQueueToClear(); - this.verifyPreferenceEvent(ANOTHER_STRING_VALUE); - - // now set to *same* value - only one this.event should fire - this.event = null; - this.preferenceEvent = null; - this.preferenceAdapter.setValue(ANOTHER_STRING_VALUE); - - assertNull(this.event); - this.waitForEventQueueToClear(); - this.verifyPreferenceEvent(ANOTHER_STRING_VALUE); - assertNull(this.event); - } - - private PreferenceChangeListener buildPreferenceChangeListener() { - return new PreferenceChangeListener() { - public void preferenceChange(PreferenceChangeEvent evt) { - PreferencePropertyValueModelTests.this.preferenceEvent = evt; - } - }; - } - - private void verifyEvent(Model source, Object oldValue, Object newValue) { - assertNotNull(this.event); - assertEquals(source, this.event.getSource()); - assertEquals(PropertyValueModel.VALUE, this.event.getPropertyName()); - assertEquals(oldValue, this.event.getOldValue()); - assertEquals(newValue, this.event.getNewValue()); - } - - private void verifyEvent(Object oldValue, Object newValue) { - this.verifyEvent(this.preferenceAdapter, oldValue, newValue); - } - - private void verifyPreferenceEvent(Object newValue) { - assertNotNull(this.preferenceEvent); - assertEquals(this.testNode, this.preferenceEvent.getSource()); - assertEquals(KEY_NAME, this.preferenceEvent.getKey()); - assertEquals(newValue, this.preferenceEvent.getNewValue()); - assertEquals(newValue, this.testNode.get(KEY_NAME, "")); - } - - private boolean nodeHasAnyPrefListeners(Preferences node) throws Exception { - PreferenceChangeListener[] prefListeners = (PreferenceChangeListener[]) ReflectionTools.getFieldValue(node, "prefListeners"); - return prefListeners.length > 0; - } - - - /** - * Use this adapter to test out always passing through the new value - * to the preference. - */ - private class AlwaysUpdatePreferencePropertyValueModel

extends PreferencePropertyValueModel

{ - - AlwaysUpdatePreferencePropertyValueModel(PropertyValueModel preferencesHolder, String key) { - super(preferencesHolder, key); - } - - @Override - protected boolean preferenceIsToBeSet(Object oldValue, Object newValue) { - return true; - } - - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/prefs/PreferencesCollectionValueModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/prefs/PreferencesCollectionValueModelTests.java deleted file mode 100644 index ed7e6ff7d8..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/prefs/PreferencesCollectionValueModelTests.java +++ /dev/null @@ -1,312 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.prefs; - -import java.util.HashMap; -import java.util.Map; -import java.util.prefs.NodeChangeEvent; -import java.util.prefs.NodeChangeListener; -import java.util.prefs.PreferenceChangeListener; -import java.util.prefs.Preferences; - -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.prefs.PreferencePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.prefs.PreferencesCollectionValueModel; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.ChangeListener; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -@SuppressWarnings("nls") -public class PreferencesCollectionValueModelTests extends PreferencesTestCase { - private Map expectedValues; - private WritablePropertyValueModel nodeHolder; - PreferencesCollectionValueModel preferencesAdapter; - CollectionEvent event; - CollectionChangeListener listener; - private PropertyChangeListener itemListener; - boolean listenerRemoved = false; - private static final String KEY_NAME_1 = "foo 1"; - private static final String KEY_NAME_2 = "foo 2"; - private static final String KEY_NAME_3 = "foo 3"; - private static final String STRING_VALUE_1 = "original string value 1"; - private static final String STRING_VALUE_2 = "original string value 2"; - private static final String STRING_VALUE_3 = "original string value 3"; - - public PreferencesCollectionValueModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.expectedValues = new HashMap(); - this.testNode.put(KEY_NAME_1, STRING_VALUE_1); this.expectedValues.put(KEY_NAME_1, STRING_VALUE_1); - this.testNode.put(KEY_NAME_2, STRING_VALUE_2); this.expectedValues.put(KEY_NAME_2, STRING_VALUE_2); - this.testNode.put(KEY_NAME_3, STRING_VALUE_3); this.expectedValues.put(KEY_NAME_3, STRING_VALUE_3); - - this.nodeHolder = new SimplePropertyValueModel(this.testNode); - this.preferencesAdapter = new PreferencesCollectionValueModel(this.nodeHolder); - this.listener = this.buildCollectionChangeListener(); - this.itemListener = this.buildItemListener(); - this.preferencesAdapter.addCollectionChangeListener(CollectionValueModel.VALUES, this.listener); - this.event = null; - } - - private CollectionChangeListener buildCollectionChangeListener() { - return new CollectionChangeListener() { - public void collectionChanged(CollectionChangeEvent e) { - this.logEvent(e); - } - public void collectionCleared(CollectionClearEvent e) { - this.logEvent(e); - } - public void itemsAdded(CollectionAddEvent e) { - this.logEvent(e); - } - public void itemsRemoved(CollectionRemoveEvent e) { - this.logEvent(e); - } - private void logEvent(CollectionEvent e) { - if (PreferencesCollectionValueModelTests.this.event != null) { - throw new IllegalStateException("unexpected this.event: " + e); - } - PreferencesCollectionValueModelTests.this.event = e; - } - }; - } - - private PropertyChangeListener buildItemListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - throw new IllegalStateException("unexpected this.event: " + e); - } - }; - } - - public void testSubjectHolder() throws Exception { - this.verifyAdapter(this.preferencesAdapter); - assertNull(this.event); - - String ANOTHER_KEY_NAME_1 = "another key 1"; - String ANOTHER_KEY_NAME_2 = "another key 2"; - String ANOTHER_KEY_NAME_3 = "another key 3"; - String ANOTHER_STRING_VALUE_1 = "another string value 1"; - String ANOTHER_STRING_VALUE_2 = "another string value 2"; - String ANOTHER_STRING_VALUE_3 = "another string value 3"; - Preferences anotherNode = this.classNode.node("another test node"); - this.expectedValues.clear(); - anotherNode.put(ANOTHER_KEY_NAME_1, ANOTHER_STRING_VALUE_1); this.expectedValues.put(ANOTHER_KEY_NAME_1, ANOTHER_STRING_VALUE_1); - anotherNode.put(ANOTHER_KEY_NAME_2, ANOTHER_STRING_VALUE_2); this.expectedValues.put(ANOTHER_KEY_NAME_2, ANOTHER_STRING_VALUE_2); - anotherNode.put(ANOTHER_KEY_NAME_3, ANOTHER_STRING_VALUE_3); this.expectedValues.put(ANOTHER_KEY_NAME_3, ANOTHER_STRING_VALUE_3); - - this.nodeHolder.setValue(anotherNode); - // collectionChanged does not pass any items in the this.event - this.verifyEvent(); - this.verifyAdapter(this.preferencesAdapter); - - this.event = null; - this.expectedValues.clear(); - this.nodeHolder.setValue(null); - this.verifyEvent(); - assertFalse(this.preferencesAdapter.iterator().hasNext()); - - this.event = null; - this.nodeHolder.setValue(this.testNode); - this.verifyEvent(); - this.expectedValues.clear(); - this.expectedValues.put(KEY_NAME_1, STRING_VALUE_1); - this.expectedValues.put(KEY_NAME_2, STRING_VALUE_2); - this.expectedValues.put(KEY_NAME_3, STRING_VALUE_3); - this.verifyAdapter(this.preferencesAdapter); - } - - public void testAddPreference() throws Exception { - this.verifyAdapter(this.preferencesAdapter); - assertNull(this.event); - - String ANOTHER_KEY_NAME = "another key"; - String ANOTHER_STRING_VALUE = "another string value"; - this.testNode.put(ANOTHER_KEY_NAME, ANOTHER_STRING_VALUE); - this.waitForEventQueueToClear(); - Map expectedItems = new HashMap(); - expectedItems.put(ANOTHER_KEY_NAME, ANOTHER_STRING_VALUE); - this.verifyEvent(expectedItems); - this.expectedValues.put(ANOTHER_KEY_NAME, ANOTHER_STRING_VALUE); - this.verifyAdapter(this.preferencesAdapter); - } - - public void testRemovePreference() throws Exception { - this.verifyAdapter(this.preferencesAdapter); - assertNull(this.event); - - this.testNode.remove(KEY_NAME_2); - this.waitForEventQueueToClear(); - - assertNotNull(this.event); - assertEquals(this.preferencesAdapter, this.event.getSource()); - assertEquals(CollectionValueModel.VALUES, this.event.getCollectionName()); - assertEquals(1, ((CollectionRemoveEvent) this.event).getItemsSize()); - @SuppressWarnings("unchecked") - String key = ((PreferencePropertyValueModel) ((CollectionRemoveEvent) this.event).getItems().iterator().next()).getKey(); - assertEquals(KEY_NAME_2, key); - - this.expectedValues.remove(KEY_NAME_2); - this.verifyAdapter(this.preferencesAdapter); - } - - public void testChangePreference() throws Exception { - this.verifyAdapter(this.preferencesAdapter); - assertNull(this.event); - - String DIFFERENT = "something completely different"; - this.testNode.put(KEY_NAME_2, DIFFERENT); - this.waitForEventQueueToClear(); - - assertNull(this.event); - - this.expectedValues.put(KEY_NAME_2, DIFFERENT); - this.verifyAdapter(this.preferencesAdapter); - } - - public void testValues() throws Exception { - this.verifyNode(this.testNode); - this.verifyAdapter(this.preferencesAdapter); - } - - /** - * test a situation where - * - we are listening to the node when it gets removed from the preferences "repository" - * - we get notification that it has been removed - * - we try to remove our this.listener - * - the node will throw an IllegalStateException - the adapter should handle it OK... - */ - public void testRemoveNode() throws Exception { - assertTrue(this.preferencesAdapter.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - - Preferences parent = this.testNode.parent(); - parent.addNodeChangeListener(this.buildParentNodeChangeListener()); - this.testNode.removeNode(); - this.testNode.flush(); // this seems to be required for the this.event to trigger... - this.waitForEventQueueToClear(); - - assertTrue(this.listenerRemoved); - assertFalse(this.preferencesAdapter.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - } - - private NodeChangeListener buildParentNodeChangeListener() { - return new NodeChangeListener() { - public void childAdded(NodeChangeEvent e) { - throw new IllegalStateException("unexpected this.event: " + e); - } - public void childRemoved(NodeChangeEvent e) { - if (e.getChild() == PreferencesCollectionValueModelTests.this.testNode) { - PreferencesCollectionValueModelTests.this.preferencesAdapter.removeCollectionChangeListener(CollectionValueModel.VALUES, PreferencesCollectionValueModelTests.this.listener); - // this line of code will not execute if the line above triggers an exception - PreferencesCollectionValueModelTests.this.listenerRemoved = true; - } - } - }; - } - - public void testHasListeners() throws Exception { - assertTrue(this.preferencesAdapter.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - assertTrue(this.nodeHasAnyPrefListeners(this.testNode)); - this.preferencesAdapter.removeCollectionChangeListener(CollectionValueModel.VALUES, this.listener); - assertFalse(this.nodeHasAnyPrefListeners(this.testNode)); - assertFalse(this.preferencesAdapter.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - - ChangeListener listener2 = this.buildChangeListener(); - this.preferencesAdapter.addChangeListener(listener2); - assertTrue(this.preferencesAdapter.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - assertTrue(this.nodeHasAnyPrefListeners(this.testNode)); - this.preferencesAdapter.removeChangeListener(listener2); - assertFalse(this.nodeHasAnyPrefListeners(this.testNode)); - assertFalse(this.preferencesAdapter.hasAnyCollectionChangeListeners(CollectionValueModel.VALUES)); - } - - private ChangeListener buildChangeListener() { - return new ChangeAdapter() { - @Override - public void collectionChanged(CollectionChangeEvent e) { - this.logEvent(e); - } - @Override - public void collectionCleared(CollectionClearEvent e) { - this.logEvent(e); - } - @Override - public void itemsAdded(CollectionAddEvent e) { - this.logEvent(e); - } - @Override - public void itemsRemoved(CollectionRemoveEvent e) { - this.logEvent(e); - } - private void logEvent(CollectionEvent e) { - if (PreferencesCollectionValueModelTests.this.event != null) { - throw new IllegalStateException("unexpected this.event: " + e); - } - PreferencesCollectionValueModelTests.this.event = e; - } - }; - } - - private void verifyEvent(Map items) { - this.verifyEvent(); - assertEquals(items.size(), ((CollectionAddEvent) this.event).getItemsSize()); - @SuppressWarnings("unchecked") - Iterable> eventItems = (Iterable>) ((CollectionAddEvent) this.event).getItems(); - this.verifyItems(items, eventItems); - } - - private void verifyEvent() { - assertNotNull(this.event); - assertEquals(this.preferencesAdapter, this.event.getSource()); - assertEquals(CollectionValueModel.VALUES, this.event.getCollectionName()); - } - - private void verifyNode(Preferences node) throws Exception { - String[] keys = node.keys(); - assertEquals(this.expectedValues.size(), keys.length); - for (int i = 0; i < keys.length; i++) { - assertEquals(this.expectedValues.get(keys[i]), node.get(keys[i], "")); - } - } - - private void verifyAdapter(PreferencesCollectionValueModel cvm) { - assertEquals(this.expectedValues.size(), cvm.size()); - this.verifyItems(this.expectedValues, cvm); - } - - private void verifyItems(Map expected, Iterable> actual) { - for (PreferencePropertyValueModel model : actual) { - model.addPropertyChangeListener(PropertyValueModel.VALUE, this.itemListener); - assertEquals(expected.get(model.getKey()), model.getValue()); - model.removePropertyChangeListener(PropertyValueModel.VALUE, this.itemListener); - } - } - - private boolean nodeHasAnyPrefListeners(Preferences node) throws Exception { - PreferenceChangeListener[] prefListeners = (PreferenceChangeListener[]) ReflectionTools.getFieldValue(node, "prefListeners"); - return prefListeners.length > 0; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/prefs/PreferencesTestCase.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/prefs/PreferencesTestCase.java deleted file mode 100644 index 3ae2c74db7..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/prefs/PreferencesTestCase.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.prefs; - -import java.util.EventObject; -import java.util.List; -import java.util.prefs.AbstractPreferences; -import java.util.prefs.Preferences; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -/** - * set up and tear down a test node for any subclass that - * needs to test preferences-related stuff - */ -@SuppressWarnings("nls") -public abstract class PreferencesTestCase extends TestCase { - protected Preferences classNode; - public Preferences testNode; - protected static final String TEST_NODE_NAME = "test node"; - - public PreferencesTestCase(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - Preferences packageNode = Preferences.userNodeForPackage(this.getClass()); - this.classNode = packageNode.node(this.getClass().getSimpleName()); - // clean out any leftover crap... - if ((this.classNode.keys().length > 0) || (this.classNode.childrenNames().length > 0)) { - this.classNode.removeNode(); - // ...and re-create the node - this.classNode = packageNode.node(this.getClass().getSimpleName()); - } - this.testNode = this.classNode.node(TEST_NODE_NAME); - } - - @Override - protected void tearDown() throws Exception { - // wait for all the events to be delivered before tearing down - this.waitForEventQueueToClear(); - Preferences node = this.classNode.parent(); - this.classNode.removeNode(); - while (this.nodeIsVestigial(node)) { - Preferences parent = node.parent(); - node.removeNode(); - node = parent; - } - TestTools.clear(this); - super.tearDown(); - } - - private boolean nodeIsVestigial(Preferences node) throws Exception { - return (node != null) - && (node.keys().length == 0) - && (node.childrenNames().length == 0) - && (node != Preferences.userRoot()); - } - - protected void waitForEventQueueToClear() { - while ( ! this.preferencesEventQueue().isEmpty()) { - TestTools.sleep(100); - } - TestTools.sleep(100); - } - - @SuppressWarnings("unchecked") - private List preferencesEventQueue() { - return (List) ReflectionTools.getStaticFieldValue(AbstractPreferences.class, "eventQueue"); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/CheckBoxModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/CheckBoxModelAdapterTests.java deleted file mode 100644 index 47a7c8e320..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/CheckBoxModelAdapterTests.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import javax.swing.ButtonModel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.event.EventListenerList; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.CheckBoxModelAdapter; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class CheckBoxModelAdapterTests extends TestCase { - private WritablePropertyValueModel booleanHolder; - private ButtonModel buttonModelAdapter; - boolean eventFired; - - public CheckBoxModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.booleanHolder = new SimplePropertyValueModel(Boolean.TRUE); - this.buttonModelAdapter = new CheckBoxModelAdapter(this.booleanHolder) { - @Override - protected PropertyChangeListener buildBooleanChangeListener() { - return this.buildBooleanChangeListener_(); - } - }; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testSetSelected() throws Exception { - this.eventFired = false; - this.buttonModelAdapter.addChangeListener(new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - CheckBoxModelAdapterTests.this.eventFired = true; - } - }); - this.buttonModelAdapter.setSelected(false); - assertTrue(this.eventFired); - assertEquals(Boolean.FALSE, this.booleanHolder.getValue()); - } - - public void testSetValue() throws Exception { - this.eventFired = false; - this.buttonModelAdapter.addChangeListener(new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - CheckBoxModelAdapterTests.this.eventFired = true; - } - }); - assertTrue(this.buttonModelAdapter.isSelected()); - this.booleanHolder.setValue(Boolean.FALSE); - assertTrue(this.eventFired); - assertFalse(this.buttonModelAdapter.isSelected()); - } - - public void testDefaultValue() throws Exception { - this.eventFired = false; - this.buttonModelAdapter.addChangeListener(new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - CheckBoxModelAdapterTests.this.eventFired = true; - } - }); - assertTrue(this.buttonModelAdapter.isSelected()); - this.booleanHolder.setValue(null); - assertTrue(this.eventFired); - assertFalse(this.buttonModelAdapter.isSelected()); - - this.eventFired = false; - this.booleanHolder.setValue(Boolean.FALSE); - assertFalse(this.eventFired); - assertFalse(this.buttonModelAdapter.isSelected()); - } - - public void testHasListeners() throws Exception { - SimplePropertyValueModel localBooleanHolder = (SimplePropertyValueModel) this.booleanHolder; - assertFalse(localBooleanHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasNoListeners(this.buttonModelAdapter); - - ChangeListener listener = new TestChangeListener(); - this.buttonModelAdapter.addChangeListener(listener); - assertTrue(localBooleanHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasListeners(this.buttonModelAdapter); - - this.buttonModelAdapter.removeChangeListener(listener); - assertFalse(localBooleanHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasNoListeners(this.buttonModelAdapter); - } - - private void verifyHasNoListeners(Object model) throws Exception { - EventListenerList listenerList = (EventListenerList) ReflectionTools.getFieldValue(model, "listenerList"); - assertEquals(0, listenerList.getListenerList().length); - } - - private void verifyHasListeners(Object model) throws Exception { - EventListenerList listenerList = (EventListenerList) ReflectionTools.getFieldValue(model, "listenerList"); - assertFalse(listenerList.getListenerList().length == 0); - } - - - // ********** member class ********** - private class TestChangeListener implements ChangeListener { - TestChangeListener() { - super(); - } - public void stateChanged(ChangeEvent e) { - fail("unexpected event"); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/CheckBoxModelAdapterUITest.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/CheckBoxModelAdapterUITest.java deleted file mode 100644 index 6c7464e0f5..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/CheckBoxModelAdapterUITest.java +++ /dev/null @@ -1,314 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.ItemEvent; -import java.awt.event.ItemListener; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.ButtonModel; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.WindowConstants; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.CheckBoxModelAdapter; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * Play around with a set of check boxes. - */ -@SuppressWarnings("nls") -public class CheckBoxModelAdapterUITest { - - private TestModel testModel; - private WritablePropertyValueModel testModelHolder; - private WritablePropertyValueModel flag1Holder; - private WritablePropertyValueModel flag2Holder; - private WritablePropertyValueModel notFlag2Holder; - private ButtonModel flag1ButtonModel; - private ButtonModel flag2ButtonModel; - private ButtonModel notFlag2ButtonModel; - - public static void main(String[] args) throws Exception { - new CheckBoxModelAdapterUITest().exec(); - } - - private CheckBoxModelAdapterUITest() { - super(); - } - - private void exec() throws Exception { - this.testModel = new TestModel(true, true); - this.testModelHolder = new SimplePropertyValueModel(this.testModel); - this.flag1Holder = this.buildFlag1Holder(this.testModelHolder); - this.flag1ButtonModel = this.buildCheckBoxModelAdapter(this.flag1Holder); - this.flag2Holder = this.buildFlag2Holder(this.testModelHolder); - this.flag2ButtonModel = this.buildCheckBoxModelAdapter(this.flag2Holder); - this.notFlag2Holder = this.buildNotFlag2Holder(this.testModelHolder); - this.notFlag2ButtonModel = this.buildCheckBoxModelAdapter(this.notFlag2Holder); - this.openWindow(); - } - - private WritablePropertyValueModel buildFlag1Holder(PropertyValueModel vm) { - return new PropertyAspectAdapter(vm, TestModel.FLAG1_PROPERTY) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.isFlag1()); - } - @Override - protected void setValue_(Boolean value) { - this.subject.setFlag1(value.booleanValue()); - } - }; - } - - private WritablePropertyValueModel buildFlag2Holder(PropertyValueModel vm) { - return new PropertyAspectAdapter(vm, TestModel.FLAG2_PROPERTY) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.isFlag2()); - } - @Override - protected void setValue_(Boolean value) { - this.subject.setFlag2(value.booleanValue()); - } - }; - } - - private WritablePropertyValueModel buildNotFlag2Holder(PropertyValueModel vm) { - return new PropertyAspectAdapter(vm, TestModel.NOT_FLAG2_PROPERTY) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.isNotFlag2()); - } - @Override - protected void setValue_(Boolean value) { - this.subject.setNotFlag2(value.booleanValue()); - } - }; - } - - private ButtonModel buildCheckBoxModelAdapter(WritablePropertyValueModel booleanHolder) { - return new CheckBoxModelAdapter(booleanHolder); - } - - private void openWindow() { - JFrame window = new JFrame(this.getClass().getName()); - window.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - window.addWindowListener(this.buildWindowListener()); - window.getContentPane().add(this.buildMainPanel(), "Center"); - window.setSize(400, 100); - window.setVisible(true); - } - - private WindowListener buildWindowListener() { - return new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - e.getWindow().setVisible(false); - System.exit(0); - } - }; - } - - private Component buildMainPanel() { - JPanel mainPanel = new JPanel(new BorderLayout()); - mainPanel.add(this.buildCheckBoxPanel(), BorderLayout.NORTH); - mainPanel.add(this.buildControlPanel(), BorderLayout.SOUTH); - return mainPanel; - } - - private Component buildCheckBoxPanel() { - JPanel taskListPanel = new JPanel(new GridLayout(1, 0)); - taskListPanel.add(this.buildFlag1CheckBox()); - taskListPanel.add(this.buildFlag2CheckBox()); - taskListPanel.add(this.buildNotFlag2CheckBox()); - taskListPanel.add(this.buildUnattachedCheckBox()); - return taskListPanel; - } - - private JCheckBox buildFlag1CheckBox() { - JCheckBox checkBox = new JCheckBox(); - checkBox.setText("flag 1"); - checkBox.setModel(this.flag1ButtonModel); - return checkBox; - } - - private JCheckBox buildFlag2CheckBox() { - JCheckBox checkBox = new JCheckBox(); - checkBox.setText("flag 2"); - checkBox.setModel(this.flag2ButtonModel); - return checkBox; - } - - private JCheckBox buildNotFlag2CheckBox() { - JCheckBox checkBox = new JCheckBox(); - checkBox.setText("not flag 2"); - checkBox.setModel(this.notFlag2ButtonModel); - return checkBox; - } - - private JCheckBox buildUnattachedCheckBox() { - JCheckBox checkBox = new JCheckBox("unattached"); - checkBox.getModel().addItemListener(this.buildUnattachedItemListener()); - return checkBox; - } - - private ItemListener buildUnattachedItemListener() { - return new ItemListener() { - public void itemStateChanged(ItemEvent e) { - System.out.println("unattached state changed: " + e); - } - }; - } - - private Component buildControlPanel() { - JPanel controlPanel = new JPanel(new GridLayout(1, 0)); - controlPanel.add(this.buildFlipFlag1Button()); - controlPanel.add(this.buildClearModelButton()); - controlPanel.add(this.buildRestoreModelButton()); - controlPanel.add(this.buildPrintModelButton()); - return controlPanel; - } - - private JButton buildFlipFlag1Button() { - return new JButton(this.buildFlipFlag1Action()); - } - - private Action buildFlipFlag1Action() { - Action action = new AbstractAction("flip flag 1") { - public void actionPerformed(ActionEvent event) { - CheckBoxModelAdapterUITest.this.flipFlag1(); - } - }; - action.setEnabled(true); - return action; - } - - void flipFlag1() { - this.testModel.setFlag1( ! this.testModel.isFlag1()); - } - - private JButton buildClearModelButton() { - return new JButton(this.buildClearModelAction()); - } - - private Action buildClearModelAction() { - Action action = new AbstractAction("clear model") { - public void actionPerformed(ActionEvent event) { - CheckBoxModelAdapterUITest.this.clearModel(); - } - }; - action.setEnabled(true); - return action; - } - - void clearModel() { - this.testModelHolder.setValue(null); - } - - private JButton buildRestoreModelButton() { - return new JButton(this.buildRestoreModelAction()); - } - - private Action buildRestoreModelAction() { - Action action = new AbstractAction("restore model") { - public void actionPerformed(ActionEvent event) { - CheckBoxModelAdapterUITest.this.restoreModel(); - } - }; - action.setEnabled(true); - return action; - } - - void restoreModel() { - this.testModelHolder.setValue(this.testModel); - } - - private JButton buildPrintModelButton() { - return new JButton(this.buildPrintModelAction()); - } - - private Action buildPrintModelAction() { - Action action = new AbstractAction("print model") { - public void actionPerformed(ActionEvent event) { - CheckBoxModelAdapterUITest.this.printModel(); - } - }; - action.setEnabled(true); - return action; - } - - void printModel() { - System.out.println("flag 1: " + this.testModel.isFlag1()); - System.out.println("flag 2: " + this.testModel.isFlag2()); - System.out.println("not flag 2: " + this.testModel.isNotFlag2()); - System.out.println("***"); - } - - - private class TestModel extends AbstractModel { - private boolean flag1; - public static final String FLAG1_PROPERTY = "flag1"; - private boolean flag2; - public static final String FLAG2_PROPERTY = "flag2"; - private boolean notFlag2; - public static final String NOT_FLAG2_PROPERTY = "notFlag2"; - - public TestModel(boolean flag1, boolean flag2) { - this.flag1 = flag1; - this.flag2 = flag2; - this.notFlag2 = ! flag2; - } - public boolean isFlag1() { - return this.flag1; - } - public void setFlag1(boolean flag1) { - boolean old = this.flag1; - this.flag1 = flag1; - this.firePropertyChanged(FLAG1_PROPERTY, old, flag1); - } - public boolean isFlag2() { - return this.flag2; - } - public void setFlag2(boolean flag2) { - boolean old = this.flag2; - this.flag2 = flag2; - this.firePropertyChanged(FLAG2_PROPERTY, old, flag2); - - old = this.notFlag2; - this.notFlag2 = ! flag2; - this.firePropertyChanged(NOT_FLAG2_PROPERTY, old, this.notFlag2); - } - public boolean isNotFlag2() { - return this.notFlag2; - } - public void setNotFlag2(boolean notFlag2) { - this.setFlag2( ! notFlag2); - } - @Override - public String toString() { - return "TestModel(" + this.isFlag1() + " - " + this.isFlag2() + ")"; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ComboBoxModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ComboBoxModelAdapterTests.java deleted file mode 100644 index 891611573d..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ComboBoxModelAdapterTests.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.List; -import javax.swing.ComboBoxModel; -import javax.swing.ListModel; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ComboBoxModelAdapter; -import org.eclipse.jpt.common.utility.internal.swing.Displayable; -import org.eclipse.jpt.common.utility.internal.swing.SimpleDisplayable; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.model.value.CoordinatedList; - -@SuppressWarnings("nls") -public class ComboBoxModelAdapterTests extends TestCase { - - public ComboBoxModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - // nothing yet... - } - - @Override - protected void tearDown() throws Exception { - // nothing yet... - super.tearDown(); - } - - public void testHasListeners() throws Exception { - SimpleListValueModel listHolder = this.buildListHolder(); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - SimplePropertyValueModel selectionHolder = new SimplePropertyValueModel(listHolder.iterator().next()); - assertFalse(selectionHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - - ComboBoxModel comboBoxModel = new ComboBoxModelAdapter(listHolder, selectionHolder); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertFalse(selectionHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasNoListeners(comboBoxModel); - - CoordinatedList synchList = new CoordinatedList(comboBoxModel); - PropertyChangeListener selectionListener = this.buildSelectionListener(); - selectionHolder.addPropertyChangeListener(PropertyValueModel.VALUE, selectionListener); - assertTrue(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertTrue(selectionHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasListeners(comboBoxModel); - - comboBoxModel.removeListDataListener(synchList); - selectionHolder.removePropertyChangeListener(PropertyValueModel.VALUE, selectionListener); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertFalse(selectionHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasNoListeners(comboBoxModel); - } - - private PropertyChangeListener buildSelectionListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent evt) { - // do nothing... - } - }; - } - - private void verifyHasNoListeners(ListModel listModel) throws Exception { - boolean hasNoListeners = ((Boolean) ReflectionTools.executeMethod(listModel, "hasNoListDataListeners")).booleanValue(); - assertTrue(hasNoListeners); - } - - private void verifyHasListeners(ListModel listModel) throws Exception { - boolean hasListeners = ((Boolean) ReflectionTools.executeMethod(listModel, "hasListDataListeners")).booleanValue(); - assertTrue(hasListeners); - } - - private SimpleListValueModel buildListHolder() { - return new SimpleListValueModel(this.buildList()); - } - - private List buildList() { - List list = new ArrayList(); - this.populateCollection(list); - return list; - } - - private void populateCollection(Collection c) { - c.add(new SimpleDisplayable("foo")); - c.add(new SimpleDisplayable("bar")); - c.add(new SimpleDisplayable("baz")); - c.add(new SimpleDisplayable("joo")); - c.add(new SimpleDisplayable("jar")); - c.add(new SimpleDisplayable("jaz")); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest.java deleted file mode 100644 index c750bdf997..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest.java +++ /dev/null @@ -1,393 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import java.util.ArrayList; -import java.util.List; - -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.ComboBoxModel; -import javax.swing.JButton; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.ListCellRenderer; -import javax.swing.UIManager; -import javax.swing.WindowConstants; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ComboBoxModelAdapter; -import org.eclipse.jpt.common.utility.internal.swing.FilteringListBrowser; -import org.eclipse.jpt.common.utility.internal.swing.ListChooser; -import org.eclipse.jpt.common.utility.internal.swing.SimpleListCellRenderer; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - - -/** - * Play around with a set of combo-boxes. - * - * DefaultLongListBrowserDialogUITest subclasses this class; so be - * careful when making changes. - */ -@SuppressWarnings("nls") -public class ComboBoxModelAdapterUITest { - - protected JFrame window; - private TestModel testModel; - private WritablePropertyValueModel testModelHolder; - private WritablePropertyValueModel colorHolder; - private SimpleListValueModel colorListHolder; - protected ComboBoxModel colorComboBoxModel; - private int nextColorNumber = 0; - - public static void main(String[] args) throws Exception { - new ComboBoxModelAdapterUITest().exec(); - } - - protected ComboBoxModelAdapterUITest() { - super(); - } - - protected void exec() throws Exception { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); -// UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName()); // Metal LAF -// UIManager.setLookAndFeel(com.sun.java.swing.plaf.windows.WindowsLookAndFeel.class.getName()); -// UIManager.setLookAndFeel(com.sun.java.swing.plaf.motif.MotifLookAndFeel.class.getName()); -// UIManager.setLookAndFeel(oracle.bali.ewt.olaf.OracleLookAndFeel.class.getName()); - this.testModel = this.buildTestModel(); - this.testModelHolder = new SimplePropertyValueModel(this.testModel); - this.colorHolder = this.buildColorHolder(this.testModelHolder); - this.colorListHolder = this.buildColorListHolder(); - this.colorComboBoxModel = this.buildComboBoxModelAdapter(this.colorListHolder, this.colorHolder); - this.openWindow(); - } - - private WritablePropertyValueModel buildColorHolder(PropertyValueModel vm) { - return new PropertyAspectAdapter(vm, TestModel.COLOR_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getColor(); - } - @Override - protected void setValue_(Object value) { - this.subject.setColor((String) value); - } - }; - } - - protected TestModel buildTestModel() { - return new TestModel(); - } - - private SimpleListValueModel buildColorListHolder() { - return new SimpleListValueModel(TestModel.validColors()); -// return new AbstractReadOnlyListValueModel() { -// public Object value() { -// return new ArrayListIterator(TestModel.VALID_COLORS); -// } -// public int size() { -// return TestModel.VALID_COLORS.length; -// } -// }; - } - - protected ListValueModel uiColorListHolder() { - return this.colorListHolder; - } - - private ComboBoxModel buildComboBoxModelAdapter(ListValueModel listHolder, WritablePropertyValueModel selectionHolder) { - return new ComboBoxModelAdapter(listHolder, selectionHolder); - } - - private void openWindow() { - this.window = new JFrame(this.getClass().getSimpleName()); - this.window.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - this.window.addWindowListener(this.buildWindowListener()); - this.window.getContentPane().add(this.buildMainPanel(), "Center"); - this.window.setLocation(300, 300); - this.window.setSize(400, 150); - this.window.setVisible(true); - } - - private WindowListener buildWindowListener() { - return new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - e.getWindow().setVisible(false); - System.exit(0); - } - }; - } - - private Component buildMainPanel() { - JPanel mainPanel = new JPanel(new BorderLayout()); - mainPanel.add(this.buildComboBoxPanel(), BorderLayout.NORTH); - mainPanel.add(this.buildControlPanel(), BorderLayout.SOUTH); - return mainPanel; - } - - protected JPanel buildComboBoxPanel() { - JPanel panel = new JPanel(new GridLayout(1, 0)); - panel.add(this.buildComboBox()); - panel.add(this.buildComboBox()); - panel.add(this.buildListChooser1()); - panel.add(this.buildListChooser2()); - return panel; - } - - private JComboBox buildComboBox() { - JComboBox comboBox = new JComboBox(this.colorComboBoxModel); - comboBox.setRenderer(this.buildComboBoxRenderer()); - return comboBox; - } - - protected ListCellRenderer buildComboBoxRenderer() { - return new SimpleListCellRenderer() { - @Override - protected String buildText(Object value) { - return super.buildText(value); - } - }; - } - - private ListChooser buildListChooser1() { - return new LocalListChooser1(this.colorComboBoxModel); - } - - private ListChooser buildListChooser2() { - return new LocalListChooser2(this.colorComboBoxModel); - } - - private Component buildControlPanel() { - JPanel controlPanel = new JPanel(new GridLayout(2, 0)); - controlPanel.add(this.buildResetColorButton()); - controlPanel.add(this.buildClearModelButton()); - controlPanel.add(this.buildRestoreModelButton()); - controlPanel.add(this.buildPrintModelButton()); - controlPanel.add(this.buildAddTenButton()); - controlPanel.add(this.buildRemoveTenButton()); - return controlPanel; - } - - // ********** reset color button ********** - private JButton buildResetColorButton() { - return new JButton(this.buildResetColorAction()); - } - - private Action buildResetColorAction() { - Action action = new AbstractAction("reset color") { - public void actionPerformed(ActionEvent event) { - ComboBoxModelAdapterUITest.this.resetColor(); - } - }; - action.setEnabled(true); - return action; - } - - void resetColor() { - this.testModel.setColor(TestModel.DEFAULT_COLOR); - } - - // ********** clear model button ********** - private JButton buildClearModelButton() { - return new JButton(this.buildClearModelAction()); - } - - private Action buildClearModelAction() { - Action action = new AbstractAction("clear model") { - public void actionPerformed(ActionEvent event) { - ComboBoxModelAdapterUITest.this.clearModel(); - } - }; - action.setEnabled(true); - return action; - } - - void clearModel() { - this.testModelHolder.setValue(null); - } - - // ********** restore model button ********** - private JButton buildRestoreModelButton() { - return new JButton(this.buildRestoreModelAction()); - } - - private Action buildRestoreModelAction() { - Action action = new AbstractAction("restore model") { - public void actionPerformed(ActionEvent event) { - ComboBoxModelAdapterUITest.this.restoreModel(); - } - }; - action.setEnabled(true); - return action; - } - - void restoreModel() { - this.testModelHolder.setValue(this.testModel); - } - - // ********** print model button ********** - private JButton buildPrintModelButton() { - return new JButton(this.buildPrintModelAction()); - } - - private Action buildPrintModelAction() { - Action action = new AbstractAction("print model") { - public void actionPerformed(ActionEvent event) { - ComboBoxModelAdapterUITest.this.printModel(); - } - }; - action.setEnabled(true); - return action; - } - - void printModel() { - System.out.println(this.testModel); - } - - // ********** add 20 button ********** - private JButton buildAddTenButton() { - return new JButton(this.buildAddTenAction()); - } - - private Action buildAddTenAction() { - Action action = new AbstractAction("add 20") { - public void actionPerformed(ActionEvent event) { - ComboBoxModelAdapterUITest.this.addTen(); - } - }; - action.setEnabled(true); - return action; - } - - void addTen() { - for (int i = this.nextColorNumber; i < this.nextColorNumber + 20; i++) { - this.colorListHolder.add(this.colorListHolder.size(), "color" + i); - } - this.nextColorNumber += 20; - } - - // ********** remove 20 button ********** - private JButton buildRemoveTenButton() { - return new JButton(this.buildRemoveTenAction()); - } - - private Action buildRemoveTenAction() { - Action action = new AbstractAction("remove 20") { - public void actionPerformed(ActionEvent event) { - ComboBoxModelAdapterUITest.this.removeTen(); - } - }; - action.setEnabled(true); - return action; - } - - void removeTen() { - for (int i = 0; i < 20; i++) { - if (this.colorListHolder.size() > 0) { - this.colorListHolder.remove(this.colorListHolder.size() - 1); - } - } - } - - - protected static class TestModel extends AbstractModel { - private String color; - public static final String COLOR_PROPERTY = "color"; - public static final String RED = "red"; - public static final String ORANGE = "orange"; - public static final String YELLOW = "yellow"; - public static final String GREEN = "green"; - public static final String BLUE = "blue"; - public static final String INDIGO = "indigo"; - public static final String VIOLET = "violet"; - public static final String DEFAULT_COLOR = RED; - public static List validColors; - public static final String[] DEFAULT_VALID_COLORS = { - RED, - ORANGE, - YELLOW, - GREEN, - BLUE, - INDIGO, - VIOLET - }; - - public static List validColors() { - if (validColors == null) { - validColors = buildDefaultValidColors(); - } - return validColors; - } - public static List buildDefaultValidColors() { - List result = new ArrayList(); - CollectionTools.addAll(result, DEFAULT_VALID_COLORS); - return result; - } - - public TestModel() { - this(DEFAULT_COLOR); - } - public TestModel(String color) { - this.color = color; - } - public String getColor() { - return this.color; - } - public void setColor(String color) { - this.checkColor(color); - Object old = this.color; - this.color = color; - this.firePropertyChanged(COLOR_PROPERTY, old, color); - } - public void checkColor(String c) { - if ( ! validColors().contains(c)) { - throw new IllegalArgumentException(c); - } - } - @Override - public String toString() { - return "TestModel(" + this.color + ")"; - } - } - - - private class LocalListChooser1 extends ListChooser { - public LocalListChooser1(ComboBoxModel model) { - super(model); - } - } - - - private class LocalListChooser2 extends ListChooser { - public LocalListChooser2(ComboBoxModel model) { - super(model); - } - @Override - protected ListBrowser buildBrowser() { - return new FilteringListBrowser(); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest2.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest2.java deleted file mode 100644 index ed00f4cf18..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ComboBoxModelAdapterUITest2.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import javax.swing.ListCellRenderer; -import org.eclipse.jpt.common.utility.internal.model.value.ExtendedListValueModelWrapper; -import org.eclipse.jpt.common.utility.internal.swing.SimpleListCellRenderer; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; - -/** - * - */ -@SuppressWarnings("nls") -public class ComboBoxModelAdapterUITest2 extends ComboBoxModelAdapterUITest { - - public static void main(String[] args) throws Exception { - new ComboBoxModelAdapterUITest2().exec(); - } - - public ComboBoxModelAdapterUITest2() { - super(); - } - - /** - * use a different model that allows the color to be set to null - */ - @Override - protected TestModel buildTestModel() { - return new TestModel2(); - } - - /** - * add a null to the front of the list - */ - @Override - protected ListValueModel uiColorListHolder() { - // the default is to prepend the wrapped list with a null item - return new ExtendedListValueModelWrapper(super.uiColorListHolder()); - } - - /** - * convert null to some text - */ - @Override - protected ListCellRenderer buildComboBoxRenderer() { - return new SimpleListCellRenderer() { - @Override - protected String buildText(Object value) { - return (value == null) ? "" : super.buildText(value); - } - }; - } - - - protected static class TestModel2 extends TestModel { - /** - * null is OK here - */ - @Override - public void checkColor(String color) { - if (color == null) { - return; - } - super.checkColor(color); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/DateSpinnerModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/DateSpinnerModelAdapterTests.java deleted file mode 100644 index 2b09c75e48..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/DateSpinnerModelAdapterTests.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import java.util.Date; -import javax.swing.SpinnerModel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.DateSpinnerModelAdapter; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class DateSpinnerModelAdapterTests extends TestCase { - private WritablePropertyValueModel valueHolder; - private SpinnerModel spinnerModelAdapter; - boolean eventFired; - - public DateSpinnerModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.valueHolder = new SimplePropertyValueModel(new Date()); - this.spinnerModelAdapter = new DateSpinnerModelAdapter(this.valueHolder) { - @Override - protected PropertyChangeListener buildDateChangeListener() { - return this.buildDateChangeListener_(); - } - }; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testSetValueSpinnerModel() throws Exception { - this.eventFired = false; - this.spinnerModelAdapter.addChangeListener(new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - DateSpinnerModelAdapterTests.this.eventFired = true; - } - }); - Date newDate = new Date(); - newDate.setTime(777777); - this.spinnerModelAdapter.setValue(newDate); - assertTrue(this.eventFired); - assertEquals(777777, ((Date) this.valueHolder.getValue()).getTime()); - } - - public void testSetValueValueHolder() throws Exception { - this.eventFired = false; - this.spinnerModelAdapter.addChangeListener(new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - DateSpinnerModelAdapterTests.this.eventFired = true; - } - }); - Date newDate = new Date(); - newDate.setTime(777777); - this.valueHolder.setValue(newDate); - assertTrue(this.eventFired); - assertEquals(777777, ((Date) this.spinnerModelAdapter.getValue()).getTime()); - } - - public void testDefaultValue() throws Exception { - Date newDate = new Date(); - newDate.setTime(777777); - this.valueHolder.setValue(newDate); - this.eventFired = false; - this.spinnerModelAdapter.addChangeListener(new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - DateSpinnerModelAdapterTests.this.eventFired = true; - } - }); - assertEquals(777777, ((Date) this.spinnerModelAdapter.getValue()).getTime()); - this.valueHolder.setValue(null); - assertTrue(this.eventFired); - assertFalse(((Date) this.spinnerModelAdapter.getValue()).getTime() == 777777); - } - - public void testHasListeners() throws Exception { - SimplePropertyValueModel localValueHolder = (SimplePropertyValueModel) this.valueHolder; - assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasNoListeners(this.spinnerModelAdapter); - - ChangeListener listener = new TestChangeListener(); - this.spinnerModelAdapter.addChangeListener(listener); - assertTrue(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasListeners(this.spinnerModelAdapter); - - this.spinnerModelAdapter.removeChangeListener(listener); - assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasNoListeners(this.spinnerModelAdapter); - } - - private void verifyHasNoListeners(SpinnerModel adapter) throws Exception { - assertEquals(0, ((DateSpinnerModelAdapter) adapter).getChangeListeners().length); - } - - private void verifyHasListeners(Object adapter) throws Exception { - assertFalse(((DateSpinnerModelAdapter) adapter).getChangeListeners().length == 0); - } - - public void testNullInitialValue() { - Date today = new Date(); - this.valueHolder = new SimplePropertyValueModel(); - this.spinnerModelAdapter = new DateSpinnerModelAdapter(this.valueHolder, today) { - @Override - protected PropertyChangeListener buildDateChangeListener() { - return this.buildDateChangeListener_(); - } - }; - - this.eventFired = false; - this.spinnerModelAdapter.addChangeListener(new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - DateSpinnerModelAdapterTests.this.eventFired = true; - } - }); - assertEquals(today, this.spinnerModelAdapter.getValue()); - - Date newDate = new Date(); - newDate.setTime(777777); - this.valueHolder.setValue(newDate); - - assertTrue(this.eventFired); - assertEquals(777777, ((Date) this.spinnerModelAdapter.getValue()).getTime()); - } - - - // ********** inner class ********** - private class TestChangeListener implements ChangeListener { - TestChangeListener() { - super(); - } - public void stateChanged(ChangeEvent e) { - fail("unexpected event"); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/DocumentAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/DocumentAdapterTests.java deleted file mode 100644 index 52206d000e..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/DocumentAdapterTests.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import javax.swing.event.DocumentEvent; -import javax.swing.event.DocumentListener; -import javax.swing.event.DocumentEvent.EventType; -import javax.swing.text.Document; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.DocumentAdapter; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class DocumentAdapterTests extends TestCase { - private WritablePropertyValueModel stringHolder; - Document documentAdapter; - boolean eventFired; - - public DocumentAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.stringHolder = new SimplePropertyValueModel("0123456789"); - this.documentAdapter = new DocumentAdapter(this.stringHolder) { - @Override - protected PropertyChangeListener buildStringListener() { - return this.buildStringListener_(); - } - }; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testRemove() throws Exception { - this.eventFired = false; - this.documentAdapter.addDocumentListener(new TestDocumentListener() { - @Override - public void removeUpdate(DocumentEvent e) { - DocumentAdapterTests.this.eventFired = true; - assertEquals(EventType.REMOVE, e.getType()); - assertEquals(DocumentAdapterTests.this.documentAdapter, e.getDocument()); - // this will be the removal of "23456" - assertEquals(2, e.getOffset()); - assertEquals(5, e.getLength()); - } - }); - this.documentAdapter.remove(2, 5); - assertTrue(this.eventFired); - assertEquals("01789", this.stringHolder.getValue()); - } - - public void testInsert() throws Exception { - this.eventFired = false; - this.documentAdapter.addDocumentListener(new TestDocumentListener() { - @Override - public void insertUpdate(DocumentEvent e) { - DocumentAdapterTests.this.eventFired = true; - assertEquals(EventType.INSERT, e.getType()); - assertEquals(DocumentAdapterTests.this.documentAdapter, e.getDocument()); - // this will be the insert of "xxxxxx" - assertEquals(2, e.getOffset()); - assertEquals(5, e.getLength()); - } - }); - this.documentAdapter.insertString(2, "xxxxx", null); - assertTrue(this.eventFired); - assertEquals("01xxxxx23456789", this.stringHolder.getValue()); - } - - public void testSetValue() throws Exception { - this.eventFired = false; - this.documentAdapter.addDocumentListener(new TestDocumentListener() { - @Override - public void insertUpdate(DocumentEvent e) { - DocumentAdapterTests.this.eventFired = true; - assertEquals(EventType.INSERT, e.getType()); - assertEquals(DocumentAdapterTests.this.documentAdapter, e.getDocument()); - // this will be the insert of "foo" - assertEquals(0, e.getOffset()); - assertEquals(3, e.getLength()); - } - @Override - public void removeUpdate(DocumentEvent e) { - assertEquals(EventType.REMOVE, e.getType()); - assertEquals(DocumentAdapterTests.this.documentAdapter, e.getDocument()); - // this will be the removal of "0123456789" - assertEquals(0, e.getOffset()); - assertEquals(10, e.getLength()); - } - }); - assertEquals("0123456789", this.documentAdapter.getText(0, this.documentAdapter.getLength())); - this.stringHolder.setValue("foo"); - assertTrue(this.eventFired); - assertEquals("foo", this.documentAdapter.getText(0, this.documentAdapter.getLength())); - } - - public void testHasListeners() throws Exception { - SimplePropertyValueModel localStringHolder = (SimplePropertyValueModel) this.stringHolder; - assertFalse(localStringHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasNoListeners(this.documentAdapter); - - DocumentListener listener = new TestDocumentListener(); - this.documentAdapter.addDocumentListener(listener); - assertTrue(localStringHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasListeners(this.documentAdapter); - - this.documentAdapter.removeDocumentListener(listener); - assertFalse(localStringHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasNoListeners(this.documentAdapter); - } - - private void verifyHasNoListeners(Object document) throws Exception { - Object delegate = ReflectionTools.getFieldValue(document, "delegate"); - Object[] listeners = (Object[]) ReflectionTools.executeMethod(delegate, "getDocumentListeners"); - assertEquals(0, listeners.length); - } - - private void verifyHasListeners(Object document) throws Exception { - Object delegate = ReflectionTools.getFieldValue(document, "delegate"); - Object[] listeners = (Object[]) ReflectionTools.executeMethod(delegate, "getDocumentListeners"); - assertFalse(listeners.length == 0); - } - - -private class TestDocumentListener implements DocumentListener { - TestDocumentListener() { - super(); - } - public void changedUpdate(DocumentEvent e) { - fail("unexpected event"); - } - public void insertUpdate(DocumentEvent e) { - fail("unexpected event"); - } - public void removeUpdate(DocumentEvent e) { - fail("unexpected event"); - } -} - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/DocumentAdapterUITest.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/DocumentAdapterUITest.java deleted file mode 100644 index f199f51150..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/DocumentAdapterUITest.java +++ /dev/null @@ -1,256 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JTextField; -import javax.swing.WindowConstants; -import javax.swing.text.AbstractDocument; -import javax.swing.text.AttributeSet; -import javax.swing.text.BadLocationException; -import javax.swing.text.Document; -import javax.swing.text.PlainDocument; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.DocumentAdapter; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * Play around with a set of entry fields. - */ -@SuppressWarnings("nls") -public class DocumentAdapterUITest { - - private TestModel testModel; - private static final String DEFAULT_NAME = "Scooby Doo"; - private WritablePropertyValueModel testModelHolder; - private WritablePropertyValueModel nameHolder; - private Document nameDocument; - private Document upperCaseNameDocument; - - public static void main(String[] args) throws Exception { - new DocumentAdapterUITest().exec(); - } - - private DocumentAdapterUITest() { - super(); - } - - private void exec() throws Exception { - this.testModel = new TestModel(DEFAULT_NAME); - this.testModelHolder = new SimplePropertyValueModel(this.testModel); - this.nameHolder = this.buildNameHolder(this.testModelHolder); - this.nameDocument = this.buildNameDocument(this.nameHolder); - this.upperCaseNameDocument = this.buildUpperCaseNameDocument(this.nameHolder); - this.openWindow(); - } - - private WritablePropertyValueModel buildNameHolder(PropertyValueModel vm) { - return new PropertyAspectAdapter(vm, TestModel.NAME_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getName(); - } - @Override - protected void setValue_(String value) { - this.subject.setName(value); - } - }; - } - - private Document buildNameDocument(WritablePropertyValueModel stringHolder) { - return new DocumentAdapter(stringHolder); - } - - private Document buildUpperCaseNameDocument(WritablePropertyValueModel stringHolder) { - return new DocumentAdapter(stringHolder, this.buildUpperCaseNameDocumentDelegate()); - } - - private AbstractDocument buildUpperCaseNameDocumentDelegate() { - return new PlainDocument() { - @Override - public void insertString(int offset, String string, AttributeSet a) throws BadLocationException { - if (string == null) { - return; - } - char[] upper = string.toCharArray(); - for (int i = 0; i < upper.length; i++) { - upper[i] = Character.toUpperCase(upper[i]); - } - super.insertString(offset, new String(upper), a); - } - }; - } - - private void openWindow() { - JFrame window = new JFrame(this.getClass().getName()); - window.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - window.addWindowListener(this.buildWindowListener()); - window.getContentPane().add(this.buildMainPanel(), "Center"); - window.setSize(400, 100); - window.setVisible(true); - } - - private WindowListener buildWindowListener() { - return new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - e.getWindow().setVisible(false); - System.exit(0); - } - }; - } - - private Component buildMainPanel() { - JPanel mainPanel = new JPanel(new BorderLayout()); - mainPanel.add(this.buildTextFieldPanel(), BorderLayout.NORTH); - mainPanel.add(this.buildControlPanel(), BorderLayout.SOUTH); - return mainPanel; - } - - private Component buildTextFieldPanel() { - JPanel taskListPanel = new JPanel(new GridLayout(1, 0)); - taskListPanel.add(this.buildNameTextField()); - taskListPanel.add(this.buildReadOnlyNameTextField()); - taskListPanel.add(this.buildUpperCaseNameTextField()); - return taskListPanel; - } - - private JTextField buildNameTextField() { - return new JTextField(this.nameDocument, null, 0); - } - - private JTextField buildReadOnlyNameTextField() { - JTextField nameTextField = this.buildNameTextField(); - nameTextField.setEditable(false); - return nameTextField; - } - - private JTextField buildUpperCaseNameTextField() { - return new JTextField(this.upperCaseNameDocument, null, 0); - } - - private Component buildControlPanel() { - JPanel controlPanel = new JPanel(new GridLayout(1, 0)); - controlPanel.add(this.buildResetNameButton()); - controlPanel.add(this.buildClearModelButton()); - controlPanel.add(this.buildRestoreModelButton()); - controlPanel.add(this.buildPrintModelButton()); - return controlPanel; - } - - private JButton buildResetNameButton() { - return new JButton(this.buildResetNameAction()); - } - - private Action buildResetNameAction() { - Action action = new AbstractAction("reset name") { - public void actionPerformed(ActionEvent event) { - DocumentAdapterUITest.this.resetName(); - } - }; - action.setEnabled(true); - return action; - } - - void resetName() { - this.testModel.setName(DEFAULT_NAME); - } - - private JButton buildClearModelButton() { - return new JButton(this.buildClearModelAction()); - } - - private Action buildClearModelAction() { - Action action = new AbstractAction("clear model") { - public void actionPerformed(ActionEvent event) { - DocumentAdapterUITest.this.clearModel(); - } - }; - action.setEnabled(true); - return action; - } - - void clearModel() { - this.testModelHolder.setValue(null); - } - - private JButton buildRestoreModelButton() { - return new JButton(this.buildRestoreModelAction()); - } - - private Action buildRestoreModelAction() { - Action action = new AbstractAction("restore model") { - public void actionPerformed(ActionEvent event) { - DocumentAdapterUITest.this.restoreModel(); - } - }; - action.setEnabled(true); - return action; - } - - void restoreModel() { - this.testModelHolder.setValue(this.testModel); - } - - private JButton buildPrintModelButton() { - return new JButton(this.buildPrintModelAction()); - } - - private Action buildPrintModelAction() { - Action action = new AbstractAction("print model") { - public void actionPerformed(ActionEvent event) { - DocumentAdapterUITest.this.printModel(); - } - }; - action.setEnabled(true); - return action; - } - - void printModel() { - System.out.println("name: " + this.testModel.getName()); - } - - - private class TestModel extends AbstractModel { - private String name; - public static final String NAME_PROPERTY = "name"; - - public TestModel(String name) { - this.name = name; - } - public String getName() { - return this.name; - } - public void setName(String name) { - Object old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - @Override - public String toString() { - return "TestModel(" + this.getName() + ")"; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/JptUtilityModelValueSwingTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/JptUtilityModelValueSwingTests.java deleted file mode 100644 index 93c6b41c9d..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/JptUtilityModelValueSwingTests.java +++ /dev/null @@ -1,42 +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.common.utility.tests.internal.model.value.swing; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class JptUtilityModelValueSwingTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptUtilityModelValueSwingTests.class.getPackage().getName()); - - suite.addTestSuite(CheckBoxModelAdapterTests.class); - suite.addTestSuite(ComboBoxModelAdapterTests.class); - suite.addTestSuite(DateSpinnerModelAdapterTests.class); - suite.addTestSuite(DocumentAdapterTests.class); - suite.addTestSuite(ListModelAdapterTests.class); - suite.addTestSuite(ListSpinnerModelAdapterTests.class); - suite.addTestSuite(NumberSpinnerModelAdapterTests.class); - suite.addTestSuite(ObjectListSelectionModelTests.class); - suite.addTestSuite(PrimitiveListTreeModelTests.class); - suite.addTestSuite(RadioButtonModelAdapterTests.class); - suite.addTestSuite(SpinnerModelAdapterTests.class); - suite.addTestSuite(TableModelAdapterTests.class); - suite.addTestSuite(TreeModelAdapterTests.class); - - return suite; - } - - private JptUtilityModelValueSwingTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ListModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ListModelAdapterTests.java deleted file mode 100644 index 0be426de9f..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ListModelAdapterTests.java +++ /dev/null @@ -1,320 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.SortedSet; -import java.util.TreeSet; - -import javax.swing.ListModel; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.Bag; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelWrapper; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ListModelAdapter; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.tests.internal.model.value.CoordinatedList; - -@SuppressWarnings("nls") -public class ListModelAdapterTests extends TestCase { - - public ListModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - // nothing yet... - } - - @Override - protected void tearDown() throws Exception { - // nothing yet... - super.tearDown(); - } - - private ListModelAdapter buildListModel(ListValueModel listHolder) { - return new ListModelAdapter(listHolder) { - @Override - protected ListChangeListener buildListChangeListener() { - return this.buildListChangeListener_(); - } - }; - } - - private ListModel buildListModel(CollectionValueModel collectionHolder) { - return new ListModelAdapter(collectionHolder) { - @Override - protected ListChangeListener buildListChangeListener() { - return this.buildListChangeListener_(); - } - }; - } - - public void testCollectionSynchronization() { - SimpleCollectionValueModel collectionHolder = this.buildCollectionHolder(); - ListModel listModel = this.buildListModel(collectionHolder); - CoordinatedList synchList = new CoordinatedList(listModel); - assertEquals(6, synchList.size()); - this.compare(listModel, synchList); - - collectionHolder.add("tom"); - collectionHolder.add("dick"); - collectionHolder.add("harry"); - collectionHolder.add(null); - assertEquals(10, synchList.size()); - this.compare(listModel, synchList); - - collectionHolder.remove("foo"); - collectionHolder.remove("jar"); - collectionHolder.remove("harry"); - collectionHolder.remove(null); - assertEquals(6, synchList.size()); - this.compare(listModel, synchList); - } - - public void testListSynchronization() { - SimpleListValueModel listHolder = this.buildListHolder(); - ListModel listModel = this.buildListModel(listHolder); - CoordinatedList synchList = new CoordinatedList(listModel); - assertEquals(6, synchList.size()); - this.compare(listModel, synchList); - - listHolder.add(6, "tom"); - listHolder.add(7, "dick"); - listHolder.add(8, "harry"); - listHolder.add(9, null); - assertEquals(10, synchList.size()); - this.compare(listModel, synchList); - - listHolder.remove(9); - listHolder.remove(8); - listHolder.remove(4); - listHolder.remove(0); - assertEquals(6, synchList.size()); - this.compare(listModel, synchList); - } - - public void testSetModel() { - SimpleListValueModel listHolder1 = this.buildListHolder(); - ListModelAdapter listModel = this.buildListModel(listHolder1); - CoordinatedList synchList = new CoordinatedList(listModel); - assertTrue(listHolder1.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - assertEquals(6, synchList.size()); - this.compare(listModel, synchList); - - SimpleListValueModel listHolder2 = this.buildListHolder2(); - listModel.setModel(listHolder2); - assertEquals(3, synchList.size()); - this.compare(listModel, synchList); - assertTrue(listHolder1.hasNoListChangeListeners(ListValueModel.LIST_VALUES)); - assertTrue(listHolder2.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - listModel.setModel(new SimpleListValueModel()); - assertEquals(0, synchList.size()); - this.compare(listModel, synchList); - assertTrue(listHolder1.hasNoListChangeListeners(ListValueModel.LIST_VALUES)); - assertTrue(listHolder2.hasNoListChangeListeners(ListValueModel.LIST_VALUES)); - } - - private void compare(ListModel listModel, List list) { - assertEquals(listModel.getSize(), list.size()); - for (int i = 0; i < listModel.getSize(); i++) { - assertEquals(listModel.getElementAt(i), list.get(i)); - } - } - - public void testCollectionSort() { - this.verifyCollectionSort(null); - } - - public void testListSort() { - this.verifyListSort(null); - } - - public void testCustomCollectionSort() { - this.verifyCollectionSort(this.buildCustomComparator()); - } - - public void testCustomListSort() { - this.verifyListSort(this.buildCustomComparator()); - } - - private Comparator buildCustomComparator() { - // sort with reverse order - return new Comparator() { - public int compare(String s1, String s2) { - return s2.compareTo(s1); - } - }; - } - - private void verifyCollectionSort(Comparator comparator) { - SimpleCollectionValueModel collectionHolder = this.buildCollectionHolder(); - ListModel listModel = this.buildListModel(new SortedListValueModelAdapter(collectionHolder, comparator)); - CoordinatedList synchList = new CoordinatedList(listModel); - assertEquals(6, synchList.size()); - this.compareSort(listModel, synchList, comparator); - - collectionHolder.add("tom"); - collectionHolder.add("dick"); - collectionHolder.add("harry"); - assertEquals(9, synchList.size()); - this.compareSort(listModel, synchList, comparator); - - collectionHolder.remove("foo"); - collectionHolder.remove("jar"); - collectionHolder.remove("harry"); - assertEquals(6, synchList.size()); - this.compareSort(listModel, synchList, comparator); - } - - private void verifyListSort(Comparator comparator) { - SimpleListValueModel listHolder = this.buildListHolder(); - ListModel listModel = this.buildListModel(new SortedListValueModelWrapper(listHolder, comparator)); - CoordinatedList synchList = new CoordinatedList(listModel); - assertEquals(6, synchList.size()); - this.compareSort(listModel, synchList, comparator); - - listHolder.add(0, "tom"); - listHolder.add(0, "dick"); - listHolder.add(0, "harry"); - assertEquals(9, synchList.size()); - this.compareSort(listModel, synchList, comparator); - - listHolder.remove(8); - listHolder.remove(4); - listHolder.remove(0); - listHolder.remove(5); - assertEquals(5, synchList.size()); - this.compareSort(listModel, synchList, comparator); - } - - private void compareSort(ListModel listModel, List list, Comparator comparator) { - SortedSet ss = new TreeSet(comparator); - for (int i = 0; i < listModel.getSize(); i++) { - ss.add((String) listModel.getElementAt(i)); - } - assertEquals(ss.size(), list.size()); - for (Iterator stream1 = ss.iterator(), stream2 = list.iterator(); stream1.hasNext(); ) { - assertEquals(stream1.next(), stream2.next()); - } - } - - public void testHasListeners() throws Exception { - SimpleListValueModel listHolder = this.buildListHolder(); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - - ListModel listModel = this.buildListModel(listHolder); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - this.verifyHasNoListeners(listModel); - - CoordinatedList synchList = new CoordinatedList(listModel); - assertTrue(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - this.verifyHasListeners(listModel); - - listModel.removeListDataListener(synchList); - assertFalse(listHolder.hasAnyListChangeListeners(ListValueModel.LIST_VALUES)); - this.verifyHasNoListeners(listModel); - } - - public void testGetSize() throws Exception { - SimpleListValueModel listHolder = this.buildListHolder(); - ListModel listModel = this.buildListModel(listHolder); - this.verifyHasNoListeners(listModel); - assertEquals(6, listModel.getSize()); - - CoordinatedList synchList = new CoordinatedList(listModel); - this.verifyHasListeners(listModel); - assertEquals(6, listModel.getSize()); - - listModel.removeListDataListener(synchList); - this.verifyHasNoListeners(listModel); - assertEquals(6, listModel.getSize()); - } - - public void testGetElementAt() throws Exception { - SimpleListValueModel listHolder = this.buildListHolder(); - ListModel listModel = this.buildListModel(new SortedListValueModelWrapper(listHolder)); - CoordinatedList synchList = new CoordinatedList(listModel); - this.verifyHasListeners(listModel); - assertEquals("bar", listModel.getElementAt(0)); - assertEquals("bar", synchList.get(0)); - } - - private void verifyHasNoListeners(ListModel listModel) throws Exception { - boolean hasNoListeners = ((Boolean) ReflectionTools.executeMethod(listModel, "hasNoListDataListeners")).booleanValue(); - assertTrue(hasNoListeners); - } - - private void verifyHasListeners(ListModel listModel) throws Exception { - boolean hasListeners = ((Boolean) ReflectionTools.executeMethod(listModel, "hasListDataListeners")).booleanValue(); - assertTrue(hasListeners); - } - - private SimpleCollectionValueModel buildCollectionHolder() { - return new SimpleCollectionValueModel(this.buildCollection()); - } - - private Collection buildCollection() { - Bag bag = new HashBag(); - this.populateCollection(bag); - return bag; - } - - private SimpleListValueModel buildListHolder() { - return new SimpleListValueModel(this.buildList()); - } - - private List buildList() { - List list = new ArrayList(); - this.populateCollection(list); - return list; - } - - private void populateCollection(Collection c) { - c.add("foo"); - c.add("bar"); - c.add("baz"); - c.add("joo"); - c.add("jar"); - c.add("jaz"); - } - - private SimpleListValueModel buildListHolder2() { - return new SimpleListValueModel(this.buildList2()); - } - - private List buildList2() { - List list = new ArrayList(); - this.populateCollection2(list); - return list; - } - - private void populateCollection2(Collection c) { - c.add("tom"); - c.add("dick"); - c.add("harry"); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ListModelAdapterUITest.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ListModelAdapterUITest.java deleted file mode 100644 index 17fd76236d..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ListModelAdapterUITest.java +++ /dev/null @@ -1,370 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.GridLayout; -import java.awt.TextField; -import java.awt.event.ActionEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.Date; -import java.util.List; -import java.util.ListIterator; - -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.Icon; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JLabel; -import javax.swing.JList; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.ListModel; -import javax.swing.WindowConstants; - -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelWrapper; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ListModelAdapter; -import org.eclipse.jpt.common.utility.internal.swing.Displayable; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * an example UI for testing various permutations of the ListModelAdapter - */ -@SuppressWarnings("nls") -public class ListModelAdapterUITest { - - private WritablePropertyValueModel taskListHolder; - private TextField taskTextField; - - public static void main(String[] args) throws Exception { - new ListModelAdapterUITest().exec(args); - } - - private ListModelAdapterUITest() { - super(); - } - - private void exec(@SuppressWarnings("unused") String[] args) throws Exception { - this.taskListHolder = new SimplePropertyValueModel(new TaskList()); - this.openWindow(); - } - - private void openWindow() { - JFrame window = new JFrame(this.getClass().getName()); - window.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - window.addWindowListener(this.buildWindowListener()); - window.getContentPane().add(this.buildMainPanel(), "Center"); - window.setSize(800, 400); - window.setVisible(true); - } - - private WindowListener buildWindowListener() { - return new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - e.getWindow().setVisible(false); - System.exit(0); - } - }; - } - - private Component buildMainPanel() { - JPanel mainPanel = new JPanel(new BorderLayout()); - mainPanel.add(this.buildTaskListPanel(), BorderLayout.CENTER); - mainPanel.add(this.buildControlPanel(), BorderLayout.SOUTH); - return mainPanel; - } - - private Component buildTaskListPanel() { - JPanel taskListPanel = new JPanel(new GridLayout(0, 1)); - taskListPanel.add(this.buildPrimitiveTaskListPanel()); - taskListPanel.add(this.buildDisplayableTaskListPanel()); - return taskListPanel; - } - - private Component buildPrimitiveTaskListPanel() { - JPanel taskListPanel = new JPanel(new GridLayout(1, 0)); - taskListPanel.add(this.buildUnsortedPrimitiveListPanel()); - taskListPanel.add(this.buildStandardSortedPrimitiveListPanel()); - taskListPanel.add(this.buildCustomSortedPrimitiveListPanel()); - return taskListPanel; - } - - private Component buildDisplayableTaskListPanel() { - JPanel taskListPanel = new JPanel(new GridLayout(1, 0)); - taskListPanel.add(this.buildUnsortedDisplayableListPanel()); - taskListPanel.add(this.buildStandardSortedDisplayableListPanel()); - taskListPanel.add(this.buildCustomSortedDisplayableListPanel()); - return taskListPanel; - } - - private Component buildUnsortedPrimitiveListPanel() { - return this.buildListPanel("primitive unsorted", this.buildUnsortedPrimitiveListModel()); - } - - private Component buildStandardSortedPrimitiveListPanel() { - return this.buildListPanel("primitive sorted", this.buildStandardSortedPrimitiveListModel()); - } - - private Component buildCustomSortedPrimitiveListPanel() { - return this.buildListPanel("primitive reverse sorted", this.buildCustomSortedPrimitiveListModel()); - } - - private Component buildUnsortedDisplayableListPanel() { - return this.buildListPanel("displayable unsorted", this.buildUnsortedDisplayableListModel()); - } - - private Component buildStandardSortedDisplayableListPanel() { - return this.buildListPanel("displayable sorted", this.buildStandardSortedDisplayableListModel()); - } - - private Component buildCustomSortedDisplayableListPanel() { - return this.buildListPanel("displayable reverse sorted", this.buildCustomSortedDisplayableListModel()); - } - - private ListModel buildUnsortedPrimitiveListModel() { - return new ListModelAdapter(this.buildPrimitiveTaskListAdapter()); - } - - private ListModel buildStandardSortedPrimitiveListModel() { - return new ListModelAdapter(new SortedListValueModelWrapper(this.buildPrimitiveTaskListAdapter())); - } - - private ListModel buildCustomSortedPrimitiveListModel() { - return new ListModelAdapter(new SortedListValueModelWrapper(this.buildPrimitiveTaskListAdapter(), this.buildCustomStringComparator())); - } - - private ListModel buildUnsortedDisplayableListModel() { - return new ListModelAdapter(this.buildDisplayableTaskListAdapter()); - } - - private ListModel buildStandardSortedDisplayableListModel() { - return new ListModelAdapter(new SortedListValueModelWrapper(this.buildDisplayableTaskListAdapter())); - } - - private ListModel buildCustomSortedDisplayableListModel() { - return new ListModelAdapter(new SortedListValueModelWrapper(this.buildDisplayableTaskListAdapter(), this.buildCustomTaskObjectComparator())); - } - - private Component buildListPanel(String label, ListModel listModel) { - JPanel listPanel = new JPanel(new BorderLayout()); - JLabel listLabel = new JLabel(" " + label); - listPanel.add(listLabel, BorderLayout.NORTH); - - JList listBox = new JList(); - listBox.setModel(listModel); - listBox.setDoubleBuffered(true); - listLabel.setLabelFor(listBox); - listPanel.add(new JScrollPane(listBox), BorderLayout.CENTER); - return listPanel; - } - - private Comparator buildCustomStringComparator() { - return new Comparator() { - public int compare(String s1, String s2) { - return s2.compareTo(s1); - } - }; - } - - private Comparator buildCustomTaskObjectComparator() { - return new Comparator() { - public int compare(Task to1, Task to2) { - return to2.displayString().compareTo(to1.displayString()); - } - }; - } - - private ListValueModel buildPrimitiveTaskListAdapter() { - return new ListAspectAdapter(TaskList.TASK_NAMES_LIST, this.taskList()) { - @Override - protected ListIterator listIterator_() { - return this.subject.taskNames(); - } - }; - } - - private ListValueModel buildDisplayableTaskListAdapter() { - return new ListAspectAdapter(TaskList.TASKS_LIST, this.taskList()) { - @Override - protected ListIterator listIterator_() { - return this.subject.tasks(); - } - }; - } - - private Component buildControlPanel() { - JPanel controlPanel = new JPanel(new BorderLayout()); - controlPanel.add(this.buildAddRemoveTaskPanel(), BorderLayout.CENTER); - controlPanel.add(this.buildClearButton(), BorderLayout.EAST); - return controlPanel; - } - - private Component buildAddRemoveTaskPanel() { - JPanel addRemoveTaskPanel = new JPanel(new BorderLayout()); - addRemoveTaskPanel.add(this.buildAddButton(), BorderLayout.WEST); - addRemoveTaskPanel.add(this.buildTaskTextField(), BorderLayout.CENTER); - addRemoveTaskPanel.add(this.buildRemoveButton(), BorderLayout.EAST); - return addRemoveTaskPanel; - } - - private String getTask() { - return this.taskTextField.getText(); - } - - private TaskList taskList() { - return this.taskListHolder.getValue(); - } - - void addTask() { - String task = this.getTask(); - if (task.length() != 0) { - this.taskList().addTask(task); - } - } - - void removeTask() { - String task = this.getTask(); - if (task.length() != 0) { - this.taskList().removeTask(task); - } - } - - void clearTasks() { - this.taskList().clearTasks(); - } - - private TextField buildTaskTextField() { - this.taskTextField = new TextField(); - return this.taskTextField; - } - - private JButton buildAddButton() { - return new JButton(this.buildAddAction()); - } - - private Action buildAddAction() { - Action action = new AbstractAction("add") { - public void actionPerformed(ActionEvent event) { - ListModelAdapterUITest.this.addTask(); - } - }; - action.setEnabled(true); - return action; - } - - private JButton buildRemoveButton() { - return new JButton(this.buildRemoveAction()); - } - - private Action buildRemoveAction() { - Action action = new AbstractAction("remove") { - public void actionPerformed(ActionEvent event) { - ListModelAdapterUITest.this.removeTask(); - } - }; - action.setEnabled(true); - return action; - } - - private JButton buildClearButton() { - return new JButton(this.buildClearAction()); - } - - private Action buildClearAction() { - Action action = new AbstractAction("clear") { - public void actionPerformed(ActionEvent event) { - ListModelAdapterUITest.this.clearTasks(); - } - }; - action.setEnabled(true); - return action; - } - - public class TaskList extends AbstractModel { - private List taskNames = new ArrayList(); - private List taskObjects = new ArrayList(); - public static final String TASK_NAMES_LIST = "taskNames"; - public static final String TASKS_LIST = "tasks"; - TaskList() { - super(); - } - public ListIterator taskNames() { - return this.taskNames.listIterator(); - } - public ListIterator tasks() { - return this.taskObjects.listIterator(); - } - public void addTask(String taskName) { - int index = this.taskNames.size(); - this.taskNames.add(index, taskName); - this.fireItemAdded(TASK_NAMES_LIST, index, taskName); - - Task taskObject = new Task(taskName); - this.taskObjects.add(index, taskObject); - this.fireItemAdded(TASKS_LIST, index, taskObject); - } - public void removeTask(String taskName) { - int index = this.taskNames.indexOf(taskName); - if (index != -1) { - Object removedTask = this.taskNames.remove(index); - this.fireItemRemoved(TASK_NAMES_LIST, index, removedTask); - // assume the indexes match... - Object removedTaskObject = this.taskObjects.remove(index); - this.fireItemRemoved(TASKS_LIST, index, removedTaskObject); - } - } - public void clearTasks() { - this.taskNames.clear(); - this.fireListChanged(TASK_NAMES_LIST, this.taskNames); - this.taskObjects.clear(); - this.fireListChanged(TASKS_LIST, this.taskObjects); - } - } - - public class Task extends AbstractModel implements Displayable { - private String name; - private Date creationTimeStamp; - public Task(String name) { - this.name = name; - this.creationTimeStamp = new Date(); - } - public String displayString() { - return this.name + ": " + this.creationTimeStamp.getTime(); - } - public Icon icon() { - return null; - } - public String getName() { - return this.name; - } - public void setName(String name) { - Object old = this.name; - this.name = name; - this.firePropertyChanged(DISPLAY_STRING_PROPERTY, old, name); - } - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.displayString()); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ListSpinnerModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ListSpinnerModelAdapterTests.java deleted file mode 100644 index 8260698bf7..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ListSpinnerModelAdapterTests.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import javax.swing.SpinnerModel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ListSpinnerModelAdapter; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class ListSpinnerModelAdapterTests extends TestCase { - private WritablePropertyValueModel valueHolder; - private SpinnerModel spinnerModelAdapter; - boolean eventFired; - private static final String[] VALUE_LIST = {"red", "green", "blue"}; - private static final String DEFAULT_VALUE = VALUE_LIST[0]; - - public ListSpinnerModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.valueHolder = new SimplePropertyValueModel(DEFAULT_VALUE); - this.spinnerModelAdapter = new ListSpinnerModelAdapter(this.valueHolder, VALUE_LIST) { - @Override - protected PropertyChangeListener buildValueChangeListener() { - return this.buildValueChangeListener_(); - } - }; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testSetValueSpinnerModel() throws Exception { - this.eventFired = false; - this.spinnerModelAdapter.addChangeListener(new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - ListSpinnerModelAdapterTests.this.eventFired = true; - } - }); - assertEquals(DEFAULT_VALUE, this.valueHolder.getValue()); - this.spinnerModelAdapter.setValue(VALUE_LIST[2]); - assertTrue(this.eventFired); - assertEquals(VALUE_LIST[2], this.valueHolder.getValue()); - } - - public void testSetValueValueHolder() throws Exception { - this.eventFired = false; - this.spinnerModelAdapter.addChangeListener(new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - ListSpinnerModelAdapterTests.this.eventFired = true; - } - }); - assertEquals(DEFAULT_VALUE, this.spinnerModelAdapter.getValue()); - this.valueHolder.setValue(VALUE_LIST[2]); - assertTrue(this.eventFired); - assertEquals(VALUE_LIST[2], this.spinnerModelAdapter.getValue()); - } - - public void testDefaultValue() throws Exception { - this.eventFired = false; - this.spinnerModelAdapter.addChangeListener(new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - ListSpinnerModelAdapterTests.this.eventFired = true; - } - }); - assertEquals(DEFAULT_VALUE, this.spinnerModelAdapter.getValue()); - - this.valueHolder.setValue(VALUE_LIST[2]); - assertTrue(this.eventFired); - assertEquals(VALUE_LIST[2], this.spinnerModelAdapter.getValue()); - - this.eventFired = false; - this.valueHolder.setValue(null); - assertTrue(this.eventFired); - assertEquals(VALUE_LIST[0], this.spinnerModelAdapter.getValue()); - } - - public void testHasListeners() throws Exception { - SimplePropertyValueModel localValueHolder = (SimplePropertyValueModel) this.valueHolder; - assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasNoListeners(this.spinnerModelAdapter); - - ChangeListener listener = new TestChangeListener(); - this.spinnerModelAdapter.addChangeListener(listener); - assertTrue(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasListeners(this.spinnerModelAdapter); - - this.spinnerModelAdapter.removeChangeListener(listener); - assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasNoListeners(this.spinnerModelAdapter); - } - - private void verifyHasNoListeners(SpinnerModel adapter) throws Exception { - assertEquals(0, ((ListSpinnerModelAdapter) adapter).getChangeListeners().length); - } - - private void verifyHasListeners(Object adapter) throws Exception { - assertFalse(((ListSpinnerModelAdapter) adapter).getChangeListeners().length == 0); - } - - - private class TestChangeListener implements ChangeListener { - TestChangeListener() { - super(); - } - public void stateChanged(ChangeEvent e) { - fail("unexpected event"); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/NumberSpinnerModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/NumberSpinnerModelAdapterTests.java deleted file mode 100644 index be5d8e16db..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/NumberSpinnerModelAdapterTests.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import javax.swing.SpinnerModel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.NumberSpinnerModelAdapter; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class NumberSpinnerModelAdapterTests extends TestCase { - private WritablePropertyValueModel valueHolder; - private SpinnerModel spinnerModelAdapter; - boolean eventFired; - - public NumberSpinnerModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.valueHolder = new SimplePropertyValueModel(new Integer(0)); - this.spinnerModelAdapter = new NumberSpinnerModelAdapter(this.valueHolder, -33, 33, 1) { - @Override - protected PropertyChangeListener buildNumberChangeListener() { - return this.buildNumberChangeListener_(); - } - }; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testSetValueSpinnerModel() throws Exception { - this.eventFired = false; - this.spinnerModelAdapter.addChangeListener(new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - NumberSpinnerModelAdapterTests.this.eventFired = true; - } - }); - this.spinnerModelAdapter.setValue(new Integer(5)); - assertTrue(this.eventFired); - assertEquals(new Integer(5), this.valueHolder.getValue()); - } - - public void testSetValueValueHolder() throws Exception { - this.eventFired = false; - this.spinnerModelAdapter.addChangeListener(new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - NumberSpinnerModelAdapterTests.this.eventFired = true; - } - }); - assertEquals(new Integer(0), this.spinnerModelAdapter.getValue()); - this.valueHolder.setValue(new Integer(7)); - assertTrue(this.eventFired); - assertEquals(new Integer(7), this.spinnerModelAdapter.getValue()); - } - - public void testDefaultValue() throws Exception { - this.eventFired = false; - this.spinnerModelAdapter.addChangeListener(new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - NumberSpinnerModelAdapterTests.this.eventFired = true; - } - }); - assertEquals(new Integer(0), this.spinnerModelAdapter.getValue()); - this.valueHolder.setValue(null); - assertTrue(this.eventFired); - assertEquals(new Integer(-33), this.spinnerModelAdapter.getValue()); - } - - public void testHasListeners() throws Exception { - SimplePropertyValueModel localValueHolder = (SimplePropertyValueModel) this.valueHolder; - assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasNoListeners(this.spinnerModelAdapter); - - ChangeListener listener = new TestChangeListener(); - this.spinnerModelAdapter.addChangeListener(listener); - assertTrue(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasListeners(this.spinnerModelAdapter); - - this.spinnerModelAdapter.removeChangeListener(listener); - assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasNoListeners(this.spinnerModelAdapter); - } - - private void verifyHasNoListeners(SpinnerModel adapter) throws Exception { - assertEquals(0, ((NumberSpinnerModelAdapter) adapter).getChangeListeners().length); - } - - private void verifyHasListeners(Object adapter) throws Exception { - assertFalse(((NumberSpinnerModelAdapter) adapter).getChangeListeners().length == 0); - } - - public void testNullInitialValue() { - this.valueHolder = new SimplePropertyValueModel(); - this.spinnerModelAdapter = new NumberSpinnerModelAdapter(this.valueHolder, new Integer(-33), new Integer(33), new Integer(1), new Integer(0)) { - @Override - protected PropertyChangeListener buildNumberChangeListener() { - return this.buildNumberChangeListener_(); - } - }; - - this.eventFired = false; - this.spinnerModelAdapter.addChangeListener(new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - NumberSpinnerModelAdapterTests.this.eventFired = true; - } - }); - assertEquals(new Integer(0), this.spinnerModelAdapter.getValue()); - this.valueHolder.setValue(new Integer(7)); - assertTrue(this.eventFired); - assertEquals(new Integer(7), this.spinnerModelAdapter.getValue()); - } - - - // ********** inner class ********** - private class TestChangeListener implements ChangeListener { - TestChangeListener() { - super(); - } - public void stateChanged(ChangeEvent e) { - fail("unexpected event"); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ObjectListSelectionModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ObjectListSelectionModelTests.java deleted file mode 100644 index 4f55864415..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ObjectListSelectionModelTests.java +++ /dev/null @@ -1,205 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import javax.swing.DefaultListModel; -import javax.swing.ListModel; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ObjectListSelectionModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class ObjectListSelectionModelTests extends TestCase { - private DefaultListModel listModel; - private ObjectListSelectionModel selectionModel; - - public ObjectListSelectionModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.listModel = this.buildListModel(); - this.selectionModel = this.buildSelectionModel(this.listModel); - } - - private DefaultListModel buildListModel() { - DefaultListModel lm = new DefaultListModel(); - lm.addElement("foo"); - lm.addElement("bar"); - lm.addElement("baz"); - return lm; - } - - private ObjectListSelectionModel buildSelectionModel(ListModel lm) { - return new ObjectListSelectionModel(lm); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testListDataListener() { - this.selectionModel.addListSelectionListener(this.buildListSelectionListener()); - this.selectionModel.setSelectionInterval(0, 0); - assertEquals("foo", this.selectionModel.selectedValue()); - this.listModel.set(0, "jar"); - assertEquals("jar", this.selectionModel.selectedValue()); - } - - public void testGetSelectedValue() { - this.selectionModel.setSelectionInterval(0, 0); - assertEquals("foo", this.selectionModel.selectedValue()); - } - - public void testGetSelectedValues() { - this.selectionModel.setSelectionInterval(0, 0); - this.selectionModel.addSelectionInterval(2, 2); - assertEquals(2, this.selectionModel.selectedValues().length); - assertTrue(ArrayTools.contains(this.selectionModel.selectedValues(), "foo")); - assertTrue(ArrayTools.contains(this.selectionModel.selectedValues(), "baz")); - } - - public void testSetSelectedValue() { - this.selectionModel.setSelectedValue("foo"); - assertEquals(0, this.selectionModel.getMinSelectionIndex()); - assertEquals(0, this.selectionModel.getMaxSelectionIndex()); - } - - public void testSetSelectedValues() { - this.selectionModel.setSelectedValues(new Object[] {"foo", "baz"}); - assertEquals(0, this.selectionModel.getMinSelectionIndex()); - assertEquals(2, this.selectionModel.getMaxSelectionIndex()); - } - - public void testAddSelectedValue() { - this.listModel.addElement("joo"); - this.listModel.addElement("jar"); - this.listModel.addElement("jaz"); - this.selectionModel.setSelectedValue("foo"); - this.selectionModel.addSelectedValue("jaz"); - assertEquals(0, this.selectionModel.getMinSelectionIndex()); - assertEquals(5, this.selectionModel.getMaxSelectionIndex()); - assertTrue(this.selectionModel.isSelectedIndex(0)); - assertFalse(this.selectionModel.isSelectedIndex(1)); - assertFalse(this.selectionModel.isSelectedIndex(2)); - assertFalse(this.selectionModel.isSelectedIndex(3)); - assertFalse(this.selectionModel.isSelectedIndex(4)); - assertTrue(this.selectionModel.isSelectedIndex(5)); - } - - public void testAddSelectedValues() { - this.listModel.addElement("joo"); - this.listModel.addElement("jar"); - this.listModel.addElement("jaz"); - this.selectionModel.setSelectedValue("foo"); - this.selectionModel.addSelectedValues(new Object[] {"bar", "jar"}); - assertEquals(0, this.selectionModel.getMinSelectionIndex()); - assertEquals(4, this.selectionModel.getMaxSelectionIndex()); - assertTrue(this.selectionModel.isSelectedIndex(0)); - assertTrue(this.selectionModel.isSelectedIndex(1)); - assertFalse(this.selectionModel.isSelectedIndex(2)); - assertFalse(this.selectionModel.isSelectedIndex(3)); - assertTrue(this.selectionModel.isSelectedIndex(4)); - assertFalse(this.selectionModel.isSelectedIndex(5)); - } - - public void testRemoveSelectedValue() { - this.listModel.addElement("joo"); - this.listModel.addElement("jar"); - this.listModel.addElement("jaz"); - this.selectionModel.setSelectedValues(new Object[] {"foo", "baz", "jar"}); - this.selectionModel.removeSelectedValue("jar"); - assertEquals(0, this.selectionModel.getMinSelectionIndex()); - assertEquals(2, this.selectionModel.getMaxSelectionIndex()); - assertTrue(this.selectionModel.isSelectedIndex(0)); - assertFalse(this.selectionModel.isSelectedIndex(1)); - assertTrue(this.selectionModel.isSelectedIndex(2)); - assertFalse(this.selectionModel.isSelectedIndex(3)); - assertFalse(this.selectionModel.isSelectedIndex(4)); - assertFalse(this.selectionModel.isSelectedIndex(5)); - } - - public void testRemoveSelectedValues() { - this.listModel.addElement("joo"); - this.listModel.addElement("jar"); - this.listModel.addElement("jaz"); - this.selectionModel.setSelectedValues(new Object[] {"foo", "baz", "joo", "jar"}); - this.selectionModel.removeSelectedValues(new Object[] {"foo", "joo"}); - assertEquals(2, this.selectionModel.getMinSelectionIndex()); - assertEquals(4, this.selectionModel.getMaxSelectionIndex()); - assertFalse(this.selectionModel.isSelectedIndex(0)); - assertFalse(this.selectionModel.isSelectedIndex(1)); - assertTrue(this.selectionModel.isSelectedIndex(2)); - assertFalse(this.selectionModel.isSelectedIndex(3)); - assertTrue(this.selectionModel.isSelectedIndex(4)); - assertFalse(this.selectionModel.isSelectedIndex(5)); - } - - public void testGetAnchorSelectedValue() { - this.selectionModel.setAnchorSelectionIndex(1); - assertEquals("bar", this.selectionModel.getAnchorSelectedValue()); - } - - public void testGetLeadSelectedValue() { - this.selectionModel.setSelectedValue("bar"); - assertEquals("bar", this.selectionModel.getLeadSelectedValue()); - this.selectionModel.setSelectedValues(new Object[] {"foo", "baz"}); - assertEquals("baz", this.selectionModel.getLeadSelectedValue()); - } - - public void testGetMinMaxSelectedValue() { - this.listModel.addElement("joo"); - this.listModel.addElement("jar"); - this.listModel.addElement("jaz"); - this.selectionModel.setSelectedValue("foo"); - this.selectionModel.addSelectedValues(new Object[] {"bar", "jar"}); - assertEquals("foo", this.selectionModel.getMinSelectedValue()); - assertEquals("jar", this.selectionModel.getMaxSelectedValue()); - } - - public void testValueIsSelected() { - this.listModel.addElement("joo"); - this.listModel.addElement("jar"); - this.listModel.addElement("jaz"); - this.selectionModel.setSelectedValue("foo"); - this.selectionModel.addSelectedValues(new Object[] {"bar", "jar"}); - assertTrue(this.selectionModel.valueIsSelected("foo")); - assertTrue(this.selectionModel.valueIsSelected("bar")); - assertTrue(this.selectionModel.valueIsSelected("jar")); - assertFalse(this.selectionModel.valueIsSelected("baz")); - } - - public void testHasListeners() throws Exception { - ListSelectionListener listener = this.buildListSelectionListener(); - assertEquals(0, this.listModel.getListDataListeners().length); - this.selectionModel.addListSelectionListener(listener); - assertEquals(1, this.listModel.getListDataListeners().length); - this.selectionModel.removeListSelectionListener(listener); - assertEquals(0, this.listModel.getListDataListeners().length); - } - - private ListSelectionListener buildListSelectionListener() { - return new ListSelectionListener() { - public void valueChanged(ListSelectionEvent e) { - // do nothing for now... - } - }; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/PrimitiveListTreeModelTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/PrimitiveListTreeModelTests.java deleted file mode 100644 index eca1bee8dd..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/PrimitiveListTreeModelTests.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.ListIterator; -import javax.swing.event.TreeModelEvent; -import javax.swing.event.TreeModelListener; -import javax.swing.tree.DefaultMutableTreeNode; -import javax.swing.tree.TreeModel; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyListIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.ListAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.swing.PrimitiveListTreeModel; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class PrimitiveListTreeModelTests extends TestCase { - TestModel testModel; - private TreeModel treeModel; - - public PrimitiveListTreeModelTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.testModel = this.buildTestModel(); - this.treeModel = this.buildTreeModel(); - } - - private TestModel buildTestModel() { - return new TestModel(); - } - - private TreeModel buildTreeModel() { - return new PrimitiveListTreeModel(this.buildListValueModel()) { - @Override - protected void primitiveChanged(int index, Object newValue) { - if ( ! newValue.equals("")) { - PrimitiveListTreeModelTests.this.testModel.replaceName(index, (String) newValue); - } - } - @Override - protected ListChangeListener buildListChangeListener() { - return this.buildListChangeListener_(); - } - }; - } - - private ListValueModel buildListValueModel() { - return new ListAspectAdapter(TestModel.NAMES_LIST, this.testModel) { - @Override - protected ListIterator listIterator_() { - return this.subject.names(); - } - @Override - public String get(int index) { - return this.subject.getName(index); - } - @Override - public int size() { - return this.subject.namesSize(); - } - }; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testAddPrimitive() { - this.treeModel.addTreeModelListener(new TestTreeModelListener() { - @Override - public void treeNodesInserted(TreeModelEvent e) { - PrimitiveListTreeModelTests.this.verifyTreeModelEvent(e, new int[] {0}, new String[] {"foo"}); - } - }); - this.testModel.addName("foo"); - } - - public void testRemovePrimitive() { - this.testModel.addName("foo"); - this.testModel.addName("bar"); - this.testModel.addName("baz"); - this.treeModel.addTreeModelListener(new TestTreeModelListener() { - @Override - public void treeNodesRemoved(TreeModelEvent e) { - PrimitiveListTreeModelTests.this.verifyTreeModelEvent(e, new int[] {1}, new String[] {"bar"}); - } - }); - String name = this.testModel.removeName(1); - assertEquals("bar", name); - } - - public void testReplacePrimitive() { - this.testModel.addName("foo"); - this.testModel.addName("bar"); - this.testModel.addName("baz"); - this.treeModel.addTreeModelListener(new TestTreeModelListener() { - @Override - public void treeNodesChanged(TreeModelEvent e) { - PrimitiveListTreeModelTests.this.verifyTreeModelEvent(e, new int[] {1}, new String[] {"jar"}); - } - }); - String name = this.testModel.replaceName(1, "jar"); - assertEquals("bar", name); - } - - void verifyTreeModelEvent(TreeModelEvent e, int[] expectedChildIndices, String[] expectedNames) { - assertTrue(Arrays.equals(expectedChildIndices, e.getChildIndices())); - Object[] actualChildren = e.getChildren(); - assertEquals(expectedNames.length, actualChildren.length); - for (int i = 0; i < expectedNames.length; i++) { - DefaultMutableTreeNode node = (DefaultMutableTreeNode) actualChildren[i]; - assertEquals(expectedNames[i], node.getUserObject()); - } - assertEquals(1, e.getPath().length); - assertEquals(this.treeModel.getRoot(), e.getPath()[0]); - assertEquals(this.treeModel, e.getSource()); - } - - -// ********** inner classes ********** - - class TestModel extends AbstractModel { - private final List names; - static final String NAMES_LIST = "names"; - - TestModel() { - super(); - this.names = new ArrayList(); - } - - public ListIterator names() { - return new ReadOnlyListIterator(this.names); - } - public int namesSize() { - return this.names.size(); - } - public String getName(int index) { - return this.names.get(index); - } - public void addName(int index, String name) { - this.addItemToList(index, name, this.names, NAMES_LIST); - } - public void addName(String name) { - this.addName(this.namesSize(), name); - } - public void addNames(int index, List list) { - this.addItemsToList(index, this.names, list, NAMES_LIST); - } - public void addNames(List list) { - this.addNames(this.namesSize(), list); - } - public String removeName(int index) { - return this.removeItemFromList(index, this.names, NAMES_LIST); - } - public List removeNames(int index, int length) { - return this.removeItemsFromList(index, length, this.names, NAMES_LIST); - } - public String replaceName(int index, String newName) { - return this.setItemInList(index, newName, this.names, NAMES_LIST); - } - } - - - public class TestTreeModelListener implements TreeModelListener { - public void treeNodesChanged(TreeModelEvent e) { - fail("unexpected event"); - } - public void treeNodesInserted(TreeModelEvent e) { - fail("unexpected event"); - } - public void treeNodesRemoved(TreeModelEvent e) { - fail("unexpected event"); - } - public void treeStructureChanged(TreeModelEvent e) { - fail("unexpected event"); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/RadioButtonModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/RadioButtonModelAdapterTests.java deleted file mode 100644 index edd9e93504..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/RadioButtonModelAdapterTests.java +++ /dev/null @@ -1,230 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import javax.swing.ButtonModel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import javax.swing.event.EventListenerList; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.RadioButtonModelAdapter; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class RadioButtonModelAdapterTests extends TestCase { - private WritablePropertyValueModel valueHolder; - - private ButtonModel redButtonModelAdapter; - private ChangeListener redListener; - boolean redEventFired; - - private ButtonModel greenButtonModelAdapter; - private ChangeListener greenListener; - boolean greenEventFired; - - private ButtonModel blueButtonModelAdapter; - private ChangeListener blueListener; - boolean blueEventFired; - -// private ButtonGroup buttonGroup; // DO NOT use a ButtonGroup - - private static final String RED = "red"; - private static final String GREEN = "green"; - private static final String BLUE = "blue"; - - public RadioButtonModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.valueHolder = new SimplePropertyValueModel(null); -// buttonGroup = new ButtonGroup(); - - this.redButtonModelAdapter = this.buildButtonModel(this.valueHolder, RED); -// this.redButtonModelAdapter.setGroup(buttonGroup); - this.redListener = new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - RadioButtonModelAdapterTests.this.redEventFired = true; - } - }; - - this.greenButtonModelAdapter = this.buildButtonModel(this.valueHolder, GREEN); -// this.greenButtonModelAdapter.setGroup(buttonGroup); - this.greenListener = new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - RadioButtonModelAdapterTests.this.greenEventFired = true; - } - }; - - this.blueButtonModelAdapter = this.buildButtonModel(this.valueHolder, BLUE); -// this.blueButtonModelAdapter.setGroup(buttonGroup); - this.blueListener = new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - RadioButtonModelAdapterTests.this.blueEventFired = true; - } - }; - - this.clearFlags(); - } - - private ButtonModel buildButtonModel(WritablePropertyValueModel pvm, Object buttonValue) { - return new RadioButtonModelAdapter(pvm, buttonValue) { - @Override - protected PropertyChangeListener buildBooleanChangeListener() { - return this.buildBooleanChangeListener_(); - } - }; - } - - private void listenToModelAdapters() { - this.redButtonModelAdapter.addChangeListener(this.redListener); - this.greenButtonModelAdapter.addChangeListener(this.greenListener); - this.blueButtonModelAdapter.addChangeListener(this.blueListener); - } - - private void clearFlags() { - this.redEventFired = false; - this.greenEventFired = false; - this.blueEventFired = false; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testSetSelected() throws Exception { - this.listenToModelAdapters(); - - this.greenButtonModelAdapter.setSelected(true); - assertFalse(this.redEventFired); - assertTrue(this.greenEventFired); - assertFalse(this.blueEventFired); - assertEquals(GREEN, this.valueHolder.getValue()); - - this.clearFlags(); - this.blueButtonModelAdapter.setSelected(true); - assertFalse(this.redEventFired); - assertTrue(this.greenEventFired); - assertTrue(this.blueEventFired); - assertEquals(BLUE, this.valueHolder.getValue()); - - this.clearFlags(); - this.redButtonModelAdapter.setSelected(true); - assertTrue(this.redEventFired); - assertFalse(this.greenEventFired); - assertTrue(this.blueEventFired); - assertEquals(RED, this.valueHolder.getValue()); - } - - public void testSetValue() throws Exception { - this.listenToModelAdapters(); - - this.greenButtonModelAdapter.setSelected(true); - - this.clearFlags(); - this.valueHolder.setValue(BLUE); - assertFalse(this.redEventFired); - assertTrue(this.greenEventFired); - assertTrue(this.blueEventFired); - assertFalse(this.redButtonModelAdapter.isSelected()); - assertFalse(this.greenButtonModelAdapter.isSelected()); - assertTrue(this.blueButtonModelAdapter.isSelected()); - - this.clearFlags(); - this.valueHolder.setValue(RED); - assertTrue(this.redEventFired); - assertFalse(this.greenEventFired); - assertTrue(this.blueEventFired); - assertTrue(this.redButtonModelAdapter.isSelected()); - assertFalse(this.greenButtonModelAdapter.isSelected()); - assertFalse(this.blueButtonModelAdapter.isSelected()); - } - - public void testDefaultValue() throws Exception { - this.listenToModelAdapters(); - - this.valueHolder.setValue(GREEN); - assertFalse(this.redButtonModelAdapter.isSelected()); - assertTrue(this.greenButtonModelAdapter.isSelected()); - assertFalse(this.blueButtonModelAdapter.isSelected()); - - this.clearFlags(); - this.valueHolder.setValue(null); - assertFalse(this.redEventFired); - assertTrue(this.greenEventFired); - assertFalse(this.blueEventFired); - assertFalse(this.redButtonModelAdapter.isSelected()); - assertFalse(this.greenButtonModelAdapter.isSelected()); - assertFalse(this.blueButtonModelAdapter.isSelected()); - - this.clearFlags(); - this.valueHolder.setValue(BLUE); - assertFalse(this.redEventFired); - assertFalse(this.greenEventFired); - assertTrue(this.blueEventFired); - assertFalse(this.redButtonModelAdapter.isSelected()); - assertFalse(this.greenButtonModelAdapter.isSelected()); - assertTrue(this.blueButtonModelAdapter.isSelected()); - } - - public void testHasListeners() throws Exception { - SimplePropertyValueModel localValueHolder = (SimplePropertyValueModel) this.valueHolder; - assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasNoListeners(this.redButtonModelAdapter); - this.verifyHasNoListeners(this.greenButtonModelAdapter); - this.verifyHasNoListeners(this.blueButtonModelAdapter); - - ChangeListener listener = new TestChangeListener(); - this.redButtonModelAdapter.addChangeListener(listener); - assertTrue(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasListeners(this.redButtonModelAdapter); - this.verifyHasNoListeners(this.greenButtonModelAdapter); - this.verifyHasNoListeners(this.blueButtonModelAdapter); - - this.redButtonModelAdapter.removeChangeListener(listener); - assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasNoListeners(this.redButtonModelAdapter); - this.verifyHasNoListeners(this.greenButtonModelAdapter); - this.verifyHasNoListeners(this.blueButtonModelAdapter); - } - - private void verifyHasNoListeners(Object model) throws Exception { - EventListenerList listenerList = (EventListenerList) ReflectionTools.getFieldValue(model, "listenerList"); - assertEquals(0, listenerList.getListenerList().length); - } - - private void verifyHasListeners(Object model) throws Exception { - EventListenerList listenerList = (EventListenerList) ReflectionTools.getFieldValue(model, "listenerList"); - assertFalse(listenerList.getListenerList().length == 0); - } - - - private class TestChangeListener implements ChangeListener { - TestChangeListener() { - super(); - } - public void stateChanged(ChangeEvent e) { - fail("unexpected event"); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/RadioButtonModelAdapterUITest.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/RadioButtonModelAdapterUITest.java deleted file mode 100644 index 0b4ff59108..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/RadioButtonModelAdapterUITest.java +++ /dev/null @@ -1,260 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; - -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.ButtonModel; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JRadioButton; -import javax.swing.WindowConstants; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.RadioButtonModelAdapter; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - - -/** - * Play around with a set of radio buttons. - */ -@SuppressWarnings("nls") -public class RadioButtonModelAdapterUITest { - - private TestModel testModel; - private WritablePropertyValueModel testModelHolder; - private WritablePropertyValueModel colorHolder; - private ButtonModel redButtonModel; - private ButtonModel greenButtonModel; - private ButtonModel blueButtonModel; - - public static void main(String[] args) throws Exception { - new RadioButtonModelAdapterUITest().exec(); - } - - private RadioButtonModelAdapterUITest() { - super(); - } - - private void exec() throws Exception { - this.testModel = new TestModel(); - this.testModelHolder = new SimplePropertyValueModel(this.testModel); - this.colorHolder = this.buildColorHolder(this.testModelHolder); - this.redButtonModel = this.buildRadioButtonModelAdapter(this.colorHolder, TestModel.RED); - this.greenButtonModel = this.buildRadioButtonModelAdapter(this.colorHolder, TestModel.GREEN); - this.blueButtonModel = this.buildRadioButtonModelAdapter(this.colorHolder, TestModel.BLUE); - this.openWindow(); - } - - private WritablePropertyValueModel buildColorHolder(PropertyValueModel subjectHolder) { - return new PropertyAspectAdapter(subjectHolder, TestModel.COLOR_PROPERTY) { - @Override - protected Object buildValue_() { - return this.subject.getColor(); - } - @Override - protected void setValue_(Object value) { - this.subject.setColor((String) value); - } - }; - } - - private ButtonModel buildRadioButtonModelAdapter(WritablePropertyValueModel colorPVM, String color) { - return new RadioButtonModelAdapter(colorPVM, color); - } - - private void openWindow() { - JFrame window = new JFrame(this.getClass().getName()); - window.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - window.addWindowListener(this.buildWindowListener()); - window.getContentPane().add(this.buildMainPanel(), "Center"); - window.setSize(400, 100); - window.setLocation(200, 200); - window.setVisible(true); - } - - private WindowListener buildWindowListener() { - return new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - e.getWindow().setVisible(false); - System.exit(0); - } - }; - } - - private Component buildMainPanel() { - JPanel mainPanel = new JPanel(new BorderLayout()); - mainPanel.add(this.buildRadioButtonPanel(), BorderLayout.NORTH); - mainPanel.add(this.buildControlPanel(), BorderLayout.SOUTH); - return mainPanel; - } - - private Component buildRadioButtonPanel() { - JPanel taskListPanel = new JPanel(new GridLayout(1, 0)); - taskListPanel.add(this.buildRedRadioButton()); - taskListPanel.add(this.buildGreenRadioButton()); - taskListPanel.add(this.buildBlueRadioButton()); - return taskListPanel; - } - - private JRadioButton buildRedRadioButton() { - JRadioButton radioButton = new JRadioButton(); - radioButton.setText("red"); - radioButton.setModel(this.redButtonModel); - return radioButton; - } - - private JRadioButton buildGreenRadioButton() { - JRadioButton radioButton = new JRadioButton(); - radioButton.setText("green"); - radioButton.setModel(this.greenButtonModel); - return radioButton; - } - - private JRadioButton buildBlueRadioButton() { - JRadioButton radioButton = new JRadioButton(); - radioButton.setText("blue"); - radioButton.setModel(this.blueButtonModel); - return radioButton; - } - - private Component buildControlPanel() { - JPanel controlPanel = new JPanel(new GridLayout(1, 0)); - controlPanel.add(this.buildResetColorButton()); - controlPanel.add(this.buildClearModelButton()); - controlPanel.add(this.buildRestoreModelButton()); - controlPanel.add(this.buildPrintModelButton()); - return controlPanel; - } - - private JButton buildResetColorButton() { - return new JButton(this.buildResetColorAction()); - } - - private Action buildResetColorAction() { - Action action = new AbstractAction("reset color") { - public void actionPerformed(ActionEvent event) { - RadioButtonModelAdapterUITest.this.resetColor(); - } - }; - action.setEnabled(true); - return action; - } - - void resetColor() { - this.testModel.setColor(TestModel.DEFAULT_COLOR); - } - - private JButton buildClearModelButton() { - return new JButton(this.buildClearModelAction()); - } - - private Action buildClearModelAction() { - Action action = new AbstractAction("clear model") { - public void actionPerformed(ActionEvent event) { - RadioButtonModelAdapterUITest.this.clearModel(); - } - }; - action.setEnabled(true); - return action; - } - - void clearModel() { - this.testModelHolder.setValue(null); - } - - private JButton buildRestoreModelButton() { - return new JButton(this.buildRestoreModelAction()); - } - - private Action buildRestoreModelAction() { - Action action = new AbstractAction("restore model") { - public void actionPerformed(ActionEvent event) { - RadioButtonModelAdapterUITest.this.restoreModel(); - } - }; - action.setEnabled(true); - return action; - } - - void restoreModel() { - this.testModelHolder.setValue(this.testModel); - } - - private JButton buildPrintModelButton() { - return new JButton(this.buildPrintModelAction()); - } - - private Action buildPrintModelAction() { - Action action = new AbstractAction("print model") { - public void actionPerformed(ActionEvent event) { - RadioButtonModelAdapterUITest.this.printModel(); - } - }; - action.setEnabled(true); - return action; - } - - void printModel() { - System.out.println(this.testModel); - } - - - private static class TestModel extends AbstractModel { - private String color; - public static final String COLOR_PROPERTY = "color"; - public static final String RED = "red"; - public static final String GREEN = "green"; - public static final String BLUE = "blue"; - public static final String DEFAULT_COLOR = RED; - public static final String[] VALID_COLORS = { - RED, - GREEN, - BLUE - }; - - public TestModel() { - this(DEFAULT_COLOR); - } - public TestModel(String color) { - this.color = color; - } - public String getColor() { - return this.color; - } - public void setColor(String color) { - if ( ! ArrayTools.contains(VALID_COLORS, color)) { - throw new IllegalArgumentException(color); - } - Object old = this.color; - this.color = color; - this.firePropertyChanged(COLOR_PROPERTY, old, color); - } - @Override - public String toString() { - return "TestModel(" + this.color + ")"; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ReadOnlyTableModelAdapterUITest.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ReadOnlyTableModelAdapterUITest.java deleted file mode 100644 index 72cb1d2d31..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/ReadOnlyTableModelAdapterUITest.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2008 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import org.eclipse.jpt.common.utility.internal.model.value.swing.ColumnAdapter; -import org.eclipse.jpt.common.utility.tests.internal.model.value.swing.TableModelAdapterTests.PersonColumnAdapter; - -/** - * Make it easy to test the table model adapter and - * renderers without any editing allowed. - */ -public class ReadOnlyTableModelAdapterUITest extends TableModelAdapterUITest { - - public static void main(String[] args) throws Exception { - new ReadOnlyTableModelAdapterUITest().exec(args); - } - - protected ReadOnlyTableModelAdapterUITest() { - super(); - } - - @Override - protected ColumnAdapter buildColumnAdapter() { - return new PersonColumnAdapter() { - @Override - public boolean columnIsEditable(int index) { - return false; - } - }; - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/SpinnerModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/SpinnerModelAdapterTests.java deleted file mode 100644 index 76a1c158f4..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/SpinnerModelAdapterTests.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import javax.swing.SpinnerModel; -import javax.swing.event.ChangeEvent; -import javax.swing.event.ChangeListener; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.SpinnerModelAdapter; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class SpinnerModelAdapterTests extends TestCase { - private WritablePropertyValueModel valueHolder; - SpinnerModel spinnerModelAdapter; - boolean eventFired; - - public SpinnerModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.valueHolder = new SimplePropertyValueModel(new Integer(0)); - this.spinnerModelAdapter = new SpinnerModelAdapter(this.valueHolder) { - @Override - protected PropertyChangeListener buildValueListener() { - return this.buildValueListener_(); - } - }; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testSetValueSpinnerModel() throws Exception { - this.eventFired = false; - this.spinnerModelAdapter.addChangeListener(new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - SpinnerModelAdapterTests.this.eventFired = true; - assertEquals(SpinnerModelAdapterTests.this.spinnerModelAdapter, e.getSource()); - } - }); - this.spinnerModelAdapter.setValue(new Integer(5)); - assertTrue(this.eventFired); - assertEquals(new Integer(5), this.valueHolder.getValue()); - } - - public void testSetValueValueHolder() throws Exception { - this.eventFired = false; - this.spinnerModelAdapter.addChangeListener(new TestChangeListener() { - @Override - public void stateChanged(ChangeEvent e) { - SpinnerModelAdapterTests.this.eventFired = true; - assertEquals(SpinnerModelAdapterTests.this.spinnerModelAdapter, e.getSource()); - } - }); - assertEquals(new Integer(0), this.spinnerModelAdapter.getValue()); - this.valueHolder.setValue(new Integer(7)); - assertTrue(this.eventFired); - assertEquals(new Integer(7), this.spinnerModelAdapter.getValue()); - } - - public void testHasListeners() throws Exception { - SimplePropertyValueModel localValueHolder = (SimplePropertyValueModel) this.valueHolder; - assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasNoListeners(this.spinnerModelAdapter); - - ChangeListener listener = new TestChangeListener(); - this.spinnerModelAdapter.addChangeListener(listener); - assertTrue(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasListeners(this.spinnerModelAdapter); - - this.spinnerModelAdapter.removeChangeListener(listener); - assertFalse(localValueHolder.hasAnyPropertyChangeListeners(PropertyValueModel.VALUE)); - this.verifyHasNoListeners(this.spinnerModelAdapter); - } - - private void verifyHasNoListeners(Object adapter) throws Exception { - Object delegate = ReflectionTools.getFieldValue(adapter, "delegate"); - Object[] listeners = (Object[]) ReflectionTools.executeMethod(delegate, "getChangeListeners"); - assertEquals(0, listeners.length); - } - - private void verifyHasListeners(Object adapter) throws Exception { - Object delegate = ReflectionTools.getFieldValue(adapter, "delegate"); - Object[] listeners = (Object[]) ReflectionTools.executeMethod(delegate, "getChangeListeners"); - assertFalse(listeners.length == 0); - } - - - private class TestChangeListener implements ChangeListener { - TestChangeListener() { - super(); - } - public void stateChanged(ChangeEvent e) { - fail("unexpected event"); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/SpinnerModelAdapterUITest.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/SpinnerModelAdapterUITest.java deleted file mode 100644 index 26976caed9..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/SpinnerModelAdapterUITest.java +++ /dev/null @@ -1,344 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import java.util.Calendar; -import java.util.Date; - -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JSpinner; -import javax.swing.SpinnerModel; -import javax.swing.WindowConstants; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.DateSpinnerModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ListSpinnerModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.swing.NumberSpinnerModelAdapter; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -/** - * Play around with a set of spinners. - */ -@SuppressWarnings("nls") -public class SpinnerModelAdapterUITest { - - private TestModel testModel; - private WritablePropertyValueModel testModelHolder; - - private WritablePropertyValueModel birthDateHolder; - private SpinnerModel birthDateSpinnerModel; - - private WritablePropertyValueModel ageHolder; - private SpinnerModel ageSpinnerModel; - - private WritablePropertyValueModel eyeColorHolder; - private SpinnerModel eyeColorSpinnerModel; - - - public static void main(String[] args) throws Exception { - new SpinnerModelAdapterUITest().exec(); - } - - private SpinnerModelAdapterUITest() { - super(); - } - - private void exec() throws Exception { - this.testModel = new TestModel(); - this.testModelHolder = new SimplePropertyValueModel(this.testModel); - - this.birthDateHolder = this.buildBirthDateHolder(this.testModelHolder); - this.birthDateSpinnerModel = this.buildBirthDateSpinnerModel(this.birthDateHolder); - - this.ageHolder = this.buildAgeHolder(this.testModelHolder); - this.ageSpinnerModel = this.buildAgeSpinnerModel(this.ageHolder); - - this.eyeColorHolder = this.buildEyeColorHolder(this.testModelHolder); - this.eyeColorSpinnerModel = this.buildEyeColorSpinnerModel(this.eyeColorHolder); - - this.openWindow(); - } - - private WritablePropertyValueModel buildBirthDateHolder(PropertyValueModel vm) { - return new PropertyAspectAdapter(vm, TestModel.BIRTH_DATE_PROPERTY) { - @Override - protected Object buildValue_() { - return this.subject.getBirthDate(); - } - @Override - protected void setValue_(Object value) { - this.subject.setBirthDate((Date) value); - } - }; - } - - private SpinnerModel buildBirthDateSpinnerModel(WritablePropertyValueModel valueHolder) { - return new DateSpinnerModelAdapter(valueHolder); - } - - private WritablePropertyValueModel buildAgeHolder(PropertyValueModel vm) { - return new PropertyAspectAdapter(vm, TestModel.AGE_PROPERTY) { - @Override - protected Number buildValue_() { - return new Integer(this.subject.getAge()); - } - @Override - protected void setValue_(Number value) { - this.subject.setAge(value.intValue()); - } - }; - } - - private SpinnerModel buildAgeSpinnerModel(WritablePropertyValueModel valueHolder) { - return new NumberSpinnerModelAdapter(valueHolder, valueHolder.getValue().intValue(), TestModel.MIN_AGE, TestModel.MAX_AGE, 1); - } - - private WritablePropertyValueModel buildEyeColorHolder(PropertyValueModel vm) { - return new PropertyAspectAdapter(vm, TestModel.EYE_COLOR_PROPERTY) { - @Override - protected Object buildValue_() { - return this.subject.getEyeColor(); - } - @Override - protected void setValue_(Object value) { - this.subject.setEyeColor((String) value); - } - }; - } - - private SpinnerModel buildEyeColorSpinnerModel(WritablePropertyValueModel valueHolder) { - return new ListSpinnerModelAdapter(valueHolder, TestModel.VALID_EYE_COLORS); - } - - private void openWindow() { - JFrame window = new JFrame(this.getClass().getName()); - window.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - window.addWindowListener(this.buildWindowListener()); - window.getContentPane().add(this.buildMainPanel(), "Center"); - window.setSize(600, 100); - window.setVisible(true); - } - - private WindowListener buildWindowListener() { - return new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - e.getWindow().setVisible(false); - System.exit(0); - } - }; - } - - private Component buildMainPanel() { - JPanel mainPanel = new JPanel(new BorderLayout()); - mainPanel.add(this.buildSpinnerPanel(), BorderLayout.NORTH); - mainPanel.add(this.buildControlPanel(), BorderLayout.SOUTH); - return mainPanel; - } - - private Component buildSpinnerPanel() { - JPanel taskListPanel = new JPanel(new GridLayout(1, 0)); - taskListPanel.add(this.buildBirthDateSpinner()); - taskListPanel.add(this.buildAgeSpinner()); - taskListPanel.add(this.buildEyeColorSpinner()); - return taskListPanel; - } - - private JSpinner buildBirthDateSpinner() { - return new JSpinner(this.birthDateSpinnerModel); - } - - private JSpinner buildAgeSpinner() { - return new JSpinner(this.ageSpinnerModel); - } - - private JSpinner buildEyeColorSpinner() { - return new JSpinner(this.eyeColorSpinnerModel); - } - - private Component buildControlPanel() { - JPanel controlPanel = new JPanel(new GridLayout(1, 0)); - controlPanel.add(this.buildResetModelButton()); - controlPanel.add(this.buildClearModelButton()); - controlPanel.add(this.buildRestoreModelButton()); - controlPanel.add(this.buildPrintModelButton()); - return controlPanel; - } - - private JButton buildResetModelButton() { - return new JButton(this.buildResetModelAction()); - } - - private Action buildResetModelAction() { - Action action = new AbstractAction("reset model") { - public void actionPerformed(ActionEvent event) { - SpinnerModelAdapterUITest.this.resetModel(); - } - }; - action.setEnabled(true); - return action; - } - - void resetModel() { - this.testModel.setBirthDate(TestModel.DEFAULT_BIRTH_DATE); - this.testModel.setEyeColor(TestModel.DEFAULT_EYE_COLOR); - } - - private JButton buildClearModelButton() { - return new JButton(this.buildClearModelAction()); - } - - private Action buildClearModelAction() { - Action action = new AbstractAction("clear model") { - public void actionPerformed(ActionEvent event) { - SpinnerModelAdapterUITest.this.clearModel(); - } - }; - action.setEnabled(true); - return action; - } - - void clearModel() { - this.testModelHolder.setValue(null); - } - - private JButton buildRestoreModelButton() { - return new JButton(this.buildRestoreModelAction()); - } - - private Action buildRestoreModelAction() { - Action action = new AbstractAction("restore model") { - public void actionPerformed(ActionEvent event) { - SpinnerModelAdapterUITest.this.restoreModel(); - } - }; - action.setEnabled(true); - return action; - } - - void restoreModel() { - this.testModelHolder.setValue(this.testModel); - } - - private JButton buildPrintModelButton() { - return new JButton(this.buildPrintModelAction()); - } - - private Action buildPrintModelAction() { - Action action = new AbstractAction("print model") { - public void actionPerformed(ActionEvent event) { - SpinnerModelAdapterUITest.this.printModel(); - } - }; - action.setEnabled(true); - return action; - } - - void printModel() { - System.out.println("birth date: " + this.testModel.getBirthDate()); - System.out.println("age: " + this.testModel.getAge()); - System.out.println("eyes: " + this.testModel.getEyeColor()); - } - - - static class TestModel extends AbstractModel { - private Calendar birthCal = Calendar.getInstance(); - // "virtual" properties - public static final String BIRTH_DATE_PROPERTY = "birthDate"; - public static final String AGE_PROPERTY = "age"; - public static final Date DEFAULT_BIRTH_DATE = new Date(); - public static final int DEFAULT_AGE = 0; - public static final int MIN_AGE = 0; - public static final int MAX_AGE = 150; - private String eyeColor; - public static final String EYE_COLOR_PROPERTY = "eyeColor"; - public static final String[] VALID_EYE_COLORS = {"blue", "brown", "green", "hazel", "pink"}; - public static final String DEFAULT_EYE_COLOR = VALID_EYE_COLORS[3]; - - TestModel() { - this(DEFAULT_BIRTH_DATE, DEFAULT_EYE_COLOR); - } - public TestModel(Date birthDate, String eyeColor) { - this.setBirthDate(birthDate); - this.setEyeColor(eyeColor); - } - public Date getBirthDate() { - return (Date) this.birthCal.getTime().clone(); - } - public void setBirthDate(Date birthDate) { - Date oldBirthDate = this.getBirthDate(); - int oldAge = this.getAge(); - this.birthCal.setTimeInMillis(birthDate.getTime()); - int newAge = this.getAge(); - if (newAge < MIN_AGE || newAge > MAX_AGE) { - throw new IllegalArgumentException(birthDate.toString()); - } - this.firePropertyChanged(BIRTH_DATE_PROPERTY, oldBirthDate, this.getBirthDate()); - this.firePropertyChanged(AGE_PROPERTY, oldAge, newAge); - } - public int getAge() { - Calendar currentCal = Calendar.getInstance(); - int age = currentCal.get(Calendar.YEAR) - this.birthCal.get(Calendar.YEAR); - if (currentCal.get(Calendar.MONTH) < this.birthCal.get(Calendar.MONTH)) { - age--; - } else if (currentCal.get(Calendar.MONTH) == this.birthCal.get(Calendar.MONTH)) { - if (currentCal.get(Calendar.DAY_OF_MONTH) < this.birthCal.get(Calendar.DAY_OF_MONTH)) { - age--; - } - } - return age; - } - public void setAge(int newAge) { - if (newAge < MIN_AGE || newAge > MAX_AGE) { - throw new IllegalArgumentException(String.valueOf(newAge)); - } - - int oldAge = this.getAge(); - int delta = newAge - oldAge; - - Calendar newBirthCal = Calendar.getInstance(); - newBirthCal.setTimeInMillis(this.birthCal.getTime().getTime()); - // if the age increased, the birth date must be "decreased"; and vice versa - newBirthCal.set(Calendar.YEAR, newBirthCal.get(Calendar.YEAR) - delta); - this.setBirthDate(newBirthCal.getTime()); - } - public String getEyeColor() { - return this.eyeColor; - } - public void setEyeColor(String eyeColor) { - if ( ! ArrayTools.contains(VALID_EYE_COLORS, eyeColor)) { - throw new IllegalArgumentException(eyeColor); - } - Object old = this.eyeColor; - this.eyeColor = eyeColor; - this.firePropertyChanged(EYE_COLOR_PROPERTY, old, eyeColor); - } - @Override - public String toString() { - return "TestModel(birth: " + this.getBirthDate() + " - eyes: " + this.eyeColor + ")"; - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/TableModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/TableModelAdapterTests.java deleted file mode 100644 index d7125a42ff..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/TableModelAdapterTests.java +++ /dev/null @@ -1,641 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import java.text.DateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Collection; -import java.util.Date; -import java.util.Iterator; -import java.util.List; -import javax.swing.event.TableModelEvent; -import javax.swing.event.TableModelListener; -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ColumnAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.swing.TableModelAdapter; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class TableModelAdapterTests extends TestCase { - private Crowd crowd; - TableModelEvent event; - - public TableModelAdapterTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.crowd = this.buildCrowd(); - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testGetRowCount() throws Exception { - TableModelAdapter tableModelAdapter = this.buildTableModelAdapter(); - assertEquals(0, tableModelAdapter.getRowCount()); - // we need to add a listener to wake up the adapter - tableModelAdapter.addTableModelListener(this.buildTableModelListener()); - assertEquals(this.crowd.peopleSize(), tableModelAdapter.getRowCount()); - } - - public void testGetColumnCount() throws Exception { - TableModelAdapter tableModelAdapter = this.buildTableModelAdapter(); - assertEquals(PersonColumnAdapter.COLUMN_COUNT, tableModelAdapter.getColumnCount()); - } - - public void testGetValueAt() throws Exception { - TableModelAdapter tableModelAdapter = this.buildTableModelAdapter(); - tableModelAdapter.addTableModelListener(this.buildTableModelListener()); - - List sortedNames = this.sortedNames(); - for (int i = 0; i < this.crowd.peopleSize(); i++) { - assertEquals(sortedNames.get(i), tableModelAdapter.getValueAt(i, PersonColumnAdapter.NAME_COLUMN)); - } - } - - public void testSetValueAt() throws Exception { - TableModelAdapter tableModelAdapter = this.buildTableModelAdapter(); - this.event = null; - tableModelAdapter.addTableModelListener(new TestTableModelListener() { - @Override - public void tableChanged(TableModelEvent e) { - TableModelAdapterTests.this.event = e; - } - }); - - Person person = this.crowd.personNamed("Gollum"); - assertEquals(Person.EYE_COLOR_BLUE, person.getEyeColor()); - assertFalse(person.isEvil()); - assertEquals(0, person.getRank()); - - for (int i = 0; i < tableModelAdapter.getRowCount(); i++) { - if (tableModelAdapter.getValueAt(i, PersonColumnAdapter.NAME_COLUMN).equals("Gollum")) { - tableModelAdapter.setValueAt(Person.EYE_COLOR_HAZEL, i, PersonColumnAdapter.EYE_COLOR_COLUMN); - tableModelAdapter.setValueAt(Boolean.TRUE, i, PersonColumnAdapter.EVIL_COLUMN); - tableModelAdapter.setValueAt(new Integer(-1), i, PersonColumnAdapter.RANK_COLUMN); - break; - } - } - assertNotNull(this.event); - assertEquals(Person.EYE_COLOR_HAZEL, person.getEyeColor()); - assertTrue(person.isEvil()); - assertEquals(-1, person.getRank()); - } - - public void testAddRow() throws Exception { - TableModelAdapter tableModelAdapter = this.buildTableModelAdapter(); - this.event = null; - tableModelAdapter.addTableModelListener(this.buildSingleEventListener()); - // add a person to the end of the list so we only trigger one event - this.crowd.addPerson("Zzzzz"); - assertNotNull(this.event); - assertEquals(TableModelEvent.INSERT, this.event.getType()); - assertEquals(TableModelEvent.ALL_COLUMNS, this.event.getColumn()); - } - - public void testRemoveRow() throws Exception { - TableModelAdapter tableModelAdapter = this.buildTableModelAdapter(); - this.event = null; - tableModelAdapter.addTableModelListener(this.buildSingleEventListener()); - // removing a person should only trigger one event, since a re-sort is not needed - this.crowd.removePerson(this.crowd.personNamed("Gollum")); - assertNotNull(this.event); - assertEquals(TableModelEvent.DELETE, this.event.getType()); - assertEquals(TableModelEvent.ALL_COLUMNS, this.event.getColumn()); - } - - public void testChangeCell() throws Exception { - TableModelAdapter tableModelAdapter = this.buildTableModelAdapter(); - this.event = null; - tableModelAdapter.addTableModelListener(this.buildSingleEventListener()); - // add a person to the end of the list so we only trigger one event - Person person = this.crowd.personNamed("Gollum"); - person.setEvil(true); - assertNotNull(this.event); - assertEquals(TableModelEvent.UPDATE, this.event.getType()); - assertEquals(PersonColumnAdapter.EVIL_COLUMN, this.event.getColumn()); - } - - public void testLazyListListener() throws Exception { - TableModelAdapter tableModelAdapter = this.buildTableModelAdapter(); - TableModelListener listener = this.buildTableModelListener(); - assertTrue(this.crowd.hasNoCollectionChangeListeners(Crowd.PEOPLE_COLLECTION)); - tableModelAdapter.addTableModelListener(listener); - assertTrue(this.crowd.hasAnyCollectionChangeListeners(Crowd.PEOPLE_COLLECTION)); - tableModelAdapter.removeTableModelListener(listener); - assertTrue(this.crowd.hasNoCollectionChangeListeners(Crowd.PEOPLE_COLLECTION)); - } - - public void testLazyCellListener() throws Exception { - TableModelAdapter tableModelAdapter = this.buildTableModelAdapter(); - TableModelListener listener = this.buildTableModelListener(); - Person person = this.crowd.personNamed("Gollum"); - assertTrue(person.hasNoPropertyChangeListeners(Person.NAME_PROPERTY)); - assertTrue(person.hasNoPropertyChangeListeners(Person.BIRTH_DATE_PROPERTY)); - assertTrue(person.hasNoPropertyChangeListeners(Person.EYE_COLOR_PROPERTY)); - assertTrue(person.hasNoPropertyChangeListeners(Person.EVIL_PROPERTY)); - assertTrue(person.hasNoPropertyChangeListeners(Person.RANK_PROPERTY)); - - tableModelAdapter.addTableModelListener(listener); - assertTrue(person.hasAnyPropertyChangeListeners(Person.NAME_PROPERTY)); - assertTrue(person.hasAnyPropertyChangeListeners(Person.BIRTH_DATE_PROPERTY)); - assertTrue(person.hasAnyPropertyChangeListeners(Person.EYE_COLOR_PROPERTY)); - assertTrue(person.hasAnyPropertyChangeListeners(Person.EVIL_PROPERTY)); - assertTrue(person.hasAnyPropertyChangeListeners(Person.RANK_PROPERTY)); - - tableModelAdapter.removeTableModelListener(listener); - assertTrue(person.hasNoPropertyChangeListeners(Person.NAME_PROPERTY)); - assertTrue(person.hasNoPropertyChangeListeners(Person.BIRTH_DATE_PROPERTY)); - assertTrue(person.hasNoPropertyChangeListeners(Person.EYE_COLOR_PROPERTY)); - assertTrue(person.hasNoPropertyChangeListeners(Person.EVIL_PROPERTY)); - assertTrue(person.hasNoPropertyChangeListeners(Person.RANK_PROPERTY)); - } - - private TableModelAdapter buildTableModelAdapter() { - return new TableModelAdapter(this.buildSortedPeopleAdapter(), this.buildColumnAdapter()) { - @Override - protected PropertyChangeListener buildCellListener() { - return this.buildCellListener_(); - } - @Override - protected ListChangeListener buildListChangeListener() { - return this.buildListChangeListener_(); - } - }; - } - - private ListValueModel buildSortedPeopleAdapter() { - return new SortedListValueModelAdapter(this.buildPeopleAdapter()); - } - - private CollectionValueModel buildPeopleAdapter() { - return new CollectionAspectAdapter(Crowd.PEOPLE_COLLECTION, this.crowd) { - @Override - protected Iterator iterator_() { - return this.subject.people(); - } - @Override - protected int size_() { - return this.subject.peopleSize(); - } - }; - } - - private Crowd buildCrowd() { - Crowd result = new Crowd(); - result.addPerson("Bilbo"); - result.addPerson("Gollum"); - result.addPerson("Frodo"); - result.addPerson("Samwise"); - return result; - } - - private ColumnAdapter buildColumnAdapter() { - return new PersonColumnAdapter(); - } - - private TableModelListener buildTableModelListener() { - return new TestTableModelListener(); - } - - private List sortedNames() { - return new ArrayList(CollectionTools.sortedSet(this.crowd.peopleNames())); - } - - private TableModelListener buildSingleEventListener() { - return new TestTableModelListener() { - @Override - public void tableChanged(TableModelEvent e) { - // we expect only a single event - if (TableModelAdapterTests.this.event == null) { - TableModelAdapterTests.this.event = e; - } else { - fail("unexpected event"); - } - } - }; - } - - - // ********** classes ********** - - public static class PersonColumnAdapter implements ColumnAdapter { - public static final int COLUMN_COUNT = 7; - - public static final int NAME_COLUMN = 0; - public static final int BIRTH_DATE_COLUMN = 1; - public static final int GONE_WEST_DATE_COLUMN = 2; - public static final int EYE_COLOR_COLUMN = 3; - public static final int EVIL_COLUMN = 4; - public static final int RANK_COLUMN = 5; - public static final int ADVENTURE_COUNT_COLUMN = 6; - - private static final String[] COLUMN_NAMES = new String[] { - "Name", - "Birth", - "Gone West", - "Eyes", - "Evil", - "Rank", - "Adventures" - }; - - - public int columnCount() { - return COLUMN_COUNT; - } - - public String columnName(int index) { - return COLUMN_NAMES[index]; - } - - public Class columnClass(int index) { - switch (index) { - case NAME_COLUMN: return Object.class; - case BIRTH_DATE_COLUMN: return Date.class; - case GONE_WEST_DATE_COLUMN: return Date.class; - case EYE_COLOR_COLUMN: return Object.class; - case EVIL_COLUMN: return Boolean.class; - case RANK_COLUMN: return Integer.class; - case ADVENTURE_COUNT_COLUMN:return Integer.class; - default: return Object.class; - } - } - - public boolean columnIsEditable(int index) { - return index != NAME_COLUMN; - } - - public WritablePropertyValueModel[] cellModels(Object subject) { - Person person = (Person) subject; - @SuppressWarnings("unchecked") - WritablePropertyValueModel[] result = new WritablePropertyValueModel[COLUMN_COUNT]; - - result[NAME_COLUMN] = this.buildNameAdapter(person); - result[BIRTH_DATE_COLUMN] = this.buildBirthDateAdapter(person); - result[GONE_WEST_DATE_COLUMN] = this.buildGoneWestDateAdapter(person); - result[EYE_COLOR_COLUMN] = this.buildEyeColorAdapter(person); - result[EVIL_COLUMN] = this.buildEvilAdapter(person); - result[RANK_COLUMN] = this.buildRankAdapter(person); - result[ADVENTURE_COUNT_COLUMN] = this.buildAdventureCountAdapter(person); - - return result; - } - - private WritablePropertyValueModel buildNameAdapter(Person person) { - return new PropertyAspectAdapter(Person.NAME_PROPERTY, person) { - @Override - protected String buildValue_() { - return this.subject.getName(); - } - @Override - protected void setValue_(Object value) { - this.subject.setName((String) value); - } - }; - } - - private WritablePropertyValueModel buildBirthDateAdapter(Person person) { - return new PropertyAspectAdapter(Person.BIRTH_DATE_PROPERTY, person) { - @Override - protected Date buildValue_() { - return this.subject.getBirthDate(); - } - @Override - protected void setValue_(Object value) { - this.subject.setBirthDate((Date) value); - } - }; - } - - private WritablePropertyValueModel buildGoneWestDateAdapter(Person person) { - return new PropertyAspectAdapter(Person.GONE_WEST_DATE_PROPERTY, person) { - @Override - protected Date buildValue_() { - return this.subject.getGoneWestDate(); - } - @Override - protected void setValue_(Object value) { - this.subject.setGoneWestDate((Date) value); - } - }; - } - - private WritablePropertyValueModel buildEyeColorAdapter(Person person) { - return new PropertyAspectAdapter(Person.EYE_COLOR_PROPERTY, person) { - @Override - protected String buildValue_() { - return this.subject.getEyeColor(); - } - @Override - protected void setValue_(Object value) { - this.subject.setEyeColor((String) value); - } - }; - } - - private WritablePropertyValueModel buildEvilAdapter(Person person) { - return new PropertyAspectAdapter(Person.EVIL_PROPERTY, person) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.isEvil()); - } - @Override - protected void setValue_(Object value) { - this.subject.setEvil(((Boolean)value).booleanValue()); - } - }; - } - - private WritablePropertyValueModel buildRankAdapter(Person person) { - return new PropertyAspectAdapter(Person.RANK_PROPERTY, person) { - @Override - protected Integer buildValue_() { - return new Integer(this.subject.getRank()); - } - @Override - protected void setValue_(Object value) { - this.subject.setRank(((Integer) value).intValue()); - } - }; - } - - private WritablePropertyValueModel buildAdventureCountAdapter(Person person) { - return new PropertyAspectAdapter(Person.ADVENTURE_COUNT_PROPERTY, person) { - @Override - protected Integer buildValue_() { - return new Integer(this.subject.getAdventureCount()); - } - @Override - protected void setValue_(Object value) { - this.subject.setAdventureCount(((Integer) value).intValue()); - } - }; - } - - } - - - public static class Crowd extends AbstractModel { - private final Collection people; - public static final String PEOPLE_COLLECTION = "people"; - - public Crowd() { - super(); - this.people = new ArrayList(); - } - - - public Iterator people() { - return new CloneIterator(this.people) { - @Override - protected void remove(Person person) { - Crowd.this.removePerson(person); - } - }; - } - - public int peopleSize() { - return this.people.size(); - } - - public Person addPerson(String name) { - this.checkPersonName(name); - return this.addPerson(new Person(this, name)); - } - - private Person addPerson(Person person) { - this.addItemToCollection(person, this.people, PEOPLE_COLLECTION); - return person; - } - - public void removePerson(Person person) { - this.removeItemFromCollection(person, this.people, PEOPLE_COLLECTION); - } - - public void removePeople(Collection persons) { - this.removeItemsFromCollection(persons, this.people, PEOPLE_COLLECTION); - } - - public void removePeople(Iterator persons) { - this.removeItemsFromCollection(persons, this.people, PEOPLE_COLLECTION); - } - - void checkPersonName(String personName) { - if (personName == null) { - throw new NullPointerException(); - } - if (CollectionTools.contains(this.peopleNames(), personName)) { - throw new IllegalArgumentException(personName); - } - } - - public Iterator peopleNames() { - return new TransformationIterator(this.people.iterator()) { - @Override - protected String transform(Person person) { - return person.getName(); - } - }; - } - - public Person personNamed(String name) { - for (Iterator stream = this.people.iterator(); stream.hasNext(); ) { - Person person = stream.next(); - if (person.getName().equals(name)) { - return person; - } - } - return null; - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, String.valueOf(this.people.size()) + " people"); - } - - } - - - public static class Person extends AbstractModel implements Comparable { - private Crowd crowd; - private String name; - public static final String NAME_PROPERTY= "name"; - private Date birthDate; - public static final String BIRTH_DATE_PROPERTY= "birthDate"; - private Date goneWestDate; - public static final String GONE_WEST_DATE_PROPERTY= "goneWestDate"; - private String eyeColor; - public static final String EYE_COLOR_PROPERTY= "eyeColor"; - public static final String EYE_COLOR_BLUE = "blue"; - public static final String EYE_COLOR_GREEN = "green"; - public static final String EYE_COLOR_BROWN = "brown"; - public static final String EYE_COLOR_HAZEL = "hazel"; - public static final String EYE_COLOR_PINK = "pink"; - private static Collection validEyeColors; - public static final String DEFAULT_EYE_COLOR = EYE_COLOR_BLUE; - private boolean evil; - public static final String EVIL_PROPERTY= "evil"; - private int rank; - public static final String RANK_PROPERTY= "rank"; - private int adventureCount; - public static final String ADVENTURE_COUNT_PROPERTY= "adventureCount"; - - Person(Crowd crowd, String name) { - super(); - this.crowd = crowd; - this.name = name; - this.birthDate = new Date(); - Calendar c = Calendar.getInstance(); - c.add(Calendar.YEAR, 250); - this.goneWestDate = new Date(c.getTimeInMillis()); - this.eyeColor = DEFAULT_EYE_COLOR; - this.evil = false; - this.rank = 0; - this.adventureCount = 0; - } - - public static Collection getValidEyeColors() { - if (validEyeColors == null) { - validEyeColors = buildValidEyeColors(); - } - return validEyeColors; - } - - private static Collection buildValidEyeColors() { - Collection result = new ArrayList(); - result.add(EYE_COLOR_BLUE); - result.add(EYE_COLOR_GREEN); - result.add(EYE_COLOR_BROWN); - result.add(EYE_COLOR_HAZEL); - result.add(EYE_COLOR_PINK); - return result; - } - - public Crowd getCrowd() { - return this.crowd; - } - - public String getName() { - return this.name; - } - public void setName(String name) { - this.crowd.checkPersonName(name); - Object old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - public Date getBirthDate() { - return this.birthDate; - } - public void setBirthDate(Date birthDate) { - Object old = this.birthDate; - this.birthDate = birthDate; - this.firePropertyChanged(BIRTH_DATE_PROPERTY, old, birthDate); - } - - public Date getGoneWestDate() { - return this.goneWestDate; - } - public void setGoneWestDate(Date goneWestDate) { - Object old = this.goneWestDate; - this.goneWestDate = goneWestDate; - this.firePropertyChanged(GONE_WEST_DATE_PROPERTY, old, goneWestDate); - } - - public String getEyeColor() { - return this.eyeColor; - } - public void setEyeColor(String eyeColor) { - if (! getValidEyeColors().contains(eyeColor)) { - throw new IllegalArgumentException(eyeColor); - } - Object old = this.eyeColor; - this.eyeColor = eyeColor; - this.firePropertyChanged(EYE_COLOR_PROPERTY, old, eyeColor); - } - - public boolean isEvil() { - return this.evil; - } - public void setEvil(boolean evil) { - boolean old = this.evil; - this.evil = evil; - this.firePropertyChanged(EVIL_PROPERTY, old, evil); - } - - public int getRank() { - return this.rank; - } - public void setRank(int rank) { - int old = this.rank; - this.rank = rank; - this.firePropertyChanged(RANK_PROPERTY, old, rank); - } - - public int getAdventureCount() { - return this.adventureCount; - } - public void setAdventureCount(int adventureCount) { - int old = this.adventureCount; - this.adventureCount = adventureCount; - this.firePropertyChanged(ADVENTURE_COUNT_PROPERTY, old, adventureCount); - } - - public int compareTo(Person p) { - return this.name.compareToIgnoreCase(p.name); - } - - @Override - public String toString() { - return this.name + - "\tborn: " + DateFormat.getDateInstance().format(this.birthDate) + - "\tgone west: " + DateFormat.getDateInstance().format(this.goneWestDate) + - "\teyes: " + this.eyeColor + - "\tevil: " + this.evil + - "\trank: " + this.rank + - "\tadventures: " + this.adventureCount - ; - } - - } - - - private class TestTableModelListener implements TableModelListener { - TestTableModelListener() { - super(); - } - public void tableChanged(TableModelEvent e) { - fail("unexpected event"); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/TableModelAdapterUITest.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/TableModelAdapterUITest.java deleted file mode 100644 index 07a614cb44..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/TableModelAdapterUITest.java +++ /dev/null @@ -1,733 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.GridLayout; -import java.awt.event.ActionEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import java.util.ArrayList; -import java.util.Date; -import java.util.Iterator; - -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.ButtonModel; -import javax.swing.ComboBoxModel; -import javax.swing.DefaultListCellRenderer; -import javax.swing.JButton; -import javax.swing.JCheckBox; -import javax.swing.JComboBox; -import javax.swing.JFrame; -import javax.swing.JList; -import javax.swing.JOptionPane; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JSpinner; -import javax.swing.JTable; -import javax.swing.JTextField; -import javax.swing.ListCellRenderer; -import javax.swing.ListSelectionModel; -import javax.swing.SpinnerModel; -import javax.swing.UIManager; -import javax.swing.WindowConstants; -import javax.swing.event.ListSelectionEvent; -import javax.swing.event.ListSelectionListener; -import javax.swing.table.TableColumn; -import javax.swing.table.TableModel; -import javax.swing.text.Document; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.ItemPropertyListValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelWrapper; -import org.eclipse.jpt.common.utility.internal.model.value.swing.CheckBoxModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ColumnAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ComboBoxModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.swing.DateSpinnerModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.swing.DocumentAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ListModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.swing.NumberSpinnerModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.swing.ObjectListSelectionModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.TableModelAdapter; -import org.eclipse.jpt.common.utility.internal.swing.CheckBoxTableCellRenderer; -import org.eclipse.jpt.common.utility.internal.swing.ComboBoxTableCellRenderer; -import org.eclipse.jpt.common.utility.internal.swing.SpinnerTableCellRenderer; -import org.eclipse.jpt.common.utility.internal.swing.TableCellEditorAdapter; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.model.value.swing.TableModelAdapterTests.Crowd; -import org.eclipse.jpt.common.utility.tests.internal.model.value.swing.TableModelAdapterTests.Person; -import org.eclipse.jpt.common.utility.tests.internal.model.value.swing.TableModelAdapterTests.PersonColumnAdapter; - -/** - * an example UI for testing the TableModelAdapter - * "name" column is read-only text field - * "birth date" column is date text field - * "gone west date" column is date spinner - * "eye color" column is combo-box - * "evil" column is check box - * "rank" column is number text field - * "adventure count" column is number spinner - * - * Note that the table model and row selection model share the same - * list value model (the sorted people adapter) - */ -@SuppressWarnings("nls") -public class TableModelAdapterUITest { - private SimpleCollectionValueModel eyeColorsHolder; // Object because it adapts to a combo-box - private WritablePropertyValueModel crowdHolder; - private WritablePropertyValueModel selectedPersonHolder; - private ListValueModel sortedPeopleAdapter; - private TableModel tableModel; - private ObjectListSelectionModel rowSelectionModel; - private Action removeAction; - private Action renameAction; - - public static void main(String[] args) throws Exception { - new TableModelAdapterUITest().exec(args); - } - - protected TableModelAdapterUITest() { - super(); - } - - protected void exec(@SuppressWarnings("unused") String[] args) throws Exception { - UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); - this.eyeColorsHolder = this. buildEyeColorCollectionHolder(); - this.crowdHolder = this.buildCrowdHolder(); - this.selectedPersonHolder = this.buildSelectedPersonHolder(); - this.sortedPeopleAdapter = this.buildSortedPeopleAdapter(); - this.tableModel = this.buildTableModel(); - this.rowSelectionModel = this.buildRowSelectionModel(); - this.openWindow(); - } - - private SimpleCollectionValueModel buildEyeColorCollectionHolder() { - return new SimpleCollectionValueModel(new ArrayList(Person.getValidEyeColors())); - } - - private WritablePropertyValueModel buildCrowdHolder() { - return new SimplePropertyValueModel(this.buildCrowd()); - } - - private Crowd buildCrowd() { - Crowd crowd = new Crowd(); - - Person p = crowd.addPerson("Bilbo"); - p.setEyeColor(Person.EYE_COLOR_BROWN); - p.setRank(22); - p.setAdventureCount(1); - - p = crowd.addPerson("Gollum"); - p.setEyeColor(Person.EYE_COLOR_PINK); - p.setEvil(true); - p.setRank(2); - p.setAdventureCount(50); - - p = crowd.addPerson("Frodo"); - p.setEyeColor(Person.EYE_COLOR_BLUE); - p.setRank(34); - p.setAdventureCount(1); - - p = crowd.addPerson("Samwise"); - p.setEyeColor(Person.EYE_COLOR_GREEN); - p.setRank(19); - p.setAdventureCount(1); - - return crowd; - } - - private WritablePropertyValueModel buildSelectedPersonHolder() { - return new SimplePropertyValueModel(); - } - - private ListValueModel buildSortedPeopleAdapter() { - return new SortedListValueModelWrapper(this.buildPeopleNameAdapter()); - } - - // the list will need to be re-sorted if a name changes - private ListValueModel buildPeopleNameAdapter() { - return new ItemPropertyListValueModelAdapter(this.buildPeopleAdapter(), Person.NAME_PROPERTY); - } - - private CollectionValueModel buildPeopleAdapter() { - return new CollectionAspectAdapter(this.crowdHolder, Crowd.PEOPLE_COLLECTION) { - @Override - protected Iterator iterator_() { - return this.subject.people(); - } - @Override - protected int size_() { - return this.subject.peopleSize(); - } - }; - } - - private TableModel buildTableModel() { - return new TableModelAdapter(this.sortedPeopleAdapter, this.buildColumnAdapter()); - } - - protected ColumnAdapter buildColumnAdapter() { - return new PersonColumnAdapter(); - } - - private ObjectListSelectionModel buildRowSelectionModel() { - ObjectListSelectionModel rsm = new ObjectListSelectionModel(new ListModelAdapter(this.sortedPeopleAdapter)); - rsm.addListSelectionListener(this.buildRowSelectionListener()); - rsm.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - return rsm; - } - - private ListSelectionListener buildRowSelectionListener() { - return new ListSelectionListener() { - public void valueChanged(ListSelectionEvent e) { - if (e.getValueIsAdjusting()) { - return; - } - TableModelAdapterUITest.this.rowSelectionChanged(e); - } - }; - } - - void rowSelectionChanged(@SuppressWarnings("unused") ListSelectionEvent event) { - Person selection = (Person) this.rowSelectionModel.selectedValue(); - this.selectedPersonHolder.setValue(selection); - boolean personSelected = (selection != null); - this.removeAction.setEnabled(personSelected); - this.renameAction.setEnabled(personSelected); - } - - private void openWindow() { - JFrame window = new JFrame(this.getClass().getSimpleName()); - window.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - window.addWindowListener(this.buildWindowListener()); - window.getContentPane().add(this.buildMainPanel(), "Center"); - window.setLocation(200, 200); - window.setSize(600, 400); - window.setVisible(true); - } - - private WindowListener buildWindowListener() { - return new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - e.getWindow().setVisible(false); - System.exit(0); - } - }; - } - - private Component buildMainPanel() { - JPanel mainPanel = new JPanel(new BorderLayout()); - mainPanel.add(this.buildTablePane(), BorderLayout.CENTER); - mainPanel.add(this.buildControlPanel(), BorderLayout.SOUTH); - return mainPanel; - } - - private Component buildTablePane() { - return new JScrollPane(this.buildTable()); - } - - private JTable buildTable() { - JTable table = new JTable(this.tableModel); - table.putClientProperty("terminateEditOnFocusLost", Boolean.TRUE); // see Java bug 5007652 - table.setSelectionModel(this.rowSelectionModel); - table.setDoubleBuffered(true); - table.setAutoResizeMode(JTable.AUTO_RESIZE_NEXT_COLUMN); - int rowHeight = 20; // start with minimum of 20 - - // gone west column (spinner) - TableColumn column = table.getColumnModel().getColumn(PersonColumnAdapter.GONE_WEST_DATE_COLUMN); - SpinnerTableCellRenderer spinnerRenderer = this.buildDateSpinnerRenderer(); - column.setCellRenderer(spinnerRenderer); - column.setCellEditor(new TableCellEditorAdapter(this.buildDateSpinnerRenderer())); - rowHeight = Math.max(rowHeight, spinnerRenderer.preferredHeight()); - - // eye color column (combo-box) - // the jdk combo-box renderer looks like a text field - // until the user starts an edit - use a custom one - column = table.getColumnModel().getColumn(PersonColumnAdapter.EYE_COLOR_COLUMN); - ComboBoxTableCellRenderer eyeColorRenderer = this.buildEyeColorComboBoxRenderer(); - column.setCellRenderer(eyeColorRenderer); - column.setCellEditor(new TableCellEditorAdapter(this.buildEyeColorComboBoxRenderer())); - rowHeight = Math.max(rowHeight, eyeColorRenderer.preferredHeight()); - - // evil (check box) - // the jdk check box renderer and editor suck - use a custom ones - column = table.getColumnModel().getColumn(PersonColumnAdapter.EVIL_COLUMN); - CheckBoxTableCellRenderer evilRenderer = new CheckBoxTableCellRenderer(); - column.setCellRenderer(evilRenderer); - column.setCellEditor(new TableCellEditorAdapter(new CheckBoxTableCellRenderer())); - rowHeight = Math.max(rowHeight, evilRenderer.preferredHeight()); - - // adventure count column (spinner) - column = table.getColumnModel().getColumn(PersonColumnAdapter.ADVENTURE_COUNT_COLUMN); - spinnerRenderer = this.buildNumberSpinnerRenderer(); - column.setCellRenderer(spinnerRenderer); - column.setCellEditor(new TableCellEditorAdapter(this.buildNumberSpinnerRenderer())); - rowHeight = Math.max(rowHeight, spinnerRenderer.preferredHeight()); - - table.setRowHeight(rowHeight); - return table; - } - - private SpinnerTableCellRenderer buildDateSpinnerRenderer() { - return new SpinnerTableCellRenderer(new DateSpinnerModelAdapter(new SimplePropertyValueModel())); - } - - private SpinnerTableCellRenderer buildNumberSpinnerRenderer() { - return new SpinnerTableCellRenderer(new NumberSpinnerModelAdapter(new SimplePropertyValueModel())); - } - - private ComboBoxTableCellRenderer buildEyeColorComboBoxRenderer() { - return new ComboBoxTableCellRenderer(this.buildReadOnlyEyeColorComboBoxModel(), this.buildEyeColorRenderer()); - } - - private ComboBoxModel buildReadOnlyEyeColorComboBoxModel() { - return new ComboBoxModelAdapter(this.eyeColorsHolder, new SimplePropertyValueModel()); - } - - private ListCellRenderer buildEyeColorRenderer() { - return new EyeColorRenderer(); - } - - private Component buildControlPanel() { - JPanel controlPanel = new JPanel(new GridLayout(0, 1)); - controlPanel.add(this.buildButtonPanel()); - controlPanel.add(this.buildPersonPanel()); - return controlPanel; - } - - private Component buildButtonPanel() { - JPanel buttonPanel = new JPanel(new GridLayout(1, 0)); - buttonPanel.add(this.buildAddButton()); - buttonPanel.add(this.buildRemoveButton()); - buttonPanel.add(this.buildRenameButton()); - buttonPanel.add(this.buildAddEyeColorButton()); - buttonPanel.add(this.buildPrintButton()); - buttonPanel.add(this.buildResetButton()); - return buttonPanel; - } - - private Component buildPersonPanel() { - JPanel personPanel = new JPanel(new GridLayout(1, 0)); - personPanel.add(this.buildNameTextField()); - personPanel.add(this.buildBirthDateSpinner()); - personPanel.add(this.buildGoneWestDateSpinner()); - personPanel.add(this.buildEyeColorComboBox()); - personPanel.add(this.buildEvilCheckBox()); - personPanel.add(this.buildRankSpinner()); - personPanel.add(this.buildAdventureCountSpinner()); - return personPanel; - } - - - // ********** add button ********** - - private JButton buildAddButton() { - return new JButton(this.buildAddAction()); - } - - private Action buildAddAction() { - Action action = new AbstractAction("add") { - public void actionPerformed(ActionEvent event) { - TableModelAdapterUITest.this.addPerson(); - } - }; - action.setEnabled(true); - return action; - } - - void addPerson() { - String name = this.getNameFromUser(); - if (name != null) { - this.setSelectedPerson(this.crowd().addPerson(name)); - } - } - - - // ********** remove button ********** - - private JButton buildRemoveButton() { - return new JButton(this.buildRemoveAction()); - } - - private Action buildRemoveAction() { - this.removeAction = new AbstractAction("remove") { - public void actionPerformed(ActionEvent event) { - TableModelAdapterUITest.this.removePerson(); - } - }; - this.removeAction.setEnabled(false); - return this.removeAction; - } - - void removePerson() { - Person person = this.selectedPerson(); - if (person != null) { - this.crowd().removePerson(person); - } - } - - - // ********** rename button ********** - - private JButton buildRenameButton() { - return new JButton(this.buildRenameAction()); - } - - private Action buildRenameAction() { - this.renameAction = new AbstractAction("rename") { - public void actionPerformed(ActionEvent event) { - TableModelAdapterUITest.this.renamePerson(); - } - }; - this.renameAction.setEnabled(false); - return this.renameAction; - } - - void renamePerson() { - Person person = this.selectedPerson(); - if (person != null) { - String name = this.promptUserForName(person.getName()); - if (name != null) { - person.setName(name); - this.setSelectedPerson(person); - } - } - } - - - // ********** add eye color button ********** - - private JButton buildAddEyeColorButton() { - return new JButton(this.buildAddEyeColorAction()); - } - - private Action buildAddEyeColorAction() { - Action action = new AbstractAction("add eye color") { - public void actionPerformed(ActionEvent event) { - TableModelAdapterUITest.this.addEyeColor(); - } - }; - action.setEnabled(true); - return action; - } - - void addEyeColor() { - String color = this.promptUserForEyeColor(); - if (color != null) { - this.eyeColorsHolder.add(color); - } - } - - private String promptUserForEyeColor() { - while (true) { - String eyeColor = JOptionPane.showInputDialog("Eye Color"); - if (eyeColor == null) { - return null; // user pressed - } - if ((eyeColor.length() == 0)) { - JOptionPane.showMessageDialog(null, "The eye color is required.", "Invalid Eye Color", JOptionPane.ERROR_MESSAGE); - } else if (CollectionTools.contains(this.eyeColorsHolder.iterator(), eyeColor)) { - JOptionPane.showMessageDialog(null, "The eye color already exists.", "Invalid Eye Color", JOptionPane.ERROR_MESSAGE); - } else { - return eyeColor; - } - } - } - - - // ********** print button ********** - - private JButton buildPrintButton() { - return new JButton(this.buildPrintAction()); - } - - private Action buildPrintAction() { - Action action = new AbstractAction("print") { - public void actionPerformed(ActionEvent event) { - TableModelAdapterUITest.this.printCrowd(); - } - }; - action.setEnabled(true); - return action; - } - - void printCrowd() { - System.out.println(this.crowd()); - for (Iterator stream = this.crowd().people(); stream.hasNext(); ) { - System.out.println("\t" + stream.next()); - } - } - - - // ********** reset button ********** - - private JButton buildResetButton() { - return new JButton(this.buildResetAction()); - } - - private Action buildResetAction() { - Action action = new AbstractAction("reset") { - public void actionPerformed(ActionEvent event) { - TableModelAdapterUITest.this.reset(); - } - }; - action.setEnabled(true); - return action; - } - - void reset() { - this.crowdHolder.setValue(this.buildCrowd()); - } - - - // ********** new name dialog ********** - - private String getNameFromUser() { - return this.promptUserForName(null); - } - - private String promptUserForName(@SuppressWarnings("unused") String originalName) { - while (true) { - String name = JOptionPane.showInputDialog("Person Name"); - if (name == null) { - return null; // user pressed - } - if ((name.length() == 0)) { - JOptionPane.showMessageDialog(null, "The name is required.", "Invalid Name", JOptionPane.ERROR_MESSAGE); - } else if (CollectionTools.contains(this.crowd().peopleNames(), name)) { - JOptionPane.showMessageDialog(null, "The name already exists.", "Invalid Name", JOptionPane.ERROR_MESSAGE); - } else { - return name; - } - } - } - - - // ********** name text field ********** - - private Component buildNameTextField() { - JTextField textField = new JTextField(this.buildNameDocument(), null, 0); - textField.setEditable(false); - return textField; - } - - private Document buildNameDocument() { - return new DocumentAdapter(this.buildNameAdapter()); - } - - private WritablePropertyValueModel buildNameAdapter() { - return new PropertyAspectAdapter(this.selectedPersonHolder, Person.NAME_PROPERTY) { - @Override - protected String buildValue_() { - return this.subject.getName(); - } - @Override - protected void setValue_(String value) { - this.subject.setName(value); - } - }; - } - - - // ********** birth date spinner ********** - - private JSpinner buildBirthDateSpinner() { - return new JSpinner(this.buildBirthDateSpinnerModel()); - } - - private SpinnerModel buildBirthDateSpinnerModel() { - return new DateSpinnerModelAdapter(this.buildBirthDateAdapter()); - } - - private WritablePropertyValueModel buildBirthDateAdapter() { - return new PropertyAspectAdapter(this.selectedPersonHolder, Person.BIRTH_DATE_PROPERTY) { - @Override - protected Date buildValue_() { - return this.subject.getBirthDate(); - } - @Override - protected void setValue_(Object value) { - this.subject.setBirthDate((Date) value); - } - }; - } - - - // ********** gone west date spinner ********** - - private JSpinner buildGoneWestDateSpinner() { - return new JSpinner(this.buildGoneWestDateSpinnerModel()); - } - - private SpinnerModel buildGoneWestDateSpinnerModel() { - return new DateSpinnerModelAdapter(this.buildGoneWestDateAdapter()); - } - - private WritablePropertyValueModel buildGoneWestDateAdapter() { - return new PropertyAspectAdapter(this.selectedPersonHolder, Person.GONE_WEST_DATE_PROPERTY) { - @Override - protected Date buildValue_() { - return this.subject.getGoneWestDate(); - } - @Override - protected void setValue_(Object value) { - this.subject.setGoneWestDate((Date) value); - } - }; - } - - - // ********** eye color combo-box ********** - - private JComboBox buildEyeColorComboBox() { - return new JComboBox(this.buildEyeColorComboBoxModel()); - } - - private ComboBoxModel buildEyeColorComboBoxModel() { - return new ComboBoxModelAdapter(this.eyeColorsHolder, this.buildEyeColorAdapter()); - } - - private WritablePropertyValueModel buildEyeColorAdapter() { - return new PropertyAspectAdapter(this.selectedPersonHolder, Person.EYE_COLOR_PROPERTY) { - @Override - protected Object buildValue_() { - return this.subject.getEyeColor(); - } - @Override - protected void setValue_(Object value) { - this.subject.setEyeColor((String) value); - } - }; - } - - - // ********** evil check box ********** - - private JCheckBox buildEvilCheckBox() { - JCheckBox checkBox = new JCheckBox(); - checkBox.setText("evil"); - checkBox.setModel(this.buildEvilCheckBoxModel()); - return checkBox; - } - - private ButtonModel buildEvilCheckBoxModel() { - return new CheckBoxModelAdapter(this.buildEvilAdapter()); - } - - private WritablePropertyValueModel buildEvilAdapter() { - return new PropertyAspectAdapter(this.selectedPersonHolder, Person.EVIL_PROPERTY) { - @Override - protected Boolean buildValue_() { - return Boolean.valueOf(this.subject.isEvil()); - } - @Override - protected void setValue_(Boolean value) { - this.subject.setEvil(value.booleanValue()); - } - }; - } - - - // ********** rank spinner ********** - - private JSpinner buildRankSpinner() { - return new JSpinner(this.buildRankSpinnerModel()); - } - - private SpinnerModel buildRankSpinnerModel() { - return new NumberSpinnerModelAdapter(this.buildRankAdapter()); - } - - private WritablePropertyValueModel buildRankAdapter() { - return new PropertyAspectAdapter(this.selectedPersonHolder, Person.RANK_PROPERTY) { - @Override - protected Number buildValue_() { - return new Integer(this.subject.getRank()); - } - @Override - protected void setValue_(Number value) { - this.subject.setRank(value.intValue()); - } - }; - } - - - // ********** adventure count spinner ********** - - private JSpinner buildAdventureCountSpinner() { - return new JSpinner(this.buildAdventureCountSpinnerModel()); - } - - private SpinnerModel buildAdventureCountSpinnerModel() { - return new NumberSpinnerModelAdapter(this.buildAdventureCountAdapter()); - } - - private WritablePropertyValueModel buildAdventureCountAdapter() { - return new PropertyAspectAdapter(this.selectedPersonHolder, Person.ADVENTURE_COUNT_PROPERTY) { - @Override - protected Number buildValue_() { - return new Integer(this.subject.getAdventureCount()); - } - @Override - protected void setValue_(Number value) { - this.subject.setAdventureCount(value.intValue()); - } - }; - } - - - // ********** queries ********** - - private Crowd crowd() { - return this.crowdHolder.getValue(); - } - - private Person selectedPerson() { - if (this.rowSelectionModel.isSelectionEmpty()) { - return null; - } - return (Person) this.rowSelectionModel.selectedValue(); - } - - private void setSelectedPerson(Person person) { - this.rowSelectionModel.setSelectedValue(person); - } - - - // ********** custom renderer ********** - - /** - * This is simply an example of a renderer for the embedded combo-box. - * It does nothing special unless you uncomment the code below.... - */ - private class EyeColorRenderer extends DefaultListCellRenderer { - EyeColorRenderer() { - super(); - } - @Override - public Component getListCellRendererComponent(JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) { - // just do something to show the renderer is working... - // value = ">" + value; - return super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/TreeModelAdapterTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/TreeModelAdapterTests.java deleted file mode 100644 index 77d6ac00d8..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/TreeModelAdapterTests.java +++ /dev/null @@ -1,812 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import java.io.OutputStream; -import java.io.OutputStreamWriter; -import java.io.StringWriter; -import java.util.Arrays; -import java.util.Collection; -import java.util.Iterator; - -import javax.swing.Icon; -import javax.swing.JTree; -import javax.swing.event.TreeModelEvent; -import javax.swing.event.TreeModelListener; -import javax.swing.tree.TreeModel; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.IndentingPrintWriter; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.ReadOnlyIterator; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.AbstractTreeNodeValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.ItemPropertyListValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.NullListValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleListValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelWrapper; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.TransformationListValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.TreeModelAdapter; -import org.eclipse.jpt.common.utility.internal.swing.Displayable; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.ListChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.TreeNodeValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; - -@SuppressWarnings("nls") -public class TreeModelAdapterTests extends TestCase { - boolean eventFired; - - public TreeModelAdapterTests(String name) { - super(name); - } - - public void testGetRoot() { - TreeModel treeModel = this.buildSortedTreeModel(); - treeModel.addTreeModelListener(new TestTreeModelListener()); - TestNode rootNode = (TestNode) treeModel.getRoot(); - TestModel root = rootNode.getTestModel(); - assertEquals("root", root.getName()); -// root.dump(); -// rootNode.dump(); - } - - public void testGetChild() { - TreeModel treeModel = this.buildSortedTreeModel(); - treeModel.addTreeModelListener(new TestTreeModelListener()); - TestNode rootNode = (TestNode) treeModel.getRoot(); - - TestNode expected = rootNode.childNamed("node 1"); - TestNode actual = (TestNode) treeModel.getChild(rootNode, 1); - assertEquals(expected, actual); - - expected = rootNode.childNamed("node 2"); - actual = (TestNode) treeModel.getChild(rootNode, 2); - assertEquals(expected, actual); - } - - public void testGetChildCount() { - TreeModel treeModel = this.buildSortedTreeModel(); - treeModel.addTreeModelListener(new TestTreeModelListener()); - TestNode rootNode = (TestNode) treeModel.getRoot(); - - assertEquals(5, treeModel.getChildCount(rootNode)); - - TestNode node = rootNode.childNamed("node 1"); - assertEquals(1, treeModel.getChildCount(node)); - } - - public void testGetIndexOfChild() { - TreeModel treeModel = this.buildSortedTreeModel(); - treeModel.addTreeModelListener(new TestTreeModelListener()); - TestNode rootNode = (TestNode) treeModel.getRoot(); - - TestNode child = rootNode.childNamed("node 0"); - assertEquals(0, treeModel.getIndexOfChild(rootNode, child)); - - child = rootNode.childNamed("node 1"); - assertEquals(1, treeModel.getIndexOfChild(rootNode, child)); - - child = rootNode.childNamed("node 2"); - assertEquals(2, treeModel.getIndexOfChild(rootNode, child)); - TestNode grandchild = child.childNamed("node 2.2"); - assertEquals(2, treeModel.getIndexOfChild(child, grandchild)); - } - - public void testIsLeaf() { - TreeModel treeModel = this.buildSortedTreeModel(); - treeModel.addTreeModelListener(new TestTreeModelListener()); - TestNode rootNode = (TestNode) treeModel.getRoot(); - assertFalse(treeModel.isLeaf(rootNode)); - TestNode node = rootNode.childNamed("node 1"); - assertFalse(treeModel.isLeaf(node)); - node = rootNode.childNamed("node 3"); - assertTrue(treeModel.isLeaf(node)); - } - - - public void testTreeNodesChanged() { - // the only way to trigger a "node changed" event is to use an unsorted tree; - // a sorted tree will will trigger only "node removed" and "node inserted" events - TreeModel treeModel = this.buildUnsortedTreeModel(); - this.eventFired = false; - treeModel.addTreeModelListener(new TestTreeModelListener() { - @Override - public void treeNodesChanged(TreeModelEvent e) { - TreeModelAdapterTests.this.eventFired = true; - } - }); - TestNode rootNode = (TestNode) treeModel.getRoot(); - TestNode node = rootNode.childNamed("node 1"); - TestModel tm = node.getTestModel(); - tm.setName("node 1++"); - assertTrue(this.eventFired); - - this.eventFired = false; - node = node.childNamed("node 1.1"); - tm = node.getTestModel(); - tm.setName("node 1.1++"); - assertTrue(this.eventFired); - } - - public void testTreeNodesInserted() { - // use an unsorted tree so the nodes are not re-shuffled... - TreeModel treeModel = this.buildUnsortedTreeModel(); - this.eventFired = false; - treeModel.addTreeModelListener(new TestTreeModelListener() { - @Override - public void treeNodesInserted(TreeModelEvent e) { - TreeModelAdapterTests.this.eventFired = true; - } - }); - TestNode rootNode = (TestNode) treeModel.getRoot(); - TestNode node = rootNode.childNamed("node 1"); - TestModel tm = node.getTestModel(); - tm.addChild("new child..."); - assertTrue(this.eventFired); - - this.eventFired = false; - node = node.childNamed("node 1.1"); - tm = node.getTestModel(); - tm.addChild("another new child..."); - assertTrue(this.eventFired); - } - - public void testTreeNodesRemoved() { - TreeModel treeModel = this.buildUnsortedTreeModel(); - this.eventFired = false; - treeModel.addTreeModelListener(new TestTreeModelListener() { - @Override - public void treeNodesRemoved(TreeModelEvent e) { - TreeModelAdapterTests.this.eventFired = true; - } - }); - TestNode rootNode = (TestNode) treeModel.getRoot(); - TestModel root = rootNode.getTestModel(); - root.removeChild(root.childNamed("node 3")); - assertTrue(this.eventFired); - - this.eventFired = false; - TestNode node = rootNode.childNamed("node 2"); - TestModel tm = node.getTestModel(); - tm.removeChild(tm.childNamed("node 2.2")); - assertTrue(this.eventFired); - } - - public void testTreeStructureChanged() { - WritablePropertyValueModel> nodeHolder = new SimplePropertyValueModel>(this.buildSortedRootNode()); - TreeModel treeModel = this.buildTreeModel(nodeHolder); - this.eventFired = false; - treeModel.addTreeModelListener(new TestTreeModelListener() { - @Override - public void treeNodesInserted(TreeModelEvent e) { - // do nothing - } - @Override - public void treeNodesRemoved(TreeModelEvent e) { - // do nothing - } - @Override - public void treeStructureChanged(TreeModelEvent e) { - TreeModelAdapterTests.this.eventFired = true; - } - }); - nodeHolder.setValue(this.buildUnsortedRootNode()); - assertTrue(this.eventFired); - } - - /** - * test a problem we had where removing a child from a tree would cause - * the JTree to call #equals(Object) on each node removed (actually, it was - * TreePath, but that was because its own #equals(Object) was called by - * JTree); and since we had already removed the last listener from the - * aspect adapter, the aspect adapter would say its value was null; this - * would cause a NPE until we tweaked TreeModelAdapter to remove its - * listeners from a node only *after* the node had been completely - * removed from the JTree - * @see TreeModelAdapter#removeNode(Object[], int, TreeNodeValueModel) - * @see TreeModelAdapter#addNode(Object[], int, TreeNodeValueModel) - */ - public void testLazyInitialization() { - TreeModel treeModel = this.buildSpecialTreeModel(); - JTree jTree = new JTree(treeModel); - TestNode rootNode = (TestNode) treeModel.getRoot(); - TestModel root = rootNode.getTestModel(); - // this would cause a NPE: - root.removeChild(root.childNamed("node 3")); - assertEquals(treeModel, jTree.getModel()); - } - - - private TreeModel buildSortedTreeModel() { - return this.buildTreeModel(this.buildSortedRootNode()); - } - - private TestNode buildSortedRootNode() { - return new SortedTestNode(this.buildRoot()); - } - - private TreeModel buildUnsortedTreeModel() { - return this.buildTreeModel(this.buildUnsortedRootNode()); - } - - private TestNode buildUnsortedRootNode() { - return new UnsortedTestNode(this.buildRoot()); - } - - private TreeModel buildSpecialTreeModel() { - return this.buildTreeModel(this.buildSpecialRootNode()); - } - - private TestNode buildSpecialRootNode() { - return new SpecialTestNode(this.buildRoot()); - } - - private TestModel buildRoot() { - TestModel root = new TestModel("root"); - /*Node node_0 = */root.addChild("node 0"); - TestModel node_1 = root.addChild("node 1"); - TestModel node_1_1 = node_1.addChild("node 1.1"); - /*Node node_1_1_1 = */node_1_1.addChild("node 1.1.1"); - TestModel node_2 = root.addChild("node 2"); - /*Node node_2_0 = */node_2.addChild("node 2.0"); - /*Node node_2_1 = */node_2.addChild("node 2.1"); - /*Node node_2_2 = */node_2.addChild("node 2.2"); - /*Node node_2_3 = */node_2.addChild("node 2.3"); - /*Node node_2_4 = */node_2.addChild("node 2.4"); - /*Node node_2_5 = */node_2.addChild("node 2.5"); - /*Node node_3 = */root.addChild("node 3"); - /*Node node_4 = */root.addChild("node 4"); - return root; - } - - - // ********** member classes ********** - - /** - * This is a typical model class with the typical change notifications - * for #name and #children. - */ - public static class TestModel extends AbstractModel { - - // the parent is immutable; the root's parent is null - private final TestModel parent; - - // the name is mutable; so I guess it isn't the "primary key" :-) - private String name; - public static final String NAME_PROPERTY = "name"; - - private final Collection children; - public static final String CHILDREN_COLLECTION = "children"; - - - public TestModel(String name) { // root ctor - this(null, name); - } - private TestModel(TestModel parent, String name) { - super(); - this.parent = parent; - this.name = name; - this.children = new HashBag(); - } - - public TestModel getParent() { - return this.parent; - } - - public String getName() { - return this.name; - } - public void setName(String name) { - Object old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - public Iterator children() { - return new ReadOnlyIterator(this.children); - } - public int childrenSize() { - return this.children.size(); - } - public TestModel addChild(String childName) { - TestModel child = new TestModel(this, childName); - this.addItemToCollection(child, this.children, CHILDREN_COLLECTION); - return child; - } - public TestModel[] addChildren(String[] childNames) { - TestModel[] newChildren = new TestModel[childNames.length]; - for (int i = 0; i < childNames.length; i++) { - newChildren[i] = new TestModel(this, childNames[i]); - } - this.addItemsToCollection(newChildren, this.children, CHILDREN_COLLECTION); - return newChildren; - } - public void removeChild(TestModel child) { - this.removeItemFromCollection(child, this.children, CHILDREN_COLLECTION); - } - public void removeChildren(TestModel[] testModels) { - this.removeItemsFromCollection(testModels, this.children, CHILDREN_COLLECTION); - } - public void clearChildren() { - this.clearCollection(this.children, CHILDREN_COLLECTION); - } - public TestModel childNamed(String childName) { - for (TestModel child : this.children) { - if (child.getName().equals(childName)) { - return child; - } - } - throw new RuntimeException("child not found: " + childName); - } - - public String dumpString() { - StringWriter sw = new StringWriter(); - IndentingPrintWriter ipw = new IndentingPrintWriter(sw); - this.dumpOn(ipw); - return sw.toString(); - } - public void dumpOn(IndentingPrintWriter writer) { - writer.println(this); - writer.indent(); - for (TestModel child : this.children) { - child.dumpOn(writer); - } - writer.undent(); - } - public void dumpOn(OutputStream stream) { - IndentingPrintWriter writer = new IndentingPrintWriter(new OutputStreamWriter(stream)); - this.dumpOn(writer); - writer.flush(); - } - public void dump() { - this.dumpOn(System.out); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.name); - } - - } - - - /** - * This Node wraps a TestModel and converts into something that can - * be used by TreeModelAdapter. It converts changes to the TestModel's - * name into "state changes" to the Node; and converts the - * TestModel's children into a ListValueModel of Nodes whose order is - * determined by subclass implementations. - */ - public static abstract class TestNode extends AbstractTreeNodeValueModel implements Displayable, Comparable { - /** the model object wrapped by this node */ - private final TestModel testModel; - /** this node's parent node; null for the root node */ - private final TestNode parent; - /** this node's child nodes */ - private final ListValueModel> childrenModel; - /** a listener that notifies us when the model object's "internal state" changes */ - private final PropertyChangeListener testModelListener; - - - // ********** constructors/initialization ********** - - /** - * root node constructor - */ - public TestNode(TestModel testModel) { - this(null, testModel); - } - - /** - * branch or leaf node constructor - */ - public TestNode(TestNode parent, TestModel testModel) { - super(); - this.parent = parent; - this.testModel = testModel; - this.childrenModel = this.buildChildrenModel(testModel); - this.testModelListener = this.buildTestModelListener(); - } - - private PropertyChangeListener buildTestModelListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - TestNode.this.testModelChanged(e); - } - }; - } - - /** - * subclasses decide the order of the child nodes - */ - protected abstract ListValueModel> buildChildrenModel(TestModel model); - - /** - * used by subclasses; - * transform the test model children into nodes - */ - protected ListValueModel> buildNodeAdapter(TestModel model) { - return new TransformationListValueModel>(this.buildChildrenAdapter(model)) { - @Override - protected TestNode transformItem(TestModel item) { - return TestNode.this.buildChildNode(item); - } - }; - } - - /** - * subclasses must build a concrete node for the specified test model - */ - protected abstract TestNode buildChildNode(TestModel childTestModel); - - /** - * return a collection value model on the specified model's children - */ - protected CollectionValueModel buildChildrenAdapter(TestModel model) { - return new CollectionAspectAdapter(TestModel.CHILDREN_COLLECTION, model) { - @Override - protected Iterator iterator_() { - return this.subject.children(); - } - @Override - protected int size_() { - return this.subject.childrenSize(); - } - }; - } - - - // ********** TreeNodeValueModel implementation ********** - - public TestModel getValue() { - return this.testModel; - } - - public TreeNodeValueModel parent() { - return this.parent; - } - - public ListValueModel> childrenModel() { - return this.childrenModel; - } - - - // ********** AbstractTreeNodeValueModel implementation ********** - - @Override - protected void engageValue() { - this.testModel.addPropertyChangeListener(TestModel.NAME_PROPERTY, this.testModelListener); - } - - @Override - protected void disengageValue() { - this.testModel.removePropertyChangeListener(TestModel.NAME_PROPERTY, this.testModelListener); - } - - - // ********** Displayable implementation ********** - - public String displayString() { - return this.testModel.getName(); - } - - public Icon icon() { - return null; - } - - - // ********** debugging support ********** - - public String dumpString() { - StringWriter sw = new StringWriter(); - IndentingPrintWriter ipw = new IndentingPrintWriter(sw); - this.dumpOn(ipw); - return sw.toString(); - } - - public void dumpOn(IndentingPrintWriter writer) { - writer.println(this); - writer.indent(); - for (Iterator> stream = this.childrenModel.iterator(); stream.hasNext(); ) { - // cast to a TestNode (i.e. this won't work with a NameTestNode in the tree) - ((TestNode) stream.next()).dumpOn(writer); - } - writer.undent(); - } - - public void dumpOn(OutputStream stream) { - IndentingPrintWriter writer = new IndentingPrintWriter(new OutputStreamWriter(stream)); - this.dumpOn(writer); - writer.flush(); - } - - public void dump() { - this.dumpOn(System.out); - } - - - // ********** behavior ********** - - /** - * the model's name has changed, forward the event to our listeners - */ - protected void testModelChanged(PropertyChangeEvent e) { - // we need to notify listeners that our "internal state" has changed - this.fireStateChanged(); - // our display string stays in synch with the model's name - this.firePropertyChanged(DISPLAY_STRING_PROPERTY, e.getOldValue(), e.getNewValue()); - } - - - // ********** queries ********** - - public TestModel getTestModel() { - return this.testModel; - } - - /** - * testing convenience method - */ - public TestNode childNamed(String name) { - for (Iterator> stream = this.childrenModel.iterator(); stream.hasNext(); ) { - TreeNodeValueModel childNode = stream.next(); - if (childNode instanceof TestNode) { - if (((TestNode) childNode).getTestModel().getName().equals(name)) { - return (TestNode) childNode; - } - } - } - throw new IllegalArgumentException("child not found: " + name); - } - - - // ********** standard methods ********** - - public int compareTo(TestNode o) { - return this.displayString().compareTo(o.displayString()); - } - - @Override - public String toString() { - return "Node(" + this.testModel + ")"; - } - - } - - /** - * concrete implementation that keeps its children sorted - */ - public static class SortedTestNode extends TestNode { - - // ********** constructors ********** - public SortedTestNode(TestModel testModel) { - super(testModel); - } - public SortedTestNode(TestNode parent, TestModel testModel) { - super(parent, testModel); - } - - // ********** initialization ********** - /** the list should be sorted */ - @Override - protected ListValueModel> buildChildrenModel(TestModel testModel) { - return new SortedListValueModelWrapper>(this.buildDisplayStringAdapter(testModel)); - } - /** the display string (name) of each node can change */ - protected ListValueModel> buildDisplayStringAdapter(TestModel testModel) { - return new ItemPropertyListValueModelAdapter>(this.buildNodeAdapter(testModel), DISPLAY_STRING_PROPERTY); - } - /** children are also sorted nodes */ - @Override - protected TestNode buildChildNode(TestModel childNode) { - return new SortedTestNode(this, childNode); - } - - } - - - /** - * concrete implementation that leaves its children unsorted - */ - public static class UnsortedTestNode extends TestNode { - - // ********** constructors ********** - public UnsortedTestNode(TestModel testModel) { - super(testModel); - } - public UnsortedTestNode(TestNode parent, TestModel testModel) { - super(parent, testModel); - } - - // ********** initialization ********** - /** the list should NOT be sorted */ - @Override - protected ListValueModel> buildChildrenModel(TestModel testModel) { - return this.buildNodeAdapter(testModel); - } - /** children are also unsorted nodes */ - @Override - protected TestNode buildChildNode(TestModel childNode) { - return new UnsortedTestNode(this, childNode); - } - - } - - - /** - * concrete implementation that leaves its children unsorted - * and has a special set of children for "node 3" - */ - public static class SpecialTestNode extends UnsortedTestNode { - - // ********** constructors ********** - public SpecialTestNode(TestModel testModel) { - super(testModel); - } - public SpecialTestNode(TestNode parent, TestModel testModel) { - super(parent, testModel); - } - - // ********** initialization ********** - /** return a different list of children for "node 3" */ - @Override - protected ListValueModel> buildChildrenModel(TestModel testModel) { - if (testModel.getName().equals("node 3")) { - return this.buildSpecialChildrenModel(); - } - return super.buildChildrenModel(testModel); - } - protected ListValueModel> buildSpecialChildrenModel() { - TreeNodeValueModel[] children = new NameTestNode[1]; - children[0] = new NameTestNode(this); - return new SimpleListValueModel>(Arrays.asList(children)); - } - /** children are also special nodes */ - @Override - protected TestNode buildChildNode(TestModel childNode) { - return new SpecialTestNode(this, childNode); - } - - } - - - public static class NameTestNode extends AbstractTreeNodeValueModel { - private final WritablePropertyValueModel nameAdapter; - private final SpecialTestNode specialNode; // parent node - private final PropertyChangeListener nameListener; - private final ListValueModel> childrenModel; - - // ********** construction/initialization ********** - - public NameTestNode(SpecialTestNode specialNode) { - super(); - this.nameListener = this.buildNameListener(); - this.specialNode = specialNode; - this.nameAdapter = this.buildNameAdapter(); - this.childrenModel = new NullListValueModel>(); - } - protected PropertyChangeListener buildNameListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent e) { - NameTestNode.this.nameChanged(e); - } - }; - } - protected WritablePropertyValueModel buildNameAdapter() { - return new PropertyAspectAdapter(TestModel.NAME_PROPERTY, this.getTestModel()) { - @Override - protected String buildValue_() { - return this.subject.getName(); - } - @Override - protected void setValue_(String value) { - this.subject.setName(value); - } - }; - } - - public TestModel getTestModel() { - return this.specialNode.getTestModel(); - } - - // ********** TreeNodeValueModel implementation ********** - - public String getValue() { - return this.nameAdapter.getValue(); - } - @Override - public void setValue(Object value) { - this.nameAdapter.setValue((String) value); - } - public TreeNodeValueModel parent() { - return this.specialNode; - } - public ListValueModel> childrenModel() { - return this.childrenModel; - } - - // ********** AbstractTreeNodeValueModel implementation ********** - - @Override - protected void engageValue() { - this.nameAdapter.addPropertyChangeListener(PropertyValueModel.VALUE, this.nameListener); - } - @Override - protected void disengageValue() { - this.nameAdapter.removePropertyChangeListener(PropertyValueModel.VALUE, this.nameListener); - } - - // ********** behavior ********** - - protected void nameChanged(PropertyChangeEvent e) { - // we need to notify listeners that our "value" has changed - this.firePropertyChanged(VALUE, e.getOldValue(), e.getNewValue()); - } - } - - private TreeModel buildTreeModel(TestNode root) { - return this.buildTreeModel(new StaticPropertyValueModel>(root)); - } - - private TreeModel buildTreeModel(PropertyValueModel> rootHolder) { - return new TreeModelAdapter(rootHolder) { - @Override - protected ListChangeListener buildChildrenListener() { - return this.buildChildrenListener_(); - } - @Override - protected StateChangeListener buildNodeStateListener() { - return this.buildNodeStateListener_(); - } - @Override - protected PropertyChangeListener buildNodeValueListener() { - return this.buildNodeValueListener_(); - } - @Override - protected PropertyChangeListener buildRootListener() { - return this.buildRootListener_(); - } - }; - } - - - - /** - * listener that will blow up with any event; - * override and implement expected event methods - */ - public class TestTreeModelListener implements TreeModelListener { - public void treeNodesChanged(TreeModelEvent e) { - fail("unexpected event"); - } - public void treeNodesInserted(TreeModelEvent e) { - fail("unexpected event"); - } - public void treeNodesRemoved(TreeModelEvent e) { - fail("unexpected event"); - } - public void treeStructureChanged(TreeModelEvent e) { - fail("unexpected event"); - } - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/TreeModelAdapterUITest.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/TreeModelAdapterUITest.java deleted file mode 100644 index 967a02783e..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/model/value/swing/TreeModelAdapterUITest.java +++ /dev/null @@ -1,425 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.model.value.swing; - -import java.awt.BorderLayout; -import java.awt.Component; -import java.awt.GridLayout; -import java.awt.TextField; -import java.awt.event.ActionEvent; -import java.awt.event.WindowAdapter; -import java.awt.event.WindowEvent; -import java.awt.event.WindowListener; -import java.util.Collection; -import java.util.Collections; -import java.util.Enumeration; -import javax.swing.AbstractAction; -import javax.swing.Action; -import javax.swing.JButton; -import javax.swing.JFrame; -import javax.swing.JPanel; -import javax.swing.JScrollPane; -import javax.swing.JTree; -import javax.swing.WindowConstants; -import javax.swing.event.TreeSelectionEvent; -import javax.swing.event.TreeSelectionListener; -import javax.swing.tree.DefaultTreeSelectionModel; -import javax.swing.tree.TreeModel; -import javax.swing.tree.TreePath; -import javax.swing.tree.TreeSelectionModel; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.EnumerationIterator; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.swing.TreeModelAdapter; -import org.eclipse.jpt.common.utility.internal.swing.Displayable; -import org.eclipse.jpt.common.utility.model.value.TreeNodeValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.common.utility.tests.internal.model.value.swing.TreeModelAdapterTests.SortedTestNode; -import org.eclipse.jpt.common.utility.tests.internal.model.value.swing.TreeModelAdapterTests.TestModel; -import org.eclipse.jpt.common.utility.tests.internal.model.value.swing.TreeModelAdapterTests.TestNode; -import org.eclipse.jpt.common.utility.tests.internal.model.value.swing.TreeModelAdapterTests.UnsortedTestNode; - -/** - * an example UI for testing the TreeModelAdapter - */ -@SuppressWarnings("nls") -public class TreeModelAdapterUITest { - - // hold the tree so we can restore its expansion state - private JTree tree; - private WritablePropertyValueModel> rootNodeHolder; - private boolean sorted; - private TreeModel treeModel; - private TreeSelectionModel treeSelectionModel; - private TextField nameTextField; - - public static void main(String[] args) throws Exception { - new TreeModelAdapterUITest().exec(); - } - - private TreeModelAdapterUITest() { - super(); - } - - private void exec() throws Exception { - this.rootNodeHolder = this.buildRootNodeHolder(); - this.sorted = this.rootNodeHolder.getValue() instanceof SortedTestNode; - this.treeModel = this.buildTreeModel(); - this.treeSelectionModel = this.buildTreeSelectionModel(); - this.nameTextField = new TextField(); - this.openWindow(); - } - - private WritablePropertyValueModel> buildRootNodeHolder() { - return new SimplePropertyValueModel>(this.buildSortedRootNode()); - } - - private TestNode buildSortedRootNode() { - return new SortedTestNode(this.buildRoot()); - } - - private TestNode buildUnsortedRootNode() { - return new UnsortedTestNode(this.buildRoot()); - } - - private TestModel buildRoot() { - TestModel root = new TestModel("root"); - - TestModel node_1 = root.addChild("node 1"); - /*Node node_1_1 = */node_1.addChild("node 1.1"); - - TestModel node_2 = root.addChild("node 2"); - /*Node node_2_1 = */node_2.addChild("node 2.1"); - TestModel node_2_2 = node_2.addChild("node 2.2"); - /*Node node_2_2_1 = */node_2_2.addChild("node 2.2.1"); - /*Node node_2_2_2 = */node_2_2.addChild("node 2.2.2"); - /*Node node_2_3 = */node_2.addChild("node 2.3"); - /*Node node_2_4 = */node_2.addChild("node 2.4"); - /*Node node_2_5 = */node_2.addChild("node 2.5"); - - TestModel node_3 = root.addChild("node 3"); - TestModel node_3_1 = node_3.addChild("node 3.1"); - TestModel node_3_1_1 = node_3_1.addChild("node 3.1.1"); - /*Node node_3_1_1_1 = */node_3_1_1.addChild("node 3.1.1.1"); - - /*Node node_4 = */root.addChild("node 4"); - - return root; - } - - private TreeModel buildTreeModel() { - return new TreeModelAdapter(this.rootNodeHolder); - } - - private TreeSelectionModel buildTreeSelectionModel() { - TreeSelectionModel tsm = new DefaultTreeSelectionModel(); - tsm.addTreeSelectionListener(this.buildTreeSelectionListener()); - tsm.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION); - return tsm; - } - - private TreeSelectionListener buildTreeSelectionListener() { - return new TreeSelectionListener() { - public void valueChanged(TreeSelectionEvent e) { - TreeModelAdapterUITest.this.treeSelectionChanged(e); - } - }; - } - - void treeSelectionChanged(@SuppressWarnings("unused") TreeSelectionEvent e) { - TestModel selectedTestModel = this.selectedTestModel(); - if (selectedTestModel != null) { - this.nameTextField.setText(selectedTestModel.getName()); - } - } - - private void openWindow() { - JFrame window = new JFrame(this.getClass().getName()); - window.setDefaultCloseOperation(WindowConstants.DO_NOTHING_ON_CLOSE); - window.addWindowListener(this.buildWindowListener()); - window.getContentPane().add(this.buildMainPanel(), "Center"); - window.setLocation(300, 300); - window.setSize(400, 400); - window.setVisible(true); - } - - private WindowListener buildWindowListener() { - return new WindowAdapter() { - @Override - public void windowClosing(WindowEvent e) { - e.getWindow().setVisible(false); - System.exit(0); - } - }; - } - - private Component buildMainPanel() { - JPanel mainPanel = new JPanel(new BorderLayout()); - mainPanel.add(this.buildTreePane(), BorderLayout.CENTER); - mainPanel.add(this.buildControlPanel(), BorderLayout.SOUTH); - return mainPanel; - } - - private Component buildTreePane() { - return new JScrollPane(this.buildTree()); - } - - private JTree buildTree() { - this.tree = new JTree(this.treeModel) { - @Override - public String convertValueToText(Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { - return ((Displayable) value).displayString(); - } - }; - this.tree.setSelectionModel(this.treeSelectionModel); - this.tree.setRootVisible(true); - this.tree.setShowsRootHandles(true); - this.tree.setRowHeight(20); - this.tree.setDoubleBuffered(true); - return this.tree; - } - - private Component buildControlPanel() { - JPanel controlPanel = new JPanel(new GridLayout(0, 1)); - controlPanel.add(this.buildAddRenameNodePanel()); - controlPanel.add(this.buildMiscPanel()); - return controlPanel; - } - - private Component buildAddRenameNodePanel() { - JPanel addRenameNodePanel = new JPanel(new BorderLayout()); - addRenameNodePanel.add(this.buildAddButton(), BorderLayout.WEST); - addRenameNodePanel.add(this.nameTextField, BorderLayout.CENTER); - addRenameNodePanel.add(this.buildRenameButton(), BorderLayout.EAST); - return addRenameNodePanel; - } - - private Component buildMiscPanel() { - JPanel miscPanel = new JPanel(new GridLayout(1, 0)); - miscPanel.add(this.buildClearChildrenButton()); - miscPanel.add(this.buildRemoveButton()); - miscPanel.add(this.buildResetButton()); - return miscPanel; - } - - private String getName() { - return this.nameTextField.getText(); - } - - // ********** queries ********** - private TestNode selectedNode() { - if (this.treeSelectionModel.isSelectionEmpty()) { - return null; - } - return (TestNode) this.treeSelectionModel.getSelectionPath().getLastPathComponent(); - } - - private TestModel selectedTestModel() { - if (this.treeSelectionModel.isSelectionEmpty()) { - return null; - } - return this.selectedNode().getValue(); - } - - private TestNode rootNode() { - return (TestNode) this.treeModel.getRoot(); - } - - private TestModel root() { - return this.rootNode().getValue(); - } - - private Collection expandedPaths() { - Enumeration stream = this.tree.getExpandedDescendants(new TreePath(this.rootNode())); - if (stream == null) { - return Collections.emptyList(); - } - return CollectionTools.list(new EnumerationIterator(stream)); - } - - // ********** behavior ********** - private void setSelectedNode(TestNode selectedNode) { - this.treeSelectionModel.setSelectionPath(new TreePath(selectedNode.path())); - } - - private void expandPaths(Collection paths) { - for (TreePath path : paths) { - this.tree.expandPath(path); - } - } - - // ********** add ********** - private JButton buildAddButton() { - return new JButton(this.buildAddAction()); - } - - private Action buildAddAction() { - Action action = new AbstractAction("add") { - public void actionPerformed(ActionEvent event) { - TreeModelAdapterUITest.this.addNode(); - } - }; - action.setEnabled(true); - return action; - } - - /** - * adding causes the tree to be sorted and nodes to be - * removed and re-added; so we have to fiddle with the expansion state - */ - void addNode() { - TestModel selectedTestModel = this.selectedTestModel(); - if (selectedTestModel != null) { - String name = this.getName(); - // save the expansion state and restore it after the add - Collection paths = this.expandedPaths(); - - selectedTestModel.addChild(name); - - this.expandPaths(paths); - this.setSelectedNode(this.selectedNode().childNamed(name)); - } - } - - // ********** remove ********** - private JButton buildRemoveButton() { - return new JButton(this.buildRemoveAction()); - } - - private Action buildRemoveAction() { - Action action = new AbstractAction("remove") { - public void actionPerformed(ActionEvent event) { - TreeModelAdapterUITest.this.removeNode(); - } - }; - action.setEnabled(true); - return action; - } - - /** - * we need to figure out which node to select after - * the selected node is deleted - */ - void removeNode() { - TestModel selectedTestModel = this.selectedTestModel(); - // do not allow the root to be removed - if ((selectedTestModel != null) && (selectedTestModel != this.root())) { - // save the parent and index, so we can select another, nearby, node - // once the selected node is removed - TestNode parentNode = (TestNode) this.selectedNode().parent(); - int childIndex = parentNode.indexOfChild(this.selectedNode()); - - selectedTestModel.getParent().removeChild(selectedTestModel); - - int childrenSize = parentNode.childrenSize(); - if (childIndex < childrenSize) { - // select the child that moved up and replaced the just-deleted child - this.setSelectedNode((TestNode) parentNode.child(childIndex)); - } else { - if (childrenSize == 0) { - // if there are no more children, select the parent - this.setSelectedNode(parentNode); - } else { - // if the child at the bottom of the list was deleted, select the next child up - this.setSelectedNode((TestNode) parentNode.child(childIndex - 1)); - } - } - } - } - - // ********** rename ********** - private JButton buildRenameButton() { - return new JButton(this.buildRenameAction()); - } - - private Action buildRenameAction() { - Action action = new AbstractAction("rename") { - public void actionPerformed(ActionEvent event) { - TreeModelAdapterUITest.this.renameNode(); - } - }; - action.setEnabled(true); - return action; - } - - /** - * renaming causes the tree to be sorted and nodes to be - * removed and re-added; so we have to fiddle with the expansion state - */ - void renameNode() { - TestModel selectedTestModel = this.selectedTestModel(); - if (selectedTestModel != null) { - // save the node and re-select it after the rename - TestNode selectedNode = this.selectedNode(); - // save the expansion state and restore it after the rename - Collection paths = this.expandedPaths(); - - selectedTestModel.setName(this.getName()); - - this.expandPaths(paths); - this.setSelectedNode(selectedNode); - } - } - - // ********** clear children ********** - private JButton buildClearChildrenButton() { - return new JButton(this.buildClearChildrenAction()); - } - - private Action buildClearChildrenAction() { - Action action = new AbstractAction("clear children") { - public void actionPerformed(ActionEvent event) { - TreeModelAdapterUITest.this.clearChildren(); - } - }; - action.setEnabled(true); - return action; - } - - /** - * nothing special, we just want to test #fireCollectionChanged(String) - */ - void clearChildren() { - TestModel selectedTestModel = this.selectedTestModel(); - if (selectedTestModel != null) { - selectedTestModel.clearChildren(); - } - } - - // ********** reset ********** - private JButton buildResetButton() { - return new JButton(this.buildResetAction()); - } - - private Action buildResetAction() { - Action action = new AbstractAction("reset") { - public void actionPerformed(ActionEvent event) { - TreeModelAdapterUITest.this.reset(); - } - }; - action.setEnabled(true); - return action; - } - - /** - * test the adapter's root node holder; - * toggle between sorted and unsorted lists - */ - void reset() { - this.sorted = ! this.sorted; - if (this.sorted) { - this.rootNodeHolder.setValue(this.buildSortedRootNode()); - } else { - this.rootNodeHolder.setValue(this.buildUnsortedRootNode()); - } - this.tree.expandPath(new TreePath(this.rootNode())); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/node/AbstractNodeTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/node/AbstractNodeTests.java deleted file mode 100644 index 74cd629a88..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/node/AbstractNodeTests.java +++ /dev/null @@ -1,495 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.node; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; - -import junit.framework.TestCase; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; -import org.eclipse.jpt.common.utility.internal.node.AbstractNode; -import org.eclipse.jpt.common.utility.internal.node.Node; -import org.eclipse.jpt.common.utility.internal.node.Problem; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class AbstractNodeTests extends TestCase { - private TestWorkbenchModel root; - - public AbstractNodeTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.root = this.buildRoot(); - } - - private TestWorkbenchModel buildRoot() { - TestWorkbenchModel r = new RootTestWorkbenchModel("root"); - TestWorkbenchModel node1 = r.addTestChildNamed("node 1"); - TestWorkbenchModel node1_1 = node1.addTestChildNamed("node 1.1"); - node1_1.addTestChildNamed("node 1.1.1"); - node1_1.addTestChildNamed("node 1.1.2"); - node1_1.addTestChildNamed("node 1.1.3"); - node1.addTestChildNamed("node 1.2"); - TestWorkbenchModel node2 = r.addTestChildNamed("node 2"); - node2.addTestChildNamed("node 2.1"); - node2.addTestChildNamed("node 2.2"); - r.addTestChildNamed("node 3"); - r.addTestChildNamed("node 4"); - - // mark the entire tree clean - r.markEntireBranchClean(); - return r; - } - - @Override - protected void tearDown() throws Exception { - TestTools.clear(this); - super.tearDown(); - } - - public void testTestWorkbenchModel() { - // make sure our test class works OK... - assertNull(this.root.testChildNamed("")); - assertNotNull(this.root.testChildNamed("node 1")); - assertTrue(this.root.testChildNamed("node 1").isClean()); - assertTrue(this.root.testChildNamed("node 1").isCleanBranch()); - assertNotNull(this.root.testChildNamed("node 2")); - assertTrue(this.root.testChildNamed("node 2").isClean()); - assertTrue(this.root.testChildNamed("node 2").isCleanBranch()); - assertNull(this.root.testChildNamed("node 2.1")); - - assertNull(this.root.testDescendantNamed("")); - assertNotNull(this.root.testDescendantNamed("node 1")); - assertNotNull(this.root.testDescendantNamed("node 2")); - assertNotNull(this.root.testDescendantNamed("node 2.1")); - assertTrue(this.root.testDescendantNamed("node 2.1").isClean()); - assertTrue(this.root.testDescendantNamed("node 2.1").isCleanBranch()); - assertNotNull(this.root.testDescendantNamed("node 1.1.3")); - assertTrue(this.root.testDescendantNamed("node 1.1.3").isClean()); - assertTrue(this.root.testDescendantNamed("node 1.1.3").isCleanBranch()); - } - - public void testParentAndChildren() { - TestWorkbenchModel node = this.root.testDescendantNamed("node 1.1.3"); - assertEquals("node 1.1.3", node.getName()); - assertEquals(0, CollectionTools.size(node.children())); - - node = (TestWorkbenchModel) node.getParent(); - assertEquals("node 1.1", node.getName()); - assertEquals(3, CollectionTools.size(node.children())); - - node = (TestWorkbenchModel) node.getParent(); - assertEquals("node 1", node.getName()); - assertEquals(2, CollectionTools.size(node.children())); - - node = (TestWorkbenchModel) node.getParent(); - assertEquals("root", node.getName()); - assertEquals(4, CollectionTools.size(node.children())); - - node = (TestWorkbenchModel) node.getParent(); - assertNull(node); - } - - public void testDirty() { - TestWorkbenchModel node = this.root.testDescendantNamed("node 1.1.3"); - node.setSize(42); - assertTrue(node.isDirty()); - - TestWorkbenchModel parent = (TestWorkbenchModel) node.getParent(); - assertTrue(parent.isClean()); - assertTrue(this.root.isClean()); - } - - public void testDirtyUnchangedAttribute() { - TestWorkbenchModel node = this.root.testDescendantNamed("node 1.1.3"); - node.setSize(42); - assertTrue(node.isDirty()); - - TestWorkbenchModel parent = (TestWorkbenchModel) node.getParent(); - assertTrue(parent.isClean()); - assertTrue(this.root.isClean()); - - this.root.markEntireBranchClean(); - // set size to same number - should stay clean - node.setSize(42); - assertTrue(node.isClean()); - assertTrue(parent.isClean()); - assertTrue(this.root.isClean()); - } - - public void testDirtyBranch() { - TestWorkbenchModel node = this.root.testDescendantNamed("node 1.1.3"); - node.setSize(42); - assertTrue(node.isDirtyBranch()); - - TestWorkbenchModel parent = (TestWorkbenchModel) node.getParent(); - assertTrue(parent.isDirtyBranch()); - assertTrue(this.root.isDirtyBranch()); - - parent.setSize(77); - assertTrue(parent.isDirty()); - assertTrue(parent.isDirtyBranch()); - - node.markEntireBranchClean(); - assertTrue(parent.isDirty()); - assertTrue(parent.isDirtyBranch()); - } - - public void testDirtyBranchCleanChildDirtyParent() { - TestWorkbenchModel node = this.root.testDescendantNamed("node 1.1.3"); - node.setSize(42); - - TestWorkbenchModel parent = (TestWorkbenchModel) node.getParent(); - parent.setSize(77); - assertTrue(parent.isDirty()); - assertTrue(parent.isDirtyBranch()); - - // now, clean the child, but leave the parent dirty - node.markEntireBranchClean(); - assertTrue(parent.isDirty()); - assertTrue(parent.isDirtyBranch()); - } - - public void testDirtyBranchCleanChildDirtyChild() { - TestWorkbenchModel node1 = this.root.testDescendantNamed("node 1.1.1"); - node1.setSize(41); - TestWorkbenchModel node2 = this.root.testDescendantNamed("node 1.1.2"); - node2.setSize(42); - - TestWorkbenchModel parent = (TestWorkbenchModel) node1.getParent(); - assertTrue(parent.isClean()); - assertTrue(parent.isDirtyBranch()); - - // now, clean the first child, but leave the second child dirty - node1.markEntireBranchClean(); - assertTrue(parent.isClean()); - assertTrue(parent.isDirtyBranch()); - } - - public void testDirtyBranchForced() { - TestWorkbenchModel node = this.root.testDescendantNamed("node 1.1.3"); - TestWorkbenchModel parent = (TestWorkbenchModel) node.getParent(); - - assertTrue(node.isClean()); - assertTrue(node.isCleanBranch()); - assertTrue(parent.isClean()); - assertTrue(parent.isCleanBranch()); - assertTrue(this.root.isClean()); - assertTrue(this.root.isCleanBranch()); - - this.root.markEntireBranchDirty(); - - assertTrue(node.isDirty()); - assertTrue(node.isDirtyBranch()); - assertTrue(parent.isDirty()); - assertTrue(parent.isDirtyBranch()); - assertTrue(this.root.isDirty()); - assertTrue(this.root.isDirtyBranch()); - } - - public void testDirtyTransientAttribute() { - TestWorkbenchModel node = this.root.testDescendantNamed("node 1.1.3"); - node.setName("BOGUS"); - assertTrue(node.isDirty()); - TestWorkbenchModel parent = (TestWorkbenchModel) node.getParent(); - assertTrue(parent.isClean()); - assertTrue(parent.isDirtyBranch()); - assertTrue(this.root.isClean()); - assertTrue(this.root.isDirtyBranch()); - - this.root.markEntireBranchClean(); - - this.root.validateBranch(); - - assertTrue(this.root.problemsSize() == 0); - assertTrue(node.branchProblems().hasNext()); - assertTrue(parent.problemsSize() == 0); - assertTrue(parent.branchProblems().hasNext()); - assertTrue(node.problemsSize() > 0); - - // since problems are transient, everything should still be clean - assertTrue(node.isClean()); - assertTrue(node.isCleanBranch()); - assertTrue(parent.isClean()); - assertTrue(parent.isCleanBranch()); - assertTrue(this.root.isClean()); - assertTrue(this.root.isCleanBranch()); - } - - public void testProblems() { - TestWorkbenchModel node = this.root.testDescendantNamed("node 1.1.3"); - node.setName("BOGUS"); - TestWorkbenchModel parent = (TestWorkbenchModel) node.getParent(); - - this.root.validateBranch(); - - assertEquals(0, this.root.problemsSize()); - assertTrue(node.branchProblems().hasNext()); - assertEquals(0, parent.problemsSize()); - assertTrue(parent.branchProblems().hasNext()); - assertEquals(1, node.problemsSize()); - Problem problem1 = node.problems().next(); - - // now create another problem that should remove the old problem - node.setName("STILL BOGUS"); - this.root.validateBranch(); - - assertEquals(0, this.root.problemsSize()); - assertTrue(node.branchProblems().hasNext()); - assertEquals(0, parent.problemsSize()); - assertTrue(parent.branchProblems().hasNext()); - assertEquals(1, node.problemsSize()); - Problem problem2 = node.problems().next(); - assertFalse(problem1 == problem2); - problem1 = problem2; - - // now create another problem that should replace the old problem - node.setName("STILL BOGUS"); - this.root.validateBranch(); - - assertEquals(0, this.root.problemsSize()); - assertTrue(node.branchProblems().hasNext()); - assertEquals(0, parent.problemsSize()); - assertTrue(parent.branchProblems().hasNext()); - assertEquals(1, node.problemsSize()); - problem2 = node.problems().next(); - // the same problem should be there - assertTrue(problem1.equals(problem2)); - } - - public void testBranchProblems() { - TestWorkbenchModel node = this.root.testDescendantNamed("node 1.1.3"); - node.setName("BOGUS"); - TestWorkbenchModel parent = (TestWorkbenchModel) node.getParent(); - parent.setName("BOGUS TOO"); - this.root.setName("BOGUS TOO TOO"); - - this.root.validateBranch(); - - assertEquals(1, this.root.problemsSize()); - assertEquals(3, this.root.branchProblemsSize()); - assertEquals(1, parent.problemsSize()); - assertEquals(2, parent.branchProblemsSize()); - assertEquals(1, node.problemsSize()); - assertEquals(1, node.branchProblemsSize()); - - node.setName("okie-dokie"); - - this.root.validateBranch(); - - assertEquals(1, this.root.problemsSize()); - assertEquals(2, this.root.branchProblemsSize()); - assertEquals(1, parent.problemsSize()); - assertEquals(1, parent.branchProblemsSize()); - assertEquals(0, node.problemsSize()); - assertEquals(0, node.branchProblemsSize()); - } - - public void testClearAllBranchProblems() { - TestWorkbenchModel node = this.root.testDescendantNamed("node 1.1.3"); - node.setName("BOGUS"); - TestWorkbenchModel parent = (TestWorkbenchModel) node.getParent(); - parent.setName("BOGUS TOO"); - this.root.setName("BOGUS TOO TOO"); - - this.root.validateBranch(); - - assertEquals(1, this.root.problemsSize()); - assertEquals(3, this.root.branchProblemsSize()); - assertEquals(1, parent.problemsSize()); - assertEquals(2, parent.branchProblemsSize()); - assertEquals(1, node.problemsSize()); - assertEquals(1, node.branchProblemsSize()); - - parent.clearAllBranchProblems(); - - assertEquals(1, this.root.problemsSize()); - assertEquals(1, this.root.branchProblemsSize()); - assertEquals(0, parent.problemsSize()); - assertEquals(0, parent.branchProblemsSize()); - assertEquals(0, node.problemsSize()); - assertEquals(0, CollectionTools.size(node.branchProblems())); - } - - public void testRemovedBranchProblems() { - TestWorkbenchModel node = this.root.testDescendantNamed("node 1.1.3"); - node.setName("BOGUS"); - TestWorkbenchModel parent = (TestWorkbenchModel) node.getParent(); - parent.setName("BOGUS TOO"); - this.root.setName("BOGUS TOO TOO"); - - this.root.validateBranch(); - - assertEquals(1, this.root.problemsSize()); - assertEquals(3, CollectionTools.size(this.root.branchProblems())); - assertEquals(1, parent.problemsSize()); - assertEquals(2, parent.branchProblemsSize()); - assertEquals(1, node.problemsSize()); - assertEquals(1, CollectionTools.size(node.branchProblems())); - - // completely remove a node that has problems - - // the entire tree should recalculate its "branch" problems - parent.removeTestChild(node); - - this.root.validateBranch(); - - assertEquals(1, this.root.problemsSize()); - assertEquals(2, CollectionTools.size(this.root.branchProblems())); - assertEquals(1, parent.problemsSize()); - assertEquals(1, parent.branchProblemsSize()); - } - - - // ********** inner classes ********** - - public class TestWorkbenchModel extends AbstractNode { - private String name; - public static final String NAME_PROPERTY = "name"; - private int size; - public static final String SIZE_PROPERTY = "size"; - private Collection testChildren; - public static final String TEST_CHILDREN_COLLECTION = "children"; - - // ********** construction/initialization ********** - public TestWorkbenchModel(TestWorkbenchModel parent, String name) { - super(parent); - if (name == null) { - throw new NullPointerException(); - } - this.name = name; - } - @Override - protected void initialize() { - super.initialize(); - this.size = 0; - this.testChildren = new HashBag(); - } - - @Override - protected void checkParent(Node parent) { - // do nothing - } - - - // ********** accessors ********** - public String getName() { - return this.name; - } - public void setName(String name) { - Object old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - public int getSize() { - return this.size; - } - public void setSize(int size) { - int old = this.size; - this.size = size; - this.firePropertyChanged(SIZE_PROPERTY, old, size); - } - - public Iterator testChildren() { - return new CloneIterator(this.testChildren) { - @Override - protected void remove(TestWorkbenchModel current) { - TestWorkbenchModel.this.removeTestChild(current); - } - }; - } - public int testChildrenSize() { - return this.testChildren.size(); - } - private TestWorkbenchModel addTestChild(TestWorkbenchModel testChild) { - this.addItemToCollection(testChild, this.testChildren, TEST_CHILDREN_COLLECTION); - return testChild; - } - public TestWorkbenchModel addTestChildNamed(String childName) { - if (this.testChildNamed(childName) != null) { - throw new IllegalArgumentException(childName); - } - return this.addTestChild(new TestWorkbenchModel(this, childName)); - } - public void removeTestChild(TestWorkbenchModel testChild) { - this.removeItemFromCollection(testChild, this.testChildren, TEST_CHILDREN_COLLECTION); - } - - // ********** queries ********** - public String displayString() { - return this.name; - } - public TestWorkbenchModel testChildNamed(String childName) { - for (TestWorkbenchModel testChild : this.testChildren) { - if (testChild.getName().equals(childName)) { - return testChild; - } - } - return null; - } - public TestWorkbenchModel testDescendantNamed(String descendantName) { - for (TestWorkbenchModel testDescendant : this.testChildren) { - if (testDescendant.getName().equals(descendantName)) { - return testDescendant; - } - // recurse... - testDescendant = testDescendant.testDescendantNamed(descendantName); - if (testDescendant != null) { - return testDescendant; - } - } - return null; - } - - // ********** behavior ********** - @Override - protected void addChildrenTo(List children) { - super.addChildrenTo(children); - children.addAll(this.testChildren); - } - @Override - protected void addProblemsTo(List currentProblems) { - super.addProblemsTo(currentProblems); - // names must be all lowercase... - for (int i = this.name.length(); i-- > 0; ) { - char c = this.name.charAt(i); - if (Character.isLetter(c) && ! Character.isLowerCase(c)) { - currentProblems.add(this.buildProblem("NAME_MUST_BE_LOWERCASE", 3 ,this.name)); - return; - } - } - } - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - } - - - private class RootTestWorkbenchModel extends TestWorkbenchModel { - public RootTestWorkbenchModel(String name) { - super(null, name); - } - @Override - public Validator getValidator() { - return Node.NULL_VALIDATOR; - } - } - -} - diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/node/JptUtilityNodeTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/node/JptUtilityNodeTests.java deleted file mode 100644 index 16f6dce93d..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/node/JptUtilityNodeTests.java +++ /dev/null @@ -1,29 +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.common.utility.tests.internal.node; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class JptUtilityNodeTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptUtilityNodeTests.class.getPackage().getName()); - - suite.addTestSuite(AbstractNodeTests.class); - - return suite; - } - - private JptUtilityNodeTests() { - super(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/AsynchronousSynchronizerTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/AsynchronousSynchronizerTests.java deleted file mode 100644 index 3ddbadc460..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/AsynchronousSynchronizerTests.java +++ /dev/null @@ -1,443 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.synchronizers; - -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.internal.CompositeException; -import org.eclipse.jpt.common.utility.internal.ConsumerThreadCoordinator; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.synchronizers.AsynchronousSynchronizer; -import org.eclipse.jpt.common.utility.synchronizers.Synchronizer; -import org.eclipse.jpt.common.utility.tests.internal.MultiThreadedTestCase; - -@SuppressWarnings("nls") -public class AsynchronousSynchronizerTests - extends MultiThreadedTestCase -{ - PrimaryModel1 primaryModel1; - SecondaryModel1 secondaryModel1; - Command command1; - Synchronizer synchronizer1; - - PrimaryModel2 primaryModel2; - SecondaryModel2 secondaryModel2; - Command command2; - Synchronizer synchronizer2; - - public AsynchronousSynchronizerTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.primaryModel1 = new PrimaryModel1(); - this.secondaryModel1 = new SecondaryModel1(this.primaryModel1); - this.command1 = new SynchronizeSecondaryModelCommand1(this.secondaryModel1); - this.synchronizer1 = new AsynchronousSynchronizer(this.command1, this.buildThreadFactory()); - this.primaryModel1.setSynchronizer(this.synchronizer1); - - this.primaryModel2 = new PrimaryModel2(); - this.secondaryModel2 = new SecondaryModel2(this.primaryModel2); - this.command2 = new SynchronizeSecondaryModelCommand2(this.primaryModel2, this.secondaryModel2); - this.synchronizer2 = new AsynchronousSynchronizer(this.command2, this.buildThreadFactory()); - this.primaryModel2.setSynchronizer(this.synchronizer2); - } - - @Override - protected void tearDown() throws Exception { - this.synchronizer1.stop(); - this.synchronizer2.stop(); - super.tearDown(); - } - - public void testInitialization() { - assertEquals(4, this.secondaryModel1.getDoubleCount()); - } - - public void testToString() { - assertNotNull(this.synchronizer1.toString()); - } - - public void testChange() throws Exception { - assertEquals(4, this.secondaryModel1.getDoubleCount()); - this.primaryModel1.setCount(7); - - this.sleep(TICK); - this.synchronizer1.stop(); - this.sleep(TICK); - - assertEquals(14, this.secondaryModel1.getDoubleCount()); - - // re-start so tear-down works - this.synchronizer1.start(); - } - - public void testStart() throws Exception { - assertEquals(4, this.secondaryModel1.getDoubleCount()); - this.primaryModel1.setSynchronizer(Synchronizer.Null.instance()); - this.primaryModel1.setCount(7); - assertEquals(4, this.secondaryModel1.getDoubleCount()); - this.primaryModel1.setSynchronizer(this.synchronizer1); - // the async synchronizer does not synchronize at start-up - assertEquals(4, this.secondaryModel1.getDoubleCount()); - - this.primaryModel1.setCount(8); - - this.sleep(TICK); - this.synchronizer1.stop(); - this.sleep(TICK); - - assertEquals(16, this.secondaryModel1.getDoubleCount()); - - // re-start so tear-down works - this.synchronizer1.start(); - } - - public void testStop() throws Exception { - assertEquals(4, this.secondaryModel1.getDoubleCount()); - this.primaryModel1.dispose(); - this.primaryModel1.setCount(7); - assertEquals(4, this.secondaryModel1.getDoubleCount()); - - // re-start so tear-down works - this.synchronizer1.start(); - } - - public void testDoubleStart() throws Exception { - assertEquals(4, this.secondaryModel1.getDoubleCount()); - boolean exCaught = false; - try { - this.primaryModel1.startSynchronizer(); - fail(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue(exCaught); - this.primaryModel1.setCount(7); - - this.sleep(TICK); - this.synchronizer1.stop(); - this.sleep(TICK); - - assertEquals(14, this.secondaryModel1.getDoubleCount()); - - // re-start so tear-down works - this.synchronizer1.start(); - } - - public void testDoubleStop() throws Exception { - assertEquals(4, this.secondaryModel1.getDoubleCount()); - this.primaryModel1.dispose(); - boolean exCaught = false; - try { - this.primaryModel1.dispose(); - fail(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue(exCaught); - this.primaryModel1.setCount(7); - assertEquals(4, this.secondaryModel1.getDoubleCount()); - - // re-start so tear-down works - this.synchronizer1.start(); - } - - public void testRecursiveChange() throws Exception { - assertEquals(4, this.secondaryModel2.getDoubleCount()); - this.primaryModel2.setCount(7); - - this.sleep(TICK); - assertEquals(10, this.primaryModel2.getCountPlus3()); - assertEquals(14, this.secondaryModel2.getDoubleCount()); - - this.sleep(TICK); - assertEquals(20, this.secondaryModel2.getDoubleCountPlus3()); - } - - public void testNullCommand() { - boolean exCaught = false; - try { - Synchronizer s = new AsynchronousSynchronizer(null, this.buildThreadFactory()); - fail("bogus: " + s); - } catch (NullPointerException ex) { - exCaught = true; - } - assertTrue(exCaught); - } - - public void testThreadName() { - Synchronizer s = new AsynchronousSynchronizer(this.command1, this.buildThreadFactory(), "sync"); - s.start(); - ConsumerThreadCoordinator ctc = (ConsumerThreadCoordinator) ReflectionTools.getFieldValue(s, "consumerThreadCoordinator"); - Thread t = (Thread) ReflectionTools.getFieldValue(ctc, "thread"); - assertEquals("sync", t.getName()); - s.stop(); - } - - public void testSynchronizeCalledBeforeStart() throws Exception { - SimpleCommand command = new SimpleCommand(); - Synchronizer synchronizer = new AsynchronousSynchronizer(command, this.buildThreadFactory()); - - synchronizer.synchronize(); - synchronizer.start(); - this.sleep(TICK); - synchronizer.stop(); - assertEquals(1, command.count); - } - - public class SimpleCommand implements Command { - int count = 0; - public void execute() { - this.count++; - } - } - - public void testException() throws Exception { - BogusCommand command = new BogusCommand(); - Synchronizer synchronizer = new AsynchronousSynchronizer(command, this.buildThreadFactory()); - synchronizer.start(); - - synchronizer.synchronize(); - this.sleep(TICK); - - synchronizer.synchronize(); - this.sleep(TICK); - - boolean exCaught = false; - try { - synchronizer.stop(); - fail(); - } catch (CompositeException ex) { - assertEquals(2, ex.getExceptions().length); - exCaught = true; - } - assertTrue(exCaught); - assertEquals(2, command.count); - } - - public class BogusCommand implements Command { - int count = 0; - public void execute() { - this.count++; - throw new NullPointerException(); - } - } - - - // ********** synchronize commands ********** - public static class SynchronizeSecondaryModelCommand1 implements Command { - private final SecondaryModel1 secondaryModel; - - public SynchronizeSecondaryModelCommand1(SecondaryModel1 secondaryModel) { - super(); - this.secondaryModel = secondaryModel; - } - - public void execute() { - this.secondaryModel.synchronize(); - } - - } - - /** - * the primary model (subclass) has to synchronize with itself (superclass) - */ - public static class SynchronizeSecondaryModelCommand2 extends SynchronizeSecondaryModelCommand1 { - private final PrimaryModel2 primaryModel; - - public SynchronizeSecondaryModelCommand2(PrimaryModel2 primaryModel, SecondaryModel2 secondaryModel) { - super(secondaryModel); - this.primaryModel = primaryModel; - } - - @Override - public void execute() { - super.execute(); - this.primaryModel.synchronize(); - } - - } - - // ********** primary models ********** - /** - * this object will call the synchronizer whenever its count changes, - * allowing interested parties to synchronize with the change - */ - public static class PrimaryModel1 { - protected Synchronizer synchronizer; - protected int count = 2; - - public PrimaryModel1() { - super(); - this.setSynchronizer_(Synchronizer.Null.instance()); - } - - public int getCount() { - return this.count; - } - public void setCount(int count) { - if (count != this.count) { - this.count = count; - this.stateChanged(); - } - } - - protected void stateChanged() { - this.synchronizer.synchronize(); - } - - public void setSynchronizer(Synchronizer synchronizer) { - if (synchronizer == null) { - throw new NullPointerException(); - } - this.synchronizer.stop(); - this.setSynchronizer_(synchronizer); - } - - protected void setSynchronizer_(Synchronizer synchronizer) { - this.synchronizer = synchronizer; - this.synchronizer.start(); - } - - public void startSynchronizer() { - this.synchronizer.start(); // this should cause an exception - } - public void dispose() { - this.synchronizer.stop(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(this.getClass().getSimpleName()); - sb.append('('); - this.toString(sb); - sb.append(')'); - return sb.toString(); - } - public void toString(StringBuilder sb) { - sb.append("count="); - sb.append(this.count); - } - - } - - /** - * This model synchronizes with itself, triggering a recursive synchronization - * with the change. Whenever the [inherited] 'count' changes, 'countPlus3' - * is updated appropriately and another synchronize is initiated if appropriate. - */ - public static class PrimaryModel2 extends PrimaryModel1 { - private int countPlus3 = 0; - - public PrimaryModel2() { - super(); - this.countPlus3 = this.count + 3; - } - - public int getCountPlus3() { - return this.countPlus3; - } - protected void setCountPlus3(int countPlus3) { - if (countPlus3 != this.countPlus3) { - this.countPlus3 = countPlus3; - this.stateChanged(); - } - } - - // synchronize with itself, so to speak - public void synchronize() { - this.setCountPlus3(this.count + 3); - } - - @Override - public void toString(StringBuilder sb) { - super.toString(sb); - sb.append(", countPlus3="); - sb.append(this.countPlus3); - } - - } - - // ********** secondary models ********** - /** - * This dependent object updates its 'doubleCount' whenever the - * PrimaryModel1's 'count' changes, via the 'synchronizer'. - */ - public static class SecondaryModel1 { - protected final PrimaryModel1 primaryModel; - protected int doubleCount = 0; - - public SecondaryModel1(PrimaryModel1 primaryModel) { - super(); - this.primaryModel = primaryModel; - this.synchronize(); - } - - public void synchronize() { - this.doubleCount = this.primaryModel.getCount() * 2; - } - - public int getDoubleCount() { - return this.doubleCount; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(this.getClass().getSimpleName()); - sb.append('('); - this.toString(sb); - sb.append(')'); - return sb.toString(); - } - public void toString(StringBuilder sb) { - sb.append("doubleCount="); - sb.append(this.doubleCount); - } - - } - - public static class SecondaryModel2 extends SecondaryModel1 { - private int doubleCountPlus3 = 0; - - public SecondaryModel2(PrimaryModel2 extendedPrimaryModel) { - super(extendedPrimaryModel); - } - - protected PrimaryModel2 getExtendedPrimaryModel() { - return (PrimaryModel2) this.primaryModel; - } - - @Override - public void synchronize() { - super.synchronize(); - int temp = this.getExtendedPrimaryModel().getCountPlus3() * 2; - if (this.doubleCountPlus3 != temp) { - this.doubleCountPlus3 = temp; - } - } - - public int getDoubleCountPlus3() { - return this.doubleCountPlus3; - } - - @Override - public void toString(StringBuilder sb) { - super.toString(sb); - sb.append(", doubleCountPlus3="); - sb.append(this.doubleCountPlus3); - } - - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/JptUtilitySynchronizersTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/JptUtilitySynchronizersTests.java deleted file mode 100644 index 96acf3075b..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/JptUtilitySynchronizersTests.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.synchronizers; - -import junit.framework.Test; -import junit.framework.TestSuite; - -/** - * decentralize test creation code - */ -public class JptUtilitySynchronizersTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JptUtilitySynchronizersTests.class.getPackage().getName()); - - suite.addTestSuite(AsynchronousSynchronizerTests.class); - suite.addTestSuite(SynchronizerTests.class); - suite.addTestSuite(SynchronousSynchronizerTests.class); - - return suite; - } - - private JptUtilitySynchronizersTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/SynchronizerTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/SynchronizerTests.java deleted file mode 100644 index 8f7c67bb69..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/SynchronizerTests.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.synchronizers; - -import junit.framework.TestCase; -import org.eclipse.jpt.common.utility.synchronizers.Synchronizer; - -public class SynchronizerTests extends TestCase { - - public SynchronizerTests(String name) { - super(name); - } - - public void testNullSynchronizerStart() { - Synchronizer synchronizer = Synchronizer.Null.instance(); - synchronizer.start(); // just make sure it doesn't blow up? - } - - public void testNullSynchronizerSynchronize() { - Synchronizer synchronizer = Synchronizer.Null.instance(); - synchronizer.synchronize(); // just make sure it doesn't blow up? - } - - public void testNullSynchronizerStop() { - Synchronizer synchronizer = Synchronizer.Null.instance(); - synchronizer.stop(); // just make sure it doesn't blow up? - } - - public void testNullSynchronizerToString() { - Synchronizer synchronizer = Synchronizer.Null.instance(); - assertNotNull(synchronizer.toString()); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/SynchronousSynchronizerTests.java b/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/SynchronousSynchronizerTests.java deleted file mode 100644 index e7601bc657..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/src/org/eclipse/jpt/common/utility/tests/internal/synchronizers/SynchronousSynchronizerTests.java +++ /dev/null @@ -1,756 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.common.utility.tests.internal.synchronizers; - -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.internal.CompositeException; -import org.eclipse.jpt.common.utility.internal.SynchronizedBoolean; -import org.eclipse.jpt.common.utility.internal.synchronizers.SynchronousSynchronizer; -import org.eclipse.jpt.common.utility.synchronizers.Synchronizer; -import org.eclipse.jpt.common.utility.tests.internal.MultiThreadedTestCase; -import org.eclipse.jpt.common.utility.tests.internal.TestTools; - -@SuppressWarnings("nls") -public class SynchronousSynchronizerTests - extends MultiThreadedTestCase -{ - PrimaryModel1 primaryModel1; - SecondaryModel1 secondaryModel1; - Command command1; - Synchronizer synchronizer1; - - PrimaryModel2 primaryModel2; - SecondaryModel2 secondaryModel2; - Command command2; - Synchronizer synchronizer2; - - public SynchronousSynchronizerTests(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.primaryModel1 = new PrimaryModel1(); - this.secondaryModel1 = new SecondaryModel1(this.primaryModel1); - this.command1 = new SynchronizeSecondaryModelCommand1(this.secondaryModel1); - this.synchronizer1 = new SynchronousSynchronizer(this.command1); - this.primaryModel1.setSynchronizer(this.synchronizer1); - - this.primaryModel2 = new PrimaryModel2(); - this.secondaryModel2 = new SecondaryModel2(this.primaryModel2); - this.command2 = new SynchronizeSecondaryModelCommand2(this.primaryModel2, this.secondaryModel2); - this.synchronizer2 = new SynchronousSynchronizer(this.command2); - this.primaryModel2.setSynchronizer(this.synchronizer2); - } - - public void testInitialization() { - assertEquals(4, this.secondaryModel1.getDoubleCount()); - } - - public void testToString() { - assertNotNull(this.synchronizer1.toString()); - } - - public void testChange() { - assertEquals(4, this.secondaryModel1.getDoubleCount()); - this.primaryModel1.setCount(7); - assertEquals(14, this.secondaryModel1.getDoubleCount()); - } - - public void testStart() { - assertEquals(4, this.secondaryModel1.getDoubleCount()); - this.primaryModel1.setSynchronizer(Synchronizer.Null.instance()); - this.primaryModel1.setCount(7); - assertEquals(4, this.secondaryModel1.getDoubleCount()); - this.primaryModel1.setSynchronizer(this.synchronizer1); - assertEquals(14, this.secondaryModel1.getDoubleCount()); - } - - public void testStop() { - assertEquals(4, this.secondaryModel1.getDoubleCount()); - this.primaryModel1.dispose(); - this.primaryModel1.setCount(7); - assertEquals(4, this.secondaryModel1.getDoubleCount()); - } - - public void testDoubleStart() { - assertEquals(4, this.secondaryModel1.getDoubleCount()); - boolean exCaught = false; - try { - this.primaryModel1.startSynchronizer(); - fail(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue(exCaught); - this.primaryModel1.setCount(7); - assertEquals(14, this.secondaryModel1.getDoubleCount()); - } - - public void testDoubleStop() { - assertEquals(4, this.secondaryModel1.getDoubleCount()); - this.primaryModel1.dispose(); - boolean exCaught = false; - try { - this.primaryModel1.dispose(); - fail(); - } catch (IllegalStateException ex) { - exCaught = true; - } - assertTrue(exCaught); - this.primaryModel1.setCount(7); - assertEquals(4, this.secondaryModel1.getDoubleCount()); - } - - public void testRecursiveChange() { - assertEquals(4, this.secondaryModel2.getDoubleCount()); - this.primaryModel2.setCount(7); - assertEquals(10, this.primaryModel2.getCountPlus3()); - assertEquals(14, this.secondaryModel2.getDoubleCount()); - assertEquals(20, this.secondaryModel2.getDoubleCountPlus3()); - } - - /** - * Call #stop() from another thread. - * Verify that no further synchronizations occur. - * Verify the call to #stop() does not return until the pending - * synchronization is complete (must set {@link #DEBUG} to true and - * look at the console). - * - * ticks: - * 0 - start "sync" thread (which will sleep for 1 tick); - * start "stop" thread (which will sleep for 2 ticks) - * 1 - "sync" thread wakes up and calls PrimaryModel1.setCount(int) - * which triggers call to Synchronizer.synchronize() to begin - * synchronization of SecondaryModel (which will run for 2 ticks; - * i.e. it will finish on tick 3) - * 2 - "stop" thread wakes up and calls Synchronizer.stop() and should - * wait until synchronization is complete - * 3 - synchronization completes first execution and should stop; - * "stop" thread should run to completion once the synchronization has stopped - */ - public void testCallStopFromAnotherThread() throws Exception { - log("=====" + this.getName() + "====="); - PrimaryModel2 primaryModel3 = new PrimaryModel2(); - // a synchronize will occur here: - SecondaryModel3 secondaryModel3 = new SecondaryModel3(primaryModel3); - Command command3 = new SynchronizeSecondaryModelCommand2(primaryModel3, secondaryModel3); - Synchronizer synchronizer3 = new SynchronousSynchronizer(command3); - // another synchronize will occur here: - primaryModel3.setSynchronizer(synchronizer3); - secondaryModel3.setTicks(2); - - assertEquals(2, primaryModel3.getCount()); - assertEquals(5, primaryModel3.getCountPlus3()); - assertEquals(4, secondaryModel3.getDoubleCount()); - assertEquals(10, secondaryModel3.getDoubleCountPlus3()); - - Thread syncThread = this.buildTriggerSynchronizeThread(primaryModel3, 1); - Thread stopThread = this.buildStopThread(synchronizer3, 2); - - log("ALL threads start"); - stopThread.start(); - syncThread.start(); - - stopThread.join(); - syncThread.join(); - - // 'doubleCount' is synchronized; but the synchronization is stopped - // while that is happening (by the 'stopThread'), so 'doubleCountPlus3' - // does not get synchronized - assertEquals(7, primaryModel3.getCount()); - assertEquals(10, primaryModel3.getCountPlus3()); - assertEquals(14, secondaryModel3.getDoubleCount()); - - // this does not get updated because it would've been updated by the - // recursive call to #synchronize(), but by that time #stop() had been called - assertEquals(10, secondaryModel3.getDoubleCountPlus3()); - } - - private Thread buildTriggerSynchronizeThread(PrimaryModel2 primaryModel, long ticks) { - return this.buildThread(this.buildTriggerSynchronizeRunnable(primaryModel, ticks), "trigger sync"); - } - - private Runnable buildTriggerSynchronizeRunnable(final PrimaryModel2 primaryModel, final long ticks) { - return new Runnable() { - public void run() { - TestTools.sleep(ticks * TICK); - primaryModel.setCount(7); - } - }; - } - - private Thread buildStopThread(Synchronizer synchronizer, long ticks) { - return this.buildThread(this.buildStopRunnable(synchronizer, ticks), "stop"); - } - - private Runnable buildStopRunnable(final Synchronizer synchronizer, final long ticks) { - return new Runnable() { - public void run() { - TestTools.sleep(ticks * TICK); - log("STOP thread Synchronizer.stop()"); - synchronizer.stop(); - log("STOP thread stop"); - } - }; - } - - /** - * Code cloned from {@link #testStopCalledFromAnotherThread()}. - * - * Interrupt the "stop" thread while it is waiting for the "synch" thread to finish. - * Verify that no further synchronizations occur. - * Verify the call to #stop() returns *before* - * synchronization is complete (must set {@link #DEBUG} to true and - * look at the console). - * - * ticks: - * 0 - start "sync" thread (which will sleep for 1 tick); - * start "stop" thread (which will sleep for 2 ticks); - * start "interrupt" thread (which will sleep for 3 ticks) - * 1 - "sync" thread wakes up and calls PrimaryModel1.setCount(int) - * which triggers call to Synchronizer.synchronize() to begin - * synchronization of SecondaryModel (which will run for 3 ticks; - * i.e. it will finish on tick 4) - * 2 - "stop" thread wakes up and calls Synchronizer.stop() and should - * wait until it is interrupted - * 3 - "interrupt" thread wakes up and interrupts "stop" thread; - * both will run to completion at that point - * 4 - synchronization completes first execution and should stop since the - * "stop" thread, before it was interrupted, told the "synch" thread to stop - */ - public void testInterruptStopThread() throws Exception { - log("=====" + this.getName() + "====="); - PrimaryModel2 primaryModel3 = new PrimaryModel2(); - // a synchronize will occur here: - SecondaryModel3 secondaryModel3 = new SecondaryModel3(primaryModel3); - Command command3 = new SynchronizeSecondaryModelCommand2(primaryModel3, secondaryModel3); - Synchronizer synchronizer3 = new SynchronousSynchronizer(command3); - // another synchronize will occur here: - primaryModel3.setSynchronizer(synchronizer3); - secondaryModel3.setTicks(3); - - assertEquals(2, primaryModel3.getCount()); - assertEquals(5, primaryModel3.getCountPlus3()); - assertEquals(4, secondaryModel3.getDoubleCount()); - assertEquals(10, secondaryModel3.getDoubleCountPlus3()); - - Thread syncThread = this.buildTriggerSynchronizeThread(primaryModel3, 1); - Thread stopThread = this.buildStopThread(synchronizer3, 2); - Thread interruptThread = this.buildInterruptThread(stopThread, 3); - - log("ALL threads start"); - stopThread.start(); - syncThread.start(); - interruptThread.start(); - - stopThread.join(); - syncThread.join(); - interruptThread.join(); - - // 'doubleCount' is synchronized; but the synchronization is stopped - // while that is happening (by the 'stopThread'), so 'doubleCountPlus3' - // does not get synchronized - assertEquals(7, primaryModel3.getCount()); - assertEquals(10, primaryModel3.getCountPlus3()); - assertEquals(14, secondaryModel3.getDoubleCount()); - - // this does not get updated because it would've been updated by the - // recursive call to #synchronize(), but by that time #stop() had been called - assertEquals(10, secondaryModel3.getDoubleCountPlus3()); - } - - /** - * Code cloned from {@link #testStopCalledFromAnotherThread()}. - * - * Interrupt the "sync" thread while it is synchronizing, cutting short the synchronization. - * Verify that no further synchronizations occur. - * Verify the call to #stop() does not return until the pending - * synchronization is stops after it is interrupted (must set {@link #DEBUG} to true and - * look at the console). - * - * ticks: - * 0 - start "sync" thread (which will sleep for 1 tick) - * start "stop" thread (which will sleep for 2 ticks) - * start "interrupt" thread (which will sleep for 3 ticks) - * 1 - "sync" thread wakes up and calls PrimaryModel1.setCount(int) - * which triggers call to Synchronizer.synchronize() to begin - * synchronization of SecondaryModel (which will run for 4 ticks; - * i.e. it will finish on tick 5) - * 2 - "stop" thread wakes up and calls Synchronizer.stop() and should - * wait until the synchronization is interrupted - * 3 - "interrupt" thread wakes up and interrupts "sync" thread; - * the "interrupt" thread runs to completion, while the "sync" thread keeps - * going for another tick before it stops in "mid-synchronize" - * 4 - the "sync" thread acknowledges the interrupt and stops in - * "mid-synchronize"; it will stop since the "stop" thread told it to at tick 2; - * the "sync" and "stop" threads run to completion - */ - public void testInterruptSyncThread() throws Exception { - log("=====" + this.getName() + "====="); - PrimaryModel2 primaryModel3 = new PrimaryModel2(); - // a synchronize will occur here: - SecondaryModel3 secondaryModel3 = new SecondaryModel3(primaryModel3); - Command command3 = new SynchronizeSecondaryModelCommand2(primaryModel3, secondaryModel3); - Synchronizer synchronizer3 = new SynchronousSynchronizer(command3); - // another synchronize will occur here: - primaryModel3.setSynchronizer(synchronizer3); - secondaryModel3.setTicks(4); - - assertEquals(2, primaryModel3.getCount()); - assertEquals(5, primaryModel3.getCountPlus3()); - assertEquals(4, secondaryModel3.getDoubleCount()); - assertEquals(10, secondaryModel3.getDoubleCountPlus3()); - - Thread syncThread = this.buildTriggerSynchronizeThread(primaryModel3, 1); - Thread stopThread = this.buildStopThread(synchronizer3, 2); - Thread interruptThread = this.buildInterruptThread(syncThread, 3); - - log("ALL threads start"); - stopThread.start(); - syncThread.start(); - interruptThread.start(); - - stopThread.join(); - syncThread.join(); - interruptThread.join(); - - assertEquals(7, primaryModel3.getCount()); - assertEquals(10, primaryModel3.getCountPlus3()); - - // none of the secondary model is synchronized because the synchronize() - // method was interrupted before any synchronization had occurred - assertEquals(4, secondaryModel3.getDoubleCount()); - assertEquals(10, secondaryModel3.getDoubleCountPlus3()); - } - - private Thread buildInterruptThread(Thread thread, long ticks) { - return this.buildThread(this.buildInterruptRunnable(thread, ticks), "interrupt"); - } - - private Runnable buildInterruptRunnable(final Thread thread, final long ticks) { - return new Runnable() { - public void run() { - TestTools.sleep(ticks * TICK); - log("INTERRUPT thread Thread.interrupt()"); - thread.interrupt(); - } - }; - } - - /** - * Call #stop() during a long-running "synchronize"; then call #start() - * while the #stop() is waiting for the "synchronize" to complete. - * - * ticks: - * 0 - start "sync" thread (which will sleep for 1 tick) - * start "stop" thread (which will sleep for 2 ticks) - * start "start" thread (which will sleep for 3 ticks) - * 1 - "sync" thread wakes up and calls Synchronizer.synchronize() to begin - * synchronization (which will run for 3 ticks; i.e. it will finish on tick 4) - * 2 - "stop" thread wakes up and calls Synchronizer.stop() and should - * wait until the synchronization is finished (i.e. tick 4) - * 3 - "start" thread wakes up and calls Synchronizer.start() - * which will throw an exception - * 4 - the "sync" thread finishes execution; - * it will stop since the "stop" thread told it to at tick 2; - * the "sync" and "stop" threads run to completion - */ - public void testCallStartDuringStop() throws Exception { - log("=====" + this.getName() + "====="); - DelayCommand command = this.buildDelayCommand(3); - Synchronizer synchronizer = new SynchronousSynchronizer(command); - synchronizer.start(); - - Thread syncThread = this.buildSynchronizeThread(synchronizer, 1); - Thread stopThread = this.buildStopThread(synchronizer, 2); - SynchronizedBoolean exCaught = new SynchronizedBoolean(false); - Thread startThread = this.buildStartThread(synchronizer, 3, exCaught); - - log("ALL threads start"); - syncThread.start(); - stopThread.start(); - startThread.start(); - - syncThread.join(); - stopThread.join(); - startThread.join(); - - assertTrue(exCaught.getValue()); - assertEquals(2, command.count); - } - - private DelayCommand buildDelayCommand(int ticks) { - return new DelayCommand(ticks); - } - - class DelayCommand implements Command { - final long ticks; - boolean first = true; - int count = 0; - - DelayCommand(int ticks) { - super(); - this.ticks = ticks; - } - - public void execute() { - this.count++; - // do nothing for the first call (from #start()) - if (this.first) { - log("EXEC first"); - this.first = false; - return; - } - log("EXEC start " + this.count); - TestTools.sleep(this.ticks * TICK); - log("EXEC stop " + this.count); - } - - } - - private Thread buildStartThread(Synchronizer synchronizer, long ticks, SynchronizedBoolean exCaught) { - return this.buildThread(this.buildStartRunnable(synchronizer, ticks, exCaught), "start"); - } - - private Runnable buildStartRunnable(final Synchronizer synchronizer, final long ticks, final SynchronizedBoolean exCaught) { - return new Runnable() { - public void run() { - TestTools.sleep(ticks * TICK); - log("START thread Synchronizer.start()"); - try { - synchronizer.start(); - } catch (IllegalStateException ex) { - exCaught.setTrue(); - log("START thread exception"); - } - log("START thread stop"); - } - }; - } - - private Thread buildSynchronizeThread(Synchronizer synchronizer, long ticks) { - return this.buildThread(this.buildSynchronizeRunnable(synchronizer, ticks), "synchronize"); - } - - private Runnable buildSynchronizeRunnable(final Synchronizer synchronizer, final long ticks) { - return new Runnable() { - public void run() { - TestTools.sleep(ticks * TICK); - log("SYNC thread Synchronizer.synchronize()"); - synchronizer.synchronize(); - log("SYNC thread stop"); - } - }; - } - - public void testException() throws Exception { - BogusCommand command = new BogusCommand(); - Synchronizer synchronizer = new SynchronousSynchronizer(command); - synchronizer.start(); - - try { - synchronizer.synchronize(); - } catch (NullPointerException ex) { - // ignore - } - - boolean exCaught = false; - try { - // we used to hang here, before we began handling exceptions - synchronizer.stop(); - fail(); - } catch (CompositeException ex) { - assertEquals(1, ex.getExceptions().length); - exCaught = true; - } - assertTrue(exCaught); - // start + synchronize - assertEquals(2, command.count); - } - - public class BogusCommand implements Command { - int count = 0; - public void execute() { - this.count++; - if (this.count > 1) { - throw new NullPointerException(); - } - } - } - - - // ********** synchronize commands ********** - public static class SynchronizeSecondaryModelCommand1 implements Command { - private final SecondaryModel1 secondaryModel; - - public SynchronizeSecondaryModelCommand1(SecondaryModel1 secondaryModel) { - super(); - this.secondaryModel = secondaryModel; - } - - public void execute() { - this.secondaryModel.synchronize(); - } - - } - - /** - * the primary model (subclass) has to synchronize with itself (superclass) - */ - public static class SynchronizeSecondaryModelCommand2 extends SynchronizeSecondaryModelCommand1 { - private final PrimaryModel2 primaryModel; - - public SynchronizeSecondaryModelCommand2(PrimaryModel2 primaryModel, SecondaryModel2 secondaryModel) { - super(secondaryModel); - this.primaryModel = primaryModel; - } - - @Override - public void execute() { - super.execute(); - this.primaryModel.synchronize(); - } - - } - - // ********** primary models ********** - /** - * this object will call the synchronizer whenever its count changes, - * allowing interested parties to synchronize with the change - */ - public static class PrimaryModel1 { - protected Synchronizer synchronizer; - protected int count = 2; - - public PrimaryModel1() { - super(); - this.setSynchronizer_(Synchronizer.Null.instance()); - } - - public int getCount() { - return this.count; - } - public void setCount(int count) { - if (count != this.count) { - this.count = count; - this.stateChanged(); - } - } - - protected void stateChanged() { - this.synchronizer.synchronize(); - } - - public void setSynchronizer(Synchronizer synchronizer) { - if (synchronizer == null) { - throw new NullPointerException(); - } - this.synchronizer.stop(); - this.setSynchronizer_(synchronizer); - } - - protected void setSynchronizer_(Synchronizer synchronizer) { - this.synchronizer = synchronizer; - this.synchronizer.start(); - } - - public void startSynchronizer() { - this.synchronizer.start(); // this should cause an exception - } - public void dispose() { - this.synchronizer.stop(); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(this.getClass().getSimpleName()); - sb.append('('); - this.toString(sb); - sb.append(')'); - return sb.toString(); - } - public void toString(StringBuilder sb) { - sb.append("count="); - sb.append(this.count); - } - - } - - /** - * This model synchronizes with itself, triggering a recursive synchronization - * with the change. Whenever the [inherited] 'count' changes, 'countPlus3' - * is updated appropriately and another synchronize is initiated if appropriate. - */ - public static class PrimaryModel2 extends PrimaryModel1 { - private int countPlus3 = 0; - - public PrimaryModel2() { - super(); - this.countPlus3 = this.count + 3; - } - - public int getCountPlus3() { - return this.countPlus3; - } - protected void setCountPlus3(int countPlus3) { - if (countPlus3 != this.countPlus3) { - this.countPlus3 = countPlus3; - this.stateChanged(); - } - } - - // synchronize with itself, so to speak - public void synchronize() { - this.setCountPlus3(this.count + 3); - } - - @Override - public void toString(StringBuilder sb) { - super.toString(sb); - sb.append(", countPlus3="); - sb.append(this.countPlus3); - } - - } - - // ********** secondary models ********** - /** - * This dependent object updates its 'doubleCount' whenever the - * PrimaryModel1's 'count' changes, via the 'synchronizer'. - */ - public static class SecondaryModel1 { - protected final PrimaryModel1 primaryModel; - protected int doubleCount = 0; - - public SecondaryModel1(PrimaryModel1 primaryModel) { - super(); - this.primaryModel = primaryModel; - this.synchronize(); - } - - public void synchronize() { - this.doubleCount = this.primaryModel.getCount() * 2; - } - - public int getDoubleCount() { - return this.doubleCount; - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - sb.append(this.getClass().getSimpleName()); - sb.append('('); - this.toString(sb); - sb.append(')'); - return sb.toString(); - } - public void toString(StringBuilder sb) { - sb.append("doubleCount="); - sb.append(this.doubleCount); - } - - } - - public static class SecondaryModel2 extends SecondaryModel1 { - private int doubleCountPlus3 = 0; - - public SecondaryModel2(PrimaryModel2 extendedPrimaryModel) { - super(extendedPrimaryModel); - } - - protected PrimaryModel2 getExtendedPrimaryModel() { - return (PrimaryModel2) this.primaryModel; - } - - @Override - public void synchronize() { - super.synchronize(); - int temp = this.getExtendedPrimaryModel().getCountPlus3() * 2; - if (this.doubleCountPlus3 != temp) { - this.doubleCountPlus3 = temp; - } - } - - public int getDoubleCountPlus3() { - return this.doubleCountPlus3; - } - - @Override - public void toString(StringBuilder sb) { - super.toString(sb); - sb.append(", doubleCountPlus3="); - sb.append(this.doubleCountPlus3); - } - - } - - /** - * Allow the time required to synchronize to be specified. - * A (non-delayed) synchronize will execute before we have a chance to - * change the tick count. (It is called in the SecondaryModel1 constructor.) - */ - public static class SecondaryModel3 extends SecondaryModel2 { - private long delay = 0; - public SecondaryModel3(PrimaryModel2 primaryModel) { - super(primaryModel); - } - - public void setTicks(long ticks) { - this.delay = ticks * TICK; - } - - @Override - public void synchronize() { - // don't log anything until 'ticks' is set - if (this.delay == 0) { - super.synchronize(); - } else { - log("SYNC thread start - sync duration will be: " + (this.delay / TICK) + " ticks"); - try { - Thread.sleep(this.delay); - } catch (InterruptedException ex) { - log("SYNC thread interrupted"); - TestTools.sleep(TICK); - return; // stop synchronize (i.e. don't call super.synchronize()) - } - super.synchronize(); - log("SYNC thread stop"); - } - } - - } - - public void testDEBUG() { - assertFalse(DEBUG); - } - - public static final boolean DEBUG = false; - public static void log(String message) { - if (DEBUG) { - log_(message); - } - } - - private static void log_(String message) { - System.out.print(timestamp()); - System.out.print(' '); - System.out.print(message); - System.out.println(); - } - - public static String timestamp() { - return String.valueOf((System.currentTimeMillis() % 10000) / 1000f); - } - -} diff --git a/common/tests/org.eclipse.jpt.common.utility.tests/test.xml b/common/tests/org.eclipse.jpt.common.utility.tests/test.xml deleted file mode 100644 index 14635f2af1..0000000000 --- a/common/tests/org.eclipse.jpt.common.utility.tests/test.xml +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/.project b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/.project deleted file mode 100644 index 7064cbb9c5..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.dbws.eclipselink.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/build.properties b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/build.properties deleted file mode 100644 index a2127dcd0c..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/build.properties +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################### -# Copyright (c) 2010, 2011 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -bin.includes = feature.xml,\ - eclipse_update_120.jpg,\ - epl-v10.html,\ - license.html,\ - feature.properties \ No newline at end of file diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/eclipse_update_120.jpg b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/epl-v10.html b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/feature.properties b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/feature.properties deleted file mode 100644 index 927ea28f4b..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/feature.properties +++ /dev/null @@ -1,163 +0,0 @@ -############################################################################### -# Copyright (c) 2010, 2011 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - DBWS EclipseLink Support (Optional) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Dali Java Persistence Tools - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/feature.xml b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/feature.xml deleted file mode 100644 index 24ca3bd89f..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/feature.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - - - - - - - - - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/license.html b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/about.html b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/about.html deleted file mode 100644 index d4916df475..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/about.html +++ /dev/null @@ -1,27 +0,0 @@ - - - -About - - - -

About This Content

- -

June 06, 2007

-

License

- -

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 http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

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.

- -

Source Code

-

This plug-in contains source code zip files ("Source Zips") that correspond to binary content in other plug-ins. These Source Zips may be distributed under different license -agreements and/or notices. Details about these license agreements and notices are contained in "about.html" files ("Abouts") located in sub-directories in the -src/ directory of this plug-in. Such Abouts govern your use of the Source Zips in that directory, not the EPL.

- - - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/about.ini b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/about.ini deleted file mode 100644 index 2dee36a2e2..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/about.ini +++ /dev/null @@ -1,31 +0,0 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=eclipse32.gif - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (not translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - - - - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/about.mappings b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/about.mappings deleted file mode 100644 index a28390a75e..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/about.properties b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/about.properties deleted file mode 100644 index 80f93d0255..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/about.properties +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################### -# Copyright (c) 2008, 2011 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. -# -# Do not translate any values surrounded by {} - -blurb=Dali Java Persistence Tools - DBWS EclipseLink Support Source\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Eclipse contributors and others 2010, 2011. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/build.properties b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/build.properties deleted file mode 100644 index 1c3e2eb73b..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/build.properties +++ /dev/null @@ -1,21 +0,0 @@ -############################################################################### -# Copyright (c) 2011 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = \ - about.html,\ - about.ini,\ - about.mappings,\ - about.properties,\ - eclipse32.gif,\ - plugin.properties,\ - plugin.xml,\ - src/**,\ - META-INF/ -sourcePlugin = true diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/eclipse32.gif b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/eclipse32.gif deleted file mode 100644 index e6ad7ccd75..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/eclipse32.gif and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/eclipse32.png b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/eclipse32.png deleted file mode 100644 index 50ae49de24..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/eclipse32.png and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/eclipse_update_120.jpg b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/eclipse_update_120.jpg and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/epl-v10.html b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/license.html b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/license.html deleted file mode 100644 index 5ad00ba719..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/license.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -Eclipse.org Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

March 17, 2005

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS - modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • - -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • - -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • - -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. - - - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/plugin.properties b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/plugin.properties deleted file mode 100644 index 1429a53f4c..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateBundle/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2010, 2011 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools - DBWS EclipseLink Support -providerName = Eclipse Web Tools Platform diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/build.properties b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/build.properties deleted file mode 100644 index 53abe6605b..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/build.properties +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################### -# Copyright (c) 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = \ - epl-v10.html,\ - eclipse_update_120.jpg,\ - feature.xml,\ - feature.properties,\ - license.html diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/eclipse_update_120.jpg b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/eclipse_update_120.jpg and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/epl-v10.html b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/feature.properties b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/feature.properties deleted file mode 100644 index 84faaa9b90..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/feature.properties +++ /dev/null @@ -1,168 +0,0 @@ -############################################################################### -# Copyright (c) 2010, 2011 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - DBWS EclipseLink Support (Optional) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Source code zips for Dali Java Persistence Tools EclipseLink Support - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2011 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/license.html b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplateFeature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/about.html b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/about.html deleted file mode 100644 index d4916df475..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/about.html +++ /dev/null @@ -1,27 +0,0 @@ - - - -About - - - -

About This Content

- -

June 06, 2007

-

License

- -

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 http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

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.

- -

Source Code

-

This plug-in contains source code zip files ("Source Zips") that correspond to binary content in other plug-ins. These Source Zips may be distributed under different license -agreements and/or notices. Details about these license agreements and notices are contained in "about.html" files ("Abouts") located in sub-directories in the -src/ directory of this plug-in. Such Abouts govern your use of the Source Zips in that directory, not the EPL.

- - - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/about.ini b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/about.ini deleted file mode 100644 index 2dee36a2e2..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/about.ini +++ /dev/null @@ -1,31 +0,0 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=eclipse32.gif - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (not translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - - - - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/about.mappings b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/about.mappings deleted file mode 100644 index a28390a75e..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/about.properties b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/about.properties deleted file mode 100644 index a8c9da3a8a..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/about.properties +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################### -# Copyright (c) 2010, 2011 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. -# -# Do not translate any values surrounded by {} - -blurb=Dali Java Persistence Tools - DBWS EclipseLink Support Source\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Eclipse contributors and others 2010, 2011. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/build.properties b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/build.properties deleted file mode 100644 index 6dcfcd6269..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/build.properties +++ /dev/null @@ -1,21 +0,0 @@ -############################################################################### -# Copyright (c) 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = \ - about.html,\ - about.ini,\ - about.mappings,\ - about.properties,\ - eclipse32.gif,\ - plugin.properties,\ - plugin.xml,\ - src/**,\ - META-INF/ -sourcePlugin = true diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/eclipse32.gif b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/eclipse32.gif deleted file mode 100644 index e6ad7ccd75..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/eclipse32.gif and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/eclipse32.png b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/eclipse32.png deleted file mode 100644 index 50ae49de24..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/eclipse32.png and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/eclipse_update_120.jpg b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/eclipse_update_120.jpg and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/epl-v10.html b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/license.html b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/license.html deleted file mode 100644 index 5ad00ba719..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/license.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -Eclipse.org Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

March 17, 2005

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS - modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • - -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • - -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • - -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. - - - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/plugin.properties b/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/plugin.properties deleted file mode 100644 index 1429a53f4c..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink.feature/sourceTemplatePlugin/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2010, 2011 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools - DBWS EclipseLink Support -providerName = Eclipse Web Tools Platform diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/.cvsignore b/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/.cvsignore deleted file mode 100644 index 9d0e114f67..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -feature.temp.folder -build.xml diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/.project b/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/.project deleted file mode 100644 index b4ba97299c..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.dbws.eclipselink_sdk.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/build.properties b/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/build.properties deleted file mode 100644 index 826a9dc3f1..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -bin.includes = feature.xml,\ - license.html,\ - feature.properties,\ - epl-v10.html,\ - eclipse_update_120.jpg - -generate.feature@org.eclipse.jpt.dbws.eclipselink.feature.source=org.eclipse.jpt.dbws.eclipselink.feature diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/eclipse_update_120.jpg b/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/epl-v10.html b/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/feature.properties b/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/feature.properties deleted file mode 100644 index c55c1066c5..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/feature.properties +++ /dev/null @@ -1,163 +0,0 @@ -############################################################################### -# Copyright (c) 2010, 2011 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - DBWS EclipseLink Support SDK (Optional) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Source code archives for Dali Java Persistence - EclipseLink Support - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/feature.xml b/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/feature.xml deleted file mode 100644 index dadd980483..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/feature.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - diff --git a/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/license.html b/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jaxb/features/org.eclipse.jpt.dbws.eclipselink_sdk.feature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/.project b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/.project deleted file mode 100644 index b3f1d9bfe7..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.jaxb.eclipselink.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/build.properties b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/build.properties deleted file mode 100644 index 4f634f8a7a..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/build.properties +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################### -# Copyright (c) 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -bin.includes = feature.xml,\ - eclipse_update_120.jpg,\ - epl-v10.html,\ - license.html,\ - feature.properties \ No newline at end of file diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/eclipse_update_120.jpg b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/epl-v10.html b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/feature.properties b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/feature.properties deleted file mode 100644 index 734fd8d8c6..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/feature.properties +++ /dev/null @@ -1,163 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - JAXB EclipseLink Support (Optional) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Dali Java Persistence Tools - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/feature.xml b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/feature.xml deleted file mode 100644 index 2e488894ba..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/feature.xml +++ /dev/null @@ -1,39 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/license.html b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/about.html b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/about.html deleted file mode 100644 index d4916df475..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/about.html +++ /dev/null @@ -1,27 +0,0 @@ - - - -About - - - -

About This Content

- -

June 06, 2007

-

License

- -

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 http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

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.

- -

Source Code

-

This plug-in contains source code zip files ("Source Zips") that correspond to binary content in other plug-ins. These Source Zips may be distributed under different license -agreements and/or notices. Details about these license agreements and notices are contained in "about.html" files ("Abouts") located in sub-directories in the -src/ directory of this plug-in. Such Abouts govern your use of the Source Zips in that directory, not the EPL.

- - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/about.ini b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/about.ini deleted file mode 100644 index 2dee36a2e2..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/about.ini +++ /dev/null @@ -1,31 +0,0 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=eclipse32.gif - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (not translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/about.mappings b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/about.mappings deleted file mode 100644 index a28390a75e..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/about.properties b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/about.properties deleted file mode 100644 index e21f19415d..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/about.properties +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################### -# Copyright (c) 2008, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. -# -# Do not translate any values surrounded by {} - -blurb=Dali Java Persistence Tools - JAXB EclipseLink Support Source\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Eclipse contributors and others 2005. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/build.properties b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/build.properties deleted file mode 100644 index 6dcfcd6269..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/build.properties +++ /dev/null @@ -1,21 +0,0 @@ -############################################################################### -# Copyright (c) 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = \ - about.html,\ - about.ini,\ - about.mappings,\ - about.properties,\ - eclipse32.gif,\ - plugin.properties,\ - plugin.xml,\ - src/**,\ - META-INF/ -sourcePlugin = true diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/eclipse32.gif b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/eclipse32.gif deleted file mode 100644 index e6ad7ccd75..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/eclipse32.gif and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/eclipse32.png b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/eclipse32.png deleted file mode 100644 index 50ae49de24..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/eclipse32.png and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/eclipse_update_120.jpg b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/eclipse_update_120.jpg and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/epl-v10.html b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/license.html b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/license.html deleted file mode 100644 index 5ad00ba719..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/license.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -Eclipse.org Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

March 17, 2005

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS - modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • - -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • - -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • - -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/plugin.properties b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/plugin.properties deleted file mode 100644 index 57daebf248..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateBundle/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2008, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools - JAXB EclipseLink Support -providerName = Eclipse Web Tools Platform diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/build.properties b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/build.properties deleted file mode 100644 index 53abe6605b..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/build.properties +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################### -# Copyright (c) 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = \ - epl-v10.html,\ - eclipse_update_120.jpg,\ - feature.xml,\ - feature.properties,\ - license.html diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/eclipse_update_120.jpg b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/eclipse_update_120.jpg and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/epl-v10.html b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/feature.properties b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/feature.properties deleted file mode 100644 index a71e7c4294..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/feature.properties +++ /dev/null @@ -1,168 +0,0 @@ -############################################################################### -# Copyright (c) 2008, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - JAXB EclipseLink Support (Optional) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Source code zips for Dali Java Persistence Tools EclipseLink Support - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/license.html b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplateFeature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/about.html b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/about.html deleted file mode 100644 index d4916df475..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/about.html +++ /dev/null @@ -1,27 +0,0 @@ - - - -About - - - -

About This Content

- -

June 06, 2007

-

License

- -

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 http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

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.

- -

Source Code

-

This plug-in contains source code zip files ("Source Zips") that correspond to binary content in other plug-ins. These Source Zips may be distributed under different license -agreements and/or notices. Details about these license agreements and notices are contained in "about.html" files ("Abouts") located in sub-directories in the -src/ directory of this plug-in. Such Abouts govern your use of the Source Zips in that directory, not the EPL.

- - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/about.ini b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/about.ini deleted file mode 100644 index 2dee36a2e2..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/about.ini +++ /dev/null @@ -1,31 +0,0 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=eclipse32.gif - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (not translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/about.mappings b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/about.mappings deleted file mode 100644 index a28390a75e..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/about.properties b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/about.properties deleted file mode 100644 index e21f19415d..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/about.properties +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################### -# Copyright (c) 2008, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. -# -# Do not translate any values surrounded by {} - -blurb=Dali Java Persistence Tools - JAXB EclipseLink Support Source\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Eclipse contributors and others 2005. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/build.properties b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/build.properties deleted file mode 100644 index 6dcfcd6269..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/build.properties +++ /dev/null @@ -1,21 +0,0 @@ -############################################################################### -# Copyright (c) 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = \ - about.html,\ - about.ini,\ - about.mappings,\ - about.properties,\ - eclipse32.gif,\ - plugin.properties,\ - plugin.xml,\ - src/**,\ - META-INF/ -sourcePlugin = true diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/eclipse32.gif b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/eclipse32.gif deleted file mode 100644 index e6ad7ccd75..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/eclipse32.gif and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/eclipse32.png b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/eclipse32.png deleted file mode 100644 index 50ae49de24..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/eclipse32.png and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/eclipse_update_120.jpg b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/eclipse_update_120.jpg and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/epl-v10.html b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/license.html b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/license.html deleted file mode 100644 index 5ad00ba719..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/license.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -Eclipse.org Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

March 17, 2005

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS - modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • - -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • - -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • - -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/plugin.properties b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/plugin.properties deleted file mode 100644 index 57daebf248..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink.feature/sourceTemplatePlugin/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2008, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools - JAXB EclipseLink Support -providerName = Eclipse Web Tools Platform diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/.cvsignore b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/.cvsignore deleted file mode 100644 index 9d0e114f67..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -feature.temp.folder -build.xml diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/.project b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/.project deleted file mode 100644 index a51d4183a3..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.jaxb.eclipselink_sdk.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/build.properties b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/build.properties deleted file mode 100644 index 751eede498..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -bin.includes = feature.xml,\ - license.html,\ - feature.properties,\ - epl-v10.html,\ - eclipse_update_120.jpg - -generate.feature@org.eclipse.jpt.jaxb.eclipselink.feature.source=org.eclipse.jpt.jaxb.eclipselink.feature diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/eclipse_update_120.jpg b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/epl-v10.html b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/feature.properties b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/feature.properties deleted file mode 100644 index 768463f76a..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/feature.properties +++ /dev/null @@ -1,163 +0,0 @@ -############################################################################### -# Copyright (c) 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - JAXB EclipseLink Support SDK (Optional) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Source code archives for Dali Java Persistence - EclipseLink Support - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/feature.xml b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/feature.xml deleted file mode 100644 index 52de3f6148..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/feature.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/license.html b/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.eclipselink_sdk.feature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/.project b/jaxb/features/org.eclipse.jpt.jaxb.feature/.project deleted file mode 100644 index 6b7e145cd1..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.jaxb.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/build.properties b/jaxb/features/org.eclipse.jpt.jaxb.feature/build.properties deleted file mode 100644 index 9e28d2421f..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/build.properties +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################### -# Copyright (c) 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -bin.includes = feature.xml,\ - eclipse_update_120.jpg,\ - epl-v10.html,\ - license.html,\ - feature.properties diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/eclipse_update_120.jpg b/jaxb/features/org.eclipse.jpt.jaxb.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/epl-v10.html b/jaxb/features/org.eclipse.jpt.jaxb.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/feature.properties b/jaxb/features/org.eclipse.jpt.jaxb.feature/feature.properties deleted file mode 100644 index dbcf452137..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/feature.properties +++ /dev/null @@ -1,163 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - JAXB Support (Optional) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Dali Java Persistence Tools - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/feature.xml b/jaxb/features/org.eclipse.jpt.jaxb.feature/feature.xml deleted file mode 100644 index 54c315dbf2..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/feature.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - - - - - - - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/license.html b/jaxb/features/org.eclipse.jpt.jaxb.feature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/about.html b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/about.html deleted file mode 100644 index d4916df475..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/about.html +++ /dev/null @@ -1,27 +0,0 @@ - - - -About - - - -

About This Content

- -

June 06, 2007

-

License

- -

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 http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

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.

- -

Source Code

-

This plug-in contains source code zip files ("Source Zips") that correspond to binary content in other plug-ins. These Source Zips may be distributed under different license -agreements and/or notices. Details about these license agreements and notices are contained in "about.html" files ("Abouts") located in sub-directories in the -src/ directory of this plug-in. Such Abouts govern your use of the Source Zips in that directory, not the EPL.

- - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/about.ini b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/about.ini deleted file mode 100644 index 2dee36a2e2..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/about.ini +++ /dev/null @@ -1,31 +0,0 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=eclipse32.gif - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (not translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/about.mappings b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/about.mappings deleted file mode 100644 index a28390a75e..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/about.properties b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/about.properties deleted file mode 100644 index 5bc4b671f1..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/about.properties +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. -# -# Do not translate any values surrounded by {} - -blurb=Dali Java Persistence Tools Source - JAXB Support\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Eclipse contributors and others 2008. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/build.properties b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/build.properties deleted file mode 100644 index ce9529be74..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/build.properties +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = about.html, about.ini, about.mappings, about.properties, eclipse32.gif, plugin.properties, plugin.xml, src/**, META-INF/ -sourcePlugin = true diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/eclipse32.gif b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/eclipse32.gif deleted file mode 100644 index e6ad7ccd75..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/eclipse32.gif and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/eclipse32.png b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/eclipse32.png deleted file mode 100644 index 50ae49de24..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/eclipse32.png and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/eclipse_update_120.jpg b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/eclipse_update_120.jpg and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/epl-v10.html b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/license.html b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/license.html deleted file mode 100644 index 5ad00ba719..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/license.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -Eclipse.org Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

March 17, 2005

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS - modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • - -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • - -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • - -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/plugin.properties b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/plugin.properties deleted file mode 100644 index 86c4916ad2..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateBundle/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools - JAXB Support -providerName = Eclipse Web Tools Platform diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/build.properties b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/build.properties deleted file mode 100644 index f60dad3f94..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/build.properties +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = \ - epl-v10.html,\ - eclipse_update_120.jpg,\ - feature.xml,\ - feature.properties,\ - license.html diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/eclipse_update_120.jpg b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/eclipse_update_120.jpg and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/epl-v10.html b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/feature.properties b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/feature.properties deleted file mode 100644 index 1dcd8050c1..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/feature.properties +++ /dev/null @@ -1,168 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - JAXB Support (Optional) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Source code zips for Dali Java Persistence Tools - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/license.html b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplateFeature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/about.html b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/about.html deleted file mode 100644 index d4916df475..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/about.html +++ /dev/null @@ -1,27 +0,0 @@ - - - -About - - - -

About This Content

- -

June 06, 2007

-

License

- -

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 http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

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.

- -

Source Code

-

This plug-in contains source code zip files ("Source Zips") that correspond to binary content in other plug-ins. These Source Zips may be distributed under different license -agreements and/or notices. Details about these license agreements and notices are contained in "about.html" files ("Abouts") located in sub-directories in the -src/ directory of this plug-in. Such Abouts govern your use of the Source Zips in that directory, not the EPL.

- - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/about.ini b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/about.ini deleted file mode 100644 index 2dee36a2e2..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/about.ini +++ /dev/null @@ -1,31 +0,0 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=eclipse32.gif - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (not translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/about.mappings b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/about.mappings deleted file mode 100644 index a28390a75e..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/about.properties b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/about.properties deleted file mode 100644 index 6f32073796..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/about.properties +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. -# -# Do not translate any values surrounded by {} - -blurb=Dali Java Persistence Tools Source - JAXB Support\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Eclipse contributors and others 2008, 2010. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/build.properties b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/build.properties deleted file mode 100644 index ce9529be74..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/build.properties +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = about.html, about.ini, about.mappings, about.properties, eclipse32.gif, plugin.properties, plugin.xml, src/**, META-INF/ -sourcePlugin = true diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/eclipse32.gif b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/eclipse32.gif deleted file mode 100644 index e6ad7ccd75..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/eclipse32.gif and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/eclipse32.png b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/eclipse32.png deleted file mode 100644 index 50ae49de24..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/eclipse32.png and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/eclipse_update_120.jpg b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/eclipse_update_120.jpg and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/epl-v10.html b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/license.html b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/license.html deleted file mode 100644 index 5ad00ba719..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/license.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -Eclipse.org Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

March 17, 2005

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS - modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • - -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • - -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • - -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/plugin.properties b/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/plugin.properties deleted file mode 100644 index 86c4916ad2..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.feature/sourceTemplatePlugin/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools - JAXB Support -providerName = Eclipse Web Tools Platform diff --git a/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/.cvsignore b/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/.cvsignore deleted file mode 100644 index c14487ceac..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -build.xml diff --git a/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/.project b/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/.project deleted file mode 100644 index d48dee7bd4..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.jaxb.tests.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/build.properties b/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/build.properties deleted file mode 100644 index 8bcc8cdff5..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/build.properties +++ /dev/null @@ -1,10 +0,0 @@ -bin.includes = feature.xml,\ - eclipse_update_120.jpg,\ - epl-v10.html,\ - license.html,\ - feature.properties -src.includes = license.html,\ - feature.xml,\ - epl-v10.html,\ - eclipse_update_120.jpg,\ - build.properties \ No newline at end of file diff --git a/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/eclipse_update_120.jpg b/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/epl-v10.html b/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/feature.properties b/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/feature.properties deleted file mode 100644 index fa0a82151d..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/feature.properties +++ /dev/null @@ -1,171 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - JAXB Core JUnit Tests - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - -# "updateSiteName" property - label for the update site -# TOREVIEW - updateSiteName -updateSiteName=Web Tools Platform (WTP) Updates - -# "description" property - description of the feature -description=Dali Java Persistence Tools JAXB JUnit Tests - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/feature.xml b/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/feature.xml deleted file mode 100644 index 01e9ec5f20..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/feature.xml +++ /dev/null @@ -1,26 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/license.html b/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb.tests.feature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/.cvsignore b/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/.cvsignore deleted file mode 100644 index 9d0e114f67..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -feature.temp.folder -build.xml diff --git a/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/.project b/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/.project deleted file mode 100644 index dbf60be032..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.jaxb_sdk.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/build.properties b/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/build.properties deleted file mode 100644 index bb2ce03ae9..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -bin.includes = feature.xml,\ - license.html,\ - feature.properties,\ - epl-v10.html,\ - eclipse_update_120.jpg - -generate.feature@org.eclipse.jpt.jaxb.feature.source=org.eclipse.jpt.jaxb.feature diff --git a/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/eclipse_update_120.jpg b/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/epl-v10.html b/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/feature.properties b/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/feature.properties deleted file mode 100644 index 8034f124b3..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/feature.properties +++ /dev/null @@ -1,163 +0,0 @@ -############################################################################### -# Copyright (c) 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools SDK - JAXB Support SDK (Optional) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Source code archives for Dali Java Persistence Tools - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/feature.xml b/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/feature.xml deleted file mode 100644 index 57615ef479..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/feature.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - diff --git a/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/license.html b/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jaxb/features/org.eclipse.jpt.jaxb_sdk.feature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/.cvsignore b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/.cvsignore deleted file mode 100644 index c14487ceac..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -build.xml diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/.project b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/.project deleted file mode 100644 index de731ab893..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.eclipse.jpt.dbws.eclipselink.branding - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/META-INF/MANIFEST.MF deleted file mode 100644 index c6c16f392a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.jpt.dbws.eclipselink.branding;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Localization: plugin -Bundle-Vendor: %providerName diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.html b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.html deleted file mode 100644 index ca606b1bb5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

June 06, 2007

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- - - \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.ini b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.ini deleted file mode 100644 index 6c107d466d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.ini +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2011 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=icons/WTP_icon_x32_v2.png - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - -# Property "tipsAndTricksHref" contains the Help topic href to a tips and tricks page -# optional -tipsAndTricksHref=/org.eclipse.jpt.doc.user/tips_and_tricks.htm - - diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.mappings b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.mappings deleted file mode 100644 index bddaab4310..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.properties deleted file mode 100644 index 54b1e269ea..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/about.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2011 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. - -blurb=Dali Java Persistence Tools - DBWS EclipseLink Support\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Oracle contributors and others 2011. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/build.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/build.properties deleted file mode 100644 index 6c20e3b027..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/build.properties +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Copyright (c) 2010, 2011 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -bin.includes = META-INF/,\ - about.ini,\ - about.html,\ - about.mappings,\ - about.properties,\ - icons/,\ - plugin.properties diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/icons/WTP_icon_x32_v2.png b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/icons/WTP_icon_x32_v2.png deleted file mode 100644 index 6f09c2a700..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/icons/WTP_icon_x32_v2.png and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/plugin.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/plugin.properties deleted file mode 100644 index 1429a53f4c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.branding/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2010, 2011 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools - DBWS EclipseLink Support -providerName = Eclipse Web Tools Platform diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.classpath b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.classpath deleted file mode 100644 index ad32c83a78..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.cvsignore b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.cvsignore deleted file mode 100644 index c5e82d7458..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.project b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.project deleted file mode 100644 index 4c657b1ec5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.jpt.dbws.eclipselink.core.gen - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.settings/org.eclipse.jdt.core.prefs b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index f4cc6fa199..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Mon Jan 31 14:51:15 EST 2011 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.assertIdentifier=error -org.eclipse.jdt.core.compiler.problem.enumIdentifier=error -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/META-INF/MANIFEST.MF deleted file mode 100644 index 8e395f6bac..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/META-INF/MANIFEST.MF +++ /dev/null @@ -1,11 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.dbws.eclipselink.core.gen;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Require-Bundle: org.eclipse.persistence.dbws.builder;bundle-version="[2.3.0,3.0.0)", - javax.wsdl;bundle-version="[1.6.2,2.0.0)" -Export-Package: org.eclipse.jpt.dbws.eclipselink.core.gen diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/about.html b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/about.html deleted file mode 100644 index 071f586b21..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/about.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

May 02, 2008

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- -

Third Party Content

-

The Content includes items that have been sourced from third parties as set - out below. If you did not receive this Content directly from the Eclipse Foundation, - the following is provided for informational purposes only, and you should look - to the Redistributor’s license for terms and conditions of use.

- -

Java Persistence API (JPA) v1.0

- -
-

The Java Persistence API (JPA) which is distributed under CDDL - v1.0 is required by the Dali Java Persistence Tools Project in order - to support this standard.

-
- - diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/build.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/build.properties deleted file mode 100644 index a00641b71c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/build.properties +++ /dev/null @@ -1,19 +0,0 @@ -############################################################################### -# Copyright (c) 2010, 2011 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -javacSource=1.6 -javacTarget=1.6 -source.. = src/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - about.html,\ - plugin.properties -jars.compile.order = . diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/plugin.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/plugin.properties deleted file mode 100644 index 5d537fcf12..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/plugin.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License 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 = Dali Java Persistence Tools - DBWS Support - Web Services Generation -providerName = Eclipse Web Tools Platform diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/Main.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/Main.java deleted file mode 100644 index 4f6f4451a6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/Main.java +++ /dev/null @@ -1,241 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.dbws.eclipselink.core.gen; - -import static java.util.logging.Level.INFO; -import static java.util.logging.Level.SEVERE; -import static org.eclipse.persistence.tools.dbws.DBWSPackager.ArchiveUse.ignore; - -import java.io.File; -import java.util.logging.Level; - -import javax.wsdl.WSDLException; - -import org.eclipse.jpt.dbws.eclipselink.core.gen.internal.JptDbwsCoreMessages; -import org.eclipse.jpt.dbws.eclipselink.core.gen.internal.Tools; -import org.eclipse.persistence.oxm.XMLContext; -import org.eclipse.persistence.oxm.XMLUnmarshaller; -import org.eclipse.persistence.tools.dbws.DBWSBuilder; -import org.eclipse.persistence.tools.dbws.DBWSBuilderModel; -import org.eclipse.persistence.tools.dbws.DBWSBuilderModelProject; -import org.eclipse.persistence.tools.dbws.DBWSPackager; -import org.eclipse.persistence.tools.dbws.EclipsePackager; - -/** - * Generate DBWS content - * - * Current command-line arguments: - * [-builderFile dbws-builder.xml] - specifies source builder file - * [-stageDir .\Output_Dir] - specifies destination directory - * [-packageAs eclipse] - specifies the source package - */ -public class Main -{ - private String builderFile; - private String stageDir; - private String packageAs; - @SuppressWarnings("unused") - private boolean isDebugMode; - - // ********** static methods ********** - - public static void main(String[] args) { - new Main().execute(args); - } - - // ********** constructors ********** - - private Main() { - super(); - } - - // ********** behavior ********** - - protected void execute(String[] args) { - - this.initializeWith(args); - - this.generate(); - } - - private void generate() { - - DBWSBuilder builder = new DBWSBuilder(); - - DBWSBuilderModel model = this.buildBuilderModel(this.builderFile); - if(model == null) { - this.logMessage(INFO, JptDbwsCoreMessages.NO_GENERATION_PERFORMED); - return; - } - - builder.setProperties(model.properties); - builder.setOperations(model.operations); - - if( ! this.jdbcDriverIsOnClasspath(builder.getDriver())) { - return; - } - - DBWSPackager packager = this.buildEclipsePackager(); - - this.initializePackager(packager, builder, this.buildStageDir(this.stageDir)); - builder.setPackager(packager); - - try { - builder.start(); - } - catch(WSDLException e) { - this.logMessage(SEVERE, JptDbwsCoreMessages.WSDL_EXCEPTION, e.getMessage()); - return; - } - catch(Exception e) { - //TODO Clean-up Stage dir. ? - this.logMessage(SEVERE, JptDbwsCoreMessages.GENERATION_FAILED, e.getMessage()); - e.printStackTrace(); - return; - } - this.logMessage(INFO, JptDbwsCoreMessages.GENERATION_COMPLETED); - return; - - } - - // ********** internal methods ********** - - private void initializeWith(String[] args) { - - this.builderFile = this.getArgumentBuilderFile(args); - this.stageDir = this.getArgumentStageDir(args); - this.packageAs = this.getArgumentPackageAs(args); - - this.isDebugMode = this.getArgumentDebugMode(args); - } - - private void initializePackager(DBWSPackager packager, DBWSBuilder builder, File stageDir) { - - packager.setDBWSBuilder(builder); - packager.setArchiveUse(ignore); - packager.setAdditionalArgs(null); - packager.setStageDir(stageDir); - packager.setSessionsFileName(builder.getSessionsFileName()); - } - - private DBWSBuilderModel buildBuilderModel(String builderFileName) { - - File builderFile = this.getBuilderFile(builderFileName); - return this.unmarshal(builderFile); - } - - private DBWSBuilderModel unmarshal(File builderFile) { - if((builderFile == null) || ( ! builderFile.exists())) { - return null; - } - XMLContext context = new XMLContext(new DBWSBuilderModelProject()); - XMLUnmarshaller unmarshaller = context.createUnmarshaller(); - - DBWSBuilderModel model = (DBWSBuilderModel)unmarshaller.unmarshal(builderFile); - if(model.properties.size() == 0) { - this.logMessage(SEVERE, JptDbwsCoreMessages.NO_OPERATIONS_SPECIFIED); - return null; - } - return model; - } - - private File getBuilderFile(String builderFileName) { - - File builderFile = new File(builderFileName); - if( ! (builderFile.exists() && builderFile.isFile())) { - this.logMessage(SEVERE, - JptDbwsCoreMessages.UNABLE_TO_LOCATE_BUILDER_XML, builderFileName); //$NON-NLS-1$ - return null; - } - return builderFile; - } - - private File buildStageDir(String stageDirName) { - File dir = new File(stageDirName); - if(( ! dir.exists()) || ( ! dir.isDirectory())) { - dir = Tools.buildDirectory(stageDirName); - } - return dir; - } - - private EclipsePackager buildEclipsePackager() { - return new EclipsePackager() { - @Override - public void start() { - // no need to check for the existence of stageDir, everything is in-memory - } - }; - } - - private boolean jdbcDriverIsOnClasspath(String jdbcDriverName) { - try { - Class.forName(jdbcDriverName); - } - catch (ClassNotFoundException cnfe) { - this.logMessage(SEVERE, JptDbwsCoreMessages.DRIVER_NOT_ON_CLASSPATH, jdbcDriverName); - return false; - } - return true; - } - - private void logMessage(Level level, String key, Object argument) { - Tools.logMessage(level, Tools.bind(key, argument)); - } - - private void logMessage(Level level, String key) { - Tools.logMessage(level, Tools.getString(key)); - } - - // ********** argument queries ********** - - private String getArgumentBuilderFile(String[] args) { - - return this.getArgumentValue("-builderFile", args); //$NON-NLS-1$ - } - - private String getArgumentStageDir(String[] args) { - - return this.getArgumentValue("-stageDir", args); //$NON-NLS-1$ - } - - private String getArgumentPackageAs(String[] args) { - - return this.getArgumentValue("-packageAs", args); //$NON-NLS-1$ - } - - private boolean getArgumentDebugMode(String[] args) { - - return this.argumentExists("-debug", args); //$NON-NLS-1$ - } - - private String getArgumentValue(String argName, String[] args) { - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.equals(argName)) { - int j = i + 1; - if (j < args.length) { - return args[j]; - } - } - } - return null; - } - - private boolean argumentExists(String argName, String[] args) { - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.toLowerCase().equals(argName)) { - return true; - } - } - return false; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/JptDbwsCoreMessages.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/JptDbwsCoreMessages.java deleted file mode 100644 index ff3fa9b9fb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/JptDbwsCoreMessages.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.dbws.eclipselink.core.gen.internal; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * Localized messages used by Dali DBWS generation core. - */ -public class JptDbwsCoreMessages -{ - - public static final String GENERATION_COMPLETED = "GENERATION_COMPLETED"; - public static final String GENERATION_FAILED = "GENERATION_FAILED"; - public static final String NO_GENERATION_PERFORMED = "NO_GENERATION_PERFORMED"; - public static final String WSDL_EXCEPTION = "WSDL_EXCEPTION"; - public static final String NO_OPERATIONS_SPECIFIED = "NO_OPERATIONS_SPECIFIED"; - public static final String UNABLE_TO_LOCATE_BUILDER_XML = "UNABLE_TO_LOCATE_BUILDER_XML"; - public static final String DRIVER_NOT_ON_CLASSPATH = "DRIVER_NOT_ON_CLASSPATH"; - - - private static final String BUNDLE_NAME = "org.eclipse.jpt.dbws.eclipselink.core.gen.internal.jpt_dbws_core"; //$NON-NLS-1$ - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - - private JptDbwsCoreMessages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } - catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/Tools.java b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/Tools.java deleted file mode 100644 index 7a49d7aaae..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/Tools.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.dbws.eclipselink.core.gen.internal; - -import static java.util.logging.Level.SEVERE; - -import java.io.File; -import java.text.MessageFormat; -import java.util.logging.Level; - -/** - * Tools - */ -public final class Tools -{ - /** empty string */ - public static final String EMPTY_STRING = ""; //$NON-NLS-1$ - - private static final String USER_DIRECTORY = System.getProperty("user.dir"); //$NON-NLS-1$ - - // ********** queries ********** - - /** - * Return whether the specified string is null, empty, or contains - * only whitespace characters. - */ - public static boolean stringIsEmpty(String string) { - if (string == null) { - return true; - } - int len = string.length(); - if (len == 0) { - return true; - } - return stringIsEmpty_(string.toCharArray(), len); - } - - private static boolean stringIsEmpty_(char[] s, int len) { - for (int i = len; i-- > 0; ) { - if ( ! Character.isWhitespace(s[i])) { - return false; - } - } - return true; - } - - // ********** short name manipulation ********** - - - public static File buildDirectory(String dirName) { - File currentDir = currentWorkingDirectory(); - File dir = new File(currentDir, dirName); - dir.mkdir(); - return dir; - } - - /** - * Return a file representing the current working directory. - */ - public static File currentWorkingDirectory() { - return new File(USER_DIRECTORY); //$NON-NLS-1$ - } - - /** - * Strip the extension from the specified file name - * and return the result. If the file name has no - * extension, it is returned unchanged - * File#basePath() - */ - public static String stripExtension(String fileName) { - int index = fileName.lastIndexOf('.'); - if (index == -1) { - return fileName; - } - return fileName.substring(0, index); - } - - public static String extractDirectory(String path) { - if( ! path.contains(File.separator)) { - return EMPTY_STRING; - } - return path.substring(0, path.lastIndexOf(File.separator)); - } - - public static void logMessage(Level level, String message) { - if(level == SEVERE) { - System.err.println('\n' + message); - } - else { - System.out.println('\n' + message); - } - } - - // ********** NLS utilities ********** - - public static String getString(String key) { - return JptDbwsCoreMessages.getString(key); - } - - public static String bind(String key, Object argument) { - return MessageFormat.format(getString(key), argument); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/jpt_dbws_core.properties b/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/jpt_dbws_core.properties deleted file mode 100644 index c49d70feb4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.dbws.eclipselink.core.gen/src/org/eclipse/jpt/dbws/eclipselink/core/gen/internal/jpt_dbws_core.properties +++ /dev/null @@ -1,17 +0,0 @@ -################################################################################ -# Copyright (c) 2010, 2011 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ - -GENERATION_COMPLETED = DBWSBuilder generation completed -GENERATION_FAILED = DBWSBuilder generation failed: {0} -NO_GENERATION_PERFORMED = DBWSBuilder no generation performed -WSDL_EXCEPTION = WSDLException: {0} -NO_OPERATIONS_SPECIFIED = No operations specified -UNABLE_TO_LOCATE_BUILDER_XML = DBWSBuilder unable to locate builder XML file: {0} -DRIVER_NOT_ON_CLASSPATH = JDBC driver not on classpath: {0} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/.cvsignore b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/.cvsignore deleted file mode 100644 index c14487ceac..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -build.xml diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/.project b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/.project deleted file mode 100644 index 98560920c2..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.eclipse.jpt.jaxb.branding - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/META-INF/MANIFEST.MF deleted file mode 100644 index 1eae124537..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.jpt.jaxb.branding;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Localization: plugin -Bundle-Vendor: %providerName diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.html b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.html deleted file mode 100644 index ca606b1bb5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

June 06, 2007

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- - - \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.ini b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.ini deleted file mode 100644 index 7d88b9d396..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.ini +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2009 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=icons/WTP_icon_x32_v2.png - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - -# Property "tipsAndTricksHref" contains the Help topic href to a tips and tricks page -# optional -tipsAndTricksHref=/org.eclipse.jpt.doc.user/tips_and_tricks.htm - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.mappings b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.mappings deleted file mode 100644 index bddaab4310..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.properties deleted file mode 100644 index a549df723a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/about.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. - -blurb=Dali Java Persistence Tools - JAXB Support\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Oracle contributors and others 2010. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/build.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/build.properties deleted file mode 100644 index 11a4e44db6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/build.properties +++ /dev/null @@ -1,18 +0,0 @@ -############################################################################### -# Copyright (c) 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -bin.includes = META-INF/,\ - about.ini,\ - about.html,\ - about.mappings,\ - about.properties,\ - icons/,\ - plugin.properties,\ - component.xml diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/component.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/component.xml deleted file mode 100644 index 6250e755ef..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/component.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/icons/WTP_icon_x32_v2.png b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/icons/WTP_icon_x32_v2.png deleted file mode 100644 index 6f09c2a700..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/icons/WTP_icon_x32_v2.png and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/plugin.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.branding/plugin.properties deleted file mode 100644 index fbe477feb2..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.branding/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools - JAXB Support -providerName = Eclipse Web Tools Platform diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.classpath b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.classpath deleted file mode 100644 index 304e86186a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.classpath +++ /dev/null @@ -1,7 +0,0 @@ - - - - - - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.cvsignore b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.cvsignore deleted file mode 100644 index c5e82d7458..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.project b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.project deleted file mode 100644 index 025cb3b6fa..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.jpt.jaxb.core.schemagen - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.settings/org.eclipse.jdt.core.prefs b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 5b24c9f8fd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Mon Mar 22 12:16:03 EDT 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -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/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/META-INF/MANIFEST.MF deleted file mode 100644 index 74056248bf..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/META-INF/MANIFEST.MF +++ /dev/null @@ -1,11 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.jaxb.core.schemagen;singleton:=true -Bundle-Version: 1.0.100.qualifier -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Import-Package: javax.xml.bind -Export-Package: org.eclipse.jpt.jaxb.core.schemagen, - org.eclipse.jpt.jaxb.core.schemagen.internal;x-internal:=true diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/about.html b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/about.html deleted file mode 100644 index 071f586b21..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/about.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

May 02, 2008

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- -

Third Party Content

-

The Content includes items that have been sourced from third parties as set - out below. If you did not receive this Content directly from the Eclipse Foundation, - the following is provided for informational purposes only, and you should look - to the Redistributor’s license for terms and conditions of use.

- -

Java Persistence API (JPA) v1.0

- -
-

The Java Persistence API (JPA) which is distributed under CDDL - v1.0 is required by the Dali Java Persistence Tools Project in order - to support this standard.

-
- - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/build.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/build.properties deleted file mode 100644 index 8ac4a493cc..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/build.properties +++ /dev/null @@ -1,19 +0,0 @@ -############################################################################### -# Copyright (c) 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -javacSource=1.5 -javacTarget=1.5 -source.. = src/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - about.html,\ - plugin.properties -jars.compile.order = . diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/plugin.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/plugin.properties deleted file mode 100644 index 2e7dfca4c9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/plugin.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License 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 = Dali Java Persistence Tools - JAXB Support - Schema Generation -providerName = Eclipse Web Tools Platform diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/Main.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/Main.java deleted file mode 100644 index 9f6a922785..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/Main.java +++ /dev/null @@ -1,287 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.core.schemagen; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; - -import javax.xml.bind.JAXBContext; -import javax.xml.bind.JAXBException; -import javax.xml.bind.SchemaOutputResolver; -import javax.xml.transform.Result; -import javax.xml.transform.stream.StreamResult; - -import org.eclipse.jpt.jaxb.core.schemagen.internal.JptJaxbCoreMessages; -import org.eclipse.jpt.jaxb.core.schemagen.internal.Tools; - -/** - * Generate a JAXB Schema - * - * Current command-line arguments: - * [-s schema.xsd] - specifies the target schema - * [-c className] - specifies the fully qualified class name - * - * [-p packageName] - specifies the source package // @deprecated - */ -public class Main -{ - private String[] sourceClassNames; - private String targetSchemaName; - @SuppressWarnings("unused") - private boolean isDebugMode; - - static public String NO_FACTORY_CLASS = "doesnt contain ObjectFactory.class"; //$NON-NLS-1$ - - // ********** static methods ********** - - public static void main(String[] args) { - new Main().execute(args); - } - - // ********** constructors ********** - - private Main() { - super(); - } - - // ********** behavior ********** - - protected void execute(String[] args) { - - this.initializeWith(args); - - this.generate(); - } - - // ********** internal methods ********** - - private void initializeWith(String[] args) { - this.sourceClassNames = this.getSourceClassNames(args); - this.targetSchemaName = this.getTargetSchemaName(args); - - this.isDebugMode = this.getDebugMode(args); - } - - private void generate() { - // Create the JAXBContext - JAXBContext jaxbContext = this.buildJaxbContext(); - - // Generate an XML Schema - if(jaxbContext != null) { - this.generateSchema(jaxbContext); - } - else { - System.out.println(Tools.bind(JptJaxbCoreMessages.SCHEMA_NOT_CREATED, this.targetSchemaName)); - } - } - - private JAXBContext buildJaxbContext() { - System.out.println(Tools.getString(JptJaxbCoreMessages.LOADING_CLASSES)); - JAXBContext jaxbContext = null; - try { - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - - Class[] sourceClasses = this.buildSourceClasses(this.sourceClassNames, loader); - - jaxbContext = JAXBContext.newInstance(sourceClasses); - } - catch(JAXBException ex) { - this.handleException(ex); - } - return jaxbContext; - } - - private void generateSchema(JAXBContext jaxbContext) { - System.out.println(Tools.getString(JptJaxbCoreMessages.GENERATING_SCHEMA)); - System.out.flush(); - - SchemaOutputResolver schemaOutputResolver = - new JptSchemaOutputResolver(this.targetSchemaName); - - try { - jaxbContext.generateSchema(schemaOutputResolver); - } - catch (IOException e) { - e.printStackTrace(); - } - } - - private Class[] buildSourceClasses(String[] classNames, ClassLoader loader) { - - ArrayList sourceClasses = new ArrayList(classNames.length); - for(String className: classNames) { - try { - sourceClasses.add(loader.loadClass(className)); - System.out.println(className); - } - catch (ClassNotFoundException e) { - System.err.println(Tools.bind(JptJaxbCoreMessages.NOT_FOUND, className)); - } - } - System.out.flush(); - return sourceClasses.toArray(new Class[0]); - } - - private void handleException(JAXBException ex) { - String message = ex.getMessage(); - Throwable linkedEx = ex.getLinkedException(); - if(message != null && message.indexOf(NO_FACTORY_CLASS) > -1) { - System.err.println(message); - } - else if(linkedEx != null && linkedEx instanceof ClassNotFoundException) { - String errorMessage = Tools.bind(JptJaxbCoreMessages.CONTEXT_FACTORY_NOT_FOUND, linkedEx.getMessage()); - System.err.println(errorMessage); - } - else { - ex.printStackTrace(); - } - } - - // ********** argument queries ********** - - private String[] getSourceClassNames(String[] args) { - - return this.getAllArgumentValue("-c", args); //$NON-NLS-1$ - } - - private String getTargetSchemaName(String[] args) { - - return this.getArgumentValue("-s", args); //$NON-NLS-1$ - } - - private boolean getDebugMode(String[] args) { - - return this.argumentExists("-debug", args); //$NON-NLS-1$ - } - - // ********** private methods ********** - - private String getArgumentValue(String argName, String[] args) { - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.toLowerCase().equals(argName)) { - int j = i + 1; - if (j < args.length) { - return args[j]; - } - } - } - return null; - } - - private String[] getAllArgumentValue(String argName, String[] args) { - List argValues = new ArrayList(); - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.toLowerCase().equals(argName)) { - int j = i + 1; - if (j < args.length) { - argValues.add(args[j]); - i++; - } - } - } - return argValues.toArray(new String[0]); - } - - private boolean argumentExists(String argName, String[] args) { - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.toLowerCase().equals(argName)) { - return true; - } - } - return false; - } - -} - -// ********** inner class ********** - -class JptSchemaOutputResolver extends SchemaOutputResolver { - - private final String defaultSchemaName; - - // ********** constructor ********** - - protected JptSchemaOutputResolver(String defaultSchemaName) { - this.defaultSchemaName = defaultSchemaName; - } - - // ********** overrides ********** - - @Override - public Result createOutput(String namespaceURI, String suggestedFileName) throws IOException { - - String filePath = (Tools.stringIsEmpty(namespaceURI)) ? - this.buildFileNameFrom(this.defaultSchemaName, suggestedFileName) : - this.modifyFileName(namespaceURI); - - filePath = this.canonicalFileName(filePath); - File file = new File(filePath); - StreamResult result = new StreamResult(file); - result.setSystemId(file.toURL().toExternalForm()); - - System.out.print(Tools.bind(JptJaxbCoreMessages.SCHEMA_GENERATED, file)); - return result; - } - - // ********** private methods ********** - - private String buildFileNameFrom(String fileName, String suggestedFileName) { - - fileName = Tools.stripExtension(fileName); - - if(Tools.stringIsEmpty(fileName)) { - return suggestedFileName; - } - String number = Tools.extractFileNumber(suggestedFileName); - - fileName = this.buildFileName(fileName, number); - return Tools.appendXsdExtension(fileName); - } - - private String buildFileName(String fileName, String number) { - - if(Tools.stringIsEmpty(number)) { - return fileName; - } - return (number.equals("0")) ? fileName : fileName + number; //$NON-NLS-1$ - } - - private String modifyFileName(String namespaceURI) throws IOException { - - String dir = Tools.extractDirectory(this.defaultSchemaName); - - String fileName = Tools.stripProtocol(namespaceURI); - fileName = fileName.replaceAll("/", "_"); //$NON-NLS-1$ - fileName = Tools.appendXsdExtension(fileName); - - String result = (Tools.stringIsEmpty(dir)) ? fileName : dir + File.separator + fileName; - - return result; - } - - private String canonicalFileName(String fileName) { - return this.canonicalFile(new File(fileName)).getAbsolutePath(); - } - - private File canonicalFile(File file) { - try { - return file.getCanonicalFile(); - } - catch (IOException ioexception) { - return file.getAbsoluteFile(); - } - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/JptJaxbCoreMessages.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/JptJaxbCoreMessages.java deleted file mode 100644 index 49170533dd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/JptJaxbCoreMessages.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.core.schemagen.internal; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * Localized messages used by Dali JAXB core. - */ -public class JptJaxbCoreMessages -{ - - public static final String LOADING_CLASSES = "LOADING_CLASSES"; - public static final String GENERATING_SCHEMA = "GENERATING_SCHEMA"; - public static final String SCHEMA_GENERATED = "SCHEMA_GENERATED"; - public static final String SCHEMA_NOT_CREATED = "SCHEMA_NOT_CREATED"; - public static final String NOT_FOUND = "NOT_FOUND"; - public static final String CONTEXT_FACTORY_NOT_FOUND = "CONTEXT_FACTORY_NOT_FOUND"; - - - private static final String BUNDLE_NAME = "org.eclipse.jpt.jaxb.core.schemagen.internal.jpt_jaxb_core"; //$NON-NLS-1$ - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - - private JptJaxbCoreMessages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } - catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/Tools.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/Tools.java deleted file mode 100644 index 6427661dcd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/Tools.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.core.schemagen.internal; - -import java.io.File; -import java.text.MessageFormat; - -/** - * Tools - */ -public final class Tools -{ - /** default file name used by the schemagen */ - static public String GEN_DEFAULT_NAME = "schema"; //$NON-NLS-1$ - - /** empty string */ - public static final String EMPTY_STRING = ""; //$NON-NLS-1$ - - // ********** queries ********** - - /** - * Return whether the specified string is null, empty, or contains - * only whitespace characters. - */ - public static boolean stringIsEmpty(String string) { - if (string == null) { - return true; - } - int len = string.length(); - if (len == 0) { - return true; - } - return stringIsEmpty_(string.toCharArray(), len); - } - - private static boolean stringIsEmpty_(char[] s, int len) { - for (int i = len; i-- > 0; ) { - if ( ! Character.isWhitespace(s[i])) { - return false; - } - } - return true; - } - - // ********** short name manipulation ********** - - /** - * Strip the extension from the specified file name - * and return the result. If the file name has no - * extension, it is returned unchanged - * File#basePath() - */ - public static String stripExtension(String fileName) { - int index = fileName.lastIndexOf('.'); - if (index == -1) { - return fileName; - } - return fileName.substring(0, index); - } - - public static String stripProtocol(String uri) { - - return uri.replaceFirst("http://", EMPTY_STRING); - } - - - public static String appendXsdExtension(String name) { - - return name + ".xsd"; //$NON-NLS-1$ - } - - public static String extractFileNumber(String fileName) { - - String result = stripExtension(fileName); - if(Tools.stringIsEmpty(result)) { - return EMPTY_STRING; - } - return result.replaceFirst(GEN_DEFAULT_NAME, EMPTY_STRING); - } - - public static String extractDirectory(String path) { - if( ! path.contains(File.separator)) { - return EMPTY_STRING; - } - return path.substring(0, path.lastIndexOf(File.separator)); - } - - // ********** NLS utilities ********** - - public static String getString(String key) { - return JptJaxbCoreMessages.getString(key); - } - - public static String bind(String key, Object argument) { - return MessageFormat.format(getString(key), argument); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/jpt_jaxb_core.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/jpt_jaxb_core.properties deleted file mode 100644 index b9112cd725..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core.schemagen/src/org/eclipse/jpt/jaxb/core/schemagen/internal/jpt_jaxb_core.properties +++ /dev/null @@ -1,19 +0,0 @@ -################################################################################ -# Copyright (c) 2010 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ - -LOADING_CLASSES = loading... -GENERATING_SCHEMA = \ngenerating schema... -SCHEMA_GENERATED = \nSchema {0} generated -SCHEMA_NOT_CREATED = \nSchema {0} not created -NOT_FOUND = \n\tNot found: {0} -CONTEXT_FACTORY_NOT_FOUND = \nThe JAXBContextFactory {0} \n\ -specified in the jaxb.properties file could not be located on the project classpath. \n\ -The JAXB provider that defines this factory should be added to the project classpath, \n\ -or the jaxb.properties file should be removed to use the default provider. diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/.classpath b/jaxb/plugins/org.eclipse.jpt.jaxb.core/.classpath deleted file mode 100644 index dc10b33286..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/.classpath +++ /dev/null @@ -1,15 +0,0 @@ - - - - - - - - - - - - - - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/.cvsignore b/jaxb/plugins/org.eclipse.jpt.jaxb.core/.cvsignore deleted file mode 100644 index 31362a7d19..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -bin -@dot -temp.folder -build.xml -javaCompiler...args -javaCompiler...args.* diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/.project b/jaxb/plugins/org.eclipse.jpt.jaxb.core/.project deleted file mode 100644 index 54ea9292fc..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.jpt.jaxb.core - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/.settings/org.eclipse.jdt.core.prefs b/jaxb/plugins/org.eclipse.jpt.jaxb.core/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 554baf91aa..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Mon Sep 13 23:43:46 EDT 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -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/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF deleted file mode 100644 index 3c3ee43439..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/META-INF/MANIFEST.MF +++ /dev/null @@ -1,49 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.jaxb.core;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Activator: org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin -Bundle-ActivationPolicy: lazy -Bundle-ClassPath: . -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.200,4.0.0)", - org.eclipse.core.runtime;bundle-version="[3.6.100,4.0.0)", - org.eclipse.debug.core;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jdt.core;bundle-version="[3.7.0,4.0.0)", - org.eclipse.jdt.launching;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jpt.common.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)", - org.eclipse.jst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)", - org.eclipse.jst.j2ee;bundle-version="[1.1.402,2.0.0)", - org.eclipse.jst.j2ee.core;bundle-version="[1.2.100,2.0.0)", - org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,2.0.0)", - org.eclipse.wst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)", - org.eclipse.wst.common.uriresolver;bundle-version="[1.1.401,2.0.0)", - org.eclipse.wst.validation;bundle-version="[1.2.200,2.0.0)", - org.eclipse.wst.xml.core;bundle-version="[1.1.600,2.0.0)", - org.eclipse.wst.xsd.core;bundle-version="[1.1.600,2.0.0)", - org.eclipse.xsd;bundle-version="[2.6.0,3.0.0)" -Export-Package: org.eclipse.jpt.jaxb.core, - org.eclipse.jpt.jaxb.core.context, - org.eclipse.jpt.jaxb.core.context.java, - org.eclipse.jpt.jaxb.core.internal;x-internal:=true, - org.eclipse.jpt.jaxb.core.internal.context;x-internal:=true, - org.eclipse.jpt.jaxb.core.internal.context.java;x-internal:=true, - org.eclipse.jpt.jaxb.core.internal.facet;x-internal:=true, - org.eclipse.jpt.jaxb.core.internal.gen;x-friends:="org.eclipse.jpt.jaxb.ui", - org.eclipse.jpt.jaxb.core.internal.jaxb21;x-internal:=true, - org.eclipse.jpt.jaxb.core.internal.jaxb22;x-internal:=true, - org.eclipse.jpt.jaxb.core.internal.libprov;x-internal:=true, - org.eclipse.jpt.jaxb.core.internal.operations;x-friends:="org.eclipse.jpt.jaxb.ui", - org.eclipse.jpt.jaxb.core.internal.platform;x-internal:=true, - org.eclipse.jpt.jaxb.core.internal.resource.java;x-internal:=true, - org.eclipse.jpt.jaxb.core.internal.resource.java.binary;x-internal:=true, - org.eclipse.jpt.jaxb.core.internal.resource.java.source;x-internal:=true, - org.eclipse.jpt.jaxb.core.internal.validation;x-internal:=true, - org.eclipse.jpt.jaxb.core.libprov, - org.eclipse.jpt.jaxb.core.platform, - org.eclipse.jpt.jaxb.core.resource.java, - org.eclipse.jpt.jaxb.core.xsd diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/about.html b/jaxb/plugins/org.eclipse.jpt.jaxb.core/about.html deleted file mode 100644 index be534ba44f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/about.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

May 02, 2008

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/build.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core/build.properties deleted file mode 100644 index 93b16b88ae..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/build.properties +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################### -# Copyright (c) 2010 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -javacSource=1.5 -javacTarget=1.5 -source.. = src/,\ - property_files/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - about.html,\ - plugin.xml,\ - plugin.properties -jars.compile.order = . diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/component.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.core/component.xml deleted file mode 100644 index 1bf3de57da..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/component.xml +++ /dev/null @@ -1,16 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties deleted file mode 100644 index 6f814334bb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.properties +++ /dev/null @@ -1,31 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2011 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools - JAXB Core -providerName = Eclipse Web Tools Platform - -JAXB_PLATFORMS = JAXB Platforms - -JAXB_PROBLEM_MARKER = JAXB Problem - -GENERIC_PLATFORM_GROUP_LABEL = Generic JAXB -GENERIC_2_2_PLATFORM_LABEL = Generic JAXB 2.2 -GENERIC_2_1_PLATFORM_LABEL = Generic JAXB 2.1 - -JAXB_FACET_LABEL = JAXB -JAXB_FACET_DESCRIPTION = Adds support for data binding using the Java Architecture for XML Binding (JAXB). -JAXB_TEMPLATE_LABEL = JAXB Project - -JAXB_NO_OP_LIBRARY_PROVIDER_MESSAGE = The JAXB facet requires a JAXB implementation library to be present on the project classpath. By disabling library configuration, the user takes on the responsibility of ensuring that the classpath is configured appropriately via alternate means. - -JAXB_JRE_LIBRARY_PROVIDER_LABEL = JRE -JAXB_JRE_LIBRARY_PROVIDER_MESSAGE = The project JRE provides the annotations and implementation to support the chosen JAXB version. - -JAXB_VALIDATOR = JAXB Validator diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml deleted file mode 100644 index 2c02e0b7ad..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/plugin.xml +++ /dev/null @@ -1,265 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 900 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %JAXB_FACET_DESCRIPTION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jaxb_validation.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jaxb_validation.properties deleted file mode 100644 index fb720eb731..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jaxb_validation.properties +++ /dev/null @@ -1,27 +0,0 @@ -################################################################################ -# Copyright (c) 2010, 2011 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ - -NO_JAXB_PROJECT = This project has the JAXB facet, but no JAXB content could be created. See the error log for more details. -PROJECT_INVALID_LIBRARY_PROVIDER=The currently selected JAXB library provider is invalid. - -PACKAGE_NO_SCHEMA_FOR_NAMESPACE = There is no schema specified on the project for the namespace ''{0}'' on the package ''{1}''. No schema-specific validation will be performed. -PACKAGE_XML_JAVA_TYPE_ADAPTER_TYPE_NOT_SPECIFIED = The type must be specified for an XML Java type adapter on a package - -XML_TYPE_UNMATCHING_NAMESPACE_FOR_ANONYMOUS_TYPE = The namespace for an anonymous type should not be different from its package -XML_TYPE_UNRESOLVED_SCHEMA_TYPE = The type definition with name ''{0}'' and namespace ''{1}'' cannot be resolved - -XML_ROOT_ELEMENT_UNRESOLVED_SCHEMA_ELEMENT = The element declaration with name ''{0}'' and namespace ''{1}'' cannot be resolved -XML_ROOT_ELEMENT_TYPE_CONFLICTS_WITH_XML_TYPE = The xml type of the element declaration with name ''{0}'' and namespace ''{1}'' conflicts with the xml type of the associated class - -ATTRIBUTE_MAPPING_XML_JAVA_TYPE_ADAPTER_TYPE_NOT_DEFINED = The type for XML Java type adapter is not defined -XML_ELEMENT_WRAPPER_DEFINED_ON_NON_ARRAY_NON_COLLECTION = XmlElementWrapper is only allowed on a collection or array property -XML_LIST_DEFINED_ON_NON_ARRAY_NON_COLLECTION = XmlList is only allowed on a collection or array property -MULTIPLE_XML_VALUE_MAPPINGS_DEFINED = Attribute ''{0}'' cannot be mapped as XmlValue because attribute ''{1}'' is already mapped as XmlValue, cannot define multiple XmlValue mappings -XML_VALUE_MAPPING_WITH_NON_XML_ATTRIBUTE_MAPPING_DEFINED = Attribute ''{0}'' must be mapped as XmlAttribute because another attribute ''{1}'' is mapped as XmlValue diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jpt_jaxb_core.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jpt_jaxb_core.properties deleted file mode 100644 index 0688655614..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/property_files/jpt_jaxb_core.properties +++ /dev/null @@ -1,22 +0,0 @@ -################################################################################ -# Copyright (c) 2010, 2011 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ - -SchemaGenerator_creatingJAXBPropertiesFileTask = Creating jaxb.properties file - -ClassesGenerator_generatingClasses = Generating JAXB Classes from Schema -ClassesGenerator_generatingClassesTask = Generating classes - -JaxbFacetConfig_validatePlatformNotSpecified = Platform must be specified -JaxbFacetConfig_validatePlatformDoesNotSupportFacetVersion = Platform does not support the current JAXB facet version - -JreLibraryValidator_invalidPlatform = Project JRE does not support the current JAXB platform. -JreLibraryValidator_invalidJreJaxbVersion = Project JRE does not support the current JAXB version. - -PREFERENCES_FLUSH_JOB_NAME=Flush Preferences: {0} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/schema/jaxbPlatforms.exsd b/jaxb/plugins/org.eclipse.jpt.jaxb.core/schema/jaxbPlatforms.exsd deleted file mode 100644 index 92b9195c13..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/schema/jaxbPlatforms.exsd +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - - - - This is used for defining JAXB platforms and JAXB platform versions. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Declares a JAXB platform group. Acts as a sort of "super" platform. Most useful for enabling functionality for a set of platforms without having to enable the functionality for each platform separately. - - - - - - - The unique identifier for a JAXB platform group. - - - - - - - A translatable string representation of the JAXB platform group. - - - - - - - - - - - - - Declares a JAXB platform. One JAXB platform will be selected per JAXB-faceted project. See <samp>org.eclipse.jpt.jaxb.core.JaxbPlatform</samp> for more information on JAXB platforms. Also see the org.eclipse.jpt.jaxb.ui.jaxbPlatformUis extension point. - - - - - - - - - - - - - - A translatable string representation of the platform. - - - - - - - - - - The class that implements <samp>org.eclipse.jpt.jaxb.core.JaxbPlatformDefinitionFactory</samp>. - - - - - - - - - - Declares which JAXB platform group this platform belongs to. If none is specified, this platform will be assumed to belong to its own group with the same id. - - - - - - - Declares the JAXB facet version for which this platform may be used. If no facet version is specified, this platform is available for all JAXB facet versions. - - - - - - - Declares whether this platform should be used as a default JAXB platform for new JAXB project content. Note that if a workspace contains more than one default platform for a JAXB facet version, one of them will be chosen at random. By default, a platform is not a default platform. - - - - - - - - - - - - JPT 3.0 - - - - - - - - - <br> -<p> -The following example is the included generic JAXB 2.2 platform and its platform group -<p> -<pre> -<extension point="org.eclipse.jpt.jaxb.core.jaxbPlatforms"> - - <jaxbPlatformGroup - id="generic" - label="%GENERIC_PLATFORM_GROUP_LABEL"/> - - <jaxbPlatform - id="generic_2_2" - label="%GENERIC_2_2_PLATFORM_LABEL" - factoryClass="org.eclipse.jpt.jaxb.core.internal.jaxb22.GenericJaxb_2_2_PlatformDefinitionFactory" - group="generic" - jaxbFacetVersion="2.2" - default="false"/> - - </extension> - - - - - - - - - <br> -Provisional API: This interface is part of an interim API that is still -under development and expected to change significantly before reaching -stability. It is available at this early stage to solicit feedback from -pioneering adopters on the understanding that any code that uses this API -will almost certainly be broken (repeatedly) as the API evolves. - - - - - - - - - <br> -<p>The org.eclipse.jpt.jaxb.core plug-in provides the following jaxb platforms: -<ul> -<li>generic_2_2</li> -</ul> -</p> -<p>and the following jaxb platform groups: -<ul> -<li>generic</li> -</ul> -</p> - - - - - - - - - Copyright (c) 2010 Oracle. All rights reserved. -This program and the accompanying materials are made available under the -terms of the Eclipse Public License v1.0, which accompanies this distribution -and is available at http://www.eclipse.org/legal/epl-v10.html. - -Contributors: -Oracle - initial API and implementation - - - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/AnnotationProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/AnnotationProvider.java deleted file mode 100644 index 034e5615e9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/AnnotationProvider.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotation; - -/** - * This is used to provide type and attribute annotations. - * Also provides list of supported annotation names, check the appropriate list - * before trying to build an annotation with that name. An exception will - * be thrown on an attempt to build an annotation that does not exist. - * - * This interface is not intended to be implemented. Instead implement - * AnnotationDefinitionProvider to extend the list of supported annotation definitions. - * - * @see AnnotationDefinitionProvider - * @version 3.0 - * @since 3.0 - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface AnnotationProvider { - - /** - * Return the names of the annotations. - */ - Iterable getAnnotationNames(); - - Iterable getContainerAnnotationNames(); - - Iterable getNestableAnnotationNames(); - - String getNestableAnnotationName(String containerAnnotationName); - - String getNestableElementName(String nestableAnnotationName); - - /** - * Build an annotation with the specified name. - * Throw an IllegalArgumentException if the specified name is unsupported. - * @see #getAnnotationNames() - */ - Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, String annotationName); - - /** - * Build a nestable annotation with the specified name and index. - * Throw an IllegalArgumentException if the specified name is unsupported. - * @see #getNestableAnnotationNames() - */ - NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, String annotationName, int index); - - /** - * Build an annotation for the specified JDT annotation. - * Throw an IllegalArgumentException if the specified annotation is unsupported. - * @see #getAnnotationNames() - */ - Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation); - - /** - * Build a null annotation with the specified name. - * Throw an IllegalArgumentException if the specified annotation is unsupported. - * @see #getAnnotationNames() - */ - Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent, String annotationName); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbPlatform.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbPlatform.java deleted file mode 100644 index a6cda374d8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbPlatform.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core; - -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformGroupDescription; - -/** - * Constants pertaining to the Generic JAXB platforms and their group. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public class GenericJaxbPlatform { - - public static final JaxbPlatformGroupDescription GROUP - = JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatformGroup("generic"); //$NON-NLS-1$ - - public static final JaxbPlatformDescription VERSION_2_1 - = JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatform("generic_2_1"); //$NON-NLS-1$ - - public static final JaxbPlatformDescription VERSION_2_2 - = JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatform("generic_2_2"); //$NON-NLS-1$ - - - /** - * Not for instantiation - */ - private GenericJaxbPlatform() {} -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbProjectManager.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbProjectManager.java deleted file mode 100644 index c4056c7bd5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/GenericJaxbProjectManager.java +++ /dev/null @@ -1,1038 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core; - -import java.util.Vector; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceProxy; -import org.eclipse.core.resources.IResourceProxyVisitor; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.jobs.IJobManager; -import org.eclipse.core.runtime.jobs.ILock; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jdt.core.ElementChangedEvent; -import org.eclipse.jdt.core.IElementChangedListener; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages; -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.internal.AsynchronousCommandExecutor; -import org.eclipse.jpt.common.utility.internal.SimpleCommandExecutor; -import org.eclipse.jpt.common.utility.internal.StatefulCommandExecutor; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.SynchronizedBoolean; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.jaxb.core.internal.SimpleJaxbProjectConfig; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; -import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework; -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.core.events.IProjectFacetActionEvent; -import org.osgi.framework.BundleContext; - -/** - * The JAXB project manager maintains a list of all JAXB projects in the workspace. - * It keeps the list (and the state of the JAXB projects themselves) - * synchronized with the workspace by listening for various - * changes:
    - *
  • Resource - *
  • Java - *
  • Faceted Project - *
- * We use an Eclipse {@link ILock lock} to synchronize access to the JAXB - * projects when dealing with these events. In an effort to reduce deadlocks, - * the simple Resource and Java change events are dispatched to a background - * thread, allowing us to handle the events outside of the workspace lock held - * during resource and Java change notifications. - *

- * Events that trigger either the adding or removing of a JAXB project (e.g. - * {@link IResourceChangeEvent#POST_CHANGE}) are handled "synchronously" - * by allowing the background thread to handle any outstanding events before - * updating the list of JAXB projects and returning execution to the event - * source. - *

- * Various things that cause us to add or remove a JAXB project:

    - *
  • The {@link JptJaxbCorePlugin} will "lazily" instantiate and {@link #start() start} - * a JAXB project manager as appropriate. This will trigger the manager - * to find and add all pre-existing JAXB projects. - * - *
  • Project created and facet installed

    - * {@link IResourceChangeEvent#POST_CHANGE} - *

  • Project facet uninstalled

    - * {@link IFacetedProjectEvent.Type#PRE_UNINSTALL} - * - *

  • Project opened

    - * {@link IResourceChangeEvent#POST_CHANGE} - * -> {@link IResource#FILE} - * -> {@link IResourceDelta#ADDED} facet settings file - * (/.settings/org.eclipse.wst.common.project.facet.core.xml) - *

  • Project closed

    - * {@link IResourceChangeEvent#POST_CHANGE} - * -> {@link IResource#FILE} - * -> {@link IResourceDelta#REMOVED} facet settings file - * - *

  • Pre-existing project imported from directory or archive (created and opened)

    - * {@link IResourceChangeEvent#POST_CHANGE} - * -> {@link IResource#FILE} - * -> {@link IResourceDelta#ADDED} facet settings file - *

  • Project renamed

    - * {@link IResourceChangeEvent#POST_CHANGE} - * -> {@link IResource#FILE} - * -> {@link IResourceDelta#REMOVED} facet settings file of old project - * -> {@link IResourceDelta#ADDED} facet settings file of new project - *

  • Project deleted

    - * {@link IResourceChangeEvent#POST_CHANGE} - * -> {@link IResource#FILE} - * -> {@link IResourceDelta#REMOVED} facet settings file - * - *

  • Project facet installed by editing the facets settings file directly

    - * {@link IResourceChangeEvent#POST_CHANGE} - * -> {@link IResource#FILE} - * -> {@link IResourceDelta#CHANGED} facet settings file - *

  • Project facet uninstalled by editing the facets settings file directly

    - * {@link IResourceChangeEvent#POST_CHANGE} - * -> {@link IResource#FILE} - * -> {@link IResourceDelta#CHANGED} facet settings file - *

- */ -//TODO Still need to look at faceted project listener for facet uninstall -class GenericJaxbProjectManager - extends AbstractModel - implements JaxbProjectManager { - - /** - * All the JAXB projects in the workspace. - */ - private final Vector jaxbProjects = new Vector(); - - /** - * Synchronize access to the JAXB projects. - */ - /* private */ final ILock lock = this.getJobManager().newLock(); - - /** - * Determine how Resource and Java change events are - * handled (i.e. synchronously or asynchronously). - */ - private volatile StatefulCommandExecutor eventHandler = new AsynchronousCommandExecutor(JptCommonCoreMessages.DALI_EVENT_HANDLER_THREAD_NAME); - - /** - * Listen for
    - *
  • changes to projects and files - *
  • clean builds - *
- */ - private final IResourceChangeListener resourceChangeListener = new ResourceChangeListener(); - - /** - * The types of resource change events that interest - * {@link #resourceChangeListener}. - */ - private static final int RESOURCE_CHANGE_EVENT_TYPES = - IResourceChangeEvent.POST_CHANGE | - IResourceChangeEvent.POST_BUILD; - - /** - * Listen for changes to this file to determine when the JAXB facet is - * added to or removed from a "faceted" project. - */ - private static final String FACETED_PROJECT_FRAMEWORK_SETTINGS_FILE_NAME = FacetedProjectFramework.PLUGIN_ID + ".xml"; //$NON-NLS-1$ - - /** - * Listen for the JAXB facet being added to or removed from a "faceted" project. - */ - private final IFacetedProjectListener facetedProjectListener = new FacetedProjectListener(); - - /** - * The types of faceted project events that interest - * {@link #facetedProjectListener}. - */ - private static final IFacetedProjectEvent.Type[] FACETED_PROJECT_EVENT_TYPES = new IFacetedProjectEvent.Type[] { - IFacetedProjectEvent.Type.PRE_UNINSTALL - }; - - /** - * Listen for Java changes (unless the Dali UI is active). - * @see #javaElementChangeListenerIsActive() - */ - private final JavaElementChangeListener javaElementChangeListener = new JavaElementChangeListener(); - - /** - * The types of resource change events that interest - * {@link #javaElementChangeListener}. - */ - private static final int JAVA_CHANGE_EVENT_TYPES = - ElementChangedEvent.POST_CHANGE | - ElementChangedEvent.POST_RECONCILE; - - - // ********** constructor ********** - - /** - * Internal: called by {@link JptJUaxbCorePlugin Dali plug-in}. - */ - GenericJaxbProjectManager() { - super(); - } - - - // ********** plug-in controlled life-cycle ********** - - /** - * Internal: called by {@link JptJaxbCorePlugin Dali plug-in}. - */ - void start() { - try { - this.lock.acquire(); - this.start_(); - } finally { - this.lock.release(); - } - } - - private void start_() { - debug("*** JAXB project manager START ***"); //$NON-NLS-1$ - try { - this.buildJaxbProjects(); - this.eventHandler.start(); - this.getWorkspace().addResourceChangeListener(this.resourceChangeListener, RESOURCE_CHANGE_EVENT_TYPES); - FacetedProjectFramework.addListener(this.facetedProjectListener, FACETED_PROJECT_EVENT_TYPES); - JavaCore.addElementChangedListener(this.javaElementChangeListener, JAVA_CHANGE_EVENT_TYPES); - } catch (RuntimeException ex) { - JptJaxbCorePlugin.log(ex); - this.stop_(); - } - } - - /** - * Side-effect: {@link #jaxbProjects} populated. - */ - private void buildJaxbProjects() { - try { - this.buildJaxbProjects_(); - } catch (CoreException ex) { - // if we have a problem, leave the currently built JAXB projects in - // place and keep executing (should be OK...) - JptJaxbCorePlugin.log(ex); - } - } - - private void buildJaxbProjects_() throws CoreException { - this.getWorkspace().getRoot().accept(new ResourceProxyVisitor(), IResource.NONE); - } - - /** - * Internal: called by {@link JptJaxbCorePlugin Dali plug-in}. - */ - void stop() throws Exception { - try { - this.lock.acquire(); - this.stop_(); - } finally { - this.lock.release(); - } - } - - private void stop_() { - debug("*** JAXB project manager STOP ***"); //$NON-NLS-1$ - JavaCore.removeElementChangedListener(this.javaElementChangeListener); - FacetedProjectFramework.removeListener(this.facetedProjectListener); - this.getWorkspace().removeResourceChangeListener(this.resourceChangeListener); - this.eventHandler.stop(); - this.clearJaxbProjects(); - } - - private void clearJaxbProjects() { - // clone to prevent concurrent modification exceptions - for (JaxbProject jaxbProject : this.getJaxbProjects_()) { - this.removeJaxbProject(jaxbProject); - } - } - - - // ********** JaxbProjectManager implementation ********** - - public Iterable getJaxbProjects() { - try { - this.lock.acquire(); - return this.getJaxbProjects_(); - } finally { - this.lock.release(); - } - } - - private Iterable getJaxbProjects_() { - return new LiveCloneIterable(this.jaxbProjects); - } - - public int getJaxbProjectsSize() { - return this.jaxbProjects.size(); - } - - public JaxbProject getJaxbProject(IProject project) { - try { - this.lock.acquire(); - return this.getJaxbProject_(project); - } finally { - this.lock.release(); - } - } - - private JaxbProject getJaxbProject_(IProject project) { - for (JaxbProject jaxbProject : this.jaxbProjects) { - if (jaxbProject.getProject().equals(project)) { - return jaxbProject; - } - } - return null; - } - - public JaxbFile getJaxbFile(IFile file) { - JaxbProject jaxbProject = this.getJaxbProject(file.getProject()); - return (jaxbProject == null) ? null : jaxbProject.getJaxbFile(file); - } - - public void rebuildJaxbProject(IProject project) { - try { - this.lock.acquire(); - this.rebuildJaxbProject_(project); - } finally { - this.lock.release(); - } - } - - /** - * assumption: the JAXB project holder exists - */ - private void rebuildJaxbProject_(IProject project) { - this.removeJaxbProject(this.getJaxbProject_(project)); - this.addJaxbProject(project); - } - - public boolean javaElementChangeListenerIsActive() { - return this.javaElementChangeListener.isActive(); - } - - public void setJavaElementChangeListenerIsActive(boolean javaElementChangeListenerIsActive) { - this.javaElementChangeListener.setActive(javaElementChangeListenerIsActive); - } - - public IWorkspace getWorkspace() { - return ResourcesPlugin.getWorkspace(); - } - - public IJobManager getJobManager() { - return Job.getJobManager(); - } - - - // ********** adding/removing JAXB projects ********** - - /* private */ void addJaxbProject(IProject project) { - this.addJaxbProject(this.buildJaxbProject(project)); - } - - private void addJaxbProject(JaxbProject jaxbProject) { - // figure out exactly when JAXB projects are added - dumpStackTrace("add: ", jaxbProject); //$NON-NLS-1$ - // the JAXB project will be null if we have any problems building it... - // (e.g. if we have problems getting the JAXB platform) - if (jaxbProject != null) { - this.addItemToCollection(jaxbProject, this.jaxbProjects, JAXB_PROJECTS_COLLECTION); - } - } - - /** - * return null if we have any problems... - */ - private JaxbProject buildJaxbProject(IProject project) { - return this.buildJaxbProject(this.buildJaxbProjectConfig(project)); - } - - /** - * return null if we have any problems... - */ - private JaxbProject buildJaxbProject(JaxbProject.Config config) { - JaxbPlatformDefinition platformDefinition = config.getPlatformDefinition(); - if (platformDefinition == null) { - return null; - } - JaxbProject jaxbProject = this.buildJaxbProject(platformDefinition, config); - if (jaxbProject == null) { - return null; - } -// jaxbProject.setUpdateSynchronizer(new CallbackAsynchronousSynchronizer()); - return jaxbProject; - } - - /** - * return null if we have any problems... - */ - private JaxbProject buildJaxbProject(JaxbPlatformDefinition platformDefinition, JaxbProject.Config config) { - try { - return platformDefinition.getFactory().buildJaxbProject(config); - } - catch (RuntimeException ex) { - JptJaxbCorePlugin.log(ex); - return null; - } - } - - private JaxbProject.Config buildJaxbProjectConfig(IProject project) { - SimpleJaxbProjectConfig config = new SimpleJaxbProjectConfig(); - config.setProject(project); - config.setPlatformDefinition(JptJaxbCorePlugin.getJaxbPlatformManager().buildJaxbPlatformDefinition(project)); - return config; - } - - /* private */ void removeJaxbProject(JaxbProject jaxbProject) { - // figure out exactly when JAXB projects are removed - dumpStackTrace("remove: ", jaxbProject); //$NON-NLS-1$ - this.removeItemFromCollection(jaxbProject, this.jaxbProjects, JAXB_PROJECTS_COLLECTION); - jaxbProject.dispose(); - } - - - // ********** Project POST_CHANGE ********** - - /* private */ void projectChanged(IResourceDelta delta) { - this.eventHandler.execute(this.buildProjectChangedCommand(delta)); - } - - private Command buildProjectChangedCommand(final IResourceDelta delta) { - return new EventHandlerCommand("Project POST_CHANGE Command") { //$NON-NLS-1$ - @Override - void execute_() { - GenericJaxbProjectManager.this.projectChanged_(delta); - } - }; - } - - /** - * Forward the specified resource delta to all our JAXB projects; - * they will each determine whether the event is significant. - */ - /* private */ void projectChanged_(IResourceDelta delta) { - for (JaxbProject jaxbProject : this.jaxbProjects) { - jaxbProject.projectChanged(delta); - } - } - - - // ********** Project POST_BUILD (CLEAN_BUILD) ********** - - /* private */ void projectPostCleanBuild(IProject project) { - this.executeAfterEventsHandled(this.buildProjectPostCleanBuildCommand(project)); - } - - private Command buildProjectPostCleanBuildCommand(final IProject project) { - return new EventHandlerCommand("Project POST_BUILD (CLEAN_BUILD) Command") { //$NON-NLS-1$ - @Override - void execute_() { - GenericJaxbProjectManager.this.projectPostCleanBuild_(project); - } - }; - } - - /* private */ void projectPostCleanBuild_(IProject project) { - JaxbProject jaxbProject = this.getJaxbProject_(project); - if (jaxbProject != null) { - this.removeJaxbProject(jaxbProject); - this.addJaxbProject(project); - } - } - - - // ********** File POST_CHANGE ********** - - /** - * The Faceted Project settings file has changed in some fashion, check - * whether the JAXB facet has been added to or removed from the specified - * project. - */ - /* private */ void checkForJaxbFacetTransition(IProject project) { - JaxbProject jaxbProject = this.getJaxbProject_(project); - - if (JaxbFacet.isInstalled(project)) { - if (jaxbProject == null) { // JAXB facet added - this.executeAfterEventsHandled(this.buildAddJaxbProjectCommand(project)); - } - } else { - if (jaxbProject != null) { // JAXB facet removed - this.executeAfterEventsHandled(this.buildRemoveJaxbProjectCommand(jaxbProject)); - } - } - } - - private Command buildAddJaxbProjectCommand(final IProject project) { - return new EventHandlerCommand("Add JAXB Project Command") { //$NON-NLS-1$ - @Override - void execute_() { - GenericJaxbProjectManager.this.addJaxbProject(project); - } - }; - } - - private Command buildRemoveJaxbProjectCommand(final JaxbProject jaxbProject) { - return new EventHandlerCommand("Remove JAXB Project Command") { //$NON-NLS-1$ - @Override - void execute_() { - GenericJaxbProjectManager.this.removeJaxbProject(jaxbProject); - } - }; - } - - // ********** FacetedProject PRE_UNINSTALL ********** - - /* private */ void jaxbFacetedProjectPreUninstall(IProjectFacetActionEvent event) { - IProject project = event.getProject().getProject(); - this.executeAfterEventsHandled(this.buildJaxbFacetedProjectPreUninstallCommand(project)); - } - - private Command buildJaxbFacetedProjectPreUninstallCommand(final IProject project) { - return new EventHandlerCommand("Faceted Project PRE_UNINSTALL Command") { //$NON-NLS-1$ - @Override - void execute_() { - GenericJaxbProjectManager.this.jaxbFacetedProjectPreUninstall_(project); - } - }; - } - - /* private */ void jaxbFacetedProjectPreUninstall_(IProject project) { - // assume(?) this is the first event to indicate we need to remove the JAXB project from the JAXB project manager - this.removeJaxbProject(this.getJaxbProject_(project)); - } - - - // ********** Java element changed ********** - - /* private */ void javaElementChanged(ElementChangedEvent event) { - this.eventHandler.execute(this.buildJavaElementChangedCommand(event)); - } - - private Command buildJavaElementChangedCommand(final ElementChangedEvent event) { - return new EventHandlerCommand("Java element changed Command") { //$NON-NLS-1$ - @Override - void execute_() { - GenericJaxbProjectManager.this.javaElementChanged_(event); - } - }; - } - - /** - * Forward the Java element changed event to all the JAXB projects - * because the event could affect multiple projects. - */ - /* private */ void javaElementChanged_(ElementChangedEvent event) { - for (JaxbProject jaxbProject : this.jaxbProjects) { - jaxbProject.javaElementChanged(event); - } - } - - - // ********** miscellaneous ********** - - @Override - public void toString(StringBuilder sb) { - sb.append(this.jaxbProjects); - } - - - // ********** event handler ********** - - /** - * If the event handler is executing asynchronously:
- * Allow all the commands currently on the command executor's queue to execute. - * Once they have executed, suspend the command executor and process the - * specified command (on this thread, not the command - * executor thread). Once the specified command is finished, allow the - * command executor to resume processing its command queue. - *

- * If the event handler is executing synchronously:
- * All the events have already been handled synchronously, so we simply - * execute the specified command [sorta] directly. - */ - private void executeAfterEventsHandled(Command command) { - SynchronizedBoolean flag = new SynchronizedBoolean(false); - this.eventHandler.execute(new PauseCommand(flag)); - try { - flag.waitUntilTrue(); - } catch (InterruptedException ex) { - // ignore - not sure why this thread would be interrupted - } - try { - command.execute(); - } finally { - flag.setFalse(); - } - } - - /** - * If this "pause" command is executing (asynchronously) on a different - * thread than the JAXB project manager:

    - *
  1. it will set the flag to true, allowing the JAXB project - * manager to resume executing on its own thread - *
  2. then it will suspend its command executor until the JAXB project - * manager sets the flag back to false. - *
- * If this "pause" command is executing (synchronously) on the same thread - * as the JAXB project manager, it will simply set the flag to - * true and return. - */ - private static class PauseCommand - implements Command - { - private final Thread producerThread; - private final SynchronizedBoolean flag; - - PauseCommand(SynchronizedBoolean flag) { - this(Thread.currentThread(), flag); - } - - PauseCommand(Thread producerThread, SynchronizedBoolean flag) { - super(); - this.producerThread = producerThread; - this.flag = flag; - } - - public void execute() { - this.flag.setTrue(); - if (Thread.currentThread() != this.producerThread) { - try { - this.flag.waitUntilFalse(); - } catch (InterruptedException ex) { - // ignore - the command executor will check for interruptions - } - } - } - } - - /** - * This method is called (via reflection) when the test plug-in is loaded. - * @see JptCoreTestsPlugin#start(BundleContext) - */ - public void handleEventsSynchronously() { - try { - this.lock.acquire(); - this.handleEventsSynchronously_(); - } finally { - this.lock.release(); - } - } - - private void handleEventsSynchronously_() { - this.eventHandler.stop(); - this.eventHandler = new SimpleCommandExecutor(); - this.eventHandler.start(); - } - - - // ********** resource proxy visitor ********** - - /** - * Visit the workspace resource tree, adding a JAXB project to the - * JAXB project manager for each open Eclipse project that has a JAXB facet. - */ - private class ResourceProxyVisitor implements IResourceProxyVisitor { - ResourceProxyVisitor() { - super(); - } - - public boolean visit(IResourceProxy resourceProxy) { - switch (resourceProxy.getType()) { - case IResource.ROOT : - return true; // all projects are in the "root" - case IResource.PROJECT : - this.processProject(resourceProxy); - return false; // no nested projects - case IResource.FOLDER : - return false; // ignore - case IResource.FILE : - return false; // ignore - default : - return false; - } - } - - private void processProject(IResourceProxy resourceProxy) { - if (resourceProxy.isAccessible()) { // the project exists and is open - IProject project = (IProject) resourceProxy.requestResource(); - if (JaxbFacet.isInstalled(project)) { - GenericJaxbProjectManager.this.addJaxbProject(project); - } - } - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - - } - - - // ********** event handler command ********** - - /** - * Command that holds the JAXB project manager lock while - * executing. - */ - private abstract class EventHandlerCommand - implements Command - { - private final String name; - - EventHandlerCommand(String name) { - super(); - this.name = name; - } - - public final void execute() { - try { - GenericJaxbProjectManager.this.lock.acquire(); - this.execute_(); - } catch (RuntimeException ex) { - JptJaxbCorePlugin.log(ex); - } finally { - GenericJaxbProjectManager.this.lock.release(); - } - } - - abstract void execute_(); - - @Override - public String toString() { - return this.name; - } - } - - - // ********** resource change listener ********** - - private class ResourceChangeListener implements IResourceChangeListener { - - ResourceChangeListener() { - super(); - } - - /** - * PRE_UNINSTALL is the only facet event we use for - * removing JAXB projects. These are the cases where we listen for resource events. - *

- * Check for:

    - *
  • facet settings file added/removed/changed - * (/.settings/org.eclipse.wst.common.project.facet.core.xml) - *
  • file add/remove - forwarded to the individual JAXB projects - *
  • project clean - *
- */ - public void resourceChanged(IResourceChangeEvent event) { - switch (event.getType()) { - case IResourceChangeEvent.POST_CHANGE : - this.processPostChangeEvent(event); - break; - - // workspace or project events - case IResourceChangeEvent.PRE_REFRESH : - break; // ignore - case IResourceChangeEvent.PRE_BUILD : - break; // ignore - case IResourceChangeEvent.POST_BUILD : - this.processPostBuildEvent(event); - break; - - // project-only events - case IResourceChangeEvent.PRE_CLOSE : - break; // ignore - case IResourceChangeEvent.PRE_DELETE : - break; // ignore - default : - break; - } - } - - private void processPostChangeEvent(IResourceChangeEvent event) { - debug("Resource POST_CHANGE"); //$NON-NLS-1$ - this.processPostChangeDelta(event.getDelta()); - } - - private void processPostChangeDelta(IResourceDelta delta) { - IResource resource = delta.getResource(); - switch (resource.getType()) { - case IResource.ROOT : - this.processPostChangeRootDelta(delta); - break; - case IResource.PROJECT : - this.processPostChangeProjectDelta(delta); - break; - case IResource.FOLDER : - this.processPostChangeFolderDelta((IFolder) resource, delta); - break; - case IResource.FILE : - this.processPostChangeFileDelta((IFile) resource, delta); - break; - default : - break; - } - } - - // ***** POST_CHANGE ROOT - private void processPostChangeRootDelta(IResourceDelta delta) { - this.processPostChangeDeltaChildren(delta); - } - - // ***** POST_CHANGE PROJECT - /** - * Process the project first for the Opening project case. - * The JAXB project will not be built until the children are processed - * and we see that the facet metadata file is added. - * Otherwise the JAXB project would be built and then we would process - * the ADDED deltas for all the files in the project. - */ - private void processPostChangeProjectDelta(IResourceDelta delta) { - GenericJaxbProjectManager.this.projectChanged(delta); - this.processPostChangeDeltaChildren(delta); - } - - // ***** POST_CHANGE FOLDER - private void processPostChangeFolderDelta(IFolder folder, IResourceDelta delta) { - if (folder.getName().equals(".settings")) { //$NON-NLS-1$ - this.processPostChangeDeltaChildren(delta); - } - } - - // ***** POST_CHANGE FILE - private void processPostChangeFileDelta(IFile file, IResourceDelta delta) { - if (file.getName().equals(FACETED_PROJECT_FRAMEWORK_SETTINGS_FILE_NAME)) { - this.checkForFacetFileChanges(file, delta); - } - } - - private void checkForFacetFileChanges(IFile file, IResourceDelta delta) { - switch (delta.getKind()) { - case IResourceDelta.ADDED : - case IResourceDelta.REMOVED : - case IResourceDelta.CHANGED : - GenericJaxbProjectManager.this.checkForJaxbFacetTransition(file.getProject()); - break; - case IResourceDelta.ADDED_PHANTOM : - break; // ignore - case IResourceDelta.REMOVED_PHANTOM : - break; // ignore - default : - break; - } - } - - private void processPostChangeDeltaChildren(IResourceDelta delta) { - for (IResourceDelta child : delta.getAffectedChildren()) { - this.processPostChangeDelta(child); // recurse - } - } - - /** - * A post build event has occurred. - * Check for whether the build was a "clean" build and trigger project update. - */ - // ***** POST_BUILD - private void processPostBuildEvent(IResourceChangeEvent event) { - debug("Resource POST_BUILD: ", event.getResource()); //$NON-NLS-1$ - if (event.getBuildKind() == IncrementalProjectBuilder.CLEAN_BUILD) { - this.processPostCleanBuildDelta(event.getDelta()); - } - } - - private void processPostCleanBuildDelta(IResourceDelta delta) { - IResource resource = delta.getResource(); - switch (resource.getType()) { - case IResource.ROOT : - this.processPostCleanBuildDeltaChildren(delta); - break; - case IResource.PROJECT : - this.processProjectPostCleanBuild((IProject) resource); - break; - case IResource.FOLDER : - break; // ignore - case IResource.FILE : - break; // ignore - default : - break; - } - } - - private void processPostCleanBuildDeltaChildren(IResourceDelta delta) { - for (IResourceDelta child : delta.getAffectedChildren()) { - this.processPostCleanBuildDelta(child); // recurse - } - } - - private void processProjectPostCleanBuild(IProject project) { - debug("\tProject CLEAN: ", project.getName()); //$NON-NLS-1$ - GenericJaxbProjectManager.this.projectPostCleanBuild(project); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - - } - - - // ********** faceted project listener ********** - - /** - * Forward the Faceted project change event back to the JAXB project manager. - */ - private class FacetedProjectListener implements IFacetedProjectListener { - - FacetedProjectListener() { - super(); - } - - /** - * Check for:
    - *
  • un-install of JAXB facet - *
- */ - public void handleEvent(IFacetedProjectEvent event) { - switch (event.getType()) { - case PRE_UNINSTALL : - this.processPreUninstallEvent((IProjectFacetActionEvent) event); - break; - default : - break; - } - } - - private void processPreUninstallEvent(IProjectFacetActionEvent event) { - debug("Facet PRE_UNINSTALL: ", event.getProjectFacet()); //$NON-NLS-1$ - if (event.getProjectFacet().equals(JaxbFacet.FACET)) { - GenericJaxbProjectManager.this.jaxbFacetedProjectPreUninstall(event); - } - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - - } - - - // ********** Java element change listener ********** - - /** - * Forward the Java element change event back to the JAXB project manager. - */ - private class JavaElementChangeListener implements IElementChangedListener { - /** - * A flag to activate/deactivate the listener - * so we can ignore Java events whenever Dali is manipulating the Java - * source code via the Dali model. We do this because the 0.5 sec delay - * between the Java source being changed and the corresponding event - * being fired causes us no end of pain. - */ - private volatile boolean active = true; - - JavaElementChangeListener() { - super(); - } - - public void elementChanged(ElementChangedEvent event) { - if (this.active) { - GenericJaxbProjectManager.this.javaElementChanged(event); - } - } - - void setActive(boolean active) { - this.active = active; - } - - boolean isActive() { - return this.active; - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - - } - - - // ********** DEBUG ********** - - // @see JaxbProjectManagerTests#testDEBUG() - private static final boolean DEBUG = false; - - /** - * trigger #toString() call and string concatenation only if DEBUG is true - */ - /* private */ static void debug(String message, Object object) { - if (DEBUG) { - debug_(message + object); - } - } - - /* private */ static void debug(String message) { - if (DEBUG) { - debug_(message); - } - } - - private static void debug_(String message) { - System.out.println(Thread.currentThread().getName() + ": " + message); //$NON-NLS-1$ - } - - /* private */ static void dumpStackTrace() { - dumpStackTrace(null); - } - - /* private */ static void dumpStackTrace(String message, Object object) { - if (DEBUG) { - dumpStackTrace_(message + object); - } - } - - /* private */ static void dumpStackTrace(String message) { - if (DEBUG) { - dumpStackTrace_(message); - } - } - - private static void dumpStackTrace_(String message) { - // lock System.out so the stack elements are printed out contiguously - synchronized (System.out) { - if (message != null) { - debug_(message); - } - StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); - // skip the first 3 elements - those are this method and 2 methods in Thread - for (int i = 3; i < stackTrace.length; i++) { - StackTraceElement element = stackTrace[i]; - if (element.getMethodName().equals("invoke0")) { //$NON-NLS-1$ - break; // skip all elements outside of the JUnit test - } - System.out.println("\t" + element); //$NON-NLS-1$ - } - } - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFacet.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFacet.java deleted file mode 100644 index 1f647ca770..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFacet.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -/** - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public class JaxbFacet { - - public static final String ID = "jpt.jaxb"; //$NON-NLS-1$ - - public static final IProjectFacet FACET = ProjectFacetsManager.getProjectFacet(ID); - - public static final IProjectFacetVersion VERSION_2_1 = FACET.getVersion("2.1"); //$NON-NLS-1$ - - public static final IProjectFacetVersion VERSION_2_2 = FACET.getVersion("2.2"); //$NON-NLS-1$ - - - public static boolean isInstalled(final IProject project) { - try { - return FacetedProjectFramework.hasProjectFacet(project, ID); - } - catch (CoreException e) { - JptJaxbCorePlugin.log(e); - return false; - } - } - - - /** - * Not for instantiation - */ - private JaxbFacet() {} -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFactory.java deleted file mode 100644 index e2619664ec..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFactory.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceModel; -import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbElementFactoryMethod; -import org.eclipse.jpt.jaxb.core.context.JaxbEnumConstant; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentField; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentProperty; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentType; -import org.eclipse.jpt.jaxb.core.context.JaxbRegistry; -import org.eclipse.jpt.jaxb.core.context.XmlAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.XmlElementMapping; -import org.eclipse.jpt.jaxb.core.context.XmlNs; -import org.eclipse.jpt.jaxb.core.context.XmlRootElement; -import org.eclipse.jpt.jaxb.core.context.XmlSchema; -import org.eclipse.jpt.jaxb.core.context.XmlValueMapping; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; - -/** - * Use a JAXB factory to build any core (e.g. {@link JaxbProject}) - * model object or any Java (e.g. {@link JavaEntity}), ORM (e.g. - * {@link EntityMappings}), or persistence (e.g. {@link PersistenceUnit}) - * context model objects. - *

- * Assumes a base JAXB project context structure - * corresponding to the JAXB spec: - *

- *     RootContext
- *      |- persistence.xml
- *          |- persistence unit(s)
- *               |- mapping file(s)  (e.g. orm.xml)
- *               |   |- persistent type mapping(s)  (e.g. Entity)
- *               |       |- persistent attribute mapping(s)  (e.g. Basic)
- *               |- persistent type mapping(s)
- * 
- * ... and associated objects. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see org.eclipse.jpt.jaxb.core.internal.jaxb21.GenericJaxb_2_1_Factory - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbFactory { - - // ********** Core Model ********** - - /** - * Construct a JaxbProject for the specified config, to be - * added to the specified JAXB project. Return null if unable to create - * the JAXB file (e.g. the content type is unrecognized). - */ - JaxbProject buildJaxbProject(JaxbProject.Config config); - - /** - * Construct a JAXB file for the specified JAXB project, file, content type, - * and resource model. - */ - JaxbFile buildJaxbFile(JaxbProject jaxbProject, IFile file, IContentType contentType, JptResourceModel resourceModel); - - - // ********** Non-resource-specific context nodes ********** - - /** - * Build a (/an updated) root context node to be associated with the given - * JAXB project. - * The root context node will be built once, but updated many times. - * @see JaxbProject#update(org.eclipse.core.runtime.IProgressMonitor) - */ - JaxbContextRoot buildContextRoot(JaxbProject jaxbProject); - - JaxbPackage buildPackage(JaxbContextRoot parent, String packageName); - - - // ********** Java context nodes ********** - - JaxbPackageInfo buildJavaPackageInfo(JaxbPackage parent, JavaResourcePackage resourcePackage); - - JaxbRegistry buildRegistry(JaxbContextRoot parent, JavaResourceType resourceType); - - JaxbPersistentClass buildJavaPersistentClass(JaxbContextRoot parent, JavaResourceType resourceType); - - JaxbPersistentEnum buildJavaPersistentEnum(JaxbContextRoot parent, JavaResourceEnum resourceEnum); - - XmlSchema buildJavaXmlSchema(JaxbPackageInfo parent); - - XmlNs buildJavaXmlNs(XmlSchema parent, XmlNsAnnotation xmlNsAnnotation); - - XmlRootElement buildJavaXmlRootElement(JaxbPersistentType parent, XmlRootElementAnnotation xmlRootElementAnnotation); - - JaxbEnumConstant buildJavaEnumConstant(JaxbPersistentEnum parent, JavaResourceEnumConstant resourceEnumConstant); - - JaxbElementFactoryMethod buildJavaElementFactoryMethod(JaxbRegistry parent, JavaResourceMethod resourceMethod); - - JaxbPersistentField buildJavaPersistentField(JaxbPersistentClass parent, JavaResourceField resourceField); - - JaxbPersistentProperty buildJavaPersistentProperty(JaxbPersistentClass parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter); - - JaxbAttributeMapping buildJavaNullAttributeMapping(JaxbPersistentAttribute parent); - - XmlAttributeMapping buildJavaXmlAttributeMapping(JaxbPersistentAttribute parent); - - XmlElementMapping buildJavaXmlElementMapping(JaxbPersistentAttribute parent); - - JaxbAttributeMapping buildJavaXmlTransientMapping(JaxbPersistentAttribute parent); - - XmlValueMapping buildJavaXmlValueMapping(JaxbPersistentAttribute parent); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFile.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFile.java deleted file mode 100644 index a3e133a33d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbFile.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceModel; - -/** - * A JAXB Project contains JAXB files for all files in the project that - * are relevant to the JAXB spec. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbFile - extends JaxbNode -{ - /** - * Return the JAXB file's Eclipse file. - */ - IFile getFile(); - - /**JAXB - * Return the JPA file's content type. - */ - IContentType getContentType(); - - /** - * Return the resource model corresponding to the JPA file; typically a JPA - * compilation unit, a JPA XML resource, or a JPA package fragment root (JAR). - */ - JptResourceModel getResourceModel(); - - /** - * Convenience method. Return the resource model corresponding to the JPA - * file if the file's content is a "kind-of" the specified content type; - * otherwise, return null. This is useful when a client has looked up the - * JPA file via a file name [and assumed content type]. - * @see #getResourceModel() - */ - JptResourceModel getResourceModel(IContentType contentType); - - - // ********** root structure nodes ********** - -// /** -// * Return the JPA file's root structure nodes. -// */ -// Iterator rootStructureNodes(); -// String ROOT_STRUCTURE_NODES_COLLECTION = "rootStructureNodes"; //$NON-NLS-1$ -// -// /** -// * Return the count of the JPA file's root context model objects. -// */ -// int rootStructureNodesSize(); -// -// /** -// * Add a root structure node. -// * There is the potential for multiple root structure nodes -// * for a particular key. For example, a Java file that is listed -// * both as a in the persistence.xml and as an in -// * an orm.xml file. In this case the orm.xml file needs to set -// * the root structure node after the Java class reference. -// * Last one in during project "update" wins. -// */ -// void addRootStructureNode(Object key, JpaStructureNode rootStructureNode); -// -// /** -// * @see #addRootStructureNode(Object, JpaStructureNode) -// */ -// void removeRootStructureNode(Object key); -// -// /** -// * Return the structure node best corresponding to the location in the file. -// */ -// JpaStructureNode getStructureNode(int textOffset); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbNode.java deleted file mode 100644 index a4eb6c5099..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbNode.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jpt.common.core.IResourcePart; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * JAXB-specific protocol. All JAXB objects belong to a JAXB project, are - * associated with a resource, and have a parent (excepting the JAXB project). - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbNode - extends Model, IAdaptable, IResourcePart -{ - /** - * Return the JAXB project the node belongs to. - */ - JaxbProject getJaxbProject(); - - /** - * Return the JAXB node's parent. The JAXB project will not have a parent. - */ - JaxbNode getParent(); - - void stateChanged(); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbProject.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbProject.java deleted file mode 100644 index 6c852f2e65..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbProject.java +++ /dev/null @@ -1,378 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jdt.core.ElementChangedEvent; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.synchronizers.CallbackSynchronizer; -import org.eclipse.jpt.common.utility.synchronizers.Synchronizer; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatform; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * A JAXB project is associated with an Eclipse project (and its corresponding - * Java project). It holds the "resource" model that corresponds to the various - * JPA-related resources (the persistence.xml file, its mapping files - * [orm.xml], - * and the Java source files). It also holds the "context" model that represents - * the JPA metadata, as derived from spec-defined defaults, Java source code - * annotations, and XML descriptors. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbProject - extends JaxbNode -{ - - // ********** general ********** - - /** - * Return the JAXB project's name, which is the same as the associated - * Eclipse project's name. - */ - String getName(); - - /** - * Return the Eclipse project associated with the JAXB project. - */ - IProject getProject(); - - /** - * Return the Java project associated with the JAXB project. - */ - IJavaProject getJavaProject(); - - /** - * Return the vendor-specific JAXB platform that builds the JAXB project - * and its contents. - */ - JaxbPlatform getPlatform(); - - /** - * Return the schema library used for validating and user assist - */ - SchemaLibrary getSchemaLibrary(); - - /** - * The JAXB project has been removed from the JJAXBPA model. Clean up any - * hooks to external resources etc. - */ - void dispose(); - - - // ********** JAXB files ********** - - /** - * ID string used when the JAXB project's collection of JAXB files changes. - * @see #addCollectionChangeListener(String, org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener) - */ - String JAXB_FILES_COLLECTION = "jaxbFiles"; //$NON-NLS-1$ - - /** - * Return the JAXB project's JAXB files. - */ - Iterable getJaxbFiles(); - - /** - * Return the size of the JAXB project's JAXB files. - */ - int getJaxbFilesSize(); - - /** - * Return the JAXB file corresponding to the specified file. - * Return null if there is no JAXB file associated with the specified file. - */ - JaxbFile getJaxbFile(IFile file); - - -// // ********** external Java resource compilation units ********** -// -// /** -// * ID string used when the JPA project's collection of external Java -// * resource compilation units changes. -// * @see #addCollectionChangeListener(String, org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener) -// */ -// String EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION = "externalJavaResourceCompilationUnits"; //$NON-NLS-1$ -// -// /** -// * Return the JPA project's external Java resource compilation units. -// */ -// Iterator externalJavaResourceCompilationUnits(); -// -// /** -// * Return the size of the JPA project's external Java resource compilation units. -// */ -// int externalJavaResourceCompilationUnitsSize(); -// -// -// // ********** external Java resource persistent types ********** -// -// /** -// * Return the JPA project's external Java resource persistent type cache. -// */ -// JavaResourcePersistentTypeCache getExternalJavaResourcePersistentTypeCache(); -// - - // ********** Java resources ********** - - /** - * Return the Java resource packages for the project. - * Return null if invalid or absent. These correspond to package-info.java files - */ - Iterable getJavaResourcePackages(); - - /** - * Return the Java resource package for the specified package. - * Return null if invalid or absent. - */ - JavaResourcePackage getJavaResourcePackage(String packageName); - - /** - * Return the java resource packages that are annotated with - * 1 or more valid JAXB package annotations - */ - Iterable getAnnotatedJavaResourcePackages(); - - /** - * Return the java resource package for the specified package if and only if it has - * recognized annotations. - * Return null otherwise. - */ - JavaResourcePackage getAnnotatedJavaResourcePackage(String packageName); - -// /** -// * Return the Java resource package fragement root for the specified JAR. -// * Return null if absent. -// */ -// JavaResourcePackageFragmentRoot getJavaResourcePackageFragmentRoot(String jarFileName); - - /** - * Return all {@link JavaResourceType}s that are represented by java source within this project - */ - Iterable getJavaSourceResourceTypes(); - - /** - * Return all {@link JavaResourceType}s that are represented by java source within this project, - * that are also annotated with a recognized annotation (and are persistable) - */ - Iterable getAnnotatedJavaSourceResourceTypes(); - -// /** -// * Return the names of the JAXB project's annotated Java classes -// */ -// Iterable getAnnotatedJavaSourceClassNames(); - - /** - * Return the Java resource type with the specified type name. - * Return null if invalid or absent. - */ - JavaResourceType getJavaResourceType(String typeName); - - /** - * Return all {@link JavaResourceEnum}s that are represented by java source within this project - */ - Iterable getJavaSourceResourceEnums(); - - /** - * Return the Java resource enum with the specified enum name. - * Return null if invalid or absent. - */ - JavaResourceEnum getJavaResourceEnum(String enumName); - - - // **************** context model ***************************************** - - /** - * Return the root of the JAXB project's context model. - */ - JaxbContextRoot getContextRoot(); - - /** - * Return all types/package infos that are primary context objects for the - * given compilation unit - */ - Iterable getPrimaryJavaNodes(ICompilationUnit cu); - - - // ********** model synchronization ********** - - /** - * Synchronize the JPA project with the specified project resource - * delta, watching for added and removed files in particular. - */ - void projectChanged(IResourceDelta delta); - - /** - * Synchronize the JPA project with the specified Java change. - */ - void javaElementChanged(ElementChangedEvent event); - - - - // ********** synchronize context model with resource model ********** - - /** - * Return the synchronizer that will synchronize the context model with - * the resource model whenever the resource model changes. - */ - Synchronizer getContextModelSynchronizer(); - - /** - * Set the synchronizer that will keep the context model synchronized with - * the resource model whenever the resource model changes. - * Before setting the synchronizer, clients should save the current - * synchronizer so it can be restored later. - * - * @see #getContextModelSynchronizer() - */ - void setContextModelSynchronizer(Synchronizer synchronizer); - - /** - * The JAXB project's resource model has changed; synchronize the JPA - * project's context model with it. This method is typically called when the - * resource model state has changed when it is synchronized with its - * underlying Eclipse resource as the result of an Eclipse resource change - * event. This method can also be called when a client (e.g. a JUnit test - * case) has manipulated the resource model via its API (as opposed to - * modifying the underlying Eclipse resource directly) and needs the context - * model to be synchronized accordingly (since manipulating the resource - * model via its API will not trigger this method). Whether the context - * model is synchronously (or asynchronously) depends on the current context - * model synchronizer. - * - * @see #synchronizeContextModelAndWait() - */ - void synchronizeContextModel(); - - /** - * Force the JAXB project's context model to synchronize with it resource - * model synchronously. - * - * @see #synchronizeContextModel() - * @see #updateAndWait() - */ - void synchronizeContextModelAndWait(); - - /** - * This is the callback used by the context model synchronizer to perform - * the actual "synchronize". - */ - IStatus synchronizeContextModel(IProgressMonitor monitor); - - // ********** project "update" ********** - - /** - * Return the synchronizer that will update the context model whenever - * it has any changes. This allows any intra-JAXB project dependencies to - * be updated. - */ - CallbackSynchronizer getUpdateSynchronizer(); - - /** - * Set the synchronizer that will update the context model whenever - * it has any changes. This allows any intra-JAXB project dependencies to - * be updated. - * Before setting the update synchronizer, clients should save the current - * synchronizer so it can be restored later. - * - * @see #getUpdateSynchronizer() - */ - void setUpdateSynchronizer(CallbackSynchronizer synchronizer); - - /** - * Force the JAXB project to "update" synchronously. - * - * @see #synchronizeContextModelAndWait() - */ - void updateAndWait(); - - /** - * This is the callback used by the update synchronizer to perform the - * actual "update". - */ - IStatus update(IProgressMonitor monitor); - - - - -// // ********** utility ********** -// -// /** -// * Return an {@link IFile} that best represents the given runtime location -// */ -// IFile getPlatformFile(IPath runtimePath); - - - // ********** validation ********** - - /** - * Return project's validation messages. - */ - Iterable validationMessages(IReporter reporter); - - - // ********** modifying shared documents ********** - - /** - * Set a thread-specific implementation of the {@link CommandExecutor} - * interface that will be used to execute a command to modify a shared - * document. If necessary, the command executor can be cleared by - * setting it to null. - * This allows background clients to modify documents that are - * already present in the UI. See implementations of {@link CommandExecutor}. - */ - void setThreadLocalModifySharedDocumentCommandExecutor(CommandExecutor commandExecutor); - - /** - * Return the project-wide implementation of the - * {@link CommandExecutor} interface. - */ - CommandExecutor getModifySharedDocumentCommandExecutor(); - - - // ********** construction config ********** - - /** - * The settings used to construct a JAXB project. - */ - interface Config { - - /** - * Return the Eclipse project to be associated with the new JAXB project. - */ - IProject getProject(); - - /** - * Return the JAXB platform definition to be associated with the new JAXB project. - */ - JaxbPlatformDefinition getPlatformDefinition(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbProjectManager.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbProjectManager.java deleted file mode 100644 index 68258577ae..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbProjectManager.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.jpt.common.utility.model.Model; - - -/** - * The JAXB project manager holds all the JAXB projects in the workspace. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbProjectManager - extends Model { - - /** - * Return the JAXB model's JAXB projects. - */ - Iterable getJaxbProjects(); - public static final String JAXB_PROJECTS_COLLECTION = "jaxbProjects"; //$NON-NLS-1$ - - /** - * Return the size of the JAXB model's list of JAXB projects. - */ - int getJaxbProjectsSize(); - - /** - * Return the JAXB project corresponding to the specified Eclipse project. - * Return null if unable to associate the specified Eclipse project - * with a JAXB project. - */ - JaxbProject getJaxbProject(IProject project); - - /** - * Return the JAXB file corresponding to the specified Eclipse file, - * or null if unable to associate the specified file with a JAXB file. - */ - JaxbFile getJaxbFile(IFile file); - - /** - * The JAXB settings associated with the specified Eclipse project - * have changed in such a way as to require the associated - * JPA project to be completely rebuilt - * (e.g. when the user changes a project's JAXB platform). - */ - void rebuildJaxbProject(IProject project); - - /** - * Return whether the model's Java change listener is active. - */ - boolean javaElementChangeListenerIsActive(); - - /** - * Set whether the model's Java change listener is active. - */ - void setJavaElementChangeListenerIsActive(boolean javaElementChangeListenerIsActive); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbResourceModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbResourceModelProvider.java deleted file mode 100644 index 5a7c5eab5e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JaxbResourceModelProvider.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceModel; - -/** - * Map a content type to a JAXB resource model. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbResourceModelProvider -{ - /** - * Return the file content type the provider is for. - */ - IContentType getContentType(); - - /** - * Build a JAXB resource model for the specified JAXB project and file. - * Use the specified factory for creation so extenders can simply override - * the appropriate creation method instead of building a provider for the - * same content. - */ - JptResourceModel buildResourceModel(JaxbProject jaxbProject, IFile file); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java deleted file mode 100644 index acba0d5a92..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/JptJaxbCorePlugin.java +++ /dev/null @@ -1,464 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.core.runtime.preferences.DefaultScope; -import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.eclipse.core.runtime.preferences.IScopeContext; -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.jpt.jaxb.core.internal.JptJaxbCoreMessages; -import org.eclipse.jpt.jaxb.core.internal.platform.JaxbPlatformManagerImpl; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformManager; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.osgi.framework.BundleContext; -import org.osgi.service.prefs.BackingStoreException; -import org.osgi.service.prefs.Preferences; - -/** - * The Dali JAXB core plug-in lifecycle implementation. - * A number of globally-available constants and methods. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public class JptJaxbCorePlugin - extends Plugin { - - private static volatile boolean flushPreferences = true; - - /** - * The plug-in identifier of Dali JAXB core - * (value "org.eclipse.jpt.jaxb.core"). - */ - public static final String PLUGIN_ID = "org.eclipse.jpt.jaxb.core"; //$NON-NLS-1$ - public static final String PLUGIN_ID_ = PLUGIN_ID + '.'; - - /** - * The node for storing a JAXB project's platform in the project's preferences. - */ - public static final String PLATFORM_PREF_NODE = "platform"; //$NON-NLS-1$ - - /** - * The key for storing the platform id - */ - public static final String PLATFORM_ID_PREF_KEY = "platform-id"; //$NON-NLS-1$ - - /** - * The node for storing a JAXB project's schemas in the project's preferences. - */ - public static final String SCHEMAS_PREF_NODE = "schemas"; //$NON-NLS-1$ - - /** - * The node prefix for storing a particular JAXB project schema in the project's preferences. - * Specific schema nodes are followed by integers ("schema-1", "schema-2", etc.) - */ - public static final String SCHEMA_PREF_NODE_PREFIX = "schema-"; //$NON-NLS-1$ - - /** - * The key for storing a schema namespace in the project's preferences - */ - public static final String SCHEMA_NAMESPACE_PREF_KEY = "namespace"; //$NON-NLS-1$ - - /** - * The key for storing a schema location (such as a uri or catalog key) in the project's preferences - */ - public static final String SCHEMA_LOCATION_PREF_KEY = "location"; //$NON-NLS-1$ - - /** - * The key for storing the default JAXB platform ID for JAXB 2.1 in the workspace preferences. - */ - public static final String DEFAULT_JAXB_PLATFORM_2_1_PREF_KEY = - "defaultJaxbPlatform_" + JaxbFacet.VERSION_2_1.getVersionString(); //$NON-NLS-1$ - - /** - * The key for storing the default JAXB platform ID for JAXB 2.2 in the workspace preferences. - */ - public static final String DEFAULT_JAXB_PLATFORM_2_2_PREF_KEY = - "defaultJaxbPlatform_" + JaxbFacet.VERSION_2_2.getVersionString(); //$NON-NLS-1$ - - /** - * The identifier for the JAXB validation marker - * (value "org.eclipse.jpt.jaxb.core.jaxbProblemMarker"). - */ - public static final String VALIDATION_MARKER_ID = PLUGIN_ID + ".jaxbProblemMarker"; //$NON-NLS-1$ - - - - // **************** fields ************************************************ - - private volatile GenericJaxbProjectManager projectManager; - - - // **************** singleton ********************************************* - - private static JptJaxbCorePlugin INSTANCE; - - /** - * Return the singleton plug-in - */ - public static JptJaxbCorePlugin instance() { - return INSTANCE; - } - - - // ********** public static methods ********** - - /** - * Return the singular JAXB project manager corresponding to the current workspace. - */ - public static JaxbProjectManager getProjectManager() { - return INSTANCE.getProjectManager_(); - } - - /** - * Return the JAXB project corresponding to the specified Eclipse project, - * or null if unable to associate the specified project with a - * JAXB project. - */ - public static JaxbProject getJaxbProject(IProject project) { - return getProjectManager().getJaxbProject(project); - } - - public static JaxbPlatformManager getJaxbPlatformManager() { - return JaxbPlatformManagerImpl.instance(); - } - - /** - * Return the default Dali preferences - * @see JpaPreferenceInitializer - */ - public static IEclipsePreferences getDefaultPreferences() { - return getPreferences(new DefaultScope()); - } - - /** - * Return the Dali preferences for the current workspace instance. - */ - public static IEclipsePreferences getWorkspacePreferences() { - return getPreferences(new InstanceScope()); - } - - /** - * Return the Dali preferences for the specified context. - */ - private static IEclipsePreferences getPreferences(IScopeContext context) { - return context.getNode(PLUGIN_ID); - } - - /** - * Set the workspace preference. - */ - public static void setWorkspacePreference(String preferenceKey, String preferenceValue) { - IEclipsePreferences prefs = getWorkspacePreferences(); - prefs.put(preferenceKey, preferenceValue); - flush(prefs); - } - - /** - * This method is called (via reflection) when the test plug-in is loaded. - * The preferences end up getting flushed after the test case has deleted - * its project, resulting in resource exceptions in the log, e.g. - *

-	 *     Resource '/JpaProjectManagerTests' is not open.
-	 * 
- * See JptJaxbCoreTestsPlugin.start(BundleContext) - */ - @SuppressWarnings("unused") - private static void doNotFlushPreferences() { - flushPreferences = false; - } - - /** - * Flush preferences in an asynchronous Job because the flush request will - * trigger a lock on the project, which can cause us some deadlocks (e.g. - * when deleting the metamodel source folder). - * Note: the flush will also remove the prefs node if it is empty - */ - private static void flush(IEclipsePreferences prefs) { - if (flushPreferences) { - new PreferencesFlushJob(prefs).schedule(); - } - } - - private static class PreferencesFlushJob extends Job { - private final IEclipsePreferences prefs; - PreferencesFlushJob(IEclipsePreferences prefs) { - super(NLS.bind(JptJaxbCoreMessages.PREFERENCES_FLUSH_JOB_NAME, prefs.absolutePath())); - this.prefs = prefs; - } - @Override - protected IStatus run(IProgressMonitor monitor) { - try { - prefs.flush(); - } catch(BackingStoreException ex) { - log(ex); - } - return Status.OK_STATUS; - } - } - - public static Preferences getProjectPreferences(IProject project) { - try { - IFacetedProject fproj = ProjectFacetsManager.create(project); - return fproj.getPreferences(JaxbFacet.FACET); - } - catch (BackingStoreException bse) { - log(bse); - } - catch (CoreException ce) { - log(ce); - } - return null; - } - - /** - * Set the default {@link JaxbPlatformDescription} for new JAXB projects with the given - * JAXB facet version. - */ - public static void setDefaultJaxbPlatform(IProjectFacetVersion jaxbFacetVersion, JaxbPlatformDescription platform) { - String preferenceKey = null; - if (JaxbFacet.VERSION_2_1.equals(jaxbFacetVersion)) { - preferenceKey = DEFAULT_JAXB_PLATFORM_2_1_PREF_KEY; - } - else if (JaxbFacet.VERSION_2_2.equals(jaxbFacetVersion)) { - preferenceKey = DEFAULT_JAXB_PLATFORM_2_2_PREF_KEY; - } - else { - throw new IllegalArgumentException("Illegal JAXB facet version: " + jaxbFacetVersion); //$NON-NLS-1$ - } - setWorkspacePreference(preferenceKey, platform.getId()); - } - - /** - * Return the default {@link JaxbPlatformDescription} for new JAXB projects with the given - * JAXB facet version. - */ - public static JaxbPlatformDescription getDefaultPlatform(IProjectFacetVersion jaxbFacetVersion) { - - JaxbPlatformDescription defaultPlatform = - getDefaultPlatform( - jaxbFacetVersion, - getWorkspacePreferences(), - getDefaultPreferences()); - if (defaultPlatform == null) { - // if the platform ID stored in the workspace prefs is invalid (i.e. null), look in the default prefs - defaultPlatform = getDefaultPlatform(jaxbFacetVersion, getDefaultPreferences()); - } - return defaultPlatform; - } - - private static JaxbPlatformDescription getDefaultPlatform( - IProjectFacetVersion jaxbFacetVersion, Preferences ... nodes) { - - JaxbPlatformDescription defaultDefaultPlatform; - String preferenceKey; - if (jaxbFacetVersion.equals(JaxbFacet.VERSION_2_1)) { - defaultDefaultPlatform = GenericJaxbPlatform.VERSION_2_1; - preferenceKey = DEFAULT_JAXB_PLATFORM_2_1_PREF_KEY; - } - else if (jaxbFacetVersion.equals(JaxbFacet.VERSION_2_2)) { - defaultDefaultPlatform = GenericJaxbPlatform.VERSION_2_2; - preferenceKey = DEFAULT_JAXB_PLATFORM_2_2_PREF_KEY; - } - else { - throw new IllegalArgumentException("Illegal JAXB facet version: " + jaxbFacetVersion); //$NON-NLS-1$ - } - return getDefaultPlatform(jaxbFacetVersion, preferenceKey, defaultDefaultPlatform, nodes); - } - - private static JaxbPlatformDescription getDefaultPlatform( - IProjectFacetVersion jaxbFacetVersion, String preferenceKey, - JaxbPlatformDescription defaultDefault, Preferences ... nodes) { - - String defaultDefaultId = (defaultDefault == null) ? null : defaultDefault.getId(); - String defaultPlatformId = Platform.getPreferencesService().get(preferenceKey, defaultDefaultId, nodes); - JaxbPlatformDescription defaultPlatform = getJaxbPlatformManager().getJaxbPlatform(defaultPlatformId); - if (defaultPlatform != null && defaultPlatform.supportsJaxbFacetVersion(jaxbFacetVersion)) { - return defaultPlatform; - } - else if (defaultDefault != null && defaultDefault.supportsJaxbFacetVersion(jaxbFacetVersion)) { - return defaultDefault; - } - return null; - } - - /** - * Return the JAXB platform ID associated with the specified Eclipse project. - */ - public static String getJaxbPlatformId(IProject project) { - Preferences prefs = getProjectPreferences(project); - Preferences platformPrefs = prefs.node(PLATFORM_PREF_NODE); - return platformPrefs.get(PLATFORM_ID_PREF_KEY, GenericJaxbPlatform.VERSION_2_1.getId()); - } - - /** - * Return the {@link JaxbPlatformDescription} associated with the specified Eclipse project. - */ - public static JaxbPlatformDescription getJaxbPlatformDescription(IProject project) { - String jpaPlatformId = getJaxbPlatformId(project); - return getJaxbPlatformManager().getJaxbPlatform(jpaPlatformId); - } - - /** - * Set the {@link JaxbPlatformDescription} associated with the specified Eclipse project. - */ - public static void setJaxbPlatform(IProject project, JaxbPlatformDescription platform) { - Preferences prefs = getProjectPreferences(project); - Preferences platformPrefs = prefs.node(PLATFORM_PREF_NODE); - platformPrefs.put(PLATFORM_ID_PREF_KEY, platform.getId()); - try { - platformPrefs.flush(); - } - catch (BackingStoreException bse) { - log(bse); - } - } - - public static Map getSchemaLocationMap(IProject project) { - Map schemaLocationMap = new HashMap(); - Preferences prefs = getProjectPreferences(project); - Preferences schemasPrefs = prefs.node(SCHEMAS_PREF_NODE); - try { - boolean checkAnotherNode = true; - for (int i = 1; checkAnotherNode; i++ ) { - String nodeName = SCHEMA_PREF_NODE_PREFIX + String.valueOf(i); - if (schemasPrefs.nodeExists(nodeName)) { - Preferences schemaPrefs = schemasPrefs.node(nodeName); - String namespace = schemaPrefs.get(SCHEMA_NAMESPACE_PREF_KEY, null); - String location = schemaPrefs.get(SCHEMA_LOCATION_PREF_KEY, null); - if (namespace != null) { - schemaLocationMap.put(namespace, location); - } - } - else { - checkAnotherNode = false; - } - } - } - catch (BackingStoreException bse) { - // this means that the prefs are corrupted, in which case reading anything is unlikely - JptJaxbCorePlugin.log(bse); - } - return schemaLocationMap; - } - - public static void setSchemaLocationMap(IProject project, Map schemaLocationMap) { - Preferences prefs = getProjectPreferences(project); - Preferences schemasPrefs = prefs.node(SCHEMAS_PREF_NODE); - try { - int i = 1; - for (String namespace : schemaLocationMap.keySet()) { - String nodeName = SCHEMA_PREF_NODE_PREFIX + String.valueOf(i); - Preferences schemaPref = schemasPrefs.node(nodeName); - schemaPref.put(SCHEMA_NAMESPACE_PREF_KEY, namespace); - schemaPref.put(SCHEMA_LOCATION_PREF_KEY, schemaLocationMap.get(namespace)); - i ++; - } - boolean checkAnotherNode = true; - for ( ; checkAnotherNode; i++ ) { - String nodeName = SCHEMA_PREF_NODE_PREFIX + String.valueOf(i); - if (schemasPrefs.nodeExists(nodeName)) { - schemasPrefs.node(nodeName).removeNode(); - } - else { - checkAnotherNode = false; - } - } - schemasPrefs.flush(); - } - catch (BackingStoreException bse) { - // this means that the prefs are corrupted, in which case reading anything is unlikely - JptJaxbCorePlugin.log(bse); - } - } - - /** - * Log the specified status. - */ - public static void log(IStatus status) { - INSTANCE.getLog().log(status); - } - - /** - * Log the specified message. - */ - public static void log(String msg) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null)); - } - - /** - * Log the specified exception or error. - */ - public static void log(Throwable throwable) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable)); - } - - - // ********** plug-in implementation ********** - - public JptJaxbCorePlugin() { - super(); - if (INSTANCE != null) { - throw new IllegalStateException(); - } - // this convention is *wack*... ~bjv - INSTANCE = this; - } - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - // nothing yet... - } - - @Override - public void stop(BundleContext context) throws Exception { - try { - if (this.projectManager != null) { - this.projectManager.stop(); - this.projectManager = null; - } - } finally { - super.stop(context); - } - } - - private synchronized GenericJaxbProjectManager getProjectManager_() { - if (this.projectManager == null) { - this.projectManager = this.buildProjectManager(); - this.projectManager.start(); - } - return this.projectManager; - } - - private GenericJaxbProjectManager buildProjectManager() { - return new GenericJaxbProjectManager(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/MappingKeys.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/MappingKeys.java deleted file mode 100644 index f6fc43d119..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/MappingKeys.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core; - -/** - * - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -@SuppressWarnings("nls") -public interface MappingKeys { - - String XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY = "xml-attribute"; - String XML_ELEMENT_ATTRIBUTE_MAPPING_KEY = "xml-element"; - String XML_TRANSIENT_ATTRIBUTE_MAPPING_KEY = "xml-transient"; - String XML_VALUE_ATTRIBUTE_MAPPING_KEY = "xml-value"; - String NULL_ATTRIBUTE_MAPPING_KEY = null; -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/SchemaLibrary.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/SchemaLibrary.java deleted file mode 100644 index fe52356cbc..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/SchemaLibrary.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core; - -import java.util.Map; -import org.eclipse.xsd.XSDSchema; - -/** - * Entry point for accessing project schema resources - * - * @version 3.0 - * @since 3.0 - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface SchemaLibrary { - - public XSDSchema getSchema(String namespace); - - /** - * Return the project settings that indicate how schema keys are mapped to actual - * resolvable schemas - */ - public Map getSchemaLocations(); - - /** - * Set the project settings that indicate how schema keys are mapped to actual - * resolvable schemas. - */ - public void setSchemaLocations(Map schemaLocations); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbAttributeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbAttributeMapping.java deleted file mode 100644 index 62c10ee6fa..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbAttributeMapping.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; - - -/** - * Represents a JAXB attribute mapping. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbAttributeMapping - extends JavaContextNode { - - JaxbPersistentAttribute getParent(); - - JavaResourceAttribute getJavaResourceAttribute(); - - String getKey(); - - /** - * Return whether the mapping is its attribute's default mapping - * (as opposed to its specified mapping). - */ - boolean isDefault(); - String DEFAULT_PROPERTY = "default"; //$NON-NLS-1$ - - void updateDefault(); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContainmentMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContainmentMapping.java deleted file mode 100644 index 311a2e3b13..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContainmentMapping.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - - -/** - * Represents a JAXB containment mappings (xml element/attribute) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbContainmentMapping - extends JaxbAttributeMapping, XmlAdaptable { - - - String getName(); - String getDefaultName(); - String getSpecifiedName(); - void setSpecifiedName(String name); - String SPECIFIED_NAME_PROPERTY = "specifiedName"; //$NON-NLS-1$ - - boolean isRequired(); - boolean isDefaultRequired(); - boolean DEFAULT_REQUIRED = false; - Boolean getSpecifiedRequired(); - void setSpecifiedRequired(Boolean specifiedRequired); - String SPECIFIED_REQUIRED_PROPERTY = "specifiedRequired"; //$NON-NLS-1$ - - String getNamespace(); - String getDefaultNamespace(); - String getSpecifiedNamespace(); - void setSpecifiedNamespace(String namespace); - String SPECIFIED_NAMESPACE_PROPERTY = "specifiedNamespace"; //$NON-NLS-1$ - - - - // ********** xml schema type ************ - /** - * Return whether this class has an XmlSchemaType annotation) - */ - boolean hasXmlSchemaType(); - - /** - * Return the xml schema type or null. - */ - XmlSchemaType getXmlSchemaType(); - - XmlSchemaType addXmlSchemaType(); - void removeXmlSchemaType(); - String XML_SCHEMA_TYPE = "xmlSchemaType"; //$NON-NLS-1$ - - - /********** XmlList **********/ - XmlList getXmlList(); - XmlList addXmlList(); - void removeXmlList(); - String XML_LIST_PROPERTY = "xmlList"; //$NON-NLS-1$ - -} \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContextNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContextNode.java deleted file mode 100644 index 9918f02d62..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContextNode.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jaxb.core.JaxbNode; - -/** - * Common protocol for JAXB objects that have a context, as opposed to - * resource objects. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbContextNode - extends JaxbNode { - - /** - * Return the root of the context model - */ - JaxbContextRoot getContextRoot(); - - /** - * Return the resource type of the context node's resource. - */ - JptResourceType getResourceType(); - - - // ********** updating ********** - - void synchronizeWithResourceModel(); - - /** - * Update the context model with the content of the JAXB resource model. - */ - void update(); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContextRoot.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContextRoot.java deleted file mode 100644 index f5394b3a3c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbContextRoot.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import java.util.List; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Root of the JAXB context model. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbContextRoot - extends JaxbContextNode { - - /** - * The set of packages. Includes any package with any interesting JAXB content. - */ - Iterable getPackages(); - public final static String PACKAGES_COLLECTION = "packages"; //$NON-NLS-1$ - - int getPackagesSize(); - - /** - * Return the package with the given name - */ - JaxbPackage getPackage(String packageName); - - /** - * Return the set of all JAXB types within this context root. - */ - Iterable getTypes(); - public final static String TYPES_COLLECTION = "types"; //$NON-NLS-1$ - - int getTypesSize(); - - /** - * Return the type with the given name - */ - JaxbType getType(String typeName); - - /** - * Return the set of types that are in the given package - */ - Iterable getTypes(JaxbPackage jaxbPackage); - - /** - * The set of persistent classes. These may be explicitly or implicitly included. - */ - Iterable getPersistentClasses(); - - /** - * Return the set of persistent classes that are in the given package - */ - Iterable getPersistentClasses(JaxbPackage jaxbPackage); - - /** - * Return the persistent class with the given fully qualified name - */ - JaxbPersistentClass getPersistentClass(String fullyQualifiedTypeName); - - /** - * The set of persistent enums. These may be explicitly or implicitly included. - */ - Iterable getPersistentEnums(); - - /** - * Return the set of persistent enums that are in the given package - */ - Iterable getPersistentEnums(JaxbPackage jaxbPackage); - - /** - * Return the persistent enum with the given fully qualified name - */ - JaxbPersistentEnum getPersistentEnum(String fullyQualifiedTypeName); - - /** - * The set of registries. - */ - Iterable getRegistries(); - - /** - * Return the set of registries that are in the given package - * (There should typically be a max of 1, but there are invalid states ...) - */ - Iterable getRegistries(JaxbPackage jaxbPackage); - - - // **************** validation ******************************************** - - /** - * Add validation messages to the specified list. - */ - public void validate(List messages, IReporter reporter); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbElementFactoryMethod.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbElementFactoryMethod.java deleted file mode 100644 index c662f829cb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbElementFactoryMethod.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; - -/** - * Represents a JAXB element factory method - * (A method inside an object factory (@XmlRegistry) with an explicit @XmlElementDecl annotation) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbElementFactoryMethod - extends JaxbContextNode { - - JavaResourceMethod getResourceMethod(); - - /** - * Return the method name - */ - String getName(); - - /** - * Corresponds to the XmlElementDecl annotation 'name' element - */ - String getElementName(); - void setElementName(String elementName); - String ELEMENT_NAME_PROPERTY = "elementName"; //$NON-NLS-1$ - - /** - * Corresponds to the XmlElementDecl annotation 'defaultValue' element - */ - String getDefaultValue(); - void setDefaultValue(String defaultValue); - String DEFAULT_VALUE_PROPERTY = "defaultValue"; //$NON-NLS-1$ - String DEFAULT_DEFAULT_VALUE = "\u0000"; //$NON-NLS-1$ - - /** - * Corresponds to the XmlElementDecl annotation 'namespace' element - */ - String getNamespace(); - void setNamespace(String namespace); - String NAMESPACE_PROPERTY = "namespace"; //$NON-NLS-1$ - String DEFAULT_NAMESPACE = "##default"; //$NON-NLS-1$ - - /** - * Corresponds to the XmlElementDecl annotation 'substitutionHeadName' element - */ - String getSubstitutionHeadName(); - void setSubstitutionHeadName(String substitutionHeadName); - String SUBSTIUTION_HEAD_NAME_PROPERTY = "substitutionHeadName"; //$NON-NLS-1$ - String DEFAULT_SUBSTIUTION_HEAD_NAME = ""; //$NON-NLS-1$ - - /** - * Corresponds to the XmlElementDecl annotation 'substitutionHeadNamespace' element - */ - String getSubstitutionHeadNamespace(); - void setSubstitutionHeadNamespace(String substitutionHeadNamespace); - String SUBSTIUTION_HEAD_NAMESPACE_PROPERTY = "substitutionHeadNamespace"; //$NON-NLS-1$ - String DEFAULT_SUBSTIUTION_HEAD_NAMESPACE = "##default"; //$NON-NLS-1$ - - - /** - * Corresponds to the XmlElementDecl annotation 'scope' element - */ - String getScope(); - void setScope(String scope); - String SCOPE_PROPERTY = "scope"; //$NON-NLS-1$ - String DEFAULT_SCOPE_CLASS_NAME = "javax.xml.bind.annotation.XmlElementDecl.GLOBAL"; //$NON-NLS-1$ -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbEnumConstant.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbEnumConstant.java deleted file mode 100644 index 71d8238701..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbEnumConstant.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; - -/** - * Represents a JAXB enum constant. - * (A constant inside an enum with either an explicit or implicit @XmlEnumValue annotation) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbEnumConstant - extends JaxbContextNode { - - JavaResourceEnumConstant getResourceEnumConstant(); - - /** - * Return the name of the enum constant. This will not change, a - * new JaxbEnumConstant will be built if the name changes. - */ - String getName(); - - - /** - * Return the enum constant's value, whether specified or default. - */ - String getValue(); - - /** - * The default value will be the name of the enum constant. - * It will be used if the XmlEnumValue annotation is null. - * @see getName() - */ - String getDefaultValue(); - - /** - * Corresponds to the XmlEnumValue annotation 'value' element - */ - String getSpecifiedValue(); - void setSpecifiedValue(String value); - String SPECIFIED_VALUE_PROPERTY = "specifiedValue"; //$NON-NLS-1$ - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPackage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPackage.java deleted file mode 100644 index e2cb4d80f1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPackage.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import java.util.List; -import org.eclipse.jpt.jaxb.core.xsd.XsdSchema; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbPackage - extends JaxbContextNode { - - /** - * The package name. - * This is unchanging in that, if a package name changes, a new JaxbPackage is created. - */ - String getName(); - - /** - * The optional package-info - */ - JaxbPackageInfo getPackageInfo(); - public final static String PACKAGE_INFO_PROPERTY = "package-info"; //$NON-NLS-1$ - - /** - * Return the namespace associated with this package, default or specified - */ - String getNamespace(); - - /** - * Return whether this package has no useful information. - * Useful information includes: - * - annotated package-info.java - * - jaxb.index - * - object factory - */ - boolean isEmpty(); - - /** - * Return the {@link XsdSchema} associated with this package, if there is one, null otherwise - */ - XsdSchema getXsdSchema(); - - - // **************** validation ******************************************** - - /** - * Add validation messages to the specified list. - */ - public void validate(List messages, IReporter reporter); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPackageInfo.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPackageInfo.java deleted file mode 100644 index fbf265e8d8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPackageInfo.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import java.util.List; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbPackageInfo - extends JavaContextNode, XmlAccessTypeHolder, XmlAccessOrderHolder { - - JavaResourcePackage getResourcePackage(); - - JaxbPackage getParent(); - - // ********** xml schema ********** - - /** - * Return the XML schema for this package info, this will not be null. - */ - XmlSchema getXmlSchema(); - - - // ********** xml schema types ********** - - ListIterable getXmlSchemaTypes(); - int getXmlSchemaTypesSize(); - XmlSchemaType addXmlSchemaType(int index); - void removeXmlSchemaType(int index); - void removeXmlSchemaType(XmlSchemaType xmlSchemaType); - void moveXmlSchemaType(int targetIndex, int sourceIndex); - String XML_SCHEMA_TYPES_LIST = "xmlSchemaTypes"; //$NON-NLS-1$ - - - // ********** xml java type adapters ********** - - ListIterable getXmlJavaTypeAdapters(); - int getXmlJavaTypeAdaptersSize(); - XmlJavaTypeAdapter addXmlJavaTypeAdapter(int index); - void removeXmlJavaTypeAdapter(int index); - void removeXmlJavaTypeAdapter(XmlJavaTypeAdapter xmlJavaTypeAdapter); - void moveXmlJavaTypeAdapter(int targetIndex, int sourceIndex); - String XML_JAVA_TYPE_ADAPTERS_LIST = "xmlJavaTypeAdapters"; //$NON-NLS-1$ - - - // **************** validation ******************************************** - - /** - * Add validation messages to the specified list. - */ - void validate(List messages, IReporter reporter); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentAttribute.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentAttribute.java deleted file mode 100644 index 1ee2dc497e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentAttribute.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; - -/** - * Represents a JAXB attribute (field/property). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbPersistentAttribute - extends JavaContextNode { - - - JaxbPersistentClass getParent(); - - // ********** name ********** - - /** - * Return the name of the attribute. This will not change, a - * new JaxbPersistentAttribute will be built if the name changes. - */ - String getName(); - - boolean isFor(JavaResourceField resourceField); - - boolean isFor(JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter); - - JavaResourceAttribute getJavaResourceAttribute(); - - /** - * Return the type name of the java resource attribute - * This might not return the same thing as getJavaResourceAttribute().getTypeName(). - */ - String getJavaResourceAttributeTypeName(); - - /** - * Return whether the java resource attribute type is an array - * This might not return the same thing as getJavaResourceAttribute().typeIsArray(). - */ - boolean isJavaResourceAttributeTypeArray(); - - /** - * Return whether the java resource attribute type is a subtype of the given type - * This might not return the same thing as getJavaResourceAttribute().typeIsSubTypeOf(String). - */ - boolean isJavaResourceAttributeTypeSubTypeOf(String typeName); - - // ********** mapping ********** - - /** - * Return the attribute's mapping. This is never null - * (although, it may be a null mapping). - * Set the mapping via {@link PersistentAttribute#setMappingKey(String)}. - */ - JaxbAttributeMapping getMapping(); - String MAPPING_PROPERTY = "mapping"; //$NON-NLS-1$ - - /** - * Return the attribute's mapping key. - */ - String getMappingKey(); - - /** - * Set the attribute's mapping. - * If the specified key is null, clear the specified mapping, - * allowing the attribute's mapping to default (if appropriate). - * Return the new mapping (which may be a null mapping). - */ - JaxbAttributeMapping setMappingKey(String key); - - /** - * Return the key for the attribute's default mapping. - * This can be null (e.g. for specified - * orm.xml attributes). - * @see JaxbAttributeMapping#isDefault() - */ - String getDefaultMappingKey(); - String DEFAULT_MAPPING_KEY_PROPERTY = "defaultMappingKey"; //$NON-NLS-1$ -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentClass.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentClass.java deleted file mode 100644 index 92c790f79e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentClass.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; - -/** - * Represents a JAXB persistent class. - * (A class with either an explicit or implicit @XmlType annotation) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbPersistentClass - extends JaxbPersistentType, XmlAccessTypeHolder, XmlAccessOrderHolder, XmlAdaptable { - - /** - * covariant override - */ - JavaResourceType getJavaResourceType(); - - JaxbPersistentClass getSuperPersistentClass(); - String SUPER_PERSISTENT_CLASS_PROPERTY = "superPersistentClass"; //$NON-NLS-1$ - - /** - * Return the persistent type's "persistence" inheritance hierarchy, - * including the persistent type itself. - * The returned iterator will return elements infinitely if the hierarchy - * has a loop. - */ - Iterable getInheritanceHierarchy(); - - /** - * Return the persistent type's "persistence" inheritance hierarchy, - * excluding the persistent type itself. - * The returned iterator will return elements infinitely if the hierarchy - * has a loop. - */ - Iterable getAncestors(); - - - /********** attributes **********/ - - Iterable getAttributes(); - int getAttributesSize(); - String ATTRIBUTES_COLLECTION = "attributes"; //$NON-NLS-1$ - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentEnum.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentEnum.java deleted file mode 100644 index 3d047e3f98..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentEnum.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; - - -/** - * Represents a JAXB persistent enum. - * (A enum with either an explicit or implicit @XmlEnum annotation) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbPersistentEnum - extends JaxbPersistentType { - - /** - * covariant override - */ - JavaResourceEnum getJavaResourceType(); - - /**************** enum type *****************/ - - /** - * enum type corresponds to the XmlEnum annotation value element - */ - String getEnumType(); - void setEnumType(String enumType); - String ENUM_TYPE_PROPERTY = "enumType"; //$NON-NLS-1$ - String DEFAULT_ENUM_TYPE = "java.lang.String"; //$NON-NLS-1$ - - - /********** enum constants **********/ - - Iterable getEnumConstants(); - int getEnumConstantsSize(); - String ENUM_CONSTANTS_COLLECTION = "enumConstants"; //$NON-NLS-1$ - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentField.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentField.java deleted file mode 100644 index e87e68feae..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentField.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; - -/** - * Represents a JAXB field. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbPersistentField - extends JaxbPersistentAttribute { - - JavaResourceField getResourceField(); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentProperty.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentProperty.java deleted file mode 100644 index 329d44807e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentProperty.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; - -/** - * Represents a JAXB property (getter/setter pair) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbPersistentProperty - extends JaxbPersistentAttribute { - - JavaResourceMethod getResourceGetterMethod(); - - JavaResourceMethod getResourceSetterMethod(); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentType.java deleted file mode 100644 index 9f9397967c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbPersistentType.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.xsd.XsdTypeDefinition; - -/** - * Represents a JAXB persistent type (class or enum). - * (A class with either an explicit or implicit @XmlType annotation) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbPersistentType - extends JaxbType { - - /**************** factory class *****************/ - - /** - * factory class corresponds to the XmlType annotation factoryClass element - */ - String getFactoryClass(); - void setFactoryClass(String factoryClass); - String FACTORY_CLASS_PROPERTY = "factoryClass"; //$NON-NLS-1$ - - - /**************** factory method *****************/ - - /** - * factory method corresponds to the XmlType annotation factoryMethod element - */ - String getFactoryMethod(); - void setFactoryMethod(String factoryMethod); - String FACTORY_METHOD_PROPERTY = "factoryMethod"; //$NON-NLS-1$ - - - /**************** name *****************/ - - /** - * Return the specified xml type name or the default type name if it is not specified - */ - String getXmlTypeName(); - - /** - * Return the specified xml type name or null if it is not specified - */ - String getSpecifiedXmlTypeName(); - - /** - * Set the xml type name, null to unspecify (use the default) - */ - void setSpecifiedXmlTypeName(String xmlTypeName); - - /** - * String constant associated with changes to the specified xml type name - */ - String SPECIFIED_XML_TYPE_NAME_PROPERTY = "specifiedXmlTypeName"; //$NON-NLS-1$ - - /** - * Return the default xml type name - */ - String getDefaultXmlTypeName(); - - - /**************** namespace *****************/ - - /** - * Return the specified xml type namespace or the default namespace if it is not specified - */ - String getNamespace(); - - /** - * Return the specified xml type namespace or null if it is not specified - */ - String getSpecifiedNamespace(); - - /** - * Set the xml type namespace, null to unspecify (use the default) - */ - void setSpecifiedNamespace(String namespace); - - /** - * String constant associated with changes to the specified xml type namespace - */ - String SPECIFIED_NAMESPACE_PROPERTY = "specifiedNamespace"; //$NON-NLS-1$ - - /** - * Return the default namespace - */ - String getDefaultNamespace(); - - - /********** propOrder **********/ - - /** - * propOrder corresponds to the XmlType annotation propOrder element - */ - ListIterable getPropOrder(); - int getPropOrderSize(); - void addProp(int index, String prop); - void removeProp(int index); - void removeProp(String prop); - void moveProp(int targetIndex, int sourceIndex); - String PROP_ORDER_LIST = "propOrder"; //$NON-NLS-1$ - - // ********** root element ************ - /** - * Return whether this class is a root element (has the XmlRootElement annotation) - */ - boolean isRootElement(); - - /** - * Return the root element or null if it is not a root element. - */ - XmlRootElement getRootElement(); - - /** - * Set the root element name, this will add the XmlRootElement annotation - * and set its name to the specified name. - * To remove the XmlRootElement annotation, pass in null. - * To set the name when the class is already a root element, - * set it directly on the XmlRootElement. - */ - XmlRootElement setRootElement(String name); - String ROOT_ELEMENT = "rootElement"; //$NON-NLS-1$ - - - // **************** misc ************************************************** - - XsdTypeDefinition getXsdTypeDefinition(); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbRegistry.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbRegistry.java deleted file mode 100644 index 2e187c89ff..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbRegistry.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; - -/** - * Represents a JAXB registry - * (A class with an explicit @XmlRegistry annotation) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbRegistry extends JaxbType { - - /** - * covariant override - */ - JavaResourceType getJavaResourceType(); - - - /********** element factory methods **********/ - - Iterable getElementFactoryMethods(); - int getElementFactoryMethodsSize(); - String ELEMENT_FACTORY_METHODS_COLLECTION = "elementFactoryMethods"; //$NON-NLS-1$ - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbType.java deleted file mode 100644 index a38b3235eb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/JaxbType.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import java.util.List; -import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Represents a java class (or enum or interface) with JAXB metadata (specified or implied). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbType - extends JavaContextNode { - - /** - * Return the kind of JaxbType this represents - */ - Kind getKind(); - - /** - * Return the associated java resource type - */ - AbstractJavaResourceType getJavaResourceType(); - - /** - * Returns the fully qualified name of this type, including qualification for any - * enclosing types and packages. - */ - String getFullyQualifiedName(); - - /** - * Returns the type-qualified name of this type, including qualification for any - * enclosing types, but not including package qualification. - */ - String getTypeQualifiedName(); - - /** - * Return the name of the type without any package or type qualifiers - */ - String getSimpleName(); - - /** - * Return the name of the type's package. Empty string if none. - */ - String getPackageName(); - - /** - * Return the {@link JaxbPackage} associated with this type - */ - JaxbPackage getJaxbPackage(); - - - // **************** validation ******************************************** - - /** - * Add to the list of current validation messages - */ - void validate(List messages, IReporter reporter); - - - /** - * The kind of metadata specified on the java type. - */ - public static enum Kind { - - /** - * A JaxbType of {@link Kind} PERSISTENT_CLASS may safely be cast as a {@link JaxbPersistentClass} - */ - PERSISTENT_CLASS, - - /** - * A JaxbType of {@link Kind} PERSISTENT_ENUM may safely be cast as a {@link JaxbPersistentEnum} - */ - PERSISTENT_ENUM, - - /** - * A JaxbType of {@link Kind} REGISTRY may safely be cast as a {@link JaxbRegistry} - */ - REGISTRY - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAccessOrder.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAccessOrder.java deleted file mode 100644 index 7c3a887420..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAccessOrder.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -/** - * Access Order - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public enum XmlAccessOrder { - - ALPHABETICAL( - org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder.ALPHABETICAL - ), - UNDEFINED( - org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder.UNDEFINED - ); - - - private org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder javaAccessOrder; - - XmlAccessOrder(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder javaAccessOrder) { - if (javaAccessOrder == null) { - throw new NullPointerException(); - } - this.javaAccessOrder = javaAccessOrder; - } - - public org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder getJavaAccessOrder() { - return this.javaAccessOrder; - } - - - // ********** static methods ********** - - public static XmlAccessOrder fromJavaResourceModel(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder javaAccessOrder) { - return (javaAccessOrder == null) ? null : fromJavaResourceModel_(javaAccessOrder); - } - - private static XmlAccessOrder fromJavaResourceModel_(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder javaAccessOrder) { - for (XmlAccessOrder accessOrder : XmlAccessOrder.values()) { - if (accessOrder.getJavaAccessOrder() == javaAccessOrder) { - return accessOrder; - } - } - return null; - } - - public static org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder toJavaResourceModel(XmlAccessOrder accessOrder) { - return (accessOrder == null) ? null : accessOrder.getJavaAccessOrder(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAccessOrderHolder.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAccessOrderHolder.java deleted file mode 100644 index 8110846e90..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAccessOrderHolder.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - - -/** - * - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlAccessOrderHolder - extends JaxbContextNode -{ - /** - * Return the access order, whether specified or defaulted. - * This should never return null since at least the default will be set - */ - XmlAccessOrder getAccessOrder(); - - /** - * Return the default access order, never null - */ - XmlAccessOrder getDefaultAccessOrder(); - - /** - * String constant associated with changes to the default access order - */ - String DEFAULT_ACCESS_ORDER_PROPERTY = "defaultAccessOrder"; //$NON-NLS-1$ - - /** - * Return the specified access order; - */ - XmlAccessOrder getSpecifiedAccessOrder(); - - /** - * Set the specified access order. - */ - void setSpecifiedAccessOrder(XmlAccessOrder newSpecifiedAccessOrder); - - /** - * String constant associated with changes to the specified access order - */ - String SPECIFIED_ACCESS_ORDER_PROPERTY = "specifiedAccessOrder"; //$NON-NLS-1$ - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAccessType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAccessType.java deleted file mode 100644 index b2c8fd639a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAccessType.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -/** - * Access Type - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public enum XmlAccessType { - - FIELD( - org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType.FIELD - ), - NONE( - org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType.NONE - ), - PROPERTY( - org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType.PROPERTY - ), - PUBLIC_MEMBER( - org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType.PUBLIC_MEMBER - ); - - - private org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType javaAccessType; - - XmlAccessType(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType javaAccessType) { - if (javaAccessType == null) { - throw new NullPointerException(); - } - this.javaAccessType = javaAccessType; - } - - public org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType getJavaAccessType() { - return this.javaAccessType; - } - - - // ********** static methods ********** - - public static XmlAccessType fromJavaResourceModel(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType javaAccessType) { - return (javaAccessType == null) ? null : fromJavaResourceModel_(javaAccessType); - } - - private static XmlAccessType fromJavaResourceModel_(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType javaAccessType) { - for (XmlAccessType accessType : XmlAccessType.values()) { - if (accessType.getJavaAccessType() == javaAccessType) { - return accessType; - } - } - return null; - } - - public static org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType toJavaResourceModel(XmlAccessType accessType) { - return (accessType == null) ? null : accessType.getJavaAccessType(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAccessTypeHolder.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAccessTypeHolder.java deleted file mode 100644 index 986195e690..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAccessTypeHolder.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - - -/** - * - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlAccessTypeHolder - extends JaxbContextNode -{ - /** - * Return the access type, whether specified or defaulted. - * This should never return null since at least the default will be set - */ - XmlAccessType getAccessType(); - - /** - * Return the default access type, never null - */ - XmlAccessType getDefaultAccessType(); - - /** - * String constant associated with changes to the default access type - */ - String DEFAULT_ACCESS_TYPE_PROPERTY = "defaultAccessType"; //$NON-NLS-1$ - - /** - * Return the specified access type; - */ - XmlAccessType getSpecifiedAccessType(); - - /** - * Set the specified access type. - */ - void setSpecifiedAccessType(XmlAccessType newSpecifiedAccessType); - - /** - * String constant associated with changes to the specified access type - */ - String SPECIFIED_ACCESS_TYPE_PROPERTY = "specifiedAccessType"; //$NON-NLS-1$ - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAdaptable.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAdaptable.java deleted file mode 100644 index d0d03b92c1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAdaptable.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; - -public interface XmlAdaptable - extends JavaContextNode -{ - /********** XmlJavaTypeAdapter **********/ - XmlJavaTypeAdapter getXmlJavaTypeAdapter(); - XmlJavaTypeAdapter addXmlJavaTypeAdapter(); - void removeXmlJavaTypeAdapter(); - String XML_JAVA_TYPE_ADAPTER_PROPERTY = "xmlJavaTypeAdapter"; //$NON-NLS-1$ - - interface Owner { - JavaResourceAnnotatedElement getResource(); - XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation adapterAnnotation); - void fireXmlAdapterChanged(XmlJavaTypeAdapter oldAdapter, XmlJavaTypeAdapter newAdapter); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAttributeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAttributeMapping.java deleted file mode 100644 index 63b5648f61..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlAttributeMapping.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - - -/** - * Represents a JAXB xml attribute mapping (@XmlAttribute) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlAttributeMapping - extends JaxbContainmentMapping { - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementMapping.java deleted file mode 100644 index c34a8ee7e1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementMapping.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - - -/** - * Represents a JAXB xml element mapping (@XmlElement) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlElementMapping - extends JaxbContainmentMapping { - - - boolean isNillable(); - boolean isDefaultNillable(); - boolean DEFAULT_NILLABLE = false; - Boolean getSpecifiedNillable(); - void setSpecifiedNillable(Boolean specifiedNillable); - String SPECIFIED_NILLABLE_PROPERTY = "specifiedNillable"; //$NON-NLS-1$ - - String getDefaultValue(); - void setDefaultValue(String defaultValue); - String DEFAULT_VALUE_PROPERTY = "defaultValue"; //$NON-NLS-1$ - - String getType(); - String getDefaultType(); - String getSpecifiedType(); - void setSpecifiedType(String type); - String SPECIFIED_TYPE_PROPERTY = "specifiedType"; //$NON-NLS-1$ - - - /********** XmlElementWrapper **********/ - XmlElementWrapper getXmlElementWrapper(); - XmlElementWrapper addXmlElementWrapper(); - void removeXmlElementWrapper(); - String XML_ELEMENT_WRAPPER_PROPERTY = "xmlElementWrapper"; //$NON-NLS-1$ - -} \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementWrapper.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementWrapper.java deleted file mode 100644 index 527cd593ad..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlElementWrapper.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode; - - -/** - * Represents a JAXB XML element wrapper - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlElementWrapper - extends JavaContextNode { - - - String getName(); - String getDefaultName(); - String getSpecifiedName(); - void setSpecifiedName(String name); - String SPECIFIED_NAME_PROPERTY = "specifiedName"; //$NON-NLS-1$ - - String getNamespace(); - String getDefaultNamespace(); - String getSpecifiedNamespace(); - void setSpecifiedNamespace(String namespace); - String SPECIFIED_NAMESPACE_PROPERTY = "specifiedNamespace"; //$NON-NLS-1$ - - boolean isNillable(); - boolean isDefaultNillable(); - boolean DEFAULT_NILLABLE = false; - Boolean getSpecifiedNillable(); - void setSpecifiedNillable(Boolean specifiedNillable); - String SPECIFIED_NILLABLE_PROPERTY = "specifiedNillable"; //$NON-NLS-1$ - - boolean isRequired(); - boolean isDefaultRequired(); - boolean DEFAULT_REQUIRED = false; - Boolean getSpecifiedRequired(); - void setSpecifiedRequired(Boolean specifiedRequired); - String SPECIFIED_REQUIRED_PROPERTY = "specifiedRequired"; //$NON-NLS-1$ -} \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlJavaTypeAdapter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlJavaTypeAdapter.java deleted file mode 100644 index 76d3d69158..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlJavaTypeAdapter.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; - -/** - * - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlJavaTypeAdapter - extends - JavaContextNode -{ - - XmlJavaTypeAdapterAnnotation getResourceXmlJavaTypeAdapter(); - - /**************** value *****************/ - - String getValue(); - - void setValue(String value); - String VALUE_PROPERTY = "value"; //$NON-NLS-1$ - - /**************** type *****************/ - - String getType(); - String getDefaultType(); - String DEFAULT_TYPE_PROPERTY = "defaultType"; //$NON-NLS-1$ - String getSpecifiedType(); - void setSpecifiedType(String type); - String SPECIFIED_TYPE_PROPERTY = "specifiedType"; //$NON-NLS-1$ - String DEFAULT_TYPE = "javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter.DEFAULT"; //$NON-NLS-1$ - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlList.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlList.java deleted file mode 100644 index 70e1fc55e3..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlList.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode; - - -/** - * Represents a JAXB XML list - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlList - extends JavaContextNode { - - -} \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlNs.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlNs.java deleted file mode 100644 index c83049ccc9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlNs.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation; - -/** - * - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlNs - extends - JaxbContextNode -{ - XmlNsAnnotation getResourceXmlNs(); - - // ********** namespaceURI ********** - String getNamespaceURI(); - void setNamespaceURI(String namespaceURI); - String NAMESPACE_URI_PROPERTY = "namespaceURI"; //$NON-NLS-1$ - - // ********** prefix ********** - String getPrefix(); - void setPrefix(String prefix); - String PREFIX_PROPERTY = "prefix"; //$NON-NLS-1$ -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlNsForm.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlNsForm.java deleted file mode 100644 index 25b8ebc374..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlNsForm.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -/** - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public enum XmlNsForm { - - QUALIFIED( - org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm.QUALIFIED - ), - UNQUALIFIED( - org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm.UNQUALIFIED - ), - UNSET( - org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm.UNSET - ); - - - private org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm javaNsForm; - - XmlNsForm(org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm javaNsForm) { - if (javaNsForm == null) { - throw new NullPointerException(); - } - this.javaNsForm = javaNsForm; - } - - public org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm getJavaNsForm() { - return this.javaNsForm; - } - - - // ********** static methods ********** - - public static XmlNsForm fromJavaResourceModel(org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm javaNsForm) { - return (javaNsForm == null) ? null : fromJavaResourceModel_(javaNsForm); - } - - private static XmlNsForm fromJavaResourceModel_(org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm javaNsForm) { - for (XmlNsForm nsForm : XmlNsForm.values()) { - if (nsForm.getJavaNsForm() == javaNsForm) { - return nsForm; - } - } - return null; - } - - public static org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm toJavaResourceModel(XmlNsForm nsForm) { - return (nsForm == null) ? null : nsForm.getJavaNsForm(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlRootElement.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlRootElement.java deleted file mode 100644 index 12870d5571..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlRootElement.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode; - -/** - * Represents a JAXB xml root element. - * (A class with either an explicit @XmlRootElement annotation) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlRootElement - extends JavaContextNode { - - /**************** name *****************/ - - /** - * Return the specified name or the default type name if it is not specified - */ - String getName(); - - /** - * Return the specified name or null if it is not specified - */ - String getSpecifiedName(); - - /** - * Set the name, null to unspecify (use the default) - */ - void setSpecifiedName(String name); - - /** - * String constant associated with changes to the specified name - */ - String SPECIFIED_NAME_PROPERTY = "specifiedName"; //$NON-NLS-1$ - - /** - * Return the default name - */ - String getDefaultName(); - - - /**************** namespace *****************/ - - /** - * Return the specified namespace or the default namespace if it is not specified - */ - String getNamespace(); - - /** - * Return the specified namespace or null if it is not specified - */ - String getSpecifiedNamespace(); - - /** - * Set the namespace, null to unspecify (use the default) - */ - void setSpecifiedNamespace(String namespace); - - /** - * String constant associated with changes to the specified namespace - */ - String SPECIFIED_NAMESPACE_PROPERTY = "specifiedNamespace"; //$NON-NLS-1$ - - /** - * Return the default namespace - */ - String getDefaultNamespace(); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlSchema.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlSchema.java deleted file mode 100644 index 6bf74005b9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlSchema.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode; - -/** - * - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlSchema - extends JavaContextNode { - - /** - * Return the specified namespace or "" (default value) - */ - String getNamespace(); - - /** - * Return the specified namespace, null if it is not specified - */ - String getSpecifiedNamespace(); - - /** - * Set the namespace, null to unspecify - */ - void setSpecifiedNamespace(String namespace); - - /** - * String constant associated with changes to the specified namespace - */ - String SPECIFIED_NAMESPACE_PROPERTY = "specifiedNamespace"; //$NON-NLS-1$ - - - /** - * Corresponds to the XmlSchema annotation location element - */ - String getLocation(); - void setLocation(String location); - String LOCATION_PROPERTY = "location"; //$NON-NLS-1$ - String DEFAULT_LOCATION = "##generate"; //$NON-NLS-1$ - - - /** - * Corresponds to the XmlSchema annotation 'attributeFormDefault' element - */ - XmlNsForm getAttributeFormDefault(); - void setAttributeFormDefault(XmlNsForm newAttributeFormDefault); - String ATTRIBUTE_FROM_DEFAULT_PROPERTY = "atributeFormDefault"; //$NON-NLS-1$ - XmlNsForm DEFAULT_ATTRIBUTE_FORM_DEFAULT = XmlNsForm.UNSET; - - - /** - * Corresponds to the XmlSchema annotation 'elementFormDefault' element - */ - XmlNsForm getElementFormDefault(); - void setElementFormDefault(XmlNsForm newElementFormDefault); - String ELEMENT_FROM_DEFAULT_PROPERTY = "elementFormDefault"; //$NON-NLS-1$ - XmlNsForm DEFAULT_ELEMENT_FORM_DEFAULT = XmlNsForm.UNSET; - - - // ********** xml namespace prefixes ********** - - ListIterable getXmlNsPrefixes(); - int getXmlNsPrefixesSize(); - XmlNs addXmlNsPrefix(int index); - void removeXmlNsPrefix(int index); - void removeXmlNsPrefix(XmlNs xmlNsPrefix); - void moveXmlNsPrefix(int targetIndex, int sourceIndex); - String XML_NS_PREFIXES_LIST = "xmlNsPrefixes"; //$NON-NLS-1$ - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlSchemaType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlSchemaType.java deleted file mode 100644 index f2fb6625ab..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlSchemaType.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - -import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; - -/** - * - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlSchemaType - extends - JavaContextNode -{ - - XmlSchemaTypeAnnotation getResourceXmlSchemaType(); - - - /**************** name *****************/ - - String getName(); - void setName(String name); - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - - - /**************** namespace *****************/ - - /** - * Corresponds to the XmlSchemaType annotation 'namespace' element - */ - String getNamespace(); - String getDefaultNamespace(); - String getSpecifiedNamespace(); - void setSpecifiedNamespace(String namespace); - String SPECIFIED_NAMESPACE_PROPERTY = "namespace"; //$NON-NLS-1$ - String DEFAULT_NAMESPACE = "http://www.w3.org/2001/XMLSchema"; //$NON-NLS-1$ - - - /**************** type *****************/ - - /** - * Corresponds to the XmlSchemaType annotation 'type' element - */ - String getType(); - void setType(String type); - String TYPE_PROPERTY = "type"; //$NON-NLS-1$ - String DEFAULT_TYPE = "javax.xml.bind.annotation.XmlSchemaType.DEFAULT"; //$NON-NLS-1$ -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlValueMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlValueMapping.java deleted file mode 100644 index 49b7509633..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/XmlValueMapping.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context; - - -/** - * Represents a JAXB xml value mapping (@XmlValue) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlValueMapping - extends JaxbAttributeMapping, XmlAdaptable { - -} \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/java/DefaultJavaAttributeMappingDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/java/DefaultJavaAttributeMappingDefinition.java deleted file mode 100644 index ff6fdc4ac3..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/java/DefaultJavaAttributeMappingDefinition.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context.java; - -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; - - - -/** - * Map a string key to an attribute mapping and its corresponding - * Java annotation. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface DefaultJavaAttributeMappingDefinition extends JavaAttributeMappingDefinition -{ - - /** - * Return whether this mapping provider should be used for the given {@link JaxbPersistentAttribute} - * in the default (ignoring all mapping annotations) case. - */ - boolean isDefault(JaxbPersistentAttribute persistentAttribute); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/java/JavaAttributeMappingDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/java/JavaAttributeMappingDefinition.java deleted file mode 100644 index d427d8eb01..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/java/JavaAttributeMappingDefinition.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context.java; - -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; - - -/** - * Map a string key to an attribute mapping and its corresponding - * Java annotation. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JavaAttributeMappingDefinition -{ - /** - * Return the attribute mapping's key. - */ - String getKey(); - - /** - * Return the attribute mapping's Java annotation name. - */ - String getAnnotationName(); - - /** - * Build a Java attribute mapping for the specified attribute. Use the specified - * factory for creation so extenders can simply override the appropriate - * creation method instead of building a provider for the same key. - */ - JaxbAttributeMapping buildMapping(JaxbPersistentAttribute attribute, JaxbFactory factory); - - /** - * Return all fully qualified annotation names that are supported with this mapping type. - * This includes all possible annotations, not just the ones that currently exist on the attribute. - */ - Iterable getSupportingAnnotationNames(); - - /** - * Return whether this mapping provider should be used for the given {@link PersistentAttribute} - * in the specified (observing all mapping annotations) case. - */ - boolean isSpecified(JaxbPersistentAttribute persistentAttribute); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/java/JavaContextNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/java/JavaContextNode.java deleted file mode 100644 index b2859f03dd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/context/java/JavaContextNode.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.jaxb.core.context.JaxbContextNode; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - - -public interface JavaContextNode - extends JaxbContextNode { - - // **************** content assist **************************************** - - /** - * Return the Java code-completion proposals for the specified position in the source code. - */ - Iterable getJavaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot); - - - // ******************** validation **************************************** - - /** - * Adds to the list of current validation messages - */ - void validate(List messages, IReporter reporter, CompilationUnit astRoot); - - /** - * Return the text range for highlighting errors for this object - */ - TextRange getValidationTextRange(CompilationUnit astRoot); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbFactory.java deleted file mode 100644 index d861f835af..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbFactory.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceModel; -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.JaxbFile; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JaxbProject.Config; -import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbElementFactoryMethod; -import org.eclipse.jpt.jaxb.core.context.JaxbEnumConstant; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentField; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentProperty; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentType; -import org.eclipse.jpt.jaxb.core.context.JaxbRegistry; -import org.eclipse.jpt.jaxb.core.context.XmlAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.XmlElementMapping; -import org.eclipse.jpt.jaxb.core.context.XmlNs; -import org.eclipse.jpt.jaxb.core.context.XmlRootElement; -import org.eclipse.jpt.jaxb.core.context.XmlSchema; -import org.eclipse.jpt.jaxb.core.context.XmlValueMapping; -import org.eclipse.jpt.jaxb.core.internal.context.GenericContextRoot; -import org.eclipse.jpt.jaxb.core.internal.context.GenericPackage; -import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaElementFactoryMethod; -import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaEnumConstant; -import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaNullAttributeMapping; -import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaPackageInfo; -import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaPersistentClass; -import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaPersistentEnum; -import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaPersistentField; -import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaPersistentProperty; -import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaRegistry; -import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaXmlAttributeMapping; -import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaXmlElementMapping; -import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaXmlNs; -import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaXmlRootElement; -import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaXmlSchema; -import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaXmlTransientMapping; -import org.eclipse.jpt.jaxb.core.internal.context.java.GenericJavaXmlValueMapping; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; - -/** - * Central class that allows extenders to easily replace implementations of - * various Dali interfaces. - */ -public abstract class AbstractJaxbFactory - implements JaxbFactory { - - protected AbstractJaxbFactory() { - super(); - } - - - // ********** Core Model ********** - - public JaxbProject buildJaxbProject(Config config) { - return new GenericJaxbProject(config); - } - - public JaxbFile buildJaxbFile(JaxbProject jaxbProject, IFile file, IContentType contentType, JptResourceModel resourceModel) { - return new GenericJaxbFile(jaxbProject, file, contentType, resourceModel); - } - - - // ********** Non-resource-specific context nodes ********** - - public JaxbContextRoot buildContextRoot(JaxbProject parent) { - return new GenericContextRoot(parent); - } - - public JaxbPackage buildPackage(JaxbContextRoot parent, String packageName) { - return new GenericPackage(parent, packageName); - } - - - // ********** Java context nodes ********** - - public JaxbPackageInfo buildJavaPackageInfo(JaxbPackage parent, JavaResourcePackage resourcePackage) { - return new GenericJavaPackageInfo(parent, resourcePackage); - } - - public JaxbRegistry buildRegistry(JaxbContextRoot parent, JavaResourceType resourceType) { - return new GenericJavaRegistry(parent, resourceType); - } - - public JaxbPersistentClass buildJavaPersistentClass(JaxbContextRoot parent, JavaResourceType resourceType) { - return new GenericJavaPersistentClass(parent, resourceType); - } - - public JaxbPersistentEnum buildJavaPersistentEnum(JaxbContextRoot parent, JavaResourceEnum resourceEnum) { - return new GenericJavaPersistentEnum(parent, resourceEnum); - } - - public XmlSchema buildJavaXmlSchema(JaxbPackageInfo parent) { - return new GenericJavaXmlSchema(parent); - } - - public JaxbEnumConstant buildJavaEnumConstant(JaxbPersistentEnum parent, JavaResourceEnumConstant resourceEnumConstant) { - return new GenericJavaEnumConstant(parent, resourceEnumConstant); - } - - public XmlNs buildJavaXmlNs(XmlSchema parent, XmlNsAnnotation xmlNsAnnotation) { - return new GenericJavaXmlNs(parent, xmlNsAnnotation); - } - - public XmlRootElement buildJavaXmlRootElement(JaxbPersistentType parent, XmlRootElementAnnotation xmlRootElementAnnotation) { - return new GenericJavaXmlRootElement(parent, xmlRootElementAnnotation); - } - - public JaxbElementFactoryMethod buildJavaElementFactoryMethod(JaxbRegistry parent, JavaResourceMethod resourceMethod) { - return new GenericJavaElementFactoryMethod(parent, resourceMethod); - } - - public JaxbPersistentField buildJavaPersistentField(JaxbPersistentClass parent, JavaResourceField resourceField) { - return new GenericJavaPersistentField(parent, resourceField); - } - - public JaxbPersistentProperty buildJavaPersistentProperty(JaxbPersistentClass parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) { - return new GenericJavaPersistentProperty(parent, resourceGetter, resourceSetter); - } - - public JaxbAttributeMapping buildJavaNullAttributeMapping(JaxbPersistentAttribute parent) { - return new GenericJavaNullAttributeMapping(parent); - } - - public JaxbAttributeMapping buildJavaXmlTransientMapping(JaxbPersistentAttribute parent) { - return new GenericJavaXmlTransientMapping(parent); - } - - public XmlAttributeMapping buildJavaXmlAttributeMapping(JaxbPersistentAttribute parent) { - return new GenericJavaXmlAttributeMapping(parent); - } - - public XmlElementMapping buildJavaXmlElementMapping(JaxbPersistentAttribute parent) { - return new GenericJavaXmlElementMapping(parent); - } - - public XmlValueMapping buildJavaXmlValueMapping(JaxbPersistentAttribute parent) { - return new GenericJavaXmlValueMapping(parent); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbNode.java deleted file mode 100644 index a449bd8aea..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbNode.java +++ /dev/null @@ -1,504 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Set; -import java.util.Vector; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTModifiedDeclaration.Adapter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.AspectChangeSupport; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.JaxbFile; -import org.eclipse.jpt.jaxb.core.JaxbNode; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.context.JaxbContextNode; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatform; - -/** - * Some common Dali behavior:

    - *
  • containment hierarchy - *
  • Eclipse adaptable - *
  • update triggers - *
- */ -public abstract class AbstractJaxbNode - extends AbstractModel - implements JaxbNode -{ - private final JaxbNode parent; - - - // ********** constructor/initialization ********** - - protected AbstractJaxbNode(JaxbNode parent) { - super(); - this.checkParent(parent); - this.parent = parent; - } - - protected void checkParent(JaxbNode p) { - if (p == null) { - if (this.requiresParent()) { - throw new IllegalArgumentException("'parent' cannot be null"); //$NON-NLS-1$ - } - } else { - if (this.forbidsParent()) { - throw new IllegalArgumentException("'parent' must be null"); //$NON-NLS-1$ - } - } - } - - protected boolean requiresParent() { - return true; - } - - protected boolean forbidsParent() { - return ! this.requiresParent(); // assume 'parent' is not optional - } - - @Override - protected ChangeSupport buildChangeSupport() { - return new AspectChangeSupport(this, this.buildChangeSupportListener()); - } - - protected AspectChangeSupport.Listener buildChangeSupportListener() { - return new AspectChangeSupport.Listener() { - public void aspectChanged(String aspectName) { - AbstractJaxbNode.this.aspectChanged(aspectName); - } - }; - } - - - // ********** IAdaptable implementation ********** - - @SuppressWarnings("rawtypes") - public Object getAdapter(Class adapter) { - return Platform.getAdapterManager().getAdapter(this, adapter); - } - - - // ********** JaxbNode implementation ********** - - public JaxbNode getParent() { - return this.parent; - } - - public IResource getResource() { - return this.parent.getResource(); - } - - public JaxbProject getJaxbProject() { - return this.parent.getJaxbProject(); - } - - - // ********** convenience methods ********** - - protected JaxbPlatform getPlatform() { - return this.getJaxbProject().getPlatform(); - } - -// protected JaxbPlatform.Version getJaxbPlatformVersion() { -// return this.getJaxbPlatform().getJaxbPlatformVersion(); -// } - - protected JaxbFactory getFactory() { - return this.getPlatform().getFactory(); - } - - protected JaxbFile getJaxbFile(IFile file) { - return this.getJaxbProject().getJaxbFile(file); - } - - protected void updateNodes(Iterable nodes) { - for (JaxbContextNode node : nodes) { - node.update(); - } - } - - - // ********** CallbackChangeSupport.Listener support ********** - - protected void aspectChanged(String aspectName) { - if (this.aspectTriggersUpdate(aspectName)) { -// String msg = Thread.currentThread() + " aspect change: " + this + ": " + aspectName; -// System.out.println(msg); -// new Exception(msg).printStackTrace(System.out); - this.stateChanged(); - } - } - - private boolean aspectTriggersUpdate(String aspectName) { - return ! this.aspectDoesNotTriggerUpdate(aspectName); - } - - protected boolean aspectDoesNotTriggerUpdate(String aspectName) { - // ignore state changes so we don't get a stack overflow :-) - // (and we don't use state changes except here) - return (aspectName == null) || - this.nonUpdateAspectNames().contains(aspectName); - } - - protected final Set nonUpdateAspectNames() { - synchronized (nonUpdateAspectNameSets) { - HashSet nonUpdateAspectNames = nonUpdateAspectNameSets.get(this.getClass()); - if (nonUpdateAspectNames == null) { - nonUpdateAspectNames = new HashSet(); - this.addNonUpdateAspectNamesTo(nonUpdateAspectNames); - nonUpdateAspectNameSets.put(this.getClass(), nonUpdateAspectNames); - } - return nonUpdateAspectNames; - } - } - - private static final HashMap, HashSet> nonUpdateAspectNameSets = new HashMap, HashSet>(); - - protected void addNonUpdateAspectNamesTo(@SuppressWarnings("unused") Set nonUpdateAspectNames) { - // when you override this method, don't forget to include: - // super.addNonUpdateAspectNamesTo(nonUpdateAspectNames); - } - - public void stateChanged() { - this.fireStateChanged(); - if (this.parent != null) { - this.parent.stateChanged(); - } - } - - - /** - * Adapter used to synchronize a context collection container with its corresponding - * resource container. - * @param the type of context elements - * @param the type of resource elements - */ - protected abstract class CollectionContainer { - - protected final Vector contextElements = new Vector(); - - protected CollectionContainer() { - super(); - this.initializeContextElements(); - } - - /** - * Return the container's current set of resource elements. - * These are what the context elements will be synchronized to. - */ - protected abstract Iterable getResourceElements(); - - /** - * Return the resource element corresponding to the specified context - * element. - */ - protected abstract R getResourceElement(C contextElement); - - /** - * Build and return a context element for the given resource element - */ - protected abstract C buildContextElement(R resourceElement); - - /** - * Return the property name for event notification when the collection is changed. - */ - protected abstract String getContextElementsPropertyName(); - - protected void initializeContextElements() { - for (R resourceElement : this.getResourceElements()) { - this.contextElements.add(this.buildContextElement(resourceElement)); - } - } - - /** - * Return an Iterable of the context elements - */ - public Iterable getContextElements() { - return new LiveCloneIterable(this.contextElements); - } - - /** - * Return the size of the context elements collection - */ - public int getContextElementsSize() { - return this.contextElements.size(); - } - - /** - * Add a context element for the specified resource element at the - * specified index. - */ - public C addContextElement(int index, R resourceElement) { - return this.addContextElement_(index, this.buildContextElement(resourceElement)); - } - - /** - * Add the specified context element to the collection ignoring - * the specified index as we only have a collection - */ - protected C addContextElement_(@SuppressWarnings("unused") int index, C contextElement) { - AbstractJaxbNode.this.addItemToCollection(contextElement, this.contextElements, this.getContextElementsPropertyName()); - return contextElement; - } - - /** - * Remove the specified context element from the container. - */ - public void removeContextElement(C element) { - AbstractJaxbNode.this.removeItemFromCollection(element, this.contextElements, this.getContextElementsPropertyName()); - } - - @SuppressWarnings("unused") - protected void moveContextElement(int index, C element) { - //no-op, not a list - } - } - - /** - * Adapter used to synchronize a context collection container with its corresponding - * resource container. - * @param the type of context elements - * @param the type of resource elements - */ - protected abstract class ContextCollectionContainer extends CollectionContainer { - - protected ContextCollectionContainer() { - super(); - } - - /** - * Using the specified adapter, synchronize a context container with its - * corresponding resource container: moving, removing, and adding elements - * as necessary. - *

- * We can do this because:

    - *
  • the XML translators will move the EMF elements when - * appropriate (as opposed to simply rebuilding them in place). - *
  • the Java resource model will re-use existing annotations when - * appropriate (as opposed to simply rebuilding them in place). - *
- */ - public void synchronizeWithResourceModel() { - sync(true); // true = sync - } - - /** - * @see #synchronizeWithResourceModel(Adapter) - */ - public void update() { - sync(false); // false = update - } - - /** - * The specified sync flag controls whether any surviving - * context nodes are either synchronized (true) or - * updated (false). - */ - protected void sync(boolean sync) { - HashSet contextElements = CollectionTools.set(this.getContextElements()); - int resourceIndex = 0; - - for (R resourceElement : this.getResourceElements()) { - boolean match = false; - for (Iterator stream = contextElements.iterator(); stream.hasNext(); ) { - C contextElement = stream.next(); - if (Tools.valuesAreEqual(this.getResourceElement(contextElement), resourceElement)) { - // we don't know the source index because the element has been moved by previously moved elements - this.moveContextElement(resourceIndex, contextElement); - stream.remove(); - if (sync) { - contextElement.synchronizeWithResourceModel(); - } else { - contextElement.update(); - } - match = true; - break; - } - } - if ( ! match) { - // added elements are sync'ed during construction or will be - // updated during the next "update" (which is triggered by - // their addition to the model) - this.addContextElement(resourceIndex, resourceElement); - } - resourceIndex++; - } - // remove any leftover context elements - for (C contextElement : contextElements) { - this.removeContextElement(contextElement); - } - } - } - - /** - * Adapter used to synchronize a context list container with its corresponding - * resource container. - * @param the type of context elements - * @param the type of resource elements - */ - protected abstract class ListContainer - extends CollectionContainer { - - protected ListContainer() { - super(); - } - - @Override - public ListIterable getContextElements() { - return new LiveCloneListIterable(this.contextElements); - } - - @Override - protected abstract ListIterable getResourceElements(); - - /** - * Return the index of the specified context element. - */ - public int indexOfContextElement(C contextElement) { - return this.contextElements.indexOf(contextElement); - } - - public C contextElementAt(int index) { - return this.contextElements.elementAt(index); - } - - /** - * Add a context element for the specified resource element at the - * specified index. - */ - @Override - protected C addContextElement_(int index, C contextElement) { - AbstractJaxbNode.this.addItemToList(index, contextElement, this.contextElements, this.getContextElementsPropertyName()); - return contextElement; - } - - /** - * Move the context element at the specified target index to the - * specified source index. - */ - public void moveContextElement(int targetIndex, int sourceIndex) { - this.moveContextElement(targetIndex, this.contextElements.get(sourceIndex)); - } - - /** - * Move the specified context element to the specified index. - */ - @Override - public void moveContextElement(int index, C element) { - AbstractJaxbNode.this.moveItemInList(index, element, this.contextElements, this.getContextElementsPropertyName()); - } - - /** - * Remove the context element at the specified index from the container. - */ - public void removeContextElement(int index) { - AbstractJaxbNode.this.removeItemFromList(index, this.contextElements, this.getContextElementsPropertyName()); - } - - public void synchronizeWithResourceModel() { - ListIterable resourceElements = getResourceElements(); - - int index = 0; - for (R resourceElement : resourceElements) { - if (this.getContextElementsSize() > index) { - if (this.contextElementAt(index) != resourceElement) { - this.addContextElement(index, resourceElement); - } - } - else { - this.addContextElement(index, resourceElement); - } - index++; - } - - for ( ; index < this.getContextElementsSize(); ) { - this.removeContextElement(index); - } - } - } - - /** - * Adapter used to synchronize a context list container with its corresponding - * resource container. - * @param the type of context elements - * @param the type of resource elements - */ - protected abstract class ContextListContainer - extends ContextCollectionContainer { - - protected ContextListContainer() { - super(); - } - - @Override - public ListIterable getContextElements() { - return new LiveCloneListIterable(this.contextElements); - } - - @Override - protected abstract ListIterable getResourceElements(); - - /** - * Return the index of the specified context element. - */ - public int indexOfContextElement(C contextElement) { - return this.contextElements.indexOf(contextElement); - } - - public C contextElementAt(int index) { - return this.contextElements.elementAt(index); - } - - /** - * Add a context element for the specified resource element at the - * specified index. - */ - @Override - protected C addContextElement_(int index, C contextElement) { - AbstractJaxbNode.this.addItemToList(index, contextElement, this.contextElements, this.getContextElementsPropertyName()); - return contextElement; - } - - /** - * Move the context element at the specified target index to the - * specified source index. - */ - public void moveContextElement(int targetIndex, int sourceIndex) { - this.moveContextElement(targetIndex, this.contextElements.get(sourceIndex)); - } - - /** - * Move the specified context element to the specified index. - */ - @Override - public void moveContextElement(int index, C element) { - AbstractJaxbNode.this.moveItemInList(index, element, this.contextElements, this.getContextElementsPropertyName()); - } - - /** - * Remove the context element at the specified index from the container. - */ - public void removeContextElement(int index) { - AbstractJaxbNode.this.removeItemFromList(index, this.contextElements, this.getContextElementsPropertyName()); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbPlatformDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbPlatformDefinition.java deleted file mode 100644 index 738774eaa7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbPlatformDefinition.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal; - -import java.util.ArrayList; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.JaxbResourceModelProvider; -import org.eclipse.jpt.jaxb.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotationDefinition; - -/** - * All the state in the JAXB platform definition should be "static" - * (i.e. unchanging once it is initialized). - */ -public abstract class AbstractJaxbPlatformDefinition - implements JaxbPlatformDefinition { - - private AnnotationDefinition[] annotationDefinitions; - - private NestableAnnotationDefinition[] nestableAnnotationDefinitions; - - private JaxbResourceModelProvider[] resourceModelProviders; - - private ArrayList defaultJavaAttributeMappingDefinitions; - - private ArrayList specifiedJavaAttributeMappingDefinitions; - -// private ResourceDefinition[] resourceDefinitions; - - - /** - * zero-argument constructor - */ - protected AbstractJaxbPlatformDefinition() { - super(); - } - - - // ********** annotation definitions ********** - - public AnnotationDefinition[] getAnnotationDefinitions() { - if (this.annotationDefinitions == null) { - this.annotationDefinitions = this.buildAnnotationDefinitions(); - } - return this.annotationDefinitions; - } - - protected abstract AnnotationDefinition[] buildAnnotationDefinitions(); - - - // ********** nestable annotation definitions ********** - - public NestableAnnotationDefinition[] getNestableAnnotationDefinitions() { - if (this.nestableAnnotationDefinitions == null) { - this.nestableAnnotationDefinitions = this.buildNestableAnnotationDefinitions(); - } - return this.nestableAnnotationDefinitions; - } - - protected abstract NestableAnnotationDefinition[] buildNestableAnnotationDefinitions(); - - - // ********** resource models ********** - - public ListIterable getResourceModelProviders() { - return new ArrayListIterable(getResourceModelProviders_()); - } - - protected synchronized JaxbResourceModelProvider[] getResourceModelProviders_() { - if (this.resourceModelProviders == null) { - this.resourceModelProviders = this.buildResourceModelProviders(); - } - return this.resourceModelProviders; - } - - protected abstract JaxbResourceModelProvider[] buildResourceModelProviders(); - - - // ********** Java attribute mappings ********** - - public synchronized Iterable getDefaultJavaAttributeMappingDefinitions() { - if (this.defaultJavaAttributeMappingDefinitions == null) { - this.defaultJavaAttributeMappingDefinitions = this.buildDefaultJavaAttributeMappingDefinitions(); - } - return this.defaultJavaAttributeMappingDefinitions; - } - - protected ArrayList buildDefaultJavaAttributeMappingDefinitions() { - ArrayList definitions = new ArrayList(); - this.addDefaultJavaAttributeMappingDefinitionsTo(definitions); - return definitions; - } - - /** - * To the specified list, add mapping definitions to use for analyzing the - * default mapping of an attribute. The order is important, - * as once a mapping definition tests positive for an attribute, - * all following mapping definitions are ignored. - */ - protected abstract void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList definitions); - - public synchronized Iterable getSpecifiedJavaAttributeMappingDefinitions() { - if (this.specifiedJavaAttributeMappingDefinitions == null) { - this.specifiedJavaAttributeMappingDefinitions = this.buildSpecifiedJavaAttributeMappingDefinitions(); - } - return this.specifiedJavaAttributeMappingDefinitions; - } - - protected ArrayList buildSpecifiedJavaAttributeMappingDefinitions() { - ArrayList definitions = new ArrayList(); - this.addSpecifiedJavaAttributeMappingDefinitionsTo(definitions); - return definitions; - } - - /** - * To the specified list, add mapping definitions to use for analyzing the - * specified mapping of an attribute given all annotations on it. The order - * is important, as once a mapping definition tests positive for an - * attribute, all following mapping definitions are ignored. - */ - protected abstract void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList definitions); - - -// // ********** Mapping Files ********** -// -// public ListIterator resourceDefinitions() { -// return new ArrayListIterator(getResourceDefinitions()); -// } -// -// protected synchronized ResourceDefinition[] getResourceDefinitions() { -// if (this.resourceDefinitions == null) { -// this.resourceDefinitions = this.buildResourceDefinitions(); -// } -// return this.resourceDefinitions; -// } -// -// protected abstract ResourceDefinition[] buildResourceDefinitions(); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbProject.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbProject.java deleted file mode 100644 index 5d1b402f07..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/AbstractJaxbProject.java +++ /dev/null @@ -1,1638 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal; - -import java.util.ArrayList; -import java.util.List; -import java.util.Vector; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceDeltaVisitor; -import org.eclipse.core.resources.IResourceProxy; -import org.eclipse.core.resources.IResourceProxyVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jdt.core.ElementChangedEvent; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaElementDelta; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageDeclaration; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.JptResourceModel; -import org.eclipse.jpt.common.core.JptResourceModelListener; -import org.eclipse.jpt.common.core.internal.utility.PlatformTools; -import org.eclipse.jpt.common.core.resource.ResourceLocator; -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.internal.BitTools; -import org.eclipse.jpt.common.utility.internal.NotNullFilter; -import org.eclipse.jpt.common.utility.internal.ThreadLocalCommandExecutor; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.common.utility.internal.synchronizers.CallbackSynchronousSynchronizer; -import org.eclipse.jpt.common.utility.internal.synchronizers.SynchronousSynchronizer; -import org.eclipse.jpt.common.utility.synchronizers.CallbackSynchronizer; -import org.eclipse.jpt.common.utility.synchronizers.Synchronizer; -import org.eclipse.jpt.jaxb.core.JaxbFacet; -import org.eclipse.jpt.jaxb.core.JaxbFile; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.SchemaLibrary; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; -import org.eclipse.jpt.jaxb.core.context.JaxbType; -import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode; -import org.eclipse.jpt.jaxb.core.internal.platform.JaxbPlatformImpl; -import org.eclipse.jpt.jaxb.core.internal.validation.DefaultValidationMessages; -import org.eclipse.jpt.jaxb.core.internal.validation.JaxbValidationMessages; -import org.eclipse.jpt.jaxb.core.libprov.JaxbLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatform; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackageInfoCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderFramework; -import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * JAXB project. Holds all the JAXB stuff. - * - * The JAXB platform provides the hooks for vendor-specific stuff. - * - * The JAXB files are the "resource" model (i.e. objects that correspond directly - * to Eclipse resources; e.g. Java source code files, XML files, JAR files). - * - * The root context node is the "context" model (i.e. objects that attempt to - * model the JAXB spec, using the "resource" model as an adapter to the Eclipse - * resources). - */ -public abstract class AbstractJaxbProject - extends AbstractJaxbNode - implements JaxbProject { - - /** - * The Eclipse project corresponding to the JAXB project. - */ - protected final IProject project; - - /** - * The vendor-specific JAXB platform that builds the JAXB project - * and all its contents. - */ - protected final JaxbPlatform jaxbPlatform; - - /** - * The library of schemas associated with this project - */ - protected final SchemaLibraryImpl schemaLibrary; - - /** - * The JAXB files associated with the JAXB project: - * java - * jaxb.index - * platform-specific files - */ - protected final Vector jaxbFiles = new Vector(); - -// /** -// * The "external" Java resource compilation units (source). Populated upon demand. -// */ -// protected final Vector externalJavaResourceCompilationUnits = new Vector(); -// -// /** -// * The "external" Java resource persistent types (binary). Populated upon demand. -// */ -// protected final JavaResourcePersistentTypeCache externalJavaResourcePersistentTypeCache; - - /** - * Resource models notify this listener when they change. A project update - * should occur any time a resource model changes. - */ - protected final JptResourceModelListener resourceModelListener; - - /** - * The root of the model representing the collated resources associated with - * the JAXB project. - */ - protected final JaxbContextRoot contextRoot; - - /** - * A pluggable synchronizer that keeps the JAXB - * project's context model synchronized with its resource model, either - * synchronously or asynchronously (or not at all). A synchronous synchronizer - * is the default. For performance reasons, a UI should - * immediately change this to an asynchronous synchronizer. A synchronous - * synchronizer can be used when the project is being manipulated by a "batch" - * (or non-UI) client (e.g. when testing "synchronization"). A null updater - * can used during tests that do not care whether "synchronization" occur. - * Clients will need to explicitly configure the synchronizer if they require - * an asynchronous synchronizer. - */ - protected volatile Synchronizer contextModelSynchronizer; - protected volatile boolean synchronizingContextModel = false; - - /** - * A pluggable synchronizer that "updates" the JAXB project, either - * synchronously or asynchronously (or not at all). A synchronous updater - * is the default, allowing a newly-constructed JAXB project to be "updated" - * upon return from the constructor. For performance reasons, a UI should - * immediately change this to an asynchronous updater. A synchronous - * updater can be used when the project is being manipulated by a "batch" - * (or non-UI) client (e.g. when testing the "update" behavior). A null - * updater can used during tests that do not care whether "synchronization" - * occur. - * Clients will need to explicitly configure the updater if they require - * an asynchronous updater. - */ - protected volatile CallbackSynchronizer updateSynchronizer; - protected final CallbackSynchronizer.Listener updateSynchronizerListener; - - /** - * Support for modifying documents shared with the UI. - */ - protected final ThreadLocalCommandExecutor modifySharedDocumentCommandExecutor; - - - // ********** constructor/initialization ********** - - protected AbstractJaxbProject(JaxbProject.Config config) { - super(null); // JPA project is the root of the containment tree - if ((config.getProject() == null) || (config.getPlatformDefinition() == null)) { - throw new NullPointerException(); - } - this.project = config.getProject(); - this.jaxbPlatform = new JaxbPlatformImpl(config.getPlatformDefinition()); - - this.schemaLibrary = new SchemaLibraryImpl(this); - - this.modifySharedDocumentCommandExecutor = this.buildModifySharedDocumentCommandExecutor(); - - this.resourceModelListener = this.buildResourceModelListener(); - // build the JPA files corresponding to the Eclipse project's files - InitialResourceProxyVisitor visitor = this.buildInitialResourceProxyVisitor(); - visitor.visitProject(this.project); - -// this.externalJavaResourcePersistentTypeCache = this.buildExternalJavaResourcePersistentTypeCache(); - - this.contextRoot = this.buildContextRoot(); - - // there *shouldn't* be any changes to the resource model... - this.setContextModelSynchronizer_(this.buildSynchronousContextModelSynchronizer()); - - this.updateSynchronizerListener = this.buildUpdateSynchronizerListener(); - // "update" the project before returning - this.setUpdateSynchronizer_(this.buildSynchronousUpdateSynchronizer()); - -// // start listening to this cache once the context model has been built -// // and all the external types are faulted in -// this.externalJavaResourcePersistentTypeCache.addResourceModelListener(this.resourceModelListener); - } - - @Override - protected boolean requiresParent() { - return false; - } - - @Override - public IResource getResource() { - return this.project; - } - - protected ThreadLocalCommandExecutor buildModifySharedDocumentCommandExecutor() { - return new ThreadLocalCommandExecutor(); - } - - protected InitialResourceProxyVisitor buildInitialResourceProxyVisitor() { - return new InitialResourceProxyVisitor(); - } -// -// protected JavaResourcePersistentTypeCache buildExternalJavaResourcePersistentTypeCache() { -// return new BinaryPersistentTypeCache(this.jpaPlatform.getAnnotationProvider()); -// } - - protected JaxbContextRoot buildContextRoot() { - return this.getFactory().buildContextRoot(this); - } - - // ***** inner class - protected class InitialResourceProxyVisitor implements IResourceProxyVisitor { - protected InitialResourceProxyVisitor() { - super(); - } - protected void visitProject(IProject p) { - try { - p.accept(this, IResource.NONE); - } catch (CoreException ex) { - // shouldn't happen - we don't throw any CoreExceptions - throw new RuntimeException(ex); - } - } - // add a JPA file for every [appropriate] file encountered by the visitor - public boolean visit(IResourceProxy resource) { - switch (resource.getType()) { - case IResource.ROOT : // shouldn't happen - return true; // visit children - case IResource.PROJECT : - return true; // visit children - case IResource.FOLDER : - return true; // visit children - case IResource.FILE : - AbstractJaxbProject.this.addJaxbFile_((IFile) resource.requestResource()); - return false; // no children - default : - return false; // no children - } - } - } - - -// // ********** miscellaneous ********** -// -// /** -// * Ignore changes to this collection. Adds can be ignored since they are triggered -// * by requests that will, themselves, trigger updates (typically during the -// * update of an object that calls a setter with the newly-created resource -// * type). Deletes will be accompanied by manual updates. -// */ -// @Override -// protected void addNonUpdateAspectNamesTo(Set nonUpdateAspectNames) { -// super.addNonUpdateAspectNamesTo(nonUpdateAspectNames); -// nonUpdateAspectNames.add(EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION); -// } - - - // ********** general queries ********** - - @Override - public JaxbProject getJaxbProject() { - return this; - } - - public String getName() { - return this.project.getName(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getName()); - } - - public IProject getProject() { - return this.project; - } - - public IJavaProject getJavaProject() { - return JavaCore.create(this.project); - } - - @Override - public JaxbPlatform getPlatform() { - return this.jaxbPlatform; - } - - public SchemaLibrary getSchemaLibrary() { - return this.schemaLibrary; - } - - @SuppressWarnings("unchecked") - protected Iterable getCombinedJavaResourceCompilationUnits() { - return this.getInternalJavaResourceCompilationUnits(); -// return new CompositeIterable( -// this.getInternalJavaResourceCompilationUnits(), -// this.getExternalJavaResourceCompilationUnits() -// ); - } - - - // ********** JAXB files ********** - - public Iterable getJaxbFiles() { - return new LiveCloneIterable(this.jaxbFiles); // read-only - } - - public int getJaxbFilesSize() { - return this.jaxbFiles.size(); - } - - protected Iterable getJaxbFiles(final IContentType contentType) { - return new FilteringIterable(this.getJaxbFiles()) { - @Override - protected boolean accept(JaxbFile jaxbFile) { - return jaxbFile.getContentType().isKindOf(contentType); - } - }; - } - - @Override - public JaxbFile getJaxbFile(IFile file) { - for (JaxbFile jaxbFile : this.getJaxbFiles()) { - if (jaxbFile.getFile().equals(file)) { - return jaxbFile; - } - } - return null; - } - - /** - * Add a JAXB file for the specified file, if appropriate. - * Return true if a JAXB File was created and added, false otherwise - */ - protected boolean addJaxbFile(IFile file) { - JaxbFile jaxbFile = this.addJaxbFile_(file); - if (jaxbFile != null) { - this.fireItemAdded(JAXB_FILES_COLLECTION, jaxbFile); - return true; - } - return false; - } - - /** - * Add a JAXB file for the specified file, if appropriate, without firing - * an event; useful during construction. - * Return the new JAXB file, null if it was not created. - */ - protected JaxbFile addJaxbFile_(IFile file) { - if (isJavaFile(file)) { - if (! getJavaProject().isOnClasspath(file)) { - // a java (.jar or .java) file must be on the Java classpath - return null; - } - } - else if (! isInAcceptableResourceLocation(file)) { - return null; - } - - JaxbFile jaxbFile = null; - try { - jaxbFile = this.getPlatform().buildJaxbFile(this, file); - } - catch (Exception e) { - //log any developer exceptions and don't build a JaxbFile rather - //than completely failing to build the JaxbProject - JptJaxbCorePlugin.log(e); - } - if (jaxbFile == null) { - return null; - } - jaxbFile.getResourceModel().addResourceModelListener(this.resourceModelListener); - this.jaxbFiles.add(jaxbFile); - return jaxbFile; - } - - /* file is .java or .jar */ - protected boolean isJavaFile(IFile file) { - IContentType contentType = PlatformTools.getContentType(file); - return contentType != null - && (contentType.isKindOf(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE) - || contentType.isKindOf(JptCommonCorePlugin.JAR_CONTENT_TYPE)); - } - - /* (non-java resource) file is in acceptable resource location */ - protected boolean isInAcceptableResourceLocation(IFile file) { - ResourceLocator resourceLocator = JptCommonCorePlugin.getResourceLocator(getProject()); - return resourceLocator.acceptResourceLocation(getProject(), file.getParent()); - } - - /** - * Remove the JAXB file corresponding to the specified IFile, if it exists. - * Return true if a JAXB File was removed, false otherwise - */ - protected boolean removeJaxbFile(IFile file) { - JaxbFile jaxbFile = this.getJaxbFile(file); - if (jaxbFile != null) { // a JpaFile is not added for every IFile - this.removeJaxbFile(jaxbFile); - return true; - } - return false; - } - - /** - * Stop listening to the JAXB file and remove it. - */ - protected void removeJaxbFile(JaxbFile jaxbFile) { - jaxbFile.getResourceModel().removeResourceModelListener(this.resourceModelListener); - if ( ! this.removeItemFromCollection(jaxbFile, this.jaxbFiles, JAXB_FILES_COLLECTION)) { - throw new IllegalArgumentException(jaxbFile.toString()); - } - } - - -// // ********** external Java resource persistent types (source or binary) ********** -// -// protected JavaResourcePersistentType buildPersistableExternalJavaResourcePersistentType(String typeName) { -// IType jdtType = this.findType(typeName); -// return (jdtType == null) ? null : this.buildPersistableExternalJavaResourcePersistentType(jdtType); -// } -// -// protected IType findType(String typeName) { -// try { -// return this.getJavaProject().findType(typeName); -// } catch (JavaModelException ex) { -// return null; // ignore exception? -// } -// } -// -// protected JavaResourcePersistentType buildPersistableExternalJavaResourcePersistentType(IType jdtType) { -// JavaResourcePersistentType jrpt = this.buildExternalJavaResourcePersistentType(jdtType); -// return ((jrpt != null) && jrpt.isPersistable()) ? jrpt : null; -// } -// -// protected JavaResourcePersistentType buildExternalJavaResourcePersistentType(IType jdtType) { -// return jdtType.isBinary() ? -// this.buildBinaryExternalJavaResourcePersistentType(jdtType) : -// this.buildSourceExternalJavaResourcePersistentType(jdtType); -// } -// -// protected JavaResourcePersistentType buildBinaryExternalJavaResourcePersistentType(IType jdtType) { -// return this.externalJavaResourcePersistentTypeCache.addPersistentType(jdtType); -// } -// -// protected JavaResourcePersistentType buildSourceExternalJavaResourcePersistentType(IType jdtType) { -// JavaResourceCompilationUnit jrcu = this.getExternalJavaResourceCompilationUnit(jdtType.getCompilationUnit()); -// String jdtTypeName = jdtType.getFullyQualifiedName('.'); // JDT member type names use '$' -// for (Iterator stream = jrcu.persistentTypes(); stream.hasNext(); ) { -// JavaResourcePersistentType jrpt = stream.next(); -// if (jrpt.getQualifiedName().equals(jdtTypeName)) { -// return jrpt; -// } -// } -// // we can get here if the project JRE is removed; -// // see SourceCompilationUnit#getPrimaryType(CompilationUnit) -// // bug 225332 -// return null; -// } -// -// -// // ********** external Java resource persistent types (binary) ********** -// -// public JavaResourcePersistentTypeCache getExternalJavaResourcePersistentTypeCache() { -// return this.externalJavaResourcePersistentTypeCache; -// } -// -// -// // ********** external Java resource compilation units (source) ********** -// -// public Iterator externalJavaResourceCompilationUnits() { -// return this.getExternalJavaResourceCompilationUnits().iterator(); -// } -// -// protected Iterable getExternalJavaResourceCompilationUnits() { -// return new LiveCloneIterable(this.externalJavaResourceCompilationUnits); // read-only -// } -// -// public int externalJavaResourceCompilationUnitsSize() { -// return this.externalJavaResourceCompilationUnits.size(); -// } -// -// /** -// * Return the resource model compilation unit corresponding to the specified -// * JDT compilation unit. If it does not exist, build it. -// */ -// protected JavaResourceCompilationUnit getExternalJavaResourceCompilationUnit(ICompilationUnit jdtCompilationUnit) { -// for (JavaResourceCompilationUnit jrcu : this.getExternalJavaResourceCompilationUnits()) { -// if (jrcu.getCompilationUnit().equals(jdtCompilationUnit)) { -// // we will get here if the JRCU could not build its persistent type... -// return jrcu; -// } -// } -// return this.addExternalJavaResourceCompilationUnit(jdtCompilationUnit); -// } -// -// /** -// * Add an external Java resource compilation unit. -// */ -// protected JavaResourceCompilationUnit addExternalJavaResourceCompilationUnit(ICompilationUnit jdtCompilationUnit) { -// JavaResourceCompilationUnit jrcu = this.buildJavaResourceCompilationUnit(jdtCompilationUnit); -// this.addItemToCollection(jrcu, this.externalJavaResourceCompilationUnits, EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION); -// jrcu.addResourceModelListener(this.resourceModelListener); -// return jrcu; -// } -// -// protected JavaResourceCompilationUnit buildJavaResourceCompilationUnit(ICompilationUnit jdtCompilationUnit) { -// return new SourceTypeCompilationUnit( -// jdtCompilationUnit, -// this.jpaPlatform.getAnnotationProvider(), -// this.jpaPlatform.getAnnotationEditFormatter(), -// this.modifySharedDocumentCommandExecutor -// ); -// } -// -// protected boolean removeExternalJavaResourceCompilationUnit(IFile file) { -// for (JavaResourceCompilationUnit jrcu : this.getExternalJavaResourceCompilationUnits()) { -// if (jrcu.getFile().equals(file)) { -// this.removeExternalJavaResourceCompilationUnit(jrcu); -// return true; -// } -// } -// return false; -// } -// -// protected void removeExternalJavaResourceCompilationUnit(JavaResourceCompilationUnit jrcu) { -// jrcu.removeResourceModelListener(this.resourceModelListener); -// this.removeItemFromCollection(jrcu, this.externalJavaResourceCompilationUnits, EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION); -// } - - - // ********** context model ********** - - public JaxbContextRoot getContextRoot() { - return this.contextRoot; - } - - public Iterable getPrimaryJavaNodes(ICompilationUnit cu) { - IFile file = getCorrespondingResource(cu); - if (file == null) { - return EmptyIterable.instance(); - } - - IContentType contentType = PlatformTools.getContentType(file); - if (contentType == null) { - return EmptyIterable.instance(); - } - - if (contentType.isKindOf(JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE)) { - try { - return new FilteringIterable( - new TransformationIterable( - new ArrayIterable(cu.getPackageDeclarations())) { - @Override - protected JaxbPackageInfo transform(IPackageDeclaration o) { - JaxbPackage jaxbPackage = getContextRoot().getPackage(o.getElementName()); - return (jaxbPackage != null) ? jaxbPackage.getPackageInfo() : null; - } - }, - NotNullFilter.instance()); - } - catch (JavaModelException jme) { - return EmptyIterable.instance(); - } - } - else if (contentType.isKindOf(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) { - try { - return new FilteringIterable( - new TransformationIterable( - new ArrayIterable(cu.getAllTypes())) { - @Override - protected JaxbType transform(IType o) { - JaxbType jaxbType = getContextRoot().getType(o.getFullyQualifiedName('.')); - return jaxbType; - } - }, - NotNullFilter.instance()); - } - catch (JavaModelException jme) { - return EmptyIterable.instance(); - } - } - - return EmptyIterable.instance(); - } - - private IFile getCorrespondingResource(ICompilationUnit cu) { - try { - return (IFile) cu.getCorrespondingResource(); - } - catch (JavaModelException ex) { - JptJaxbCorePlugin.log(ex); - return null; - } - } - - -// // ********** utility ********** -// -// public IFile getPlatformFile(IPath runtimePath) { -// return JptCorePlugin.getPlatformFile(this.project, runtimePath); -// } - - -// -// /** -// * If the specified file exists, is significant to the JPA project, and its -// * content is a "kind of" the specified content type, return the JPA -// * resource model corresponding to the file; otherwise, return null. -// */ -// protected JpaResourceModel getResourceModel(IPath runtimePath, IContentType contentType) { -// IFile file = this.getPlatformFile(runtimePath); -// return file.exists() ? this.getResourceModel(file, contentType) : null; -// } -// -// /** -// * If the specified file is significant to the JPA project and its content -// * is a "kind of" the specified content type, return the JPA resource model -// * corresponding to the file; otherwise, return null. -// */ -// protected JpaResourceModel getResourceModel(IFile file, IContentType contentType) { -// JpaFile jpaFile = this.getJpaFile(file); -// return (jpaFile == null) ? null : jpaFile.getResourceModel(contentType); -// } - - - // ********** annotated Java source classes ********** - - /** - * Return all {@link JavaResourceType}s that are represented by java source within this project - */ - public Iterable getJavaSourceResourceTypes() { - return new CompositeIterable(this.getInternalJavaSourceResourceTypeSets()); - } - - /** - * Return all {@link JavaResourceType}s that are represented by java source within this project, - * that are also annotated with a recognized annotation - */ - public Iterable getAnnotatedJavaSourceResourceTypes() { - return new FilteringIterable(getJavaSourceResourceTypes()) { - @Override - protected boolean accept(JavaResourceType type) { - return type.isAnnotated(); - } - }; - } - -// public Iterable getAnnotatedJavaSourceClassNames() { -// return new TransformationIterable(this.getInternalAnnotatedSourceJavaResourceTypes()) { -// @Override -// protected String transform(JavaResourceType type) { -// return type.getQualifiedName(); -// } -// }; -// } - - /* - * Return the sets of {@link JavaResourceType}s that are represented by java source within this project - */ - protected Iterable> getInternalJavaSourceResourceTypeSets() { - return new TransformationIterable>(this.getInternalJavaResourceCompilationUnits()) { - @Override - protected Iterable transform(JavaResourceCompilationUnit compilationUnit) { - return compilationUnit.getTypes(); - } - }; - } - - protected Iterable getInternalJavaResourceCompilationUnits() { - return new TransformationIterable(this.getJavaSourceJaxbFiles()) { - @Override - protected JavaResourceCompilationUnit transform(JaxbFile jaxbFile) { - return (JavaResourceCompilationUnit) jaxbFile.getResourceModel(); - } - }; - } - - /** - * Return all {@link JavaResourceType}s that are represented by java source within this project - */ - public Iterable getJavaSourceResourceEnums() { - return new CompositeIterable(this.getInternalJavaSourceResourceEnumSets()); - } - - /* - * Return the sets of {@link JavaResourceType}s that are represented by java source within this project - */ - protected Iterable> getInternalJavaSourceResourceEnumSets() { - return new TransformationIterable>(this.getInternalJavaResourceCompilationUnits()) { - @Override - protected Iterable transform(JavaResourceCompilationUnit compilationUnit) { - return compilationUnit.getEnums(); - } - }; - } - - /** - * return JAXB files with Java source "content" - */ - protected Iterable getJavaSourceJaxbFiles() { - return this.getJaxbFiles(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE); - } - - - // ********** Java resource package look-up ********** - - public Iterable getJavaResourcePackages(){ - return new FilteringIterable( - new TransformationIterable(this.getPackageInfoSourceJaxbFiles()) { - @Override - protected JavaResourcePackage transform(JaxbFile jaxbFile) { - return ((JavaResourcePackageInfoCompilationUnit) jaxbFile.getResourceModel()).getPackage(); - } - }) { - - @Override - protected boolean accept(JavaResourcePackage resourcePackage) { - return resourcePackage != null; - } - }; - } - - public JavaResourcePackage getJavaResourcePackage(String packageName) { - for (JavaResourcePackage jrp : this.getJavaResourcePackages()) { - if (jrp.getName().equals(packageName)) { - return jrp; - } - } - return null; - } - - public Iterable getAnnotatedJavaResourcePackages() { - return new FilteringIterable(this.getJavaResourcePackages()) { - @Override - protected boolean accept(JavaResourcePackage resourcePackage) { - return resourcePackage.isAnnotated(); // i.e. the package has a valid package annotation - } - }; - } - - public JavaResourcePackage getAnnotatedJavaResourcePackage(String packageName) { - JavaResourcePackage jrp = getJavaResourcePackage(packageName); - return (jrp != null && jrp.isAnnotated()) ? jrp : null; - } - - /** - * return JPA files with package-info source "content" - */ - protected Iterable getPackageInfoSourceJaxbFiles() { - return this.getJaxbFiles(JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE); - } - - - // ********** Java resource type look-up ********** - - - public JavaResourceType getJavaResourceType(String typeName) { - for (JavaResourceType type : this.getJavaResourceTypes()) { - if (type.getQualifiedName().equals(typeName)) { - return type; - } - } - return null; -// // if we don't have a type already, try to build new one from the project classpath -// return this.buildPersistableExternalJavaResourcePersistentType(typeName); - } - - public JavaResourceEnum getJavaResourceEnum(String enumName) { - for (JavaResourceEnum enum_ : this.getJavaSourceResourceEnums()) { - if (enum_.getQualifiedName().equals(enumName)) { - return enum_; - } - } - return null; -// // if we don't have a type already, try to build new one from the project classpath -// return this.buildPersistableExternalJavaResourcePersistentType(typeName); - } - - /** - * return *all* the Java resource persistent types, including those in JARs referenced in - * persistence.xml - */ - protected Iterable getJavaResourceTypes() { - return new CompositeIterable(this.getJavaResourceTypeSets()); - } - - /** - * return *all* the Java resource persistent types, including those in JARs referenced in - * persistence.xml - */ - protected Iterable> getJavaResourceTypeSets() { - return new TransformationIterable>(this.getJavaResourceNodeRoots()) { - @Override - protected Iterable transform(JavaResourceNode.Root root) { - return root.getTypes(); - } - }; - } - - @SuppressWarnings("unchecked") - protected Iterable getJavaResourceNodeRoots() { - return new CompositeIterable( - this.getInternalJavaResourceCompilationUnits()/*, - this.getInternalJavaResourcePackageFragmentRoots(), - this.getExternalJavaResourceCompilationUnits(), - Collections.singleton(this.externalJavaResourcePersistentTypeCache)*/ - ); - } - - -// // ********** JARs ********** -// -// // TODO -// public JavaResourcePackageFragmentRoot getJavaResourcePackageFragmentRoot(String jarFileName) { -//// return this.getJarResourcePackageFragmentRoot(this.convertToPlatformFile(jarFileName)); -// return this.getJavaResourcePackageFragmentRoot(this.getProject().getFile(jarFileName)); -// } -// -// protected JavaResourcePackageFragmentRoot getJavaResourcePackageFragmentRoot(IFile jarFile) { -// for (JavaResourcePackageFragmentRoot pfr : this.getInternalJavaResourcePackageFragmentRoots()) { -// if (pfr.getFile().equals(jarFile)) { -// return pfr; -// } -// } -// return null; -// } -// -// protected Iterable getInternalJavaResourcePackageFragmentRoots() { -// return new TransformationIterable(this.getJarJpaFiles()) { -// @Override -// protected JavaResourcePackageFragmentRoot transform(JpaFile jpaFile) { -// return (JavaResourcePackageFragmentRoot) jpaFile.getResourceModel(); -// } -// }; -// } -// -// /** -// * return JPA files with JAR "content" -// */ -// protected Iterable getJarJpaFiles() { -// return this.getJpaFiles(JptCorePlugin.JAR_CONTENT_TYPE); -// } - - - -// -// // ********** Java source folder names ********** -// -// public Iterable getJavaSourceFolderNames() { -// try { -// return this.getJavaSourceFolderNames_(); -// } catch (JavaModelException ex) { -// JptCorePlugin.log(ex); -// return EmptyIterable.instance(); -// } -// } -// -// protected Iterable getJavaSourceFolderNames_() throws JavaModelException { -// return new TransformationIterable(this.getJavaSourceFolders()) { -// @Override -// protected String transform(IPackageFragmentRoot pfr) { -// try { -// return this.transform_(pfr); -// } catch (JavaModelException ex) { -// return "Error: " + pfr.getPath(); //$NON-NLS-1$ -// } -// } -// private String transform_(IPackageFragmentRoot pfr) throws JavaModelException { -// return pfr.getUnderlyingResource().getProjectRelativePath().toString(); -// } -// }; -// } -// -// protected Iterable getJavaSourceFolders() throws JavaModelException { -// return new FilteringIterable( -// this.getPackageFragmentRoots(), -// SOURCE_PACKAGE_FRAGMENT_ROOT_FILTER -// ); -// } -// -// protected static final Filter SOURCE_PACKAGE_FRAGMENT_ROOT_FILTER = -// new Filter() { -// public boolean accept(IPackageFragmentRoot pfr) { -// try { -// return this.accept_(pfr); -// } catch (JavaModelException ex) { -// return false; -// } -// } -// private boolean accept_(IPackageFragmentRoot pfr) throws JavaModelException { -// return pfr.exists() && (pfr.getKind() == IPackageFragmentRoot.K_SOURCE); -// } -// }; -// -// protected Iterable getPackageFragmentRoots() throws JavaModelException { -// return new ArrayIterable(this.getJavaProject().getPackageFragmentRoots()); -// } - - - // ********** Java events ********** - - // TODO handle changes to external projects - public void javaElementChanged(ElementChangedEvent event) { - this.processJavaDelta(event.getDelta()); - } - - /** - * We recurse back here from {@link #processJavaDeltaChildren(IJavaElementDelta)}. - */ - protected void processJavaDelta(IJavaElementDelta delta) { - switch (delta.getElement().getElementType()) { - case IJavaElement.JAVA_MODEL : - this.processJavaModelDelta(delta); - break; - case IJavaElement.JAVA_PROJECT : - this.processJavaProjectDelta(delta); - break; - case IJavaElement.PACKAGE_FRAGMENT_ROOT : - this.processJavaPackageFragmentRootDelta(delta); - break; - case IJavaElement.PACKAGE_FRAGMENT : - this.processJavaPackageFragmentDelta(delta); - break; - case IJavaElement.COMPILATION_UNIT : - this.processJavaCompilationUnitDelta(delta); - break; - default : - break; // ignore the elements inside a compilation unit - } - } - - protected void processJavaDeltaChildren(IJavaElementDelta delta) { - for (IJavaElementDelta child : delta.getAffectedChildren()) { - this.processJavaDelta(child); // recurse - } - } - - /** - * Return whether the specified Java element delta is for a - * {@link IJavaElementDelta#CHANGED CHANGED} - * (as opposed to {@link IJavaElementDelta#ADDED ADDED} or - * {@link IJavaElementDelta#REMOVED REMOVED}) Java element - * and the specified flag is set. - * (The delta flags are only significant if the delta - * {@link IJavaElementDelta#getKind() kind} is - * {@link IJavaElementDelta#CHANGED CHANGED}.) - */ - protected boolean deltaFlagIsSet(IJavaElementDelta delta, int flag) { - return (delta.getKind() == IJavaElementDelta.CHANGED) && - BitTools.flagIsSet(delta.getFlags(), flag); - } - - // ***** model - protected void processJavaModelDelta(IJavaElementDelta delta) { - // process the Java model's projects - this.processJavaDeltaChildren(delta); - } - - // ***** project - protected void processJavaProjectDelta(IJavaElementDelta delta) { - // process the Java project's package fragment roots - this.processJavaDeltaChildren(delta); - - // a classpath change can have pretty far-reaching effects... - if (this.classpathHasChanged(delta)) { - this.rebuild((IJavaProject) delta.getElement()); - } - } - - /** - * The specified Java project's classpath changed. Rebuild the JPA project - * as appropriate. - */ - protected void rebuild(IJavaProject javaProject) { - // if the classpath has changed, we need to update everything since - // class references could now be resolved (or not) etc. - if (javaProject.equals(this.getJavaProject())) { - this.removeDeadJpaFiles(); - this.synchronizeWithJavaSource(this.getInternalJavaResourceCompilationUnits()); - } else { - // TODO see if changed project is on our classpath? - //this.synchronizeWithJavaSource(this.getExternalJavaResourceCompilationUnits()); - } - } - - /** - * Loop through all our JPA files, remove any that are no longer on the - * classpath. - */ - protected void removeDeadJpaFiles() { - for (JaxbFile jaxbFile : this.getJaxbFiles()) { - if (this.jaxbFileIsDead(jaxbFile)) { - this.removeJaxbFile(jaxbFile); - } - } - } - - protected boolean jaxbFileIsDead(JaxbFile jaxbFile) { - return ! this.jaxbFileIsAlive(jaxbFile); - } - - /** - * Sometimes (e.g. during tests), when a project has been deleted, we get a - * Java change event that indicates the Java project is CHANGED (as - * opposed to REMOVED, which is what typically happens). The event's delta - * indicates that everything in the Java project has been deleted and the - * classpath has changed. All entries in the classpath have been removed; - * but single entry for the Java project's root folder has been added. (!) - * This means any file in the project is on the Java project's classpath. - * This classpath change is what triggers us to rebuild the JPA project; so - * we put an extra check here to make sure the JPA file's resource file is - * still present. - *

- * This would not be a problem if Dali received the resource change event - * before JDT and simply removed the JPA project; but JDT receives - * the resource change event first and converts it into the problematic - * Java change event.... - */ - protected boolean jaxbFileIsAlive(JaxbFile jaxbFile) { - IFile file = jaxbFile.getFile(); - return this.getJavaProject().isOnClasspath(file) && - file.exists(); - } - - /** - * pre-condition: - * delta.getElement().getElementType() == IJavaElement.JAVA_PROJECT - */ - protected boolean classpathHasChanged(IJavaElementDelta delta) { - return this.deltaFlagIsSet(delta, IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED); - } - - protected void synchronizeWithJavaSource(Iterable javaResourceCompilationUnits) { - for (JavaResourceCompilationUnit javaResourceCompilationUnit : javaResourceCompilationUnits) { - javaResourceCompilationUnit.synchronizeWithJavaSource(); - } - } - - - // ***** package fragment root - protected void processJavaPackageFragmentRootDelta(IJavaElementDelta delta) { - // process the Java package fragment root's package fragments - this.processJavaDeltaChildren(delta); - - if (this.classpathEntryHasBeenAdded(delta)) { - // TODO bug 277218 - } else if (this.classpathEntryHasBeenRemoved(delta)) { // should be mutually-exclusive w/added (?) - // TODO bug 277218 - } - } - - /** - * pre-condition: - * delta.getElement().getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT - */ - protected boolean classpathEntryHasBeenAdded(IJavaElementDelta delta) { - return this.deltaFlagIsSet(delta, IJavaElementDelta.F_ADDED_TO_CLASSPATH); - } - - /** - * pre-condition: - * delta.getElement().getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT - */ - protected boolean classpathEntryHasBeenRemoved(IJavaElementDelta delta) { - return this.deltaFlagIsSet(delta, IJavaElementDelta.F_REMOVED_FROM_CLASSPATH); - } - - // ***** package fragment - protected void processJavaPackageFragmentDelta(IJavaElementDelta delta) { - // process the java package fragment's compilation units - this.processJavaDeltaChildren(delta); - } - - // ***** compilation unit - protected void processJavaCompilationUnitDelta(IJavaElementDelta delta) { - if (this.javaCompilationUnitDeltaIsRelevant(delta)) { - ICompilationUnit compilationUnit = (ICompilationUnit) delta.getElement(); - for (JavaResourceCompilationUnit jrcu : this.getCombinedJavaResourceCompilationUnits()) { - if (jrcu.getCompilationUnit().equals(compilationUnit)) { - jrcu.synchronizeWithJavaSource(); - // TODO ? this.resolveJavaTypes(); // might have new member types now... - break; // there *shouldn't* be any more... - } - } - } - // ignore the java compilation unit's children - } - - protected boolean javaCompilationUnitDeltaIsRelevant(IJavaElementDelta delta) { - // ignore changes to/from primary working copy - no content has changed; - // and make sure there are no other flags set that indicate *both* a - // change to/from primary working copy *and* content has changed - if (BitTools.onlyFlagIsSet(delta.getFlags(), IJavaElementDelta.F_PRIMARY_WORKING_COPY)) { - return false; - } - - // ignore java notification for ADDED or REMOVED; - // these are handled via resource notification - return delta.getKind() == IJavaElementDelta.CHANGED; - } - - - // ********** validation ********** - - public Iterable validationMessages(IReporter reporter) { - List messages = new ArrayList(); - this.validate(messages, reporter); - return new SnapshotCloneIterable(messages); - } - - protected void validate(List messages, IReporter reporter) { - if (reporter.isCancelled()) { - throw new ValidationCancelledException(); - } - validateLibraryProvider(messages); - this.contextRoot.validate(messages, reporter); - } - - protected void validateLibraryProvider(List messages) { - try { - IFacetedProject facetedProject = ProjectFacetsManager.create(getProject()); - IProjectFacetVersion facetVersion = facetedProject.getInstalledVersion(JaxbFacet.FACET); - LibraryInstallDelegate lid = new LibraryInstallDelegate(facetedProject, facetVersion); - ILibraryProvider lp = lid.getLibraryProvider(); - if (lid.getLibraryProviderOperationConfig() instanceof JaxbLibraryProviderInstallOperationConfig) { - ((JaxbLibraryProviderInstallOperationConfig) lid.getLibraryProviderOperationConfig()).setJaxbPlatform(getPlatform().getDescription()); - } - if (! lp.isEnabledFor(facetedProject, facetVersion) || ! lid.validate().isOK()) { - messages.add( - DefaultValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JaxbValidationMessages.PROJECT_INVALID_LIBRARY_PROVIDER, - this)); - } - } - catch (CoreException ce) { - // fall through - JptJaxbCorePlugin.log(ce); - } - } - - - // ********** dispose ********** - - public void dispose() { - this.contextModelSynchronizer.stop(); - this.updateSynchronizer.stop(); - this.updateSynchronizer.removeListener(this.updateSynchronizerListener); - // the XML resources are held indefinitely by the WTP translator framework, - // so we better remove our listener or the JAXB project will not be GCed - for (JaxbFile jaxbFile : this.getJaxbFiles()) { - jaxbFile.getResourceModel().removeResourceModelListener(this.resourceModelListener); - } - } - - - - // ********** resource model listener ********** - - protected JptResourceModelListener buildResourceModelListener() { - return new DefaultResourceModelListener(); - } - - protected class DefaultResourceModelListener - implements JptResourceModelListener - { - protected DefaultResourceModelListener() { - super(); - } - - public void resourceModelChanged(JptResourceModel jpaResourceModel) { -// String msg = Thread.currentThread() + " resource model change: " + jpaResourceModel; -// System.out.println(msg); -// new Exception(msg).printStackTrace(System.out); - AbstractJaxbProject.this.synchronizeContextModel(jpaResourceModel); - } - - public void resourceModelReverted(JptResourceModel jpaResourceModel) { -// IFile file = WorkbenchResourceHelper.getFile((JpaXmlResource)jpaResourceModel); -// AbstractJaxbProject.this.removeJaxbFile(file); -// AbstractJaxbProject.this.addJaxbFile(file); - } - - public void resourceModelUnloaded(JptResourceModel jpaResourceModel) { -// IFile file = WorkbenchResourceHelper.getFile((JpaXmlResource)jpaResourceModel); -// AbstractJaxbProject.this.removeJaxbFile(file); - } - } - - protected void synchronizeContextModel(@SuppressWarnings("unused") JptResourceModel jpaResourceModel) { - this.synchronizeContextModel(); - } - - - // ********** resource events ********** - - // TODO need to do the same thing for external projects and compilation units - public void projectChanged(IResourceDelta delta) { - if (delta.getResource().equals(this.getProject())) { - this.internalProjectChanged(delta); - } else { -// this.externalProjectChanged(delta); - } - } - - protected void internalProjectChanged(IResourceDelta delta) { - ResourceDeltaVisitor resourceDeltaVisitor = this.buildInternalResourceDeltaVisitor(); - resourceDeltaVisitor.visitDelta(delta); - // at this point, if we have added and/or removed JpaFiles, an "update" will have been triggered; - // any changes to the resource model during the "resolve" will trigger further "updates"; - // there should be no need to "resolve" external Java types (they can't have references to - // the internal Java types) - if (resourceDeltaVisitor.encounteredSignificantChange()) { - this.resolveInternalJavaTypes(); - } - } - - protected ResourceDeltaVisitor buildInternalResourceDeltaVisitor() { - return new ResourceDeltaVisitor() { - @Override - public boolean fileChangeIsSignificant(IFile file, int deltaKind) { - return AbstractJaxbProject.this.synchronizeJaxbFiles(file, deltaKind); - } - }; - } - - /** - * Internal resource delta visitor callback. - * Return true if a JaxbFile was either added or removed. - */ - protected boolean synchronizeJaxbFiles(IFile file, int deltaKind) { - switch (deltaKind) { - case IResourceDelta.ADDED : - return this.addJaxbFile(file); - case IResourceDelta.REMOVED : - return this.removeJaxbFile(file); - case IResourceDelta.CHANGED : - return this.checkForChangedFileContent(file); - case IResourceDelta.ADDED_PHANTOM : - break; // ignore - case IResourceDelta.REMOVED_PHANTOM : - break; // ignore - default : - break; // only worried about added/removed/changed files - } - - return false; - } - - protected boolean checkForChangedFileContent(IFile file) { - JaxbFile jaxbFile = this.getJaxbFile(file); - if (jaxbFile == null) { - // the file might have changed its content to something that we are interested in - return this.addJaxbFile(file); - } - - if (jaxbFile.getContentType().equals(PlatformTools.getContentType(file))) { - // content has not changed - ignore - return false; - } - - // the content type changed, we need to build a new JPA file - // (e.g. the schema of an orm.xml file changed from JPA to EclipseLink) - this.removeJaxbFile(jaxbFile); - this.addJaxbFile(file); - return true; // at the least, we have removed a JPA file - } - - protected void resolveInternalJavaTypes() { - for (JavaResourceCompilationUnit jrcu : this.getInternalJavaResourceCompilationUnits()) { - jrcu.resolveTypes(); - } - } - -// protected void externalProjectChanged(IResourceDelta delta) { -// if (this.getJavaProject().isOnClasspath(delta.getResource())) { -// ResourceDeltaVisitor resourceDeltaVisitor = this.buildExternalResourceDeltaVisitor(); -// resourceDeltaVisitor.visitDelta(delta); -// // force an "update" here since adding and/or removing an external Java type -// // will only trigger an "update" if the "resolve" causes something in the resource model to change -// if (resourceDeltaVisitor.encounteredSignificantChange()) { -// this.update(); -// this.resolveExternalJavaTypes(); -// this.resolveInternalJavaTypes(); -// } -// } -// } -// -// protected ResourceDeltaVisitor buildExternalResourceDeltaVisitor() { -// return new ResourceDeltaVisitor() { -// @Override -// public boolean fileChangeIsSignificant(IFile file, int deltaKind) { -// return AbstractJaxbProject.this.synchronizeExternalFiles(file, deltaKind); -// } -// }; -// } -// -// /** -// * external resource delta visitor callback -// * Return true if an "external" Java resource compilation unit -// * was added or removed. -// */ -// protected boolean synchronizeExternalFiles(IFile file, int deltaKind) { -// switch (deltaKind) { -// case IResourceDelta.ADDED : -// return this.externalFileAdded(file); -// case IResourceDelta.REMOVED : -// return this.externalFileRemoved(file); -// case IResourceDelta.CHANGED : -// break; // ignore -// case IResourceDelta.ADDED_PHANTOM : -// break; // ignore -// case IResourceDelta.REMOVED_PHANTOM : -// break; // ignore -// default : -// break; // only worried about added/removed/changed files -// } -// -// return false; -// } -// -// protected boolean externalFileAdded(IFile file) { -// IContentType contentType = PlatformTools.getContentType(file); -// if (contentType == null) { -// return false; -// } -// if (contentType.equals(JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) { -// return true; -// } -// if (contentType.equals(JptCorePlugin.JAR_CONTENT_TYPE)) { -// return true; -// } -// return false; -// } -// -// protected boolean externalFileRemoved(IFile file) { -// IContentType contentType = PlatformTools.getContentType(file); -// if (contentType == null) { -// return false; -// } -// if (contentType.equals(JptCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) { -// return this.removeExternalJavaResourceCompilationUnit(file); -// } -// if (contentType.equals(JptCorePlugin.JAR_CONTENT_TYPE)) { -// return this.externalJavaResourcePersistentTypeCache.removePersistentTypes(file); -// } -// return false; -// } -// -// protected void resolveExternalJavaTypes() { -// for (JavaResourceCompilationUnit jrcu : this.getExternalJavaResourceCompilationUnits()) { -// jrcu.resolveTypes(); -// } -// } - - // ***** resource delta visitors - /** - * add or remove a JPA file for every [appropriate] file encountered by the visitor - */ - protected abstract class ResourceDeltaVisitor implements IResourceDeltaVisitor { - protected boolean encounteredSignificantChange = false; - - protected ResourceDeltaVisitor() { - super(); - } - - protected void visitDelta(IResourceDelta delta) { - try { - delta.accept(this); - } catch (CoreException ex) { - // shouldn't happen - we don't throw any CoreExceptions - throw new RuntimeException(ex); - } - } - - public boolean visit(IResourceDelta delta) { - IResource res = delta.getResource(); - switch (res.getType()) { - case IResource.ROOT : - return true; // visit children - case IResource.PROJECT : - return true; // visit children - case IResource.FOLDER : - return true; // visit children - case IResource.FILE : - this.fileChanged((IFile) res, delta.getKind()); - return false; // no children - default : - return false; // no children (probably shouldn't get here...) - } - } - - protected void fileChanged(IFile file, int deltaKind) { - if (this.fileChangeIsSignificant(file, deltaKind)) { - this.encounteredSignificantChange = true; - } - } - - protected abstract boolean fileChangeIsSignificant(IFile file, int deltaKind); - - /** - * Return whether the visitor encountered some sort of "significant" - * change while traversing the IResourceDelta - * (e.g. a JPA file was added or removed). - */ - protected boolean encounteredSignificantChange() { - return this.encounteredSignificantChange; - } - - } - - - // ********** support for modifying documents shared with the UI ********** - - public void setThreadLocalModifySharedDocumentCommandExecutor(CommandExecutor commandExecutor) { - this.modifySharedDocumentCommandExecutor.set(commandExecutor); - } - - public CommandExecutor getModifySharedDocumentCommandExecutor() { - return this.modifySharedDocumentCommandExecutor; - } - - - // ********** synchronize context model with resource model ********** - - public Synchronizer getContextModelSynchronizer() { - return this.contextModelSynchronizer; - } - - public void setContextModelSynchronizer(Synchronizer synchronizer) { - if (synchronizer == null) { - throw new NullPointerException(); - } - this.contextModelSynchronizer.stop(); - this.setContextModelSynchronizer_(synchronizer); - } - - protected void setContextModelSynchronizer_(Synchronizer synchronizer) { - this.contextModelSynchronizer = synchronizer; - this.contextModelSynchronizer.start(); - } - - /** - * Delegate to the context model synchronizer so clients can configure how - * synchronizations occur. - */ - public void synchronizeContextModel() { - this.synchronizingContextModel = true; - this.contextModelSynchronizer.synchronize(); - this.synchronizingContextModel = false; - - // There are some changes to the resource model that will not change - // the existing context model and trigger an update (e.g. adding an - // @Entity annotation when the the JPA project is automatically - // discovering annotated classes); so we explicitly execute an update - // here to discover those changes. - this.update(); - } - - /** - * Called by the context model synchronizer. - */ - public IStatus synchronizeContextModel(IProgressMonitor monitor) { - this.contextRoot.synchronizeWithResourceModel(); - return Status.OK_STATUS; - } - - public void synchronizeContextModelAndWait() { - Synchronizer temp = this.contextModelSynchronizer; - this.setContextModelSynchronizer(this.buildSynchronousContextModelSynchronizer()); - this.synchronizeContextModel(); - this.setContextModelSynchronizer(temp); - } - - - // ********** default context model synchronizer (synchronous) ********** - - protected Synchronizer buildSynchronousContextModelSynchronizer() { - return new SynchronousSynchronizer(this.buildSynchronousContextModelSynchronizerCommand()); - } - - protected Command buildSynchronousContextModelSynchronizerCommand() { - return new SynchronousContextModelSynchronizerCommand(); - } - - protected class SynchronousContextModelSynchronizerCommand - implements Command - { - public void execute() { - AbstractJaxbProject.this.synchronizeContextModel(new NullProgressMonitor()); - } - } - - - // ********** project "update" ********** - - public CallbackSynchronizer getUpdateSynchronizer() { - return this.updateSynchronizer; - } - - public void setUpdateSynchronizer(CallbackSynchronizer synchronizer) { - if (synchronizer == null) { - throw new NullPointerException(); - } - this.updateSynchronizer.stop(); - this.updateSynchronizer.removeListener(this.updateSynchronizerListener); - this.setUpdateSynchronizer_(synchronizer); - } - - protected void setUpdateSynchronizer_(CallbackSynchronizer synchronizer) { - this.updateSynchronizer = synchronizer; - this.updateSynchronizer.addListener(this.updateSynchronizerListener); - this.updateSynchronizer.start(); - } - - @Override - public void stateChanged() { - super.stateChanged(); - this.update(); - } - - /** - * The JAXB project's state has changed, "update" those parts of the - * JAXB project that are dependent on other parts of the JAXB project. - *

- * Delegate to the update synchronizer so clients can configure how - * updates occur. - *

- * Ignore any updates that occur while we are synchronizing - * the context model with the resource model because we will update - * the context model at the completion of the sync. This is really - * only useful for synchronous syncs and updates; since - * the job scheduling rules will prevent the sync and - * update jobs from running concurrently. - * - * @see #updateAndWait() - */ - protected void update() { - if ( ! this.synchronizingContextModel) { - this.updateSynchronizer.synchronize(); - } - } - - /** - * Called by the update synchronizer. - */ - public IStatus update(IProgressMonitor monitor) { - this.contextRoot.update(); - return Status.OK_STATUS; - } - - /** - * This is the callback used by the update synchronizer to notify the JAXB - * project that the "update" has quiesced (i.e. the "update" has completed - * and there are no outstanding requests for further "updates"). - */ - public void updateQuiesced() { - //nothing yet - } - - public void updateAndWait() { - CallbackSynchronizer temp = this.updateSynchronizer; - this.setUpdateSynchronizer(this.buildSynchronousUpdateSynchronizer()); - this.update(); - this.setUpdateSynchronizer(temp); - } - - - // ********** default update synchronizer (synchronous) ********** - - protected CallbackSynchronizer buildSynchronousUpdateSynchronizer() { - return new CallbackSynchronousSynchronizer(this.buildSynchronousUpdateSynchronizerCommand()); - } - - protected Command buildSynchronousUpdateSynchronizerCommand() { - return new SynchronousUpdateSynchronizerCommand(); - } - - protected class SynchronousUpdateSynchronizerCommand - implements Command - { - public void execute() { - AbstractJaxbProject.this.update(new NullProgressMonitor()); - } - } - - - // ********** update synchronizer listener ********** - - protected CallbackSynchronizer.Listener buildUpdateSynchronizerListener() { - return new UpdateSynchronizerListener(); - } - - protected class UpdateSynchronizerListener - implements CallbackSynchronizer.Listener - { - public void synchronizationQuiesced(CallbackSynchronizer synchronizer) { - AbstractJaxbProject.this.updateQuiesced(); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/GenericAnnotationProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/GenericAnnotationProvider.java deleted file mode 100644 index 32f447deff..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/GenericAnnotationProvider.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jaxb.core.AnnotationProvider; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotationDefinition; - -/** - * Delegate to annotation definition providers. - * The platform factory will build an instance of this annotation provider, - * passing in the appropriate array of annotation definition providers necessary - * to build the annotations for the platform (vendor and/or version). - */ -public final class GenericAnnotationProvider - implements AnnotationProvider -{ - private final AnnotationDefinition[] annotationDefinitions; - - private final NestableAnnotationDefinition[] nestableAnnotationDefinitions; - - public GenericAnnotationProvider(AnnotationDefinition[] annotationDefinitions, NestableAnnotationDefinition[] nestableAnnotationDefinitions) { - super(); - this.annotationDefinitions = annotationDefinitions; - this.nestableAnnotationDefinitions = nestableAnnotationDefinitions; - } - - - protected Iterable getAnnotationDefinitions() { - return new ArrayIterable(this.annotationDefinitions); - } - - protected AnnotationDefinition getAnnotationDefinition(String annotationName) { - for (AnnotationDefinition annotationDefinition : this.annotationDefinitions) { - if (annotationDefinition.getAnnotationName().equals(annotationName)) { - return annotationDefinition; - } - } - return null; - } - - public Iterable getAnnotationNames() { - return new TransformationIterable(getAnnotationDefinitions()) { - @Override - protected String transform(AnnotationDefinition annotationDefinition) { - return annotationDefinition.getAnnotationName(); - } - }; - } - - public Iterable getContainerAnnotationNames() { - return new TransformationIterable(getNestableAnnotationDefinitions()) { - @Override - protected String transform(NestableAnnotationDefinition annotationDefinition) { - return annotationDefinition.getContainerAnnotationName(); - } - }; - } - - public Iterable getNestableAnnotationNames() { - return new TransformationIterable(getNestableAnnotationDefinitions()) { - @Override - protected String transform(NestableAnnotationDefinition annotationDefinition) { - return annotationDefinition.getNestableAnnotationName(); - } - }; - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, String annotationName) { - return this.getAnnotationDefinition(annotationName).buildAnnotation(parent, element); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return this.getAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent, String annotationName) { - return this.getAnnotationDefinition(annotationName).buildNullAnnotation(parent); - } - - protected Iterable getNestableAnnotationDefinitions() { - return new ArrayIterable(this.nestableAnnotationDefinitions); - } - - protected NestableAnnotationDefinition getNestableAnnotationDefinition(String annotationName) { - for (NestableAnnotationDefinition annotationDefinition : this.nestableAnnotationDefinitions) { - if (annotationDefinition.getNestableAnnotationName().equals(annotationName)) { - return annotationDefinition; - } - } - return null; - } - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement element, String annotationName, int index) { - return this.getNestableAnnotationDefinition(annotationName).buildAnnotation(parent, element, index); - } - - public String getNestableAnnotationName(String containerAnnotationName) { - return getNestableAnnotationDefinitionForContainer(containerAnnotationName).getNestableAnnotationName(); - } - - public String getNestableElementName(String nestableAnnotationName) { - return getNestableAnnotationDefinition(nestableAnnotationName).getElementName(); - } - - private NestableAnnotationDefinition getNestableAnnotationDefinitionForContainer(String containerAnnotationName) { - for (NestableAnnotationDefinition nestableAnnotationDefinition : getNestableAnnotationDefinitions()) { - if (nestableAnnotationDefinition.getContainerAnnotationName().equals(containerAnnotationName)) { - return nestableAnnotationDefinition; - } - } - return null; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/GenericJaxbFile.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/GenericJaxbFile.java deleted file mode 100644 index 574ad14301..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/GenericJaxbFile.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceModel; -import org.eclipse.jpt.jaxb.core.JaxbFile; -import org.eclipse.jpt.jaxb.core.JaxbProject; - -/** - * The transition between a JAXB project and the resource model associated - * with a file. - * Hold the associated root structure nodes, which are hooks to the - * context model. - */ -public class GenericJaxbFile - extends AbstractJaxbNode - implements JaxbFile -{ - /** - * typically a .java or .xml file. - */ - protected final IFile file; - - /** - * cache the content type - if the content type changes, the JAXB project - * will throw out the JAXB file and build a new one - */ - protected final IContentType contentType; - - /** - * the resource model corresponding to the file - */ - protected final JptResourceModel resourceModel; - -// /** -// * the root structure (context model) nodes corresponding to the resource -// * model -// */ -// protected final Hashtable rootStructureNodes; - - - // ********** construction ********** - - public GenericJaxbFile(JaxbProject jaxbProject, IFile file, IContentType contentType, JptResourceModel resourceModel) { - super(jaxbProject); - this.file = file; - this.contentType = contentType; - this.resourceModel = resourceModel; -// this.rootStructureNodes = new Hashtable(); - } -// -// /** -// * Changes to ROOT_STRUCTURE_NODES_COLLECTION do not need to trigger a -// * project update. Only the UI cares about the root structure nodes. -// * If a project update is allowed to happen, an infinite loop will result -// * if any java class is specified in more than one location in the -// * persistence unit. -// */ -// @Override -// protected void addNonUpdateAspectNamesTo(Set nonUpdateAspectNames) { -// super.addNonUpdateAspectNamesTo(nonUpdateAspectNames); -// nonUpdateAspectNames.add(ROOT_STRUCTURE_NODES_COLLECTION); -// } - - - // ********** file ********** - - public IFile getFile() { - return this.file; - } - - public IContentType getContentType() { - return this.contentType; - } - - public JptResourceModel getResourceModel() { - return this.resourceModel; - } - - public JptResourceModel getResourceModel(IContentType ct) { - return this.contentType.isKindOf(ct) ? this.resourceModel : null; - } - - -// // ********** root structure nodes ********** -// -// public Iterator rootStructureNodes() { -// return this.getRootStructureNodes().iterator(); -// } -// -// protected Iterable getRootStructureNodes() { -// return new LiveCloneIterable(this.rootStructureNodes.values()); -// } -// -// public int rootStructureNodesSize() { -// return this.rootStructureNodes.size(); -// } -// -// public void addRootStructureNode(Object key, JpaStructureNode rootStructureNode) { -// JpaStructureNode old = this.rootStructureNodes.put(key, rootStructureNode); -// if (rootStructureNode != old) { -// if (old != null) { -// this.fireItemRemoved(ROOT_STRUCTURE_NODES_COLLECTION, old); -// } -// this.fireItemAdded(ROOT_STRUCTURE_NODES_COLLECTION, rootStructureNode); -// } -// } -// -// public void removeRootStructureNode(Object key) { -// this.fireItemRemoved(ROOT_STRUCTURE_NODES_COLLECTION, this.rootStructureNodes.remove(key)); -// } -// -// public JpaStructureNode getStructureNode(int textOffset) { -// for (JpaStructureNode rootNode : this.getRootStructureNodes()) { -// JpaStructureNode node = rootNode.getStructureNode(textOffset); -// if (node != null) { -// return node; -// } -// } -// return null; -// } - - - // ********** misc ********** - - @Override - public void toString(StringBuilder sb) { - sb.append(this.file); - sb.append('['); - sb.append(this.contentType.getName()); - sb.append(']'); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/GenericJaxbProject.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/GenericJaxbProject.java deleted file mode 100644 index 1b81017142..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/GenericJaxbProject.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal; - -import org.eclipse.jpt.jaxb.core.JaxbProject; - -/** - * Not much different from the abstract JAXB project. - */ -public class GenericJaxbProject - extends AbstractJaxbProject -{ - - // ********** constructor/initialization ********** - - public GenericJaxbProject(JaxbProject.Config config) { - super(config); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaPackageInfoResourceModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaPackageInfoResourceModelProvider.java deleted file mode 100644 index 82042f5140..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaPackageInfoResourceModelProvider.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JaxbResourceModelProvider; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourcePackageInfoCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; - -/** - * Java package-info.java source code - */ -public class JavaPackageInfoResourceModelProvider - implements JaxbResourceModelProvider -{ - // singleton - private static final JaxbResourceModelProvider INSTANCE = new JavaPackageInfoResourceModelProvider(); - - /** - * Return the singleton. - */ - public static JaxbResourceModelProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private JavaPackageInfoResourceModelProvider() { - super(); - } - - public IContentType getContentType() { - return JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE; - } - - public JavaResourceCompilationUnit buildResourceModel(JaxbProject jaxbProject, IFile file) { - return new SourcePackageInfoCompilationUnit( - JavaCore.createCompilationUnitFrom(file), - jaxbProject.getPlatform().getAnnotationProvider(), - jaxbProject.getPlatform().getAnnotationEditFormatter(), - jaxbProject.getModifySharedDocumentCommandExecutor() - ); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaResourceModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaResourceModelProvider.java deleted file mode 100644 index f59a77992e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JavaResourceModelProvider.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JaxbResourceModelProvider; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceTypeCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; - -/** - * Java source code - */ -public class JavaResourceModelProvider - implements JaxbResourceModelProvider -{ - // singleton - private static final JaxbResourceModelProvider INSTANCE = new JavaResourceModelProvider(); - - /** - * Return the singleton. - */ - public static JaxbResourceModelProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private JavaResourceModelProvider() { - super(); - } - - public IContentType getContentType() { - return JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE; - } - - public JavaResourceCompilationUnit buildResourceModel(JaxbProject jaxbProject, IFile file) { - return new SourceTypeCompilationUnit( - JavaCore.createCompilationUnitFrom(file), - jaxbProject.getPlatform().getAnnotationProvider(), - jaxbProject.getPlatform().getAnnotationEditFormatter(), - jaxbProject.getModifySharedDocumentCommandExecutor() - ); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JptJaxbCoreMessages.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JptJaxbCoreMessages.java deleted file mode 100644 index b8dd9e9dfb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/JptJaxbCoreMessages.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * Localized messages used by Dali JAXB Core. - */ -public class JptJaxbCoreMessages { - - public static String ClassesGenerator_generatingClasses; - public static String ClassesGenerator_generatingClassesTask; - - public static String JaxbFacetConfig_validatePlatformNotSpecified; - public static String JaxbFacetConfig_validatePlatformDoesNotSupportFacetVersion; - - public static String JreLibraryValidator_invalidPlatform; - public static String JreLibraryValidator_invalidJreJaxbVersion; - - public static String PREFERENCES_FLUSH_JOB_NAME; - - public static String SchemaGenerator_creatingJAXBPropertiesFileTask; - - - private static final String BUNDLE_NAME = "jpt_jaxb_core"; //$NON-NLS-1$ - private static final Class BUNDLE_CLASS = JptJaxbCoreMessages.class; - - static { - NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS); - } - - - private JptJaxbCoreMessages() { - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SchemaLibraryImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SchemaLibraryImpl.java deleted file mode 100644 index cc9f954415..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SchemaLibraryImpl.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal; - -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; -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.resource.Resource; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.SchemaLibrary; -import org.eclipse.jpt.jaxb.core.xsd.XsdUtil; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.util.XSDResourceImpl; - -public class SchemaLibraryImpl - implements SchemaLibrary { - - private JaxbProject project; - - private final Map schemaLocations; - - private final Map schemaResources; - - private Adapter schemaResourceAdapter = new SchemaResourceAdapter(); - - - SchemaLibraryImpl(JaxbProject project) { - this.project = project; - this.schemaLocations = new HashMap(); - this.schemaResources = new HashMap(); - readProjectPreferences(); - } - - - public XSDSchema getSchema(String namespace) { - String resolvedUri = getResolvedUri(namespace); - if (resolvedUri == null) { - return null; - } - - XSDResourceImpl schemaResource = this.schemaResources.get(namespace); - XSDSchema schema = (schemaResource == null) ? null : schemaResource.getSchema(); - if (schemaResource != null) { - if (schema != null && schemaResource.getURI().toString().equals(resolvedUri) && schemaResource.isLoaded()) { - return schema; - } - else { - removeSchemaResource(namespace, schemaResource); - } - } - - return addSchema(namespace, resolvedUri); - } - - protected String getResolvedUri(String namespace) { - String location = this.schemaLocations.get(namespace); - return XsdUtil.getResolvedUri(namespace, location); - } - - protected XSDSchema addSchema(String namespace, String resolvedUri) { - XSDSchema schema = XsdUtil.buildXSDModel(resolvedUri); - XSDResourceImpl schemaResource = (XSDResourceImpl) schema.eResource(); - if (schemaResource != null) { - schemaResource.eAdapters().add(this.schemaResourceAdapter); - this.schemaResources.put(namespace, schemaResource); - return schema; - } - return null; - } - - protected void removeSchemaResource(XSDResourceImpl schemaResource) { - for (String namespace : this.schemaResources.keySet()) { - if (schemaResource.equals(this.schemaResources.get(namespace))) { - removeSchemaResource(namespace, schemaResource); - } - } - } - - protected void removeSchemaResource(String namespace, XSDResourceImpl schemaResource) { - schemaResource.eAdapters().remove(this.schemaResourceAdapter); - this.schemaResources.remove(namespace); - } - - protected void readProjectPreferences() { - Map schemaMap = JptJaxbCorePlugin.getSchemaLocationMap(this.project.getProject()); - this.schemaLocations.putAll(schemaMap); - } - - public Map getSchemaLocations() { - return Collections.unmodifiableMap(this.schemaLocations); - } - - public void setSchemaLocations(Map schemaLocations) { - this.schemaLocations.clear(); - JptJaxbCorePlugin.setSchemaLocationMap(this.project.getProject(), schemaLocations); - readProjectPreferences(); - } - - - private class SchemaResourceAdapter - extends AdapterImpl { - - @Override - public void notifyChanged(Notification msg) { - if (msg.getFeatureID(Resource.class) == Resource.RESOURCE__IS_LOADED - && msg.getNewBooleanValue() == false) { - removeSchemaResource((XSDResourceImpl) msg.getNotifier()); - } - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SimpleJaxbProjectConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SimpleJaxbProjectConfig.java deleted file mode 100644 index f159ded880..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/SimpleJaxbProjectConfig.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; - -/** - * Straightforward implementation of the JAXB project config. - */ -public class SimpleJaxbProjectConfig - implements JaxbProject.Config { - - private IProject project; - - private JaxbPlatformDefinition platformDefinition; - - - public SimpleJaxbProjectConfig() { - super(); - } - - - public IProject getProject() { - return this.project; - } - - public void setProject(IProject project) { - this.project = project; - } - - public JaxbPlatformDefinition getPlatformDefinition() { - return this.platformDefinition; - } - - public void setPlatformDefinition(JaxbPlatformDefinition platformDefinition) { - this.platformDefinition = platformDefinition; - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.project.getName()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/AbstractJaxbContextNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/AbstractJaxbContextNode.java deleted file mode 100644 index d8e0cf3044..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/AbstractJaxbContextNode.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context; - -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jaxb.core.JaxbNode; -import org.eclipse.jpt.jaxb.core.context.JaxbContextNode; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.internal.AbstractJaxbNode; - -public abstract class AbstractJaxbContextNode - extends AbstractJaxbNode - implements JaxbContextNode -{ - - // ********** constructor ********** - - protected AbstractJaxbContextNode(JaxbNode parent) { - super(parent); - } - - - // ********** JaxbNode implentation ********** - - @Override - public JaxbContextNode getParent() { - return (JaxbContextNode) super.getParent(); - } - - - // ********** JaxbContextNode implementation ********** - - public JaxbContextRoot getContextRoot() { - return getParent().getContextRoot(); - } - - public JptResourceType getResourceType() { - return getParent().getResourceType(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/GenericContextRoot.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/GenericContextRoot.java deleted file mode 100644 index 4ebf6c4991..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/GenericContextRoot.java +++ /dev/null @@ -1,516 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; -import org.eclipse.jpt.jaxb.core.context.JaxbRegistry; -import org.eclipse.jpt.jaxb.core.context.JaxbType; -import org.eclipse.jpt.jaxb.core.context.JaxbType.Kind; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * the context model root - */ -public class GenericContextRoot - extends AbstractJaxbContextNode - implements JaxbContextRoot { - - /* This object has no parent, so it must point to the JAXB project explicitly. */ - protected final JaxbProject jaxbProject; - - /* The map of package name to JaxbPackage objects */ - protected final Map packages; - - /* The map of class name to JaxbType objects */ - protected final Map types; - - - public GenericContextRoot(JaxbProject jaxbProject) { - super(null); // the JAXB project is not really a "parent"... - if (jaxbProject == null) { - throw new NullPointerException(); - } - this.jaxbProject = jaxbProject; - this.packages = new HashMap(); - this.types = new HashMap(); - initialize(); - } - - - @Override - public JaxbContextRoot getContextRoot() { - return this; - } - - @Override - protected boolean requiresParent() { - return false; - } - - protected void initialize() { - // determine set of registries - // (registries can be determined purely by resource model) - final Set registries = calculateRegistries(); - - // determine initial set of persistent classes - // (persistent classes that can be determined purely by resource model) - final Set initialPersistentClasses = calculateInitialPersistentClasses(); - - final Set initialPersistentEnums = calculateInitialPersistentEnums(); - - final Set initialTypes = new HashSet(registries); - initialTypes.addAll(initialPersistentClasses); - initialTypes.addAll(initialPersistentEnums); - - // determine initial set of packages - final Set initialPackages = calculateInitialPackageNames(initialTypes); - - for (String pkg : initialPackages) { - this.packages.put(pkg, buildPackage(pkg)); - } - - for (JavaResourceType resourceType : registries) { - this.types.put(resourceType.getName(), buildRegistry(resourceType)); - } - - for (JavaResourceType resourceType : initialPersistentClasses) { - this.types.put(resourceType.getName(), buildPersistentClass(resourceType)); - } - - for (JavaResourceEnum resourceType : initialPersistentEnums) { - this.types.put(resourceType.getName(), buildPersistentEnum(resourceType)); - } - } - - public void synchronizeWithResourceModel() { - for (JaxbPackage each : getPackages()) { - each.synchronizeWithResourceModel(); - } - for (JaxbType each : getTypes()) { - each.synchronizeWithResourceModel(); - } - } - - public void update() { - // determine set of registries - // (registries can be determined purely by resource model) - final Set registries = calculateRegistries(); - - // determine initial set of persistent classes - // (persistent classes that can be determined purely by resource model) - final Set initialPersistentClasses = calculateInitialPersistentClasses(); - final Set initialPersistentEnums = calculateInitialPersistentEnums(); - - final Set initialTypes = new HashSet(registries); - initialTypes.addAll(initialPersistentClasses); - initialTypes.addAll(initialPersistentEnums); - - // determine initial set of packages - final Set initialPackages = calculateInitialPackageNames(initialTypes); - - final Set packagesToUpdate = CollectionTools.set(); - final Set packagesToRemove = CollectionTools.set(this.packages.keySet()); - final Set typesToUpdate = CollectionTools.set(); - final Set typesToRemove = CollectionTools.set(this.types.keySet()); - - for (String pkg : initialPackages) { - if (this.packages.containsKey(pkg)) { - packagesToUpdate.add(pkg); - packagesToRemove.remove(pkg); - } - else { - this.addPackage(this.buildPackage(pkg)); - } - } - - for (JavaResourceType resourceType : registries) { - String className = resourceType.getQualifiedName(); - typesToRemove.remove(className); - if (this.types.containsKey(className)) { - if (this.types.get(className).getKind() == Kind.REGISTRY) { - typesToUpdate.add(className); - } - else { - this.removeType(className); // this will remove a type of another kind - this.addType(buildRegistry(resourceType)); - } - } - else { - this.addType(buildRegistry(resourceType)); - } - } - - for (JavaResourceType resourceType : initialPersistentClasses) { - String className = resourceType.getQualifiedName(); - typesToRemove.remove(className); - if (this.types.containsKey(className)) { - if (this.types.get(className).getKind() == Kind.PERSISTENT_CLASS) { - typesToUpdate.add(className); - } - else { - this.removeType(className); // this will remove a type of another kind - this.addType(buildPersistentClass(resourceType)); - } - } - else { - this.addType(buildPersistentClass(resourceType)); - } - } - - for (JavaResourceEnum resourceEnum : initialPersistentEnums) { - String className = resourceEnum.getQualifiedName(); - typesToRemove.remove(className); - if (this.types.containsKey(className)) { - if (this.types.get(className).getKind() == Kind.PERSISTENT_ENUM) { - typesToUpdate.add(className); - } - else { - this.removeType(className); // this will remove a type of another kind - this.addType(buildPersistentEnum(resourceEnum)); - } - } - else { - this.addType(buildPersistentEnum(resourceEnum)); - } - } - - for (String packageToUpdate : packagesToUpdate) { - this.packages.get(packageToUpdate).update(); - } - - for (String typeToUpdate : typesToUpdate) { - this.types.get(typeToUpdate).update(); - } - - for (String packageToRemove : packagesToRemove) { - removePackage(packageToRemove); - } - - for (String typeToRemove : typesToRemove) { - removeType(typeToRemove); - } - } - - /* - * calculate set of packages that can be determined purely by resource model and the given - * set of classes. - * This should include: - * - any annotated package - * - any package containing an included class - */ - protected Set calculateInitialPackageNames(final Set initialClasses) { - final Set packages = CollectionTools.set( - new TransformationIterable( - getJaxbProject().getAnnotatedJavaResourcePackages()) { - @Override - protected String transform(JavaResourcePackage o) { - return o.getName(); - } - }); - for (AbstractJavaResourceType clazz : initialClasses) { - packages.add(clazz.getPackageName()); - } - return packages; - } - - /* - * Calculate set of persistent classes that can be determined purely by resource model - * (so far, this should be all resource types with the @XmlType annotation) - * If both @XmlType and @XmlRegistry exist on a class, we will let @XmlRegistry take precedence - */ - protected Set calculateInitialPersistentClasses() { - return CollectionTools.set( - new FilteringIterable( - getJaxbProject().getJavaSourceResourceTypes()) { - @Override - protected boolean accept(JavaResourceType o) { - return o.getAnnotation(JAXB.XML_TYPE) != null && o.getAnnotation(JAXB.XML_REGISTRY) == null && o.getAnnotation(JAXB.XML_ENUM) == null; - } - }); - } - - /* - * Calculate set of persistent enums that can be determined purely by resource model - * (so far, this should be all resource types with the @XmlEnum annotation) - * If both @XmlEnum and @XmlRegistry exist on a class, we will let @XmlRegistry take precedence - */ - protected Set calculateInitialPersistentEnums() { - return CollectionTools.set( - new FilteringIterable( - getJaxbProject().getJavaSourceResourceEnums()) { - @Override - protected boolean accept(JavaResourceEnum o) { - return ((o.getAnnotation(JAXB.XML_ENUM) != null) || (o.getAnnotation(JAXB.XML_TYPE) != null)) && o.getAnnotation(JAXB.XML_REGISTRY) == null; - } - }); - } - - /* - * Calculate set of registries - * (this should be all resource types with the @XmlRegistry annotation) - */ - protected Set calculateRegistries() { - return CollectionTools.set( - new FilteringIterable( - getJaxbProject().getJavaSourceResourceTypes()) { - @Override - protected boolean accept(JavaResourceType o) { - return o.getAnnotation(JAXB.XML_REGISTRY) != null; - } - }); - } - - - // ********** AbstractJaxbNode overrides ********** - - @Override - public JaxbProject getJaxbProject() { - return this.jaxbProject; - } - - @Override - public IResource getResource() { - return this.getProject(); - } - - protected IProject getProject() { - return this.jaxbProject.getProject(); - } - - - // ************* packages *************** - - public Iterable getPackages() { - return new LiveCloneIterable(this.packages.values()); - } - - public int getPackagesSize() { - return this.packages.size(); - } - - public JaxbPackage getPackage(String packageName) { - for (JaxbPackage jaxbPackage : this.getPackages()) { - if (StringTools.stringsAreEqual(jaxbPackage.getName(), packageName)) { - return jaxbPackage; - } - } - return null; - } - - protected JaxbPackage addPackage(JaxbPackage contextPackage) { - if (this.packages.containsKey(contextPackage.getName())) { - throw new IllegalArgumentException("Package with that name already exists."); //$NON-NLS-1$ - } - this.packages.put(contextPackage.getName(), contextPackage); - fireItemAdded(PACKAGES_COLLECTION, contextPackage); - return contextPackage; - } - - protected void removePackage(JaxbPackage contextPackage) { - this.removePackage(contextPackage.getName()); - } - - protected void removePackage(String packageName) { - if (! this.packages.containsKey(packageName)) { - throw new IllegalArgumentException("No package with that name exists."); //$NON-NLS-1$ - } - JaxbPackage removedPackage = this.packages.remove(packageName); - fireItemRemoved(PACKAGES_COLLECTION, removedPackage); - } - - protected JaxbPackage buildPackage(String packageName) { - return this.getFactory().buildPackage(this, packageName); - } - - protected boolean isEmpty(JaxbPackage jaxbPackage) { - return jaxbPackage.isEmpty(); - } - - - // ********** types *********** - - public Iterable getTypes() { - return new LiveCloneIterable(this.types.values()); - } - - public int getTypesSize() { - return this.types.size(); - } - - public JaxbType getType(String typeName) { - return this.types.get(typeName); - } - - protected void addType(JaxbType type) { - if (this.types.containsKey(type.getFullyQualifiedName())) { - throw new IllegalArgumentException("Type with that name already exists."); //$NON-NLS-1$ - } - this.types.put(type.getFullyQualifiedName(), type); - fireItemAdded(TYPES_COLLECTION, type); - } - - protected void removeType(JaxbType type) { - removeType(type.getFullyQualifiedName()); - } - - protected void removeType(String typeName) { - if (! this.types.containsKey(typeName)) { - throw new IllegalArgumentException("No type with that name exists."); //$NON-NLS-1$ - } - JaxbType removedType = this.types.remove(typeName); - fireItemRemoved(TYPES_COLLECTION, removedType); - } - - public Iterable getTypes(final JaxbPackage jaxbPackage) { - return new FilteringIterable(getTypes()) { - @Override - protected boolean accept(JaxbType o) { - return o.getPackageName().equals(jaxbPackage.getName()); - } - }; - } - - - // ********** registries ********** - - public Iterable getRegistries() { - return new SubIterableWrapper( - new FilteringIterable(getTypes()) { - @Override - protected boolean accept(JaxbType o) { - return o.getKind() == Kind.REGISTRY; - } - }); - } - - protected JaxbRegistry buildRegistry(JavaResourceType resourceType) { - return this.getFactory().buildRegistry(this, resourceType); - } - - public Iterable getRegistries(final JaxbPackage jaxbPackage) { - return new FilteringIterable(getRegistries()) { - @Override - protected boolean accept(JaxbRegistry o) { - return o.getPackageName().equals(jaxbPackage.getName()); - } - }; - } - - - // ********** persistent classes ********** - - public Iterable getPersistentClasses() { - return new SubIterableWrapper( - new FilteringIterable(getTypes()) { - @Override - protected boolean accept(JaxbType o) { - return o.getKind() == Kind.PERSISTENT_CLASS; - } - }); - } - - protected JaxbPersistentClass buildPersistentClass(JavaResourceType resourceType) { - return this.getFactory().buildJavaPersistentClass(this, resourceType); - } - - public Iterable getPersistentClasses(final JaxbPackage jaxbPackage) { - return new FilteringIterable(getPersistentClasses()) { - @Override - protected boolean accept(JaxbPersistentClass o) { - return o.getPackageName().equals(jaxbPackage.getName()); - } - }; - } - - public JaxbPersistentClass getPersistentClass(String className) { - for (JaxbPersistentClass jaxbClass : this.getPersistentClasses()) { - if (StringTools.stringsAreEqual(jaxbClass.getFullyQualifiedName(), className)) { - return jaxbClass; - } - } - return null; - } - - // ********** persistent enums ********** - - public Iterable getPersistentEnums() { - return new SubIterableWrapper( - new FilteringIterable(getTypes()) { - @Override - protected boolean accept(JaxbType o) { - return o.getKind() == Kind.PERSISTENT_ENUM; - } - }); - } - - protected JaxbPersistentEnum buildPersistentEnum(JavaResourceEnum resourceEnum) { - return this.getFactory().buildJavaPersistentEnum(this, resourceEnum); - } - - public Iterable getPersistentEnums(final JaxbPackage jaxbPackage) { - return new FilteringIterable(getPersistentEnums()) { - @Override - protected boolean accept(JaxbPersistentEnum o) { - return o.getPackageName().equals(jaxbPackage.getName()); - } - }; - } - - public JaxbPersistentEnum getPersistentEnum(String enumName) { - for (JaxbPersistentEnum jaxbEnum : this.getPersistentEnums()) { - if (StringTools.stringsAreEqual(jaxbEnum.getFullyQualifiedName(), enumName)) { - return jaxbEnum; - } - } - return null; - } - - @Override - public void stateChanged() { - super.stateChanged(); - // forward to JAXB project - this.jaxbProject.stateChanged(); - } - - - // **************** validation ******************************************** - - public void validate(List messages, IReporter reporter) { - for (JaxbPackage pkg : this.packages.values()) { - pkg.validate(messages, reporter); - } - for (JaxbType type : this.types.values()) { - type.validate(messages, reporter); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/GenericPackage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/GenericPackage.java deleted file mode 100644 index 81d1768702..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/GenericPackage.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context; - -import java.util.List; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; -import org.eclipse.jpt.jaxb.core.internal.validation.DefaultValidationMessages; -import org.eclipse.jpt.jaxb.core.internal.validation.JaxbValidationMessages; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.xsd.XsdSchema; -import org.eclipse.jpt.jaxb.core.xsd.XsdUtil; -import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; -import org.eclipse.xsd.XSDSchema; - -public class GenericPackage - extends AbstractJaxbContextNode - implements JaxbPackage { - - protected final String name; - - protected JaxbPackageInfo packageInfo; - - - public GenericPackage(JaxbContextRoot parent, String name) { - super(parent); - this.name = name; - JavaResourcePackage jrp = getJaxbProject().getAnnotatedJavaResourcePackage(this.name); - if (jrp != null) { - this.packageInfo = buildPackageInfo(jrp); - } - } - - - public void synchronizeWithResourceModel() { - if (this.packageInfo != null) { - this.packageInfo.synchronizeWithResourceModel(); - } - } - - //Building/removing of the packageInfo is in the update because this is dependent - //on a JaxbFile being added/removed which only causes an update of the model. - public void update() { - JavaResourcePackage jrp = getJaxbProject().getAnnotatedJavaResourcePackage(this.name); - if (jrp == null) { - this.setPackageInfo_(null); - } - else { - if (this.packageInfo == null) { - this.setPackageInfo_(this.buildPackageInfo(jrp)); - } - else { - this.packageInfo.update(); - } - } - } - - - // **************** name ************************************************** - - public String getName() { - return this.name; - } - - - // **************** package info ****************************************** - - public JaxbPackageInfo getPackageInfo() { - return this.packageInfo; - } - - protected void setPackageInfo_(JaxbPackageInfo packageInfo) { - JaxbPackageInfo old = this.packageInfo; - this.packageInfo = packageInfo; - firePropertyChanged(PACKAGE_INFO_PROPERTY, old, this.packageInfo); - } - - protected JaxbPackageInfo buildPackageInfo(JavaResourcePackage resourcePackage) { - return getFactory().buildJavaPackageInfo(this, resourcePackage); - } - - - public boolean isEmpty() { - return getPackageInfo() == null; - } - - - // **************** misc ************************************************** - - public String getNamespace() { - return (getPackageInfo() == null) ? "" : getPackageInfo().getXmlSchema().getNamespace(); - } - - public XsdSchema getXsdSchema() { - XSDSchema emfSchema = getJaxbProject().getSchemaLibrary().getSchema(getNamespace()); - return (emfSchema == null) ? null : (XsdSchema) XsdUtil.getAdapter(emfSchema); - } - - - // **************** validation ******************************************** - - public void validate(List messages, IReporter reporter) { - if (! getJaxbProject().getSchemaLibrary().getSchemaLocations().containsKey(getNamespace())) { - messages.add( - DefaultValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - JaxbValidationMessages.PACKAGE_NO_SCHEMA_FOR_NAMESPACE, - new String[] {getNamespace(), this.name}, - this)); - } - if (reporter.isCancelled()) { - throw new ValidationCancelledException(); - } - if (this.packageInfo != null) { - this.packageInfo.validate(messages, reporter); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAttributeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAttributeMapping.java deleted file mode 100644 index 405fbc3e2a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAttributeMapping.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; - -public abstract class AbstractJavaAttributeMapping - extends AbstractJavaContextNode - implements JaxbAttributeMapping -{ - - protected boolean default_; - - protected AbstractJavaAttributeMapping(JaxbPersistentAttribute parent) { - super(parent); - this.default_ = this.buildDefault(); - } - - // ********** synchronize/update ********** - - public void synchronizeWithResourceModel() { - this.updateDefault(); - } - - public void update() { - //do nothing - } - - // ********** annotation ********** - - @SuppressWarnings("unchecked") - public A getMappingAnnotation() { - return (A) this.getAnnotation_(); - } - - protected Annotation getAnnotation_() { - return this.getJavaResourceAttribute().getAnnotation(this.getAnnotationName()); - } - - protected abstract String getAnnotationName(); - - /** - * This method should only be called on mappings that can occur by default - * (e.g. XmlElement). - */ - public A getAnnotationForUpdate() { - A annotation = this.getMappingAnnotation(); - if (annotation == null) { - this.getPersistentAttribute().setMappingKey(this.getKey()); - annotation = this.getMappingAnnotation(); - if (annotation == null) { - throw new IllegalStateException("missing annotation: " + this); //$NON-NLS-1$ - } - } - return annotation; - } - - - // ********** default ********** - - public boolean isDefault() { - return this.default_; - } - - protected void setDefault(boolean default_) { - boolean old = this.default_; - this.default_ = default_; - this.firePropertyChanged(DEFAULT_PROPERTY, old, default_); - } - - public void updateDefault() { - this.setDefault(this.buildDefault()); - } - - protected boolean buildDefault() { - return this.getMappingAnnotation() == null; - } - - - // ********** validation ********** - - @Override - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return getAnnotation_() == null ? getJavaResourceAttribute().getNameTextRange(astRoot) : getAnnotation_().getTextRange(astRoot); - } - - - // ********** misc ********** - - @Override - public JaxbPersistentAttribute getParent() { - return (JaxbPersistentAttribute) super.getParent(); - } - - public JaxbPersistentAttribute getPersistentAttribute() { - return this.getParent(); - } - - public JavaResourceAttribute getJavaResourceAttribute() { - return this.getPersistentAttribute().getJavaResourceAttribute(); - } - - public String getJavaResourceAttributeType() { - return this.getPersistentAttribute().getJavaResourceAttributeTypeName(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAttributeMappingDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAttributeMappingDefinition.java deleted file mode 100644 index 135d71ba06..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaAttributeMappingDefinition.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.java.JavaAttributeMappingDefinition; - - -public abstract class AbstractJavaAttributeMappingDefinition - implements JavaAttributeMappingDefinition -{ - protected AbstractJavaAttributeMappingDefinition() { - super(); - } - - /** - * Default implementation. Override if the mapping definition needs to do more analysis. - */ - public boolean isSpecified(JaxbPersistentAttribute persistentAttribute) { - return persistentAttribute.getJavaResourceAttribute().getAnnotation(getAnnotationName()) - != null; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaContextNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaContextNode.java deleted file mode 100644 index ab6a7bf38f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaContextNode.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jaxb.core.JaxbNode; -import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode; -import org.eclipse.jpt.jaxb.core.internal.context.AbstractJaxbContextNode; -import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - - -public abstract class AbstractJavaContextNode - extends AbstractJaxbContextNode - implements JavaContextNode { - - // **************** constructor ******************************************* - - protected AbstractJavaContextNode(JaxbNode parent) { - super(parent); - } - - - // **************** content assist **************************************** - - public Iterable getJavaCompletionProposals( - int pos, Filter filter, CompilationUnit astRoot) { - return EmptyIterable.instance(); - } - - - // **************** validation ******************************************** - - public abstract TextRange getValidationTextRange(CompilationUnit astRoot); - - /** - * All subclass implementations {@link #validate(List, CompilationUnit))} - * should be preceded by a "super" call to this method - */ - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - if (reporter.isCancelled()) { - throw new ValidationCancelledException(); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaPersistentType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaPersistentType.java deleted file mode 100644 index 09d685d6df..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaPersistentType.java +++ /dev/null @@ -1,432 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import java.beans.Introspector; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentType; -import org.eclipse.jpt.jaxb.core.context.XmlRootElement; -import org.eclipse.jpt.jaxb.core.internal.validation.DefaultValidationMessages; -import org.eclipse.jpt.jaxb.core.internal.validation.JaxbValidationMessages; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation; -import org.eclipse.jpt.jaxb.core.xsd.XsdSchema; -import org.eclipse.jpt.jaxb.core.xsd.XsdTypeDefinition; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class AbstractJavaPersistentType - extends AbstractJavaType - implements JaxbPersistentType { - - protected String factoryClass; - protected String factoryMethod; - protected String specifiedXmlTypeName; - protected String specifiedNamespace; - protected final PropOrderContainer propOrderContainer; - - protected XmlRootElement rootElement; - - public AbstractJavaPersistentType(JaxbContextRoot parent, AbstractJavaResourceType resourceType) { - super(parent, resourceType); - this.factoryClass = this.getResourceFactoryClass(); - this.factoryMethod = this.getResourceFactoryMethod(); - this.specifiedXmlTypeName = this.getResourceXmlTypeName(); - this.specifiedNamespace = this.getResourceNamespace(); - this.propOrderContainer = new PropOrderContainer(); - this.rootElement = this.buildRootElement(); - } - - @Override - public JaxbContextRoot getParent() { - return (JaxbContextRoot) super.getParent(); - } - - protected JaxbPackageInfo getPackageInfo() { - JaxbPackage jaxbPackage = getParent().getPackage(this.getPackageName()); - return jaxbPackage == null ? null : jaxbPackage.getPackageInfo(); - } - - // ********** synchronize/update ********** - - public void synchronizeWithResourceModel() { - this.setFactoryClass_(getResourceFactoryClass()); - this.setFactoryMethod_(getResourceFactoryMethod()); - this.setSpecifiedXmlTypeName_(getResourceXmlTypeName()); - this.setSpecifiedNamespace_(getResourceNamespace()); - this.syncPropOrder(); - this.syncRootElement(); - } - - public void update() { - //nothing yet - } - - // ********** xml type annotation ********** - - protected XmlTypeAnnotation getXmlTypeAnnotation() { - return (XmlTypeAnnotation) this.getJavaResourceType().getNonNullAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - } - - - // ********** factory class ********** - - public String getFactoryClass() { - return this.factoryClass; - } - - public void setFactoryClass(String factoryClass) { - this.getXmlTypeAnnotation().setFactoryClass(factoryClass); - this.setFactoryClass_(factoryClass); - } - - protected void setFactoryClass_(String factoryClass) { - String old = this.factoryClass; - this.factoryClass = factoryClass; - this.firePropertyChanged(FACTORY_CLASS_PROPERTY, old, factoryClass); - } - - protected String getResourceFactoryClass() { - return this.getXmlTypeAnnotation().getFactoryClass(); - } - - // ********** factory method ********** - - public String getFactoryMethod() { - return this.factoryMethod; - } - - public void setFactoryMethod(String factoryMethod) { - this.getXmlTypeAnnotation().setFactoryMethod(factoryMethod); - this.setFactoryMethod_(factoryMethod); - } - - protected void setFactoryMethod_(String factoryMethod) { - String old = this.factoryMethod; - this.factoryMethod = factoryMethod; - this.firePropertyChanged(FACTORY_METHOD_PROPERTY, old, factoryMethod); - } - - protected String getResourceFactoryMethod() { - return this.getXmlTypeAnnotation().getFactoryMethod(); - } - - // ********** name ********** - - public String getXmlTypeName() { - return (this.specifiedXmlTypeName != null) ? this.specifiedXmlTypeName : getDefaultXmlTypeName(); - } - - public String getSpecifiedXmlTypeName() { - return this.specifiedXmlTypeName; - } - - public void setSpecifiedXmlTypeName(String xmlTypeName) { - this.getXmlTypeAnnotation().setName(xmlTypeName); - this.setSpecifiedXmlTypeName_(xmlTypeName); - } - - protected void setSpecifiedXmlTypeName_(String xmlTypeName) { - String old = this.specifiedXmlTypeName; - this.specifiedXmlTypeName = xmlTypeName; - this.firePropertyChanged(SPECIFIED_XML_TYPE_NAME_PROPERTY, old, xmlTypeName); - } - - public String getDefaultXmlTypeName() { - return Introspector.decapitalize(getSimpleName()); - } - - protected String getResourceXmlTypeName() { - return this.getXmlTypeAnnotation().getName(); - } - - - // ********** namespace ********** - - public String getNamespace() { - return (this.specifiedNamespace != null) ? this.specifiedNamespace : getDefaultNamespace(); - } - - public String getSpecifiedNamespace() { - return this.specifiedNamespace; - } - - public void setSpecifiedNamespace(String namespace) { - this.getXmlTypeAnnotation().setNamespace(namespace); - this.setSpecifiedNamespace_(namespace); - } - - protected void setSpecifiedNamespace_(String namespace) { - String old = this.specifiedNamespace; - this.specifiedNamespace = namespace; - this.firePropertyChanged(SPECIFIED_NAMESPACE_PROPERTY, old, namespace); - } - - public String getDefaultNamespace() { - return getJaxbPackage().getNamespace(); - } - - protected String getResourceNamespace() { - return this.getXmlTypeAnnotation().getNamespace(); - } - - - // ********** prop order ********** - - public ListIterable getPropOrder() { - return this.propOrderContainer.getContextElements(); - } - - public int getPropOrderSize() { - return this.propOrderContainer.getContextElementsSize(); - } - - public void addProp(int index, String prop) { - getXmlTypeAnnotation().addProp(index, prop); - this.propOrderContainer.addContextElement(index, prop); - } - - public void removeProp(String prop) { - this.removeProp(this.propOrderContainer.indexOfContextElement(prop)); - } - - public void removeProp(int index) { - this.getXmlTypeAnnotation().removeProp(index); - this.propOrderContainer.removeContextElement(index); - } - - public void moveProp(int targetIndex, int sourceIndex) { - this.getXmlTypeAnnotation().moveProp(targetIndex, sourceIndex); - this.propOrderContainer.moveContextElement(targetIndex, sourceIndex); - } - - protected void syncPropOrder() { - this.propOrderContainer.synchronizeWithResourceModel(); - } - - protected ListIterable getResourcePropOrder() { - return this.getXmlTypeAnnotation().getPropOrder(); - } - - // *************** root element ********************* - - public XmlRootElement getRootElement() { - return this.rootElement; - } - - public boolean isRootElement() { - return this.rootElement != null; - } - - public XmlRootElement setRootElement(String name) { - if (name == null) { - this.getJavaResourceType().removeAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); - this.setRootElement_(null); - return null; - } - XmlRootElementAnnotation resourceRootElement = (XmlRootElementAnnotation) getJavaResourceType().addAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); - resourceRootElement.setName(name); - XmlRootElement contextRootElement = this.buildRootElement(resourceRootElement); - this.setRootElement_(contextRootElement); - return contextRootElement; - } - - protected void setRootElement_(XmlRootElement rootElement) { - XmlRootElement old = this.rootElement; - this.rootElement = rootElement; - this.firePropertyChanged(ROOT_ELEMENT, old, rootElement); - } - - protected XmlRootElement buildRootElement() { - XmlRootElementAnnotation resourceRootElement = this.getRootElementAnnotation(); - return resourceRootElement == null ? null : this.buildRootElement(resourceRootElement); - } - - protected XmlRootElement buildRootElement(XmlRootElementAnnotation resourceRootElement) { - return getFactory().buildJavaXmlRootElement(this, resourceRootElement); - } - - protected void syncRootElement() { - XmlRootElementAnnotation resourceRootElement = this.getRootElementAnnotation(); - if (resourceRootElement != null) { - if (this.rootElement != null) { - this.rootElement.synchronizeWithResourceModel(); - } - else { - this.setRootElement_(this.buildRootElement(resourceRootElement)); - } - } - else if (this.rootElement != null) { - this.setRootElement_(null); - } - } - - protected XmlRootElementAnnotation getRootElementAnnotation() { - return (XmlRootElementAnnotation) this.getJavaResourceType().getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); - } - - - // **************** content assist **************************************** - - @Override - public Iterable getJavaCompletionProposals( - int pos, Filter filter, CompilationUnit astRoot) { - Iterable result = super.getJavaCompletionProposals(pos, filter, astRoot); - if (! CollectionTools.isEmpty(result)) { - return result; - } - - if (namespaceTouches(pos, astRoot)) { - return getNamespaceProposals(filter); - } - - if (nameTouches(pos, astRoot)) { - return getNameProposals(filter); - } - - if (this.rootElement != null) { - result = this.rootElement.getJavaCompletionProposals(pos, filter, astRoot); - if (! CollectionTools.isEmpty(result)) { - return result; - } - } - - return EmptyIterable.instance(); - } - - protected boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return getXmlTypeAnnotation().namespaceTouches(pos, astRoot); - } - - protected Iterable getNamespaceProposals(Filter filter) { - XsdSchema schema = getJaxbPackage().getXsdSchema(); - if (schema == null) { - return EmptyIterable.instance(); - } - return schema.getNamespaceProposals(filter); - } - - protected boolean nameTouches(int pos, CompilationUnit astRoot) { - return getXmlTypeAnnotation().nameTouches(pos, astRoot); - } - - protected Iterable getNameProposals(Filter filter) { - XsdSchema schema = getJaxbPackage().getXsdSchema(); - if (schema == null) { - return EmptyIterable.instance(); - } - return schema.getTypeNameProposals(getNamespace(), filter); - } - - - // **************** validation ******************************************** - - @Override - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = getXmlTypeAnnotation().getTextRange(astRoot); - return (textRange != null) ? textRange : super.getValidationTextRange(astRoot); - } - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - - validateXmlType(messages, reporter, astRoot); - - if (this.rootElement != null) { - this.rootElement.validate(messages, reporter, astRoot); - } - } - - protected void validateXmlType(List messages, IReporter reporter, CompilationUnit astRoot) { - // 1. if name is absent (""), namespace cannot be different from package namespace - // 2. if name is not absent (""), type must be from schema associated with this package - - String name = getXmlTypeName(); - String namespace = getNamespace(); - if ("".equals(name)) { - if (! StringTools.stringsAreEqual(namespace, getJaxbPackage().getNamespace())) { - messages.add( - DefaultValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JaxbValidationMessages.XML_TYPE_UNMATCHING_NAMESPACE_FOR_ANONYMOUS_TYPE, - this, - getXmlTypeAnnotation().getNamespaceTextRange(astRoot))); - } - } - else { - XsdSchema schema = getJaxbPackage().getXsdSchema(); - - if (schema != null) { - XsdTypeDefinition schemaType = schema.getTypeDefinition(namespace, name); - if (schemaType == null) { - messages.add( - DefaultValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JaxbValidationMessages.XML_TYPE_UNRESOLVED_SCHEMA_TYPE, - new String[] {name, namespace}, - this, - getXmlTypeAnnotation().getTextRange(astRoot))); - } - } - } - } - - - // **************** misc ************************************************** - - public XsdTypeDefinition getXsdTypeDefinition() { - XsdSchema xsdSchema = getJaxbPackage().getXsdSchema(); - return (xsdSchema == null) ? null : xsdSchema.getTypeDefinition(getNamespace(), getXmlTypeName()); - } - - @Override - public void toString(StringBuilder sb) { - super.toString(sb); - sb.append(this.getFullyQualifiedName()); - } - - - - /** - * xml prop order container - */ - protected class PropOrderContainer - extends ListContainer - { - @Override - protected String getContextElementsPropertyName() { - return PROP_ORDER_LIST; - } - @Override - protected String buildContextElement(String resourceElement) { - return resourceElement; - } - @Override - protected ListIterable getResourceElements() { - return AbstractJavaPersistentType.this.getResourcePropOrder(); - } - @Override - protected String getResourceElement(String contextElement) { - return contextElement; - } - } -} \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaType.java deleted file mode 100644 index 19e898537f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaType.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import java.util.List; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbType; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - - -public abstract class AbstractJavaType - extends AbstractJavaContextNode - implements JaxbType { - - protected final AbstractJavaResourceType resourceType; - - - protected AbstractJavaType(JaxbContextRoot parent, AbstractJavaResourceType resourceType) { - super(parent); - this.resourceType = resourceType; - - } - - - // **************** AbstractJaxbNode impl ********************************* - - @Override - public IResource getResource() { - return this.resourceType.getFile(); - } - - - // *********** JaxbType impl *********** - - public AbstractJavaResourceType getJavaResourceType() { - return this.resourceType; - } - - public String getFullyQualifiedName() { - return this.resourceType.getQualifiedName(); - } - - public String getTypeQualifiedName() { - String packageName = getPackageName(); - return (packageName.length() == 0) ? getFullyQualifiedName() : getFullyQualifiedName().substring(packageName.length() + 1); - } - - public String getSimpleName() { - return this.resourceType.getName(); - } - - public String getPackageName() { - return this.resourceType.getPackageName(); - } - - public JaxbPackage getJaxbPackage() { - return getContextRoot().getPackage(getPackageName()); - } - - - // **************** misc ************************************************** - - protected CompilationUnit buildASTRoot() { - return this.resourceType.getJavaResourceCompilationUnit().buildASTRoot(); - } - - - // **************** validation ******************************************** - - /** - * Override as needed - */ - @Override - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return getJavaResourceType().getNameTextRange(astRoot); - } - - public void validate(List messages, IReporter reporter) { - if (reporter.isCancelled()) { - throw new ValidationCancelledException(); - } - // TODO temporary hack since we don't know yet where to put - // any messages for types in another project - IFile file = this.resourceType.getFile(); - // 'file' will be null if the type is "external" and binary; - // the file will be in a different project if the type is "external" and source; - // the type will be binary if it is in a JAR in the current project - if ((file != null) - && file.getProject().equals(getJaxbProject().getProject()) - && (this.resourceType instanceof SourceNode)) { - // build the AST root here to pass down - this.validate(messages, reporter, this.buildASTRoot()); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaXmlJavaTypeAdapter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaXmlJavaTypeAdapter.java deleted file mode 100644 index 5657d3120d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/AbstractJavaXmlJavaTypeAdapter.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.context.JaxbContextNode; -import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; - -public abstract class AbstractJavaXmlJavaTypeAdapter - extends AbstractJavaContextNode - implements XmlJavaTypeAdapter -{ - - protected final XmlJavaTypeAdapterAnnotation resourceXmlJavaTypeAdapter; - - protected String value; - - protected String specifiedType; - - protected String defaultType; - - protected AbstractJavaXmlJavaTypeAdapter(JaxbContextNode parent, XmlJavaTypeAdapterAnnotation resource) { - super(parent); - this.resourceXmlJavaTypeAdapter = resource; - this.value = this.getResourceValue(); - this.specifiedType = this.getResourceTypeString(); - this.defaultType = this.buildDefaultType(); - } - - - // ********** synchronize/update ********** - - public void synchronizeWithResourceModel() { - this.setValue_(this.getResourceValue()); - this.setSpecifiedType_(this.getResourceTypeString()); - this.setDefaultType(this.buildDefaultType()); - } - - public void update() { - //nothing yet - } - - - // ********** xml java type adapter annotation ********** - - public XmlJavaTypeAdapterAnnotation getResourceXmlJavaTypeAdapter() { - return this.resourceXmlJavaTypeAdapter; - } - - // ********** value ********** - - public String getValue() { - return this.value; - } - - public void setValue(String value) { - this.resourceXmlJavaTypeAdapter.setValue(value); - this.setValue_(value); - } - - protected void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - protected String getResourceValue() { - return this.resourceXmlJavaTypeAdapter.getValue(); - } - - - // ********** type ********** - - public String getType() { - return this.specifiedTypeNotSet() ? this.getDefaultType() : this.getSpecifiedType(); - } - - /** - * @see javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter.DEFAULT - */ - protected boolean specifiedTypeNotSet() { - return getSpecifiedType() == null || getSpecifiedType().equals(DEFAULT_TYPE); - } - - public String getDefaultType() { - return this.defaultType; - } - - protected void setDefaultType(String defaultType) { - String oldDefaultType = this.defaultType; - this.defaultType = defaultType; - firePropertyChanged(DEFAULT_TYPE_PROPERTY, oldDefaultType, defaultType); - } - - protected abstract String buildDefaultType(); - - public String getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(String location) { - this.resourceXmlJavaTypeAdapter.setType(location); - this.setSpecifiedType_(location); - } - - protected void setSpecifiedType_(String type) { - String old = this.specifiedType; - this.specifiedType = type; - this.firePropertyChanged(SPECIFIED_TYPE_PROPERTY, old, type); - } - - protected String getResourceTypeString() { - return this.resourceXmlJavaTypeAdapter.getType(); - } - - - // ********** validation ********** - - @Override - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return getResourceXmlJavaTypeAdapter().getTextRange(astRoot); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapter.java deleted file mode 100644 index df7840cd84..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapter.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter; -import org.eclipse.jpt.jaxb.core.internal.validation.DefaultValidationMessages; -import org.eclipse.jpt.jaxb.core.internal.validation.JaxbValidationMessages; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaAttributeXmlJavaTypeAdapter - extends AbstractJavaXmlJavaTypeAdapter -{ - - public GenericJavaAttributeXmlJavaTypeAdapter(JaxbAttributeMapping parent, XmlJavaTypeAdapterAnnotation resource) { - super(parent, resource); - } - - @Override - public JaxbAttributeMapping getParent() { - return (JaxbAttributeMapping) super.getParent(); - } - - protected JaxbPersistentAttribute getPersistentAttribute() { - return getParent().getParent(); - } - - // ********** type ********** - - @Override - protected String buildDefaultType() { - return this.getPersistentAttribute().getJavaResourceAttributeTypeName(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - if (getType() == null || getType().equals(XmlJavaTypeAdapter.DEFAULT_TYPE)) { - messages.add( - DefaultValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JaxbValidationMessages.ATTRIBUTE_MAPPING_XML_JAVA_TYPE_ADAPTER_TYPE_NOT_DEFINED, - this, - getResourceXmlJavaTypeAdapter().getTypeTextRange(astRoot))); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaContainmentMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaContainmentMapping.java deleted file mode 100644 index b4e8c25b44..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaContainmentMapping.java +++ /dev/null @@ -1,369 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jaxb.core.context.JaxbContainmentMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.XmlAdaptable; -import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter; -import org.eclipse.jpt.jaxb.core.context.XmlList; -import org.eclipse.jpt.jaxb.core.context.XmlSchemaType; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JaxbContainmentAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class GenericJavaContainmentMapping - extends AbstractJavaAttributeMapping - implements JaxbContainmentMapping -{ - - protected String specifiedName; - - protected Boolean specifiedRequired; - - protected String specifiedNamespace; - - protected final XmlAdaptable xmlAdaptable; - - protected XmlSchemaType xmlSchemaType; - - protected XmlList xmlList; - - public GenericJavaContainmentMapping(JaxbPersistentAttribute parent) { - super(parent); - this.specifiedName = buildSpecifiedName(); - this.specifiedNamespace = buildSpecifiedNamespace(); - this.specifiedRequired = buildSpecifiedRequired(); - this.xmlAdaptable = buildXmlAdaptable(); - this.initializeXmlSchemaType(); - this.initializeXmlList(); - } - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - setSpecifiedName_(buildSpecifiedName()); - setSpecifiedNamespace_(buildSpecifiedNamespace()); - setSpecifiedRequired_(buildSpecifiedRequired()); - this.xmlAdaptable.synchronizeWithResourceModel(); - this.syncXmlSchemaType(); - this.syncXmlList(); - } - - @Override - public void update() { - super.update(); - this.xmlAdaptable.update(); - this.updateXmlSchemaType(); - this.updateXmlList(); - } - - //************ XmlAttribute.name *************** - public String getName() { - return this.getSpecifiedName() == null ? this.getDefaultName() : getSpecifiedName(); - } - - public String getDefaultName() { - return getJavaResourceAttribute().getName(); - } - - public String getSpecifiedName() { - return this.specifiedName; - } - - public void setSpecifiedName(String name) { - this.getAnnotationForUpdate().setName(name); - this.setSpecifiedName_(name); - } - - protected void setSpecifiedName_(String name) { - String old = this.specifiedName; - this.specifiedName = name; - firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedName() { - return getMappingAnnotation() == null ? null : getMappingAnnotation().getName(); - } - - - //************ required *************** - - public boolean isRequired() { - return (this.getSpecifiedRequired() == null) ? this.isDefaultRequired() : this.getSpecifiedRequired().booleanValue(); - } - - public boolean isDefaultRequired() { - return DEFAULT_REQUIRED; - } - - public Boolean getSpecifiedRequired() { - return this.specifiedRequired; - } - - public void setSpecifiedRequired(Boolean newSpecifiedRequired) { - this.getAnnotationForUpdate().setRequired(newSpecifiedRequired); - this.setSpecifiedRequired_(newSpecifiedRequired); - } - - protected void setSpecifiedRequired_(Boolean newSpecifiedRequired) { - Boolean oldRequired = this.specifiedRequired; - this.specifiedRequired = newSpecifiedRequired; - firePropertyChanged(SPECIFIED_REQUIRED_PROPERTY, oldRequired, newSpecifiedRequired); - } - - protected Boolean buildSpecifiedRequired() { - return getMappingAnnotation() == null ? null : getMappingAnnotation().getRequired(); - } - - - //************ XmlAttribute.namespace *************** - - public String getNamespace() { - return getSpecifiedNamespace() == null ? getDefaultNamespace() : getSpecifiedNamespace(); - } - - public String getDefaultNamespace() { - return getPersistentAttribute().getParent().getNamespace(); - } - - public String getSpecifiedNamespace() { - return this.specifiedNamespace; - } - - public void setSpecifiedNamespace(String newSpecifiedNamespace) { - this.getAnnotationForUpdate().setNamespace(newSpecifiedNamespace); - this.setSpecifiedNamespace_(newSpecifiedNamespace); - } - - protected void setSpecifiedNamespace_(String newSpecifiedNamespace) { - String oldNamespace = this.specifiedNamespace; - this.specifiedNamespace = newSpecifiedNamespace; - firePropertyChanged(SPECIFIED_NAMESPACE_PROPERTY, oldNamespace, newSpecifiedNamespace); - } - - protected String buildSpecifiedNamespace() { - return getMappingAnnotation() == null ? null : getMappingAnnotation().getNamespace(); - } - - - //****************** XmlJavaTypeAdapter ********************* - - public XmlAdaptable buildXmlAdaptable() { - return new GenericJavaXmlAdaptable(this, new XmlAdaptable.Owner() { - public JavaResourceAnnotatedElement getResource() { - return getJavaResourceAttribute(); - } - public XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation adapterAnnotation) { - return GenericJavaContainmentMapping.this.buildXmlJavaTypeAdapter(adapterAnnotation); - } - public void fireXmlAdapterChanged(XmlJavaTypeAdapter oldAdapter, XmlJavaTypeAdapter newAdapter) { - GenericJavaContainmentMapping.this.firePropertyChanged(XML_JAVA_TYPE_ADAPTER_PROPERTY, oldAdapter, newAdapter); - } - }); - } - - public XmlJavaTypeAdapter getXmlJavaTypeAdapter() { - return this.xmlAdaptable.getXmlJavaTypeAdapter(); - } - - public XmlJavaTypeAdapter addXmlJavaTypeAdapter() { - return this.xmlAdaptable.addXmlJavaTypeAdapter(); - } - - protected XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation) { - return new GenericJavaAttributeXmlJavaTypeAdapter(this, xmlJavaTypeAdapterAnnotation); - } - - public void removeXmlJavaTypeAdapter() { - this.xmlAdaptable.removeXmlJavaTypeAdapter(); - } - - //****************** XmlSchemaType ********************* - - public XmlSchemaType getXmlSchemaType() { - return this.xmlSchemaType; - } - - protected void setXmlSchemaType_(XmlSchemaType xmlSchemaType) { - XmlSchemaType oldXmlSchemaType = this.xmlSchemaType; - this.xmlSchemaType = xmlSchemaType; - this.firePropertyChanged(XML_SCHEMA_TYPE, oldXmlSchemaType, xmlSchemaType); - } - - public boolean hasXmlSchemaType() { - return this.xmlSchemaType != null; - } - - public XmlSchemaType addXmlSchemaType() { - if (this.xmlSchemaType != null) { - throw new IllegalStateException(); - } - XmlSchemaTypeAnnotation annotation = (XmlSchemaTypeAnnotation) this.getJavaResourceAttribute().addAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - - XmlSchemaType xmlJavaTypeAdapter = this.buildXmlSchemaType(annotation); - this.setXmlSchemaType_(xmlJavaTypeAdapter); - return xmlJavaTypeAdapter; - } - - public void removeXmlSchemaType() { - if (this.xmlSchemaType == null) { - throw new IllegalStateException(); - } - this.getJavaResourceAttribute().removeAnnotation(XmlSchemaTypeAnnotation.ANNOTATION_NAME); - this.setXmlSchemaType_(null); - } - - protected XmlSchemaType buildXmlSchemaType(XmlSchemaTypeAnnotation annotation) { - return new GenericJavaContainmentMappingXmlSchemaType(this, annotation); - } - - protected XmlSchemaTypeAnnotation getXmlSchemaTypeAnnotation() { - return (XmlSchemaTypeAnnotation) this.getJavaResourceAttribute().getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - } - - protected void initializeXmlSchemaType() { - XmlSchemaTypeAnnotation annotation = this.getXmlSchemaTypeAnnotation(); - if (annotation != null) { - this.xmlSchemaType = this.buildXmlSchemaType(annotation); - } - } - - protected void updateXmlSchemaType() { - if (this.xmlSchemaType != null) { - this.xmlSchemaType.update(); - } - } - - protected void syncXmlSchemaType() { - XmlSchemaTypeAnnotation annotation = this.getXmlSchemaTypeAnnotation(); - if (annotation != null) { - if (this.getXmlSchemaType() != null) { - this.getXmlSchemaType().synchronizeWithResourceModel(); - } - else { - this.setXmlSchemaType_(this.buildXmlSchemaType(annotation)); - } - } - else { - this.setXmlSchemaType_(null); - } - } - - //************ XmlList *************** - - public XmlList getXmlList() { - return this.xmlList; - } - - public XmlList addXmlList() { - if (this.xmlList != null) { - throw new IllegalStateException(); - } - XmlListAnnotation annotation = (XmlListAnnotation) this.getJavaResourceAttribute().addAnnotation(XmlListAnnotation.ANNOTATION_NAME); - - XmlList xmlList = this.buildXmlList(annotation); - this.setXmlList_(xmlList); - return xmlList; - } - - protected XmlList buildXmlList(XmlListAnnotation xmlListAnnotation) { - return new GenericJavaXmlList(this, xmlListAnnotation); - } - - public void removeXmlList() { - if (this.xmlList == null) { - throw new IllegalStateException(); - } - this.getJavaResourceAttribute().removeAnnotation(XmlListAnnotation.ANNOTATION_NAME); - this.setXmlList_(null); - } - - protected void initializeXmlList() { - XmlListAnnotation annotation = this.getXmlListAnnotation(); - if (annotation != null) { - this.xmlList = this.buildXmlList(annotation); - } - } - - protected XmlListAnnotation getXmlListAnnotation() { - return (XmlListAnnotation) this.getJavaResourceAttribute().getAnnotation(XmlListAnnotation.ANNOTATION_NAME); - } - - protected void syncXmlList() { - XmlListAnnotation annotation = this.getXmlListAnnotation(); - if (annotation != null) { - if (this.getXmlList() != null) { - this.getXmlList().synchronizeWithResourceModel(); - } - else { - this.setXmlList_(this.buildXmlList(annotation)); - } - } - else { - this.setXmlList_(null); - } - } - - protected void updateXmlList() { - if (this.getXmlList() != null) { - this.getXmlList().update(); - } - } - - protected void setXmlList_(XmlList xmlList) { - XmlList oldXmlList = this.xmlList; - this.xmlList = xmlList; - firePropertyChanged(XML_LIST_PROPERTY, oldXmlList, xmlList); - } - - - // **************** content assist ************** - - @Override - public Iterable getJavaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterable result = super.getJavaCompletionProposals(pos, filter, astRoot); - if (! CollectionTools.isEmpty(result)) { - return result; - } - - if (this.xmlSchemaType != null) { - result = this.xmlSchemaType.getJavaCompletionProposals(pos, filter, astRoot); - if (! CollectionTools.isEmpty(result)) { - return result; - } - } - - return EmptyIterable.instance(); - } - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.xmlAdaptable.validate(messages, reporter, astRoot); - if (this.xmlSchemaType != null) { - this.xmlSchemaType.validate(messages, reporter, astRoot); - } - if (this.xmlList != null) { - this.xmlList.validate(messages, reporter, astRoot); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaContainmentMappingXmlSchemaType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaContainmentMappingXmlSchemaType.java deleted file mode 100644 index 52a57fdafd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaContainmentMappingXmlSchemaType.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.jaxb.core.context.JaxbContainmentMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; - -public class GenericJavaContainmentMappingXmlSchemaType - extends GenericJavaXmlSchemaType -{ - - public GenericJavaContainmentMappingXmlSchemaType(JaxbContainmentMapping parent, XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation) { - super(parent, xmlSchemaTypeAnnotation); - } - - @Override - public JaxbContainmentMapping getParent() { - return (JaxbContainmentMapping) super.getParent(); - } - - protected JaxbContainmentMapping getJaxbContainmentMapping() { - return getParent(); - } - - protected JaxbPersistentAttribute getPersistentAttribute() { - return getJaxbContainmentMapping().getParent(); - } - - protected JaxbPersistentClass getPersistentClass() { - return getPersistentAttribute().getParent(); - } - - @Override - protected JaxbPackage getJaxbPackage() { - return this.getPersistentClass().getJaxbPackage(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaElementFactoryMethod.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaElementFactoryMethod.java deleted file mode 100644 index 06fab230ad..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaElementFactoryMethod.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.jaxb.core.context.JaxbElementFactoryMethod; -import org.eclipse.jpt.jaxb.core.context.JaxbRegistry; -import org.eclipse.jpt.jaxb.core.internal.context.AbstractJaxbContextNode; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementDeclAnnotation; - -public class GenericJavaElementFactoryMethod - extends AbstractJaxbContextNode - implements JaxbElementFactoryMethod { - - protected final JavaResourceMethod resourceMethod; - - protected String elementName; - protected String defaultValue; - protected String namespace; - protected String scope; - protected String substitutionHeadName; - protected String substitutionHeadNamespace; - - public GenericJavaElementFactoryMethod(JaxbRegistry parent, JavaResourceMethod resourceMethod) { - super(parent); - this.resourceMethod = resourceMethod; - this.elementName = this.getResourceElementName(); - this.defaultValue = this.getResourceDefaultValue(); - this.namespace = this.getResourceNamespace(); - this.scope = this.getResourceScope(); - this.substitutionHeadName = this.getResourceSubstitutionHeadName(); - this.substitutionHeadNamespace = this.getResourceSubstitutionHeadNamespace(); - } - - public JavaResourceMethod getResourceMethod() { - return this.resourceMethod; - } - - // ********** synchronize/update ********** - - public void synchronizeWithResourceModel() { - this.setElementName_(this.getResourceElementName()); - this.setDefaultValue_(this.getResourceDefaultValue()); - this.setNamespace_(this.getResourceNamespace()); - this.setScope_(this.getResourceScope()); - this.setSubstitutionHeadName_(this.getResourceSubstitutionHeadName()); - this.setSubstitutionHeadNamespace_(this.getResourceSubstitutionHeadNamespace()); - } - - public void update() { - // nothing yet - } - - // ********** xml enum value annotation ********** - - protected XmlElementDeclAnnotation getXmlElementDeclAnnotation() { - return (XmlElementDeclAnnotation) this.getResourceMethod().getNonNullAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); - } - - - // ************** JaxbElementFactoryMethod impl *********** - - public String getName() { - return this.resourceMethod.getName(); - } - - // ********** element name ********** - - public String getElementName() { - return this.elementName; - } - - public void setElementName(String elementName) { - this.getXmlElementDeclAnnotation().setName(elementName); - this.setElementName_(elementName); - } - - protected void setElementName_(String elementName) { - String old = this.elementName; - this.elementName = elementName; - this.firePropertyChanged(ELEMENT_NAME_PROPERTY, old, elementName); - } - - protected String getResourceElementName() { - return this.getXmlElementDeclAnnotation().getName(); - } - - public String getDefaultValue() { - return this.defaultValue; - } - - public void setDefaultValue(String defaultValue) { - this.getXmlElementDeclAnnotation().setDefaultValue(defaultValue); - this.setDefaultValue_(defaultValue); - } - - protected void setDefaultValue_(String defaultValue) { - String old = this.defaultValue; - this.defaultValue = defaultValue; - this.firePropertyChanged(DEFAULT_VALUE_PROPERTY, old, defaultValue); - } - - protected String getResourceDefaultValue() { - return this.getXmlElementDeclAnnotation().getDefaultValue(); - } - - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - this.getXmlElementDeclAnnotation().setNamespace(namespace); - this.setNamespace_(namespace); - } - - protected void setNamespace_(String namespace) { - String old = this.namespace; - this.namespace = namespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - protected String getResourceNamespace() { - return this.getXmlElementDeclAnnotation().getNamespace(); - } - - public String getScope() { - return this.scope; - } - - public void setScope(String scope) { - this.getXmlElementDeclAnnotation().setScope(scope); - this.setScope_(scope); - } - - protected void setScope_(String scope) { - String old = this.scope; - this.scope = scope; - this.firePropertyChanged(SCOPE_PROPERTY, old, scope); - } - - protected String getResourceScope() { - return this.getXmlElementDeclAnnotation().getScope(); - } - - public String getSubstitutionHeadName() { - return this.substitutionHeadName; - } - - public void setSubstitutionHeadName(String substitutionHeadName) { - this.getXmlElementDeclAnnotation().setSubstitutionHeadName(substitutionHeadName); - this.setSubstitutionHeadName_(substitutionHeadName); - } - - protected void setSubstitutionHeadName_(String substitutionHeadName) { - String old = this.substitutionHeadName; - this.substitutionHeadName = substitutionHeadName; - this.firePropertyChanged(SUBSTIUTION_HEAD_NAME_PROPERTY, old, substitutionHeadName); - } - - protected String getResourceSubstitutionHeadName() { - return this.getXmlElementDeclAnnotation().getSubstitutionHeadName(); - } - - public String getSubstitutionHeadNamespace() { - return this.substitutionHeadNamespace; - } - - public void setSubstitutionHeadNamespace(String substitutionHeadNamespace) { - this.getXmlElementDeclAnnotation().setSubstitutionHeadNamespace(substitutionHeadNamespace); - this.setSubstitutionHeadNamespace_(substitutionHeadNamespace); - } - - protected void setSubstitutionHeadNamespace_(String substitutionHeadNamespace) { - String old = this.substitutionHeadNamespace; - this.substitutionHeadNamespace = substitutionHeadNamespace; - this.firePropertyChanged(SUBSTIUTION_HEAD_NAMESPACE_PROPERTY, old, substitutionHeadNamespace); - } - - protected String getResourceSubstitutionHeadNamespace() { - return this.getXmlElementDeclAnnotation().getSubstitutionHeadNamespace(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaEnumConstant.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaEnumConstant.java deleted file mode 100644 index 692add0b8b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaEnumConstant.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.jaxb.core.context.JaxbEnumConstant; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; -import org.eclipse.jpt.jaxb.core.internal.context.AbstractJaxbContextNode; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation; - -public class GenericJavaEnumConstant - extends AbstractJaxbContextNode - implements JaxbEnumConstant { - - final protected JavaResourceEnumConstant resourceEnumConstant; - - protected String specifiedValue; - - public GenericJavaEnumConstant(JaxbPersistentEnum parent, JavaResourceEnumConstant resourceEnumConstant) { - super(parent); - this.resourceEnumConstant = resourceEnumConstant; - this.specifiedValue = this.getResourceEnumValue(); - } - - public JavaResourceEnumConstant getResourceEnumConstant() { - return this.resourceEnumConstant; - } - - - // ********** synchronize/update ********** - - public void synchronizeWithResourceModel() { - this.setSpecifiedValue_(this.getResourceEnumValue()); - } - - public void update() { - // nothing yet - } - - - // ********** xml enum value annotation ********** - - protected XmlEnumValueAnnotation getXmlEnumValueAnnotation() { - return (XmlEnumValueAnnotation) this.getResourceEnumConstant().getNonNullAnnotation(XmlEnumValueAnnotation.ANNOTATION_NAME); - } - - - // ********** name ********** - - public String getName() { - return this.resourceEnumConstant.getName(); - } - - // ********** value ********** - - public String getValue() { - return this.getSpecifiedValue() != null ? this.getSpecifiedValue() : this.getDefaultValue(); - } - - public String getDefaultValue() { - return this.getName(); - } - - public String getSpecifiedValue() { - return this.specifiedValue; - } - - public void setSpecifiedValue(String value) { - this.getXmlEnumValueAnnotation().setValue(value); - this.setSpecifiedValue_(value); - } - - protected void setSpecifiedValue_(String value) { - String old = this.specifiedValue; - this.specifiedValue = value; - this.firePropertyChanged(SPECIFIED_VALUE_PROPERTY, old, value); - } - - protected String getResourceEnumValue() { - return this.getXmlEnumValueAnnotation().getValue(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaNullAttributeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaNullAttributeMapping.java deleted file mode 100644 index 18e688deca..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaNullAttributeMapping.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.jaxb.core.MappingKeys; -import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; - - -public class GenericJavaNullAttributeMapping - extends AbstractJavaAttributeMapping - implements JaxbAttributeMapping -{ - public GenericJavaNullAttributeMapping(JaxbPersistentAttribute parent) { - super(parent); - } - - public String getKey() { - return MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY; - } - - @Override - public String getAnnotationName() { - return null; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageInfo.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageInfo.java deleted file mode 100644 index 50605611e5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageInfo.java +++ /dev/null @@ -1,369 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import java.util.List; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; -import org.eclipse.jpt.jaxb.core.context.XmlAccessOrder; -import org.eclipse.jpt.jaxb.core.context.XmlAccessType; -import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter; -import org.eclipse.jpt.jaxb.core.context.XmlSchema; -import org.eclipse.jpt.jaxb.core.context.XmlSchemaType; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; -import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaPackageInfo - extends AbstractJavaContextNode - implements JaxbPackageInfo { - - protected final JavaResourcePackage resourcePackage; - - protected final XmlSchema xmlSchema; - - protected XmlAccessType specifiedAccessType; - - protected XmlAccessOrder specifiedAccessOrder; - - protected final XmlSchemaTypeContainer xmlSchemaTypeContainer; - - protected final XmlJavaTypeAdapterContainer xmlJavaTypeAdapterContainer; - - public GenericJavaPackageInfo(JaxbPackage parent, JavaResourcePackage resourcePackage) { - super(parent); - this.resourcePackage = resourcePackage; - this.xmlSchema = getFactory().buildJavaXmlSchema(this); - this.specifiedAccessType = getResourceAccessType(); - this.specifiedAccessOrder = getResourceAccessOrder(); - this.xmlSchemaTypeContainer = new XmlSchemaTypeContainer(); - this.xmlJavaTypeAdapterContainer = new XmlJavaTypeAdapterContainer(); - } - - @Override - public JaxbPackage getParent() { - return (JaxbPackage) super.getParent(); - } - - - // **************** AbstractJaxbNode impl ********************************* - - @Override - public IResource getResource() { - return this.resourcePackage.getFile(); - } - - - // ********** synchronize/update ********** - - public void synchronizeWithResourceModel() { - this.xmlSchema.synchronizeWithResourceModel(); - this.setSpecifiedAccessType_(this.getResourceAccessType()); - this.setSpecifiedAccessOrder_(this.getResourceAccessOrder()); - this.syncXmlSchemaTypes(); - this.syncXmlJavaTypeAdapters(); - } - - public void update() { - this.xmlSchema.update(); - } - - - // ********** JaxbPackageInfo implementation ********** - - public JavaResourcePackage getResourcePackage() { - return this.resourcePackage; - } - - // ********** xml schema ********** - - public XmlSchema getXmlSchema() { - return this.xmlSchema; - } - - // ********** access type ********** - - public XmlAccessType getAccessType() { - return (this.specifiedAccessType != null) ? this.specifiedAccessType : this.getDefaultAccessType(); - } - - public XmlAccessType getSpecifiedAccessType() { - return this.specifiedAccessType; - } - - public void setSpecifiedAccessType(XmlAccessType access) { - this.getAccessorTypeAnnotation().setValue(XmlAccessType.toJavaResourceModel(access)); - this.setSpecifiedAccessType_(access); - } - - protected void setSpecifiedAccessType_(XmlAccessType access) { - XmlAccessType old = this.specifiedAccessType; - this.specifiedAccessType = access; - this.firePropertyChanged(SPECIFIED_ACCESS_TYPE_PROPERTY, old, access); - } - - public XmlAccessType getDefaultAccessType() { - return XmlAccessType.PUBLIC_MEMBER; - } - - protected XmlAccessType getResourceAccessType() { - return XmlAccessType.fromJavaResourceModel(this.getAccessorTypeAnnotation().getValue()); - } - - protected XmlAccessorTypeAnnotation getAccessorTypeAnnotation() { - return (XmlAccessorTypeAnnotation) this.resourcePackage.getNonNullAnnotation(XmlAccessorTypeAnnotation.ANNOTATION_NAME); - } - - - // ********** access order ********** - - public XmlAccessOrder getAccessOrder() { - return (this.specifiedAccessOrder != null) ? this.specifiedAccessOrder : this.getDefaultAccessOrder(); - } - - public XmlAccessOrder getSpecifiedAccessOrder() { - return this.specifiedAccessOrder; - } - - public void setSpecifiedAccessOrder(XmlAccessOrder accessOrder) { - this.getAccessorOrderAnnotation().setValue(XmlAccessOrder.toJavaResourceModel(accessOrder)); - this.setSpecifiedAccessOrder_(accessOrder); - } - - protected void setSpecifiedAccessOrder_(XmlAccessOrder accessOrder) { - XmlAccessOrder old = this.specifiedAccessOrder; - this.specifiedAccessOrder = accessOrder; - this.firePropertyChanged(SPECIFIED_ACCESS_ORDER_PROPERTY, old, accessOrder); - } - - public XmlAccessOrder getDefaultAccessOrder() { - return XmlAccessOrder.UNDEFINED; - } - - protected XmlAccessOrder getResourceAccessOrder() { - return XmlAccessOrder.fromJavaResourceModel(this.getAccessorOrderAnnotation().getValue()); - } - - protected XmlAccessorOrderAnnotation getAccessorOrderAnnotation() { - return (XmlAccessorOrderAnnotation) this.resourcePackage.getNonNullAnnotation(XmlAccessorOrderAnnotation.ANNOTATION_NAME); - } - - - // ********** xml schema types ********** - - public ListIterable getXmlSchemaTypes() { - return this.xmlSchemaTypeContainer.getContextElements(); - } - - public int getXmlSchemaTypesSize() { - return this.xmlSchemaTypeContainer.getContextElementsSize(); - } - - public XmlSchemaType addXmlSchemaType(int index) { - XmlSchemaTypeAnnotation annotation = (XmlSchemaTypeAnnotation) this.resourcePackage.addAnnotation(index, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - return this.xmlSchemaTypeContainer.addContextElement(index, annotation); - } - - public void removeXmlSchemaType(XmlSchemaType xmlSchemaType) { - this.removeXmlSchemaType(this.xmlSchemaTypeContainer.indexOfContextElement(xmlSchemaType)); - } - - public void removeXmlSchemaType(int index) { - this.resourcePackage.removeAnnotation(index, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - this.xmlSchemaTypeContainer.removeContextElement(index); - } - - public void moveXmlSchemaType(int targetIndex, int sourceIndex) { - this.resourcePackage.moveAnnotation(targetIndex, sourceIndex, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - this.xmlSchemaTypeContainer.moveContextElement(targetIndex, sourceIndex); - } - - protected XmlSchemaType buildXmlSchemaType(XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation) { - return new GenericJavaPackageXmlSchemaType(this, xmlSchemaTypeAnnotation); - } - - protected void syncXmlSchemaTypes() { - this.xmlSchemaTypeContainer.synchronizeWithResourceModel(); - } - - @SuppressWarnings("unchecked") - protected ListIterable getXmlSchemaTypeAnnotations() { - return (ListIterable) this.resourcePackage.getAnnotations(XmlSchemaTypeAnnotation.ANNOTATION_NAME); - } - - - // ********** xml java type adapters ********** - - public ListIterable getXmlJavaTypeAdapters() { - return this.xmlJavaTypeAdapterContainer.getContextElements(); - } - - public int getXmlJavaTypeAdaptersSize() { - return this.xmlJavaTypeAdapterContainer.getContextElementsSize(); - } - - public XmlJavaTypeAdapter addXmlJavaTypeAdapter(int index) { - XmlJavaTypeAdapterAnnotation annotation = (XmlJavaTypeAdapterAnnotation) this.resourcePackage.addAnnotation(index, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - return this.xmlJavaTypeAdapterContainer.addContextElement(index, annotation); - } - - public void removeXmlJavaTypeAdapter(XmlJavaTypeAdapter xmlSchemaType) { - this.removeXmlJavaTypeAdapter(this.xmlJavaTypeAdapterContainer.indexOfContextElement(xmlSchemaType)); - } - - public void removeXmlJavaTypeAdapter(int index) { - this.resourcePackage.removeAnnotation(index, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - this.xmlJavaTypeAdapterContainer.removeContextElement(index); - } - - public void moveXmlJavaTypeAdapter(int targetIndex, int sourceIndex) { - this.resourcePackage.moveAnnotation(targetIndex, sourceIndex, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - this.xmlJavaTypeAdapterContainer.moveContextElement(targetIndex, sourceIndex); - } - - protected XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation) { - return new GenericJavaPackageXmlJavaTypeAdapter(this, xmlJavaTypeAdapterAnnotation); - } - - protected void syncXmlJavaTypeAdapters() { - this.xmlJavaTypeAdapterContainer.synchronizeWithResourceModel(); - } - - @SuppressWarnings("unchecked") - protected ListIterable getXmlJavaTypeAdapterAnnotations() { - return (ListIterable) this.resourcePackage.getAnnotations(XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - - - // **************** misc ************************************************** - - protected CompilationUnit buildASTRoot() { - return this.resourcePackage.getJavaResourceCompilationUnit().buildASTRoot(); - } - - // **************** content assist **************************************** - - //This doesn't actually work yet because of JDT bug (bugs.eclipse.org/326610) - @Override - public Iterable getJavaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterable result = super.getJavaCompletionProposals(pos, filter, astRoot); - if (! CollectionTools.isEmpty(result)) { - return result; - } - - result = this.xmlSchema.getJavaCompletionProposals(pos, filter, astRoot); - if (! CollectionTools.isEmpty(result)) { - return result; - } - for (XmlSchemaType xmlSchemaType : this.getXmlSchemaTypes()) { - result = xmlSchemaType.getJavaCompletionProposals(pos, filter, astRoot); - if (!CollectionTools.isEmpty(result)) { - return result; - } - } - - return EmptyIterable.instance(); - } - - // **************** validation ******************************************** - - @Override - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.resourcePackage.getNameTextRange(astRoot); - } - - public void validate(List messages, IReporter reporter) { - if (reporter.isCancelled()) { - throw new ValidationCancelledException(); - } - IFile file = this.resourcePackage.getFile(); - // 'file' will be null if the type is "external" and binary; - // the file will be in a different project if the type is "external" and source; - // the type will be binary if it is in a JAR in the current project - if ((file != null) - && file.getProject().equals(getJaxbProject().getProject()) - && (this.resourcePackage instanceof SourceNode)) { - // build the AST root here to pass down - this.validate(messages, reporter, this.buildASTRoot()); - } - } - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - - for (XmlJavaTypeAdapter adapter : getXmlJavaTypeAdapters()) { - adapter.validate(messages, reporter, astRoot); - } - } - - - /** - * xml schema type container - */ - protected class XmlSchemaTypeContainer - extends ContextListContainer - { - @Override - protected String getContextElementsPropertyName() { - return XML_SCHEMA_TYPES_LIST; - } - @Override - protected XmlSchemaType buildContextElement(XmlSchemaTypeAnnotation resourceElement) { - return GenericJavaPackageInfo.this.buildXmlSchemaType(resourceElement); - } - @Override - protected ListIterable getResourceElements() { - return GenericJavaPackageInfo.this.getXmlSchemaTypeAnnotations(); - } - @Override - protected XmlSchemaTypeAnnotation getResourceElement(XmlSchemaType contextElement) { - return contextElement.getResourceXmlSchemaType(); - } - } - - /** - * xml java type adapter container - */ - protected class XmlJavaTypeAdapterContainer - extends ContextListContainer - { - @Override - protected String getContextElementsPropertyName() { - return XML_JAVA_TYPE_ADAPTERS_LIST; - } - @Override - protected XmlJavaTypeAdapter buildContextElement(XmlJavaTypeAdapterAnnotation resourceElement) { - return GenericJavaPackageInfo.this.buildXmlJavaTypeAdapter(resourceElement); - } - @Override - protected ListIterable getResourceElements() { - return GenericJavaPackageInfo.this.getXmlJavaTypeAdapterAnnotations(); - } - @Override - protected XmlJavaTypeAdapterAnnotation getResourceElement(XmlJavaTypeAdapter contextElement) { - return contextElement.getResourceXmlJavaTypeAdapter(); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageXmlJavaTypeAdapter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageXmlJavaTypeAdapter.java deleted file mode 100644 index 14f9daf4ab..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageXmlJavaTypeAdapter.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; -import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter; -import org.eclipse.jpt.jaxb.core.internal.validation.DefaultValidationMessages; -import org.eclipse.jpt.jaxb.core.internal.validation.JaxbValidationMessages; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaPackageXmlJavaTypeAdapter - extends AbstractJavaXmlJavaTypeAdapter -{ - - public GenericJavaPackageXmlJavaTypeAdapter(JaxbPackageInfo parent, XmlJavaTypeAdapterAnnotation resource) { - super(parent, resource); - } - - @Override - protected String buildDefaultType() { - //there is no default type on a package level XmlJavaTypeAdapter, it must be specified - return null; - } - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - if (getSpecifiedType() == null || getSpecifiedType().equals(XmlJavaTypeAdapter.DEFAULT_TYPE)) { - messages.add( - DefaultValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JaxbValidationMessages.PACKAGE_XML_JAVA_TYPE_ADAPTER_TYPE_NOT_SPECIFIED, - this, - getResourceXmlJavaTypeAdapter().getTypeTextRange(astRoot))); - } - - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageXmlSchemaType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageXmlSchemaType.java deleted file mode 100644 index 2bfc690fa0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPackageXmlSchemaType.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; - -public class GenericJavaPackageXmlSchemaType - extends GenericJavaXmlSchemaType -{ - - public GenericJavaPackageXmlSchemaType(JaxbPackageInfo parent, XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation) { - super(parent, xmlSchemaTypeAnnotation); - } - - @Override - public JaxbPackageInfo getParent() { - return (JaxbPackageInfo) super.getParent(); - } - - protected JaxbPackageInfo getJaxbPackageInfo() { - return getParent(); - } - - @Override - protected JaxbPackage getJaxbPackage() { - return getJaxbPackageInfo().getParent(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentAttribute.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentAttribute.java deleted file mode 100644 index 247b378223..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentAttribute.java +++ /dev/null @@ -1,380 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import java.util.Collection; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class GenericJavaPersistentAttribute - extends AbstractJavaContextNode - implements JaxbPersistentAttribute { - - protected JaxbAttributeMapping mapping; // never null - protected String defaultMappingKey; - - - protected GenericJavaPersistentAttribute(JaxbPersistentClass parent) { - super(parent); - } - - @Override - public JaxbPersistentClass getParent() { - return (JaxbPersistentClass) super.getParent(); - } - - /** - * subclasses must call this method in their constructor - */ - protected void initializeMapping() { - // keep non-null at all times - this.mapping = this.buildMapping(); - } - - // ********** synchronize/update ********** - - public void synchronizeWithResourceModel() { - this.syncMapping(); - } - - public void update() { - this.updateMapping(); - } - - // ********** name ********** - - public String getName() { - return this.getJavaResourceAttribute().getName(); - } - - // ********** mapping ********** - - public JaxbAttributeMapping getMapping() { - return this.mapping; - } - - /** - * Clients do not set the mapping directly. - * @see #setMappingKey(String) - */ - protected void setMapping(JaxbAttributeMapping mapping) { - JaxbAttributeMapping old = this.mapping; - this.mapping = mapping; - this.firePropertyChanged(MAPPING_PROPERTY, old, mapping); - } - - public String getMappingKey() { - return this.mapping.getKey(); - } - - /** - * Possible transitions: - * - * - * - * - *
- * null mapping/default
- * key = null - *
specified mapping A
- * key = "A" - *
specified mapping B
- * key = "B" - *
[default] null mapping - * do nothing - * add annotation A
- * set new mapping A - *
add annotation B
- * set new mapping B - *
default mapping A - * do nothing - * add annotation A
- * re-use default mapping A - *
add annotation B
- * set new mapping B - *
specified mapping A - * remove annotation A
- * set new default or null mapping - *
do nothing - * remove annotation A
- * add annotation B
- * set new mapping B - *
- * The "do nothing" transitions are handled in this method. - */ - public JaxbAttributeMapping setMappingKey(String key) { - if (this.mapping.isDefault()) { - if (key == null) { - // leave the default mapping unchanged - } else { - this.setMappingKey_(key); // replace the default mapping - } - } else { - if (this.valuesAreEqual(key, this.mapping.getKey())) { - // leave the specified mapping unchanged - } else { - this.setMappingKey_(key); // replace the specified mapping - } - } - return this.mapping; - } - - /** - * We have either:

or
    - *
  • a specified mapping and a different (possibly - * null) key - *
- */ - protected void setMappingKey_(String key) { - JavaAttributeMappingDefinition definition = this.getSpecifiedMappingDefinition(key); - if (definition == null) { - // our mapping is "specified" and the key is null; - // check for a default definition - definition = this.getDefaultMappingDefinition(); - Iterable supportingAnnotationNames = (definition != null) ? definition.getSupportingAnnotationNames() : EmptyIterable.instance(); - // clear any mapping annotation(s); - // leave the "default" mapping's supporting annotations; - // if there is no "default" mapping, clear all supporting annotations too(?) - this.setMappingAnnotation(null, supportingAnnotationNames); - } else { - this.setMappingAnnotation(definition); - } - // note: 'definition' can still be null (if the key is null and there is no "default" mapping) - this.setMapping(this.buildMapping(definition)); - } - - /** - * pre-condition: definition is not null - */ - protected void setMappingAnnotation(JavaAttributeMappingDefinition definition) { - this.setMappingAnnotation(definition.getAnnotationName(), definition.getSupportingAnnotationNames()); - } - - protected void setMappingAnnotation(String primaryAnnotationName, Iterable supportingAnnotationNames) { - this.getJavaResourceAttribute().setPrimaryAnnotation(primaryAnnotationName, supportingAnnotationNames); - } - - protected JaxbAttributeMapping buildMapping(JavaAttributeMappingDefinition definition) { - return (definition == null) ? this.buildNullMapping() : this.buildMapping_(definition); - } - - protected JaxbAttributeMapping buildNullMapping() { - return this.getFactory().buildJavaNullAttributeMapping(this); - } - - /** - * pre-condition: definition is not null - *

- * If we are converting a default mapping to its specified - * manifestation, we just keep the same mapping and create its annotation. - * We do not do the same thing when converting a specified - * mapping to its default manifestation. We rebuild the - * entire mapping, simplifying the clearing of all its state. We do this - * because we allow clients to modify a default mapping (or any of - * its components) directly, - * modifying its state and triggering a conversion to a specified - * mapping. The only way to convert a specified mapping to a - * default mapping is by {@link #setMappingKey(String) setting the - * mapping key} to null. - */ - protected JaxbAttributeMapping buildMapping_(JavaAttributeMappingDefinition definition) { - // 'mapping' is null during construction - if ((this.mapping != null) && this.mapping.isDefault() && Tools.valuesAreEqual(this.mapping.getKey(), definition.getKey())) { - this.mapping.updateDefault(); // since nothing here changes, we need to update the mapping's flag - return this.mapping; - } - return definition.buildMapping(this, this.getFactory()); - } - - /** - * We only look for a specified mapping here. - * We look for a default mapping during update. - */ - protected JaxbAttributeMapping buildMapping() { - return this.buildMapping(this.getSpecifiedMappingDefinition()); - } - - /** - * Look for a specified mapping and sync our mapping. - */ - protected void syncMapping() { - JavaAttributeMappingDefinition definition = this.getSpecifiedMappingDefinition(); - if (definition == null) { - if (this.mapping.isDefault()) { - // null/default => null/default - this.mapping.synchronizeWithResourceModel(); - } else { - // specified => null/default - definition = this.getDefaultMappingDefinition(); - this.setMapping(this.buildMapping(definition)); - } - } else { - if (this.mapping.isDefault()) { - // null/default => specified - this.setMapping(this.buildMapping(definition)); - } else { - // specified => specified - if (this.valuesAreEqual(definition.getKey(), this.mapping.getKey())) { - this.mapping.synchronizeWithResourceModel(); - } else { - this.setMapping(this.buildMapping(definition)); - } - } - } - } - - /** - * Return the "specified" mapping definition for the specified key. - */ - protected JavaAttributeMappingDefinition getSpecifiedMappingDefinition(String key) { - if (key == null) { - return null; - } - for (JavaAttributeMappingDefinition definition : this.getSpecifiedMappingDefinitions()) { - if (Tools.valuesAreEqual(definition.getKey(), key)) { - return definition; - } - } - throw new IllegalArgumentException("invalid mapping key: " + key); //$NON-NLS-1$ - } - - /** - * Return the mapping definition for the mapping currently specified in the - * source code. - */ - protected JavaAttributeMappingDefinition getSpecifiedMappingDefinition() { - for (JavaAttributeMappingDefinition definition : this.getSpecifiedMappingDefinitions()) { - if (definition.isSpecified(this)) { - return definition; - } - } - return null; - } - - protected Iterable getSpecifiedMappingDefinitions() { - return this.getPlatform().getSpecifiedJavaAttributeMappingDefinitions(); - } - - - // ********** default mapping ********** - - public String getDefaultMappingKey() { - return this.defaultMappingKey; - } - - protected void setDefaultMappingKey(String mappingKey) { - String old = this.defaultMappingKey; - this.defaultMappingKey = mappingKey; - this.firePropertyChanged(DEFAULT_MAPPING_KEY_PROPERTY, old, mappingKey); - } - - /** - * If a mapping annotation is specified, we would have already set a - * specified mapping in {@link #syncMapping()}. We need only check - * for changes to the default mapping. - */ - protected void updateMapping() { - JavaAttributeMappingDefinition definition = this.getDefaultMappingDefinition(); - String newDefaultKey = (definition == null) ? null : definition.getKey(); - if (this.mapping.isDefault() && Tools.valuesAreDifferent(this.mapping.getKey(), newDefaultKey)) { - this.setMapping(this.buildMapping(definition)); // the default mapping has changed - } else { - this.mapping.update(); - } - this.setDefaultMappingKey(newDefaultKey); - } - - protected JavaAttributeMappingDefinition getDefaultMappingDefinition() { - for (DefaultJavaAttributeMappingDefinition definition : this.getDefaultMappingDefinitions()) { - if (definition.isDefault(this)) { - return definition; - } - } - return null; - } - - protected Iterable getDefaultMappingDefinitions() { - return this.getPlatform().getDefaultJavaAttributeMappingDefinitions(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getName()); - } - - // **************** content assist **************************************** - - @Override - public Iterable getJavaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterable result = super.getJavaCompletionProposals(pos, filter, astRoot); - if (! CollectionTools.isEmpty(result)) { - return result; - } - - result = this.mapping.getJavaCompletionProposals(pos, filter, astRoot); - if (! CollectionTools.isEmpty(result)) { - return result; - } - - return EmptyIterable.instance(); - } - - - // **************** validation ******************************************** - - @Override - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getJavaResourceAttribute().getTextRange(astRoot); - } - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.getMapping().validate(messages, reporter, astRoot); - } - - - //**************** static methods ***************** - - protected static String getJavaResourceAttributeType(JavaResourceAttribute attribute) { - if (attribute.typeIsSubTypeOf(COLLECTION_CLASS_NAME)) { - if (attribute.getTypeTypeArgumentNamesSize() == 1) { - return attribute.getTypeTypeArgumentName(0); - } - return null; - } - return attribute.getTypeName(); - } - - private static final String COLLECTION_CLASS_NAME = Collection.class.getName(); - - protected static boolean typeIsArray(JavaResourceAttribute attribute) { - return attribute.typeIsArray(); - } - - protected static boolean typeIsSubTypeOf(JavaResourceAttribute attribute, String typeName) { - return attribute.typeIsSubTypeOf(typeName); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentClass.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentClass.java deleted file mode 100644 index 7504423b6f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentClass.java +++ /dev/null @@ -1,965 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import java.lang.reflect.Modifier; -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ChainIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.jaxb.core.MappingKeys; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentField; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentProperty; -import org.eclipse.jpt.jaxb.core.context.XmlAccessOrder; -import org.eclipse.jpt.jaxb.core.context.XmlAccessType; -import org.eclipse.jpt.jaxb.core.context.XmlAdaptable; -import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter; -import org.eclipse.jpt.jaxb.core.internal.validation.DefaultValidationMessages; -import org.eclipse.jpt.jaxb.core.internal.validation.JaxbValidationMessages; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaPersistentClass - extends AbstractJavaPersistentType - implements JaxbPersistentClass { - - protected JaxbPersistentClass superPersistentClass; - - protected XmlAccessType defaultAccessType; - protected XmlAccessType specifiedAccessType; - - protected XmlAccessOrder defaultAccessOrder; - protected XmlAccessOrder specifiedAccessOrder; - - protected final Vector attributes = new Vector(); - - protected final XmlAdaptable xmlAdaptable; - - public GenericJavaPersistentClass(JaxbContextRoot parent, JavaResourceType resourceType) { - super(parent, resourceType); - this.superPersistentClass = this.buildSuperPersistentClass(); - this.specifiedAccessType = this.getResourceAccessType(); - this.specifiedAccessOrder = this.getResourceAccessOrder(); - this.defaultAccessType = this.buildDefaultAccessType(); - this.defaultAccessOrder = this.buildDefaultAccessOrder(); - this.xmlAdaptable = this.buildXmlAdaptable(); - this.initializeAttributes(); - } - - @Override - public JavaResourceType getJavaResourceType() { - return (JavaResourceType) super.getJavaResourceType(); - } - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedAccessType_(this.getResourceAccessType()); - this.setSpecifiedAccessOrder_(this.getResourceAccessOrder()); - this.xmlAdaptable.synchronizeWithResourceModel(); - this.syncAttributes(); - } - - @Override - public void update() { - this.setSuperPersistentClass(this.buildSuperPersistentClass()); - this.setDefaultAccessType(this.buildDefaultAccessType()); - this.setDefaultAccessOrder(this.buildDefaultAccessOrder()); - this.xmlAdaptable.update(); - this.updateAttributes(); - } - - - // ********** JaxbType impl ********** - - public Kind getKind() { - return Kind.PERSISTENT_CLASS; - } - - - // ********** super persistent class ********** - - public JaxbPersistentClass getSuperPersistentClass() { - return this.superPersistentClass; - } - - protected void setSuperPersistentClass(JaxbPersistentClass superPersistentClass) { - JaxbPersistentClass old = this.superPersistentClass; - this.superPersistentClass = superPersistentClass; - this.firePropertyChanged(SUPER_PERSISTENT_CLASS_PROPERTY, old, superPersistentClass); - } - - protected JaxbPersistentClass buildSuperPersistentClass() { - HashSet visited = new HashSet(); - visited.add(this.getJavaResourceType()); - JaxbPersistentClass spc = this.getSuperPersistentClass(this.getJavaResourceType().getSuperclassQualifiedName(), visited); - if (spc == null) { - return null; - } - if (CollectionTools.contains(spc.getInheritanceHierarchy(), this)) { - return null; // short-circuit in this case, we have circular inheritance - } - return spc; - } - - /** - * The JPA spec allows non-persistent types in a persistent type's - * inheritance hierarchy. We check for a persistent type with the - * specified name in the persistence unit. If it is not found we use - * resource persistent type and look for *its* super type. - * - * The 'visited' collection is used to detect a cycle in the *resource* type - * inheritance hierarchy and prevent the resulting stack overflow. - * Any cycles in the *context* type inheritance hierarchy are handled in - * #buildSuperPersistentType(). - */ - protected JaxbPersistentClass getSuperPersistentClass(String typeName, Collection visited) { - if (typeName == null) { - return null; - } - JavaResourceType resourceType = this.getJaxbProject().getJavaResourceType(typeName); - if ((resourceType == null) || visited.contains(resourceType)) { - return null; - } - visited.add(resourceType); - JaxbPersistentClass spc = this.getPersistentClass(typeName); - return (spc != null && resourceType.isMapped()) ? spc : this.getSuperPersistentClass(resourceType.getSuperclassQualifiedName(), visited); // recurse - } - - protected JaxbPersistentClass getPersistentClass(String fullyQualifiedTypeName) { - return this.getParent().getPersistentClass(fullyQualifiedTypeName); - } - - // ********** inheritance ********** - - public Iterable getInheritanceHierarchy() { - return this.getInheritanceHierarchyOf(this); - } - - public Iterable getAncestors() { - return this.getInheritanceHierarchyOf(this.superPersistentClass); - } - - protected Iterable getInheritanceHierarchyOf(JaxbPersistentClass start) { - // using a chain iterator to traverse up the inheritance tree - return new ChainIterable(start) { - @Override - protected JaxbPersistentClass nextLink(JaxbPersistentClass persistentType) { - return persistentType.getSuperPersistentClass(); - } - }; - } - - // ********** access type ********** - - public XmlAccessType getAccessType() { - return (this.specifiedAccessType != null) ? this.specifiedAccessType : this.defaultAccessType; - } - - public XmlAccessType getSpecifiedAccessType() { - return this.specifiedAccessType; - } - - public void setSpecifiedAccessType(XmlAccessType access) { - this.getAccessorTypeAnnotation().setValue(XmlAccessType.toJavaResourceModel(access)); - this.setSpecifiedAccessType_(access); - } - - protected void setSpecifiedAccessType_(XmlAccessType access) { - XmlAccessType old = this.specifiedAccessType; - this.specifiedAccessType = access; - this.firePropertyChanged(SPECIFIED_ACCESS_TYPE_PROPERTY, old, access); - } - - public XmlAccessType getDefaultAccessType() { - return this.defaultAccessType; - } - - protected void setDefaultAccessType(XmlAccessType access) { - XmlAccessType old = this.defaultAccessType; - this.defaultAccessType = access; - this.firePropertyChanged(DEFAULT_ACCESS_TYPE_PROPERTY, old, access); - } - - protected XmlAccessType getResourceAccessType() { - return XmlAccessType.fromJavaResourceModel(this.getAccessorTypeAnnotation().getValue()); - } - - protected XmlAccessorTypeAnnotation getAccessorTypeAnnotation() { - return (XmlAccessorTypeAnnotation) getJavaResourceType().getNonNullAnnotation(XmlAccessorTypeAnnotation.ANNOTATION_NAME); - } - - /** - * If there is a @XmlAccessorType on a class, then it is used. - * Otherwise, if a @XmlAccessorType exists on one of its super classes, then it is inherited. - * Otherwise, the @XmlAccessorType on a package is inherited. - */ - protected XmlAccessType buildDefaultAccessType() { - XmlAccessType superAccessType = this.getSuperPersistentClassAccessType(); - if (superAccessType != null) { - return superAccessType; - } - XmlAccessType packageAccessType = getPackageAccessType(); - if (packageAccessType != null) { - return packageAccessType; - } - return XmlAccessType.PUBLIC_MEMBER; - } - - protected XmlAccessType getSuperPersistentClassAccessType() { - JaxbPersistentClass superPersistentClass = this.getSuperPersistentClass(); - return superPersistentClass == null ? null : superPersistentClass.getSpecifiedAccessType(); - } - - protected XmlAccessType getPackageAccessType() { - JaxbPackageInfo packageInfo = this.getPackageInfo(); - return packageInfo == null ? null : packageInfo.getAccessType(); - } - - - // ********** access order ********** - - public XmlAccessOrder getAccessOrder() { - return (this.specifiedAccessOrder != null) ? this.specifiedAccessOrder : this.defaultAccessOrder; - } - - public XmlAccessOrder getSpecifiedAccessOrder() { - return this.specifiedAccessOrder; - } - - public void setSpecifiedAccessOrder(XmlAccessOrder accessOrder) { - this.getAccessorOrderAnnotation().setValue(XmlAccessOrder.toJavaResourceModel(accessOrder)); - this.setSpecifiedAccessOrder_(accessOrder); - } - - protected void setSpecifiedAccessOrder_(XmlAccessOrder accessOrder) { - XmlAccessOrder old = this.specifiedAccessOrder; - this.specifiedAccessOrder = accessOrder; - this.firePropertyChanged(SPECIFIED_ACCESS_ORDER_PROPERTY, old, accessOrder); - } - - public XmlAccessOrder getDefaultAccessOrder() { - return this.defaultAccessOrder; - } - - protected void setDefaultAccessOrder(XmlAccessOrder accessOrder) { - XmlAccessOrder old = this.defaultAccessOrder; - this.defaultAccessOrder = accessOrder; - this.firePropertyChanged(DEFAULT_ACCESS_ORDER_PROPERTY, old, accessOrder); - } - - protected XmlAccessOrder getResourceAccessOrder() { - return XmlAccessOrder.fromJavaResourceModel(this.getAccessorOrderAnnotation().getValue()); - } - - protected XmlAccessorOrderAnnotation getAccessorOrderAnnotation() { - return (XmlAccessorOrderAnnotation) getJavaResourceType().getNonNullAnnotation(XmlAccessorOrderAnnotation.ANNOTATION_NAME); - } - - /** - * If there is a @XmlAccessorOrder on a class, then it is used. - * Otherwise, if a @XmlAccessorOrder exists on one of its super classes, then it is inherited (by the virtue of Inherited) - * Otherwise, the @XmlAccessorOrder on the package of the class is used, if it's there. - * Otherwise XmlAccessOrder.UNDEFINED. - */ - protected XmlAccessOrder buildDefaultAccessOrder() { - XmlAccessOrder superAccessOrder = this.getSuperPersistentClassAccessOrder(); - if (superAccessOrder != null) { - return superAccessOrder; - } - XmlAccessOrder packageAccessOrder = getPackageAccessOrder(); - if (packageAccessOrder != null) { - return packageAccessOrder; - } - return XmlAccessOrder.UNDEFINED; - } - - protected XmlAccessOrder getSuperPersistentClassAccessOrder() { - JaxbPersistentClass superPersistentClass = this.getSuperPersistentClass(); - return superPersistentClass == null ? null : superPersistentClass.getSpecifiedAccessOrder(); - } - - protected XmlAccessOrder getPackageAccessOrder() { - JaxbPackageInfo packageInfo = this.getPackageInfo(); - return packageInfo == null ? null : packageInfo.getAccessOrder(); - } - - - // ********** attributes ********** - - public Iterable getAttributes() { - return new LiveCloneIterable(this.attributes); - } - - public int getAttributesSize() { - return this.attributes.size(); - } - - protected void addAttribute(JaxbPersistentAttribute attribute) { - addItemToCollection(attribute, this.attributes, ATTRIBUTES_COLLECTION); - } - - protected void removeAttribute(JaxbPersistentAttribute attribute) { - removeItemFromCollection(attribute, this.attributes, ATTRIBUTES_COLLECTION); - } - - protected JaxbPersistentField buildField(JavaResourceField resourceField) { - return getFactory().buildJavaPersistentField(this, resourceField); - } - - protected JaxbPersistentProperty buildProperty(JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) { - return getFactory().buildJavaPersistentProperty(this, resourceGetter, resourceSetter); - } - - protected void initializeAttributes() { - if (getAccessType() == XmlAccessType.PUBLIC_MEMBER) { - this.initializePublicMemberAccessAttributes(); - } - else if (getAccessType() == XmlAccessType.FIELD) { - this.intializeFieldAccessAttributes(); - } - else if (getAccessType() == XmlAccessType.PROPERTY) { - this.intializePropertyAccessAttributes(); - } - else if (getAccessType() == XmlAccessType.NONE) { - this.intializeNoneAccessAttributes(); - } - } - - /** - * Initialize the attributes for XmlAccessType.PUBLIC_MEMBER - * 1. all public, non-static, non-transient fields (transient modifier, @XmlTransient is brought to the context model) - * 2. all annotated fields that aren't public - * 3. all public getter/setter javabeans pairs - * 4. all annotated methods (some will have a matching getter/setter, some will be standalone) - */ - private void initializePublicMemberAccessAttributes() { - this.initializeFieldAttributes(this.buildPublicMemberAccessTypeResourceFieldsFilter()); - Collection resourceMethods = CollectionTools.collection(this.getResourceMethods()); - //iterate through all persistable resource method getters - for (JavaResourceMethod getterMethod : this.getResourceMethods(this.buildPersistablePropertyGetterMethodsFilter())) { - JavaResourceMethod setterMethod = getValidSiblingSetMethod(getterMethod, resourceMethods); - if (methodsArePersistablePublicMemberAccess(getterMethod, setterMethod)) { - this.attributes.add(this.buildProperty(getterMethod, setterMethod)); - } - resourceMethods.remove(getterMethod); - resourceMethods.remove(setterMethod); - } - this.initializeRemainingResourceMethodAttributes(resourceMethods); - } - - /** - * Initialize the attributes for XmlAccessType.FIELD - * 1. all non-transient fields - * 2. all annotated methods getters/setters - */ - private void intializeFieldAccessAttributes() { - this.initializeFieldAttributes(this.buildNonTransientNonStaticResourceFieldsFilter()); - this.initializeAnnotatedPropertyAttributes(); - } - - /** - * Initialize the attributes for XmlAccessType.PROPERTY - * 1. all getter/setter javabeans pairs - * 2. all annotated fields - * 3. all annotated methods getters/setters that don't have a matching pair - */ - private void intializePropertyAccessAttributes() { - this.initializeFieldAttributes(this.buildAnnotatedResourceFieldsFilter()); - - Collection resourceMethods = CollectionTools.collection(this.getResourceMethods()); - //iterate through all resource methods searching for persistable getters - for (JavaResourceMethod getterMethod : this.getResourceMethods(this.buildPersistablePropertyGetterMethodsFilter())) { - JavaResourceMethod setterMethod = getValidSiblingSetMethod(getterMethod, resourceMethods); - if (methodsArePersistableProperties(getterMethod, setterMethod)) { - this.attributes.add(this.buildProperty(getterMethod, setterMethod)); - } - resourceMethods.remove(getterMethod); - resourceMethods.remove(setterMethod); - } - this.initializeRemainingResourceMethodAttributes(resourceMethods); - } - - /** - * Initialize the attributes for XmlAccessType.NONE - * 1. all annotated fields - * 2. all annotated methods getters/setters (some will have a matching getter/setter, some will be standalone) - */ - private void intializeNoneAccessAttributes() { - this.initializeFieldAttributes(this.buildAnnotatedResourceFieldsFilter()); - this.initializeAnnotatedPropertyAttributes(); - } - - private void initializeFieldAttributes(Filter filter) { - for (JavaResourceField resourceField : this.getResourceFields(filter)) { - this.attributes.add(this.buildField(resourceField)); - } - } - - private void initializeRemainingResourceMethodAttributes(Collection resourceMethods) { - //iterate through remaining resource methods and search for those that are annotated. - //all getter methods will already be used. - for (JavaResourceMethod resourceMethod : resourceMethods) { - if (resourceMethod.isAnnotated()) { - //annotated setter(or other random method) with no corresponding getter, bring into context model for validation purposes - this.attributes.add(this.buildProperty(null, resourceMethod)); - } - } - } - - private static boolean methodsArePersistableProperties(JavaResourceMethod getterMethod, JavaResourceMethod setterMethod) { - if (setterMethod != null) { - return true; - } - //Lists do not have to have a corresponding setter method - else if (getterMethod.getTypeName().equals("java.util.List")) { //$NON-NLS-1$ - return true; - } - else if (getterMethod.isAnnotated()) { - //annotated getter with no corresponding setter, bring into context model for validation purposes - return true; - } - return false; - } - - private static boolean methodsArePersistablePublicMemberAccess(JavaResourceMethod getterMethod, JavaResourceMethod setterMethod) { - if (getterMethod.isPublic()) { - if (setterMethod != null) { - if (setterMethod.isPublic()) { - return true; - } - } - //Lists do not have to have a corresponding setter method - else if (getterMethod.getTypeName().equals("java.util.List")) { //$NON-NLS-1$ - return true; - } - else if (getterMethod.isAnnotated()) { - //annotated getter with no corresponding setter, bring into context model for validation purposes - return true; - } - } - else if (getterMethod.isAnnotated() || (setterMethod != null && setterMethod.isAnnotated())) { - return true; - } - return false; - } - - private void initializeAnnotatedPropertyAttributes() { - Collection resourceMethods = CollectionTools.collection(this.getResourceMethods()); - //iterate through all resource methods searching for persistable getters - for (JavaResourceMethod getterMethod : this.getResourceMethods(buildPersistablePropertyGetterMethodsFilter())) { - JavaResourceMethod setterMethod = getValidSiblingSetMethod(getterMethod, resourceMethods); - if (getterMethod.isAnnotated() || (setterMethod != null && setterMethod.isAnnotated())) { - this.attributes.add(this.buildProperty(getterMethod, setterMethod)); - } - resourceMethods.remove(getterMethod); - resourceMethods.remove(setterMethod); - } - this.initializeRemainingResourceMethodAttributes(resourceMethods); - } - - protected Iterable getResourceFields() { - return getJavaResourceType().getFields(); - } - - protected Iterable getResourceMethods() { - return getJavaResourceType().getMethods(); - } - - protected Iterable getResourceFields(Filter filter) { - return new FilteringIterable(getResourceFields(), filter); - } - - protected Iterable getResourceMethods(Filter filter) { - return new FilteringIterable(getResourceMethods(), filter); - } - - protected Filter buildNonTransientNonStaticResourceFieldsFilter() { - return new Filter() { - public boolean accept(JavaResourceField resourceField) { - return memberIsNonTransientNonStatic(resourceField) || resourceField.isAnnotated(); - } - }; - } - - protected Filter buildPublicMemberAccessTypeResourceFieldsFilter() { - return new Filter() { - public boolean accept(JavaResourceField resourceField) { - return memberIsPublicNonTransientNonStatic(resourceField) || resourceField.isAnnotated(); - } - }; - } - - protected Filter buildPersistablePropertyGetterMethodsFilter() { - return new Filter() { - public boolean accept(JavaResourceMethod resourceMethod) { - return methodIsPersistablePropertyGetter(resourceMethod, getResourceMethods()); - } - }; - } - - protected static boolean memberIsPublicNonTransientNonStatic(JavaResourceMember resourceMember) { - return resourceMember.isPublic() && memberIsNonTransientNonStatic(resourceMember); - } - - protected static boolean memberIsNonTransientNonStatic(JavaResourceMember resourceMember) { - return !resourceMember.isTransient() && !resourceMember.isStatic(); - } - - protected Filter buildAnnotatedResourceFieldsFilter() { - return new Filter() { - public boolean accept(JavaResourceField resourceField) { - return resourceField.isAnnotated(); - } - }; - } - - protected void syncAttributes() { - if (getAccessType() == XmlAccessType.PUBLIC_MEMBER) { - this.syncPublicMemberAccessAttributes(); - } - else if (getAccessType() == XmlAccessType.FIELD) { - this.syncFieldAccessAttributes(); - } - else if (getAccessType() == XmlAccessType.PROPERTY) { - this.syncPropertyAccessAttributes(); - } - else if (getAccessType() == XmlAccessType.NONE) { - this.syncNoneAccessAttributes(); - } - } - - /** - * Sync the attributes for XmlAccessType.PUBLIC_MEMBER - * 1. all public, non-static, non-transient fields (transient modifier, @XmlTransient is brought to the context model) - * 2. all annotated fields that aren't public - * 3. all public getter/setter javabeans pairs - * 4. all annotated methods (some will have a matching getter/setter, some will be standalone) - */ - private void syncPublicMemberAccessAttributes() { - HashSet contextAttributes = CollectionTools.set(this.getAttributes()); - - this.syncFieldAttributes(contextAttributes, this.buildPublicMemberAccessTypeResourceFieldsFilter()); - - Collection resourceMethods = CollectionTools.collection(this.getResourceMethods()); - //iterate through all persistable resource method getters - for (JavaResourceMethod getterMethod : this.getResourceMethods(this.buildPersistablePropertyGetterMethodsFilter())) { - JavaResourceMethod setterMethod = getValidSiblingSetMethod(getterMethod, resourceMethods); - if (methodsArePersistablePublicMemberAccess(getterMethod, setterMethod)) { - boolean match = false; - for (Iterator stream = contextAttributes.iterator(); stream.hasNext();) { - JaxbPersistentAttribute contextAttribute = stream.next(); - if (contextAttribute.isFor(getterMethod, setterMethod)) { - match = true; - contextAttribute.synchronizeWithResourceModel(); - stream.remove(); - break; - } - } - if (!match) { - this.addAttribute(this.buildProperty(getterMethod, setterMethod)); - } - resourceMethods.remove(getterMethod); - resourceMethods.remove(setterMethod); - } - } - this.syncRemainingResourceMethods(contextAttributes, resourceMethods); - } - - /** - * Initialize the attributes for XmlAccessType.FIELD - * 1. all non-transient fields - * 2. all annotated methods getters/setters - */ - private void syncFieldAccessAttributes() { - HashSet contextAttributes = CollectionTools.set(this.getAttributes()); - - this.syncFieldAttributes(contextAttributes, this.buildNonTransientNonStaticResourceFieldsFilter()); - this.syncAnnotatedPropertyAttributes(contextAttributes); - } - - /** - * Initialize the attributes for XmlAccessType.PROPERTY - * 1. all getter/setter javabeans pairs - * 2. all annotated fields - * 3. all annotated methods getters/setters that don't have a matching pair - */ - private void syncPropertyAccessAttributes() { - HashSet contextAttributes = CollectionTools.set(this.getAttributes()); - - this.syncFieldAttributes(contextAttributes, this.buildAnnotatedResourceFieldsFilter()); - - Collection resourceMethods = CollectionTools.collection(this.getResourceMethods()); - //iterate through all resource methods searching for persistable getters - for (JavaResourceMethod getterMethod : this.getResourceMethods(this.buildPersistablePropertyGetterMethodsFilter())) { - JavaResourceMethod setterMethod = getValidSiblingSetMethod(getterMethod, resourceMethods); - if (methodsArePersistableProperties(getterMethod, setterMethod)) { - boolean match = false; - for (Iterator stream = contextAttributes.iterator(); stream.hasNext();) { - JaxbPersistentAttribute contextAttribute = stream.next(); - if (contextAttribute.isFor(getterMethod, setterMethod)) { - match = true; - contextAttribute.synchronizeWithResourceModel(); - stream.remove(); - break; - } - } - if (!match) { - this.addAttribute(this.buildProperty(getterMethod, setterMethod)); - } - } - resourceMethods.remove(getterMethod); - resourceMethods.remove(setterMethod); - } - this.syncRemainingResourceMethods(contextAttributes, resourceMethods); - } - - /** - * Initialize the attributes for XmlAccessType.NONE - * 1. all annotated fields - * 2. all annotated methods getters/setters (some will have a matching getter/setter, some will be standalone) - */ - private void syncNoneAccessAttributes() { - HashSet contextAttributes = CollectionTools.set(this.getAttributes()); - - this.syncFieldAttributes(contextAttributes, this.buildAnnotatedResourceFieldsFilter()); - this.syncAnnotatedPropertyAttributes(contextAttributes); - } - - private void syncAnnotatedPropertyAttributes(HashSet contextAttributes) { - Collection resourceMethods = CollectionTools.collection(this.getResourceMethods()); - //iterate through all resource methods searching for persistable getters - for (JavaResourceMethod getterMethod : this.getResourceMethods(buildPersistablePropertyGetterMethodsFilter())) { - JavaResourceMethod setterMethod = getValidSiblingSetMethod(getterMethod, resourceMethods); - if (getterMethod.isAnnotated() || (setterMethod != null && setterMethod.isAnnotated())) { - boolean match = false; - for (Iterator stream = contextAttributes.iterator(); stream.hasNext();) { - JaxbPersistentAttribute contextAttribute = stream.next(); - if (contextAttribute.isFor(getterMethod, setterMethod)) { - match = true; - contextAttribute.synchronizeWithResourceModel(); - stream.remove(); - break; - } - } - if (!match) { - this.addAttribute(this.buildProperty(getterMethod, setterMethod)); - } - } - resourceMethods.remove(getterMethod); - resourceMethods.remove(setterMethod); - } - this.syncRemainingResourceMethods(contextAttributes, resourceMethods); - } - - private void syncFieldAttributes(HashSet contextAttributes, Filter filter) { - for (JavaResourceField resourceField : this.getResourceFields(filter)) { - boolean match = false; - for (Iterator stream = contextAttributes.iterator(); stream.hasNext(); ) { - JaxbPersistentAttribute contextAttribute = stream.next(); - if (contextAttribute.isFor(resourceField)) { - match = true; - contextAttribute.synchronizeWithResourceModel(); - stream.remove(); - break; - } - } - if (!match) { - // added elements are sync'ed during construction or will be - // updated during the next "update" (which is triggered by - // their addition to the model) - this.addAttribute(this.buildField(resourceField)); - } - } - } - - private void syncRemainingResourceMethods(HashSet contextAttributes, Collection resourceMethods) { - //iterate through remaining resource methods and search for those that are annotated. - //all getter methods will already be used. - for (JavaResourceMethod resourceMethod : resourceMethods) { - if (resourceMethod.isAnnotated()) { - boolean match = false; - //annotated setter(or other random method) with no corresponding getter, bring into context model for validation purposes - for (Iterator stream = contextAttributes.iterator(); stream.hasNext();) { - JaxbPersistentAttribute contextAttribute = stream.next(); - if (contextAttribute.isFor(null, resourceMethod)) { - match = true; - contextAttribute.synchronizeWithResourceModel(); - stream.remove(); - break; - } - } - if (!match) { - this.addAttribute(this.buildProperty(null, resourceMethod)); - } - } - } - - // remove any leftover context attributes - for (JaxbPersistentAttribute contextAttribute : contextAttributes) { - this.removeAttribute(contextAttribute); - } - } - - protected void updateAttributes() { - this.updateNodes(this.attributes); - } - - /** - * Return whether the specified method is a "getter" method that - * represents a property that may be "persisted". - */ - protected static boolean methodIsPersistablePropertyGetter(JavaResourceMethod resourceMethod, Iterable allMethods) { - if (methodHasInvalidModifiers(resourceMethod)) { - return false; - } - if (resourceMethod.isConstructor()) { - return false; - } - - String returnTypeName = resourceMethod.getTypeName(); - if (returnTypeName == null) { - return false; // DOM method bindings can have a null name - } - if (returnTypeName.equals("void")) { //$NON-NLS-1$ - return false; - } - if (methodHasParameters(resourceMethod)) { - return false; - } - - boolean booleanGetter = methodIsBooleanGetter(resourceMethod); - - // if the type has both methods: - // boolean isProperty() - // boolean getProperty() - // then #isProperty() takes precedence and we ignore #getProperty(); - // but only having #getProperty() is OK too - // (see the JavaBeans spec 1.01) - if (booleanGetter && methodHasValidSiblingIsMethod(resourceMethod, allMethods)) { - return false; // since the type also defines #isProperty(), ignore #getProperty() - } - return true; - } - - private static boolean methodIsBooleanGetter(JavaResourceMethod resourceMethod) { - String returnTypeName = resourceMethod.getTypeName(); - String name = resourceMethod.getMethodName(); - boolean booleanGetter = false; - if (name.startsWith("is")) { //$NON-NLS-1$ - if (returnTypeName.equals("boolean")) { //$NON-NLS-1$ - } else { - return false; - } - } else if (name.startsWith("get")) { //$NON-NLS-1$ - if (returnTypeName.equals("boolean")) { //$NON-NLS-1$ - booleanGetter = true; - } - } else { - return false; - } - return booleanGetter; - } - - /** - * Return whether the method's modifiers prevent it - * from being a getter or setter for a "persistent" property. - */ - private static boolean methodHasInvalidModifiers(JavaResourceMethod resourceMethod) { - int modifiers = resourceMethod.getModifiers(); - if (Modifier.isStatic(modifiers)) { - return true; - } - return false; - } - - private static boolean methodHasParameters(JavaResourceMethod resourceMethod) { - return resourceMethod.getParametersSize() != 0; - } - - /** - * Return whether the method has a sibling "is" method for the specified - * property and that method is valid for a "persistable" property. - * Pre-condition: the method is a "boolean getter" (e.g. 'public boolean getProperty()'); - * this prevents us from returning true when the method itself is an - * "is" method. - */ - private static boolean methodHasValidSiblingIsMethod(JavaResourceMethod getMethod, Iterable resourceMethods) { - String capitalizedAttributeName = StringTools.capitalize(getMethod.getName()); - for (JavaResourceMethod sibling : resourceMethods) { - if ((sibling.getParametersSize() == 0) - && sibling.getMethodName().equals("is" + capitalizedAttributeName)) { //$NON-NLS-1$ - return methodIsValidSibling(sibling, "boolean"); //$NON-NLS-1$ - } - } - return false; - } - - /** - * Return whether the method has a sibling "set" method - * and that method is valid for a "persistable" property. - */ - private static JavaResourceMethod getValidSiblingSetMethod(JavaResourceMethod getMethod, Collection resourceMethods) { - String capitalizedAttributeName = StringTools.capitalize(getMethod.getName()); - String parameterTypeErasureName = getMethod.getTypeName(); - for (JavaResourceMethod sibling : resourceMethods) { - ListIterable siblingParmTypeNames = sibling.getParameterTypeNames(); - if ((sibling.getParametersSize() == 1) - && sibling.getMethodName().equals("set" + capitalizedAttributeName) //$NON-NLS-1$ - && siblingParmTypeNames.iterator().next().equals(parameterTypeErasureName)) { - return methodIsValidSibling(sibling, "void") ? sibling : null; //$NON-NLS-1$ - } - } - return null; - } - - /** - * Return whether the specified method is a valid sibling with the - * specified return type. - */ - private static boolean methodIsValidSibling(JavaResourceMethod resourceMethod, String returnTypeName) { - if (resourceMethod == null) { - return false; - } - if (methodHasInvalidModifiers(resourceMethod)) { - return false; - } - if (resourceMethod.isConstructor()) { - return false; - } - String rtName = resourceMethod.getTypeName(); - if (rtName == null) { - return false; // DOM method bindings can have a null name - } - return rtName.equals(returnTypeName); - } - - - //****************** XmlJavaTypeAdapter ********************* - - public XmlAdaptable buildXmlAdaptable() { - return new GenericJavaXmlAdaptable(this, new XmlAdaptable.Owner() { - public JavaResourceAnnotatedElement getResource() { - return getJavaResourceType(); - } - public XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation adapterAnnotation) { - return GenericJavaPersistentClass.this.buildXmlJavaTypeAdapter(adapterAnnotation); - } - public void fireXmlAdapterChanged(XmlJavaTypeAdapter oldAdapter, XmlJavaTypeAdapter newAdapter) { - GenericJavaPersistentClass.this.firePropertyChanged(XML_JAVA_TYPE_ADAPTER_PROPERTY, oldAdapter, newAdapter); - } - }); - } - - public XmlJavaTypeAdapter getXmlJavaTypeAdapter() { - return this.xmlAdaptable.getXmlJavaTypeAdapter(); - } - - public XmlJavaTypeAdapter addXmlJavaTypeAdapter() { - return this.xmlAdaptable.addXmlJavaTypeAdapter(); - } - - protected XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation) { - return new GenericJavaTypeXmlJavaTypeAdapter(this, xmlJavaTypeAdapterAnnotation); - } - - public void removeXmlJavaTypeAdapter() { - this.xmlAdaptable.removeXmlJavaTypeAdapter(); - } - - // ********** content assist ********** - - @Override - public Iterable getJavaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterable result = super.getJavaCompletionProposals(pos, filter, astRoot); - if (!CollectionTools.isEmpty(result)) { - return result; - } - for (JaxbPersistentAttribute attribute : this.getAttributes()) { - result = attribute.getJavaCompletionProposals(pos, filter, astRoot); - if (!CollectionTools.isEmpty(result)) { - return result; - } - } - return EmptyIterable.instance(); - } - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.xmlAdaptable.validate(messages, reporter, astRoot); - this.validateXmlValueMapping(messages, astRoot); - for (JaxbPersistentAttribute attribute : getAttributes()) { - attribute.validate(messages, reporter, astRoot); - } - } - - protected void validateXmlValueMapping(List messages, CompilationUnit astRoot) { - String xmlValueMapping = null; - for (JaxbPersistentAttribute attribute : getAttributes()) { - if (attribute.getMappingKey() == MappingKeys.XML_VALUE_ATTRIBUTE_MAPPING_KEY) { - if (xmlValueMapping != null) { - messages.add( - DefaultValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JaxbValidationMessages.MULTIPLE_XML_VALUE_MAPPINGS_DEFINED, - new String[] {attribute.getName(), xmlValueMapping}, - attribute.getMapping(), - attribute.getMapping().getValidationTextRange(astRoot))); - } - else { - xmlValueMapping = attribute.getName(); - } - } - } - if (xmlValueMapping != null) { - for (JaxbPersistentAttribute attribute : getAttributes()) { - if (attribute.getName() != xmlValueMapping) { - if (attribute.getMappingKey() != MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY - && attribute.getMappingKey() != MappingKeys.XML_TRANSIENT_ATTRIBUTE_MAPPING_KEY) { - messages.add( - DefaultValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JaxbValidationMessages.XML_VALUE_MAPPING_WITH_NON_XML_ATTRIBUTE_MAPPING_DEFINED, - new String[] {attribute.getName(), xmlValueMapping}, - attribute.getMapping(), - attribute.getMapping().getValidationTextRange(astRoot))); - } - } - } - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentEnum.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentEnum.java deleted file mode 100644 index d43101901b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentEnum.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbEnumConstant; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumAnnotation; - -public class GenericJavaPersistentEnum - extends AbstractJavaPersistentType - implements JaxbPersistentEnum { - - protected String enumType; - - protected final EnumConstantContainer enumConstantContainer; - - public GenericJavaPersistentEnum(JaxbContextRoot parent, JavaResourceEnum resourceEnum) { - super(parent, resourceEnum); - this.enumType = this.getResourceEnumType(); - this.enumConstantContainer = new EnumConstantContainer(); - } - - @Override - public JavaResourceEnum getJavaResourceType() { - return (JavaResourceEnum) super.getJavaResourceType(); - } - - - // ********** JaxbType impl ********** - - public Kind getKind() { - return Kind.PERSISTENT_ENUM; - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setEnumType_(this.getResourceEnumType()); - this.enumConstantContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.enumConstantContainer.update(); - } - - // ********** xml enum annotation ********** - - protected XmlEnumAnnotation getXmlEnumAnnotation() { - return (XmlEnumAnnotation) this.getJavaResourceType().getNonNullAnnotation(XmlEnumAnnotation.ANNOTATION_NAME); - } - - - // ********** JaxbPersistentEnum impl ********** - - // ********** enum type ********** - - public String getEnumType() { - return this.enumType; - } - - public void setEnumType(String enumType) { - this.getXmlEnumAnnotation().setValue(enumType); - this.setEnumType_(enumType); - } - - protected void setEnumType_(String enumType) { - String old = this.enumType; - this.enumType = enumType; - this.firePropertyChanged(ENUM_TYPE_PROPERTY, old, enumType); - } - - protected String getResourceEnumType() { - return this.getXmlEnumAnnotation().getValue(); - } - - public Iterable getEnumConstants() { - return this.enumConstantContainer.getContextElements(); - } - - public int getEnumConstantsSize() { - return this.enumConstantContainer.getContextElementsSize(); - } - - private Iterable getResourceEnumConstants() { - return getJavaResourceType().getEnumConstants(); - } - - private JaxbEnumConstant buildEnumConstant(JavaResourceEnumConstant resourceEnumConstant) { - return getFactory().buildJavaEnumConstant(this, resourceEnumConstant); - } - - /** - * enum constant container adapter - */ - protected class EnumConstantContainer - extends ContextCollectionContainer - { - @Override - protected String getContextElementsPropertyName() { - return ENUM_CONSTANTS_COLLECTION; - } - @Override - protected JaxbEnumConstant buildContextElement(JavaResourceEnumConstant resourceElement) { - return GenericJavaPersistentEnum.this.buildEnumConstant(resourceElement); - } - @Override - protected Iterable getResourceElements() { - return GenericJavaPersistentEnum.this.getResourceEnumConstants(); - } - @Override - protected JavaResourceEnumConstant getResourceElement(JaxbEnumConstant contextElement) { - return contextElement.getResourceEnumConstant(); - } - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentField.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentField.java deleted file mode 100644 index da822fa6cc..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentField.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; - -public class GenericJavaPersistentField - extends GenericJavaPersistentAttribute - implements JaxbPersistentField { - - - protected final JavaResourceField resourceField; - - public GenericJavaPersistentField(JaxbPersistentClass parent, JavaResourceField resourceField) { - super(parent); - this.resourceField = resourceField; - this.initializeMapping(); - } - - public JavaResourceAttribute getJavaResourceAttribute() { - return this.getResourceField(); - } - - public String getJavaResourceAttributeTypeName() { - return getJavaResourceAttributeType(this.getJavaResourceAttribute()); - } - - public boolean isJavaResourceAttributeTypeArray() { - return typeIsArray(this.getJavaResourceAttribute()); - } - - public boolean isJavaResourceAttributeTypeSubTypeOf(String typeName) { - return typeIsSubTypeOf(this.getJavaResourceAttribute(), typeName); - } - - public JavaResourceField getResourceField() { - return this.resourceField; - } - - public boolean isFor(JavaResourceField resourceField) { - return this.resourceField == resourceField; - } - - public boolean isFor(JavaResourceMethod getterMethod, JavaResourceMethod setterMethod) { - return false; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentProperty.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentProperty.java deleted file mode 100644 index 7cf112ff5e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaPersistentProperty.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentProperty; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; - -public class GenericJavaPersistentProperty - extends GenericJavaPersistentAttribute - implements JaxbPersistentProperty { - - - protected final JavaResourceMethod resourceGetter; - - protected final JavaResourceMethod resourceSetter; - - public GenericJavaPersistentProperty(JaxbPersistentClass parent, JavaResourceMethod resourceGetter, JavaResourceMethod resourceSetter) { - super(parent); - this.resourceGetter = resourceGetter; - this.resourceSetter = resourceSetter; - this.initializeMapping(); - } - - public JavaResourceAttribute getJavaResourceAttribute() { - return this.calculateResourceMethodToAnnotate(); - } - - public String getJavaResourceAttributeTypeName() { - JavaResourceAttribute getterMethod = getResourceGetterMethod(); - //it's invalid to have a setter without a getter, so just return null in this case - //rather than attempting to define the type from the setter's parameters - return getterMethod == null ? null : getJavaResourceAttributeType(getterMethod); - } - - public boolean isJavaResourceAttributeTypeArray() { - JavaResourceAttribute getterMethod = getResourceGetterMethod(); - //it's invalid to have a setter without a getter, so just return false in this case - //rather than attempting to use the setter's parameters - return getterMethod == null ? false : typeIsArray(getterMethod); - } - - public boolean isJavaResourceAttributeTypeSubTypeOf(String typeName) { - JavaResourceAttribute getterMethod = getResourceGetterMethod(); - //it's invalid to have a setter without a getter, so just return false in this case - //rather than attempting to use the setter's parameters - return getterMethod == null ? false : typeIsSubTypeOf(getterMethod, typeName); - } - - public JavaResourceMethod getResourceGetterMethod() { - return this.resourceGetter; - } - - public JavaResourceMethod getResourceSetterMethod() { - return this.resourceSetter; - } - - public boolean isFor(JavaResourceField resourceField) { - return false; - } - - public boolean isFor(JavaResourceMethod getterMethod, JavaResourceMethod setterMethod) { - return (this.resourceGetter == getterMethod) && (this.resourceSetter == setterMethod); - } - - //since this is based on a preference as well as annotation location - //we will just calculate it instead of handling it in sync and storing it. - protected JavaResourceMethod calculateResourceMethodToAnnotate() { - if (getterIsAnnotated()) { - if (setterIsAnnotated()) { - //use preference for which one to set the primary annotation on. - return getAnnotateGetterPreference() ? this.resourceGetter : this.resourceSetter; - } - return this.resourceGetter; - } - else if (setterIsAnnotated()) { - return this.resourceSetter; - } - else if (getAnnotateGetterPreference()&& this.resourceGetter != null) { - return this.resourceGetter; - } - return this.resourceSetter; - } - - protected boolean getterIsAnnotated() { - return this.resourceGetter == null ? false : this.resourceGetter.isAnnotated(); - } - - protected boolean setterIsAnnotated() { - return this.resourceSetter == null ? false : this.resourceSetter.isAnnotated(); - } - - //TODO bug 333483 - make this a preference for the user to select whether the getter or setter should be annotated. - protected boolean getAnnotateGetterPreference() { - return true; - } - - //TODO validation - bug 333484 - //if (getterIsAnnotated() && setterIsAnnotated()) error to user -} \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaRegistry.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaRegistry.java deleted file mode 100644 index 8e93bd8d8c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaRegistry.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbElementFactoryMethod; -import org.eclipse.jpt.jaxb.core.context.JaxbRegistry; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementDeclAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRegistryAnnotation; - - -public class GenericJavaRegistry - extends AbstractJavaType - implements JaxbRegistry { - - protected final ElementFactoryMethodContainer elementFactoryMethodContainer; - - private static final String ELEMENT_FACTORY_METHOD_CREATE_PREFIX = "create"; //$NON-NLS-1$ - - public GenericJavaRegistry(JaxbContextRoot parent, JavaResourceType resourceType) { - super(parent, resourceType); - this.elementFactoryMethodContainer = new ElementFactoryMethodContainer(); - } - - @Override - public JavaResourceType getJavaResourceType() { - return (JavaResourceType) super.getJavaResourceType(); - } - - protected XmlRegistryAnnotation getAnnotation() { - return (XmlRegistryAnnotation) getJavaResourceType().getNonNullAnnotation(XmlRegistryAnnotation.ANNOTATION_NAME); - } - - - // ********** JaxbType impl ********** - - public Kind getKind() { - return Kind.REGISTRY; - } - - // ********** synchronize/update ********** - - public void synchronizeWithResourceModel() { - this.elementFactoryMethodContainer.synchronizeWithResourceModel(); - } - - public void update() { - this.elementFactoryMethodContainer.update(); - } - - public Iterable getElementFactoryMethods() { - return this.elementFactoryMethodContainer.getContextElements(); - } - - public int getElementFactoryMethodsSize() { - return this.elementFactoryMethodContainer.getContextElementsSize(); - } - - private JaxbElementFactoryMethod buildElementFactoryMethod(JavaResourceMethod resourceMethod) { - return getFactory().buildJavaElementFactoryMethod(this, resourceMethod); - } - - private Iterable getResourceElementFactoryMethods() { - return new FilteringIterable(getJavaResourceType().getMethods()) { - @Override - protected boolean accept(JavaResourceMethod method) { - return methodIsElementFactoryMethod(method); - } - }; - } - - //For now we will just check that the method has an @XmlElementDecl annotation. - //In the future we could look for methods that are unannotated, but appear - //to be element factory methods : begin with create, return type is JAXB element, - //1 parameter, etc. - protected static boolean methodIsElementFactoryMethod(JavaResourceMethod method) { - return methodHasXmlElementDeclAnnotation(method); - } - - protected static boolean methodHasXmlElementDeclAnnotation(JavaResourceMethod method) { - return method.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME) != null; - } - - protected static boolean methodStartsWithCreate(JavaResourceMethod method) { - return method.getName().startsWith(ELEMENT_FACTORY_METHOD_CREATE_PREFIX); - } - - protected static boolean methodReturnTypeIsJAXBElement(JavaResourceMethod method) { - return method.typeIsSubTypeOf(JAXB_ELEMENT_TYPE_NAME); - } - - protected static final String JAXB_ELEMENT_TYPE_NAME = "javax.xml.bind.JAXBElement"; //$NON-NLS-1$ - - - // **************** validation ******************************************** - - @Override - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = getAnnotation().getTextRange(astRoot); - return (textRange != null) ? textRange : super.getValidationTextRange(astRoot); - } - - - /** - * element factory method container adapter - */ - protected class ElementFactoryMethodContainer - extends ContextCollectionContainer - { - @Override - protected String getContextElementsPropertyName() { - return ELEMENT_FACTORY_METHODS_COLLECTION; - } - @Override - protected JaxbElementFactoryMethod buildContextElement(JavaResourceMethod resourceElement) { - return GenericJavaRegistry.this.buildElementFactoryMethod(resourceElement); - } - @Override - protected Iterable getResourceElements() { - return GenericJavaRegistry.this.getResourceElementFactoryMethods(); - } - @Override - protected JavaResourceMethod getResourceElement(JaxbElementFactoryMethod contextElement) { - return contextElement.getResourceMethod(); - } - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaTypeXmlJavaTypeAdapter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaTypeXmlJavaTypeAdapter.java deleted file mode 100644 index 4932837849..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaTypeXmlJavaTypeAdapter.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; - -public class GenericJavaTypeXmlJavaTypeAdapter - extends AbstractJavaXmlJavaTypeAdapter -{ - - public GenericJavaTypeXmlJavaTypeAdapter(JaxbPersistentClass parent, XmlJavaTypeAdapterAnnotation resource) { - super(parent, resource); - } - - @Override - public JaxbPersistentClass getParent() { - return (JaxbPersistentClass) super.getParent(); - } - - // ********** type ********** - @Override - protected String buildDefaultType() { - return getParent().getJavaResourceType().getQualifiedName(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAdaptable.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAdaptable.java deleted file mode 100644 index 5760366123..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAdaptable.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.JaxbNode; -import org.eclipse.jpt.jaxb.core.context.XmlAdaptable; -import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - - -class GenericJavaXmlAdaptable - extends AbstractJavaContextNode - implements XmlAdaptable { - - protected XmlJavaTypeAdapter xmlJavaTypeAdapter; - - protected XmlAdaptable.Owner owner; - - GenericJavaXmlAdaptable(JaxbNode parent, XmlAdaptable.Owner owner) { - super(parent); - this.owner = owner; - this.initializeXmlJavaTypeAdapter(); - } - - public void synchronizeWithResourceModel() { - this.syncXmlJavaTypeAdapter(); - } - - public void update() { - this.updateXmlJavaTypeAdapter(); - } - - @Override - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.xmlJavaTypeAdapter == null ? this.owner.getResource().getTextRange(astRoot) : this.xmlJavaTypeAdapter.getResourceXmlJavaTypeAdapter().getTextRange(astRoot); - } - - public XmlJavaTypeAdapter getXmlJavaTypeAdapter() { - return this.xmlJavaTypeAdapter; - } - - public XmlJavaTypeAdapter addXmlJavaTypeAdapter() { - if (this.xmlJavaTypeAdapter != null) { - throw new IllegalStateException(); - } - XmlJavaTypeAdapterAnnotation annotation = (XmlJavaTypeAdapterAnnotation) this.owner.getResource().addAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - - XmlJavaTypeAdapter xmlJavaTypeAdapter = this.buildXmlJavaTypeAdapter(annotation); - this.setXmlJavaTypeAdapter_(xmlJavaTypeAdapter); - return xmlJavaTypeAdapter; - } - - protected XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation) { - return this.owner.buildXmlJavaTypeAdapter(xmlJavaTypeAdapterAnnotation); - } - - public void removeXmlJavaTypeAdapter() { - if (this.xmlJavaTypeAdapter == null) { - throw new IllegalStateException(); - } - this.owner.getResource().removeAnnotation(XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - this.setXmlJavaTypeAdapter_(null); - } - - protected void initializeXmlJavaTypeAdapter() { - XmlJavaTypeAdapterAnnotation annotation = this.getXmlJavaTypeAdapterAnnotation(); - if (annotation != null) { - this.xmlJavaTypeAdapter = this.buildXmlJavaTypeAdapter(annotation); - } - } - - protected XmlJavaTypeAdapterAnnotation getXmlJavaTypeAdapterAnnotation() { - return (XmlJavaTypeAdapterAnnotation) this.owner.getResource().getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - - protected void syncXmlJavaTypeAdapter() { - XmlJavaTypeAdapterAnnotation annotation = this.getXmlJavaTypeAdapterAnnotation(); - if (annotation != null) { - if (this.getXmlJavaTypeAdapter() != null) { - this.getXmlJavaTypeAdapter().synchronizeWithResourceModel(); - } - else { - this.setXmlJavaTypeAdapter_(this.buildXmlJavaTypeAdapter(annotation)); - } - } - else { - this.setXmlJavaTypeAdapter_(null); - } - } - - protected void updateXmlJavaTypeAdapter() { - if (this.getXmlJavaTypeAdapter() != null) { - this.getXmlJavaTypeAdapter().update(); - } - } - - protected void setXmlJavaTypeAdapter_(XmlJavaTypeAdapter xmlJavaTypeAdapter) { - XmlJavaTypeAdapter oldXmlJavaTypeAdapter = this.xmlJavaTypeAdapter; - this.xmlJavaTypeAdapter = xmlJavaTypeAdapter; - this.owner.fireXmlAdapterChanged(oldXmlJavaTypeAdapter, xmlJavaTypeAdapter); - } - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - if (getXmlJavaTypeAdapter() != null) { - this.getXmlJavaTypeAdapter().validate(messages, reporter, astRoot); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAttributeMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAttributeMapping.java deleted file mode 100644 index 29adacbbfa..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlAttributeMapping.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.jaxb.core.MappingKeys; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.XmlAttributeMapping; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; - -public class GenericJavaXmlAttributeMapping - extends GenericJavaContainmentMapping - implements XmlAttributeMapping -{ - - - public GenericJavaXmlAttributeMapping(JaxbPersistentAttribute parent) { - super(parent); - } - - public String getKey() { - return MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return XmlAttributeAnnotation.ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementMapping.java deleted file mode 100644 index c7d5751317..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementMapping.java +++ /dev/null @@ -1,223 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.jaxb.core.MappingKeys; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.XmlElementMapping; -import org.eclipse.jpt.jaxb.core.context.XmlElementWrapper; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaXmlElementMapping - extends GenericJavaContainmentMapping - implements XmlElementMapping -{ - - protected Boolean specifiedNillable; - - protected String defaultValue; - - protected String specifiedType; - - protected XmlElementWrapper xmlElementWrapper; - - public GenericJavaXmlElementMapping(JaxbPersistentAttribute parent) { - super(parent); - this.specifiedNillable = this.buildSpecifiedNillable(); - this.defaultValue = this.buildDefaultValue(); - this.specifiedType = this.buildSpecifiedType(); - this.initializeXmlElementWrapper(); - } - - public String getKey() { - return MappingKeys.XML_ELEMENT_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return XmlElementAnnotation.ANNOTATION_NAME; - } - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedNillable_(this.buildSpecifiedNillable()); - this.setDefaultValue_(this.buildDefaultValue()); - this.setSpecifiedType_(this.buildSpecifiedType()); - this.syncXmlElementWrapper(); - } - - @Override - public void update() { - super.update(); - this.updateXmlElementWrapper(); - } - - //************ XmlElement.nillable *************** - - public boolean isNillable() { - return (this.getSpecifiedNillable() == null) ? this.isDefaultNillable() : this.getSpecifiedNillable().booleanValue(); - } - - public boolean isDefaultNillable() { - return DEFAULT_NILLABLE; - } - - public Boolean getSpecifiedNillable() { - return this.specifiedNillable; - } - - public void setSpecifiedNillable(Boolean newSpecifiedNillable) { - this.getAnnotationForUpdate().setNillable(newSpecifiedNillable); - this.setSpecifiedNillable_(newSpecifiedNillable); - } - - protected void setSpecifiedNillable_(Boolean newSpecifiedNillable) { - Boolean oldNillable = this.specifiedNillable; - this.specifiedNillable = newSpecifiedNillable; - firePropertyChanged(SPECIFIED_NILLABLE_PROPERTY, oldNillable, newSpecifiedNillable); - } - - protected Boolean buildSpecifiedNillable() { - return getMappingAnnotation() == null ? null : getMappingAnnotation().getNillable(); - } - - - //************ XmlElement.defaultValue *************** - - public String getDefaultValue() { - return this.defaultValue; - } - - public void setDefaultValue(String defaultValue) { - this.getAnnotationForUpdate().setDefaultValue(defaultValue); - this.setDefaultValue_(defaultValue); - } - - protected void setDefaultValue_(String defaultValue) { - String oldDefaultValue = this.defaultValue; - this.defaultValue = defaultValue; - firePropertyChanged(DEFAULT_VALUE_PROPERTY, oldDefaultValue, defaultValue); - } - - protected String buildDefaultValue() { - return getMappingAnnotation() == null ? null : getMappingAnnotation().getDefaultValue(); - } - - //************ XmlElement.type *************** - - public String getType() { - return getSpecifiedType() == null ? getDefaultType() : getSpecifiedType(); - } - - public String getDefaultType() { - //TODO calculate default type - return null; - } - - public String getSpecifiedType() { - return this.specifiedType; - } - - public void setSpecifiedType(String newSpecifiedType) { - this.getAnnotationForUpdate().setType(newSpecifiedType); - this.setSpecifiedType_(newSpecifiedType); - } - - protected void setSpecifiedType_(String newSpecifiedType) { - String oldType = this.specifiedType; - this.specifiedType = newSpecifiedType; - firePropertyChanged(SPECIFIED_TYPE_PROPERTY, oldType, newSpecifiedType); - } - - protected String buildSpecifiedType() { - return getMappingAnnotation() == null ? null : getMappingAnnotation().getType(); - } - - //************ XmlElementWrapper *************** - - public XmlElementWrapper getXmlElementWrapper() { - return this.xmlElementWrapper; - } - - public XmlElementWrapper addXmlElementWrapper() { - if (this.xmlElementWrapper != null) { - throw new IllegalStateException(); - } - XmlElementWrapperAnnotation annotation = (XmlElementWrapperAnnotation) this.getJavaResourceAttribute().addAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME); - - XmlElementWrapper xmlElementWrapper = this.buildXmlElementWrapper(annotation); - this.setXmlElementWrapper_(xmlElementWrapper); - return xmlElementWrapper; - } - - protected XmlElementWrapper buildXmlElementWrapper(XmlElementWrapperAnnotation xmlElementWrapperAnnotation) { - return new GenericJavaXmlElementWrapper(this, xmlElementWrapperAnnotation); - } - - public void removeXmlElementWrapper() { - if (this.xmlElementWrapper == null) { - throw new IllegalStateException(); - } - this.getJavaResourceAttribute().removeAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME); - this.setXmlElementWrapper_(null); - } - - protected void initializeXmlElementWrapper() { - XmlElementWrapperAnnotation annotation = this.getXmlElementWrapperAnnotation(); - if (annotation != null) { - this.xmlElementWrapper = this.buildXmlElementWrapper(annotation); - } - } - - protected XmlElementWrapperAnnotation getXmlElementWrapperAnnotation() { - return (XmlElementWrapperAnnotation) this.getJavaResourceAttribute().getAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME); - } - - protected void syncXmlElementWrapper() { - XmlElementWrapperAnnotation annotation = this.getXmlElementWrapperAnnotation(); - if (annotation != null) { - if (this.getXmlElementWrapper() != null) { - this.getXmlElementWrapper().synchronizeWithResourceModel(); - } - else { - this.setXmlElementWrapper_(this.buildXmlElementWrapper(annotation)); - } - } - else { - this.setXmlElementWrapper_(null); - } - } - - protected void updateXmlElementWrapper() { - if (this.getXmlElementWrapper() != null) { - this.getXmlElementWrapper().update(); - } - } - - protected void setXmlElementWrapper_(XmlElementWrapper xmlElementWrapper) { - XmlElementWrapper oldXmlElementWrapper = this.xmlElementWrapper; - this.xmlElementWrapper = xmlElementWrapper; - firePropertyChanged(XML_ELEMENT_WRAPPER_PROPERTY, oldXmlElementWrapper, xmlElementWrapper); - } - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - if (this.getXmlElementWrapper() != null) { - this.getXmlElementWrapper().validate(messages, reporter, astRoot); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementWrapper.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementWrapper.java deleted file mode 100644 index b940e68187..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlElementWrapper.java +++ /dev/null @@ -1,211 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import java.util.Collection; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.XmlElementWrapper; -import org.eclipse.jpt.jaxb.core.internal.validation.DefaultValidationMessages; -import org.eclipse.jpt.jaxb.core.internal.validation.JaxbValidationMessages; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaXmlElementWrapper - extends AbstractJavaContextNode - implements XmlElementWrapper -{ - - protected final XmlElementWrapperAnnotation resourceXmlElementWrapper; - - protected String specifiedName; - - protected Boolean specifiedRequired; - - protected String specifiedNamespace; - - protected Boolean specifiedNillable; - - public GenericJavaXmlElementWrapper(JaxbAttributeMapping parent, XmlElementWrapperAnnotation resource) { - super(parent); - this.resourceXmlElementWrapper = resource; - this.specifiedName = buildSpecifiedName(); - this.specifiedNamespace = buildSpecifiedNamespace(); - this.specifiedRequired = buildSpecifiedRequired(); - this.specifiedNillable = this.buildSpecifiedNillable(); - } - - @Override - public JaxbAttributeMapping getParent() { - return (JaxbAttributeMapping) super.getParent(); - } - - protected JaxbPersistentAttribute getPersistentAttribute() { - return getParent().getParent(); - } - - // ********** synchronize/update ********** - - public void synchronizeWithResourceModel() { - setSpecifiedName_(buildSpecifiedName()); - setSpecifiedNamespace_(buildSpecifiedNamespace()); - setSpecifiedRequired_(buildSpecifiedRequired()); - this.setSpecifiedNillable_(this.buildSpecifiedNillable()); - } - - public void update() { - //nothing yet - } - - - //************ XmlElementWrapper.name *************** - - public String getName() { - return this.getSpecifiedName() == null ? this.getDefaultName() : getSpecifiedName(); - } - - public String getDefaultName() { - return getParent().getParent().getName(); - } - - public String getSpecifiedName() { - return this.specifiedName; - } - - public void setSpecifiedName(String name) { - this.resourceXmlElementWrapper.setName(name); - this.setSpecifiedName_(name); - } - - protected void setSpecifiedName_(String name) { - String old = this.specifiedName; - this.specifiedName = name; - firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedName() { - return this.resourceXmlElementWrapper.getName(); - } - - - //************ XmlElementWrapper.required *************** - - public boolean isRequired() { - return (this.getSpecifiedRequired() == null) ? this.isDefaultRequired() : this.getSpecifiedRequired().booleanValue(); - } - - public boolean isDefaultRequired() { - return DEFAULT_REQUIRED; - } - - public Boolean getSpecifiedRequired() { - return this.specifiedRequired; - } - - public void setSpecifiedRequired(Boolean newSpecifiedRequired) { - this.resourceXmlElementWrapper.setRequired(newSpecifiedRequired); - this.setSpecifiedRequired_(newSpecifiedRequired); - } - - protected void setSpecifiedRequired_(Boolean newSpecifiedRequired) { - Boolean oldRequired = this.specifiedRequired; - this.specifiedRequired = newSpecifiedRequired; - firePropertyChanged(SPECIFIED_REQUIRED_PROPERTY, oldRequired, newSpecifiedRequired); - } - - protected Boolean buildSpecifiedRequired() { - return this.resourceXmlElementWrapper.getRequired(); - } - - - //************ XmlElementWrapper.namespace *************** - - public String getNamespace() { - return getSpecifiedNamespace() == null ? getDefaultNamespace() : getSpecifiedNamespace(); - } - - public String getDefaultNamespace() { - return null; - //TODO what is the default namespace? Is the default namespace in GeneraicJavaContainmentMapping even right? ask Paul - //return getPersistentAttribute().getParent().getNamespace(); - } - - public String getSpecifiedNamespace() { - return this.specifiedNamespace; - } - - public void setSpecifiedNamespace(String newSpecifiedNamespace) { - this.resourceXmlElementWrapper.setNamespace(newSpecifiedNamespace); - this.setSpecifiedNamespace_(newSpecifiedNamespace); - } - - protected void setSpecifiedNamespace_(String newSpecifiedNamespace) { - String oldNamespace = this.specifiedNamespace; - this.specifiedNamespace = newSpecifiedNamespace; - firePropertyChanged(SPECIFIED_NAMESPACE_PROPERTY, oldNamespace, newSpecifiedNamespace); - } - - protected String buildSpecifiedNamespace() { - return this.resourceXmlElementWrapper.getNamespace(); - } - - //************ XmlElementWrapper.nillable *************** - - public boolean isNillable() { - return (this.getSpecifiedNillable() == null) ? this.isDefaultNillable() : this.getSpecifiedNillable().booleanValue(); - } - - public boolean isDefaultNillable() { - return DEFAULT_NILLABLE; - } - - public Boolean getSpecifiedNillable() { - return this.specifiedNillable; - } - - public void setSpecifiedNillable(Boolean newSpecifiedNillable) { - this.resourceXmlElementWrapper.setNillable(newSpecifiedNillable); - this.setSpecifiedNillable_(newSpecifiedNillable); - } - - protected void setSpecifiedNillable_(Boolean newSpecifiedNillable) { - Boolean oldNillable = this.specifiedNillable; - this.specifiedNillable = newSpecifiedNillable; - firePropertyChanged(SPECIFIED_NILLABLE_PROPERTY, oldNillable, newSpecifiedNillable); - } - - protected Boolean buildSpecifiedNillable() { - return this.resourceXmlElementWrapper.getNillable(); - } - - - //************* validation **************** - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - if (!getPersistentAttribute().isJavaResourceAttributeTypeSubTypeOf(Collection.class.getName()) && !getPersistentAttribute().isJavaResourceAttributeTypeArray()) { - messages.add( - DefaultValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JaxbValidationMessages.XML_ELEMENT_WRAPPER_DEFINED_ON_NON_ARRAY_NON_COLLECTION, - this, - getValidationTextRange(astRoot))); - } - } - - @Override - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.resourceXmlElementWrapper.getTextRange(astRoot); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlList.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlList.java deleted file mode 100644 index 61a2ca27e2..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlList.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import java.util.Collection; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.XmlList; -import org.eclipse.jpt.jaxb.core.internal.validation.DefaultValidationMessages; -import org.eclipse.jpt.jaxb.core.internal.validation.JaxbValidationMessages; -import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaXmlList - extends AbstractJavaContextNode - implements XmlList -{ - - protected final XmlListAnnotation resourceXmlList; - - protected String specifiedName; - - protected Boolean specifiedRequired; - - protected String specifiedNamespace; - - protected Boolean specifiedNillable; - - public GenericJavaXmlList(JaxbAttributeMapping parent, XmlListAnnotation resource) { - super(parent); - this.resourceXmlList = resource; - } - - @Override - public JaxbAttributeMapping getParent() { - return (JaxbAttributeMapping) super.getParent(); - } - - protected JaxbPersistentAttribute getPersistentAttribute() { - return getParent().getParent(); - } - - // ********** synchronize/update ********** - - public void synchronizeWithResourceModel() { - //nothing yet - } - - public void update() { - //nothing yet - } - - - - //************* validation **************** - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - if (!getPersistentAttribute().isJavaResourceAttributeTypeSubTypeOf(Collection.class.getName()) && !getPersistentAttribute().isJavaResourceAttributeTypeArray()) { - messages.add( - DefaultValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JaxbValidationMessages.XML_LIST_DEFINED_ON_NON_ARRAY_NON_COLLECTION, - this, - getValidationTextRange(astRoot))); - } - } - - @Override - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.resourceXmlList.getTextRange(astRoot); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlNs.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlNs.java deleted file mode 100644 index 585e4809af..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlNs.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; -import org.eclipse.jpt.jaxb.core.context.XmlNs; -import org.eclipse.jpt.jaxb.core.context.XmlSchema; -import org.eclipse.jpt.jaxb.core.internal.context.AbstractJaxbContextNode; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation; - -public class GenericJavaXmlNs - extends AbstractJaxbContextNode - implements XmlNs -{ - - protected final XmlNsAnnotation resourceXmlNs; - - protected String namespaceURI; - - protected String prefix; - - public GenericJavaXmlNs(XmlSchema parent, XmlNsAnnotation xmlNsAnnotation) { - super(parent); - this.resourceXmlNs = xmlNsAnnotation; - this.namespaceURI = this.getResourceNamespaceURI(); - this.prefix = this.getResourcePrefix(); - } - - public XmlNsAnnotation getResourceXmlNs() { - return this.resourceXmlNs; - } - - // ********** synchronize/update ********** - - public void synchronizeWithResourceModel() { - this.setNamespaceURI_(this.getResourceNamespaceURI()); - this.setPrefix_(this.getResourcePrefix()); - } - - public void update() { - //nothing yet - } - - - @Override - public JaxbPackageInfo getParent() { - return (JaxbPackageInfo) super.getParent(); - } - - protected JavaResourcePackage getResourcePackage() { - return getParent().getResourcePackage(); - } - - - // ********** namespaceURI ********** - - public String getNamespaceURI() { - return this.namespaceURI; - } - - public void setNamespaceURI(String namespace) { - this.resourceXmlNs.setNamespaceURI(namespace); - this.setNamespaceURI_(namespace); - } - - protected void setNamespaceURI_(String namespaceURI) { - String old = this.namespaceURI; - this.namespaceURI = namespaceURI; - this.firePropertyChanged(NAMESPACE_URI_PROPERTY, old, namespaceURI); - } - - protected String getResourceNamespaceURI() { - return this.resourceXmlNs.getNamespaceURI(); - } - - // ********** prefix ********** - - public String getPrefix() { - return this.prefix; - } - - public void setPrefix(String prefix) { - this.resourceXmlNs.setPrefix(prefix); - this.setPrefix_(prefix); - } - - protected void setPrefix_(String prefix) { - String old = this.prefix; - this.prefix = prefix; - this.firePropertyChanged(PREFIX_PROPERTY, old, prefix); - } - - protected String getResourcePrefix() { - return this.resourceXmlNs.getPrefix(); - } - - - //****************** miscellaneous ******************** - - @Override - public void toString(StringBuilder sb) { - super.toString(sb); - sb.append(this.namespaceURI); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlRootElement.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlRootElement.java deleted file mode 100644 index a4463e247e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlRootElement.java +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import java.beans.Introspector; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentType; -import org.eclipse.jpt.jaxb.core.context.XmlRootElement; -import org.eclipse.jpt.jaxb.core.internal.validation.DefaultValidationMessages; -import org.eclipse.jpt.jaxb.core.internal.validation.JaxbValidationMessages; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; -import org.eclipse.jpt.jaxb.core.xsd.XsdElementDeclaration; -import org.eclipse.jpt.jaxb.core.xsd.XsdSchema; -import org.eclipse.jpt.jaxb.core.xsd.XsdTypeDefinition; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaXmlRootElement - extends AbstractJavaContextNode - implements XmlRootElement { - - protected final XmlRootElementAnnotation resourceXmlRootElementAnnotation; - - protected String specifiedName; - - protected String specifiedNamespace; - - - public GenericJavaXmlRootElement(JaxbPersistentType parent, XmlRootElementAnnotation resourceXmlRootElementAnnotation) { - super(parent); - this.resourceXmlRootElementAnnotation = resourceXmlRootElementAnnotation; - this.specifiedName = this.getResourceName(); - this.specifiedNamespace = this.getResourceNamespace(); - } - - - // ********** synchronize/update ********** - - public void synchronizeWithResourceModel() { - this.setSpecifiedName_(this.getResourceName()); - this.setSpecifiedNamespace_(this.getResourceNamespace()); - } - - public void update() { - //nothing yet - } - - - @Override - public JaxbPersistentType getParent() { - return (JaxbPersistentType) super.getParent(); - } - - - // ********** name ********** - - public String getName() { - return (this.specifiedName != null) ? this.specifiedName : getDefaultName(); - } - - public String getSpecifiedName() { - return this.specifiedName; - } - - public void setSpecifiedName(String name) { - this.resourceXmlRootElementAnnotation.setName(name); - this.setSpecifiedName_(name); - } - - protected void setSpecifiedName_(String name) { - String old = this.specifiedName; - this.specifiedName = name; - this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name); - } - - public String getDefaultName() { - return Introspector.decapitalize(getParent().getSimpleName()); - } - - protected String getResourceName() { - return this.resourceXmlRootElementAnnotation.getName(); - } - - - // ********** namespace ********** - - public String getNamespace() { - return (this.specifiedNamespace != null) ? this.specifiedNamespace : getDefaultNamespace(); - } - - public String getSpecifiedNamespace() { - return this.specifiedNamespace; - } - - public void setSpecifiedNamespace(String namespace) { - this.resourceXmlRootElementAnnotation.setNamespace(namespace); - this.setSpecifiedNamespace_(namespace); - } - - protected void setSpecifiedNamespace_(String namespace) { - String old = this.specifiedNamespace; - this.specifiedNamespace = namespace; - this.firePropertyChanged(SPECIFIED_NAMESPACE_PROPERTY, old, namespace); - } - - public String getDefaultNamespace() { - return getParent().getJaxbPackage().getNamespace(); - } - - protected String getResourceNamespace() { - return this.resourceXmlRootElementAnnotation.getNamespace(); - } - - - // **************** content assist **************************************** - - @Override - public Iterable getJavaCompletionProposals( - int pos, Filter filter, CompilationUnit astRoot) { - Iterable result = super.getJavaCompletionProposals(pos, filter, astRoot); - if (! CollectionTools.isEmpty(result)) { - return result; - } - - if (namespaceTouches(pos, astRoot)) { - return getNamespaceProposals(filter); - } - - if (nameTouches(pos, astRoot)) { - return getNameProposals(filter); - } - - return EmptyIterable.instance(); - } - - protected boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return this.resourceXmlRootElementAnnotation.namespaceTouches(pos, astRoot); - } - - protected Iterable getNamespaceProposals(Filter filter) { - XsdSchema schema = getParent().getJaxbPackage().getXsdSchema(); - if (schema == null) { - return EmptyIterable.instance(); - } - return schema.getNamespaceProposals(filter); - } - - protected boolean nameTouches(int pos, CompilationUnit astRoot) { - return this.resourceXmlRootElementAnnotation.nameTouches(pos, astRoot); - } - - protected Iterable getNameProposals(Filter filter) { - String namespace = getNamespace(); - XsdSchema schema = getParent().getJaxbPackage().getXsdSchema(); - if (schema == null) { - return EmptyIterable.instance(); - } - return StringTools.convertToJavaStringLiterals( - new FilteringIterable( - new TransformationIterable(schema.getElementDeclarations(namespace)) { - @Override - protected String transform(XsdElementDeclaration o) { - return o.getName(); - } - }, - filter)); - } - - - // **************** validation ******************************************** - - @Override - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.resourceXmlRootElementAnnotation.getTextRange(astRoot); - } - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - - String name = getName(); - String namespace = getNamespace(); - - XsdSchema schema = getParent().getJaxbPackage().getXsdSchema(); - - if (schema != null) { - // element must resolve - XsdElementDeclaration schemaElement = schema.getElementDeclaration(namespace, name); - if (schemaElement == null) { - messages.add( - DefaultValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JaxbValidationMessages.XML_ROOT_ELEMENT_UNRESOLVED_SCHEMA_ELEMENT, - new String[] {name, namespace}, - this, - this.resourceXmlRootElementAnnotation.getTextRange(astRoot))); - } - else { - // element type must agree with parent's schema type - XsdTypeDefinition schemaType = getParent().getXsdTypeDefinition(); - if (schemaType != null) { - if (! schemaType.equals(schemaElement.getType())) { - messages.add( - DefaultValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JaxbValidationMessages.XML_ROOT_ELEMENT_TYPE_CONFLICTS_WITH_XML_TYPE, - new String[] {name, namespace}, - this, - this.resourceXmlRootElementAnnotation.getTextRange(astRoot))); - } - } - } - } - } - - - //****************** miscellaneous ******************** - - @Override - public void toString(StringBuilder sb) { - super.toString(sb); - sb.append("namespace = \"" + this.specifiedNamespace + "\""); - sb.append("; name = \"" + this.specifiedName + "\""); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlSchema.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlSchema.java deleted file mode 100644 index 7cd8060433..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlSchema.java +++ /dev/null @@ -1,283 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; -import org.eclipse.jpt.jaxb.core.context.XmlNs; -import org.eclipse.jpt.jaxb.core.context.XmlNsForm; -import org.eclipse.jpt.jaxb.core.context.XmlSchema; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaAnnotation; - -public class GenericJavaXmlSchema - extends AbstractJavaContextNode - implements XmlSchema { - - protected String specifiedNamespace; - - protected String location; - - protected XmlNsForm attributeFormDefault; - - protected XmlNsForm elementFormDefault; - - protected final XmlNsPrefixContainer xmlNsPrefixContainer; - - - public GenericJavaXmlSchema(JaxbPackageInfo parent) { - super(parent); - this.specifiedNamespace = this.getResourceNamespace(); - this.location = this.getResourceLocation(); - this.attributeFormDefault = this.getResourceAttributeFormDefault(); - this.elementFormDefault = this.getResourceElementFormDefault(); - this.xmlNsPrefixContainer = new XmlNsPrefixContainer(); - } - - - // ********** synchronize/update ********** - - public void synchronizeWithResourceModel() { - this.setSpecifiedNamespace_(this.getResourceNamespace()); - this.setLocation_(this.getResourceLocation()); - this.setAttributeFormDefault_(this.getResourceAttributeFormDefault()); - this.setElementFormDefault_(this.getResourceElementFormDefault()); - this.syncXmlNsPrefixes(); - } - - public void update() { - this.updateXmlNsPrefixes(); - } - - @Override - public JaxbPackageInfo getParent() { - return (JaxbPackageInfo) super.getParent(); - } - - protected JavaResourcePackage getResourcePackage() { - return getParent().getResourcePackage(); - } - - - // ********** xml schema annotation ********** - - protected XmlSchemaAnnotation getXmlSchemaAnnotation() { - return (XmlSchemaAnnotation) this.getResourcePackage().getNonNullAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - } - - // ********** namespace ********** - - public String getNamespace() { - return (this.specifiedNamespace == null) ? "" : this.specifiedNamespace; - } - - public String getSpecifiedNamespace() { - return this.specifiedNamespace; - } - - public void setSpecifiedNamespace(String namespace) { - this.getXmlSchemaAnnotation().setNamespace(namespace); - this.setSpecifiedNamespace_(namespace); - } - - protected void setSpecifiedNamespace_(String namespace) { - String old = this.specifiedNamespace; - this.specifiedNamespace = namespace; - this.firePropertyChanged(SPECIFIED_NAMESPACE_PROPERTY, old, namespace); - } - - protected String getResourceNamespace() { - return getXmlSchemaAnnotation().getNamespace(); - } - - - // ********** location ********** - - public String getLocation() { - return this.location; - } - - public void setLocation(String location) { - this.getXmlSchemaAnnotation().setLocation(location); - this.setLocation_(location); - } - - protected void setLocation_(String location) { - String old = this.location; - this.location = location; - this.firePropertyChanged(LOCATION_PROPERTY, old, location); - } - - protected String getResourceLocation() { - return getXmlSchemaAnnotation().getLocation(); - } - - - // ********** attribute form default ********** - - public XmlNsForm getAttributeFormDefault() { - return this.attributeFormDefault; - } - - public void setAttributeFormDefault(XmlNsForm xmlNsForm) { - this.getXmlSchemaAnnotation().setAttributeFormDefault(XmlNsForm.toJavaResourceModel(xmlNsForm)); - this.setAttributeFormDefault_(xmlNsForm); - } - - protected void setAttributeFormDefault_(XmlNsForm xmlNsForm) { - XmlNsForm old = this.attributeFormDefault; - this.attributeFormDefault = xmlNsForm; - this.firePropertyChanged(ATTRIBUTE_FROM_DEFAULT_PROPERTY, old, xmlNsForm); - } - - protected XmlNsForm getResourceAttributeFormDefault() { - return XmlNsForm.fromJavaResourceModel(getXmlSchemaAnnotation().getAttributeFormDefault()); - } - - - // ********** element form default ********** - - public XmlNsForm getElementFormDefault() { - return this.elementFormDefault; - } - - public void setElementFormDefault(XmlNsForm xmlNsForm) { - this.getXmlSchemaAnnotation().setElementFormDefault(XmlNsForm.toJavaResourceModel(xmlNsForm)); - this.setElementFormDefault_(xmlNsForm); - } - - protected void setElementFormDefault_(XmlNsForm xmlNsForm) { - XmlNsForm old = this.elementFormDefault; - this.elementFormDefault = xmlNsForm; - this.firePropertyChanged(ELEMENT_FROM_DEFAULT_PROPERTY, old, xmlNsForm); - } - - protected XmlNsForm getResourceElementFormDefault() { - return XmlNsForm.fromJavaResourceModel(getXmlSchemaAnnotation().getElementFormDefault()); - } - - - // ********** xml namespace prefixes ********** - - public ListIterable getXmlNsPrefixes() { - return this.xmlNsPrefixContainer.getContextElements(); - } - - public int getXmlNsPrefixesSize() { - return this.xmlNsPrefixContainer.getContextElementsSize(); - } - - public XmlNs addXmlNsPrefix(int index) { - XmlNsAnnotation annotation = this.getXmlSchemaAnnotation().addXmlns(index); - return this.xmlNsPrefixContainer.addContextElement(index, annotation); - } - - public void removeXmlNsPrefix(XmlNs xmlNsPrefix) { - this.removeXmlNsPrefix(this.xmlNsPrefixContainer.indexOfContextElement(xmlNsPrefix)); - } - - public void removeXmlNsPrefix(int index) { - this.getXmlSchemaAnnotation().removeXmlns(index); - this.xmlNsPrefixContainer.removeContextElement(index); - } - - public void moveXmlNsPrefix(int targetIndex, int sourceIndex) { - this.getXmlSchemaAnnotation().moveXmlns(targetIndex, sourceIndex); - this.xmlNsPrefixContainer.moveContextElement(targetIndex, sourceIndex); - } - - protected XmlNs buildXmlNs(XmlNsAnnotation xmlNsAnnotation) { - return this.getFactory().buildJavaXmlNs(this, xmlNsAnnotation); - } - - protected void syncXmlNsPrefixes() { - this.xmlNsPrefixContainer.synchronizeWithResourceModel(); - } - - protected void updateXmlNsPrefixes() { - this.xmlNsPrefixContainer.update(); - } - - protected ListIterable getXmlNsAnnotations() { - return getXmlSchemaAnnotation().getXmlns(); - } - - - // **************** content assist **************************************** - - @Override - public Iterable getJavaCompletionProposals( - int pos, Filter filter, CompilationUnit astRoot) { - Iterable result = super.getJavaCompletionProposals(pos, filter, astRoot); - if (! CollectionTools.isEmpty(result)) { - return result; - } - - if (namespaceTouches(pos, astRoot)) { - return getNamespaceProposals(filter); - } - - return EmptyIterable.instance(); - } - - protected boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return getXmlSchemaAnnotation().namespaceTouches(pos, astRoot); - } - - protected Iterable getNamespaceProposals(Filter filter) { - return StringTools.convertToJavaStringLiterals( - new FilteringIterable( - getJaxbProject().getSchemaLibrary().getSchemaLocations().keySet(), filter)); - } - - - // **************** validation ******************************************** - - @Override - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return getXmlSchemaAnnotation().getTextRange(astRoot); - } - - - /** - * xml ns prefix container adapter - */ - protected class XmlNsPrefixContainer - extends ContextListContainer { - - @Override - protected String getContextElementsPropertyName() { - return XML_NS_PREFIXES_LIST; - } - - @Override - protected XmlNs buildContextElement(XmlNsAnnotation resourceElement) { - return GenericJavaXmlSchema.this.buildXmlNs(resourceElement); - } - - @Override - protected ListIterable getResourceElements() { - return GenericJavaXmlSchema.this.getXmlNsAnnotations(); - } - - @Override - protected XmlNsAnnotation getResourceElement(XmlNs contextElement) { - return contextElement.getResourceXmlNs(); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlSchemaType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlSchemaType.java deleted file mode 100644 index a9ae250368..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlSchemaType.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jaxb.core.context.JaxbContextNode; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.XmlSchemaType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; -import org.eclipse.jpt.jaxb.core.xsd.XsdSchema; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; -import org.eclipse.xsd.util.XSDUtil; - -public abstract class GenericJavaXmlSchemaType - extends AbstractJavaContextNode - implements XmlSchemaType { - - protected final XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation; - - protected String name; - - protected String specifiedNamespace; - - protected String type; - - - protected GenericJavaXmlSchemaType(JaxbContextNode parent, XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation) { - super(parent); - this.xmlSchemaTypeAnnotation = xmlSchemaTypeAnnotation; - this.name = this.getResourceName(); - this.specifiedNamespace = this.getResourceNamespace(); - this.type = this.getResourceTypeString(); - } - - - // ********** synchronize/update ********** - - public void synchronizeWithResourceModel() { - this.setName_(this.getResourceName()); - this.setNamespace_(this.getResourceNamespace()); - this.setType_(this.getResourceTypeString()); - } - - public void update() { - //nothing yet - } - - - // ********** xml schema type annotation ********** - - public XmlSchemaTypeAnnotation getResourceXmlSchemaType() { - return this.xmlSchemaTypeAnnotation; - } - - // ********** name ********** - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.xmlSchemaTypeAnnotation.setName(name); - this.setName_(name); - } - - protected void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - protected String getResourceName() { - return this.xmlSchemaTypeAnnotation.getName(); - } - - // ********** namespace ********** - - public String getNamespace() { - return getSpecifiedNamespace() == null ? getDefaultNamespace() : getSpecifiedNamespace(); - } - - public String getDefaultNamespace() { - return XSDUtil.SCHEMA_FOR_SCHEMA_URI_2001; - } - - public String getSpecifiedNamespace() { - return this.specifiedNamespace; - } - - public void setSpecifiedNamespace(String location) { - this.xmlSchemaTypeAnnotation.setNamespace(location); - this.setNamespace_(location); - } - - protected void setNamespace_(String namespace) { - String old = this.specifiedNamespace; - this.specifiedNamespace = namespace; - this.firePropertyChanged(SPECIFIED_NAMESPACE_PROPERTY, old, namespace); - } - - protected String getResourceNamespace() { - return this.xmlSchemaTypeAnnotation.getNamespace(); - } - - - // ********** type ********** - - public String getType() { - return this.type; - } - - public void setType(String location) { - this.xmlSchemaTypeAnnotation.setType(location); - this.setType_(location); - } - - protected void setType_(String type) { - String old = this.type; - this.type = type; - this.firePropertyChanged(TYPE_PROPERTY, old, type); - } - - protected String getResourceTypeString() { - return this.xmlSchemaTypeAnnotation.getType(); - } - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - } - - @Override - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.xmlSchemaTypeAnnotation.getTextRange(astRoot); - } - - - // *********** content assist *********** - - @Override - public Iterable getJavaCompletionProposals( - int pos, Filter filter, CompilationUnit astRoot) { - Iterable result = super.getJavaCompletionProposals(pos, filter, astRoot); - if (! CollectionTools.isEmpty(result)) { - return result; - } - - if (namespaceTouches(pos, astRoot)) { - return getNamespaceProposals(filter); - } - - if (nameTouches(pos, astRoot)) { - return getNameProposals(filter); - } - - return EmptyIterable.instance(); - } - - protected boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return getResourceXmlSchemaType().namespaceTouches(pos, astRoot); - } - - protected Iterable getNamespaceProposals(Filter filter) { - XsdSchema schema = getJaxbPackage().getXsdSchema(); - if (schema == null) { - return EmptyIterable.instance(); - } - return schema.getNamespaceProposals(filter); - } - - protected boolean nameTouches(int pos, CompilationUnit astRoot) { - return getResourceXmlSchemaType().nameTouches(pos, astRoot); - } - - protected Iterable getNameProposals(Filter filter) { - XsdSchema schema = getJaxbPackage().getXsdSchema(); - if (schema == null) { - return EmptyIterable.instance(); - } - return schema.getSimpleTypeNameProposals(getNamespace(), filter); - } - - protected abstract JaxbPackage getJaxbPackage(); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlTransientMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlTransientMapping.java deleted file mode 100644 index 57f35c3c3d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlTransientMapping.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.jaxb.core.MappingKeys; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTransientAnnotation; - -public class GenericJavaXmlTransientMapping - extends AbstractJavaAttributeMapping -{ - - public GenericJavaXmlTransientMapping(JaxbPersistentAttribute parent) { - super(parent); - } - - public String getKey() { - return MappingKeys.XML_TRANSIENT_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return XmlTransientAnnotation.ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlValueMapping.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlValueMapping.java deleted file mode 100644 index 0d31b6a659..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/GenericJavaXmlValueMapping.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.jaxb.core.MappingKeys; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.XmlAdaptable; -import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter; -import org.eclipse.jpt.jaxb.core.context.XmlValueMapping; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaXmlValueMapping - extends AbstractJavaAttributeMapping - implements XmlValueMapping -{ - protected final XmlAdaptable xmlAdaptable; - - - public GenericJavaXmlValueMapping(JaxbPersistentAttribute parent) { - super(parent); - this.xmlAdaptable = buildXmlAdaptable(); - } - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.xmlAdaptable.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.xmlAdaptable.update(); - } - - public String getKey() { - return MappingKeys.XML_VALUE_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return XmlValueAnnotation.ANNOTATION_NAME; - } - - //****************** XmlJavaTypeAdapter ********************* - - public XmlAdaptable buildXmlAdaptable() { - return new GenericJavaXmlAdaptable(this, new XmlAdaptable.Owner() { - public JavaResourceAnnotatedElement getResource() { - return getJavaResourceAttribute(); - } - public XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation adapterAnnotation) { - return GenericJavaXmlValueMapping.this.buildXmlJavaTypeAdapter(adapterAnnotation); - } - public void fireXmlAdapterChanged(XmlJavaTypeAdapter oldAdapter, XmlJavaTypeAdapter newAdapter) { - GenericJavaXmlValueMapping.this.firePropertyChanged(XML_JAVA_TYPE_ADAPTER_PROPERTY, oldAdapter, newAdapter); - } - }); - } - - public XmlJavaTypeAdapter getXmlJavaTypeAdapter() { - return this.xmlAdaptable.getXmlJavaTypeAdapter(); - } - - public XmlJavaTypeAdapter addXmlJavaTypeAdapter() { - return this.xmlAdaptable.addXmlJavaTypeAdapter(); - } - - protected XmlJavaTypeAdapter buildXmlJavaTypeAdapter(XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation) { - return new GenericJavaAttributeXmlJavaTypeAdapter(this, xmlJavaTypeAdapterAnnotation); - } - - public void removeXmlJavaTypeAdapter() { - this.xmlAdaptable.removeXmlJavaTypeAdapter(); - } - - //****************** validation ********************* - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - // TODO Auto-generated method stub - super.validate(messages, reporter, astRoot); - } - - //validation: -// If a class contains a mapped property or field annotated with -// @XmlValue annotation, then all other mapped fields or properties in the -// class must be mapped to an XML attribute. - - - - - - - -//if the class, subClass, derives from another XML-bound class, baseClass -// directly or indirectly (other than java.lang.Object), then the subClass -// must not contain a mapped property or field annotated with @XmlValue -// annotation. - -//The containing class must not extend another class (other than java.lang.Obect). - - - -//If the type of the field or property is a collection type, then the -// collection item type must map to a simple schema type. Examples: -// // Examples (not exhaustive): Legal usage of @XmlValue -// @XmlValue List foo; // int maps to xs:int -// @XmlValue String[] foo; // String maps to xs:string -// @XmlValue List foo; // only if Bar maps to a simple schema type - - - -// If the type of the field or property is not a collection type, then the type -// of the property or field must map to a schema simple type. -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/JavaXmlAttributeMappingDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/JavaXmlAttributeMappingDefinition.java deleted file mode 100644 index 2a7e2d8c98..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/JavaXmlAttributeMappingDefinition.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayListIterable; -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.MappingKeys; -import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttachmentRefAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlInlineBinaryDataAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlMimeTypeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; - - -public class JavaXmlAttributeMappingDefinition - extends AbstractJavaAttributeMappingDefinition -{ - // singleton - private static final JavaXmlAttributeMappingDefinition INSTANCE = - new JavaXmlAttributeMappingDefinition(); - - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - private static final String[] SUPPORTING_ANNOTATION_NAMES = - {XmlIDAnnotation.ANNOTATION_NAME, - XmlIDREFAnnotation.ANNOTATION_NAME, - XmlListAnnotation.ANNOTATION_NAME, - XmlSchemaTypeAnnotation.ANNOTATION_NAME, - XmlAttachmentRefAnnotation.ANNOTATION_NAME, - XmlMimeTypeAnnotation.ANNOTATION_NAME, - XmlInlineBinaryDataAnnotation.ANNOTATION_NAME, - XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME}; - - /** - * Enforce singleton usage - */ - private JavaXmlAttributeMappingDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return XmlAttributeAnnotation.ANNOTATION_NAME; - } - - public Iterable getSupportingAnnotationNames() { - return new ArrayListIterable(SUPPORTING_ANNOTATION_NAMES); - } - - public JaxbAttributeMapping buildMapping(JaxbPersistentAttribute parent, JaxbFactory factory) { - return factory.buildJavaXmlAttributeMapping(parent); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/JavaXmlElementMappingDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/JavaXmlElementMappingDefinition.java deleted file mode 100644 index b7ba4f77af..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/JavaXmlElementMappingDefinition.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayListIterable; -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.MappingKeys; -import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttachmentRefAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlInlineBinaryDataAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlMimeTypeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; - - -public class JavaXmlElementMappingDefinition - extends AbstractJavaAttributeMappingDefinition - implements DefaultJavaAttributeMappingDefinition -{ - // singleton - private static final JavaXmlElementMappingDefinition INSTANCE = - new JavaXmlElementMappingDefinition(); - - private static final String[] SUPPORTING_ANNOTATION_NAMES = - {XmlIDAnnotation.ANNOTATION_NAME, - XmlIDREFAnnotation.ANNOTATION_NAME, - XmlListAnnotation.ANNOTATION_NAME, - XmlSchemaTypeAnnotation.ANNOTATION_NAME, - XmlAttachmentRefAnnotation.ANNOTATION_NAME, - XmlMimeTypeAnnotation.ANNOTATION_NAME, - XmlInlineBinaryDataAnnotation.ANNOTATION_NAME, - XmlElementWrapperAnnotation.ANNOTATION_NAME, - XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME}; - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaXmlElementMappingDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.XML_ELEMENT_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return XmlElementAnnotation.ANNOTATION_NAME; - } - - public Iterable getSupportingAnnotationNames() { - return new ArrayListIterable(SUPPORTING_ANNOTATION_NAMES); - } - - public JaxbAttributeMapping buildMapping(JaxbPersistentAttribute parent, JaxbFactory factory) { - return factory.buildJavaXmlElementMapping(parent); - } - - public boolean isDefault(JaxbPersistentAttribute persistentAttribute) { - //TODO define what makes a persistent attribute a default XmlElement mapping - return false; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/JavaXmlTransientMappingDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/JavaXmlTransientMappingDefinition.java deleted file mode 100644 index de1049e956..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/JavaXmlTransientMappingDefinition.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.MappingKeys; -import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTransientAnnotation; - - -public class JavaXmlTransientMappingDefinition - extends AbstractJavaAttributeMappingDefinition -{ - // singleton - private static final JavaXmlTransientMappingDefinition INSTANCE = - new JavaXmlTransientMappingDefinition(); - - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaXmlTransientMappingDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.XML_TRANSIENT_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return XmlTransientAnnotation.ANNOTATION_NAME; - } - - public Iterable getSupportingAnnotationNames() { - return EmptyIterable.instance(); - } - - public JaxbAttributeMapping buildMapping(JaxbPersistentAttribute parent, JaxbFactory factory) { - return factory.buildJavaXmlTransientMapping(parent); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/JavaXmlValueMappingDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/JavaXmlValueMappingDefinition.java deleted file mode 100644 index 2b01af0865..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/context/java/JavaXmlValueMappingDefinition.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayListIterable; -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.MappingKeys; -import org.eclipse.jpt.jaxb.core.context.JaxbAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation; - - -public class JavaXmlValueMappingDefinition - extends AbstractJavaAttributeMappingDefinition -{ - // singleton - private static final JavaXmlValueMappingDefinition INSTANCE = - new JavaXmlValueMappingDefinition(); - - private static final String[] SUPPORTING_ANNOTATION_NAMES = - {XmlListAnnotation.ANNOTATION_NAME, - XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME}; - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaXmlValueMappingDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.XML_VALUE_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return XmlValueAnnotation.ANNOTATION_NAME; - } - - public Iterable getSupportingAnnotationNames() { - return new ArrayListIterable(SUPPORTING_ANNOTATION_NAMES); - } - - public JaxbAttributeMapping buildMapping(JaxbPersistentAttribute parent, JaxbFactory factory) { - return factory.buildJavaXmlValueMapping(parent); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProperties.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProperties.java deleted file mode 100644 index a9d2a5f736..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProperties.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.facet; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties; - -public interface JaxbFacetDataModelProperties - extends IDataModelProperties { - - static final String PREFIX_ - = JaxbFacetDataModelProperties.class.getSimpleName() + "."; //$NON-NLS-1$ - - public static final String PLATFORM - = PREFIX_ + "PLATFORM"; //$NON-NLS-1$ - - public static final String LIBRARY_INSTALL_DELEGATE - = PREFIX_ + "LIBRARY_INSTALL_DELEGATE"; //$NON-NLS-1$ -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProvider.java deleted file mode 100644 index c1a2b6b5bd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDataModelProvider.java +++ /dev/null @@ -1,277 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.facet; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Set; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jaxb.core.JaxbFacet; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.internal.JptJaxbCoreMessages; -import org.eclipse.jpt.jaxb.core.libprov.JaxbLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider; -import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig; -import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider; -import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent; -import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener; - - -public abstract class JaxbFacetDataModelProvider - extends FacetInstallDataModelProvider - implements JaxbFacetDataModelProperties { - - protected static final DataModelPropertyDescriptor[] EMPTY_DMPD_ARRAY = new DataModelPropertyDescriptor[0]; - - - protected static final Comparator DMPD_COMPARATOR = - new Comparator() { - public int compare(DataModelPropertyDescriptor dmpd1, DataModelPropertyDescriptor dmpd2) { - return dmpd1.getPropertyDescription().compareTo(dmpd2.getPropertyDescription()); - } - }; - - - - // listens to primary runtime changing - private IFacetedProjectListener fprojListener; - - private LibraryInstallDelegate defaultLibraryInstallDelegate; - - - protected JaxbFacetDataModelProvider() { - super(); - this.fprojListener = buildFprojListener(); - } - - - protected IFacetedProjectListener buildFprojListener() { - return new IFacetedProjectListener() { - public void handleEvent(IFacetedProjectEvent event) { - getLibraryInstallDelegate().refresh(); - } - }; - } - - @Override - public Set getPropertyNames() { - Set names = super.getPropertyNames(); - names.add(PLATFORM); - names.add(LIBRARY_INSTALL_DELEGATE); - return names; - } - - @Override - public Object getDefaultProperty(String propertyName) { - if (propertyName.equals(FACET_ID)) { - return JaxbFacet.ID; - } - else if (propertyName.equals(PLATFORM)) { - return getDefaultPlatform(); - } - else if (propertyName.equals(LIBRARY_INSTALL_DELEGATE)) { - return getDefaultLibraryInstallDelegate(); - } - - return super.getDefaultProperty(propertyName); - } - - protected JaxbPlatformDescription getDefaultPlatform() { - return JptJaxbCorePlugin.getDefaultPlatform(getProjectFacetVersion()); - } - - protected LibraryInstallDelegate getDefaultLibraryInstallDelegate() { - // delegate itself changes only when facet version changes - if (this.defaultLibraryInstallDelegate == null) { - this.defaultLibraryInstallDelegate = buildDefaultLibraryInstallDelegate(); - } - else if (! this.defaultLibraryInstallDelegate.getProjectFacetVersion().equals(getProjectFacetVersion())) { - this.defaultLibraryInstallDelegate.dispose(); - this.defaultLibraryInstallDelegate = buildDefaultLibraryInstallDelegate(); - } - return defaultLibraryInstallDelegate; - } - - protected LibraryInstallDelegate buildDefaultLibraryInstallDelegate() { - IFacetedProjectWorkingCopy fpjwc = getFacetedProjectWorkingCopy(); - IProjectFacetVersion pfv = getProjectFacetVersion(); - if (fpjwc == null || pfv == null) { - return null; - } - LibraryInstallDelegate lid = new LibraryInstallDelegate(fpjwc, pfv); - lid.addListener(buildLibraryInstallDelegateListener()); - return lid; - } - - protected IPropertyChangeListener buildLibraryInstallDelegateListener() { - return new IPropertyChangeListener() { - public void propertyChanged(String property, Object oldValue, Object newValue ) { - if (LibraryInstallDelegate.PROP_AVAILABLE_PROVIDERS.equals(property)) { - adjustLibraryInstallDelegate(); - } - getDataModel().notifyPropertyChange(LIBRARY_INSTALL_DELEGATE, IDataModel.VALUE_CHG); - } - }; - } - - protected void adjustLibraryInstallDelegate() { - LibraryInstallDelegate lid = this.getLibraryInstallDelegate(); - if (lid != null) { - List jaxbConfigs - = new ArrayList(); - // add the currently selected one first - JaxbLibraryProviderInstallOperationConfig currentJaxbConfig = null; - LibraryProviderOperationConfig config = lid.getLibraryProviderOperationConfig(); - if (config instanceof JaxbLibraryProviderInstallOperationConfig) { - currentJaxbConfig = (JaxbLibraryProviderInstallOperationConfig) config; - jaxbConfigs.add(currentJaxbConfig); - } - for (ILibraryProvider lp : lid.getLibraryProviders()) { - config = lid.getLibraryProviderOperationConfig(lp); - if (config instanceof JaxbLibraryProviderInstallOperationConfig - && ! config.equals(currentJaxbConfig)) { - jaxbConfigs.add((JaxbLibraryProviderInstallOperationConfig) config); - } - } - for (JaxbLibraryProviderInstallOperationConfig jaxbConfig : jaxbConfigs) { - jaxbConfig.setJaxbPlatform(getPlatform()); - } - } - } - - @Override - public boolean propertySet(String propertyName, Object propertyValue) { - boolean ok = super.propertySet(propertyName, propertyValue); - - if (propertyName.equals(FACETED_PROJECT_WORKING_COPY)) { - // should only be done once - IFacetedProjectWorkingCopy fproj = (IFacetedProjectWorkingCopy) propertyValue; - fproj.addListener(this.fprojListener, IFacetedProjectEvent.Type.PRIMARY_RUNTIME_CHANGED); - } - else if (propertyName.equals(FACET_VERSION)) { - adjustLibraryInstallDelegate(); - this.model.notifyPropertyChange(PLATFORM, IDataModel.DEFAULT_CHG); - this.model.notifyPropertyChange(LIBRARY_INSTALL_DELEGATE, IDataModel.DEFAULT_CHG); - } - else if (propertyName.equals(PLATFORM)) { - adjustLibraryInstallDelegate(); - } - - return ok; - } - - @Override - public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) { - if (propertyName.equals(PLATFORM)) { - return this.buildValidPlatformDescriptors(); - } - - return super.getValidPropertyDescriptors(propertyName); - } - - protected DataModelPropertyDescriptor[] buildValidPlatformDescriptors() { - Iterable validPlatformDescriptions = buildValidPlatformDescriptions(); - Iterable validPlatformDescriptors = - new TransformationIterable(validPlatformDescriptions) { - @Override - protected DataModelPropertyDescriptor transform(JaxbPlatformDescription description) { - return buildPlatformDescriptor(description); - } - }; - return ArrayTools.sort(ArrayTools.array(validPlatformDescriptors, EMPTY_DMPD_ARRAY), DMPD_COMPARATOR); - } - - protected Iterable buildValidPlatformDescriptions() { - return new FilteringIterable( - JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatforms()) { - @Override - protected boolean accept(JaxbPlatformDescription o) { - return o.supportsJaxbFacetVersion(getProjectFacetVersion()); - } - }; - } - - @Override - public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) { - if (propertyName.equals(PLATFORM)) { - return buildPlatformDescriptor(getPlatform()); - } - - return super.getPropertyDescriptor(propertyName); - } - - protected DataModelPropertyDescriptor buildPlatformDescriptor(JaxbPlatformDescription desc) { - return new DataModelPropertyDescriptor(desc, desc.getLabel()); - } - - // ********** validation ********** - - protected static IStatus OK_STATUS = Status.OK_STATUS; - - protected static IStatus buildErrorStatus(String message) { - return buildStatus(IStatus.ERROR, message); - } - - protected static IStatus buildStatus(int severity, String message) { - return new Status(severity, JptJaxbCorePlugin.PLUGIN_ID, message); - } - - @Override - public IStatus validate(String propertyName) { - if (propertyName.equals(PLATFORM)) { - return this.validatePlatform(); - } - else if (propertyName.equals(LIBRARY_INSTALL_DELEGATE)) { - return getLibraryInstallDelegate().validate(); - } - - return super.validate(propertyName); - } - - protected IStatus validatePlatform() { - return (getPlatform() == null) ? - buildErrorStatus(JptJaxbCoreMessages.JaxbFacetConfig_validatePlatformNotSpecified) - : OK_STATUS; - } - - protected IFacetedProjectWorkingCopy getFacetedProjectWorkingCopy() { - return (IFacetedProjectWorkingCopy) getProperty(FACETED_PROJECT_WORKING_COPY); - } - - protected IProjectFacetVersion getProjectFacetVersion() { - return (IProjectFacetVersion) getProperty(FACET_VERSION); - } - - protected JaxbPlatformDescription getPlatform() { - return (JaxbPlatformDescription) getProperty(PLATFORM); - } - - protected LibraryInstallDelegate getLibraryInstallDelegate() { - return (LibraryInstallDelegate) getProperty(LIBRARY_INSTALL_DELEGATE); - } - - @Override - public void dispose() { - super.dispose(); - getFacetedProjectWorkingCopy().removeListener(this.fprojListener); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDelegate.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDelegate.java deleted file mode 100644 index 2a5a516cb1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetDelegate.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - - -public abstract class JaxbFacetDelegate - implements IDelegate { - - public final void execute( - IProject project, IProjectFacetVersion fv, - Object config, IProgressMonitor monitor) throws CoreException { - - this.execute_(project, fv, config, monitor); - } - - protected void execute_( - IProject project, IProjectFacetVersion fv, - Object config, IProgressMonitor monitor) throws CoreException { - - SubMonitor subMonitor = SubMonitor.convert(monitor, 7); - - IDataModel jaxbConfig = (IDataModel) config; - - // project settings - JaxbPlatformDescription platform = - (JaxbPlatformDescription) jaxbConfig.getProperty(JaxbFacetDataModelProperties.PLATFORM); - JptJaxbCorePlugin.setJaxbPlatform(project, platform); - subMonitor.worked(1); - - // defaults settings - JptJaxbCorePlugin.setDefaultJaxbPlatform(fv, platform); - subMonitor.worked(1); - - //Delegate to LibraryInstallDelegate to configure the project classpath - LibraryInstallDelegate lid = - (LibraryInstallDelegate) jaxbConfig.getProperty(JaxbFacetDataModelProperties.LIBRARY_INSTALL_DELEGATE); - lid.execute(subMonitor.newChild(1)); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDataModelProperties.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDataModelProperties.java deleted file mode 100644 index a1c426ccf2..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDataModelProperties.java +++ /dev/null @@ -1,16 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.facet; - - -public interface JaxbFacetInstallDataModelProperties - extends JaxbFacetDataModelProperties { - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDataModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDataModelProvider.java deleted file mode 100644 index 40e26c3349..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDataModelProvider.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.facet; - - -public class JaxbFacetInstallDataModelProvider - extends JaxbFacetDataModelProvider - implements JaxbFacetInstallDataModelProperties { - - public JaxbFacetInstallDataModelProvider() { - super(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDelegate.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDelegate.java deleted file mode 100644 index 7724832546..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetInstallDelegate.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.validation.ValidationFramework; - - -public class JaxbFacetInstallDelegate - extends JaxbFacetDelegate { - - @Override - protected void execute_( - IProject project, IProjectFacetVersion fv, - Object config, IProgressMonitor monitor) throws CoreException { - - ValidationFramework.getDefault().addValidationBuilder(project); - super.execute_(project, fv, config, monitor); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetUninstallDelegate.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetUninstallDelegate.java deleted file mode 100644 index 53e1d9a43c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetUninstallDelegate.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - - -public class JaxbFacetUninstallDelegate - implements IDelegate { - - public void execute(IProject project, IProjectFacetVersion fv, - Object config, IProgressMonitor monitor) throws CoreException { - - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDataModelProperties.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDataModelProperties.java deleted file mode 100644 index d9c5b2a932..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDataModelProperties.java +++ /dev/null @@ -1,16 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.facet; - - -public interface JaxbFacetVersionChangeDataModelProperties - extends JaxbFacetDataModelProperties { - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDataModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDataModelProvider.java deleted file mode 100644 index d5772b50e8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDataModelProvider.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.facet; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jaxb.core.internal.JptJaxbCoreMessages; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; - -public class JaxbFacetVersionChangeDataModelProvider - extends JaxbFacetDataModelProvider - implements JaxbFacetVersionChangeDataModelProperties { - - public JaxbFacetVersionChangeDataModelProvider() { - super(); - } - - - @Override - protected Iterable buildValidPlatformDescriptions() { - // add existing platform to list of choices - Iterable validPlatformDescs = super.buildValidPlatformDescriptions(); - if (! CollectionTools.contains(validPlatformDescs, getPlatform())) { - validPlatformDescs = new CompositeIterable(getPlatform(), validPlatformDescs); - } - return validPlatformDescs; - } - - @Override - protected IStatus validatePlatform() { - IStatus status = super.validatePlatform(); - - if (status.isOK()) { - if (! getPlatform().supportsJaxbFacetVersion(getProjectFacetVersion())) { - status = buildErrorStatus(JptJaxbCoreMessages.JaxbFacetConfig_validatePlatformDoesNotSupportFacetVersion); - } - } - - return status; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDelegate.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDelegate.java deleted file mode 100644 index 2c7a4bc95f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/facet/JaxbFacetVersionChangeDelegate.java +++ /dev/null @@ -1,26 +0,0 @@ -package org.eclipse.jpt.jaxb.core.internal.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - - -public class JaxbFacetVersionChangeDelegate - extends JaxbFacetDelegate { - - @Override - protected void execute_( - IProject project, IProjectFacetVersion fv, Object config, - IProgressMonitor monitor) throws CoreException { - - SubMonitor sm = SubMonitor.convert(monitor, 2); - super.execute_(project, fv, config, sm.newChild(1)); - - JptJaxbCorePlugin.getProjectManager().rebuildJaxbProject(project); - sm.worked(1); - // nothing further to do here *just* yet - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGenerator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGenerator.java deleted file mode 100644 index 619274ea66..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGenerator.java +++ /dev/null @@ -1,264 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.gen; - -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jdt.core.IClasspathContainer; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; -import org.eclipse.jdt.launching.IRuntimeClasspathEntry; -import org.eclipse.jdt.launching.JavaRuntime; -import org.eclipse.jpt.common.core.internal.gen.AbstractJptGenerator; -import org.eclipse.jpt.common.utility.internal.StringTools; - -/** - * ClassesGenerator - */ -public class ClassesGenerator extends AbstractJptGenerator -{ - public static final String LAUNCH_CONFIG_NAME = "JAXB Run Config"; //$NON-NLS-1$ - public static final String JAXB_GENERIC_GEN_CLASS = "com.sun.tools.xjc.XJCFacade"; //$NON-NLS-1$ - public static final String JAXB_ECLIPSELINK_GEN_CLASS = "org.eclipse.persistence.jaxb.xjc.MOXyXJC"; //$NON-NLS-1$ - - private final String schemaPathOrUri; - private final String outputDir; - private final String targetPackage; - private final String catalog; - private final String[] bindingsFileNames; - private final ClassesGeneratorOptions generatorOptions; - private final ClassesGeneratorExtensionOptions generatorExtensionOptions; - private final String mainType; - - // ********** static methods ********** - - public static void generate( - IJavaProject javaProject, - String schemaPathOrUri, - String outputDir, - String targetPackage, - String catalog, - boolean usesMoxyGenerator, - String[] bindingsFileNames, - ClassesGeneratorOptions generatorOptions, - ClassesGeneratorExtensionOptions generatorExtensionOptions, - IProgressMonitor monitor) { - if (javaProject == null) { - throw new NullPointerException(); - } - new ClassesGenerator(javaProject, - schemaPathOrUri, - outputDir, - targetPackage, - catalog, - usesMoxyGenerator, - bindingsFileNames, - generatorOptions, - generatorExtensionOptions).generate(monitor); - } - - // ********** constructors ********** - - protected ClassesGenerator( - IJavaProject javaProject, - String schemaPathOrUri, - String outputDir, - String targetPackage, - String catalog, - boolean usesMoxyGenerator, - String[] bindingsFileNames, - ClassesGeneratorOptions generatorOptions, - ClassesGeneratorExtensionOptions generatorExtensionOptions) { - super(javaProject); - this.schemaPathOrUri = schemaPathOrUri; - this.outputDir = outputDir; - this.targetPackage = targetPackage; - this.catalog = catalog; - this.bindingsFileNames = bindingsFileNames; - this.generatorOptions = generatorOptions; - this.generatorExtensionOptions = generatorExtensionOptions; - this.mainType = (usesMoxyGenerator) ? JAXB_ECLIPSELINK_GEN_CLASS : JAXB_GENERIC_GEN_CLASS; - } - - // ********** overrides ********** - - @Override - protected String getMainType() { - return this.mainType; - } - - @Override - protected String getLaunchConfigName() { - return LAUNCH_CONFIG_NAME; - } - - // ********** behavior ********** - - @Override - protected void preGenerate(IProgressMonitor monitor) { - //nothing to do yet... - } - - @Override - protected void postGenerate() { - super.postGenerate(); - try { - this.javaProject.getProject().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); - } - catch (CoreException e) { - throw new RuntimeException(e); - } - } - - // ********** Launch Configuration Setup ********** - - @Override - protected List buildClasspath() throws CoreException { - List classpath = new ArrayList(); - // Default Project classpath - classpath.add(this.getDefaultProjectClasspathEntry().getMemento()); - // System Library - classpath.add(this.getSystemLibraryClasspathEntry().getMemento()); - // Containers classpath - for(IRuntimeClasspathEntry containerClasspathEntry: this.getContainersClasspathEntries()) { - classpath.add(containerClasspathEntry.getMemento()); - } - return classpath; - } - - @Override - protected void specifyProgramArguments() { - StringBuffer programArguments = new StringBuffer(); - - programArguments.append("-d "); //$NON-NLS-1$ - if(StringTools.stringIsEmpty(this.outputDir)) { - throw new RuntimeException("Output directory cannot be empty"); //$NON-NLS-1$ - } - programArguments.append(StringTools.quote(this.outputDir)); - if( ! StringTools.stringIsEmpty(this.targetPackage)) { - programArguments.append(" -p "); //$NON-NLS-1$ - programArguments.append(this.targetPackage); - } - if( ! StringTools.stringIsEmpty(this.catalog)) { - programArguments.append(" -catalog "); //$NON-NLS-1$ - programArguments.append(StringTools.quote(this.catalog)); - } - - // Options - if( ! StringTools.stringIsEmpty(this.generatorOptions.getProxy())) { - programArguments.append(" -httpproxy "); //$NON-NLS-1$ - programArguments.append(this.generatorOptions.getProxy()); - } - if( ! StringTools.stringIsEmpty(this.generatorOptions.getProxyFile())) { - programArguments.append(" -httpproxyfile "); //$NON-NLS-1$ - programArguments.append(StringTools.quote(this.generatorOptions.getProxyFile())); - } - - if( ! this.generatorOptions.usesStrictValidation()) { - programArguments.append(" -nv"); //$NON-NLS-1$ - } - if(this.generatorOptions.makesReadOnly()) { - programArguments.append(" -readOnly"); //$NON-NLS-1$ - } - if(this.generatorOptions.suppressesPackageInfoGen()) { - programArguments.append(" -npa"); //$NON-NLS-1$ - } - if(this.generatorOptions.suppressesHeaderGen()) { - programArguments.append(" -no-header"); //$NON-NLS-1$ - } - if(this.generatorOptions.targetIs20()) { - programArguments.append(" -target 2.0"); //$NON-NLS-1$ - } - if(this.generatorOptions.isVerbose()) { - programArguments.append(" -verbose"); //$NON-NLS-1$ - } - if(this.generatorOptions.isQuiet()) { - programArguments.append(" -quiet"); //$NON-NLS-1$ - } - - if(this.generatorOptions.treatsAsXmlSchema()) { - programArguments.append(" -xmlschema"); //$NON-NLS-1$ - } - if(this.generatorOptions.treatsAsRelaxNg()) { - programArguments.append(" -relaxng"); //$NON-NLS-1$ - } - if(this.generatorOptions.treatsAsRelaxNgCompact()) { - programArguments.append(" -relaxng-compact"); //$NON-NLS-1$ - } - if(this.generatorOptions.treatsAsDtd()) { - programArguments.append(" -dtd"); //$NON-NLS-1$ - } - if(this.generatorOptions.treatsAsWsdl()) { - programArguments.append(" -wsdl"); //$NON-NLS-1$ - } - if(this.generatorOptions.showsVersion()) { - programArguments.append(" -version"); //$NON-NLS-1$ - } - if(this.generatorOptions.showsHelp()) { - programArguments.append(" -help"); //$NON-NLS-1$ - } - - // Extension Options - if(this.generatorExtensionOptions.allowsExtensions()) { - programArguments.append(" -extension"); //$NON-NLS-1$ - } - if( ! StringTools.stringIsEmpty(this.generatorExtensionOptions.getClasspath())) { - programArguments.append(" -classpath "); //$NON-NLS-1$ - programArguments.append(StringTools.quote(this.generatorExtensionOptions.getClasspath())); - } - if( ! StringTools.stringIsEmpty(this.generatorExtensionOptions.getAdditionalArgs())) { - programArguments.append(' '); - programArguments.append(this.generatorExtensionOptions.getAdditionalArgs()); - } - - // schema - programArguments.append(' '); - if(StringTools.stringIsEmpty(this.schemaPathOrUri)) { - throw new RuntimeException("Schema cannot be empty"); //$NON-NLS-1$ - } - programArguments.append(StringTools.quote(this.schemaPathOrUri)); - - // bindings - if (this.bindingsFileNames.length > 0) { - for (String bindingsFileName : this.bindingsFileNames) { - programArguments.append(" -b "); //$NON-NLS-1$ - programArguments.append(StringTools.quote(bindingsFileName)); - } - } - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, programArguments.toString()); - } - - - // ********** Queries ********** - - private List getContainersClasspathEntries() throws CoreException { - ArrayList classpathEntries = new ArrayList(); - for(IClasspathEntry classpathEntry: this.javaProject.getRawClasspath()) { - if(classpathEntry.getEntryKind() == IClasspathEntry.CPE_CONTAINER) { - IClasspathContainer container = JavaCore.getClasspathContainer(classpathEntry.getPath(), this.javaProject); - if(container != null && container.getKind() == IClasspathContainer.K_SYSTEM) { - classpathEntries.add( - JavaRuntime.newRuntimeContainerClasspathEntry( - container.getPath(), - IRuntimeClasspathEntry.BOOTSTRAP_CLASSES, - this.javaProject)); - } - } - } - return classpathEntries; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGeneratorExtensionOptions.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGeneratorExtensionOptions.java deleted file mode 100644 index 476945fbe6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGeneratorExtensionOptions.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.gen; - -/** - * ClassesGeneratorExtensionOptions - */ -public class ClassesGeneratorExtensionOptions -{ - private String classpath; - private boolean allowsExtensions; - - private String additionalArgs; - - // ********** constructor ********** - - public ClassesGeneratorExtensionOptions() { - super(); - } - - // ********** getters/setters ********* - - public boolean allowsExtensions() { - return this.allowsExtensions; - } - - public void setAllowsExtensions(boolean allowsExtensions) { - this.allowsExtensions = allowsExtensions; - } - - public String getClasspath() { - return this.classpath; - } - - public void setClasspath(String classpath){ - this.classpath = classpath; - } - - public String getAdditionalArgs() { - return this.additionalArgs; - } - - public void setAdditionalArgs(String additionalArgs){ - this.additionalArgs = additionalArgs; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGeneratorOptions.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGeneratorOptions.java deleted file mode 100644 index fd361d7054..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/ClassesGeneratorOptions.java +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.gen; - - -/** - * ClassesGeneratorOptions - */ -public class ClassesGeneratorOptions -{ - private String proxy; - private String proxyFile; - - private boolean usesStrictValidation; - private boolean makesReadOnly; - private boolean suppressesPackageInfoGen; - private boolean suppressesHeaderGen; - private boolean targetIs20; - private boolean isVerbose; - private boolean isQuiet; - - private boolean treatsAsXmlSchema; - private boolean treatsAsRelaxNg; - private boolean treatsAsRelaxNgCompact; - private boolean treatsAsDtd; - private boolean treatsAsWsdl; - private boolean showsVersion; - private boolean showsHelp; - - // ********** constructor ********** - - public ClassesGeneratorOptions() { - super(); - } - - // ********** getters/setters ********* - - public String getProxy() { - return this.proxy; - } - - public void setProxy(String proxy){ - this.proxy = proxy; - } - - public String getProxyFile() { - return this.proxyFile; - } - - public void setProxyFile(String proxyFile){ - this.proxyFile = proxyFile; - } - - public boolean suppressesPackageInfoGen() { - return this.suppressesPackageInfoGen; - } - - public void setSuppressesPackageInfoGen(boolean suppressesPackageInfoGen) { - this.suppressesPackageInfoGen = suppressesPackageInfoGen; - } - - public boolean usesStrictValidation() { - return this.usesStrictValidation; - } - - public void setUsesStrictValidation(boolean usesStrictValidation) { - this.usesStrictValidation = usesStrictValidation; - } - - public boolean makesReadOnly() { - return this.makesReadOnly; - } - - public void setMakesReadOnly(boolean makesReadOnly) { - this.makesReadOnly = makesReadOnly; - } - - public boolean suppressesHeaderGen() { - return this.suppressesHeaderGen; - } - - public void setSuppressesHeaderGen(boolean suppressesHeaderGen){ - this.suppressesHeaderGen = suppressesHeaderGen; - } - - public boolean targetIs20() { - return this.targetIs20; - } - - public void setTargetIs20(boolean targetIs20){ - this.targetIs20 = targetIs20; - } - - public boolean isVerbose() { - return this.isVerbose; - } - - public void setIsVerbose(boolean isVerbose){ - this.isVerbose = isVerbose; - } - - public boolean isQuiet() { - return this.isQuiet; - } - - public void setIsQuiet(boolean isQuiet){ - this.isQuiet = isQuiet; - } - - public boolean treatsAsXmlSchema() { - return this.treatsAsXmlSchema; - } - - public void setTreatsAsXmlSchema(boolean treatsAsXmlSchema){ - this.treatsAsXmlSchema = treatsAsXmlSchema; - } - - public boolean treatsAsRelaxNg() { - return this.treatsAsRelaxNg; - } - - public void setTreatsAsRelaxNg(boolean treatsAsRelaxNg){ - this.treatsAsRelaxNg = treatsAsRelaxNg; - } - - public boolean treatsAsRelaxNgCompact() { - return this.treatsAsRelaxNgCompact; - } - - public void setTreatsAsRelaxNgCompact(boolean treatsAsRelaxNgCompact){ - this.treatsAsRelaxNgCompact = treatsAsRelaxNgCompact; - } - - public boolean treatsAsDtd() { - return this.treatsAsDtd; - } - - public void setTreatsAsDtd(boolean treatsAsDtd){ - this.treatsAsDtd = treatsAsDtd; - } - - public boolean treatsAsWsdl() { - return this.treatsAsWsdl; - } - - public void setTreatsAsWsdl(boolean treatsAsWsdl){ - this.treatsAsWsdl = treatsAsWsdl; - } - - public boolean showsVersion() { - return this.showsVersion; - } - - public void setShowsVersion(boolean showsVersion){ - this.showsVersion = showsVersion; - } - - public boolean showsHelp() { - return this.showsHelp; - } - - public void setShowsHelp(boolean showsHelp){ - this.showsHelp = showsHelp; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/GenerateJaxbClassesJob.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/GenerateJaxbClassesJob.java deleted file mode 100644 index 9027ff2c83..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/GenerateJaxbClassesJob.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.gen; - -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.core.runtime.SubMonitor; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.core.internal.JptJaxbCoreMessages; - -/** - * GenerateJaxbClassesJob - */ -public class GenerateJaxbClassesJob extends WorkspaceJob { - private final IJavaProject javaProject; - private final String schemaPathOrUri; - private final String outputDir; - private final String targetPackage; - private final String catalog; - private final boolean usesMoxyGenerator; - private final String[] bindingsFileNames; - private final ClassesGeneratorOptions generatorOptions; - private final ClassesGeneratorExtensionOptions generatorExtensionOptions; - - // ********** constructors ********** - - public GenerateJaxbClassesJob( - IJavaProject javaProject, - String schemaPathOrUri, - String outputDir, - String targetPackage, - String catalog, - boolean usesMoxyGenerator, - String[] bindingsFileNames, - ClassesGeneratorOptions generatorOptions, - ClassesGeneratorExtensionOptions generatorExtensionOptions) { - - super(JptJaxbCoreMessages.ClassesGenerator_generatingClasses); - if(javaProject == null) { - throw new RuntimeException("Project is null"); //$NON-NLS-1$ - } - else if(StringTools.stringIsEmpty(schemaPathOrUri)) { - throw new RuntimeException("Schema cannot be empty"); //$NON-NLS-1$ - } - else if(StringTools.stringIsEmpty(outputDir)) { - throw new RuntimeException("Output directory cannot be empty"); //$NON-NLS-1$ - } - this.javaProject = javaProject; - this.schemaPathOrUri = schemaPathOrUri; - this.outputDir = outputDir; - this.targetPackage = targetPackage; - this.catalog = catalog; - this.usesMoxyGenerator = usesMoxyGenerator; - this.bindingsFileNames = bindingsFileNames; - this.generatorOptions = generatorOptions; - this.generatorExtensionOptions = generatorExtensionOptions; - this.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(this.javaProject.getProject())); - } - - @Override - public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { - SubMonitor sm = SubMonitor.convert(monitor, JptJaxbCoreMessages.ClassesGenerator_generatingClassesTask, 1); - try { - this.classesGeneratorGenerate(this.javaProject, - this.schemaPathOrUri, - this.outputDir, - this.targetPackage, - this.catalog, - this.usesMoxyGenerator, - this.bindingsFileNames, - this.generatorOptions, - this.generatorExtensionOptions, - sm.newChild(1)); - } - catch (OperationCanceledException e) { - return Status.CANCEL_STATUS; - // fall through and tell monitor we are done - } - catch (RuntimeException re) { - throw new RuntimeException(re); - } - return Status.OK_STATUS; -} - - private void classesGeneratorGenerate(IJavaProject javaProject, - String schemaPathOrUri, - String outputDir, - String targetPackage, - String catalog, - boolean usesMoxyGenerator, - String[] bindingsFileNames, - ClassesGeneratorOptions generatorOptions, - ClassesGeneratorExtensionOptions generatorExtensionOptions, - IProgressMonitor monitor) { - - ClassesGenerator.generate(javaProject, - schemaPathOrUri, - outputDir, - targetPackage, - catalog, - usesMoxyGenerator, - bindingsFileNames, - generatorOptions, - generatorExtensionOptions, - monitor); - return; - } -} \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/SchemaGenerator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/SchemaGenerator.java deleted file mode 100644 index 5360e81f83..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/gen/SchemaGenerator.java +++ /dev/null @@ -1,287 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.gen; - -import java.io.BufferedReader; -import java.io.ByteArrayInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.io.InputStreamReader; -import java.io.UnsupportedEncodingException; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.launching.IJavaLaunchConfigurationConstants; -import org.eclipse.jpt.common.core.internal.gen.AbstractJptGenerator; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTTools; -import org.eclipse.jpt.jaxb.core.internal.JptJaxbCoreMessages; - -/** - * SchemaGenerator - */ -public class SchemaGenerator extends AbstractJptGenerator -{ - static public String LAUNCH_CONFIG_NAME = "JAXB Schema Gen Run Config"; //$NON-NLS-1$ - static public String JAXB_SCHEMA_GEN_PACKAGE_NAME = "org.eclipse.jpt.jaxb.core.schemagen"; //$NON-NLS-1$ - static public String JAXB_SCHEMA_GEN_CLASS = JAXB_SCHEMA_GEN_PACKAGE_NAME + ".Main"; //$NON-NLS-1$ - static public String ECLIPSELINK_JAXB_SCHEMA_GEN_PACKAGE_NAME = "org.eclipse.jpt.jaxb.eclipselink.core.schemagen"; //$NON-NLS-1$ - static public String ECLIPSELINK_JAXB_SCHEMA_GEN_CLASS = ECLIPSELINK_JAXB_SCHEMA_GEN_PACKAGE_NAME + ".Main"; //$NON-NLS-1$ - - static public String ECLIPSELINK_JAXB_CONTEXT_FACTORY = "org.eclipse.persistence.jaxb.JAXBContextFactory"; //$NON-NLS-1$ - static public String ECLIPSELINK_JAXB_PROPERTIES_FILE_CONTENTS = "javax.xml.bind.context.factory=" + ECLIPSELINK_JAXB_CONTEXT_FACTORY; //$NON-NLS-1$ - static public String JAXB_PROPERTIES_FILE_NAME = "jaxb.properties"; //$NON-NLS-1$ - - static public String JAXB_SCHEMA_GEN_JAR_PREFIX = JAXB_SCHEMA_GEN_PACKAGE_NAME + "_"; //$NON-NLS-1$ - static public String ECLIPSELINK_JAXB_SCHEMA_GEN_JAR_PREFIX = ECLIPSELINK_JAXB_SCHEMA_GEN_PACKAGE_NAME + "_"; //$NON-NLS-1$ - - static public String JAXB_GENERIC_SCHEMA_GEN_CLASS = "javax.xml.bind.JAXBContext"; //$NON-NLS-1$ - static public String JAXB_ECLIPSELINK_SCHEMA_GEN_CLASS = "org.eclipse.persistence.jaxb.JAXBContext"; //$NON-NLS-1$ - - private final String targetSchemaName; - private final String[] sourceClassNames; - private String mainType; - private boolean useMoxy; - - // ********** static methods ********** - - public static void generate( - IJavaProject javaProject, - String targetSchemaName, - String[] sourceClassNames, - boolean useMoxy, - IProgressMonitor monitor) { - if (javaProject == null) { - throw new NullPointerException(); - } - new SchemaGenerator(javaProject, - targetSchemaName, - sourceClassNames, - useMoxy).generate(monitor); - } - - // ********** constructors ********** - - protected SchemaGenerator( - IJavaProject javaProject, - String targetSchemaName, - String[] sourceClassNames, - boolean useMoxy) { - super(javaProject); - this.targetSchemaName = targetSchemaName; - this.sourceClassNames = sourceClassNames; - this.useMoxy = useMoxy; - this.mainType = (this.useMoxy) ? - ECLIPSELINK_JAXB_SCHEMA_GEN_CLASS : - JAXB_SCHEMA_GEN_CLASS; - this.initialize(); - } - - // ********** overrides ********** - - @Override - protected String getMainType() { - return this.mainType; - } - - @Override - protected String getLaunchConfigName() { - return LAUNCH_CONFIG_NAME; - } - - @Override - protected String getBootstrapJarPrefix() { - return (this.useMoxy) ? - ECLIPSELINK_JAXB_SCHEMA_GEN_JAR_PREFIX : - JAXB_SCHEMA_GEN_JAR_PREFIX; - } - - @Override - protected void preGenerate(IProgressMonitor monitor) { - // generate jaxb.properties file if necessary - if (this.useMoxy){ - if (!isJaxbPropertiesFilePresent()){ - this.generateJaxbPropertiesFile(monitor); - } - else if (!isJaxbContextMoxy()){ - //properties file actually specifies a different implementation - //override wizard setting and fall back to generic generation - this.useMoxy = false; - this.mainType = JAXB_SCHEMA_GEN_CLASS; - } - } - } - - @Override - protected void postGenerate() { - super.postGenerate(); - try { - this.getProject().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor()); - } - catch (CoreException e) { - throw new RuntimeException(e); - } - } - - // ********** Launch Configuration Setup ********** - - @Override - protected List buildClasspath() throws CoreException { - List classpath = new ArrayList(); - // Schema_Gen jar - classpath.add(this.getBootstrapJarClasspathEntry().getMemento()); - // Default Project classpath - classpath.add(this.getDefaultProjectClasspathEntry().getMemento()); - // System Library - classpath.add(this.getSystemLibraryClasspathEntry().getMemento()); - return classpath; - } - - @Override - protected void specifyProgramArguments() { - - StringBuffer programArguments = new StringBuffer(); - // sourceClassNames - this.appendClassNameArguments(programArguments); - - // schema - programArguments.append(" -s \""); //$NON-NLS-1$ - programArguments.append(this.targetSchemaName); - programArguments.append('"'); - - this.launchConfig.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROGRAM_ARGUMENTS, programArguments.toString()); - } - - // ********** private methods ********** - - private void appendClassNameArguments(StringBuffer sb) { - for (String className : this.sourceClassNames) { - sb.append(" -c "); //$NON-NLS-1$ - sb.append(className); - } - } - - /** - * Returns the first "jaxb.properties" file that is found in a valid source - * folder in the project. - * - * Returns null if no "jaxb.properties" file is found. - */ - private IFile getJaxbPropertiesFile() { - return getJaxbPropertiesFileFromPackageRoots(JDTTools.getJavaSourceFolders(this.javaProject)); - } - - private IFile getJaxbPropertiesFileFromPackageRoots(Iterable packageFragmentRoots){ - Object[] objects = null; - IJavaElement[] javaElements; - try { - for (IPackageFragmentRoot pfr : packageFragmentRoots) { - javaElements = pfr.getChildren(); - for (IJavaElement javaElement : javaElements) { - objects = ((IPackageFragment) javaElement).getNonJavaResources(); - for (Object object : objects) { - IResource resource = (IResource) object; - if (resource.getName().equals(JAXB_PROPERTIES_FILE_NAME)) { - // jaxb.properties has been found - return (IFile)resource; - } - } - } - } - } catch (JavaModelException jme) { - throw new RuntimeException(jme); - } - return null; - } - - private boolean isJaxbPropertiesFilePresent(){ - return getJaxbPropertiesFile()!= null; - } - - private boolean isJaxbContextMoxy(){ - - InputStream in = null; - try { - in = getJaxbPropertiesFile().getContents(); - BufferedReader reader = new BufferedReader(new InputStreamReader(in)); - String line = reader.readLine(); - //jaxb.properties will only contain one property entry, the JAXBContextFactory - String propertyValue = line.substring(line.indexOf("=") + 1); //$NON-NLS-1$ - if (propertyValue.equals(ECLIPSELINK_JAXB_CONTEXT_FACTORY)){ - return true; - } - } catch (CoreException ce){ - throw new RuntimeException(ce); - } catch (IOException ioe){ - throw new RuntimeException(ioe); - } finally { - if (in != null){ - try{ - in.close(); - } catch (IOException ioe) { - throw new RuntimeException(ioe); - } - } - } - return false; - } - - private void generateJaxbPropertiesFile(IProgressMonitor monitor) { - SubMonitor sm = SubMonitor.convert(monitor, 1); - sm.subTask(JptJaxbCoreMessages.SchemaGenerator_creatingJAXBPropertiesFileTask); - - IPackageFragment packageFragment = findPackageFragementForSourceClassName(this.sourceClassNames[0]); - - IFolder folder = (IFolder)packageFragment.getResource(); - IFile file = folder.getFile(JAXB_PROPERTIES_FILE_NAME); - - byte[] bytes; - try { - bytes = ECLIPSELINK_JAXB_PROPERTIES_FILE_CONTENTS.getBytes("UTF-8"); //$NON-NLS-1$ - } catch (UnsupportedEncodingException e) { - throw new RuntimeException(e); - } - - InputStream contents = new ByteArrayInputStream(bytes); - - try { - //the input stream will be closed as a result of calling create - file.create(contents, IResource.NONE, sm.newChild(1)); - } catch (CoreException ce) { - throw new RuntimeException(ce); - } - } - - private IPackageFragment findPackageFragementForSourceClassName(String sourceClassName) { - String packageName = sourceClassName.substring(0, sourceClassName.lastIndexOf('.')); - - //Find the existing package fragment where we want to generate - for (IPackageFragmentRoot pfr : JDTTools.getJavaSourceFolders(this.javaProject)) { - //use the package of the first source class as the package for generation - IPackageFragment packageFragment = pfr.getPackageFragment(packageName); - if (packageFragment.exists()){ - return packageFragment; - } - } - //the existing package fragment was not found - throw new IllegalStateException("Java package must exist for source class"); //$NON-NLS-1$ - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_Factory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_Factory.java deleted file mode 100644 index b7594bd39c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_Factory.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.jaxb21; - -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.internal.AbstractJaxbFactory; - -/** - * Generic JAXB version 2.1 - */ -public class GenericJaxb_2_1_Factory - extends AbstractJaxbFactory { - - // singleton - private static final JaxbFactory INSTANCE = new GenericJaxb_2_1_Factory(); - - /** - * Return the singleton. - */ - public static JaxbFactory instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private GenericJaxb_2_1_Factory() { - super(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_PlatformDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_PlatformDefinition.java deleted file mode 100644 index 0a493a9304..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_PlatformDefinition.java +++ /dev/null @@ -1,178 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.jaxb21; - -import java.util.ArrayList; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jaxb.core.GenericJaxbPlatform; -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.JaxbResourceModelProvider; -import org.eclipse.jpt.jaxb.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.internal.AbstractJaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.internal.JavaPackageInfoResourceModelProvider; -import org.eclipse.jpt.jaxb.core.internal.JavaResourceModelProvider; -import org.eclipse.jpt.jaxb.core.internal.context.java.JavaXmlAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.internal.context.java.JavaXmlElementMappingDefinition; -import org.eclipse.jpt.jaxb.core.internal.context.java.JavaXmlTransientMappingDefinition; -import org.eclipse.jpt.jaxb.core.internal.context.java.JavaXmlValueMappingDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlAccessorOrderAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlAccessorTypeAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlAnyAttributeAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlAnyElementAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlAttachmentRefAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlAttributeAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlElementAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlElementDeclAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlElementRefAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlElementWrapperAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlElementsAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlEnumAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlEnumValueAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlIDAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlIDREFAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlInlineBinaryDataAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlJavaTypeAdapterAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlListAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlMimeTypeAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlMixedAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlRegistryAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlRootElementAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlSchemaAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlSchemaTypeAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlSeeAlsoAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlTransientAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlTypeAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.internal.resource.java.XmlValueAnnotationDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotationDefinition; - -public class GenericJaxb_2_1_PlatformDefinition - extends AbstractJaxbPlatformDefinition -{ - // singleton - private static final JaxbPlatformDefinition INSTANCE = new GenericJaxb_2_1_PlatformDefinition(); - - /** - * Return the singleton. - */ - public static JaxbPlatformDefinition instance() { - return INSTANCE; - } - - protected GenericJaxb_2_1_PlatformDefinition() { - super(); - } - - - public JaxbPlatformDescription getDescription() { - return GenericJaxbPlatform.VERSION_2_1; - } - - public JaxbFactory getFactory() { - return GenericJaxb_2_1_Factory.instance(); - } - - @Override - protected AnnotationDefinition[] buildAnnotationDefinitions() { - return new AnnotationDefinition[] { - XmlAccessorOrderAnnotationDefinition.instance(), - XmlAccessorTypeAnnotationDefinition.instance(), - XmlAnyAttributeAnnotationDefinition.instance(), - XmlAnyElementAnnotationDefinition.instance(), - XmlAttachmentRefAnnotationDefinition.instance(), - XmlAttributeAnnotationDefinition.instance(), - XmlElementAnnotationDefinition.instance(), - XmlElementDeclAnnotationDefinition.instance(), - XmlElementsAnnotationDefinition.instance(), - XmlElementWrapperAnnotationDefinition.instance(), - XmlEnumAnnotationDefinition.instance(), - XmlEnumValueAnnotationDefinition.instance(), - XmlIDAnnotationDefinition.instance(), - XmlIDREFAnnotationDefinition.instance(), - XmlInlineBinaryDataAnnotationDefinition.instance(), - XmlListAnnotationDefinition.instance(), - XmlMimeTypeAnnotationDefinition.instance(), - XmlMixedAnnotationDefinition.instance(), - XmlRegistryAnnotationDefinition.instance(), - XmlRootElementAnnotationDefinition.instance(), - XmlSchemaAnnotationDefinition.instance(), - XmlSeeAlsoAnnotationDefinition.instance(), - XmlTransientAnnotationDefinition.instance(), - XmlTypeAnnotationDefinition.instance(), - XmlValueAnnotationDefinition.instance()}; - } - - @Override - protected NestableAnnotationDefinition[] buildNestableAnnotationDefinitions() { - return new NestableAnnotationDefinition[] { - XmlElementRefAnnotationDefinition.instance(), - XmlJavaTypeAdapterAnnotationDefinition.instance(), - XmlSchemaTypeAnnotationDefinition.instance() - }; - } - - // ********** resource models ********** - - public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) { - if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) { - return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE; - } - else if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE)) { - return JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_RESOURCE_TYPE; - } -// else if (contentType.equals(JptCorePlugin.JAR_CONTENT_TYPE)) { -// return JptCorePlugin.JAR_RESOURCE_TYPE; -// } -// else if (contentType.equals(JptCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) { -// return JptCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE; -// } -// else if (contentType.equals(JptCorePlugin.ORM_XML_CONTENT_TYPE)) { -// return JptCorePlugin.ORM_XML_1_0_RESOURCE_TYPE; -// } - throw new IllegalArgumentException(contentType.toString()); - } - - @Override - protected JaxbResourceModelProvider[] buildResourceModelProviders() { - // order should not be important here - return new JaxbResourceModelProvider[] { - JavaResourceModelProvider.instance(), - JavaPackageInfoResourceModelProvider.instance()}; - } - - // ********** Java attribute mappings ********** - - @Override - protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList definitions) { - definitions.add(JavaXmlAttributeMappingDefinition.instance()); - definitions.add(JavaXmlElementMappingDefinition.instance()); - definitions.add(JavaXmlTransientMappingDefinition.instance()); - definitions.add(JavaXmlValueMappingDefinition.instance()); - } - - @Override - protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList definitions) { - definitions.add(JavaXmlElementMappingDefinition.instance()); - } - -// // ********** Mapping Files ********** -// -// @Override -// protected ResourceDefinition[] buildResourceDefinitions() { -// return new ResourceDefinition[] { -// GenericPersistenceXmlDefinition.instance(), -// GenericOrmXmlDefinition.instance()}; -// } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_PlatformDefinitionFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_PlatformDefinitionFactory.java deleted file mode 100644 index a8a235bdc8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb21/GenericJaxb_2_1_PlatformDefinitionFactory.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.jaxb21; - -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinitionFactory; - - -public class GenericJaxb_2_1_PlatformDefinitionFactory - implements JaxbPlatformDefinitionFactory { - - public JaxbPlatformDefinition buildJaxbPlatformDefinition() { - return GenericJaxb_2_1_PlatformDefinition.instance(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb22/GenericJaxb_2_2_PlatformDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb22/GenericJaxb_2_2_PlatformDefinition.java deleted file mode 100644 index b7683bc4ea..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb22/GenericJaxb_2_2_PlatformDefinition.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.jaxb22; - -import org.eclipse.jpt.jaxb.core.GenericJaxbPlatform; -import org.eclipse.jpt.jaxb.core.internal.jaxb21.GenericJaxb_2_1_PlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; - - -public class GenericJaxb_2_2_PlatformDefinition - extends GenericJaxb_2_1_PlatformDefinition { - - // singleton - private static final JaxbPlatformDefinition INSTANCE = new GenericJaxb_2_2_PlatformDefinition(); - - /** - * Return the singleton. - */ - public static JaxbPlatformDefinition instance() { - return INSTANCE; - } - - protected GenericJaxb_2_2_PlatformDefinition() { - super(); - } - - - @Override - public JaxbPlatformDescription getDescription() { - return GenericJaxbPlatform.VERSION_2_2; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb22/GenericJaxb_2_2_PlatformDefinitionFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb22/GenericJaxb_2_2_PlatformDefinitionFactory.java deleted file mode 100644 index 14944e74e7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/jaxb22/GenericJaxb_2_2_PlatformDefinitionFactory.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.jaxb22; - -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinitionFactory; - - -public class GenericJaxb_2_2_PlatformDefinitionFactory - implements JaxbPlatformDefinitionFactory { - - public JaxbPlatformDefinition buildJaxbPlatformDefinition() { - return GenericJaxb_2_2_PlatformDefinition.instance(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbJreLibraryProviderInstallOperationConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbJreLibraryProviderInstallOperationConfig.java deleted file mode 100644 index 87d08f80ca..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbJreLibraryProviderInstallOperationConfig.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.libprov; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.libval.LibraryValidator; -import org.eclipse.jpt.jaxb.core.libprov.JaxbLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderInstallOperationConfig; - - -public class JaxbJreLibraryProviderInstallOperationConfig - extends LibraryProviderInstallOperationConfig - implements JaxbLibraryProviderInstallOperationConfig { - - private JaxbPlatformDescription jaxbPlatform; - - - public JaxbJreLibraryProviderInstallOperationConfig() { - super(); - } - - - public JaxbPlatformDescription getJaxbPlatform() { - return this.jaxbPlatform; - } - - public void setJaxbPlatform(JaxbPlatformDescription jaxbPlatform) { - JaxbPlatformDescription old = this.jaxbPlatform; - this.jaxbPlatform = jaxbPlatform; - if (old != jaxbPlatform) { - notifyListeners(PROP_JAXB_PLATFORM, old, jaxbPlatform); - } - } - - @Override - public synchronized IStatus validate() { - IStatus status = super.validate(); - if (! status.isOK()) { - return status; - } - - for (LibraryValidator libraryValidator : JptCommonCorePlugin.getLibraryValidators(this)) { - status = libraryValidator.validate(this); - if (! status.isOK()) { - return status; - } - } - - return Status.OK_STATUS; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbOsgiBundlesLibraryProviderInstallOperationConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbOsgiBundlesLibraryProviderInstallOperationConfig.java deleted file mode 100644 index 1b6769914d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbOsgiBundlesLibraryProviderInstallOperationConfig.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.libprov; - -import org.eclipse.jpt.common.core.internal.libprov.JptOsgiBundlesLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jaxb.core.libprov.JaxbLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; - - -public class JaxbOsgiBundlesLibraryProviderInstallOperationConfig - extends JptOsgiBundlesLibraryProviderInstallOperationConfig - implements JaxbLibraryProviderInstallOperationConfig { - - private JaxbPlatformDescription jaxbPlatform; - - - public JaxbOsgiBundlesLibraryProviderInstallOperationConfig() { - super(); - } - - - public JaxbPlatformDescription getJaxbPlatform() { - return this.jaxbPlatform; - } - - public void setJaxbPlatform(JaxbPlatformDescription jaxbPlatform) { - JaxbPlatformDescription old = this.jaxbPlatform; - this.jaxbPlatform = jaxbPlatform; - notifyListeners(PROP_JAXB_PLATFORM, old, jaxbPlatform); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbUserLibraryProviderInstallOperationConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbUserLibraryProviderInstallOperationConfig.java deleted file mode 100644 index 39349ca701..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libprov/JaxbUserLibraryProviderInstallOperationConfig.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.libprov; - -import org.eclipse.jpt.common.core.internal.libprov.JptUserLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jaxb.core.libprov.JaxbLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; - -public class JaxbUserLibraryProviderInstallOperationConfig - extends JptUserLibraryProviderInstallOperationConfig - implements JaxbLibraryProviderInstallOperationConfig { - - private JaxbPlatformDescription jaxbPlatform; - - - public JaxbUserLibraryProviderInstallOperationConfig() { - super(); - } - - - public JaxbPlatformDescription getJaxbPlatform() { - return this.jaxbPlatform; - } - - public void setJaxbPlatform(JaxbPlatformDescription jaxbPlatform) { - JaxbPlatformDescription old = this.jaxbPlatform; - this.jaxbPlatform = jaxbPlatform; - notifyListeners(PROP_JAXB_PLATFORM, old, jaxbPlatform); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java deleted file mode 100644 index 4ec0fc3238..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.libval; - - -public class GenericEclipseLinkBundlesLibraryValidator -// extends AbstractOsgiBundlesLibraryValidator - { - -// public IStatus validate(JptLibraryProviderInstallOperationConfig config) { -// JpaOsgiBundlesLibraryProviderInstallOperationConfig jpaConfig -// = (JpaOsgiBundlesLibraryProviderInstallOperationConfig) config; -// Map bundleVersionRanges = new HashMap(); -// String bundleName = "javax.persistence"; //$NON-NLS-1$ -// VersionRange[] versionRanges = new VersionRange[0]; -// if (config.getProjectFacetVersion().equals(JpaFacet.VERSION_1_0)) { -// versionRanges = new VersionRange[] {new VersionRange("[1.0, 3.0)")}; //$NON-NLS-1$ -// } -// else if (config.getProjectFacetVersion().equals(JpaFacet.VERSION_2_0)) { -// versionRanges = new VersionRange[] {new VersionRange("[2.0, 3.0)")}; //$NON-NLS-1$ -// } -// bundleVersionRanges.put(bundleName, versionRanges); -// return validate(jpaConfig, bundleVersionRanges); -// } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericJaxbUserLibraryValidator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericJaxbUserLibraryValidator.java deleted file mode 100644 index 762a8c98e6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/GenericJaxbUserLibraryValidator.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.libval; - -import java.util.HashSet; -import java.util.Set; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jpt.common.core.internal.libval.LibValUtil; -import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.common.core.libval.LibraryValidator; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jaxb.core.JaxbFacet; -import org.eclipse.jpt.jaxb.core.internal.libprov.JaxbUserLibraryProviderInstallOperationConfig; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -public class GenericJaxbUserLibraryValidator - implements LibraryValidator { - - public synchronized IStatus validate(JptLibraryProviderInstallOperationConfig config) { - - JaxbUserLibraryProviderInstallOperationConfig jaxbConfig - = (JaxbUserLibraryProviderInstallOperationConfig) config; - - IProjectFacetVersion jreJaxbVersion = JaxbLibValUtil.findJreJaxbVersion(jaxbConfig); - IProjectFacetVersion jaxbVersion = config.getProjectFacetVersion(); - - Set classNames = new HashSet(); - - if (jreJaxbVersion == null) { - classNames.add("javax.xml.bind.annotation.XmlSeeAlso"); //$NON-NLS-1$ - } - if (jaxbVersion.compareTo(JaxbFacet.VERSION_2_2) >= 0 - && (jreJaxbVersion == null || jreJaxbVersion.compareTo(JaxbFacet.VERSION_2_2) < 0)) { - classNames.add("javax.xml.bind.JAXBPermission"); //$NON-NLS-1$ - } - - Iterable libraryPaths = - new TransformationIterable(jaxbConfig.resolve()) { - @Override - protected IPath transform(IClasspathEntry o) { - return o.getPath(); - } - }; - - return LibValUtil.validate(libraryPaths, classNames); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbJreLibraryValidator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbJreLibraryValidator.java deleted file mode 100644 index 462dd9ac4e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbJreLibraryValidator.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.libval; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.common.core.libval.LibraryValidator; -import org.eclipse.jpt.jaxb.core.GenericJaxbPlatform; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.internal.JptJaxbCoreMessages; -import org.eclipse.jpt.jaxb.core.libprov.JaxbLibraryProviderInstallOperationConfig; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - - -public class JaxbJreLibraryValidator - implements LibraryValidator { - - public IStatus validate(JptLibraryProviderInstallOperationConfig config) { - - JaxbLibraryProviderInstallOperationConfig jaxbConfig - = (JaxbLibraryProviderInstallOperationConfig) config; - - if (! jaxbConfig.getJaxbPlatform().getGroup().equals(GenericJaxbPlatform.GROUP)) { - return new Status(IStatus.ERROR, JptJaxbCorePlugin.PLUGIN_ID, JptJaxbCoreMessages.JreLibraryValidator_invalidPlatform); - } - - IProjectFacetVersion jreJaxbVersion = JaxbLibValUtil.findJreJaxbVersion(jaxbConfig); - IProjectFacetVersion jaxbVersion = config.getProjectFacetVersion(); - - if (jreJaxbVersion == null || jreJaxbVersion.compareTo(jaxbVersion) < 0) { - return new Status(IStatus.ERROR, JptJaxbCorePlugin.PLUGIN_ID, JptJaxbCoreMessages.JreLibraryValidator_invalidJreJaxbVersion); - } - - return Status.OK_STATUS; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbLibValUtil.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbLibValUtil.java deleted file mode 100644 index 8d3a913fd9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/libval/JaxbLibValUtil.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.libval; - -import java.io.File; -import java.io.IOException; -import java.util.zip.ZipFile; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.launching.IVMInstall; -import org.eclipse.jdt.launching.IVMInstall2; -import org.eclipse.jdt.launching.IVMInstallType; -import org.eclipse.jdt.launching.JavaRuntime; -import org.eclipse.jdt.launching.LibraryLocation; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jaxb.core.JaxbFacet; -import org.eclipse.jpt.jaxb.core.libprov.JaxbLibraryProviderInstallOperationConfig; -import org.eclipse.jst.common.project.facet.core.StandardJreRuntimeComponent; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.runtime.IRuntime; -import org.eclipse.wst.common.project.facet.core.runtime.IRuntimeComponent; - - -public class JaxbLibValUtil { - - static IProjectFacetVersion findJreJaxbVersion(JaxbLibraryProviderInstallOperationConfig config) { - IRuntime runtime = config.getFacetedProject().getPrimaryRuntime(); - - if (runtime != null) { - for (IRuntimeComponent rc : runtime.getRuntimeComponents()) { - IVMInstall vm = findVMInstall(rc); - if (vm != null) { - return findJreJaxbVersion(vm); - } - } - } - - IVMInstall vm = JavaRuntime.getDefaultVMInstall(); - if (vm != null) { - return findJreJaxbVersion(vm); - } - - return null; - } - - private static IVMInstall findVMInstall(IRuntimeComponent rc) { - String vmInstallTypeId - = rc.getProperty(StandardJreRuntimeComponent.PROP_VM_INSTALL_TYPE); - String vmInstallId - = rc.getProperty(StandardJreRuntimeComponent.PROP_VM_INSTALL_ID); - - if (vmInstallTypeId == null || vmInstallId == null) { - return null; - } - - IVMInstallType vmInstallType = JavaRuntime.getVMInstallType(vmInstallTypeId); - - if( vmInstallType == null ) { - return null; - } - - return vmInstallType.findVMInstall(vmInstallId); - } - - private static IProjectFacetVersion findJreJaxbVersion(IVMInstall vm) { - if (vm instanceof IVMInstall2) { - String javaVersion = ((IVMInstall2) vm).getJavaVersion(); - if (javaVersion != null) { - if (javaVersion.startsWith(JavaCore.VERSION_1_7)) { - return JaxbFacet.VERSION_2_2; - } - // all other versions except 1.6 have no corresponding version (as of yet) - // 1.6 must be further analyzed - if (! javaVersion.startsWith(JavaCore.VERSION_1_6)) { - return null; - } - } - } - - Iterable vmLibPaths - = new TransformationIterable( - new ArrayIterable(JavaRuntime.getLibraryLocations(vm))) { - @Override - protected IPath transform(LibraryLocation o) { - return o.getSystemLibraryPath(); - } - }; - - boolean foundXmlSeeAlso = false; // marker for jaxb 2.1 + - boolean foundJAXBPermission = false; // marker for jaxb 2.2 + - - for (IPath vmLibPath : vmLibPaths) { - File file = vmLibPath.toFile(); - - if (file.exists()) { - ZipFile zip = null; - - try { - zip = new ZipFile(file); - - foundXmlSeeAlso |= zip.getEntry("javax/xml/bind/annotation/XmlSeeAlso.class") != null; - foundJAXBPermission |= zip.getEntry("javax/xml/bind/JAXBPermission.class") != null; - - // short circuit for JAXB 2.2 - if (foundJAXBPermission) { - return JaxbFacet.VERSION_2_2; - } - } - catch (IOException e) {} - finally { - if (zip != null) { - try { - zip.close(); - } - catch (IOException e) {} - } - } - } - } - - if (foundXmlSeeAlso) { - return JaxbFacet.VERSION_2_1; - } - - return null; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/operations/SchemaFileCreationDataModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/operations/SchemaFileCreationDataModelProvider.java deleted file mode 100644 index 745ba46411..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/operations/SchemaFileCreationDataModelProvider.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.operations; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IProject; -import org.eclipse.jpt.common.core.internal.operations.AbstractJptFileCreationDataModelProvider; - -/** - * SchemaFileCreationDataModelProvider - */ -public class SchemaFileCreationDataModelProvider extends AbstractJptFileCreationDataModelProvider -{ - - @Override - protected String getDefaultFileName() { - if(this.getProject() == null) { - return null; - } - return this.getProject().getName(); - } - - /** - * Return a best guess source location for the for the specified project - */ - @Override - protected IContainer getDefaultContainer() { - IContainer defaultContainer = super.getDefaultContainer(); - if(defaultContainer != null) { - IProject project = (IProject) this.model.getProperty(PROJECT); - return defaultContainer.getFolder(project.getLocation()); - } - return null; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformDescriptionImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformDescriptionImpl.java deleted file mode 100644 index 8c0a16df90..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformDescriptionImpl.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.platform; - -import org.eclipse.jpt.common.core.internal.XPointUtil; -import org.eclipse.jpt.jaxb.core.JaxbFacet; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinitionFactory; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformGroupDescription; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -public class JaxbPlatformDescriptionImpl - implements JaxbPlatformDescription { - - private String id; - private String pluginId; - private String label; - private String factoryClassName; - private IProjectFacetVersion jaxbFacetVersion; - private boolean default_ = false; - private JaxbPlatformGroupDescriptionImpl group; - - - public String getId() { - return this.id; - } - - void setId(String id) { - this.id = id; - } - - public String getPluginId() { - return this.pluginId; - } - - void setPluginId(String pluginId) { - this.pluginId = pluginId; - } - - public String getLabel() { - return this.label; - } - - void setLabel(String label) { - this.label = label; - } - - public String getFactoryClassName() { - return this.factoryClassName; - } - - void setFactoryClassName(String className) { - this.factoryClassName = className; - } - - public IProjectFacetVersion getJaxbFacetVersion() { - return this.jaxbFacetVersion; - } - - void setJaxbFacetVersion(IProjectFacetVersion jaxbFacetVersion) { - if (! jaxbFacetVersion.getProjectFacet().equals(JaxbFacet.FACET)) { - throw new IllegalArgumentException(jaxbFacetVersion.toString()); - } - this.jaxbFacetVersion = jaxbFacetVersion; - } - - public boolean supportsJaxbFacetVersion(IProjectFacetVersion jaxbFacetVersion) { - if (! jaxbFacetVersion.getProjectFacet().equals(JaxbFacet.FACET)) { - throw new IllegalArgumentException(jaxbFacetVersion.toString()); - } - return (this.jaxbFacetVersion != null) ? this.jaxbFacetVersion.equals(jaxbFacetVersion) : true; - } - - public boolean isDefault() { - return this.default_; - } - - void setDefault(boolean default_) { - this.default_ = default_; - } - - public JaxbPlatformGroupDescription getGroup() { - return this.group; - } - - void setGroup(JaxbPlatformGroupDescriptionImpl group) { - this.group = group; - } - - public JaxbPlatformDefinition buildJaxbPlatformDefinition() { - JaxbPlatformDefinitionFactory factory = XPointUtil.instantiate( - this.pluginId, JaxbPlatformManagerImpl.QUALIFIED_EXTENSION_POINT_ID, - this.factoryClassName, JaxbPlatformDefinitionFactory.class); - return factory.buildJaxbPlatformDefinition(); - } - - @Override - public String toString() { - return this.label; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformGroupDescriptionImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformGroupDescriptionImpl.java deleted file mode 100644 index e3e83ad95d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformGroupDescriptionImpl.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.platform; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformGroupDescription; - - -public class JaxbPlatformGroupDescriptionImpl - implements JaxbPlatformGroupDescription { - - private String id; - private String pluginId; - private String label; - private Map platforms; - - - JaxbPlatformGroupDescriptionImpl() { - this.platforms = new HashMap(); - } - - public String getId() { - return this.id; - } - - void setId(String id) { - this.id = id; - } - - public String getPluginId() { - return this.pluginId; - } - - void setPluginId(String pluginId) { - this.pluginId = pluginId; - } - - public String getLabel() { - return this.label; - } - - void setLabel(String label) { - this.label = label; - } - - void addPlatform(JaxbPlatformDescriptionImpl platform) { - this.platforms.put(platform.getId(), platform); - } - - public Iterable getPlatforms() { - return new SuperIterableWrapper(CollectionTools.collection(this.platforms.values())); - } - - @Override - public String toString() { - return this.label; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformImpl.java deleted file mode 100644 index 4721f2c5d0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformImpl.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.platform; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceModel; -import org.eclipse.jpt.common.core.internal.utility.PlatformTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.DefaultAnnotationEditFormatter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.AnnotationProvider; -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.JaxbFile; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JaxbResourceModelProvider; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.internal.GenericAnnotationProvider; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatform; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; - -public final class JaxbPlatformImpl - implements JaxbPlatform { - - private JaxbPlatformDefinition platformDefinition; - - private AnnotationProvider annotationProvider; - - - public JaxbPlatformImpl(JaxbPlatformDefinition jaxbPlatformDefinition) { - super(); - this.platformDefinition = jaxbPlatformDefinition; - this.annotationProvider = new GenericAnnotationProvider(this.platformDefinition.getAnnotationDefinitions(), this.platformDefinition.getNestableAnnotationDefinitions()); - } - - - public JaxbPlatformDescription getDescription() { - return this.platformDefinition.getDescription(); - } - - // ********** factory ********** - - public JaxbFactory getFactory() { - return this.platformDefinition.getFactory(); - } - - - // ********** JAXB file/resource models ********** - - public JaxbFile buildJaxbFile(JaxbProject jaxbProject, IFile file) { - IContentType contentType = PlatformTools.getContentType(file); - return (contentType == null) ? null : this.buildJaxbFile(jaxbProject, file, contentType); - } - - protected JaxbFile buildJaxbFile(JaxbProject jaxbProject, IFile file, IContentType contentType) { - JptResourceModel resourceModel = this.buildResourceModel(jaxbProject, file, contentType); - return (resourceModel == null) ? null : getFactory().buildJaxbFile(jaxbProject, file, contentType, resourceModel); - } - - protected JptResourceModel buildResourceModel(JaxbProject jaxbProject, IFile file, IContentType contentType) { - JaxbResourceModelProvider provider = this.getResourceModelProvider(contentType); - return (provider == null) ? null : provider.buildResourceModel(jaxbProject, file); - } - - /** - * Return null if we don't have a provider for the specified content type - * (since we don't have control over the possible content types). - */ - protected JaxbResourceModelProvider getResourceModelProvider(IContentType contentType) { - for (JaxbResourceModelProvider provider : getResourceModelProviders()) { - if (contentType.equals(provider.getContentType())) { - return provider; - } - } - return null; - } - - protected ListIterable getResourceModelProviders() { - return this.platformDefinition.getResourceModelProviders(); - } - - - // ********** Java annotations ********** - - public AnnotationProvider getAnnotationProvider() { - return this.annotationProvider; - } - - public AnnotationEditFormatter getAnnotationEditFormatter() { - return DefaultAnnotationEditFormatter.instance(); - } - - - // ********** Java attribute mappings ********** - - public JavaAttributeMappingDefinition getSpecifiedJavaAttributeMappingDefinition( - JaxbPersistentAttribute attribute) { - for (JavaAttributeMappingDefinition definition : getSpecifiedJavaAttributeMappingDefinitions()) { - if (definition.isSpecified(attribute)) { - return definition; - } - } - throw new IllegalStateException("There must be a mapping definition for all attributes"); //$NON-NLS-1$ - } - - public Iterable getSpecifiedJavaAttributeMappingDefinitions() { - return this.platformDefinition.getSpecifiedJavaAttributeMappingDefinitions(); - } - - public JavaAttributeMappingDefinition getSpecifiedJavaAttributeMappingDefinition(String mappingKey) { - for (JavaAttributeMappingDefinition definition : getSpecifiedJavaAttributeMappingDefinitions()) { - if (Tools.valuesAreEqual(definition.getKey(), mappingKey)) { - return definition; - } - } - throw new IllegalArgumentException("Illegal attribute mapping key: " + mappingKey); //$NON-NLS-1$ - } - - public Iterable getDefaultJavaAttributeMappingDefinitions() { - return this.platformDefinition.getDefaultJavaAttributeMappingDefinitions(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformManagerImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformManagerImpl.java deleted file mode 100644 index 4d3b8e03bf..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/platform/JaxbPlatformManagerImpl.java +++ /dev/null @@ -1,253 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.platform; - -import static org.eclipse.jpt.common.core.internal.XPointUtil.*; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jpt.common.core.internal.XPointUtil.XPointException; -import org.eclipse.jpt.common.utility.internal.KeyedSet; -import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper; -import org.eclipse.jpt.jaxb.core.JaxbFacet; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformGroupDescription; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformManager; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - - -public class JaxbPlatformManagerImpl - implements JaxbPlatformManager { - - static final String EXTENSION_POINT_ID = "jaxbPlatforms"; //$NON-NLS-1$ - static final String QUALIFIED_EXTENSION_POINT_ID = JptJaxbCorePlugin.PLUGIN_ID_ + EXTENSION_POINT_ID; - static final String PLATFORM_GROUP_ELEMENT = "jaxbPlatformGroup"; //$NON-NLS-1$ - static final String PLATFORM_ELEMENT = "jaxbPlatform"; //$NON-NLS-1$ - static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$ - static final String LABEL_ATTRIBUTE = "label"; //$NON-NLS-1$ - static final String FACTORY_CLASS_ATTRIBUTE = "factoryClass"; //$NON-NLS-1$ - static final String JAXB_FACET_VERSION_ATTRIBUTE = "jaxbFacetVersion"; //$NON-NLS-1$ - static final String DEFAULT_ATTRIBUTE = "default"; //$NON-NLS-1$ - static final String GROUP_ELEMENT = "group"; //$NON-NLS-1$ - - - private static final JaxbPlatformManagerImpl INSTANCE = new JaxbPlatformManagerImpl(); - - - public static JaxbPlatformManagerImpl instance() { - return INSTANCE; - } - - - private KeyedSet platformGroupDescriptions; - private KeyedSet platformDescriptions; - - - // ********** constructor/initialization ********** - - private JaxbPlatformManagerImpl() { - super(); - this.platformGroupDescriptions = new KeyedSet(); - this.platformDescriptions = new KeyedSet(); - readExtensions(); - } - - - private void readExtensions() { - final IExtensionRegistry registry = Platform.getExtensionRegistry(); - - final IExtensionPoint xpoint - = registry.getExtensionPoint(JptJaxbCorePlugin.PLUGIN_ID, EXTENSION_POINT_ID); - - if (xpoint == null) { - throw new IllegalStateException(); - } - - List platformGroupConfigs = new ArrayList(); - List platformConfigs = new ArrayList(); - - for (IExtension extension : xpoint.getExtensions()) { - for (IConfigurationElement element : extension.getConfigurationElements()) { - if (element.getName().equals(PLATFORM_GROUP_ELEMENT)) { - platformGroupConfigs.add(element); - } - else if (element.getName().equals(PLATFORM_ELEMENT)) { - platformConfigs.add(element); - } - } - } - - for (IConfigurationElement element : platformGroupConfigs) { - readPlatformGroupExtension(element); - } - - for (IConfigurationElement element : platformConfigs) { - readPlatformExtension(element); - } - } - - private void readPlatformGroupExtension(IConfigurationElement element) { - try { - final JaxbPlatformGroupDescriptionImpl desc = new JaxbPlatformGroupDescriptionImpl(); - - // plug-in id - desc.setPluginId(element.getContributor().getName()); - - // id - desc.setId(findRequiredAttribute(element, ID_ATTRIBUTE)); - - if (this.platformGroupDescriptions.containsKey(desc.getId())) { - logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, desc.getId()); - throw new XPointException(); - } - - // label - desc.setLabel(findRequiredAttribute(element, LABEL_ATTRIBUTE)); - - this.platformGroupDescriptions.addItem(desc.getId(), desc); - } - catch (XPointException e) { - // Ignore and continue. The problem has already been reported to the user - // in the log. - } - } - - private void readPlatformExtension(IConfigurationElement element) { - try { - final JaxbPlatformDescriptionImpl desc = new JaxbPlatformDescriptionImpl(); - - // plug-in id - desc.setPluginId(element.getContributor().getName()); - - // id - desc.setId(findRequiredAttribute(element, ID_ATTRIBUTE)); - - if (this.platformDescriptions.containsKey(desc.getId())) { - logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, desc.getId()); - throw new XPointException(); - } - - // label - desc.setLabel(findRequiredAttribute(element, LABEL_ATTRIBUTE)); - - // factory class - desc.setFactoryClassName(findRequiredAttribute(element, FACTORY_CLASS_ATTRIBUTE)); - - // JAXB facet version - String jaxbFacetVersionString = element.getAttribute(JAXB_FACET_VERSION_ATTRIBUTE); - if (jaxbFacetVersionString != null) { - IProjectFacetVersion jpaFacetVersion = JaxbFacet.FACET.getVersion(jaxbFacetVersionString); - if (jpaFacetVersion != null) { - desc.setJaxbFacetVersion(jpaFacetVersion); - } - else { - logInvalidValue(element, JAXB_FACET_VERSION_ATTRIBUTE, jaxbFacetVersionString); - throw new XPointException(); - } - } - - // default - String defaultString = element.getAttribute(DEFAULT_ATTRIBUTE); - if (defaultString != null) { - if (defaultString.equals("true")) { //$NON-NLS-1$ - desc.setDefault(true); - } - else if (defaultString.equals("false")) { //$NON-NLS-1$ - desc.setDefault(false); - } - else { - logInvalidValue(element, DEFAULT_ATTRIBUTE, defaultString); - throw new XPointException(); - } - } - - // group - String groupId = element.getAttribute(GROUP_ELEMENT); - if (groupId != null) { - JaxbPlatformGroupDescriptionImpl group = this.platformGroupDescriptions.getItem(groupId); - if (group != null) { - desc.setGroup(group); - group.addPlatform(desc); - } - else { - logInvalidValue(element, GROUP_ELEMENT, groupId); - throw new XPointException(); - } - } - else { - JaxbPlatformGroupDescriptionImpl group = new JaxbPlatformGroupDescriptionImpl(); - group.setPluginId(desc.getPluginId()); - group.setId(desc.getId()); - group.setLabel(desc.getLabel()); - group.addPlatform(desc); - - if (this.platformGroupDescriptions.containsKey(group.getId())) { - logInvalidValue(element, GROUP_ELEMENT, groupId); - throw new XPointException(); - } - - this.platformGroupDescriptions.addItem(group.getId(), group); - } - - this.platformDescriptions.addItem(desc.getId(), desc); - } - catch (XPointException e) { - // Ignore and continue. The problem has already been reported to the user - // in the log. - } - } - - - // ********** public methods ********** - - public Iterable getJaxbPlatformGroups() { - return new SuperIterableWrapper(this.platformGroupDescriptions.getItemSet()); - } - - public JaxbPlatformGroupDescription getJaxbPlatformGroup(String groupId) { - return this.platformGroupDescriptions.getItem(groupId); - } - - public Iterable getJaxbPlatforms() { - return new SuperIterableWrapper(this.platformDescriptions.getItemSet()); - } - - public JaxbPlatformDescription getJaxbPlatform(String platformId) { - return this.platformDescriptions.getItem(platformId); - } - - public JaxbPlatformDescription getDefaultJaxbPlatform(IProjectFacetVersion jaxbFacetVersion) { - if (! jaxbFacetVersion.getProjectFacet().equals(JaxbFacet.FACET)) { - throw new IllegalArgumentException(jaxbFacetVersion.toString()); - } - for (JaxbPlatformDescription platform : getJaxbPlatforms()) { - if (platform.isDefault() && platform.supportsJaxbFacetVersion(jaxbFacetVersion)) { - return platform; - } - } - return null; - } - - public JaxbPlatformDefinition buildJaxbPlatformDefinition(IProject project) { - String jaxbPlatformId = JptJaxbCorePlugin.getJaxbPlatformId(project); - JaxbPlatformDescriptionImpl platformDesc = this.platformDescriptions.getItem(jaxbPlatformId); - if (platformDesc == null) { - throw new IllegalArgumentException("Project does not have a recognized JAXB platform."); //$NON-NLS-1$ - } - return platformDesc.buildJaxbPlatformDefinition(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullAnnotation.java deleted file mode 100644 index a5fb26a455..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullAnnotation.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.AbstractJavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; - -/** - * Simplify null annotation classes - */ -public abstract class NullAnnotation - extends AbstractJavaResourceNode - implements Annotation -{ - - protected NullAnnotation(JavaResourceNode parent) { - super(parent); - } - - public void initialize(CompilationUnit astRoot) { - // do nothing - } - - public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) { - return null; - } - - public JavaResourceCompilationUnit getJavaResourceCompilationUnit() { - throw new UnsupportedOperationException(); - } - - public void newAnnotation() { - throw new UnsupportedOperationException(); - } - - public void removeAnnotation() { - throw new UnsupportedOperationException(); - } - - public TextRange getTextRange(CompilationUnit astRoot) { - return null; - } - - public void synchronizeWith(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - /** - * Convenience method: Cast the annotation's parent to a - * persistent member. - */ - protected JavaResourceAnnotatedElement getAnnotatedElement() { - return (JavaResourceAnnotatedElement) this.parent; - } - - /** - * Convenience method: Add the type or attribute's annotation - * and return it. - * Pre-condition: The annotation's parent must be a persistent member - * (type or attribute). - */ - protected Annotation addAnnotation() { - return this.getAnnotatedElement().addAnnotation(this.getAnnotationName()); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorOrderAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorOrderAnnotation.java deleted file mode 100644 index dae57d6a99..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorOrderAnnotation.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; - -/** - * javax.xml.bind.annotation.XmlAccessorOrder - */ -public final class NullXmlAccessorOrderAnnotation - extends NullAnnotation - implements XmlAccessorOrderAnnotation -{ - protected NullXmlAccessorOrderAnnotation(JavaResourceAnnotatedElement parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected XmlAccessorOrderAnnotation addAnnotation() { - return (XmlAccessorOrderAnnotation) super.addAnnotation(); - } - - - // ********** XmlAccessorTOrderAnnotation implementation ********** - - // ***** value - public XmlAccessOrder getValue() { - return null; - } - - public void setValue(XmlAccessOrder value) { - if (value != null) { - this.addAnnotation().setValue(value); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorTypeAnnotation.java deleted file mode 100644 index bb8856ee0e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlAccessorTypeAnnotation.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAccessorType - */ -public final class NullXmlAccessorTypeAnnotation - extends NullAnnotation - implements XmlAccessorTypeAnnotation -{ - protected NullXmlAccessorTypeAnnotation(JavaResourceAnnotatedElement parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected XmlAccessorTypeAnnotation addAnnotation() { - return (XmlAccessorTypeAnnotation) super.addAnnotation(); - } - - - // ********** XmlAccessorTypeAnnotation implementation ********** - - // ***** value - public XmlAccessType getValue() { - return null; - } - - public void setValue(XmlAccessType value) { - if (value != null) { - this.addAnnotation().setValue(value); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlElementDeclAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlElementDeclAnnotation.java deleted file mode 100644 index 72f000dedd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlElementDeclAnnotation.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementDeclAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementDecl - */ -public final class NullXmlElementDeclAnnotation - extends NullAnnotation - implements XmlElementDeclAnnotation -{ - protected NullXmlElementDeclAnnotation(JavaResourceMethod parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected XmlElementDeclAnnotation addAnnotation() { - return (XmlElementDeclAnnotation) super.addAnnotation(); - } - - - // ********** XmlEnumAnnotation implementation ********** - - // ***** name - public String getName() { - return null; - } - - public void setName(String name) { - if (name != null) { - this.addAnnotation().setName(name); - } - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** namespace - public String getNamespace() { - return null; - } - - public void setNamespace(String namespace) { - if (namespace != null) { - this.addAnnotation().setNamespace(namespace); - } - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** defaultValue - public String getDefaultValue() { - return null; - } - - public void setDefaultValue(String defaultValue) { - if (defaultValue != null) { - this.addAnnotation().setDefaultValue(defaultValue); - } - } - - public TextRange getDefaultValueTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** scope - public String getScope() { - return null; - } - - public String getFullyQualifiedScopeClassName() { - return null; - } - - public void setScope(String scope) { - if (scope != null) { - this.addAnnotation().setScope(scope); - } - } - - public TextRange getScopeTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** substitutionHeadName - public String getSubstitutionHeadName() { - return null; - } - - public void setSubstitutionHeadName(String substitutionHeadName) { - if (substitutionHeadName != null) { - this.addAnnotation().setSubstitutionHeadName(substitutionHeadName); - } - } - - public TextRange getSubstitutionHeadNameTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** substitutionHeadNamespace - public String getSubstitutionHeadNamespace() { - return null; - } - - public void setSubstitutionHeadNamespace(String substitutionHeadNamespace) { - if (substitutionHeadNamespace != null) { - this.addAnnotation().setSubstitutionHeadNamespace(substitutionHeadNamespace); - } - } - - public TextRange getSubstitutionHeadNamespaceTextRange(CompilationUnit astRoot) { - return null; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumAnnotation.java deleted file mode 100644 index 1d86e9d827..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumAnnotation.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumAnnotation; - -/** - * javax.xml.bind.annotation.XmlEnum - */ -public final class NullXmlEnumAnnotation - extends NullAnnotation - implements XmlEnumAnnotation -{ - protected NullXmlEnumAnnotation(AbstractJavaResourceType parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected XmlEnumAnnotation addAnnotation() { - return (XmlEnumAnnotation) super.addAnnotation(); - } - - - // ********** XmlEnumAnnotation implementation ********** - - // ***** value - public String getValue() { - return null; - } - - public String getFullyQualifiedValueClassName() { - return null; - } - - public void setValue(String value) { - if (value != null) { - this.addAnnotation().setValue(value); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumValueAnnotation.java deleted file mode 100644 index 4d2adeba94..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlEnumValueAnnotation.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation; - -/** - * javax.xml.bind.annotation.XmlEnumValue - */ -public final class NullXmlEnumValueAnnotation - extends NullAnnotation - implements XmlEnumValueAnnotation -{ - protected NullXmlEnumValueAnnotation(JavaResourceEnumConstant parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected XmlEnumValueAnnotation addAnnotation() { - return (XmlEnumValueAnnotation) super.addAnnotation(); - } - - - // ********** XmlEnumValueAnnotation implementation ********** - - // ***** value - public String getValue() { - return null; - } - - public void setValue(String value) { - if (value != null) { - this.addAnnotation().setValue(value); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlSchemaAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlSchemaAnnotation.java deleted file mode 100644 index 667baacffd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlSchemaAnnotation.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaAnnotation; - -/** - * javax.xml.bind.annotation.XmlSchema - */ -public final class NullXmlSchemaAnnotation - extends NullAnnotation - implements XmlSchemaAnnotation -{ - protected NullXmlSchemaAnnotation(JavaResourcePackage parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected XmlSchemaAnnotation addAnnotation() { - return (XmlSchemaAnnotation) super.addAnnotation(); - } - - - // ********** XmlSchemaAnnotation implementation ********** - - // ***** namespace - - public String getNamespace() { - return null; - } - - public void setNamespace(String namespace) { - if (namespace != null) { - this.addAnnotation().setNamespace(namespace); - } - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return null; - } - - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return false; - } - - - // ***** location - - public String getLocation() { - return null; - } - - public void setLocation(String location) { - if (location != null) { - this.addAnnotation().setLocation(location); - } - } - - public TextRange getLocationTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } - - public XmlNsForm getAttributeFormDefault() { - return null; - } - - public void setAttributeFormDefault(XmlNsForm attributeFormDefault) { - if (attributeFormDefault != null) { - this.addAnnotation().setAttributeFormDefault(attributeFormDefault); - } - } - - public TextRange getAttributeFormDefaultTextRange(CompilationUnit astRoot) { - return null; - } - - public XmlNsForm getElementFormDefault() { - return null; - } - - public void setElementFormDefault(XmlNsForm elementFormDefault) { - if (elementFormDefault != null) { - this.addAnnotation().setElementFormDefault(elementFormDefault); - } - } - - public TextRange getElementFormDefaultTextRange(CompilationUnit astRoot) { - return null; - } - - public ListIterable getXmlns() { - return EmptyListIterable.instance(); - } - - public int getXmlnsSize() { - return 0; - } - - public XmlNsAnnotation xmlnsAt(int index) { - return null; - } - - public XmlNsAnnotation addXmlns(int index) { - return this.addAnnotation().addXmlns(index); - } - - public void moveXmlns(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeXmlns(int index) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlTypeAnnotation.java deleted file mode 100644 index a6877586fc..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/NullXmlTypeAnnotation.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlType - */ -public final class NullXmlTypeAnnotation - extends NullAnnotation - implements XmlTypeAnnotation -{ - protected NullXmlTypeAnnotation(AbstractJavaResourceType parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected XmlTypeAnnotation addAnnotation() { - return (XmlTypeAnnotation) super.addAnnotation(); - } - - - // ********** XmlTypeAnnotation implementation ********** - - // ***** factory class - public String getFactoryClass() { - return null; - } - - public String getFullyQualifiedFactoryClassName() { - return null; - } - - public void setFactoryClass(String factoryClass) { - if (factoryClass != null) { - this.addAnnotation().setFactoryClass(factoryClass); - } - } - - public TextRange getFactoryClassTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** factory method - public String getFactoryMethod() { - return null; - } - - public void setFactoryMethod(String factoryMethod) { - if (factoryMethod != null) { - this.addAnnotation().setFactoryMethod(factoryMethod); - } - } - - public TextRange getFactoryMethodTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** name - public String getName() { - return null; - } - - public void setName(String name) { - if (name != null) { - this.addAnnotation().setName(name); - } - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return null; - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - return false; - } - - - // ***** namespace - public String getNamespace() { - return null; - } - - public void setNamespace(String namespace) { - if (namespace != null) { - this.addAnnotation().setNamespace(namespace); - } - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return null; - } - - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return false; - } - - - public ListIterable getPropOrder() { - return EmptyListIterable.instance(); - } - - public int getPropOrderSize() { - return 0; - } - - public void addProp(int index, String prop) { - this.addAnnotation().addProp(index, prop); - } - - public void addProp(String prop) { - this.addAnnotation().addProp(prop); - } - - public void moveProp(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeProp(int index) { - throw new UnsupportedOperationException(); - } - - public void removeProp(String prop) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAccessorOrderAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAccessorOrderAnnotationDefinition.java deleted file mode 100644 index 362d0f430b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAccessorOrderAnnotationDefinition.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlAccessorOrderAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlAccessorOrderAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; - -/** - * javax.xml.bind.annotation.XmlAccessorOrder - */ -public final class XmlAccessorOrderAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlAccessorOrderAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlAccessorOrderAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlAccessorOrderAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullXmlAccessorOrderAnnotation(parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlAccessorOrderAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlAccessorOrderAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAccessorTypeAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAccessorTypeAnnotationDefinition.java deleted file mode 100644 index e36e85dd89..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAccessorTypeAnnotationDefinition.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlAccessorTypeAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlAccessorTypeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAccessorType - */ -public final class XmlAccessorTypeAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlAccessorTypeAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlAccessorTypeAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlAccessorTypeAnnotation(parent, annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullXmlAccessorTypeAnnotation(parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlAccessorTypeAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlAccessorTypeAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyAttributeAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyAttributeAnnotationDefinition.java deleted file mode 100644 index 008f0be7cf..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyAttributeAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlAnyAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlAnyAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyAttributeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAnyAttribute - */ -public final class XmlAnyAttributeAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlAnyAttributeAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlAnyAttributeAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlAnyAttributeAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlAnyAttributeAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlAnyAttributeAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyElementAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyElementAnnotationDefinition.java deleted file mode 100644 index 1a652d1664..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAnyElementAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlAnyElementAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlAnyElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlAnyElement - */ -public final class XmlAnyElementAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlAnyElementAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlAnyElementAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlAnyElementAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlAnyElementAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlAnyElementAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttachmentRefAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttachmentRefAnnotationDefinition.java deleted file mode 100644 index 4de95f3fff..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttachmentRefAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlAttachmentRefAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlAttachmentRefAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttachmentRefAnnotation; - -/** - * javax.xml.bind.annotation.XmlAttachmentRef - */ -public final class XmlAttachmentRefAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlAttachmentRefAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlAttachmentRefAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlAttachmentRefAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlAttachmentRefAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlAttachmentRefAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttributeAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttributeAnnotationDefinition.java deleted file mode 100644 index f1386ae20d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlAttributeAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAttribute - */ -public final class XmlAttributeAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlAttributeAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlAttributeAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlAttributeAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlAttributeAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlAttributeAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementAnnotationDefinition.java deleted file mode 100644 index aadf23dedf..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementAnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlElementAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlElement - */ -public final class XmlElementAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlElementAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlElementAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return SourceXmlElementAnnotation.buildSourceXmlElementAnnotation((JavaResourceAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlElementAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlElementAnnotation.ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementDeclAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementDeclAnnotationDefinition.java deleted file mode 100644 index 80e909350d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementDeclAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.MethodAttribute; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlElementDeclAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlElementDeclAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementDeclAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementDecl - */ -public final class XmlElementDeclAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlElementDeclAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlElementDeclAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlElementDeclAnnotation((JavaResourceMethod) parent, (MethodAttribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullXmlElementDeclAnnotation((JavaResourceMethod) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlElementDeclAnnotation((JavaResourceMethod) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlElementDeclAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementRefAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementRefAnnotationDefinition.java deleted file mode 100644 index 906de66d39..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementRefAnnotationDefinition.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlElementRefAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlElementRefAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotationDefinition; - -/** - * javax.xml.bind.annotation.XmlElementRef - */ -public final class XmlElementRefAnnotationDefinition - implements NestableAnnotationDefinition -{ - // singleton - private static final NestableAnnotationDefinition INSTANCE = new XmlElementRefAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static NestableAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlElementRefAnnotationDefinition() { - super(); - } - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) { - return SourceXmlElementRefAnnotation.buildSourceXmlElementRefAnnotation((JavaResourceField) parent, (Attribute) annotatedElement, index); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlElementRefAnnotation(parent, jdtAnnotation); - } - - public String getNestableAnnotationName() { - return JAXB.XML_ELEMENT_REF; - } - - public String getContainerAnnotationName() { - return JAXB.XML_ELEMENT_REFS; - } - - public String getElementName() { - return JAXB.XML_ELEMENT_REFS__VALUE; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementWrapperAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementWrapperAnnotationDefinition.java deleted file mode 100644 index 56efd05d7c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementWrapperAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlElementWrapperAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlElementWrapperAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementWrapper - */ -public final class XmlElementWrapperAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlElementWrapperAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlElementWrapperAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlElementWrapperAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlElementWrapperAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlElementWrapperAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementsAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementsAnnotationDefinition.java deleted file mode 100644 index d9a5683a43..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlElementsAnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlElementsAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlElementsAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementsAnnotation; - -/** - * javax.xml.bind.annotation.XmlElement - */ -public final class XmlElementsAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlElementsAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlElementsAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlElementsAnnotation((JavaResourceAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlElementsAnnotation((JavaResourceAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlElementsAnnotation.ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumAnnotationDefinition.java deleted file mode 100644 index c799ce6908..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlEnumAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlEnumAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumAnnotation; - -/** - * javax.xml.bind.annotation.XmlEnum - */ -public final class XmlEnumAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlEnumAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlEnumAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlEnumAnnotation((AbstractJavaResourceType) parent, (AbstractType) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullXmlEnumAnnotation((AbstractJavaResourceType) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlEnumAnnotation((AbstractJavaResourceType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlEnumAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumValueAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumValueAnnotationDefinition.java deleted file mode 100644 index 309104f514..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlEnumValueAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.EnumConstant; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlEnumValueAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlEnumValueAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation; - -/** - * javax.xml.bind.annotation.XmlEnumValue - */ -public final class XmlEnumValueAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlEnumValueAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlEnumValueAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlEnumValueAnnotation((JavaResourceEnumConstant) parent, (EnumConstant) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullXmlEnumValueAnnotation((JavaResourceEnumConstant) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlEnumValueAnnotation((JavaResourceEnumConstant) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlEnumValueAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDAnnotationDefinition.java deleted file mode 100644 index de18ccecf0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlIDAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlIDAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDAnnotation; - -/** - * javax.xml.bind.annotation.XmlID - */ -public final class XmlIDAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlIDAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlIDAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlIDAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlIDAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlIDAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDREFAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDREFAnnotationDefinition.java deleted file mode 100644 index 2d07bc9a34..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlIDREFAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlIDREFAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlIDREFAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation; - -/** - * javax.xml.bind.annotation.XmlIDREF - */ -public final class XmlIDREFAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlIDREFAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlIDREFAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlIDREFAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlIDREFAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlIDREFAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlInlineBinaryDataAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlInlineBinaryDataAnnotationDefinition.java deleted file mode 100644 index 8d14d81a46..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlInlineBinaryDataAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlInlineBinaryDataAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlInlineBinaryDataAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlInlineBinaryDataAnnotation; - -/** - * javax.xml.bind.annotation.XmlInlineBinaryData - */ -public final class XmlInlineBinaryDataAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlInlineBinaryDataAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlInlineBinaryDataAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlInlineBinaryDataAnnotation((JavaResourceMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlInlineBinaryDataAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlInlineBinaryDataAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlJavaTypeAdapterAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlJavaTypeAdapterAnnotationDefinition.java deleted file mode 100644 index 8d3039fd24..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlJavaTypeAdapterAnnotationDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotationDefinition; - -/** - * javax.xml.bind.annotation.adapters.XmlJavaTypeAdapterAnnotation - */ -public final class XmlJavaTypeAdapterAnnotationDefinition - implements NestableAnnotationDefinition -{ - // singleton - private static final NestableAnnotationDefinition INSTANCE = new XmlJavaTypeAdapterAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static NestableAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlJavaTypeAdapterAnnotationDefinition() { - super(); - } - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) { - return SourceXmlJavaTypeAdapterAnnotation.buildSourceXmlJavaTypeAdapterAnnotation(parent, annotatedElement, index); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlJavaTypeAdapterAnnotation(parent, jdtAnnotation); - } - - public String getNestableAnnotationName() { - return JAXB.XML_JAVA_TYPE_ADAPTER; - } - - public String getContainerAnnotationName() { - return JAXB.XML_JAVA_TYPE_ADAPTERS; - } - - public String getElementName() { - return JAXB.XML_JAVA_TYPE_ADAPTERS__VALUE; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlListAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlListAnnotationDefinition.java deleted file mode 100644 index 5ee5334802..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlListAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlListAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlListAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation; - -/** - * javax.xml.bind.annotation.XmlList - */ -public final class XmlListAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlListAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlListAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlListAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlListAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlListAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMimeTypeAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMimeTypeAnnotationDefinition.java deleted file mode 100644 index 084b40291a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMimeTypeAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlMimeTypeAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlMimeTypeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlMimeTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlMimeType - */ -public final class XmlMimeTypeAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlMimeTypeAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlMimeTypeAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlMimeTypeAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlMimeTypeAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlMimeTypeAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMixedAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMixedAnnotationDefinition.java deleted file mode 100644 index 77263c2fd1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlMixedAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlMixedAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlMixedAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation; - -/** - * javax.xml.bind.annotation.XmlMixed - */ -public final class XmlMixedAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlMixedAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlMixedAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlMixedAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlMixedAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlMixedAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlRegistryAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlRegistryAnnotationDefinition.java deleted file mode 100644 index ce649dd605..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlRegistryAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlRegistryAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlRegistryAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRegistryAnnotation; - -/** - * javax.xml.bind.annotation.XmlRegistry - */ -public final class XmlRegistryAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlRegistryAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlRegistryAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlRegistryAnnotation((AbstractJavaResourceType) parent, (AbstractType) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlRegistryAnnotation((AbstractJavaResourceType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlRegistryAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlRootElementAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlRootElementAnnotationDefinition.java deleted file mode 100644 index 0f5cbbb99c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlRootElementAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlRootElementAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlRootElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlRootElement - */ -public final class XmlRootElementAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlRootElementAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlRootElementAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlRootElementAnnotation((AbstractJavaResourceType) parent, (AbstractType) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlRootElementAnnotation((AbstractJavaResourceType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlRootElementAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSchemaAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSchemaAnnotationDefinition.java deleted file mode 100644 index 0ac46c3036..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSchemaAnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedPackage; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlSchemaAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; - -public class XmlSchemaAnnotationDefinition - implements AnnotationDefinition { - - // singleton - private static final AnnotationDefinition INSTANCE = new XmlSchemaAnnotationDefinition(); - - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - - /** - * Ensure single instance. - */ - private XmlSchemaAnnotationDefinition() { - super(); - } - - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlSchemaAnnotation((JavaResourcePackage) parent, (AnnotatedPackage) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullXmlSchemaAnnotation((JavaResourcePackage) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - // TODO - throw new UnsupportedOperationException(); - } - - public String getAnnotationName() { - return JAXB.XML_SCHEMA; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSchemaTypeAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSchemaTypeAnnotationDefinition.java deleted file mode 100644 index 385af2b93c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSchemaTypeAnnotationDefinition.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlSchemaTypeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotationDefinition; - - -public class XmlSchemaTypeAnnotationDefinition - implements NestableAnnotationDefinition { - - // singleton - private static final NestableAnnotationDefinition INSTANCE = new XmlSchemaTypeAnnotationDefinition(); - - - /** - * Return the singleton. - */ - public static NestableAnnotationDefinition instance() { - return INSTANCE; - } - - - private XmlSchemaTypeAnnotationDefinition() { - super(); - } - - public NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) { - return SourceXmlSchemaTypeAnnotation.buildSourceXmlSchemaTypeAnnotation(parent, annotatedElement, index); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - throw new UnsupportedOperationException(); - } - - public String getNestableAnnotationName() { - return JAXB.XML_SCHEMA_TYPE; - } - - public String getContainerAnnotationName() { - return JAXB.XML_SCHEMA_TYPES; - } - - public String getElementName() { - return JAXB.XML_SCHEMA_TYPES__VALUE; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSeeAlsoAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSeeAlsoAnnotationDefinition.java deleted file mode 100644 index c8fa92dc22..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlSeeAlsoAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlSeeAlsoAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlSeeAlsoAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSeeAlsoAnnotation; - -/** - * javax.xml.bind.annotation.XmlSeeAlso - */ -public final class XmlSeeAlsoAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlSeeAlsoAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlSeeAlsoAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlSeeAlsoAnnotation((AbstractJavaResourceType) parent, (AbstractType) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlSeeAlsoAnnotation((AbstractJavaResourceType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlSeeAlsoAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlTransientAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlTransientAnnotationDefinition.java deleted file mode 100644 index 2f40820e51..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlTransientAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlTransientAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlTransientAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTransientAnnotation; - -/** - * javax.xml.bind.annotation.XmlTransient - */ -public final class XmlTransientAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlTransientAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlTransientAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlTransientAnnotation((JavaResourceMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlTransientAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlTransientAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlTypeAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlTypeAnnotationDefinition.java deleted file mode 100644 index 05bdb0f6fc..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlTypeAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlTypeAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlTypeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlType - */ -public final class XmlTypeAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlTypeAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlTypeAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlTypeAnnotation((AbstractJavaResourceType) parent, (AbstractType) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullXmlTypeAnnotation((AbstractJavaResourceType) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlTypeAnnotation((AbstractJavaResourceType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlTypeAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlValueAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlValueAnnotationDefinition.java deleted file mode 100644 index cf706d63d8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/XmlValueAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jaxb.core.internal.resource.java.binary.BinaryXmlValueAnnotation; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceXmlValueAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation; - -/** - * javax.xml.bind.annotation.XmlValue - */ -public final class XmlValueAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new XmlValueAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private XmlValueAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceXmlValueAnnotation((JavaResourceMember) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryXmlValueAnnotation((JavaResourceMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return XmlValueAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryAnnotation.java deleted file mode 100644 index 5dd44ff4c6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryAnnotation.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.IMemberValuePair; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; - -/** - * JAR annotation - */ -public abstract class BinaryAnnotation - extends BinaryNode - implements Annotation -{ - final IAnnotation jdtAnnotation; - - protected BinaryAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent); - this.jdtAnnotation = jdtAnnotation; - } - - - // ********** convenience methods ********** - - /** - * Return the values of the JDT annotation's member with the specified name. - */ - protected Object[] getJdtMemberValues(String memberName) { - Object[] values = (Object[]) this.getJdtMemberValue(memberName); - return (values != null) ? values : EMPTY_OBJECT_ARRAY; - } - private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; - - /** - * Return the value of the JDT annotation's member with the specified name. - */ - protected Object getJdtMemberValue(String memberName) { - IMemberValuePair pair = this.getJdtMemberValuePair(memberName); - return (pair == null) ? null : pair.getValue(); - } - - /** - * Return the JDT annotation's member-value pair with the specified name. - */ - private IMemberValuePair getJdtMemberValuePair(String memberName) { - for (IMemberValuePair pair : this.getJdtMemberValuePairs()) { - if (pair.getMemberName().equals(memberName)) { - return pair; - } - } - return null; - } - - private IMemberValuePair[] getJdtMemberValuePairs() { - try { - return this.jdtAnnotation.getMemberValuePairs(); - } catch (JavaModelException ex) { - JptJaxbCorePlugin.log(ex); - return EMPTY_MEMBER_VALUE_PAIR_ARRAY; - } - } - private static final IMemberValuePair[] EMPTY_MEMBER_VALUE_PAIR_ARRAY = new IMemberValuePair[0]; - - - // ********** Annotation implementation ********** - public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - public void newAnnotation() { - throw new UnsupportedOperationException(); - } - public void removeAnnotation() { - throw new UnsupportedOperationException(); - } - - // ********** NestableAnnotation implementation ********** - public void moveAnnotation(@SuppressWarnings("unused") int index) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryNode.java deleted file mode 100644 index 653f1bdc2d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryNode.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.AbstractJavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; - -/** - * Binary convenience methods - */ -// TODO hopefully this class can go away with some sort of refactoring of the -// source and binary hierarchies... -public abstract class BinaryNode - extends AbstractJavaResourceNode -{ - - // ********** construction ********** - - protected BinaryNode(JavaResourceNode parent) { - super(parent); - } - - - // ********** JavaResourceNode implementation ********** - - @Override - public IFile getFile() { - return null; // only BinaryPackageFragmentRoot has a file... - } - - public void update() { - // nothing by default - } - - public JavaResourceCompilationUnit getJavaResourceCompilationUnit() { - throw new UnsupportedOperationException(); - } - - public TextRange getTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public void initialize(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public void synchronizeWith(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorOrderAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorOrderAnnotation.java deleted file mode 100644 index 651dbc16eb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorOrderAnnotation.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; - -/** - * javax.xml.bind.annotation.XmlAccessorOrder - */ -public final class BinaryXmlAccessorOrderAnnotation - extends BinaryAnnotation - implements XmlAccessorOrderAnnotation -{ - private XmlAccessOrder value; - - - public BinaryXmlAccessorOrderAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - //*************** XmlAccessorOrderAnnotation implementation **************** - - // ***** value - public XmlAccessOrder getValue() { - return this.value; - } - - public void setValue(XmlAccessOrder value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(XmlAccessOrder value) { - XmlAccessOrder old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private XmlAccessOrder buildValue() { - return XmlAccessOrder.fromJavaAnnotationValue(this.getJdtMemberValue(JAXB.XML_ACCESSOR_ORDER__VALUE)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorTypeAnnotation.java deleted file mode 100644 index 4b4d94ecc9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAccessorTypeAnnotation.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAccessorType - */ -public final class BinaryXmlAccessorTypeAnnotation - extends BinaryAnnotation - implements XmlAccessorTypeAnnotation -{ - private XmlAccessType value; - - - public BinaryXmlAccessorTypeAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - //*************** XmlAccessorTypeAnnotation implementation **************** - - // ***** value - public XmlAccessType getValue() { - return this.value; - } - - public void setValue(XmlAccessType value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(XmlAccessType value) { - XmlAccessType old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private XmlAccessType buildValue() { - return XmlAccessType.fromJavaAnnotationValue(this.getJdtMemberValue(JAXB.XML_ACCESSOR_TYPE__VALUE)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyAttributeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyAttributeAnnotation.java deleted file mode 100644 index 4bfd81dbd9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyAttributeAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyAttributeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAnyAttribute - */ -public final class BinaryXmlAnyAttributeAnnotation - extends BinaryAnnotation - implements XmlAnyAttributeAnnotation -{ - - public BinaryXmlAnyAttributeAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyElementAnnotation.java deleted file mode 100644 index 09bd4937e7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAnyElementAnnotation.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlAnyElement - */ -public final class BinaryXmlAnyElementAnnotation - extends BinaryAnnotation - implements XmlAnyElementAnnotation -{ - private Boolean lax; - private String value; - - - public BinaryXmlAnyElementAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.lax = this.buildLax(); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setLax_(this.buildLax()); - this.setValue_(this.buildValue()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** XmlAnyElementAnnotation implementation ********** - - // ***** lax - public Boolean getLax() { - return this.lax; - } - - public void setLax(Boolean lax) { - throw new UnsupportedOperationException(); - } - - private void setLax_(Boolean lax) { - Boolean old = this.lax; - this.lax = lax; - this.firePropertyChanged(LAX_PROPERTY, old, lax); - } - - private Boolean buildLax() { - return (Boolean) this.getJdtMemberValue(JAXB.XML_ANY_ELEMENT__LAX); - } - - public TextRange getLaxTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - this.firePropertyChanged(FULLY_QUALIFIED_VALUE_CLASS_NAME_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JAXB.XML_ANY_ELEMENT__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified value class name - public String getFullyQualifiedValueClassName() { - return this.value; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttachmentRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttachmentRefAnnotation.java deleted file mode 100644 index decc7a278a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttachmentRefAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttachmentRefAnnotation; - -/** - * javax.xml.bind.annotation.XmlAttachmentRef - */ -public final class BinaryXmlAttachmentRefAnnotation - extends BinaryAnnotation - implements XmlAttachmentRefAnnotation -{ - - public BinaryXmlAttachmentRefAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttributeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttributeAnnotation.java deleted file mode 100644 index 44f0d3e9f9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlAttributeAnnotation.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAttribute - */ -public final class BinaryXmlAttributeAnnotation - extends BinaryAnnotation - implements XmlAttributeAnnotation -{ - private String name; - private String namespace; - private Boolean required; - - - public BinaryXmlAttributeAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.namespace = this.buildNamespace(); - this.required = this.buildRequired(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setNamespace_(this.buildNamespace()); - this.setRequired_(this.buildRequired()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlAttributeAnnotation implementation ********** - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JAXB.XML_ATTRIBUTE__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - - private void setNamespace_(String namespace) { - String old = this.namespace; - this.namespace = namespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - private String buildNamespace() { - return (String) this.getJdtMemberValue(JAXB.XML_ATTRIBUTE__NAMESPACE); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** required - public Boolean getRequired() { - return this.required; - } - - public void setRequired(Boolean required) { - throw new UnsupportedOperationException(); - } - - private void setRequired_(Boolean required) { - Boolean old = this.required; - this.required = required; - this.firePropertyChanged(REQUIRED_PROPERTY, old, required); - } - - private Boolean buildRequired() { - return (Boolean) this.getJdtMemberValue(JAXB.XML_ATTRIBUTE__REQUIRED); - } - - public TextRange getRequiredTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementAnnotation.java deleted file mode 100644 index 7e83bef0b4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementAnnotation.java +++ /dev/null @@ -1,210 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlElement - */ -public final class BinaryXmlElementAnnotation - extends BinaryAnnotation - implements XmlElementAnnotation -{ - private String name; - private String namespace; - private String defaultValue; - private Boolean nillable; - private Boolean required; - private String type; - - - public BinaryXmlElementAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.namespace = this.buildNamespace(); - this.defaultValue = this.buildDefaultValue(); - this.nillable = this.buildNillable(); - this.required = this.buildRequired(); - this.type = this.buildType(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setNamespace_(this.buildNamespace()); - this.setDefaultValue_(this.buildDefaultValue()); - this.setNillable_(this.buildNillable()); - this.setRequired_(this.buildRequired()); - this.setType_(this.buildType()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlElementAnnotation implementation ********** - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - - private void setNamespace_(String namespace) { - String old = this.namespace; - this.namespace = namespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - private String buildNamespace() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT__NAMESPACE); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** default value - public String getDefaultValue() { - return this.defaultValue; - } - - public void setDefaultValue(String defaultValue) { - throw new UnsupportedOperationException(); - } - - private void setDefaultValue_(String defaultValue) { - String old = this.defaultValue; - this.defaultValue = defaultValue; - this.firePropertyChanged(DEFAULT_VALUE_PROPERTY, old, defaultValue); - } - - private String buildDefaultValue() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT__DEFAULT_VALUE); - } - - public TextRange getDefaultValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** nillable - public Boolean getNillable() { - return this.nillable; - } - - public void setNillable(Boolean nillable) { - throw new UnsupportedOperationException(); - } - - private void setNillable_(Boolean nillable) { - Boolean old = this.nillable; - this.nillable = nillable; - this.firePropertyChanged(NILLABLE_PROPERTY, old, nillable); - } - - private Boolean buildNillable() { - return (Boolean) this.getJdtMemberValue(JAXB.XML_ELEMENT__NILLABLE); - } - - public TextRange getNillableTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** required - public Boolean getRequired() { - return this.required; - } - - public void setRequired(Boolean required) { - throw new UnsupportedOperationException(); - } - - private void setRequired_(Boolean required) { - Boolean old = this.required; - this.required = required; - this.firePropertyChanged(REQUIRED_PROPERTY, old, required); - } - - private Boolean buildRequired() { - return (Boolean) this.getJdtMemberValue(JAXB.XML_ELEMENT__REQUIRED); - } - - public TextRange getRequiredTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** type - public String getType() { - return this.type; - } - - public void setType(String type) { - throw new UnsupportedOperationException(); - } - - private void setType_(String type) { - String old = this.type; - this.type = type; - this.firePropertyChanged(TYPE_PROPERTY, old, type); - this.firePropertyChanged(FULLY_QUALIFIED_TYPE_NAME_PROPERTY, old, type); - } - - private String buildType() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT__TYPE); - } - - public TextRange getTypeTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified type name - public String getFullyQualifiedTypeName() { - return this.type; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementDeclAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementDeclAnnotation.java deleted file mode 100644 index 3f418fa470..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementDeclAnnotation.java +++ /dev/null @@ -1,209 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementDeclAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementDecl - */ -public final class BinaryXmlElementDeclAnnotation - extends BinaryAnnotation - implements XmlElementDeclAnnotation -{ - private String name; - private String namespace; - private String defaultValue; - private String scope; - private String substitutionHeadName; - private String substitutionHeadNamespace; - - - public BinaryXmlElementDeclAnnotation(JavaResourceMethod parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.namespace = this.buildNamespace(); - this.defaultValue = this.buildDefaultValue(); - this.scope = this.buildScope(); - this.substitutionHeadName = this.buildSubstitutionHeadName(); - this.substitutionHeadNamespace = this.buildSubstitutionHeadNamespace(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setNamespace_(this.buildNamespace()); - this.setDefaultValue_(this.buildDefaultValue()); - this.setScope_(this.buildScope()); - this.setSubstitutionHeadName_(this.buildSubstitutionHeadName()); - this.setSubstitutionHeadNamespace_(this.buildSubstitutionHeadNamespace()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlElementDeclAnnotation implementation ********** - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_DECL__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - - private void setNamespace_(String namespace) { - String old = this.namespace; - this.namespace = namespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - private String buildNamespace() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_DECL__NAMESPACE); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** default value - public String getDefaultValue() { - return this.defaultValue; - } - - public void setDefaultValue(String defaultValue) { - throw new UnsupportedOperationException(); - } - - private void setDefaultValue_(String defaultValue) { - String old = this.defaultValue; - this.defaultValue = defaultValue; - this.firePropertyChanged(DEFAULT_VALUE_PROPERTY, old, defaultValue); - } - - private String buildDefaultValue() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_DECL__DEFAULT_VALUE); - } - - public TextRange getDefaultValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** scope - public String getScope() { - return this.scope; - } - - public void setScope(String scope) { - throw new UnsupportedOperationException(); - } - - private void setScope_(String scope) { - String old = this.scope; - this.scope = scope; - this.firePropertyChanged(SCOPE_PROPERTY, old, scope); - this.firePropertyChanged(FULLY_QUALIFIED_SCOPE_CLASS_NAME_PROPERTY, old, scope); - } - - private String buildScope() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_DECL__SCOPE); - } - - public TextRange getScopeTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified scope class name - public String getFullyQualifiedScopeClassName() { - return this.scope; - } - - // ***** substitutionHeadName - public String getSubstitutionHeadName() { - return this.substitutionHeadName; - } - - public void setSubstitutionHeadName(String substitutionHeadName) { - throw new UnsupportedOperationException(); - } - - private void setSubstitutionHeadName_(String substitutionHeadName) { - String old = this.substitutionHeadName; - this.substitutionHeadName = substitutionHeadName; - this.firePropertyChanged(SUBSTITUTION_HEAD_NAME_PROPERTY, old, substitutionHeadName); - } - - private String buildSubstitutionHeadName() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_DECL__SUBSTITUTION_HEAD_NAME); - } - - public TextRange getSubstitutionHeadNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** substitutionHeadNamespace - public String getSubstitutionHeadNamespace() { - return this.substitutionHeadNamespace; - } - - public void setSubstitutionHeadNamespace(String substitutionHeadNamespace) { - throw new UnsupportedOperationException(); - } - - private void setSubstitutionHeadNamespace_(String substitutionHeadNamespace) { - String old = this.substitutionHeadNamespace; - this.substitutionHeadNamespace = substitutionHeadNamespace; - this.firePropertyChanged(SUBSTITUTION_HEAD_NAMESPACE_PROPERTY, old, substitutionHeadNamespace); - } - - private String buildSubstitutionHeadNamespace() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_DECL__SUBSTITUTION_HEAD_NAMESPACE); - } - - public TextRange getSubstitutionHeadNamespaceTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefAnnotation.java deleted file mode 100644 index 685e505318..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementRefAnnotation.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementRef - */ -public final class BinaryXmlElementRefAnnotation - extends BinaryAnnotation - implements XmlElementRefAnnotation -{ - private String name; - private String namespace; - private String type; - - - public BinaryXmlElementRefAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.namespace = this.buildNamespace(); - this.type = this.buildType(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setNamespace_(this.buildNamespace()); - this.setType_(this.buildType()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlElementRefAnnotation implementation ********** - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_REF__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - - private void setNamespace_(String namespace) { - String old = this.namespace; - this.namespace = namespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - private String buildNamespace() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_REF__NAMESPACE); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** type - public String getType() { - return this.type; - } - - public void setType(String type) { - throw new UnsupportedOperationException(); - } - - private void setType_(String type) { - String old = this.type; - this.type = type; - this.firePropertyChanged(TYPE_PROPERTY, old, type); - this.firePropertyChanged(FULLY_QUALIFIED_TYPE_NAME_PROPERTY, old, type); - } - - private String buildType() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_REF__TYPE); - } - - public TextRange getTypeTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified type name - public String getFullyQualifiedTypeName() { - return this.type; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementWrapperAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementWrapperAnnotation.java deleted file mode 100644 index 942fcb50eb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementWrapperAnnotation.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementWrapper - */ -public final class BinaryXmlElementWrapperAnnotation - extends BinaryAnnotation - implements XmlElementWrapperAnnotation -{ - private String name; - private String namespace; - private Boolean nillable; - private Boolean required; - - - public BinaryXmlElementWrapperAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.namespace = this.buildNamespace(); - this.nillable = this.buildNillable(); - this.required = this.buildRequired(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setNamespace_(this.buildNamespace()); - this.setNillable_(this.buildNillable()); - this.setRequired_(this.buildRequired()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlElementWrapperAnnotation implementation ********** - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_WRAPPER__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - - private void setNamespace_(String namespace) { - String old = this.namespace; - this.namespace = namespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - private String buildNamespace() { - return (String) this.getJdtMemberValue(JAXB.XML_ELEMENT_WRAPPER__NAMESPACE); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** nillable - public Boolean getNillable() { - return this.nillable; - } - - public void setNillable(Boolean nillable) { - throw new UnsupportedOperationException(); - } - - private void setNillable_(Boolean nillable) { - Boolean old = this.nillable; - this.nillable = nillable; - this.firePropertyChanged(NILLABLE_PROPERTY, old, nillable); - } - - private Boolean buildNillable() { - return (Boolean) this.getJdtMemberValue(JAXB.XML_ELEMENT_WRAPPER__NILLABLE); - } - - public TextRange getNillableTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** required - public Boolean getRequired() { - return this.required; - } - - public void setRequired(Boolean required) { - throw new UnsupportedOperationException(); - } - - private void setRequired_(Boolean required) { - Boolean old = this.required; - this.required = required; - this.firePropertyChanged(REQUIRED_PROPERTY, old, required); - } - - private Boolean buildRequired() { - return (Boolean) this.getJdtMemberValue(JAXB.XML_ELEMENT_WRAPPER__REQUIRED); - } - - public TextRange getRequiredTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementsAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementsAnnotation.java deleted file mode 100644 index 9cfa9a45a6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlElementsAnnotation.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import java.util.Vector; -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementsAnnotation; - -/** - * javax.xml.bind.annotation.XmlElements - */ -public final class BinaryXmlElementsAnnotation - extends BinaryAnnotation - implements XmlElementsAnnotation -{ - private final Vector xmlElements; - - - public BinaryXmlElementsAnnotation(JavaResourceAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.xmlElements = this.buildXmlElements(); - } - - private Vector buildXmlElements() { - Object[] jdtXmlElements = this.getJdtMemberValues(JAXB.XML_ELEMENTS__VALUE); - Vector result = new Vector(jdtXmlElements.length); - for (Object jdtXmlElement : jdtXmlElements) { - result.add(new BinaryXmlElementAnnotation(this, (IAnnotation) jdtXmlElement)); - } - return result; - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public ListIterable getXmlElements() { - return new LiveCloneListIterable(this.xmlElements); - } - - public int getXmlElementsSize() { - return this.xmlElements.size(); - } - - public XmlElementAnnotation xmlElementAt(int index) { - return this.xmlElements.elementAt(index); - } - - public XmlElementAnnotation addXmlElement(int index) { - throw new UnsupportedOperationException(); - } - - public void moveXmlElement(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeXmlElement(int index) { - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumAnnotation.java deleted file mode 100644 index 614530f01e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumAnnotation.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumAnnotation; - -/** - * javax.xml.bind.annotation.XmlEnum - */ -public final class BinaryXmlEnumAnnotation - extends BinaryAnnotation - implements XmlEnumAnnotation -{ - private String value; - - - public BinaryXmlEnumAnnotation(AbstractJavaResourceType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** XmlEnum implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - this.firePropertyChanged(FULLY_QUALIFIED_VALUE_CLASS_NAME_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JAXB.XML_ENUM__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified value class name - public String getFullyQualifiedValueClassName() { - return this.value; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumValueAnnotation.java deleted file mode 100644 index e726a7a6c7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlEnumValueAnnotation.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation; - -/** - * javax.xml.bind.annotation.XmlEnumValue - */ -public final class BinaryXmlEnumValueAnnotation - extends BinaryAnnotation - implements XmlEnumValueAnnotation -{ - - private String value; - - public BinaryXmlEnumValueAnnotation(JavaResourceEnumConstant parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** XmlEnumValueAnnotation implementation ********** - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JAXB.XML_ENUM_VALUE__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDAnnotation.java deleted file mode 100644 index cbc80e7c93..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDAnnotation; - -/** - * javax.xml.bind.annotation.XmlID - */ -public final class BinaryXmlIDAnnotation - extends BinaryAnnotation - implements XmlIDAnnotation -{ - - public BinaryXmlIDAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDREFAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDREFAnnotation.java deleted file mode 100644 index 76fab01bb1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlIDREFAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation; - -/** - * javax.xml.bind.annotation.XmlIDREF - */ -public final class BinaryXmlIDREFAnnotation - extends BinaryAnnotation - implements XmlIDREFAnnotation -{ - - public BinaryXmlIDREFAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlInlineBinaryDataAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlInlineBinaryDataAnnotation.java deleted file mode 100644 index c06a25dc4d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlInlineBinaryDataAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlInlineBinaryDataAnnotation; - -/** - * javax.xml.bind.annotation.XmlInlineBinaryDataAnnotation - */ -public final class BinaryXmlInlineBinaryDataAnnotation - extends BinaryAnnotation - implements XmlInlineBinaryDataAnnotation -{ - - public BinaryXmlInlineBinaryDataAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlJavaTypeAdapterAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlJavaTypeAdapterAnnotation.java deleted file mode 100644 index 5ebee1b2f3..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlJavaTypeAdapterAnnotation.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; - -/** - * javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter - */ -public final class BinaryXmlJavaTypeAdapterAnnotation - extends BinaryAnnotation - implements XmlJavaTypeAdapterAnnotation { - - private String value; - - private String type; - - - public BinaryXmlJavaTypeAdapterAnnotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = buildValue(); - this.type = buildType(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - setValue_(buildValue()); - setType_(buildType()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** XmlJavaTypeAdapterAnnotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - this.firePropertyChanged(FULLY_QUALIFIED_VALUE_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JAXB.XML_JAVA_TYPE_ADAPTER__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public String getFullyQualifiedValue() { - return this.value; - } - - // ***** type - public String getType() { - return this.type; - } - - public void setType(String type) { - throw new UnsupportedOperationException(); - } - - private void setType_(String type) { - String old = this.type; - this.type = type; - this.firePropertyChanged(TYPE_PROPERTY, old, type); - this.firePropertyChanged(FULLY_QUALIFIED_TYPE_PROPERTY, old, type); - } - - private String buildType() { - return (String) this.getJdtMemberValue(JAXB.XML_JAVA_TYPE_ADAPTER__TYPE); - } - - public TextRange getTypeTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public String getFullyQualifiedType() { - return this.type; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlListAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlListAnnotation.java deleted file mode 100644 index e41b57feb9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlListAnnotation.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation; - -/** - * javax.xml.bind.annotation.XmlList - */ -public final class BinaryXmlListAnnotation - extends BinaryAnnotation - implements XmlListAnnotation -{ - - public BinaryXmlListAnnotation(JavaResourceMember - parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMimeTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMimeTypeAnnotation.java deleted file mode 100644 index a7fd90a62e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMimeTypeAnnotation.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlMimeTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlMimeType - */ -public final class BinaryXmlMimeTypeAnnotation - extends BinaryAnnotation - implements XmlMimeTypeAnnotation -{ - - private String value; - - public BinaryXmlMimeTypeAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** XmlMimeTypeAnnotation implementation ********** - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JAXB.XML_MIME_TYPE__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMixedAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMixedAnnotation.java deleted file mode 100644 index 3897ba916d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlMixedAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation; - -/** - * javax.xml.bind.annotation.XmlMixed - */ -public final class BinaryXmlMixedAnnotation - extends BinaryAnnotation - implements XmlMixedAnnotation -{ - - public BinaryXmlMixedAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRegistryAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRegistryAnnotation.java deleted file mode 100644 index 1628c5b31e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRegistryAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRegistryAnnotation; - -/** - * javax.xml.bind.annotation.XmlRegistry - */ -public final class BinaryXmlRegistryAnnotation - extends BinaryAnnotation - implements XmlRegistryAnnotation -{ - - public BinaryXmlRegistryAnnotation(AbstractJavaResourceType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRootElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRootElementAnnotation.java deleted file mode 100644 index d25a4ba740..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlRootElementAnnotation.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlRootElement - */ -public final class BinaryXmlRootElementAnnotation - extends BinaryAnnotation - implements XmlRootElementAnnotation -{ - private String name; - private String namespace; - - - public BinaryXmlRootElementAnnotation(AbstractJavaResourceType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.name = this.buildName(); - this.namespace = this.buildNamespace(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setName_(this.buildName()); - this.setNamespace_(this.buildNamespace()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlRootElementAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JAXB.XML_ROOT_ELEMENT__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - - private void setNamespace_(String namespace) { - String old = this.namespace; - this.namespace = namespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - private String buildNamespace() { - return (String) this.getJdtMemberValue(JAXB.XML_ROOT_ELEMENT__NAMESPACE); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSeeAlsoAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSeeAlsoAnnotation.java deleted file mode 100644 index 65188db758..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlSeeAlsoAnnotation.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import java.util.Vector; -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSeeAlsoAnnotation; - -/** - * javax.xml.bind.annotation.XmlSeeAlso - */ -public final class BinaryXmlSeeAlsoAnnotation - extends BinaryAnnotation - implements XmlSeeAlsoAnnotation -{ - private final Vector classes; - - - public BinaryXmlSeeAlsoAnnotation(AbstractJavaResourceType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.classes = this.buildClasses(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.updateClasses(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.classes); - } - - - // ********** XmlSeeAlsoAnnotation implementation ********** - - // ***** value - public ListIterable getClasses() { - return new LiveCloneListIterable(this.classes); - } - - public int getClassesSize() { - return this.classes.size(); - } - - private Vector buildClasses() { - Object[] jdtClasses = this.getJdtMemberValues(JAXB.XML_SEE_ALSO__VALUE); - Vector result = new Vector(jdtClasses.length); - for (Object jdtClass : jdtClasses) { - result.add((String) jdtClass); - } - return result; - } - - public void addClass(String clazz) { - throw new UnsupportedOperationException(); - } - - public void addClass(int index, String clazz) { - throw new UnsupportedOperationException(); - } - - public void moveClass(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeClass(String clazz) { - throw new UnsupportedOperationException(); - } - - public void removeClass(int index) { - throw new UnsupportedOperationException(); - } - - // TODO - private void updateClasses() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTransientAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTransientAnnotation.java deleted file mode 100644 index 81c43cbd10..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTransientAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTransientAnnotation; - -/** - * javax.xml.bind.annotation.XmlTransient - */ -public final class BinaryXmlTransientAnnotation - extends BinaryAnnotation - implements XmlTransientAnnotation -{ - - public BinaryXmlTransientAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTypeAnnotation.java deleted file mode 100644 index 70ae5bbc18..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlTypeAnnotation.java +++ /dev/null @@ -1,212 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import java.util.Vector; -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlType - */ -public final class BinaryXmlTypeAnnotation - extends BinaryAnnotation - implements XmlTypeAnnotation -{ - private String factoryClass; - private String factoryMethod; - private String name; - private String namespace; - private final Vector propOrder; - - - public BinaryXmlTypeAnnotation(AbstractJavaResourceType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.factoryClass = this.buildFactoryClass(); - this.factoryMethod = this.buildFactoryMethod(); - this.name = this.buildName(); - this.namespace = this.buildNamespace(); - this.propOrder = this.buildPropOrder(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setFactoryClass_(this.buildFactoryClass()); - this.setFactoryMethod_(this.buildFactoryMethod()); - this.setName_(this.buildName()); - this.setNamespace_(this.buildNamespace()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlTypeAnnotation implementation ********** - - // ***** factoryClass - public String getFactoryClass() { - return this.factoryClass; - } - - public void setFactoryClass(String factoryClass) { - throw new UnsupportedOperationException(); - } - - private void setFactoryClass_(String factoryClass) { - String old = this.factoryClass; - this.factoryClass = factoryClass; - this.firePropertyChanged(FACTORY_CLASS_PROPERTY, old, factoryClass); - this.firePropertyChanged(FULLY_QUALIFIED_FACTORY_CLASS_NAME_PROPERTY, old, factoryClass); - } - - private String buildFactoryClass() { - return (String) this.getJdtMemberValue(JAXB.XML_TYPE__FACTORY_CLASS); - } - - public TextRange getFactoryClassTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified factory class name - public String getFullyQualifiedFactoryClassName() { - return this.factoryClass; - } - - // ***** factoryMethod - public String getFactoryMethod() { - return this.factoryMethod; - } - - public void setFactoryMethod(String factoryMethod) { - throw new UnsupportedOperationException(); - } - - private void setFactoryMethod_(String factoryMethod) { - String old = this.factoryMethod; - this.factoryMethod = factoryMethod; - this.firePropertyChanged(FACTORY_METHOD_PROPERTY, old, factoryMethod); - } - - private String buildFactoryMethod() { - return (String) this.getJdtMemberValue(JAXB.XML_TYPE__FACTORY_METHOD); - } - - public TextRange getFactoryMethodTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - throw new UnsupportedOperationException(); - } - - private void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - private String buildName() { - return (String) this.getJdtMemberValue(JAXB.XML_TYPE__NAME); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - throw new UnsupportedOperationException(); - } - - private void setNamespace_(String namespace) { - String old = this.namespace; - this.namespace = namespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - private String buildNamespace() { - return (String) this.getJdtMemberValue(JAXB.XML_TYPE__NAMESPACE); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - - // ***** prop order - public ListIterable getPropOrder() { - return new LiveCloneListIterable(this.propOrder); - } - - public int getPropOrderSize() { - return this.propOrder.size(); - } - - private Vector buildPropOrder() { - Object[] jdtPropOrder = this.getJdtMemberValues(JAXB.XML_TYPE__PROP_ORDER); - Vector result = new Vector(jdtPropOrder.length); - for (Object jdtProp : jdtPropOrder) { - result.add((String) jdtProp); - } - return result; - } - - public void addProp(String propOrder) { - throw new UnsupportedOperationException(); - } - - public void addProp(int index, String propOrder) { - throw new UnsupportedOperationException(); - } - - public void moveProp(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeProp(String propOrder) { - throw new UnsupportedOperationException(); - } - - public void removeProp(int index) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlValueAnnotation.java deleted file mode 100644 index d07f3d990c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/binary/BinaryXmlValueAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation; - -/** - * javax.xml.bind.annotation.XmlValue - */ -public final class BinaryXmlValueAnnotation - extends BinaryAnnotation - implements XmlValueAnnotation -{ - - public BinaryXmlValueAnnotation(JavaResourceMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/AbstractJavaResourceNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/AbstractJavaResourceNode.java deleted file mode 100644 index c2ddcd153b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/AbstractJavaResourceNode.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.AspectChangeSupport; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.jaxb.core.AnnotationProvider; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; - -/** - * Java resource containment hierarchy - */ -public abstract class AbstractJavaResourceNode - extends AbstractModel - implements JavaResourceNode -{ - protected final JavaResourceNode parent; - - - // ********** constructor ********** - - protected AbstractJavaResourceNode(JavaResourceNode parent) { - super(); - this.checkParent(parent); - this.parent = parent; - } - - protected JavaResourceNode getParent() { - return this.parent; - } - - // ********** parent ********** - - protected void checkParent(JavaResourceNode p) { - if (p == null) { - if (this.requiresParent()) { - throw new IllegalArgumentException("'parent' cannot be null"); //$NON-NLS-1$ - } - } else { - if (this.forbidsParent()) { - throw new IllegalArgumentException("'parent' must be null"); //$NON-NLS-1$ - } - } - } - - protected boolean requiresParent() { - return true; - } - - protected boolean forbidsParent() { - return ! this.requiresParent(); // assume 'parent' is not optional - } - - - // ********** change support callback hook ********** - - @Override - protected final ChangeSupport buildChangeSupport() { - return new AspectChangeSupport(this, this.buildChangeSupportListener()); - } - - private AspectChangeSupport.Listener buildChangeSupportListener() { - return new AspectChangeSupport.Listener() { - public void aspectChanged(String aspectName) { - AbstractJavaResourceNode.this.aspectChanged(aspectName); - } - }; - } - - /** - * ignore the aspect name, we notify listeners of *every* change - */ - protected void aspectChanged(@SuppressWarnings("unused") String aspectName) { - this.getRoot().resourceModelChanged(); - } - - - // ********** JavaResourceNode implementation ********** - - /** - * @see org.eclipse.jpt.core.internal.resource.java.source.SourceCompilationUnit#getRoot() - * @see org.eclipse.jpt.core.internal.resource.java.binary.BinaryPackageFragmentRoot#getRoot() - * @see org.eclipse.jpt.core.internal.resource.java.binary.BinaryPersistentTypeCache#getRoot() - */ - public Root getRoot() { - return this.parent.getRoot(); - } - - public IFile getFile() { - return this.getRoot().getFile(); - } - - - // ********** convenience methods ********** - - protected AnnotationProvider getAnnotationProvider() { - return this.getRoot().getAnnotationProvider(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAbstractType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAbstractType.java deleted file mode 100644 index 1f5a0ba8e2..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAbstractType.java +++ /dev/null @@ -1,194 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import java.util.HashMap; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.SimpleIntReference; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; - -/** - * Java source type - */ -abstract class SourceAbstractType - extends SourceMember - implements AbstractJavaResourceType -{ - private String name; - - private String qualifiedName; - - private String packageName; - - private String declaringTypeName; - - private boolean memberType; - - - // ********** construction/initialization ********** - - protected SourceAbstractType(JavaResourceCompilationUnit javaResourceCompilationUnit, A type) { - super(javaResourceCompilationUnit, type); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - ITypeBinding binding = this.annotatedElement.getBinding(astRoot); - this.name = this.buildName(binding); - this.qualifiedName = this.buildQualifiedName(binding); - this.packageName = this.buildPackageName(binding); - this.declaringTypeName = this.buildDeclaringTypeName(binding); - this.memberType = this.buildMemberType(binding); - } - - - // ********** update ********** - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - ITypeBinding binding = this.annotatedElement.getBinding(astRoot); - this.syncName(this.buildName(binding)); - this.syncQualifiedName(this.buildQualifiedName(binding)); - this.syncPackageName(this.buildPackageName(binding)); - this.syncDeclaringTypeName(this.buildDeclaringTypeName(binding)); - this.syncMemberType(this.buildMemberType(binding)); - } - - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ******** JavaResourceAbstractType implementation ******** - - // ***** name - public String getName() { - return this.name; - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(ITypeBinding binding) { - return (binding == null) ? null : binding.getName(); - } - - // ***** qualified name - public String getQualifiedName() { - return this.qualifiedName; - } - - private void syncQualifiedName(String astQualifiedName) { - String old = this.qualifiedName; - this.qualifiedName = astQualifiedName; - this.firePropertyChanged(QUALIFIED_NAME_PROPERTY, old, astQualifiedName); - } - - private String buildQualifiedName(ITypeBinding binding) { - return (binding == null) ? null : binding.getQualifiedName(); - } - - // ***** package name - public String getPackageName() { - return this.packageName; - } - - private void syncPackageName(String astPackageName) { - String old = this.packageName; - this.packageName = astPackageName; - this.firePropertyChanged(PACKAGE_NAME_PROPERTY, old, astPackageName); - } - - private String buildPackageName(ITypeBinding binding) { - return (binding == null) ? null : binding.getPackage().getName(); - } - - // ***** package - public boolean isIn(IPackageFragment packageFragment) { - return StringTools.stringsAreEqual(packageFragment.getElementName(), this.packageName); - } - - // ***** declaring type name - public String getDeclaringTypeName() { - return this.declaringTypeName; - } - - private void syncDeclaringTypeName(String astDeclaringTypeName) { - String old = this.declaringTypeName; - this.declaringTypeName = astDeclaringTypeName; - this.firePropertyChanged(DECLARING_TYPE_NAME_PROPERTY, old, astDeclaringTypeName); - } - - private String buildDeclaringTypeName(ITypeBinding binding) { - if (binding == null) { - return null; - } - ITypeBinding declaringClass = binding.getDeclaringClass(); - return (declaringClass == null) ? null : declaringClass.getTypeDeclaration().getQualifiedName(); - } - - // ***** member type - public boolean isMemberType() { - return this.memberType; - } - - private void syncMemberType(boolean memberType) { - boolean old = this.memberType; - this.memberType = memberType; - this.firePropertyChanged(MEMBER_TYPE_PROPERTY, old, memberType); - } - - private boolean buildMemberType(ITypeBinding binding) { - return (binding == null) ? false : binding.isMember(); - } - - public boolean isMapped() { - return ! CollectionTools.isEmpty(getAnnotations()); - } - - - // ********** CounterMap ********** - - protected static class CounterMap { - private final HashMap counters; - - protected CounterMap(int initialCapacity) { - super(); - this.counters = new HashMap(initialCapacity); - } - - /** - * Return the incremented count for the specified object. - */ - int increment(Object o) { - SimpleIntReference counter = this.counters.get(o); - if (counter == null) { - counter = new SimpleIntReference(); - this.counters.put(o, counter); - } - counter.increment(); - return counter.getValue(); - } - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotatedElement.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotatedElement.java deleted file mode 100644 index f92161e939..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotatedElement.java +++ /dev/null @@ -1,500 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; -import java.util.Vector; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.ASTVisitor; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTNodeTextRange; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotation; - -/** - * Java source annotated element (annotations) - */ -abstract class SourceAnnotatedElement - extends SourceNode - implements JavaResourceAnnotatedElement -{ - final A annotatedElement; - - /** - * annotations; no duplicates (java compiler has an error for duplicates) - */ - final Vector annotations = new Vector(); - - /** - * Annotation containers keyed on nestable annotation name. - * This is used to store annotations that can be both standalone and nested - * and are moved back and forth between the 2. - */ - final Map annotationContainers = new HashMap(); - - // ********** construction/initialization ********** - - SourceAnnotatedElement(JavaResourceNode parent, A annotatedElement) { - super(parent); - this.annotatedElement = annotatedElement; - } - - public void initialize(CompilationUnit astRoot) { - ASTNode node = this.annotatedElement.getBodyDeclaration(astRoot); - node.accept(this.buildInitialAnnotationVisitor(node)); - } - - private ASTVisitor buildInitialAnnotationVisitor(ASTNode node) { - return new InitialAnnotationVisitor(node); - } - - /** - * called from {@link InitialAnnotationVisitor} - */ - /* private */ void addInitialAnnotation(org.eclipse.jdt.core.dom.Annotation node) { - String jdtAnnotationName = ASTTools.resolveAnnotation(node); - if (jdtAnnotationName != null) { - if (this.annotationIsValid(jdtAnnotationName)) { - if (this.selectAnnotationNamed(this.annotations, jdtAnnotationName) == null) { // ignore duplicates - Annotation annotation = this.buildAnnotation(jdtAnnotationName); - annotation.initialize((CompilationUnit) node.getRoot()); - this.annotations.add(annotation); - } - } - else if(this.annotationIsValidNestable(jdtAnnotationName)) { - AnnotationContainer container = new AnnotationContainer(jdtAnnotationName); - container.initializeNestableAnnotation(node); - this.annotationContainers.put(jdtAnnotationName, container); - } - else if(this.annotationIsValidContainer(jdtAnnotationName)) { - String nestableAnnotationName = this.getNestableAnnotationName(jdtAnnotationName); - AnnotationContainer container = new AnnotationContainer(nestableAnnotationName); - container.initialize(node); - this.annotationContainers.put(nestableAnnotationName, container); - } - } - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncAnnotations(this.annotatedElement.getBodyDeclaration(astRoot)); - } - - - // ********** annotations ********** - - public Iterable getAnnotations() { - return new LiveCloneIterable(this.annotations); - } - - public int getAnnotationsSize() { - return this.annotations.size(); - } - - public Annotation getAnnotation(String annotationName) { - return this.selectAnnotationNamed(this.getAnnotations(), annotationName); - } - - public Annotation getNonNullAnnotation(String annotationName) { - Annotation annotation = this.getAnnotation(annotationName); - return (annotation != null) ? annotation : this.buildNullAnnotation(annotationName); - } - - public ListIterable getAnnotations(String nestableAnnotationName) { - AnnotationContainer container = this.annotationContainers.get(nestableAnnotationName); - return container != null ? container.getNestedAnnotations() : EmptyListIterable. instance(); - } - - public int getAnnotationsSize(String nestableAnnotationName) { - AnnotationContainer container = this.annotationContainers.get(nestableAnnotationName); - return container == null ? 0 : container.getNestedAnnotationsSize(); - } - - public NestableAnnotation getAnnotation(int index, String nestableAnnotationName) { - AnnotationContainer container = this.annotationContainers.get(nestableAnnotationName); - return container == null ? null : container.nestedAnnotationAt(index); - } - - private String getNestableAnnotationName(String containerAnnotationName) { - return getAnnotationProvider().getNestableAnnotationName(containerAnnotationName); - } - - private String getNestableElementName(String nestableAnnotationName) { - return getAnnotationProvider().getNestableElementName(nestableAnnotationName); - } - - public Annotation addAnnotation(String annotationName) { - Annotation annotation = this.buildAnnotation(annotationName); - this.annotations.add(annotation); - annotation.newAnnotation(); - return annotation; - } - - /** - * 1. check for a container annotation; - * if it is present, add a nested annotation to it - * 2. check for a stand-alone nested annotation; - * if it is missing, add a stand-alone nested annotation - * 3. if there is an existing stand-alone nested annotation, - * add a container annotation and move the stand-alone nested annotation to it - * and add a new nested annotation to it also - */ - public NestableAnnotation addAnnotation(int index, String nestableAnnotationName) { - AnnotationContainer container = this.annotationContainers.get(nestableAnnotationName); - if (container == null) { - container = new AnnotationContainer(nestableAnnotationName); - this.annotationContainers.put(nestableAnnotationName, container); - } - return container.addNestedAnnotation(index); - } - - public void moveAnnotation(int targetIndex, int sourceIndex, String nestableAnnotationName) { - this.annotationContainers.get(nestableAnnotationName).moveNestedAnnotation(targetIndex, sourceIndex); - } - - public void removeAnnotation(String annotationName) { - Annotation annotation = this.getAnnotation(annotationName); - if (annotation != null) { - this.removeAnnotation(annotation); - } - } - - private void removeAnnotation(Annotation annotation) { - this.annotations.remove(annotation); - annotation.removeAnnotation(); - } - - public void removeAnnotation(int index, String nestableAnnotationName) { - this.annotationContainers.get(nestableAnnotationName).removeNestedAnnotation(index); - } - - private boolean annotationIsValid(String annotationName) { - return CollectionTools.contains(this.getValidAnnotationNames(), annotationName); - } - - private boolean annotationIsValidContainer(String annotationName) { - return CollectionTools.contains(this.getValidContainerAnnotationNames(), annotationName); - } - - private boolean annotationIsValidNestable(String annotationName) { - return CollectionTools.contains(this.getValidNestableAnnotationNames(), annotationName); - } - - Iterable getValidAnnotationNames() { - return this.getAnnotationProvider().getAnnotationNames(); - } - - Iterable getValidContainerAnnotationNames() { - return this.getAnnotationProvider().getContainerAnnotationNames(); - } - - Iterable getValidNestableAnnotationNames() { - return this.getAnnotationProvider().getNestableAnnotationNames(); - } - - Annotation buildAnnotation(String annotationName) { - return this.getAnnotationProvider().buildAnnotation(this, this.annotatedElement, annotationName); - } - - Annotation buildNullAnnotation(String annotationName) { - return this.getAnnotationProvider().buildNullAnnotation(this, annotationName); - } - - NestableAnnotation buildNestableAnnotation(String annotationName, int index) { - return this.getAnnotationProvider().buildAnnotation(this, this.annotatedElement, annotationName, index); - } - - private void syncAnnotations(ASTNode node) { - HashSet annotationsToRemove = new HashSet(this.annotations); - - HashSet containersToRemove = new HashSet(this.annotationContainers.values()); - node.accept(this.buildSynchronizeAnnotationVisitor(node, annotationsToRemove, containersToRemove)); - - for (Annotation annotation : annotationsToRemove) { - this.removeItemFromCollection(annotation, this.annotations, ANNOTATIONS_COLLECTION); - } - - for (AnnotationContainer annotationContainer : containersToRemove) { - this.annotationContainers.remove(annotationContainer.getNestedAnnotationName()); - fireItemsRemoved(NESTABLE_ANNOTATIONS_COLLECTION, CollectionTools.collection(annotationContainer.getNestedAnnotations())); - } - - Iterator keys = this.annotationContainers.keySet().iterator(); - - while (keys.hasNext()) { - String annotationName = keys.next(); - if (this.annotationContainers.get(annotationName).getNestedAnnotationsSize() == 0) { - keys.remove(); - } - } - } - - private ASTVisitor buildSynchronizeAnnotationVisitor(ASTNode node, Set annotationsToRemove, Set containersToRemove) { - return new SynchronizeAnnotationVisitor(node, annotationsToRemove, containersToRemove); - } - - /** - * called from {@link SynchronizeAnnotationVisitor} - */ - /* private */ void addOrSyncAnnotation(org.eclipse.jdt.core.dom.Annotation node, Set annotationsToRemove, Set containersToRemove) { - String jdtAnnotationName = ASTTools.resolveAnnotation(node); - if (jdtAnnotationName != null) { - if (this.annotationIsValid(jdtAnnotationName)) { - this.addOrSyncAnnotation_(node, jdtAnnotationName, annotationsToRemove); - } - else if(this.annotationIsValidNestable(jdtAnnotationName)) { - this.addOrSyncNestableAnnotation_(node, jdtAnnotationName, containersToRemove); - } - else if(this.annotationIsValidContainer(jdtAnnotationName)) { - this.addOrSyncContainerAnnotation_(node, jdtAnnotationName, containersToRemove); - } - } - } - - /** - * pre-condition: jdtAnnotationName is valid - */ - private void addOrSyncAnnotation_(org.eclipse.jdt.core.dom.Annotation node, String jdtAnnotationName, Set annotationsToRemove) { - Annotation annotation = this.selectAnnotationNamed(annotationsToRemove, jdtAnnotationName); - if (annotation != null) { - annotation.synchronizeWith((CompilationUnit) node.getRoot()); - annotationsToRemove.remove(annotation); - } else { - annotation = this.buildAnnotation(jdtAnnotationName); - annotation.initialize((CompilationUnit) node.getRoot()); - this.addItemToCollection(annotation, this.annotations, ANNOTATIONS_COLLECTION); - } - } - - /** - * pre-condition: jdtAnnotationName is valid - */ - private void addOrSyncNestableAnnotation_(org.eclipse.jdt.core.dom.Annotation node, String nestableAnnotationName, Set containersToRemove) { - AnnotationContainer container = this.annotationContainers.get(nestableAnnotationName); - if (container != null) { - container.synchronizeNestableAnnotation(node); - containersToRemove.remove(container); - } - else { - container = new AnnotationContainer(nestableAnnotationName); - container.initializeNestableAnnotation(node); - this.annotationContainers.put(nestableAnnotationName, container); - this.fireItemAdded(NESTABLE_ANNOTATIONS_COLLECTION, container.nestedAnnotationAt(0)); - } - } - - /** - * pre-condition: node is valid container annotation - */ - private void addOrSyncContainerAnnotation_(org.eclipse.jdt.core.dom.Annotation node, String containerAnnotationName, Set containersToRemove) { - String nestableAnnotationName = this.getNestableAnnotationName(containerAnnotationName); - AnnotationContainer container = this.annotationContainers.get(nestableAnnotationName); - if (container == null) { - container = new AnnotationContainer(nestableAnnotationName); - container.initialize(node); - this.annotationContainers.put(nestableAnnotationName, container); - this.fireItemsAdded(NESTABLE_ANNOTATIONS_COLLECTION, CollectionTools.collection(container.getNestedAnnotations())); - } - else { - container.synchronize(node); - containersToRemove.remove(container); - } - } - - - // ********** miscellaneous ********** - - public boolean isAnnotated() { - return ! this.annotations.isEmpty() || ! this.annotationContainers.isEmpty(); - } - - public TextRange getTextRange(CompilationUnit astRoot) { - return this.fullTextRange(astRoot); - } - - private TextRange fullTextRange(CompilationUnit astRoot) { - return this.buildTextRange(this.annotatedElement.getBodyDeclaration(astRoot)); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.annotatedElement.getNameTextRange(astRoot); - } - - private Annotation selectAnnotationNamed(Iterable list, String annotationName) { - for (Annotation annotation : list) { - if (annotation.getAnnotationName().equals(annotationName)) { - return annotation; - } - } - return null; - } - - private TextRange buildTextRange(ASTNode astNode) { - return (astNode == null) ? null : new ASTNodeTextRange(astNode); - } - - - // ********** AST visitors ********** - - /** - * annotation visitor - */ - protected static abstract class AnnotationVisitor - extends ASTVisitor - { - protected final ASTNode node; - - - protected AnnotationVisitor(ASTNode node) { - super(); - this.node = node; - } - - @Override - public boolean visit(SingleMemberAnnotation node) { - return this.visit_(node); - } - - @Override - public boolean visit(NormalAnnotation node) { - return this.visit_(node); - } - - @Override - public boolean visit(MarkerAnnotation node) { - return this.visit_(node); - } - - protected boolean visit_(org.eclipse.jdt.core.dom.Annotation node) { - // ignore annotations for child members, only this member - if (node.getParent() == this.node) { - this.visitChildAnnotation(node); - } - return false; - } - - protected abstract void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation node); - } - - - /** - * initial annotation visitor - */ - protected class InitialAnnotationVisitor - extends AnnotationVisitor - { - protected InitialAnnotationVisitor(ASTNode node) { - super(node); - } - - @Override - protected void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation node) { - SourceAnnotatedElement.this.addInitialAnnotation(node); - } - } - - - /** - * synchronize annotation visitor - */ - protected class SynchronizeAnnotationVisitor - extends AnnotationVisitor - { - protected final Set annotationsToRemove; - protected final Set containersToRemove; - - protected SynchronizeAnnotationVisitor(ASTNode node, Set annotationsToRemove, Set containersToRemove) { - super(node); - this.annotationsToRemove = annotationsToRemove; - this.containersToRemove = containersToRemove; - } - - @Override - protected void visitChildAnnotation(org.eclipse.jdt.core.dom.Annotation node) { - SourceAnnotatedElement.this.addOrSyncAnnotation(node, this.annotationsToRemove, this.containersToRemove); - } - } - - - class AnnotationContainer extends SourceNode.AnnotationContainer - { - private final String nestableAnnotationName; - - protected AnnotationContainer(String nestableAnnotationName) { - super(); - this.nestableAnnotationName = nestableAnnotationName; - } - - /** - * Return the element name of the nested annotations - */ - @Override - protected String getElementName() { - return SourceAnnotatedElement.this.getNestableElementName(this.nestableAnnotationName); - } - - /** - * Return the nested annotation name - */ - @Override - protected String getNestedAnnotationName() { - return this.nestableAnnotationName; - } - - /** - * Return a new nested annotation at the given index - */ - @Override - protected NestableAnnotation buildNestedAnnotation(int index) { - return SourceAnnotatedElement.this.buildNestableAnnotation(this.nestableAnnotationName, index); - } - - public void initializeNestableAnnotation(org.eclipse.jdt.core.dom.Annotation standaloneNestableAnnotation) { - NestableAnnotation nestedAnnotation = this.buildNestedAnnotation(0); - this.nestedAnnotations.add(nestedAnnotation); - nestedAnnotation.initialize((CompilationUnit) standaloneNestableAnnotation.getRoot()); - } - - public void synchronizeNestableAnnotation(org.eclipse.jdt.core.dom.Annotation standaloneNestableAnnotation) { - if (this.getNestedAnnotationsSize() > 1) { - //ignore the new standalone annotation as a container annotation already exists - } - else if (this.getNestedAnnotationsSize() == 1) { - this.nestedAnnotationAt(0).synchronizeWith((CompilationUnit) standaloneNestableAnnotation.getRoot()); - } - } - - @Override - protected void fireItemAdded(int index, NestableAnnotation nestedAnnotation) { - SourceAnnotatedElement.this.fireItemAdded(NESTABLE_ANNOTATIONS_COLLECTION, nestedAnnotation); - } - - @Override - protected void fireItemsRemoved(int index, List removedItems) { - SourceAnnotatedElement.this.fireItemsRemoved(NESTABLE_ANNOTATIONS_COLLECTION, removedItems); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotation.java deleted file mode 100644 index db2e0b4f22..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAnnotation.java +++ /dev/null @@ -1,175 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTNodeTextRange; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotation; - -/** - * some common state and behavior for Java source annotations; - * and lots of convenience methods - */ -public abstract class SourceAnnotation - extends SourceNode - implements Annotation -{ - protected final A annotatedElement; - - protected final DeclarationAnnotationAdapter daa; - - protected final AnnotationAdapter annotationAdapter; - - - /** - * constructor for straight member annotation - */ - protected SourceAnnotation(JavaResourceNode parent, A annotatedElement, DeclarationAnnotationAdapter daa) { - this(parent, annotatedElement, daa, new ElementAnnotationAdapter(annotatedElement, daa)); - } - - /** - * constructor for nested annotation (typically) - */ - protected SourceAnnotation(JavaResourceNode parent, A annotatedElement, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent); - this.annotatedElement = annotatedElement; - this.daa = daa; - this.annotationAdapter = annotationAdapter; - } - - - // ********** JavaResourceNode implementation ********** - - public TextRange getTextRange(CompilationUnit astRoot) { - return this.getAnnotationTextRange(astRoot); - } - - - // ********** Annotation implementation ********** - - public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) { - return this.annotationAdapter.getAnnotation(astRoot); - } - - public void newAnnotation() { - this.annotationAdapter.newMarkerAnnotation(); - } - - public void removeAnnotation() { - this.annotationAdapter.removeAnnotation(); - } - - - // ********** convenience methods ********** - - /** - * Return the text range corresponding to the annotation. - * If the annotation is missing, return null. - */ - protected TextRange getAnnotationTextRange(CompilationUnit astRoot) { - return this.getTextRange(this.getAstAnnotation(astRoot)); - } - - /** - * Convenience method. - * Return the text range corresponding to the specified element. - * If the specified element is missing, return the annotation's text range instead. - */ - protected TextRange getElementTextRange(DeclarationAnnotationElementAdapter elementAdapter, CompilationUnit astRoot) { - return this.getElementTextRange(this.getAnnotationElementTextRange(elementAdapter, astRoot), astRoot); - } - - /** - * Convenience method. If the specified element text range is null - * return the member's text range instead. - */ - protected TextRange getElementTextRange(TextRange elementTextRange, CompilationUnit astRoot) { - return (elementTextRange != null) ? elementTextRange : this.getAnnotationTextRange(astRoot); - } - - /** - * Convenience method. Return whether the specified position exists and - * touches the specified element. - */ - protected boolean elementTouches(DeclarationAnnotationElementAdapter elementAdapter, int pos, CompilationUnit astRoot) { - return this.textRangeTouches(this.getAnnotationElementTextRange(elementAdapter, astRoot), pos); - } - - /** - * Convenience method. Return whether the specified text range is not - * null (meaning the corresponding AST node exists) and the specified position touches it. - */ - protected boolean textRangeTouches(TextRange textRange, int pos) { - return (textRange != null) && textRange.touches(pos); - } - - /** - * Return the text range corresponding to the specified element. - * If the element is missing, return null. - */ - protected TextRange getAnnotationElementTextRange(DeclarationAnnotationElementAdapter adapter, CompilationUnit astRoot) { - return this.getTextRange(this.getAnnotationElementExpression(adapter, astRoot)); - } - - /** - * Return the specified AST DOM element. - */ - protected Expression getAnnotationElementExpression(DeclarationAnnotationElementAdapter adapter, CompilationUnit astRoot) { - return adapter.getExpression(this.annotatedElement.getModifiedDeclaration(astRoot)); - } - - /** - * Return the text range corresponding to the specified AST node. - * If the AST node is null, return null. - */ - protected TextRange getTextRange(ASTNode astNode) { - return (astNode == null) ? null : new ASTNodeTextRange(astNode); - } - - - - /** - * A container for nested annotations. The owner of the AnnotationContainer - * needs to call initialize(CompilationUnit) on it. - * @param the type of the resource nestable annotations - */ - abstract class AnnotationContainer extends SourceNode.AnnotationContainer - { - protected AnnotationContainer() { - super(); - } - - /** - * Return the annotations property name for firing property change notification - */ - protected abstract String getAnnotationsPropertyName(); - - @Override - protected void fireItemAdded(int index, T addedItem) { - SourceAnnotation.this.fireItemAdded(this.getAnnotationsPropertyName(), index, addedItem); - } - - @Override - protected void fireItemsRemoved(int index, java.util.List removedItems) { - SourceAnnotation.this.fireItemsRemoved(this.getAnnotationsPropertyName(), index, removedItems); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAttribute.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAttribute.java deleted file mode 100644 index f43d19bf87..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceAttribute.java +++ /dev/null @@ -1,321 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; -import java.util.List; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IBinding; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.utility.internal.ClassName; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; - -/** - * Java source attribute (field or method) - */ -abstract class SourceAttribute - extends SourceMember - implements JavaResourceAttribute -{ - private int modifiers; - - private String typeName; - - private boolean typeIsInterface; - - private boolean typeIsEnum; - - private boolean typeIsArray; - - private final Vector typeSuperclassNames = new Vector(); - - private final Vector typeInterfaceNames = new Vector(); - - private final Vector typeTypeArgumentNames = new Vector(); - - - protected SourceAttribute(JavaResourceType parent, A attribute){ - super(parent, attribute); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - ITypeBinding typeBinding = this.getTypeBinding(astRoot); //build once, minor performance tweak for major benefit - this.modifiers = this.buildModifiers(astRoot); - this.typeName = this.buildTypeName(typeBinding); - this.typeIsInterface = this.buildTypeIsInterface(typeBinding); - this.typeIsEnum = this.buildTypeIsEnum(typeBinding); - this.typeIsArray = this.buildTypeIsArray(typeBinding); - this.typeSuperclassNames.addAll(this.buildTypeSuperclassNames(typeBinding)); - this.typeInterfaceNames.addAll(this.buildTypeInterfaceNames(typeBinding)); - this.typeTypeArgumentNames.addAll(this.buildTypeTypeArgumentNames(typeBinding)); - } - - - // ******** overrides ******** - - @Override - public void resolveTypes(CompilationUnit astRoot) { - super.resolveTypes(astRoot); - ITypeBinding typeBinding = this.getTypeBinding(astRoot);//build once, minor performance tweak for major benefit - this.syncTypeName(this.buildTypeName(typeBinding)); - this.syncTypeSuperclassNames(this.buildTypeSuperclassNames(typeBinding)); - this.syncTypeInterfaceNames(this.buildTypeInterfaceNames(typeBinding)); - this.syncTypeTypeArgumentNames(this.buildTypeTypeArgumentNames(typeBinding)); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - ITypeBinding typeBinding = this.getTypeBinding(astRoot);//build once, minor performance tweak for major benefit - this.syncModifiers(this.buildModifiers(astRoot)); - this.syncTypeName(this.buildTypeName(typeBinding)); - this.syncTypeIsInterface(this.buildTypeIsInterface(typeBinding)); - this.syncTypeIsEnum(this.buildTypeIsEnum(typeBinding)); - this.syncTypeIsArray(this.buildTypeIsArray(typeBinding)); - this.syncTypeSuperclassNames(this.buildTypeSuperclassNames(typeBinding)); - this.syncTypeInterfaceNames(this.buildTypeInterfaceNames(typeBinding)); - this.syncTypeTypeArgumentNames(this.buildTypeTypeArgumentNames(typeBinding)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getName()); - } - - - // ******** JavaResourcePersistentAttribute implementation ******** - - public String getName() { - return this.annotatedElement.getAttributeName(); - } - - public boolean typeIsSubTypeOf(String tn) { - if (this.typeName == null) { - return false; - } - return this.typeName.equals(tn) - || this.typeInterfaceNames.contains(tn) - || this.typeSuperclassNames.contains(tn); - } - - public boolean typeIsVariablePrimitive() { - return (this.typeName != null) && ClassName.isVariablePrimitive(this.typeName); - } - - private ITypeBinding getTypeBinding(CompilationUnit astRoot) { - return this.annotatedElement.getTypeBinding(astRoot); - } - - - // ***** modifiers - public int getModifiers() { - return this.modifiers; - } - - private void syncModifiers(int astModifiers) { - int old = this.modifiers; - this.modifiers = astModifiers; - this.firePropertyChanged(MODIFIERS_PROPERTY, old, astModifiers); - } - - /** - * zero seems like a reasonable default... - */ - private int buildModifiers(CompilationUnit astRoot) { - IBinding binding = this.annotatedElement.getBinding(astRoot); - return (binding == null) ? 0 : binding.getModifiers(); - } - - // ***** type name - public String getTypeName() { - return this.typeName; - } - - private void syncTypeName(String astTypeName) { - String old = this.typeName; - this.typeName = astTypeName; - this.firePropertyChanged(TYPE_NAME_PROPERTY, old, astTypeName); - } - - /** - * this can be an array (e.g. "java.lang.String[]"); - * but no generic type arguments - */ - private String buildTypeName(ITypeBinding typeBinding) { - if (typeBinding == null) { - return null; - } - // a type variable is what is declared by a generic type; - // e.g. "E" is a type variable declared by the generic type "Collection" in - // public interface Collection - if (typeBinding.isTypeVariable()) { - // e.g. "E extends Number" has an erasure of "Number" - typeBinding = typeBinding.getErasure(); - } - String tbName = typeBinding.getTypeDeclaration().getQualifiedName(); - return (tbName.length() == 0) ? null : tbName; - } - - // ***** type is interface - public boolean typeIsInterface() { - return this.typeIsInterface; - } - - private void syncTypeIsInterface(boolean astTypeIsInterface) { - boolean old = this.typeIsInterface; - this.typeIsInterface = astTypeIsInterface; - this.firePropertyChanged(TYPE_IS_INTERFACE_PROPERTY, old, astTypeIsInterface); - } - - private boolean buildTypeIsInterface(ITypeBinding typeBinding) { - return (typeBinding != null) && ( ! typeBinding.isArray()) && typeBinding.isInterface(); - } - - // ***** type is enum - public boolean typeIsEnum() { - return this.typeIsEnum; - } - - private void syncTypeIsEnum(boolean astTypeIsEnum) { - boolean old = this.typeIsEnum; - this.typeIsEnum = astTypeIsEnum; - this.firePropertyChanged(TYPE_IS_ENUM_PROPERTY, old, astTypeIsEnum); - } - - private boolean buildTypeIsEnum(ITypeBinding typeBinding) { - return (typeBinding != null) && ( ! typeBinding.isArray()) && typeBinding.isEnum(); - } - - // ***** type is array - public boolean typeIsArray() { - return this.typeIsArray; - } - - private void syncTypeIsArray(boolean astTypeIsArray) { - boolean old = this.typeIsArray; - this.typeIsArray = astTypeIsArray; - this.firePropertyChanged(TYPE_IS_ARRAY_PROPERTY, old, astTypeIsArray); - } - - private boolean buildTypeIsArray(ITypeBinding typeBinding) { - return (typeBinding != null) && typeBinding.isArray(); - } - - // ***** type superclass hierarchy - public ListIterable getTypeSuperclassNames() { - return new LiveCloneListIterable(this.typeSuperclassNames); - } - - private void syncTypeSuperclassNames(List astTypeSuperclassNames) { - this.synchronizeList(astTypeSuperclassNames, this.typeSuperclassNames, TYPE_SUPERCLASS_NAMES_LIST); - } - - private List buildTypeSuperclassNames(ITypeBinding typeBinding) { - if (typeBinding == null) { - return Collections.emptyList(); - } - ArrayList names = new ArrayList(); - typeBinding = typeBinding.getSuperclass(); - while (typeBinding != null) { - names.add(typeBinding.getQualifiedName()); - typeBinding = typeBinding.getSuperclass(); - } - return names; - } - - // ***** type interface hierarchy - public Iterable getTypeInterfaceNames() { - return new LiveCloneIterable(this.typeInterfaceNames); - } - -// private boolean typeInterfaceNamesContains(String interfaceName) { -// return this.typeInterfaceNames.contains(interfaceName); -// } -// - private void syncTypeInterfaceNames(Collection astTypeInterfaceNames) { - this.synchronizeCollection(astTypeInterfaceNames, this.typeInterfaceNames, TYPE_INTERFACE_NAMES_COLLECTION); - } - - private Collection buildTypeInterfaceNames(ITypeBinding typeBinding) { - if (typeBinding == null) { - return Collections.emptySet(); - } - HashSet names = new HashSet(); - while (typeBinding != null) { - this.addInterfaceNamesTo(typeBinding, names); - typeBinding = typeBinding.getSuperclass(); - } - return names; - } - - private void addInterfaceNamesTo(ITypeBinding typeBinding, HashSet names) { - for (ITypeBinding interfaceBinding : typeBinding.getInterfaces()) { - names.add(interfaceBinding.getTypeDeclaration().getQualifiedName()); - this.addInterfaceNamesTo(interfaceBinding, names); // recurse - } - } - - // ***** type type argument names - public ListIterable getTypeTypeArgumentNames() { - return new LiveCloneListIterable(this.typeTypeArgumentNames); - } - - public int getTypeTypeArgumentNamesSize() { - return this.typeTypeArgumentNames.size(); - } - - public String getTypeTypeArgumentName(int index) { - return this.typeTypeArgumentNames.get(index); - } - - private void syncTypeTypeArgumentNames(List astTypeTypeArgumentNames) { - this.synchronizeList(astTypeTypeArgumentNames, this.typeTypeArgumentNames, TYPE_TYPE_ARGUMENT_NAMES_LIST); - } - - /** - * these types can be arrays (e.g. "java.lang.String[]"); - * but they won't have any further nested generic type arguments - * (e.g. "java.util.Collection") - */ - private List buildTypeTypeArgumentNames(ITypeBinding typeBinding) { - if (typeBinding == null) { - return Collections.emptyList(); - } - - ITypeBinding[] typeArguments = typeBinding.getTypeArguments(); - if (typeArguments.length == 0) { - return Collections.emptyList(); - } - - ArrayList names = new ArrayList(typeArguments.length); - for (ITypeBinding typeArgument : typeArguments) { - if (typeArgument == null) { - names.add(null); - } else { - // e.g. "? extends Number" has an erasure of "Number" - ITypeBinding erasure = typeArgument.getErasure(); - names.add(erasure.getTypeDeclaration().getQualifiedName()); - } - } - return names; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceCompilationUnit.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceCompilationUnit.java deleted file mode 100644 index 7ede5747b6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceCompilationUnit.java +++ /dev/null @@ -1,176 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.JptResourceModelListener; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.internal.ListenerList; -import org.eclipse.jpt.jaxb.core.AnnotationProvider; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; - -/** - * Java compilation unit (source file) - */ -public abstract class SourceCompilationUnit - extends SourceNode - implements JavaResourceCompilationUnit -{ - /** JDT compilation unit */ - final ICompilationUnit compilationUnit; - - /** pluggable annotation provider */ - private final AnnotationProvider annotationProvider; - - /** improved annotation formatting */ - private final AnnotationEditFormatter annotationEditFormatter; - - /** pluggable executor that allows the document to be modified on another thread */ - private final CommandExecutor modifySharedDocumentCommandExecutor; - - /** listeners notified whenever the resource model changes */ - private final ListenerList resourceModelListenerList; - - - // ********** construction ********** - - protected SourceCompilationUnit( - ICompilationUnit compilationUnit, - AnnotationProvider annotationProvider, - AnnotationEditFormatter annotationEditFormatter, - CommandExecutor modifySharedDocumentCommandExecutor) { - super(null); // the JPA compilation unit is the root of its sub-tree - this.compilationUnit = compilationUnit; - this.annotationProvider = annotationProvider; - this.annotationEditFormatter = annotationEditFormatter; - this.modifySharedDocumentCommandExecutor = modifySharedDocumentCommandExecutor; - this.resourceModelListenerList = new ListenerList(JptResourceModelListener.class); - } - - public void initialize(CompilationUnit astRoot) { - // never called? - } - - void openCompilationUnit() { - try { - this.compilationUnit.open(null); - } catch (JavaModelException ex) { - // do nothing - we just won't have a primary type in this case - } - } - - void closeCompilationUnit() { - try { - this.compilationUnit.close(); - } catch (JavaModelException ex) { - // hmmm - } - } - - - // ********** AbstractJavaResourceNode overrides ********** - - @Override - protected boolean requiresParent() { - return false; - } - - @Override - public JavaResourceCompilationUnit getRoot() { - return this; - } - - @Override - public IFile getFile() { - return (IFile) this.compilationUnit.getResource(); - } - - @Override - public AnnotationProvider getAnnotationProvider() { - return this.annotationProvider; - } - - - // ********** JavaResourceNode implementation ********** - - public TextRange getTextRange(CompilationUnit astRoot) { - return null; - } - - - // ********** JavaResourceNode.Root implementation ********** - - public void resourceModelChanged() { - for (JptResourceModelListener listener : this.resourceModelListenerList.getListeners()) { - listener.resourceModelChanged(this); - } - } - - - // ********** JavaResourceCompilationUnit implementation ********** - - public ICompilationUnit getCompilationUnit() { - return this.compilationUnit; - } - - public CommandExecutor getModifySharedDocumentCommandExecutor() { - return this.modifySharedDocumentCommandExecutor; - } - - public AnnotationEditFormatter getAnnotationEditFormatter() { - return this.annotationEditFormatter; - } - - public CompilationUnit buildASTRoot() { - return ASTTools.buildASTRoot(this.compilationUnit); - } - - - // ********** JpaResourceModel implementation ********** - - public void addResourceModelListener(JptResourceModelListener listener) { - this.resourceModelListenerList.add(listener); - } - - public void removeResourceModelListener(JptResourceModelListener listener) { - this.resourceModelListenerList.remove(listener); - } - - - // ********** Java changes ********** - - public void synchronizeWithJavaSource() { - this.synchronizeWith(this.buildASTRoot()); - } - - - // ********** internal ********** - - String getCompilationUnitName() { - return this.removeJavaExtension(this.compilationUnit.getElementName()); - } - - private String removeJavaExtension(String fileName) { - int index = fileName.lastIndexOf(".java"); //$NON-NLS-1$ - return (index == -1) ? fileName : fileName.substring(0, index); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getCompilationUnitName()); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceEnum.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceEnum.java deleted file mode 100644 index 9137f61d0c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceEnum.java +++ /dev/null @@ -1,215 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import java.util.Collection; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumConstantDeclaration; -import org.eclipse.jdt.core.dom.EnumDeclaration; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTEnum; -import org.eclipse.jpt.common.core.utility.jdt.Enum; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.common.utility.internal.SimpleIntReference; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; - -/** - * Java source type - */ -final class SourceEnum - extends SourceAbstractType - implements JavaResourceEnum -{ - - private final Vector enumConstants; - - - - // ********** construction/initialization ********** - - /** - * build top-level type - */ - static JavaResourceEnum newInstance( - JavaResourceCompilationUnit javaResourceCompilationUnit, - EnumDeclaration enumDeclaration, - CompilationUnit astRoot) { - Enum _enum = new JDTEnum( - enumDeclaration, - javaResourceCompilationUnit.getCompilationUnit(), - javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(), - javaResourceCompilationUnit.getAnnotationEditFormatter()); - JavaResourceEnum jre = new SourceEnum(javaResourceCompilationUnit, _enum); - jre.initialize(astRoot); - return jre; - } - - /** - * build nested type - */ - protected static JavaResourceEnum newInstance( - JavaResourceCompilationUnit javaResourceCompilationUnit, - Type declaringType, - EnumDeclaration enumDeclaration, - int occurrence, - CompilationUnit astRoot) { - Enum _enum = new JDTEnum( - declaringType, - enumDeclaration, - occurrence, - javaResourceCompilationUnit.getCompilationUnit(), - javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(), - javaResourceCompilationUnit.getAnnotationEditFormatter()); - JavaResourceEnum jre = new SourceEnum(javaResourceCompilationUnit, _enum); - jre.initialize(astRoot); - return jre; - } - - private SourceEnum(JavaResourceCompilationUnit javaResourceCompilationUnit, Enum _enum) { - super(javaResourceCompilationUnit, _enum); - this.enumConstants = new Vector(); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - this.initializeEnumConstants(astRoot); - } - - - // ********** update ********** - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncEnumConstants(astRoot); - } - - - // ********** SourceAnnotatedElement implementation ********** - - @Override - public void resolveTypes(CompilationUnit astRoot) { - super.resolveTypes(astRoot); - - for (JavaResourceEnumConstant enumConstant : this.getEnumConstants()) { - enumConstant.resolveTypes(astRoot); - } - } - - - // ******** JavaResourceEnum implementation ******** - - // ********** enum constants ********** - - public Iterable getEnumConstants() { - return new LiveCloneIterable(this.enumConstants); - } - - private void addEnumConstant(JavaResourceEnumConstant enumConstant) { - this.addItemToCollection(enumConstant, this.enumConstants, ENUM_CONSTANTS_COLLECTION); - } - - private JavaResourceEnumConstant getEnumConstant(String fieldName, int occurrence) { - for (JavaResourceEnumConstant enumConstant : this.getEnumConstants()) { - if (enumConstant.isFor(fieldName, occurrence)) { - return enumConstant; - } - } - return null; - } - - private void removeEnumConstants(Collection remove) { - this.removeItemsFromCollection(remove, this.enumConstants, ENUM_CONSTANTS_COLLECTION); - } - - private void initializeEnumConstants(CompilationUnit astRoot) { - EnumConstantDeclaration[] enumConstantDeclarations = this.annotatedElement.getEnumConstants(astRoot); - CounterMap counters = new CounterMap(enumConstantDeclarations.length); - for (EnumConstantDeclaration enumConstantDeclaration : enumConstantDeclarations) { - String constantName = enumConstantDeclaration.getName().getFullyQualifiedName(); - int occurrence = counters.increment(constantName); - this.enumConstants.add(this.buildEnumConstant(constantName, occurrence, astRoot)); - } - } - - private void syncEnumConstants(CompilationUnit astRoot) { - EnumConstantDeclaration[] enumConstantDeclarations = this.annotatedElement.getEnumConstants(astRoot); - CounterMap counters = new CounterMap(enumConstantDeclarations.length); - HashSet enumConstantsToRemove = new HashSet(this.enumConstants); - for (EnumConstantDeclaration enumConstantDeclaration : enumConstantDeclarations) { - String constantName = enumConstantDeclaration.getName().getFullyQualifiedName(); - int occurrence = counters.increment(constantName); - - JavaResourceEnumConstant enumConstant = this.getEnumConstant(constantName, occurrence); - if (enumConstant == null) { - this.addEnumConstant(this.buildEnumConstant(constantName, occurrence, astRoot)); - } else { - enumConstantsToRemove.remove(enumConstant); - enumConstant.synchronizeWith(astRoot); - } - } - this.removeEnumConstants(enumConstantsToRemove); - } - - private JavaResourceEnumConstant buildEnumConstant(String fieldName, int occurrence, CompilationUnit astRoot) { - return SourceEnumConstant.newInstance(this, this.annotatedElement, fieldName, occurrence, this.getJavaResourceCompilationUnit(), astRoot); - } - - - public Iterable getTypes() { - return EmptyIterable.instance(); - } - - public Iterable getAllTypes() { - return EmptyIterable.instance(); - } - - public Iterable getEnums() { - return EmptyIterable.instance(); - } - - public Iterable getAllEnums() { - return new SingleElementIterable(this); - } - - // ********** CounterMap ********** - - private static class CounterMap { - private final HashMap counters; - - protected CounterMap(int initialCapacity) { - super(); - this.counters = new HashMap(initialCapacity); - } - - /** - * Return the incremented count for the specified object. - */ - int increment(Object o) { - SimpleIntReference counter = this.counters.get(o); - if (counter == null) { - counter = new SimpleIntReference(); - this.counters.put(o, counter); - } - counter.increment(); - return counter.getValue(); - } - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceEnumConstant.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceEnumConstant.java deleted file mode 100644 index fec1045317..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceEnumConstant.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTEnumConstant; -import org.eclipse.jpt.common.core.utility.jdt.Enum; -import org.eclipse.jpt.common.core.utility.jdt.EnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; - -/** - * Java source enum constant - */ -final class SourceEnumConstant - extends SourceMember - implements JavaResourceEnumConstant -{ - - /** - * construct enum constant - */ - static JavaResourceEnumConstant newInstance( - JavaResourceEnum parent, - Enum declaringEnum, - String name, - int occurrence, - JavaResourceCompilationUnit javaResourceCompilationUnit, - CompilationUnit astRoot) { - EnumConstant enumConstant = new JDTEnumConstant( - declaringEnum, - name, - occurrence, - javaResourceCompilationUnit.getCompilationUnit(), - javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(), - javaResourceCompilationUnit.getAnnotationEditFormatter()); - JavaResourceEnumConstant jrec = new SourceEnumConstant(parent, enumConstant); - jrec.initialize(astRoot); - return jrec; - } - - private SourceEnumConstant(JavaResourceEnum parent, EnumConstant enumConstant){ - super(parent, enumConstant); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - } - - - // ******** overrides ******** - - @Override - public void resolveTypes(CompilationUnit astRoot) { - super.resolveTypes(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getName()); - } - - - // ******** JavaResourceEnumConstant implementation ******** - - public String getName() { - return this.annotatedElement.getName(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceField.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceField.java deleted file mode 100644 index 3218f47915..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceField.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTFieldAttribute; -import org.eclipse.jpt.common.core.utility.jdt.FieldAttribute; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; - -/** - * Java source field - */ -final class SourceField - extends SourceAttribute - implements JavaResourceField -{ - - /** - * construct field attribute - */ - static JavaResourceField newInstance( - JavaResourceType parent, - Type declaringType, - String name, - int occurrence, - JavaResourceCompilationUnit javaResourceCompilationUnit, - CompilationUnit astRoot) { - FieldAttribute field = new JDTFieldAttribute( - declaringType, - name, - occurrence, - javaResourceCompilationUnit.getCompilationUnit(), - javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(), - javaResourceCompilationUnit.getAnnotationEditFormatter()); - JavaResourceField jrpa = new SourceField(parent, field); - jrpa.initialize(astRoot); - return jrpa; - } - - private SourceField(JavaResourceType parent, FieldAttribute field){ - super(parent, field); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMember.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMember.java deleted file mode 100644 index 15a93b2523..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMember.java +++ /dev/null @@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import java.util.ArrayList; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IBinding; -import org.eclipse.jdt.core.dom.Modifier; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jaxb.core.resource.java.Annotation; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; - -/** - * Java source member (annotations, "persistable") - */ -abstract class SourceMember - extends SourceAnnotatedElement - implements JavaResourceMember -{ - - boolean final_; // 'final' is a reserved word - - boolean transient_; // 'transient' is a reserved word - - boolean public_; // 'public' is a reserved word - - boolean static_; // 'static' is a reserved word - - - // ********** construction/initialization ********** - - SourceMember(JavaResourceNode parent, M member) { - super(parent, member); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - IBinding binding = this.annotatedElement.getBinding(astRoot); - this.final_ = this.buildFinal(binding); - this.transient_ = this.buildTransient(binding); - this.public_ = this.buildPublic(binding); - this.static_ = this.buildStatic(binding); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - IBinding binding = this.annotatedElement.getBinding(astRoot); - this.syncFinal(this.buildFinal(binding)); - this.syncTransient(this.buildTransient(binding)); - this.syncPublic(this.buildPublic(binding)); - this.syncStatic(this.buildStatic(binding)); - } - - - // ********** annotations ********** - - public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable supportingAnnotationNames) { - ArrayList annotationNames = new ArrayList(); - CollectionTools.addAll(annotationNames, supportingAnnotationNames); - if (primaryAnnotationName != null) { - annotationNames.add(primaryAnnotationName); - } - for (Annotation annotation : this.getAnnotations()) { - if ( ! CollectionTools.contains(annotationNames, annotation.getAnnotationName())) { - this.annotations.remove(annotation); - annotation.removeAnnotation(); - } - } - Annotation newPrimaryAnnotation = null; - if ((primaryAnnotationName != null) && (this.getAnnotation(primaryAnnotationName) == null)) { - newPrimaryAnnotation = this.buildAnnotation(primaryAnnotationName); - this.annotations.add(newPrimaryAnnotation); - newPrimaryAnnotation.newAnnotation(); - } - // fire collection change event after all annotation changes are done - this.fireCollectionChanged(ANNOTATIONS_COLLECTION, this.annotations); - return newPrimaryAnnotation; - } - - - // ***** final - public boolean isFinal() { - return this.final_; - } - - private void syncFinal(boolean astFinal) { - boolean old = this.final_; - this.final_ = astFinal; - this.firePropertyChanged(FINAL_PROPERTY, old, astFinal); - } - - private boolean buildFinal(IBinding binding) { - return (binding == null) ? false : Modifier.isFinal(binding.getModifiers()); - } - - // ***** transient - public boolean isTransient() { - return this.transient_; - } - - private void syncTransient(boolean astTransient) { - boolean old = this.transient_; - this.transient_ = astTransient; - this.firePropertyChanged(TRANSIENT_PROPERTY, old, astTransient); - } - - private boolean buildTransient(IBinding binding) { - return (binding == null) ? false : Modifier.isTransient(binding.getModifiers()); - } - - // ***** public - public boolean isPublic() { - return this.public_; - } - - private void syncPublic(boolean astPublic) { - boolean old = this.public_; - this.public_ = astPublic; - this.firePropertyChanged(PUBLIC_PROPERTY, old, astPublic); - } - - private boolean buildPublic(IBinding binding) { - return (binding == null) ? false : Modifier.isPublic(binding.getModifiers()); - } - - // ***** static - public boolean isStatic() { - return this.static_; - } - - private void syncStatic(boolean astStatic) { - boolean old = this.static_; - this.static_ = astStatic; - this.firePropertyChanged(STATIC_PROPERTY, old, astStatic); - } - - private boolean buildStatic(IBinding binding) { - return (binding == null) ? false : Modifier.isStatic(binding.getModifiers()); - } - - - // ********** miscellaneous ********** - - public boolean isFor(String memberName, int occurrence) { - return this.annotatedElement.matches(memberName, occurrence); - } - - public void resolveTypes(CompilationUnit astRoot) { - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMethod.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMethod.java deleted file mode 100644 index 5d33f11f35..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceMethod.java +++ /dev/null @@ -1,154 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IMethodBinding; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTMethodAttribute; -import org.eclipse.jpt.common.core.utility.jdt.MethodAttribute; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.common.utility.MethodSignature; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; - -/** - * Java source method - */ -final class SourceMethod - extends SourceAttribute - implements JavaResourceMethod -{ - boolean constructor; - - private final Vector parameterTypeNames = new Vector(); - - /** - * construct method - */ - static JavaResourceMethod newInstance( - JavaResourceType parent, - Type declaringType, - MethodSignature signature, - int occurrence, - JavaResourceCompilationUnit javaResourceCompilationUnit, - CompilationUnit astRoot) { - MethodAttribute method = JDTMethodAttribute.newInstance( - declaringType, - signature, - occurrence, - javaResourceCompilationUnit.getCompilationUnit(), - javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(), - javaResourceCompilationUnit.getAnnotationEditFormatter()); - JavaResourceMethod jrm = new SourceMethod(parent, method); - jrm.initialize(astRoot); - return jrm; - } - - private SourceMethod(JavaResourceType parent, MethodAttribute method){ - super(parent, method); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - IMethodBinding binding = this.annotatedElement.getBinding(astRoot); - this.constructor = this.buildConstructor(binding); - this.parameterTypeNames.addAll(this.buildParameterTypeNames(binding)); - } - - - // ******** overrides ******** - - @Override - protected JavaResourceType getParent() { - return (JavaResourceType) super.getParent(); - } - - @Override - public void resolveTypes(CompilationUnit astRoot) { - super.resolveTypes(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - IMethodBinding binding = this.annotatedElement.getBinding(astRoot); - this.syncConstructor(this.buildConstructor(binding)); - this.syncParameterTypeNames(this.buildParameterTypeNames(binding)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getMethodName()); - } - - - // ******** JavaResourceMethod implementation ******** - - public String getMethodName() { - return this.annotatedElement.getName(); - } - - // ***** constructor - public boolean isConstructor() { - return this.constructor; - } - - private void syncConstructor(boolean astConstructor) { - boolean old = this.constructor; - this.constructor = astConstructor; - this.firePropertyChanged(CONSTRUCTOR_PROPERTY, old, astConstructor); - } - - private boolean buildConstructor(IMethodBinding methodBinding) { - return methodBinding == null ? false : methodBinding.isConstructor(); - } - - public boolean isFor(MethodSignature signature, int occurrence) { - return this.annotatedElement.matches(signature, occurrence); - } - - // ***** parameter type names - public ListIterable getParameterTypeNames() { - return new LiveCloneListIterable(this.parameterTypeNames); - } - - public int getParametersSize() { - return this.parameterTypeNames.size(); - } - - private void syncParameterTypeNames(List astParameterTypeNames) { - this.synchronizeList(astParameterTypeNames, this.parameterTypeNames, PARAMETER_TYPE_NAMES_LIST); - } - - private List buildParameterTypeNames(IMethodBinding methodBinding) { - if (methodBinding == null) { - return Collections.emptyList(); - } - ArrayList names = new ArrayList(); - for (ITypeBinding parameterType : methodBinding.getParameterTypes()) { - if (parameterType.isTypeVariable()) { - // e.g. "E extends Number" has an erasure of "Number" - parameterType = parameterType.getErasure(); - } - String ptName = parameterType.getTypeDeclaration().getQualifiedName(); - names.add(ptName); - } - return names; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceNode.java deleted file mode 100644 index f61cecd321..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceNode.java +++ /dev/null @@ -1,333 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.ArrayInitializer; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.Expression; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jdt.core.dom.MemberValuePair; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.SingleMemberAnnotation; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotation; - - -/** - * Source convenience methods - */ -public abstract class SourceNode - extends AbstractJavaResourceNode -{ - - public SourceNode(JavaResourceNode parent) { - super(parent); - } - - public JavaResourceCompilationUnit getJavaResourceCompilationUnit() { - return (JavaResourceCompilationUnit) this.getRoot(); - } - - /** - * A container for nested annotations. The owner of the AnnotationContainer - * needs to call initialize(org.eclipse.jdt.core.dom.Annotation) on it. - * @param the type of the resource nestable annotations - */ - abstract class AnnotationContainer - { - protected final Vector nestedAnnotations = new Vector(); - - protected AnnotationContainer() { - super(); - } - - /** - * Return the element name of the nested annotations - */ - protected abstract String getElementName(); - - /** - * Return the nested annotation name - */ - protected abstract String getNestedAnnotationName(); - - /** - * Return a new nested annotation at the given index - */ - protected abstract T buildNestedAnnotation(int index); - - protected abstract void fireItemAdded(int index, T nestedAnnotation); - - protected abstract void fireItemsRemoved(int index, List removedItems); - - protected void initialize(org.eclipse.jdt.core.dom.Annotation astContainerAnnotation) { - // ignore the nested AST annotations themselves - // (maybe someday we can use them during initialization...) - int size = this.getNestedAstAnnotations(astContainerAnnotation).size(); - for (int i = 0; i < size; i++) { - T nestedAnnotation = this.buildNestedAnnotation(i); - this.nestedAnnotations.add(i, nestedAnnotation); - nestedAnnotation.initialize((CompilationUnit) astContainerAnnotation.getRoot()); - } - } - - /** - * Synchronize the resource model annotations with those in the specified AST. - * Trigger the appropriate change notification. - */ - protected void synchronize(org.eclipse.jdt.core.dom.Annotation astContainerAnnotation) { - ArrayList astAnnotations = this.getNestedAstAnnotations(astContainerAnnotation); - Iterator astAnnotationStream = astAnnotations.iterator(); - - for (T nestedAnnotation : this.getNestedAnnotations()) { - if (astAnnotationStream.hasNext()) { - // matching AST annotation is present - synchronize the nested annotation - astAnnotationStream.next(); // maybe someday we can pass this to the update - nestedAnnotation.synchronizeWith((CompilationUnit) astContainerAnnotation.getRoot()); - } else { - // no more AST annotations - remove the remaining nested annotations and exit - this.syncRemoveNestedAnnotations(astAnnotations.size()); - return; - } - } - - // add nested annotations for any remaining AST annotations - while (astAnnotationStream.hasNext()) { - this.syncAddNestedAnnotation(astAnnotationStream.next()); - } - } - - public ListIterable getNestedAnnotations() { - return new LiveCloneListIterable(this.nestedAnnotations); - } - - public int getNestedAnnotationsSize() { - return this.nestedAnnotations.size(); - } - - public T nestedAnnotationAt(int index) { - return this.nestedAnnotations.get(index); - } - - public T addNestedAnnotation(int index) { - // add a new annotation to the end of the list... - int sourceIndex = this.getNestedAnnotationsSize(); - T nestedAnnotation = this.buildNestedAnnotation(sourceIndex); - this.nestedAnnotations.add(sourceIndex, nestedAnnotation); - nestedAnnotation.newAnnotation(); - // ...then move it to the specified index - this.moveNestedAnnotation(index, sourceIndex); - return nestedAnnotation; - } - - public T moveNestedAnnotation(int targetIndex, int sourceIndex) { - if (targetIndex != sourceIndex) { - return this.moveNestedAnnotation_(targetIndex, sourceIndex); - } - return null; - } - - public T removeNestedAnnotation(int index) { - T nestedAnnotation = this.nestedAnnotations.remove(index); - nestedAnnotation.removeAnnotation(); - this.syncAstAnnotationsAfterRemove(index); - return nestedAnnotation; - } - - private T moveNestedAnnotation_(int targetIndex, int sourceIndex) { - T nestedAnnotation = CollectionTools.move(this.nestedAnnotations, targetIndex, sourceIndex).get(targetIndex); - this.syncAstAnnotationsAfterMove(targetIndex, sourceIndex, nestedAnnotation); - return nestedAnnotation; - } - - /** - * Return a list of the nested AST annotations. - */ - private ArrayList getNestedAstAnnotations(org.eclipse.jdt.core.dom.Annotation astContainerAnnotation) { - ArrayList result = new ArrayList(); - if (astContainerAnnotation == null || astContainerAnnotation.isMarkerAnnotation()) { - // no nested annotations - } - else if (astContainerAnnotation.isSingleMemberAnnotation()) { - if (this.getElementName().equals("value")) { //$NON-NLS-1$ - Expression ex = ((SingleMemberAnnotation) astContainerAnnotation).getValue(); - this.addAstAnnotationsTo(ex, result); - } else { - // no nested annotations - } - } - else if (astContainerAnnotation.isNormalAnnotation()) { - MemberValuePair pair = this.getMemberValuePair((NormalAnnotation) astContainerAnnotation); - if (pair == null) { - // no nested annotations - } else { - this.addAstAnnotationsTo(pair.getValue(), result); - } - } - return result; - } - - /** - * Add whatever annotations are represented by the specified expression to - * the specified list. Do not add null to the list for any non-annotation expression. - */ - private void addAstAnnotationsTo(Expression expression, ArrayList astAnnotations) { - if (expression == null) { - //do not add null to the list, not sure how we would get here... - } - else if (expression.getNodeType() == ASTNode.ARRAY_INITIALIZER) { - this.addAstAnnotationsTo((ArrayInitializer) expression, astAnnotations); - } - else { - org.eclipse.jdt.core.dom.Annotation astAnnotation = this.getAstAnnotation_(expression); - if (astAnnotation != null) { - astAnnotations.add(astAnnotation); - } - } - } - - private void addAstAnnotationsTo(ArrayInitializer arrayInitializer, ArrayList astAnnotations) { - List expressions = this.expressions(arrayInitializer); - for (Expression expression : expressions) { - org.eclipse.jdt.core.dom.Annotation astAnnotation = getAstAnnotation(expression); - if (astAnnotation != null) { - astAnnotations.add(astAnnotation); - } - } - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - private List expressions(ArrayInitializer arrayInitializer) { - return arrayInitializer.expressions(); - } - - /** - * If the specified expression is an annotation with the specified name, return it; - * otherwise return null. - */ - private org.eclipse.jdt.core.dom.Annotation getAstAnnotation(Expression expression) { - // not sure how the expression could be null... - return (expression == null) ? null : getAstAnnotation_(expression); - } - - /** - * pre-condition: expression is not null - */ - private org.eclipse.jdt.core.dom.Annotation getAstAnnotation_(Expression expression) { - switch (expression.getNodeType()) { - case ASTNode.NORMAL_ANNOTATION: - case ASTNode.SINGLE_MEMBER_ANNOTATION: - case ASTNode.MARKER_ANNOTATION: - org.eclipse.jdt.core.dom.Annotation astAnnotation = (org.eclipse.jdt.core.dom.Annotation) expression; - if (this.getQualifiedName(astAnnotation).equals(this.getNestedAnnotationName())) { - return astAnnotation; - } - return null; - default: - return null; - } - } - - private String getQualifiedName(org.eclipse.jdt.core.dom.Annotation astAnnotation) { - ITypeBinding typeBinding = astAnnotation.resolveTypeBinding(); - if (typeBinding != null) { - String resolvedName = typeBinding.getQualifiedName(); - if (resolvedName != null) { - return resolvedName; - } - } - return astAnnotation.getTypeName().getFullyQualifiedName(); - } - - private MemberValuePair getMemberValuePair(NormalAnnotation annotation) { - List pairs = this.values(annotation); - for (MemberValuePair pair : pairs) { - if (pair.getName().getFullyQualifiedName().equals(this.getElementName())) { - return pair; - } - } - return null; - } - - @SuppressWarnings("unchecked") - protected List values(NormalAnnotation na) { - return na.values(); - } - - /** - * An annotation was moved within the specified annotation container from - * the specified source index to the specified target index. - * Synchronize the AST annotations with the resource model annotation container, - * starting with the lower index to prevent overlap. - */ - private void syncAstAnnotationsAfterMove(int targetIndex, int sourceIndex, T nestedAnnotation) { - // move the Java annotation to the end of the list... - nestedAnnotation.moveAnnotation(this.getNestedAnnotationsSize()); - // ...then shift the other AST annotations over one slot... - if (sourceIndex < targetIndex) { - for (int i = sourceIndex; i < targetIndex; i++) { - this.nestedAnnotations.get(i).moveAnnotation(i); - } - } else { - for (int i = sourceIndex; i > targetIndex; i-- ) { - this.nestedAnnotations.get(i).moveAnnotation(i); - } - } - // ...then move the AST annotation to the now empty slot at the target index - nestedAnnotation.moveAnnotation(targetIndex); - } - - /** - * An annotation was removed from the specified annotation container at the - * specified index. - * Synchronize the AST annotations with the resource model annotation container, - * starting at the specified index to prevent overlap. - */ - private void syncAstAnnotationsAfterRemove(int index) { - for (int i = index; i < this.getNestedAnnotationsSize(); i++) { - // the indices are the same because the model annotations are - // already in the proper locations - it's the AST annotations that - // need to be moved to the matching location - this.nestedAnnotations.get(i).moveAnnotation(i); - } - } - - protected void syncAddNestedAnnotation(org.eclipse.jdt.core.dom.Annotation astAnnotation) { - int index = this.getNestedAnnotationsSize(); - T nestedAnnotation = this.buildNestedAnnotation(index); - nestedAnnotation.initialize((CompilationUnit) astAnnotation.getRoot()); - this.nestedAnnotations.add(index, nestedAnnotation); - this.fireItemAdded(index, nestedAnnotation); - } - - protected void syncRemoveNestedAnnotations(int index) { - List subList = this.nestedAnnotations.subList(index, this.getNestedAnnotationsSize()); - List removedItems = new ArrayList(subList); - subList.clear(); - this.fireItemsRemoved(index, removedItems); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourcePackage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourcePackage.java deleted file mode 100644 index 59d44226df..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourcePackage.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Red Hat, Inc. - * Distributed under license by Red Hat, Inc. All rights reserved. - * This program is made available under the terms of the - * Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributor: - * Red Hat, Inc. - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.IPackageBinding; -import org.eclipse.jdt.core.dom.PackageDeclaration; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTPackage; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedPackage; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; - -/** - * @author Dmitry Geraskov - * Source package-info.java - * - */ -public final class SourcePackage - extends SourceAnnotatedElement - implements JavaResourcePackage { - - private String name; - - /** - * construct package info - */ - public static JavaResourcePackage newInstance( - JavaResourceCompilationUnit parent, - PackageDeclaration declaringPackage, - CompilationUnit astRoot) { - AnnotatedPackage pack = new JDTPackage( - declaringPackage, - parent.getCompilationUnit(), - parent.getModifySharedDocumentCommandExecutor(), - parent.getAnnotationEditFormatter()); - JavaResourcePackage jrpp = new SourcePackage(parent, pack); - jrpp.initialize(astRoot); - return jrpp; - } - - private SourcePackage( - JavaResourceCompilationUnit parent, - AnnotatedPackage pack){ - super(parent, pack); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - this.name = this.buildName(astRoot); - } - - - // ********** JavaResourcePackageInfo implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - private void syncName(String astName) { - if (valuesAreDifferent(astName, this.name)){ - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - } - - private String buildName(CompilationUnit astRoot) { - IPackageBinding binding = this.annotatedElement.getBinding(astRoot); - return (binding == null) ? null : binding.getName(); - } - - - // ********** Java changes ********** - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncName(this.buildName(astRoot)); - } - - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java deleted file mode 100644 index 02798852bb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourcePackageInfoCompilationUnit.java +++ /dev/null @@ -1,123 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Red Hat, Inc. - * Distributed under license by Red Hat, Inc. All rights reserved. - * This program is made available under the terms of the - * Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributor: - * Red Hat, Inc. - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.PackageDeclaration; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jaxb.core.AnnotationProvider; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackageInfoCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; - -/** - * @author Dmitry Geraskov - * Source package-info.java - * - */ -public final class SourcePackageInfoCompilationUnit - extends SourceCompilationUnit - implements JavaResourcePackageInfoCompilationUnit { - - private JavaResourcePackage package_; - - public SourcePackageInfoCompilationUnit( - ICompilationUnit compilationUnit, - AnnotationProvider annotationProvider, - AnnotationEditFormatter annotationEditFormatter, - CommandExecutor modifySharedDocumentCommandExecutor) { - super(compilationUnit, annotationProvider, annotationEditFormatter, modifySharedDocumentCommandExecutor); // the JPA compilation unit is the root of its sub-tree - this.package_ = this.buildPackage(); - } - - - private JavaResourcePackage buildPackage() { - this.openCompilationUnit(); - CompilationUnit astRoot = this.buildASTRoot(); - this.closeCompilationUnit(); - return this.buildPackage(astRoot); - } - - - // ********** JavaResourceNode.Root implementation ********** - - public Iterable getTypes() { - return EmptyIterable.instance(); - } - - public Iterable getEnums() { - return EmptyIterable.instance(); - } - - // ********** JptResourceModel implementation ********** - - public JptResourceType getResourceType() { - return JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_RESOURCE_TYPE; - } - - - // ********** Java changes ********** - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncPackage(astRoot); - } - - - // ********** JavaResourceCompilationUnit implementation ********** - - public void resolveTypes() { - //no-op - } - - // ********** package-info ********** - - public JavaResourcePackage getPackage() { - return this.package_; - } - - private JavaResourcePackage buildPackage(CompilationUnit astRoot) { - return this.buildPackage(astRoot, this.getPackageDeclaration(astRoot)); - } - - private void syncPackage(CompilationUnit astRoot) { - PackageDeclaration pd = this.getPackageDeclaration(astRoot); - if (pd == null) { - this.syncPackage_(null); - } else { - if (this.package_ == null) { - this.syncPackage_(this.buildPackage(astRoot, pd)); - } else { - this.package_.synchronizeWith(astRoot); - } - } - } - - private PackageDeclaration getPackageDeclaration(CompilationUnit astRoot) { - return astRoot.getPackage(); - } - - private void syncPackage_(JavaResourcePackage astPackage) { - JavaResourcePackage old = this.package_; - this.package_ = astPackage; - this.firePropertyChanged(PACKAGE, old, astPackage); - } - - private JavaResourcePackage buildPackage(CompilationUnit astRoot, PackageDeclaration packageDeclaration) { - return SourcePackage.newInstance(this, packageDeclaration, astRoot); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceType.java deleted file mode 100644 index b1c1983fac..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceType.java +++ /dev/null @@ -1,484 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumDeclaration; -import org.eclipse.jdt.core.dom.FieldDeclaration; -import org.eclipse.jdt.core.dom.IMethodBinding; -import org.eclipse.jdt.core.dom.ITypeBinding; -import org.eclipse.jdt.core.dom.MethodDeclaration; -import org.eclipse.jdt.core.dom.Modifier; -import org.eclipse.jdt.core.dom.TypeDeclaration; -import org.eclipse.jdt.core.dom.VariableDeclarationFragment; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTType; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.common.utility.MethodSignature; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TreeIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; - -/** - * Java source type - */ -final class SourceType - extends SourceAbstractType - implements JavaResourceType -{ - - private String superclassQualifiedName; - - private boolean abstract_; // 'abstract' is a reserved word - - private boolean hasNoArgConstructor; - - private final Vector types; - - private final Vector enums; - - private final Vector fields; - - private final Vector methods; - - - // ********** construction/initialization ********** - - /** - * build top-level type - */ - static JavaResourceType newInstance( - JavaResourceCompilationUnit javaResourceCompilationUnit, - TypeDeclaration typeDeclaration, - CompilationUnit astRoot) { - Type type = new JDTType( - typeDeclaration, - javaResourceCompilationUnit.getCompilationUnit(), - javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(), - javaResourceCompilationUnit.getAnnotationEditFormatter()); - JavaResourceType jrpt = new SourceType(javaResourceCompilationUnit, type); - jrpt.initialize(astRoot); - return jrpt; - } - - /** - * build nested type - */ - private static JavaResourceType newInstance( - JavaResourceCompilationUnit javaResourceCompilationUnit, - Type declaringType, - TypeDeclaration typeDeclaration, - int occurrence, - CompilationUnit astRoot) { - Type type = new JDTType( - declaringType, - typeDeclaration, - occurrence, - javaResourceCompilationUnit.getCompilationUnit(), - javaResourceCompilationUnit.getModifySharedDocumentCommandExecutor(), - javaResourceCompilationUnit.getAnnotationEditFormatter()); - JavaResourceType jrpt = new SourceType(javaResourceCompilationUnit, type); - jrpt.initialize(astRoot); - return jrpt; - } - - private SourceType(JavaResourceCompilationUnit javaResourceCompilationUnit, Type type) { - super(javaResourceCompilationUnit, type); - this.types = new Vector(); - this.enums = new Vector(); - this.fields = new Vector(); - this.methods = new Vector(); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - ITypeBinding binding = this.annotatedElement.getBinding(astRoot); - this.superclassQualifiedName = this.buildSuperclassQualifiedName(binding); - this.abstract_ = this.buildAbstract(binding); - this.hasNoArgConstructor = this.buildHasNoArgConstructor(binding); - this.initializeTypes(astRoot); - this.initializeEnums(astRoot); - this.initializeFields(astRoot); - this.initializeMethods(astRoot); - } - - - // ********** update ********** - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - ITypeBinding binding = this.annotatedElement.getBinding(astRoot); - this.syncSuperclassQualifiedName(this.buildSuperclassQualifiedName(binding)); - this.syncAbstract(this.buildAbstract(binding)); - this.syncHasNoArgConstructor(this.buildHasNoArgConstructor(binding)); - this.syncTypes(astRoot); - this.syncEnums(astRoot); - this.syncFields(astRoot); - this.syncMethods(astRoot); - } - - - // ********** SourceAnnotatedElement implementation ********** - - @Override - public void resolveTypes(CompilationUnit astRoot) { - super.resolveTypes(astRoot); - - this.syncSuperclassQualifiedName(this.buildSuperclassQualifiedName(this.annotatedElement.getBinding(astRoot))); - - for (JavaResourceField field : this.getFields()) { - field.resolveTypes(astRoot); - } - - // a new type can trigger a method parameter type to be a resolved, - // fully-qualified name, so we need to rebuild our list of methods: - // "setFoo(Foo)" is not the same as "setFoo(com.bar.Foo)" - // and, vice-versa, a removed type can "unresolve" a parameter type - this.syncMethods(astRoot); - - for (JavaResourceMethod method : this.getMethods()) { - method.resolveTypes(astRoot); - } - for (JavaResourceType type : this.getTypes()) { - type.resolveTypes(astRoot); - } - for (JavaResourceEnum enum_ : this.getEnums()) { - enum_.resolveTypes(astRoot); - } - } - - - // ******** JavaResourceType implementation ******** - - // ***** superclass qualified name - public String getSuperclassQualifiedName() { - return this.superclassQualifiedName; - } - - private void syncSuperclassQualifiedName(String astSuperclassQualifiedName) { - String old = this.superclassQualifiedName; - this.superclassQualifiedName = astSuperclassQualifiedName; - this.firePropertyChanged(SUPERCLASS_QUALIFIED_NAME_PROPERTY, old, astSuperclassQualifiedName); - } - - private String buildSuperclassQualifiedName(ITypeBinding binding) { - if (binding == null) { - return null; - } - ITypeBinding superclass = binding.getSuperclass(); - return (superclass == null) ? null : superclass.getTypeDeclaration().getQualifiedName(); - } - - // ***** abstract - public boolean isAbstract() { - return this.abstract_; - } - - private void syncAbstract(boolean astAbstract) { - boolean old = this.abstract_; - this.abstract_ = astAbstract; - this.firePropertyChanged(ABSTRACT_PROPERTY, old, astAbstract); - } - - private boolean buildAbstract(ITypeBinding binding) { - return (binding == null) ? false : Modifier.isAbstract(binding.getModifiers()); - } - - // ***** no-arg constructor - public boolean hasNoArgConstructor() { - return this.hasNoArgConstructor; - } - - private void syncHasNoArgConstructor(boolean hasNoArgConstructor) { - boolean old = this.hasNoArgConstructor; - this.hasNoArgConstructor = hasNoArgConstructor; - this.firePropertyChanged(NO_ARG_CONSTRUCTOR_PROPERTY, old, hasNoArgConstructor); - } - - private boolean buildHasNoArgConstructor(ITypeBinding binding) { - return (binding == null) ? false : typeHasNoArgConstructor(binding); - } - - protected static boolean typeHasNoArgConstructor(ITypeBinding binding) { - return findNoArgConstructor(binding) != null; - } - - protected static IMethodBinding findNoArgConstructor(ITypeBinding binding) { - for (IMethodBinding method : binding.getDeclaredMethods()) { - if (method.isConstructor()) { - if (method.getParameterTypes().length == 0) { - return method; - } - } - } - return null; - } - - // ********** types ********** - - public Iterable getTypes() { - return new LiveCloneIterable(this.types); // read-only - } - - public Iterable getAllTypes() { - return new TreeIterable(this) { - @Override - protected Iterator children(JavaResourceType type) { - return type.getTypes().iterator(); - } - }; - } - - private JavaResourceType getType(String typeName, int occurrence) { - for (JavaResourceType type : this.getTypes()) { - if (type.isFor(typeName, occurrence)) { - return type; - } - } - return null; - } - - private void addType(JavaResourceType type) { - this.addItemToCollection(type, this.types, TYPES_COLLECTION); - } - - private void removeTypes(Collection remove) { - this.removeItemsFromCollection(remove, this.types, TYPES_COLLECTION); - } - - private void initializeTypes(CompilationUnit astRoot) { - TypeDeclaration[] typeDeclarations = this.annotatedElement.getTypes(astRoot); - CounterMap counters = new CounterMap(typeDeclarations.length); - for (TypeDeclaration td : typeDeclarations) { - String tdName = td.getName().getFullyQualifiedName(); - int occurrence = counters.increment(tdName); - this.types.add(this.buildType(td, occurrence, astRoot)); - } - } - - private void syncTypes(CompilationUnit astRoot) { - TypeDeclaration[] typeDeclarations = this.annotatedElement.getTypes(astRoot); - CounterMap counters = new CounterMap(typeDeclarations.length); - HashSet typesToRemove = new HashSet(this.types); - for (TypeDeclaration typeDeclaration : typeDeclarations) { - String tdName = typeDeclaration.getName().getFullyQualifiedName(); - int occurrence = counters.increment(tdName); - - JavaResourceType type = this.getType(tdName, occurrence); - if (type == null) { - this.addType(this.buildType(typeDeclaration, occurrence, astRoot)); - } else { - typesToRemove.remove(type); - type.synchronizeWith(astRoot); - } - } - this.removeTypes(typesToRemove); - } - - private JavaResourceType buildType(TypeDeclaration nestedTypeDeclaration, int occurrence, CompilationUnit astRoot) { - return newInstance(this.getJavaResourceCompilationUnit(), this.annotatedElement, nestedTypeDeclaration, occurrence, astRoot); - } - - - // ********** enums ********** - - public Iterable getEnums() { - return new LiveCloneIterable(this.enums); // read-only - } - - public Iterable getAllEnums() { - return this.getEnums(); - } - - private JavaResourceEnum getEnum(String enumName, int occurrence) { - for (JavaResourceEnum enum_ : this.getEnums()) { - if (enum_.isFor(enumName, occurrence)) { - return enum_; - } - } - return null; - } - - private void addEnum(JavaResourceEnum enum_) { - this.addItemToCollection(enum_, this.enums, ENUMS_COLLECTION); - } - - private void removeEnums(Collection remove) { - this.removeItemsFromCollection(remove, this.enums, ENUMS_COLLECTION); - } - - private void initializeEnums(CompilationUnit astRoot) { - EnumDeclaration[] enumDeclarations = this.annotatedElement.getEnums(astRoot); - CounterMap counters = new CounterMap(enumDeclarations.length); - for (EnumDeclaration ed : enumDeclarations) { - String tdName = ed.getName().getFullyQualifiedName(); - int occurrence = counters.increment(tdName); - this.enums.add(this.buildEnum(ed, occurrence, astRoot)); - } - } - - private void syncEnums(CompilationUnit astRoot) { - EnumDeclaration[] enumDeclarations = this.annotatedElement.getEnums(astRoot); - CounterMap counters = new CounterMap(enumDeclarations.length); - HashSet enumsToRemove = new HashSet(this.enums); - for (EnumDeclaration enumDeclaration : enumDeclarations) { - String tdName = enumDeclaration.getName().getFullyQualifiedName(); - int occurrence = counters.increment(tdName); - - JavaResourceEnum enum_ = this.getEnum(tdName, occurrence); - if (enum_ == null) { - this.addEnum(this.buildEnum(enumDeclaration, occurrence, astRoot)); - } else { - enumsToRemove.remove(enum_); - enum_.synchronizeWith(astRoot); - } - } - this.removeEnums(enumsToRemove); - } - - private JavaResourceEnum buildEnum(EnumDeclaration nestedEnumDeclaration, int occurrence, CompilationUnit astRoot) { - return SourceEnum.newInstance(this.getJavaResourceCompilationUnit(), this.annotatedElement, nestedEnumDeclaration, occurrence, astRoot); - } - - - // ********** fields ********** - - public Iterable getFields() { - return new LiveCloneIterable(this.fields); - } - - private void addField(JavaResourceField field) { - this.addItemToCollection(field, this.fields, FIELDS_COLLECTION); - } - - private JavaResourceField getField(String fieldName, int occurrence) { - for (JavaResourceField field : this.getFields()) { - if (field.isFor(fieldName, occurrence)) { - return field; - } - } - return null; - } - - private void removeFields(Collection remove) { - this.removeItemsFromCollection(remove, this.fields, FIELDS_COLLECTION); - } - - private void initializeFields(CompilationUnit astRoot) { - FieldDeclaration[] fieldDeclarations = this.annotatedElement.getFields(astRoot); - CounterMap counters = new CounterMap(fieldDeclarations.length); - for (FieldDeclaration fieldDeclaration : fieldDeclarations) { - for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) { - String fieldName = fragment.getName().getFullyQualifiedName(); - int occurrence = counters.increment(fieldName); - this.fields.add(this.buildField(fieldName, occurrence, astRoot)); - } - } - } - - private void syncFields(CompilationUnit astRoot) { - FieldDeclaration[] fieldDeclarations = this.annotatedElement.getFields(astRoot); - CounterMap counters = new CounterMap(fieldDeclarations.length); - HashSet fieldsToRemove = new HashSet(this.fields); - for (FieldDeclaration fieldDeclaration : fieldDeclarations) { - for (VariableDeclarationFragment fragment : fragments(fieldDeclaration)) { - String fieldName = fragment.getName().getFullyQualifiedName(); - int occurrence = counters.increment(fieldName); - - JavaResourceField field = this.getField(fieldName, occurrence); - if (field == null) { - this.addField(this.buildField(fieldName, occurrence, astRoot)); - } else { - fieldsToRemove.remove(field); - field.synchronizeWith(astRoot); - } - } - } - this.removeFields(fieldsToRemove); - } - - private JavaResourceField buildField(String fieldName, int occurrence, CompilationUnit astRoot) { - return SourceField.newInstance(this, this.annotatedElement, fieldName, occurrence, this.getJavaResourceCompilationUnit(), astRoot); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - private static List fragments(FieldDeclaration fd) { - return fd.fragments(); - } - - - // ********** methods ********** - - public Iterable getMethods() { - return new LiveCloneIterable(this.methods); - } - - private JavaResourceMethod getMethod(MethodSignature signature, int occurrence) { - for (JavaResourceMethod method : this.getMethods()) { - if (method.isFor(signature, occurrence)) { - return method; - } - } - return null; - } - - private void addMethod(JavaResourceMethod method) { - this.addItemToCollection(method, this.methods, METHODS_COLLECTION); - } - - private void removeMethods(Collection remove) { - this.removeItemsFromCollection(remove, this.methods, METHODS_COLLECTION); - } - - private void initializeMethods(CompilationUnit astRoot) { - MethodDeclaration[] methodDeclarations = this.annotatedElement.getMethods(astRoot); - CounterMap counters = new CounterMap(methodDeclarations.length); - for (MethodDeclaration methodDeclaration : methodDeclarations) { - MethodSignature signature = ASTTools.buildMethodSignature(methodDeclaration); - int occurrence = counters.increment(signature); - this.methods.add(this.buildMethod(signature, occurrence, astRoot)); - } - } - - private void syncMethods(CompilationUnit astRoot) { - MethodDeclaration[] methodDeclarations = this.annotatedElement.getMethods(astRoot); - CounterMap counters = new CounterMap(methodDeclarations.length); - HashSet methodsToRemove = new HashSet(this.methods); - for (MethodDeclaration methodDeclaration : methodDeclarations) { - MethodSignature signature = ASTTools.buildMethodSignature(methodDeclaration); - int occurrence = counters.increment(signature); - - JavaResourceMethod method = this.getMethod(signature, occurrence); - if (method == null) { - this.addMethod(this.buildMethod(signature, occurrence, astRoot)); - } else { - methodsToRemove.remove(method); - method.synchronizeWith(astRoot); - } - } - this.removeMethods(methodsToRemove); - } - - private JavaResourceMethod buildMethod(MethodSignature signature, int occurrence, CompilationUnit astRoot) { - return SourceMethod.newInstance(this, this.annotatedElement, signature, occurrence, this.getJavaResourceCompilationUnit(), astRoot); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceTypeCompilationUnit.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceTypeCompilationUnit.java deleted file mode 100644 index f695130860..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceTypeCompilationUnit.java +++ /dev/null @@ -1,184 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import java.util.List; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.ASTNode; -import org.eclipse.jdt.core.dom.AbstractTypeDeclaration; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.EnumDeclaration; -import org.eclipse.jdt.core.dom.TypeDeclaration; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jaxb.core.AnnotationProvider; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; - -/** - * Java compilation unit (source file) - * non package-info.java file - */ -public final class SourceTypeCompilationUnit - extends SourceCompilationUnit -{ - - /** - * The primary type of the AST compilation unit. We are not going to handle - * multiple types defined in a single compilation unit. Entities must have - * a public/protected no-arg constructor, and there is no way to access - * the constructor in a package class (which is what all top-level, - * non-primary classes must be). - */ - private AbstractJavaResourceType type; - - - // ********** construction ********** - - public SourceTypeCompilationUnit( - ICompilationUnit compilationUnit, - AnnotationProvider annotationProvider, - AnnotationEditFormatter annotationEditFormatter, - CommandExecutor modifySharedDocumentCommandExecutor) { - super(compilationUnit, annotationProvider, annotationEditFormatter, modifySharedDocumentCommandExecutor); // the compilation unit is the root of its sub-tree - this.type = this.buildType(); - } - - private AbstractJavaResourceType buildType() { - this.openCompilationUnit(); - CompilationUnit astRoot = this.buildASTRoot(); - this.closeCompilationUnit(); - return this.buildPersistentType(astRoot); - } - - - // ********** JavaResourceNode implementation ********** - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncType(astRoot); - } - - - // ********** JavaResourceNode.Root implementation ********** - - /** - * NB: return *all* the types since we build them all - */ - public Iterable getTypes() { - return (this.type == null) ? - EmptyIterable.instance() : - this.type.getAllTypes(); - } - - /** - * NB: return *all* the enums since we build them all - */ - public Iterable getEnums() { - return (this.type == null) ? - EmptyIterable.instance() : - this.type.getAllEnums(); - } - - - // ********** JpaResourceModel implementation ********** - - public JptResourceType getResourceType() { - return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE; - } - - - // ********** JavaResourceCompilationUnit implementation ********** - - public void resolveTypes() { - if (this.type != null) { - this.type.resolveTypes(this.buildASTRoot()); - } - } - - - // ********** persistent type ********** - - private AbstractJavaResourceType buildPersistentType(CompilationUnit astRoot) { - AbstractTypeDeclaration td = this.getPrimaryTypeDeclaration(astRoot); - return (td == null) ? null : this.buildType(astRoot, td); - } - - - private void syncType(CompilationUnit astRoot) { - AbstractTypeDeclaration td = this.getPrimaryTypeDeclaration(astRoot); - if (td == null) { - this.syncType_(null); - } else { - if (this.type == null) { - this.syncType_(this.buildType(astRoot, td)); - } else { - this.type.synchronizeWith(astRoot); - } - } - } - - private void syncType_(AbstractJavaResourceType astType) { - AbstractJavaResourceType old = this.type; - this.type = astType; - this.firePropertyChanged(TYPES_COLLECTION, old, astType); - } - - - // ********** internal ********** - - private AbstractJavaResourceType buildType(CompilationUnit astRoot, AbstractTypeDeclaration typeDeclaration) { - if (typeDeclaration.getNodeType() == ASTNode.TYPE_DECLARATION) { - return SourceType.newInstance(this, (TypeDeclaration) typeDeclaration, astRoot); - } - else if (typeDeclaration.getNodeType() == ASTNode.ENUM_DECLARATION) { - return SourceEnum.newInstance(this, (EnumDeclaration) typeDeclaration, astRoot); - } - throw new IllegalArgumentException(); - } - - /** - * i.e. the type with the same name as the compilation unit; - * return the first class or interface (ignore annotations and enums) with - * the same name as the compilation unit (file); - * NB: this type could be in error if there is an annotation or enum - * with the same name preceding it in the compilation unit - * - * Return null if the parser did not resolve the type declaration's binding. - * This can occur if the project JRE is removed (bug 225332). - */ - private AbstractTypeDeclaration getPrimaryTypeDeclaration(CompilationUnit astRoot) { - String primaryTypeName = this.getPrimaryTypeName(); - for (AbstractTypeDeclaration atd : this.types(astRoot)) { - if (this.nodeIsPrimaryTypeDeclaration(atd, primaryTypeName)) { - return (atd.resolveBinding() == null) ? null : atd; - } - } - return null; - } - - private boolean nodeIsPrimaryTypeDeclaration(AbstractTypeDeclaration atd, String primaryTypeName) { - return (atd.getNodeType() == ASTNode.TYPE_DECLARATION || atd.getNodeType() == ASTNode.ENUM_DECLARATION) && - (atd.getName().getFullyQualifiedName().equals(primaryTypeName)); - } - - private String getPrimaryTypeName() { - return this.getCompilationUnitName(); - } - - // minimize scope of suppressed warnings - @SuppressWarnings("unchecked") - private List types(CompilationUnit astRoot) { - return astRoot.types(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorOrderAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorOrderAnnotation.java deleted file mode 100644 index 63426d92f1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorOrderAnnotation.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; - -/** - * javax.xml.bind.annotation.XmlAccessorOrder - */ -public final class SourceXmlAccessorOrderAnnotation - extends SourceAnnotation - implements XmlAccessorOrderAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter valueAdapter; - private XmlAccessOrder value; - - - public SourceXmlAccessorOrderAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - super(parent, annotatedElement, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter(annotatedElement, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - //*************** XmlAccessorOrderAnnotation implementation **************** - - // ***** value - public XmlAccessOrder getValue() { - return this.value; - } - - public void setValue(XmlAccessOrder value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(XmlAccessOrder.toJavaAnnotationValue(value)); - } - } - - private void syncValue(XmlAccessOrder astValue) { - XmlAccessOrder old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private XmlAccessOrder buildValue(CompilationUnit astRoot) { - return XmlAccessOrder.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter buildValueAdapter() { - //remove the XmlAccessorOrder annotation when the value element is removed. - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ACCESSOR_ORDER__VALUE); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorTypeAnnotation.java deleted file mode 100644 index bbc7fd08ca..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAccessorTypeAnnotation.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAccessorType - */ -public final class SourceXmlAccessorTypeAnnotation - extends SourceAnnotation - implements XmlAccessorTypeAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter valueAdapter; - private XmlAccessType value; - - - public SourceXmlAccessorTypeAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - super(parent, annotatedElement, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter(annotatedElement, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - //*************** XmlAccessorTypeAnnotation implementation **************** - - // ***** value - public XmlAccessType getValue() { - return this.value; - } - - public void setValue(XmlAccessType value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(XmlAccessType.toJavaAnnotationValue(value)); - } - } - - private void syncValue(XmlAccessType astValue) { - XmlAccessType old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private XmlAccessType buildValue(CompilationUnit astRoot) { - return XmlAccessType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter buildValueAdapter() { - //remove the XmlAccessorType annotation when the value element is removed. - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ACCESSOR_TYPE__VALUE); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyAttributeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyAttributeAnnotation.java deleted file mode 100644 index b8bb3a477d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyAttributeAnnotation.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyAttributeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAnyAttribute - */ -public final class SourceXmlAnyAttributeAnnotation - extends SourceAnnotation - implements XmlAnyAttributeAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlAnyAttributeAnnotation(JavaResourceMember parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyElementAnnotation.java deleted file mode 100644 index 18fe641193..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAnyElementAnnotation.java +++ /dev/null @@ -1,172 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlAnyElement - */ -public final class SourceXmlAnyElementAnnotation - extends SourceAnnotation - implements XmlAnyElementAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final DeclarationAnnotationElementAdapter laxDeclarationAdapter; - private final AnnotationElementAdapter laxAdapter; - private Boolean lax; - - private final DeclarationAnnotationElementAdapter valueDeclarationAdapter; - private final AnnotationElementAdapter valueAdapter; - private String value; - private String fullyQualifiedValueClassName; - - - // ********** constructors ********** - public SourceXmlAnyElementAnnotation(JavaResourceMember parent, Attribute attribute) { - this(parent, attribute, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(attribute, DECLARATION_ANNOTATION_ADAPTER)); - } - - public SourceXmlAnyElementAnnotation(JavaResourceMember parent, Attribute attribute, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, attribute, daa, annotationAdapter); - this.laxDeclarationAdapter = this.buildLaxAdapter(daa); - this.laxAdapter = this.buildShortCircuitBooleanElementAdapter(this.laxDeclarationAdapter); - this.valueDeclarationAdapter = this.buildValueAdapter(daa); - this.valueAdapter = this.buildAnnotationElementAdapter(this.valueDeclarationAdapter); - } - - private DeclarationAnnotationElementAdapter buildLaxAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, JAXB.XML_ANY_ELEMENT__LAX); - } - - private DeclarationAnnotationElementAdapter buildValueAdapter(DeclarationAnnotationAdapter daa) { - return buildAnnotationElementAdapter(daa, JAXB.XML_ANY_ELEMENT__VALUE, SimpleTypeStringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter converter) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, converter); - } - - private AnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - private AnnotationElementAdapter buildShortCircuitBooleanElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.lax = this.buildLax(astRoot); - this.value = this.buildValue(astRoot); - this.fullyQualifiedValueClassName = this.buildFullyQualifiedValueClassName(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncLax(this.buildLax(astRoot)); - this.syncValue(this.buildValue(astRoot)); - this.syncFullyQualifiedValueClassName(this.buildFullyQualifiedValueClassName(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** XmlAnyElementAnnotation implementation ********** - - // ***** lax - public Boolean getLax() { - return this.lax; - } - - public void setLax(Boolean lax) { - if (this.attributeValueHasChanged(this.lax, lax)) { - this.lax = lax; - this.laxAdapter.setValue(lax); - } - } - - private void syncLax(Boolean astLax) { - Boolean old = this.lax; - this.lax = astLax; - this.firePropertyChanged(LAX_PROPERTY, old, astLax); - } - - private Boolean buildLax(CompilationUnit astRoot) { - return this.laxAdapter.getValue(astRoot); - } - - public TextRange getLaxTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.laxDeclarationAdapter, astRoot); - } - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(String astValue) { - String old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private String buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.valueDeclarationAdapter, astRoot); - } - - // ***** fully-qualified value class name - public String getFullyQualifiedValueClassName() { - return this.fullyQualifiedValueClassName; - } - - private void syncFullyQualifiedValueClassName(String name) { - String old = this.fullyQualifiedValueClassName; - this.fullyQualifiedValueClassName = name; - this.firePropertyChanged(FULLY_QUALIFIED_VALUE_CLASS_NAME_PROPERTY, old, name); - } - - private String buildFullyQualifiedValueClassName(CompilationUnit astRoot) { - return (this.value == null) ? null : ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(astRoot)); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttachmentRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttachmentRefAnnotation.java deleted file mode 100644 index c342b209bb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttachmentRefAnnotation.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttachmentRefAnnotation; - -/** - * javax.xml.bind.annotation.XmlAttachmentRef - */ -public final class SourceXmlAttachmentRefAnnotation - extends SourceAnnotation - implements XmlAttachmentRefAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlAttachmentRefAnnotation(JavaResourceMember parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttributeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttributeAnnotation.java deleted file mode 100644 index 26391d1a39..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlAttributeAnnotation.java +++ /dev/null @@ -1,185 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; - -/** - * javax.xml.bind.annotation.XmlAttribute - */ -public final class SourceXmlAttributeAnnotation - extends SourceAnnotation - implements XmlAttributeAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final DeclarationAnnotationElementAdapter nameDeclarationAdapter; - private final AnnotationElementAdapter nameAdapter; - private String name; - - private final DeclarationAnnotationElementAdapter namespaceDeclarationAdapter; - private final AnnotationElementAdapter namespaceAdapter; - private String namespace; - - private final DeclarationAnnotationElementAdapter requiredDeclarationAdapter; - private final AnnotationElementAdapter requiredAdapter; - private Boolean required; - - - // ********** constructors ********** - public SourceXmlAttributeAnnotation(JavaResourceMember parent, Attribute attribute) { - this(parent, attribute, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(attribute, DECLARATION_ANNOTATION_ADAPTER)); - } - - public SourceXmlAttributeAnnotation(JavaResourceMember parent, Attribute attribute, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, attribute, daa, annotationAdapter); - this.nameDeclarationAdapter = this.buildNameAdapter(daa); - this.nameAdapter = this.buildAnnotationElementAdapter(this.nameDeclarationAdapter); - this.namespaceDeclarationAdapter = this.buildNamespaceAdapter(daa); - this.namespaceAdapter = this.buildAnnotationElementAdapter(this.namespaceDeclarationAdapter); - this.requiredDeclarationAdapter = this.buildRequiredAdapter(daa); - this.requiredAdapter = this.buildShortCircuitBooleanElementAdapter(this.requiredDeclarationAdapter); - } - - private DeclarationAnnotationElementAdapter buildNameAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ATTRIBUTE__NAME); - } - - private DeclarationAnnotationElementAdapter buildNamespaceAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ATTRIBUTE__NAMESPACE); - } - - private DeclarationAnnotationElementAdapter buildRequiredAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, JAXB.XML_ATTRIBUTE__REQUIRED); - } - - private AnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - private AnnotationElementAdapter buildShortCircuitBooleanElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.buildName(astRoot); - this.namespace = this.buildNamespace(astRoot); - this.required = this.buildRequired(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncName(this.buildName(astRoot)); - this.syncNamespace(this.buildNamespace(astRoot)); - this.syncRequired(this.buildRequired(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlAttributeAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nameDeclarationAdapter, astRoot); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (this.attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private void syncNamespace(String astNamespace) { - String old = this.namespace; - this.namespace = astNamespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace); - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.namespaceDeclarationAdapter, astRoot); - } - - // ***** required - public Boolean getRequired() { - return this.required; - } - - public void setRequired(Boolean required) { - if (this.attributeValueHasChanged(this.required, required)) { - this.required = required; - this.requiredAdapter.setValue(required); - } - } - - private void syncRequired(Boolean astRequired) { - Boolean old = this.required; - this.required = astRequired; - this.firePropertyChanged(REQUIRED_PROPERTY, old, astRequired); - } - - private Boolean buildRequired(CompilationUnit astRoot) { - return this.requiredAdapter.getValue(astRoot); - } - - public TextRange getRequiredTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.requiredDeclarationAdapter, astRoot); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementAnnotation.java deleted file mode 100644 index 9052b33bf5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementAnnotation.java +++ /dev/null @@ -1,362 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlElement - */ -public final class SourceXmlElementAnnotation - extends SourceAnnotation - implements XmlElementAnnotation -{ - private static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final DeclarationAnnotationElementAdapter nameDeclarationAdapter; - private final AnnotationElementAdapter nameAdapter; - private String name; - - private final DeclarationAnnotationElementAdapter namespaceDeclarationAdapter; - private final AnnotationElementAdapter namespaceAdapter; - private String namespace; - - private final DeclarationAnnotationElementAdapter nillableDeclarationAdapter; - private final AnnotationElementAdapter nillableAdapter; - private Boolean nillable; - - private final DeclarationAnnotationElementAdapter requiredDeclarationAdapter; - private final AnnotationElementAdapter requiredAdapter; - private Boolean required; - - private final DeclarationAnnotationElementAdapter defaultValueDeclarationAdapter; - private final AnnotationElementAdapter defaultValueAdapter; - private String defaultValue; - - private final DeclarationAnnotationElementAdapter typeDeclarationAdapter; - private final AnnotationElementAdapter typeAdapter; - private String type; - private String fullyQualifiedTypeName; - - - // ********** constructors ********** - public static SourceXmlElementAnnotation buildSourceXmlElementAnnotation(JavaResourceMember parent, Attribute attribute) { - return new SourceXmlElementAnnotation( - parent, - attribute, - DECLARATION_ANNOTATION_ADAPTER); - } - - public static SourceXmlElementAnnotation buildNestedSourceXmlElementAnnotation(JavaResourceNode parent, Attribute attribute, IndexedDeclarationAnnotationAdapter idaa) { - IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(attribute, idaa); - return new SourceXmlElementAnnotation(parent, attribute, idaa, annotationAdapter); - } - - - private SourceXmlElementAnnotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, attribute, daa, annotationAdapter); - this.nameDeclarationAdapter = this.buildNameAdapter(daa); - this.nameAdapter = this.buildAnnotationElementAdapter(this.nameDeclarationAdapter); - this.namespaceDeclarationAdapter = this.buildNamespaceAdapter(daa); - this.namespaceAdapter = this.buildAnnotationElementAdapter(this.namespaceDeclarationAdapter); - this.nillableDeclarationAdapter = this.buildNillableAdapter(daa); - this.nillableAdapter = this.buildShortCircuitBooleanElementAdapter(this.nillableDeclarationAdapter); - this.requiredDeclarationAdapter = this.buildRequiredAdapter(daa); - this.requiredAdapter = this.buildShortCircuitBooleanElementAdapter(this.requiredDeclarationAdapter); - this.defaultValueDeclarationAdapter = this.buildDefaultValueAdapter(daa); - this.defaultValueAdapter = this.buildAnnotationElementAdapter(this.defaultValueDeclarationAdapter); - this.typeDeclarationAdapter = this.buildTypeAdapter(daa); - this.typeAdapter = this.buildAnnotationElementAdapter(this.typeDeclarationAdapter); - } - - private SourceXmlElementAnnotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa) { - this(parent, attribute, daa, new ElementAnnotationAdapter(attribute, daa)); - } - - private SourceXmlElementAnnotation(JavaResourceNode parent, Attribute attribute, IndexedDeclarationAnnotationAdapter idaa) { - this(parent, attribute, idaa, new ElementIndexedAnnotationAdapter(attribute, idaa)); - } - - private DeclarationAnnotationElementAdapter buildNameAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT__NAME); - } - - private DeclarationAnnotationElementAdapter buildNamespaceAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT__NAMESPACE); - } - - private DeclarationAnnotationElementAdapter buildNillableAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, JAXB.XML_ELEMENT__NILLABLE); - } - - private DeclarationAnnotationElementAdapter buildRequiredAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, JAXB.XML_ELEMENT__REQUIRED); - } - - private DeclarationAnnotationElementAdapter buildDefaultValueAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT__DEFAULT_VALUE); - } - - private DeclarationAnnotationElementAdapter buildTypeAdapter(DeclarationAnnotationAdapter daa) { - return buildAnnotationElementAdapter(daa, JAXB.XML_ELEMENT__TYPE, SimpleTypeStringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter converter) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, converter); - } - - private AnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - private AnnotationElementAdapter buildShortCircuitBooleanElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.buildName(astRoot); - this.namespace = this.buildNamespace(astRoot); - this.nillable = this.buildNillable(astRoot); - this.required = this.buildRequired(astRoot); - this.defaultValue = this.buildDefaultValue(astRoot); - this.type = this.buildType(astRoot); - this.fullyQualifiedTypeName = this.buildFullyQualifiedTypeName(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncName(this.buildName(astRoot)); - this.syncNamespace(this.buildNamespace(astRoot)); - this.syncNillable(this.buildNillable(astRoot)); - this.syncRequired(this.buildRequired(astRoot)); - this.syncDefaultValue(this.buildDefaultValue(astRoot)); - this.syncType(this.buildType(astRoot)); - this.syncFullyQualifiedTypeName(this.buildFullyQualifiedTypeName(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlElementAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nameDeclarationAdapter, astRoot); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (this.attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private void syncNamespace(String astNamespace) { - String old = this.namespace; - this.namespace = astNamespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace); - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.namespaceDeclarationAdapter, astRoot); - } - - // ***** nillable - public Boolean getNillable() { - return this.nillable; - } - - public void setNillable(Boolean nillable) { - if (this.attributeValueHasChanged(this.nillable, nillable)) { - this.nillable = nillable; - this.nillableAdapter.setValue(nillable); - } - } - - private void syncNillable(Boolean astNillable) { - Boolean old = this.nillable; - this.nillable = astNillable; - this.firePropertyChanged(NILLABLE_PROPERTY, old, astNillable); - } - - private Boolean buildNillable(CompilationUnit astRoot) { - return this.nillableAdapter.getValue(astRoot); - } - - public TextRange getNillableTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nillableDeclarationAdapter, astRoot); - } - - // ***** required - public Boolean getRequired() { - return this.required; - } - - public void setRequired(Boolean required) { - if (this.attributeValueHasChanged(this.required, required)) { - this.required = required; - this.requiredAdapter.setValue(required); - } - } - - private void syncRequired(Boolean astRequired) { - Boolean old = this.required; - this.required = astRequired; - this.firePropertyChanged(REQUIRED_PROPERTY, old, astRequired); - } - - private Boolean buildRequired(CompilationUnit astRoot) { - return this.requiredAdapter.getValue(astRoot); - } - - public TextRange getRequiredTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.requiredDeclarationAdapter, astRoot); - } - - // ***** defaultValue - public String getDefaultValue() { - return this.defaultValue; - } - - public void setDefaultValue(String defaultValue) { - if (this.attributeValueHasChanged(this.defaultValue, defaultValue)) { - this.defaultValue = defaultValue; - this.defaultValueAdapter.setValue(defaultValue); - } - } - - private void syncDefaultValue(String astDefaultValue) { - String old = this.defaultValue; - this.defaultValue = astDefaultValue; - this.firePropertyChanged(DEFAULT_VALUE_PROPERTY, old, astDefaultValue); - } - - private String buildDefaultValue(CompilationUnit astRoot) { - return this.defaultValueAdapter.getValue(astRoot); - } - - public TextRange getDefaultValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.defaultValueDeclarationAdapter, astRoot); - } - - // ***** type - public String getType() { - return this.type; - } - - public void setType(String type) { - if (this.attributeValueHasChanged(this.type, type)) { - this.type = type; - this.typeAdapter.setValue(type); - } - } - - private void syncType(String astType) { - String old = this.type; - this.type = astType; - this.firePropertyChanged(TYPE_PROPERTY, old, astType); - } - - private String buildType(CompilationUnit astRoot) { - return this.typeAdapter.getValue(astRoot); - } - - public TextRange getTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.typeDeclarationAdapter, astRoot); - } - - // ***** fully-qualified type name - public String getFullyQualifiedTypeName() { - return this.fullyQualifiedTypeName; - } - - private void syncFullyQualifiedTypeName(String name) { - String old = this.fullyQualifiedTypeName; - this.fullyQualifiedTypeName = name; - this.firePropertyChanged(FULLY_QUALIFIED_TYPE_NAME_PROPERTY, old, name); - } - - private String buildFullyQualifiedTypeName(CompilationUnit astRoot) { - return (this.type == null) ? null : ASTTools.resolveFullyQualifiedName(this.typeAdapter.getExpression(astRoot)); - } - - - //*********** NestableAnnotation implementation **************** - - /** - * convenience implementation of method from NestableAnnotation interface - * for subclasses - */ - public void moveAnnotation(int newIndex) { - this.getIndexedAnnotationAdapter().moveAnnotation(newIndex); - } - - private IndexedAnnotationAdapter getIndexedAnnotationAdapter() { - return (IndexedAnnotationAdapter) this.annotationAdapter; - } - - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementDeclAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementDeclAnnotation.java deleted file mode 100644 index b50d5e1fcc..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementDeclAnnotation.java +++ /dev/null @@ -1,313 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.common.core.utility.jdt.MethodAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementDeclAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementDecl - */ -public final class SourceXmlElementDeclAnnotation - extends SourceAnnotation - implements XmlElementDeclAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter NAME_ADAPTER = buildNameAdapter(); - private final AnnotationElementAdapter nameAdapter; - private String name; - - private static final DeclarationAnnotationElementAdapter NAMESPACE_ADAPTER = buildNamespaceAdapter(); - private final AnnotationElementAdapter namespaceAdapter; - private String namespace; - - private static final DeclarationAnnotationElementAdapter DEFAULT_VALUE_ADAPTER = buildDefaultValueAdapter(); - private final AnnotationElementAdapter defaultValueAdapter; - private String defaultValue; - - private static final DeclarationAnnotationElementAdapter SCOPE_ADAPTER = buildScopeAdapter(); - private final AnnotationElementAdapter scopeAdapter; - private String scope; - private String fullyQualifiedScopeClassName; - - private static final DeclarationAnnotationElementAdapter SUBSTITUTION_HEAD_NAME_ADAPTER = buildSubstitutionHeadNameAdapter(); - private final AnnotationElementAdapter substitutionHeadNameAdapter; - private String substitutionHeadName; - - private static final DeclarationAnnotationElementAdapter SUBSTITUTION_HEAD_NAMESPACE_ADAPTER = buildSubstitutionHeadNamespaceAdapter(); - private final AnnotationElementAdapter substitutionHeadNamespaceAdapter; - private String substitutionHeadNamespace; - - - // ********** constructors ********** - - public SourceXmlElementDeclAnnotation(JavaResourceMethod parent, MethodAttribute method) { - super(parent, method, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(method, DECLARATION_ANNOTATION_ADAPTER)); - this.nameAdapter = this.buildAnnotationElementAdapter(NAME_ADAPTER); - this.namespaceAdapter = this.buildAnnotationElementAdapter(NAMESPACE_ADAPTER); - this.defaultValueAdapter = this.buildAnnotationElementAdapter(DEFAULT_VALUE_ADAPTER); - this.scopeAdapter = this.buildAnnotationElementAdapter(SCOPE_ADAPTER); - this.substitutionHeadNameAdapter = this.buildAnnotationElementAdapter(SUBSTITUTION_HEAD_NAME_ADAPTER); - this.substitutionHeadNamespaceAdapter = this.buildAnnotationElementAdapter(SUBSTITUTION_HEAD_NAMESPACE_ADAPTER); - } - - private AnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.buildName(astRoot); - this.namespace = this.buildNamespace(astRoot); - this.defaultValue = this.buildDefaultValue(astRoot); - this.scope = this.buildScope(astRoot); - this.fullyQualifiedScopeClassName = this.buildFullyQualifiedScopeClassName(astRoot); - this.substitutionHeadName = this.buildSubstitutionHeadName(astRoot); - this.substitutionHeadNamespace = this.buildSubstitutionHeadNamespace(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncName(this.buildName(astRoot)); - this.syncNamespace(this.buildNamespace(astRoot)); - this.syncDefaultValue(this.buildDefaultValue(astRoot)); - this.syncScope(this.buildScope(astRoot)); - this.syncFullyQualifiedScopeClassName(this.buildFullyQualifiedScopeClassName(astRoot)); - this.syncSubstitutionHeadName(this.buildSubstitutionHeadName(astRoot)); - this.syncSubstitutionHeadNamespace(this.buildSubstitutionHeadNamespace(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlElementDeclAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(NAME_ADAPTER, astRoot); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (this.attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private void syncNamespace(String astNamespace) { - String old = this.namespace; - this.namespace = astNamespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace); - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(NAMESPACE_ADAPTER, astRoot); - } - - // ***** defaultValue - public String getDefaultValue() { - return this.defaultValue; - } - - public void setDefaultValue(String defaultValue) { - if (this.attributeValueHasChanged(this.defaultValue, defaultValue)) { - this.defaultValue = defaultValue; - this.defaultValueAdapter.setValue(defaultValue); - } - } - - private void syncDefaultValue(String astDefaultValue) { - String old = this.defaultValue; - this.defaultValue = astDefaultValue; - this.firePropertyChanged(DEFAULT_VALUE_PROPERTY, old, astDefaultValue); - } - - private String buildDefaultValue(CompilationUnit astRoot) { - return this.defaultValueAdapter.getValue(astRoot); - } - - public TextRange getDefaultValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(DEFAULT_VALUE_ADAPTER, astRoot); - } - - // ***** scope - public String getScope() { - return this.scope; - } - - public void setScope(String scope) { - if (this.attributeValueHasChanged(this.scope, scope)) { - this.scope = scope; - this.scopeAdapter.setValue(scope); - } - } - - private void syncScope(String astScope) { - String old = this.scope; - this.scope = astScope; - this.firePropertyChanged(SCOPE_PROPERTY, old, astScope); - } - - private String buildScope(CompilationUnit astRoot) { - return this.scopeAdapter.getValue(astRoot); - } - - public TextRange getScopeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(SCOPE_ADAPTER, astRoot); - } - - // ***** fully-qualified scope class name - public String getFullyQualifiedScopeClassName() { - return this.fullyQualifiedScopeClassName; - } - - private void syncFullyQualifiedScopeClassName(String name) { - String old = this.fullyQualifiedScopeClassName; - this.fullyQualifiedScopeClassName = name; - this.firePropertyChanged(FULLY_QUALIFIED_SCOPE_CLASS_NAME_PROPERTY, old, name); - } - - private String buildFullyQualifiedScopeClassName(CompilationUnit astRoot) { - return (this.scope == null) ? null : ASTTools.resolveFullyQualifiedName(this.scopeAdapter.getExpression(astRoot)); - } - - // ***** substitutionHeadName - public String getSubstitutionHeadName() { - return this.substitutionHeadName; - } - - public void setSubstitutionHeadName(String substitutionHeadName) { - if (this.attributeValueHasChanged(this.substitutionHeadName, substitutionHeadName)) { - this.substitutionHeadName = substitutionHeadName; - this.substitutionHeadNameAdapter.setValue(substitutionHeadName); - } - } - - private void syncSubstitutionHeadName(String astSubstitutionHeadName) { - String old = this.substitutionHeadName; - this.substitutionHeadName = astSubstitutionHeadName; - this.firePropertyChanged(SUBSTITUTION_HEAD_NAME_PROPERTY, old, astSubstitutionHeadName); - } - - private String buildSubstitutionHeadName(CompilationUnit astRoot) { - return this.substitutionHeadNameAdapter.getValue(astRoot); - } - - public TextRange getSubstitutionHeadNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(SUBSTITUTION_HEAD_NAME_ADAPTER, astRoot); - } - - // ***** substitutionHeadNamespace - public String getSubstitutionHeadNamespace() { - return this.substitutionHeadNamespace; - } - - public void setSubstitutionHeadNamespace(String substitutionHeadNamespace) { - if (this.attributeValueHasChanged(this.substitutionHeadNamespace, substitutionHeadNamespace)) { - this.substitutionHeadNamespace = substitutionHeadNamespace; - this.substitutionHeadNamespaceAdapter.setValue(substitutionHeadNamespace); - } - } - - private void syncSubstitutionHeadNamespace(String astSubstitutionHeadNamespace) { - String old = this.substitutionHeadNamespace; - this.substitutionHeadNamespace = astSubstitutionHeadNamespace; - this.firePropertyChanged(SUBSTITUTION_HEAD_NAMESPACE_PROPERTY, old, astSubstitutionHeadNamespace); - } - - private String buildSubstitutionHeadNamespace(CompilationUnit astRoot) { - return this.substitutionHeadNamespaceAdapter.getValue(astRoot); - } - - public TextRange getSubstitutionHeadNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(SUBSTITUTION_HEAD_NAMESPACE_ADAPTER, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter buildNameAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ELEMENT_DECL__NAME); - } - - private static DeclarationAnnotationElementAdapter buildNamespaceAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ELEMENT_DECL__NAMESPACE); - } - - private static DeclarationAnnotationElementAdapter buildDefaultValueAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ELEMENT_DECL__DEFAULT_VALUE); - } - - private static DeclarationAnnotationElementAdapter buildScopeAdapter() { - return buildAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ELEMENT_DECL__SCOPE, SimpleTypeStringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter buildSubstitutionHeadNameAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ELEMENT_DECL__SUBSTITUTION_HEAD_NAME); - } - - private static DeclarationAnnotationElementAdapter buildSubstitutionHeadNamespaceAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ELEMENT_DECL__SUBSTITUTION_HEAD_NAMESPACE); - } - - private static DeclarationAnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter converter) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, converter); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefAnnotation.java deleted file mode 100644 index 33971cf6d2..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementRefAnnotation.java +++ /dev/null @@ -1,253 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementRef - */ -public final class SourceXmlElementRefAnnotation - extends SourceAnnotation - implements XmlElementRefAnnotation -{ - public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - public static final SimpleDeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JAXB.XML_ELEMENT_REFS); - - private String fullyQualifiedTypeName; - - private final DeclarationAnnotationElementAdapter nameDeclarationAdapter; - private final AnnotationElementAdapter nameAdapter; - private String name; - - private final DeclarationAnnotationElementAdapter namespaceDeclarationAdapter; - private final AnnotationElementAdapter namespaceAdapter; - private String namespace; - - private final DeclarationAnnotationElementAdapter typeDeclarationAdapter; - private final AnnotationElementAdapter typeAdapter; - private String type; - - // ********** constructors ********** - public static SourceXmlElementRefAnnotation buildSourceXmlElementRefAnnotation(JavaResourceField parent, Attribute attribute, int index) { - IndexedDeclarationAnnotationAdapter idaa = buildXmlElementRefDeclarationAnnotationAdapter(index); - IndexedAnnotationAdapter iaa = buildXmlElementRefAnnotationAdapter(attribute, idaa); - return new SourceXmlElementRefAnnotation( - parent, - attribute, - idaa, - iaa); - } - - private SourceXmlElementRefAnnotation( - JavaResourceField parent, - Attribute attribute, - IndexedDeclarationAnnotationAdapter daa, - IndexedAnnotationAdapter annotationAdapter) { - super(parent, attribute, daa, annotationAdapter); - this.nameDeclarationAdapter = this.buildNameAdapter(daa); - this.nameAdapter = this.buildAnnotationElementAdapter(this.nameDeclarationAdapter); - this.namespaceDeclarationAdapter = this.buildNamespaceAdapter(daa); - this.namespaceAdapter = this.buildAnnotationElementAdapter(this.namespaceDeclarationAdapter); - this.typeDeclarationAdapter = this.buildTypeAdapter(daa); - this.typeAdapter = this.buildAnnotationElementAdapter(this.typeDeclarationAdapter); - } - - private DeclarationAnnotationElementAdapter buildNameAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT_REF__NAME); - } - - private DeclarationAnnotationElementAdapter buildNamespaceAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT_REF__NAMESPACE); - } - - private DeclarationAnnotationElementAdapter buildTypeAdapter(DeclarationAnnotationAdapter daa) { - return buildAnnotationElementAdapter(daa, JAXB.XML_ELEMENT_REF__TYPE, SimpleTypeStringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter converter) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, converter); - } - - private AnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.buildName(astRoot); - this.namespace = this.buildNamespace(astRoot); - this.type = this.buildType(astRoot); - this.fullyQualifiedTypeName = this.buildFullyQualifiedTypeName(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncName(this.buildName(astRoot)); - this.syncNamespace(this.buildNamespace(astRoot)); - this.syncType(this.buildType(astRoot)); - this.syncFullyQualifiedTypeName(this.buildFullyQualifiedTypeName(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlElementRefAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nameDeclarationAdapter, astRoot); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (this.attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private void syncNamespace(String astNamespace) { - String old = this.namespace; - this.namespace = astNamespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace); - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.namespaceDeclarationAdapter, astRoot); - } - - // ***** type - public String getType() { - return this.type; - } - - public void setType(String type) { - if (this.attributeValueHasChanged(this.type, type)) { - this.type = type; - this.typeAdapter.setValue(type); - } - } - - private void syncType(String astType) { - String old = this.type; - this.type = astType; - this.firePropertyChanged(TYPE_PROPERTY, old, astType); - } - - private String buildType(CompilationUnit astRoot) { - return this.typeAdapter.getValue(astRoot); - } - - public TextRange getTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.typeDeclarationAdapter, astRoot); - } - - // ***** fully-qualified type name - public String getFullyQualifiedTypeName() { - return this.fullyQualifiedTypeName; - } - - private void syncFullyQualifiedTypeName(String name) { - String old = this.fullyQualifiedTypeName; - this.fullyQualifiedTypeName = name; - this.firePropertyChanged(FULLY_QUALIFIED_TYPE_NAME_PROPERTY, old, name); - } - - private String buildFullyQualifiedTypeName(CompilationUnit astRoot) { - return (this.type == null) ? null : ASTTools.resolveFullyQualifiedName(this.typeAdapter.getExpression(astRoot)); - } - - - //*********** NestableAnnotation implementation **************** - - /** - * convenience implementation of method from NestableAnnotation interface - * for subclasses - */ - public void moveAnnotation(int newIndex) { - this.getIndexedAnnotationAdapter().moveAnnotation(newIndex); - } - - private IndexedAnnotationAdapter getIndexedAnnotationAdapter() { - return (IndexedAnnotationAdapter) this.annotationAdapter; - } - - - // ********** static methods ********** - - private static IndexedAnnotationAdapter buildXmlElementRefAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) { - return new ElementIndexedAnnotationAdapter(annotatedElement, idaa); - } - - private static IndexedDeclarationAnnotationAdapter buildXmlElementRefDeclarationAnnotationAdapter(int index) { - IndexedDeclarationAnnotationAdapter idaa = - new CombinationIndexedDeclarationAnnotationAdapter( - DECLARATION_ANNOTATION_ADAPTER, - CONTAINER_DECLARATION_ANNOTATION_ADAPTER, - index, - JAXB.XML_ELEMENT_REF); - return idaa; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementWrapperAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementWrapperAnnotation.java deleted file mode 100644 index 79bfc80693..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementWrapperAnnotation.java +++ /dev/null @@ -1,223 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation; - -/** - * javax.xml.bind.annotation.XmlElementWrapper - */ -public final class SourceXmlElementWrapperAnnotation - extends SourceAnnotation - implements XmlElementWrapperAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final DeclarationAnnotationElementAdapter nameDeclarationAdapter; - private final AnnotationElementAdapter nameAdapter; - private String name; - - private final DeclarationAnnotationElementAdapter namespaceDeclarationAdapter; - private final AnnotationElementAdapter namespaceAdapter; - private String namespace; - - private final DeclarationAnnotationElementAdapter nillableDeclarationAdapter; - private final AnnotationElementAdapter nillableAdapter; - private Boolean nillable; - - private final DeclarationAnnotationElementAdapter requiredDeclarationAdapter; - private final AnnotationElementAdapter requiredAdapter; - private Boolean required; - - - // ********** constructors ********** - public SourceXmlElementWrapperAnnotation(JavaResourceMember parent, Attribute attribute) { - this(parent, attribute, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(attribute, DECLARATION_ANNOTATION_ADAPTER)); - } - - public SourceXmlElementWrapperAnnotation(JavaResourceMember parent, Attribute attribute, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, attribute, daa, annotationAdapter); - this.nameDeclarationAdapter = this.buildNameAdapter(daa); - this.nameAdapter = this.buildAnnotationElementAdapter(this.nameDeclarationAdapter); - this.namespaceDeclarationAdapter = this.buildNamespaceAdapter(daa); - this.namespaceAdapter = this.buildAnnotationElementAdapter(this.namespaceDeclarationAdapter); - this.nillableDeclarationAdapter = this.buildNillableAdapter(daa); - this.nillableAdapter = this.buildShortCircuitBooleanElementAdapter(this.nillableDeclarationAdapter); - this.requiredDeclarationAdapter = this.buildRequiredAdapter(daa); - this.requiredAdapter = this.buildShortCircuitBooleanElementAdapter(this.requiredDeclarationAdapter); - } - - private DeclarationAnnotationElementAdapter buildNameAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT_WRAPPER__NAME); - } - - private DeclarationAnnotationElementAdapter buildNamespaceAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_ELEMENT_WRAPPER__NAMESPACE); - } - - private DeclarationAnnotationElementAdapter buildNillableAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, JAXB.XML_ELEMENT_WRAPPER__NILLABLE); - } - - private DeclarationAnnotationElementAdapter buildRequiredAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forBooleans(daa, JAXB.XML_ELEMENT_WRAPPER__REQUIRED); - } - - private AnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - private AnnotationElementAdapter buildShortCircuitBooleanElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.buildName(astRoot); - this.namespace = this.buildNamespace(astRoot); - this.nillable = this.buildNillable(astRoot); - this.required = this.buildRequired(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncName(this.buildName(astRoot)); - this.syncNamespace(this.buildNamespace(astRoot)); - this.syncNillable(this.buildNillable(astRoot)); - this.syncRequired(this.buildRequired(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlElementWrapperAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nameDeclarationAdapter, astRoot); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (this.attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private void syncNamespace(String astNamespace) { - String old = this.namespace; - this.namespace = astNamespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace); - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.namespaceDeclarationAdapter, astRoot); - } - - // ***** nillable - public Boolean getNillable() { - return this.nillable; - } - - public void setNillable(Boolean nillable) { - if (this.attributeValueHasChanged(this.nillable, nillable)) { - this.nillable = nillable; - this.nillableAdapter.setValue(nillable); - } - } - - private void syncNillable(Boolean astNillable) { - Boolean old = this.nillable; - this.nillable = astNillable; - this.firePropertyChanged(NILLABLE_PROPERTY, old, astNillable); - } - - private Boolean buildNillable(CompilationUnit astRoot) { - return this.nillableAdapter.getValue(astRoot); - } - - public TextRange getNillableTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nillableDeclarationAdapter, astRoot); - } - - // ***** required - public Boolean getRequired() { - return this.required; - } - - public void setRequired(Boolean required) { - if (this.attributeValueHasChanged(this.required, required)) { - this.required = required; - this.requiredAdapter.setValue(required); - } - } - - private void syncRequired(Boolean astRequired) { - Boolean old = this.required; - this.required = astRequired; - this.firePropertyChanged(REQUIRED_PROPERTY, old, astRequired); - } - - private Boolean buildRequired(CompilationUnit astRoot) { - return this.requiredAdapter.getValue(astRoot); - } - - public TextRange getRequiredTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.requiredDeclarationAdapter, astRoot); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementsAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementsAnnotation.java deleted file mode 100644 index a938c23116..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlElementsAnnotation.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementsAnnotation; - -/** - * javax.xml.bind.annotation.XmlElements - */ -public class SourceXmlElementsAnnotation - extends SourceAnnotation - implements XmlElementsAnnotation { - - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER - = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - private final XmlElementsAnnotationContainer xmlElementsContainer = new XmlElementsAnnotationContainer(); - - public SourceXmlElementsAnnotation(JavaResourceAttribute parent, Attribute attribute) { - this(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public SourceXmlElementsAnnotation(JavaResourceAttribute parent, Attribute attribute, DeclarationAnnotationAdapter daa) { - super(parent, attribute, daa); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.xmlElementsContainer.initialize(this.getAstAnnotation(astRoot)); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.xmlElementsContainer.synchronize(this.getAstAnnotation(astRoot)); - } - - - // **************** xmlns ************************************************* - - public ListIterable getXmlElements() { - return this.xmlElementsContainer.getNestedAnnotations(); - } - - public int getXmlElementsSize() { - return this.xmlElementsContainer.getNestedAnnotationsSize(); - } - - public XmlElementAnnotation xmlElementAt(int index) { - return this.xmlElementsContainer.nestedAnnotationAt(index); - } - - public XmlElementAnnotation addXmlElement(int index) { - return this.xmlElementsContainer.addNestedAnnotation(index); - } - - private XmlElementAnnotation buildXmlElement(int index) { - return SourceXmlElementAnnotation.buildNestedSourceXmlElementAnnotation(this, this.annotatedElement, buildXmlElementIndexedDeclarationAnnotationAdapter(index)); - } - - private IndexedDeclarationAnnotationAdapter buildXmlElementIndexedDeclarationAnnotationAdapter(int index) { - return new NestedIndexedDeclarationAnnotationAdapter( - this.daa, JAXB.XML_ELEMENTS__VALUE, index, JAXB.XML_ELEMENT); - } - - public void moveXmlElement(int targetIndex, int sourceIndex) { - this.xmlElementsContainer.moveNestedAnnotation(targetIndex, sourceIndex); - } - - public void removeXmlElement(int index) { - this.xmlElementsContainer.removeNestedAnnotation(index); - } - - /** - * adapt the AnnotationContainer interface to the xml schema's xmlns - */ - class XmlElementsAnnotationContainer - extends AnnotationContainer - { - @Override - protected String getAnnotationsPropertyName() { - return XML_ELEMENTS_LIST; - } - @Override - protected String getElementName() { - return JAXB.XML_ELEMENTS__VALUE; - } - @Override - protected String getNestedAnnotationName() { - return JAXB.XML_ELEMENT; - } - @Override - protected XmlElementAnnotation buildNestedAnnotation(int index) { - return SourceXmlElementsAnnotation.this.buildXmlElement(index); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumAnnotation.java deleted file mode 100644 index ce88ee64b6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumAnnotation.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumAnnotation; - -/** - * javax.xml.bind.annotation.XmlEnum - */ -public final class SourceXmlEnumAnnotation - extends SourceAnnotation - implements XmlEnumAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter valueAdapter; - private String value; - - private String fullyQualifiedValueClassName; - - public SourceXmlEnumAnnotation(AbstractJavaResourceType parent, AbstractType type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = this.buildAnnotationElementAdapter(VALUE_ADAPTER); - } - - protected AnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - this.fullyQualifiedValueClassName = this.buildFullyQualifiedValueClassName(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - this.syncFullyQualifiedValueClassName(this.buildFullyQualifiedValueClassName(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** XmlEnumAnnotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(String astValue) { - String old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private String buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - // ***** fully-qualified value class name - public String getFullyQualifiedValueClassName() { - return this.fullyQualifiedValueClassName; - } - - private void syncFullyQualifiedValueClassName(String name) { - String old = this.fullyQualifiedValueClassName; - this.fullyQualifiedValueClassName = name; - this.firePropertyChanged(FULLY_QUALIFIED_VALUE_CLASS_NAME_PROPERTY, old, name); - } - - private String buildFullyQualifiedValueClassName(CompilationUnit astRoot) { - return (this.value == null) ? null : ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(astRoot)); - } - - - //*********** static methods **************** - - private static DeclarationAnnotationElementAdapter buildValueAdapter() { - return buildAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ENUM__VALUE, SimpleTypeStringExpressionConverter.instance()); - } - - static DeclarationAnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter converter) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, converter); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumValueAnnotation.java deleted file mode 100644 index 5d3bab34a1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlEnumValueAnnotation.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.EnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation; - -/** - * javax.xml.bind.annotation.XmlEnumValue - */ -public final class SourceXmlEnumValueAnnotation - extends SourceAnnotation - implements XmlEnumValueAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter valueAdapter; - private String value; - - public SourceXmlEnumValueAnnotation(JavaResourceEnumConstant parent, EnumConstant enumConstant) { - super(parent, enumConstant, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = this.buildAnnotationElementAdapter(VALUE_ADAPTER); - } - - protected AnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** XmlEnumValueAnnotation implementation ********** - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(String astValue) { - String old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private String buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - - //*********** static methods **************** - - private static DeclarationAnnotationElementAdapter buildValueAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ENUM_VALUE__VALUE); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDAnnotation.java deleted file mode 100644 index 8968a82695..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDAnnotation.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDAnnotation; - -/** - * javax.xml.bind.annotation.XmlID - */ -public final class SourceXmlIDAnnotation - extends SourceAnnotation - implements XmlIDAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlIDAnnotation(JavaResourceMember parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDREFAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDREFAnnotation.java deleted file mode 100644 index d2f96423b4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlIDREFAnnotation.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation; - -/** - * javax.xml.bind.annotation.XmlIDREF - */ -public final class SourceXmlIDREFAnnotation - extends SourceAnnotation - implements XmlIDREFAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlIDREFAnnotation(JavaResourceMember parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlInlineBinaryDataAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlInlineBinaryDataAnnotation.java deleted file mode 100644 index e017397b69..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlInlineBinaryDataAnnotation.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlInlineBinaryDataAnnotation; - -/** - * javax.xml.bind.annotation.XmlInlineBinaryDataAnnotation - */ -public final class SourceXmlInlineBinaryDataAnnotation - extends SourceAnnotation - implements XmlInlineBinaryDataAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlInlineBinaryDataAnnotation(JavaResourceMember parent, Member member) { - super(parent, member, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlJavaTypeAdapterAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlJavaTypeAdapterAnnotation.java deleted file mode 100644 index e06a032eae..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlJavaTypeAdapterAnnotation.java +++ /dev/null @@ -1,229 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; - -/** - * javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter - */ -public final class SourceXmlJavaTypeAdapterAnnotation - extends SourceAnnotation - implements XmlJavaTypeAdapterAnnotation -{ - public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - public static final SimpleDeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JAXB.XML_JAVA_TYPE_ADAPTERS); - - private final DeclarationAnnotationElementAdapter valueDeclarationAdapter; - private final AnnotationElementAdapter valueAdapter; - private String value; - private String fullyQualifiedValue; - - private final DeclarationAnnotationElementAdapter typeDeclarationAdapter; - private final AnnotationElementAdapter typeAdapter; - private String type; - private String fullyQualifiedType; - - - // ********** constructors ********** - public static SourceXmlJavaTypeAdapterAnnotation buildSourceXmlJavaTypeAdapterAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index) { - IndexedDeclarationAnnotationAdapter idaa = buildXmlJavaTypeAdapterDeclarationAnnotationAdapter(index); - IndexedAnnotationAdapter iaa = buildXmlJavaTypeAdapterAnnotationAdapter(annotatedElement, idaa); - return new SourceXmlJavaTypeAdapterAnnotation( - parent, - annotatedElement, - idaa, - iaa); - } - - private SourceXmlJavaTypeAdapterAnnotation( - JavaResourceAnnotatedElement parent, - AnnotatedElement element, - IndexedDeclarationAnnotationAdapter daa, - IndexedAnnotationAdapter annotationAdapter) { - super(parent, element, daa, annotationAdapter); - this.valueDeclarationAdapter = buildValueAdapter(daa); - this.valueAdapter = this.buildAnnotationElementAdapter(this.valueDeclarationAdapter); - this.typeDeclarationAdapter = buildTypeAdapter(daa); - this.typeAdapter = this.buildAnnotationElementAdapter(this.typeDeclarationAdapter); - } - - private DeclarationAnnotationElementAdapter buildValueAdapter(DeclarationAnnotationAdapter daa) { - return buildAnnotationElementAdapter(daa, JAXB.XML_JAVA_TYPE_ADAPTER__VALUE, SimpleTypeStringExpressionConverter.instance()); - } - - private DeclarationAnnotationElementAdapter buildTypeAdapter(DeclarationAnnotationAdapter daa) { - return buildAnnotationElementAdapter(daa, JAXB.XML_JAVA_TYPE_ADAPTER__TYPE, SimpleTypeStringExpressionConverter.instance()); - } - - static DeclarationAnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter converter) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, converter); - } - - protected AnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = buildValue(astRoot); - this.fullyQualifiedValue = buildFullyQualifiedValue(astRoot); - this.type = buildType(astRoot); - this.fullyQualifiedType = buildFullyQualifiedType(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - syncValue(buildValue(astRoot)); - syncFullyQualifiedValue(buildFullyQualifiedValue(astRoot)); - syncType(buildType(astRoot)); - syncFullyQualifiedType(buildFullyQualifiedType(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** XmlJavaTypeAdapterAnnotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(String astValue) { - String old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private String buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.valueDeclarationAdapter, astRoot); - } - - public String getFullyQualifiedValue() { - return this.fullyQualifiedValue; - } - - private void syncFullyQualifiedValue(String name) { - String old = this.fullyQualifiedValue; - this.fullyQualifiedValue = name; - this.firePropertyChanged(FULLY_QUALIFIED_VALUE_PROPERTY, old, name); - } - - private String buildFullyQualifiedValue(CompilationUnit astRoot) { - return (this.value == null) ? null : ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(astRoot)); - } - - // ***** type - public String getType() { - return this.type; - } - - public void setType(String type) { - if (this.attributeValueHasChanged(this.type, type)) { - this.type = type; - this.typeAdapter.setValue(type); - } - } - - private void syncType(String astType) { - String old = this.type; - this.type = astType; - this.firePropertyChanged(TYPE_PROPERTY, old, astType); - } - - private String buildType(CompilationUnit astRoot) { - return this.typeAdapter.getValue(astRoot); - } - - public TextRange getTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.typeDeclarationAdapter, astRoot); - } - - public String getFullyQualifiedType() { - return this.fullyQualifiedType; - } - - private void syncFullyQualifiedType(String name) { - String old = this.fullyQualifiedType; - this.fullyQualifiedType = name; - this.firePropertyChanged(FULLY_QUALIFIED_TYPE_PROPERTY, old, name); - } - - private String buildFullyQualifiedType(CompilationUnit astRoot) { - return (this.type == null) ? null : ASTTools.resolveFullyQualifiedName(this.typeAdapter.getExpression(astRoot)); - } - - - //*********** NestableAnnotation implementation **************** - - /** - * convenience implementation of method from NestableAnnotation interface - * for subclasses - */ - public void moveAnnotation(int newIndex) { - this.getIndexedAnnotationAdapter().moveAnnotation(newIndex); - } - - private IndexedAnnotationAdapter getIndexedAnnotationAdapter() { - return (IndexedAnnotationAdapter) this.annotationAdapter; - } - - - // ********** static methods ********** - - private static IndexedAnnotationAdapter buildXmlJavaTypeAdapterAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) { - return new ElementIndexedAnnotationAdapter(annotatedElement, idaa); - } - - private static IndexedDeclarationAnnotationAdapter buildXmlJavaTypeAdapterDeclarationAnnotationAdapter(int index) { - IndexedDeclarationAnnotationAdapter idaa = - new CombinationIndexedDeclarationAnnotationAdapter( - DECLARATION_ANNOTATION_ADAPTER, - CONTAINER_DECLARATION_ANNOTATION_ADAPTER, - index, - JAXB.XML_JAVA_TYPE_ADAPTER); - return idaa; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlListAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlListAnnotation.java deleted file mode 100644 index 1d66e39a9b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlListAnnotation.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation; - -/** - * javax.xml.bind.annotation.XmlList - */ -public final class SourceXmlListAnnotation - extends SourceAnnotation - implements XmlListAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlListAnnotation(JavaResourceMember parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMimeTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMimeTypeAnnotation.java deleted file mode 100644 index 6465642f3d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMimeTypeAnnotation.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlMimeTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlMimeType - */ -public final class SourceXmlMimeTypeAnnotation - extends SourceAnnotation - implements XmlMimeTypeAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter valueAdapter; - private String value; - - public SourceXmlMimeTypeAnnotation(JavaResourceMember parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = this.buildAnnotationElementAdapter(VALUE_ADAPTER); - } - - protected AnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** XmlMimeTypeAnnotation implementation ********** - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(String astValue) { - String old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private String buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - - //*********** static methods **************** - - private static DeclarationAnnotationElementAdapter buildValueAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_MIME_TYPE__VALUE); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMixedAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMixedAnnotation.java deleted file mode 100644 index 06db802a49..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlMixedAnnotation.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation; - -/** - * javax.xml.bind.annotation.XmlMixed - */ -public final class SourceXmlMixedAnnotation - extends SourceAnnotation - implements XmlMixedAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlMixedAnnotation(JavaResourceMember parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlNsAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlNsAnnotation.java deleted file mode 100644 index 945b367265..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlNsAnnotation.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedPackage; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation; - - -public class SourceXmlNsAnnotation - extends SourceAnnotation - implements XmlNsAnnotation { - - private final DeclarationAnnotationElementAdapter namespaceURIDeclarationAdapter; - private final AnnotationElementAdapter namespaceURIAdapter; - private String namespaceURI; - - private final DeclarationAnnotationElementAdapter prefixDeclarationAdapter; - private final AnnotationElementAdapter prefixAdapter; - private String prefix; - - - public SourceXmlNsAnnotation(JavaResourceNode parent, AnnotatedPackage pack, IndexedDeclarationAnnotationAdapter idaa) { - super(parent, pack, idaa, new ElementIndexedAnnotationAdapter(pack, idaa)); - this.namespaceURIDeclarationAdapter = this.buildNamespaceURIDeclarationAdapter(idaa); - this.namespaceURIAdapter = this.buildAdapter(this.namespaceURIDeclarationAdapter); - this.prefixDeclarationAdapter = this.buildPrefixDeclarationAdapter(idaa); - this.prefixAdapter = buildAdapter(this.prefixDeclarationAdapter); - } - - - protected DeclarationAnnotationElementAdapter buildNamespaceURIDeclarationAdapter( - DeclarationAnnotationAdapter daa) { - - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_NS__NAMESPACE_URI); - } - - protected DeclarationAnnotationElementAdapter buildPrefixDeclarationAdapter( - DeclarationAnnotationAdapter daa) { - - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_NS__PREFIX); - } - - private AnnotationElementAdapter buildAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.namespaceURI = buildNamespaceURI(astRoot); - this.prefix = buildPrefix(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - syncNamespaceURI(buildNamespaceURI(astRoot)); - syncPrefix(buildPrefix(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.namespaceURI); - } - - - // **************** namespace ********************************************* - - public String getNamespaceURI() { - return this.namespaceURI; - } - - public void setNamespaceURI(String namespaceURI) { - if (attributeValueHasChanged(this.namespaceURI, namespaceURI)) { - this.namespaceURI = namespaceURI; - this.namespaceURIAdapter.setValue(namespaceURI); - } - } - - private String buildNamespaceURI(CompilationUnit astRoot) { - return this.namespaceURIAdapter.getValue(astRoot); - } - - private void syncNamespaceURI(String namespaceURI) { - String old = this.namespaceURI; - this.namespaceURI = namespaceURI; - firePropertyChanged(NAMESPACE_URI_PROPERTY, old, namespaceURI); - } - - public TextRange getNamespaceURITextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.namespaceURIDeclarationAdapter, astRoot); - } - - - // **************** prefix ************************************************ - - public String getPrefix() { - return this.prefix; - } - - public void setPrefix(String prefix) { - if (attributeValueHasChanged(this.prefix, prefix)) { - this.prefix = prefix; - this.prefixAdapter.setValue(prefix); - } - } - - private String buildPrefix(CompilationUnit astRoot) { - return this.prefixAdapter.getValue(astRoot); - } - - private void syncPrefix(String prefix) { - String old = this.prefix; - this.prefix = prefix; - firePropertyChanged(PREFIX_PROPERTY, old, prefix); - } - - public TextRange getPrefixTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.prefixDeclarationAdapter, astRoot); - } - - - // **************** NestableAnnotation impl ******************************* - - public void moveAnnotation(int newIndex) { - this.getIndexedAnnotationAdapter().moveAnnotation(newIndex); - } - - private IndexedAnnotationAdapter getIndexedAnnotationAdapter() { - return (IndexedAnnotationAdapter) this.annotationAdapter; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRegistryAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRegistryAnnotation.java deleted file mode 100644 index 3e3f45b267..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRegistryAnnotation.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRegistryAnnotation; - -/** - * javax.xml.bind.annotation.XmlRegistry - */ -public final class SourceXmlRegistryAnnotation - extends SourceAnnotation - implements XmlRegistryAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlRegistryAnnotation(AbstractJavaResourceType parent, AbstractType type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRootElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRootElementAnnotation.java deleted file mode 100644 index bf4befaeea..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlRootElementAnnotation.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; - -/** - * javax.xml.bind.annotation.XmlRootElement - */ -public final class SourceXmlRootElementAnnotation - extends SourceAnnotation - implements XmlRootElementAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter NAME_ADAPTER = buildNameAdapter(); - private final AnnotationElementAdapter nameAdapter; - private String name; - - private static final DeclarationAnnotationElementAdapter NAMESPACE_ADAPTER = buildNamespaceAdapter(); - private final AnnotationElementAdapter namespaceAdapter; - private String namespace; - - public SourceXmlRootElementAnnotation(AbstractJavaResourceType parent, AbstractType type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.nameAdapter = this.buildAnnotationElementAdapter(NAME_ADAPTER); - this.namespaceAdapter = this.buildAnnotationElementAdapter(NAMESPACE_ADAPTER); - } - - protected AnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.name = this.buildName(astRoot); - this.namespace = this.buildNamespace(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncName(this.buildName(astRoot)); - this.syncNamespace(this.buildNamespace(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlRootElementAnnotation implementation ********** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(NAME_ADAPTER, astRoot); - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - return elementTouches(NAME_ADAPTER, pos, astRoot); - } - - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (this.attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private void syncNamespace(String astNamespace) { - String old = this.namespace; - this.namespace = astNamespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace); - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(NAMESPACE_ADAPTER, astRoot); - } - - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return elementTouches(NAMESPACE_ADAPTER, pos, astRoot); - } - - - //*********** static methods **************** - - private static DeclarationAnnotationElementAdapter buildNameAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ROOT_ELEMENT__NAME); - } - - private static DeclarationAnnotationElementAdapter buildNamespaceAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_ROOT_ELEMENT__NAMESPACE); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaAnnotation.java deleted file mode 100644 index 76df750769..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaAnnotation.java +++ /dev/null @@ -1,303 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedPackage; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaAnnotation; - - -public class SourceXmlSchemaAnnotation - extends SourceAnnotation - implements XmlSchemaAnnotation { - - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER - = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter ATTRIBUTE_FORM_DEFAULT_ADAPTER = - buildAttributeFormDefaultAdapter(); - private final AnnotationElementAdapter attributeFormDefaultAdapter; - private XmlNsForm attributeFormDefault; - - private static final DeclarationAnnotationElementAdapter ELEMENT_FORM_DEFAULT_ADAPTER = - buildElementFormDefaultAdapter(); - private final AnnotationElementAdapter elementFormDefaultAdapter; - private XmlNsForm elementFormDefault; - - private static final DeclarationAnnotationElementAdapter LOCATION_ADAPTER = - buildLocationAdapter(); - private final AnnotationElementAdapter locationAdapter; - private String location; - - private static final DeclarationAnnotationElementAdapter NAMESPACE_ADAPTER = - buildNamespaceAdapter(); - private final AnnotationElementAdapter namespaceAdapter; - private String namespace; - - private final XmlnsAnnotationContainer xmlnsContainer = new XmlnsAnnotationContainer(); - - - private static DeclarationAnnotationElementAdapter buildAttributeFormDefaultAdapter() { - return new EnumDeclarationAnnotationElementAdapter( - DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_SCHEMA__ATTRIBUTE_FORM_DEFAULT); //remove annotation when empty - } - - private static DeclarationAnnotationElementAdapter buildElementFormDefaultAdapter() { - return new EnumDeclarationAnnotationElementAdapter( - DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_SCHEMA__ELEMENT_FORM_DEFAULT); // remove annotation when empty - } - - private static DeclarationAnnotationElementAdapter buildLocationAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings( - DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_SCHEMA__LOCATION); // remove annotation when empty - } - - private static DeclarationAnnotationElementAdapter buildNamespaceAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings( - DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_SCHEMA__NAMESPACE); // remove annotation when empty - } - - - public SourceXmlSchemaAnnotation(JavaResourcePackage parent, AnnotatedPackage pack) { - this(parent, pack, DECLARATION_ANNOTATION_ADAPTER); - } - - public SourceXmlSchemaAnnotation(JavaResourcePackage parent, AnnotatedPackage pack, DeclarationAnnotationAdapter daa) { - super(parent, pack, daa); - this.attributeFormDefaultAdapter = buildAnnotationElementAdapter(ATTRIBUTE_FORM_DEFAULT_ADAPTER); - this.elementFormDefaultAdapter = buildAnnotationElementAdapter(ELEMENT_FORM_DEFAULT_ADAPTER); - this.locationAdapter = buildAnnotationElementAdapter(LOCATION_ADAPTER); - this.namespaceAdapter = buildAnnotationElementAdapter(NAMESPACE_ADAPTER); - } - - - protected AnnotationElementAdapter buildAnnotationElementAdapter( - DeclarationAnnotationElementAdapter daea) { - - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.attributeFormDefault = buildAttributeFormDefault(astRoot); - this.elementFormDefault = buildElementFormDefault(astRoot); - this.location = buildLocation(astRoot); - this.namespace = buildNamespace(astRoot); - this.xmlnsContainer.initialize(this.getAstAnnotation(astRoot)); - } - - public void synchronizeWith(CompilationUnit astRoot) { - syncAttributeFormDefault(buildAttributeFormDefault(astRoot)); - syncElementFormDefault(buildElementFormDefault(astRoot)); - syncLocation(buildLocation(astRoot)); - syncNamespace(buildNamespace(astRoot)); - this.xmlnsContainer.synchronize(this.getAstAnnotation(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.namespace); - } - - - // **************** attribute form default ******************************** - - public XmlNsForm getAttributeFormDefault() { - return this.attributeFormDefault; - } - - public void setAttributeFormDefault(XmlNsForm attributeFormDefault) { - if (attributeValueHasChanged(this.attributeFormDefault, attributeFormDefault)) { - this.attributeFormDefault = attributeFormDefault; - this.attributeFormDefaultAdapter.setValue(XmlNsForm.toJavaAnnotationValue(attributeFormDefault)); - } - } - - private XmlNsForm buildAttributeFormDefault(CompilationUnit astRoot) { - return XmlNsForm.fromJavaAnnotationValue(this.attributeFormDefaultAdapter.getValue(astRoot)); - } - - private void syncAttributeFormDefault(XmlNsForm attributeFormDefault) { - XmlNsForm old = this.attributeFormDefault; - this.attributeFormDefault = attributeFormDefault; - firePropertyChanged(ATTRIBUTE_FORM_DEFAULT_PROPERTY, old, attributeFormDefault); - } - - public TextRange getAttributeFormDefaultTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(ATTRIBUTE_FORM_DEFAULT_ADAPTER, astRoot); - } - - - // **************** element form default ******************************** - - public XmlNsForm getElementFormDefault() { - return this.elementFormDefault; - } - - public void setElementFormDefault(XmlNsForm elementFormDefault) { - if (attributeValueHasChanged(this.elementFormDefault, elementFormDefault)) { - this.elementFormDefault = elementFormDefault; - this.elementFormDefaultAdapter.setValue(XmlNsForm.toJavaAnnotationValue(elementFormDefault)); - } - } - - private XmlNsForm buildElementFormDefault(CompilationUnit astRoot) { - return XmlNsForm.fromJavaAnnotationValue(this.elementFormDefaultAdapter.getValue(astRoot)); - } - - private void syncElementFormDefault(XmlNsForm elementFormDefault) { - XmlNsForm old = this.elementFormDefault; - this.elementFormDefault = elementFormDefault; - firePropertyChanged(ELEMENT_FORM_DEFAULT_PROPERTY, old, elementFormDefault); - } - - public TextRange getElementFormDefaultTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(ELEMENT_FORM_DEFAULT_ADAPTER, astRoot); - } - - - // **************** location ********************************************** - - public String getLocation() { - return this.location; - } - - public void setLocation(String location) { - if (attributeValueHasChanged(this.location, location)) { - this.location = location; - this.locationAdapter.setValue(location); - } - } - - private String buildLocation(CompilationUnit astRoot) { - return this.locationAdapter.getValue(astRoot); - } - - private void syncLocation(String location) { - String old = this.location; - this.location = location; - firePropertyChanged(LOCATION_PROPERTY, old, location); - } - - public TextRange getLocationTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(LOCATION_ADAPTER, astRoot); - } - - - // **************** namespace ********************************************* - - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - private void syncNamespace(String namespace) { - String old = this.namespace; - this.namespace = namespace; - firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(NAMESPACE_ADAPTER, astRoot); - } - - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return elementTouches(NAMESPACE_ADAPTER, pos, astRoot); - } - - - // **************** xmlns ************************************************* - - public ListIterable getXmlns() { - return this.xmlnsContainer.getNestedAnnotations(); - } - - public int getXmlnsSize() { - return this.xmlnsContainer.getNestedAnnotationsSize(); - } - - public XmlNsAnnotation xmlnsAt(int index) { - return this.xmlnsContainer.nestedAnnotationAt(index); - } - - public XmlNsAnnotation addXmlns(int index) { - return this.xmlnsContainer.addNestedAnnotation(index); - } - - private XmlNsAnnotation buildXmlns(int index) { - return new SourceXmlNsAnnotation( - this, this.annotatedElement, buildXmlnsIndexedDeclarationAnnotationAdapter(index)); - } - - private IndexedDeclarationAnnotationAdapter buildXmlnsIndexedDeclarationAnnotationAdapter(int index) { - return new NestedIndexedDeclarationAnnotationAdapter( - this.daa, JAXB.XML_SCHEMA__XMLNS, index, JAXB.XML_NS); - } - - public void moveXmlns(int targetIndex, int sourceIndex) { - this.xmlnsContainer.moveNestedAnnotation(targetIndex, sourceIndex); - } - - public void removeXmlns(int index) { - this.xmlnsContainer.removeNestedAnnotation(index); - } - - /** - * adapt the AnnotationContainer interface to the xml schema's xmlns - */ - class XmlnsAnnotationContainer - extends AnnotationContainer - { - @Override - protected String getAnnotationsPropertyName() { - return XMLNS_LIST; - } - @Override - protected String getElementName() { - return JAXB.XML_SCHEMA__XMLNS; - } - @Override - protected String getNestedAnnotationName() { - return JAXB.XML_NS; - } - @Override - protected XmlNsAnnotation buildNestedAnnotation(int index) { - return SourceXmlSchemaAnnotation.this.buildXmlns(index); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaTypeAnnotation.java deleted file mode 100644 index 4fdd5507ab..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSchemaTypeAnnotation.java +++ /dev/null @@ -1,272 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.CombinationIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlSchemaType - */ -public class SourceXmlSchemaTypeAnnotation - extends SourceAnnotation - implements XmlSchemaTypeAnnotation { - - public static final SimpleDeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - public static final SimpleDeclarationAnnotationAdapter CONTAINER_DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(JAXB.XML_SCHEMA_TYPES); - - private final DeclarationAnnotationElementAdapter nameDeclarationAdapter; - private final AnnotationElementAdapter nameAdapter; - private String name; - - private final DeclarationAnnotationElementAdapter namespaceDeclarationAdapter; - private final AnnotationElementAdapter namespaceAdapter; - private String namespace; - - private final DeclarationAnnotationElementAdapter typeDeclarationAdapter; - private final AnnotationElementAdapter typeAdapter; - private String type; - private String fullyQualifiedType; - - - // ********** constructors ********** - - public static SourceXmlSchemaTypeAnnotation buildSourceXmlSchemaTypeAnnotation( - JavaResourceAnnotatedElement parent, - AnnotatedElement annotatedElement, - int index) { - - IndexedDeclarationAnnotationAdapter idaa = buildXmlSchemaTypeDeclarationAnnotationAdapter(index); - IndexedAnnotationAdapter iaa = buildXmlSchemaTypeAnnotationAdapter(annotatedElement, idaa); - return new SourceXmlSchemaTypeAnnotation( - parent, - annotatedElement, - idaa, - iaa); - } - - private SourceXmlSchemaTypeAnnotation( - JavaResourceAnnotatedElement parent, - AnnotatedElement annotatedElement, - IndexedDeclarationAnnotationAdapter daa, - IndexedAnnotationAdapter annotationAdapter) { - - super(parent, annotatedElement, daa, annotationAdapter); - this.nameDeclarationAdapter = buildNameAdapter(daa); - this.nameAdapter = this.buildAnnotationElementAdapter(this.nameDeclarationAdapter); - this.namespaceDeclarationAdapter = buildNamespaceAdapter(daa); - this.namespaceAdapter = this.buildAnnotationElementAdapter(this.namespaceDeclarationAdapter); - this.typeDeclarationAdapter = buildTypeAdapter(daa); - this.typeAdapter = this.buildAnnotationElementAdapter(this.typeDeclarationAdapter); - } - - - private DeclarationAnnotationElementAdapter buildNameAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_SCHEMA_TYPE__NAME); - } - - private DeclarationAnnotationElementAdapter buildNamespaceAdapter(DeclarationAnnotationAdapter daa) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(daa, JAXB.XML_SCHEMA_TYPE__NAMESPACE); - } - - private DeclarationAnnotationElementAdapter buildTypeAdapter(DeclarationAnnotationAdapter daa) { - return buildAnnotationElementAdapter(daa, JAXB.XML_SCHEMA_TYPE__TYPE, - SimpleTypeStringExpressionConverter.instance()); - } - - static DeclarationAnnotationElementAdapter buildAnnotationElementAdapter( - DeclarationAnnotationAdapter annotationAdapter, String elementName, - ExpressionConverter converter) { - - return new ConversionDeclarationAnnotationElementAdapter( - annotationAdapter, elementName, converter); - } - - protected AnnotationElementAdapter buildAnnotationElementAdapter( - DeclarationAnnotationElementAdapter daea) { - - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.name = buildName(astRoot); - this.namespace = buildNamespace(astRoot); - this.type = buildType(astRoot); - this.fullyQualifiedType = buildFullyQualifiedType(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - syncName(buildName(astRoot)); - syncNamespace(buildNamespace(astRoot)); - syncType(buildType(astRoot)); - syncFullyQualifiedType(buildFullyQualifiedType(astRoot)); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // **************** XmlSchemaTypeAnnotation impl ************************** - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nameDeclarationAdapter, astRoot); - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - return elementTouches(this.nameDeclarationAdapter, pos, astRoot); - } - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (this.attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private void syncNamespace(String astNamespace) { - String old = this.namespace; - this.namespace = astNamespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace); - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.namespaceDeclarationAdapter, astRoot); - } - - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return elementTouches(this.namespaceDeclarationAdapter, pos, astRoot); - } - - // ***** type - public String getType() { - return this.type; - } - - public void setType(String type) { - if (this.attributeValueHasChanged(this.type, type)) { - this.type = type; - this.typeAdapter.setValue(type); - } - } - - private void syncType(String astType) { - String old = this.type; - this.type = astType; - this.firePropertyChanged(TYPE_PROPERTY, old, astType); - } - - private String buildType(CompilationUnit astRoot) { - return this.typeAdapter.getValue(astRoot); - } - - public TextRange getTypeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.typeDeclarationAdapter, astRoot); - } - - public String getFullyQualifiedType() { - return this.fullyQualifiedType; - } - - private void syncFullyQualifiedType(String name) { - String old = this.fullyQualifiedType; - this.fullyQualifiedType = name; - this.firePropertyChanged(FULLY_QUALIFIED_TYPE_PROPERTY, old, name); - } - - private String buildFullyQualifiedType(CompilationUnit astRoot) { - return (this.type == null) ? null : ASTTools.resolveFullyQualifiedName(this.typeAdapter.getExpression(astRoot)); - } - - - //*********** NestableAnnotation implementation **************** - - /** - * convenience implementation of method from NestableAnnotation interface - * for subclasses - */ - public void moveAnnotation(int newIndex) { - this.getIndexedAnnotationAdapter().moveAnnotation(newIndex); - } - - private IndexedAnnotationAdapter getIndexedAnnotationAdapter() { - return (IndexedAnnotationAdapter) this.annotationAdapter; - } - - - // ********** static methods ********** - - private static IndexedAnnotationAdapter buildXmlSchemaTypeAnnotationAdapter(AnnotatedElement annotatedElement, IndexedDeclarationAnnotationAdapter idaa) { - return new ElementIndexedAnnotationAdapter(annotatedElement, idaa); - } - - private static IndexedDeclarationAnnotationAdapter buildXmlSchemaTypeDeclarationAnnotationAdapter(int index) { - IndexedDeclarationAnnotationAdapter idaa = - new CombinationIndexedDeclarationAnnotationAdapter( - DECLARATION_ANNOTATION_ADAPTER, - CONTAINER_DECLARATION_ANNOTATION_ADAPTER, - index, - JAXB.XML_SCHEMA_TYPE); - return idaa; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSeeAlsoAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSeeAlsoAnnotation.java deleted file mode 100644 index addf2bf106..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlSeeAlsoAnnotation.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import java.util.Arrays; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotationStringArrayExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSeeAlsoAnnotation; - -/** - * javax.xml.bind.annotation.XmlSeeAlso - */ -public final class SourceXmlSeeAlsoAnnotation - extends SourceAnnotation - implements XmlSeeAlsoAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final DeclarationAnnotationElementAdapter valueDeclarationAdapter; - private final AnnotationElementAdapter valueAdapter; - private final Vector classes = new Vector(); - - public SourceXmlSeeAlsoAnnotation(AbstractJavaResourceType parent, AbstractType type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueDeclarationAdapter = buildArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_SEE_ALSO__VALUE); - this.valueAdapter = this.buildArrayAnnotationElementAdapter(this.valueDeclarationAdapter); - } - - private AnnotationElementAdapter buildArrayAnnotationElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.initializeClasses(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncClasses(astRoot); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.classes); - } - - - // ********** XmlSeeAlsoAnnotation implementation ********** - - // ***** classes - public ListIterable getClasses() { - return new LiveCloneListIterable(this.classes); - } - - public int getClassesSize() { - return this.classes.size(); - } - - public void addClass(String clazz) { - this.addClass(this.classes.size(), clazz); - } - - public void addClass(int index, String clazz) { - this.classes.add(index, clazz); - this.writeClasses(); - } - - public void moveClass(int targetIndex, int sourceIndex) { - CollectionTools.move(this.classes, targetIndex, sourceIndex); - this.writeClasses(); - } - - public void removeClass(String prop) { - this.classes.remove(prop); - this.writeClasses(); - } - - public void removeClass(int index) { - this.classes.remove(index); - this.writeClasses(); - } - - private void writeClasses() { - this.valueAdapter.setValue(this.classes.toArray(new String[this.classes.size()])); - } - - private void initializeClasses(CompilationUnit astRoot) { - String[] astClasses = this.valueAdapter.getValue(astRoot); - for (int i = 0; i < astClasses.length; i++) { - this.classes.add(astClasses[i]); - } - } - - private void syncClasses(CompilationUnit astRoot) { - String[] astClasses = this.valueAdapter.getValue(astRoot); - this.synchronizeList(Arrays.asList(astClasses), this.classes, CLASSES_LIST); - } - - - //*********** static methods **************** - - - private static DeclarationAnnotationElementAdapter buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) { - return buildArrayAnnotationElementAdapter(annotationAdapter, elementName, AnnotationStringArrayExpressionConverter.forTypes()); - } - - private static DeclarationAnnotationElementAdapter buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter converter) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, converter); - } - - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTransientAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTransientAnnotation.java deleted file mode 100644 index d4a89c124b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTransientAnnotation.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTransientAnnotation; - -/** - * javax.xml.bind.annotation.XmlTransient - */ -public final class SourceXmlTransientAnnotation - extends SourceAnnotation - implements XmlTransientAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlTransientAnnotation(JavaResourceMember parent, Member member) { - super(parent, member, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTypeAnnotation.java deleted file mode 100644 index 9bb28f5870..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlTypeAnnotation.java +++ /dev/null @@ -1,322 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import java.util.Arrays; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotationStringArrayExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AbstractType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation; - -/** - * javax.xml.bind.annotation.XmlType - */ -public final class SourceXmlTypeAnnotation - extends SourceAnnotation - implements XmlTypeAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter FACTORY_CLASS_ADAPTER = buildFactoryClassAdapter(); - private final AnnotationElementAdapter factoryClassAdapter; - private String factoryClass; - - private String fullyQualifiedFactoryClassName; - - private static final DeclarationAnnotationElementAdapter FACTORY_METHOD_ADAPTER = buildFactoryMethodAdapter(); - private final AnnotationElementAdapter factoryMethodAdapter; - private String factoryMethod; - - private static final DeclarationAnnotationElementAdapter NAME_ADAPTER = buildNameAdapter(); - private final AnnotationElementAdapter nameAdapter; - private String name; - - private static final DeclarationAnnotationElementAdapter NAMESPACE_ADAPTER = buildNamespaceAdapter(); - private final AnnotationElementAdapter namespaceAdapter; - private String namespace; - - private final DeclarationAnnotationElementAdapter propOrderDeclarationAdapter; - private final AnnotationElementAdapter propOrderAdapter; - private final Vector propOrder = new Vector(); - - public SourceXmlTypeAnnotation(AbstractJavaResourceType parent, AbstractType type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.factoryClassAdapter = this.buildAnnotationElementAdapter(FACTORY_CLASS_ADAPTER); - this.factoryMethodAdapter = this.buildAnnotationElementAdapter(FACTORY_METHOD_ADAPTER); - this.nameAdapter = this.buildAnnotationElementAdapter(NAME_ADAPTER); - this.namespaceAdapter = this.buildAnnotationElementAdapter(NAMESPACE_ADAPTER); - this.propOrderDeclarationAdapter = buildArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_TYPE__PROP_ORDER); - this.propOrderAdapter = this.buildArrayAnnotationElementAdapter(this.propOrderDeclarationAdapter); - } - - protected AnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - private static DeclarationAnnotationElementAdapter buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) { - return buildArrayAnnotationElementAdapter(annotationAdapter, elementName, AnnotationStringArrayExpressionConverter.forStrings()); - } - - private static DeclarationAnnotationElementAdapter buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter converter) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, converter); - } - - private AnnotationElementAdapter buildArrayAnnotationElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.factoryClass = this.buildFactoryClass(astRoot); - this.fullyQualifiedFactoryClassName = this.buildFullyQualifiedFactoryClassName(astRoot); - this.factoryMethod = this.buildFactoryMethod(astRoot); - this.name = this.buildName(astRoot); - this.namespace = this.buildNamespace(astRoot); - this.initializePropOrder(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncFactoryClass(this.buildFactoryClass(astRoot)); - this.syncFullyQualifiedFactoryClassName(this.buildFullyQualifiedFactoryClassName(astRoot)); - this.syncFactoryMethod(this.buildFactoryMethod(astRoot)); - this.syncName(this.buildName(astRoot)); - this.syncNamespace(this.buildNamespace(astRoot)); - this.syncPropOrder(astRoot); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** XmlTypeAnnotation implementation ********** - - // ***** factoryClass - public String getFactoryClass() { - return this.factoryClass; - } - - public void setFactoryClass(String factoryClass) { - if (this.attributeValueHasChanged(this.factoryClass, factoryClass)) { - this.factoryClass = factoryClass; - this.factoryClassAdapter.setValue(factoryClass); - } - } - - private void syncFactoryClass(String astFactoryClass) { - String old = this.factoryClass; - this.factoryClass = astFactoryClass; - this.firePropertyChanged(FACTORY_CLASS_PROPERTY, old, astFactoryClass); - } - - private String buildFactoryClass(CompilationUnit astRoot) { - return this.factoryClassAdapter.getValue(astRoot); - } - - public TextRange getFactoryClassTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(FACTORY_CLASS_ADAPTER, astRoot); - } - - // ***** fully-qualified factory class name - public String getFullyQualifiedFactoryClassName() { - return this.fullyQualifiedFactoryClassName; - } - - private void syncFullyQualifiedFactoryClassName(String name) { - String old = this.fullyQualifiedFactoryClassName; - this.fullyQualifiedFactoryClassName = name; - this.firePropertyChanged(FULLY_QUALIFIED_FACTORY_CLASS_NAME_PROPERTY, old, name); - } - - private String buildFullyQualifiedFactoryClassName(CompilationUnit astRoot) { - return (this.factoryClass == null) ? null : ASTTools.resolveFullyQualifiedName(this.factoryClassAdapter.getExpression(astRoot)); - } - - // ***** factoryMethod - public String getFactoryMethod() { - return this.factoryMethod; - } - - public void setFactoryMethod(String factoryMethod) { - if (this.attributeValueHasChanged(this.factoryMethod, factoryMethod)) { - this.factoryMethod = factoryMethod; - this.factoryMethodAdapter.setValue(factoryMethod); - } - } - - private void syncFactoryMethod(String astFactoryMethod) { - String old = this.factoryMethod; - this.factoryMethod = astFactoryMethod; - this.firePropertyChanged(FACTORY_METHOD_PROPERTY, old, astFactoryMethod); - } - - private String buildFactoryMethod(CompilationUnit astRoot) { - return this.factoryMethodAdapter.getValue(astRoot); - } - - public TextRange getFactoryMethodTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(FACTORY_METHOD_ADAPTER, astRoot); - } - - // ***** name - public String getName() { - return this.name; - } - - public void setName(String name) { - if (this.attributeValueHasChanged(this.name, name)) { - this.name = name; - this.nameAdapter.setValue(name); - } - } - - private void syncName(String astName) { - String old = this.name; - this.name = astName; - this.firePropertyChanged(NAME_PROPERTY, old, astName); - } - - private String buildName(CompilationUnit astRoot) { - return this.nameAdapter.getValue(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return getElementTextRange(NAME_ADAPTER, astRoot); - } - - public boolean nameTouches(int pos, CompilationUnit astRoot) { - return elementTouches(NAME_ADAPTER, pos, astRoot); - } - - - // ***** namespace - public String getNamespace() { - return this.namespace; - } - - public void setNamespace(String namespace) { - if (this.attributeValueHasChanged(this.namespace, namespace)) { - this.namespace = namespace; - this.namespaceAdapter.setValue(namespace); - } - } - - private void syncNamespace(String astNamespace) { - String old = this.namespace; - this.namespace = astNamespace; - this.firePropertyChanged(NAMESPACE_PROPERTY, old, astNamespace); - } - - private String buildNamespace(CompilationUnit astRoot) { - return this.namespaceAdapter.getValue(astRoot); - } - - public TextRange getNamespaceTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(NAMESPACE_ADAPTER, astRoot); - } - - public boolean namespaceTouches(int pos, CompilationUnit astRoot) { - return elementTouches(NAMESPACE_ADAPTER, pos, astRoot); - } - - - // ***** prop order - public ListIterable getPropOrder() { - return new LiveCloneListIterable(this.propOrder); - } - - public int getPropOrderSize() { - return this.propOrder.size(); - } - - public void addProp(String prop) { - this.addProp(this.propOrder.size(), prop); - } - - public void addProp(int index, String prop) { - this.propOrder.add(index, prop); - this.writePropOrder(); - } - - public void moveProp(int targetIndex, int sourceIndex) { - CollectionTools.move(this.propOrder, targetIndex, sourceIndex); - this.writePropOrder(); - } - - public void removeProp(String prop) { - this.propOrder.remove(prop); - this.writePropOrder(); - } - - public void removeProp(int index) { - this.propOrder.remove(index); - this.writePropOrder(); - } - - private void writePropOrder() { - this.propOrderAdapter.setValue(this.propOrder.toArray(new String[this.propOrder.size()])); - } - - private void initializePropOrder(CompilationUnit astRoot) { - String[] astPropOrder = this.propOrderAdapter.getValue(astRoot); - for (int i = 0; i < astPropOrder.length; i++) { - this.propOrder.add(astPropOrder[i]); - } - } - - private void syncPropOrder(CompilationUnit astRoot) { - String[] astPropOrder = this.propOrderAdapter.getValue(astRoot); - this.synchronizeList(Arrays.asList(astPropOrder), this.propOrder, PROP_ORDER_LIST); - } - - - //*********** static methods **************** - - private static DeclarationAnnotationElementAdapter buildFactoryClassAdapter() { - return buildAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_TYPE__FACTORY_CLASS, SimpleTypeStringExpressionConverter.instance()); - } - - static DeclarationAnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter converter) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, converter); - } - - private static DeclarationAnnotationElementAdapter buildFactoryMethodAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_TYPE__FACTORY_METHOD); - } - - private static DeclarationAnnotationElementAdapter buildNameAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_TYPE__NAME); - } - - private static DeclarationAnnotationElementAdapter buildNamespaceAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JAXB.XML_TYPE__NAMESPACE); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlValueAnnotation.java deleted file mode 100644 index 72621e49b0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/resource/java/source/SourceXmlValueAnnotation.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation; - -/** - * javax.xml.bind.annotation.XmlValue - */ -public final class SourceXmlValueAnnotation - extends SourceAnnotation - implements XmlValueAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - public SourceXmlValueAnnotation(JavaResourceMember parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - //no-op - } - - public void synchronizeWith(CompilationUnit astRoot) { - //no-op - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/DefaultValidationMessages.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/DefaultValidationMessages.java deleted file mode 100644 index b4c447f0a0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/DefaultValidationMessages.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.validation; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.wst.validation.internal.core.Message; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - - -public class DefaultValidationMessages { - - private static String[] DEFAULT_PARMS = new String[0]; - private static TextRange DEFAULT_TEXT_RANGE = TextRange.Empty.instance(); - - - public static IMessage buildMessage( - int defaultSeverity, String messageId, Object targetObject) { - return buildMessage(defaultSeverity, messageId, DEFAULT_PARMS, targetObject); - } - - public static IMessage buildMessage( - int defaultSeverity, String messageId, String[] parms, Object targetObject) { - return buildMessage(defaultSeverity, messageId, parms, targetObject, DEFAULT_TEXT_RANGE); - } - - public static IMessage buildMessage( - int defaultSeverity, String messageId, Object targetObject, TextRange textRange) { - return buildMessage(defaultSeverity, messageId, DEFAULT_PARMS, targetObject, textRange); - } - - public static IMessage buildMessage( - int defaultSeverity, String messageId, String[] parms, Object targetObject, TextRange textRange) { - - //determine whether default severity should be overridden - int severity = defaultSeverity; - - // TODO - user override of errors/warnings -// int severityPreference = JpaValidationPreferences.getProblemSeverityPreference(targetObject, messageId); -// if (severityPreference != JpaValidationPreferences.NO_SEVERITY_PREFERENCE){ -// severity = severityPreference; -// } - - IMessage message = new Message(JaxbValidationMessages.BUNDLE_NAME, severity, messageId, parms, targetObject); - message.setMarkerId(JptJaxbCorePlugin.VALIDATION_MARKER_ID); - - if (textRange == null) { - //log an exception and then continue without setting location information - //At least the user will still get the validation message and will - //be able to see other validation messages with valid textRanges - JptJaxbCorePlugin.log(new IllegalArgumentException("Null text range for message ID: " + messageId)); //$NON-NLS-1$ - } - else { - message.setLineNo(textRange.getLineNumber()); - message.setOffset(textRange.getOffset()); - message.setLength(textRange.getLength()); - } - return message; - } - - - private DefaultValidationMessages() { - super(); - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidationMessages.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidationMessages.java deleted file mode 100644 index 7047c1697a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidationMessages.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.validation; - -@SuppressWarnings("nls") -public interface JaxbValidationMessages { - - // bundle name - public static final String BUNDLE_NAME = "jaxb_validation"; - - // validation on project - public static final String NO_JAXB_PROJECT = "NO_JAXB_PROJECT"; - public static final String PROJECT_INVALID_LIBRARY_PROVIDER = "PROJECT_INVALID_LIBRARY_PROVIDER"; - - // validation on package - public static final String PACKAGE_NO_SCHEMA_FOR_NAMESPACE = "PACKAGE_NO_SCHEMA_FOR_NAMESPACE"; - public static final String PACKAGE_XML_JAVA_TYPE_ADAPTER_TYPE_NOT_SPECIFIED = "PACKAGE_XML_JAVA_TYPE_ADAPTER_TYPE_NOT_SPECIFIED"; - - // validation on type - public static final String XML_TYPE_UNMATCHING_NAMESPACE_FOR_ANONYMOUS_TYPE = "XML_TYPE_UNMATCHING_NAMESPACE_FOR_ANONYMOUS_TYPE"; - public static final String XML_TYPE_UNRESOLVED_SCHEMA_TYPE = "XML_TYPE_UNRESOLVED_SCHEMA_TYPE"; - - public static final String XML_ROOT_ELEMENT_UNRESOLVED_SCHEMA_ELEMENT = "XML_ROOT_ELEMENT_UNRESOLVED_SCHEMA_ELEMENT"; - public static final String XML_ROOT_ELEMENT_TYPE_CONFLICTS_WITH_XML_TYPE = "XML_ROOT_ELEMENT_TYPE_CONFLICTS_WITH_XML_TYPE"; - - // validation on attribute mapping - public static final String ATTRIBUTE_MAPPING_XML_JAVA_TYPE_ADAPTER_TYPE_NOT_DEFINED = "ATTRIBUTE_MAPPING_XML_JAVA_TYPE_ADAPTER_TYPE_NOT_DEFINED"; - public static final String XML_ELEMENT_WRAPPER_DEFINED_ON_NON_ARRAY_NON_COLLECTION = "XML_ELEMENT_WRAPPER_DEFINED_ON_NON_ARRAY_NON_COLLECTION"; - public static final String XML_LIST_DEFINED_ON_NON_ARRAY_NON_COLLECTION = "XML_LIST_DEFINED_ON_NON_ARRAY_NON_COLLECTION"; - public static final String MULTIPLE_XML_VALUE_MAPPINGS_DEFINED = "MULTIPLE_XML_VALUE_MAPPINGS_DEFINED"; - public static final String XML_VALUE_MAPPING_WITH_NON_XML_ATTRIBUTE_MAPPING_DEFINED = "XML_VALUE_MAPPING_WITH_NON_XML_ATTRIBUTE_MAPPING_DEFINED"; -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidator.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidator.java deleted file mode 100644 index 3ad17e4f8a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/internal/validation/JaxbValidator.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.internal.validation; - -import org.eclipse.core.resources.IMarker; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jpt.common.core.IResourcePart; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.wst.validation.AbstractValidator; -import org.eclipse.wst.validation.ValidationResult; -import org.eclipse.wst.validation.ValidationState; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IProjectValidationContext; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; -import org.eclipse.wst.validation.internal.provisional.core.IValidationContext; -import org.eclipse.wst.validation.internal.provisional.core.IValidator; - -/** - * This class is referenced in the JAXB extension for the - * WTP validator extension point. - */ -public class JaxbValidator - extends AbstractValidator - implements IValidator { - - public JaxbValidator() { - super(); - } - - - // ********** IValidator implementation ********** - - public void validate(IValidationContext context, IReporter reporter) { - validate(reporter, project(context)); - } - - public void cleanup(IReporter reporter) { - // nothing to do - } - - - // **************** AbstractValidator impl ********************************* - - @Override - public ValidationResult validate(IResource resource, int kind, ValidationState state, IProgressMonitor monitor) { - if (resource.getType() != IResource.FILE) - return null; - ValidationResult result = new ValidationResult(); - IReporter reporter = result.getReporter(monitor); - IProject project = resource.getProject(); - this.clearMarkers(project); - result.setSuspendValidation(project); - this.validate(reporter, project); - return result; - } - - - // **************** internal conv. ***************************************** - private void clearMarkers(IProject project) { - try { - clearMarkers_(project); - } - catch (CoreException ce) { - JptJaxbCorePlugin.log(ce); - } - } - - private void clearMarkers_(IProject project) throws CoreException { - IMarker[] markers = project.findMarkers(JptJaxbCorePlugin.VALIDATION_MARKER_ID, true, IResource.DEPTH_INFINITE); - for (IMarker marker : markers) { - marker.delete(); - } - } - - private void validate(IReporter reporter, IProject project) { - for (IMessage message : this.getValidationMessages(reporter, project)) { - // check to see if the message should be ignored based on preferences - // TODO JAXB validation preferences -// if (!JpaValidationPreferences.isProblemIgnored(project, message.getId())){ - reporter.addMessage(this, adjustMessage(message)); -// } - - } - } - - private IProject project(IValidationContext context) { - return ((IProjectValidationContext) context).getProject(); - } - - private Iterable getValidationMessages(IReporter reporter, IProject project) { - JaxbProject jaxbProject = JptJaxbCorePlugin.getJaxbProject(project); - if (jaxbProject != null) { - return jaxbProject.validationMessages(reporter); - } - return new SingleElementIterable( - DefaultValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JaxbValidationMessages.NO_JAXB_PROJECT, - project)); - } - - private IMessage adjustMessage(IMessage message) { - IAdaptable targetObject = (IAdaptable) message.getTargetObject(); - IResource targetResource = ((IResourcePart) targetObject.getAdapter(IResourcePart.class)).getResource(); - message.setTargetObject(targetResource); - if (message.getLineNumber() == IMessage.LINENO_UNSET) { - message.setAttribute(IMarker.LOCATION, " "); - } - return message; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/libprov/JaxbLibraryProviderInstallOperationConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/libprov/JaxbLibraryProviderInstallOperationConfig.java deleted file mode 100644 index 0790fca4b1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/libprov/JaxbLibraryProviderInstallOperationConfig.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.libprov; - -import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; - - -public interface JaxbLibraryProviderInstallOperationConfig - extends JptLibraryProviderInstallOperationConfig { - - public static final String PROP_JAXB_PLATFORM = "JAXB_PLATFORM"; //$NON-NLS-1$ - - JaxbPlatformDescription getJaxbPlatform(); - - void setJaxbPlatform(JaxbPlatformDescription jaxbPlatform); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatform.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatform.java deleted file mode 100644 index 99e042b319..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatform.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.platform; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.jaxb.core.AnnotationProvider; -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.JaxbFile; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.context.java.JavaAttributeMappingDefinition; - -/** - * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbPlatform { - - JaxbPlatformDescription getDescription(); - - // ********** factory ********** - - /** - * Return a factory responsible for creating core (e.g. JaxbProject), resource - * (e.g. PersistenceResource), and context (e.g. PersistenceUnit) model - * objects - */ - JaxbFactory getFactory(); - - - // ********** JAXB files ********** - - /** - * Return a JAXB file corresponding to the specified Eclipse file. - * Return null if the file's content is unsupported. - */ - JaxbFile buildJaxbFile(JaxbProject jaxbProject, IFile file); - - - // ********** Java annotations ********** - - /** - * Return an annotation provider responsible for determining what Java - * annotations are supported and constructing java resource model objects. - */ - AnnotationProvider getAnnotationProvider(); - - /** - * Return a formatter that can clean up the Java annotations added to source - * code. - */ - AnnotationEditFormatter getAnnotationEditFormatter(); - - - // ********** Java attribute mappings ********** - - Iterable getSpecifiedJavaAttributeMappingDefinitions(); - - Iterable getDefaultJavaAttributeMappingDefinitions(); - - /** - * Return a {@link JavaAttributeMappingDefinition} that describes the interpretation of the attribute - * as it exists, complete with annotations. It is assumed that the attribute's default mapping - * has already been determined. - * This may not be null (@see {@link NullSpecifiedJavaAttributeMappingDefinition},) else - * an {@link IllegalStateException} is thrown. - * - * @param attribute The persistent attribute to analyze - * @return The mapping definition describing the annotated state of the attribute - */ - JavaAttributeMappingDefinition getSpecifiedJavaAttributeMappingDefinition(JaxbPersistentAttribute attribute); - - /** - * Return a {@link JavaAttributeMappingDefinition} for the given mapping key. - * Throw an {@link IllegalArgumentException} if the key is not supported by the platform. - */ - JavaAttributeMappingDefinition getSpecifiedJavaAttributeMappingDefinition(String mappingKey); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDefinition.java deleted file mode 100644 index 4f98d49401..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDefinition.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.platform; - -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.JaxbFactory; -import org.eclipse.jpt.jaxb.core.JaxbResourceModelProvider; -import org.eclipse.jpt.jaxb.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotationDefinition; - -/** - * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbPlatformDefinition { - - JaxbPlatformDescription getDescription(); - - JaxbFactory getFactory(); - - AnnotationDefinition[] getAnnotationDefinitions(); - - NestableAnnotationDefinition[] getNestableAnnotationDefinitions(); - - /** - * Return the resource model providers that apply to this platform. - */ - ListIterable getResourceModelProviders(); - - /** - * Return the most recent resource type for the given content type supported by this platform - */ - public JptResourceType getMostRecentSupportedResourceType(IContentType contentType); - -// /** -// * Return the resource definitions supported by this platform. -// */ -// ListIterator resourceDefinitions(); - - /** - * Return the mapping definitions to use for default java attribute mappings for this platform. - */ - Iterable getDefaultJavaAttributeMappingDefinitions(); - - /** - * Return the mapping definitions to use for specified java attribute mappings for this platform. - */ - Iterable getSpecifiedJavaAttributeMappingDefinitions(); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDefinitionFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDefinitionFactory.java deleted file mode 100644 index c27161a036..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDefinitionFactory.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.platform; - -/** - * This interface is to be implemented by a JAXB vendor to build a - * {@link JaxbPlatformDefinition}. - *

- * See the org.eclipse.jpt.jaxb.core.jaxbPlatforms extension point. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbPlatformDefinitionFactory { - - JaxbPlatformDefinition buildJaxbPlatformDefinition(); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDescription.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDescription.java deleted file mode 100644 index 93fc5e47c5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformDescription.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.platform; - -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * Contains metadata that describes a JAXB platform. Not intended to be implemented by clients. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbPlatformDescription { - - public String getId(); - - public String getPluginId(); - - public String getLabel(); - - public String getFactoryClassName(); - - public boolean supportsJaxbFacetVersion(IProjectFacetVersion jpaFacetVersion); - - public boolean isDefault(); - - public JaxbPlatformGroupDescription getGroup(); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformGroupDescription.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformGroupDescription.java deleted file mode 100644 index 607c120a51..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformGroupDescription.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.platform; - -/** - * Contains metadata that describes a JAXB platform group. Not intended to be implemented by clients. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbPlatformGroupDescription { - - public String getId(); - - public String getPluginId(); - - public String getLabel(); - - public Iterable getPlatforms(); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformManager.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformManager.java deleted file mode 100644 index 1dca3072c4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/platform/JaxbPlatformManager.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.platform; - -import org.eclipse.core.resources.IProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * Entry point to the "jaxbPlatforms" extension point - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbPlatformManager { - - Iterable getJaxbPlatformGroups(); - - JaxbPlatformGroupDescription getJaxbPlatformGroup(String groupId); - - Iterable getJaxbPlatforms(); - - JaxbPlatformDescription getJaxbPlatform(String platformId); - - /** - * Returns the first JAXB platform registered as a default platform and which supports the given - * JAXB facet version. - * Returns null if there are no such registered platforms. - */ - JaxbPlatformDescription getDefaultJaxbPlatform(IProjectFacetVersion jaxbFacetVersion); - - JaxbPlatformDefinition buildJaxbPlatformDefinition(IProject project); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/AbstractJavaResourceType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/AbstractJavaResourceType.java deleted file mode 100644 index f7c6005a81..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/AbstractJavaResourceType.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.IPackageFragment; - -/** - * Java source code or binary type. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface AbstractJavaResourceType - extends JavaResourceMember -{ - /** - * Property change String for the unqualified (short) type name. - * @see JavaResourceMember#getName() - */ - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - - /** - * Return the fully qualified type name. - */ - String getQualifiedName(); - String QUALIFIED_NAME_PROPERTY = "qualifiedName"; //$NON-NLS-1$ - - /** - * Return the package name. - */ - String getPackageName(); - String PACKAGE_NAME_PROPERTY = "packageName"; //$NON-NLS-1$ - - /** - * Return the name of the type's "declaring type". - * Return null if the type is a top-level type. - */ - String getDeclaringTypeName(); - String DECLARING_TYPE_NAME_PROPERTY = "declaringTypeName"; //$NON-NLS-1$ - - /** - * Return whether the type is a member type. - */ - boolean isMemberType(); - String MEMBER_TYPE_PROPERTY = "memberType"; //$NON-NLS-1$ - - /** - * Return whether the type is annotated with any annotations that determine whether and - * how the type is persisted - */ - boolean isMapped(); - - boolean isIn(IPackageFragment packageFragment); - - - /** - * Return the immediately nested types (children). - */ - Iterable getTypes(); - String TYPES_COLLECTION = "types"; //$NON-NLS-1$ - - /** - * Return all the types; the type itself, its children, its grandchildren, - * etc. - */ - Iterable getAllTypes(); - - /** - * Return the immediately nested enums (children). - */ - Iterable getEnums(); - String ENUMS_COLLECTION = "enums"; //$NON-NLS-1$ - - /** - * Return all the enums; the enum itself, its children, its grandchildren, - * etc. - */ - Iterable getAllEnums(); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/Annotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/Annotation.java deleted file mode 100644 index af2a73bee3..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/Annotation.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; - -/** - * Common Java resource annotation behavior - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface Annotation - extends JavaResourceNode -{ - /** - * Return the annotation's fully qualified name, as opposed to the value of - * the annotation's 'name' element. For example: - * @com.foo.Bar(name="Thomas") - * #getAnnotationName() will return "com.foo.Bar". - * In typical subclasses, #getName() would return "Thomas". - * @see JAXB - */ - String getAnnotationName(); - - /** - * Return the corresponding JDT DOM annotation from the specified - * AST compilation unit. - */ - org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot); - - /** - * Create and add the corresponding Java annotation to the JDT DOM. - */ - void newAnnotation(); - - /** - * Remove the corresponding Java annotation from the JDT DOM. - */ - void removeAnnotation(); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/AnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/AnnotationDefinition.java deleted file mode 100644 index fdabd0cc5f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/AnnotationDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; - -/** - * Used to build Annotations discovered in the Java source code. - * To provide new AnnotationDefinitions, create a new JaxbPlatform - * by implementing JaxbPlatformDefinition. - * - * @see Annotation - * @see org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface AnnotationDefinition -{ - /** - * Return the name of the annotation the definition will build in the - * various #build...(...) methods. - */ - String getAnnotationName(); - - /** - * Build and return an annotation for the specified annotated element. - */ - Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement); - - /** - * Build and return an annotation for the specified JDT annotation - * on the specified annotated element. - */ - Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation); - - /** - * Build and return a "null" annotation for the specified annotated element. - * Only certain annotations are required to have "null" implementations; - * typically the annotations with reasonably complex default behavior. - * The "null" annotation is used by the corresponding default context model. - * The "null" annotation simplifies the context model code, allowing the - * context model to simply set various bits of state (e.g. 'name') and the - * "null" annotation will create a new "real" annotation and forward the - * new state to it. This reduces the number of null checks in the context - * model (hopefully). - */ - Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JAXB.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JAXB.java deleted file mode 100644 index a3b2be0c5b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JAXB.java +++ /dev/null @@ -1,174 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -/** - * JAXB Java-related stuff (annotations etc.) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -@SuppressWarnings("nls") -public interface JAXB { - - // JAXB package - String PACKAGE = "javax.xml.bind.annotation"; - String PACKAGE_ = PACKAGE + '.'; - - String ADAPTERS_PACKAGE = PACKAGE_ + "adapters"; - String ADAPTERS_PACKAGE_ = ADAPTERS_PACKAGE + '.'; - - // ********** API ********** - - // JAXB annotations - String XML_ATTACHMENT_REF = PACKAGE_ + "XmlAttachmentRef"; - - String XML_ACCESSOR_ORDER = PACKAGE_ + "XmlAccessorOrder"; - String XML_ACCESSOR_ORDER__VALUE = "value"; - - String XML_ACCESSOR_TYPE = PACKAGE_ + "XmlAccessorType"; - String XML_ACCESSOR_TYPE__VALUE = "value"; - - String XML_ANY_ATTRIBUTE = PACKAGE_ + "XmlAnyAttribute"; - - String XML_ANY_ELEMENT = PACKAGE_ + "XmlAnyElement"; - String XML_ANY_ELEMENT__LAX = "lax"; - String XML_ANY_ELEMENT__VALUE = "value"; - - String XML_ATTRIBUTE = PACKAGE_ + "XmlAttribute"; - String XML_ATTRIBUTE__NAME = "name"; - String XML_ATTRIBUTE__NAMESPACE = "namespace"; - String XML_ATTRIBUTE__REQUIRED = "required"; - - String XML_ELEMENT = PACKAGE_ + "XmlElement"; - String XML_ELEMENT__NAME = "name"; - String XML_ELEMENT__NAMESPACE = "namespace"; - String XML_ELEMENT__DEFAULT_VALUE = "defaultValue"; - String XML_ELEMENT__NILLABLE = "nillable"; - String XML_ELEMENT__REQUIRED = "required"; - String XML_ELEMENT__TYPE = "type"; - - String XML_ELEMENT_DECL = PACKAGE_ + "XmlElementDecl"; - String XML_ELEMENT_DECL__NAME = "name"; - String XML_ELEMENT_DECL__NAMESPACE = "namespace"; - String XML_ELEMENT_DECL__DEFAULT_VALUE = "defaultValue"; - String XML_ELEMENT_DECL__SCOPE = "scope"; - String XML_ELEMENT_DECL__SUBSTITUTION_HEAD_NAME = "substitutionHeadName"; - String XML_ELEMENT_DECL__SUBSTITUTION_HEAD_NAMESPACE = "substitutionHeadNamespace"; - - String XML_ELEMENTS = PACKAGE_ + "XmlElements"; - String XML_ELEMENTS__VALUE = "value"; - - String XML_ELEMENT_REF = PACKAGE_ + "XmlElementRef"; - String XML_ELEMENT_REF__NAME = "name"; - String XML_ELEMENT_REF__NAMESPACE = "namespace"; - String XML_ELEMENT_REF__TYPE = "type"; - - String XML_ELEMENT_REFS = PACKAGE_ + "XmlElementRefs"; - String XML_ELEMENT_REFS__VALUE = "value"; - - String XML_ELEMENT_WRAPPER = PACKAGE_ + "XmlElementWrapper"; - String XML_ELEMENT_WRAPPER__NAME = "name"; - String XML_ELEMENT_WRAPPER__NAMESPACE = "namespace"; - String XML_ELEMENT_WRAPPER__NILLABLE = "nillable"; - String XML_ELEMENT_WRAPPER__REQUIRED = "required"; - - String XML_ENUM = PACKAGE_ + "XmlEnum"; - String XML_ENUM__VALUE = "value"; - - String XML_ENUM_VALUE = PACKAGE_ + "XmlEnumValue"; - String XML_ENUM_VALUE__VALUE = "value"; - - String XML_INLINE_BINARY_DATA = PACKAGE_ + "XmlInlineBinaryData"; - - String XML_ID = PACKAGE_ + "XmlID"; - - String XML_IDREF = PACKAGE_ + "XmlIDREF"; - - String XML_JAVA_TYPE_ADAPTER = ADAPTERS_PACKAGE_ + "XmlJavaTypeAdapter"; - String XML_JAVA_TYPE_ADAPTER__TYPE = "type"; - String XML_JAVA_TYPE_ADAPTER__VALUE = "value"; - - String XML_JAVA_TYPE_ADAPTERS = ADAPTERS_PACKAGE_ + "XmlJavaTypeAdapters"; - String XML_JAVA_TYPE_ADAPTERS__VALUE = "value"; - - String XML_LIST = PACKAGE_ + "XmlList"; - - String XML_MIME_TYPE = PACKAGE_ + "XmlMimeType"; - String XML_MIME_TYPE__VALUE = "value"; - - String XML_MIXED = PACKAGE_ + "XmlMixed"; - - String XML_NS = PACKAGE_ + "XmlNs"; - String XML_NS__NAMESPACE_URI = "namespaceURI"; - String XML_NS__PREFIX = "prefix"; - - String XML_REGISTRY = PACKAGE_ + "XmlRegistry"; - - String XML_ROOT_ELEMENT = PACKAGE_ + "XmlRootElement"; - String XML_ROOT_ELEMENT__NAME = "name"; - String XML_ROOT_ELEMENT__NAMESPACE = "namespace"; - - String XML_SCHEMA = PACKAGE_ + "XmlSchema"; - String XML_SCHEMA__ATTRIBUTE_FORM_DEFAULT = "attributeFormDefault"; - String XML_SCHEMA__ELEMENT_FORM_DEFAULT = "elementFormDefault"; - String XML_SCHEMA__LOCATION = "location"; - String XML_SCHEMA__NAMESPACE = "namespace"; - String XML_SCHEMA__XMLNS = "xmlns"; - - String XML_SCHEMA_TYPE = PACKAGE_ + "XmlSchemaType"; - String XML_SCHEMA_TYPE__NAME = "name"; - String XML_SCHEMA_TYPE__NAMESPACE = "namespace"; - String XML_SCHEMA_TYPE__TYPE = "type"; - - String XML_SCHEMA_TYPES = PACKAGE_ + "XmlSchemaTypes"; - String XML_SCHEMA_TYPES__VALUE = "value"; - - String XML_SEE_ALSO = PACKAGE_ + "XmlSeeAlso"; - String XML_SEE_ALSO__VALUE = "value"; - - String XML_TYPE = PACKAGE_ + "XmlType"; - String XML_TYPE__FACTORY_CLASS = "factoryClass"; - String XML_TYPE__FACTORY_METHOD = "factoryMethod"; - String XML_TYPE__NAME = "name"; - String XML_TYPE__NAMESPACE = "namespace"; - String XML_TYPE__PROP_ORDER = "propOrder"; - - String XML_TRANSIENT = PACKAGE_ + "XmlTransient"; - - String XML_VALUE = PACKAGE_ + "XmlValue"; - - - // JAXB enums - String XML_ACCESS_ORDER = PACKAGE_ + "XmlAccessOrder"; - String XML_ACCESS_ORDER_ = XML_ACCESS_ORDER + '.'; - String XML_ACCESS_ORDER__ALPHABETICAL = XML_ACCESS_ORDER_ + "ALPHABETICAL"; - String XML_ACCESS_ORDER__UNDEFINED = XML_ACCESS_ORDER_ + "UNDEFINED"; - - String XML_ACCESS_TYPE = PACKAGE_ + "XmlAccessType"; - String XML_ACCESS_TYPE_ = XML_ACCESS_TYPE + '.'; - String XML_ACCESS_TYPE__FIELD = XML_ACCESS_TYPE_ + "FIELD"; - String XML_ACCESS_TYPE__NONE = XML_ACCESS_TYPE_ + "NONE"; - String XML_ACCESS_TYPE__PROPERTY = XML_ACCESS_TYPE_ + "PROPERTY"; - String XML_ACCESS_TYPE__PUBLIC_MEMBER = XML_ACCESS_TYPE_ + "PUBLIC_MEMBER"; - - String XML_NS_FORM = PACKAGE_ + "XmlNsForm"; - String XML_NS_FORM_ = XML_NS_FORM + "."; - String XML_NS_FORM__QUALIFIED = XML_NS_FORM_ + "QUALIFIED"; - String XML_NS_FORM__UNQUALIFIED = XML_NS_FORM_ + "UNQUALIFIED"; - String XML_NS_FORM__UNSET = XML_NS_FORM_ + "UNSET"; - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceAnnotatedElement.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceAnnotatedElement.java deleted file mode 100644 index 45b14e3543..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceAnnotatedElement.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; - -/** - * Java source code or binary annotated element. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JavaResourceAnnotatedElement - extends JavaResourceNode -{ - // ********** annotations ********** - - /** - * String associated with changes to the "annotations" collection - */ - String ANNOTATIONS_COLLECTION = "annotations"; //$NON-NLS-1$ - - /** - * String associated with changes to the "nestableAnnotations" collection - */ - String NESTABLE_ANNOTATIONS_COLLECTION = "nestableAnnotations"; //$NON-NLS-1$ - - /** - * Return the member's annotations in the order that they appear. - * Do not return duplicate annotations as this error is handled by the Java - * compiler. - */ - Iterable getAnnotations(); - - /** - * Return the number of annotations. - */ - int getAnnotationsSize(); - - /** - * Return the annotation with the specified name. - * Return the first if there are duplicates in the source code. - */ - Annotation getAnnotation(String annotationName); - - /** - * Return the specified annotation. - * Return the first if there are duplicates in the source code. - * Do not return null, but a Null Object instead if no annotation - * with the specified name exists in the source code. - */ - Annotation getNonNullAnnotation(String annotationName); - - /** - * Return the nestable annotations with the specified name in the order that - * they appear. - * If nestable and container annotations are both specified on the - * member directly, the behavior is undefined - */ - // TODO tie the singular and plural annotations together so we can generate - // a validation error when both are specified - ListIterable getAnnotations(String nestableAnnotationName); - - /** - * Return the number of nestable annotations with the specified name. - * If nestable and container annotations are both specified on the - * member directly, the behavior is undefined - */ - int getAnnotationsSize(String nestableAnnotationName); - - /** - * Return the nestable annotation at the specified index with the specified name. - * If nestable and container annotations are both specified on the - * member directly, the behavior is undefined - */ - NestableAnnotation getAnnotation(int index, String nestableAnnotationName); - - /** - * Add an annotation with the specified name. - * Return the newly-created annotation. - */ - Annotation addAnnotation(String annotationName); - - /** - * Add a new nestable annotation with the specified name. - * Create a new container annotation if necessary and add the nestable - * annotation to it. - * If both the nestable annotation and the container annotation already - * exist, then add to the container annotation, leaving the existing - * nestable annotation alone. - * If only the nestable annotation exists, then create the new container - * annotation and move the existing nestable annotation to it along with - * the new one. If neither annotation exists, then create a new nestable - * annotation. - */ - NestableAnnotation addAnnotation(int index, String nestableAnnotationName); - - /** - * Move the nestable annotation at the specified source index to the specified target index. - */ - void moveAnnotation(int targetIndex, int sourceIndex, String nestableAnnotationName); - - /** - * Remove the specified annotation. - */ - void removeAnnotation(String annotationName); - - /** - * Remove the specified nestable annotation from the container annotation at the specified - * index. - * If there is no container, assume the index is zero and just remove the nestable annotation - */ - void removeAnnotation(int index, String nestableAnnotationName); - - - // ********** queries ********** - - /** - * Return whether the underlying JDT member is currently annotated with any recognized - * annotations. - */ - boolean isAnnotated(); - - /** - * Return the text range for the member's name. - */ - TextRange getNameTextRange(CompilationUnit astRoot); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceAttribute.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceAttribute.java deleted file mode 100644 index 3f4522fc1f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceAttribute.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; - -/** - * Java source code or binary attribute (field/method) - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JavaResourceAttribute - extends JavaResourceMember -{ - - /** - * Return whether the attribute's type implements or extends the specified - * type. - */ - boolean typeIsSubTypeOf(String typeName); - - /** - * Return whether the attribute's type is a "variable" primitive type - * (i.e. any primitive type except 'void'). - */ - boolean typeIsVariablePrimitive(); - - /** - * @see java.lang.reflect.Modifier - */ - int getModifiers(); - String MODIFIERS_PROPERTY = "modifiers"; //$NON-NLS-1$ - - /** - * Return the resolved, qualified name of the attribute's type - * (e.g. "java.util.Collection" or "byte[]"). - * If the type is an array, this name will include the appropriate number - * of bracket pairs. - * This name will not include the type's generic type arguments - * (e.g. "java.util.Collection" will only return - * "java.util.Collection"). - * @see #typeTypeArgumentNames() - */ - String getTypeName(); - String TYPE_NAME_PROPERTY = "typeName"; //$NON-NLS-1$ - - /** - * Return whether the attribute type is an interface. - */ - boolean typeIsInterface(); - String TYPE_IS_INTERFACE_PROPERTY = "typeIsInterface"; //$NON-NLS-1$ - - /** - * Return whether the attribute type is an enum. - */ - boolean typeIsEnum(); - String TYPE_IS_ENUM_PROPERTY = "typeIsEnum"; //$NON-NLS-1$ - - /** - * Return whether the attribute type is an array. - */ - boolean typeIsArray(); - String TYPE_IS_ARRAY_PROPERTY = "typeIsArray"; //$NON-NLS-1$ - - /** - * Return the names of the attribute type's superclasses. - */ - ListIterable getTypeSuperclassNames(); - String TYPE_SUPERCLASS_NAMES_LIST = "typeSuperclassNames"; //$NON-NLS-1$ - - /** - * Return the names of the attribute type's interfaces. - */ - Iterable getTypeInterfaceNames(); - String TYPE_INTERFACE_NAMES_COLLECTION = "typeInterfaceNames"; //$NON-NLS-1$ - - /** - * Return the names of the attribute type's type arguments. - * The name for any argument that is an array will contain the appropriate - * number of bracket pairs. - * The names will not include any further generic type arguments. - */ - ListIterable getTypeTypeArgumentNames(); - String TYPE_TYPE_ARGUMENT_NAMES_LIST = "typeTypeArgumentNames"; //$NON-NLS-1$ - - int getTypeTypeArgumentNamesSize(); - - String getTypeTypeArgumentName(int index); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceClassFile.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceClassFile.java deleted file mode 100644 index 2267bcb4ea..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceClassFile.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - - -/** - * Java class file - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JavaResourceClassFile - extends JavaResourceNode -{ - /** - * Return the class file's persistent type. - */ - JavaResourceType getPersistentType(); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceCompilationUnit.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceCompilationUnit.java deleted file mode 100644 index 5fe1d8e3b2..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceCompilationUnit.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.common.utility.CommandExecutor; - -/** - * Dali resource for JDT compilation unit. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JavaResourceCompilationUnit - extends JavaResourceNode.Root -{ - /** - * Return the corresponding JDT compilation unit. - */ - ICompilationUnit getCompilationUnit(); - - /** - * Return the JPA project's annotation formatter. This is used to make any - * manipulated annotations reasonably readable after being written to the - * Java source file. - */ - AnnotationEditFormatter getAnnotationEditFormatter(); - - /** - * This allows the resource model to modify the Java source code on the - * UI thread when it is executing on another thread. - */ - CommandExecutor getModifySharedDocumentCommandExecutor(); - - /** - * Resolve type information that could be dependent on other files being - * added/removed. - */ - void resolveTypes(); - - /** - * Something in Java has changed (typically either the compilation unit's - * source code or the Java classpath); synchronize the compilation unit's - * state with the Java source code etc. - */ - void synchronizeWithJavaSource(); - - /** - * Build an AST for the compilation unit with its bindings resolved. - */ - CompilationUnit buildASTRoot(); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceEnum.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceEnum.java deleted file mode 100644 index 7409d862bd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceEnum.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -/** - * Java source code or binary type. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JavaResourceEnum - extends AbstractJavaResourceType -{ - - - // ********** enum constants ********** - - /** - * Return the enum's enum constants. - */ - Iterable getEnumConstants(); - String ENUM_CONSTANTS_COLLECTION = "enumConstants"; //$NON-NLS-1$ -// -// /** -// * Return the type's persistable fields. -// */ -// Iterable getPersistableFields(); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceEnumConstant.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceEnumConstant.java deleted file mode 100644 index e7ab99a4ee..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceEnumConstant.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -/** - * Java source code or binary enum constant - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JavaResourceEnumConstant - extends JavaResourceMember -{ - /** - * The Java resource enum constant's name does not change. - */ - String getName(); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceField.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceField.java deleted file mode 100644 index a5c82bd549..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceField.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -/** - * Java source code or binary field - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JavaResourceField - extends JavaResourceAttribute -{ -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceMember.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceMember.java deleted file mode 100644 index a873e558c4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceMember.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; - -/** - * Java source code or binary persistent member. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public interface JavaResourceMember - extends JavaResourceAnnotatedElement -{ - String getName(); - - // ********** annotations ********** - - /** - * Sets the specified primary annotation as the first annotation, and removes all known - * annotations (i.e. does not remove non-persistence annotations) which are not included - * in the supporting annotations. - */ - Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable supportingAnnotationNames); - - - - // ********** modifiers ********** - - /** - * Return whether the member is final. - */ - boolean isFinal(); - String FINAL_PROPERTY = "final"; //$NON-NLS-1$ - - boolean isTransient(); - String TRANSIENT_PROPERTY = "transient"; //$NON-NLS-1$ - - boolean isPublic(); - String PUBLIC_PROPERTY = "public"; //$NON-NLS-1$ - - boolean isStatic(); - String STATIC_PROPERTY = "static"; //$NON-NLS-1$ - - - // ********** queries ********** - - /** - * Return whether the Java resource member is for the specified - * member. - */ - boolean isFor(String memberName, int occurrence); - - - // ********** behavior ********** - - /** - * Resolve type information that could be dependent on changes elsewhere - * in the workspace. - */ - void resolveTypes(CompilationUnit astRoot); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceMethod.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceMethod.java deleted file mode 100644 index 1ab479b6a8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceMethod.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jpt.common.utility.MethodSignature; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; - -/** - * Java source code or binary method - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JavaResourceMethod - extends JavaResourceAttribute -{ - - /** - * The Java resource method's name does not change. - */ - String getMethodName(); - - /** - * Return whether the Java resource persistent attribute is for the specified - * method. - */ - boolean isFor(MethodSignature methodSignature, int occurrence); - - ListIterable getParameterTypeNames(); - String PARAMETER_TYPE_NAMES_LIST = "parameterTypeNames"; //$NON-NLS-1$ - - int getParametersSize(); - - boolean isConstructor(); - String CONSTRUCTOR_PROPERTY = "constructor"; //$NON-NLS-1$ - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceNode.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceNode.java deleted file mode 100644 index 9e33bd0372..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceNode.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.JptResourceModel; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.jaxb.core.AnnotationProvider; - -/** - * Common interface for Java resource nodes (source code or binary). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JavaResourceNode - extends Model -{ - - /** - * Return the Eclipse file that contains the Java resource node - * (typically either a Java source code file or a JAR). - */ - IFile getFile(); - - /** - * Return the root of the Java resource containment hierarchy - * (typically either a compilation unit or a package fragment root). - */ - Root getRoot(); - - /** - * Return the [source] node's root (the compilation unit). - */ - // TODO get rid of this method...? - JavaResourceCompilationUnit getJavaResourceCompilationUnit(); - - /** - * Return the [source] node's text range in the compilation unit's file. - */ - TextRange getTextRange(CompilationUnit astRoot); - - /** - * Initialize the [source] node from the specified AST. - */ - void initialize(CompilationUnit astRoot); - - /** - * Synchronize the [source] node with the specified AST. - */ - void synchronizeWith(CompilationUnit astRoot); - - - /** - * Root of Java resource model containment hierarchy. - */ - interface Root extends JavaResourceNode, JptResourceModel { - - /** - * Return the root's Java resource types. - */ - Iterable getTypes(); - String TYPES_COLLECTION = "types"; //$NON-NLS-1$ - - /** - * Return the root's Java resource enums. - */ - Iterable getEnums(); - String ENUMS_COLLECTION = "enums"; //$NON-NLS-1$ - - /** - * Called (via a hook in change notification) whenever anything in the - * Java resource model changes. Forwarded to listeners. - */ - void resourceModelChanged(); - - /** - * Return the annotation provider that supplies the annotations found - * in the Java resource model. - */ - AnnotationProvider getAnnotationProvider(); - - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourcePackage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourcePackage.java deleted file mode 100644 index ac15223fe1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourcePackage.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Red Hat, Inc. - * Distributed under license by Red Hat, Inc. All rights reserved. - * This program is made available under the terms of the - * Eclipse Public License v1.0 which accompanies this distribution, - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributor: - * Red Hat, Inc. - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -/** - * @author Dmitry Geraskov - * - * Java source code of package-info - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaResourcePackage - extends JavaResourceAnnotatedElement { - - /** - * The Java resource persistent package's name. - */ - String getName(); - String NAME_PROPERTY = "name"; //$NON-NLS-1$ -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourcePackageFragment.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourcePackageFragment.java deleted file mode 100644 index f488cc96a9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourcePackageFragment.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - - -/** - * Java package fragment - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JavaResourcePackageFragment - extends JavaResourceNode -{ - /** - * Return the package fragment's class files that contain "persistable" types. - */ - Iterable getClassFiles(); - String CLASS_FILES_COLLECTION = "classFiles"; //$NON-NLS-1$ - - /** - * Return the size of the package fragment's class files. - */ - int getClassFilesSize(); - - /** - * Return the package fragment's Java persistent types. - * Return only the files that are annotated with JAXB annotations. - */ - Iterable getPersistedTypes(); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourcePackageFragmentRoot.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourcePackageFragmentRoot.java deleted file mode 100644 index e23bc87f4f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourcePackageFragmentRoot.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - - -/** - * Java package fragement root - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JavaResourcePackageFragmentRoot - extends JavaResourceNode.Root -{ - /** - * Return the package fragment root's package fragments. - */ - Iterable getPackageFragments(); - String PACKAGE_FRAGMENTS_COLLECTION = "packageFragments"; //$NON-NLS-1$ - - /** - * Return the size of the package fragment root's package fragments. - */ - int getPackageFragmentsSize(); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourcePackageInfoCompilationUnit.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourcePackageInfoCompilationUnit.java deleted file mode 100644 index 29a829c232..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourcePackageInfoCompilationUnit.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -/** - * Dali resource for JDT compilation unit named package-info.java. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JavaResourcePackageInfoCompilationUnit - extends JavaResourceCompilationUnit -{ - JavaResourcePackage getPackage(); - String PACKAGE = "package"; //$NON-NLS-1$ - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceType.java deleted file mode 100644 index 44f719f6aa..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JavaResourceType.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -/** - * Java source code or binary type. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public interface JavaResourceType - extends AbstractJavaResourceType -{ - - /** - * Return the fully qualified name of the type's superclass. - */ - String getSuperclassQualifiedName(); - String SUPERCLASS_QUALIFIED_NAME_PROPERTY = "superclassQualifiedName"; //$NON-NLS-1$ - - /** - * Return whether the type is abstract. - */ - boolean isAbstract(); - String ABSTRACT_PROPERTY = "abstract"; //$NON-NLS-1$ - - /** - * Return whether the type has a no-arg constructor (private, protected, or public) - */ - boolean hasNoArgConstructor(); - String NO_ARG_CONSTRUCTOR_PROPERTY = "noArgConstructor"; //$NON-NLS-1$ - - - // ********** fields ********** - - /** - * Return the type's fields. - */ - Iterable getFields(); - String FIELDS_COLLECTION = "fields"; //$NON-NLS-1$ - - - // ********** methods ********** - - /** - * Return the type's methods. This returns *all* methods from the JDT Type - */ - Iterable getMethods(); - String METHODS_COLLECTION = "methods"; //$NON-NLS-1$ - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JaxbContainmentAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JaxbContainmentAnnotation.java deleted file mode 100644 index d5a606aa56..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/JaxbContainmentAnnotation.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbContainmentAnnotation - extends Annotation -{ - - /** - * Corresponds to the 'name' element of the XmlAttribute annotation. - * Return null if the element does not exist in Java. - */ - String getName(); - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - - /** - * Corresponds to the 'name' element of the XmlAttribute annotation. - * Set to null to remove the element. - */ - void setName(String name); - - /** - * Return the {@link TextRange} for the 'name' element. If the element - * does not exist return the {@link TextRange} for the XmlAttribute annotation. - */ - TextRange getNameTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'namespace' element of the XmlAttribute annotation. - * Return null if the element does not exist in Java. - */ - String getNamespace(); - String NAMESPACE_PROPERTY = "namespace"; //$NON-NLS-1$ - - /** - * Corresponds to the 'namespace' element of the XmlAttribute annotation. - * Set to null to remove the element. - */ - void setNamespace(String namespace); - - /** - * Return the {@link TextRange} for the 'namespace' element. If the element - * does not exist return the {@link TextRange} for the XmlAttribute annotation. - */ - TextRange getNamespaceTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'required' element of the XmlAttribute annotation. - * Return null if the element does not exist in Java. - */ - Boolean getRequired(); - String REQUIRED_PROPERTY = "required"; //$NON-NLS-1$ - - /** - * Corresponds to the 'required' element of the XmlAttribute annotation. - * Set to null to remove the element. - */ - void setRequired(Boolean required); - - /** - * Return the {@link TextRange} for the 'required' element. If the element - * does not exist return the {@link TextRange} for the XmlAttribute annotation. - */ - TextRange getRequiredTextRange(CompilationUnit astRoot); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/NestableAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/NestableAnnotation.java deleted file mode 100644 index 4fcae43c04..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/NestableAnnotation.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -/** - * Interface for dealing with annotations that can be "nested" within other - * annotations, typically within arrays. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public interface NestableAnnotation - extends Annotation -{ - /** - * Move the annotation to the specified index within its container annotation. - * This should only be called when the annotation is actually nested. - */ - void moveAnnotation(int index); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/NestableAnnotationDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/NestableAnnotationDefinition.java deleted file mode 100644 index 403e8a52b7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/NestableAnnotationDefinition.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; - -/** - * Used to build NestableAnnotations discovered in the Java source code. - * To provide new NestableAnnotationDefinitions, create a new JaxbPlatform - * by implementing JaxbPlatformDefinition. - * - * @see NestableAnnotation - * @see org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDefinition - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface NestableAnnotationDefinition -{ - /** - * Return the name of the annotation the definition will build in the - * various #build...(...) methods. - */ - String getNestableAnnotationName(); - - String getContainerAnnotationName(); - - String getElementName(); - - /** - * Build and return an annotation for the specified annotated element. - */ - NestableAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement, int index); - - /** - * Build and return an annotation for the specified JDT annotation - * on the specified annotated element. - */ - Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessOrder.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessOrder.java deleted file mode 100644 index a7cbac73b7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessOrder.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -/** - * Corresponds to the JAXB enum - * javax.xml.bind.annotation.XmlAccessOrder - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public enum XmlAccessOrder { - - ALPHABETICAL(JAXB.XML_ACCESS_ORDER__ALPHABETICAL), - UNDEFINED (JAXB.XML_ACCESS_ORDER__UNDEFINED); - - - private String javaAnnotationValue; - - XmlAccessOrder(String javaAnnotationValue) { - if (javaAnnotationValue == null) { - throw new NullPointerException(); - } - this.javaAnnotationValue = javaAnnotationValue; - } - - public String getJavaAnnotationValue() { - return this.javaAnnotationValue; - } - - - // ********** static methods ********** - - public static XmlAccessOrder fromJavaAnnotationValue(Object javaAnnotationValue) { - return (javaAnnotationValue == null) ? null : fromJavaAnnotationValue_(javaAnnotationValue); - } - - private static XmlAccessOrder fromJavaAnnotationValue_(Object javaAnnotationValue) { - for (XmlAccessOrder accessType : XmlAccessOrder.values()) { - if (accessType.getJavaAnnotationValue().equals(javaAnnotationValue)) { - return accessType; - } - } - return null; - } - - public static String toJavaAnnotationValue(XmlAccessOrder accessType) { - return (accessType == null) ? null : accessType.getJavaAnnotationValue(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessType.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessType.java deleted file mode 100644 index c3b3bd0967..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessType.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -/** - * Corresponds to the JAXB enum - * javax.xml.bind.annotation.XmlAccessType - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public enum XmlAccessType { - - FIELD(JAXB.XML_ACCESS_TYPE__FIELD), - NONE(JAXB.XML_ACCESS_TYPE__NONE), - PROPERTY(JAXB.XML_ACCESS_TYPE__PROPERTY), - PUBLIC_MEMBER(JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - - - private String javaAnnotationValue; - - XmlAccessType(String javaAnnotationValue) { - if (javaAnnotationValue == null) { - throw new NullPointerException(); - } - this.javaAnnotationValue = javaAnnotationValue; - } - - public String getJavaAnnotationValue() { - return this.javaAnnotationValue; - } - - - // ********** static methods ********** - - public static XmlAccessType fromJavaAnnotationValue(Object javaAnnotationValue) { - return (javaAnnotationValue == null) ? null : fromJavaAnnotationValue_(javaAnnotationValue); - } - - private static XmlAccessType fromJavaAnnotationValue_(Object javaAnnotationValue) { - for (XmlAccessType accessType : XmlAccessType.values()) { - if (accessType.getJavaAnnotationValue().equals(javaAnnotationValue)) { - return accessType; - } - } - return null; - } - - public static String toJavaAnnotationValue(XmlAccessType accessType) { - return (accessType == null) ? null : accessType.getJavaAnnotationValue(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessorOrderAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessorOrderAnnotation.java deleted file mode 100644 index f4055f4ae6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessorOrderAnnotation.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlAccessorOrder - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlAccessorOrderAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_ACCESSOR_ORDER; - - /** - * Corresponds to the 'value' element of the XmlAccessorOrder annotation. - * Return null if the element does not exist in Java. - */ - XmlAccessOrder getValue(); - String VALUE_PROPERTY = "value"; //$NON-NLS-1$ - - /** - * Corresponds to the 'value' element of the XmlAccessorOrder annotation. - * Set to null to remove the element. - */ - void setValue(XmlAccessOrder value); - - /** - * Return the {@link TextRange} for the 'value' element. If the element - * does not exist return the {@link TextRange} for the XmlAccessorOrder annotation. - */ - TextRange getValueTextRange(CompilationUnit astRoot); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessorTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessorTypeAnnotation.java deleted file mode 100644 index bc6d0e1e04..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAccessorTypeAnnotation.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlAccessorType - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlAccessorTypeAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_ACCESSOR_TYPE; - - /** - * Corresponds to the 'value' element of the XmlAccessorType annotation. - * Return null if the element does not exist in Java. - */ - XmlAccessType getValue(); - String VALUE_PROPERTY = "value"; //$NON-NLS-1$ - - /** - * Corresponds to the 'value' element of the XmlAccessorType annotation. - * Set to null to remove the element. - */ - void setValue(XmlAccessType value); - - /** - * Return the {@link TextRange} for the 'value' element. If the element - * does not exist return the {@link TextRange} for the XmlAccessorType annotation. - */ - TextRange getValueTextRange(CompilationUnit astRoot); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAnyAttributeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAnyAttributeAnnotation.java deleted file mode 100644 index 2a0f79dd4e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAnyAttributeAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlAnyAttribute - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlAnyAttributeAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_ANY_ATTRIBUTE; - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAnyElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAnyElementAnnotation.java deleted file mode 100644 index ecff447a9c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAnyElementAnnotation.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlAnyElement - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlAnyElementAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_ANY_ELEMENT; - - /** - * Corresponds to the 'lax' element of the XmlAnyElement annotation. - * Return null if the element does not exist in Java. - */ - Boolean getLax(); - String LAX_PROPERTY = "lax"; //$NON-NLS-1$ - - /** - * Corresponds to the 'lax' element of the XmlAnyElement annotation. - * Set to null to remove the element. - */ - void setLax(Boolean lax); - - /** - * Return the {@link TextRange} for the 'lax' element. If the element - * does not exist return the {@link TextRange} for the XmlAnyElement annotation. - */ - TextRange getLaxTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'value' element of the XmlAnyElement annotation. - * Return null if the element does not exist in Java. - * Return the portion of the value preceding ".class". - *

-	 *     @XmlAnyElement(value=Foo.class)
-	 * 
- * will return "Foo" - */ - String getValue(); - String VALUE_PROPERTY = "value"; //$NON-NLS-1$ - - /** - * Corresponds to the 'value' element of the XmlAnyElement annotation. - * Set to null to remove the element. - */ - void setValue(String value); - - /** - * Return the {@link TextRange} for the 'value' element. If the element - * does not exist return the {@link TextRange} for the XmlAnyElement annotation. - */ - TextRange getValueTextRange(CompilationUnit astRoot); - - /** - * Return the fully-qualified value class name as resolved by the AST's bindings. - *
-	 *     @XmlAnyElement(value=Foo.class)
-	 * 
- * will return "model.Foo" if there is an import for model.Foo. - * @return - */ - String getFullyQualifiedValueClassName(); - String FULLY_QUALIFIED_VALUE_CLASS_NAME_PROPERTY = "fullyQualifiedValueClassName"; //$NON-NLS-1$ -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAttachmentRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAttachmentRefAnnotation.java deleted file mode 100644 index f02dfaeba5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAttachmentRefAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlAttachmentRef - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlAttachmentRefAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_ATTACHMENT_REF; - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAttributeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAttributeAnnotation.java deleted file mode 100644 index d953ee52a6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlAttributeAnnotation.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010,2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlAttribute - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlAttributeAnnotation - extends JaxbContainmentAnnotation -{ - String ANNOTATION_NAME = JAXB.XML_ATTRIBUTE; - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementAnnotation.java deleted file mode 100644 index 6a0d5f68a8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementAnnotation.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlElement - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlElementAnnotation - extends JaxbContainmentAnnotation, NestableAnnotation -{ - String ANNOTATION_NAME = JAXB.XML_ELEMENT; - - /** - * Corresponds to the 'defaultValue' element of the XmlElement annotation. - * Return null if the element does not exist in Java. - */ - String getDefaultValue(); - String DEFAULT_VALUE_PROPERTY = "defaultValue"; //$NON-NLS-1$ - - /** - * Corresponds to the 'defaultValue' element of the XmlElement annotation. - * Set to null to remove the element. - */ - void setDefaultValue(String defaultValue); - - /** - * Return the {@link TextRange} for the 'defaultValue' element. If the element - * does not exist return the {@link TextRange} for the XmlElement annotation. - */ - TextRange getDefaultValueTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'nillable' element of the XmlElement annotation. - * Return null if the element does not exist in Java. - */ - Boolean getNillable(); - String NILLABLE_PROPERTY = "nillable"; //$NON-NLS-1$ - - /** - * Corresponds to the 'nillable' element of the XmlElement annotation. - * Set to null to remove the element. - */ - void setNillable(Boolean nillable); - - /** - * Return the {@link TextRange} for the 'nillable' element. If the element - * does not exist return the {@link TextRange} for the XmlElement annotation. - */ - TextRange getNillableTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'type' element of the XmlElement annotation. - * Return null if the element does not exist in Java. - * Return the portion of the value preceding ".class". - *
-	 *     @XmlElement(type=Foo.class)
-	 * 
- * will return "Foo" - */ - String getType(); - String TYPE_PROPERTY = "type"; //$NON-NLS-1$ - - /** - * Corresponds to the 'type' element of the XmlElement annotation. - * Set to null to remove the element. - */ - void setType(String type); - /** - * Return the {@link TextRange} for the 'type' element. If the element - * does not exist return the {@link TextRange} for the XmlElement annotation. - */ - TextRange getTypeTextRange(CompilationUnit astRoot); - - /** - * Return the fully-qualified type name as resolved by the AST's bindings. - *
-	 *     @XmlElement(type=Foo.class)
-	 * 
- * will return "model.Foo" if there is an import for model.Foo. - * @return - */ - String getFullyQualifiedTypeName(); - String FULLY_QUALIFIED_TYPE_NAME_PROPERTY = "fullyQualifiedTypeName"; //$NON-NLS-1$ -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementDeclAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementDeclAnnotation.java deleted file mode 100644 index 349a7aea5a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementDeclAnnotation.java +++ /dev/null @@ -1,162 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlElementDecl - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlElementDeclAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_ELEMENT_DECL; - - /** - * Corresponds to the 'name' element of the XmlElementDecl annotation. - * Return null if the element does not exist in Java. - */ - String getName(); - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - - /** - * Corresponds to the 'name' element of the XmlElementDecl annotation. - * Set to null to remove the element. - */ - void setName(String name); - - /** - * Return the {@link TextRange} for the 'name' element. If the element - * does not exist return the {@link TextRange} for the XmlElementDecl annotation. - */ - TextRange getNameTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'namespace' element of the XmlElementDecl annotation. - * Return null if the element does not exist in Java. - */ - String getNamespace(); - String NAMESPACE_PROPERTY = "namespace"; //$NON-NLS-1$ - - /** - * Corresponds to the 'namespace' element of the XmlElementDecl annotation. - * Set to null to remove the element. - */ - void setNamespace(String namespace); - - /** - * Return the {@link TextRange} for the 'namespace' element. If the element - * does not exist return the {@link TextRange} for the XmlElementDecl annotation. - */ - TextRange getNamespaceTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'defaultValue' element of the XmlElementDecl annotation. - * Return null if the element does not exist in Java. - */ - String getDefaultValue(); - String DEFAULT_VALUE_PROPERTY = "defaultValue"; //$NON-NLS-1$ - - /** - * Corresponds to the 'defaultValue' element of the XmlElementDecl annotation. - * Set to null to remove the element. - */ - void setDefaultValue(String defaultValue); - - /** - * Return the {@link TextRange} for the 'defaultValue' element. If the element - * does not exist return the {@link TextRange} for the XmlElementDecl annotation. - */ - TextRange getDefaultValueTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'scope' element of the XmlElementDecl annotation. - * Return null if the element does not exist in Java. - * Return the portion of the value preceding ".class". - *
-	 *     @XmlElementDecl(type=XmlElementDecl.GLOBAL.class)
-	 * 
- * will return "XmlElementDecl.GLOBAL" - */ - String getScope(); - String SCOPE_PROPERTY = "scope"; //$NON-NLS-1$ - - /** - * Corresponds to the 'scope' element of the XmlElementDecl annotation. - * Set to null to remove the element. - */ - void setScope(String scope); - - /** - * Return the {@link TextRange} for the 'scope' element. If the element - * does not exist return the {@link TextRange} for the XmlElementDecl annotation. - */ - TextRange getScopeTextRange(CompilationUnit astRoot); - - /** - * Return the fully-qualified scope class name as resolved by the AST's bindings. - *
-	 *     @XmlElementDecl(type=XmlElementDecl.GLOBAL.class)
-	 * 
- * will return "javax.xml.bind.annotation.XmlElementDecl.GLOBAL" - */ - String getFullyQualifiedScopeClassName(); - String FULLY_QUALIFIED_SCOPE_CLASS_NAME_PROPERTY = "fullyQualifiedScopeClassName"; //$NON-NLS-1$ - - /** - * Corresponds to the 'substitutionHeadName' element of the XmlElementDecl annotation. - * Return null if the element does not exist in Java. - */ - String getSubstitutionHeadName(); - String SUBSTITUTION_HEAD_NAME_PROPERTY = "substitutionHeadName"; //$NON-NLS-1$ - - /** - * Corresponds to the 'substitutionHeadName' element of the XmlElementDecl annotation. - * Set to null to remove the element. - */ - void setSubstitutionHeadName(String substitutionHeadName); - - /** - * Return the {@link TextRange} for the 'substitutionHeadName' element. If the element - * does not exist return the {@link TextRange} for the XmlElementDecl annotation. - */ - TextRange getSubstitutionHeadNameTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'substitutionHeadNamespace' element of the XmlElementDecl annotation. - * Return null if the element does not exist in Java. - */ - String getSubstitutionHeadNamespace(); - String SUBSTITUTION_HEAD_NAMESPACE_PROPERTY = "substitutionHeadNamespace"; //$NON-NLS-1$ - - /** - * Corresponds to the 'substitutionHeadNamespace' element of the XmlElementDecl annotation. - * Set to null to remove the element. - */ - void setSubstitutionHeadNamespace(String substitutionHeadNamespace); - - /** - * Return the {@link TextRange} for the 'substitutionHeadNamespace' element. If the element - * does not exist return the {@link TextRange} for the XmlElementDecl annotation. - */ - TextRange getSubstitutionHeadNamespaceTextRange(CompilationUnit astRoot); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementRefAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementRefAnnotation.java deleted file mode 100644 index 469606260b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementRefAnnotation.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlElementRef - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlElementRefAnnotation - extends NestableAnnotation -{ - String ANNOTATION_NAME = JAXB.XML_ELEMENT_REF; - - /** - * Corresponds to the 'name' element of the XmlElementRef annotation. - * Return null if the element does not exist in Java. - */ - String getName(); - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - - /** - * Corresponds to the 'name' element of the XmlElementRef annotation. - * Set to null to remove the element. - */ - void setName(String name); - - /** - * Return the {@link TextRange} for the 'name' element. If the element - * does not exist return the {@link TextRange} for the XmlElementRef annotation. - */ - TextRange getNameTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'namespace' element of the XmlElementRef annotation. - * Return null if the element does not exist in Java. - */ - String getNamespace(); - String NAMESPACE_PROPERTY = "namespace"; //$NON-NLS-1$ - - /** - * Corresponds to the 'namespace' element of the XmlElementRef annotation. - * Set to null to remove the element. - */ - void setNamespace(String namespace); - - /** - * Return the {@link TextRange} for the 'namespace' element. If the element - * does not exist return the {@link TextRange} for the XmlElementRef annotation. - */ - TextRange getNamespaceTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'type' element of the XmlElementRef annotation. - * Return null if the element does not exist in Java. - * Return the portion of the value preceding ".class". - *
-	 *     @XmlElementRef(type=Foo.class)
-	 * 
- * will return "Foo" - */ - String getType(); - String TYPE_PROPERTY = "type"; //$NON-NLS-1$ - - /** - * Corresponds to the 'type' element of the XmlElementRef annotation. - * Set to null to remove the element. - */ - void setType(String type); - /** - * Return the {@link TextRange} for the 'type' element. If the element - * does not exist return the {@link TextRange} for the XmlElementRef annotation. - */ - TextRange getTypeTextRange(CompilationUnit astRoot); - - /** - * Return the fully-qualified type name as resolved by the AST's bindings. - *
-	 *     @XmlElementRef(type=Foo.class)
-	 * 
- * will return "model.Foo" if there is an import for model.Foo. - * @return - */ - String getFullyQualifiedTypeName(); - String FULLY_QUALIFIED_TYPE_NAME_PROPERTY = "fullyQualifiedTypeName"; //$NON-NLS-1$ -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementWrapperAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementWrapperAnnotation.java deleted file mode 100644 index ed11d770a1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementWrapperAnnotation.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlElementWrapper - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlElementWrapperAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_ELEMENT_WRAPPER; - - /** - * Corresponds to the 'name' element of the XmlElementWrapper annotation. - * Return null if the element does not exist in Java. - */ - String getName(); - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - - /** - * Corresponds to the 'name' element of the XmlElementWrapper annotation. - * Set to null to remove the element. - */ - void setName(String name); - - /** - * Return the {@link TextRange} for the 'name' element. If the element - * does not exist return the {@link TextRange} for the XmlElementWrapper annotation. - */ - TextRange getNameTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'namespace' element of the XmlElementWrapper annotation. - * Return null if the element does not exist in Java. - */ - String getNamespace(); - String NAMESPACE_PROPERTY = "namespace"; //$NON-NLS-1$ - - /** - * Corresponds to the 'namespace' element of the XmlElementWrapper annotation. - * Set to null to remove the element. - */ - void setNamespace(String namespace); - - /** - * Return the {@link TextRange} for the 'namespace' element. If the element - * does not exist return the {@link TextRange} for the XmlElementWrapper annotation. - */ - TextRange getNamespaceTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'nillable' element of the XmlElementWrapper annotation. - * Return null if the element does not exist in Java. - */ - Boolean getNillable(); - String NILLABLE_PROPERTY = "nillable"; //$NON-NLS-1$ - - /** - * Corresponds to the 'nillable' element of the XmlElementWrapper annotation. - * Set to null to remove the element. - */ - void setNillable(Boolean nillable); - - /** - * Return the {@link TextRange} for the 'nillable' element. If the element - * does not exist return the {@link TextRange} for the XmlElementWrapper annotation. - */ - TextRange getNillableTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'required' element of the XmlElementWrapper annotation. - * Return null if the element does not exist in Java. - */ - Boolean getRequired(); - String REQUIRED_PROPERTY = "required"; //$NON-NLS-1$ - - /** - * Corresponds to the 'required' element of the XmlElementWrapper annotation. - * Set to null to remove the element. - */ - void setRequired(Boolean required); - - /** - * Return the {@link TextRange} for the 'required' element. If the element - * does not exist return the {@link TextRange} for the XmlElementWrapper annotation. - */ - TextRange getRequiredTextRange(CompilationUnit astRoot); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementsAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementsAnnotation.java deleted file mode 100644 index 86a145c54b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlElementsAnnotation.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlElement - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlElementsAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_ELEMENTS; - - - /** - * Corresponds to the 'value' element of the XmlElements annotation. - * Return an empty iterator if the element does not exist in Java. - */ - ListIterable getXmlElements(); - String XML_ELEMENTS_LIST = "xmlElements"; //$NON-NLS-1$ - - /** - * Corresponds to the 'value' element of the XmlElements annotation. - */ - int getXmlElementsSize(); - - /** - * Corresponds to the 'value' element of the XmlElements annotation. - */ - XmlElementAnnotation xmlElementAt(int index); - - /** - * Corresponds to the 'value' element of the XmlElements annotation. - */ - XmlElementAnnotation addXmlElement(int index); - - /** - * Corresponds to the 'value' element of the XmlElements annotation. - */ - void moveXmlElement(int targetIndex, int sourceIndex); - - /** - * Corresponds to the 'value' element of the XmlElements annotation. - */ - void removeXmlElement(int index); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumAnnotation.java deleted file mode 100644 index affaa665fc..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumAnnotation.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlEnum - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlEnumAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_ENUM; - - /** - * Corresponds to the 'value' element of the XmlEnum annotation. - * Return null if the element does not exist in Java. - * Return the portion of the value preceding ".class". - *
-	 *     @XmlEnum(value=EnumClass.class)
-	 * 
- * will return "EnumClass" - */ - String getValue(); - String VALUE_PROPERTY = "value"; //$NON-NLS-1$ - - /** - * Corresponds to the 'value' element of the XmlEnum annotation. - * Set to null to remove the element. - */ - void setValue(String value); - /** - * Return the {@link TextRange} for the 'value' element. If the element - * does not exist return the {@link TextRange} for the XmlEnum annotation. - */ - TextRange getValueTextRange(CompilationUnit astRoot); - - /** - * Return the fully-qualified value class name as resolved by the AST's bindings. - *
-	 *     @XmlEnum(value=EnumClass.class)
-	 * 
- * will return "model.EnumClass" if there is an import for model.EnumClass. - * @return - */ - String getFullyQualifiedValueClassName(); - String FULLY_QUALIFIED_VALUE_CLASS_NAME_PROPERTY = "fullyQualifiedValueClassName"; //$NON-NLS-1$ - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumValueAnnotation.java deleted file mode 100644 index 1692615046..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlEnumValueAnnotation.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlEnumValue - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlEnumValueAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_ENUM_VALUE; - - - /** - * Corresponds to the 'value' element of the XmlEnumValue annotation. - * Return null if the element does not exist in Java. - */ - String getValue(); - String VALUE_PROPERTY = "value"; //$NON-NLS-1$ - - /** - * Corresponds to the 'value' element of the XmlEnumValue annotation. - * Set to null to remove the element. - */ - void setValue(String value); - - /** - * Return the {@link TextRange} for the 'value' element. If the element - * does not exist return the {@link TextRange} for the XmlEnumValue annotation. - */ - TextRange getValueTextRange(CompilationUnit astRoot); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlIDAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlIDAnnotation.java deleted file mode 100644 index 98379fdbe0..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlIDAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlID - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlIDAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_ID; - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlIDREFAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlIDREFAnnotation.java deleted file mode 100644 index eea217cdf6..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlIDREFAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlIDREF - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlIDREFAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_IDREF; - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlInlineBinaryDataAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlInlineBinaryDataAnnotation.java deleted file mode 100644 index 1e1e7c97ec..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlInlineBinaryDataAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlInlineBinaryData - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlInlineBinaryDataAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_INLINE_BINARY_DATA; - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlJavaTypeAdapterAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlJavaTypeAdapterAnnotation.java deleted file mode 100644 index 6b85cdc0f2..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlJavaTypeAdapterAnnotation.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlJavaTypeAdapterAnnotation - extends NestableAnnotation { - - String ANNOTATION_NAME = JAXB.XML_JAVA_TYPE_ADAPTER; - - /** - * Corresponds to the 'value' element of the XmlJavaTypeAdapter annotation. - * Return null if the element does not exist in Java. - * Return the portion of the value preceding ".class". - *
-	 *     @XmlJavaTypeAdapter(value=FooAdapter.class)
-	 * 
- * will return "FooAdapter" - */ - String getValue(); - String VALUE_PROPERTY = "value"; //$NON-NLS-1$ - - /** - * Corresponds to the 'value' element of the XmlJavaTypeAdapter annotation. - * Set to null to remove the element. - */ - void setValue(String value); - - /** - * Return the {@link TextRange} for the 'value' element. If the element - * does not exist return the {@link TextRange} for the XmlJavaTypeAdapter annotation. - */ - TextRange getValueTextRange(CompilationUnit astRoot); - - /** - * Return the value's fully-qualified class name as resolved by the AST's bindings. - *
-	 *     @XmlJavaTypeAdapter(FooAdapter.class)
-	 * 
- * will return "example.FooAdapter" if there is an import for example.FooAdapter. - */ - String getFullyQualifiedValue(); - String FULLY_QUALIFIED_VALUE_PROPERTY = "fullyQualifiedValue"; //$NON-NLS-1$ - - /** - * Corresponds to the 'type' element of the XmlJavaTypeAdapter annotation. - * Return null if the element does not exist in Java. - * Return the portion of the value preceding ".class". - *
-	 *     @XmlJavaTypeAdapter(type=Foo.class)
-	 * 
- * will return "Foo" - */ - String getType(); - String TYPE_PROPERTY = "type"; //$NON-NLS-1$ - - /** - * Corresponds to the 'type' element of the XmlJavaTypeAdapter annotation. - * Set to null to remove the element. - */ - void setType(String type); - - /** - * Return the {@link TextRange} for the 'type' element. If the element - * does not exist return the {@link TextRange} for the XmlJavaTypeAdapter annotation. - */ - TextRange getTypeTextRange(CompilationUnit astRoot); - - /** - * Return the type's fully-qualified class name as resolved by the AST's bindings. - *
-	 *     @XmlJavaTypeAdapter(type=Foo.class)
-	 * 
- * will return "example.Foo" if there is an import for example.Foo. - */ - String getFullyQualifiedType(); - String FULLY_QUALIFIED_TYPE_PROPERTY = "fullyQualifiedType"; //$NON-NLS-1$ -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlListAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlListAnnotation.java deleted file mode 100644 index 6b32924649..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlListAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlList - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlListAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_LIST; - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMimeTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMimeTypeAnnotation.java deleted file mode 100644 index d81da94c74..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMimeTypeAnnotation.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlMimeType - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlMimeTypeAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_MIME_TYPE; - - /** - * Corresponds to the 'value' element of the XmlMimeType annotation. - * Return null if the element does not exist in Java. - */ - String getValue(); - String VALUE_PROPERTY = "value"; //$NON-NLS-1$ - - /** - * Corresponds to the 'value' element of the XmlMimeType annotation. - * Set to null to remove the element. - */ - void setValue(String value); - - /** - * Return the {@link TextRange} for the 'value' element. If the element - * does not exist return the {@link TextRange} for the XmlMimeType annotation. - */ - TextRange getValueTextRange(CompilationUnit astRoot); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMixedAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMixedAnnotation.java deleted file mode 100644 index 832cb98570..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlMixedAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlMixed - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlMixedAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_MIXED; - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlNsAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlNsAnnotation.java deleted file mode 100644 index 6b562d4f7e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlNsAnnotation.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlNs - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlNsAnnotation - extends NestableAnnotation { - - String ANNOTATION_NAME = JAXB.XML_NS; - - /** - * Corresponds to the 'namespaceURI' element of the XmlNs annotation. - * Return null if the element does not exist in Java. - */ - String getNamespaceURI(); - String NAMESPACE_URI_PROPERTY = "namespaceURI"; //$NON-NLS-1$ - - /** - * Corresponds to the 'namespaceURI' element of the XmlNs annotation. - * Set to null to remove the element. - */ - void setNamespaceURI(String namespaceURI); - - /** - * Return the {@link TextRange} for the 'namespace' element. If the element - * does not exist return the {@link TextRange} for the XmlNs annotation. - */ - TextRange getNamespaceURITextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'prefix' element of the XmlNs annotation. - * Return null if the element does not exist in Java. - */ - String getPrefix(); - String PREFIX_PROPERTY = "prefix"; //$NON-NLS-1$ - - /** - * Corresponds to the 'prefix' element of the XmlNs annotation. - * Set to null to remove the element. - */ - void setPrefix(String prefix); - - /** - * Return the {@link TextRange} for the 'prefix' element. If the element - * does not exist return the {@link TextRange} for the XmlNs annotation. - */ - TextRange getPrefixTextRange(CompilationUnit astRoot); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlNsForm.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlNsForm.java deleted file mode 100644 index 4d73541c8f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlNsForm.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -/** - * Corresponds to the JAXB enum - * javax.xml.bind.annotation.XmlNsForm - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public enum XmlNsForm { - - QUALIFIED(JAXB.XML_NS_FORM__QUALIFIED), - UNQUALIFIED(JAXB.XML_NS_FORM__UNQUALIFIED), - UNSET(JAXB.XML_NS_FORM__UNSET); - - - private String javaAnnotationValue; - - XmlNsForm(String javaAnnotationValue) { - if (javaAnnotationValue == null) { - throw new NullPointerException(); - } - this.javaAnnotationValue = javaAnnotationValue; - } - - public String getJavaAnnotationValue() { - return this.javaAnnotationValue; - } - - - // ********** static methods ********** - - public static XmlNsForm fromJavaAnnotationValue(Object javaAnnotationValue) { - return (javaAnnotationValue == null) ? null : fromJavaAnnotationValue_(javaAnnotationValue); - } - - private static XmlNsForm fromJavaAnnotationValue_(Object javaAnnotationValue) { - for (XmlNsForm nsForm : XmlNsForm.values()) { - if (nsForm.getJavaAnnotationValue().equals(javaAnnotationValue)) { - return nsForm; - } - } - return null; - } - - public static String toJavaAnnotationValue(XmlNsForm nsForm) { - return (nsForm == null) ? null : nsForm.getJavaAnnotationValue(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlRegistryAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlRegistryAnnotation.java deleted file mode 100644 index 0ed5752e78..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlRegistryAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlRegistry - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlRegistryAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_REGISTRY; - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlRootElementAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlRootElementAnnotation.java deleted file mode 100644 index b49eebe824..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlRootElementAnnotation.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlRootElement - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlRootElementAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_ROOT_ELEMENT; - - /** - * Corresponds to the 'name' element of the XmlRootElement annotation. - * Return null if the element does not exist in Java. - */ - String getName(); - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - - /** - * Corresponds to the 'name' element of the XmlRootElement annotation. - * Set to null to remove the element. - */ - void setName(String name); - - /** - * Return the {@link TextRange} for the 'name' element. If the element - * does not exist return the {@link TextRange} for the XmlRootElement annotation. - */ - TextRange getNameTextRange(CompilationUnit astRoot); - - /** - * Return whether the specified position touches the 'name' element. - * Return false if the element does not exist. - */ - boolean nameTouches(int pos, CompilationUnit astRoot); - - /** - * Corresponds to the 'namespace' element of the XmlRootElement annotation. - * Return null if the element does not exist in Java. - */ - String getNamespace(); - String NAMESPACE_PROPERTY = "namespace"; //$NON-NLS-1$ - - /** - * Corresponds to the 'namespace' element of the XmlRootElement annotation. - * Set to null to remove the element. - */ - void setNamespace(String namespace); - - /** - * Return the {@link TextRange} for the 'namespace' element. If the element - * does not exist return the {@link TextRange} for the XmlRootElement annotation. - */ - TextRange getNamespaceTextRange(CompilationUnit astRoot); - - /** - * Return whether the specified position touches the 'namespace' element. - * Return false if the element does not exist. - */ - boolean namespaceTouches(int pos, CompilationUnit astRoot); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlSchemaAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlSchemaAnnotation.java deleted file mode 100644 index 6f60a1ef0a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlSchemaAnnotation.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlSchema - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlSchemaAnnotation - extends Annotation { - - String ANNOTATION_NAME = JAXB.XML_SCHEMA; - - /** - * Corresponds to the 'attributeFormDefault' element of the XmlSchema annotation. - * Return null if the element does not exist in Java. - */ - XmlNsForm getAttributeFormDefault(); - String ATTRIBUTE_FORM_DEFAULT_PROPERTY = "attributeFormDefault"; //$NON-NLS-1$ - - /** - * Corresponds to the 'attributeFormDefault' element of the XmlSchema annotation. - * Set to null to remove the element. - */ - void setAttributeFormDefault(XmlNsForm attributeFormDefault); - - /** - * Return the {@link TextRange} for the 'attributeFormDefault' element. If the element - * does not exist return the {@link TextRange} for the XmlSchema annotation. - */ - TextRange getAttributeFormDefaultTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'elementFormDefault' element of the XmlSchema annotation. - * Return null if the element does not exist in Java. - */ - XmlNsForm getElementFormDefault(); - String ELEMENT_FORM_DEFAULT_PROPERTY = "elementFormDefault"; //$NON-NLS-1$ - - /** - * Corresponds to the 'elementFormDefault' element of the XmlSchema annotation. - * Set to null to remove the element. - */ - void setElementFormDefault(XmlNsForm elementFormDefault); - - /** - * Return the {@link TextRange} for the 'elementFormDefault' element. If the element - * does not exist return the {@link TextRange} for the XmlSchema annotation. - */ - TextRange getElementFormDefaultTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'location' element of the XmlSchema annotation. - * Return null if the element does not exist in Java. - */ - String getLocation(); - String LOCATION_PROPERTY = "location"; //$NON-NLS-1$ - - /** - * Corresponds to the 'location' element of the XmlSchema annotation. - * Set to null to remove the element. - */ - void setLocation(String location); - - /** - * Return the {@link TextRange} for the 'location' element. If the element - * does not exist return the {@link TextRange} for the XmlSchema annotation. - */ - TextRange getLocationTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'namespace' element of the XmlSchema annotation. - * Return null if the element does not exist in Java. - */ - String getNamespace(); - String NAMESPACE_PROPERTY = "namespace"; //$NON-NLS-1$ - - /** - * Corresponds to the 'namespace' element of the XmlSchema annotation. - * Set to null to remove the element. - */ - void setNamespace(String namespace); - - /** - * Return the {@link TextRange} for the 'namespace' element. If the element - * does not exist return the {@link TextRange} for the XmlSchema annotation. - */ - TextRange getNamespaceTextRange(CompilationUnit astRoot); - - /** - * Return whether the specified position touches the 'namespace' element. - * Return false if the element does not exist. - */ - boolean namespaceTouches(int pos, CompilationUnit astRoot); - - /** - * Corresponds to the 'xmlns' element of the XmlSchema annotation. - * Return an empty iterator if the element does not exist in Java. - */ - ListIterable getXmlns(); - String XMLNS_LIST = "xmlns"; //$NON-NLS-1$ - - /** - * Corresponds to the 'xmlns' element of the XmlSchema annotation. - */ - int getXmlnsSize(); - - /** - * Corresponds to the 'xmlns' element of the XmlSchema annnotation. - */ - XmlNsAnnotation xmlnsAt(int index); - - /** - * Corresponds to the 'xmlns' element of the XmlSchema annotation. - */ - XmlNsAnnotation addXmlns(int index); - - /** - * Corresponds to the 'xmlns' element of the XmlSchema annotation. - */ - void moveXmlns(int targetIndex, int sourceIndex); - - /** - * Corresponds to the 'xmlns' element of the XmlSchema annotation. - */ - void removeXmlns(int index); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlSchemaTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlSchemaTypeAnnotation.java deleted file mode 100644 index 8b9c76b7a5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlSchemaTypeAnnotation.java +++ /dev/null @@ -1,117 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlSchemaType - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlSchemaTypeAnnotation - extends NestableAnnotation { - - String ANNOTATION_NAME = JAXB.XML_SCHEMA_TYPE; - - /** - * Corresponds to the 'name' element of the XmlSchemaType annotation. - * Return null if the element does not exist in Java. - */ - String getName(); - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - - /** - * Corresponds to the 'name' element of the XmlSchemaType annotation. - * Set to null to remove the element. - */ - void setName(String name); - - /** - * Return the {@link TextRange} for the 'name' element. If the element - * does not exist return the {@link TextRange} for the XmlSchemaType annotation. - */ - TextRange getNameTextRange(CompilationUnit astRoot); - - /** - * Return whether the specified position touches the 'name' element. - * Return false if the element does not exist. - */ - boolean nameTouches(int pos, CompilationUnit astRoot); - - /** - * Corresponds to the 'namespace' element of the XmlSchemaType annotation. - * Return null if the element does not exist in Java. - */ - String getNamespace(); - String NAMESPACE_PROPERTY = "namespace"; //$NON-NLS-1$ - - /** - * Corresponds to the 'namespace' element of the XmlSchemaType annotation. - * Set to null to remove the element. - */ - void setNamespace(String namespace); - - /** - * Return the {@link TextRange} for the 'namespace' element. If the element - * does not exist return the {@link TextRange} for the XmlSchemaType annotation. - */ - TextRange getNamespaceTextRange(CompilationUnit astRoot); - - /** - * Return whether the specified position touches the 'namespace' element. - * Return false if the element does not exist. - */ - boolean namespaceTouches(int pos, CompilationUnit astRoot); - - /** - * Corresponds to the 'type' element of the XmlSchemaType annotation. - * Return null if the element does not exist in Java. - * Return the portion of the value preceding ".class". - *

-	 *     @XmlSchemaType(name="date", type=XMLGregorianCalendar.class)
-	 * 
- * will return "XMLGregorianCalendar" - */ - String getType(); - String TYPE_PROPERTY = "type"; //$NON-NLS-1$ - - /** - * Corresponds to the 'type' element of the XmlSchemaType annotation. - * Set to null to remove the element. - */ - void setType(String type); - /** - * Return the {@link TextRange} for the 'type' element. If the element - * does not exist return the {@link TextRange} for the XmlSchemaType annotation. - */ - TextRange getTypeTextRange(CompilationUnit astRoot); - - /** - * Return the fully-qualified type name as resolved by the AST's bindings. - *
-	 *     @XmlSchemaType(name="date", type=XMLGregorianCalendar.class)
-	 * 
- * will return "javax.xml.datatype.XMLGregorianCalendar" if there is an import for - * javax.xml.datatype.XMLGregorianCalendar. - * @return - */ - String getFullyQualifiedType(); - String FULLY_QUALIFIED_TYPE_PROPERTY = "fullyQualifiedType"; //$NON-NLS-1$ -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlSeeAlsoAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlSeeAlsoAnnotation.java deleted file mode 100644 index 5813758650..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlSeeAlsoAnnotation.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlSeeAlso - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlSeeAlsoAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_SEE_ALSO; - - /** - * Corresponds to the 'value' element of the XmlSeeAlso annotation. - * Return an empty iterator if the element does not exist in Java. - * Return the portion of the value preceding ".class". - *
-	 *     @XmlSeeAlso({Foo.class, Bar.class})
-	 * 
- * will return and iterable containing: "Foo", "Bar" - */ - ListIterable getClasses(); - String CLASSES_LIST = "classes"; //$NON-NLS-1$ - - /** - * Corresponds to the 'value' element of the XmlSeeAlso annotation. - */ - int getClassesSize(); - - /** - * Corresponds to the 'value' element of the XmlSeeAlso annotation. - */ - void addClass(String clazz); - - /** - * Corresponds to the 'value' element of the XmlSeeAlso annotation. - */ - void addClass(int index, String clazz); - - /** - * Corresponds to the 'value' element of the XmlSeeAlso annotation. - */ - void moveClass(int targetIndex, int sourceIndex); - - /** - * Corresponds to the 'value' element of the XmlSeeAlso annotation. - */ - void removeClass(String clazz); - - /** - * Corresponds to the 'value' element of the XmlSeeAlso annotation. - */ - void removeClass(int index); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlTransientAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlTransientAnnotation.java deleted file mode 100644 index 65a62172ff..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlTransientAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlTransient - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlTransientAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_TRANSIENT; - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlTypeAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlTypeAnnotation.java deleted file mode 100644 index 3596982875..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlTypeAnnotation.java +++ /dev/null @@ -1,175 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlType - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlTypeAnnotation - extends Annotation { - - String ANNOTATION_NAME = JAXB.XML_TYPE; - - /** - * Corresponds to the 'factoryClass' element of the XmlType annotation. - * Return null if the element does not exist in Java. - * Return the portion of the value preceding ".class". - *
-	 *     @XmlType(name="USAddressType", factoryClass=USAddressFactory.class)
-	 * 
- * will return "USAddressFactory" - */ - String getFactoryClass(); - String FACTORY_CLASS_PROPERTY = "factoryClass"; //$NON-NLS-1$ - - /** - * Corresponds to the 'factoryClass' element of the XmlType annotation. - * Set to null to remove the element. - */ - void setFactoryClass(String factoryClass); - - /** - * Return the {@link TextRange} for the 'factoryClass' element. If the element - * does not exist return the {@link TextRange} for the XmlType annotation. - */ - TextRange getFactoryClassTextRange(CompilationUnit astRoot); - - /** - * Return the fully-qualified factory class name as resolved by the AST's bindings. - *
-	 *     @XmlType(name="USAddressType", factoryClass=USAddressFactory.class)
-	 * 
- * will return "model.USAddressFactory" if there is an import for model.USAddressFactory. - * @return - */ - String getFullyQualifiedFactoryClassName(); - String FULLY_QUALIFIED_FACTORY_CLASS_NAME_PROPERTY = "fullyQualifiedFactoryClassName"; //$NON-NLS-1$ - - /** - * Corresponds to the 'factoryMethod' element of the XmlType annotation. - * Return null if the element does not exist in Java. - */ - String getFactoryMethod(); - String FACTORY_METHOD_PROPERTY = "factoryMethod"; //$NON-NLS-1$ - - /** - * Corresponds to the 'factoryMethod' element of the XmlType annotation. - * Set to null to remove the element. - */ - void setFactoryMethod(String factoryMethod); - - /** - * Return the {@link TextRange} for the 'factoryMethod' element. If the element - * does not exist return the {@link TextRange} for the XmlType annotation. - */ - TextRange getFactoryMethodTextRange(CompilationUnit astRoot); - - /** - * Corresponds to the 'name' element of the XmlType annotation. - * Return null if the element does not exist in Java. - */ - String getName(); - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - - /** - * Corresponds to the 'name' element of the XmlType annotation. - * Set to null to remove the element. - */ - void setName(String name); - - /** - * Return the {@link TextRange} for the 'name' element. If the element - * does not exist return the {@link TextRange} for the XmlType annotation. - */ - TextRange getNameTextRange(CompilationUnit astRoot); - - /** - * Return whether the specified position touches the 'name' element. - * Return false if the element does not exist. - */ - boolean nameTouches(int pos, CompilationUnit astRoot); - - /** - * Corresponds to the 'namespace' element of the XmlType annotation. - * Return null if the element does not exist in Java. - */ - String getNamespace(); - String NAMESPACE_PROPERTY = "namespace"; //$NON-NLS-1$ - - /** - * Corresponds to the 'namespace' element of the XmlType annotation. - * Set to null to remove the element. - */ - void setNamespace(String namespace); - - /** - * Return the {@link TextRange} for the 'namespace' element. If the element - * does not exist return the {@link TextRange} for the XmlType annotation. - */ - TextRange getNamespaceTextRange(CompilationUnit astRoot); - - /** - * Return whether the specified position touches the 'namespace' element. - * Return false if the element does not exist. - */ - boolean namespaceTouches(int pos, CompilationUnit astRoot); - - /** - * Corresponds to the 'propOrder' element of the XmlType annotation. - * Return an empty iterator if the element does not exist in Java. - */ - ListIterable getPropOrder(); - String PROP_ORDER_LIST = "propOrder"; //$NON-NLS-1$ - - /** - * Corresponds to the 'propOrder' element of the XmlType annotation. - */ - int getPropOrderSize(); - - /** - * Corresponds to the 'propOrder' element of the XmlType annotation. - */ - void addProp(String prop); - - /** - * Corresponds to the 'propOrder' element of the XmlType annotation. - */ - void addProp(int index, String prop); - - /** - * Corresponds to the 'propOrder' element of the XmlType annotation. - */ - void moveProp(int targetIndex, int sourceIndex); - - /** - * Corresponds to the 'propOrder' element of the XmlType annotation. - */ - void removeProp(String prop); - - /** - * Corresponds to the 'propOrder' element of the XmlType annotation. - */ - void removeProp(int index); - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlValueAnnotation.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlValueAnnotation.java deleted file mode 100644 index 74fa320c04..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/resource/java/XmlValueAnnotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.resource.java; - - -/** - * Corresponds to the JAXB annotation - * javax.xml.bind.annotation.XmlValue - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface XmlValueAnnotation - extends Annotation -{ - String ANNOTATION_NAME = JAXB.XML_VALUE; - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdAdapter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdAdapter.java deleted file mode 100644 index 7ad4345bf1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdAdapter.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.xsd; - -import org.eclipse.emf.common.notify.impl.AdapterImpl; - - -public class XsdAdapter - extends AdapterImpl { - - protected XsdAdapter() { - super(); - } - - - @Override - public boolean isAdapterForType(Object type) { - return type == XsdUtil.adapterFactory; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdComplexTypeDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdComplexTypeDefinition.java deleted file mode 100644 index 53b457aa34..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdComplexTypeDefinition.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.xsd; - -import org.eclipse.xsd.XSDComplexTypeDefinition; - - -public class XsdComplexTypeDefinition - extends XsdTypeDefinition { - - XsdComplexTypeDefinition(XSDComplexTypeDefinition xsdComplexTypeDefinition) { - super(xsdComplexTypeDefinition); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdElementDeclaration.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdElementDeclaration.java deleted file mode 100644 index d27229f828..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdElementDeclaration.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.xsd; - -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDTypeDefinition; - - -public class XsdElementDeclaration - extends XsdAdapter { - - protected final XSDElementDeclaration xsdElementDeclaration; - - - XsdElementDeclaration(XSDElementDeclaration xsdElementDeclaration) { - super(); - this.xsdElementDeclaration = xsdElementDeclaration; - } - - - public String getName() { - return this.xsdElementDeclaration.getName(); - } - - public XsdTypeDefinition getType() { - XSDTypeDefinition xsdType = this.xsdElementDeclaration.getTypeDefinition(); - return (xsdType == null) ? null : (XsdTypeDefinition) XsdUtil.getAdapter(xsdType); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdSchema.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdSchema.java deleted file mode 100644 index e8c9e01b53..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdSchema.java +++ /dev/null @@ -1,202 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.xsd; - -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.XSDSimpleTypeDefinition; -import org.eclipse.xsd.XSDTypeDefinition; -import org.eclipse.xsd.util.XSDUtil; - -public class XsdSchema - extends XsdAdapter { - - protected final XSDSchema xsdSchema; - - - - XsdSchema(XSDSchema xsdSchema) { - super(); - this.xsdSchema = xsdSchema; - } - - - public Iterable getNamespaces() { - return new SnapshotCloneIterable(this.xsdSchema.getQNamePrefixToNamespaceMap().values()); - } - - public Iterable getAllTypeDefinitions() { - return new TransformationIterable(getAllXSDTypeDefinitions()) { - @Override - protected XsdTypeDefinition transform(XSDTypeDefinition o) { - return (XsdTypeDefinition) XsdUtil.getAdapter(o); - } - }; - } - - public Iterable getDeclaredTypeDefinitions() { - return new TransformationIterable(getDeclaredXSDTypeDefinitions()) { - @Override - protected XsdTypeDefinition transform(XSDTypeDefinition o) { - return (XsdTypeDefinition) XsdUtil.getAdapter(o); - } - }; - } - - public Iterable getBuiltInTypeDefinitions() { - return new TransformationIterable(getBuiltInXSDTypeDefinitions()) { - @Override - protected XsdTypeDefinition transform(XSDTypeDefinition o) { - return (XsdTypeDefinition) XsdUtil.getAdapter(o); - } - }; - } - - public Iterable getTypeDefinitions(final String namespace) { - return new TransformationIterable(getXSDTypeDefinitions(namespace)) { - @Override - protected XsdTypeDefinition transform(XSDTypeDefinition o) { - return (XsdTypeDefinition) XsdUtil.getAdapter(o); - } - }; - } - - public Iterable getSimpleTypeDefinitions(final String namespace) { - return new TransformationIterable( - getXSDSimpleTypeDefinitions(namespace)) { - @Override - protected XsdSimpleTypeDefinition transform(XSDSimpleTypeDefinition o) { - return (XsdSimpleTypeDefinition) XsdUtil.getAdapter(o); - } - }; - } - - public XsdTypeDefinition getTypeDefinition(String namespace, String name) { - for (XSDTypeDefinition typeDefinition : getXSDTypeDefinitions(namespace)) { - if (typeDefinition.getTargetNamespace().equals(namespace) && typeDefinition.getName().equals(name)) { - return (XsdTypeDefinition) XsdUtil.getAdapter(typeDefinition); - } - } - return null; - } - - protected Iterable getAllXSDTypeDefinitions() { - return new CompositeIterable( - getDeclaredXSDTypeDefinitions(), getBuiltInXSDTypeDefinitions()); - } - - protected Iterable getDeclaredXSDTypeDefinitions() { - return new SnapshotCloneIterable(this.xsdSchema.getTypeDefinitions()); - } - - protected Iterable getBuiltInXSDTypeDefinitions() { - return new SnapshotCloneIterable(this.xsdSchema.getSchemaForSchema().getTypeDefinitions()); - } - - protected Iterable getXSDTypeDefinitions(final String namespace) { - if (XSDUtil.SCHEMA_FOR_SCHEMA_URI_2001.equals(namespace)) { - return getBuiltInXSDTypeDefinitions(); - } - return new FilteringIterable(getDeclaredXSDTypeDefinitions()) { - @Override - protected boolean accept(XSDTypeDefinition o) { - return namespace.equals(o.getTargetNamespace()); - } - }; - } - - protected Iterable getXSDSimpleTypeDefinitions(String namespace) { - return new TransformationIterable( - new FilteringIterable(getXSDTypeDefinitions(namespace)) { - @Override - protected boolean accept(XSDTypeDefinition o) { - return o instanceof XSDSimpleTypeDefinition; - } - }) { - @Override - protected XSDSimpleTypeDefinition transform(XSDTypeDefinition o) { - return (XSDSimpleTypeDefinition) o; - } - }; - } - - public Iterable getElementDeclarations() { - return new TransformationIterable(getXSDElementDeclarations()) { - @Override - protected XsdElementDeclaration transform(XSDElementDeclaration o) { - return (XsdElementDeclaration) XsdUtil.getAdapter(o); - } - }; - } - - public Iterable getElementDeclarations(final String namespace) { - return new TransformationIterable( - new FilteringIterable(getXSDElementDeclarations()) { - @Override - protected boolean accept(XSDElementDeclaration o) { - return o.getTargetNamespace().equals(namespace); - } - }) { - @Override - protected XsdElementDeclaration transform(XSDElementDeclaration o) { - return (XsdElementDeclaration) XsdUtil.getAdapter(o); - } - }; - } - - public XsdElementDeclaration getElementDeclaration(String namespace, String name) { - for (XSDElementDeclaration elementDeclaration : getXSDElementDeclarations()) { - if (elementDeclaration.getTargetNamespace().equals(namespace) && elementDeclaration.getName().equals(name)) { - return (XsdElementDeclaration) XsdUtil.getAdapter(elementDeclaration); - } - } - return null; - } - - protected Iterable getXSDElementDeclarations() { - return new SnapshotCloneIterable(this.xsdSchema.getElementDeclarations()); - } - - public Iterable getNamespaceProposals(Filter filter) { - return StringTools.convertToJavaStringLiterals( - new FilteringIterable(getNamespaces(), filter)); - } - - public Iterable getTypeNameProposals(String namespace, Filter filter) { - return StringTools.convertToJavaStringLiterals( - new FilteringIterable( - new TransformationIterable(this.getTypeDefinitions(namespace)) { - @Override - protected String transform(XsdTypeDefinition o) { - return o.getName(); - } - }, - filter)); - } - - public Iterable getSimpleTypeNameProposals(String namespace, Filter filter) { - return StringTools.convertToJavaStringLiterals( - new FilteringIterable( - new TransformationIterable(this.getSimpleTypeDefinitions(namespace)) { - @Override - protected String transform(XsdSimpleTypeDefinition o) { - return o.getName(); - } - }, - filter)); - } - -} \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdSimpleTypeDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdSimpleTypeDefinition.java deleted file mode 100644 index c50310c85f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdSimpleTypeDefinition.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.xsd; - -import org.eclipse.xsd.XSDSimpleTypeDefinition; - - -public class XsdSimpleTypeDefinition - extends XsdTypeDefinition { - - XsdSimpleTypeDefinition(XSDSimpleTypeDefinition xsdSimpleTypeDefinition) { - super(xsdSimpleTypeDefinition); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdTypeDefinition.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdTypeDefinition.java deleted file mode 100644 index 85d95bbf9b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdTypeDefinition.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.xsd; - -import org.eclipse.xsd.XSDTypeDefinition; - - -public abstract class XsdTypeDefinition - extends XsdAdapter { - - protected final XSDTypeDefinition xsdTypeDefinition; - - - protected XsdTypeDefinition(XSDTypeDefinition xsdTypeDefinition) { - super(); - this.xsdTypeDefinition = xsdTypeDefinition; - } - - - public String getName() { - return this.xsdTypeDefinition.getName(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdUtil.java b/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdUtil.java deleted file mode 100644 index c4882c9b48..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.core/src/org/eclipse/jpt/jaxb/core/xsd/XsdUtil.java +++ /dev/null @@ -1,194 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - * (copied mainly from org.eclipse.wst.xsd.contentmodel.internal.XSDImpl) - * Oracle - extensions and modifications - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.xsd; - -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import org.eclipse.emf.common.notify.Adapter; -import org.eclipse.emf.common.notify.Notifier; -import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl; -import org.eclipse.emf.common.util.URI; -import org.eclipse.emf.ecore.EObject; -import org.eclipse.emf.ecore.resource.ResourceSet; -import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin; -import org.eclipse.wst.xml.core.internal.XMLCorePlugin; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; -import org.eclipse.wst.xsd.contentmodel.internal.util.XSDSchemaLocatorAdapterFactory; -import org.eclipse.xsd.XSDComplexTypeDefinition; -import org.eclipse.xsd.XSDElementDeclaration; -import org.eclipse.xsd.XSDSchema; -import org.eclipse.xsd.XSDSchemaContent; -import org.eclipse.xsd.XSDSimpleTypeDefinition; -import org.eclipse.xsd.impl.XSDImportImpl; -import org.eclipse.xsd.impl.XSDSchemaImpl; -import org.eclipse.xsd.util.XSDConstants; -import org.eclipse.xsd.util.XSDResourceImpl; -import org.eclipse.xsd.util.XSDSwitch; - -/** - * Utility class for building XSD model and its extensions for JAXB - */ -public class XsdUtil { - - static final XsdAdapterFactoryImpl adapterFactory = new XsdAdapterFactoryImpl(); - - public static String getResolvedUri(String namespace, String location) { - String resolvedUri = null; - - ICatalog catalog = XMLCorePlugin.getDefault().getDefaultXMLCatalog(); - - if (! StringTools.stringIsEmpty(location)) { - try { - resolvedUri = catalog.resolveSystem(location); - if (resolvedUri == null) { - resolvedUri = catalog.resolveURI(location); - } - } - catch (MalformedURLException me) { - JptJaxbCorePlugin.log(me); - resolvedUri = null; - } - catch (IOException ie) { - JptJaxbCorePlugin.log(ie); - resolvedUri = null; - } - } - - if (resolvedUri == null && namespace != null) { - if ( ! (location != null && location.endsWith(".xsd"))) { //$NON-NLS-1$ - try { - resolvedUri = catalog.resolvePublic(namespace, location); - if (resolvedUri == null) { - resolvedUri = catalog.resolveURI(namespace); - } - } - catch (MalformedURLException me) { - JptJaxbCorePlugin.log(me); - resolvedUri = null; - } - catch (IOException ie) { - JptJaxbCorePlugin.log(ie); - resolvedUri = null; - } - } - } - - // if resolvedUri is null, assume the location is resolved - return (resolvedUri != null) ? resolvedUri : location; - } - - - /** - * Given uri for an XML Schema document, parse the document and build - * corresponding EMF object. - */ - public static XSDSchema buildXSDModel(String uriString) { - XSDSchema xsdSchema = null; - - try { - // if XML Schema for Schema is requested, get it through schema model - if (uriString.endsWith("2001/XMLSchema.xsd")) { - xsdSchema = XSDSchemaImpl.getSchemaForSchema(XSDConstants.SCHEMA_FOR_SCHEMA_URI_2001); - } - else { - ResourceSet resourceSet = new ResourceSetImpl(); - resourceSet.getAdapterFactories().add(new XSDSchemaLocatorAdapterFactory()); - - URI uri = URI.createURI(uriString); - - // CS : bug 113537 ensure we perform physical resolution before opening a stream for the resource - String physicalLocation = URIResolverPlugin.createResolver().resolvePhysicalLocation("", "", uriString); - InputStream inputStream = resourceSet.getURIConverter().createInputStream(URI.createURI(physicalLocation)); - XSDResourceImpl resource = (XSDResourceImpl)resourceSet.createResource(URI.createURI("*.xsd")); - resource.setURI(uri); - resource.load(inputStream, null); - xsdSchema = resource.getSchema(); - } - handleImports(xsdSchema); - } - catch (Exception e) { - JptJaxbCorePlugin.log(e); - } - return xsdSchema; - } - - private static void handleImports(XSDSchema xsdSchema) { - if (xsdSchema != null) { - for (XSDSchemaContent content : xsdSchema.getContents()) { - if (content instanceof XSDImportImpl) { - XSDImportImpl anImport = (XSDImportImpl) content; - try { - if (anImport.getSchemaLocation() != null) { - anImport.importSchema(); - } - } - catch (Exception e) { - JptJaxbCorePlugin.log(e); - } - } - } - } - } - - public static Object getAdapter(Notifier notifier) { - return adapterFactory.adapt(notifier); - } - - - /** - * The Factory for the XSD adapter model. It provides a create method for each - * non-abstract class of the model. - */ - public static class XsdAdapterFactoryImpl - extends AdapterFactoryImpl { - - @Override - public Adapter createAdapter(Notifier target) { - XSDSwitch xsdSwitch = new XSDSwitch() { - @Override - public Object caseXSDSchema(XSDSchema object) { - return new XsdSchema(object); - } - - @Override - public Object caseXSDSimpleTypeDefinition(XSDSimpleTypeDefinition object) { - return new XsdSimpleTypeDefinition(object); - } - - @Override - public Object caseXSDComplexTypeDefinition(XSDComplexTypeDefinition object) { - return new XsdComplexTypeDefinition(object); - } - - @Override - public Object caseXSDElementDeclaration(XSDElementDeclaration object) { - return new XsdElementDeclaration(object); - } - }; - - Object o = xsdSwitch.doSwitch((EObject) target); - Adapter result = null; - if (o instanceof Adapter) { - result = (Adapter) o; - } - return result; - } - - public Adapter adapt(Notifier target) { - return adapt(target, this); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/.cvsignore b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/.cvsignore deleted file mode 100644 index c14487ceac..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -build.xml diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/.project b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/.project deleted file mode 100644 index d123fb8513..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.eclipse.jpt.jaxb.eclipselink.branding - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/META-INF/MANIFEST.MF deleted file mode 100644 index 0eb6ebdab2..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.jpt.jaxb.eclipselink.branding;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Localization: plugin -Bundle-Vendor: %providerName diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.html b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.html deleted file mode 100644 index ca606b1bb5..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

June 06, 2007

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- - - \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.ini b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.ini deleted file mode 100644 index 7d88b9d396..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.ini +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2009 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=icons/WTP_icon_x32_v2.png - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - -# Property "tipsAndTricksHref" contains the Help topic href to a tips and tricks page -# optional -tipsAndTricksHref=/org.eclipse.jpt.doc.user/tips_and_tricks.htm - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.mappings b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.mappings deleted file mode 100644 index bddaab4310..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.properties deleted file mode 100644 index 99e307d5a3..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/about.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. - -blurb=Dali Java Persistence Tools - JAXB EclipseLink Support\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Oracle contributors and others 2010. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/build.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/build.properties deleted file mode 100644 index d6bd03a94b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/build.properties +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Copyright (c) 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -bin.includes = META-INF/,\ - about.ini,\ - about.html,\ - about.mappings,\ - about.properties,\ - icons/,\ - plugin.properties diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/icons/WTP_icon_x32_v2.png b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/icons/WTP_icon_x32_v2.png deleted file mode 100644 index 6f09c2a700..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/icons/WTP_icon_x32_v2.png and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/plugin.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/plugin.properties deleted file mode 100644 index 6b68e90ef7..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.branding/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools - JAXB EclipseLink Support -providerName = Eclipse Web Tools Platform diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.classpath b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.classpath deleted file mode 100644 index bbf9ced68e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.classpath +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.cvsignore b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.cvsignore deleted file mode 100644 index c5e82d7458..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -bin \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.project b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.project deleted file mode 100644 index a482c34f48..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.jpt.jaxb.eclipselink.core.schemagen - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.settings/org.eclipse.jdt.core.prefs b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 8fb4ff705c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,8 +0,0 @@ -#Tue Apr 13 12:12:27 EDT 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -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/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/META-INF/MANIFEST.MF deleted file mode 100644 index eea3432f5d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/META-INF/MANIFEST.MF +++ /dev/null @@ -1,12 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.jaxb.eclipselink.core.schemagen;singleton:=true -Bundle-Version: 1.1.0.qualifier -Bundle-ClassPath: lib/eclipselink.jar -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Import-Package: javax.xml.bind -Export-Package: org.eclipse.jpt.jaxb.eclipselink.core.schemagen, - org.eclipse.jpt.jaxb.eclipselink.core.schemagen.internal;x-internal:=true diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/about.html b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/about.html deleted file mode 100644 index 071f586b21..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/about.html +++ /dev/null @@ -1,47 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

May 02, 2008

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- -

Third Party Content

-

The Content includes items that have been sourced from third parties as set - out below. If you did not receive this Content directly from the Eclipse Foundation, - the following is provided for informational purposes only, and you should look - to the Redistributor’s license for terms and conditions of use.

- -

Java Persistence API (JPA) v1.0

- -
-

The Java Persistence API (JPA) which is distributed under CDDL - v1.0 is required by the Dali Java Persistence Tools Project in order - to support this standard.

-
- - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/build.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/build.properties deleted file mode 100644 index a3ffe71f6c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/build.properties +++ /dev/null @@ -1,20 +0,0 @@ -############################################################################### -# Copyright (c) 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -javacSource=1.5 -javacTarget=1.5 -source.. = src/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - lib/eclipselink.jar,\ - about.html,\ - plugin.properties -jars.compile.order = . diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/lib/eclipselink-src.zip b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/lib/eclipselink-src.zip deleted file mode 100644 index 68a5393d4f..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/lib/eclipselink-src.zip and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/lib/eclipselink.jar b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/lib/eclipselink.jar deleted file mode 100644 index 855e644c5e..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/lib/eclipselink.jar and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/plugin.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/plugin.properties deleted file mode 100644 index c05741163a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/plugin.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License 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 = Dali Java Persistence Tools - EclipseLink JAXB Support - Schema Generation -providerName = Eclipse Web Tools Platform diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/Main.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/Main.java deleted file mode 100644 index 0ae05f139f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/Main.java +++ /dev/null @@ -1,290 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.eclipselink.core.schemagen; - -import java.io.File; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; - -import javax.xml.bind.JAXBException; -import javax.xml.bind.SchemaOutputResolver; -import javax.xml.transform.Result; -import javax.xml.transform.stream.StreamResult; - -import org.eclipse.jpt.jaxb.eclipselink.core.schemagen.internal.JptEclipseLinkJaxbCoreMessages; -import org.eclipse.jpt.jaxb.eclipselink.core.schemagen.internal.Tools; -import org.eclipse.persistence.jaxb.JAXBContext; -import org.eclipse.persistence.jaxb.JAXBContextFactory; - -/** - * Generate a EclipseLink JAXB Schema - * - * Current command-line arguments: - * [-s schema.xsd] - specifies the target schema - * [-c className] - specifies the fully qualified class name - */ -public class Main -{ - private String[] sourceClassNames; - private String targetSchemaName; - @SuppressWarnings("unused") - private boolean isDebugMode; - - static public String NO_FACTORY_CLASS = "doesnt contain ObjectFactory.class"; //$NON-NLS-1$ - static public String CANNOT_BE_CAST_TO_JAXBCONTEXT = "cannot be cast to org.eclipse.persistence.jaxb.JAXBContext"; //$NON-NLS-1$ - - // ********** static methods ********** - - public static void main(String[] args) { - new Main().execute(args); - } - - // ********** constructors ********** - - private Main() { - super(); - } - - // ********** behavior ********** - - protected void execute(String[] args) { - - this.initializeWith(args); - - this.generate(); - } - - // ********** internal methods ********** - - private void initializeWith(String[] args) { - this.sourceClassNames = this.getSourceClassNames(args); - this.targetSchemaName = this.getTargetSchemaName(args); - - this.isDebugMode = this.getDebugMode(args); - } - - private void generate() { - // Create the JAXBContext - JAXBContext jaxbContext = this.buildJaxbContext(); - - // Generate an XML Schema - if(jaxbContext != null) { - this.generateSchema(jaxbContext); - } - else { - Tools.bind(JptEclipseLinkJaxbCoreMessages.SCHEMA_NOT_CREATED, this.targetSchemaName); - } - } - - private JAXBContext buildJaxbContext() { - System.out.println(Tools.getString(JptEclipseLinkJaxbCoreMessages.LOADING_CLASSES)); - JAXBContext jaxbContext = null; - try { - ClassLoader loader = Thread.currentThread().getContextClassLoader(); - - Class[] sourceClasses = this.buildSourceClasses(this.sourceClassNames, loader); - - //call MOXy JAXBContextFactory directly. This eliminates the need to have the JAXB properties file in place - //in time for the generation. - jaxbContext = (JAXBContext)JAXBContextFactory.createContext(sourceClasses, Collections.emptyMap()); - } - catch (JAXBException ex) { - this.handleJaxbException(ex); - } - catch (ClassCastException ex) { - this.handleClassCastException(ex); - } - return jaxbContext; - } - - private void generateSchema(JAXBContext jaxbContext) { - System.out.println(Tools.getString(JptEclipseLinkJaxbCoreMessages.GENERATING_SCHEMA)); - System.out.flush(); - - SchemaOutputResolver schemaOutputResolver = - new JptSchemaOutputResolver(this.targetSchemaName); - - try { - jaxbContext.generateSchema(schemaOutputResolver); - } - catch(Exception e) { - e.printStackTrace(); - } - } - - private Class[] buildSourceClasses(String[] classNames, ClassLoader loader) { - - ArrayList sourceClasses = new ArrayList(classNames.length); - for(String className: classNames) { - try { - sourceClasses.add(loader.loadClass(className)); - System.out.println(className); - } - catch (ClassNotFoundException e) { - System.err.println(Tools.bind(JptEclipseLinkJaxbCoreMessages.NOT_FOUND, className)); - } - } - System.out.flush(); - return sourceClasses.toArray(new Class[0]); - } - - private void handleJaxbException(JAXBException ex) { - String message = ex.getMessage(); - Throwable linkedEx = ex.getLinkedException(); - if(message != null && message.indexOf(NO_FACTORY_CLASS) > -1) { - System.err.println(message); - } - else if(linkedEx != null && linkedEx instanceof ClassNotFoundException) { - String errorMessage = Tools.bind( - JptEclipseLinkJaxbCoreMessages.CONTEXT_FACTORY_NOT_FOUND, linkedEx.getMessage()); - System.err.println(errorMessage); - } - else { - ex.printStackTrace(); - } - } - - private void handleClassCastException(ClassCastException ex) { - String message = ex.getMessage(); - if(message != null && message.indexOf(CANNOT_BE_CAST_TO_JAXBCONTEXT) > -1) { - System.err.println(Tools.getString(JptEclipseLinkJaxbCoreMessages.PROPERTIES_FILE_NOT_FOUND)); - } - else { - ex.printStackTrace(); - } - } - - // ********** argument queries ********** - - private String[] getSourceClassNames(String[] args) { - - return this.getAllArgumentValues("-c", args); //$NON-NLS-1$ - } - - private String getTargetSchemaName(String[] args) { - - return this.getArgumentValue("-s", args); //$NON-NLS-1$ - } - - private boolean getDebugMode(String[] args) { - - return this.argumentExists("-debug", args); //$NON-NLS-1$ - } - - // ********** private methods ********** - - private String getArgumentValue(String argName, String[] args) { - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.toLowerCase().equals(argName)) { - int j = i + 1; - if (j < args.length) { - return args[j]; - } - } - } - return null; - } - - private String[] getAllArgumentValues(String argName, String[] args) { - List argValues = new ArrayList(); - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.toLowerCase().equals(argName)) { - int j = i + 1; - if (j < args.length) { - argValues.add(args[j]); - i++; - } - } - } - return argValues.toArray(new String[0]); - } - - private boolean argumentExists(String argName, String[] args) { - for (int i = 0; i < args.length; i++) { - String arg = args[i]; - if (arg.toLowerCase().equals(argName)) { - return true; - } - } - return false; - } - -} - -// ********** inner class ********** - -class JptSchemaOutputResolver extends SchemaOutputResolver { - - private String defaultSchemaName; - - // ********** constructor ********** - - protected JptSchemaOutputResolver(String defaultSchemaName) { - this.defaultSchemaName = defaultSchemaName; - } - - // ********** overrides ********** - - @Override - public Result createOutput(String namespaceURI, String suggestedFileName) throws IOException { - - String filePath = (Tools.stringIsEmpty(namespaceURI)) ? - this.buildFileNameFrom(this.defaultSchemaName, suggestedFileName) : - this.modifyFileName(namespaceURI); - - File file = new File(filePath); - StreamResult result = new StreamResult(file); - result.setSystemId(file.toURI().toURL().toString()); - - System.out.print(Tools.bind(JptEclipseLinkJaxbCoreMessages.SCHEMA_GENERATED, file)); - return result; - } - - // ********** private methods ********** - - private String buildFileNameFrom(String fileName, String suggestedFileName) { - - fileName = Tools.stripExtension(fileName); - - if(Tools.stringIsEmpty(fileName)) { - return suggestedFileName; - } - String number = Tools.extractFileNumber(suggestedFileName); - - fileName = this.buildFileName(fileName, number); - return Tools.appendXsdExtension(fileName); - } - - private String buildFileName(String fileName, String number) { - - if(Tools.stringIsEmpty(number)) { - return fileName; - } - return (number.equals("0")) ? fileName : fileName + number; //$NON-NLS-1$ - } - - private String modifyFileName(String namespaceURI) throws IOException { - - String dir = Tools.extractDirectory(this.defaultSchemaName); - - String fileName = Tools.stripProtocol(namespaceURI); - fileName = fileName.replaceAll("/", "_"); //$NON-NLS-1$ - fileName = Tools.appendXsdExtension(fileName); - - String result = (Tools.stringIsEmpty(dir)) ? fileName : dir + File.separator + fileName; - - return result; - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/JptEclipseLinkJaxbCoreMessages.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/JptEclipseLinkJaxbCoreMessages.java deleted file mode 100644 index 65a9e2eee8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/JptEclipseLinkJaxbCoreMessages.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.eclipselink.core.schemagen.internal; - -import java.util.MissingResourceException; -import java.util.ResourceBundle; - -/** - * Localized messages used by Dali EclipseLink JAXB core. - */ -public class JptEclipseLinkJaxbCoreMessages -{ - public static final String LOADING_CLASSES = "LOADING_CLASSES"; - public static final String GENERATING_SCHEMA = "GENERATING_SCHEMA"; - public static final String SCHEMA_GENERATED = "SCHEMA_GENERATED"; - public static final String SCHEMA_NOT_CREATED = "SCHEMA_NOT_CREATED"; - public static final String NOT_FOUND = "NOT_FOUND"; - public static final String CONTEXT_FACTORY_NOT_FOUND = "CONTEXT_FACTORY_NOT_FOUND"; - public static final String PROPERTIES_FILE_NOT_FOUND = "PROPERTIES_FILE_NOT_FOUND"; - - - private static final String BUNDLE_NAME = "org.eclipse.jpt.jaxb.eclipselink.core.schemagen.internal.jpt_eclipselink_jaxb_core"; //$NON-NLS-1$ - private static final ResourceBundle RESOURCE_BUNDLE = ResourceBundle.getBundle(BUNDLE_NAME); - - private JptEclipseLinkJaxbCoreMessages() { - } - - public static String getString(String key) { - try { - return RESOURCE_BUNDLE.getString(key); - } - catch (MissingResourceException e) { - return '!' + key + '!'; - } - } -} \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/Tools.java b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/Tools.java deleted file mode 100644 index 5a32e4c09c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/Tools.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.eclipselink.core.schemagen.internal; - -import java.io.File; -import java.text.MessageFormat; - -/** - * Tools - */ -public final class Tools -{ - /** default file name used by the schemagen */ - static public String GEN_DEFAULT_NAME = "schema"; //$NON-NLS-1$ - - /** empty string */ - public static final String EMPTY_STRING = ""; //$NON-NLS-1$ - - // ********** queries ********** - - /** - * Return whether the specified string is null, empty, or contains - * only whitespace characters. - */ - public static boolean stringIsEmpty(String string) { - if (string == null) { - return true; - } - int len = string.length(); - if (len == 0) { - return true; - } - return stringIsEmpty_(string.toCharArray(), len); - } - - private static boolean stringIsEmpty_(char[] s, int len) { - for (int i = len; i-- > 0; ) { - if ( ! Character.isWhitespace(s[i])) { - return false; - } - } - return true; - } - - // ********** short name manipulation ********** - - /** - * Strip the extension from the specified file name - * and return the result. If the file name has no - * extension, it is returned unchanged - * File#basePath() - */ - public static String stripExtension(String fileName) { - int index = fileName.lastIndexOf('.'); - if (index == -1) { - return fileName; - } - return fileName.substring(0, index); - } - - public static String stripProtocol(String uri) { - - return uri.replaceFirst("http://", EMPTY_STRING); - } - - - public static String appendXsdExtension(String name) { - - return name + ".xsd"; //$NON-NLS-1$ - } - - public static String extractFileNumber(String fileName) { - - String result = stripExtension(fileName); - if(Tools.stringIsEmpty(result)) { - return EMPTY_STRING; - } - return result.replaceFirst(GEN_DEFAULT_NAME, EMPTY_STRING); - } - - public static String extractDirectory(String path) { - if( ! path.contains(File.separator)) { - return EMPTY_STRING; - } - return path.substring(0, path.lastIndexOf(File.separator)); - } - - // ********** NLS utilities ********** - - public static String getString(String key) { - return JptEclipseLinkJaxbCoreMessages.getString(key); - } - - public static String bind(String key, Object argument) { - return MessageFormat.format(getString(key), argument); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/jpt_eclipselink_jaxb_core.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/jpt_eclipselink_jaxb_core.properties deleted file mode 100644 index a9f76617fa..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.eclipselink.core.schemagen/src/org/eclipse/jpt/jaxb/eclipselink/core/schemagen/internal/jpt_eclipselink_jaxb_core.properties +++ /dev/null @@ -1,21 +0,0 @@ -################################################################################ -# Copyright (c) 2010 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ - -LOADING_CLASSES = loading... -GENERATING_SCHEMA = \nMOXy generating schema... -SCHEMA_GENERATED = \nSchema {0} generated -SCHEMA_NOT_CREATED = \nSchema {0} not created -NOT_FOUND = \n\tNot found: {0} -PROPERTIES_FILE_NOT_FOUND = \nEclipseLink JAXBContextFactory must be specified in the jaxb.properties file to use EclipseLink MOXy for schema generation.\n\ -javax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory -CONTEXT_FACTORY_NOT_FOUND = \nThe JAXBContextFactory {0} \n\ -specified in the jaxb.properties file could not be located on the project classpath. \n\ -The JAXB provider that defines this factory should be added to the project classpath, \n\ -or the jaxb.properties file should be removed to use the default provider. diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.classpath b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.classpath deleted file mode 100644 index 5ee7c76127..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.classpath +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.cvsignore b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.cvsignore deleted file mode 100644 index a196dd7686..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.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/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.project b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.project deleted file mode 100644 index 67371280df..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.jpt.jaxb.ui - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.settings/org.eclipse.jdt.core.prefs b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 7a34f4bbcf..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,7 +0,0 @@ -#Mon Feb 08 18:48:37 EST 2010 -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/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF deleted file mode 100644 index af73ce27df..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/META-INF/MANIFEST.MF +++ /dev/null @@ -1,50 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.jaxb.ui;singleton:=true -Bundle-Version: 1.1.0.qualifier -Bundle-Activator: org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin -Bundle-ActivationPolicy: lazy -Bundle-ClassPath: . -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.debug.core;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jdt.ui;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jface.text;bundle-version="[3.7.0,4.0.0)", - org.eclipse.jpt.common.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.ui;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)", - org.eclipse.jpt.jaxb.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)", - org.eclipse.jst.common.project.facet.ui;bundle-version="[1.4.200,2.0.0)", - org.eclipse.ui.ide;bundle-version="[3.4.0,4.0.0)", - org.eclipse.ui.navigator;bundle-version="[3.5.0,4.0.0)", - org.eclipse.wst.common.frameworks.ui;bundle-version="[1.2.0,2.0.0)", - org.eclipse.wst.common.modulecore;bundle-version="[1.2.100,2.0.0)", - org.eclipse.wst.common.project.facet.ui;bundle-version="[1.4.200,2.0.0)", - org.eclipse.wst.common.ui;bundle-version="[1.1.500,2.0.0)", - org.eclipse.wst.common.uriresolver;bundle-version="[1.1.401,2.0.0)", - org.eclipse.wst.web.ui;bundle-version="[1.1.400,2.0.0)", - org.eclipse.wst.xml.core;bundle-version="[1.1.500,2.0.0)", - org.eclipse.wst.xsd.core;bundle-version="[1.1.600,2.0.0)", - org.eclipse.xsd;bundle-version="[2.6.0,3.0.0)" -Export-Package: org.eclipse.jpt.jaxb.ui, - org.eclipse.jpt.jaxb.ui.internal;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.actions;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.filters;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.jaxb21;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.jaxb22;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.navigator;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.platform;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.properties;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.wizards;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.wizards.facet;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.wizards.proj;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.wizards.proj.model;x-internal:=true, - org.eclipse.jpt.jaxb.ui.internal.wizards.schemagen;x-internal:=true, - org.eclipse.jpt.jaxb.ui.navigator, - org.eclipse.jpt.jaxb.ui.platform -Import-Package: com.ibm.icu.text;version="4.0.1" diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/about.html b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/about.html deleted file mode 100644 index be534ba44f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/about.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

May 02, 2008

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/build.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/build.properties deleted file mode 100644 index 6eca01337e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/build.properties +++ /dev/null @@ -1,23 +0,0 @@ -################################################################################ -# Copyright (c) 2010 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ -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 = . -src.includes = schema/ - \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/component.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/component.xml deleted file mode 100644 index 04957fe9b2..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/component.xml +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/NewXSD.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/NewXSD.gif deleted file mode 100644 index b6efdd3d86..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/NewXSD.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/jaxb_facet.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/jaxb_facet.gif deleted file mode 100644 index e75a17c2d0..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/jaxb_facet.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/new_jaxb_project_wiz.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/new_jaxb_project_wiz.gif deleted file mode 100644 index b547717598..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/new_jaxb_project_wiz.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/newclass_wiz.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/newclass_wiz.gif deleted file mode 100644 index a1c6545cd6..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/etool16/newclass_wiz.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/XSDFile.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/XSDFile.gif deleted file mode 100644 index cc0eeb7196..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/XSDFile.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/dtdfile.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/dtdfile.gif deleted file mode 100644 index 3c0acadd2d..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/dtdfile.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/enum_constant.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/enum_constant.gif deleted file mode 100644 index d4cb4254d9..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/enum_constant.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/jaxb_content.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/jaxb_content.gif deleted file mode 100644 index e75a17c2d0..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/jaxb_content.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/null-attribute-mapping.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/null-attribute-mapping.gif deleted file mode 100644 index 70a9c23541..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/null-attribute-mapping.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/package.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/package.gif deleted file mode 100644 index 131c28da40..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/package.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_class.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_class.gif deleted file mode 100644 index e4c2a836f8..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_class.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_enum.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_enum.gif deleted file mode 100644 index 15535f52f5..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_enum.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_field.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_field.gif deleted file mode 100644 index d4cb4254d9..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_field.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_property.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_property.gif deleted file mode 100644 index 7d24707ee8..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/persistent_property.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/text.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/text.gif deleted file mode 100644 index efa7a38014..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/text.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-attribute.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-attribute.gif deleted file mode 100644 index a547d743e7..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-attribute.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-element.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-element.gif deleted file mode 100644 index c2ae66497a..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-element.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-transient.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-transient.gif deleted file mode 100644 index cc5d83db20..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-transient.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-value.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-value.gif deleted file mode 100644 index c2ae66497a..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/obj16/xml-value.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/ovr16/error_ovr.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/ovr16/error_ovr.gif deleted file mode 100644 index 119dcccd5a..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/ovr16/error_ovr.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/NewXSD.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/NewXSD.gif deleted file mode 100644 index 390f48216a..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/NewXSD.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/new_jaxb_prj_wiz.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/new_jaxb_prj_wiz.gif deleted file mode 100644 index d1873a1a51..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/new_jaxb_prj_wiz.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/newclass_wiz.gif b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/newclass_wiz.gif deleted file mode 100644 index 0ac0ee8635..0000000000 Binary files a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/icons/full/wizban/newclass_wiz.gif and /dev/null differ diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.properties deleted file mode 100644 index 704b484070..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.properties +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################### -# Copyright (c) 2010, 2011 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### - -# ==================================================================== -# 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= Dali Java Persistence Tools - JAXB UI -providerName=Eclipse Web Tools Platform - -jaxbPlatformUi = JAXB Platform UI - -jaxbWizardCategoryName = JAXB - -generateSchemaFromClassesName = Schema from JAXB Classes -generateSchemaFromClassesDesc = Generate a Schema from JAXB classes - -generateClassesFromSchemaName = JAXB Classes from Schema -generateClassesFromSchemaDesc = Generate JAXB Classes from a Schema - -newJaxbProjectWizardName = JAXB Project -newJaxbProjectWizardDesc = Create a JAXB project - -jaxbCompletionProposals = JAXB Proposals -jaxbCompletionProposalComputer = JAXB Proposal Computer - -jaxbNavigatorContent=JAXB Content -generateJaxbClasses = JAXB Classes... - -jaxbNode = JAXB -jaxbSchemas = Schemas diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml deleted file mode 100644 index 01e1c1522f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/plugin.xml +++ /dev/null @@ -1,303 +0,0 @@ - - - - - - - - - - - - - - %generateSchemaFromClassesDesc - - - - - %generateClassesFromSchemaDesc - - - - - %newJaxbProjectWizardDesc - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties deleted file mode 100644 index 73b7773f0c..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/property_files/jpt_jaxb_ui.properties +++ /dev/null @@ -1,167 +0,0 @@ -################################################################################ -# Copyright (c) 2010 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ - -JavaProjectWizardPage_project = Project: -JavaProjectWizardPage_destinationProject = Select destination project: - -# ClassesGenerator -ClassesGeneratorProjectWizardPage_title = Java Project -ClassesGeneratorProjectWizardPage_desc = Specify project for the new classes. - -ClassesGeneratorWizard_title = New JAXB Classes from schema - -ClassesGeneratorWizard_errorDialogTitle = Generate Classes Failed -ClassesGeneratorWizard_couldNotCreate = Could not create {0} - -JaxbContent_label=JAXB Content - -SchemasPage_description = Configure JAXB schemas used for validation and user-assist -SchemasPage_revert = &Revert -SchemasPage_schemas = &Schema namespaces and locations: -SchemasPage_namespaceColumnLabel = Namespace -SchemasPage_locationColumnLabel = Location -SchemasPage_addButtonLabel = &Add ... -SchemasPage_editButtonLabel = &Edit ... -SchemasPage_removeButtonLabel = Re&move -SchemasPage_addSchemaMessage = Enter a new schema namespace and the location where it can be found. -SchemasPage_editSchemaMessage = Edit an existing schema namespace and the location where it can be found. -SchemasPage_addSchemaDialogTitle = Add Schema Location -SchemasPage_editSchemaDialogTitle = Edit Schema Location -SchemasPage_addSchemaTitle = Add a new schema location -SchemasPage_editSchemaTitle = Edit an existing schema location -SchemasPage_locationLabel = &Location: -SchemasPage_browseButtonLabel = &Browse ... -SchemasPage_namespaceLabel = &Namespace: -SchemasPage_noNamespaceText = -SchemasPage_schemaUnresolvedMessage = Could not resolve chosen schema location. -SchemasPage_duplicateNamespaceMessage = That namespace is already in use. -SchemasPage_noLocationMessage = You must specify a location. -SchemasPage_chooseLocationTitle = Select Schema Location - -SchemaWizardPage_title = Select Schema -SchemaWizardPage_desc = Specify schema to generate the classes from - -SchemaWizardPage_xmlCatalogTableTitle = XML Catalog -SchemaWizardPage_xmlCatalogKeyColumn = Key -SchemaWizardPage_xmlCatalogUriColumn = URI - -SchemaWizardPage_errorUriCannotBeLocated = The selected catalog entry specifies a URI that can not be located. - -ClassesGeneratorWizardPage_title = Generate Classes from Schema: {0} -ClassesGeneratorWizardPage_desc = Configure JAXB class generation. - -ClassesGeneratorWizardPage_usesMoxyImplementation = Use EclipseLink MOXy as the JAXB implementation - -ClassesGeneratorWizardPage_catalog = Catalog: -ClassesGeneratorWizardPage_bindingsFiles = Bindings files: -ClassesGeneratorWizardPage_browseButton = Browse... -ClassesGeneratorWizardPage_addButton = Add... -ClassesGeneratorWizardPage_removeButton = Remove -ClassesGeneratorWizardPage_chooseABindingsFile = External Bindings File Selection -ClassesGeneratorWizardPage_chooseACatalog = Catalog File Selection - -ClassesGeneratorWizardPage_sourceFolderSelectionDialog_title = Source Folder Selection -ClassesGeneratorWizardPage_chooseSourceFolderDialog_desc = &Choose a source folder: - -ClassesGeneratorWizardPage_jaxbLibrariesNotAvailable = \ - The classpath for this project does not appear to contain the necessary libraries to proceed with class generation.\ - \nPlease insure that a JAXB implementation is available on the classpath. - -ClassesGeneratorWizardPage_moxyLibrariesNotAvailable = \ - The classpath for this project does not appear to contain the necessary libraries to proceed with class generation.\ - \nPlease insure that EclipseLink MOXy is available on the classpath. - -ClassesGeneratorOptionsWizardPage_title = Classes Generator Options -ClassesGeneratorOptionsWizardPage_desc = Configure JAXB compiler options. - -ClassesGeneratorOptionsWizardPage_proxyGroup = Proxy -ClassesGeneratorOptionsWizardPage_noProxy = No proxy -ClassesGeneratorOptionsWizardPage_proxy = Proxy: -ClassesGeneratorOptionsWizardPage_proxyFile = Proxy file: -ClassesGeneratorOptionsWizardPage_chooseAProxyFile = Proxy File Selection - -ClassesGeneratorOptionsWizardPage_useStrictValidation = Use strict validation -ClassesGeneratorOptionsWizardPage_makeReadOnly = Generate read-only files -ClassesGeneratorOptionsWizardPage_suppressPackageInfoGen = Suppress package-info generation -ClassesGeneratorOptionsWizardPage_suppressesHeaderGen = Suppress generation of file header -ClassesGeneratorOptionsWizardPage_target = Target XJC 2.0 -ClassesGeneratorOptionsWizardPage_verbose = Verbose -ClassesGeneratorOptionsWizardPage_quiet = Suppress compiler output - -ClassesGeneratorOptionsWizardPage_treatsAsXmlSchema = Treat input as XML schema -ClassesGeneratorOptionsWizardPage_treatsAsRelaxNg = Treat input as RELAX NG -ClassesGeneratorOptionsWizardPage_treatsAsRelaxNgCompact = Treat input as RELAX NG compact syntax -ClassesGeneratorOptionsWizardPage_treatsAsDtd = Treat input as XML DTD -ClassesGeneratorOptionsWizardPage_treatsAsWsdl = Treat input as WSDL and compile schema inside it -ClassesGeneratorOptionsWizardPage_showsVersion = Show version -ClassesGeneratorOptionsWizardPage_showsHelp = Show help - -ClassesGeneratorExtensionOptionsWizardPage_title = Classes Generator Extension Configuration -ClassesGeneratorExtensionOptionsWizardPage_desc = Configure JAXB compiler vendor extensions. - -ClassesGeneratorExtensionOptionsWizardPage_allowExtensions = Allow vendor extensions -ClassesGeneratorExtensionOptionsWizardPage_classpath = Classpath: -ClassesGeneratorExtensionOptionsWizardPage_additionalArguments = Additional arguments: - -ClassesGeneratorUi_generatingEntities = Generating JAXB Classes from Schema -ClassesGeneratorUi_generatingEntitiesTask = Generating classes - -ClassesGeneratorUi_generatingClassesWarningTitle = Generating JAXB Classes -ClassesGeneratorUi_generatingClassesWarningMessage = \ - Warning: Generating classes will overwrite existing files in your project.\ - \n\nAre you sure you want to continue? - -# SchemaGenerator -SchemaGeneratorWizard_title = New JAXB Schema File - -SchemaGeneratorWizard_generatingSchema = Generating JAXB Schema - -SchemaGeneratorProjectWizardPage_title = JAXB schema file -SchemaGeneratorProjectWizardPage_desc = Specify default file name and location - -SchemaGeneratorWizardPage_title = Generate Schema from Classes -SchemaGeneratorWizardPage_desc = Select classes to include. - -SchemaGeneratorWizardPage_shemaLocation = Schema file: -SchemaGeneratorWizardPage_shema = Schema name: -SchemaGeneratorWizardPage_packages = Select classes to include in schema: -SchemaGeneratorWizardPage_browse = Browse... - -SchemaGeneratorWizardPage_chooseSchemaDialogTitle = Select Schema File - -SchemaGeneratorWizardPage_errorNoSchema = Schema name cannot be empty -SchemaGeneratorWizardPage_errorNoPackage = No classes included - -SchemaGeneratorWizardPage_jaxbLibrariesNotAvailable = \ - The classpath for this project does not appear to contain the necessary libraries to proceed with schema generation.\ - \nPlease insure that a JAXB implementation is available on the classpath. - -SchemaGeneratorWizardPage_moxyLibrariesNotAvailable = \ - The classpath for this project does not appear to contain the necessary libraries to proceed with schema generation.\ - \nPlease insure that EclipseLink MOXy is available on the classpath. - -SchemaGeneratorWizard_generateSchemaTask = Generating schema {0} - -#NewSchemaFileWizardPage - -NewSchemaFileWizardPage_errorNotJavaProject = Not a Java project -NewSchemaFileWizardPage_overwriteExistingSchemas = Schema generation may overwrite existing schemas in the specified directory. - - -JaxbProjectWizard_title = New JAXB Project - -JaxbProjectWizard_firstPage_title = JAXB Project -JaxbProjectWizard_firstPage_desc = Configure JAXB project settings. - -JaxbFacetWizardPage_title = JAXB Facet -JaxbFacetWizardPage_desc = Configure JAXB settings. -JaxbFacetWizardPage_platformLabel = &Platform -JaxbFacetWizardPage_facetsPageLink = Change JAXB version ... -JaxbFacetWizardPage_jaxbImplementationLabel = JAXB implementation diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/schema/jaxbPlatformUis.exsd b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/schema/jaxbPlatformUis.exsd deleted file mode 100644 index dc152bc93b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/schema/jaxbPlatformUis.exsd +++ /dev/null @@ -1,139 +0,0 @@ - - - - - - - - - [Enter description of this extension point.] - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Extenders of the org.eclipse.jpt.jaxb.core.jaxbPlatforms extension point may also use this point to insert UI into the workbench for that platform. The jaxbPlatform must match the id of a jaxbPlatform extension. - - - - - - - - - - - - - - The jaxbPlatform must match a corresponding org.eclipse.jpt.jaxb.core.jaxbPlatform extension id. - - - - - - - The instantiable class that implements <samp>org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi</samp>. - - - - - - - - - - - - - - - 3.0 - - - - - - - - - [Enter extension point usage example here.] - - - - - - - - - Provisional API: This interface is part of an interim API that is still -under development and expected to change significantly before reaching -stability. It is available at this early stage to solicit feedback from -pioneering adopters on the understanding that any code that uses this API -will almost certainly be broken (repeatedly) as the API evolves. - - - - - - - - - [Enter information about supplied implementation of this extension point.] - - - - - - - - - Copyright (c) 2010 Oracle. All rights reserved. -This program and the accompanying materials are made available under the -terms of the Eclipse Public License v1.0, which accompanies this distribution -and is available at http://www.eclipse.org/legal/epl-v10.html. - -Contributors: -Oracle - initial API and implementation - - - - diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java deleted file mode 100644 index 709d829083..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/JptJaxbUiPlugin.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.resource.ImageRegistry; -import org.eclipse.jpt.jaxb.ui.internal.platform.JaxbPlatformUiManagerImpl; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUiManager; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.plugin.AbstractUIPlugin; -import org.eclipse.wst.xml.core.internal.XMLCorePlugin; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; - -/** - * The activator class controls the plug-in life cycle - * - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -@SuppressWarnings("nls") -public class JptJaxbUiPlugin extends AbstractUIPlugin -{ - // The plug-in ID - public static final String PLUGIN_ID = "org.eclipse.jpt.jaxb.ui"; - - public static final String USER_CATALOG_ID = XMLCorePlugin.USER_CATALOG_ID; //$NON-NLS-1$ - public static final String DEFAULT_CATALOG_ID = XMLCorePlugin.DEFAULT_CATALOG_ID; //$NON-NLS-1$ - public static final String SYSTEM_CATALOG_ID = XMLCorePlugin.SYSTEM_CATALOG_ID; //$NON-NLS-1$ - - // ********** singleton ********** - private static JptJaxbUiPlugin INSTANCE; - - /** - * Returns the singleton Plugin - */ - public static JptJaxbUiPlugin instance() { - return INSTANCE; - } - - public static void log(IStatus status) { - INSTANCE.getLog().log(status); - } - - public static void log(String msg) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null)); - } - - public static void log(Throwable throwable) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable)); - } - - // ********** Image API ********** - /** - * This gets a .gif from the icons folder. - */ - public static ImageDescriptor getImageDescriptor(String key) { - if (! key.startsWith("icons/")) { - key = "icons/" + key; - } - if (! key.endsWith(".gif")) { - key = key + ".gif"; - } - return imageDescriptorFromPlugin(PLUGIN_ID, key); - } - - /** - * This returns an image for a .gif from the icons folder - */ - //TODO we are using the ImageRegistry here and storing all our icons for the life of the plugin, - //which means until the workspace is closed. This is better than before where we constantly - //created new images. Bug 306437 is about cleaning this up and using Local Resource Managers - //on our views so that closing the JPA perspective would mean our icons are disposed. - public static Image getImage(String key) { - ImageRegistry imageRegistry = instance().getImageRegistry(); - Image image = imageRegistry.get(key); - if (image == null) { - imageRegistry.put(key, getImageDescriptor(key)); - image = imageRegistry.get(key); - } - return image; - } - - - public static JaxbPlatformUiManager getJaxbPlatformUiManager() { - return JaxbPlatformUiManagerImpl.instance(); - } - - - // ********** XMLCorePlugin API ********** - - public ICatalog getDefaultXMLCatalog() { - return XMLCorePlugin.getDefault().getDefaultXMLCatalog(); - } - - // ********** constructors ********** - public JptJaxbUiPlugin() { - super(); - if (INSTANCE != null) { - throw new IllegalStateException(); - } - INSTANCE = this; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java deleted file mode 100644 index c6db6cfd70..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/ClassesGeneratorUi.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.WorkspaceJob; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.window.Window; -import org.eclipse.jface.wizard.WizardDialog; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGeneratorExtensionOptions; -import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGeneratorOptions; -import org.eclipse.jpt.jaxb.core.internal.gen.GenerateJaxbClassesJob; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen.ClassesGeneratorWizard; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Shell; - -/** - * ClassesGeneratorUi - */ -public class ClassesGeneratorUi { - private final IJavaProject javaProject; - private final String schemaPathOrUri; - - // ********** static methods ********** - - public static void generate(IFile xsdFile) { - IJavaProject javaProject = JavaCore.create(xsdFile.getProject()); - if (javaProject == null) { - throw new NullPointerException(); - } - IPath xmlSchema = xsdFile.getProjectRelativePath(); - - new ClassesGeneratorUi(javaProject, xmlSchema.toOSString()).generate(); - } - - // ********** constructors ********** - private ClassesGeneratorUi(IJavaProject javaProject, String schemaPathOrUri) { - super(); - if(javaProject == null || StringTools.stringIsEmpty(schemaPathOrUri)) { - throw new NullPointerException(); - } - this.javaProject = javaProject; - this.schemaPathOrUri = schemaPathOrUri; - } - - // ********** generate ********** - /** - * prompt the user with a wizard - */ - protected void generate() { - ClassesGeneratorWizard wizard = new ClassesGeneratorWizard(this.javaProject, this.schemaPathOrUri); - wizard.setWindowTitle(JptJaxbUiMessages.ClassesGeneratorWizard_title); - WizardDialog dialog = new WizardDialog(this.getCurrentShell(), wizard); - dialog.create(); - int returnCode = dialog.open(); - if (returnCode != Window.OK) { - return; - } - String outputDir = wizard.getDestinationFolder(); - String targetPackage = wizard.getTargetPackage(); - String catalog = wizard.getCatalog(); - boolean usesMoxy = wizard.usesMoxy(); - String[] bindingsFileNames = wizard.getBindingsFileNames(); - ClassesGeneratorOptions generatorOptions = wizard.getGeneratorOptions(); - ClassesGeneratorExtensionOptions generatorExtensionOptions = wizard.getGeneratorExtensionOptions(); - - if(this.displayOverridingClassesWarning(generatorOptions)) { - this.generateJaxbClasses(outputDir, targetPackage, catalog, usesMoxy, bindingsFileNames, generatorOptions, generatorExtensionOptions); - } - } - - // ********** internal methods ********** - - private void generateJaxbClasses( - String outputDir, - String targetPackage, - String catalog, - boolean usesMoxyGenerator, - String[] bindingsFileNames, - ClassesGeneratorOptions generatorOptions, - ClassesGeneratorExtensionOptions generatorExtensionOptions) { - - try { - WorkspaceJob job = new GenerateJaxbClassesJob( - this.javaProject, - this.schemaPathOrUri, - outputDir, - targetPackage, - catalog, - usesMoxyGenerator, - bindingsFileNames, - generatorOptions, - generatorExtensionOptions); - job.schedule(); - } - catch(RuntimeException re) { - JptJaxbUiPlugin.log(re); - - String msg = re.getMessage(); - String message = (msg == null) ? re.toString() : msg; - this.logError(message); - } - } - - private void logError(String message) { - this.displayError(message); - } - - private void displayError(String message) { - MessageDialog.openError( - this.getShell(), - JptJaxbUiMessages.ClassesGeneratorWizard_errorDialogTitle, - message - ); - } - - private Shell getShell() { - Display display = Display.getCurrent(); - Shell shell = (display == null) ? null : display.getActiveShell(); - if(shell == null && display != null) { - Shell[] shells = display.getShells(); - if(shells.length > 0) - shell = shells[0]; - } - return shell; - } - - private boolean isOverridingClasses(ClassesGeneratorOptions generatorOptions) { - if(generatorOptions == null) { - throw new NullPointerException(); - } - if(generatorOptions.showsVersion() || generatorOptions.showsHelp()) { - return false; - } - return true; - } - - private boolean displayOverridingClassesWarning(ClassesGeneratorOptions generatorOptions) { - - if( ! this.isOverridingClasses(generatorOptions)) { - return true; - } - return MessageDialog.openQuestion( - this.getCurrentShell(), - JptJaxbUiMessages.ClassesGeneratorUi_generatingClassesWarningTitle, - JptJaxbUiMessages.ClassesGeneratorUi_generatingClassesWarningMessage); - } - - private Shell getCurrentShell() { - return Display.getCurrent().getActiveShell(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java deleted file mode 100644 index 9a8fb04f8e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbJavaCompletionProposalComputer.java +++ /dev/null @@ -1,185 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jdt.core.CompletionContext; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.core.dom.CompilationUnit; -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.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.internal.utility.PlatformTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.context.java.JavaContextNode; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; - - -public class JaxbJavaCompletionProposalComputer - implements IJavaCompletionProposalComputer { - - public JaxbJavaCompletionProposalComputer() { - super(); - } - - - public void sessionStarted() { - // do nothing - } - - @SuppressWarnings("unchecked") - public List computeCompletionProposals(ContentAssistInvocationContext context, IProgressMonitor monitor) { - return (context instanceof JavaContentAssistInvocationContext) ? - computeCompletionProposals((JavaContentAssistInvocationContext) context) - : Collections.emptyList(); - } - - /** - * We fail silently here because (it seems) expected exceptions occur - * more frequently than intermittent unexpected exceptions that might - * merit investigation (and a logged stacktrace might be the only hint as - * to what happened). - *

- * We will get an expected exception (typically a {@link NullPointerException NPE}) - * here if the user:

    - *
  1. modifies the Java source file in a way that puts it drastically out - * of sync with the Dali context model (e.g. deleting a field or - * annotation) - *
  2. immediately invokes Content Assist (typically Ctrl+Space) - *
- * The AST we build here will be based on the just-modified Java source; but, - * since the user moved quickly and we will not have yet received any Java - * change notification (since we only get a Java change notification when - * the user has paused typing for at least 0.5 seconds), the context model - * will still be based on the unmodified Java source. As the new AST is - * passed down through the context model to the resource model all the code - * expects to find the AST in sync with the model. When this is not the - * case (e.g. a field in the resource model is no longer present in the AST - * because the user has deleted it or modified the code in such a way that - * the parser can no longer detect the field) the model will probably choke - * when it cannot find the corresponding AST node. - *

- * It seems reasonable, in these situations, to simply return no completion - * proposals. If the user simply waits a moment and tries again, we will be - * able to successfully calculate some proposals. - *

- * ~bjv - */ - private List computeCompletionProposals(JavaContentAssistInvocationContext context) { - try { - return computeCompletionProposals_(context); - } - catch (Exception ex) { - // JptJaxbCorePlugin.log(ex); // don't log "expected" exceptions (?) - return Collections.emptyList(); - } - } - - private List computeCompletionProposals_(JavaContentAssistInvocationContext context) { - ICompilationUnit cu = context.getCompilationUnit(); - IFile file = (cu != null) ? getCorrespondingResource(cu) : null; - IContentType contentType = (file != null) ? PlatformTools.getContentType(file) : null; - - if (contentType == null || ! contentType.isKindOf(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) { - return Collections.emptyList(); - } - - JaxbProject jaxbProject = JptJaxbCorePlugin.getJaxbProject(file.getProject()); - if (jaxbProject == null) { - return Collections.emptyList(); - } - - Iterable javaNodes = jaxbProject.getPrimaryJavaNodes(cu); - if (CollectionTools.isEmpty(javaNodes)) { - return Collections.emptyList(); - } - - 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 filter = ((prefix == null) ? Filter.Null.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(); - if (tokenStart == -1) { // not sure why this happens - see bug 242286 - return Collections.emptyList(); - } - -// System.out.println("prefix: " + ((prefix == null) ? "[null]" : new String(prefix))); -// System.out.println("token start: " + tokenStart); -// System.out.println("token end: " + tokenEnd); -// String source = cu.getSource(); -// String token = source.substring(Math.max(0, tokenStart), Math.min(source.length(), 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 + "<="); - - // TODO move this parser call into the model... - CompilationUnit astRoot = ASTTools.buildASTRoot(cu); - List proposals = new ArrayList(); - for (JavaContextNode javaNode : javaNodes) { - for (String proposal : javaNode.getJavaCompletionProposals(context.getInvocationOffset(), filter, astRoot)) { - proposals.add(new CompletionProposal(proposal, tokenStart, tokenEnd - tokenStart + 1, proposal.length())); - } - } - return proposals; - } - - private IFile getCorrespondingResource(ICompilationUnit cu) { - try { - return (IFile) cu.getCorrespondingResource(); - } catch (JavaModelException ex) { - JptJaxbUiPlugin.log(ex); - return null; - } - } - - @SuppressWarnings("unchecked") - public List computeContextInformation(ContentAssistInvocationContext context, IProgressMonitor monitor) { - return Collections.emptyList(); - } - - public String getErrorMessage() { - return null; - } - - public void sessionEnded() { - // do nothing - } - - private static class IgnoreCasePrefixFilter implements Filter { - private final char[] prefix; - IgnoreCasePrefixFilter(char[] prefix) { - super(); - this.prefix = prefix; - } - public boolean accept(String s) { - return StringTools.stringStartsWithIgnoreCase(s.toCharArray(), this.prefix); - } - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbMappingImageHelper.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbMappingImageHelper.java deleted file mode 100644 index a9139a4ade..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JaxbMappingImageHelper.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal; - -import org.eclipse.jpt.jaxb.core.MappingKeys; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.swt.graphics.Image; - -public class JaxbMappingImageHelper -{ -// -// public static Image imageForTypeMapping(String mappingKey) { -// return JptUiPlugin.getImage(iconKeyForTypeMapping(mappingKey)); -// } -// -// public static String iconKeyForTypeMapping(String mappingKey) { -// if (MappingKeys.NULL_TYPE_MAPPING_KEY == mappingKey) { -// return JptUiIcons.NULL_TYPE_MAPPING; -// } -// else if (MappingKeys.ENTITY_TYPE_MAPPING_KEY.equals(mappingKey)) { -// return JptUiIcons.ENTITY; -// } -// else if (MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY.equals(mappingKey)) { -// return JptUiIcons.EMBEDDABLE; -// } -// else if (MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY.equals(mappingKey)) { -// return JptUiIcons.MAPPED_SUPERCLASS; -// } -// return null; -// } - - public static Image imageForAttributeMapping(String mappingKey) { - return JptJaxbUiPlugin.getImage(iconKeyForAttributeMapping(mappingKey)); - } - - public static String iconKeyForAttributeMapping(String mappingKey) { - if (MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY == mappingKey) { - return JptJaxbUiIcons.NULL_ATTRIBUTE_MAPPING; - } - else if (MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) { - return JptJaxbUiIcons.XML_ATTRIBUTE; - } - else if (MappingKeys.XML_ELEMENT_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) { - return JptJaxbUiIcons.XML_ELEMENT; - } - else if (MappingKeys.XML_TRANSIENT_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) { - return JptJaxbUiIcons.XML_TRANSIENT; - } - else if (MappingKeys.XML_VALUE_ATTRIBUTE_MAPPING_KEY.equals(mappingKey)) { - return JptJaxbUiIcons.XML_VALUE; - } - //return the JAXB_CONTENT icon instead of null, might as well have an icon if one is not defined - return JptJaxbUiIcons.JAXB_CONTENT; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiIcons.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiIcons.java deleted file mode 100644 index 870a50f559..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiIcons.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal; - -@SuppressWarnings("nls") -public class JptJaxbUiIcons -{ - // **************** General icons ************************************** - - public static final String JAXB_CONTENT = "full/obj16/jaxb_content"; - public static final String PACKAGE = "full/obj16/package"; - public static final String PERSISTENT_CLASS = "full/obj16/persistent_class"; - public static final String PERSISTENT_ENUM = "full/obj16/persistent_enum"; - public static final String PERSISTENT_FIELD = "full/obj16/persistent_field"; - public static final String PERSISTENT_PROPERTY = "full/obj16/persistent_property"; - public static final String ENUM_CONSTANT = "full/obj16/enum_constant"; - - public static final String SCHEMA_GEN = "full/wizban/NewXSD"; - - // **************** Wizard icons ******************************************* - - public static final String SCHEMA_GEN_WIZ_BANNER = "full/wizban/NewXSD"; - public static final String CLASSES_GEN_WIZ_BANNER = "full/wizban/newclass_wiz"; - public static final String JAXB_WIZ_BANNER = "full/wizban/new_jaxb_prj_wiz"; - - - public static final String XML_ATTRIBUTE = "full/obj16/xml-attribute"; - public static final String XML_ELEMENT = "full/obj16/xml-element"; - public static final String XML_TRANSIENT = "full/obj16/xml-transient"; - public static final String XML_VALUE = "full/obj16/xml-value"; - public static final String NULL_ATTRIBUTE_MAPPING = "full/obj16/null-attribute-mapping"; - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java deleted file mode 100644 index 753b671958..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/JptJaxbUiMessages.java +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * Localized messages used by Dali JAXB UI. - * - * @version 2.3 - */ -public class JptJaxbUiMessages { - - public static String JavaProjectWizardPage_project; - public static String JavaProjectWizardPage_destinationProject; - - // ClassesGenerator - public static String ClassesGeneratorProjectWizardPage_title; - public static String ClassesGeneratorProjectWizardPage_desc; - - public static String ClassesGeneratorWizard_title; - public static String ClassesGeneratorWizard_errorDialogTitle; - public static String ClassesGeneratorWizard_couldNotCreate; - - public static String JaxbContent_label; - - public static String SchemasPage_description; - public static String SchemasPage_revert; - public static String SchemasPage_schemas; - public static String SchemasPage_namespaceColumnLabel; - public static String SchemasPage_locationColumnLabel; - public static String SchemasPage_addButtonLabel; - public static String SchemasPage_editButtonLabel; - public static String SchemasPage_removeButtonLabel; - public static String SchemasPage_addSchemaMessage; - public static String SchemasPage_editSchemaMessage; - public static String SchemasPage_addSchemaDialogTitle; - public static String SchemasPage_editSchemaDialogTitle; - public static String SchemasPage_addSchemaTitle; - public static String SchemasPage_editSchemaTitle; - public static String SchemasPage_locationLabel; - public static String SchemasPage_browseButtonLabel; - public static String SchemasPage_namespaceLabel; - public static String SchemasPage_noNamespaceText; - public static String SchemasPage_schemaUnresolvedMessage; - public static String SchemasPage_duplicateNamespaceMessage; - public static String SchemasPage_noLocationMessage; - public static String SchemasPage_chooseLocationTitle; - - public static String SchemaWizardPage_title; - public static String SchemaWizardPage_desc; - - public static String SchemaWizardPage_xmlCatalogTableTitle; - public static String SchemaWizardPage_xmlCatalogKeyColumn; - public static String SchemaWizardPage_xmlCatalogUriColumn; - - public static String SchemaWizardPage_errorUriCannotBeLocated; - - - public static String ClassesGeneratorWizardPage_title; - public static String ClassesGeneratorWizardPage_desc; - - public static String ClassesGeneratorWizardPage_usesMoxyImplementation; - - public static String ClassesGeneratorWizardPage_catalog; - public static String ClassesGeneratorWizardPage_bindingsFiles; - public static String ClassesGeneratorWizardPage_browseButton; - public static String ClassesGeneratorWizardPage_addButton; - public static String ClassesGeneratorWizardPage_removeButton; - public static String ClassesGeneratorWizardPage_chooseABindingsFile; - public static String ClassesGeneratorWizardPage_chooseACatalog; - - public static String ClassesGeneratorWizardPage_sourceFolderSelectionDialog_title; - public static String ClassesGeneratorWizardPage_chooseSourceFolderDialog_desc; - - public static String ClassesGeneratorWizardPage_jaxbLibrariesNotAvailable; - public static String ClassesGeneratorWizardPage_moxyLibrariesNotAvailable; - - public static String ClassesGeneratorOptionsWizardPage_title; - public static String ClassesGeneratorOptionsWizardPage_desc; - - public static String ClassesGeneratorOptionsWizardPage_proxyGroup; - public static String ClassesGeneratorOptionsWizardPage_noProxy; - public static String ClassesGeneratorOptionsWizardPage_proxy; - public static String ClassesGeneratorOptionsWizardPage_proxyFile; - public static String ClassesGeneratorOptionsWizardPage_chooseAProxyFile; - - public static String ClassesGeneratorOptionsWizardPage_useStrictValidation; - public static String ClassesGeneratorOptionsWizardPage_makeReadOnly; - public static String ClassesGeneratorOptionsWizardPage_suppressPackageInfoGen; - public static String ClassesGeneratorOptionsWizardPage_suppressesHeaderGen; - public static String ClassesGeneratorOptionsWizardPage_target; - public static String ClassesGeneratorOptionsWizardPage_verbose; - public static String ClassesGeneratorOptionsWizardPage_quiet; - - public static String ClassesGeneratorOptionsWizardPage_treatsAsXmlSchema; - public static String ClassesGeneratorOptionsWizardPage_treatsAsRelaxNg; - public static String ClassesGeneratorOptionsWizardPage_treatsAsRelaxNgCompact; - public static String ClassesGeneratorOptionsWizardPage_treatsAsDtd; - public static String ClassesGeneratorOptionsWizardPage_treatsAsWsdl; - public static String ClassesGeneratorOptionsWizardPage_showsVersion; - public static String ClassesGeneratorOptionsWizardPage_showsHelp; - - public static String ClassesGeneratorExtensionOptionsWizardPage_title; - public static String ClassesGeneratorExtensionOptionsWizardPage_desc; - - public static String ClassesGeneratorExtensionOptionsWizardPage_allowExtensions; - public static String ClassesGeneratorExtensionOptionsWizardPage_classpath; - public static String ClassesGeneratorExtensionOptionsWizardPage_additionalArguments; - - public static String ClassesGeneratorUi_generatingEntities; - public static String ClassesGeneratorUi_generatingEntitiesTask; - - public static String ClassesGeneratorUi_generatingClassesWarningTitle; - public static String ClassesGeneratorUi_generatingClassesWarningMessage; - - // SchemaGenerator - public static String SchemaGeneratorWizard_title; - public static String SchemaGeneratorWizard_generatingSchema; - - public static String SchemaGeneratorProjectWizardPage_title; - public static String SchemaGeneratorProjectWizardPage_desc; - - public static String SchemaGeneratorWizardPage_title; - public static String SchemaGeneratorWizardPage_desc; - - public static String SchemaGeneratorWizardPage_shemaLocation; - public static String SchemaGeneratorWizardPage_shema; - public static String SchemaGeneratorWizardPage_packages; - public static String SchemaGeneratorWizardPage_browse; - - public static String SchemaGeneratorWizardPage_chooseSchemaDialogTitle; - - public static String SchemaGeneratorWizardPage_errorNoSchema; - public static String SchemaGeneratorWizardPage_errorNoPackage; - - public static String SchemaGeneratorWizardPage_jaxbLibrariesNotAvailable; - - public static String SchemaGeneratorWizardPage_moxyLibrariesNotAvailable; - - public static String SchemaGeneratorWizard_generateSchemaTask; - - public static String NewSchemaFileWizardPage_errorNotJavaProject; - public static String NewSchemaFileWizardPage_overwriteExistingSchemas; - - - // new project wizard - - public static String JaxbProjectWizard_title; - - public static String JaxbProjectWizard_firstPage_title; - public static String JaxbProjectWizard_firstPage_desc; - - - // facet page - - public static String JaxbFacetWizardPage_title; - public static String JaxbFacetWizardPage_desc; - public static String JaxbFacetWizardPage_platformLabel; - public static String JaxbFacetWizardPage_facetsPageLink; - public static String JaxbFacetWizardPage_jaxbImplementationLabel; - - - private static final String BUNDLE_NAME = "jpt_jaxb_ui"; //$NON-NLS-1$ - private static final Class BUNDLE_CLASS = JptJaxbUiMessages.class; - static { - NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS); - } - - private JptJaxbUiMessages() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/GenerateClassesAction.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/GenerateClassesAction.java deleted file mode 100644 index 526fd69580..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/GenerateClassesAction.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.actions; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jpt.jaxb.ui.internal.ClassesGeneratorUi; - -/** - * GenerateClassesAction - */ -public class GenerateClassesAction extends ObjectAction -{ - - @Override - protected void execute(IFile xsdFile) { - - ClassesGeneratorUi.generate(xsdFile); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/ObjectAction.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/ObjectAction.java deleted file mode 100644 index 652d75ac58..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/actions/ObjectAction.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.actions; - -import java.util.Iterator; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.action.IAction; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ITreeSelection; -import org.eclipse.ui.IObjectActionDelegate; -import org.eclipse.ui.IWorkbenchPart; -import org.eclipse.ui.actions.ActionDelegate; - -/** - * GenerateEntitiesAction - */ -public abstract class ObjectAction extends ActionDelegate implements IObjectActionDelegate -{ - private ISelection currentSelection; - - public ObjectAction() { - super(); - } - - public void setActivePart(IAction action, IWorkbenchPart targetPart) { - // do nothing - } - - @Override - public void selectionChanged(IAction action, ISelection selection) { - this.currentSelection = selection; - } - - @Override - public void run(IAction action) { - if (this.currentSelection instanceof ITreeSelection) { - for (Iterator stream = ((ITreeSelection) this.currentSelection).iterator(); stream.hasNext(); ) { - this.execute(stream.next()); - } - } - } - - protected void execute(Object selection) { - - if(selection instanceof IFile) { - this.execute((IFile)selection); - } - } - - @SuppressWarnings("unused") - protected void execute(IFile file) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/ContainerFilter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/ContainerFilter.java deleted file mode 100644 index 5572e0b5fa..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/ContainerFilter.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.filters; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -/** - * Filters out all containers i.e. all packages and folders - */ -public class ContainerFilter extends ViewerFilter { - - @Override - public boolean select(Viewer viewer, Object parent, Object element) { - boolean isContainer = element instanceof IContainer; - - if( ! isContainer && element instanceof IJavaElement) { - int type= ((IJavaElement)element).getElementType(); - isContainer = (type == IJavaElement.JAVA_MODEL - || type == IJavaElement.JAVA_PROJECT - || type == IJavaElement.PACKAGE_FRAGMENT - || type ==IJavaElement.PACKAGE_FRAGMENT_ROOT); - } - return ! isContainer; - } - - @Override - public String toString() { - return "Filter out Containers"; //$NON-NLS-1$ - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/EmptyInnerPackageFilter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/EmptyInnerPackageFilter.java deleted file mode 100644 index e89609ec7a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/EmptyInnerPackageFilter.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2005 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 - * Code originate from org.eclipse.jdt.internal.ui.filters - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.filters; - - -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.JavaModelException; - - -/** - * Filters empty non-leaf package fragments - */ -public class EmptyInnerPackageFilter extends ViewerFilter { - - /* - * @see ViewerFilter - */ - public boolean select(Viewer viewer, Object parent, Object element) { - if (element instanceof IPackageFragment) { - IPackageFragment pkg= (IPackageFragment)element; - try { - if (pkg.isDefaultPackage()) - return pkg.hasChildren(); - return !pkg.hasSubpackages() || pkg.hasChildren() || (pkg.getNonJavaResources().length > 0); - } catch (JavaModelException e) { - return false; - } - } - - return true; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonArchiveOrExternalElementFilter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonArchiveOrExternalElementFilter.java deleted file mode 100644 index 9ae95f8b9b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonArchiveOrExternalElementFilter.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -* -* Code originate from XXXX -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.filters; - -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -/** - * NonArchiveOrExternalElementFilter - */ -public class NonArchiveOrExternalElementFilter extends ViewerFilter { - - @Override - public boolean select(Viewer viewer, Object parent, Object element) { - if(element instanceof IPackageFragmentRoot) { - IPackageFragmentRoot root= (IPackageFragmentRoot) element; - return !root.isArchive() && !root.isExternal(); - } - return true; - } - - @Override - public String toString() { - return "Filter out: Non-Archive and Non-External"; //$NON-NLS-1$ - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonContainerFilter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonContainerFilter.java deleted file mode 100644 index 8fd6e6ac82..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonContainerFilter.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.filters; - -import org.eclipse.core.resources.IContainer; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -/** - * Filters out all non Container and all JavaProject - * with name not equals to the given projectName. - */ -public class NonContainerFilter extends ViewerFilter -{ - final private String projectName; - - public NonContainerFilter(String projectName) { - this.projectName = projectName; - } - - @Override - public boolean select(Viewer viewer, Object parent, Object element) { - boolean isContainer = element instanceof IContainer; - int type; - if( ! isContainer && element instanceof IJavaElement) { - type = ((IJavaElement)element).getElementType(); - isContainer = (type == IJavaElement.JAVA_MODEL - || type == IJavaElement.JAVA_PROJECT - || type == IJavaElement.PACKAGE_FRAGMENT - || type ==IJavaElement.PACKAGE_FRAGMENT_ROOT); - } - if(isContainer && (element instanceof IJavaElement)) { - type = ((IJavaElement)element).getElementType(); - if(type == IJavaElement.JAVA_PROJECT) { - String projectName = ((IJavaProject)element).getElementName(); - return projectName.equals(this.projectName); - } - } - return isContainer; - } - - @Override - public String toString() { - return "Filter out Non-Containers"; //$NON-NLS-1$ - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonJavaElementFilter.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonJavaElementFilter.java deleted file mode 100644 index 0c1a6949bd..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/filters/NonJavaElementFilter.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 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 - * Code originate from org.eclipse.jdt.internal.ui.filters - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.filters; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IStorage; - -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; - -import org.eclipse.jdt.core.IJavaElement; - - -/** - * Filters out all non-Java elements, and elements named package-info - */ -public class NonJavaElementFilter extends ViewerFilter { - - static public String FILE_TO_EXCLUDE = "package-info.java"; //$NON-NLS-1$ - - /* (non-Javadoc) - * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) - */ - public boolean select(Viewer viewer, Object parent, Object element) { - if (element instanceof IJavaElement) { - return(FILE_TO_EXCLUDE.equals(((IJavaElement)element).getElementName())) ? - false : true; - } - - if (element instanceof IResource) { - IProject project= ((IResource)element).getProject(); - return project == null || !project.isOpen(); - } - - // Exclude all IStorage elements which are neither Java elements nor resources - if (element instanceof IStorage) - return false; - - return true; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.java deleted file mode 100644 index f943f3db3a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorItemLabelProviderFactory.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.ItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.ItemLabelProviderFactory; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbEnumConstant; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentField; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentProperty; -import org.eclipse.jpt.jaxb.core.context.JaxbType; - - -public class GenericJaxb_2_1_NavigatorItemLabelProviderFactory - implements ItemLabelProviderFactory { - - private static GenericJaxb_2_1_NavigatorItemLabelProviderFactory INSTANCE; - - - public static GenericJaxb_2_1_NavigatorItemLabelProviderFactory instance() { - if (INSTANCE == null) { - INSTANCE = new GenericJaxb_2_1_NavigatorItemLabelProviderFactory(); - } - return INSTANCE; - } - - - private GenericJaxb_2_1_NavigatorItemLabelProviderFactory() { - super(); - } - - - public ItemLabelProvider buildItemLabelProvider( - Object item, - DelegatingContentAndLabelProvider contentAndLabelProvider) { - - if (item instanceof JaxbContextRoot) { - return new JaxbContextRootItemLabelProvider((JaxbContextRoot) item, contentAndLabelProvider); - } - else if (item instanceof JaxbPackage) { - return new JaxbPackageItemLabelProvider((JaxbPackage) item, contentAndLabelProvider); - } - else if (item instanceof JaxbPersistentEnum) { - return new JaxbPersistentEnumItemLabelProvider((JaxbPersistentEnum) item, contentAndLabelProvider); - } - else if (item instanceof JaxbType) { - return new JaxbTypeItemLabelProvider((JaxbType) item, contentAndLabelProvider); - } - else if (item instanceof JaxbPersistentField) { - return new JaxbPersistentFieldItemLabelProvider((JaxbPersistentField) item, contentAndLabelProvider); - } - else if (item instanceof JaxbPersistentProperty) { - return new JaxbPersistentPropertyItemLabelProvider((JaxbPersistentProperty) item, contentAndLabelProvider); - } - else if (item instanceof JaxbEnumConstant) { - return new JaxbEnumConstantItemLabelProvider((JaxbEnumConstant) item, contentAndLabelProvider); - } - return null; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory.java deleted file mode 100644 index 2b053849fb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProvider; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProviderFactory; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; -import org.eclipse.jpt.jaxb.core.context.JaxbRegistry; - - -public class GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory - implements TreeItemContentProviderFactory { - - private static GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory INSTANCE; - - - public static GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory instance() { - if (INSTANCE == null) { - INSTANCE = new GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory(); - } - return INSTANCE; - } - - - private GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory() { - super(); - } - - - public TreeItemContentProvider buildItemContentProvider( - Object item, - DelegatingContentAndLabelProvider contentAndLabelProvider) { - - DelegatingTreeContentAndLabelProvider treeContentAndLabelProvider = - (DelegatingTreeContentAndLabelProvider) contentAndLabelProvider; - - if (item instanceof JaxbContextRoot) { - return new JaxbContextRootItemContentProvider((JaxbContextRoot) item, treeContentAndLabelProvider); - } - else if (item instanceof JaxbPackage) { - return new JaxbPackageItemContentProvider((JaxbPackage) item, treeContentAndLabelProvider); - } - else if (item instanceof JaxbPersistentClass) { - return new JaxbPersistentClassItemContentProvider((JaxbPersistentClass) item, treeContentAndLabelProvider); - } - else if (item instanceof JaxbPersistentEnum) { - return new JaxbPersistentEnumItemContentProvider((JaxbPersistentEnum) item, treeContentAndLabelProvider); - } - else if (item instanceof JaxbRegistry) { - return new JaxbRegistryItemContentProvider((JaxbRegistry) item, treeContentAndLabelProvider); - } - return null; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorUi.java deleted file mode 100644 index 10da002510..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_NavigatorUi.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.jpt.common.ui.jface.ItemLabelProviderFactory; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProviderFactory; -import org.eclipse.jpt.jaxb.ui.navigator.JaxbNavigatorUi; - - -public class GenericJaxb_2_1_NavigatorUi - implements JaxbNavigatorUi { - - private static GenericJaxb_2_1_NavigatorUi INSTANCE; - - - public static GenericJaxb_2_1_NavigatorUi instance() { - if (INSTANCE == null) { - INSTANCE = new GenericJaxb_2_1_NavigatorUi(); - } - return INSTANCE; - } - - - private GenericJaxb_2_1_NavigatorUi() { - super(); - } - - - public TreeItemContentProviderFactory getTreeItemContentProviderFactory() { - return GenericJaxb_2_1_NavigatorTreeItemContentProviderFactory.instance(); - } - - public ItemLabelProviderFactory getItemLabelProviderFactory() { - return GenericJaxb_2_1_NavigatorItemLabelProviderFactory.instance(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_PlatformUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_PlatformUi.java deleted file mode 100644 index 9336abc359..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/GenericJaxb_2_1_PlatformUi.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.jpt.jaxb.ui.navigator.JaxbNavigatorUi; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; - - -public class GenericJaxb_2_1_PlatformUi - implements JaxbPlatformUi { - - public JaxbNavigatorUi getNavigatorUi() { - return GenericJaxb_2_1_NavigatorUi.instance(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbContextRootItemContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbContextRootItemContentProvider.java deleted file mode 100644 index 4f6a013de8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbContextRootItemContentProvider.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jpt.common.ui.internal.jface.AbstractTreeItemContentProvider; -import org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; - - -public class JaxbContextRootItemContentProvider - extends AbstractTreeItemContentProvider { - - public JaxbContextRootItemContentProvider( - JaxbContextRoot rootContext, DelegatingTreeContentAndLabelProvider contentProvider) { - super(rootContext, contentProvider); - } - - - @Override - public JaxbContextRoot getModel() { - return (JaxbContextRoot) super.getModel(); - } - - @Override - public IProject getParent() { - return getModel().getJaxbProject().getProject(); - } - - @Override - protected CollectionValueModel buildChildrenModel() { - return new CollectionAspectAdapter( - JaxbContextRoot.PACKAGES_COLLECTION, - getModel()) { - - @Override - protected Iterable getIterable() { - return this.subject.getPackages(); - } - }; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbContextRootItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbContextRootItemLabelProvider.java deleted file mode 100644 index 8b6f394555..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbContextRootItemLabelProvider.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.swt.graphics.Image; - - -public class JaxbContextRootItemLabelProvider - extends AbstractItemLabelProvider { - - public JaxbContextRootItemLabelProvider( - JaxbContextRoot rootContextNode, DelegatingContentAndLabelProvider labelProvider) { - - super(rootContextNode, labelProvider); - } - - - @Override - public JaxbContextRoot model() { - return (JaxbContextRoot) super.model(); - } - - @Override - protected PropertyValueModel buildImageModel() { - return new StaticPropertyValueModel(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.JAXB_CONTENT)); - } - - @Override - protected PropertyValueModel buildTextModel() { - return new StaticPropertyValueModel(JptJaxbUiMessages.JaxbContent_label); - } - - @Override - protected PropertyValueModel buildDescriptionModel() { - return new StaticPropertyValueModel( - JptJaxbUiMessages.JaxbContent_label - + " - " + model().getResource().getFullPath().makeRelative()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbEnumConstantItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbEnumConstantItemLabelProvider.java deleted file mode 100644 index 5163dae4ce..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbEnumConstantItemLabelProvider.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbEnumConstant; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.swt.graphics.Image; - - -public class JaxbEnumConstantItemLabelProvider - extends AbstractItemLabelProvider { - - public JaxbEnumConstantItemLabelProvider( - JaxbEnumConstant jaxbEnumConstant, DelegatingContentAndLabelProvider labelProvider) { - - super(jaxbEnumConstant, labelProvider); - } - - - @Override - public JaxbEnumConstant model() { - return (JaxbEnumConstant) super.model(); - } - - @Override - protected PropertyValueModel buildImageModel() { - return new StaticPropertyValueModel(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.ENUM_CONSTANT)); - } - - @Override - protected PropertyValueModel buildTextModel() { - return new StaticPropertyValueModel(model().getName()); - } - - @Override - protected PropertyValueModel buildDescriptionModel() { - return new StaticPropertyValueModel(model().getName()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemContentProvider.java deleted file mode 100644 index 620c6e783e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemContentProvider.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractTreeItemContentProvider; -import org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbType; - - -public class JaxbPackageItemContentProvider - extends AbstractTreeItemContentProvider { - - public JaxbPackageItemContentProvider( - JaxbPackage jaxbPackage, DelegatingTreeContentAndLabelProvider contentProvider) { - - super(jaxbPackage, contentProvider); - } - - - @Override - public JaxbPackage getModel() { - return (JaxbPackage) super.getModel(); - } - - @Override - public JaxbContextRoot getParent() { - return (JaxbContextRoot) getModel().getParent(); - } - - @Override - protected CollectionValueModel buildChildrenModel() { - return new CollectionAspectAdapter( - JaxbContextRoot.TYPES_COLLECTION, getParent()) { - @Override - protected Iterable getIterable() { - return this.subject.getTypes(getModel()); - } - }; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemLabelProvider.java deleted file mode 100644 index b0ba82cbf4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPackageItemLabelProvider.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.swt.graphics.Image; - - -public class JaxbPackageItemLabelProvider - extends AbstractItemLabelProvider { - - public JaxbPackageItemLabelProvider( - JaxbPackage jaxbPackage, DelegatingContentAndLabelProvider labelProvider) { - - super(jaxbPackage, labelProvider); - } - - - - @Override - protected PropertyValueModel buildImageModel() { - return new StaticPropertyValueModel(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.PACKAGE)); - } - - @Override - protected PropertyValueModel buildTextModel() { - return new StaticPropertyValueModel(((JaxbPackage) model()).getName()); - } - - @Override - protected PropertyValueModel buildDescriptionModel() { - JaxbPackage jaxbPackage = (JaxbPackage) model(); - return new StaticPropertyValueModel( - jaxbPackage.getName() + " - " + jaxbPackage.getResource().getFullPath().makeRelative()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentAttributeItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentAttributeItemLabelProvider.java deleted file mode 100644 index 16254f6edb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentAttributeItemLabelProvider.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.ui.internal.JaxbMappingImageHelper; -import org.eclipse.swt.graphics.Image; - - -public abstract class JaxbPersistentAttributeItemLabelProvider - extends AbstractItemLabelProvider { - - public JaxbPersistentAttributeItemLabelProvider( - JaxbPersistentAttribute attribute, DelegatingContentAndLabelProvider labelProvider) { - - super(attribute, labelProvider); - } - - - @Override - public JaxbPersistentAttribute model() { - return (JaxbPersistentAttribute) super.model(); - } - - @Override - protected PropertyValueModel buildImageModel() { - return new PropertyAspectAdapter( - new String[] {JaxbPersistentAttribute.DEFAULT_MAPPING_KEY_PROPERTY, JaxbPersistentAttribute.MAPPING_PROPERTY}, - model()) { - @Override - protected Image buildValue_() { - return JaxbMappingImageHelper.imageForAttributeMapping(this.subject.getMappingKey()); - } - }; - } - - @Override - protected PropertyValueModel buildTextModel() { - return new StaticPropertyValueModel(model().getName()); - } - - @Override - protected PropertyValueModel buildDescriptionModel() { - return new StaticPropertyValueModel(model().getName()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemContentProvider.java deleted file mode 100644 index 76e5837ac9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentClassItemContentProvider.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractTreeItemContentProvider; -import org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; - - -public class JaxbPersistentClassItemContentProvider - extends AbstractTreeItemContentProvider { - - public JaxbPersistentClassItemContentProvider( - JaxbPersistentClass jaxbPersistentClass, DelegatingTreeContentAndLabelProvider contentProvider) { - - super(jaxbPersistentClass, contentProvider); - } - - - @Override - public JaxbPersistentClass getModel() { - return (JaxbPersistentClass) super.getModel(); - } - - @Override - public JaxbContextRoot getParent() { - return (JaxbContextRoot) getModel().getParent(); - } - - @Override - protected CollectionValueModel buildChildrenModel() { - return new CollectionAspectAdapter( - JaxbPersistentClass.ATTRIBUTES_COLLECTION, getModel()) { - @Override - protected Iterable getIterable() { - return this.subject.getAttributes(); - } - }; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemContentProvider.java deleted file mode 100644 index 5e7620866e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemContentProvider.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractTreeItemContentProvider; -import org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionAspectAdapter; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbEnumConstant; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; - - -public class JaxbPersistentEnumItemContentProvider - extends AbstractTreeItemContentProvider { - - public JaxbPersistentEnumItemContentProvider( - JaxbPersistentEnum jaxbPersistentEnum, DelegatingTreeContentAndLabelProvider contentProvider) { - - super(jaxbPersistentEnum, contentProvider); - } - - - @Override - public JaxbPersistentEnum getModel() { - return (JaxbPersistentEnum) super.getModel(); - } - - @Override - public JaxbContextRoot getParent() { - return (JaxbContextRoot) getModel().getParent(); - } - - @Override - protected CollectionValueModel buildChildrenModel() { - return new CollectionAspectAdapter( - JaxbPersistentEnum.ENUM_CONSTANTS_COLLECTION, getModel()) { - @Override - protected Iterable getIterable() { - return this.subject.getEnumConstants(); - } - }; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemLabelProvider.java deleted file mode 100644 index 08d0114d95..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentEnumItemLabelProvider.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.swt.graphics.Image; - - -public class JaxbPersistentEnumItemLabelProvider - extends AbstractItemLabelProvider { - - public JaxbPersistentEnumItemLabelProvider( - JaxbPersistentEnum jaxbEnum, DelegatingContentAndLabelProvider labelProvider) { - - super(jaxbEnum, labelProvider); - } - - @Override - public JaxbPersistentEnum model() { - return (JaxbPersistentEnum) super.model(); - } - - @Override - protected PropertyValueModel buildImageModel() { - return new StaticPropertyValueModel(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.PERSISTENT_ENUM)); - } - - @Override - protected PropertyValueModel buildTextModel() { - return new StaticPropertyValueModel(model().getTypeQualifiedName()); - } - - @Override - protected PropertyValueModel buildDescriptionModel() { - return new StaticPropertyValueModel( - model().getFullyQualifiedName() + " - " + model().getResource().getFullPath().makeRelative()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentFieldItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentFieldItemLabelProvider.java deleted file mode 100644 index 2893b9e0df..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentFieldItemLabelProvider.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentField; - - -public class JaxbPersistentFieldItemLabelProvider - extends JaxbPersistentAttributeItemLabelProvider { - - public JaxbPersistentFieldItemLabelProvider( - JaxbPersistentField jaxbField, DelegatingContentAndLabelProvider labelProvider) { - - super(jaxbField, labelProvider); - } - - - @Override - public JaxbPersistentField model() { - return (JaxbPersistentField) super.model(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentPropertyItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentPropertyItemLabelProvider.java deleted file mode 100644 index 7fa5089486..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbPersistentPropertyItemLabelProvider.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentProperty; - - -public class JaxbPersistentPropertyItemLabelProvider - extends JaxbPersistentAttributeItemLabelProvider { - - public JaxbPersistentPropertyItemLabelProvider( - JaxbPersistentProperty jaxbProperty, DelegatingContentAndLabelProvider labelProvider) { - - super(jaxbProperty, labelProvider); - } - - - @Override - public JaxbPersistentProperty model() { - return (JaxbPersistentProperty) super.model(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbRegistryItemContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbRegistryItemContentProvider.java deleted file mode 100644 index 940db5e8c4..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbRegistryItemContentProvider.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractTreeItemContentProvider; -import org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.context.JaxbElementFactoryMethod; -import org.eclipse.jpt.jaxb.core.context.JaxbRegistry; - - -public class JaxbRegistryItemContentProvider - extends AbstractTreeItemContentProvider { - - public JaxbRegistryItemContentProvider( - JaxbRegistry jaxbRegistry, DelegatingTreeContentAndLabelProvider contentProvider) { - - super(jaxbRegistry, contentProvider); - } - - - @Override - public JaxbRegistry getModel() { - return (JaxbRegistry) super.getModel(); - } - - @Override - public JaxbContextRoot getParent() { - return (JaxbContextRoot) getModel().getParent(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTypeItemLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTypeItemLabelProvider.java deleted file mode 100644 index 2e64650d86..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb21/JaxbTypeItemLabelProvider.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb21; - -import org.eclipse.jpt.common.ui.internal.jface.AbstractItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.utility.internal.model.value.StaticPropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.context.JaxbType; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.swt.graphics.Image; - - -public class JaxbTypeItemLabelProvider - extends AbstractItemLabelProvider { - - public JaxbTypeItemLabelProvider( - JaxbType jaxbType, DelegatingContentAndLabelProvider labelProvider) { - - super(jaxbType, labelProvider); - } - - - - @Override - protected PropertyValueModel buildImageModel() { - return new StaticPropertyValueModel(JptJaxbUiPlugin.getImage(JptJaxbUiIcons.PERSISTENT_CLASS)); - } - - @Override - protected PropertyValueModel buildTextModel() { - return new StaticPropertyValueModel(((JaxbType) model()).getTypeQualifiedName()); - } - - @Override - protected PropertyValueModel buildDescriptionModel() { - JaxbType type = (JaxbType) model(); - return new StaticPropertyValueModel( - type.getFullyQualifiedName() + " - " + type.getResource().getFullPath().makeRelative()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb22/GenericJaxb_2_2_PlatformUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb22/GenericJaxb_2_2_PlatformUi.java deleted file mode 100644 index 3e2ad5efd9..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/jaxb22/GenericJaxb_2_2_PlatformUi.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.jaxb22; - -import org.eclipse.jpt.jaxb.ui.internal.jaxb21.GenericJaxb_2_1_NavigatorUi; -import org.eclipse.jpt.jaxb.ui.navigator.JaxbNavigatorUi; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; - - -public class GenericJaxb_2_2_PlatformUi - implements JaxbPlatformUi { - - public JaxbNavigatorUi getNavigatorUi() { - return GenericJaxb_2_1_NavigatorUi.instance(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentAndLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentAndLabelProvider.java deleted file mode 100644 index c4844b218a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentAndLabelProvider.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.navigator; - -import org.eclipse.jpt.common.ui.internal.jface.DelegatingTreeContentAndLabelProvider; - - -public class JaxbNavigatorContentAndLabelProvider - extends DelegatingTreeContentAndLabelProvider { - - public JaxbNavigatorContentAndLabelProvider() { - super(new JaxbNavigatorTreeItemContentProviderFactory(), new JaxbNavigatorItemLabelProviderFactory()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java deleted file mode 100644 index 79d1a19831..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorContentProvider.java +++ /dev/null @@ -1,232 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.navigator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jface.viewers.StructuredViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionChangeEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionClearEvent; -import org.eclipse.jpt.common.utility.model.event.CollectionRemoveEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JaxbProjectManager; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.navigator.ICommonContentExtensionSite; -import org.eclipse.ui.navigator.ICommonContentProvider; - -/** - * This extension of navigator content provider delegates to the platform UI - * (see the org.eclipse.jpt.ui.jpaPlatform extension point) for navigator content. - * - * If there is a platform UI for the given project, this content provider will - * provide a root "JPA Content" node (child of the project), otherwise there - * will be no content. For children of the "JPA Content" node (or for any other - * sub-node), this provider will delegate to the content provider returned by the - * platform UI implementation. - */ -public class JaxbNavigatorContentProvider - implements ICommonContentProvider { - - private JaxbNavigatorContentAndLabelProvider delegate; - - private final CollectionChangeListener jaxbProjectListener; - - private StructuredViewer viewer; - - - public JaxbNavigatorContentProvider() { - super(); - this.jaxbProjectListener = this.buildJaxbProjectListener(); - JptJaxbCorePlugin.getProjectManager().addCollectionChangeListener(JaxbProjectManager.JAXB_PROJECTS_COLLECTION, this.jaxbProjectListener); - } - - protected CollectionChangeListener buildJaxbProjectListener() { - return new JaxbProjectListener(); - } - - public JaxbNavigatorContentAndLabelProvider getDelegate() { - return this.delegate; - } - - - // **************** IContentProvider implementation ************************ - - public void dispose() { - JptJaxbCorePlugin.getProjectManager().removeCollectionChangeListener(JaxbProjectManager.JAXB_PROJECTS_COLLECTION, this.jaxbProjectListener); - if (this.delegate != null) { - this.delegate.dispose(); - } - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) { - if (this.delegate != null) { - this.delegate.inputChanged(viewer, oldInput, newInput); - } - this.viewer = (StructuredViewer) viewer; - } - - - // **************** IStructuredContentProvider implementation ************** - - public Object[] getElements(Object inputElement) { - return getChildren(inputElement); - } - - - // **************** ITreeContentProvider implementation ******************** - - public Object getParent(Object element) { - if (this.delegate != null) { - return this.delegate.getParent(element); - } - - return null; - } - - public boolean hasChildren(Object element) { - if (element instanceof IAdaptable) { - IProject project = (IProject) ((IAdaptable) element).getAdapter(IProject.class); - - if (project != null) { - JaxbProject jaxbProject = JptJaxbCorePlugin.getJaxbProject(project); - if (jaxbProject != null) { - JaxbPlatformDescription desc = jaxbProject.getPlatform().getDescription(); - JaxbPlatformUi platformUi = - JptJaxbUiPlugin.getJaxbPlatformUiManager().getJaxbPlatformUi(desc); - - return platformUi != null; - } - } - } - - if (this.delegate != null) { - return this.delegate.hasChildren(element); - } - - return false; - } - - public Object[] getChildren(Object parentElement) { - if (parentElement instanceof IAdaptable) { - IProject project = (IProject) ((IAdaptable) parentElement).getAdapter(IProject.class); - - if (project != null) { - JaxbProject jaxbProject = JptJaxbCorePlugin.getJaxbProject(project); - if (jaxbProject != null) { - JaxbPlatformDescription desc = jaxbProject.getPlatform().getDescription(); - JaxbPlatformUi platformUi = - JptJaxbUiPlugin.getJaxbPlatformUiManager().getJaxbPlatformUi(desc); - - if (platformUi != null) { - return new Object[] {jaxbProject.getContextRoot()}; - } - } - } - } - - if (this.delegate != null) { - return this.delegate.getChildren(parentElement); - } - - return new Object[0]; - } - - - // **************** IMementoAware implementation *************************** - - public void saveState(IMemento memento) { - // no op - } - - public void restoreState(IMemento memento) { - // no op - } - - - // **************** ICommonContentProvider implementation ****************** - - public void init(ICommonContentExtensionSite config) { - if (this.delegate == null) { - JaxbNavigatorLabelProvider labelProvider = (JaxbNavigatorLabelProvider) config.getExtension().getLabelProvider(); - if (labelProvider != null && labelProvider.getDelegate() != null) { - this.delegate = labelProvider.getDelegate(); - } - else { - this.delegate = new JaxbNavigatorContentAndLabelProvider(); - } - } - } - - - // **************** member classes ***************************************** - - private class JaxbProjectListener - implements CollectionChangeListener - { - public void collectionChanged(CollectionChangeEvent event) { - this.refreshViewer(null); - } - public void collectionCleared(CollectionClearEvent event) { - this.refreshViewer(null); - } - public void itemsAdded(CollectionAddEvent event) { - for (Object item : event.getItems()) { - this.refreshViewer(((JaxbProject) item).getProject()); - } - } - public void itemsRemoved(CollectionRemoveEvent event) { - for (Object item : event.getItems()) { - this.refreshViewer(((JaxbProject) item).getProject()); - } - } - - private void refreshViewer(final IProject project) { - if (viewer != null - && viewer.getControl() != null - && !viewer.getControl().isDisposed()) { - // Using job here so that project model update (which also uses - // a job) will complete first - Job refreshJob = new Job("Refresh viewer") { - @Override - protected IStatus run(IProgressMonitor monitor) { - // Using runnable here so that refresh will go on correct thread - viewer.getControl().getDisplay().asyncExec(new Runnable() { - public void run() { - if (project != null) { - viewer.refresh(project); - } - else { - viewer.refresh(); - } - } - }); - return Status.OK_STATUS; - } - }; - if (project != null) { - refreshJob.setRule(project); - } - refreshJob.schedule(); - } - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorItemLabelProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorItemLabelProviderFactory.java deleted file mode 100644 index ee3b2cbeb3..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorItemLabelProviderFactory.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.navigator; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.ItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.ItemLabelProviderFactory; -import org.eclipse.jpt.jaxb.core.context.JaxbContextNode; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; - -public class JaxbNavigatorItemLabelProviderFactory - implements ItemLabelProviderFactory { - - /** - * Exactly *one* of these factories is created for each view that utilizes it. - * Therefore, as we delegate to the platform UI for each project, we should - * maintain the same multiplicity. That is, if there is a delegate for each - * platform UI, we should maintain *one* delegate for each view. - * - * Key: platform description, Value: delegate content provider factory - */ - private final Map delegates; - - - public JaxbNavigatorItemLabelProviderFactory() { - super(); - this.delegates = new HashMap(); - } - - public ItemLabelProvider buildItemLabelProvider(Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) { - ItemLabelProviderFactory delegate = getDelegate(item); - if (delegate != null) { - return delegate.buildItemLabelProvider(item, contentAndLabelProvider); - } - return null; - } - - - private ItemLabelProviderFactory getDelegate(Object element) { - if (! (element instanceof IAdaptable)) { - return null; - } - - JaxbContextNode contextNode = (JaxbContextNode) ((IAdaptable) element).getAdapter(JaxbContextNode.class); - - if (contextNode == null) { - return null; - } - - JaxbPlatformDescription platformDesc = contextNode.getJaxbProject().getPlatform().getDescription(); - if (delegates.containsKey(platformDesc)) { - return delegates.get(platformDesc); - } - JaxbPlatformUi platformUi = JptJaxbUiPlugin.getJaxbPlatformUiManager().getJaxbPlatformUi(platformDesc); - ItemLabelProviderFactory delegate = - (platformUi == null) ? null : platformUi.getNavigatorUi().getItemLabelProviderFactory(); - delegates.put(platformDesc, delegate); - return delegate; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorLabelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorLabelProvider.java deleted file mode 100644 index 615a7bac26..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorLabelProvider.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.navigator; - -import org.eclipse.jface.viewers.ILabelProviderListener; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.swt.graphics.Image; -import org.eclipse.ui.IMemento; -import org.eclipse.ui.navigator.ICommonContentExtensionSite; -import org.eclipse.ui.navigator.ICommonLabelProvider; - -/** - * This extension of navigator label provider delegates to the platform UI - * (see the org.eclipse.jpt.ui.jpaPlatform extension point) for navigator labels. - * - * This label provider provides a label for the root "JPA Content" node provided - * by the content provider (see {@link JaxbNavigatorContentProvider}) and delegates - * to the label provider returned by the platform UI implementation for labels - * for children of the "JPA Content" node (or for any other sub-node). - */ -public class JaxbNavigatorLabelProvider - extends LabelProvider - implements ICommonLabelProvider { - - private JaxbNavigatorContentAndLabelProvider delegate; - - - public JaxbNavigatorLabelProvider() { - super(); - } - - - public JaxbNavigatorContentAndLabelProvider getDelegate() { - return delegate; - } - - - // **************** IBaseLabelProvider implementation ********************** - - @Override - public void addListener(ILabelProviderListener listener) { - if (delegate != null) { - delegate.addListener(listener); - } - super.addListener(listener); - } - - @Override - public void removeListener(ILabelProviderListener listener) { - super.removeListener(listener); - if (delegate != null) { - delegate.removeListener(listener); - } - } - - @Override - public boolean isLabelProperty(Object element, String property) { - if (delegate != null) { - return delegate.isLabelProperty(element, property); - } - - return super.isLabelProperty(element, property); - } - - @Override - public void dispose() { - if (delegate != null) { - delegate.dispose(); - } - super.dispose(); - } - - - // **************** ILabelProvider implementation ************************** - - @Override - public Image getImage(Object element) { - if (delegate != null) { - return delegate.getImage(element); - } - - return super.getImage(element); - } - - @Override - public String getText(Object element) { - if (delegate != null) { - return delegate.getText(element); - } - - return super.getText(element); - } - - - // **************** IDescriptionProvider implementation ******************** - - public String getDescription(Object element) { - if (delegate != null) { - return delegate.getDescription(element); - } - - return super.getText(element); - } - - - // **************** IMementoAware implementation *************************** - - public void saveState(IMemento memento) { - // no op - } - - public void restoreState(IMemento memento) { - // no op - } - - - // **************** ICommonLabelProvider implementation ******************** - - public void init(ICommonContentExtensionSite config) { - if (delegate == null) { - JaxbNavigatorContentProvider contentProvider = (JaxbNavigatorContentProvider) config.getExtension().getContentProvider(); - if (contentProvider != null && contentProvider.getDelegate() != null) { - delegate = contentProvider.getDelegate(); - } - else { - delegate = new JaxbNavigatorContentAndLabelProvider(); - } - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorTreeItemContentProviderFactory.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorTreeItemContentProviderFactory.java deleted file mode 100644 index 567fbb04f1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/navigator/JaxbNavigatorTreeItemContentProviderFactory.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.navigator; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jpt.common.ui.jface.DelegatingContentAndLabelProvider; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProvider; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProviderFactory; -import org.eclipse.jpt.jaxb.core.context.JaxbContextNode; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; - -public class JaxbNavigatorTreeItemContentProviderFactory - implements TreeItemContentProviderFactory { - - /** - * Exactly *one* of these factories is created for each view that utilizes it. - * Therefore, as we delegate to the platform UI for each project, we should - * maintain the same multiplicity. That is, if there is a delegate for each - * platform UI, we should maintain *one* delegate for each view. - * - * Key: platform id, Value: delegate content provider factory - */ - private Map delegates; - - - public JaxbNavigatorTreeItemContentProviderFactory() { - super(); - this.delegates = new HashMap(); - } - - public TreeItemContentProvider buildItemContentProvider(Object item, DelegatingContentAndLabelProvider contentAndLabelProvider) { - TreeItemContentProviderFactory delegate = getDelegate(item); - if (delegate != null) { - return delegate.buildItemContentProvider(item, contentAndLabelProvider); - } - return null; - } - - - private TreeItemContentProviderFactory getDelegate(Object element) { - if (! (element instanceof IAdaptable)) { - return null; - } - - JaxbContextNode contextNode = (JaxbContextNode) ((IAdaptable) element).getAdapter(JaxbContextNode.class); - - if (contextNode == null) { - return null; - } - - JaxbPlatformDescription platformDesc = contextNode.getJaxbProject().getPlatform().getDescription(); - if (delegates.containsKey(platformDesc)) { - return delegates.get(platformDesc); - } - JaxbPlatformUi platformUi = JptJaxbUiPlugin.getJaxbPlatformUiManager().getJaxbPlatformUi(platformDesc); - TreeItemContentProviderFactory delegate = - (platformUi == null) ? null : platformUi.getNavigatorUi().getTreeItemContentProviderFactory(); - delegates.put(platformDesc, delegate); - return delegate; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiConfig.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiConfig.java deleted file mode 100644 index 632aed48bc..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiConfig.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.platform; - -import org.eclipse.jpt.common.core.internal.XPointUtil; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; - -public class JaxbPlatformUiConfig { - - private String id; - private String pluginId; - private JaxbPlatformDescription jaxbPlatform; - private String className; - private JaxbPlatformUi platformUi; - - - JaxbPlatformUiConfig() { - super(); - } - - - public String getId() { - return this.id; - } - - void setId(String id) { - this.id = id; - } - - public String getPluginId() { - return this.pluginId; - } - - void setPluginId(String pluginId) { - this.pluginId = pluginId; - } - - public JaxbPlatformDescription getJaxbPlatform() { - return this.jaxbPlatform; - } - - void setJaxbPlatform(JaxbPlatformDescription jaxbPlatform) { - this.jaxbPlatform = jaxbPlatform; - } - - public String getClassName() { - return this.className; - } - - void setClassName(String className) { - this.className = className; - } - - public JaxbPlatformUi getPlatformUi() { - if (this.platformUi == null) { - this.platformUi = XPointUtil.instantiate( - JptJaxbUiPlugin.PLUGIN_ID, JaxbPlatformUiManagerImpl.QUALIFIED_EXTENSION_POINT_ID, - this.className, JaxbPlatformUi.class); - } - return this.platformUi; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiManagerImpl.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiManagerImpl.java deleted file mode 100644 index d643dbddc1..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/platform/JaxbPlatformUiManagerImpl.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.platform; - -import static org.eclipse.jpt.common.core.internal.XPointUtil.*; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jpt.common.core.internal.XPointUtil.XPointException; -import org.eclipse.jpt.common.utility.internal.KeyedSet; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUi; -import org.eclipse.jpt.jaxb.ui.platform.JaxbPlatformUiManager; - -public class JaxbPlatformUiManagerImpl - implements JaxbPlatformUiManager { - - static final String EXTENSION_POINT_ID = "jaxbPlatformUis"; //$NON-NLS-1$ - static final String QUALIFIED_EXTENSION_POINT_ID = JptJaxbCorePlugin.PLUGIN_ID_ + EXTENSION_POINT_ID; //$NON-NLS-1$ - static final String PLATFORM_UI_ELEMENT = "jaxbPlatformUi"; //$NON-NLS-1$ - static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$ - static final String PLATFORM_ATTRIBUTE = "jaxbPlatform"; //$NON-NLS-1$ - static final String CLASS_ATTRIBUTE = "class"; //$NON-NLS-1$ - - - private static final JaxbPlatformUiManagerImpl INSTANCE = new JaxbPlatformUiManagerImpl(); - - - public static JaxbPlatformUiManagerImpl instance() { - return INSTANCE; - } - - - private KeyedSet platformUiConfigs; - private KeyedSet platformToUiConfigs; - - - // ********** constructor/initialization ********** - - private JaxbPlatformUiManagerImpl() { - super(); - this.platformUiConfigs = new KeyedSet(); - this.platformToUiConfigs = new KeyedSet(); - readExtensions(); - } - - - private void readExtensions() { - final IExtensionRegistry registry = Platform.getExtensionRegistry(); - - final IExtensionPoint xpoint - = registry.getExtensionPoint(JptJaxbUiPlugin.PLUGIN_ID, EXTENSION_POINT_ID); - - if (xpoint == null) { - throw new IllegalStateException(); - } - - List platformUiConfigs = new ArrayList(); - - for (IExtension extension : xpoint.getExtensions()) { - for (IConfigurationElement configElement : extension.getConfigurationElements()) { - if (configElement.getName().equals(PLATFORM_UI_ELEMENT)) { - platformUiConfigs.add(configElement); - } - } - } - - for (IConfigurationElement configElement: platformUiConfigs) { - readPlatformUiExtension(configElement); - } - } - - private void readPlatformUiExtension(IConfigurationElement element) { - try { - JaxbPlatformUiConfig platformUiConfig = new JaxbPlatformUiConfig(); - - // plug-in id - platformUiConfig.setPluginId(element.getContributor().getName()); - - // id - platformUiConfig.setId(findRequiredAttribute(element, ID_ATTRIBUTE)); - - if (this.platformUiConfigs.containsKey(platformUiConfig.getId())) { - logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, platformUiConfig.getId()); - throw new XPointException(); - } - - // jaxb platform id - String jaxbPlatformId = findRequiredAttribute(element, PLATFORM_ATTRIBUTE); - JaxbPlatformDescription jaxbPlatform = - JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatform(jaxbPlatformId); - - if (jaxbPlatform == null) { - logInvalidValue(element, PLATFORM_ATTRIBUTE, jaxbPlatformId); - } - - if (this.platformToUiConfigs.containsKey(jaxbPlatform)) { - logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, PLATFORM_ATTRIBUTE, jaxbPlatformId); - throw new XPointException(); - } - - platformUiConfig.setJaxbPlatform(jaxbPlatform); - - // class - platformUiConfig.setClassName(findRequiredAttribute(element, CLASS_ATTRIBUTE)); - - this.platformUiConfigs.addItem(platformUiConfig.getId(), platformUiConfig); - this.platformToUiConfigs.addItem(jaxbPlatform, platformUiConfig); - } - catch (XPointException e) { - // Ignore and continue. The problem has already been reported to the user - // in the log. - } - } - - public JaxbPlatformUi getJaxbPlatformUi(JaxbPlatformDescription platformDesc) { - JaxbPlatformUiConfig config = this.platformToUiConfigs.getItem(platformDesc); - return (config == null) ? null : config.getPlatformUi(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java deleted file mode 100644 index 96fb670b28..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectModel.java +++ /dev/null @@ -1,71 +0,0 @@ -package org.eclipse.jpt.jaxb.ui.internal.properties; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jpt.common.utility.internal.model.value.AspectPropertyValueModelAdapter; -import org.eclipse.jpt.common.utility.model.event.CollectionAddEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeAdapter; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JaxbProjectManager; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; - -/** - * Treat the JAXB project as an "aspect" of the Eclipse project (IProject); - * but the JAXB project is stored in the JAXB model, not the Eclipse project - * itself.... - * We also need to listen for the JAXB project to be rebuilt if the user - * changes the Eclipse project's JAXB platform (which is stored in the - * Eclipse project's preferences). - */ -class JaxbProjectModel - extends AspectPropertyValueModelAdapter { - - /** - * The JAXB project may also change via another page (notably, the project facets page). - * In that case, the preference change occurs before we actually have another project, - * so we must listen to the projects manager - */ - private final CollectionChangeListener projectManagerListener; - - - JaxbProjectModel(PropertyValueModel projectModel) { - super(projectModel); - this.projectManagerListener = buildProjectManagerListener(); - } - - private CollectionChangeListener buildProjectManagerListener() { - return new CollectionChangeAdapter() { - // we are only looking for the project rebuild *add* event here so we can - // determine if the platform has changed. - // the other events are unimportant in this case - @Override - public void itemsAdded(CollectionAddEvent event) { - platformChanged(); - } - }; - } - - void platformChanged() { - this.propertyChanged(); - } - - @Override - protected void engageSubject_() { - JptJaxbCorePlugin.getProjectManager().addCollectionChangeListener( - JaxbProjectManager.JAXB_PROJECTS_COLLECTION, - this.projectManagerListener); - } - - @Override - protected void disengageSubject_() { - JptJaxbCorePlugin.getProjectManager().removeCollectionChangeListener( - JaxbProjectManager.JAXB_PROJECTS_COLLECTION, - this.projectManagerListener); - } - - @Override - protected JaxbProject buildValue_() { - return JptJaxbCorePlugin.getJaxbProject(this.subject); - } -} \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java deleted file mode 100644 index d213266994..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbProjectPropertiesPage.java +++ /dev/null @@ -1,315 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.properties; - -import static org.eclipse.jst.common.project.facet.ui.libprov.LibraryProviderFrameworkUi.createInstallLibraryPanel; -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Map; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jpt.common.ui.internal.properties.JptProjectPropertiesPage; -import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools; -import org.eclipse.jpt.common.utility.internal.StringConverter; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.model.value.AspectPropertyValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.BufferedWritablePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.CompositeCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyCollectionValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SetCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.StaticCollectionValueModel; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.ListValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.jaxb.core.JaxbFacet; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.libprov.JaxbLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig; -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.Group; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import com.ibm.icu.text.Collator; - -/** - * Way more complicated UI than you would think.... - */ -public class JaxbProjectPropertiesPage - extends JptProjectPropertiesPage { - - public static final String PROP_ID = "org.eclipse.jpt.jaxb.ui.jaxbProjectPropertiesPage"; //$NON-NLS-1$ - - private PropertyValueModel jaxbProjectModel; - - private BufferedWritablePropertyValueModel platformModel; - private PropertyChangeListener platformListener; - - - @SuppressWarnings("unchecked") - /* private */ static final Comparator STRING_COMPARATOR = Collator.getInstance(); - - - // ************ construction ************ - - public JaxbProjectPropertiesPage() { - super(); - } - - - @Override - protected void buildModels() { - this.jaxbProjectModel = new JaxbProjectModel(this.projectModel); - - this.platformModel = this.buildPlatformModel(); - this.platformListener = this.buildPlatformListener(); - } - - - // ***** platform ID model - - private BufferedWritablePropertyValueModel buildPlatformModel() { - return new BufferedWritablePropertyValueModel( - new PlatformModel(this.jaxbProjectModel), this.trigger); - } - - private PropertyChangeListener buildPlatformListener(){ - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - JaxbProjectPropertiesPage.this.platformChanged((JaxbPlatformDescription) event.getNewValue()); - } - }; - } - - void platformChanged(JaxbPlatformDescription newPlatform) { - if ( ! this.getControl().isDisposed()) { - // handle null, in the case the jpa facet is changed via the facets page, - // the library install delegate is temporarily null - adjustLibraryProviders(); - } - } - - - // ********** LibraryFacetPropertyPage implementation ********** - - @Override - public IProjectFacetVersion getProjectFacetVersion() { - return this.getFacetedProject().getInstalledVersion(JaxbFacet.FACET); - } - - @Override - protected void adjustLibraryProviders() { - LibraryInstallDelegate lid = this.getLibraryInstallDelegate(); - if (lid != null) { - List jaxbConfigs - = new ArrayList(); - // add the currently selected one first - JaxbLibraryProviderInstallOperationConfig currentJaxbConfig = null; - LibraryProviderOperationConfig config = lid.getLibraryProviderOperationConfig(); - if (config instanceof JaxbLibraryProviderInstallOperationConfig) { - currentJaxbConfig = (JaxbLibraryProviderInstallOperationConfig) config; - jaxbConfigs.add(currentJaxbConfig); - } - for (ILibraryProvider lp : lid.getLibraryProviders()) { - config = lid.getLibraryProviderOperationConfig(lp); - if (config instanceof JaxbLibraryProviderInstallOperationConfig - && ! config.equals(currentJaxbConfig)) { - jaxbConfigs.add((JaxbLibraryProviderInstallOperationConfig) config); - } - } - for (JaxbLibraryProviderInstallOperationConfig jaxbConfig : jaxbConfigs) { - jaxbConfig.setJaxbPlatform(this.platformModel.getValue()); - } - } - } - - - // ********** page ********** - - @Override - protected void createWidgets(Composite parent) { - buildPlatformGroup(parent); - - Control libraryProviderComposite = createInstallLibraryPanel( - parent, - getLibraryInstallDelegate(), - JptJaxbUiMessages.JaxbFacetWizardPage_jaxbImplementationLabel); - - libraryProviderComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - -// PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, JaxbHelpContextIds.PROPERTIES_JAVA_PERSISTENCE); - } - - @Override - protected void engageListeners() { - super.engageListeners(); - this.platformModel.addPropertyChangeListener(PropertyValueModel.VALUE, this.platformListener); - } - - @Override - public void disengageListeners() { - this.platformModel.removePropertyChangeListener(PropertyValueModel.VALUE, this.platformListener); - super.disengageListeners(); - } - - - // ********** platform group ********** - - private void buildPlatformGroup(Composite composite) { - Group group = new Group(composite, SWT.NONE); - group.setText(JptJaxbUiMessages.JaxbFacetWizardPage_platformLabel); - group.setLayout(new GridLayout()); - group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Combo platformDropDown = this.buildDropDown(group); - SWTTools.bind( - buildPlatformChoicesModel(), - this.platformModel, - platformDropDown, - JAXB_PLATFORM_LABEL_CONVERTER); - - buildFacetsPageLink(group, JptJaxbUiMessages.JaxbFacetWizardPage_facetsPageLink); - } - - /** - * Add the project's JAXB platform if it is not on the list of valid - * platforms. - *

- * This is probably only useful if the project is corrupted - * and has a platform that exists in the registry but is not on the - * list of valid platforms for the project's JAXB facet version. - * Because, if the project's JAXB platform is completely invalid, there - * would be no JAXB project! - */ - @SuppressWarnings("unchecked") - private ListValueModel buildPlatformChoicesModel() { - return new SortedListValueModelAdapter( - new SetCollectionValueModel( - new CompositeCollectionValueModel, JaxbPlatformDescription>( - new PropertyCollectionValueModelAdapter(this.platformModel), - buildRegistryPlatformsModel())), - JAXB_PLATFORM_COMPARATOR); - } - - private CollectionValueModel buildRegistryPlatformsModel() { - Iterable enabledPlatforms = - new FilteringIterable( - JptJaxbCorePlugin.getJaxbPlatformManager().getJaxbPlatforms()) { - @Override - protected boolean accept(JaxbPlatformDescription o) { - return o.supportsJaxbFacetVersion(getProjectFacetVersion()); - } - }; - return new StaticCollectionValueModel(enabledPlatforms); - } - - private static final Comparator JAXB_PLATFORM_COMPARATOR = - new Comparator() { - public int compare(JaxbPlatformDescription desc1, JaxbPlatformDescription desc2) { - return STRING_COMPARATOR.compare(desc1.getLabel(), desc2.getLabel()); - } - }; - - private static final StringConverter JAXB_PLATFORM_LABEL_CONVERTER = - new StringConverter() { - public String convertToString(JaxbPlatformDescription desc) { - return desc.getLabel(); - } - }; - - - // ********** OK/Revert/Apply behavior ********** - - @Override - protected boolean projectRebuildRequired() { - return this.platformModel.isBuffering(); - } - - @Override - protected void rebuildProject() { - // if the JAXB platform is changed, we need to completely rebuild the JAXB project - JptJaxbCorePlugin.getProjectManager().rebuildJaxbProject(getProject()); - } - - @Override - protected BufferedWritablePropertyValueModel[] buildBufferedModels() { - return new BufferedWritablePropertyValueModel[] { - this.platformModel - }; - } - - - // ********** validation ********** - - @Override - protected Model[] buildValidationModels() { - return new Model[] { - platformModel - }; - } - - @Override - protected void performValidation(Map> statuses) { - /* platform */ - // user is unable to unset the platform, so no validation necessary - - /* library provider */ - super.performValidation(statuses); - } - - - // ********** UI model adapters ********** - - /** - * Treat the JAXB platform as an "aspect" of the JAXB project. - * The platform ID is stored in the project preferences. - * The platform ID does not change for a JAXB project - if the user wants a - * different platform, we build an entirely new JAXB project. - */ - static class PlatformModel - extends AspectPropertyValueModelAdapter { - - PlatformModel(PropertyValueModel jaxbProjectModel) { - super(jaxbProjectModel); - } - - @Override - protected JaxbPlatformDescription buildValue_() { - return this.subject.getPlatform().getDescription(); - } - - @Override - public void setValue_(JaxbPlatformDescription newPlatform) { - JptJaxbCorePlugin.setJaxbPlatform(this.subject.getProject(), newPlatform); - } - - @Override - protected void engageSubject_() { - // the platform ID does not change - } - - @Override - protected void disengageSubject_() { - // the platform ID does not change - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java deleted file mode 100644 index eedc507131..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/properties/JaxbSchemasPropertiesPage.java +++ /dev/null @@ -1,912 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.properties; - -import java.lang.reflect.InvocationTargetException; -import java.util.ArrayList; -import java.util.Collection; -import java.util.EventListener; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IWorkspaceRunnable; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.dialogs.IDialogConstants; -import org.eclipse.jface.dialogs.ProgressMonitorDialog; -import org.eclipse.jface.dialogs.TitleAreaDialog; -import org.eclipse.jface.dialogs.TrayDialog; -import org.eclipse.jface.layout.TableColumnLayout; -import org.eclipse.jface.operation.IRunnableContext; -import org.eclipse.jface.operation.IRunnableWithProgress; -import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.window.ToolTip; -import org.eclipse.jface.window.Window; -import org.eclipse.jpt.common.ui.internal.swt.ColumnAdapter; -import org.eclipse.jpt.common.ui.internal.swt.TableModelAdapter; -import org.eclipse.jpt.common.ui.internal.utility.swt.SWTTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.value.AspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.BufferedWritablePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.CollectionPropertyValueModelAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.PropertyAspectAdapter; -import org.eclipse.jpt.common.utility.internal.model.value.SimpleCollectionValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SimplePropertyValueModel; -import org.eclipse.jpt.common.utility.internal.model.value.SortedListValueModelAdapter; -import org.eclipse.jpt.common.utility.model.event.PropertyChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener; -import org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener; -import org.eclipse.jpt.common.utility.model.value.CollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.PropertyValueModel; -import org.eclipse.jpt.common.utility.model.value.WritableCollectionValueModel; -import org.eclipse.jpt.common.utility.model.value.WritablePropertyValueModel; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.xsd.XsdUtil; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen.SelectFileOrXMLCatalogIdPanel; -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.graphics.Point; -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.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.dialogs.PropertyPage; -import org.eclipse.wst.common.uriresolver.internal.URI; -import org.eclipse.wst.xsd.contentmodel.internal.XSDImpl; -import org.eclipse.xsd.XSDSchema; - -/** - * Shows the schemas associated with a JAXB project - */ -public class JaxbSchemasPropertiesPage - extends PropertyPage { - - private static final int SIZING_SELECTION_PANE_WIDTH = 450; - - - protected final WritablePropertyValueModel projectModel; - - private final PropertyValueModel jaxbProjectModel; - - protected final BufferedWritablePropertyValueModel.Trigger trigger; - - private final SchemasModel schemasModel; - - private final WritableCollectionValueModel schemasSelectionModel; - - - public JaxbSchemasPropertiesPage() { - super(); - this.projectModel = new SimplePropertyValueModel(); - this.jaxbProjectModel = new JaxbProjectModel(this.projectModel); - this.trigger = new BufferedWritablePropertyValueModel.Trigger(); - this.schemasModel = new SchemasModel(this.jaxbProjectModel, this.trigger); - this.schemasSelectionModel = new SimpleCollectionValueModel(); - setDescription(JptJaxbUiMessages.SchemasPage_description); - } - - - protected IProject getProject() { - return this.projectModel.getValue(); - } - - @Override - public final void createControl(Composite parent ) { - super.createControl( parent ); - - Button revertButton = getDefaultsButton(); - - revertButton.setText(JptJaxbUiMessages.SchemasPage_revert); - - GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); - Point minButtonSize = revertButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); - gd.widthHint = Math.max(convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH), minButtonSize.x); - revertButton.setLayoutData(gd); - - updateButtons(); - - getShell().layout(true, true); - } - - @Override - protected final Control createContents(Composite parent) { - IAdaptable element = getElement(); - - IProject project = null; - if (element instanceof IProject) { - project = (IProject) element; - } - else { - project = (IProject) Platform.getAdapterManager().loadAdapter(element, IProject.class.getName()); - } - - this.projectModel.setValue(project); - - Composite pageComponent = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - layout.numColumns = 2; - layout.marginWidth = 0; - layout.marginHeight = 0; - pageComponent.setLayout(layout); - GridData data = new GridData(GridData.FILL_BOTH); - data.widthHint = SIZING_SELECTION_PANE_WIDTH; - pageComponent.setLayoutData(data); - - Label schemasLabel = new Label(pageComponent, SWT.LEFT); - schemasLabel.setText(JptJaxbUiMessages.SchemasPage_schemas); - data = new GridData(); - data.horizontalAlignment = GridData.FILL; - data.horizontalSpan = 2; - schemasLabel.setLayoutData(data); - - // create the table composite - Composite tableComposite = new Composite(pageComponent, SWT.NONE); - data = new GridData(SWT.FILL, SWT.FILL, true, true); - data.grabExcessHorizontalSpace = true; - data.grabExcessVerticalSpace = true; - data.widthHint = SIZING_SELECTION_PANE_WIDTH; - tableComposite.setLayoutData(data); - - // create the table - TableViewer schemasTable = new TableViewer(tableComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI); - TableModelAdapter.adapt( - new SortedListValueModelAdapter(this.schemasModel), - this.schemasSelectionModel, - schemasTable.getTable(), - new SchemaColumnAdapter(), - new SchemaTableLabelProvider()); - ColumnViewerToolTipSupport.enableFor(schemasTable, ToolTip.NO_RECREATE); - schemasTable.getTable().setHeaderVisible(true); - schemasTable.getTable().setToolTipText(null); - - // set the table composite layout (after the table, so that column information is available) - TableColumnLayout tableLayout = new TableColumnLayout(); - tableLayout.setColumnData(schemasTable.getTable().getColumn(0), new ColumnWeightData(15)); - tableLayout.setColumnData(schemasTable.getTable().getColumn(1), new ColumnWeightData(25)); - tableComposite.setLayout(tableLayout); - - // set the table layout data - data = new GridData(GridData.FILL_BOTH); - data.heightHint = schemasTable.getTable().getItemHeight() * 7; - data.widthHint = 200; - schemasTable.getTable().setLayoutData(data); - - createButtonGroup(pageComponent); - - Dialog.applyDialogFont(parent); - - return pageComponent; - } - - protected void createButtonGroup(Composite parent) { - Composite groupComponent = new Composite(parent, SWT.NULL); - GridLayout groupLayout = new GridLayout(); - groupLayout.marginWidth = 0; - groupLayout.marginHeight = 0; - groupComponent.setLayout(groupLayout); - GridData data = new GridData(); - data.verticalAlignment = GridData.FILL; - data.horizontalAlignment = GridData.FILL; - groupComponent.setLayoutData(data); - - Button addButton = new Button(groupComponent, SWT.PUSH); - addButton.setText(JptJaxbUiMessages.SchemasPage_addButtonLabel); - addButton.addSelectionListener( - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - addSchema(); - } - }); - setButtonLayoutData(addButton); - - Button editButton = new Button(groupComponent, SWT.PUSH); - editButton.setText(JptJaxbUiMessages.SchemasPage_editButtonLabel); - editButton.addSelectionListener( - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - editSelectedSchema(); - } - }); - SWTTools.controlEnabledState(buildEditEnabledModel(), editButton); - setButtonLayoutData(editButton); - - Button removeButton = new Button(groupComponent, SWT.PUSH); - removeButton.setText(JptJaxbUiMessages.SchemasPage_removeButtonLabel); - removeButton.addSelectionListener( - new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - removeSelectedSchemas(); - } - }); - SWTTools.controlEnabledState(buildRemoveEnabledModel(), removeButton); - setButtonLayoutData(removeButton); - } - - - private void addSchema() { - // constructs a dialog for editing the new schema namespace and location - AddEditSchemaDialog dialog = - new AddEditSchemaDialog( - getShell(), - null, - this.schemasModel.getValue()); - - // opens the dialog - just returns if the user cancels it - if (dialog.open() == Window.CANCEL) { - return; - } - - // otherwise, adds the new schema - Schema schema = this.schemasModel.addSchema(dialog.getNamespace(), dialog.getLocation()); - - // select the new schema - this.schemasSelectionModel.setValues(new SingleElementIterable(schema)); - } - - private PropertyValueModel buildEditEnabledModel() { - return new CollectionPropertyValueModelAdapter(this.schemasSelectionModel) { - @Override - protected Boolean buildValue() { - return this.collectionModel.size() == 1; - } - }; - } - - private void editSelectedSchema() { - // constructs a dialog for editing the new schema namespace and location - final Schema schema = this.schemasSelectionModel.iterator().next(); - AddEditSchemaDialog dialog = - new AddEditSchemaDialog( - getShell(), - schema, - this.schemasModel.getValue()); - - // opens the dialog - just returns if the user cancels it - if (dialog.open() == Window.CANCEL) { - return; - } - - // otherwise, changes the new schema - schema.setNamespace(dialog.getNamespace()); - schema.setLocation(dialog.getLocation()); - } - - private PropertyValueModel buildRemoveEnabledModel() { - return new CollectionPropertyValueModelAdapter(this.schemasSelectionModel) { - @Override - protected Boolean buildValue() { - return this.collectionModel.size() >= 1; - } - }; - } - - private void removeSelectedSchemas() { - this.schemasModel.removeSchemas(CollectionTools.iterable(this.schemasSelectionModel.iterator())); - } - - private void updateButtons() { - boolean enableApply = isValid(); - boolean enableRevert = true; - - Button applyButton = getApplyButton(); - - if (applyButton != null) { - applyButton.setEnabled(enableApply); - } - - Button revertButton = getDefaultsButton(); - - if (revertButton != null) { - revertButton.setEnabled(enableRevert); - } - } - - - // ********** OK/Revert/Apply behavior ********** - - @Override - public boolean performOk() { - try { - // true=fork; false=uncancellable - this.buildOkProgressMonitorDialog().run(true, false, this.buildOkRunnableWithProgress()); - } - catch (InterruptedException ex) { - return false; - } - catch (InvocationTargetException ex) { - throw new RuntimeException(ex.getTargetException()); - } - - return true; - } - - private IRunnableContext buildOkProgressMonitorDialog() { - return new ProgressMonitorDialog(this.getShell()); - } - - private IRunnableWithProgress buildOkRunnableWithProgress() { - return new IRunnableWithProgress() { - public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { - IWorkspace ws = ResourcesPlugin.getWorkspace(); - try { - // the build we execute in #performOk_() locks the workspace root, - // so we need to use the workspace root as our scheduling rule here - ws.run( - buildOkWorkspaceRunnable(), - ws.getRoot(), - IWorkspace.AVOID_UPDATE, - monitor); - } - catch (CoreException ex) { - throw new InvocationTargetException(ex); - } - } - }; - } - - /* private */ IWorkspaceRunnable buildOkWorkspaceRunnable() { - return new IWorkspaceRunnable() { - public void run(IProgressMonitor monitor) throws CoreException { - performOk_(monitor); - } - }; - } - - void performOk_(IProgressMonitor monitor) throws CoreException { - if (this.schemasModel.hasChanges()) { - this.trigger.accept(); - JptJaxbCorePlugin.getProjectManager().rebuildJaxbProject(getProject()); - getProject().build(IncrementalProjectBuilder.FULL_BUILD, monitor); - } - } - - @Override - protected void performDefaults() { - this.trigger.reset(); - } - - @Override - public void dispose() { - - super.dispose(); - } - - - static class SchemasModel - extends AspectAdapter - implements CollectionValueModel { - - /** - * The collection of schemas - */ - protected final Collection schemas; - - /** - * This is the trigger that indicates whether the buffered value - * should be accepted or reset. - */ - protected final PropertyValueModel triggerHolder; - - /** This listens to the trigger holder. */ - protected final PropertyChangeListener triggerChangeListener; - - - SchemasModel(PropertyValueModel subjectHolder, PropertyValueModel triggerHolder) { - super(subjectHolder); - this.schemas = new ArrayList(); - this.triggerHolder = triggerHolder; - this.triggerChangeListener = buildTriggerChangeListener(); - } - - - protected PropertyChangeListener buildTriggerChangeListener() { - return new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - triggerChanged(event); - } - }; - } - - protected Collection buildSchemas_() { - ArrayList schemas = new ArrayList(); - for (Map.Entry entry : this.subject.getSchemaLibrary().getSchemaLocations().entrySet()) { - schemas.add(new Schema(entry.getKey(), entry.getValue())); - } - return schemas; - } - - public boolean hasChanges() { - return (this.subject == null) ? false : ! this.schemas.equals(buildSchemas_()); - } - - protected void triggerChanged(PropertyChangeEvent event) { - if (hasChanges()) { - if (this.subject != null && ((Boolean) event.getNewValue()).booleanValue()) { - this.accept(); - } else { - this.reset(); - } - } - } - - public void accept() { - Map schemaLocations = new HashMap(); - for (Schema schema : this.schemas) { - schemaLocations.put(schema.getNamespace(), schema.getLocation()); - } - this.subject.getSchemaLibrary().setSchemaLocations(schemaLocations); - } - - public void reset() { - this.schemas.clear(); - if (this.subject != null) { - this.schemas.addAll(buildSchemas_()); - } - fireCollectionChanged(VALUES, getValue()); - } - - public Schema addSchema(String namespace, String location) { - Schema schema = new Schema(namespace, location); - addItemToCollection(schema, this.schemas, VALUES); - return schema; - } - - public void removeSchemas(Iterable schemas) { - removeItemsFromCollection(schemas, this.schemas, VALUES); - } - - - // ************ AspectAdapter impl ************************************ - - @Override - protected String getListenerAspectName() { - return VALUES; - } - - @Override - protected Class getListenerClass() { - return CollectionChangeListener.class; - } - - @Override - protected boolean hasListeners() { - return hasAnyCollectionChangeListeners(VALUES); - } - - @Override - protected void fireAspectChanged(Object oldValue, Object newValue) { - fireCollectionChanged(VALUES, getValue()); - } - - @Override - protected void engageSubject_() { - this.schemas.addAll(buildSchemas_()); - } - - @Override - protected void disengageSubject_() { - this.schemas.clear(); - } - - @Override - protected void engageModels() { - super.engageModels(); - this.triggerHolder.addPropertyChangeListener(PropertyValueModel.VALUE, this.triggerChangeListener); - } - - @Override - protected void disengageModels() { - this.triggerHolder.removePropertyChangeListener(PropertyValueModel.VALUE, this.triggerChangeListener); - super.disengageModels(); - } - - @Override - protected Collection getValue() { - return CollectionTools.collection(iterator()); - } - - - // ************ CollectionValueModel impl ***************************** - - public Iterator iterator() { - return this.schemas.iterator(); - } - - public int size() { - return this.schemas.size(); - } - } - - - static class Schema - extends AbstractModel - implements Comparable { - - Schema(String namespace, String location) { - super(); - this.namespace = namespace; - this.location = location; - } - - - private String namespace; - final static String NAMESPACE_PROPERTY = "namespace"; - - private String location; - final static String LOCATION_PROPERTY = "location"; - - - String getNamespace() { - return this.namespace; - } - - void setNamespace(String namespace) { - String old = this.namespace; - this.namespace = namespace; - firePropertyChanged(NAMESPACE_PROPERTY, old, namespace); - } - - String getLocation() { - return this.location; - } - - void setLocation(String location) { - String old = this.location; - this.location = location; - firePropertyChanged(LOCATION_PROPERTY, old, location); - } - - public int compareTo(Schema o) { - return this.namespace.compareTo(o.namespace); - } - } - - - static class SchemaColumnAdapter - implements ColumnAdapter { - - static final int COLUMN_COUNT = 2; - static final int NAMESPACE_COLUMN = 0; - static final int LOCATION_COLUMN = 1; - - - public int columnCount() { - return COLUMN_COUNT; - } - - public String columnName(int columnIndex) { - switch (columnIndex) { - case NAMESPACE_COLUMN : - return JptJaxbUiMessages.SchemasPage_namespaceColumnLabel; - case LOCATION_COLUMN : - return JptJaxbUiMessages.SchemasPage_locationColumnLabel; - default : - return null; - } - } - - public WritablePropertyValueModel[] cellModels(Schema subject) { - WritablePropertyValueModel[] cellModels = new WritablePropertyValueModel[COLUMN_COUNT]; - cellModels[NAMESPACE_COLUMN] = buildNamespaceCellModel(subject); - cellModels[LOCATION_COLUMN] = buildLocationCellModel(subject); - return cellModels; - } - - private WritablePropertyValueModel buildNamespaceCellModel(Schema subject) { - return new PropertyAspectAdapter(Schema.NAMESPACE_PROPERTY, subject) { - @Override - protected String buildValue_() { - return this.subject.getNamespace(); - } - }; - } - - private WritablePropertyValueModel buildLocationCellModel(Schema subject) { - return new PropertyAspectAdapter(Schema.LOCATION_PROPERTY, subject) { - @Override - protected String buildValue_() { - return this.subject.getLocation(); - } - }; - } - } - - - static class SchemaTableLabelProvider - extends LabelProvider - implements ITableLabelProvider { - - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - - public String getColumnText(Object element, int columnIndex) { - switch (columnIndex) { - case SchemaColumnAdapter.NAMESPACE_COLUMN : - return ((Schema) element).getNamespace(); - case SchemaColumnAdapter.LOCATION_COLUMN : - return ((Schema) element).getLocation(); - default : - return null; - } - } - } - - - static class AddEditSchemaDialog - extends TitleAreaDialog { - - private Schema currentSchema; - - private String defaultMessage; - - private final WritablePropertyValueModel location; - - private final WritablePropertyValueModel namespace; - - private XSDSchema resolvedSchema; - - private final Mode mode; - - private Iterable allSchemas; - - - public AddEditSchemaDialog(Shell shell, Schema currentSchema, Iterable allSchemas) { - super(shell); - this.currentSchema = currentSchema; - this.allSchemas = allSchemas; - this.location = new SimplePropertyValueModel(); - this.namespace = new SimplePropertyValueModel(); - - this.mode = (this.currentSchema == null) ? Mode.ADD : Mode.EDIT; - if (this.mode == Mode.ADD) { - this.defaultMessage = JptJaxbUiMessages.SchemasPage_addSchemaMessage; - this.location.setValue(""); - this.namespace.setValue(""); - } - else { - this.defaultMessage = JptJaxbUiMessages.SchemasPage_editSchemaMessage; - this.location.setValue(currentSchema.getLocation()); - this.namespace.setValue(currentSchema.getNamespace()); - } - } - - - @Override - protected void configureShell(Shell newShell) { - super.configureShell(newShell); - if (this.mode == Mode.ADD) { - newShell.setText(JptJaxbUiMessages.SchemasPage_addSchemaDialogTitle); - } - else { - newShell.setText(JptJaxbUiMessages.SchemasPage_editSchemaDialogTitle); - } - } - - @Override - protected Control createDialogArea(Composite parent) { - Composite dialogArea = (Composite) super.createDialogArea(parent); - - setMessage(this.defaultMessage); - if (this.mode == Mode.ADD) { - setTitle(JptJaxbUiMessages.SchemasPage_addSchemaTitle); - } - else { - setTitle(JptJaxbUiMessages.SchemasPage_editSchemaTitle); - } - - Composite composite = new Composite(dialogArea, SWT.NONE); - composite.setLayout(new GridLayout(3, false)); - composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - Label locationLabel = new Label(composite, SWT.NULL); - locationLabel.setText(JptJaxbUiMessages.SchemasPage_locationLabel); - locationLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - - final Text locationText = new Text(composite, SWT.SINGLE | SWT.BORDER); - locationText.setText(this.location.getValue()); - locationText.setEditable(false); - locationText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - this.location.addPropertyChangeListener( - PropertyValueModel.VALUE, - new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - locationText.setText((String) event.getNewValue()); - } - }); - - Button browseButton = new Button(composite, SWT.PUSH); - browseButton.setText(JptJaxbUiMessages.SchemasPage_browseButtonLabel); - browseButton.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, true, 1, 1)); - browseButton.addSelectionListener( - new SelectionListener() { - public void widgetSelected(SelectionEvent e) { - browseForSchemaLocation(); - } - - public void widgetDefaultSelected(SelectionEvent e) { - widgetSelected(e); - } - }); - - Label namespaceLabel = new Label(composite, SWT.NULL); - namespaceLabel.setText(JptJaxbUiMessages.SchemasPage_namespaceLabel); - namespaceLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false)); - - final Text namespaceText = new Text(composite, SWT.SINGLE | SWT.BORDER); - namespaceText.setText(this.namespace.getValue()); - namespaceText.setEditable(false); - namespaceText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); - this.namespace.addPropertyChangeListener( - PropertyValueModel.VALUE, - new PropertyChangeListener() { - public void propertyChanged(PropertyChangeEvent event) { - String newValue = (String) event.getNewValue(); - String display = (StringTools.stringIsEmpty(newValue)) ? - JptJaxbUiMessages.SchemasPage_noNamespaceText : newValue; - namespaceText.setText(display); - } - }); - - Dialog.applyDialogFont(dialogArea); - - return dialogArea; - } - - @Override - protected boolean isResizable() { - return true; - } - - private void browseForSchemaLocation() { - SchemaLocationDialog dialog = new SchemaLocationDialog(getShell()); - - // opens the dialog - just returns if the user cancels it - if (dialog.open() == Window.CANCEL) { - return; - } - - String location = dialog.getLocation(); - this.location.setValue(location); - - String resolvedUri = XsdUtil.getResolvedUri(null, location); - - XSDSchema schema = XSDImpl.buildXSDModel(resolvedUri); - String newNamespace = (schema == null) ? null : schema.getTargetNamespace(); - this.namespace.setValue(newNamespace); - this.resolvedSchema = schema; - - validate(); - } - - public String getNamespace() { - return this.namespace.getValue(); - } - - public String getLocation() { - return this.location.getValue(); - } - - private void validate() { - if (this.resolvedSchema == null) { - setErrorMessage(JptJaxbUiMessages.SchemasPage_schemaUnresolvedMessage); - } - else if (isDuplicateNamespace()) { - setErrorMessage(JptJaxbUiMessages.SchemasPage_duplicateNamespaceMessage); - } - else if (StringTools.stringIsEmpty(this.location.getValue())) { - setErrorMessage(JptJaxbUiMessages.SchemasPage_noLocationMessage); - } - else { - setErrorMessage(null); - setMessage(this.defaultMessage); - } - getButton(IDialogConstants.OK_ID).setEnabled(getErrorMessage() == null); - } - - private boolean isDuplicateNamespace() { - for (Schema schema : this.allSchemas) { - if ((this.currentSchema != schema) && getNamespace().equals(schema.getNamespace())) { - return true; - } - } - return false; - } - - - private enum Mode { - ADD, - EDIT - } - } - - - static class SchemaLocationDialog - extends TrayDialog { - - private SelectFileOrXMLCatalogIdPanel locationPanel; - - private String location; - - - public SchemaLocationDialog(Shell shell) { - super(shell); - } - - - @Override - protected void configureShell(Shell newShell) { - super.configureShell(newShell); - newShell.setText(JptJaxbUiMessages.SchemasPage_chooseLocationTitle); - } - - @Override - protected Control createDialogArea(Composite parent) { - Composite composite = (Composite) super.createDialogArea(parent); - - this.locationPanel = new SelectFileOrXMLCatalogIdPanel(composite, StructuredSelection.EMPTY); - this.locationPanel.setFilterExtensions(new String[] {".xsd"}); - this.locationPanel.update(); - this.locationPanel.setVisibleHelper(true); - - return composite; - } - - @Override - protected boolean isResizable() { - return true; - } - - @Override - protected void okPressed() { - IFile file = this.locationPanel.getFile(); - if (file != null) { - this.location = URI.createPlatformResourceURI(file.getFullPath().toString()).toString(); - } - else { - this.location = this.locationPanel.getXMLCatalogId(); - } - - super.okPressed(); - } - - public String getLocation() { - return this.location; - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/JavaProjectWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/JavaProjectWizardPage.java deleted file mode 100644 index 5b414d07f8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/JavaProjectWizardPage.java +++ /dev/null @@ -1,252 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards; - -import java.util.Iterator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -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.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableItem; -import org.eclipse.ui.PlatformUI; - -/** - * JavaProjectWizardPage - */ -public class JavaProjectWizardPage extends WizardPage { - - private IJavaProject javaProject; - private Table projectTable; - private TableViewer projectTableViewer; - - private static String SELECT_PROJECT_PAGE_NAME = "SelectJavaProject"; //$NON-NLS-1$ - private static int PROJECT_NAME_COLUMN_INDEX = 0; - - // ********** constructor ********** - - public JavaProjectWizardPage(IJavaProject javaProject) { - super(SELECT_PROJECT_PAGE_NAME); - - this.javaProject = javaProject; - } - - // ********** IDialogPage implementation ********** - - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - layout.numColumns = 1; - composite.setLayout(layout); - - this.buildLabel(composite, JptJaxbUiMessages.JavaProjectWizardPage_destinationProject); - - this.projectTable = this.buildProjectTable(composite, this.buildProjectTableSelectionListener()); - - this.projectTableViewer = this.buildProjectTableViewer( - this.projectTable, - this.buildProjectTableLabelProvider(), - this.buildProjectTableContentProvider()); - this.fillProjectList(); - this.setControl(composite); - this.setTableSelection(this.javaProject); - this.validate(); - } - - // ********** listeners ********** - - private SelectionListener buildProjectTableSelectionListener() { - return new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - selectedProjectChanged(); - } - - @Override - public void widgetDefaultSelected(SelectionEvent e) { - widgetSelected(e); - } - - @Override - public String toString() { - return "PromptProjectWizardPage project table selection listener"; //$NON-NLS-1$ - } - }; - } - - // ********** listener callbacks ********** - - protected void selectedProjectChanged() { - if(this.projectTable.getSelectionIndex() != -1) { - TableItem item = this.projectTable.getItem(this.projectTable.getSelectionIndex()); - String projectName = item.getText(0); - if( ! StringTools.stringIsEmpty(projectName)) { - - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - this.setJavaProject(JavaCore.create(project)); - this.validate(); - } - } - } - - // ********** intra-wizard methods ********** - - public IJavaProject getJavaProject() { - return this.javaProject; - } - - // ********** protected methods ********** - - protected void setTableSelection(IJavaProject javaProject) { - if(javaProject != null) { - String projectName = javaProject.getProject().getName(); - for(TableItem item: this.projectTable.getItems()) { - if(item.getText(0).equals(projectName)) { - this.projectTable.setSelection(item); - } - } - } - } - - protected void fillProjectList() { - this.projectTableViewer.setInput(this.getSortedJavaProjectsNames()); - } - - // ********** internal methods ********** - - private void validate() { - this.setPageComplete(this.projectTable.getSelectionIndex() != -1); - } - - private void setJavaProject(IJavaProject project) { - this.javaProject = project; - } - - private String[] getSortedJavaProjectsNames() { - return ArrayTools.sort(this.getJavaProjectsNames()); - } - - private String[] getJavaProjectsNames() { - return ArrayTools.array( - new TransformationIterable(this.getJavaProjects()) { - @Override - protected String transform(IProject project) { - return project.getName(); - } - }, - new String[0]); - } - - private Iterable getJavaProjects() { - return new FilteringIterable(CollectionTools.collection(this.getProjects())) { - @Override - protected boolean accept(IProject next) { - try { - return next.hasNature(JavaCore.NATURE_ID); - } - catch (CoreException e) { - return false; - } - } - }; - } - - private Iterator getProjects() { - return new ArrayIterator(ResourcesPlugin.getWorkspace().getRoot().getProjects()); - } - - // ********** inner classes ********** - - private final class ProjectTableLabelProvider extends LabelProvider implements ITableLabelProvider { - - public Image getColumnImage(Object element, int columnIndex) { - if(columnIndex == PROJECT_NAME_COLUMN_INDEX) - return PlatformUI.getWorkbench().getSharedImages().getImage(org.eclipse.ui.ide.IDE.SharedImages.IMG_OBJ_PROJECT); - return null; - } - - public String getColumnText(Object element, int columnIndex) { - assert element instanceof String; - String projectName = (String)element; - if(columnIndex == PROJECT_NAME_COLUMN_INDEX) - return projectName; - return null; - } - } - - private final class ProjectTableContentProvider implements IStructuredContentProvider { - - public Object[] getElements(Object inputElement) { - return ((String[])inputElement); - } - - public void dispose() {} - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} - } - - // ********** UI components ********** - - private ITableLabelProvider buildProjectTableLabelProvider() { - return new ProjectTableLabelProvider(); - } - - private IStructuredContentProvider buildProjectTableContentProvider() { - return new ProjectTableContentProvider(); - } - - private Label buildLabel(Composite parent, String text) { - Label label = new Label( parent, SWT.NONE ); - label.setText(text); - return label; - } - - private Table buildProjectTable(Composite parent, SelectionListener listener) { - TableViewer tableViewer = new TableViewer(parent, - SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.VIRTUAL); - - Table table = tableViewer.getTable(); - table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true)); - table.addSelectionListener(listener); - return table; - } - - private TableViewer buildProjectTableViewer(Table parent, ITableLabelProvider labelProvider, IStructuredContentProvider contentProvider) { - - TableViewer tableViewer = new TableViewer(parent); - tableViewer.setLabelProvider(labelProvider); - tableViewer.setContentProvider(contentProvider); - return tableViewer; - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/ProjectWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/ProjectWizardPage.java deleted file mode 100644 index 89c3c8ca3e..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/ProjectWizardPage.java +++ /dev/null @@ -1,246 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards; - -import java.util.Iterator; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -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.Combo; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Control; -import org.eclipse.swt.widgets.Label; - -/** - * ProjectWizardPage - */ -public class ProjectWizardPage extends WizardPage -{ - private IJavaProject javaProject; - private ProjectGroup projectGroup; - - // ********** static methods ********** - - public static IJavaProject getJavaProjectFromSelection(IStructuredSelection selection) { - if(selection == null) { - return null; - } - Object firstElement = selection.getFirstElement(); - if(firstElement instanceof IJavaProject) { - return (IJavaProject)firstElement; - } - else if(firstElement instanceof IResource) { - IProject project = ((IResource) firstElement).getProject(); - return getJavaProjectFrom(project); - } - else if(firstElement instanceof IJavaElement) { - return ((IJavaElement)firstElement).getJavaProject(); - } - return null; - } - - public static IJavaProject getJavaProjectFrom(IProject project) { - return (IJavaProject)((IJavaElement)((IAdaptable)project).getAdapter(IJavaElement.class)); - } - - // ********** constructor ********** - - public ProjectWizardPage() { - super("Java Project"); //$NON-NLS-1$ - - this.setDescription(JptJaxbUiMessages.ClassesGeneratorProjectWizardPage_desc); - } - - public ProjectWizardPage(IJavaProject javaProject) { - this(); - - this.javaProject = javaProject; - } - - // ********** IDialogPage implementation ********** - - public void createControl(Composite parent) { - this.setPageComplete(false); - this.setControl(this.buildTopLevelControl(parent)); - } - - // ********** intra-wizard methods ********** - - public IJavaProject getJavaProject() { - return this.javaProject; - } - - // ********** internal methods ********** - - private Control buildTopLevelControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new FillLayout()); - this.projectGroup = new ProjectGroup(composite); - Dialog.applyDialogFont(parent); -// PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, HELP_CONTEXT_ID); - return composite; - } - - private void setJavaProject(IJavaProject project) { - this.javaProject = project; - } - - private void projectChanged() { - this.setPageComplete(false); - String projectName = this.projectGroup.getProjectName(); - if( ! StringTools.stringIsEmpty(projectName)) { - - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - this.setJavaProject(JavaCore.create(project)); - this.setPageComplete(true); - } - } - - // ********** project group ********** - - class ProjectGroup { - - private Combo projectCombo; - - - // ********** constructor ********** - - private ProjectGroup(Composite parent) { - super(); - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout(2, false)); - - // Project - this.buildLabel(composite, JptJaxbUiMessages.JavaProjectWizardPage_project); - this.projectCombo = this.buildProjectCombo(composite, this.buildProjectComboSelectionListener()); - this.updateProjectCombo(); - - setPageComplete( ! StringTools.stringIsEmpty(this.getProjectName())); - } - - // ********** listeners ********** - - private SelectionListener buildProjectComboSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - // nothing special for "default" (double-click?) - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - ProjectGroup.this.selectedProjectChanged(); - } - @Override - public String toString() { - return "JavaProjectWizardPage project combo-box selection listener"; //$NON-NLS-1$ - } - }; - } - - // ********** listener callbacks ********** - - void selectedProjectChanged() { - projectChanged(); - } - - // ********** intra-wizard methods ********** - - protected String getProjectName() { - return this.projectCombo.getText(); - } - - // ********** internal methods ********** - - protected void updateProjectCombo() { - - this.projectCombo.removeAll(); - - for (String name : this.getSortedJavaProjectsNames()) { - this.projectCombo.add(name); - } - if(javaProject != null) { - this.projectCombo.select(this.projectCombo.indexOf(javaProject.getProject().getName())); - } - } - - private String[] getSortedJavaProjectsNames() { - return ArrayTools.sort(this.getJavaProjectsNames()); - } - - private String[] getJavaProjectsNames() { - return ArrayTools.array( - new TransformationIterable(this.getJavaProjects()) { - @Override - protected String transform(IProject project) { - return project.getName(); - } - }, - new String[0]); - } - - private Iterable getJavaProjects() { - return new FilteringIterable(CollectionTools.collection(this.getProjects())) { - @Override - protected boolean accept(IProject next) { - try { - return next.hasNature(JavaCore.NATURE_ID); - } - catch (CoreException e) { - return false; - } - } - }; - } - - private Iterator getProjects() { - return new ArrayIterator(ResourcesPlugin.getWorkspace().getRoot().getProjects()); - } - - // ********** UI components ********** - - private Label buildLabel(Composite parent, String text) { - Label label = new Label(parent, SWT.LEFT); - label.setLayoutData(new GridData()); - label.setText(text); - return label; - } - - private Combo buildProjectCombo(Composite parent, SelectionListener listener) { - Combo projectCombo = new Combo(parent, SWT.READ_ONLY); - GridData gridData = new GridData(); - gridData.horizontalAlignment = SWT.FILL; - gridData.grabExcessHorizontalSpace = true; - projectCombo.setLayoutData(gridData); - projectCombo.addSelectionListener(listener); - return projectCombo; - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.java deleted file mode 100644 index c0300c5825..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorExtensionOptionsWizardPage.java +++ /dev/null @@ -1,186 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen; - -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -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.Label; -import org.eclipse.swt.widgets.Text; - -/** - * ClassesGeneratorExtensionOptionsWizardPage - */ -public class ClassesGeneratorExtensionOptionsWizardPage extends WizardPage -{ - - private ExtensionOptionsComposite additionalArgsComposite; - - // ********** constructor ********** - - protected ClassesGeneratorExtensionOptionsWizardPage() { - super("Classes Generator Extension Options"); //$NON-NLS-1$ - - this.initialize(); - } - - protected void initialize() { - this.setTitle(JptJaxbUiMessages.ClassesGeneratorExtensionOptionsWizardPage_title); - this.setDescription(JptJaxbUiMessages.ClassesGeneratorExtensionOptionsWizardPage_desc); - } - - // ********** UI components ********** - - public void createControl(Composite parent) { - this.setPageComplete(true); - this.setControl(this.buildTopLevelControl(parent)); - } - - private Control buildTopLevelControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - - this.additionalArgsComposite = new ExtensionOptionsComposite(composite); - - return composite; - } - - // ********** intra-wizard methods ********** - - protected boolean allowsExtensions() { - return this.additionalArgsComposite.allowsExtensions(); - } - - protected String getClasspath() { - return this.additionalArgsComposite.getClasspath(); - } - - protected String getAdditionalArgs() { - return this.additionalArgsComposite.getAdditionalArgs(); - } - - // ********** AdditionalArgsComposite ********** - - class ExtensionOptionsComposite { - - private boolean allowsExtensions; - private final Text classpathText; - private final Button allowsExtensionsCheckBox; - - private final Text additionalArgsText; - - // ********** constructor ********** - - private ExtensionOptionsComposite(Composite parent) { - super(); - this.allowsExtensions = false; - - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(1, false); - layout.marginHeight = 0; - layout.marginWidth = 0; - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - // TODO PlatformUI.getWorkbench().getHelpSystem().setHelp(this.group, HELP_CONTEXT_ID); - - this.allowsExtensionsCheckBox = this.buildAllowsExtensionsCheckBox(composite, this.buildAllowsExtensionsSelectionListener()); - - // Classpath - Label classpathLabel = new Label(composite, SWT.NONE); - classpathLabel.setText(JptJaxbUiMessages.ClassesGeneratorExtensionOptionsWizardPage_classpath); - GridData gridData = new GridData(); - gridData.verticalIndent = 5; - classpathLabel.setLayoutData(gridData); - this.classpathText = this.buildClasspathText(composite); - - Label additionalArgsLabel = new Label(composite, SWT.NONE); - additionalArgsLabel.setText(JptJaxbUiMessages.ClassesGeneratorExtensionOptionsWizardPage_additionalArguments); - gridData = new GridData(); - gridData.verticalIndent = 5; - additionalArgsLabel.setLayoutData(gridData); - this.additionalArgsText = this.buildAdditionalArgsText(composite); - } - - // ********** UI components ********** - - private Button buildAllowsExtensionsCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = new Button(parent, SWT.CHECK); - GridData gridData = new GridData(); - gridData.verticalIndent = 5; - checkBox.setLayoutData(gridData); - checkBox.setText(JptJaxbUiMessages.ClassesGeneratorExtensionOptionsWizardPage_allowExtensions); - checkBox.setSelection(this.allowsExtensions()); - checkBox.addSelectionListener(listener); - return checkBox; - } - - private Text buildClasspathText(Composite parent) { - Text text = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL); - GridData gridData = new GridData(GridData.FILL_HORIZONTAL); - gridData.horizontalSpan = 1; - gridData.verticalIndent = 1; - gridData.heightHint = text.getLineHeight() * 3; - gridData.grabExcessHorizontalSpace = true; - text.setLayoutData(gridData); - return text; - } - - private Text buildAdditionalArgsText(Composite parent) { - Text text = new Text(parent, SWT.BORDER | SWT.MULTI | SWT.V_SCROLL); - GridData gridData = new GridData(GridData.FILL_HORIZONTAL); - gridData.horizontalSpan = 1; - gridData.verticalIndent = 1; - gridData.heightHint = text.getLineHeight() * 10; - gridData.grabExcessHorizontalSpace = true; - text.setLayoutData(gridData); - return text; - } - - // ********** listeners ********** - - private SelectionListener buildAllowsExtensionsSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - ExtensionOptionsComposite.this.setAllowsExtensions( - ExtensionOptionsComposite.this.allowsExtensionsCheckBox.getSelection()); - } - }; - } - - // ********** intra-wizard methods ********** - - protected boolean allowsExtensions() { - return this.allowsExtensions; - } - - protected void setAllowsExtensions(boolean allowsExtensions){ - this.allowsExtensions = allowsExtensions; - } - - protected String getClasspath() { - return this.classpathText.getText(); - } - - protected String getAdditionalArgs() { - return this.additionalArgsText.getText(); - } - - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorOptionsWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorOptionsWizardPage.java deleted file mode 100644 index dfa510aa12..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorOptionsWizardPage.java +++ /dev/null @@ -1,805 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jface.wizard.IWizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -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.FileDialog; -import org.eclipse.swt.widgets.Group; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Text; - -/** - * ClassesGeneratorOptionsWizardPage - */ -public class ClassesGeneratorOptionsWizardPage extends WizardPage -{ - private ProxyOptionsComposite proxyOptionsComposite; - private Options1Composite options1Composite; - private Options2Composite options2Composite; - - // ********** constructor ********** - - protected ClassesGeneratorOptionsWizardPage() { - super("Classes Generator Options"); //$NON-NLS-1$ - - this.initialize(); - } - - protected void initialize() { - this.setTitle(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_title); - this.setDescription(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_desc); - } - - // ********** UI components ********** - - public void createControl(Composite parent) { - this.setPageComplete(true); - this.setControl(this.buildTopLevelControl(parent)); - } - - private Control buildTopLevelControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - - this.proxyOptionsComposite = new ProxyOptionsComposite(composite); - - this.buildOptionsComposites(composite); - - return composite; - } - - private void buildOptionsComposites(Composite parent) { - - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout(2, true)); - - this.options1Composite = new Options1Composite(composite); - - this.options2Composite = new Options2Composite(composite); - } - - // ********** intra-wizard methods ********** - - protected String getProxy() { - return this.proxyOptionsComposite.getProxy(); - } - - protected String getProxyFile() { - return this.proxyOptionsComposite.getProxyFile(); - } - - protected boolean usesStrictValidation() { - return this.options1Composite.usesStrictValidation(); - } - - protected boolean makesReadOnly() { - return this.options1Composite.makesReadOnly(); - } - - protected boolean suppressesPackageInfoGen() { - return this.options1Composite.suppressesPackageInfoGen(); - } - - protected boolean suppressesHeaderGen() { - return this.options1Composite.suppressesHeaderGen(); - } - - protected boolean getTarget() { - return this.options1Composite.targetIs20(); - } - - protected boolean isVerbose() { - return this.options1Composite.isVerbose(); - } - - protected boolean isQuiet() { - return this.options1Composite.isQuiet(); - } - - protected boolean treatsAsXmlSchema() { - return this.options2Composite.treatsAsXmlSchema(); - } - - protected boolean treatsAsRelaxNg() { - return this.options2Composite.treatsAsRelaxNg(); - } - - protected boolean treatsAsRelaxNgCompact() { - return this.options2Composite.treatsAsRelaxNgCompact(); - } - - protected boolean treatsAsDtd() { - return this.options2Composite.treatsAsDtd(); - } - - protected boolean treatsAsWsdl() { - return this.options2Composite.treatsAsWsdl(); - } - - protected boolean showsVersion() { - return this.options2Composite.showsVersion(); - } - - protected boolean showsHelp() { - return this.options2Composite.showsHelp(); - } - - // ********** UI controls ********** - - protected Button buildCheckBox(Composite parent, String text, SelectionListener listener, int verticalIndent) { - Button checkBox = new Button(parent, SWT.CHECK); - GridData gridData = new GridData(); - gridData.verticalIndent= verticalIndent; - checkBox.setLayoutData(gridData); - checkBox.setText(text); - checkBox.addSelectionListener(listener); - return checkBox; - } - - protected Button buildRadioButton(Composite parent, String text, SelectionListener listener, int horizontalSpan) { - Button radioButton = new Button(parent, SWT.RADIO); - GridData gridData = new GridData(); - gridData.horizontalSpan = horizontalSpan; - radioButton.setLayoutData(gridData); - radioButton.setText(text); - radioButton.addSelectionListener(listener); - return radioButton; - } - - protected Text buildText(Composite parent, int horizontalSpan) { - Text text = new Text(parent, SWT.SINGLE | SWT.BORDER); - GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, false); - gridData.horizontalSpan = horizontalSpan; - text.setLayoutData(gridData); - return text; - } - - protected void disableText(Text text) { - text.setEnabled(false); - text.setText(""); //$NON-NLS-1$ - } - - // ********** internal methods ********** - - private String makeRelativeToProjectPath(String filePath) { - Path path = new Path(filePath); - IPath relativePath = path.makeRelativeTo(this.getProject().getLocation()); - return relativePath.toOSString(); - } - - private IProject getProject() { - return ((ClassesGeneratorWizard)this.getWizard()).getJavaProject().getProject(); - } - - // ********** ProxyOptionsComposite ********** - - class ProxyOptionsComposite { - - private final Button noProxyRadioButton; - - private final Button proxyRadioButton; - private final Text proxyText; - - private final Button proxyFileRadioButton; - private final Text proxyFileText; - private Button browseButton; - - // ********** constructor ********** - - private ProxyOptionsComposite(Composite parent) { - super(); - Group proxyGroup = new Group(parent, SWT.NONE); - GridLayout layout = new GridLayout(3, false); - proxyGroup.setLayout(layout); - proxyGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - proxyGroup.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_proxyGroup); - - SelectionListener proxyButtonListener = this.buildProxyRadioButtonListener(); - - this.noProxyRadioButton = buildRadioButton(proxyGroup, - JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_noProxy, proxyButtonListener, 3); - - this.proxyRadioButton = buildRadioButton(proxyGroup, - JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_proxy, proxyButtonListener, 1); - this.proxyText = buildText(proxyGroup, 1); - new Label(proxyGroup, SWT.WRAP); //empty label for spacing - - this.proxyFileRadioButton = buildRadioButton(proxyGroup, - JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_proxyFile, proxyButtonListener, 1); - this.proxyFileText = buildText(proxyGroup, 1); - this.browseButton = this.buildBrowseButton(proxyGroup); - - this.noProxyRadioButton.setSelection(true); - this.proxyButtonChanged(); - } - - private Button buildBrowseButton(Composite parent) { - Composite buttonComposite = new Composite(parent, SWT.NULL); - GridLayout buttonLayout = new GridLayout(1, false); - buttonComposite.setLayout(buttonLayout); - GridData gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.verticalAlignment = GridData.BEGINNING; - buttonComposite.setLayoutData(gridData); - - // Browse buttons - Button browseButton = new Button(buttonComposite, SWT.PUSH); - browseButton.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_browseButton); - gridData = new GridData(); - gridData.horizontalAlignment= GridData.FILL; - gridData.grabExcessHorizontalSpace= true; - browseButton.setLayoutData(gridData); - - browseButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - - public void widgetSelected(SelectionEvent e) { - - String filePath = promptProxyFile(); - if ( ! StringTools.stringIsEmpty(filePath)) { - ProxyOptionsComposite.this.proxyFileText.setText(makeRelativeToProjectPath(filePath)); - } - } - }); - return browseButton; - } - - // ********** listeners ********** - - private SelectionListener buildProxyRadioButtonListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - proxyButtonChanged(); - } - }; - } - - private void proxyButtonChanged() { - boolean usesProxy = ! this.noProxyRadioButton.getSelection(); - if (usesProxy) { - if (this.proxyRadioButton.getSelection()) { - this.proxyText.setEnabled(true); - disableText(this.proxyFileText); - this.browseButton.setEnabled(false); - } - else if (this.proxyFileRadioButton.getSelection()) { - this.proxyFileText.setEnabled(true); - this.browseButton.setEnabled(true); - disableText(this.proxyText); - } - } - else { - disableText(this.proxyText); - disableText(this.proxyFileText); - this.browseButton.setEnabled(false); - } - } - - // ********** internal methods ********** - /** - * The Add button was clicked, its action invokes this action which should - * prompt the user to select a file and return it. - */ - private String promptProxyFile() { - IWizard wizard = ClassesGeneratorOptionsWizardPage.this.getWizard(); - String projectPath = ((ClassesGeneratorWizard)wizard).getJavaProject().getProject().getLocation().toString(); - - FileDialog dialog = new FileDialog(getShell()); - dialog.setText(JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_chooseAProxyFile); - dialog.setFilterPath(projectPath); - - return dialog.open(); - } - - // ********** intra-wizard methods ********** - - protected String getProxy() { - return this.proxyText.getText(); - } - - protected String getProxyFile() { - return this.proxyFileText.getText(); - } - } - - - // ********** Options1Composite ********** - - class Options1Composite { - - private boolean usesStrictValidation; - private final Button usesStrictValidationCheckBox; - - private boolean makesReadOnly; - private final Button makesReadOnlyCheckBox; - - private boolean suppressesPackageInfoGen; - private final Button suppressesPackageInfoGenCheckBox; - - private boolean suppressesHeaderGen; - private final Button suppressesHeaderGenCheckBox; - - private boolean target; - private final Button targetCheckBox; - - private boolean isVerbose; - private final Button isVerboseCheckBox; - - private boolean isQuiet; - private final Button isQuietCheckBox; - - // ********** constructor ********** - - Options1Composite(Composite parent) { - super(); - this.usesStrictValidation = true; - this.makesReadOnly = false; - this.suppressesPackageInfoGen = false; - this.suppressesHeaderGen = false; - this.target = false; - this.isVerbose = false; - this.isQuiet = false; - - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - - this.usesStrictValidationCheckBox = this.buildUsesStrictValidationCheckBox(composite, this.buildUsesStrictValidationSelectionListener()); - this.makesReadOnlyCheckBox = this.buildMakesReadOnlyCheckBox(composite, this.buildMakesReadOnlySelectionListener()); - this.suppressesPackageInfoGenCheckBox = this.buildSuppressesPackageInfoGenCheckBox(composite, this.buildSuppressesPackageInfoGenSelectionListener()); - this.suppressesHeaderGenCheckBox = this.buildSuppressesHeaderGenCheckBox(composite, this.buildSuppressesHeaderGenSelectionListener()); - this.targetCheckBox = this.buildTargetCheckBox(composite, this.buildTargetSelectionListener()); - this.isVerboseCheckBox = this.buildIsVerboseCheckBox(composite, this.buildIsVerboseSelectionListener()); - this.isQuietCheckBox = this.buildIsQuietCheckBox(composite, this.buildIsQuietSelectionListener()); - } - - // ********** UI components ********** - - private Button buildUsesStrictValidationCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_useStrictValidation, listener, 5); - checkBox.setSelection(this.usesStrictValidation()); - return checkBox; - } - - private Button buildMakesReadOnlyCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_makeReadOnly, listener, 5); - checkBox.setSelection(this.makesReadOnly()); - return checkBox; - } - - private Button buildSuppressesPackageInfoGenCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_suppressPackageInfoGen, listener, 5); - checkBox.setSelection(this.suppressesPackageInfoGen()); - return checkBox; - } - - private Button buildSuppressesHeaderGenCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_suppressesHeaderGen, listener, 5); - checkBox.setSelection(this.suppressesHeaderGen()); - return checkBox; - } - - private Button buildTargetCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_target, listener, 5); - checkBox.setSelection(this.targetIs20()); - return checkBox; - } - - private Button buildIsVerboseCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_verbose, listener, 5); - checkBox.setSelection(this.isVerbose()); - return checkBox; - } - - private Button buildIsQuietCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_quiet, listener, 5); - checkBox.setSelection(this.isQuiet()); - return checkBox; - } - - // ********** listeners ********** - - private SelectionListener buildUsesStrictValidationSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options1Composite.this.setUsesStrictValidation( - Options1Composite.this.usesStrictValidationCheckBox.getSelection()); - } - }; - } - - private SelectionListener buildMakesReadOnlySelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options1Composite.this.setMakesReadOnly( - Options1Composite.this.makesReadOnlyCheckBox.getSelection()); - } - }; - } - - private SelectionListener buildSuppressesPackageInfoGenSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options1Composite.this.setSuppressesPackageInfoGen( - Options1Composite.this.suppressesPackageInfoGenCheckBox.getSelection()); - } - }; - } - - private SelectionListener buildSuppressesHeaderGenSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options1Composite.this.setSuppressesHeaderGen( - Options1Composite.this.suppressesHeaderGenCheckBox.getSelection()); - } - }; - } - - private SelectionListener buildTargetSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options1Composite.this.setTargetIs20( - Options1Composite.this.targetCheckBox.getSelection()); - } - }; - } - - private SelectionListener buildIsVerboseSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options1Composite.this.setIsVerbose( - Options1Composite.this.isVerboseCheckBox.getSelection()); - } - }; - } - - private SelectionListener buildIsQuietSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options1Composite.this.setIsQuiet( - Options1Composite.this.isQuietCheckBox.getSelection()); - } - }; - } - - // ********** getters/setters ********* - - protected boolean usesStrictValidation() { - return this.usesStrictValidation; - } - - protected void setUsesStrictValidation(boolean usesStrictValidation){ - this.usesStrictValidation = usesStrictValidation; - } - - protected boolean makesReadOnly() { - return this.makesReadOnly; - } - - protected void setMakesReadOnly(boolean makesReadOnly){ - this.makesReadOnly = makesReadOnly; - } - - protected boolean suppressesPackageInfoGen() { - return this.suppressesPackageInfoGen; - } - - protected void setSuppressesPackageInfoGen(boolean suppressesPackageInfoGen){ - this.suppressesPackageInfoGen = suppressesPackageInfoGen; - } - - protected boolean suppressesHeaderGen() { - return this.suppressesHeaderGen; - } - - protected void setSuppressesHeaderGen(boolean suppressesHeaderGen){ - this.suppressesHeaderGen = suppressesHeaderGen; - } - - protected boolean targetIs20() { - return this.target; - } - - protected void setTargetIs20(boolean targetIs20){ - this.target = targetIs20; - } - - protected boolean isVerbose() { - return this.isVerbose; - } - - protected void setIsVerbose(boolean isVerbose){ - this.isVerbose = isVerbose; - } - - protected boolean isQuiet() { - return this.isQuiet; - } - - protected void setIsQuiet(boolean isQuiet){ - this.isQuiet = isQuiet; - } - - } - - // ********** Options2Composite ********** - - class Options2Composite { - - private boolean treatsAsXmlSchema; - private final Button treatsAsXmlSchemaCheckBox; - - private boolean treatsAsRelaxNg; - private final Button treatsAsRelaxNgCheckBox; - - private boolean treatsAsRelaxNgCompact; - private final Button treatsAsRelaxNgCompactCheckBox; - - private boolean treatsAsDtd; - private final Button treatsAsDtdCheckBox; - - private boolean treatsAsWsdl; - private final Button treatsAsWsdlCheckBox; - - private boolean showsVersion; - private final Button showsVersionCheckBox; - - private boolean showsHelp; - private final Button showsHelpCheckBox; - - // ********** constructor ********** - - Options2Composite(Composite parent) { - super(); - this.treatsAsXmlSchema = false; - this.treatsAsRelaxNg = false; - this.treatsAsRelaxNgCompact = false; - this.treatsAsDtd = false; - this.treatsAsWsdl = false; - this.showsVersion = false; - this.showsHelp = false; - - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - - this.treatsAsXmlSchemaCheckBox = this.buildTreatsAsXmlSchemaCheckBox(composite, this.buildTreatsAsXmlSchemaSelectionListener()); - this.treatsAsRelaxNgCheckBox = this.buildTreatsAsRelaxNgCheckBox(composite, this.buildTreatsAsRelaxNgSelectionListener()); - this.treatsAsRelaxNgCompactCheckBox = this.buildTreatsAsRelaxNgCompactCheckBox(composite, this.buildTreatsAsRelaxNgCompactSelectionListener()); - this.treatsAsDtdCheckBox = this.buildTreatsAsDtdCheckBox(composite, this.buildTreatsAsDtdSelectionListener()); - this.treatsAsWsdlCheckBox = this.buildTreatsAsWsdlCheckBox(composite, this.buildTreatsAsWsdlSelectionListener()); - this.showsVersionCheckBox = this.buildVersionCheckBox(composite, this.buildVersionSelectionListener()); - this.showsHelpCheckBox = this.buildHelpCheckBox(composite, this.buildHelpSelectionListener()); - } - - // ********** UI components ********** - - private Button buildTreatsAsXmlSchemaCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_treatsAsXmlSchema, listener, 5); - checkBox.setSelection(this.treatsAsXmlSchema()); - return checkBox; - } - - private Button buildTreatsAsRelaxNgCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_treatsAsRelaxNg, listener, 5); - checkBox.setSelection(this.treatsAsRelaxNg()); - return checkBox; - } - private Button buildTreatsAsRelaxNgCompactCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_treatsAsRelaxNgCompact, listener, 5); - checkBox.setSelection(this.treatsAsRelaxNgCompact()); - return checkBox; - } - - private Button buildTreatsAsDtdCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_treatsAsDtd, listener, 5); - checkBox.setSelection(this.treatsAsDtd()); - return checkBox; - } - - private Button buildTreatsAsWsdlCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_treatsAsWsdl, listener, 5); - checkBox.setSelection(this.treatsAsWsdl()); - return checkBox; - } - - private Button buildVersionCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_showsVersion, listener, 5); - checkBox.setSelection(this.showsVersion()); - return checkBox; - } - - private Button buildHelpCheckBox(Composite parent, SelectionListener listener) { - Button checkBox = buildCheckBox(parent, JptJaxbUiMessages.ClassesGeneratorOptionsWizardPage_showsHelp, listener, 5); - checkBox.setSelection(this.showsHelp()); - return checkBox; - } - - // ********** listeners ********** - - private SelectionListener buildTreatsAsXmlSchemaSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options2Composite.this.setTreatsAsXmlSchema( - Options2Composite.this.treatsAsXmlSchemaCheckBox.getSelection()); - } - }; - } - - private SelectionListener buildTreatsAsRelaxNgSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options2Composite.this.setTreatsAsRelaxNg( - Options2Composite.this.treatsAsRelaxNgCheckBox.getSelection()); - } - }; - } - - private SelectionListener buildTreatsAsRelaxNgCompactSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options2Composite.this.setTreatsAsRelaxNgCompact( - Options2Composite.this.treatsAsRelaxNgCompactCheckBox.getSelection()); - } - }; - } - - private SelectionListener buildTreatsAsDtdSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options2Composite.this.setTreatsAsDtd( - Options2Composite.this.treatsAsDtdCheckBox.getSelection()); - } - }; - } - - private SelectionListener buildTreatsAsWsdlSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options2Composite.this.setTreatsAsWsdl( - Options2Composite.this.treatsAsWsdlCheckBox.getSelection()); - } - }; - } - - private SelectionListener buildVersionSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options2Composite.this.setShowsVersion( - Options2Composite.this.showsVersionCheckBox.getSelection()); - } - }; - } - - private SelectionListener buildHelpSelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - public void widgetSelected(SelectionEvent event) { - Options2Composite.this.setShowsHelp( - Options2Composite.this.showsHelpCheckBox.getSelection()); - } - }; - } - - // ********** getter/setter ********* - - protected boolean treatsAsXmlSchema() { - return this.treatsAsXmlSchema; - } - - protected void setTreatsAsXmlSchema(boolean treatsAsXmlSchema){ - this.treatsAsXmlSchema = treatsAsXmlSchema; - } - - protected boolean treatsAsRelaxNg() { - return this.treatsAsRelaxNg; - } - - protected void setTreatsAsRelaxNg(boolean treatsAsRelaxNg){ - this.treatsAsRelaxNg = treatsAsRelaxNg; - } - - protected boolean treatsAsRelaxNgCompact() { - return this.treatsAsRelaxNgCompact; - } - - protected void setTreatsAsRelaxNgCompact(boolean treatsAsRelaxNgCompact){ - this.treatsAsRelaxNgCompact = treatsAsRelaxNgCompact; - } - - protected boolean treatsAsDtd() { - return this.treatsAsDtd; - } - - protected void setTreatsAsDtd(boolean treatsAsDtd){ - this.treatsAsDtd = treatsAsDtd; - } - - protected boolean treatsAsWsdl() { - return this.treatsAsWsdl; - } - - protected void setTreatsAsWsdl(boolean treatsAsWsdl){ - this.treatsAsWsdl = treatsAsWsdl; - } - - protected boolean showsVersion() { - return this.showsVersion; - } - - protected void setShowsVersion(boolean showsVersion){ - this.showsVersion = showsVersion; - } - - protected boolean showsHelp() { - return this.showsHelp; - } - - protected void setShowsHelp(boolean showsHelp){ - this.showsHelp = showsHelp; - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java deleted file mode 100644 index a682566b93..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizard.java +++ /dev/null @@ -1,357 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.WorkspaceJob; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jface.dialogs.MessageDialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGeneratorExtensionOptions; -import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGeneratorOptions; -import org.eclipse.jpt.jaxb.core.internal.gen.GenerateJaxbClassesJob; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jpt.jaxb.ui.internal.wizards.JavaProjectWizardPage; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.IWorkbench; -import org.eclipse.ui.IWorkbenchWizard; - -/** - * ClassesGeneratorWizard - */ -public class ClassesGeneratorWizard extends Wizard implements IWorkbenchWizard { - - private IJavaProject javaProject; - private String schemaPathOrUri; - protected IStructuredSelection selection; - - private String destinationFolder; - private String targetPackage; - private String catalog; - private boolean usesMoxy; - private String[] bindingsFileNames; - private ClassesGeneratorOptions generatorOptions; - private ClassesGeneratorExtensionOptions generatorExtensionOptions; - - private JavaProjectWizardPage projectWizardPage; - private SchemaWizardPage schemaWizardPage; - - private ClassesGeneratorWizardPage settingsPage; - private ClassesGeneratorOptionsWizardPage optionsPage; - private ClassesGeneratorExtensionOptionsWizardPage extensionOptionsPage; - private boolean performsGeneration; - - // ********** constructor ********** - - public ClassesGeneratorWizard() { - super(); - this.performsGeneration = true; - } - - public ClassesGeneratorWizard(IJavaProject javaProject, String xsdSchemaPath) { - super(); - this.javaProject = javaProject; - this.schemaPathOrUri = xsdSchemaPath; - - this.performsGeneration = false; - } - - // ********** IWorkbenchWizard implementation ********** - - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.selection = selection; - - this.setWindowTitle(JptJaxbUiMessages.ClassesGeneratorWizard_title); - this.setDefaultPageImageDescriptor(JptJaxbUiPlugin.getImageDescriptor(JptJaxbUiIcons.CLASSES_GEN_WIZ_BANNER)); - this.setNeedsProgressMonitor(true); - } - - // ********** IWizard implementation ********** - - @Override - public void addPages() { - super.addPages(); - - if(this.selection != null) { - this.javaProject = this.getJavaProjectFromSelection(this.selection); - - this.projectWizardPage = new JavaProjectWizardPage(this.javaProject); - this.projectWizardPage.setTitle(JptJaxbUiMessages.ClassesGeneratorProjectWizardPage_title); - this.projectWizardPage.setDescription(JptJaxbUiMessages.ClassesGeneratorProjectWizardPage_desc); - this.addPage(this.projectWizardPage); - - // SchemaWizardPage - IFile schemaSelected = SchemaWizardPage.getSourceSchemaFromSelection(this.selection); - if(schemaSelected == null) { - this.schemaWizardPage = new SchemaWizardPage(this.selection); - this.addPage(this.schemaWizardPage); - } - else { - this.schemaPathOrUri = this.makeRelativeToProjectPath(schemaSelected.getFullPath()); - } - } - this.settingsPage = this.buildClassesGeneratorPage(); - this.optionsPage = this.buildClassesGeneratorOptionsPage(); - this.extensionOptionsPage = this.buildExtensionOptionsPage(); - - this.addPage(this.settingsPage); - this.addPage(this.optionsPage); - this.addPage(this.extensionOptionsPage); - } - - @Override - public boolean performFinish() { - - WizardPage currentPage = (WizardPage)getContainer().getCurrentPage(); - if(currentPage != null) { - if( ! currentPage.isPageComplete()) { - return false; - } - this.retrieveGeneratorSettings(); - this.retrieveGeneratorOptions(); - this.retrieveGeneratorExtensionOptions(); - - IFolder folder = this.getJavaProject().getProject().getFolder(this.destinationFolder); - this.createFolderIfNotExist(folder); - } - - if(this.performsGeneration) { - if(this.displayOverridingClassesWarning(this.generatorOptions)) { - this.generateJaxbClasses(); - } - } - - return true; - } - - @Override - public boolean canFinish() { - return (this.settingsPage.isPageComplete() && - this.optionsPage.isPageComplete() && - this.extensionOptionsPage.isPageComplete()); - } - - // ********** intra-wizard methods ********** - - public IJavaProject getJavaProject() { - if(this.projectWizardPage != null) { - this.javaProject = this.projectWizardPage.getJavaProject(); - } - return this.javaProject; - } - - public String getSchemaPathOrUri() { - if(this.schemaWizardPage != null) { - IFile schemaFile = this.schemaWizardPage.getSourceSchema(); - if(schemaFile != null) { - return this.makeRelativeToProjectPath(schemaFile.getFullPath()); - } - else { - return this.schemaWizardPage.getSourceURI(); - } - } - return this.schemaPathOrUri; - } - - private String makeRelativeToProjectPath(IPath path) { - IPath relativePath = path.makeRelativeTo(this.getJavaProject().getProject().getFullPath()); - return relativePath.toOSString(); - } - - // ********** public methods ********** - - public String getDestinationFolder() { - return this.destinationFolder; - } - - public String getTargetPackage() { - return this.targetPackage; - } - - public String getCatalog() { - return this.catalog; - } - - public boolean usesMoxy() { - return this.usesMoxy; - } - - public String[] getBindingsFileNames() { - return this.bindingsFileNames; - } - - public ClassesGeneratorOptions getGeneratorOptions() { - return this.generatorOptions; - } - - public ClassesGeneratorExtensionOptions getGeneratorExtensionOptions() { - return this.generatorExtensionOptions; - } - - // ********** internal methods ********** - - public IJavaProject getJavaProjectFromSelection(IStructuredSelection selection) { - if(selection == null) { - return null; - } - Object firstElement = selection.getFirstElement(); - if(firstElement instanceof IJavaProject) { - return (IJavaProject)firstElement; - } - else if(firstElement instanceof IResource) { - IProject project = ((IResource) firstElement).getProject(); - return getJavaProjectFrom(project); - } - else if(firstElement instanceof IJavaElement) { - return ((IJavaElement)firstElement).getJavaProject(); - } - return null; - } - - public IJavaProject getJavaProjectFrom(IProject project) { - return (IJavaProject)((IJavaElement)((IAdaptable)project).getAdapter(IJavaElement.class)); - } - - private boolean displayOverridingClassesWarning(ClassesGeneratorOptions generatorOptions) { - - if( ! this.isOverridingClasses(generatorOptions)) { - return true; - } - return MessageDialog.openQuestion( - this.getShell(), - JptJaxbUiMessages.ClassesGeneratorUi_generatingClassesWarningTitle, - JptJaxbUiMessages.ClassesGeneratorUi_generatingClassesWarningMessage); - } - - private boolean isOverridingClasses(ClassesGeneratorOptions generatorOptions) { - if(generatorOptions == null) { - throw new NullPointerException(); - } - if(generatorOptions.showsVersion() || generatorOptions.showsHelp()) { - return false; - } - return true; - } - - private void generateJaxbClasses() { - try { - WorkspaceJob job = new GenerateJaxbClassesJob( - this.getJavaProject(), - this.getSchemaPathOrUri(), - this.destinationFolder, - this.targetPackage, - this.catalog, - this.usesMoxy, - this.bindingsFileNames, - this.generatorOptions, - this.generatorExtensionOptions); - job.schedule(); - } - catch(RuntimeException re) { - JptJaxbUiPlugin.log(re); - - String msg = re.getMessage(); - String message = (msg == null) ? re.toString() : msg; - this.logError(message); - } - } - - private void retrieveGeneratorSettings() { - this.destinationFolder = this.settingsPage.getTargetFolder(); - this.targetPackage = this.settingsPage.getTargetPackage(); - this.catalog = this.settingsPage.getCatalog(); - this.usesMoxy = this.settingsPage.usesMoxy(); - this.bindingsFileNames = this.settingsPage.getBindingsFileNames(); - } - - private void retrieveGeneratorOptions() { - this.generatorOptions = new ClassesGeneratorOptions(); - - this.generatorOptions.setProxy(this.optionsPage.getProxy()); - this.generatorOptions.setProxyFile(this.optionsPage.getProxyFile()); - - this.generatorOptions.setUsesStrictValidation(this.optionsPage.usesStrictValidation()); - this.generatorOptions.setMakesReadOnly(this.optionsPage.makesReadOnly()); - this.generatorOptions.setSuppressesPackageInfoGen(this.optionsPage.suppressesPackageInfoGen()); - this.generatorOptions.setSuppressesHeaderGen(this.optionsPage.suppressesHeaderGen()); - this.generatorOptions.setTargetIs20(this.optionsPage.getTarget()); - this.generatorOptions.setIsVerbose(this.optionsPage.isVerbose()); - this.generatorOptions.setIsQuiet(this.optionsPage.isQuiet()); - - this.generatorOptions.setTreatsAsXmlSchema(this.optionsPage.treatsAsXmlSchema()); - this.generatorOptions.setTreatsAsRelaxNg(this.optionsPage.treatsAsRelaxNg()); - this.generatorOptions.setTreatsAsRelaxNgCompact(this.optionsPage.treatsAsRelaxNgCompact()); - this.generatorOptions.setTreatsAsDtd(this.optionsPage.treatsAsDtd()); - this.generatorOptions.setTreatsAsWsdl(this.optionsPage.treatsAsWsdl()); - this.generatorOptions.setShowsVersion(this.optionsPage.showsVersion()); - this.generatorOptions.setShowsHelp(this.optionsPage.showsHelp()); - } - - private void retrieveGeneratorExtensionOptions() { - - this.generatorExtensionOptions = new ClassesGeneratorExtensionOptions(); - - this.generatorExtensionOptions.setAllowsExtensions(this.extensionOptionsPage.allowsExtensions()); - this.generatorExtensionOptions.setClasspath(this.extensionOptionsPage.getClasspath()); - this.generatorExtensionOptions.setAdditionalArgs(this.extensionOptionsPage.getAdditionalArgs()); - } - - private ClassesGeneratorWizardPage buildClassesGeneratorPage() { - - return new ClassesGeneratorWizardPage(); - } - - private ClassesGeneratorOptionsWizardPage buildClassesGeneratorOptionsPage() { - return new ClassesGeneratorOptionsWizardPage(); - } - - private ClassesGeneratorExtensionOptionsWizardPage buildExtensionOptionsPage() { - return new ClassesGeneratorExtensionOptionsWizardPage(); - } - - private void createFolderIfNotExist(IFolder folder) { - if( folder.exists()) { - return; - } - try { - folder.create(true, true, null); - } - catch (CoreException e) { - JptJaxbUiPlugin.log(e); - - this.logError(NLS.bind( - JptJaxbUiMessages.ClassesGeneratorWizard_couldNotCreate, - folder.getProjectRelativePath().toOSString())); - } - } - - protected void logError(String message) { - this.displayError(message); - } - - private void displayError(String message) { - MessageDialog.openError( - this.getShell(), - JptJaxbUiMessages.ClassesGeneratorWizard_errorDialogTitle, - message - ); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java deleted file mode 100644 index d1676f5c21..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/ClassesGeneratorWizardPage.java +++ /dev/null @@ -1,643 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen; - -import java.io.File; -import java.util.ArrayList; -import java.util.Collection; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Status; -import org.eclipse.jdt.core.IJavaModel; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.internal.ui.wizards.TypedElementSelectionValidator; -import org.eclipse.jdt.internal.ui.wizards.TypedViewerFilter; -import org.eclipse.jdt.ui.JavaElementComparator; -import org.eclipse.jdt.ui.JavaElementLabelProvider; -import org.eclipse.jdt.ui.StandardJavaElementContentProvider; -import org.eclipse.jdt.ui.wizards.NewTypeWizardPage; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.IBaseLabelProvider; -import org.eclipse.jface.viewers.IContentProvider; -import org.eclipse.jface.viewers.ILabelProvider; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jface.window.Window; -import org.eclipse.jpt.common.ui.internal.util.SWTUtil; -import org.eclipse.jpt.common.ui.internal.util.TableLayoutComposite; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.core.internal.gen.ClassesGenerator; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -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.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.Control; -import org.eclipse.swt.widgets.FileDialog; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.swt.widgets.Text; -import org.eclipse.ui.PlatformUI; -import org.eclipse.ui.dialogs.ElementTreeSelectionDialog; -import org.osgi.framework.Bundle; - -/** - * ClassesGeneratorWizardPage - */ -public class ClassesGeneratorWizardPage extends NewTypeWizardPage { - static public String JPT_ECLIPSELINK_UI_PLUGIN_ID = "org.eclipse.jpt.jpa.eclipselink.ui"; //$NON-NLS-1$ - static public String XML_FILTER = "*.xml"; //$NON-NLS-1$ - static public String BINDINGS_FILE_FILTER = "*.xjb;*.xml;*.xbd"; //$NON-NLS-1$ - - public static final String HELP_CONTEXT_ID = "org.eclipse.jpt.ui.configure_jaxb_class_generation_dialog"; //$NON-NLS-1$ - - private SettingsGroup settingsGroup; - - private String targetFolder; - private String targetPackage; - - private Button usesMoxyCheckBox; - private boolean usesMoxy; - - // ********** constructor ********** - - public ClassesGeneratorWizardPage() { - super(true, "Classes Generator"); //$NON-NLS-1$ - - this.setDescription(JptJaxbUiMessages.ClassesGeneratorWizardPage_desc); - } - - // ********** UI components ********** - - public void createControl(Composite parent) { - this.setPageComplete(false); - this.setControl(this.buildTopLevelControl(parent)); - } - - // ********** intra-wizard methods ********** - - protected String getTargetFolder() { - return this.targetFolder; - } - - protected String getTargetPackage() { - return this.targetPackage; - } - - protected String getCatalog() { - return this.settingsGroup.getCatalog(); - } - - protected String[] getBindingsFileNames() { - return this.settingsGroup.getBindingsFileNames(); - } - - protected boolean usesMoxy() { - return this.usesMoxy; - } - - protected void setUsesMoxy(boolean usesMoxy){ - this.usesMoxy = usesMoxy; - } - - // ********** internal methods ********** - - private Control buildTopLevelControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - - PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, HELP_CONTEXT_ID); - - this.settingsGroup = new SettingsGroup(composite); - - this.usesMoxyCheckBox = this.buildUsesMoxyCheckBox(composite); - - Dialog.applyDialogFont(parent); - return composite; - } - - private Button buildUsesMoxyCheckBox(Composite parent) { - - Button checkBox = new Button(parent, SWT.CHECK); - GridData gridData = new GridData(); - gridData.verticalIndent = 10; - checkBox.setLayoutData(gridData); - checkBox.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_usesMoxyImplementation); - checkBox.setSelection(this.usesMoxy()); - checkBox.addSelectionListener(this.buildUsesMoxySelectionListener()); - - return checkBox; - } - - private SelectionListener buildUsesMoxySelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - - public void widgetSelected(SelectionEvent event) { - setUsesMoxy(usesMoxyCheckBox.getSelection()); - validateProjectClasspath(); - } - }; - } - - private boolean jptEclipseLinkBundleExists() { - return (this.getJptEclipseLinkBundle() != null); - } - - private Bundle getJptEclipseLinkBundle() { - return Platform.getBundle(JPT_ECLIPSELINK_UI_PLUGIN_ID); // Cannot reference directly EL plugin. - } - - private void validateProjectClasspath() { - //this line will suppress the "default package" warning (which doesn't really apply here - //as the JAXB gen uses an org.example.schemaName package by default) and will clear the classpath warnings when necessary - setMessage(null); - - if ( ! this.genericJaxbIsOnClasspath()) { - this.displayWarning(JptJaxbUiMessages.ClassesGeneratorWizardPage_jaxbLibrariesNotAvailable); - } - else if (this.usesMoxy() && ! this.moxyIsOnClasspath()) { - //this message is being truncated by the wizard width in some cases - this.displayWarning(JptJaxbUiMessages.ClassesGeneratorWizardPage_moxyLibrariesNotAvailable); - } - - //this code will intelligently remove our classpath warnings when they are present but no longer apply (as an alternative - //to setting the message to null continuously as is currently done) -// else if( this.getMessage() != null){ -// if (this.getMessage().equals(JptJaxbUiMessages.ClassesGeneratorWizardPage_jaxbLibrariesNotAvailable) || -// this.getMessage().equals(JptJaxbUiMessages.ClassesGeneratorWizardPage_moxyLibrariesNotAvailable)) { -// setMessage(null); -// } -// } - } - - private void displayWarning(String message) { - this.setMessage(message, WARNING); - } - - /** - * Test if the Jaxb compiler is on the classpath. - */ - private boolean genericJaxbIsOnClasspath() { - try { - String className = ClassesGenerator.JAXB_GENERIC_GEN_CLASS; - IType genClass = this.getJavaProject().findType(className); - return (genClass != null); - } - catch (JavaModelException e) { - throw new RuntimeException(e); - } - } - - /** - * Test if the EclipseLink Jaxb compiler is on the classpath. - */ - private boolean moxyIsOnClasspath() { - try { - String className = ClassesGenerator.JAXB_ECLIPSELINK_GEN_CLASS; - IType genClass = this.getJavaProject().findType(className); - return (genClass != null); - } - catch (JavaModelException e) { - throw new RuntimeException(e); - } - } - - // ********** overrides ********** - - @Override - protected IStatus packageChanged() { - IStatus status = super.packageChanged(); - IPackageFragment packageFragment = getPackageFragment(); - if (!status.matches(IStatus.ERROR)) { - this.targetPackage = packageFragment.getElementName(); - } - return status; - } - - @Override - protected IStatus containerChanged() { - IStatus status = super.containerChanged(); - String srcFolder = getPackageFragmentRootText(); - if( !status.matches(IStatus.ERROR) ){ - this.targetFolder = srcFolder.substring(srcFolder.indexOf("/") + 1); - } - return status; - } - - @Override - protected void handleFieldChanged(String fieldName) { - super.handleFieldChanged(fieldName); - if (this.fContainerStatus.matches(IStatus.ERROR)) { - updateStatus(fContainerStatus); - }else if( ! this.fPackageStatus.matches(IStatus.OK) ) { - updateStatus(fPackageStatus); - } else { - updateStatus(Status.OK_STATUS); - } - validateProjectClasspath(); - } - - /** - * Override setVisible to insure that our more important warning - * message about classpath problems is displayed to the user first. - */ - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if(visible) { - this.initContainerPage(((ClassesGeneratorWizard)this.getWizard()).getJavaProject()); - - // default usesMoxy to true only when JPT EclipseLink bundle exists and MOXy is on the classpath - this.usesMoxy = (this.jptEclipseLinkBundleExists() && this.moxyIsOnClasspath()); - - // checkbox is visible only if jpt.eclipselink.ui plugin is available - // and EclipseLink MOXy is not on the classpath - this.usesMoxyCheckBox.setVisible(this.jptEclipseLinkBundleExists() && ! this.moxyIsOnClasspath()); - this.validateProjectClasspath(); - - String schemaPathOrUri = ((ClassesGeneratorWizard)this.getWizard()).getSchemaPathOrUri(); - this.setTitle(NLS.bind(JptJaxbUiMessages.ClassesGeneratorWizardPage_title, schemaPathOrUri)); - } - } - - /** - * Override to allow selection of source folder in current project only - * @see org.eclipse.jdt.ui.wizards.NewContainerWizardPage#chooseContainer() - * Only 1 line in this code is different from the parent - */ - @Override - protected IPackageFragmentRoot chooseContainer() { - Class[] acceptedClasses = new Class[] { IPackageFragmentRoot.class, IJavaProject.class }; - TypedElementSelectionValidator validator= new TypedElementSelectionValidator(acceptedClasses, false) { - @Override - public boolean isSelectedValid(Object element) { - try { - if (element instanceof IJavaProject) { - IJavaProject jproject= (IJavaProject)element; - IPath path= jproject.getProject().getFullPath(); - return (jproject.findPackageFragmentRoot(path) != null); - } else if (element instanceof IPackageFragmentRoot) { - return (((IPackageFragmentRoot)element).getKind() == IPackageFragmentRoot.K_SOURCE); - } - return true; - } catch (JavaModelException e) { - JptJaxbUiPlugin.log(e); // just log, no UI in validation - } - return false; - } - }; - - acceptedClasses= new Class[] { IJavaModel.class, IPackageFragmentRoot.class, IJavaProject.class }; - ViewerFilter filter= new TypedViewerFilter(acceptedClasses) { - @Override - public boolean select(Viewer viewer, Object parent, Object element) { - if (element instanceof IPackageFragmentRoot) { - try { - return (((IPackageFragmentRoot)element).getKind() == IPackageFragmentRoot.K_SOURCE); - } catch (JavaModelException e) { - JptJaxbUiPlugin.log(e.getStatus()); // just log, no UI in validation - return false; - } - } - return super.select(viewer, parent, element); - } - }; - - StandardJavaElementContentProvider provider= new StandardJavaElementContentProvider(); - ILabelProvider labelProvider= new JavaElementLabelProvider(JavaElementLabelProvider.SHOW_DEFAULT); - ElementTreeSelectionDialog dialog= new ElementTreeSelectionDialog(getShell(), labelProvider, provider); - dialog.setValidator(validator); - dialog.setComparator(new JavaElementComparator()); - dialog.setTitle(JptJaxbUiMessages.ClassesGeneratorWizardPage_sourceFolderSelectionDialog_title); - dialog.setMessage(JptJaxbUiMessages.ClassesGeneratorWizardPage_chooseSourceFolderDialog_desc); - dialog.addFilter(filter); - //set the java project as the input instead of the workspace like the NewContainerWizardPage was doing - //******************************************************// - dialog.setInput(this.getJavaProject()); // - //******************************************************// - dialog.setInitialSelection(getPackageFragmentRoot()); - dialog.setHelpAvailable(false); - - if (dialog.open() == Window.OK) { - Object element= dialog.getFirstResult(); - if (element instanceof IJavaProject) { - IJavaProject jproject= (IJavaProject)element; - return jproject.getPackageFragmentRoot(jproject.getProject()); - } else if (element instanceof IPackageFragmentRoot) { - return (IPackageFragmentRoot)element; - } - return null; - } - return null; - } - - // ********** SettingsGroup class ********** - - private class SettingsGroup { - - private final Text catalogText; - - private final ArrayList bindingsFileNames; - - // ********** constructor ********** - - private SettingsGroup(Composite parent) { - super(); - Composite composite = new Composite(parent, SWT.NONE); - GridLayout layout = new GridLayout(4, false); //must be 4 for the package controls - layout.marginHeight = 0; - layout.marginWidth = 0; - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - // TODO PlatformUI.getWorkbench().getHelpSystem().setHelp(this.group, HELP_CONTEXT_ID); - - // Source folder - createContainerControls(composite, 4); - - // Package - createPackageControls(composite, 4); - - Label label = new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL); - GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false, 4, 1); - gridData.verticalIndent = 5; - label.setLayoutData(gridData); - - // Catalog - Label catalogLabel = new Label(composite, SWT.NONE); - catalogLabel.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_catalog); - gridData = new GridData(); - gridData.verticalIndent = 5; - catalogLabel.setLayoutData(gridData); - this.catalogText = this.buildCatalogText(composite); - this.buildBrowseButton(composite); - - // Bindings files - this.bindingsFileNames = new ArrayList(); - Label bindingsFileLabel = new Label(composite, SWT.NONE); - bindingsFileLabel.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_bindingsFiles); - bindingsFileLabel.setLayoutData(new GridData()); - this.buildBindingsFileTable(composite); - } - - // ********** intra-wizard methods ********** - - protected String getCatalog() { - return this.catalogText.getText(); - } - - protected String[] getBindingsFileNames() { - return ArrayTools.array(this.bindingsFileNames.iterator(), new String[0]); - } - - // ********** UI components ********** - - private Text buildCatalogText(Composite parent) { - Text text = new Text(parent, SWT.BORDER); - GridData gridData = new GridData(GridData.FILL_HORIZONTAL); - gridData.horizontalSpan = 2; - gridData.verticalIndent = 5; - text.setLayoutData(gridData); - return text; - } - - private void buildBrowseButton(Composite parent) { - - Composite buttonComposite = new Composite(parent, SWT.NULL); - GridLayout buttonLayout = new GridLayout(1, false); - buttonComposite.setLayout(buttonLayout); - GridData gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.verticalAlignment = GridData.BEGINNING; - buttonComposite.setLayoutData(gridData); - - // Browse buttons - Button browseButton = new Button(buttonComposite, SWT.PUSH); - browseButton.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_browseButton); - gridData = new GridData(); - gridData.horizontalAlignment= GridData.FILL; - gridData.verticalIndent = 5; - gridData.grabExcessHorizontalSpace= true; - browseButton.setLayoutData(gridData); - - browseButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - - public void widgetSelected(SelectionEvent e) { - - String filePath = promptXmlFile(); - if( ! StringTools.stringIsEmpty(filePath)) { - - catalogText.setText(makeRelativeToProjectPath(filePath)); - } - } - }); - } - - private TableViewer buildBindingsFileTable(Composite parent) { - - TableViewer tableViewer = this.buildTableViewer(parent, this.bindingsFileNames); - - this.buildAddRemoveButtons(parent, tableViewer, this.bindingsFileNames); - return tableViewer; - } - - private TableViewer buildTableViewer(Composite parent, ArrayList tableDataModel) { - - TableLayoutComposite tableLayout = new TableLayoutComposite(parent, SWT.NONE); - this.addColumnsData(tableLayout); - - final Table table = new Table(tableLayout, SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE | SWT.FULL_SELECTION | SWT.BORDER); - table.setLinesVisible(false); - - TableColumn column = new TableColumn(table, SWT.NONE, 0); - column.setResizable(true); - - GridData gridData= new GridData(GridData.FILL_BOTH); - gridData.horizontalSpan = 2; - gridData.heightHint= SWTUtil.getTableHeightHint(table, 3); - tableLayout.setLayoutData(gridData); - - TableViewer tableViewer = new TableViewer(table); - tableViewer.setUseHashlookup(true); - tableViewer.setLabelProvider(this.buildLabelProvider()); - tableViewer.setContentProvider(this.buildContentProvider()); - - tableViewer.setInput(tableDataModel); - return tableViewer; - } - - private void buildAddRemoveButtons(Composite parent, final TableViewer tableViewer, final ArrayList tableDataModel) { - - Composite buttonComposite = new Composite(parent, SWT.NULL); - GridLayout buttonLayout = new GridLayout(1, false); - buttonComposite.setLayout(buttonLayout); - GridData gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.verticalAlignment = GridData.BEGINNING; - buttonComposite.setLayoutData(gridData); - // Add buttons - Button addButton = new Button(buttonComposite, SWT.PUSH); - addButton.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_addButton); - gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.grabExcessHorizontalSpace= true; - addButton.setLayoutData(gridData); - addButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - - public void widgetSelected(SelectionEvent e) { - - ArrayList filePaths = promptBindingsFiles(); - for(String filePath : filePaths) { - addBindingsFile(filePath, tableDataModel); - } - tableViewer.refresh(); - } - }); - // Remove buttons - Button removeButton = new Button(buttonComposite, SWT.PUSH); - removeButton.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_removeButton); - gridData = new GridData(); - gridData.horizontalAlignment = GridData.FILL; - gridData.grabExcessHorizontalSpace= true; - removeButton.setLayoutData(gridData); - removeButton.addSelectionListener(new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent e) {} - - public void widgetSelected(SelectionEvent e) { - StructuredSelection selection = (StructuredSelection)tableViewer.getSelection(); - if(selection.isEmpty()) { - return; - } - String bindingsFileName = (String)selection.getFirstElement(); - removeBindingsFile(bindingsFileName); - - tableViewer.refresh(); - } - }); - addButton.setFocus(); - } - - // ********** internal methods ********** - - private String makeRelativeToProjectPath(String filePath) { - Path path = new Path(filePath); - IPath relativePath = path.makeRelativeTo(getJavaProject().getProject().getLocation()); - return relativePath.toOSString(); - } - - private void addBindingsFile(String filePath, final ArrayList tableDataModel) { - String relativePath = this.makeRelativeToProjectPath(filePath); - if( ! tableDataModel.contains(relativePath)) { - tableDataModel.add(relativePath); - } - } - - private void removeBindingsFile(String bindingsName) { - this.bindingsFileNames.remove(bindingsName); - } - - private IBaseLabelProvider buildLabelProvider() { - return new TableLabelProvider(); - } - - private IContentProvider buildContentProvider() { - return new TableContentProvider(); - } - - /** - * The Add button was clicked, its action invokes this action which should - * prompt the user to select a file and return it. - */ - private String promptXmlFile() { - String projectPath= getJavaProject().getProject().getLocation().toString(); - - FileDialog dialog = new FileDialog(getShell()); - dialog.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_chooseACatalog); - dialog.setFilterPath(projectPath); - dialog.setFilterExtensions(new String[] {XML_FILTER}); - - return dialog.open(); - } - - private ArrayList promptBindingsFiles() { - String projectPath= getJavaProject().getProject().getLocation().toString(); - - FileDialog dialog = new FileDialog(getShell(), SWT.MULTI); - dialog.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_chooseABindingsFile); - dialog.setFilterPath(projectPath); - dialog.setFilterExtensions(new String[] {BINDINGS_FILE_FILTER}); - - dialog.open(); - String path = dialog.getFilterPath(); - String[] fileNames = dialog.getFileNames(); - ArrayList results = new ArrayList(fileNames.length); - for(String fileName : fileNames) { - results.add(path + File.separator + fileName); - } - return results; - } - - private void addColumnsData(TableLayoutComposite layout) { - layout.addColumnData(new ColumnWeightData(50, true)); - } - - } - - // ********** inner class ********** - private class TableLabelProvider extends LabelProvider implements ITableLabelProvider { - - public Image getColumnImage(Object element, int columnIndex) { - return null; - } - - public String getColumnText(Object element, int columnIndex) { - return (String)element; - } - } - - private class TableContentProvider implements IStructuredContentProvider { - - TableContentProvider() { - super(); - } - - public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {} - - public void dispose() {} - - public Object[] getElements(Object inputElement) { - return ((Collection) inputElement).toArray(); - } - } -} \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SchemaWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SchemaWizardPage.java deleted file mode 100644 index 0f9371cfbc..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SchemaWizardPage.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jface.wizard.WizardPage; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jpt.jaxb.ui.internal.wizards.JavaProjectWizardPage; -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.wst.common.uriresolver.internal.util.URIHelper; - -/** - * SchemaWizardPage - */ -public class SchemaWizardPage extends WizardPage { - - private final IStructuredSelection initialSelection; - private IProject targetProject; - - protected SelectFileOrXMLCatalogIdPanel selectSourcePanel; - - protected static final String[] browseXSDFilterExtensions = {".xsd"}; //$NON-NLS-1$ - - // ********** static method ********** - - public static IFile getSourceSchemaFromSelection(IStructuredSelection selection) { - Object firstElement = selection.getFirstElement(); - if(firstElement instanceof IFile) { - String elementExtension = ((IFile)firstElement).getFileExtension(); - if(elementExtension != null) { - if(browseXSDFilterExtensions[0].endsWith(elementExtension)) { - return ((IFile)firstElement); - } - } - } - return null; - } - - // ********** constructor ********** - - SchemaWizardPage(IStructuredSelection selection) { - super("SchemaWizardPage"); //$NON-NLS-1$ - - this.initialSelection = selection; - } - - // ********** IDialogPage implementation ********** - - public void createControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NONE); -// PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, HELP_CONTEXT_ID); - composite.setLayout(new GridLayout()); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - this.setControl(composite); - - this.selectSourcePanel = new SelectFileOrXMLCatalogIdPanel(composite, this.initialSelection); - this.selectSourcePanel.setLayoutData(new GridData(GridData.FILL_BOTH)); - - SelectFileOrXMLCatalogIdPanel.PanelListener listener = new SelectFileOrXMLCatalogIdPanel.PanelListener() { - public void completionStateChanged() { - selectFileOrXMLCatalogIdPanelChanged(); - } - }; - this.selectSourcePanel.setListener(listener); - Dialog.applyDialogFont(parent); - } - - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if(visible) { - - if(this.getSourceSchema() != null) { - this.selectSourcePanel.setSingleFileViewDefaultSelection(new StructuredSelection(this.getSourceSchema())); - } - else { - this.updateTargetProject(); - IFile schema = getSourceSchemaFromSelection(this.initialSelection); - if(schema != null) { - this.selectSourcePanel.setSingleFileViewDefaultSelection(new StructuredSelection(schema)); - } - else { - this.selectSourcePanel.setSingleFileViewDefaultSelection(new StructuredSelection(this.targetProject)); - } - } - this.selectSourcePanel.update(); - - this.setTitle(JptJaxbUiMessages.SchemaWizardPage_title); - this.setDescription(JptJaxbUiMessages.SchemaWizardPage_desc); - this.selectSourcePanel.setFilterExtensions(browseXSDFilterExtensions); - } - this.selectSourcePanel.setVisibleHelper(visible); - } - - // ********** IWizardPage implementation ********** - - @Override - public boolean isPageComplete() { - - return this.schemaOrUriSelected() && (this.getErrorMessage() == null); - } - - // ********** intra-wizard methods ********** - - public IFile getSourceSchema() { - return this.selectSourcePanel.getFile(); - } - - public String getSourceURI() { - String uri = this.selectSourcePanel.getXMLCatalogURI(); - if(uri == null) { - IFile file = this.selectSourcePanel.getFile(); - if(file != null) { - uri = URIHelper.getPlatformURI(file); - } - } - return uri; - } - - public String getXMLCatalogId() { - return this.selectSourcePanel.getXMLCatalogId(); - } - - // ********** internal methods ********** - - private void updateTargetProject() { - IWizardPage previousPage = this.getPreviousPage(); - - if(previousPage instanceof JavaProjectWizardPage) { - // get project from previousPage - this.targetProject = (((JavaProjectWizardPage)previousPage).getJavaProject()).getProject(); - } - else if(initialSelection != null && ! this.initialSelection.isEmpty()) { - // no previousPage - get project from initialSelection - this.targetProject = this.getProjectFromInitialSelection(); - } - } - - private IProject getProjectFromInitialSelection() { - Object firstElement = initialSelection.getFirstElement(); - if(firstElement instanceof IProject) { - return (IProject)firstElement; - } - else if(firstElement instanceof IResource) { - return ((IResource) firstElement).getProject(); - } - else if(firstElement instanceof IJavaElement) { - return ((IJavaElement)firstElement).getJavaProject().getProject(); - } - return null; - } - - private boolean schemaOrUriSelected() { - return ((this.getSourceSchema() != null) || (this.getSourceURI() != null)); - } - - private String computeErrorMessage() { - String errorMessage = null; - String uri = this.getSourceURI(); - if(uri != null) { - if( ! URIHelper.isReadableURI(uri, false)) { - errorMessage = JptJaxbUiMessages.SchemaWizardPage_errorUriCannotBeLocated; - } - } - return errorMessage; - } - - private void selectFileOrXMLCatalogIdPanelChanged() { - String errorMessage = this.computeErrorMessage(); - this.setErrorMessage(errorMessage); - this.setPageComplete(this.isPageComplete()); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectFileOrXMLCatalogIdPanel.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectFileOrXMLCatalogIdPanel.java deleted file mode 100644 index c7a6db1116..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectFileOrXMLCatalogIdPanel.java +++ /dev/null @@ -1,185 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 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 - * Code originate from org.eclipse.wst.xml.ui.internal.dialogs - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.ISelectionChangedListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.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.ui.part.PageBook; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry; - - -public class SelectFileOrXMLCatalogIdPanel extends Composite implements SelectionListener { - - public interface PanelListener { - void completionStateChanged(); - } - - protected PanelListener listener; - protected PageBook pageBook; - - protected Button[] radioButton; - protected SelectFilePanel selectFilePanel; - protected SelectXMLCatalogIdPanel selectXMLCatalogIdPanel; - - // ********** constructor ********** - - public SelectFileOrXMLCatalogIdPanel(Composite parent, IStructuredSelection selection) { - super(parent, SWT.NONE); - - // container group - setLayout(new GridLayout()); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = 400; - gd.widthHint = 400; - setLayoutData(gd); - - radioButton = new Button[2]; - radioButton[0] = new Button(this, SWT.RADIO); - radioButton[0].setText("Select file from Workspace"); - radioButton[0].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - radioButton[0].setSelection(true); - radioButton[0].addSelectionListener(this); - - radioButton[1] = new Button(this, SWT.RADIO); - radioButton[1].setText("Select XML Catalog entry"); - radioButton[1].setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - radioButton[1].addSelectionListener(this); - - pageBook = new PageBook(this, SWT.NONE); - pageBook.setLayoutData(new GridData(GridData.FILL_BOTH)); - - selectFilePanel = new SelectFilePanel(pageBook, selection); - this.setSingleFileViewDefaultSelection(selection); - - // Catalog - ICatalog xmlCatalog = JptJaxbUiPlugin.instance().getDefaultXMLCatalog(); - selectXMLCatalogIdPanel = new SelectXMLCatalogIdPanel(pageBook, xmlCatalog); - selectXMLCatalogIdPanel.getTableViewer().addSelectionChangedListener(new ISelectionChangedListener() { - public void selectionChanged(SelectionChangedEvent event) { - updateCompletionStateChange(); - } - }); - Dialog.applyDialogFont(parent); - pageBook.showPage(selectFilePanel.getControl()); - } - - public void setSingleFileViewDefaultSelection(ISelection selection) { - this.selectFilePanel.setDefaultSelection(selection); - } - - public IFile getFile() { - IFile result = null; - if (radioButton[0].getSelection()) { - result = selectFilePanel.getFile(); - } - return result; - } - - public ICatalogEntry getXMLCatalogEntry() { - ICatalogEntry result = null; - if (radioButton[1].getSelection()) { - result = selectXMLCatalogIdPanel.getXMLCatalogEntry(); - } - return result; - } - - public String getXMLCatalogId() { - String result = null; - if (radioButton[1].getSelection()) { - result = selectXMLCatalogIdPanel.getId(); - } - return result; - } - - public String getXMLCatalogURI() { - String result = null; - if (radioButton[1].getSelection()) { - result = selectXMLCatalogIdPanel.getURI(); - } - return result; - } - - public void setCatalogEntryType(int catalogEntryType) { - selectXMLCatalogIdPanel.setCatalogEntryType(catalogEntryType); - } - - public void setFilterExtensions(String[] filterExtensions) { - selectFilePanel.resetFilters(); - selectFilePanel.addFilterExtensions(filterExtensions); - - selectXMLCatalogIdPanel.getTableViewer().setFilterExtensions(filterExtensions); - } - - public void setListener(PanelListener listener) { - this.listener = listener; - } - - public void setVisibleHelper(boolean isVisible) { - selectFilePanel.setVisibleHelper(isVisible); - } - - public void updateCompletionStateChange() { - if (listener != null) { - listener.completionStateChanged(); - } - } - - public void widgetDefaultSelected(SelectionEvent e) { - } - - public void widgetSelected(SelectionEvent e) { - if (e.widget == radioButton[0]) { - pageBook.showPage(selectFilePanel.getControl()); - } - else { - pageBook.showPage(selectXMLCatalogIdPanel); - } - updateCompletionStateChange(); - } - - // ********** inner class ********** - - protected class SelectFilePanel extends SelectSingleFileViewFacade implements SelectSingleFileViewFacade.Listener { - protected Control control; - - public SelectFilePanel(Composite parent, IStructuredSelection selection) { - super(selection, true); - // String[] ext = {".dtd"}; - // addFilterExtensions(ext); - control = createControl(parent); - control.setLayoutData(new GridData(GridData.FILL_BOTH)); - SelectFilePanel.this.setListener(this); - } - - public Control getControl() { - return control; - } - - public void setControlComplete(boolean isComplete) { - updateCompletionStateChange(); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectSingleFileViewFacade.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectSingleFileViewFacade.java deleted file mode 100644 index 888095e447..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectSingleFileViewFacade.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.swt.widgets.Composite; - -/** - * SelectSingleFileView - * - * Façade class to change accessibility of SelectSingleFileView. - */ -public class SelectSingleFileViewFacade extends org.eclipse.wst.common.ui.internal.viewers.SelectSingleFileView { - - public static interface Listener extends org.eclipse.wst.common.ui.internal.viewers.SelectSingleFileView.Listener - {} - - public SelectSingleFileViewFacade(IStructuredSelection selection, boolean isFileMandatory) { - super(selection, isFileMandatory); - } - - public void addFilterExtensions(String[] filterExtensions) { - super.addFilterExtensions(filterExtensions); - } - - public Composite createControl(Composite parent) { - return super.createControl(parent); - } - - public IFile getFile() { - return super.getFile(); - } - - public void resetFilters() { - super.resetFilters(); - } - - public void setVisibleHelper(boolean isVisible) { - super.setVisibleHelper(isVisible); - } - - public void setDefaultSelection(ISelection selection) { - super.setDefaultSelection(selection); - } - - public void setListener(Listener listener) { - super.setListener(listener); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectXMLCatalogIdPanel.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectXMLCatalogIdPanel.java deleted file mode 100644 index 2745d0ab04..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/SelectXMLCatalogIdPanel.java +++ /dev/null @@ -1,146 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 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 - * Code originate from org.eclipse.wst.xml.ui.internal.dialogs - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen; - -import java.util.Collection; -import java.util.List; -import java.util.Vector; - -import org.eclipse.jface.viewers.ISelection; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.swt.SWT; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Label; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalog; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry; -import org.eclipse.wst.xml.core.internal.catalog.provisional.INextCatalog; - - -public class SelectXMLCatalogIdPanel extends Composite { - protected int catalogEntryType; - protected boolean doTableSizeHack = false; - - protected XMLCatalogTableViewer tableViewer; - protected ICatalog fXmlCatalog; - - public SelectXMLCatalogIdPanel(Composite parent, ICatalog xmlCatalog) { - super(parent, SWT.NONE); - this.fXmlCatalog = xmlCatalog; - - GridLayout gridLayout = new GridLayout(); - this.setLayout(gridLayout); - GridData gd = new GridData(GridData.FILL_BOTH); - gd.heightHint = 200; - gd.widthHint = 700; - this.setLayoutData(gd); - - Label label = new Label(this, SWT.NONE); - label.setText(JptJaxbUiMessages.SchemaWizardPage_xmlCatalogTableTitle); - - tableViewer = createTableViewer(this); - tableViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH)); - tableViewer.setInput("dummy"); //$NON-NLS-1$ - } - - protected XMLCatalogTableViewer createTableViewer(Composite parent) { - String headings[] = new String[2]; - headings[0] = JptJaxbUiMessages.SchemaWizardPage_xmlCatalogKeyColumn; - headings[1] = JptJaxbUiMessages.SchemaWizardPage_xmlCatalogUriColumn; - - XMLCatalogTableViewer theTableViewer = new XMLCatalogTableViewer(parent, headings) { - - protected void addXMLCatalogEntries(List list, ICatalogEntry[] entries) { - for (int i = 0; i < entries.length; i++) { - ICatalogEntry entry = entries[i]; - if (catalogEntryType == 0) { - list.add(entry); - } - else if (catalogEntryType == entry.getEntryType()) { - list.add(entry); - } - } - } - - public Collection getXMLCatalogEntries() { - List result = null; - - if ((fXmlCatalog == null) || doTableSizeHack) { - // this lets us create a table with an initial height of - // 10 rows - // otherwise we get stuck with 0 row heigh table... that's - // too small - doTableSizeHack = false; - result = new Vector(); - for (int i = 0; i < 6; i++) { - result.add(""); //$NON-NLS-1$ - } - } - else { - result = new Vector(); - INextCatalog[] nextCatalogs = fXmlCatalog.getNextCatalogs(); - for (int i = 0; i < nextCatalogs.length; i++) { - INextCatalog catalog = nextCatalogs[i]; - ICatalog referencedCatalog = catalog.getReferencedCatalog(); - if (referencedCatalog != null) { - if (JptJaxbUiPlugin.SYSTEM_CATALOG_ID.equals(referencedCatalog.getId())) { - ICatalog systemCatalog = referencedCatalog; - addXMLCatalogEntries(result, systemCatalog.getCatalogEntries()); - - } - else if (JptJaxbUiPlugin.USER_CATALOG_ID.equals(referencedCatalog.getId())) { - ICatalog userCatalog = referencedCatalog; - addXMLCatalogEntries(result, userCatalog.getCatalogEntries()); - - } - } - } - } - return result; - } - }; - return theTableViewer; - } - - - public String getId() { - ICatalogEntry entry = getXMLCatalogEntry(); - return entry != null ? entry.getKey() : null; - } - - public XMLCatalogTableViewer getTableViewer() { - return tableViewer; - } - - public String getURI() { - ICatalogEntry entry = getXMLCatalogEntry(); - return entry != null ? entry.getURI() : null; - } - - public ICatalogEntry getXMLCatalogEntry() { - ICatalogEntry result = null; - ISelection selection = tableViewer.getSelection(); - Object selectedObject = (selection instanceof IStructuredSelection) ? ((IStructuredSelection) selection).getFirstElement() : null; - if (selectedObject instanceof ICatalogEntry) { - result = (ICatalogEntry) selectedObject; - } - return result; - } - - public void setCatalogEntryType(int catalogEntryType) { - this.catalogEntryType = catalogEntryType; - tableViewer.refresh(); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/XMLCatalogTableViewer.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/XMLCatalogTableViewer.java deleted file mode 100644 index 4a24f1c36b..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/classesgen/XMLCatalogTableViewer.java +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2001, 2004 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 - * Code originate from org.eclipse.wst.xml.ui.internal.dialogs - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.classesgen; - -import java.util.Arrays; -import java.util.Collection; -import java.util.Comparator; - -import org.eclipse.jface.action.Action; -import org.eclipse.jface.action.IMenuManager; -import org.eclipse.jface.viewers.ColumnWeightData; -import org.eclipse.jface.viewers.IStructuredContentProvider; -import org.eclipse.jface.viewers.ITableLabelProvider; -import org.eclipse.jface.viewers.LabelProvider; -import org.eclipse.jface.viewers.TableLayout; -import org.eclipse.jface.viewers.TableViewer; -import org.eclipse.jface.viewers.Viewer; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.swt.SWT; -import org.eclipse.swt.graphics.Image; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.TableColumn; -import org.eclipse.wst.common.uriresolver.internal.util.URIHelper; -import org.eclipse.wst.xml.core.internal.catalog.provisional.ICatalogEntry; - -import com.ibm.icu.text.Collator; - -public class XMLCatalogTableViewer extends TableViewer { - - protected static String ERROR_STATE_KEY = "errorstatekey"; //$NON-NLS-1$ - - protected static Image dtdFileImage = JptJaxbUiPlugin.getImage("icons/full/obj16/dtdfile.gif"); //$NON-NLS-1$ - protected static Image unknownFileImage = JptJaxbUiPlugin.getImage("icons/full/obj16/text.gif"); //$NON-NLS-1$ - protected static Image xsdFileImage = JptJaxbUiPlugin.getImage("icons/full/obj16/XSDFile.gif"); //$NON-NLS-1$ - protected static Image errorImage = JptJaxbUiPlugin.getImage("icons/full/ovr16/error_ovr.gif"); //$NON-NLS-1$ - - // ********** constructor ********** - - public XMLCatalogTableViewer(Composite parent, String[] columnProperties) { - super(parent, SWT.FULL_SELECTION); - - Table table = getTable(); - table.setLinesVisible(true); - table.setHeaderVisible(true); - table.setLinesVisible(true); - - TableLayout layout = new TableLayout(); - for (int i = 0; i < columnProperties.length; i++) { - TableColumn column = new TableColumn(table, i); - column.setText(columnProperties[i]); - column.setAlignment(SWT.LEFT); - layout.addColumnData(new ColumnWeightData(50, true)); - } - table.setLayout(layout); - table.setLinesVisible(false); - - setColumnProperties(columnProperties); - - setContentProvider(new CatalogEntryContentProvider()); - setLabelProvider(new CatalogEntryLabelProvider()); - } - - public Collection getXMLCatalogEntries() { - return null; - } - - public void menuAboutToShow(IMenuManager menuManager) { - Action action = new Action("hello") { //$NON-NLS-1$ - public void run() { - System.out.println("run!"); //$NON-NLS-1$ - } - }; - menuManager.add(action); - } - - public void setFilterExtensions(String[] extensions) { - resetFilters(); - addFilter(new XMLCatalogTableViewerFilter(extensions)); - } - - // ********** inner class ********** - - public class CatalogEntryContentProvider implements IStructuredContentProvider { - - public void dispose() { - } - - public Object[] getElements(Object element) { - Object[] array = getXMLCatalogEntries().toArray(); - Comparator comparator = new Comparator() { - public int compare(Object o1, Object o2) { - int result = 0; - if ((o1 instanceof ICatalogEntry) && (o2 instanceof ICatalogEntry)) { - ICatalogEntry mappingInfo1 = (ICatalogEntry) o1; - ICatalogEntry mappingInfo2 = (ICatalogEntry) o2; - result = Collator.getInstance().compare(mappingInfo1.getKey(), mappingInfo2.getKey()); - } - return result; - } - }; - Arrays.sort(array, comparator); - return array; - } - - public void inputChanged(Viewer viewer, Object old, Object newobj) { - } - - public boolean isDeleted(Object object) { - return false; - } - } - - public class CatalogEntryLabelProvider extends LabelProvider implements ITableLabelProvider { - - public Image getColumnImage(Object object, int columnIndex) { - Image result = null; - if (columnIndex == 0) { - Image base = null; - if (object instanceof ICatalogEntry) { - ICatalogEntry catalogEntry = (ICatalogEntry) object; - String uri = catalogEntry.getURI(); - if (uri.endsWith("dtd")) { //$NON-NLS-1$ - base = dtdFileImage; - } - else if (uri.endsWith("xsd")) { //$NON-NLS-1$ - base = xsdFileImage; - } - else { - base = unknownFileImage; - } - - if (base != null) { - if (URIHelper.isReadableURI(uri, false)) { - result = base; - } - else { - // TODO... SSE port - result = base;// imageFactory.createCompositeImage(base, - // errorImage, - // ImageFactory.BOTTOM_LEFT); - } - } - } - } - return result; - } - - public String getColumnText(Object object, int columnIndex) { - String result = null; - if (object instanceof ICatalogEntry) { - ICatalogEntry catalogEntry = (ICatalogEntry) object; - result = columnIndex == 0 ? catalogEntry.getKey() : catalogEntry.getURI(); - result = URIHelper.removePlatformResourceProtocol(result); - } - return result != null ? result : ""; //$NON-NLS-1$ - } - } - - class XMLCatalogTableViewerFilter extends ViewerFilter { - protected String[] extensions; - - public XMLCatalogTableViewerFilter(String[] extensions) { - this.extensions = extensions; - } - - public boolean isFilterProperty(Object element, Object property) { - return false; - } - - public boolean select(Viewer viewer, Object parent, Object element) { - boolean result = false; - if (element instanceof ICatalogEntry) { - ICatalogEntry catalogEntry = (ICatalogEntry) element; - for (int i = 0; i < extensions.length; i++) { - if (catalogEntry.getURI().endsWith(extensions[i])) { - result = true; - break; - } - } - } - return result; - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetInstallPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetInstallPage.java deleted file mode 100644 index 23526b7272..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetInstallPage.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.facet; - -import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallDataModelProperties; - -public class JaxbFacetInstallPage - extends JaxbFacetPage - implements JaxbFacetInstallDataModelProperties { - - public JaxbFacetInstallPage() { - super("jpt.jaxb.facet.install.page"); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java deleted file mode 100644 index 861dae7f92..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetPage.java +++ /dev/null @@ -1,178 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.facet; - -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetDataModelProperties; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.common.project.facet.ui.libprov.LibraryProviderFrameworkUi; -import org.eclipse.swt.SWT; -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.ui.PlatformUI; -import org.eclipse.ui.help.IWorkbenchHelpSystem; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.web.ui.internal.wizards.DataModelFacetInstallPage; - - -public abstract class JaxbFacetPage - extends DataModelFacetInstallPage - implements JaxbFacetDataModelProperties { - - protected JaxbFacetPage(String pageName) { - super(pageName); - setTitle(JptJaxbUiMessages.JaxbFacetWizardPage_title); - setDescription(JptJaxbUiMessages.JaxbFacetWizardPage_desc); - setImageDescriptor(JptJaxbUiPlugin.getImageDescriptor(JptJaxbUiIcons.JAXB_WIZ_BANNER)); - } - - - @Override - public void setConfig(Object config) { - if (! (config instanceof IDataModel)) { - config = Platform.getAdapterManager().loadAdapter(config, IDataModel.class.getName()); - } - super.setConfig(config); - } - - @Override - protected Composite createTopLevelComposite(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - composite.setLayout(layout); - - addSubComposites(composite); - - Dialog.applyDialogFont(parent); -// PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, JpaHelpContextIds.DIALOG_JPA_FACET); - - return composite; - } - - protected void addSubComposites(Composite composite) { - new PlatformGroup(composite); - new ClasspathConfigGroup(composite); - } - - protected 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; - } - - protected 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, - LIBRARY_INSTALL_DELEGATE - }; - } - - @Override - public boolean isPageComplete() { - if (! super.isPageComplete()) { - return false; - } - else { - IStatus status = this.model.validate(); - if (status.getSeverity() == IStatus.ERROR) { - setErrorMessage(status.getMessage()); - return false; - }; - setErrorMessage(null); - return true; - } - } - - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - if (visible) { - setErrorMessage(); - } - } - - @Override - public void transferStateToConfig() { - // This method is called when "finish" is being performed. - // We remove "this" as a listener so that it will stop responding to data model changes. - // "This" listens only for validation purposes, and we are done with validation at this - // point. Furthermore, any validation at this point runs into the danger of deadlocking - // the wizard. - this.model.removeListener(this); - this.synchHelper.dispose(); - super.transferStateToConfig(); - } - - protected final IWorkbenchHelpSystem getHelpSystem() { - return PlatformUI.getWorkbench().getHelpSystem(); - } - - - protected final class PlatformGroup - { - private final Combo platformCombo; - - - public PlatformGroup(Composite composite) { - Group group = new Group(composite, SWT.NONE); - group.setText(JptJaxbUiMessages.JaxbFacetWizardPage_platformLabel); - group.setLayout(new GridLayout()); - group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); -// PlatformUI.getWorkbench().getHelpSystem().setHelp(group, JpaHelpContextIds.DIALOG_JPA_PLATFORM); - - this.platformCombo = createCombo(group, 1, true); - JaxbFacetPage.this.synchHelper.synchCombo(platformCombo, PLATFORM, null); - } - } - - - protected final class ClasspathConfigGroup { - - public ClasspathConfigGroup(Composite composite) { - - LibraryInstallDelegate librariesInstallDelegate - = (LibraryInstallDelegate) getDataModel().getProperty(LIBRARY_INSTALL_DELEGATE); - - Composite librariesComposite - = (Composite) LibraryProviderFrameworkUi.createInstallLibraryPanel( - composite, librariesInstallDelegate, - JptJaxbUiMessages.JaxbFacetWizardPage_jaxbImplementationLabel); - librariesComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); -// PlatformUI.getWorkbench().getHelpSystem().setHelp(librariesComposite, JpaHelpContextIds.NEW_JPA_PROJECT_CONTENT_PAGE_CLASSPATH); - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetVersionChangePage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetVersionChangePage.java deleted file mode 100644 index 26e1e43b0a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/facet/JaxbFacetVersionChangePage.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.facet; - -import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetVersionChangeDataModelProperties; - -public class JaxbFacetVersionChangePage - extends JaxbFacetPage - implements JaxbFacetVersionChangeDataModelProperties { - - public JaxbFacetVersionChangePage() { - super("jpt.jaxb.facet.versionChange.page"); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizard.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizard.java deleted file mode 100644 index 696d4cee32..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizard.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.proj; - -import org.eclipse.jface.resource.ImageDescriptor; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jpt.jaxb.ui.internal.wizards.proj.model.JaxbProjectCreationDataModelProvider; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -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; -import org.eclipse.wst.web.ui.internal.wizards.NewProjectDataModelFacetWizard; - - -public class JaxbProjectWizard - extends NewProjectDataModelFacetWizard { - - public JaxbProjectWizard() { - super(); - setWindowTitle(JptJaxbUiMessages.JaxbProjectWizard_title); - } - - public JaxbProjectWizard(IDataModel dataModel) { - super(dataModel); - setWindowTitle(JptJaxbUiMessages.JaxbProjectWizard_title); - } - - - @Override - protected ImageDescriptor getDefaultPageImageDescriptor() { - return JptJaxbUiPlugin.getImageDescriptor(JptJaxbUiIcons.JAXB_WIZ_BANNER); - } - - @Override - protected IWizardPage createFirstPage() { - return new JaxbProjectWizardFirstPage(model, "first.page"); //$NON-NLS-1$ - } - - @Override - protected IDataModel createDataModel() { - return DataModelFactory.createDataModel(new JaxbProjectCreationDataModelProvider()); - } - - @Override - protected IFacetedProjectTemplate getTemplate() { - return ProjectFacetsManager.getTemplate("jpt.jaxb.template"); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizardFirstPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizardFirstPage.java deleted file mode 100644 index 1a1ec07af8..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/JaxbProjectWizardFirstPage.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.proj; - -import org.eclipse.jpt.jaxb.core.JaxbFacet; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.web.ui.internal.wizards.DataModelFacetCreationWizardPage; - - -public class JaxbProjectWizardFirstPage - extends DataModelFacetCreationWizardPage { - - public JaxbProjectWizardFirstPage(IDataModel dataModel, String pageName) { - super(dataModel, pageName); - setTitle(JptJaxbUiMessages.JaxbProjectWizard_firstPage_title); - setDescription(JptJaxbUiMessages.JaxbProjectWizard_firstPage_desc); - //setInfopopID(JpaJaxbHelpContextIds.NEW_JAXB_PROJECT); - } - - - @Override - protected Composite createTopLevelComposite(Composite parent) { - final Composite top = super.createTopLevelComposite(parent); - createWorkingSetGroupPanel(top, new String[] { RESOURCE_WORKING_SET, JAVA_WORKING_SET }); - return top; - } - -// @Override -// public boolean internalLaunchNewRuntimeWizard(Shell shell, IDataModel model) { -// IFacetedProjectWorkingCopy fpwc = (IFacetedProjectWorkingCopy) model.getProperty(FACETED_PROJECT_WORKING_COPY); -// IProjectFacetVersion moduleFacet = FacetTools.getModuleFacet(fpwc); -// if (moduleFacet != null) { -// return launchNewRuntimeWizard(shell, model, moduleFacet.getProjectFacet().getId()); -// } -// else { -// return launchNewRuntimeWizard(shell, model); -// } -// } - - @Override - protected String getModuleTypeID() { - return JaxbFacet.ID; - } - - @Override - public void storeDefaultSettings() { - super.storeDefaultSettings(); - // TODO -// IDialogSettings settings = getDialogSettings(); -// if (settings != null) { -// FacetDataModelMap map = (FacetDataModelMap)model.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP); -// String facetID = getModuleFacetID(); -// IDataModel j2eeModel = map.getFacetDataModel(facetID); -// if(j2eeModel.getBooleanProperty(IJ2EEModuleFacetInstallDataModelProperties.ADD_TO_EAR)){ -// String lastEARName = j2eeModel.getStringProperty(IJ2EEModuleFacetInstallDataModelProperties.EAR_PROJECT_NAME); -// settings.put(STORE_LABEL, lastEARName); -// } -// } - } - - @Override - public void restoreDefaultSettings() { - super.restoreDefaultSettings(); - // TODO -// IDialogSettings settings = getDialogSettings(); -// if (settings != null) { -// String lastEARName = settings.get(STORE_LABEL); -// if (lastEARName != null){ -// FacetDataModelMap map = (FacetDataModelMap)model.getProperty(IFacetProjectCreationDataModelProperties.FACET_DM_MAP); -// String facetID = getModuleFacetID(); -// IDataModel j2eeModel = map.getFacetDataModel(facetID); -// j2eeModel.setProperty(IJ2EEModuleFacetInstallDataModelProperties.LAST_EAR_NAME, lastEARName); -// } -// } - } - -// @Override -// protected IDialogSettings getDialogSettings() { -// return J2EEUIPlugin.getDefault().getDialogSettings(); -// } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/model/JaxbProjectCreationDataModelProvider.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/model/JaxbProjectCreationDataModelProvider.java deleted file mode 100644 index 76747b04ab..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/proj/model/JaxbProjectCreationDataModelProvider.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.proj.model; - -import java.util.ArrayList; -import java.util.Collection; -import org.eclipse.jpt.jaxb.core.JaxbFacet; -import org.eclipse.jst.common.project.facet.core.JavaFacet; -import org.eclipse.wst.common.componentcore.datamodel.FacetProjectCreationDataModelProvider; -import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetProjectCreationDataModelProperties; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; - - -public class JaxbProjectCreationDataModelProvider - extends FacetProjectCreationDataModelProvider - implements IFacetProjectCreationDataModelProperties { - - public JaxbProjectCreationDataModelProvider() { - super(); - } - - - @Override - public void init() { - super.init(); - - Collection requiredFacets = new ArrayList(); - requiredFacets.add(JavaFacet.FACET); - requiredFacets.add(JaxbFacet.FACET); - setProperty(REQUIRED_FACETS_COLLECTION, requiredFacets); - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/AbstractJarDestinationWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/AbstractJarDestinationWizardPage.java deleted file mode 100644 index b703e1c3bb..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/AbstractJarDestinationWizardPage.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.schemagen; - -import org.eclipse.jdt.ui.jarpackager.JarPackageData; -import org.eclipse.jface.viewers.IStructuredSelection; - -/** - * Façade class to change accessibility of AbstractJarDestinationWizardPage. - */ -@SuppressWarnings("restriction") -public abstract class AbstractJarDestinationWizardPage extends org.eclipse.jdt.internal.ui.jarpackager.AbstractJarDestinationWizardPage -{ - - public AbstractJarDestinationWizardPage(String pageName, IStructuredSelection selection, JarPackageData jarPackage) { - super(pageName, selection, jarPackage); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/CheckboxTreeAndListGroup.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/CheckboxTreeAndListGroup.java deleted file mode 100644 index e551a5e32f..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/CheckboxTreeAndListGroup.java +++ /dev/null @@ -1,856 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2000, 2008 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 - * Code originate from org.eclipse.jdt.internal.ui.jarpackager - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.schemagen; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Set; - -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.CheckboxTableViewer; -import org.eclipse.jface.viewers.CheckboxTreeViewer; -import org.eclipse.jface.viewers.ICheckStateListener; -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.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.viewers.ITreeViewerListener; -import org.eclipse.jface.viewers.SelectionChangedEvent; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.viewers.TreeExpansionEvent; -import org.eclipse.jface.viewers.ViewerComparator; -import org.eclipse.jface.viewers.ViewerFilter; -import org.eclipse.swt.SWT; -import org.eclipse.swt.custom.BusyIndicator; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Table; -import org.eclipse.swt.widgets.Tree; - -/** - * Combines a CheckboxTreeViewer and CheckboxListViewer. - * All viewer selection-driven interactions are handled within this viewer - */ -public class CheckboxTreeAndListGroup implements ICheckStateListener, ISelectionChangedListener, ITreeViewerListener { - - private Object fRoot; - private Object fCurrentTreeSelection; - private List fExpandedTreeNodes= new ArrayList(); - private Map fCheckedStateStore= this.buildCheckedStateStore(); - private List fWhiteCheckedTreeItems= new ArrayList(); - private List fListeners= new ArrayList(); - - private ITreeContentProvider fTreeContentProvider; - private IStructuredContentProvider fListContentProvider; - private ILabelProvider fTreeLabelProvider; - private ILabelProvider fListLabelProvider; - - // widgets - private CheckboxTreeViewer fTreeViewer; - private CheckboxTableViewer fListViewer; - - /** - * Creates an instance of this class. Use this constructor if you wish to specify - * the width and/or height of the combined widget (to only hardcode one of the - * sizing dimensions, specify the other dimension's value as -1) - * @param parent parent composite - * @param rootObject - * @param treeContentProvider - * @param treeLabelProvider - * @param listContentProvider - * @param listLabelProvider - * @param style - * @param width the width - * @param height the height - */ - public CheckboxTreeAndListGroup( - Composite parent, - Object rootObject, - ITreeContentProvider treeContentProvider, - ILabelProvider treeLabelProvider, - IStructuredContentProvider listContentProvider, - ILabelProvider listLabelProvider, - int style, - int width, - int height) { - fRoot= rootObject; - fTreeContentProvider= treeContentProvider; - fListContentProvider= listContentProvider; - fTreeLabelProvider= treeLabelProvider; - fListLabelProvider= listLabelProvider; - createContents(parent, width, height, style); - } - /** - * This method must be called just before this window becomes visible. - */ - public void aboutToOpen() { - determineWhiteCheckedDescendents(fRoot); - checkNewTreeElements(getTreeChildren(fRoot)); - fCurrentTreeSelection= null; - - //select the first element in the list - Object[] elements= getTreeChildren(fRoot); - Object primary= elements.length > 0 ? elements[0] : null; - if (primary != null) { - fTreeViewer.setSelection(new StructuredSelection(primary)); - } - fTreeViewer.getControl().setFocus(); - } - /** - * Adds the passed listener to self's collection of clients - * that listen for changes to element checked states - * - * @param listener ICheckStateListener - */ - public void addCheckStateListener(ICheckStateListener listener) { - fListeners.add(listener); - } - /** - * Adds the receiver and all of it's ancestors to the checkedStateStore if they - * are not already there. - * @param treeElement - */ - private void addToHierarchyToCheckedStore(Object treeElement) { - - // if this tree element is already gray then its ancestors all are as well - if (!fCheckedStateStore.containsKey(treeElement)) - fCheckedStateStore.put(treeElement, new ArrayList()); - - Object parent= fTreeContentProvider.getParent(treeElement); - if (parent != null) - addToHierarchyToCheckedStore(parent); - } - /** - * Returns a boolean indicating whether all children of the passed tree element - * are currently white-checked - * - * @return boolean - * @param treeElement java.lang.Object - */ - protected boolean areAllChildrenWhiteChecked(Object treeElement) { - Object[] children= getTreeChildren(treeElement); - for (int i= 0; i < children.length; ++i) { - if (!fWhiteCheckedTreeItems.contains(children[i])) - return false; - } - - return true; - } - /** - * Returns a boolean indicating whether all list elements associated with - * the passed tree element are currently checked - * - * @return boolean - * @param treeElement java.lang.Object - */ - protected boolean areAllElementsChecked(Object treeElement) { - List checkedElements= (List)fCheckedStateStore.get(treeElement); - if (checkedElements == null) // ie.- tree item not even gray-checked - return false; - - return getListItemsSize(treeElement) == checkedElements.size(); - } - /** - * Iterates through the passed elements which are being realized for the first - * time and check each one in the tree viewer as appropriate - * @param elements - */ - protected void checkNewTreeElements(Object[] elements) { - for (int i= 0; i < elements.length; ++i) { - Object currentElement= elements[i]; - boolean checked= fCheckedStateStore.containsKey(currentElement); - fTreeViewer.setChecked(currentElement, checked); - fTreeViewer.setGrayed( - currentElement, - checked && !fWhiteCheckedTreeItems.contains(currentElement)); - } - } - /** - * An item was checked in one of self's two views. Determine which - * view this occurred in and delegate appropriately - * - * @param event CheckStateChangedEvent - */ - public void checkStateChanged(final CheckStateChangedEvent event) { - - //Potentially long operation - show a busy cursor - BusyIndicator.showWhile(fTreeViewer.getControl().getDisplay(), new Runnable() { - public void run() { - if (event.getCheckable().equals(fTreeViewer)) - treeItemChecked(event.getElement(), event.getChecked()); - else - listItemChecked(event.getElement(), event.getChecked(), true); - - notifyCheckStateChangeListeners(event); - } - }); - } - /** - * Lay out and initialize self's visual components. - * - * @param parent org.eclipse.swt.widgets.Composite - * @param width int - * @param height int - * @param style - */ - protected void createContents( - Composite parent, - int width, - int height, - int style) { - // group pane - Composite composite= new Composite(parent, style); - GridLayout layout= new GridLayout(); - layout.numColumns= 2; - layout.makeColumnsEqualWidth= true; - layout.marginHeight= 0; - layout.marginWidth= 0; - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_BOTH)); - - createTreeViewer(composite, width / 2, height); - createListViewer(composite, width / 2, height); - - initialize(); - } - /** - * Creates this group's list viewer. - * @param parent the parent composite - * @param width the width - * @param height the height - */ - protected void createListViewer(Composite parent, int width, int height) { - fListViewer= CheckboxTableViewer.newCheckList(parent, SWT.BORDER); - fListViewer.setUseHashlookup(true); - GridData data= new GridData(GridData.FILL_BOTH); - data.widthHint= width; - data.heightHint= height; - fListViewer.getTable().setLayoutData(data); - fListViewer.setContentProvider(fListContentProvider); - fListViewer.setLabelProvider(fListLabelProvider); - fListViewer.addCheckStateListener(this); - } - /** - * Creates this group's tree viewer. - * @param parent parent composite - * @param width the width - * @param height the height - */ - protected void createTreeViewer(Composite parent, int width, int height) { - Tree tree= new Tree(parent, SWT.CHECK | SWT.BORDER); - GridData data= new GridData(GridData.FILL_BOTH); - data.widthHint= width; - data.heightHint= height; - tree.setLayoutData(data); - - fTreeViewer= new CheckboxTreeViewer(tree); - fTreeViewer.setUseHashlookup(true); - fTreeViewer.setContentProvider(fTreeContentProvider); - fTreeViewer.setLabelProvider(fTreeLabelProvider); - fTreeViewer.addTreeListener(this); - fTreeViewer.addCheckStateListener(this); - fTreeViewer.addSelectionChangedListener(this); - } - /** - * Returns a boolean indicating whether the passed tree element should be - * at LEAST gray-checked. Note that this method does not consider whether - * it should be white-checked, so a specified tree item which should be - * white-checked will result in a true answer from this method. - * To determine whether a tree item should be white-checked use method - * #determineShouldBeWhiteChecked(Object). - * - * @param treeElement java.lang.Object - * @return boolean - * @see #determineShouldBeWhiteChecked(java.lang.Object) - */ - protected boolean determineShouldBeAtLeastGrayChecked(Object treeElement) { - // if any list items associated with treeElement are checked then it - // retains its gray-checked status regardless of its children - List checked= (List) fCheckedStateStore.get(treeElement); - if (checked != null && (!checked.isEmpty())) - return true; - - // if any children of treeElement are still gray-checked then treeElement - // must remain gray-checked as well - Object[] children= getTreeChildren(treeElement); - for (int i= 0; i < children.length; ++i) { - if (fCheckedStateStore.containsKey(children[i])) - return true; - } - - return false; - } - /** - * Returns a boolean indicating whether the passed tree item should be - * white-checked. - * - * @return boolean - * @param treeElement java.lang.Object - */ - protected boolean determineShouldBeWhiteChecked(Object treeElement) { - return areAllChildrenWhiteChecked(treeElement) - && areAllElementsChecked(treeElement); - } - /** - * Recursively adds appropriate tree elements to the collection of - * known white-checked tree elements. - * - * @param treeElement java.lang.Object - */ - protected void determineWhiteCheckedDescendents(Object treeElement) { - // always go through all children first since their white-checked - // statuses will be needed to determine the white-checked status for - // this tree element - Object[] children= getTreeChildren(treeElement); - for (int i= 0; i < children.length; ++i) - determineWhiteCheckedDescendents(children[i]); - - // now determine the white-checked status for this tree element - if (determineShouldBeWhiteChecked(treeElement)) - setWhiteChecked(treeElement, true); - } - /** - * Causes the tree viewer to expand all its items - */ - public void expandAll() { - fTreeViewer.expandAll(); - } - /** - * Answers a flat collection of all of the checked elements in the - * list portion of self - * - * @return java.util.Vector - */ - public Iterator getAllCheckedListItems() { - Set result= new HashSet(); - Iterator listCollectionsEnum= this.fCheckedStateStore.values().iterator(); - while (listCollectionsEnum.hasNext()) - result.addAll((List)listCollectionsEnum.next()); - return result.iterator(); - } - /** - * Answer a collection of all of the checked elements in the tree portion - * of self - * - * @return java.util.Vector - */ - public Set getAllCheckedTreeItems() { - return new HashSet(fCheckedStateStore.keySet()); - } - /** - * Answers the number of elements that have been checked by the - * user. - * - * @return int - */ - public int getCheckedElementCount() { - return fCheckedStateStore.size(); - } - /** - * Returns a count of the number of list items associated with a - * given tree item. - * - * @return int - * @param treeElement java.lang.Object - */ - protected int getListItemsSize(Object treeElement) { - Object[] elements= getListElements(treeElement); - return elements.length; - } - /** - * Gets the table that displays the folder content - * - * @return the table used to show the list - */ - public Table getTable() { - return fListViewer.getTable(); - } - /** - * Gets the tree that displays the list for a folder - * - * @return the tree used to show the folders - */ - public Tree getTree() { - return fTreeViewer.getTree(); - } - /** - * Adds the given filter to the tree viewer and - * triggers refiltering and resorting of the elements. - * - * @param filter a viewer filter - */ - public void addTreeFilter(ViewerFilter filter) { - fTreeViewer.addFilter(filter); - } - - public void removeTreeFilter(ViewerFilter filter) { - fTreeViewer.removeFilter(filter); - } - - /** - * Adds the given filter to the list viewer and - * triggers refiltering and resorting of the elements. - * - * @param filter a viewer filter - */ - public void addListFilter(ViewerFilter filter) { - fListViewer.addFilter(filter); - } - - /** - * Logically gray-check all ancestors of treeItem by ensuring that they - * appear in the checked table - * @param treeElement - */ - protected void grayCheckHierarchy(Object treeElement) { - - // if this tree element is already gray then its ancestors all are as well - if (fCheckedStateStore.containsKey(treeElement)) - return; // no need to proceed upwards from here - - fCheckedStateStore.put(treeElement, new ArrayList()); - if (determineShouldBeWhiteChecked(treeElement)) { - setWhiteChecked(treeElement, true); - } - Object parent= fTreeContentProvider.getParent(treeElement); - if (parent != null) - grayCheckHierarchy(parent); - } - /** - * Sets the initial checked state of the passed list element to true. - * @param element - */ - public void initialCheckListItem(Object element) { - Object parent= fTreeContentProvider.getParent(element); - fCurrentTreeSelection= parent; - //As this is not done from the UI then set the box for updating from the selection to false - listItemChecked(element, true, false); - updateHierarchy(parent); - } - /** - * Sets the initial checked state of the passed element to true, - * as well as to all of its children and associated list elements - * @param element - */ - public void initialCheckTreeItem(Object element) { - treeItemChecked(element, true); - } - /** - * Initializes this group's viewers after they have been laid out. - */ - protected void initialize() { - fTreeViewer.setInput(fRoot); - } - /** - * Callback that's invoked when the checked status of an item in the list - * is changed by the user. Do not try and update the hierarchy if we are building the - * initial list. - * @param listElement - * @param state - * @param updatingFromSelection - */ - protected void listItemChecked( - Object listElement, - boolean state, - boolean updatingFromSelection) { - List checkedListItems= (List) fCheckedStateStore.get(fCurrentTreeSelection); - - if (state) { - if (checkedListItems == null) { - // since the associated tree item has gone from 0 -> 1 checked - // list items, tree checking may need to be updated - grayCheckHierarchy(fCurrentTreeSelection); - checkedListItems= (List) fCheckedStateStore.get(fCurrentTreeSelection); - } - checkedListItems.add(listElement); - } else { - checkedListItems.remove(listElement); - if (checkedListItems.isEmpty()) { - // since the associated tree item has gone from 1 -> 0 checked - // list items, tree checking may need to be updated - ungrayCheckHierarchy(fCurrentTreeSelection); - } - } - - if (updatingFromSelection) - updateHierarchy(fCurrentTreeSelection); - } - /** - * Notifies all checked state listeners that the passed element has had - * its checked state changed to the passed state - * @param event - */ - protected void notifyCheckStateChangeListeners(CheckStateChangedEvent event) { - Iterator listenersEnum= fListeners.iterator(); - while (listenersEnum.hasNext()) - ((ICheckStateListener) listenersEnum.next()).checkStateChanged(event); - } - /** - *Sets the contents of the list viewer based upon the specified selected - *tree element. This also includes checking the appropriate list items. - * - *@param treeElement java.lang.Object - */ - public void populateListViewer(final Object treeElement) { - if (treeElement == fCurrentTreeSelection) - return; - fCurrentTreeSelection= treeElement; - fListViewer.setInput(treeElement); - List listItemsToCheck= (List) fCheckedStateStore.get(treeElement); - - if (listItemsToCheck != null) { - Iterator listItemsEnum= listItemsToCheck.iterator(); - while (listItemsEnum.hasNext()) - fListViewer.setChecked(listItemsEnum.next(), true); - } - } - /** - * Removes the passed listener from self's collection of clients - * that listen for changes to element checked states - * - * @param listener ICheckStateListener - */ - public void removeCheckStateListener(ICheckStateListener listener) { - fListeners.remove(listener); - } - /** - * Handles the selection of an item in the tree viewer - * - * @param event ISelection - */ - public void selectionChanged(final SelectionChangedEvent event) { - BusyIndicator.showWhile(getTable().getShell().getDisplay(), new Runnable() { - public void run() { - IStructuredSelection selection= (IStructuredSelection) event.getSelection(); - Object selectedElement= selection.getFirstElement(); - if (selectedElement == null) { - fCurrentTreeSelection= null; - fListViewer.setInput(fCurrentTreeSelection); - return; - } - populateListViewer(selectedElement); - } - }); - } - - /** - * Selects or deselect all of the elements in the tree depending on the value of the selection - * boolean. Be sure to update the displayed files as well. - * @param selection - */ - public void setAllSelections(final boolean selection) { - - //Potentially long operation - show a busy cursor - BusyIndicator.showWhile(fTreeViewer.getControl().getDisplay(), new Runnable() { - public void run() { - setTreeChecked(fRoot, selection); - fListViewer.setAllChecked(selection); - } - }); - } - - /** - * Sets the list viewer's providers to those passed - * - * @param contentProvider ITreeContentProvider - * @param labelProvider ILabelProvider - */ - public void setListProviders( - IStructuredContentProvider contentProvider, - ILabelProvider labelProvider) { - fListViewer.setContentProvider(contentProvider); - fListViewer.setLabelProvider(labelProvider); - } - /** - * Sets the sorter that is to be applied to self's list viewer - * @param comparator - */ - public void setListComparator(ViewerComparator comparator) { - fListViewer.setComparator(comparator); - } - /** - * Sets the root of the widget to be new Root. Regenerate all of the tables and lists from this - * value. - * - * @param newRoot - */ - public void setRoot(Object newRoot) { - this.fRoot= newRoot; - initialize(); - } - /** - * Sets the checked state of the passed tree element appropriately, and - * do so recursively to all of its child tree elements as well - * @param treeElement - * @param state - */ - protected void setTreeChecked(Object treeElement, boolean state) { - - if (treeElement.equals(fCurrentTreeSelection)) { - fListViewer.setAllChecked(state); - } - - if (state) { - Object[] listItems= getListElements(treeElement); - List listItemsChecked= new ArrayList(); - for (int i= 0; i < listItems.length; ++i) - listItemsChecked.add(listItems[i]); - - fCheckedStateStore.put(treeElement, listItemsChecked); - } else - fCheckedStateStore.remove(treeElement); - - setWhiteChecked(treeElement, state); - fTreeViewer.setChecked(treeElement, state); - fTreeViewer.setGrayed(treeElement, false); - - // now logically check/uncheck all children as well - Object[] children= getTreeChildren(treeElement); - for (int i= 0; i < children.length; ++i) { - setTreeChecked(children[i], state); - } - } - /** - * Sets the tree viewer's providers to those passed - * - * @param contentProvider ITreeContentProvider - * @param labelProvider ILabelProvider - */ - public void setTreeProviders( - ITreeContentProvider contentProvider, - ILabelProvider labelProvider) { - fTreeViewer.setContentProvider(contentProvider); - fTreeViewer.setLabelProvider(labelProvider); - } - /** - * Sets the sorter that is to be applied to self's tree viewer - * @param sorter - */ - public void setTreeComparator(ViewerComparator sorter) { - fTreeViewer.setComparator(sorter); - } - /** - * Adjusts the collection of references to white-checked tree elements appropriately. - * - * @param treeElement java.lang.Object - * @param isWhiteChecked boolean - */ - protected void setWhiteChecked(Object treeElement, boolean isWhiteChecked) { - if (isWhiteChecked) { - if (!fWhiteCheckedTreeItems.contains(treeElement)) - fWhiteCheckedTreeItems.add(treeElement); - } else - fWhiteCheckedTreeItems.remove(treeElement); - } - /** - * Handle the collapsing of an element in a tree viewer - * @param event - */ - public void treeCollapsed(TreeExpansionEvent event) { - // We don't need to do anything with this - } - - /** - * Handles the expansionsion of an element in a tree viewer - * @param event - */ - public void treeExpanded(TreeExpansionEvent event) { - - Object item= event.getElement(); - - // First see if the children need to be given their checked state at all. If they've - // already been realized then this won't be necessary - if (!fExpandedTreeNodes.contains(item)) { - fExpandedTreeNodes.add(item); - checkNewTreeElements(getTreeChildren(item)); - } - } - - /** - * Callback that's invoked when the checked status of an item in the tree - * is changed by the user. - * @param treeElement - * @param state - */ - protected void treeItemChecked(Object treeElement, boolean state) { - - // recursively adjust all child tree elements appropriately - setTreeChecked(treeElement, state); - - Object parent= fTreeContentProvider.getParent(treeElement); - if (parent == null) - return; - - // now update upwards in the tree hierarchy - if (state) - grayCheckHierarchy(parent); - else - ungrayCheckHierarchy(parent); - - updateHierarchy(treeElement); - } - /** - * Logically un-gray-check all ancestors of treeItem iff appropriate. - * @param treeElement - */ - protected void ungrayCheckHierarchy(Object treeElement) { - if (!determineShouldBeAtLeastGrayChecked(treeElement)) - fCheckedStateStore.remove(treeElement); - - Object parent= fTreeContentProvider.getParent(treeElement); - if (parent != null) - ungrayCheckHierarchy(parent); - } - /** - * Sets the checked state of self and all ancestors appropriately - * @param treeElement - */ - protected void updateHierarchy(Object treeElement) { - - boolean whiteChecked= determineShouldBeWhiteChecked(treeElement); - boolean shouldBeAtLeastGray= determineShouldBeAtLeastGrayChecked(treeElement); - - fTreeViewer.setChecked(treeElement, whiteChecked || shouldBeAtLeastGray); - setWhiteChecked(treeElement, whiteChecked); - if (whiteChecked) - fTreeViewer.setGrayed(treeElement, false); - else - fTreeViewer.setGrayed(treeElement, shouldBeAtLeastGray); - - // proceed up the tree element hierarchy - Object parent= fTreeContentProvider.getParent(treeElement); - if (parent != null) { - updateHierarchy(parent); - } - } - /** - * Update the selections of the tree elements in items to reflect the new - * selections provided. - * - * @param items with keys of Object (the tree element) and values of List (the selected - * list elements). - */ - public void updateSelections(final Map items) { - - //Potentially long operation - show a busy cursor - BusyIndicator.showWhile(fTreeViewer.getControl().getDisplay(), new Runnable() { - public void run() { - handleUpdateSelection(items); - } - }); - } - /** - * Returns the result of running the given elements through the filters. - * @param filters - * - * @param elements the elements to filter - * @return only the elements which all filters accept - */ - protected Object[] filter(ViewerFilter[] filters, Object[] elements) { - if (filters != null) { - ArrayList filtered = new ArrayList(elements.length); - for (int i = 0; i < elements.length; i++) { - boolean add = true; - for (int j = 0; j < filters.length; j++) { - add = filters[j].select(null, null, elements[i]); - if (!add) - break; - } - if (add) - filtered.add(elements[i]); - } - return filtered.toArray(); - } - return elements; - } - - private Object[] getTreeChildren(Object element) { - return filter(fTreeViewer.getFilters(), fTreeContentProvider.getChildren(element)); - } - - private Object[] getListElements(Object element) { - return filter(fListViewer.getFilters(), fListContentProvider.getElements(element)); - } - - public Set getWhiteCheckedTreeItems() { - return new HashSet(fWhiteCheckedTreeItems); - } - - private HashMap buildCheckedStateStore() { - return new HashMap(9); - } - - private void handleUpdateSelection(Map items) { - Iterator keyIterator= items.keySet().iterator(); - - //Update the store before the hierarchy to prevent updating parents before all of the children are done - while (keyIterator.hasNext()) { - Object key= keyIterator.next(); - //Replace the items in the checked state store with those from the supplied items - List selections= (List) items.get(key); - if (selections.size() == 0) - //If it is empty remove it from the list - fCheckedStateStore.remove(key); - else { - fCheckedStateStore.put(key, selections); - // proceed up the tree element hierarchy - Object parent= fTreeContentProvider.getParent(key); - if (parent != null) { - addToHierarchyToCheckedStore(parent); - } - } - } - - //Now update hierarchies - keyIterator= items.keySet().iterator(); - - while (keyIterator.hasNext()) { - Object key= keyIterator.next(); - updateHierarchy(key); - if (fCurrentTreeSelection != null && fCurrentTreeSelection.equals(key)) { - fListViewer.setAllChecked(false); - fListViewer.setCheckedElements(((List) items.get(key)).toArray()); - } - } - } - - /** - * Checks if an element is grey checked. - * @param object - * @return if an element is grey checked. - */ - public boolean isTreeItemGreyChecked(Object object) { - return fTreeViewer.getGrayed(object); - } - - /** - * For a given element, expand its chidren to a level. - * @param object - * @param level - */ - public void expandTreeToLevel(Object object, int level) { - fTreeViewer.expandToLevel(object, level); - } - /** - * @param selection - */ - public void setTreeSelection(ISelection selection) { - fTreeViewer.setSelection(selection); - } -} \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/NewSchemaFileWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/NewSchemaFileWizardPage.java deleted file mode 100644 index c384630021..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/NewSchemaFileWizardPage.java +++ /dev/null @@ -1,204 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.schemagen; - -import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.CONTAINER_PATH; -import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.FILE_NAME; -import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.PROJECT; -import static org.eclipse.jpt.jaxb.ui.internal.wizards.schemagen.SchemaGeneratorWizard.XSD_EXTENSION; - -import java.io.File; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jface.dialogs.IMessageProvider; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jpt.common.utility.internal.FileTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.ui.dialogs.WizardNewFileCreationPage; -import org.eclipse.ui.internal.ide.IDEWorkbenchMessages; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -/** - * NewSchemaFileWizardPage - */ -public class NewSchemaFileWizardPage extends WizardNewFileCreationPage { - - protected IDataModel dataModel; - - private IStructuredSelection initialSelection; - - static public String DEFAULT_SCHEMA_NAME = "NewXMLSchema" + XSD_EXTENSION; //$NON-NLS-1$ - - // ********** constructor ********** - - public NewSchemaFileWizardPage(String pageName, IStructuredSelection selection, IDataModel dataModel, - String title, String description) { - - super(pageName, selection); - this.initialSelection = selection; - - this.init(dataModel); - this.setTitle(title); - this.setDescription(description); - } - - protected void init(IDataModel dataModel) { - this.dataModel = dataModel; - - IProject project = this.getProjectFromInitialSelection(); - this.dataModel.setProperty(PROJECT, project); - - IPath containerPath = (IPath) this.dataModel.getProperty(CONTAINER_PATH); - if (containerPath != null) { - this.setContainerFullPath(containerPath); - } - } - - // ********** IDialogPage implementation ********** - @Override - public void createControl(Composite parent) { - super.createControl(parent); - - this.setAllowExistingResources(true); - this.setFileName(DEFAULT_SCHEMA_NAME); - } - - // ********** intra-wizard methods ********** - - public IProject getProject() { - return (IProject) this.dataModel.getProperty(PROJECT); - } - - public IPath getFilePath() { - return this.getContainerFullPath(); - } - - // ********** validation ********** - - @Override - protected boolean validatePage() { - this.dataModel.setProperty(PROJECT, this.getProjectNamed(this.getContainerName())); - this.dataModel.setProperty(CONTAINER_PATH, this.getContainerFullPath()); - this.dataModel.setProperty(FILE_NAME, this.getFileName()); - - boolean valid = super.validatePage(); - if( ! valid) { - return valid; - } - this.overrideFileExistsWarning(); - - //TODO move this validation to the dataModel - see MappingFileNewFileWizardPage - // Validate Project - valid = this.projectIsJavaProject(this.getProject()); - if( ! valid) { - this.setErrorMessage(JptJaxbUiMessages.NewSchemaFileWizardPage_errorNotJavaProject); - return valid; - } - // Validate XSD file not exists. - valid = this.xsdFileNotExists(); - if( ! valid) { - this.setMessage(JptJaxbUiMessages.NewSchemaFileWizardPage_overwriteExistingSchemas, IMessageProvider.WARNING); - return true; - } - this.setErrorMessage(null); - - return valid; - } - - // ********** internal methods ********** - - private boolean projectIsJavaProject(IProject project) { - try { - return (project != null) && (project.hasNature(JavaCore.NATURE_ID)); - } - catch (CoreException e) { - return false; - } - } - - private IProject getProjectFromInitialSelection() { - Object firstElement = initialSelection.getFirstElement(); - if(firstElement instanceof IProject) { - return (IProject)firstElement; - } - else if(firstElement instanceof IResource) { - return ((IResource) firstElement).getProject(); - } - else if(firstElement instanceof IJavaElement) { - return ((IJavaElement)firstElement).getJavaProject().getProject(); - } - return null; - } - - private IProject getProjectNamed(String projectName) { - if(StringTools.stringIsEmpty(projectName)) { - return null; - } - return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - } - - private String getContainerName() { - IPath containerPath = this.getContainerFullPath(); - if(containerPath == null) { - return null; - } - String containerName = containerPath.segment(0); - return containerName; - } - - private void overrideFileExistsWarning() { - String existsString= IDEWorkbenchMessages.ResourceGroup_nameExists; - existsString.toString(); - - existsString = existsString.substring("''{0}''".length(), existsString.length()); //$NON-NLS-1$ - String message = this.getMessage(); - if(message != null && message.endsWith(existsString)) { - this.setMessage(null); - } - } - - private boolean xsdFileNotExists() { - - return ! this.xsdFileExists(this.getContainerAbsolutePath().toFile()); - } - - private boolean xsdFileExists(File directory) { - - if(directory.listFiles() == null) { - throw new RuntimeException("Could not find directory: " + directory); //$NON-NLS-1$ - } - for(File file : directory.listFiles()) { - if (file.isDirectory()) { - continue; - } - else if(XSD_EXTENSION.equalsIgnoreCase(FileTools.extension(file))) { - return true; - } - } - return false; - } - - private IPath getContainerAbsolutePath() { - IPath projectRelativePath = this.getContainerFullPath().makeRelativeTo(this.getProject().getFullPath()); - IResource directory = (projectRelativePath.isEmpty()) ? - this.getProject() : - this.getProject().getFile(projectRelativePath); - return directory.getLocation(); - } - -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java deleted file mode 100644 index 977d6d809a..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizard.java +++ /dev/null @@ -1,267 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010, 2011 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.schemagen; - -import java.io.File; -import java.util.ArrayList; -import java.util.List; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.resources.WorkspaceJob; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.StructuredSelection; -import org.eclipse.jface.wizard.Wizard; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.FileTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.core.internal.gen.SchemaGenerator; -import org.eclipse.jpt.jaxb.core.internal.operations.SchemaFileCreationDataModelProvider; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiIcons; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.osgi.util.NLS; -import org.eclipse.ui.INewWizard; -import org.eclipse.ui.IWorkbench; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelProvider; - -/** - * SchemaGeneratorWizard - */ -public class SchemaGeneratorWizard extends Wizard implements INewWizard -{ - protected IStructuredSelection initialSelection; - private IJavaProject targetProject; - - protected IDataModel dataModel; - - private NewSchemaFileWizardPage newSchemaFileWizardPage; - - private SchemaGeneratorWizardPage schemaGenWizardPage; - - public static final String XSD_EXTENSION = ".xsd"; //$NON-NLS-1$ - - // ********** constructor ********** - - public SchemaGeneratorWizard() { - super(); - setWindowTitle(JptJaxbUiMessages.SchemaGeneratorWizard_title); - setDefaultPageImageDescriptor(JptJaxbUiPlugin.getImageDescriptor(JptJaxbUiIcons.SCHEMA_GEN_WIZ_BANNER)); - } - - public void init(IWorkbench workbench, IStructuredSelection selection) { - this.initialSelection = selection; - - if (selection == null || selection.isEmpty()) { - return; - } - this.targetProject = this.getProjectFromInitialSelection(); - this.dataModel = null; - } - - // ********** IWizard implementation ********** - - @Override - public void addPages() { - super.addPages(); - - this.newSchemaFileWizardPage = this.buildNewSchemaFileWizardPage(this.initialSelection); - this.addPage(this.newSchemaFileWizardPage); - - this.schemaGenWizardPage = this.buildSchemaGeneratorWizardPage(this.buildSelection(this.getProject())); - this.addPage(this.schemaGenWizardPage); - } - - @Override - public boolean performFinish() { - - this.targetProject = this.getJavaProject(); - - String[] sourceClassNames = this.buildSourceClassNames(this.getAllCheckedItems()); - - WorkspaceJob genSchemaJob = new GenerateSchemaJob( - this.targetProject, - sourceClassNames, - this.getTargetSchema(), - this.usesMoxy()); - genSchemaJob.schedule(); - - return true; - } - - // ********** intra-wizard methods ********** - - public IJavaProject getJavaProject() { - return this.getJavaProjectFrom(this.getProject()); - } - - // ********** internal methods ********** - - private IProject getProject() { - return this.newSchemaFileWizardPage.getProject(); - } - - private IJavaProject getProjectFromInitialSelection() { - IJavaProject project = null; - - Object firstElement = this.initialSelection.getFirstElement(); - if(firstElement instanceof IJavaElement) { - IJavaElement javaElement = (IJavaElement)firstElement; - int type = javaElement.getElementType(); - if(type == IJavaElement.JAVA_PROJECT) { - project = (IJavaProject)javaElement; - } - else if(type == IJavaElement.PACKAGE_FRAGMENT) { - project = ((IPackageFragment)javaElement).getJavaProject(); - } - } - return project; - } - - private IJavaProject getJavaProjectFrom(IProject project) { - IJavaProject javaProject = (IJavaProject)((IJavaElement)((IAdaptable)project).getAdapter(IJavaElement.class)); - if(javaProject == null) { - throw new RuntimeException("Not a Java Project"); //$NON-NLS-1$ - } - return javaProject; - } - - private String getTargetSchema() { - - IPath filePath = this.newSchemaFileWizardPage.getFilePath(); - String fileName = this.newSchemaFileWizardPage.getFileName(); - String targetSchema = filePath.toOSString() + File.separator + fileName; - if ( ! FileTools.extension(targetSchema).equalsIgnoreCase(XSD_EXTENSION)) { - targetSchema += XSD_EXTENSION; - } - - return this.makeRelativeToProjectPath(targetSchema); - } - - private String makeRelativeToProjectPath(String filePath) { - Path path = new Path(filePath); - IPath relativePath = path.makeRelativeTo(this.targetProject.getProject().getLocation()); - return relativePath.removeFirstSegments(1).toOSString(); - } - - private Object[] getAllCheckedItems() { - return this.schemaGenWizardPage.getAllCheckedItems(); - } - - private String[] buildSourceClassNames(Object[] checkedElements) { - - ArrayList classNames = new ArrayList(); - - for(Object element: checkedElements) { - IJavaElement javaElement = (IJavaElement)element; - String packageName = javaElement.getParent().getElementName(); - String elementName = javaElement.getElementName(); - String className = FileTools.stripExtension(elementName); - if(StringTools.stringIsEmpty(packageName)) { - classNames.add(className); - } - else { - classNames.add(packageName + '.' + className); - } - } - - return ArrayTools.array(classNames, new String[0]); - } - - private boolean usesMoxy() { - return this.schemaGenWizardPage.usesMoxy(); - } - - protected NewSchemaFileWizardPage buildNewSchemaFileWizardPage(IStructuredSelection selection) { - return new NewSchemaFileWizardPage( - "Page_1", selection, this.getDataModel(), //$NON-NLS-1$ - JptJaxbUiMessages.SchemaGeneratorProjectWizardPage_title, - JptJaxbUiMessages.SchemaGeneratorProjectWizardPage_desc); - } - - protected SchemaGeneratorWizardPage buildSchemaGeneratorWizardPage(IStructuredSelection selection) { - return new SchemaGeneratorWizardPage(selection); - } - - private IStructuredSelection buildSelection(IProject project) { - - List selectedElements = new ArrayList(1); - this.addProjectTo(selectedElements, project); - return new StructuredSelection(selectedElements); - } - - private void addProjectTo(List selectedElements, IProject project) { - try { - if(project != null && project.hasNature(JavaCore.NATURE_ID)) - selectedElements.add(JavaCore.create(project)); - } - catch(CoreException ex) { - // ignore selected element - } - } - - protected IDataModel getDataModel() { - if (this.dataModel == null) { - this.dataModel = DataModelFactory.createDataModel(getDefaultProvider()); - } - return this.dataModel; - } - - protected IDataModelProvider getDefaultProvider() { - return new SchemaFileCreationDataModelProvider(); - } - - // ********** generate schema job ********** - - static class GenerateSchemaJob extends WorkspaceJob { - private final IJavaProject javaProject; - private final String[] sourceClassNames; - private final String targetSchema; - private final boolean useMoxy; - - GenerateSchemaJob(IJavaProject project, String[] sourceClassNames, String targetSchema, boolean useMoxy) { - super(JptJaxbUiMessages.SchemaGeneratorWizard_generatingSchema); - - this.javaProject = project ; - this.sourceClassNames = sourceClassNames; - this.targetSchema = targetSchema; - this.useMoxy = useMoxy; - - this.setRule(ResourcesPlugin.getWorkspace().getRuleFactory().modifyRule(this.javaProject.getProject())); - } - - @Override - public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException { - SubMonitor sm = SubMonitor.convert(monitor, NLS.bind(JptJaxbUiMessages.SchemaGeneratorWizard_generateSchemaTask, this.targetSchema), 1); - try { - SchemaGenerator.generate(this.javaProject, this.targetSchema, this.sourceClassNames, this.useMoxy, sm.newChild(1)); - } - catch (OperationCanceledException e) { - return Status.CANCEL_STATUS; - } - return Status.OK_STATUS; - } - } -} \ No newline at end of file diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java deleted file mode 100644 index 70aa054611..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/internal/wizards/schemagen/SchemaGeneratorWizardPage.java +++ /dev/null @@ -1,439 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.internal.wizards.schemagen; - -import java.util.Iterator; - -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jdt.ui.JavaElementComparator; -import org.eclipse.jdt.ui.JavaElementLabelProvider; -import org.eclipse.jdt.ui.ProblemsLabelDecorator; -import org.eclipse.jdt.ui.StandardJavaElementContentProvider; -import org.eclipse.jface.dialogs.Dialog; -import org.eclipse.jface.viewers.CheckStateChangedEvent; -import org.eclipse.jface.viewers.DecoratingLabelProvider; -import org.eclipse.jface.viewers.ICheckStateListener; -import org.eclipse.jface.viewers.IStructuredSelection; -import org.eclipse.jface.viewers.ITreeContentProvider; -import org.eclipse.jface.wizard.IWizardPage; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.jaxb.core.internal.gen.SchemaGenerator; -import org.eclipse.jpt.jaxb.ui.internal.JptJaxbUiMessages; -import org.eclipse.jpt.jaxb.ui.internal.filters.ContainerFilter; -import org.eclipse.jpt.jaxb.ui.internal.filters.EmptyInnerPackageFilter; -import org.eclipse.jpt.jaxb.ui.internal.filters.NonArchiveOrExternalElementFilter; -import org.eclipse.jpt.jaxb.ui.internal.filters.NonContainerFilter; -import org.eclipse.jpt.jaxb.ui.internal.filters.NonJavaElementFilter; -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.ui.PlatformUI; -import org.osgi.framework.Bundle; - -/** - * SchemaGeneratorWizardPage - */ -public class SchemaGeneratorWizardPage extends AbstractJarDestinationWizardPage { - - private IJavaProject targetProject; - - // widgets - private SettingsGroup settingsGroup; - private NonContainerFilter projectFilter; - - private Button usesMoxyCheckBox; - private boolean usesMoxy; - - static public String JPT_ECLIPSELINK_UI_PLUGIN_ID = "org.eclipse.jpt.jpa.eclipselink.ui"; //$NON-NLS-1$ - - // other constants - private static final int SIZING_SELECTION_WIDGET_WIDTH = 480; - private static final int SIZING_SELECTION_WIDGET_HEIGHT = 150; - - public static final String HELP_CONTEXT_ID = "org.eclipse.jpt.ui.wizard_jaxbschema_classes"; //$NON-NLS-1$ - - // ********** constructor ********** - - public SchemaGeneratorWizardPage(IStructuredSelection selection) { - super("JAXB Schema Generator", selection, null); //$NON-NLS-1$ - - this.setUsesMoxy(false); - this.setTitle(JptJaxbUiMessages.SchemaGeneratorWizardPage_title); - this.setDescription(JptJaxbUiMessages.SchemaGeneratorWizardPage_desc); - } - - // ********** IDialogPage implementation ********** - @Override - public void createControl(Composite parent) { - this.setPageComplete(false); - this.setControl(this.buildTopLevelControl(parent)); - } - - @Override - public void setVisible(boolean visible) { - super.setVisible(visible); - - if(visible) { - this.updateTargetProject(); - this.updateInputGroupTreeFilter(); - - // default usesMoxy to true only when JPT EclipseLink bundle exists and MOXy is on the classpath - this.updateUsesMoxy(this.jptEclipseLinkBundleExists() && this.moxyIsOnClasspath()); - - // checkbox visible only if jpt.eclipselink.ui plugin is available - // and EclipseLink MOXy is not on the classpath - this.usesMoxyCheckBox.setVisible(this.jptEclipseLinkBundleExists() && ! this.moxyIsOnClasspath()); - - this.validateProjectClasspath(); - } - } - - // ********** IWizardPage implementation ********** - - @Override - public boolean isPageComplete() { - boolean complete = this.validateSourceGroup(); - if(complete) { - this.validateProjectClasspath(); - } - return complete; - } - - @Override - public void setPreviousPage(IWizardPage page) { - super.setPreviousPage(page); - if(this.getControl() != null) - this.updatePageCompletion(); - } - - // ********** intra-wizard methods ********** - - protected Object[] getAllCheckedItems() { - return ArrayTools.array(this.getInputGroup().getAllCheckedListItems()); - } - - protected boolean usesMoxy() { - return this.usesMoxy; - } - - // ********** validation ********** - - @Override - @SuppressWarnings("restriction") - protected void updatePageCompletion() { - super.updatePageCompletion(); - } - - @Override - protected boolean validateDestinationGroup() { - // do nothing - return true; - } - - @Override - protected boolean validateSourceGroup() { - if(this.getAllCheckedItems().length == 0) { - if(this.getErrorMessage() == null) { - this.setErrorMessage(JptJaxbUiMessages.SchemaGeneratorWizardPage_errorNoPackage); - } - return false; - } - this.setErrorMessage(null); - return true; - } - - private void validateProjectClasspath() { - if(this.targetProject == null) { // project selected available yet - return; - } - //this line will suppress the "default package" warning (which doesn't really apply here - //as the JAXB gen uses an org.example.schemaName package by default) and will clear the classpath warnings when necessary - setMessage(null); - - if( ! this.genericJaxbIsOnClasspath()) { - this.displayWarning(JptJaxbUiMessages.SchemaGeneratorWizardPage_jaxbLibrariesNotAvailable); - } - else if(this.usesMoxy() && ! this.moxyIsOnClasspath()) { - //this message is being truncated by the wizard width in some cases - this.displayWarning(JptJaxbUiMessages.SchemaGeneratorWizardPage_moxyLibrariesNotAvailable); - } - - //this code will intelligently remove our classpath warnings when they are present but no longer apply (as an alternative - //to setting the message to null continuously as is currently done) -// else if( this.getMessage() != null){ -// if (this.getMessage().equals(JptJaxbUiMessages.ClassesGeneratorWizardPage_jaxbLibrariesNotAvailable) || -// this.getMessage().equals(JptJaxbUiMessages.ClassesGeneratorWizardPage_moxyLibrariesNotAvailable)) { -// setMessage(null); -// } -// } - } - - /** - * Test if the Jaxb compiler is on the classpath. - */ - private boolean genericJaxbIsOnClasspath() { - try { - String className = SchemaGenerator.JAXB_GENERIC_SCHEMA_GEN_CLASS; - IType genClass = this.targetProject.findType(className); - return (genClass != null); - } - catch(JavaModelException e) { - throw new RuntimeException(e); - } - } - - // ********** internal methods ********** - - private Control buildTopLevelControl(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - composite.setLayout(new GridLayout()); - - PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, HELP_CONTEXT_ID); - - this.settingsGroup = new SettingsGroup(composite); - - this.usesMoxyCheckBox = this.buildUsesMoxyCheckBox(composite); - - Dialog.applyDialogFont(parent); - return composite; - } - - private void updateTargetProject() { - - this.targetProject = ((SchemaGeneratorWizard)this.getWizard()).getJavaProject(); - } - - private void updateInputGroupTreeFilter() { - this.getInputGroup().setAllSelections(false); - - if(this.projectFilter != null) { - this.getInputGroup().removeTreeFilter(this.projectFilter); - } - this.projectFilter = new NonContainerFilter(this.targetProject.getProject().getName()); - this.getInputGroup().addTreeFilter(this.projectFilter); - } - - private boolean jptEclipseLinkBundleExists() { - return (this.getJptEclipseLinkBundle() != null); - } - - private Bundle getJptEclipseLinkBundle() { - return Platform.getBundle(JPT_ECLIPSELINK_UI_PLUGIN_ID); // Cannot reference directly EL plugin. - } - - private void setUsesMoxy(boolean usesMoxy){ - this.usesMoxy = usesMoxy; - } - - private void updateUsesMoxy(boolean usesMoxy){ - this.setUsesMoxy(usesMoxy); - this.usesMoxyCheckBox.setSelection(this.usesMoxy()); - this.validateProjectClasspath(); - } - - /** - * Test if the EclipseLink Jaxb compiler is on the classpath. - */ - private boolean moxyIsOnClasspath() { - try { - String className = SchemaGenerator.JAXB_ECLIPSELINK_SCHEMA_GEN_CLASS; - IType genClass = this.targetProject.findType(className); - return (genClass != null); - } - catch (JavaModelException e) { - throw new RuntimeException(e); - } - } - - private void displayWarning(String message) { - this.setMessage(message, WARNING); - } - - private CheckboxTreeAndListGroup getInputGroup() { - return this.settingsGroup.inputGroup; - } - - // ********** overrides ********** - /** - * Returns an iterator over this page's collection of currently-specified - * elements to be exported. This is the primary element selection facility - * accessor for subclasses. - * - * @return an iterator over the collection of elements currently selected for export - */ - @Override - protected Iterator getSelectedResourcesIterator() { - return this.getInputGroup().getAllCheckedListItems(); - } - - @Override - protected void update() { - this.updatePageCompletion(); - } - - @Override - public final void saveWidgetValues() { - // do nothing - } - - @Override - protected void internalSaveWidgetValues() { - // do nothing - } - - @Override - protected void restoreWidgetValues() { - // do nothing - } - - - @Override - protected void initializeJarPackage() { - // do nothing - } - - @Override - protected void giveFocusToDestination() { - // do nothing - } - - // ********** UI components ********** - - private Button buildUsesMoxyCheckBox(Composite parent) { - - Button checkBox = new Button(parent, SWT.CHECK); - GridData gridData = new GridData(); - gridData.verticalIndent = 10; - checkBox.setLayoutData(gridData); - checkBox.setText(JptJaxbUiMessages.ClassesGeneratorWizardPage_usesMoxyImplementation); - checkBox.setSelection(this.usesMoxy()); - checkBox.addSelectionListener(this.buildUsesMoxySelectionListener()); - - return checkBox; - } - - private SelectionListener buildUsesMoxySelectionListener() { - return new SelectionListener() { - public void widgetDefaultSelected(SelectionEvent event) { - this.widgetSelected(event); - } - - public void widgetSelected(SelectionEvent event) { - updateUsesMoxy(usesMoxyCheckBox.getSelection()); - validateProjectClasspath(); - } - }; - } - - // ********** SettingsGroup class ********** - - private class SettingsGroup { - - private CheckboxTreeAndListGroup inputGroup; - - // ********** constructor ********** - - private SettingsGroup(Composite parent) { - super(); - initializeDialogUnits(parent); - - Composite composite = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(); - layout.marginWidth = 0; - layout.marginHeight = 0; - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - buildSchemaComposite(composite); - - // Input Tree - createPlainLabel(composite, JptJaxbUiMessages.SchemaGeneratorWizardPage_packages); - this.inputGroup = this.createInputGroup(composite); - - } - - protected void buildSchemaComposite(Composite parent) { - Composite composite = new Composite(parent, SWT.NULL); - GridLayout layout = new GridLayout(3, false); // false = do not make columns equal width - layout.marginWidth = 0; - layout.marginTop = 0; - layout.marginBottom = 10; - composite.setLayout(layout); - composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - - } - - // ********** UI components ********** - - /** - * Creates the checkbox tree and list for selecting resources. - * - * @param parent the parent control - */ - protected CheckboxTreeAndListGroup createInputGroup(Composite parent) { - CheckboxTreeAndListGroup checkboxTreeGroup; - - int labelFlags = JavaElementLabelProvider.SHOW_BASICS - | JavaElementLabelProvider.SHOW_OVERLAY_ICONS - | JavaElementLabelProvider.SHOW_SMALL_ICONS; - ITreeContentProvider treeContentProvider= - new StandardJavaElementContentProvider() { - @Override - public boolean hasChildren(Object element) { - // prevent the + from being shown in front of packages - return !(element instanceof IPackageFragment) && super.hasChildren(element); - } - }; - final DecoratingLabelProvider provider = new DecoratingLabelProvider(new JavaElementLabelProvider(labelFlags), new ProblemsLabelDecorator(null)); - checkboxTreeGroup = new CheckboxTreeAndListGroup( - parent, - JavaCore.create(ResourcesPlugin.getWorkspace().getRoot()), - treeContentProvider, - provider, - new StandardJavaElementContentProvider(), - provider, - SWT.NONE, - SIZING_SELECTION_WIDGET_WIDTH, - SIZING_SELECTION_WIDGET_HEIGHT); - checkboxTreeGroup.addTreeFilter(new EmptyInnerPackageFilter()); - checkboxTreeGroup.setTreeComparator(new JavaElementComparator()); - checkboxTreeGroup.setListComparator(new JavaElementComparator()); - - checkboxTreeGroup.addTreeFilter(new NonJavaElementFilter()); - checkboxTreeGroup.addTreeFilter(new NonArchiveOrExternalElementFilter()); - - checkboxTreeGroup.addListFilter(new ContainerFilter()); - checkboxTreeGroup.addListFilter(new NonJavaElementFilter()); - - checkboxTreeGroup.getTree().addListener(SWT.MouseUp, SchemaGeneratorWizardPage.this); - checkboxTreeGroup.getTable().addListener(SWT.MouseUp, SchemaGeneratorWizardPage.this); - - ICheckStateListener listener = new ICheckStateListener() { - public void checkStateChanged(CheckStateChangedEvent event) { - update(); - } - }; - - checkboxTreeGroup.addCheckStateListener(listener); - return checkboxTreeGroup; - } - } -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/navigator/JaxbNavigatorUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/navigator/JaxbNavigatorUi.java deleted file mode 100644 index 2db5a2e7aa..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/navigator/JaxbNavigatorUi.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.navigator; - -import org.eclipse.jpt.common.ui.jface.ItemLabelProvider; -import org.eclipse.jpt.common.ui.jface.ItemLabelProviderFactory; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProvider; -import org.eclipse.jpt.common.ui.jface.TreeItemContentProviderFactory; - -/** - * Defines content and label provider factories for Project Navigator view for a given JAXB project. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbNavigatorUi { - - /** - * Return the factory to create {@link TreeItemContentProvider}s - */ - TreeItemContentProviderFactory getTreeItemContentProviderFactory(); - - /** - * Return the factory to create {@link ItemLabelProvider}s - */ - ItemLabelProviderFactory getItemLabelProviderFactory(); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUi.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUi.java deleted file mode 100644 index e50e9ee980..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUi.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.platform; - -import org.eclipse.jpt.jaxb.ui.navigator.JaxbNavigatorUi; - -/** - * This interface is to be implemented by a JAXB implementation vendor to provide extensions - * to JAXB UI functionality. - *

- * Any implementation should be stateless in nature. - *

- * See the extension point: org.eclipse.jpt.jaxb.ui.jaxbPlatforms - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public interface JaxbPlatformUi { - - // ********** navigator UI ********** - - /** - * Return the {@link JaxbNavigatorUi} for this platform, - * which determines Project Explorer content - */ - JaxbNavigatorUi getNavigatorUi(); -} diff --git a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUiManager.java b/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUiManager.java deleted file mode 100644 index 1f04ed438d..0000000000 --- a/jaxb/plugins/org.eclipse.jpt.jaxb.ui/src/org/eclipse/jpt/jaxb/ui/platform/JaxbPlatformUiManager.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.ui.platform; - -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.ui.JptJaxbUiPlugin; - -/** - * Repository for {@link JaxbPlatformUi}s - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - * @see JptJaxbUiPlugin#getJaxbPlatformUiManager() - */ -public interface JaxbPlatformUiManager { - - /** - * Return the platform UI responsible for providing UI elements for the given - * JAXB platform description - */ - public JaxbPlatformUi getJaxbPlatformUi(JaxbPlatformDescription platformDesc); -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/.classpath b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/.classpath deleted file mode 100644 index 6e9ceed7e9..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/.classpath +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - - - - - - - diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/.project b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/.project deleted file mode 100644 index bcbed7f5b7..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.jpt.jaxb.core.tests - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF deleted file mode 100644 index d39856f57c..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/META-INF/MANIFEST.MF +++ /dev/null @@ -1,30 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.jaxb.core.tests;singleton:=true -Bundle-Version: 1.0.0.qualifier -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: JavaSE-1.6 -Bundle-Activator: org.eclipse.jpt.jaxb.core.tests.JptJaxbCoreTestsPlugin -Bundle-ActivationPolicy: lazy -Require-Bundle: org.eclipse.core.resources;bundle-version="[3.6.100,4.0.0)", - org.eclipse.core.runtime;bundle-version="[3.6.100,4.0.0)", - org.eclipse.jdt.core;bundle-version="[3.7.0,4.0.0)", - org.eclipse.jpt.common.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.core.tests;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.jaxb.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)", - org.eclipse.jst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)", - org.eclipse.wst.common.frameworks;bundle-version="[1.2.0,2.0.0)", - org.eclipse.wst.common.modulecore;bundle-version="[1.2.100,2.0.0)", - org.eclipse.wst.common.project.facet.core;bundle-version="[1.4.200,2.0.0)", - org.eclipse.xsd;bundle-version="[2.6.0,3.0.0)", - org.junit;bundle-version="3.8.0" -Export-Package: org.eclipse.jpt.jaxb.core.tests, - org.eclipse.jpt.jaxb.core.tests.internal;x-internal:=true, - org.eclipse.jpt.jaxb.core.tests.internal.context;x-internal:=true, - org.eclipse.jpt.jaxb.core.tests.internal.context.java;x-internal:=true, - org.eclipse.jpt.jaxb.core.tests.internal.projects;x-internal:=true, - org.eclipse.jpt.jaxb.core.tests.internal.resource;x-internal:=true, - org.eclipse.jpt.jaxb.core.tests.internal.resource.java;x-internal:=true diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/about.html b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/about.html deleted file mode 100644 index be534ba44f..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/about.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

May 02, 2008

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- - - diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/build.properties b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/build.properties deleted file mode 100644 index 08cd61be5f..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/build.properties +++ /dev/null @@ -1,18 +0,0 @@ -################################################################################ -# Copyright (c) 2011 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ -javacSource = 1.6 -javacTarget = 1.6 -bin.includes = .,\ - META-INF/,\ - about.html,\ - test.xml,\ - plugin.properties -source.. = src/ -output.. = bin/ diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/plugin.properties b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/plugin.properties deleted file mode 100644 index 01a0b633cd..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/plugin.properties +++ /dev/null @@ -1,23 +0,0 @@ -################################################################################ -# Copyright (c) 2010 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ -# ==================================================================== -# 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=Dali Java Persistence Tools - JAXB Core Tests -providerName=Eclipse Web Tools Platform diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/JptJaxbCoreTestsPlugin.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/JptJaxbCoreTestsPlugin.java deleted file mode 100644 index 6ce4ff10a5..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/JptJaxbCoreTestsPlugin.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests; - -import org.eclipse.core.runtime.Plugin; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.jaxb.core.JaxbProjectManager; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.osgi.framework.BundleContext; - -/** - * configure the core to handle events synchronously when we are - * running tests - */ -@SuppressWarnings("nls") -public class JptJaxbCoreTestsPlugin extends Plugin { - - private static JptJaxbCoreTestsPlugin INSTANCE; - - public static JptJaxbCoreTestsPlugin instance() { - return INSTANCE; - } - - - // ********** plug-in implementation ********** - - public JptJaxbCoreTestsPlugin() { - super(); - if (INSTANCE != null) { - throw new IllegalStateException(); - } - // this convention is *wack*... ~bjv - INSTANCE = this; - } - - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - JaxbProjectManager jaxbProjectManager = JptJaxbCorePlugin.getProjectManager(); - ReflectionTools.executeMethod(jaxbProjectManager, "handleEventsSynchronously"); - ReflectionTools.executeStaticMethod(JptJaxbCorePlugin.class, "doNotFlushPreferences"); - } - - @Override - public void stop(BundleContext context) throws Exception { - super.stop(context); - } - -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreTests.java deleted file mode 100644 index a018d17d59..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbCoreTests.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal; - -import junit.framework.Test; -import junit.framework.TestSuite; -import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbCoreContextModelTests; -import org.eclipse.jpt.jaxb.core.tests.internal.resource.JaxbCoreResourceModelTests; - -public class JaxbCoreTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JaxbCoreTests.class.getPackage().getName()); - suite.addTestSuite(SchemaLibraryTests.class); - suite.addTest(JaxbCoreResourceModelTests.suite()); - suite.addTest(JaxbCoreContextModelTests.suite()); - return suite; - } - - private JaxbCoreTests() { - super(); - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbTestCase.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbTestCase.java deleted file mode 100644 index f3a3c728d2..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/JaxbTestCase.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal; - -import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject; -import org.eclipse.jpt.common.core.tests.internal.utility.jdt.AnnotationTestCase; -import org.eclipse.jpt.jaxb.core.JaxbFacet; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetDataModelProperties; -import org.eclipse.jpt.jaxb.core.internal.facet.JaxbFacetInstallDataModelProvider; -import org.eclipse.jpt.jaxb.core.platform.JaxbPlatformDescription; -import org.eclipse.jpt.jaxb.core.tests.internal.projects.TestJaxbProject; -import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - - -public class JaxbTestCase - extends AnnotationTestCase { - - protected static final String BASE_PROJECT_NAME = "JaxbTestProject"; - - protected JaxbTestCase(String name) { - super(name); - } - - - @Override - protected TestJavaProject buildJavaProject(boolean autoBuild) throws Exception { - return buildJaxbProject(BASE_PROJECT_NAME, autoBuild, buildJaxbFacetInstallConfig()); - } - - protected TestJaxbProject buildJaxbProject( - String projectName, boolean autoBuild, IDataModel jaxbConfig) - throws Exception { - return TestJaxbProject.buildJaxbProject(projectName, autoBuild, jaxbConfig); - } - - protected IDataModel buildJaxbFacetInstallConfig() { - IDataModel config = DataModelFactory.createDataModel(new JaxbFacetInstallDataModelProvider()); - config.setProperty(IFacetDataModelProperties.FACET_VERSION, getProjectFacetVersion()); - config.setProperty(JaxbFacetDataModelProperties.PLATFORM, getPlatform()); - return config; - } - - protected JaxbPlatformDescription getPlatform() { - return JptJaxbCorePlugin.getDefaultPlatform(getProjectFacetVersion()); - } - - protected IProjectFacetVersion getProjectFacetVersion() { - return JaxbFacet.VERSION_2_1; - } - - @Override - protected TestJaxbProject getJavaProject() { - return (TestJaxbProject) super.getJavaProject(); - } - - protected JaxbProject getJaxbProject() { - return this.getJavaProject().getJaxbProject(); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/SchemaLibraryTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/SchemaLibraryTests.java deleted file mode 100644 index 219a879f1a..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/SchemaLibraryTests.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal; - -import java.io.ByteArrayInputStream; -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.Path; -import org.eclipse.xsd.XSDSchema; - - - -public class SchemaLibraryTests - extends JaxbTestCase { - - public SchemaLibraryTests(String name) { - super(name); - } - - // tests schema for namespace that is set in catalog, but not in project properties - public void testUnsetNamespace() { - String namespace = "http://www.eclipse.org/eclipselink/xsds/persistence/orm"; - - // test initial load - XSDSchema schema = getJaxbProject().getSchemaLibrary().getSchema(namespace); - assertNotNull(schema); - - // test cached load - schema = getJaxbProject().getSchemaLibrary().getSchema(namespace); - assertNotNull(schema); - - // test unload/reload - schema.eResource().unload(); - schema = getJaxbProject().getSchemaLibrary().getSchema(namespace); - assertNotNull(schema); - } - - // tests schema for registered uri that is set in project properties (namespace not registered in catalog) - public void testSetRegisteredUriUnregisteredNamespace() { - String namespace = "http://java.sun.com/xml/ns/persistence/orm"; - - // set namespace in project properties\ - Map schemaLocations = new HashMap(); - schemaLocations.put(namespace, "http://java.sun.com/xml/ns/persistence/orm_2_0.xsd"); - getJaxbProject().getSchemaLibrary().setSchemaLocations(schemaLocations); - - // test initial load - XSDSchema schema = getJaxbProject().getSchemaLibrary().getSchema(namespace); - assertNotNull(schema); - - // test cached load - schema = getJaxbProject().getSchemaLibrary().getSchema(namespace); - assertNotNull(schema); - - // test unload/reload - schema.eResource().unload(); - schema = getJaxbProject().getSchemaLibrary().getSchema(namespace); - assertNotNull(schema); - } - - // tests schema for registerd uri that is set in project properties (namespace already registered in catalog) - public void testSetRegisteredUriRegisteredNamespace() { - String namespace = "http://www.eclipse.org/eclipselink/xsds/persistence/orm"; - - // set namespace in project properties\ - Map schemaLocations = new HashMap(); - schemaLocations.put(namespace, "http://www.eclipse.org/eclipselink/xsds/eclipselink_orm_1_0.xsd"); - getJaxbProject().getSchemaLibrary().setSchemaLocations(schemaLocations); - - // test initial load - XSDSchema schema = getJaxbProject().getSchemaLibrary().getSchema(namespace); - assertNotNull(schema); - - // test cached load - schema = getJaxbProject().getSchemaLibrary().getSchema(namespace); - assertNotNull(schema); - - // test unload/reload - schema.eResource().unload(); - schema = getJaxbProject().getSchemaLibrary().getSchema(namespace); - assertNotNull(schema); - } - - // tests schema for unregistered uri that is set in project properties (local file) - public void testSetUnregisterdUri() throws Exception { - IFile schemaFile = getJaxbProject().getProject().getFile(new Path("customer.xsd")); - String contents = - "" - + "" - + ""; - schemaFile.create(new ByteArrayInputStream(contents.getBytes()), true, null); - - String namespace = "http://www.example.org/customer-example"; - - // set namespace in project properties\ - Map schemaLocations = new HashMap(); - schemaLocations.put(namespace, "platform:/resource/" + BASE_PROJECT_NAME + "/customer.xsd"); - getJaxbProject().getSchemaLibrary().setSchemaLocations(schemaLocations); - - // test initial load - XSDSchema schema = getJaxbProject().getSchemaLibrary().getSchema(namespace); - assertNotNull(schema); - - // test cached load - schema = getJaxbProject().getSchemaLibrary().getSchema(namespace); - assertNotNull(schema); - - // test unload/reload - schema.eResource().unload(); - schema = getJaxbProject().getSchemaLibrary().getSchema(namespace); - assertNotNull(schema); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/GenericContextRootTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/GenericContextRootTests.java deleted file mode 100644 index 1c20ba66ce..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/GenericContextRootTests.java +++ /dev/null @@ -1,344 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context; - -import java.util.Iterator; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.context.JaxbPackage; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; -import org.eclipse.jpt.jaxb.core.context.JaxbRegistry; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; - - -@SuppressWarnings("nls") -public class GenericContextRootTests extends JaxbContextModelTestCase -{ - - public GenericContextRootTests(String name) { - super(name); - } - - private ICompilationUnit createPackageInfoWithAccessorOrder() throws CoreException { - return createTestPackageInfo( - "@XmlAccessorOrder(value = XmlAccessOrder.ALPHABETICAL)", - JAXB.XML_ACCESS_ORDER, JAXB.XML_ACCESSOR_ORDER); - } - - private ICompilationUnit createUnannotatedPackageInfo(String packageName) throws CoreException { - return createTestPackageInfo(packageName); - } - - private ICompilationUnit createTypeWithXmlRegistry() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_REGISTRY); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlRegistry"); - } - }); - } - - private ICompilationUnit createTypeWithXmlType() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType"); - } - }); - } - - private ICompilationUnit createUnannotatedTestTypeNamed(String typeName) throws Exception { - return this.createTestType(PACKAGE_NAME, typeName + ".java", typeName, new DefaultAnnotationWriter()); - } - - private ICompilationUnit createTestXmlEnum() throws Exception { - return this.createTestEnum(new DefaultEnumAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ENUM); - } - @Override - public void appendEnumAnnotationTo(StringBuilder sb) { - sb.append("@XmlEnum"); - } - }); - } - - private ICompilationUnit createTestXmlEnumNoAnnotation(String enumName) throws Exception { - return this.createTestEnum(PACKAGE_NAME, enumName + ".java", enumName, new DefaultEnumAnnotationWriter()); - } - - public void testGetPackages() throws Exception { - this.createPackageInfoWithAccessorOrder(); - Iterator packages = this.getContextRoot().getPackages().iterator(); - assertEquals(1, this.getContextRoot().getPackagesSize()); - assertEquals(PACKAGE_NAME, packages.next().getName()); - assertFalse(packages.hasNext()); - - //add an unannotated package-info.java and make sure it's not added to the root context node - this.createUnannotatedPackageInfo("foo"); - packages = this.getContextRoot().getPackages().iterator(); - assertEquals(1, this.getContextRoot().getPackagesSize()); - assertEquals(PACKAGE_NAME, packages.next().getName()); - assertFalse(packages.hasNext()); - - //annotate the package-info.java and test it's added to the root context node - JavaResourcePackage fooResourcePackage = getJaxbProject().getJavaResourcePackage("foo"); - AnnotatedElement annotatedElement = this.annotatedElement(fooResourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericContextRootTests.this.addXmlAccessorTypeAnnotation(declaration, JAXB.XML_ACCESS_TYPE__PROPERTY); - } - }); - - Iterable packageNames = new TransformationIterable(this.getContextRoot().getPackages()) { - @Override - protected String transform(JaxbPackage o) { - return o.getName(); - } - }; - assertEquals(2, this.getContextRoot().getPackagesSize()); - assertTrue(CollectionTools.contains(packageNames, PACKAGE_NAME)); - assertTrue(CollectionTools.contains(packageNames, "foo")); - - //remove the annotation from the package-info.java and test it's removed from the root context node - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericContextRootTests.this.removeXmlAccessorTypeAnnotation(declaration); - } - }); - - packages = this.getContextRoot().getPackages().iterator(); - assertEquals(1, this.getContextRoot().getPackagesSize()); - assertEquals(PACKAGE_NAME, packages.next().getName()); - assertFalse(packages.hasNext()); - } - - protected void addXmlAccessorTypeAnnotation(ModifiedDeclaration declaration, String accessType) { - NormalAnnotation annotation = this.addNormalAnnotation(declaration.getDeclaration(), JAXB.XML_ACCESSOR_TYPE); - this.addEnumMemberValuePair(annotation, JAXB.XML_ACCESSOR_TYPE__VALUE, accessType); - } - - protected void removeXmlAccessorTypeAnnotation(ModifiedDeclaration declaration) { - this.removeAnnotation(declaration, JAXB.XML_ACCESSOR_TYPE); - } - - public void testGetRegistries() throws Exception { - createTypeWithXmlRegistry(); - Iterator registries = getContextRoot().getRegistries().iterator(); - assertEquals(1, CollectionTools.size(getContextRoot().getRegistries())); - assertEquals(FULLY_QUALIFIED_TYPE_NAME, registries.next().getFullyQualifiedName()); - assertFalse(registries.hasNext()); - - //add an unannotated class and make sure it's not added to the context root - createUnannotatedTestTypeNamed("Foo"); - registries = getContextRoot().getRegistries().iterator(); - assertEquals(1, CollectionTools.size(getContextRoot().getRegistries())); - assertEquals(FULLY_QUALIFIED_TYPE_NAME, registries.next().getFullyQualifiedName()); - assertFalse(registries.hasNext()); - - //annotate the class with @XmlRegistry and test it's added to the root context node - AbstractJavaResourceType fooResourceType = getJaxbProject().getJavaResourceType("test.Foo"); - AnnotatedElement annotatedElement = annotatedElement(fooResourceType); - annotatedElement.edit( - new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_REGISTRY); - } - }); - - Iterable registryNames = - new TransformationIterable( - getContextRoot().getRegistries()) { - @Override - protected String transform(JaxbRegistry o) { - return o.getFullyQualifiedName(); - } - }; - assertEquals(2, CollectionTools.size(getContextRoot().getRegistries())); - assertTrue(CollectionTools.contains(registryNames, "test.Foo")); - assertTrue(CollectionTools.contains(registryNames, FULLY_QUALIFIED_TYPE_NAME)); - - //remove the annotation from the class and test it's removed from the context root - annotatedElement.edit( - new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - removeAnnotation(declaration, JAXB.XML_REGISTRY); - } - }); - - registries = getContextRoot().getRegistries().iterator(); - assertEquals(1, CollectionTools.size(getContextRoot().getRegistries())); - assertEquals(FULLY_QUALIFIED_TYPE_NAME, registries.next().getFullyQualifiedName()); - assertFalse(registries.hasNext()); - } - - public void testGetPersistentClasses() throws Exception { - this.createTypeWithXmlType(); - Iterator persistentClasses = this.getContextRoot().getPersistentClasses().iterator(); - assertEquals(1, CollectionTools.size(getContextRoot().getPersistentClasses())); - assertEquals(FULLY_QUALIFIED_TYPE_NAME, persistentClasses.next().getFullyQualifiedName()); - assertFalse(persistentClasses.hasNext()); - - //add an unannotated class and make sure it's not added to the context root - createUnannotatedTestTypeNamed("Foo"); - persistentClasses = this.getContextRoot().getPersistentClasses().iterator(); - assertEquals(1, CollectionTools.size(getContextRoot().getPersistentClasses())); - assertEquals(FULLY_QUALIFIED_TYPE_NAME, persistentClasses.next().getFullyQualifiedName()); - assertFalse(persistentClasses.hasNext()); - - //annotate the class with @XmlType and test it's added to the context root - AbstractJavaResourceType fooResourceType = getJaxbProject().getJavaResourceType("test.Foo"); - AnnotatedElement annotatedElement = annotatedElement(fooResourceType); - annotatedElement.edit( - new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_TYPE); - } - }); - - Iterable persistentClassNames = - new TransformationIterable( - getContextRoot().getPersistentClasses()) { - @Override - protected String transform(JaxbPersistentClass o) { - return o.getFullyQualifiedName(); - } - }; - assertEquals(2, CollectionTools.size(getContextRoot().getPersistentClasses())); - assertTrue(CollectionTools.contains(persistentClassNames, "test.Foo")); - assertTrue(CollectionTools.contains(persistentClassNames, FULLY_QUALIFIED_TYPE_NAME)); - - //remove the annotation from the class and test it's removed from the root context node - annotatedElement.edit( - new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - removeAnnotation(declaration, JAXB.XML_TYPE); - } - }); - - persistentClasses = getContextRoot().getPersistentClasses().iterator(); - assertEquals(1, CollectionTools.size(getContextRoot().getPersistentClasses())); - assertEquals(FULLY_QUALIFIED_TYPE_NAME, persistentClasses.next().getFullyQualifiedName()); - assertFalse(persistentClasses.hasNext()); - } - - public void testGetPersistentEnums() throws Exception { - this.createTestXmlEnum(); - Iterator persistentEnums = this.getContextRoot().getPersistentEnums().iterator(); - assertEquals(1, CollectionTools.size(getContextRoot().getPersistentEnums())); - assertEquals(FULLY_QUALIFIED_TYPE_NAME, persistentEnums.next().getFullyQualifiedName()); - assertFalse(persistentEnums.hasNext()); - - //add an unannotated class and make sure it's not added to the context root - createTestXmlEnumNoAnnotation("Foo"); - persistentEnums = this.getContextRoot().getPersistentEnums().iterator(); - assertEquals(1, CollectionTools.size(getContextRoot().getPersistentEnums())); - assertEquals(FULLY_QUALIFIED_TYPE_NAME, persistentEnums.next().getFullyQualifiedName()); - assertFalse(persistentEnums.hasNext()); - - //annotate the class with @XmlEnum and test it's added to the context root - JavaResourceEnum fooResourceType = getJaxbProject().getJavaResourceEnum("test.Foo"); - AnnotatedElement annotatedElement = annotatedElement(fooResourceType); - annotatedElement.edit( - new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_ENUM); - } - }); - - Iterable persistentEnumNames = - new TransformationIterable( - getContextRoot().getPersistentEnums()) { - @Override - protected String transform(JaxbPersistentEnum o) { - return o.getFullyQualifiedName(); - } - }; - assertEquals(2, CollectionTools.size(getContextRoot().getPersistentEnums())); - assertTrue(CollectionTools.contains(persistentEnumNames, "test.Foo")); - assertTrue(CollectionTools.contains(persistentEnumNames, FULLY_QUALIFIED_TYPE_NAME)); - - //remove the annotation from the class and test it's removed from the root context node - annotatedElement.edit( - new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - removeAnnotation(declaration, JAXB.XML_ENUM); - } - }); - - persistentEnums = getContextRoot().getPersistentEnums().iterator(); - assertEquals(1, CollectionTools.size(getContextRoot().getPersistentEnums())); - assertEquals(FULLY_QUALIFIED_TYPE_NAME, persistentEnums.next().getFullyQualifiedName()); - assertFalse(persistentEnums.hasNext()); - } - - public void testChangeTypeKind() throws Exception { - createTypeWithXmlRegistry(); - createUnannotatedTestTypeNamed("Foo"); - AbstractJavaResourceType fooResourceType = getJaxbProject().getJavaResourceType("test.Foo"); - AnnotatedElement annotatedElement = annotatedElement(fooResourceType); - annotatedElement.edit( - new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_REGISTRY); - } - }); - - assertEquals(2, getContextRoot().getTypesSize()); - assertEquals(2, CollectionTools.size(getContextRoot().getRegistries())); - assertEquals(0, CollectionTools.size(getContextRoot().getPersistentClasses())); - - // remove the @XmlRegistry annotation and add an @XmlType annotation - annotatedElement.edit( - new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - removeAnnotation(declaration, JAXB.XML_REGISTRY); - addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_TYPE); - } - }); - - assertEquals(2, getContextRoot().getTypesSize()); - assertEquals(1, CollectionTools.size(getContextRoot().getRegistries())); - assertEquals(1, CollectionTools.size(getContextRoot().getPersistentClasses())); - - // remove the @XmlType annotation and add an @XmlRegistry annotation - annotatedElement.edit( - new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - removeAnnotation(declaration, JAXB.XML_TYPE); - addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_REGISTRY); - } - }); - - assertEquals(2, getContextRoot().getTypesSize()); - assertEquals(2, CollectionTools.size(getContextRoot().getRegistries())); - assertEquals(0, CollectionTools.size(getContextRoot().getPersistentClasses())); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/JaxbContextModelTestCase.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/JaxbContextModelTestCase.java deleted file mode 100644 index cd8c6f4f07..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/JaxbContextModelTestCase.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context; - -import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.jaxb.core.context.JaxbContextRoot; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jaxb.core.tests.internal.JaxbTestCase; - -@SuppressWarnings("nls") -public abstract class JaxbContextModelTestCase - extends JaxbTestCase { - - protected static final String BASE_PROJECT_NAME = "JaxbContextModelTestProject"; - - - protected JaxbContextModelTestCase(String name) { - super(name); - } - - @Override - protected TestJavaProject buildJavaProject(boolean autoBuild) throws Exception { - return buildJaxbProject(BASE_PROJECT_NAME, autoBuild, buildJaxbFacetInstallConfig()); - } - - protected JaxbContextRoot getContextRoot() { - return this.getJaxbProject().getContextRoot(); - } - - protected AnnotatedElement annotatedElement(JavaResourceAnnotatedElement resource) { - return (AnnotatedElement) ReflectionTools.getFieldValue(resource, "annotatedElement"); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/JaxbCoreContextModelTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/JaxbCoreContextModelTests.java deleted file mode 100644 index 7ecde92d62..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/JaxbCoreContextModelTests.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; -import org.eclipse.jpt.jaxb.core.tests.internal.context.java.JaxbCoreJavaContextModelTests; - -public class JaxbCoreContextModelTests extends TestCase -{ - public static Test suite() { - TestSuite suite = new TestSuite(JaxbCoreContextModelTests.class.getName()); - - suite.addTestSuite(GenericContextRootTests.class); - suite.addTest(JaxbCoreJavaContextModelTests.suite()); - return suite; - } - - private JaxbCoreContextModelTests() { - super(); - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapterTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapterTests.java deleted file mode 100644 index 7fc2c62d3e..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaAttributeXmlJavaTypeAdapterTests.java +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.context.XmlAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; - - -@SuppressWarnings("nls") -public class GenericJavaAttributeXmlJavaTypeAdapterTests extends JaxbContextModelTestCase -{ - - public GenericJavaAttributeXmlJavaTypeAdapterTests(String name) { - super(name); - } - - private ICompilationUnit createTypeWithXmlTypeWithXmlJavaTypeAdapter() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE, JAXB.XML_ATTRIBUTE, JAXB.XML_JAVA_TYPE_ADAPTER); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType").append(CR); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlAttribute").append(CR); - sb.append("@XmlJavaTypeAdapter"); - } - }); - } - - public void testModifyValue() throws Exception { - this.createTypeWithXmlTypeWithXmlJavaTypeAdapter(); - XmlAttributeMapping contextAttributeMapping = (XmlAttributeMapping) CollectionTools.get(CollectionTools.get(getContextRoot().getPersistentClasses(), 0).getAttributes(), 0).getMapping(); - XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextAttributeMapping.getXmlJavaTypeAdapter(); - JavaResourceAttribute resourceAttribute = contextAttributeMapping.getJavaResourceAttribute(); - - assertNull(contextXmlJavaTypeAdapter.getValue()); - - contextXmlJavaTypeAdapter.setValue("foo"); - XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertEquals("foo", javaTypeAdapterAnnotation.getValue()); - assertEquals("foo", contextXmlJavaTypeAdapter.getValue()); - - //verify the xml schema type annotation is not removed when the value is set to null - contextXmlJavaTypeAdapter.setValue(null); - javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(javaTypeAdapterAnnotation.getValue()); - assertNull(contextXmlJavaTypeAdapter.getValue()); - } - - public void testUpdateValue() throws Exception { - this.createTypeWithXmlTypeWithXmlJavaTypeAdapter(); - XmlAttributeMapping contextAttributeMapping = (XmlAttributeMapping) CollectionTools.get(CollectionTools.get(getContextRoot().getPersistentClasses(), 0).getAttributes(), 0).getMapping(); - XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextAttributeMapping.getXmlJavaTypeAdapter(); - JavaResourceAttribute resourceAttribute = contextAttributeMapping.getJavaResourceAttribute(); - - assertNull(contextXmlJavaTypeAdapter.getValue()); - - //add a value member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaAttributeXmlJavaTypeAdapterTests.this.addXmlJavaTypeAdapterTypeMemberValuePair(declaration, JAXB.XML_JAVA_TYPE_ADAPTER__VALUE, "String"); - } - }); - assertEquals("String", contextXmlJavaTypeAdapter.getValue()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaAttributeXmlJavaTypeAdapterTests.this.removeXmlJavaTypeAdapterAnnotation(declaration); - } - }); - assertNull(contextAttributeMapping.getXmlJavaTypeAdapter()); - } - - public void testModifyType() throws Exception { - this.createTypeWithXmlTypeWithXmlJavaTypeAdapter(); - XmlAttributeMapping contextAttributeMapping = (XmlAttributeMapping) CollectionTools.get(CollectionTools.get(getContextRoot().getPersistentClasses(), 0).getAttributes(), 0).getMapping(); - XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextAttributeMapping.getXmlJavaTypeAdapter(); - JavaResourceAttribute resourceAttribute = contextAttributeMapping.getJavaResourceAttribute(); - - assertEquals("int", contextXmlJavaTypeAdapter.getType()); - assertNull(contextXmlJavaTypeAdapter.getSpecifiedType()); - assertEquals("int", contextXmlJavaTypeAdapter.getDefaultType()); - - contextXmlJavaTypeAdapter.setSpecifiedType("foo"); - XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertEquals("foo", javaTypeAdapterAnnotation.getType()); - assertEquals("foo", contextXmlJavaTypeAdapter.getSpecifiedType()); - assertEquals("int", contextXmlJavaTypeAdapter.getDefaultType()); - - contextXmlJavaTypeAdapter.setSpecifiedType(null); - javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(javaTypeAdapterAnnotation.getType()); - assertEquals("int", contextXmlJavaTypeAdapter.getType()); - assertNull(contextXmlJavaTypeAdapter.getSpecifiedType()); - assertEquals("int", contextXmlJavaTypeAdapter.getDefaultType()); - } - - public void testUpdateType() throws Exception { - this.createTypeWithXmlTypeWithXmlJavaTypeAdapter(); - XmlAttributeMapping contextAttributeMapping = (XmlAttributeMapping) CollectionTools.get(CollectionTools.get(getContextRoot().getPersistentClasses(), 0).getAttributes(), 0).getMapping(); - XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextAttributeMapping.getXmlJavaTypeAdapter(); - JavaResourceAttribute resourceAttribute = contextAttributeMapping.getJavaResourceAttribute(); - - assertEquals("int", contextXmlJavaTypeAdapter.getType()); - assertNull(contextXmlJavaTypeAdapter.getSpecifiedType()); - assertEquals("int", contextXmlJavaTypeAdapter.getDefaultType()); - - //add a type member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaAttributeXmlJavaTypeAdapterTests.this.addXmlJavaTypeAdapterTypeMemberValuePair(declaration, JAXB.XML_JAVA_TYPE_ADAPTER__TYPE, "String"); - } - }); - assertEquals("String", contextXmlJavaTypeAdapter.getSpecifiedType()); - assertEquals("String", contextXmlJavaTypeAdapter.getType()); - assertEquals("int", contextXmlJavaTypeAdapter.getDefaultType()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaAttributeXmlJavaTypeAdapterTests.this.removeXmlJavaTypeAdapterAnnotation(declaration); - } - }); - assertNull(contextAttributeMapping.getXmlJavaTypeAdapter()); - } - - protected void addXmlJavaTypeAdapterTypeMemberValuePair(ModifiedDeclaration declaration, String name, String typeName) { - this.addMemberValuePair( - (MarkerAnnotation) this.getXmlJavaTypeAdapterAnnotation(declaration), - name, - this.newTypeLiteral(declaration.getAst(), typeName)); - } - - protected void addXmlJavaTypeAdapterMemberValuePair(ModifiedDeclaration declaration, String name, String value) { - this.addMemberValuePair((MarkerAnnotation) this.getXmlJavaTypeAdapterAnnotation(declaration), name, value); - } - - protected void removeXmlJavaTypeAdapterAnnotation(ModifiedDeclaration declaration) { - this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - - protected Annotation getXmlJavaTypeAdapterAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaElementFactoryMethodTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaElementFactoryMethodTests.java deleted file mode 100644 index 0adc4189ba..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaElementFactoryMethodTests.java +++ /dev/null @@ -1,404 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.context.JaxbElementFactoryMethod; -import org.eclipse.jpt.jaxb.core.context.JaxbRegistry; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementDeclAnnotation; -import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; - - -@SuppressWarnings("nls") -public class GenericJavaElementFactoryMethodTests extends JaxbContextModelTestCase -{ - - public GenericJavaElementFactoryMethodTests(String name) { - super(name); - } - - private ICompilationUnit createTypeWithXmlRegistry() throws Exception { - return this.createTestType(PACKAGE_NAME, "ObjectFactory.java", "ObjectFactory", new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_REGISTRY, JAXB.XML_ELEMENT_DECL, "javax.xml.bind.JAXBElement"); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlRegistry"); - } - - @Override - public void appendGetNameMethodAnnotationTo(StringBuilder sb) { - sb.append("@XmlElementDecl").append(CR); - sb.append(" JAXBElement createFoo(AnnotationTestType value) {return null}").append(CR); - sb.append(CR); - sb.append(" @XmlElementDecl(name=\"bar\")").append(CR); - sb.append(" JAXBElement createBar(Object value) {return null}").append(CR); - sb.append(CR); - } - }); - } - - private ICompilationUnit createTypeWithXmlType() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType").append(CR); - } - }); - } - - public void testModifyElementName() throws Exception { - createTypeWithXmlType(); - createTypeWithXmlRegistry(); - - JaxbRegistry contextRegistry = CollectionTools.get(getContextRoot().getRegistries(), 0); - - Iterator elementFactoryMethods = contextRegistry.getElementFactoryMethods().iterator(); - JaxbElementFactoryMethod elementFactoryMethod = elementFactoryMethods.next(); - JavaResourceMethod resourceMethod = elementFactoryMethod.getResourceMethod(); - assertNull(elementFactoryMethod.getElementName()); - - elementFactoryMethod.setElementName("bar"); - XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); - assertEquals("bar", elementDeclAnnotation.getName()); - assertEquals("bar", elementFactoryMethod.getElementName()); - - //verify the xml element decl annotation is not removed when the element name is set to null - elementFactoryMethod.setElementName(null); - elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); - assertNull(elementDeclAnnotation.getName()); - assertNull(elementFactoryMethod.getElementName()); - } - - public void testUpdateElementName() throws Exception { - createTypeWithXmlType(); - createTypeWithXmlRegistry(); - - JaxbRegistry contextRegistry = CollectionTools.get(getContextRoot().getRegistries(), 0); - - assertEquals(2, contextRegistry.getElementFactoryMethodsSize()); - Iterator elementFactoryMethods = contextRegistry.getElementFactoryMethods().iterator(); - JaxbElementFactoryMethod elementFactoryMethod = elementFactoryMethods.next(); - JavaResourceMethod resourceMethod = elementFactoryMethod.getResourceMethod(); - assertNull(elementFactoryMethod.getElementName()); - - //add a name member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceMethod); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaElementFactoryMethodTests.this.addXmlElementDeclMemberValuePair(declaration, JAXB.XML_ELEMENT_DECL__NAME, "foo"); - } - }); - assertEquals("foo", elementFactoryMethod.getElementName()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaElementFactoryMethodTests.this.removeXmlElementDeclAnnotation(declaration); - } - }); - assertEquals(1, contextRegistry.getElementFactoryMethodsSize()); - } - - public void testModifyDefaultValue() throws Exception { - createTypeWithXmlType(); - createTypeWithXmlRegistry(); - - JaxbRegistry contextRegistry = CollectionTools.get(getContextRoot().getRegistries(), 0); - - Iterator elementFactoryMethods = contextRegistry.getElementFactoryMethods().iterator(); - JaxbElementFactoryMethod elementFactoryMethod = elementFactoryMethods.next(); - JavaResourceMethod resourceMethod = elementFactoryMethod.getResourceMethod(); - assertNull(elementFactoryMethod.getDefaultValue()); - - elementFactoryMethod.setDefaultValue("bar"); - XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); - assertEquals("bar", elementDeclAnnotation.getDefaultValue()); - assertEquals("bar", elementFactoryMethod.getDefaultValue()); - - //verify the xml element decl annotation is not removed when the element name is set to null - elementFactoryMethod.setDefaultValue(null); - elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); - assertNull(elementDeclAnnotation.getDefaultValue()); - assertNull(elementFactoryMethod.getDefaultValue()); - } - - public void testUpdateDefaultValue() throws Exception { - createTypeWithXmlType(); - createTypeWithXmlRegistry(); - - JaxbRegistry contextRegistry = CollectionTools.get(getContextRoot().getRegistries(), 0); - - assertEquals(2, contextRegistry.getElementFactoryMethodsSize()); - Iterator elementFactoryMethods = contextRegistry.getElementFactoryMethods().iterator(); - JaxbElementFactoryMethod elementFactoryMethod = elementFactoryMethods.next(); - JavaResourceMethod resourceMethod = elementFactoryMethod.getResourceMethod(); - assertNull(elementFactoryMethod.getDefaultValue()); - - //add a name member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceMethod); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaElementFactoryMethodTests.this.addXmlElementDeclMemberValuePair(declaration, JAXB.XML_ELEMENT_DECL__DEFAULT_VALUE, "foo"); - } - }); - assertEquals("foo", elementFactoryMethod.getDefaultValue()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaElementFactoryMethodTests.this.removeXmlElementDeclAnnotation(declaration); - } - }); - assertEquals(1, contextRegistry.getElementFactoryMethodsSize()); - } - - public void testModifyScope() throws Exception { - createTypeWithXmlType(); - createTypeWithXmlRegistry(); - - JaxbRegistry contextRegistry = CollectionTools.get(getContextRoot().getRegistries(), 0); - - Iterator elementFactoryMethods = contextRegistry.getElementFactoryMethods().iterator(); - JaxbElementFactoryMethod elementFactoryMethod = elementFactoryMethods.next(); - JavaResourceMethod resourceMethod = elementFactoryMethod.getResourceMethod(); - assertNull(elementFactoryMethod.getScope()); - - elementFactoryMethod.setScope("Bar"); - XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); - assertEquals("Bar", elementDeclAnnotation.getScope()); - assertEquals("Bar", elementFactoryMethod.getScope()); - - //verify the xml element decl annotation is not removed when the element name is set to null - elementFactoryMethod.setScope(null); - elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); - assertNull(elementDeclAnnotation.getScope()); - assertNull(elementFactoryMethod.getScope()); - } - - public void testUpdateScope() throws Exception { - createTypeWithXmlType(); - createTypeWithXmlRegistry(); - - JaxbRegistry contextRegistry = CollectionTools.get(getContextRoot().getRegistries(), 0); - - assertEquals(2, contextRegistry.getElementFactoryMethodsSize()); - Iterator elementFactoryMethods = contextRegistry.getElementFactoryMethods().iterator(); - JaxbElementFactoryMethod elementFactoryMethod = elementFactoryMethods.next(); - JavaResourceMethod resourceMethod = elementFactoryMethod.getResourceMethod(); - assertNull(elementFactoryMethod.getScope()); - - //add a name member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceMethod); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaElementFactoryMethodTests.this.addXmlElementDeclTypeMemberValuePair(declaration, JAXB.XML_ELEMENT_DECL__SCOPE, "Foo"); - } - }); - assertEquals("Foo", elementFactoryMethod.getScope()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaElementFactoryMethodTests.this.removeXmlElementDeclAnnotation(declaration); - } - }); - assertEquals(1, contextRegistry.getElementFactoryMethodsSize()); - } - - public void testModifySubstitutionHeadName() throws Exception { - createTypeWithXmlType(); - createTypeWithXmlRegistry(); - - JaxbRegistry contextRegistry = CollectionTools.get(getContextRoot().getRegistries(), 0); - - Iterator elementFactoryMethods = contextRegistry.getElementFactoryMethods().iterator(); - JaxbElementFactoryMethod elementFactoryMethod = elementFactoryMethods.next(); - JavaResourceMethod resourceMethod = elementFactoryMethod.getResourceMethod(); - assertNull(elementFactoryMethod.getSubstitutionHeadName()); - - elementFactoryMethod.setSubstitutionHeadName("bar"); - XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); - assertEquals("bar", elementDeclAnnotation.getSubstitutionHeadName()); - assertEquals("bar", elementFactoryMethod.getSubstitutionHeadName()); - - //verify the xml element decl annotation is not removed when the element name is set to null - elementFactoryMethod.setSubstitutionHeadName(null); - elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); - assertNull(elementDeclAnnotation.getSubstitutionHeadName()); - assertNull(elementFactoryMethod.getSubstitutionHeadName()); - } - - public void testUpdateSubstitutionHeadName() throws Exception { - createTypeWithXmlType(); - createTypeWithXmlRegistry(); - - JaxbRegistry contextRegistry = CollectionTools.get(getContextRoot().getRegistries(), 0); - - assertEquals(2, contextRegistry.getElementFactoryMethodsSize()); - Iterator elementFactoryMethods = contextRegistry.getElementFactoryMethods().iterator(); - JaxbElementFactoryMethod elementFactoryMethod = elementFactoryMethods.next(); - JavaResourceMethod resourceMethod = elementFactoryMethod.getResourceMethod(); - assertNull(elementFactoryMethod.getSubstitutionHeadName()); - - //add a name member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceMethod); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaElementFactoryMethodTests.this.addXmlElementDeclMemberValuePair(declaration, JAXB.XML_ELEMENT_DECL__SUBSTITUTION_HEAD_NAME, "foo"); - } - }); - assertEquals("foo", elementFactoryMethod.getSubstitutionHeadName()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaElementFactoryMethodTests.this.removeXmlElementDeclAnnotation(declaration); - } - }); - assertEquals(1, contextRegistry.getElementFactoryMethodsSize()); - } - - public void testModifySubstitutionHeadNamespace() throws Exception { - createTypeWithXmlType(); - createTypeWithXmlRegistry(); - - JaxbRegistry contextRegistry = CollectionTools.get(getContextRoot().getRegistries(), 0); - - Iterator elementFactoryMethods = contextRegistry.getElementFactoryMethods().iterator(); - JaxbElementFactoryMethod elementFactoryMethod = elementFactoryMethods.next(); - JavaResourceMethod resourceMethod = elementFactoryMethod.getResourceMethod(); - assertNull(elementFactoryMethod.getSubstitutionHeadNamespace()); - - elementFactoryMethod.setSubstitutionHeadNamespace("bar"); - XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); - assertEquals("bar", elementDeclAnnotation.getSubstitutionHeadNamespace()); - assertEquals("bar", elementFactoryMethod.getSubstitutionHeadNamespace()); - - //verify the xml element decl annotation is not removed when the element name is set to null - elementFactoryMethod.setSubstitutionHeadNamespace(null); - elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); - assertNull(elementDeclAnnotation.getSubstitutionHeadNamespace()); - assertNull(elementFactoryMethod.getSubstitutionHeadNamespace()); - } - - public void testUpdateSubstitutionHeadNamespace() throws Exception { - createTypeWithXmlType(); - createTypeWithXmlRegistry(); - - JaxbRegistry contextRegistry = CollectionTools.get(getContextRoot().getRegistries(), 0); - - assertEquals(2, contextRegistry.getElementFactoryMethodsSize()); - Iterator elementFactoryMethods = contextRegistry.getElementFactoryMethods().iterator(); - JaxbElementFactoryMethod elementFactoryMethod = elementFactoryMethods.next(); - JavaResourceMethod resourceMethod = elementFactoryMethod.getResourceMethod(); - assertNull(elementFactoryMethod.getSubstitutionHeadNamespace()); - - //add a name member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceMethod); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaElementFactoryMethodTests.this.addXmlElementDeclMemberValuePair(declaration, JAXB.XML_ELEMENT_DECL__SUBSTITUTION_HEAD_NAMESPACE, "foo"); - } - }); - assertEquals("foo", elementFactoryMethod.getSubstitutionHeadNamespace()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaElementFactoryMethodTests.this.removeXmlElementDeclAnnotation(declaration); - } - }); - assertEquals(1, contextRegistry.getElementFactoryMethodsSize()); - } - - public void testModifyNamespace() throws Exception { - createTypeWithXmlType(); - createTypeWithXmlRegistry(); - - JaxbRegistry contextRegistry = CollectionTools.get(getContextRoot().getRegistries(), 0); - - Iterator elementFactoryMethods = contextRegistry.getElementFactoryMethods().iterator(); - JaxbElementFactoryMethod elementFactoryMethod = elementFactoryMethods.next(); - JavaResourceMethod resourceMethod = elementFactoryMethod.getResourceMethod(); - assertNull(elementFactoryMethod.getNamespace()); - - elementFactoryMethod.setNamespace("bar"); - XmlElementDeclAnnotation elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); - assertEquals("bar", elementDeclAnnotation.getNamespace()); - assertEquals("bar", elementFactoryMethod.getNamespace()); - - //verify the xml element decl annotation is not removed when the element name is set to null - elementFactoryMethod.setNamespace(null); - elementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(XmlElementDeclAnnotation.ANNOTATION_NAME); - assertNull(elementDeclAnnotation.getNamespace()); - assertNull(elementFactoryMethod.getNamespace()); - } - - public void testUpdateNamespace() throws Exception { - createTypeWithXmlType(); - createTypeWithXmlRegistry(); - - JaxbRegistry contextRegistry = CollectionTools.get(getContextRoot().getRegistries(), 0); - - assertEquals(2, contextRegistry.getElementFactoryMethodsSize()); - Iterator elementFactoryMethods = contextRegistry.getElementFactoryMethods().iterator(); - JaxbElementFactoryMethod elementFactoryMethod = elementFactoryMethods.next(); - JavaResourceMethod resourceMethod = elementFactoryMethod.getResourceMethod(); - assertNull(elementFactoryMethod.getNamespace()); - - //add a name member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceMethod); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaElementFactoryMethodTests.this.addXmlElementDeclMemberValuePair(declaration, JAXB.XML_ELEMENT_DECL__NAMESPACE, "foo"); - } - }); - assertEquals("foo", elementFactoryMethod.getNamespace()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaElementFactoryMethodTests.this.removeXmlElementDeclAnnotation(declaration); - } - }); - assertEquals(1, contextRegistry.getElementFactoryMethodsSize()); - } - - protected void addXmlElementDeclMemberValuePair(ModifiedDeclaration declaration, String name, String value) { - this.addMemberValuePair((MarkerAnnotation) this.getXmlElementDeclAnnotation(declaration), name, value); - } - - protected Annotation getXmlElementDeclAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlElementDeclAnnotation.ANNOTATION_NAME); - } - - protected void removeXmlElementDeclAnnotation(ModifiedDeclaration declaration) { - this.removeAnnotation(declaration, XmlElementDeclAnnotation.ANNOTATION_NAME); - } - - protected void addXmlElementDeclTypeMemberValuePair(ModifiedDeclaration declaration, String name, String typeName) { - this.addMemberValuePair( - (MarkerAnnotation) this.getXmlElementDeclAnnotation(declaration), - name, - this.newTypeLiteral(declaration.getAst(), typeName)); - } - -} \ No newline at end of file diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaEnumConstantTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaEnumConstantTests.java deleted file mode 100644 index b41c808df8..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaEnumConstantTests.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.EnumDeclaration; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.context.JaxbEnumConstant; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation; -import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; - - -@SuppressWarnings("nls") -public class GenericJavaEnumConstantTests extends JaxbContextModelTestCase -{ - - public GenericJavaEnumConstantTests(String name) { - super(name); - } - - private ICompilationUnit createEnumWithXmlEnum() throws Exception { - return createTestEnum(new DefaultEnumAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ENUM); - } - @Override - public void appendEnumAnnotationTo(StringBuilder sb) { - sb.append("@XmlEnum").append(CR); - } - }); - } - - public void testUpdateName() throws Exception { - createEnumWithXmlEnum(); - - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JaxbEnumConstant contextEnumConstant = CollectionTools.get(contextEnum.getEnumConstants(), 1); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - assertEquals("MONDAY", contextEnumConstant.getName()); - - - //add a factoryClass member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceEnum); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaEnumConstantTests.this.changeEnumConstantName((EnumDeclaration) declaration.getDeclaration(), "MONDAY", "MONDAY2"); - } - }); - contextEnumConstant = CollectionTools.get(contextEnum.getEnumConstants(), 1); - assertEquals(2, contextEnum.getEnumConstantsSize()); - assertEquals("MONDAY2", contextEnumConstant.getName()); - } - - public void testModifyValue() throws Exception { - createEnumWithXmlEnum(); - - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JaxbEnumConstant contextEnumConstant = CollectionTools.get(contextEnum.getEnumConstants(), 1); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - JavaResourceEnumConstant resourceEnumConstant = CollectionTools.get(resourceEnum.getEnumConstants(), 1); - - assertEquals("MONDAY", contextEnumConstant.getDefaultValue()); - assertEquals("MONDAY", contextEnumConstant.getValue()); - assertNull(contextEnumConstant.getSpecifiedValue()); - - contextEnumConstant.setSpecifiedValue("foo"); - XmlEnumValueAnnotation enumValueAnnotation = (XmlEnumValueAnnotation) resourceEnumConstant.getAnnotation(XmlEnumValueAnnotation.ANNOTATION_NAME); - assertEquals("foo", enumValueAnnotation.getValue()); - assertEquals("MONDAY", contextEnumConstant.getDefaultValue()); - assertEquals("foo", contextEnumConstant.getValue()); - assertEquals("foo", contextEnumConstant.getSpecifiedValue()); - - contextEnumConstant.setSpecifiedValue(null); - enumValueAnnotation = (XmlEnumValueAnnotation) resourceEnumConstant.getAnnotation(XmlEnumValueAnnotation.ANNOTATION_NAME); - assertNull(enumValueAnnotation.getValue()); - assertEquals("MONDAY", contextEnumConstant.getDefaultValue()); - assertEquals("MONDAY", contextEnumConstant.getValue()); - assertNull(contextEnumConstant.getSpecifiedValue()); - } - - public void testUpdateValue() throws Exception { - createEnumWithXmlEnum(); - - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JaxbEnumConstant contextEnumConstant = CollectionTools.get(contextEnum.getEnumConstants(), 1); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - JavaResourceEnumConstant resourceEnumConstant = CollectionTools.get(resourceEnum.getEnumConstants(), 1); - - assertEquals("MONDAY", contextEnumConstant.getDefaultValue()); - assertEquals("MONDAY", contextEnumConstant.getValue()); - assertNull(contextEnumConstant.getSpecifiedValue()); - - //add an XmlEnumValue annotation - AnnotatedElement annotatedElement = this.annotatedElement(resourceEnumConstant); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation enumValueAnnotation = GenericJavaEnumConstantTests.this.addNormalAnnotation(declaration.getDeclaration(), JAXB.XML_ENUM_VALUE); - GenericJavaEnumConstantTests.this.addMemberValuePair(enumValueAnnotation, JAXB.XML_ENUM_VALUE__VALUE, "foo"); - } - }); - - assertEquals("MONDAY", contextEnumConstant.getDefaultValue()); - assertEquals("foo", contextEnumConstant.getValue()); - assertEquals("foo", contextEnumConstant.getSpecifiedValue()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaEnumConstantTests.this.removeAnnotation(declaration, JAXB.XML_ENUM_VALUE); - } - }); - assertEquals("MONDAY", contextEnumConstant.getDefaultValue()); - assertEquals("MONDAY", contextEnumConstant.getValue()); - assertNull(contextEnumConstant.getSpecifiedValue()); - } - -} \ No newline at end of file diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageInfoTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageInfoTests.java deleted file mode 100644 index 301e4e8924..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageInfoTests.java +++ /dev/null @@ -1,797 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context.java; - -import java.util.Iterator; -import java.util.ListIterator; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; -import org.eclipse.jpt.jaxb.core.context.XmlAccessOrder; -import org.eclipse.jpt.jaxb.core.context.XmlAccessType; -import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter; -import org.eclipse.jpt.jaxb.core.context.XmlSchemaType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; -import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; - - -@SuppressWarnings("nls") -public class GenericJavaPackageInfoTests extends JaxbContextModelTestCase -{ - - public GenericJavaPackageInfoTests(String name) { - super(name); - } - - private ICompilationUnit createPackageInfoWithAccessorType() throws CoreException { - return createTestPackageInfo( - "@XmlAccessorType(value = XmlAccessType.PROPERTY)", - JAXB.XML_ACCESS_TYPE, JAXB.XML_ACCESSOR_TYPE); - } - - private ICompilationUnit createPackageInfoWithAccessorOrder() throws CoreException { - return createTestPackageInfo( - "@XmlAccessorOrder(value = XmlAccessOrder.ALPHABETICAL)", - JAXB.XML_ACCESS_ORDER, JAXB.XML_ACCESSOR_ORDER); - } - - public void testModifyAccessType() throws Exception { - createPackageInfoWithAccessorType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertEquals(XmlAccessType.PROPERTY, contextPackageInfo.getSpecifiedAccessType()); - assertEquals(XmlAccessType.PROPERTY, contextPackageInfo.getAccessType()); - assertEquals(XmlAccessType.PUBLIC_MEMBER, contextPackageInfo.getDefaultAccessType()); - - contextPackageInfo.setSpecifiedAccessType(XmlAccessType.FIELD); - XmlAccessorTypeAnnotation accessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourcePackage.getAnnotation(XmlAccessorTypeAnnotation.ANNOTATION_NAME); - assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType.FIELD, accessorTypeAnnotation.getValue()); - assertEquals(XmlAccessType.FIELD, contextPackageInfo.getAccessType()); - - contextPackageInfo.setSpecifiedAccessType(XmlAccessType.PUBLIC_MEMBER); - assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType.PUBLIC_MEMBER, accessorTypeAnnotation.getValue()); - assertEquals(XmlAccessType.PUBLIC_MEMBER, contextPackageInfo.getAccessType()); - - contextPackageInfo.setSpecifiedAccessType(XmlAccessType.NONE); - assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType.NONE, accessorTypeAnnotation.getValue()); - assertEquals(XmlAccessType.NONE, contextPackageInfo.getAccessType()); - - contextPackageInfo.setSpecifiedAccessType(null); - accessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourcePackage.getAnnotation(XmlAccessorTypeAnnotation.ANNOTATION_NAME); - assertNull(accessorTypeAnnotation.getValue()); - assertNull(contextPackageInfo.getSpecifiedAccessType()); - assertEquals(XmlAccessType.PUBLIC_MEMBER, contextPackageInfo.getAccessType()); - assertEquals(XmlAccessType.PUBLIC_MEMBER, contextPackageInfo.getDefaultAccessType()); - } - - public void testUpdateAccessType() throws Exception { - createPackageInfoWithAccessorType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertEquals(XmlAccessType.PROPERTY, contextPackageInfo.getSpecifiedAccessType()); - assertEquals(XmlAccessType.PROPERTY, contextPackageInfo.getAccessType()); - assertEquals(XmlAccessType.PUBLIC_MEMBER, contextPackageInfo.getDefaultAccessType()); - - //set the accesser type value to FIELD - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.setEnumMemberValuePair(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME, JAXB.XML_ACCESS_TYPE__FIELD); - } - }); - assertEquals(XmlAccessType.FIELD, contextPackageInfo.getAccessType()); - - //set the accesser type value to PUBLIC_MEMBER - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.setEnumMemberValuePair(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - } - }); - assertEquals(XmlAccessType.PUBLIC_MEMBER, contextPackageInfo.getAccessType()); - - //set the accesser type value to NONE - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.setEnumMemberValuePair(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME, JAXB.XML_ACCESS_TYPE__NONE); - } - }); - assertEquals(XmlAccessType.NONE, contextPackageInfo.getAccessType()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.removeXmlAccessorTypeAnnotation(declaration); - } - }); - assertNull(contextPackageInfo.getSpecifiedAccessType()); - assertEquals(XmlAccessType.PUBLIC_MEMBER, contextPackageInfo.getAccessType()); - assertEquals(XmlAccessType.PUBLIC_MEMBER, contextPackageInfo.getDefaultAccessType()); - } - - public void testModifyAccessOrder() throws Exception { - createPackageInfoWithAccessorOrder(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertEquals(XmlAccessOrder.ALPHABETICAL, contextPackageInfo.getSpecifiedAccessOrder()); - assertEquals(XmlAccessOrder.ALPHABETICAL, contextPackageInfo.getAccessOrder()); - assertEquals(XmlAccessOrder.UNDEFINED, contextPackageInfo.getDefaultAccessOrder()); - - contextPackageInfo.setSpecifiedAccessOrder(XmlAccessOrder.UNDEFINED); - XmlAccessorOrderAnnotation accessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourcePackage.getAnnotation(XmlAccessorOrderAnnotation.ANNOTATION_NAME); - assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder.UNDEFINED, accessorOrderAnnotation.getValue()); - assertEquals(XmlAccessOrder.UNDEFINED, contextPackageInfo.getAccessOrder()); - - contextPackageInfo.setSpecifiedAccessOrder(null); - accessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourcePackage.getAnnotation(XmlAccessorOrderAnnotation.ANNOTATION_NAME); - assertNull(accessorOrderAnnotation.getValue()); - assertNull(contextPackageInfo.getSpecifiedAccessOrder()); - assertEquals(XmlAccessOrder.UNDEFINED, contextPackageInfo.getAccessOrder()); - assertEquals(XmlAccessOrder.UNDEFINED, contextPackageInfo.getDefaultAccessOrder()); - } - - public void testUpdateAccessOrder() throws Exception { - createPackageInfoWithAccessorOrder(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertEquals(XmlAccessOrder.ALPHABETICAL, contextPackageInfo.getSpecifiedAccessOrder()); - assertEquals(XmlAccessOrder.ALPHABETICAL, contextPackageInfo.getAccessOrder()); - assertEquals(XmlAccessOrder.UNDEFINED, contextPackageInfo.getDefaultAccessOrder()); - - //set the access order value to UNDEFINED - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.setEnumMemberValuePair(declaration, XmlAccessorOrderAnnotation.ANNOTATION_NAME, JAXB.XML_ACCESS_ORDER__UNDEFINED); - } - }); - assertEquals(XmlAccessOrder.UNDEFINED, contextPackageInfo.getAccessOrder()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.removeXmlAccessorOrderAnnotation(declaration); - } - }); - assertNull(contextPackageInfo.getSpecifiedAccessOrder()); - assertEquals(XmlAccessOrder.UNDEFINED, contextPackageInfo.getAccessOrder()); - assertEquals(XmlAccessOrder.UNDEFINED, contextPackageInfo.getDefaultAccessOrder()); - } - - //add another package annotation so that the context model object doesn't get removed when - //removing the XmlAccessorType annotation. Only "annotated" packages are added to the context model - protected void removeXmlAccessorTypeAnnotation(ModifiedDeclaration declaration) { - this.addMarkerAnnotation(declaration.getDeclaration(), XmlSchemaAnnotation.ANNOTATION_NAME); - this.removeAnnotation(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME); - } - - //add another package annotation so that the context model object doesn't get removed when - //removing the XmlAccessorOrder annotation. Only "annotated" packages are added to the context model - protected void removeXmlAccessorOrderAnnotation(ModifiedDeclaration declaration) { - this.addMarkerAnnotation(declaration.getDeclaration(), XmlSchemaAnnotation.ANNOTATION_NAME); - this.removeAnnotation(declaration, XmlAccessorOrderAnnotation.ANNOTATION_NAME); - } - - public void testGetXmlSchemaTypes() throws Exception { - this.createPackageInfoWithAccessorOrder(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - ListIterable xmlSchemaTypes = contextPackageInfo.getXmlSchemaTypes(); - assertFalse(xmlSchemaTypes.iterator().hasNext()); - - //add 2 XmlSchemaTypes - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.addXmlSchemaType(declaration, 0, "bar"); - GenericJavaPackageInfoTests.this.addXmlSchemaType(declaration, 1, "foo"); - } - }); - - xmlSchemaTypes = contextPackageInfo.getXmlSchemaTypes(); - ListIterator xmlSchemaTypesIterator = xmlSchemaTypes.iterator(); - assertTrue(xmlSchemaTypesIterator.hasNext()); - assertEquals("bar", xmlSchemaTypesIterator.next().getName()); - assertEquals("foo", xmlSchemaTypesIterator.next().getName()); - assertFalse(xmlSchemaTypesIterator.hasNext()); - } - - protected void addXmlSchemaType(ModifiedDeclaration declaration, int index, String name) { - NormalAnnotation arrayElement = this.newXmlSchemaTypeAnnotation(declaration.getAst(), name); - this.addArrayElement(declaration, JAXB.XML_SCHEMA_TYPES, index, JAXB.XML_SCHEMA_TYPES__VALUE, arrayElement); - } - - protected NormalAnnotation newXmlSchemaTypeAnnotation(AST ast, String name) { - NormalAnnotation annotation = this.newNormalAnnotation(ast, JAXB.XML_SCHEMA_TYPE); - this.addMemberValuePair(annotation, JAXB.XML_SCHEMA_TYPE__NAME, name); - return annotation; - } - - public void testGetXmlSchemaTypesSize() throws Exception { - this.createPackageInfoWithAccessorOrder(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertEquals(0, contextPackageInfo.getXmlSchemaTypesSize()); - - //add 2 XmlSchemaTypes - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.addXmlSchemaType(declaration, 0, "bar"); - GenericJavaPackageInfoTests.this.addXmlSchemaType(declaration, 1, "foo"); - } - }); - assertEquals(2, contextPackageInfo.getXmlSchemaTypesSize()); - } - - public void testAddXmlSchemaType() throws Exception { - //create a package info with an annotation other than XmlSchema to test - //adding things to the null schema annotation - this.createPackageInfoWithAccessorType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - contextPackageInfo.addXmlSchemaType(0).setName("bar"); - contextPackageInfo.addXmlSchemaType(0).setName("foo"); - contextPackageInfo.addXmlSchemaType(0).setName("baz"); - - Iterator xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage); - - assertEquals("baz", xmlSchemaTypes.next().getName()); - assertEquals("foo", xmlSchemaTypes.next().getName()); - assertEquals("bar", xmlSchemaTypes.next().getName()); - assertFalse(xmlSchemaTypes.hasNext()); - } - - @SuppressWarnings("unchecked") - protected Iterator getSchemaTypeAnnotations(JavaResourcePackage resourcePackage) { - return (Iterator) resourcePackage.getAnnotations(JAXB.XML_SCHEMA_TYPE).iterator(); - } - - public void testAddXmlSchemaType2() throws Exception { - //create a package info with an annotation other than XmlSchema to test - //adding things to the null schema annotation - this.createPackageInfoWithAccessorType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - contextPackageInfo.addXmlSchemaType(0).setName("bar"); - contextPackageInfo.addXmlSchemaType(1).setName("foo"); - contextPackageInfo.addXmlSchemaType(0).setName("baz"); - - Iterator xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage); - - assertEquals("baz", xmlSchemaTypes.next().getName()); - assertEquals("bar", xmlSchemaTypes.next().getName()); - assertEquals("foo", xmlSchemaTypes.next().getName()); - assertFalse(xmlSchemaTypes.hasNext()); - } - - public void testRemoveXmlSchemaType() throws Exception { - this.createPackageInfoWithAccessorType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - contextPackageInfo.addXmlSchemaType(0).setName("bar"); - contextPackageInfo.addXmlSchemaType(1).setName("foo"); - contextPackageInfo.addXmlSchemaType(2).setName("baz"); - - Iterator xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage); - assertEquals("bar", xmlSchemaTypes.next().getName()); - assertEquals("foo", xmlSchemaTypes.next().getName()); - assertEquals("baz", xmlSchemaTypes.next().getName()); - assertFalse(xmlSchemaTypes.hasNext()); - - contextPackageInfo.removeXmlSchemaType(1); - - xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage); - assertEquals("bar", xmlSchemaTypes.next().getName()); - assertEquals("baz", xmlSchemaTypes.next().getName()); - assertFalse(xmlSchemaTypes.hasNext()); - - contextPackageInfo.removeXmlSchemaType(1); - xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage); - assertEquals("bar", xmlSchemaTypes.next().getName()); - assertFalse(xmlSchemaTypes.hasNext()); - - contextPackageInfo.removeXmlSchemaType(0); - xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage); - assertFalse(xmlSchemaTypes.hasNext()); - } - - public void testMoveXmlSchemaType() throws Exception { - this.createPackageInfoWithAccessorType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - contextPackageInfo.addXmlSchemaType(0).setName("bar"); - contextPackageInfo.addXmlSchemaType(1).setName("foo"); - contextPackageInfo.addXmlSchemaType(2).setName("baz"); - - Iterator xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage); - assertEquals("bar", xmlSchemaTypes.next().getName()); - assertEquals("foo", xmlSchemaTypes.next().getName()); - assertEquals("baz", xmlSchemaTypes.next().getName()); - assertFalse(xmlSchemaTypes.hasNext()); - - contextPackageInfo.moveXmlSchemaType(2, 0); - xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage); - assertEquals("foo", xmlSchemaTypes.next().getName()); - assertEquals("baz", xmlSchemaTypes.next().getName()); - assertEquals("bar", xmlSchemaTypes.next().getName()); - assertFalse(xmlSchemaTypes.hasNext()); - - contextPackageInfo.moveXmlSchemaType(0, 1); - xmlSchemaTypes = this.getSchemaTypeAnnotations(resourcePackage); - assertEquals("baz", xmlSchemaTypes.next().getName()); - assertEquals("foo", xmlSchemaTypes.next().getName()); - assertEquals("bar", xmlSchemaTypes.next().getName()); - assertFalse(xmlSchemaTypes.hasNext()); - } - - public void testSyncXmlSchemaTypes() throws Exception { - this.createPackageInfoWithAccessorType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - ListIterable xmlSchemaTypes = contextPackageInfo.getXmlSchemaTypes(); - assertFalse(xmlSchemaTypes.iterator().hasNext()); - - //add 3 XmlSchemaTypes - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.addXmlSchemaType(declaration, 0, "bar"); - GenericJavaPackageInfoTests.this.addXmlSchemaType(declaration, 1, "foo"); - GenericJavaPackageInfoTests.this.addXmlSchemaType(declaration, 2, "baz"); - } - }); - - xmlSchemaTypes = contextPackageInfo.getXmlSchemaTypes(); - ListIterator xmlSchemaTypesIterator = xmlSchemaTypes.iterator(); - assertTrue(xmlSchemaTypesIterator.hasNext()); - assertEquals("bar", xmlSchemaTypesIterator.next().getName()); - assertEquals("foo", xmlSchemaTypesIterator.next().getName()); - assertEquals("baz", xmlSchemaTypesIterator.next().getName()); - assertFalse(xmlSchemaTypesIterator.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.moveXmlSchemaType(declaration, 2, 0); - } - }); - - xmlSchemaTypesIterator = xmlSchemaTypes.iterator(); - assertTrue(xmlSchemaTypesIterator.hasNext()); - assertEquals("foo", xmlSchemaTypesIterator.next().getName()); - assertEquals("baz", xmlSchemaTypesIterator.next().getName()); - assertEquals("bar", xmlSchemaTypesIterator.next().getName()); - assertFalse(xmlSchemaTypesIterator.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.moveXmlSchemaType(declaration, 0, 1); - } - }); - - xmlSchemaTypesIterator = xmlSchemaTypes.iterator(); - assertTrue(xmlSchemaTypesIterator.hasNext()); - assertEquals("baz", xmlSchemaTypesIterator.next().getName()); - assertEquals("foo", xmlSchemaTypesIterator.next().getName()); - assertEquals("bar", xmlSchemaTypesIterator.next().getName()); - assertFalse(xmlSchemaTypesIterator.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.removeXmlSchemaType(declaration, 1); - } - }); - - xmlSchemaTypesIterator = xmlSchemaTypes.iterator(); - assertTrue(xmlSchemaTypesIterator.hasNext()); - assertEquals("baz", xmlSchemaTypesIterator.next().getName()); - assertEquals("bar", xmlSchemaTypesIterator.next().getName()); - assertFalse(xmlSchemaTypesIterator.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.removeXmlSchemaType(declaration, 1); - } - }); - - xmlSchemaTypesIterator = xmlSchemaTypes.iterator(); - assertTrue(xmlSchemaTypesIterator.hasNext()); - assertEquals("baz", xmlSchemaTypesIterator.next().getName()); - assertFalse(xmlSchemaTypesIterator.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.removeXmlSchemaType(declaration, 0); - } - }); - - xmlSchemaTypesIterator = xmlSchemaTypes.iterator(); - assertFalse(xmlSchemaTypesIterator.hasNext()); - } - - public void testSyncAddXmlSchemaTypes() throws Exception { - this.createPackageInfoWithAccessorType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - ListIterable xmlSchemaTypes = contextPackageInfo.getXmlSchemaTypes(); - assertFalse(xmlSchemaTypes.iterator().hasNext()); - - //add 1 XmlSchemaType when none exist - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.addXmlSchemaType(declaration, 0, "bar"); - } - }); - - xmlSchemaTypes = contextPackageInfo.getXmlSchemaTypes(); - ListIterator xmlSchemaTypesIterator = xmlSchemaTypes.iterator(); - assertTrue(xmlSchemaTypesIterator.hasNext()); - assertEquals("bar", xmlSchemaTypesIterator.next().getName()); - assertFalse(xmlSchemaTypesIterator.hasNext()); - - - //add 1 XmlSchemaType when 1 standalone exists - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.addXmlSchemaType(declaration, 1, "foo"); - } - }); - - xmlSchemaTypes = contextPackageInfo.getXmlSchemaTypes(); - xmlSchemaTypesIterator = xmlSchemaTypes.iterator(); - assertTrue(xmlSchemaTypesIterator.hasNext()); - assertEquals("bar", xmlSchemaTypesIterator.next().getName()); - assertEquals("foo", xmlSchemaTypesIterator.next().getName()); - assertFalse(xmlSchemaTypesIterator.hasNext()); - - //add 1 XmlSchemaType when a container annotations exists - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.addXmlSchemaType(declaration, 2, "baz"); - } - }); - - xmlSchemaTypes = contextPackageInfo.getXmlSchemaTypes(); - xmlSchemaTypesIterator = xmlSchemaTypes.iterator(); - assertTrue(xmlSchemaTypesIterator.hasNext()); - assertEquals("bar", xmlSchemaTypesIterator.next().getName()); - assertEquals("foo", xmlSchemaTypesIterator.next().getName()); - assertEquals("baz", xmlSchemaTypesIterator.next().getName()); - assertFalse(xmlSchemaTypesIterator.hasNext()); - - //add 1 XmlSchemaType to beginning of list when a container annotations exists - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.addXmlSchemaType(declaration, 0, "foobaz"); - } - }); - - xmlSchemaTypes = contextPackageInfo.getXmlSchemaTypes(); - xmlSchemaTypesIterator = xmlSchemaTypes.iterator(); - assertTrue(xmlSchemaTypesIterator.hasNext()); - assertEquals("foobaz", xmlSchemaTypesIterator.next().getName()); - assertEquals("bar", xmlSchemaTypesIterator.next().getName()); - assertEquals("foo", xmlSchemaTypesIterator.next().getName()); - assertEquals("baz", xmlSchemaTypesIterator.next().getName()); - assertFalse(xmlSchemaTypesIterator.hasNext()); - } - - protected void moveXmlSchemaType(ModifiedDeclaration declaration, int targetIndex, int sourceIndex) { - this.moveArrayElement((NormalAnnotation) declaration.getAnnotationNamed(JAXB.XML_SCHEMA_TYPES), JAXB.XML_SCHEMA_TYPES__VALUE, targetIndex, sourceIndex); - } - - protected void removeXmlSchemaType(ModifiedDeclaration declaration, int index) { - this.removeArrayElement((NormalAnnotation) declaration.getAnnotationNamed(JAXB.XML_SCHEMA_TYPES), JAXB.XML_SCHEMA_TYPES__VALUE, index); - } - - - - - - public void testGetXmlJavaTypeAdapters() throws Exception { - this.createPackageInfoWithAccessorOrder(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - ListIterable xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters(); - assertFalse(xmlJavaTypeAdapters.iterator().hasNext()); - - //add 2 XmlJavaTypeAdapters - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.addXmlJavaTypeAdapter(declaration, 0, "String"); - GenericJavaPackageInfoTests.this.addXmlJavaTypeAdapter(declaration, 1, "Integer"); - } - }); - - xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters(); - ListIterator xmlJavaTypeAdaptersIterator = xmlJavaTypeAdapters.iterator(); - assertTrue(xmlJavaTypeAdaptersIterator.hasNext()); - assertEquals("String", xmlJavaTypeAdaptersIterator.next().getValue()); - assertEquals("Integer", xmlJavaTypeAdaptersIterator.next().getValue()); - assertFalse(xmlJavaTypeAdaptersIterator.hasNext()); - } - - protected void addXmlJavaTypeAdapter(ModifiedDeclaration declaration, int index, String name) { - NormalAnnotation arrayElement = this.newXmlJavaTypeAdapterAnnotation(declaration.getAst(), name); - this.addArrayElement(declaration, JAXB.XML_JAVA_TYPE_ADAPTERS, index, JAXB.XML_JAVA_TYPE_ADAPTERS__VALUE, arrayElement); - } - - protected NormalAnnotation newXmlJavaTypeAdapterAnnotation(AST ast, String valueTypeName) { - NormalAnnotation annotation = this.newNormalAnnotation(ast, JAXB.XML_JAVA_TYPE_ADAPTER); - this.addMemberValuePair( - annotation, - JAXB.XML_JAVA_TYPE_ADAPTER__VALUE, - this.newTypeLiteral(ast, valueTypeName)); - return annotation; - } - - public void testGetXmlJavaTypeAdaptersSize() throws Exception { - this.createPackageInfoWithAccessorOrder(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertEquals(0, contextPackageInfo.getXmlJavaTypeAdaptersSize()); - - //add 2 XmlJavaTypeAdapters - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.addXmlJavaTypeAdapter(declaration, 0, "String"); - GenericJavaPackageInfoTests.this.addXmlJavaTypeAdapter(declaration, 1, "Integer"); - } - }); - assertEquals(2, contextPackageInfo.getXmlJavaTypeAdaptersSize()); - } - - public void testAddXmlJavaTypeAdapter() throws Exception { - //create a package info with an annotation other than XmlSchema to test - //adding things to the null schema annotation - this.createPackageInfoWithAccessorType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - contextPackageInfo.addXmlJavaTypeAdapter(0).setValue("bar"); - contextPackageInfo.addXmlJavaTypeAdapter(0).setValue("foo"); - contextPackageInfo.addXmlJavaTypeAdapter(0).setValue("baz"); - - Iterator xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage); - - assertEquals("baz", xmlJavaTypeAdapters.next().getValue()); - assertEquals("foo", xmlJavaTypeAdapters.next().getValue()); - assertEquals("bar", xmlJavaTypeAdapters.next().getValue()); - assertFalse(xmlJavaTypeAdapters.hasNext()); - } - - @SuppressWarnings("unchecked") - protected Iterator getXmlJavaTypeAdapterAnnotations(JavaResourcePackage resourcePackage) { - return (Iterator) resourcePackage.getAnnotations(JAXB.XML_JAVA_TYPE_ADAPTER).iterator(); - } - - public void testAddXmlJavaTypeAdapter2() throws Exception { - //create a package info with an annotation other than XmlSchema to test - //adding things to the null schema annotation - this.createPackageInfoWithAccessorType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - contextPackageInfo.addXmlJavaTypeAdapter(0).setValue("bar"); - contextPackageInfo.addXmlJavaTypeAdapter(1).setValue("foo"); - contextPackageInfo.addXmlJavaTypeAdapter(0).setValue("baz"); - - Iterator xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage); - - assertEquals("baz", xmlJavaTypeAdapters.next().getValue()); - assertEquals("bar", xmlJavaTypeAdapters.next().getValue()); - assertEquals("foo", xmlJavaTypeAdapters.next().getValue()); - assertFalse(xmlJavaTypeAdapters.hasNext()); - } - - public void testRemoveXmlJavaTypeAdapter() throws Exception { - this.createPackageInfoWithAccessorType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - contextPackageInfo.addXmlJavaTypeAdapter(0).setValue("String"); - contextPackageInfo.addXmlJavaTypeAdapter(1).setValue("foo"); - contextPackageInfo.addXmlJavaTypeAdapter(2).setValue("baz"); - - Iterator xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage); - XmlJavaTypeAdapterAnnotation adapterAnnotation = xmlJavaTypeAdapters.next(); - assertEquals("String", adapterAnnotation.getValue()); - assertEquals("java.lang.String", adapterAnnotation.getFullyQualifiedValue()); - assertEquals("foo", xmlJavaTypeAdapters.next().getValue()); - assertEquals("baz", xmlJavaTypeAdapters.next().getValue()); - assertFalse(xmlJavaTypeAdapters.hasNext()); - - contextPackageInfo.removeXmlJavaTypeAdapter(1); - - xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage); - adapterAnnotation = xmlJavaTypeAdapters.next(); - assertEquals("String", adapterAnnotation.getValue()); - assertEquals("java.lang.String", adapterAnnotation.getFullyQualifiedValue()); - assertEquals("baz", xmlJavaTypeAdapters.next().getValue()); - assertFalse(xmlJavaTypeAdapters.hasNext()); - - contextPackageInfo.removeXmlJavaTypeAdapter(1); - xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage); - adapterAnnotation = xmlJavaTypeAdapters.next(); - assertEquals("String", adapterAnnotation.getValue()); - assertEquals("java.lang.String", adapterAnnotation.getFullyQualifiedValue()); - assertFalse(xmlJavaTypeAdapters.hasNext()); - - contextPackageInfo.removeXmlJavaTypeAdapter(0); - xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage); - assertFalse(xmlJavaTypeAdapters.hasNext()); - } - - public void testMoveXmlJavaTypeAdapter() throws Exception { - this.createPackageInfoWithAccessorType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - contextPackageInfo.addXmlJavaTypeAdapter(0).setValue("bar"); - contextPackageInfo.addXmlJavaTypeAdapter(1).setValue("foo"); - contextPackageInfo.addXmlJavaTypeAdapter(2).setValue("baz"); - - Iterator xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage); - assertEquals("bar", xmlJavaTypeAdapters.next().getValue()); - assertEquals("foo", xmlJavaTypeAdapters.next().getValue()); - assertEquals("baz", xmlJavaTypeAdapters.next().getValue()); - assertFalse(xmlJavaTypeAdapters.hasNext()); - - contextPackageInfo.moveXmlJavaTypeAdapter(2, 0); - xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage); - assertEquals("foo", xmlJavaTypeAdapters.next().getValue()); - assertEquals("baz", xmlJavaTypeAdapters.next().getValue()); - assertEquals("bar", xmlJavaTypeAdapters.next().getValue()); - assertFalse(xmlJavaTypeAdapters.hasNext()); - - contextPackageInfo.moveXmlJavaTypeAdapter(0, 1); - xmlJavaTypeAdapters = this.getXmlJavaTypeAdapterAnnotations(resourcePackage); - assertEquals("baz", xmlJavaTypeAdapters.next().getValue()); - assertEquals("foo", xmlJavaTypeAdapters.next().getValue()); - assertEquals("bar", xmlJavaTypeAdapters.next().getValue()); - assertFalse(xmlJavaTypeAdapters.hasNext()); - } - - public void testSyncXmlJavaTypeAdapters() throws Exception { - this.createPackageInfoWithAccessorType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - ListIterable xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters(); - assertFalse(xmlJavaTypeAdapters.iterator().hasNext()); - - //add 3 XmlJavaTypeAdapters - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.addXmlJavaTypeAdapter(declaration, 0, "bar"); - GenericJavaPackageInfoTests.this.addXmlJavaTypeAdapter(declaration, 1, "foo"); - GenericJavaPackageInfoTests.this.addXmlJavaTypeAdapter(declaration, 2, "baz"); - } - }); - - xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters(); - ListIterator xmlJavaTypeAdaptersIterator = xmlJavaTypeAdapters.iterator(); - assertTrue(xmlJavaTypeAdaptersIterator.hasNext()); - assertEquals("bar", xmlJavaTypeAdaptersIterator.next().getValue()); - assertEquals("foo", xmlJavaTypeAdaptersIterator.next().getValue()); - assertEquals("baz", xmlJavaTypeAdaptersIterator.next().getValue()); - assertFalse(xmlJavaTypeAdaptersIterator.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.moveXmlJavaTypeAdapter(declaration, 2, 0); - } - }); - - xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters(); - xmlJavaTypeAdaptersIterator = xmlJavaTypeAdapters.iterator(); - assertTrue(xmlJavaTypeAdaptersIterator.hasNext()); - assertEquals("foo", xmlJavaTypeAdaptersIterator.next().getValue()); - assertEquals("baz", xmlJavaTypeAdaptersIterator.next().getValue()); - assertEquals("bar", xmlJavaTypeAdaptersIterator.next().getValue()); - assertFalse(xmlJavaTypeAdaptersIterator.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.moveXmlJavaTypeAdapter(declaration, 0, 1); - } - }); - - xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters(); - xmlJavaTypeAdaptersIterator = xmlJavaTypeAdapters.iterator(); - assertTrue(xmlJavaTypeAdaptersIterator.hasNext()); - assertEquals("baz", xmlJavaTypeAdaptersIterator.next().getValue()); - assertEquals("foo", xmlJavaTypeAdaptersIterator.next().getValue()); - assertEquals("bar", xmlJavaTypeAdaptersIterator.next().getValue()); - assertFalse(xmlJavaTypeAdaptersIterator.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.removeXmlJavaTypeAdapter(declaration, 1); - } - }); - - xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters(); - xmlJavaTypeAdaptersIterator = xmlJavaTypeAdapters.iterator(); - assertTrue(xmlJavaTypeAdaptersIterator.hasNext()); - assertEquals("baz", xmlJavaTypeAdaptersIterator.next().getValue()); - assertEquals("bar", xmlJavaTypeAdaptersIterator.next().getValue()); - assertFalse(xmlJavaTypeAdaptersIterator.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.removeXmlJavaTypeAdapter(declaration, 1); - } - }); - - xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters(); - xmlJavaTypeAdaptersIterator = xmlJavaTypeAdapters.iterator(); - assertTrue(xmlJavaTypeAdaptersIterator.hasNext()); - assertEquals("baz", xmlJavaTypeAdaptersIterator.next().getValue()); - assertFalse(xmlJavaTypeAdaptersIterator.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageInfoTests.this.removeXmlJavaTypeAdapter(declaration, 0); - } - }); - - xmlJavaTypeAdapters = contextPackageInfo.getXmlJavaTypeAdapters(); - xmlJavaTypeAdaptersIterator = xmlJavaTypeAdapters.iterator(); - assertFalse(xmlJavaTypeAdaptersIterator.hasNext()); - } - - - protected void moveXmlJavaTypeAdapter(ModifiedDeclaration declaration, int targetIndex, int sourceIndex) { - this.moveArrayElement((NormalAnnotation) declaration.getAnnotationNamed(JAXB.XML_JAVA_TYPE_ADAPTERS), JAXB.XML_JAVA_TYPE_ADAPTERS__VALUE, targetIndex, sourceIndex); - } - - protected void removeXmlJavaTypeAdapter(ModifiedDeclaration declaration, int index) { - this.removeArrayElement((NormalAnnotation) declaration.getAnnotationNamed(JAXB.XML_JAVA_TYPE_ADAPTERS), JAXB.XML_JAVA_TYPE_ADAPTERS__VALUE, index); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageXmlJavaTypeAdapterTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageXmlJavaTypeAdapterTests.java deleted file mode 100644 index ac0a365b50..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPackageXmlJavaTypeAdapterTests.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context.java; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; -import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; - - -@SuppressWarnings("nls") -public class GenericJavaPackageXmlJavaTypeAdapterTests extends JaxbContextModelTestCase -{ - - public GenericJavaPackageXmlJavaTypeAdapterTests(String name) { - super(name); - } - - private ICompilationUnit createPackageInfoWithXmlJavaTypeAdapter() throws CoreException { - return createTestPackageInfo( - "@XmlJavaTypeAdapter", - JAXB.XML_JAVA_TYPE_ADAPTER); - } - - - public void testModifyValue() throws Exception { - this.createPackageInfoWithXmlJavaTypeAdapter(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextPackageInfo.getXmlJavaTypeAdapters().iterator().next(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertNull(contextXmlJavaTypeAdapter.getValue()); - - contextXmlJavaTypeAdapter.setValue("foo"); - XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertEquals("foo", javaTypeAdapterAnnotation.getValue()); - assertEquals("foo", contextXmlJavaTypeAdapter.getValue()); - - //verify the xml schema type annotation is not removed when the value is set to null - contextXmlJavaTypeAdapter.setValue(null); - javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(javaTypeAdapterAnnotation.getValue()); - assertNull(contextXmlJavaTypeAdapter.getValue()); - } - - public void testUpdateValue() throws Exception { - this.createPackageInfoWithXmlJavaTypeAdapter(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextPackageInfo.getXmlJavaTypeAdapters().iterator().next(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertNull(contextXmlJavaTypeAdapter.getValue()); - - //add a value member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageXmlJavaTypeAdapterTests.this.addXmlJavaTypeAdapterTypeMemberValuePair(declaration, JAXB.XML_JAVA_TYPE_ADAPTER__VALUE, "String"); - } - }); - assertEquals("String", contextXmlJavaTypeAdapter.getValue()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageXmlJavaTypeAdapterTests.this.removeXmlJavaTypeAdapterAnnotation(declaration); - } - }); - assertFalse(contextPackageInfo.getXmlJavaTypeAdapters().iterator().hasNext()); - } - - public void testModifyType() throws Exception { - this.createPackageInfoWithXmlJavaTypeAdapter(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextPackageInfo.getXmlJavaTypeAdapters().iterator().next(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertNull(contextXmlJavaTypeAdapter.getType()); - assertNull(contextXmlJavaTypeAdapter.getSpecifiedType()); - assertNull(contextXmlJavaTypeAdapter.getDefaultType()); - - contextXmlJavaTypeAdapter.setSpecifiedType("foo"); - XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertEquals("foo", javaTypeAdapterAnnotation.getType()); - assertEquals("foo", contextXmlJavaTypeAdapter.getType()); - - //verify the xml schema type annotation is not removed when the type is set to null - contextXmlJavaTypeAdapter.setSpecifiedType(null); - javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(javaTypeAdapterAnnotation.getType()); - assertNull(contextXmlJavaTypeAdapter.getType()); - assertNull(contextXmlJavaTypeAdapter.getSpecifiedType()); - assertNull(contextXmlJavaTypeAdapter.getDefaultType()); - } - - public void testUpdateType() throws Exception { - this.createPackageInfoWithXmlJavaTypeAdapter(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextPackageInfo.getXmlJavaTypeAdapters().iterator().next(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertNull(contextXmlJavaTypeAdapter.getType()); - assertNull(contextXmlJavaTypeAdapter.getSpecifiedType()); - assertNull(contextXmlJavaTypeAdapter.getDefaultType()); - - //add a type member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageXmlJavaTypeAdapterTests.this.addXmlJavaTypeAdapterTypeMemberValuePair(declaration, JAXB.XML_JAVA_TYPE_ADAPTER__TYPE, "String"); - } - }); - assertEquals("String", contextXmlJavaTypeAdapter.getType()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPackageXmlJavaTypeAdapterTests.this.removeXmlJavaTypeAdapterAnnotation(declaration); - } - }); - assertFalse(contextPackageInfo.getXmlJavaTypeAdapters().iterator().hasNext()); - } - - protected void addXmlJavaTypeAdapterTypeMemberValuePair(ModifiedDeclaration declaration, String name, String typeName) { - this.addMemberValuePair( - (MarkerAnnotation) this.getXmlJavaTypeAdapterAnnotation(declaration), - name, - this.newTypeLiteral(declaration.getAst(), typeName)); - } - - protected void addXmlJavaTypeAdapterMemberValuePair(ModifiedDeclaration declaration, String name, String value) { - this.addMemberValuePair((MarkerAnnotation) this.getXmlJavaTypeAdapterAnnotation(declaration), name, value); - } - - //add another package annotation so that the context model object doesn't get removed when - //removing the XmlJavaTypeAdapter annotation. Only "annotated" packages are added to the context model - protected void removeXmlJavaTypeAdapterAnnotation(ModifiedDeclaration declaration) { - this.addMarkerAnnotation(declaration.getDeclaration(), XmlAccessorOrderAnnotation.ANNOTATION_NAME); - this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - - protected Annotation getXmlJavaTypeAdapterAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentClassTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentClassTests.java deleted file mode 100644 index 26028a0e89..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentClassTests.java +++ /dev/null @@ -1,2121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context.java; - -import java.beans.Introspector; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.BodyDeclaration; -import org.eclipse.jdt.core.dom.IExtendedModifier; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jdt.core.dom.Modifier; -import org.eclipse.jdt.core.dom.Modifier.ModifierKeyword; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentField; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentProperty; -import org.eclipse.jpt.jaxb.core.context.XmlAccessOrder; -import org.eclipse.jpt.jaxb.core.context.XmlAccessType; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMember; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTransientAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation; -import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; - - -@SuppressWarnings("nls") -public class GenericJavaPersistentClassTests extends JaxbContextModelTestCase -{ - - public GenericJavaPersistentClassTests(String name) { - super(name); - } - - private ICompilationUnit createTypeWithXmlType() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType"); - } - }); - } - - private void createTestSubType() throws Exception { - SourceWriter sourceWriter = new SourceWriter() { - public void appendSourceTo(StringBuilder sb) { - sb.append(CR); - sb.append("import "); - sb.append(JAXB.XML_TYPE); - sb.append(";"); - sb.append(CR); - sb.append("@XmlType"); - sb.append(CR); - sb.append("public class ").append("AnnotationTestTypeChild").append(" "); - sb.append("extends " + TYPE_NAME + " "); - sb.append("{}").append(CR); - } - }; - this.javaProject.createCompilationUnit(PACKAGE_NAME, "AnnotationTestTypeChild.java", sourceWriter); - } - - private ICompilationUnit createXmlTypeWithAccessorType() throws CoreException { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE, JAXB.XML_ACCESS_TYPE, JAXB.XML_ACCESSOR_TYPE); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType").append(CR); - sb.append("@XmlAccessorType(value = XmlAccessType.PROPERTY)"); - } - }); - } - - private ICompilationUnit createXmlTypeWithAccessorOrder() throws CoreException { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE, JAXB.XML_ACCESS_ORDER, JAXB.XML_ACCESSOR_ORDER); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType").append(CR); - sb.append("@XmlAccessorOrder(value = XmlAccessOrder.ALPHABETICAL)"); - } - }); - } - - private ICompilationUnit createPackageInfoWithAccessorType() throws CoreException { - return createTestPackageInfo( - "@XmlAccessorType(value = XmlAccessType.PROPERTY)", - JAXB.XML_ACCESS_TYPE, JAXB.XML_ACCESSOR_TYPE); - } - - private void createTestXmlTypeWithFieldAndPublicMemberAccess() throws Exception { - SourceWriter sourceWriter = new SourceWriter() { - public void appendSourceTo(StringBuilder sb) { - sb.append(CR); - sb.append("import "); - sb.append(JAXB.XML_TYPE); - sb.append(";"); - sb.append(CR); - sb.append("import "); - sb.append(JAXB.XML_ATTRIBUTE); - sb.append(";"); - sb.append(CR); - sb.append("import "); - sb.append(JAXB.XML_TRANSIENT); - sb.append(";"); - sb.append(CR); - sb.append("import java.util.List;"); - sb.append(CR); - sb.append("@XmlType"); - sb.append(CR); - sb.append("public class ").append(TYPE_NAME).append(" "); - sb.append("{").append(CR); - sb.append(" public int foo;").append(CR); - sb.append(CR).append("}").append(CR); - } - }; - this.javaProject.createCompilationUnit(PACKAGE_NAME, "AnnotationTestType.java", sourceWriter); - } - - private void createTestXmlTypeWithPropertyAndPublicMemberAccess() throws Exception { - SourceWriter sourceWriter = new SourceWriter() { - public void appendSourceTo(StringBuilder sb) { - sb.append(CR); - sb.append("import "); - sb.append(JAXB.XML_TYPE); - sb.append(";"); - sb.append(CR); - sb.append("import "); - sb.append(JAXB.XML_ATTRIBUTE); - sb.append(";"); - sb.append(CR); - sb.append("import "); - sb.append(JAXB.XML_TRANSIENT); - sb.append(";"); - sb.append(CR); - sb.append("import java.util.List;"); - sb.append(CR); - sb.append("@XmlType"); - sb.append(CR); - sb.append("public class ").append(TYPE_NAME).append(" "); - sb.append("{").append(CR); - sb.append(" public int getFoo() {").append(CR); - sb.append(" return 1;").append(CR).append(" }").append(CR); - sb.append(" public void setFoo(int foo) {}").append(CR).append(CR); - sb.append(CR).append("}").append(CR); - } - }; - this.javaProject.createCompilationUnit(PACKAGE_NAME, "AnnotationTestType.java", sourceWriter); - } - - private void createTestXmlTypeWithPropertyGetterAndPublicMemberAccess() throws Exception { - SourceWriter sourceWriter = new SourceWriter() { - public void appendSourceTo(StringBuilder sb) { - sb.append(CR); - sb.append("import "); - sb.append(JAXB.XML_TYPE); - sb.append(";"); - sb.append(CR); - sb.append("import "); - sb.append(JAXB.XML_ATTRIBUTE); - sb.append(";"); - sb.append(CR); - sb.append("import "); - sb.append(JAXB.XML_TRANSIENT); - sb.append(";"); - sb.append(CR); - sb.append("import java.util.List;"); - sb.append(CR); - sb.append("@XmlType"); - sb.append(CR); - sb.append("public class ").append(TYPE_NAME).append(" "); - sb.append("{").append(CR); - sb.append(" public int getFoo() {").append(CR); - sb.append(" return 1;").append(CR).append(" }").append(CR); - sb.append(CR).append("}").append(CR); - } - }; - this.javaProject.createCompilationUnit(PACKAGE_NAME, "AnnotationTestType.java", sourceWriter); - } - - private void createTestXmlTypeWithPropertyGetterListAndPublicMemberAccess() throws Exception { - SourceWriter sourceWriter = new SourceWriter() { - public void appendSourceTo(StringBuilder sb) { - sb.append(CR); - sb.append("import "); - sb.append(JAXB.XML_TYPE); - sb.append(";"); - sb.append(CR); - sb.append("import "); - sb.append(JAXB.XML_ATTRIBUTE); - sb.append(";"); - sb.append(CR); - sb.append("import "); - sb.append(JAXB.XML_TRANSIENT); - sb.append(";"); - sb.append(CR); - sb.append("import java.util.List;"); - sb.append(CR); - sb.append("@XmlType"); - sb.append(CR); - sb.append("public class ").append(TYPE_NAME).append(" "); - sb.append("{").append(CR); - sb.append(" public List getFoo() {").append(CR); - sb.append(" return 1;").append(CR).append(" }").append(CR); - sb.append(CR).append("}").append(CR); - } - }; - this.javaProject.createCompilationUnit(PACKAGE_NAME, "AnnotationTestType.java", sourceWriter); - } - - private void createTestXmlTypeWithPropertySetterAndPublicMemberAccess() throws Exception { - SourceWriter sourceWriter = new SourceWriter() { - public void appendSourceTo(StringBuilder sb) { - sb.append(CR); - sb.append("import "); - sb.append(JAXB.XML_TYPE); - sb.append(";"); - sb.append(CR); - sb.append("import "); - sb.append(JAXB.XML_ATTRIBUTE); - sb.append(";"); - sb.append(CR); - sb.append("import "); - sb.append(JAXB.XML_TRANSIENT); - sb.append(";"); - sb.append(CR); - sb.append("import java.util.List;"); - sb.append(CR); - sb.append("@XmlType"); - sb.append(CR); - sb.append("public class ").append(TYPE_NAME).append(" "); - sb.append("{").append(CR); - sb.append(" public void setFoo(int foo) {}").append(CR).append(CR); - sb.append(CR).append("}").append(CR); - } - }; - this.javaProject.createCompilationUnit(PACKAGE_NAME, "AnnotationTestType.java", sourceWriter); - } - - public void testModifyFactoryClass() throws Exception { - createTypeWithXmlType(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - assertNull(persistentClass.getFactoryClass()); - - persistentClass.setFactoryClass("foo"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlTypeAnnotation.getFactoryClass()); - assertEquals("foo", persistentClass.getFactoryClass()); - - persistentClass.setFactoryClass(null); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertNull(xmlTypeAnnotation.getFactoryClass()); - assertNull(persistentClass.getFactoryClass()); - - //add another annotation so that the context model does not get blown away - persistentClass.setSpecifiedAccessType(XmlAccessType.FIELD); - resourceType.removeAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - - //set factoryClass again, this time starting with no XmlType annotation - persistentClass.setFactoryClass("foo"); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlTypeAnnotation.getFactoryClass()); - assertEquals("foo", persistentClass.getFactoryClass()); - } - - public void testUpdateFactoryClass() throws Exception { - createTypeWithXmlType(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - assertNull(persistentClass.getFactoryClass()); - - - //add a factoryClass member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceType); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addXmlTypeTypeMemberValuePair(declaration, JAXB.XML_TYPE__FACTORY_CLASS, "Foo"); - } - }); - assertEquals("Foo", persistentClass.getFactoryClass()); - - //remove the factoryClass member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlTypeAnnotation = (NormalAnnotation) GenericJavaPersistentClassTests.this.getXmlTypeAnnotation(declaration); - GenericJavaPersistentClassTests.this.values(xmlTypeAnnotation).remove(0); - } - }); - assertNull(persistentClass.getFactoryClass()); - } - - public void testModifyFactoryMethod() throws Exception { - createTypeWithXmlType(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - assertNull(persistentClass.getFactoryMethod()); - - persistentClass.setFactoryMethod("foo"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlTypeAnnotation.getFactoryMethod()); - assertEquals("foo", persistentClass.getFactoryMethod()); - - persistentClass.setFactoryMethod(null); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertNull(xmlTypeAnnotation.getFactoryMethod()); - assertNull(persistentClass.getFactoryMethod()); - - //add another annotation so that the context model does not get blown away - persistentClass.setSpecifiedAccessType(XmlAccessType.FIELD); - resourceType.removeAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - - //set factoryMethod again, this time starting with no XmlType annotation - persistentClass.setFactoryMethod("foo"); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlTypeAnnotation.getFactoryMethod()); - assertEquals("foo", persistentClass.getFactoryMethod()); - } - - public void testUpdateFactoryMethod() throws Exception { - createTypeWithXmlType(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - assertNull(persistentClass.getFactoryMethod()); - - - //add a factoryMethod member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceType); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addXmlTypeMemberValuePair(declaration, JAXB.XML_TYPE__FACTORY_METHOD, "foo"); - } - }); - assertEquals("foo", persistentClass.getFactoryMethod()); - - //remove the factoryMethod member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlTypeAnnotation = (NormalAnnotation) GenericJavaPersistentClassTests.this.getXmlTypeAnnotation(declaration); - GenericJavaPersistentClassTests.this.values(xmlTypeAnnotation).remove(0); - } - }); - assertNull(persistentClass.getFactoryMethod()); - } - - public void testModifySchemaTypeName() throws Exception { - createTypeWithXmlType(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - String defaultXmlTypeName = Introspector.decapitalize(TYPE_NAME); - - assertNull(persistentClass.getSpecifiedXmlTypeName()); - assertEquals(defaultXmlTypeName, persistentClass.getDefaultXmlTypeName()); - assertEquals(defaultXmlTypeName, persistentClass.getXmlTypeName()); - - persistentClass.setSpecifiedXmlTypeName("foo"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlTypeAnnotation.getName()); - assertEquals("foo", persistentClass.getSpecifiedXmlTypeName()); - assertEquals("foo", persistentClass.getXmlTypeName()); - - persistentClass.setSpecifiedXmlTypeName(null); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertNull(xmlTypeAnnotation.getName()); - assertNull(persistentClass.getSpecifiedXmlTypeName()); - assertEquals(defaultXmlTypeName, persistentClass.getXmlTypeName()); - - //add another annotation so that the context model does not get blown away - persistentClass.setSpecifiedAccessType(XmlAccessType.FIELD); - resourceType.removeAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - - //set name again, this time starting with no XmlType annotation - persistentClass.setSpecifiedXmlTypeName("foo"); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlTypeAnnotation.getName()); - assertEquals("foo", persistentClass.getSpecifiedXmlTypeName()); - assertEquals("foo", persistentClass.getXmlTypeName()); - } - - public void testUpdateSchemaTypeName() throws Exception { - createTypeWithXmlType(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - String defaultXmlTypeName = Introspector.decapitalize(TYPE_NAME); - - assertNull(persistentClass.getSpecifiedXmlTypeName()); - assertEquals(defaultXmlTypeName, persistentClass.getDefaultXmlTypeName()); - assertEquals(defaultXmlTypeName, persistentClass.getXmlTypeName()); - - //add a namespace member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceType); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addXmlTypeMemberValuePair(declaration, JAXB.XML_TYPE__NAME, "foo"); - } - }); - assertEquals("foo", persistentClass.getSpecifiedXmlTypeName()); - assertEquals("foo", persistentClass.getXmlTypeName()); - - //remove the namespace member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlTypeAnnotation = (NormalAnnotation) GenericJavaPersistentClassTests.this.getXmlTypeAnnotation(declaration); - GenericJavaPersistentClassTests.this.values(xmlTypeAnnotation).remove(0); - } - }); - assertNull(persistentClass.getSpecifiedXmlTypeName()); - assertEquals(defaultXmlTypeName, persistentClass.getXmlTypeName()); - } - - public void testModifyNamespace() throws Exception { - createTypeWithXmlType(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - assertNull(persistentClass.getSpecifiedNamespace()); - assertEquals("", persistentClass.getDefaultNamespace()); - assertEquals("", persistentClass.getNamespace()); - - persistentClass.setSpecifiedNamespace("foo"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlTypeAnnotation.getNamespace()); - assertEquals("foo", persistentClass.getSpecifiedNamespace()); - assertEquals("foo", persistentClass.getNamespace()); - - persistentClass.setSpecifiedNamespace(null); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertNull(xmlTypeAnnotation.getNamespace()); - assertNull(persistentClass.getSpecifiedNamespace()); - assertEquals("", persistentClass.getNamespace()); - - //add another annotation so that the context model does not get blown away - persistentClass.setSpecifiedAccessType(XmlAccessType.FIELD); - resourceType.removeAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - - //set namespace again, this time starting with no XmlType annotation - persistentClass.setSpecifiedNamespace("foo"); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlTypeAnnotation.getNamespace()); - assertEquals("foo", persistentClass.getSpecifiedNamespace()); - assertEquals("foo", persistentClass.getNamespace()); - } - - public void testUpdateNamespace() throws Exception { - createTypeWithXmlType(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - assertNull(persistentClass.getSpecifiedNamespace()); - assertEquals("", persistentClass.getDefaultNamespace()); - assertEquals("", persistentClass.getNamespace()); - - //add a namespace member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceType); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addXmlTypeMemberValuePair(declaration, JAXB.XML_TYPE__NAMESPACE, "foo"); - } - }); - assertEquals("foo", persistentClass.getSpecifiedNamespace()); - assertEquals("foo", persistentClass.getNamespace()); - - //remove the namespace member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlTypeAnnotation = (NormalAnnotation) GenericJavaPersistentClassTests.this.getXmlTypeAnnotation(declaration); - GenericJavaPersistentClassTests.this.values(xmlTypeAnnotation).remove(0); - } - }); - assertNull(persistentClass.getSpecifiedNamespace()); - assertEquals("", persistentClass.getNamespace()); - } - - public void testModifyAccessType() throws Exception { - createXmlTypeWithAccessorType(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - assertEquals(XmlAccessType.PROPERTY, persistentClass.getSpecifiedAccessType()); - assertEquals(XmlAccessType.PROPERTY, persistentClass.getAccessType()); - assertEquals(XmlAccessType.PUBLIC_MEMBER, persistentClass.getDefaultAccessType()); - - persistentClass.setSpecifiedAccessType(XmlAccessType.FIELD); - XmlAccessorTypeAnnotation accessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourceType.getAnnotation(XmlAccessorTypeAnnotation.ANNOTATION_NAME); - assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType.FIELD, accessorTypeAnnotation.getValue()); - assertEquals(XmlAccessType.FIELD, persistentClass.getAccessType()); - - persistentClass.setSpecifiedAccessType(XmlAccessType.PUBLIC_MEMBER); - assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType.PUBLIC_MEMBER, accessorTypeAnnotation.getValue()); - assertEquals(XmlAccessType.PUBLIC_MEMBER, persistentClass.getAccessType()); - - persistentClass.setSpecifiedAccessType(XmlAccessType.NONE); - assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType.NONE, accessorTypeAnnotation.getValue()); - assertEquals(XmlAccessType.NONE, persistentClass.getAccessType()); - - persistentClass.setSpecifiedAccessType(null); - accessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourceType.getAnnotation(XmlAccessorTypeAnnotation.ANNOTATION_NAME); - assertNull(accessorTypeAnnotation.getValue()); - assertNull(persistentClass.getSpecifiedAccessType()); - assertEquals(XmlAccessType.PUBLIC_MEMBER, persistentClass.getAccessType()); - assertEquals(XmlAccessType.PUBLIC_MEMBER, persistentClass.getDefaultAccessType()); - } - - public void testUpdateAccessType() throws Exception { - createXmlTypeWithAccessorType(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - assertEquals(XmlAccessType.PROPERTY, persistentClass.getSpecifiedAccessType()); - assertEquals(XmlAccessType.PROPERTY, persistentClass.getAccessType()); - assertEquals(XmlAccessType.PUBLIC_MEMBER, persistentClass.getDefaultAccessType()); - - //set the accesser type value to FIELD - AnnotatedElement annotatedElement = this.annotatedElement(resourceType); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.setEnumMemberValuePair(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME, JAXB.XML_ACCESS_TYPE__FIELD); - } - }); - assertEquals(XmlAccessType.FIELD, persistentClass.getAccessType()); - - //set the accesser type value to PUBLIC_MEMBER - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.setEnumMemberValuePair(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - } - }); - assertEquals(XmlAccessType.PUBLIC_MEMBER, persistentClass.getAccessType()); - - //set the accesser type value to NONE - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.setEnumMemberValuePair(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME, JAXB.XML_ACCESS_TYPE__NONE); - } - }); - assertEquals(XmlAccessType.NONE, persistentClass.getAccessType()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME); - } - }); - assertNull(persistentClass.getSpecifiedAccessType()); - assertEquals(XmlAccessType.PUBLIC_MEMBER, persistentClass.getAccessType()); - assertEquals(XmlAccessType.PUBLIC_MEMBER, persistentClass.getDefaultAccessType()); - } - - /** - * If there is a @XmlAccessorType on a class, then it is used. - * Otherwise, if a @XmlAccessorType exists on one of its super classes, then it is inherited. - * Otherwise, the @XmlAccessorType on a package is inherited. - */ - public void testGetDefaultAccessType() throws Exception { - this.createTypeWithXmlType(); - this.createTestSubType(); - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentClass childPersistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - - assertEquals(XmlAccessType.PUBLIC_MEMBER, childPersistentClass.getDefaultAccessType()); - - this.createPackageInfoWithAccessorType(); - assertEquals(XmlAccessType.PROPERTY, childPersistentClass.getDefaultAccessType()); - - persistentClass.setSpecifiedAccessType(XmlAccessType.FIELD); - assertEquals(XmlAccessType.PROPERTY, childPersistentClass.getDefaultAccessType()); - - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - persistentClass.setSpecifiedAccessType(null); - assertEquals(XmlAccessType.PROPERTY, childPersistentClass.getDefaultAccessType()); - contextPackageInfo.setSpecifiedAccessType(XmlAccessType.FIELD); - assertEquals(XmlAccessType.FIELD, childPersistentClass.getDefaultAccessType()); - - contextPackageInfo.setSpecifiedAccessType(XmlAccessType.NONE); - assertEquals(XmlAccessType.NONE, childPersistentClass.getDefaultAccessType()); - - contextPackageInfo.setSpecifiedAccessType(null); - assertEquals(XmlAccessType.PUBLIC_MEMBER, childPersistentClass.getDefaultAccessType()); - } - - public void testGetSuperPersistentClass() throws Exception { - this.createTypeWithXmlType(); - this.createTestSubType(); - JaxbPersistentClass persistentClass = getContextRoot().getPersistentClass(FULLY_QUALIFIED_TYPE_NAME); - JaxbPersistentClass childPersistentClass = getContextRoot().getPersistentClass(PACKAGE_NAME + ".AnnotationTestTypeChild"); - - assertEquals(persistentClass, childPersistentClass.getSuperPersistentClass()); - - //This test will change when we no longer depend on there being an @XmlType annotation for something to be persistent - AnnotatedElement annotatedElement = this.annotatedElement(persistentClass.getJavaResourceType()); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlTypeAnnotation.ANNOTATION_NAME); - } - }); - assertNull(childPersistentClass.getSuperPersistentClass()); - } - - public void testModifyAccessOrder() throws Exception { - createXmlTypeWithAccessorOrder(); - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - assertEquals(XmlAccessOrder.ALPHABETICAL, persistentClass.getSpecifiedAccessOrder()); - assertEquals(XmlAccessOrder.ALPHABETICAL, persistentClass.getAccessOrder()); - assertEquals(XmlAccessOrder.UNDEFINED, persistentClass.getDefaultAccessOrder()); - - persistentClass.setSpecifiedAccessOrder(XmlAccessOrder.UNDEFINED); - XmlAccessorOrderAnnotation accessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourceType.getAnnotation(XmlAccessorOrderAnnotation.ANNOTATION_NAME); - assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder.UNDEFINED, accessorOrderAnnotation.getValue()); - assertEquals(XmlAccessOrder.UNDEFINED, persistentClass.getAccessOrder()); - - persistentClass.setSpecifiedAccessOrder(null); - accessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourceType.getAnnotation(XmlAccessorOrderAnnotation.ANNOTATION_NAME); - assertNull(accessorOrderAnnotation.getValue()); - assertNull(persistentClass.getSpecifiedAccessOrder()); - assertEquals(XmlAccessOrder.UNDEFINED, persistentClass.getAccessOrder()); - assertEquals(XmlAccessOrder.UNDEFINED, persistentClass.getDefaultAccessOrder()); - } - - public void testUpdateAccessOrder() throws Exception { - createXmlTypeWithAccessorOrder(); - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - assertEquals(XmlAccessOrder.ALPHABETICAL, persistentClass.getSpecifiedAccessOrder()); - assertEquals(XmlAccessOrder.ALPHABETICAL, persistentClass.getAccessOrder()); - assertEquals(XmlAccessOrder.UNDEFINED, persistentClass.getDefaultAccessOrder()); - - //set the access order value to UNDEFINED - AnnotatedElement annotatedElement = this.annotatedElement(resourceType); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.setEnumMemberValuePair(declaration, XmlAccessorOrderAnnotation.ANNOTATION_NAME, JAXB.XML_ACCESS_ORDER__UNDEFINED); - } - }); - assertEquals(XmlAccessOrder.UNDEFINED, persistentClass.getAccessOrder()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAccessorOrderAnnotation.ANNOTATION_NAME); - } - }); - assertNull(persistentClass.getSpecifiedAccessOrder()); - assertEquals(XmlAccessOrder.UNDEFINED, persistentClass.getAccessOrder()); - assertEquals(XmlAccessOrder.UNDEFINED, persistentClass.getDefaultAccessOrder()); - } - - public void testGetPropOrder() throws Exception { - this.createTypeWithXmlType(); - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - ListIterator props = persistentClass.getPropOrder().iterator(); - assertFalse(props.hasNext()); - - //add 2 prop orders - AnnotatedElement annotatedElement = this.annotatedElement(resourceType); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addProp(declaration, 0, "bar"); - GenericJavaPersistentClassTests.this.addProp(declaration, 1, "foo"); - } - }); - - props = persistentClass.getPropOrder().iterator(); - assertEquals("bar", props.next()); - assertEquals("foo", props.next()); - assertFalse(props.hasNext()); - } - - protected void addProp(ModifiedDeclaration declaration, int index, String prop) { - this.addArrayElement(declaration, JAXB.XML_TYPE, index, JAXB.XML_TYPE__PROP_ORDER, this.newStringLiteral(declaration.getAst(), prop)); - } - - public void testGetPropOrderSize() throws Exception { - this.createTypeWithXmlType(); - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - assertEquals(0, persistentClass.getPropOrderSize()); - - //add 2 prop orders - AnnotatedElement annotatedElement = this.annotatedElement(resourceType); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addProp(declaration, 0, "bar"); - GenericJavaPersistentClassTests.this.addProp(declaration, 1, "foo"); - } - }); - assertEquals(2, persistentClass.getPropOrderSize()); - } - - public void testAddProp() throws Exception { - this.createTypeWithXmlType(); - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - persistentClass.addProp(0, "bar"); - persistentClass.addProp(0, "foo"); - persistentClass.addProp(0, "baz"); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - ListIterator props = xmlTypeAnnotation.getPropOrder().iterator(); - - assertEquals("baz", props.next()); - assertEquals("foo", props.next()); - assertEquals("bar", props.next()); - assertFalse(props.hasNext()); - } - - public void testAddProp2() throws Exception { - this.createTypeWithXmlType(); - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - persistentClass.addProp(0, "bar"); - persistentClass.addProp(1, "foo"); - persistentClass.addProp(0, "baz"); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - ListIterator props = xmlTypeAnnotation.getPropOrder().iterator(); - - assertEquals("baz", props.next()); - assertEquals("bar", props.next()); - assertEquals("foo", props.next()); - assertFalse(props.hasNext()); - } - - public void testRemoveProp() throws Exception { - this.createTypeWithXmlType(); - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - persistentClass.addProp(0, "bar"); - persistentClass.addProp(1, "foo"); - persistentClass.addProp(2, "baz"); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - - persistentClass.removeProp(1); - - ListIterator resourceProps = xmlTypeAnnotation.getPropOrder().iterator(); - assertEquals("bar", resourceProps.next()); - assertEquals("baz", resourceProps.next()); - assertFalse(resourceProps.hasNext()); - - persistentClass.removeProp(1); - resourceProps = xmlTypeAnnotation.getPropOrder().iterator(); - assertEquals("bar", resourceProps.next()); - assertFalse(resourceProps.hasNext()); - - persistentClass.removeProp(0); - resourceProps = xmlTypeAnnotation.getPropOrder().iterator(); - assertFalse(resourceProps.hasNext()); - } - - public void testMoveProp() throws Exception { - this.createTypeWithXmlType(); - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - persistentClass.addProp(0, "bar"); - persistentClass.addProp(1, "foo"); - persistentClass.addProp(2, "baz"); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - - assertEquals(3, xmlTypeAnnotation.getPropOrderSize()); - - persistentClass.moveProp(2, 0); - ListIterator props = persistentClass.getPropOrder().iterator(); - assertEquals("foo", props.next()); - assertEquals("baz", props.next()); - assertEquals("bar", props.next()); - assertFalse(props.hasNext()); - - ListIterator resourceProps = xmlTypeAnnotation.getPropOrder().iterator(); - assertEquals("foo", resourceProps.next()); - assertEquals("baz", resourceProps.next()); - assertEquals("bar", resourceProps.next()); - - - persistentClass.moveProp(0, 1); - props = persistentClass.getPropOrder().iterator(); - assertEquals("baz", props.next()); - assertEquals("foo", props.next()); - assertEquals("bar", props.next()); - assertFalse(props.hasNext()); - - resourceProps = xmlTypeAnnotation.getPropOrder().iterator(); - assertEquals("baz", resourceProps.next()); - assertEquals("foo", resourceProps.next()); - assertEquals("bar", resourceProps.next()); - } - - public void testSyncXmlNsPrefixes() throws Exception { - this.createTypeWithXmlType(); - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - ListIterator props = persistentClass.getPropOrder().iterator(); - assertFalse(props.hasNext()); - - //add 3 prop orders - AnnotatedElement annotatedElement = this.annotatedElement(resourceType); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addProp(declaration, 0, "bar"); - GenericJavaPersistentClassTests.this.addProp(declaration, 1, "foo"); - GenericJavaPersistentClassTests.this.addProp(declaration, 2, "baz"); - } - }); - - props = persistentClass.getPropOrder().iterator(); - assertTrue(props.hasNext()); - assertEquals("bar", props.next()); - assertEquals("foo", props.next()); - assertEquals("baz", props.next()); - assertFalse(props.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.moveProp(declaration, 2, 0); - } - }); - - props = persistentClass.getPropOrder().iterator(); - assertTrue(props.hasNext()); - assertEquals("foo", props.next()); - assertEquals("baz", props.next()); - assertEquals("bar", props.next()); - assertFalse(props.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.moveProp(declaration, 0, 1); - } - }); - - props = persistentClass.getPropOrder().iterator(); - assertTrue(props.hasNext()); - assertEquals("baz", props.next()); - assertEquals("foo", props.next()); - assertEquals("bar", props.next()); - assertFalse(props.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeProp(declaration, 1); - } - }); - - props = persistentClass.getPropOrder().iterator(); - assertTrue(props.hasNext()); - assertEquals("baz", props.next()); - assertEquals("bar", props.next()); - assertFalse(props.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeProp(declaration, 1); - } - }); - - props = persistentClass.getPropOrder().iterator(); - assertTrue(props.hasNext()); - assertEquals("baz", props.next()); - assertFalse(props.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeProp(declaration, 0); - } - }); - - props = persistentClass.getPropOrder().iterator(); - assertFalse(props.hasNext()); - } - - protected void addXmlTypeMemberValuePair(ModifiedDeclaration declaration, String name, String value) { - this.addMemberValuePair((MarkerAnnotation) this.getXmlTypeAnnotation(declaration), name, value); - } - - protected void addXmlTypeTypeMemberValuePair(ModifiedDeclaration declaration, String name, String typeName) { - this.addMemberValuePair( - (MarkerAnnotation) this.getXmlTypeAnnotation(declaration), - name, - this.newTypeLiteral(declaration.getAst(), typeName)); - } - - protected Annotation getXmlTypeAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlTypeAnnotation.ANNOTATION_NAME); - } - - protected void moveProp(ModifiedDeclaration declaration, int targetIndex, int sourceIndex) { - this.moveArrayElement((NormalAnnotation) getXmlTypeAnnotation(declaration), JAXB.XML_TYPE__PROP_ORDER, targetIndex, sourceIndex); - } - - protected void removeProp(ModifiedDeclaration declaration, int index) { - this.removeArrayElement((NormalAnnotation) getXmlTypeAnnotation(declaration), JAXB.XML_TYPE__PROP_ORDER, index); - } - - public void testModifyXmlRootElement() throws Exception { - createTypeWithXmlType(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - assertNull(persistentClass.getRootElement()); - assertFalse(persistentClass.isRootElement()); - - persistentClass.setRootElement("foo"); - XmlRootElementAnnotation xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlRootElementAnnotation.getName()); - assertEquals("foo", persistentClass.getRootElement().getName()); - assertTrue(persistentClass.isRootElement()); - - persistentClass.setRootElement(null); - xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); - assertNull(xmlRootElementAnnotation); - assertNull(persistentClass.getRootElement()); - assertFalse(persistentClass.isRootElement()); - } - - public void testUpdateXmlRootElement() throws Exception { - createTypeWithXmlType(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - assertNull(persistentClass.getRootElement()); - assertFalse(persistentClass.isRootElement()); - - - //add a XmlRootElement annotation - AnnotatedElement annotatedElement = this.annotatedElement(resourceType); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation annotation = GenericJavaPersistentClassTests.this.addNormalAnnotation(declaration.getDeclaration(), JAXB.XML_ROOT_ELEMENT); - GenericJavaPersistentClassTests.this.addMemberValuePair(annotation, JAXB.XML_ROOT_ELEMENT__NAME, "foo"); - } - }); - assertEquals("foo", persistentClass.getRootElement().getName()); - assertTrue(persistentClass.isRootElement()); - - //remove the XmlRootElement annotation - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, JAXB.XML_ROOT_ELEMENT); - } - }); - assertNull(persistentClass.getRootElement()); - assertFalse(persistentClass.isRootElement()); - } - - - public void testUpdateFieldAttributes() throws Exception { - this.createTestXmlTypeWithFieldAndPublicMemberAccess(); - - JaxbPersistentClass contextClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - - //public int foo; - this.publicFieldTest(contextClass); - - //public transient int foo; - this.publicTransientFieldTest(contextClass); - - //public static int foo; - this.publicStaticFieldTest(contextClass); - - //public final int foo; - this.publicFinalFieldTest(contextClass); - - //public static final int foo; - this.publicStaticFinalFieldTest(contextClass); - - //private int foo; - this.privateFieldTest(contextClass); - - // private transient int foo; - this.privateTransientFieldTest(contextClass); - - // @XmlAttribute - // private static int foo; //persistent - this.privateStaticFieldTest(contextClass); - - // @XmlAttribute - // private static final int foo; //persistent - this.privateStaticFinalFieldTest(contextClass); - } - - protected void publicFieldTest(JaxbPersistentClass contextClass) { - //public int foo; PUBLIC_MEMBER access - persistent - assertEquals(1, contextClass.getAttributesSize()); - Iterator attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //public int foo; //PROPERTY access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(0, contextClass.getAttributesSize()); - - //public int foo; //FIELD access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //public int foo; //NONE access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(0, contextClass.getAttributesSize()); - - //public int foo; PUBLIC_MEMBER access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - - //add @XmlTransient annotation and test each access type - JavaResourceField resourceField = ((JaxbPersistentField) contextClass.getAttributes().iterator().next()).getResourceField(); - AnnotatedElement annotatedElement = this.annotatedElement(resourceField); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlTransientAnnotation.ANNOTATION_NAME); - } - }); - //@XmlTransient - //public int foo; //PROPERTY access - not "persistent", but comes in to our context model because it is "mapped" - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlTransient - //public int foo; //FIELD access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlTransient - //public int foo; //NONE access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlTransient - //public int foo; PUBLIC_MEMBER access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlTransientAnnotation.ANNOTATION_NAME); - } - }); - } - - protected void publicTransientFieldTest(JaxbPersistentClass contextClass) { - Iterator attributes = contextClass.getAttributes().iterator(); - JavaResourceField resourceField = ((JaxbPersistentField) attributes.next()).getResourceField(); - - //public transient int foo; PUBLIC_MEMBER access - not persistent - this.addModifiers(resourceField, ModifierKeyword.TRANSIENT_KEYWORD); - assertEquals(0, contextClass.getAttributesSize()); - - //public transient int foo; //PROPERTY access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(0, contextClass.getAttributesSize()); - - //public transient int foo; //FIELD access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(0, contextClass.getAttributesSize()); - - //public transient int foo; //NONE access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(0, contextClass.getAttributesSize()); - - //public transient int foo; PUBLIC_MEMBER access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(0, contextClass.getAttributesSize()); - - this.removeModifiers(resourceField, ModifierKeyword.TRANSIENT_KEYWORD); - } - - protected void publicStaticFieldTest(JaxbPersistentClass contextClass) { - Iterator attributes = contextClass.getAttributes().iterator(); - JavaResourceField resourceField = ((JaxbPersistentField) attributes.next()).getResourceField(); - - //public static int foo; PUBLIC_MEMBER access - not persistent - this.addModifiers(resourceField, ModifierKeyword.STATIC_KEYWORD); - assertEquals(0, contextClass.getAttributesSize()); - - //public static int foo; //PROPERTY access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(0, contextClass.getAttributesSize()); - - //public static int foo; //FIELD access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(0, contextClass.getAttributesSize()); - - //public static int foo; //NONE access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(0, contextClass.getAttributesSize()); - - //public static int foo; PUBLIC_MEMBER access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(0, contextClass.getAttributesSize()); - - this.removeModifiers(resourceField, ModifierKeyword.STATIC_KEYWORD); - } - - protected void publicFinalFieldTest(JaxbPersistentClass contextClass) { - Iterator attributes = contextClass.getAttributes().iterator(); - JavaResourceField resourceField = ((JaxbPersistentField) attributes.next()).getResourceField(); - - //public final int foo; PUBLIC_MEMBER access - persistent - this.addModifiers(resourceField, ModifierKeyword.FINAL_KEYWORD); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //public final int foo; //PROPERTY access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(0, contextClass.getAttributesSize()); - - //public final int foo; //FIELD access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //public final int foo; //NONE access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(0, contextClass.getAttributesSize()); - - //public final int foo; PUBLIC_MEMBER access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - this.removeModifiers(resourceField, ModifierKeyword.FINAL_KEYWORD); - } - - protected void publicStaticFinalFieldTest(JaxbPersistentClass contextClass) { - Iterator attributes = contextClass.getAttributes().iterator(); - JavaResourceField resourceField = ((JaxbPersistentField) attributes.next()).getResourceField(); - - //public static final int foo; PUBLIC_MEMBER access - not persistent - this.addModifiers(resourceField, ModifierKeyword.STATIC_KEYWORD, ModifierKeyword.FINAL_KEYWORD); - assertEquals(0, contextClass.getAttributesSize()); - - //public static final int foo; //PROPERTY access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(0, contextClass.getAttributesSize()); - - //public static final int foo; //FIELD access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(0, contextClass.getAttributesSize()); - - //public static final int foo; //NONE access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(0, contextClass.getAttributesSize()); - - //public static final int foo; PUBLIC_MEMBER access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(0, contextClass.getAttributesSize()); - - this.removeModifiers(resourceField, ModifierKeyword.STATIC_KEYWORD, ModifierKeyword.FINAL_KEYWORD); - } - - protected void privateFieldTest(JaxbPersistentClass contextClass) { - Iterator attributes = contextClass.getAttributes().iterator(); - JavaResourceField resourceField = ((JaxbPersistentField) attributes.next()).getResourceField(); - removeModifiers(resourceField, ModifierKeyword.PUBLIC_KEYWORD); - addModifiers(resourceField, ModifierKeyword.PRIVATE_KEYWORD); - - //private int foo; PUBLIC_MEMBER access - not persistent - assertEquals(0, contextClass.getAttributesSize()); - - //private int foo; //PROPERTY access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(0, contextClass.getAttributesSize()); - - //private int foo; //FIELD access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //private int foo; //NONE access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(0, contextClass.getAttributesSize()); - - //private int foo; PUBLIC_MEMBER access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(0, contextClass.getAttributesSize()); - - - //add @XmlAttribute annotation and test each access type - AnnotatedElement annotatedElement = this.annotatedElement(resourceField); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - //@XmlAttribute - //private int foo; //PROPERTY access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //private int foo; //FIELD access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //private int foo; //NONE access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //private int foo; PUBLIC_MEMBER access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - removeModifiers(resourceField, ModifierKeyword.PRIVATE_KEYWORD); - addModifiers(resourceField, ModifierKeyword.PUBLIC_KEYWORD); - } - - protected void privateTransientFieldTest(JaxbPersistentClass contextClass) { - Iterator attributes = contextClass.getAttributes().iterator(); - JavaResourceField resourceField = ((JaxbPersistentField) attributes.next()).getResourceField(); - removeModifiers(resourceField, ModifierKeyword.PUBLIC_KEYWORD); - addModifiers(resourceField, ModifierKeyword.PRIVATE_KEYWORD, ModifierKeyword.TRANSIENT_KEYWORD); - - //private transient int foo; PUBLIC_MEMBER access - not persistent - assertEquals(0, contextClass.getAttributesSize()); - - //private transient int foo; //PROPERTY access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(0, contextClass.getAttributesSize()); - - //private transient int foo; //FIELD access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(0, contextClass.getAttributesSize()); - - //private transient int foo; //NONE access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(0, contextClass.getAttributesSize()); - - //private transient int foo; PUBLIC_MEMBER access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(0, contextClass.getAttributesSize()); - - - //add @XmlAttribute annotation and test each access type - AnnotatedElement annotatedElement = this.annotatedElement(resourceField); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - //@XmlAttribute - //private transient int foo; //PROPERTY access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //private transient int foo; //FIELD access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //private transient int foo; //NONE access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //private transient int foo; PUBLIC_MEMBER access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - removeModifiers(resourceField, ModifierKeyword.PRIVATE_KEYWORD, ModifierKeyword.TRANSIENT_KEYWORD); - addModifiers(resourceField, ModifierKeyword.PUBLIC_KEYWORD); - } - - protected void privateStaticFieldTest(JaxbPersistentClass contextClass) { - Iterator attributes = contextClass.getAttributes().iterator(); - JavaResourceField resourceField = ((JaxbPersistentField) attributes.next()).getResourceField(); - removeModifiers(resourceField, ModifierKeyword.PUBLIC_KEYWORD); - addModifiers(resourceField, ModifierKeyword.PRIVATE_KEYWORD, ModifierKeyword.STATIC_KEYWORD); - - //private static int foo; PUBLIC_MEMBER access - not persistent - assertEquals(0, contextClass.getAttributesSize()); - - //private static int foo; //PROPERTY access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(0, contextClass.getAttributesSize()); - - //private static int foo; //FIELD access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(0, contextClass.getAttributesSize()); - - //private static int foo; //NONE access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(0, contextClass.getAttributesSize()); - - //private static int foo; PUBLIC_MEMBER access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(0, contextClass.getAttributesSize()); - - - //add @XmlAttribute annotation and test each access type - AnnotatedElement annotatedElement = this.annotatedElement(resourceField); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - //@XmlAttribute - //private static int foo; //PROPERTY access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //private static int foo; //FIELD access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //private static int foo; //NONE access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //private static int foo; PUBLIC_MEMBER access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - removeModifiers(resourceField, ModifierKeyword.PRIVATE_KEYWORD, ModifierKeyword.STATIC_KEYWORD); - addModifiers(resourceField, ModifierKeyword.PUBLIC_KEYWORD); - } - - protected void privateStaticFinalFieldTest(JaxbPersistentClass contextClass) { - Iterator attributes = contextClass.getAttributes().iterator(); - JavaResourceField resourceField = ((JaxbPersistentField) attributes.next()).getResourceField(); - removeModifiers(resourceField, ModifierKeyword.PUBLIC_KEYWORD); - addModifiers(resourceField, ModifierKeyword.PRIVATE_KEYWORD, ModifierKeyword.STATIC_KEYWORD, ModifierKeyword.FINAL_KEYWORD); - - //private static final int foo; PUBLIC_MEMBER access - not persistent - assertEquals(0, contextClass.getAttributesSize()); - - //private static final int foo; //PROPERTY access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(0, contextClass.getAttributesSize()); - - //private static final int foo; //FIELD access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(0, contextClass.getAttributesSize()); - - //private static final int foo; //NONE access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(0, contextClass.getAttributesSize()); - - //private static final int foo; PUBLIC_MEMBER access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(0, contextClass.getAttributesSize()); - - - //add @XmlAttribute annotation and test each access type - AnnotatedElement annotatedElement = this.annotatedElement(resourceField); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - //@XmlAttribute - //private static final int foo; //PROPERTY access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //private static final int foo; //FIELD access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //private static final int foo; //NONE access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //private static final int foo; PUBLIC_MEMBER access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - } - - public void testUpdatePropertyAttributes() throws Exception { - this.createTestXmlTypeWithPropertyAndPublicMemberAccess(); - - JaxbPersistentClass contextClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - - //public int getFoo();, public void setFoo(int); - this.publicGetterSetterTest(contextClass); - - //public static int getFoo();, public static void setFoo(int); - this.publicStaticGetterSetterTest(contextClass); - - //private int getFoo();, private void setFoo(int); - this.privateGetterSetterTest(contextClass); - } - - public void testUpdateGetterPropertyAttributes() throws Exception { - this.createTestXmlTypeWithPropertyGetterAndPublicMemberAccess(); - - JaxbPersistentClass contextClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - - //public int getFoo(); PUBLIC_MEMBER access - not persistent - assertEquals(0, contextClass.getAttributesSize()); - - //public int getFoo(); PROPERTY access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(0, contextClass.getAttributesSize()); - - //public int getFoo(); FIELD access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(0, contextClass.getAttributesSize()); - - //public int getFoo(); NONE access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(0, contextClass.getAttributesSize()); - - //public int getFoo(); PUBLIC_MEMBER access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(0, contextClass.getAttributesSize()); - - - //add @XmlAttribute annotation and test each access type - JavaResourceMethod resourceMethod = contextClass.getJavaResourceType().getMethods().iterator().next(); - AnnotatedElement annotatedElement = this.annotatedElement(resourceMethod); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - //@XmlAttribute - //public int getFoo(); PROPERTY access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - Iterator attributes = contextClass.getAttributes().iterator(); - assertEquals(1, contextClass.getAttributesSize()); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //public int getFoo(); FIELD access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //public int getFoo(); NONE access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //public int getFoo(); PUBLIC_MEMBER access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - } - - public void testUpdateSetterPropertyAttributes() throws Exception { - this.createTestXmlTypeWithPropertySetterAndPublicMemberAccess(); - - JaxbPersistentClass contextClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - - //public void setFoo(int foo); PUBLIC_MEMBER access - not persistent - assertEquals(0, contextClass.getAttributesSize()); - - //public void setFoo(int foo); PROPERTY access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(0, contextClass.getAttributesSize()); - - //public void setFoo(int foo); FIELD access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(0, contextClass.getAttributesSize()); - - //public void setFoo(int foo); NONE access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(0, contextClass.getAttributesSize()); - - //public void setFoo(int foo); PUBLIC_MEMBER access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(0, contextClass.getAttributesSize()); - - - //add @XmlAttribute annotation and test each access type - JavaResourceMethod resourceMethod = contextClass.getJavaResourceType().getMethods().iterator().next(); - AnnotatedElement annotatedElement = this.annotatedElement(resourceMethod); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - //@XmlAttribute - //public void setFoo(int foo);; PROPERTY access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - Iterator attributes = contextClass.getAttributes().iterator(); - assertEquals(1, contextClass.getAttributesSize()); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //public void setFoo(int foo); FIELD access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //public void setFoo(int foo); NONE access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //public void setFoo(int foo); PUBLIC_MEMBER access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - } - - public void testUpdateGetterListPropertyAttributes() throws Exception { - this.createTestXmlTypeWithPropertyGetterListAndPublicMemberAccess(); - - JaxbPersistentClass contextClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - - //public List getFoo(); PUBLIC_MEMBER access - persistent - Iterator attributes = contextClass.getAttributes().iterator(); - assertEquals(1, contextClass.getAttributesSize()); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //public List getFoo(); PROPERTY access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - attributes = contextClass.getAttributes().iterator(); - assertEquals(1, contextClass.getAttributesSize()); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //public List getFoo(); FIELD access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(0, contextClass.getAttributesSize()); - - //public List getFoo(); NONE access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(0, contextClass.getAttributesSize()); - - //public List getFoo(); PUBLIC_MEMBER access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - attributes = contextClass.getAttributes().iterator(); - assertEquals(1, contextClass.getAttributesSize()); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - - //add @XmlAttribute annotation and test each access type - JavaResourceMethod resourceMethod = contextClass.getJavaResourceType().getMethods().iterator().next(); - AnnotatedElement annotatedElement = this.annotatedElement(resourceMethod); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - //@XmlAttribute - //public List getFoo(); PROPERTY access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - attributes = contextClass.getAttributes().iterator(); - assertEquals(1, contextClass.getAttributesSize()); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //public List getFoo(); FIELD access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //public List getFoo(); NONE access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //public List getFoo(); PUBLIC_MEMBER access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - } - - protected void publicGetterSetterTest(JaxbPersistentClass contextClass) { - //public int getFoo();, public void setFoo(int); PUBLIC_MEMBER access - persistent - assertEquals(1, contextClass.getAttributesSize()); - Iterator attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //public int getFoo();, public void setFoo(int); PROPERTY access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //public int getFoo();, public void setFoo(int); FIELD access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(0, contextClass.getAttributesSize()); - - //public int getFoo();, public void setFoo(int); NONE access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(0, contextClass.getAttributesSize()); - - //public int getFoo();, public void setFoo(int); PUBLIC_MEMBER access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - - //add @XmlAttribute annotation and test each access type - JavaResourceMethod resourceMethod = ((JaxbPersistentProperty) contextClass.getAttributes().iterator().next()).getResourceGetterMethod(); - AnnotatedElement annotatedElement = this.annotatedElement(resourceMethod); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - //@XmlAttribute - //public int getFoo();, public void setFoo(int); PROPERTY access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //public int getFoo();, public void setFoo(int); FIELD access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //public int getFoo();, public void setFoo(int); NONE access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //public int getFoo();, public void setFoo(int); PUBLIC_MEMBER access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - } - - protected void publicStaticGetterSetterTest(JaxbPersistentClass contextClass) { - Iterator attributes = contextClass.getAttributes().iterator(); - JaxbPersistentProperty contextProperty = (JaxbPersistentProperty) attributes.next(); - JavaResourceMethod resourceGetter = contextProperty.getResourceGetterMethod(); - JavaResourceMethod resourceSetter = contextProperty.getResourceSetterMethod(); - - //public static int getFoo();, public static void setFoo(int); PUBLIC_MEMBER access - not persistent - this.addModifiers(resourceGetter, ModifierKeyword.STATIC_KEYWORD); - this.addModifiers(resourceSetter, ModifierKeyword.STATIC_KEYWORD); - assertEquals(0, contextClass.getAttributesSize()); - - - //public static int getFoo();, public static void setFoo(int); PROPERTY access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(0, contextClass.getAttributesSize()); - - //public static int getFoo();, public static void setFoo(int); FIELD access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(0, contextClass.getAttributesSize()); - - //public static int getFoo();, public static void setFoo(int); NONE access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(0, contextClass.getAttributesSize()); - - //public static int getFoo();, public static void setFoo(int); PUBLIC_MEMBER access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(0, contextClass.getAttributesSize()); - - - //add @XmlAttribute annotation and test each access type - AnnotatedElement annotatedElement = this.annotatedElement(resourceGetter); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - //@XmlAttribute - //public static int getFoo();, public static void setFoo(int); PROPERTY access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //public static int getFoo();, public static void setFoo(int); FIELD access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //public static int getFoo();, public static void setFoo(int); NONE access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //public static int getFoo();, public static void setFoo(int); PUBLIC_MEMBER access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - this.removeModifiers(resourceGetter, ModifierKeyword.STATIC_KEYWORD); - this.removeModifiers(resourceSetter, ModifierKeyword.STATIC_KEYWORD); - } - - protected void privateGetterSetterTest(JaxbPersistentClass contextClass) { - Iterator attributes = contextClass.getAttributes().iterator(); - JaxbPersistentProperty contextProperty = (JaxbPersistentProperty) attributes.next(); - JavaResourceMethod resourceGetter = contextProperty.getResourceGetterMethod(); - JavaResourceMethod resourceSetter = contextProperty.getResourceSetterMethod(); - - //private int getFoo();, private void setFoo(int); PUBLIC_MEMBER access - not persistent - this.removeModifiers(resourceGetter, ModifierKeyword.PUBLIC_KEYWORD); - this.removeModifiers(resourceSetter, ModifierKeyword.PUBLIC_KEYWORD); - this.addModifiers(resourceGetter, ModifierKeyword.PRIVATE_KEYWORD); - this.addModifiers(resourceSetter, ModifierKeyword.PRIVATE_KEYWORD); - assertEquals(0, contextClass.getAttributesSize()); - - - //private int getFoo();, private void setFoo(int); PROPERTY access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //private int getFoo();, private void setFoo(int); FIELD access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(0, contextClass.getAttributesSize()); - - //private int getFoo();, private void setFoo(int); NONE access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(0, contextClass.getAttributesSize()); - - //private int getFoo();, private void setFoo(int); PUBLIC_MEMBER access - not persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(0, contextClass.getAttributesSize()); - - - //add @XmlAttribute annotation and test each access type - AnnotatedElement annotatedElement = this.annotatedElement(resourceGetter); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - //@XmlAttribute - //private int getFoo();, private void setFoo(int); PROPERTY access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PROPERTY); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //private int getFoo();, private void setFoo(int); FIELD access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__FIELD); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //private int getFoo();, private void setFoo(int); NONE access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__NONE); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - //@XmlAttribute - //private int getFoo();, private void setFoo(int); PUBLIC_MEMBER access - persistent - this.setAccessTypeInJavaSource(contextClass, JAXB.XML_ACCESS_TYPE__PUBLIC_MEMBER); - assertEquals(1, contextClass.getAttributesSize()); - attributes = contextClass.getAttributes().iterator(); - assertEquals("foo", attributes.next().getName()); - assertFalse(attributes.hasNext()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlAttributeAnnotation.ANNOTATION_NAME); - } - }); - this.removeModifiers(resourceGetter, ModifierKeyword.PRIVATE_KEYWORD); - this.removeModifiers(resourceSetter, ModifierKeyword.PRIVATE_KEYWORD); - this.addModifiers(resourceGetter, ModifierKeyword.PUBLIC_KEYWORD); - this.addModifiers(resourceSetter, ModifierKeyword.PUBLIC_KEYWORD); - } - - public void testModifyXmlJavaTypeAdapter() throws Exception { - createTypeWithXmlType(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(persistentClass.getXmlJavaTypeAdapter()); - assertNull(xmlJavaTypeAdapterAnnotation); - - persistentClass.addXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNotNull(persistentClass.getXmlJavaTypeAdapter()); - assertNotNull(xmlJavaTypeAdapterAnnotation); - - persistentClass.removeXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - - public void testUpdateXmlJavaTypeAdapter() throws Exception { - createTypeWithXmlType(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(persistentClass.getXmlJavaTypeAdapter()); - assertNull(xmlJavaTypeAdapterAnnotation); - - - //add an XmlJavaTypeAdapter annotation - AnnotatedElement annotatedElement = this.annotatedElement(resourceType); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNotNull(persistentClass.getXmlJavaTypeAdapter()); - assertNotNull(xmlJavaTypeAdapterAnnotation); - - //remove the XmlJavaTypeAdapter annotation - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(persistentClass.getXmlJavaTypeAdapter()); - assertNull(xmlJavaTypeAdapterAnnotation); - } - - protected void addModifiers(JavaResourceMember resourceMember, final ModifierKeyword... modifiers) { - AnnotatedElement annotatedElement = this.annotatedElement(resourceMember); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.addModifiers((BodyDeclaration) declaration.getDeclaration(), modifiers); - } - }); - } - - protected void removeModifiers(JavaResourceMember resourceMember, final ModifierKeyword... modifiers) { - AnnotatedElement annotatedElement = this.annotatedElement(resourceMember); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.removeModifiers((BodyDeclaration) declaration.getDeclaration(), modifiers); - } - }); - } - - protected void addModifiers(BodyDeclaration bodyDeclaration, ModifierKeyword... modifiers) { - for (ModifierKeyword modifier : modifiers) { - this.modifiers(bodyDeclaration).add(bodyDeclaration.getAST().newModifier(modifier)); - } - } - - protected void removeModifiers(BodyDeclaration bodyDeclaration, ModifierKeyword... modifierKeywords) { - for (ModifierKeyword modifierKeyWord : modifierKeywords) { - for (Iterator stream = this.modifiers(bodyDeclaration).iterator(); stream.hasNext();) { - IExtendedModifier modifier = stream.next(); - if (modifier.isModifier()) { - if (((Modifier) modifier).getKeyword() == modifierKeyWord) { - stream.remove(); - break; - } - } - } - } - } - - @SuppressWarnings("unchecked") - protected List modifiers(BodyDeclaration bodyDeclaration) { - return bodyDeclaration.modifiers(); - } - - protected void setAccessTypeInJavaSource(JaxbPersistentClass contextClass, final String accessType) { - JavaResourceType resourceClass = contextClass.getJavaResourceType(); - AnnotatedElement annotatedElement = this.annotatedElement(resourceClass); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentClassTests.this.setEnumMemberValuePair(declaration, XmlAccessorTypeAnnotation.ANNOTATION_NAME, accessType); - } - }); - } - -} \ No newline at end of file diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentEnumTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentEnumTests.java deleted file mode 100644 index a036c03943..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaPersistentEnumTests.java +++ /dev/null @@ -1,740 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context.java; - -import java.beans.Introspector; -import java.util.Iterator; -import java.util.ListIterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.EnumDeclaration; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.context.JaxbEnumConstant; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation; -import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; - - -@SuppressWarnings("nls") -public class GenericJavaPersistentEnumTests extends JaxbContextModelTestCase -{ - - public GenericJavaPersistentEnumTests(String name) { - super(name); - } - - private ICompilationUnit createEnumWithXmlEnum() throws Exception { - return createTestEnum(new DefaultEnumAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ENUM); - } - @Override - public void appendEnumAnnotationTo(StringBuilder sb) { - sb.append("@XmlEnum"); - } - }); - } - - public void testModifyFactoryClass() throws Exception { - createEnumWithXmlEnum(); - - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - assertNull(contextEnum.getFactoryClass()); - - contextEnum.setFactoryClass("foo"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlTypeAnnotation.getFactoryClass()); - assertEquals("foo", contextEnum.getFactoryClass()); - - contextEnum.setFactoryClass(null); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertNull(xmlTypeAnnotation.getFactoryClass()); - assertNull(contextEnum.getFactoryClass()); - - resourceEnum.removeAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertNull(contextEnum.getFactoryClass()); - } - - public void testUpdateFactoryClass() throws Exception { - createEnumWithXmlEnum(); - - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - assertNull(contextEnum.getFactoryClass()); - - - //add a factoryClass member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceEnum); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_TYPE); - GenericJavaPersistentEnumTests.this.addXmlTypeTypeMemberValuePair(declaration, JAXB.XML_TYPE__FACTORY_CLASS, "Foo"); - } - }); - assertEquals("Foo", contextEnum.getFactoryClass()); - - //remove the factoryClass member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlTypeAnnotation = (NormalAnnotation) GenericJavaPersistentEnumTests.this.getXmlTypeAnnotation(declaration); - GenericJavaPersistentEnumTests.this.values(xmlTypeAnnotation).remove(0); - } - }); - assertNull(contextEnum.getFactoryClass()); - } - - public void testModifyFactoryMethod() throws Exception { - createEnumWithXmlEnum(); - - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - assertNull(contextEnum.getFactoryMethod()); - - contextEnum.setFactoryMethod("foo"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlTypeAnnotation.getFactoryMethod()); - assertEquals("foo", contextEnum.getFactoryMethod()); - - contextEnum.setFactoryMethod(null); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertNull(xmlTypeAnnotation.getFactoryMethod()); - assertNull(contextEnum.getFactoryMethod()); - - resourceEnum.removeAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - - //set factoryMethod again, this time starting with no XmlType annotation - contextEnum.setFactoryMethod("foo"); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlTypeAnnotation.getFactoryMethod()); - assertEquals("foo", contextEnum.getFactoryMethod()); - } - - public void testUpdateFactoryMethod() throws Exception { - createEnumWithXmlEnum(); - - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - assertNull(contextEnum.getFactoryMethod()); - - - //add a factoryMethod member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceEnum); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_TYPE); - GenericJavaPersistentEnumTests.this.addXmlTypeMemberValuePair(declaration, JAXB.XML_TYPE__FACTORY_METHOD, "foo"); - } - }); - assertEquals("foo", contextEnum.getFactoryMethod()); - - //remove the factoryMethod member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlTypeAnnotation = (NormalAnnotation) GenericJavaPersistentEnumTests.this.getXmlTypeAnnotation(declaration); - GenericJavaPersistentEnumTests.this.values(xmlTypeAnnotation).remove(0); - } - }); - assertNull(contextEnum.getFactoryMethod()); - } - - public void testModifySchemaTypeName() throws Exception { - createEnumWithXmlEnum(); - - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - String defaultXmlTypeName = Introspector.decapitalize(TYPE_NAME); - - assertNull(contextEnum.getSpecifiedXmlTypeName()); - assertEquals(defaultXmlTypeName, contextEnum.getDefaultXmlTypeName()); - assertEquals(defaultXmlTypeName, contextEnum.getXmlTypeName()); - - contextEnum.setSpecifiedXmlTypeName("foo"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlTypeAnnotation.getName()); - assertEquals("foo", contextEnum.getSpecifiedXmlTypeName()); - assertEquals("foo", contextEnum.getXmlTypeName()); - - contextEnum.setSpecifiedXmlTypeName(null); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertNull(xmlTypeAnnotation.getName()); - assertNull(contextEnum.getSpecifiedXmlTypeName()); - assertEquals(defaultXmlTypeName, contextEnum.getXmlTypeName()); - - resourceEnum.removeAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - - //set name again, this time starting with no XmlType annotation - contextEnum.setSpecifiedXmlTypeName("foo"); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlTypeAnnotation.getName()); - assertEquals("foo", contextEnum.getSpecifiedXmlTypeName()); - assertEquals("foo", contextEnum.getXmlTypeName()); - } - - public void testUpdateSchemaTypeName() throws Exception { - createEnumWithXmlEnum(); - - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - String defaultXmlTypeName = Introspector.decapitalize(TYPE_NAME); - - assertNull(contextEnum.getSpecifiedXmlTypeName()); - assertEquals(defaultXmlTypeName, contextEnum.getDefaultXmlTypeName()); - assertEquals(defaultXmlTypeName, contextEnum.getXmlTypeName()); - - //add a namespace member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceEnum); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_TYPE); - GenericJavaPersistentEnumTests.this.addXmlTypeMemberValuePair(declaration, JAXB.XML_TYPE__NAME, "foo"); - } - }); - assertEquals("foo", contextEnum.getSpecifiedXmlTypeName()); - assertEquals("foo", contextEnum.getXmlTypeName()); - - //remove the namespace member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlTypeAnnotation = (NormalAnnotation) GenericJavaPersistentEnumTests.this.getXmlTypeAnnotation(declaration); - GenericJavaPersistentEnumTests.this.values(xmlTypeAnnotation).remove(0); - } - }); - assertNull(contextEnum.getSpecifiedXmlTypeName()); - assertEquals(defaultXmlTypeName, contextEnum.getXmlTypeName()); - } - - public void testModifyNamespace() throws Exception { - createEnumWithXmlEnum(); - - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - assertNull(contextEnum.getSpecifiedNamespace()); - assertEquals("", contextEnum.getDefaultNamespace()); - assertEquals("", contextEnum.getNamespace()); - - contextEnum.setSpecifiedNamespace("foo"); - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlTypeAnnotation.getNamespace()); - assertEquals("foo", contextEnum.getSpecifiedNamespace()); - assertEquals("foo", contextEnum.getNamespace()); - - contextEnum.setSpecifiedNamespace(null); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertNull(xmlTypeAnnotation.getNamespace()); - assertNull(contextEnum.getSpecifiedNamespace()); - assertEquals("", contextEnum.getNamespace()); - - resourceEnum.removeAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - - //set namespace again, this time starting with no XmlType annotation - contextEnum.setSpecifiedNamespace("foo"); - xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlTypeAnnotation.getNamespace()); - assertEquals("foo", contextEnum.getSpecifiedNamespace()); - assertEquals("foo", contextEnum.getNamespace()); - } - - public void testUpdateNamespace() throws Exception { - createEnumWithXmlEnum(); - - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - assertNull(contextEnum.getSpecifiedNamespace()); - assertEquals("", contextEnum.getDefaultNamespace()); - assertEquals("", contextEnum.getNamespace()); - - //add a namespace member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceEnum); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.addMarkerAnnotation(declaration.getDeclaration(), JAXB.XML_TYPE); - GenericJavaPersistentEnumTests.this.addXmlTypeMemberValuePair(declaration, JAXB.XML_TYPE__NAMESPACE, "foo"); - } - }); - assertEquals("foo", contextEnum.getSpecifiedNamespace()); - assertEquals("foo", contextEnum.getNamespace()); - - //remove the namespace member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlTypeAnnotation = (NormalAnnotation) GenericJavaPersistentEnumTests.this.getXmlTypeAnnotation(declaration); - GenericJavaPersistentEnumTests.this.values(xmlTypeAnnotation).remove(0); - } - }); - assertNull(contextEnum.getSpecifiedNamespace()); - assertEquals("", contextEnum.getNamespace()); - } - - public void testGetPropOrder() throws Exception { - this.createEnumWithXmlEnum(); - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - ListIterator props = contextEnum.getPropOrder().iterator(); - assertFalse(props.hasNext()); - - //add 2 prop orders - AnnotatedElement annotatedElement = this.annotatedElement(resourceEnum); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.addProp(declaration, 0, "bar"); - GenericJavaPersistentEnumTests.this.addProp(declaration, 1, "foo"); - } - }); - - props = contextEnum.getPropOrder().iterator(); - assertEquals("bar", props.next()); - assertEquals("foo", props.next()); - assertFalse(props.hasNext()); - } - - protected void addProp(ModifiedDeclaration declaration, int index, String prop) { - this.addArrayElement(declaration, JAXB.XML_TYPE, index, JAXB.XML_TYPE__PROP_ORDER, this.newStringLiteral(declaration.getAst(), prop)); - } - - public void testGetPropOrderSize() throws Exception { - this.createEnumWithXmlEnum(); - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - assertEquals(0, contextEnum.getPropOrderSize()); - - //add 2 prop orders - AnnotatedElement annotatedElement = this.annotatedElement(resourceEnum); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.addProp(declaration, 0, "bar"); - GenericJavaPersistentEnumTests.this.addProp(declaration, 1, "foo"); - } - }); - assertEquals(2, contextEnum.getPropOrderSize()); - } - - public void testAddProp() throws Exception { - this.createEnumWithXmlEnum(); - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - contextEnum.addProp(0, "bar"); - contextEnum.addProp(0, "foo"); - contextEnum.addProp(0, "baz"); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - ListIterator props = xmlTypeAnnotation.getPropOrder().iterator(); - - assertEquals("baz", props.next()); - assertEquals("foo", props.next()); - assertEquals("bar", props.next()); - assertFalse(props.hasNext()); - } - - public void testAddProp2() throws Exception { - this.createEnumWithXmlEnum(); - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - contextEnum.addProp(0, "bar"); - contextEnum.addProp(1, "foo"); - contextEnum.addProp(0, "baz"); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - ListIterator props = xmlTypeAnnotation.getPropOrder().iterator(); - - assertEquals("baz", props.next()); - assertEquals("bar", props.next()); - assertEquals("foo", props.next()); - assertFalse(props.hasNext()); - } - - public void testRemoveProp() throws Exception { - this.createEnumWithXmlEnum(); - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - contextEnum.addProp(0, "bar"); - contextEnum.addProp(1, "foo"); - contextEnum.addProp(2, "baz"); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - - contextEnum.removeProp(1); - - ListIterator resourceProps = xmlTypeAnnotation.getPropOrder().iterator(); - assertEquals("bar", resourceProps.next()); - assertEquals("baz", resourceProps.next()); - assertFalse(resourceProps.hasNext()); - - contextEnum.removeProp(1); - resourceProps = xmlTypeAnnotation.getPropOrder().iterator(); - assertEquals("bar", resourceProps.next()); - assertFalse(resourceProps.hasNext()); - - contextEnum.removeProp(0); - resourceProps = xmlTypeAnnotation.getPropOrder().iterator(); - assertFalse(resourceProps.hasNext()); - } - - public void testMoveProp() throws Exception { - this.createEnumWithXmlEnum(); - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - contextEnum.addProp(0, "bar"); - contextEnum.addProp(1, "foo"); - contextEnum.addProp(2, "baz"); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceEnum.getAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - - assertEquals(3, xmlTypeAnnotation.getPropOrderSize()); - - contextEnum.moveProp(2, 0); - ListIterator props = contextEnum.getPropOrder().iterator(); - assertEquals("foo", props.next()); - assertEquals("baz", props.next()); - assertEquals("bar", props.next()); - assertFalse(props.hasNext()); - - ListIterator resourceProps = xmlTypeAnnotation.getPropOrder().iterator(); - assertEquals("foo", resourceProps.next()); - assertEquals("baz", resourceProps.next()); - assertEquals("bar", resourceProps.next()); - - - contextEnum.moveProp(0, 1); - props = contextEnum.getPropOrder().iterator(); - assertEquals("baz", props.next()); - assertEquals("foo", props.next()); - assertEquals("bar", props.next()); - assertFalse(props.hasNext()); - - resourceProps = xmlTypeAnnotation.getPropOrder().iterator(); - assertEquals("baz", resourceProps.next()); - assertEquals("foo", resourceProps.next()); - assertEquals("bar", resourceProps.next()); - } - - public void testSyncXmlNsPrefixes() throws Exception { - this.createEnumWithXmlEnum(); - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - ListIterator props = contextEnum.getPropOrder().iterator(); - assertFalse(props.hasNext()); - - //add 3 prop orders - AnnotatedElement annotatedElement = this.annotatedElement(resourceEnum); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.addProp(declaration, 0, "bar"); - GenericJavaPersistentEnumTests.this.addProp(declaration, 1, "foo"); - GenericJavaPersistentEnumTests.this.addProp(declaration, 2, "baz"); - } - }); - - props = contextEnum.getPropOrder().iterator(); - assertTrue(props.hasNext()); - assertEquals("bar", props.next()); - assertEquals("foo", props.next()); - assertEquals("baz", props.next()); - assertFalse(props.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.moveProp(declaration, 2, 0); - } - }); - - props = contextEnum.getPropOrder().iterator(); - assertTrue(props.hasNext()); - assertEquals("foo", props.next()); - assertEquals("baz", props.next()); - assertEquals("bar", props.next()); - assertFalse(props.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.moveProp(declaration, 0, 1); - } - }); - - props = contextEnum.getPropOrder().iterator(); - assertTrue(props.hasNext()); - assertEquals("baz", props.next()); - assertEquals("foo", props.next()); - assertEquals("bar", props.next()); - assertFalse(props.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.removeProp(declaration, 1); - } - }); - - props = contextEnum.getPropOrder().iterator(); - assertTrue(props.hasNext()); - assertEquals("baz", props.next()); - assertEquals("bar", props.next()); - assertFalse(props.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.removeProp(declaration, 1); - } - }); - - props = contextEnum.getPropOrder().iterator(); - assertTrue(props.hasNext()); - assertEquals("baz", props.next()); - assertFalse(props.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.removeProp(declaration, 0); - } - }); - - props = contextEnum.getPropOrder().iterator(); - assertFalse(props.hasNext()); - } - - protected void addXmlTypeMemberValuePair(ModifiedDeclaration declaration, String name, String value) { - this.addMemberValuePair((MarkerAnnotation) this.getXmlTypeAnnotation(declaration), name, value); - } - - protected void addXmlTypeTypeMemberValuePair(ModifiedDeclaration declaration, String name, String typeName) { - this.addMemberValuePair( - (MarkerAnnotation) this.getXmlTypeAnnotation(declaration), - name, - this.newTypeLiteral(declaration.getAst(), typeName)); - } - - protected void addXmlEnumTypeMemberValuePair(ModifiedDeclaration declaration, String name, String typeName) { - this.addMemberValuePair( - (MarkerAnnotation) this.getXmlEnumAnnotation(declaration), - name, - this.newTypeLiteral(declaration.getAst(), typeName)); - } - - protected Annotation getXmlTypeAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlTypeAnnotation.ANNOTATION_NAME); - } - - protected Annotation getXmlEnumAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlEnumAnnotation.ANNOTATION_NAME); - } - - protected void moveProp(ModifiedDeclaration declaration, int targetIndex, int sourceIndex) { - this.moveArrayElement((NormalAnnotation) getXmlTypeAnnotation(declaration), JAXB.XML_TYPE__PROP_ORDER, targetIndex, sourceIndex); - } - - protected void removeProp(ModifiedDeclaration declaration, int index) { - this.removeArrayElement((NormalAnnotation) getXmlTypeAnnotation(declaration), JAXB.XML_TYPE__PROP_ORDER, index); - } - - public void testModifyXmlRootElement() throws Exception { - createEnumWithXmlEnum(); - - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - assertNull(contextEnum.getRootElement()); - assertFalse(contextEnum.isRootElement()); - - contextEnum.setRootElement("foo"); - XmlRootElementAnnotation xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceEnum.getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlRootElementAnnotation.getName()); - assertEquals("foo", contextEnum.getRootElement().getName()); - assertTrue(contextEnum.isRootElement()); - - contextEnum.setRootElement(null); - xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceEnum.getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); - assertNull(xmlRootElementAnnotation); - assertNull(contextEnum.getRootElement()); - assertFalse(contextEnum.isRootElement()); - } - - public void testUpdateXmlRootElement() throws Exception { - createEnumWithXmlEnum(); - - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - assertNull(contextEnum.getRootElement()); - assertFalse(contextEnum.isRootElement()); - - - //add a XmlRootElement annotation - AnnotatedElement annotatedElement = this.annotatedElement(resourceEnum); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation annotation = GenericJavaPersistentEnumTests.this.addNormalAnnotation(declaration.getDeclaration(), JAXB.XML_ROOT_ELEMENT); - GenericJavaPersistentEnumTests.this.addMemberValuePair(annotation, JAXB.XML_ROOT_ELEMENT__NAME, "foo"); - } - }); - assertEquals("foo", contextEnum.getRootElement().getName()); - assertTrue(contextEnum.isRootElement()); - - //remove the XmlRootElement annotation - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.removeAnnotation(declaration, JAXB.XML_ROOT_ELEMENT); - } - }); - assertNull(contextEnum.getRootElement()); - assertFalse(contextEnum.isRootElement()); - } - - public void testModifyEnumType() throws Exception { - createEnumWithXmlEnum(); - - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - assertNull(contextEnum.getEnumType()); - - contextEnum.setEnumType("Integer"); - XmlEnumAnnotation xmlEnumAnnotation = (XmlEnumAnnotation) resourceEnum.getAnnotation(XmlEnumAnnotation.ANNOTATION_NAME); - assertEquals("Integer", xmlEnumAnnotation.getValue()); - assertEquals("Integer", contextEnum.getEnumType()); - - contextEnum.setEnumType(null); - xmlEnumAnnotation = (XmlEnumAnnotation) resourceEnum.getAnnotation(XmlEnumAnnotation.ANNOTATION_NAME); - assertNull(xmlEnumAnnotation.getValue()); - assertNull(contextEnum.getEnumType()); - - resourceEnum.addAnnotation(XmlTypeAnnotation.ANNOTATION_NAME); - resourceEnum.removeAnnotation(XmlEnumAnnotation.ANNOTATION_NAME); - contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - assertNull(contextEnum.getEnumType()); - } - - public void testUpdateEnumType() throws Exception { - createEnumWithXmlEnum(); - - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - assertNull(contextEnum.getEnumType()); - - - //add a factoryClass member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceEnum); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.addXmlEnumTypeMemberValuePair(declaration, JAXB.XML_ENUM__VALUE, "String"); - } - }); - assertEquals("String", contextEnum.getEnumType()); - - //remove the factoryClass member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlEnumAnnotation = (NormalAnnotation) GenericJavaPersistentEnumTests.this.getXmlEnumAnnotation(declaration); - GenericJavaPersistentEnumTests.this.values(xmlEnumAnnotation).remove(0); - } - }); - assertNull(contextEnum.getEnumType()); - } - - public void testUpdateEnumConstants() throws Exception { - createEnumWithXmlEnum(); - - JaxbPersistentEnum contextEnum = CollectionTools.get(getContextRoot().getPersistentEnums(), 0); - JavaResourceEnum resourceEnum = contextEnum.getJavaResourceType(); - - assertEquals(2, contextEnum.getEnumConstantsSize()); - Iterator enumConstants = contextEnum.getEnumConstants().iterator(); - JaxbEnumConstant enumConstant = enumConstants.next(); - assertEquals("SUNDAY", enumConstant.getName()); - enumConstant = enumConstants.next(); - assertEquals("MONDAY", enumConstant.getName()); - assertFalse(enumConstants.hasNext()); - - - AnnotatedElement annotatedElement = this.annotatedElement(resourceEnum); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.addEnumConstant((EnumDeclaration) declaration.getDeclaration(), "TUESDAY"); - GenericJavaPersistentEnumTests.this.addEnumConstant((EnumDeclaration) declaration.getDeclaration(), "WEDNESDAY"); - } - }); - assertEquals(4, contextEnum.getEnumConstantsSize()); - enumConstants = contextEnum.getEnumConstants().iterator(); - enumConstant = enumConstants.next(); - assertEquals("SUNDAY", enumConstant.getName()); - enumConstant = enumConstants.next(); - assertEquals("MONDAY", enumConstant.getName()); - enumConstant = enumConstants.next(); - assertEquals("TUESDAY", enumConstant.getName()); - enumConstant = enumConstants.next(); - assertEquals("WEDNESDAY", enumConstant.getName()); - assertFalse(enumConstants.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.removeEnumConstant((EnumDeclaration) declaration.getDeclaration(), "SUNDAY"); - } - }); - assertEquals(3, contextEnum.getEnumConstantsSize()); - enumConstants = contextEnum.getEnumConstants().iterator(); - enumConstant = enumConstants.next(); - assertEquals("MONDAY", enumConstant.getName()); - enumConstant = enumConstants.next(); - assertEquals("TUESDAY", enumConstant.getName()); - enumConstant = enumConstants.next(); - assertEquals("WEDNESDAY", enumConstant.getName()); - assertFalse(enumConstants.hasNext()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.removeEnumConstant((EnumDeclaration) declaration.getDeclaration(), "TUESDAY"); - GenericJavaPersistentEnumTests.this.removeEnumConstant((EnumDeclaration) declaration.getDeclaration(), "MONDAY"); - } - }); - assertEquals(1, contextEnum.getEnumConstantsSize()); - enumConstants = contextEnum.getEnumConstants().iterator(); - enumConstant = enumConstants.next(); - assertEquals("WEDNESDAY", enumConstant.getName()); - assertFalse(enumConstants.hasNext()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaPersistentEnumTests.this.removeEnumConstant((EnumDeclaration) declaration.getDeclaration(), "WEDNESDAY"); - } - }); - assertEquals(0, contextEnum.getEnumConstantsSize()); - assertFalse(contextEnum.getEnumConstants().iterator().hasNext()); - - } -} \ No newline at end of file diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaRegistryTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaRegistryTests.java deleted file mode 100644 index e6d52157dd..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaRegistryTests.java +++ /dev/null @@ -1,209 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.Block; -import org.eclipse.jdt.core.dom.BodyDeclaration; -import org.eclipse.jdt.core.dom.IExtendedModifier; -import org.eclipse.jdt.core.dom.MethodDeclaration; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jdt.core.dom.SingleVariableDeclaration; -import org.eclipse.jdt.core.dom.TypeDeclaration; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.context.JaxbElementFactoryMethod; -import org.eclipse.jpt.jaxb.core.context.JaxbRegistry; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; - - -@SuppressWarnings("nls") -public class GenericJavaRegistryTests extends JaxbContextModelTestCase -{ - - public GenericJavaRegistryTests(String name) { - super(name); - } - - private ICompilationUnit createTypeWithXmlRegistry() throws Exception { - return this.createTestType(PACKAGE_NAME, "ObjectFactory.java", "ObjectFactory", new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_REGISTRY, JAXB.XML_ELEMENT_DECL, "javax.xml.bind.JAXBElement"); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlRegistry"); - } - - @Override - public void appendGetNameMethodAnnotationTo(StringBuilder sb) { - sb.append("@XmlElementDecl(name=\"foo\")").append(CR); - sb.append(" JAXBElement createFoo(AnnotationTestType value) {return null}").append(CR); - sb.append(CR); - sb.append(" @XmlElementDecl(name=\"bar\")").append(CR); - sb.append(" JAXBElement createBar(Object value) {return null}").append(CR); - sb.append(CR); - } - }); - } - - private ICompilationUnit createTypeWithXmlType() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType").append(CR); - } - }); - } - - - protected void addElementFactoryMethod(TypeDeclaration typeDeclaration, String methodName) { - AST ast = typeDeclaration.getAST(); - MethodDeclaration methodDeclaration = this.newMethodDeclaration(ast, methodName); - Block body = ast.newBlock(); - methodDeclaration.setBody(body); - methodDeclaration.setReturnType2(ast.newSimpleType(ast.newName("JAXBElement"))); - SingleVariableDeclaration parameter = ast.newSingleVariableDeclaration(); - parameter.setName(ast.newSimpleName("value")); - parameter.setType(ast.newSimpleType(ast.newName("Object"))); - parameters(methodDeclaration).add(parameter); - NormalAnnotation elementDeclAnnotation = this.newNormalAnnotation(ast, "XmlElementDecl"); - modifiers(methodDeclaration).add(elementDeclAnnotation); - this.bodyDeclarations(typeDeclaration).add(methodDeclaration); - } - - protected MethodDeclaration newMethodDeclaration(AST ast, String methodName) { - MethodDeclaration methodDeclaration = ast.newMethodDeclaration(); - methodDeclaration.setName(ast.newSimpleName(methodName)); - return methodDeclaration; - } - - /** - * minimize the scope of the suppressed warnings - */ - @SuppressWarnings("unchecked") - protected List bodyDeclarations(TypeDeclaration td) { - return td.bodyDeclarations(); - } - - @SuppressWarnings("unchecked") - protected List parameters(MethodDeclaration md) { - return md.parameters(); - } - - @SuppressWarnings("unchecked") - protected List modifiers(MethodDeclaration md) { - return md.modifiers(); - } - - protected void removeMethodDeclaration(TypeDeclaration typeDeclaration, String methodName) { - for (MethodDeclaration md : typeDeclaration.getMethods()) { - if (md.getName().getFullyQualifiedName().equals(methodName)) { - this.bodyDeclarations(typeDeclaration).remove(md); - break; - } - } - } - - public void testUpdateElementFactoryMethods() throws Exception { - createTypeWithXmlType(); - createTypeWithXmlRegistry(); - - JaxbRegistry contextRegistry = CollectionTools.get(getContextRoot().getRegistries(), 0); - JavaResourceType resourceType = contextRegistry.getJavaResourceType(); - - assertEquals(2, contextRegistry.getElementFactoryMethodsSize()); - Iterator elementFactoryMethods = contextRegistry.getElementFactoryMethods().iterator(); - JaxbElementFactoryMethod elementFactoryMethod = elementFactoryMethods.next(); - assertEquals("createFoo", elementFactoryMethod.getName()); - assertEquals("foo", elementFactoryMethod.getElementName()); - elementFactoryMethod = elementFactoryMethods.next(); - assertEquals("createBar", elementFactoryMethod.getName()); - assertEquals("bar", elementFactoryMethod.getElementName()); - assertFalse(elementFactoryMethods.hasNext()); - - - AnnotatedElement annotatedElement = this.annotatedElement(resourceType); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaRegistryTests.this.addElementFactoryMethod((TypeDeclaration) declaration.getDeclaration(), "createFoo2"); - GenericJavaRegistryTests.this.addElementFactoryMethod((TypeDeclaration) declaration.getDeclaration(), "createBar2"); - } - }); - assertEquals(4, contextRegistry.getElementFactoryMethodsSize()); - elementFactoryMethods = contextRegistry.getElementFactoryMethods().iterator(); - elementFactoryMethod = elementFactoryMethods.next(); - assertEquals("createFoo", elementFactoryMethod.getName()); - assertEquals("foo", elementFactoryMethod.getElementName()); - elementFactoryMethod = elementFactoryMethods.next(); - assertEquals("createBar", elementFactoryMethod.getName()); - assertEquals("bar", elementFactoryMethod.getElementName()); - elementFactoryMethod = elementFactoryMethods.next(); - assertEquals("createFoo2", elementFactoryMethod.getName()); - assertEquals(null, elementFactoryMethod.getElementName()); - elementFactoryMethod = elementFactoryMethods.next(); - assertEquals("createBar2", elementFactoryMethod.getName()); - assertEquals(null, elementFactoryMethod.getElementName()); - assertFalse(elementFactoryMethods.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaRegistryTests.this.removeMethodDeclaration((TypeDeclaration) declaration.getDeclaration(), "createFoo"); - } - }); - assertEquals(3, contextRegistry.getElementFactoryMethodsSize()); - elementFactoryMethods = contextRegistry.getElementFactoryMethods().iterator(); - elementFactoryMethod = elementFactoryMethods.next(); - assertEquals("createBar", elementFactoryMethod.getName()); - assertEquals("bar", elementFactoryMethod.getElementName()); - elementFactoryMethod = elementFactoryMethods.next(); - assertEquals("createFoo2", elementFactoryMethod.getName()); - assertEquals(null, elementFactoryMethod.getElementName()); - elementFactoryMethod = elementFactoryMethods.next(); - assertEquals("createBar2", elementFactoryMethod.getName()); - assertEquals(null, elementFactoryMethod.getElementName()); - assertFalse(elementFactoryMethods.hasNext()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaRegistryTests.this.removeMethodDeclaration((TypeDeclaration) declaration.getDeclaration(), "createFoo2"); - GenericJavaRegistryTests.this.removeMethodDeclaration((TypeDeclaration) declaration.getDeclaration(), "createBar2"); - } - }); - assertEquals(1, contextRegistry.getElementFactoryMethodsSize()); - elementFactoryMethods = contextRegistry.getElementFactoryMethods().iterator(); - elementFactoryMethod = elementFactoryMethods.next(); - assertEquals("createBar", elementFactoryMethod.getName()); - assertEquals("bar", elementFactoryMethod.getElementName()); - assertFalse(elementFactoryMethods.hasNext()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaRegistryTests.this.removeMethodDeclaration((TypeDeclaration) declaration.getDeclaration(), "createBar"); - } - }); - assertEquals(0, contextRegistry.getElementFactoryMethodsSize()); - assertFalse(contextRegistry.getElementFactoryMethods().iterator().hasNext()); - } -} \ No newline at end of file diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaTypeXmlJavaTypeAdapterTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaTypeXmlJavaTypeAdapterTests.java deleted file mode 100644 index f2568cc326..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaTypeXmlJavaTypeAdapterTests.java +++ /dev/null @@ -1,171 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.XmlJavaTypeAdapter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; - - -@SuppressWarnings("nls") -public class GenericJavaTypeXmlJavaTypeAdapterTests extends JaxbContextModelTestCase -{ - - public GenericJavaTypeXmlJavaTypeAdapterTests(String name) { - super(name); - } - - private ICompilationUnit createTypeWithXmlTypeWithXmlJavaTypeAdapter() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE, JAXB.XML_JAVA_TYPE_ADAPTER); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType").append(CR); - sb.append("@XmlJavaTypeAdapter"); - } - }); - } - - public void testModifyValue() throws Exception { - this.createTypeWithXmlTypeWithXmlJavaTypeAdapter(); - JaxbPersistentClass contextPersistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextPersistentClass.getXmlJavaTypeAdapter(); - JavaResourceType resourceType = contextPersistentClass.getJavaResourceType(); - - assertNull(contextXmlJavaTypeAdapter.getValue()); - - contextXmlJavaTypeAdapter.setValue("foo"); - XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertEquals("foo", javaTypeAdapterAnnotation.getValue()); - assertEquals("foo", contextXmlJavaTypeAdapter.getValue()); - - //verify the xml schema type annotation is not removed when the value is set to null - contextXmlJavaTypeAdapter.setValue(null); - javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(javaTypeAdapterAnnotation.getValue()); - assertNull(contextXmlJavaTypeAdapter.getValue()); - } - - public void testUpdateValue() throws Exception { - this.createTypeWithXmlTypeWithXmlJavaTypeAdapter(); - JaxbPersistentClass contextPersistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextPersistentClass.getXmlJavaTypeAdapter(); - JavaResourceType resourceType = contextPersistentClass.getJavaResourceType(); - - assertNull(contextXmlJavaTypeAdapter.getValue()); - - //add a value member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceType); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaTypeXmlJavaTypeAdapterTests.this.addXmlJavaTypeAdapterTypeMemberValuePair(declaration, JAXB.XML_JAVA_TYPE_ADAPTER__VALUE, "String"); - } - }); - assertEquals("String", contextXmlJavaTypeAdapter.getValue()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaTypeXmlJavaTypeAdapterTests.this.removeXmlJavaTypeAdapterAnnotation(declaration); - } - }); - assertNull(contextPersistentClass.getXmlJavaTypeAdapter()); - } - - public void testModifyType() throws Exception { - this.createTypeWithXmlTypeWithXmlJavaTypeAdapter(); - JaxbPersistentClass contextPersistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextPersistentClass.getXmlJavaTypeAdapter(); - JavaResourceType resourceType = contextPersistentClass.getJavaResourceType(); - - assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getType()); - assertNull(contextXmlJavaTypeAdapter.getSpecifiedType()); - assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getDefaultType()); - - contextXmlJavaTypeAdapter.setSpecifiedType("foo"); - XmlJavaTypeAdapterAnnotation javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertEquals("foo", javaTypeAdapterAnnotation.getType()); - assertEquals("foo", contextXmlJavaTypeAdapter.getSpecifiedType()); - assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getDefaultType()); - - contextXmlJavaTypeAdapter.setSpecifiedType(null); - javaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(javaTypeAdapterAnnotation.getType()); - assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getType()); - assertNull(contextXmlJavaTypeAdapter.getSpecifiedType()); - assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getDefaultType()); - } - - public void testUpdateType() throws Exception { - this.createTypeWithXmlTypeWithXmlJavaTypeAdapter(); - JaxbPersistentClass contextPersistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlJavaTypeAdapter contextXmlJavaTypeAdapter = contextPersistentClass.getXmlJavaTypeAdapter(); - JavaResourceType resourceType = contextPersistentClass.getJavaResourceType(); - - assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getType()); - assertNull(contextXmlJavaTypeAdapter.getSpecifiedType()); - assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getDefaultType()); - - //add a type member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceType); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaTypeXmlJavaTypeAdapterTests.this.addXmlJavaTypeAdapterTypeMemberValuePair(declaration, JAXB.XML_JAVA_TYPE_ADAPTER__TYPE, "String"); - } - }); - assertEquals("String", contextXmlJavaTypeAdapter.getSpecifiedType()); - assertEquals("String", contextXmlJavaTypeAdapter.getType()); - assertEquals(FULLY_QUALIFIED_TYPE_NAME, contextXmlJavaTypeAdapter.getDefaultType()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaTypeXmlJavaTypeAdapterTests.this.removeXmlJavaTypeAdapterAnnotation(declaration); - } - }); - assertNull(contextPersistentClass.getXmlJavaTypeAdapter()); - } - - protected void addXmlJavaTypeAdapterTypeMemberValuePair(ModifiedDeclaration declaration, String name, String typeName) { - this.addMemberValuePair( - (MarkerAnnotation) this.getXmlJavaTypeAdapterAnnotation(declaration), - name, - this.newTypeLiteral(declaration.getAst(), typeName)); - } - - protected void addXmlJavaTypeAdapterMemberValuePair(ModifiedDeclaration declaration, String name, String value) { - this.addMemberValuePair((MarkerAnnotation) this.getXmlJavaTypeAdapterAnnotation(declaration), name, value); - } - - //add another package annotation so that the context model object doesn't get removed when - //removing the XmlJavaTypeAdapter annotation. Only "annotated" packages are added to the context model - protected void removeXmlJavaTypeAdapterAnnotation(ModifiedDeclaration declaration) { - this.addMarkerAnnotation(declaration.getDeclaration(), XmlAccessorOrderAnnotation.ANNOTATION_NAME); - this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - - protected Annotation getXmlJavaTypeAdapterAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAttributeMappingTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAttributeMappingTests.java deleted file mode 100644 index b43a41fe0c..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlAttributeMappingTests.java +++ /dev/null @@ -1,437 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.MappingKeys; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.XmlAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.XmlElementMapping; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; -import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; - - -@SuppressWarnings("nls") -public class GenericJavaXmlAttributeMappingTests extends JaxbContextModelTestCase -{ - - public GenericJavaXmlAttributeMappingTests(String name) { - super(name); - } - - private ICompilationUnit createTypeWithXmlAttribute() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE, JAXB.XML_ATTRIBUTE); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType"); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlAttribute"); - } - }); - } - - public void testModifyName() throws Exception { - createTypeWithXmlAttribute(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlAttributeMapping.getSpecifiedName()); - assertEquals("id", xmlAttributeMapping.getDefaultName()); - assertEquals("id", xmlAttributeMapping.getName()); - - xmlAttributeMapping.setSpecifiedName("foo"); - XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlAttributeAnnotation.getName()); - assertEquals("foo", xmlAttributeMapping.getSpecifiedName()); - assertEquals("id", xmlAttributeMapping.getDefaultName()); - assertEquals("foo", xmlAttributeMapping.getName()); - - xmlAttributeMapping.setSpecifiedName(null); - xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME); - assertNull(xmlAttributeAnnotation.getName()); - assertNull(xmlAttributeMapping.getSpecifiedName()); - } - - public void testUpdateName() throws Exception { - createTypeWithXmlAttribute(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlAttributeMapping.getSpecifiedName()); - - - //add a Name member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.addXmlAttributeMemberValuePair(declaration, JAXB.XML_ATTRIBUTE__NAME, "foo"); - } - }); - assertEquals("foo", xmlAttributeMapping.getName()); - - //remove the Name member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlAttributeAnnotation = (NormalAnnotation) GenericJavaXmlAttributeMappingTests.this.getXmlAttributeAnnotation(declaration); - GenericJavaXmlAttributeMappingTests.this.values(xmlAttributeAnnotation).remove(0); - } - }); - assertNull(xmlAttributeMapping.getSpecifiedName()); - } - - public void testModifyNamespace() throws Exception { - createTypeWithXmlAttribute(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlAttributeMapping.getSpecifiedNamespace()); - - xmlAttributeMapping.setSpecifiedNamespace("foo"); - XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlAttributeAnnotation.getNamespace()); - assertEquals("foo", xmlAttributeMapping.getNamespace()); - - xmlAttributeMapping.setSpecifiedNamespace(null); - xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME); - assertNull(xmlAttributeAnnotation.getNamespace()); - assertNull(xmlAttributeMapping.getSpecifiedNamespace()); - } - - public void testUpdateNamespace() throws Exception { - createTypeWithXmlAttribute(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlAttributeMapping.getSpecifiedNamespace()); - - - //add a namespace member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.addXmlAttributeMemberValuePair(declaration, JAXB.XML_ATTRIBUTE__NAMESPACE, "foo"); - } - }); - assertEquals("foo", xmlAttributeMapping.getNamespace()); - - //remove the namespace member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlAttributeAnnotation = (NormalAnnotation) GenericJavaXmlAttributeMappingTests.this.getXmlAttributeAnnotation(declaration); - GenericJavaXmlAttributeMappingTests.this.values(xmlAttributeAnnotation).remove(0); - } - }); - assertNull(xmlAttributeMapping.getSpecifiedNamespace()); - } - - public void testModifyRequired() throws Exception { - createTypeWithXmlAttribute(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlAttributeMapping.getSpecifiedRequired()); - assertEquals(false, xmlAttributeMapping.isDefaultRequired()); - assertEquals(false, xmlAttributeMapping.isRequired()); - - xmlAttributeMapping.setSpecifiedRequired(Boolean.TRUE); - XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME); - assertEquals(Boolean.TRUE, xmlAttributeAnnotation.getRequired()); - assertEquals(Boolean.TRUE, xmlAttributeMapping.getSpecifiedRequired()); - assertEquals(false, xmlAttributeMapping.isDefaultRequired()); - assertEquals(true, xmlAttributeMapping.isRequired()); - - xmlAttributeMapping.setSpecifiedRequired(null); - xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME); - assertNull(xmlAttributeAnnotation.getName()); - assertNull(xmlAttributeMapping.getSpecifiedRequired()); - assertEquals(false, xmlAttributeMapping.isDefaultRequired()); - assertEquals(false, xmlAttributeMapping.isRequired()); - } - - public void testUpdateRequired() throws Exception { - createTypeWithXmlAttribute(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlAttributeMapping.getSpecifiedRequired()); - assertEquals(false, xmlAttributeMapping.isDefaultRequired()); - assertEquals(false, xmlAttributeMapping.isRequired()); - - - //add a required member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.addXmlAttributeMemberValuePair(declaration, JAXB.XML_ATTRIBUTE__REQUIRED, true); - } - }); - assertEquals(Boolean.TRUE, xmlAttributeMapping.getSpecifiedRequired()); - assertEquals(false, xmlAttributeMapping.isDefaultRequired()); - assertEquals(true, xmlAttributeMapping.isRequired()); - - //remove the required member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlAttributeAnnotation = (NormalAnnotation) GenericJavaXmlAttributeMappingTests.this.getXmlAttributeAnnotation(declaration); - GenericJavaXmlAttributeMappingTests.this.values(xmlAttributeAnnotation).remove(0); - } - }); - assertNull(xmlAttributeMapping.getSpecifiedRequired()); - assertEquals(false, xmlAttributeMapping.isDefaultRequired()); - assertEquals(false, xmlAttributeMapping.isRequired()); - } - - public void testChangeMappingType() throws Exception { - createTypeWithXmlAttribute(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getParent().getJavaResourceAttribute(); - - assertNotNull(xmlAttributeMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); - - persistentAttribute.setMappingKey(MappingKeys.XML_ELEMENT_ATTRIBUTE_MAPPING_KEY); - XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); - assertNotNull(xmlElementMapping); - assertNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); - assertNotNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); - - - persistentAttribute.setMappingKey(MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY); - xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); - assertNotNull(xmlAttributeMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); - assertNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); - } - - public void testModifyXmlJavaTypeAdapter() throws Exception { - createTypeWithXmlAttribute(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getParent().getJavaResourceAttribute(); - - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(xmlAttributeMapping.getXmlJavaTypeAdapter()); - assertNull(xmlJavaTypeAdapterAnnotation); - - xmlAttributeMapping.addXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNotNull(xmlAttributeMapping.getXmlJavaTypeAdapter()); - assertNotNull(xmlJavaTypeAdapterAnnotation); - - xmlAttributeMapping.removeXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - - public void testUpdateXmlJavaTypeAdapter() throws Exception { - createTypeWithXmlAttribute(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getParent().getJavaResourceAttribute(); - - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(xmlAttributeMapping.getXmlJavaTypeAdapter()); - assertNull(xmlJavaTypeAdapterAnnotation); - - - //add an XmlJavaTypeAdapter annotation - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNotNull(xmlAttributeMapping.getXmlJavaTypeAdapter()); - assertNotNull(xmlJavaTypeAdapterAnnotation); - - //remove the XmlJavaTypeAdapter annotation - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(xmlAttributeMapping.getXmlJavaTypeAdapter()); - assertNull(xmlJavaTypeAdapterAnnotation); - } - - public void testModifyXmlSchemaType() throws Exception { - createTypeWithXmlAttribute(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getParent().getJavaResourceAttribute(); - - XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - assertNull(xmlAttributeMapping.getXmlSchemaType()); - assertNull(xmlSchemaTypeAnnotation); - - xmlAttributeMapping.addXmlSchemaType(); - xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - assertNotNull(xmlAttributeMapping.getXmlSchemaType()); - assertNotNull(xmlSchemaTypeAnnotation); - - xmlAttributeMapping.removeXmlSchemaType(); - xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - } - - public void testUpdateXmlSchemaType() throws Exception { - createTypeWithXmlAttribute(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getParent().getJavaResourceAttribute(); - - XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - assertNull(xmlAttributeMapping.getXmlSchemaType()); - assertNull(xmlSchemaTypeAnnotation); - - - //add an XmlSchemaType annotation - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlSchemaTypeAnnotation.ANNOTATION_NAME); - } - }); - xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - assertNotNull(xmlAttributeMapping.getXmlSchemaType()); - assertNotNull(xmlSchemaTypeAnnotation); - - //remove the XmlSchemaType annotation - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - } - }); - xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - assertNull(xmlAttributeMapping.getXmlSchemaType()); - assertNull(xmlSchemaTypeAnnotation); - } - - protected void addXmlAttributeMemberValuePair(ModifiedDeclaration declaration, String name, String value) { - this.addMemberValuePair((MarkerAnnotation) this.getXmlAttributeAnnotation(declaration), name, value); - } - - protected void addXmlAttributeMemberValuePair(ModifiedDeclaration declaration, String name, boolean value) { - this.addMemberValuePair((MarkerAnnotation) this.getXmlAttributeAnnotation(declaration), name, value); - } - - protected void addXmlAttributeTypeMemberValuePair(ModifiedDeclaration declaration, String name, String typeName) { - this.addMemberValuePair( - (MarkerAnnotation) this.getXmlAttributeAnnotation(declaration), - name, - this.newTypeLiteral(declaration.getAst(), typeName)); - } - - protected Annotation getXmlAttributeAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlAttributeAnnotation.ANNOTATION_NAME); - } - - public void testModifyXmlList() throws Exception { - createTypeWithXmlAttribute(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getParent().getJavaResourceAttribute(); - - XmlListAnnotation xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); - assertNull(xmlAttributeMapping.getXmlList()); - assertNull(xmlListAnnotation); - - xmlAttributeMapping.addXmlList(); - xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); - assertNotNull(xmlAttributeMapping.getXmlList()); - assertNotNull(xmlListAnnotation); - - xmlAttributeMapping.removeXmlList(); - xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); - } - - public void testUpdateXmlList() throws Exception { - createTypeWithXmlAttribute(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlAttributeMapping.getParent().getJavaResourceAttribute(); - - XmlListAnnotation xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); - assertNull(xmlAttributeMapping.getXmlList()); - assertNull(xmlListAnnotation); - - - //add an XmlList annotation - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlListAnnotation.ANNOTATION_NAME); - } - }); - xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); - assertNotNull(xmlAttributeMapping.getXmlList()); - assertNotNull(xmlListAnnotation); - - //remove the XmlList annotation - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlAttributeMappingTests.this.removeAnnotation(declaration, XmlListAnnotation.ANNOTATION_NAME); - } - }); - xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); - assertNull(xmlAttributeMapping.getXmlList()); - assertNull(xmlListAnnotation); - } - -} \ No newline at end of file diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementMappingTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementMappingTests.java deleted file mode 100644 index 7ff8d7ea49..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlElementMappingTests.java +++ /dev/null @@ -1,654 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.MappingKeys; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.XmlAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.XmlElementMapping; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; -import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; - - -@SuppressWarnings("nls") -public class GenericJavaXmlElementMappingTests extends JaxbContextModelTestCase -{ - - public GenericJavaXmlElementMappingTests(String name) { - super(name); - } - - private ICompilationUnit createTypeWithXmlElement() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE, JAXB.XML_ELEMENT); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType"); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlElement"); - } - }); - } - - public void testModifyName() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlElementMapping.getSpecifiedName()); - assertEquals("id", xmlElementMapping.getDefaultName()); - assertEquals("id", xmlElementMapping.getName()); - - xmlElementMapping.setSpecifiedName("foo"); - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlElementAnnotation.getName()); - assertEquals("foo", xmlElementMapping.getSpecifiedName()); - assertEquals("id", xmlElementMapping.getDefaultName()); - assertEquals("foo", xmlElementMapping.getName()); - - xmlElementMapping.setSpecifiedName(null); - xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); - assertNull(xmlElementAnnotation.getName()); - assertNull(xmlElementMapping.getSpecifiedName()); - } - - public void testUpdateName() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlElementMapping.getSpecifiedName()); - - - //add a Name member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addXmlElementMemberValuePair(declaration, JAXB.XML_ELEMENT__NAME, "foo"); - } - }); - assertEquals("foo", xmlElementMapping.getName()); - - //remove the Name member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlElementAnnotation = (NormalAnnotation) GenericJavaXmlElementMappingTests.this.getXmlElementAnnotation(declaration); - GenericJavaXmlElementMappingTests.this.values(xmlElementAnnotation).remove(0); - } - }); - assertNull(xmlElementMapping.getSpecifiedName()); - } - - public void testModifyNamespace() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlElementMapping.getSpecifiedNamespace()); - - xmlElementMapping.setSpecifiedNamespace("foo"); - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlElementAnnotation.getNamespace()); - assertEquals("foo", xmlElementMapping.getNamespace()); - - xmlElementMapping.setSpecifiedNamespace(null); - xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); - assertNull(xmlElementAnnotation.getNamespace()); - assertNull(xmlElementMapping.getSpecifiedNamespace()); - } - - public void testUpdateNamespace() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlElementMapping.getSpecifiedNamespace()); - - - //add a namespace member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addXmlElementMemberValuePair(declaration, JAXB.XML_ELEMENT__NAMESPACE, "foo"); - } - }); - assertEquals("foo", xmlElementMapping.getNamespace()); - - //remove the namespace member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlElementAnnotation = (NormalAnnotation) GenericJavaXmlElementMappingTests.this.getXmlElementAnnotation(declaration); - GenericJavaXmlElementMappingTests.this.values(xmlElementAnnotation).remove(0); - } - }); - assertNull(xmlElementMapping.getSpecifiedNamespace()); - } - - public void testModifyRequired() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlElementMapping.getSpecifiedRequired()); - assertEquals(false, xmlElementMapping.isDefaultRequired()); - assertEquals(false, xmlElementMapping.isRequired()); - - xmlElementMapping.setSpecifiedRequired(Boolean.TRUE); - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); - assertEquals(Boolean.TRUE, xmlElementAnnotation.getRequired()); - assertEquals(Boolean.TRUE, xmlElementMapping.getSpecifiedRequired()); - assertEquals(false, xmlElementMapping.isDefaultRequired()); - assertEquals(true, xmlElementMapping.isRequired()); - - xmlElementMapping.setSpecifiedRequired(null); - xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); - assertNull(xmlElementAnnotation.getName()); - assertNull(xmlElementMapping.getSpecifiedRequired()); - assertEquals(false, xmlElementMapping.isDefaultRequired()); - assertEquals(false, xmlElementMapping.isRequired()); - } - - public void testUpdateRequired() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlElementMapping.getSpecifiedRequired()); - assertEquals(false, xmlElementMapping.isDefaultRequired()); - assertEquals(false, xmlElementMapping.isRequired()); - - - //add a required member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addXmlElementMemberValuePair(declaration, JAXB.XML_ELEMENT__REQUIRED, true); - } - }); - assertEquals(Boolean.TRUE, xmlElementMapping.getSpecifiedRequired()); - assertEquals(false, xmlElementMapping.isDefaultRequired()); - assertEquals(true, xmlElementMapping.isRequired()); - - //remove the required member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlElementAnnotation = (NormalAnnotation) GenericJavaXmlElementMappingTests.this.getXmlElementAnnotation(declaration); - GenericJavaXmlElementMappingTests.this.values(xmlElementAnnotation).remove(0); - } - }); - assertNull(xmlElementMapping.getSpecifiedRequired()); - assertEquals(false, xmlElementMapping.isDefaultRequired()); - assertEquals(false, xmlElementMapping.isRequired()); - } - - public void testModifyNillable() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlElementMapping.getSpecifiedNillable()); - assertEquals(false, xmlElementMapping.isDefaultNillable()); - assertEquals(false, xmlElementMapping.isNillable()); - - xmlElementMapping.setSpecifiedNillable(Boolean.TRUE); - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); - assertEquals(Boolean.TRUE, xmlElementAnnotation.getNillable()); - assertEquals(Boolean.TRUE, xmlElementMapping.getSpecifiedNillable()); - assertEquals(false, xmlElementMapping.isDefaultNillable()); - assertEquals(true, xmlElementMapping.isNillable()); - - xmlElementMapping.setSpecifiedNillable(null); - xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); - assertNull(xmlElementAnnotation.getName()); - assertNull(xmlElementMapping.getSpecifiedNillable()); - assertEquals(false, xmlElementMapping.isDefaultNillable()); - assertEquals(false, xmlElementMapping.isNillable()); - } - - public void testUpdateNillable() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlElementMapping.getSpecifiedNillable()); - assertEquals(false, xmlElementMapping.isDefaultNillable()); - assertEquals(false, xmlElementMapping.isNillable()); - - - //add a nillable member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addXmlElementMemberValuePair(declaration, JAXB.XML_ELEMENT__NILLABLE, true); - } - }); - assertEquals(Boolean.TRUE, xmlElementMapping.getSpecifiedNillable()); - assertEquals(false, xmlElementMapping.isDefaultNillable()); - assertEquals(true, xmlElementMapping.isNillable()); - - //remove the nillable member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlElementAnnotation = (NormalAnnotation) GenericJavaXmlElementMappingTests.this.getXmlElementAnnotation(declaration); - GenericJavaXmlElementMappingTests.this.values(xmlElementAnnotation).remove(0); - } - }); - assertNull(xmlElementMapping.getSpecifiedNillable()); - assertEquals(false, xmlElementMapping.isDefaultNillable()); - assertEquals(false, xmlElementMapping.isNillable()); - } - - public void testModifyDefaultValue() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlElementMapping.getDefaultValue()); - - xmlElementMapping.setDefaultValue("foo"); - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); - assertEquals("foo", xmlElementAnnotation.getDefaultValue()); - assertEquals("foo", xmlElementMapping.getDefaultValue()); - - xmlElementMapping.setDefaultValue(null); - xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); - assertNull(xmlElementAnnotation.getDefaultValue()); - assertNull(xmlElementMapping.getDefaultValue()); - } - - public void testUpdateDefaultValue() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlElementMapping.getDefaultValue()); - - - //add a DefaultValue member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addXmlElementMemberValuePair(declaration, JAXB.XML_ELEMENT__DEFAULT_VALUE, "foo"); - } - }); - assertEquals("foo", xmlElementMapping.getDefaultValue()); - - //remove the DefaultValue member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlElementAnnotation = (NormalAnnotation) GenericJavaXmlElementMappingTests.this.getXmlElementAnnotation(declaration); - GenericJavaXmlElementMappingTests.this.values(xmlElementAnnotation).remove(0); - } - }); - assertNull(xmlElementMapping.getDefaultValue()); - } - - public void testModifyType() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlElementMapping.getSpecifiedType()); - - xmlElementMapping.setSpecifiedType("Foo"); - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); - assertEquals("Foo", xmlElementMapping.getSpecifiedType()); - assertEquals("Foo", xmlElementMapping.getType()); - - xmlElementMapping.setSpecifiedType(null); - xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME); - assertNull(xmlElementAnnotation.getType()); - assertNull(xmlElementMapping.getSpecifiedType()); - } - - public void testUpdateType() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) CollectionTools.get(persistentClass.getAttributes(), 0).getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - assertNull(xmlElementMapping.getSpecifiedType()); - - - //add a Type member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addXmlElementTypeMemberValuePair(declaration, JAXB.XML_ELEMENT__TYPE, "Foo"); - } - }); - assertEquals("Foo", xmlElementMapping.getType()); - - //remove the Type member value pair - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - NormalAnnotation xmlElementAnnotation = (NormalAnnotation) GenericJavaXmlElementMappingTests.this.getXmlElementAnnotation(declaration); - GenericJavaXmlElementMappingTests.this.values(xmlElementAnnotation).remove(0); - } - }); - assertNull(xmlElementMapping.getSpecifiedType()); - } - - public void testChangeMappingType() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - assertNotNull(xmlElementMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); - - persistentAttribute.setMappingKey(MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY); - XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); - assertNotNull(xmlAttributeMapping); - assertNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); - assertNotNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); - - - persistentAttribute.setMappingKey(MappingKeys.XML_ELEMENT_ATTRIBUTE_MAPPING_KEY); - xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); - assertNotNull(xmlElementMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); - assertNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); - } - - public void testModifyXmlJavaTypeAdapter() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(xmlElementMapping.getXmlJavaTypeAdapter()); - assertNull(xmlJavaTypeAdapterAnnotation); - - xmlElementMapping.addXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNotNull(xmlElementMapping.getXmlJavaTypeAdapter()); - assertNotNull(xmlJavaTypeAdapterAnnotation); - - xmlElementMapping.removeXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - - public void testUpdateXmlJavaTypeAdapter() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(xmlElementMapping.getXmlJavaTypeAdapter()); - assertNull(xmlJavaTypeAdapterAnnotation); - - - //add an XmlJavaTypeAdapter annotation - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNotNull(xmlElementMapping.getXmlJavaTypeAdapter()); - assertNotNull(xmlJavaTypeAdapterAnnotation); - - //remove the XmlJavaTypeAdapter annotation - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(xmlElementMapping.getXmlJavaTypeAdapter()); - assertNull(xmlJavaTypeAdapterAnnotation); - } - - public void testModifyXmlSchemaType() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - assertNull(xmlElementMapping.getXmlSchemaType()); - assertNull(xmlSchemaTypeAnnotation); - - xmlElementMapping.addXmlSchemaType(); - xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - assertNotNull(xmlElementMapping.getXmlSchemaType()); - assertNotNull(xmlSchemaTypeAnnotation); - - xmlElementMapping.removeXmlSchemaType(); - xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - } - - public void testUpdateXmlSchemaType() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - XmlSchemaTypeAnnotation xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - assertNull(xmlElementMapping.getXmlSchemaType()); - assertNull(xmlSchemaTypeAnnotation); - - - //add an XmlSchemaType annotation - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlSchemaTypeAnnotation.ANNOTATION_NAME); - } - }); - xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - assertNotNull(xmlElementMapping.getXmlSchemaType()); - assertNotNull(xmlSchemaTypeAnnotation); - - //remove the XmlSchemaType annotation - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - } - }); - xmlSchemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - assertNull(xmlElementMapping.getXmlSchemaType()); - assertNull(xmlSchemaTypeAnnotation); - } - - protected void addXmlElementMemberValuePair(ModifiedDeclaration declaration, String name, String value) { - this.addMemberValuePair((MarkerAnnotation) this.getXmlElementAnnotation(declaration), name, value); - } - - protected void addXmlElementMemberValuePair(ModifiedDeclaration declaration, String name, boolean value) { - this.addMemberValuePair((MarkerAnnotation) this.getXmlElementAnnotation(declaration), name, value); - } - - protected void addXmlElementTypeMemberValuePair(ModifiedDeclaration declaration, String name, String typeName) { - this.addMemberValuePair( - (MarkerAnnotation) this.getXmlElementAnnotation(declaration), - name, - this.newTypeLiteral(declaration.getAst(), typeName)); - } - - protected Annotation getXmlElementAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlElementAnnotation.ANNOTATION_NAME); - } - - - public void testModifyXmlElementWrapper() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME); - assertNull(xmlElementMapping.getXmlElementWrapper()); - assertNull(xmlElementWrapperAnnotation); - - xmlElementMapping.addXmlElementWrapper(); - xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME); - assertNotNull(xmlElementMapping.getXmlElementWrapper()); - assertNotNull(xmlElementWrapperAnnotation); - - xmlElementMapping.removeXmlElementWrapper(); - xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME); - } - - public void testUpdateXmlElementWrapper() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME); - assertNull(xmlElementMapping.getXmlElementWrapper()); - assertNull(xmlElementWrapperAnnotation); - - - //add an XmlElementWrapper annotation - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlElementWrapperAnnotation.ANNOTATION_NAME); - } - }); - xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME); - assertNotNull(xmlElementMapping.getXmlElementWrapper()); - assertNotNull(xmlElementWrapperAnnotation); - - //remove the XmlElementWrapper annotation - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, XmlElementWrapperAnnotation.ANNOTATION_NAME); - } - }); - xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(XmlElementWrapperAnnotation.ANNOTATION_NAME); - assertNull(xmlElementMapping.getXmlElementWrapper()); - assertNull(xmlElementWrapperAnnotation); - } - - public void testModifyXmlList() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - XmlListAnnotation xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); - assertNull(xmlElementMapping.getXmlList()); - assertNull(xmlListAnnotation); - - xmlElementMapping.addXmlList(); - xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); - assertNotNull(xmlElementMapping.getXmlList()); - assertNotNull(xmlListAnnotation); - - xmlElementMapping.removeXmlList(); - xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); - } - - public void testUpdateXmlList() throws Exception { - createTypeWithXmlElement(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlElementMapping.getParent().getJavaResourceAttribute(); - - XmlListAnnotation xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); - assertNull(xmlElementMapping.getXmlList()); - assertNull(xmlListAnnotation); - - - //add an XmlList annotation - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlListAnnotation.ANNOTATION_NAME); - } - }); - xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); - assertNotNull(xmlElementMapping.getXmlList()); - assertNotNull(xmlListAnnotation); - - //remove the XmlList annotation - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlElementMappingTests.this.removeAnnotation(declaration, XmlListAnnotation.ANNOTATION_NAME); - } - }); - xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(XmlListAnnotation.ANNOTATION_NAME); - assertNull(xmlElementMapping.getXmlList()); - assertNull(xmlListAnnotation); - } - -} \ No newline at end of file diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlRootElementTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlRootElementTests.java deleted file mode 100644 index 5f3e31f88d..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlRootElementTests.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context.java; - -import java.beans.Introspector; -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.XmlRootElement; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; -import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; - - -@SuppressWarnings("nls") -public class GenericJavaXmlRootElementTests extends JaxbContextModelTestCase -{ - - public GenericJavaXmlRootElementTests(String name) { - super(name); - } - - private ICompilationUnit createTypeWithXmlTypeWithXmlRootElement() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE, JAXB.XML_ROOT_ELEMENT); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType").append(CR); - sb.append("@XmlRootElement").append(CR); - } - }); - } - - - public void testModifyNamespace() throws Exception { - createTypeWithXmlTypeWithXmlRootElement(); - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlRootElement contextRootElement = persistentClass.getRootElement(); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - assertNull(contextRootElement.getSpecifiedNamespace()); - assertEquals("", contextRootElement.getDefaultNamespace()); - assertEquals("", contextRootElement.getNamespace()); - - contextRootElement.setSpecifiedNamespace("foo"); - XmlRootElementAnnotation rootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); - assertEquals("foo", rootElementAnnotation.getNamespace()); - assertEquals("foo", contextRootElement.getSpecifiedNamespace()); - assertEquals("foo", contextRootElement.getNamespace()); - - contextRootElement.setSpecifiedNamespace(null); - rootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); - assertNull(rootElementAnnotation.getNamespace()); - assertNull(contextRootElement.getSpecifiedNamespace()); - assertEquals("", contextRootElement.getNamespace()); - } - - public void testUpdateNamespace() throws Exception { - createTypeWithXmlTypeWithXmlRootElement(); - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlRootElement contextRootElement = persistentClass.getRootElement(); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - - assertNull(contextRootElement.getSpecifiedNamespace()); - assertEquals("", contextRootElement.getDefaultNamespace()); - assertEquals("", contextRootElement.getNamespace()); - - //add a namespace member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceType); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlRootElementTests.this.addXmlRootElementMemberValuePair(declaration, JAXB.XML_ROOT_ELEMENT__NAMESPACE, "foo"); - } - }); - assertEquals("foo", contextRootElement.getSpecifiedNamespace()); - assertEquals("foo", contextRootElement.getNamespace()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlRootElementTests.this.removeAnnotation(declaration, XmlRootElementAnnotation.ANNOTATION_NAME); - } - }); - contextRootElement = persistentClass.getRootElement(); - assertNull(contextRootElement); - } - - public void testModifyName() throws Exception { - createTypeWithXmlTypeWithXmlRootElement(); - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlRootElement contextRootElement = persistentClass.getRootElement(); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - String defaultName = Introspector.decapitalize(TYPE_NAME); - - assertNull(contextRootElement.getSpecifiedName()); - assertEquals(defaultName, contextRootElement.getDefaultName()); - assertEquals(defaultName, contextRootElement.getName()); - - contextRootElement.setSpecifiedName("foo"); - XmlRootElementAnnotation rootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); - assertEquals("foo", rootElementAnnotation.getName()); - assertEquals("foo", contextRootElement.getSpecifiedName()); - assertEquals("foo", contextRootElement.getName()); - - contextRootElement.setSpecifiedName(null); - rootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(XmlRootElementAnnotation.ANNOTATION_NAME); - assertNull(rootElementAnnotation.getName()); - assertNull(contextRootElement.getSpecifiedName()); - assertEquals(defaultName, contextRootElement.getName()); - } - - public void testUpdateName() throws Exception { - createTypeWithXmlTypeWithXmlRootElement(); - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - XmlRootElement contextRootElement = persistentClass.getRootElement(); - AbstractJavaResourceType resourceType = persistentClass.getJavaResourceType(); - String defaultName = Introspector.decapitalize(TYPE_NAME); - - assertNull(contextRootElement.getSpecifiedName()); - assertEquals(defaultName, contextRootElement.getDefaultName()); - assertEquals(defaultName, contextRootElement.getName()); - - //add a namespace member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourceType); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlRootElementTests.this.addXmlRootElementMemberValuePair(declaration, JAXB.XML_ROOT_ELEMENT__NAME, "foo"); - } - }); - assertEquals("foo", contextRootElement.getSpecifiedName()); - assertEquals("foo", contextRootElement.getName()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlRootElementTests.this.removeAnnotation(declaration, XmlRootElementAnnotation.ANNOTATION_NAME); - } - }); - contextRootElement = persistentClass.getRootElement(); - assertNull(contextRootElement); - } - - protected void addXmlRootElementMemberValuePair(ModifiedDeclaration declaration, String name, String value) { - this.addMemberValuePair((MarkerAnnotation) this.getXmlRootElementAnnotation(declaration), name, value); - } - - protected Annotation getXmlRootElementAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlRootElementAnnotation.ANNOTATION_NAME); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlSchemaTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlSchemaTests.java deleted file mode 100644 index 2ab04d6a06..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlSchemaTests.java +++ /dev/null @@ -1,662 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context.java; - -import java.util.ListIterator; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.AST; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jdt.core.dom.NormalAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; -import org.eclipse.jpt.jaxb.core.context.XmlAccessType; -import org.eclipse.jpt.jaxb.core.context.XmlNs; -import org.eclipse.jpt.jaxb.core.context.XmlNsForm; -import org.eclipse.jpt.jaxb.core.context.XmlSchema; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaAnnotation; -import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; - - -@SuppressWarnings("nls") -public class GenericJavaXmlSchemaTests extends JaxbContextModelTestCase -{ - - public GenericJavaXmlSchemaTests(String name) { - super(name); - } - - private ICompilationUnit createPackageInfoWithXmlSchema() throws CoreException { - return createTestPackageInfo( - "@XmlSchema", - JAXB.XML_SCHEMA); - } - - private ICompilationUnit createPackageInfoWithAccessorType() throws CoreException { - return createTestPackageInfo( - "@XmlAccessorType(value = XmlAccessType.PROPERTY)", - JAXB.XML_ACCESS_TYPE, JAXB.XML_ACCESSOR_TYPE); - } - - public void testModifyNamespace() throws Exception { - createPackageInfoWithXmlSchema(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchema contextXmlSchema = contextPackageInfo.getXmlSchema(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertEquals("", contextXmlSchema.getNamespace()); - assertNull(contextXmlSchema.getSpecifiedNamespace()); - - contextXmlSchema.setSpecifiedNamespace("foo"); - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - assertEquals("foo", schemaAnnotation.getNamespace()); - assertEquals("foo", contextXmlSchema.getNamespace()); - assertEquals("foo", contextXmlSchema.getSpecifiedNamespace()); - - //set another annotation so the context model is not blown away by removing the XmlSchema annotation - contextPackageInfo.setSpecifiedAccessType(XmlAccessType.FIELD); - contextXmlSchema.setSpecifiedNamespace(null); - schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - assertNull(schemaAnnotation.getNamespace()); - assertEquals("", contextXmlSchema.getNamespace()); - assertNull(contextXmlSchema.getSpecifiedNamespace()); - - //set namespace again, this time starting with no XmlSchema annotation - contextXmlSchema.setSpecifiedNamespace("foo"); - schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - assertEquals("foo", schemaAnnotation.getNamespace()); - assertEquals("foo", contextXmlSchema.getSpecifiedNamespace()); - assertEquals("foo", contextXmlSchema.getNamespace()); - } - - public void testUpdateNamespace() throws Exception { - this.createPackageInfoWithXmlSchema(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchema contextXmlSchema = contextPackageInfo.getXmlSchema(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertEquals("", contextXmlSchema.getNamespace()); - assertNull(contextXmlSchema.getSpecifiedNamespace()); - - //add a namespace member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.addXmlSchemaMemberValuePair(declaration, JAXB.XML_SCHEMA__NAMESPACE, "foo"); - } - }); - assertEquals("foo", contextXmlSchema.getNamespace()); - assertEquals("foo", contextXmlSchema.getSpecifiedNamespace()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.removeXmlSchemaAnnotation(declaration); - } - }); - contextXmlSchema = contextPackageInfo.getXmlSchema(); - assertEquals("", contextXmlSchema.getNamespace()); - assertNull(contextXmlSchema.getSpecifiedNamespace()); - } - - public void testModifyLocation() throws Exception { - createPackageInfoWithXmlSchema(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchema contextXmlSchema = contextPackageInfo.getXmlSchema(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertNull(contextXmlSchema.getLocation()); - - contextXmlSchema.setLocation("foo"); - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - assertEquals("foo", schemaAnnotation.getLocation()); - assertEquals("foo", contextXmlSchema.getLocation()); - - //set another annotation so the context model is not blown away by removing the XmlSchema annotation - contextPackageInfo.setSpecifiedAccessType(XmlAccessType.FIELD); - contextXmlSchema.setLocation(null); - schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - assertNull(schemaAnnotation.getLocation()); - assertNull(contextXmlSchema.getLocation()); - - //set location again, this time starting with no XmlSchema annotation - contextXmlSchema.setLocation("foo"); - schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - assertEquals("foo", schemaAnnotation.getLocation()); - assertEquals("foo", contextXmlSchema.getLocation()); - } - - public void testUpdateLocation() throws Exception { - this.createPackageInfoWithXmlSchema(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchema contextXmlSchema = contextPackageInfo.getXmlSchema(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertNull(contextXmlSchema.getLocation()); - - //add a location member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.addXmlSchemaMemberValuePair(declaration, JAXB.XML_SCHEMA__LOCATION, "foo"); - } - }); - - assertEquals("foo", contextXmlSchema.getLocation()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.removeXmlSchemaAnnotation(declaration); - } - }); - contextXmlSchema = contextPackageInfo.getXmlSchema(); - assertNull(contextXmlSchema.getLocation()); - } - - public void testModifyAttributeFormDefault() throws Exception { - createPackageInfoWithXmlSchema(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchema contextXmlSchema = contextPackageInfo.getXmlSchema(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertNull(contextXmlSchema.getAttributeFormDefault()); - - contextXmlSchema.setAttributeFormDefault(XmlNsForm.QUALIFIED); - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm.QUALIFIED, schemaAnnotation.getAttributeFormDefault()); - assertEquals(XmlNsForm.QUALIFIED, contextXmlSchema.getAttributeFormDefault()); - - contextXmlSchema.setAttributeFormDefault(XmlNsForm.UNQUALIFIED); - assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm.UNQUALIFIED, schemaAnnotation.getAttributeFormDefault()); - assertEquals(XmlNsForm.UNQUALIFIED, contextXmlSchema.getAttributeFormDefault()); - - //set another annotation so the context model is not blown away by removing the XmlSchema annotation - contextPackageInfo.setSpecifiedAccessType(XmlAccessType.FIELD); - contextXmlSchema.setAttributeFormDefault(null); - schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - assertNull(schemaAnnotation.getAttributeFormDefault()); - assertNull(contextXmlSchema.getAttributeFormDefault()); - - //set attribute form default again, this time starting with no XmlSchema annotation - contextXmlSchema.setAttributeFormDefault(XmlNsForm.QUALIFIED); - schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm.QUALIFIED, schemaAnnotation.getAttributeFormDefault()); - assertEquals(XmlNsForm.QUALIFIED, contextXmlSchema.getAttributeFormDefault()); - } - - public void testUpdateAttributeFormDefault() throws Exception { - this.createPackageInfoWithXmlSchema(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchema contextXmlSchema = contextPackageInfo.getXmlSchema(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertNull(contextXmlSchema.getAttributeFormDefault()); - - //set the attribute form default value to QUALIFIED - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.addXmlSchemaEnumMemberValuePair( - declaration, - JAXB.XML_SCHEMA__ATTRIBUTE_FORM_DEFAULT, - JAXB.XML_NS_FORM__QUALIFIED); - } - }); - - assertEquals(XmlNsForm.QUALIFIED, contextXmlSchema.getAttributeFormDefault()); - - - //set the attribute form default value to UNQUALIFIED - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.setXmlSchemaEnumMemberValuePair( - declaration, - JAXB.XML_SCHEMA__ATTRIBUTE_FORM_DEFAULT, - JAXB.XML_NS_FORM__UNQUALIFIED); - } - }); - - assertEquals(XmlNsForm.UNQUALIFIED, contextXmlSchema.getAttributeFormDefault()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.removeXmlSchemaAnnotation(declaration); - } - }); - - contextXmlSchema = contextPackageInfo.getXmlSchema(); - assertNull(contextXmlSchema.getAttributeFormDefault()); - } - - public void testModifyElementFormDefault() throws Exception { - createPackageInfoWithXmlSchema(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchema contextXmlSchema = contextPackageInfo.getXmlSchema(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertNull(contextXmlSchema.getElementFormDefault()); - - contextXmlSchema.setElementFormDefault(XmlNsForm.QUALIFIED); - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm.QUALIFIED, schemaAnnotation.getElementFormDefault()); - assertEquals(XmlNsForm.QUALIFIED, contextXmlSchema.getElementFormDefault()); - - contextXmlSchema.setElementFormDefault(XmlNsForm.UNQUALIFIED); - assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm.UNQUALIFIED, schemaAnnotation.getElementFormDefault()); - assertEquals(XmlNsForm.UNQUALIFIED, contextXmlSchema.getElementFormDefault()); - - //set another annotation so the context model is not blown away by removing the XmlSchema annotation - contextPackageInfo.setSpecifiedAccessType(XmlAccessType.FIELD); - contextXmlSchema.setElementFormDefault(null); - schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - assertNull(schemaAnnotation.getElementFormDefault()); - assertNull(contextXmlSchema.getElementFormDefault()); - - //set element form default again, this time starting with no XmlSchema annotation - contextXmlSchema.setElementFormDefault(XmlNsForm.QUALIFIED); - schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - assertEquals(org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm.QUALIFIED, schemaAnnotation.getElementFormDefault()); - assertEquals(XmlNsForm.QUALIFIED, contextXmlSchema.getElementFormDefault()); - } - - public void testUpdateElementFormDefault() throws Exception { - this.createPackageInfoWithXmlSchema(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchema contextXmlSchema = contextPackageInfo.getXmlSchema(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertNull(contextXmlSchema.getElementFormDefault()); - - //set the element form default value to QUALIFIED - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.addXmlSchemaEnumMemberValuePair( - declaration, - JAXB.XML_SCHEMA__ELEMENT_FORM_DEFAULT, - JAXB.XML_NS_FORM__QUALIFIED); - } - }); - - assertEquals(XmlNsForm.QUALIFIED, contextXmlSchema.getElementFormDefault()); - - - //set the element form default value to UNQUALIFIED - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.setXmlSchemaEnumMemberValuePair( - declaration, - JAXB.XML_SCHEMA__ELEMENT_FORM_DEFAULT, - JAXB.XML_NS_FORM__UNQUALIFIED); - } - }); - - assertEquals(XmlNsForm.UNQUALIFIED, contextXmlSchema.getElementFormDefault()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.removeXmlSchemaAnnotation(declaration); - } - }); - - contextXmlSchema = contextPackageInfo.getXmlSchema(); - assertNull(contextXmlSchema.getElementFormDefault()); - } - - public void testGetXmlNsPrefixes() throws Exception { - this.createPackageInfoWithXmlSchema(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchema contextXmlSchema = contextPackageInfo.getXmlSchema(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - ListIterable xmlNsPrefixes = contextXmlSchema.getXmlNsPrefixes(); - assertFalse(xmlNsPrefixes.iterator().hasNext()); - - //add 2 XmlNs prefixes - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.addXmlNs(declaration, 0, "bar", "barPrefix"); - GenericJavaXmlSchemaTests.this.addXmlNs(declaration, 1, "foo", "fooPrefix"); - } - }); - - xmlNsPrefixes = contextXmlSchema.getXmlNsPrefixes(); - ListIterator xmlNsPrefixesIterator = xmlNsPrefixes.iterator(); - assertTrue(xmlNsPrefixesIterator.hasNext()); - XmlNs xmlNsPref = xmlNsPrefixesIterator.next(); - assertEquals("bar", xmlNsPref.getNamespaceURI()); - assertEquals("barPrefix", xmlNsPref.getPrefix()); - xmlNsPref = xmlNsPrefixesIterator.next(); - assertEquals("foo", xmlNsPref.getNamespaceURI()); - assertEquals("fooPrefix", xmlNsPref.getPrefix()); - assertFalse(xmlNsPrefixesIterator.hasNext()); - } - - protected void addXmlNs(ModifiedDeclaration declaration, int index, String namespaceURI, String prefix) { - NormalAnnotation arrayElement = this.newXmlNsAnnotation(declaration.getAst(), namespaceURI, prefix); - this.addArrayElement(declaration, JAXB.XML_SCHEMA, index, JAXB.XML_SCHEMA__XMLNS, arrayElement); - } - - protected NormalAnnotation newXmlNsAnnotation(AST ast, String namespaceURI, String prefix) { - NormalAnnotation annotation = this.newNormalAnnotation(ast, JAXB.XML_NS); - this.addMemberValuePair(annotation, JAXB.XML_NS__NAMESPACE_URI, namespaceURI); - this.addMemberValuePair(annotation, JAXB.XML_NS__PREFIX, prefix); - return annotation; - } - - public void testGetXmlNsPrexiesSize() throws Exception { - this.createPackageInfoWithXmlSchema(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchema contextXmlSchema = contextPackageInfo.getXmlSchema(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertEquals(0, contextXmlSchema.getXmlNsPrefixesSize()); - - //add 2 XmlNs prefixes - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.addXmlNs(declaration, 0, "bar", "barPrefix"); - GenericJavaXmlSchemaTests.this.addXmlNs(declaration, 1, "foo", "fooPrefix"); - } - }); - assertEquals(2, contextXmlSchema.getXmlNsPrefixesSize()); - } - - public void testAddXmlNsPrefix() throws Exception { - //create a package info with an annotation other than XmlSchema to test - //adding things to the null schema annotation - this.createPackageInfoWithAccessorType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchema contextXmlSchema = contextPackageInfo.getXmlSchema(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - XmlNs xmlNsPrefix = contextXmlSchema.addXmlNsPrefix(0); - xmlNsPrefix.setNamespaceURI("bar"); - xmlNsPrefix.setPrefix("barPrefix"); - xmlNsPrefix = contextXmlSchema.addXmlNsPrefix(0); - xmlNsPrefix.setNamespaceURI("foo"); - xmlNsPrefix.setPrefix("fooPrefix"); - xmlNsPrefix = contextXmlSchema.addXmlNsPrefix(0); - xmlNsPrefix.setNamespaceURI("baz"); - xmlNsPrefix.setPrefix("bazPrefix"); - - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - ListIterator xmlNsPrefixes = schemaAnnotation.getXmlns().iterator(); - - XmlNsAnnotation xmlNsAnnotation = xmlNsPrefixes.next(); - assertEquals("baz", xmlNsAnnotation.getNamespaceURI()); - assertEquals("bazPrefix", xmlNsAnnotation.getPrefix()); - xmlNsAnnotation = xmlNsPrefixes.next(); - assertEquals("foo", xmlNsAnnotation.getNamespaceURI()); - assertEquals("fooPrefix", xmlNsAnnotation.getPrefix()); - xmlNsAnnotation = xmlNsPrefixes.next(); - assertEquals("bar", xmlNsAnnotation.getNamespaceURI()); - assertEquals("barPrefix", xmlNsAnnotation.getPrefix()); - assertFalse(xmlNsPrefixes.hasNext()); - } - - public void testAddXmlNsPrefix2() throws Exception { - this.createPackageInfoWithXmlSchema(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchema contextXmlSchema = contextPackageInfo.getXmlSchema(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - XmlNs xmlNsPrefix = contextXmlSchema.addXmlNsPrefix(0); - xmlNsPrefix.setNamespaceURI("bar"); - xmlNsPrefix.setPrefix("barPrefix"); - xmlNsPrefix = contextXmlSchema.addXmlNsPrefix(1); - xmlNsPrefix.setNamespaceURI("foo"); - xmlNsPrefix.setPrefix("fooPrefix"); - xmlNsPrefix = contextXmlSchema.addXmlNsPrefix(0); - xmlNsPrefix.setNamespaceURI("baz"); - xmlNsPrefix.setPrefix("bazPrefix"); - - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - ListIterator xmlNsPrefixes = schemaAnnotation.getXmlns().iterator(); - - XmlNsAnnotation xmlNsAnnotation = xmlNsPrefixes.next(); - assertEquals("baz", xmlNsAnnotation.getNamespaceURI()); - assertEquals("bazPrefix", xmlNsAnnotation.getPrefix()); - xmlNsAnnotation = xmlNsPrefixes.next(); - assertEquals("bar", xmlNsAnnotation.getNamespaceURI()); - assertEquals("barPrefix", xmlNsAnnotation.getPrefix()); - xmlNsAnnotation = xmlNsPrefixes.next(); - assertEquals("foo", xmlNsAnnotation.getNamespaceURI()); - assertEquals("fooPrefix", xmlNsAnnotation.getPrefix()); - assertFalse(xmlNsPrefixes.hasNext()); - } - - public void testRemoveXmlNsPrefix() throws Exception { - this.createPackageInfoWithXmlSchema(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchema contextXmlSchema = contextPackageInfo.getXmlSchema(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - contextXmlSchema.addXmlNsPrefix(0).setNamespaceURI("bar"); - contextXmlSchema.addXmlNsPrefix(1).setNamespaceURI("foo"); - contextXmlSchema.addXmlNsPrefix(2).setNamespaceURI("baz"); - - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - assertEquals(3, schemaAnnotation.getXmlnsSize()); - - contextXmlSchema.removeXmlNsPrefix(1); - - ListIterator xmlNsPrefixes = schemaAnnotation.getXmlns().iterator(); - assertEquals("bar", xmlNsPrefixes.next().getNamespaceURI()); - assertEquals("baz", xmlNsPrefixes.next().getNamespaceURI()); - assertFalse(xmlNsPrefixes.hasNext()); - - contextXmlSchema.removeXmlNsPrefix(1); - xmlNsPrefixes = schemaAnnotation.getXmlns().iterator(); - assertEquals("bar", xmlNsPrefixes.next().getNamespaceURI()); - assertFalse(xmlNsPrefixes.hasNext()); - - contextXmlSchema.removeXmlNsPrefix(0); - xmlNsPrefixes = schemaAnnotation.getXmlns().iterator(); - assertFalse(xmlNsPrefixes.hasNext()); - } - - public void testMoveXmlNsPrefix() throws Exception { - this.createPackageInfoWithXmlSchema(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchema contextXmlSchema = contextPackageInfo.getXmlSchema(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - contextXmlSchema.addXmlNsPrefix(0).setNamespaceURI("bar"); - contextXmlSchema.addXmlNsPrefix(1).setNamespaceURI("foo"); - contextXmlSchema.addXmlNsPrefix(2).setNamespaceURI("baz"); - - - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) resourcePackage.getAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - - assertEquals(3, schemaAnnotation.getXmlnsSize()); - - contextXmlSchema.moveXmlNsPrefix(2, 0); - ListIterator xmlNsPrefixes = contextXmlSchema.getXmlNsPrefixes().iterator(); - assertEquals("foo", xmlNsPrefixes.next().getNamespaceURI()); - assertEquals("baz", xmlNsPrefixes.next().getNamespaceURI()); - assertEquals("bar", xmlNsPrefixes.next().getNamespaceURI()); - assertFalse(xmlNsPrefixes.hasNext()); - - ListIterator xmlNsAnnotations = schemaAnnotation.getXmlns().iterator(); - assertEquals("foo", xmlNsAnnotations.next().getNamespaceURI()); - assertEquals("baz", xmlNsAnnotations.next().getNamespaceURI()); - assertEquals("bar", xmlNsAnnotations.next().getNamespaceURI()); - - - contextXmlSchema.moveXmlNsPrefix(0, 1); - xmlNsPrefixes = contextXmlSchema.getXmlNsPrefixes().iterator(); - assertEquals("baz", xmlNsPrefixes.next().getNamespaceURI()); - assertEquals("foo", xmlNsPrefixes.next().getNamespaceURI()); - assertEquals("bar", xmlNsPrefixes.next().getNamespaceURI()); - assertFalse(xmlNsPrefixes.hasNext()); - - xmlNsAnnotations = schemaAnnotation.getXmlns().iterator(); - assertEquals("baz", xmlNsAnnotations.next().getNamespaceURI()); - assertEquals("foo", xmlNsAnnotations.next().getNamespaceURI()); - assertEquals("bar", xmlNsAnnotations.next().getNamespaceURI()); - } - - public void testSyncXmlNsPrefixes() throws Exception { - this.createPackageInfoWithXmlSchema(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchema contextXmlSchema = contextPackageInfo.getXmlSchema(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - ListIterable xmlNsPrefixes = contextXmlSchema.getXmlNsPrefixes(); - assertFalse(xmlNsPrefixes.iterator().hasNext()); - - //add 3 XmlNs prefixes - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.addXmlNs(declaration, 0, "bar", "barPrefix"); - GenericJavaXmlSchemaTests.this.addXmlNs(declaration, 1, "foo", "fooPrefix"); - GenericJavaXmlSchemaTests.this.addXmlNs(declaration, 2, "baz", "bazPrefix"); - } - }); - - xmlNsPrefixes = contextXmlSchema.getXmlNsPrefixes(); - ListIterator xmlNsPrefixesIterator = xmlNsPrefixes.iterator(); - assertTrue(xmlNsPrefixesIterator.hasNext()); - XmlNs xmlNsPref = xmlNsPrefixesIterator.next(); - assertEquals("bar", xmlNsPref.getNamespaceURI()); - assertEquals("barPrefix", xmlNsPref.getPrefix()); - xmlNsPref = xmlNsPrefixesIterator.next(); - assertEquals("foo", xmlNsPref.getNamespaceURI()); - assertEquals("fooPrefix", xmlNsPref.getPrefix()); - xmlNsPref = xmlNsPrefixesIterator.next(); - assertEquals("baz", xmlNsPref.getNamespaceURI()); - assertEquals("bazPrefix", xmlNsPref.getPrefix()); - assertFalse(xmlNsPrefixesIterator.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.moveXmlNsPrefix(declaration, 2, 0); - } - }); - - xmlNsPrefixesIterator = xmlNsPrefixes.iterator(); - assertTrue(xmlNsPrefixesIterator.hasNext()); - xmlNsPref = xmlNsPrefixesIterator.next(); - assertEquals("foo", xmlNsPref.getNamespaceURI()); - assertEquals("fooPrefix", xmlNsPref.getPrefix()); - xmlNsPref = xmlNsPrefixesIterator.next(); - assertEquals("baz", xmlNsPref.getNamespaceURI()); - assertEquals("bazPrefix", xmlNsPref.getPrefix()); - xmlNsPref = xmlNsPrefixesIterator.next(); - assertEquals("bar", xmlNsPref.getNamespaceURI()); - assertEquals("barPrefix", xmlNsPref.getPrefix()); - assertFalse(xmlNsPrefixesIterator.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.moveXmlNsPrefix(declaration, 0, 1); - } - }); - - xmlNsPrefixesIterator = xmlNsPrefixes.iterator(); - assertTrue(xmlNsPrefixesIterator.hasNext()); - xmlNsPref = xmlNsPrefixesIterator.next(); - assertEquals("baz", xmlNsPref.getNamespaceURI()); - assertEquals("bazPrefix", xmlNsPref.getPrefix()); - xmlNsPref = xmlNsPrefixesIterator.next(); - assertEquals("foo", xmlNsPref.getNamespaceURI()); - assertEquals("fooPrefix", xmlNsPref.getPrefix()); - xmlNsPref = xmlNsPrefixesIterator.next(); - assertEquals("bar", xmlNsPref.getNamespaceURI()); - assertEquals("barPrefix", xmlNsPref.getPrefix()); - assertFalse(xmlNsPrefixesIterator.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.removeXmlNsPrefix(declaration, 1); - } - }); - - xmlNsPrefixesIterator = xmlNsPrefixes.iterator(); - assertTrue(xmlNsPrefixesIterator.hasNext()); - xmlNsPref = xmlNsPrefixesIterator.next(); - assertEquals("baz", xmlNsPref.getNamespaceURI()); - assertEquals("bazPrefix", xmlNsPref.getPrefix()); - xmlNsPref = xmlNsPrefixesIterator.next(); - assertEquals("bar", xmlNsPref.getNamespaceURI()); - assertEquals("barPrefix", xmlNsPref.getPrefix()); - assertFalse(xmlNsPrefixesIterator.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.removeXmlNsPrefix(declaration, 1); - } - }); - - xmlNsPrefixesIterator = xmlNsPrefixes.iterator(); - assertTrue(xmlNsPrefixesIterator.hasNext()); - xmlNsPref = xmlNsPrefixesIterator.next(); - assertEquals("baz", xmlNsPref.getNamespaceURI()); - assertEquals("bazPrefix", xmlNsPref.getPrefix()); - assertFalse(xmlNsPrefixesIterator.hasNext()); - - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTests.this.removeXmlNsPrefix(declaration, 0); - } - }); - - xmlNsPrefixesIterator = xmlNsPrefixes.iterator(); - assertFalse(xmlNsPrefixesIterator.hasNext()); - } - - protected void addXmlSchemaEnumMemberValuePair(ModifiedDeclaration declaration, String elementName, String value) { - this.addEnumMemberValuePair((MarkerAnnotation) this.getXmlSchemaAnnotation(declaration), elementName, value); - } - - protected void setXmlSchemaEnumMemberValuePair(ModifiedDeclaration declaration, String elementName, String enumValue) { - this.setEnumMemberValuePair((NormalAnnotation) this.getXmlSchemaAnnotation(declaration), elementName, enumValue); - } - - protected void addXmlSchemaMemberValuePair(ModifiedDeclaration declaration, String name, String value) { - this.addMemberValuePair((MarkerAnnotation) this.getXmlSchemaAnnotation(declaration), name, value); - } - - //add another package annotation so that the context model object doesn't get removed when - //removing the XmlSchema annotation. Only "annotated" packages are added to the context model - protected void removeXmlSchemaAnnotation(ModifiedDeclaration declaration) { - this.addMarkerAnnotation(declaration.getDeclaration(), XmlAccessorOrderAnnotation.ANNOTATION_NAME); - this.removeAnnotation(declaration, XmlSchemaAnnotation.ANNOTATION_NAME); - } - - protected Annotation getXmlSchemaAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlSchemaAnnotation.ANNOTATION_NAME); - } - - protected void moveXmlNsPrefix(ModifiedDeclaration declaration, int targetIndex, int sourceIndex) { - this.moveArrayElement((NormalAnnotation) getXmlSchemaAnnotation(declaration), JAXB.XML_SCHEMA__XMLNS, targetIndex, sourceIndex); - } - - protected void removeXmlNsPrefix(ModifiedDeclaration declaration, int index) { - this.removeArrayElement((NormalAnnotation) getXmlSchemaAnnotation(declaration), JAXB.XML_SCHEMA__XMLNS, index); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlSchemaTypeTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlSchemaTypeTests.java deleted file mode 100644 index 6ff137f7d0..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlSchemaTypeTests.java +++ /dev/null @@ -1,207 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context.java; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.MarkerAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jaxb.core.context.JaxbPackageInfo; -import org.eclipse.jpt.jaxb.core.context.XmlSchemaType; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; -import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; -import org.eclipse.xsd.util.XSDUtil; - - -@SuppressWarnings("nls") -public class GenericJavaXmlSchemaTypeTests extends JaxbContextModelTestCase -{ - - public GenericJavaXmlSchemaTypeTests(String name) { - super(name); - } - - private ICompilationUnit createPackageInfoWithXmlSchemaType() throws CoreException { - return createTestPackageInfo( - "@XmlSchemaType", - JAXB.XML_SCHEMA_TYPE); - } - - public void testModifyName() throws Exception { - this.createPackageInfoWithXmlSchemaType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchemaType contextXmlSchemaType = contextPackageInfo.getXmlSchemaTypes().iterator().next(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertNull(contextXmlSchemaType.getName()); - - contextXmlSchemaType.setName("foo"); - XmlSchemaTypeAnnotation schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", schemaTypeAnnotation.getName()); - assertEquals("foo", contextXmlSchemaType.getName()); - - //verify the xml schema type annotation is not removed when the name is set to null - contextXmlSchemaType.setName(null); - schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - assertNull(schemaTypeAnnotation.getName()); - assertNull(contextXmlSchemaType.getName()); - } - - public void testUpdateName() throws Exception { - this.createPackageInfoWithXmlSchemaType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchemaType contextXmlSchemaType = contextPackageInfo.getXmlSchemaTypes().iterator().next(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertNull(contextXmlSchemaType.getName()); - - //add a name member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTypeTests.this.addXmlSchemaTypeMemberValuePair(declaration, JAXB.XML_SCHEMA_TYPE__NAME, "foo"); - } - }); - assertEquals("foo", contextXmlSchemaType.getName()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTypeTests.this.removeXmlSchemaTypeAnnotation(declaration); - } - }); - assertFalse(contextPackageInfo.getXmlSchemaTypes().iterator().hasNext()); - } - - public void testModifyNamespace() throws Exception { - this.createPackageInfoWithXmlSchemaType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchemaType contextXmlSchemaType = contextPackageInfo.getXmlSchemaTypes().iterator().next(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertNull(contextXmlSchemaType.getSpecifiedNamespace()); - assertEquals(XSDUtil.SCHEMA_FOR_SCHEMA_URI_2001, contextXmlSchemaType.getDefaultNamespace()); - assertEquals(XSDUtil.SCHEMA_FOR_SCHEMA_URI_2001, contextXmlSchemaType.getNamespace()); - - contextXmlSchemaType.setSpecifiedNamespace("foo"); - XmlSchemaTypeAnnotation schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", schemaTypeAnnotation.getNamespace()); - assertEquals("foo", contextXmlSchemaType.getSpecifiedNamespace()); - assertEquals("foo", contextXmlSchemaType.getNamespace()); - - //verify the xml schema type annotation is not removed when the namespace is set to null - contextXmlSchemaType.setSpecifiedNamespace(null); - schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - assertNull(schemaTypeAnnotation.getNamespace()); - assertNull(contextXmlSchemaType.getSpecifiedNamespace()); - assertEquals(XSDUtil.SCHEMA_FOR_SCHEMA_URI_2001, contextXmlSchemaType.getNamespace()); - } - - public void testUpdateNamespace() throws Exception { - this.createPackageInfoWithXmlSchemaType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchemaType contextXmlSchemaType = contextPackageInfo.getXmlSchemaTypes().iterator().next(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertNull(contextXmlSchemaType.getSpecifiedNamespace()); - assertEquals(XSDUtil.SCHEMA_FOR_SCHEMA_URI_2001, contextXmlSchemaType.getDefaultNamespace()); - assertEquals(XSDUtil.SCHEMA_FOR_SCHEMA_URI_2001, contextXmlSchemaType.getNamespace()); - - //add a namespace member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTypeTests.this.addXmlSchemaTypeMemberValuePair(declaration, JAXB.XML_SCHEMA_TYPE__NAMESPACE, "foo"); - } - }); - assertEquals("foo", contextXmlSchemaType.getSpecifiedNamespace()); - assertEquals("foo", contextXmlSchemaType.getNamespace()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTypeTests.this.removeXmlSchemaTypeAnnotation(declaration); - } - }); - assertFalse(contextPackageInfo.getXmlSchemaTypes().iterator().hasNext()); - } - - public void testModifyType() throws Exception { - this.createPackageInfoWithXmlSchemaType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchemaType contextXmlSchemaType = contextPackageInfo.getXmlSchemaTypes().iterator().next(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertNull(contextXmlSchemaType.getType()); - - contextXmlSchemaType.setType("foo"); - XmlSchemaTypeAnnotation schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - assertEquals("foo", schemaTypeAnnotation.getType()); - assertEquals("foo", contextXmlSchemaType.getType()); - - //verify the xml schema type annotation is not removed when the type is set to null - contextXmlSchemaType.setType(null); - schemaTypeAnnotation = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - assertNull(schemaTypeAnnotation.getType()); - assertNull(contextXmlSchemaType.getType()); - } - - public void testUpdateType() throws Exception { - this.createPackageInfoWithXmlSchemaType(); - JaxbPackageInfo contextPackageInfo = CollectionTools.get(getContextRoot().getPackages(), 0).getPackageInfo(); - XmlSchemaType contextXmlSchemaType = contextPackageInfo.getXmlSchemaTypes().iterator().next(); - JavaResourcePackage resourcePackage = contextPackageInfo.getResourcePackage(); - - assertNull(contextXmlSchemaType.getType()); - - //add a type member value pair - AnnotatedElement annotatedElement = this.annotatedElement(resourcePackage); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTypeTests.this.addXmlSchemaTypeTypeMemberValuePair(declaration, JAXB.XML_SCHEMA_TYPE__TYPE, "String"); - } - }); - assertEquals("String", contextXmlSchemaType.getType()); - - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlSchemaTypeTests.this.removeXmlSchemaTypeAnnotation(declaration); - } - }); - assertFalse(contextPackageInfo.getXmlSchemaTypes().iterator().hasNext()); - } - - protected void addXmlSchemaTypeTypeMemberValuePair(ModifiedDeclaration declaration, String name, String typeName) { - this.addMemberValuePair( - (MarkerAnnotation) this.getXmlSchemaTypeAnnotation(declaration), - name, - this.newTypeLiteral(declaration.getAst(), typeName)); - } - - protected void addXmlSchemaTypeMemberValuePair(ModifiedDeclaration declaration, String name, String value) { - this.addMemberValuePair((MarkerAnnotation) this.getXmlSchemaTypeAnnotation(declaration), name, value); - } - - //add another package annotation so that the context model object doesn't get removed when - //removing the XmlSchemaType annotation. Only "annotated" packages are added to the context model - protected void removeXmlSchemaTypeAnnotation(ModifiedDeclaration declaration) { - this.addMarkerAnnotation(declaration.getDeclaration(), XmlAccessorOrderAnnotation.ANNOTATION_NAME); - this.removeAnnotation(declaration, XmlSchemaTypeAnnotation.ANNOTATION_NAME); - } - - protected Annotation getXmlSchemaTypeAnnotation(ModifiedDeclaration declaration) { - return declaration.getAnnotationNamed(XmlSchemaTypeAnnotation.ANNOTATION_NAME); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlValueMappingTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlValueMappingTests.java deleted file mode 100644 index dc9cd5f39c..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/GenericJavaXmlValueMappingTests.java +++ /dev/null @@ -1,151 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.ModifiedDeclaration; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.MappingKeys; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentAttribute; -import org.eclipse.jpt.jaxb.core.context.JaxbPersistentClass; -import org.eclipse.jpt.jaxb.core.context.XmlAttributeMapping; -import org.eclipse.jpt.jaxb.core.context.XmlElementMapping; -import org.eclipse.jpt.jaxb.core.context.XmlValueMapping; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceAttribute; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation; -import org.eclipse.jpt.jaxb.core.tests.internal.context.JaxbContextModelTestCase; - - -@SuppressWarnings("nls") -public class GenericJavaXmlValueMappingTests extends JaxbContextModelTestCase -{ - - public GenericJavaXmlValueMappingTests(String name) { - super(name); - } - - private ICompilationUnit createTypeWithXmlValue() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE, JAXB.XML_VALUE); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType"); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlValue"); - } - }); - } - - public void testChangeMappingType() throws Exception { - createTypeWithXmlValue(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlValueMapping xmlValueMapping = (XmlValueMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlValueMapping.getParent().getJavaResourceAttribute(); - - assertNotNull(xmlValueMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlValueAnnotation.ANNOTATION_NAME)); - - persistentAttribute.setMappingKey(MappingKeys.XML_ATTRIBUTE_ATTRIBUTE_MAPPING_KEY); - XmlAttributeMapping xmlAttributeMapping = (XmlAttributeMapping) persistentAttribute.getMapping(); - assertNotNull(xmlAttributeMapping); - assertNull(resourceAttribute.getAnnotation(XmlValueAnnotation.ANNOTATION_NAME)); - assertNotNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); - - persistentAttribute.setMappingKey(MappingKeys.XML_VALUE_ATTRIBUTE_MAPPING_KEY); - xmlValueMapping = (XmlValueMapping) persistentAttribute.getMapping(); - assertNotNull(xmlValueMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlValueAnnotation.ANNOTATION_NAME)); - assertNull(resourceAttribute.getAnnotation(XmlAttributeAnnotation.ANNOTATION_NAME)); - - - persistentAttribute.setMappingKey(MappingKeys.XML_ELEMENT_ATTRIBUTE_MAPPING_KEY); - XmlElementMapping xmlElementMapping = (XmlElementMapping) persistentAttribute.getMapping(); - assertNotNull(xmlElementMapping); - assertNull(resourceAttribute.getAnnotation(XmlValueAnnotation.ANNOTATION_NAME)); - assertNotNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); - - persistentAttribute.setMappingKey(MappingKeys.XML_VALUE_ATTRIBUTE_MAPPING_KEY); - xmlValueMapping = (XmlValueMapping) persistentAttribute.getMapping(); - assertNotNull(xmlValueMapping); - assertNotNull(resourceAttribute.getAnnotation(XmlValueAnnotation.ANNOTATION_NAME)); - assertNull(resourceAttribute.getAnnotation(XmlElementAnnotation.ANNOTATION_NAME)); - } - - public void testModifyXmlJavaTypeAdapter() throws Exception { - createTypeWithXmlValue(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlValueMapping xmlValueMapping = (XmlValueMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlValueMapping.getParent().getJavaResourceAttribute(); - - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(xmlValueMapping.getXmlJavaTypeAdapter()); - assertNull(xmlJavaTypeAdapterAnnotation); - - xmlValueMapping.addXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNotNull(xmlValueMapping.getXmlJavaTypeAdapter()); - assertNotNull(xmlJavaTypeAdapterAnnotation); - - xmlValueMapping.removeXmlJavaTypeAdapter(); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - - public void testUpdateXmlJavaTypeAdapter() throws Exception { - createTypeWithXmlValue(); - - JaxbPersistentClass persistentClass = CollectionTools.get(getContextRoot().getPersistentClasses(), 0); - JaxbPersistentAttribute persistentAttribute = CollectionTools.get(persistentClass.getAttributes(), 0); - XmlValueMapping xmlValueMapping = (XmlValueMapping) persistentAttribute.getMapping(); - JavaResourceAttribute resourceAttribute = xmlValueMapping.getParent().getJavaResourceAttribute(); - - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(xmlValueMapping.getXmlJavaTypeAdapter()); - assertNull(xmlJavaTypeAdapterAnnotation); - - - //add an XmlJavaTypeAdapter annotation - AnnotatedElement annotatedElement = this.annotatedElement(resourceAttribute); - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlValueMappingTests.this.addMarkerAnnotation(declaration.getDeclaration(), XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNotNull(xmlValueMapping.getXmlJavaTypeAdapter()); - assertNotNull(xmlJavaTypeAdapterAnnotation); - - //remove the XmlJavaTypeAdapter annotation - annotatedElement.edit(new Member.Editor() { - public void edit(ModifiedDeclaration declaration) { - GenericJavaXmlValueMappingTests.this.removeAnnotation(declaration, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - } - }); - xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceAttribute.getAnnotation(0, XmlJavaTypeAdapterAnnotation.ANNOTATION_NAME); - assertNull(xmlValueMapping.getXmlJavaTypeAdapter()); - assertNull(xmlJavaTypeAdapterAnnotation); - } -} \ No newline at end of file diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/JaxbCoreJavaContextModelTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/JaxbCoreJavaContextModelTests.java deleted file mode 100644 index 7dabe10ebc..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/context/java/JaxbCoreJavaContextModelTests.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.context.java; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; - -public class JaxbCoreJavaContextModelTests extends TestCase -{ - public static Test suite() { - TestSuite suite = new TestSuite(JaxbCoreJavaContextModelTests.class.getName()); - suite.addTestSuite(GenericJavaElementFactoryMethodTests.class); - suite.addTestSuite(GenericJavaEnumConstantTests.class); - suite.addTestSuite(GenericJavaPackageInfoTests.class); - suite.addTestSuite(GenericJavaPackageXmlJavaTypeAdapterTests.class); - suite.addTestSuite(GenericJavaTypeXmlJavaTypeAdapterTests.class); - suite.addTestSuite(GenericJavaAttributeXmlJavaTypeAdapterTests.class); - suite.addTestSuite(GenericJavaPersistentClassTests.class); - suite.addTestSuite(GenericJavaPersistentEnumTests.class); - suite.addTestSuite(GenericJavaRegistryTests.class); - suite.addTestSuite(GenericJavaXmlAttributeMappingTests.class); - suite.addTestSuite(GenericJavaXmlElementMappingTests.class); - suite.addTestSuite(GenericJavaXmlRootElementTests.class); - suite.addTestSuite(GenericJavaXmlSchemaTests.class); - suite.addTestSuite(GenericJavaXmlSchemaTypeTests.class); - suite.addTestSuite(GenericJavaXmlValueMappingTests.class); - return suite; - } - - private JaxbCoreJavaContextModelTests() { - super(); - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/projects/TestJaxbProject.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/projects/TestJaxbProject.java deleted file mode 100644 index b759240164..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/projects/TestJaxbProject.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.projects; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject; -import org.eclipse.jpt.jaxb.core.JaxbFacet; -import org.eclipse.jpt.jaxb.core.JaxbProject; -import org.eclipse.jpt.jaxb.core.JptJaxbCorePlugin; -import org.eclipse.wst.common.componentcore.datamodel.properties.IFacetDataModelProperties; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * This builds and holds a "JAXB" project. - * Support for adding packages and types. - * - * The JPA project's settings (platform, database connection, etc.) can be - * controlled by building a data model and passing it into the constructor. - */ -public class TestJaxbProject - extends TestJavaProject { - - private final JaxbProject jaxbProject; - - - // ********** builders ********** - - public static TestJaxbProject buildJaxbProject( - String baseProjectName, boolean autoBuild, IDataModel config) - throws CoreException { - return new TestJaxbProject(baseProjectName, autoBuild, config); - } - - - // ********** constructors/initialization ********** - - public TestJaxbProject(String projectName) throws CoreException { - this(projectName, false); - } - - public TestJaxbProject(String projectName, boolean autoBuild) throws CoreException { - this(projectName, autoBuild, null); - } - - public TestJaxbProject(String projectName, boolean autoBuild, IDataModel config) throws CoreException { - super(projectName, autoBuild); - String jaxbFacetVersion = - ((IProjectFacetVersion) config.getProperty(IFacetDataModelProperties.FACET_VERSION)).getVersionString(); - this.installFacet(JaxbFacet.ID, jaxbFacetVersion, config); - this.jaxbProject = JptJaxbCorePlugin.getJaxbProject(this.getProject()); -// this.jaxbProject.setUpdater(new SynchronousJpaProjectUpdater(this.jaxbProject)); - } - - - // ********** public methods ********** - - public JaxbProject getJaxbProject() { - return this.jaxbProject; - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/JaxbCoreResourceModelTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/JaxbCoreResourceModelTests.java deleted file mode 100644 index 18e284c963..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/JaxbCoreResourceModelTests.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource; - -import junit.framework.Test; -import junit.framework.TestCase; -import junit.framework.TestSuite; -import org.eclipse.jpt.jaxb.core.tests.internal.resource.java.JaxbJavaResourceModelTests; - - -public class JaxbCoreResourceModelTests extends TestCase -{ - public static Test suite() { - TestSuite suite = new TestSuite(JaxbCoreResourceModelTests.class.getName()); - - suite.addTest(JaxbJavaResourceModelTests.suite()); - return suite; - } - - private JaxbCoreResourceModelTests() { - super(); - throw new UnsupportedOperationException(); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JavaResourceModelTestCase.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JavaResourceModelTestCase.java deleted file mode 100644 index e606226c7a..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JavaResourceModelTestCase.java +++ /dev/null @@ -1,197 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import org.eclipse.jdt.core.ElementChangedEvent; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IElementChangedListener; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaElementDelta; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jpt.common.core.internal.utility.jdt.NullAnnotationEditFormatter; -import org.eclipse.jpt.common.core.tests.internal.utility.jdt.AnnotationTestCase; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.internal.BitTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jaxb.core.AnnotationProvider; -import org.eclipse.jpt.jaxb.core.internal.GenericAnnotationProvider; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourcePackageInfoCompilationUnit; -import org.eclipse.jpt.jaxb.core.internal.resource.java.source.SourceTypeCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.AbstractJavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackageInfoCompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotationDefinition; - -@SuppressWarnings("nls") -public abstract class JavaResourceModelTestCase - extends AnnotationTestCase { - - private JavaElementChangeListener javaElementChangeListener; - protected JavaResourceCompilationUnit javaResourceCompilationUnit; - - - public JavaResourceModelTestCase(String name) { - super(name); - } - - @Override - protected void setUp() throws Exception { - super.setUp(); - this.javaElementChangeListener = new JavaElementChangeListener(); - JavaCore.addElementChangedListener(this.javaElementChangeListener); - } - - @Override - protected void tearDown() throws Exception { - super.tearDown(); - JavaCore.removeElementChangedListener(this.javaElementChangeListener); - this.javaElementChangeListener = null; - } - - private class JavaElementChangeListener - implements IElementChangedListener { - - JavaElementChangeListener() { - super(); - } - - public void elementChanged(ElementChangedEvent event) { - JavaResourceModelTestCase.this.javaElementChanged(event); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - } - - void javaElementChanged(ElementChangedEvent event) { - if (this.javaResourceCompilationUnit == null) { - return; - } - this.syncWithJavaDelta(event.getDelta()); - } - - /** - * NB: this is copied from GenericJpaProject, so it might need to be - * kept in synch with that code if it changes... yech... - */ - protected void syncWithJavaDelta(IJavaElementDelta delta) { - switch (delta.getElement().getElementType()) { - case IJavaElement.JAVA_MODEL : - case IJavaElement.JAVA_PROJECT : - case IJavaElement.PACKAGE_FRAGMENT_ROOT : - case IJavaElement.PACKAGE_FRAGMENT : - this.syncWithJavaDeltaChildren(delta); - break; - case IJavaElement.COMPILATION_UNIT : - this.javaCompilationUnitChanged(delta); - break; - default : - break; // ignore the elements inside a compilation unit - } - } - - protected void syncWithJavaDeltaChildren(IJavaElementDelta delta) { - for (IJavaElementDelta child : delta.getAffectedChildren()) { - this.syncWithJavaDelta(child); // recurse - } - } - - protected void javaCompilationUnitChanged(IJavaElementDelta delta) { - if (this.deltaIsRelevant(delta)) { - this.javaResourceCompilationUnit.synchronizeWithJavaSource(); - } - } - - protected boolean deltaIsRelevant(IJavaElementDelta delta) { - if (BitTools.onlyFlagIsSet(delta.getFlags(), IJavaElementDelta.F_PRIMARY_WORKING_COPY)) { - return false; - } - return delta.getKind() == IJavaElementDelta.CHANGED; - } - - protected ICompilationUnit createAnnotationAndMembers(String packageName, String annotationName, String annotationBody) throws Exception { - return this.javaProject.createCompilationUnit(packageName, annotationName + ".java", "public @interface " + annotationName + " { " + annotationBody + " }"); - } - - protected ICompilationUnit createEnumAndMembers(String packageName, String enumName, String enumBody) throws Exception { - return this.javaProject.createCompilationUnit(packageName, enumName + ".java", "public enum " + enumName + " { " + enumBody + " }"); - } - - protected JavaResourcePackage buildJavaResourcePackage(ICompilationUnit cu) { - JavaResourcePackageInfoCompilationUnit pkgCu = - new SourcePackageInfoCompilationUnit( - cu, - this.buildAnnotationProvider(), - NullAnnotationEditFormatter.instance(), - CommandExecutor.Default.instance()); - this.javaResourceCompilationUnit = pkgCu; - return pkgCu.getPackage(); - } - - protected JavaResourceType buildJavaResourceType(ICompilationUnit cu) { - return (JavaResourceType) this.buildJavaResourceType_(cu); - } - - protected JavaResourceEnum buildJavaResourceEnum(ICompilationUnit cu) { - return (JavaResourceEnum) this.buildJavaResourceType_(cu); - } - - private AbstractJavaResourceType buildJavaResourceType_(ICompilationUnit cu) { - this.javaResourceCompilationUnit = this.buildJavaResourceCompilationUnit(cu); - this.javaResourceCompilationUnit.resolveTypes(); - return this.hackJavaResourceType(); - } - - protected JavaResourceField getField(JavaResourceType type, int index) { - return CollectionTools.get(type.getFields(), index); - } - - protected JavaResourceMethod getMethod(JavaResourceType type, int index) { - return CollectionTools.get(type.getMethods(), index); - } - - protected JavaResourceEnumConstant getEnumConstant(JavaResourceEnum resourceEnum, int index) { - return CollectionTools.get(resourceEnum.getEnumConstants(), index); - } - - protected AbstractJavaResourceType hackJavaResourceType() { - return (AbstractJavaResourceType) ReflectionTools.getFieldValue(this.javaResourceCompilationUnit, "type"); - } - - protected JavaResourceCompilationUnit buildJavaResourceCompilationUnit(ICompilationUnit cu) { - if (this.javaResourceCompilationUnit != null) { - throw new IllegalStateException(); - } - return new SourceTypeCompilationUnit( - cu, - this.buildAnnotationProvider(), - NullAnnotationEditFormatter.instance(), - CommandExecutor.Default.instance()); - } - - protected AnnotationProvider buildAnnotationProvider() { - return new GenericAnnotationProvider(this.annotationDefinitions(), this.nestableAnnotationDefinitions()); - } - - protected abstract AnnotationDefinition[] annotationDefinitions(); - - protected abstract NestableAnnotationDefinition[] nestableAnnotationDefinitions(); -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTestCase.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTestCase.java deleted file mode 100644 index 863e0e0552..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTestCase.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import org.eclipse.jpt.jaxb.core.internal.jaxb21.GenericJaxb_2_1_PlatformDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jaxb.core.resource.java.NestableAnnotationDefinition; - -public class JaxbJavaResourceModelTestCase - extends JavaResourceModelTestCase { - - public JaxbJavaResourceModelTestCase(String name) { - super(name); - } - - - @Override - protected AnnotationDefinition[] annotationDefinitions() { - return GenericJaxb_2_1_PlatformDefinition.instance().getAnnotationDefinitions(); - } - - @Override - protected NestableAnnotationDefinition[] nestableAnnotationDefinitions() { - return GenericJaxb_2_1_PlatformDefinition.instance().getNestableAnnotationDefinitions(); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTests.java deleted file mode 100644 index d76311ba11..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/JaxbJavaResourceModelTests.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import junit.framework.Test; -import junit.framework.TestSuite; - -public class JaxbJavaResourceModelTests { - - public static Test suite() { - TestSuite suite = new TestSuite(JaxbJavaResourceModelTests.class.getName()); - suite.addTestSuite(XmlAccessorOrderPackageAnnotationTests.class); - suite.addTestSuite(XmlAccessorOrderTypeAnnotationTests.class); - suite.addTestSuite(XmlAccessorTypePackageAnnotationTests.class); - suite.addTestSuite(XmlAccessorTypeTypeAnnotationTests.class); - suite.addTestSuite(XmlAnyAttributeAnnotationTests.class); - suite.addTestSuite(XmlAnyElementAnnotationTests.class); - suite.addTestSuite(XmlAttachmentRefAnnotationTests.class); - suite.addTestSuite(XmlAttributeAnnotationTests.class); - suite.addTestSuite(XmlElementAnnotationTests.class); - suite.addTestSuite(XmlElementDeclAnnotationTests.class); - suite.addTestSuite(XmlElementRefAnnotationTests.class); - suite.addTestSuite(XmlElementWrapperAnnotationTests.class); - suite.addTestSuite(XmlEnumAnnotationTests.class); - suite.addTestSuite(XmlEnumValueAnnotationTests.class); - suite.addTestSuite(XmlIDAnnotationTests.class); - suite.addTestSuite(XmlIDREFAnnotationTests.class); - suite.addTestSuite(XmlInlineBinaryDataAttributeAnnotationTests.class); - suite.addTestSuite(XmlInlineBinaryDataTypeAnnotationTests.class); - suite.addTestSuite(XmlJavaTypeAdapterPackageAnnotationTests.class); - suite.addTestSuite(XmlJavaTypeAdapterTypeAnnotationTests.class); - suite.addTestSuite(XmlListAnnotationTests.class); - suite.addTestSuite(XmlMimeTypeAnnotationTests.class); - suite.addTestSuite(XmlMixedAnnotationTests.class); - suite.addTestSuite(XmlRegistryAnnotationTests.class); - suite.addTestSuite(XmlRootElementAnnotationTests.class); - suite.addTestSuite(XmlSchemaAnnotationTests.class); - suite.addTestSuite(XmlSchemaTypeAttributeAnnotationTests.class); - suite.addTestSuite(XmlSchemaTypePackageAnnotationTests.class); - suite.addTestSuite(XmlSeeAlsoAnnotationTests.class); - suite.addTestSuite(XmlTransientAttributeAnnotationTests.class); - suite.addTestSuite(XmlTransientTypeAnnotationTests.class); - suite.addTestSuite(XmlTypeAnnotationTests.class); - suite.addTestSuite(XmlValueAnnotationTests.class); - - return suite; - } - - private JaxbJavaResourceModelTests() { - super(); - throw new UnsupportedOperationException(); - } - -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorOrderPackageAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorOrderPackageAnnotationTests.java deleted file mode 100644 index b56725ab5d..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorOrderPackageAnnotationTests.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; - -@SuppressWarnings("nls") -public class XmlAccessorOrderPackageAnnotationTests - extends JaxbJavaResourceModelTestCase { - - public XmlAccessorOrderPackageAnnotationTests(String name) { - super(name); - } - - - private ICompilationUnit createPackageInfoWithAccessorOrder() throws CoreException { - return createTestPackageInfo( - "@XmlAccessorOrder(XmlAccessOrder.UNDEFINED)", - JAXB.XML_ACCESS_ORDER, JAXB.XML_ACCESSOR_ORDER); - } - - public void testValue() - throws Exception { - - ICompilationUnit cu = createPackageInfoWithAccessorOrder(); - JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu); - - XmlAccessorOrderAnnotation annotation = - (XmlAccessorOrderAnnotation) resourcePackage.getAnnotation(JAXB.XML_ACCESSOR_ORDER); - assertNotNull(annotation); - assertEquals(XmlAccessOrder.UNDEFINED, annotation.getValue()); - - annotation.setValue(XmlAccessOrder.ALPHABETICAL); - assertEquals(XmlAccessOrder.ALPHABETICAL, annotation.getValue()); - assertSourceContains("@XmlAccessorOrder(ALPHABETICAL)", cu); - - annotation.setValue(null); - annotation = (XmlAccessorOrderAnnotation) resourcePackage.getAnnotation(JAXB.XML_ACCESSOR_ORDER); - assertNull(annotation.getValue()); - assertSourceDoesNotContain("@XmlAccessorOrder(", cu); - -// TODO uncomment when bug 328400 is addressed -// annotation = (XmlAccessorOrderAnnotation) packageResource.addAnnotation(JAXB.XML_ACCESSOR_ORDER); -// annotation.setValue(XmlAccessOrder.UNDEFINED); -// assertEquals(XmlAccessOrder.UNDEFINED, annotation.getValue()); -// assertSourceContains("@XmlAccessorOrder(UNDEFINED)", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorOrderTypeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorOrderTypeAnnotationTests.java deleted file mode 100644 index 32d835183f..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorOrderTypeAnnotationTests.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessOrder; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorOrderAnnotation; - -@SuppressWarnings("nls") -public class XmlAccessorOrderTypeAnnotationTests - extends JaxbJavaResourceModelTestCase { - - public XmlAccessorOrderTypeAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlAccessorOrder() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ACCESSOR_ORDER); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlAccessorOrder"); - } - }); - } - - private ICompilationUnit createTestXmlAccessorOrderWithValue() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ACCESSOR_ORDER, JAXB.XML_ACCESS_ORDER); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlAccessorOrder(value = XmlAccessOrder.ALPHABETICAL)"); - } - }); - } - - public void testGetNull() throws Exception { - ICompilationUnit cu = this.createTestXmlAccessorOrder(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlAccessorOrderAnnotation xmlAccessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_ORDER); - assertTrue(xmlAccessorOrderAnnotation != null); - assertNull(xmlAccessorOrderAnnotation.getValue()); - } - - public void testGetValue() throws Exception { - ICompilationUnit cu = this.createTestXmlAccessorOrderWithValue(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlAccessorOrderAnnotation xmlAccessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_ORDER); - assertEquals(XmlAccessOrder.ALPHABETICAL, xmlAccessorOrderAnnotation.getValue()); - } - - public void testSetValue() throws Exception { - ICompilationUnit cu = this.createTestXmlAccessorOrder(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlAccessorOrderAnnotation xmlAccessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_ORDER); - assertEquals(null, xmlAccessorOrderAnnotation.getValue()); - - xmlAccessorOrderAnnotation.setValue(XmlAccessOrder.UNDEFINED); - assertEquals(XmlAccessOrder.UNDEFINED, xmlAccessorOrderAnnotation.getValue()); - - assertSourceContains("@XmlAccessorOrder(UNDEFINED)", cu); - } - - public void testSetValueNull() throws Exception { - ICompilationUnit cu = this.createTestXmlAccessorOrderWithValue(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlAccessorOrderAnnotation xmlAccessorOrderAnnotation = (XmlAccessorOrderAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_ORDER); - assertEquals(XmlAccessOrder.ALPHABETICAL, xmlAccessorOrderAnnotation.getValue()); - - xmlAccessorOrderAnnotation.setValue(null); - assertNull(xmlAccessorOrderAnnotation.getValue()); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorTypePackageAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorTypePackageAnnotationTests.java deleted file mode 100644 index 31a54bb81f..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorTypePackageAnnotationTests.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation; - -@SuppressWarnings("nls") -public class XmlAccessorTypePackageAnnotationTests - extends JaxbJavaResourceModelTestCase { - - public XmlAccessorTypePackageAnnotationTests(String name) { - super(name); - } - - - private ICompilationUnit createPackageInfoWithAccessorType() throws CoreException { - return createTestPackageInfo( - "@XmlAccessorType(value = XmlAccessType.PROPERTY)", - JAXB.XML_ACCESS_TYPE, JAXB.XML_ACCESSOR_TYPE); - } - - public void testValue() - throws Exception { - - ICompilationUnit cu = createPackageInfoWithAccessorType(); - JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu); - - XmlAccessorTypeAnnotation annotation = - (XmlAccessorTypeAnnotation) resourcePackage.getAnnotation(JAXB.XML_ACCESSOR_TYPE); - assertTrue(annotation != null); - assertEquals(XmlAccessType.PROPERTY, annotation.getValue()); - - annotation.setValue(XmlAccessType.FIELD); - assertEquals(XmlAccessType.FIELD, annotation.getValue()); - assertSourceContains("@XmlAccessorType(value = FIELD)", cu); - - annotation.setValue(XmlAccessType.NONE); - assertEquals(XmlAccessType.NONE, annotation.getValue()); - assertSourceContains("@XmlAccessorType(value = NONE)", cu); - - annotation.setValue(XmlAccessType.PUBLIC_MEMBER); - assertEquals(XmlAccessType.PUBLIC_MEMBER, annotation.getValue()); - assertSourceContains("@XmlAccessorType(value = PUBLIC_MEMBER)", cu); - - annotation.setValue(null); - assertSourceDoesNotContain("@XmlAccessorType(", cu); - -// TODO uncomment when bug 328400 is addressed -// annotation = (XmlAccessorTypeAnnotation) packageResource.addAnnotation(JAXB.XML_ACCESSOR_TYPE); -// annotation.setValue(XmlAccessType.PROPERTY); -// assertEquals(XmlAccessType.PROPERTY, annotation.getValue()); -// assertSourceContains("@XmlAccessorType(PROPERTY)", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorTypeTypeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorTypeTypeAnnotationTests.java deleted file mode 100644 index 581eb2c125..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAccessorTypeTypeAnnotationTests.java +++ /dev/null @@ -1,106 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAccessorTypeAnnotation; - -@SuppressWarnings("nls") -public class XmlAccessorTypeTypeAnnotationTests - extends JaxbJavaResourceModelTestCase { - - public XmlAccessorTypeTypeAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlAccessorType() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ACCESSOR_TYPE); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlAccessorType"); - } - }); - } - - private ICompilationUnit createTestXmlAccessorTypeWithValue() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ACCESSOR_TYPE, JAXB.XML_ACCESS_TYPE); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlAccessorType(value = XmlAccessType.FIELD)"); - } - }); - } - - public void testGetNull() throws Exception { - ICompilationUnit cu = this.createTestXmlAccessorType(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlAccessorTypeAnnotation xmlAccessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_TYPE); - assertTrue(xmlAccessorTypeAnnotation != null); - assertNull(xmlAccessorTypeAnnotation.getValue()); - } - - public void testGetValue() throws Exception { - ICompilationUnit cu = this.createTestXmlAccessorTypeWithValue(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlAccessorTypeAnnotation xmlAccessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_TYPE); - assertEquals(XmlAccessType.FIELD, xmlAccessorTypeAnnotation.getValue()); - } - - public void testSetValue() throws Exception { - ICompilationUnit cu = this.createTestXmlAccessorType(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlAccessorTypeAnnotation xmlAccessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_TYPE); - assertEquals(null, xmlAccessorTypeAnnotation.getValue()); - - xmlAccessorTypeAnnotation.setValue(XmlAccessType.PUBLIC_MEMBER); - assertEquals(XmlAccessType.PUBLIC_MEMBER, xmlAccessorTypeAnnotation.getValue()); - - assertSourceContains("@XmlAccessorType(PUBLIC_MEMBER)", cu); - - xmlAccessorTypeAnnotation.setValue(XmlAccessType.PROPERTY); - assertEquals(XmlAccessType.PROPERTY, xmlAccessorTypeAnnotation.getValue()); - - assertSourceContains("@XmlAccessorType(PROPERTY)", cu); - - xmlAccessorTypeAnnotation.setValue(XmlAccessType.NONE); - assertEquals(XmlAccessType.NONE, xmlAccessorTypeAnnotation.getValue()); - - assertSourceContains("@XmlAccessorType(NONE)", cu); - } - - public void testSetValueNull() throws Exception { - ICompilationUnit cu = this.createTestXmlAccessorTypeWithValue(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlAccessorTypeAnnotation xmlAccessorTypeAnnotation = (XmlAccessorTypeAnnotation) resourceType.getAnnotation(JAXB.XML_ACCESSOR_TYPE); - assertEquals(XmlAccessType.FIELD, xmlAccessorTypeAnnotation.getValue()); - - xmlAccessorTypeAnnotation.setValue(null); - assertNull(xmlAccessorTypeAnnotation.getValue()); - - assertSourceDoesNotContain("@XmlAccessorType(", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyAttributeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyAttributeAnnotationTests.java deleted file mode 100644 index 5fa4b55305..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyAttributeAnnotationTests.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyAttributeAnnotation; - -@SuppressWarnings("nls") -public class XmlAnyAttributeAnnotationTests extends JaxbJavaResourceModelTestCase { - - public XmlAnyAttributeAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlAnyAttribute() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ANY_ATTRIBUTE); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlAnyAttribute"); - } - }); - } - - public void testGetXmlAnyAttribute() throws Exception { - ICompilationUnit cu = this.createTestXmlAnyAttribute(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlAnyAttributeAnnotation xmlAnyAttributeAnnotation = (XmlAnyAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ANY_ATTRIBUTE); - assertTrue(xmlAnyAttributeAnnotation != null); - - resourceAttribute.removeAnnotation(JAXB.XML_ANY_ATTRIBUTE); - assertSourceDoesNotContain("@XmlAnyAttribute", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyElementAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyElementAnnotationTests.java deleted file mode 100644 index 2c38213a2b..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAnyElementAnnotationTests.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAnyElementAnnotation; - -@SuppressWarnings("nls") -public class XmlAnyElementAnnotationTests extends JaxbJavaResourceModelTestCase { - - private static final String XML_ANY_ELEMENT_VALUE = "String"; - - public XmlAnyElementAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlAnyElement() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ANY_ELEMENT); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlAnyElement"); - } - }); - } - - private ICompilationUnit createTestXmlAnyElementWithBooleanElement(final String booleanElement) throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ANY_ELEMENT); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlAnyElement(" + booleanElement + " = true)"); - } - }); - } - - private ICompilationUnit createTestXmlAnyElementWithValue() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ANY_ELEMENT); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlAnyElement(value = " + XML_ANY_ELEMENT_VALUE + ".class)"); - } - }); - } - - public void testGetNull() throws Exception { - ICompilationUnit cu = this.createTestXmlAnyElement(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlAnyElementAnnotation xmlAnyElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT); - assertTrue(xmlAnyElementAnnotation != null); - assertNull(xmlAnyElementAnnotation.getLax()); - assertNull(xmlAnyElementAnnotation.getValue()); - } - - public void testGetLax() throws Exception { - ICompilationUnit cu = this.createTestXmlAnyElementWithBooleanElement("lax"); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - XmlAnyElementAnnotation xmlAnyElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT); - - assertEquals(Boolean.TRUE, xmlAnyElementAnnotation.getLax()); - } - - public void testSetLax() throws Exception { - ICompilationUnit cu = this.createTestXmlAnyElement(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - XmlAnyElementAnnotation xmlAnyElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT); - - assertNotNull(xmlAnyElementAnnotation); - assertNull(xmlAnyElementAnnotation.getLax()); - - xmlAnyElementAnnotation.setLax(Boolean.FALSE); - assertEquals(Boolean.FALSE, xmlAnyElementAnnotation.getLax()); - - assertSourceContains("@XmlAnyElement(lax = false)", cu); - - xmlAnyElementAnnotation.setLax(null); - assertSourceContains("@XmlAnyElement", cu); - assertSourceDoesNotContain("lax", cu); - } - - public void testGetValue() throws Exception { - ICompilationUnit cu = this.createTestXmlAnyElementWithValue(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlAnyElementAnnotation xmlAnyElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT); - assertTrue(xmlAnyElementAnnotation != null); - assertEquals(XML_ANY_ELEMENT_VALUE, xmlAnyElementAnnotation.getValue()); - assertEquals("java.lang." + XML_ANY_ELEMENT_VALUE, xmlAnyElementAnnotation.getFullyQualifiedValueClassName()); - } - - public void testSetValue() throws Exception { - ICompilationUnit cu = this.createTestXmlAnyElement(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlAnyElementAnnotation xmlAnyElementAnnotation = (XmlAnyElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ANY_ELEMENT); - assertNull(xmlAnyElementAnnotation.getValue()); - xmlAnyElementAnnotation.setValue(XML_ANY_ELEMENT_VALUE); - assertEquals(XML_ANY_ELEMENT_VALUE, xmlAnyElementAnnotation.getValue()); - - assertSourceContains("@XmlAnyElement(" + XML_ANY_ELEMENT_VALUE + ".class)", cu); - - xmlAnyElementAnnotation.setValue(null); - assertNull(xmlAnyElementAnnotation.getValue()); - - assertSourceContains("@XmlAnyElement", cu); - assertSourceDoesNotContain("@XmlAnyElement(value = " + XML_ANY_ELEMENT_VALUE + ".class)", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttachmentRefAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttachmentRefAnnotationTests.java deleted file mode 100644 index fadcf440de..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttachmentRefAnnotationTests.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttachmentRefAnnotation; - -@SuppressWarnings("nls") -public class XmlAttachmentRefAnnotationTests extends JaxbJavaResourceModelTestCase { - - public XmlAttachmentRefAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlAttachmentRef() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ATTACHMENT_REF); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlAttachmentRef"); - } - }); - } - - public void testGetXmlAttachmentRef() throws Exception { - ICompilationUnit cu = this.createTestXmlAttachmentRef(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlAttachmentRefAnnotation xmlAttachmentRefAnnotation = (XmlAttachmentRefAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTACHMENT_REF); - assertTrue(xmlAttachmentRefAnnotation != null); - - resourceAttribute.removeAnnotation(JAXB.XML_ATTACHMENT_REF); - assertSourceDoesNotContain("@XmlAttachmentRef", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttributeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttributeAnnotationTests.java deleted file mode 100644 index 74839bb6f7..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlAttributeAnnotationTests.java +++ /dev/null @@ -1,174 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlAttributeAnnotation; - -@SuppressWarnings("nls") -public class XmlAttributeAnnotationTests extends JaxbJavaResourceModelTestCase { - - private static final String XML_ATTRIBUTE_NAME = "elementName"; - private static final String XML_ATTRIBUTE_NAMESPACE = "XmlAttributeNamespace"; - - public XmlAttributeAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlAttribute() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ATTRIBUTE); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlAttribute"); - } - }); - } - - private ICompilationUnit createTestXmlAttributeWithName() throws Exception { - return this.createTestXmlAttributeWithStringElement("name", XML_ATTRIBUTE_NAME); - } - - private ICompilationUnit createTestXmlAttributeWithNamespace() throws Exception { - return this.createTestXmlAttributeWithStringElement("namespace", XML_ATTRIBUTE_NAMESPACE); - } - - private ICompilationUnit createTestXmlAttributeWithStringElement(final String element, final String value) throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ATTRIBUTE); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlAttribute(" + element + " = \"" + value + "\")"); - } - }); - } - - private ICompilationUnit createTestXmlAttributeWithBooleanElement(final String booleanElement) throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ATTRIBUTE); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlAttribute(" + booleanElement + " = true)"); - } - }); - } - - public void testGetName() throws Exception { - ICompilationUnit cu = this.createTestXmlAttributeWithName(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE); - assertTrue(xmlAttributeAnnotation != null); - assertEquals(XML_ATTRIBUTE_NAME, xmlAttributeAnnotation.getName()); - } - - public void testGetNull() throws Exception { - ICompilationUnit cu = this.createTestXmlAttribute(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE); - assertTrue(xmlAttributeAnnotation != null); - assertNull(xmlAttributeAnnotation.getName()); - assertNull(xmlAttributeAnnotation.getNamespace()); - assertNull(xmlAttributeAnnotation.getRequired()); - } - - public void testSetName() throws Exception { - ICompilationUnit cu = this.createTestXmlAttribute(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE); - assertNull(xmlAttributeAnnotation.getName()); - xmlAttributeAnnotation.setName(XML_ATTRIBUTE_NAME); - assertEquals(XML_ATTRIBUTE_NAME, xmlAttributeAnnotation.getName()); - - assertSourceContains("@XmlAttribute(name = \"" + XML_ATTRIBUTE_NAME + "\")", cu); - - xmlAttributeAnnotation.setName(null); - assertNull(xmlAttributeAnnotation.getName()); - - assertSourceContains("@XmlAttribute", cu); - assertSourceDoesNotContain("@XmlAttribute(name = \"" + XML_ATTRIBUTE_NAME + "\")", cu); - } - - public void testGetNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlAttributeWithNamespace(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE); - assertTrue(xmlAttributeAnnotation != null); - assertEquals(XML_ATTRIBUTE_NAMESPACE, xmlAttributeAnnotation.getNamespace()); - } - - public void testSetNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlAttribute(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE); - assertNull(xmlAttributeAnnotation.getNamespace()); - xmlAttributeAnnotation.setNamespace(XML_ATTRIBUTE_NAMESPACE); - assertEquals(XML_ATTRIBUTE_NAMESPACE, xmlAttributeAnnotation.getNamespace()); - - assertSourceContains("@XmlAttribute(namespace = \"" + XML_ATTRIBUTE_NAMESPACE + "\")", cu); - - xmlAttributeAnnotation.setNamespace(null); - assertNull(xmlAttributeAnnotation.getNamespace()); - - assertSourceContains("@XmlAttribute", cu); - assertSourceDoesNotContain("@XmlAttribute(namespace = \"" + XML_ATTRIBUTE_NAMESPACE + "\")", cu); - } - - public void testGetRequired() throws Exception { - ICompilationUnit cu = this.createTestXmlAttributeWithBooleanElement("required"); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE); - - assertEquals(Boolean.TRUE, xmlAttributeAnnotation.getRequired()); - } - - public void testSetRequired() throws Exception { - ICompilationUnit cu = this.createTestXmlAttribute(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - XmlAttributeAnnotation xmlAttributeAnnotation = (XmlAttributeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ATTRIBUTE); - - assertNotNull(xmlAttributeAnnotation); - assertNull(xmlAttributeAnnotation.getRequired()); - - xmlAttributeAnnotation.setRequired(Boolean.FALSE); - assertEquals(Boolean.FALSE, xmlAttributeAnnotation.getRequired()); - - assertSourceContains("@XmlAttribute(required = false)", cu); - - xmlAttributeAnnotation.setRequired(null); - assertSourceContains("@XmlAttribute", cu); - assertSourceDoesNotContain("required", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementAnnotationTests.java deleted file mode 100644 index 2706f40ea6..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementAnnotationTests.java +++ /dev/null @@ -1,283 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementAnnotation; - -@SuppressWarnings("nls") -public class XmlElementAnnotationTests extends JaxbJavaResourceModelTestCase { - - private static final String XML_ELEMENT_NAME = "elementName"; - private static final String XML_ELEMENT_NAMESPACE = "XmlElementNamespace"; - private static final String XML_ELEMENT_DEFAULT_VALUE = "myDefaultValue"; - private static final String XML_ELEMENT_TYPE = "String"; - - public XmlElementAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlElement() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ELEMENT); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlElement"); - } - }); - } - - private ICompilationUnit createTestXmlElementWithName() throws Exception { - return this.createTestXmlElementWithStringElement("name", XML_ELEMENT_NAME); - } - - private ICompilationUnit createTestXmlElementWithNamespace() throws Exception { - return this.createTestXmlElementWithStringElement("namespace", XML_ELEMENT_NAMESPACE); - } - - private ICompilationUnit createTestXmlElementWithDefaultValue() throws Exception { - return this.createTestXmlElementWithStringElement("defaultValue", XML_ELEMENT_DEFAULT_VALUE); - } - - private ICompilationUnit createTestXmlElementWithStringElement(final String element, final String value) throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ELEMENT); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlElement(" + element + " = \"" + value + "\")"); - } - }); - } - - private ICompilationUnit createTestXmlElementWithBooleanElement(final String booleanElement) throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ELEMENT); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlElement(" + booleanElement + " = true)"); - } - }); - } - - private ICompilationUnit createTestXmlElementWithType() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ELEMENT); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlElement(type = " + XML_ELEMENT_TYPE + ".class)"); - } - }); - } - - public void testGetName() throws Exception { - ICompilationUnit cu = this.createTestXmlElementWithName(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); - assertTrue(xmlElementAnnotation != null); - assertEquals(XML_ELEMENT_NAME, xmlElementAnnotation.getName()); - } - - public void testGetNull() throws Exception { - ICompilationUnit cu = this.createTestXmlElement(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); - assertTrue(xmlElementAnnotation != null); - assertNull(xmlElementAnnotation.getName()); - assertNull(xmlElementAnnotation.getNamespace()); - assertNull(xmlElementAnnotation.getDefaultValue()); - assertNull(xmlElementAnnotation.getNillable()); - assertNull(xmlElementAnnotation.getRequired()); - assertNull(xmlElementAnnotation.getType()); - } - - public void testSetName() throws Exception { - ICompilationUnit cu = this.createTestXmlElement(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); - assertNull(xmlElementAnnotation.getName()); - xmlElementAnnotation.setName(XML_ELEMENT_NAME); - assertEquals(XML_ELEMENT_NAME, xmlElementAnnotation.getName()); - - assertSourceContains("@XmlElement(name = \"" + XML_ELEMENT_NAME + "\")", cu); - - xmlElementAnnotation.setName(null); - assertNull(xmlElementAnnotation.getName()); - - assertSourceContains("@XmlElement", cu); - assertSourceDoesNotContain("@XmlElement(name = \"" + XML_ELEMENT_NAME + "\")", cu); - } - - public void testGetNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlElementWithNamespace(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); - assertTrue(xmlElementAnnotation != null); - assertEquals(XML_ELEMENT_NAMESPACE, xmlElementAnnotation.getNamespace()); - } - - public void testSetNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlElement(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); - assertNull(xmlElementAnnotation.getNamespace()); - xmlElementAnnotation.setNamespace(XML_ELEMENT_NAMESPACE); - assertEquals(XML_ELEMENT_NAMESPACE, xmlElementAnnotation.getNamespace()); - - assertSourceContains("@XmlElement(namespace = \"" + XML_ELEMENT_NAMESPACE + "\")", cu); - - xmlElementAnnotation.setNamespace(null); - assertNull(xmlElementAnnotation.getNamespace()); - - assertSourceContains("@XmlElement", cu); - assertSourceDoesNotContain("@XmlElement(namespace = \"" + XML_ELEMENT_NAMESPACE + "\")", cu); - } - - public void testGetDefaultValue() throws Exception { - ICompilationUnit cu = this.createTestXmlElementWithDefaultValue(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); - assertTrue(xmlElementAnnotation != null); - assertEquals(XML_ELEMENT_DEFAULT_VALUE, xmlElementAnnotation.getDefaultValue()); - } - - public void testSetDefaultValue() throws Exception { - ICompilationUnit cu = this.createTestXmlElement(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); - assertNull(xmlElementAnnotation.getDefaultValue()); - xmlElementAnnotation.setDefaultValue(XML_ELEMENT_DEFAULT_VALUE); - assertEquals(XML_ELEMENT_DEFAULT_VALUE, xmlElementAnnotation.getDefaultValue()); - - assertSourceContains("@XmlElement(defaultValue = \"" + XML_ELEMENT_DEFAULT_VALUE + "\")", cu); - - xmlElementAnnotation.setDefaultValue(null); - assertNull(xmlElementAnnotation.getDefaultValue()); - - assertSourceContains("@XmlElement", cu); - assertSourceDoesNotContain("@XmlElement(defaultValue = \"" + XML_ELEMENT_DEFAULT_VALUE + "\")", cu); - } - - public void testGetNillable() throws Exception { - ICompilationUnit cu = this.createTestXmlElementWithBooleanElement("nillable"); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); - - assertEquals(Boolean.TRUE, xmlElementAnnotation.getNillable()); - } - - public void testSetNillable() throws Exception { - ICompilationUnit cu = this.createTestXmlElement(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); - - assertNotNull(xmlElementAnnotation); - assertNull(xmlElementAnnotation.getNillable()); - - xmlElementAnnotation.setNillable(Boolean.FALSE); - assertEquals(Boolean.FALSE, xmlElementAnnotation.getNillable()); - - assertSourceContains("@XmlElement(nillable = false)", cu); - - xmlElementAnnotation.setNillable(null); - assertSourceContains("@XmlElement", cu); - assertSourceDoesNotContain("nillable", cu); - } - - public void testGetRequired() throws Exception { - ICompilationUnit cu = this.createTestXmlElementWithBooleanElement("required"); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); - - assertEquals(Boolean.TRUE, xmlElementAnnotation.getRequired()); - } - - public void testSetRequired() throws Exception { - ICompilationUnit cu = this.createTestXmlElement(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); - - assertNotNull(xmlElementAnnotation); - assertNull(xmlElementAnnotation.getRequired()); - - xmlElementAnnotation.setRequired(Boolean.FALSE); - assertEquals(Boolean.FALSE, xmlElementAnnotation.getRequired()); - - assertSourceContains("@XmlElement(required = false)", cu); - - xmlElementAnnotation.setRequired(null); - assertSourceContains("@XmlElement", cu); - assertSourceDoesNotContain("required", cu); - } - - public void testGetType() throws Exception { - ICompilationUnit cu = this.createTestXmlElementWithType(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); - assertTrue(xmlElementAnnotation != null); - assertEquals(XML_ELEMENT_TYPE, xmlElementAnnotation.getType()); - assertEquals("java.lang." + XML_ELEMENT_TYPE, xmlElementAnnotation.getFullyQualifiedTypeName()); - } - - public void testSetType() throws Exception { - ICompilationUnit cu = this.createTestXmlElement(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementAnnotation xmlElementAnnotation = (XmlElementAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT); - assertNull(xmlElementAnnotation.getType()); - xmlElementAnnotation.setType(XML_ELEMENT_TYPE); - assertEquals(XML_ELEMENT_TYPE, xmlElementAnnotation.getType()); - - assertSourceContains("@XmlElement(type = " + XML_ELEMENT_TYPE + ".class", cu); - - xmlElementAnnotation.setType(null); - assertNull(xmlElementAnnotation.getType()); - - assertSourceContains("@XmlElement", cu); - assertSourceDoesNotContain("@XmlElement(type = " + XML_ELEMENT_TYPE + ".class", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementDeclAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementDeclAnnotationTests.java deleted file mode 100644 index 2d610067b7..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementDeclAnnotationTests.java +++ /dev/null @@ -1,280 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementDeclAnnotation; - -@SuppressWarnings("nls") -public class XmlElementDeclAnnotationTests extends JaxbJavaResourceModelTestCase { - - private static final String XML_ELEMENT_DECL_NAME = "elementName"; - private static final String XML_ELEMENT_DECL_NAMESPACE = "XmlElementDeclNamespace"; - private static final String XML_ELEMENT_DECL_DEFAULT_VALUE = "myDefaultValue"; - private static final String XML_ELEMENT_DECL_SCOPE = "XmlElementDecl.GLOBAL"; - - public XmlElementDeclAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlElementDecl() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ELEMENT_DECL); - } - @Override - public void appendGetIdMethodAnnotationTo(StringBuilder sb) { - sb.append("@XmlElementDecl"); - } - }); - } - - private ICompilationUnit createTestXmlElementDeclWithName() throws Exception { - return this.createTestXmlElementDeclWithStringElementDecl("name", XML_ELEMENT_DECL_NAME); - } - - private ICompilationUnit createTestXmlElementDeclWithNamespace() throws Exception { - return this.createTestXmlElementDeclWithStringElementDecl("namespace", XML_ELEMENT_DECL_NAMESPACE); - } - - private ICompilationUnit createTestXmlElementDeclWithDefaultValue() throws Exception { - return this.createTestXmlElementDeclWithStringElementDecl("defaultValue", XML_ELEMENT_DECL_DEFAULT_VALUE); - } - - private ICompilationUnit createTestXmlElementDeclWithSubstitutionHeadName() throws Exception { - return this.createTestXmlElementDeclWithStringElementDecl("substitutionHeadName", XML_ELEMENT_DECL_NAME); - } - - private ICompilationUnit createTestXmlElementDeclWithSubstitutionHeadNamespace() throws Exception { - return this.createTestXmlElementDeclWithStringElementDecl("substitutionHeadNamespace", XML_ELEMENT_DECL_NAME); - } - - private ICompilationUnit createTestXmlElementDeclWithStringElementDecl(final String element, final String value) throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ELEMENT_DECL); - } - @Override - public void appendGetIdMethodAnnotationTo(StringBuilder sb) { - sb.append("@XmlElementDecl(" + element + " = \"" + value + "\")"); - } - }); - } - - private ICompilationUnit createTestXmlElementDeclWithScope() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ELEMENT_DECL); - } - @Override - public void appendGetIdMethodAnnotationTo(StringBuilder sb) { - sb.append("@XmlElementDecl(scope = " + XML_ELEMENT_DECL_SCOPE + ".class)"); - } - }); - } - - public void testGetName() throws Exception { - ICompilationUnit cu = this.createTestXmlElementDeclWithName(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceMethod resourceMethod = getMethod(resourceType, 0); - - XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); - assertTrue(xmlElementDeclAnnotation != null); - assertEquals(XML_ELEMENT_DECL_NAME, xmlElementDeclAnnotation.getName()); - } - - public void testGetNull() throws Exception { - ICompilationUnit cu = this.createTestXmlElementDecl(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceMethod resourceMethod = getMethod(resourceType, 0); - - XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); - assertTrue(xmlElementDeclAnnotation != null); - assertNull(xmlElementDeclAnnotation.getName()); - assertNull(xmlElementDeclAnnotation.getNamespace()); - assertNull(xmlElementDeclAnnotation.getDefaultValue()); - assertNull(xmlElementDeclAnnotation.getScope()); - assertNull(xmlElementDeclAnnotation.getSubstitutionHeadName()); - assertNull(xmlElementDeclAnnotation.getSubstitutionHeadNamespace()); - } - - public void testSetName() throws Exception { - ICompilationUnit cu = this.createTestXmlElementDecl(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceMethod resourceMethod = getMethod(resourceType, 0); - - XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); - assertNull(xmlElementDeclAnnotation.getName()); - xmlElementDeclAnnotation.setName(XML_ELEMENT_DECL_NAME); - assertEquals(XML_ELEMENT_DECL_NAME, xmlElementDeclAnnotation.getName()); - - assertSourceContains("@XmlElementDecl(name = \"" + XML_ELEMENT_DECL_NAME + "\")", cu); - - xmlElementDeclAnnotation.setName(null); - assertNull(xmlElementDeclAnnotation.getName()); - - assertSourceContains("@XmlElementDecl", cu); - assertSourceDoesNotContain("@XmlElementDecl(name = \"" + XML_ELEMENT_DECL_NAME + "\")", cu); - } - - public void testGetNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlElementDeclWithNamespace(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceMethod resourceMethod = getMethod(resourceType, 0); - - XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); - assertTrue(xmlElementDeclAnnotation != null); - assertEquals(XML_ELEMENT_DECL_NAMESPACE, xmlElementDeclAnnotation.getNamespace()); - } - - public void testSetNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlElementDecl(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceMethod resourceMethod = getMethod(resourceType, 0); - - XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); - assertNull(xmlElementDeclAnnotation.getNamespace()); - xmlElementDeclAnnotation.setNamespace(XML_ELEMENT_DECL_NAMESPACE); - assertEquals(XML_ELEMENT_DECL_NAMESPACE, xmlElementDeclAnnotation.getNamespace()); - - assertSourceContains("@XmlElementDecl(namespace = \"" + XML_ELEMENT_DECL_NAMESPACE + "\")", cu); - - xmlElementDeclAnnotation.setNamespace(null); - assertNull(xmlElementDeclAnnotation.getNamespace()); - - assertSourceContains("@XmlElementDecl", cu); - assertSourceDoesNotContain("@XmlElementDecl(namespace = \"" + XML_ELEMENT_DECL_NAMESPACE + "\")", cu); - } - - public void testGetDefaultValue() throws Exception { - ICompilationUnit cu = this.createTestXmlElementDeclWithDefaultValue(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceMethod resourceMethod = getMethod(resourceType, 0); - - XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); - assertTrue(xmlElementDeclAnnotation != null); - assertEquals(XML_ELEMENT_DECL_DEFAULT_VALUE, xmlElementDeclAnnotation.getDefaultValue()); - } - - public void testSetDefaultValue() throws Exception { - ICompilationUnit cu = this.createTestXmlElementDecl(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceMethod resourceMethod = getMethod(resourceType, 0); - - XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); - assertNull(xmlElementDeclAnnotation.getDefaultValue()); - xmlElementDeclAnnotation.setDefaultValue(XML_ELEMENT_DECL_DEFAULT_VALUE); - assertEquals(XML_ELEMENT_DECL_DEFAULT_VALUE, xmlElementDeclAnnotation.getDefaultValue()); - - assertSourceContains("@XmlElementDecl(defaultValue = \"" + XML_ELEMENT_DECL_DEFAULT_VALUE + "\")", cu); - - xmlElementDeclAnnotation.setDefaultValue(null); - assertNull(xmlElementDeclAnnotation.getDefaultValue()); - - assertSourceContains("@XmlElementDecl", cu); - assertSourceDoesNotContain("@XmlElementDecl(defaultValue = \"" + XML_ELEMENT_DECL_DEFAULT_VALUE + "\")", cu); - } - - public void testGetScope() throws Exception { - ICompilationUnit cu = this.createTestXmlElementDeclWithScope(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceMethod resourceMethod = getMethod(resourceType, 0); - - XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); - assertTrue(xmlElementDeclAnnotation != null); - assertEquals(XML_ELEMENT_DECL_SCOPE, xmlElementDeclAnnotation.getScope()); - assertEquals("javax.xml.bind.annotation." + XML_ELEMENT_DECL_SCOPE, xmlElementDeclAnnotation.getFullyQualifiedScopeClassName()); - } - - public void testSetScope() throws Exception { - ICompilationUnit cu = this.createTestXmlElementDecl(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceMethod resourceMethod = getMethod(resourceType, 0); - - XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); - assertNull(xmlElementDeclAnnotation.getScope()); - xmlElementDeclAnnotation.setScope(XML_ELEMENT_DECL_SCOPE); - assertEquals(XML_ELEMENT_DECL_SCOPE, xmlElementDeclAnnotation.getScope()); - - assertSourceContains("@XmlElementDecl(scope = " + XML_ELEMENT_DECL_SCOPE + ".class", cu); - - xmlElementDeclAnnotation.setScope(null); - assertNull(xmlElementDeclAnnotation.getScope()); - - assertSourceContains("@XmlElementDecl", cu); - assertSourceDoesNotContain("@XmlElementDecl(scope = " + XML_ELEMENT_DECL_SCOPE + ".class", cu); - } - - public void testGetSubstitutionHeadName() throws Exception { - ICompilationUnit cu = this.createTestXmlElementDeclWithSubstitutionHeadName(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceMethod resourceMethod = getMethod(resourceType, 0); - - XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); - assertTrue(xmlElementDeclAnnotation != null); - assertEquals(XML_ELEMENT_DECL_NAME, xmlElementDeclAnnotation.getSubstitutionHeadName()); - } - - public void testSetSubstitutionHeadName() throws Exception { - ICompilationUnit cu = this.createTestXmlElementDecl(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceMethod resourceMethod = getMethod(resourceType, 0); - - XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); - assertNull(xmlElementDeclAnnotation.getSubstitutionHeadName()); - xmlElementDeclAnnotation.setSubstitutionHeadName(XML_ELEMENT_DECL_NAME); - assertEquals(XML_ELEMENT_DECL_NAME, xmlElementDeclAnnotation.getSubstitutionHeadName()); - - assertSourceContains("@XmlElementDecl(substitutionHeadName = \"" + XML_ELEMENT_DECL_NAME + "\")", cu); - - xmlElementDeclAnnotation.setSubstitutionHeadName(null); - assertNull(xmlElementDeclAnnotation.getSubstitutionHeadName()); - - assertSourceContains("@XmlElementDecl", cu); - assertSourceDoesNotContain("@XmlElementDecl(substitutionHeadName = \"" + XML_ELEMENT_DECL_NAME + "\")", cu); - } - - public void testGetSubstitutionHeadNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlElementDeclWithSubstitutionHeadNamespace(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceMethod resourceMethod = getMethod(resourceType, 0); - - XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); - assertTrue(xmlElementDeclAnnotation != null); - assertEquals(XML_ELEMENT_DECL_NAME, xmlElementDeclAnnotation.getSubstitutionHeadNamespace()); - } - - public void testSetSubstitutionHeadNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlElementDecl(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceMethod resourceMethod = getMethod(resourceType, 0); - - XmlElementDeclAnnotation xmlElementDeclAnnotation = (XmlElementDeclAnnotation) resourceMethod.getAnnotation(JAXB.XML_ELEMENT_DECL); - assertNull(xmlElementDeclAnnotation.getSubstitutionHeadNamespace()); - xmlElementDeclAnnotation.setSubstitutionHeadNamespace(XML_ELEMENT_DECL_NAME); - assertEquals(XML_ELEMENT_DECL_NAME, xmlElementDeclAnnotation.getSubstitutionHeadNamespace()); - - assertSourceContains("@XmlElementDecl(substitutionHeadNamespace = \"" + XML_ELEMENT_DECL_NAME + "\")", cu); - - xmlElementDeclAnnotation.setSubstitutionHeadNamespace(null); - assertNull(xmlElementDeclAnnotation.getSubstitutionHeadNamespace()); - - assertSourceContains("@XmlElementDecl", cu); - assertSourceDoesNotContain("@XmlElementDecl(substitutionHeadNamespace = \"" + XML_ELEMENT_DECL_NAME + "\")", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementRefAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementRefAnnotationTests.java deleted file mode 100644 index c2908ebcd7..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementRefAnnotationTests.java +++ /dev/null @@ -1,191 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementRefAnnotation; - -@SuppressWarnings("nls") -public class XmlElementRefAnnotationTests extends JaxbJavaResourceModelTestCase { - - private static final String XML_ELEMENT_REF_NAME = "elementName"; - private static final String XML_ELEMENT_REF_NAMESPACE = "XmlElementRefNamespace"; - private static final String XML_ELEMENT_REF_TYPE = "String"; - - public XmlElementRefAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlElementRef() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ELEMENT_REF); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlElementRef"); - } - }); - } - - private ICompilationUnit createTestXmlElementRefWithName() throws Exception { - return this.createTestXmlElementRefWithStringElement("name", XML_ELEMENT_REF_NAME); - } - - private ICompilationUnit createTestXmlElementRefWithNamespace() throws Exception { - return this.createTestXmlElementRefWithStringElement("namespace", XML_ELEMENT_REF_NAMESPACE); - } - - private ICompilationUnit createTestXmlElementRefWithStringElement(final String element, final String value) throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ELEMENT_REF); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlElementRef(" + element + " = \"" + value + "\")"); - } - }); - } - - private ICompilationUnit createTestXmlElementRefWithType() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ELEMENT_REF); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlElementRef(type = " + XML_ELEMENT_REF_TYPE + ".class)"); - } - }); - } - - public void testGetName() throws Exception { - ICompilationUnit cu = this.createTestXmlElementRefWithName(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_ELEMENT_REF); - assertTrue(xmlElementRefAnnotation != null); - assertEquals(XML_ELEMENT_REF_NAME, xmlElementRefAnnotation.getName()); - } - - public void testGetNull() throws Exception { - ICompilationUnit cu = this.createTestXmlElementRef(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_ELEMENT_REF); - assertTrue(xmlElementRefAnnotation != null); - assertNull(xmlElementRefAnnotation.getName()); - assertNull(xmlElementRefAnnotation.getNamespace()); - assertNull(xmlElementRefAnnotation.getType()); - } - - public void testSetName() throws Exception { - ICompilationUnit cu = this.createTestXmlElementRef(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_ELEMENT_REF); - assertNull(xmlElementRefAnnotation.getName()); - xmlElementRefAnnotation.setName(XML_ELEMENT_REF_NAME); - assertEquals(XML_ELEMENT_REF_NAME, xmlElementRefAnnotation.getName()); - - assertSourceContains("@XmlElementRef(name = \"" + XML_ELEMENT_REF_NAME + "\")", cu); - - xmlElementRefAnnotation.setName(null); - assertNull(xmlElementRefAnnotation.getName()); - - assertSourceContains("@XmlElementRef", cu); - assertSourceDoesNotContain("@XmlElementRef(name = \"" + XML_ELEMENT_REF_NAME + "\")", cu); - } - - public void testGetNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlElementRefWithNamespace(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_ELEMENT_REF); - assertTrue(xmlElementRefAnnotation != null); - assertEquals(XML_ELEMENT_REF_NAMESPACE, xmlElementRefAnnotation.getNamespace()); - } - - public void testSetNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlElementRef(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_ELEMENT_REF); - assertNull(xmlElementRefAnnotation.getNamespace()); - xmlElementRefAnnotation.setNamespace(XML_ELEMENT_REF_NAMESPACE); - assertEquals(XML_ELEMENT_REF_NAMESPACE, xmlElementRefAnnotation.getNamespace()); - - assertSourceContains("@XmlElementRef(namespace = \"" + XML_ELEMENT_REF_NAMESPACE + "\")", cu); - - xmlElementRefAnnotation.setNamespace(null); - assertNull(xmlElementRefAnnotation.getNamespace()); - - assertSourceContains("@XmlElementRef", cu); - assertSourceDoesNotContain("@XmlElementRef(namespace = \"" + XML_ELEMENT_REF_NAMESPACE + "\")", cu); - } - - public void testGetType() throws Exception { - ICompilationUnit cu = this.createTestXmlElementRefWithType(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_ELEMENT_REF); - assertTrue(xmlElementRefAnnotation != null); - assertEquals(XML_ELEMENT_REF_TYPE, xmlElementRefAnnotation.getType()); - assertEquals("java.lang." + XML_ELEMENT_REF_TYPE, xmlElementRefAnnotation.getFullyQualifiedTypeName()); - } - - public void testSetType() throws Exception { - ICompilationUnit cu = this.createTestXmlElementRef(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_ELEMENT_REF); - assertNull(xmlElementRefAnnotation.getType()); - xmlElementRefAnnotation.setType(XML_ELEMENT_REF_TYPE); - assertEquals(XML_ELEMENT_REF_TYPE, xmlElementRefAnnotation.getType()); - - assertSourceContains("@XmlElementRef(type = " + XML_ELEMENT_REF_TYPE + ".class", cu); - - xmlElementRefAnnotation.setType(null); - assertNull(xmlElementRefAnnotation.getType()); - - assertSourceContains("@XmlElementRef", cu); - assertSourceDoesNotContain("@XmlElementRef(type = " + XML_ELEMENT_REF_TYPE + ".class", cu); - } - - public void testAddXmlElementRefAnnotation() throws Exception { - ICompilationUnit cu = this.createTestXmlElementRefWithName(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementRefAnnotation xmlElementRefAnnotation = (XmlElementRefAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_ELEMENT_REF); - assertTrue(xmlElementRefAnnotation != null); - assertEquals(XML_ELEMENT_REF_NAME, xmlElementRefAnnotation.getName()); - - XmlElementRefAnnotation xmlElementRefAnnotation2 = (XmlElementRefAnnotation) resourceAttribute.addAnnotation(1, JAXB.XML_ELEMENT_REF); - xmlElementRefAnnotation2.setName("Foo"); - assertSourceContains("@XmlElementRefs({ @XmlElementRef(name = \"" + XML_ELEMENT_REF_NAME + "\"), @XmlElementRef(name = \"Foo\") })", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementWrapperAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementWrapperAnnotationTests.java deleted file mode 100644 index 4a4f2ffd8f..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlElementWrapperAnnotationTests.java +++ /dev/null @@ -1,203 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlElementWrapperAnnotation; - -@SuppressWarnings("nls") -public class XmlElementWrapperAnnotationTests extends JaxbJavaResourceModelTestCase { - - private static final String XML_ELEMENT_WRAPPER_NAME = "elementName"; - private static final String XML_ELEMENT_WRAPPER_NAMESPACE = "XmlElementWrapperNamespace"; - - public XmlElementWrapperAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlElementWrapper() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ELEMENT_WRAPPER); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlElementWrapper"); - } - }); - } - - private ICompilationUnit createTestXmlElementWrapperWithName() throws Exception { - return this.createTestXmlElementWrapperWithStringElement("name", XML_ELEMENT_WRAPPER_NAME); - } - - private ICompilationUnit createTestXmlElementWrapperWithNamespace() throws Exception { - return this.createTestXmlElementWrapperWithStringElement("namespace", XML_ELEMENT_WRAPPER_NAMESPACE); - } - - private ICompilationUnit createTestXmlElementWrapperWithStringElement(final String element, final String value) throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ELEMENT_WRAPPER); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlElementWrapper(" + element + " = \"" + value + "\")"); - } - }); - } - - private ICompilationUnit createTestXmlElementWrapperWithBooleanElement(final String booleanElement) throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ELEMENT_WRAPPER); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlElementWrapper(" + booleanElement + " = true)"); - } - }); - } - - public void testGetName() throws Exception { - ICompilationUnit cu = this.createTestXmlElementWrapperWithName(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER); - assertTrue(xmlElementWrapperAnnotation != null); - assertEquals(XML_ELEMENT_WRAPPER_NAME, xmlElementWrapperAnnotation.getName()); - } - - public void testGetNull() throws Exception { - ICompilationUnit cu = this.createTestXmlElementWrapper(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER); - assertTrue(xmlElementWrapperAnnotation != null); - assertNull(xmlElementWrapperAnnotation.getName()); - assertNull(xmlElementWrapperAnnotation.getNamespace()); - assertNull(xmlElementWrapperAnnotation.getNillable()); - assertNull(xmlElementWrapperAnnotation.getRequired()); - } - - public void testSetName() throws Exception { - ICompilationUnit cu = this.createTestXmlElementWrapper(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER); - assertNull(xmlElementWrapperAnnotation.getName()); - xmlElementWrapperAnnotation.setName(XML_ELEMENT_WRAPPER_NAME); - assertEquals(XML_ELEMENT_WRAPPER_NAME, xmlElementWrapperAnnotation.getName()); - - assertSourceContains("@XmlElementWrapper(name = \"" + XML_ELEMENT_WRAPPER_NAME + "\")", cu); - - xmlElementWrapperAnnotation.setName(null); - assertNull(xmlElementWrapperAnnotation.getName()); - - assertSourceContains("@XmlElementWrapper", cu); - assertSourceDoesNotContain("@XmlElementWrapper(name = \"" + XML_ELEMENT_WRAPPER_NAME + "\")", cu); - } - - public void testGetNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlElementWrapperWithNamespace(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER); - assertTrue(xmlElementWrapperAnnotation != null); - assertEquals(XML_ELEMENT_WRAPPER_NAMESPACE, xmlElementWrapperAnnotation.getNamespace()); - } - - public void testSetNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlElementWrapper(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER); - assertNull(xmlElementWrapperAnnotation.getNamespace()); - xmlElementWrapperAnnotation.setNamespace(XML_ELEMENT_WRAPPER_NAMESPACE); - assertEquals(XML_ELEMENT_WRAPPER_NAMESPACE, xmlElementWrapperAnnotation.getNamespace()); - - assertSourceContains("@XmlElementWrapper(namespace = \"" + XML_ELEMENT_WRAPPER_NAMESPACE + "\")", cu); - - xmlElementWrapperAnnotation.setNamespace(null); - assertNull(xmlElementWrapperAnnotation.getNamespace()); - - assertSourceContains("@XmlElementWrapper", cu); - assertSourceDoesNotContain("@XmlElementWrapper(namespace = \"" + XML_ELEMENT_WRAPPER_NAMESPACE + "\")", cu); - } - - public void testGetNillable() throws Exception { - ICompilationUnit cu = this.createTestXmlElementWrapperWithBooleanElement("nillable"); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER); - - assertEquals(Boolean.TRUE, xmlElementWrapperAnnotation.getNillable()); - } - - public void testSetNillable() throws Exception { - ICompilationUnit cu = this.createTestXmlElementWrapper(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER); - - assertNotNull(xmlElementWrapperAnnotation); - assertNull(xmlElementWrapperAnnotation.getNillable()); - - xmlElementWrapperAnnotation.setNillable(Boolean.FALSE); - assertEquals(Boolean.FALSE, xmlElementWrapperAnnotation.getNillable()); - - assertSourceContains("@XmlElementWrapper(nillable = false)", cu); - - xmlElementWrapperAnnotation.setNillable(null); - assertSourceContains("@XmlElementWrapper", cu); - assertSourceDoesNotContain("nillable", cu); - } - - public void testGetRequired() throws Exception { - ICompilationUnit cu = this.createTestXmlElementWrapperWithBooleanElement("required"); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER); - - assertEquals(Boolean.TRUE, xmlElementWrapperAnnotation.getRequired()); - } - - public void testSetRequired() throws Exception { - ICompilationUnit cu = this.createTestXmlElementWrapper(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - XmlElementWrapperAnnotation xmlElementWrapperAnnotation = (XmlElementWrapperAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ELEMENT_WRAPPER); - - assertNotNull(xmlElementWrapperAnnotation); - assertNull(xmlElementWrapperAnnotation.getRequired()); - - xmlElementWrapperAnnotation.setRequired(Boolean.FALSE); - assertEquals(Boolean.FALSE, xmlElementWrapperAnnotation.getRequired()); - - assertSourceContains("@XmlElementWrapper(required = false)", cu); - - xmlElementWrapperAnnotation.setRequired(null); - assertSourceContains("@XmlElementWrapper", cu); - assertSourceDoesNotContain("required", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumAnnotationTests.java deleted file mode 100644 index ff163dcb51..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumAnnotationTests.java +++ /dev/null @@ -1,89 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumAnnotation; - -@SuppressWarnings("nls") -public class XmlEnumAnnotationTests extends JaxbJavaResourceModelTestCase { - - private static final String XML_ENUM_JAVA_TYPE = "String"; - - public XmlEnumAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlEnum() throws Exception { - return this.createTestEnum(new DefaultEnumAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ENUM); - } - @Override - public void appendEnumAnnotationTo(StringBuilder sb) { - sb.append("@XmlEnum"); - } - }); - } - - private ICompilationUnit createTestXmlEnumWithValue() throws Exception { - return this.createTestEnum(new DefaultEnumAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ENUM); - } - @Override - public void appendEnumAnnotationTo(StringBuilder sb) { - sb.append("@XmlEnum(value = " + XML_ENUM_JAVA_TYPE + ".class)"); - } - }); - } - - public void testGetNull() throws Exception { - ICompilationUnit cu = this.createTestXmlEnum(); - JavaResourceEnum resourceEnum = this.buildJavaResourceEnum(cu); - - XmlEnumAnnotation xmlEnumAnnotation = (XmlEnumAnnotation) resourceEnum.getAnnotation(JAXB.XML_ENUM); - assertTrue(xmlEnumAnnotation != null); - assertNull(xmlEnumAnnotation.getValue()); - } - - public void testGetValue() throws Exception { - ICompilationUnit cu = this.createTestXmlEnumWithValue(); - JavaResourceEnum resourceEnum = this.buildJavaResourceEnum(cu); - - XmlEnumAnnotation xmlEnumAnnotation = (XmlEnumAnnotation) resourceEnum.getAnnotation(JAXB.XML_ENUM); - assertTrue(xmlEnumAnnotation != null); - assertEquals(XML_ENUM_JAVA_TYPE, xmlEnumAnnotation.getValue()); - assertEquals("java.lang." + XML_ENUM_JAVA_TYPE, xmlEnumAnnotation.getFullyQualifiedValueClassName()); - } - - public void testSetValue() throws Exception { - ICompilationUnit cu = this.createTestXmlEnum(); - JavaResourceEnum resourceEnum = this.buildJavaResourceEnum(cu); - - XmlEnumAnnotation xmlEnumAnnotation = (XmlEnumAnnotation) resourceEnum.getAnnotation(JAXB.XML_ENUM); - assertNull(xmlEnumAnnotation.getValue()); - xmlEnumAnnotation.setValue(XML_ENUM_JAVA_TYPE); - assertEquals(XML_ENUM_JAVA_TYPE, xmlEnumAnnotation.getValue()); - - assertSourceContains("@XmlEnum(" + XML_ENUM_JAVA_TYPE + ".class)", cu); - - xmlEnumAnnotation.setValue(null); - assertNull(xmlEnumAnnotation.getValue()); - - assertSourceContains("@XmlEnum", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumValueAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumValueAnnotationTests.java deleted file mode 100644 index ffe94b4a7f..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlEnumValueAnnotationTests.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnum; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceEnumConstant; -import org.eclipse.jpt.jaxb.core.resource.java.XmlEnumValueAnnotation; - -@SuppressWarnings("nls") -public class XmlEnumValueAnnotationTests extends JaxbJavaResourceModelTestCase { - - private static final String XML_ENUM_VALUE_VALUE = "myEnumValue"; - - public XmlEnumValueAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlEnumValue() throws Exception { - return this.createTestEnum(new DefaultEnumAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ENUM_VALUE); - } - @Override - public void appendSundayEnumConstantAnnotationTo(StringBuilder sb) { - sb.append("@XmlEnumValue"); - } - }); - } - - private ICompilationUnit createTestXmlEnumValueWithValue() throws Exception { - return this.createTestXmlEnumValueWithStringElement("value", XML_ENUM_VALUE_VALUE); - } - - private ICompilationUnit createTestXmlEnumValueWithStringElement(final String element, final String value) throws Exception { - return this.createTestEnum(new DefaultEnumAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ENUM_VALUE); - } - @Override - public void appendSundayEnumConstantAnnotationTo(StringBuilder sb) { - sb.append("@XmlEnumValue(" + element + " = \"" + value + "\")"); - } - }); - } - - public void testGetXmlEnumValue() throws Exception { - ICompilationUnit cu = this.createTestXmlEnumValue(); - JavaResourceEnum resourceEnum = buildJavaResourceEnum(cu); - JavaResourceEnumConstant enumConstant = getEnumConstant(resourceEnum, 0); - - XmlEnumValueAnnotation xmlEnumValueAnnotation = (XmlEnumValueAnnotation) enumConstant.getAnnotation(JAXB.XML_ENUM_VALUE); - assertTrue(xmlEnumValueAnnotation != null); - - enumConstant.removeAnnotation(JAXB.XML_ENUM_VALUE); - assertSourceDoesNotContain("@XmlEnumValue", cu); - } - - - public void testGetValue() throws Exception { - ICompilationUnit cu = this.createTestXmlEnumValueWithValue(); - JavaResourceEnum resourceEnum = buildJavaResourceEnum(cu); - JavaResourceEnumConstant enumConstant = getEnumConstant(resourceEnum, 0); - - XmlEnumValueAnnotation xmlEnumValueAnnotation = (XmlEnumValueAnnotation) enumConstant.getAnnotation(JAXB.XML_ENUM_VALUE); - assertTrue(xmlEnumValueAnnotation != null); - assertEquals(XML_ENUM_VALUE_VALUE, xmlEnumValueAnnotation.getValue()); - } - - public void testGetNull() throws Exception { - ICompilationUnit cu = this.createTestXmlEnumValue(); - JavaResourceEnum resourceEnum = buildJavaResourceEnum(cu); - JavaResourceEnumConstant enumConstant = getEnumConstant(resourceEnum, 0); - - XmlEnumValueAnnotation xmlEnumValueAnnotation = (XmlEnumValueAnnotation) enumConstant.getAnnotation(JAXB.XML_ENUM_VALUE); - assertTrue(xmlEnumValueAnnotation != null); - assertNull(xmlEnumValueAnnotation.getValue()); - } - - public void testSetValue() throws Exception { - ICompilationUnit cu = this.createTestXmlEnumValue(); - JavaResourceEnum resourceEnum = buildJavaResourceEnum(cu); - JavaResourceEnumConstant enumConstant = getEnumConstant(resourceEnum, 0); - - XmlEnumValueAnnotation xmlEnumValueAnnotation = (XmlEnumValueAnnotation) enumConstant.getAnnotation(JAXB.XML_ENUM_VALUE); - assertNull(xmlEnumValueAnnotation.getValue()); - xmlEnumValueAnnotation.setValue(XML_ENUM_VALUE_VALUE); - assertEquals(XML_ENUM_VALUE_VALUE, xmlEnumValueAnnotation.getValue()); - - assertSourceContains("@XmlEnumValue(\"" + XML_ENUM_VALUE_VALUE + "\")", cu); - - xmlEnumValueAnnotation.setValue(null); - assertNull(xmlEnumValueAnnotation.getValue()); - - assertSourceDoesNotContain("@XmlEnumValue(", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDAnnotationTests.java deleted file mode 100644 index 2ee14ec9db..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDAnnotationTests.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDAnnotation; - -@SuppressWarnings("nls") -public class XmlIDAnnotationTests extends JaxbJavaResourceModelTestCase { - - public XmlIDAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlID() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ID); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlID"); - } - }); - } - - public void testGetXmlID() throws Exception { - ICompilationUnit cu = this.createTestXmlID(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlIDAnnotation xmlIDAnnotation = (XmlIDAnnotation) resourceAttribute.getAnnotation(JAXB.XML_ID); - assertTrue(xmlIDAnnotation != null); - - resourceAttribute.removeAnnotation(JAXB.XML_ID); - assertSourceDoesNotContain("@XmlID", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDREFAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDREFAnnotationTests.java deleted file mode 100644 index c3cfcb601d..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlIDREFAnnotationTests.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlIDREFAnnotation; - -@SuppressWarnings("nls") -public class XmlIDREFAnnotationTests extends JaxbJavaResourceModelTestCase { - - public XmlIDREFAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlIDREF() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_IDREF); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlIDREF"); - } - }); - } - - public void testGetXmlIDREF() throws Exception { - ICompilationUnit cu = this.createTestXmlIDREF(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlIDREFAnnotation xmlIDREFAnnotation = (XmlIDREFAnnotation) resourceAttribute.getAnnotation(JAXB.XML_IDREF); - assertTrue(xmlIDREFAnnotation != null); - - resourceAttribute.removeAnnotation(JAXB.XML_IDREF); - assertSourceDoesNotContain("@XmlIDREF", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlInlineBinaryDataAttributeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlInlineBinaryDataAttributeAnnotationTests.java deleted file mode 100644 index 0ddf3fb5bf..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlInlineBinaryDataAttributeAnnotationTests.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlInlineBinaryDataAnnotation; - -@SuppressWarnings("nls") -public class XmlInlineBinaryDataAttributeAnnotationTests extends JaxbJavaResourceModelTestCase { - - public XmlInlineBinaryDataAttributeAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlInlineBinaryData() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_INLINE_BINARY_DATA); - } - @Override - public void appendGetIdMethodAnnotationTo(StringBuilder sb) { - sb.append("@XmlInlineBinaryData"); - } - }); - } - - public void testGetXmlInlineBinaryData() throws Exception { - ICompilationUnit cu = this.createTestXmlInlineBinaryData(); - JavaResourceType resourceType = this.buildJavaResourceType(cu); - JavaResourceMethod resourceMethod = this.getMethod(resourceType, 0); - - XmlInlineBinaryDataAnnotation xmlInlineBinaryDataAnnotation = (XmlInlineBinaryDataAnnotation) resourceMethod.getAnnotation(JAXB.XML_INLINE_BINARY_DATA); - assertTrue(xmlInlineBinaryDataAnnotation != null); - - resourceMethod.removeAnnotation(JAXB.XML_INLINE_BINARY_DATA); - assertSourceDoesNotContain("@XmlInlineBinaryData", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlInlineBinaryDataTypeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlInlineBinaryDataTypeAnnotationTests.java deleted file mode 100644 index 98c91c4bb4..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlInlineBinaryDataTypeAnnotationTests.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlInlineBinaryDataAnnotation; - -@SuppressWarnings("nls") -public class XmlInlineBinaryDataTypeAnnotationTests extends JaxbJavaResourceModelTestCase { - - public XmlInlineBinaryDataTypeAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlInlineBinaryData() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_INLINE_BINARY_DATA); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlInlineBinaryData"); - } - }); - } - - public void testGetXmlInlineBinaryData() throws Exception { - ICompilationUnit cu = this.createTestXmlInlineBinaryData(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlInlineBinaryDataAnnotation xmlInlineBinaryDataAnnotation = (XmlInlineBinaryDataAnnotation) resourceType.getAnnotation(JAXB.XML_INLINE_BINARY_DATA); - assertTrue(xmlInlineBinaryDataAnnotation != null); - - resourceType.removeAnnotation(JAXB.XML_INLINE_BINARY_DATA); - assertSourceDoesNotContain("@XmlInlineBinaryData", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlJavaTypeAdapterPackageAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlJavaTypeAdapterPackageAnnotationTests.java deleted file mode 100644 index 23f625f65c..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlJavaTypeAdapterPackageAnnotationTests.java +++ /dev/null @@ -1,267 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; - -@SuppressWarnings("nls") -public class XmlJavaTypeAdapterPackageAnnotationTests - extends JaxbJavaResourceModelTestCase { - - private static final String TEST_CLASS = "TestClass"; - private static final String TEST_CLASS_2 = "TestClass2"; - private static final String FQ_TEST_CLASS = PACKAGE_NAME + "." + TEST_CLASS; - private static final String FQ_TEST_CLASS_2 = PACKAGE_NAME + "." + TEST_CLASS_2; - - - public XmlJavaTypeAdapterPackageAnnotationTests(String name) { - super(name); - } - - - private void createTestClass() throws CoreException { - SourceWriter sourceWriter = new SourceWriter() { - public void appendSourceTo(StringBuilder sb) { - sb.append(CR); - sb.append("public class ").append(TEST_CLASS).append(" "); - sb.append("{}").append(CR); - } - }; - this.javaProject.createCompilationUnit(PACKAGE_NAME, TEST_CLASS + ".java", sourceWriter); - } - - private void createTestClass2() throws CoreException { - SourceWriter sourceWriter = new SourceWriter() { - public void appendSourceTo(StringBuilder sb) { - sb.append(CR); - sb.append("public class ").append(TEST_CLASS_2).append(" "); - sb.append("{}").append(CR); - } - }; - this.javaProject.createCompilationUnit(PACKAGE_NAME, TEST_CLASS_2 + ".java", sourceWriter); - } - - private ICompilationUnit createPackageInfoWithJavaTypeAdapter() throws CoreException { - return createTestPackageInfo( - "@XmlJavaTypeAdapter", - JAXB.XML_JAVA_TYPE_ADAPTER); - } - - private ICompilationUnit createPackageInfoWithJavaTypeAdapterAndValue() throws CoreException { - createTestClass(); - return createTestPackageInfo( - "@XmlJavaTypeAdapter(" + TEST_CLASS + ".class)", - JAXB.XML_JAVA_TYPE_ADAPTER, FQ_TEST_CLASS); - } - - private ICompilationUnit createPackageInfoWithJavaTypeAdapterAndType() throws CoreException { - createTestClass(); - return createTestPackageInfo( - "@XmlJavaTypeAdapter(type = " + TEST_CLASS + ".class)", - JAXB.XML_JAVA_TYPE_ADAPTER, FQ_TEST_CLASS); - } - - private ICompilationUnit createPackageInfoWithJavaTypeAdapters() throws CoreException { - return createTestPackageInfo( - "@XmlJavaTypeAdapters({@XmlJavaTypeAdapter,@XmlJavaTypeAdapter})", - JAXB.XML_JAVA_TYPE_ADAPTERS, JAXB.XML_JAVA_TYPE_ADAPTER); - } - - public void testValue() - throws Exception { - - ICompilationUnit cu = createPackageInfoWithJavaTypeAdapterAndValue(); - JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu); - createTestClass2(); - - XmlJavaTypeAdapterAnnotation annotation = - (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); - assertTrue(annotation != null); - assertEquals(TEST_CLASS, annotation.getValue()); - assertEquals(FQ_TEST_CLASS, annotation.getFullyQualifiedValue()); - assertSourceContains("@XmlJavaTypeAdapter(" + TEST_CLASS + ".class)", cu); - - annotation.setValue(TEST_CLASS_2); - assertEquals(TEST_CLASS_2, annotation.getValue()); - assertEquals(FQ_TEST_CLASS_2, annotation.getFullyQualifiedValue()); - assertSourceContains("@XmlJavaTypeAdapter(" + TEST_CLASS_2 + ".class)", cu); - - annotation.setValue(null); - assertEquals(null, annotation.getValue()); - assertEquals(null, annotation.getFullyQualifiedValue()); - assertSourceContains("@XmlJavaTypeAdapter", cu); - - annotation.setValue(TEST_CLASS); - assertEquals(TEST_CLASS, annotation.getValue()); - assertEquals(FQ_TEST_CLASS, annotation.getFullyQualifiedValue()); - assertSourceContains("@XmlJavaTypeAdapter(" + TEST_CLASS + ".class)", cu); - } - - public void testType() - throws Exception { - - ICompilationUnit cu = createPackageInfoWithJavaTypeAdapterAndType(); - JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu); - createTestClass2(); - - XmlJavaTypeAdapterAnnotation annotation = - (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); - assertTrue(annotation != null); - assertEquals(TEST_CLASS, annotation.getType()); - assertEquals(FQ_TEST_CLASS, annotation.getFullyQualifiedType()); - assertSourceContains("@XmlJavaTypeAdapter(type = " + TEST_CLASS + ".class)", cu); - - annotation.setType(TEST_CLASS_2); - assertEquals(TEST_CLASS_2, annotation.getType()); - assertEquals(FQ_TEST_CLASS_2, annotation.getFullyQualifiedType()); - assertSourceContains("@XmlJavaTypeAdapter(type = " + TEST_CLASS_2 + ".class)", cu); - - annotation.setType(null); - assertEquals(null, annotation.getType()); - assertEquals(null, annotation.getFullyQualifiedType()); - assertSourceContains("@XmlJavaTypeAdapter", cu); - - annotation.setType(TEST_CLASS); - assertEquals(TEST_CLASS, annotation.getType()); - assertEquals(FQ_TEST_CLASS, annotation.getFullyQualifiedType()); - assertSourceContains("@XmlJavaTypeAdapter(type = " + TEST_CLASS + ".class)", cu); - } - - public void testTypeWithValue() - throws Exception { - - ICompilationUnit cu = createPackageInfoWithJavaTypeAdapterAndValue(); - JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu); - createTestClass2(); - - XmlJavaTypeAdapterAnnotation annotation = - (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); - assertTrue(annotation != null); - assertEquals(TEST_CLASS, annotation.getValue()); - assertSourceContains("@XmlJavaTypeAdapter(" + TEST_CLASS + ".class)", cu); - - annotation.setType(TEST_CLASS_2); - assertEquals(TEST_CLASS, annotation.getValue()); - assertEquals(TEST_CLASS_2, annotation.getType()); - assertSourceContains("@XmlJavaTypeAdapter(value = " + TEST_CLASS + ".class, type = " + TEST_CLASS_2 + ".class)", cu); - - annotation.setValue(null); - assertEquals(null, annotation.getValue()); - assertEquals(TEST_CLASS_2, annotation.getType()); - assertSourceContains("@XmlJavaTypeAdapter(type = " + TEST_CLASS_2 + ".class)", cu); - - annotation.setValue(TEST_CLASS); - assertEquals(TEST_CLASS, annotation.getValue()); - assertEquals(TEST_CLASS_2, annotation.getType()); - assertSourceContains("@XmlJavaTypeAdapter(type = " + TEST_CLASS_2 + ".class, value = " + TEST_CLASS + ".class)", cu); - - annotation.setType(null); - assertEquals(TEST_CLASS, annotation.getValue()); - assertEquals(null, annotation.getType()); - assertSourceContains("@XmlJavaTypeAdapter(" + TEST_CLASS + ".class)", cu); - } - - public void testContainedWithValue() - throws Exception { - // test contained annotation value setting/updating - - ICompilationUnit cu = createPackageInfoWithJavaTypeAdapters(); - JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu); - createTestClass(); - - XmlJavaTypeAdapterAnnotation adapterAnnotation = - (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); - - adapterAnnotation.setValue(TEST_CLASS); - assertEquals(TEST_CLASS, adapterAnnotation.getValue()); - assertEquals(FQ_TEST_CLASS, adapterAnnotation.getFullyQualifiedValue()); - assertSourceContains( - "@XmlJavaTypeAdapters({@XmlJavaTypeAdapter(" + TEST_CLASS + ".class),@XmlJavaTypeAdapter})", cu); - - adapterAnnotation.setValue(null); - assertNull(adapterAnnotation.getValue()); - assertNull(FQ_TEST_CLASS, adapterAnnotation.getFullyQualifiedValue()); - assertSourceContains( - "@XmlJavaTypeAdapters({@XmlJavaTypeAdapter,@XmlJavaTypeAdapter})", cu); - } - - public void testContainedWithType() - throws Exception { - // test contained annotation type setting/updating - - ICompilationUnit cu = createPackageInfoWithJavaTypeAdapters(); - JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu); - createTestClass(); - - XmlJavaTypeAdapterAnnotation adapterAnnotation = - (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(1, JAXB.XML_JAVA_TYPE_ADAPTER); - - adapterAnnotation.setType(TEST_CLASS); - assertEquals(TEST_CLASS, adapterAnnotation.getType()); - assertEquals(FQ_TEST_CLASS, adapterAnnotation.getFullyQualifiedType()); - assertSourceContains( - "@XmlJavaTypeAdapters({@XmlJavaTypeAdapter,@XmlJavaTypeAdapter(type = " + TEST_CLASS + ".class)})", cu); - - resourcePackage.moveAnnotation(0, 1, JAXB.XML_JAVA_TYPE_ADAPTER); - adapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); - assertEquals(TEST_CLASS, adapterAnnotation.getType()); - assertEquals(FQ_TEST_CLASS, adapterAnnotation.getFullyQualifiedType()); - assertSourceContains( - "@XmlJavaTypeAdapters({@XmlJavaTypeAdapter(type = " + TEST_CLASS + ".class),@XmlJavaTypeAdapter})", cu); - - adapterAnnotation.setType(null); - assertNull(adapterAnnotation.getType()); - assertNull(FQ_TEST_CLASS, adapterAnnotation.getFullyQualifiedType()); - assertSourceContains( - "@XmlJavaTypeAdapters({@XmlJavaTypeAdapter,@XmlJavaTypeAdapter})", cu); - } - - public void testContained() - throws Exception { - // test adding/removing/moving - - ICompilationUnit cu = createPackageInfoWithJavaTypeAdapter(); - JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu); - createTestClass(); - createTestClass2(); - - assertEquals(1, resourcePackage.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER)); - - resourcePackage.addAnnotation(1, JAXB.XML_JAVA_TYPE_ADAPTER); - assertEquals(2, resourcePackage.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER)); - assertSourceContains("@XmlJavaTypeAdapters({ @XmlJavaTypeAdapter, @XmlJavaTypeAdapter })", cu); - - XmlJavaTypeAdapterAnnotation adapterAnnotation1 = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); - adapterAnnotation1.setValue(TEST_CLASS); - XmlJavaTypeAdapterAnnotation adapterAnnotation2 = (XmlJavaTypeAdapterAnnotation) resourcePackage.getAnnotation(1, JAXB.XML_JAVA_TYPE_ADAPTER); - adapterAnnotation2.setValue(TEST_CLASS_2); - assertSourceContains( - "@XmlJavaTypeAdapters({ @XmlJavaTypeAdapter(" + TEST_CLASS - + ".class), @XmlJavaTypeAdapter(" + TEST_CLASS_2 - + ".class) })", cu); - - resourcePackage.moveAnnotation(0, 1, JAXB.XML_JAVA_TYPE_ADAPTER); - assertSourceContains( - "@XmlJavaTypeAdapters({ @XmlJavaTypeAdapter(" + TEST_CLASS_2 - + ".class), @XmlJavaTypeAdapter(" + TEST_CLASS - + ".class) })", cu); - - resourcePackage.removeAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); - assertEquals(1, resourcePackage.getAnnotationsSize(JAXB.XML_JAVA_TYPE_ADAPTER)); - assertSourceContains( - "@XmlJavaTypeAdapter(" + TEST_CLASS + ".class)", cu); - assertSourceDoesNotContain("@XmlJavaTypeAdapters", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlJavaTypeAdapterTypeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlJavaTypeAdapterTypeAnnotationTests.java deleted file mode 100644 index 63c3d1b3b1..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlJavaTypeAdapterTypeAnnotationTests.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlJavaTypeAdapterAnnotation; - -@SuppressWarnings("nls") -public class XmlJavaTypeAdapterTypeAnnotationTests extends JaxbJavaResourceModelTestCase { - - private static final String XML_JAVA_TYPE_ADAPTER_CLASS = "MyAdapterClass"; - - public XmlJavaTypeAdapterTypeAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlJavaTypeAdapter() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_JAVA_TYPE_ADAPTER); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlJavaTypeAdapter"); - } - }); - } - - private ICompilationUnit createTestXmlJavaTypeAdapterWithValue() throws Exception { - this.createTestAdapterClass(); - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_JAVA_TYPE_ADAPTER); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlJavaTypeAdapter(value = " + XML_JAVA_TYPE_ADAPTER_CLASS + ".class)"); - } - }); - } - - private void createTestAdapterClass() throws Exception { - SourceWriter sourceWriter = new SourceWriter() { - public void appendSourceTo(StringBuilder sb) { - sb.append(CR); - sb.append("public class ").append(XML_JAVA_TYPE_ADAPTER_CLASS).append(" "); - sb.append("{}").append(CR); - } - }; - this.javaProject.createCompilationUnit(PACKAGE_NAME, "MyAdapterClass.java", sourceWriter); - } - - public void testGetNull() throws Exception { - ICompilationUnit cu = this.createTestXmlJavaTypeAdapter(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); - assertTrue(xmlJavaTypeAdapterAnnotation != null); - assertNull(xmlJavaTypeAdapterAnnotation.getValue()); - } - - public void testGetValue() throws Exception { - ICompilationUnit cu = this.createTestXmlJavaTypeAdapterWithValue(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); - assertTrue(xmlJavaTypeAdapterAnnotation != null); - assertEquals(XML_JAVA_TYPE_ADAPTER_CLASS, xmlJavaTypeAdapterAnnotation.getValue()); - assertEquals("test." + XML_JAVA_TYPE_ADAPTER_CLASS, xmlJavaTypeAdapterAnnotation.getFullyQualifiedValue()); - } - - public void testSetValue() throws Exception { - ICompilationUnit cu = this.createTestXmlJavaTypeAdapter(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); - assertNull(xmlJavaTypeAdapterAnnotation.getValue()); - xmlJavaTypeAdapterAnnotation.setValue(XML_JAVA_TYPE_ADAPTER_CLASS); - assertEquals(XML_JAVA_TYPE_ADAPTER_CLASS, xmlJavaTypeAdapterAnnotation.getValue()); - - assertSourceContains("@XmlJavaTypeAdapter(" + XML_JAVA_TYPE_ADAPTER_CLASS + ".class)", cu); - } - - public void testSetValueNull() throws Exception { - ICompilationUnit cu = this.createTestXmlJavaTypeAdapterWithValue(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlJavaTypeAdapterAnnotation xmlJavaTypeAdapterAnnotation = (XmlJavaTypeAdapterAnnotation) resourceType.getAnnotation(0, JAXB.XML_JAVA_TYPE_ADAPTER); - assertEquals(XML_JAVA_TYPE_ADAPTER_CLASS, xmlJavaTypeAdapterAnnotation.getValue()); - - xmlJavaTypeAdapterAnnotation.setValue(null); - assertNull(xmlJavaTypeAdapterAnnotation.getValue()); - - assertSourceContains("@XmlJavaTypeAdapter", cu); - assertSourceDoesNotContain("@XmlJavaTypeAdapter(" + XML_JAVA_TYPE_ADAPTER_CLASS + ".class)", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlListAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlListAnnotationTests.java deleted file mode 100644 index ee05aeed28..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlListAnnotationTests.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlListAnnotation; - -@SuppressWarnings("nls") -public class XmlListAnnotationTests extends JaxbJavaResourceModelTestCase { - - public XmlListAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlList() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_LIST); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlList"); - } - }); - } - - public void testGetXmlList() throws Exception { - ICompilationUnit cu = this.createTestXmlList(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlListAnnotation xmlListAnnotation = (XmlListAnnotation) resourceAttribute.getAnnotation(JAXB.XML_LIST); - assertTrue(xmlListAnnotation != null); - - resourceAttribute.removeAnnotation(JAXB.XML_LIST); - assertSourceDoesNotContain("@XmlList", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMimeTypeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMimeTypeAnnotationTests.java deleted file mode 100644 index 59ffe47d2a..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMimeTypeAnnotationTests.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlMimeTypeAnnotation; - -@SuppressWarnings("nls") -public class XmlMimeTypeAnnotationTests extends JaxbJavaResourceModelTestCase { - - private static final String XML_MIME_TYPE_VALUE = "myMimeType"; - - public XmlMimeTypeAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlMimeType() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_MIME_TYPE); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlMimeType"); - } - }); - } - - private ICompilationUnit createTestXmlMimeTypeWithValue() throws Exception { - return this.createTestXmlMimeTypeWithStringElement("value", XML_MIME_TYPE_VALUE); - } - - private ICompilationUnit createTestXmlMimeTypeWithStringElement(final String element, final String value) throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_MIME_TYPE); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlMimeType(" + element + " = \"" + value + "\")"); - } - }); - } - - public void testGetXmlMimeType() throws Exception { - ICompilationUnit cu = this.createTestXmlMimeType(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlMimeTypeAnnotation xmlMimeTypeAnnotation = (XmlMimeTypeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_MIME_TYPE); - assertTrue(xmlMimeTypeAnnotation != null); - - resourceAttribute.removeAnnotation(JAXB.XML_MIME_TYPE); - assertSourceDoesNotContain("@XmlMimeType", cu); - } - - public void testGetValue() throws Exception { - ICompilationUnit cu = this.createTestXmlMimeTypeWithValue(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlMimeTypeAnnotation xmlMimeTypeAnnotation = (XmlMimeTypeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_MIME_TYPE); - assertTrue(xmlMimeTypeAnnotation != null); - assertEquals(XML_MIME_TYPE_VALUE, xmlMimeTypeAnnotation.getValue()); - } - - public void testGetNull() throws Exception { - ICompilationUnit cu = this.createTestXmlMimeType(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlMimeTypeAnnotation xmlMimeTypeAnnotation = (XmlMimeTypeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_MIME_TYPE); - assertTrue(xmlMimeTypeAnnotation != null); - assertNull(xmlMimeTypeAnnotation.getValue()); - } - - public void testSetValue() throws Exception { - ICompilationUnit cu = this.createTestXmlMimeType(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlMimeTypeAnnotation xmlMimeTypeAnnotation = (XmlMimeTypeAnnotation) resourceAttribute.getAnnotation(JAXB.XML_MIME_TYPE); - assertNull(xmlMimeTypeAnnotation.getValue()); - xmlMimeTypeAnnotation.setValue(XML_MIME_TYPE_VALUE); - assertEquals(XML_MIME_TYPE_VALUE, xmlMimeTypeAnnotation.getValue()); - - assertSourceContains("@XmlMimeType(\"" + XML_MIME_TYPE_VALUE + "\")", cu); - - xmlMimeTypeAnnotation.setValue(null); - assertNull(xmlMimeTypeAnnotation.getValue()); - - assertSourceDoesNotContain("@XmlMimeType(", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMixedAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMixedAnnotationTests.java deleted file mode 100644 index 2f8d9e3dc0..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlMixedAnnotationTests.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlMixedAnnotation; - -@SuppressWarnings("nls") -public class XmlMixedAnnotationTests extends JaxbJavaResourceModelTestCase { - - public XmlMixedAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlMixed() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_MIXED); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlMixed"); - } - }); - } - - public void testGetXmlMixed() throws Exception { - ICompilationUnit cu = this.createTestXmlMixed(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlMixedAnnotation xmlMixedAnnotation = (XmlMixedAnnotation) resourceAttribute.getAnnotation(JAXB.XML_MIXED); - assertTrue(xmlMixedAnnotation != null); - - resourceAttribute.removeAnnotation(JAXB.XML_MIXED); - assertSourceDoesNotContain("@XmlMixed", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlRegistryAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlRegistryAnnotationTests.java deleted file mode 100644 index 97afdb52c4..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlRegistryAnnotationTests.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRegistryAnnotation; - -@SuppressWarnings("nls") -public class XmlRegistryAnnotationTests extends JaxbJavaResourceModelTestCase { - - public XmlRegistryAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlRegistry() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_REGISTRY); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlRegistry"); - } - }); - } - - public void testGetXmlRegistry() throws Exception { - ICompilationUnit cu = this.createTestXmlRegistry(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlRegistryAnnotation xmlRegistryAnnotation = (XmlRegistryAnnotation) resourceType.getAnnotation(JAXB.XML_REGISTRY); - assertTrue(xmlRegistryAnnotation != null); - - resourceType.removeAnnotation(JAXB.XML_REGISTRY); - assertSourceDoesNotContain("@XmlRegistry", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlRootElementAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlRootElementAnnotationTests.java deleted file mode 100644 index a14a2f59f1..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlRootElementAnnotationTests.java +++ /dev/null @@ -1,131 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlRootElementAnnotation; - -@SuppressWarnings("nls") -public class XmlRootElementAnnotationTests extends JaxbJavaResourceModelTestCase { - - private static final String XML_ROOT_ELEMENT_NAME = "XmlRootElementName"; - private static final String XML_ROOT_ELEMENT_NAMESPACE = "XmlRootElementNamespace"; - - public XmlRootElementAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlRootElement() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ROOT_ELEMENT); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlRootElement"); - } - }); - } - - private ICompilationUnit createTestXmlRootElementWithName() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ROOT_ELEMENT); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlRootElement(name = \"" + XML_ROOT_ELEMENT_NAME + "\")"); - } - }); - } - - private ICompilationUnit createTestXmlRootElementWithNamespace() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_ROOT_ELEMENT); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlRootElement(namespace = \"" + XML_ROOT_ELEMENT_NAMESPACE + "\")"); - } - }); - } - - public void testGetName() throws Exception { - ICompilationUnit cu = this.createTestXmlRootElementWithName(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlRootElementAnnotation xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(JAXB.XML_ROOT_ELEMENT); - assertTrue(xmlRootElementAnnotation != null); - assertEquals(XML_ROOT_ELEMENT_NAME, xmlRootElementAnnotation.getName()); - } - - public void testGetNull() throws Exception { - ICompilationUnit cu = this.createTestXmlRootElement(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlRootElementAnnotation xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(JAXB.XML_ROOT_ELEMENT); - assertTrue(xmlRootElementAnnotation != null); - assertNull(xmlRootElementAnnotation.getName()); - assertNull(xmlRootElementAnnotation.getNamespace()); - } - - public void testSetName() throws Exception { - ICompilationUnit cu = this.createTestXmlRootElement(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlRootElementAnnotation xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(JAXB.XML_ROOT_ELEMENT); - assertNull(xmlRootElementAnnotation.getName()); - xmlRootElementAnnotation.setName(XML_ROOT_ELEMENT_NAME); - assertEquals(XML_ROOT_ELEMENT_NAME, xmlRootElementAnnotation.getName()); - - assertSourceContains("@XmlRootElement(name = \"" + XML_ROOT_ELEMENT_NAME + "\")", cu); - - xmlRootElementAnnotation.setName(null); - assertNull(xmlRootElementAnnotation.getName()); - - assertSourceContains("@XmlRootElement", cu); - assertSourceDoesNotContain("@XmlRootElement(name = \"" + XML_ROOT_ELEMENT_NAME + "\")", cu); - } - - public void testGetNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlRootElementWithNamespace(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlRootElementAnnotation xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(JAXB.XML_ROOT_ELEMENT); - assertTrue(xmlRootElementAnnotation != null); - assertEquals(XML_ROOT_ELEMENT_NAMESPACE, xmlRootElementAnnotation.getNamespace()); - } - - public void testSetNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlRootElement(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlRootElementAnnotation xmlRootElementAnnotation = (XmlRootElementAnnotation) resourceType.getAnnotation(JAXB.XML_ROOT_ELEMENT); - assertNull(xmlRootElementAnnotation.getNamespace()); - xmlRootElementAnnotation.setNamespace(XML_ROOT_ELEMENT_NAMESPACE); - assertEquals(XML_ROOT_ELEMENT_NAMESPACE, xmlRootElementAnnotation.getNamespace()); - - assertSourceContains("@XmlRootElement(namespace = \"" + XML_ROOT_ELEMENT_NAMESPACE + "\")", cu); - - xmlRootElementAnnotation.setNamespace(null); - assertNull(xmlRootElementAnnotation.getNamespace()); - - assertSourceContains("@XmlRootElement", cu); - assertSourceDoesNotContain("@XmlRootElement(namespace = \"" + XML_ROOT_ELEMENT_NAMESPACE + "\")", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaAnnotationTests.java deleted file mode 100644 index f4d70c852b..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaAnnotationTests.java +++ /dev/null @@ -1,263 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsAnnotation; -import org.eclipse.jpt.jaxb.core.resource.java.XmlNsForm; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaAnnotation; - -@SuppressWarnings("nls") -public class XmlSchemaAnnotationTests - extends JaxbJavaResourceModelTestCase { - - private static final String TEST_LOCATION = "http://www.eclipse.org/test/schema.xsd"; - - private static final String TEST_NAMESPACE = "http://www.eclipse.org/test/schema"; - - private static final String TEST_PREFIX = "ts"; - - private static final String TEST_NAMESPACE_2 = "http://www.eclipse.org/test/schema2"; - - private static final String TEST_PREFIX_2 = "ts2"; - - - public XmlSchemaAnnotationTests(String name) { - super(name); - } - - - private ICompilationUnit createPackageInfoWithSchemaAndAttributeFormDefault() throws CoreException { - return createTestPackageInfo( - "@XmlSchema(attributeFormDefault = XmlNsForm.QUALIFIED)", - JAXB.XML_SCHEMA, JAXB.XML_NS_FORM); - } - - private ICompilationUnit createPackageInfoWithSchemaAndElementFormDefault() throws CoreException { - return createTestPackageInfo( - "@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED)", - JAXB.XML_SCHEMA, JAXB.XML_NS_FORM); - } - - private ICompilationUnit createPackageInfoWithSchemaAndLocation() throws CoreException { - return createTestPackageInfo( - "@XmlSchema(location = \"" + TEST_LOCATION + "\")", - JAXB.XML_SCHEMA); - } - - private ICompilationUnit createPackageInfoWithSchemaAndNamespace() throws CoreException { - return createTestPackageInfo( - "@XmlSchema(namespace = \"" + TEST_NAMESPACE + "\")", - JAXB.XML_SCHEMA); - } - - private ICompilationUnit createPackageInfoWithSchemaAndXmlns() throws CoreException { - return createTestPackageInfo( - "@XmlSchema(xmlns = @XmlNs)", - JAXB.XML_SCHEMA, JAXB.XML_NS); - } - - private ICompilationUnit createPackageInfoWithSchemaAndXmlnsWithNamespace() throws CoreException { - return createTestPackageInfo( - "@XmlSchema(xmlns = @XmlNs(namespaceURI = \"" + TEST_NAMESPACE + "\"))", - JAXB.XML_SCHEMA, JAXB.XML_NS); - } - - private ICompilationUnit createPackageInfoWithSchemaAndXmlnsWithPrefix() throws CoreException { - return createTestPackageInfo( - "@XmlSchema(xmlns = @XmlNs(prefix = \"" + TEST_PREFIX + "\"))", - JAXB.XML_SCHEMA, JAXB.XML_NS); - } - - public void testAttributeFormDefault() - throws Exception { - - ICompilationUnit cu = createPackageInfoWithSchemaAndAttributeFormDefault(); - JavaResourcePackage packageResource = buildJavaResourcePackage(cu); - - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA); - assertTrue(schemaAnnotation != null); - assertEquals(XmlNsForm.QUALIFIED, schemaAnnotation.getAttributeFormDefault()); - assertSourceContains("@XmlSchema(attributeFormDefault = XmlNsForm.QUALIFIED)", cu); - - schemaAnnotation.setAttributeFormDefault(XmlNsForm.UNQUALIFIED); - assertEquals(XmlNsForm.UNQUALIFIED, schemaAnnotation.getAttributeFormDefault()); - assertSourceContains("@XmlSchema(attributeFormDefault = UNQUALIFIED)", cu); - - schemaAnnotation.setAttributeFormDefault(XmlNsForm.UNSET); - assertEquals(XmlNsForm.UNSET, schemaAnnotation.getAttributeFormDefault()); - assertSourceContains("@XmlSchema(attributeFormDefault = UNSET)", cu); - - schemaAnnotation.setAttributeFormDefault(null); - schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA); - assertNull(schemaAnnotation.getAttributeFormDefault()); - assertSourceDoesNotContain("@XmlSchema(", cu); - - schemaAnnotation = (XmlSchemaAnnotation) packageResource.addAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - schemaAnnotation.setAttributeFormDefault(XmlNsForm.QUALIFIED); - assertEquals(XmlNsForm.QUALIFIED, schemaAnnotation.getAttributeFormDefault()); - assertSourceContains("@XmlSchema(attributeFormDefault = QUALIFIED)", cu); - } - - public void testElementFormDefault() - throws Exception { - - ICompilationUnit cu = createPackageInfoWithSchemaAndElementFormDefault(); - JavaResourcePackage packageResource = buildJavaResourcePackage(cu); - - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA); - assertTrue(schemaAnnotation != null); - assertEquals(XmlNsForm.QUALIFIED, schemaAnnotation.getElementFormDefault()); - assertSourceContains("@XmlSchema(elementFormDefault = XmlNsForm.QUALIFIED)", cu); - - schemaAnnotation.setElementFormDefault(XmlNsForm.UNQUALIFIED); - assertEquals(XmlNsForm.UNQUALIFIED, schemaAnnotation.getElementFormDefault()); - assertSourceContains("@XmlSchema(elementFormDefault = UNQUALIFIED)", cu); - - schemaAnnotation.setElementFormDefault(XmlNsForm.UNSET); - assertEquals(XmlNsForm.UNSET, schemaAnnotation.getElementFormDefault()); - assertSourceContains("@XmlSchema(elementFormDefault = UNSET)", cu); - - schemaAnnotation.setElementFormDefault(null); - schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA); - assertNull(schemaAnnotation.getElementFormDefault()); - assertSourceDoesNotContain("@XmlSchema(", cu); - - schemaAnnotation = (XmlSchemaAnnotation) packageResource.addAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - schemaAnnotation.setElementFormDefault(XmlNsForm.QUALIFIED); - assertEquals(XmlNsForm.QUALIFIED, schemaAnnotation.getElementFormDefault()); - assertSourceContains("@XmlSchema(elementFormDefault = QUALIFIED)", cu); - } - - public void testLocation() - throws Exception { - - ICompilationUnit cu = createPackageInfoWithSchemaAndLocation(); - JavaResourcePackage packageResource = buildJavaResourcePackage(cu); - - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA); - assertNotNull(schemaAnnotation.getLocation()); - - schemaAnnotation.setLocation(null); - schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA); - assertNull(schemaAnnotation.getLocation()); - assertSourceDoesNotContain("@XmlSchema(", cu); - - schemaAnnotation = (XmlSchemaAnnotation) packageResource.addAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - schemaAnnotation.setLocation(TEST_LOCATION); - assertEquals(TEST_LOCATION, schemaAnnotation.getLocation()); - assertSourceContains("@XmlSchema(location = \"" + TEST_LOCATION + "\")", cu); - } - - public void testNamespace() - throws Exception { - - ICompilationUnit cu = createPackageInfoWithSchemaAndNamespace(); - JavaResourcePackage packageResource = buildJavaResourcePackage(cu); - - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA); - assertNotNull(schemaAnnotation.getNamespace()); - - schemaAnnotation.setNamespace(null); - schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA); - assertNull(schemaAnnotation.getNamespace()); - assertSourceDoesNotContain("@XmlSchema(", cu); - - schemaAnnotation = (XmlSchemaAnnotation) packageResource.addAnnotation(XmlSchemaAnnotation.ANNOTATION_NAME); - schemaAnnotation.setNamespace(TEST_NAMESPACE); - assertEquals(TEST_NAMESPACE, schemaAnnotation.getNamespace()); - assertSourceContains("@XmlSchema(namespace = \"" + TEST_NAMESPACE + "\")", cu); - } - - public void testXmlnsNamespace() - throws Exception { - - ICompilationUnit cu = createPackageInfoWithSchemaAndXmlnsWithNamespace(); - JavaResourcePackage packageResource = buildJavaResourcePackage(cu); - - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA); - XmlNsAnnotation xmlnsAnnotation = schemaAnnotation.xmlnsAt(0); - assertNotNull(xmlnsAnnotation.getNamespaceURI()); - - xmlnsAnnotation.setNamespaceURI(null); - assertNull(xmlnsAnnotation.getNamespaceURI()); - assertSourceContains("@XmlSchema(xmlns = @XmlNs)", cu); - - xmlnsAnnotation.setNamespaceURI(TEST_NAMESPACE_2); - assertEquals(TEST_NAMESPACE_2, xmlnsAnnotation.getNamespaceURI()); - assertSourceContains("@XmlSchema(xmlns = @XmlNs(namespaceURI = \"" + TEST_NAMESPACE_2 + "\"))", cu); - } - - public void testXmlnsPrefix() - throws Exception { - - ICompilationUnit cu = createPackageInfoWithSchemaAndXmlnsWithPrefix(); - JavaResourcePackage packageResource = buildJavaResourcePackage(cu); - - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA); - XmlNsAnnotation xmlnsAnnotation = schemaAnnotation.xmlnsAt(0); - assertNotNull(xmlnsAnnotation.getPrefix()); - - xmlnsAnnotation.setPrefix(null); - assertNull(xmlnsAnnotation.getPrefix()); - assertSourceContains("@XmlSchema(xmlns = @XmlNs)", cu); - - xmlnsAnnotation.setPrefix(TEST_PREFIX_2); - assertEquals(TEST_PREFIX_2, xmlnsAnnotation.getPrefix()); - assertSourceContains("@XmlSchema(xmlns = @XmlNs(prefix = \"" + TEST_PREFIX_2 + "\"))", cu); - } - - public void testXmlns() - throws Exception { - - ICompilationUnit cu = createPackageInfoWithSchemaAndXmlns(); - JavaResourcePackage packageResource = buildJavaResourcePackage(cu); - - XmlSchemaAnnotation schemaAnnotation = (XmlSchemaAnnotation) packageResource.getAnnotation(JAXB.XML_SCHEMA); - assertFalse(CollectionTools.isEmpty(schemaAnnotation.getXmlns())); - assertEquals(1, schemaAnnotation.getXmlnsSize()); - - schemaAnnotation.addXmlns(1); - assertEquals(2, schemaAnnotation.getXmlnsSize()); - assertSourceContains("@XmlSchema(xmlns = {@XmlNs,@XmlNs})", cu); - - XmlNsAnnotation xmlnsAnnotation1 = schemaAnnotation.xmlnsAt(0); - xmlnsAnnotation1.setNamespaceURI(TEST_NAMESPACE); - xmlnsAnnotation1.setPrefix(TEST_PREFIX); - XmlNsAnnotation xmlnsAnnotation2 = schemaAnnotation.xmlnsAt(1); - xmlnsAnnotation2.setNamespaceURI(TEST_NAMESPACE_2); - xmlnsAnnotation2.setPrefix(TEST_PREFIX_2); - assertSourceContains( - "@XmlSchema(xmlns = {@XmlNs(namespaceURI = \"" + TEST_NAMESPACE - + "\", prefix = \"" + TEST_PREFIX - + "\"),@XmlNs(namespaceURI = \"" + TEST_NAMESPACE_2 - + "\", prefix = \"" + TEST_PREFIX_2 - + "\")})", cu); - - schemaAnnotation.moveXmlns(0, 1); - assertSourceContains( - "@XmlSchema(xmlns = {@XmlNs(namespaceURI = \"" + TEST_NAMESPACE_2 - + "\", prefix = \"" + TEST_PREFIX_2 - + "\"),@XmlNs(namespaceURI = \"" + TEST_NAMESPACE - + "\", prefix = \"" + TEST_PREFIX - + "\")})", cu); - - schemaAnnotation.removeXmlns(1); - assertEquals(1, schemaAnnotation.getXmlnsSize()); - assertSourceContains( - "@XmlSchema(xmlns = @XmlNs(namespaceURI = \"" + TEST_NAMESPACE_2 - + "\", prefix = \"" + TEST_PREFIX_2 - + "\"))", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaTypeAttributeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaTypeAttributeAnnotationTests.java deleted file mode 100644 index 0c7b1a4b1c..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaTypeAttributeAnnotationTests.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Date; -import java.util.GregorianCalendar; -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; - -@SuppressWarnings("nls") -public class XmlSchemaTypeAttributeAnnotationTests - extends JaxbJavaResourceModelTestCase { - - private static final String TEST_NAME = "foo"; - private static final String TEST_NAME_2 = "bar"; - - private static final String TEST_NAMESPACE = "http://www.eclipse.org/test/schema"; - private static final String TEST_NAMESPACE_2 = "http://www.eclipse.org/test/schema2"; - - private static final String TEST_CLASS = GregorianCalendar.class.getSimpleName(); - private static final String TEST_CLASS_2 = Date.class.getSimpleName(); - private static final String FQ_TEST_CLASS = GregorianCalendar.class.getName(); - private static final String FQ_TEST_CLASS_2 = Date.class.getName(); - - - public XmlSchemaTypeAttributeAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlAttributeWithSchemaTypeAndName() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_SCHEMA_TYPE); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlSchemaType(name = \"" + TEST_NAME + "\")"); - } - }); - } - - private ICompilationUnit createTestXmlAttributeWithSchemaTypeAndNamespace() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_SCHEMA_TYPE); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlSchemaType(namespace = \"" + TEST_NAMESPACE + "\")"); - } - }); - } - - private ICompilationUnit createTestXmlAttributeWithSchemaTypeAndType() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_SCHEMA_TYPE, FQ_TEST_CLASS, FQ_TEST_CLASS_2); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlSchemaType(type = " + TEST_CLASS + ".class)"); - } - }); - } - - public void testName() throws Exception { - ICompilationUnit cu = this.createTestXmlAttributeWithSchemaTypeAndName(); - JavaResourceType resourceType = this.buildJavaResourceType(cu); - JavaResourceField resourceAttribute = this.getField(resourceType, 0); - - XmlSchemaTypeAnnotation annotation = - (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); - assertTrue(annotation != null); - assertEquals(TEST_NAME, annotation.getName()); - assertSourceContains("@XmlSchemaType(name = \"" + TEST_NAME + "\")", cu); - - annotation.setName(TEST_NAME_2); - assertEquals(TEST_NAME_2, annotation.getName()); - assertSourceContains("@XmlSchemaType(name = \"" + TEST_NAME_2 + "\")", cu); - - annotation.setName(null); - assertEquals(null, annotation.getName()); - assertSourceContains("@XmlSchemaType", cu); - - annotation.setName(TEST_NAME); - assertEquals(TEST_NAME, annotation.getName()); - assertSourceContains("@XmlSchemaType(name = \"" + TEST_NAME + "\")", cu); - } - - public void testNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlAttributeWithSchemaTypeAndNamespace(); - JavaResourceType resourceType = this.buildJavaResourceType(cu); - JavaResourceField resourceAttribute = this.getField(resourceType, 0); - - XmlSchemaTypeAnnotation annotation = - (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); - assertTrue(annotation != null); - assertEquals(TEST_NAMESPACE, annotation.getNamespace()); - assertSourceContains("@XmlSchemaType(namespace = \"" + TEST_NAMESPACE + "\")", cu); - - annotation.setNamespace(TEST_NAMESPACE_2); - assertEquals(TEST_NAMESPACE_2, annotation.getNamespace()); - assertSourceContains("@XmlSchemaType(namespace = \"" + TEST_NAMESPACE_2 + "\")", cu); - - annotation.setNamespace(null); - assertEquals(null, annotation.getNamespace()); - assertSourceContains("@XmlSchemaType", cu); - - annotation.setNamespace(TEST_NAMESPACE); - assertEquals(TEST_NAMESPACE, annotation.getNamespace()); - assertSourceContains("@XmlSchemaType(namespace = \"" + TEST_NAMESPACE + "\")", cu); - } - - public void testType() throws Exception { - ICompilationUnit cu = this.createTestXmlAttributeWithSchemaTypeAndType(); - JavaResourceType resourceType = this.buildJavaResourceType(cu); - JavaResourceField resourceAttribute = this.getField(resourceType, 0); - - XmlSchemaTypeAnnotation annotation = - (XmlSchemaTypeAnnotation) resourceAttribute.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); - assertTrue(annotation != null); - assertEquals(TEST_CLASS, annotation.getType()); - assertEquals(FQ_TEST_CLASS, annotation.getFullyQualifiedType()); - assertSourceContains("@XmlSchemaType(type = " + TEST_CLASS + ".class)", cu); - - annotation.setType(TEST_CLASS_2); - assertEquals(TEST_CLASS_2, annotation.getType()); - assertEquals(FQ_TEST_CLASS_2, annotation.getFullyQualifiedType()); - assertSourceContains("@XmlSchemaType(type = " + TEST_CLASS_2 + ".class)", cu); - - annotation.setType(null); - assertEquals(null, annotation.getType()); - assertEquals(null, annotation.getFullyQualifiedType()); - assertSourceContains("@XmlSchemaType", cu); - - annotation.setType(TEST_CLASS); - assertEquals(TEST_CLASS, annotation.getType()); - assertEquals(FQ_TEST_CLASS, annotation.getFullyQualifiedType()); - assertSourceContains("@XmlSchemaType(type = " + TEST_CLASS + ".class)", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaTypePackageAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaTypePackageAnnotationTests.java deleted file mode 100644 index 03e98ea782..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSchemaTypePackageAnnotationTests.java +++ /dev/null @@ -1,240 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Date; -import java.util.GregorianCalendar; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSchemaTypeAnnotation; - -@SuppressWarnings("nls") -public class XmlSchemaTypePackageAnnotationTests - extends JaxbJavaResourceModelTestCase { - - private static final String TEST_NAME = "foo"; - private static final String TEST_NAME_2 = "bar"; - - private static final String TEST_NAMESPACE = "http://www.eclipse.org/test/schema"; - private static final String TEST_NAMESPACE_2 = "http://www.eclipse.org/test/schema2"; - - private static final String TEST_CLASS = GregorianCalendar.class.getSimpleName(); - private static final String TEST_CLASS_2 = Date.class.getSimpleName(); - private static final String FQ_TEST_CLASS = GregorianCalendar.class.getName(); - private static final String FQ_TEST_CLASS_2 = Date.class.getName(); - - - public XmlSchemaTypePackageAnnotationTests(String name) { - super(name); - } - - - private ICompilationUnit createPackageInfoWithSchemaType() throws CoreException { - return createTestPackageInfo( - "@XmlSchemaType", - JAXB.XML_SCHEMA_TYPE); - } - - private ICompilationUnit createPackageInfoWithSchemaTypeAndName() throws CoreException { - return createTestPackageInfo( - "@XmlSchemaType(name = \"" + TEST_NAME + "\")", - JAXB.XML_SCHEMA_TYPE); - } - - private ICompilationUnit createPackageInfoWithSchemaTypeAndNamespace() throws CoreException { - return createTestPackageInfo( - "@XmlSchemaType(namespace = \"" + TEST_NAMESPACE + "\")", - JAXB.XML_SCHEMA_TYPE); - } - - private ICompilationUnit createPackageInfoWithSchemaTypeAndType() throws CoreException { - return createTestPackageInfo( - "@XmlSchemaType(type = " + TEST_CLASS + ".class)", - JAXB.XML_SCHEMA_TYPE, FQ_TEST_CLASS, FQ_TEST_CLASS_2); - } - - private ICompilationUnit createPackageInfoWithSchemaTypes() throws CoreException { - return createTestPackageInfo( - "@XmlSchemaTypes({@XmlSchemaType,@XmlSchemaType})", - JAXB.XML_SCHEMA_TYPES, JAXB.XML_SCHEMA_TYPE, FQ_TEST_CLASS, FQ_TEST_CLASS_2); - } - - public void testName() throws Exception { - ICompilationUnit cu = createPackageInfoWithSchemaTypeAndName(); - JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu); - - XmlSchemaTypeAnnotation annotation = - (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); - assertTrue(annotation != null); - assertEquals(TEST_NAME, annotation.getName()); - assertSourceContains("@XmlSchemaType(name = \"" + TEST_NAME + "\")", cu); - - annotation.setName(TEST_NAME_2); - assertEquals(TEST_NAME_2, annotation.getName()); - assertSourceContains("@XmlSchemaType(name = \"" + TEST_NAME_2 + "\")", cu); - - annotation.setName(null); - assertEquals(null, annotation.getName()); - assertSourceContains("@XmlSchemaType", cu); - - annotation.setName(TEST_NAME); - assertEquals(TEST_NAME, annotation.getName()); - assertSourceContains("@XmlSchemaType(name = \"" + TEST_NAME + "\")", cu); - } - - public void testNamespace() throws Exception { - ICompilationUnit cu = createPackageInfoWithSchemaTypeAndNamespace(); - JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu); - - XmlSchemaTypeAnnotation annotation = - (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); - assertTrue(annotation != null); - assertEquals(TEST_NAMESPACE, annotation.getNamespace()); - assertSourceContains("@XmlSchemaType(namespace = \"" + TEST_NAMESPACE + "\")", cu); - - annotation.setNamespace(TEST_NAMESPACE_2); - assertEquals(TEST_NAMESPACE_2, annotation.getNamespace()); - assertSourceContains("@XmlSchemaType(namespace = \"" + TEST_NAMESPACE_2 + "\")", cu); - - annotation.setNamespace(null); - assertEquals(null, annotation.getNamespace()); - assertSourceContains("@XmlSchemaType", cu); - - annotation.setNamespace(TEST_NAMESPACE); - assertEquals(TEST_NAMESPACE, annotation.getNamespace()); - assertSourceContains("@XmlSchemaType(namespace = \"" + TEST_NAMESPACE + "\")", cu); - } - - public void testType() throws Exception { - ICompilationUnit cu = createPackageInfoWithSchemaTypeAndType(); - JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu); - - XmlSchemaTypeAnnotation annotation = - (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); - assertTrue(annotation != null); - assertEquals(TEST_CLASS, annotation.getType()); - assertEquals(FQ_TEST_CLASS, annotation.getFullyQualifiedType()); - assertSourceContains("@XmlSchemaType(type = " + TEST_CLASS + ".class)", cu); - - annotation.setType(TEST_CLASS_2); - assertEquals(TEST_CLASS_2, annotation.getType()); - assertEquals(FQ_TEST_CLASS_2, annotation.getFullyQualifiedType()); - assertSourceContains("@XmlSchemaType(type = " + TEST_CLASS_2 + ".class)", cu); - - annotation.setType(null); - assertEquals(null, annotation.getType()); - assertEquals(null, annotation.getFullyQualifiedType()); - assertSourceContains("@XmlSchemaType", cu); - - annotation.setType(TEST_CLASS); - assertEquals(TEST_CLASS, annotation.getType()); - assertEquals(FQ_TEST_CLASS, annotation.getFullyQualifiedType()); - assertSourceContains("@XmlSchemaType(type = " + TEST_CLASS + ".class)", cu); - } - - public void testContainedWithName() throws Exception { - // test contained annotation value setting/updating - - ICompilationUnit cu = createPackageInfoWithSchemaTypes(); - JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu); - - XmlSchemaTypeAnnotation containedAnnotation = - (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); - - containedAnnotation.setName(TEST_NAME); - assertEquals(TEST_NAME, containedAnnotation.getName()); - assertSourceContains( - "@XmlSchemaTypes({@XmlSchemaType(name = \"" + TEST_NAME + "\"),@XmlSchemaType})", cu); - - containedAnnotation.setName(null); - assertNull(containedAnnotation.getName()); - assertSourceContains( - "@XmlSchemaTypes({@XmlSchemaType,@XmlSchemaType})", cu); - } - - public void testContainedWithNamespace() throws Exception { - // test contained annotation value setting/updating - - ICompilationUnit cu = createPackageInfoWithSchemaTypes(); - JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu); - - XmlSchemaTypeAnnotation containedAnnotation = - (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); - - containedAnnotation.setNamespace(TEST_NAMESPACE); - assertEquals(TEST_NAMESPACE, containedAnnotation.getNamespace()); - assertSourceContains( - "@XmlSchemaTypes({@XmlSchemaType(namespace = \"" + TEST_NAMESPACE + "\"),@XmlSchemaType})", cu); - - containedAnnotation.setNamespace(null); - assertNull(containedAnnotation.getNamespace()); - assertSourceContains( - "@XmlSchemaTypes({@XmlSchemaType,@XmlSchemaType})", cu); - } - - public void testContainedWithType()throws Exception { - // test contained annotation type setting/updating - - ICompilationUnit cu = createPackageInfoWithSchemaTypes(); - JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu); - - XmlSchemaTypeAnnotation containedAnnotation = - (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(1, JAXB.XML_SCHEMA_TYPE); - - containedAnnotation.setType(TEST_CLASS); - assertEquals(TEST_CLASS, containedAnnotation.getType()); - assertEquals(FQ_TEST_CLASS, containedAnnotation.getFullyQualifiedType()); - assertSourceContains( - "@XmlSchemaTypes({@XmlSchemaType,@XmlSchemaType(type = " + TEST_CLASS + ".class)})", cu); - - containedAnnotation.setType(null); - assertNull(containedAnnotation.getType()); - assertNull(FQ_TEST_CLASS, containedAnnotation.getFullyQualifiedType()); - assertSourceContains( - "@XmlSchemaTypes({@XmlSchemaType,@XmlSchemaType})", cu); - } - - public void testContained() throws Exception { - // test adding/removing/moving - - ICompilationUnit cu = createPackageInfoWithSchemaType(); - JavaResourcePackage resourcePackage = buildJavaResourcePackage(cu); - - assertEquals(1, resourcePackage.getAnnotationsSize(JAXB.XML_SCHEMA_TYPE)); - - resourcePackage.addAnnotation(1, JAXB.XML_SCHEMA_TYPE); - - assertEquals(2, resourcePackage.getAnnotationsSize(JAXB.XML_SCHEMA_TYPE)); - assertSourceContains("@XmlSchemaTypes({ @XmlSchemaType, @XmlSchemaType })", cu); - - XmlSchemaTypeAnnotation containedAnnotation1 = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(0, JAXB.XML_SCHEMA_TYPE); - containedAnnotation1.setName(TEST_NAME); - XmlSchemaTypeAnnotation containedAnnotation2 = (XmlSchemaTypeAnnotation) resourcePackage.getAnnotation(1, JAXB.XML_SCHEMA_TYPE); - containedAnnotation2.setName(TEST_NAME_2); - assertSourceContains( - "@XmlSchemaTypes({ @XmlSchemaType(name = \"" + TEST_NAME - + "\"), @XmlSchemaType(name = \"" + TEST_NAME_2 - + "\") })", cu); - - resourcePackage.moveAnnotation(0, 1, JAXB.XML_SCHEMA_TYPE); - assertSourceContains( - "@XmlSchemaTypes({ @XmlSchemaType(name = \"" + TEST_NAME_2 - + "\"), @XmlSchemaType(name = \"" + TEST_NAME - + "\") })", cu); - - resourcePackage.removeAnnotation(1, JAXB.XML_SCHEMA_TYPE); - assertEquals(1, resourcePackage.getAnnotationsSize(JAXB.XML_SCHEMA_TYPE)); - assertSourceContains( - "@XmlSchemaType(name = \"" + TEST_NAME_2 + "\")", cu); - assertSourceDoesNotContain("@XmlSchemaTypes", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSeeAlsoAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSeeAlsoAnnotationTests.java deleted file mode 100644 index 53f1ecebcc..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlSeeAlsoAnnotationTests.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import java.util.ListIterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlSeeAlsoAnnotation; - -@SuppressWarnings("nls") -public class XmlSeeAlsoAnnotationTests extends JaxbJavaResourceModelTestCase { - - - public XmlSeeAlsoAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlSeeAlso() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_SEE_ALSO); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlSeeAlso"); - } - }); - } - - private ICompilationUnit createTestXmlSeeAlsoWithValue() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_SEE_ALSO); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlSeeAlso(value = {Foo.class, Bar.class})"); - } - }); - } - - - public void testGetNull() throws Exception { - ICompilationUnit cu = this.createTestXmlSeeAlso(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlSeeAlsoAnnotation xmlSeeAlsoAnnotation = (XmlSeeAlsoAnnotation) resourceType.getAnnotation(JAXB.XML_SEE_ALSO); - assertTrue(xmlSeeAlsoAnnotation != null); - assertEquals(0, xmlSeeAlsoAnnotation.getClassesSize()); - } - - public void testGetClasses() throws Exception { - ICompilationUnit cu = this.createTestXmlSeeAlsoWithValue(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlSeeAlsoAnnotation xmlSeeAlsoAnnotation = (XmlSeeAlsoAnnotation) resourceType.getAnnotation(JAXB.XML_SEE_ALSO); - assertTrue(xmlSeeAlsoAnnotation != null); - ListIterator classes = xmlSeeAlsoAnnotation.getClasses().iterator(); - assertEquals("Foo", classes.next()); - assertEquals("Bar", classes.next()); - } - - public void testGetClassesSize() throws Exception { - ICompilationUnit cu = this.createTestXmlSeeAlsoWithValue(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlSeeAlsoAnnotation xmlSeeAlsoAnnotation = (XmlSeeAlsoAnnotation) resourceType.getAnnotation(JAXB.XML_SEE_ALSO); - assertTrue(xmlSeeAlsoAnnotation != null); - assertEquals(2, xmlSeeAlsoAnnotation.getClassesSize()); - } - - public void testAddClass() throws Exception { - ICompilationUnit cu = this.createTestXmlSeeAlso(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlSeeAlsoAnnotation xmlSeeAlsoAnnotation = (XmlSeeAlsoAnnotation) resourceType.getAnnotation(JAXB.XML_SEE_ALSO); - assertTrue(xmlSeeAlsoAnnotation != null); - - xmlSeeAlsoAnnotation.addClass("Fooo"); - xmlSeeAlsoAnnotation.addClass("Barrr"); - - assertSourceContains("@XmlSeeAlso({ Fooo.class, Barrr.class })", cu); - } - - public void testAddClassIndex() throws Exception { - ICompilationUnit cu = this.createTestXmlSeeAlso(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlSeeAlsoAnnotation xmlSeeAlsoAnnotation = (XmlSeeAlsoAnnotation) resourceType.getAnnotation(JAXB.XML_SEE_ALSO); - assertTrue(xmlSeeAlsoAnnotation != null); - - xmlSeeAlsoAnnotation.addClass(0, "Fooo"); - xmlSeeAlsoAnnotation.addClass(0, "Barr"); - xmlSeeAlsoAnnotation.addClass(1, "Blah"); - - assertSourceContains("@XmlSeeAlso({ Barr.class, Blah.class, Fooo.class })", cu); - } - - public void testRemoveClass() throws Exception { - ICompilationUnit cu = this.createTestXmlSeeAlsoWithValue(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlSeeAlsoAnnotation xmlSeeAlsoAnnotation = (XmlSeeAlsoAnnotation) resourceType.getAnnotation(JAXB.XML_SEE_ALSO); - assertTrue(xmlSeeAlsoAnnotation != null); - - xmlSeeAlsoAnnotation.removeClass("Foo"); - assertSourceContains("@XmlSeeAlso(value = Bar.class)", cu); - - xmlSeeAlsoAnnotation.removeClass("Bar"); - assertSourceContains("@XmlSeeAlso", cu); - assertSourceDoesNotContain("value", cu); - } - - public void testRemoveClassIndex() throws Exception { - ICompilationUnit cu = this.createTestXmlSeeAlsoWithValue(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlSeeAlsoAnnotation xmlSeeAlsoAnnotation = (XmlSeeAlsoAnnotation) resourceType.getAnnotation(JAXB.XML_SEE_ALSO); - assertTrue(xmlSeeAlsoAnnotation != null); - - xmlSeeAlsoAnnotation.removeClass(0); - assertSourceContains("@XmlSeeAlso(value = Bar.class)", cu); - - xmlSeeAlsoAnnotation.removeClass(0); - assertSourceContains("@XmlSeeAlso", cu); - assertSourceDoesNotContain("value", cu); - } - - public void testMoveClass() throws Exception { - ICompilationUnit cu = this.createTestXmlSeeAlso(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlSeeAlsoAnnotation xmlSeeAlsoAnnotation = (XmlSeeAlsoAnnotation) resourceType.getAnnotation(JAXB.XML_SEE_ALSO); - assertTrue(xmlSeeAlsoAnnotation != null); - - xmlSeeAlsoAnnotation.addClass("Fooo"); - xmlSeeAlsoAnnotation.addClass("Barr"); - xmlSeeAlsoAnnotation.addClass("Blah"); - assertSourceContains("@XmlSeeAlso({ Fooo.class, Barr.class, Blah.class })", cu); - - xmlSeeAlsoAnnotation.moveClass(0, 1); - assertSourceContains("@XmlSeeAlso({ Barr.class, Fooo.class, Blah.class })", cu); - - xmlSeeAlsoAnnotation.moveClass(2, 1); - assertSourceContains("@XmlSeeAlso({ Barr.class, Blah.class, Fooo.class })", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTransientAttributeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTransientAttributeAnnotationTests.java deleted file mode 100644 index 39d28752b1..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTransientAttributeAnnotationTests.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceMethod; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTransientAnnotation; - -@SuppressWarnings("nls") -public class XmlTransientAttributeAnnotationTests extends JaxbJavaResourceModelTestCase { - - public XmlTransientAttributeAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlTransient() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TRANSIENT); - } - @Override - public void appendGetIdMethodAnnotationTo(StringBuilder sb) { - sb.append("@XmlTransient"); - } - }); - } - - public void testGetXmlTransient() throws Exception { - ICompilationUnit cu = this.createTestXmlTransient(); - JavaResourceType resourceType = this.buildJavaResourceType(cu); - JavaResourceMethod resourceMethod = this.getMethod(resourceType, 0); - - XmlTransientAnnotation xmlTransientAnnotation = (XmlTransientAnnotation) resourceMethod.getAnnotation(JAXB.XML_TRANSIENT); - assertTrue(xmlTransientAnnotation != null); - - resourceMethod.removeAnnotation(JAXB.XML_TRANSIENT); - assertSourceDoesNotContain("@XmlTransient", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTransientTypeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTransientTypeAnnotationTests.java deleted file mode 100644 index 502fb5e820..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTransientTypeAnnotationTests.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTransientAnnotation; - -@SuppressWarnings("nls") -public class XmlTransientTypeAnnotationTests extends JaxbJavaResourceModelTestCase { - - public XmlTransientTypeAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlTransient() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TRANSIENT); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlTransient"); - } - }); - } - - public void testGetXmlTransient() throws Exception { - ICompilationUnit cu = this.createTestXmlTransient(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTransientAnnotation xmlTransientAnnotation = (XmlTransientAnnotation) resourceType.getAnnotation(JAXB.XML_TRANSIENT); - assertTrue(xmlTransientAnnotation != null); - - resourceType.removeAnnotation(JAXB.XML_TRANSIENT); - assertSourceDoesNotContain("@XmlTransient", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTypeAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTypeAnnotationTests.java deleted file mode 100644 index 2ac478b980..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlTypeAnnotationTests.java +++ /dev/null @@ -1,340 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import java.util.ListIterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.core.tests.internal.projects.TestJavaProject.SourceWriter; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlTypeAnnotation; - -@SuppressWarnings("nls") -public class XmlTypeAnnotationTests extends JaxbJavaResourceModelTestCase { - - private static final String XML_TYPE_NAME = "XmlTypeName"; - private static final String XML_TYPE_NAMESPACE = "XmlTypeNamespace"; - private static final String XML_TYPE_FACTORY_METHOD = "myFactoryMethod"; - private static final String XML_TYPE_FACTORY_CLASS = "MyFactoryClass"; - - public XmlTypeAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlType() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType"); - } - }); - } - - private ICompilationUnit createTestXmlTypeWithName() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType(name = \"" + XML_TYPE_NAME + "\")"); - } - }); - } - - private ICompilationUnit createTestXmlTypeWithNamespace() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType(namespace = \"" + XML_TYPE_NAMESPACE + "\")"); - } - }); - } - - private ICompilationUnit createTestXmlTypeWithFactoryMethod() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType(factoryMethod = \"" + XML_TYPE_FACTORY_METHOD + "\")"); - } - }); - } - - private ICompilationUnit createTestXmlTypeWithFactoryClass() throws Exception { - this.createTestFactoryClass(); - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType(factoryClass = " + XML_TYPE_FACTORY_CLASS + ".class)"); - } - }); - } - - private void createTestFactoryClass() throws Exception { - SourceWriter sourceWriter = new SourceWriter() { - public void appendSourceTo(StringBuilder sb) { - sb.append(CR); - sb.append("public class ").append(XML_TYPE_FACTORY_CLASS).append(" "); - sb.append("{}").append(CR); - } - }; - this.javaProject.createCompilationUnit(PACKAGE_NAME, "MyFactoryClass.java", sourceWriter); - } - - private ICompilationUnit createTestXmlTypeWithPropOrder() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_TYPE); - } - @Override - public void appendTypeAnnotationTo(StringBuilder sb) { - sb.append("@XmlType(propOrder = {\"foo\", \"bar\"})"); - } - }); - } - - public void testGetName() throws Exception { - ICompilationUnit cu = this.createTestXmlTypeWithName(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); - assertTrue(xmlTypeAnnotation != null); - assertEquals(XML_TYPE_NAME, xmlTypeAnnotation.getName()); - } - - public void testGetNull() throws Exception { - ICompilationUnit cu = this.createTestXmlType(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); - assertTrue(xmlTypeAnnotation != null); - assertNull(xmlTypeAnnotation.getName()); - assertNull(xmlTypeAnnotation.getNamespace()); - assertNull(xmlTypeAnnotation.getFactoryClass()); - assertNull(xmlTypeAnnotation.getFullyQualifiedFactoryClassName()); - assertNull(xmlTypeAnnotation.getFactoryMethod()); - } - - public void testSetName() throws Exception { - ICompilationUnit cu = this.createTestXmlType(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); - assertNull(xmlTypeAnnotation.getName()); - xmlTypeAnnotation.setName(XML_TYPE_NAME); - assertEquals(XML_TYPE_NAME, xmlTypeAnnotation.getName()); - - assertSourceContains("@XmlType(name = \"" + XML_TYPE_NAME + "\")", cu); - - xmlTypeAnnotation.setName(null); - assertNull(xmlTypeAnnotation.getName()); - - assertSourceContains("@XmlType", cu); - assertSourceDoesNotContain("@XmlType(name = \"" + XML_TYPE_NAME + "\")", cu); - } - - public void testGetNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlTypeWithNamespace(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); - assertTrue(xmlTypeAnnotation != null); - assertEquals(XML_TYPE_NAMESPACE, xmlTypeAnnotation.getNamespace()); - } - - public void testSetNamespace() throws Exception { - ICompilationUnit cu = this.createTestXmlType(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); - assertNull(xmlTypeAnnotation.getNamespace()); - xmlTypeAnnotation.setNamespace(XML_TYPE_NAMESPACE); - assertEquals(XML_TYPE_NAMESPACE, xmlTypeAnnotation.getNamespace()); - - assertSourceContains("@XmlType(namespace = \"" + XML_TYPE_NAMESPACE + "\")", cu); - - xmlTypeAnnotation.setNamespace(null); - assertNull(xmlTypeAnnotation.getNamespace()); - - assertSourceContains("@XmlType", cu); - assertSourceDoesNotContain("@XmlType(namespace = \"" + XML_TYPE_NAMESPACE + "\")", cu); - } - - public void testGetFactoryMethod() throws Exception { - ICompilationUnit cu = this.createTestXmlTypeWithFactoryMethod(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); - assertTrue(xmlTypeAnnotation != null); - assertEquals(XML_TYPE_FACTORY_METHOD, xmlTypeAnnotation.getFactoryMethod()); - } - - public void testSetFactoryMethod() throws Exception { - ICompilationUnit cu = this.createTestXmlType(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); - assertNull(xmlTypeAnnotation.getFactoryMethod()); - xmlTypeAnnotation.setFactoryMethod(XML_TYPE_FACTORY_METHOD); - assertEquals(XML_TYPE_FACTORY_METHOD, xmlTypeAnnotation.getFactoryMethod()); - - assertSourceContains("@XmlType(factoryMethod = \"" + XML_TYPE_FACTORY_METHOD + "\")", cu); - - xmlTypeAnnotation.setFactoryMethod(null); - assertNull(xmlTypeAnnotation.getFactoryMethod()); - - assertSourceContains("@XmlType", cu); - assertSourceDoesNotContain("@XmlType(factoryMethod = \"" + XML_TYPE_FACTORY_METHOD + "\")", cu); - } - - public void testGetFactoryClass() throws Exception { - ICompilationUnit cu = this.createTestXmlTypeWithFactoryClass(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); - assertTrue(xmlTypeAnnotation != null); - assertEquals(XML_TYPE_FACTORY_CLASS, xmlTypeAnnotation.getFactoryClass()); - assertEquals("test." + XML_TYPE_FACTORY_CLASS, xmlTypeAnnotation.getFullyQualifiedFactoryClassName()); - } - - public void testSetFactoryClass() throws Exception { - ICompilationUnit cu = this.createTestXmlType(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); - assertNull(xmlTypeAnnotation.getFactoryClass()); - xmlTypeAnnotation.setFactoryClass(XML_TYPE_FACTORY_CLASS); - assertEquals(XML_TYPE_FACTORY_CLASS, xmlTypeAnnotation.getFactoryClass()); - - assertSourceContains("@XmlType(factoryClass = " + XML_TYPE_FACTORY_CLASS + ".class", cu); - - xmlTypeAnnotation.setFactoryClass(null); - assertNull(xmlTypeAnnotation.getFactoryClass()); - - assertSourceContains("@XmlType", cu); - assertSourceDoesNotContain("@XmlType(factoryClass = " + XML_TYPE_FACTORY_CLASS + ".class", cu); - } - - public void testGetPropOrder() throws Exception { - ICompilationUnit cu = this.createTestXmlTypeWithPropOrder(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); - assertTrue(xmlTypeAnnotation != null); - ListIterator propOrder = xmlTypeAnnotation.getPropOrder().iterator(); - assertEquals("foo", propOrder.next()); - assertEquals("bar", propOrder.next()); - } - - public void testGetPropOrderSize() throws Exception { - ICompilationUnit cu = this.createTestXmlTypeWithPropOrder(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); - assertTrue(xmlTypeAnnotation != null); - assertEquals(2, xmlTypeAnnotation.getPropOrderSize()); - } - - public void testAddProp() throws Exception { - ICompilationUnit cu = this.createTestXmlType(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); - assertTrue(xmlTypeAnnotation != null); - - xmlTypeAnnotation.addProp("fooo"); - xmlTypeAnnotation.addProp("barr"); - - assertSourceContains("@XmlType(propOrder = { \"fooo\", \"barr\" })", cu); - } - - public void testAddPropIndex() throws Exception { - ICompilationUnit cu = this.createTestXmlType(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); - assertTrue(xmlTypeAnnotation != null); - - xmlTypeAnnotation.addProp(0, "fooo"); - xmlTypeAnnotation.addProp(0, "barr"); - xmlTypeAnnotation.addProp(1, "blah"); - - assertSourceContains("@XmlType(propOrder = { \"barr\", \"blah\", \"fooo\" })", cu); - } - - public void testRemoveProp() throws Exception { - ICompilationUnit cu = this.createTestXmlTypeWithPropOrder(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); - assertTrue(xmlTypeAnnotation != null); - - xmlTypeAnnotation.removeProp("foo"); - assertSourceContains("@XmlType(propOrder = \"bar\")", cu); - - xmlTypeAnnotation.removeProp("bar"); - assertSourceContains("@XmlType", cu); - assertSourceDoesNotContain("propOrder", cu); - } - - public void testRemovePropIndex() throws Exception { - ICompilationUnit cu = this.createTestXmlTypeWithPropOrder(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); - assertTrue(xmlTypeAnnotation != null); - - xmlTypeAnnotation.removeProp(0); - assertSourceContains("@XmlType(propOrder = \"bar\")", cu); - - xmlTypeAnnotation.removeProp(0); - assertSourceContains("@XmlType", cu); - assertSourceDoesNotContain("propOrder", cu); - } - - public void testMoveProp() throws Exception { - ICompilationUnit cu = this.createTestXmlType(); - JavaResourceType resourceType = buildJavaResourceType(cu); - - XmlTypeAnnotation xmlTypeAnnotation = (XmlTypeAnnotation) resourceType.getAnnotation(JAXB.XML_TYPE); - assertTrue(xmlTypeAnnotation != null); - - xmlTypeAnnotation.addProp("fooo"); - xmlTypeAnnotation.addProp("barr"); - xmlTypeAnnotation.addProp("blah"); - assertSourceContains("@XmlType(propOrder = { \"fooo\", \"barr\", \"blah\" })", cu); - - xmlTypeAnnotation.moveProp(0, 1); - assertSourceContains("@XmlType(propOrder = { \"barr\", \"fooo\", \"blah\" })", cu); - - xmlTypeAnnotation.moveProp(2, 1); - assertSourceContains("@XmlType(propOrder = { \"barr\", \"blah\", \"fooo\" })", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlValueAnnotationTests.java b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlValueAnnotationTests.java deleted file mode 100644 index ef7dcf212f..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/src/org/eclipse/jpt/jaxb/core/tests/internal/resource/java/XmlValueAnnotationTests.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jaxb.core.tests.internal.resource.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jpt.common.utility.internal.iterators.ArrayIterator; -import org.eclipse.jpt.jaxb.core.resource.java.JAXB; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceField; -import org.eclipse.jpt.jaxb.core.resource.java.JavaResourceType; -import org.eclipse.jpt.jaxb.core.resource.java.XmlValueAnnotation; - -@SuppressWarnings("nls") -public class XmlValueAnnotationTests extends JaxbJavaResourceModelTestCase { - - public XmlValueAnnotationTests(String name) { - super(name); - } - - private ICompilationUnit createTestXmlValue() throws Exception { - return this.createTestType(new DefaultAnnotationWriter() { - @Override - public Iterator imports() { - return new ArrayIterator(JAXB.XML_VALUE); - } - @Override - public void appendIdFieldAnnotationTo(StringBuilder sb) { - sb.append("@XmlValue"); - } - }); - } - - public void testGetXmlValue() throws Exception { - ICompilationUnit cu = this.createTestXmlValue(); - JavaResourceType resourceType = buildJavaResourceType(cu); - JavaResourceField resourceAttribute = getField(resourceType, 0); - - XmlValueAnnotation xmlValueAnnotation = (XmlValueAnnotation) resourceAttribute.getAnnotation(JAXB.XML_VALUE); - assertTrue(xmlValueAnnotation != null); - - resourceAttribute.removeAnnotation(JAXB.XML_VALUE); - assertSourceDoesNotContain("@XmlValue", cu); - } -} diff --git a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/test.xml b/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/test.xml deleted file mode 100644 index 06df99e774..0000000000 --- a/jaxb/tests/org.eclipse.jpt.jaxb.core.tests/test.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/.cvsignore b/jpa/features/org.eclipse.jpt.eclipselink.feature/.cvsignore deleted file mode 100644 index c14487ceac..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -build.xml diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/.project b/jpa/features/org.eclipse.jpt.eclipselink.feature/.project deleted file mode 100644 index 93f19b18a8..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.eclipselink.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/.settings/org.eclipse.core.resources.prefs b/jpa/features/org.eclipse.jpt.eclipselink.feature/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index dab5837cb6..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun May 27 15:10:47 EDT 2007 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/build.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/build.properties deleted file mode 100644 index 7200939aca..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/build.properties +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -bin.includes = feature.xml,\ - eclipse_update_120.jpg,\ - epl-v10.html,\ - license.html,\ - feature.properties diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.eclipselink.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt.eclipselink.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/epl-v10.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/feature.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/feature.properties deleted file mode 100644 index 024fdc1a21..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/feature.properties +++ /dev/null @@ -1,163 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - EclipseLink Support (Optional) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Dali Java Persistence Tools - EclipseLink Support - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/feature.xml b/jpa/features/org.eclipse.jpt.eclipselink.feature/feature.xml deleted file mode 100644 index b87ac6cc64..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/feature.xml +++ /dev/null @@ -1,53 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - - - - - - - diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/license.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.html deleted file mode 100644 index d4916df475..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.html +++ /dev/null @@ -1,27 +0,0 @@ - - - -About - - - -

About This Content

- -

June 06, 2007

-

License

- -

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 http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

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.

- -

Source Code

-

This plug-in contains source code zip files ("Source Zips") that correspond to binary content in other plug-ins. These Source Zips may be distributed under different license -agreements and/or notices. Details about these license agreements and notices are contained in "about.html" files ("Abouts") located in sub-directories in the -src/ directory of this plug-in. Such Abouts govern your use of the Source Zips in that directory, not the EPL.

- - - diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.ini b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.ini deleted file mode 100644 index 2dee36a2e2..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.ini +++ /dev/null @@ -1,31 +0,0 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=eclipse32.gif - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (not translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - - - - diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.mappings b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.mappings deleted file mode 100644 index a28390a75e..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.properties deleted file mode 100644 index cb59e5f914..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/about.properties +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################### -# Copyright (c) 2008, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. -# -# Do not translate any values surrounded by {} - -blurb=Dali Java Persistence Tools - EclipseLink Support Source\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Eclipse contributors and others 2005. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools - diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/build.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/build.properties deleted file mode 100644 index 6dcfcd6269..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/build.properties +++ /dev/null @@ -1,21 +0,0 @@ -############################################################################### -# Copyright (c) 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = \ - about.html,\ - about.ini,\ - about.mappings,\ - about.properties,\ - eclipse32.gif,\ - plugin.properties,\ - plugin.xml,\ - src/**,\ - META-INF/ -sourcePlugin = true diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse32.gif b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse32.gif deleted file mode 100644 index e6ad7ccd75..0000000000 Binary files a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse32.gif and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse32.png b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse32.png deleted file mode 100644 index 50ae49de24..0000000000 Binary files a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse32.png and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/epl-v10.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/license.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/license.html deleted file mode 100644 index 5ad00ba719..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/license.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -Eclipse.org Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

March 17, 2005

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS - modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • - -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • - -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • - -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. - - - diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/plugin.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/plugin.properties deleted file mode 100644 index 262082f5ee..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateBundle/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2008, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools - EclipseLink Support -providerName = Eclipse Web Tools Platform diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/build.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/build.properties deleted file mode 100644 index 53abe6605b..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/build.properties +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################### -# Copyright (c) 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = \ - epl-v10.html,\ - eclipse_update_120.jpg,\ - feature.xml,\ - feature.properties,\ - license.html diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/epl-v10.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/feature.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/feature.properties deleted file mode 100644 index ae6b7ad4ef..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/feature.properties +++ /dev/null @@ -1,168 +0,0 @@ -############################################################################### -# Copyright (c) 2008, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - EclipseLink Support (Optional) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Source code zips for Dali Java Persistence Tools EclipseLink Support - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/license.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplateFeature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.html deleted file mode 100644 index d4916df475..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.html +++ /dev/null @@ -1,27 +0,0 @@ - - - -About - - - -

About This Content

- -

June 06, 2007

-

License

- -

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 http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

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.

- -

Source Code

-

This plug-in contains source code zip files ("Source Zips") that correspond to binary content in other plug-ins. These Source Zips may be distributed under different license -agreements and/or notices. Details about these license agreements and notices are contained in "about.html" files ("Abouts") located in sub-directories in the -src/ directory of this plug-in. Such Abouts govern your use of the Source Zips in that directory, not the EPL.

- - - diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.ini b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.ini deleted file mode 100644 index 2dee36a2e2..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.ini +++ /dev/null @@ -1,31 +0,0 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=eclipse32.gif - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (not translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - - - - diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.mappings b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.mappings deleted file mode 100644 index a28390a75e..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.properties deleted file mode 100644 index cb59e5f914..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/about.properties +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################### -# Copyright (c) 2008, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. -# -# Do not translate any values surrounded by {} - -blurb=Dali Java Persistence Tools - EclipseLink Support Source\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Eclipse contributors and others 2005. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools - diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/build.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/build.properties deleted file mode 100644 index 6dcfcd6269..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/build.properties +++ /dev/null @@ -1,21 +0,0 @@ -############################################################################### -# Copyright (c) 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = \ - about.html,\ - about.ini,\ - about.mappings,\ - about.properties,\ - eclipse32.gif,\ - plugin.properties,\ - plugin.xml,\ - src/**,\ - META-INF/ -sourcePlugin = true diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse32.gif b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse32.gif deleted file mode 100644 index e6ad7ccd75..0000000000 Binary files a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse32.gif and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse32.png b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse32.png deleted file mode 100644 index 50ae49de24..0000000000 Binary files a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse32.png and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/epl-v10.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/license.html b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/license.html deleted file mode 100644 index 5ad00ba719..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/license.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -Eclipse.org Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

March 17, 2005

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS - modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • - -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • - -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • - -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. - - - diff --git a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/plugin.properties b/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/plugin.properties deleted file mode 100644 index 262082f5ee..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink.feature/sourceTemplatePlugin/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2008, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools - EclipseLink Support -providerName = Eclipse Web Tools Platform diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.cvsignore b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.cvsignore deleted file mode 100644 index 6365d3dc51..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -feature.temp.folder -build.xml -org.eclipse.jpt_sdk.feature_1.0.1.* diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.project b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.project deleted file mode 100644 index 15f9157901..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.eclipselink_sdk.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.settings/org.eclipse.core.resources.prefs b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 6cc7d4b4cd..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun May 27 15:09:59 EDT 2007 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/build.properties b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/build.properties deleted file mode 100644 index b479ccbeeb..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -bin.includes = feature.xml,\ - license.html,\ - feature.properties,\ - epl-v10.html,\ - eclipse_update_120.jpg - -generate.feature@org.eclipse.jpt.eclipselink.feature.source=org.eclipse.jpt.eclipselink.feature diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/epl-v10.html b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/feature.properties b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/feature.properties deleted file mode 100644 index be836175c0..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/feature.properties +++ /dev/null @@ -1,163 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - EclipseLink Support SDK (Optional) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Source code archives for Dali Java Persistence - EclipseLink Support - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/feature.xml b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/feature.xml deleted file mode 100644 index f08cee5755..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/feature.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - diff --git a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/license.html b/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jpa/features/org.eclipse.jpt.eclipselink_sdk.feature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jpa/features/org.eclipse.jpt.feature/.cvsignore b/jpa/features/org.eclipse.jpt.feature/.cvsignore deleted file mode 100644 index c14487ceac..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -build.xml diff --git a/jpa/features/org.eclipse.jpt.feature/.project b/jpa/features/org.eclipse.jpt.feature/.project deleted file mode 100644 index c8eb2f0481..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/jpa/features/org.eclipse.jpt.feature/.settings/org.eclipse.core.resources.prefs b/jpa/features/org.eclipse.jpt.feature/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index dab5837cb6..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun May 27 15:10:47 EDT 2007 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/jpa/features/org.eclipse.jpt.feature/build.properties b/jpa/features/org.eclipse.jpt.feature/build.properties deleted file mode 100644 index 7200939aca..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/build.properties +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -bin.includes = feature.xml,\ - eclipse_update_120.jpg,\ - epl-v10.html,\ - license.html,\ - feature.properties diff --git a/jpa/features/org.eclipse.jpt.feature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.feature/epl-v10.html b/jpa/features/org.eclipse.jpt.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/jpa/features/org.eclipse.jpt.feature/feature.properties b/jpa/features/org.eclipse.jpt.feature/feature.properties deleted file mode 100644 index 43967bbc60..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/feature.properties +++ /dev/null @@ -1,163 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Dali Java Persistence Tools - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jpa/features/org.eclipse.jpt.feature/feature.xml b/jpa/features/org.eclipse.jpt.feature/feature.xml deleted file mode 100644 index 6a316ed45d..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/feature.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jpa/features/org.eclipse.jpt.feature/license.html b/jpa/features/org.eclipse.jpt.feature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.html b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.html deleted file mode 100644 index d4916df475..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.html +++ /dev/null @@ -1,27 +0,0 @@ - - - -About - - - -

About This Content

- -

June 06, 2007

-

License

- -

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 http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

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.

- -

Source Code

-

This plug-in contains source code zip files ("Source Zips") that correspond to binary content in other plug-ins. These Source Zips may be distributed under different license -agreements and/or notices. Details about these license agreements and notices are contained in "about.html" files ("Abouts") located in sub-directories in the -src/ directory of this plug-in. Such Abouts govern your use of the Source Zips in that directory, not the EPL.

- - - diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.ini b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.ini deleted file mode 100644 index 2dee36a2e2..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.ini +++ /dev/null @@ -1,31 +0,0 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=eclipse32.gif - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (not translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - - - - diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.mappings b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.mappings deleted file mode 100644 index a28390a75e..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.properties b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.properties deleted file mode 100644 index 20288ae9d9..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/about.properties +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. -# -# Do not translate any values surrounded by {} - -blurb=Dali Java Persistence Tools Source\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Eclipse contributors and others 2008. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools - diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/build.properties b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/build.properties deleted file mode 100644 index ce9529be74..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/build.properties +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = about.html, about.ini, about.mappings, about.properties, eclipse32.gif, plugin.properties, plugin.xml, src/**, META-INF/ -sourcePlugin = true diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse32.gif b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse32.gif deleted file mode 100644 index e6ad7ccd75..0000000000 Binary files a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse32.gif and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse32.png b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse32.png deleted file mode 100644 index 50ae49de24..0000000000 Binary files a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse32.png and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/epl-v10.html b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/license.html b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/license.html deleted file mode 100644 index 5ad00ba719..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/license.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -Eclipse.org Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

March 17, 2005

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS - modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • - -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • - -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • - -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. - - - diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/plugin.properties b/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/plugin.properties deleted file mode 100644 index c07594d901..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateBundle/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools -providerName = Eclipse Web Tools Platform diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/build.properties b/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/build.properties deleted file mode 100644 index f60dad3f94..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/build.properties +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = \ - epl-v10.html,\ - eclipse_update_120.jpg,\ - feature.xml,\ - feature.properties,\ - license.html diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/epl-v10.html b/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/feature.properties b/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/feature.properties deleted file mode 100644 index 8cccce1155..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/feature.properties +++ /dev/null @@ -1,168 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Source code zips for Dali Java Persistence Tools - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/license.html b/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplateFeature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.html b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.html deleted file mode 100644 index d4916df475..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.html +++ /dev/null @@ -1,27 +0,0 @@ - - - -About - - - -

About This Content

- -

June 06, 2007

-

License

- -

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 http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

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.

- -

Source Code

-

This plug-in contains source code zip files ("Source Zips") that correspond to binary content in other plug-ins. These Source Zips may be distributed under different license -agreements and/or notices. Details about these license agreements and notices are contained in "about.html" files ("Abouts") located in sub-directories in the -src/ directory of this plug-in. Such Abouts govern your use of the Source Zips in that directory, not the EPL.

- - - diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.ini b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.ini deleted file mode 100644 index 2dee36a2e2..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.ini +++ /dev/null @@ -1,31 +0,0 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=eclipse32.gif - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (not translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - - - - diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.mappings b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.mappings deleted file mode 100644 index a28390a75e..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.properties b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.properties deleted file mode 100644 index 021634dd5c..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/about.properties +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. -# -# Do not translate any values surrounded by {} - -blurb=Dali Java Persistence Tools Source\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Eclipse contributors and others 2008, 2010. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools - diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/build.properties b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/build.properties deleted file mode 100644 index ce9529be74..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/build.properties +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = about.html, about.ini, about.mappings, about.properties, eclipse32.gif, plugin.properties, plugin.xml, src/**, META-INF/ -sourcePlugin = true diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse32.gif b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse32.gif deleted file mode 100644 index e6ad7ccd75..0000000000 Binary files a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse32.gif and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse32.png b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse32.png deleted file mode 100644 index 50ae49de24..0000000000 Binary files a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse32.png and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/epl-v10.html b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/license.html b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/license.html deleted file mode 100644 index 5ad00ba719..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/license.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -Eclipse.org Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

March 17, 2005

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS - modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • - -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • - -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • - -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. - - - diff --git a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/plugin.properties b/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/plugin.properties deleted file mode 100644 index c07594d901..0000000000 --- a/jpa/features/org.eclipse.jpt.feature/sourceTemplatePlugin/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools -providerName = Eclipse Web Tools Platform diff --git a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/.cvsignore b/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/.cvsignore deleted file mode 100644 index 6365d3dc51..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -feature.temp.folder -build.xml -org.eclipse.jpt_sdk.feature_1.0.1.* diff --git a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/.project b/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/.project deleted file mode 100644 index f5f4862fc6..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.jpa.eclipselink_sdk.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/.settings/org.eclipse.core.resources.prefs b/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 6cc7d4b4cd..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun May 27 15:09:59 EDT 2007 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/build.properties b/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/build.properties deleted file mode 100644 index 60536095f6..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -bin.includes = feature.xml,\ - license.html,\ - feature.properties,\ - epl-v10.html,\ - eclipse_update_120.jpg - -generate.feature@org.eclipse.jpt.jpa.eclipselink.feature.source=org.eclipse.jpt.jpa.eclipselink.feature diff --git a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/epl-v10.html b/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/feature.properties b/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/feature.properties deleted file mode 100644 index be836175c0..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/feature.properties +++ /dev/null @@ -1,163 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - EclipseLink Support SDK (Optional) - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Source code archives for Dali Java Persistence - EclipseLink Support - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/feature.xml b/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/feature.xml deleted file mode 100644 index 200ee16275..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/feature.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - diff --git a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/license.html b/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.eclipselink_sdk.feature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/.cvsignore b/jpa/features/org.eclipse.jpt.jpa.feature/.cvsignore deleted file mode 100644 index c14487ceac..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -build.xml diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/.project b/jpa/features/org.eclipse.jpt.jpa.feature/.project deleted file mode 100644 index e1d95d7c7f..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.jpa.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/.settings/org.eclipse.core.resources.prefs b/jpa/features/org.eclipse.jpt.jpa.feature/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index dab5837cb6..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun May 27 15:10:47 EDT 2007 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/build.properties b/jpa/features/org.eclipse.jpt.jpa.feature/build.properties deleted file mode 100644 index 7200939aca..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/build.properties +++ /dev/null @@ -1,15 +0,0 @@ -############################################################################### -# Copyright (c) 2006 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -bin.includes = feature.xml,\ - eclipse_update_120.jpg,\ - epl-v10.html,\ - license.html,\ - feature.properties diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.jpa.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt.jpa.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/epl-v10.html b/jpa/features/org.eclipse.jpt.jpa.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/feature.properties b/jpa/features/org.eclipse.jpt.jpa.feature/feature.properties deleted file mode 100644 index 43967bbc60..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/feature.properties +++ /dev/null @@ -1,163 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Dali Java Persistence Tools - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/feature.xml b/jpa/features/org.eclipse.jpt.jpa.feature/feature.xml deleted file mode 100644 index dde24e4fcf..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/feature.xml +++ /dev/null @@ -1,132 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/license.html b/jpa/features/org.eclipse.jpt.jpa.feature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/about.html b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/about.html deleted file mode 100644 index d4916df475..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/about.html +++ /dev/null @@ -1,27 +0,0 @@ - - - -About - - - -

About This Content

- -

June 06, 2007

-

License

- -

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 http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

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.

- -

Source Code

-

This plug-in contains source code zip files ("Source Zips") that correspond to binary content in other plug-ins. These Source Zips may be distributed under different license -agreements and/or notices. Details about these license agreements and notices are contained in "about.html" files ("Abouts") located in sub-directories in the -src/ directory of this plug-in. Such Abouts govern your use of the Source Zips in that directory, not the EPL.

- - - diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/about.ini b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/about.ini deleted file mode 100644 index 2dee36a2e2..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/about.ini +++ /dev/null @@ -1,31 +0,0 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=eclipse32.gif - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (not translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - - - - diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/about.mappings b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/about.mappings deleted file mode 100644 index a28390a75e..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/about.properties b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/about.properties deleted file mode 100644 index 20288ae9d9..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/about.properties +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. -# -# Do not translate any values surrounded by {} - -blurb=Dali Java Persistence Tools Source\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Eclipse contributors and others 2008. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools - diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/build.properties b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/build.properties deleted file mode 100644 index ce9529be74..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/build.properties +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = about.html, about.ini, about.mappings, about.properties, eclipse32.gif, plugin.properties, plugin.xml, src/**, META-INF/ -sourcePlugin = true diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/eclipse32.gif b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/eclipse32.gif deleted file mode 100644 index e6ad7ccd75..0000000000 Binary files a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/eclipse32.gif and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/eclipse32.png b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/eclipse32.png deleted file mode 100644 index 50ae49de24..0000000000 Binary files a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/eclipse32.png and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/epl-v10.html b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/license.html b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/license.html deleted file mode 100644 index 5ad00ba719..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/license.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -Eclipse.org Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

March 17, 2005

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS - modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • - -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • - -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • - -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. - - - diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/plugin.properties b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/plugin.properties deleted file mode 100644 index c07594d901..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateBundle/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools -providerName = Eclipse Web Tools Platform diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/build.properties b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/build.properties deleted file mode 100644 index f60dad3f94..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/build.properties +++ /dev/null @@ -1,16 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = \ - epl-v10.html,\ - eclipse_update_120.jpg,\ - feature.xml,\ - feature.properties,\ - license.html diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/epl-v10.html b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/feature.properties b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/feature.properties deleted file mode 100644 index 8cccce1155..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/feature.properties +++ /dev/null @@ -1,168 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Source code zips for Dali Java Persistence Tools - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/license.html b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplateFeature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/about.html b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/about.html deleted file mode 100644 index d4916df475..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/about.html +++ /dev/null @@ -1,27 +0,0 @@ - - - -About - - - -

About This Content

- -

June 06, 2007

-

License

- -

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 http://www.eclipse.org/legal/epl-v10.html. -For purposes of the EPL, "Program" will mean the Content.

- -

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.

- -

Source Code

-

This plug-in contains source code zip files ("Source Zips") that correspond to binary content in other plug-ins. These Source Zips may be distributed under different license -agreements and/or notices. Details about these license agreements and notices are contained in "about.html" files ("Abouts") located in sub-directories in the -src/ directory of this plug-in. Such Abouts govern your use of the Source Zips in that directory, not the EPL.

- - - diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/about.ini b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/about.ini deleted file mode 100644 index 2dee36a2e2..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/about.ini +++ /dev/null @@ -1,31 +0,0 @@ -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=eclipse32.gif - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (not translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - - - - diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/about.mappings b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/about.mappings deleted file mode 100644 index a28390a75e..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/about.properties b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/about.properties deleted file mode 100644 index 021634dd5c..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/about.properties +++ /dev/null @@ -1,26 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. -# -# Do not translate any values surrounded by {} - -blurb=Dali Java Persistence Tools Source\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Eclipse contributors and others 2008, 2010. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools - diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/build.properties b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/build.properties deleted file mode 100644 index ce9529be74..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/build.properties +++ /dev/null @@ -1,12 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2008 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -bin.includes = about.html, about.ini, about.mappings, about.properties, eclipse32.gif, plugin.properties, plugin.xml, src/**, META-INF/ -sourcePlugin = true diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/eclipse32.gif b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/eclipse32.gif deleted file mode 100644 index e6ad7ccd75..0000000000 Binary files a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/eclipse32.gif and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/eclipse32.png b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/eclipse32.png deleted file mode 100644 index 50ae49de24..0000000000 Binary files a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/eclipse32.png and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/epl-v10.html b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/epl-v10.html deleted file mode 100644 index 022ad2955b..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/license.html b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/license.html deleted file mode 100644 index 5ad00ba719..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/license.html +++ /dev/null @@ -1,86 +0,0 @@ - - - - -Eclipse.org Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

March 17, 2005

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse.org CVS repository ("Repository") in CVS - modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • - -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • - -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • - -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- - -

Note: if a Feature made available by the Eclipse Foundation is installed using the Eclipse Update Manager, you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -Java and all Java-based trademarks are trademarks of Sun Microsystems, Inc. in the United States, other countries, or both. - - - diff --git a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/plugin.properties b/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/plugin.properties deleted file mode 100644 index c07594d901..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa.feature/sourceTemplatePlugin/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools -providerName = Eclipse Web Tools Platform diff --git a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/.cvsignore b/jpa/features/org.eclipse.jpt.jpa_sdk.feature/.cvsignore deleted file mode 100644 index 087aebe7cd..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -feature.temp.folder -build.xml -org.eclipse.jpt.jpa_sdk.feature_1.0.1.* diff --git a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/.project b/jpa/features/org.eclipse.jpt.jpa_sdk.feature/.project deleted file mode 100644 index f933b5eefa..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.jpa_sdk.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/.settings/org.eclipse.core.resources.prefs b/jpa/features/org.eclipse.jpt.jpa_sdk.feature/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 6cc7d4b4cd..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun May 27 15:09:59 EDT 2007 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/build.properties b/jpa/features/org.eclipse.jpt.jpa_sdk.feature/build.properties deleted file mode 100644 index 923e8a3273..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -bin.includes = feature.xml,\ - license.html,\ - feature.properties,\ - epl-v10.html,\ - eclipse_update_120.jpg - -generate.feature@org.eclipse.jpt.jpa.feature.source=org.eclipse.jpt.jpa.feature diff --git a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.jpa_sdk.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/epl-v10.html b/jpa/features/org.eclipse.jpt.jpa_sdk.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/feature.properties b/jpa/features/org.eclipse.jpt.jpa_sdk.feature/feature.properties deleted file mode 100644 index a2fe8ca5c2..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/feature.properties +++ /dev/null @@ -1,163 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools SDK - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Source code archives for Dali Java Persistence Tools - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/feature.xml b/jpa/features/org.eclipse.jpt.jpa_sdk.feature/feature.xml deleted file mode 100644 index be03d1eee2..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/feature.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - diff --git a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/license.html b/jpa/features/org.eclipse.jpt.jpa_sdk.feature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jpa/features/org.eclipse.jpt.jpa_sdk.feature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jpa/features/org.eclipse.jpt.tests.feature/.cvsignore b/jpa/features/org.eclipse.jpt.tests.feature/.cvsignore deleted file mode 100644 index c14487ceac..0000000000 --- a/jpa/features/org.eclipse.jpt.tests.feature/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -build.xml diff --git a/jpa/features/org.eclipse.jpt.tests.feature/.project b/jpa/features/org.eclipse.jpt.tests.feature/.project deleted file mode 100644 index 91760f21b4..0000000000 --- a/jpa/features/org.eclipse.jpt.tests.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt.tests.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/jpa/features/org.eclipse.jpt.tests.feature/.settings/org.eclipse.core.resources.prefs b/jpa/features/org.eclipse.jpt.tests.feature/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 235b84ae83..0000000000 --- a/jpa/features/org.eclipse.jpt.tests.feature/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun May 27 15:11:17 EDT 2007 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/jpa/features/org.eclipse.jpt.tests.feature/build.properties b/jpa/features/org.eclipse.jpt.tests.feature/build.properties deleted file mode 100644 index d6a4dce096..0000000000 --- a/jpa/features/org.eclipse.jpt.tests.feature/build.properties +++ /dev/null @@ -1,10 +0,0 @@ -bin.includes = feature.xml,\ - eclipse_update_120.jpg,\ - epl-v10.html,\ - license.html,\ - feature.properties -src.includes = license.html,\ - feature.xml,\ - epl-v10.html,\ - eclipse_update_120.jpg,\ - build.properties diff --git a/jpa/features/org.eclipse.jpt.tests.feature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt.tests.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt.tests.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt.tests.feature/epl-v10.html b/jpa/features/org.eclipse.jpt.tests.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jpa/features/org.eclipse.jpt.tests.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/jpa/features/org.eclipse.jpt.tests.feature/feature.properties b/jpa/features/org.eclipse.jpt.tests.feature/feature.properties deleted file mode 100644 index bb09352da6..0000000000 --- a/jpa/features/org.eclipse.jpt.tests.feature/feature.properties +++ /dev/null @@ -1,171 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# feature.properties -# contains externalized strings for feature.xml -# "%foo" in feature.xml corresponds to the key "foo" in this file -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file should be translated. - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools JUnit Tests - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - -# "updateSiteName" property - label for the update site -# TOREVIEW - updateSiteName -updateSiteName=Web Tools Platform (WTP) Updates - -# "description" property - description of the feature -description=Dali Java Persistence Tools Tests - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jpa/features/org.eclipse.jpt.tests.feature/feature.xml b/jpa/features/org.eclipse.jpt.tests.feature/feature.xml deleted file mode 100644 index 7a516429ba..0000000000 --- a/jpa/features/org.eclipse.jpt.tests.feature/feature.xml +++ /dev/null @@ -1,50 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - - - - - diff --git a/jpa/features/org.eclipse.jpt.tests.feature/license.html b/jpa/features/org.eclipse.jpt.tests.feature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jpa/features/org.eclipse.jpt.tests.feature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/.cvsignore b/jpa/features/org.eclipse.jpt_sdk.feature/.cvsignore deleted file mode 100644 index 6365d3dc51..0000000000 --- a/jpa/features/org.eclipse.jpt_sdk.feature/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -feature.temp.folder -build.xml -org.eclipse.jpt_sdk.feature_1.0.1.* diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/.project b/jpa/features/org.eclipse.jpt_sdk.feature/.project deleted file mode 100644 index 33da750336..0000000000 --- a/jpa/features/org.eclipse.jpt_sdk.feature/.project +++ /dev/null @@ -1,17 +0,0 @@ - - - org.eclipse.jpt_sdk.feature - - - - - - org.eclipse.pde.FeatureBuilder - - - - - - org.eclipse.pde.FeatureNature - - diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/.settings/org.eclipse.core.resources.prefs b/jpa/features/org.eclipse.jpt_sdk.feature/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 6cc7d4b4cd..0000000000 --- a/jpa/features/org.eclipse.jpt_sdk.feature/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun May 27 15:09:59 EDT 2007 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/build.properties b/jpa/features/org.eclipse.jpt_sdk.feature/build.properties deleted file mode 100644 index 2d7ab8d203..0000000000 --- a/jpa/features/org.eclipse.jpt_sdk.feature/build.properties +++ /dev/null @@ -1,7 +0,0 @@ -bin.includes = feature.xml,\ - license.html,\ - feature.properties,\ - epl-v10.html,\ - eclipse_update_120.jpg - -generate.feature@org.eclipse.jpt.feature.source=org.eclipse.jpt.feature diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/eclipse_update_120.jpg b/jpa/features/org.eclipse.jpt_sdk.feature/eclipse_update_120.jpg deleted file mode 100644 index bfdf708ad6..0000000000 Binary files a/jpa/features/org.eclipse.jpt_sdk.feature/eclipse_update_120.jpg and /dev/null differ diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/epl-v10.html b/jpa/features/org.eclipse.jpt_sdk.feature/epl-v10.html deleted file mode 100644 index ed4b196655..0000000000 --- a/jpa/features/org.eclipse.jpt_sdk.feature/epl-v10.html +++ /dev/null @@ -1,328 +0,0 @@ - - - - - - - - -Eclipse Public License - Version 1.0 - - - - - - -
- -

Eclipse Public License - v 1.0 -

- -

THE ACCOMPANYING PROGRAM IS PROVIDED UNDER -THE TERMS OF THIS ECLIPSE PUBLIC LICENSE ("AGREEMENT"). ANY USE, -REPRODUCTION OR DISTRIBUTION OF THE PROGRAM CONSTITUTES RECIPIENT'S ACCEPTANCE -OF THIS AGREEMENT.

- -

1. DEFINITIONS

- -

"Contribution" means:

- -

a) -in the case of the initial Contributor, the initial code and documentation -distributed under this Agreement, and
-b) in the case of each subsequent Contributor:

- -

i) -changes to the Program, and

- -

ii) -additions to the Program;

- -

where -such changes and/or additions to the Program originate from and are distributed -by that particular Contributor. A Contribution 'originates' from a Contributor -if it was added to the Program by such Contributor itself or anyone acting on -such Contributor's behalf. Contributions do not include additions to the -Program which: (i) are separate modules of software distributed in conjunction -with the Program under their own license agreement, and (ii) are not derivative -works of the Program.

- -

"Contributor" means any person or -entity that distributes the Program.

- -

"Licensed Patents " mean patent -claims licensable by a Contributor which are necessarily infringed by the use -or sale of its Contribution alone or when combined with the Program.

- -

"Program" means the Contributions -distributed in accordance with this Agreement.

- -

"Recipient" means anyone who -receives the Program under this Agreement, including all Contributors.

- -

2. GRANT OF RIGHTS

- -

a) -Subject to the terms of this Agreement, each Contributor hereby grants Recipient -a non-exclusive, worldwide, royalty-free copyright license to reproduce, prepare derivative works of, publicly -display, publicly perform, distribute and sublicense the Contribution of such -Contributor, if any, and such derivative works, in source code and object code -form.

- -

b) -Subject to the terms of this Agreement, each Contributor hereby grants -Recipient a non-exclusive, worldwide, royalty-free -patent license under Licensed Patents to make, use, sell, offer to sell, import -and otherwise transfer the Contribution of such Contributor, if any, in source -code and object code form. This patent license shall apply to the combination -of the Contribution and the Program if, at the time the Contribution is added -by the Contributor, such addition of the Contribution causes such combination -to be covered by the Licensed Patents. The patent license shall not apply to -any other combinations which include the Contribution. No hardware per se is -licensed hereunder.

- -

c) -Recipient understands that although each Contributor grants the licenses to its -Contributions set forth herein, no assurances are provided by any Contributor -that the Program does not infringe the patent or other intellectual property -rights of any other entity. Each Contributor disclaims any liability to Recipient -for claims brought by any other entity based on infringement of intellectual -property rights or otherwise. As a condition to exercising the rights and -licenses granted hereunder, each Recipient hereby assumes sole responsibility -to secure any other intellectual property rights needed, if any. For example, -if a third party patent license is required to allow Recipient to distribute -the Program, it is Recipient's responsibility to acquire that license before -distributing the Program.

- -

d) -Each Contributor represents that to its knowledge it has sufficient copyright -rights in its Contribution, if any, to grant the copyright license set forth in -this Agreement.

- -

3. REQUIREMENTS

- -

A Contributor may choose to distribute the -Program in object code form under its own license agreement, provided that: -

- -

a) -it complies with the terms and conditions of this Agreement; and

- -

b) -its license agreement:

- -

i) -effectively disclaims on behalf of all Contributors all warranties and -conditions, express and implied, including warranties or conditions of title -and non-infringement, and implied warranties or conditions of merchantability -and fitness for a particular purpose;

- -

ii) -effectively excludes on behalf of all Contributors all liability for damages, -including direct, indirect, special, incidental and consequential damages, such -as lost profits;

- -

iii) -states that any provisions which differ from this Agreement are offered by that -Contributor alone and not by any other party; and

- -

iv) -states that source code for the Program is available from such Contributor, and -informs licensees how to obtain it in a reasonable manner on or through a -medium customarily used for software exchange.

- -

When the Program is made available in source -code form:

- -

a) -it must be made available under this Agreement; and

- -

b) a -copy of this Agreement must be included with each copy of the Program.

- -

Contributors may not remove or alter any -copyright notices contained within the Program.

- -

Each Contributor must identify itself as the -originator of its Contribution, if any, in a manner that reasonably allows -subsequent Recipients to identify the originator of the Contribution.

- -

4. COMMERCIAL DISTRIBUTION

- -

Commercial distributors of software may -accept certain responsibilities with respect to end users, business partners -and the like. While this license is intended to facilitate the commercial use -of the Program, the Contributor who includes the Program in a commercial -product offering should do so in a manner which does not create potential -liability for other Contributors. Therefore, if a Contributor includes the -Program in a commercial product offering, such Contributor ("Commercial -Contributor") hereby agrees to defend and indemnify every other -Contributor ("Indemnified Contributor") against any losses, damages and -costs (collectively "Losses") arising from claims, lawsuits and other -legal actions brought by a third party against the Indemnified Contributor to -the extent caused by the acts or omissions of such Commercial Contributor in -connection with its distribution of the Program in a commercial product -offering. The obligations in this section do not apply to any claims or Losses -relating to any actual or alleged intellectual property infringement. In order -to qualify, an Indemnified Contributor must: a) promptly notify the Commercial -Contributor in writing of such claim, and b) allow the Commercial Contributor -to control, and cooperate with the Commercial Contributor in, the defense and -any related settlement negotiations. The Indemnified Contributor may participate -in any such claim at its own expense.

- -

For example, a Contributor might include the -Program in a commercial product offering, Product X. That Contributor is then a -Commercial Contributor. If that Commercial Contributor then makes performance -claims, or offers warranties related to Product X, those performance claims and -warranties are such Commercial Contributor's responsibility alone. Under this -section, the Commercial Contributor would have to defend claims against the -other Contributors related to those performance claims and warranties, and if a -court requires any other Contributor to pay any damages as a result, the -Commercial Contributor must pay those damages.

- -

5. NO WARRANTY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, THE PROGRAM IS PROVIDED ON AN "AS IS" BASIS, WITHOUT -WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED INCLUDING, -WITHOUT LIMITATION, ANY WARRANTIES OR CONDITIONS OF TITLE, NON-INFRINGEMENT, -MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. Each Recipient is solely -responsible for determining the appropriateness of using and distributing the -Program and assumes all risks associated with its exercise of rights under this -Agreement , including but not limited to the risks and costs of program errors, -compliance with applicable laws, damage to or loss of data, programs or -equipment, and unavailability or interruption of operations.

- -

6. DISCLAIMER OF LIABILITY

- -

EXCEPT AS EXPRESSLY SET FORTH IN THIS -AGREEMENT, NEITHER RECIPIENT NOR ANY CONTRIBUTORS SHALL HAVE ANY LIABILITY FOR -ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES -(INCLUDING WITHOUT LIMITATION LOST PROFITS), HOWEVER CAUSED AND ON ANY THEORY -OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING -NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OR DISTRIBUTION OF -THE PROGRAM OR THE EXERCISE OF ANY RIGHTS GRANTED HEREUNDER, EVEN IF ADVISED OF -THE POSSIBILITY OF SUCH DAMAGES.

- -

7. GENERAL

- -

If any provision of this Agreement is invalid -or unenforceable under applicable law, it shall not affect the validity or -enforceability of the remainder of the terms of this Agreement, and without -further action by the parties hereto, such provision shall be reformed to the -minimum extent necessary to make such provision valid and enforceable.

- -

If Recipient institutes patent litigation -against any entity (including a cross-claim or counterclaim in a lawsuit) -alleging that the Program itself (excluding combinations of the Program with -other software or hardware) infringes such Recipient's patent(s), then such -Recipient's rights granted under Section 2(b) shall terminate as of the date -such litigation is filed.

- -

All Recipient's rights under this Agreement -shall terminate if it fails to comply with any of the material terms or -conditions of this Agreement and does not cure such failure in a reasonable -period of time after becoming aware of such noncompliance. If all Recipient's -rights under this Agreement terminate, Recipient agrees to cease use and -distribution of the Program as soon as reasonably practicable. However, -Recipient's obligations under this Agreement and any licenses granted by -Recipient relating to the Program shall continue and survive.

- -

Everyone is permitted to copy and distribute -copies of this Agreement, but in order to avoid inconsistency the Agreement is -copyrighted and may only be modified in the following manner. The Agreement -Steward reserves the right to publish new versions (including revisions) of -this Agreement from time to time. No one other than the Agreement Steward has -the right to modify this Agreement. The Eclipse Foundation is the initial -Agreement Steward. The Eclipse Foundation may assign the responsibility to -serve as the Agreement Steward to a suitable separate entity. Each new version -of the Agreement will be given a distinguishing version number. The Program -(including Contributions) may always be distributed subject to the version of -the Agreement under which it was received. In addition, after a new version of -the Agreement is published, Contributor may elect to distribute the Program -(including its Contributions) under the new version. Except as expressly stated -in Sections 2(a) and 2(b) above, Recipient receives no rights or licenses to -the intellectual property of any Contributor under this Agreement, whether -expressly, by implication, estoppel or otherwise. All rights in the Program not -expressly granted under this Agreement are reserved.

- -

This Agreement is governed by the laws of the -State of New York and the intellectual property laws of the United States of -America. No party to this Agreement will bring a legal action under this -Agreement more than one year after the cause of action arose. Each party waives -its rights to a jury trial in any resulting litigation.

- -

 

- -
- - - - \ No newline at end of file diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/feature.properties b/jpa/features/org.eclipse.jpt_sdk.feature/feature.properties deleted file mode 100644 index a2fe8ca5c2..0000000000 --- a/jpa/features/org.eclipse.jpt_sdk.feature/feature.properties +++ /dev/null @@ -1,163 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# "featureName" property - name of the feature -featureName=Dali Java Persistence Tools SDK - -# "providerName" property - name of the company that provides the feature -providerName=Eclipse Web Tools Platform - - -# "description" property - description of the feature -description=Source code archives for Dali Java Persistence Tools - -# "copyright" property - text of the "Feature Update Copyright" -copyright=\ -Copyright (c) 2006, 2010 Oracle Corporation.\n\ -All rights reserved. This program and the accompanying materials\n\ -are made available under the terms of the Eclipse Public License v1.0\n\ -which accompanies this distribution, and is available at\n\ -http://www.eclipse.org/legal/epl-v10.html\n\ -\n\ -Contributors:\n\ - Oracle - initial API and implementation\n -################ end of copyright property #################################### - -# "licenseURL" property - URL of the "Feature License" -# do not translate value - just change to point to a locale-specific HTML page -licenseURL=license.html - -# "license" property - text of the "Feature Update License" -# should be plain text version of license agreement pointed to be "licenseURL" -license=\ -Eclipse Foundation Software User Agreement\n\ -April 14, 2010\n\ -\n\ -Usage Of Content\n\ -\n\ -THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR\n\ -OTHER MATERIALS FOR OPEN SOURCE PROJECTS (COLLECTIVELY "CONTENT").\n\ -USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS\n\ -AGREEMENT AND/OR THE TERMS AND CONDITIONS OF LICENSE AGREEMENTS OR\n\ -NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU\n\ -AGREE THAT YOUR USE OF THE CONTENT IS GOVERNED BY THIS AGREEMENT\n\ -AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS\n\ -OR NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE\n\ -TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND CONDITIONS\n\ -OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED\n\ -BELOW, THEN YOU MAY NOT USE THE CONTENT.\n\ -\n\ -Applicable Licenses\n\ -\n\ -Unless otherwise indicated, all Content made available by the\n\ -Eclipse Foundation is provided to you under the terms and conditions of\n\ -the Eclipse Public License Version 1.0 ("EPL"). A copy of the EPL is\n\ -provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html.\n\ -For purposes of the EPL, "Program" will mean the Content.\n\ -\n\ -Content includes, but is not limited to, source code, object code,\n\ -documentation and other files maintained in the Eclipse Foundation source code\n\ -repository ("Repository") in software modules ("Modules") and made available\n\ -as downloadable archives ("Downloads").\n\ -\n\ - - Content may be structured and packaged into modules to facilitate delivering,\n\ - extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"),\n\ - plug-in fragments ("Fragments"), and features ("Features").\n\ - - Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java(TM) ARchive)\n\ - in a directory named "plugins".\n\ - - A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material.\n\ - Each Feature may be packaged as a sub-directory in a directory named "features".\n\ - Within a Feature, files named "feature.xml" may contain a list of the names and version\n\ - numbers of the Plug-ins and/or Fragments associated with that Feature.\n\ - - Features may also include other Features ("Included Features"). Within a Feature, files\n\ - named "feature.xml" may contain a list of the names and version numbers of Included Features.\n\ -\n\ -The terms and conditions governing Plug-ins and Fragments should be\n\ -contained in files named "about.html" ("Abouts"). The terms and\n\ -conditions governing Features and Included Features should be contained\n\ -in files named "license.html" ("Feature Licenses"). Abouts and Feature\n\ -Licenses may be located in any directory of a Download or Module\n\ -including, but not limited to the following locations:\n\ -\n\ - - The top-level (root) directory\n\ - - Plug-in and Fragment directories\n\ - - Inside Plug-ins and Fragments packaged as JARs\n\ - - Sub-directories of the directory named "src" of certain Plug-ins\n\ - - Feature directories\n\ -\n\ -Note: if a Feature made available by the Eclipse Foundation is installed using the\n\ -Provisioning Technology (as defined below), you must agree to a license ("Feature \n\ -Update License") during the installation process. If the Feature contains\n\ -Included Features, the Feature Update License should either provide you\n\ -with the terms and conditions governing the Included Features or inform\n\ -you where you can locate them. Feature Update Licenses may be found in\n\ -the "license" property of files named "feature.properties" found within a Feature.\n\ -Such Abouts, Feature Licenses, and Feature Update Licenses contain the\n\ -terms and conditions (or references to such terms and conditions) that\n\ -govern your use of the associated Content in that directory.\n\ -\n\ -THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER\n\ -TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS.\n\ -SOME OF THESE OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):\n\ -\n\ - - Common Public License Version 1.0 (available at http://www.eclipse.org/legal/cpl-v10.html)\n\ - - Apache Software License 1.1 (available at http://www.apache.org/licenses/LICENSE)\n\ - - Apache Software License 2.0 (available at http://www.apache.org/licenses/LICENSE-2.0)\n\ - - Metro Link Public License 1.00 (available at http://www.opengroup.org/openmotif/supporters/metrolink/license.html)\n\ - - Mozilla Public License Version 1.1 (available at http://www.mozilla.org/MPL/MPL-1.1.html)\n\ -\n\ -IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR\n\ -TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License\n\ -is provided, please contact the Eclipse Foundation to determine what terms and conditions\n\ -govern that particular Content.\n\ -\n\ -\n\Use of Provisioning Technology\n\ -\n\ -The Eclipse Foundation makes available provisioning software, examples of which include,\n\ -but are not limited to, p2 and the Eclipse Update Manager ("Provisioning Technology") for\n\ -the purpose of allowing users to install software, documentation, information and/or\n\ -other materials (collectively "Installable Software"). This capability is provided with\n\ -the intent of allowing such users to install, extend and update Eclipse-based products.\n\ -Information about packaging Installable Software is available at\n\ -http://eclipse.org/equinox/p2/repository_packaging.html ("Specification").\n\ -\n\ -You may use Provisioning Technology to allow other parties to install Installable Software.\n\ -You shall be responsible for enabling the applicable license agreements relating to the\n\ -Installable Software to be presented to, and accepted by, the users of the Provisioning Technology\n\ -in accordance with the Specification. By using Provisioning Technology in such a manner and\n\ -making it available in accordance with the Specification, you further acknowledge your\n\ -agreement to, and the acquisition of all necessary rights to permit the following:\n\ -\n\ - 1. A series of actions may occur ("Provisioning Process") in which a user may execute\n\ - the Provisioning Technology on a machine ("Target Machine") with the intent of installing,\n\ - extending or updating the functionality of an Eclipse-based product.\n\ - 2. During the Provisioning Process, the Provisioning Technology may cause third party\n\ - Installable Software or a portion thereof to be accessed and copied to the Target Machine.\n\ - 3. Pursuant to the Specification, you will provide to the user the terms and conditions that\n\ - govern the use of the Installable Software ("Installable Software Agreement") and such\n\ - Installable Software Agreement shall be accessed from the Target Machine in accordance\n\ - with the Specification. Such Installable Software Agreement must inform the user of the\n\ - terms and conditions that govern the Installable Software and must solicit acceptance by\n\ - the end user in the manner prescribed in such Installable Software Agreement. Upon such\n\ - indication of agreement by the user, the provisioning Technology will complete installation\n\ - of the Installable Software.\n\ -\n\ -Cryptography\n\ -\n\ -Content may contain encryption software. The country in which you are\n\ -currently may have restrictions on the import, possession, and use,\n\ -and/or re-export to another country, of encryption software. BEFORE\n\ -using any encryption software, please check the country's laws,\n\ -regulations and policies concerning the import, possession, or use, and\n\ -re-export of encryption software, to see if this is permitted.\n\ -\n\ -Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.\n -########### end of license property ########################################## diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/feature.xml b/jpa/features/org.eclipse.jpt_sdk.feature/feature.xml deleted file mode 100644 index 16e6aa9486..0000000000 --- a/jpa/features/org.eclipse.jpt_sdk.feature/feature.xml +++ /dev/null @@ -1,35 +0,0 @@ - - - - - %description - - - - %copyright - - - - %license - - - - - - - - - diff --git a/jpa/features/org.eclipse.jpt_sdk.feature/license.html b/jpa/features/org.eclipse.jpt_sdk.feature/license.html deleted file mode 100644 index c184ca36a9..0000000000 --- a/jpa/features/org.eclipse.jpt_sdk.feature/license.html +++ /dev/null @@ -1,107 +0,0 @@ - - - - - -Eclipse Foundation Software User Agreement - - - -

Eclipse Foundation Software User Agreement

-

April 14, 2010

- -

Usage Of Content

- -

THE ECLIPSE FOUNDATION MAKES AVAILABLE SOFTWARE, DOCUMENTATION, INFORMATION AND/OR OTHER MATERIALS FOR OPEN SOURCE PROJECTS - (COLLECTIVELY "CONTENT"). USE OF THE CONTENT IS GOVERNED BY THE TERMS AND CONDITIONS OF THIS AGREEMENT AND/OR THE TERMS AND - CONDITIONS OF LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW. BY USING THE CONTENT, YOU AGREE THAT YOUR USE - OF THE CONTENT IS GOVERNED BY THIS AGREEMENT AND/OR THE TERMS AND CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR - NOTICES INDICATED OR REFERENCED BELOW. IF YOU DO NOT AGREE TO THE TERMS AND CONDITIONS OF THIS AGREEMENT AND THE TERMS AND - CONDITIONS OF ANY APPLICABLE LICENSE AGREEMENTS OR NOTICES INDICATED OR REFERENCED BELOW, THEN YOU MAY NOT USE THE CONTENT.

- -

Applicable Licenses

- -

Unless otherwise indicated, all Content made available by the Eclipse Foundation is provided to you under the terms and conditions of the Eclipse Public License Version 1.0 - ("EPL"). A copy of the EPL is provided with this Content and is also available at http://www.eclipse.org/legal/epl-v10.html. - For purposes of the EPL, "Program" will mean the Content.

- -

Content includes, but is not limited to, source code, object code, documentation and other files maintained in the Eclipse Foundation source code - repository ("Repository") in software modules ("Modules") and made available as downloadable archives ("Downloads").

- -
    -
  • Content may be structured and packaged into modules to facilitate delivering, extending, and upgrading the Content. Typical modules may include plug-ins ("Plug-ins"), plug-in fragments ("Fragments"), and features ("Features").
  • -
  • Each Plug-in or Fragment may be packaged as a sub-directory or JAR (Java™ ARchive) in a directory named "plugins".
  • -
  • A Feature is a bundle of one or more Plug-ins and/or Fragments and associated material. Each Feature may be packaged as a sub-directory in a directory named "features". Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of the Plug-ins - and/or Fragments associated with that Feature.
  • -
  • Features may also include other Features ("Included Features"). Within a Feature, files named "feature.xml" may contain a list of the names and version numbers of Included Features.
  • -
- -

The terms and conditions governing Plug-ins and Fragments should be contained in files named "about.html" ("Abouts"). The terms and conditions governing Features and -Included Features should be contained in files named "license.html" ("Feature Licenses"). Abouts and Feature Licenses may be located in any directory of a Download or Module -including, but not limited to the following locations:

- -
    -
  • The top-level (root) directory
  • -
  • Plug-in and Fragment directories
  • -
  • Inside Plug-ins and Fragments packaged as JARs
  • -
  • Sub-directories of the directory named "src" of certain Plug-ins
  • -
  • Feature directories
  • -
- -

Note: if a Feature made available by the Eclipse Foundation is installed using the Provisioning Technology (as defined below), you must agree to a license ("Feature Update License") during the -installation process. If the Feature contains Included Features, the Feature Update License should either provide you with the terms and conditions governing the Included Features or -inform you where you can locate them. Feature Update Licenses may be found in the "license" property of files named "feature.properties" found within a Feature. -Such Abouts, Feature Licenses, and Feature Update Licenses contain the terms and conditions (or references to such terms and conditions) that govern your use of the associated Content in -that directory.

- -

THE ABOUTS, FEATURE LICENSES, AND FEATURE UPDATE LICENSES MAY REFER TO THE EPL OR OTHER LICENSE AGREEMENTS, NOTICES OR TERMS AND CONDITIONS. SOME OF THESE -OTHER LICENSE AGREEMENTS MAY INCLUDE (BUT ARE NOT LIMITED TO):

- - - -

IT IS YOUR OBLIGATION TO READ AND ACCEPT ALL SUCH TERMS AND CONDITIONS PRIOR TO USE OF THE CONTENT. If no About, Feature License, or Feature Update License is provided, please -contact the Eclipse Foundation to determine what terms and conditions govern that particular Content.

- - -

Use of Provisioning Technology

- -

The Eclipse Foundation makes available provisioning software, examples of which include, but are not limited to, p2 and the Eclipse - Update Manager ("Provisioning Technology") for the purpose of allowing users to install software, documentation, information and/or - other materials (collectively "Installable Software"). This capability is provided with the intent of allowing such users to - install, extend and update Eclipse-based products. Information about packaging Installable Software is available at http://eclipse.org/equinox/p2/repository_packaging.html - ("Specification").

- -

You may use Provisioning Technology to allow other parties to install Installable Software. You shall be responsible for enabling the - applicable license agreements relating to the Installable Software to be presented to, and accepted by, the users of the Provisioning Technology - in accordance with the Specification. By using Provisioning Technology in such a manner and making it available in accordance with the - Specification, you further acknowledge your agreement to, and the acquisition of all necessary rights to permit the following:

- -
    -
  1. A series of actions may occur ("Provisioning Process") in which a user may execute the Provisioning Technology - on a machine ("Target Machine") with the intent of installing, extending or updating the functionality of an Eclipse-based - product.
  2. -
  3. During the Provisioning Process, the Provisioning Technology may cause third party Installable Software or a portion thereof to be - accessed and copied to the Target Machine.
  4. -
  5. Pursuant to the Specification, you will provide to the user the terms and conditions that govern the use of the Installable - Software ("Installable Software Agreement") and such Installable Software Agreement shall be accessed from the Target - Machine in accordance with the Specification. Such Installable Software Agreement must inform the user of the terms and conditions that govern - the Installable Software and must solicit acceptance by the end user in the manner prescribed in such Installable Software Agreement. Upon such - indication of agreement by the user, the provisioning Technology will complete installation of the Installable Software.
  6. -
- -

Cryptography

- -

Content may contain encryption software. The country in which you are currently may have restrictions on the import, possession, and use, and/or re-export to - another country, of encryption software. BEFORE using any encryption software, please check the country's laws, regulations and policies concerning the import, - possession, or use, and re-export of encryption software, to see if this is permitted.

- -

Java and all Java-based trademarks are trademarks of Oracle Corporation in the United States, other countries, or both.

- - diff --git a/jpa/plugins/org.eclipse.jpt.branding/.cvsignore b/jpa/plugins/org.eclipse.jpt.branding/.cvsignore deleted file mode 100644 index c9401a2c83..0000000000 --- a/jpa/plugins/org.eclipse.jpt.branding/.cvsignore +++ /dev/null @@ -1,2 +0,0 @@ -build.xml -org.eclipse.jpt_1.0.0.* \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.branding/.project b/jpa/plugins/org.eclipse.jpt.branding/.project deleted file mode 100644 index e1a9beda8b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.branding/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.eclipse.jpt.branding - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/jpa/plugins/org.eclipse.jpt.branding/.settings/org.eclipse.core.resources.prefs b/jpa/plugins/org.eclipse.jpt.branding/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 4aec29d1cd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.branding/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun May 27 15:10:09 EDT 2007 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/jpa/plugins/org.eclipse.jpt.branding/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.branding/META-INF/MANIFEST.MF deleted file mode 100644 index 5507a8f00a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.branding/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.jpt.branding;singleton:=true -Bundle-Version: 2.4.0.qualifier -Bundle-Localization: plugin -Bundle-Vendor: %providerName diff --git a/jpa/plugins/org.eclipse.jpt.branding/about.html b/jpa/plugins/org.eclipse.jpt.branding/about.html deleted file mode 100644 index ca606b1bb5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.branding/about.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

June 06, 2007

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- - - \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.branding/about.ini b/jpa/plugins/org.eclipse.jpt.branding/about.ini deleted file mode 100644 index 7d88b9d396..0000000000 --- a/jpa/plugins/org.eclipse.jpt.branding/about.ini +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2009 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=icons/WTP_icon_x32_v2.png - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - -# Property "tipsAndTricksHref" contains the Help topic href to a tips and tricks page -# optional -tipsAndTricksHref=/org.eclipse.jpt.doc.user/tips_and_tricks.htm - - diff --git a/jpa/plugins/org.eclipse.jpt.branding/about.mappings b/jpa/plugins/org.eclipse.jpt.branding/about.mappings deleted file mode 100644 index bddaab4310..0000000000 --- a/jpa/plugins/org.eclipse.jpt.branding/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.branding/about.properties b/jpa/plugins/org.eclipse.jpt.branding/about.properties deleted file mode 100644 index 4b821e2ac7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.branding/about.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2009 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. - -blurb=Dali Java Persistence Tools\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Oracle contributors and others 2006, 2009. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools diff --git a/jpa/plugins/org.eclipse.jpt.branding/build.properties b/jpa/plugins/org.eclipse.jpt.branding/build.properties deleted file mode 100644 index 4e089bbd76..0000000000 --- a/jpa/plugins/org.eclipse.jpt.branding/build.properties +++ /dev/null @@ -1,18 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2009 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -bin.includes = META-INF/,\ - about.ini,\ - about.html,\ - about.mappings,\ - about.properties,\ - icons/,\ - plugin.properties,\ - component.xml diff --git a/jpa/plugins/org.eclipse.jpt.branding/component.xml b/jpa/plugins/org.eclipse.jpt.branding/component.xml deleted file mode 100644 index 622c26c9a9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.branding/component.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.branding/icons/WTP_icon_x32_v2.png b/jpa/plugins/org.eclipse.jpt.branding/icons/WTP_icon_x32_v2.png deleted file mode 100644 index 6f09c2a700..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.branding/icons/WTP_icon_x32_v2.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.branding/plugin.properties b/jpa/plugins/org.eclipse.jpt.branding/plugin.properties deleted file mode 100644 index 0cadd22a37..0000000000 --- a/jpa/plugins/org.eclipse.jpt.branding/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2009 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools -providerName = Eclipse Web Tools Platform diff --git a/jpa/plugins/org.eclipse.jpt.core/.project b/jpa/plugins/org.eclipse.jpt.core/.project deleted file mode 100644 index fff56584ab..0000000000 --- a/jpa/plugins/org.eclipse.jpt.core/.project +++ /dev/null @@ -1,5 +0,0 @@ - - - org.eclipse.jpt.core - renamed to org.eclipse.jpt.jpa.core - \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.db.ui/.project b/jpa/plugins/org.eclipse.jpt.db.ui/.project deleted file mode 100644 index 64a5574ce5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.db.ui/.project +++ /dev/null @@ -1,5 +0,0 @@ - - - org.eclipse.jpt.db.ui - renamed to org.eclipse.jpt.jpa.db.ui - \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.db/.project b/jpa/plugins/org.eclipse.jpt.db/.project deleted file mode 100644 index 604cfcb4a9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.db/.project +++ /dev/null @@ -1,5 +0,0 @@ - - - org.eclipse.jpt.db - renamed to org.eclipse.jpt.jpa.db - \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/.project b/jpa/plugins/org.eclipse.jpt.doc.user/.project deleted file mode 100644 index 61670ff4fc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.eclipse.jpt.doc.user - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.doc.user/META-INF/MANIFEST.MF deleted file mode 100644 index b1923a2c5a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/META-INF/MANIFEST.MF +++ /dev/null @@ -1,9 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.doc.user;singleton:=true -Bundle-Version: 1.4.0.qualifier -Bundle-Localization: plugin -Require-Bundle: org.eclipse.help;bundle-version="[3.3.100,4.0.0)", - org.eclipse.ui.cheatsheets;bundle-version="[3.3.100,4.0.0)" diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/about.htm b/jpa/plugins/org.eclipse.jpt.doc.user/about.htm deleted file mode 100644 index 29a91352c6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/about.htm +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - -About this content - - - - - - - - - - - -
-

About this content

-

November, 2009

- -

License

-

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 http://www.eclipse.org/legal/epl-v10.html. For purposes of the EPL, "Program" will mean the Content.

-

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 http://www.eclipse.org.

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/about.html b/jpa/plugins/org.eclipse.jpt.doc.user/about.html deleted file mode 100644 index 54a84efdaf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/about.html +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - -About this content - - - - - - - - - - - -
-

About this content

-

November, 2009

- -

License

-

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 http://www.eclipse.org/legal/epl-v10.html. For purposes of the EPL, "Program" will mean the Content.

-

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 http://www.eclipse.org.

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/build.properties b/jpa/plugins/org.eclipse.jpt.doc.user/build.properties deleted file mode 100644 index 2b421082db..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/build.properties +++ /dev/null @@ -1,136 +0,0 @@ -bin.includes = cheatsheets/,\ - dcommon/,\ - img/,\ - META-INF/,\ - about.html,\ - build.properties,\ - concept_mapping.htm,\ - concept_persistence.htm,\ - concepts.htm,\ - concepts001.htm,\ - concepts002.htm,\ - concepts003.htm,\ - contexts.xml,\ - getting_started.htm,\ - getting_started001.htm,\ - getting_started002.htm,\ - getting_started003.htm,\ - getting_started004.htm,\ - index.xml,\ - legal.htm,\ - plugin.properties,\ - plugin.xml,\ - ref_details_orm.htm,\ - ref_jpa_facet.htm,\ - ref_mapping_general.htm,\ - ref_new_jpa_project.htm,\ - ref_new_jpa_project_wizard.htm,\ - ref_persistence_map_view.htm,\ - ref_persistence_outline.htm,\ - ref_persistence_perspective.htm,\ - ref_persistence_prop_view.htm,\ - ref_primary_key.htm,\ - ref_project_properties.htm,\ - reference.htm,\ - reference001.htm,\ - reference002.htm,\ - reference003.htm,\ - reference004.htm,\ - reference005.htm,\ - reference006.htm,\ - reference007.htm,\ - reference008.htm,\ - reference009.htm,\ - reference010.htm,\ - reference011.htm,\ - reference012.htm,\ - reference013.htm,\ - reference014.htm,\ - reference015.htm,\ - reference016.htm,\ - reference017.htm,\ - reference018.htm,\ - task_add_persistence.htm,\ - task_additonal_tables.htm,\ - task_create_new_project.htm,\ - task_inheritance.htm,\ - task_manage_orm.htm,\ - task_manage_persistence.htm,\ - task_mapping.htm,\ - tasks.htm,\ - tasks001.htm,\ - tasks002.htm,\ - tasks003.htm,\ - tasks004.htm,\ - tasks005.htm,\ - tasks006.htm,\ - tasks007.htm,\ - tasks008.htm,\ - tasks009.htm,\ - tasks010.htm,\ - tasks011.htm,\ - tasks012.htm,\ - tasks013.htm,\ - tasks014.htm,\ - tasks015.htm,\ - tasks016.htm,\ - tasks017.htm,\ - tasks018.htm,\ - tasks019.htm,\ - tasks020.htm,\ - tasks021.htm,\ - tasks022.htm,\ - tips_and_tricks.htm,\ - toc.xml,\ - whats_new.htm,\ - whats_new001.htm,\ - whats_new002.htm,\ - whats_new003.htm,\ - about.htm,\ - reference019.htm,\ - reference020.htm,\ - reference021.htm,\ - reference022.htm,\ - reference023.htm,\ - reference024.htm,\ - reference025.htm,\ - reference026.htm,\ - reference027.htm,\ - reference028.htm,\ - reference030.htm,\ - reference029.htm,\ - reference031.htm,\ - reference032.htm,\ - tasks023.htm,\ - tasks024.htm,\ - whats_new004.htm,\ - whats_new005.htm,\ - ref_persistence_xmll_editor.htm,\ - ref_EntityClassPage.htm,\ - ref_EntityPropertiesPage.htm,\ - ref_add_converter.htm,\ - ref_association_cardinality.htm,\ - ref_association_table.htm,\ - ref_create_custom_entities_wizard.htm,\ - ref_create_jpa_entity_wizard.htm,\ - ref_create_new_association_wizard.htm,\ - ref_customizIndividualEntities.htm,\ - ref_customizeDefaultEntityGeneration.htm,\ - ref_eclipselink_mapping_file.htm,\ - ref_java_page.htm,\ - ref_join_columns.htm,\ - ref_persistence_general.htm,\ - ref_selectTables.htm,\ - ref_select_cascade_dialog.htm,\ - ref_tableAssociations.htm,\ - task_create_jpa_entity.htm,\ - ref_configure_jaxb_class_generation_dialog.htm,\ - ref_jaxb_schema_wizard.htm,\ - ref_schema_from_classes_page.htm,\ - reference033.htm,\ - task_generate_classes_from_schema.htm,\ - task_generating_schema_from_classes.htm,\ - tasks025.htm,\ - tasks026.htm,\ - whats_new006.htm -generateSourceBundle=false diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/add_persistence.xml b/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/add_persistence.xml deleted file mode 100644 index 6dbeedbeca..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/add_persistence.xml +++ /dev/null @@ -1,63 +0,0 @@ - - - - - This cheat sheet will automatically launch wizards, perform actions, and guide you through the steps to create a JPA project. - -To learn more about using cheat sheets, or to see a list of available cheat sheets, click Help (?). -To start work working on this cheat sheet click the "Click to Begin" button below. - -Let's get started! - - - - - Your environment must be set up before you can perform the steps in this cheat sheet. - -Create a database profile and connect to the database. - -The Database Connection dialog automatically appears when you click the "Click to Perform" button. - - - - - - - Use the New Project Wizard to create a JPA project. -Select File->New->Project... and choose JPA->JPA Project in the list. - -On the first page of the wizard, enter a project name and location, select your target runtime, and select a predefined project configuration. - -Click Next to display the next page of the wizard. - -The "New JPA Project" wizard is automatically displayed when you click the "Click to Perform" button. - - - - - - - Use the Project Facet page to select a predefined project configuration or specific specific facets to include in the project. - -Click "Next" to display the next page of the wizard. - - - - - Use the JPA Facet page to specify the the vendor-specific JPA platform, the database connection to use, and the specific JPA implementation library. - -You can also specify if Dali should create an orm.xml file. - -If you do not have an active database connection, click Add Connections to create one. - -If you do not have a defined JPA implementation library, click Configure default JPA implementation library or Configure user libraries to define one. - -Click Finish to complete the wizard and open the open the project. - - - - - Congratulations! You have successfully created a JPA project. Complete the additional cheat sheets to add Java persistent entities and map those entities to database tables. - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/create_entity.xml b/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/create_entity.xml deleted file mode 100644 index b64e8afdee..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/create_entity.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - -This cheat sheet will automatically launch wizards, perform actions, and guide you through the steps to add a Java persistent entity to your Java project. -To learn more about using cheat sheets or to see a list of available cheat sheets, click Help (?). -To start work working on this cheat sheet, click the Click to Begin button below. -Let's get started! - - - - -To create a Persistent entity, you must create a JPA project. If you already have a JPA project, you may skip this step by clicking the "Click to Skip" button. -If not, select File->New->Project... and choose JPA->JPA Project in the list. Complete each page of the Create JPA Project wizard to create a new JPA project. - - - - - -When working with JPA persistence, you should use the Persistence perspective. If you already have the Persistence perspective active, you may skip this step by clicking the "Click to Skip" button. -If not, select Window->Open Perspective->Other in the menubar at the top of the workbench. In the Select Perspectives dialog, select JPA Development and click OK. This step changes the perspective to set up the Eclipse workbench for JPA development. -You can click the "Click to Perform" button to have the "Persistence" perspective opened automatically. - - - - -The next step is to create a new Java class. In the main toolbar again, click on New Java Class button (or the link below). -The Java editor will automatically open showing your new class. - - - - -Finally we will make the Java class a persistent entity. -In the JPA Structure view select the Java class. -In the JPA Details view, use the "Map As" field to select Entity. Dali automatically adds the @Entity annotation to the class in the Java editor. -Use the Table, Catalog, and Schema fields to associate the entity with a specific table in the database. - - - - -Congratulations! You have successfully added a JPA entity to your JPA project. Complete the additional cheat sheets to map the entity's fields to database tables. - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/map_entity.xml b/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/map_entity.xml deleted file mode 100644 index 63307f226e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/cheatsheets/map_entity.xml +++ /dev/null @@ -1,88 +0,0 @@ - - - - - This cheat sheet will automatically launch wizards, perform actions, and guide you through the steps to map the fields of a JPA entity entity to your database. - -To learn more about using cheat sheets or to see a list of available cheat sheets, click Help (?). -To start work working on this cheat sheet, click the "Click to Begin" button below. - -Let's get started! - - - - - Your environment must be set up before you can perform the steps in this cheat sheet. - -Create a database profile and connect to the database. - -If you already have (and are connected to) a database connection, you may skip this step by clicking the "Click to Skip" button. - -The Database Connection dialog automatically appears when you click the "Click to Perform" button. - - - - - - - Use the New Project Wizard to create a JPA project. -Select File->New->Project... and choose JPA->JPA Project in the list. - -Complete each page of the wizard to create a new JPA project. - -The "New JPA Project" wizard is automatically displayed when you click the "Click to Perform" button. - -If you already have a JPA project, you may skip this step by clicking the "Click to Skip" button. - - - - - - - When working with JPA persistence, you should use the Persistence perspective. If you already have the Persistence perspective active, you may skip this step by clicking the "Click to Skip" button. -If not, select Window->Open Perspective->Other in the menubar at the top of the workbench. In the Select Perspectives dialog, select JPA Development and click OK. This step changes the perspective to set up the Eclipse workbench for JPA development. -You can click the "Click to Perform" button to have the "Persistence" perspective opened automatically. - - - - - - - The next step is to create a new Java class. In the main toolbar again, click on New Java Class button (or the link below). -The Java editor will automatically open showing your new class. - - - - - Finally we will make the Java class a persistent entity. -In the JPA Structure view select the Java class. -In the JPA Details view, use the "Map As" field to select Entity. Dali automatically adds the @Entity annotation to the class in the Java editor. -Use the Table, Catalog, and Schema fields to associate the entity with a specific table in the database. - - - - - Now you will add some fields to the entity to map to rows in the database table. - -If your persistent entity already has fields to map, you may skip this step by clicking the "Click to Skip" button. If not, use the Java editor to add fields to the entity. - - - - - - - Now you are ready to map the entity fields to columns in the database table. In the Package Explorer, select the Java class. - -In the JPA Structure view, expand the persistent entity to display the fields. Select a field. - -The JPA Details view displays the information for the field. Use the Map As field to select the Basic mapping. Use the Column field to select a column from the database table. - - - - - - - Congratulations! You have successfully mapped the fields from a Java persistent entity to a column in a database table. - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/concept_mapping.htm b/jpa/plugins/org.eclipse.jpt.doc.user/concept_mapping.htm deleted file mode 100644 index 59f7d97bfd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/concept_mapping.htm +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - -Understanding OR mappings - - - - - - - - - - - -

-
-

Understanding OR mappings

-

The Dali OR (object-relational) Mapping Tool allows you to describe how your entity objects map to the data source (or other objects). This approach isolates persistence information from the object model–developers are free to design their ideal object model, and DBAs are free to design their ideal schema.

-

These mappings transform an object data member type to a corresponding relational database data source representation. These OR mappings can also transform object data members that reference other domain objects stored in other tables in the database and are related through foreign keys.

-

You can use these mappings to map simple data types including primitives (such as int), JDK classes (such as String), and large object (LOB) values. You can also use them to transform object data members that reference other domain objects by way of association where data source representations require object identity maintenance (such as sequencing and back references) and possess various types of multiplicity and navigability. The appropriate mapping class is chosen primarily by the cardinality of the relationship.

-Related task
-
-Mapping an entity -

 

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/concept_persistence.htm b/jpa/plugins/org.eclipse.jpt.doc.user/concept_persistence.htm deleted file mode 100644 index 3c7f80bf06..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/concept_persistence.htm +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - -Understanding Java persistence - - - - - - - - - - - -

-
-

Understanding Java persistence

-

Persistence refers to the ability to store objects in a database and use those objects with transactional integrity. In a J2EE application, data is typically stored and persisted in the data tier, in a relational database.

-

Entity beans are enterprise beans that contain persistent data and that can be saved in various persistent data stores. The entity beans represent data from a database; each entity bean carries its own identity. Entity beans can be deployed using application-managed persistence or container-managed persistence.

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/concepts.htm b/jpa/plugins/org.eclipse.jpt.doc.user/concepts.htm deleted file mode 100644 index 7a140b7e90..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/concepts.htm +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - -Concepts - - - - - - - - - - - -

-

Concepts

-

This section contains an overview of concepts you should be familiar with when using Dali to create mappings for Java persistent entities.

- -

In addition to these sections, you should review the following resources for additional information:

- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/concepts001.htm b/jpa/plugins/org.eclipse.jpt.doc.user/concepts001.htm deleted file mode 100644 index 5104da12ef..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/concepts001.htm +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - -Understanding EJB 3.0 Java Persistence API - - - - - - - - - - - -

-
-

Understanding EJB 3.0 Java Persistence API

-

The Java 2 Enterprise Edition(J2EE) Enterprise JavaBeans (EJB) are a component architecture that you use to develop and deploy object-oriented, distributed, enterprise-scale applications. An application written according to the Enterprise JavaBeans architecture is scalable, transactional, and secure.

-

The EJB 3.0 Java Persistence API (JPA) improves the EJB architecture by reducing its complexity through the use of metadata (annotations) and specifying programmatic defaults of that metadata.

-Related task
-
-Mapping an entity -

 

- - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/concepts002.htm b/jpa/plugins/org.eclipse.jpt.doc.user/concepts002.htm deleted file mode 100644 index 99f1e4397b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/concepts002.htm +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - -The persistence.xml file - - - - - - - - - - - -

-
-

The persistence.xml file

-

The JPA specification requires the use of a persistence.xml file for deployment. This file defines the database and entity manager options, and may contain more than one persistence unit. To enable you to easily edit this information, Dali provides the persistence.xml Editor. Alternatively, you can use the Eclipse XML Editor to create and maintain this information. See "Managing the persistence.xml file" for more information.

-
-

- - - - - - -
-

Tip:

-To work with multiple persistence units, comment out all but one persistence unit in persistence.xml.
-
-
-Related task
-
-Managing the persistence.xml file
-Creating a new JPA project -

 

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/concepts003.htm b/jpa/plugins/org.eclipse.jpt.doc.user/concepts003.htm deleted file mode 100644 index 9c887a7984..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/concepts003.htm +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - -The orm.xml file - - - - - - - - - - - -

-
-

The orm.xml file

-

Although the JPA specification emphasizes the use of annotations to specify persistence, you can also use the orm.xml file to store this metadata. Dali enables you to create a stub orm.xml file for a JPA project using the Mapping File Wizard. See "Managing the orm.xml file" for more information.

-
-

- - - - - - -
-

Note:

-The metadata must match the XSD specification of your selected JPA implementation.
-
-
-

Dali provides comprehensive support for configuring XML mapping files through the JPA Details view (for orm.xml) that is nearly identical to the annotation-based configuration in the Java source. Alternatively, you can also use the Eclipse XML Editor to create and maintain the metadata information in orm.xml.

-Related task
-
-Managing the orm.xml file
-Creating a new JPA project
-

 

-
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/contexts.xml b/jpa/plugins/org.eclipse.jpt.doc.user/contexts.xml deleted file mode 100644 index a7a661aa44..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/contexts.xml +++ /dev/null @@ -1,646 +0,0 @@ - - - - - Specify how the variable is accessed: Property (default) or Field. - - - - - - The name of this entity. By default, the class name is used as the entity name. - - - - - - The database table assigned to this entity. By default, the class name is used as the database table name. - - - - - - - Specify a property or field to be overridden (from the default mappings). - - - - - - Name of the database column. - - - - - - The database column that overrides a property or field. - - - - - - Specifies if the column is always included in SQL INSERT statements. - - - - - - Specifies if the column is always included in SQL UPDATE statements. - - - - - - Specify how this attribute maps to the database. - - - - - - The database column that contains the value for the attribute. - - - - - - Name of the database table that contains the selected column. - - - - - - Specifies if the column is always included in SQL INSERT statements. - - - - - - Specifies if the column is always included in SQL UPDATE statements. - - - - - - Defines how data is loaded from the database: Eager (default) or Lazy - - - - - - Specifies if this field is can be null. - - - - - - Determines how the primary key is generated: Auto (default), Sequence, Identity, or Table. - - - - - - Unique name of the generator. - - - - - - The entity to which this attribute is mapped. - - - - - - Specify which operations are propagated throughout the entity: All, Persist, Merge, or Move. - - - - - - The field in the database table that owns the relationship. - - - - - - The name of the database column that contains the foreign key reference for the entity association. - - - - - - Name of the join table that contains the foreign key column. - - - - - - Specify to override the default mapping of an entity’s attribute. - - - - - - The database column that is being mapped to the entity’s attribute. - - - - - - Specify the type of persistent domain object for the Java class: Persistent, Embedded, or Mapped Superclass. - - - - - - Specify how an entity may inherit properties from other entities: Single table, One table per class, or Joined tables. - - - - - Use to specify the name of the discriminator column when using a Single or Joined inheritance strategy. - - - - - Use this field to set the discriminator type to CHAR or INTEGER (instead of its default: String). The discriminator value must conform to this type. - - - - - Specify the discriminator value used to differentiate an entity in this inheritance hierarchy. The value must conform to the specified discriminator type. - - - - - Specify the default order for objects returned from a query. -orderby_list::= orderby_item [,orderby_item] -orderby_item::= [property_or_field_name] [ASC | DESC] -For example: "lastName ASC ,salary DESC" - - - - - Specify the name of the database table that defines the foreign key for a many-to-many or a unidirectional one-to-many association. You can configure the join table with a specific catalog or schema, configure one or more join table columns with a unique constraint, and use multiple join columns per entity. - - - - - Specify two or more join columns (that is, a composite primary key). - - - - - Specify the join column on the owned (or inverse side) of the association: the owned entity's primary key column. - - - - - Use the Java Persistence options on the Properties page to select the database connection to use with the project. - - - - - - The database connection used to map the persistent entities. - - - - - The database schema used to map the persistent entities. - - - - - Use the Add Persistence dialog to define the database connection use to store the persistence entities. - - - - - The JPA Structure view displays an outline of the structure (its attributes and mappings) of the entity that is currently selected or opened in the editor. - - - - - Use the Generate Entities dialog to create Java persistent entities based on your database tables. - - - - - The project folder name in which to generate the Java persistent entities. Click Browse to select an existing folder. - - - - The package in which to generate the Java persistent entities, or click Browse to select an existing package. - - - - Select the tables from which to create Java persistent entities. - - - - - Use this dialog to define the database connection used to store the persistence entities and to create the persistence.xml file. - - - - - - Use this dialog to define the new JPA project name, its location, target runtime, and other configuration settings. - - - - - - - Use these fields to define the database connection used to store the persistent entities. - - - - - Use this option to add libraries or JARs that contain the Java Persistence API (JPA) and entities to the project’s Java Build Path. - - - - - Use these fields to create the persistence.xml file. Select the persistence version, the name of the JPA provider, and a unique name to identify the persistence unit. - - - - - Use this page to select which script options will be included in the generated script. - - - - - Use this page to select which elements will be included in the generated script. - - - - - Use this page to select the filename and location of the generated script. You can also preview the script and specify to run or continue editing the script after generation. - - - - - This page shows the settings that you selected for the generated DDL. To change any option click "Back" or click "Finish" to continue. - - - - The name of the table sequence generator. This name is global to to the persistence unit (across all generator types). - - - - - The database table that stores the generated ID values. - - - - - The database column of the generator table that stores the generated ID values. - - - - - The name for the column that stores the generated ID values. - - - - - The database column of the generator table that defines the primary key value. - - - - - Use to connect (log in) to a database connection to use with your Java persistent entities. - You must have a defined database connection (and be connected) to add persistence. - - - - Specify if the mapped field contains a Date (java.sql.Date), Time (java.sql.Time), or Timestamp (java.sql.Timestamp) value. - - - - - Define how the primary key is generated - - - - - - Specify to use a specific database table for generating the primary key. - - - - - - Specify to use a specific sequence for generating the primary key. - - - - - - Name of the sequence. - - - - - - - - - - - - Specify if the field is mapped to java.sql.Clob or java.sql.Blob. - - - - - - Specify how to persist enumerated constraints if the String value suits your application requirements or to match an existing database schema. - - - - - - . - - - - The database catalog that contains the Table. This field overrides the defaults in the orm.xml file. - - - - - - The database schema that contains the Table. This field overrides the defaults in the orm.xml file. - - - - - - The Java package that contains the persistent entities to which the orm.xml file applies. - - - - - The database schema to use as the default for all entities managed by this persistence unit. - - - - - The database catalog to use as the default for all entities managed by this persistence unit. - - - - - The default access method for variables in this project: Property or Field. - - - - - Adds cascade-persist to the set of cascade options in entity relationships of the persistence unit. - - - - - Specifies that the Java classes in this persistence unit are fully specified by their metadata. Any annotations will be ignored. - - - - - Specify the vendor-specific JPA implementation.Default is Generic.. - - - - Create an initial orm.xml file. Use this file to specify project and persistence unit defaults. - - - - - - Select the default caching strategy for the project. The default is Weak with Soft Subcache. - - - - - Select the default size of the cache. The default is 100 items. - - - - - Specify if cached instances should be in the shared cache or in a client isolated cache. - - - - - Specifies the amount and detail of log output by selecting the log level. Default is Info level. - - - - - Control whether the timestamp is logged in each log entry. Default is True. - - - - - Control whether a thread identifier is logged in each log entry. Default is True. - - - - - Control whether an EclipseLink session identifier is logged in each log entry. Default is True. - - - - - Control whether the exceptions thrown from within the code are logged prior to returning the exception to the calling application. Ensures that all exceptions are logged and not masked by the application code.. Default is False. - - - - - Specify the name by which the EclipseLink session is stored in the static session manager. - - - - - Specify persistence information loaded from the EclipseLink session configuration file. You can use this option as an alternative to annotations and deployment XML. - - - - - - - - - - - - - - - Use this dialog to include existing Java source files in this project. - - - - - - Use this dialog to specify your vender-specific platform, JPA implementation library, and database connection. - - - - - - Use this dialog to specify package, class name, and inheritance properties of the entity to create. - - - - - - Use this dialog to specify the entity name, associated table, and mapped fields. - - - - - - Use this dialog to specify the database tables from which to generate entities. - - - - - Use this dialog to create or edit the association between the database table and entity. - - - - - Use this dialog to specify the table mapping and domain class information for the generated entity. - - - - - Use this dialog to specify the table mapping and domain class information for the generated entity. - - - - - - Use this dialog to specify the association tables for an entity. - - - - - Use this dialog to specify the join columns of an association table. - - - - - Use this dialog to specify cardinality of an association table. - - - - - Specify which operations are propagated throughout the association: All, Persist, Merge, Remove, or Refresh. - - - - - - - Specify the general persistence options. - - - - - - Specify the data source or JDBC connection properties. - - - - - - Specify the default or entity specific EclipseLink customization and validation properties. - - - - - - Configure the session or entity specific EclipseLink caching properties. - - - - - - Configure the EclipseLink logging properties. - - - - - - Configure the EclipseLink session and miscellanous options. - - - - - - Configure the schema generation properties. - - - - - - Configure the properties defined for the persistence unit. - - - - - - Configure the properties defined for the persistence unit. - - - - - - Configure the properties defined for the persistence unit. - - - - - - Use this dialog to create a new EclipseLink conveter. - - - - - - - Specifies if the project model uses the Canonical Metamodel. - - - - - Specify if the entity uses the @Cachable annotation. Default is @Cachable(false). - - - - - Click Browse and select the primary key for the entity. Clicking the field name, which is represented as a hyperlink, allows you to create a new class. - - - - - Select the project, package, or classes from which to generate the XML schema. Click Finish to generate the schema - - - - - Enter the JAXB class generation settings and click Finish to generate classes. All fields are optional except for the source folder. - - - - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/dcommon/css/blafdoc.css b/jpa/plugins/org.eclipse.jpt.doc.user/dcommon/css/blafdoc.css deleted file mode 100644 index baf6127928..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/dcommon/css/blafdoc.css +++ /dev/null @@ -1,21 +0,0 @@ -@import "../../../PRODUCT_PLUGIN/book.css"; - -span.control, span.gui-object-action, p.subhead2, span.bold, p.notep1 { - font-weight: bold; -} - -span.name, p.titleinfigure, span.italic { - font-style: italic; -} - -p.titleinfigure, p.subhead2 { - padding-top: 10px; -} - -span.code { - font-family: monospace; -} - -span.copyrightlogo {font-size: 0.8em} - -.footer {margin-top: 2em;border-top:1px solid #cccccc;padding-top:1em;} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/dcommon/html/cpyr.htm b/jpa/plugins/org.eclipse.jpt.doc.user/dcommon/html/cpyr.htm deleted file mode 100644 index 382ec67619..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/dcommon/html/cpyr.htm +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - -

License Information

- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started.htm b/jpa/plugins/org.eclipse.jpt.doc.user/getting_started.htm deleted file mode 100644 index c993ad7ac6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started.htm +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - -Getting started - - - - - - - - - - - -

-

Getting started

-

This section provides information on getting started with the Java Persistence Tools.

- -

For additional information, please visit the Dali home page at:

-

http://www.eclipse.org/webtools/dali.

- - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started001.htm b/jpa/plugins/org.eclipse.jpt.doc.user/getting_started001.htm deleted file mode 100644 index 21cf961743..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started001.htm +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - -Requirements and installation - - - - - - - - - - - -

-
-

Requirements and installation

-

Before installing Dali, ensure that your environment meets the following minimum requirements:

- -

Refer to http://www.eclipse.org/webtools/dali/gettingstarted_main.html for additional installation information.

-

Dali is included as part of WTP 3.2. No additional installation or configuration is required.

- -

Accessibility Features

-

Dali supports the standard accessibility features in Eclipse, including the following:

-
    -
  • -

    Navigating the user interface using the keyboard.

    -
  • -
  • -

    Specifying general accessibility preferences for the editor.

    -
  • -
-

See Accessibility Features in Eclipse in the Workbench User Guide for details.

- -

Help Accessibility

-

The documentation and help contains markup to facilitate access by the disabled community. See Help Accessibility in the Workbench User Guide for details.

-

When using the help, be aware of the following:

-
    -
  • -

    Screen readers may not always correctly read the code examples in this document. The conventions for writing code require that closing braces should appear on an otherwise empty line; however, some screen readers may not always read a line of text that consists solely of a bracket or brace.

    -
  • -
  • -

    This documentation may contain links to Web sites of other companies or organizations that we do not control. We neither evaluate nor make any representations regarding the accessibility of these Web sites.

    -
  • -
-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started002.htm b/jpa/plugins/org.eclipse.jpt.doc.user/getting_started002.htm deleted file mode 100644 index 3285315b65..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started002.htm +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - -Dali quick start - - - - - - - - - - - -

-
-

Dali quick start

-

This section includes information to help you quickly start using Dali to create relational mappings between Java persistent entities and database tables.

- -Related reference
-
-Tips and tricks
- - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started003.htm b/jpa/plugins/org.eclipse.jpt.doc.user/getting_started003.htm deleted file mode 100644 index 2cbac78532..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started003.htm +++ /dev/null @@ -1,105 +0,0 @@ - - - - - - - -Creating a new JPA project - - - - - - - - - - - -

-
-

Creating a new JPA project

-

This quick start shows how to create a new JPA project.

-
    -
  1. -

    Select File > New > Project. The Select a Wizard dialog appears.

    -
    -

    - - - - - - -
    -

    Tip:

    -You can also select the JPA perspective and then select File > New > JPA Project.
    -
    -
    -
  2. -
  3. -

    Select JPA Project and then click Next. The New JPA Project page appears.

    -
  4. -
  5. -

    Enter a Project name (such as QuickStart).

    -
  6. -
  7. -

    If needed, select the Target Runtime (such as Apache Tomcat) and configuration, such as Utility JPA Project with Java 5.0 and then click Next. The Java source page appears.

    -
    -

    - - - - - - -
    -

    Note:

    -The Target Runtime is not required for Java SE development.
    -
    -
    -
  8. -
  9. -

    If you have existing Java source files, add them to your classpath and then click Next. The JPA Facet page appears.

    -
  10. -
  11. -

    On the JPA Facet dialog, select your vendor-specific JPA platform (or select Generic), database connection (or create a new connection), JPA implementation library (such as EclipseLink), define how Dali should manage persistent classes, and then click Finish.

    -
    -

    - - - - - - -
    -

    Tip:

    -Select Override the Default Schema for Connection if you require a schema other than the one that Dali derives from the connection information, which may be incorrect in some cases. Using this option, you can select a development time schema for defaults and validation.
    -
    -
    -
  12. -
-

Eclipse adds the project to the workbench and opens the JPA perspective.

-
-

JPA Project in Project Explorer

-Package Explorer showing the JPA project.
- -

Now that you have created a project with persistence, you can continue with Creating a Java persistent entity with persistent fields.

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started004.htm b/jpa/plugins/org.eclipse.jpt.doc.user/getting_started004.htm deleted file mode 100644 index 249ea76a96..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/getting_started004.htm +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - -Creating a Java persistent entity with persistent fields - - - - - - - - - - - -

-
-

Creating a Java persistent entity with persistent fields

-

This quick start shows how to create a new persistent Java entity. We will create an entity to associate with a database table. You will also need to add the ADDRESS table to your database.

-
    -
  1. -

    Select the JPA project in the Navigator or Project Explorer and then click New > Other. The Select a Wizard dialog appears.

    -
  2. -
  3. -

    Select JPA > Entity and then click Next. The Entity Class page appears.

    -
  4. -
  5. -

    Enter the package name (such as quickstart.demo.model), the class name (such as Address) and then click Next. The Entity Properties page appears, which enables you to define the persistence fields, which you will map to the columns of a database table.

    -
  6. -
  7. -

    Use the Entity Fields dialog (invoked by clicking Add) to add persistence fields to the Address class:

    -
    -private Long id;
    -private String city;
    -private String country;
    -private String stateOrProvince;
    -private String postalCode;
    -private String street;
    -
    -
    -

    - - - - - - -
    -

    Note:

    -You will also need to add the following columns to the ADDRESS database table: -
    -NUMBER(10,0) ADDRESS_ID (primary key)
    -VARCHAR2(80) PROVINCE
    -VARCHAR2(80) COUNTRY
    -VARCHAR2(20) P_CODE
    -VARCHAR2(80) STREET
    -VARCHAR2(80) CITY
    -
    -
    -
    -
    -
    -
  8. -
  9. -

    Click Finish. With the Create JPA Entity completed, Eclipse displays the Address entity in the JPA Structure view.

    -

    Address.java includes the @Entity annotation, the persistence fields, as well as getter and setter methods for each of the fields.

    -
  10. -
-
-

Address Entity in Address.java

-Java editor with the Address entity.
- -

Eclipse also displays the Address entity in the JPA Structure view:

-
-

Address Entity in the JPA Structure View

-Address.java in the JPA Structure View.
- -
    -
  1. -

    Select the Address class in the Project Explorer view.

    -
  2. -
  3. -

    In the JPA Details view, notice that Dali has automatically associated the ADDRESS database table with the entity because they are named identically.

    -
    -

    - - - - - - -
    -

    Note:

    -Depending on your database connection type, you may need to specify the Schema.
    -
    -
    -
    -

    JPA Details View for Address Entity

    -Address.java in the JPA Details view.
    -
  4. -
-
-

- - - - - - -
-

Tip:

-After associating the entity with the database table, you should update the persistence.xml file to include this JPA entity. -

Right-click the persistence.xml file in the Project Explorer and select JPA Tools > Synchronize Class List. Dali adds the following to the persistence.xml file:

-

<class>quickstart.demo.model.Address</class>

-
-
-
-

Now we are ready to map each fields in the Address class to a column in the database table.

-
    -
  1. -

    Select the id field in the JPA Details view.

    -
  2. -
  3. -

    Right click id and then select Map As > id.

    -
  4. -
  5. -

    In the JPA Details view, select ADDRESS_ID in the Name field:

    -
    -

    JPA Details View for the addressId Field

    -The JPA Details view for the Address entity’s id attribute.
    - -

    Eclipse adds the following annotations to the Address entity:

    -
    -@Id
    -@Column(name="ADDRESS_ID")
    -
  6. -
  7. -

    Map each of the following fields (as Basic mappings) to the appropriate database column:

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    FieldMap AsDatabase Column
    cityBasicCITY
    countryBasicCOUNTRY
    postalCodeBasicP_CODE
    provinceOrStateBasicPROVINCE
    streetBasicSTREET
    -
    -
  8. -
-

Dali automatically maps some fields to the correct database column (such as the city field to the City column) if the names are identical.

-
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/address.java_jpa_details.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/address.java_jpa_details.png deleted file mode 100644 index bdcf00838f..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/address.java_jpa_details.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/address_id_details_quickstart.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/address_id_details_quickstart.png deleted file mode 100644 index 7ef40cf6c6..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/address_id_details_quickstart.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/address_java_JPA_structure_quickstart.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/address_java_JPA_structure_quickstart.png deleted file mode 100644 index 1af51a9f9b..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/address_java_JPA_structure_quickstart.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/create_jpa_entity_wizard.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/create_jpa_entity_wizard.png deleted file mode 100644 index 0360e0a86c..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/create_jpa_entity_wizard.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/create_jpa_fields.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/create_jpa_fields.png deleted file mode 100644 index 69797a803c..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/create_jpa_fields.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/customize_default_entity_generation.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/customize_default_entity_generation.png deleted file mode 100644 index 9567616b7c..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/customize_default_entity_generation.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/customize_individual_entities.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/customize_individual_entities.png deleted file mode 100644 index 237bdee290..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/customize_individual_entities.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/details_entitymappings.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/details_entitymappings.png deleted file mode 100644 index d66300e421..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/details_entitymappings.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/error_sample.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/error_sample.png deleted file mode 100644 index 3a4964632c..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/error_sample.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/generate_classes_from_schema.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/generate_classes_from_schema.png deleted file mode 100644 index b911d0280b..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/generate_classes_from_schema.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/generate_entities.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/generate_entities.png deleted file mode 100644 index 4daa25c7c5..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/generate_entities.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/icon_basicmapmappings.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/icon_basicmapmappings.png deleted file mode 100644 index 86eef3abe4..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/icon_basicmapmappings.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/icon_basicmapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/icon_basicmapping.png deleted file mode 100644 index b193753e98..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/icon_basicmapping.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_join.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_join.png deleted file mode 100644 index 22b6875f4d..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_join.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_single.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_single.png deleted file mode 100644 index 3146482609..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_single.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_tab.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_tab.png deleted file mode 100644 index b76dd9faf3..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/inheritance_tab.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/java_editor_address.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/java_editor_address.png deleted file mode 100644 index 47428906e8..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/java_editor_address.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/jaxb_schmea_generation_dialog.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/jaxb_schmea_generation_dialog.png deleted file mode 100644 index c9b222e8cd..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/jaxb_schmea_generation_dialog.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/jpa_wizard_create_fields.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/jpa_wizard_create_fields.png deleted file mode 100644 index 30550ea033..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/jpa_wizard_create_fields.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapped_entity_type_link.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/mapped_entity_type_link.png deleted file mode 100644 index 2b616033dd..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapped_entity_type_link.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_file_new.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_file_new.png deleted file mode 100644 index 3355741af7..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_file_new.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_embed.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_embed.png deleted file mode 100644 index 086ea6e9eb..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_embed.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_entity.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_entity.png deleted file mode 100644 index 2604fd9284..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_entity.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_superclass.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_superclass.png deleted file mode 100644 index e28e8fa168..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/mapping_type_selection_superclass.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/modify_faceted_project.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/modify_faceted_project.png deleted file mode 100644 index f4c7968a69..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/modify_faceted_project.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_basicmappings.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_basicmappings.png deleted file mode 100644 index 1b0b7ff4bd..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_basicmappings.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddableentitymapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddableentitymapping.png deleted file mode 100644 index 48294edaf6..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddableentitymapping.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddedidmapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddedidmapping.png deleted file mode 100644 index abe9dc8d20..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddedidmapping.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddedmapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddedmapping.png deleted file mode 100644 index 44d52b8bc4..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_embeddedmapping.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_idmapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_idmapping.png deleted file mode 100644 index fdefb5d781..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_idmapping.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_manytomanymapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_manytomanymapping.png deleted file mode 100644 index eb8022e16c..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_manytomanymapping.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_manytoonemapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_manytoonemapping.png deleted file mode 100644 index ccacc19f1e..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_manytoonemapping.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_mappedentity.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_mappedentity.png deleted file mode 100644 index 398ea2c11f..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_mappedentity.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_mappedsuperclass.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_mappedsuperclass.png deleted file mode 100644 index fc97ceb1fb..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_mappedsuperclass.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_onetomanymapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_onetomanymapping.png deleted file mode 100644 index 5ddc989dfd..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_onetomanymapping.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_onetoonemapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_onetoonemapping.png deleted file mode 100644 index 74d9bbd66c..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_onetoonemapping.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_transientmapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_transientmapping.png deleted file mode 100644 index 750488f49d..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_transientmapping.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_versionmapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_versionmapping.png deleted file mode 100644 index a87371215b..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_icon_versionmapping.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_facet_task.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_facet_task.png deleted file mode 100644 index 7607808317..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_facet_task.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_perspective_button.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_perspective_button.png deleted file mode 100644 index 07425ad08a..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_perspective_button.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_project_task.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_project_task.png deleted file mode 100644 index ab079c2484..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/new_jpa_project_task.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelc.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelc.png deleted file mode 100644 index 88381a5a80..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelc.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelr.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelr.png deleted file mode 100644 index 4bbc744806..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelr.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelt.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelt.png deleted file mode 100644 index 60af21f5ea..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/ngrelt.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/persistence_outline_view.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/persistence_outline_view.png deleted file mode 100644 index 769aa825e5..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/persistence_outline_view.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/project_properties_tasks.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/project_properties_tasks.png deleted file mode 100644 index 97557ee963..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/project_properties_tasks.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/quickstart_project.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/quickstart_project.png deleted file mode 100644 index 48ca05099b..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/quickstart_project.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/secondary_tables.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/secondary_tables.png deleted file mode 100644 index a41f9f53ed..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/secondary_tables.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_entity.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_entity.png deleted file mode 100644 index 2cebe90add..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_entity.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_jpa_project.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_jpa_project.png deleted file mode 100644 index 182350246d..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_jpa_project.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_mapping.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_mapping.png deleted file mode 100644 index 049c9d15b5..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_a_wizard_mapping.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_jaxb_schema_wizard.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/select_jaxb_schema_wizard.png deleted file mode 100644 index 587e61c9c1..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_jaxb_schema_wizard.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_tables.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/select_tables.png deleted file mode 100644 index a57c9314c7..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/select_tables.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/synchornize_classes.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/synchornize_classes.png deleted file mode 100644 index a359f64651..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/synchornize_classes.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/table_associations.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/table_associations.png deleted file mode 100644 index b5b40be797..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/table_associations.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/table_entity.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/table_entity.png deleted file mode 100644 index 1aa1dbe059..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/table_entity.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/task_entering_query.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/task_entering_query.png deleted file mode 100644 index e8beaceb79..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/task_entering_query.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/img/upgrade_persistence_jpa_version.png b/jpa/plugins/org.eclipse.jpt.doc.user/img/upgrade_persistence_jpa_version.png deleted file mode 100644 index 96fa4d27c8..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.doc.user/img/upgrade_persistence_jpa_version.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/index.xml b/jpa/plugins/org.eclipse.jpt.doc.user/index.xml deleted file mode 100644 index acf9beb953..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/index.xml +++ /dev/null @@ -1,668 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/legal.htm b/jpa/plugins/org.eclipse.jpt.doc.user/legal.htm deleted file mode 100644 index dfa0007f53..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/legal.htm +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - -Legal - - - - - - - - - - - -

-

Legal

-

Copyright © 2006, 2010, Oracle. All rights reserved.

-

This program and the accompanying materials are made available under the terms of the Eclipse Public License v1.0 which accompanies this distribution, and is available at:

-

http://www.eclipse.org/legal/epl-v10.html

-

Terms and conditions regarding the use of this guide.

- - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/plugin.properties b/jpa/plugins/org.eclipse.jpt.doc.user/plugin.properties deleted file mode 100644 index 0aea0c736c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/plugin.properties +++ /dev/null @@ -1,32 +0,0 @@ -############################################################################### -# Copyright (c) 2007, 2010 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -# ==================================================================== -# 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 = Dali Java Persistence Tools - Documentation -providerName = Eclipse Web Tools Platform - -jpaDevelopment=JPA Development -createAJpaProject=Create a JPA project -createAJpaProjectDescription=This cheat sheet helps you create a JPA project. -createAPersistentEntity=Create a persistent entity -createAPersistentEntityDescription=This cheat sheet helps you create a Java persistent entity. -MapAPersistentEntity=Map a persistent entity -MapAPersistentEntityDescription=This cheat sheet helps you map the a Java persistent entity to a database table. diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/plugin.xml b/jpa/plugins/org.eclipse.jpt.doc.user/plugin.xml deleted file mode 100644 index 342c5199d0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/plugin.xml +++ /dev/null @@ -1,37 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - %createAJpaProjectDescription - - - %createAPersistentEntityDescription - - - %MapAPersistentEntityDescription - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_EntityClassPage.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_EntityClassPage.htm deleted file mode 100644 index f4578f1bd3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_EntityClassPage.htm +++ /dev/null @@ -1,115 +0,0 @@ - - - - - - - -Entity Class page - - - - - - - - - - - -

-
-

Entity Class page

-

This table lists the properties of the Entity Class page of the Create JPA Entity wizard.

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
ProjectThe name of the JPA project.
Source FolderThe location of the JPA project's src folder.
Java PackageThe name of the class package.
Class nameThe name of the Java class.
SuperclassSelect the superclass.
InheritanceBecause the wizard creates a Java class with an @Entity notation, the Entity option is selected by default. -

Select Mapped Superclass if you defined a superclass.

-

To add an @Inheritance notation to the entity, select Inheritance and then select one of the inheritance mapping strategies (described in JSR 220):

-
    -
  • -

    SINGLE_TABLE -- All classes in a hierarchy as mapped to a single table. This annotation is without an attribute for the inheritance strategy.

    -
  • -
  • -

    TABLE_PER_CLASS -- Each class is mapped to a separate table.

    -
  • -
  • -

    JOINED -- The root of the class hierarchy is represented by a single table. Each subclass is represented by a separate table that contains those fields that are specific to the subclass (not inherited from its superclass), as well as the column(s) that represent its primary key. The primary key column(s) of the subclass table serves as a foreign key to the primary key of the superclass table.

    -
  • -
-
Entity
XML Entity MappingsSelect Add to entity mappings in XML to create XML mappings in orm.xml, rather than annotations. -

Use the Mapping file field to specify the file to use. By default, mappings are stored in the META-INF/orm.xml file.

-

-
- -

 

-Related task
-
-Creating a JPA Entity -

 

-Related task
-
-Create JPA Entity wizard
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_EntityPropertiesPage.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_EntityPropertiesPage.htm deleted file mode 100644 index 8914f86c92..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_EntityPropertiesPage.htm +++ /dev/null @@ -1,117 +0,0 @@ - - - - - - - -Entity Properties page - - - - - - - - - - - -

-
-

Entity Properties page

-

This table lists the properties of the Entity Properties page of the Create JPA Entity wizard.

-
-

 

- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
-

Entity Name

-
-

The name of the entity. By default, this value is the same as the one entered as the class name. If the entity name differs from the class name, then the entity name is added as an attribute. For example: @Entity(name="EntityName").

-
-

Determined by server.

-
-

Table Name

-
-

Select Use default to match the name of the mapped table name to the entity name. Otherwise, clear the Use default option and enter the name in the Table Name field. These options result in the addition of the @Table option to the Java class file.

-
-

Use default.

-
-

Entity Fields

-
-

Click the Add button to add persistence fields using the Entity Fields dialog. This dialog enable you to build a field by entering a field name and selecting among persistence types. The Key option enables you to mark a field as a primary key. The dialog's Browse function enables you to add other persistence types described in the JPA specification. The Edit button enables you to change the name or type set for a persistent field.

-

-

Access Type

-
-

Select whether the entity's access to instance variables is field-based or property-based, as defined in the JPA specification.

-
    -
  • -

    Field – Instance variables are accessed directly. All non-transient instance variables are persistent.

    -
  • -
  • -

    Property – Persistent state accessed through the property accessor methods. The property accessor methods must be public or private.

    -
  • -
-
-

Field

-
-
- -

 

-Related task
-
-Creating a JPA Entity
-Adding persistence to a class -

 

-Related reference
-
-JPA Details view (for entities)
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_add_converter.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_add_converter.htm deleted file mode 100644 index f992258622..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_add_converter.htm +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - -Add Converter dialog - - - - - - - - - - - -

-
-

Add Converter dialog

-

Use this dialog to create a new EclipseLink converter.

-
- --- - - - - - - - - - - - - - - - -
PropertyDescription
NameEnter the name for this converter
TypeSelect the converter type: -
    -
  • -

    Custom

    -
  • -
  • -

    Object type

    -
  • -
  • -

    Struct

    -
  • -
  • -

    Type

    -
  • -
-
-
-
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_association_cardinality.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_association_cardinality.htm deleted file mode 100644 index 17b8e5d990..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_association_cardinality.htm +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - -Association Cardinality - - - - - - - - - - - -

-
-

Association Cardinality

-

Use this dialog to specify cardinality of an association table. Depending on the Association Kind and Join Columns that you selected previously, some associations may not be available.

-
    -
  • -

    Many to one

    -
  • -
  • -

    One to many

    -
  • -
  • -

    One to one

    -
  • -
  • -

    Many to many

    -
  • -
-

 

-Related task
-
-Create New Association
-Generating entities from tables
-JPA Details view (for entities) -

 

-Related reference
-
-Generate Entities from Tables Wizard
- - - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_association_table.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_association_table.htm deleted file mode 100644 index 78197f6367..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_association_table.htm +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - -Association Tables - - - - - - - - - - - -

-
-

Association Tables

-

Use this page to specify the association tables for an entity.

-
- --- - - - - - - - - - - - - - - - -
PropertyDescription
Association kindSpecify if the association is Simple (1:M) or Many to Many (M:M).
Association tablesClick Table Selection, then select the two tables to associate. -

When creating a Many to Many association, you can select a Join Table for the association.

-
-
- -

 

-Related task
-
-Create New Association
-Generating entities from tables
-JPA Details view (for entities) -

 

-Related reference
-
-Generate Entities from Tables Wizard
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_configure_jaxb_class_generation_dialog.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_configure_jaxb_class_generation_dialog.htm deleted file mode 100644 index 7efc7a4ffa..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_configure_jaxb_class_generation_dialog.htm +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - -Configure JAXB Class Generation dialog - - - - - - - - - - - -

-
-

Configure JAXB Class Generation dialog

-

Use this dialog to generate JAXB classes from a schema.

-
- --- - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
Source folderLocation in which to generate the classes. Click Browse to select a location.
PackageName of the package. Click Browse to select an existing package.
CatalogName of the catalog file to use to resolve external entity references.
Bindings filesClick Add to select the external bindings files
-
- -

 

-Related task
-
-Generating JAXB Classes from a Schema -

 

-
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_custom_entities_wizard.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_custom_entities_wizard.htm deleted file mode 100644 index 6b5694a7a6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_custom_entities_wizard.htm +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - -Generate Entities from Tables Wizard - - - - - - - - - - - -

-
-

Generate Entities from Tables Wizard

-

Use the Generate Custom Entities Wizard to create entities from your database tables.

-

The wizard consists of the following pages:

- - - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_jpa_entity_wizard.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_jpa_entity_wizard.htm deleted file mode 100644 index 12da7476c9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_jpa_entity_wizard.htm +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - -Create JPA Entity wizard - - - - - - - - - - - -

-
-

Create JPA Entity wizard

-

The Create JPA wizard enables you to quickly add an entity and also add persistence fields to that entity. In addition, this wizard adds the accessor methods (getter and setter) in the class file. The wizard consists of the following pages:

- - - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_new_association_wizard.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_new_association_wizard.htm deleted file mode 100644 index b74aa5a71a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_create_new_association_wizard.htm +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - -Create New Association - - - - - - - - - - - -

-
-

Create New Association

-

Use the Create New Association wizard to specify association tables when generating an entity.

-

The wizard consists of the following pages:

- - - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_customizIndividualEntities.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_customizIndividualEntities.htm deleted file mode 100644 index e847da34fd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_customizIndividualEntities.htm +++ /dev/null @@ -1,89 +0,0 @@ - - - - - - - -Customize Individual Entities - - - - - - - - - - - -

-
-

Customize Individual Entities

-

Use this page to customize each generated entity. Select an item in the Table and columns area, then complete the following fields for each item.

-
- --- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
Table MappingUse these options to define the table mapping information for the entity.
  Key generatorSelect the generator used for this mapping.
  Sequence nameEnter a name for the sequence. -

You can use $table and $pk as variables in the name. These will be replaced by the table name and primary key column name (respectively) when Dali generates a table mapping.

-
  Entity accessSpecify the default entity access method: Field (default) or Property.
Domain Java ClassUse these options to define the class information (Superclass and Interfaces) for the entity.
-
- -

 

-Related task
-
-Creating a JPA Entity
-Generating entities from tables
-JPA Details view (for entities) -

 

-Related reference
-
-Generate Entities from Tables Wizard -

 

-
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_customizeDefaultEntityGeneration.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_customizeDefaultEntityGeneration.htm deleted file mode 100644 index 578801a58e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_customizeDefaultEntityGeneration.htm +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - -Customize Default Entity Generation - - - - - - - - - - - -

-
-

Customize Default Entity Generation

-

Use this page to specify the default information Dali will use when generating the entities from the database tables. You will be able to override this information for specific entities.

-
- --- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
Table MappingUse these options to define the table mapping information for the entity.
  Key generatorSelect the generator used for this mapping.
  Sequence nameEnter a name for the sequence. -

You can use $table and $pk as variables in the name. These will be replaced by the table name and primary key column name (respectively) when Dali generates a table mapping.

-
  Entity accessSpecify the default entity access method: Field (default) or Property.
  Associations fetchSpecify the default fetch mode for associations: Default, as defined by the application (default), or Lazy.
  Collection typeSpecify if the collection properties are a Set or List. -

Enable the Always generate optional JPA annotations and DDL parameters option to have Dali include this information in the entity.

-
Domain Java ClassUse these options to define the class information (Package, Superclass, and Interfaces) for the entity.
-
- -

 

-Related task
-
-Creating a JPA Entity
-Generating entities from tables
-JPA Details view (for entities) -

 

-Related reference
-
-Generate Entities from Tables Wizard
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_details_orm.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_details_orm.htm deleted file mode 100644 index 018594b103..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_details_orm.htm +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - -JPA Details view (for orm.xml) - - - - - - - - - - - -

-
-

JPA Details view (for orm.xml)

-

The JPA Details view displays the default mapping and persistence information for the project and contains the following areas:

- -

These defaults can be overridden by the settings on a specific entity or mapping.

- - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_eclipselink_mapping_file.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_eclipselink_mapping_file.htm deleted file mode 100644 index 18a6305077..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_eclipselink_mapping_file.htm +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - -New EclipseLink Mapping File dialog - - - - - - - - - - - -

-
-

New EclipseLink Mapping File dialog

-

Specify the location and properties of the EclipseLink mapping file (eclispelink-orm.xml).

-
- --- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
ProjectSelect the project in which to add the mapping file.
Source folderClick Browse and select the source file in which to add the mapping file. The default is ../<PROJECT>/src.
File pathEnter the filename and path of the mapping file. The default is META-INF/eclipselink-orm.xml.
Default accessSelect whether the entity's access to instance variables is field-based or property-based, as defined in the JPA specification.
Add to persistence unitSpecify if this mapping file should be added to the persistence unit (persistence.xml).
  Persistence UnitSelect the persistence unit in which to add the mapping file.
-
- -Related reference
-
-Mapping File
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_java_page.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_java_page.htm deleted file mode 100644 index ffbf3fdaff..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_java_page.htm +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - -Java Page - - - - - - - - - - - -

-
-

Java Page

-

This table lists the properties available on the Java page of the Create New JPA Project wizard.

-
- ---- - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
Source folders on build pathClick Add Folder to select an existing Java source folder to add to this project.EclipseLink
Default output folderSpecify the location of the .class files.build\classes
-
- -

 

-Related task
-
-Creating a new JPA project -

 

-Related task
-
-Create New JPA Project wizard
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_jaxb_schema_wizard.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_jaxb_schema_wizard.htm deleted file mode 100644 index e2eb5bf134..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_jaxb_schema_wizard.htm +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - -Generate Schema from JAXB Classes Wizard - - - - - - - - - - - -

-
-

Generate Schema from JAXB Classes Wizard

-

Use the Generate Schema from JAXB Classes wizard create an XML schema ( .xsd) for a set of JAXB mapped classes.

-

The wizard consists of the following pages:

- -Related task
-
-Generating Schema from Classes -

 

-Related reference
-
-Generate Schema from JAXB Classes Wizard - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_join_columns.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_join_columns.htm deleted file mode 100644 index 8632cbfec4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_join_columns.htm +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - -Join Columns - - - - - - - - - - - -

-
-

Join Columns

-

Use this dialog to specify the join columns of an association table.

-

Click Add to specify the join columns between the two tables.

-

 

-Related task
-
-Create New Association
-Generating entities from tables
-JPA Details view (for entities) -

 

-Related reference
-
-Generate Entities from Tables Wizard
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_jpa_facet.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_jpa_facet.htm deleted file mode 100644 index 89e4ff8a71..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_jpa_facet.htm +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - -JPA Facet page - - - - - - - - - - - -

-
-

JPA Facet page

-

This table lists the properties available on the JPA Facet page of the Create New JPA Project wizard.

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
PlatformVendor-specific JPA implementation.EclipseLink
JPA ImplementationSelect a specific JPA library configuration. -

Click Manage libraries to create or update a user library.

-

Click Download libraries to download a specific library configuration.

-

  TypeSelect User Library to select from the available user-defined or downloaded libraries. -

If you select Disable, you must manually include the JPA implementation library on the project classpath.

-
User Library
  Include libraries with this applicationSpecify if the selected libraries are included when deploying the application.Selected
ConnectionSelect the database connection to use with the project. Dali requires an active database connection to use and validate the persistent entities and mappings. -

Click Add connection to create a new database connection.

-

  Override default schema from connectionSelect a schema other than the default one that is derived from the connection information. Use this option if the default schema cannot be used. For example, use this option when the deployment login differs from the design-time login.The value calculated by Dali.
JPA ImplementationSelect to use the JPA implementation provided by the server at runtime, or select a specific implementation library that contain the Java Persistence API (JPA) and entities to be added to the project's Java Build Path. -

Click Configure default JPA implementation library to create a default library for the project or click Configure user libraries to define additional libraries.

-

Depending on your JPA implementation (for example, Generic or EclipseLink), different options may be available when working with JPA projects.

-
Determined by server.
Persistent class managementSpecify if Dali will discover annotated classes automatically, or if the annotated classes must be listed in the persistence.xml file. -

Note: To insure application portability, you should explicitly list the managed persistence classes that are included in the persistence unit.

-
Determined by server.
Create orm.xmlSpecify if Dali should create a default orm.xml file for your entity mappings and persistence unit defaults.Selected
-
- -

 

-Related task
-
-Creating a new JPA project -

 

-Related task
-
-Create New JPA Project wizard
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_mapping_general.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_mapping_general.htm deleted file mode 100644 index 7b02bb68fd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_mapping_general.htm +++ /dev/null @@ -1,272 +0,0 @@ - - - - - - - -General information - - - - - - - - - - - -

-
-

General information

-

This table lists the General properties available in the Java Details view for each mapping type.

-
- ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefaultAvailable for Mapping Type
Mapping Type HyperlinkClicking the name of the mapping type, which is represented as a hyperlink, invokes the Mapping Type Selection dialog. Use this dialog to specify the type of attribute.BasicAll mapping types
ColumnThe database column that contains the value for the attribute. This field corresponds to the @Column annotation.By default, the Column is assumed to be named identically to the attribute.Basic mapping, Embedded mapping, ID mapping, Version mapping
  NameName of the database column. -

This field corresponds to the @Column annotation.

-

Basic mapping, Embedded mapping, ID mapping
  TableName of the database table that contains the selected column.
Basic mapping, Embedded mapping, ID mapping
  InsertableSpecifies if the column is always included in SQL INSERT statements.TrueBasic mapping, Embedded mapping, ID mapping
  UpdatableSpecifies if this column is always included in SQL UPDATE statements.TrueBasic mapping, Embedded mapping, ID mapping
  UniqueSets the UNIQUE constraint for the column.FalseBasic mapping, Embedded mapping, ID mapping
  NullableSpecifies if the column allows null values.TrueBasic mapping, Embedded mapping, ID mapping
  LengthSets the column length.255Basic mapping, Embedded mapping, ID mapping
  PrecisionSets the precision for the column values.0Basic mapping, Embedded mapping, ID mapping
  ScaleSets the number of digits that appear to the right of the decimal point.0Basic mapping, Embedded mapping, ID mapping
  Column DefinitionDefine the DDL for a column. This is used when a table is being generated.
Basic mapping, Embedded mapping, ID mapping
Fetch TypeDefines how data is loaded from the database: -
    -
  • -

    Eager – Data is loaded in before it is actually needed.

    -
  • -
  • -

    Lazy – Data is loaded only when required by the transaction.

    -
  • -
-
EagerBasic mapping, One-to-one mapping, Many-to-many mapping, Many-to-one mapping
OptionalSpecifies if this field is can be null.YesBasic mapping, One-to-one mapping, Many-to-one mapping
LobSpecify if the field is mapped to java.sql.Clob or java.sql.Blob. -

This field corresponds to the @Lob annotation.

-

Basic mapping
TemporalSpecifies if this field is one of the following: -
    -
  • -

    Date – java.sql.Date

    -
  • -
  • -

    Time – java.sql.Time

    -
  • -
  • -

    Timestamp – java.sql.Timestamp

    -
  • -
-

This field corresponds to the @Temporal annotation.

-

Basic mapping, ID mapping
EnumeratedSpecify how to persist enumerated constraints if the String value suits your application requirements or to match an existing database schema. -
    -
  • -

    ordinal

    -
  • -
  • -

    String

    -
  • -
-

This field corresponds to the @Enumerated annotation.

-
Ordinal
Target EntityThe persistent entity to which the attribute is mapped.
One-to-one mapping, One-to-many mapping Many-to-many mapping, Many-to-one mapping
IDSpecify if the entity's ID is derived from the identity of another entity.

Cascade TypeSpecify which operations are propagated throughout the entity. -
    -
  • -

    All – All operations

    -
  • -
  • -

    Persist

    -
  • -
  • -

    Merge

    -
  • -
  • -

    Move

    -
  • -
  • -

    Remove

    -
  • -
  • -

    Refresh

    -
  • -
-

One-to-one mapping, One-to-many mapping, Many-to-many mapping, Many-to-one mapping
Mapped ByThe field in the database table that "owns" the relationship. This field is required only on the non-owning side of the relationship.
One-to-one mapping, One-to-many mapping
Order BySpecify the default order for objects returned from a query: -
    -
  • -

    No ordering

    -
  • -
  • -

    Primary key

    -
  • -
  • -

    Custom ordering

    -
  • -
-

This field corresponds to the @OrderBy annotation.

-
Primary keyOne-to-many mapping. Many-to-many mapping, Many-to-one mapping
Attribute OverridesOverrides Basic mappings of a mapped superclass (for example, if the inherited column name is incompatible with a pre-existing data model, or invalid as a column name in your database).
Embedded mapping -

Embedded mapping

-
-
- -

 

-Related task
-
-Mapping an entity
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_new_jpa_project.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_new_jpa_project.htm deleted file mode 100644 index 2a576e6eba..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_new_jpa_project.htm +++ /dev/null @@ -1,104 +0,0 @@ - - - - - - - -New JPA Project page - - - - - - - - - - - -

-
-

New JPA Project page

-

This table lists the properties available on the New JPA Project page of the Create New JPA Project wizard.

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
Project nameName of the Eclipse JPA project.
Project contentsLocation of the workspace in which to save the project. -

Unselect The Use Default option and click Browse to select a new location.

-
Current workspace
Target runtimeSelect a pre-defined target for the project. -

Click New to create a new environment with the New Server Runtime wizard.

-

ConfigurationsSelect a project configuration with pre-defined facets. -

Select <custom> to manually select the facets for this project.

-
Utility JPA project with Java 5.0
EAR membershipSpecify if this project should be included in an EAR file for deployment. -

Select the EAR Project Name, or click New to create a new EAR project.

-

Working setsSpecify if this project should be included in an existing working set. The drop down field shows a list of previous selected working sets. -

Select Add project to working sets, then select a working set in which to add this project.

-

-
- -

 

-Related task
-
-Creating a new JPA project -

 

-Related task
-
-Create New JPA Project wizard
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_new_jpa_project_wizard.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_new_jpa_project_wizard.htm deleted file mode 100644 index b59320be77..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_new_jpa_project_wizard.htm +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - -Create New JPA Project wizard - - - - - - - - - - - -

-
-

Create New JPA Project wizard

-

The Create New JPA Project wizard allows you to create a new Java project using JPA. The wizard consists of the following pages:

- - - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_general.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_general.htm deleted file mode 100644 index ea6f099cfc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_general.htm +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - -General - - - - - - - - - - - -

-
-

General

-

The following table lists properties available in the General page of the persistence.xml Editor.

-
-

Properties of the General Page

- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
-

Name

-
-

Enter the name of the persistence unit.

-
-

The project name.

-
-

Persistence Provider

-
-

Enter the name of the persistence provider.

-
-

Determined by the server.

-
-

Description

-
-

Enter a description for this persistence unit. This is an optional property.

-

-

Managed Classes

-
-

Add or remove the classes managed through the persistence unit.

-

-

Exclude Unlisted Classes

-
-

Select to include all annotated entity classes in the root of the persistence unit.

-
-

False

-
-

XML Mapping Files

-
-

Add or remove the object/relational mapping XML files that define the classes to be managed by the persistence unit.

-
-

Meta-INF\orm.xml

-
-

JAR Files

-


-
-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_map_view.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_map_view.htm deleted file mode 100644 index 40d2673812..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_map_view.htm +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - -JPA Details view (for attributes) - - - - - - - - - - - -

-
-

JPA Details view (for attributes)

-

The JPA Details view displays the persistence information for the currently selected mapped attribute and contains the following areas:

- - - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_outline.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_outline.htm deleted file mode 100644 index abdafce3b3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_outline.htm +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - -JPA Structure view - - - - - - - - - - - -

-
-

JPA Structure view

-

The JPA Structure view displays an outline of the structure (its attributes and mappings) of the entity that is currently selected or opened in the editor. The structural elements shown in the outline are the entity and its fields.

-
-

Sample JPA Structure View

-Sample JPA Structure view for an entity.
- -

 

-Related reference
-
-JPA Development perspective -

 

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_perspective.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_perspective.htm deleted file mode 100644 index 0be8caf0d2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_perspective.htm +++ /dev/null @@ -1,56 +0,0 @@ - - - - - - - -JPA Development perspective - - - - - - - - - - - -

-
-

JPA Development perspective

-

The JPA Development perspective defines the initial set and layout of views in the Workbench window when using Dali. By default, the JPA Development perspective includes the following views:

- -Related concept
-

Perspectives

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_prop_view.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_prop_view.htm deleted file mode 100644 index 408e016a11..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_prop_view.htm +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - -JPA Details view (for entities) - - - - - - - - - - - -

-
-

JPA Details view (for entities)

-

The JPA Details view displays the persistence information for the currently selected entity and contains the following tabs:

- - - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_xmll_editor.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_xmll_editor.htm deleted file mode 100644 index 027900047f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_persistence_xmll_editor.htm +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - -persistence.xml Editor - - - - - - - - - - - -

-
-

persistence.xml Editor

-

The persistence.xml Editor provides an interface that enables you to update the persistence.xml file. For projects using the EclipseLink platform, the perisistence.xml Editor consists of the following pages:

- -

For projects using the Generic platform, the following subset of these pages is available:

- - - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_primary_key.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_primary_key.htm deleted file mode 100644 index 78ae018537..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_primary_key.htm +++ /dev/null @@ -1,142 +0,0 @@ - - - - - - - -Primary Key Generation information - - - - - - - - - - - -

-
-

Primary Key Generation information

-

This table lists the fields available in the Primary Key Generation area in JPA Details view for ID mapping types.

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
Primary Key GenerationThese fields define how the primary key is generated. These fields correspond to the @GeneratedValue annotation.Generated Value
   Strategy -
    -
  • Auto
  • -
  • -

    Identity – Values are assigned by the database's Identity column.

    -
  • -
  • -

    Sequence – Values are assigned by a sequence table (see Sequence Generator).

    -
  • -
  • -

    Table – Values are assigned by a database table (see Table Generator).

    -
  • -
-
Auto
  Generator NameUnique name of the generated value.
Table GeneratorThese fields define the database table used for generating the primary key and correspond to the @TableGenerator annotation. -

These fields apply only when Strategy = Table.

-

  NameUnique name of the generator.
  TableDatabase table that stores the generated ID values.
  Primary Key ColumnThe column in the table generator's Table that contains the primary key.
  Value ColumnThe column that stores the generated ID values.
  Primary Key Column ValueThe value for the Primary Key Column in the generator table.
Sequence GeneratorThese fields define the specific sequence used for generating the primary key and correspond to the @SequenceGenerator annotation. -

These fields apply only when Strategy = Sequence.

-

  NameName of the sequence table to use for defining primary key values.
  SequenceUnique name of the sequence.
-
- -

 

-Related task
-
-ID mapping -

 

-Related task
-
-JPA Details view (for attributes)
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_project_properties.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_project_properties.htm deleted file mode 100644 index 7a6aa85241..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_project_properties.htm +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - -Project Properties page – Java Persistence Options - - - - - - - - - - - -

-
-

Project Properties page – Java Persistence Options

-

Use the Errors/Warnings options on the Properties page to specify the validation options to use with the project.

-
- --- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
Enable project specific settingsSelect the to override the general settings for this project.
  Project levelSelect the warning level to report.
  Persistent unit levelSelect the warning level to report.
  Type levelSelect the warning level to report.
  Attribute levelSelect the warning level to report.
  Schema mappingSelect the warning level to report.
  Implied attributesSelect the warning level to report.
  Implied associationsSelect the warning level to report.
  InheritanceSelect the warning level to report.
  Queries and generatorsSelect the warning level to report.
-
- -

 

-Related task
-
-Modifying persistent project properties
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_schema_from_classes_page.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_schema_from_classes_page.htm deleted file mode 100644 index 46ff81ed85..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_schema_from_classes_page.htm +++ /dev/null @@ -1,42 +0,0 @@ - - - - - - - -Generate Schema from Classes - - - - - - - - - - - -

-
-

Generate Schema from Classes

-

Use this dialog to select the classes from which to generate a schema. You can select an entire project, a package, or specific classes.

-
- - - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_selectTables.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_selectTables.htm deleted file mode 100644 index ea7d3c1a7f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_selectTables.htm +++ /dev/null @@ -1,79 +0,0 @@ - - - - - - - -Select Tables - - - - - - - - - - - -

-
-

Select Tables

-

Use the Select Tables dialog to specify the database connection and tables from which to create entities.

-
- --- - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
ConnectionSelect a database connection or click Add Connection to create a new connection.
SchemaSelect the database schema from which to select tables.
TablesSelect the tables from which to create Java persistent entities. The tables shown are determined by the database connection and schema selections.
Synchronize Classes listed in persistence.xmlSpecify if Dali should update the persistence.xml file to include the generated classes.
-
- -

 

-Related task
-
-Creating a JPA Entity
-Generating entities from tables -

 

-Related reference
-
-Generate Entities from Tables Wizard
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_select_cascade_dialog.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_select_cascade_dialog.htm deleted file mode 100644 index 317bf1e1f0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_select_cascade_dialog.htm +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - -Select Cascade dialog - - - - - - - - - - - -

-
-

Select Cascade dialog

-

Specify which operations are propagated throughout the association: All, Persist, Merge, Remove, or Refresh.

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/ref_tableAssociations.htm b/jpa/plugins/org.eclipse.jpt.doc.user/ref_tableAssociations.htm deleted file mode 100644 index 507ef3adaa..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/ref_tableAssociations.htm +++ /dev/null @@ -1,78 +0,0 @@ - - - - - - - -Table Associations - - - - - - - - - - - -

-
-

Table Associations

-

Use this page to create or edit the association between the database table and entity.

-
- --- - - - - - - - - - - - - - - - - - - - -
PropertyDescription
Table associationsSelect an association to modify or click to create a new table association with the Create New Association wizard.
Generate this associationSpecify if Dali should create the selected association. If enabled, you can specify the Cardinality and Join table for the table association.
Generate a reference to <ROW> in <TABLE>Specify if the entity should contain a reference to the specified table. -

If enabled, you can also enter the Property name and select the Cascade method (all, persist, merge, remove, or refresh) for the reference.

-
-
- -

 

-Related task
-
-Creating a JPA Entity
-Generating entities from tables
-Create New Association -

 

-Related reference
-
-Generate Entities from Tables Wizard
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference.htm deleted file mode 100644 index edb027d6f3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference.htm +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - -Reference - - - - - - - - - - - -

-

Reference

-

This section includes detailed help information for each of the following elements in the Dali OR Mapping Tool:

- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference001.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference001.htm deleted file mode 100644 index be40229799..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference001.htm +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - -Wizards - - - - - - - - - - - -

-
-

Wizards

-

This section includes information on the following wizards:

- - - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference002.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference002.htm deleted file mode 100644 index a636406aa6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference002.htm +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - -Mapping File Wizard - - - - - - - - - - - -

-
-

Mapping File Wizard

-

The Mapping File wizard enables you to add an orm.xml file to a JPA project if no object map exists at the location specified. For example, if you cleared the Create orm.xml option on the JPA Facet page, you can later add the orm.xml file to the src file of the project using this wizard.

-

The Mapping File Wizard consists of the Mapping File page.

- - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference003.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference003.htm deleted file mode 100644 index 80773ce3bd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference003.htm +++ /dev/null @@ -1,134 +0,0 @@ - - - - - - - -Mapping File - - - - - - - - - - - -

-
-

Mapping File

-

This table lists the properties of the Mapping File Wizard.

-
-

Mapping File Wizard Properties

- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
-

Project

-
-

The name of the JPA project.

-
-

Selected.

-
-

Source folder

-
-

The location of the project's src folder. If needed, click Browse to point the wizard to the src file's location.

-
-

Selected.

-
-

File Path

-
-

The location for the new orm.xml file.

-
-

Selected.

-
-

Default Access

-
-

Select whether the access to the entity is field-based or property-based, as defined in JPA specification.

-
    -
  • -

    None – No access type specified.

    -
  • -
  • -

    Property-based – Persistent state accessed through the property accessor methods. The property accessor methods must be public or private.

    -
  • -
  • -

    Field-based – Instance variables are accessed directly. All non-transient instance variables are persistent.

    -
  • -
-
-

None

-
-

Add to persistence unit

-
-

Designates the persistence unit for this object map file.

-
-

Selected.

-
-
- -

 

-Related task
-
-Creating a new JPA project
-Creating a JPA Entity
-Mapping an entity -

 

-Related task
-
-Mapping File Wizard
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference004.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference004.htm deleted file mode 100644 index 8a00cd0882..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference004.htm +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - -Generate Tables from Entities Wizard - - - - - - - - - - - -

-
-

Generate Tables from Entities Wizard

-

Use the Generate DDL from Entities Wizard to quickly create DDL scripts from your persistent entities. Dali automatically creates the necessary primary and foreign keys, based on the entity mappings.

-

 

-Related task
-
-Generating entities from tables
-Creating a JPA Entity
-Mapping an entity -

 

-Related task
-
-Create JPA Entity wizard
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference005.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference005.htm deleted file mode 100644 index a11400d263..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference005.htm +++ /dev/null @@ -1,52 +0,0 @@ - - - - - - - -Property pages - - - - - - - - - - - -

-
-

Property pages

-

This section includes information on the following:

- - - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference006.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference006.htm deleted file mode 100644 index 31bc24dbb3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference006.htm +++ /dev/null @@ -1,122 +0,0 @@ - - - - - - - -General information - - - - - - - - - - - -

-
-

General information

-

This table lists the General information fields available in the JPA Details view for each entity type.

-
- ----- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefaultAvailable for Entity Type
Mapping Type HyperlinkClicking the name of the mapping type, which is represented as a hyperlink, invokes the Mapping Type Selection dialog. Use this dialog to specify the type of entity: Mapped Superclass, Embeddable or the default mapping type.EntityEntity, Embeddable, and Mapped superclass
TableThe default database table information for this entity. These fields can be overridden by the information in the Attribute overrides area.
Entity
  NameThe name of the primary database table associated with the entity.
Entity
  CatalogThe database catalog that contains the Table.As defined in orm.xml.Entity
  SchemaThe database schema that contains the Table.As defined in orm.xml.Entity
NameThe name of this entity. By default, the class name is used as the entity name.
Entity
AccessThe access method for this entity.FieldEntity
Primary key classClick Browse and select the primary key for the entity. Clicking the field name, which is represented as a hyperlink, allows you to create a new class.

CachableSpecifies if the entity is cachable. -

This field corresponds to the @Cachable annotation.

-
@Cachable(false)Entity
-
- -

 

-Related task
-
-Adding persistence to a class -

 

-Related reference
-
-JPA Details view (for entities)
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference007.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference007.htm deleted file mode 100644 index 3100acd390..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference007.htm +++ /dev/null @@ -1,80 +0,0 @@ - - - - - - - -Attribute overrides - - - - - - - - - - - -

-
-

Attribute overrides

-

Use the Attribute Overrides area in the JPA Details view to override the default settings specified in the General information area of an attribute. Attribute overrides generally override/configure attributes that are inherited or embedded.

-

This table lists the Attribute override fields available in the JPA Details view for each entity type.

-
- ----- - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefaultAvailable for Entity Type
Attribute OverridesSpecify a property or field to be overridden (from the default mappings). Select Override Default.
Entity
Join ColumnsSpecify the joining strategy. Select Override Default to add a different joining strategy.Join columnsEntity
-
- -

 

-Related task
-
-General information
-Adding persistence to a class -

 

-Related reference
-
-JPA Details view (for entities)
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference008.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference008.htm deleted file mode 100644 index edd0f9f932..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference008.htm +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - -Secondary table information - - - - - - - - - - - -

-
-

Secondary table information

-

Use the Secondary Tables area in the JPA Details view to associate additional tables with an entity. Use this area if the data associated with an entity is spread across multiple tables.

-

 

-Related task
-
-Specifying additional tables
-Adding persistence to a class -

 

-Related reference
-
-JPA Details view (for entities)
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference009.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference009.htm deleted file mode 100644 index b905385cad..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference009.htm +++ /dev/null @@ -1,113 +0,0 @@ - - - - - - - -Inheritance information - - - - - - - - - - - -

-
-

Inheritance information

-

This table lists the fields available on the Inheritance area in the JPA Details view for each entity type.

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
StrategySpecify the strategy to use when mapping a class or class hierarchy: -
    -
  • -

    Single table – All classes in the hierarchy are mapped to a single table.

    -
  • -
  • -

    Joined – The root of the hierarchy is mapped to a single table; each child maps to its own table.

    -
  • -
  • -

    Table per class – Each class is mapped to a separate table.

    -
  • -
-

This field corresponds to the @Inheritance annotation.

-
Single table
Discriminator ValueSpecify the discriminator value used to differentiate an entity in this inheritance hierarchy. The value must conform to the specified Discriminator Type.
Discriminator ColumnThese fields are available when using a Single or Joined inheritance strategy. -

This field corresponds to the @DiscriminatorColumn annotation.

-

Use the Details area to define the Length and Column definition of this Discriminator Column.

-

  NameName of the discriminator column
  TypeSet this field to set the discriminator type to Char or Integer (instead of its default: String). The Discriminator Value must conform to this type.String
Primary Key Join ColumnsUse to override the default primary key join columns. Select Override Default, then click Add to select new Join Column. -

This field corresponds with @PrimaryKeyJoinColumn annotation.

-

-
- -

 

-Related task
-
-Specifying entity inheritance
-Adding persistence to a class -

 

-Related reference
-
-JPA Details view (for entities)
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference010.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference010.htm deleted file mode 100644 index f4b3e9ab36..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference010.htm +++ /dev/null @@ -1,47 +0,0 @@ - - - - - - - -Queries - - - - - - - - - - - -
-

Queries

-

Use the queries area of the JPA Details view to create named queries and named native queries. Refer to "Creating Named Queries" for additional information.

-

 

-Related task
-
-Creating Named Queries -

 

-Related reference
-
-JPA Details view (for entities)
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference011.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference011.htm deleted file mode 100644 index 25cdce9134..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference011.htm +++ /dev/null @@ -1,82 +0,0 @@ - - - - - - - -Join Table Information - - - - - - - - - - - -

-
-

Join Table Information

-

Use area to specify a mapped column for joining an entity association. By default, the mapping is assumed to have a single join.

-

This table lists the fields available on the Join Table area in the JPA Details view for One-to-many mapping and Many-to-many mapping mapping types.

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
NameName of the join table that contains the foreign key column.By default, the name is assumed to be the primary tables associated with the entities concatenated with an underscore.
Join ColumnsSpecify a mapped column for joining an entity association. This field corresponds to the @JoinColum attribute. -

Select Override Default, then Add, Edit, or Remove the join columns.

-
By default, the mapping is assumed to have a single join.
Inverse Join ColumnsSelect Override Default, then Add, Edit, or Remove the join columns.
-
- -

 

-Related task
-
-Mapping an entity -

 

-Related task
-
-Edit Join Columns Dialog
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference012.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference012.htm deleted file mode 100644 index 619907782d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference012.htm +++ /dev/null @@ -1,71 +0,0 @@ - - - - - - - -Join Columns Information - - - - - - - - - - - -

-
-

Join Columns Information

-

This table lists the fields available in the Join Table area in JPA Details view for Many-to-one mapping and One-to-one mapping mapping types.

-
- ---- - - - - - - - - - - - - - -
PropertyDescriptionDefault
Join ColumnSpecify a mapped column for joining an entity association. This field corresponds to the @JoinColum attribute. -

Select Override Default, then Add, Edit, or Remove the join columns.

-
By default, the mapping is assumed to have a single join.
-
- -

 

-Related task
-
-Mapping an entity -

 

-Related task
-
-Edit Join Columns Dialog
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference013.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference013.htm deleted file mode 100644 index 0b08922f60..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference013.htm +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - -General information - - - - - - - - - - - -

-
-

General information

-

This table lists the General information fields available in the JPA Details view for each entity type.

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
PackageThe Java package that contains the persistent entities. Click Browse and select the package
SchemaThe database schema that contains the Table. -

This field corresponds to the <schema> element in the orm.xml file.

-

CatalogThe database catalog that contains the Table. -

This field corresponds to the <catalog> element in the orm.xml file.

-

AccessSpecify the default access method for the variables in the project: -
    -
  • -

    Property

    -
  • -
  • -

    Field

    -
  • -
-

This field corresponds to the <access> element in the orm.xml file.

-

-
- -

 

-Related task
-
-Adding persistence to a class -

 

-Related reference
-
-JPA Details view (for entities)
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference014.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference014.htm deleted file mode 100644 index e824d3fab2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference014.htm +++ /dev/null @@ -1,106 +0,0 @@ - - - - - - - -Persistence Unit information - - - - - - - - - - - -

-
-

Persistence Unit information

-

This table lists the Persistence Unit information fields available in the JPA Details view for each entity type. These fields are contained in the <persistence-unit-metadata> element in the orm.xml file.

-
- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
XML Mapping Data CompleteSpecifies that the Java classes in this persistence unit are fully specified by their metadata. Any annotations will be ignored. -

This field corresponds to the <xml-mapping-metadata-complete> element in the orm.xml file.

-

Cascade PersistAdds cascade-persist to the set of cascade options in entity relationships of the persistence unit. -

This field corresponds to the <cascade-persist> element in the orm.xml file.

-

SchemaThe database schema that contains the Table. -

This field corresponds to the <schema> element in the orm.xml file.

-

CatalogThe database catalog that contains the Table. -

This field corresponds to the <catalog> element in the orm.xml file.

-

AccessSpecify how the entity its access instance variables. -
    -
  • -

    Property – Persistent state accessed through the property accessor methods. The property accessor methods must be public or private.

    -
  • -
  • -

    Field – Instance variables are accessed directly. All non-transient instance variables are persistent.

    -
  • -
-
Property
-
- -

 

-Related task
-
-Adding persistence to a class -

 

-Related reference
-
-JPA Details view (for entities)
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference015.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference015.htm deleted file mode 100644 index dd0c88a4e0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference015.htm +++ /dev/null @@ -1,116 +0,0 @@ - - - - - - - -Generators - - - - - - - - - - - -

-
-

Generators

-

This table lists the Generator information fields available in the JPA Details view for the orm.xml file.

-
- --- - - - - - - - - - - - -
PropertyDescription
GeneratorDisplays the existing Sequence and Table generators. -

Click Add Sequence or Add Table to add a new generator.

-

For sequence generators, you must complete the following fields:

-
    -
  • -

    Name

    -
  • -
  • -

    Sequence

    -
  • -
  • -

    Schema

    -
  • -
  • -

    Catalog

    -
  • -
  • -

    Allocation size

    -
  • -
  • -

    Initial value

    -
  • -
-

For table generators, you must complete the following fields:

-
    -
  • -

    Name

    -
  • -
  • -

    Table

    -
  • -
  • -

    Schema

    -
  • -
  • -

    Catalog

    -
  • -
  • -

    Primary key column

    -
  • -
  • -

    Value column

    -
  • -
  • -

    Primary key column value

    -
  • -
  • -

    Allocation size

    -
  • -
-
-
- -

 

-Related task
-
-Adding persistence to a class -

 

-Related reference
-
-JPA Details view (for orm.xml)
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference016.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference016.htm deleted file mode 100644 index 227a2b3ec2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference016.htm +++ /dev/null @@ -1,76 +0,0 @@ - - - - - - - -Queries - - - - - - - - - - - -

-
-

Queries

-

This table lists the Query information fields available in the JPA Details view for the orm.xml file.

-
- --- - - - - - - - - - - - - - - - -
PropertyDescription
QueriesDisplays the existing Named and Native queries. -

Click Add to add a named query, or Add Native for a native query.

-

For named queries, enter the query in the Query field.

-

For native queries, select a result class, then enter the query in the Query field.

-
Query HintsDisplays the existing query hints (Name and Value). -

Click Add to add a new query hint.

-
-
- -

 

-Related task
-
-Creating Named Queries -

 

-Related reference
-
-JPA Details view (for orm.xml)
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference017.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference017.htm deleted file mode 100644 index a9a21aad29..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference017.htm +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - -Converters - - - - - - - - - - - -

-
-

Converters

-

The Converters information in the JPA Details view applies only when using EclipseLink

-

Click Add to create a new converter, using the Add Converter dialog.

-

 

-

 

-Related reference
-
-JPA Details view (for orm.xml)
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference018.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference018.htm deleted file mode 100644 index 8f35b73150..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference018.htm +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - -Connection - - - - - - - - - - - -

-
-

Connection

-

The following table lists the properties available in the Connection page of the persistence.xml Editor.

-
-

Properties of the Connection Page

- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
-

Transaction Type

-
-

Specify if the connection for this persistence unit uses one of the following transaction types:

-
    -
  • -

    Default -- Select to use the container used by the container.

    -
  • -
  • -

    JTA (Java Transaction API) -- Transactions of the Java EE server.

    -
  • -
  • -

    Resource Local -- Native actions of a JDBC driver that are referenced by a persistence unit.

    -
  • -
-

-

Batch Writing

-
-

Specify the use of batch writing to optimize transactions with multiple write operations.

-

Set the value of this property into the session at deployment time.

-

Note: This property applies when used both in a Java SE and Java EE environment.

-

The following are the valid values for oracle.toplink.config.BatchWriting:

-
    -
  • -

    JDBC–Use JDBC batch writing.

    -
  • -
  • -

    Buffered–Do not use either JDBC batch writing nor native platform batch writing.

    -
  • -
  • -

    OracleJDBC–Use both JDBC batch writing and Oracle native platform batch writing.

    -
  • -
  • -

    None–Do not use batch writing (turn it off).

    -
  • -
-
-

None

-
-

Statement caching

-


-

Native SQL

-

-

False

-
-

JTA Data Source Name

-
-

If you selected JTA as the transaction type, then enter the name of the default JTA data source for the persistence unit.

-

-

Non-JTA Data Source Name

-
-

If you selected Resource Local as the transaction type, then enter the name of the non-JTA data source.

-

This property is not available for projects using the Generic platform.

-

-

  Bind Parameters

-
-

Control whether or not the query uses parameter binding.

-

Note: This property applies when used in a Java SE environment.

-

This property is not available for projects using the Generic platform.

-

-

EclipseLink Connection Pool

-
-

Define the connection pool driver, URL, user name and password.

-

These properties are note available for projects using the Generic platform.

-

-

  Read Connection

-
-

The maximum and minimum number of connections allowed in the JDBC read connection pool.

-

Note: These property apply when used in a Java SE environment.

-

These properties are not available for projects using the Generic platform

-

-

  Write Connection

-
-

The maximum and minimum number of connections allowed in the JDBC read connection pool.

-

Note: These property apply when used in a Java SE environment.

-

These properties are not available for projects using the Generic platform

-

-
-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference019.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference019.htm deleted file mode 100644 index 2a13dba748..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference019.htm +++ /dev/null @@ -1,221 +0,0 @@ - - - - - - - -Customization - - - - - - - - - - - -

-
-

Customization

-

The following table lists the properties available in the Customization page of the persistence.xml Editor.

-
-

Properties of the Customization Page

- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
-

Weaving

-
-

Specifies if weaving of the entity classes is performed. The EclipseLink JPA persistence provider uses weaving to enhance JPA entities for such properties as lazy loading, change tracking, fetch groups, and internal optimizations. Select from the following options:

-
    -
  • -

    No Weaving

    -
  • -
  • -

    Weave Dynamically

    -
  • -
  • -

    Weave Statically -- Use this option if you plan to execute your application outside of a Java EE 5 container in an environment that does not permit the use of -javaagent:eclipselink.jar on the JVM command line. This assumes that classes have already been statically woven. Run the static weaver on the classes before deploying them.

    -
  • -
-
-

Weave Dynamically

-
-

  Weaving Lazy

-
-

Select this option to enable lazy weaving.

-
-

True

-
-

  Weaving Fetch Groups

-
-

Select this option to enable fetch groups through weaving. Set this option to false if:

-
    -
  • -

    There is no weaving.

    -
  • -
  • -

    Classes should not be changed during weaving (for example, when debugging).

    -
  • -
-

Set this property to false for platforms where it is not supported.

-
-

True

-
-

Weaving internal

-

-

True

-
-

Weaving eager

-

-

False

-
-

  Weaving Change Tracking

-
-

Select this option to use weaving to detect which fields or properties of the object change.

-
-

True

-
-

  Throw Exceptions

-
-

Select this option to set EclipseLink to throw an exception or log a warning when it encounters a problem with any of the files listed in a persistence.xml file <mapping-file> element.

-
-

True

-
-

Exception handler

-
-

Select (or create) a Java class to handle exceptions.

-

-

Session Customizer

-
-

Select a session customizer class: a Java class that implements the eclipselink.tools.sessionconfiguration.SessionCustomizer interface and provides a default (zero-argument) constructor. Use this class' customize method, which takes an eclipselink.sessions.Session, to programmatically access advanced EclipseLink session API.

-

-

Descriptor Customizer

-
-

Select an EclipseLink descriptor customizer class–a Java class that implements the eclipselink.tools.sessionconfiguration.DescriptorCustomizer interface and provides a default (zero-argument) constructor. Use this class's customize method, which takes an eclipselink.descriptors.ClassDescriptor, to programmatically access advanced EclipseLink descriptor and mapping API for the descriptor associated with the JPA entity named <ENTITY>.

-

-

Validation only

-

-

True

-
-

Profiler

-
-
    -
  • -

    No Profiler

    -
  • -
  • -

    Performance Profiler

    -
  • -
  • -

    Query Monitor

    -
  • -
-
-

NoProfiler

-
-
- -
-

- - - - - - -
-

Note:

-This page is not available for projects using the Generic platform.
-
-
-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference020.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference020.htm deleted file mode 100644 index 769e6de077..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference020.htm +++ /dev/null @@ -1,185 +0,0 @@ - - - - - - - -Caching - - - - - - - - - - - -

-
-

Caching

-

This table lists the properties of the Caching page of the persistence.xml Editor.

-
-

Properties of the Caching Page

- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
-

Default Cache Type

-
-

Select one of the following as the Default Cache Type:

-
    -
  • -

    Soft with Weak Subcache–This option is similar to Weak with Hard Subcache except that it maintains a most frequently used subcache that uses soft references. The size of the subcache is proportional to the size of the identity map. The subcache uses soft references to ensure that these objects are garbage-collected only if the system is low on memory.

    -

    Use this identity map in most circumstances as a means to control memory used by the cache.

    -
  • -
  • -

    Week with Hard Subcache–This option is similar to Soft with Weak subcache except that it maintains a most frequently used subcache that uses hard references. Use this identity map if soft references are not suitable for your platform.

    -
  • -
  • -

    Weak–This option is similar to Full, except that objects are referenced using weak references. This option uses less memory than Full, allows complete garbage collection and provides full caching and guaranteed identity.

    -

    Use this identity map for transactions that, once started, stay on the server side.

    -
  • -
  • -

    Soft–This option is similar to Weak except that the map holds the objects using soft references. This identity map enables full garbage collection when memory is low. It provides full caching and guaranteed identity.

    -
  • -
  • -

    Full–This option provides full caching and guaranteed identity: all objects are cached and not removed.

    -

    Note: This process may be memory-intensive when many objects are read.

    -
  • -
  • -

    None–This option does not preserve object identity and does not cache objects.This option is not recommended.

    -
  • -
-
-

Weak with soft subcache

-
-

Default Cache Size

-
-

Set the size (maximum number of objects) of the cache.

-
-

100

-
-

Default Shared Cache

-
-

Specifies if cached instances should be in the shared cache or in a client isolated cache.

-
-

True

-
-

Entity Caching

-
-

Specify the entity-specific caching information.

-

-

  Cache Type

-
-

See Default Cache Type.

-

-

  Cache Size

-
-

See Default Cache Size.

-

-

  Shared Cache

-
-

See Default Shared Cache.

-

-

Flush clear cache

-
-

Select one of the following as the Default Cache Type:

-
    -
  • -

    Drop – This mode is the fastest and uses the least memory. However, after commit the shared cache might potentially contain stale data.

    -
  • -
  • -

    Drop Invalidate – Classes that have at least one object updated or deleted are invalidated in the shared cache at commit time. This mode is slower than Drop, but as efficient memory usage-wise, and prevents stale data.

    -
  • -
  • -

    Merge – Drop classes from the EntityManager's cache of objects that have not been flushed. This mode leaves the shared cache in a perfect state after commit. However, it is the least memory-efficient mode; the memory might even run out in a very large transaction.

    -
  • -
-
-

Drop Invalidate

-
-
- -
-

- - - - - - -
-

Note:

-This page is not available for projects using the Generic platform.
-
-
-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference021.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference021.htm deleted file mode 100644 index c92c362700..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference021.htm +++ /dev/null @@ -1,241 +0,0 @@ - - - - - - - -Logging - - - - - - - - - - - -

-
-

Logging

-

This table lists the properties of the Logging page of the persistence.xml Editor.

-
-

- - - - - - -
-

Note:

-This page is not available for projects using the Generic platform.
-
-
-
-

Properties of the Logging Page

- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
-

Logging Level

-
-

Specifies the amount and detail of log output by selecting the log level (in ascending order of information):

-

The following are the valid values for the java.util.logging.Level:

-
    -
  • -

    OFF–disables logging

    -
  • -
  • -

    SEVERE–logs exceptions indicating TopLink cannot continue, as well as any exceptions generated during login. This includes a stack trace.

    -
  • -
  • -

    WARNING–logs exceptions that do not force TopLink to stop, including all exceptions not logged with severe level. This does not include a stack trace.

    -
  • -
  • -

    INFO–logs the login/logout per sever session, including the user name. After acquiring the session, detailed information is logged.

    -
  • -
  • -

    CONFIG–logs only login, JDBC connection, and database information.

    -
  • -
  • -

    FINE–logs SQL.

    -
  • -
  • -

    FINER–similar to warning. Includes stack trace.

    -
  • -
  • -

    FINEST–includes additional low level information.

    -
  • -
-

Example: persistence.xml file

-
-<property name="eclipselink.logging.level" value="INFO"/>
-
-

Info

-
-

  Timestamp

-
-

Control whether the timestamp is logged in each log entry.

-

The following are the valid values:

-
    -
  • -

    true–log a timestamp.

    -
  • -
  • -

    false–do not log a timestamp.

    -
  • -
-

Example: persistence.xml file

-
-<property name="eclipselink.logging.timestamp" value="false"/>
-
-

true

-
-

  Thread

-
-

Control whether a thread identifier is logged in each log entry.

-

The following are the valid values:

-
    -
  • -

    true–log a thread identifier.

    -
  • -
  • -

    false–do not log a thread identifier.

    -
  • -
-
-

true

-
-

  Session

-
-

Control whether an EclipseLink session identifier is logged in each log entry.

-

The following are the valid values:

-
    -
  • -

    true–log a EclipseLink session identifier.

    -
  • -
  • -

    false–do not log a EclipseLink session identifier.

    -
  • -
-

Example: persistence.xml file

-
-<property name="eclipselink.logging.session" value="false"/>
-
-

true

-
-

  Exceptions

-
-

Control whether the exceptions thrown from within the EclipseLink code are logged prior to returning the exception to the calling application. Ensures that all exceptions are logged and not masked by the application code.

-

The following are the valid values:

-
    -
  • -

    true–log all exceptions.

    -
  • -
  • -

    false–do not log exceptions.

    -
  • -
-

Example: persistence.xml file

-
-<property name="eclipselink.logging.exceptions" value="true"/>
-
-

false

-
-

Log file

-
-

Specify a file location for the log output (instead of the standard out).

-

Example: persistence.xml file

-
-<property name="eclipselink.logging.file" value="C:\myout\" />
-

-

Logger

-
-

Select the type of logger to use:

-

The following are the valid values:

-
    -
  • -

    DefaultLogger–the EclipseLink native logger eclipselink.logging.DefaultSessionLog.

    -
  • -
  • -

    JavaLogger–the java.util.logging logger eclipselink.logging.JavaLog.

    -
  • -
  • -

    ServerLogger–the java.util.logging logger eclipselink.platform.server.ServerLog. Integrates with the application server's logging as define in the eclipselink.platform.server.ServerPlatform.

    -
  • -
  • -

    Fully qualified class name of a custom logger. The custom logger must implement the eclipselink.logging.SessionLog interface.

    -
  • -
-

Example: persistence.xml file

-
-<property name="eclipselink.logging.logger" value="acme.loggers.MyCustomLogger" />
-
-

DefaultLogger

-
-
-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference022.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference022.htm deleted file mode 100644 index 111b7cbf21..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference022.htm +++ /dev/null @@ -1,170 +0,0 @@ - - - - - - - -Options - - - - - - - - - - - -

-
-

Options

-

This table lists the properties of the Options page of the persistence.xml Editor.

-
-

- - - - - - -
-

Note:

-This page is not available for projects using the Generic platform.
-
-
-
-

Properties of the Options Page

- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
-

Session Name

-
-

Specify the name by which the EclipseLink session is stored in the static session manager. Use this option if you need to access the EclipseLink shared session outside of the context of the JPA or to use a pre-existing EclipseLink session configured through a EclipseLink sessions.xml file

-

Valid values: a valid EclipseLink session name that is unique in a server deployment.

-

Example: persistence.xml file

-
-<property name="eclipselink.session-name" value="MySession"/>
-

-

Sessions XML

-
-

Specify persistence information loaded from the EclipseLink session configuration file (sessions.xml).

-

You can use this option as an alternative to annotations and deployment XML. If you specify this property, EclipseLink will override all class annotation and the object relational mapping from the persistence.xml, as well as ORM.xml and other mapping files, if present.

-

Indicate the session by setting the eclipselink.session-name property.

-

Note: If you do not specify the value for this property, sessions.xml file will not be used.

-

Valid values: the resource name of the sessions XML file.

-

Example: persistence.xml file

-
-<property name="toplink.session-xml" value="mysession.xml"/>
-

-

Target Database

-
-

Select the target database. You can also set the value to the fully qualified class name of a subclass of the org.eclipse.persistence.platform.DatabasePlatform class.

-

Example: persistence.xml file

-
-<property name="eclipselink.target-database" value="Oracle"/>
-
-

Auto

-
-

Target Server

-
-

Select the target server for your JPA application.

-

Example: persistence.xml file

-
-<property name="eclipselink.target-server" value="OC4J_10_1_3"/>
-
-

None

-
-

Event Listener

-
-

Specify a descriptor event listener to be added during bootstrapping.

-

Valid values: qualified class name for a class that implements the eclipselink.sessions.SessionEventListener interface.

-

Example: persistence.xml file

-
-<property name="eclipselink.session-event-listener" value="mypackage.MyClass.class"/>
-

-

Include Descriptor Queries

-
-

Enable or disable the default copying of all named queries from the descriptors to the session. These queries include the ones defined using EclipseLink API, descriptor amendment methods, and so on.

-

-

Miscellaneous Options

-


-

  Temporal mutable

-
-

Specify if all Date and Calendar persistent fields should be handled as mutable objects.

-

Example: persistence.xml file

-
-<property name="eclipselink.temporal.mutable" value="true"/>
-
-

False

-
-
-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference023.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference023.htm deleted file mode 100644 index 52ec40416d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference023.htm +++ /dev/null @@ -1,143 +0,0 @@ - - - - - - - -Schema Generation - - - - - - - - - - - -

-
-

Schema Generation

-

This table lists the properties of the Schema Generation page of the persistence.xml Editor.

-
-

- - - - - - -
-

Note:

-This page is not available for projects using the Generic platform.
-
-
-
-

 

- ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescriptionDefault
-

DDL Generation Type

-
-

Select the type of DDL generation:

-
    -
  • -

    None -- Do not generate DDL; no schema is generated.

    -
  • -
  • -

    Create Tables -- Create DDL for non-existent tables; leave existing tables unchanged.

    -
  • -
  • -

    Drop and Create Tables -- Create DDL for all tables; drop all existing tables.

    -
  • -
-
-

None

-
-

Output Mode

-
-

Select the DDL generation target:

-
    -
  • -

    Both -- Generate SQL files and execute them on the database.

    -
  • -
  • -

    Database -- Execute SQL on the database only (do not generate SQL files).

    -
  • -
  • -

    SQL Script -- Generate SQL files only (do not execute them on the database).

    -
  • -
-

-

DDL Generation Location

-
-

Specify where EclipseLink writes DDL output. Specify a file specification to a directory in which you have write access. The file specification may be relative to your current working directory or absolute. If it does not end in a file separator, then EclipseLink appends one that is valid for your operating system.

-

-

Create DDL File Name

-
-

Specify the file name of the DDL file that EclipseLink generates that contains SQL statements for creating tables for JPA entities. Specify a file name valid for your operating system.

-
-

createDDL.jdbc

-
-

Drop DDL File Name

-
-

Specify the file name of the DDL file that EclipseLink generates that contains SQL statements for dropping tables for JPA entities.

-
-

dropDDL.jdbc

-
-
-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference024.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference024.htm deleted file mode 100644 index 1830f01b1d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference024.htm +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - -Properties - - - - - - - - - - - -

-
-

Properties

-

This page enables you to add or remove the vendor-specific <properties> elements of persistence.xml.

-

To add a property, click Add then enter the property Name and Value.

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference025.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference025.htm deleted file mode 100644 index 47b984b01f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference025.htm +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - -Source - - - - - - - - - - - -

-
-

Source

-

Using this page, you can manually edit the persistence.xml file.

-

See "Managing the persistence.xml file" for additional information.

-

 

-Related task
-
-Managing the persistence.xml file
- - - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference026.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference026.htm deleted file mode 100644 index 235ba80757..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference026.htm +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - -Preferences - - - - - - - - - - - -

-
-

Preferences

-

This section includes information on the following preference pages:

- - - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference027.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference027.htm deleted file mode 100644 index f48d45b158..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference027.htm +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - -Project Properties page – Validation Preferences - - - - - - - - - - - -

-
-

Project Properties page – Validation Preferences

-

Use the Java Persistence options on the Properties page to select the database connection to use with the project.

-

This table lists the properties available in the JPA Details page.

-
- --- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
PropertyDescription
PlatformSelect the vendor-specific platform.
LibrarySelect a specific JPA library configuration. -

Click Manage libraries to create or update a user library.

-

Click Download libraries to download a specific library configuration.

-
  TypeSelect User Library to select from the available user-defined or downloaded libraries. -

If you select Disable, you must manually include the JPA implementation library on the project classpath.

-
  Include libraries with this applicationSpecify if the selected libraries are included when deploying the application.
ConnectionThe database connection used to map the persistent entities. -
    -
  • -

    To create a new connection, click Add Connections.

    -
  • -
  • -

    To reconnect to an existing connection, click Reconnect.

    -
  • -
-
  Override default catalog from connectionSelect a catalog other than the default one derived from the connection information. Use this option if the default catalog is incorrect or cannot be used.
  Override default schema from connectionSelect a schema other than the default one derived from the connection information. Use this option if the default schema is incorrect or cannot be used. For example, use this option when the deployment login differs from the design-time login.
Persistent Class ManagementSpecify if Dali will discover annotated classes automatically, or if the annotated classes must be listed in the persistence.xml file. -

Note: To insure application portability, you should explicitly list the managed persistence classes that are included in the persistence unit.

-
Canonical Metamodel
-
-
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference028.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference028.htm deleted file mode 100644 index 7371b2503f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference028.htm +++ /dev/null @@ -1,49 +0,0 @@ - - - - - - - -Dialogs - - - - - - - - - - - -

-
-

Dialogs

-

This section includes information on the following preference pages:

- - - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference029.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference029.htm deleted file mode 100644 index 9f66678703..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference029.htm +++ /dev/null @@ -1,67 +0,0 @@ - - - - - - - -Edit Join Columns Dialog - - - - - - - - - - - -

-
-

Edit Join Columns Dialog

-

Use the Join Columns dialog to create or modify the join tables and columns in relationship mappings.

-

This table lists the properties available in the Join Columns dialog.

-
- --- - - - - - - - - - - - - - - - -
PropertyDescription
NameName of the joint table column that contains the foreign key column.
Referenced Column NameName of the database column that contains the foreign key reference for the entity relationship.
-
- -Related reference
-
-Join Table Information
-Join Columns Information
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference030.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference030.htm deleted file mode 100644 index 70279780ba..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference030.htm +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - - -Icons and buttons - - - - - - - - - - - -

-
-

Icons and buttons

-

This section includes information on each of the icons and buttons used in the Dali OR Mapping Tool.

- - - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference031.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference031.htm deleted file mode 100644 index 35760eef4f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference031.htm +++ /dev/null @@ -1,125 +0,0 @@ - - - - - - - -Icons - - - - - - - - - - - -

-
-

Icons

-

The following icons are used throughout the Dali OR Mapping Tool.

-
- --- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
IconDescription

Entity
Embeddable entity icon
Embeddable entity
Mapped superclass icon
Mapped superclass
Basic mapping icon
Basic mapping
Basic mapping icon
Basic collection mapping
Basic mapping icon
Basic map mapping
Embedded mapping icon
Embedded mapping
Embedded ID mapping icon
Embedded ID mapping
ID mapping icon
ID mapping
Many-to-many mapping icon
Many-to-many mapping
Many-to-one mapping icon.
Many-to-one mapping
One-to-many mapping icon
One-to-many mapping
One-to-one mapping icon.
One-to-one mapping
Basic mapping icon
Transformation mappings
Transient mapping icon.
Transient mapping
Basic mapping icon
Variable one-to-one mappings
Version mapping icon.
Version mapping
-
- -Related concept
-

Icons and buttons

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference032.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference032.htm deleted file mode 100644 index 36db5405f8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference032.htm +++ /dev/null @@ -1,62 +0,0 @@ - - - - - - - -Buttons - - - - - - - - - - - -

-
-

Buttons

-

The following buttons are used throughout the Dali OR Mapping Tool.

-
- --- - - - - - - - - - - - -
IconDescription
The JPA Perspective icon
JPA Development perspective
-
- -Related concept
-

Icons and buttons

-
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/reference033.htm b/jpa/plugins/org.eclipse.jpt.doc.user/reference033.htm deleted file mode 100644 index 9a706b9f2d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/reference033.htm +++ /dev/null @@ -1,53 +0,0 @@ - - - - - - - -Dali Developer Documentation - - - - - - - - - - - -

-
-

Dali Developer Documentation

-

Additional Dali documentation is available online at:

-

http://wiki.eclipse.org/index.php/Dali_Developer_Documentation

-

This developer documentation includes information about:

-
    -
  • -

    Dali architecture

    -
  • -
  • -

    Plugins that comprise the Dali JPA Eclipse feature

    -
  • -
  • -

    Extension points

    -
  • -
-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_add_persistence.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_add_persistence.htm deleted file mode 100644 index 4c9842ee03..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/task_add_persistence.htm +++ /dev/null @@ -1,60 +0,0 @@ - - - - - - - -Adding persistence to a class - - - - - - - - - - - -

-
-

Adding persistence to a class

-

You can make a Java class into one of the following persistent types:

- -

 

-Related tasks
-
-Specifying additional tables
-Specifying entity inheritance
-Mapping an entity -

 

-Related concept
-
-Understanding Java persistence
-The orm.xml file
-The persistence.xml file - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_additonal_tables.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_additonal_tables.htm deleted file mode 100644 index 77d584cd6b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/task_additonal_tables.htm +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - -Specifying additional tables - - - - - - - - - - - -

-
-

Specifying additional tables

-

Add a secondary table annotation to an entity if its data is split across more than one table.

-

To add a secondary table to the entity,

-
    -
  1. -

    Select the entity in the Project Explorer.

    -
  2. -
  3. -

    In the JPA Details view, select the Secondary Tables information.

    -
    -

    Specifying Secondary Tables

    -Secondary Tables area on the JPA Details view.
    -
  4. -
  5. -

    Click Add to associate an additional table with the entity. The Edit Secondary Table dialog appears

    -
  6. -
  7. -

    Select the Name, Catalog, and Schema of the additional table to associate with the entity.

    -
  8. -
-

Eclipse adds the following annotations the entity:

-
-@SecondaryTable(name="NAME", catalog = "CATALOG", schema = "SCHEMA")
-
-
-

To override the default primary key:

-
    -
  1. -

    Enable the Overwrite default option, then click Add to specify a new primary key join column. The Create New Primary Key Join Column appears.

    -
  2. -
  3. -

    Select the Name, Referenced column name, Table, and Column definition of the primary key for the entity.

    -

    Eclipse adds the following annotations the entity:

    -
    -@SecondaryTable(name="NAME", catalog = "CATALOG", schema = "SCHEMA", pkJoinColumns = {@PrimaryKeyJoinColumn(name="id", referencedColumnName = "id"),@PrimaryKeyJoinColumn(name="NAME", referencedColumnName = "REFERENCED COLUMN NAME", columnDefinition = "COLUMN DEFINITION")})
    -
    -
  4. -
-
-

 

-Related task
-
-Adding persistence to a class -

 

-Related concept
-
-Understanding Java persistence
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_create_jpa_entity.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_create_jpa_entity.htm deleted file mode 100644 index a83f787ffc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/task_create_jpa_entity.htm +++ /dev/null @@ -1,160 +0,0 @@ - - - - - - - -Creating a JPA Entity - - - - - - - - - - - -

-
-

Creating a JPA Entity

-

Use this procedure to create a JPA entity:

-
    -
  1. -

    From the Navigator or Project Explorer, select the JPA project and then File > New > Other. The Select a Wizard dialog appears.

    -
    -

    Selecting the Create a JPA Entity Wizard

    -The Select a Wizard dialog with Entity selected.
    -
  2. -
  3. -

    Select JPA > Entity and then click Next. The Entity Class page appears.

    -
    -

    The Entity Class Page

    -The Entity Class page of the Create a JPA Entity wizard.
    - -

    Complete this page as follows:

    -
      -
    • -

      Select the JPA project in the Project field.

      -
    • -
    • -

      In the Source Folder field, select, or enter, the location of the JPA project's src folder.

      -
    • -
    • -

      Select, or enter, the name of the class package for this entity in the Java Package field.

      -
    • -
    • -

      Enter the name of the Java class in the Class name field.

      -
    • -
    • -

      If needed, enter, or select a superclass.

      -
    • -
    • -

      If needed, complete the Inheritance section as follows (these properties are optional):

      -
        -
      • -

        Accept the Entity option (the default) to create a Java class with the @Entity option.

        -
      • -
      • -

        Alternatively, select Mapped superclass (if you defined a super class).

        -
      • -
      • -

        Select Inheritance and then select one of the JSR 220 inheritance mapping strategies (SINGLE_TABLE, TABLE_PER_CLASS, JOINED).

        -
      • -
      • -

        Select Add to entity mappings in XML to create XML mappings in orm.xml, rather than annotations.

        -
      • -
      -
    • -
    -
  4. -
  5. -

    Click Next to proceed to the Entity Properties page where you define the persistent fields for the entity.

    -
    -

    The Entity Properties Page

    -The Entity Properties page of the Create JPA Entity wizard.
    - -

    Alternatively, click Finish to complete the entity.

    -
  6. -
  7. -

    Complete the page as follows:

    -
      -
    1. -

      If needed, enter a new name for the entity. Doing so results in adding a name attribute to the @Entity notation (@Entity(name="EntityName")).

      -
    2. -
    3. -

      Accept Use default (the default setting) to use the default value for the name of the mapped table. Entering a different name results in adding the @Table notation with its name attribute defined as the new table (@Table(name="TableName")).

      -
      -

      - - - - - - -
      -

      Note:

      -The Entity Name-related options are not available if you selected Mapped superclass on the Entity Class page
      -
      -
      -
    4. -
    5. -

      Add persistence fields to the entity by clicking Add. The Entity Fields dialog appears.

      -
      -

      The Entity Fields Dialog

      -The Entity Fields dialog.
      -
    6. -
    7. -

      Select a persistence type from the Type list. You can retrieve additional types using the Browse function.

      -
    8. -
    9. -

      Enter the field name and then click OK. Repeat this procedure for each field.

      -
    10. -
    11. -

      If needed, select Key to designate the field as a primary key.

      -
    12. -
    13. -

      Select either the Field-based access type (the default) or Property-based access type.

      -
    14. -
    -
  8. -
  9. -

    Click Finish. Eclipse adds the entity to your project.

    -
  10. -
-

 

-Related reference
-
-Create JPA Entity wizard
-Create New JPA Project wizard
-JPA Development perspective -

 

-Related tasks
-
-Managing the persistence.xml file
-Adding persistence to a class -

 

-Related concept
-
-Understanding Java persistence
-The persistence.xml file
-

 

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_create_new_project.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_create_new_project.htm deleted file mode 100644 index ee7e1ede8e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/task_create_new_project.htm +++ /dev/null @@ -1,141 +0,0 @@ - - - - - - - -Creating a new JPA project - - - - - - - - - - - -

-
-

Creating a new JPA project

-

Use this procedure to create a new JPA project.

-
    -
  1. -

    From the Navigator or Project Explorer, select File > New > Project. The Select a wizard dialog appears.

    -
    -

    - - - - - - -
    -

    Tip:

    -You can also select the JPA perspective and then select File > New > JPA Project.
    -
    -
    -
    -

    Selecting the Create a JPA Project wizard

    -The Select a Wizard dialog with JPA project selected.
    -
  2. -
  3. -

    Select JPA Project and then click Next. The New JPA Project page appears.

    -
    -

    The JPA Project Page

    -The JPA Project page of the Create a JPA Project wizard.
    -
  4. -
  5. -

    Complete the fields on the New JPA Project page to specify the project name and location, target runtime, and pre-defined configuration.

    -
    -

    - - - - - - -
    -

    Note:

    -The Target Runtime is not required for Java SE development.
    -
    -
    -
  6. -
  7. -

    Click Next. The Java source page appears.

    -
    -

    The Java Source Page

    -The JPA Facet page of the Create a JPA Project wizard.
    -
  8. -
  9. -

    Click Add Folder to add existing Java source files to the project.

    -
  10. -
  11. -

    Click Next. JPA Facet page appears.

    -
    -

    The JPA Facet Page

    -The JPA Facet page of the Create a JPA Project wizard.
    -
  12. -
  13. -

    Complete the fields on the JPA Facet page to specify your vender-specific platform, JPA implementation library, and database connection.

    -

    Click Manage libraries to create or update your JPA user libraries. Click Download libraries to obtain additional JPA implementation libraries.

    -

    If Dali derives the incorrect schema, select Override the Default Schema for Connection. Using this option, you can select a development time schema for defaults and validation.

    -

    If you clear the Create orm.xml option (which is selected by default), you can later add a mapping file to the project using the Mapping File Wizard.

    -
    -

    - - - - - - -
    -

    Note:

    -If the server runtime does not provide a JPA implementation, you must explicitly select a JPA implementation library. -

    To insure the portability of your application, you must explicitly list the managed persistence classes that are included in the persistence unit. If the server supports EJB 3.0, the persistent classes will be discovered automatically.

    -

    Depending on your JPA implementation (for example, Generic or EclipseLink), different options may be available when creating JPA projects.

    -
    -
    -
    -
  14. -
  15. -

    Click Finish. You should now open the JPA Development perspective.

    -
  16. -
-

 

-Related reference
-
-Create New JPA Project wizard
-JPA Development perspective
-Mapping File Wizard -

 

-Related tasks
-
-Managing the persistence.xml file
-Adding persistence to a class
-Converting a Java Project to a JPA Project -

 

-Related concept
-
-Understanding Java persistence
-The persistence.xml file -

 

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_generate_classes_from_schema.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_generate_classes_from_schema.htm deleted file mode 100644 index 429ee81d23..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/task_generate_classes_from_schema.htm +++ /dev/null @@ -1,55 +0,0 @@ - - - - - - - -Generating JAXB Classes from a Schema - - - - - - - - - - - -

-
-

Generating JAXB Classes from a Schema

-

Use the Generate Classes from XSD dialog to generate JAXB classes from an XML schema ( .xsd).

-
    -
  1. -

    From the Navigator or Project Explorer, right-click a schema ( .xsd file) and select Generate > JAXB Classes. The Generate Classes from Schema dialog appears.

    -
    -

    Configure JAXB Class Generation dialog

    -Generate classes from schema dialog.
    -
  2. -
  3. -

    Enter the JAXB settings information and click Finish.

    -
  4. -
-Related reference
-
-Configure JAXB Class Generation dialog -

 

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_generating_schema_from_classes.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_generating_schema_from_classes.htm deleted file mode 100644 index 6e7cf1cca2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/task_generating_schema_from_classes.htm +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - -Generating Schema from Classes - - - - - - - - - - - -

-
-

Generating Schema from Classes

-

Use the Generate Schema from JAXB Classes wizard create an XML schema ( .xsd) for a set of JAXB mapped classes.

-
    -
  1. -

    From the Navigator or Project Explorer, select File > New > Other. The Select a wizard dialog appears.

    -
    -

    - - - - - - -
    -

    Tip:

    -You can also access the Generate Schema from JAXB Classes wizard from a specific project or package.
    -
    -
    -
    -

    Selecting the Schema From JAXB Classes wizard

    -The Select a Wizard dialog with Schema From JAXB Classes selected.
    -
  2. -
  3. -

    Select JAXB > Schema from JAXB Classes and then click Next. The Generate Schema from Classes page of the Generate Schema from JAXB Classes Wizard appears.

    -
    -

    The Generate Schema from Classes Page

    -The JPA Project page of the Create a JPA Project wizard.
    -
  4. -
  5. -

    Select the project, package, or classes from which to generate the schema and click Finish.

    -
  6. -
-Related reference
-
-Generate Schema from JAXB Classes Wizard -

 

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_inheritance.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_inheritance.htm deleted file mode 100644 index 15a4d073d7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/task_inheritance.htm +++ /dev/null @@ -1,138 +0,0 @@ - - - - - - - -Specifying entity inheritance - - - - - - - - - - - -

-
-

Specifying entity inheritance

-

An entity may inherit properties from other entities. You can specify a specific strategy to use for inheritance.

-

Use this procedure to specify inheritance (@Inheritance) for an existing entity (@Entity):

-
    -
  1. -

    Select the entity in the Project Explorer.

    -
  2. -
  3. -

    In the JPA Details view, select the Inheritance information.

    -
    -

    Specifying Inheritance

    -Selecting the Inheritance area on the JPA Details view.
    -
  4. -
  5. -

    In the Strategy list, select one of the following the inheritance strategies:

    -
      -
    • -

      A single table (default)

      -
    • -
    • -

      Joined table

      -
    • -
    • -

      One table per class

      -
    • -
    -
  6. -
  7. -

    Use the following table to complete the remaining fields on the tab. See "Inheritance information" for additional details.

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescriptionDefault
    Discriminator ColumnName of the discriminator column when using a Single or Joined inheritance strategy. -

    This field corresponds to the @DiscriminatorColumn annotation.

    -

    Discriminator TypeSet the discriminator type to Char or Integer (instead of its default: String). The Discriminator Value must conform to this type.String
    Discriminator ValueSpecify the discriminator value used to differentiate an entity in this inheritance hierarchy. The value must conform to the specified Discriminator Type. -

    This field corresponds to the @DiscriminatorValue annotation.

    -

    Override DefaultUse this field to specify custom primary key join columns. -

    This field corresponds to the @PrimaryKeyJoinClumn annotation.

    -

    -
    -
  8. -
-

Eclipse adds the following annotations the entity field:

-
-@Inheritance(strategy=InheritanceType.<INHERITANCE_STRATEGY>)
-@DiscriminatorColumn(name="<DISCRIMINATOR_COLUMN>",
-    discriminatorType=<DISCRIMINATOR_TYPE>)
-@DiscriminatorValue(value-"<DISCRIMINATOR_VALUE>")
-@PrimaryKeyJoinColumn(name="<JOIN_COLUMN_NAME>", 
-    referencedColumnName = "<REFERENCED_COLUMN_NAME>")
-
-
-

The following figures illustrates the different inheritance strategies.

-
-

Single Table Inheritance

-This figure illustrates entity inheritance in a single table.
- -
-

Joined Table Inheritance

-This figure illustrates a joined subclass inheritance strategy.
- -
-

 

-Related task
-
-Adding persistence to a class -

 

-Related concept
-
-Understanding Java persistence
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_manage_orm.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_manage_orm.htm deleted file mode 100644 index 8968739b98..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/task_manage_orm.htm +++ /dev/null @@ -1,64 +0,0 @@ - - - - - - - -Managing the orm.xml file - - - - - - - - - - - -

-
-

Managing the orm.xml file

-

When creating a JPA project, (see "Creating a new JPA project") you can also create the orm.xml file that defines the mapping metadata and defaults.

-

Eclipse creates the META-INF\orm.xml file in your project's directory:

-
-<?xml version="1.0" encoding="UTF-8"?>
-<persistence version="<PERSISTENCE_VERSION>"
-      xmlns="http://java.sun.com/xml/ns/persistence"
-      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
-      http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
-  <persistence-unit name="<PERSISTENCE_UNIT_NAME>">
-    <provider="<PERSISTENCE_PROVIDER>" />
-  </persistence-unit>
-</persistence>
-
-

 

-Related reference
-
-Create New JPA Project wizard
-New EclipseLink Mapping File dialog -

 

-Related task
-
-Working with orm.xml file
-

 

-Related concept
-
-The orm.xml file
- - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_manage_persistence.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_manage_persistence.htm deleted file mode 100644 index 92f618b401..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/task_manage_persistence.htm +++ /dev/null @@ -1,222 +0,0 @@ - - - - - - - -Managing the persistence.xml file - - - - - - - - - - - -

-
-

Managing the persistence.xml file

-

When you create a project, Eclipse creates the META-INF\persistence.xml file in the project's directory.

-

You can create a stub persistence.xml file in the META-INF directory when you create a JPA project (see "Creating a new JPA project"). You can manage this file either through the XML editor (see ) or through the persistence.xml Editor.

-
-

- - - - - - -
-

Note:

-Depending on your JPA implementation (for example, EclipseLink), the following additional pages may be available in the persistence.xml Editor: -
    -
  • -

    Customization

    -

    Use this page to define change-tracking and session customizer-related properties.

    -
  • -
  • -

    Caching

    -

    Use this page to define caching properties.

    -
  • -
  • -

    Logging

    -

    Use this page to define logging properties.

    -
  • -
  • -

    Options

    -

    Use this page to define session and target database properties.

    -
  • -
  • -

    Schema Generation

    -

    Use this page to define DDL-related properties.

    -
  • -
-

For projects using the EclipseLink JPA implementation, the Connections page also includes JDBC connection pool properties.

-

If the project uses the Generic platform, then only the General, Connection, Properties and Source pages are available.

-
-
-
-

To use the persistence.xml Editor:

-
    -
  1. -

    Open the peristence.xml file. The General page of the editor appears.

    -
  2. -
  3. -

    Use the General page to define the persistence.xml files <persistent-unit>-related attributes as well as the <provider>, and <class> elements (described in the following table).

    -
    -

    - - - - - - -
    -

    Tip:

    -The persistence.xml Editor's Source page enables you to view and edit the raw XML file.
    -
    -
    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescriptionElement Defined
    NameEnter the name of the persistence unit.<persistence-unit name = "<Name>">
    Persistence ProviderEnter the name of the persistence provider.<provider>
    DescriptionEnter a description for this persistence unit. This is an optional property.<description>
    Managed ClassesAdd or remove the classes managed through the persistence unit.<class>
      Exclude Unlisted ClassesSelect to include all annotated entity classes in the root of the persistence unit.<exclude-unlisted-classes>
    XML Mapping FilesAdd or remove the object/relational mapping XML files define the classes managed through the persistence unit.<mapping-file>
    JAR FilesAdd or remove additional JAR files and libraries
    -
    -
  4. -
  5. -

    Use the Connection page to define the <jta-data-source> and <non-jta-data-source> elements as follows:

    -

    To configure the JTA (Java Transaction API) source used by the persistence provider:

    -
      -
    1. -

      Select JTA from the Transaction Type list.

      -
    2. -
    3. -

      Enter the global JNDI name of the data source.

      -
    4. -
    -

    To configure a non-JTA data source:

    -
      -
    1. -

      Select Resource Local from the Transaction Type list.

      -
    2. -
    3. -

      Enter the global JNDI name of the data source.

      -
      -

      - - - - - - -
      -

      Note:

      -Select Default() to use the data source provided by the container.
      -
      -
      -
    4. -
    -

    For projects using the Generic platform, you can also define the EclipseLink connection pool driver, connection pool driver, URL, user name and password.

    -
  6. -
  7. -

    Use the table in the Properties page to set the vendor-specific <properties> element.

    -

    To add <property> elements:

    -
      -
    1. -

      Click Add.

      -
    2. -
    3. -

      Enter the <name> and <value> attributes for the <property> element using the table's Name and Value fields.

      -
    4. -
    -

    To remove a <property> element, select a defined property in the table and then click Remove.

    -
    -

    - - - - - - -
    -

    Note:

    -If the project uses the EclipseLink platform, the connection page also includes parameters for JDBC connection pooling.
    -
    -
    -
  8. -
-Related reference
-
-persistence.xml Editor -

 

-Related task
-
-Synchronizing classes
-

 

-Related concept
-
-The persistence.xml file
- - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/task_mapping.htm b/jpa/plugins/org.eclipse.jpt.doc.user/task_mapping.htm deleted file mode 100644 index be8d8f1f48..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/task_mapping.htm +++ /dev/null @@ -1,77 +0,0 @@ - - - - - - - -Mapping an entity - - - - - - - - - - - -

-
-

Mapping an entity

-

Dali supports the following mapping types for Java persistent entities:

- -

Additional mapping types (such as Basic Collection mappings) may be available when using Dali with EclipseLink.

-

 

-Related concept
-
-Understanding OR mappings - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks.htm deleted file mode 100644 index 00e2189526..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks.htm +++ /dev/null @@ -1,81 +0,0 @@ - - - - - - - -Tasks - - - - - - - - - - - -

-

Tasks

-

This section includes detailed step-by-step procedures for accessing the Dali OR mapping tool functionality.

- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks001.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks001.htm deleted file mode 100644 index 0960434330..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks001.htm +++ /dev/null @@ -1,85 +0,0 @@ - - - - - - - -Converting a Java Project to a JPA Project - - - - - - - - - - - -

-
-

Converting a Java Project to a JPA Project

-

Use this procedure to convert an existing Java project to a JPA project.

-
    -
  1. -

    From the Navigator or Project explorer, right-click the Java project and then select Configure > Convert to JPA Project. The Project Facets page of the Modify Faceted Project wizard appears.

    -
    -

    Modify Faceted Project Page

    -
    -
  2. -
  3. -

    Change the Configuration to Default JPA Configuration.

    -
  4. -
  5. -

    Click Next. JPA Facet page appears.

    -
    -

    JPA Facet Page

    -
    -
  6. -
  7. -

    Complete the fields on the JPA Facet page to specify your vender-specific platform, JPA implementation library, and database connection.

    -

    Click Manage libraries to create or update your JPA user libraries. Click Download libraries to obtain additional JPA implementation libraries.

    -

    If Dali derives the incorrect schema, select Override the Default Schema for Connection. Using this option, you can select a development time schema for defaults and validation.

    -

    If you clear the Create orm.xml option (which is selected by default), you can later add a mapping file to the project using the Mapping File Wizard.

    -
  8. -
  9. -

    Click Finish.

    -
  10. -
-

The Dali OR Mapping Tool adds the JPA implementation libraries to your project and creates the necessary orm.xml and perisistence.xml files.

-

 

-Related reference
-
-Create New JPA Project wizard
-JPA Development perspective
-Mapping File Wizard -

 

-Related tasks
-
-Managing the persistence.xml file
-Adding persistence to a class
-Creating a new JPA project -

 

-Related concept
-
-Understanding Java persistence
-The persistence.xml file -

 

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks002.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks002.htm deleted file mode 100644 index 96f9bb0090..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks002.htm +++ /dev/null @@ -1,74 +0,0 @@ - - - - - - - -Synchronizing classes - - - - - - - - - - - -

-
-

Synchronizing classes

-

As you work with the classes in your Java project, you will need to update the persistence.xml file to reflect the changes.

-

Use this procedure to synchronize the persistence.xml file:

-
    -
  1. -

    Right-click the persistence.xml file in the Project Explorer and select JPA Tools > Synchronize Class List.

    -
    -

    - - - - - - -
    -

    Note:

    -Use this function if you selected Annotated classes must be listed in the persistence.xml option in the JPA Facet page. In general, you do not have to use this function within the container.
    -
    -
    -
    -

    Synchronizing the persistence.xml File

    -This figure shows the JPA Tools > Synchronize Classes option.
    - -

    Dali adds the necessary <class> elements to the persistence.xml file.

    -
  2. -
  3. -

    Use the Persistence XML Editor to continue editing the persistence.xml file.

    -
  4. -
-Related task
-
-Managing the persistence.xml file -

 

-Related concept
-
-The persistence.xml file
-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks003.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks003.htm deleted file mode 100644 index 818f14603c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks003.htm +++ /dev/null @@ -1,43 +0,0 @@ - - - - - - - -Upgrading document version - - - - - - - - - - - -
-

Upgrading document version

-

Use this procedure to migrate your project from JPA 1.0 to JPA 2.0. You must complete this upgrade to use the current JPA 2.0 features in Dali.

-
-

Upgrading the persistence.xml File

-This figure shows the JPA Tools > Synchronize Classes option.
-
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks004.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks004.htm deleted file mode 100644 index 90441ad325..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks004.htm +++ /dev/null @@ -1,58 +0,0 @@ - - - - - - - -Creating an orm.xml file - - - - - - - - - - - -
-

Creating an orm.xml file

-

If you opt not to create an orm.xml file when you create a JPA project, you can create one using the Mapping File Wizard.

-

Use this procedure to create an orm.xml file:

-
    -
  1. -

    From the Navigator or Project Explorer, select File > New > Other. The Select a Wizard dialog appears.

    -
    -

    The Select a Wizard Dialog

    -The Select a Wizard dialog with Mapping file selected.
    -
  2. -
  3. -

    Select Mapping File and then click Next. The Mapping File page appears.

    -

    If you are using EclipseLink, you can select EclipseLink > EclipseLink Mapping File.

    -
    -

    The Mapping File Page

    -The Mapping File page.
    -
  4. -
  5. -

    Define the properties in the page and click Finish. The orm.xml file appears in the src directory of the selected JPA project. You can manage the orm.xml file using the JPA Details view or through the XML Editor. See also JPA Details view (for orm.xml).

    -
  6. -
-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks005.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks005.htm deleted file mode 100644 index 1f960838f9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks005.htm +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - -Working with orm.xml file - - - - - - - - - - - -

-
-

Working with orm.xml file

-

You can work with the orm.xml by using the JPA Details view.

-

Use this procedure to work with the orm.xml file:

-
    -
  1. -

    Right-click the orm.xml file in the Project Explorer and select Open.

    -
  2. -
  3. -

    In the JPA Structure view, select EntityMappings.

    -
  4. -
  5. -

    Use the JPA Details view to configure the entity mapping and persistence unit defaults.

    -
    -

    JPA Details view for EntityMappings (orm.xml)

    -JPA Details view for orm.xml file.
    -
  6. -
-Related task
-
-JPA Details view (for orm.xml)
-Related task
-
-Working with orm.xml file
-Working with XML Files
-

 

-Related concept
-
-The orm.xml file
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks006.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks006.htm deleted file mode 100644 index eca0d7006b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks006.htm +++ /dev/null @@ -1,96 +0,0 @@ - - - - - - - -Entity - - - - - - - - - - - -

-
-

Entity

-

An Entity is a persistent domain object.

-

An entity can be:

-
    -
  • -

    Abstract or concrete classes. Entities may also extend non-entity classes as well as entity classes, and non-entity classes may extend entity classes.

    -
  • -
-

An entity must have:

-
    -
  • -

    A no-arg constructor (public or protected); the entity class may have other constructors as well.

    -
  • -
-

Each persistent entity must be mapped to a database table and contain a primary key. Persistent entities are identified by the @Entity annotation.

-

Use this procedure to add persistence to an existing entity:

-
    -
  1. -

    Open the Java class in the Project Explorer.

    -
  2. -
  3. -

    Select the class in the JPA Structure view.

    -
  4. -
  5. -

    In the JPA Details view, click the mapping type hyperlink to access the Mapping Type Selection dialog. In the following figure, clicking entity invokes the dialog from the JPA Details View.

    -
    -

    The Mapping Type Hyperlink

    -The JPA Details view for an entity showing the mapping type hyperlink.
    - -
    -

    - - - - - - -
    -

    Tip:

    -You can also change (or add) persistence for an entity by right-clicking the class in the JPA Structure View and then clicking Map As > Entity.
    -
    -
    -
  6. -
  7. -

    Select Entity from the Mapping Type Selection dialog and then click OK.

    -
    -

    The Mapping Type Selection Dialog

    -The Mapping Type selection dialog with Enity selected.
    -
  8. -
  9. -

    Complete the remaining JPA Details view (for entities).

    -
  10. -
-

 

-Related tasks
-
-Adding persistence to a class
-Specifying additional tables
-Specifying entity inheritance
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks007.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks007.htm deleted file mode 100644 index 004a1691dd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks007.htm +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - -Embeddable - - - - - - - - - - - -

-
-

Embeddable

-

An Embedded class is a class whose instances are stored as part of an owning entity; it shares the identity of the owning entity. Each field of the embedded class is mapped to the database table associated with the owning entity.

-

To override the mapping information for a specific subclass, use the @AttributeOverride annotation for that specific class.

-

An embeddable entity is identified by the @Embeddable annotation.

-

Use this procedure to add embeddable persistence to an existing entity:

-
    -
  1. -

    Open the Java class in the Project Explorer.

    -
  2. -
  3. -

    Select the class in the JPA Structure view.

    -
  4. -
  5. -

    Click the mapping type hyperlink to open the Mapping Type Selection dialog.

    -
  6. -
  7. -

    Select Embeddable and then click OK.

    -
    -

    Mapping Type Selection Dialog (Embeddable)

    -The Mapping Type Selection dialog with Embeddable selected.
    -
  8. -
  9. -

    Complete the remaining JPA Details view (for entities).

    -
  10. -
-

 

-Related tasks
-
-
Adding persistence to a class
-
Specifying additional tables
-
Specifying entity inheritance
-
-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks008.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks008.htm deleted file mode 100644 index 1b5054e055..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks008.htm +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - -Mapped superclass - - - - - - - - - - - -

-
-

Mapped superclass

-

An entity that extends a Mapped Superclass class inherits the persistent state and mapping information from a superclass. You should use a mapped superclass to define mapping information that is common to multiple entity classes.

-

A mapped superclass can be:

-
    -
  • -

    Abstract or concrete classes

    -
  • -
-

A mapped superclass cannot be:

-
    -
  • -

    Be queried or passed as an argument to Entity-Manager or Query operations

    -
  • -
  • -

    Be the target of a persistent relationship

    -
  • -
-

A mapped superclass does not have a defined database table. Instead, its mapping information is derived from its superclass. To override the mapping information for a specific subclass, use the @AttributeOverride annotation for that specific class.

-

A mapped superclass is identified by the @MappedSuperclass annotation.

-

Use this procedure to add Mapped Superclass persistence to an existing entity:

-
    -
  1. -

    Open the Java class in the Project Explorer.

    -
  2. -
  3. -

    Select the class in the JPA Structure view.

    -
  4. -
  5. -

    In the JPA Details view, click the mapping type hyperlink to open the Mapping Type Selection dialog.

    -
  6. -
  7. -

    Select Mapped Superclass and then OK.

    -
    -

    Mapping Type Selection Dialog (Mapped Superclass)

    -The Mapping Type Selection dialog with Mapped Superclass selected.
    -
  8. -
  9. -

    Complete the remaining JPA Details view (for entities).

    -
  10. -
-

 

-Related tasks
-
-Adding persistence to a class
-Specifying additional tables
-Specifying entity inheritance
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks009.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks009.htm deleted file mode 100644 index 82e8697c54..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks009.htm +++ /dev/null @@ -1,65 +0,0 @@ - - - - - - - -Creating Named Queries - - - - - - - - - - - -

-
-

Creating Named Queries

-

Named queries improve application performance because they are prepared once and they (and all of their associated supporting objects) can be efficiently reused thereafter, making them well suited for complex and frequently executed operations. Named queries use the JPA query language for portable execution on any underlying database; named native queries use the SQL language native to the underlying database.

-

Use this procedure to add @NamedQuery and @NamedNativeQuery annotations to the entity.

-

To create a named query:

-
    -
  1. -

    Select the entity in the Project Explorer.

    -
  2. -
  3. -

    In the JPA Details view, expand Queries.

    -
  4. -
  5. -

    Click Add for a named query, or Add Native for a native query.

    -
  6. -
  7. -

    In the dialog that appears, enter the name of the query in the Name field and then click OK.

    -
  8. -
  9. -

    Enter the query in the Query field.

    -
  10. -
  11. -

    To add a Query hint, click Add.

    -
    -

    Entering a Named Query

    -The Queries section of the JPA Details view.
    -
  12. -
-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks010.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks010.htm deleted file mode 100644 index f4022d9d10..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks010.htm +++ /dev/null @@ -1,183 +0,0 @@ - - - - - - - -Basic mapping - - - - - - - - - - - -

-
-

Basic mapping

-

Use a Basic Mapping to map an attribute directly to a database column. Basic mappings may be used only with the following attribute types:

-
    -
  • -

    Java primitive types and wrappers of the primitive types

    -
  • -
  • -

    java.lang.String, java.math.BigInteger

    -
  • -
  • -

    java.math.BigDecimal

    -
  • -
  • -

    java.util.Date

    -
  • -
  • -

    java.util.Calendar, java.sql.Date

    -
  • -
  • -

    java.sql.Time

    -
  • -
  • -

    java.sql.Timestamp

    -
  • -
  • -

    byte[]

    -
  • -
  • -

    Byte[]

    -
  • -
  • -

    char[]

    -
  • -
  • -

    Character[]

    -
  • -
  • -

    enums

    -
  • -
  • -

    any other type that implements Serializable

    -
  • -
-

To create a basic mapping:

-
    -
  1. -

    In the JPA Structure view, right-click the field to map. Select Map As > Basic. The JPA Details view (for attributes) displays the properties for the selected field.

    -
  2. -
  3. -

    Use this table to complete the remaining fields on the JPA Details view.

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescriptionDefault
    Entity Map HyperlinkDefines this mapping as a Basic Mapping. -

    This corresponds to the @Basic annotation.

    -
    Basic
    ColumnThe database column mapped to the entity attribute. See "Column" for details.By default, the Column is assumed to be named identically to the attribute and always included in the INSERT and UPDATE statements.
    TableName of the database table.
    FetchDefines how data is loaded from the database. See "Fetch Type" for details. -
      -
    • -

      Eager

      -
    • -
    • -

      Lazy

      -
    • -
    -
    Eager
    OptionalSpecifies if this field is can be null.Yes
    TypeSpecifies the type of data: -
      -
    • -

      Default

      -
    • -
    • -

      LOB – Specifies if this is a large objects (BLOB or CLOB). See "Lob" for details.

      -
    • -
    • -

      Temporal – Specify if this is a Date, Time, or Timestamp object. See "Temporal" for details.

      -
    • -
    • -

      Enumerated – Specify how to persist enumerated constraints as ordinal or string, in order to match an existing database schema.

      -
    • -
    -

    -
    -
  4. -
-

Eclipse adds the following annotations to the field:

-
-@Column(name="<COLUMN_NAME>", table="<COLUMN_TABLE>", 
-    insertable=<INSERTABLE>, updatable=<UPDATABLE>)
-@Basic(fetch=FetchType.<FETCH_TYPE>, optional = <OPTIONAL>)
-@Temporal(TemporalType.<TEMPORAL>)
-
-
-

 

-Related task
-
-Mapping an entity -

 

-Related reference
-
-JPA Structure view
-JPA Details view (for attributes) -

 

-Related concept
-
-Understanding OR mappings
-Understanding EJB 3.0 Java Persistence API
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks011.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks011.htm deleted file mode 100644 index 5634d786c3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks011.htm +++ /dev/null @@ -1,97 +0,0 @@ - - - - - - - -Embedded mapping - - - - - - - - - - - -

-
-

Embedded mapping

-

Use an Embedded Mapping to specify a persistent field or property of an entity whose value is an instance of an embeddable class.

-
    -
  1. -

    In the JPA Structure view, right-click the field to map.

    -
  2. -
  3. -

    Select Map as > Embedded. The JPA Details view (for attributes) displays the properties for the selected field.

    -
  4. -
  5. -

    Use this table to complete the remaining fields on the JPA Details view.

    -
    - ---- - - - - - - - - - - - - - - - - - - -
    PropertyDescriptionDefault
    Entity Mapping HyperlinkDefines this mapping as a Embedded. -

    This corresponds to the @Embedded annotation.

    -
    Embedded
    Attribute OverridesSpecify to override the default mapping of an entity's attribute. Select Override Default.
    -
    -
  6. -
-

Eclipse adds the following annotations to the field:

-
-@Embedded
-@AttributeOverride(column=@Column(table="<COLUMN_TABLE>", name = "<COLUMN_NAME>"))
-
-

 

-Related task
-
-Mapping an entity -

 

-Related reference
-
-JPA Structure view
-JPA Details view (for attributes) -

 

-Related concept
-
-Understanding OR mappings
-Understanding EJB 3.0 Java Persistence API
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks012.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks012.htm deleted file mode 100644 index 425fb6498c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks012.htm +++ /dev/null @@ -1,91 +0,0 @@ - - - - - - - -Embedded ID mapping - - - - - - - - - - - -

-
-

Embedded ID mapping

-

Use an Embedded ID Mapping to specify the primary key of an embedded ID. These mappings may be used with a Embeddable entities.

-
    -
  1. -

    In the JPA Structure view, select the field to map.

    -
  2. -
  3. -

    Right-click the field and then select Map As > Embedded Id. The JPA Details view (for attributes) displays the properties for the selected field.

    -
  4. -
  5. -

    Use this table to complete the remaining fields on the JPA Details view.

    -
    - ---- - - - - - - - - - - - - - -
    PropertyDescriptionDefault
    Entity Mapping HyperlinkDefines this mapping as a Embedded Id. -

    This corresponds to the @EmbeddedId annotation.

    -
    Embedded Id
    -
    -
  6. -
-

Eclipse adds the following annotations to the field:

-
-@EmbeddedId
-
-

 

-Related task
-
-Mapping an entity -

 

-Related reference
-
-JPA Structure view
-JPA Details view (for attributes) -

 

-Related concept
-
-Understanding OR mappings
-Understanding EJB 3.0 Java Persistence API
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks013.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks013.htm deleted file mode 100644 index 8aadf81887..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks013.htm +++ /dev/null @@ -1,176 +0,0 @@ - - - - - - - -ID mapping - - - - - - - - - - - -

-
-

ID mapping

-

Use an ID Mapping to specify the primary key of an entity. ID mappings may be used with a Entity or Mapped superclass. Each Entity must have an ID mapping.

-
    -
  1. -

    In the JPA Structure view, select the field to map.

    -
  2. -
  3. -

    Right click the filed and then select Map as > ID. The JPA Details view (for attributes) displays the properties for the selected.

    -
  4. -
  5. -

    Use this table to complete the General information fields in the JPA Details view.

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescriptionDefault
    Entity Mapping HyperlinkDefines this mapping as an ID Mapping. -

    This field corresponds to the @Id annotation.

    -
    ID
    ColumnThe database column mapped to the entity attribute. See "Column" for details.By default, the Column is assumed to be named identically to the attribute.
    TableThe database table mapped to the entity attribute.By default, the Table is assumed to be identical to the table associated with the entity.
    TemporalSpecifies the type of data. See "Temporal" for details. -
      -
    • -

      Date

      -
    • -
    • -

      Time

      -
    • -
    • -

      Timestamp

      -
    • -
    -

    -
    -
  6. -
  7. -

    Use this table to complete the fields in Primary Key Generation information area in the JPA Details view.

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescriptionDefault
    Primary Key GenerationThese fields define how the primary key is generated.
      StrategySee "Primary Key Generation" for details. -
      -
    • -

      Auto

      -
    • -
    • -

      Sequence

      -
    • -
    • -

      Identity

      -
    • -
    • -

      Table

      -
    • -
    -
    Auto
      Generator NameName of the primary key generator specified in the Strategy
    -
    -
  8. -
-

Additional fields will appear in the Primary Key Generation information area, depending on the selected Strategy. See "JPA Details view (for attributes)" for additional information.

-

Eclipse adds the following annotations to the field:

-
-@Id
-@Column(name="<COLUMN_NAME>", table="<TABLE_NAME>", insertable=<INSERTABLE>,
-    updatable=<UPDATABLE>)
-@Temporal(<TEMPORAL>)
-@GeneratedValue(strategy=GeneratorType.<STRATEGY>, generator="<GENERATOR_NAME>")@TableGenerator(name="<TABLE_GENERATOR_NAME>", table = "<TABLE_GENERATOR_TABLE>", 
-    pkColumnName = "<TABLE_GENERATOR_PK>", 
-    valueColumnName = "<TABLE_GENERATOR_VALUE_COLUMN>", 
-    pkColumnValue = "<TABLE_GENERATOR_PK_COLUMN_VALUE>")@SequenceGenerator(name="<SEQUENCE_GENERATOR_NAME>", 
-    sequenceName="<SEQUENCE_GENERATOR_SEQUENCE>")
-
-

 

-Related task
-
-Mapping an entity -

 

-Related reference
-
-JPA Structure view
-JPA Details view (for attributes) -

 

-Related concept
-
-Understanding OR mappings
-Understanding EJB 3.0 Java Persistence API
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks014.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks014.htm deleted file mode 100644 index d158190edb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks014.htm +++ /dev/null @@ -1,179 +0,0 @@ - - - - - - - -Many-to-many mapping - - - - - - - - - - - -

-
-

Many-to-many mapping

-

Use a Many-to-Many Mapping to define a many-valued association with many-to-many multiplicity. A many-to-many mapping has two sides: the owning side and non-owning side. You must specify the join table on the owning side. For bidirectional mappings, either side may be the owning side.

-
    -
  1. -

    In the JPA Structure view, select the field to map.

    -
  2. -
  3. -

    Right-click the field and then select Map As > Many-to-Many. The JPA Details view (for attributes) displays the properties for the selected field.

    -
  4. -
  5. -

    Use this table to complete the General information fields of the JPA Details view.

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescriptionDefault
    Mapping Entity HyperlinkDefines this mapping as a Many to Many Mapping. -

    This field corresponds to the @ManyToMany annotation.

    -
    Many to Many
    Target EntityThe entity to which this attribute is mapped.null -

    You do not need to explicitly specify the target entity, since it can be inferred from the type of object being referenced.

    -
    FetchDefines how data is loaded from the database. See "Fetch Type" for details. -
      -
    • -

      Eager

      -
    • -
    • -

      Lazy

      -
    • -
    -
    Lazy
    Mapped ByThe database field that owns the relationship.
    Order BySpecify the default order for objects returned from a query. See "Order By" for details. -
      -
    • -

      No ordering

      -
    • -
    • -

      Primary key

      -
    • -
    • -

      Custom

      -
    • -
    -
    No ordering
    -
    -
  6. -
  7. -

    Use this table to complete the fields in the Join Table Information area in the JPA Details view.

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescriptionDefault
    NameName of the join table that contains the foreign key column.You must specify the join table on the owning side. -

    By default, the name is assumed to be the primary tables associated with the entities concatenated with an underscore.

    -
    Join ColumnsSelect Override Default, then Add, Edit, or Remove the join columns.By default, the name is assumed to be the primary tables associated with the entities concatenated with an underscore.
    Inverse Join ColumnsSelect Override Default, then Add, Edit, or Remove the join columns.By default, the mapping is assumed to have a single join.
    -
    -
  8. -
  9. -

    To add a new Join or Inverse Join Column, click Add.

    -

    To edit an existing Join or Inverse Join Column, select the field to and click Edit.

    -
  10. -
-

Eclipse adds the following annotations to the field:

-
-@JoinTable(joinColumns=@JoinColumn(name="<JOIN_COLUMN>"), 
-    name = "<JOIN_TABLE_NAME>")
-@ManyToMany(cascade=CascadeType.<CASCADE_TYPE>, fetch=FetchType.<FETCH_TYPE>,
-    targetEntity=<TARGET_ENTITY>, mappedBy = "<MAPPED_BY>")
-@OrderBy("<ORDER_BY>")
-
-
-

 

-Related task
-
-Mapping an entity -

 

-Related reference
-
-JPA Structure view
-JPA Details view (for attributes) -

 

-Related concept
-
-Understanding OR mappings
-Understanding EJB 3.0 Java Persistence API
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks015.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks015.htm deleted file mode 100644 index 05eba6a8dd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks015.htm +++ /dev/null @@ -1,167 +0,0 @@ - - - - - - - -Many-to-one mapping - - - - - - - - - - - -

-
-

Many-to-one mapping

-

Use a Many-to-One mapping to defines a single-valued association to another entity class that has many-to-one multiplicity.

-
    -
  1. -

    In the JPA Structure view, select the field to map.

    -
  2. -
  3. -

    Right click the field and then select Map As > Many-to-One. The JPA Details view (for attributes) displays the properties for the selected.

    -
  4. -
  5. -

    Use this table to complete the General information fields JPA Details view.

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescriptionDefault
    Mapping Entity HyperlinkDefines mapping as Many-to-One. This corresponds to the @ManyToOne annotation.Many-to-One
    Target EntityThe entity to which this attribute is mapped.null -

    You do not need to explicitly specify the target entity, since it can be inferred from the type of object being referenced.

    -
    FetchDefines how data is loaded from the database. See "Fetch Type" for details. -
      -
    • -

      Eager

      -
    • -
    • -

      Lazy

      -
    • -
    -
    Eager
    CascadeSee "Cascade Type" for details. -
      -
    • -

      Default

      -
    • -
    • -

      All

      -
    • -
    • -

      Persist

      -
    • -
    • -

      Merge

      -
    • -
    • -

      Remove

      -
    • -
    -
    Default
    OptionalSpecifies if this field is can be null.Yes
    -
    -
  6. -
  7. -

    Use this table to complete the fields on the Join Columns Information tab in the JPA Details view.

    -
    - ---- - - - - - - - - - - - - - -
    PropertyDescriptionDefault
    Join ColumnSpecify a mapped column for joining an entity association. This field corresponds to the @JoinColum attribute. -

    Select Override Default, then Add, Edit, or Remove the join columns.

    -
    By default, the mapping is assumed to have a single join.
    -
    -
  8. -
-

Eclipse adds the following annotations to the field:

-
-@JoinTable(joinColumns=@JoinColumn(name="<JOIN_COLUMN>"), 
-    name = "<JOIN_TABLE_NAME>")
-@ManyToOne(targetEntity=<TARGET_ENTITY>, fetch=<FETCH_TYPE>, 
-    cascade=<CASCADE_TYPE>)
-
-

 

-Related task
-
-Mapping an entity -

 

-Related reference
-
-JPA Structure view
-JPA Details view (for attributes) -

 

-Related concept
-
-Understanding OR mappings
-Understanding EJB 3.0 Java Persistence API
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks016.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks016.htm deleted file mode 100644 index 417c743805..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks016.htm +++ /dev/null @@ -1,197 +0,0 @@ - - - - - - - -One-to-many mapping - - - - - - - - - - - -

-
-

One-to-many mapping

-

Use a One-to-Many Mapping to define a relationship with one-to-many multiplicity.

-
    -
  1. -

    In the JPA Structure view, select the field to map.

    -
  2. -
  3. -

    Right-click the field and then select Map As > One-to-many. The JPA Details view (for attributes) displays the properties for the selected.

    -
  4. -
  5. -

    Use this table to complete the General information fields JPA Details view.

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescriptionDefault
    Mapping Entity Type HyperlinkDefines mapping as One-to-Many. This corresponds to the @OneToMany annotation.One-to-Many
    Target EntityThe entity to which this attribute is mapped.
    CascadeSee "Cascade Type" for details. -
      -
    • -

      Default

      -
    • -
    • -

      All

      -
    • -
    • -

      Persist

      -
    • -
    • -

      Merge

      -
    • -
    • -

      Remove

      -
    • -
    -

    FetchDefines how data is loaded from the database. See "Fetch Type" for details. -
      -
    • -

      Eager

      -
    • -
    • -

      Lazy

      -
    • -
    -
    Eager
    Mapped ByThe database field that owns the relationship.
    Order BySpecify the default order for objects returned from a query. See "Order By" for details. -
      -
    • -

      No ordering

      -
    • -
    • -

      Primary key

      -
    • -
    • -

      Custom

      -
    • -
    -
    No ordering
    -
    -
  6. -
  7. -

    Use this table to complete the Join Table Information fields in the JPA Details view.

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescriptionDefault
    NameName of the join tableBy default, the name is assumed to be the primary tables associated with the entities concatenated with an underscore.
    Join ColumnsSpecify two or more join columns (that is, a primary key).
    Inverse Join ColumnsThe join column on the owned (or inverse) side of the association: the owned entity's primary key column.
    -
    -
  8. -
-

Eclipse adds the following annotations to the field:

-
-@OneToMany(targetEntity=<TARGET_ENTITY>)
-@Column(name="<COLUMN>")
-
-
-@OneToMany(targetEntity=<TARGET_ENTITY>.class, cascade=CascadeType.<CASCADE_TYPE>, 
-    fetch = FetchType.<FETCH_TYPE>, mappedBy = "<MAPPED_BY>")@OrderBy("<ORDER_BY>")
-@JoinTable(name="<JOIN_TABLE_NAME>", joinColumns=@JoinColumn(name=
-    "<JOIN_COLUMN_NAME>", referencedColumnName="<JOIN_COLUMN_REFERENCED_COLUMN>"), 
-    inverseJoinColumns=@JoinColumn(name="<INVERSE_JOIN_COLUMN_NAME>", 
-    referencedColumnName="<INVERSE_JOIN_COLUMN_REFERENCED_COLUMN>"))
-
-
-

 

-Related task
-
-Mapping an entity -

 

-Related reference
-
-JPA Structure view
-JPA Details view (for attributes) -

 

-Related concept
-
-Understanding OR mappings
-Understanding EJB 3.0 Java Persistence API
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks017.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks017.htm deleted file mode 100644 index 9c58f8a42b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks017.htm +++ /dev/null @@ -1,146 +0,0 @@ - - - - - - - -One-to-one mapping - - - - - - - - - - - -

-
-

One-to-one mapping

-

Use a One-to-One Mapping to define a relationship with one-to-many multiplicity.

-
    -
  1. -

    In the JPA Structure view, select the field to map.

    -
  2. -
  3. -

    Right-click the field and then select Map As > One-to-One. The JPA Details view (for attributes) displays the properties for the selected.

    -
  4. -
  5. -

    Use this table to complete the General information fields in the JPA Details view.

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescriptionDefault
    Mapped Entity HyperlinkDefines mapping as One-to-One. This corresponds to the @OneToOne annotation.One-to-One
    Target EntityThe entity to which this attribute is mapped.null -

    You do not need to explicitly specify the target entity, since it can be inferred from the type of object being referenced.

    -
    Fetch TypeDefines how data is loaded from the database. See "Fetch Type" for details. -
      -
    • -

      Eager

      -
    • -
    • -

      Lazy

      -
    • -
    -
    Eager
    Mapped ByThe database field that owns the relationship.
    -
    -
  6. -
  7. -

    Use this table to complete the Join Columns Information fields in the JPA Details view.

    -
    - ---- - - - - - - - - - - - - - -
    PropertyDescriptionDefault
    Join ColumnSpecify a mapped column for joining an entity association. This field corresponds to the @JoinColum attribute. -

    Select Override Default, then Add, Edit, or Remove the join columns.

    -
    By default, the mapping is assumed to have a single join.
    -
    -
  8. -
-

Eclipse adds the following annotations to the field:

-
-@OneToOne(targetEntity=<TARGET_ENTITY>, cascade=CascadeType.<CASCADE_TYPE>, 
-    fetch = FetchType.<FETCH_TYPE>, mappedBy = "<MAPPED_BY>")
-@JoinColumn(name="<JOIN_COLUMN_NAME>", referencedColumnName=
-    "<JOIN_COLUMN_REFERENCED_COLUMN>", insertable = <INSERTABLE>, 
-    updatable = <UPDATABLE>)
-
-
-

 

-Related task
-
-Mapping an entity -

 

-Related reference
-
-JPA Structure view
-JPA Details view (for attributes) -

 

-Related concept
-
-Understanding OR mappings
-Understanding EJB 3.0 Java Persistence API
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks018.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks018.htm deleted file mode 100644 index b04bdb3c0a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks018.htm +++ /dev/null @@ -1,66 +0,0 @@ - - - - - - - -Transient mapping - - - - - - - - - - - -

-
-

Transient mapping

-

Use the Transient Mapping to specify a field of the entity class that is not persistent.

-

To create a transient mapping:

-
    -
  1. -

    In the JPA Structure view, select the field to map.

    -
  2. -
  3. -

    Right-click the field and then select Map As Transient. The JPA Details view (for attributes) displays the properties for the selected.

    -
  4. -
-

Eclipse adds the following annotation to the field:

-
-@Transient
-
-

 

-Related task
-
-Mapping an entity -

 

-Related reference
-
-JPA Structure view
-JPA Details view (for attributes) -

 

-Related concept
-
-Understanding OR mappings
-Understanding EJB 3.0 Java Persistence API
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks019.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks019.htm deleted file mode 100644 index f9f3209292..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks019.htm +++ /dev/null @@ -1,136 +0,0 @@ - - - - - - - -Version mapping - - - - - - - - - - - -

-
-

Version mapping

-

Use a Version Mapping to specify the field used for optimistic locking. If the entity is associated with multiple tables, you should use a version mapping only with the primary table. You should have only a single version mapping per persistent entity. Version mappings may be used only with the following attribute types:

-
    -
  • -

    int

    -
  • -
  • -

    Integer

    -
  • -
  • -

    short, Short

    -
  • -
  • -

    long, Long

    -
  • -
  • -

    Timestamp

    -
  • -
-

To create a version mapping:

-
    -
  1. -

    In the JPA Structure view, select the field to map.

    -
  2. -
  3. -

    Right-click the field and then select Map As > Version. The JPA Details view (for attributes) displays the properties for the selected.

    -
  4. -
  5. -

    Use this table to complete the remaining fields in the JPA Details view.

    -
    - ---- - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    PropertyDescriptionDefault
    Mapped Entity HyperlinkDefines the mapping as Version. This corresponds to the @Version annotation.Version
    ColumnThe database column mapped to the entity attribute. See "Column" for details.By default, the Column is assumed to be named identically to the attribute and always included in the INSERT and UPDATE statements.
    TableName of the database table. This must be the primary table associated with the attribute's entity.
    TemporalSpecifies the type of data. See "Temporal" for details. -
      -
    • -

      Date

      -
    • -
    • -

      Time

      -
    • -
    • -

      Timestamp

      -
    • -
    -

    -
    -
  6. -
-

Eclipse adds the following annotations to the field:

-
-@Version
-@Column(table="<COLUMN_TABLE>", name="<COLUMN_NAME>")
-
-
-

 

-Related task
-
-Mapping an entity -

 

-Related reference
-
-JPA Structure view
-JPA Details view (for attributes) -

 

-Related concept
-
-Understanding OR mappings
-Understanding EJB 3.0 Java Persistence API
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks020.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks020.htm deleted file mode 100644 index c785cd4dc0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks020.htm +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - -Element Collection mapping - - - - - - - - - - - -

-
-

Element Collection mapping

-
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks021.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks021.htm deleted file mode 100644 index 358ebb8f33..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks021.htm +++ /dev/null @@ -1,95 +0,0 @@ - - - - - - - -Generating entities from tables - - - - - - - - - - - -

-
-

Generating entities from tables

-

Use this procedure to generate Java persistent entities from database tables. You must create a JPA project and establish a database connection before generating persistent entities. See "Creating a new JPA project" for more information.

-
    -
  1. -

    Right-click the JPA project in the Project Explorer and select JPA Tools > Generate Entities from Tables.

    -
    -

    Generating Entities

    -Using the JPA Tools > Generate Entities menu option.
    -
  2. -
  3. -

    On the Select Tables page, select your database connection and schema.

    -

    To create a new database connection, click Add connection.

    -

    If you are not currently connected to the database, the Database Connection page appears. Select your database connection and schema, and click Reconnect.

    -
    -

    Select Tables

    -
    -
  4. -
  5. -

    After selecting a schema, select the tables from which to generate Java persistent entities and click Next.

    -
  6. -
  7. -

    On the Table Associations page, select the associations to generate. You can specify to generate specific references for each association.

    -

    To create a new association, click Add Association. Use the Create New Association wizard to define the association.

    -
    -

    Table Associations

    -
    -
  8. -
  9. -

    After editing the table associations, click Next.

    -
  10. -
  11. -

    On the Customize Default Entity Generation page, customize the mapping and class information for each generated entity.

    -
    -

    Customize Default Entity Generation

    -
    -
  12. -
  13. -

    After customizing the mappings, click Next.

    -
  14. -
  15. -

    On the Customize Individual Entities page, review the mapping and class information for each entity that will be generated, then click Finish.

    -
    -

    Customize Individual Entities

    -
    -
  16. -
-

Eclipse creates a Java persistent entity for each database table. Each entity contains fields based on the table's columns. Eclipse will also generate entity relationships (such as one-to-one) based on the table constraints. Figure: Generating Entities from Tables illustrates how Eclipse generates entities from tables.

-
-

Generating Entities from Tables

-This figure shows the EMPLOYEE and ADDRESS entities generated from database tables.
- -

 

-Related task
-

Creating a new JPA project

-

 

-Related reference
-
-Project Properties page – Java Persistence Options
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks022.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks022.htm deleted file mode 100644 index 6341e8970b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks022.htm +++ /dev/null @@ -1,61 +0,0 @@ - - - - - - - -Generating tables from entities - - - - - - - - - - - -

-
-

Generating tables from entities

-

When using a vendor-specific platform, you can create a DDL script from your persistent entities.

-
-

- - - - - - -
-

Note:

-The DDL script with DROP existing tables on the database and CREATE new tables, based on the entities in your project.
-
-
-

To generate a DDL script:

-

Right-click the JPA project in the Project Explorer and select JPA Tools > Generate Tables from Entities.

-

 

-Related task
-

Creating a JPA Entity

-

 

-Related reference
-
-Project Properties page – Java Persistence Options
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks023.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks023.htm deleted file mode 100644 index a1870e4d58..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks023.htm +++ /dev/null @@ -1,54 +0,0 @@ - - - - - - - -Validating mappings and reporting problems - - - - - - - - - - - -

-
-

Validating mappings and reporting problems

-

Errors and warnings on persistent entities and mappings are indicated with a red error or yellow warning next to the resource with the error, as well as the parent containers up to the project.

-
-

Sample Errors and Warnings

-This figure shows sample error and warning icons in the Explorer view.
- -

This section contains information on the following:

- -

 

-Related concept
-

Problems view

- - -
- - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks024.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks024.htm deleted file mode 100644 index b3fee1f68d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks024.htm +++ /dev/null @@ -1,92 +0,0 @@ - - - - - - - -Error messages - - - - - - - - - - - -

-
-

Error messages

-

This section contains information on error messages (including how to resolve the issue) you may encounter while working with Dali.

- -

Attribute "<ATTRIBUTE__NAME>" has invalid mapping type in this context

-

The mapped attribute is invalid. Either change the mapping type or change the entity type.

-

See "Mapping an entity" for more information.

- -

Attribute "<ATTRIBUTE_NAME>" cannot be resolved.

-

Dali cannot map the attribute to a database table and column. Verify that you database connection information is correct.

-

See "Creating a new JPA project" for more information.

- -

Class "<CLASS_NAME>" is not annotated as a persistent class.

-

The class has not been identified as a persistent class. Configure the class as an Entity, Mapped Superclass, or Embeddable persistent entity.

-

See "Adding persistence to a class".

- -

Column "<COLUMN_NAME>" cannot be resolved.

-

You mapped an entity's field to an incorrect or invalid column in the database table. By default, Dali will attempt to map each field in the entity with an identically named row in the database table. If the field's name differs from the row's name, you must explicitly create the mapping.

-

Map the field to a valid row in the database table as shown in "Mapping an entity".

- -

Duplicate class "<CLASS_NAME>".

-

You created to persistence classes with the same name. Each Java class must have a unique name. See "Adding persistence to a class" for more information.

- -

Entity does not have an Id or Embedded Id.

-

You created a persistent entity without identifying its primary key. A persistent entity must have a primary key field designated with an @Id or @EmbeddedId annotation.

-

Add an ID mapping to the entity as shown in "ID mapping" or "Embedded ID mapping".

- -

Multiple persistence.xml files in project.

-

You created a JPA project with more than one persistence.xml file. Each JPA project must contain a single persistence.xml file.

-

See "Managing the persistence.xml file" for more information.

- -

No persistence unit defined.

-

There is no persistence unit defined in the persistence.xml file. Use the <persistence-unit name="<PERSISTENCE_UNIT_NAME>" tag to define the persistent unit.

-

See "Managing the orm.xml file" for more information.

- -

No persistence.xml file in project.

-

You created a JPA project without a persistence.xml file. Each JPA project must contain a single persistence.xml file.

-

See "Managing the persistence.xml file" for more information.

- -

Referenced column "<COLUMN_NAME>" in join column "<COLUMN_NAME>" cannot be resolved.

-

The column that you selected to join a relationship mapping does not exist on the database table. Either select a different column on the Join Table Information or create the necessary column on the database table.

-

See "JPA Details view (for attributes)" for more information.

- -

Schema "<SCHEMA_NAME>" cannot be resolved for table/join table "<TABLE_NAME>".

-

Define the default database schema information in the persistence unit.

-

See "Managing the orm.xml file" for more information.

- -

Table "<TABLE_NAME>" cannot be resolved.

-

You associated a persistent entity to an incorrect or invalid database table. By default, Dali will attempt to associate each persistent entity with an identically named database table. If the entity's name differs from the table's name, you must explicitly create the association.

-

Associate the entity with a valid database table as shown in "Adding persistence to a class".

- -

Unresolved generator "<GENERATOR_NAME>" is defined in persistence unit.

-

You created a persistence entity that uses sequencing or a table generator, but did not define the generator in the persistence unit. Either define the generator by using an annotation or including it in the XML mapping file.

-Related concept
-

Problems view

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks025.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks025.htm deleted file mode 100644 index f6bbacb426..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks025.htm +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - -Warning messages - - - - - - - - - - - -

-
-

Warning messages

-

This section contains information on warning messages (including how to resolve the issue) you may encounter while working with Dali.

- -

Connection "<CONNECTION_NAME>" is not active. No validation will be done against the data source.

-

The database connection you specified to use with the JPA project is not active. The JPA project requires an active connection.

- -

No connection specified for the project. No data-specific validation will be performed.

-

You created a JPA project without specifying a database connection. The JPA project requires an active connection.

-

See "Creating a new JPA project" or "Modifying persistent project properties" for information on specifying a database connection.

-Related concept
-

Problems view

-
- - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tasks026.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tasks026.htm deleted file mode 100644 index 295a03a8bb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tasks026.htm +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - -Modifying persistent project properties - - - - - - - - - - - -

-
-

Modifying persistent project properties

-

Each persistent project must be associated with a database connection. To create a new database connection, click Database Connection use the New Connection wizard.

-

Use this procedure to modify the vender-specific platform and database connection associated with your JPA project.

-
    -
  1. -

    Right-click the project in the Explorer view and select Properties. The Properties page appears.

    -
    -

    The Properties Page

    -The Persistence page.
    -
  2. -
  3. -

    Complete each field on the Project Properties page – Java Persistence Options click OK.

    -
  4. -
-

 

-Related task
-
-Creating a new JPA project -

 

-Related reference
-
-Project Properties page – Java Persistence Options -

 

-Related concept
-
-Understanding Java persistence
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/tips_and_tricks.htm b/jpa/plugins/org.eclipse.jpt.doc.user/tips_and_tricks.htm deleted file mode 100644 index a47917f7e1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/tips_and_tricks.htm +++ /dev/null @@ -1,68 +0,0 @@ - - - - - - - -Tips and tricks - - - - - - - - - - - -

-

Tips and tricks

-

The following tips and tricks give some helpful ideas for increasing your productivity.

- -
- --- - - - - - - - - - - - - - - - -
TipDescription
Database ConnectionsWhen starting a new workbench session, be sure to reconnect to your database (if you are working online). This allows Dali to provide database-related mapping assistance and validation.
Schema-based persistence.xmlIf you are behind a firewall, you may need to configure your Eclipse workspace proxy in the Preferences dialog (Preferences > Internet > Proxy Settings) to properly validate a schema-based persistence.xml file.
-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/toc.xml b/jpa/plugins/org.eclipse.jpt.doc.user/toc.xml deleted file mode 100644 index 976debe599..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/toc.xml +++ /dev/null @@ -1,155 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new.htm b/jpa/plugins/org.eclipse.jpt.doc.user/whats_new.htm deleted file mode 100644 index 95294a3e2d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new.htm +++ /dev/null @@ -1,50 +0,0 @@ - - - - - - - -What's new - - - - - - - - - - - -

What's new

-

This section contains descriptions of the following new features and significant changes made to the Dali OR Mapping Tool for Release 2.3:

- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new001.htm b/jpa/plugins/org.eclipse.jpt.doc.user/whats_new001.htm deleted file mode 100644 index 70ca442b7b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new001.htm +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - -Improved Internationalization and Localization - - - - - - - - - - - -
-

Improved Internationalization and Localization

-

This release of the Dali OR Mapping Tool provides improved internationalization (i18n) and localization support. Dali projects can support different locales and processing of international data (such as dates and strings).

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new002.htm b/jpa/plugins/org.eclipse.jpt.doc.user/whats_new002.htm deleted file mode 100644 index 46b15e5afc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new002.htm +++ /dev/null @@ -1,51 +0,0 @@ - - - - - - - -Multiple Improvements to the Dali Perspective - - - - - - - - - - - -

-
-

Multiple Improvements to the Dali Perspective

-

There have been multiple improvements to the Dali perspectives to improve its ease-of-use:

-
    -
  • -

    The Create JPA Entity wizard now accepts short names as attribute types.

    -
  • -
  • -

    Dali will perform validation after refreshing database information.

    -
  • -
  • -

    Dali allows project-level customization for validation (error and warning reports)

    -
  • -
-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new003.htm b/jpa/plugins/org.eclipse.jpt.doc.user/whats_new003.htm deleted file mode 100644 index 5061cc4f3a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new003.htm +++ /dev/null @@ -1,63 +0,0 @@ - - - - - - - -Support for JPA 2.0 and EclipseLink - - - - - - - - - - - -

-
-

Support for JPA 2.0 and EclipseLink

-

This release of the Dali OR Mapping Tool supports generic JPA 2.0 as well as specific items for EclispeLink 1.2.

-
    -
  • -

    Derived IDs

    -
  • -
  • -

    Caching (Shared Cache and Cachable)

    -
  • -
  • -

    Canonical metamodel generation

    -
  • -
  • -

    Order Column configuration

    -
  • -
  • -

    ElementCollection mapping type

    -
  • -
  • -

    Cascade detach

    -
  • -
  • -

    Dali will upgrade your persistence.xml from JPA 1.0 to 2.0.

    -
  • -
-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new004.htm b/jpa/plugins/org.eclipse.jpt.doc.user/whats_new004.htm deleted file mode 100644 index 7ad545bfb6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new004.htm +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - -Conversion of Java Projects to JPA Projects - - - - - - - - - - - -

-
-

Conversion of Java Projects to JPA Projects

-

The Dali OR Mapping Tool now uses the Eclipse Configure menu to convert existing Java projects to JPA projects.

-

See "Converting a Java Project to a JPA Project" for more information.

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new005.htm b/jpa/plugins/org.eclipse.jpt.doc.user/whats_new005.htm deleted file mode 100644 index 431f99807f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new005.htm +++ /dev/null @@ -1,41 +0,0 @@ - - - - - - - -EclipseLink 2.x Support - - - - - - - - - - - -

-
-

EclipseLink 2.x Support

-

Release 2.3 provides support for EclipseLink 2.x features.

-

EclipseLink (the Eclipse Persistence Services Project) is a complete persistence frame work. Refer to http://www.eclipse.org/eclipselink/ for more information.

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new006.htm b/jpa/plugins/org.eclipse.jpt.doc.user/whats_new006.htm deleted file mode 100644 index 712867a5cc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.doc.user/whats_new006.htm +++ /dev/null @@ -1,39 +0,0 @@ - - - - - - - -Table-per-Concrete-Class Inheritance - - - - - - - - - - - -
-

Table-per-Concrete-Class Inheritance

-

The Dali OR Mapping Tool now supports the JPA 1.0-optional table-per-concrete-class inheritance option. This functionality may be required in JPA 2.0.

-
- - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.cvsignore b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.cvsignore deleted file mode 100644 index c14487ceac..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.cvsignore +++ /dev/null @@ -1 +0,0 @@ -build.xml diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.project b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.project deleted file mode 100644 index e29a7c662f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.project +++ /dev/null @@ -1,22 +0,0 @@ - - - org.eclipse.jpt.eclipselink.branding - - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - - diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.settings/org.eclipse.core.resources.prefs b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index 4aec29d1cd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Sun May 27 15:10:09 EDT 2007 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/META-INF/MANIFEST.MF deleted file mode 100644 index a822f00a6d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/META-INF/MANIFEST.MF +++ /dev/null @@ -1,7 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-SymbolicName: org.eclipse.jpt.eclipselink.branding;singleton:=true -Bundle-Version: 2.4.0.qualifier -Bundle-Localization: plugin -Bundle-Vendor: %providerName diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.html b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.html deleted file mode 100644 index ca606b1bb5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

June 06, 2007

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- - - \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.ini b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.ini deleted file mode 100644 index 7d88b9d396..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.ini +++ /dev/null @@ -1,44 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2009 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# about.ini -# contains information about a feature -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# "%key" are externalized strings defined in about.properties -# This file does not need to be translated. - -# Property "aboutText" contains blurb for "About" dialog (translated) -aboutText=%blurb - -# Property "windowImage" contains path to window icon (16x16) -# needed for primary features only - -# Property "featureImage" contains path to feature image (32x32) -featureImage=icons/WTP_icon_x32_v2.png - -# Property "aboutImage" contains path to product image (500x330 or 115x164) -# needed for primary features only - -# Property "appName" contains name of the application (translated) -# needed for primary features only - -# Property "welcomePage" contains path to welcome page (special XML-based format) -# optional - -# Property "welcomePerspective" contains the id of the perspective in which the -# welcome page is to be opened. -# optional - -# Property "tipsAndTricksHref" contains the Help topic href to a tips and tricks page -# optional -tipsAndTricksHref=/org.eclipse.jpt.doc.user/tips_and_tricks.htm - - diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.mappings b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.mappings deleted file mode 100644 index bddaab4310..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.mappings +++ /dev/null @@ -1,6 +0,0 @@ -# about.mappings -# contains fill-ins for about.properties -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# This file does not need to be translated. - -0=@build@ \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.properties deleted file mode 100644 index af0e36f3e0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/about.properties +++ /dev/null @@ -1,24 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2009 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -# about.properties -# contains externalized strings for about.ini -# java.io.Properties file (ISO 8859-1 with "\" escapes) -# fill-ins are supplied by about.mappings -# This file should be translated. - -blurb=Dali Java Persistence Tools - EclipseLink Support\n\ -\n\ -Version: {featureVersion}\n\ -Build id: {0}\n\ -\n\ -(c) Copyright Oracle contributors and others 2006, 2009. All rights reserved.\n\ -Visit http://www.eclipse.org/webtools diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/build.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/build.properties deleted file mode 100644 index 8ce4550c10..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/build.properties +++ /dev/null @@ -1,17 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2009 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### -bin.includes = META-INF/,\ - about.ini,\ - about.html,\ - about.mappings,\ - about.properties,\ - icons/,\ - plugin.properties diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/icons/WTP_icon_x32_v2.png b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/icons/WTP_icon_x32_v2.png deleted file mode 100644 index 6f09c2a700..0000000000 Binary files a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/icons/WTP_icon_x32_v2.png and /dev/null differ diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/plugin.properties b/jpa/plugins/org.eclipse.jpt.eclipselink.branding/plugin.properties deleted file mode 100644 index 33c60d39c3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.branding/plugin.properties +++ /dev/null @@ -1,13 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2009 Oracle. -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Eclipse Public License v1.0 -# which accompanies this distribution, and is available at -# http://www.eclipse.org/legal/epl-v10.html -# -# Contributors: -# Oracle. - initial API and implementation -############################################################################### - -pluginName = Dali Java Persistence Tools - EclipseLink Support -providerName = Eclipse Web Tools Platform diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.project b/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.project deleted file mode 100644 index 1d5359a334..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core.ddlgen/.project +++ /dev/null @@ -1,5 +0,0 @@ - - - org.eclipse.jpt.eclipselink.core.ddlgen - renamed to org.eclipse.jpt.jpa.eclipselink.core.ddlgen - \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.core/.project b/jpa/plugins/org.eclipse.jpt.eclipselink.core/.project deleted file mode 100644 index bd14595c75..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.core/.project +++ /dev/null @@ -1,5 +0,0 @@ - - - org.eclipse.jpt.eclipselink.core - renamed to org.eclipse.jpt.jpa.eclipselink.core - \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.jaxb.core.schemagen/.project b/jpa/plugins/org.eclipse.jpt.eclipselink.jaxb.core.schemagen/.project deleted file mode 100644 index 868e21be70..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.jaxb.core.schemagen/.project +++ /dev/null @@ -1,5 +0,0 @@ - - - org.eclipse.jpt.eclipselink.jaxb.core.schemagen - renamed to org.eclipse.jpt.jaxb.eclipselink.core.schemagen and moved to jaxb component - diff --git a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.project b/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.project deleted file mode 100644 index 7a6587657e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.eclipselink.ui/.project +++ /dev/null @@ -1,5 +0,0 @@ - - - org.eclipse.jpt.eclipselink.ui - renamed to org.eclipse.jpt.jpa.eclipselink.ui - \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.gen/.project b/jpa/plugins/org.eclipse.jpt.gen/.project deleted file mode 100644 index 688225a0c1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.gen/.project +++ /dev/null @@ -1,5 +0,0 @@ - - - org.eclipse.jpt.gen - renamed to org.eclipse.jpt.jpa.gen - \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.core.schemagen/.project b/jpa/plugins/org.eclipse.jpt.jaxb.core.schemagen/.project deleted file mode 100644 index 3d552f89dd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jaxb.core.schemagen/.project +++ /dev/null @@ -1,5 +0,0 @@ - - - org.eclipse.jpt.jaxb.core.schemagen - moved to jaxb component - diff --git a/jpa/plugins/org.eclipse.jpt.jaxb.ui/.project b/jpa/plugins/org.eclipse.jpt.jaxb.ui/.project deleted file mode 100644 index 8dc3015b6b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jaxb.ui/.project +++ /dev/null @@ -1,5 +0,0 @@ - - - org.eclipse.jpt.jaxb.ui - moved to jaxb component - diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/.classpath b/jpa/plugins/org.eclipse.jpt.jpa.core/.classpath deleted file mode 100644 index 5ee7c76127..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/.classpath +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/.cvsignore b/jpa/plugins/org.eclipse.jpt.jpa.core/.cvsignore deleted file mode 100644 index 31362a7d19..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -bin -@dot -temp.folder -build.xml -javaCompiler...args -javaCompiler...args.* diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/.project b/jpa/plugins/org.eclipse.jpt.jpa.core/.project deleted file mode 100644 index 42cb5a3ec4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/.project +++ /dev/null @@ -1,28 +0,0 @@ - - - org.eclipse.jpt.jpa.core - - - - - - org.eclipse.jdt.core.javabuilder - - - - - org.eclipse.pde.ManifestBuilder - - - - - org.eclipse.pde.SchemaBuilder - - - - - - org.eclipse.pde.PluginNature - org.eclipse.jdt.core.javanature - - diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/.settings/org.eclipse.core.resources.prefs b/jpa/plugins/org.eclipse.jpt.jpa.core/.settings/org.eclipse.core.resources.prefs deleted file mode 100644 index a35e16a202..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/.settings/org.eclipse.core.resources.prefs +++ /dev/null @@ -1,3 +0,0 @@ -#Wed Jan 20 17:49:11 EST 2010 -eclipse.preferences.version=1 -encoding/=ISO-8859-1 diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/.settings/org.eclipse.jdt.core.prefs b/jpa/plugins/org.eclipse.jpt.jpa.core/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 00070b73fb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,12 +0,0 @@ -#Sun Nov 12 15:24:36 EST 2006 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 -org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.5 -org.eclipse.jdt.core.compiler.debug.lineNumber=generate -org.eclipse.jdt.core.compiler.debug.localVariable=generate -org.eclipse.jdt.core.compiler.debug.sourceFile=generate -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.jpa.core/META-INF/MANIFEST.MF b/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF deleted file mode 100644 index 9cdc8de471..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/META-INF/MANIFEST.MF +++ /dev/null @@ -1,97 +0,0 @@ -Manifest-Version: 1.0 -Bundle-ManifestVersion: 2 -Bundle-Name: %pluginName -Bundle-Vendor: %providerName -Bundle-SymbolicName: org.eclipse.jpt.jpa.core;singleton:=true -Bundle-Version: 3.0.0.qualifier -Bundle-Activator: org.eclipse.jpt.jpa.core.JptJpaCorePlugin -Bundle-ActivationPolicy: lazy;exclude:="org.eclipse.jpt.core.internal.resource.contenttypes" -Bundle-ClassPath: . -Bundle-Localization: plugin -Bundle-RequiredExecutionEnvironment: J2SE-1.5 -Require-Bundle: org.eclipse.core.commands;bundle-version="[3.4.0,4.0.0)", - org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)", - org.eclipse.core.filebuffers;bundle-version="[3.4.0,4.0.0)", - org.eclipse.core.resources;bundle-version="[3.4.0,4.0.0)", - org.eclipse.core.runtime;bundle-version="[3.4.0,4.0.0)", - org.eclipse.debug.core;bundle-version="[3.4.0,4.0.0)", - org.eclipse.emf.ecore.xmi;bundle-version="[2.4.0,3.0.0)", - org.eclipse.jdt.core;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jdt.launching;bundle-version="[3.4.0,4.0.0)", - org.eclipse.jem.util;bundle-version="[2.0.100,3.0.0)", - org.eclipse.jpt.common.core;bundle-version="[1.0.0,2.0.0)", - org.eclipse.jpt.jpa.db;bundle-version="[2.0.0,3.0.0)", - org.eclipse.jpt.common.utility;bundle-version="[2.0.0,3.0.0)", - org.eclipse.jst.common.project.facet.core;bundle-version="[1.3.100,2.0.0)", - org.eclipse.jst.j2ee;bundle-version="[1.1.200,2.0.0)", - org.eclipse.jst.j2ee.core;bundle-version="[1.1.200,2.0.0)", - org.eclipse.wst.common.emf;bundle-version="[1.1.200,2.0.0)", - org.eclipse.wst.common.emfworkbench.integration;bundle-version="[1.1.200,2.0.0)", - org.eclipse.wst.common.frameworks;bundle-version="[1.1.200,2.0.0)", - org.eclipse.wst.common.modulecore;bundle-version="[1.1.200,2.0.0)", - org.eclipse.wst.common.project.facet.core;bundle-version="[1.3.0,2.0.0)", - org.eclipse.wst.sse.core;bundle-version="[1.1.300,2.0.0)", - org.eclipse.wst.validation;bundle-version="[1.2.0,2.0.0)", - org.eclipse.wst.xml.core;bundle-version="[1.1.300,2.0.0)", - org.eclipse.ltk.core.refactoring;bundle-version="[3.5.100,4.0.0)" -Export-Package: org.eclipse.jpt.jpa.core, - org.eclipse.jpt.jpa.core.context, - org.eclipse.jpt.jpa.core.context.java, - org.eclipse.jpt.jpa.core.context.orm, - org.eclipse.jpt.jpa.core.context.persistence, - org.eclipse.jpt.jpa.core.internal;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.context;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.context.java;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.context.orm;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.context.persistence;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.facet;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa1;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa1.context;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa1.context.java;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa1.context.orm;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa2;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa2.context;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa2.context.java;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa2.context.orm;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.connection;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.options;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa2.resource.java;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.libprov;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.libval;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.operations;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.platform;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.prefs;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.refactoring;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.resource.contenttypes;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.resource.java;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.resource.java.binary;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.resource.java.source;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.resource.orm;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.resource.persistence;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.resource.xml;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.synch;x-internal:=true, - org.eclipse.jpt.jpa.core.internal.validation;x-internal:=true, - org.eclipse.jpt.jpa.core.jpa2, - org.eclipse.jpt.jpa.core.jpa2.context, - org.eclipse.jpt.jpa.core.jpa2.context.java, - org.eclipse.jpt.jpa.core.jpa2.context.orm, - org.eclipse.jpt.jpa.core.jpa2.context.persistence, - org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection, - org.eclipse.jpt.jpa.core.jpa2.context.persistence.options, - org.eclipse.jpt.jpa.core.jpa2.resource.java, - org.eclipse.jpt.jpa.core.libprov, - org.eclipse.jpt.jpa.core.platform, - org.eclipse.jpt.jpa.core.resource, - org.eclipse.jpt.jpa.core.resource.java, - org.eclipse.jpt.jpa.core.resource.orm, - org.eclipse.jpt.jpa.core.resource.orm.v2_0, - org.eclipse.jpt.jpa.core.resource.persistence, - org.eclipse.jpt.jpa.core.resource.persistence.v2_0, - org.eclipse.jpt.jpa.core.resource.xml -Import-Package: com.ibm.icu.text;version="4.0.1" diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/about.html b/jpa/plugins/org.eclipse.jpt.jpa.core/about.html deleted file mode 100644 index be534ba44f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/about.html +++ /dev/null @@ -1,34 +0,0 @@ - - - - -About - - - - - -

About This Content

- -

May 02, 2008

- -

License

- -

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 -http://www.eclipse.org/org/documents/epl-v10.php. -For purposes of the EPL, "Program" will mean the Content.

- -

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 -http://www.eclipse.org/.

- - - diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/build.properties b/jpa/plugins/org.eclipse.jpt.jpa.core/build.properties deleted file mode 100644 index 1035f84e58..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/build.properties +++ /dev/null @@ -1,22 +0,0 @@ -################################################################################ -# Copyright (c) 2006, 2010 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ -javacSource=1.5 -javacTarget=1.5 -source.. = src/,\ - property_files/ -output.. = bin/ -bin.includes = .,\ - META-INF/,\ - about.html,\ - plugin.xml,\ - plugin.properties -jars.compile.order = . -src.includes = model/,\ - schema/ diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/component.xml b/jpa/plugins/org.eclipse.jpt.jpa.core/component.xml deleted file mode 100644 index 7706c8873c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/component.xml +++ /dev/null @@ -1,12 +0,0 @@ - - - - \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/model/DaliEmfFormatter.xml b/jpa/plugins/org.eclipse.jpt.jpa.core/model/DaliEmfFormatter.xml deleted file mode 100644 index 147065a21f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/model/DaliEmfFormatter.xml +++ /dev/null @@ -1,274 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/model/common.ecore b/jpa/plugins/org.eclipse.jpt.jpa.core/model/common.ecore deleted file mode 100644 index fd130656f3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/model/common.ecore +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/model/jpaResourceModels.genmodel b/jpa/plugins/org.eclipse.jpt.jpa.core/model/jpaResourceModels.genmodel deleted file mode 100644 index 89701be828..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/model/jpaResourceModels.genmodel +++ /dev/null @@ -1,513 +0,0 @@ - - - common.ecore - orm.ecore - persistence.ecore - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/model/orm.ecore b/jpa/plugins/org.eclipse.jpt.jpa.core/model/orm.ecore deleted file mode 100644 index 90197ea84f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/model/orm.ecore +++ /dev/null @@ -1,578 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/model/persistence.ecore b/jpa/plugins/org.eclipse.jpt.jpa.core/model/persistence.ecore deleted file mode 100644 index aaa8f23063..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/model/persistence.ecore +++ /dev/null @@ -1,84 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.properties b/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.properties deleted file mode 100644 index 98f06b2b92..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.properties +++ /dev/null @@ -1,59 +0,0 @@ -############################################################################### -# Copyright (c) 2006, 2010 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -############################################################################### -# ==================================================================== -# 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 = Dali Java Persistence Tools - Jpa Core -providerName = Eclipse Web Tools Platform - -JPA_PLATFORM=JPA Platforms - -JPA_RESOURCE_MODEL_PROVIDERS=JPA Resource Model Providers -JPA_FILE_CONTENT=JPA File Content - -BASE_JPA_CONTENT = Base content for JPA XML files -PERSISTENCE_XML_CONTENT = JPA persistence.xml files -MAPPING_FILE_CONTENT = Base content for JPA XML mapping files -ORM_XML_CONTENT = JPA orm.xml mapping files -JAR_CONTENT = JAR Content -JAVA_PACKAGE_INFO_CONTENT = package-info.java - -GENERIC_PLATFORM_GROUP_LABEL=Generic -GENERIC_1_0_PLATFORM_LABEL=Generic 1.0 -GENERIC_2_0_PLATFORM_LABEL=Generic 2.0 - -NO_OP_LIBRARY_PROVIDER_MESSAGE = The JPA facet requires a JPA implementation library to be present on the project classpath. By disabling library configuration, the user takes on the responsibility of ensuring that the classpath is configured appropriately via alternate means. -DEPRECATED_USER_LIBRARY_PROVIDER_LABEL=User Library (deprecated) - -JPA_FACET_LABEL=JPA -JPA_FACET_DESCRIPTION=Adds support for writing persistent meta-data using the Java Persistence API (JPA). -JPA_TEMPLATE_LABEL=JPA Project -JPA_VALIDATOR=JPA Validator -JPA_PROBLEM=JPA Problem - -JPA_DELETE_TYPE_PARTICIPANT_NAME=JPA Delete Type Participant -JPA_DELETE_PACKAGE_OR_FOLDER_PARTICIPANT_NAME=JPA Delete Package or Folder Participant -JPA_DELETE_MAPPING_FILE_PARTICIPANT_NAME=JPA Delete Mapping File Participant -JPA_RENAME_TYPE_PARTICIPANT_NAME=JPA Rename Type Participant -JPA_RENAME_PACKAGE_PARTICIPANT_NAME=JPA Rename Package Participant -JPA_RENAME_FOLDER_PARTICIPANT_NAME=JPA Rename Folder Participant -JPA_RENAME_MAPPING_FILE_PARTICIPANT_NAME=JPA Rename Mapping File Participant -JPA_MOVE_TYPE_PARTICIPANT_NAME=JPA Move Type Participant -JPA_MOVE_MAPPING_FILE_PARTICIPANT_NAME=JPA Move Mapping File Participant - \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml b/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml deleted file mode 100644 index 48f75fd544..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/plugin.xml +++ /dev/null @@ -1,679 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - %JPA_FACET_DESCRIPTION - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_core.properties b/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_core.properties deleted file mode 100644 index b08508d2e6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_core.properties +++ /dev/null @@ -1,49 +0,0 @@ -################################################################################ -# Copyright (c) 2006, 2010 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ - -NONE= -VALIDATE_JOB=Validation -VALIDATE_PROJECT_NOT_JPA=Project does not have the JPA facet -VALIDATE_PROJECT_IMPROPER_PLATFORM=Project's JPA platform does not support this file type -VALIDATE_CONTAINER_QUESTIONABLE=Parent folder may not be acceptable for this projects -VALIDATE_FILE_VERSION_NOT_SUPPORTED=File version not supported -VALIDATE_FILE_VERSION_NOT_SUPPORTED_FOR_FACET_VERSION=File version not supported for JPA facet version -VALIDATE_PERSISTENCE_UNIT_DOES_NOT_SPECIFIED=Persistence unit not specified -VALIDATE_PERSISTENCE_UNIT_NOT_IN_PROJECT=Persistence unit ''{0}'' not defined in project ''{1}'' -VALIDATE_PLATFORM_NOT_SPECIFIED=Platform must be specified -VALIDATE_PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION=Platform does not support the current JPA facet version -VALIDATE_LIBRARY_PROVIDER_INVALID=The currently selected library provider is invalid -VALIDATE_CONNECTION_NOT_SPECIFIED=Connection must be specified -VALIDATE_CONNECTION_INVALID=Connection profile ''{0}'' does not exist -VALIDATE_CONNECTION_NOT_CONNECTED=Connection must be active to get data source specific help and validation. -VALIDATE_DEFAULT_CATALOG_NOT_SPECIFIED=Default catalog is not specified -VALIDATE_CONNECTION_DOESNT_CONTAIN_CATALOG=Catalog ''{0}'' does not exist on the connection specified -VALIDATE_DEFAULT_SCHEMA_NOT_SPECIFIED=Default schema is not specified -VALIDATE_CONNECTION_DOESNT_CONTAIN_SCHEMA=Schema ''{0}'' does not exist on the connection specified -VALIDATE_RUNTIME_NOT_SPECIFIED=There is no server runtime associated with this project to provide a JPA implementation -VALIDATE_RUNTIME_DOES_NOT_SUPPORT_EJB_30=The server runtime selected does not support EJB 3.0, so it likely does not provide a JPA implementation -VALIDATE_LIBRARY_NOT_SPECIFIED=No JPA implementation library specified -SYNCHRONIZE_CLASSES_JOB=Synchronizing classes -SYNCHRONIZING_CLASSES_TASK=Synchronizing classes ... -INVALID_PERSISTENCE_XML_CONTENT=Invalid persistence.xml content -ERROR_SYNCHRONIZING_CLASSES_COULD_NOT_VALIDATE=Error synchronizing classes. Could not validate. -ERROR_WRITING_FILE=Could not write to persistence.xml -REGISTRY_MISSING_ATTRIBUTE=Missing required attribute ''{0}'' for element ''{1}'' in extension ''{1}'' from plug-in ''{2}''. -REGISTRY_INVALID_VALUE=Invalid value ''{0}'' for ''{1}'' in extension ''{2}'' from plug-in ''{3}''. -REGISTRY_DUPLICATE=An extension of ''{0}'' with the ''{1}'' value of ''{2}'' is already registered. -REGISTRY_FAILED_CLASS_LOAD=Unable to load the class ''{0}'' declared for the extension point ''{1}'' in the plug-in ''{2}''. -REGISTRY_FAILED_INTERFACE_ASSIGNMENT=Unable to assign the class ''{0}'' declared for the extension point ''{1}'' in the plug-in ''{2}'' to the interface ''{3}''. -REGISTRY_FAILED_INSTANTIATION=Unable to instantiate the class ''{0}'' declared for the extension point ''{1}'' in the plug-in ''{2}''. -CONTEXT_MODEL_SYNC_JOB_NAME=Synchronize JPA project: ''{0}'' -UPDATE_JOB_NAME=Update JPA project: ''{0}'' -PLATFORM_ID_DOES_NOT_EXIST=No JPA platform exists for the id: ''{0}''. The JPA project was not created for project ''{1}''. Ensure that the platform''s plugin has been added to this Eclipse installation. -PREFERENCES_FLUSH_JOB_NAME=Flush Preferences: {0} -OSGI_BUNDLES_LIBRARY_VALIDATOR__BUNDLE_NOT_FOUND=The bundle ''{0}'' could not be found. -OSGI_BUNDLES_LIBRARY_VALIDATOR__IMPROPER_BUNDLE_VERSION=The version of bundle ''{0}'' does not meet platform requirements. diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_core_refactoring.properties b/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_core_refactoring.properties deleted file mode 100644 index 7fadb37c81..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_core_refactoring.properties +++ /dev/null @@ -1,61 +0,0 @@ -################################################################################ -# Copyright (c) 2010 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ - -JPA_DELETE_TYPE_REFACTORING_PARTICIPANT_NAME=JPA delete IType refactoring participant -JPA_DELETE_PACKAGE_OR_FOLDER_REFACTORING_PARTICIPANT_NAME=JPA delete IPackageFragment/IFolder refactoring participant -JPA_DELETE_TYPE_REFACTORING_CHANGE_NAME=Delete references in JPA metadata files -JPA_DELETE_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME=Delete references from persistence.xml -JPA_DELETE_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME=Delete types from mapping file -JPA_DELETE_TYPE_REFACTORING_SUB_TASK_NAME=JPA delete references - -JPA_DELETE_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME=JPA delete mapping file refactoring participant -JPA_DELETE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME=JPA delete mapping file references -JPA_DELETE_MAPPING_FILE_REFACTORING_CHANGE_NAME=Delete mapping file references in JPA metadata files -JPA_DELETE_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME=Delete mapping files from persistence.xml - -JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME=loading JPA projects - -JPA_RENAME_TYPE_REFACTORING_PARTICIPANT_NAME=JPA rename IType refactoring participant -JPA_RENAME_TYPE_REFACTORING_CHANGE_NAME=Rename classes referenced in JPA metadata files -JPA_RENAME_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME=Rename type references in the persistence.xml -JPA_RENAME_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME=Rename type references in the mapping file -JPA_RENAME_TYPE_REFACTORING_SUB_TASK_NAME=JPA rename type references - -JPA_RENAME_PACKAGE_REFACTORING_PARTICIPANT_NAME=JPA rename IPackageFragment refactoring participant -JPA_RENAME_PACKAGE_REFACTORING_CHANGE_NAME=Rename packages referenced in JPA metadata files -JPA_RENAME_PACKAGE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME=Rename package references in the persistence.xml -JPA_RENAME_PACKAGE_REFACTORING_CHANGE_MAPPING_FILE_NAME=Rename package references in the mapping file -JPA_RENAME_PACKAGE_REFACTORING_SUB_TASK_NAME=JPA rename package references - -JPA_RENAME_FOLDER_REFACTORING_PARTICIPANT_NAME=JPA rename IFolder refactoring participant -JPA_RENAME_FOLDER_REFACTORING_CHANGE_NAME=Rename folders referenced in JPA metadata files -JPA_RENAME_FOLDER_REFACTORING_CHANGE_PERSISTENCE_XML_NAME=Rename folder references in the persistence.xml -JPA_RENAME_FOLDER_REFACTORING_SUB_TASK_NAME=JPA rename folder references - -JPA_RENAME_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME=JPA rename mapping file refactoring participant -JPA_RENAME_MAPPING_FILE_REFACTORING_SUB_TASK_NAME=JPA rename mapping file references -JPA_RENAME_MAPPING_FILE_REFACTORING_CHANGE_NAME=Rename mapping file references in JPA metadata files -JPA_RENAME_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME=Rename mapping file references in the persistence.xml - -JPA_MOVE_TYPE_REFACTORING_PARTICIPANT_NAME=JPA move IType refactoring participant -JPA_MOVE_TYPE_REFACTORING_CHANGE_NAME=Move classes referenced in JPA metadata files -JPA_MOVE_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME=Move type references in the persistence.xml -JPA_MOVE_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME=Move type references in the mapping file -JPA_MOVE_TYPE_REFACTORING_SUB_TASK_NAME=JPA move type references - -JPA_MOVE_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME=JPA move mapping file refactoring participant -JPA_MOVE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME=JPA move mapping file references -JPA_MOVE_MAPPING_FILE_REFACTORING_CHANGE_NAME=Move mapping file references in JPA metadata files -JPA_MOVE_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME=Move mapping file references in the persistence.xml - -JPA_MOVE_FOLDER_REFACTORING_PARTICIPANT_NAME=JPA move IFolder refactoring participant -JPA_MOVE_FOLDER_REFACTORING_CHANGE_NAME=Move folders referenced in JPA metadata files -JPA_MOVE_FOLDER_REFACTORING_CHANGE_PERSISTENCE_XML_NAME=Move folder references in the persistence.xml -JPA_MOVE_FOLDER_REFACTORING_SUB_TASK_NAME=JPA move folder references diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_validation.properties b/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_validation.properties deleted file mode 100644 index bd137902a5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_validation.properties +++ /dev/null @@ -1,224 +0,0 @@ -################################################################################ -# Copyright (c) 2006, 2010 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -################################################################################ - -PROJECT_INVALID_LIBRARY_PROVIDER=The currently selected library provider is invalid. -PROJECT_NO_CONNECTION=No connection specified for project. No database-specific validation will be performed. -PROJECT_INVALID_CONNECTION=Connection \"{0}\" does not exist. No database-specific validation will be performed. -PROJECT_INACTIVE_CONNECTION=Connection \"{0}\" is not active. No validation will be done against the data source. -PROJECT_NO_PERSISTENCE_XML=No persistence.xml file found in project -PROJECT_MULTIPLE_PERSISTENCE_XML=Multiple persistence.xml files in project -XML_VERSION_NOT_LATEST=A more recent version of this document is supported by this JPA platform -PERSISTENCE_XML_INVALID_CONTENT=The persistence.xml file does not have recognized content. -PERSISTENCE_XML_UNSUPPORTED_CONTENT=The persistence.xml file does not have supported content for this JPA platform. -PERSISTENCE_NO_PERSISTENCE_UNIT=No persistence unit defined -PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS=Multiple persistence units defined - only the first persistence unit will be recognized -PERSISTENCE_UNIT_ENTITY_NAME_ATTRIBUTE_MISSING=Duplicate entity \"{0}\" found in this persistence unit. Each entity must have a unique name within a persistent unit. -PERSISTENCE_UNIT_UNSPECIFIED_MAPPING_FILE=Unspecified mapping file -PERSISTENCE_UNIT_UNSUPPORTED_MAPPING_FILE_CONTENT=Mapping file {0} does not have supported content for this JPA platform. -PERSISTENCE_UNIT_INVALID_MAPPING_FILE=Mapping file {0} does not have recognized content. -PERSISTENCE_UNIT_NONEXISTENT_MAPPING_FILE=Mapping file \"{0}\" cannot be resolved. -PERSISTENCE_UNIT_DUPLICATE_MAPPING_FILE=Duplicate mapping file \"{0}\" -PERSISTENCE_UNIT_UNSPECIFIED_CLASS=Unspecified class -PERSISTENCE_UNIT_NONEXISTENT_CLASS=Class \"{0}\" cannot be resolved -PERSISTENCE_UNIT_INVALID_CLASS=Class \"{0}\" is included in a persistence unit, but is not mapped -PERSISTENCE_UNIT_DUPLICATE_CLASS=Duplicate class \"{0}\" -PERSISTENCE_UNIT_REDUNDANT_CLASS=Class \"{0}\" is already specified in mapping file \"{1}\" -PERSISTENCE_UNIT_DUPLICATE_JAR_FILE=Duplicate JAR file \"{0}\" -PERSISTENCE_UNIT_UNSPECIFIED_JAR_FILE=Unspecified JAR file -PERSISTENCE_UNIT_JAR_FILE_DEPLOYMENT_PATH_WARNING=The path to the JAR file will vary on your runtime environment. Please make sure the specified path fits your particular environment. -PERSISTENCE_UNIT_NONEXISTENT_JAR_FILE=JAR file \"{0}\" cannot be resolved -GENERATOR_DUPLICATE_NAME=Duplicate generator named \"{0}\" defined in this persistence unit -GENERATOR_NAME_UNDEFINED=Generator is unnamed. All generators require a name. -QUERY_DUPLICATE_NAME=Duplicate query named \"{0}\" defined in this persistence unit -QUERY_STATEMENT_UNDEFINED=Query \"{0}\" has no query statement. All queries require a query statement. -QUERY_NAME_UNDEFINED=Query is unnamed. All queries require a name. -MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_METADATA=Extraneous persistence unit metadata found for mapping file \"{0}\". These metadata will not be used. -PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT=Class \"{0}\" is mapped, but is not included in any persistence unit -PERSISTENT_TYPE_ANNOTATED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT=Class \"{0}\" is annotated, but is not included in any persistence unit -PERSISTENT_TYPE_UNSPECIFIED_CLASS=Unspecified class -PERSISTENT_TYPE_UNRESOLVED_CLASS=Class \"{0}\" cannot be resolved -TYPE_MAPPING_PK_REDEFINED_ID_CLASS=An ancestor of this class has already defined the primary key. The ID class may not be defined here. -TYPE_MAPPING_PK_REDEFINED_ID_ATTRIBUTE=An ancestor of this class has already defined the primary key. Primary key attributes may not be defined here. -TYPE_MAPPING_ID_CLASS_REDEFINED=An ancestor of this class has already defined the ID class. The ID class may not be defined here. -TYPE_MAPPING_ID_CLASS_REQUIRED=This class has a composite primary key. It must use an ID class. -TYPE_MAPPING_ID_CLASS_AND_EMBEDDED_ID_BOTH_USED=This class must use either an ID class or an embedded ID to specify its composite primary key, not both. -TYPE_MAPPING_MULTIPLE_EMBEDDED_ID=This class uses multiple embedded ID mappings. Only one is allowed. -TYPE_MAPPING_ID_CLASS_WITH_MAPS_ID=The relationship ''{0}'' maps an ID, which is not allowed in conjunction with an ID class. -TYPE_MAPPING_MAPS_ID_ATTRIBUTE_TYPE_DOES_NOT_AGREE=The type of the ID mapped by the relationship ''{0}'' does not agree with the primary key class of the target entity. -TYPE_MAPPING_ID_CLASS_ATTRIBUTE_NO_MATCH=There is no primary key attribute to match the ID class attribute {0} -TYPE_MAPPING_ID_CLASS_ATTRIBUTE_MAPPING_NO_MATCH=There is no ID class attribute to match the primary key attribute {0} -TYPE_MAPPING_ID_CLASS_ATTRIBUTE_MAPPING_DUPLICATE_MATCH=Primary key attribute {0} is a duplicate match for ID class -TYPE_MAPPING_ID_CLASS_ATTRIBUTE_NOT_PRIMARY_KEY=The attribute matching the ID class attribute {0} is not mapped as a primary key -TYPE_MAPPING_ID_CLASS_ATTRIBUTE_TYPE_DOES_NOT_AGREE=The attribute matching the ID class attribute {0} does not have the correct type {1} -ENTITY_NON_ROOT_ID_CLASS_SPECIFIED=An ID class should only be defined on the root entity or a mapped superclass -ENTITY_NON_ROOT_ID_ATTRIBUTE_SPECIFIED=A primary key attribute should only be defined on the root entity or a mapped superclass -ENTITY_NO_PK=The entity has no primary key attribute defined -TYPE_MAPPING_FINAL_CLASS=The java class for mapped type \"{0}\" is final -TYPE_MAPPING_MEMBER_CLASS=The java class for mapped type \"{0}\" is a member class -TYPE_MAPPING_CLASS_MISSING_NO_ARG_CONSTRUCTOR=The java class for mapped type \"{0}\" has no no-arg constructor defined -TYPE_MAPPING_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR=The java class for mapped type \"{0}\" has a private no-arg constructor; it must be public or protected. -ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE=No table should be defined for non-root entity \"{0}\" using single-table inheritance -ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE=No table should be defined for abstract entity \"{0}\" using table-per-concrete-class inheritance -ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED=No discriminator value should be defined for abstract entity \"{0}\" -ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_VALUE_DEFINED=No discriminator value should be defined for entity \"{0}\" using table-per-concrete-class inheritance -ENTITY_NAME_MISSING=The given name of the entity \"{0}\" is empty -ENTITY_NON_ROOT_DISCRIMINATOR_COLUMN_DEFINED=No discriminator column should be defined for non-root entity \"{0}\" -ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_COLUMN_DEFINED=No discriminator column should be defined for entity \"{0}\" using table-per-concrete-class inheritance -PERSISTENT_ATTRIBUTE_UNSPECIFIED_NAME=Unspecified name -PERSISTENT_ATTRIBUTE_UNRESOLVED_NAME=Attribute \"{0}\" in class \"{1}\" cannot be resolved -PERSISTENT_ATTRIBUTE_INHERITED_ATTRIBUTES_NOT_SUPPORTED=Attribute \"{0}\" is inherited; referring to inherited attributes in the orm.xml may not be supported by all persistence providers -PERSISTENT_ATTRIBUTE_INVALID_MAPPING=Attribute \"{0}\" has invalid mapping type in this context -PERSISTENT_ATTRIBUTE_FINAL_FIELD=The java field for attribute \"{0}\" is final -PERSISTENT_ATTRIBUTE_FINAL_GETTER=The get method for attribute \"{0}\" is final -PERSISTENT_ATTRIBUTE_PUBLIC_FIELD=The java field for attribute \"{0}\" is public -MAPPING_UNRESOLVED_MAPPED_BY=In {0}, the "mapped by" value ''{1}'' cannot be resolved to an attribute on the target entity. -MAPPING_INVALID_MAPPED_BY=In {0}, the "mapped by" attribute ''{1}'' has an invalid mapping type for this relationship. -MAPPING_MAPPED_BY_ON_BOTH_SIDES=In {0}, the "mapped by" attribute ''{1}'' also maps this attribute. Every relationship must have an owner. -ID_MAPPING_UNRESOLVED_GENERATOR_NAME=Unresolved generator name \"{0}\" -ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_COLUMN_SPECIFIED=In {0}, a column is specified, but it is mapped by a relationship. IDs that are mapped by a relationship should not specify a column. -EMBEDDED_ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_ATTRIBUTE_OVERRIDES_SPECIFIED=Embedded IDs that are mapped by a relationship should not specify any attribute overrides. -ATTRIBUTE_OVERRIDE_MAPPED_BY_RELATIONSHIP_AND_SPECIFIED=Attributes (or subattributes of an attribute) that are mapped by a relationship should not be overridden. -TABLE_UNRESOLVED_CATALOG=Catalog \"{0}\" cannot be resolved for table \"{1}\" -TABLE_UNRESOLVED_SCHEMA=Schema \"{0}\" cannot be resolved for table \"{1}\" -TABLE_UNRESOLVED_NAME=Table \"{0}\" cannot be resolved -SECONDARY_TABLE_UNRESOLVED_CATALOG=Catalog \"{0}\" cannot be resolved for secondary table \"{1}\" -SECONDARY_TABLE_UNRESOLVED_SCHEMA=Schema \"{0}\" cannot be resolved for secondary table \"{1}\" -SECONDARY_TABLE_UNRESOLVED_NAME=Secondary table \"{0}\" cannot be resolved -JOIN_TABLE_UNRESOLVED_CATALOG=Catalog \"{0}\" cannot be resolved for join table \"{1}\" -JOIN_TABLE_UNRESOLVED_SCHEMA=Schema \"{0}\" cannot be resolved for join table \"{1}\" -JOIN_TABLE_UNRESOLVED_NAME=Join table \"{0}\" cannot be resolved -VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_CATALOG=In implied attribute \"{0}\", catalog \"{1}\" cannot be resolved for join table \"{2}\" -VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA=In implied attribute \"{0}\", schema \"{1}\" cannot be resolved for join table \"{2}\" -VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME=In implied attribute \"{0}\", join table \"{1}\" cannot be resolved -COLUMN_UNRESOLVED_TABLE=Table \"{0}\" for column \"{1}\" cannot be resolved -COLUMN_UNRESOLVED_NAME=Column \"{0}\" cannot be resolved on table \"{1}\" -VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME=In implied attribute \"{0}\", column \"{1}\" cannot be resolved on table \"{2}\" -VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME=In implied attribute override \"{0}\", column \"{1}\" cannot be resolved on table \"{2}\" -VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME=In implied attribute \"{0}\", attribute override \"{1}\", column \"{2}\" cannot be resolved on table \"{3}\" -VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME=In implied map key attribute override \"{0}\", column \"{1}\" cannot be resolved on table \"{2}\" -VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME=In implied attribute \"{0}\", map key attribute override \"{1}\", column \"{2}\" cannot be resolved on table \"{3}\" -JOIN_COLUMN_UNRESOLVED_NAME=Join column \"{0}\" cannot be resolved on table \"{1}\" -JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=Name must be specified when there are multiple join columns -JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME=Join column referenced column name \"{0}\" cannot be resolved on table \"{1}\" -JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=Referenced column name must be specified when there are multiple join columns - -VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_TABLE=In implied attribute \"{0}\", table \"{1}\" for join column \"{2}\" cannot be resolved -VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME=In implied attribute \"{0}\", join column \"{1}\" cannot be resolved on table \"{2}\" -VIRTUAL_ATTRIBUTE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=In implied attribute \"{0}\", name must be specified when there are multiple join columns -VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME=In implied attribute \"{0}\", join column referenced column name \"{1}\" cannot be resolved on table \"{2}\" -VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=In implied attribute \"{0}\", referenced column name must be specified when there are multiple join columns -INVERSE_JOIN_COLUMN_UNRESOLVED_NAME=Inverse join column \"{0}\" cannot be resolved on table \"{1}\" -INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=Name must be specified when there are multiple inverse join columns -INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME=Inverse join column referenced column name \"{0}\" cannot be resolved on table \"{1}\" -INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=Referenced column name must be specified when there are multiple inverse join columns -VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME=In implied attribute \"{0}\", inverse join column \"{1}\" cannot be resolved on table \"{2}\" -VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=In implied attribute \"{0}\", name must be specified when there are multiple inverse join columns -VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=In implied attribute \"{0}\", referenced column name must be specified when there are multiple inverse join columns -VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME=In implied attribute \"{0}\", inverse join column referenced column name \"{1}\" cannot be resolved on table \"{2}\" -VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME=In implied association override \"{0}\", join column \"{1}\" cannot be resolved on table \"{2}\" -VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME=In implied association override \"{0}\", join column referenced column name \"{1}\" cannot be resolved on table \"{2}\" -VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=In implied association override \"{0}\", name must be specified when there are multiple join columns -VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=In implied association override \"{0}\", referenced column name must be specified when there are multiple join columns -VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME=In implied attribute \"{0}\", association override \"{1}\", join column \"{2}\" cannot be resolved on table \"{3}\" -VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME=In implied attribute \"{0}\", association override \"{1}\", join column referenced column name \"{2}\" cannot be resolved on table \"{3}\" -VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=In implied attribute \"{0}\", association override \"{1}\", name must be specified when there are multiple join columns -VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=In implied attribute \"{0}\", association override \"{1}\", referenced column name must be specified when there are multiple join columns -VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME=In implied association override \"{0}\", inverse join column \"{1}\" cannot be resolved on table \"{2}\" -VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME=In implied association override \"{0}\", inverse join column referenced column name \"{1}\" cannot be resolved on table \"{2}\" -VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS=In implied association override \"{0}\", name must be specified when there are multiple inverse join columns -VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS=In implied association override \"{0}\", referenced column name must be specified when there are multiple inverse join columns -VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME=In implied attribute \"{0}\", association override \"{1}\", inverse join column \"{2}\" cannot be resolved on table \"{3}\" -VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME=In implied attribute \"{0}\", association override \"{1}\", inverse join column referenced column name \"{2}\" cannot be resolved on table \"{3}\" -VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS=In implied attribute \"{0}\", association override \"{1}\", name must be specified when there are multiple inverse join columns -VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS=In implied attribute \"{0}\", association override \"{1}\", referenced column name must be specified when there are multiple inverse join columns -VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_NAME=In implied association override \"{0}\", join table \"{1}\" cannot be resolved -VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_CATALOG=In implied association override \"{0}\", join table catalog \"{1}\" cannot be resolved -VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_SCHEMA=In implied association override \"{0}\", join table schema \"{1}\" cannot be resolved -GENERATED_VALUE_UNRESOLVED_GENERATOR=No generator named \"{0}\" is defined in the persistence unit -PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME=Primary key join column \"{0}\" cannot be resolved on table \"{1}\" -PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=Name must be specified when there are multiple primary key join columns -PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME=Primary key join column referenced column name \"{0}\" cannot be resolved on table \"{1}\" -PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=Referenced column name must be specified when there are multiple primary key join columns -VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME=In implied primary key join column, name \"{0}\" cannot be resolved on table \"{1}\" -VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME=In implied primary key join column, referenced column name \"{0}\" cannot be resolved on table \"{1}\" -VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=In implied primary key join column, name must be specified when there are multiple primary key join columns -VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=In implied primary key join column, referenced column name must be specified when there are multiple primary key join columns -VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME=In implied attribute \"{0}\", primary key join column name \"{1}\" cannot be resolved on table \"{2}\" -VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME=In implied attribute \"{0}\", primary key join column referenced column name \"{1}\" cannot be resolved on table \"{2}\" -VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=In implied attribute \"{0}\", primary key join column name must be specified when there are multiple primary key join columns -VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=In implied attribute \"{0}\", primary key join column referenced column name must be specified when there are multiple primary key join columns -VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME=In implied secondary table \"{0}\", primary key join column \"{1}\" cannot be resolved on table \"{2}\" -VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME=In implied secondary table \"{0}\", primary key join column referenced column name \"{1}\" cannot be resolved on table \"{2}\" -VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=In implied secondary table \"{0}\", name must be specified when there are multiple primary key join columns -VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS=In implied secondary table \"{0}\", referenced column name must be specified when there are multiple primary key join columns - -NO_JPA_PROJECT=This project has the JPA facet, but no JPA project could be created. See the error log for more details. -TARGET_ENTITY_NOT_DEFINED=Target entity for \"{0}\" is not defined -VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED=In implied attribute \"{0}\", target entity is not defined -TARGET_ENTITY_IS_NOT_AN_ENTITY=Target entity \"{0}\" for \"{1}\" is not an Entity -VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY=In implied attribute \"{0}\", target entity \"{1}\" is not an Entity -DISCRIMINATOR_COLUMN_UNRESOLVED_NAME=Discriminator column \"{0}\" cannot be resolved on table \"{1}\" -ENTITY_TABLE_PER_CLASS_NOT_SUPPORTED_ON_PLATFORM=Entity \"{0}\" cannot use table-per-concrete-class inheritance because the chosen JPA platform does not support it -ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM=Entity \"{0}\" uses table-per-concrete-class inheritance which is not portable and may not be supported by the JPA provider -TARGET_NOT_AN_EMBEDDABLE={0} is not mapped as an embeddable - -MAPS_ID_VALUE_NOT_SPECIFIED=In {0}, the "maps ID" value is not specified and could not be determined from defaults -MAPS_ID_VALUE_NOT_RESOLVED=In {0}, the "maps ID" value ''{1}'' could not be resolved to an attribute on this entity or this entity''s embedded ID -MAPS_ID_VALUE_INVALID=In {0}, the "maps ID" value ''{1}'' does not refer to an attribute that is used as an ID for this entity -ORDER_COLUMN_AND_ORDER_BY_BOTH_SPECIFIED=Attribute \"{0}\" specifies both OrderColumn and OrderBy annotations -ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED=Target class is not defined -VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED=In implied attribute \"{0}\", target class is not defined -ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED=Map key class is not defined -VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED=In implied attribute \"{0}\", map key class is not defined -ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE=Target class \"{0}\" is not an embeddable or basic type -VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE=In implied attribute \"{0}\" target class \"{1}\" is not an embeddable or basic type -MAP_KEY_COLUMN_UNRESOLVED_NAME = Map key column \"{0}\" cannot be resolved on table \"{1}\" -VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_UNRESOLVED_NAME = In implied attribute \"{0}\", map key column \"{1}\" cannot be resolved on table \"{2}\" -COLLECTION_TABLE_UNRESOLVED_CATALOG = Catalog \"{0}\" cannot be resolved for collection table \"{1}\" -COLLECTION_TABLE_UNRESOLVED_NAME = Collection table \"{0}\" cannot be resolved -COLLECTION_TABLE_UNRESOLVED_SCHEMA = Schema \"{0}\" cannot be resolved for collection table \"{1}\" -VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_CATALOG = In implied attribute \"{0}\", catalog \"{1}\" cannot be resolved for collection table \"{2}\" -VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_SCHEMA = In implied attribute \"{0}\", schema \"{1}\" cannot be resolved for collection table \"{2}\" -VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_NAME = In implied attribute \"{0}\", collection table \"{1}\" cannot be resolved -ORDER_COLUMN_UNRESOLVED_NAME=Order column \"{0}\" cannot be resolved on table \"{1}\" -VIRTUAL_ATTRIBUTE_ORDER_COLUMN_UNRESOLVED_NAME=In implied attribute \"{0}\", order column \"{1}\" cannot be resolved on table \"{2}\" - - -#These messages have a parameter at the end which is used to plugin a different description. -#The possible message endings are found in jpa_validation_description.properties. -COLUMN_TABLE_NOT_VALID=Table \"{0}\" for column \"{1}\" {2} -VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID=In implied attribute \"{0}\", table \"{1}\" for column \"{2}\" {3} -VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID=In implied attribute override \"{0}\", table \"{1}\" for column \"{2}\" {3} -VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID=In implied attribute \"{0}\", attribute override \"{1}\", table \"{2}\" for column \"{3}\" {4} -JOIN_COLUMN_TABLE_NOT_VALID=Table \"{0}\" for join column \"{1}\" {2} -VIRTUAL_ATTRIBUTE_JOIN_COLUMN_TABLE_NOT_VALID=In implied attribute \"{0}\", table \"{1}\" for join column \"{2}\" {3} -INVERSE_JOIN_COLUMN_TABLE_NOT_VALID=Table \"{0}\" for inverse join column \"{1}\" {2} -VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID=In implied attribute \"{0}\", table \"{1}\" for inverse join column \"{2}\" {3} -VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID=In implied association override \"{0}\", table \"{1}\" for join column \"{2}\" {3} -VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID=In implied attribute \"{0}\", association override \"{1}\", table \"{2}\" for join column \"{3}\" {4} -VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID=In implied association override \"{0}\", table \"{1}\" for inverse join column \"{2}\" {3} -VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID=In implied attribute \"{0}\", association override \"{1}\", table \"{2}\" for inverse join column \"{3}\" {4} - -VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID=In implied map key attribute override \"{0}\", table \"{1}\" for column \"{2}\" {3} -VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID=In implied attribute \"{0}\", map key attribute override \"{1}\", table \"{2}\" for column \"{3}\" {4} -MAP_KEY_COLUMN_TABLE_NOT_VALID=Table \"{0}\" for map key column \"{1}\" {2} -VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID=In implied attribute \"{0}\", table \"{1}\" for map key column \"{2}\" {3} - -ATTRIBUTE_OVERRIDE_INVALID_NAME=Attribute override \"{0}\" cannot be resolved to an attribute {1} \"{2}\" -VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_INVALID_NAME=In implied attribute \"{0}\", attribute override \"{1}\" cannot be resolved to an attribute {2} \"{3}\" -ASSOCIATION_OVERRIDE_INVALID_NAME=Association override \"{0}\" cannot be resolved to an attribute {1} \"{2}\" -VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVALID_NAME=In implied attribute \"{0}\", association override \"{1}\" cannot be resolved to an attribute {2} \"{3}\" -VIRTUAL_ATTRIBUTE_OVERRIDE_INVALID_NAME=Implied attribute override \"{0}\" cannot be resolved to an attribute {1} \"{2}\" -VIRTUAL_ASSOCIATION_OVERRIDE_INVALID_NAME=Implied association override \"{0}\" cannot be resolved to an attribute {1} \"{2}\" -VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_INVALID_NAME=Implied map key attribute override \"{0}\" cannot be resolved to an attribute {1} \"{2}\" -VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_INVALID_NAME=In implied attribute \"{0}\", map key attribute override \"{1}\" cannot be resolved to an attribute {2} \"{3}\" - - - diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_validation_description.properties b/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_validation_description.properties deleted file mode 100644 index c5922c7c23..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/property_files/jpa_validation_description.properties +++ /dev/null @@ -1,23 +0,0 @@ -################################################################################ -# Copyright (c) 2010 Oracle. All rights reserved. -# This program and the accompanying materials are made available under the -# terms of the Eclipse Public License v1.0, which accompanies this distribution -# and is available at http://www.eclipse.org/legal/epl-v10.html. -# -# Contributors: -# Oracle - initial API and implementation -# -# The messages are used as the description of validation messages found in the -# jpa_validation.properties bundle. They are used as parameters to validation messages. -# -################################################################################ - -DOES_NOT_MATCH_JOIN_TABLE=does not match join table -DOES_NOT_MATCH_COLLECTION_TABLE=does not match collection table -NOT_VALID_FOR_THIS_ENTITY=is not valid for this entity - -ATTRIBUTE_DESC=attribute ''{0}'' -VIRTUAL_ATTRIBUTE_DESC=implied attribute ''{0}'' - -ON_MAPPED_SUPERCLASS=on the mapped superclass -ON_EMBEDDABLE=on the embeddable diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/schema/jpaPlatforms.exsd b/jpa/plugins/org.eclipse.jpt.jpa.core/schema/jpaPlatforms.exsd deleted file mode 100644 index 3628256e4f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/schema/jpaPlatforms.exsd +++ /dev/null @@ -1,210 +0,0 @@ - - - - - - - - - Defines JPA platforms and JPA platform groups. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Declares a JPA platform group. Acts as a sort of "super" platform. Most useful for enabling functionality for a set of platforms without having to enable the functionality for each platform separately. - - - - - - - The unique identifier for a JPA platform group. - - - - - - - A translatable string representation of the JPA platform group. - - - - - - - - - - - - - Declares a JPA platform. One JPA platform will be selected per JPA-faceted project. See <samp>org.eclipse.jpt.jpa.core.JpaPlatform</samp> for more information on JPA platforms. Also see the org.eclipse.jpt.jpa.ui.jpaPlatformUis extension point. - - - - - - - - - - - - - - A translatable string representation of the platform. - - - - - - - - - - The class that implements <samp>org.eclipse.jpt.jpa.core.JpaPlatformFactory</samp>. - - - - - - - - - - Declares which JPA platform group this platform belongs to, if any. - - - - - - - Declares the JPA facet version for which this platform may be used. If no JPA facet version is specified, this platform is available for all JPA facet versions. - - - - - - - Declares whether this platform should be used as a default JPA platform for new JPA project content. Note that if a workspace contains more than one default platform for a JPA facet version, one of them will be chosen at random. By default, a platform is not a default platform. - - - - - - - - - - - - JPT 1.0 - - - - - - - - - <br> -<p> -The following example is the included generic JPA 1.0 platform and its platform group -<p> -<pre> -<extension point="org.eclipse.jpt.jpa.core.jpaPlatforms"> - - <jpaPlatformGroup - id="myJpaPlatformGroup" - label="My JPA Platform"/> - - <jpaPlatform - id="generic" - label="%GENERIC_1_0_PLATFORM_LABEL" - factoryClass="org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory" - jpaFacetVersion="1.0" - default="false"> - </jpaPlatform> - -</extension> - - - - - - - - - Provisional API: This interface is part of an interim API that is still -under development and expected to change significantly before reaching -stability. It is available at this early stage to solicit feedback from -pioneering adopters on the understanding that any code that uses this API -will almost certainly be broken (repeatedly) as the API evolves. - - - - - - - - - [Enter information about supplied implementation of this extension point.] - - - - - - - - - Copyright (c) 2006, 2010 Oracle. All rights reserved. -This program and the accompanying materials are made available under the -terms of the Eclipse Public License v1.0, which accompanies this distribution -and is available at http://www.eclipse.org/legal/epl-v10.html. - -Contributors: -Oracle - initial API and implementation - - - - diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/EntityGeneratorDatabaseAnnotationNameBuilder.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/EntityGeneratorDatabaseAnnotationNameBuilder.java deleted file mode 100644 index 0564829788..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/EntityGeneratorDatabaseAnnotationNameBuilder.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import org.eclipse.jpt.jpa.db.Column; -import org.eclipse.jpt.jpa.db.ForeignKey; -import org.eclipse.jpt.jpa.db.Table; - -/** - * Provide a pluggable way to determine whether and how the entity generator - * prints the names of various database objects. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.1 - */ -public interface EntityGeneratorDatabaseAnnotationNameBuilder { - - /** - * Given the name of an entity and the table to which it is mapped, - * build and return a string to be used as the value for the entity's - * Table annotation's 'name' element. Return null if the entity - * maps to the table by default. - */ - String buildTableAnnotationName(String entityName, Table table); - - /** - * Given the name of an attribute (field or property) and the column - * to which it is mapped, - * build and return a string to be used as the value for the attribute's - * Column annotation's 'name' element. Return null if the attribute - * maps to the column by default. - */ - String buildColumnAnnotationName(String attributeName, Column column); - - /** - * Given the name of an attribute (field or property) and the - * many-to-one or many-to-many foreign key to which it is mapped, - * build and return a string to be used as the value for the attribute's - * JoinColumn annotation's 'name' element. Return null if the attribute - * maps to the join column by default. - * The specified foreign key consists of a single column pair whose - * referenced column is the single-column primary key of the foreign - * key's referenced table. - */ - String buildJoinColumnAnnotationName(String attributeName, ForeignKey foreignKey); - - /** - * Build and return a string to be used as the value for a JoinColumn - * annotation's 'name' or 'referencedColumnName' element. - * This is called for many-to-one and many-to-many mappings when - * the default join column name and/or referenced column name are/is - * not applicable. - * @see #buildJoinColumnAnnotationName(String, ForeignKey) - */ - String buildJoinColumnAnnotationName(Column column); - - /** - * Build and return a string to be used as the value for a JoinTable - * annotation's 'name' element. - * This is called for many-to-many mappings when the default - * join table name is not applicable. - */ - String buildJoinTableAnnotationName(Table table); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/GenericJpaProjectManager.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/GenericJpaProjectManager.java deleted file mode 100644 index 44d0ded6b1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/GenericJpaProjectManager.java +++ /dev/null @@ -1,1100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import java.util.Vector; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceChangeEvent; -import org.eclipse.core.resources.IResourceChangeListener; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceProxy; -import org.eclipse.core.resources.IResourceProxyVisitor; -import org.eclipse.core.resources.IWorkspace; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.jobs.IJobManager; -import org.eclipse.core.runtime.jobs.ILock; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.jdt.core.ElementChangedEvent; -import org.eclipse.jdt.core.IElementChangedListener; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jpt.common.core.internal.JptCommonCoreMessages; -import org.eclipse.jpt.common.core.internal.utility.CallbackJobSynchronizer; -import org.eclipse.jpt.common.core.internal.utility.JobCommand; -import org.eclipse.jpt.common.core.internal.utility.JobSynchronizer; -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.internal.AsynchronousCommandExecutor; -import org.eclipse.jpt.common.utility.internal.SimpleCommandExecutor; -import org.eclipse.jpt.common.utility.internal.StatefulCommandExecutor; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.SynchronizedBoolean; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.synchronizers.CallbackSynchronizer; -import org.eclipse.jpt.common.utility.synchronizers.Synchronizer; -import org.eclipse.jpt.jpa.core.internal.JptCoreMessages; -import org.eclipse.jpt.jpa.core.internal.SimpleJpaProjectConfig; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework; -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.core.events.IProjectFacetActionEvent; - -/** - * The JPA project manager maintains a list of all JPA projects in the workspace. - * It keeps the list (and the state of the JPA projects themselves) - * synchronized with the workspace by listening for various - * changes:
    - *
  • Resource - *
  • Java - *
  • Faceted Project - *
- * We use an Eclipse {@link ILock lock} to synchronize access to the JPA - * projects when dealing with these events. In an effort to reduce deadlocks, - * the simple Resource and Java change events are dispatched to a background - * thread, allowing us to handle the events outside of the workspace lock held - * during resource and Java change notifications. - *

- * Events that trigger either the adding or removing of a JPA project (e.g. - * {@link IResourceChangeEvent#POST_CHANGE}) are handled "synchronously" - * by allowing the background thread to handle any outstanding events before - * updating the list of JPA projects and returning execution to the event - * source. - *

- * Various things that cause us to add or remove a JPA project:

    - *
  • The {@link JptJpaCorePlugin} will "lazily" instantiate and {@link #start() start} - * a JPA project manager as appropriate. This will trigger the manager - * to find and add all pre-existing JPA projects. - * - *
  • Project created and facet installed

    - * {@link IResourceChangeEvent#POST_CHANGE} - *

  • Project facet uninstalled

    - * {@link IFacetedProjectEvent.Type#PRE_UNINSTALL} - * - *

  • Project opened

    - * {@link IResourceChangeEvent#POST_CHANGE} - * -> {@link IResource#FILE} - * -> {@link IResourceDelta#ADDED} facet settings file - * (/.settings/org.eclipse.wst.common.project.facet.core.xml) - *

  • Project closed

    - * {@link IResourceChangeEvent#POST_CHANGE} - * -> {@link IResource#FILE} - * -> {@link IResourceDelta#REMOVED} facet settings file - * - *

  • Pre-existing project imported from directory or archive (created and opened)

    - * {@link IResourceChangeEvent#POST_CHANGE} - * -> {@link IResource#FILE} - * -> {@link IResourceDelta#ADDED} facet settings file - *

  • Project renamed

    - * {@link IResourceChangeEvent#POST_CHANGE} - * -> {@link IResource#FILE} - * -> {@link IResourceDelta#REMOVED} facet settings file of old project - * -> {@link IResourceDelta#ADDED} facet settings file of new project - *

  • Project deleted

    - * {@link IResourceChangeEvent#POST_CHANGE} - * -> {@link IResource#FILE} - * -> {@link IResourceDelta#REMOVED} facet settings file - * - *

  • Project facet installed by editing the facets settings file directly

    - * {@link IResourceChangeEvent#POST_CHANGE} - * -> {@link IResource#FILE} - * -> {@link IResourceDelta#CHANGED} facet settings file - *

  • Project facet uninstalled by editing the facets settings file directly

    - * {@link IResourceChangeEvent#POST_CHANGE} - * -> {@link IResource#FILE} - * -> {@link IResourceDelta#CHANGED} facet settings file - *

- */ -// TODO remove faceted project listener and rely solely on resource change events -// for the faceted project settings file -class GenericJpaProjectManager - extends AbstractModel - implements JpaProjectManager -{ - /** - * All the JPA projects in the workspace. - */ - private final Vector jpaProjects = new Vector(); - - /** - * Synchronize access to the JPA projects. - */ - /* CU private */ final ILock lock = this.getJobManager().newLock(); - - /** - * Determine how Resource and Java change events are - * handled (i.e. synchronously or asynchronously). - */ - private volatile StatefulCommandExecutor eventHandler = new AsynchronousCommandExecutor(JptCommonCoreMessages.DALI_EVENT_HANDLER_THREAD_NAME); - - /** - * Listen for
    - *
  • changes to projects and files - *
  • clean builds - *
- */ - private final IResourceChangeListener resourceChangeListener = new ResourceChangeListener(); - - /** - * The types of resource change events that interest - * {@link #resourceChangeListener}. - */ - private static final int RESOURCE_CHANGE_EVENT_TYPES = - IResourceChangeEvent.POST_CHANGE | - IResourceChangeEvent.POST_BUILD; - - /** - * Listen for changes to this file to determine when the JPA facet is - * added to or removed from a "faceted" project. - */ - private static final String FACETED_PROJECT_FRAMEWORK_SETTINGS_FILE_NAME = FacetedProjectFramework.PLUGIN_ID + ".xml"; //$NON-NLS-1$ - - /** - * Listen for the JPA facet being added to or removed from a "faceted" project. - */ - private final IFacetedProjectListener facetedProjectListener = new FacetedProjectListener(); - - /** - * The types of faceted project events that interest - * {@link #facetedProjectListener}. - */ - private static final IFacetedProjectEvent.Type[] FACETED_PROJECT_EVENT_TYPES = new IFacetedProjectEvent.Type[] { - IFacetedProjectEvent.Type.PRE_UNINSTALL - }; - - /** - * Listen for Java changes (unless the Dali UI is active). - * @see #javaElementChangeListenerIsActive() - */ - private final JavaElementChangeListener javaElementChangeListener = new JavaElementChangeListener(); - - /** - * The types of resource change events that interest - * {@link #javaElementChangeListener}. - */ - private static final int JAVA_CHANGE_EVENT_TYPES = - ElementChangedEvent.POST_CHANGE | - ElementChangedEvent.POST_RECONCILE; - - - // ********** constructor ********** - - /** - * Internal: called by {@link JptJpaCorePlugin Dali plug-in}. - */ - GenericJpaProjectManager() { - super(); - } - - - // ********** plug-in controlled life-cycle ********** - - /** - * Internal: called by {@link JptJpaCorePlugin Dali plug-in}. - */ - void start() { - try { - this.lock.acquire(); - this.start_(); - } finally { - this.lock.release(); - } - } - - private void start_() { - debug("*** JPA project manager START ***"); //$NON-NLS-1$ - try { - this.buildJpaProjects(); - this.eventHandler.start(); - this.getWorkspace().addResourceChangeListener(this.resourceChangeListener, RESOURCE_CHANGE_EVENT_TYPES); - FacetedProjectFramework.addListener(this.facetedProjectListener, FACETED_PROJECT_EVENT_TYPES); - JavaCore.addElementChangedListener(this.javaElementChangeListener, JAVA_CHANGE_EVENT_TYPES); - } catch (RuntimeException ex) { - JptJpaCorePlugin.log(ex); - this.stop_(); - } - } - - /** - * Side-effect: {@link #jpaProjects} populated. - */ - private void buildJpaProjects() { - try { - this.buildJpaProjects_(); - } catch (CoreException ex) { - // if we have a problem, leave the currently built JPA projects in - // place and keep executing (should be OK...) - JptJpaCorePlugin.log(ex); - } - } - - private void buildJpaProjects_() throws CoreException { - this.getWorkspace().getRoot().accept(new ResourceProxyVisitor(), IResource.NONE); - } - - /** - * Internal: called by {@link JptJpaCorePlugin Dali plug-in}. - */ - void stop() throws Exception { - try { - this.lock.acquire(); - this.stop_(); - } finally { - this.lock.release(); - } - } - - private void stop_() { - debug("*** JPA project manager STOP ***"); //$NON-NLS-1$ - JavaCore.removeElementChangedListener(this.javaElementChangeListener); - FacetedProjectFramework.removeListener(this.facetedProjectListener); - this.getWorkspace().removeResourceChangeListener(this.resourceChangeListener); - this.eventHandler.stop(); - this.clearJpaProjects(); - } - - private void clearJpaProjects() { - // clone to prevent concurrent modification exceptions - for (JpaProject jpaProject : this.getJpaProjects_()) { - this.removeJpaProject(jpaProject); - } - } - - - // ********** JpaProjectManager implementation ********** - - public Iterable getJpaProjects() { - try { - this.lock.acquire(); - return this.getJpaProjects_(); - } finally { - this.lock.release(); - } - } - - private Iterable getJpaProjects_() { - return new LiveCloneIterable(this.jpaProjects); - } - - public int getJpaProjectsSize() { - return this.jpaProjects.size(); - } - - public JpaProject getJpaProject(IProject project) { - try { - this.lock.acquire(); - return this.getJpaProject_(project); - } finally { - this.lock.release(); - } - } - - private JpaProject getJpaProject_(IProject project) { - for (JpaProject jpaProject : this.jpaProjects) { - if (jpaProject.getProject().equals(project)) { - return jpaProject; - } - } - return null; - } - - public JpaFile getJpaFile(IFile file) { - JpaProject jpaProject = this.getJpaProject(file.getProject()); - return (jpaProject == null) ? null : jpaProject.getJpaFile(file); - } - - public void rebuildJpaProject(IProject project) { - try { - this.lock.acquire(); - this.rebuildJpaProject_(project); - } finally { - this.lock.release(); - } - } - - /** - * assumption: the JPA project holder exists - */ - private void rebuildJpaProject_(IProject project) { - this.removeJpaProject(this.getJpaProject_(project)); - this.addJpaProject(project); - } - - public boolean javaElementChangeListenerIsActive() { - return this.javaElementChangeListener.isActive(); - } - - public void setJavaElementChangeListenerIsActive(boolean javaElementChangeListenerIsActive) { - this.javaElementChangeListener.setActive(javaElementChangeListenerIsActive); - } - - public IWorkspace getWorkspace() { - return ResourcesPlugin.getWorkspace(); - } - - public IJobManager getJobManager() { - return Job.getJobManager(); - } - - - // ********** adding/removing JPA projects ********** - - /* CU private */ void addJpaProject(IProject project) { - this.addJpaProject(this.buildJpaProject(project)); - } - - private void addJpaProject(JpaProject jpaProject) { - // figure out exactly when JPA projects are added - dumpStackTrace("add: ", jpaProject); //$NON-NLS-1$ - // the JPA project will be null if we have any problems building it... - // (e.g. if we have problems getting the JPA platform) - if (jpaProject != null) { - this.addItemToCollection(jpaProject, this.jpaProjects, JPA_PROJECTS_COLLECTION); - } - } - - /** - * return null if we have any problems... - */ - private JpaProject buildJpaProject(IProject project) { - return this.buildJpaProject(this.buildJpaProjectConfig(project)); - } - - /** - * return null if we have any problems... - */ - private JpaProject buildJpaProject(JpaProject.Config config) { - JpaPlatform jpaPlatform = config.getJpaPlatform(); - if (jpaPlatform == null) { - return null; - } - JpaProject jpaProject = this.buildJpaProject(jpaPlatform, config); - if (jpaProject == null) { - return null; - } - jpaProject.setContextModelSynchronizer(this.buildJobContextModelSynchronizer(jpaProject)); - jpaProject.setUpdateSynchronizer(this.buildJobUpdateSynchronizer(jpaProject)); - return jpaProject; - } - - /** - * return null if we have any problems... - */ - private JpaProject buildJpaProject(JpaPlatform jpaPlatform, JpaProject.Config config) { - try { - return jpaPlatform.getJpaFactory().buildJpaProject(config); - } catch (RuntimeException ex) { - JptJpaCorePlugin.log(ex); - return null; - } - } - - private JpaProject.Config buildJpaProjectConfig(IProject project) { - SimpleJpaProjectConfig config = new SimpleJpaProjectConfig(); - config.setProject(project); - config.setJpaPlatform(JptJpaCorePlugin.getJpaPlatformManager().buildJpaPlatformImplementation(project)); - config.setConnectionProfileName(JptJpaCorePlugin.getConnectionProfileName(project)); - config.setUserOverrideDefaultCatalog(JptJpaCorePlugin.getUserOverrideDefaultCatalog(project)); - config.setUserOverrideDefaultSchema(JptJpaCorePlugin.getUserOverrideDefaultSchema(project)); - config.setDiscoverAnnotatedClasses(JptJpaCorePlugin.discoverAnnotatedClasses(project)); - config.setMetamodelSourceFolderName(JptJpaCorePlugin.getMetamodelSourceFolderName(project)); - return config; - } - - private Synchronizer buildJobContextModelSynchronizer(JpaProject jpaProject) { - return new JobSynchronizer( - this.buildContextModelJobName(jpaProject), - this.buildContextModelJobCommand(jpaProject), - jpaProject.getProject() - ); - } - - private String buildContextModelJobName(JpaProject jpaProject) { - return NLS.bind(JptCoreMessages.CONTEXT_MODEL_SYNC_JOB_NAME, jpaProject.getName()); - } - - private JobCommand buildContextModelJobCommand(final JpaProject jpaProject) { - return new JobCommand() { - public IStatus execute(IProgressMonitor monitor) { - return jpaProject.synchronizeContextModel(monitor); - } - }; - } - - private CallbackSynchronizer buildJobUpdateSynchronizer(JpaProject jpaProject) { - return new CallbackJobSynchronizer( - this.buildUpdateJobName(jpaProject), - this.buildUpdateJobCommand(jpaProject), - jpaProject.getProject() - ); - } - - private String buildUpdateJobName(JpaProject jpaProject) { - return NLS.bind(JptCoreMessages.UPDATE_JOB_NAME, jpaProject.getName()); - } - - private JobCommand buildUpdateJobCommand(final JpaProject jpaProject) { - return new JobCommand() { - public IStatus execute(IProgressMonitor monitor) { - return jpaProject.update(monitor); - } - }; - } - - /* CU private */ void removeJpaProject(JpaProject jpaProject) { - // figure out exactly when JPA projects are removed - dumpStackTrace("remove: ", jpaProject); //$NON-NLS-1$ - this.removeItemFromCollection(jpaProject, this.jpaProjects, JPA_PROJECTS_COLLECTION); - jpaProject.dispose(); - } - - - // ********** Project POST_CHANGE ********** - - /* CU private */ void projectChanged(IResourceDelta delta) { - this.eventHandler.execute(this.buildProjectChangedCommand(delta)); - } - - private Command buildProjectChangedCommand(final IResourceDelta delta) { - return new EventHandlerCommand("Project POST_CHANGE Command") { //$NON-NLS-1$ - @Override - void execute_() { - GenericJpaProjectManager.this.projectChanged_(delta); - } - }; - } - - /** - * Forward the specified resource delta to all our JPA projects; - * they will each determine whether the event is significant. - */ - /* CU private */ void projectChanged_(IResourceDelta delta) { - for (JpaProject jpaProject : this.jpaProjects) { - jpaProject.projectChanged(delta); - } - } - - - // ********** Project POST_BUILD (CLEAN_BUILD) ********** - - /* CU private */ void projectPostCleanBuild(IProject project) { - this.executeAfterEventsHandled(this.buildProjectPostCleanBuildCommand(project)); - } - - private Command buildProjectPostCleanBuildCommand(final IProject project) { - return new EventHandlerCommand("Project POST_BUILD (CLEAN_BUILD) Command") { //$NON-NLS-1$ - @Override - void execute_() { - GenericJpaProjectManager.this.projectPostCleanBuild_(project); - } - }; - } - - /* CU private */ void projectPostCleanBuild_(IProject project) { - JpaProject jpaProject = this.getJpaProject_(project); - if (jpaProject != null) { - this.removeJpaProject(jpaProject); - this.addJpaProject(project); - } - } - - - // ********** File POST_CHANGE ********** - - /** - * The Faceted Project settings file has changed in some fashion, check - * whether the JPA facet has been added to or removed from the specified - * project. - */ - /* CU private */ void checkForJpaFacetTransition(IProject project) { - JpaProject jpaProject = this.getJpaProject_(project); - - if (JpaFacet.isInstalled(project)) { - if (jpaProject == null) { // JPA facet added - this.executeAfterEventsHandled(this.buildAddJpaProjectCommand(project)); - } - } else { - if (jpaProject != null) { // JPA facet removed - this.executeAfterEventsHandled(this.buildRemoveJpaProjectCommand(jpaProject)); - } - } - } - - private Command buildAddJpaProjectCommand(final IProject project) { - return new EventHandlerCommand("Add JPA Project Command") { //$NON-NLS-1$ - @Override - void execute_() { - GenericJpaProjectManager.this.addJpaProject(project); - } - }; - } - - private Command buildRemoveJpaProjectCommand(final JpaProject jpaProject) { - return new EventHandlerCommand("Remove JPA Project Command") { //$NON-NLS-1$ - @Override - void execute_() { - GenericJpaProjectManager.this.removeJpaProject(jpaProject); - } - }; - } - - - // ********** FacetedProject PRE_UNINSTALL ********** - - /* CU private */ void jpaFacetedProjectPreUninstall(IProjectFacetActionEvent event) { - IProject project = event.getProject().getProject(); - this.executeAfterEventsHandled(this.buildJpaFacetedProjectPreUninstallCommand(project)); - } - - private Command buildJpaFacetedProjectPreUninstallCommand(final IProject project) { - return new EventHandlerCommand("Faceted Project PRE_UNINSTALL Command") { //$NON-NLS-1$ - @Override - void execute_() { - GenericJpaProjectManager.this.jpaFacetedProjectPreUninstall_(project); - } - }; - } - - /* CU private */ void jpaFacetedProjectPreUninstall_(IProject project) { - // assume(?) this is the first event to indicate we need to remove the JPA project from the JPA project manager - this.removeJpaProject(this.getJpaProject_(project)); - } - - - // ********** Java element changed ********** - - /* CU private */ void javaElementChanged(ElementChangedEvent event) { - this.eventHandler.execute(this.buildJavaElementChangedCommand(event)); - } - - private Command buildJavaElementChangedCommand(final ElementChangedEvent event) { - return new EventHandlerCommand("Java element changed Command") { //$NON-NLS-1$ - @Override - void execute_() { - GenericJpaProjectManager.this.javaElementChanged_(event); - } - }; - } - - /** - * Forward the Java element changed event to all the JPA projects - * because the event could affect multiple projects. - */ - /* CU private */ void javaElementChanged_(ElementChangedEvent event) { - for (JpaProject jpaProject : this.jpaProjects) { - jpaProject.javaElementChanged(event); - } - } - - - // ********** misc ********** - - @Override - public void toString(StringBuilder sb) { - sb.append(this.jpaProjects); - } - - - // ********** event handler ********** - - /** - * If the event handler is executing asynchronously:
- * Allow all the commands currently on the command executor's queue to execute. - * Once they have executed, suspend the command executor and process the - * specified command (on this thread, not the command - * executor thread). Once the specified command is finished, allow the - * command executor to resume processing its command queue. - *

- * If the event handler is executing synchronously:
- * All the events have already been handled synchronously, so we simply - * execute the specified command [sorta] directly. - */ - private void executeAfterEventsHandled(Command command) { - SynchronizedBoolean flag = new SynchronizedBoolean(false); - this.eventHandler.execute(new PauseCommand(flag)); - try { - flag.waitUntilTrue(); - } catch (InterruptedException ex) { - // ignore - not sure why this thread would be interrupted - } - try { - command.execute(); - } finally { - flag.setFalse(); - } - } - - /** - * If this "pause" command is executing (asynchronously) on a different - * thread than the JPA project manager:

    - *
  1. it will set the flag to true, allowing the JPA project - * manager to resume executing on its own thread - *
  2. then it will suspend its command executor until the JPA project - * manager sets the flag back to false. - *
- * If this "pause" command is executing (synchronously) on the same thread - * as the JPA project manager, it will simply set the flag to - * true and return. - */ - private static class PauseCommand - implements Command - { - private final Thread producerThread; - private final SynchronizedBoolean flag; - - PauseCommand(SynchronizedBoolean flag) { - this(Thread.currentThread(), flag); - } - - PauseCommand(Thread producerThread, SynchronizedBoolean flag) { - super(); - this.producerThread = producerThread; - this.flag = flag; - } - - public void execute() { - this.flag.setTrue(); - if (Thread.currentThread() != this.producerThread) { - try { - this.flag.waitUntilFalse(); - } catch (InterruptedException ex) { - // ignore - the command executor will check for interruptions - } - } - } - } - - /** - * This method is called (via reflection) when the test plug-in is loaded. - * See JptCoreTestsPlugin#start(BundleContext) - */ - @SuppressWarnings("unused") - private void handleEventsSynchronously() { - try { - this.lock.acquire(); - this.handleEventsSynchronously_(); - } finally { - this.lock.release(); - } - } - - private void handleEventsSynchronously_() { - this.eventHandler.stop(); - this.eventHandler = new SimpleCommandExecutor(); - this.eventHandler.start(); - } - - - // ********** resource proxy visitor ********** - - /** - * Visit the workspace resource tree, adding a JPA project to the - * JPA project manager for each open Eclipse project that has a JPA facet. - */ - private class ResourceProxyVisitor - implements IResourceProxyVisitor - { - ResourceProxyVisitor() { - super(); - } - - public boolean visit(IResourceProxy resourceProxy) { - switch (resourceProxy.getType()) { - case IResource.ROOT : - return true; // all projects are in the "root" - case IResource.PROJECT : - this.processProject(resourceProxy); - return false; // no nested projects - case IResource.FOLDER : - return false; // ignore - case IResource.FILE : - return false; // ignore - default : - return false; - } - } - - private void processProject(IResourceProxy resourceProxy) { - if (resourceProxy.isAccessible()) { // the project exists and is open - IProject project = (IProject) resourceProxy.requestResource(); - if (JpaFacet.isInstalled(project)) { - GenericJpaProjectManager.this.addJpaProject(project); - } - } - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - - } - - - // ********** event handler command ********** - - /** - * Command that holds the JPA project manager lock while - * executing. - */ - private abstract class EventHandlerCommand - implements Command - { - private final String name; - - EventHandlerCommand(String name) { - super(); - this.name = name; - } - - public final void execute() { - try { - GenericJpaProjectManager.this.lock.acquire(); - this.execute_(); - } catch (RuntimeException ex) { - JptJpaCorePlugin.log(ex); - } finally { - GenericJpaProjectManager.this.lock.release(); - } - } - - abstract void execute_(); - - @Override - public String toString() { - return this.name; - } - } - - - // ********** resource change listener ********** - - private class ResourceChangeListener - implements IResourceChangeListener - { - ResourceChangeListener() { - super(); - } - - /** - * PRE_UNINSTALL is the only facet event we use for - * removing JPA projects. These are the cases where we listen for resource events. - *

- * Check for:

    - *
  • facet settings file added/removed/changed - * (/.settings/org.eclipse.wst.common.project.facet.core.xml) - *
  • file add/remove - forwarded to the individual JPA projects - *
  • project clean - *
- */ - public void resourceChanged(IResourceChangeEvent event) { - switch (event.getType()) { - case IResourceChangeEvent.POST_CHANGE : - this.processPostChangeEvent(event); - break; - - // workspace or project events - case IResourceChangeEvent.PRE_REFRESH : - break; // ignore - case IResourceChangeEvent.PRE_BUILD : - break; // ignore - case IResourceChangeEvent.POST_BUILD : - this.processPostBuildEvent(event); - break; - - // project-only events - case IResourceChangeEvent.PRE_CLOSE : - break; // ignore - case IResourceChangeEvent.PRE_DELETE : - break; // ignore - default : - break; - } - } - - private void processPostChangeEvent(IResourceChangeEvent event) { - debug("Resource POST_CHANGE"); //$NON-NLS-1$ - this.processPostChangeDelta(event.getDelta()); - } - - private void processPostChangeDelta(IResourceDelta delta) { - IResource resource = delta.getResource(); - switch (resource.getType()) { - case IResource.ROOT : - this.processPostChangeRootDelta(delta); - break; - case IResource.PROJECT : - this.processPostChangeProjectDelta(delta); - break; - case IResource.FOLDER : - this.processPostChangeFolderDelta((IFolder) resource, delta); - break; - case IResource.FILE : - this.processPostChangeFileDelta((IFile) resource, delta); - break; - default : - break; - } - } - - // ***** POST_CHANGE ROOT - private void processPostChangeRootDelta(IResourceDelta delta) { - this.processPostChangeDeltaChildren(delta); - } - - // ***** POST_CHANGE PROJECT - /** - * Process the project first for the Opening project case. - * The JPA project will not be built until the children are processed - * and we see that the facet metadata file is added. - * Otherwise the JPA project would be built and then we would process - * the ADDED deltas for all the files in the project. - */ - private void processPostChangeProjectDelta(IResourceDelta delta) { - GenericJpaProjectManager.this.projectChanged(delta); - this.processPostChangeDeltaChildren(delta); - } - - // ***** POST_CHANGE FOLDER - private void processPostChangeFolderDelta(IFolder folder, IResourceDelta delta) { - if (folder.getName().equals(".settings")) { //$NON-NLS-1$ - this.processPostChangeDeltaChildren(delta); - } - } - - // ***** POST_CHANGE FILE - private void processPostChangeFileDelta(IFile file, IResourceDelta delta) { - if (file.getName().equals(FACETED_PROJECT_FRAMEWORK_SETTINGS_FILE_NAME)) { - this.checkForFacetFileChanges(file, delta); - } - } - - private void checkForFacetFileChanges(IFile file, IResourceDelta delta) { - switch (delta.getKind()) { - case IResourceDelta.ADDED : - case IResourceDelta.REMOVED : - case IResourceDelta.CHANGED : - GenericJpaProjectManager.this.checkForJpaFacetTransition(file.getProject()); - break; - case IResourceDelta.ADDED_PHANTOM : - break; // ignore - case IResourceDelta.REMOVED_PHANTOM : - break; // ignore - default : - break; - } - } - - private void processPostChangeDeltaChildren(IResourceDelta delta) { - for (IResourceDelta child : delta.getAffectedChildren()) { - this.processPostChangeDelta(child); // recurse - } - } - - /** - * A post build event has occurred. - * Check for whether the build was a "clean" build and trigger project update. - */ - // ***** POST_BUILD - private void processPostBuildEvent(IResourceChangeEvent event) { - debug("Resource POST_BUILD: ", event.getResource()); //$NON-NLS-1$ - if (event.getBuildKind() == IncrementalProjectBuilder.CLEAN_BUILD) { - this.processPostCleanBuildDelta(event.getDelta()); - } - } - - private void processPostCleanBuildDelta(IResourceDelta delta) { - IResource resource = delta.getResource(); - switch (resource.getType()) { - case IResource.ROOT : - this.processPostCleanBuildDeltaChildren(delta); - break; - case IResource.PROJECT : - this.processProjectPostCleanBuild((IProject) resource); - break; - case IResource.FOLDER : - break; // ignore - case IResource.FILE : - break; // ignore - default : - break; - } - } - - private void processPostCleanBuildDeltaChildren(IResourceDelta delta) { - for (IResourceDelta child : delta.getAffectedChildren()) { - this.processPostCleanBuildDelta(child); // recurse - } - } - - private void processProjectPostCleanBuild(IProject project) { - debug("\tProject CLEAN: ", project.getName()); //$NON-NLS-1$ - GenericJpaProjectManager.this.projectPostCleanBuild(project); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - - } - - - // ********** faceted project listener ********** - - /** - * Forward the Faceted project change event back to the JPA project manager. - */ - private class FacetedProjectListener - implements IFacetedProjectListener - { - FacetedProjectListener() { - super(); - } - - /** - * Check for:
    - *
  • un-install of JPA facet - *
- */ - public void handleEvent(IFacetedProjectEvent event) { - switch (event.getType()) { - case PRE_UNINSTALL : - this.processPreUninstallEvent((IProjectFacetActionEvent) event); - break; - default : - break; - } - } - - private void processPreUninstallEvent(IProjectFacetActionEvent event) { - debug("Facet PRE_UNINSTALL: ", event.getProjectFacet()); //$NON-NLS-1$ - if (event.getProjectFacet().equals(JpaFacet.FACET)) { - GenericJpaProjectManager.this.jpaFacetedProjectPreUninstall(event); - } - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - - } - - - // ********** Java element change listener ********** - - /** - * Forward the Java element change event back to the JPA project manager. - */ - private class JavaElementChangeListener - implements IElementChangedListener - { - /** - * A flag to activate/deactivate the listener - * so we can ignore Java events whenever Dali is manipulating the Java - * source code via the Dali model. We do this because the 0.5 sec delay - * between the Java source being changed and the corresponding event - * being fired causes us no end of pain. - */ - private volatile boolean active = true; - - JavaElementChangeListener() { - super(); - } - - public void elementChanged(ElementChangedEvent event) { - if (this.active) { - GenericJpaProjectManager.this.javaElementChanged(event); - } - // TODO save unhandled events and process when listener is reactivated? - } - - void setActive(boolean active) { - this.active = active; - } - - boolean isActive() { - return this.active; - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - - } - - - // ********** DEBUG ********** - - // @see JpaProjectManagerTests#testDEBUG() - private static final boolean DEBUG = false; - - /** - * trigger #toString() call and string concatenation only if DEBUG is true - */ - /* CU private */ static void debug(String message, Object object) { - if (DEBUG) { - debug_(message + object); - } - } - - /* CU private */ static void debug(String message) { - if (DEBUG) { - debug_(message); - } - } - - private static void debug_(String message) { - System.out.println(Thread.currentThread().getName() + ": " + message); //$NON-NLS-1$ - } - - /* CU private */ static void dumpStackTrace() { - dumpStackTrace(null); - } - - /* CU private */ static void dumpStackTrace(String message, Object object) { - if (DEBUG) { - dumpStackTrace_(message + object); - } - } - - /* CU private */ static void dumpStackTrace(String message) { - if (DEBUG) { - dumpStackTrace_(message); - } - } - - private static void dumpStackTrace_(String message) { - // lock System.out so the stack elements are printed out contiguously - synchronized (System.out) { - if (message != null) { - debug_(message); - } - StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); - // skip the first 3 elements - those are this method and 2 methods in Thread - for (int i = 3; i < stackTrace.length; i++) { - StackTraceElement element = stackTrace[i]; - if (element.getMethodName().equals("invoke0")) { //$NON-NLS-1$ - break; // skip all elements outside of the JUnit test - } - System.out.println("\t" + element); //$NON-NLS-1$ - } - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationDefinitionProvider.java deleted file mode 100644 index c49f656fec..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationDefinitionProvider.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; - -/** - * Provides annotation definitions for types and attributes. - * {@link JpaAnnotationProvider} - * then uses a collection of these to build annotations. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.2 - */ -public interface JpaAnnotationDefinitionProvider -{ - /** - * Return all annotation definitions which can appear on a type - */ - Iterable getTypeAnnotationDefinitions(); - - /** - * Return all annotation definitions which can appear on a type and are used to determine - * whether and how the type is persisted (how it is "mapped"). - * This should be a subset of {@link #getTypeAnnotationDefinitions()}. - */ - Iterable getTypeMappingAnnotationDefinitions(); - - /** - * Return all annotation definitions which can appear on an attribute - */ - Iterable getAttributeAnnotationDefinitions(); - - /** - * Return all annotation definitions which can appear on a package. - */ - Iterable getPackageAnnotationDefinitions(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationProvider.java deleted file mode 100644 index 4802b5d1e9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaAnnotationProvider.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import java.util.Iterator; -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedPackage; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * This is used to provide type and attribute annotations. - * Also provides list of supported annotation names, check the appropriate list - * before trying to build an annotation with that name. An exception will - * be thrown on an attempt to build an annotation that does not exist. - * - * This interface is not intended to be implemented. Instead implement - * JpaAnnotationDefinitionProvider to extend the list of supported annotation definitions. - * - * @see JpaAnnotationDefinitionProvider - * @version 3.0 - * @since 2.0? - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JpaAnnotationProvider -{ - // ********** type annotations ********** - - /** - * Return the names of the annotations that can appear on a type. - */ - Iterator typeAnnotationNames(); - - /** - * Return the names of the annotations that can appear on a type and are used to - * determine whether and how the type is persisted (how it is "mapped"). - * This should be a subset of {@link #typeAnnotationNames()}. - */ - Iterator typeMappingAnnotationNames(); - - /** - * Build a type annotation with the specified name. - * Throw an IllegalArgumentException if the specified name is unsupported. - * @see #typeAnnotationNames() - */ - Annotation buildTypeAnnotation( - JavaResourcePersistentType parent, Type type, String annotationName); - - /** - * Build a type annotation for the specified JDT annotation. - * Throw an IllegalArgumentException if the specified annotation is unsupported. - * @see #typeAnnotationNames() - */ - Annotation buildTypeAnnotation( - JavaResourcePersistentType parent, IAnnotation jdtAnnotation); - - /** - * Build a null type annotation with the specified name. - * Throw an IllegalArgumentException if the specified annotation is unsupported. - * @see #typeAnnotationNames() - */ - Annotation buildNullTypeAnnotation( - JavaResourcePersistentType parent, String annotationName); - - - // ********** attribute annotations ********** - - /** - * Return the names of the annotations that can appear on an attribute. - */ - Iterator attributeAnnotationNames(); - - /** - * Build an attribute annotation with the specified name. - * Throw an IllegalArgumentException if the specified name is unsupported. - * @see #attributeAnnotationNames() - */ - Annotation buildAttributeAnnotation( - JavaResourcePersistentAttribute parent, Attribute attribute, String annotationName); - - /** - * Build an attribute annotation for the specified JDT annotation. - * Throw an IllegalArgumentException if the specified annotation is unsupported. - * @see #attributeAnnotationNames() - */ - Annotation buildAttributeAnnotation( - JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation); - - /** - * Build a null attribute annotation with the specified name. - * Throw an IllegalArgumentException if the specified annotation is unsupported. - * @see #attributeAnnotationNames() - */ - Annotation buildNullAttributeAnnotation( - JavaResourcePersistentAttribute parent, String annotationName); - - - // ********** package annotations ********** - - /** - * Return the names of the annotations that can appear on a package. - */ - Iterator packageAnnotationNames(); - - /** - * Build an package annotation with the specified name. - * Throw an IllegalArgumentException if the specified name is unsupported. - * @see #packageAnnotationNames() - */ - Annotation buildPackageAnnotation( - JavaResourcePackage parent, AnnotatedPackage pack, String annotationName); - - /** - * Build a package annotation for the specified JDT annotation. - * Throw an IllegalArgumentException if the specified name is unsupported. - * @see #packageAnnotationNames() - */ - Annotation buildPackageAnnotation( - JavaResourcePackage parent, IAnnotation jdtAnnotation); - - /** - * Build a null package annotation with the specified name. - * Throw an IllegalArgumentException if the specified annotation is unsupported. - * @see #packageAnnotationNames() - */ - Annotation buildNullPackageAnnotation( - JavaResourcePackage parent, String annotationName); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaDataSource.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaDataSource.java deleted file mode 100644 index 77a241b96f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaDataSource.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import org.eclipse.jpt.jpa.db.ConnectionProfile; -import org.eclipse.jpt.jpa.db.Database; -import org.eclipse.jpt.jpa.db.DatabaseObject; - -/** - * Interface to the connection profile. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JpaDataSource - extends JpaNode { - - /** - * Return the data source's connection profile name. - * The connection profile is looked up based on this setting. - */ - String getConnectionProfileName(); - - /** - * Set the data source's connection profile name. - * The connection profile is looked up based on this setting. - */ - void setConnectionProfileName(String connectionProfileName); - - /** - * ID string used when connectionProfileName property is changed - * @see org.eclipse.jpt.common.utility.model.Model#addPropertyChangeListener(String, org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener) - */ - String CONNECTION_PROFILE_NAME_PROPERTY = "connectionProfileName"; //$NON-NLS-1$ - - /** - * The connection profile is null if the connection profile name is invalid. - */ - ConnectionProfile getConnectionProfile(); - - /** - * ID string used when connectionProfile property is changed - * @see org.eclipse.jpt.common.utility.model.Model#addPropertyChangeListener(String, org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener) - */ - String CONNECTION_PROFILE_PROPERTY = "connectionProfile"; //$NON-NLS-1$ - - /** - * Return whether the profile is either connected to a live database - * session or working off-line (i.e. it has access to meta-data). - */ - boolean connectionProfileIsActive(); - - /** - * If the connection profile is active, return its database. - */ - Database getDatabase(); - - /** - * Select and return the database object with the specified identifier. - */ - T selectDatabaseObjectForIdentifier(Iterable databaseObjects, String identifier); - - /** - * Dispose the data source. - */ - void dispose(); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFacet.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFacet.java deleted file mode 100644 index 609cb4c1a5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFacet.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -/** - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 3.0 - */ -public final class JpaFacet { - - public static final String ID = "jpt.jpa"; //$NON-NLS-1$ - - public static final IProjectFacet FACET = ProjectFacetsManager.getProjectFacet(ID); - - public static final IProjectFacetVersion VERSION_1_0 = FACET.getVersion("1.0"); //$NON-NLS-1$ - - public static final IProjectFacetVersion VERSION_2_0 = FACET.getVersion("2.0"); //$NON-NLS-1$ - - - public static boolean isInstalled(final IProject project) { - try { - return FacetedProjectFramework.hasProjectFacet(project, ID); - } - catch (CoreException e) { - JptJpaCorePlugin.log(e); - return false; - } - } - - - /** - * Not for instantiation - */ - private JpaFacet() {} -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java deleted file mode 100644 index b4238bb037..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFactory.java +++ /dev/null @@ -1,270 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceModel; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.JpaRootContextNode; -import org.eclipse.jpt.jpa.core.context.MappingFile; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.UniqueConstraint; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaBasicMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaDiscriminatorColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable; -import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedIdMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaEntity; -import org.eclipse.jpt.jpa.core.context.java.JavaEnumeratedConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaGeneratedValue; -import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTable; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaLobConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaManyToOneMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass; -import org.eclipse.jpt.jpa.core.context.java.JavaNamedNativeQuery; -import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery; -import org.eclipse.jpt.jpa.core.context.java.JavaOneToManyMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaOrderable; -import org.eclipse.jpt.jpa.core.context.java.JavaOverrideRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaQuery; -import org.eclipse.jpt.jpa.core.context.java.JavaQueryContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaQueryHint; -import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable; -import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator; -import org.eclipse.jpt.jpa.core.context.java.JavaTable; -import org.eclipse.jpt.jpa.core.context.java.JavaTableGenerator; -import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaTransientMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint; -import org.eclipse.jpt.jpa.core.context.java.JavaVersionMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTable; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverrideRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualUniqueConstraint; -import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; -import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation; -import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; - -/** - * Use a JPA factory to build any core (e.g. {@link JpaProject}) - * model object or any Java (e.g. {@link JavaEntity}), ORM (e.g. - * {@link EntityMappings}), or persistence (e.g. {@link PersistenceUnit}) - * context model objects. - *

- * Assumes a base JPA project context structure - * corresponding to the JPA spec: - *

- *     RootContext
- *      |- persistence.xml
- *          |- persistence unit(s)
- *               |- mapping file(s)  (e.g. orm.xml)
- *               |   |- persistent type mapping(s)  (e.g. Entity)
- *               |       |- persistent attribute mapping(s)  (e.g. Basic)
- *               |- persistent type mapping(s)
- * 
- * ... and associated objects. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaFactory - * - * @version 2.3 - * @since 2.0 - */ -public interface JpaFactory -{ - // ********** Core Model ********** - - /** - * Construct a JpaProject for the specified config, to be - * added to the specified JPA project. Return null if unable to create - * the JPA file (e.g. the content type is unrecognized). - */ - JpaProject buildJpaProject(JpaProject.Config config); - - JpaDataSource buildJpaDataSource(JpaProject jpaProject, String connectionProfileName); - - /** - * Construct a JPA file for the specified JPA project, file, content type, - * and resource model. - */ - JpaFile buildJpaFile(JpaProject jpaProject, IFile file, IContentType contentType, JptResourceModel resourceModel); - - - // ********** Context Nodes ********** - - /** - * Build a (/an updated) root context node to be associated with the given - * JPA project. - * The root context node will be built once, but updated many times. - * @see JpaProject#update(org.eclipse.core.runtime.IProgressMonitor) - */ - JpaRootContextNode buildRootContextNode(JpaProject jpaProject); - - - // ********** XML Context Model ********** - - PersistenceXml buildPersistenceXml(JpaRootContextNode parent, JpaXmlResource resource); - - MappingFile buildMappingFile(MappingFileRef parent, JpaXmlResource resource); - - - // ********** Java Context Model ********** - - JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourcePersistentType jrpt); - - JavaEntity buildJavaEntity(JavaPersistentType parent, EntityAnnotation entityAnnotation); - - JavaMappedSuperclass buildJavaMappedSuperclass(JavaPersistentType parent, MappedSuperclassAnnotation mappedSuperclassAnnotation); - - JavaEmbeddable buildJavaEmbeddable(JavaPersistentType parent, EmbeddableAnnotation embeddableAnnotation); - - JavaTypeMapping buildJavaNullTypeMapping(JavaPersistentType parent); - - JavaPersistentAttribute buildJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa); - - JavaBasicMapping buildJavaBasicMapping(JavaPersistentAttribute parent); - - JavaEmbeddedIdMapping buildJavaEmbeddedIdMapping(JavaPersistentAttribute parent); - - JavaEmbeddedMapping buildJavaEmbeddedMapping(JavaPersistentAttribute parent); - - JavaIdMapping buildJavaIdMapping(JavaPersistentAttribute parent); - - JavaManyToManyMapping buildJavaManyToManyMapping(JavaPersistentAttribute parent); - - JavaManyToOneMapping buildJavaManyToOneMapping(JavaPersistentAttribute parent); - - JavaOneToManyMapping buildJavaOneToManyMapping(JavaPersistentAttribute parent); - - JavaOneToOneMapping buildJavaOneToOneMapping(JavaPersistentAttribute parent); - - JavaTransientMapping buildJavaTransientMapping(JavaPersistentAttribute parent); - - JavaVersionMapping buildJavaVersionMapping(JavaPersistentAttribute parent); - - JavaAttributeMapping buildJavaNullAttributeMapping(JavaPersistentAttribute parent); - - JavaGeneratorContainer buildJavaGeneratorContainer(JavaJpaContextNode parent, JavaGeneratorContainer.Owner owner); - - JavaTable buildJavaTable(JavaEntity parent, Table.Owner owner); - - JavaJoinTable buildJavaJoinTable(JavaJoinTableRelationshipStrategy parent, Table.Owner owner); - - JavaVirtualJoinTable buildJavaVirtualJoinTable(JavaVirtualJoinTableRelationshipStrategy parent, JoinTable overriddenTable); - - JavaColumn buildJavaColumn(JavaJpaContextNode parent, JavaColumn.Owner owner); - - JavaVirtualColumn buildJavaVirtualColumn(JavaJpaContextNode parent, JavaVirtualColumn.Owner owner); - - JavaDiscriminatorColumn buildJavaDiscriminatorColumn(JavaEntity parent, JavaDiscriminatorColumn.Owner owner); - - JavaJoinColumn buildJavaJoinColumn(JavaJpaContextNode parent, JavaJoinColumn.Owner owner, JoinColumnAnnotation joinColumnAnnotation); - - JavaVirtualJoinColumn buildJavaVirtualJoinColumn(JavaJpaContextNode parent, ReadOnlyJoinColumn.Owner owner, JoinColumn joinColumn); - - JavaSecondaryTable buildJavaSecondaryTable(JavaEntity parent, Table.Owner owner, SecondaryTableAnnotation tableAnnotation); - - JavaSequenceGenerator buildJavaSequenceGenerator(JavaJpaContextNode parent, SequenceGeneratorAnnotation sequenceGeneratorAnnotation); - - JavaTableGenerator buildJavaTableGenerator(JavaJpaContextNode parent, TableGeneratorAnnotation tableGeneratorAnnotation); - - JavaGeneratedValue buildJavaGeneratedValue(JavaIdMapping parent, GeneratedValueAnnotation generatedValueAnnotation); - - JavaPrimaryKeyJoinColumn buildJavaPrimaryKeyJoinColumn(JavaJpaContextNode parent, JavaBaseJoinColumn.Owner owner, PrimaryKeyJoinColumnAnnotation pkJoinColumnAnnotation); - - JavaAttributeOverrideContainer buildJavaAttributeOverrideContainer(JavaJpaContextNode parent, JavaAttributeOverrideContainer.Owner owner); - - JavaAttributeOverride buildJavaAttributeOverride(JavaAttributeOverrideContainer parent, AttributeOverrideAnnotation annotation); - - JavaVirtualAttributeOverride buildJavaVirtualAttributeOverride(JavaAttributeOverrideContainer parent, String name); - - JavaAssociationOverrideContainer buildJavaAssociationOverrideContainer(JavaJpaContextNode parent, JavaAssociationOverrideContainer.Owner owner); - - JavaAssociationOverride buildJavaAssociationOverride(JavaAssociationOverrideContainer parent, AssociationOverrideAnnotation annotation); - - JavaVirtualAssociationOverride buildJavaVirtualAssociationOverride(JavaAssociationOverrideContainer parent, String name); - - JavaOverrideRelationship buildJavaOverrideRelationship(JavaAssociationOverride parent); - - JavaVirtualOverrideRelationship buildJavaVirtualOverrideRelationship(JavaVirtualAssociationOverride parent); - - JavaQueryContainer buildJavaQueryContainer(JavaJpaContextNode parent, JavaQueryContainer.Owner owner); - - JavaNamedQuery buildJavaNamedQuery(JavaJpaContextNode parent, NamedQueryAnnotation namedQueryAnnotation); - - JavaNamedNativeQuery buildJavaNamedNativeQuery(JavaJpaContextNode parent, NamedNativeQueryAnnotation namedNativeQueryAnnotation); - - JavaQueryHint buildJavaQueryHint(JavaQuery parent, QueryHintAnnotation queryHintAnnotation); - - JavaUniqueConstraint buildJavaUniqueConstraint(JavaJpaContextNode parent, UniqueConstraint.Owner owner, UniqueConstraintAnnotation constraintAnnotation); - - JavaVirtualUniqueConstraint buildJavaVirtualUniqueConstraint(JavaJpaContextNode parent, UniqueConstraint uniqueConstraint); - - JavaEnumeratedConverter buildJavaEnumeratedConverter(JavaAttributeMapping parent, EnumeratedAnnotation annotation); - - JavaTemporalConverter buildJavaTemporalConverter(JavaAttributeMapping parent, TemporalAnnotation annotation); - - JavaLobConverter buildJavaLobConverter(JavaAttributeMapping parent, LobAnnotation annotation); - - JavaOrderable buildJavaOrderable(JavaAttributeMapping parent); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFile.java deleted file mode 100644 index 848cde5b3a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaFile.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import java.util.Iterator; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceModel; - -/** - * A JPA Project contains JPA files for all files in the project that - * are relevant to the JPA spec. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface JpaFile - extends JpaNode -{ - /** - * Return the JPA file's Eclipse file. - */ - IFile getFile(); - - /** - * Return the JPA file's content type. - */ - IContentType getContentType(); - - /** - * Return the resource model corresponding to the JPA file; typically a JPA - * compilation unit, a JPA XML resource, or a JPA package fragment root (JAR). - */ - JptResourceModel getResourceModel(); - - /** - * Convenience method. Return the resource model corresponding to the JPA - * file if the file's content is a "kind-of" the specified content type; - * otherwise, return null. This is useful when a client has looked up the - * JPA file via a file name [and assumed content type]. - * @see #getResourceModel() - */ - JptResourceModel getResourceModel(IContentType contentType); - - - // ********** root structure nodes ********** - - /** - * Return the JPA file's root structure nodes. - */ - Iterator rootStructureNodes(); - String ROOT_STRUCTURE_NODES_COLLECTION = "rootStructureNodes"; //$NON-NLS-1$ - - /** - * Return the count of the JPA file's root context model objects. - */ - int rootStructureNodesSize(); - - /** - * Add a root structure node. - * There is the potential for multiple root structure nodes - * for a particular key. For example, a Java type can be listed - * both as a {@code } in the persistence.xml file - * and as an {@code } in - * an orm.xml file. In this case, the Jave type in - * the orm.xml file must set - * the root structure node after the Java type in the - * persistence.xml file. - * Last one in during project update wins. - */ - void addRootStructureNode(Object key, JpaStructureNode rootStructureNode); - - /** - * Remove the root structure node for the specified key if its current value - * is the same as the specified node. - * - * @see #addRootStructureNode(Object, JpaStructureNode) - */ - void removeRootStructureNode(Object key, JpaStructureNode rootStructureNode); - - /** - * Return the structure node best corresponding to the location in the file. - */ - JpaStructureNode getStructureNode(int textOffset); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaNode.java deleted file mode 100644 index b1e0e5dfbc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaNode.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.jpt.common.core.IResourcePart; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * JPA-specific protocol. All JPA objects belong to a JPA project, are - * associated with a resource, and have a parent (excepting the JPA project). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface JpaNode - extends Model, IAdaptable, IResourcePart -{ - /** - * Return the JPA project the node belongs to. - */ - JpaProject getJpaProject(); - - /** - * Return the JPA node's parent. The JPA project will not have a parent. - */ - JpaNode getParent(); - - /** - * Some state or child (or grandchild etc.) of the JPA node changed. - * Fire a state change event. Implied by this behavior is that any change - * to any JPA node in a JPA project will trigger the JPA project to fire a - * state change event. - * - * @see Model#addStateChangeListener(org.eclipse.jpt.common.utility.model.listener.StateChangeListener) - * @see org.eclipse.jpt.common.utility.model.event.StateChangeEvent - * @see org.eclipse.jpt.common.utility.model.listener.StateChangeListener - */ - void stateChanged(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java deleted file mode 100644 index d3cec2c329..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatform.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; -import org.eclipse.jpt.jpa.db.ConnectionProfileFactory; - -/** - * This interface is to be implemented by a JPA vendor to provide extensions to - * the core JPA model. The core JPA model will provide functionality for JPA - * spec annotations in Java, persistence.xml and mapping - * (orm.xml) files. - * The org.eclipse.jpt.jpa.core.generic extension supplies - * resource models for those file types. As another vendor option you - * will have to supply those resource models as well or different ones - * as necessary. In the extension point you actually provide a - * {@link JpaPlatformFactory} that will build the JPA platform. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - *

- * See the org.eclipse.jpt.jpa.core.jpaPlatforms extension point. - * @see JpaPlatformFactory - * @see JpaPlatformProvider - * - * @version 3.0 - * @since 2.0 - */ -public interface JpaPlatform -{ - // ********** meta stuff ********** - - /** - * Get the ID for this platform - */ - String getId(); - - /** - * Return the description for this platform - */ - JpaPlatformDescription getDescription(); - - /** - * Get the version object for this platform. - */ - Version getJpaVersion(); - - - // ********** factory ********** - - /** - * Return a factory responsible for creating core (e.g. JpaProject), resource - * (e.g. PersistenceResource), and context (e.g. PersistenceUnit) model - * objects - */ - JpaFactory getJpaFactory(); - - - // ********** JPA files ********** - - /** - * Return a JPA file corresponding to the specified Eclipse file. - * Return null if the file's content is unsupported. - */ - JpaFile buildJpaFile(JpaProject jpaProject, IFile file); - - - // ********** Java annotations ********** - - /** - * Return an annotation provider responsible for determining what Java - * annotations are supported and constructing java resource model objects. - */ - JpaAnnotationProvider getAnnotationProvider(); - - /** - * Return a formatter that can clean up the Java annotations added to source - * code. - */ - AnnotationEditFormatter getAnnotationEditFormatter(); - - - // ********** Java type mappings ********** - - /** - * Return the Java type mapping definitions that will be used to build Java - * type mappings and their corresponding annotations. - */ - Iterable getJavaTypeMappingDefinitions(); - - - // ********** Java attribute mappings ********** - - /** - * Return the Java attribute mapping definitions that will be used to build - * Java attribute mappings and their corresponding annotations. - */ - Iterable getSpecifiedJavaAttributeMappingDefinitions(); - - /** - * Return the Java attribute mapping definitions that will be used to build - * default Java attribute mappings. - */ - Iterable getDefaultJavaAttributeMappingDefinitions(); - - - // ********** resource types and definitions ********** - - /** - * Return true if the resource type is supported. The result of this call is consistent with - * the result of {@link #getResourceDefinition(JptResourceType)} - */ - boolean supportsResourceType(JptResourceType resourceType); - - /** - * Return a {@link ResourceDefinition} to describe the context model for a file of the given - * resource type. - * Throw an {@link IllegalArgumentException} if the resource type is not supported by the platform. - * - * @param resourceType The resource type of a potential resource definition - * @return The resource definition that can be used for such a file - */ - ResourceDefinition getResourceDefinition(JptResourceType resourceType); - - /** - * Return the most recent supported {@link JptResourceType} for the given content type. - * Throw an {@link IllegalArgumentException} if the content type is not supported by the platform. - * - * @param contentType A content type supported by the platform - * @return The most recent resource type supported by the platform - */ - JptResourceType getMostRecentSupportedResourceType(IContentType contentType); - - - // ********** database ********** - - /** - * Return a connection repository that can be used to query the database - * about database metadata. - */ - ConnectionProfileFactory getConnectionProfileFactory(); - - /** - * Return an entity generator database annotation name builder, which is - * used by Entity Generation to determine whether and how the entity generator - * prints the names of various database objects. - */ - EntityGeneratorDatabaseAnnotationNameBuilder getEntityGeneratorDatabaseAnnotationNameBuilder(); - - - // ********** platform variation ********** - - /** - * Return a platform variation that is used to determine differences platforms and/or JPA specification versions - */ - JpaPlatformVariation getJpaVariation(); - - - interface Version { - - /** - * Return the platform's version. - */ - String getVersion(); - - /** - * Return the highest JPA specification version supported by the platform. - * @see JpaFacet#VERSION_1_0 - * @see JpaFacet#VERSION_2_0 - */ - String getJpaVersion(); - - /** - * Return whether the platform is compatible with the specified JPA - * specification version. - * @see JpaFacet#VERSION_1_0 - * @see JpaFacet#VERSION_2_0 - */ - boolean isCompatibleWithJpaVersion(String jpaVersion); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformFactory.java deleted file mode 100644 index c3bb9dd128..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformFactory.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -/** - * This interface is to be implemented by a JPA vendor to build a - * {@link JpaPlatform}. - *

- * See the org.eclipse.jpt.jpa.core.jpaPlatforms extension point. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JpaPlatformFactory { - /** - * Build the JPA platform with the specified ID. - */ - JpaPlatform buildJpaPlatform(String id); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformProvider.java deleted file mode 100644 index a511eda3b7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformProvider.java +++ /dev/null @@ -1,71 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; - -/** - * This interface is to be implemented by a JPA vendor to provide extensions to - * the core JPA model. The core JPA model will provide functionality for JPA - * spec annotations in java, persistence.xml and mapping (orm.xml) files. - * The org.eclipse.jpt.jpa.core.generic extension supplies - * resource models for those file types in GenericJpaPlatformProvider. - * - * This JpaPlatformProvider implementation most likely only returns providers - * that are extensions of other platforms. Then in the GenericJpaPlatform implementation - * you pass in 1 or more JpaPlatformProviders. - * - * See the org.eclipse.jpt.jpa.core.jpaPlatforms extension point - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.2 - */ -public interface JpaPlatformProvider -{ - /** - * Return the most recent resource type for the given content type supported by this platform - */ - JptResourceType getMostRecentSupportedResourceType(IContentType contentType); - - /** - * Return the resource model providers that apply to this platform. - */ - Iterable getResourceModelProviders(); - - /** - * Return the resource definitions supported by this platform. - */ - Iterable getResourceDefinitions(); - - /** - * Return the platform's Java type mapping definitions. - */ - Iterable getJavaTypeMappingDefinitions(); - - /** - * Return the platform's default Java attribute mapping definitions. - */ - Iterable getDefaultJavaAttributeMappingDefinitions(); - - /** - * Return the platform's specified Java attribute mapping definitions. - */ - Iterable getSpecifiedJavaAttributeMappingDefinitions(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformVariation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformVariation.java deleted file mode 100644 index 156628e336..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaPlatformVariation.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -/** - * A JpaPlatform contains a JpaPlatformVariation. This is used for various jpa spec - * items that are either optional or only supported by certain version of the spec. - * Each platform implementation must determine if it supports these things. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface JpaPlatformVariation -{ - /** - * Return whether table-per-concrete-class is a supported - * inheritance strategy in the JPA platform. - * Supported.MAYBE means that it is in the JPA spec, but not portable - * or might not be supported by a particular provider. - * @return - */ - Supported getTablePerConcreteClassInheritanceIsSupported(); - - /** - * This is used to determine if a relationship mapping that uses a join table - * can be overridden with an association override. - */ - boolean isJoinTableOverridable(); - - - public enum Supported { - /** - * fully supported by the platform - */ - YES, - - /** - * not supported by the platform - */ - NO, - - /** - * in the JPA spec, might not supported be supported by a particular provider - */ - MAYBE, - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java deleted file mode 100644 index ba7a6e5c57..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProject.java +++ /dev/null @@ -1,549 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import java.util.Iterator; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jdt.core.ElementChangedEvent; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.synchronizers.CallbackSynchronizer; -import org.eclipse.jpt.common.utility.synchronizers.Synchronizer; -import org.eclipse.jpt.jpa.core.context.JpaRootContextNode; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentTypeCache; -import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.ConnectionProfile; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * A JPA project is associated with an Eclipse project (and its corresponding - * Java project). It holds the resource model that corresponds to the - * various JPA-related resources (the persistence.xml file, its - * mapping files [orm.xml], and the Java source files). It also - * holds the context model that represents - * the JPA metadata, as derived from spec-defined defaults, Java source code - * annotations, and XML descriptors. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public interface JpaProject - extends JpaNode -{ - - // ********** general ********** - - /** - * Return the JPA project's name, which is the same as the associated - * Eclipse project's name. - */ - String getName(); - - /** - * Return the Eclipse project associated with the JPA project. - */ - IProject getProject(); - - /** - * Return the Java project associated with the JPA project. - */ - IJavaProject getJavaProject(); - - /** - * Return the vendor-specific JPA platform that builds the JPA project - * and its contents. - */ - JpaPlatform getJpaPlatform(); - - /** - * Return the root of the JPA project's context model. - */ - JpaRootContextNode getRootContextNode(); - - /** - * The JPA project has been removed from the JPA model. Clean up any - * hooks to external resources etc. - */ - void dispose(); - - - // ********** JPA files ********** - - /** - * ID string used when the JPA project's collection of JPA files changes. - * @see #addCollectionChangeListener(String, org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener) - */ - String JPA_FILES_COLLECTION = "jpaFiles"; //$NON-NLS-1$ - - /** - * Return the JPA project's JPA files. - */ - Iterator jpaFiles(); - - /** - * Return the size of the JPA project's JPA files. - */ - int jpaFilesSize(); - - /** - * Return the JPA file corresponding to the specified file. - * Return null if there is no JPA file associated with the specified file. - */ - JpaFile getJpaFile(IFile file); - - - // ********** external Java resource compilation units ********** - - /** - * ID string used when the JPA project's collection of external Java - * resource compilation units changes. - * @see #addCollectionChangeListener(String, org.eclipse.jpt.common.utility.model.listener.CollectionChangeListener) - */ - String EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION = "externalJavaResourceCompilationUnits"; //$NON-NLS-1$ - - /** - * Return the JPA project's external Java resource compilation units. - */ - Iterator externalJavaResourceCompilationUnits(); - - /** - * Return the size of the JPA project's external Java resource compilation units. - */ - int externalJavaResourceCompilationUnitsSize(); - - - // ********** external Java resource persistent types ********** - - /** - * Return the JPA project's external Java resource persistent type cache. - */ - JavaResourcePersistentTypeCache getExternalJavaResourcePersistentTypeCache(); - - - // ********** XML resources ********** - - /** - * Return the XML resource model corresponding to the file with runtime path - * META-INF/persistence.xml if that file has the persistence content type - * ("org.eclipse.jpt.jpa.core.content.persistence"). - * - * @see JptJpaCorePlugin#DEFAULT_PERSISTENCE_XML_RUNTIME_PATH - * @see JptJpaCorePlugin#PERSISTENCE_XML_CONTENT_TYPE - */ - JpaXmlResource getPersistenceXmlResource(); - - /** - * Return the XML resource model corresponding to the file with the specified - * runtime path if that file has the mapping file content type - * ("org.eclipse.jpt.jpa.core.content.mappingFile") - * - * @see JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE - */ - JpaXmlResource getMappingFileXmlResource(IPath runtimePath); - - /** - * Return the XML resource model corresponding to the file - * META-INF/orm.xml if that file has the mapping file content type. - * - * @see JptJpaCorePlugin#DEFAULT_ORM_XML_RUNTIME_PATH - */ - JpaXmlResource getDefaultOrmXmlResource(); - - - // ********** Java resources ********** - - /** - * Return the names of the JPA project's annotated Java classes - * (ignoring classes in JARs referenced in the persistence.xml). - */ - Iterator annotatedJavaSourceClassNames(); - - /** - * Return only the names of those valid mapped (i.e. annotated with - * @Entity, @Embeddable, etc.) Java resource - * persistent types that are directly part of the JPA project, ignoring - * those in JARs referenced in persistence.xml. - */ - Iterable getMappedJavaSourceClassNames(); - - /** - * Return the Java resource persistent type for the specified type. - * Return null if invalid or absent. - */ - JavaResourcePersistentType getJavaResourcePersistentType(String typeName); - - /** - * Return the Java resource package for the specified package. - * Return null if invalid or absent. - */ - JavaResourcePackage getJavaResourcePackage(String packageName); - - /** - * Return the Java resource packages for the project. - * Return null if invalid or absent. - */ - Iterable getJavaResourcePackages(); - - /** - * Return the Java resource package fragement root for the specified JAR. - * Return null if absent. - */ - JavaResourcePackageFragmentRoot getJavaResourcePackageFragmentRoot(String jarFileName); - - /** - * Return the JPA project's JPA files for jars. - */ - Iterable getJarJpaFiles(); - - - // ********** external events ********** - - /** - * Synchronize the JPA project with the specified project resource - * delta, watching for added and removed files in particular. - */ - void projectChanged(IResourceDelta delta); - - /** - * Synchronize the JPA project with the specified Java change. - */ - void javaElementChanged(ElementChangedEvent event); - - - // ********** synchronize context model with resource model ********** - - /** - * Return the synchronizer that will synchronize the context model with - * the resource model whenever the resource model changes. - */ - Synchronizer getContextModelSynchronizer(); - - /** - * Set the synchronizer that will keep the context model synchronized with - * the resource model whenever the resource model changes. - * Before setting the synchronizer, clients should save the current - * synchronizer so it can be restored later. - * - * @see #getContextModelSynchronizer() - */ - void setContextModelSynchronizer(Synchronizer synchronizer); - - /** - * The JPA project's resource model has changed; synchronize the JPA - * project's context model with it. This method is typically called when the - * resource model state has changed when it is synchronized with its - * underlying Eclipse resource as the result of an Eclipse resource change - * event. This method can also be called when a client (e.g. a JUnit test - * case) has manipulated the resource model via its API (as opposed to - * modifying the underlying Eclipse resource directly) and needs the context - * model to be synchronized accordingly (since manipulating the resource - * model via its API will not trigger this method). Whether the context - * model is synchronously (or asynchronously) depends on the current context - * model synchronizer. - * - * @see #synchronizeContextModelAndWait() - */ - void synchronizeContextModel(); - - /** - * Force the JPA project's context model to synchronize with it resource - * model synchronously. - * - * @see #synchronizeContextModel() - * @see #updateAndWait() - */ - void synchronizeContextModelAndWait(); - - /** - * This is the callback used by the context model synchronizer to perform - * the actual "synchronize". - */ - IStatus synchronizeContextModel(IProgressMonitor monitor); - - - // ********** project "update" ********** - - /** - * Return the synchronizer that will update the context model whenever - * it has any changes. This allows any intra-JPA project dependencies to - * be updated. - */ - CallbackSynchronizer getUpdateSynchronizer(); - - /** - * Set the synchronizer that will update the context model whenever - * it has any changes. This allows any intra-JPA project dependencies to - * be updated. - * Before setting the update synchronizer, clients should save the current - * synchronizer so it can be restored later. - * - * @see #getUpdateSynchronizer() - */ - void setUpdateSynchronizer(CallbackSynchronizer synchronizer); - - /** - * Force the JPA project to "update" synchronously. - * - * @see #synchronizeContextModelAndWait() - */ - void updateAndWait(); - - /** - * This is the callback used by the update synchronizer to perform the - * actual "update". - */ - IStatus update(IProgressMonitor monitor); - - - // ********** utility ********** - - /** - * Return an {@link IFile} that best represents the given runtime location - */ - IFile getPlatformFile(IPath runtimePath); - - - // ********** validation ********** - - /** - * Return JPA project's validation messages. - */ - Iterator validationMessages(IReporter reporter); - - - // ********** database ********** - - /** - * Return the data source the JPA project is mapped to. - */ - JpaDataSource getDataSource(); - - /** - * Return the JPA project's connection. - * The connection profile is null if the JPA project's connection profile - * name does not match the name of a DTP connection profile. - */ - ConnectionProfile getConnectionProfile(); - - /** - * Return the JPA project's default database schema container; - * which is either the JPA project's default catalog or the JPA project's - * database, depending on how the DTP model is implemented. - */ - SchemaContainer getDefaultDbSchemaContainer(); - - /** - * Return the JPA project's default catalog; which is either the user - * override catalog or the database's default catalog. - */ - String getDefaultCatalog(); - - /** - * Return the JPA project's default database catalog. - * @see #getDefaultCatalog() - */ - Catalog getDefaultDbCatalog(); - - /** - * Return the JPA project's default schema; which can be one of the - * following:

    - *
  • the user override schema - *
  • the default catalog's default schema - *
  • the database's default schema (if catalogs are not supported) - *
- */ - String getDefaultSchema(); - - /** - * Return the JPA project's default database schema. - * @see #getDefaultSchema() - * @see #getDefaultDbSchemaContainer() - */ - Schema getDefaultDbSchema(); - - - // ********** user override default catalog ********** - - /** - * ID string used when the JPA project's user override default catalog changes. - * @see #addPropertyChangeListener(String, org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener) - */ - String USER_OVERRIDE_DEFAULT_CATALOG_PROPERTY = "userOverrideDefaultCatalog"; //$NON-NLS-1$ - - /** - * Return the identifier of the catalog to be used as a default - * for the JPA project instead of the one that is associated by default - * with the connection profile. - * @return The catalog identifier. May be null (implying the connection profile - * default catalog should be used). - */ - String getUserOverrideDefaultCatalog(); - - /** - * Set the identifier of the catalog to be used as a default - * for the JPA project instead of the one that is associated by default - * with the connection profile. - * @parameter catalog The catalog identifier. May be null (implying the connection profile - * default catalog should be used). - */ - void setUserOverrideDefaultCatalog(String catalog); - - - // ********** user override default schema ********** - - /** - * ID string used when the JPA project's user override default schema changes. - * @see #addPropertyChangeListener(String, org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener) - */ - String USER_OVERRIDE_DEFAULT_SCHEMA_PROPERTY = "userOverrideDefaultSchema"; //$NON-NLS-1$ - - /** - * Return the identifier of the schema to be used as a default - * for the JPA project instead of the one that is associated by default - * with the connection profile. - * @return The schema identifier. May be null (implying the connection profile - * default schema should be used). - */ - String getUserOverrideDefaultSchema(); - - /** - * Set the identifier of the schema to be used as a default - * for the JPA project instead of the one that is associated by default - * with the connection profile. - * @parameter schema The schema identifier. May be null (implying the connection profile - * default schema should be used). - */ - void setUserOverrideDefaultSchema(String schema); - - - // ********** discover annotated classes ********** - - /** - * ID string used when discoversAnnotatedClasses property is changed. - * @see #addPropertyChangeListener(String, org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener) - */ - String DISCOVERS_ANNOTATED_CLASSES_PROPERTY = "discoversAnnotatedClasses"; //$NON-NLS-1$ - - /** - * Return whether the JPA project will not generate error messages for any - * annotated classes that are not listed in the persistence.xml - * file or one of its mapping files. If this flag is set to - * false, error messages will be generated for all of the - * annotated classes that are not explicitly listed. The JPA project - * always "discovers" annotated classes and allows the user to - * reference them throughout the model; this flag simply controls whether - * the error messages are generated during validation. - *

- * This is a user-specified preference that is probably - * only helpful when deploying to a JavaSE environment. The JPA spec - * says annotated classes are to be discovered automatically in a JavaEE - * environment; while the managed persistence classes must be explicitly - * listed in a JavaSE environment: "A list of all named managed persistence - * classes must be specified in Java SE environments to insure portability". - * This flag allows Dali to behave consistently with the user's JPA - * implementation, which may allow "discovery" in a JavaSE environment - * (e.g. EclipseLink). This setting can also be used when the user wants - * to explicitly list classes, even when the classes are "discovered" - * by the JPA implementation. - */ - boolean discoversAnnotatedClasses(); - - /** - * Set whether the JPA project will not generate error messages for any - * annotated classes that are not listed in the persistence.xml - * file or one of its mapping files. - * @see #discoversAnnotatedClasses() - */ - void setDiscoversAnnotatedClasses(boolean discoversAnnotatedClasses); - - - // ********** modifying shared documents ********** - - /** - * Set a thread-specific implementation of the {@link CommandExecutor} - * interface that will be used to execute a command to modify a shared - * document. If necessary, the command executor can be cleared by - * setting it to null. - * This allows background clients to modify documents that are - * already present in the UI. See implementations of {@link CommandExecutor}. - */ - void setThreadLocalModifySharedDocumentCommandExecutor(CommandExecutor commandExecutor); - - /** - * Return the project-wide implementation of the - * {@link CommandExecutor} interface. - */ - CommandExecutor getModifySharedDocumentCommandExecutor(); - - - // ********** construction config ********** - - /** - * The settings used to construct a JPA project. - */ - interface Config - { - /** - * Return the Eclipse project to be associated with the new JPA project. - */ - IProject getProject(); - - /** - * Return the JPA platform to be associated with the new JPA project. - */ - JpaPlatform getJpaPlatform(); - - /** - * Return the name of the connection profile to be associated - * with the new JPA project. (This connection profile wraps a DTP - * connection profile.) - */ - String getConnectionProfileName(); - - /** - * Return the catalog to use instead of the connection profile's - * default catalog. - * May be null. - */ - String getUserOverrideDefaultCatalog(); - - /** - * Return the name of the schema to use instead of the default schema - * of the connection profile. - * May be null. - */ - String getUserOverrideDefaultSchema(); - - /** - * Return whether the new JPA project is to "discover" annotated - * classes. - */ - boolean discoverAnnotatedClasses(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProjectManager.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProjectManager.java deleted file mode 100644 index 2601919a09..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaProjectManager.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.jpt.common.utility.model.Model; - -/** - * The JPA project manager holds all the JPA projects in the workspace. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface JpaProjectManager - extends Model -{ - /** - * Return the JPA model's JPA projects. - */ - Iterable getJpaProjects(); - public static final String JPA_PROJECTS_COLLECTION = "jpaProjects"; //$NON-NLS-1$ - - /** - * Return the size of the JPA model's list of JPA projects. - */ - int getJpaProjectsSize(); - - /** - * Return the JPA project corresponding to the specified Eclipse project. - * Return null if unable to associate the specified Eclipse - * project with a JPA project. - */ - JpaProject getJpaProject(IProject project); - - /** - * Return the JPA file corresponding to the specified Eclipse file, - * or null if unable to associate the specified file with a - * JPA file. - */ - JpaFile getJpaFile(IFile file); - - /** - * The JPA settings associated with the specified Eclipse project - * have changed in such a way as to require the associated - * JPA project to be completely rebuilt - * (e.g. when the user changes a project's JPA platform). - */ - void rebuildJpaProject(IProject project); - - /** - * Return whether the model's Java change listener is active. - */ - boolean javaElementChangeListenerIsActive(); - - /** - * Set whether the model's Java change listener is active. - */ - void setJavaElementChangeListenerIsActive(boolean javaElementChangeListenerIsActive); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaResourceModelProvider.java deleted file mode 100644 index 0b434b8c6d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaResourceModelProvider.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceModel; - -/** - * Map a content type to a JPA resource model. - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JpaResourceModelProvider -{ - /** - * Return the file content type the provider is for. - */ - IContentType getContentType(); - - /** - * Build a JPA resource model for the specified JPA project and file. - * Use the specified factory for creation so extenders can simply override - * the appropriate creation method instead of building a provider for the - * same content. - */ - JptResourceModel buildResourceModel(JpaProject jpaProject, IFile file); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaStructureNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaStructureNode.java deleted file mode 100644 index c94dbd0088..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JpaStructureNode.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.core.utility.TextRange; - - -/** - * Implement this interface for objects that appear in the Structure view - * This is used by JpaSelection to determine selection in the editor. - * Details pages are also provided for each JpaStructureNode. - * - * I did not implement JpaContextNode and I'm not even sure we should implement - * JpaNode. It is possibly someone could want a structure node that is - * not actually a contextNode in the model.//TODO - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JpaStructureNode - extends JpaNode -{ - /** - * Return the structure node at the given offset. - */ - JpaStructureNode getStructureNode(int textOffset); - - /** - * Return the text range to be used to select text in the editor - * corresponding to this node. - */ - TextRange getSelectionTextRange(); - - /** - * Return a unique identifier for all of this class of structure nodes - */ - String getId(); - - /** - * Return the content type of the structure node's resource. - * This is used to find the appropriate ui provider for building composites - */ - JptResourceType getResourceType(); - - /** - * Dispose of this structureNode and dispose of child structureNodes. - * Typically this would be used to update the JpaFile rootStructureNodes. - */ - void dispose(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCorePlugin.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCorePlugin.java deleted file mode 100644 index 36c3dbf976..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/JptJpaCorePlugin.java +++ /dev/null @@ -1,774 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import javax.xml.parsers.SAXParserFactory; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ProjectScope; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.Plugin; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.core.runtime.jobs.Job; -import org.eclipse.core.runtime.preferences.DefaultScope; -import org.eclipse.core.runtime.preferences.IEclipsePreferences; -import org.eclipse.core.runtime.preferences.IScopeContext; -import org.eclipse.core.runtime.preferences.InstanceScope; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.internal.JptCoreMessages; -import org.eclipse.jpt.jpa.core.internal.platform.JpaPlatformManagerImpl; -import org.eclipse.jpt.jpa.core.internal.prefs.JpaPreferenceInitializer; -import org.eclipse.jpt.jpa.core.platform.GenericPlatform; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager; -import org.eclipse.jst.j2ee.internal.J2EEConstants; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.osgi.framework.BundleContext; -import org.osgi.service.prefs.BackingStoreException; -import org.osgi.service.prefs.Preferences; -import org.osgi.util.tracker.ServiceTracker; - -/** - * The Dali core plug-in lifecycle implementation. - * A number of globally-available constants and methods. - *

- * Provisional API: This class is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public class JptJpaCorePlugin - extends Plugin -{ - private volatile GenericJpaProjectManager jpaProjectManager; - private volatile ServiceTracker parserTracker; - private static volatile boolean flushPreferences = true; - - - // ********** public constants ********** - - /** - * The plug-in identifier of the persistence support - * (value "org.eclipse.jpt.jpa.core"). - */ - public static final String PLUGIN_ID = "org.eclipse.jpt.jpa.core"; //$NON-NLS-1$ - public static final String PLUGIN_ID_ = PLUGIN_ID + '.'; - - /** - * The key for storing a JPA project's platform ID in the Eclipse - * project's preferences. - */ - private static final String JPA_PLATFORM_PREF_KEY = PLUGIN_ID_ + "platform"; //$NON-NLS-1$ - - /** - * The old key for storing the default JPA platform ID in the workspace preferences. - * @deprecated As of version 2.3. Instead use {@link #DEFAULT_JPA_PLATFORM_1_0_PREF_KEY} or - * {@link #DEFAULT_JPA_PLATFORM_2_0_PREF_KEY} - */ - @Deprecated - public static final String DEFAULT_JPA_PLATFORM_PREF_KEY = "defaultJpaPlatform"; //$NON-NLS-1$ - - /** - * The key for storing the default JPA platform ID for JPA 1.0 in the workspace preferences. - */ - public static final String DEFAULT_JPA_PLATFORM_1_0_PREF_KEY = - DEFAULT_JPA_PLATFORM_PREF_KEY + "_" + JpaFacet.VERSION_1_0.getVersionString(); //$NON-NLS-1$ - - /** - * The key for storing the default JPA platform ID for JPA 2.0 in the workspace preferences. - */ - public static final String DEFAULT_JPA_PLATFORM_2_0_PREF_KEY = - DEFAULT_JPA_PLATFORM_PREF_KEY + "_" + JpaFacet.VERSION_2_0.getVersionString(); //$NON-NLS-1$ - - /** - * The key for storing a JPA project's "discover" flag in the Eclipse - * project's preferences. - */ - public static final String DISCOVER_ANNOTATED_CLASSES = PLUGIN_ID_ + "discoverAnnotatedClasses"; //$NON-NLS-1$ - - /** - * The key for storing the name of a JPA project's metamodel source folder - * in the Eclipse project's preferences. - */ - public static final String METAMODEL_SOURCE_FOLDER_NAME = PLUGIN_ID_ + "metamodelSourceFolderName"; //$NON-NLS-1$ - - /** - * The key for storing a JPA project's data source connection profile name - * in the Eclipse project's persistent properties. - */ - public static final QualifiedName DATA_SOURCE_CONNECTION_PROFILE_NAME = - new QualifiedName(PLUGIN_ID, "dataSource.connectionProfileName"); //$NON-NLS-1$ - - /** - * The key for storing a JPA project's user overridden default catalog name - * in the Eclipse project's persistent properties. - */ - public static final QualifiedName USER_OVERRIDE_DEFAULT_CATALOG = - new QualifiedName(PLUGIN_ID, "userOverrideDefaultCatalogName"); //$NON-NLS-1$ - - /** - * The key for storing a JPA project's user overridden default schema name - * in the Eclipse project's persistent properties. - */ - public static final QualifiedName USER_OVERRIDE_DEFAULT_SCHEMA = - new QualifiedName(PLUGIN_ID, "userOverrideDefaultSchemaName"); //$NON-NLS-1$ - - - /** - * The identifier for the JPA validation marker - * (value "org.eclipse.jpt.jpa.core.jpaProblemMarker"). - */ - public static final String VALIDATION_MARKER_ID = PLUGIN_ID + ".jpaProblemMarker"; //$NON-NLS-1$ - - /** - * The identifier for the JPA validator - * (value "org.eclipse.jpt.jpa.core.jpaValidator"). - */ - public static final String VALIDATOR_ID = PLUGIN_ID_ + "jpaValidator"; //$NON-NLS-1$ - - /** - * The content type for persistence.xml files. - */ - public static final IContentType PERSISTENCE_XML_CONTENT_TYPE = getJpaContentType("persistence"); //$NON-NLS-1$ - - /** - * The resource type for persistence.xml version 1.0 files - */ - public static final JptResourceType PERSISTENCE_XML_1_0_RESOURCE_TYPE = - new JptResourceType(PERSISTENCE_XML_CONTENT_TYPE, org.eclipse.jpt.jpa.core.resource.persistence.JPA.SCHEMA_VERSION); - - /** - * The resource type for persistence.xml version 2.0 files - */ - public static final JptResourceType PERSISTENCE_XML_2_0_RESOURCE_TYPE = - new JptResourceType(PERSISTENCE_XML_CONTENT_TYPE, org.eclipse.jpt.jpa.core.resource.persistence.v2_0.JPA2_0.SCHEMA_VERSION); - - /** - * The base content type for all mapping files. - */ - public static final IContentType MAPPING_FILE_CONTENT_TYPE = getJpaContentType("mappingFile"); //$NON-NLS-1$ - - /** - * The content type for orm.xml mapping files. - */ - public static final IContentType ORM_XML_CONTENT_TYPE = getJpaContentType("orm"); //$NON-NLS-1$ - - /** - * The resource type for orm.xml version 1.0 mapping files - */ - public static final JptResourceType ORM_XML_1_0_RESOURCE_TYPE = - new JptResourceType(ORM_XML_CONTENT_TYPE, org.eclipse.jpt.jpa.core.resource.orm.JPA.SCHEMA_VERSION); - - /** - * The resource type for orm.xml version 2.0 mapping files - */ - public static final JptResourceType ORM_XML_2_0_RESOURCE_TYPE = - new JptResourceType(ORM_XML_CONTENT_TYPE, org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0.SCHEMA_VERSION); - - /** - * Web projects have some special exceptions. - */ - public static final IProjectFacet WEB_FACET - = ProjectFacetsManager.getProjectFacet(IModuleConstants.JST_WEB_MODULE); - - public static final IPath DEFAULT_PERSISTENCE_XML_RUNTIME_PATH = new Path("META-INF/persistence.xml"); //$NON-NLS-1$ - - public static final IPath DEFAULT_ORM_XML_RUNTIME_PATH = new Path("META-INF/orm.xml"); //$NON-NLS-1$ - - private static IContentType getJpaContentType(String jpaContentType) { - return getContentType(CONTENT_PREFIX_ + jpaContentType); - } - - public static final String CONTENT_PREFIX = PLUGIN_ID_ + "content"; //$NON-NLS-1$ - - public static final String CONTENT_PREFIX_ = CONTENT_PREFIX + '.'; - - private static IContentType getContentType(String contentType) { - return Platform.getContentTypeManager().getContentType(contentType); - } - - - // ********** singleton ********** - - private static JptJpaCorePlugin INSTANCE; - - /** - * Return the singleton Dali core plug-in. - */ - public static JptJpaCorePlugin instance() { - return INSTANCE; - } - - - // ********** public static methods ********** - - /** - * Return the singular JPA project manager corresponding - * to the current workspace. - */ - public static JpaProjectManager getJpaProjectManager() { - return INSTANCE.getJpaProjectManager_(); - } - - /** - * Return the JPA project corresponding to the specified Eclipse project, - * or null if unable to associate the specified project with a - * JPA project. - */ - public static JpaProject getJpaProject(IProject project) { - return getJpaProjectManager().getJpaProject(project); - } - - /** - * Return the JPA file corresponding to the specified Eclipse file, - * or null if unable to associate the specified file with a JPA file. - */ - public static JpaFile getJpaFile(IFile file) { - return getJpaProjectManager().getJpaFile(file); - } - - /** - * The JPA settings associated with the specified Eclipse project - * have changed in such a way as to require the associated - * JPA project to be completely rebuilt - * (e.g. when the user changes a project's JPA platform). - */ - public static void rebuildJpaProject(IProject project) { - getJpaProjectManager().rebuildJpaProject(project); - } - - /** - * Return whether the specified Eclipse project has a Web facet. - */ - public static boolean projectHasWebFacet(IProject project) { - return projectHasFacet(project, WEB_FACET); - } - - /** - * Checked exceptions bite. - */ - private static boolean projectHasFacet(IProject project, IProjectFacet facet) { - try { - return FacetedProjectFramework.hasProjectFacet(project, facet.getId()); - } catch (CoreException ex) { - log(ex); // problems reading the project metadata - assume facet doesn't exist - return 'false' - return false; - } - } - - public static JpaFile getJpaFile(IProject project, IPath runtimePath) { - IFile xmlFile = JptCommonCorePlugin.getPlatformFile(project, runtimePath); - return xmlFile.exists() ? getJpaFile(xmlFile) : null; - } - - /** - * Return the runtime path to which JARs are relatively specified for - * the given project. - * (Web projects have a different runtime structure than non-web projects.) - */ - public static IPath getJarRuntimeRootPath(IProject project) { - return projectHasWebFacet(project) ? - new Path("/" + J2EEConstants.WEB_INF) //$NON-NLS-1$ - : new Path("/"); //$NON-NLS-1$ - } - - public static void initializeDefaultPreferences() { - IEclipsePreferences node = getDefaultPreferences(); - - // default JPA platforms - JpaPlatformDescription defaultPlatform_1_0 = - JpaPlatformManagerImpl.instance().getDefaultJpaPlatform(JpaFacet.VERSION_1_0); - if (defaultPlatform_1_0 == null) { - defaultPlatform_1_0 = GenericPlatform.VERSION_1_0; - } - node.put(DEFAULT_JPA_PLATFORM_1_0_PREF_KEY, defaultPlatform_1_0.getId()); - - JpaPlatformDescription defaultPlatform_2_0 = - JpaPlatformManagerImpl.instance().getDefaultJpaPlatform(JpaFacet.VERSION_2_0); - if (defaultPlatform_2_0 == null) { - defaultPlatform_2_0 = GenericPlatform.VERSION_2_0; - } - node.put(DEFAULT_JPA_PLATFORM_2_0_PREF_KEY, defaultPlatform_2_0.getId()); - } - - /** - * Return the default Dali preferences - * @see JpaPreferenceInitializer - */ - public static IEclipsePreferences getDefaultPreferences() { - return getPreferences(new DefaultScope()); - } - - /** - * Return the Dali preferences for the current workspace instance. - */ - public static IEclipsePreferences getWorkspacePreferences() { - return getPreferences(new InstanceScope()); - } - - /** - * Set the workspace preference. - */ - public static void setWorkspacePreference(String preferenceKey, String preferenceValue) { - IEclipsePreferences prefs = getWorkspacePreferences(); - prefs.put(preferenceKey, preferenceValue); - flush(prefs); - } - - /** - * Return the Dali preferences for the specified Eclipse project. - */ - public static IEclipsePreferences getProjectPreferences(IProject project) { - return getPreferences(new ProjectScope(project)); - } - - /** - * Set the project preference - */ - public static void setProjectPreference(IProject project, String preferenceKey, String preferenceValue) { - IEclipsePreferences prefs = getProjectPreferences(project); - if (preferenceValue == null) { - prefs.remove(preferenceKey); - } - else { - prefs.put(preferenceKey, preferenceValue); - } - flush(prefs); - } - - /** - * Set the project preference - */ - public static void setProjectPreference(IProject project, String preferenceKey, boolean preferenceValue) { - IEclipsePreferences prefs = getProjectPreferences(project); - prefs.putBoolean(preferenceKey, preferenceValue); - flush(prefs); - } - - /** - * Clears the project of JPA-specific preferences - */ - public static void clearProjectPreferences(IProject project) { - clearProjectPreferences( - project, - JPA_PLATFORM_PREF_KEY, DISCOVER_ANNOTATED_CLASSES, METAMODEL_SOURCE_FOLDER_NAME); - } - - /** - * Clears the specified preferences - */ - public static void clearProjectPreferences(IProject project, String ... preferenceKeys) { - IEclipsePreferences prefs = getProjectPreferences(project); - for (String preferenceKey : preferenceKeys) { - prefs.remove(preferenceKey); - } - flush(prefs); - } - - /** - * Return the Dali preferences for the specified context. - */ - private static IEclipsePreferences getPreferences(IScopeContext context) { - return context.getNode(PLUGIN_ID); - } - - /** - * Return the default {@link JpaPlatformDescription} for new JPA projects with the given JPA facet version. - */ - public static JpaPlatformDescription getDefaultJpaPlatform(IProjectFacetVersion jpaFacetVersion) { - JpaPlatformDescription defaultPlatform = - getDefaultJpaPlatform(jpaFacetVersion, getWorkspacePreferences(), getDefaultPreferences()); - if (defaultPlatform == null) { - // if the platform ID stored in the workspace prefs is invalid (i.e. null), look in the default prefs - defaultPlatform = getDefaultJpaPlatform(jpaFacetVersion, getDefaultPreferences()); - } - return defaultPlatform; - } - - private static JpaPlatformDescription getDefaultJpaPlatform(IProjectFacetVersion jpaFacetVersion, Preferences ... nodes) { - JpaPlatformDescription defaultDefaultPlatform = - getDefaultJpaPlatform(jpaFacetVersion, DEFAULT_JPA_PLATFORM_PREF_KEY, null, nodes); - String preferenceKey = null; - if (jpaFacetVersion.equals(JpaFacet.VERSION_1_0)) { - if (defaultDefaultPlatform == null) { - defaultDefaultPlatform = GenericPlatform.VERSION_1_0; - } - preferenceKey = DEFAULT_JPA_PLATFORM_1_0_PREF_KEY; - } - else if (jpaFacetVersion.equals(JpaFacet.VERSION_2_0)) { - if (defaultDefaultPlatform == null) { - defaultDefaultPlatform = GenericPlatform.VERSION_2_0; - } - preferenceKey = DEFAULT_JPA_PLATFORM_2_0_PREF_KEY; - } - else { - throw new IllegalArgumentException("Illegal JPA facet version: " + jpaFacetVersion); //$NON-NLS-1$ - } - return getDefaultJpaPlatform(jpaFacetVersion, preferenceKey, defaultDefaultPlatform, nodes); - } - - private static JpaPlatformDescription getDefaultJpaPlatform( - IProjectFacetVersion jpaFacetVersion, String preferenceKey, JpaPlatformDescription defaultDefault, Preferences ... nodes) { - - String defaultDefaultId = (defaultDefault == null) ? null : defaultDefault.getId(); - String defaultPlatformId = Platform.getPreferencesService().get(preferenceKey, defaultDefaultId, nodes); - JpaPlatformDescription defaultPlatform = getJpaPlatformManager().getJpaPlatform(defaultPlatformId); - if (defaultPlatform != null && defaultPlatform.supportsJpaFacetVersion(jpaFacetVersion)) { - return defaultPlatform; - } - else if (defaultDefault != null && defaultDefault.supportsJpaFacetVersion(jpaFacetVersion)) { - return defaultDefault; - } - return null; - } - - public static JpaPlatformManager getJpaPlatformManager() { - return JpaPlatformManagerImpl.instance(); - } - - /** - * Set the default JPA platform ID for creating new JPA projects - */ - public static void setDefaultJpaPlatformId(String jpaFacetVersion, String platformId) { - String preferenceKey = null; - if (JpaFacet.VERSION_1_0.getVersionString().equals(jpaFacetVersion)) { - preferenceKey = DEFAULT_JPA_PLATFORM_1_0_PREF_KEY; - } - else if (JpaFacet.VERSION_2_0.getVersionString().equals(jpaFacetVersion)) { - preferenceKey = DEFAULT_JPA_PLATFORM_2_0_PREF_KEY; - } - else { - throw new IllegalArgumentException("Illegal JPA facet version: " + jpaFacetVersion); //$NON-NLS-1$ - } - setWorkspacePreference(preferenceKey, platformId); - } - - /** - * Return the JPA platform ID associated with the specified Eclipse project. - */ - public static String getJpaPlatformId(IProject project) { - return getProjectPreferences(project).get(JPA_PLATFORM_PREF_KEY, GenericPlatform.VERSION_1_0.getId()); - } - - /** - * Return the JPA platform description associated with the specified Eclipse project. - */ - public static JpaPlatformDescription getJpaPlatformDescription(IProject project) { - String jpaPlatformId = getJpaPlatformId(project); - return getJpaPlatformManager().getJpaPlatform(jpaPlatformId); - } - - /** - * Set the JPA platform ID associated with the specified Eclipse project. - */ - public static void setJpaPlatformId(IProject project, String jpaPlatformId) { - setProjectPreference(project, JPA_PLATFORM_PREF_KEY, jpaPlatformId); - } - - /** - * Return the preferences key used to look up an Eclipse project's - * JPA platform ID. - */ - public static String getJpaPlatformIdPrefKey() { - return JPA_PLATFORM_PREF_KEY; - } - - /** - * Return the JPA "discover" flag associated with the specified - * Eclipse project. - */ - public static boolean discoverAnnotatedClasses(IProject project) { - return getProjectPreferences(project).getBoolean(DISCOVER_ANNOTATED_CLASSES, false); - } - - /** - * Set the JPA "discover" flag associated with the specified - * Eclipse project. - */ - public static void setDiscoverAnnotatedClasses(IProject project, boolean discoverAnnotatedClasses) { - setProjectPreference(project, DISCOVER_ANNOTATED_CLASSES, discoverAnnotatedClasses); - } - - /** - * Return the name of the metamodel source folder associated with the - * specified Eclipse project. - */ - public static String getMetamodelSourceFolderName(IProject project) { - return getProjectPreferences(project).get(METAMODEL_SOURCE_FOLDER_NAME, null); - } - - /** - * Set the name of the metamodel source folder associated with the - * specified Eclipse project. - */ - public static void setMetamodelSourceFolderName(IProject project, String metamodelSourceFolderName) { - setProjectPreference(project, METAMODEL_SOURCE_FOLDER_NAME, metamodelSourceFolderName); - } - - /** - * This method is called (via reflection) when the test plug-in is loaded. - * The preferences end up getting flushed after the test case has deleted - * its project, resulting in resource exceptions in the log, e.g. - *

-	 *     Resource '/JpaProjectManagerTests' is not open.
-	 * 
- * See JptCoreTestsPlugin.start(BundleContext) - */ - @SuppressWarnings("unused") - private static void doNotFlushPreferences() { - flushPreferences = false; - } - - /** - * Flush preferences in an asynchronous Job because the flush request will - * trigger a lock on the project, which can cause us some deadlocks (e.g. - * when deleting the metamodel source folder). - * Note: the flush will also remove the prefs node if it is empty - */ - private static void flush(IEclipsePreferences prefs) { - if (flushPreferences) { - new PreferencesFlushJob(prefs).schedule(); - } - } - - private static class PreferencesFlushJob extends Job { - private final IEclipsePreferences prefs; - PreferencesFlushJob(IEclipsePreferences prefs) { - super(NLS.bind(JptCoreMessages.PREFERENCES_FLUSH_JOB_NAME, prefs.absolutePath())); - this.prefs = prefs; - } - @Override - protected IStatus run(IProgressMonitor monitor) { - try { - this.prefs.flush(); - } catch(BackingStoreException ex) { - log(ex); - } - return Status.OK_STATUS; - } - } - - /** - * Return the name of the connection profile associated with the specified - * Eclipse project. - */ - public static String getConnectionProfileName(IProject project) { - try { - String connectionProfileName = project.getPersistentProperty(DATA_SOURCE_CONNECTION_PROFILE_NAME); - // some old connection profile names were stored as empty strings instead of nulls :-( - // convert them here - return (StringTools.stringIsEmpty(connectionProfileName)) ? null : connectionProfileName; - } catch (CoreException ex) { - log(ex); - return null; - } - } - - /** - * Set the name of the connection profile associated with the specified - * Eclipse project. - */ - public static void setConnectionProfileName(IProject project, String connectionProfileName) { - try { - project.setPersistentProperty(DATA_SOURCE_CONNECTION_PROFILE_NAME, connectionProfileName); - } catch (CoreException ex) { - log(ex); - } - } - - /** - * Return the default catalog (identifier) associated with the specified Eclipse project. - * @see JpaProject#getUserOverrideDefaultCatalog() - */ - public static String getUserOverrideDefaultCatalog(IProject project) { - try { - return project.getPersistentProperty(USER_OVERRIDE_DEFAULT_CATALOG); - } catch (CoreException ex) { - log(ex); - return null; - } - } - - /** - * Set the default catalog (identifier) associated with the specified Eclipse project. - * @see JpaProject#setUserOverrideDefaultCatalog(String) - */ - public static void setUserOverrideDefaultCatalog(IProject project, String defaultCatalog) { - try { - project.setPersistentProperty(USER_OVERRIDE_DEFAULT_CATALOG, defaultCatalog); - } catch (CoreException ex) { - log(ex); - } - } - - /** - * Return the default schema (identifier) associated with the specified Eclipse project. - * @see JpaProject#getUserOverrideDefaultSchema() - */ - public static String getUserOverrideDefaultSchema(IProject project) { - try { - return project.getPersistentProperty(USER_OVERRIDE_DEFAULT_SCHEMA); - } catch (CoreException ex) { - log(ex); - return null; - } - } - - /** - * Set the default schema (identifier) associated with the specified Eclipse project. - * @see JpaProject#setUserOverrideDefaultSchema(String) - */ - public static void setUserOverrideDefaultSchema(IProject project, String defaultSchema) { - try { - project.setPersistentProperty(USER_OVERRIDE_DEFAULT_SCHEMA, defaultSchema); - } catch (CoreException ex) { - log(ex); - } - } - - /** - * Clear the JPA-specific project properties - */ - public static void clearProjectPersistentProperties(IProject project) { - try { - project.setPersistentProperty(DATA_SOURCE_CONNECTION_PROFILE_NAME, null); - project.setPersistentProperty(USER_OVERRIDE_DEFAULT_CATALOG, null); - project.setPersistentProperty(USER_OVERRIDE_DEFAULT_SCHEMA, null); - } - catch (CoreException ce) { - log(ce); - } - } - - public static boolean nodeIsJpa2_0Compatible(JpaNode jpaNode) { - return jpaNode.getJpaProject().getJpaPlatform().getJpaVersion().isCompatibleWithJpaVersion(JpaFacet.VERSION_2_0.getVersionString()); - } - - /** - * Return whether the JPA project manager's Java change listener is active. - */ - public static boolean javaElementChangeListenerIsActive() { - return getJpaProjectManager().javaElementChangeListenerIsActive(); - } - - /** - * Set whether the JPA project manager's Java change listener is active. - */ - public static void setJavaElementChangeListenerIsActive(boolean javaElementChangeListenerIsActive) { - getJpaProjectManager().setJavaElementChangeListenerIsActive(javaElementChangeListenerIsActive); - } - - /** - * Log the specified status. - */ - public static void log(IStatus status) { - INSTANCE.getLog().log(status); - } - - /** - * Log the specified message. - */ - public static void log(String msg) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, msg, null)); - } - - /** - * Log the specified exception or error. - */ - public static void log(Throwable throwable) { - log(new Status(IStatus.ERROR, PLUGIN_ID, IStatus.OK, throwable.getLocalizedMessage(), throwable)); - } - - - // ********** plug-in implementation ********** - - public JptJpaCorePlugin() { - super(); - if (INSTANCE != null) { - throw new IllegalStateException(); - } - // this convention is *wack*... ~bjv - INSTANCE = this; - } - - - @Override - public void start(BundleContext context) throws Exception { - super.start(context); - // nothing yet... - } - - @Override - public void stop(BundleContext context) throws Exception { - try { - if (this.jpaProjectManager != null) { - this.jpaProjectManager.stop(); - this.jpaProjectManager = null; - } - if (this.parserTracker != null) { - this.parserTracker.close(); - this.parserTracker = null; - } - } finally { - super.stop(context); - } - } - - private synchronized GenericJpaProjectManager getJpaProjectManager_() { - if (this.jpaProjectManager == null) { - this.jpaProjectManager = this.buildJpaProjectManager(); - this.jpaProjectManager.start(); - } - return this.jpaProjectManager; - } - - private GenericJpaProjectManager buildJpaProjectManager() { - return new GenericJpaProjectManager(); - } - - public synchronized SAXParserFactory getSAXParserFactory() { - SAXParserFactory factory = this.getParserTracker().getService(); - if (factory != null) { - factory.setNamespaceAware(true); - } - return factory; - } - - private ServiceTracker getParserTracker() { - if (this.parserTracker == null) { - this.parserTracker = this.buildParserTracker(); - this.parserTracker.open(); - } - return this.parserTracker; - } - - private ServiceTracker buildParserTracker() { - return new ServiceTracker(this.getBundle().getBundleContext(), "javax.xml.parsers.SAXParserFactory", null); //$NON-NLS-1$ - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/MappingKeys.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/MappingKeys.java deleted file mode 100644 index 0a556c8cc8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/MappingKeys.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -/** - * - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -@SuppressWarnings("nls") -public interface MappingKeys { - - String ENTITY_TYPE_MAPPING_KEY = "entity"; - String MAPPED_SUPERCLASS_TYPE_MAPPING_KEY = "mappedSuperclass"; - String EMBEDDABLE_TYPE_MAPPING_KEY = "embeddable"; - String NULL_TYPE_MAPPING_KEY = null; - - String BASIC_ATTRIBUTE_MAPPING_KEY = "basic"; - String ID_ATTRIBUTE_MAPPING_KEY = "id"; - String VERSION_ATTRIBUTE_MAPPING_KEY = "version"; - String ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY = "oneToOne"; - String ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY = "oneToMany"; - String MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY = "manyToOne"; - String MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY = "manyToMany"; - String EMBEDDED_ATTRIBUTE_MAPPING_KEY = "embedded"; - String EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY = "embeddedId"; - String TRANSIENT_ATTRIBUTE_MAPPING_KEY = "transient"; - String NULL_ATTRIBUTE_MAPPING_KEY = null; - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/ResourceDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/ResourceDefinition.java deleted file mode 100644 index 7c73fe07f5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/ResourceDefinition.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core; - -import org.eclipse.jpt.common.core.JptResourceType; - -/** - * A JPA platform can support multiple resources. Each will - * have a unique resource type and must be defined with a resource definition. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface ResourceDefinition -{ - /** - * Return the definition's resource type. - */ - JptResourceType getResourceType(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AccessHolder.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AccessHolder.java deleted file mode 100644 index 441e633b01..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AccessHolder.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Common interface that can be used by clients interested only in a type - * or attribute's access setting (e.g. a UI composite). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface AccessHolder - extends ReadOnlyAccessHolder -{ - /** - * Return the specified access type; - */ - AccessType getSpecifiedAccess(); - - /** - * Set the specified access type. - */ - void setSpecifiedAccess(AccessType newSpecifiedAccess); - - /** - * String constant associated with changes to the specified access type - */ - String SPECIFIED_ACCESS_PROPERTY = "specifiedAccess"; //$NON-NLS-1$ - - /** - * Return the default access type, never null - */ - AccessType getDefaultAccess(); - - /** - * String constant associated with changes to the default access type - */ - String DEFAULT_ACCESS_PROPERTY = "defaultAccess"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AccessType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AccessType.java deleted file mode 100644 index 29ea8a482d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AccessType.java +++ /dev/null @@ -1,101 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Context model corresponding to:

    - *
  • the XML resource model - * {@link org.eclipse.jpt.jpa.core.resource.orm.AccessType}, - * which corresponds to the access element in the - * orm.xml file. - *
  • the Java resource model {@link org.eclipse.jpt.jpa.core.resource.java.AccessType} - * which corresponds to the javax.persistence.Access annotation. - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public enum AccessType { - - FIELD( - org.eclipse.jpt.jpa.core.resource.java.AccessType.FIELD, - org.eclipse.jpt.jpa.core.resource.orm.AccessType.FIELD - ), - PROPERTY( - org.eclipse.jpt.jpa.core.resource.java.AccessType.PROPERTY, - org.eclipse.jpt.jpa.core.resource.orm.AccessType.PROPERTY - ); - - - private org.eclipse.jpt.jpa.core.resource.java.AccessType javaAccessType; - private org.eclipse.jpt.jpa.core.resource.orm.AccessType ormAccessType; - - AccessType(org.eclipse.jpt.jpa.core.resource.java.AccessType javaAccessType, org.eclipse.jpt.jpa.core.resource.orm.AccessType ormAccessType) { - if (javaAccessType == null) { - throw new NullPointerException(); - } - if (ormAccessType == null) { - throw new NullPointerException(); - } - this.javaAccessType = javaAccessType; - this.ormAccessType = ormAccessType; - } - - public org.eclipse.jpt.jpa.core.resource.java.AccessType getJavaAccessType() { - return this.javaAccessType; - } - - public org.eclipse.jpt.jpa.core.resource.orm.AccessType getOrmAccessType() { - return this.ormAccessType; - } - - - // ********** static methods ********** - - public static AccessType fromJavaResourceModel(org.eclipse.jpt.jpa.core.resource.java.AccessType javaAccessType) { - return (javaAccessType == null) ? null : fromJavaResourceModel_(javaAccessType); - } - - private static AccessType fromJavaResourceModel_(org.eclipse.jpt.jpa.core.resource.java.AccessType javaAccessType) { - for (AccessType accessType : AccessType.values()) { - if (accessType.getJavaAccessType() == javaAccessType) { - return accessType; - } - } - return null; - } - - public static org.eclipse.jpt.jpa.core.resource.java.AccessType toJavaResourceModel(AccessType accessType) { - return (accessType == null) ? null : accessType.getJavaAccessType(); - } - - public static AccessType fromOrmResourceModel(org.eclipse.jpt.jpa.core.resource.orm.AccessType ormAccessType) { - return (ormAccessType == null) ? null : fromOrmResourceModel_(ormAccessType); - } - - private static AccessType fromOrmResourceModel_(org.eclipse.jpt.jpa.core.resource.orm.AccessType ormAccessType) { - for (AccessType accessType : AccessType.values()) { - if (accessType.getOrmAccessType() == ormAccessType) { - return accessType; - } - } - return null; - } - - public static org.eclipse.jpt.jpa.core.resource.orm.AccessType toOrmResourceModel(AccessType accessType) { - return (accessType == null) ? null : accessType.getOrmAccessType(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverride.java deleted file mode 100644 index 2e34373553..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverride.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Association override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public interface AssociationOverride - extends Override_, ReadOnlyAssociationOverride -{ - VirtualAssociationOverride convertToVirtual(); - - OverrideRelationship getRelationship(); - - void initializeFrom(ReadOnlyAssociationOverride oldOverride); - - void initializeFromVirtual(ReadOnlyAssociationOverride virtualOverride); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverrideContainer.java deleted file mode 100644 index 3155aad2cc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AssociationOverrideContainer.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; - -/** - * Association override container. - * Used by entities, embedded mappings, and element collection mappings. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.3 - */ -public interface AssociationOverrideContainer - extends OverrideContainer -{ - ListIterator overrides(); - ReadOnlyAssociationOverride getOverrideNamed(String name); - ListIterator specifiedOverrides(); - AssociationOverride getSpecifiedOverride(int index); - AssociationOverride getSpecifiedOverrideNamed(String name); - ListIterator virtualOverrides(); - VirtualAssociationOverride convertOverrideToVirtual(Override_ specifiedOverride); - AssociationOverride convertOverrideToSpecified(VirtualOverride virtualOverride); - - /** - * Return the relationship mapping with the given attribute name. - * Return null if it does not exist. This relationship mapping - * will be found in the mapped superclass, not in the owning entity - */ - RelationshipMapping getRelationshipMapping(String attributeName); - - /** - * Return the relationship with the specified attribute name. - */ - Relationship resolveOverriddenRelationship(String attributeName); - - JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver); - - JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver); - - JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver); - - - // ********** owner ********** - - interface Owner - extends OverrideContainer.Owner - { - Relationship resolveOverriddenRelationship(String attributeName); - - JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver); - - JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver); - - JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeMapping.java deleted file mode 100644 index 3422add9a4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeMapping.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.Iterator; - -/** - * JPA attribute mapping. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface AttributeMapping - extends JpaContextNode -{ - /** - * Return the mapping's attribute (typically its parent node in the - * containment hierarchy). - */ - PersistentAttribute getPersistentAttribute(); - - /** - * Return the mapping's name, which corresponds to the name of the - * associated attribute. - */ - String getName(); - - /** - * Return whether the mapping is its attribute's default mapping - * (as opposed to its specified mapping). - */ - boolean isDefault(); - String DEFAULT_PROPERTY = "default"; //$NON-NLS-1$ - - /** - * Return a unique key for the attribute mapping. If this is defined in - * an extension they should be equal. - */ - String getKey(); - - /** - * Return whether the "attribute" mapping can be overridden. - * The mapping must be a {@link ColumnMapping}. - */ - boolean isOverridableAttributeMapping(); - - /** - * Return whether the "association" mapping can be overridden. - * The mapping must be a {@link RelationshipMapping}. - */ - boolean isOverridableAssociationMapping(); - - /** - * Return the mapping for the type that contains the mapping's attribute. - */ - TypeMapping getTypeMapping(); - - /** - * If the mapping is for a primary key column, return the column's name, - * otherwise return null. - */ - String getPrimaryKeyColumnName(); - - /** - * Return whether this mapping is the owning side of a relationship. - * Either this is a unidirectional mapping or it is the owning side of a - * bidirectional relationship. If bidirectional, the owning side is the - * side that does not specify a "mapped by" attribute name. - * The owning side is the side where the join table is to be specified. - * If this returns true the mapping will be a - * {@link RelationshipMapping}. - */ - boolean isRelationshipOwner(); - - /** - * Return whether the specified mapping manages a relationship with the - * mapping. - */ - boolean isOwnedBy(AttributeMapping mapping); - - /** - * Return whether any database metadata specific validation should occur. - * (For instance, if the connection is not active, then it should not.) - */ - boolean validatesAgainstDatabase(); - - /** - * Return the relationship for the specified attribute. - */ - Relationship resolveOverriddenRelationship(String attributeName); - - - // ********** embedded mappings ********** - - /** - * This is used for "mapped by" choices in a relationship mapping. - * Typically this will just be a single element iterator with the mapping's - * name. - *

- * In a JPA 2.0 project, an embedded mapping should return its own name as - * well as the name of its target embeddable's mappings with the embedded - * mapping name prepended, e.g.:

    - *
  • "embedded" - *
  • "embedded.foo" - *
  • "embedded.bar" - *
- */ - Iterator allMappingNames(); - - /** - * This is used to determine the virtual attribute overrides for an - * embedded mapping or entity. Return the names of all the attributes - * that can be overridden. - *

- * In a JPA 2.0 project this will include overridable nested attributes. - * @see #isOverridableAttributeMapping() - */ - Iterator allOverridableAttributeMappingNames(); - - /** - * This is used to determine the virtual association overrides for an - * embedded mapping or entity. Return the names of all the associations - * that can be overridden. - *

- * In a JPA 2.0 project this will include overridable nested associations. - * @see #isOverridableAssociationMapping() - */ - Iterator allOverridableAssociationMappingNames(); - - /** - * Return the mapping itself if its name matches the specified name. - *

- * In JPA 2.0 this name could use dot-notation for nested mappings. - * JPA 2.0 embedded mappings will have to parse this name and return the - * appropriate nested mapping. - */ - AttributeMapping resolveAttributeMapping(String name); - - /** - * Return the column of the overridable attribute mapping (or attribute - * override) with the specified attribute name. - *

- * In JPA 2.0 this name can use dot-notation to designate nested attributes - * in embedded attribute mapping's embeddable type mapping. - */ - Column resolveOverriddenColumn(String attributeName); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverride.java deleted file mode 100644 index e3cf50a22c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverride.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Attribute override. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface AttributeOverride - extends Override_, ReadOnlyAttributeOverride -{ - VirtualAttributeOverride convertToVirtual(); - - Column getColumn(); - - void initializeFrom(ReadOnlyAttributeOverride oldOverride); - - void initializeFromVirtual(ReadOnlyAttributeOverride oldOverride); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverrideContainer.java deleted file mode 100644 index fa4fac7254..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/AttributeOverrideContainer.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - -/** - * Attribute override container. - * Used by entities, embedded mappings, and element collection mappings. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface AttributeOverrideContainer - extends OverrideContainer -{ - ListIterator overrides(); - ReadOnlyAttributeOverride getOverrideNamed(String name); - ListIterator specifiedOverrides(); - AttributeOverride getSpecifiedOverride(int index); - AttributeOverride getSpecifiedOverrideNamed(String name); - ListIterator virtualOverrides(); - VirtualAttributeOverride convertOverrideToVirtual(Override_ specifiedOverride); - AttributeOverride convertOverrideToSpecified(VirtualOverride virtualOverride); - - /** - * Return the column of the mapping or attribute override with the specified - * attribute name. Return null if it does not exist. This - * column mapping/attribute override will be found in the mapped superclass - * (or embeddable), not in the owning entity. - */ - Column resolveOverriddenColumn(String attributeName); - - - // ********** owner ********** - - interface Owner - extends OverrideContainer.Owner - { - Column resolveOverriddenColumn(String attributeName); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseColumn.java deleted file mode 100644 index 1b63c9bd71..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseColumn.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.Iterator; - -/** - * column or join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public interface BaseColumn - extends NamedColumn, ReadOnlyBaseColumn -{ - void setSpecifiedTable(String table); - void setSpecifiedUnique(Boolean unique); - void setSpecifiedNullable(Boolean nullable); - void setSpecifiedInsertable(Boolean insertable); - void setSpecifiedUpdatable(Boolean updatable); - - boolean tableNameIsInvalid(); - - //TODO This is used by ColumnComposite to get a list of possible associated tables, - //but right now that list isn't going to update in the UI except when we repopulate - /** - * Return a list of table names that are valid for this column - */ - Iterator candidateTableNames(); - - - // ********** owner ********** - - /** - * Interface allowing columns to be used in multiple places - * (e.g. basic mappings and attribute overrides). - */ - interface Owner - extends NamedColumn.Owner - // ReadOnlyBaseColumn does not define an Owner - { - /** - * return whether the given table cannot be explicitly specified - * in the column's 'table' element - */ - boolean tableNameIsInvalid(String tableName); - - /** - * Return a list of table names that are valid for this column - */ - Iterator candidateTableNames(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseEmbeddedMapping.java deleted file mode 100644 index 2e6ddedaf7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseEmbeddedMapping.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Behavior common to embedded and embedded ID mappings. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface BaseEmbeddedMapping - extends AttributeMapping -{ - AttributeOverrideContainer getAttributeOverrideContainer(); - - /** - * Return the embeddable the embedded mapping references. - * Return null if there is none. - */ - Embeddable getTargetEmbeddable(); - - /** - * String associated with property change events for the target embeddable - */ - String TARGET_EMBEDDABLE_PROPERTY = "targetEmbeddable"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseJoinColumn.java deleted file mode 100644 index 8cefbf942e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BaseJoinColumn.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import org.eclipse.jpt.jpa.db.Table; - -/** - * Specified - *

    - *
  • join column - *
  • primary key join column - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public interface BaseJoinColumn - extends NamedColumn, ReadOnlyBaseJoinColumn -{ - void setSpecifiedReferencedColumnName(String value); - - /** - * Return the wrapper for the referenced column datasource table - */ - Table getReferencedColumnDbTable(); - - boolean referencedColumnIsResolved(); - - boolean isVirtual(); - - - // ********** owner ********** - - /** - * Interface allowing columns to be used in multiple places - * (e.g. basic mappings and attribute overrides). - */ - interface Owner - extends ReadOnlyBaseJoinColumn.Owner, NamedColumn.Owner - { - /** - * Return the wrapper for the datasource table for the referenced column - */ - Table getReferencedColumnDbTable(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BasicMapping.java deleted file mode 100644 index c23cfb6628..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/BasicMapping.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA basic mapping. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface BasicMapping - extends ColumnMapping, FetchableMapping, OptionalMapping, ConvertibleMapping -{ - FetchType DEFAULT_FETCH_TYPE = FetchType.EAGER; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Cascade.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Cascade.java deleted file mode 100644 index 4edc0d63f8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Cascade.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA cascade (persist, merge, remove, refresh) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface Cascade - extends JpaContextNode -{ - boolean isAll(); - void setAll(boolean value); - String ALL_PROPERTY = "all"; //$NON-NLS-1$ - - boolean isPersist(); - void setPersist(boolean value); - String PERSIST_PROPERTY = "persist"; //$NON-NLS-1$ - - boolean isMerge(); - void setMerge(boolean value); - String MERGE_PROPERTY = "merge"; //$NON-NLS-1$ - - boolean isRemove(); - void setRemove(boolean value); - String REMOVE_PROPERTY = "remove"; //$NON-NLS-1$ - - boolean isRefresh(); - void setRefresh(boolean value); - String REFRESH_PROPERTY = "refresh"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/CollectionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/CollectionMapping.java deleted file mode 100644 index 5b8dc30347..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/CollectionMapping.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.Iterator; - -/** - * JPA collection mapping (e.g. 1:m, m:m, element collection) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface CollectionMapping - extends FetchableMapping -{ - FetchType DEFAULT_FETCH_TYPE = FetchType.LAZY; - - Orderable getOrderable(); - - PersistentType getResolvedTargetType(); - - - // ********** types ********** - - Type getValueType(); - String VALUE_TYPE_PROPERTY = "valueType"; //$NON-NLS-1$ - - Type getKeyType(); - String KEY_TYPE_PROPERTY = "keyType"; //$NON-NLS-1$ - - public enum Type { - BASIC_TYPE, - EMBEDDABLE_TYPE, - ENTITY_TYPE, - NO_TYPE - } - - - // ********** map key ********** - - String getMapKey(); - - String getSpecifiedMapKey(); - void setSpecifiedMapKey(String mapKey); - String SPECIFIED_MAP_KEY_PROPERTY = "specifiedMapKey"; //$NON-NLS-1$ - - boolean isNoMapKey(); - void setNoMapKey(boolean noMapKey); - String NO_MAP_KEY_PROPERTY = "noMapKey"; //$NON-NLS-1$ - - boolean isPkMapKey(); - void setPkMapKey(boolean pkMapKey); - String PK_MAP_KEY_PROPERTY = "pkMapKey"; //$NON-NLS-1$ - - boolean isCustomMapKey(); - void setCustomMapKey(boolean customMapKey); - String CUSTOM_MAP_KEY_PROPERTY = "customMapKey"; //$NON-NLS-1$ - - Iterator candidateMapKeyNames(); - - String getMetamodelFieldMapKeyTypeName(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Column.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Column.java deleted file mode 100644 index 6c1fa9a8be..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Column.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Normal column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface Column - extends BaseColumn, ReadOnlyColumn -{ - void initializeFrom(ReadOnlyColumn oldColumn); - - void initializeFromVirtual(ReadOnlyColumn oldColumn); - - void setSpecifiedLength(Integer length); - - void setSpecifiedPrecision(Integer precision); - - void setSpecifiedScale(Integer scale); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ColumnMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ColumnMapping.java deleted file mode 100644 index 9fa16f69b1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ColumnMapping.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA attribute mapping that has a converter (e.g. basic, ID, version). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface ColumnMapping - extends AttributeMapping, BaseColumn.Owner -{ - Column getColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Converter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Converter.java deleted file mode 100644 index 78be6044f1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Converter.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA attribute mapping converter. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.1 - */ -public interface Converter - extends JpaContextNode -{ - AttributeMapping getParent(); - - /** - * Return the converter's type. - */ - Class getType(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ConvertibleMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ConvertibleMapping.java deleted file mode 100644 index db587e8ce9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ConvertibleMapping.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA attribute mapping that has a converter (e.g. basic, ID, version). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.1 - */ -public interface ConvertibleMapping - extends AttributeMapping -{ - /** - * Return the mapping's converter. Never null. - */ - Converter getConverter(); - String CONVERTER_PROPERTY = "converter"; //$NON-NLS-1$ - - /** - * Set the converter type, adding the appropriate converter to the resource - * model and removing any other converters. Clear all converters if the - * specified type is null. - */ - void setConverter(Class converterType); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DiscriminatorColumn.java deleted file mode 100644 index 6b7d22d13f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DiscriminatorColumn.java +++ /dev/null @@ -1,87 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * discriminator column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface DiscriminatorColumn - extends NamedColumn -{ - String DEFAULT_NAME = "DTYPE"; //$NON-NLS-1$ - - - // ********** discriminator type ********** - - /** - * Return the specified discriminator type if present, - * otherwise return the default discriminator type. - */ - DiscriminatorType getDiscriminatorType(); - DiscriminatorType getSpecifiedDiscriminatorType(); - void setSpecifiedDiscriminatorType(DiscriminatorType newSpecifiedDiscriminatorType); - String SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY = "specifiedDiscriminatorType"; //$NON-NLS-1$ - DiscriminatorType getDefaultDiscriminatorType(); - String DEFAULT_DISCRIMINATOR_TYPE_PROPERTY = "defaultDiscriminatorType"; //$NON-NLS-1$ - DiscriminatorType DEFAULT_DISCRIMINATOR_TYPE = DiscriminatorType.STRING; - - - // ********** length ********** - - /** - * Return the specified length if present, - * otherwise return the default length. - */ - int getLength(); - Integer getSpecifiedLength(); - void setSpecifiedLength(Integer value); - String SPECIFIED_LENGTH_PROPERTY = "specifiedLength"; //$NON-NLS-1$ - int getDefaultLength(); - String DEFAULT_LENGTH_PROPERTY = "defaultLength"; //$NON-NLS-1$ - int DEFAULT_LENGTH = 31; - - - // ********** validation ********** - - /** - * Return whether the column is specified in the resource. - */ - boolean isResourceSpecified(); - - - // ********** owner ********** - - /** - * interface allowing discriminator columns to be used in multiple places - * (but pretty much just entities) - */ - interface Owner - extends NamedColumn.Owner - { - /** - * Return the default discriminator column length - */ - int getDefaultLength(); - - /** - * Return the default discriminator column type - */ - DiscriminatorType getDefaultDiscriminatorType(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DiscriminatorType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DiscriminatorType.java deleted file mode 100644 index ebfd0b93ad..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/DiscriminatorType.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Discriminator Type - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public enum DiscriminatorType { - - STRING( - org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType.STRING, - org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType.STRING - ), - CHAR( - org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType.CHAR, - org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType.CHAR - ), - INTEGER( - org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType.INTEGER, - org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType.INTEGER - ); - - - private org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType javaDiscriminatorType; - private org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType ormDiscriminatorType; - - DiscriminatorType(org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType javaDiscriminatorType, org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType ormDiscriminatorType) { - if (javaDiscriminatorType == null) { - throw new NullPointerException(); - } - if (ormDiscriminatorType == null) { - throw new NullPointerException(); - } - this.javaDiscriminatorType = javaDiscriminatorType; - this.ormDiscriminatorType = ormDiscriminatorType; - } - - public org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType getJavaDiscriminatorType() { - return this.javaDiscriminatorType; - } - - public org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType getOrmDiscriminatorType() { - return this.ormDiscriminatorType; - } - - - // ********** static methods ********** - - public static DiscriminatorType fromJavaResourceModel(org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType javaDiscriminatorType) { - return (javaDiscriminatorType == null) ? null : fromJavaResourceModel_(javaDiscriminatorType); - } - - private static DiscriminatorType fromJavaResourceModel_(org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType javaDiscriminatorType) { - for (DiscriminatorType discriminatorType : DiscriminatorType.values()) { - if (discriminatorType.getJavaDiscriminatorType() == javaDiscriminatorType) { - return discriminatorType; - } - } - return null; - } - - public static org.eclipse.jpt.jpa.core.resource.java.DiscriminatorType toJavaResourceModel(DiscriminatorType discriminatorType) { - return (discriminatorType == null) ? null : discriminatorType.getJavaDiscriminatorType(); - } - - public static DiscriminatorType fromOrmResourceModel(org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType ormDiscriminatorType) { - return (ormDiscriminatorType == null) ? null : fromOrmResourceModel_(ormDiscriminatorType); - } - - private static DiscriminatorType fromOrmResourceModel_(org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType ormDiscriminatorType) { - for (DiscriminatorType discriminatorType : DiscriminatorType.values()) { - if (discriminatorType.getOrmDiscriminatorType() == ormDiscriminatorType) { - return discriminatorType; - } - } - return null; - } - - public static org.eclipse.jpt.jpa.core.resource.orm.DiscriminatorType toOrmResourceModel(DiscriminatorType discriminatorType) { - return (discriminatorType == null) ? null : discriminatorType.getOrmDiscriminatorType(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Embeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Embeddable.java deleted file mode 100644 index 4c06592dd2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Embeddable.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * embeddable type mapping - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public interface Embeddable - extends TypeMapping -{ - // nothing yet -} - diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EmbeddedIdMapping.java deleted file mode 100644 index 6bd03dff15..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EmbeddedIdMapping.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA embedded ID mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public interface EmbeddedIdMapping - extends BaseEmbeddedMapping -{ - // nothing yet -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EmbeddedMapping.java deleted file mode 100644 index 4a9f747c34..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EmbeddedMapping.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA embedded mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public interface EmbeddedMapping - extends BaseEmbeddedMapping -{ - // nothing yet -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java deleted file mode 100644 index ed494b6929..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Entity.java +++ /dev/null @@ -1,292 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - -/** - * entity - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface Entity - extends TypeMapping -{ - // ********** name ********** - - String getSpecifiedName(); - String SPECIFIED_NAME_PROPERTY = "specifiedName"; //$NON-NLS-1$ - void setSpecifiedName(String name); - String getDefaultName(); - String DEFAULT_NAME_PROPERTY = "defaultName"; //$NON-NLS-1$ - - - // ********** id class ********** - - /** - * Return the (aggregate) class reference for configuring and validating id class - */ - IdClassReference getIdClassReference(); - - - // ********** table ********** - - /** - * Return the table for this entity, either specified or default. - * This will not be null. - */ - Table getTable(); - - /** - * Return the name of the entity's primary key column. - * Return null if the entity's primary key is "compound" - * (i.e. the primary key is composed of multiple columns). - */ - String getPrimaryKeyColumnName(); - - /** - * Return the entity's default table name, which depends on the entity's - * inheritance hierarchy. - */ - String getDefaultTableName(); - - /** - * Return the entity's default schema, which depends on the entity's - * inheritance hierarchy. - */ - String getDefaultSchema(); - - /** - * Return the entity's default catalog, which depends on the entity's - * inheritance hierarchy. - */ - String getDefaultCatalog(); - - - // ********** secondary tables ********** - - /** - * Return the secondary tables whether specified or default. - */ - ListIterator secondaryTables(); - - /** - * Return the number of secondary tables, both specified and default. - */ - int secondaryTablesSize(); - - /** - * Return a list iterator of the specified secondary tables. - * This will not be null. - */ - ListIterator specifiedSecondaryTables(); - String SPECIFIED_SECONDARY_TABLES_LIST = "specifiedSecondaryTables"; //$NON-NLS-1$ - - /** - * Return the number of specified secondary tables. - */ - int specifiedSecondaryTablesSize(); - - /** - * Add a specified secondary table to the entity return the object - * representing it. - */ - SecondaryTable addSpecifiedSecondaryTable(); - - /** - * Add a specified secondary table to the entity return the object - * representing it. - */ - SecondaryTable addSpecifiedSecondaryTable(int index); - - /** - * Remove the specified secondary table from the entity. - */ - void removeSpecifiedSecondaryTable(int index); - - /** - * Remove the specified secondary table at the index from the entity. - */ - void removeSpecifiedSecondaryTable(SecondaryTable secondaryTable); - - /** - * Move the specified secondary table from the source index to the target index. - */ - void moveSpecifiedSecondaryTable(int targetIndex, int sourceIndex); - - - // ********** inheritance strategy ********** - - /** - * Return the specified inheritance strategy if present, otherwise return the default - * inheritance strategy. - */ - InheritanceType getInheritanceStrategy(); - InheritanceType getSpecifiedInheritanceStrategy(); - void setSpecifiedInheritanceStrategy(InheritanceType inheritanceType); - String SPECIFIED_INHERITANCE_STRATEGY_PROPERTY = "specifiedInheritanceStrategy"; //$NON-NLS-1$ - InheritanceType getDefaultInheritanceStrategy(); - String DEFAULT_INHERITANCE_STRATEGY_PROPERTY = "defaultInheritanceStrategy"; //$NON-NLS-1$ - - - /** - * The first parent in the class hierarchy that is an entity. - * This is the parent in the entity (persistent) inheritance hierarchy - * (vs class inheritance hierarchy). Return null if there is no parent entity. - */ - Entity getParentEntity(); - - DiscriminatorColumn getDiscriminatorColumn(); - - String getDiscriminatorValue(); - String getSpecifiedDiscriminatorValue(); - void setSpecifiedDiscriminatorValue(String value); - String SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY = "specifiedDiscriminatorValue"; //$NON-NLS-1$ - String getDefaultDiscriminatorValue(); - String DEFAULT_DISCRIMINATOR_VALUE_PROPERTY = "defaultDiscriminatorValue"; //$NON-NLS-1$ - - /** - * Return whether a DiscriminatorValue is allowed for this Entity. - * It is allowed if the entity is not abstract and not part of - * a table-per-class inheritance hierarchy - */ - boolean specifiedDiscriminatorValueIsAllowed(); - String SPECIFIED_DISCRIMINATOR_VALUE_IS_ALLOWED_PROPERTY = "discriminatorValueIsAllowed"; //$NON-NLS-1$ - - /** - * Return whether a DiscriminatorValue is undefined for this Entity. - * It is undefined if the entity is abstract or if it - * is part of a table-per-class inheritance hierarchy - */ - boolean discriminatorValueIsUndefined(); - String DISCRIMINATOR_VALUE_IS_UNDEFINED_PROPERTY = "discriminatorValueIsUndefined"; //$NON-NLS-1$ - - /** - * Return whether a DiscriminatorColumn is allowed for this Entity. - * It is allowed if the entity is the root of the inheritance hierarchy (with descendant entities) - * and the strategy is not table-per-class - */ - boolean specifiedDiscriminatorColumnIsAllowed(); - String SPECIFIED_DISCRIMINATOR_COLUMN_IS_ALLOWED_PROPERTY = "specifiedDiscriminatorColumnIsAllowed"; //$NON-NLS-1$ - - /** - * Return whether a DiscriminatorColumn is undefined for this Entity. - * It is undefined if the inheritance strategy is table-per-class - */ - boolean discriminatorColumnIsUndefined(); - String DISCRIMINATOR_COLUMN_IS_UNDEFINED_PROPERTY = "discriminatorColumnIsUndefined"; //$NON-NLS-1$ - - /** - * Return whether a Table is allowed for this Entity. - * If the inheritance strategy is single-table, Table is allowed only - * on the root entity. - * If the inheritance strategy is table-per-class it is allowed only - * on concrete entities. - */ - boolean specifiedTableIsAllowed(); - String SPECIFIED_TABLE_IS_ALLOWED_PROPERTY = "specifiedTableIsAllowed"; //$NON-NLS-1$ - - /** - * Return whether a Table is undefined for this Entity. - * If the inheritance strategy is table-per-class and the entity is - * abstract, then a Table object is undefined - */ - boolean tableIsUndefined(); - String TABLE_IS_UNDEFINED_PROPERTY = "tableIsUndefined"; //$NON-NLS-1$ - - - // ********** primary key join columns ********** - - ListIterator primaryKeyJoinColumns(); - - int primaryKeyJoinColumnsSize(); - - ListIterator specifiedPrimaryKeyJoinColumns(); - String SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST = "specifiedPrimaryKeyJoinColumns"; //$NON-NLS-1$ - - int specifiedPrimaryKeyJoinColumnsSize(); - - PrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index); - - PrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(); - - void removeSpecifiedPrimaryKeyJoinColumn(int index); - - void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumn); - - void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex); - - - // ********** containers ********** - - AttributeOverrideContainer getAttributeOverrideContainer(); - - AssociationOverrideContainer getAssociationOverrideContainer(); - - QueryContainer getQueryContainer(); - - GeneratorContainer getGeneratorContainer(); - - - // ********** entity inheritance ********** - - /** - * Return whether this entity is a root entity in an inheritance hierarchy. - */ - boolean isRoot(); - - /** - * Return the top of the entity's inheritance hierarchy. - * This method will never return null. The root - * is defined as the persistent type in the inheritance hierarchy - * that has no parent. The root will be an entity. - *

- * Non-entities in the hierarchy should be ignored; i.e. we skip - * over them in the search for the root. - */ - Entity getRootEntity(); - String ROOT_ENTITY_PROPERTY = "rootEntity"; //$NON-NLS-1$ - - /** - * If the entity is a root entity, return the entity's descendant entities; - * if the entity is not a root entity, return an empty collection. - *

- * NB: An entity A is a "descendant" of another root - * entity B if the name of entity A's root entity's type matches - * the name of entity B's type. This means entity A can be a "descendant" - * of multiple root entities (typically both the orm.xml - * and Java root entities for a particular type); despite entity have only - * a single "root" entity (typically the orm.xml root entity). - */ - Iterable getDescendants(); - String DESCENDANTS_COLLECTION = "descendants"; //$NON-NLS-1$ - - - // ********** misc ********** - - /** - * Returns the attribute mapping that matches the name. - * In 2.0 this name could use dot-notation for nested mappings. - */ - AttributeMapping resolveAttributeMapping(String name); - - /** - * If an entity has a single id attribute, return that attribute. - * Else return null. - */ - PersistentAttribute getIdAttribute(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EnumType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EnumType.java deleted file mode 100644 index 4135ca9b2e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EnumType.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Enum Type - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public enum EnumType { - - ORDINAL( - org.eclipse.jpt.jpa.core.resource.java.EnumType.ORDINAL, - org.eclipse.jpt.jpa.core.resource.orm.EnumType.ORDINAL - ), - STRING( - org.eclipse.jpt.jpa.core.resource.java.EnumType.STRING, - org.eclipse.jpt.jpa.core.resource.orm.EnumType.STRING - ); - - - private org.eclipse.jpt.jpa.core.resource.java.EnumType javaEnumType; - private org.eclipse.jpt.jpa.core.resource.orm.EnumType ormEnumType; - - EnumType(org.eclipse.jpt.jpa.core.resource.java.EnumType javaEnumType, org.eclipse.jpt.jpa.core.resource.orm.EnumType ormEnumType) { - if (javaEnumType == null) { - throw new NullPointerException(); - } - if (ormEnumType == null) { - throw new NullPointerException(); - } - this.javaEnumType = javaEnumType; - this.ormEnumType = ormEnumType; - } - - public org.eclipse.jpt.jpa.core.resource.java.EnumType getJavaEnumType() { - return this.javaEnumType; - } - - public org.eclipse.jpt.jpa.core.resource.orm.EnumType getOrmEnumType() { - return this.ormEnumType; - } - - - // ********** static methods ********** - - public static EnumType fromJavaResourceModel(org.eclipse.jpt.jpa.core.resource.java.EnumType javaEnumType) { - return (javaEnumType == null) ? null : fromJavaResourceModel_(javaEnumType); - } - - private static EnumType fromJavaResourceModel_(org.eclipse.jpt.jpa.core.resource.java.EnumType javaEnumType) { - for (EnumType enumType : EnumType.values()) { - if (enumType.getJavaEnumType() == javaEnumType) { - return enumType; - } - } - return null; - } - - public static org.eclipse.jpt.jpa.core.resource.java.EnumType toJavaResourceModel(EnumType enumType) { - return (enumType == null) ? null : enumType.getJavaEnumType(); - } - - public static EnumType fromOrmResourceModel(org.eclipse.jpt.jpa.core.resource.orm.EnumType ormEnumType) { - return (ormEnumType == null) ? null : fromOrmResourceModel_(ormEnumType); - } - - private static EnumType fromOrmResourceModel_(org.eclipse.jpt.jpa.core.resource.orm.EnumType ormEnumType) { - for (EnumType enumType : EnumType.values()) { - if (enumType.getOrmEnumType() == ormEnumType) { - return enumType; - } - } - return null; - } - - public static org.eclipse.jpt.jpa.core.resource.orm.EnumType toOrmResourceModel(EnumType enumType) { - return (enumType == null) ? null : enumType.getOrmEnumType(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EnumeratedConverter.java deleted file mode 100644 index 570f8738ad..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/EnumeratedConverter.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA enumerated converter - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.1 - */ -public interface EnumeratedConverter - extends Converter -{ - EnumType getEnumType(); - - EnumType getSpecifiedEnumType(); - void setSpecifiedEnumType(EnumType enumType); - String SPECIFIED_ENUM_TYPE_PROPERTY = "specifiedEnumType"; //$NON-NLS-1$ - - EnumType getDefaultEnumType(); - String DEFAULT_ENUM_TYPE_PROPERTY = "defaultEnumType"; //$NON-NLS-1$ - EnumType DEFAULT_ENUM_TYPE = EnumType.ORDINAL; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchType.java deleted file mode 100644 index 2ae147cf90..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchType.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Fetch Type - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public enum FetchType { - - EAGER( - org.eclipse.jpt.jpa.core.resource.java.FetchType.EAGER, - org.eclipse.jpt.jpa.core.resource.orm.FetchType.EAGER - ), - LAZY( - org.eclipse.jpt.jpa.core.resource.java.FetchType.LAZY, - org.eclipse.jpt.jpa.core.resource.orm.FetchType.LAZY - ); - - - private org.eclipse.jpt.jpa.core.resource.java.FetchType javaFetchType; - private org.eclipse.jpt.jpa.core.resource.orm.FetchType ormFetchType; - - FetchType(org.eclipse.jpt.jpa.core.resource.java.FetchType javaFetchType, org.eclipse.jpt.jpa.core.resource.orm.FetchType ormFetchType) { - if (javaFetchType == null) { - throw new NullPointerException(); - } - if (ormFetchType == null) { - throw new NullPointerException(); - } - this.javaFetchType = javaFetchType; - this.ormFetchType = ormFetchType; - } - - public org.eclipse.jpt.jpa.core.resource.java.FetchType getJavaFetchType() { - return this.javaFetchType; - } - - public org.eclipse.jpt.jpa.core.resource.orm.FetchType getOrmFetchType() { - return this.ormFetchType; - } - - - // ********** static methods ********** - - public static FetchType fromJavaResourceModel(org.eclipse.jpt.jpa.core.resource.java.FetchType javaFetchType) { - return (javaFetchType == null) ? null : fromJavaResourceModel_(javaFetchType); - } - - private static FetchType fromJavaResourceModel_(org.eclipse.jpt.jpa.core.resource.java.FetchType javaFetchType) { - for (FetchType fetchType : FetchType.values()) { - if (fetchType.getJavaFetchType() == javaFetchType) { - return fetchType; - } - } - return null; - } - - public static org.eclipse.jpt.jpa.core.resource.java.FetchType toJavaResourceModel(FetchType fetchType) { - return (fetchType == null) ? null : fetchType.getJavaFetchType(); - } - - public static FetchType fromOrmResourceModel(org.eclipse.jpt.jpa.core.resource.orm.FetchType ormFetchType) { - return (ormFetchType == null) ? null : fromOrmResourceModel_(ormFetchType); - } - - private static FetchType fromOrmResourceModel_(org.eclipse.jpt.jpa.core.resource.orm.FetchType ormFetchType) { - for (FetchType fetchType : FetchType.values()) { - if (fetchType.getOrmFetchType() == ormFetchType) { - return fetchType; - } - } - return null; - } - - public static org.eclipse.jpt.jpa.core.resource.orm.FetchType toOrmResourceModel(FetchType fetchType) { - return (fetchType == null) ? null : fetchType.getOrmFetchType(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchableMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchableMapping.java deleted file mode 100644 index 31dec5ef31..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/FetchableMapping.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA attribute mapping that has a fetch type (e.g. basic, relationship). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface FetchableMapping - extends AttributeMapping -{ - FetchType getFetch(); - - FetchType getSpecifiedFetch(); - void setSpecifiedFetch(FetchType newSpecifiedFetch); - String SPECIFIED_FETCH_PROPERTY = "specifiedFetch"; //$NON-NLS-1$ - - FetchType getDefaultFetch(); - String DEFAULT_FETCH_PROPERTY = "defaultFetch"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GeneratedValue.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GeneratedValue.java deleted file mode 100644 index 934a08f609..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GeneratedValue.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA generated value - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface GeneratedValue - extends JpaContextNode -{ - GenerationType getStrategy(); - GenerationType getSpecifiedStrategy(); - void setSpecifiedStrategy(GenerationType strategy); - String SPECIFIED_STRATEGY_PROPERTY = "specifiedStrategy"; //$NON-NLS-1$ - GenerationType getDefaultStrategy(); - String DEFAULT_STRATEGY_PROPERTY = "defaultStrategy"; //$NON-NLS-1$ - GenerationType DEFAULT_STRATEGY = GenerationType.AUTO; - - String getGenerator(); - String getSpecifiedGenerator(); - void setSpecifiedGenerator(String generator); - String SPECIFIED_GENERATOR_PROPERTY = "specifiedGenerator"; //$NON-NLS-1$ - String getDefaultGenerator(); - String DEFAULT_GENERATOR_PROPERTY = "defaultGenerator"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GenerationType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GenerationType.java deleted file mode 100644 index 6d87ae32d2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GenerationType.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Generation Type - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public enum GenerationType { - - TABLE( - org.eclipse.jpt.jpa.core.resource.java.GenerationType.TABLE, - org.eclipse.jpt.jpa.core.resource.orm.GenerationType.TABLE - ), - SEQUENCE( - org.eclipse.jpt.jpa.core.resource.java.GenerationType.SEQUENCE, - org.eclipse.jpt.jpa.core.resource.orm.GenerationType.SEQUENCE - ), - IDENTITY( - org.eclipse.jpt.jpa.core.resource.java.GenerationType.IDENTITY, - org.eclipse.jpt.jpa.core.resource.orm.GenerationType.IDENTITY - ), - AUTO( - org.eclipse.jpt.jpa.core.resource.java.GenerationType.AUTO, - org.eclipse.jpt.jpa.core.resource.orm.GenerationType.AUTO - ); - - - private org.eclipse.jpt.jpa.core.resource.java.GenerationType javaGenerationType; - private org.eclipse.jpt.jpa.core.resource.orm.GenerationType ormGenerationType; - - GenerationType(org.eclipse.jpt.jpa.core.resource.java.GenerationType javaGenerationType, org.eclipse.jpt.jpa.core.resource.orm.GenerationType ormGenerationType) { - if (javaGenerationType == null) { - throw new NullPointerException(); - } - if (ormGenerationType == null) { - throw new NullPointerException(); - } - this.javaGenerationType = javaGenerationType; - this.ormGenerationType = ormGenerationType; - } - - public org.eclipse.jpt.jpa.core.resource.java.GenerationType getJavaGenerationType() { - return this.javaGenerationType; - } - - public org.eclipse.jpt.jpa.core.resource.orm.GenerationType getOrmGenerationType() { - return this.ormGenerationType; - } - - - // ********** static methods ********** - - public static GenerationType fromJavaResourceModel(org.eclipse.jpt.jpa.core.resource.java.GenerationType javaGenerationType) { - return (javaGenerationType == null) ? null : fromJavaResourceModel_(javaGenerationType); - } - - private static GenerationType fromJavaResourceModel_(org.eclipse.jpt.jpa.core.resource.java.GenerationType javaGenerationType) { - for (GenerationType generationType : GenerationType.values()) { - if (generationType.getJavaGenerationType() == javaGenerationType) { - return generationType; - } - } - return null; - } - - public static org.eclipse.jpt.jpa.core.resource.java.GenerationType toJavaResourceModel(GenerationType generationType) { - return (generationType == null) ? null : generationType.getJavaGenerationType(); - } - - public static GenerationType fromOrmResourceModel(org.eclipse.jpt.jpa.core.resource.orm.GenerationType ormGenerationType) { - return (ormGenerationType == null) ? null : fromOrmResourceModel_(ormGenerationType); - } - - private static GenerationType fromOrmResourceModel_(org.eclipse.jpt.jpa.core.resource.orm.GenerationType ormGenerationType) { - for (GenerationType generationType : GenerationType.values()) { - if (generationType.getOrmGenerationType() == ormGenerationType) { - return generationType; - } - } - return null; - } - - public static org.eclipse.jpt.jpa.core.resource.orm.GenerationType toOrmResourceModel(GenerationType generationType) { - return (generationType == null) ? null : generationType.getOrmGenerationType(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Generator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Generator.java deleted file mode 100644 index 3f82a10551..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Generator.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.Arrays; - -import org.eclipse.jpt.jpa.core.context.java.JavaGenerator; -import org.eclipse.jpt.jpa.core.context.orm.OrmGenerator; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; - -/** - * sequence and table generators - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface Generator - extends JpaNamedContextNode -{ - /** - * TODO use this precedence until adopters protest... - * then move to JpaPlatform - */ - @SuppressWarnings("unchecked") - Iterable> PRECEDENCE_TYPE_LIST = Arrays.asList( - OrmGenerator.class, - JavaGenerator.class - ); - - - // ********** initial value ********** - - /** - * Return the specified initial value if present, otherwise return the - * default initial value. - */ - int getInitialValue(); - Integer getSpecifiedInitialValue(); - void setSpecifiedInitialValue(Integer value); - String SPECIFIED_INITIAL_VALUE_PROPERTY = "specifiedInitialValue"; //$NON-NLS-1$ - int getDefaultInitialValue(); - String DEFAULT_INITIAL_VALUE_PROPERTY = "defaultInitialValue"; //$NON-NLS-1$ - - - // ********** allocation size ********** - - /** - * Return the specified allocation size if present, otherwise return the - * default allocation size. - */ - int getAllocationSize(); - Integer getSpecifiedAllocationSize(); - void setSpecifiedAllocationSize(Integer value); - String SPECIFIED_ALLOCATION_SIZE_PROPERTY = "specifiedAllocationSize"; //$NON-NLS-1$ - int getDefaultAllocationSize(); - String DEFAULT_ALLOCATION_SIZE_PROPERTY = "defaultAllocationSize"; //$NON-NLS-1$ - int DEFAULT_ALLOCATION_SIZE = 50; - - - // ********** database stuff ********** - - /** - * Return the schema container that holds the relevant schemata. - */ - SchemaContainer getDbSchemaContainer(); - - /** - * Return the generator's database catalog. - * Return null if the generator's catalog (name) is invalid. - */ - Catalog getDbCatalog(); - - /** - * Return the generator's database schema. - * Return null if the generator's schema (name) is invalid. - */ - Schema getDbSchema(); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GeneratorContainer.java deleted file mode 100644 index 9297560a29..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/GeneratorContainer.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Container for a table generator and/or sequence generator. - * Used by entities and ID mappings. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface GeneratorContainer - extends JpaContextNode -{ - // ********** sequence generator ********** - - String SEQUENCE_GENERATOR_PROPERTY = "sequenceGenerator"; //$NON-NLS-1$ - - SequenceGenerator getSequenceGenerator(); - - SequenceGenerator addSequenceGenerator(); - - void removeSequenceGenerator(); - - - // ********** table generator ********** - - String TABLE_GENERATOR_PROPERTY = "tableGenerator"; //$NON-NLS-1$ - - TableGenerator getTableGenerator(); - - TableGenerator addTableGenerator(); - - void removeTableGenerator(); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdClassReference.java deleted file mode 100644 index 8d63b18cb5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdClassReference.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; - -/** - * ID class reference - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface IdClassReference - extends PersistentType.Owner -{ - // ********** id class name ********** - - /** - * Return the name of the id class, taking into consideration the default value if applicable - */ - String getIdClassName(); - - /** - * Property string associated with changes to the {@link IdClassHolder}'s specified id class name - */ - String SPECIFIED_ID_CLASS_NAME_PROPERTY = "specifiedIdClassName"; //$NON-NLS-1$ - - /** - * Return the specified name of the id class, null if none is specified in the resource model - */ - String getSpecifiedIdClassName(); - - /** - * Set the specified name of the id class. - * Use null to remove the id class specification from the resource model - */ - void setSpecifiedIdClassName(String value); - - /** - * Property string associated with changes to the {@link IdClassHolder}'s default id class name - */ - String DEFAULT_ID_CLASS_NAME_PROPERTY = "defaultIdClassName"; //$NON-NLS-1$ - - /** - * Return the default name of the id class, null if there is none - */ - String getDefaultIdClassName(); - - /** - * Return whether the id class has been specified. - * Generally, this simply means that the id class name has been set, although if a default - * applies, this should also return true. - */ - boolean isSpecified(); - - - // ********** id class ********** - - /** - * Property string associated with changes to the {@link IdClassHolder}'s id class. - * This will change (potentially) if the id class name changes, or if other changes result - * in changes in the id class' resolution. - */ - String ID_CLASS_PROPERTY = "idClass"; //$NON-NLS-1$ - - /** - * Return the {@link JavaPersistentType} that is resolved from the id class name. - * This will be null if the id class name is null or if the class cannot be resolved from that - * name. - */ - JavaPersistentType getIdClass(); - - /** - * Return the char to be used for browsing or creating the id class IType. - * @see org.eclipse.jdt.core.IType#getFullyQualifiedName(char) - */ - char getIdClassEnclosingTypeSeparator(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdMapping.java deleted file mode 100644 index d4f117ff28..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/IdMapping.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA ID mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface IdMapping - extends ColumnMapping, ConvertibleMapping -{ - GeneratorContainer getGeneratorContainer(); - - GeneratedValue getGeneratedValue(); - GeneratedValue addGeneratedValue(); - void removeGeneratedValue(); - String GENERATED_VALUE_PROPERTY = "generatedValue"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/InheritanceType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/InheritanceType.java deleted file mode 100644 index a3003bf64c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/InheritanceType.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Inheritance Type - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public enum InheritanceType { - - SINGLE_TABLE( - org.eclipse.jpt.jpa.core.resource.java.InheritanceType.SINGLE_TABLE, - org.eclipse.jpt.jpa.core.resource.orm.InheritanceType.SINGLE_TABLE - ), - JOINED( - org.eclipse.jpt.jpa.core.resource.java.InheritanceType.JOINED, - org.eclipse.jpt.jpa.core.resource.orm.InheritanceType.JOINED - ), - TABLE_PER_CLASS( - org.eclipse.jpt.jpa.core.resource.java.InheritanceType.TABLE_PER_CLASS, - org.eclipse.jpt.jpa.core.resource.orm.InheritanceType.TABLE_PER_CLASS - ); - - - private org.eclipse.jpt.jpa.core.resource.java.InheritanceType javaInheritanceType; - private org.eclipse.jpt.jpa.core.resource.orm.InheritanceType ormInheritanceType; - - InheritanceType(org.eclipse.jpt.jpa.core.resource.java.InheritanceType javaInheritanceType, org.eclipse.jpt.jpa.core.resource.orm.InheritanceType ormInheritanceType) { - if (javaInheritanceType == null) { - throw new NullPointerException(); - } - if (ormInheritanceType == null) { - throw new NullPointerException(); - } - this.javaInheritanceType = javaInheritanceType; - this.ormInheritanceType = ormInheritanceType; - } - - public org.eclipse.jpt.jpa.core.resource.java.InheritanceType getJavaInheritanceType() { - return this.javaInheritanceType; - } - - public org.eclipse.jpt.jpa.core.resource.orm.InheritanceType getOrmInheritanceType() { - return this.ormInheritanceType; - } - - - // ********** static methods ********** - - public static InheritanceType fromJavaResourceModel(org.eclipse.jpt.jpa.core.resource.java.InheritanceType javaInheritanceType) { - return (javaInheritanceType == null) ? null : fromJavaResourceModel_(javaInheritanceType); - } - - private static InheritanceType fromJavaResourceModel_(org.eclipse.jpt.jpa.core.resource.java.InheritanceType javaInheritanceType) { - for (InheritanceType inheritanceType : InheritanceType.values()) { - if (inheritanceType.getJavaInheritanceType() == javaInheritanceType) { - return inheritanceType; - } - } - return null; - } - - public static org.eclipse.jpt.jpa.core.resource.java.InheritanceType toJavaResourceModel(InheritanceType inheritanceType) { - return (inheritanceType == null) ? null : inheritanceType.getJavaInheritanceType(); - } - - public static InheritanceType fromOrmResourceModel(org.eclipse.jpt.jpa.core.resource.orm.InheritanceType ormInheritanceType) { - return (ormInheritanceType == null) ? null : fromOrmResourceModel_(ormInheritanceType); - } - - private static InheritanceType fromOrmResourceModel_(org.eclipse.jpt.jpa.core.resource.orm.InheritanceType ormInheritanceType) { - for (InheritanceType inheritanceType : InheritanceType.values()) { - if (inheritanceType.getOrmInheritanceType() == ormInheritanceType) { - return inheritanceType; - } - } - return null; - } - - public static org.eclipse.jpt.jpa.core.resource.orm.InheritanceType toOrmResourceModel(InheritanceType inheritanceType) { - return (inheritanceType == null) ? null : inheritanceType.getOrmInheritanceType(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumn.java deleted file mode 100644 index 42d2edf02d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumn.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Specified join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JoinColumn - extends BaseJoinColumn, BaseColumn, ReadOnlyJoinColumn -{ - /** - * Initialize the join column from the specified old join column. - */ - void initializeFrom(ReadOnlyJoinColumn oldJoinColumn); - - /** - * Initialize the join column from the specified old virtual join column. - */ - void initializeFromVirtual(ReadOnlyJoinColumn virtualJoinColumn); - - - /** - * interface allowing join columns to be used in multiple places - * (e.g. 1:1 mappings and join tables) - */ - interface Owner - extends ReadOnlyJoinColumn.Owner, BaseJoinColumn.Owner, BaseColumn.Owner - { - // combine interfaces - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationship.java deleted file mode 100644 index 4a80ae536c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationship.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Join column relationship

    - *
  • 1:1 - *
  • 1:m - *
  • m:1 - *
  • association override - *
- *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see RelationshipMapping - * @see Relationship - * @see JoinColumn - * - * @version 2.2 - * @since 2.2 - */ -public interface JoinColumnRelationship - extends ReadOnlyJoinColumnRelationship, Relationship -{ - JoinColumnRelationshipStrategy getJoinColumnStrategy(); - - /** - * Set the relationship's strategy to the join column strategy. - */ - void setStrategyToJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationshipStrategy.java deleted file mode 100644 index a6338dfce5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - -/** - * Join column relationship strategy. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see RelationshipMapping - * @see AssociationOverride - * @see JoinColumnRelationship - * - * @version 2.3 - * @since 2.2 - */ -public interface JoinColumnRelationshipStrategy - extends ReadOnlyJoinColumnRelationshipStrategy, RelationshipStrategy -{ - void initializeFrom(ReadOnlyJoinColumnRelationshipStrategy oldStrategy); - - void initializeFromVirtual(ReadOnlyJoinColumnRelationshipStrategy oldStrategy); - - - // ********** join columns ********** - - ListIterator joinColumns(); - - - // ********** specified join columns ********** - - ListIterator specifiedJoinColumns(); - JoinColumn getSpecifiedJoinColumn(int index); - - /** - * Add a specified join column to the relationship. - */ - JoinColumn addSpecifiedJoinColumn(); - - /** - * Add a specified join column to the relationship. - */ - JoinColumn addSpecifiedJoinColumn(int index); - - /** - * Remove the specified join column. - */ - void removeSpecifiedJoinColumn(int index); - - /** - * Remove the specified join column. - */ - void removeSpecifiedJoinColumn(JoinColumn joinColumn); - - /** - * Move the specified join column from the source index to the target index. - */ - void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex); - - - // ********** default join column ********** - - JoinColumn getDefaultJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTable.java deleted file mode 100644 index 7a95d1b11a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTable.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - -/** - * Used by many-to-many and one-to-many mappings. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JoinTable - extends ReferenceTable, ReadOnlyJoinTable -{ - JoinTableRelationshipStrategy getParent(); - - void initializeFrom(ReadOnlyJoinTable oldJoinTable); - - void initializeFromVirtual(ReadOnlyJoinTable virtualJoinTable); - - - // ********** inverse join columns ********** - - /** - * Convert the join table's default inverse join column to a specified - * inverse join column. - */ - void convertDefaultToSpecifiedInverseJoinColumn(); - - ListIterator inverseJoinColumns(); - - ListIterator specifiedInverseJoinColumns(); - - JoinColumn getSpecifiedInverseJoinColumn(int index); - - /** - * Add a specified inverse join column to the join table. - * Return the newly-created join column. - */ - JoinColumn addSpecifiedInverseJoinColumn(); - - /** - * Add a specified inverse join column to the join table. - * Return the newly-created join column. - */ - JoinColumn addSpecifiedInverseJoinColumn(int index); - - /** - * Remove the inverse join column at the specified index from the join table. - */ - void removeSpecifiedInverseJoinColumn(int index); - - /** - * Remove the specified inverse join column from the join table. - */ - void removeSpecifiedInverseJoinColumn(JoinColumn joinColumn); - - /** - * Move an inverse join column from the specified source index to the - * specified target index. - */ - void moveSpecifiedInverseJoinColumn(int targetIndex, int sourceIndex); - - /** - * Remove all the join table's inverse join columns. - */ - void clearSpecifiedInverseJoinColumns(); - - JoinColumn getDefaultInverseJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationship.java deleted file mode 100644 index 45b60aaf47..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationship.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Join table relationship

    - *
  • 1:1 (JPA 2.0) - *
  • 1:m - *
  • m:1 (JPA 2.0) - *
  • m:m - *
  • association override (JPA 2.0) - *
- *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JoinTableRelationship - extends ReadOnlyJoinTableRelationship, Relationship -{ - JoinTableRelationshipStrategy getJoinTableStrategy(); - - /** - * Set the relationship's strategy to the join table strategy. - */ - void setStrategyToJoinTable(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationshipStrategy.java deleted file mode 100644 index 74bf5f21b9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JoinTableRelationshipStrategy.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; - -/** - * Join table relationship strategy. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see RelationshipMapping - * @see AssociationOverride - * @see JoinTableRelationship - * - * @version 2.3 - * @since 2.2 - */ -public interface JoinTableRelationshipStrategy - extends ReadOnlyJoinTableRelationshipStrategy, RelationshipStrategy -{ - void initializeFrom(ReadOnlyJoinTableRelationshipStrategy oldStrategy); - - void initializeFromVirtual(ReadOnlyJoinTableRelationshipStrategy virtualStrategy); - - JoinTable getJoinTable(); - - boolean validatesAgainstDatabase(); - - JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver); - - JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaContextNode.java deleted file mode 100644 index 3de89e27bf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaContextNode.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jpa.core.JpaNode; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; - -/** - * Common protocol for JPA objects that have a context, as opposed to - * resource objects. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JpaContextNode - extends JpaNode -{ - /** - * Return the resource type of the context node's resource. - */ - JptResourceType getResourceType(); - - /** - * Return the persistence unit if the context node is within a - * persistence unit. Otherwise throw an exception. - */ - PersistenceUnit getPersistenceUnit(); - - /** - * Return the mapping file root if the context node is within a - * mapping file. Otherwise throw an exception. - */ - MappingFileRoot getMappingFileRoot(); - - - // ********** database stuff ********** - - SchemaContainer getContextDefaultDbSchemaContainer(); - - Catalog getContextDefaultDbCatalog(); - - Schema getContextDefaultDbSchema(); - - - // ********** synchronize/update ********** - - /** - * The resource model has changed; synchronize the context model with it. - * This will probably trigger a call to {@link #update()}. - */ - void synchronizeWithResourceModel(); - - /** - * Some non-trivial state in the JPA project has changed; update the - * parts of the context node that are dependent on yet other parts of the - * node's JPA project. - * If the dependent state changes also, yet another update will be - * triggered, possibly followed by yet more updates; until the JPA - * project's state quiesces. - */ - void update(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaNamedContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaNamedContextNode.java deleted file mode 100644 index 2ba2391fba..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaNamedContextNode.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Named context node that may have collisions with or override other nodes - * with the same name defined elsewhere in the persistence unit - * (e.g. sequence generators). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JpaNamedContextNode - extends JpaContextNode -{ - // ********** name ********** - - String getName(); - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - void setName(String name); - - - // ********** validation ********** - - /** - * Return whether the node "overrides" the specified node - * within the nodes' persistence unit. - * (e.g. a query defined in orm.xml - * "overrides" one defined in a Java annotation). - * - * @see #duplicates(Object) - */ - boolean overrides(T other); - - /** - * Return whether the node is a "duplicate" of the specified node. - * Two nodes are duplicates if they both have the same, - * non-null name and neither node "overrides" the other. - * - * @see #overrides(Object) - */ - boolean duplicates(T other); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaRootContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaRootContextNode.java deleted file mode 100644 index 72f17ddf63..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/JpaRootContextNode.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.List; - -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Root of the Dali JPA context model. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface JpaRootContextNode - extends JpaContextNode -{ - - // ********** persistence.xml ********** - - /** - * String constant associated with changes to the persistence XML property - * @see #addPropertyChangeListener(String, org.eclipse.jpt.common.utility.model.listener.PropertyChangeListener) - */ - public final static String PERSISTENCE_XML_PROPERTY = "persistenceXml"; //$NON-NLS-1$ - - /** - * Return the content represented by the persistence.xml - * file associated with the root context node's JPA project. - * This may be null. - */ - PersistenceXml getPersistenceXml(); - - - // ********** validation ********** - - /** - * Add validation messages to the specified list. - */ - public void validate(List messages, IReporter reporter); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/LobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/LobConverter.java deleted file mode 100644 index 61066cf693..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/LobConverter.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA LOB converter - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.1 - */ -public interface LobConverter - extends Converter -{ - // nothing yet -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToManyMapping.java deleted file mode 100644 index 3b98a83d02..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToManyMapping.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011s Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA m:m mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface ManyToManyMapping - extends MultiRelationshipMapping -{ - ManyToManyRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToManyRelationship.java deleted file mode 100644 index 2ec18c5fa8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToManyRelationship.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * m:m relationship reference - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface ManyToManyRelationship - extends MappedByRelationship, - JoinTableRelationship, - MappingRelationship -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToOneMapping.java deleted file mode 100644 index 41617e286f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToOneMapping.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA m:1 mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface ManyToOneMapping - extends SingleRelationshipMapping -{ - ManyToOneRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToOneRelationship.java deleted file mode 100644 index 712f296a33..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ManyToOneRelationship.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * m:1 relationship (join column) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface ManyToOneRelationship - extends JoinColumnRelationship, MappingRelationship -{ - // nothing -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationship.java deleted file mode 100644 index 09f610b7a2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationship.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * "Mapped by" relationship

    - *
  • 1:1 - *
  • 1:m - *
  • m:m - *
- *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface MappedByRelationship - extends Relationship -{ - /** - * Return the (never null) strategy used to configure - * the relationship's "mapped by" strategy. - */ - MappedByRelationshipStrategy getMappedByStrategy(); - - /** - * Return whether the "mapped by" strategy is the - * relationship's current strategy. - */ - boolean strategyIsMappedBy(); - - /** - * Set the relationship's strategy to the "mapped by" strategy. - */ - void setStrategyToMappedBy(); - - /** - * Return whether the specified mapping may own the relationship. - */ - boolean mayBeMappedBy(AttributeMapping mapping); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationshipStrategy.java deleted file mode 100644 index 525cece96b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedByRelationshipStrategy.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.Iterator; - -/** - * "Mapped by" relationship strategy - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see RelationshipMapping - * @see MappedByRelationship - * - * @version 2.2 - * @since 2.2 - */ -public interface MappedByRelationshipStrategy - extends RelationshipStrategy -{ - void initializeFrom(MappedByRelationshipStrategy oldStrategy); - - /** - * String associated with changes to the attribute property of this object - */ - String MAPPED_BY_ATTRIBUTE_PROPERTY = "mappedByAttribute"; //$NON-NLS-1$ - - /** - * Return the name of the attribute that maps the relationship. - */ - String getMappedByAttribute(); - - /** - * Set the name of the attribute that maps the relationship. - */ - void setMappedByAttribute(String attribute); - - /** - * Return the possible attribute names the strategy might use. - */ - Iterator candidateMappedByAttributeNames(); - - /** - * Return whether this strategy's relationship is owned by the given other - * relationship mapping - */ - boolean relationshipIsOwnedBy(RelationshipMapping otherMapping); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedSuperclass.java deleted file mode 100644 index 6a60964bef..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappedSuperclass.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * mapped superclass - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface MappedSuperclass - extends TypeMapping -{ - IdClassReference getIdClassReference(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java deleted file mode 100644 index 9d7ca2b09f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFile.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * JPA mapping file (typically orm.xml). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.1 - */ -public interface MappingFile - extends XmlFile, PersistentTypeContainer -{ - /** - * Covariant override. - */ - MappingFileRef getParent(); - - /** - * Return the mapping file's root. - * This can be null. - */ - MappingFileRoot getRoot(); - - /** - * Return the specified persistent type if it is listed in the mapping file; - * otherwise return null. - */ - PersistentType getPersistentType(String name); - - /** - * Return true if this mapping file exists in the given folder - */ - boolean isIn(IFolder folder); - - - // ********** refactoring ********** - - /** - * Create DeleteEdits for deleting references (if any) to the type about to be deleted. - * Return an EmptyIterable if there are not any references to the given type. - */ - Iterable createDeleteTypeEdits(IType type); - - /** - * Create ReplaceEdits for renaming any references to the originalType to the newName. - * The originalType has not yet been renamed, the newName is the new short name. - */ - Iterable createRenameTypeEdits(IType originalType, String newName); - - /** - * Create ReplaceEdits for moving any references to the originalType to the newPackage. - * The originalType has not yet been moved. - */ - Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage); - - /** - * Create ReplaceEdits for renaming any references to the originalPackage to the newName. - * The originalPackage has not yet been renamed. - */ - Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitDefaults.java deleted file mode 100644 index f32ec18b8d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitDefaults.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Persistence unit defaults held by a mapping file. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.1 - */ -public interface MappingFilePersistenceUnitDefaults - extends XmlContextNode -{ - /** - * Covariant override. - */ - MappingFilePersistenceUnitMetadata getParent(); - - /** - * Return the access type for all managed classes in the persistence unit, - * unless overridden by a local annotation or XML setting. - */ - AccessType getAccess(); - - /** - * Return the catalog for all database objects referenced in the - * persistence unit, unless overridden by a local annotation or XML setting. - *

- * Return the specified catalog if present, otherwise return the - * default catalog as determined by the database connection. - */ - String getCatalog(); - - /** - * Return the schema for all database objects referenced in the - * persistence unit, unless overridden by a local annotation or XML setting. - *

- * Return the specified schema if present, otherwise return the - * default schema as determined by the database connection. - */ - String getSchema(); - - /** - * Return all the relationhips in the persistence unit are to be cascade - * persist, unless overridden by a local annotation or XML setting. - */ - boolean isCascadePersist(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitMetadata.java deleted file mode 100644 index 1313b66fbe..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFilePersistenceUnitMetadata.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Persistence unit metadata held by a mapping file. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface MappingFilePersistenceUnitMetadata - extends XmlContextNode -{ - /** - * Covariant override. - */ - MappingFileRoot getParent(); - - /** - * Return whether any annotations on the persistent types associated with - * the mapping file's persistence unit are to be ignored. - */ - boolean isXmlMappingMetadataComplete(); - - /** - * Return the persistence unit defaults held by the mapping file. - */ - MappingFilePersistenceUnitDefaults getPersistenceUnitDefaults(); - - /** - * Return whether the mapping file's underlying resource exists. - * If there is a node in the orm.xml file for the - * {@code } element, - * return true; otherwise false. - */ - boolean resourceExists(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFileRoot.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFileRoot.java deleted file mode 100644 index 657c618834..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingFileRoot.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import org.eclipse.jpt.jpa.core.JpaStructureNode; - -/** - * The root of a JPA mapping file. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.1 - */ -public interface MappingFileRoot - extends XmlContextNode, JpaStructureNode -{ - /** - * covariant override - */ - MappingFile getParent(); - - /** - * Return the specified access if present, otherwise return the default - * access. - */ - AccessType getAccess(); - - /** - * Return the specified catalog if present, otherwise return the default - * catalog. - */ - String getCatalog(); - - /** - * Return the specified schema if present, otherwise return the default - * schema. - */ - String getSchema(); - - /** - * Return the metadata defined within the mapping file - * for the persistence unit. - * Return null if none exists. - * - * @see MappingFilePersistenceUnitMetadata#resourceExists() - */ - MappingFilePersistenceUnitMetadata getPersistenceUnitMetadata(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingRelationship.java deleted file mode 100644 index b3000326b4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MappingRelationship.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Mapping relationship

    - *
  • 1:1 - *
  • 1:m - *
  • m:1 - *
  • m:m - *
- *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface MappingRelationship - extends Relationship -{ - /** - * Return whether the relationship's mapping is the relationship owner. - * @see RelationshipMapping#isRelationshipOwner() - */ - boolean isOwner(); - - /** - * Return whether the specified mapping owns the relationship. - * @see RelationshipMapping#isOwnedBy(AttributeMapping) - */ - boolean isOwnedBy(RelationshipMapping mapping); - - /** - * Return whether the relationship's mapping is a target foreign key - * relationship. - * A one-to-many mapping with a join column will have the foreign key - * in the target table. - */ - boolean isTargetForeignKey(); - - /** - * Return whether the relationship's mapping can be overridden with an - * association override. - */ - boolean isOverridable(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MultiRelationshipMapping.java deleted file mode 100644 index a7351fc176..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/MultiRelationshipMapping.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Multi-valued (1:m, m:m) relationship mapping. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface MultiRelationshipMapping - extends RelationshipMapping, CollectionMapping -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedColumn.java deleted file mode 100644 index ffeef1b9c4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedColumn.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.db.Table; - -/** - * Specified - *

    - *
  • column - *
  • join column - *
  • primary key join column - *
  • discriminator column - *
  • order column - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface NamedColumn - extends ReadOnlyNamedColumn -{ - void setSpecifiedName(String name); - - void setColumnDefinition(String columnDefinition); - - - // ********** database stuff ********** - - /** - * Return the wrapper for the datasource table - */ - Table getDbTable(); - - /** - * Return whether the column is found on the datasource. - */ - boolean isResolved(); - - - // ********** owner ********** - - /** - * Interface allowing columns to be used in multiple places - * (e.g. basic mappings and attribute overrides). - */ - interface Owner - extends ReadOnlyNamedColumn.Owner - { - /** - * Return the database table for the specified table name. - */ - Table resolveDbTable(String tableName); - - JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedNativeQuery.java deleted file mode 100644 index beba80ec44..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedNativeQuery.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * named native query - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface NamedNativeQuery - extends Query -{ - // ********** result class ********** - - String getResultClass(); - void setResultClass(String value); - String RESULT_CLASS_PROPERTY = "resultClass"; //$NON-NLS-1$ - - /** - * Return the character to be used for browsing or - * creating the result class {@link org.eclipse.jdt.core.IType IType}. - * @see org.eclipse.jdt.core.IType#getFullyQualifiedName(char) - */ - char getResultClassEnclosingTypeSeparator(); - - - // ********** result set mapping ********** - - String getResultSetMapping(); - void setResultSetMapping(String value); - String RESULT_SET_MAPPING_PROPERTY = "resultSetMapping"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedQuery.java deleted file mode 100644 index 92ac55e44f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/NamedQuery.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * named query - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public interface NamedQuery - extends Query -{ - // nothing yet -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToManyMapping.java deleted file mode 100644 index b68338b4bf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToManyMapping.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA 1:m mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface OneToManyMapping - extends MultiRelationshipMapping -{ - OneToManyRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToManyRelationship.java deleted file mode 100644 index 3d7d40dc43..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToManyRelationship.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * 1:m relationship (mapped by, join table) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface OneToManyRelationship - extends MappedByRelationship, - JoinTableRelationship, - MappingRelationship -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToOneMapping.java deleted file mode 100644 index a6595c346c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToOneMapping.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA 1:1 mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface OneToOneMapping - extends SingleRelationshipMapping -{ - OneToOneRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToOneRelationship.java deleted file mode 100644 index a3c5019619..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OneToOneRelationship.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * 1:1 relationship (mapped by, join column, primary key join column) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface OneToOneRelationship - extends MappedByRelationship, - JoinColumnRelationship, - PrimaryKeyJoinColumnRelationship, - MappingRelationship -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OptionalMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OptionalMapping.java deleted file mode 100644 index 0707763858..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OptionalMapping.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA attribute mapping that is optional (e.g. basic, single relationship). - * From the JPA spec: - *

- * Whether the value of the field or property may be null. This is a hint 
- * and is disregarded for primitive types; it may be used in schema generation.
- * 
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface OptionalMapping - extends AttributeMapping -{ - boolean isOptional(); - - boolean isDefaultOptional(); - String DEFAULT_OPTIONAL_PROPERTY = "defaultOptional"; //$NON-NLS-1$ - boolean DEFAULT_OPTIONAL = true; - - Boolean getSpecifiedOptional(); - void setSpecifiedOptional(Boolean newSpecifiedOptional); - String SPECIFIED_OPTIONAL_PROPERTY = "specifiedOptional"; //$NON-NLS-1$ - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Orderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Orderable.java deleted file mode 100644 index 8f2ab3c07f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Orderable.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Multi-valued (1:m, m:m) relationship mappings support ordering. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface Orderable - extends JpaContextNode -{ - AttributeMapping getParent(); - - String getSpecifiedOrderBy(); - void setSpecifiedOrderBy(String orderBy); - String SPECIFIED_ORDER_BY_PROPERTY = "specifiedOrderBy"; //$NON-NLS-1$ - - boolean isNoOrdering(); - void setNoOrdering(boolean noOrdering); - String NO_ORDERING_PROPERTY = "noOrdering"; //$NON-NLS-1$ - - boolean isPkOrdering(); - void setPkOrdering(boolean pkOrdering); - String PK_ORDERING_PROPERTY = "pkOrdering"; //$NON-NLS-1$ - - boolean isCustomOrdering(); - void setCustomOrdering(boolean customOrdering); - String CUSTOM_ORDERING_PROPERTY = "customOrdering"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideContainer.java deleted file mode 100644 index d01155645d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideContainer.java +++ /dev/null @@ -1,215 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.Iterator; -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.db.Table; - -/** - * attribute or association override container - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.3 - */ -public interface OverrideContainer - extends JpaContextNode -{ - /** - * Return the type mapping that this override is contained in - */ - TypeMapping getTypeMapping(); - - /** - * Return the type mapping that contains the attributes/associations to - * be overridden. (Though the type mapping may not directly - * own them (i.e. they may be on a supertype mapping). - * (For example: for an entity, this would be the supertype mapping of - * that entity; for an embedded, this would be the target type mapping - * of the embedded.) - */ - TypeMapping getOverridableTypeMapping(); - - /** - * Return the names of all attributes that can be overridden - */ - Iterator allOverridableNames(); - - /** - * Convert the specified specified override to virtual. - * Return the new override. - */ - VirtualOverride convertOverrideToVirtual(Override_ specifiedOverride); - - /** - * Convert the specified virtual override to specified. - * Return the new override. - */ - Override_ convertOverrideToSpecified(VirtualOverride virtualOverride); - - /** - * return whether the given table cannot be explicitly specified - * in the column or join column's 'table' element - */ - boolean tableNameIsInvalid(String tableName); - - /** - * Return the names of tables that are valid for the overrides column or join columns. - */ - Iterator candidateTableNames(); - - /** - * Return the database table for the specified table name - */ - Table resolveDbTable(String tableName); - - /** - * Return the name of the table which the column belongs to by default - */ - String getDefaultTableName(); - - JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver); - - JptValidator buildValidator(Override_ override, OverrideTextRangeResolver textRangeResolver); - - - // ********** overrides ********** - - /** - * Return the overrides, both specified and virtual. - */ - // TODO bjv change to a collection? - ListIterator overrides(); - - /** - * Return the number of overrides, both specified and default. - */ - int overridesSize(); - - /** - * Return the override with the specified name, - * whether specified or virtual. - */ - // TODO look into getting rid of this; - // we should probably use #getSpecifiedOverrideNamed(String) - ReadOnlyOverride getOverrideNamed(String name); - - - // ********** specified overrides ********** - - /** - * Return the specified overrides. - * No add/remove for specified overrides, the - * virtual overrides will be populated from the owner, then use - * {@link VirtualOverride#convertToSpecified()} to add/remove the - * override from the container. - */ - ListIterator specifiedOverrides(); - String SPECIFIED_OVERRIDES_LIST = "specifiedOverrides"; //$NON-NLS-1$ - - /** - * Return the number of specified overrides. - */ - int specifiedOverridesSize(); - - /** - * Return the specified override at the specified index. - */ - Override_ getSpecifiedOverride(int index); - - /** - * Move the specified override from the source index to the target index. - */ - void moveSpecifiedOverride(int targetIndex, int sourceIndex); - - Override_ getSpecifiedOverrideNamed(String name); - - - // ********** virtual overrides ********** - - /** - * Return the virtual overrides, those not specified. - */ - // TODO change to a collection? - ListIterator virtualOverrides(); - String VIRTUAL_OVERRIDES_LIST = "virtualOverrides"; //$NON-NLS-1$ - - /** - * Return the number of virtual overrides. - */ - int virtualOverridesSize(); - - - // ********** owner ********** - - interface Owner - { - /** - * Return the mapping of the persistent type where the container is defined. - * (For example: for an entity, this would be the entity; for an embedded, - * this would be the type mapping where the embedded is defined.) - */ - TypeMapping getTypeMapping(); - - /** - * Return the type mapping that contains the attributes/associations to - * be overridden. (Though the type mapping may not directly - * own them (i.e. they may be on a supertype mapping). - * (For example: for an entity, this would be the supertype mapping of - * that entity; for an embedded, this would be the target type mapping - * of the embedded.) - */ - TypeMapping getOverridableTypeMapping(); - - /** - * Return all the names of the attributes/associations to be overridden. - * This is usually just all of the overridable names of the overridable - * type mapping. - * @see #getOverridableTypeMapping() - */ - Iterator allOverridableNames(); - - /** - * Return the name of an override column's/join column's default table. - */ - String getDefaultTableName(); - - /** - * Return whether the specified table cannot be explicitly specified - * by a column/join column. - */ - boolean tableNameIsInvalid(String tableName); - - /** - * Return the database table for the specified table name. - */ - org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName); - - /** - * Return the table names that are valid for the override's column - * or join columns - */ - Iterator candidateTableNames(); - - JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver); - - JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideRelationship.java deleted file mode 100644 index f826819245..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/OverrideRelationship.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Association override relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see AssociationOverride - * - * @version 2.3 - * @since 2.3 - */ -public interface OverrideRelationship - extends ReadOnlyOverrideRelationship, - JoinColumnRelationship -{ - AssociationOverride getAssociationOverride(); - - void initializeFromVirtual(ReadOnlyOverrideRelationship virtualRelationship); - - void initializeFromVirtualJoinColumnRelationship(ReadOnlyJoinColumnRelationship virtualRelationship); - - void initializeFromVirtualJoinTableRelationship(ReadOnlyJoinTableRelationship virtualRelationship); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Override_.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Override_.java deleted file mode 100644 index d4da2d94d6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Override_.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - *

    - *
  • attribute override - *
  • association override - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -// the class name "Override" is sorta taken: java.lang.Override -// maybe if it weren't in the java.lang package we would take it on, but... :) -public interface Override_ - extends ReadOnlyOverride -{ - void setName(String value); - - /** - * Convert the override to a virtual override. - * Return the new override. - * @see #isVirtual() - */ - VirtualOverride convertToVirtual(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentAttribute.java deleted file mode 100644 index 930aa0142f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentAttribute.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Context persistent attribute (field or property). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface PersistentAttribute - extends ReadOnlyPersistentAttribute, AccessHolder -{ - /** - * Set the attribute's mapping. - * If the specified key is null, clear the specified mapping, - * allowing the attribute's mapping to default (if appropriate). - * Return the new mapping (which may be a null mapping). - */ - AttributeMapping setMappingKey(String key); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java deleted file mode 100644 index a77d422449..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PersistentType.java +++ /dev/null @@ -1,210 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Context persistent type. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface PersistentType - extends JpaContextNode, JpaStructureNode, AccessHolder -{ - // ********** name ********** - - /** - * Return the persistent type's [fully-qualified] name. - * The enclosing type separator is '.', - * as opposed to '$'. - * @see #getSimpleName() - */ - String getName(); - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - - /** - * Return the persistent type's simple name. - * @see #getName() - */ - String getSimpleName(); - - - // ********** mapping ********** - - /** - * Return the persistent type's mapping. - * Set the mapping via {@link #setMappingKey(String)}. - */ - TypeMapping getMapping(); - String MAPPING_PROPERTY = "mapping"; //$NON-NLS-1$ - - String getMappingKey(); - - void setMappingKey(String key); - - boolean isMapped(); - - - // ********** attributes ********** - - /** - * Return the persistent type's persistent attributes. - */ - ListIterator attributes(); - - /** - * Return the number of the persistent type's persistent attributes. - */ - int attributesSize(); - - /** - * Return the names of the persistent type's persistent attributes. - */ - Iterator attributeNames(); - - /** - * Return all the persistent attributes in the persistent type's - * inheritance hierarchy. - */ - Iterator allAttributes(); - - /** - * Return the names of all the persistent attributes in the - * persistent type's hierarchy. - */ - Iterator allAttributeNames(); - - /** - * Return the persistent attribute with the specified name, - * if it exists locally on the persistent type (as opposed to in its - * inheritance hierarchy). - */ - ReadOnlyPersistentAttribute getAttributeNamed(String attributeName); - - /** - * Resolve and return the persistent attribute with the specified name, if it - * is distinct and exists within the context of the persistent type. - */ - ReadOnlyPersistentAttribute resolveAttribute(String attributeName); - - - // ********** inheritance ********** - - /** - * Return the "super" {@link PersistentType} from the "persistence" - * inheritance hierarchy. - * If the Java inheritance parent is not a {@link PersistentType}, then continue - * up the hierarchy (the JPA spec allows non-persistent types to be part of the hierarchy.) - * Return null if the persistent type is the root persistent type. - *

- * Example: - *

-	 * @Entity
-	 * public abstract class Model {}
-	 * 
-	 * public abstract class Animal extends Model {}
-	 * 
-	 * @Entity
-	 * public class Cat extends Animal {}
-	 * 
- * The "super" persistent type of the Cat persistent type is - * the Model persistent type. The "super" persistent type can - * be either a Java annotated class or declared in the XML files. - */ - PersistentType getSuperPersistentType(); - String SUPER_PERSISTENT_TYPE_PROPERTY = "superPersistentType"; //$NON-NLS-1$ - - /** - * Return the persistent type's "persistence" inheritance hierarchy, - * including the persistent type itself. - * The returned iterator will return elements infinitely if the hierarchy - * has a loop. - */ - Iterator inheritanceHierarchy(); - - /** - * Return the persistent type's "persistence" inheritance hierarchy, - * excluding the persistent type itself. - * The returned iterator will return elements infinitely if the hierarchy - * has a loop. - */ - Iterator ancestors(); - - - // ********** validation ********** - - /** - * Add to the list of current validation messages - */ - void validate(List messages, IReporter reporter); - - - // ********** misc ********** - - /** - * Return whether the persistent type applies to the - * specified type name qualified with '.'. - */ - boolean isFor(String typeName); - - /** - * Return true if persistent type resolves to a java class in the given package fragment - */ - boolean isIn(IPackageFragment packageFragment); - - - // ********** owner ********** - - /** - * Return the access type that overrides the client persistent type's - * access type; null if there is no such access override. - */ - AccessType getOwnerOverrideAccess(); - - /** - * Return the client persistent type's default access type; - * null if there is no such access default. - */ - AccessType getOwnerDefaultAccess(); - - - // ********** owner interface ********** - - interface Owner - extends JpaContextNode - { - /** - * Return the access type that overrides the client persistent type's - * access type; null if there is no such access override - */ - AccessType getOverridePersistentTypeAccess(); - - /** - * Return the client persistent type's default access type; - * null if there is no such access default. - */ - AccessType getDefaultPersistentTypeAccess(); - - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumn.java deleted file mode 100644 index a573c26ee5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumn.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * primary key join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public interface PrimaryKeyJoinColumn - extends BaseJoinColumn, ReadOnlyPrimaryKeyJoinColumn -{ - // combine interfaces -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationship.java deleted file mode 100644 index 5fbedec03c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationship.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Primary key join column relationship

    - *
  • 1:1 - *
- *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface PrimaryKeyJoinColumnRelationship - extends Relationship -{ - /** - * Return the (never null) strategy used to configure - * the relationship's primary key join column strategy. - */ - PrimaryKeyJoinColumnRelationshipStrategy getPrimaryKeyJoinColumnStrategy(); - - /** - * Return whether the primary key join column strategy is the - * relationship's current strategy. - */ - boolean strategyIsPrimaryKeyJoinColumn(); - - /** - * Set the relationship's strategy to the primary key join column strategy. - */ - void setStrategyToPrimaryKeyJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationshipStrategy.java deleted file mode 100644 index 0fe8328ec8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/PrimaryKeyJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - -/** - * Primary key join column relationship strategy. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see RelationshipMapping - * @see PrimaryKeyJoinColumnRelationship - * - * @version 2.2 - * @since 2.2 - */ -public interface PrimaryKeyJoinColumnRelationshipStrategy - extends RelationshipStrategy -{ - /** - * Change notification identifier for "primaryKeyJoinColumns" list - */ - String PRIMARY_KEY_JOIN_COLUMNS_LIST = "primaryKeyJoinColumns"; //$NON-NLS-1$ - - /** - * Return the strategy's primary key join columns. - */ - ListIterator primaryKeyJoinColumns(); - - /** - * Return the number of primary key join columns. - */ - int primaryKeyJoinColumnsSize(); - - /** - * Return whether the relationship has any primary key join columns. - * (Equivalent to {@link #primaryKeyJoinColumnsSize()} == 0.) - */ - boolean hasPrimaryKeyJoinColumns(); - - /** - * Return the primary key join column at the specified index. - */ - PrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index); - - /** - * Add a primary key join column. - */ - PrimaryKeyJoinColumn addPrimaryKeyJoinColumn(); - - /** - * Add a primary key join column. - */ - PrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index); - - /** - * Remove the specified primary key join column. - */ - void removePrimaryKeyJoinColumn(int index); - - /** - * Remove the specified primary key join column. - */ - void removePrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumn); - - /** - * Remove the specified primary key join column. - */ - void movePrimaryKeyJoinColumn(int targetIndex, int sourceIndex); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Query.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Query.java deleted file mode 100644 index cbf49207e7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Query.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.Arrays; - -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaQuery; -import org.eclipse.jpt.jpa.core.context.orm.OrmQuery; - -/** - * named and named native queries - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface Query - extends JpaNamedContextNode -{ - /** - * TODO use this precedence until adopters protest... - * then move to JpaPlatform - */ - @SuppressWarnings("unchecked") - Iterable> PRECEDENCE_TYPE_LIST = Arrays.asList( - OrmQuery.class, - JavaQuery.class - ); - - - // ********** query ********** - - String QUERY_PROPERTY = "query"; //$NON-NLS-1$ - - String getQuery(); - - void setQuery(String query); - - - // ********** hints ********** - - String HINTS_LIST = "hints"; //$NON-NLS-1$ - - /** - * Return the query's hints. - */ - ListIterable getHints(); - - /** - * Return the number of hints. - */ - int getHintsSize(); - - /** - * Add a hint to the query and return the object representing it. - */ - QueryHint addHint(); - - /** - * Add a hint to the query and return the object representing it. - */ - QueryHint addHint(int index); - - /** - * Remove the hint at the index from the query. - */ - void removeHint(QueryHint queryHint); - - /** - * Remove the hint from the query. - */ - void removeHint(int index); - - /** - * Move the hint from the source index to the target index. - */ - void moveHint(int targetIndex, int sourceIndex); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryContainer.java deleted file mode 100644 index 681b93fa9c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryContainer.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - -/** - * Container for named queries and/or named native queries. - * Used by entities and the orm.xml - * entity-mappings element. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface QueryContainer - extends JpaContextNode -{ - // ********** named queries ********** - - /** - * Return the container's named queries. - */ - ListIterator namedQueries(); - - String NAMED_QUERIES_LIST = "namedQueries"; //$NON-NLS-1$ - - /** - * Return the number of named queries. - */ - int namedQueriesSize(); - - /** - * Add a new named query to the container and return it. - */ - NamedQuery addNamedQuery(); - - /** - * Add a new named query to the container at the specified index - * and return it. - */ - NamedQuery addNamedQuery(int index); - - /** - * Remove from the container the named query at the specified index. - */ - void removeNamedQuery(int index); - - /** - * Remove the specified named query from the container. - */ - void removeNamedQuery(NamedQuery namedQuery); - - /** - * Move a named query as specified. - */ - void moveNamedQuery(int targetIndex, int sourceIndex); - - - // ********** named native queries ********** - - /** - * Return the container's named native queries. - */ - ListIterator namedNativeQueries(); - - String NAMED_NATIVE_QUERIES_LIST = "namedNativeQueries"; //$NON-NLS-1$ - - /** - * Return the number of named native queries. - */ - int namedNativeQueriesSize(); - - /** - * Add a new named native query to the container and return it. - */ - NamedNativeQuery addNamedNativeQuery(); - - /** - * Add a new named native query to the container at the specified index - * and return it. - */ - NamedNativeQuery addNamedNativeQuery(int index); - - /** - * Remove from the container the named native query at the specified index. - */ - void removeNamedNativeQuery(int index); - - /** - * Remove the specified named native query from the container. - */ - void removeNamedNativeQuery(NamedNativeQuery namedNativeQuery); - - /** - * Move a named native query as specified. - */ - void moveNamedNativeQuery(int targetIndex, int sourceIndex); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryHint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryHint.java deleted file mode 100644 index 6deee9ec1b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/QueryHint.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * query hint - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface QueryHint - extends JpaContextNode -{ - String getName(); - void setName(String name); - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - - String getValue(); - void setValue(String value); - String VALUE_PROPERTY = "value"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAccessHolder.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAccessHolder.java deleted file mode 100644 index 3cc216ecad..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAccessHolder.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import org.eclipse.jpt.common.utility.model.Model; - -/** - * Common interface that can be used by clients interested only in a type - * or attribute's access setting (e.g. a UI composite). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface ReadOnlyAccessHolder - extends Model -{ - /** - * Return the access type, whether specified or defaulted. - * This should never return null since at least the default - * will be set. - */ - AccessType getAccess(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAssociationOverride.java deleted file mode 100644 index a2956964d5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAssociationOverride.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Read-only association override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ReadOnlyAssociationOverride - extends ReadOnlyOverride -{ - AssociationOverrideContainer getContainer(); - - RelationshipMapping getMapping(); - - ReadOnlyOverrideRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAttributeOverride.java deleted file mode 100644 index c82fa690fd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyAttributeOverride.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Read-only attribute override. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ReadOnlyAttributeOverride - extends ReadOnlyOverride -{ - AttributeOverrideContainer getContainer(); - - ReadOnlyColumn getColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseColumn.java deleted file mode 100644 index c4bf083c72..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseColumn.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - - -/** - * Read-only - *

    - *
  • column - *
  • join column - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ReadOnlyBaseColumn - extends ReadOnlyNamedColumn -{ - // ********** table ********** - - String getSpecifiedTable(); - String SPECIFIED_TABLE_PROPERTY = "specifiedTable"; //$NON-NLS-1$ - String getDefaultTable(); - String DEFAULT_TABLE_PROPERTY = "defaultTable"; //$NON-NLS-1$ - - - // ********** unique ********** - - /** - * Return the specified unique setting if present, otherwise return the - * default unique setting. - */ - boolean isUnique(); - Boolean getSpecifiedUnique(); - String SPECIFIED_UNIQUE_PROPERTY = "specifiedUnique"; //$NON-NLS-1$ - boolean isDefaultUnique(); - String DEFAULT_UNIQUE_PROPERTY = "defaultUnique"; //$NON-NLS-1$ - boolean DEFAULT_UNIQUE = false; - - - // ********** nullable ********** - - /** - * Return the specified nullable setting if present, otherwise return the - * default nullable setting. - */ - boolean isNullable(); - Boolean getSpecifiedNullable(); - String SPECIFIED_NULLABLE_PROPERTY = "specifiedNullable"; //$NON-NLS-1$ - boolean isDefaultNullable(); - String DEFAULT_NULLABLE_PROPERTY = "defaultNullable"; //$NON-NLS-1$ - boolean DEFAULT_NULLABLE = true; - - - // ********** insertable ********** - - /** - * Return the specified insertable setting if present, otherwise return the - * default insertable setting. - */ - boolean isInsertable(); - Boolean getSpecifiedInsertable(); - String SPECIFIED_INSERTABLE_PROPERTY = "specifiedInsertable"; //$NON-NLS-1$ - boolean isDefaultInsertable(); - String DEFAULT_INSERTABLE_PROPERTY = "defaultInsertable"; //$NON-NLS-1$ - boolean DEFAULT_INSERTABLE = true; - - - // ********** updatable ********** - - /** - * Return the specified updatable setting if present, otherwise return the - * default updatable setting. - */ - boolean isUpdatable(); - Boolean getSpecifiedUpdatable(); - String SPECIFIED_UPDATABLE_PROPERTY = "specifiedUpdatable"; //$NON-NLS-1$ - boolean isDefaultUpdatable(); - String DEFAULT_UPDATABLE_PROPERTY = "defaultUpdatable"; //$NON-NLS-1$ - boolean DEFAULT_UPDATABLE = true; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseJoinColumn.java deleted file mode 100644 index 41608b1a68..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyBaseJoinColumn.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Read-only - *
    - *
  • join column - *
  • primary key join column - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ReadOnlyBaseJoinColumn - extends ReadOnlyNamedColumn -{ - // ********** referenced column name ********** - - /** - * Return the specified referenced column name if present, - * otherwise return the default referenced column name. - */ - String getReferencedColumnName(); - String getSpecifiedReferencedColumnName(); - String SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY = "specifiedReferencedColumnName"; //$NON-NLS-1$ - String getDefaultReferencedColumnName(); - String DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY = "defaultReferencedColumnName"; //$NON-NLS-1$ - - - // ********** misc ********** - - boolean isDefault(); - - - // ********** owner ********** - - /** - * Interface allowing columns to be used in multiple places - * (e.g. basic mappings and attribute overrides). - */ - interface Owner - extends ReadOnlyNamedColumn.Owner - { - boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn); - - /** - * Return the number of join columns in the owner's list the join - * column belongs to. - */ - int joinColumnsSize(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyColumn.java deleted file mode 100644 index 1ea60e1b64..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyColumn.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Read-only column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ReadOnlyColumn - extends ReadOnlyBaseColumn -{ - // ********** length ********** - - /** - * Return the specified length if present, otherwise return the default length. - */ - int getLength(); - Integer getSpecifiedLength(); - String SPECIFIED_LENGTH_PROPERTY = "specifiedLength"; //$NON-NLS-1$ - int getDefaultLength(); - String DEFAULT_LENGTH_PROPERTY = "defaultLength"; //$NON-NLS-1$ - int DEFAULT_LENGTH = 255; - - - // ********** precision ********** - - /** - * Return the specified precision if present, otherwise return the default precision. - */ - int getPrecision(); - Integer getSpecifiedPrecision(); - String SPECIFIED_PRECISION_PROPERTY = "specifiedPrecision"; //$NON-NLS-1$ - int getDefaultPrecision(); - String DEFAULT_PRECISION_PROPERTY = "defaultPrecision"; //$NON-NLS-1$ - int DEFAULT_PRECISION = 0; - - - // ********** scale ********** - - /** - * Return the specified scale if present, otherwise return the default scale. - */ - int getScale(); - Integer getSpecifiedScale(); - String SPECIFIED_SCALE_PROPERTY = "specifiedScale"; //$NON-NLS-1$ - int getDefaultScale(); - String DEFAULT_SCALE_PROPERTY = "defaultScale"; //$NON-NLS-1$ - int DEFAULT_SCALE = 0; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumn.java deleted file mode 100644 index 170cffca0f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumn.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Read-only join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ReadOnlyJoinColumn - extends ReadOnlyBaseJoinColumn, ReadOnlyBaseColumn -{ - /** - * Interface allowing columns to be used in multiple places - * (e.g. basic mappings and attribute overrides). - */ - interface Owner - extends ReadOnlyBaseJoinColumn.Owner - // ReadOnlyBaseColumn does not define an Owner - { - /** - * The target of the relationship will usually be the target entity. - * In the case of a target foreign key relationship the source and target - * are swapped. - */ - Entity getRelationshipTarget(); - - /** - * return the join column's attribute name - */ - String getAttributeName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationship.java deleted file mode 100644 index bce23660f0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationship.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Join column relationship

    - *
  • 1:1 - *
  • 1:m - *
  • m:1 - *
  • association override - *
- *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see RelationshipMapping - * @see Relationship - * @see JoinColumn - */ -public interface ReadOnlyJoinColumnRelationship - extends ReadOnlyRelationship -{ - /** - * Return the (never null) strategy used to configure - * the relationship's join column strategy. - */ - ReadOnlyJoinColumnRelationshipStrategy getJoinColumnStrategy(); - - /** - * Return whether the join column strategy is the - * relationship's current strategy. - */ - boolean strategyIsJoinColumn(); - - /** - * Return whether this relationship may potentially have a default join - * column. For example, a 1-1 mapping may have a default join column - * if it does not specify a "mapped by" attribute or a join table; - * but a 1-M mapping does not support a default join column in any - * situation. - */ - boolean mayHaveDefaultJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationshipStrategy.java deleted file mode 100644 index 287e821fab..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - - -/** - * Read-only join column relationship strategy. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see ReadOnlyAssociationOverride - * @see JoinColumnRelationship - */ -public interface ReadOnlyJoinColumnRelationshipStrategy - extends ReadOnlyRelationshipStrategy -{ - /** - * The source of the relationship is usually the owning type mapping. - * In the case of a target foreign key relationship the source and target - * are swapped. - * @see #isTargetForeignKey() - */ - TypeMapping getRelationshipSource(); - - /** - * The target of the relationship usually is the target entity. - * In the case of a target foreign key relationship the source and target - * are swapped. - * @see #isTargetForeignKey() - */ - TypeMapping getRelationshipTarget(); - - /** - * Return whether this relationship is a target foreign key relationship. - * A one-to-many mapping with a join column will have the foreign key - * in the target table. - */ - boolean isTargetForeignKey(); - - - // ********** join columns ********** - - /** - * Return the join columns whether specified or default. - */ - ListIterator joinColumns(); - - /** - * Return the number of join columns, whether specified and default. - */ - int joinColumnsSize(); - - - // ********** specified join columns ********** - - /** - * Change notification identifier for "specifiedJoinColumns" list - */ - String SPECIFIED_JOIN_COLUMNS_LIST = "specifiedJoinColumns"; //$NON-NLS-1$ - - /** - * Return the specified join columns. - */ - ListIterator specifiedJoinColumns(); - - /** - * Return the number of specified join columns. - */ - int specifiedJoinColumnsSize(); - - /** - * Return whether the strategy has any specified join columns. - * (Equivalent to {@link #specifiedJoinColumnsSize()} != 0.) - */ - boolean hasSpecifiedJoinColumns(); - - /** - * Return the specified join column at the specified index. - */ - ReadOnlyJoinColumn getSpecifiedJoinColumn(int index); - - - // ********** default join column ********** - - /** - * Change notification identifier for "defaultJoinColumn" property - */ - String DEFAULT_JOIN_COLUMN_PROPERTY = "defaultJoinColumn"; //$NON-NLS-1$ - - /** - * Return the default join column. If there are specified join - * columns, there is no default join column. There are also - * times that there may be no default join column even if there are no - * specified join columns. - */ - ReadOnlyJoinColumn getDefaultJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTable.java deleted file mode 100644 index 838d16c904..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTable.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - -/** - * Used by association overrides. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ReadOnlyJoinTable - extends ReadOnlyReferenceTable -{ - ReadOnlyJoinTableRelationshipStrategy getParent(); - - RelationshipMapping getRelationshipMapping(); - - - // ********** inverse join columns ********** - - /** - * Return the join table's inverse join columns, whether specified or default. - */ - ListIterator inverseJoinColumns(); - - /** - * Return the number of inverse join columns, whether specified or default. - */ - int inverseJoinColumnsSize(); - - /** - * Return the specified inverse join columns. - */ - ListIterator specifiedInverseJoinColumns(); - String SPECIFIED_INVERSE_JOIN_COLUMNS_LIST = "specifiedInverseJoinColumns"; //$NON-NLS-1$ - - /** - * Return the number of specified inverse join columns. - */ - int specifiedInverseJoinColumnsSize(); - - /** - * Return whether the join table has specified inverse join columns. - */ - boolean hasSpecifiedInverseJoinColumns(); - - /** - * Return the specified inverse join column at the specified index. - */ - ReadOnlyJoinColumn getSpecifiedInverseJoinColumn(int index); - - /** - * Return the default inverse join column or null. A default inverse join column - * only exists if there are no specified inverse join columns. - */ - ReadOnlyJoinColumn getDefaultInverseJoinColumn(); - String DEFAULT_INVERSE_JOIN_COLUMN = "defaultInverseJoinColumn"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTableRelationship.java deleted file mode 100644 index 5e09f3e852..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTableRelationship.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Join table relationship

    - *
  • 1:1 (JPA 2.0) - *
  • 1:m - *
  • m:1 (JPA 2.0) - *
  • m:m - *
  • association override (JPA 2.0) - *
- *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ReadOnlyJoinTableRelationship - extends ReadOnlyRelationship -{ - /** - * Return the (never null) strategy used to configure - * the relationship's join table strategy. - */ - ReadOnlyJoinTableRelationshipStrategy getJoinTableStrategy(); - - /** - * Return whether the join table strategy is the - * relationship's current strategy. - */ - boolean strategyIsJoinTable(); - - /** - * Return whether this relationship may potentially have a default join - * table. For example, a M-M mapping may have a default join table - * if it does not specify a "mapped by" attribute or a join table; - * but a M-1 mapping does not support a default join table in any - * situation. - */ - boolean mayHaveDefaultJoinTable(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTableRelationshipStrategy.java deleted file mode 100644 index 7727e9eab2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyJoinTableRelationshipStrategy.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Read-only join table relationship strategy. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see ReadOnlyAssociationOverride - * @see JoinTableRelationship - */ -public interface ReadOnlyJoinTableRelationshipStrategy - extends ReadOnlyRelationshipStrategy -{ - /** - * Change notification identifier for "joinTable" property - */ - String JOIN_TABLE_PROPERTY = "joinTable"; //$NON-NLS-1$ - - /** - * Return the strategy's join table. This will be the - * specified or default join table if one is specified or a default - * join table applies, otherwise null. - */ - ReadOnlyJoinTable getJoinTable(); - - /** - * Return the default name of the strategy's join table - */ - String getJoinTableDefaultName(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyNamedColumn.java deleted file mode 100644 index 09afa25b07..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyNamedColumn.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Read-only - *

    - *
  • column - *
  • join column - *
  • primary key join column - *
  • discriminator column - *
  • order column - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ReadOnlyNamedColumn - extends JpaContextNode -{ - // ********** name ********** - - /** - * Return the specified name if present, otherwise return the default - * name. - */ - String getName(); - String getSpecifiedName(); - String SPECIFIED_NAME_PROPERTY = "specifiedName"; //$NON-NLS-1$ - String getDefaultName(); - String DEFAULT_NAME_PROPERTY = "defaultName"; //$NON-NLS-1$ - - - // ********** table ********** - - /** - * Return the name of the column's table. A column that does not have a - * specified table still has a table (as determined by - * the column's owner). - */ - String getTable(); - - - // ********** column definition ********** - - String getColumnDefinition(); - String COLUMN_DEFINITION_PROPERTY = "columnDefinition"; //$NON-NLS-1$ - - - // ********** owner ********** - - /** - * Interface allowing columns to be used in multiple places - * (e.g. basic mappings and attribute overrides). - */ - interface Owner - { - /** - * Return the type mapping containing the column. - */ - TypeMapping getTypeMapping(); - - /** - * Return the name of the table which the column belongs to by default. - */ - String getDefaultTableName(); - - /** - * Return the default column name. - */ - String getDefaultColumnName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyOverride.java deleted file mode 100644 index f1481d7ede..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyOverride.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Read-only
    - *
  • attribute override - *
  • association override - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ReadOnlyOverride - extends JpaContextNode -{ - OverrideContainer getContainer(); - - String getName(); - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - - /** - * Return true if the override is not explicitly specified on - * the owning object (i.e. it occurs by default); return false - * if the override is explicitly specified on the owning object. - * - * @see Override_#convertToVirtual() - * @see VirtualOverride#convertToSpecified() - */ - boolean isVirtual(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyOverrideRelationship.java deleted file mode 100644 index 82d9a2e076..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyOverrideRelationship.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Read-only association override relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see AssociationOverride - */ -public interface ReadOnlyOverrideRelationship - extends ReadOnlyJoinColumnRelationship -{ - ReadOnlyAssociationOverride getAssociationOverride(); - - void initializeOnSpecified(OverrideRelationship specifiedRelationship); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPersistentAttribute.java deleted file mode 100644 index 2ea0af3151..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPersistentAttribute.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; - -/** - * Read-only context persistent attribute (field or property). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ReadOnlyPersistentAttribute - extends JpaContextNode, JpaStructureNode, ReadOnlyAccessHolder -{ - // ********** name ********** - - String getName(); - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - - - // ********** mapping ********** - - /** - * Return the attribute's mapping. This is never null - * (although, it may be a null mapping). - * Set the mapping via {@link PersistentAttribute#setMappingKey(String)}. - */ - AttributeMapping getMapping(); - String MAPPING_PROPERTY = "mapping"; //$NON-NLS-1$ - - /** - * Return the attribute's mapping key. - */ - String getMappingKey(); - - /** - * Return the key for the attribute's default mapping. - * This can be null (e.g. for specified - * orm.xml attributes). - * @see AttributeMapping#isDefault() - */ - String getDefaultMappingKey(); - String DEFAULT_MAPPING_KEY_PROPERTY = "defaultMappingKey"; //$NON-NLS-1$ - - - // ********** misc ********** - - /** - * Return the persistent type that owns (declares) the attribute. - */ - PersistentType getOwningPersistentType(); - - /** - * Return the attribute's owning persistent type's mapping (as opposed to - * the attribute's target type's mapping). - */ - TypeMapping getOwningTypeMapping(); - - /** - * Return the resolved, qualified name of the attribute's type - * (e.g. "java.util.Collection" or "byte[]"). - * Return null if the attribute's type can not be resolved. - * If the type is an array, this name will include the appropriate number - * of bracket pairs. - * This name will not include the type's generic type arguments - * (e.g. "java.util.Collection" will only return - * "java.util.Collection"). - */ - String getTypeName(); - - /** - * If the attribute is mapped to a primary key column, return the - * column's name, otherwise return null. - */ - String getPrimaryKeyColumnName(); - - /** - * Return whether the attribute has a textual representation - * in its underlying resource. - */ - boolean isVirtual(); - - JavaPersistentAttribute getJavaPersistentAttribute(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPrimaryKeyJoinColumn.java deleted file mode 100644 index 4f41aa63b7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyPrimaryKeyJoinColumn.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Read-only primary key join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ReadOnlyPrimaryKeyJoinColumn - extends ReadOnlyBaseJoinColumn -{ - // nothing yet -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyReferenceTable.java deleted file mode 100644 index ed2fba7080..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyReferenceTable.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - -/** - * Read-only reference table (i.e. a table that joins with one other table, - * as opposed to a "join table" that joins with two other tables)

    - *
  • join table - *
  • collection table - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ReadOnlyReferenceTable - extends ReadOnlyTable -{ - // TODO is this method necessary? - PersistentAttribute getPersistentAttribute(); - - - // ********** join columns ********** - - /** - * Return the reference table's join columns, whether specified or default. - */ - ListIterator joinColumns(); - - /** - * Return the number of join columns, whether specified or default. - */ - int joinColumnsSize(); - - /** - * Return the reference table's specified join columns. - */ - ListIterator specifiedJoinColumns(); - String SPECIFIED_JOIN_COLUMNS_LIST = "specifiedJoinColumns"; //$NON-NLS-1$ - - /** - * Return the number of specified join columns. - */ - int specifiedJoinColumnsSize(); - - /** - * Return whether the reference table has specified join columns. - */ - boolean hasSpecifiedJoinColumns(); - - /** - * Return the specified join column at the specified index. - */ - ReadOnlyJoinColumn getSpecifiedJoinColumn(int index); - - /** - * Return the default join column or null. - * A default join column only exists if there are no specified join columns. - */ - ReadOnlyJoinColumn getDefaultJoinColumn(); - String DEFAULT_JOIN_COLUMN_PROPERTY = "defaultJoinColumn"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyRelationship.java deleted file mode 100644 index aa7b27f25b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyRelationship.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * A relationship contains the settings describing how entities are related - * in a {@link RelationshipMapping} or {@link AssociationOverride}:
    - *
  • join column - *
  • join table - *
  • "mapped by" - *
  • primary key join column - *
- * Supported mappings:
    - *
  • 1:1 - *
  • 1:m - *
  • m:1 - *
  • m:m - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see RelationshipMapping - * @see AssociationOverride - */ -public interface ReadOnlyRelationship - extends JpaContextNode -{ - /** - * Return the relationship's mapping; which for a mapping relationship is - * the relationship's parent, but in the case of an override is the - * overridden mapping (from a superclass or embeddable type). - */ - RelationshipMapping getMapping(); - - /** - * Return the type mapping that contains the relationship's mapping or - * override. - */ - TypeMapping getTypeMapping(); - - /** - * Return the entity that contains the relationship's mapping or override. - * This is just a convenience method that calls {@link #getTypeMapping()} - * and returns null if the result is not an {@link Entity}. - */ - Entity getEntity(); - - /** - * String associated with changes to the predominant strategy property - */ - final static String STRATEGY_PROPERTY = "strategy"; //$NON-NLS-1$ - - /** - * Return the current strategy, this is never null. - */ - ReadOnlyRelationshipStrategy getStrategy(); - - /** - * Return whether the the relationship is virtual. - */ - boolean isVirtual(); - - void initializeOn(Relationship newRelationship); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyRelationshipStrategy.java deleted file mode 100644 index 39b22c7e01..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyRelationshipStrategy.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Strategy describing how two entities are related, either for a - * {@link RelationshipMapping} or an {@link AssociationOverride}:
    - *
  • join column - *
  • join table - *
  • "mapped by" - *
  • primary key join column - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see RelationshipMapping - * @see ReadOnlyAssociationOverride - * @see ReadOnlyRelationship - */ -public interface ReadOnlyRelationshipStrategy - extends JpaContextNode -{ - /** - * Return the strategy's relationship. - */ - ReadOnlyRelationship getRelationship(); - - /** - * Return the table name associated with the strategy's columns. - * The join table name, for instance, or in the case of a bi-directional - * relationship, the table of the owning relationship. - */ - String getTableName(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlySecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlySecondaryTable.java deleted file mode 100644 index 90cd0ada13..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlySecondaryTable.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - -/** - * Read-only entity secondary table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ReadOnlySecondaryTable - extends ReadOnlyTable -{ - public Entity getParent(); - - /** - * Return whether the secondary table is part of an orm.xml - * entity but is specified only in the entity's Java annotations (as - * opposed to explicitly in the orm.xml). - */ - boolean isVirtual(); - - - // ********** primary key join columns ********** - - /** - * Return the secondary table's primary key join columns, - * whether specified or default. - */ - ListIterator primaryKeyJoinColumns(); - - /** - * Return the number of primary key join columns, - * whether specified or default. - */ - int primaryKeyJoinColumnsSize(); - - - // ********** specified primary key join columns ********** - - /** - * Return the specified primary key join columns. - */ - ListIterator specifiedPrimaryKeyJoinColumns(); - String SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST = "specifiedPrimaryKeyJoinColumns"; //$NON-NLS-1$ - - /** - * Return the number of specified primary key join columns. - */ - int specifiedPrimaryKeyJoinColumnsSize(); - - - // ********** default primary key join columns ********** - - /** - * Return the default primary key join column or null. A default primary - * key join column only exists if there are no specified primary key join - * columns. - */ - ReadOnlyPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn(); - String DEFAULT_PRIMARY_KEY_JOIN_COLUMN = "defaultPrimaryKeyJoinColumn"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyTable.java deleted file mode 100644 index 82e86fc3ee..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyTable.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; - -/** - * Read-only table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ReadOnlyTable - extends JpaContextNode -{ - // ********** name ********** - - /** - * Return the specified name if present, otherwise return the default - * name. - */ - String getName(); - String getSpecifiedName(); - String SPECIFIED_NAME_PROPERTY = "specifiedName"; //$NON-NLS-1$ - String getDefaultName(); - String DEFAULT_NAME_PROPERTY = "defaultName"; //$NON-NLS-1$ - - - // ********** schema ********** - - /** - * Return the specified schema if present, otherwise return the default - * schema. - */ - String getSchema(); - String getSpecifiedSchema(); - String SPECIFIED_SCHEMA_PROPERTY = "specifiedSchema"; //$NON-NLS-1$ - String getDefaultSchema(); - String DEFAULT_SCHEMA_PROPERTY = "defaultSchema"; //$NON-NLS-1$ - - - // ********** catalog ********** - - /** - * Return the specified catalog if present, otherwise return the default - * catalog. - */ - String getCatalog(); - String getSpecifiedCatalog(); - String SPECIFIED_CATALOG_PROPERTY = "specifiedCatalog"; //$NON-NLS-1$ - String getDefaultCatalog(); - String DEFAULT_CATALOG_PROPERTY = "defaultCatalog"; //$NON-NLS-1$ - - - // ********** unique constraints ********** - - ListIterator uniqueConstraints(); - String UNIQUE_CONSTRAINTS_LIST = "uniqueConstraints"; //$NON-NLS-1$ - int uniqueConstraintsSize(); - ReadOnlyUniqueConstraint getUniqueConstraint(int index); - - - // ********** database ********** - - /** - * Return the corresponding database table. - */ - org.eclipse.jpt.jpa.db.Table getDbTable(); - - /** - * Return the corresponding database schema. - */ - Schema getDbSchema(); - - /** - * Return the corresponding database catalog. - */ - Catalog getDbCatalog(); - - /** - * Return the corresponding database schema container (catalog or database). - */ - SchemaContainer getDbSchemaContainer(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyUniqueConstraint.java deleted file mode 100644 index e98d8b0317..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReadOnlyUniqueConstraint.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Read-only database unique constraint - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface ReadOnlyUniqueConstraint - extends JpaContextNode -{ - /** - * Return the unique constraint's column names. - */ - Iterable getColumnNames(); - String COLUMN_NAMES_LIST = "columnNames"; //$NON-NLS-1$ - - /** - * Return the number of column names in the unique constraint. - */ - int getColumnNamesSize(); - - /** - * Return the column name at the specified index. - */ - String getColumnName(int index); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReferenceTable.java deleted file mode 100644 index 7a210e7036..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/ReferenceTable.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - -/** - * Reference table (i.e. a table that joins with one other table, - * as opposed to a "join table" that joins with two other tables)

    - *
  • join table - *
  • collection table - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface ReferenceTable - extends Table, ReadOnlyReferenceTable -{ - // ********** join columns ********** - - /** - * Convert the reference table's default join column to a specified join column. - */ - void convertDefaultToSpecifiedJoinColumn(); - - ListIterator joinColumns(); - - ListIterator specifiedJoinColumns(); - - JoinColumn getSpecifiedJoinColumn(int index); - - /** - * Add and return a specified join column to the reference table. - */ - JoinColumn addSpecifiedJoinColumn(); - - /** - * Add and return a specified join column to the reference table. - */ - JoinColumn addSpecifiedJoinColumn(int index); - - /** - * Remove the join column at the specified index from the reference table. - */ - void removeSpecifiedJoinColumn(int index); - - /** - * Remove the specified join column from the reference table. - */ - void removeSpecifiedJoinColumn(JoinColumn joinColumn); - - /** - * Move the join column at the specified source index to the - * specified target index. - */ - void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex); - - JoinColumn getDefaultJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Relationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Relationship.java deleted file mode 100644 index 53b2c5b4d9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Relationship.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see RelationshipMapping - * @see AssociationOverride - * - * @version 2.3 - * @since 2.2 - */ -public interface Relationship - extends ReadOnlyRelationship -{ - RelationshipStrategy getStrategy(); - - - // ********** conversions ********** - - void initializeFrom(ReadOnlyRelationship oldRelationship); - - void initializeFromMappedByRelationship(MappedByRelationship oldRelationship); - - void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship); - - void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship); - - // we only have a single "client" of the primary key relationship (1:1 mapping) -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java deleted file mode 100644 index 5bfecd7f7e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipMapping.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.Iterator; - -/** - * JPA relationship (1:1, 1:m, m:1, m:m) mapping. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface RelationshipMapping - extends FetchableMapping -{ - /** - * Return the meta-information used to populate the entities of the - * relationship - */ - MappingRelationship getRelationship(); - - /** - * Return the relationship owner or null if this is the owning side - * or it is a unidirectional mapping. - */ - RelationshipMapping getRelationshipOwner(); - - - // **************** target entity ************************************** - - String getTargetEntity(); - - String getSpecifiedTargetEntity(); - void setSpecifiedTargetEntity(String value); - String SPECIFIED_TARGET_ENTITY_PROPERTY = "specifiedTargetEntity"; //$NON-NLS-1$ - - String getDefaultTargetEntity(); - String DEFAULT_TARGET_ENTITY_PROPERTY = "defaultTargetEntity"; //$NON-NLS-1$ - - Entity getResolvedTargetEntity(); - - /** - * Return all attribute names on the target entity, provided target entity - * resolves - */ - Iterator allTargetEntityAttributeNames(); - - /** - * Return the char to be used for browsing or creating the target entity IType. - * @see org.eclipse.jdt.core.IType#getFullyQualifiedName(char) - */ - char getTargetEntityEnclosingTypeSeparator(); - - // **************** cascade ************************************** - - Cascade getCascade(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipStrategy.java deleted file mode 100644 index de6411800c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/RelationshipStrategy.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import org.eclipse.jpt.jpa.db.Table; - -/** - * Strategy describing how two entities are joined, either for a - * {@link RelationshipMapping} or an {@link AssociationOverride}:

    - *
  • join column - *
  • join table - *
  • "mapped by" - *
  • primary key join column - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see RelationshipMapping - * @see AssociationOverride - * @see Relationship - * - * @version 2.3 - * @since 2.2 - */ -public interface RelationshipStrategy - extends ReadOnlyRelationshipStrategy -{ - Relationship getRelationship(); - - /** - * Add this strategy to the relationship. - */ - void addStrategy(); - - /** - * Remove this strategy from the relationship. - */ - void removeStrategy(); - - /** - * Return whether the relationship's mapping can be overridden with an - * association override. - */ - boolean isOverridable(); - - /** - * Return the database table for the specified table name. - */ - Table resolveDbTable(String tableName); - - /** - * Return whether the specified table cannot be explicitly specified - * in the column's table element. - */ - boolean tableNameIsInvalid(String tableName); - - /** - * Return a message description used when the column's table is not valid - * in this context. This will be passed in as a parameter to a validation - * message. Here is an example where the description is what is returned - * by the implementation: - *

location: - * Table "table name" for map key column "column name" - *

description: - * does not match join table - */ - String getColumnTableNotValidDescription(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SecondaryTable.java deleted file mode 100644 index bdcdac8846..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SecondaryTable.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - -/** - * entity secondary table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface SecondaryTable - extends Table, ReadOnlySecondaryTable -{ - ListIterator primaryKeyJoinColumns(); - ListIterator specifiedPrimaryKeyJoinColumns(); - PrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn(); - - /** - * Add a specified primary key join column to the secondary table. - * Return the newly-created primary key join column. - */ - PrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(); - - /** - * Add a specified primary key join column to the secondary table. - * Return the newly-created primary key join column. - */ - PrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index); - - /** - * Remove the specified primary key join column at the specified index from - * the secondary table. - */ - void removeSpecifiedPrimaryKeyJoinColumn(int index); - - /** - * Remove the specified primary key join column from the secondary table. - */ - void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn pkJoinColumn); - - /** - * Move the specified primary key join column from the specified source - * index to the specified target index. - */ - void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SequenceGenerator.java deleted file mode 100644 index fd164b1e86..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SequenceGenerator.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * sequence generator - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface SequenceGenerator - extends Generator -{ - int DEFAULT_INITIAL_VALUE = 1; - - - // ********** sequence name ********** - - /** - * Return the specified sequence name if present, otherwise return the - * default sequence name. - */ - String getSequenceName(); - String getSpecifiedSequenceName(); - void setSpecifiedSequenceName(String value); - String SPECIFIED_SEQUENCE_NAME_PROPERTY = "specifiedSequenceName"; //$NON-NLS-1$ - String getDefaultSequenceName(); - String DEFAULT_SEQUENCE_NAME_PROPERTY = "defaultSequenceName"; //$NON-NLS-1$ - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SingleRelationshipMapping.java deleted file mode 100644 index 8a448c464c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/SingleRelationshipMapping.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA single (m:1, 1:2) mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface SingleRelationshipMapping - extends RelationshipMapping, OptionalMapping -{ - FetchType DEFAULT_FETCH_TYPE = FetchType.EAGER; -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Table.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Table.java deleted file mode 100644 index c475063105..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/Table.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; - -/** - *

    - *
  • table - *
  • secondary table - *
  • join table - *
  • collection table - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface Table - extends ReadOnlyTable -{ - void setSpecifiedName(String value); - - void setSpecifiedSchema(String value); - - void setSpecifiedCatalog(String value); - - ListIterator uniqueConstraints(); - UniqueConstraint getUniqueConstraint(int index); - UniqueConstraint addUniqueConstraint(); - UniqueConstraint addUniqueConstraint(int index); - void removeUniqueConstraint(int index); - void removeUniqueConstraint(UniqueConstraint uniqueConstraint); - void moveUniqueConstraint(int targetIndex, int sourceIndex); - - - // ********** misc ********** - - /** - * Return whether the table is specified in the - * (Java or XML) resource. - */ - boolean isSpecifiedInResource(); - - /** - * Return whether the table can be resolved to a table on the database. - */ - boolean isResolved(); - - /** - * Return whether the table's schema can be resolved to a schema on the - * database. - */ - boolean schemaIsResolved(); - - /** - * Return whether the table has a catalog and it can be resolved to a - * catalog on the database. - */ - boolean catalogIsResolved(); - - /** - * Return whether the table is validated against a live database connection. - */ - boolean validatesAgainstDatabase(); - - /** - * interface allowing columns to be used in multiple places - * (e.g. basic mappings and attribute overrides) - */ - interface Owner - { - JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TableGenerator.java deleted file mode 100644 index 13a2fad455..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TableGenerator.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import org.eclipse.jpt.jpa.db.Table; - -/** - * table generator - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface TableGenerator - extends Generator -{ - int DEFAULT_INITIAL_VALUE = 0; - - - // ********** table ********** - - /** - * Return the specified table if present, otherwise return the default - * table. - */ - String getTable(); - String getSpecifiedTable(); - void setSpecifiedTable(String value); - String SPECIFIED_TABLE_PROPERTY = "specifiedTable"; //$NON-NLS-1$ - String getDefaultTable(); - String DEFAULT_TABLE_PROPERTY = "defaultTable"; //$NON-NLS-1$ - - - // ********** schema ********** - - /** - * Return the specified schema if present, otherwise return the default - * schema. - */ - String getSchema(); - String getSpecifiedSchema(); - void setSpecifiedSchema(String value); - String SPECIFIED_SCHEMA_PROPERTY = "specifiedSchema"; //$NON-NLS-1$ - String getDefaultSchema(); - String DEFAULT_SCHEMA_PROPERTY = "defaultSchema"; //$NON-NLS-1$ - - - // ********** catalog ********** - - /** - * Return the specified catalog if present, otherwise return the default - * catalog. - */ - String getCatalog(); - String getSpecifiedCatalog(); - void setSpecifiedCatalog(String value); - String SPECIFIED_CATALOG_PROPERTY = "specifiedCatalog"; //$NON-NLS-1$ - String getDefaultCatalog(); - String DEFAULT_CATALOG_PROPERTY = "defaultCatalog"; //$NON-NLS-1$ - - - // ********** primary key column name ********** - - /** - * Return the specified primary key colum name if present, otherwise return - * the default primary key colum name. - */ - String getPkColumnName(); - String getSpecifiedPkColumnName(); - void setSpecifiedPkColumnName(String value); - String SPECIFIED_PK_COLUMN_NAME_PROPERTY = "specifiedPkColumnName"; //$NON-NLS-1$ - String getDefaultPkColumnName(); - String DEFAULT_PK_COLUMN_NAME_PROPERTY = "defaultPkColumnName"; //$NON-NLS-1$ - - - // ********** value column name ********** - - /** - * Return the specified value colum name if present, otherwise return - * the default value colum name. - */ - String getValueColumnName(); - String getSpecifiedValueColumnName(); - void setSpecifiedValueColumnName(String value); - String SPECIFIED_VALUE_COLUMN_NAME_PROPERTY = "specifiedValueColumnName"; //$NON-NLS-1$ - String getDefaultValueColumnName(); - String DEFAULT_VALUE_COLUMN_NAME_PROPERTY = "defaultValueColumnName"; //$NON-NLS-1$ - - - // ********** primary key column value ********** - - /** - * Return the specified primary key colum value if present, otherwise return - * the default primary key colum value. - */ - String getPkColumnValue(); - String getSpecifiedPkColumnValue(); - void setSpecifiedPkColumnValue(String value); - String SPECIFIED_PK_COLUMN_VALUE_PROPERTY = "specifiedPkColummValue"; //$NON-NLS-1$ - String getDefaultPkColumnValue(); - String DEFAULT_PK_COLUMN_VALUE_PROPERTY = "defaultPkColummValue"; //$NON-NLS-1$ - - - // ********** unique constraints ********** - - Iterable getUniqueConstraints(); - int getUniqueConstraintsSize(); - UniqueConstraint addUniqueConstraint(); - UniqueConstraint addUniqueConstraint(int index); - void removeUniqueConstraint(int index); - void removeUniqueConstraint(UniqueConstraint uniqueConstraint); - void moveUniqueConstraint(int targetIndex, int sourceIndex); - String UNIQUE_CONSTRAINTS_LIST = "uniqueConstraints"; //$NON-NLS-1$ - - - // ********** database stuff ********** - - /** - * Return the generator's database table. - * Return null if the generator's table (name) is invalid. - */ - Table getDbTable(); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TemporalConverter.java deleted file mode 100644 index 7a651dc6fa..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TemporalConverter.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA temporal converter - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.1 - */ -public interface TemporalConverter - extends Converter -{ - TemporalType getTemporalType(); - void setTemporalType(TemporalType temporalType); - String TEMPORAL_TYPE_PROPERTY = "temporalType"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TemporalType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TemporalType.java deleted file mode 100644 index 63b0fd27a3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TemporalType.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Temporal Type - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public enum TemporalType { - - DATE( - org.eclipse.jpt.jpa.core.resource.java.TemporalType.DATE, - org.eclipse.jpt.jpa.core.resource.orm.TemporalType.DATE - ), - TIME( - org.eclipse.jpt.jpa.core.resource.java.TemporalType.TIME, - org.eclipse.jpt.jpa.core.resource.orm.TemporalType.TIME - ), - TIMESTAMP( - org.eclipse.jpt.jpa.core.resource.java.TemporalType.TIMESTAMP, - org.eclipse.jpt.jpa.core.resource.orm.TemporalType.TIMESTAMP - ); - - - private org.eclipse.jpt.jpa.core.resource.java.TemporalType javaTemporalType; - private org.eclipse.jpt.jpa.core.resource.orm.TemporalType ormTemporalType; - - TemporalType(org.eclipse.jpt.jpa.core.resource.java.TemporalType javaTemporalType, org.eclipse.jpt.jpa.core.resource.orm.TemporalType ormTemporalType) { - if (javaTemporalType == null) { - throw new NullPointerException(); - } - if (ormTemporalType == null) { - throw new NullPointerException(); - } - this.javaTemporalType = javaTemporalType; - this.ormTemporalType = ormTemporalType; - } - - public org.eclipse.jpt.jpa.core.resource.java.TemporalType getJavaTemporalType() { - return this.javaTemporalType; - } - - public org.eclipse.jpt.jpa.core.resource.orm.TemporalType getOrmTemporalType() { - return this.ormTemporalType; - } - - - // ********** static methods ********** - - public static TemporalType fromJavaResourceModel(org.eclipse.jpt.jpa.core.resource.java.TemporalType javaTemporalType) { - return (javaTemporalType == null) ? null : fromJavaResourceModel_(javaTemporalType); - } - - private static TemporalType fromJavaResourceModel_(org.eclipse.jpt.jpa.core.resource.java.TemporalType javaTemporalType) { - for (TemporalType temporalType : TemporalType.values()) { - if (temporalType.getJavaTemporalType() == javaTemporalType) { - return temporalType; - } - } - return null; - } - - public static org.eclipse.jpt.jpa.core.resource.java.TemporalType toJavaResourceModel(TemporalType temporalType) { - return (temporalType == null) ? null : temporalType.getJavaTemporalType(); - } - - public static TemporalType fromOrmResourceModel(org.eclipse.jpt.jpa.core.resource.orm.TemporalType ormTemporalType) { - return (ormTemporalType == null) ? null : fromOrmResourceModel_(ormTemporalType); - } - - private static TemporalType fromOrmResourceModel_(org.eclipse.jpt.jpa.core.resource.orm.TemporalType ormTemporalType) { - for (TemporalType temporalType : TemporalType.values()) { - if (temporalType.getOrmTemporalType() == ormTemporalType) { - return temporalType; - } - } - return null; - } - - public static org.eclipse.jpt.jpa.core.resource.orm.TemporalType toOrmResourceModel(TemporalType temporalType) { - return (temporalType == null) ? null : temporalType.getOrmTemporalType(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TransientMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TransientMapping.java deleted file mode 100644 index b6d759493d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TransientMapping.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA transient "mapping". Because of default mappings, attributes must be - * explicitly marked "transient" if they are not to be mapped to the database. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public interface TransientMapping - extends AttributeMapping -{ - // nothing yet -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TypeMapping.java deleted file mode 100644 index 7786bc9bdb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/TypeMapping.java +++ /dev/null @@ -1,200 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.Iterator; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.db.Schema; - -/** - * type mapping:

    - *
  • entity - *
  • mapped superclass - *
  • embeddable - *
- * Provisional API: This interface is part of an interim API that is still under - * development and expected to change significantly before reaching stability. - * It is available at this early stage to solicit feedback from pioneering - * adopters on the understanding that any code that uses this API will almost - * certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface TypeMapping - extends JpaContextNode -{ - PersistentType getPersistentType(); - - /** - * Return a unique key for the type mapping. If this is defined in an - * extension they should be equal. - */ - String getKey(); - - /** - * Return the name, specified or default if not specified. - */ - String getName(); - - boolean isMapped(); - - /** - * Return the resolved id class specified on this type mapping, null otherwise - */ - JavaPersistentType getIdClass(); - - - // ********** inheritance ********** - - /** - * Return the type mapping of this type mapping's super type. - * Return null if this is the root. - */ - TypeMapping getSuperTypeMapping(); - - /** - * Return the type mapping's "persistence" inheritance hierarchy, - * including the type mapping itself. - * The returned iterator will return elements infinitely if the hierarchy - * has a loop. - */ - Iterator inheritanceHierarchy(); - - - // ********** tables ********** - - /** - * Return the type mapping's primary table name. - * Return null if a primary table is not applicable. - */ - String getPrimaryTableName(); - - /** - * Return the type mapping's primary database table. - * Return null if a primary table is not applicable. - */ - org.eclipse.jpt.jpa.db.Table getPrimaryDbTable(); - - Schema getDbSchema(); - - /** - * Return the type mapping's "associated" tables, which includes the primary - * table and the collection of secondary tables. - */ - Iterator associatedTables(); - - /** - * Return the type mapping's "associated" tables, which includes the primary - * table and the collection of secondary tables, as well as all inherited - * "associated" tables. - */ - Iterator allAssociatedTables(); - - /** - * Return the names of the type mapping's "associated" tables, which - * includes the primary table and the collection of secondary tables, as - * well as all the inherited "associated" tables. - */ - Iterator allAssociatedTableNames(); - - /** - * Return the resolved associated db table with the specified name. - */ - org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName); - - /** - * Return whether the specified table is invalid for any annotations - * associated with the type mapping. - */ - boolean tableNameIsInvalid(String tableName); - - - // ********** mappings ********** - - /** - * A convenience method for getting the attribute mappings from PersistentType.attributes() - */ - Iterator attributeMappings(); - - /** - * Return attribute mappings of a particular mapping type that are declared on this type mapping - */ - Iterable getAttributeMappings(String mappingKey); - - /** - * Return all the attribute mappings in the type mapping's - * inheritance hierarchy. - */ - Iterator allAttributeMappings(); - - /** - * Return attribute mappings of a particular mapping type that are declared anywhere on this - * type mapping's hierarchy - */ - Iterable getAllAttributeMappings(String mappingKey); - - /** - * Return whether the given attribute mapping key is valid for this - * particular type mapping (for example, id's are not valid for an - * embeddable type mapping) - */ - boolean attributeMappingKeyAllowed(String attributeMappingKey); - - - // ********** attribute overrides ********** - - /** - * Return an Iterator of attribute names that can be overridden by a - * sub type mapping. - */ - Iterator overridableAttributeNames(); - - /** - * Return an Iterator of all attribute names that can be overridden in this - * type mapping. - */ - Iterator allOverridableAttributeNames(); - - /** - * Return the column of the overridable attribute mapping (or attribute - * override) with the specified attribute name. - *

- * In JPA 2.0 this name can use dot-notation to designate nested attributes - * in embedded attribute mapping's embeddable type mapping. - */ - Column resolveOverriddenColumn(String attributeName); - - - // ********** association overrides ********** - - /** - * Return an Iterator of associations names that can be overridden in this - * type mapping. - */ - Iterator overridableAssociationNames(); - - /** - * Return an Iterator of all associations names that can be overridden in this - * type mapping. - */ - Iterator allOverridableAssociationNames(); - - Relationship resolveOverriddenRelationship(String attributeName); - - - // ********** validation ********** - - /** - * Return whether any database metadata specific validation should occur. - * (For instance, if the connection is not active, then it should not.) - */ - boolean validatesAgainstDatabase(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/UniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/UniqueConstraint.java deleted file mode 100644 index 3b6fa6241b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/UniqueConstraint.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.Iterator; - -/** - * database unique constraint - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface UniqueConstraint - extends ReadOnlyUniqueConstraint -{ - void initializeFrom(ReadOnlyUniqueConstraint oldUniqueConstraint); - - - // ********** column names ********** - - /** - * Add the specified column name to the end of the - * unique constraint's list of column names. - */ - void addColumnName(String columnName); - - /** - * Add the specified column name to the - * unique constraint's list of column names - * at the specified index. - */ - void addColumnName(int index, String columnName); - - /** - * Remove the specified column name from the - * unique constraint's list of column names. - */ - void removeColumnName(String columnName); - - /** - * Remove the column name at the specified index from the - * unique constraint's list of column names. - */ - void removeColumnName(int index); - - /** - * Move the column name at the specified source index - * to the specified target index in the - * unique constraint's list of column names. - */ - void moveColumnName(int targetIndex, int sourceIndex); - - - // ********** owner ********** - - /** - * All containers must implement this interface. - */ - interface Owner { - Iterator candidateUniqueConstraintColumnNames(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VersionMapping.java deleted file mode 100644 index 7f6bf33c43..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VersionMapping.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * JPA version mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface VersionMapping - extends ColumnMapping, ConvertibleMapping -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualAssociationOverride.java deleted file mode 100644 index 32aefc25da..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualAssociationOverride.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Virtual association override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualAssociationOverride - extends VirtualOverride, ReadOnlyAssociationOverride -{ - AssociationOverride convertToSpecified(); - - VirtualOverrideRelationship getRelationship(); - - Relationship resolveOverriddenRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualAttributeOverride.java deleted file mode 100644 index ba2787c54f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualAttributeOverride.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Virtual attribute override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualAttributeOverride - extends VirtualOverride, ReadOnlyAttributeOverride -{ - AttributeOverride convertToSpecified(); - - VirtualColumn getColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualBaseColumn.java deleted file mode 100644 index 7d956dc5fc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualBaseColumn.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Virtual - *

    - *
  • column - *
  • join column - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualBaseColumn - extends VirtualNamedColumn, ReadOnlyBaseColumn -{ - BaseColumn getOverriddenColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualBaseJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualBaseJoinColumn.java deleted file mode 100644 index 2eabed2eb4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualBaseJoinColumn.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Virtual join column (no virtual primary key join columns yet) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualBaseJoinColumn - extends VirtualNamedColumn, ReadOnlyBaseJoinColumn -{ - BaseJoinColumn getOverriddenColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualColumn.java deleted file mode 100644 index 43486daa38..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualColumn.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Virtual column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualColumn - extends VirtualBaseColumn, ReadOnlyColumn -{ - Column getOverriddenColumn(); - - - // ********** owner ********** - - /** - * Interface allowing the virtual column to be get the column it overrides. - */ - interface Owner - extends ReadOnlyColumn.Owner - { - /** - * Return the column overridden by the virtual column. - */ - Column resolveOverriddenColumn(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumn.java deleted file mode 100644 index a49d3ef972..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumn.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Virtual join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualJoinColumn - extends VirtualBaseJoinColumn, VirtualBaseColumn, ReadOnlyJoinColumn -{ - JoinColumn getOverriddenColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationship.java deleted file mode 100644 index eb9019d98c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationship.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Virtual join column relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualJoinColumnRelationship - extends ReadOnlyJoinColumnRelationship, - VirtualRelationship -{ - VirtualJoinColumnRelationshipStrategy getJoinColumnStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationshipStrategy.java deleted file mode 100644 index 985be639ce..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - -/** - * Virtual join column relationship strategy. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualJoinColumnRelationshipStrategy - extends ReadOnlyJoinColumnRelationshipStrategy, VirtualRelationshipStrategy -{ - ListIterator joinColumns(); - ListIterator specifiedJoinColumns(); - VirtualJoinColumn getSpecifiedJoinColumn(int index); - VirtualJoinColumn getDefaultJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTable.java deleted file mode 100644 index 16b9f1dc39..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTable.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - -/** - * Used by association overrides. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualJoinTable - extends VirtualReferenceTable, ReadOnlyJoinTable -{ - VirtualJoinTableRelationshipStrategy getParent(); - - ListIterator inverseJoinColumns(); - ListIterator specifiedInverseJoinColumns(); - VirtualJoinColumn getSpecifiedInverseJoinColumn(int index); - VirtualJoinColumn getDefaultInverseJoinColumn(); - - JoinTable getOverriddenTable(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTableRelationship.java deleted file mode 100644 index 8f322197d3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTableRelationship.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Virtual join table relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualJoinTableRelationship - extends ReadOnlyJoinTableRelationship, - VirtualRelationship -{ - VirtualJoinTableRelationshipStrategy getJoinTableStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTableRelationshipStrategy.java deleted file mode 100644 index 94c9901b64..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualJoinTableRelationshipStrategy.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Virtual join table relationship strategy. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualJoinTableRelationshipStrategy - extends ReadOnlyJoinTableRelationshipStrategy, VirtualRelationshipStrategy -{ - VirtualJoinTable getJoinTable(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualNamedColumn.java deleted file mode 100644 index 175e487a12..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualNamedColumn.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Virtual - *

    - *
  • column - *
  • join column - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualNamedColumn - extends ReadOnlyNamedColumn -{ - /** - * Return the virtual column's wrapped column. - */ - NamedColumn getOverriddenColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualOverride.java deleted file mode 100644 index 791c6aac1a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualOverride.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Virtual
    - *
  • attribute override - *
  • association override - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualOverride - extends ReadOnlyOverride -{ - /** - * Convert the virtual override to a specified override. - * Return the new override. - * @see #isVirtual() - */ - Override_ convertToSpecified(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualOverrideRelationship.java deleted file mode 100644 index 728eed9a15..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualOverrideRelationship.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Virtual association override relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @see AssociationOverride - */ -public interface VirtualOverrideRelationship - extends ReadOnlyOverrideRelationship, - VirtualJoinColumnRelationship -{ - VirtualAssociationOverride getAssociationOverride(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualPrimaryKeyJoinColumn.java deleted file mode 100644 index 4a2ef7c118..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualPrimaryKeyJoinColumn.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Virtual primary key join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualPrimaryKeyJoinColumn - extends VirtualBaseJoinColumn, ReadOnlyPrimaryKeyJoinColumn -{ - PrimaryKeyJoinColumn getOverriddenColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualReferenceTable.java deleted file mode 100644 index 1d14fdbadf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualReferenceTable.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - -/** - * Virtual reference table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualReferenceTable - extends VirtualTable, ReadOnlyReferenceTable -{ - ListIterator joinColumns(); - ListIterator specifiedJoinColumns(); - VirtualJoinColumn getSpecifiedJoinColumn(int index); - VirtualJoinColumn getDefaultJoinColumn(); - - ReferenceTable getOverriddenTable(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualRelationship.java deleted file mode 100644 index bc64dc7c0e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualRelationship.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Virtual relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualRelationship - extends ReadOnlyRelationship -{ - VirtualRelationshipStrategy getStrategy(); - - Relationship resolveOverriddenRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualRelationshipStrategy.java deleted file mode 100644 index 0d9570d197..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualRelationshipStrategy.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Virtual strategy - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualRelationshipStrategy - extends ReadOnlyRelationshipStrategy -{ - VirtualRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualSecondaryTable.java deleted file mode 100644 index 2251a30bce..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualSecondaryTable.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - -/** - * Virtual secondary table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualSecondaryTable - extends VirtualTable, ReadOnlySecondaryTable -{ - ListIterator primaryKeyJoinColumns(); - ListIterator specifiedPrimaryKeyJoinColumns(); - VirtualPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn(); - - SecondaryTable getOverriddenTable(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualTable.java deleted file mode 100644 index e168fa3985..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualTable.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.ListIterator; - -/** - * Virtual table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualTable - extends ReadOnlyTable -{ - ListIterator uniqueConstraints(); - VirtualUniqueConstraint getUniqueConstraint(int index); - - Table getOverriddenTable(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualUniqueConstraint.java deleted file mode 100644 index 32b9128a1d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/VirtualUniqueConstraint.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -/** - * Virtual database unique constraint - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface VirtualUniqueConstraint - extends ReadOnlyUniqueConstraint -{ - /** - * Return the wrapped unique constraint. - */ - UniqueConstraint getOverriddenUniqueConstraint(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlContextNode.java deleted file mode 100644 index 5ff9c36b37..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlContextNode.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import java.util.List; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * XML JPA context node - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.1 - */ -public interface XmlContextNode - extends JpaContextNode -{ -// TODO bjv rename to XmlJpaContextNode - /** - * Add to the list of current validation messages - */ - void validate(List messages, IReporter reporter); - - TextRange getValidationTextRange(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java deleted file mode 100644 index f413d9d170..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/XmlFile.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context; - -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; - -/** - * Context representation of any JPA XML file. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface XmlFile - extends XmlContextNode, JpaStructureNode -{ - /** - * Return the resource model object - */ - JpaXmlResource getXmlResource(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/DefaultJavaAttributeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/DefaultJavaAttributeMappingDefinition.java deleted file mode 100644 index 94676c16d0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/DefaultJavaAttributeMappingDefinition.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -public interface DefaultJavaAttributeMappingDefinition - extends JavaAttributeMappingDefinition -{ - /** - * Return whether the definition's mapping is the "default" mapping for the - * specified persistent attribute. - */ - boolean isDefault(JavaPersistentAttribute persistentAttribute); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JarFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JarFile.java deleted file mode 100644 index fb16f1d95f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JarFile.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.Iterator; -import java.util.List; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.context.JpaContextNode; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * A JAR file identified by a persistence.xml jar-file element. - * This holds persistent types corresponding to all the "persistable" types - * discovered in the JAR. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.2 - */ -public interface JarFile - extends JpaContextNode, JpaStructureNode, PersistentTypeContainer -{ - JavaResourcePackageFragmentRoot getJarResourcePackageFragmentRoot(); - - - // ********** Java persistent types ********** - - /** - * Return the JAR file's Java persistent types. - * Return only the types that are annotated with JPA annotations. - */ - Iterator javaPersistentTypes(); - String JAVA_PERSISTENT_TYPES_COLLECTION = "javaPersistentTypes"; //$NON-NLS-1$ - - /** - * Return the size of the JAR file's Java persistent types. - */ - int javaPersistentTypesSize(); - - /** - * Return the persistent type with the specified name. - * Return null if the persistent type is not found. - */ - PersistentType getPersistentType(String typeName); - - - // ********** validation ********** - - /** - * Add to the list of current validation messages - */ - void validate(List messages, IReporter reporter); - - /** - * Return true if this jar file exists in the given folder - */ - boolean isIn(IFolder folder); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverride.java deleted file mode 100644 index 1ceb4e962a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverride.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.AssociationOverride; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation; - -/** - * Java association override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaAssociationOverride - extends JavaReadOnlyAssociationOverride, AssociationOverride, JavaOverride -{ - JavaVirtualAssociationOverride convertToVirtual(); - - AssociationOverrideAnnotation getOverrideAnnotation(); - - JavaOverrideRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverrideContainer.java deleted file mode 100644 index b43e2ee1de..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAssociationOverrideContainer.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.VirtualOverride; - -/** - * Java association override container - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface JavaAssociationOverrideContainer - extends AssociationOverrideContainer, JavaOverrideContainer -{ - ListIterator overrides(); - JavaReadOnlyAssociationOverride getOverrideNamed(String name); - ListIterator specifiedOverrides(); - JavaAssociationOverride getSpecifiedOverride(int index); - JavaAssociationOverride getSpecifiedOverrideNamed(String name); - ListIterator virtualOverrides(); - JavaVirtualAssociationOverride convertOverrideToVirtual(Override_ specifiedOverride); - JavaAssociationOverride convertOverrideToSpecified(VirtualOverride virtualOverride); - - - // ********** owner ********** - - interface Owner - extends AssociationOverrideContainer.Owner, JavaOverrideContainer.Owner - { - // combine two interfaces - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMapping.java deleted file mode 100644 index 0a438ef690..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMapping.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * Java attribute mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaAttributeMapping - extends AttributeMapping, JavaJpaContextNode -{ - JavaPersistentAttribute getParent(); - - JavaPersistentAttribute getPersistentAttribute(); - - JavaResourcePersistentAttribute getResourcePersistentAttribute(); - - Annotation getMappingAnnotation(); - - Annotation getAnnotationForUpdate(); - - void updateDefault(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMappingDefinition.java deleted file mode 100644 index 887a8d2d89..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeMappingDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.JpaFactory; - -/** - * Map a string key to an attribute mapping and its corresponding - * Java annotations. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface JavaAttributeMappingDefinition -{ - /** - * Return the attribute mapping's key. - */ - String getKey(); - - /** - * Return the name of the attribute mapping's annotation. - */ - String getAnnotationName(); - - /** - * Return the names of the attribute mapping's "supporting" annotations. - */ - Iterable getSupportingAnnotationNames(); - - /** - * Return whether the definition's mapping is - * the "specified" mapping for the specified persistent attribute. - *

- * NB: A mapping is not necessarily "specified" if its - * annotation is present - * (see {@link org.eclipse.jpt.jpa.core.internal.jpa2.context.java.AbstractJavaIdMappingDefinition2_0#isSpecified(JavaPersistentAttribute)}) - */ - boolean isSpecified(JavaPersistentAttribute persistentAttribute); - - /** - * Build a Java attribute mapping for the specified persistent attribute. - * Use the specified factory for creation so extenders can simply override - * the appropriate factory method instead of building a definition for the - * same key. - */ - JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverride.java deleted file mode 100644 index 093e0e8eca..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverride.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.AttributeOverride; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation; - -/** - * Java attribute override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaAttributeOverride - extends JavaReadOnlyAttributeOverride, AttributeOverride, JavaOverride -{ - JavaVirtualAttributeOverride convertToVirtual(); - - AttributeOverrideAnnotation getOverrideAnnotation(); - - JavaColumn getColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverrideContainer.java deleted file mode 100644 index 48bd48d7d5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaAttributeOverrideContainer.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.VirtualOverride; - -/** - * Java attribute override container - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface JavaAttributeOverrideContainer - extends AttributeOverrideContainer, JavaOverrideContainer -{ - ListIterator overrides(); - JavaReadOnlyAttributeOverride getOverrideNamed(String name); - ListIterator specifiedOverrides(); - JavaAttributeOverride getSpecifiedOverride(int index); - JavaAttributeOverride getSpecifiedOverrideNamed(String name); - ListIterator virtualOverrides(); - JavaVirtualAttributeOverride convertOverrideToVirtual(Override_ specifiedOverride); - JavaAttributeOverride convertOverrideToSpecified(VirtualOverride virtualOverride); - - - // ********** Java owner ********** - - interface Owner - extends AttributeOverrideContainer.Owner, JavaOverrideContainer.Owner - { - // combine two interfaces - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseColumn.java deleted file mode 100644 index 3e92a1890e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseColumn.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.resource.java.BaseColumnAnnotation; - -/** - * Java column or join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaBaseColumn - extends BaseColumn, JavaNamedColumn -{ - BaseColumnAnnotation getColumnAnnotation(); - - /** - * Return the (best guess) text location of the column's table. - */ - TextRange getTableTextRange(CompilationUnit astRoot); - - - // ********** owner ********** - - /** - * interface allowing columns to be used in multiple places - * (e.g. basic mappings and attribute overrides) - */ - interface Owner - extends JavaNamedColumn.Owner, BaseColumn.Owner - { - // combine two interfaces - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseEmbeddedMapping.java deleted file mode 100644 index ab5405f5d5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseEmbeddedMapping.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.BaseEmbeddedMapping; - -/** - * Behavior common to Java embedded and embedded ID mappings. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaBaseEmbeddedMapping - extends BaseEmbeddedMapping, JavaAttributeMapping -{ - JavaAttributeOverrideContainer getAttributeOverrideContainer(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseJoinColumn.java deleted file mode 100644 index 9a54c73cce..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBaseJoinColumn.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.BaseJoinColumn; - -/** - * Java join column or primary key join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface JavaBaseJoinColumn - extends BaseJoinColumn, JavaNamedColumn -{ - /** - * Return the (best guess) text location of the join column's - * referenced column name. - */ - TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot); - - - // ********** owner ********** - - /** - * interface allowing join columns to be used in multiple places - * (e.g. 1:1 mappings and join tables) - */ - interface Owner - extends BaseJoinColumn.Owner, JavaNamedColumn.Owner - { - // combine interfaces - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBasicMapping.java deleted file mode 100644 index b5d8038928..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaBasicMapping.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.BasicMapping; -import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation; - -/** - * Java basic mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaBasicMapping - extends BasicMapping, JavaColumnMapping, JavaConvertibleMapping -{ - BasicAnnotation getMappingAnnotation(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaCascade.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaCascade.java deleted file mode 100644 index 9f0562919b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaCascade.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.Cascade; - -/** - * Java cascade (persist, merge, remove, refresh) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface JavaCascade - extends Cascade, JavaJpaContextNode -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaCollectionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaCollectionMapping.java deleted file mode 100644 index 3c0a4fb3eb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaCollectionMapping.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.CollectionMapping; - -/** - * JPA Java collection mapping (e.g. 1:m, m:m, element collection) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaCollectionMapping - extends CollectionMapping, JavaAttributeMapping -{ - JavaOrderable getOrderable(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaColumn.java deleted file mode 100644 index f2117d070e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaColumn.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation; - -/** - * Java column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaColumn - extends Column, JavaBaseColumn -{ - CompleteColumnAnnotation getColumnAnnotation(); - - // ********** owner ********** - - interface Owner - extends JavaBaseColumn.Owner - { - CompleteColumnAnnotation getColumnAnnotation(); - void removeColumnAnnotation(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaColumnMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaColumnMapping.java deleted file mode 100644 index 1d4f3fd5fa..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaColumnMapping.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.ColumnMapping; - -/** - * Java column mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaColumnMapping - extends ColumnMapping, JavaAttributeMapping, JavaColumn.Owner -{ - JavaColumn getColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java deleted file mode 100644 index 60df112508..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConverter.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.common.utility.internal.ClassName; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * Java converter - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.1 - */ -public interface JavaConverter - extends Converter, JavaJpaContextNode -{ - JavaAttributeMapping getParent(); - - Annotation getConverterAnnotation(); - - /** - * Allow the converter to clean up any related annotations before it is - * removed itself. - */ - void dispose(); - - - // ********** adapter ********** - - /** - * This interface allows a convertible mapping to interact with various - * Java converters via the same protocol. - */ - public interface Adapter - { - /** - * Return the type of converter handled by the adapter. - */ - Class getConverterType(); - - /** - * Build a converter corresponding to the specified mapping - * if the mapping's resource attribute is modified by the adapter's - * converter annotation. Return null otherwise. - * This is used to build a converter during construction of the - * converter's mapping. - */ - JavaConverter buildConverter(JavaAttributeMapping parent, JpaFactory factory); - - /** - * Return the adapter's converter annotation for the specified Java - * resource persistent member. - * Return null if the adapter's converter annotation is - * missing. - * The returned converter annotation is compared to the parent's - * converter's converter annotation while the context model is synchronized - * with the resource model. If it has changed, the parent will build - * a new converter (via the adapter). - * - * @see #buildConverter(Annotation, JavaAttributeMapping, JpaFactory) - */ - Annotation getConverterAnnotation(JavaResourcePersistentAttribute javaResourcePersistentAttribute); - - /** - * Build a converter using the specified converter annotation. - * This is used when the context model is synchronized with the - * resource model (and the resource model has changed). - * - * @see #getConverterAnnotation(JavaResourcePersistentAttribute) - */ - JavaConverter buildConverter(Annotation converterAnnotation, JavaAttributeMapping parent, JpaFactory factory); - - /** - * Build a new converter and, if necessary, its corresponding converter - * annotation. - */ - JavaConverter buildNewConverter(JavaAttributeMapping parent, JpaFactory factory); - - /** - * Remove the adapter's converter annotation from the specified - * Java resource persistent member. - */ - void removeConverterAnnotation(JavaResourcePersistentAttribute javaResourcePersistentAttribute); - } - - - // ********** abstract adapter ********** - - public abstract static class AbstractAdapter - implements JavaConverter.Adapter - { - public JavaConverter buildConverter(JavaAttributeMapping parent, JpaFactory factory) { - Annotation annotation = this.getConverterAnnotation(parent.getResourcePersistentAttribute()); - return (annotation == null) ? null : this.buildConverter(annotation, parent, factory); - } - - public Annotation getConverterAnnotation(JavaResourcePersistentAttribute attribute) { - return attribute.getAnnotation(this.getAnnotationName()); - } - - protected abstract String getAnnotationName(); - - public JavaConverter buildNewConverter(JavaAttributeMapping parent, JpaFactory factory) { - return this.buildConverter(this.buildConverterAnnotationIfNecessary(parent.getResourcePersistentAttribute()), parent, factory); - } - - protected Annotation buildConverterAnnotationIfNecessary(JavaResourcePersistentAttribute attribute) { - // the annotation may already be present, after we remove the other converter annotations - Annotation annotation = this.getConverterAnnotation(attribute); - return (annotation != null) ? annotation : this.buildConverterAnnotation(attribute); - } - - protected Annotation buildConverterAnnotation(JavaResourcePersistentAttribute attribute) { - return attribute.addAnnotation(this.getAnnotationName()); - } - - public void removeConverterAnnotation(JavaResourcePersistentAttribute attribute) { - attribute.removeAnnotation(this.getAnnotationName()); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, ClassName.getSimpleName(this.getAnnotationName())); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConvertibleMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConvertibleMapping.java deleted file mode 100644 index a6f9bd607f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaConvertibleMapping.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.ConvertibleMapping; - -/** - * Java attribute mapping that has a converter (e.g. basic, ID, version). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaConvertibleMapping - extends ConvertibleMapping, JavaAttributeMapping -{ - JavaConverter getConverter(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaDiscriminatorColumn.java deleted file mode 100644 index 18ca8a5820..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaDiscriminatorColumn.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.DiscriminatorColumn; -import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation; - -/** - * Java discriminator column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaDiscriminatorColumn - extends DiscriminatorColumn, JavaNamedColumn -{ - DiscriminatorColumnAnnotation getColumnAnnotation(); - - - // ********** owner ********** - - /** - * interface allowing columns to be used in multiple places - */ - interface Owner - extends JavaNamedColumn.Owner, DiscriminatorColumn.Owner - { - // combine two interfaces - } - -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddable.java deleted file mode 100644 index f00fca6d49..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddable.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.Embeddable; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation; - -/** - * Java embeddable type mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaEmbeddable - extends Embeddable, JavaTypeMapping -{ - EmbeddableAnnotation getMappingAnnotation(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddedIdMapping.java deleted file mode 100644 index 8f066b4392..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddedIdMapping.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation; - -/** - * Java embedded ID mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaEmbeddedIdMapping - extends EmbeddedIdMapping, JavaBaseEmbeddedMapping -{ - EmbeddedIdAnnotation getMappingAnnotation(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddedMapping.java deleted file mode 100644 index ff6631c380..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEmbeddedMapping.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.EmbeddedMapping; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation; - -/** - * Java embedded mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaEmbeddedMapping - extends EmbeddedMapping, JavaBaseEmbeddedMapping -{ - EmbeddedAnnotation getMappingAnnotation(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEntity.java deleted file mode 100644 index ea466ee4e9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEntity.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation; - -/** - * Java entity - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaEntity - extends Entity, JavaTypeMapping -{ - EntityAnnotation getMappingAnnotation(); - - JavaTable getTable(); - - JavaIdClassReference getIdClassReference(); - - JavaDiscriminatorColumn getDiscriminatorColumn(); - - - // ********** secondary tables ********** - - ListIterator secondaryTables(); - ListIterator specifiedSecondaryTables(); - JavaSecondaryTable addSpecifiedSecondaryTable(); - JavaSecondaryTable addSpecifiedSecondaryTable(int index); - - - // ********** primary key join columns ********** - - ListIterator primaryKeyJoinColumns(); - ListIterator specifiedPrimaryKeyJoinColumns(); - JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index); - - JavaPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn(); - String DEFAULT_PRIMARY_KEY_JOIN_COLUMN_PROPERTY = "defaultPrimaryKeyJoinColumn"; //$NON-NLS-1$ - - - // ********** containers ********** - - JavaAttributeOverrideContainer getAttributeOverrideContainer(); - JavaAssociationOverrideContainer getAssociationOverrideContainer(); - JavaQueryContainer getQueryContainer(); - JavaGeneratorContainer getGeneratorContainer(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java deleted file mode 100644 index ec8671ad3c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaEnumeratedConverter.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.EnumeratedConverter; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation; - -/** - * Java enumerated converter - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaEnumeratedConverter - extends EnumeratedConverter, JavaConverter -{ - // ********** adapter ********** - - public static class Adapter - extends JavaConverter.AbstractAdapter - { - private static final Adapter INSTANCE = new Adapter(); - public static Adapter instance() { - return INSTANCE; - } - - private Adapter() { - super(); - } - - public Class getConverterType() { - return EnumeratedConverter.class; - } - - @Override - protected String getAnnotationName() { - return EnumeratedAnnotation.ANNOTATION_NAME; - } - - public JavaConverter buildConverter(Annotation converterAnnotation, JavaAttributeMapping parent, JpaFactory factory) { - return factory.buildJavaEnumeratedConverter(parent, (EnumeratedAnnotation) converterAnnotation); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratedValue.java deleted file mode 100644 index d93495dd04..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratedValue.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.GeneratedValue; -import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation; - -/** - * Java generated value - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public interface JavaGeneratedValue - extends GeneratedValue, JavaJpaContextNode -{ - GeneratedValueAnnotation getGeneratedValueAnnotation(); - - /** - * Return the (best guess) text location of the generator. - */ - TextRange getGeneratorTextRange(CompilationUnit astRoot); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGenerator.java deleted file mode 100644 index 25395aff31..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGenerator.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Generator; -import org.eclipse.jpt.jpa.core.resource.java.GeneratorAnnotation; - -/** - * Java sequence and table generators - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public interface JavaGenerator - extends Generator, JavaJpaContextNode -{ - GeneratorAnnotation getGeneratorAnnotation(); - - TextRange getNameTextRange(CompilationUnit astRoot); -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratorContainer.java deleted file mode 100644 index 8592c86715..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaGeneratorContainer.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.GeneratorContainer; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; - -/** - * Java generator container - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface JavaGeneratorContainer - extends GeneratorContainer, JavaJpaContextNode -{ - // ********** sequence generator ********** - - JavaSequenceGenerator getSequenceGenerator(); - - JavaSequenceGenerator addSequenceGenerator(); - - - // ********** table generator ********** - - JavaTableGenerator getTableGenerator(); - - JavaTableGenerator addTableGenerator(); - - interface Owner - { - JavaResourceAnnotatedElement getResourceAnnotatedElement(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdClassReference.java deleted file mode 100644 index e21214ca35..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdClassReference.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.IdClassReference; - -/** - * Java ID class reference - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface JavaIdClassReference - extends IdClassReference, JavaJpaContextNode -{ - /** - * Return the fully qualified name of the id class, taking into consideration the default value if applicable - */ - String getFullyQualifiedIdClassName(); - String FULLY_QUALIFIED_ID_CLASS_PROPERTY = "fullyQualifiedIdClass"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdMapping.java deleted file mode 100644 index 7fe82f003d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaIdMapping.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.IdMapping; -import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation; - -/** - * Java ID mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaIdMapping - extends IdMapping, JavaColumnMapping, JavaConvertibleMapping, JavaGeneratorContainer.Owner -{ - IdAnnotation getMappingAnnotation(); - - JavaGeneratorContainer getGeneratorContainer(); - - JavaGeneratedValue getGeneratedValue(); - JavaGeneratedValue addGeneratedValue(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumn.java deleted file mode 100644 index b8510b1d5a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumn.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; - -/** - * Java join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaJoinColumn - extends JoinColumn, JavaBaseJoinColumn, JavaBaseColumn -{ - JoinColumnAnnotation getColumnAnnotation(); - - - // ********** owner ********** - - interface Owner - extends JoinColumn.Owner, JavaBaseJoinColumn.Owner, JavaBaseColumn.Owner - { - // combine interfaces - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationship.java deleted file mode 100644 index b42bc14b39..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationship.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.JoinColumnRelationship; - -/** - * Java join column relationship (1:1, 1:m, m:1, and association override) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JavaJoinColumnRelationship - extends JoinColumnRelationship, JavaRelationship -{ - JavaJoinColumnRelationshipStrategy getJoinColumnStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationshipStrategy.java deleted file mode 100644 index cba596937c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.JoinColumnRelationshipStrategy; - -/** - * Java join column relationship strategy - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JavaJoinColumnRelationshipStrategy - extends JoinColumnRelationshipStrategy, JavaRelationshipStrategy -{ - ListIterator joinColumns(); - - ListIterator specifiedJoinColumns(); - JavaJoinColumn getSpecifiedJoinColumn(int index); - JavaJoinColumn addSpecifiedJoinColumn(); - JavaJoinColumn addSpecifiedJoinColumn(int index); - - JavaJoinColumn getDefaultJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTable.java deleted file mode 100644 index 7d1ac7c54f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTable.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; - -/** - * Java join table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaJoinTable - extends JoinTable, JavaReferenceTable -{ - JavaJoinTableRelationshipStrategy getParent(); - - JoinTableAnnotation getTableAnnotation(); - - - // ********** inverse join columns ********** - - ListIterator inverseJoinColumns(); - - ListIterator specifiedInverseJoinColumns(); - JavaJoinColumn getSpecifiedInverseJoinColumn(int index); - JavaJoinColumn addSpecifiedInverseJoinColumn(); - JavaJoinColumn addSpecifiedInverseJoinColumn(int index); - - JavaJoinColumn getDefaultInverseJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTableRelationship.java deleted file mode 100644 index 2418a7d02e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTableRelationship.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.JoinTableRelationship; - -/** - * Java join table relationship (1:1, 1:m, m:1, m:m) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JavaJoinTableRelationship - extends JoinTableRelationship, JavaRelationship -{ - JavaJoinTableRelationshipStrategy getJoinTableStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTableRelationshipStrategy.java deleted file mode 100644 index c6c912fa07..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJoinTableRelationshipStrategy.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.JoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; - -/** - * Java join table relationship strategy - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.2 - */ -public interface JavaJoinTableRelationshipStrategy - extends JoinTableRelationshipStrategy, JavaRelationshipStrategy -{ - JavaJoinTable getJoinTable(); - - /** - * Return the join table annotation, use a null object instead of returning null - * if the join table annotation does not exist. - */ - JoinTableAnnotation getJoinTableAnnotation(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJpaContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJpaContextNode.java deleted file mode 100644 index ff33b25ef8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaJpaContextNode.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.jpa.core.context.JpaContextNode; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java JPA context node. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface JavaJpaContextNode - extends JpaContextNode -{ - /** - * Return the Java code-completion proposals for the specified position - * in the source code. - */ - Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot); - - - // ********** validation ********** - - /** - * Adds to the list of current validation messages - */ - void validate(List messages, IReporter reporter, CompilationUnit astRoot); - - TextRange getValidationTextRange(CompilationUnit astRoot); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java deleted file mode 100644 index 2158df7c79..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaLobConverter.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.LobConverter; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation; - -/** - * Java LOB converter - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaLobConverter - extends LobConverter, JavaConverter -{ - // ********** adapter ********** - - public static class Adapter - extends JavaConverter.AbstractAdapter - { - private static final Adapter INSTANCE = new Adapter(); - public static Adapter instance() { - return INSTANCE; - } - - private Adapter() { - super(); - } - - public Class getConverterType() { - return LobConverter.class; - } - - @Override - protected String getAnnotationName() { - return LobAnnotation.ANNOTATION_NAME; - } - - public JavaConverter buildConverter(Annotation converterAnnotation, JavaAttributeMapping parent, JpaFactory factory) { - return factory.buildJavaLobConverter(parent, (LobAnnotation) converterAnnotation); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToManyMapping.java deleted file mode 100644 index 9e2544dc8f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToManyMapping.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.ManyToManyMapping; -import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation; - -/** - * Java m:m mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface JavaManyToManyMapping - extends ManyToManyMapping, JavaMultiRelationshipMapping -{ - ManyToManyAnnotation getMappingAnnotation(); - - ManyToManyAnnotation getAnnotationForUpdate(); - - JavaManyToManyRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToManyRelationship.java deleted file mode 100644 index 0ecaef922d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToManyRelationship.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.ManyToManyRelationship; - -/** - * Java m:m relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JavaManyToManyRelationship - extends ManyToManyRelationship, - JavaMappedByRelationship, - JavaMappingJoinTableRelationship -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToOneMapping.java deleted file mode 100644 index 6c7db3b15d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToOneMapping.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.ManyToOneMapping; -import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation; - -/** - * Java m:1 mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface JavaManyToOneMapping - extends ManyToOneMapping, JavaSingleRelationshipMapping -{ - ManyToOneAnnotation getMappingAnnotation(); - - JavaManyToOneRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToOneRelationship.java deleted file mode 100644 index c146adb25a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaManyToOneRelationship.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.ManyToOneRelationship; - -/** - * Java m:1 relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JavaManyToOneRelationship - extends ManyToOneRelationship, - JavaMappingJoinColumnRelationship -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedByRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedByRelationship.java deleted file mode 100644 index 4a7fec62be..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedByRelationship.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.MappedByRelationship; -import org.eclipse.jpt.jpa.core.resource.java.OwnableRelationshipMappingAnnotation; - -/** - * Java "mapped by" relationship (1:1, 1:m, m:m) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JavaMappedByRelationship - extends MappedByRelationship, JavaRelationship -{ - JavaMappedByRelationshipStrategy getMappedByStrategy(); - - OwnableRelationshipMappingAnnotation getMappingAnnotation(); - - OwnableRelationshipMappingAnnotation getMappingAnnotationForUpdate(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedByRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedByRelationshipStrategy.java deleted file mode 100644 index 77b3356adb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedByRelationshipStrategy.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.MappedByRelationshipStrategy; - -/** - * Java "mapped by" relationship strategy - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JavaMappedByRelationshipStrategy - extends JavaRelationshipStrategy, MappedByRelationshipStrategy -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedSuperclass.java deleted file mode 100644 index 1ccd402c93..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappedSuperclass.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.MappedSuperclass; -import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation; - -/** - * Java mapped superclass - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaMappedSuperclass - extends MappedSuperclass, JavaTypeMapping -{ - MappedSuperclassAnnotation getMappingAnnotation(); - - JavaIdClassReference getIdClassReference(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingJoinColumnRelationship.java deleted file mode 100644 index 20cd4e734d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingJoinColumnRelationship.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -/** - * Java mapping join column relationship (1:1, 1:m, m:1) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaMappingJoinColumnRelationship - extends JavaJoinColumnRelationship, - JavaMappingRelationship -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingJoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingJoinTableRelationship.java deleted file mode 100644 index 027552a3c5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingJoinTableRelationship.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -/** - * Java mapping join table relationship (1:1, 1:m, m:1, m:m) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaMappingJoinTableRelationship - extends JavaJoinTableRelationship, - JavaMappingRelationship -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingRelationship.java deleted file mode 100644 index e47c8299b1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMappingRelationship.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.MappingRelationship; - -/** - * Java mapping relationship (1:1, 1:m, m:1, m:m) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JavaMappingRelationship - extends MappingRelationship, JavaRelationship -{ - JavaRelationshipMapping getMapping(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMultiRelationshipMapping.java deleted file mode 100644 index 595c23129a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaMultiRelationshipMapping.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.MultiRelationshipMapping; - -/** - * Java multi-valued (1:m, m:m) relationship mapping. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaMultiRelationshipMapping - extends MultiRelationshipMapping, JavaRelationshipMapping, JavaCollectionMapping -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedColumn.java deleted file mode 100644 index 7607bad56f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedColumn.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation; - -/** - * Java - *

    - *
  • column - *
  • join column - *
  • primary key join column - *
  • discriminator column - *
  • order column - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaNamedColumn - extends NamedColumn, JavaJpaContextNode -{ - NamedColumnAnnotation getColumnAnnotation(); - - /** - * Return the (best guess) text location of the column's name. - */ - TextRange getNameTextRange(CompilationUnit astRoot); - - - // ********** owner ********** - - /** - * interface allowing columns to be used in multiple places - * (e.g. basic mappings and attribute overrides) - */ - interface Owner - extends NamedColumn.Owner - { - /** - * Return the column owner's text range. This can be returned by the - * column when its annotation is not present. - */ - TextRange getValidationTextRange(CompilationUnit astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java deleted file mode 100644 index 0d915857af..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedNativeQuery.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jpa.core.context.NamedNativeQuery; -import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation; - -/** - * Java named native query - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface JavaNamedNativeQuery - extends NamedNativeQuery, JavaQuery -{ - NamedNativeQueryAnnotation getQueryAnnotation(); - - // required to resolve ambiguity - ListIterable getHints(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedQuery.java deleted file mode 100644 index bf742d7a87..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaNamedQuery.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jpa.core.context.NamedQuery; -import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation; - -/** - * Java named query - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface JavaNamedQuery - extends NamedQuery, JavaQuery -{ - NamedQueryAnnotation getQueryAnnotation(); - - // required to resolve ambiguity - ListIterable getHints(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToManyMapping.java deleted file mode 100644 index dc6461010b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToManyMapping.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.OneToManyMapping; -import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation; - -/** - * Java 1:m mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface JavaOneToManyMapping - extends OneToManyMapping, JavaMultiRelationshipMapping -{ - OneToManyAnnotation getMappingAnnotation(); - - OneToManyAnnotation getAnnotationForUpdate(); - - JavaOneToManyRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToManyRelationship.java deleted file mode 100644 index dab064d031..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToManyRelationship.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.OneToManyRelationship; - -/** - * Java 1:m relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JavaOneToManyRelationship - extends OneToManyRelationship, - JavaMappedByRelationship, - JavaMappingJoinTableRelationship -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToOneMapping.java deleted file mode 100644 index b98d965be9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToOneMapping.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.OneToOneMapping; -import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation; - -/** - * Java 1:1 mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface JavaOneToOneMapping - extends OneToOneMapping, JavaSingleRelationshipMapping -{ - OneToOneAnnotation getMappingAnnotation(); - - OneToOneAnnotation getAnnotationForUpdate(); - - JavaOneToOneRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToOneRelationship.java deleted file mode 100644 index 3715ccf9e2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOneToOneRelationship.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.OneToOneRelationship; - -/** - * Java 1:1 relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JavaOneToOneRelationship - extends OneToOneRelationship, - JavaMappedByRelationship, - JavaPrimaryKeyJoinColumnRelationship, - JavaMappingJoinColumnRelationship -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOrderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOrderable.java deleted file mode 100644 index 2a5c042baf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOrderable.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.Orderable; - -/** - * Multi-valued (1:m, m:m) relationship mappings support ordering. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface JavaOrderable - extends Orderable, JavaJpaContextNode -{ - JavaAttributeMapping getParent(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverride.java deleted file mode 100644 index a7d3f41694..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverride.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation; - -/** - * Java override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.3 - */ -public interface JavaOverride - extends Override_, JavaReadOnlyOverride -{ - JavaVirtualOverride convertToVirtual(); - - OverrideAnnotation getOverrideAnnotation(); - - /** - * Return the (best guess) text location of the override's name. - */ - TextRange getNameTextRange(CompilationUnit astRoot); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideContainer.java deleted file mode 100644 index 90a62ee8ba..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideContainer.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.ListIterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.OverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.VirtualOverride; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * Java attribute or association override container - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface JavaOverrideContainer - extends OverrideContainer, JavaJpaContextNode -{ - ListIterator overrides(); - JavaReadOnlyOverride getOverrideNamed(String name); - ListIterator specifiedOverrides(); - JavaOverride getSpecifiedOverride(int index); - JavaOverride getSpecifiedOverrideNamed(String name); - ListIterator virtualOverrides(); - JavaVirtualOverride convertOverrideToVirtual(Override_ specifiedOverride); - JavaOverride convertOverrideToSpecified(VirtualOverride virtualOverride); - - /** - * JPA 2.0 - *

- * Return a prefix (without the following '.') - * that may be prepended to the override name. - * Return null if no prefix is supported. - */ - String getPossiblePrefix(); - String getWritePrefix(); - - - // ********** owner ********** - - interface Owner - extends OverrideContainer.Owner - { - JavaResourcePersistentMember getResourcePersistentMember(); - - TextRange getValidationTextRange(CompilationUnit astRoot); - - /** - * JPA 2.0 - *

- * Return the prefix (without the following '.') - * to be prepended to the override name. - */ - String getWritePrefix(); - - /** - * JPA 2.0 - *

- * Return a prefix (without the following '.') - * that may be prepended to the override name. - * Return null if no prefix is supported. - *

- * JPA 2.0 supports the prefixes "map" and "key". - */ - String getPossiblePrefix(); - - /** - * JPA 2.0 - *

- * This is necessary for JPA 2.0 because an override annotation for an - * element collection can have a name with a prefix that indicates - * whether the override applies to element collection's embedded key or - * value. Return whether the specified override name, which may have a - * prefix, is relevant to the override container. - *

- * JPA 2.0 supports the prefixes "map" and "key". - */ - boolean isRelevant(String overrideName); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideRelationship.java deleted file mode 100644 index bd7bfedc49..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaOverrideRelationship.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.OverrideRelationship; - -/** - * Java association override relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface JavaOverrideRelationship - extends OverrideRelationship, - JavaJoinColumnRelationship -{ - JavaAssociationOverride getAssociationOverride(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java deleted file mode 100644 index 27b1653476..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentAttribute.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.jpa.core.context.CollectionMapping; -import org.eclipse.jpt.jpa.core.context.Embeddable; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * Context Java persistent attribute (field or property). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaPersistentAttribute - extends PersistentAttribute, JavaJpaContextNode -{ - // ********** mapping ********** - - JavaAttributeMapping getMapping(); - - JavaAttributeMapping setMappingKey(String key); - - - // ********** misc ********** - - /** - * Return the "resource" persistent attribute. - */ - JavaResourcePersistentAttribute getResourcePersistentAttribute(); - - /** - * Return whether the attribute contains the given offset into the text file. - */ - boolean contains(int offset, CompilationUnit astRoot); - - /** - * Return the embeddable (type mapping) corresponding to the persistent - * attribute's type. Return null if it is not found. - */ - Embeddable getEmbeddable(); - - /** - * Return whether the attribute is a field (as opposed to a property). - */ - boolean isField(); - - /** - * Return whether the attribute is a property (as opposed to a field). - */ - boolean isProperty(); - - /** - * Return whether the attribute is 'public', which is problematic for fields. - */ - boolean isPublic(); - - /** - * Return whether the attribute is 'final', which is problematic. - */ - boolean isFinal(); - - - // ********** type ********** - - /** - * Return whether the attribute's type is valid for a default basic mapping. - */ - boolean typeIsBasic(); - - /** - * Return the attribute's type name if it is valid as a target type - * (i.e. the type is neither an array nor a "container"). - */ - String getSingleReferenceTargetTypeName(); - - /** - * If the attribute's type is an appropriate "container" type, - * return the type parameter that can be used as a target type. - * Return null if the attribute is not a container or if the type - * parameter is not valid as a target type (i.e. it is either - * an array or a "container"). - */ - String getMultiReferenceTargetTypeName(); - - /** - * If the attribute's type is a map type, - * return the type parameter that can be used as a key type. - * Return null if the attribute is not a map or if the type - * parameter is not valid as a key type (i.e. it is either - * an array or a "container"). - */ - String getMultiReferenceMapKeyTypeName(); - - /** - * Return the JpaContainer that corresponds to this attribute's type. - * Return a null implementation if the type is not a container (map or collection) - */ - JpaContainerDefinition getJpaContainerDefinition(); - - - // ********** JPA container ********** - - /** - * JPA container definition interface (and null implementation) - */ - interface JpaContainerDefinition { - String getTypeName(); - boolean isContainer(); - boolean isMap(); - String getMultiReferenceTargetTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute); - String getMultiReferenceMapKeyTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute); - String getMetamodelContainerFieldTypeName(); - String getMetamodelContainerFieldMapKeyTypeName(CollectionMapping mapping); - - final class Null implements JpaContainerDefinition { - public static final JpaContainerDefinition INSTANCE = new Null(); - public static JpaContainerDefinition instance() { - return INSTANCE; - } - // ensure single instance - private Null() { - super(); - } - public String getTypeName() { - return null; - } - public boolean isContainer() { - return false; - } - public boolean isMap() { - return false; - } - public String getMultiReferenceTargetTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) { - return null; - } - public String getMultiReferenceMapKeyTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) { - return null; - } - public String getMetamodelContainerFieldTypeName() { - return JPA2_0.COLLECTION_ATTRIBUTE; - } - public String getMetamodelContainerFieldMapKeyTypeName(CollectionMapping mapping) { - return null; - } - @Override - public String toString() { - return JpaContainerDefinition.class.getSimpleName() + ".Null"; //$NON-NLS-1$ - } - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java deleted file mode 100644 index 0ab09a0dc5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPersistentType.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * Context Java persistent type. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaPersistentType - extends PersistentType, JavaJpaContextNode -{ - // ********** covariant overrides ********** - - JavaTypeMapping getMapping(); - - @SuppressWarnings("unchecked") - ListIterator attributes(); - String ATTRIBUTES_LIST = "attributes"; //$NON-NLS-1$ - - JavaPersistentAttribute getAttributeNamed(String attributeName); - - - // ********** Java ********** - - /** - * Return whether any attribute in this persistent type is annotated - */ - boolean hasAnyAnnotatedAttributes(); - - /** - * Return the Java resource persistent type. - */ - JavaResourcePersistentType getResourcePersistentType(); - - JavaPersistentAttribute getAttributeFor(JavaResourcePersistentAttribute javaResourcePersistentAttribute); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumn.java deleted file mode 100644 index 6c047186b5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumn.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation; - -/** - * Java primary key join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface JavaPrimaryKeyJoinColumn - extends PrimaryKeyJoinColumn, JavaBaseJoinColumn -{ - PrimaryKeyJoinColumnAnnotation getColumnAnnotation(); -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationship.java deleted file mode 100644 index 6c47161927..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationship.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumnRelationship; - -/** - * Java primary key join column relationship (1:1) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JavaPrimaryKeyJoinColumnRelationship - extends PrimaryKeyJoinColumnRelationship, - JavaMappingRelationship -{ - JavaPrimaryKeyJoinColumnRelationshipStrategy getPrimaryKeyJoinColumnStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationshipStrategy.java deleted file mode 100644 index 16158a0615..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaPrimaryKeyJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumnRelationshipStrategy; - -/** - * Java primary key join column relationship strategy - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JavaPrimaryKeyJoinColumnRelationshipStrategy - extends JavaRelationshipStrategy, PrimaryKeyJoinColumnRelationshipStrategy -{ - ListIterator primaryKeyJoinColumns(); - JavaPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index); - JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(); - JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQuery.java deleted file mode 100644 index 9dbea1e546..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQuery.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jpa.core.context.Query; -import org.eclipse.jpt.jpa.core.resource.java.QueryAnnotation; - -/** - * Java named and named native queries - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public interface JavaQuery - extends Query, JavaJpaContextNode -{ - QueryAnnotation getQueryAnnotation(); - - - // ********** hints ********** - - @SuppressWarnings("unchecked") - ListIterable getHints(); - - JavaQueryHint addHint(); - - JavaQueryHint addHint(int index); - - - // ********** validation ********** - - TextRange getNameTextRange(CompilationUnit astRoot); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryContainer.java deleted file mode 100644 index 6f7afe6241..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryContainer.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.QueryContainer; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; - -/** - * Java query container - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface JavaQueryContainer - extends QueryContainer, JavaJpaContextNode -{ - // ********** named queries ********** - - @SuppressWarnings("unchecked") - ListIterator namedQueries(); - - JavaNamedQuery addNamedQuery(); - - JavaNamedQuery addNamedQuery(int index); - - - // ********** named native queries ********** - - @SuppressWarnings("unchecked") - ListIterator namedNativeQueries(); - - JavaNamedNativeQuery addNamedNativeQuery(); - - JavaNamedNativeQuery addNamedNativeQuery(int index); - - interface Owner - { - JavaResourceAnnotatedElement getResourceAnnotatedElement(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryHint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryHint.java deleted file mode 100644 index 859b893437..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaQueryHint.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.QueryHint; -import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation; - -/** - * Java query hint - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface JavaQueryHint - extends QueryHint, JavaJpaContextNode -{ - QueryHintAnnotation getQueryHintAnnotation(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyAssociationOverride.java deleted file mode 100644 index 69afbc01ea..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyAssociationOverride.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride; - -/** - * Java read-only association override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaReadOnlyAssociationOverride - extends ReadOnlyAssociationOverride, JavaReadOnlyOverride -{ - JavaAssociationOverrideContainer getContainer(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyAttributeOverride.java deleted file mode 100644 index 1f552eeaee..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyAttributeOverride.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride; - -/** - * Read-only Java attribute override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaReadOnlyAttributeOverride - extends ReadOnlyAttributeOverride, JavaReadOnlyOverride -{ - JavaAttributeOverrideContainer getContainer(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyOverride.java deleted file mode 100644 index 530c455545..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyOverride.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride; - -/** - * Read-only Java override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaReadOnlyOverride - extends ReadOnlyOverride, JavaJpaContextNode -{ - JavaOverrideContainer getContainer(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyRelationship.java deleted file mode 100644 index 59aae9e166..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyRelationship.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship; - -/** - * Java relationship (join column, join table, mapped by, primary key join - * column, mapping) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaReadOnlyRelationship - extends ReadOnlyRelationship, JavaJpaContextNode -{ - JavaReadOnlyRelationshipStrategy getStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyRelationshipStrategy.java deleted file mode 100644 index 196563f5ce..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyRelationshipStrategy.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy; - -/** - * Java read-only relationship strategy - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaReadOnlyRelationshipStrategy - extends ReadOnlyRelationshipStrategy, JavaJpaContextNode -{ - JavaReadOnlyRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyUniqueConstraint.java deleted file mode 100644 index f0d2546f07..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReadOnlyUniqueConstraint.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint; - -/** - * Java read-only unique constraint - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaReadOnlyUniqueConstraint - extends ReadOnlyUniqueConstraint, JavaJpaContextNode -{ - // combine interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReferenceTable.java deleted file mode 100644 index d65d9fe62e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaReferenceTable.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.ReferenceTable; -import org.eclipse.jpt.jpa.core.resource.java.ReferenceTableAnnotation; - -/** - * Java reference table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface JavaReferenceTable - extends ReferenceTable, JavaTable -{ - ReferenceTableAnnotation getTableAnnotation(); - - - // ********** join columns ********** - - ListIterator joinColumns(); - - ListIterator specifiedJoinColumns(); - JavaJoinColumn getSpecifiedJoinColumn(int index); - JavaJoinColumn addSpecifiedJoinColumn(); - JavaJoinColumn addSpecifiedJoinColumn(int index); - - JavaJoinColumn getDefaultJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationship.java deleted file mode 100644 index 088cd7bd3a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationship.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.Relationship; - -/** - * Java relationship (join column, join table, mapped by, primary key join - * column, mapping) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface JavaRelationship - extends Relationship, JavaReadOnlyRelationship -{ - JavaRelationshipStrategy getStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationshipMapping.java deleted file mode 100644 index 7636c3885d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationshipMapping.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.resource.java.RelationshipMappingAnnotation; - -/** - * Java relationship (1:1, 1:m, m:1, m:m) mapping. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaRelationshipMapping - extends RelationshipMapping, JavaAttributeMapping -{ - RelationshipMappingAnnotation getMappingAnnotation(); - - RelationshipMappingAnnotation getAnnotationForUpdate(); - - JavaCascade getCascade(); - - JavaMappingRelationship getRelationship(); - - /** - * If the target entity is specified, this will return it fully qualified. - * If not specified, it returns the default target entity, which is always - * fully qualified - */ - String getFullyQualifiedTargetEntity(); - String FULLY_QUALIFIED_TARGET_ENTITY_PROPERTY = "fullyQualifiedTargetEntity"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationshipStrategy.java deleted file mode 100644 index f658507620..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaRelationshipStrategy.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.RelationshipStrategy; - -/** - * Java relationship strategy - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.2 - */ -public interface JavaRelationshipStrategy - extends RelationshipStrategy, JavaReadOnlyRelationshipStrategy -{ - JavaRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSecondaryTable.java deleted file mode 100644 index 27b74cab7c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSecondaryTable.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.SecondaryTable; -import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation; - -/** - * Java secondary table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public interface JavaSecondaryTable - extends SecondaryTable, JavaTable -{ - JavaEntity getParent(); - - SecondaryTableAnnotation getTableAnnotation(); - - - // ********** primary key join columns ********** - - ListIterator primaryKeyJoinColumns(); - ListIterator specifiedPrimaryKeyJoinColumns(); - JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(); - JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index); - JavaPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSequenceGenerator.java deleted file mode 100644 index f00727d412..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSequenceGenerator.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.SequenceGenerator; -import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation; - -/** - * Java sequence generator - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface JavaSequenceGenerator - extends JavaGenerator, SequenceGenerator -{ - SequenceGeneratorAnnotation getGeneratorAnnotation(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSingleRelationshipMapping.java deleted file mode 100644 index fc688ddfff..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaSingleRelationshipMapping.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.SingleRelationshipMapping; -import org.eclipse.jpt.jpa.core.resource.java.SingleRelationshipMappingAnnotation; - -/** - * Java single (m:1, 1:1) mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface JavaSingleRelationshipMapping - extends SingleRelationshipMapping, JavaRelationshipMapping -{ - SingleRelationshipMappingAnnotation getMappingAnnotation(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaStructureNodes.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaStructureNodes.java deleted file mode 100644 index e95b3def50..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaStructureNodes.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; - -/** - * - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public interface JavaStructureNodes -{ - String COMPILATION_UNIT_ID = - JptJpaCorePlugin.PLUGIN_ID + ".java.compilationUnit"; //$NON-NLS-1$ - - String PERSISTENT_TYPE_ID = - JptJpaCorePlugin.PLUGIN_ID + ".java.persistentType"; //$NON-NLS-1$ - - String PERSISTENT_ATTRIBUTE_ID = - JptJpaCorePlugin.PLUGIN_ID + ".java.persistentAttribute"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTable.java deleted file mode 100644 index e270eee2f1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTable.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.ListIterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation; - -/** - * Java table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public interface JavaTable - extends Table, JavaJpaContextNode -{ - BaseTableAnnotation getTableAnnotation(); - - TextRange getNameTextRange(CompilationUnit astRoot); - TextRange getSchemaTextRange(CompilationUnit astRoot); - TextRange getCatalogTextRange(CompilationUnit astRoot); - - ListIterator uniqueConstraints(); - JavaUniqueConstraint getUniqueConstraint(int index); - JavaUniqueConstraint addUniqueConstraint(); - JavaUniqueConstraint addUniqueConstraint(int index); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTableGenerator.java deleted file mode 100644 index ee8dba64e9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTableGenerator.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.TableGenerator; -import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation; - -/** - * Java table generator - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface JavaTableGenerator - extends JavaGenerator, TableGenerator -{ - TableGeneratorAnnotation getGeneratorAnnotation(); - - @SuppressWarnings("unchecked") - Iterable getUniqueConstraints(); - - JavaUniqueConstraint addUniqueConstraint(int index); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java deleted file mode 100644 index a05540642d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTemporalConverter.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.TemporalConverter; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation; - -/** - * Java temporal converter - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaTemporalConverter - extends TemporalConverter, JavaConverter -{ - // ********** adapter ********** - - public static class Adapter - extends JavaConverter.AbstractAdapter - { - private static final Adapter INSTANCE = new Adapter(); - public static Adapter instance() { - return INSTANCE; - } - - private Adapter() { - super(); - } - - public Class getConverterType() { - return TemporalConverter.class; - } - - @Override - protected String getAnnotationName() { - return TemporalAnnotation.ANNOTATION_NAME; - } - - public JavaConverter buildConverter(Annotation converterAnnotation, JavaAttributeMapping parent, JpaFactory factory) { - return factory.buildJavaTemporalConverter(parent, (TemporalAnnotation) converterAnnotation); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTransientMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTransientMapping.java deleted file mode 100644 index eed007e2aa..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTransientMapping.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.TransientMapping; -import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation; - -/** - * Java transient "mapping" - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public interface JavaTransientMapping - extends JavaAttributeMapping, TransientMapping -{ - TransientAnnotation getMappingAnnotation(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMapping.java deleted file mode 100644 index 034db01fe9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMapping.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.Iterator; - -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * Java type mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaTypeMapping - extends TypeMapping, JavaJpaContextNode -{ - JavaResourcePersistentType getResourcePersistentType(); - - Annotation getMappingAnnotation(); - - - // ********** covariant overrides ********** - - JavaPersistentType getPersistentType(); - - @SuppressWarnings("unchecked") - Iterator attributeMappings(); - - @SuppressWarnings("unchecked") - Iterable getAttributeMappings(String mappingKey); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMappingDefinition.java deleted file mode 100644 index 28dfa505e0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaTypeMappingDefinition.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; - -/** - * Map a string key to a type mapping and its corresponding - * Java annotations. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface JavaTypeMappingDefinition -{ - /** - * Return the type mapping's key. - */ - String getKey(); - - /** - * Return the name of the type mapping's annotation. - */ - String getAnnotationName(); - - /** - * Return the names of the type mapping's "supporting" annotations. - */ - Iterable getSupportingAnnotationNames(); - - /** - * Build a Java type mapping for the specified persistent type and - * annotation. - * Use the specified factory for creation so extenders can simply override - * the appropriate factory method instead of building a definition for the - * same key. - */ - JavaTypeMapping buildMapping(JavaPersistentType persistentType, Annotation annotation, JpaFactory factory); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaUniqueConstraint.java deleted file mode 100644 index 9073653d88..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaUniqueConstraint.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.UniqueConstraint; -import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation; - -/** - * Java unique constraint - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public interface JavaUniqueConstraint - extends UniqueConstraint, JavaReadOnlyUniqueConstraint -{ - UniqueConstraintAnnotation getUniqueConstraintAnnotation(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVersionMapping.java deleted file mode 100644 index d74d02a75b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVersionMapping.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.VersionMapping; -import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation; - -/** - * Java version mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface JavaVersionMapping - extends VersionMapping, JavaColumnMapping, JavaConvertibleMapping -{ - VersionAnnotation getMappingAnnotation(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualAssociationOverride.java deleted file mode 100644 index 37ca150230..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualAssociationOverride.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.VirtualAssociationOverride; - -/** - * Java virtual association override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaVirtualAssociationOverride - extends VirtualAssociationOverride, - JavaVirtualOverride, - JavaReadOnlyAssociationOverride -{ - JavaVirtualOverrideRelationship getRelationship(); - - JavaAssociationOverride convertToSpecified(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualAttributeOverride.java deleted file mode 100644 index 8687426537..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualAttributeOverride.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.VirtualAttributeOverride; - -/** - * Java virtual attribute override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaVirtualAttributeOverride - extends VirtualAttributeOverride, - JavaVirtualOverride, - JavaReadOnlyAttributeOverride -{ - JavaAttributeOverride convertToSpecified(); - - JavaVirtualColumn getColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualColumn.java deleted file mode 100644 index 6b5161bfa6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualColumn.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.VirtualColumn; - -/** - * Java virtual column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaVirtualColumn - extends VirtualColumn, JavaJpaContextNode -{ - /** - * The overridden column can be either a Java join column or an - * orm.xml join column; so we don't change the return type - * here. - */ - Column getOverriddenColumn(); - - - // ********** owner ********** - - interface Owner - extends VirtualColumn.Owner - { - /** - * The overridden column can be either a Java column or an - * orm.xml column; so we don't change the return type here. - */ - Column resolveOverriddenColumn(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumn.java deleted file mode 100644 index f3f4a2d24d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumn.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.VirtualJoinColumn; - -/** - * Java virtual join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaVirtualJoinColumn - extends VirtualJoinColumn, JavaJpaContextNode -{ - /** - * The overridden join column can be either a Java join column or an - * orm.xml join column; so we don't change the return type - * here. - */ - JoinColumn getOverriddenColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationship.java deleted file mode 100644 index dfb9d21642..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationship.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.VirtualJoinColumnRelationship; - -/** - * Java virtual join column relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaVirtualJoinColumnRelationship - extends VirtualJoinColumnRelationship, - JavaVirtualRelationship -{ - JavaVirtualJoinColumnRelationshipStrategy getJoinColumnStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationshipStrategy.java deleted file mode 100644 index b9b9bc4c10..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.VirtualJoinColumnRelationshipStrategy; - -/** - * Java virtual join column relationship strategy. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaVirtualJoinColumnRelationshipStrategy - extends VirtualJoinColumnRelationshipStrategy, JavaVirtualRelationshipStrategy -{ - ListIterator joinColumns(); - ListIterator specifiedJoinColumns(); - JavaVirtualJoinColumn getSpecifiedJoinColumn(int index); - JavaVirtualJoinColumn getDefaultJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTable.java deleted file mode 100644 index c6da69c644..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTable.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.VirtualJoinTable; - -/** - * Java virtual join table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaVirtualJoinTable - extends VirtualJoinTable, JavaJpaContextNode -{ - JavaVirtualJoinTableRelationshipStrategy getParent(); - - ListIterator uniqueConstraints(); - JavaVirtualUniqueConstraint getUniqueConstraint(int index); - - ListIterator joinColumns(); - ListIterator specifiedJoinColumns(); - JavaVirtualJoinColumn getSpecifiedJoinColumn(int index); - JavaVirtualJoinColumn getDefaultJoinColumn(); - - ListIterator inverseJoinColumns(); - ListIterator specifiedInverseJoinColumns(); - JavaVirtualJoinColumn getSpecifiedInverseJoinColumn(int index); - JavaVirtualJoinColumn getDefaultInverseJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTableRelationship.java deleted file mode 100644 index 5f2963c8b2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTableRelationship.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.VirtualJoinTableRelationship; - -/** - * Java virtual join table relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaVirtualJoinTableRelationship - extends VirtualJoinTableRelationship, - JavaVirtualRelationship -{ - JavaVirtualJoinTableRelationshipStrategy getJoinTableStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTableRelationshipStrategy.java deleted file mode 100644 index 7c8ea38e78..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualJoinTableRelationshipStrategy.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.VirtualJoinTableRelationshipStrategy; - -/** - * Java virtual join table relationship strategy. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaVirtualJoinTableRelationshipStrategy - extends VirtualJoinTableRelationshipStrategy, JavaVirtualRelationshipStrategy -{ - JavaVirtualJoinTable getJoinTable(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualOverride.java deleted file mode 100644 index 576234b13b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualOverride.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.VirtualOverride; - -/** - * Java virtual

    - *
  • attribute override - *
  • association override - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaVirtualOverride - extends VirtualOverride, JavaReadOnlyOverride -{ - JavaOverride convertToSpecified(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualOverrideRelationship.java deleted file mode 100644 index 970fb1ba45..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualOverrideRelationship.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.VirtualOverrideRelationship; - -/** - * Java virtual association override relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaVirtualOverrideRelationship - extends VirtualOverrideRelationship, - JavaVirtualJoinColumnRelationship -{ - JavaVirtualAssociationOverride getAssociationOverride(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualRelationship.java deleted file mode 100644 index fb03325c31..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualRelationship.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.VirtualRelationship; - -/** - * Java virtual relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaVirtualRelationship - extends VirtualRelationship, JavaReadOnlyRelationship -{ - JavaVirtualRelationshipStrategy getStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualRelationshipStrategy.java deleted file mode 100644 index 850754310e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualRelationshipStrategy.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.VirtualRelationshipStrategy; - -/** - * Java virtual strategy - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaVirtualRelationshipStrategy - extends VirtualRelationshipStrategy, JavaReadOnlyRelationshipStrategy -{ - JavaVirtualRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualUniqueConstraint.java deleted file mode 100644 index d2363e24e7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/java/JavaVirtualUniqueConstraint.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.java; - -import org.eclipse.jpt.jpa.core.context.UniqueConstraint; -import org.eclipse.jpt.jpa.core.context.VirtualUniqueConstraint; - -/** - * Java virtual database unique constraint - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface JavaVirtualUniqueConstraint - extends VirtualUniqueConstraint, JavaReadOnlyUniqueConstraint -{ - /** - * The overridden unique constraint can be either a Java unique constraint - * or an orm.xml unique constraint; so we don't change the - * return type here. - */ - UniqueConstraint getOverriddenUniqueConstraint(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java deleted file mode 100644 index ab518ac108..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/EntityMappings.java +++ /dev/null @@ -1,200 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.MappingFileRoot; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * Context model corresponding to the - * XML resource model {@link XmlEntityMappings}, - * which corresponds to the entity-mappings element - * in the orm.xml file. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 -*/ -public interface EntityMappings - extends MappingFileRoot, PersistentType.Owner, PersistentTypeContainer -{ - /** - * Covariant override. - */ - OrmXml getParent(); - - XmlEntityMappings getXmlEntityMappings(); - - String getVersion(); - - String getDescription(); - void setDescription(String description); - String DESCRIPTION_PROPERTY = "description"; //$NON-NLS-1$ - - /** - * "The package subelement specifies the package of the - * classes listed within the subelements and attributes of the same mapping - * file only. The package subelement is overridden if the fully - * qualified class name is specified for a class and the two disagree." - *

- * NB: No mention of how to resolve duplicates in the - * "default" package or sub-packages:

    - *
  • Bar (in "default" package) vs. foo.Bar - *
  • baz.Bar vs. foo.baz.Bar - *
- * when package is specified as foo. - */ - String getPackage(); - void setPackage(String package_); - String PACKAGE_PROPERTY = "package"; //$NON-NLS-1$ - - AccessType getSpecifiedAccess(); - void setSpecifiedAccess(AccessType access); - String SPECIFIED_ACCESS_PROPERTY = "specifiedAccess"; //$NON-NLS-1$ - AccessType getDefaultAccess(); - String DEFAULT_ACCESS_PROPERTY = "defaultAccess"; //$NON-NLS-1$ - - /** - * Return the database schema container, which can be either a catalog or, - * if the database does not support catalogs, the database itself. - */ - SchemaContainer getDbSchemaContainer(); - - String getSpecifiedCatalog(); - void setSpecifiedCatalog(String catalog); - String SPECIFIED_CATALOG_PROPERTY = "specifiedCatalog"; //$NON-NLS-1$ - String getDefaultCatalog(); - String DEFAULT_CATALOG_PROPERTY = "defaultCatalog"; //$NON-NLS-1$ - Catalog getDbCatalog(); - - String getSpecifiedSchema(); - void setSpecifiedSchema(String schema); - String SPECIFIED_SCHEMA_PROPERTY = "specifiedSchema"; //$NON-NLS-1$ - String getDefaultSchema(); - String DEFAULT_SCHEMA_PROPERTY = "defaultSchema"; //$NON-NLS-1$ - Schema getDbSchema(); - - /** - * Covariant override. - */ - OrmPersistenceUnitMetadata getPersistenceUnitMetadata(); - - /** - * Covariant override. - */ - ListIterable getPersistentTypes(); - int getPersistentTypesSize(); - OrmPersistentType addPersistentType(String mappingKey, String className); - void removePersistentType(int index); - void removePersistentType(OrmPersistentType persistentType); - //void movePersistentType(int targetIndex, int sourceIndex); - boolean containsPersistentType(String className); - /** - * Return the persistent type listed in the mapping file - * with the specified type name. Return null if none exists. - */ - OrmPersistentType getPersistentType(String className); - String PERSISTENT_TYPES_LIST = "persistentTypes"; //$NON-NLS-1$ - - ListIterable getSequenceGenerators(); - int getSequenceGeneratorsSize(); - OrmSequenceGenerator addSequenceGenerator(); - OrmSequenceGenerator addSequenceGenerator(int index); - void removeSequenceGenerator(int index); - void removeSequenceGenerator(OrmSequenceGenerator sequenceGenerator); - void moveSequenceGenerator(int targetIndex, int sourceIndex); - String SEQUENCE_GENERATORS_LIST = "sequenceGenerators"; //$NON-NLS-1$ - - ListIterable getTableGenerators(); - int getTableGeneratorsSize(); - OrmTableGenerator addTableGenerator(); - OrmTableGenerator addTableGenerator(int index); - void removeTableGenerator(int index); - void removeTableGenerator(OrmTableGenerator tableGenerator); - void moveTableGenerator(int targetIndex, int sourceIndex); - String TABLE_GENERATORS_LIST = "tableGenerators"; //$NON-NLS-1$ - - OrmQueryContainer getQueryContainer(); - - /** - * Return the default package to be used for persistent types in this - * context. - */ - String getDefaultPersistentTypePackage(); - - void changeMapping(OrmPersistentType ormPersistentType, OrmTypeMapping oldMapping, OrmTypeMapping newMapping); - - boolean containsOffset(int textOffset); - - /** - * Return the Java resource persistent type for the specified class name - * found in the JPA project. First look for one with the specified - * name (since it might be fully qualified). If not found, prepend the - * default package name and try again. - * - * @see #getPackage() - */ - JavaResourcePersistentType resolveJavaResourcePersistentType(String className); - - /** - * Return the persistent type for the specified class name - * found in the persistence unit. First look for one with the specified - * name (since it might be fully qualified). If not found, prepend the - * default package name and try again. - * - * @see #getPackage() - */ - PersistentType resolvePersistentType(String className); - - - - // ********** refactoring ********** - - /** - * Create DeleteEdits for deleting references (if any) to the type about to be deleted. - * Return an EmptyIterable if there are not any references to the given type. - */ - Iterable createDeleteTypeEdits(IType type); - - /** - * Create ReplaceEdits for renaming any references to the originalType to the newName. - * The originalType has not yet been renamed, the newName is the new short name. - */ - Iterable createRenameTypeEdits(IType originalType, String newName); - - /** - * Create ReplaceEdits for moving any references to the originalType to the newPackage. - * The originalType has not yet been moved. - */ - Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage); - - /** - * Create ReplaceEdits for renaming any references to the originalPackage to the newName. - * The originalPackage has not yet been renamed. - */ - Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/MappingFileDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/MappingFileDefinition.java deleted file mode 100644 index fa9ef11e5b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/MappingFileDefinition.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.ResourceDefinition; - -/** - * A JPA platform can support multiple mapping files. Each will - * have a unique resource type and must be defined with a mapping file definition. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface MappingFileDefinition - extends ResourceDefinition -{ - // nothing yet -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/NullOrmAttributeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/NullOrmAttributeMappingDefinition.java deleted file mode 100644 index fa21aa9a48..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/NullOrmAttributeMappingDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping; - -/** - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public class NullOrmAttributeMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmAttributeMappingDefinition INSTANCE = - new NullOrmAttributeMappingDefinition(); - - - /** - * Return the singleton. - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private NullOrmAttributeMappingDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - throw new UnsupportedOperationException(); - } - - public OrmAttributeMapping buildContextMapping(OrmPersistentAttribute parent, XmlAttributeMapping resourceMapping, OrmXmlContextNodeFactory factory) { - return factory.buildOrmNullAttributeMapping(parent, (XmlNullAttributeMapping) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverride.java deleted file mode 100644 index 697d5f397e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverride.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.AssociationOverride; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride; - -/** - * orm.xml association override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmAssociationOverride - extends OrmReadOnlyAssociationOverride, AssociationOverride, OrmOverride -{ - OrmVirtualAssociationOverride convertToVirtual(); - - XmlAssociationOverride getXmlOverride(); - - OrmOverrideRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverrideContainer.java deleted file mode 100644 index bf2956fa23..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAssociationOverrideContainer.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import java.util.ListIterator; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.VirtualOverride; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride; - -/** - * orm.xml association override container - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface OrmAssociationOverrideContainer - extends AssociationOverrideContainer, OrmOverrideContainer -{ - ListIterator overrides(); - OrmReadOnlyAssociationOverride getOverrideNamed(String name); - ListIterator specifiedOverrides(); - OrmAssociationOverride getSpecifiedOverride(int index); - OrmAssociationOverride getSpecifiedOverrideNamed(String name); - ListIterator virtualOverrides(); - OrmVirtualAssociationOverride convertOverrideToVirtual(Override_ specifiedOverride); - OrmAssociationOverride convertOverrideToSpecified(VirtualOverride virtualOverride); - - - // ********** owner ********** - - interface Owner - extends AssociationOverrideContainer.Owner, OrmOverrideContainer.Owner - { - @SuppressWarnings("unchecked") - EList getXmlOverrides(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMapping.java deleted file mode 100644 index 9c298bf8fb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMapping.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * orm.xml attribute mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.3 - */ -public interface OrmAttributeMapping - extends AttributeMapping, XmlContextNode -{ - OrmPersistentAttribute getParent(); - - OrmPersistentAttribute getPersistentAttribute(); - - XmlAttributeMapping getXmlAttributeMapping(); - - OrmTypeMapping getTypeMapping(); - - void setName(String name); - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - - /** - * Attributes are a sequence in the orm.xml schema. We must keep - * the list of attributes in the appropriate order so the WTP XML - * translators will write them to the XML document in that order and they - * will adhere to the schema. - *

- * Each implementation must implement this - * method and return a number that matches its order in the schema. - */ - int getXmlSequence(); - - void addXmlAttributeMappingTo(Attributes resourceAttributes); - - void removeXmlAttributeMappingFrom(Attributes resourceAttributes); - - boolean contains(int textOffset); - - TextRange getSelectionTextRange(); - - TextRange getNameTextRange(); - - - // ********** morphing mappings ********** - - void initializeOn(OrmAttributeMapping newMapping); - - void initializeFromOrmAttributeMapping(OrmAttributeMapping oldMapping); - - void initializeFromOrmBasicMapping(OrmBasicMapping oldMapping); - - void initializeFromOrmIdMapping(OrmIdMapping oldMapping); - - void initializeFromOrmTransientMapping(OrmTransientMapping oldMapping); - - void initializeFromOrmEmbeddedMapping(OrmEmbeddedMapping oldMapping); - - void initializeFromOrmEmbeddedIdMapping(OrmEmbeddedIdMapping oldMapping); - - void initializeFromOrmVersionMapping(OrmVersionMapping oldMapping); - - void initializeFromOrmOneToManyMapping(OrmOneToManyMapping oldMapping); - - void initializeFromOrmManyToOneMapping(OrmManyToOneMapping oldMapping); - - void initializeFromOrmOneToOneMapping(OrmOneToOneMapping oldMapping); - - void initializeFromOrmManyToManyMapping(OrmManyToManyMapping oldMapping); - - - // ********** refactoring ********** - - /** - * Create ReplaceEdits for renaming any references to the originalType to the newName. - * The originalType has not yet been renamed, the newName is the new short name. - */ - Iterable createRenameTypeEdits(IType originalType, String newName); - - /** - * Create ReplaceEdits for moving any references to the originalType to the newPackage. - * The originalType has not yet been moved. - */ - Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage); - - /** - * Create ReplaceEdits for renaming any references to the originalPackage to the newName. - * The originalPackage has not yet been renamed. - */ - Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMappingDefinition.java deleted file mode 100644 index d6f5e55b84..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeMappingDefinition.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; - -/** - * Part of mechanism to extend the types of orm.xml attribute - * mappings. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface OrmAttributeMappingDefinition -{ - /** - * Return the definition's mapping key. - */ - String getKey(); - - /** - * Build a resource mapping. - */ - XmlAttributeMapping buildResourceMapping(EFactory factory); - - /** - * Build a context mapping. - */ - OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverride.java deleted file mode 100644 index 1a3ea76ffe..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverride.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.AttributeOverride; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride; - -/** - * orm.xml attribute override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmAttributeOverride - extends OrmReadOnlyAttributeOverride, AttributeOverride, OrmOverride -{ - OrmVirtualAttributeOverride convertToVirtual(); - - XmlAttributeOverride getXmlOverride(); - - OrmColumn getColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverrideContainer.java deleted file mode 100644 index f74f7175ac..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmAttributeOverrideContainer.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import java.util.ListIterator; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.VirtualOverride; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride; - -/** - * orm.xml attribute override container - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface OrmAttributeOverrideContainer - extends AttributeOverrideContainer, OrmOverrideContainer -{ - ListIterator overrides(); - OrmReadOnlyAttributeOverride getOverrideNamed(String name); - ListIterator specifiedOverrides(); - OrmAttributeOverride getSpecifiedOverride(int index); - OrmAttributeOverride getSpecifiedOverrideNamed(String name); - ListIterator virtualOverrides(); - OrmVirtualAttributeOverride convertOverrideToVirtual(Override_ specifiedOverride); - OrmAttributeOverride convertOverrideToSpecified(VirtualOverride virtualOverride); - - void initializeFrom(OrmAttributeOverrideContainer oldContainer); - - - // ********** owner ********** - - interface Owner - extends AttributeOverrideContainer.Owner, OrmOverrideContainer.Owner - { - @SuppressWarnings("unchecked") - EList getXmlOverrides(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseColumn.java deleted file mode 100644 index a25338f4a5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseColumn.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn; - -/** - * orm.xml column or join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmBaseColumn - extends BaseColumn, OrmNamedColumn -{ - AbstractXmlColumn getXmlColumn(); - - /** - * Return the (best guess) text location of the column's table. - */ - TextRange getTableTextRange(); - - - // ********** owner ********** - - /** - * interface allowing columns to be used in multiple places - * (e.g. basic mappings and attribute overrides) - */ - interface Owner - extends OrmNamedColumn.Owner, BaseColumn.Owner - { - // combine two interfaces - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseEmbeddedMapping.java deleted file mode 100644 index 17d8d1d110..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseEmbeddedMapping.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.BaseEmbeddedMapping; -import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlEmbedded; - -/** - * Behavior common to orm.xml embedded and embedded ID mappings. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmBaseEmbeddedMapping - extends BaseEmbeddedMapping, OrmAttributeMapping -{ - AbstractXmlEmbedded getXmlAttributeMapping(); - - OrmAttributeOverrideContainer getAttributeOverrideContainer(); -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseJoinColumn.java deleted file mode 100644 index 32600b6ec1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBaseJoinColumn.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.BaseJoinColumn; - -/** - * orm.xml join column or primary key join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmBaseJoinColumn - extends BaseJoinColumn, OrmNamedColumn -{ - /** - * Return the (best guess) text location of the column's - * referenced column name. - */ - TextRange getReferencedColumnNameTextRange(); - - - // ********** owner ********** - - /** - * interface allowing join columns to be used in multiple places - * (e.g. 1:1 mappings and join tables) - */ - interface Owner - extends BaseJoinColumn.Owner, OrmNamedColumn.Owner - { - // combine two interfaces - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBasicMapping.java deleted file mode 100644 index f691894c99..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmBasicMapping.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.BasicMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic; - -/** - * orm.xml basic mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmBasicMapping - extends BasicMapping, OrmColumnMapping, OrmConvertibleMapping -{ - XmlBasic getXmlAttributeMapping(); -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmCascade.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmCascade.java deleted file mode 100644 index f8333ad944..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmCascade.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.Cascade; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; - -/** - * orm.xml cascade (persist, merge, remove, refresh) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface OrmCascade - extends Cascade, XmlContextNode -{ - void initializeFrom(Cascade oldCascade); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmCollectionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmCollectionMapping.java deleted file mode 100644 index aae5833bcf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmCollectionMapping.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.CollectionMapping; - -/** - * JPA orm.xml collection mapping (e.g. 1:m, m:m, element collection) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmCollectionMapping - extends CollectionMapping, OrmAttributeMapping -{ - OrmOrderable getOrderable(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmColumn.java deleted file mode 100644 index 0d5cde88fa..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmColumn.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn; - -/** - * orm.xml column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmColumn - extends Column, OrmBaseColumn -{ - XmlColumn getXmlColumn(); - - - // ********** owner ********** - - /** - * interface allowing columns to be used in multiple places - * (e.g. basic mappings and attribute overrides) - */ - interface Owner - extends OrmBaseColumn.Owner - { - XmlColumn getXmlColumn(); - - XmlColumn buildXmlColumn(); - - void removeXmlColumn(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmColumnMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmColumnMapping.java deleted file mode 100644 index 0f8f85695f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmColumnMapping.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.ColumnMapping; - -/** - * orm.xml column mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public interface OrmColumnMapping - extends ColumnMapping, OrmAttributeMapping, OrmColumn.Owner -{ - OrmColumn getColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConverter.java deleted file mode 100644 index 2e8001eb7e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConverter.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * orm.xml converter - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.1 - */ -public interface OrmConverter - extends Converter, XmlContextNode -{ - OrmAttributeMapping getParent(); - - /** - * We need this "hack" because we can't build the resource converter before - * we build the context converter. There is no resource "converter", just a - * simple setting on the mapping. (Maybe "converter" is not the best way to - * model what is going on here....) - */ - void initialize(); - - - // ********** refactoring ********** - - /** - * Create ReplaceEdits for renaming any references to the originalType to the newName. - * The originalType has not yet been renamed, the newName is the new short name. - */ - Iterable createRenameTypeEdits(IType originalType, String newName); - - /** - * Create ReplaceEdits for moving any references to the originalType to the newPackage. - * The originalType has not yet been moved. - */ - Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage); - - /** - * Create ReplaceEdits for renaming any references to the originalPackage to the newName. - * The originalPackage has not yet been renamed. - */ - Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName); - - - // ********** adapter ********** - - /** - * This interface allows a convertible mapping to interact with various - * orm.xml converters via the same protocol. - */ - public interface Adapter - { - /** - * Return the type of converter handled by the adapter. - */ - Class getConverterType(); - - /** - * Build a converter for specified mapping - * if the mapping's XML has the adapter's value set. - * Return null otherwise. - * This is used to build a converter during construction of the - * converter's mapping. - */ - OrmConverter buildConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory); - - /** - * Return whether the specified XML mapping has the - * adapter's value set. If the adapter is active and the context - * mapping's converter does not match the adapter, the mapping will - * build a new converter (via the adapter). - * - * @see #buildNewConverter(OrmAttributeMapping, OrmXmlContextNodeFactory) - */ - boolean isActive(XmlConvertibleMapping xmlMapping); - - /** - * Build a converter for specified mapping. - * This is used when the context model is synchronized with the - * resource model (and the resource model has changed) or when a client - * changes a mapping's converter. - * The appropriate setting in the XML mapping will be configured once - * the context converter has been added to the context model (see {@link - * OrmConverter#initialize()}. - * - * @see #isActive(XmlConvertibleMapping) - */ - OrmConverter buildNewConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory); - - /** - * Clear the adapter's XML value from the specified XML mapping. - */ - void clearXmlValue(XmlConvertibleMapping xmlMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConvertibleMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConvertibleMapping.java deleted file mode 100644 index ebfdafbd42..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmConvertibleMapping.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.ConvertibleMapping; - -/** - * orm.xml attribute mapping that has a - * converter (e.g. basic, ID, version). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmConvertibleMapping - extends ConvertibleMapping, OrmAttributeMapping -{ - OrmConverter getConverter(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmDiscriminatorColumn.java deleted file mode 100644 index 246a6581db..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmDiscriminatorColumn.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.DiscriminatorColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn; - -/** - * orm.xml discriminator column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface OrmDiscriminatorColumn - extends DiscriminatorColumn, OrmNamedColumn -{ - XmlDiscriminatorColumn getXmlColumn(); - - - // ********** owner ********** - - /** - * interface allowing discriminator columns to be used in multiple places - */ - interface Owner - extends OrmNamedColumn.Owner, DiscriminatorColumn.Owner - { - XmlDiscriminatorColumn getXmlColumn(); - - XmlDiscriminatorColumn buildXmlColumn(); - - void removeXmlColumn(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddable.java deleted file mode 100644 index 03861f395b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddable.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.Embeddable; -import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable; - -/** - * orm.xml embeddable type mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmEmbeddable - extends Embeddable, OrmTypeMapping -{ - XmlEmbeddable getXmlTypeMapping(); - - JavaEmbeddable getJavaTypeMapping(); - - JavaEmbeddable getJavaTypeMappingForDefaults(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddedIdMapping.java deleted file mode 100644 index 84ec06f7da..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddedIdMapping.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId; - -/** - * orm.xml embedded ID mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmEmbeddedIdMapping - extends EmbeddedIdMapping, OrmBaseEmbeddedMapping -{ - XmlEmbeddedId getXmlAttributeMapping(); -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddedMapping.java deleted file mode 100644 index 4587e93bae..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEmbeddedMapping.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.EmbeddedMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded; - -/** - * orm.xml embedded mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmEmbeddedMapping - extends EmbeddedMapping, OrmBaseEmbeddedMapping -{ - XmlEmbedded getXmlAttributeMapping(); -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEntity.java deleted file mode 100644 index 505e4d7ff5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEntity.java +++ /dev/null @@ -1,98 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable; -import org.eclipse.jpt.jpa.core.context.java.JavaEntity; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity; - -/** - * orm.xml entity - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmEntity - extends Entity, OrmTypeMapping -{ - XmlEntity getXmlTypeMapping(); - - JavaEntity getJavaTypeMapping(); - - JavaEntity getJavaTypeMappingForDefaults(); - - OrmTable getTable(); - - OrmIdClassReference getIdClassReference(); - - OrmDiscriminatorColumn getDiscriminatorColumn(); - - - // ********** secondary tables ********** - - ListIterator secondaryTables(); - ListIterator specifiedSecondaryTables(); - OrmSecondaryTable addSpecifiedSecondaryTable(); - OrmSecondaryTable addSpecifiedSecondaryTable(int index); - - /** - * Return the virtual (not specified) secondary tables. - */ - ListIterator virtualSecondaryTables(); - String VIRTUAL_SECONDARY_TABLES_LIST = "virtualSecondaryTables"; //$NON-NLS-1$ - - /** - * Return the number of virtual secondary tables. - */ - int virtualSecondaryTablesSize(); - - /** - * Return true if there are no virtual secondary tables on the orm entity. - * This is used to determine whether you can add specified secondary tables. - * You must first make sure all virtual secondary tables have been specified - * in xml before adding more. This is because adding one secondary table to xml - * will override all the secondary tables specified in the java entity - */ - boolean secondaryTablesAreDefinedInXml(); - - /** - * If true, then all virtual secondary tables are added in as specified secondary tables to the xml. - * If false, then all the specified secondary tables are remvoed from the xml. - */ - void setSecondaryTablesAreDefinedInXml(boolean defineInXml); - - - // ********** primary key join columns ********** - - ListIterator primaryKeyJoinColumns(); - ListIterator specifiedPrimaryKeyJoinColumns(); - OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(); - OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index); - - ListIterator defaultPrimaryKeyJoinColumns(); - String DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST = "defaultPrimaryKeyJoinColumns"; //$NON-NLS-1$ - - - // ********** containers ********** - - OrmAttributeOverrideContainer getAttributeOverrideContainer(); - OrmAssociationOverrideContainer getAssociationOverrideContainer(); - OrmQueryContainer getQueryContainer(); - OrmGeneratorContainer getGeneratorContainer(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEnumeratedConverter.java deleted file mode 100644 index 859883f98b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmEnumeratedConverter.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.EnumeratedConverter; -import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping; - -/** - * orm.xml enumerated converter - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmEnumeratedConverter - extends EnumeratedConverter, OrmConverter -{ - // ********** adapter ********** - - public static class Adapter - implements OrmConverter.Adapter - { - private static final Adapter INSTANCE = new Adapter(); - public static Adapter instance() { - return INSTANCE; - } - - private Adapter() { - super(); - } - - public Class getConverterType() { - return EnumeratedConverter.class; - } - - public OrmConverter buildConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { - XmlConvertibleMapping xmlMapping = (XmlConvertibleMapping) parent.getXmlAttributeMapping(); - return (xmlMapping.getEnumerated() == null) ? null : factory.buildOrmEnumeratedConverter(parent); - } - - public boolean isActive(XmlConvertibleMapping xmlMapping) { - return xmlMapping.getEnumerated() != null; - } - - public OrmConverter buildNewConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { - return factory.buildOrmEnumeratedConverter(parent); - } - - public void clearXmlValue(XmlConvertibleMapping xmlMapping) { - xmlMapping.setEnumerated(null); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGeneratedValue.java deleted file mode 100644 index f42e8c098b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGeneratedValue.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.GeneratedValue; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue; - -/** - * orm.xml generated value - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface OrmGeneratedValue - extends GeneratedValue, XmlContextNode -{ - XmlGeneratedValue getXmlGeneratedValue(); - - /** - * Return the (best guess) text location of the generator. - */ - TextRange getGeneratorTextRange(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGenerator.java deleted file mode 100644 index cd1791fd1f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGenerator.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Generator; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator; - -/** - * orm.xml sequence and table generators - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public interface OrmGenerator - extends Generator, XmlContextNode -{ - XmlGenerator getXmlGenerator(); - - TextRange getNameTextRange(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGeneratorContainer.java deleted file mode 100644 index b858c265f0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmGeneratorContainer.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.GeneratorContainer; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; - -/** - * orm.xml generator container - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface OrmGeneratorContainer - extends GeneratorContainer, XmlContextNode -{ - // ********** sequence generator ********** - - OrmSequenceGenerator getSequenceGenerator(); - - OrmSequenceGenerator addSequenceGenerator(); - - - // ********** table generator ********** - - OrmTableGenerator getTableGenerator(); - - OrmTableGenerator addTableGenerator(); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdClassReference.java deleted file mode 100644 index c27612bedc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdClassReference.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.jpa.core.context.IdClassReference; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference; -import org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * orm.xml ID class reference - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.3 - */ -public interface OrmIdClassReference - extends IdClassReference, XmlContextNode -{ - // ********** refactoring ********** - - /** - * Create ReplaceEdits for renaming any references to the originalType to the newName. - * The originalType has not yet been renamed, the newName is the new short name. - */ - Iterable createRenameTypeEdits(IType originalType, String newName); - - /** - * Create ReplaceEdits for moving any references to the originalType to the newPackage. - * The originalType has not yet been moved. - */ - Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage); - - /** - * Create ReplaceEdits for renaming any references to the originalPackage to the newName. - * The originalPackage has not yet been renamed. - */ - Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName); - - - // ********** owner ********** - - interface Owner { - XmlIdClassContainer getXmlIdClassContainer(); - JavaIdClassReference getJavaIdClassReferenceForDefaults(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdMapping.java deleted file mode 100644 index 1b6be0b6dd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmIdMapping.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.IdMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlId; - -/** - * orm.xml ID mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmIdMapping - extends IdMapping, OrmColumnMapping, OrmConvertibleMapping -{ - XmlId getXmlAttributeMapping(); - - OrmGeneratorContainer getGeneratorContainer(); - - OrmGeneratedValue getGeneratedValue(); - OrmGeneratedValue addGeneratedValue(); -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumn.java deleted file mode 100644 index 2699ae3a4a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumn.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn; - -/** - * orm.xml join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmJoinColumn - extends JoinColumn, OrmBaseJoinColumn, OrmBaseColumn -{ - XmlJoinColumn getXmlColumn(); - - - // ********** owner ********** - - interface Owner - extends JoinColumn.Owner, OrmBaseJoinColumn.Owner, OrmBaseColumn.Owner - { - // combine interfaces - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationship.java deleted file mode 100644 index e99324dbd7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationship.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.JoinColumnRelationship; -import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumnContainer; - -/** - * orm.xml join column relationship - * (1:1, 1:m, m:1, and association override) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface OrmJoinColumnRelationship - extends JoinColumnRelationship, OrmRelationship -{ - XmlJoinColumnContainer getXmlContainer(); - - OrmJoinColumnRelationshipStrategy getJoinColumnStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationshipStrategy.java deleted file mode 100644 index 3f01842efa..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.JoinColumnRelationshipStrategy; - -/** - * orm.xml join column relationship strategy - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface OrmJoinColumnRelationshipStrategy - extends JoinColumnRelationshipStrategy, OrmRelationshipStrategy -{ - ListIterator joinColumns(); - - ListIterator specifiedJoinColumns(); - OrmJoinColumn getSpecifiedJoinColumn(int index); - OrmJoinColumn addSpecifiedJoinColumn(); - OrmJoinColumn addSpecifiedJoinColumn(int index); - - OrmJoinColumn getDefaultJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTable.java deleted file mode 100644 index 4d3d7a27bc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTable.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.JoinTable; - -/** - * orm.xml join table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmJoinTable - extends JoinTable, OrmReferenceTable -{ - OrmJoinTableRelationshipStrategy getParent(); - - // ********** inverse join columns ********** - - ListIterator inverseJoinColumns(); - - ListIterator specifiedInverseJoinColumns(); - OrmJoinColumn getSpecifiedInverseJoinColumn(int index); - OrmJoinColumn addSpecifiedInverseJoinColumn(); - OrmJoinColumn addSpecifiedInverseJoinColumn(int index); - - OrmJoinColumn getDefaultInverseJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTableRelationship.java deleted file mode 100644 index 8d15df3467..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTableRelationship.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.JoinTableRelationship; -import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTableContainer; - -/** - * orm.xml join table relationship (1:1, 1:m, m:1, m:m) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface OrmJoinTableRelationship - extends JoinTableRelationship, OrmRelationship -{ - XmlJoinTableContainer getXmlContainer(); - - OrmJoinTableRelationshipStrategy getJoinTableStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTableRelationshipStrategy.java deleted file mode 100644 index f35384d08e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmJoinTableRelationshipStrategy.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.JoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable; - -/** - * orm.xml join table relationship strategy - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface OrmJoinTableRelationshipStrategy - extends JoinTableRelationshipStrategy, OrmRelationshipStrategy -{ - OrmJoinTable getJoinTable(); - - XmlJoinTable getXmlJoinTable(); - - XmlJoinTable buildXmlJoinTable(); - - void removeXmlJoinTable(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmLobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmLobConverter.java deleted file mode 100644 index f1a29164b4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmLobConverter.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.LobConverter; -import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping; - -/** - * orm.xml LOB converter - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmLobConverter - extends LobConverter, OrmConverter -{ - // ********** adapter ********** - - public static class Adapter - implements OrmConverter.Adapter - { - private static final Adapter INSTANCE = new Adapter(); - public static Adapter instance() { - return INSTANCE; - } - - private Adapter() { - super(); - } - - public Class getConverterType() { - return LobConverter.class; - } - - public OrmConverter buildConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { - XmlConvertibleMapping xmlMapping = (XmlConvertibleMapping) parent.getXmlAttributeMapping(); - return xmlMapping.isLob() ? factory.buildOrmLobConverter(parent) : null; - } - - public boolean isActive(XmlConvertibleMapping xmlMapping) { - return xmlMapping.isLob(); - } - - public OrmConverter buildNewConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { - return factory.buildOrmLobConverter(parent); - } - - public void clearXmlValue(XmlConvertibleMapping xmlMapping) { - xmlMapping.setLob(false); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToManyMapping.java deleted file mode 100644 index de5e5ecb0b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToManyMapping.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.ManyToManyMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany; - -/** - * orm.xml m:m mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface OrmManyToManyMapping - extends ManyToManyMapping, OrmMultiRelationshipMapping -{ - XmlManyToMany getXmlAttributeMapping(); - - OrmManyToManyRelationship getRelationship(); -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToManyRelationship.java deleted file mode 100644 index f2f2d7edc0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToManyRelationship.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.ManyToManyRelationship; -import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany; - -/** - * orm.xml m:m relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface OrmManyToManyRelationship - extends ManyToManyRelationship, - OrmMappedByRelationship, - OrmMappingJoinTableRelationship -{ - XmlManyToMany getXmlContainer(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToOneMapping.java deleted file mode 100644 index 1bd07cf10a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToOneMapping.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.ManyToOneMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne; - -/** - * orm.xml m:1 mapping. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface OrmManyToOneMapping - extends ManyToOneMapping, OrmSingleRelationshipMapping -{ - XmlManyToOne getXmlAttributeMapping(); - - OrmManyToOneRelationship getRelationship(); -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToOneRelationship.java deleted file mode 100644 index c7b47fd010..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmManyToOneRelationship.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.ManyToOneRelationship; -import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne; - -/** - * orm.xml m:1 relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface OrmManyToOneRelationship - extends ManyToOneRelationship, OrmMappingJoinColumnRelationship -{ - XmlManyToOne getXmlContainer(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedByRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedByRelationship.java deleted file mode 100644 index 2ac19206a8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedByRelationship.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.MappedByRelationship; -import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedByMapping; - -/** - * orm.xml "mapped by" relationship (1:1, 1:m, m:m) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface OrmMappedByRelationship - extends MappedByRelationship, OrmRelationship -{ - XmlMappedByMapping getXmlContainer(); - - OrmMappedByRelationshipStrategy getMappedByStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedByRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedByRelationshipStrategy.java deleted file mode 100644 index cc250f2d6c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedByRelationshipStrategy.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.MappedByRelationshipStrategy; - -/** - * orm.xml "mapped by" relationship strategy - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface OrmMappedByRelationshipStrategy - extends OrmRelationshipStrategy, MappedByRelationshipStrategy -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedSuperclass.java deleted file mode 100644 index 437675b778..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappedSuperclass.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.MappedSuperclass; -import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass; -import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass; - -/** - * orm.xml mapped superclass - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmMappedSuperclass - extends MappedSuperclass, OrmTypeMapping -{ - XmlMappedSuperclass getXmlTypeMapping(); - - OrmIdClassReference getIdClassReference(); - - JavaMappedSuperclass getJavaTypeMapping(); - - JavaMappedSuperclass getJavaTypeMappingForDefaults(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingJoinColumnRelationship.java deleted file mode 100644 index 504846fb08..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingJoinColumnRelationship.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -/** - * orm.xml mapping join column relationship (1:1, 1:m, m:1) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmMappingJoinColumnRelationship - extends OrmJoinColumnRelationship, OrmMappingRelationship -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingJoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingJoinTableRelationship.java deleted file mode 100644 index 72403bbef2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingJoinTableRelationship.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -/** - * orm.xml mapping join table relationship (1:1, 1:m, m:1, m:m) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmMappingJoinTableRelationship - extends OrmJoinTableRelationship, - OrmMappingRelationship -{ - // combine various interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingRelationship.java deleted file mode 100644 index d366671163..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMappingRelationship.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.MappingRelationship; - -/** - * orm.xml mapping relationship (1:1, 1:m, m:1, m:m) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.2 - */ -public interface OrmMappingRelationship - extends MappingRelationship, OrmRelationship -{ - OrmRelationshipMapping getMapping(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMultiRelationshipMapping.java deleted file mode 100644 index 6408e6f1a5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmMultiRelationshipMapping.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.MultiRelationshipMapping; -import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping; - -/** - * orm.xml multi-valued (1:m, m:m) relationship mapping. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmMultiRelationshipMapping - extends MultiRelationshipMapping, OrmRelationshipMapping, OrmCollectionMapping -{ - AbstractXmlMultiRelationshipMapping getXmlAttributeMapping(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedColumn.java deleted file mode 100644 index ff7236a4bd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedColumn.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn; - - -/** - * orm.xml - *

    - *
  • column - *
  • join column - *
  • primary key join column - *
  • discriminator column - *
  • order column - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmNamedColumn - extends NamedColumn, XmlContextNode -{ - AbstractXmlNamedColumn getXmlColumn(); - - /** - * Return the (best guess) text location of the column's name. - */ - TextRange getNameTextRange(); - - - // ********** owner ********** - - /** - * interface allowing columns to be used in multiple places - * (e.g. basic mappings and attribute overrides) - */ - interface Owner - extends NamedColumn.Owner - { - /** - * Return the column owner's text range. This can be returned by the - * column when its annotation is not present. - */ - TextRange getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedNativeQuery.java deleted file mode 100644 index bde37c1a12..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedNativeQuery.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jpa.core.context.NamedNativeQuery; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery; - -/** - * orm.xml named native query - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface OrmNamedNativeQuery - extends OrmQuery, NamedNativeQuery -{ - XmlNamedNativeQuery getXmlQuery(); - - // required to resolve ambiguity - ListIterable getHints(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedQuery.java deleted file mode 100644 index fc5aba360e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmNamedQuery.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jpa.core.context.NamedQuery; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery; - -/** - * orm.xml named query - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface OrmNamedQuery - extends OrmQuery, NamedQuery -{ - XmlNamedQuery getXmlQuery(); - - // required to resolve ambiguity - ListIterable getHints(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToManyMapping.java deleted file mode 100644 index c984cb9004..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToManyMapping.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.OneToManyMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany; - -/** - * orm.xml 1:m mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmOneToManyMapping - extends OneToManyMapping, OrmMultiRelationshipMapping -{ - XmlOneToMany getXmlAttributeMapping(); - - OrmOneToManyRelationship getRelationship(); -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToManyRelationship.java deleted file mode 100644 index a37d64d5de..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToManyRelationship.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.OneToManyRelationship; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany; - -/** - * orm.xml 1:m relationship reference - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface OrmOneToManyRelationship - extends OneToManyRelationship, - OrmMappedByRelationship, - OrmMappingJoinTableRelationship -{ - XmlOneToMany getXmlContainer(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToOneMapping.java deleted file mode 100644 index 51bfe95b55..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToOneMapping.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.OneToOneMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne; - -/** - * orm.xml 1:1 mapping. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface OrmOneToOneMapping - extends OneToOneMapping, OrmSingleRelationshipMapping -{ - XmlOneToOne getXmlAttributeMapping(); - - OrmOneToOneRelationship getRelationship(); -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToOneRelationship.java deleted file mode 100644 index 2947aadeb6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOneToOneRelationship.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.OneToOneRelationship; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne; - -/** - * orm.xml 1:1 relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface OrmOneToOneRelationship - extends OneToOneRelationship, - OrmMappedByRelationship, - OrmPrimaryKeyJoinColumnRelationship, - OrmMappingJoinColumnRelationship -{ - XmlOneToOne getXmlContainer(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOrderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOrderable.java deleted file mode 100644 index 96c78052cf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOrderable.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.Orderable; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; - -/** - * Multi-valued (1:m, m:m) relationship mappings support ordering. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface OrmOrderable - extends Orderable, XmlContextNode -{ - OrmAttributeMapping getParent(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverride.java deleted file mode 100644 index 2bd280da20..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverride.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOverride; - -/** - * orm.xml override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmOverride - extends Override_, OrmReadOnlyOverride -{ - OrmVirtualOverride convertToVirtual(); - - XmlOverride getXmlOverride(); - - /** - * Return the (best guess) text location of the override's name. - */ - TextRange getNameTextRange(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java deleted file mode 100644 index fb15a1aadc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideContainer.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import java.util.ListIterator; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.OverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.VirtualOverride; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOverride; - -/** - * orm.xml attribute or association override container - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface OrmOverrideContainer - extends OverrideContainer, XmlContextNode -{ - ListIterator overrides(); - OrmReadOnlyOverride getOverrideNamed(String name); - ListIterator specifiedOverrides(); - OrmOverride getSpecifiedOverride(int index); - OrmOverride getSpecifiedOverrideNamed(String name); - ListIterator virtualOverrides(); - OrmVirtualOverride convertOverrideToVirtual(Override_ specifiedOverride); - OrmOverride convertOverrideToSpecified(VirtualOverride virtualOverride); - - - interface Owner - extends OverrideContainer.Owner - { - EList getXmlOverrides(); - - OrmTypeMapping getTypeMapping(); - - TextRange getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideRelationship.java deleted file mode 100644 index dd2f0f4baf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmOverrideRelationship.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.OverrideRelationship; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride; - -/** - * orm.xml association override relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface OrmOverrideRelationship - extends OverrideRelationship, - OrmJoinColumnRelationship -{ - OrmAssociationOverride getAssociationOverride(); - - XmlAssociationOverride getXmlContainer(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitDefaults.java deleted file mode 100644 index f912d1067f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitDefaults.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitDefaults; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; - -/** - * Context model corresponding to the - * XML resource model {@link org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults}, - * which corresponds to the persistence-unit-defaults element - * in the orm.xml file. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.1 - */ -public interface OrmPersistenceUnitDefaults - extends MappingFilePersistenceUnitDefaults -{ - /** - * Covariant override. - */ - OrmPersistenceUnitMetadata getParent(); - - // ********** access ********** - void setAccess(AccessType value); - String ACCESS_PROPERTY = "access"; //$NON-NLS-1$ - - // ********** schema container ********** - SchemaContainer getDbSchemaContainer(); - - // ********** catalog ********** - String getSpecifiedCatalog(); - void setSpecifiedCatalog(String newSpecifiedCatalog); - String SPECIFIED_CATALOG_PROPERTY = "specifiedCatalog"; //$NON-NLS-1$ - String getDefaultCatalog(); - String DEFAULT_CATALOG_PROPERTY = "defaultCatalog"; //$NON-NLS-1$ - Catalog getDbCatalog(); - - // ********** schema ********** - String getSpecifiedSchema(); - void setSpecifiedSchema(String newSpecifiedSchema); - String SPECIFIED_SCHEMA_PROPERTY = "specifiedSchema"; //$NON-NLS-1$ - String getDefaultSchema(); - String DEFAULT_SCHEMA_PROPERTY = "defaultSchema"; //$NON-NLS-1$ - Schema getDbSchema(); - - // ********** cascade persist ********** - void setCascadePersist(boolean value); - String CASCADE_PERSIST_PROPERTY = "cascadePersist"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitMetadata.java deleted file mode 100644 index ae87ffc6bf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistenceUnitMetadata.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitMetadata; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata; - -/** - * Context orm.xml persistence unit metadata. - * Context model corresponding to the - * XML resource model {@link XmlPersistenceUnitMetadata}, - * which corresponds to the persistence-unit-metadata element - * in the orm.xml file. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmPersistenceUnitMetadata - extends MappingFilePersistenceUnitMetadata -{ - /** - * Covariant override. - */ - EntityMappings getParent(); - - /** - * This can be null. The context metadata is always present, - * even if the XML metadata is missing. - */ - XmlEntityMappings getXmlEntityMappings(); - void setXmlMappingMetadataComplete(boolean xmlMappingMetadataComplete); - String XML_MAPPING_METADATA_COMPLETE_PROPERTY = "xmlMappingMetadataComplete"; //$NON-NLS-1$ - - OrmPersistenceUnitDefaults getPersistenceUnitDefaults(); - - XmlPersistenceUnitMetadata getXmlPersistenceUnitMetadata(); - XmlPersistenceUnitMetadata getXmlPersistenceUnitMetadataForUpdate(); - void removeXmlPersistenceUnitMetadataIfUnset(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentAttribute.java deleted file mode 100644 index b660504f2f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentAttribute.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * Context orm.xml persistent attribute - * (field or property). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public interface OrmPersistentAttribute - extends PersistentAttribute, OrmReadOnlyPersistentAttribute -{ - /** - * Return an orm.xml mapping since the attribute is - * specified. - */ - OrmAttributeMapping getMapping(); - - /** - * Convert the (currently specified) attribute to a virtual attribute. - * The attribute will be removed - * from the list of specified attributes - * and removed from the orm.xml file. Return the new attribute. - * Return null if the attribute does not correspond to an - * attribute in the Java persistent type. - *

- * @see #isVirtual() - * @see #setMappingKey(String) - */ - OrmReadOnlyPersistentAttribute convertToVirtual(); - - OrmAttributeMapping setMappingKey(String key); - - /** - * Called by the attribute's mapping when it's name changes, - * effectively changing the attribute's name. - */ - void nameChanged(String oldName, String newName); - - - // ********** refactoring ********** - - /** - * Create ReplaceEdits for renaming any references to the originalType to the newName. - * The originalType has not yet been renamed, the newName is the new short name. - */ - Iterable createRenameTypeEdits(IType originalType, String newName); - - /** - * Create ReplaceEdits for moving any references to the originalType to the newPackage. - * The originalType has not yet been moved. - */ - Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage); - - /** - * Create ReplaceEdits for renaming any references to the originalPackage to the newName. - * The originalPackage has not yet been renamed. - */ - Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java deleted file mode 100644 index b0b82a3b03..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPersistentType.java +++ /dev/null @@ -1,195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import java.util.ListIterator; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * orm.xml persistent type - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public interface OrmPersistentType - extends PersistentType, PersistentType.Owner, XmlContextNode -{ - // ********** covariant overrides ********** - - EntityMappings getParent(); - - OrmTypeMapping getMapping(); - - /** - * Return a combination of the persistent type's specified and - * virtual attributes. The specified attributes are those - * explicitly listed in the orm.xml file; while the - * virtual attributes are those derived from the corresponding - * Java persistent type. - */ - @SuppressWarnings("unchecked") - ListIterator attributes(); - - OrmReadOnlyPersistentAttribute getAttributeNamed(String attributeName); - - - // ********** specified attributes ********** - - String SPECIFIED_ATTRIBUTES_LIST = "specifiedAttributes"; //$NON-NLS-1$ - - /** - * Return the persistent type's specified attributes. - */ - ListIterator specifiedAttributes(); - - /** - * Return the number of the persistent type's specified attributes. - */ - int specifiedAttributesSize(); - - // TODO this is currently only used by tests; remove it and change tests to use - // OrmReadOnlyPersistenAttribute.convertToSpecified(String mappingKey) - OrmPersistentAttribute addSpecifiedAttribute(String mappingKey, String attributeName); - - - // ********** virtual attributes ********** - - String VIRTUAL_ATTRIBUTES_LIST = "virtualAttributes"; //$NON-NLS-1$ - - /** - * Return virtual orm.xml persistent attributes. These - * are attributes that exist in the corresponding Java class, but are not - * specified in the orm.xml. - */ - ListIterator virtualAttributes(); - - /** - * Return the number of virtual orm.xml persistent attributes. - * @see #virtualAttributes() - */ - int virtualAttributesSize(); - - /** - * Convert the specified attribute to a virtual attribute. Remove the - * attribute from the type's list of specified attributes - * and remove it from the orm.xml file. Return the new - * (virtual) attribute. - * Return null if the specified attribute does not correspond - * to an attribute in the Java persistent type. - *

- * Throw an {@link IllegalArgumentException} if the attribute is already - * virtual. - * - * @see OrmPersistentAttribute#convertToVirtual() - */ - OrmReadOnlyPersistentAttribute convertAttributeToVirtual(OrmPersistentAttribute specifiedAttribute); - - /** - * Add the specified persistent attribute to the orm.xml. - * The attribute will be added to the orm.xml and moved - * from the list of virtual attributes to the list - * of specified attributes. It will keep the same mapping it had, either - * specified in a Java annotation or the default. - *

- * Throw an {@link IllegalArgumentException} if the attribute is already - * specified. - * - * @see OrmPersistentAttribute#convertToSpecified() - */ - OrmPersistentAttribute convertAttributeToSpecified(OrmReadOnlyPersistentAttribute virtualAttribute); - - /** - * Add the specified persistent attribute to the orm.xml with - * the specified mapping. The attribute will be added to the - * orm.xml and moved from the list of virtual attributes to - * the list of specified attributes. - *

- * Throw an {@link IllegalArgumentException} if the attribute is already - * specified. - * - * @see OrmPersistentAttribute#convertToSpecified(String) - */ - OrmPersistentAttribute convertAttributeToSpecified(OrmReadOnlyPersistentAttribute virtualAttribute, String mappingKey); - - - // ********** mapping morphing ********** - - /** - * This is called whenever the specified persistent attribute's mapping is - * changed as specified. - */ - void changeMapping(OrmPersistentAttribute ormPersistentAttribute, OrmAttributeMapping oldMapping, OrmAttributeMapping newMapping); - - - // ********** refactoring ********** - - /** - * If this {@link OrmPersistentType#isFor(String)} the given IType, create a text - * DeleteEdit for deleting the type mapping element and any text that precedes it. - * Otherwise return an EmptyIterable. - * Though this will contain 1 or 0 DeleteEdits, using an Iterable - * for ease of use with other createDeleteEdit API. - */ - Iterable createDeleteTypeEdits(IType type); - - /** - * Create ReplaceEdits for renaming any references to the originalType to the newName. - * The originalType has not yet been renamed, the newName is the new short name. - */ - Iterable createRenameTypeEdits(IType originalType, String newName); - - /** - * Create ReplaceEdits for moving any references to the originalType to the newPackage. - * The originalType has not yet been moved. - */ - Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage); - - /** - * Create ReplaceEdits for renaming any references to the originalPackage to the newName. - * The originalPackage has not yet been renamed. - */ - Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName); - - - // ********** misc ********** - - boolean contains(int textOffset); - - /** - * This is called by the persistent type's mapping when its class - * (name) changes. - */ - void mappingClassChanged(String oldClass, String newClass); - - /** - * Return the Java persistent type that is referred to by the - * orm.xml persistent type. - * Return null if it is missing. - */ - JavaPersistentType getJavaPersistentType(); - String JAVA_PERSISTENT_TYPE_PROPERTY = "javaPersistentType"; //$NON-NLS-1$ - - /** - * Return the persistent type's default package. - */ - String getDefaultPackage(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumn.java deleted file mode 100644 index 0b451cc727..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumn.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn; - -/** - * orm.xml primary key join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface OrmPrimaryKeyJoinColumn - extends PrimaryKeyJoinColumn, OrmBaseJoinColumn -{ - XmlPrimaryKeyJoinColumn getXmlColumn(); - - void initializeFrom(ReadOnlyPrimaryKeyJoinColumn oldColumn); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationship.java deleted file mode 100644 index c8d304ed52..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationship.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumnContainer; - -/** - * orm.xml primary key join column relationship (1:1) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface OrmPrimaryKeyJoinColumnRelationship - extends PrimaryKeyJoinColumnRelationship, OrmMappingRelationship -{ - XmlPrimaryKeyJoinColumnContainer getXmlContainer(); - - OrmPrimaryKeyJoinColumnRelationshipStrategy getPrimaryKeyJoinColumnStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationshipStrategy.java deleted file mode 100644 index 3333e28146..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmPrimaryKeyJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumnRelationshipStrategy; - -/** - * orm.xml primary key join column relationship strategy - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface OrmPrimaryKeyJoinColumnRelationshipStrategy - extends OrmRelationshipStrategy, PrimaryKeyJoinColumnRelationshipStrategy -{ - ListIterator primaryKeyJoinColumns(); - OrmPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index); - OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(); - OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQuery.java deleted file mode 100644 index 7275bea005..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQuery.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.jpa.core.context.Query; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.XmlQuery; - -/** - * orm.xml named and named native queries - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface OrmQuery - extends Query, XmlContextNode -{ - XmlQuery getXmlQuery(); - - - // ********** hints ********** - - @SuppressWarnings("unchecked") - ListIterable getHints(); - - OrmQueryHint addHint(); - - OrmQueryHint addHint(int index); - - - // ********** validation ********** - - TextRange getNameTextRange(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryContainer.java deleted file mode 100644 index 4ef6ed563e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryContainer.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.QueryContainer; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; - -/** - * orm.xml query container - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface OrmQueryContainer - extends QueryContainer, XmlContextNode -{ - // ********** named queries ********** - - @SuppressWarnings("unchecked") - ListIterator namedQueries(); - - OrmNamedQuery addNamedQuery(); - - OrmNamedQuery addNamedQuery(int index); - - - // ********** named native queries ********** - - @SuppressWarnings("unchecked") - ListIterator namedNativeQueries(); - - OrmNamedNativeQuery addNamedNativeQuery(); - - OrmNamedNativeQuery addNamedNativeQuery(int index); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryHint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryHint.java deleted file mode 100644 index beffe63141..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmQueryHint.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.QueryHint; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint; - -/** - * orm.xml query hint - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface OrmQueryHint - extends QueryHint, XmlContextNode -{ - XmlQueryHint getXmlQueryHint(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyAssociationOverride.java deleted file mode 100644 index e751769020..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyAssociationOverride.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride; - -/** - * orm.xml association override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmReadOnlyAssociationOverride - extends ReadOnlyAssociationOverride, OrmReadOnlyOverride -{ - OrmAssociationOverrideContainer getContainer(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyAttributeOverride.java deleted file mode 100644 index 344971592a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyAttributeOverride.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride; - -/** - * Read-only orm.xml attribute override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmReadOnlyAttributeOverride - extends ReadOnlyAttributeOverride, OrmReadOnlyOverride -{ - OrmAttributeOverrideContainer getContainer(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyOverride.java deleted file mode 100644 index 410c599958..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyOverride.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; - -/** - * Read-only orm.xml override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmReadOnlyOverride - extends ReadOnlyOverride, XmlContextNode -{ - OrmOverrideContainer getContainer(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyPersistentAttribute.java deleted file mode 100644 index 6995be47ff..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyPersistentAttribute.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * Read-only context orm.xml persistent attribute - * (field or property). - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmReadOnlyPersistentAttribute - extends ReadOnlyPersistentAttribute, XmlContextNode -{ - /** - * A specified orm.xml attribute will return an - * orm.xml mapping, while a virtual attribute will - * return a Java mapping. If the attribute is virtual, the returned - * (Java) mapping is also virtual; i.e. it is read-only and is not to - * be modified (nor are any of its parts). The modifiable Java - * mapping can be retrieved via the modifiable Java attribute: - * {@link #resolveJavaPersistentAttribute()}. - */ - AttributeMapping getMapping(); - - OrmPersistentType getOwningPersistentType(); - - OrmTypeMapping getOwningTypeMapping(); - - /** - * If the orm.xml attribute is virtual, the returned Java - * attribute is also virtual; i.e. it is read-only and is not to - * be modified (nor are any of its parts [e.g. column]). The modifiable Java - * attribute can be retrieved via {@link #resolveJavaPersistentAttribute()}. - */ - JavaPersistentAttribute getJavaPersistentAttribute(); - String JAVA_PERSISTENT_ATTRIBUTE_PROPERTY = "javaPersistentAttribute"; //$NON-NLS-1$ - - /** - * Return the orm.xml attribute's Java attribute; which, in the - * case of virtual attributes, is not the same Java attribute as - * returned by {@link #getJavaPersistentAttribute()}. - *

- * This is probably useful only to tests; since nothing else will want to - * modify the returned Java attribute. - */ - JavaPersistentAttribute resolveJavaPersistentAttribute(); - - JavaResourcePersistentAttribute getJavaResourcePersistentAttribute(); - - boolean contains(int textOffset); - - - // ********** virtual -> specified ********** - - /** - * Convert the (currently virtual) attribute to a specified - * attribute. The attribute will be added to the list of specified - * attributes and added to the orm.xml file. The mapping will - * remain the same. Return the new attribute. - * @see #isVirtual() - * @throw IllegalStateException if the attribute is already specified - */ - OrmPersistentAttribute convertToSpecified(); - - /** - * Convert the (currently virtual) persistent attribute to a specified - * attribute. The attribute will be added to the list of specified - * attributes and added to the orm.xml file. The mapping will - * be changed according to the specified mapping key. - * Return the new attribute. - * @see #isVirtual() - * @throw IllegalStateException if the attribute is already specified - */ - OrmPersistentAttribute convertToSpecified(String mappingKey); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyRelationship.java deleted file mode 100644 index 09e3b7ebca..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyRelationship.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; - -/** - * orm.xml relationship (join column, join table, mapped by, - * primary key join column, mapping) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.2 - */ -public interface OrmReadOnlyRelationship - extends ReadOnlyRelationship, XmlContextNode -{ - OrmReadOnlyRelationshipStrategy getStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyRelationshipStrategy.java deleted file mode 100644 index 38e20442f6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyRelationshipStrategy.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; - -/** - * orm.xml read-only relationship strategy - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmReadOnlyRelationshipStrategy - extends ReadOnlyRelationshipStrategy, XmlContextNode -{ - OrmReadOnlyRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyUniqueConstraint.java deleted file mode 100644 index c8f8f00c81..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReadOnlyUniqueConstraint.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; - -/** - * orm.xml read-only unique constraint - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface OrmReadOnlyUniqueConstraint - extends ReadOnlyUniqueConstraint, XmlContextNode -{ - // combine interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReferenceTable.java deleted file mode 100644 index 71f53cdf13..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmReferenceTable.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.ReferenceTable; - -/** - * orm.xml join table or collection table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface OrmReferenceTable - extends ReferenceTable, OrmTable -{ - // ********** join columns ********** - - ListIterator joinColumns(); - - ListIterator specifiedJoinColumns(); - OrmJoinColumn getSpecifiedJoinColumn(int index); - OrmJoinColumn addSpecifiedJoinColumn(); - OrmJoinColumn addSpecifiedJoinColumn(int index); - - OrmJoinColumn getDefaultJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationship.java deleted file mode 100644 index 416a61364b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationship.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.Relationship; - -/** - * orm.xml relationship (join column, join table, mapped by, - * primary key join column, mapping) - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.2 - */ -public interface OrmRelationship - extends Relationship, OrmReadOnlyRelationship -{ - OrmRelationshipStrategy getStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationshipMapping.java deleted file mode 100644 index 739d460fc8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationshipMapping.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping; - -/** - * orm.xml relationship (1:1, 1:m, m:1, m:m) mapping. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmRelationshipMapping - extends RelationshipMapping, OrmAttributeMapping -{ - AbstractXmlRelationshipMapping getXmlAttributeMapping(); - - OrmCascade getCascade(); - - OrmMappingRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationshipStrategy.java deleted file mode 100644 index 7704ca4aa4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmRelationshipStrategy.java +++ /dev/null @@ -1,30 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.RelationshipStrategy; - -/** - * orm.xml relationship strategy - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.2 - */ -public interface OrmRelationshipStrategy - extends RelationshipStrategy, OrmReadOnlyRelationshipStrategy -{ - OrmRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSecondaryTable.java deleted file mode 100644 index cd600a1310..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSecondaryTable.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable; -import org.eclipse.jpt.jpa.core.context.SecondaryTable; -import org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable; - -/** - * orm.xml secondary table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface OrmSecondaryTable - extends SecondaryTable, OrmTable -{ - OrmEntity getParent(); - - void initializeFrom(ReadOnlySecondaryTable oldSecondaryTable); - - XmlSecondaryTable getXmlTable(); - - - // ********** primary key join columns ********** - - ListIterator primaryKeyJoinColumns(); - ListIterator specifiedPrimaryKeyJoinColumns(); - OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(); - OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index); - OrmPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSequenceGenerator.java deleted file mode 100644 index b4158a6c45..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSequenceGenerator.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.SequenceGenerator; -import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator; - -/** - * orm.xml sequence generator - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmSequenceGenerator - extends SequenceGenerator, OrmGenerator -{ - XmlSequenceGenerator getXmlGenerator(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSingleRelationshipMapping.java deleted file mode 100644 index bfe8774ab9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmSingleRelationshipMapping.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.SingleRelationshipMapping; -import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping; - -/** - * orm.xml single (1:1, m:1) mapping. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface OrmSingleRelationshipMapping - extends SingleRelationshipMapping, OrmRelationshipMapping -{ - AbstractXmlSingleRelationshipMapping getXmlAttributeMapping(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmStructureNodes.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmStructureNodes.java deleted file mode 100644 index 64bd9c75bc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmStructureNodes.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; - -/** - * - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public interface OrmStructureNodes -{ - - String ENTITY_MAPPINGS_ID = JptJpaCorePlugin.PLUGIN_ID + ".orm.entityMappings"; //$NON-NLS-1$ - - String PERSISTENT_TYPE_ID = JptJpaCorePlugin.PLUGIN_ID + ".orm.persistentType"; //$NON-NLS-1$ - - String PERSISTENT_ATTRIBUTE_ID = JptJpaCorePlugin.PLUGIN_ID + ".orm.persistentAttribute"; //$NON-NLS-1$ - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTable.java deleted file mode 100644 index 0969a76ed5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTable.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import java.util.ListIterator; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; - -/** - * orm.xml table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface OrmTable - extends Table, XmlContextNode -{ - TextRange getNameTextRange(); - TextRange getSchemaTextRange(); - TextRange getCatalogTextRange(); - - ListIterator uniqueConstraints(); - OrmUniqueConstraint getUniqueConstraint(int index); - OrmUniqueConstraint addUniqueConstraint(); - OrmUniqueConstraint addUniqueConstraint(int index); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTableGenerator.java deleted file mode 100644 index bb6d5bc2e2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTableGenerator.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.TableGenerator; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator; - -/** - * orm.xml table generator - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface OrmTableGenerator - extends TableGenerator, OrmGenerator -{ - XmlTableGenerator getXmlGenerator(); - - - // ********** unique constraints ********** - - @SuppressWarnings("unchecked") - Iterable getUniqueConstraints(); - - OrmUniqueConstraint addUniqueConstraint(); - - OrmUniqueConstraint addUniqueConstraint(int index); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTemporalConverter.java deleted file mode 100644 index e474b841a2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTemporalConverter.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.TemporalConverter; -import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping; - -/** - * orm.xml temporal converter - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmTemporalConverter - extends TemporalConverter, OrmConverter -{ - // ********** adapter ********** - - public static class Adapter - implements OrmConverter.Adapter - { - private static final Adapter INSTANCE = new Adapter(); - public static Adapter instance() { - return INSTANCE; - } - - private Adapter() { - super(); - } - - public Class getConverterType() { - return TemporalConverter.class; - } - - public OrmConverter buildConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { - XmlConvertibleMapping xmlMapping = (XmlConvertibleMapping) parent.getXmlAttributeMapping(); - return (xmlMapping.getTemporal() == null) ? null : factory.buildOrmTemporalConverter(parent); - } - - public boolean isActive(XmlConvertibleMapping xmlMapping) { - return xmlMapping.getTemporal() != null; - } - - public OrmConverter buildNewConverter(OrmAttributeMapping parent, OrmXmlContextNodeFactory factory) { - return factory.buildOrmTemporalConverter(parent); - } - - public void clearXmlValue(XmlConvertibleMapping xmlMapping) { - xmlMapping.setTemporal(null); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTransientMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTransientMapping.java deleted file mode 100644 index 4ee1e4b385..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTransientMapping.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.TransientMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTransient; - -/** - * orm.xml transient "mapping" - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface OrmTransientMapping - extends TransientMapping, OrmAttributeMapping -{ - XmlTransient getXmlAttributeMapping(); -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMapping.java deleted file mode 100644 index ea81dae761..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMapping.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * orm.xml type mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public interface OrmTypeMapping - extends TypeMapping, XmlContextNode -{ - // ********** class ********** - - /** - * NB: This may be a partial name to be prefixed by the - * entity mappings's package value. - * - * @see EntityMappings#getPackage() - */ - String getClass_(); - - /** - * @see #getClass_() - */ - void setClass(String class_); - String CLASS_PROPERTY = "class"; //$NON-NLS-1$ - - - // ********** metadata complete ********** - - boolean isMetadataComplete(); - Boolean getSpecifiedMetadataComplete(); - void setSpecifiedMetadataComplete(Boolean metadataComplete); - String SPECIFIED_METADATA_COMPLETE_PROPERTY = "specifiedMetadataComplete"; //$NON-NLS-1$ - - /** - * Override metadata complete is true if the type mapping's persistence - * unit is marked "XML mapping metadata complete". - */ - boolean isOverrideMetadataComplete(); - String OVERRIDE_METADATA_COMPLETE_PROPERTY = "overrideMetadataComplete"; //$NON-NLS-1$ - - - // ********** XML ********** - - /** - * Type mappings are a sequence in the orm schema. We must keep - * the list of type mappings in the appropriate order so the wtp xml - * translators will write them to the xml in that order and they - * will adhere to the schema. - *

- * Each concrete implementation must implement this - * method and return an int that matches its order in the schema. - */ - int getXmlSequence(); - - /** - * Add the type mapping's XML type mapping to the appropriate list - * in the specified XML entity mappings. - */ - void addXmlTypeMappingTo(XmlEntityMappings entityMappings); - - /** - * Remove the type mapping's XML type mapping from the appropriate list - * in the specified XML entity mappings. - */ - void removeXmlTypeMappingFrom(XmlEntityMappings entityMappings); - - XmlTypeMapping getXmlTypeMapping(); - - TextRange getSelectionTextRange(); - - TextRange getClassTextRange(); - - TextRange getAttributesTextRange(); - - boolean containsOffset(int textOffset); - - - // ********** Java type mapping ********** - - /** - * Return the Java type mapping corresponding to the orm.xml - * type mapping. Return null if there is no such Java type - * mapping; i.e. it does not exist or it is not the same type of type - * mapping (entity, mapped superclass, embeddable). - * - * @see #getJavaTypeMappingForDefaults() - */ - JavaTypeMapping getJavaTypeMapping(); - - /** - * Check "metadata complete" before returning the Java type mapping. - * For orm.xml defaults, if "metadata complete" is - * true, return null. - * - * @see #getJavaTypeMapping() - */ - JavaTypeMapping getJavaTypeMappingForDefaults(); - - - // ********** refactoring ********** - - /** - * Create a text DeleteEdit for deleting the type mapping element and any text that precedes it - */ - DeleteEdit createDeleteEdit(); - - /** - * Create ReplaceEdits for renaming any references to the originalType to the newName. - * The originalType has not yet been renamed, the newName is the new short name. - */ - Iterable createRenameTypeEdits(IType originalType, String newName); - - /** - * Create ReplaceEdits for moving any references to the originalType to the newPackage. - * The originalType has not yet been moved. - */ - Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage); - - /** - * Create ReplaceEdits for renaming any references to the originalPackage to the newName. - * The originalPackage has not yet been renamed. - */ - Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName); - - - // ********** misc ********** - - OrmPersistentType getPersistentType(); - - void initializeFrom(OrmTypeMapping oldMapping); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMappingDefinition.java deleted file mode 100644 index fef4b7d092..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmTypeMappingDefinition.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping; - -/** - * Part of mechanism to extend the types of orm.xml type mappings. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface OrmTypeMappingDefinition -{ - /** - * Return the definition's mapping key. - * @see MappingKeys - */ - String getKey(); - - /** - * Build a resource mapping using the specifed factory. - */ - XmlTypeMapping buildResourceMapping(EFactory factory); - - /** - * Build a context mapping for the specified parent and resource mapping, - * using the specified factory. - */ - OrmTypeMapping buildContextMapping( - OrmPersistentType parent, - XmlTypeMapping resourceMapping, - OrmXmlContextNodeFactory factory); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmUniqueConstraint.java deleted file mode 100644 index f320080aa6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmUniqueConstraint.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.UniqueConstraint; -import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint; - -/** - * orm.xml unique constraint - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface OrmUniqueConstraint - extends UniqueConstraint, OrmReadOnlyUniqueConstraint -{ - XmlUniqueConstraint getXmlUniqueConstraint(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVersionMapping.java deleted file mode 100644 index 4f29cf3fd2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVersionMapping.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.VersionMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion; - -/** - * orm.xml version mapping - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface OrmVersionMapping - extends VersionMapping, OrmColumnMapping, OrmConvertibleMapping -{ - XmlVersion getXmlAttributeMapping(); -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualAssociationOverride.java deleted file mode 100644 index a16dbcad5e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualAssociationOverride.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.VirtualAssociationOverride; - -/** - * orm.xml virtual association override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmVirtualAssociationOverride - extends VirtualAssociationOverride, - OrmVirtualOverride, - OrmReadOnlyAssociationOverride -{ - OrmVirtualOverrideRelationship getRelationship(); - - OrmAssociationOverride convertToSpecified(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualAttributeOverride.java deleted file mode 100644 index 6c957c2b80..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualAttributeOverride.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.VirtualAttributeOverride; - -/** - * Java virtual attribute override - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmVirtualAttributeOverride - extends VirtualAttributeOverride, - OrmVirtualOverride, - OrmReadOnlyAttributeOverride -{ - OrmAttributeOverride convertToSpecified(); - - OrmVirtualColumn getColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualColumn.java deleted file mode 100644 index ce33b3a81d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualColumn.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.VirtualColumn; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; - -/** - * orm.xml virtual column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmVirtualColumn - extends VirtualColumn, XmlContextNode -{ - /** - * The overridden column can be either a Java join column or an - * orm.xml join column; so we don't change the return type - * here. - */ - Column getOverriddenColumn(); - - - // ********** owner ********** - - interface Owner - extends VirtualColumn.Owner - { - /** - * The overridden column can be either a Java column or an - * orm.xml column; so we don't change the return type here. - */ - Column resolveOverriddenColumn(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumn.java deleted file mode 100644 index 9a17a4a6d7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumn.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.VirtualJoinColumn; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; - -/** - * orm.xml virtual join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmVirtualJoinColumn - extends VirtualJoinColumn, XmlContextNode -{ - /** - * The overridden join column can be either a Java join column or an - * orm.xml join column; so we don't change the return type - * here. - */ - JoinColumn getOverriddenColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationship.java deleted file mode 100644 index d2d4154496..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationship.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.VirtualJoinColumnRelationship; - -/** - * orm.xml virtual join column relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmVirtualJoinColumnRelationship - extends VirtualJoinColumnRelationship, - OrmVirtualRelationship -{ - OrmVirtualJoinColumnRelationshipStrategy getJoinColumnStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationshipStrategy.java deleted file mode 100644 index 248fbb8293..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.VirtualJoinColumnRelationshipStrategy; - -/** - * orm.xml virtual join column relationship strategy. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmVirtualJoinColumnRelationshipStrategy - extends VirtualJoinColumnRelationshipStrategy, OrmVirtualRelationshipStrategy -{ - ListIterator joinColumns(); - ListIterator specifiedJoinColumns(); - OrmVirtualJoinColumn getSpecifiedJoinColumn(int index); - OrmVirtualJoinColumn getDefaultJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTable.java deleted file mode 100644 index 55892a2148..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTable.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.VirtualJoinTable; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; - -/** - * orm.xml virtual join table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmVirtualJoinTable - extends VirtualJoinTable, XmlContextNode -{ - OrmVirtualJoinTableRelationshipStrategy getParent(); - - ListIterator uniqueConstraints(); - OrmVirtualUniqueConstraint getUniqueConstraint(int index); - - ListIterator joinColumns(); - ListIterator specifiedJoinColumns(); - OrmVirtualJoinColumn getSpecifiedJoinColumn(int index); - OrmVirtualJoinColumn getDefaultJoinColumn(); - - ListIterator inverseJoinColumns(); - ListIterator specifiedInverseJoinColumns(); - OrmVirtualJoinColumn getSpecifiedInverseJoinColumn(int index); - OrmVirtualJoinColumn getDefaultInverseJoinColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTableRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTableRelationship.java deleted file mode 100644 index b5b58c4bfc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTableRelationship.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.VirtualJoinTableRelationship; - -/** - * orm.xml virtual join table relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmVirtualJoinTableRelationship - extends VirtualJoinTableRelationship, - OrmVirtualRelationship -{ - OrmVirtualJoinTableRelationshipStrategy getJoinTableStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTableRelationshipStrategy.java deleted file mode 100644 index 2072e72dd5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualJoinTableRelationshipStrategy.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.VirtualJoinTableRelationshipStrategy; - -/** - * orm.xml virtual join table relationship strategy. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmVirtualJoinTableRelationshipStrategy - extends VirtualJoinTableRelationshipStrategy, OrmVirtualRelationshipStrategy -{ - OrmVirtualJoinTable getJoinTable(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualOverride.java deleted file mode 100644 index 031174b0c3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualOverride.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.VirtualOverride; - -/** - * orm.xml virtual

    - *
  • attribute override - *
  • association override - *
- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmVirtualOverride - extends VirtualOverride, OrmReadOnlyOverride -{ - OrmOverride convertToSpecified(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualOverrideRelationship.java deleted file mode 100644 index 4da970ad2b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualOverrideRelationship.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.VirtualOverrideRelationship; - -/** - * orm.xml virtual association override relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmVirtualOverrideRelationship - extends VirtualOverrideRelationship, - OrmVirtualJoinColumnRelationship -{ - OrmVirtualAssociationOverride getAssociationOverride(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualPrimaryKeyJoinColumn.java deleted file mode 100644 index 8823e4fc10..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualPrimaryKeyJoinColumn.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.VirtualPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn; - -/** - * orm.xml virtual primary key join column - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmVirtualPrimaryKeyJoinColumn - extends VirtualPrimaryKeyJoinColumn, XmlContextNode -{ - JavaPrimaryKeyJoinColumn getOverriddenColumn(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualRelationship.java deleted file mode 100644 index 7738e2e999..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualRelationship.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.VirtualRelationship; - -/** - * orm.xml virtual relationship - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmVirtualRelationship - extends VirtualRelationship, OrmReadOnlyRelationship -{ - OrmVirtualRelationshipStrategy getStrategy(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualRelationshipStrategy.java deleted file mode 100644 index 08c209b2c3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualRelationshipStrategy.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.VirtualRelationshipStrategy; - -/** - * orm.xml virtual strategy - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmVirtualRelationshipStrategy - extends VirtualRelationshipStrategy, OrmReadOnlyRelationshipStrategy -{ - OrmVirtualRelationship getRelationship(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualSecondaryTable.java deleted file mode 100644 index 46cc96082c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualSecondaryTable.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import java.util.ListIterator; -import org.eclipse.jpt.jpa.core.context.VirtualSecondaryTable; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable; - -/** - * orm.xml virtual secondary table - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmVirtualSecondaryTable - extends VirtualSecondaryTable, XmlContextNode -{ - ListIterator primaryKeyJoinColumns(); - ListIterator specifiedPrimaryKeyJoinColumns(); - OrmVirtualPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn(); - - JavaSecondaryTable getOverriddenTable(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualUniqueConstraint.java deleted file mode 100644 index 7e9e7a911a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmVirtualUniqueConstraint.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.UniqueConstraint; -import org.eclipse.jpt.jpa.core.context.VirtualUniqueConstraint; - -/** - * orm.xml virtual database unique constraint - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - */ -public interface OrmVirtualUniqueConstraint - extends VirtualUniqueConstraint, OrmReadOnlyUniqueConstraint -{ - /** - * The overridden unique constraint can be either a Java unique constraint - * or an orm.xml unique constraint; so we don't change the - * return type here. - */ - UniqueConstraint getOverriddenUniqueConstraint(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXml.java deleted file mode 100644 index 0b4a509790..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXml.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.MappingFile; - -/** - * JPA orm.xml file. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public interface OrmXml - extends MappingFile -{ - // ********** root ********** - - /** - * String constant associated with changes to the - * entity-mappings property - */ - String ROOT_PROPERTY = "root"; //$NON-NLS-1$ - - /** - * Covariant override. - */ - EntityMappings getRoot(); - - OrmPersistentType getPersistentType(String name); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java deleted file mode 100644 index b8f98cb0c4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlContextNodeFactory.java +++ /dev/null @@ -1,183 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.UniqueConstraint; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride; -import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue; -import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer; -import org.eclipse.jpt.jpa.core.resource.orm.XmlId; -import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable; -import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany; -import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne; -import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne; -import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer; -import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint; -import org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable; -import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTransient; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint; -import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion; - -/** - * orm.xml context node factory - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface OrmXmlContextNodeFactory -{ - // ********** ORM Context Model ********** - - EntityMappings buildEntityMappings(OrmXml parent, XmlEntityMappings entityMappings); - - OrmPersistenceUnitMetadata buildOrmPersistenceUnitMetadata(EntityMappings parent); - - OrmPersistenceUnitDefaults buildOrmPersistenceUnitDefaults(OrmPersistenceUnitMetadata parent); - - OrmPersistentType buildOrmPersistentType(EntityMappings parent, XmlTypeMapping resourceMapping); - - OrmEntity buildOrmEntity(OrmPersistentType parent, XmlEntity resourceMapping); - - OrmMappedSuperclass buildOrmMappedSuperclass(OrmPersistentType parent, XmlMappedSuperclass resourceMapping); - - OrmEmbeddable buildOrmEmbeddable(OrmPersistentType parent, XmlEmbeddable resourceMapping); - - OrmPersistentAttribute buildOrmPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlMapping); - - OrmReadOnlyPersistentAttribute buildVirtualOrmPersistentAttribute(OrmPersistentType parent, JavaResourcePersistentAttribute javaResourcePersistentAttribute); - - OrmTable buildOrmTable(OrmEntity parent, Table.Owner owner); - - OrmSecondaryTable buildOrmSecondaryTable(OrmEntity parent, Table.Owner owner, XmlSecondaryTable xmlSecondaryTable); - - OrmVirtualSecondaryTable buildOrmVirtualSecondaryTable(OrmEntity parent, JavaSecondaryTable javaSecondaryTable); - - OrmPrimaryKeyJoinColumn buildOrmPrimaryKeyJoinColumn(XmlContextNode parent, OrmBaseJoinColumn.Owner owner, XmlPrimaryKeyJoinColumn resourcePrimaryKeyJoinColumn); - - OrmVirtualPrimaryKeyJoinColumn buildOrmVirtualPrimaryKeyJoinColumn(XmlContextNode parent, ReadOnlyBaseJoinColumn.Owner owner, JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn); - - OrmJoinTable buildOrmJoinTable(OrmJoinTableRelationshipStrategy parent, Table.Owner owner); - - OrmVirtualJoinTable buildOrmVirtualJoinTable(OrmVirtualJoinTableRelationshipStrategy parent, JoinTable overriddenTable); - - OrmJoinColumn buildOrmJoinColumn(XmlContextNode parent, OrmJoinColumn.Owner owner, XmlJoinColumn resourceJoinColumn); - - OrmVirtualJoinColumn buildOrmVirtualJoinColumn(XmlContextNode parent, ReadOnlyJoinColumn.Owner owner, JoinColumn joinColumn); - - OrmAttributeOverrideContainer buildOrmAttributeOverrideContainer(XmlContextNode parent, OrmAttributeOverrideContainer.Owner owner); - - OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(XmlContextNode parent, OrmAssociationOverrideContainer.Owner owner); - - OrmAttributeOverride buildOrmAttributeOverride(OrmAttributeOverrideContainer parent, XmlAttributeOverride xmlOverride); - - OrmVirtualAttributeOverride buildOrmVirtualAttributeOverride(OrmAttributeOverrideContainer parent, String name); - - OrmAssociationOverride buildOrmAssociationOverride(OrmAssociationOverrideContainer parent, XmlAssociationOverride xmlOverride); - - OrmVirtualAssociationOverride buildOrmVirtualAssociationOverride(OrmAssociationOverrideContainer parent, String name); - - OrmOverrideRelationship buildOrmOverrideRelationship(OrmAssociationOverride parent); - - OrmVirtualOverrideRelationship buildOrmVirtualOverrideRelationship(OrmVirtualAssociationOverride parent); - - OrmDiscriminatorColumn buildOrmDiscriminatorColumn(OrmEntity parent, OrmDiscriminatorColumn.Owner owner); - - OrmColumn buildOrmColumn(XmlContextNode parent, OrmColumn.Owner owner); - - OrmVirtualColumn buildOrmVirtualColumn(XmlContextNode parent, OrmVirtualColumn.Owner owner); - - OrmGeneratedValue buildOrmGeneratedValue(XmlContextNode parent, XmlGeneratedValue resourceGeneratedValue); - - OrmGeneratorContainer buildOrmGeneratorContainer(XmlContextNode parent, XmlGeneratorContainer resourceGeneratorContainer); - - OrmSequenceGenerator buildOrmSequenceGenerator(XmlContextNode parent, XmlSequenceGenerator resourceSequenceGenerator); - - OrmTableGenerator buildOrmTableGenerator(XmlContextNode parent, XmlTableGenerator resourceTableGenerator); - - OrmQueryContainer buildOrmQueryContainer(XmlContextNode parent, XmlQueryContainer resourceQueryContainer); - - OrmNamedNativeQuery buildOrmNamedNativeQuery(XmlContextNode parent, XmlNamedNativeQuery resourceNamedQuery); - - OrmNamedQuery buildOrmNamedQuery(XmlContextNode parent, XmlNamedQuery resourceNamedQuery); - - OrmQueryHint buildOrmQueryHint(OrmQuery parent, XmlQueryHint resourceQueryhint); - - OrmBasicMapping buildOrmBasicMapping(OrmPersistentAttribute parent, XmlBasic resourceMapping); - - OrmManyToManyMapping buildOrmManyToManyMapping(OrmPersistentAttribute parent, XmlManyToMany resourceMapping); - - OrmOneToManyMapping buildOrmOneToManyMapping(OrmPersistentAttribute parent, XmlOneToMany resourceMapping); - - OrmManyToOneMapping buildOrmManyToOneMapping(OrmPersistentAttribute parent, XmlManyToOne resourceMapping); - - OrmOneToOneMapping buildOrmOneToOneMapping(OrmPersistentAttribute parent, XmlOneToOne resourceMapping); - - OrmEmbeddedIdMapping buildOrmEmbeddedIdMapping(OrmPersistentAttribute parent, XmlEmbeddedId resourceMapping); - - OrmEmbeddedMapping buildOrmEmbeddedMapping(OrmPersistentAttribute parent, XmlEmbedded resourceMapping); - - OrmIdMapping buildOrmIdMapping(OrmPersistentAttribute parent, XmlId resourceMapping); - - OrmTransientMapping buildOrmTransientMapping(OrmPersistentAttribute parent, XmlTransient resourceMapping); - - OrmVersionMapping buildOrmVersionMapping(OrmPersistentAttribute parent, XmlVersion resourceMapping); - - OrmAttributeMapping buildOrmNullAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping resourceMapping); - - OrmAttributeMapping buildUnsupportedOrmAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping resourceMapping); - - OrmUniqueConstraint buildOrmUniqueConstraint(XmlContextNode parent, UniqueConstraint.Owner owner, XmlUniqueConstraint resourceUniqueConstraint); - - OrmVirtualUniqueConstraint buildOrmVirtualUniqueConstraint(XmlContextNode parent, UniqueConstraint overriddenUniqueConstraint); - - OrmConverter buildOrmEnumeratedConverter(OrmAttributeMapping parent); - - OrmConverter buildOrmTemporalConverter(OrmAttributeMapping parent); - - OrmConverter buildOrmLobConverter(OrmAttributeMapping parent); - - /** - * JPA 1.0 only - */ - OrmOrderable buildOrmOrderable(OrmAttributeMapping parent); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlDefinition.java deleted file mode 100644 index 7ed177a093..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/OrmXmlDefinition.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.emf.ecore.EFactory; - -/** - * orm.xml definition - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface OrmXmlDefinition - extends MappingFileDefinition -{ - /** - * Return the factory for building XML resource nodes. - */ - EFactory getResourceNodeFactory(); - - /** - * Return the factory for building XML context nodes. - */ - OrmXmlContextNodeFactory getContextNodeFactory(); - - - // ********** type/attribute mappings ********** - - /** - * Return a type mapping definiton for the specified mapping key. - * @throws IllegalArgumentException if the mapping key is not - * supported - */ - OrmTypeMappingDefinition getTypeMappingDefinition(String mappingKey); - - /** - * Return an attribute mapping definiton for the specified mapping key. - * Never return null. - */ - OrmAttributeMappingDefinition getAttributeMappingDefinition(String mappingKey); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/UnsupportedOrmAttributeMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/UnsupportedOrmAttributeMappingDefinition.java deleted file mode 100644 index 1275887f77..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/orm/UnsupportedOrmAttributeMappingDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping; - -/** - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public class UnsupportedOrmAttributeMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmAttributeMappingDefinition INSTANCE = - new UnsupportedOrmAttributeMappingDefinition(); - - - /** - * Return the singleton. - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private UnsupportedOrmAttributeMappingDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - throw new UnsupportedOperationException(); - } - - public OrmAttributeMapping buildContextMapping(OrmPersistentAttribute parent, XmlAttributeMapping resourceMapping, OrmXmlContextNodeFactory factory) { - return factory.buildUnsupportedOrmAttributeMapping(parent, (XmlNullAttributeMapping) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java deleted file mode 100644 index 5902e9dd5f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/ClassRef.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.persistence; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * Context model corresponding to the XML resource model - * {@link XmlJavaClassRef}, which corresponds to the class element - * in the persistence.xml file. - * This is also used for "implied" class refs; i.e. class refs that are not - * explicitly listed in the persistence.xml file. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public interface ClassRef - extends XmlContextNode, JpaStructureNode, PersistentType.Owner -{ - /** - * Return whether the class ref is a reference to the specified type. - */ - boolean isFor(String typeName); - - /** - * Return true if the mapping file ref is virtual; - * return false if the mapping file ref is represented by an - * entry in the persistence.xml file. - */ - boolean isVirtual(); - - /** - * Return the class ref's corresponding resource class ref. - * This is null for implied class refs. - */ - XmlJavaClassRef getXmlClassRef(); - - /** - * Return whether the text representation of this persistence unit contains - * the given text offset - */ - boolean containsOffset(int textOffset); - - - // ********** class name ********** - - /** - * String constant associated with changes to the class name - */ - final static String CLASS_NAME_PROPERTY = "className"; //$NON-NLS-1$ - - /** - * Return the class name of the class ref. - */ - String getClassName(); - - /** - * Set the class name of the class ref. - */ - void setClassName(String className); - - - // ********** java persistent type ********** - - /** - * String constant associated with changes to the java persistent type - */ - final static String JAVA_PERSISTENT_TYPE_PROPERTY = "javaPersistentType"; //$NON-NLS-1$ - - /** - * Return the JavaPersistentType that corresponds to this IClassRef. - * This can be null. - * This is not settable by users of this API. - */ - JavaPersistentType getJavaPersistentType(); - - - // ********** refactoring ********** - - /** - * If this {@link #isFor(String)} the given IType, create a text - * DeleteEdit for deleting the class element and any text that precedes it. - * Otherwise return an EmptyIterable. - * Though this will contain 1 or 0 DeleteEdits, using an Iterable - * for ease of use with other createDeleteEdit API. - */ - Iterable createDeleteTypeEdits(IType type); - - /** - * Create ReplaceEdits for renaming the class element to the newName. - * The originalType has not yet been renamed, the newName is the new short name. - * If this ClassRef does not match the original type, then return an empty Iterable. - */ - Iterable createRenameTypeEdits(IType originalType, String newName); - - /** - * Create ReplaceEdits for moving any references to the originalType to the newPackage. - * The originalType has not yet been moved. - */ - Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage); - - /** - * Create ReplaceEdits for renaming the class's package to the newName. - * The originalPackage has not yet been renamed. - * If this class is not a part of the original package, then return an empty Iterable. - */ - Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java deleted file mode 100644 index 942142ca0f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/JarFileRef.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.persistence; - -import org.eclipse.core.resources.IFolder; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.java.JarFile; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * Context model corresponding to the - * XML resource model {@link XmlJarFileRef}, - * which corresponds to the jar-file - * element in the persistence.xml file. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.2 - */ -public interface JarFileRef - extends XmlContextNode, JpaStructureNode, PersistentTypeContainer -{ - // ********** file name ********** - - /** - * String constant associated with changes to the file name. - */ - String FILE_NAME_PROPERTY = "fileName"; //$NON-NLS-1$ - - /** - * Return the file name of the jar file ref. - */ - String getFileName(); - - /** - * Set the file name of the jar file ref. - */ - void setFileName(String fileName); - - - // ********** JAR file ********** - - /** - * String constant associated with changes to the JAR file. - */ - String JAR_FILE_PROPERTY = "jarFile"; //$NON-NLS-1$ - - /** - * Return the JAR file ref's JAR file corresponding to the file name. - */ - JarFile getJarFile(); - - - // ********** refactoring ********** - - /** - * Create ReplaceEdits for renaming any references to the originalFolder to the newName. - * The originalFolder has not yet been renamed. - */ - Iterable createReplaceFolderEdits(IFolder originalFolder, String newName); - - - // ********** queries ********** - - XmlJarFileRef getXmlJarFileRef(); - - /** - * Return the persistent type, as listed in the JAR file, - * with the specified name. Return null if it does not exists. - */ - PersistentType getPersistentType(String typeName); - - /** - * Return whether the text representation of the JAR file ref contains - * the specified text offset. - */ - boolean containsOffset(int textOffset); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java deleted file mode 100644 index 03acbdcbb1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/MappingFileRef.java +++ /dev/null @@ -1,190 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.persistence; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.context.MappingFile; -import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitMetadata; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * Context model corresponding to the - * XML resource model {@link XmlMappingFileRef}, - * which corresponds to the mapping-file element - * in the persistence.xml file. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public interface MappingFileRef - extends XmlContextNode, JpaStructureNode, PersistentTypeContainer -{ - /** - * Covariant override. - */ - PersistenceUnit getParent(); - - - // ********** file name ********** - - /** - * String constant associated with changes to the file name. - */ - String FILE_NAME_PROPERTY = "fileName"; //$NON-NLS-1$ - - /** - * Return the file name of the mapping file ref. - */ - String getFileName(); - - /** - * Set the file name of the mapping file ref. - */ - void setFileName(String fileName); - - /** - * Return whether the mapping file ref is a reference to the specified file. - */ - boolean isFor(IFile file); - - - // ********** mapping file (orm.xml) ********** - - /** - * String constant associated with changes to the mapping file. - */ - String MAPPING_FILE_PROPERTY = "mappingFile"; //$NON-NLS-1$ - - /** - * Return mapping file corresponding to the mapping file ref's file name. - */ - MappingFile getMappingFile(); - - - // ********** persistence unit metadata ********** - - /** - * Return the mapping file's persistence unit metadata. - */ - MappingFilePersistenceUnitMetadata getPersistenceUnitMetadata(); - - /** - * Return whether the mapping file's persistence unit metadata exist. - */ - boolean persistenceUnitMetadataExists(); - - - // ********** misc ********** - - /** - * Return the mapping file ref's corresponding resource mapping file ref. - */ - XmlMappingFileRef getXmlMappingFileRef(); - - /** - * Return whether the mapping file ref is "implied" by, or explicitly - * specified in, the persistence.xml. - */ - boolean isImplied(); - - /** - * Return the persistent type, as listed in the mapping file, - * with the specified name. Return null if it does not exists. - */ - PersistentType getPersistentType(String typeName); - - /** - * Return whether the specified text offset is within - * the text representation of the mapping file. - */ - boolean containsOffset(int textOffset); - - - // ********** refactoring ********** - - /** - * Create DeleteEdits for deleting any references to the given type - * that is about to be deleted. - * Return an EmptyIterable if there are not any references to the given type. - */ - Iterable createDeleteTypeEdits(IType type); - - /** - * If this {@link #isFor(IFile)} the given IFile, create a text - * DeleteEdit for deleting the mapping file element and any text that precedes it - * from the persistence.xml. - * Otherwise return an EmptyIterable. - * Though this will contain 1 or 0 DeleteEdits, using an Iterable - * for ease of use with other createDeleteEdit API. - */ - Iterable createDeleteMappingFileEdits(IFile file); - - /** - * Create ReplaceEdits for renaming any references to the originalType to the newName. - * The originalType has not yet been renamed, the newName is the new short name. - */ - Iterable createRenameTypeEdits(IType originalType, String newName); - - /** - * Create ReplaceEdits for moving any references to the originalType to the newPackage. - * The originalType has not yet been moved. - */ - Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage); - - /** - * Create ReplaceEdits for renaming any references to the originalPackage to the newName. - * The originalPackage has not yet been renamed. - */ - Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName); - - /** - * Create ReplaceEdits for renaming any references to the originalFolder to the newName. - * The originalFolder has not yet been renamed. - */ - Iterable createRenameFolderEdits(IFolder originalFolder, String newName); - - /** - * If this {@link #isFor(IFile)} the given IFile, create a text - * ReplaceEdit for renaming the mapping file element to the new name. - * Otherwise return an EmptyIterable. - * Though this will contain 1 or 0 ReplaceEdits, using an Iterable - * for ease of use with other createReplaceMappingFileEdits API. - */ - Iterable createRenameMappingFileEdits(IFile originalFile, String newName); - - /** - * If this {@link #isFor(IFile)} the given IFile create a text - * ReplaceEdit for moving the originalFile to the destination. - * Otherwise return an EmptyIterable. - * The originalFile has not been moved yet. - */ - Iterable createMoveMappingFileEdits(IFile originalFile, IPath runtineDestination); - - /** - * Create ReplaceEdits for moving any references to the originalFolder to the runtimeDestination. - * The runtimeDestination already includes the original folder name. - */ - Iterable createMoveFolderEdits(IFolder originalFolder, IPath runtimeDestination); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java deleted file mode 100644 index 8574352ec5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/Persistence.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.persistence; - -import java.util.ListIterator; - -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence; - -/** - * Context model corresponding to the XML resource model {@link XmlPersistence}, - * which corresponds to the persistence element in the - * persistence.xml file. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.1 - * @since 2.0 - */ -public interface Persistence - extends XmlContextNode, JpaStructureNode -{ - /** - * Return the resource model object associated with this context model object - */ - XmlPersistence getXmlPersistence(); - - /** - * Covariant override. - */ - PersistenceXml getParent(); - - - // **************** persistence units ************************************** - - /** - * String constant associated with changes to the persistence units list - */ - String PERSISTENCE_UNITS_LIST = "persistenceUnits"; //$NON-NLS-1$ - - /** - * Return the persistence element's persistence units. - */ - ListIterator persistenceUnits(); - - /** - * Return the number of persistence units. - */ - int persistenceUnitsSize(); - - /** - * Add a persistence unit and return it. - */ - PersistenceUnit addPersistenceUnit(); - - /** - * Add a persistence unit at the specified index and return it. - */ - PersistenceUnit addPersistenceUnit(int index); - - /** - * Remove the specified persistence unit from the persistence node. - */ - void removePersistenceUnit(PersistenceUnit persistenceUnit); - - /** - * Remove the persistence unit at the specified index from the persistence node. - */ - void removePersistenceUnit(int index); - - - // **************** text range ********************************************* - - /** - * Return whether the text representation of this persistence contains - * the specified text offset. - */ - boolean containsOffset(int textOffset); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceStructureNodes.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceStructureNodes.java deleted file mode 100644 index 2e34050432..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceStructureNodes.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.persistence; - -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; - -/** - * - * - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.2 - * @since 2.0 - */ -public interface PersistenceStructureNodes -{ - String PREFIX = JptJpaCorePlugin.PLUGIN_ID_ + "persistence"; //$NON-NLS-1$ - String PREFIX_ = PREFIX + '.'; - - String PERSISTENCE_ID = PREFIX_ + "persistence"; //$NON-NLS-1$ - String PERSISTENCE_UNIT_ID = PREFIX_ + "persistenceUnit"; //$NON-NLS-1$ - String CLASS_REF_ID = PREFIX_ + "classRef"; //$NON-NLS-1$ - String MAPPING_FILE_REF_ID = PREFIX_ + "mappingFileRef"; //$NON-NLS-1$ - String JAR_FILE_REF_ID = PREFIX_ + "jarFileRef"; //$NON-NLS-1$ - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java deleted file mode 100644 index 90b30cbb46..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnit.java +++ /dev/null @@ -1,839 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.persistence; - -import java.util.Iterator; -import java.util.ListIterator; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.Embeddable; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.Generator; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.Query; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * Context model corresponding to the XML resource model {@link XmlPersistenceUnit}, - * which corresponds to the persistence-unit element in the - * persistence.xml file. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.0 - */ -public interface PersistenceUnit - extends XmlContextNode, JpaStructureNode, PersistentTypeContainer -{ - /** - * Covariant override. - */ - Persistence getParent(); - - - // ********** name ********** - - /** - * String constant associated with changes to the persistence unit's name. - */ - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - - /** - * Return the persistence unit's name. - */ - String getName(); - - /** - * Set the persistence unit's name. - */ - void setName(String name); - - - // ********** transaction type ********** - - /** - * Return the persistence unit's transaction type, - * whether specified or defaulted. - */ - PersistenceUnitTransactionType getTransactionType(); - - /** - * String constant associated with changes to the persistence unit's - * specified transaction type - */ - String SPECIFIED_TRANSACTION_TYPE_PROPERTY = "specifiedTransactionType"; //$NON-NLS-1$ - - /** - * Return the persistence unit's specified transaction type. - */ - PersistenceUnitTransactionType getSpecifiedTransactionType(); - - /** - * Set the persistence unit's specified transaction type. - */ - void setSpecifiedTransactionType(PersistenceUnitTransactionType transactionType); - - /** - * String constant associated with changes to the persistence unit's - * default transaction type (not typically changed). - */ - String DEFAULT_TRANSACTION_TYPE_PROPERTY = "defaultTransactionType"; //$NON-NLS-1$ - - /** - * Return the persistence unit's default transaction type. - */ - PersistenceUnitTransactionType getDefaultTransactionType(); - - - // ********** description ********** - - /** - * String constant associated with changes to the persistence unit's description. - */ - String DESCRIPTION_PROPERTY = "description"; //$NON-NLS-1$ - - /** - * Return the persistence unit's description. - */ - String getDescription(); - - /** - * Set the persistence unit's description. - */ - void setDescription(String description); - - - // ********** provider ********** - - /** - * String constant associated with changes to the persistence unit's provider. - */ - String PROVIDER_PROPERTY = "provider"; //$NON-NLS-1$ - - /** - * Return the persistence unit's provider. - */ - String getProvider(); - - /** - * Set the persistence unit's provider. - */ - void setProvider(String provider); - - - // ********** JTA data source ********** - - /** - * String constant associated with changes to the persistence unit's JTA data source - */ - String JTA_DATA_SOURCE_PROPERTY = "jtaDataSource"; //$NON-NLS-1$ - - /** - * Return the persistence unit's JTA data source. - */ - String getJtaDataSource(); - - /** - * Set the persistence unit's JTA data source. - */ - void setJtaDataSource(String jtaDataSource); - - - // ********** non-JTA data source ********** - - /** - * String constant associated with changes to the persistence unit's non-JTA data source - */ - String NON_JTA_DATA_SOURCE_PROPERTY = "nonJtaDataSource"; //$NON-NLS-1$ - - /** - * Return the persistence unit's non-JTA data source. - */ - String getNonJtaDataSource(); - - /** - * Set the persistence unit's non-JTA data source. - */ - void setNonJtaDataSource(String nonJtaDataSource); - - - // ********** mapping file refs ********** - - /** - * Return the persistence unit's list of mapping file refs, - * both specified and implied. - */ - ListIterator mappingFileRefs(); - - /** - * Return the size of the persistence unit's list of mapping file refs, - * both specified and implied. - */ - int mappingFileRefsSize(); - - /** - * Return all the mapping file refs, both specified and implied, - * containing the specified type. - */ - Iterator mappingFileRefsContaining(String typeName); - - - // ********** specified mapping file refs ********** - - /** - * String constant associated with changes to the persistence unit's - * specified mapping file refs. - */ - String SPECIFIED_MAPPING_FILE_REFS_LIST = "specifiedMappingFileRefs"; //$NON-NLS-1$ - - /** - * Return the persistence unit's list of specified mapping file refs. - */ - ListIterator specifiedMappingFileRefs(); - - /** - * Return the size of the persistence unit's list of specified mapping file refs. - */ - int specifiedMappingFileRefsSize(); - - /** - * Add a new specified mapping file ref to the persistence unit; - * return the newly-created mapping file ref. - */ - MappingFileRef addSpecifiedMappingFileRef(String fileName); - - /** - * Add a new specified mapping file ref to the persistence unit at the specified index; - * return the newly-created mapping file ref. - */ - MappingFileRef addSpecifiedMappingFileRef(int index, String fileName); - - /** - * Remove the specified mapping file ref from the persistence unit. - */ - void removeSpecifiedMappingFileRef(MappingFileRef mappingFileRef); - - /** - * Remove the specified mapping file ref at the specified index from the persistence unit. - */ - void removeSpecifiedMappingFileRef(int index); - - - // ********** implied mapping file ref ********** - - /** - * String constant associated with changes to the persistence unit's - * implied mapping file ref. - */ - String IMPLIED_MAPPING_FILE_REF_PROPERTY = "impliedMappingFileRef"; //$NON-NLS-1$ - - /** - * Return the persistence unit's implied mapping file ref. - */ - MappingFileRef getImpliedMappingFileRef(); - - - // ********** jar file refs ********** - - /** - * String constant associated with changes to the persistence unit's - * JAR file refs. - */ - String JAR_FILE_REFS_LIST = "jarFileRefs"; //$NON-NLS-1$ - - /** - * Return the persistence unit's list of JAR file refs. - */ - ListIterator jarFileRefs(); - - /** - * Return the size of the persistence unit's list of JAR file refs. - */ - int jarFileRefsSize(); - - /** - * Add a new JAR file ref to the persistence unit; - * return the newly-created JAR file ref. - */ - JarFileRef addJarFileRef(String fileName); - - /** - * Add a new JAR file ref to the persistence unit at the specified index; - * return the newly-created JAR file ref. - */ - JarFileRef addJarFileRef(int index, String fileName); - - /** - * Remove the specified JAR file ref from the persistence unit. - */ - void removeJarFileRef(JarFileRef jarFileRef); - - /** - * Remove the JAR file ref at the specified index from the persistence unit. - */ - void removeJarFileRef(int index); - - - // ********** class refs ********** - - /** - * Return the persistence unit's list of class refs, - * both specified and implied. - */ - Iterator classRefs(); - - /** - * Return the size of the persistence unit's list of class refs, - * both specified and implied. - */ - int classRefsSize(); - - - // ********** specified class refs ********** - - /** - * String constant associated with changes to the persistence unit's - * specified class refs. - */ - String SPECIFIED_CLASS_REFS_LIST = "specifiedClassRefs"; //$NON-NLS-1$ - - /** - * Return the persistence unit's list of specified class refs. - */ - ListIterator specifiedClassRefs(); - - /** - * Return the size of the persistence unit's list of specified mapping file refs. - */ - int specifiedClassRefsSize(); - - /** - * Add a new specified class ref to the persistence unit; - * return the newly-created class ref. - */ - ClassRef addSpecifiedClassRef(String className); - - /** - * Add a new specified class ref to the persistence unit at the specified index; - * return the newly-created class ref. - */ - ClassRef addSpecifiedClassRef(int index, String className); - - /** - * Remove the specified class ref from the persistence unit. - */ - void removeSpecifiedClassRef(ClassRef classRef); - - /** - * Remove the specified class ref at the specified index from the persistence unit. - */ - void removeSpecifiedClassRef(int index); - - - // ********** implied class refs ********** - - /** - * String constant associated with changes to the persistence unit's - * implied class refs. - */ - String IMPLIED_CLASS_REFS_COLLECTION = "impliedClassRefs"; //$NON-NLS-1$ - - /** - * Return the persistence unit's list of implied class refs. - */ - Iterator impliedClassRefs(); - - /** - * Return the size of the persistence unit's list of implied class refs. - */ - int impliedClassRefsSize(); - - - // ********** exclude unlisted classes ********** - - /** - * Return whether the persistence unit excludes unlisted classes. - */ - boolean excludesUnlistedClasses(); - - /** - * String constant associated with changes to the persistence unit's - * "exclude unlisted classes" flag. - */ - String SPECIFIED_EXCLUDE_UNLISTED_CLASSES_PROPERTY = "specifiedExcludeUnlistedClasses"; //$NON-NLS-1$ - - /** - * Return the persistence unit's specified "exclude unlisted classes" flag. - */ - Boolean getSpecifiedExcludeUnlistedClasses(); - - /** - * Set the persistence unit's specified "exclude unlisted classes" flag. - */ - void setSpecifiedExcludeUnlistedClasses(Boolean excludeUnlistedClasses); - - /** - * String constant associated with changes to the persistence unit's - * default "exclude unlisted classes" flag (not typically changed). - */ - String DEFAULT_EXCLUDE_UNLISTED_CLASSES_PROPERTY = "defaultExcludeUnlistedClasses"; //$NON-NLS-1$ - - /** - * Return whether the persistence unit excludes unlisted classes by default. - */ - boolean getDefaultExcludeUnlistedClasses(); - - - // ********** properties ********** - - /** - * String constant associated with changes to the persistence unit's - * properties. - */ - String PROPERTIES_LIST = "properties"; //$NON-NLS-1$ - - /** - * Return the persistence unit's list of properties. - */ - ListIterator properties(); - - /** - * Return the size of the persistence unit's list of properties. - */ - int propertiesSize(); - - /** - * Return the *first* property in the persistence unit's property list with - * the specified name. Return null if the list does not contain a property - * with the specified name. - */ - Property getProperty(String propertyName); - - /** - * Return all the properties in the persistence unit with the specified - * name. Return an empty Iterable if the persistence unit does not contain - * a property with the specified name. - */ - Iterable getPropertiesNamed(String propertyName); - - /** - * Return the persistence unit's properties with names beginning with the - * specified prefix. - */ - Iterator propertiesWithNamePrefix(String propertyNamePrefix); - - /** - * Add a new property to the persistence unit; - * return the newly-created property. - */ - Property addProperty(); - - /** - * Add a new property to the persistence unit at the specified index; - * return the newly-created property. - */ - Property addProperty(int index); - - /** - * Set the value of the *first* property in the persistence unit's property - * list with the specified name to the specified value, creating a new - * property if one does not already exist. If a property exists and the - * specified value is null, the existing property is removed. - */ - void setProperty(String propertyName, String value); - - /** - * Set the value of the property with the specified name, creating a new - * property if one does not exist or if the specified flag indicates - * duplicate property names are allowed. If a property exists and duplicate - * values are not allowed and the specified value is null, the existing - * property is removed. - */ - void setProperty(String propertyName, String value, boolean duplicatePropertyNamesAllowed); - - /** - * Remove the specified property from the persistence unit. - */ - void removeProperty(Property property); - - /** - * Remove the *first* property in the persistence unit's property list - * with the specified name. - */ - void removeProperty(String propertyName); - - /** - * Remove the *first* property in the persistence unit's property list - * with the specified name and value, allowing the removal of properties - * with duplicate property names. - */ - void removeProperty(String propertyName, String value); - - /** - * Call back method for Property name changing. - */ - void propertyNameChanged(String oldPropertyName, String newPropertyName, String value); - - /** - * Call back method for Property value changing. - */ - void propertyValueChanged(String propertyName, String newValue); - - /** - * Simple property interface. - */ - interface Property - extends XmlContextNode - { - PersistenceUnit getParent(); - - @SuppressWarnings("hiding") - String NAME_PROPERTY = "name"; //$NON-NLS-1$ - String getName(); - void setName(String name); - - String VALUE_PROPERTY = "value"; //$NON-NLS-1$ - String getValue(); - void setValue(String value); - - XmlProperty getXmlProperty(); - - /** - * Create ReplaceEdits for renaming the property value to the newName. - * The originalType has not yet been renamed, the newName is the new short name. - * If this value does not match the original type, then return an empty Iterable. - */ - Iterable createRenameTypeEdits(IType originalType, String newName); - - /** - * Create ReplaceEdits for moving any references to the originalType to the newPackage. - * The originalType has not yet been moved. - */ - Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage); - - /** - * Create ReplaceEdits for renaming the property value package to the newName. - * The originalPackage has not yet been renamed. - * If this value is not in the originalPackage, then return an empty Iterable. - */ - Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName); - } - - - // ********** mapping file (orm.xml) persistence unit metadata ********** - - /** - * String constant associated with changes to the persistence unit's - * "XML mapping metadata complete" flag. - */ - String XML_MAPPING_METADATA_COMPLETE_PROPERTY = "xmlMappingMetadataComplete"; //$NON-NLS-1$ - - /** - * Return the default "XML mapping metadata complete" flag from the - * first persistence unit metadata - * found in the persistence unit's list of mapping files. - */ - boolean isXmlMappingMetadataComplete(); - - /** - * String constant associated with changes to the persistence unit's - * default access type. - */ - String DEFAULT_ACCESS_PROPERTY = "defaultAccess"; //$NON-NLS-1$ - - /** - * Return the default access type from the first persistence unit metadata - * found in the persistence unit's list of mapping files. - */ - AccessType getDefaultAccess(); - - /** - * String constant associated with changes to the persistence unit's - * default database catalog. - */ - String DEFAULT_CATALOG_PROPERTY = "defaultCatalog"; //$NON-NLS-1$ - - /** - * Return the default database catalog from the first persistence unit metadata - * found in the persistence unit's list of mapping files. - */ - String getDefaultCatalog(); - - /** - * String constant associated with changes to the persistence unit's - * default database schema. - */ - String DEFAULT_SCHEMA_PROPERTY = "defaultSchema"; //$NON-NLS-1$ - - /** - * Return the default database schema from the first persistence unit metadata - * found in the persistence unit's list of mapping files. - */ - String getDefaultSchema(); - - /** - * String constant associated with changes to the persistence unit's - * default "cascade persist" flag. - */ - String DEFAULT_CASCADE_PERSIST_PROPERTY = "defaultCascadePersist"; //$NON-NLS-1$ - - /** - * Return the default "cascade persist" flag from the first persistence unit metadata - * found in the persistence unit's list of mapping files. - */ - boolean getDefaultCascadePersist(); - - - // ********** generators ********** - - /** - * String constant associated with changes to the persistence unit's - * collection of "global" generators. - * NB: There are no granular collection change notifications; - * only a "collection changed" notification when the collection - * is rebuilt at the finish of the persistence unit's "update". - */ - String GENERATORS_COLLECTION = "generators"; //$NON-NLS-1$ - - /** - * Return the generators defined within the persistence unit's scope, - * including generators with duplicate names. - */ - Iterator generators(); - - /** - * Return the size of the list of generators defined within the persistence unit's scope, - * including generators with duplicate names. - */ - int generatorsSize(); - - /** - * Add the specified generator (that is defined elsewhere) to the - * list of generators defined within the persistence unit's scope. - * NB: This is to be called by every generator during "update". - * This method does not directly generate a change notification. - * The change notification is fired at the end of the persistence unit's - * "update", once all the generators have added themselves. - */ - void addGenerator(Generator generator); - - /** - * Return the names of the generators defined in the persistence - * unit's scope, with duplicates removed. - */ - Iterable getUniqueGeneratorNames(); - - - // ********** queries ********** - - /** - * String constant associated with changes to the persistence unit's - * collection of "global" queries. - * NB: There are no granular collection change notifications; - * only a "collection changed" notification when the collection is - * rebuilt at the finish of the persistence unit's "update". - */ - String QUERIES_COLLECTION = "queries"; //$NON-NLS-1$ - - /** - * Return the queries defined within the persistence unit's scope, - * including queries with duplicate names. - */ - Iterator queries(); - - /** - * Return the number of queries defined within the persistence unit's scope, - * including queries with duplicate names. - */ - int queriesSize(); - - /** - * Add the specified query (that is defined elsewhere) to the - * list of queries defined within the persistence unit's scope. - * NB: This is to be called by every query during "update". - * This method does not directly generate a change notification. - * The change notification is fired at the end of the persistence unit's - * "update", once all the queries have added themselves. - */ - void addQuery(Query query); - - - // ********** misc ********** - - /** - * Return the XML resource model corresponding to the - * persistence unit. - */ - XmlPersistenceUnit getXmlPersistenceUnit(); - - /** - * Return the persistent type specified in the persistence unit with the - * specified name. - */ - PersistentType getPersistentType(String typeName); - - /** - * Return whether the persistence unit specifies a persistent type with the - * specified name (i.e. the type is listed either in the persistence unit's - * list of specified classes or in one of the persistent unit's mapping files). - */ - boolean specifiesPersistentType(String typeName); - - /** - * Return the persistence unit's entities. - */ - Iterable getEntities(); - - /** - * Return the entity specified in the persistence unit with the - * specified name. Return null if there is no persistent type - * with the specified name or if the persistent type is not mapped as an - * entity. - * @see org.eclipse.jpt.jpa.core.MappingKeys#ENTITY_TYPE_MAPPING_KEY - */ - Entity getEntity(String typeName); - - /** - * Return the embeddable specified in the persistence unit with the - * specified name. Return null if there is no persistent type - * with the specified name or if the persistent type is not mapped as an - * embeddable. - * @see org.eclipse.jpt.jpa.core.MappingKeys#EMBEDDABLE_TYPE_MAPPING_KEY - */ - Embeddable getEmbeddable(String typeName); - - /** - * Return whether the text representation of this persistence unit contains - * the given text offset - */ - boolean containsOffset(int textOffset); - - /** - * Return all the entities defined in both the implied and specified mapping files - * of a persistence unit - */ - Iterable getOrmEntities(); - - /** - * Return the entity names of all the entities defined in both the implied and specified mapping files - * of a persistence unit - */ - Iterator ormEntityNames(); - - /** - * Return all the entities defined with both the implied and specified Java classes - * of a persistence unit - */ - Iterable getJavaEntities(); - - /** - * Return the entity names of all the entities defined with both the implied and specified Java classes - * of a persistence unit - */ - Iterator javaEntityNames(); - - /** - * Return the entity names of entities only defined with mapped Java classes of a persistence unit. - * The names of Java entities overridden by entities defined in the mapping files are excluded. - */ - Iterator javaEntityNamesExclOverridden(); - - - // ********** validation ********** - - /** - * Return whether the persistence unit validates agains database metadata. - * (For instance, if the connection is not active, then it should not.) - */ - boolean validatesAgainstDatabase(); - - - // ********** refactoring ********** - - /** - * Create DeleteEdits for deleting any references to the deleted type. - * Return an EmptyIterable if there are not any references. - */ - Iterable createDeleteTypeEdits(IType type); - - /** - * Create DeleteEdits for deleting any references to the deleted file - * Return an EmptyIterable if there are not any references. - */ - Iterable createDeleteMappingFileEdits(IFile file); - - /** - * Create ReplaceEdits for renaming any references to the originalType to the newName. - * The originalType has not yet been renamed, the newName is the new short name. - */ - Iterable createRenameTypeEdits(IType originalType, String newName); - - /** - * Create ReplaceEdits for moving any references to the originalType to the newPackage. - * The originalType has not yet been moved. - */ - Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage); - - /** - * Create ReplaceEdits for renaming any references to the originalPackage to the newName. - * The originalPackage has not yet been renamed. - */ - Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName); - - /** - * Create ReplaceEdits for renaming any references to the originalFolder to the newName. - * The originalFolder has not yet been renamed. - */ - Iterable createRenameFolderEdits(IFolder originalFolder, String newName); - - /** - * Create ReplaceEdits for renaming any references to the originalFile to the newName. - * Return an EmptyIterable if there are not any references. - * The originalFile has not yet been renamed, the newName is the new short name. - */ - Iterable createRenameMappingFileEdits(IFile originalFile, String newName); - - /** - * Create ReplaceEdits for moving any references to the originalFile to the destination. - * Return an EmptyIterable if there are not any references. - * The originalFile has not been moved yet. - */ - Iterable createMoveMappingFileEdits(IFile originalFile, IPath runtineDestination); - - /** - * Create ReplaceEdits for moving any references to the originalFolder to the runtimeDestination. - * The runtimeDestination already includes the original folder name. - */ - Iterable createMoveFolderEdits(IFolder originalFolder, IPath runtimeDestination); - - /** - * Return a location relative to the beginning of the persistence.xml for - * inserting a new mapping-file element. If there are existing mapping files, - * the location should be after those. If no existing mapping files then make - * sure the location does not violate the persistence.xml schema. - */ - int findInsertLocationForMappingFileRef(); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnitProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnitProperties.java deleted file mode 100644 index a50723c10b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnitProperties.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2007, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.persistence; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.utility.model.Model; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 3.0 - * @since 2.3 - */ -public interface PersistenceUnitProperties extends Model -{ - /** - * Method used for identifying the given property. - */ - boolean itemIsProperty(PersistenceUnit.Property item); - - /** - * Returns the property name used for change notification of the given property. - */ - String propertyIdOf(PersistenceUnit.Property property); - - /** - * Return the PersistenceUnit of this Properties. - */ - PersistenceUnit getPersistenceUnit(); - - /** - * Return the JPA project the PersistenceUnit belongs to. - */ - JpaProject getJpaProject(); - - /** - * A Property with the given name had its value changed - */ - void propertyValueChanged(String propertyName, String newValue); - - /** - * A Property with the given name was removed - */ - void propertyRemoved(String propertyName); - - - // ************ refactoring ************** - - /** - * Create ReplaceEdits for renaming any references to the originalType to the newName. - * The originalType has not yet been renamed, the newName is the new short name. - */ - Iterable createRenameTypeEdits(IType originalType, String newName); - - /** - * Create ReplaceEdits for moving any references to the originalType to the newPackage. - * The originalType has not yet been moved. - */ - Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage); - - /** - * Create ReplaceEdits for renaming any reference to the originalPackage newName. - * The originalPackage has not yet been renamed. - */ - Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName); - -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnitTransactionType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnitTransactionType.java deleted file mode 100644 index c9478dc229..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceUnitTransactionType.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.persistence; - -import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnitTransactionType; - -/** - * Context model corresponding to the XML resource model - * {@link XmlPersistenceUnitTransactionType}, - * which corresponds to the transaction-type element in the - * persistence.xml file. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.0 - * @since 2.0 - */ -public enum PersistenceUnitTransactionType -{ - /** Corresponds to JTA transaction type */ - JTA, - - /** Corresponds to RESOURCE_LOCAL transaction type */ - RESOURCE_LOCAL; - - public static PersistenceUnitTransactionType fromXmlResourceModel(XmlPersistenceUnitTransactionType transactionType) { - if (transactionType == null) { - return null; - } - switch (transactionType) { - case JTA: - return JTA; - case RESOURCE_LOCAL: - return RESOURCE_LOCAL; - default: - throw new IllegalArgumentException("unknown transaction type: " + transactionType); //$NON-NLS-1$ - } - } - - public static XmlPersistenceUnitTransactionType toXmlResourceModel(PersistenceUnitTransactionType transactionType) { - if (transactionType == null) { - return null; - } - switch (transactionType) { - case JTA: - return XmlPersistenceUnitTransactionType.JTA; - case RESOURCE_LOCAL: - return XmlPersistenceUnitTransactionType.RESOURCE_LOCAL; - default: - throw new IllegalArgumentException("unknown transaction type: " + transactionType); //$NON-NLS-1$ - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXml.java deleted file mode 100644 index ff1c034335..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXml.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.persistence; - -import org.eclipse.jpt.jpa.core.context.XmlFile; - -/** - * JPA persistence.xml file. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.0 - */ -public interface PersistenceXml - extends XmlFile -{ - // ********** persistence ********** - - /** - * String constant associated with changes to the persistence property - */ - public final static String PERSISTENCE_PROPERTY = "persistence"; //$NON-NLS-1$ - - /** - * Return the content represented by the root of the persistence.xml file. - * This may be null. - */ - Persistence getPersistence(); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java deleted file mode 100644 index 98ef23c467..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlContextNodeFactory.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.persistence; - -import org.eclipse.jpt.jpa.core.context.java.JarFile; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty; - -/** - * Interface used by persistence unit to gather up persistent types. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface PersistenceXmlContextNodeFactory -{ - Persistence buildPersistence(PersistenceXml parent, XmlPersistence resourcePersistence); - - PersistenceUnit buildPersistenceUnit(Persistence parent, XmlPersistenceUnit resourcePersistenceUnit); - - /** - * Build a "specified" mapping file ref. - */ - MappingFileRef buildMappingFileRef(PersistenceUnit parent, XmlMappingFileRef xmlMappingFileRef); - - /** - * Build a "implied" mapping file ref. - */ - MappingFileRef buildImpliedMappingFileRef(PersistenceUnit parent); - - /** - * Build a "specified" class ref. - */ - ClassRef buildClassRef(PersistenceUnit parent, XmlJavaClassRef xmlClassRef); - - /** - * Build an "implied" class ref. - */ - ClassRef buildClassRef(PersistenceUnit parent, String className); - - JarFileRef buildJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef); - - JarFile buildJarFile(JarFileRef parent, JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot); - - PersistenceUnit.Property buildProperty(PersistenceUnit parent, XmlProperty property); - - PersistenceUnitProperties buildConnection(PersistenceUnit parent); - - PersistenceUnitProperties buildOptions(PersistenceUnit parent); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlDefinition.java deleted file mode 100644 index 218b88e434..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistenceXmlDefinition.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.persistence; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.ResourceDefinition; - -/** - * persistence.xml definition - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface PersistenceXmlDefinition - extends ResourceDefinition -{ - EFactory getResourceNodeFactory(); - - PersistenceXmlContextNodeFactory getContextNodeFactory(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistentTypeContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistentTypeContainer.java deleted file mode 100644 index 554e665f01..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/context/persistence/PersistentTypeContainer.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.context.persistence; - -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.jpa.core.context.PersistentType; - -/** - * Interface used by persistence unit to gather up persistent types. - *

- * Provisional API: This interface is part of an interim API that is still - * under development and expected to change significantly before reaching - * stability. It is available at this early stage to solicit feedback from - * pioneering adopters on the understanding that any code that uses this API - * will almost certainly be broken (repeatedly) as the API evolves. - * - * @version 2.3 - * @since 2.3 - */ -public interface PersistentTypeContainer { - - /** - * Return the container's persistent types. - */ - Iterable getPersistentTypes(); - - - Transformer> TRANSFORMER = - new Transformer>() { - public Iterable transform(PersistentTypeContainer container) { - return container.getPersistentTypes(); - } - @Override - public String toString() { - return "PersistentTypeContainer.TRANSFORMER"; //$NON-NLS-1$ - } - }; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java deleted file mode 100644 index 9912509ddb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaAnnotationDefinitionProvider.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import java.util.ArrayList; -import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; - -public abstract class AbstractJpaAnnotationDefinitionProvider - implements JpaAnnotationDefinitionProvider -{ - protected ArrayList typeAnnotationDefinitions; - - protected ArrayList typeMappingAnnotationDefinitions; - - protected ArrayList attributeAnnotationDefinitions; - - private ArrayList packageAnnotationDefinitions; - - - protected AbstractJpaAnnotationDefinitionProvider() { - super(); - } - - - // ********** type annotation definitions ********** - - public synchronized Iterable getTypeAnnotationDefinitions() { - if (this.typeAnnotationDefinitions == null) { - this.typeAnnotationDefinitions = this.buildTypeAnnotationDefinitions(); - } - return this.typeAnnotationDefinitions; - } - - protected ArrayList buildTypeAnnotationDefinitions() { - ArrayList definitions = new ArrayList(); - this.addTypeAnnotationDefinitionsTo(definitions); - return definitions; - } - - protected abstract void addTypeAnnotationDefinitionsTo(ArrayList definitions); - - - // ********** type mapping annotation definitions ********** - - public synchronized Iterable getTypeMappingAnnotationDefinitions() { - if (this.typeMappingAnnotationDefinitions == null) { - this.typeMappingAnnotationDefinitions = this.buildTypeMappingAnnotationDefinitions(); - } - return this.typeMappingAnnotationDefinitions; - } - - protected ArrayList buildTypeMappingAnnotationDefinitions() { - ArrayList definitions = new ArrayList(); - this.addTypeMappingAnnotationDefinitionsTo(definitions); - return definitions; - } - - protected abstract void addTypeMappingAnnotationDefinitionsTo(ArrayList definitions); - - - // ********** attribute annotation definitions ********** - - public synchronized Iterable getAttributeAnnotationDefinitions() { - if (this.attributeAnnotationDefinitions == null) { - this.attributeAnnotationDefinitions = this.buildAttributeAnnotationDefinitions(); - } - return this.attributeAnnotationDefinitions; - } - - protected ArrayList buildAttributeAnnotationDefinitions() { - ArrayList definitions = new ArrayList(); - this.addAttributeAnnotationDefinitionsTo(definitions); - return definitions; - } - - protected abstract void addAttributeAnnotationDefinitionsTo(ArrayList definitions); - - - // ********** package annotation definitions ********** - - public synchronized Iterable getPackageAnnotationDefinitions() { - if (this.packageAnnotationDefinitions == null) { - this.packageAnnotationDefinitions = this.buildPackageAnnotationDefinitions(); - } - return this.packageAnnotationDefinitions; - } - - protected ArrayList buildPackageAnnotationDefinitions() { - ArrayList definitions = new ArrayList(); - this.addPackageAnnotationDefinitionsTo(definitions); - return definitions; - } - - protected abstract void addPackageAnnotationDefinitionsTo(ArrayList definitions); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java deleted file mode 100644 index 31ea66c1c3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaFactory.java +++ /dev/null @@ -1,402 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceModel; -import org.eclipse.jpt.jpa.core.JpaDataSource; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.JpaFile; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.JpaRootContextNode; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.UniqueConstraint; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaBasicMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaDiscriminatorColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable; -import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedIdMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaEntity; -import org.eclipse.jpt.jpa.core.context.java.JavaEnumeratedConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaGeneratedValue; -import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTable; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaLobConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaManyToOneMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass; -import org.eclipse.jpt.jpa.core.context.java.JavaNamedNativeQuery; -import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery; -import org.eclipse.jpt.jpa.core.context.java.JavaOneToManyMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaOrderable; -import org.eclipse.jpt.jpa.core.context.java.JavaOverrideRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaQuery; -import org.eclipse.jpt.jpa.core.context.java.JavaQueryContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaQueryHint; -import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable; -import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator; -import org.eclipse.jpt.jpa.core.context.java.JavaTable; -import org.eclipse.jpt.jpa.core.context.java.JavaTableGenerator; -import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaTransientMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint; -import org.eclipse.jpt.jpa.core.context.java.JavaVersionMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTable; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverrideRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualUniqueConstraint; -import org.eclipse.jpt.jpa.core.context.orm.OrmXml; -import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.jpt.jpa.core.internal.context.java.GenericJavaVirtualJoinTable; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaNullTypeMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaDataSource; -import org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaFile; -import org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaProject; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericRootContextNode; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaAssociationOverride; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaAttributeOverride; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaBasicMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaColumn; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaDiscriminatorColumn; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEmbeddable; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEmbeddedIdMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEmbeddedMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEntity; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEnumeratedConverter; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaGeneratedValue; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaGeneratorContainer; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaIdMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaJoinColumn; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaJoinTable; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaLobConverter; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaManyToManyMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaManyToOneMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaMappedSuperclass; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaNamedNativeQuery; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaNamedQuery; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaNullAttributeMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaOneToManyMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaOneToOneMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaOrderable; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaOverrideRelationship; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaQueryContainer; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaQueryHint; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaSecondaryTable; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaSequenceGenerator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaTable; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaTableGenerator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaTemporalConverter; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaTransientMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaUniqueConstraint; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVersionMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualAssociationOverride; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualAttributeOverride; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualColumn; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualJoinColumn; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualOverrideRelationship; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaVirtualUniqueConstraint; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXml; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXml; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation; -import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; - -/** - * Central class that allows extenders to easily replace implementations of - * various Dali interfaces. - */ -public abstract class AbstractJpaFactory - implements JpaFactory -{ - protected AbstractJpaFactory() { - super(); - } - - - // ********** Core Model ********** - - public JpaProject buildJpaProject(JpaProject.Config config) { - return new GenericJpaProject(config); - } - - public JpaDataSource buildJpaDataSource(JpaProject jpaProject, String connectionProfileName) { - return new GenericJpaDataSource(jpaProject, connectionProfileName); - } - - public JpaFile buildJpaFile(JpaProject jpaProject, IFile file, IContentType contentType, JptResourceModel resourceModel) { - return new GenericJpaFile(jpaProject, file, contentType, resourceModel); - } - - - // ********** Context Nodes ********** - - public JpaRootContextNode buildRootContextNode(JpaProject parent) { - return new GenericRootContextNode(parent); - } - - - // ********** XML Context Model ********** - - public PersistenceXml buildPersistenceXml(JpaRootContextNode parent, JpaXmlResource resource) { - return new GenericPersistenceXml(parent, resource); - } - - public OrmXml buildMappingFile(MappingFileRef parent, JpaXmlResource resource) { - return new GenericOrmXml(parent, resource); - } - - - // ********** Java Context Model ********** - - public JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourcePersistentType jrpt) { - return new GenericJavaPersistentType(owner, jrpt); - } - - public JavaPersistentAttribute buildJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa) { - return new GenericJavaPersistentAttribute(parent, jrpa); - } - - public JavaTypeMapping buildJavaNullTypeMapping(JavaPersistentType parent) { - return new JavaNullTypeMapping(parent); - } - - public JavaEntity buildJavaEntity(JavaPersistentType parent, EntityAnnotation entityAnnotation) { - return new GenericJavaEntity(parent, entityAnnotation); - } - - public JavaMappedSuperclass buildJavaMappedSuperclass(JavaPersistentType parent, MappedSuperclassAnnotation mappedSuperclassAnnotation) { - return new GenericJavaMappedSuperclass(parent, mappedSuperclassAnnotation); - } - - public JavaEmbeddable buildJavaEmbeddable(JavaPersistentType parent, EmbeddableAnnotation embeddableAnnotation) { - return new GenericJavaEmbeddable(parent, embeddableAnnotation); - } - - public JavaTable buildJavaTable(JavaEntity parent, Table.Owner owner) { - return new GenericJavaTable(parent, owner); - } - - public JavaColumn buildJavaColumn(JavaJpaContextNode parent, JavaColumn.Owner owner) { - return new GenericJavaColumn(parent, owner); - } - - public JavaVirtualColumn buildJavaVirtualColumn(JavaJpaContextNode parent, JavaVirtualColumn.Owner owner) { - return new GenericJavaVirtualColumn(parent, owner); - } - - public JavaDiscriminatorColumn buildJavaDiscriminatorColumn(JavaEntity parent, JavaDiscriminatorColumn.Owner owner) { - return new GenericJavaDiscriminatorColumn(parent, owner); - } - - public JavaJoinColumn buildJavaJoinColumn(JavaJpaContextNode parent, JavaJoinColumn.Owner owner, JoinColumnAnnotation joinColumnAnnotation) { - return new GenericJavaJoinColumn(parent, owner, joinColumnAnnotation); - } - - public JavaVirtualJoinColumn buildJavaVirtualJoinColumn(JavaJpaContextNode parent, ReadOnlyJoinColumn.Owner owner, JoinColumn joinColumn) { - return new GenericJavaVirtualJoinColumn(parent, owner, joinColumn); - } - - public JavaJoinTable buildJavaJoinTable(JavaJoinTableRelationshipStrategy parent, Table.Owner owner) { - return new GenericJavaJoinTable(parent, owner); - } - - public JavaVirtualJoinTable buildJavaVirtualJoinTable(JavaVirtualJoinTableRelationshipStrategy parent, JoinTable overriddenTable) { - return new GenericJavaVirtualJoinTable(parent, overriddenTable); - } - - public JavaSecondaryTable buildJavaSecondaryTable(JavaEntity parent, Table.Owner owner, SecondaryTableAnnotation tableAnnotation) { - return new GenericJavaSecondaryTable(parent, owner, tableAnnotation); - } - - public JavaBasicMapping buildJavaBasicMapping(JavaPersistentAttribute parent) { - return new GenericJavaBasicMapping(parent); - } - - public JavaEmbeddedIdMapping buildJavaEmbeddedIdMapping(JavaPersistentAttribute parent) { - return new GenericJavaEmbeddedIdMapping(parent); - } - - public JavaEmbeddedMapping buildJavaEmbeddedMapping(JavaPersistentAttribute parent) { - return new GenericJavaEmbeddedMapping(parent); - } - - public JavaIdMapping buildJavaIdMapping(JavaPersistentAttribute parent) { - return new GenericJavaIdMapping(parent); - } - - public JavaManyToManyMapping buildJavaManyToManyMapping(JavaPersistentAttribute parent) { - return new GenericJavaManyToManyMapping(parent); - } - - public JavaManyToOneMapping buildJavaManyToOneMapping(JavaPersistentAttribute parent) { - return new GenericJavaManyToOneMapping(parent); - } - - public JavaOneToManyMapping buildJavaOneToManyMapping(JavaPersistentAttribute parent) { - return new GenericJavaOneToManyMapping(parent); - } - - public JavaOneToOneMapping buildJavaOneToOneMapping(JavaPersistentAttribute parent) { - return new GenericJavaOneToOneMapping(parent); - } - - public JavaTransientMapping buildJavaTransientMapping(JavaPersistentAttribute parent) { - return new GenericJavaTransientMapping(parent); - } - - public JavaVersionMapping buildJavaVersionMapping(JavaPersistentAttribute parent) { - return new GenericJavaVersionMapping(parent); - } - - public JavaAttributeMapping buildJavaNullAttributeMapping(JavaPersistentAttribute parent) { - return new GenericJavaNullAttributeMapping(parent); - } - - public JavaGeneratorContainer buildJavaGeneratorContainer(JavaJpaContextNode parent, JavaGeneratorContainer.Owner owner) { - return new GenericJavaGeneratorContainer(parent, owner); - } - - public JavaSequenceGenerator buildJavaSequenceGenerator(JavaJpaContextNode parent, SequenceGeneratorAnnotation sequenceGeneratorAnnotation) { - return new GenericJavaSequenceGenerator(parent, sequenceGeneratorAnnotation); - } - - public JavaTableGenerator buildJavaTableGenerator(JavaJpaContextNode parent, TableGeneratorAnnotation tableGeneratorAnnotation) { - return new GenericJavaTableGenerator(parent, tableGeneratorAnnotation); - } - - public JavaGeneratedValue buildJavaGeneratedValue(JavaIdMapping parent, GeneratedValueAnnotation generatedValueAnnotation) { - return new GenericJavaGeneratedValue(parent, generatedValueAnnotation); - } - - public JavaPrimaryKeyJoinColumn buildJavaPrimaryKeyJoinColumn(JavaJpaContextNode parent, JavaBaseJoinColumn.Owner owner, PrimaryKeyJoinColumnAnnotation pkJoinColumnAnnotation) { - return new GenericJavaPrimaryKeyJoinColumn(parent, owner, pkJoinColumnAnnotation); - } - - public JavaAttributeOverrideContainer buildJavaAttributeOverrideContainer(JavaJpaContextNode parent, JavaAttributeOverrideContainer.Owner owner) { - return new GenericJavaAttributeOverrideContainer(parent, owner); - } - - public JavaAssociationOverrideContainer buildJavaAssociationOverrideContainer(JavaJpaContextNode parent, JavaAssociationOverrideContainer.Owner owner) { - return new GenericJavaAssociationOverrideContainer(parent, owner); - } - - public JavaAttributeOverride buildJavaAttributeOverride(JavaAttributeOverrideContainer parent, AttributeOverrideAnnotation annotation) { - return new GenericJavaAttributeOverride(parent, annotation); - } - - public JavaVirtualAttributeOverride buildJavaVirtualAttributeOverride(JavaAttributeOverrideContainer parent, String name) { - return new GenericJavaVirtualAttributeOverride(parent, name); - } - - public JavaAssociationOverride buildJavaAssociationOverride(JavaAssociationOverrideContainer parent, AssociationOverrideAnnotation annotation) { - return new GenericJavaAssociationOverride(parent, annotation); - } - - public JavaVirtualAssociationOverride buildJavaVirtualAssociationOverride(JavaAssociationOverrideContainer parent, String name) { - return new GenericJavaVirtualAssociationOverride(parent, name); - } - - public JavaOverrideRelationship buildJavaOverrideRelationship(JavaAssociationOverride parent) { - return new GenericJavaOverrideRelationship(parent); - } - - public JavaVirtualOverrideRelationship buildJavaVirtualOverrideRelationship(JavaVirtualAssociationOverride parent) { - return new GenericJavaVirtualOverrideRelationship(parent); - } - - public JavaQueryContainer buildJavaQueryContainer(JavaJpaContextNode parent, JavaQueryContainer.Owner owner) { - return new GenericJavaQueryContainer(parent, owner); - } - - public JavaNamedQuery buildJavaNamedQuery(JavaJpaContextNode parent, NamedQueryAnnotation namedQueryAnnotation) { - return new GenericJavaNamedQuery(parent, namedQueryAnnotation); - } - - public JavaNamedNativeQuery buildJavaNamedNativeQuery(JavaJpaContextNode parent, NamedNativeQueryAnnotation namedNativeQueryAnnotation) { - return new GenericJavaNamedNativeQuery(parent, namedNativeQueryAnnotation); - } - - public JavaQueryHint buildJavaQueryHint(JavaQuery parent, QueryHintAnnotation queryHintAnnotation) { - return new GenericJavaQueryHint(parent, queryHintAnnotation); - } - - public JavaUniqueConstraint buildJavaUniqueConstraint(JavaJpaContextNode parent, UniqueConstraint.Owner owner, UniqueConstraintAnnotation constraintAnnotation) { - return new GenericJavaUniqueConstraint(parent, owner, constraintAnnotation); - } - - public JavaVirtualUniqueConstraint buildJavaVirtualUniqueConstraint(JavaJpaContextNode parent, UniqueConstraint uniqueConstraint) { - return new GenericJavaVirtualUniqueConstraint(parent, uniqueConstraint); - } - - public JavaEnumeratedConverter buildJavaEnumeratedConverter(JavaAttributeMapping parent, EnumeratedAnnotation annotation) { - return new GenericJavaEnumeratedConverter(parent, annotation); - } - - public JavaTemporalConverter buildJavaTemporalConverter(JavaAttributeMapping parent, TemporalAnnotation annotation) { - return new GenericJavaTemporalConverter(parent, annotation); - } - - public JavaLobConverter buildJavaLobConverter(JavaAttributeMapping parent, LobAnnotation annotation) { - return new GenericJavaLobConverter(parent, annotation); - } - - public JavaOrderable buildJavaOrderable(JavaAttributeMapping parent) { - return new GenericJavaOrderable(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java deleted file mode 100644 index a7a7a73a20..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaNode.java +++ /dev/null @@ -1,223 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Set; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.AspectChangeSupport; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.jpa.core.JpaDataSource; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.JpaFile; -import org.eclipse.jpt.jpa.core.JpaNode; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaPlatformVariation; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.Database; - -/** - * Some common Dali behavior:

    - *
  • containment hierarchy - *
  • Eclipse adaptable - *
  • update triggers - *
- */ -public abstract class AbstractJpaNode - extends AbstractModel - implements JpaNode -{ - protected final JpaNode parent; - - - // ********** constructor/initialization ********** - - protected AbstractJpaNode(JpaNode parent) { - super(); - this.checkParent(parent); - this.parent = parent; - } - - protected void checkParent(JpaNode p) { - if (p == null) { - if (this.requiresParent()) { - throw new IllegalArgumentException("'parent' cannot be null"); //$NON-NLS-1$ - } - } else { - if (this.forbidsParent()) { - throw new IllegalArgumentException("'parent' must be null"); //$NON-NLS-1$ - } - } - } - - protected boolean requiresParent() { - return true; - } - - protected final boolean forbidsParent() { - return ! this.requiresParent(); // assume 'parent' is not optional - } - - @Override - protected ChangeSupport buildChangeSupport() { - return new AspectChangeSupport(this, this.buildChangeSupportListener()); - } - - protected AspectChangeSupport.Listener buildChangeSupportListener() { - return new AspectChangeSupport.Listener() { - public void aspectChanged(String aspectName) { - AbstractJpaNode.this.aspectChanged(aspectName); - } - }; - } - - - // ********** IAdaptable implementation ********** - - @SuppressWarnings("rawtypes") - public Object getAdapter(Class adapter) { - return Platform.getAdapterManager().getAdapter(this, adapter); - } - - - // ********** JpaNode implementation ********** - - public JpaNode getParent() { - return this.parent; - } - - public IResource getResource() { - return this.parent.getResource(); - } - - public JpaProject getJpaProject() { - return this.parent.getJpaProject(); - } - - - // ********** convenience methods ********** - - protected JpaPlatform getJpaPlatform() { - return this.getJpaProject().getJpaPlatform(); - } - - protected JpaPlatform.Version getJpaPlatformVersion() { - return this.getJpaPlatform().getJpaVersion(); - } - - protected boolean isJpa2_0Compatible() { - return JptJpaCorePlugin.nodeIsJpa2_0Compatible(this); - } - - /** - * Call {@link #isJpa2_0Compatible()} before calling this method. - */ - protected JpaFactory2_0 getJpaFactory2_0() { - return (JpaFactory2_0) this.getJpaFactory(); - } - - protected JpaFactory getJpaFactory() { - return this.getJpaPlatform().getJpaFactory(); - } - - protected JpaPlatformVariation getJpaPlatformVariation() { - return this.getJpaPlatform().getJpaVariation(); - } - - protected JpaFile getJpaFile(IFile file) { - return this.getJpaProject().getJpaFile(file); - } - - protected JpaDataSource getDataSource() { - return this.getJpaProject().getDataSource(); - } - - protected Database getDatabase() { - return this.getDataSource().getDatabase(); - } - - protected boolean connectionProfileIsActive() { - return this.getDataSource().connectionProfileIsActive(); - } - - /** - * Pre-condition: specified catalog identifier is not null. - * NB: Do not use the catalog name. - */ - protected Catalog resolveDbCatalog(String catalog) { - Database database = this.getDatabase(); - return (database == null) ? null : database.getCatalogForIdentifier(catalog); - } - - - // ********** AspectChangeSupport.Listener support ********** - - protected void aspectChanged(String aspectName) { - if (this.aspectTriggersUpdate(aspectName)) { -// String msg = Thread.currentThread() + " aspect change: " + this + ": " + aspectName; -// System.out.println(msg); -// new Exception(msg).printStackTrace(System.out); - this.stateChanged(); - } - } - - protected boolean aspectTriggersUpdate(String aspectName) { - return ! this.aspectDoesNotTriggerUpdate(aspectName); - } - - protected boolean aspectDoesNotTriggerUpdate(String aspectName) { - // ignore state changes so we don't get a stack overflow :-) - // (and we don't use state changes except here) - return (aspectName == null) || - this.nonUpdateAspectNames().contains(aspectName); - } - - protected final Set nonUpdateAspectNames() { - synchronized (NON_UPDATE_ASPECT_NAME_SETS) { - HashSet nonUpdateAspectNames = NON_UPDATE_ASPECT_NAME_SETS.get(this.getClass()); - if (nonUpdateAspectNames == null) { - nonUpdateAspectNames = new HashSet(); - this.addNonUpdateAspectNamesTo(nonUpdateAspectNames); - NON_UPDATE_ASPECT_NAME_SETS.put(this.getClass(), nonUpdateAspectNames); - } - return nonUpdateAspectNames; - } - } - - private static final HashMap, HashSet> NON_UPDATE_ASPECT_NAME_SETS = new HashMap, HashSet>(); - - protected void addNonUpdateAspectNamesTo(@SuppressWarnings("unused") Set nonUpdateAspectNames) { - // when you override this method, don't forget to include: - // super.addNonUpdateAspectNamesTo(nonUpdateAspectNames); - } - - public void stateChanged() { - this.fireStateChanged(); - if (this.parent != null) { - this.parent.stateChanged(); - } - } - - - // ********** convenience stuff ********** - - /** - * Useful for building validation messages. - */ - public static final String[] EMPTY_STRING_ARRAY = StringTools.EMPTY_STRING_ARRAY; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaPlatformProvider.java deleted file mode 100644 index 785068d04f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaPlatformProvider.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import java.util.ArrayList; -import org.eclipse.jpt.jpa.core.JpaPlatformProvider; -import org.eclipse.jpt.jpa.core.JpaResourceModelProvider; -import org.eclipse.jpt.jpa.core.ResourceDefinition; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; - -/** - * All the state in the JPA platform should be "static" (i.e. unchanging once - * it is initialized). - */ -public abstract class AbstractJpaPlatformProvider - implements JpaPlatformProvider -{ - protected ArrayList resourceModelProviders; - - protected ArrayList javaTypeMappingDefinitions; - - protected ArrayList defaultJavaAttributeMappingDefinitions; - - protected ArrayList specifiedJavaAttributeMappingDefinitions; - - protected ArrayList resourceDefinitions; - - - /** - * zero-argument constructor - */ - protected AbstractJpaPlatformProvider() { - super(); - } - - - // ********** resource models ********** - - public synchronized Iterable getResourceModelProviders() { - if (this.resourceModelProviders == null) { - this.resourceModelProviders = this.buildResourceModelProviders(); - } - return this.resourceModelProviders; - } - - protected ArrayList buildResourceModelProviders() { - ArrayList providers = new ArrayList(); - this.addResourceModelProvidersTo(providers); - return providers; - } - - protected abstract void addResourceModelProvidersTo(ArrayList providers); - - - // ********** Java type mappings ********** - - public synchronized Iterable getJavaTypeMappingDefinitions() { - if (this.javaTypeMappingDefinitions == null) { - this.javaTypeMappingDefinitions = this.buildJavaTypeMappingDefinitions(); - } - return this.javaTypeMappingDefinitions; - } - - protected ArrayList buildJavaTypeMappingDefinitions() { - ArrayList definitions = new ArrayList(); - this.addJavaTypeMappingDefinitionsTo(definitions); - return definitions; - } - - /** - * To the specified list, add mapping definitions to use for analyzing the - * mapping of a type given all annotations on it. The order is important, - * as once a mapping definition tests positive for a - * type, all following mapping definitions are ignored. - */ - protected abstract void addJavaTypeMappingDefinitionsTo(ArrayList definitions); - - - // ********** Java attribute mappings ********** - - public synchronized Iterable getDefaultJavaAttributeMappingDefinitions() { - if (this.defaultJavaAttributeMappingDefinitions == null) { - this.defaultJavaAttributeMappingDefinitions = this.buildDefaultJavaAttributeMappingDefinitions(); - } - return this.defaultJavaAttributeMappingDefinitions; - } - - protected ArrayList buildDefaultJavaAttributeMappingDefinitions() { - ArrayList definitions = new ArrayList(); - this.addDefaultJavaAttributeMappingDefinitionsTo(definitions); - return definitions; - } - - /** - * To the specified list, add mapping definitions to use for analyzing the - * default mapping of an attribute. The order is important, - * as once a mapping definition tests positive for an attribute, - * all following mapping definitions are ignored. - */ - protected abstract void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList definitions); - - public synchronized Iterable getSpecifiedJavaAttributeMappingDefinitions() { - if (this.specifiedJavaAttributeMappingDefinitions == null) { - this.specifiedJavaAttributeMappingDefinitions = this.buildSpecifiedJavaAttributeMappingDefinitions(); - } - return this.specifiedJavaAttributeMappingDefinitions; - } - - protected ArrayList buildSpecifiedJavaAttributeMappingDefinitions() { - ArrayList definitions = new ArrayList(); - this.addSpecifiedJavaAttributeMappingDefinitionsTo(definitions); - return definitions; - } - - /** - * To the specified list, add mapping definitions to use for analyzing the - * specified mapping of an attribute given all annotations on it. The order - * is important, as once a mapping definition tests positive for an - * attribute, all following mapping definitions are ignored. - */ - protected abstract void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList definitions); - - - // ********** resource definitions ********** - - public synchronized Iterable getResourceDefinitions() { - if (this.resourceDefinitions == null) { - this.resourceDefinitions = this.buildResourceDefinitions(); - } - return this.resourceDefinitions; - } - - protected ArrayList buildResourceDefinitions() { - ArrayList definitions = new ArrayList(); - this.addResourceDefinitionsTo(definitions); - return definitions; - } - - protected abstract void addResourceDefinitionsTo(ArrayList definitions); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java deleted file mode 100644 index aea481dfcd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/AbstractJpaProject.java +++ /dev/null @@ -1,1955 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import java.util.ArrayList; -import java.util.Collections; -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import java.util.Vector; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceDelta; -import org.eclipse.core.resources.IResourceDeltaVisitor; -import org.eclipse.core.resources.IResourceProxy; -import org.eclipse.core.resources.IResourceProxyVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Status; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jdt.core.ElementChangedEvent; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaElementDelta; -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.jpt.common.core.JptResourceModel; -import org.eclipse.jpt.common.core.JptResourceModelListener; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.internal.utility.PlatformTools; -import org.eclipse.jpt.common.core.resource.ResourceLocator; -import org.eclipse.jpt.common.utility.Command; -import org.eclipse.jpt.common.utility.CommandExecutor; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.BitTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.ThreadLocalCommandExecutor; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.common.utility.internal.synchronizers.CallbackSynchronousSynchronizer; -import org.eclipse.jpt.common.utility.internal.synchronizers.SynchronousSynchronizer; -import org.eclipse.jpt.common.utility.synchronizers.CallbackSynchronizer; -import org.eclipse.jpt.common.utility.synchronizers.Synchronizer; -import org.eclipse.jpt.jpa.core.JpaDataSource; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaFile; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.JpaRootContextNode; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPersistentTypeCache; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTypeCompilationUnit; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.JpaRootContextNode2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JavaResourcePersistentType2_0; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageInfoCompilationUnit; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentTypeCache; -import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.ConnectionProfile; -import org.eclipse.jpt.jpa.db.Database; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; -import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderFramework; -import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException; -import org.eclipse.wst.common.internal.emfworkbench.WorkbenchResourceHelper; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * JPA project. Holds all the JPA stuff. - * - * The JPA platform provides the hooks for vendor-specific stuff. - * - * The JPA files are the "resource" model (i.e. objects that correspond directly - * to Eclipse resources; e.g. Java source code files, XML files, JAR files). - * - * The root context node is the "context"model (i.e. objects that attempt to - * model the JPA spec, using the "resource" model as an adapter to the Eclipse - * resources). - * - * The data source is an adapter to the DTP meta-data model. - */ -public abstract class AbstractJpaProject - extends AbstractJpaNode - implements JpaProject2_0 -{ - /** - * The Eclipse project corresponding to the JPA project. - */ - protected final IProject project; - - /** - * The vendor-specific JPA platform that builds the JPA project - * and all its contents. - */ - protected final JpaPlatform jpaPlatform; - - /** - * The JPA files associated with the JPA project: - * persistence.xml - * orm.xml - * java - */ - protected final Vector jpaFiles = new Vector(); - - /** - * The "external" Java resource compilation units (source). Populated upon demand. - */ - protected final Vector externalJavaResourceCompilationUnits = new Vector(); - - /** - * The "external" Java resource persistent types (binary). Populated upon demand. - */ - protected final JavaResourcePersistentTypeCache externalJavaResourcePersistentTypeCache; - - /** - * Resource models notify this listener when they change. A project update - * should occur any time a resource model changes. - */ - protected final JptResourceModelListener resourceModelListener; - - /** - * The root of the model representing the collated resources associated with - * the JPA project. - */ - protected final JpaRootContextNode rootContextNode; - - /** - * A pluggable synchronizer that keeps the JPA - * project's context model synchronized with its resource model, either - * synchronously or asynchronously (or not at all). A synchronous synchronizer - * is the default. For performance reasons, a UI should - * immediately change this to an asynchronous synchronizer. A synchronous - * synchronizer can be used when the project is being manipulated by a "batch" - * (or non-UI) client (e.g. when testing "synchronization"). A null updater - * can used during tests that do not care whether "synchronization" occur. - * Clients will need to explicitly configure the synchronizer if they require - * an asynchronous synchronizer. - */ - protected volatile Synchronizer contextModelSynchronizer; - protected volatile boolean synchronizingContextModel = false; - - /** - * A pluggable synchronizer that "updates" the JPA project, either - * synchronously or asynchronously (or not at all). A synchronous updater - * is the default, allowing a newly-constructed JPA project to be "updated" - * upon return from the constructor. For performance reasons, a UI should - * immediately change this to an asynchronous updater. A synchronous - * updater can be used when the project is being manipulated by a "batch" - * (or non-UI) client (e.g. when testing the "update" behavior). A null - * updater can used during tests that do not care whether "synchronization" - * occur. - * Clients will need to explicitly configure the updater if they require - * an asynchronous updater. - */ - protected volatile CallbackSynchronizer updateSynchronizer; - protected final CallbackSynchronizer.Listener updateSynchronizerListener; - - /** - * The data source that wraps the DTP model. - */ - // TODO move to persistence unit... :-( - protected final JpaDataSource dataSource; - - /** - * A catalog name used to override the connection's default catalog. - */ - protected volatile String userOverrideDefaultCatalog; - - /** - * A schema name used to override the connection's default schema. - */ - protected volatile String userOverrideDefaultSchema; - - /** - * Flag indicating whether the project should "discover" annotated - * classes automatically, as opposed to requiring the classes to be - * listed in persistence.xml. Stored as a preference. - * @see #setDiscoversAnnotatedClasses(boolean) - */ - protected volatile boolean discoversAnnotatedClasses; - - /** - * Support for modifying documents shared with the UI. - */ - protected final ThreadLocalCommandExecutor modifySharedDocumentCommandExecutor; - - /** - * The name of the Java project source folder that holds the generated - * metamodel. If the name is null the metamodel is not - * generated. - */ - protected volatile String metamodelSourceFolderName; - - - // ********** constructor/initialization ********** - - protected AbstractJpaProject(JpaProject.Config config) { - super(null); // JPA project is the root of the containment tree - if ((config.getProject() == null) || (config.getJpaPlatform() == null)) { - throw new NullPointerException(); - } - this.project = config.getProject(); - this.jpaPlatform = config.getJpaPlatform(); - this.dataSource = this.getJpaFactory().buildJpaDataSource(this, config.getConnectionProfileName()); - this.userOverrideDefaultCatalog = config.getUserOverrideDefaultCatalog(); - this.userOverrideDefaultSchema = config.getUserOverrideDefaultSchema(); - this.discoversAnnotatedClasses = config.discoverAnnotatedClasses(); - - this.modifySharedDocumentCommandExecutor = this.buildModifySharedDocumentCommandExecutor(); - - this.resourceModelListener = this.buildResourceModelListener(); - // build the JPA files corresponding to the Eclipse project's files - InitialResourceProxyVisitor visitor = this.buildInitialResourceProxyVisitor(); - visitor.visitProject(this.project); - - this.externalJavaResourcePersistentTypeCache = this.buildExternalJavaResourcePersistentTypeCache(); - - if (this.isJpa2_0Compatible()) { - this.metamodelSourceFolderName = ((JpaProject2_0.Config) config).getMetamodelSourceFolderName(); - if (this.metamodelSoureFolderNameIsInvalid()) { - this.metamodelSourceFolderName = null; - } - } - - this.rootContextNode = this.buildRootContextNode(); - - // there *shouldn't* be any changes to the resource model... - this.setContextModelSynchronizer_(this.buildSynchronousContextModelSynchronizer()); - - this.updateSynchronizerListener = this.buildUpdateSynchronizerListener(); - // "update" the project before returning - this.setUpdateSynchronizer_(this.buildSynchronousUpdateSynchronizer()); - - // start listening to this cache once the context model has been built - // and all the external types are faulted in - this.externalJavaResourcePersistentTypeCache.addResourceModelListener(this.resourceModelListener); - } - - @Override - protected boolean requiresParent() { - return false; - } - - @Override - public IResource getResource() { - return this.project; - } - - protected JavaResourcePersistentTypeCache buildExternalJavaResourcePersistentTypeCache() { - return new BinaryPersistentTypeCache(this.jpaPlatform.getAnnotationProvider()); - } - - protected JpaRootContextNode buildRootContextNode() { - return this.getJpaFactory().buildRootContextNode(this); - } - - - // ********** initial resource proxy visitor ********** - - protected InitialResourceProxyVisitor buildInitialResourceProxyVisitor() { - return new InitialResourceProxyVisitor(); - } - - protected class InitialResourceProxyVisitor implements IResourceProxyVisitor { - protected InitialResourceProxyVisitor() { - super(); - } - protected void visitProject(IProject p) { - try { - p.accept(this, IResource.NONE); - } catch (CoreException ex) { - // shouldn't happen - we don't throw any CoreExceptions - throw new RuntimeException(ex); - } - } - // add a JPA file for every [appropriate] file encountered by the visitor - public boolean visit(IResourceProxy resource) { - switch (resource.getType()) { - case IResource.ROOT : // shouldn't happen - return true; // visit children - case IResource.PROJECT : - return true; // visit children - case IResource.FOLDER : - return true; // visit children - case IResource.FILE : - AbstractJpaProject.this.addJpaFile_((IFile) resource.requestResource()); - return false; // no children - default : - return false; // no children - } - } - } - - - // ********** misc ********** - - /** - * Ignore changes to this collection. Adds can be ignored since they are triggered - * by requests that will, themselves, trigger updates (typically during the - * update of an object that calls a setter with the newly-created resource - * type). Deletes will be accompanied by manual updates. - */ - @Override - protected void addNonUpdateAspectNamesTo(Set nonUpdateAspectNames) { - super.addNonUpdateAspectNamesTo(nonUpdateAspectNames); - nonUpdateAspectNames.add(EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION); - } - - - // ********** general queries ********** - - @Override - public JpaProject getJpaProject() { - return this; - } - - public String getName() { - return this.project.getName(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getName()); - } - - public IProject getProject() { - return this.project; - } - - public IJavaProject getJavaProject() { - return JavaCore.create(this.project); - } - - @Override - public JpaPlatform getJpaPlatform() { - return this.jpaPlatform; - } - - @SuppressWarnings("unchecked") - protected Iterable getCombinedJavaResourceCompilationUnits() { - return new CompositeIterable( - this.getInternalJavaResourceCompilationUnits(), - this.getExternalJavaResourceCompilationUnits() - ); - } - - - // ********** database ********** - - @Override - public JpaDataSource getDataSource() { - return this.dataSource; - } - - public ConnectionProfile getConnectionProfile() { - return this.dataSource.getConnectionProfile(); - } - - /** - * If we don't have a catalog (i.e. we don't even have a default - * catalog), then the database probably does not support catalogs. - */ - public Catalog getDefaultDbCatalog() { - String catalog = this.getDefaultCatalog(); - return (catalog == null) ? null : this.resolveDbCatalog(catalog); - } - - public String getDefaultCatalog() { - String catalog = this.getUserOverrideDefaultCatalog(); - return (catalog != null) ? catalog : this.getDatabaseDefaultCatalog(); - } - - protected String getDatabaseDefaultCatalog() { - Database db = this.getDatabase(); - return (db == null ) ? null : db.getDefaultCatalogIdentifier(); - } - - /** - * If we don't have a catalog (i.e. we don't even have a default catalog), - * then the database probably does not support catalogs; and we need to - * get the schema directly from the database. - */ - public SchemaContainer getDefaultDbSchemaContainer() { - String catalog = this.getDefaultCatalog(); - return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase(); - } - - public Schema getDefaultDbSchema() { - SchemaContainer sc = this.getDefaultDbSchemaContainer(); - return (sc == null) ? null : sc.getSchemaForIdentifier(this.getDefaultSchema()); - } - - public String getDefaultSchema() { - String schema = this.getUserOverrideDefaultSchema(); - if (schema != null) { - return schema; - } - - String catalog = this.getDefaultCatalog(); - if (catalog == null) { - // if there is no default catalog (either user-override or database-determined), - // the database probably does not support catalogs; - // return the database's default schema - return this.getDatabaseDefaultSchema(); - } - - Catalog dbCatalog = this.resolveDbCatalog(catalog); - if (dbCatalog != null) { - return dbCatalog.getDefaultSchemaIdentifier(); - } - - // if we could not find a catalog on the database that matches the default - // catalog name, return the database's default schema(?) - hmmm - return this.getDatabaseDefaultSchema(); - } - - protected String getDatabaseDefaultSchema() { - Database db = this.getDatabase(); - return (db == null ) ? null : db.getDefaultSchemaIdentifier(); - } - - - // ********** user override default catalog ********** - - public String getUserOverrideDefaultCatalog() { - return this.userOverrideDefaultCatalog; - } - - public void setUserOverrideDefaultCatalog(String catalog) { - String old = this.userOverrideDefaultCatalog; - this.userOverrideDefaultCatalog = catalog; - JptJpaCorePlugin.setUserOverrideDefaultCatalog(this.project, catalog); - this.firePropertyChanged(USER_OVERRIDE_DEFAULT_CATALOG_PROPERTY, old, catalog); - } - - - // ********** user override default schema ********** - - public String getUserOverrideDefaultSchema() { - return this.userOverrideDefaultSchema; - } - - public void setUserOverrideDefaultSchema(String schema) { - String old = this.userOverrideDefaultSchema; - this.userOverrideDefaultSchema = schema; - JptJpaCorePlugin.setUserOverrideDefaultSchema(this.project, schema); - this.firePropertyChanged(USER_OVERRIDE_DEFAULT_SCHEMA_PROPERTY, old, schema); - } - - - // ********** discover annotated classes ********** - - public boolean discoversAnnotatedClasses() { - return this.discoversAnnotatedClasses; - } - - public void setDiscoversAnnotatedClasses(boolean discoversAnnotatedClasses) { - boolean old = this.discoversAnnotatedClasses; - this.discoversAnnotatedClasses = discoversAnnotatedClasses; - JptJpaCorePlugin.setDiscoverAnnotatedClasses(this.project, discoversAnnotatedClasses); - this.firePropertyChanged(DISCOVERS_ANNOTATED_CLASSES_PROPERTY, old, discoversAnnotatedClasses); - } - - - // ********** JPA files ********** - - public Iterator jpaFiles() { - return this.getJpaFiles().iterator(); - } - - protected Iterable getJpaFiles() { - return new LiveCloneIterable(this.jpaFiles); // read-only - } - - public int jpaFilesSize() { - return this.jpaFiles.size(); - } - - protected Iterable getJpaFiles(final IContentType contentType) { - return new FilteringIterable(this.getJpaFiles()) { - @Override - protected boolean accept(JpaFile jpaFile) { - return jpaFile.getContentType().isKindOf(contentType); - } - }; - } - - @Override - public JpaFile getJpaFile(IFile file) { - for (JpaFile jpaFile : this.getJpaFiles()) { - if (jpaFile.getFile().equals(file)) { - return jpaFile; - } - } - return null; - } - - /** - * Add a JPA file for the specified file, if appropriate. - * Return true if a JPA File was created and added, false otherwise - */ - protected boolean addJpaFile(IFile file) { - JpaFile jpaFile = this.addJpaFile_(file); - if (jpaFile != null) { - this.fireItemAdded(JPA_FILES_COLLECTION, jpaFile); - return true; - } - return false; - } - - /** - * Add a JPA file for the specified file, if appropriate, without firing - * an event; useful during construction. - * Return the new JPA file, null if it was not created. - */ - protected JpaFile addJpaFile_(IFile file) { - if (this.fileIsJavaRelated(file)) { - if ( ! this.getJavaProject().isOnClasspath(file)) { - return null; // java-related files must be on the Java classpath - } - } - else if ( ! this.fileResourceLocationIsValid(file)) { - return null; - } - - JpaFile jpaFile = this.buildJpaFile(file); - if (jpaFile == null) { - return null; - } - jpaFile.getResourceModel().addResourceModelListener(this.resourceModelListener); - this.jpaFiles.add(jpaFile); - return jpaFile; - } - - /** - * .java or .jar - */ - protected boolean fileIsJavaRelated(IFile file) { - IContentType contentType = PlatformTools.getContentType(file); - return (contentType != null) && this.contentTypeIsJavaRelated(contentType); - } - - /** - * pre-condition: content type is not null - */ - protected boolean contentTypeIsJavaRelated(IContentType contentType) { - return contentType.isKindOf(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE) || - contentType.isKindOf(JptCommonCorePlugin.JAR_CONTENT_TYPE); - } - - protected boolean fileResourceLocationIsValid(IFile file) { - ResourceLocator resourceLocator = JptCommonCorePlugin.getResourceLocator(this.getProject()); - return resourceLocator.acceptResourceLocation(this.getProject(), file.getParent()); - } - - /** - * Log any developer exceptions and don't build a JPA file rather - * than completely failing to build the JPA Project. - */ - protected JpaFile buildJpaFile(IFile file) { - try { - return this.getJpaPlatform().buildJpaFile(this, file); - } catch (Exception ex) { - JptJpaCorePlugin.log(ex); - return null; - } - } - - /** - * Remove the JPA file corresponding to the specified IFile, if it exists. - * Return true if a JPA File was removed, false otherwise - */ - protected boolean removeJpaFile(IFile file) { - JpaFile jpaFile = this.getJpaFile(file); - if (jpaFile != null) { // a JpaFile is not added for every IFile - this.removeJpaFile(jpaFile); - return true; - } - return false; - } - - /** - * Stop listening to the JPA file and remove it. - */ - protected void removeJpaFile(JpaFile jpaFile) { - jpaFile.getResourceModel().removeResourceModelListener(this.resourceModelListener); - if ( ! this.removeItemFromCollection(jpaFile, this.jpaFiles, JPA_FILES_COLLECTION)) { - throw new IllegalArgumentException(jpaFile.toString()); - } - } - - - // ********** external Java resource persistent types (source or binary) ********** - - protected JavaResourcePersistentType buildPersistableExternalJavaResourcePersistentType(String typeName) { - IType jdtType = this.findType(typeName); - return (jdtType == null) ? null : this.buildPersistableExternalJavaResourcePersistentType(jdtType); - } - - protected IType findType(String typeName) { - try { - return this.getJavaProject().findType(typeName); - } catch (JavaModelException ex) { - return null; // ignore exception? - } - } - - protected JavaResourcePersistentType buildPersistableExternalJavaResourcePersistentType(IType jdtType) { - JavaResourcePersistentType jrpt = this.buildExternalJavaResourcePersistentType(jdtType); - return ((jrpt != null) && jrpt.isPersistable()) ? jrpt : null; - } - - protected JavaResourcePersistentType buildExternalJavaResourcePersistentType(IType jdtType) { - return jdtType.isBinary() ? - this.buildBinaryExternalJavaResourcePersistentType(jdtType) : - this.buildSourceExternalJavaResourcePersistentType(jdtType); - } - - protected JavaResourcePersistentType buildBinaryExternalJavaResourcePersistentType(IType jdtType) { - return this.externalJavaResourcePersistentTypeCache.addPersistentType(jdtType); - } - - protected JavaResourcePersistentType buildSourceExternalJavaResourcePersistentType(IType jdtType) { - JavaResourceCompilationUnit jrcu = this.getExternalJavaResourceCompilationUnit(jdtType.getCompilationUnit()); - String jdtTypeName = jdtType.getFullyQualifiedName('.'); // JDT member type names use '$' - for (Iterator stream = jrcu.persistentTypes(); stream.hasNext(); ) { - JavaResourcePersistentType jrpt = stream.next(); - if (jrpt.getQualifiedName().equals(jdtTypeName)) { - return jrpt; - } - } - // we can get here if the project JRE is removed; - // see SourceCompilationUnit#getPrimaryType(CompilationUnit) - // bug 225332 - return null; - } - - - // ********** external Java resource persistent types (binary) ********** - - public JavaResourcePersistentTypeCache getExternalJavaResourcePersistentTypeCache() { - return this.externalJavaResourcePersistentTypeCache; - } - - - // ********** external Java resource compilation units (source) ********** - - public Iterator externalJavaResourceCompilationUnits() { - return this.getExternalJavaResourceCompilationUnits().iterator(); - } - - protected Iterable getExternalJavaResourceCompilationUnits() { - return new LiveCloneIterable(this.externalJavaResourceCompilationUnits); // read-only - } - - public int externalJavaResourceCompilationUnitsSize() { - return this.externalJavaResourceCompilationUnits.size(); - } - - /** - * Return the resource model compilation unit corresponding to the specified - * JDT compilation unit. If it does not exist, build it. - */ - protected JavaResourceCompilationUnit getExternalJavaResourceCompilationUnit(ICompilationUnit jdtCompilationUnit) { - for (JavaResourceCompilationUnit jrcu : this.getExternalJavaResourceCompilationUnits()) { - if (jrcu.getCompilationUnit().equals(jdtCompilationUnit)) { - // we will get here if the JRCU could not build its persistent type... - return jrcu; - } - } - return this.addExternalJavaResourceCompilationUnit(jdtCompilationUnit); - } - - /** - * Add an external Java resource compilation unit. - */ - protected JavaResourceCompilationUnit addExternalJavaResourceCompilationUnit(ICompilationUnit jdtCompilationUnit) { - JavaResourceCompilationUnit jrcu = this.buildJavaResourceCompilationUnit(jdtCompilationUnit); - this.addItemToCollection(jrcu, this.externalJavaResourceCompilationUnits, EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION); - jrcu.addResourceModelListener(this.resourceModelListener); - return jrcu; - } - - protected JavaResourceCompilationUnit buildJavaResourceCompilationUnit(ICompilationUnit jdtCompilationUnit) { - return new SourceTypeCompilationUnit( - jdtCompilationUnit, - this.jpaPlatform.getAnnotationProvider(), - this.jpaPlatform.getAnnotationEditFormatter(), - this.modifySharedDocumentCommandExecutor - ); - } - - protected boolean removeExternalJavaResourceCompilationUnit(IFile file) { - for (JavaResourceCompilationUnit jrcu : this.getExternalJavaResourceCompilationUnits()) { - if (jrcu.getFile().equals(file)) { - this.removeExternalJavaResourceCompilationUnit(jrcu); - return true; - } - } - return false; - } - - protected void removeExternalJavaResourceCompilationUnit(JavaResourceCompilationUnit jrcu) { - jrcu.removeResourceModelListener(this.resourceModelListener); - this.removeItemFromCollection(jrcu, this.externalJavaResourceCompilationUnits, EXTERNAL_JAVA_RESOURCE_COMPILATION_UNITS_COLLECTION); - } - - - // ********** context model ********** - - public JpaRootContextNode getRootContextNode() { - return this.rootContextNode; - } - - - // ********** utility ********** - - public IFile getPlatformFile(IPath runtimePath) { - return JptCommonCorePlugin.getPlatformFile(this.project, runtimePath); - } - - - // ********** XML files ********** - - public JpaXmlResource getPersistenceXmlResource() { - return (JpaXmlResource) this.getResourceModel( - JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH, - JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE - ); - } - - public JpaXmlResource getDefaultOrmXmlResource() { - return this.getMappingFileXmlResource(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH); - } - - public JpaXmlResource getMappingFileXmlResource(IPath runtimePath) { - return (JpaXmlResource) this.getResourceModel(runtimePath, JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE); - } - - /** - * If the specified file exists, is significant to the JPA project, and its - * content is a "kind of" the specified content type, return the JPA - * resource model corresponding to the file; otherwise, return null. - */ - protected JptResourceModel getResourceModel(IPath runtimePath, IContentType contentType) { - IFile file = this.getPlatformFile(runtimePath); - return (file != null && file.exists()) ? this.getResourceModel(file, contentType) : null; - } - - /** - * If the specified file is significant to the JPA project and its content - * is a "kind of" the specified content type, return the JPA resource model - * corresponding to the file; otherwise, return null. - */ - protected JptResourceModel getResourceModel(IFile file, IContentType contentType) { - JpaFile jpaFile = this.getJpaFile(file); - return (jpaFile == null) ? null : jpaFile.getResourceModel(contentType); - } - - - // ********** annotated Java source classes ********** - - public Iterator annotatedJavaSourceClassNames() { - return this.getAnnotatedJavaSourceClassNames().iterator(); - } - - protected Iterable getAnnotatedJavaSourceClassNames() { - return new TransformationIterable(this.getInternalAnnotatedSourceJavaResourcePersistentTypes()) { - @Override - protected String transform(JavaResourcePersistentType jrpType) { - return jrpType.getQualifiedName(); - } - }; - } - - /** - * Return only those valid annotated Java resource persistent types that are - * directly part of the JPA project, ignoring those in JARs referenced in - * persistence.xml. - * @see org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools#typeIsPersistable(org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools.TypeAdapter) - */ - protected Iterable getInternalAnnotatedSourceJavaResourcePersistentTypes() { - return new FilteringIterable(this.getInternalSourceJavaResourcePersistentTypes()) { - @Override - protected boolean accept(JavaResourcePersistentType jrpType) { - return jrpType.isPersistable() && jrpType.isAnnotated(); // i.e. the type is valid and has a valid type annotation - } - }; - } - - /** - * Return only the names of those valid mapped (i.e. annotated with - * @Entity, @Embeddable, etc.) Java resource - * persistent types that are directly part of the JPA project, ignoring - * those in JARs referenced in persistence.xml. - */ - public Iterable getMappedJavaSourceClassNames() { - return new TransformationIterable(this.getInternalMappedSourceJavaResourcePersistentTypes()) { - @Override - protected String transform(JavaResourcePersistentType jrpType) { - return jrpType.getQualifiedName(); - } - }; - } - - /** - * Return only those valid mapped (i.e. annotated with - * @Entity, @Embeddable, etc.) Java resource - * persistent types that are directly part of the JPA project, ignoring - * those in JARs referenced in persistence.xml. - */ - protected Iterable getInternalMappedSourceJavaResourcePersistentTypes() { - return new FilteringIterable(this.getInternalAnnotatedSourceJavaResourcePersistentTypes()) { - @Override - protected boolean accept(JavaResourcePersistentType jrpType) { - return jrpType.isMapped(); // i.e. the type is already persistable and annotated - } - }; - } - - /** - * Return only those Java resource persistent types that are directly - * part of the JPA project, ignoring those in JARs referenced in - * persistence.xml - */ - protected Iterable getInternalSourceJavaResourcePersistentTypes2_0() { - return new SubIterableWrapper(this.getInternalSourceJavaResourcePersistentTypes()); - } - - /** - * Return only those Java resource persistent types that are directly - * part of the JPA project, ignoring those in JARs referenced in - * persistence.xml - */ - protected Iterable getInternalSourceJavaResourcePersistentTypes() { - return new CompositeIterable(this.getInternalSourceJavaResourcePersistentTypeLists()); - } - - /** - * Return only those Java resource persistent types that are directly - * part of the JPA project, ignoring those in JARs referenced in - * persistence.xml - */ - protected Iterable> getInternalSourceJavaResourcePersistentTypeLists() { - return new TransformationIterable>(this.getInternalJavaResourceCompilationUnits()) { - @Override - protected Iterable transform(final JavaResourceCompilationUnit compilationUnit) { - return new Iterable() { - public Iterator iterator() { - return compilationUnit.persistentTypes(); // *all* the types in the compilation unit - } - }; - } - }; - } - - /** - * Return the JPA project's resource compilation units. - */ - protected Iterable getInternalJavaResourceCompilationUnits() { - return new TransformationIterable(this.getJavaSourceJpaFiles()) { - @Override - protected JavaResourceCompilationUnit transform(JpaFile jpaFile) { - return (JavaResourceCompilationUnit) jpaFile.getResourceModel(); - } - }; - } - - /** - * Return the JPA project's JPA files with Java source content. - */ - protected Iterable getJavaSourceJpaFiles() { - return this.getJpaFiles(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE); - } - - - // ********** Java resource persistent type look-up ********** - - public JavaResourcePersistentType getJavaResourcePersistentType(String typeName) { - for (JavaResourcePersistentType jrpType : this.getPersistableJavaResourcePersistentTypes()) { - if (jrpType.getQualifiedName().equals(typeName)) { - return jrpType; - } - } - // if we don't have a type already, try to build new one from the project classpath - return this.buildPersistableExternalJavaResourcePersistentType(typeName); - } - - /** - * return *all* the "persistable" Java resource persistent types, including those in JARs referenced in - * persistence.xml - * @see org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools#typeIsPersistable(org.eclipse.jpt.common.core.internal.utility.jdt.JPTTools.TypeAdapter) - */ - protected Iterable getPersistableJavaResourcePersistentTypes() { - return new FilteringIterable(this.getJavaResourcePersistentTypes()) { - @Override - protected boolean accept(JavaResourcePersistentType jrpType) { - return jrpType.isPersistable(); - } - }; - } - - /** - * return *all* the Java resource persistent types, including those in JARs referenced in - * persistence.xml - */ - protected Iterable getJavaResourcePersistentTypes() { - return new CompositeIterable(this.getJavaResourcePersistentTypeSets()); - } - - /** - * return *all* the Java resource persistent types, including those in JARs referenced in - * persistence.xml - */ - protected Iterable> getJavaResourcePersistentTypeSets() { - return new TransformationIterable>(this.getJavaResourceNodeRoots()) { - @Override - protected Iterable transform(final JavaResourceNode.Root root) { - return new Iterable() { - public Iterator iterator() { - return root.persistentTypes(); // *all* the types held by the root - } - }; - } - }; - } - - @SuppressWarnings("unchecked") - protected Iterable getJavaResourceNodeRoots() { - return new CompositeIterable( - this.getInternalJavaResourceCompilationUnits(), - this.getInternalJavaResourcePackageFragmentRoots(), - this.getExternalJavaResourceCompilationUnits(), - Collections.singleton(this.externalJavaResourcePersistentTypeCache) - ); - } - - - // ********** Java resource persistent package look-up ********** - - public JavaResourcePackage getJavaResourcePackage(String packageName) { - for (JavaResourcePackage jrp : this.getJavaResourcePackages()) { - if (jrp.getName().equals(packageName)) { - return jrp; - } - } - return null; - } - - public Iterable getJavaResourcePackages(){ - return new FilteringIterable( - new TransformationIterable(this.getPackageInfoSourceJpaFiles()) { - @Override - protected JavaResourcePackage transform(JpaFile jpaFile) { - return ((JavaResourcePackageInfoCompilationUnit) jpaFile.getResourceModel()).getPackage(); - } - }) - { - @Override - protected boolean accept(JavaResourcePackage packageInfo) { - return packageInfo != null; - } - }; - } - - /** - * return JPA files with package-info source "content" - */ - protected Iterable getPackageInfoSourceJpaFiles() { - return this.getJpaFiles(JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE); - } - - - // ********** JARs ********** - - // TODO - public JavaResourcePackageFragmentRoot getJavaResourcePackageFragmentRoot(String jarFileName) { -// return this.getJarResourcePackageFragmentRoot(this.convertToPlatformFile(jarFileName)); - return this.getJavaResourcePackageFragmentRoot(this.getProject().getFile(jarFileName)); - } - - protected JavaResourcePackageFragmentRoot getJavaResourcePackageFragmentRoot(IFile jarFile) { - for (JavaResourcePackageFragmentRoot pfr : this.getInternalJavaResourcePackageFragmentRoots()) { - if (pfr.getFile().equals(jarFile)) { - return pfr; - } - } - return null; - } - - protected Iterable getInternalJavaResourcePackageFragmentRoots() { - return new TransformationIterable(this.getJarJpaFiles()) { - @Override - protected JavaResourcePackageFragmentRoot transform(JpaFile jpaFile) { - return (JavaResourcePackageFragmentRoot) jpaFile.getResourceModel(); - } - }; - } - - /** - * return JPA files with JAR "content" - */ - public Iterable getJarJpaFiles() { - return this.getJpaFiles(JptCommonCorePlugin.JAR_CONTENT_TYPE); - } - - - // ********** metamodel ********** - - public Iterable getGeneratedMetamodelTopLevelTypes() { - if (this.metamodelSourceFolderName == null) { - return EmptyIterable.instance(); - } - final IPackageFragmentRoot genSourceFolder = this.getMetamodelPackageFragmentRoot(); - return new FilteringIterable(this.getInternalSourceJavaResourcePersistentTypes2_0()) { - @Override - protected boolean accept(JavaResourcePersistentType2_0 jrpt) { - return jrpt.isGeneratedMetamodelTopLevelType(genSourceFolder); - } - }; - } - - public JavaResourcePersistentType2_0 getGeneratedMetamodelTopLevelType(IFile file) { - JavaResourceCompilationUnit jrcu = this.getJavaResourceCompilationUnit(file); - if (jrcu == null) { - return null; // hmmm... - } - // TODO add API to JRCU to get top-level persistent type - Iterator types = jrcu.persistentTypes(); - if ( ! types.hasNext()) { - return null; // no types in the file - } - JavaResourcePersistentType2_0 jrpt = (JavaResourcePersistentType2_0) types.next(); - return jrpt.isGeneratedMetamodelTopLevelType() ? jrpt : null; - } - - protected JavaResourceCompilationUnit getJavaResourceCompilationUnit(IFile file) { - return (JavaResourceCompilationUnit) this.getResourceModel(file, JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE); - } - - public String getMetamodelSourceFolderName() { - return this.metamodelSourceFolderName; - } - - public void setMetamodelSourceFolderName(String folderName) { - if (this.setMetamodelSourceFolderName_(folderName)) { - JptJpaCorePlugin.setMetamodelSourceFolderName(this.project, folderName); - if (folderName == null) { - this.disposeMetamodel(); - } else { - this.initializeMetamodel(); - } - } - } - - protected boolean setMetamodelSourceFolderName_(String folderName) { - String old = this.metamodelSourceFolderName; - this.metamodelSourceFolderName = folderName; - return this.firePropertyChanged(METAMODEL_SOURCE_FOLDER_NAME_PROPERTY, old, folderName); - } - - public void initializeMetamodel() { - if (this.isJpa2_0Compatible()) { - ((JpaRootContextNode2_0) this.rootContextNode).initializeMetamodel(); - } - } - - /** - * Synchronize the metamodel for 2.0-compatible JPA projects. - */ - public void synchronizeMetamodel() { - if (this.isJpa2_0Compatible()) { - if (this.metamodelSourceFolderName != null) { - ((JpaRootContextNode2_0) this.rootContextNode).synchronizeMetamodel(); - } - } - } - - public void disposeMetamodel() { - if (this.isJpa2_0Compatible()) { - ((JpaRootContextNode2_0) this.rootContextNode).disposeMetamodel(); - } - } - - public IPackageFragmentRoot getMetamodelPackageFragmentRoot() { - return this.getJavaProject().getPackageFragmentRoot(this.getMetaModelSourceFolder()); - } - - protected IFolder getMetaModelSourceFolder() { - return this.getProject().getFolder(this.metamodelSourceFolderName); - } - - /** - * If the metamodel source folder is no longer a Java project source - * folder, clear it out. - */ - protected void checkMetamodelSourceFolderName() { - if (this.metamodelSoureFolderNameIsInvalid()) { - this.setMetamodelSourceFolderName(null); - } - } - - protected boolean metamodelSoureFolderNameIsInvalid() { - return ! this.metamodelSourceFolderNameIsValid(); - } - - protected boolean metamodelSourceFolderNameIsValid() { - return CollectionTools.contains(this.getJavaSourceFolderNames(), this.metamodelSourceFolderName); - } - - - // ********** Java source folder names ********** - - public Iterable getJavaSourceFolderNames() { - try { - return this.getJavaSourceFolderNames_(); - } catch (JavaModelException ex) { - JptJpaCorePlugin.log(ex); - return EmptyIterable.instance(); - } - } - - protected Iterable getJavaSourceFolderNames_() throws JavaModelException { - return new TransformationIterable(this.getJavaSourceFolders()) { - @Override - protected String transform(IPackageFragmentRoot pfr) { - try { - return this.transform_(pfr); - } catch (JavaModelException ex) { - return "Error: " + pfr.getPath(); //$NON-NLS-1$ - } - } - private String transform_(IPackageFragmentRoot pfr) throws JavaModelException { - return pfr.getUnderlyingResource().getProjectRelativePath().toString(); - } - }; - } - - protected Iterable getJavaSourceFolders() throws JavaModelException { - return new FilteringIterable( - this.getPackageFragmentRoots(), - SOURCE_PACKAGE_FRAGMENT_ROOT_FILTER - ); - } - - protected static final Filter SOURCE_PACKAGE_FRAGMENT_ROOT_FILTER = - new Filter() { - public boolean accept(IPackageFragmentRoot pfr) { - try { - return this.accept_(pfr); - } catch (JavaModelException ex) { - return false; - } - } - private boolean accept_(IPackageFragmentRoot pfr) throws JavaModelException { - return pfr.exists() && (pfr.getKind() == IPackageFragmentRoot.K_SOURCE); - } - }; - - protected Iterable getPackageFragmentRoots() throws JavaModelException { - return new ArrayIterable(this.getJavaProject().getPackageFragmentRoots()); - } - - - // ********** Java events ********** - - // TODO handle changes to external projects - public void javaElementChanged(ElementChangedEvent event) { - this.processJavaDelta(event.getDelta()); - } - - /** - * We recurse back here from {@link #processJavaDeltaChildren(IJavaElementDelta)}. - */ - protected void processJavaDelta(IJavaElementDelta delta) { - switch (delta.getElement().getElementType()) { - case IJavaElement.JAVA_MODEL : - this.processJavaModelDelta(delta); - break; - case IJavaElement.JAVA_PROJECT : - this.processJavaProjectDelta(delta); - break; - case IJavaElement.PACKAGE_FRAGMENT_ROOT : - this.processJavaPackageFragmentRootDelta(delta); - break; - case IJavaElement.PACKAGE_FRAGMENT : - this.processJavaPackageFragmentDelta(delta); - break; - case IJavaElement.COMPILATION_UNIT : - this.processJavaCompilationUnitDelta(delta); - break; - default : - break; // ignore the elements inside a compilation unit - } - } - - protected void processJavaDeltaChildren(IJavaElementDelta delta) { - for (IJavaElementDelta child : delta.getAffectedChildren()) { - this.processJavaDelta(child); // recurse - } - } - - /** - * Return whether the specified Java element delta is for a - * {@link IJavaElementDelta#CHANGED CHANGED} - * (as opposed to {@link IJavaElementDelta#ADDED ADDED} or - * {@link IJavaElementDelta#REMOVED REMOVED}) Java element - * and the specified flag is set. - * (The delta flags are only significant if the delta - * {@link IJavaElementDelta#getKind() kind} is - * {@link IJavaElementDelta#CHANGED CHANGED}.) - */ - protected boolean deltaFlagIsSet(IJavaElementDelta delta, int flag) { - return (delta.getKind() == IJavaElementDelta.CHANGED) && - BitTools.flagIsSet(delta.getFlags(), flag); - } - - // ***** model - protected void processJavaModelDelta(IJavaElementDelta delta) { - // process the Java model's projects - this.processJavaDeltaChildren(delta); - } - - // ***** project - protected void processJavaProjectDelta(IJavaElementDelta delta) { - // process the Java project's package fragment roots - this.processJavaDeltaChildren(delta); - - // a classpath change can have pretty far-reaching effects... - if (this.classpathHasChanged(delta)) { - this.rebuild((IJavaProject) delta.getElement()); - } - } - - /** - * The specified Java project's classpath changed. Rebuild the JPA project - * as appropriate. - */ - protected void rebuild(IJavaProject javaProject) { - // if the classpath has changed, we need to update everything since - // class references could now be resolved (or not) etc. - if (javaProject.equals(this.getJavaProject())) { - this.removeDeadJpaFiles(); - this.checkMetamodelSourceFolderName(); - this.synchronizeWithJavaSource(this.getInternalJavaResourceCompilationUnits()); - } else { - // TODO see if changed project is on our classpath? - this.synchronizeWithJavaSource(this.getExternalJavaResourceCompilationUnits()); - } - } - - /** - * Loop through all our JPA files, remove any that are no longer on the - * classpath. - */ - protected void removeDeadJpaFiles() { - for (JpaFile jpaFile : this.getJpaFiles()) { - if (this.jpaFileIsDead(jpaFile)) { - this.removeJpaFile(jpaFile); - } - } - } - - protected boolean jpaFileIsDead(JpaFile jpaFile) { - return ! this.jpaFileIsAlive(jpaFile); - } - - /** - * Sometimes (e.g. during tests), when a project has been deleted, we get a - * Java change event that indicates the Java project is CHANGED (as - * opposed to REMOVED, which is what typically happens). The event's delta - * indicates that everything in the Java project has been deleted and the - * classpath has changed. All entries in the classpath have been removed; - * but single entry for the Java project's root folder has been added. (!) - * This means any file in the project is on the Java project's classpath. - * This classpath change is what triggers us to rebuild the JPA project; so - * we put an extra check here to make sure the JPA file's resource file is - * still present. - *

- * This would not be a problem if Dali received the resource change event - * before JDT and simply removed the JPA project; but JDT receives - * the resource change event first and converts it into the problematic - * Java change event.... - */ - protected boolean jpaFileIsAlive(JpaFile jpaFile) { - IFile file = jpaFile.getFile(); - return this.getJavaProject().isOnClasspath(file) && - file.exists(); - } - - /** - * pre-condition: - * delta.getElement().getElementType() == IJavaElement.JAVA_PROJECT - */ - protected boolean classpathHasChanged(IJavaElementDelta delta) { - return this.deltaFlagIsSet(delta, IJavaElementDelta.F_RESOLVED_CLASSPATH_CHANGED); - } - - protected void synchronizeWithJavaSource(Iterable javaResourceCompilationUnits) { - for (JavaResourceCompilationUnit javaResourceCompilationUnit : javaResourceCompilationUnits) { - javaResourceCompilationUnit.synchronizeWithJavaSource(); - } - } - - // ***** package fragment root - protected void processJavaPackageFragmentRootDelta(IJavaElementDelta delta) { - // process the Java package fragment root's package fragments - this.processJavaDeltaChildren(delta); - - if (this.classpathEntryHasBeenAdded(delta)) { - // TODO bug 277218 - } else if (this.classpathEntryHasBeenRemoved(delta)) { // should be mutually-exclusive w/added (?) - // TODO bug 277218 - } - } - - /** - * pre-condition: - * delta.getElement().getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT - */ - protected boolean classpathEntryHasBeenAdded(IJavaElementDelta delta) { - return this.deltaFlagIsSet(delta, IJavaElementDelta.F_ADDED_TO_CLASSPATH); - } - - /** - * pre-condition: - * delta.getElement().getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT - */ - protected boolean classpathEntryHasBeenRemoved(IJavaElementDelta delta) { - return this.deltaFlagIsSet(delta, IJavaElementDelta.F_REMOVED_FROM_CLASSPATH); - } - - // ***** package fragment - protected void processJavaPackageFragmentDelta(IJavaElementDelta delta) { - // process the java package fragment's compilation units - this.processJavaDeltaChildren(delta); - } - - // ***** compilation unit - protected void processJavaCompilationUnitDelta(IJavaElementDelta delta) { - if (this.javaCompilationUnitDeltaIsRelevant(delta)) { - ICompilationUnit compilationUnit = (ICompilationUnit) delta.getElement(); - for (JavaResourceCompilationUnit jrcu : this.getCombinedJavaResourceCompilationUnits()) { - if (jrcu.getCompilationUnit().equals(compilationUnit)) { - jrcu.synchronizeWithJavaSource(); - // TODO ? this.resolveJavaTypes(); // might have new member types now... - break; // there *shouldn't* be any more... - } - } - } - // ignore the java compilation unit's children - } - - protected boolean javaCompilationUnitDeltaIsRelevant(IJavaElementDelta delta) { - // ignore changes to/from primary working copy - no content has changed; - // and make sure there are no other flags set that indicate *both* a - // change to/from primary working copy *and* content has changed - if (BitTools.onlyFlagIsSet(delta.getFlags(), IJavaElementDelta.F_PRIMARY_WORKING_COPY)) { - return false; - } - - // ignore java notification for ADDED or REMOVED; - // these are handled via resource notification - return delta.getKind() == IJavaElementDelta.CHANGED; - } - - - // ********** validation ********** - - public Iterator validationMessages(IReporter reporter) { - List messages = new ArrayList(); - this.validate(messages, reporter); - return messages.iterator(); - } - - protected void validate(List messages, IReporter reporter) { - if (reporter.isCancelled()) { - throw new ValidationCancelledException(); - } - this.validateLibraryProvider(messages); - this.validateConnection(messages); - this.rootContextNode.validate(messages, reporter); - } - - protected void validateLibraryProvider(List messages) { - try { - this.validateLibraryProvider_(messages); - } catch (CoreException ex) { - JptJpaCorePlugin.log(ex); - } - } - - protected void validateLibraryProvider_(List messages) throws CoreException { - ILibraryProvider libraryProvider = LibraryProviderFramework.getCurrentProvider(getProject(), JpaFacet.FACET); - IFacetedProject facetedProject = ProjectFacetsManager.create(getProject()); - IProjectFacetVersion facetVersion = facetedProject.getInstalledVersion(JpaFacet.FACET); - if ( ! libraryProvider.isEnabledFor(facetedProject, facetVersion)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PROJECT_INVALID_LIBRARY_PROVIDER, - this - ) - ); - } - } - - protected void validateConnection(List messages) { - String cpName = this.dataSource.getConnectionProfileName(); - if (StringTools.stringIsEmpty(cpName)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - JpaValidationMessages.PROJECT_NO_CONNECTION, - this - ) - ); - return; - } - ConnectionProfile cp = this.dataSource.getConnectionProfile(); - if (cp == null) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - JpaValidationMessages.PROJECT_INVALID_CONNECTION, - new String[] {cpName}, - this - ) - ); - return; - } - if (cp.isInactive()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - JpaValidationMessages.PROJECT_INACTIVE_CONNECTION, - new String[] {cpName}, - this - ) - ); - } - } - - - // ********** dispose ********** - - public void dispose() { - this.contextModelSynchronizer.stop(); - this.updateSynchronizer.stop(); - this.updateSynchronizer.removeListener(this.updateSynchronizerListener); - this.dataSource.dispose(); - // the XML resources are held indefinitely by the WTP translator framework, - // so we better remove our listener or the JPA project will not be GCed - for (JpaFile jpaFile : this.getJpaFiles()) { - jpaFile.getResourceModel().removeResourceModelListener(this.resourceModelListener); - } - } - - - // ********** resource model listener ********** - - protected JptResourceModelListener buildResourceModelListener() { - return new DefaultResourceModelListener(); - } - - protected class DefaultResourceModelListener - implements JptResourceModelListener - { - protected DefaultResourceModelListener() { - super(); - } - - public void resourceModelChanged(JptResourceModel jpaResourceModel) { -// String msg = Thread.currentThread() + " resource model change: " + jpaResourceModel; -// System.out.println(msg); -// new Exception(msg).printStackTrace(System.out); - AbstractJpaProject.this.synchronizeContextModel(jpaResourceModel); - } - - public void resourceModelReverted(JptResourceModel jpaResourceModel) { - IFile file = WorkbenchResourceHelper.getFile((JpaXmlResource)jpaResourceModel); - AbstractJpaProject.this.removeJpaFile(file); - AbstractJpaProject.this.addJpaFile(file); - } - - public void resourceModelUnloaded(JptResourceModel jpaResourceModel) { - IFile file = WorkbenchResourceHelper.getFile((JpaXmlResource)jpaResourceModel); - AbstractJpaProject.this.removeJpaFile(file); - } - } - - protected void synchronizeContextModel(@SuppressWarnings("unused") JptResourceModel jpaResourceModel) { - this.synchronizeContextModel(); - } - - - // ********** resource events ********** - - // TODO need to do the same thing for external projects and compilation units - public void projectChanged(IResourceDelta delta) { - if (delta.getResource().equals(this.getProject())) { - this.internalProjectChanged(delta); - } else { - this.externalProjectChanged(delta); - } - } - - protected void internalProjectChanged(IResourceDelta delta) { - if (delta.getKind() == IResourceDelta.REMOVED) { - this.setContextModelSynchronizer(Synchronizer.Null.instance()); - this.setUpdateSynchronizer(CallbackSynchronizer.Null.instance()); - } - ResourceDeltaVisitor resourceDeltaVisitor = this.buildInternalResourceDeltaVisitor(); - resourceDeltaVisitor.visitDelta(delta); - // at this point, if we have added and/or removed JpaFiles, an "update" will have been triggered; - // any changes to the resource model during the "resolve" will trigger further "updates"; - // there should be no need to "resolve" external Java types (they can't have references to - // the internal Java types) - if (resourceDeltaVisitor.encounteredSignificantChange()) { - this.resolveInternalJavaTypes(); - } - } - - protected ResourceDeltaVisitor buildInternalResourceDeltaVisitor() { - return new InternalResourceDeltaVisitor(); - } - - protected class InternalResourceDeltaVisitor extends ResourceDeltaVisitor { - protected InternalResourceDeltaVisitor() { - super(); - } - @Override - public boolean fileChangeIsSignificant(IFile file, int deltaKind) { - return AbstractJpaProject.this.synchronizeJpaFiles(file, deltaKind); - } - } - - /** - * Internal resource delta visitor callback. - * Return true if a JpaFile was either added or removed. - */ - protected boolean synchronizeJpaFiles(IFile file, int deltaKind) { - switch (deltaKind) { - case IResourceDelta.ADDED : - return this.addJpaFile(file); - case IResourceDelta.REMOVED : - return this.removeJpaFile(file); - case IResourceDelta.CHANGED : - return this.checkForChangedFileContent(file); - case IResourceDelta.ADDED_PHANTOM : - break; // ignore - case IResourceDelta.REMOVED_PHANTOM : - break; // ignore - default : - break; // only worried about added/removed/changed files - } - - return false; - } - - protected boolean checkForChangedFileContent(IFile file) { - JpaFile jpaFile = this.getJpaFile(file); - if (jpaFile == null) { - // the file might have changed its content to something that we are interested in - return this.addJpaFile(file); - } - - if (jpaFile.getContentType().equals(PlatformTools.getContentType(file))) { - // content has not changed - ignore - return false; - } - - // the content type changed, we need to build a new JPA file - // (e.g. the schema of an orm.xml file changed from JPA to EclipseLink) - this.removeJpaFile(jpaFile); - this.addJpaFile(file); - return true; // at the least, we have removed a JPA file - } - - protected void resolveInternalJavaTypes() { - for (JavaResourceCompilationUnit jrcu : this.getInternalJavaResourceCompilationUnits()) { - jrcu.resolveTypes(); - } - } - - protected void externalProjectChanged(IResourceDelta delta) { - if (this.getJavaProject().isOnClasspath(delta.getResource())) { - ResourceDeltaVisitor resourceDeltaVisitor = this.buildExternalResourceDeltaVisitor(); - resourceDeltaVisitor.visitDelta(delta); - // force an "update" here since adding and/or removing an external Java type - // will only trigger an "update" if the "resolve" causes something in the resource model to change - if (resourceDeltaVisitor.encounteredSignificantChange()) { - this.update(); - this.resolveExternalJavaTypes(); - this.resolveInternalJavaTypes(); - } - } - } - - protected ResourceDeltaVisitor buildExternalResourceDeltaVisitor() { - return new ExternalResourceDeltaVisitor(); - } - - protected class ExternalResourceDeltaVisitor extends ResourceDeltaVisitor { - protected ExternalResourceDeltaVisitor() { - super(); - } - @Override - public boolean fileChangeIsSignificant(IFile file, int deltaKind) { - return AbstractJpaProject.this.synchronizeExternalFiles(file, deltaKind); - } - } - - /** - * external resource delta visitor callback - * Return true if an "external" Java resource compilation unit - * was added or removed. - */ - protected boolean synchronizeExternalFiles(IFile file, int deltaKind) { - switch (deltaKind) { - case IResourceDelta.ADDED : - return this.externalFileAdded(file); - case IResourceDelta.REMOVED : - return this.externalFileRemoved(file); - case IResourceDelta.CHANGED : - break; // ignore - case IResourceDelta.ADDED_PHANTOM : - break; // ignore - case IResourceDelta.REMOVED_PHANTOM : - break; // ignore - default : - break; // only worried about added/removed/changed files - } - - return false; - } - - protected boolean externalFileAdded(IFile file) { - IContentType contentType = PlatformTools.getContentType(file); - if (contentType == null) { - return false; - } - if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) { - return true; - } - if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) { - return true; - } - return false; - } - - protected boolean externalFileRemoved(IFile file) { - IContentType contentType = PlatformTools.getContentType(file); - if (contentType == null) { - return false; - } - if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) { - return this.removeExternalJavaResourceCompilationUnit(file); - } - if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) { - return this.externalJavaResourcePersistentTypeCache.removePersistentTypes(file); - } - return false; - } - - protected void resolveExternalJavaTypes() { - for (JavaResourceCompilationUnit jrcu : this.getExternalJavaResourceCompilationUnits()) { - jrcu.resolveTypes(); - } - } - - // ***** resource delta visitors - /** - * add or remove a JPA file for every [appropriate] file encountered by the visitor - */ - protected abstract class ResourceDeltaVisitor implements IResourceDeltaVisitor { - protected boolean encounteredSignificantChange = false; - - protected ResourceDeltaVisitor() { - super(); - } - - protected void visitDelta(IResourceDelta delta) { - try { - delta.accept(this); - } catch (CoreException ex) { - // shouldn't happen - we don't throw any CoreExceptions - throw new RuntimeException(ex); - } - } - - public boolean visit(IResourceDelta delta) { - IResource res = delta.getResource(); - switch (res.getType()) { - case IResource.ROOT : - return true; // visit children - case IResource.PROJECT : - return true; // visit children - case IResource.FOLDER : - return true; // visit children - case IResource.FILE : - this.fileChanged((IFile) res, delta.getKind()); - return false; // no children - default : - return false; // no children (probably shouldn't get here...) - } - } - - protected void fileChanged(IFile file, int deltaKind) { - if (this.fileChangeIsSignificant(file, deltaKind)) { - this.encounteredSignificantChange = true; - } - } - - protected abstract boolean fileChangeIsSignificant(IFile file, int deltaKind); - - /** - * Return whether the visitor encountered some sort of "significant" - * change while traversing the IResourceDelta - * (e.g. a JPA file was added or removed). - */ - protected boolean encounteredSignificantChange() { - return this.encounteredSignificantChange; - } - - } - - - // ********** support for modifying documents shared with the UI ********** - - public void setThreadLocalModifySharedDocumentCommandExecutor(CommandExecutor commandExecutor) { - this.modifySharedDocumentCommandExecutor.set(commandExecutor); - } - - public CommandExecutor getModifySharedDocumentCommandExecutor() { - return this.modifySharedDocumentCommandExecutor; - } - - protected ThreadLocalCommandExecutor buildModifySharedDocumentCommandExecutor() { - return new ThreadLocalCommandExecutor(); - } - - - // ********** synchronize context model with resource model ********** - - public Synchronizer getContextModelSynchronizer() { - return this.contextModelSynchronizer; - } - - public void setContextModelSynchronizer(Synchronizer synchronizer) { - if (synchronizer == null) { - throw new NullPointerException(); - } - this.contextModelSynchronizer.stop(); - this.setContextModelSynchronizer_(synchronizer); - } - - protected void setContextModelSynchronizer_(Synchronizer synchronizer) { - this.contextModelSynchronizer = synchronizer; - this.contextModelSynchronizer.start(); - } - - /** - * Delegate to the context model synchronizer so clients can configure how - * synchronizations occur. - */ - public void synchronizeContextModel() { - this.synchronizingContextModel = true; - this.contextModelSynchronizer.synchronize(); - this.synchronizingContextModel = false; - - // There are some changes to the resource model that will not change - // the existing context model and trigger an update (e.g. adding an - // @Entity annotation when the JPA project is automatically - // discovering annotated classes); so we explicitly execute an update - // here to discover those changes. - this.update(); - } - - /** - * Called by the context model synchronizer. - */ - public IStatus synchronizeContextModel(IProgressMonitor monitor) { - this.rootContextNode.synchronizeWithResourceModel(); - return Status.OK_STATUS; - } - - public void synchronizeContextModelAndWait() { - Synchronizer temp = this.contextModelSynchronizer; - this.setContextModelSynchronizer(this.buildSynchronousContextModelSynchronizer()); - this.synchronizeContextModel(); - this.setContextModelSynchronizer(temp); - } - - - // ********** default context model synchronizer (synchronous) ********** - - protected Synchronizer buildSynchronousContextModelSynchronizer() { - return new SynchronousSynchronizer(this.buildSynchronousContextModelSynchronizerCommand()); - } - - protected Command buildSynchronousContextModelSynchronizerCommand() { - return new SynchronousContextModelSynchronizerCommand(); - } - - protected class SynchronousContextModelSynchronizerCommand - implements Command - { - public void execute() { - AbstractJpaProject.this.synchronizeContextModel(new NullProgressMonitor()); - } - } - - - // ********** project "update" ********** - - public CallbackSynchronizer getUpdateSynchronizer() { - return this.updateSynchronizer; - } - - public void setUpdateSynchronizer(CallbackSynchronizer synchronizer) { - if (synchronizer == null) { - throw new NullPointerException(); - } - this.updateSynchronizer.stop(); - this.updateSynchronizer.removeListener(this.updateSynchronizerListener); - this.setUpdateSynchronizer_(synchronizer); - } - - protected void setUpdateSynchronizer_(CallbackSynchronizer synchronizer) { - this.updateSynchronizer = synchronizer; - this.updateSynchronizer.addListener(this.updateSynchronizerListener); - this.updateSynchronizer.start(); - } - - @Override - public void stateChanged() { - super.stateChanged(); - this.update(); - } - - /** - * The JPA project's state has changed, "update" those parts of the - * JPA project that are dependent on other parts of the JPA project. - *

- * Delegate to the update synchronizer so clients can configure how - * updates occur. - *

- * Ignore any updates that occur while we are synchronizing - * the context model with the resource model because we will update - * the context model at the completion of the sync. This is really - * only useful for synchronous syncs and updates; since - * the job scheduling rules will prevent the sync and - * update jobs from running concurrently. - * - * @see #updateAndWait() - */ - protected void update() { - if ( ! this.synchronizingContextModel) { - this.updateSynchronizer.synchronize(); - } - } - - /** - * Called by the update synchronizer. - */ - public IStatus update(IProgressMonitor monitor) { - this.rootContextNode.update(); - return Status.OK_STATUS; - } - - /** - * This is the callback used by the update synchronizer to notify the JPA - * project that the "update" has quiesced (i.e. the "update" has completed - * and there are no outstanding requests for further "updates"). - */ - public void updateQuiesced() { - this.synchronizeMetamodel(); - } - - public void updateAndWait() { - CallbackSynchronizer temp = this.updateSynchronizer; - this.setUpdateSynchronizer(this.buildSynchronousUpdateSynchronizer()); - this.update(); - this.setUpdateSynchronizer(temp); - } - - - // ********** default update synchronizer (synchronous) ********** - - protected CallbackSynchronizer buildSynchronousUpdateSynchronizer() { - return new CallbackSynchronousSynchronizer(this.buildSynchronousUpdateSynchronizerCommand()); - } - - protected Command buildSynchronousUpdateSynchronizerCommand() { - return new SynchronousUpdateSynchronizerCommand(); - } - - protected class SynchronousUpdateSynchronizerCommand - implements Command - { - public void execute() { - AbstractJpaProject.this.update(new NullProgressMonitor()); - } - } - - - // ********** update synchronizer listener ********** - - protected CallbackSynchronizer.Listener buildUpdateSynchronizerListener() { - return new UpdateSynchronizerListener(); - } - - protected class UpdateSynchronizerListener - implements CallbackSynchronizer.Listener - { - public void synchronizationQuiesced(CallbackSynchronizer synchronizer) { - AbstractJpaProject.this.updateQuiesced(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java deleted file mode 100644 index 2e14d4d697..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericEntityGeneratorDatabaseAnnotationNameBuilder.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import org.eclipse.jpt.jpa.core.EntityGeneratorDatabaseAnnotationNameBuilder; -import org.eclipse.jpt.jpa.db.Column; -import org.eclipse.jpt.jpa.db.ForeignKey; -import org.eclipse.jpt.jpa.db.Table; - -/** - * Singleton that delegates to the db object passed in. - */ -public final class GenericEntityGeneratorDatabaseAnnotationNameBuilder - implements EntityGeneratorDatabaseAnnotationNameBuilder -{ - public static final EntityGeneratorDatabaseAnnotationNameBuilder INSTANCE - = new GenericEntityGeneratorDatabaseAnnotationNameBuilder(); - - public static EntityGeneratorDatabaseAnnotationNameBuilder instance() { - return INSTANCE; - } - - // ensure single instance - private GenericEntityGeneratorDatabaseAnnotationNameBuilder() { - super(); - } - - public String buildTableAnnotationName(String entityName, Table table) { - return table.getIdentifier(entityName); - } - - public String buildColumnAnnotationName(String attributeName, Column column) { - return column.getIdentifier(attributeName); - } - - public String buildJoinColumnAnnotationName(String attributeName, ForeignKey foreignKey) { - return foreignKey.getJoinColumnAnnotationIdentifier(attributeName); - } - - public String buildJoinColumnAnnotationName(Column column) { - return column.getIdentifier(); - } - - public String buildJoinTableAnnotationName(Table table) { - return table.getIdentifier(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java deleted file mode 100644 index f86051c5cf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationDefinitionProvider.java +++ /dev/null @@ -1,161 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import java.util.ArrayList; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.internal.resource.java.AssociationOverrideAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.AssociationOverridesAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.AttributeOverrideAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.AttributeOverridesAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.BasicAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.ColumnAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.DiscriminatorColumnAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.DiscriminatorValueAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddableAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddedAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddedIdAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.EntityAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.EnumeratedAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.GeneratedValueAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.IdAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.IdClassAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.InheritanceAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.JoinColumnAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.JoinColumnsAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.JoinTableAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.LobAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.ManyToManyAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.ManyToOneAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.MapKeyAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.MappedSuperclassAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.NamedNativeQueriesAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.NamedNativeQueryAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.NamedQueriesAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.NamedQueryAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.OneToManyAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.OneToOneAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.OrderByAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.PrimaryKeyJoinColumnAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.PrimaryKeyJoinColumnsAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.SecondaryTableAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.SecondaryTablesAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.SequenceGeneratorAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.TableAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.TableGeneratorAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.TemporalAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.TransientAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.VersionAnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; - -public class GenericJpaAnnotationDefinitionProvider - extends AbstractJpaAnnotationDefinitionProvider -{ - // singleton - private static final JpaAnnotationDefinitionProvider INSTANCE = new GenericJpaAnnotationDefinitionProvider(); - - /** - * Return the singleton - */ - public static JpaAnnotationDefinitionProvider instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private GenericJpaAnnotationDefinitionProvider() { - super(); - } - - @Override - protected void addTypeAnnotationDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, TYPE_ANNOTATION_DEFINITIONS); - } - - protected static final AnnotationDefinition[] TYPE_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] { - AssociationOverrideAnnotationDefinition.instance(), - AssociationOverridesAnnotationDefinition.instance(), - AttributeOverrideAnnotationDefinition.instance(), - AttributeOverridesAnnotationDefinition.instance(), - DiscriminatorColumnAnnotationDefinition.instance(), - DiscriminatorValueAnnotationDefinition.instance(), - EmbeddableAnnotationDefinition.instance(), - EntityAnnotationDefinition.instance(), - IdClassAnnotationDefinition.instance(), - InheritanceAnnotationDefinition.instance(), - MappedSuperclassAnnotationDefinition.instance(), - NamedQueryAnnotationDefinition.instance(), - NamedQueriesAnnotationDefinition.instance(), - NamedNativeQueryAnnotationDefinition.instance(), - NamedNativeQueriesAnnotationDefinition.instance(), - PrimaryKeyJoinColumnAnnotationDefinition.instance(), - PrimaryKeyJoinColumnsAnnotationDefinition.instance(), - SecondaryTableAnnotationDefinition.instance(), - SecondaryTablesAnnotationDefinition.instance(), - SequenceGeneratorAnnotationDefinition.instance(), - TableAnnotationDefinition.instance(), - TableGeneratorAnnotationDefinition.instance() - }; - - @Override - protected void addTypeMappingAnnotationDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, TYPE_MAPPING_ANNOTATION_DEFINITIONS); - } - - protected static final AnnotationDefinition[] TYPE_MAPPING_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] { - EmbeddableAnnotationDefinition.instance(), - EntityAnnotationDefinition.instance(), - MappedSuperclassAnnotationDefinition.instance() - }; - - @Override - protected void addAttributeAnnotationDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, ATTRIBUTE_ANNOTATION_DEFINITIONS); - } - - protected static final AnnotationDefinition[] ATTRIBUTE_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] { - AssociationOverrideAnnotationDefinition.instance(), - AssociationOverridesAnnotationDefinition.instance(), - AttributeOverrideAnnotationDefinition.instance(), - AttributeOverridesAnnotationDefinition.instance(), - BasicAnnotationDefinition.instance(), - ColumnAnnotationDefinition.instance(), - EmbeddedAnnotationDefinition.instance(), - EmbeddedIdAnnotationDefinition.instance(), - EnumeratedAnnotationDefinition.instance(), - GeneratedValueAnnotationDefinition.instance(), - IdAnnotationDefinition.instance(), - JoinColumnAnnotationDefinition.instance(), - JoinColumnsAnnotationDefinition.instance(), - JoinTableAnnotationDefinition.instance(), - LobAnnotationDefinition.instance(), - ManyToManyAnnotationDefinition.instance(), - ManyToOneAnnotationDefinition.instance(), - MapKeyAnnotationDefinition.instance(), - OneToManyAnnotationDefinition.instance(), - OneToOneAnnotationDefinition.instance(), - OrderByAnnotationDefinition.instance(), - PrimaryKeyJoinColumnAnnotationDefinition.instance(), - PrimaryKeyJoinColumnsAnnotationDefinition.instance(), - SequenceGeneratorAnnotationDefinition.instance(), - TableGeneratorAnnotationDefinition.instance(), - TemporalAnnotationDefinition.instance(), - TransientAnnotationDefinition.instance(), - VersionAnnotationDefinition.instance() - }; - - @Override - protected void addPackageAnnotationDefinitionsTo(ArrayList definitions) { - // no package annotations - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationProvider.java deleted file mode 100644 index 62a7cfe743..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaAnnotationProvider.java +++ /dev/null @@ -1,194 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import java.util.Iterator; -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedPackage; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.JpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackage; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * Delegate to annotation definition providers. - * The platform factory will build an instance of this annotation provider, - * passing in the appropriate array of annotation definition providers necessary - * to build the annotations for the platform (vendor and/or version). - */ -public class GenericJpaAnnotationProvider - implements JpaAnnotationProvider -{ - private final Iterable annotationDefinitionProviders; - - - public GenericJpaAnnotationProvider(JpaAnnotationDefinitionProvider... annotationDefinitionProviders) { - super(); - this.annotationDefinitionProviders = new ArrayIterable(annotationDefinitionProviders); - } - - - // ********** type annotations ********** - - public Iterator typeAnnotationNames() { - return this.convertToNames(this.getTypeAnnotationDefinitions()).iterator(); - } - - protected Iterable getTypeAnnotationDefinitions() { - return new CompositeIterable ( - new TransformationIterable>(this.annotationDefinitionProviders) { - @Override - protected Iterable transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) { - return annotationDefinitionProvider.getTypeAnnotationDefinitions(); - } - } - ); - } - - public Iterator typeMappingAnnotationNames() { - return this.convertToNames(this.getTypeMappingAnnotationDefinitions()).iterator(); - } - - protected Iterable getTypeMappingAnnotationDefinitions() { - return new CompositeIterable ( - new TransformationIterable>(this.annotationDefinitionProviders) { - @Override - protected Iterable transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) { - return annotationDefinitionProvider.getTypeMappingAnnotationDefinitions(); - } - } - ); - } - - public Annotation buildTypeAnnotation(JavaResourcePersistentType parent, Type type, String annotationName) { - return this.getTypeAnnotationDefinition(annotationName).buildAnnotation(parent, type); - } - - public Annotation buildTypeAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - return this.getTypeAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation); - } - - protected AnnotationDefinition getTypeAnnotationDefinition(String annotationName) { - AnnotationDefinition annotationDefinition = this.selectAnnotationDefinition(this.getTypeAnnotationDefinitions(), annotationName); - if (annotationDefinition == null) { - throw new IllegalArgumentException("unsupported type annotation: " + annotationName); //$NON-NLS-1$ - } - return annotationDefinition; - } - - public Annotation buildNullTypeAnnotation(JavaResourcePersistentType parent, String annotationName) { - return this.getTypeAnnotationDefinition(annotationName).buildNullAnnotation(parent); - } - - - // ********** attribute annotations ********** - - public Iterator attributeAnnotationNames() { - return this.convertToNames(this.getAttributeAnnotationDefinitions()).iterator(); - } - - protected Iterable getAttributeAnnotationDefinitions() { - return new CompositeIterable ( - new TransformationIterable>(this.annotationDefinitionProviders) { - @Override - protected Iterable transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) { - return annotationDefinitionProvider.getAttributeAnnotationDefinitions(); - } - } - ); - } - - public Annotation buildAttributeAnnotation(JavaResourcePersistentAttribute parent, Attribute attribute, String annotationName) { - return this.getAttributeAnnotationDefinition(annotationName).buildAnnotation(parent, attribute); - } - - public Annotation buildAttributeAnnotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - return this.getAttributeAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation); - } - - public Annotation buildNullAttributeAnnotation(JavaResourcePersistentAttribute parent, String annotationName) { - return this.getAttributeAnnotationDefinition(annotationName).buildNullAnnotation(parent); - } - - protected AnnotationDefinition getAttributeAnnotationDefinition(String annotationName) { - AnnotationDefinition annotationDefinition = this.selectAnnotationDefinition(this.getAttributeAnnotationDefinitions(), annotationName); - if (annotationDefinition == null) { - throw new IllegalArgumentException("unsupported attribute annotation: " + annotationName); //$NON-NLS-1$ - } - return annotationDefinition; - } - - - // ********** package annotations ********** - - public Iterator packageAnnotationNames() { - return this.convertToNames(this.getPackageAnnotationDefinitions()).iterator(); - } - - protected Iterable getPackageAnnotationDefinitions() { - return new CompositeIterable ( - new TransformationIterable>(this.annotationDefinitionProviders) { - @Override - protected Iterable transform(JpaAnnotationDefinitionProvider annotationDefinitionProvider) { - return annotationDefinitionProvider.getPackageAnnotationDefinitions(); - } - } - ); - } - - public Annotation buildPackageAnnotation(JavaResourcePackage parent, AnnotatedPackage pkg, String annotationName) { - return this.getPackageAnnotationDefinition(annotationName).buildAnnotation(parent, pkg); - } - - public Annotation buildPackageAnnotation(JavaResourcePackage parent, IAnnotation jdtAnnotation) { - return this.getPackageAnnotationDefinition(jdtAnnotation.getElementName()).buildAnnotation(parent, jdtAnnotation); - } - - public Annotation buildNullPackageAnnotation(JavaResourcePackage parent, String annotationName) { - return this.getPackageAnnotationDefinition(annotationName).buildNullAnnotation(parent); - } - - protected AnnotationDefinition getPackageAnnotationDefinition(String annotationName) { - AnnotationDefinition annotationDefinition = this.selectAnnotationDefinition(this.getPackageAnnotationDefinitions(), annotationName); - if (annotationDefinition == null) { - throw new IllegalArgumentException("unsupported package annotation: " + annotationName); //$NON-NLS-1$ - } - return annotationDefinition; - } - - - // ********** convenience methods ********** - - protected Iterable convertToNames(Iterable annotationDefinitions) { - return new TransformationIterable(annotationDefinitions) { - @Override - protected String transform(AnnotationDefinition annotationDefinition) { - return annotationDefinition.getAnnotationName(); - } - }; - } - - protected AnnotationDefinition selectAnnotationDefinition(Iterable annotationDefinitions, String annotationName) { - for (AnnotationDefinition annotationDefinition : annotationDefinitions) { - if (annotationDefinition.getAnnotationName().equals(annotationName)) { - return annotationDefinition; - } - } - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java deleted file mode 100644 index c8e5bf9efd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatform.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceModel; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.core.internal.utility.PlatformTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.DefaultAnnotationEditFormatter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationEditFormatter; -import org.eclipse.jpt.jpa.core.EntityGeneratorDatabaseAnnotationNameBuilder; -import org.eclipse.jpt.jpa.core.JpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.JpaFile; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaPlatformProvider; -import org.eclipse.jpt.jpa.core.JpaPlatformVariation; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaResourceModelProvider; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.ResourceDefinition; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; -import org.eclipse.jpt.jpa.db.ConnectionProfileFactory; -import org.eclipse.jpt.jpa.db.JptJpaDbPlugin; - -/** - * All the state in the JPA platform should be "static" (i.e. unchanging once - * it is initialized). - */ -public class GenericJpaPlatform - implements JpaPlatform -{ - private final String id; - - private final Version jpaVersion; - - private final JpaFactory jpaFactory; - - private final JpaAnnotationProvider annotationProvider; - - private final JpaPlatformProvider platformProvider; - - private final JpaPlatformVariation jpaVariation; - - - public GenericJpaPlatform(String id, Version jpaVersion, JpaFactory jpaFactory, JpaAnnotationProvider jpaAnnotationProvider, JpaPlatformProvider platformProvider, JpaPlatformVariation jpaVariation) { - super(); - this.id = id; - this.jpaVersion = jpaVersion; - this.jpaFactory = jpaFactory; - this.annotationProvider = jpaAnnotationProvider; - this.jpaVariation = jpaVariation; - this.platformProvider = platformProvider; - } - - - // ********** meta stuff ********** - - public String getId() { - return this.id; - } - - public JpaPlatformDescription getDescription() { - return JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(this.getId()); - } - - public Version getJpaVersion() { - return this.jpaVersion; - } - - - // ********** factory ********** - - public JpaFactory getJpaFactory() { - return this.jpaFactory; - } - - - // ********** platform providers ********** - - protected JpaPlatformProvider getPlatformProvider() { - return this.platformProvider; - } - - - // ********** JPA file/resource models ********** - - public JpaFile buildJpaFile(JpaProject jpaProject, IFile file) { - IContentType contentType = PlatformTools.getContentType(file); - return (contentType == null) ? null : this.buildJpaFile(jpaProject, file, contentType); - } - - protected JpaFile buildJpaFile(JpaProject jpaProject, IFile file, IContentType contentType) { - JptResourceModel resourceModel = this.buildResourceModel(jpaProject, file, contentType); - return (resourceModel == null) ? null : this.jpaFactory.buildJpaFile(jpaProject, file, contentType, resourceModel); - } - - protected JptResourceModel buildResourceModel(JpaProject jpaProject, IFile file, IContentType contentType) { - JpaResourceModelProvider provider = this.getResourceModelProvider(contentType); - return (provider == null) ? null : provider.buildResourceModel(jpaProject, file); - } - - /** - * Return null if we don't have a provider for the specified content type - * (since we don't have control over the possible content types). - */ - protected JpaResourceModelProvider getResourceModelProvider(IContentType contentType) { - for (JpaResourceModelProvider provider : this.platformProvider.getResourceModelProviders()) { - if (contentType.equals(provider.getContentType())) { - return provider; - } - } - return null; - } - - - // ********** Java annotations ********** - - public JpaAnnotationProvider getAnnotationProvider() { - return this.annotationProvider; - } - - public AnnotationEditFormatter getAnnotationEditFormatter() { - return DefaultAnnotationEditFormatter.instance(); - } - - - // ********** Java type mappings ********** - - public Iterable getJavaTypeMappingDefinitions() { - return this.platformProvider.getJavaTypeMappingDefinitions(); - } - - - // ********** Java attribute mappings ********** - - public Iterable getSpecifiedJavaAttributeMappingDefinitions() { - return this.platformProvider.getSpecifiedJavaAttributeMappingDefinitions(); - } - - public Iterable getDefaultJavaAttributeMappingDefinitions() { - return this.platformProvider.getDefaultJavaAttributeMappingDefinitions(); - } - - - // ********** resource types and definitions ********** - - public boolean supportsResourceType(JptResourceType resourceType) { - for (ResourceDefinition resourceDefinition : this.platformProvider.getResourceDefinitions()) { - if (resourceDefinition.getResourceType().equals(resourceType)) { - return true; - } - } - return false; - } - - public ResourceDefinition getResourceDefinition(JptResourceType resourceType) { - for (ResourceDefinition resourceDefinition : this.platformProvider.getResourceDefinitions()) { - if (resourceDefinition.getResourceType().equals(resourceType)) { - return resourceDefinition; - } - } - throw new IllegalArgumentException("Illegal resource type: " + resourceType); //$NON-NLS-1$ - } - - public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) { - return this.platformProvider.getMostRecentSupportedResourceType(contentType); - } - - - // ********** database ********** - - public ConnectionProfileFactory getConnectionProfileFactory() { - return JptJpaDbPlugin.getConnectionProfileFactory(); - } - - public EntityGeneratorDatabaseAnnotationNameBuilder getEntityGeneratorDatabaseAnnotationNameBuilder() { - return GenericEntityGeneratorDatabaseAnnotationNameBuilder.instance(); - } - - - // ********** validation ********** - - public JpaPlatformVariation getJpaVariation() { - return this.jpaVariation; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java deleted file mode 100644 index be8f3e7f80..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformFactory.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import java.util.Comparator; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaPlatformFactory; -import org.eclipse.jpt.jpa.core.JpaPlatformVariation; -import org.eclipse.jpt.jpa.core.internal.jpa1.GenericJpaFactory; -import org.eclipse.wst.common.project.facet.core.DefaultVersionComparator; - -/** - * All the state in the JPA platform should be "static" (i.e. unchanging once - * it is initialized). - */ -public class GenericJpaPlatformFactory - implements JpaPlatformFactory -{ - /** - * zero-argument constructor - */ - public GenericJpaPlatformFactory() { - super(); - } - - public JpaPlatform buildJpaPlatform(String id) { - return new GenericJpaPlatform( - id, - this.buildJpaVersion(), - new GenericJpaFactory(), - new GenericJpaAnnotationProvider(GenericJpaAnnotationDefinitionProvider.instance()), - GenericJpaPlatformProvider.instance(), - this.buildJpaPlatformVariation()); - } - - - private JpaPlatform.Version buildJpaVersion() { - return new SimpleVersion(JpaFacet.VERSION_1_0.getVersionString()); - } - - protected JpaPlatformVariation buildJpaPlatformVariation() { - return new JpaPlatformVariation() { - public Supported getTablePerConcreteClassInheritanceIsSupported() { - return Supported.MAYBE; - } - public boolean isJoinTableOverridable() { - return false; - } - }; - } - - - public static class SimpleVersion implements JpaPlatform.Version { - protected final String jpaVersion; - - public static final Comparator JPA_VERSION_COMPARATOR = new DefaultVersionComparator(); - - public SimpleVersion(String jpaVersion) { - super(); - this.jpaVersion = jpaVersion; - } - - /** - * The generic platform's version is the same as the JPA version. - */ - public String getVersion() { - return this.getJpaVersion(); - } - - public String getJpaVersion() { - return this.jpaVersion; - } - - /** - * For now, generic platforms are backward-compatible. - */ - public boolean isCompatibleWithJpaVersion(String version) { - return JPA_VERSION_COMPARATOR.compare(this.jpaVersion, version) >= 0; - } - - @Override - public String toString() { - return "JPA version: " + this.getJpaVersion(); //$NON-NLS-1$ - } - - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformProvider.java deleted file mode 100644 index 7b5ef341a0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/GenericJpaPlatformProvider.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import java.util.ArrayList; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaPlatformProvider; -import org.eclipse.jpt.jpa.core.JpaResourceModelProvider; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.ResourceDefinition; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaBasicMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddableDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEntityDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaMappedSuperclassDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaVersionMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition; - -/** - * All the state in the JPA platform should be "static" (i.e. unchanging once - * it is initialized). - */ -public class GenericJpaPlatformProvider - extends AbstractJpaPlatformProvider -{ - // singleton - private static final JpaPlatformProvider INSTANCE = new GenericJpaPlatformProvider(); - - /** - * Return the singleton. - */ - public static JpaPlatformProvider instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private GenericJpaPlatformProvider() { - super(); - } - - - // ********** resource models ********** - - public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) { - if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) { - return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE; - } - else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) { - return JptCommonCorePlugin.JAR_RESOURCE_TYPE; - } - else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) { - return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE; - } - else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) { - return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE; - } - else { - throw new IllegalArgumentException(contentType.toString()); - } - } - - @Override - protected void addResourceModelProvidersTo(ArrayList providers) { - CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS); - } - - // order should not be important here - protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] { - JavaResourceModelProvider.instance(), - JarResourceModelProvider.instance(), - PersistenceResourceModelProvider.instance(), - OrmResourceModelProvider.instance() - }; - - - // ********** Java type mappings ********** - - @Override - protected void addJavaTypeMappingDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS); - } - - // order matches that used by the Reference Implementation (EclipseLink) - protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] { - JavaEntityDefinition.instance(), - JavaEmbeddableDefinition.instance(), - JavaMappedSuperclassDefinition.instance() - }; - - - // ********** Java attribute mappings ********** - - @Override - protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by the Reference Implementation (EclipseLink) - protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] { - JavaEmbeddedMappingDefinition.instance(), - JavaBasicMappingDefinition.instance() - }; - - @Override - protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by the Reference Implementation (EclipseLink) - protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] { - JavaTransientMappingDefinition.instance(), - JavaIdMappingDefinition.instance(), - JavaVersionMappingDefinition.instance(), - JavaBasicMappingDefinition.instance(), - JavaEmbeddedMappingDefinition.instance(), - JavaEmbeddedIdMappingDefinition.instance(), - JavaManyToManyMappingDefinition.instance(), - JavaManyToOneMappingDefinition.instance(), - JavaOneToManyMappingDefinition.instance(), - JavaOneToOneMappingDefinition.instance() - }; - - - // ********** resource definitions ********** - - @Override - protected void addResourceDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS); - } - - protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] { - GenericPersistenceXmlDefinition.instance(), - GenericOrmXmlDefinition.instance() - }; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java deleted file mode 100644 index 0299725cf2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JarResourceModelProvider.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jpt.common.core.JptResourceModel; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPackageFragmentRoot; - -/** - * JAR files - */ -public class JarResourceModelProvider - implements JpaResourceModelProvider -{ - // singleton - private static final JpaResourceModelProvider INSTANCE = new JarResourceModelProvider(); - - /** - * Return the singleton. - */ - public static JpaResourceModelProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private JarResourceModelProvider() { - super(); - } - - public IContentType getContentType() { - return JptCommonCorePlugin.JAR_CONTENT_TYPE; - } - - /** - * NB: Despite the check in GenericJpaProject.addJpaFile_(IFile), - * we can get here and - * the PFR will be null if the JAR is underneath a directory on the - * classpath but the JAR itself is not on the classpath. - * Returning null should be OK. - */ - public JptResourceModel buildResourceModel(JpaProject jpaProject, IFile file) { - IPackageFragmentRoot pfr = JavaCore.createJarPackageFragmentRootFrom(file); - return (pfr ==null) ? null : new BinaryPackageFragmentRoot(pfr, jpaProject.getJpaPlatform().getAnnotationProvider()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java deleted file mode 100644 index 4cde45e05f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaPackageInfoResourceModelProvider.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourcePackageInfoCompilationUnit; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit; - -/** - * Java package-info.java source code - */ -public class JavaPackageInfoResourceModelProvider - implements JpaResourceModelProvider -{ - // singleton - private static final JpaResourceModelProvider INSTANCE = new JavaPackageInfoResourceModelProvider(); - - /** - * Return the singleton. - */ - public static JpaResourceModelProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private JavaPackageInfoResourceModelProvider() { - super(); - } - - public IContentType getContentType() { - return JptCommonCorePlugin.JAVA_SOURCE_PACKAGE_INFO_CONTENT_TYPE; - } - - public JavaResourceCompilationUnit buildResourceModel(JpaProject jpaProject, IFile file) { - return new SourcePackageInfoCompilationUnit( - JavaCore.createCompilationUnitFrom(file), - jpaProject.getJpaPlatform().getAnnotationProvider(), - jpaProject.getJpaPlatform().getAnnotationEditFormatter(), - jpaProject.getModifySharedDocumentCommandExecutor() - ); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java deleted file mode 100644 index bd0623255c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JavaResourceModelProvider.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceTypeCompilationUnit; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit; - -/** - * Java source code - */ -public class JavaResourceModelProvider - implements JpaResourceModelProvider -{ - // singleton - private static final JpaResourceModelProvider INSTANCE = new JavaResourceModelProvider(); - - /** - * Return the singleton. - */ - public static JpaResourceModelProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private JavaResourceModelProvider() { - super(); - } - - public IContentType getContentType() { - return JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE; - } - - public JavaResourceCompilationUnit buildResourceModel(JpaProject jpaProject, IFile file) { - return new SourceTypeCompilationUnit( - JavaCore.createCompilationUnitFrom(file), - jpaProject.getJpaPlatform().getAnnotationProvider(), - jpaProject.getJpaPlatform().getAnnotationEditFormatter(), - jpaProject.getModifySharedDocumentCommandExecutor() - ); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaPlatformTester.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaPlatformTester.java deleted file mode 100644 index 985056b392..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaPlatformTester.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import org.eclipse.core.expressions.PropertyTester; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription; - -public class JpaPlatformTester extends PropertyTester { - - public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { - if (! (property.equals("jpaPlatform") || property.equals("jpaPlatformGroup")) - || ! (expectedValue instanceof String)) { //$NON-NLS-1$ - return false; - } - - JpaPlatformDescription platform = null; - - if (receiver instanceof IResource) { - platform = platform(((IResource) receiver).getProject()); - } - else if (receiver instanceof IJavaElement) { - platform = platform(((IJavaElement) receiver).getResource().getProject()); - } - else if (receiver instanceof JpaPlatformDescription) { - platform = (JpaPlatformDescription) receiver; - } - else if (receiver instanceof JpaLibraryProviderInstallOperationConfig) { - platform = ((JpaLibraryProviderInstallOperationConfig) receiver).getJpaPlatform(); - } - - if (property.equals("jpaPlatform")) { - JpaPlatformDescription otherPlatform = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform((String) expectedValue); - return platform == null ? false : platform.equals(otherPlatform); - } - if (property.equals("jpaPlatformGroup")) { - JpaPlatformGroupDescription group = (platform == null) ? null : platform.getGroup(); - JpaPlatformGroupDescription otherGroup = JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatformGroup((String) expectedValue); - return group == null ? false : group.equals(otherGroup); - } - return false; - } - - private JpaPlatformDescription platform(IProject project) { - return (project == null) - ? null - : JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(JptJpaCorePlugin.getJpaPlatformId(project)); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaTester.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaTester.java deleted file mode 100644 index fd62b02ccf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JpaTester.java +++ /dev/null @@ -1,52 +0,0 @@ -/****************************************************************************** - * Copyright (c) 2008 BEA Systems, Inc 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: - * Konstantin Komissarchik - initial implementation and ongoing maintenance - * Oracle - copied and modified from org.eclipse.wst.common.project.facet.core.internal.FacetedProjectPropertyTester - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import org.eclipse.core.expressions.PropertyTester; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.wst.common.project.facet.core.FacetedProjectFramework; - -public class JpaTester extends PropertyTester { - - public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { - if (!property.equals("projectFacet")) { //$NON-NLS-1$ - return false; - } - if (receiver instanceof IJavaElement) { - IProject project = ((IJavaElement) receiver).getResource().getProject(); - if (project != null) { - - String val = (String) expectedValue; - int colon = val.indexOf( ':' ); - String facetID; - String facetVer; - if( colon == -1 || colon == val.length() - 1 ) { - facetID = val; - facetVer = null; - } else { - facetID = val.substring( 0, colon ); - facetVer = val.substring( colon + 1 ); - } - try { - return FacetedProjectFramework.hasProjectFacet( project, facetID, facetVer ); - } catch (CoreException e) { - JptJpaCorePlugin.log(e.getStatus()); - return false; - } - } - } - return false; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java deleted file mode 100644 index eb5ec8c8ca..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/JptCoreMessages.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import org.eclipse.osgi.util.NLS; - -/** - * Localized messages used by Dali core. - */ -public class JptCoreMessages { - - public static String NONE; - public static String VALIDATE_JOB; - public static String VALIDATE_PROJECT_NOT_JPA; - public static String VALIDATE_PROJECT_IMPROPER_PLATFORM; - public static String VALIDATE_CONTAINER_QUESTIONABLE; - public static String VALIDATE_FILE_VERSION_NOT_SUPPORTED; - public static String VALIDATE_FILE_VERSION_NOT_SUPPORTED_FOR_FACET_VERSION; - public static String VALIDATE_PERSISTENCE_UNIT_DOES_NOT_SPECIFIED; - public static String VALIDATE_PERSISTENCE_UNIT_NOT_IN_PROJECT; - public static String VALIDATE_PLATFORM_NOT_SPECIFIED; - public static String VALIDATE_PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION; - public static String VALIDATE_LIBRARY_PROVIDER_INVALID; - public static String VALIDATE_CONNECTION_NOT_SPECIFIED; - public static String VALIDATE_CONNECTION_INVALID; - public static String VALIDATE_CONNECTION_NOT_CONNECTED; - public static String VALIDATE_DEFAULT_CATALOG_NOT_SPECIFIED; - public static String VALIDATE_CONNECTION_DOESNT_CONTAIN_CATALOG; - public static String VALIDATE_DEFAULT_SCHEMA_NOT_SPECIFIED; - public static String VALIDATE_CONNECTION_DOESNT_CONTAIN_SCHEMA; - public static String VALIDATE_RUNTIME_NOT_SPECIFIED; - public static String VALIDATE_RUNTIME_DOES_NOT_SUPPORT_EJB_30; - public static String VALIDATE_LIBRARY_NOT_SPECIFIED; - public static String SYNCHRONIZE_CLASSES_JOB; - public static String SYNCHRONIZING_CLASSES_TASK; - public static String INVALID_PERSISTENCE_XML_CONTENT; - public static String ERROR_SYNCHRONIZING_CLASSES_COULD_NOT_VALIDATE; - public static String ERROR_WRITING_FILE; - public static String REGISTRY_MISSING_ATTRIBUTE; - public static String REGISTRY_INVALID_VALUE; - public static String REGISTRY_DUPLICATE; - public static String REGISTRY_FAILED_CLASS_LOAD; - public static String REGISTRY_FAILED_INTERFACE_ASSIGNMENT; - public static String REGISTRY_FAILED_INSTANTIATION; - public static String CONTEXT_MODEL_SYNC_JOB_NAME; - public static String UPDATE_JOB_NAME; - public static String PLATFORM_ID_DOES_NOT_EXIST; - public static String PREFERENCES_FLUSH_JOB_NAME; - public static String OSGI_BUNDLES_LIBRARY_VALIDATOR__BUNDLE_NOT_FOUND; - public static String OSGI_BUNDLES_LIBRARY_VALIDATOR__IMPROPER_BUNDLE_VERSION; - - private static final String BUNDLE_NAME = "jpa_core"; //$NON-NLS-1$ - private static final Class BUNDLE_CLASS = JptCoreMessages.class; - static { - NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS); - } - - private JptCoreMessages() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/OrmResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/OrmResourceModelProvider.java deleted file mode 100644 index 124e5ce332..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/OrmResourceModelProvider.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaResourceModelProvider; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.internal.resource.orm.OrmXmlResourceProvider; -import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; - -/** - * orm.xml - */ -public class OrmResourceModelProvider - implements JpaResourceModelProvider -{ - // singleton - private static final JpaResourceModelProvider INSTANCE = new OrmResourceModelProvider(); - - /** - * Return the singleton. - */ - public static JpaResourceModelProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private OrmResourceModelProvider() { - super(); - } - - public IContentType getContentType() { - return JptJpaCorePlugin.ORM_XML_CONTENT_TYPE; - } - - public JpaXmlResource buildResourceModel(JpaProject jpaProject, IFile file) { - return OrmXmlResourceProvider.getXmlResourceProvider(file).getXmlResource(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/PersistenceResourceModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/PersistenceResourceModelProvider.java deleted file mode 100644 index 047e497f21..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/PersistenceResourceModelProvider.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaResourceModelProvider; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.internal.resource.persistence.PersistenceXmlResourceProvider; -import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; - -/** - * persistence.xml - */ -public class PersistenceResourceModelProvider - implements JpaResourceModelProvider -{ - // singleton - private static final JpaResourceModelProvider INSTANCE = new PersistenceResourceModelProvider(); - - /** - * Return the singleton. - */ - public static JpaResourceModelProvider instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private PersistenceResourceModelProvider() { - super(); - } - - public IContentType getContentType() { - return JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE; - } - - public JpaXmlResource buildResourceModel(JpaProject jpaProject, IFile file) { - return PersistenceXmlResourceProvider.getXmlResourceProvider(file).getXmlResource(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/ProjectAdapterFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/ProjectAdapterFactory.java deleted file mode 100644 index 1e1d2cdba8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/ProjectAdapterFactory.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdapterFactory; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; - -/** - * [Double-duty] factory to build adapters for either standard projects or - * Java projects: - * - JPA project - * - * See org.eclipse.jpt.jpa.core plugin.xml. - */ -public class ProjectAdapterFactory - implements IAdapterFactory -{ - private static final Class[] ADAPTER_LIST = new Class[] { JpaProject.class }; - - public Class[] getAdapterList() { - return ADAPTER_LIST; - } - - public Object getAdapter(Object adaptableObject, @SuppressWarnings("unchecked") Class adapterType) { - if (adaptableObject instanceof IProject) { - return this.getAdapter((IProject) adaptableObject, adapterType); - } - if (adaptableObject instanceof IJavaProject) { - return this.getAdapter((IJavaProject) adaptableObject, adapterType); - } - return null; - } - - private Object getAdapter(IProject project, Class adapterType) { - if (adapterType == JpaProject.class) { - return this.getJpaProject(project); - } - return null; - } - - private Object getAdapter(IJavaProject javaProject, Class adapterType) { - if (adapterType == JpaProject.class) { - return this.getJpaProject(javaProject.getProject()); - } - return null; - } - - private JpaProject getJpaProject(IProject project) { - return JptJpaCorePlugin.getJpaProject(project); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/SimpleJpaProjectConfig.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/SimpleJpaProjectConfig.java deleted file mode 100644 index 67535d5bb3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/SimpleJpaProjectConfig.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0; - -/** - * Straightforward implementation of the JPA project config. - */ -public class SimpleJpaProjectConfig implements JpaProject2_0.Config { - protected IProject project; - protected JpaPlatform jpaPlatform; - protected String connectionProfileName; - protected String userOverrideDefaultCatalog; - protected String userOverrideDefaultSchema; - protected boolean discoverAnnotatedClasses; - protected String metamodelSourceFolderName; - - public SimpleJpaProjectConfig() { - super(); - } - - public IProject getProject() { - return this.project; - } - - public void setProject(IProject project) { - this.project = project; - } - - public JpaPlatform getJpaPlatform() { - return this.jpaPlatform; - } - - public void setJpaPlatform(JpaPlatform jpaPlatform) { - this.jpaPlatform = jpaPlatform; - } - - public String getConnectionProfileName() { - return this.connectionProfileName; - } - - public void setConnectionProfileName(String connectionProfileName) { - this.connectionProfileName = connectionProfileName; - } - - public String getUserOverrideDefaultSchema() { - return this.userOverrideDefaultSchema; - } - - public void setUserOverrideDefaultSchema(String userOverrideDefaultSchema) { - this.userOverrideDefaultSchema = userOverrideDefaultSchema; - } - - public String getUserOverrideDefaultCatalog() { - return this.userOverrideDefaultCatalog; - } - - public void setUserOverrideDefaultCatalog(String userOverrideDefaultCatalog) { - this.userOverrideDefaultCatalog = userOverrideDefaultCatalog; - } - - public boolean discoverAnnotatedClasses() { - return this.discoverAnnotatedClasses; - } - - public void setDiscoverAnnotatedClasses(boolean discoverAnnotatedClasses) { - this.discoverAnnotatedClasses = discoverAnnotatedClasses; - } - - public String getMetamodelSourceFolderName() { - return this.metamodelSourceFolderName; - } - - public void setMetamodelSourceFolderName(String metamodelSourceFolderName) { - this.metamodelSourceFolderName = metamodelSourceFolderName; - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.project.getName()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractJpaContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractJpaContextNode.java deleted file mode 100644 index 22507e4026..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractJpaContextNode.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jpa.core.JpaNode; -import org.eclipse.jpt.jpa.core.context.JpaContextNode; -import org.eclipse.jpt.jpa.core.context.MappingFileRoot; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaNode; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; - -public abstract class AbstractJpaContextNode - extends AbstractJpaNode - implements JpaContextNode -{ - protected AbstractJpaContextNode(JpaNode parent) { - super(parent); - } - - - // ********** synchronize/update ********** - - public void synchronizeWithResourceModel() { - // NOP - } - - /** - * convenience method - */ - protected void synchronizeNodesWithResourceModel(Iterable nodes) { - for (JpaContextNode node : nodes) { - node.synchronizeWithResourceModel(); - } - } - - public void update() { - // NOP - } - - /** - * convenience method - */ - protected void updateNodes(Iterable nodes) { - for (JpaContextNode node : nodes) { - node.update(); - } - } - - - // ********** containment hierarchy ********** - - /** - * covariant override - */ - @Override - public JpaContextNode getParent() { - return (JpaContextNode) super.getParent(); - } - - /** - * Overridden in:

    - *
  • {@link org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode#getResourceType() AbstractJavaJpaContextNode} - *
  • {@link org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJarFile#getResourceType() GenericJarFile} - *
  • {@link org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXml#getResourceType() GenericOrmXml} - *
  • {@link org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXml#getResourceType() GenericPersistenceXml} - *
- */ - public JptResourceType getResourceType() { - return this.getParent().getResourceType(); - } - - /** - * Overridden in:
    - *
  • {@link org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit#getPersistenceUnit() AbstractPersistenceUnit} - * to return itself - *
  • {@link org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericRootContextNode#getPersistenceUnit() GenericRootContextNode} - * to return null - *
- */ - public PersistenceUnit getPersistenceUnit() { - return this.getParent().getPersistenceUnit(); - } - - /** - * Overridden in:
    - *
  • {@link org.eclipse.jpt.jpa.core.internal.context.orm.AbstractEntityMappings#getMappingFileRoot() AbstractEntityMappings} - * to return itself - *
  • {@link org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericRootContextNode#getMappingFileRoot() GenericRootContextNode} - * to return null - *
- */ - public MappingFileRoot getMappingFileRoot() { - return this.getParent().getMappingFileRoot(); - } - - - // ********** database stuff ********** - - public Schema getContextDefaultDbSchema() { - SchemaContainer dbSchemaContainer = this.getContextDefaultDbSchemaContainer(); - return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getContextDefaultSchema()); - } - - protected String getContextDefaultSchema() { - MappingFileRoot mfr = this.getMappingFileRoot(); - return (mfr != null) ? mfr.getSchema() : this.getPersistenceUnit().getDefaultSchema(); - } - - /** - * If we don't have a catalog (i.e. we don't even have a default catalog), - * then the database probably does not support catalogs; and we need to - * get the schema directly from the database. - */ - public SchemaContainer getContextDefaultDbSchemaContainer() { - String catalog = this.getContextDefaultCatalog(); - return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase(); - } - - /** - * If we don't have a catalog (i.e. we don't even have a default - * catalog), then the database probably does not support catalogs. - */ - public Catalog getContextDefaultDbCatalog() { - String catalog = this.getContextDefaultCatalog(); - return (catalog == null) ? null : this.resolveDbCatalog(catalog); - } - - protected String getContextDefaultCatalog() { - MappingFileRoot mfr = this.getMappingFileRoot(); - return (mfr != null) ? mfr.getCatalog() : this.getPersistenceUnit().getDefaultCatalog(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractXmlContextNode.java deleted file mode 100644 index 8149d527c6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AbstractXmlContextNode.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.JpaContextNode; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class AbstractXmlContextNode - extends AbstractJpaContextNode - implements XmlContextNode -{ - protected AbstractXmlContextNode(JpaContextNode parent) { - super(parent); - } - - - // ********** validation ********** - - /** - * All subclass implementations should be have a "super" call to this method. - */ - public void validate(List messages, IReporter reporter) { - if (reporter.isCancelled()) { - throw new ValidationCancelledException(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AttributeMappingTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AttributeMappingTools.java deleted file mode 100644 index ea6a5dbdb9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/AttributeMappingTools.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; - -/** - * Gather some of the behavior common to the Java and XML models. :-( - */ -public final class AttributeMappingTools -{ - - // ********** all mapping names transformer ********** - - public static final Transformer> ALL_MAPPING_NAMES_TRANSFORMER = new AllMappingNamesTransformer(); - static class AllMappingNamesTransformer - implements Transformer> - { - public Iterator transform(AttributeMapping mapping) { - return mapping.allMappingNames(); - } - } - - - // ********** all overridable attribute mapping names transformer ********** - - public static final Transformer> ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER = new AllOverridableAttributeMappingNamesTransformer(); - static class AllOverridableAttributeMappingNamesTransformer - implements Transformer> - { - public Iterator transform(AttributeMapping mapping) { - return mapping.allOverridableAttributeMappingNames(); - } - } - - - // ********** all overridable association mapping names transformer ********** - - public static final Transformer> ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER = new AllOverridableAssociationMappingNamesTransformer(); - static class AllOverridableAssociationMappingNamesTransformer - implements Transformer> - { - public Iterator transform(AttributeMapping mapping) { - return mapping.allOverridableAssociationMappingNames(); - } - } - - - // ********** constructor ********** - - /** - * Suppress default constructor, ensuring non-instantiability. - */ - private AttributeMappingTools() { - super(); - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseColumnTextRangeResolver.java deleted file mode 100644 index 07cc664f27..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseColumnTextRangeResolver.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Interface to resolve text ranges on named columns - */ -public interface BaseColumnTextRangeResolver extends NamedColumnTextRangeResolver -{ - TextRange getTableTextRange(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseJoinColumnTextRangeResolver.java deleted file mode 100644 index 8918e1ce48..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/BaseJoinColumnTextRangeResolver.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Interface to resolve text ranges on join columns - */ -public interface BaseJoinColumnTextRangeResolver extends NamedColumnTextRangeResolver -{ - TextRange getReferencedColumnNameTextRange(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/ContextContainerTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/ContextContainerTools.java deleted file mode 100644 index f8c958501b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/ContextContainerTools.java +++ /dev/null @@ -1,148 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -import java.util.ArrayList; -import java.util.HashSet; -import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.jpa.core.context.JpaContextNode; - -/** - * Utility methods for manipulating context containers. - */ -public class ContextContainerTools { - - /** - * Adapter used to synchronize a context container with its corresponding - * resource container. - * - * @param the type of context elements - * @param the type of resource elements - */ - public interface Adapter { - - /** - * Return the container's context elements. - */ - Iterable getContextElements(); - - /** - * Return the container's current set of resource elements. - * These are what the context elements will be synchronized to. - */ - Iterable getResourceElements(); - - /** - * Return the resource element corresponding to the specified context - * element. - */ - R getResourceElement(C contextElement); - - /** - * Move the specified context element to the specified index. - */ - void moveContextElement(int index, C element); - - /** - * Add a context element for the specified resource element at the - * specified index. - */ - void addContextElement(int index, R resourceElement); - - /** - * Remove the specified context element from the container. - */ - void removeContextElement(C element); - } - - - /** - * Using the specified adapter, synchronize a context container with its - * corresponding resource container: moving, removing, and adding elements - * as necessary. - *

- * We can do this because:

    - *
  • the XML translators will move the EMF elements when - * appropriate (as opposed to simply rebuilding them in place). - *
  • the Java resource model will re-use existing annotations when - * appropriate (as opposed to simply rebuilding them in place). - *
- */ - public static void synchronizeWithResourceModel(Adapter adapter) { - sync(adapter, true); // true = sync - } - - /** - * @see #synchronizeWithResourceModel(Adapter) - */ - public static void update(Adapter adapter) { - sync(adapter, false); // false = update - } - - /** - * The specified sync flag controls whether any surviving - * context nodes are either synchronized (true) or - * updated (false). - */ - protected static void sync(Adapter adapter, boolean sync) { - HashSet contextElements = CollectionTools.set(adapter.getContextElements()); - ArrayList contextElementsToSync = new ArrayList(contextElements.size()); - int resourceIndex = 0; - - for (R resourceElement : adapter.getResourceElements()) { - boolean match = false; - for (Iterator stream = contextElements.iterator(); stream.hasNext(); ) { - C contextElement = stream.next(); - if (Tools.valuesAreEqual(adapter.getResourceElement(contextElement), resourceElement)) { - // we don't know the source index because the element has been moved by previously moved elements - adapter.moveContextElement(resourceIndex, contextElement); - stream.remove(); - // TODO perform update here someday... - contextElementsToSync.add(contextElement); - match = true; - break; - } - } - if ( ! match) { - // added elements are sync'ed during construction or will be - // updated during the next "update" (which is triggered by - // their addition to the model) - adapter.addContextElement(resourceIndex, resourceElement); - } - resourceIndex++; - } - // remove any leftover context elements - for (C contextElement : contextElements) { - adapter.removeContextElement(contextElement); - } - // TODO bjv - // take care of the structural changes before sync'ing the remaining elements; - // we might be able to do this inline once we get rid of the "list change" events - // and go with only add, remove, etc. list events - // (these syncs will trigger "list change" events with list aspect adapters, which - // trigger refreshes of UI adapters (e.g. TableModelAdapter) which will prematurely - // discover any structural changes... :( ) - // see ItemAspectListValueModelAdapter.itemAspectChanged(EventObject) - for (C contextElement : contextElementsToSync) { - if (sync) { - contextElement.synchronizeWithResourceModel(); - } else { - contextElement.update(); - } - } - } - - private ContextContainerTools() { - super(); - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/EntityTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/EntityTextRangeResolver.java deleted file mode 100644 index 19b118f3b4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/EntityTextRangeResolver.java +++ /dev/null @@ -1,18 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - - -public interface EntityTextRangeResolver - extends PrimaryKeyTextRangeResolver -{ - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JoinColumnTextRangeResolver.java deleted file mode 100644 index 5c7ac1ede2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JoinColumnTextRangeResolver.java +++ /dev/null @@ -1,20 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -/** - * Interface to resolve text ranges on join columns - */ -public interface JoinColumnTextRangeResolver - extends BaseJoinColumnTextRangeResolver, BaseColumnTextRangeResolver -{ - // combine interfaces -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JptValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JptValidator.java deleted file mode 100644 index 0bc515e2a1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/JptValidator.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -import java.util.List; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public interface JptValidator -{ - /** - * Return a boolean used to determine whether to continue validating - */ - boolean validate(List messages, IReporter reporter); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java deleted file mode 100644 index 1d55cc1e9e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/MappingTools.java +++ /dev/null @@ -1,432 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.ColumnMapping; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.JpaNamedContextNode; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship; -import org.eclipse.jpt.jpa.core.context.ReferenceTable; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.jpa2.context.AttributeMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.CollectionMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.ElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.db.Table; - -/** - * Gather some of the behavior common to the Java and XML models. :-( - */ -public final class MappingTools { - - /** - * Default join table name from the JPA spec:
- * "The concatenated names of the two associated primary - * entity tables, separated by a underscore." - *
-	 * [owning table name]_[target table name]
-	 * 
- * NB: The names are concatenated, - * not the identifiers. - * E.g. the join table for "Foo" and "baR" - * (where the "delimited" identifier is required) is: - *
-	 *     "Foo_baR"
-	 * 
- * not - *
-	 *     "Foo"_"baR"
-	 * 
- * As a result, we cannot honestly calculate the default name without a - * database connection. We need the database to convert the resulting name - * to an identifier appropriate to the current database. - */ - public static String buildJoinTableDefaultName(ReadOnlyRelationship relationship) { - if (relationship.getJpaProject().getDataSource().connectionProfileIsActive()) { - return buildDbJoinTableDefaultName(relationship); - } - // continue with a "best effort": - String owningTableName = relationship.getTypeMapping().getPrimaryTableName(); - if (owningTableName == null) { - return null; - } - RelationshipMapping relationshipMapping = relationship.getMapping(); - if (relationshipMapping == null) { - return null; - } - Entity targetEntity = relationshipMapping.getResolvedTargetEntity(); - if (targetEntity == null) { - return null; - } - String targetTableName = targetEntity.getPrimaryTableName(); - if (targetTableName == null) { - return null; - } - return owningTableName + '_' + targetTableName; - } - - /** - * Use the database to build a more accurate default name. - */ - private static String buildDbJoinTableDefaultName(ReadOnlyRelationship relationship) { - Table owningTable = relationship.getTypeMapping().getPrimaryDbTable(); - if (owningTable == null) { - return null; - } - RelationshipMapping relationshipMapping = relationship.getMapping(); - if (relationshipMapping == null) { - return null; - } - Entity targetEntity = relationshipMapping.getResolvedTargetEntity(); - if (targetEntity == null) { - return null; - } - Table targetTable = targetEntity.getPrimaryDbTable(); - if (targetTable == null) { - return null; - } - String name = owningTable.getName() + '_' + targetTable.getName(); - return owningTable.getDatabase().convertNameToIdentifier(name); - } - - /** - * Default collection table name from the JPA spec:
- * "The concatenation of the name of the containing entity and - * the name of the collection attribute, separated by an underscore." - *
-	 * [owning entity name]_[attribute name]
-	 * 
- */ - public static String buildCollectionTableDefaultName(ElementCollectionMapping2_0 mapping) { - Entity entity = mapping.getEntity(); - if (entity == null) { - return null; - } - String owningEntityName = entity.getName(); - String attributeName = mapping.getName(); - return owningEntityName + '_' + attributeName; - } - - /** - * Return the join column's default name; - * which is typically - * [attribute name]_[referenced column name] - * But, if we don't have an attribute name (e.g. in a unidirectional - * OneToMany or ManyToMany) is - * [target entity name]_[referenced column name] - * - * @see #buildJoinTableDefaultName(ReadOnlyRelationship) - */ - public static String buildJoinColumnDefaultName(ReadOnlyJoinColumn joinColumn, ReadOnlyJoinColumn.Owner owner) { - if (owner.joinColumnsSize() != 1) { - return null; - } - String prefix = owner.getAttributeName(); - if (prefix == null) { - Entity targetEntity = owner.getRelationshipTarget(); - if (targetEntity == null) { - return null; - } - prefix = targetEntity.getName(); - } - // not sure which of these is correct... - // (the spec implies that the referenced column is always the - // primary key column of the target entity) - // Column targetColumn = joinColumn.getTargetPrimaryKeyDbColumn(); - String targetColumnName = joinColumn.getReferencedColumnName(); - if (targetColumnName == null) { - return null; - } - String name = prefix + '_' + targetColumnName; - // not sure which of these is correct... - // converting the name to an identifier will result in the identifier - // being delimited nearly every time (at least on non-Sybase/MS - // databases); but that probably is not the intent of the spec... - // return targetColumn.getDatabase().convertNameToIdentifier(name); - return name; - } - - /** - * Return the name of the attribute in the specified mapping's target entity - * that is owned by the mapping. - */ - public static String getTargetAttributeName(RelationshipMapping relationshipMapping) { - if (relationshipMapping == null) { - return null; - } - Entity targetEntity = relationshipMapping.getResolvedTargetEntity(); - if (targetEntity == null) { - return null; - } - for (ReadOnlyPersistentAttribute attribute : CollectionTools.iterable(targetEntity.getPersistentType().allAttributes())) { - if (attribute.getMapping().isOwnedBy(relationshipMapping)) { - return attribute.getName(); - } - } - return null; - } - - /** - * If appropriate, return the name of the single primary key column of the - * relationship target. - * Spec states:
- * "The same name as the primary key column of the referenced table."
- * We are assuming that the primary key column is defined by the mappings instead of the database. - */ - public static String buildJoinColumnDefaultReferencedColumnName(ReadOnlyJoinColumn.Owner joinColumnOwner) { - if (joinColumnOwner.joinColumnsSize() != 1) { - return null; - } - Entity targetEntity = joinColumnOwner.getRelationshipTarget(); - if (targetEntity == null) { - return null; - } - return targetEntity.getPrimaryKeyColumnName(); - } - - public static ColumnMapping getColumnMapping(String attributeName, PersistentType persistentType) { - if ((attributeName == null) || (persistentType == null)) { - return null; - } - for (Iterator stream = persistentType.allAttributes(); stream.hasNext(); ) { - ReadOnlyPersistentAttribute persAttribute = stream.next(); - if (attributeName.equals(persAttribute.getName())) { - if (persAttribute.getMapping() instanceof ColumnMapping) { - return (ColumnMapping) persAttribute.getMapping(); - } - // keep looking or return null??? - } - } - return null; - } - - public static RelationshipMapping getRelationshipMapping(String attributeName, TypeMapping typeMapping) { - if ((attributeName == null) || (typeMapping == null)) { - return null; - } - for (Iterator stream = typeMapping.allAttributeMappings(); stream.hasNext(); ) { - AttributeMapping attributeMapping = stream.next(); - if (attributeName.equals(attributeMapping.getName())) { - if (attributeMapping instanceof RelationshipMapping) { - return (RelationshipMapping) attributeMapping; - } - // keep looking or return null??? - } - } - return null; - } - - public static void convertReferenceTableDefaultToSpecifiedJoinColumn(ReferenceTable referenceTable) { - JoinColumn defaultJoinColumn = referenceTable.getDefaultJoinColumn(); - if (defaultJoinColumn != null) { - String columnName = defaultJoinColumn.getDefaultName(); - String referencedColumnName = defaultJoinColumn.getDefaultReferencedColumnName(); - JoinColumn joinColumn = referenceTable.addSpecifiedJoinColumn(); - joinColumn.setSpecifiedName(columnName); - joinColumn.setSpecifiedReferencedColumnName(referencedColumnName); - } - } - - public static void convertJoinTableDefaultToSpecifiedInverseJoinColumn(JoinTable joinTable) { - JoinColumn defaultInverseJoinColumn = joinTable.getDefaultInverseJoinColumn(); - if (defaultInverseJoinColumn != null) { - String columnName = defaultInverseJoinColumn.getDefaultName(); - String referencedColumnName = defaultInverseJoinColumn.getDefaultReferencedColumnName(); - JoinColumn joinColumn = joinTable.addSpecifiedInverseJoinColumn(0); - joinColumn.setSpecifiedName(columnName); - joinColumn.setSpecifiedReferencedColumnName(referencedColumnName); - } - } - - public static String getMetamodelFieldMapKeyTypeName(CollectionMapping2_0 mapping) { - PersistentType targetType = mapping.getResolvedTargetType(); - String mapKey = mapping.getMapKey(); - if ((mapKey == null) || (targetType == null)) { - String mapKeyClass = mapping.getMapKeyClass(); - return mapKeyClass != null ? mapKeyClass : MetamodelField.DEFAULT_TYPE_NAME; - } - ReadOnlyPersistentAttribute mapKeyAttribute = targetType.resolveAttribute(mapKey); - if (mapKeyAttribute == null) { - return MetamodelField.DEFAULT_TYPE_NAME; - } - AttributeMapping2_0 mapKeyMapping = (AttributeMapping2_0) mapKeyAttribute.getMapping(); - if (mapKeyMapping == null) { - return MetamodelField.DEFAULT_TYPE_NAME; - } - return mapKeyMapping.getMetamodelTypeName(); - } - - // TODO move to TypeMapping? may need different name (or may need to rename existing #resolve...) - public static Column resolveOverriddenColumn(TypeMapping overridableTypeMapping, String attributeName) { - // convenience null check to simplify client code - if (overridableTypeMapping == null) { - return null; - } - - for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) { - Column column = typeMapping.resolveOverriddenColumn(attributeName); - if (column != null) { - return column; - } - } - return null; - } - - // TODO move to TypeMapping? may need different name (or may need to rename existing #resolve...) - public static Relationship resolveOverriddenRelationship(TypeMapping overridableTypeMapping, String attributeName) { - // convenience null check to simplify client code - if (overridableTypeMapping == null) { - return null; - } - - for (TypeMapping typeMapping : CollectionTools.iterable(overridableTypeMapping.inheritanceHierarchy())) { - Relationship relationship = typeMapping.resolveOverriddenRelationship(attributeName); - if (relationship != null) { - return relationship; - } - } - return null; - } - - /** - * Return whether the specified nodes are "duplicates". - * @see JpaNamedContextNode#duplicates(Object) - */ - public static > boolean nodesAreDuplicates(T node1, T node2) { - return (node1 != node2) && - ! StringTools.stringIsEmpty(node1.getName()) && - node1.getName().equals(node2.getName()) && - ! node1.overrides(node2) && - ! node2.overrides(node1); - } - - /** - * Return whether the first specified node "overrides" the second, - * based on the "precedence" of their classes. - * @see JpaNamedContextNode#overrides(Object) - */ - public static > boolean nodeOverrides(T node1, T node2, Iterable> precedenceTypeList) { - // this isn't ideal, but use it until adopters protest... - return (node1.getName() != null) && - (node2.getName() != null) && - node1.getName().equals(node2.getName()) && - (node1.getPersistenceUnit() == node2.getPersistenceUnit()) && - (calculatePrecedence(node1, precedenceTypeList) < calculatePrecedence(node2, precedenceTypeList)); - } - - /** - * Loop through the specified classes; return the index of the first class - * the specified node is an instance of. - */ - private static > int calculatePrecedence(T node, Iterable> precedenceTypeList) { - int precedence = 0; - for (Class nodeClass : precedenceTypeList) { - if (nodeClass.isInstance(node)) { - return precedence; - } - precedence++; - } - throw new IllegalArgumentException("unknown named node: " + node); //$NON-NLS-1$ - } - - public static String getPrimaryKeyColumnName(Entity entity) { - String pkColumnName = null; - for (Iterator stream = entity.getPersistentType().allAttributes(); stream.hasNext(); ) { - ReadOnlyPersistentAttribute attribute = stream.next(); - String current = attribute.getPrimaryKeyColumnName(); - if (current != null) { - // 229423 - if the attribute is a primary key, but it has an attribute override, - // use the override column instead - ReadOnlyAttributeOverride attributeOverride = entity.getAttributeOverrideContainer().getOverrideNamed(attribute.getName()); - if (attributeOverride != null) { - current = attributeOverride.getColumn().getName(); - } - } - if (pkColumnName == null) { - pkColumnName = current; - } else { - if (current != null) { - // if we encounter a composite primary key, return null - return null; - } - } - } - // if we encounter only a single primary key column name, return it - return pkColumnName; - } - - /** - * "Unqualify" the specified attribute name, removing the mapping's name - * from the front of the attribute name if it is present. For example, if - * the mapping's name is "foo", the attribute name - * "foo.bar" would be converted to "bar"). - * Return null if the attribute name cannot be "unqualified". - */ - public static String unqualify(String mappingName, String attributeName) { - if (mappingName == null) { - return null; - } - if ( ! attributeName.startsWith(mappingName)) { - return null; - } - int mappingNameLength = mappingName.length(); - if (attributeName.length() <= mappingNameLength) { - return null; - } - return (attributeName.charAt(mappingNameLength) == '.') ? attributeName.substring(mappingNameLength + 1) : null; - } - - /** - * This transformer will prepend a specified qualifier, followed by a - * dot ('.'), to a string. For example, if a mapping's name is - * "foo" and one of its attribute's is named - * "bar", the attribute's name will be transformed - * into "foo.bar". If the specified qualifier is - * null (or an empty string), only a dot will be prepended - * to a string. - */ - public static class QualifierTransformer - implements Transformer - { - private final String prefix; - public QualifierTransformer(String qualifier) { - super(); - this.prefix = (qualifier == null) ? "." : qualifier + '.'; //$NON-NLS-1$ - } - public String transform(String s) { - return this.prefix + s; - } - } - - - // ********** constructor ********** - - /** - * Suppress default constructor, ensuring non-instantiability. - */ - private MappingTools() { - super(); - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/NamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/NamedColumnTextRangeResolver.java deleted file mode 100644 index da477387e9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/NamedColumnTextRangeResolver.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Interface to resolve text ranges on named columns - */ -public interface NamedColumnTextRangeResolver -{ - TextRange getNameTextRange(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/OverrideTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/OverrideTextRangeResolver.java deleted file mode 100644 index 901eae1c02..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/OverrideTextRangeResolver.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Interface to resolve text ranges on named columns - */ -public interface OverrideTextRangeResolver -{ - TextRange getNameTextRange(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java deleted file mode 100644 index 7620a04d2e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributePropertyTester.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -import org.eclipse.core.expressions.PropertyTester; -import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute; - -public class PersistentAttributePropertyTester - extends PropertyTester -{ - public static final String IS_MAPPED = "isMapped"; //$NON-NLS-1$ - - public static final String IS_VIRTUAL = "isVirtual"; //$NON-NLS-1$ - - - public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { - if (property == null) { - return false; - } - if ( ! (expectedValue instanceof Boolean)) { - return false; - } - return this.test_(receiver, property, ((Boolean) expectedValue).booleanValue()); - } - - /** - * pre-condition: property is not null - */ - protected boolean test_(Object receiver, String property, boolean expected) { - if (property.equals(IS_MAPPED)) { - boolean actual = ((ReadOnlyPersistentAttribute) receiver).getMapping().getKey() != null; - return actual == expected; - } - if (property.equals(IS_VIRTUAL)) { - boolean actual = ((ReadOnlyPersistentAttribute) receiver).isVirtual(); - return actual == expected; - } - return false; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributeTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributeTextRangeResolver.java deleted file mode 100644 index a2345cc459..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PersistentAttributeTextRangeResolver.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Interface to resolve text ranges on persistent attributes - */ -public interface PersistentAttributeTextRangeResolver -{ - TextRange getAttributeTextRange(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PrimaryKeyTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PrimaryKeyTextRangeResolver.java deleted file mode 100644 index 8a759ea107..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/PrimaryKeyTextRangeResolver.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Interface to resolve text ranges on persistent type mappings that can define primary keys - */ -public interface PrimaryKeyTextRangeResolver extends TypeMappingTextRangeResolver -{ - - TextRange getIdClassTextRange(); - - TextRange getAttributeMappingTextRange(String attributeName); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TableTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TableTextRangeResolver.java deleted file mode 100644 index a66f0ede07..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TableTextRangeResolver.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Interface to resolve text ranges on named columns - */ -public interface TableTextRangeResolver -{ - TextRange getNameTextRange(); - - TextRange getSchemaTextRange(); - - TextRange getCatalogTextRange(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTextRangeResolver.java deleted file mode 100644 index a30cac215c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTextRangeResolver.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -import org.eclipse.jpt.common.core.utility.TextRange; - -/** - * Interface to resolve text ranges on persistent type mappings - */ -public interface TypeMappingTextRangeResolver -{ - TextRange getTypeMappingTextRange(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTools.java deleted file mode 100644 index 78deca4bf8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/TypeMappingTools.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context; - -import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.ReadOnlyTable; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.jpa2.context.SingleRelationshipMapping2_0; - -/** - * Gather some of the behavior common to the Java and XML models. :-( - */ -public class TypeMappingTools -{ - // ********** single relationship mappings ********** - - public static Iterable getMappedByRelationshipAttributeNames(TypeMapping typeMapping) { - return new TransformationIterable(getMapsIdRelationshipMappings(typeMapping)) { - @Override - protected String transform(SingleRelationshipMapping2_0 attributeMapping) { - return attributeMapping.getDerivedIdentity().getMapsIdDerivedIdentityStrategy().getValue(); - } - }; - } - - public static Iterable getMapsIdRelationshipMappings(TypeMapping typeMapping) { - return new FilteringIterable(getSingleRelationshipMappings(typeMapping)) { - @Override - protected boolean accept(SingleRelationshipMapping2_0 attributeMapping) { - return attributeMapping.getDerivedIdentity().usesMapsIdDerivedIdentityStrategy(); - } - }; - } - - protected static Iterable getSingleRelationshipMappings(TypeMapping typeMapping) { - return new SubIterableWrapper(getSingleRelationshipMappings_(typeMapping)); - } - - @SuppressWarnings("unchecked") - protected static Iterable getSingleRelationshipMappings_(TypeMapping typeMapping) { - return new CompositeIterable( - typeMapping.getAllAttributeMappings(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY), - typeMapping.getAllAttributeMappings(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) - ); - } - - - // ********** attribute mappings transformer ********** - - public static final Transformer> ATTRIBUTE_MAPPINGS_TRANSFORMER = new AttributeMappingsTransformer(); - static class AttributeMappingsTransformer - implements Transformer> - { - public Iterator transform(TypeMapping mapping) { - return mapping.attributeMappings(); - } - } - - - // ********** associated tables transformer ********** - - public static final Transformer> ASSOCIATED_TABLES_TRANSFORMER = new AssociatedTablesTransformer(); - static class AssociatedTablesTransformer - implements Transformer> - { - public Iterator transform(TypeMapping mapping) { - return mapping.associatedTables(); - } - } - - - // ********** overridable attribute names transformer ********** - - public static final Transformer> OVERRIDABLE_ATTRIBUTE_NAMES_TRANSFORMER = new OverridableAttributeNamesTransformer(); - static class OverridableAttributeNamesTransformer - implements Transformer> - { - public Iterator transform(TypeMapping mapping) { - return mapping.overridableAttributeNames(); - } - } - - - // ********** overridable association names transformer ********** - - public static final Transformer> OVERRIDABLE_ASSOCIATION_NAMES_TRANSFORMER = new OverridableAssociationNamesTransformer(); - static class OverridableAssociationNamesTransformer - implements Transformer> - { - public Iterator transform(TypeMapping mapping) { - return mapping.overridableAssociationNames(); - } - } - - - // ********** constructor ********** - - /** - * Suppress default constructor, ensuring non-instantiability. - */ - private TypeMappingTools() { - super(); - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java deleted file mode 100644 index 1a92c17ab5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaAttributeMapping.java +++ /dev/null @@ -1,319 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.SingleElementIterator; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.ColumnMapping; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.SimpleMetamodelField; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.AttributeMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java attribute mapping - *

- * The mapping annotation is null for default mappings. - * It will be faulted into existence whenever {@link #getAnnotationForUpdate()} - * is called. It will not return to null automatically - * when all its state is defaulted; it must be explicitly cleared via - * {@link JavaPersistentAttribute#setMappingKey(String)}. - */ -public abstract class AbstractJavaAttributeMapping - extends AbstractJavaJpaContextNode - implements JavaAttributeMapping, AttributeMapping2_0 -{ - protected boolean default_; - - - protected AbstractJavaAttributeMapping(JavaPersistentAttribute parent) { - super(parent); - this.default_ = this.buildDefault(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.updateDefault(); - } - - @Override - public void update() { - super.update(); - } - - - // ********** name ********** - - public String getName() { - return this.getPersistentAttribute().getName(); - } - - - // ********** annotation ********** - - @SuppressWarnings("unchecked") - public A getMappingAnnotation() { - return (A) this.getAnnotation_(); - } - - protected Annotation getAnnotation_() { - return this.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()); - } - - protected abstract String getAnnotationName(); - - /** - * This method should only be called on mappings that can occur by default - * (e.g. Basic, Embedded, OneToOne, - * and OneToMany). - */ - public A getAnnotationForUpdate() { - A annotation = this.getMappingAnnotation(); - if (annotation == null) { - this.getPersistentAttribute().setMappingKey(this.getKey()); - annotation = this.getMappingAnnotation(); - if (annotation == null) { - throw new IllegalStateException("missing annotation: " + this); //$NON-NLS-1$ - } - } - return annotation; - } - - - // ********** default ********** - - public boolean isDefault() { - return this.default_; - } - - protected void setDefault(boolean default_) { - boolean old = this.default_; - this.default_ = default_; - this.firePropertyChanged(DEFAULT_PROPERTY, old, default_); - } - - public void updateDefault() { - this.setDefault(this.buildDefault()); - } - - protected boolean buildDefault() { - return this.getMappingAnnotation() == null; - } - - - // ********** misc ********** - - @Override - public JavaPersistentAttribute getParent() { - return (JavaPersistentAttribute) super.getParent(); - } - - public JavaPersistentAttribute getPersistentAttribute() { - return this.getParent(); - } - - public TypeMapping getTypeMapping() { - return this.getPersistentAttribute().getOwningTypeMapping(); - } - - public JavaResourcePersistentAttribute getResourcePersistentAttribute() { - return this.getPersistentAttribute().getResourcePersistentAttribute(); - } - - public String getPrimaryKeyColumnName() { - return null; - } - - public boolean isOverridableAttributeMapping() { - return false; - } - - public boolean isOverridableAssociationMapping() { - return false; - } - - public boolean isRelationshipOwner() { - return false; - } - - public boolean isOwnedBy(AttributeMapping mapping) { - return false; - } - - public boolean validatesAgainstDatabase() { - return this.getTypeMapping().validatesAgainstDatabase(); - } - - public Table resolveDbTable(String tableName) { - return this.getTypeMapping().resolveDbTable(tableName); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getName()); - } - - - // ********** embedded mappings ********** - - public Iterator allMappingNames() { - return new SingleElementIterator(this.getName()); - } - - public Iterator allOverridableAttributeMappingNames() { - return this.isOverridableAttributeMapping() ? - new SingleElementIterator(this.getName()) : - EmptyIterator.instance(); - } - - public Iterator allOverridableAssociationMappingNames() { - return this.isOverridableAssociationMapping() ? - new SingleElementIterator(this.getName()) : - EmptyIterator.instance(); - } - - public Column resolveOverriddenColumn(String attributeName) { - ColumnMapping mapping = this.resolveColumnMapping(attributeName); - return (mapping == null) ? null : mapping.getColumn(); - } - - protected ColumnMapping resolveColumnMapping(String name) { - AttributeMapping mapping = this.resolveAttributeMapping(name); - return ((mapping != null) && mapping.isOverridableAttributeMapping()) ? (ColumnMapping) mapping : null; - } - - public Relationship resolveOverriddenRelationship(String attributeName) { - RelationshipMapping mapping = this.resolveRelationshipMapping(attributeName); - return (mapping == null) ? null : mapping.getRelationship(); - } - - protected RelationshipMapping resolveRelationshipMapping(String name) { - AttributeMapping mapping = this.resolveAttributeMapping(name); - return ((mapping != null) && mapping.isOverridableAssociationMapping()) ? (RelationshipMapping) mapping : null; - } - - public AttributeMapping resolveAttributeMapping(String attributeName) { - return this.getName().equals(attributeName) ? this : null; - } - - protected Transformer buildQualifierTransformer() { - return new MappingTools.QualifierTransformer(this.getName()); - } - - protected String unqualify(String attributeName) { - return MappingTools.unqualify(this.getName(), attributeName); - } - - - // ********** metamodel ********** - - public MetamodelField getMetamodelField() { - return new SimpleMetamodelField( - this.getMetamodelFieldModifiers(), - this.getMetamodelFieldTypeName(), - this.getMetamodelFieldTypeArgumentNames(), - this.getMetamodelFieldName() - ); - } - - protected Iterable getMetamodelFieldModifiers() { - return STANDARD_METAMODEL_FIELD_MODIFIERS; - } - - /** - * most mappings are "singular" - */ - protected String getMetamodelFieldTypeName() { - return JPA2_0.SINGULAR_ATTRIBUTE; - } - - protected final Iterable getMetamodelFieldTypeArgumentNames() { - ArrayList typeArgumentNames = new ArrayList(3); - typeArgumentNames.add(this.getTypeMapping().getPersistentType().getName()); - this.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames); - return typeArgumentNames; - } - - /** - * by default, we add only the mapping's attribute type name; - * but collection relationship mappings will also need to add the key type - * name if the "collection" is of type java.util.Map - */ - protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList typeArgumentNames) { - typeArgumentNames.add(this.getMetamodelTypeName()); - } - - public String getMetamodelTypeName() { - return ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelTypeName(); - } - - protected String getMetamodelFieldName() { - return this.getName(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.validateMappingType(messages, astRoot); - } - - protected void validateMappingType(List messages, CompilationUnit astRoot) { - if ( ! this.getTypeMapping().attributeMappingKeyAllowed(this.getKey())) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_MAPPING, - new String[] {this.getName()}, - this, - this.getValidationTextRange(astRoot) - ) - ); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getMappingAnnotationTextRange(astRoot); - return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot); - } - - protected TextRange getMappingAnnotationTextRange(CompilationUnit astRoot) { - A annotation = this.getMappingAnnotation(); - return (annotation == null) ? null : annotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseColumn.java deleted file mode 100644 index 5e2dd96aec..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseColumn.java +++ /dev/null @@ -1,361 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaBaseColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.java.BaseColumnAnnotation; - -/** - * Java column or join column - */ -public abstract class AbstractJavaBaseColumn - extends AbstractJavaNamedColumn - implements JavaBaseColumn -{ - protected String specifiedTable; - protected String defaultTable; - - protected Boolean specifiedUnique; - protected boolean defaultUnique; - - protected Boolean specifiedNullable; - protected boolean defaultNullable; - - protected Boolean specifiedInsertable; - protected boolean defaultInsertable; - - protected Boolean specifiedUpdatable; - protected boolean defaultUpdatable; - - - protected AbstractJavaBaseColumn(JavaJpaContextNode parent, O owner) { - this(parent, owner, null); - } - - protected AbstractJavaBaseColumn(JavaJpaContextNode parent, O owner, A columnAnnotation) { - super(parent, owner, columnAnnotation); - this.specifiedTable = this.buildSpecifiedTable(); - this.specifiedUnique = this.buildSpecifiedUnique(); - this.specifiedNullable = this.buildSpecifiedNullable(); - this.specifiedInsertable = this.buildSpecifiedInsertable(); - this.specifiedUpdatable = this.buildSpecifiedUpdatable(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedTable_(this.buildSpecifiedTable()); - this.setSpecifiedUnique_(this.buildSpecifiedUnique()); - this.setSpecifiedNullable_(this.buildSpecifiedNullable()); - this.setSpecifiedInsertable_(this.buildSpecifiedInsertable()); - this.setSpecifiedUpdatable_(this.buildSpecifiedUpdatable()); - } - - @Override - public void update() { - super.update(); - this.setDefaultTable(this.buildDefaultTable()); - this.setDefaultUnique(this.buildDefaultUnique()); - this.setDefaultNullable(this.buildDefaultNullable()); - this.setDefaultInsertable(this.buildDefaultInsertable()); - this.setDefaultUpdatable(this.buildDefaultUpdatable()); - } - - - // ********** table ********** - - @Override - public String getTable() { - return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable; - } - - public String getSpecifiedTable() { - return this.specifiedTable; - } - - public void setSpecifiedTable(String table) { - if (this.valuesAreDifferent(this.specifiedTable, table)) { - this.getColumnAnnotation().setTable(table); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedTable_(table); - } - } - - protected void setSpecifiedTable_(String table) { - String old = this.specifiedTable; - this.specifiedTable = table; - this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table); - } - - protected String buildSpecifiedTable() { - return this.getColumnAnnotation().getTable(); - } - - public String getDefaultTable() { - return this.defaultTable; - } - - protected void setDefaultTable(String table) { - String old = this.defaultTable; - this.defaultTable = table; - this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table); - } - - protected String buildDefaultTable() { - return this.owner.getDefaultTableName(); - } - - public TextRange getTableTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getColumnAnnotation().getTableTextRange(astRoot); - return (textRange != null) ? textRange : this.owner.getValidationTextRange(astRoot); - } - - - // ********** unique ********** - - public boolean isUnique() { - return (this.specifiedUnique != null) ? this.specifiedUnique.booleanValue() : this.isDefaultUnique(); - } - - public Boolean getSpecifiedUnique() { - return this.specifiedUnique; - } - - public void setSpecifiedUnique(Boolean unique) { - if (this.valuesAreDifferent(this.specifiedUnique, unique)) { - this.getColumnAnnotation().setUnique(unique); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedUnique_(unique); - } - } - - protected void setSpecifiedUnique_(Boolean unique) { - Boolean old = this.specifiedUnique; - this.specifiedUnique = unique; - this.firePropertyChanged(SPECIFIED_UNIQUE_PROPERTY, old, unique); - } - - protected Boolean buildSpecifiedUnique() { - return this.getColumnAnnotation().getUnique(); - } - - public boolean isDefaultUnique() { - return this.defaultUnique; - } - - protected void setDefaultUnique(boolean unique) { - boolean old = this.defaultUnique; - this.defaultUnique = unique; - this.firePropertyChanged(DEFAULT_UNIQUE_PROPERTY, old, unique); - } - - protected boolean buildDefaultUnique() { - return DEFAULT_UNIQUE; - } - - - // ********** nullable ********** - - public boolean isNullable() { - return (this.specifiedNullable != null) ? this.specifiedNullable.booleanValue() : this.isDefaultNullable(); - } - - public Boolean getSpecifiedNullable() { - return this.specifiedNullable; - } - - public void setSpecifiedNullable(Boolean nullable) { - if (this.valuesAreDifferent(this.specifiedNullable, nullable)) { - this.getColumnAnnotation().setNullable(nullable); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedNullable_(nullable); - } - } - - protected void setSpecifiedNullable_(Boolean nullable) { - Boolean old = this.specifiedNullable; - this.specifiedNullable = nullable; - this.firePropertyChanged(SPECIFIED_NULLABLE_PROPERTY, old, nullable); - } - - protected Boolean buildSpecifiedNullable() { - return this.getColumnAnnotation().getNullable(); - } - - public boolean isDefaultNullable() { - return this.defaultNullable; - } - - protected void setDefaultNullable(boolean nullable) { - boolean old = this.defaultNullable; - this.defaultNullable = nullable; - this.firePropertyChanged(DEFAULT_NULLABLE_PROPERTY, old, nullable); - } - - protected boolean buildDefaultNullable() { - return DEFAULT_NULLABLE; - } - - - // ********** insertable ********** - - public boolean isInsertable() { - return (this.specifiedInsertable != null) ? this.specifiedInsertable.booleanValue() : this.isDefaultInsertable(); - } - - public Boolean getSpecifiedInsertable() { - return this.specifiedInsertable; - } - - public void setSpecifiedInsertable(Boolean insertable) { - if (this.valuesAreDifferent(this.specifiedInsertable, insertable)) { - this.getColumnAnnotation().setInsertable(insertable); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedInsertable_(insertable); - } - } - - protected void setSpecifiedInsertable_(Boolean insertable) { - Boolean old = this.specifiedInsertable; - this.specifiedInsertable = insertable; - this.firePropertyChanged(SPECIFIED_INSERTABLE_PROPERTY, old, insertable); - } - - protected Boolean buildSpecifiedInsertable() { - return this.getColumnAnnotation().getInsertable(); - } - - public boolean isDefaultInsertable() { - return this.defaultInsertable; - } - - protected void setDefaultInsertable(boolean insertable) { - boolean old = this.defaultInsertable; - this.defaultInsertable = insertable; - this.firePropertyChanged(DEFAULT_INSERTABLE_PROPERTY, old, insertable); - } - - protected boolean buildDefaultInsertable() { - return DEFAULT_INSERTABLE; - } - - - // ********** updatable ********** - - public boolean isUpdatable() { - return (this.specifiedUpdatable != null) ? this.specifiedUpdatable.booleanValue() : this.isDefaultUpdatable(); - } - - public Boolean getSpecifiedUpdatable() { - return this.specifiedUpdatable; - } - - public void setSpecifiedUpdatable(Boolean updatable) { - if (this.valuesAreDifferent(this.specifiedUpdatable, updatable)) { - this.getColumnAnnotation().setUpdatable(updatable); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedUpdatable_(updatable); - } - } - - protected void setSpecifiedUpdatable_(Boolean updatable) { - Boolean old = this.specifiedUpdatable; - this.specifiedUpdatable = updatable; - this.firePropertyChanged(SPECIFIED_UPDATABLE_PROPERTY, old, updatable); - } - - protected Boolean buildSpecifiedUpdatable() { - return this.getColumnAnnotation().getUpdatable(); - } - - public boolean isDefaultUpdatable() { - return this.defaultUpdatable; - } - - protected void setDefaultUpdatable(boolean updatable) { - boolean old = this.defaultUpdatable; - this.defaultUpdatable = updatable; - this.firePropertyChanged(DEFAULT_UPDATABLE_PROPERTY, old, updatable); - } - - protected boolean buildDefaultUpdatable() { - return DEFAULT_UPDATABLE; - } - - - // ********** misc ********** - - protected void initializeFrom(ReadOnlyBaseColumn oldColumn) { - super.initializeFrom(oldColumn); - this.setSpecifiedTable(oldColumn.getSpecifiedTable()); - this.setSpecifiedUnique(oldColumn.getSpecifiedUnique()); - this.setSpecifiedNullable(oldColumn.getSpecifiedNullable()); - this.setSpecifiedInsertable(oldColumn.getSpecifiedInsertable()); - this.setSpecifiedUpdatable(oldColumn.getSpecifiedUpdatable()); - } - - protected void initializeFromVirtual(ReadOnlyBaseColumn virtualColumn) { - super.initializeFromVirtual(virtualColumn); - this.setSpecifiedTable(virtualColumn.getTable()); - // ignore other settings? - } - - public boolean tableNameIsInvalid() { - return this.owner.tableNameIsInvalid(this.getTable()); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.tableTouches(pos, astRoot)) { - return this.javaCandidateTableNames(filter); - } - return null; - } - - protected boolean tableTouches(int pos, CompilationUnit astRoot) { - return this.getColumnAnnotation().tableTouches(pos, astRoot); - } - - protected Iterator javaCandidateTableNames(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.candidateTableNames(filter)); - } - - protected Iterator candidateTableNames(Filter filter) { - return new FilteringIterator(this.candidateTableNames(), filter); - } - - public Iterator candidateTableNames() { - return this.owner.candidateTableNames(); - } - - @Override - protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) { - return new JavaBaseColumnTextRangeResolver(this, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java deleted file mode 100644 index ea3c1a97e2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBaseEmbeddedMapping.java +++ /dev/null @@ -1,319 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.AttributeOverride; -import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.Embeddable; -import org.eclipse.jpt.jpa.core.context.OverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaBaseEmbeddedMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEmbeddedIdMapping; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml embedded or embedded ID mapping - */ -public abstract class AbstractJavaBaseEmbeddedMapping - extends AbstractJavaAttributeMapping - implements JavaBaseEmbeddedMapping -{ - protected final JavaAttributeOverrideContainer attributeOverrideContainer; - - protected Embeddable targetEmbeddable; - - - protected AbstractJavaBaseEmbeddedMapping(JavaPersistentAttribute parent) { - super(parent); - this.attributeOverrideContainer = this.buildAttributeOverrideContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.attributeOverrideContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.attributeOverrideContainer.update(); - this.setTargetEmbeddable(this.buildTargetEmbeddable()); - } - - - // ********** attribute override container ********** - - public JavaAttributeOverrideContainer getAttributeOverrideContainer() { - return this.attributeOverrideContainer; - } - - protected JavaAttributeOverrideContainer buildAttributeOverrideContainer() { - return this.getJpaFactory().buildJavaAttributeOverrideContainer(this, this.buildAttributeOverrideContainerOwner()); - } - - protected JavaAttributeOverrideContainer.Owner buildAttributeOverrideContainerOwner() { - return new AttributeOverrideContainerOwner(); - } - - - // ********** target embeddable ********** - - public Embeddable getTargetEmbeddable() { - return this.targetEmbeddable; - } - - protected void setTargetEmbeddable(Embeddable embeddable) { - Embeddable old = this.targetEmbeddable; - this.targetEmbeddable = embeddable; - this.firePropertyChanged(TARGET_EMBEDDABLE_PROPERTY, old, embeddable); - } - - protected Embeddable buildTargetEmbeddable() { - return this.getPersistentAttribute().getEmbeddable(); - } - - - // ********** embedded mappings ********** - - @Override - public Iterator allOverridableAttributeMappingNames() { - return this.isJpa2_0Compatible() ? - this.embeddableOverridableAttributeMappingNames() : - super.allOverridableAttributeMappingNames(); - } - - protected Iterator embeddableOverridableAttributeMappingNames() { - return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER); - } - - @Override - public Iterator allOverridableAssociationMappingNames() { - return this.isJpa2_0Compatible() ? - this.embeddableOverridableAssociationMappingNames() : - super.allOverridableAssociationMappingNames(); - } - - protected Iterator embeddableOverridableAssociationMappingNames() { - return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER); - } - - protected Iterator qualifiedEmbeddableOverridableMappingNames(Transformer> transformer) { - return new TransformationIterator(this.embeddableAttributeMappingNames(transformer), this.buildQualifierTransformer()); - } - - protected Iterator embeddableAttributeMappingNames(Transformer> transformer) { - return new CompositeIterator(this.embeddableAttributeMappingNamesLists(transformer)); - } - - /** - * Return a list of lists; each nested list holds the names for one of the - * embedded mapping's target embeddable type mapping's attribute mappings - * (attribute or association mappings, depending on the specified transformer). - */ - protected Iterator> embeddableAttributeMappingNamesLists(Transformer> transformer) { - return new TransformationIterator>(this.embeddableAttributeMappings(), transformer); - } - - /** - * Return the target embeddable's attribute mappings. - */ - protected Iterator embeddableAttributeMappings() { - return ((this.targetEmbeddable != null) && (this.targetEmbeddable != this.getTypeMapping())) ? - this.targetEmbeddable.attributeMappings() : - EmptyIterator.instance(); - } - - - // ********** misc ********** - - @Override - public Column resolveOverriddenColumn(String attributeName) { - return this.isJpa2_0Compatible() ? this.resolveOverriddenColumn_(attributeName) : null; - } - - protected Column resolveOverriddenColumn_(String attributeName) { - attributeName = this.unqualify(attributeName); - if (attributeName == null) { - return null; - } - AttributeOverride override = this.attributeOverrideContainer.getSpecifiedOverrideNamed(attributeName); - // recurse into the target embeddable if necessary - return (override != null) ? override.getColumn() : this.resolveOverriddenColumnInTargetEmbeddable(attributeName); - } - - protected Column resolveOverriddenColumnInTargetEmbeddable(String attributeName) { - return (this.targetEmbeddable == null) ? null : this.targetEmbeddable.resolveOverriddenColumn(attributeName); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - result = this.attributeOverrideContainer.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - return null; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - - if (this.validateTargetEmbeddable(messages, astRoot)) { - this.validateOverrides(messages, reporter, astRoot); - } - } - - protected boolean validateTargetEmbeddable(List messages, CompilationUnit astRoot) { - if (this.targetEmbeddable != null) { - return true; - } - String targetEmbeddableTypeName = this.getPersistentAttribute().getTypeName(); - // if the type isn't resolvable, there will already be a java compile error - if (targetEmbeddableTypeName != null) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TARGET_NOT_AN_EMBEDDABLE, - new String[] {targetEmbeddableTypeName}, - this, - this.getValidationTextRange(astRoot) - ) - ); - } - return false; - } - - protected void validateOverrides(List messages, IReporter reporter, CompilationUnit astRoot) { - this.attributeOverrideContainer.validate(messages, reporter, astRoot); - } - - - // ********** attribute override container owner ********* - - protected class AttributeOverrideContainerOwner - implements JavaAttributeOverrideContainer.Owner - { - public JavaResourcePersistentMember getResourcePersistentMember() { - return AbstractJavaBaseEmbeddedMapping.this.getResourcePersistentAttribute(); - } - - public TypeMapping getTypeMapping() { - return AbstractJavaBaseEmbeddedMapping.this.getTypeMapping(); - } - - public TypeMapping getOverridableTypeMapping() { - return AbstractJavaBaseEmbeddedMapping.this.getTargetEmbeddable(); - } - - public Iterator allOverridableNames() { - TypeMapping typeMapping = this.getOverridableTypeMapping(); - return (typeMapping != null) ? this.allOverridableAttributeNames_(typeMapping) : EmptyIterator.instance(); - } - - /** - * pre-condition: type mapping is not null - *

- * NB: Overridden in {@link GenericOrmEmbeddedIdMapping.AttributeOverrideContainerOwner} - */ - protected Iterator allOverridableAttributeNames_(TypeMapping typeMapping) { - return typeMapping.allOverridableAttributeNames(); - } - - public Column resolveOverriddenColumn(String attributeName) { - return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getTypeMapping().tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return this.getTypeMapping().allAssociatedTableNames(); - } - - public Table resolveDbTable(String tableName) { - return this.getTypeMapping().resolveDbTable(tableName); - } - - public String getDefaultTableName() { - return this.getTypeMapping().getPrimaryTableName(); - } - - public String getPossiblePrefix() { - return null; - } - - public String getWritePrefix() { - return null; - } - - // no maps, so all overrides are relevant - public boolean isRelevant(String overrideName) { - return true; - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return AbstractJavaBaseEmbeddedMapping.this.getValidationTextRange(astRoot); - } - - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new AttributeOverrideValidator((AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) { - return new AttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider()); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java deleted file mode 100644 index 1fa555f9cb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMapping.java +++ /dev/null @@ -1,383 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.Association; -import org.eclipse.jpt.common.utility.internal.SimpleAssociation; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.FetchType; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaBasicMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaEnumeratedConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaLobConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaConverter; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java basic mapping - */ -public abstract class AbstractJavaBasicMapping - extends AbstractJavaAttributeMapping - implements JavaBasicMapping -{ - protected final JavaColumn column; - - protected FetchType specifiedFetch; - protected FetchType defaultFetch; - - protected Boolean specifiedOptional; - protected boolean defaultOptional; - - protected JavaConverter converter; // never null - - - protected static final JavaConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] { - JavaEnumeratedConverter.Adapter.instance(), - JavaTemporalConverter.Adapter.instance(), - JavaLobConverter.Adapter.instance() - }; - protected static final Iterable CONVERTER_ADAPTERS = new ArrayIterable(CONVERTER_ADAPTER_ARRAY); - - - protected AbstractJavaBasicMapping(JavaPersistentAttribute parent) { - super(parent); - this.column = this.buildColumn(); - this.specifiedFetch = this.buildSpecifiedFetch(); - this.specifiedOptional = this.buildSpecifiedOptional(); - this.converter = this.buildConverter(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.column.synchronizeWithResourceModel(); - this.setSpecifiedFetch_(this.buildSpecifiedFetch()); - this.setSpecifiedOptional_(this.buildSpecifiedOptional()); - this.syncConverter(); - } - - @Override - public void update() { - super.update(); - this.column.update(); - this.setDefaultFetch(this.buildDefaultFetch()); - this.setDefaultOptional(this.buildDefaultOptional()); - this.converter.update(); - } - - - // ********** column ********** - - public JavaColumn getColumn() { - return this.column; - } - - protected JavaColumn buildColumn() { - return this.getJpaFactory().buildJavaColumn(this, this); - } - - - // ********** fetch ********** - - public FetchType getFetch() { - return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch; - } - - public FetchType getSpecifiedFetch() { - return this.specifiedFetch; - } - - public void setSpecifiedFetch(FetchType fetch) { - if (this.valuesAreDifferent(fetch, this.specifiedFetch)) { - this.getAnnotationForUpdate().setFetch(FetchType.toJavaResourceModel(fetch)); - this.setSpecifiedFetch_(fetch); - } - } - - protected void setSpecifiedFetch_(FetchType fetch) { - FetchType old = this.specifiedFetch; - this.specifiedFetch = fetch; - this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch); - } - - protected FetchType buildSpecifiedFetch() { - BasicAnnotation annotation = this.getMappingAnnotation(); - return (annotation == null) ? null : FetchType.fromJavaResourceModel(annotation.getFetch()); - } - - public FetchType getDefaultFetch() { - return this.defaultFetch; - } - - protected void setDefaultFetch(FetchType fetch) { - FetchType old = this.defaultFetch; - this.defaultFetch = fetch; - this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch); - } - - protected FetchType buildDefaultFetch() { - return DEFAULT_FETCH_TYPE; - } - - - // ********** optional ********** - - public boolean isOptional() { - return (this.specifiedOptional != null) ? this.specifiedOptional.booleanValue() : this.isDefaultOptional(); - } - - public Boolean getSpecifiedOptional() { - return this.specifiedOptional; - } - - public void setSpecifiedOptional(Boolean optional) { - if (this.valuesAreDifferent(optional, this.specifiedOptional)) { - this.getAnnotationForUpdate().setOptional(optional); - this.setSpecifiedOptional_(optional); - } - } - - protected void setSpecifiedOptional_(Boolean optional) { - Boolean old = this.specifiedOptional; - this.specifiedOptional = optional; - this.firePropertyChanged(SPECIFIED_OPTIONAL_PROPERTY, old, optional); - } - - protected Boolean buildSpecifiedOptional() { - BasicAnnotation annotation = this.getMappingAnnotation(); - return (annotation == null) ? null : annotation.getOptional(); - } - - public boolean isDefaultOptional() { - return defaultOptional; - } - - protected void setDefaultOptional(boolean optional) { - boolean old = this.defaultOptional; - this.defaultOptional = optional; - this.firePropertyChanged(DEFAULT_OPTIONAL_PROPERTY, old, optional); - } - - protected boolean buildDefaultOptional() { - return DEFAULT_OPTIONAL; - } - - - // ********** converter ********** - - public JavaConverter getConverter() { - return this.converter; - } - - public void setConverter(Class converterType) { - if (this.converter.getType() != converterType) { - this.converter.dispose(); - JavaConverter.Adapter converterAdapter = this.getConverterAdapter(converterType); - this.retainConverterAnnotation(converterAdapter); - this.setConverter_(this.buildConverter(converterAdapter)); - } - } - - protected JavaConverter buildConverter(JavaConverter.Adapter converterAdapter) { - return (converterAdapter != null) ? - converterAdapter.buildNewConverter(this, this.getJpaFactory()) : - this.buildNullConverter(); - } - - protected void setConverter_(JavaConverter converter) { - Converter old = this.converter; - this.converter = converter; - this.firePropertyChanged(CONVERTER_PROPERTY, old, converter); - } - - /** - * Clear all the converter annotations except for the annotation - * corresponding to the specified adapter. If the specified adapter is - * null, remove all the converter annotations. - */ - protected void retainConverterAnnotation(JavaConverter.Adapter converterAdapter) { - JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute(); - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter != converterAdapter) { - adapter.removeConverterAnnotation(resourceAttribute); - } - } - } - - protected JavaConverter buildConverter() { - JpaFactory jpaFactory = this.getJpaFactory(); - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - JavaConverter javaConverter = adapter.buildConverter(this, jpaFactory); - if (javaConverter != null) { - return javaConverter; - } - } - return this.buildNullConverter(); - } - - protected void syncConverter() { - Association assoc = this.getConverterAnnotation(); - if (assoc == null) { - if (this.converter.getType() != null) { - this.setConverter_(this.buildNullConverter()); - } - } else { - JavaConverter.Adapter adapter = assoc.getKey(); - Annotation annotation = assoc.getValue(); - if ((this.converter.getType() == adapter.getConverterType()) && - (this.converter.getConverterAnnotation() == annotation)) { - this.converter.synchronizeWithResourceModel(); - } else { - this.setConverter_(adapter.buildConverter(annotation, this, this.getJpaFactory())); - } - } - } - - /** - * Return the first converter annotation we find along with its corresponding - * adapter. Return null if there are no converter annotations. - */ - protected Association getConverterAnnotation() { - JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute(); - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - Annotation annotation = adapter.getConverterAnnotation(resourceAttribute); - if (annotation != null) { - return new SimpleAssociation(adapter, annotation); - } - } - return null; - } - - protected JavaConverter buildNullConverter() { - return new NullJavaConverter(this); - } - - - // ********** converter adapters ********** - - /** - * Return the converter adapter for the specified converter type. - */ - protected JavaConverter.Adapter getConverterAdapter(Class converterType) { - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.getConverterType() == converterType) { - return adapter; - } - } - return null; - } - - protected Iterable getConverterAdapters() { - return CONVERTER_ADAPTERS; - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return BasicAnnotation.ANNOTATION_NAME; - } - - @Override - public boolean isOverridableAttributeMapping() { - return true; - } - - - // ********** JavaColumn.Owner implementation ********** - - public ColumnAnnotation getColumnAnnotation() { - return (ColumnAnnotation) this.getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME); - } - - public void removeColumnAnnotation() { - this.getResourcePersistentAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME); - } - - public String getDefaultColumnName() { - return this.getName(); - } - - public String getDefaultTableName() { - return this.getTypeMapping().getPrimaryTableName(); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getTypeMapping().tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return this.getTypeMapping().allAssociatedTableNames(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new NamedColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.column.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.converter.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - return null; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.column.validate(messages, reporter, astRoot); - this.converter.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMappingDefinition.java deleted file mode 100644 index e9db78d75f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaBasicMappingDefinition.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation; - -public abstract class AbstractJavaBasicMappingDefinition - implements DefaultJavaAttributeMappingDefinition -{ - protected AbstractJavaBasicMappingDefinition() { - super(); - } - - public String getKey() { - return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return BasicAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable getSupportingAnnotationNames() { - return SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - ColumnAnnotation.ANNOTATION_NAME, - LobAnnotation.ANNOTATION_NAME, - TemporalAnnotation.ANNOTATION_NAME, - EnumeratedAnnotation.ANNOTATION_NAME - }; - protected static final Iterable SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(SUPPORTING_ANNOTATION_NAMES_ARRAY); - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return factory.buildJavaBasicMapping(persistentAttribute); - } - - public boolean isDefault(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.typeIsBasic(); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddable.java deleted file mode 100644 index 991d67b0d2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddable.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation; - -/** - * Java embeddable type mapping - */ -public abstract class AbstractJavaEmbeddable - extends AbstractJavaTypeMapping - implements JavaEmbeddable -{ - protected AbstractJavaEmbeddable(JavaPersistentType parent, EmbeddableAnnotation mappingAnnotation) { - super(parent, mappingAnnotation); - } - - public String getKey() { - return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY; - } - - public JavaPersistentType getIdClass() { - return null; - } - - public boolean isMapped() { - return true; - } - - public boolean tableNameIsInvalid(String tableName) { - return false; - } - - @Override - public boolean validatesAgainstDatabase() { - return false; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java deleted file mode 100644 index 4460a740a3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEmbeddedMappingDefinition.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation; - -public abstract class AbstractJavaEmbeddedMappingDefinition - implements DefaultJavaAttributeMappingDefinition -{ - protected AbstractJavaEmbeddedMappingDefinition() { - super(); - } - - public String getKey() { - return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EmbeddedAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable getSupportingAnnotationNames() { - return SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - AttributeOverrideAnnotation.ANNOTATION_NAME, - AttributeOverridesAnnotation.ANNOTATION_NAME, - }; - protected static final Iterable SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(SUPPORTING_ANNOTATION_NAMES_ARRAY); - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return factory.buildJavaEmbeddedMapping(persistentAttribute); - } - - public boolean isDefault(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getEmbeddable() != null; - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java deleted file mode 100644 index 11157f3cb5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaEntity.java +++ /dev/null @@ -1,1816 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.NotNullFilter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.JpaPlatformVariation.Supported; -import org.eclipse.jpt.jpa.core.context.AssociationOverride; -import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.AttributeOverride; -import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.BaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.DiscriminatorColumn; -import org.eclipse.jpt.jpa.core.context.DiscriminatorType; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.InheritanceType; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.OverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyTable; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.SecondaryTable; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaDiscriminatorColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaEntity; -import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference; -import org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaQueryContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable; -import org.eclipse.jpt.jpa.core.context.java.JavaTable; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.EntityTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinTableValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.DiscriminatorColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityPrimaryKeyJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericEntityPrimaryKeyValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.MappedSuperclassOverrideDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.SecondaryTableValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.TableValidator; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullPrimaryKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.SingleRelationshipMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0; -import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.SecondaryTablesAnnotation; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java entity - */ -public abstract class AbstractJavaEntity - extends AbstractJavaTypeMapping - implements JavaEntity, JavaCacheableHolder2_0, JavaGeneratorContainer.Owner, JavaQueryContainer.Owner -{ - protected String specifiedName; - protected String defaultName; - - protected Entity rootEntity; - protected final Vector descendants = new Vector(); - - protected final JavaIdClassReference idClassReference; - - protected final JavaTable table; - protected boolean specifiedTableIsAllowed; - protected boolean tableIsUndefined; - - protected final Vector specifiedSecondaryTables = new Vector(); - protected final SpecifiedSecondaryTableContainerAdapter specifiedSecondaryTableContainerAdapter = new SpecifiedSecondaryTableContainerAdapter(); - protected final Table.Owner specifiedSecondaryTableOwner; - - protected final PrimaryKeyJoinColumnOwner primaryKeyJoinColumnOwner; - protected final Vector specifiedPrimaryKeyJoinColumns = new Vector(); - protected final SpecifiedPrimaryKeyJoinColumnContainerAdapter specifiedPrimaryKeyJoinColumnContainerAdapter = new SpecifiedPrimaryKeyJoinColumnContainerAdapter(); - protected JavaPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn; - - protected InheritanceType specifiedInheritanceStrategy; - protected InheritanceType defaultInheritanceStrategy; - - protected String specifiedDiscriminatorValue; - protected String defaultDiscriminatorValue; - protected boolean specifiedDiscriminatorValueIsAllowed; - protected boolean discriminatorValueIsUndefined; - - protected final JavaDiscriminatorColumn discriminatorColumn; - protected boolean specifiedDiscriminatorColumnIsAllowed; - protected boolean discriminatorColumnIsUndefined; - - protected final JavaAttributeOverrideContainer attributeOverrideContainer; - protected final JavaAssociationOverrideContainer associationOverrideContainer; - - protected final JavaGeneratorContainer generatorContainer; - protected final JavaQueryContainer queryContainer; - - - // ********** construction ********** - - protected AbstractJavaEntity(JavaPersistentType parent, EntityAnnotation mappingAnnotation) { - super(parent, mappingAnnotation); - this.specifiedName = this.mappingAnnotation.getName(); - this.idClassReference = this.buildIdClassReference(); - this.table = this.buildTable(); - this.specifiedSecondaryTableOwner = this.buildSpecifiedSecondaryTableOwner(); - this.initializeSpecifiedSecondaryTables(); - this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner(); - this.initializeSpecifiedPrimaryKeyJoinColumns(); - this.specifiedInheritanceStrategy = this.buildSpecifiedInheritanceStrategy(); - this.specifiedDiscriminatorValue = this.getDiscriminatorValueAnnotation().getValue(); - this.discriminatorColumn = this.buildDiscriminatorColumn(); - // start with the entity as the root - it will be recalculated in update() - this.rootEntity = this; - this.attributeOverrideContainer = this.buildAttributeOverrideContainer(); - this.associationOverrideContainer = this.buildAssociationOverrideContainer(); - this.generatorContainer = this.buildGeneratorContainer(); - this.queryContainer = this.buildQueryContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedName_(this.mappingAnnotation.getName()); - this.idClassReference.synchronizeWithResourceModel(); - this.table.synchronizeWithResourceModel(); - this.syncSpecifiedSecondaryTables(); - this.syncSpecifiedPrimaryKeyJoinColumns(); - this.setSpecifiedInheritanceStrategy_(this.buildSpecifiedInheritanceStrategy()); - this.setSpecifiedDiscriminatorValue_(this.getDiscriminatorValueAnnotation().getValue()); - this.discriminatorColumn.synchronizeWithResourceModel(); - this.attributeOverrideContainer.synchronizeWithResourceModel(); - this.associationOverrideContainer.synchronizeWithResourceModel(); - this.generatorContainer.synchronizeWithResourceModel(); - this.queryContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - - this.setDefaultName(this.buildDefaultName()); - - // calculate root entity early - other things depend on it - this.setRootEntity(this.buildRootEntity()); - this.updateDescendants(); - - this.idClassReference.update(); - - this.table.update(); - this.setSpecifiedTableIsAllowed(this.buildSpecifiedTableIsAllowed()); - this.setTableIsUndefined(this.buildTableIsUndefined()); - - this.updateNodes(this.getSecondaryTables()); - - this.updateDefaultPrimaryKeyJoinColumn(); - this.updateNodes(this.getPrimaryKeyJoinColumns()); - - this.setDefaultInheritanceStrategy(this.buildDefaultInheritanceStrategy()); - - this.setDefaultDiscriminatorValue(this.buildDefaultDiscriminatorValue()); - this.setSpecifiedDiscriminatorValueIsAllowed(this.buildSpecifiedDiscriminatorValueIsAllowed()); - this.setDiscriminatorValueIsUndefined(this.buildDiscriminatorValueIsUndefined()); - - this.discriminatorColumn.update(); - this.setSpecifiedDiscriminatorColumnIsAllowed(this.buildSpecifiedDiscriminatorColumnIsAllowed()); - this.setDiscriminatorColumnIsUndefined(this.buildDiscriminatorColumnIsUndefined()); - - this.attributeOverrideContainer.update(); - this.associationOverrideContainer.update(); - - this.generatorContainer.update(); - this.queryContainer.update(); - } - - - // ********** name ********** - - @Override - public String getName() { - return (this.specifiedName != null) ? this.specifiedName : this.defaultName; - } - - public String getSpecifiedName() { - return this.specifiedName; - } - - public void setSpecifiedName(String name) { - this.mappingAnnotation.setName(name); - this.setSpecifiedName_(name); - } - - protected void setSpecifiedName_(String name) { - String old = this.specifiedName; - this.specifiedName = name; - this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name); - } - - public String getDefaultName() { - return this.defaultName; - } - - protected void setDefaultName(String name) { - String old = this.defaultName; - this.defaultName = name; - this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name); - } - - protected String buildDefaultName() { - return this.getResourcePersistentType().getName(); - } - - - // ********** root entity ********** - - public Entity getRootEntity() { - return this.rootEntity; - } - - protected void setRootEntity(Entity entity) { - Entity old = this.rootEntity; - this.rootEntity = entity; - this.firePropertyChanged(ROOT_ENTITY_PROPERTY, old, entity); - } - - protected Entity buildRootEntity() { - Entity root = this; - for (TypeMapping typeMapping : this.getAncestors()) { - if (typeMapping instanceof Entity) { - root = (Entity) typeMapping; - } - } - return root; - } - - - // ********** descendants ********** - - public Iterable getDescendants() { - return new LiveCloneListIterable(this.descendants); - } - - protected void updateDescendants() { - this.synchronizeCollection(this.buildDescendants(), this.descendants, DESCENDANTS_COLLECTION); - } - - protected Iterable buildDescendants() { - return new FilteringIterable(this.getPersistenceUnit().getEntities()) { - @Override - protected boolean accept(Entity entity) { - return AbstractJavaEntity.this.entityIsDescendant(entity); - } - }; - } - - /** - * Return whether specified entity is a descendant of the entity. - */ - protected boolean entityIsDescendant(Entity entity) { - String typeName = this.getPersistentType().getName(); - String entityTypeName = entity.getPersistentType().getName(); - String rootEntityTypeName = entity.getRootEntity().getPersistentType().getName(); - return Tools.valuesAreDifferent(typeName, entityTypeName) && - Tools.valuesAreEqual(typeName, rootEntityTypeName); - } - - - // ********** id class ********** - - public JavaIdClassReference getIdClassReference() { - return this.idClassReference; - } - - protected JavaIdClassReference buildIdClassReference() { - return new GenericJavaIdClassReference(this); - } - - public JavaPersistentType getIdClass() { - return this.idClassReference.getIdClass(); - } - - - // ********** table ********** - - public JavaTable getTable() { - return this.table; - } - - protected JavaTable buildTable() { - return this.getJpaFactory().buildJavaTable(this, this.buildTableOwner()); - } - - protected JavaTable.Owner buildTableOwner() { - return new TableOwner(); - } - - public boolean specifiedTableIsAllowed() { - return this.specifiedTableIsAllowed; - } - - protected void setSpecifiedTableIsAllowed(boolean specifiedTableIsAllowed) { - boolean old = this.specifiedTableIsAllowed; - this.specifiedTableIsAllowed = specifiedTableIsAllowed; - this.firePropertyChanged(SPECIFIED_TABLE_IS_ALLOWED_PROPERTY, old, specifiedTableIsAllowed); - } - - protected boolean buildSpecifiedTableIsAllowed() { - return ! this.isAbstractTablePerClass() && ! this.isSingleTableDescendant(); - } - - public boolean tableIsUndefined() { - return this.tableIsUndefined; - } - - protected void setTableIsUndefined(boolean tableIsUndefined) { - boolean old = this.tableIsUndefined; - this.tableIsUndefined = tableIsUndefined; - this.firePropertyChanged(TABLE_IS_UNDEFINED_PROPERTY, old, tableIsUndefined); - } - - protected boolean buildTableIsUndefined() { - return this.isAbstractTablePerClass(); - } - - /** - *

- */ - public String getDefaultTableName() { - return this.isSingleTableDescendant() ? - this.rootEntity.getTable().getName() : - this.isAbstractTablePerClass() ? null : this.getName(); - } - - /** - * @see #getDefaultTableName() - */ - public String getDefaultSchema() { - return this.isSingleTableDescendant() ? - this.rootEntity.getTable().getSchema() : - this.isAbstractTablePerClass() ? null : this.getContextDefaultSchema(); - } - - /** - * @see #getDefaultTableName() - */ - public String getDefaultCatalog() { - return this.isSingleTableDescendant() ? - this.rootEntity.getTable().getCatalog() : - this.isAbstractTablePerClass() ? null : this.getContextDefaultCatalog(); - } - - - // ********** secondary tables ********** - - public ListIterator secondaryTables() { - return this.specifiedSecondaryTables(); - } - - protected ListIterable getSecondaryTables() { - return this.getSpecifiedSecondaryTables(); - } - - public int secondaryTablesSize() { - return this.specifiedSecondaryTablesSize(); - } - - - // ********** specified secondary tables ********** - - public ListIterator specifiedSecondaryTables() { - return this.getSpecifiedSecondaryTables().iterator(); - } - - protected ListIterable getSpecifiedSecondaryTables() { - return new LiveCloneListIterable(this.specifiedSecondaryTables); - } - - public int specifiedSecondaryTablesSize() { - return this.specifiedSecondaryTables.size(); - } - - public JavaSecondaryTable addSpecifiedSecondaryTable() { - return this.addSpecifiedSecondaryTable(this.specifiedSecondaryTables.size()); - } - - public JavaSecondaryTable addSpecifiedSecondaryTable(int index) { - SecondaryTableAnnotation annotation = this.buildSecondaryTableAnnotation(index); - return this.addSpecifiedSecondaryTable_(index, annotation); - } - - protected SecondaryTableAnnotation buildSecondaryTableAnnotation(int index) { - return (SecondaryTableAnnotation) this.getResourcePersistentType().addAnnotation(index, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); - } - - public void removeSpecifiedSecondaryTable(SecondaryTable secondaryTable) { - this.removeSpecifiedSecondaryTable(this.specifiedSecondaryTables.indexOf(secondaryTable)); - } - - public void removeSpecifiedSecondaryTable(int index) { - this.getResourcePersistentType().removeAnnotation(index, SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); - this.removeSpecifiedSecondaryTable_(index); - } - - protected void removeSpecifiedSecondaryTable_(int index) { - this.removeItemFromList(index, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST); - } - - public void moveSpecifiedSecondaryTable(int targetIndex, int sourceIndex) { - this.getResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, SecondaryTablesAnnotation.ANNOTATION_NAME); - this.moveItemInList(targetIndex, sourceIndex, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST); - } - - protected void initializeSpecifiedSecondaryTables() { - for (SecondaryTableAnnotation annotation : this.getSecondaryTableAnnotations()) { - this.specifiedSecondaryTables.add(this.buildSecondaryTable(annotation)); - } - } - - protected JavaSecondaryTable buildSecondaryTable(SecondaryTableAnnotation secondaryTableAnnotation) { - return this.getJpaFactory().buildJavaSecondaryTable(this, this.specifiedSecondaryTableOwner, secondaryTableAnnotation); - } - - protected void syncSpecifiedSecondaryTables() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedSecondaryTableContainerAdapter); - } - - protected Iterable getSecondaryTableAnnotations() { - return new SubIterableWrapper( - CollectionTools.iterable(this.secondaryTableAnnotations()) - ); - } - - protected Iterator secondaryTableAnnotations() { - return this.getResourceAnnotatedElement().annotations(SecondaryTableAnnotation.ANNOTATION_NAME, SecondaryTablesAnnotation.ANNOTATION_NAME); - } - - protected void moveSpecifiedSecondaryTable_(int index, JavaSecondaryTable secondaryTable) { - this.moveItemInList(index, secondaryTable, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST); - } - - protected JavaSecondaryTable addSpecifiedSecondaryTable_(int index, SecondaryTableAnnotation secondaryTableAnnotation) { - JavaSecondaryTable secondaryTable = this.buildSecondaryTable(secondaryTableAnnotation); - this.addItemToList(index, secondaryTable, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST); - return secondaryTable; - } - - protected void removeSpecifiedSecondaryTable_(JavaSecondaryTable secondaryTable) { - this.removeSpecifiedSecondaryTable_(this.specifiedSecondaryTables.indexOf(secondaryTable)); - } - - /** - * specified secondary table container adapter - */ - protected class SpecifiedSecondaryTableContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractJavaEntity.this.getSpecifiedSecondaryTables(); - } - public Iterable getResourceElements() { - return AbstractJavaEntity.this.getSecondaryTableAnnotations(); - } - public SecondaryTableAnnotation getResourceElement(JavaSecondaryTable contextElement) { - return contextElement.getTableAnnotation(); - } - public void moveContextElement(int index, JavaSecondaryTable element) { - AbstractJavaEntity.this.moveSpecifiedSecondaryTable_(index, element); - } - public void addContextElement(int index, SecondaryTableAnnotation resourceElement) { - AbstractJavaEntity.this.addSpecifiedSecondaryTable_(index, resourceElement); - } - public void removeContextElement(JavaSecondaryTable element) { - AbstractJavaEntity.this.removeSpecifiedSecondaryTable_(element); - } - } - - protected Table.Owner buildSpecifiedSecondaryTableOwner() { - return new SecondaryTableOwner(); - } - - - // ********** primary key join columns ********** - - public ListIterator primaryKeyJoinColumns() { - return this.getPrimaryKeyJoinColumns().iterator(); - } - - protected ListIterable getPrimaryKeyJoinColumns() { - return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns(); - } - - public int primaryKeyJoinColumnsSize() { - return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.defaultPrimaryKeyJoinColumnsSize(); - } - - - // ********** specified primary key join columns ********** - - public ListIterator specifiedPrimaryKeyJoinColumns() { - return this.getSpecifiedPrimaryKeyJoinColumns().iterator(); - } - - protected ListIterable getSpecifiedPrimaryKeyJoinColumns() { - return new LiveCloneListIterable(this.specifiedPrimaryKeyJoinColumns); - } - - public int specifiedPrimaryKeyJoinColumnsSize() { - return this.specifiedPrimaryKeyJoinColumns.size(); - } - - protected boolean hasSpecifiedPrimaryKeyJoinColumns() { - return this.specifiedPrimaryKeyJoinColumns.size() != 0; - } - - public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() { - return this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size()); - } - - public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) { - PrimaryKeyJoinColumnAnnotation annotation = this.buildPrimaryKeyJoinColumnAnnotation(index); - return this.addSpecifiedPrimaryKeyJoinColumn_(index, annotation); - } - - protected PrimaryKeyJoinColumnAnnotation buildPrimaryKeyJoinColumnAnnotation(int index) { - return (PrimaryKeyJoinColumnAnnotation) this.getResourcePersistentType().addAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); - } - - public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumn) { - this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(primaryKeyJoinColumn)); - } - - public void removeSpecifiedPrimaryKeyJoinColumn(int index) { - this.getResourcePersistentType().removeAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); - this.removeSpecifiedPrimaryKeyJoinColumn_(index); - } - - protected void removeSpecifiedPrimaryKeyJoinColumn_(int index) { - this.removeItemFromList(index, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) { - this.getResourcePersistentType().moveAnnotation(targetIndex, sourceIndex, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); - this.moveItemInList(targetIndex, sourceIndex, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - protected PrimaryKeyJoinColumnOwner buildPrimaryKeyJoinColumnOwner() { - return new PrimaryKeyJoinColumnOwner(); - } - - protected void initializeSpecifiedPrimaryKeyJoinColumns() { - for (PrimaryKeyJoinColumnAnnotation annotation : this.getPrimaryKeyJoinColumnAnnotations()) { - this.specifiedPrimaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(annotation)); - } - } - - protected JavaPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(PrimaryKeyJoinColumnAnnotation primaryKeyJoinColumnAnnotation) { - return this.getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, primaryKeyJoinColumnAnnotation); - } - - protected void syncSpecifiedPrimaryKeyJoinColumns() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedPrimaryKeyJoinColumnContainerAdapter); - } - - protected Iterable getPrimaryKeyJoinColumnAnnotations() { - return new SubIterableWrapper( - CollectionTools.iterable(this.primaryKeyJoinColumnAnnotations()) - ); - } - - protected Iterator primaryKeyJoinColumnAnnotations() { - return this.getResourceAnnotatedElement().annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); - } - - protected void moveSpecifiedPrimaryKeyJoinColumn_(int index, JavaPrimaryKeyJoinColumn primaryKeyJoinColumn) { - this.moveItemInList(index, primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - protected JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn_(int index, PrimaryKeyJoinColumnAnnotation primaryKeyJoinColumnAnnotation) { - JavaPrimaryKeyJoinColumn primaryKeyJoinColumn = this.buildPrimaryKeyJoinColumn(primaryKeyJoinColumnAnnotation); - this.addItemToList(index, primaryKeyJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - return primaryKeyJoinColumn; - } - - protected void removeSpecifiedPrimaryKeyJoinColumn_(JavaPrimaryKeyJoinColumn primaryKeyJoinColumn) { - this.removeSpecifiedPrimaryKeyJoinColumn_(this.specifiedPrimaryKeyJoinColumns.indexOf(primaryKeyJoinColumn)); - } - - /** - * specified primary key join column container adapter - */ - protected class SpecifiedPrimaryKeyJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractJavaEntity.this.getSpecifiedPrimaryKeyJoinColumns(); - } - public Iterable getResourceElements() { - return AbstractJavaEntity.this.getPrimaryKeyJoinColumnAnnotations(); - } - public PrimaryKeyJoinColumnAnnotation getResourceElement(JavaPrimaryKeyJoinColumn contextElement) { - return contextElement.getColumnAnnotation(); - } - public void moveContextElement(int index, JavaPrimaryKeyJoinColumn element) { - AbstractJavaEntity.this.moveSpecifiedPrimaryKeyJoinColumn_(index, element); - } - public void addContextElement(int index, PrimaryKeyJoinColumnAnnotation resourceElement) { - AbstractJavaEntity.this.addSpecifiedPrimaryKeyJoinColumn_(index, resourceElement); - } - public void removeContextElement(JavaPrimaryKeyJoinColumn element) { - AbstractJavaEntity.this.removeSpecifiedPrimaryKeyJoinColumn_(element); - } - } - - - // ********** default primary key join column ********** - - public JavaPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn() { - return this.defaultPrimaryKeyJoinColumn; - } - - protected void setDefaultPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn pkJoinColumn) { - JavaPrimaryKeyJoinColumn old = this.defaultPrimaryKeyJoinColumn; - this.defaultPrimaryKeyJoinColumn = pkJoinColumn; - this.firePropertyChanged(DEFAULT_PRIMARY_KEY_JOIN_COLUMN_PROPERTY, old, pkJoinColumn); - } - - protected ListIterable getDefaultPrimaryKeyJoinColumns() { - return (this.defaultPrimaryKeyJoinColumn != null) ? - new SingleElementListIterable(this.defaultPrimaryKeyJoinColumn) : - EmptyListIterable.instance(); - } - - protected int defaultPrimaryKeyJoinColumnsSize() { - return (this.defaultPrimaryKeyJoinColumn == null) ? 0 : 1; - } - - protected void updateDefaultPrimaryKeyJoinColumn() { - if (this.buildsDefaultPrimaryKeyJoinColumn()) { - if (this.defaultPrimaryKeyJoinColumn == null) { - this.setDefaultPrimaryKeyJoinColumn(this.buildDefaultPrimaryKeyJoinColumn()); - } else { - this.defaultPrimaryKeyJoinColumn.update(); - } - } else { - this.setDefaultPrimaryKeyJoinColumn(null); - } - } - - protected boolean buildsDefaultPrimaryKeyJoinColumn() { - return ! this.hasSpecifiedPrimaryKeyJoinColumns(); - } - - protected JavaPrimaryKeyJoinColumn buildDefaultPrimaryKeyJoinColumn() { - return this.buildPrimaryKeyJoinColumn(new NullPrimaryKeyJoinColumnAnnotation(this.getResourcePersistentType())); - } - - - // ********** inheritance strategy ********** - - public InheritanceType getInheritanceStrategy() { - return (this.specifiedInheritanceStrategy != null) ? this.specifiedInheritanceStrategy : this.defaultInheritanceStrategy; - } - - public InheritanceType getSpecifiedInheritanceStrategy() { - return this.specifiedInheritanceStrategy; - } - - public void setSpecifiedInheritanceStrategy(InheritanceType inheritanceType) { - if (this.valuesAreDifferent(this.specifiedInheritanceStrategy, inheritanceType)) { - this.getInheritanceAnnotation().setStrategy(InheritanceType.toJavaResourceModel(inheritanceType)); - this.removeInheritanceAnnotationIfUnset(); - this.setSpecifiedInheritanceStrategy_(inheritanceType); - } - } - - protected void setSpecifiedInheritanceStrategy_(InheritanceType inheritanceType) { - InheritanceType old = this.specifiedInheritanceStrategy; - this.specifiedInheritanceStrategy = inheritanceType; - this.firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, old, inheritanceType); - } - - protected InheritanceType buildSpecifiedInheritanceStrategy() { - return InheritanceType.fromJavaResourceModel(this.getInheritanceAnnotation().getStrategy()); - } - - public InheritanceType getDefaultInheritanceStrategy() { - return this.defaultInheritanceStrategy; - } - - protected void setDefaultInheritanceStrategy(InheritanceType inheritanceType) { - InheritanceType old = this.defaultInheritanceStrategy; - this.defaultInheritanceStrategy = inheritanceType; - this.firePropertyChanged(DEFAULT_INHERITANCE_STRATEGY_PROPERTY, old, inheritanceType); - } - - protected InheritanceType buildDefaultInheritanceStrategy() { - return this.isRoot() ? InheritanceType.SINGLE_TABLE : this.rootEntity.getInheritanceStrategy(); - } - - - // ********** inheritance annotation ********** - - protected InheritanceAnnotation getInheritanceAnnotation() { - return (InheritanceAnnotation) this.getResourcePersistentType().getNonNullAnnotation(InheritanceAnnotation.ANNOTATION_NAME); - } - - protected void removeInheritanceAnnotationIfUnset() { - if (this.getInheritanceAnnotation().isUnset()) { - this.removeInheritanceAnnotation(); - } - } - - protected void removeInheritanceAnnotation() { - this.getResourcePersistentType().removeAnnotation(InheritanceAnnotation.ANNOTATION_NAME); - } - - - // ********** discriminator value ********** - - public String getDiscriminatorValue() { - return (this.specifiedDiscriminatorValue != null) ? this.specifiedDiscriminatorValue : this.defaultDiscriminatorValue; - } - - public String getSpecifiedDiscriminatorValue() { - return this.specifiedDiscriminatorValue; - } - - public void setSpecifiedDiscriminatorValue(String discriminatorValue) { - if (this.valuesAreDifferent(this.specifiedDiscriminatorValue, discriminatorValue)) { - this.getDiscriminatorValueAnnotation().setValue(discriminatorValue); - this.removeDiscriminatorValueAnnotationIfUnset(); - this.setSpecifiedDiscriminatorValue_(discriminatorValue); - } - } - - protected void setSpecifiedDiscriminatorValue_(String discriminatorValue) { - String old = this.specifiedDiscriminatorValue; - this.specifiedDiscriminatorValue = discriminatorValue; - this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY, old, discriminatorValue); - } - - public String getDefaultDiscriminatorValue() { - return this.defaultDiscriminatorValue; - } - - protected void setDefaultDiscriminatorValue(String discriminatorValue) { - String old = this.defaultDiscriminatorValue; - this.defaultDiscriminatorValue = discriminatorValue; - this.firePropertyChanged(DEFAULT_DISCRIMINATOR_VALUE_PROPERTY, old, discriminatorValue); - } - - /** - * From the Spec: - * If the DiscriminatorValue annotation is not specified, a - * provider-specific function to generate a value representing - * the entity type is used for the value of the discriminator - * column. If the DiscriminatorType is STRING, the discriminator - * value default is the entity name. - */ - // TODO extension point for provider-specific function? - protected String buildDefaultDiscriminatorValue() { - if (this.discriminatorValueIsUndefined) { - return null; - } - return (this.getDiscriminatorType() == DiscriminatorType.STRING) ? this.getName() : null; - } - - protected DiscriminatorType getDiscriminatorType() { - return this.discriminatorColumn.getDiscriminatorType(); - } - - public boolean specifiedDiscriminatorValueIsAllowed() { - return this.specifiedDiscriminatorValueIsAllowed; - } - - protected void setSpecifiedDiscriminatorValueIsAllowed(boolean allowed) { - boolean old = this.specifiedDiscriminatorValueIsAllowed; - this.specifiedDiscriminatorValueIsAllowed = allowed; - this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_IS_ALLOWED_PROPERTY, old, allowed); - } - - protected boolean buildSpecifiedDiscriminatorValueIsAllowed() { - return ! this.isTablePerClass() && ! this.isAbstract(); - } - - public boolean discriminatorValueIsUndefined() { - return this.discriminatorValueIsUndefined; - } - - protected void setDiscriminatorValueIsUndefined(boolean undefined) { - boolean old = this.discriminatorValueIsUndefined; - this.discriminatorValueIsUndefined = undefined; - this.firePropertyChanged(DISCRIMINATOR_VALUE_IS_UNDEFINED_PROPERTY, old, undefined); - } - - protected boolean buildDiscriminatorValueIsUndefined() { - return this.isTablePerClass() || - this.isAbstract() || - this.isRootNoDescendantsNoStrategyDefined(); - } - - - // ********** discriminator value annotation ********** - - protected DiscriminatorValueAnnotation getDiscriminatorValueAnnotation() { - return (DiscriminatorValueAnnotation) this.getResourcePersistentType().getNonNullAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME); - } - - protected void removeDiscriminatorValueAnnotationIfUnset() { - if (this.getDiscriminatorValueAnnotation().isUnset()) { - this.removeDiscriminatorValueAnnotation(); - } - } - - protected void removeDiscriminatorValueAnnotation() { - this.getResourcePersistentType().removeAnnotation(DiscriminatorValueAnnotation.ANNOTATION_NAME); - } - - - // ********** discriminator column ********** - - public JavaDiscriminatorColumn getDiscriminatorColumn() { - return this.discriminatorColumn; - } - - protected JavaDiscriminatorColumn buildDiscriminatorColumn() { - return this.getJpaFactory().buildJavaDiscriminatorColumn(this, this.buildDiscriminatorColumnOwner()); - } - - protected JavaDiscriminatorColumn.Owner buildDiscriminatorColumnOwner() { - return new DiscriminatorColumnOwner(); - } - - public boolean specifiedDiscriminatorColumnIsAllowed() { - return this.specifiedDiscriminatorColumnIsAllowed; - } - - protected void setSpecifiedDiscriminatorColumnIsAllowed(boolean allowed) { - boolean old = this.specifiedDiscriminatorColumnIsAllowed; - this.specifiedDiscriminatorColumnIsAllowed = allowed; - this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_COLUMN_IS_ALLOWED_PROPERTY, old, allowed); - } - - protected boolean buildSpecifiedDiscriminatorColumnIsAllowed() { - return ! this.isTablePerClass() && this.isRoot(); - } - - public boolean discriminatorColumnIsUndefined() { - return this.discriminatorColumnIsUndefined; - } - - protected void setDiscriminatorColumnIsUndefined(boolean undefined) { - boolean old = this.discriminatorColumnIsUndefined; - this.discriminatorColumnIsUndefined = undefined; - this.firePropertyChanged(DISCRIMINATOR_COLUMN_IS_UNDEFINED_PROPERTY, old, undefined); - } - - protected boolean buildDiscriminatorColumnIsUndefined() { - return this.isTablePerClass() || - this.isRootNoDescendantsNoStrategyDefined(); - } - - - // ********** attribute override container ********** - - public JavaAttributeOverrideContainer getAttributeOverrideContainer() { - return this.attributeOverrideContainer; - } - - protected JavaAttributeOverrideContainer buildAttributeOverrideContainer() { - return this.getJpaFactory().buildJavaAttributeOverrideContainer(this, new AttributeOverrideContainerOwner()); - } - - public TypeMapping getOverridableTypeMapping() { - PersistentType superPersistentType = this.getPersistentType().getSuperPersistentType(); - return (superPersistentType == null) ? null : superPersistentType.getMapping(); - } - - - // ********** association override container ********** - - public JavaAssociationOverrideContainer getAssociationOverrideContainer() { - return this.associationOverrideContainer; - } - - protected JavaAssociationOverrideContainer buildAssociationOverrideContainer() { - return this.getJpaFactory().buildJavaAssociationOverrideContainer(this, new AssociationOverrideContainerOwner()); - } - - @Override - public Relationship resolveOverriddenRelationship(String attributeName) { - // check for an override before looking at attribute mappings - AssociationOverride override = this.associationOverrideContainer.getSpecifiedOverrideNamed(attributeName); - return (override != null) ? override.getRelationship() : super.resolveOverriddenRelationship(attributeName); - } - - - // ********** generator container ********** - - public JavaGeneratorContainer getGeneratorContainer() { - return this.generatorContainer; - } - - protected JavaGeneratorContainer buildGeneratorContainer() { - return this.getJpaFactory().buildJavaGeneratorContainer(this, this); - } - - public JavaResourcePersistentMember getResourceAnnotatedElement() { - return this.getResourcePersistentType(); - } - - - // ********** query container ********** - - public JavaQueryContainer getQueryContainer() { - return this.queryContainer; - } - - protected JavaQueryContainer buildQueryContainer() { - return this.getJpaFactory().buildJavaQueryContainer(this, this); - } - - - // ********** associated tables ********** - - @Override - public Iterator associatedTables() { - return this.getAssociatedTables().iterator(); - } - - public Iterable getAssociatedTables() { - return new CompositeIterable(this.table, this.getSecondaryTables()); - } - - @Override - public Iterator allAssociatedTables() { - return new CompositeIterator(this.allAssociatedTablesLists()); - } - - public Iterable getAllAssociatedTables() { - return CollectionTools.iterable(this.allAssociatedTables()); - } - - // TODO eliminate duplicate tables? - protected Iterator> allAssociatedTablesLists() { - return new TransformationIterator>(this.inheritanceHierarchy(), TypeMappingTools.ASSOCIATED_TABLES_TRANSFORMER); - } - - @Override - public Iterator allAssociatedTableNames() { - return this.getAllAssociatedTableNames().iterator(); - } - - public Iterable getAllAssociatedTableNames() { - return this.convertToNames(this.getAllAssociatedTables()); - } - - /** - * strip out null names - */ - protected Iterable convertToNames(Iterable tables) { - return new FilteringIterable(this.convertToNames_(tables), NotNullFilter.instance()); - } - - protected Iterable convertToNames_(Iterable tables) { - return new TransformationIterable(tables) { - @Override - protected String transform(ReadOnlyTable t) { - return t.getName(); - } - }; - } - - public boolean tableNameIsInvalid(String tableName) { - return ! this.tableNameIsValid(tableName); - } - - protected boolean tableNameIsValid(String tableName) { - return this.tableIsUndefined || CollectionTools.contains(this.getAllAssociatedTableNames(), tableName); - } - - - // ********** database ********** - - @Override - public String getPrimaryTableName() { - return this.table.getName(); - } - - @Override - public org.eclipse.jpt.jpa.db.Table getPrimaryDbTable() { - return this.table.getDbTable(); - } - - @Override - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - // matching database objects and identifiers is database platform-specific - return this.getDataSource().selectDatabaseObjectForIdentifier(this.getAllAssociatedDbTables(), tableName); - } - - /** - * strip out null db tables - */ - protected Iterable getAllAssociatedDbTables() { - return new FilteringIterable(this.getAllAssociatedDbTables_(), NotNullFilter.instance()); - } - - protected Iterable getAllAssociatedDbTables_() { - return new TransformationIterable(this.getAllAssociatedTables()) { - @Override - protected org.eclipse.jpt.jpa.db.Table transform(ReadOnlyTable entityTable) { - return entityTable.getDbTable(); - } - }; - } - - @Override - public Schema getDbSchema() { - return this.table.getDbSchema(); - } - - - // ********** primary key ********** - - public String getPrimaryKeyColumnName() { - return MappingTools.getPrimaryKeyColumnName(this); - } - - public PersistentAttribute getIdAttribute() { - Iterator idAttributeMappings = this.getAllAttributeMappings(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY).iterator(); - if (idAttributeMappings.hasNext()) { - PersistentAttribute attribute = idAttributeMappings.next().getPersistentAttribute(); - return idAttributeMappings.hasNext() ? null /*more than one*/: attribute; - } - return null; - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.ENTITY_TYPE_MAPPING_KEY; - } - - public boolean isMapped() { - return true; - } - - @Override - public JavaResourcePersistentType getResourcePersistentType() { - return super.getResourcePersistentType(); - } - - - // ********** attribute mappings ********** - - @Override - public Column resolveOverriddenColumn(String attributeName) { - // check for an override before looking at attribute mappings - AttributeOverride override = this.attributeOverrideContainer.getSpecifiedOverrideNamed(attributeName); - return (override != null) ? override.getColumn() : super.resolveOverriddenColumn(attributeName); - } - - @Override - public Iterator overridableAttributeNames() { - return this.isTablePerClass() ? - super.overridableAttributeNames() : - EmptyIterator.instance(); - } - - @Override - public Iterator overridableAssociationNames() { - return this.isTablePerClass() ? - super.overridableAssociationNames() : - EmptyIterator.instance(); - } - - public AttributeMapping resolveAttributeMapping(String name) { - for (AttributeMapping attributeMapping : CollectionTools.iterable(this.allAttributeMappings())) { - AttributeMapping resolvedMapping = attributeMapping.resolveAttributeMapping(name); - if (resolvedMapping != null) { - return resolvedMapping; - } - } - return null; - } - - - // ********** inheritance ********** - - public Entity getParentEntity() { - for (TypeMapping typeMapping : this.getAncestors()) { - if (typeMapping instanceof Entity) { - return (Entity) typeMapping; - } - } - return null; - } - - public boolean isRoot() { - return this == this.rootEntity; - } - - /** - * Return whether the entity is a descendant in (as opposed to the root of) - * an inheritance hierarchy. - */ - protected boolean isDescendant() { - return ! this.isRoot(); - } - - /** - * Return whether the entity is a descendant of the root entity - * of a "single table" inheritance hierarchy. - */ - protected boolean isSingleTableDescendant() { - return this.isDescendant() && - (this.getInheritanceStrategy() == InheritanceType.SINGLE_TABLE); - } - - /** - * Return whether the entity is the top of an inheritance hierarchy - * and has no descendants and no specified inheritance strategy has been defined. - */ - protected boolean isRootNoDescendantsNoStrategyDefined() { - return this.isRoot() && - this.descendants.isEmpty() && - (this.specifiedInheritanceStrategy == null); - } - - /** - * Return whether the entity is abstract and is a part of a - * "table per class" inheritance hierarchy. - */ - protected boolean isAbstractTablePerClass() { - return this.isAbstract() && this.isTablePerClass(); - } - - /** - * Return whether the entity is a part of a "table per class" - * inheritance hierarchy. - */ - protected boolean isTablePerClass() { - return this.getInheritanceStrategy() == InheritanceType.TABLE_PER_CLASS; - } - - /** - * Return whether the entity is a part of a "table per class" - * inheritance hierarchy. - */ - protected boolean isTablePerClassDescendant() { - return this.isTablePerClass() && this.isDescendant(); - } - - /** - * Return whether the type is abstract. - */ - protected boolean isAbstract() { - return this.getResourcePersistentType().isAbstract(); - } - - /** - * Return whether the entity's type is final. - */ - protected boolean isFinal() { - return this.getResourcePersistentType().isFinal(); - } - - /** - * Return whether the entity's type is a member of another type. - */ - protected boolean isMember() { - return this.getResourcePersistentType().isMemberType(); - } - - /** - * Return whether the entity's type is static. - */ - protected boolean isStatic() { - return this.getResourcePersistentType().isStatic(); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.table.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - for (JavaSecondaryTable secondaryTable : CollectionTools.iterable(this.secondaryTables())) { - result = secondaryTable.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - for (JavaPrimaryKeyJoinColumn pkJoinColumn : CollectionTools.iterable(this.primaryKeyJoinColumns())) { - result = pkJoinColumn.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - result = this.attributeOverrideContainer.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.associationOverrideContainer.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.discriminatorColumn.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.generatorContainer.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - return null; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - - this.validatePrimaryKey(messages, reporter, astRoot); - this.validateTable(messages, reporter, astRoot); - for (JavaSecondaryTable secondaryTable : this.getSecondaryTables()) { - secondaryTable.validate(messages, reporter, astRoot); - } - this.validateInheritance(messages, reporter, astRoot); - for (JavaPrimaryKeyJoinColumn pkJoinColumn : this.getPrimaryKeyJoinColumns()) { - pkJoinColumn.validate(messages, reporter, astRoot); - } - this.generatorContainer.validate(messages, reporter, astRoot); - this.queryContainer.validate(messages, reporter, astRoot); - this.attributeOverrideContainer.validate(messages, reporter, astRoot); - this.associationOverrideContainer.validate(messages, reporter, astRoot); - this.validateEntityName(messages, reporter, astRoot); - this.validateDuplicateEntityNames(messages, reporter, astRoot); - } - - @Override - public boolean validatesAgainstDatabase() { - return super.validatesAgainstDatabase() && ! this.isAbstractTablePerClass(); - } - - protected void validateEntityName(List messages, - IReporter reporter, CompilationUnit astRoot) { - if (StringTools.stringIsEmpty(this.getName())){ - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ENTITY_NAME_MISSING, - new String[] {this.getPersistentType().getName()}, - this, - this.getMappingAnnotation().getNameTextRange(astRoot) - ) - ); - } - } - - protected void validateDuplicateEntityNames(List messages, - IReporter reporter, CompilationUnit astRoot) { - HashBag javaEntityNamesExclOverridden = new HashBag(); - CollectionTools.addAll(javaEntityNamesExclOverridden, this.getPersistenceUnit().javaEntityNamesExclOverridden()); - HashBag ormEntityNames = new HashBag(); - CollectionTools.addAll(ormEntityNames, this.getPersistenceUnit().ormEntityNames()); - String javaEntityName = this.getName(); - if ((javaEntityName != null) - // Check whether or not this entity name has duplicates among - // the java entities that are not overridden by orm entities - && ((javaEntityNamesExclOverridden.count(javaEntityName) > 1) - //Check whether or not this entity name has duplicates - //with the names of orm entities - || (ormEntityNames.contains(javaEntityName)))) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENCE_UNIT_ENTITY_NAME_ATTRIBUTE_MISSING, - new String[] {javaEntityName}, - this, - this.getMappingAnnotation().getNameTextRange(astRoot) - ) - ); - } - } - - protected void validatePrimaryKey(List messages, IReporter reporter, CompilationUnit astRoot) { - this.buildPrimaryKeyValidator(astRoot).validate(messages, reporter); - } - - protected JptValidator buildPrimaryKeyValidator(CompilationUnit astRoot) { - return new GenericEntityPrimaryKeyValidator(this, this.buildTextRangeResolver(astRoot)); - } - - @Override - protected EntityTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) { - return new JavaEntityTextRangeResolver(this, astRoot); - } - - protected void validateTable(List messages, IReporter reporter, CompilationUnit astRoot) { - if (this.isAbstractTablePerClass()) { - if (this.table.isSpecifiedInResource()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE, - new String[] {this.getName()}, - this, - this.table.getValidationTextRange(astRoot) - ) - ); - } - return; - } - if (this.isSingleTableDescendant()) { - if (this.table.isSpecifiedInResource()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE, - new String[] {this.getName()}, - this, - this.table.getValidationTextRange(astRoot) - ) - ); - } - return; - } - this.table.validate(messages, reporter, astRoot); - } - - protected void validateInheritance(List messages, IReporter reporter, CompilationUnit astRoot) { - this.validateInheritanceStrategy(messages, astRoot); - this.validateDiscriminatorColumn(messages, reporter, astRoot); - this.validateDiscriminatorValue(messages, astRoot); - } - - protected void validateDiscriminatorColumn(List messages, IReporter reporter, CompilationUnit astRoot) { - if (this.specifiedDiscriminatorColumnIsAllowed && ! this.discriminatorColumnIsUndefined) { - this.discriminatorColumn.validate(messages, reporter, astRoot); - } - else if (this.discriminatorColumn.isResourceSpecified()) { - if (this.isDescendant()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ENTITY_NON_ROOT_DISCRIMINATOR_COLUMN_DEFINED, - new String[] {this.getName()}, - this, - this.getDiscriminatorColumnTextRange(astRoot) - ) - ); - } - else if (this.isTablePerClass()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_COLUMN_DEFINED, - new String[] {this.getName()}, - this, - this.getDiscriminatorColumnTextRange(astRoot) - ) - ); - } - } - } - - protected void validateDiscriminatorValue(List messages, CompilationUnit astRoot) { - if (this.discriminatorValueIsUndefined && (this.specifiedDiscriminatorValue != null)) { - if (this.isAbstract()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - JpaValidationMessages.ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED, - new String[] {this.getName()}, - this, - this.getDiscriminatorValueTextRange(astRoot) - ) - ); - } - else if (this.isTablePerClass()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - JpaValidationMessages.ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_VALUE_DEFINED, - new String[] {this.getName()}, - this, - this.getDiscriminatorValueTextRange(astRoot) - ) - ); - } - } - } - - protected void validateInheritanceStrategy(List messages, CompilationUnit astRoot) { - Supported tablePerConcreteClassInheritanceIsSupported = this.getJpaPlatformVariation().getTablePerConcreteClassInheritanceIsSupported(); - if (tablePerConcreteClassInheritanceIsSupported == Supported.YES) { - return; - } - if ((this.getInheritanceStrategy() == InheritanceType.TABLE_PER_CLASS) && this.isRoot()) { - if (tablePerConcreteClassInheritanceIsSupported == Supported.NO) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ENTITY_TABLE_PER_CLASS_NOT_SUPPORTED_ON_PLATFORM, - new String[] {this.getName()}, - this, - this.getInheritanceStrategyTextRange(astRoot) - ) - ); - } - else { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - JpaValidationMessages.ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM, - new String[] {this.getName()}, - this, - this.getInheritanceStrategyTextRange(astRoot) - ) - ); - } - } - } - - protected TextRange getDiscriminatorValueTextRange(CompilationUnit astRoot) { - return this.getDiscriminatorValueAnnotation().getTextRange(astRoot); - } - - protected TextRange getDiscriminatorColumnTextRange(CompilationUnit astRoot) { - return this.discriminatorColumn.getValidationTextRange(astRoot); - } - - protected TextRange getInheritanceStrategyTextRange(CompilationUnit astRoot) { - return this.getInheritanceAnnotation().getStrategyTextRange(astRoot); - } - - - // ********** OrmOverrideContainer.Owner implementation ********** - - /** - * some common behavior - */ - protected abstract class OverrideContainerOwner - implements JavaOverrideContainer.Owner - { - public JavaResourcePersistentMember getResourcePersistentMember() { - return AbstractJavaEntity.this.getResourcePersistentType(); - } - - public JavaTypeMapping getTypeMapping() { - return AbstractJavaEntity.this; - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return AbstractJavaEntity.this.getValidationTextRange(astRoot); - } - - public TypeMapping getOverridableTypeMapping() { - return AbstractJavaEntity.this.getOverridableTypeMapping(); - } - - public Iterator allOverridableNames() { - TypeMapping typeMapping = this.getOverridableTypeMapping(); - return (typeMapping != null) ? this.allOverridableNames_(typeMapping) : EmptyIterator.instance(); - } - - /** - * pre-condition: typeMapping is not null - */ - protected abstract Iterator allOverridableNames_(TypeMapping typeMapping); - - public String getDefaultTableName() { - return AbstractJavaEntity.this.getPrimaryTableName(); - } - - public boolean tableNameIsInvalid(String tableName) { - return AbstractJavaEntity.this.tableNameIsInvalid(tableName); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return AbstractJavaEntity.this.resolveDbTable(tableName); - } - - public Iterator candidateTableNames() { - return AbstractJavaEntity.this.allAssociatedTableNames(); - } - - public String getPossiblePrefix() { - return null; - } - - public String getWritePrefix() { - return null; - } - - // no maps, so all overrides are relevant - public boolean isRelevant(String overrideName) { - return true; - } - - } - - - // ********** JavaAttributeOverrideContainer.Owner implementation ********** - - protected class AttributeOverrideContainerOwner - extends OverrideContainerOwner - implements JavaAttributeOverrideContainer.Owner - { - @Override - protected Iterator allOverridableNames_(TypeMapping typeMapping) { - final Collection mappedByRelationshipAttributes = CollectionTools.collection( - new TransformationIterator(this.getMapsIdRelationships()) { - @Override - protected String transform(SingleRelationshipMapping2_0 mapping) { - return mapping.getDerivedIdentity().getMapsIdDerivedIdentityStrategy().getValue(); - } - }); - return new FilteringIterator(typeMapping.allOverridableAttributeNames()) { - @Override - protected boolean accept(String name) { - if (mappedByRelationshipAttributes.isEmpty()) { - return true; - } - // overridable names are (usually?) qualified with a container mapping, - // which may also be the one mapped by a relationship - int index = name.indexOf('.'); - String qualifier = (index > 0) ? name.substring(0, index) : name; - return ! mappedByRelationshipAttributes.contains(qualifier); - } - }; - } - - protected Iterable getMapsIdRelationships() { - return new FilteringIterable(this.getSingleRelationshipMappings()) { - @Override - protected boolean accept(SingleRelationshipMapping2_0 mapping) { - return mapping.getDerivedIdentity().usesMapsIdDerivedIdentityStrategy(); - } - }; - } - - protected Iterable getSingleRelationshipMappings() { - return new SubIterableWrapper(this.getSingleRelationshipMappings_()); - } - - @SuppressWarnings("unchecked") - protected Iterable getSingleRelationshipMappings_() { - return new CompositeIterable( - this.getTypeMapping().getAllAttributeMappings(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY), - this.getTypeMapping().getAllAttributeMappings(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) - ); - } - public Column resolveOverriddenColumn(String attributeName) { - return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName); - } - - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new AttributeOverrideValidator((AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new MappedSuperclassOverrideDescriptionProvider()); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) { - return new AttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider()); - } - } - - - // ********** JavaAssociationOverrideContainer.Owner implementation ********** - - protected class AssociationOverrideContainerOwner - extends OverrideContainerOwner - implements JavaAssociationOverrideContainer.Owner - { - @Override - protected Iterator allOverridableNames_(TypeMapping typeMapping) { - return typeMapping.allOverridableAssociationNames(); - } - - public Relationship resolveOverriddenRelationship(String attributeName) { - return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName); - } - - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new AssociationOverrideValidator((AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new MappedSuperclassOverrideDescriptionProvider()); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); - } - - public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); - } - - public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideInverseJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); - } - - public JptValidator buildTableValidator(AssociationOverride override, Table t, TableTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinTableValidator(override, (JoinTable) t, textRangeResolver); - } - } - - - // ********** JavaNamedColumn.Owner implementation ********** - - /** - * some common behavior - */ - protected abstract class NamedColumnOwner - implements JavaNamedColumn.Owner - { - public TypeMapping getTypeMapping() { - return AbstractJavaEntity.this; - } - - public String getDefaultTableName() { - return AbstractJavaEntity.this.getPrimaryTableName(); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return AbstractJavaEntity.this.resolveDbTable(tableName); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return AbstractJavaEntity.this.getValidationTextRange(astRoot); - } - } - - - // ********** JavaBaseJoinColumn.Owner implementation ********** - - protected class PrimaryKeyJoinColumnOwner - extends NamedColumnOwner - implements JavaBaseJoinColumn.Owner - { - public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() { - Entity parentEntity = AbstractJavaEntity.this.getParentEntity(); - return (parentEntity == null) ? null : parentEntity.getPrimaryDbTable(); - } - - public int joinColumnsSize() { - return AbstractJavaEntity.this.primaryKeyJoinColumnsSize(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return AbstractJavaEntity.this.defaultPrimaryKeyJoinColumn == joinColumn; - } - - public String getDefaultColumnName() { - if (this.joinColumnsSize() != 1) { - return null; - } - Entity parentEntity = AbstractJavaEntity.this.getParentEntity(); - return (parentEntity == null) ? AbstractJavaEntity.this.getPrimaryKeyColumnName() : parentEntity.getPrimaryKeyColumnName(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new EntityPrimaryKeyJoinColumnValidator((BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver); - } - } - - - // ********** JavaDiscriminatorColumn.Owner implementation ********** - - protected class DiscriminatorColumnOwner - extends NamedColumnOwner - implements JavaDiscriminatorColumn.Owner - { - public String getDefaultColumnName() { - return this.isDescendant() ? - this.getRootDiscriminatorColumn().getName() : - this.discriminatorColumnIsUndefined() ? null : DiscriminatorColumn.DEFAULT_NAME; - } - - public int getDefaultLength() { - return this.isDescendant() ? - this.getRootDiscriminatorColumn().getLength() : - this.discriminatorColumnIsUndefined() ? 0 : DiscriminatorColumn.DEFAULT_LENGTH; - } - - public DiscriminatorType getDefaultDiscriminatorType() { - return this.isDescendant() ? - this.getRootDiscriminatorColumn().getDiscriminatorType() : - this.discriminatorColumnIsUndefined() ? null : DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE; - } - - protected boolean isDescendant() { - return AbstractJavaEntity.this.isDescendant(); - } - - protected DiscriminatorColumn getRootDiscriminatorColumn() { - return AbstractJavaEntity.this.rootEntity.getDiscriminatorColumn(); - } - - protected boolean discriminatorColumnIsUndefined() { - return AbstractJavaEntity.this.discriminatorColumnIsUndefined; - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new DiscriminatorColumnValidator(column, textRangeResolver); - } - } - - - // ********** table owner ********** - - protected class TableOwner implements Table.Owner { - public JptValidator buildTableValidator(Table t, TableTextRangeResolver textRangeResolver) { - return new TableValidator(t, textRangeResolver); - } - } - - - // ********** secondary table owner ********** - - protected class SecondaryTableOwner implements Table.Owner { - public JptValidator buildTableValidator(Table t, TableTextRangeResolver textRangeResolver) { - return new SecondaryTableValidator((SecondaryTable) t, textRangeResolver); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java deleted file mode 100644 index cc79849d49..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaGenerator.java +++ /dev/null @@ -1,225 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Generator; -import org.eclipse.jpt.jpa.core.context.java.JavaGenerator; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.resource.java.GeneratorAnnotation; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; - -/** - * Java sequence or table generator - */ -public abstract class AbstractJavaGenerator - extends AbstractJavaJpaContextNode - implements JavaGenerator -{ - protected final A generatorAnnotation; - - protected String name; - - protected Integer specifiedInitialValue; - protected int defaultInitialValue; - - protected Integer specifiedAllocationSize; - protected int defaultAllocationSize; - - - protected AbstractJavaGenerator(JavaJpaContextNode parent, A generatorAnnotation) { - super(parent); - this.generatorAnnotation = generatorAnnotation; - this.name = generatorAnnotation.getName(); - this.specifiedInitialValue = generatorAnnotation.getInitialValue(); - this.specifiedAllocationSize = generatorAnnotation.getAllocationSize(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setName_(this.generatorAnnotation.getName()); - this.setSpecifiedInitialValue_(this.generatorAnnotation.getInitialValue()); - this.setSpecifiedAllocationSize_(this.generatorAnnotation.getAllocationSize()); - } - - @Override - public void update() { - super.update(); - this.setDefaultInitialValue(this.buildDefaultInitialValue()); - this.setDefaultAllocationSize(this.buildDefaultAllocationSize()); - this.getPersistenceUnit().addGenerator(this); - } - - - // ********** name ********** - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.generatorAnnotation.setName(name); - this.setName_(name); - } - - protected void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - - // ********** initial value ********** - - public int getInitialValue() { - return (this.specifiedInitialValue != null) ? this.specifiedInitialValue.intValue() : this.defaultInitialValue; - } - - public Integer getSpecifiedInitialValue() { - return this.specifiedInitialValue; - } - - public void setSpecifiedInitialValue(Integer value) { - this.generatorAnnotation.setInitialValue(value); - this.setSpecifiedInitialValue_(value); - } - - protected void setSpecifiedInitialValue_(Integer value) { - Integer old = this.specifiedInitialValue; - this.specifiedInitialValue = value; - this.firePropertyChanged(SPECIFIED_INITIAL_VALUE_PROPERTY, old, value); - } - - public int getDefaultInitialValue() { - return this.defaultInitialValue; - } - - protected void setDefaultInitialValue(int value) { - int old = this.defaultInitialValue; - this.defaultInitialValue = value; - this.firePropertyChanged(DEFAULT_INITIAL_VALUE_PROPERTY, old, value); - } - - protected abstract int buildDefaultInitialValue(); - - - // ********** allocation size ********** - - public int getAllocationSize() { - return (this.specifiedAllocationSize != null) ? this.specifiedAllocationSize.intValue() : this.defaultAllocationSize; - } - - public Integer getSpecifiedAllocationSize() { - return this.specifiedAllocationSize; - } - - public void setSpecifiedAllocationSize(Integer size) { - this.generatorAnnotation.setAllocationSize(size); - this.setSpecifiedAllocationSize_(size); - } - - protected void setSpecifiedAllocationSize_(Integer size) { - Integer old = this.specifiedAllocationSize; - this.specifiedAllocationSize = size; - this.firePropertyChanged(SPECIFIED_ALLOCATION_SIZE_PROPERTY, old, size); - } - - public int getDefaultAllocationSize() { - return this.defaultAllocationSize; - } - - protected void setDefaultAllocationSize(int size) { - int old = this.defaultAllocationSize; - this.defaultAllocationSize = size; - this.firePropertyChanged(DEFAULT_ALLOCATION_SIZE_PROPERTY, old, size); - } - - protected int buildDefaultAllocationSize() { - return DEFAULT_ALLOCATION_SIZE; - } - - - // ********** text ranges ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getSelectionTextRange(astRoot); - } - - public TextRange getSelectionTextRange(CompilationUnit astRoot) { - return this.generatorAnnotation.getTextRange(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.generatorAnnotation.getNameTextRange(astRoot); - } - - - // ********** database stuff ********** - - public Schema getDbSchema() { - SchemaContainer dbSchemaContainer = this.getDbSchemaContainer(); - return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema()); - } - - /** - * If we don't have a catalog (i.e. we don't even have a default catalog), - * then the database probably does not support catalogs; and we need to - * get the schema directly from the database. - */ - public SchemaContainer getDbSchemaContainer() { - String catalog = this.getCatalog(); - return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase(); - } - - protected abstract String getSchema(); - - /** - * If we don't have a catalog (i.e. we don't even have a default - * catalog), then the database probably does not support catalogs. - */ - public Catalog getDbCatalog() { - String catalog = this.getCatalog(); - return (catalog == null) ? null : this.resolveDbCatalog(catalog); - } - - protected abstract String getCatalog(); - - - // ********** JpaNamedContextNode implementation ********** - - public boolean overrides(Generator other) { - return MappingTools.nodeOverrides(this, other, PRECEDENCE_TYPE_LIST); - } - - public boolean duplicates(Generator other) { - return MappingTools.nodesAreDuplicates(this, other); - } - - - // ********** misc ********** - - public A getGeneratorAnnotation() { - return this.generatorAnnotation; - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java deleted file mode 100644 index ac83d194a1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMapping.java +++ /dev/null @@ -1,476 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.Association; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.SimpleAssociation; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaGeneratedValue; -import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaConverter; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.IdMapping2_0; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java ID mapping - */ -public abstract class AbstractJavaIdMapping - extends AbstractJavaAttributeMapping - implements JavaIdMapping, IdMapping2_0 -{ - protected final JavaColumn column; - - protected final JavaGeneratorContainer generatorContainer; - - protected JavaGeneratedValue generatedValue; - - protected JavaConverter converter; // never null - - /* 2.0 feature - a relationship may map this id */ - protected boolean mappedByRelationship; - - - protected static final JavaConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] { - JavaTemporalConverter.Adapter.instance(), - }; - protected static final Iterable CONVERTER_ADAPTERS = new ArrayIterable(CONVERTER_ADAPTER_ARRAY); - - - protected AbstractJavaIdMapping(JavaPersistentAttribute parent) { - super(parent); - this.column = this.buildColumn(); - this.generatorContainer = this.buildGeneratorContainer(); - this.generatedValue = this.buildGeneratedValue(); - this.converter = this.buildConverter(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.column.synchronizeWithResourceModel(); - this.generatorContainer.synchronizeWithResourceModel(); - this.syncGeneratedValue(); - this.syncConverter(); - } - - @Override - public void update() { - super.update(); - this.column.update(); - this.generatorContainer.update(); - if (this.generatedValue != null) { - this.generatedValue.update(); - } - this.converter.update(); - this.setMappedByRelationship(this.buildMappedByRelationship()); - } - - - // ********** column ********** - - public JavaColumn getColumn() { - return this.column; - } - - protected JavaColumn buildColumn() { - return this.getJpaFactory().buildJavaColumn(this, this); - } - - - // ********** generator container ********** - - public JavaGeneratorContainer getGeneratorContainer() { - return this.generatorContainer; - } - - private JavaGeneratorContainer buildGeneratorContainer() { - return this.getJpaFactory().buildJavaGeneratorContainer(this, this); - } - - - // ********** generated value ********** - - public JavaGeneratedValue getGeneratedValue() { - return this.generatedValue; - } - - public JavaGeneratedValue addGeneratedValue() { - if (this.generatedValue != null) { - throw new IllegalStateException("generated value already exists: " + this.generatedValue); //$NON-NLS-1$ - } - GeneratedValueAnnotation annotation = this.buildGeneratedValueAnnotation(); - JavaGeneratedValue value = this.buildGeneratedValue(annotation); - this.setGeneratedValue(value); - return value; - } - - protected GeneratedValueAnnotation buildGeneratedValueAnnotation() { - return (GeneratedValueAnnotation) this.getResourcePersistentAttribute().addAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME); - } - - public void removeGeneratedValue() { - if (this.generatedValue == null) { - throw new IllegalStateException("generated value does not exist"); //$NON-NLS-1$ - } - this.getResourcePersistentAttribute().removeAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME); - this.setGeneratedValue(null); - } - - protected JavaGeneratedValue buildGeneratedValue() { - GeneratedValueAnnotation annotation = this.getGeneratedValueAnnotation(); - return (annotation == null) ? null : this.buildGeneratedValue(annotation); - } - - protected GeneratedValueAnnotation getGeneratedValueAnnotation() { - return (GeneratedValueAnnotation) this.getResourcePersistentAttribute().getAnnotation(GeneratedValueAnnotation.ANNOTATION_NAME); - } - - protected JavaGeneratedValue buildGeneratedValue(GeneratedValueAnnotation generatedValueAnnotation) { - return this.getJpaFactory().buildJavaGeneratedValue(this, generatedValueAnnotation); - } - - protected void syncGeneratedValue() { - GeneratedValueAnnotation annotation = this.getGeneratedValueAnnotation(); - if (annotation == null) { - if (this.generatedValue != null) { - this.setGeneratedValue(null); - } - } - else { - if ((this.generatedValue != null) && (this.generatedValue.getGeneratedValueAnnotation() == annotation)) { - this.generatedValue.synchronizeWithResourceModel(); - } else { - this.setGeneratedValue(this.buildGeneratedValue(annotation)); - } - } - } - - protected void setGeneratedValue(JavaGeneratedValue value) { - JavaGeneratedValue old = this.generatedValue; - this.generatedValue = value; - this.firePropertyChanged(GENERATED_VALUE_PROPERTY, old, value); - } - - - // ********** converter ********** - - public JavaConverter getConverter() { - return this.converter; - } - - public void setConverter(Class converterType) { - if (this.converter.getType() != converterType) { - this.converter.dispose(); - JavaConverter.Adapter converterAdapter = this.getConverterAdapter(converterType); - this.retainConverterAnnotation(converterAdapter); - this.setConverter_(this.buildConverter(converterAdapter)); - } - } - - protected JavaConverter buildConverter(JavaConverter.Adapter converterAdapter) { - return (converterAdapter != null) ? - converterAdapter.buildNewConverter(this, this.getJpaFactory()) : - this.buildNullConverter(); - } - - protected void setConverter_(JavaConverter converter) { - Converter old = this.converter; - this.converter = converter; - this.firePropertyChanged(CONVERTER_PROPERTY, old, converter); - } - - /** - * Clear all the converter annotations except for the annotation - * corresponding to the specified adapter. If the specified adapter is - * null, remove all the converter annotations. - */ - protected void retainConverterAnnotation(JavaConverter.Adapter converterAdapter) { - JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute(); - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter != converterAdapter) { - adapter.removeConverterAnnotation(resourceAttribute); - } - } - } - - protected JavaConverter buildConverter() { - JpaFactory jpaFactory = this.getJpaFactory(); - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - JavaConverter javaConverter = adapter.buildConverter(this, jpaFactory); - if (javaConverter != null) { - return javaConverter; - } - } - return this.buildNullConverter(); - } - - protected void syncConverter() { - Association assoc = this.getConverterAnnotation(); - if (assoc == null) { - if (this.converter.getType() != null) { - this.setConverter_(this.buildNullConverter()); - } - } else { - JavaConverter.Adapter adapter = assoc.getKey(); - Annotation annotation = assoc.getValue(); - if ((this.converter.getType() == adapter.getConverterType()) && - (this.converter.getConverterAnnotation() == annotation)) { - this.converter.synchronizeWithResourceModel(); - } else { - this.setConverter_(adapter.buildConverter(annotation, this, this.getJpaFactory())); - } - } - } - - /** - * Return the first converter annotation we find along with its corresponding - * adapter. Return null if there are no converter annotations. - */ - protected Association getConverterAnnotation() { - JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute(); - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - Annotation annotation = adapter.getConverterAnnotation(resourceAttribute); - if (annotation != null) { - return new SimpleAssociation(adapter, annotation); - } - } - return null; - } - - protected JavaConverter buildNullConverter() { - return new NullJavaConverter(this); - } - - - // ********** converter adapters ********** - - /** - * Return the converter adapter for the specified converter type. - */ - protected JavaConverter.Adapter getConverterAdapter(Class converterType) { - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.getConverterType() == converterType) { - return adapter; - } - } - return null; - } - - protected Iterable getConverterAdapters() { - return CONVERTER_ADAPTERS; - } - - - // ********** mapped by relationship ********** - - public boolean isMappedByRelationship() { - return this.mappedByRelationship; - } - - protected void setMappedByRelationship(boolean mappedByRelationship) { - boolean old = this.mappedByRelationship; - this.mappedByRelationship = mappedByRelationship; - this.firePropertyChanged(MAPPED_BY_RELATIONSHIP_PROPERTY, old, mappedByRelationship); - } - - protected boolean buildMappedByRelationship() { - return this.isJpa2_0Compatible() && this.buildMappedByRelationship_(); - } - - protected boolean buildMappedByRelationship_() { - return CollectionTools.contains(this.getMappedByRelationshipAttributeNames(), this.getName()); - } - - protected Iterable getMappedByRelationshipAttributeNames() { - return TypeMappingTools.getMappedByRelationshipAttributeNames(this.getTypeMapping()); - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return IdAnnotation.ANNOTATION_NAME; - } - - @Override - public String getPrimaryKeyColumnName() { - return this.column.getName(); - } - - protected boolean columnIsSpecified() { - return this.getResourcePersistentAttribute().getAnnotation(ColumnAnnotation.ANNOTATION_NAME) != null; - } - - @Override - public boolean isOverridableAttributeMapping() { - return true; - } - - - // ********** JavaGeneratorContainer implementation ********** - - public JavaResourcePersistentMember getResourceAnnotatedElement() { - return this.getResourcePersistentAttribute(); - } - - - // ********** JavaColumn.Owner implementation ********** - - public ColumnAnnotation getColumnAnnotation() { - return (ColumnAnnotation) this.getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME); - } - - public void removeColumnAnnotation() { - this.getResourcePersistentAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME); - } - - public String getDefaultColumnName() { - return (this.mappedByRelationship && ! this.columnIsSpecified()) ? null : this.getName(); - } - - public String getDefaultTableName() { - return (this.mappedByRelationship && ! this.columnIsSpecified()) ? null : this.getTypeMapping().getPrimaryTableName(); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getTypeMapping().tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return this.getTypeMapping().allAssociatedTableNames(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new NamedColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - result = this.column.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - result = this.generatorContainer.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - if (this.generatedValue != null) { - result = this.generatedValue.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - - result = this.converter.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - return null; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - - // [JPA 2.0] if the column is specified, or if the id is not mapped by a relationship, - // then the column is validated. - // (In JPA 1.0, the column will always be validated, since the id is never mapped by a - // relationship) - if (this.columnIsSpecified() || ! this.mappedByRelationship) { - this.column.validate(messages, reporter, astRoot); - } - - // [JPA 2.0] if the column is specified and the id is mapped by a relationship, - // then that is an error - // (In JPA 1.0, this will never be the case, since the id is never mapped by a relationship) - if (this.columnIsSpecified() && this.mappedByRelationship) { - messages.add( - this.buildMessage( - JpaValidationMessages.ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_COLUMN_SPECIFIED, - EMPTY_STRING_ARRAY, - this.column.getValidationTextRange(astRoot) - ) - ); - } - - this.generatorContainer.validate(messages, reporter, astRoot); - if (this.generatedValue != null) { - this.generatedValue.validate(messages, reporter, astRoot); - } - this.converter.validate(messages, reporter, astRoot); - } - - protected IMessage buildMessage(String msgID, String[] parms, TextRange textRange) { - String attributeDescription = NLS.bind(JpaValidationDescriptionMessages.ATTRIBUTE_DESC, this.getPersistentAttribute().getName()); - parms = ArrayTools.add(parms, 0, attributeDescription); - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - msgID, - parms, - this, - textRange - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMappingDefinition.java deleted file mode 100644 index 1ba4b92315..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaIdMappingDefinition.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation; - -public abstract class AbstractJavaIdMappingDefinition - implements JavaAttributeMappingDefinition -{ - protected AbstractJavaIdMappingDefinition() { - super(); - } - - public String getKey() { - return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return IdAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable getSupportingAnnotationNames() { - return SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - ColumnAnnotation.ANNOTATION_NAME, - GeneratedValueAnnotation.ANNOTATION_NAME, - TemporalAnnotation.ANNOTATION_NAME, - TableGeneratorAnnotation.ANNOTATION_NAME, - SequenceGeneratorAnnotation.ANNOTATION_NAME - }; - protected static final Iterable SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(SUPPORTING_ANNOTATION_NAMES_ARRAY); - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return factory.buildJavaIdMapping(persistentAttribute); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java deleted file mode 100644 index b133a319f7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,348 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class AbstractJavaJoinColumnRelationshipStrategy - extends AbstractJavaJpaContextNode - implements JavaJoinColumnRelationshipStrategy -{ - protected final Vector specifiedJoinColumns = new Vector(); - protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter; - protected final JavaJoinColumn.Owner joinColumnOwner; - - protected JavaJoinColumn defaultJoinColumn; - - - protected AbstractJavaJoinColumnRelationshipStrategy(JavaJoinColumnRelationship parent) { - super(parent); - this.specifiedJoinColumnContainerAdapter = this.buildSpecifiedJoinColumnContainerAdapter(); - this.joinColumnOwner = this.buildJoinColumnOwner(); - this.initializeSpecifiedJoinColumns(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncSpecifiedJoinColumns(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getSpecifiedJoinColumns()); - this.updateDefaultJoinColumn(); - } - - - // ********** join columns ********** - - public ListIterator joinColumns() { - return this.getJoinColumns().iterator(); - } - - protected ListIterable getJoinColumns() { - return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns(); - } - - public int joinColumnsSize() { - return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize(); - } - - - // ********** specified join columns ********** - - public ListIterator specifiedJoinColumns() { - return this.getSpecifiedJoinColumns().iterator(); - } - - protected ListIterable getSpecifiedJoinColumns() { - return new LiveCloneListIterable(this.specifiedJoinColumns); - } - - public int specifiedJoinColumnsSize() { - return this.specifiedJoinColumns.size(); - } - - public boolean hasSpecifiedJoinColumns() { - return this.specifiedJoinColumns.size() != 0; - } - - public JavaJoinColumn getSpecifiedJoinColumn(int index) { - return this.specifiedJoinColumns.get(index); - } - - public JavaJoinColumn addSpecifiedJoinColumn() { - return this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size()); - } - - public JavaJoinColumn addSpecifiedJoinColumn(int index) { - JoinColumnAnnotation annotation = this.addJoinColumnAnnotation(index); - return this.addSpecifiedJoinColumn_(index, annotation); - } - - public void removeSpecifiedJoinColumn(JoinColumn joinColumn) { - this.removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn)); - } - - public void removeSpecifiedJoinColumn(int index) { - this.removeJoinColumnAnnotation(index); - this.removeSpecifiedJoinColumn_(index); - } - - protected void removeSpecifiedJoinColumn_(int index) { - this.removeItemFromList(index, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) { - this.moveJoinColumnAnnotation(targetIndex, sourceIndex); - this.moveItemInList(targetIndex, sourceIndex, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - protected void initializeSpecifiedJoinColumns() { - for (JoinColumnAnnotation joinColumnAnnotation : this.getJoinColumnAnnotations()) { - this.specifiedJoinColumns.add(this.buildJoinColumn(joinColumnAnnotation)); - } - } - - protected void syncSpecifiedJoinColumns() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedJoinColumnContainerAdapter); - } - - protected Iterable getJoinColumnAnnotations() { - return CollectionTools.iterable(this.joinColumnAnnotations()); - } - - protected void moveSpecifiedJoinColumn_(int index, JavaJoinColumn joinColumn) { - this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - protected JavaJoinColumn addSpecifiedJoinColumn_(int index, JoinColumnAnnotation joinColumnAnnotation) { - JavaJoinColumn joinColumn = this.buildJoinColumn(joinColumnAnnotation); - this.addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - return joinColumn; - } - - protected void removeSpecifiedJoinColumn_(JavaJoinColumn joinColumn) { - this.removeSpecifiedJoinColumn_(this.specifiedJoinColumns.indexOf(joinColumn)); - } - - protected SpecifiedJoinColumnContainerAdapter buildSpecifiedJoinColumnContainerAdapter() { - return new SpecifiedJoinColumnContainerAdapter(); - } - - /** - * specified join column container adapter - */ - protected class SpecifiedJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractJavaJoinColumnRelationshipStrategy.this.getSpecifiedJoinColumns(); - } - public Iterable getResourceElements() { - return AbstractJavaJoinColumnRelationshipStrategy.this.getJoinColumnAnnotations(); - } - public JoinColumnAnnotation getResourceElement(JavaJoinColumn contextElement) { - return contextElement.getColumnAnnotation(); - } - public void moveContextElement(int index, JavaJoinColumn element) { - AbstractJavaJoinColumnRelationshipStrategy.this.moveSpecifiedJoinColumn_(index, element); - } - public void addContextElement(int index, JoinColumnAnnotation resourceElement) { - AbstractJavaJoinColumnRelationshipStrategy.this.addSpecifiedJoinColumn_(index, resourceElement); - } - public void removeContextElement(JavaJoinColumn element) { - AbstractJavaJoinColumnRelationshipStrategy.this.removeSpecifiedJoinColumn_(element); - } - } - - protected abstract JavaJoinColumn.Owner buildJoinColumnOwner(); - - - // ********** default join column ********** - - public JavaJoinColumn getDefaultJoinColumn() { - return this.defaultJoinColumn; - } - - protected void setDefaultJoinColumn(JavaJoinColumn joinColumn) { - JavaJoinColumn old = this.defaultJoinColumn; - this.defaultJoinColumn = joinColumn; - this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn); - } - - protected ListIterable getDefaultJoinColumns() { - return (this.defaultJoinColumn != null) ? - new SingleElementListIterable(this.defaultJoinColumn) : - EmptyListIterable.instance(); - } - - protected int getDefaultJoinColumnsSize() { - return (this.defaultJoinColumn == null) ? 0 : 1; - } - - protected void updateDefaultJoinColumn() { - if (this.buildsDefaultJoinColumn()) { - if (this.defaultJoinColumn == null) { - this.setDefaultJoinColumn(this.buildJoinColumn(this.buildNullJoinColumnAnnotation())); - } else { - this.defaultJoinColumn.update(); - } - } else { - this.setDefaultJoinColumn(null); - } - } - - protected boolean buildsDefaultJoinColumn() { - return ! this.hasSpecifiedJoinColumns() && - this.getRelationship().mayHaveDefaultJoinColumn(); - } - - - // ********** join column annotations ********** - - protected abstract Iterator joinColumnAnnotations(); - - protected abstract JoinColumnAnnotation addJoinColumnAnnotation(int index); - - protected abstract void removeJoinColumnAnnotation(int index); - - protected abstract void moveJoinColumnAnnotation(int targetIndex, int sourceIndex); - - protected abstract JoinColumnAnnotation buildNullJoinColumnAnnotation(); - - - // ********** misc ********** - - @Override - public JavaJoinColumnRelationship getParent() { - return (JavaJoinColumnRelationship) super.getParent(); - } - - public JavaJoinColumnRelationship getRelationship() { - return this.getParent(); - } - - protected JavaJoinColumn buildJoinColumn(JoinColumnAnnotation joinColumnAnnotation) { - return this.getJpaFactory().buildJavaJoinColumn(this, this.joinColumnOwner, joinColumnAnnotation); - } - - public void initializeFrom(ReadOnlyJoinColumnRelationshipStrategy oldStrategy) { - for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldStrategy.specifiedJoinColumns())) { - this.addSpecifiedJoinColumn().initializeFrom(joinColumn); - } - } - - public void initializeFromVirtual(ReadOnlyJoinColumnRelationshipStrategy virtualStrategy) { - for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualStrategy.joinColumns())) { - this.addSpecifiedJoinColumn().initializeFromVirtual(joinColumn); - } - } - - public RelationshipMapping getRelationshipMapping() { - return this.getRelationship().getMapping(); - } - - public String getTableName() { - TypeMapping typeMapping = this.getRelationshipSource(); - return (typeMapping == null) ? null : typeMapping.getPrimaryTableName(); - } - - public Table resolveDbTable(String tableName) { - TypeMapping typeMapping = this.getRelationshipSource(); - return (typeMapping == null) ? null : typeMapping.resolveDbTable(tableName); - } - - public boolean tableNameIsInvalid(String tableName) { - TypeMapping typeMapping = this.getRelationshipSource(); - return (typeMapping != null) && typeMapping.tableNameIsInvalid(tableName); - } - - // subclasses like this to be public - public Table getReferencedColumnDbTable() { - TypeMapping relationshipTarget = this.getRelationshipTarget(); - return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable(); - } - - protected Iterator candidateTableNames() { - TypeMapping typeMapping = this.getRelationshipSource(); - return (typeMapping != null) ? typeMapping.allAssociatedTableNames() : EmptyIterator.instance(); - } - - public void addStrategy() { - if (this.specifiedJoinColumnsSize() == 0) { - this.addSpecifiedJoinColumn(); - } - } - - public void removeStrategy() { - for (int i = this.specifiedJoinColumns.size(); i-- > 0; ) { - this.removeSpecifiedJoinColumn(i); - } - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - for (JavaJoinColumn joinColumn : this.getJoinColumns()) { - result = joinColumn.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - return null; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - for (JavaJoinColumn joinColumn : this.getJoinColumns()) { - joinColumn.validate(messages, reporter, astRoot); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinTableRelationshipStrategy.java deleted file mode 100644 index 6eafead62c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJoinTableRelationshipStrategy.java +++ /dev/null @@ -1,196 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTable; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class AbstractJavaJoinTableRelationshipStrategy - extends AbstractJavaJpaContextNode - implements JavaJoinTableRelationshipStrategy, Table.Owner -{ - protected JavaJoinTable joinTable; - - - protected AbstractJavaJoinTableRelationshipStrategy(JavaJoinTableRelationship parent) { - super(parent); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - if (this.joinTable != null) { - this.joinTable.synchronizeWithResourceModel(); - } - } - - @Override - public void update() { - super.update(); - this.updateJoinTable(); - } - - - // ********** join table ********** - - public JavaJoinTable getJoinTable() { - return this.joinTable; - } - - protected void setJoinTable(JavaJoinTable joinTable) { - JavaJoinTable old = this.joinTable; - this.joinTable = joinTable; - this.firePropertyChanged(JOIN_TABLE_PROPERTY, old, joinTable); - } - - protected void updateJoinTable() { - if (this.buildsJoinTable()) { - if (this.joinTable == null) { - this.setJoinTable(this.buildJoinTable()); - } else { - this.joinTable.update(); - } - } else { - if (this.joinTable != null) { - this.setJoinTable(null); - } - } - } - - /** - * The strategy can have a join table if either the table annotation is present - * or the [mapping] relationship supports a default join table. - */ - protected boolean buildsJoinTable() { - return this.getJoinTableAnnotation().isSpecified() - || this.getRelationship().mayHaveDefaultJoinTable(); - } - - protected JavaJoinTable buildJoinTable() { - return this.getJpaFactory().buildJavaJoinTable(this, this); - } - - - // ********** join table annotation ********** - - protected abstract JoinTableAnnotation addJoinTableAnnotation(); - - protected abstract void removeJoinTableAnnotation(); - - - // ********** misc ********** - - @Override - public JavaJoinTableRelationship getParent() { - return (JavaJoinTableRelationship) super.getParent(); - } - - public JavaJoinTableRelationship getRelationship() { - return this.getParent(); - } - - public RelationshipMapping getRelationshipMapping() { - return this.getRelationship().getMapping(); - } - - public void initializeFrom(ReadOnlyJoinTableRelationshipStrategy oldStrategy) { - ReadOnlyJoinTable oldJoinTable = oldStrategy.getJoinTable(); - if (oldJoinTable != null) { - this.addStrategy(); - this.joinTable.initializeFrom(oldJoinTable); - } - } - - public void initializeFromVirtual(ReadOnlyJoinTableRelationshipStrategy virtualStrategy) { - ReadOnlyJoinTable oldJoinTable = virtualStrategy.getJoinTable(); - if (oldJoinTable != null) { - this.addStrategy(); - this.joinTable.initializeFromVirtual(oldJoinTable); - } - } - - public String getTableName() { - return (this.joinTable == null) ? null : this.joinTable.getName(); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return (this.joinTable == null) ? null : this.joinTable.getDbTable(); - } - - public boolean tableNameIsInvalid(String tableName) { - return Tools.valuesAreDifferent(this.getTableName(), tableName); - } - - public String getColumnTableNotValidDescription() { - return JpaValidationDescriptionMessages.DOES_NOT_MATCH_JOIN_TABLE; - } - - public String getJoinTableDefaultName() { - return MappingTools.buildJoinTableDefaultName(this.getRelationship()); - } - - public void addStrategy() { - if (this.joinTable == null) { - this.addJoinTableAnnotation(); - this.setJoinTable(this.buildJoinTable()); - } - } - - public void removeStrategy() { - if (this.joinTable != null) { - this.removeJoinTableAnnotation(); - this.setJoinTable(null); - } - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.joinTable != null) { - result = this.joinTable.javaCompletionProposals(pos, filter, astRoot); - } - return result; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - if (this.joinTable != null) { - this.joinTable.validate(messages, reporter, astRoot); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java deleted file mode 100644 index 92643cc26a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaJpaContextNode.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.jpa.core.context.JpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.AbstractJpaContextNode; -import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class AbstractJavaJpaContextNode - extends AbstractJpaContextNode - implements JavaJpaContextNode -{ - protected AbstractJavaJpaContextNode(JpaContextNode parent) { - super(parent); - } - - @Override - public JptResourceType getResourceType() { - return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE; - } - - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - if (this.connectionProfileIsActive()) { - Iterator result = this.connectedJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - return null; - } - - /** - * This method is called if the database is connected, allowing us to - * get candidates from the various database tables etc. - * This method should NOT be cascaded to "child" objects; it should - * only return candidates for the current object. The cascading is - * handled by #javaCompletionProposals(int, Filter, CompilationUnit). - */ - @SuppressWarnings("unused") - public Iterator connectedJavaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - return null; - } - - // ********** validation ********** - - /** - * All subclass implementations - * should be preceded by a "super" call to this method. - */ - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - if (reporter.isCancelled()) { - throw new ValidationCancelledException(); - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMapping.java deleted file mode 100644 index 22c5d8c9e3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMapping.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaMappingRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaManyToManyMapping2_0; -import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation; - -public abstract class AbstractJavaManyToManyMapping - extends AbstractJavaMultiRelationshipMapping - implements JavaManyToManyMapping2_0 -{ - protected AbstractJavaManyToManyMapping(JavaPersistentAttribute parent) { - super(parent); - } - - - // ********** relationship ********** - - @Override - public JavaManyToManyRelationship getRelationship() { - return (JavaManyToManyRelationship) super.getRelationship(); - } - - @Override - protected JavaMappingRelationship buildRelationship() { - return new GenericJavaManyToManyRelationship(this); - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return ManyToManyAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMappingDefinition.java deleted file mode 100644 index 9677d6b81e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToManyMappingDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation; - -public abstract class AbstractJavaManyToManyMappingDefinition - implements JavaAttributeMappingDefinition -{ - protected AbstractJavaManyToManyMappingDefinition() { - super(); - } - - public String getKey() { - return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return ManyToManyAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable getSupportingAnnotationNames() { - return SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - JoinTableAnnotation.ANNOTATION_NAME, - MapKeyAnnotation.ANNOTATION_NAME, - OrderByAnnotation.ANNOTATION_NAME - }; - protected static final Iterable SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(SUPPORTING_ANNOTATION_NAMES_ARRAY); - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return factory.buildJavaManyToManyMapping(persistentAttribute); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMapping.java deleted file mode 100644 index 42a93b9b37..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMapping.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaManyToOneRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaManyToOneMapping2_0; -import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation; - -public abstract class AbstractJavaManyToOneMapping - extends AbstractJavaSingleRelationshipMapping - implements JavaManyToOneMapping2_0 -{ - protected AbstractJavaManyToOneMapping(JavaPersistentAttribute parent) { - super(parent); - } - - - // ********** relationship ********** - - @Override - public JavaManyToOneRelationship getRelationship() { - return (JavaManyToOneRelationship) super.getRelationship(); - } - - @Override - protected JavaManyToOneRelationship buildRelationship() { - return new GenericJavaManyToOneRelationship(this); - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return ManyToOneAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMappingDefinition.java deleted file mode 100644 index 9534ff5126..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaManyToOneMappingDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation; - -public abstract class AbstractJavaManyToOneMappingDefinition - implements JavaAttributeMappingDefinition -{ - protected AbstractJavaManyToOneMappingDefinition() { - super(); - } - - public String getKey() { - return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return ManyToOneAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable getSupportingAnnotationNames() { - return SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - JoinTableAnnotation.ANNOTATION_NAME, - JoinColumnAnnotation.ANNOTATION_NAME, - JoinColumnsAnnotation.ANNOTATION_NAME - }; - protected static final Iterable SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(SUPPORTING_ANNOTATION_NAMES_ARRAY); - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return factory.buildJavaManyToOneMapping(persistentAttribute); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappedSuperclass.java deleted file mode 100644 index b4255f5a56..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappedSuperclass.java +++ /dev/null @@ -1,112 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference; -import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericMappedSuperclassPrimaryKeyValidator; -import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java mapped superclass - */ -public abstract class AbstractJavaMappedSuperclass - extends AbstractJavaTypeMapping - implements JavaMappedSuperclass -{ - protected final JavaIdClassReference idClassReference; - - - protected AbstractJavaMappedSuperclass(JavaPersistentType parent, MappedSuperclassAnnotation mappingAnnotation) { - super(parent, mappingAnnotation); - this.idClassReference = this.buildIdClassReference(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.idClassReference.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.idClassReference.update(); - } - - - // ********** id class ********** - - public JavaIdClassReference getIdClassReference() { - return this.idClassReference; - } - - protected JavaIdClassReference buildIdClassReference() { - return new GenericJavaIdClassReference(this); - } - - public JavaPersistentType getIdClass() { - return this.idClassReference.getIdClass(); - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY; - } - - public boolean isMapped() { - return true; - } - - public boolean tableNameIsInvalid(String tableName) { - return false; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.validatePrimaryKey(messages, reporter, astRoot); - } - - @Override - public boolean validatesAgainstDatabase() { - return false; - } - - protected void validatePrimaryKey(List messages, IReporter reporter, CompilationUnit astRoot) { - this.buildPrimaryKeyValidator(astRoot).validate(messages, reporter); - } - - protected JptValidator buildPrimaryKeyValidator(CompilationUnit astRoot) { - return new GenericMappedSuperclassPrimaryKeyValidator(this, this.buildTextRangeResolver(astRoot)); - // TODO - JPA 2.0 validation - } - - @Override - protected PrimaryKeyTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) { - return new JavaMappedSuperclassTextRangeResolver(this, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappingRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappingRelationship.java deleted file mode 100644 index 852474ce29..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMappingRelationship.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.MappedByRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship; -import org.eclipse.jpt.jpa.core.context.RelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaMappingRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipStrategy; - -/** - * NB: Subclasses may want to set the {@link #strategy} at the - * end of their constructors; otherwise, it will be null until it - * is set during {@link #update()}. - */ -public abstract class AbstractJavaMappingRelationship - extends AbstractJavaJpaContextNode - implements JavaMappingRelationship -{ - protected JavaRelationshipStrategy strategy; - - - public AbstractJavaMappingRelationship(M parent) { - super(parent); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.updateStrategy(); - } - - - // ********** strategy ********** - - public JavaRelationshipStrategy getStrategy() { - return this.strategy; - } - - protected void setStrategy(JavaRelationshipStrategy strategy) { - RelationshipStrategy old = this.strategy; - this.strategy = strategy; - this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy); - } - - protected abstract JavaRelationshipStrategy buildStrategy(); - - /** - * This is called by subclasses when the various supported strategies are - * added or removed; allowing the strategy to be set synchronously. (?) - */ - protected void updateStrategy() { - this.setStrategy(this.buildStrategy()); - } - - - // ********** conversions ********** - - public void initializeFrom(ReadOnlyRelationship oldRelationship) { - oldRelationship.initializeOn(this); - } - - public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) { - // NOP - } - - public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) { - // NOP - } - - public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) { - // NOP - } - - - // ********** misc ********** - - @Override - @SuppressWarnings("unchecked") - public M getParent() { - return (M) super.getParent(); - } - - public JavaRelationshipMapping getMapping() { - return this.getParent(); - } - - public TypeMapping getTypeMapping() { - return this.getMapping().getTypeMapping(); - } - - public Entity getEntity() { - TypeMapping typeMapping = this.getTypeMapping(); - return (typeMapping instanceof Entity) ? (Entity) typeMapping : null; - } - - public boolean isOverridable() { - return this.strategy.isOverridable(); - } - - public boolean isVirtual() { - return this.getMapping().getPersistentAttribute().isVirtual(); - } - - public boolean isTargetForeignKey() { - return false; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getMapping().getValidationTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java deleted file mode 100644 index bb0e245fe8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaMultiRelationshipMapping.java +++ /dev/null @@ -1,780 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.jpa.core.context.AttributeOverride; -import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.Embeddable; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.FetchType; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.OverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.RelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaMultiRelationshipMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaOrderable; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.RelationshipStrategyTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaMapKeyColumn2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.RelationshipMappingAnnotation; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java multi-relationship (m:m, 1:m) mapping - */ -public abstract class AbstractJavaMultiRelationshipMapping - extends AbstractJavaRelationshipMapping - implements JavaMultiRelationshipMapping, JavaCollectionMapping2_0 -{ - protected final JavaOrderable orderable; - - protected String specifiedMapKey; - protected boolean noMapKey = false; - protected boolean pkMapKey = false; - protected boolean customMapKey = false; - - protected String specifiedMapKeyClass; - protected String defaultMapKeyClass; - protected String fullyQualifiedMapKeyClass; - - protected Type valueType; - protected Type keyType; - - protected final JavaColumn mapKeyColumn; - - protected final JavaAttributeOverrideContainer mapKeyAttributeOverrideContainer; - - - protected AbstractJavaMultiRelationshipMapping(JavaPersistentAttribute parent) { - super(parent); - this.orderable = this.buildOrderable(); - - this.specifiedMapKey = this.buildSpecifiedMapKey(); - this.noMapKey = this.buildNoMapKey(); - this.pkMapKey = this.buildPkMapKey(); - this.customMapKey = this.buildCustomMapKey(); - - this.specifiedMapKeyClass = this.buildSpecifiedMapKeyClass(); - - this.mapKeyColumn = this.buildMapKeyColumn(); - this.mapKeyAttributeOverrideContainer = this.buildMapKeyAttributeOverrideContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.orderable.synchronizeWithResourceModel(); - - this.setSpecifiedMapKey_(this.buildSpecifiedMapKey()); - this.setNoMapKey_(this.buildNoMapKey()); - this.setPkMapKey_(this.buildPkMapKey()); - this.setCustomMapKey_(this.buildCustomMapKey()); - - this.setSpecifiedMapKeyClass_(this.buildSpecifiedMapKeyClass()); - - this.mapKeyColumn.synchronizeWithResourceModel(); - - this.mapKeyAttributeOverrideContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - - this.orderable.update(); - - this.setDefaultMapKeyClass(this.buildDefaultMapKeyClass()); - this.setFullyQualifiedMapKeyClass(this.buildFullyQualifiedMapKeyClass()); - - this.setValueType(this.buildValueType()); - this.setKeyType(this.buildKeyType()); - - this.mapKeyColumn.update(); - - this.mapKeyAttributeOverrideContainer.update(); - } - - - // ********** orderable ********** - - public JavaOrderable getOrderable() { - return this.orderable; - } - - protected JavaOrderable buildOrderable() { - return this.isJpa2_0Compatible() ? - this.getJpaFactory2_0().buildJavaOrderable(this, this.buildOrderableOwner()) : - this.getJpaFactory().buildJavaOrderable(this); - } - - protected Orderable2_0.Owner buildOrderableOwner() { - return new OrderableOwner(); - } - - protected class OrderableOwner - implements Orderable2_0.Owner - { - public String getTableName() { - return this.getRelationshipStrategy().getTableName(); - } - public Table resolveDbTable(String tableName) { - return this.getRelationshipStrategy().resolveDbTable(tableName); - } - protected JavaRelationshipStrategy getRelationshipStrategy() { - return AbstractJavaMultiRelationshipMapping.this.getRelationship().getStrategy(); - } - } - - - // ********** map key ********** - - public String getMapKey() { - if (this.noMapKey) { - return null; - } - if (this.pkMapKey) { - return this.getTargetEntityIdAttributeName(); - } - if (this.customMapKey) { - return this.specifiedMapKey; - } - throw new IllegalStateException("unknown map key"); //$NON-NLS-1$ - } - - - // ********** specified map key ********** - - public String getSpecifiedMapKey() { - return this.specifiedMapKey; - } - - public void setSpecifiedMapKey(String mapKey) { - if (mapKey != null) { - this.getMapKeyAnnotationForUpdate().setName(mapKey); - - this.setSpecifiedMapKey_(mapKey); - this.setNoMapKey_(false); - this.setPkMapKey_(false); - this.setCustomMapKey_(true); - } else { - this.setPkMapKey(true); // hmmm... - } - } - - protected void setSpecifiedMapKey_(String mapKey) { - String old = this.specifiedMapKey; - this.specifiedMapKey = mapKey; - this.firePropertyChanged(SPECIFIED_MAP_KEY_PROPERTY, old, mapKey); - } - - protected String buildSpecifiedMapKey() { - MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation(); - return (mapKeyAnnotation == null) ? null : mapKeyAnnotation.getName(); - } - - - // ********** no map key ********** - - public boolean isNoMapKey() { - return this.noMapKey; - } - - public void setNoMapKey(boolean noMapKey) { - if (noMapKey) { - if (this.getMapKeyAnnotation() != null) { - this.removeMapKeyAnnotation(); - } - - this.setSpecifiedMapKey_(null); - this.setNoMapKey_(true); - this.setPkMapKey_(false); - this.setCustomMapKey_(false); - } else { - this.setPkMapKey(true); // hmmm... - } - } - - protected void setNoMapKey_(boolean noMapKey) { - boolean old = this.noMapKey; - this.noMapKey = noMapKey; - this.firePropertyChanged(NO_MAP_KEY_PROPERTY, old, noMapKey); - } - - protected boolean buildNoMapKey() { - return this.getMapKeyAnnotation() == null; - } - - - // ********** pk map key ********** - - public boolean isPkMapKey() { - return this.pkMapKey; - } - - public void setPkMapKey(boolean pkMapKey) { - if (pkMapKey) { - MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation(); - if (mapKeyAnnotation == null) { - mapKeyAnnotation = this.addMapKeyAnnotation(); - } else { - mapKeyAnnotation.setName(null); - } - - this.setSpecifiedMapKey_(null); - this.setNoMapKey_(false); - this.setPkMapKey_(true); - this.setCustomMapKey_(false); - } else { - this.setNoMapKey(true); // hmmm... - } - } - - protected void setPkMapKey_(boolean pkMapKey) { - boolean old = this.pkMapKey; - this.pkMapKey = pkMapKey; - this.firePropertyChanged(PK_MAP_KEY_PROPERTY, old, pkMapKey); - } - - protected boolean buildPkMapKey() { - MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation(); - return (mapKeyAnnotation != null) && (mapKeyAnnotation.getName() == null); - } - - - // ********** custom map key ********** - - public boolean isCustomMapKey() { - return this.customMapKey; - } - - public void setCustomMapKey(boolean customMapKey) { - if (customMapKey) { - this.setSpecifiedMapKey(""); //$NON-NLS-1$ - } else { - this.setNoMapKey(true); // hmmm... - } - } - - protected void setCustomMapKey_(boolean customMapKey) { - boolean old = this.customMapKey; - this.customMapKey = customMapKey; - this.firePropertyChanged(CUSTOM_MAP_KEY_PROPERTY, old, customMapKey); - } - - protected boolean buildCustomMapKey() { - MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation(); - return (mapKeyAnnotation != null) && (mapKeyAnnotation.getName() != null); - } - - - // ********** map key annotation ********** - - protected MapKeyAnnotation getMapKeyAnnotation() { - return (MapKeyAnnotation) this.getResourcePersistentAttribute().getAnnotation(MapKeyAnnotation.ANNOTATION_NAME); - } - - protected MapKeyAnnotation getMapKeyAnnotationForUpdate() { - MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation(); - return (mapKeyAnnotation != null) ? mapKeyAnnotation : this.addMapKeyAnnotation(); - } - - protected MapKeyAnnotation addMapKeyAnnotation() { - return (MapKeyAnnotation) this.getResourcePersistentAttribute().addAnnotation(MapKeyAnnotation.ANNOTATION_NAME); - } - - protected void removeMapKeyAnnotation() { - this.getResourcePersistentAttribute().removeAnnotation(MapKeyAnnotation.ANNOTATION_NAME); - } - - - // ********** map key class ********** - - public String getMapKeyClass() { - return (this.specifiedMapKeyClass != null) ? this.specifiedMapKeyClass : this.defaultMapKeyClass; - } - - public String getSpecifiedMapKeyClass() { - return this.specifiedMapKeyClass; - } - - public void setSpecifiedMapKeyClass(String mapKeyClass) { - if (this.valuesAreDifferent(mapKeyClass, this.specifiedMapKeyClass)) { - MapKeyClass2_0Annotation annotation = this.getMapKeyClassAnnotation(); - if (mapKeyClass == null) { - if (annotation != null) { - this.removeMapKeyClassAnnotation(); - } - } else { - if (annotation == null) { - annotation = this.addMapKeyClassAnnotation(); - } - annotation.setValue(mapKeyClass); - } - - this.setSpecifiedMapKeyClass_(mapKeyClass); - } - } - - protected void setSpecifiedMapKeyClass_(String mapKeyClass) { - String old = this.specifiedMapKeyClass; - this.specifiedMapKeyClass = mapKeyClass; - this.firePropertyChanged(SPECIFIED_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass); - } - - protected String buildSpecifiedMapKeyClass() { - MapKeyClass2_0Annotation annotation = this.getMapKeyClassAnnotation(); - return (annotation == null) ? null : annotation.getValue(); - } - - public String getDefaultMapKeyClass() { - return this.defaultMapKeyClass; - } - - protected void setDefaultMapKeyClass(String mapKeyClass) { - String old = this.defaultMapKeyClass; - this.defaultMapKeyClass = mapKeyClass; - this.firePropertyChanged(DEFAULT_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass); - } - - protected String buildDefaultMapKeyClass() { - return this.isJpa2_0Compatible() ? this.getPersistentAttribute().getMultiReferenceMapKeyTypeName() : null; - } - - public String getFullyQualifiedMapKeyClass() { - return this.fullyQualifiedMapKeyClass; - } - - protected void setFullyQualifiedMapKeyClass(String mapKeyClass) { - String old = this.fullyQualifiedMapKeyClass; - this.fullyQualifiedMapKeyClass = mapKeyClass; - this.firePropertyChanged(FULLY_QUALIFIED_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass); - } - - protected String buildFullyQualifiedMapKeyClass() { - return this.isJpa2_0Compatible() ? this.buildFullyQualifiedMapKeyClass_() : null; - } - - protected String buildFullyQualifiedMapKeyClass_() { - return (this.specifiedMapKeyClass == null) ? - this.defaultMapKeyClass : - this.getMapKeyClassAnnotation().getFullyQualifiedClassName(); - } - - public char getMapKeyClassEnclosingTypeSeparator() { - return '.'; - } - - - // ********** resolved map key embeddable/entity ********** - - protected Embeddable getResolvedMapKeyEmbeddable() { - return this.getPersistenceUnit().getEmbeddable(this.fullyQualifiedMapKeyClass); - } - - protected Entity getResolvedMapKeyEntity() { - return this.getPersistenceUnit().getEntity(this.fullyQualifiedMapKeyClass); - } - - - // ********** map key class annotation ********** - - protected MapKeyClass2_0Annotation getMapKeyClassAnnotation() { - return this.isJpa2_0Compatible() ? this.getMapKeyClassAnnotation_() : null; - } - - protected MapKeyClass2_0Annotation getMapKeyClassAnnotation_() { - return (MapKeyClass2_0Annotation) this.getResourcePersistentAttribute().getAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME); - } - - protected MapKeyClass2_0Annotation addMapKeyClassAnnotation() { - return (MapKeyClass2_0Annotation) this.getResourcePersistentAttribute().addAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME); - } - - protected void removeMapKeyClassAnnotation() { - this.getResourcePersistentAttribute().removeAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME); - } - - - // ********** value type ********** - - public Type getValueType() { - return this.valueType; - } - - protected void setValueType(Type valueType) { - Type old = this.valueType; - this.valueType = valueType; - this.firePropertyChanged(VALUE_TYPE_PROPERTY, old, valueType); - } - - protected Type buildValueType() { - if (this.getResolvedTargetEntity() != null) { - return Type.ENTITY_TYPE; - } - if (this.getResolvedTargetEmbeddable() != null) { - return Type.EMBEDDABLE_TYPE; - } - if (this.getTargetEntity() == null) { - return Type.NO_TYPE; - } - return Type.BASIC_TYPE; - } - - protected Embeddable getResolvedTargetEmbeddable() { - return this.getPersistenceUnit().getEmbeddable(this.fullyQualifiedTargetEntity); - } - - - // ********** key type ********** - - public Type getKeyType() { - return this.keyType; - } - - protected void setKeyType(Type keyType) { - Type old = this.keyType; - this.keyType = keyType; - this.firePropertyChanged(KEY_TYPE_PROPERTY, old, keyType); - } - - protected Type buildKeyType() { - if (this.getResolvedMapKeyEmbeddable() != null) { - return Type.EMBEDDABLE_TYPE; - } - if (this.getResolvedMapKeyEntity() != null) { - return Type.ENTITY_TYPE; - } - if (this.getMapKeyClass() == null) { - return Type.NO_TYPE; - } - return Type.BASIC_TYPE; - } - - - // ********** map key column ********** - - public JavaColumn getMapKeyColumn() { - return this.mapKeyColumn; - } - - protected JavaColumn buildMapKeyColumn() { - return this.isJpa2_0Compatible() ? - this.getJpaFactory2_0().buildJavaMapKeyColumn(this, this.buildMapKeyColumnOwner()) : - new NullJavaMapKeyColumn2_0(this); - } - - protected JavaColumn.Owner buildMapKeyColumnOwner() { - return new MapKeyColumnOwner(); - } - - protected MapKeyColumn2_0Annotation getMapKeyColumnAnnotation() { - return this.isJpa2_0Compatible() ? this.getMapKeyColumnAnnotation_() : null; - } - - protected MapKeyColumn2_0Annotation getMapKeyColumnAnnotation_() { - return (MapKeyColumn2_0Annotation) this.getResourcePersistentAttribute().getNonNullAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME); - } - - protected void removeMapKeyColumnAnnotation() { - if (this.isJpa2_0Compatible()) { - this.removeMapKeyColumnAnnotation_(); - } else { - throw new IllegalStateException(); - } - } - - protected void removeMapKeyColumnAnnotation_() { - this.getResourcePersistentAttribute().removeAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME); - } - - - // ********** map key attribute override container ********** - - public JavaAttributeOverrideContainer getMapKeyAttributeOverrideContainer() { - return this.mapKeyAttributeOverrideContainer; - } - - public JavaAttributeOverrideContainer buildMapKeyAttributeOverrideContainer() { - return this.getJpaFactory().buildJavaAttributeOverrideContainer(this, this.buildMapKeyAttributeOverrideContainerOwner()); - } - - protected JavaAttributeOverrideContainer.Owner buildMapKeyAttributeOverrideContainerOwner() { - return new MapKeyAttributeOverrideContainerOwner(); - } - - - // ********** misc ********** - - @Override - protected String buildDefaultTargetEntity() { - return this.getPersistentAttribute().getMultiReferenceTargetTypeName(); - } - - @Override - protected FetchType buildDefaultFetch() { - return DEFAULT_FETCH_TYPE; - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - result = this.orderable.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - if (this.mapKeyNameTouches(pos, astRoot)) { - return this.javaCandidateMapKeyNames(filter); - } - - result = this.mapKeyColumn.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - result = this.mapKeyAttributeOverrideContainer.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - return null; - } - - protected boolean mapKeyNameTouches(int pos, CompilationUnit astRoot) { - MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation(); - return (mapKeyAnnotation != null) && mapKeyAnnotation.nameTouches(pos, astRoot); - } - - protected Iterator javaCandidateMapKeyNames(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.candidateMapKeyNames(filter)); - } - - protected Iterator candidateMapKeyNames(Filter filter) { - return new FilteringIterator(this.candidateMapKeyNames(), filter); - } - - public Iterator candidateMapKeyNames() { - return this.allTargetEntityAttributeNames(); - } - - - // ********** metamodel ********** - - @Override - protected String getMetamodelFieldTypeName() { - return ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldTypeName(); - } - - @Override - protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList typeArgumentNames) { - this.addMetamodelFieldMapKeyTypeArgumentNameTo(typeArgumentNames); - super.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames); - } - - protected void addMetamodelFieldMapKeyTypeArgumentNameTo(ArrayList typeArgumentNames) { - String keyTypeName = ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldMapKeyTypeName(); - if (keyTypeName != null) { - typeArgumentNames.add(keyTypeName); - } - } - - public String getMetamodelFieldMapKeyTypeName() { - return MappingTools.getMetamodelFieldMapKeyTypeName(this); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.orderable.validate(messages, reporter, astRoot); - this.validateMapKey(messages, reporter, astRoot); - } - - protected void validateMapKey(List messages, IReporter reporter, CompilationUnit astRoot) { - if (this.getMapKeyAnnotation() != null) {//If MapKey annotation specified, no other MapKey* annotations can be specified, don't validate them - //TODO validate that the map key refers to an existing attribute - return; - } - if (this.getKeyType() == Type.BASIC_TYPE) { - this.mapKeyColumn.validate(messages, reporter, astRoot); - //validate map key converter - } - else if (this.getKeyType() == Type.ENTITY_TYPE) { - //validate map key join columns - } - else if (this.getKeyType() == Type.EMBEDDABLE_TYPE) { - this.mapKeyAttributeOverrideContainer.validate(messages, reporter, astRoot); - //validate map key association overrides - for eclipselink - } - } - - - // ********** abstract owner ********** - - /** - * some common behavior - */ - protected abstract class AbstractOwner - { - public TypeMapping getTypeMapping() { - return AbstractJavaMultiRelationshipMapping.this.getTypeMapping(); - } - - public String getDefaultTableName() { - return this.getRelationshipStrategy().getTableName(); - } - - public Table resolveDbTable(String tableName) { - return this.getRelationshipStrategy().resolveDbTable(tableName); - } - - public Iterator candidateTableNames() { - return EmptyIterator.instance(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return AbstractJavaMultiRelationshipMapping.this.getValidationTextRange(astRoot); - } - - protected RelationshipStrategy getRelationshipStrategy() { - return AbstractJavaMultiRelationshipMapping.this.getRelationship().getStrategy(); - } - } - - - // ********** map key column owner ********** - - protected class MapKeyColumnOwner - extends AbstractOwner - implements JavaColumn.Owner - { - public MapKeyColumn2_0Annotation getColumnAnnotation() { - return AbstractJavaMultiRelationshipMapping.this.getMapKeyColumnAnnotation(); - } - - public void removeColumnAnnotation() { - AbstractJavaMultiRelationshipMapping.this.removeMapKeyColumnAnnotation(); - } - - public String getDefaultColumnName() { - return AbstractJavaMultiRelationshipMapping.this.getName() + "_KEY"; //$NON-NLS-1$ - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getRelationshipStrategy().tableNameIsInvalid(tableName); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new MapKeyColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new RelationshipStrategyTableDescriptionProvider(this.getRelationshipStrategy())); - } - } - - - // ********** map key attribute override owner ********** - - protected class MapKeyAttributeOverrideContainerOwner - extends AbstractOwner - implements JavaAttributeOverrideContainer.Owner - { - public JavaResourcePersistentMember getResourcePersistentMember() { - return AbstractJavaMultiRelationshipMapping.this.getResourcePersistentAttribute(); - } - - public TypeMapping getOverridableTypeMapping() { - return AbstractJavaMultiRelationshipMapping.this.getResolvedMapKeyEmbeddable(); - } - - /** - * If there is a specified table name it needs to be the same - * the default table name. the table is always the collection table - */ - public boolean tableNameIsInvalid(String tableName) { - return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName); - } - - public Iterator allOverridableNames() { - TypeMapping typeMapping = this.getOverridableTypeMapping(); - return (typeMapping != null) ? typeMapping.allOverridableAttributeNames() : EmptyIterator.instance(); - } - - protected static final String POSSIBLE_PREFIX = "key"; //$NON-NLS-1$ - public String getPossiblePrefix() { - return POSSIBLE_PREFIX; - } - - public String getWritePrefix() { - return this.getPossiblePrefix(); - } - - // since only a map's key can be an embeddable on a 1-m or m-m; - // all overrides are relevant - public boolean isRelevant(String overrideName) { - return true; - } - - public Column resolveOverriddenColumn(String attributeName) { - return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName); - } - - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new MapKeyAttributeOverrideValidator((AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) { - return new MapKeyAttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new RelationshipStrategyTableDescriptionProvider(this.getRelationshipStrategy())); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java deleted file mode 100644 index fa129f27da..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaNamedColumn.java +++ /dev/null @@ -1,292 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation; -import org.eclipse.jpt.jpa.db.Column; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java
    - *
  • column - *
  • join column - *
  • discriminator column - *
  • order column - *
  • primary key join column - *
- * NB: any subclass that directly holds its column annotation - * must:
    - *
  • call the "super" constructor that takes a column annotation - * {@link #AbstractJavaNamedColumn(JavaJpaContextNode, JavaNamedColumn.Owner, NamedColumnAnnotation)} - *
  • override {@link #setColumnAnnotation(NamedColumnAnnotation)} to set the column annotation - * so it is in place before the column's state (e.g. {@link #specifiedName}) - * is initialized - *
- */ -public abstract class AbstractJavaNamedColumn
- extends AbstractJavaJpaContextNode - implements JavaNamedColumn -{ - protected final O owner; - - protected String specifiedName; - protected String defaultName; - - protected String columnDefinition; - - - protected AbstractJavaNamedColumn(JavaJpaContextNode parent, O owner) { - this(parent, owner, null); - } - - protected AbstractJavaNamedColumn(JavaJpaContextNode parent, O owner, A columnAnnotation) { - super(parent); - this.owner = owner; - this.setColumnAnnotation(columnAnnotation); - this.specifiedName = this.buildSpecifiedName(); - this.columnDefinition = this.buildColumnDefinition(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedName_(this.buildSpecifiedName()); - this.setColumnDefinition_(this.buildColumnDefinition()); - } - - @Override - public void update() { - super.update(); - this.setDefaultName(this.buildDefaultName()); - } - - - // ********** column annotation ********** - - /** - * Return the Java column annotation. Do not return null if the - * Java annotation does not exist; return a null column annotation - * instead. - */ - public abstract A getColumnAnnotation(); - - /** - * see class comment... ({@link AbstractJavaNamedColumn}) - */ - protected void setColumnAnnotation(A columnAnnotation) { - if (columnAnnotation != null) { - throw new IllegalArgumentException("this method must be overridden if the column annotation is not null: " + columnAnnotation); //$NON-NLS-1$ - } - } - - protected void removeColumnAnnotationIfUnset() { - if (this.getColumnAnnotation().isUnset()) { - this.removeColumnAnnotation(); - } - } - - protected abstract void removeColumnAnnotation(); - - - // ********** name ********** - - public String getName() { - return (this.specifiedName != null) ? this.specifiedName : this.defaultName; - } - - public String getSpecifiedName() { - return this.specifiedName; - } - - public void setSpecifiedName(String name) { - if (this.valuesAreDifferent(this.specifiedName, name)) { - this.getColumnAnnotation().setName(name); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedName_(name); - } - } - - protected void setSpecifiedName_(String name) { - String old = this.specifiedName; - this.specifiedName = name; - this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedName() { - return this.getColumnAnnotation().getName(); - } - - public String getDefaultName() { - return this.defaultName; - } - - protected void setDefaultName(String name) { - String old = this.defaultName; - this.defaultName = name; - this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name); - } - - protected String buildDefaultName() { - return this.owner.getDefaultColumnName(); - } - - - // ********** column definition ********** - - public String getColumnDefinition() { - return this.columnDefinition; - } - - public void setColumnDefinition(String columnDefinition) { - if (this.valuesAreDifferent(this.columnDefinition, columnDefinition)) { - this.getColumnAnnotation().setColumnDefinition(columnDefinition); - this.removeColumnAnnotationIfUnset(); - this.setColumnDefinition_(columnDefinition); - } - } - - protected void setColumnDefinition_(String columnDefinition) { - String old = this.columnDefinition; - this.columnDefinition = columnDefinition; - this.firePropertyChanged(COLUMN_DEFINITION_PROPERTY, old, columnDefinition); - } - - public String buildColumnDefinition() { - return this.getColumnAnnotation().getColumnDefinition(); - } - - - // ********** database stuff ********** - - protected Column getDbColumn() { - Table table = this.getDbTable(); - return (table == null) ? null : table.getColumnForIdentifier(this.getName()); - } - - public Table getDbTable() { - return this.owner.resolveDbTable(this.getTable()); - } - - /** - * Return the name of the column's table. This is overridden - * in {@link AbstractJavaBaseColumn} where a table can be defined. - */ - public String getTable() { - return this.owner.getTypeMapping().getPrimaryTableName(); - } - - public boolean isResolved() { - return this.getDbColumn() != null; - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator connectedJavaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.connectedJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.nameTouches(pos, astRoot)) { - return this.getJavaCandidateNames(filter).iterator(); - } - return null; - } - - protected boolean nameTouches(int pos, CompilationUnit astRoot) { - return this.getColumnAnnotation().nameTouches(pos, astRoot); - } - - protected Iterable getJavaCandidateNames(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.getCandidateNames(filter)); - } - - protected Iterable getCandidateNames(Filter filter) { - return new FilteringIterable(this.getCandidateNames(), filter); - } - - protected Iterable getCandidateNames() { - Table dbTable = this.getDbTable(); - return (dbTable != null) ? dbTable.getSortedColumnIdentifiers() : EmptyIterable. instance(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.buildColumnValidator(astRoot).validate(messages, reporter); - } - - protected JptValidator buildColumnValidator(CompilationUnit astRoot) { - return this.owner.buildColumnValidator(this, buildTextRangeResolver(astRoot)); - } - - protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) { - return new JavaNamedColumnTextRangeResolver(this, astRoot); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getColumnAnnotation().getTextRange(astRoot); - return (textRange != null) ? textRange : this.owner.getValidationTextRange(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getColumnAnnotation().getNameTextRange(astRoot); - return (textRange != null) ? textRange : this.owner.getValidationTextRange(astRoot); - } - - - // ********** misc ********** - - public boolean isVirtual() { - return false; - } - - protected void initializeFrom(ReadOnlyNamedColumn oldColumn) { - this.setSpecifiedName(oldColumn.getSpecifiedName()); - this.setColumnDefinition(oldColumn.getColumnDefinition()); - } - - protected void initializeFromVirtual(ReadOnlyNamedColumn virtualColumn) { - this.setSpecifiedName(virtualColumn.getName()); - this.setColumnDefinition(virtualColumn.getColumnDefinition()); - } - - @Override - public void toString(StringBuilder sb) { - String table = this.getTable(); - if (table != null) { - sb.append(table); - sb.append('.'); - } - sb.append(this.getName()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMapping.java deleted file mode 100644 index a7614b8d84..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMapping.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaMappingRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaOneToManyRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaOrphanRemoval2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOneToManyMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0; -import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation; - -public abstract class AbstractJavaOneToManyMapping - extends AbstractJavaMultiRelationshipMapping - implements JavaOneToManyMapping2_0, JavaOrphanRemovalHolder2_0 -{ - protected final JavaOrphanRemovable2_0 orphanRemoval; - - - protected AbstractJavaOneToManyMapping(JavaPersistentAttribute parent) { - super(parent); - this.orphanRemoval = this.buildOrphanRemoval(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.orphanRemoval.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.orphanRemoval.update(); - } - - - // ********** relationship ********** - - @Override - public JavaOneToManyRelationship getRelationship() { - return (JavaOneToManyRelationship) super.getRelationship(); - } - - @Override - protected JavaMappingRelationship buildRelationship() { - return new GenericJavaOneToManyRelationship(this, this.isJpa2_0Compatible()); - } - - - // ********** orphan removal ********** - - public JavaOrphanRemovable2_0 getOrphanRemoval() { - return this.orphanRemoval; - } - - protected JavaOrphanRemovable2_0 buildOrphanRemoval() { - return this.isJpa2_0Compatible() ? - this.getJpaFactory2_0().buildJavaOrphanRemoval(this) : - new NullJavaOrphanRemoval2_0(this); - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return OneToManyAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMappingDefinition.java deleted file mode 100644 index fbc1bffffd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToManyMappingDefinition.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation; - -public abstract class AbstractJavaOneToManyMappingDefinition - implements JavaAttributeMappingDefinition -{ - protected AbstractJavaOneToManyMappingDefinition() { - super(); - } - - public String getKey() { - return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return OneToManyAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable getSupportingAnnotationNames() { - return SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - JoinTableAnnotation.ANNOTATION_NAME, - MapKeyAnnotation.ANNOTATION_NAME, - OrderByAnnotation.ANNOTATION_NAME, - JoinColumnAnnotation.ANNOTATION_NAME, - JoinColumnsAnnotation.ANNOTATION_NAME - }; - protected static final Iterable SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(SUPPORTING_ANNOTATION_NAMES_ARRAY); - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return factory.buildJavaOneToManyMapping(persistentAttribute); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMapping.java deleted file mode 100644 index 1fca5e88aa..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMapping.java +++ /dev/null @@ -1,86 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaOrphanRemoval2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOneToOneMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0; -import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation; - - -public abstract class AbstractJavaOneToOneMapping - extends AbstractJavaSingleRelationshipMapping - implements JavaOneToOneMapping2_0, JavaOrphanRemovalHolder2_0 -{ - protected final JavaOrphanRemovable2_0 orphanRemoval; - - - protected AbstractJavaOneToOneMapping(JavaPersistentAttribute parent) { - super(parent); - this.orphanRemoval = this.buildOrphanRemoval(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.orphanRemoval.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.orphanRemoval.update(); - } - - - // ********** relationship ********** - - @Override - public JavaOneToOneRelationship getRelationship() { - return (JavaOneToOneRelationship) super.getRelationship(); - } - - @Override - protected JavaOneToOneRelationship buildRelationship() { - return new GenericJavaOneToOneRelationship(this); - } - - - // ********** orphan removal ********** - - public JavaOrphanRemovable2_0 getOrphanRemoval() { - return this.orphanRemoval; - } - - protected JavaOrphanRemovable2_0 buildOrphanRemoval() { - return this.isJpa2_0Compatible() ? - this.getJpaFactory2_0().buildJavaOrphanRemoval(this) : - new NullJavaOrphanRemoval2_0(this); - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return OneToOneAnnotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMappingDefinition.java deleted file mode 100644 index e5df782d91..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOneToOneMappingDefinition.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.OneToOneAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation; - -public abstract class AbstractJavaOneToOneMappingDefinition - implements JavaAttributeMappingDefinition -{ - protected AbstractJavaOneToOneMappingDefinition() { - super(); - } - - public String getKey() { - return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return OneToOneAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable getSupportingAnnotationNames() { - return SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - JoinTableAnnotation.ANNOTATION_NAME, - JoinColumnAnnotation.ANNOTATION_NAME, - JoinColumnsAnnotation.ANNOTATION_NAME, - PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, - PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME - }; - protected static final Iterable SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(SUPPORTING_ANNOTATION_NAMES_ARRAY); - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return factory.buildJavaOneToOneMapping(persistentAttribute); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOverride.java deleted file mode 100644 index f460c8dbfa..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaOverride.java +++ /dev/null @@ -1,215 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverride; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Specified Java override - */ -public abstract class AbstractJavaOverride - extends AbstractJavaJpaContextNode - implements JavaOverride -{ - protected final A overrideAnnotation; - - protected String name; - - - protected AbstractJavaOverride(C parent, A overrideAnnotation) { - super(parent); - this.overrideAnnotation = overrideAnnotation; - this.name = this.buildName(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setName_(this.buildName()); - } - - - // ********** name ********** - - public String getName() { - return this.name; - } - - /** - * Strip the prefix (if necessary) before storing the name in the context - * model. Pass the unchanged name to the annotation. - */ - public void setName(String name) { - this.overrideAnnotation.setName(name); - this.setName_(this.stripPrefix(name)); - } - - protected void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - /** - * Strip the prefix (if necessary) from the name taken from the annotation - * before storing it in the context model. - */ - protected String buildName() { - return this.stripPrefix(this.overrideAnnotation.getName()); - } - - protected String stripPrefix(String rawName) { - if (rawName == null) { - return null; - } - String prefix = this.getPossiblePrefix(); - if (prefix == null) { - return rawName; - } - int prefixLength = prefix.length(); - if ((rawName.length() > prefixLength) && - (rawName.charAt(prefixLength) == '.') && - rawName.startsWith(prefix)) { - return rawName.substring(prefixLength + 1); - } - return rawName; - } - - protected String getPossiblePrefix() { - return this.getContainer().getPossiblePrefix(); - } - - - // ********** specified/virtual ********** - - public boolean isVirtual() { - return false; - } - - public JavaVirtualOverride convertToVirtual() { - return this.getContainer().convertOverrideToVirtual(this); - } - - - // ********** misc ********** - - @Override - @SuppressWarnings("unchecked") - public C getParent() { - return (C) super.getParent(); - } - - public C getContainer() { - return this.getParent(); - } - - public A getOverrideAnnotation() { - return this.overrideAnnotation; - } - - protected void initializeFrom(ReadOnlyOverride oldOverride) { - this.setName(this.prefix(oldOverride.getName())); - } - - protected void initializeFromVirtual(ReadOnlyOverride virtualOverride) { - this.setName(this.prefix(virtualOverride.getName())); - } - - protected String prefix(String oldName) { - if (oldName == null) { - return null; - } - String prefix = this.getWritePrefix(); - return (prefix == null) ? oldName : (prefix + '.' + oldName); - } - - protected String getWritePrefix() { - return this.getContainer().getWritePrefix(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.nameTouches(pos, astRoot)) { - return this.javaCandidateNames(filter); - } - return null; - } - - protected boolean nameTouches(int pos, CompilationUnit astRoot) { - return this.overrideAnnotation.nameTouches(pos, astRoot); - } - - protected Iterator javaCandidateNames(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.candidateNames(filter)); - } - - private Iterator candidateNames(Filter filter) { - return new FilteringIterator(this.candidateNames(), filter); - } - - protected abstract Iterator candidateNames(); - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.buildValidator(astRoot).validate(messages, reporter); - } - - protected JptValidator buildValidator(CompilationUnit astRoot) { - return this.getContainer().buildValidator(this, buildTextRangeResolver(astRoot)); - } - - protected OverrideTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) { - return new JavaOverrideTextRangeResolver(this, astRoot); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.overrideAnnotation.getTextRange(astRoot); - return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - TextRange textRange = this.overrideAnnotation.getNameTextRange(astRoot); - return (textRange != null) ? textRange : this.getValidationTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java deleted file mode 100644 index 10d11930cd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentAttribute.java +++ /dev/null @@ -1,816 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jdt.core.dom.Modifier; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.ClassName; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.CollectionMapping; -import org.eclipse.jpt.jpa.core.context.Embeddable; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaStructureNodes; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java persistent attributes - */ -public abstract class AbstractJavaPersistentAttribute - extends AbstractJavaJpaContextNode - implements JavaPersistentAttribute2_0 -{ - protected final JavaResourcePersistentAttribute resourcePersistentAttribute; - - protected String name; - - protected AccessType defaultAccess; - - protected JavaAttributeMapping mapping; // never null - protected String defaultMappingKey; - - - protected AbstractJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute resourcePersistentAttribute) { - super(parent); - this.resourcePersistentAttribute = resourcePersistentAttribute; - this.name = resourcePersistentAttribute.getName(); - - // this is determined directly from the resource model - this.defaultAccess = this.buildDefaultAccess(); - - // keep non-null at all times - this.mapping = this.buildMapping(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setName(this.resourcePersistentAttribute.getName()); - // this is determined directly from the resource model - this.setDefaultAccess(this.buildDefaultAccess()); - this.syncMapping(); - } - - @Override - public void update() { - super.update(); - this.updateMapping(); - } - - - // ********** name ********** - - public String getName() { - return this.name; - } - - protected void setName(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - - // ********** access ********** - - /** - * Subclasses determine the specified access. - */ - public AccessType getAccess() { - AccessType access = this.getSpecifiedAccess(); - return (access != null) ? access : this.defaultAccess; - } - - public abstract AccessType getSpecifiedAccess(); - - public AccessType getDefaultAccess() { - return this.defaultAccess; - } - - protected void setDefaultAccess(AccessType access) { - AccessType old = this.defaultAccess; - this.defaultAccess = access; - this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, access); - } - - protected AccessType buildDefaultAccess() { - return this.resourcePersistentAttribute.isField() ? AccessType.FIELD : AccessType.PROPERTY; - } - - - // ********** mapping ********** - - public JavaAttributeMapping getMapping() { - return this.mapping; - } - - /** - * Clients do not set the mapping directly. - * @see #setMappingKey(String) - */ - protected void setMapping(JavaAttributeMapping mapping) { - JavaAttributeMapping old = this.mapping; - this.mapping = mapping; - this.firePropertyChanged(MAPPING_PROPERTY, old, mapping); - } - - public String getMappingKey() { - return this.mapping.getKey(); - } - - /** - * Possible transitions: - * - * - * - * - *
- * null mapping/default
- * key = null - *
specified mapping A
- * key = "A" - *
specified mapping B
- * key = "B" - *
[default] null mapping - * do nothing - * add annotation A
- * set new mapping A - *
add annotation B
- * set new mapping B - *
default mapping A - * do nothing - * add annotation A
- * re-use default mapping A - *
add annotation B
- * set new mapping B - *
specified mapping A - * remove annotation A
- * set new default or null mapping - *
do nothing - * remove annotation A
- * add annotation B
- * set new mapping B - *
- * The "do nothing" transitions are handled in this method. - */ - public JavaAttributeMapping setMappingKey(String key) { - if (this.mapping.isDefault()) { - if (key == null) { - // leave the default mapping unchanged - } else { - this.setMappingKey_(key); // replace the default mapping - } - } else { - if (this.valuesAreEqual(key, this.mapping.getKey())) { - // leave the specified mapping unchanged - } else { - this.setMappingKey_(key); // replace the specified mapping - } - } - return this.mapping; - } - - /** - * We have either:
    - *
  • a default mapping and a non-null key - *
or
    - *
  • a specified mapping and a different (possibly - * null) key - *
- */ - protected void setMappingKey_(String key) { - JavaAttributeMappingDefinition definition = this.getSpecifiedMappingDefinition(key); - if (definition == null) { - // our mapping is "specified" and the key is null; - // check for a default definition - definition = this.getDefaultMappingDefinition(); - Iterable supportingAnnotationNames = (definition != null) ? definition.getSupportingAnnotationNames() : EmptyIterable.instance(); - // clear any mapping annotation(s); - // leave the "default" mapping's supporting annotations; - // if there is no "default" mapping, clear all supporting annotations too(?) - this.setMappingAnnotation(null, supportingAnnotationNames); - } else { - this.setMappingAnnotation(definition); - } - // note: 'definition' can still be null (if the key is null and there is no "default" mapping) - this.setMapping(this.buildMapping(definition)); - } - - /** - * pre-condition: definition is not null - */ - protected void setMappingAnnotation(JavaAttributeMappingDefinition definition) { - this.setMappingAnnotation(definition.getAnnotationName(), definition.getSupportingAnnotationNames()); - } - - protected void setMappingAnnotation(String primaryAnnotationName, Iterable supportingAnnotationNames) { - this.resourcePersistentAttribute.setPrimaryAnnotation(primaryAnnotationName, supportingAnnotationNames); - } - - protected JavaAttributeMapping buildMapping(JavaAttributeMappingDefinition definition) { - return (definition == null) ? this.buildNullMapping() : this.buildMapping_(definition); - } - - protected JavaAttributeMapping buildNullMapping() { - return this.getJpaFactory().buildJavaNullAttributeMapping(this); - } - - /** - * pre-condition: definition is not null - *

- * If we are converting a default mapping to its specified - * manifestation, we just keep the same mapping and create its annotation. - * We do not do the same thing when converting a specified - * mapping to its default manifestation. We rebuild the - * entire mapping, simplifying the clearing of all its state. We do this - * because we allow clients to modify a default mapping (or any of - * its components) directly, - * modifying its state and triggering a conversion to a specified - * mapping. The only way to convert a specified mapping to a - * default mapping is by {@link #setMappingKey(String) setting the - * mapping key} to null. - */ - protected JavaAttributeMapping buildMapping_(JavaAttributeMappingDefinition definition) { - // 'mapping' is null during construction - if ((this.mapping != null) && this.mapping.isDefault() && Tools.valuesAreEqual(this.mapping.getKey(), definition.getKey())) { - this.mapping.updateDefault(); // since nothing here changes, we need to update the mapping's flag - return this.mapping; - } - return definition.buildMapping(this, this.getJpaFactory()); - } - - /** - * We only look for a specified mapping here. - * We look for a default mapping during update. - */ - protected JavaAttributeMapping buildMapping() { - return this.buildMapping(this.getSpecifiedMappingDefinition()); - } - - /** - * Look for a specified mapping and sync our mapping. - */ - protected void syncMapping() { - JavaAttributeMappingDefinition definition = this.getSpecifiedMappingDefinition(); - if (definition == null) { - if (this.mapping.isDefault()) { - // null/default => null/default - this.mapping.synchronizeWithResourceModel(); - } else { - // specified => null/default - definition = this.getDefaultMappingDefinition(); - this.setMapping(this.buildMapping(definition)); - } - } else { - if (this.mapping.isDefault()) { - // null/default => specified - this.setMapping(this.buildMapping(definition)); - } else { - // specified => specified - if (this.valuesAreEqual(definition.getKey(), this.mapping.getKey())) { - this.mapping.synchronizeWithResourceModel(); - } else { - this.setMapping(this.buildMapping(definition)); - } - } - } - } - - /** - * Return the "specified" mapping definition for the specified key. - */ - protected JavaAttributeMappingDefinition getSpecifiedMappingDefinition(String key) { - if (key == null) { - return null; - } - for (JavaAttributeMappingDefinition definition : this.getSpecifiedMappingDefinitions()) { - if (Tools.valuesAreEqual(definition.getKey(), key)) { - return definition; - } - } - throw new IllegalArgumentException("invalid mapping key: " + key); //$NON-NLS-1$ - } - - /** - * Return the mapping definition for the mapping currently specified in the - * source code. - */ - protected JavaAttributeMappingDefinition getSpecifiedMappingDefinition() { - for (JavaAttributeMappingDefinition definition : this.getSpecifiedMappingDefinitions()) { - if (definition.isSpecified(this)) { - return definition; - } - } - return null; - } - - protected Iterable getSpecifiedMappingDefinitions() { - return this.getJpaPlatform().getSpecifiedJavaAttributeMappingDefinitions(); - } - - - // ********** default mapping ********** - - public String getDefaultMappingKey() { - return this.defaultMappingKey; - } - - protected void setDefaultMappingKey(String mappingKey) { - String old = this.defaultMappingKey; - this.defaultMappingKey = mappingKey; - this.firePropertyChanged(DEFAULT_MAPPING_KEY_PROPERTY, old, mappingKey); - } - - /** - * If a mapping annotation is specified, we would have already set a - * specified mapping in {@link #syncMapping()}. We need only check - * for changes to the default mapping. - */ - protected void updateMapping() { - JavaAttributeMappingDefinition definition = this.getDefaultMappingDefinition(); - String newDefaultKey = (definition == null) ? null : definition.getKey(); - if (this.mapping.isDefault() && Tools.valuesAreDifferent(this.mapping.getKey(), newDefaultKey)) { - this.setMapping(this.buildMapping(definition)); // the default mapping has changed - } else { - this.mapping.update(); - } - this.setDefaultMappingKey(newDefaultKey); - } - - protected JavaAttributeMappingDefinition getDefaultMappingDefinition() { - for (DefaultJavaAttributeMappingDefinition definition : this.getDefaultMappingDefinitions()) { - if (definition.isDefault(this)) { - return definition; - } - } - return null; - } - - protected Iterable getDefaultMappingDefinitions() { - return this.getJpaPlatform().getDefaultJavaAttributeMappingDefinitions(); - } - - - // ********** JpaStructureNode implementation ********** - - public String getId() { - return JavaStructureNodes.PERSISTENT_ATTRIBUTE_ID; - } - - public JpaStructureNode getStructureNode(int textOffset) { - return this; - } - - public TextRange getSelectionTextRange() { - return this.getSelectionTextRange(this.buildASTRoot()); - } - - protected TextRange getSelectionTextRange(CompilationUnit astRoot) { - return this.resourcePersistentAttribute.getNameTextRange(astRoot); - } - - protected CompilationUnit buildASTRoot() { - return this.resourcePersistentAttribute.getJavaResourceCompilationUnit().buildASTRoot(); - } - - public void dispose() { - // nothing to dispose - } - - - // ********** type ********** - - /** - * From the JPA spec, when the basic mapping applies:
- * If the type of the attribute (field or property) is one of the following - * it must be mapped as @javax.persistence.Basic:

    - *
  • byte[] - *
  • java.lang.Byte[] - *
  • char[] - *
  • java.lang.Character[] - *
  • primitive types (except void) - *
  • primitive wrappers (except java.lang.Void) - *
  • java.lang.String - *
  • java.math.BigInteger - *
  • java.math.BigDecimal - *
  • java.util.Date - *
  • java.util.Calendar - *
  • java.sql.Date - *
  • java.sql.Time - *
  • java.sql.Timestamp - *
  • enums - *
  • any other type that implements java.io.Serializable - *
- */ - public boolean typeIsBasic() { - // 'typeName' may include array brackets but not generic type arguments - String typeName = this.getTypeName(); - if (typeName == null) { - return false; - } - - int arrayDepth = ReflectionTools.getArrayDepthForTypeDeclaration(typeName); - if (arrayDepth > 1) { - return false; // multi-dimensional arrays are not supported - } - - if (arrayDepth == 1) { - String elementTypeName = ReflectionTools.getElementTypeNameForTypeDeclaration(typeName, 1); - return this.elementTypeIsValidForBasicArray(elementTypeName); - } - - // arrayDepth == 0 - if (ClassName.isVariablePrimitive(typeName)) { - return true; // any primitive but 'void' - } - if (ClassName.isVariablePrimitiveWrapper(typeName)) { - return true; // any primitive wrapper but 'java.lang.Void' - } - if (this.typeIsOtherValidBasicType(typeName)) { - return true; - } - if (this.resourcePersistentAttribute.typeIsEnum()) { - return true; - } - if (this.resourcePersistentAttribute.typeIsSubTypeOf(SERIALIZABLE_TYPE_NAME)) { - return true; - } - return false; - } - - /** - * Return whether the specified type is a valid element type for - * a one-dimensional array that can default to a basic mapping:
    - *
  • byte - *
  • java.lang.Byte - *
  • char - *
  • java.lang.Character - *
- */ - protected boolean elementTypeIsValidForBasicArray(String elementTypeName) { - return ArrayTools.contains(VALID_BASIC_ARRAY_ELEMENT_TYPE_NAMES, elementTypeName); - } - - protected static final String[] VALID_BASIC_ARRAY_ELEMENT_TYPE_NAMES = { - byte.class.getName(), - char.class.getName(), - java.lang.Byte.class.getName(), - java.lang.Character.class.getName() - }; - - /** - * Return whether the specified type is among the various "other" types - * that can default to a basic mapping. - */ - protected boolean typeIsOtherValidBasicType(String typeName) { - return ArrayTools.contains(OTHER_VALID_BASIC_TYPE_NAMES, typeName); - } - - protected static final String[] OTHER_VALID_BASIC_TYPE_NAMES = { - java.lang.String.class.getName(), - java.math.BigInteger.class.getName(), - java.math.BigDecimal.class.getName(), - java.util.Date.class.getName(), - java.util.Calendar.class.getName(), - java.sql.Date.class.getName(), - java.sql.Time.class.getName(), - java.sql.Timestamp.class.getName(), - }; - - protected static final String SERIALIZABLE_TYPE_NAME = java.io.Serializable.class.getName(); - - public String getSingleReferenceTargetTypeName() { - // 'typeName' may include array brackets ("[]") - // but not generic type arguments (e.g. "") - String typeName = this.getTypeName(); - if (typeName == null) { - return null; - } - if (ReflectionTools.getArrayDepthForTypeDeclaration(typeName) != 0) { - return null; // arrays cannot be entities - } - if (this.typeIsContainer(typeName)) { - return null; // "containers" cannot be entities - } - return typeName; - } - - public String getMultiReferenceTargetTypeName() { - return this.getJpaContainerDefinition().getMultiReferenceTargetTypeName(this.resourcePersistentAttribute); - } - - public String getMultiReferenceMapKeyTypeName() { - return this.getJpaContainerDefinition().getMultiReferenceMapKeyTypeName(this.resourcePersistentAttribute); - } - - /** - * return whether the specified type is one of the container - * types allowed by the JPA spec - */ - protected boolean typeIsContainer(String typeName) { - return this.getJpaContainerDefinition(typeName).isContainer(); - } - - - // ********** misc ********** - - @Override - public PersistentType getParent() { - return (PersistentType) super.getParent(); - } - - public PersistentType getOwningPersistentType() { - return this.getParent(); - } - - public TypeMapping getOwningTypeMapping() { - return this.getOwningPersistentType().getMapping(); - } - - public JavaPersistentAttribute getJavaPersistentAttribute() { - return this; - } - - public JavaResourcePersistentAttribute getResourcePersistentAttribute() { - return this.resourcePersistentAttribute; - } - - public String getPrimaryKeyColumnName() { - return this.getMapping().getPrimaryKeyColumnName(); - } - - public String getTypeName() { - return this.resourcePersistentAttribute.getTypeName(); - } - - /** - * Java attributes always correspond to attributes in the source code. - */ - public boolean isVirtual() { - return false; - } - - public boolean contains(int offset, CompilationUnit astRoot) { - TextRange fullTextRange = this.getFullTextRange(astRoot); - // 'fullTextRange' will be null if the attribute no longer exists in the java; - // the context model can be out of synch with the resource model - // when a selection event occurs before the context model has a - // chance to synch with the resource model via the update thread - return (fullTextRange == null) ? false : fullTextRange.includes(offset); - } - - protected TextRange getFullTextRange(CompilationUnit astRoot) { - return this.resourcePersistentAttribute.getTextRange(astRoot); - } - - public Embeddable getEmbeddable() { - String typeName = this.getTypeName(); - return (typeName == null) ? null : this.getPersistenceUnit().getEmbeddable(typeName); - } - - public boolean isField() { - return this.resourcePersistentAttribute.isField(); - } - - public boolean isProperty() { - return this.resourcePersistentAttribute.isProperty(); - } - - public boolean isPublic() { - return Modifier.isPublic(this.resourcePersistentAttribute.getModifiers()); - } - - public boolean isFinal() { - return Modifier.isFinal(this.resourcePersistentAttribute.getModifiers()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getSelectionTextRange(astRoot); - } - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - - this.validateAttribute(messages, reporter, astRoot); - - this.getMapping().validate(messages, reporter, astRoot); - } - - protected void validateAttribute(List messages, IReporter reporter, CompilationUnit astRoot) { - this.buildAttibuteValidator(astRoot).validate(messages, reporter); - } - - protected abstract JptValidator buildAttibuteValidator(CompilationUnit astRoot); - - protected PersistentAttributeTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) { - return new JavaPersistentAttributeTextRangeResolver(this, astRoot); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - return this.getMapping().javaCompletionProposals(pos, filter, astRoot); - } - - - // ********** metamodel ********** - - public String getMetamodelContainerFieldTypeName() { - return this.getJpaContainerDefinition().getMetamodelContainerFieldTypeName(); - } - - public String getMetamodelContainerFieldMapKeyTypeName() { - return this.getJpaContainerDefinition().getMetamodelContainerFieldMapKeyTypeName((CollectionMapping) this.getMapping()); - } - - public String getMetamodelTypeName() { - String typeName = this.getTypeName(); - if (typeName == null) { - return MetamodelField.DEFAULT_TYPE_NAME; - } - if (ClassName.isPrimitive(typeName)) { - return ClassName.getWrapperClassName(typeName); // ??? - } - return typeName; - } - - - // ********** JPA container definition ********** - - public JpaContainerDefinition getJpaContainerDefinition() { - // 'typeName' may include array brackets ("[]") - // but not generic type arguments (e.g. "") - return this.getJpaContainerDefinition(this.resourcePersistentAttribute.getTypeName()); - } - - /** - * Return the JPA container definition corresponding to the specified type; - * return a "null" definition if the specified type is not one of the - * container types allowed by the JPA spec. - */ - protected JpaContainerDefinition getJpaContainerDefinition(String typeName) { - for (JpaContainerDefinition definition : this.getJpaContainerDefinitions()) { - if (definition.getTypeName().equals(typeName)) { - return definition; - } - } - return JpaContainerDefinition.Null.instance(); - } - - protected Iterable getJpaContainerDefinitions() { - return JPA_CONTAINER_DEFINITIONS; - } - - protected static final JpaContainerDefinition[] JPA_CONTAINER_DEFINITION_ARRAY = new JpaContainerDefinition[] { - new CollectionJpaContainerDefinition(java.util.Collection.class, JPA2_0.COLLECTION_ATTRIBUTE), - new CollectionJpaContainerDefinition(java.util.Set.class, JPA2_0.SET_ATTRIBUTE), - new CollectionJpaContainerDefinition(java.util.List.class, JPA2_0.LIST_ATTRIBUTE), - new MapJpaContainerDefinition(java.util.Map.class, JPA2_0.MAP_ATTRIBUTE) - }; - - protected static final Iterable JPA_CONTAINER_DEFINITIONS = new ArrayIterable(JPA_CONTAINER_DEFINITION_ARRAY); - - - /** - * Abstract JPA container definition - */ - protected abstract static class AbstractJpaContainerDefinition - implements JpaContainerDefinition - { - protected final String typeName; - protected final String metamodelContainerFieldTypeName; - - protected AbstractJpaContainerDefinition(Class containerClass, String metamodelContainerFieldTypeName) { - this(containerClass.getName(), metamodelContainerFieldTypeName); - } - - protected AbstractJpaContainerDefinition(String typeName, String metamodelContainerFieldTypeName) { - super(); - if ((typeName == null) || (metamodelContainerFieldTypeName == null)) { - throw new NullPointerException(); - } - this.typeName = typeName; - this.metamodelContainerFieldTypeName = metamodelContainerFieldTypeName; - } - - public String getTypeName() { - return this.typeName; - } - - public boolean isContainer() { - return true; - } - - public String getMetamodelContainerFieldTypeName() { - return this.metamodelContainerFieldTypeName; - } - - } - - /** - * Collection JPA container definition - */ - protected static class CollectionJpaContainerDefinition - extends AbstractJpaContainerDefinition - { - protected CollectionJpaContainerDefinition(Class collectionClass, String staticMetamodelTypeDeclarationTypeName) { - super(collectionClass, staticMetamodelTypeDeclarationTypeName); - } - - public String getMultiReferenceTargetTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) { - return (resourcePersistentAttribute.typeTypeArgumentNamesSize() == 1) ? - resourcePersistentAttribute.getTypeTypeArgumentName(0) : - null; - } - - public String getMultiReferenceMapKeyTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) { - return null; - } - - public String getMetamodelContainerFieldMapKeyTypeName(CollectionMapping mapping) { - return null; - } - - public boolean isMap() { - return false; - } - } - - /** - * Map JPA container definition - */ - protected static class MapJpaContainerDefinition - extends AbstractJpaContainerDefinition - { - protected MapJpaContainerDefinition(Class mapClass, String staticMetamodelTypeDeclarationTypeName) { - super(mapClass, staticMetamodelTypeDeclarationTypeName); - } - - public String getMultiReferenceTargetTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) { - return (resourcePersistentAttribute.typeTypeArgumentNamesSize() == 2) ? - resourcePersistentAttribute.getTypeTypeArgumentName(1) : - null; - } - - public String getMultiReferenceMapKeyTypeName(JavaResourcePersistentAttribute resourcePersistentAttribute) { - return (resourcePersistentAttribute.typeTypeArgumentNamesSize() == 2) ? - resourcePersistentAttribute.getTypeTypeArgumentName(0) : - null; - } - - public String getMetamodelContainerFieldMapKeyTypeName(CollectionMapping mapping) { - return mapping.getMetamodelFieldMapKeyTypeName(); - } - - public boolean isMap() { - return true; - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java deleted file mode 100644 index 3891dcca22..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaPersistentType.java +++ /dev/null @@ -1,722 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Collection; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.ClassName; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.ChainIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.jpa.core.JpaFile; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaStructureNodes; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNode; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java persistent type:
    - *
  • name - *
  • access - *
  • mapping - *
  • attributes - *
  • super persistent type - *
- */ -public abstract class AbstractJavaPersistentType - extends AbstractJavaJpaContextNode - implements JavaPersistentType -{ - protected final JavaResourcePersistentType resourcePersistentType; - - protected String name; - - protected PersistentType superPersistentType; - - protected AccessType specifiedAccess; - protected AccessType defaultAccess; // never null - - protected JavaTypeMapping mapping; // never null - - protected final Vector attributes = new Vector(); - protected final AttributeContainerAdapter attributeContainerAdapter = new AttributeContainerAdapter(); - - - protected AbstractJavaPersistentType(PersistentType.Owner parent, JavaResourcePersistentType resourcePersistentType) { - super(parent); - this.resourcePersistentType = resourcePersistentType; - this.name = resourcePersistentType.getQualifiedName(); - this.specifiedAccess = this.buildSpecifiedAccess(); - - // keep this non-null - this.defaultAccess = AccessType.FIELD; - - this.mapping = this.buildMapping(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setName(this.resourcePersistentType.getQualifiedName()); - this.setSpecifiedAccess_(this.buildSpecifiedAccess()); - this.syncMapping(); - this.synchronizeNodesWithResourceModel(this.getAttributes()); - } - - @Override - public void update() { - super.update(); - this.setSuperPersistentType(this.buildSuperPersistentType()); - this.setDefaultAccess(this.buildDefaultAccess()); - this.mapping.update(); - this.updateAttributes(); - this.registerRootStructureNode(); - } - - - // ********** name ********** - - public String getName() { - return this.name; - } - - public String getSimpleName(){ - return ClassName.getSimpleName(this.name); - } - - protected void setName(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - - // ********** super persistent type ********** - - public PersistentType getSuperPersistentType() { - return this.superPersistentType; - } - - protected void setSuperPersistentType(PersistentType superPersistentType) { - PersistentType old = this.superPersistentType; - this.superPersistentType = superPersistentType; - this.firePropertyChanged(SUPER_PERSISTENT_TYPE_PROPERTY, old, superPersistentType); - } - - protected PersistentType buildSuperPersistentType() { - HashSet visited = new HashSet(); - visited.add(this.resourcePersistentType); - PersistentType spt = this.resolveSuperPersistentType(this.resourcePersistentType.getSuperclassQualifiedName(), visited); - if (spt == null) { - return null; - } - if (CollectionTools.contains(spt.inheritanceHierarchy(), this)) { - return null; // short-circuit in this case, we have circular inheritance - } - return spt.isMapped() ? spt : spt.getSuperPersistentType(); - } - - /** - * The JPA spec allows non-persistent types in a persistent type's - * inheritance hierarchy. We check for a persistent type with the - * specified name in the persistence unit. If it is not found we use - * resource persistent type and look for its super type. - *

- * The visited collection is used to detect a cycle in the - * resource type inheritance hierarchy and prevent the resulting - * stack overflow. Any cycles in the context type inheritance - * hierarchy are handled in {@link #buildSuperPersistentType()}. - */ - protected PersistentType resolveSuperPersistentType(String typeName, Collection visited) { - if (typeName == null) { - return null; - } - JavaResourcePersistentType resourceType = this.getJpaProject().getJavaResourcePersistentType(typeName); - if ((resourceType == null) || visited.contains(resourceType)) { - return null; - } - visited.add(resourceType); - PersistentType spt = this.resolvePersistentType(typeName); - return (spt != null) ? spt : this.resolveSuperPersistentType(resourceType.getSuperclassQualifiedName(), visited); // recurse - } - - protected PersistentType resolvePersistentType(String typeName) { - return this.getPersistenceUnit().getPersistentType(typeName); - } - - - // ********** access ********** - - public AccessType getAccess() { - return (this.specifiedAccess != null) ? this.specifiedAccess : this.defaultAccess; - } - - public AccessType getSpecifiedAccess() { - return this.specifiedAccess; - } - - protected void setSpecifiedAccess_(AccessType access) { - AccessType old = this.specifiedAccess; - this.specifiedAccess = access; - this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, access); - } - - /** - * Build an access type based on annotations from the resource model. - * (This is JPA platform-dependent.) - */ - protected abstract AccessType buildSpecifiedAccess(); - - public AccessType getDefaultAccess() { - return this.defaultAccess; - } - - protected void setDefaultAccess(AccessType access) { - AccessType old = this.defaultAccess; - this.defaultAccess = access; - this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, access); - } - - /** - * Check the access "specified" by the Java resource model:

    - *
  • Check Java annotations first - *
  • If null, check XML mapping specified access - *
  • If still null, check {@link #superPersistentType} access - *
  • If still null, check entity-mappings - * specified access setting if the corresponding persistent-type - * is listed in a mapping (orm.xml) file - *
  • If still null, check the persistence-unit - * default Access - *
  • Default to {@link AccessType#FIELD FIELD} if all else fails. - *
- */ - protected AccessType buildDefaultAccess() { - AccessType accessType = AccessType.fromJavaResourceModel(JavaResourcePersistentType.Tools.buildAccess(this.resourcePersistentType)); - if (accessType != null) { - return accessType; - } - accessType = this.getOwnerOverrideAccess(); - if (accessType != null) { - return accessType; - } - - if (this.superPersistentType != null) { - accessType = this.superPersistentType.getAccess(); - if (accessType != null) { - return accessType; - } - } - - accessType = this.getOwnerDefaultAccess(); - if (accessType != null) { - return accessType; - } - - // last ditch attempt to allow the user to annotate *something* - return AccessType.FIELD; - } - - - // ********** mapping ********** - - public JavaTypeMapping getMapping() { - return this.mapping; - } - - public String getMappingKey() { - return this.mapping.getKey(); - } - - public void setMappingKey(String key) { - if (this.valuesAreDifferent(key, this.getMappingKey())) { - this.setMapping(this.buildMapping(key)); - } - } - - protected JavaTypeMapping buildMapping(String key) { - for (JavaTypeMappingDefinition definition : this.getMappingDefinitions()) { - if (Tools.valuesAreEqual(definition.getKey(), key)) { - Annotation annotation = this.resourcePersistentType.setPrimaryAnnotation(definition.getAnnotationName(), definition.getSupportingAnnotationNames()); - return definition.buildMapping(this, annotation, this.getJpaFactory()); - } - } - this.resourcePersistentType.setPrimaryAnnotation(null, EmptyIterable.instance()); - return this.buildNullMapping(); - } - - /** - * Clients do not set the mapping directly. - * @see #setMappingKey(String) - */ - protected void setMapping(JavaTypeMapping mapping) { - JavaTypeMapping old = this.mapping; - this.mapping = mapping; - this.firePropertyChanged(MAPPING_PROPERTY, old, mapping); - } - - protected JavaTypeMapping buildMapping() { - for (JavaTypeMappingDefinition definition : this.getMappingDefinitions()) { - Annotation annotation = this.resourcePersistentType.getAnnotation(definition.getAnnotationName()); - if (annotation != null) { - return definition.buildMapping(this, annotation, this.getJpaFactory()); - } - } - return this.buildNullMapping(); - } - - protected void syncMapping() { - JavaTypeMappingDefinition definition = null; - Annotation annotation = null; - for (Iterator stream = this.mappingDefinitions(); stream.hasNext(); ) { - definition = stream.next(); - annotation = this.resourcePersistentType.getAnnotation(definition.getAnnotationName()); - if (annotation != null) { - break; - } - } - // 'annotation' can still be null when we get here - if (this.mapping.getMappingAnnotation() == annotation) { - this.mapping.synchronizeWithResourceModel(); - } else { - this.setMapping(this.buildMapping(annotation, definition)); - } - } - - protected JavaTypeMapping buildMapping(Annotation annotation, JavaTypeMappingDefinition definition) { - return (annotation != null) ? - definition.buildMapping(this, annotation, this.getJpaFactory()) : - this.buildNullMapping(); - } - - protected Iterator mappingDefinitions() { - return this.getMappingDefinitions().iterator(); - } - - protected Iterable getMappingDefinitions() { - return this.getJpaPlatform().getJavaTypeMappingDefinitions(); - } - - protected JavaTypeMapping buildNullMapping() { - return this.getJpaFactory().buildJavaNullTypeMapping(this); - } - - public boolean isMapped() { - return this.mapping.isMapped(); - } - - - // ********** attributes ********** - - public ListIterator attributes() { - return this.getAttributes().iterator(); - } - - protected ListIterable getAttributes() { - return new LiveCloneListIterable(this.attributes); - } - - public int attributesSize() { - return this.attributes.size(); - } - - public Iterator attributeNames() { - return this.getAttributeNames().iterator(); - } - - protected Iterable getAttributeNames() { - return this.convertToNames(this.getAttributes()); - } - - public JavaPersistentAttribute getAttributeNamed(String attributeName) { - Iterator stream = this.getAttributesNamed(attributeName).iterator(); - return stream.hasNext() ? stream.next() : null; - } - - public JavaPersistentAttribute getAttributeFor(JavaResourcePersistentAttribute javaResourceAttribute) { - for (JavaPersistentAttribute javaAttribute : this.getAttributes()) { - if (javaAttribute.getResourcePersistentAttribute() == javaResourceAttribute) { - return javaAttribute; - } - } - return null; - } - - public Iterator allAttributes() { - return this.getAllAttributes().iterator(); - } - - protected Iterable getAllAttributes() { - return new CompositeIterable( - new TransformationIterable>(this.getInheritanceHierarchy()) { - @Override - protected Iterable transform(PersistentType pt) { - return new SnapshotCloneIterable(pt.attributes()); - } - } - ); - } - - public Iterator allAttributeNames() { - return this.getAllAttributeNames().iterator(); - } - - protected Iterable getAllAttributeNames() { - return this.convertToNames(this.getAllAttributes()); - } - - protected Iterable getAttributesNamed(final String attributeName) { - return new FilteringIterable(this.getAttributes()) { - @Override - protected boolean accept(JavaPersistentAttribute attribute) { - return Tools.valuesAreEqual(attributeName, attribute.getName()); - } - }; - } - - public ReadOnlyPersistentAttribute resolveAttribute(String attributeName) { - Iterator stream = this.getAttributesNamed(attributeName).iterator(); - if (stream.hasNext()) { - JavaPersistentAttribute attribute = stream.next(); - // return null if we have more than one - return stream.hasNext() ? null : attribute; - } - // recurse - return (this.superPersistentType == null) ? null : this.superPersistentType.resolveAttribute(attributeName); - } - - protected Iterable convertToNames(Iterable attrs) { - return new TransformationIterable(attrs) { - @Override - protected String transform(ReadOnlyPersistentAttribute attribute) { - return attribute.getName(); - } - }; - } - - protected Iterator resourceAttributes() { - return (this.getAccess() == AccessType.PROPERTY) ? - this.resourcePersistentType.persistableProperties() : - this.resourcePersistentType.persistableFields(); - } - - protected Iterable getResourceAttributes() { - return CollectionTools.iterable(this.resourceAttributes()); - } - - protected JavaPersistentAttribute buildAttribute(JavaResourcePersistentAttribute resourceAttribute) { - return this.getJpaFactory().buildJavaPersistentAttribute(this, resourceAttribute); - } - - public boolean hasAnyAnnotatedAttributes() { - return this.resourcePersistentType.hasAnyAnnotatedAttributes(); - } - - /** - * The attributes are synchronized during the update because - * the list of resource attributes is determined by the access type - * which can be controlled in a number of different places.... - */ - protected void updateAttributes() { - ContextContainerTools.update(this.attributeContainerAdapter); - } - - protected void moveAttribute(int index, JavaPersistentAttribute attribute) { - this.moveItemInList(index, attribute, this.attributes, ATTRIBUTES_LIST); - } - - protected void addAttribute(int index, JavaResourcePersistentAttribute resourceAttribute) { - this.addItemToList(index, this.buildAttribute(resourceAttribute), this.attributes, ATTRIBUTES_LIST); - } - - protected void removeAttribute(JavaPersistentAttribute attribute) { - this.removeItemFromList(attribute, this.attributes, ATTRIBUTES_LIST); - } - - /** - * attribute container adapter - */ - protected class AttributeContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractJavaPersistentType.this.getAttributes(); - } - public Iterable getResourceElements() { - return AbstractJavaPersistentType.this.getResourceAttributes(); - } - public JavaResourcePersistentAttribute getResourceElement(JavaPersistentAttribute contextElement) { - return contextElement.getResourcePersistentAttribute(); - } - public void moveContextElement(int index, JavaPersistentAttribute element) { - AbstractJavaPersistentType.this.moveAttribute(index, element); - } - public void addContextElement(int index, JavaResourcePersistentAttribute resourceElement) { - AbstractJavaPersistentType.this.addAttribute(index, resourceElement); - } - public void removeContextElement(JavaPersistentAttribute element) { - AbstractJavaPersistentType.this.removeAttribute(element); - } - } - - - // ********** inheritance ********** - - public Iterator inheritanceHierarchy() { - return this.getInheritanceHierarchy().iterator(); - } - - public Iterable getInheritanceHierarchy() { - return this.getInheritanceHierarchyOf(this); - } - - public Iterator ancestors() { - return this.getAncestors().iterator(); - } - - public Iterable getAncestors() { - return this.getInheritanceHierarchyOf(this.superPersistentType); - } - - protected Iterable getInheritanceHierarchyOf(PersistentType start) { - // using a chain iterable to traverse up the inheritance tree - return new ChainIterable(start) { - @Override - protected PersistentType nextLink(PersistentType persistentType) { - return persistentType.getSuperPersistentType(); - } - }; - } - - - // ********** JpaStructureNode implementation ********** - - public String getId() { - return JavaStructureNodes.PERSISTENT_TYPE_ID; - } - - // it would be nice if the we passed in an astRoot here, but then we - // would need to pass it to the XML structure nodes too... - public JpaStructureNode getStructureNode(int offset) { - CompilationUnit astRoot = this.buildASTRoot(); - - if (this.contains(offset, astRoot)) { - for (JavaPersistentAttribute persistentAttribute : this.getAttributes()) { - if (persistentAttribute.contains(offset, astRoot)) { - return persistentAttribute; - } - } - return this; - } - return null; - } - - protected boolean contains(int offset, CompilationUnit astRoot) { - TextRange fullTextRange = this.getFullTextRange(astRoot); - // 'fullTextRange' will be null if the type no longer exists in the java; - // the context model can be out of synch with the resource model - // when a selection event occurs before the context model has a - // chance to synch with the resource model via the update thread - return (fullTextRange == null) ? false : fullTextRange.includes(offset); - } - - protected TextRange getFullTextRange(CompilationUnit astRoot) { - return this.resourcePersistentType.getTextRange(astRoot); - } - - public TextRange getSelectionTextRange() { - return this.getSelectionTextRange(this.buildASTRoot()); - } - - protected TextRange getSelectionTextRange(CompilationUnit astRoot) { - return this.resourcePersistentType.getNameTextRange(astRoot); - } - - public void dispose() { - this.unregisterRootStructureNode(); - } - - protected void registerRootStructureNode() { - JpaFile jpaFile = this.getJpaFile(); - // the JPA file can be null if the resource type is "external" - if (jpaFile != null) { - jpaFile.addRootStructureNode(this.name, this); - } - } - - protected void unregisterRootStructureNode() { - JpaFile jpaFile = this.getJpaFile(); - // the JPA file can be null if the .java file was deleted - // or the resource type is "external" - if (jpaFile != null) { - jpaFile.removeRootStructureNode(this.name, this); - } - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - Iterator values = this.mapping.javaCompletionProposals(pos, filter, astRoot); - if (values != null) { - return values; - } - for (JavaPersistentAttribute attribute : this.getAttributes()) { - values = attribute.javaCompletionProposals(pos, filter, astRoot); - if (values != null) { - return values; - } - } - return EmptyIterator.instance(); - } - - - // ********** validation ********** - - public void validate(List messages, IReporter reporter) { - if (reporter.isCancelled()) { - throw new ValidationCancelledException(); - } - // TODO temporary hack since we don't know yet where to put - // any messages for types in another project (e.g. referenced by - // persistence.xml) - IFile file = this.resourcePersistentType.getFile(); - // 'file' will be null if the type is "external" and binary; - // the file will be in a different project if the type is "external" and source; - // the type will be binary if it is in a JAR in the current project - if ((file != null) && file.getProject().equals(this.getJpaProject().getProject()) && - (this.resourcePersistentType instanceof SourceNode)) { - // build the AST root here to pass down - this.validate(messages, reporter, this.buildASTRoot()); - } - } - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.validateMapping(messages, reporter, astRoot); - this.validateAttributes(messages, reporter, astRoot); - } - - protected void validateMapping(List messages, IReporter reporter, CompilationUnit astRoot) { - try { - this.mapping.validate(messages, reporter, astRoot); - } catch(Throwable t) { - JptJpaCorePlugin.log(t); - } - } - - protected void validateAttributes(List messages, IReporter reporter, CompilationUnit astRoot) { - for (JavaPersistentAttribute attribute : this.getAttributes()) { - this.validateAttribute(attribute, reporter, messages, astRoot); - } - } - - protected void validateAttribute(JavaPersistentAttribute attribute, IReporter reporter, List messages, CompilationUnit astRoot) { - try { - attribute.validate(messages, reporter, astRoot); - } catch(Throwable t) { - JptJpaCorePlugin.log(t); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getSelectionTextRange(astRoot); - } - - - // ********** misc ********** - - @Override - public PersistentType.Owner getParent() { - return (PersistentType.Owner) super.getParent(); - } - - @Override - public IResource getResource() { - return this.resourcePersistentType.getFile(); - } - - public JavaResourcePersistentType getResourcePersistentType() { - return this.resourcePersistentType; - } - - public AccessType getOwnerOverrideAccess() { - return this.getParent().getOverridePersistentTypeAccess(); - } - - public AccessType getOwnerDefaultAccess() { - return this.getParent().getDefaultPersistentTypeAccess(); - } - - protected CompilationUnit buildASTRoot() { - return this.resourcePersistentType.getJavaResourceCompilationUnit().buildASTRoot(); - } - - protected JpaFile getJpaFile() { - return this.getJpaFile(this.resourcePersistentType.getFile()); - } - - public boolean isFor(String typeName) { - return Tools.valuesAreEqual(typeName, this.getName()); - } - - public boolean isIn(IPackageFragment packageFragment) { - return Tools.valuesAreEqual(packageFragment.getElementName(), this.getPackageName()); - } - - protected String getPackageName() { - return this.getResourcePersistentType().getPackageName(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java deleted file mode 100644 index 9f92fa8592..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaQuery.java +++ /dev/null @@ -1,231 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jpa.core.context.Query; -import org.eclipse.jpt.jpa.core.context.QueryHint; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaQuery; -import org.eclipse.jpt.jpa.core.context.java.JavaQueryHint; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.resource.java.QueryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation; - -/** - * Java query - */ -public abstract class AbstractJavaQuery
- extends AbstractJavaJpaContextNode - implements JavaQuery -{ - protected final A queryAnnotation; - - protected String name; - - protected String query; - - protected final Vector hints = new Vector(); - protected final HintContainerAdapter hintContainerAdapter = new HintContainerAdapter(); - - - protected AbstractJavaQuery(JavaJpaContextNode parent, A queryAnnotation) { - super(parent); - this.queryAnnotation = queryAnnotation; - this.name = queryAnnotation.getName(); - this.query = queryAnnotation.getQuery(); - this.initializeHints(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setName_(this.queryAnnotation.getName()); - this.setQuery_(this.queryAnnotation.getQuery()); - this.syncHints(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getHints()); - this.getPersistenceUnit().addQuery(this); - } - - - // ********** name ********** - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.queryAnnotation.setName(name); - this.setName_(name); - } - - protected void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - - // ********** query ********** - - public String getQuery() { - return this.query; - } - - public void setQuery(String query) { - this.queryAnnotation.setQuery(query); - this.setQuery_(query); - } - - protected void setQuery_(String query) { - String old = this.query; - this.query = query; - this.firePropertyChanged(QUERY_PROPERTY, old, query); - } - - - // ********** hints ********** - - public ListIterable getHints() { - return new LiveCloneListIterable(this.hints); - } - - public int getHintsSize() { - return this.hints.size(); - } - - public JavaQueryHint addHint() { - return this.addHint(this.hints.size()); - } - - public JavaQueryHint addHint(int index) { - QueryHintAnnotation annotation = this.queryAnnotation.addHint(index); - return this.addHint_(index, annotation); - } - - public void removeHint(QueryHint hint) { - this.removeHint(this.hints.indexOf(hint)); - } - - public void removeHint(int index) { - this.queryAnnotation.removeHint(index); - this.removeHint_(index); - } - - protected void removeHint_(int index) { - this.removeItemFromList(index, this.hints, HINTS_LIST); - } - - public void moveHint(int targetIndex, int sourceIndex) { - this.queryAnnotation.moveHint(targetIndex, sourceIndex); - this.moveItemInList(targetIndex, sourceIndex, this.hints, HINTS_LIST); - } - - protected void initializeHints() { - for (Iterator stream = this.queryAnnotation.hints(); stream.hasNext(); ) { - this.hints.add(this.buildHint(stream.next())); - } - } - - protected JavaQueryHint buildHint(QueryHintAnnotation hintAnnotation) { - return this.getJpaFactory().buildJavaQueryHint(this, hintAnnotation); - } - - protected void syncHints() { - ContextContainerTools.synchronizeWithResourceModel(this.hintContainerAdapter); - } - - protected Iterable getHintAnnotations() { - return CollectionTools.iterable(this.queryAnnotation.hints()); - } - - protected void moveHint_(int index, JavaQueryHint hint) { - this.moveItemInList(index, hint, this.hints, HINTS_LIST); - } - - protected JavaQueryHint addHint_(int index, QueryHintAnnotation hintAnnotation) { - JavaQueryHint hint = this.buildHint(hintAnnotation); - this.addItemToList(index, hint, this.hints, HINTS_LIST); - return hint; - } - - protected void removeHint_(JavaQueryHint hint) { - this.removeHint_(this.hints.indexOf(hint)); - } - - /** - * hint container adapter - */ - protected class HintContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractJavaQuery.this.getHints(); - } - public Iterable getResourceElements() { - return AbstractJavaQuery.this.getHintAnnotations(); - } - public QueryHintAnnotation getResourceElement(JavaQueryHint contextElement) { - return contextElement.getQueryHintAnnotation(); - } - public void moveContextElement(int index, JavaQueryHint element) { - AbstractJavaQuery.this.moveHint_(index, element); - } - public void addContextElement(int index, QueryHintAnnotation resourceElement) { - AbstractJavaQuery.this.addHint_(index, resourceElement); - } - public void removeContextElement(JavaQueryHint element) { - AbstractJavaQuery.this.removeHint_(element); - } - } - - - // ********** misc ********** - - public A getQueryAnnotation() { - return this.queryAnnotation; - } - - public boolean overrides(Query other) { - return MappingTools.nodeOverrides(this, other, PRECEDENCE_TYPE_LIST); - } - - public boolean duplicates(Query other) { - return MappingTools.nodesAreDuplicates(this, other); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.queryAnnotation.getTextRange(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.queryAnnotation.getNameTextRange(astRoot); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaReadOnlyUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaReadOnlyUniqueConstraint.java deleted file mode 100644 index 053fe6fb83..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaReadOnlyUniqueConstraint.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Vector; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyUniqueConstraint; - -public abstract class AbstractJavaReadOnlyUniqueConstraint - extends AbstractJavaJpaContextNode - implements JavaReadOnlyUniqueConstraint -{ - protected final Vector columnNames = new Vector(); - - - public AbstractJavaReadOnlyUniqueConstraint(JavaJpaContextNode parent) { - super(parent); - } - - - // ********** column names ********** - - public Iterable getColumnNames() { - return new LiveCloneIterable(this.columnNames); - } - - public int getColumnNamesSize() { - return this.columnNames.size(); - } - - public String getColumnName(int index) { - return this.columnNames.get(index); - } - - protected void syncColumnNames() { - this.synchronizeList(this.getResourceColumnNames(), this.columnNames, COLUMN_NAMES_LIST); - } - - protected abstract Iterable getResourceColumnNames(); - - @Override - public void toString(StringBuilder sb) { - sb.append(this.columnNames); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java deleted file mode 100644 index 95788f0127..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaRelationshipMapping.java +++ /dev/null @@ -1,347 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.FetchType; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaCascade; -import org.eclipse.jpt.jpa.core.context.java.JavaMappingRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipMapping; -import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaCascade; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.resource.java.RelationshipMappingAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java relationship mapping (1:1, 1:m, m:1, m:m) - */ -public abstract class AbstractJavaRelationshipMapping - extends AbstractJavaAttributeMapping - implements JavaRelationshipMapping -{ - protected String specifiedTargetEntity; - protected String defaultTargetEntity; - protected String fullyQualifiedTargetEntity; - - protected final JavaMappingRelationship relationship; - - protected final JavaCascade cascade; - - protected FetchType specifiedFetch; - protected FetchType defaultFetch; - - - protected AbstractJavaRelationshipMapping(JavaPersistentAttribute parent) { - super(parent); - this.specifiedTargetEntity = this.buildSpecifiedTargetEntity(); - this.relationship = this.buildRelationship(); - this.cascade = this.buildCascade(); - this.specifiedFetch = this.buildSpecifiedFetch(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedTargetEntity_(this.buildSpecifiedTargetEntity()); - this.relationship.synchronizeWithResourceModel(); - this.cascade.synchronizeWithResourceModel(); - this.setSpecifiedFetch_(this.buildSpecifiedFetch()); - } - - @Override - public void update() { - super.update(); - this.setDefaultTargetEntity(this.buildDefaultTargetEntity()); - this.setFullyQualifiedTargetEntity(this.buildFullyQualifiedTargetEntity()); - this.relationship.update(); - this.cascade.update(); - this.setDefaultFetch(this.buildDefaultFetch()); - } - - - // ********** target entity ********** - - public String getTargetEntity() { - return (this.specifiedTargetEntity != null) ? this.specifiedTargetEntity : this.defaultTargetEntity; - } - - public String getSpecifiedTargetEntity() { - return this.specifiedTargetEntity; - } - - public void setSpecifiedTargetEntity(String entity) { - if (this.valuesAreDifferent(entity, this.specifiedTargetEntity)) { - this.getAnnotationForUpdate().setTargetEntity(entity); - this.setSpecifiedTargetEntity_(entity); - } - } - - protected void setSpecifiedTargetEntity_(String entity) { - String old = this.specifiedTargetEntity; - this.specifiedTargetEntity = entity; - this.firePropertyChanged(SPECIFIED_TARGET_ENTITY_PROPERTY, old, entity); - } - - protected String buildSpecifiedTargetEntity() { - A annotation = this.getMappingAnnotation(); - return (annotation == null) ? null : annotation.getTargetEntity(); - } - - public String getDefaultTargetEntity() { - return this.defaultTargetEntity; - } - - protected void setDefaultTargetEntity(String entity) { - String old = this.defaultTargetEntity; - this.defaultTargetEntity = entity; - this.firePropertyChanged(DEFAULT_TARGET_ENTITY_PROPERTY, old, entity); - } - - protected abstract String buildDefaultTargetEntity(); - - public String getFullyQualifiedTargetEntity() { - return this.fullyQualifiedTargetEntity; - } - - protected void setFullyQualifiedTargetEntity(String entity) { - String old = this.fullyQualifiedTargetEntity; - this.fullyQualifiedTargetEntity = entity; - this.firePropertyChanged(FULLY_QUALIFIED_TARGET_ENTITY_PROPERTY, old, entity); - } - - protected String buildFullyQualifiedTargetEntity() { - return (this.specifiedTargetEntity == null) ? - this.defaultTargetEntity : - this.getMappingAnnotation().getFullyQualifiedTargetEntityClassName(); - } - - public Entity getResolvedTargetEntity() { - return (this.fullyQualifiedTargetEntity == null) ? null : this.getPersistenceUnit().getEntity(this.fullyQualifiedTargetEntity); - } - - // sub-classes like this to be public - public PersistentType getResolvedTargetType() { - return (this.fullyQualifiedTargetEntity == null) ? null : this.getPersistenceUnit().getPersistentType(this.fullyQualifiedTargetEntity); - } - - public char getTargetEntityEnclosingTypeSeparator() { - return '.'; - } - - - // ********** relationship reference ********** - - public JavaMappingRelationship getRelationship() { - return this.relationship; - } - - protected abstract JavaMappingRelationship buildRelationship(); - - - // ********** cascade ********** - - public JavaCascade getCascade() { - return this.cascade; - } - - protected JavaCascade buildCascade() { - // NB: we don't use the platform - return new GenericJavaCascade(this); - } - - - // ********** fetch ********** - - public FetchType getFetch() { - return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch; - } - - public FetchType getSpecifiedFetch() { - return this.specifiedFetch; - } - - public void setSpecifiedFetch(FetchType fetch) { - if (this.valuesAreDifferent(fetch, this.specifiedFetch)) { - this.getAnnotationForUpdate().setFetch(FetchType.toJavaResourceModel(fetch)); - this.setSpecifiedFetch_(fetch); - } - } - - protected void setSpecifiedFetch_(FetchType fetch) { - FetchType old = this.specifiedFetch; - this.specifiedFetch = fetch; - this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch); - } - - protected FetchType buildSpecifiedFetch() { - A annotation = this.getMappingAnnotation(); - return (annotation == null) ? null : FetchType.fromJavaResourceModel(annotation.getFetch()); - } - - public FetchType getDefaultFetch() { - return this.defaultFetch; - } - - protected void setDefaultFetch(FetchType fetch) { - FetchType old = this.defaultFetch; - this.defaultFetch = fetch; - this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch); - } - - protected abstract FetchType buildDefaultFetch(); - - - // ********** misc ********** - - @Override - public boolean isRelationshipOwner() { - return this.relationship.isOwner(); - } - - @Override - public boolean isOwnedBy(AttributeMapping mapping) { - return mapping.isRelationshipOwner() && - this.relationship.isOwnedBy((RelationshipMapping) mapping); - } - - public RelationshipMapping getRelationshipOwner() { - Entity entity = this.getResolvedTargetEntity(); - if (entity == null) { - return null; - } - for (ReadOnlyPersistentAttribute attribute : CollectionTools.iterable(entity.getPersistentType().allAttributes())) { - AttributeMapping mapping = attribute.getMapping(); - if (this.isOwnedBy(mapping)) { - return (RelationshipMapping) mapping; - } - } - return null; - } - - @Override - public boolean isOverridableAssociationMapping() { - return this.relationship.isOverridable(); - } - - public Iterator allTargetEntityAttributeNames() { - return new CompositeIterator(this.allTargetEntityAttributeNamesLists()); - } - - protected Iterator> allTargetEntityAttributeNamesLists() { - return new TransformationIterator>(this.allTargetEntityAttributeMappings(), AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER); - } - - protected Iterator allTargetEntityAttributeMappings() { - Entity entity = this.getResolvedTargetEntity(); - return (entity != null) ? entity.allAttributeMappings() : EmptyIterator. instance(); - } - - protected String getTargetEntityIdAttributeName() { - PersistentAttribute attribute = this.getTargetEntityIdAttribute(); - return (attribute == null) ? null : attribute.getName(); - } - - protected PersistentAttribute getTargetEntityIdAttribute() { - Entity entity = this.getResolvedTargetEntity(); - return (entity == null) ? null : entity.getIdAttribute(); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - result = this.relationship.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - return null; - } - - - // ********** metamodel ********** - - @Override - public String getMetamodelTypeName() { - return (this.fullyQualifiedTargetEntity != null) ? this.fullyQualifiedTargetEntity : MetamodelField.DEFAULT_TYPE_NAME; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.validateTargetEntity(messages, astRoot); - this.relationship.validate(messages, reporter, astRoot); - } - - protected void validateTargetEntity(List messages, CompilationUnit astRoot) { - if (this.getTargetEntity() == null) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TARGET_ENTITY_NOT_DEFINED, - new String[] {this.getName()}, - this, - this.getValidationTextRange(astRoot) - ) - ); - } - else if (this.getResolvedTargetEntity() == null) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TARGET_ENTITY_IS_NOT_AN_ENTITY, - new String[] {this.getTargetEntity(), this.getName()}, - this, - this.getTargetEntityTextRange(astRoot) - ) - ); - } - } - - protected TextRange getTargetEntityTextRange(CompilationUnit astRoot) { - A annotation = this.getMappingAnnotation(); - return (annotation == null) ? null : this.getTextRange(annotation.getTargetEntityTextRange(astRoot), astRoot); - } - - protected TextRange getTextRange(TextRange textRange, CompilationUnit astRoot) { - return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java deleted file mode 100644 index c81dbb41b1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSequenceGenerator.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator; -import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation; -import org.eclipse.jpt.jpa.db.Schema; - -/** - * Java sequence generator - */ -public abstract class AbstractJavaSequenceGenerator - extends AbstractJavaGenerator - implements JavaSequenceGenerator -{ - protected String specifiedSequenceName; - protected String defaultSequenceName; - - - protected AbstractJavaSequenceGenerator(JavaJpaContextNode parent, A generatorAnnotation) { - super(parent, generatorAnnotation); - this.specifiedSequenceName = generatorAnnotation.getSequenceName(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedSequenceName_(this.generatorAnnotation.getSequenceName()); - } - - @Override - public void update() { - super.update(); - this.setDefaultSequenceName(this.buildDefaultSequenceName()); - } - - - // ********** initial value ********** - - @Override - protected int buildDefaultInitialValue() { - return DEFAULT_INITIAL_VALUE; - } - - - // ********** sequence name ********** - - public String getSequenceName() { - return (this.specifiedSequenceName != null) ? this.specifiedSequenceName : this.defaultSequenceName; - } - - public String getSpecifiedSequenceName() { - return this.specifiedSequenceName; - } - - public void setSpecifiedSequenceName(String name) { - this.generatorAnnotation.setSequenceName(name); - this.setSpecifiedSequenceName_(name); - } - - protected void setSpecifiedSequenceName_(String name) { - String old = this.specifiedSequenceName; - this.specifiedSequenceName = name; - this.firePropertyChanged(SPECIFIED_SEQUENCE_NAME_PROPERTY, old, name); - } - - public String getDefaultSequenceName() { - return this.defaultSequenceName; - } - - protected void setDefaultSequenceName(String name) { - String old = this.defaultSequenceName; - this.defaultSequenceName = name; - this.firePropertyChanged(DEFAULT_SEQUENCE_NAME_PROPERTY, old, name); - } - - protected String buildDefaultSequenceName() { - return null; // TODO the default sequence name is determined by the runtime provider... - } - - - // ********** Java completion proposals ********** - - /** - * called if the database is connected: - * sequenceName - */ - @Override - public Iterator connectedJavaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.connectedJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.sequenceNameTouches(pos, astRoot)) { - return this.getJavaCandidateSequences(filter).iterator(); - } - return null; - } - - protected boolean sequenceNameTouches(int pos, CompilationUnit astRoot) { - return this.generatorAnnotation.sequenceNameTouches(pos, astRoot); - } - - protected Iterable getJavaCandidateSequences(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.getCandidateSequences(filter)); - } - - protected Iterable getCandidateSequences(Filter filter) { - return new FilteringIterable(this.getCandidateSequences(), filter); - } - - protected Iterable getCandidateSequences() { - Schema dbSchema = this.getDbSchema(); - return (dbSchema != null) ? dbSchema.getSortedSequenceIdentifiers() : EmptyIterable. instance(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java deleted file mode 100644 index 38ee6dc2c2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaSingleRelationshipMapping.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.jpa.core.context.FetchType; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0; -import org.eclipse.jpt.jpa.core.resource.java.SingleRelationshipMappingAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java single relationship mapping (1:1, m:1) - */ -public abstract class AbstractJavaSingleRelationshipMapping - extends AbstractJavaRelationshipMapping - implements JavaSingleRelationshipMapping2_0 -{ - protected Boolean specifiedOptional; - protected boolean defaultOptional; - - protected final JavaDerivedIdentity2_0 derivedIdentity; - - - protected AbstractJavaSingleRelationshipMapping(JavaPersistentAttribute parent) { - super(parent); - this.specifiedOptional = this.buildSpecifiedOptional(); - this.derivedIdentity = this.buildDerivedIdentity(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedOptional_(this.buildSpecifiedOptional()); - this.derivedIdentity.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.setDefaultOptional(this.buildDefaultOptional()); - this.derivedIdentity.update(); - } - - - // ********** optional ********** - - public boolean isOptional() { - return (this.specifiedOptional != null) ? this.specifiedOptional.booleanValue() : this.defaultOptional; - } - - public Boolean getSpecifiedOptional() { - return this.specifiedOptional; - } - - public void setSpecifiedOptional(Boolean optional) { - if (this.valuesAreDifferent(optional, this.specifiedOptional)) { - this.getAnnotationForUpdate().setOptional(optional); - this.setSpecifiedOptional_(optional); - } - } - - protected void setSpecifiedOptional_(Boolean optional) { - Boolean old = this.specifiedOptional; - this.specifiedOptional = optional; - this.firePropertyChanged(SPECIFIED_OPTIONAL_PROPERTY, old, optional); - } - - protected Boolean buildSpecifiedOptional() { - A annotation = this.getMappingAnnotation(); - return (annotation == null) ? null : annotation.getOptional(); - } - - public boolean isDefaultOptional() { - return this.defaultOptional; - } - - protected void setDefaultOptional(boolean optional) { - boolean old = this.defaultOptional; - this.defaultOptional = optional; - this.firePropertyChanged(DEFAULT_OPTIONAL_PROPERTY, old, optional); - } - - protected boolean buildDefaultOptional() { - return DEFAULT_OPTIONAL; - } - - - // ********** derived identity ********** - - public JavaDerivedIdentity2_0 getDerivedIdentity() { - return this.derivedIdentity; - } - - protected JavaDerivedIdentity2_0 buildDerivedIdentity() { - return this.isJpa2_0Compatible() ? - this.getJpaFactory2_0().buildJavaDerivedIdentity(this) : - new NullJavaDerivedIdentity2_0(this); - } - - - // ********** misc ********** - - @Override - protected FetchType buildDefaultFetch() { - return DEFAULT_FETCH_TYPE; - } - - @Override - protected String buildDefaultTargetEntity() { - return this.getPersistentAttribute().getSingleReferenceTargetTypeName(); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - result = this.derivedIdentity.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - return null; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.derivedIdentity.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java deleted file mode 100644 index 302f4af238..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTable.java +++ /dev/null @@ -1,584 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.NameTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.jpa.core.context.ReadOnlyTable; -import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint; -import org.eclipse.jpt.jpa.core.context.UniqueConstraint; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaTable; -import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.Database; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java table, secondary table, join table, or collection table - *

- * NB: any subclass that directly holds its table - * annotation must:

    - *
  • call the "super" constructor that takes a table annotation - * {@link #AbstractJavaTable(JavaJpaContextNode, org.eclipse.jpt.jpa.core.context.Table.Owner, BaseTableAnnotation)} - *
  • override {@link #setTableAnnotation(BaseTableAnnotation)} to set the table - * annotation so it is in place before the table's state - * (e.g. {@link #specifiedName}) is initialized - *
- */ -public abstract class AbstractJavaTable
- extends AbstractJavaJpaContextNode - implements JavaTable, UniqueConstraint.Owner -{ - protected final Owner owner; - - protected String specifiedName; - protected String defaultName; - - protected String specifiedSchema; - protected String defaultSchema; - - protected String specifiedCatalog; - protected String defaultCatalog; - - protected final Vector uniqueConstraints = new Vector(); - protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter(); - - - protected AbstractJavaTable(JavaJpaContextNode parent, Owner owner) { - this(parent, owner, null); - } - - protected AbstractJavaTable(JavaJpaContextNode parent, Owner owner, A tableAnnotation) { - super(parent); - this.owner = owner; - this.setTableAnnotation(tableAnnotation); - this.specifiedName = this.buildSpecifiedName(); - this.specifiedSchema = this.buildSpecifiedSchema(); - this.specifiedCatalog = this.buildSpecifiedCatalog(); - this.initializeUniqueConstraints(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedName_(this.buildSpecifiedName()); - this.setSpecifiedSchema_(this.buildSpecifiedSchema()); - this.setSpecifiedCatalog_(this.buildSpecifiedCatalog()); - this.syncUniqueConstraints(); - } - - @Override - public void update() { - super.update(); - this.setDefaultName(this.buildDefaultName()); - this.setDefaultSchema(this.buildDefaultSchema()); - this.setDefaultCatalog(this.buildDefaultCatalog()); - this.updateNodes(this.getUniqueConstraints()); - } - - - // ********** table annotation ********** - - /** - * Return the Java table annotation. Do not return null if the - * Java annotation does not exist; return a null table annotation - * instead. - */ - public abstract A getTableAnnotation(); - - /** - * see class comment... ({@link AbstractJavaTable}) - */ - protected void setTableAnnotation(A tableAnnotation) { - if (tableAnnotation != null) { - throw new IllegalArgumentException("this method must be overridden if the table annotation is not null: " + tableAnnotation); //$NON-NLS-1$ - } - } - - protected void removeTableAnnotationIfUnset() { - if (this.getTableAnnotation().isUnset()) { - this.removeTableAnnotation(); - } - } - - protected abstract void removeTableAnnotation(); - - public boolean isSpecifiedInResource() { - return this.getTableAnnotation().isSpecified(); - } - - - // ********** name ********** - - public String getName() { - return (this.specifiedName != null) ? this.specifiedName : this.defaultName; - } - - public String getSpecifiedName() { - return this.specifiedName; - } - - public void setSpecifiedName(String name) { - if (this.valuesAreDifferent(this.specifiedName, name)) { - this.getTableAnnotation().setName(name); - this.removeTableAnnotationIfUnset(); - this.setSpecifiedName_(name); - } - } - - protected void setSpecifiedName_(String name) { - String old = this.specifiedName; - this.specifiedName = name; - this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedName() { - return this.getTableAnnotation().getName(); - } - - public String getDefaultName() { - return this.defaultName; - } - - protected void setDefaultName(String name) { - String old = this.defaultName; - this.defaultName = name; - this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name); - } - - protected abstract String buildDefaultName(); - - - // ********** schema ********** - - public String getSchema() { - return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema; - } - - public String getSpecifiedSchema() { - return this.specifiedSchema; - } - - public void setSpecifiedSchema(String schema) { - if (this.valuesAreDifferent(this.specifiedSchema, schema)) { - this.getTableAnnotation().setSchema(schema); - this.removeTableAnnotationIfUnset(); - this.setSpecifiedSchema_(schema); - } - } - - protected void setSpecifiedSchema_(String schema) { - String old = this.specifiedSchema; - this.specifiedSchema = schema; - this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema); - } - - protected String buildSpecifiedSchema() { - return this.getTableAnnotation().getSchema(); - } - - public String getDefaultSchema() { - return this.defaultSchema; - } - - protected void setDefaultSchema(String schema) { - String old = this.defaultSchema; - this.defaultSchema = schema; - this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema); - } - - protected abstract String buildDefaultSchema(); - - - // ********** catalog ********** - - public String getCatalog() { - return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog; - } - - public String getSpecifiedCatalog() { - return this.specifiedCatalog; - } - - public void setSpecifiedCatalog(String catalog) { - if (this.valuesAreDifferent(this.specifiedCatalog, catalog)) { - this.getTableAnnotation().setCatalog(catalog); - this.removeTableAnnotationIfUnset(); - this.setSpecifiedCatalog_(catalog); - } - } - - protected void setSpecifiedCatalog_(String catalog) { - String old = this.specifiedCatalog; - this.specifiedCatalog = catalog; - this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog); - } - - protected String buildSpecifiedCatalog() { - return this.getTableAnnotation().getCatalog(); - } - - public String getDefaultCatalog() { - return this.defaultCatalog; - } - - protected void setDefaultCatalog(String catalog) { - String old = this.defaultCatalog; - this.defaultCatalog = catalog; - this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog); - } - - protected abstract String buildDefaultCatalog(); - - - // ********** unique constraints ********** - - public ListIterator uniqueConstraints() { - return this.getUniqueConstraints().iterator(); - } - - protected ListIterable getUniqueConstraints() { - return new LiveCloneListIterable(this.uniqueConstraints); - } - - public int uniqueConstraintsSize() { - return this.uniqueConstraints.size(); - } - - public JavaUniqueConstraint getUniqueConstraint(int index) { - return this.uniqueConstraints.get(index); - } - - public JavaUniqueConstraint addUniqueConstraint() { - return this.addUniqueConstraint(this.uniqueConstraints.size()); - } - - public JavaUniqueConstraint addUniqueConstraint(int index) { - UniqueConstraintAnnotation annotation = this.getTableAnnotation().addUniqueConstraint(index); - return this.addUniqueConstraint_(index, annotation); - } - - public void removeUniqueConstraint(UniqueConstraint constraint) { - this.removeUniqueConstraint(this.uniqueConstraints.indexOf(constraint)); - } - - public void removeUniqueConstraint(int index) { - this.getTableAnnotation().removeUniqueConstraint(index); - this.removeTableAnnotationIfUnset(); - this.removeUniqueConstraint_(index); - } - - protected void removeUniqueConstraint_(int index) { - this.removeItemFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - } - - public void moveUniqueConstraint(int targetIndex, int sourceIndex) { - this.getTableAnnotation().moveUniqueConstraint(targetIndex, sourceIndex); - this.moveItemInList(targetIndex, sourceIndex, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - } - - protected void initializeUniqueConstraints() { - for (Iterator stream = this.getTableAnnotation().uniqueConstraints(); stream.hasNext(); ) { - this.uniqueConstraints.add(this.buildUniqueConstraint(stream.next())); - } - } - - protected JavaUniqueConstraint buildUniqueConstraint(UniqueConstraintAnnotation constraintAnnotation) { - return this.getJpaFactory().buildJavaUniqueConstraint(this, this, constraintAnnotation); - } - - protected void syncUniqueConstraints() { - ContextContainerTools.synchronizeWithResourceModel(this.uniqueConstraintContainerAdapter); - } - - protected Iterable getUniqueConstraintAnnotations() { - return CollectionTools.iterable(this.getTableAnnotation().uniqueConstraints()); - } - - protected void moveUniqueConstraint_(int index, JavaUniqueConstraint constraint) { - this.moveItemInList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - } - - protected JavaUniqueConstraint addUniqueConstraint_(int index, UniqueConstraintAnnotation constraintAnnotation) { - JavaUniqueConstraint constraint = this.buildUniqueConstraint(constraintAnnotation); - this.addItemToList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - return constraint; - } - - protected void removeUniqueConstraint_(JavaUniqueConstraint constraint) { - this.removeUniqueConstraint_(this.uniqueConstraints.indexOf(constraint)); - } - - /** - * unique constraint container adapter - */ - protected class UniqueConstraintContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractJavaTable.this.getUniqueConstraints(); - } - public Iterable getResourceElements() { - return AbstractJavaTable.this.getUniqueConstraintAnnotations(); - } - public UniqueConstraintAnnotation getResourceElement(JavaUniqueConstraint contextElement) { - return contextElement.getUniqueConstraintAnnotation(); - } - public void moveContextElement(int index, JavaUniqueConstraint element) { - AbstractJavaTable.this.moveUniqueConstraint_(index, element); - } - public void addContextElement(int index, UniqueConstraintAnnotation resourceElement) { - AbstractJavaTable.this.addUniqueConstraint_(index, resourceElement); - } - public void removeContextElement(JavaUniqueConstraint element) { - AbstractJavaTable.this.removeUniqueConstraint_(element); - } - } - - - // ********** database stuff ********** - - public org.eclipse.jpt.jpa.db.Table getDbTable() { - Schema dbSchema = this.getDbSchema(); - return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getName()); - } - - public Schema getDbSchema() { - SchemaContainer dbSchemaContainer = this.getDbSchemaContainer(); - return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema()); - } - - /** - * If we don't have a catalog (i.e. we don't even have a default catalog), - * then the database probably does not support catalogs; and we need to - * get the schema directly from the database. - */ - public SchemaContainer getDbSchemaContainer() { - String catalog = this.getCatalog(); - return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase(); - } - - /** - * If we don't have a catalog (i.e. we don't even have a default - * catalog), then the database probably does not support catalogs. - */ - public Catalog getDbCatalog() { - String catalog = this.getCatalog(); - return (catalog == null) ? null : this.resolveDbCatalog(catalog); - } - - public boolean isResolved() { - return this.getDbTable() != null; - } - - public boolean schemaIsResolved() { - return this.getDbSchema() != null; - } - - /** - * If we don't have a catalog (i.e. we don't even have a default - * catalog), then the database probably does not support catalogs. - */ - public boolean catalogIsResolved() { - String catalog = this.getCatalog(); - return (catalog == null) || (this.resolveDbCatalog(catalog) != null); - } - - - // ********** UniqueConstraint.Owner implementation ********** - - public Iterator candidateUniqueConstraintColumnNames() { - org.eclipse.jpt.jpa.db.Table dbTable = this.getDbTable(); - return (dbTable != null) ? dbTable.getSortedColumnIdentifiers().iterator() : EmptyIterator.instance(); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - for (JavaUniqueConstraint constraint : CollectionTools.iterable(this.uniqueConstraints())) { - result = constraint.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - return null; - } - - /** - * called if the database is connected: - * name, schema, catalog - */ - @Override - public Iterator connectedJavaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.connectedJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.nameTouches(pos, astRoot)) { - return this.getJavaCandidateNames(filter).iterator(); - } - if (this.schemaTouches(pos, astRoot)) { - return this.getJavaCandidateSchemata(filter).iterator(); - } - if (this.catalogTouches(pos, astRoot)) { - return this.getJavaCandidateCatalogs(filter).iterator(); - } - return null; - } - - protected boolean nameTouches(int pos, CompilationUnit astRoot) { - return this.getTableAnnotation().nameTouches(pos, astRoot); - } - - protected Iterable getJavaCandidateNames(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.getCandidateNames(filter)); - } - - protected Iterable getCandidateNames(Filter filter) { - return new FilteringIterable(this.getCandidateNames(), filter); - } - - protected Iterable getCandidateNames() { - Schema dbSchema = this.getDbSchema(); - return (dbSchema != null) ? dbSchema.getSortedTableIdentifiers() : EmptyIterable. instance(); - } - - protected boolean schemaTouches(int pos, CompilationUnit astRoot) { - return this.getTableAnnotation().schemaTouches(pos, astRoot); - } - - protected Iterable getJavaCandidateSchemata(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.getCandidateSchemata(filter)); - } - - protected Iterable getCandidateSchemata(Filter filter) { - return new FilteringIterable(this.getCandidateSchemata(), filter); - } - - protected Iterable getCandidateSchemata() { - return this.getDbSchemaContainer().getSortedSchemaIdentifiers(); - } - - protected boolean catalogTouches(int pos, CompilationUnit astRoot) { - return this.getTableAnnotation().catalogTouches(pos, astRoot); - } - - protected Iterable getJavaCandidateCatalogs(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.getCandidateCatalogs(filter)); - } - - protected Iterable getCandidateCatalogs(Filter filter) { - return new FilteringIterable(this.getCandidateCatalogs(), filter); - } - - protected Iterable getCandidateCatalogs() { - Database db = this.getDatabase(); - return (db != null) ? db.getSortedCatalogIdentifiers() : EmptyIterable. instance(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.buildTableValidator(astRoot).validate(messages, reporter); - } - - protected JptValidator buildTableValidator(CompilationUnit astRoot) { - return this.owner.buildTableValidator(this, buildTextRangeResolver(astRoot)); - } - - protected TableTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) { - return new JavaTableTextRangeResolver(this, astRoot); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getTextRange(this.getTableAnnotation().getTextRange(astRoot), astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.getTextRange(this.getTableAnnotation().getNameTextRange(astRoot), astRoot); - } - - public TextRange getSchemaTextRange(CompilationUnit astRoot) { - return this.getTextRange(this.getTableAnnotation().getSchemaTextRange(astRoot), astRoot); - } - - public TextRange getCatalogTextRange(CompilationUnit astRoot) { - return this.getTextRange(this.getTableAnnotation().getCatalogTextRange(astRoot), astRoot); - } - - protected TextRange getTextRange(TextRange textRange, CompilationUnit astRoot) { - return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot); - } - - - // ********** misc ********** - - @Override - public JavaJpaContextNode getParent() { - return (JavaJpaContextNode) super.getParent(); - } - - protected void initializeFrom(ReadOnlyTable oldTable) { - this.setSpecifiedName(oldTable.getSpecifiedName()); - this.setSpecifiedCatalog(oldTable.getSpecifiedCatalog()); - this.setSpecifiedSchema(oldTable.getSpecifiedSchema()); - for (ReadOnlyUniqueConstraint constraint : CollectionTools.iterable(oldTable.uniqueConstraints())) { - this.addUniqueConstraint().initializeFrom(constraint); - } - } - - protected void initializeFromVirtual(ReadOnlyTable virtualTable) { - this.setSpecifiedName(virtualTable.getName()); - // ignore other settings? - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.buildQualifiedName()); - } - - protected String buildQualifiedName() { - return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java deleted file mode 100644 index 7aeada737c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaTypeMapping.java +++ /dev/null @@ -1,293 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.NotNullFilter; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.ReadOnlyTable; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericTypeMappingValidator; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java type mapping - */ -public abstract class AbstractJavaTypeMapping - extends AbstractJavaJpaContextNode - implements JavaTypeMapping -{ - // this can be null for a "null" type mapping - protected final A mappingAnnotation; - - - protected AbstractJavaTypeMapping(JavaPersistentType parent, A mappingAnnotation) { - super(parent); - this.mappingAnnotation = mappingAnnotation; - } - - - // ********** misc ********** - - @Override - public JavaPersistentType getParent() { - return (JavaPersistentType) super.getParent(); - } - - public JavaPersistentType getPersistentType() { - return this.getParent(); - } - - public JavaResourcePersistentType getResourcePersistentType() { - return this.getPersistentType().getResourcePersistentType(); - } - - public String getName() { - return this.getPersistentType().getName(); - } - - public A getMappingAnnotation() { - return this.mappingAnnotation; - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getPersistentType().getName()); - } - - - // ********** tables ********** - - public String getPrimaryTableName() { - return null; - } - - public org.eclipse.jpt.jpa.db.Table getPrimaryDbTable() { - return null; - } - - public Schema getDbSchema() { - return null; - } - - public Iterator associatedTables() { - return EmptyIterator.instance(); - } - - public Iterator allAssociatedTables() { - return EmptyIterator.instance(); - } - - public Iterator allAssociatedTableNames() { - return EmptyIterator.instance(); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return null; - } - - - // ********** inheritance ********** - - public TypeMapping getSuperTypeMapping() { - PersistentType superPersistentType = this.getPersistentType().getSuperPersistentType(); - return (superPersistentType == null) ? null : superPersistentType.getMapping(); - } - - public Iterator inheritanceHierarchy() { - return this.convertToMappings(this.getPersistentType().inheritanceHierarchy()); - } - - protected Iterable getInheritanceHierarchy() { - return CollectionTools.iterable(this.inheritanceHierarchy()); - } - - /** - * Return the type mapping's "persistence" ancestors, - * excluding the type mapping itself. - * The returned iterator will return elements infinitely if the hierarchy - * has a loop. - */ - protected Iterator ancestors() { - return this.convertToMappings(this.getPersistentType().ancestors()); - } - - protected Iterable getAncestors() { - return CollectionTools.iterable(this.ancestors()); - } - - protected Iterator convertToMappings(Iterator types) { - return new TransformationIterator(types) { - @Override - protected TypeMapping transform(PersistentType type) { - return type.getMapping(); - } - }; - } - - - // ********** attribute mappings ********** - - public Iterator attributeMappings() { - return new TransformationIterator(this.getPersistentType().attributes()) { - @Override - protected JavaAttributeMapping transform(JavaPersistentAttribute attribute) { - return attribute.getMapping(); - } - }; - } - - public Iterable getAttributeMappings(final String mappingKey) { - return new FilteringIterable(CollectionTools.collection(this.attributeMappings())) { - @Override - protected boolean accept(JavaAttributeMapping o) { - return Tools.valuesAreEqual(o.getKey(), mappingKey); - } - }; - } - - public Iterator allAttributeMappings() { - return new CompositeIterator(this.allAttributeMappingsLists()); - } - - protected Iterator> allAttributeMappingsLists() { - return new TransformationIterator>(this.nonNullInheritanceHierarchy(), TypeMappingTools.ATTRIBUTE_MAPPINGS_TRANSFORMER); - } - - protected Iterator nonNullInheritanceHierarchy() { - return new FilteringIterator(this.inheritanceHierarchy(), NotNullFilter.instance()); - } - - public Iterable getAllAttributeMappings(final String mappingKey) { - return new FilteringIterable(CollectionTools.collection(this.allAttributeMappings())) { - @Override - protected boolean accept(AttributeMapping o) { - return Tools.valuesAreEqual(o.getKey(), mappingKey); - } - }; - } - - public boolean attributeMappingKeyAllowed(String attributeMappingKey) { - return true; - } - - - // ********** attribute overrides ********** - - public Iterator overridableAttributeNames() { - return new CompositeIterator(this.overridableAttributeNamesLists()); - } - - protected Iterator> overridableAttributeNamesLists() { - return new TransformationIterator>(this.attributeMappings(), AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER); - } - - public Iterator allOverridableAttributeNames() { - return new CompositeIterator(this.allOverridableAttributeNamesLists()); - } - - protected Iterator> allOverridableAttributeNamesLists() { - return new TransformationIterator>(this.inheritanceHierarchy(), TypeMappingTools.OVERRIDABLE_ATTRIBUTE_NAMES_TRANSFORMER); - } - - public Column resolveOverriddenColumn(String attributeName) { - for (AttributeMapping attributeMapping : CollectionTools.iterable(this.attributeMappings())) { - Column column = attributeMapping.resolveOverriddenColumn(attributeName); - if (column != null) { - return column; - } - } - return null; - } - - - // ********** association overrides ********** - - public Iterator overridableAssociationNames() { - return new CompositeIterator(this.overridableAssociationNamesLists()); - } - - protected Iterator> overridableAssociationNamesLists() { - return new TransformationIterator>(this.attributeMappings(), AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER); - } - - public Iterator allOverridableAssociationNames() { - return new CompositeIterator(this.allOverridableAssociationNamesLists()); - } - - protected Iterator> allOverridableAssociationNamesLists() { - return new TransformationIterator>(this.inheritanceHierarchy(), TypeMappingTools.OVERRIDABLE_ASSOCIATION_NAMES_TRANSFORMER); - } - - public Relationship resolveOverriddenRelationship(String attributeName) { - for (AttributeMapping attributeMapping : CollectionTools.iterable(this.attributeMappings())) { - Relationship relationship = attributeMapping.resolveOverriddenRelationship(attributeName); - if (relationship != null) { - return relationship; - } - } - return null; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.validateType(messages, reporter, astRoot); - } - - protected void validateType(List messages, IReporter reporter, CompilationUnit astRoot) { - this.buildTypeMappingValidator(astRoot).validate(messages, reporter); - } - - protected JptValidator buildTypeMappingValidator(CompilationUnit astRoot) { - return new GenericTypeMappingValidator(this, this.getResourcePersistentType(), buildTextRangeResolver(astRoot)); - } - - protected TypeMappingTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) { - return new JavaTypeMappingTextRangeResolver(this, astRoot); - } - - public boolean validatesAgainstDatabase() { - return this.getPersistenceUnit().validatesAgainstDatabase(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.mappingAnnotation.getTextRange(astRoot); - return (textRange != null) ? textRange : this.getPersistentType().getValidationTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java deleted file mode 100644 index b88646d9e0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMapping.java +++ /dev/null @@ -1,276 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.Association; -import org.eclipse.jpt.common.utility.internal.SimpleAssociation; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaVersionMapping; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaConverter; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java version mapping - */ -public abstract class AbstractJavaVersionMapping - extends AbstractJavaAttributeMapping - implements JavaVersionMapping -{ - protected final JavaColumn column; - - protected JavaConverter converter; // never null - - - // the spec does not list Temporal explicitly, - // but it is included in the orm.xml schema... - protected static final JavaConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] { - JavaTemporalConverter.Adapter.instance(), - }; - protected static final Iterable CONVERTER_ADAPTERS = new ArrayIterable(CONVERTER_ADAPTER_ARRAY); - - - protected AbstractJavaVersionMapping(JavaPersistentAttribute parent) { - super(parent); - this.column = this.buildColumn(); - this.converter = this.buildConverter(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.column.synchronizeWithResourceModel(); - this.syncConverter(); - } - - @Override - public void update() { - super.update(); - this.column.update(); - this.converter.update(); - } - - - // ********** column ********** - - public JavaColumn getColumn() { - return this.column; - } - - protected JavaColumn buildColumn() { - return this.getJpaFactory().buildJavaColumn(this, this); - } - - - // ********** converter ********** - - public JavaConverter getConverter() { - return this.converter; - } - - public void setConverter(Class converterType) { - if (this.converter.getType() != converterType) { - this.converter.dispose(); - JavaConverter.Adapter converterAdapter = this.getConverterAdapter(converterType); - this.retainConverterAnnotation(converterAdapter); - this.setConverter_(this.buildConverter(converterAdapter)); - } - } - - protected JavaConverter buildConverter(JavaConverter.Adapter converterAdapter) { - return (converterAdapter != null) ? - converterAdapter.buildNewConverter(this, this.getJpaFactory()) : - this.buildNullConverter(); - } - - protected void setConverter_(JavaConverter converter) { - Converter old = this.converter; - this.converter = converter; - this.firePropertyChanged(CONVERTER_PROPERTY, old, converter); - } - - /** - * Clear all the converter annotations except for the annotation - * corresponding to the specified adapter. If the specified adapter is - * null, remove all the converter annotations. - */ - protected void retainConverterAnnotation(JavaConverter.Adapter converterAdapter) { - JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute(); - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter != converterAdapter) { - adapter.removeConverterAnnotation(resourceAttribute); - } - } - } - - protected JavaConverter buildConverter() { - JpaFactory jpaFactory = this.getJpaFactory(); - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - JavaConverter javaConverter = adapter.buildConverter(this, jpaFactory); - if (javaConverter != null) { - return javaConverter; - } - } - return this.buildNullConverter(); - } - - protected void syncConverter() { - Association assoc = this.getConverterAnnotation(); - if (assoc == null) { - if (this.converter.getType() != null) { - this.setConverter_(this.buildNullConverter()); - } - } else { - JavaConverter.Adapter adapter = assoc.getKey(); - Annotation annotation = assoc.getValue(); - if ((this.converter.getType() == adapter.getConverterType()) && - (this.converter.getConverterAnnotation() == annotation)) { - this.converter.synchronizeWithResourceModel(); - } else { - this.setConverter_(adapter.buildConverter(annotation, this, this.getJpaFactory())); - } - } - } - - /** - * Return the first converter annotation we find along with its corresponding - * adapter. Return null if there are no converter annotations. - */ - protected Association getConverterAnnotation() { - JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute(); - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - Annotation annotation = adapter.getConverterAnnotation(resourceAttribute); - if (annotation != null) { - return new SimpleAssociation(adapter, annotation); - } - } - return null; - } - - protected JavaConverter buildNullConverter() { - return new NullJavaConverter(this); - } - - - // ********** converter adapters ********** - - /** - * Return the converter adapter for the specified converter type. - */ - protected JavaConverter.Adapter getConverterAdapter(Class converterType) { - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.getConverterType() == converterType) { - return adapter; - } - } - return null; - } - - protected Iterable getConverterAdapters() { - return CONVERTER_ADAPTERS; - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return VersionAnnotation.ANNOTATION_NAME; - } - - - // ********** JavaColumn.Owner implementation ********** - - public ColumnAnnotation getColumnAnnotation() { - return (ColumnAnnotation) this.getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME); - } - - public void removeColumnAnnotation() { - this.getResourcePersistentAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME); - } - - public String getDefaultColumnName() { - return this.getName(); - } - - public String getDefaultTableName() { - return this.getTypeMapping().getPrimaryTableName(); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getTypeMapping().tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return this.getTypeMapping().allAssociatedTableNames(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new NamedColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.column.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.converter.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - return null; - } - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.column.validate(messages, reporter, astRoot); - this.converter.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMappingDefinition.java deleted file mode 100644 index 5c62ad3ecc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVersionMappingDefinition.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.VersionAnnotation; - -public abstract class AbstractJavaVersionMappingDefinition - implements JavaAttributeMappingDefinition -{ - protected AbstractJavaVersionMappingDefinition() { - super(); - } - - public String getKey() { - return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return VersionAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable getSupportingAnnotationNames() { - return SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - ColumnAnnotation.ANNOTATION_NAME, - TemporalAnnotation.ANNOTATION_NAME, - }; - protected static final Iterable SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(SUPPORTING_ANNOTATION_NAMES_ARRAY); - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return factory.buildJavaVersionMapping(persistentAttribute); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualBaseColumn.java deleted file mode 100644 index a28099d901..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualBaseColumn.java +++ /dev/null @@ -1,238 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn; -import org.eclipse.jpt.jpa.core.context.VirtualBaseColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; - -public abstract class AbstractJavaVirtualBaseColumn - extends AbstractJavaVirtualNamedColumn - implements VirtualBaseColumn -{ - protected String specifiedTable; - protected String defaultTable; - - protected Boolean specifiedUnique; - protected boolean defaultUnique; - - protected Boolean specifiedNullable; - protected boolean defaultNullable; - - protected Boolean specifiedInsertable; - protected boolean defaultInsertable; - - protected Boolean specifiedUpdatable; - protected boolean defaultUpdatable; - - - protected AbstractJavaVirtualBaseColumn(JavaJpaContextNode parent, O owner) { - super(parent, owner); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - - this.setSpecifiedTable(this.buildSpecifiedTable()); - this.setDefaultTable(this.buildDefaultTable()); - - this.setSpecifiedUnique(this.buildSpecifiedUnique()); - this.setDefaultUnique(this.buildDefaultUnique()); - - this.setSpecifiedNullable(this.buildSpecifiedNullable()); - this.setDefaultNullable(this.buildDefaultNullable()); - - this.setSpecifiedInsertable(this.buildSpecifiedInsertable()); - this.setDefaultInsertable(this.buildDefaultInsertable()); - - this.setSpecifiedUpdatable(this.buildSpecifiedUpdatable()); - this.setDefaultUpdatable(this.buildDefaultUpdatable()); - } - - - // ********** table ********** - - public String getTable() { - return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable; - } - - public String getSpecifiedTable() { - return this.specifiedTable; - } - - protected void setSpecifiedTable(String table) { - String old = this.specifiedTable; - this.specifiedTable = table; - this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table); - } - - protected String buildSpecifiedTable() { - return this.getOverriddenColumn().getSpecifiedTable(); - } - - public String getDefaultTable() { - return this.defaultTable; - } - - protected void setDefaultTable(String table) { - String old = this.defaultTable; - this.defaultTable = table; - this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table); - } - - protected String buildDefaultTable() { - return this.owner.getDefaultTableName(); - } - - - // ********** unique ********** - - public boolean isUnique() { - return (this.specifiedUnique != null) ? this.specifiedUnique.booleanValue() : this.isDefaultUnique(); - } - - public Boolean getSpecifiedUnique() { - return this.specifiedUnique; - } - - protected void setSpecifiedUnique(Boolean unique) { - Boolean old = this.specifiedUnique; - this.specifiedUnique = unique; - this.firePropertyChanged(SPECIFIED_UNIQUE_PROPERTY, old, unique); - } - - protected Boolean buildSpecifiedUnique() { - return this.getOverriddenColumn().getSpecifiedUnique(); - } - - public boolean isDefaultUnique() { - return this.defaultUnique; - } - - protected void setDefaultUnique(boolean unique) { - boolean old = this.defaultUnique; - this.defaultUnique = unique; - this.firePropertyChanged(DEFAULT_UNIQUE_PROPERTY, old, unique); - } - - protected boolean buildDefaultUnique() { - return DEFAULT_UNIQUE; - } - - - // ********** nullable ********** - - public boolean isNullable() { - return (this.specifiedNullable != null) ? this.specifiedNullable.booleanValue() : this.isDefaultNullable(); - } - - public Boolean getSpecifiedNullable() { - return this.specifiedNullable; - } - - protected void setSpecifiedNullable(Boolean nullable) { - Boolean old = this.specifiedNullable; - this.specifiedNullable = nullable; - this.firePropertyChanged(SPECIFIED_NULLABLE_PROPERTY, old, nullable); - } - - protected Boolean buildSpecifiedNullable() { - return this.getOverriddenColumn().getSpecifiedNullable(); - } - - public boolean isDefaultNullable() { - return this.defaultNullable; - } - - protected void setDefaultNullable(boolean nullable) { - boolean old = this.defaultNullable; - this.defaultNullable = nullable; - this.firePropertyChanged(DEFAULT_NULLABLE_PROPERTY, old, nullable); - } - - protected boolean buildDefaultNullable() { - return DEFAULT_NULLABLE; - } - - - // ********** insertable ********** - - public boolean isInsertable() { - return (this.specifiedInsertable != null) ? this.specifiedInsertable.booleanValue() : this.isDefaultInsertable(); - } - - public Boolean getSpecifiedInsertable() { - return this.specifiedInsertable; - } - - protected void setSpecifiedInsertable(Boolean insertable) { - Boolean old = this.specifiedInsertable; - this.specifiedInsertable = insertable; - this.firePropertyChanged(SPECIFIED_INSERTABLE_PROPERTY, old, insertable); - } - - protected Boolean buildSpecifiedInsertable() { - return this.getOverriddenColumn().getSpecifiedInsertable(); - } - - public boolean isDefaultInsertable() { - return this.defaultInsertable; - } - - protected void setDefaultInsertable(boolean insertable) { - boolean old = this.defaultInsertable; - this.defaultInsertable = insertable; - this.firePropertyChanged(DEFAULT_INSERTABLE_PROPERTY, old, insertable); - } - - protected boolean buildDefaultInsertable() { - return DEFAULT_INSERTABLE; - } - - - // ********** updatable ********** - - public boolean isUpdatable() { - return (this.specifiedUpdatable != null) ? this.specifiedUpdatable.booleanValue() : this.isDefaultUpdatable(); - } - - public Boolean getSpecifiedUpdatable() { - return this.specifiedUpdatable; - } - - protected void setSpecifiedUpdatable(Boolean updatable) { - Boolean old = this.specifiedUpdatable; - this.specifiedUpdatable = updatable; - this.firePropertyChanged(SPECIFIED_UPDATABLE_PROPERTY, old, updatable); - } - - protected Boolean buildSpecifiedUpdatable() { - return this.getOverriddenColumn().getSpecifiedUpdatable(); - } - - public boolean isDefaultUpdatable() { - return this.defaultUpdatable; - } - - protected void setDefaultUpdatable(boolean updatable) { - boolean old = this.defaultUpdatable; - this.defaultUpdatable = updatable; - this.firePropertyChanged(DEFAULT_UPDATABLE_PROPERTY, old, updatable); - } - - protected boolean buildDefaultUpdatable() { - return DEFAULT_UPDATABLE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java deleted file mode 100644 index 517dbeab97..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualNamedColumn.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn; -import org.eclipse.jpt.jpa.core.context.VirtualNamedColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; - -/** - * Java virtual
    - *
  • column - *
  • join column - *
- * NB: all state is sync'ed/updated in {@link #update()} - * because all of its derived from the context model (i.e. none of it - * is derived from the resource model). - */ -public abstract class AbstractJavaVirtualNamedColumn - extends AbstractJavaJpaContextNode - implements VirtualNamedColumn -{ - protected final O owner; - - protected String specifiedName; - protected String defaultName; - - protected String columnDefinition; - - - protected AbstractJavaVirtualNamedColumn(JavaJpaContextNode parent, O owner) { - super(parent); - this.owner = owner; - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - - this.setSpecifiedName(this.buildSpecifiedName()); - this.setDefaultName(this.buildDefaultName()); - - this.setColumnDefinition(this.buildColumnDefinition()); - } - - - // ********** column ********** - - /** - * This should never return null. - */ - public abstract C getOverriddenColumn(); - - - // ********** name ********** - - public String getName() { - return (this.specifiedName != null) ? this.specifiedName : this.defaultName; - } - - public String getSpecifiedName() { - return this.specifiedName; - } - - protected void setSpecifiedName(String name) { - String old = this.specifiedName; - this.specifiedName = name; - this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedName() { - return this.getOverriddenColumn().getSpecifiedName(); - } - - public String getDefaultName() { - return this.defaultName; - } - - protected void setDefaultName(String name) { - String old = this.defaultName; - this.defaultName = name; - this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name); - } - - protected String buildDefaultName() { - return this.owner.getDefaultColumnName(); - } - - - // ********** column definition ********** - - public String getColumnDefinition() { - return this.columnDefinition; - } - - protected void setColumnDefinition(String columnDefinition) { - String old = this.columnDefinition; - this.columnDefinition = columnDefinition; - this.firePropertyChanged(COLUMN_DEFINITION_PROPERTY, old, columnDefinition); - } - - protected String buildColumnDefinition() { - return this.getOverriddenColumn().getColumnDefinition(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return null; // not sure this column is validated... - } - - - // ********** misc ********** - - public boolean isVirtual() { - return true; - } - - @Override - public void toString(StringBuilder sb) { - String table = this.getTable(); - if (table != null) { - sb.append(table); - sb.append('.'); - } - sb.append(this.getName()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualOverride.java deleted file mode 100644 index 6f589efad7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualOverride.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverride; - -/** - * Virtual Java override - */ -public abstract class AbstractJavaVirtualOverride - extends AbstractJavaJpaContextNode - implements JavaVirtualOverride -{ - protected final String name; // never null - - - protected AbstractJavaVirtualOverride(C parent, String name) { - super(parent); - this.name = name; - } - - public String getName() { - return this.name; - } - - public boolean isVirtual() { - return true; - } - - public JavaOverride convertToSpecified() { - return this.getContainer().convertOverrideToSpecified(this); - } - - @Override - @SuppressWarnings("unchecked") - public C getParent() { - return (C) super.getParent(); - } - - public C getContainer() { - return this.getParent(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getParent().getValidationTextRange(astRoot); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java deleted file mode 100644 index ec4d5b507f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualReferenceTable.java +++ /dev/null @@ -1,200 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReferenceTable; -import org.eclipse.jpt.jpa.core.context.VirtualReferenceTable; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; - -public abstract class AbstractJavaVirtualReferenceTable - extends AbstractJavaVirtualTable - implements VirtualReferenceTable -{ - protected final Vector specifiedJoinColumns = new Vector(); - protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter = new SpecifiedJoinColumnContainerAdapter(); - protected final ReadOnlyJoinColumn.Owner joinColumnOwner; - - protected JavaVirtualJoinColumn defaultJoinColumn; - - - protected AbstractJavaVirtualReferenceTable(JavaJpaContextNode parent) { - super(parent); - this.joinColumnOwner = this.buildJoinColumnOwner(); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.updateSpecifiedJoinColumns(); - this.updateDefaultJoinColumn(); - } - - - // ********** join columns ********** - - public ListIterator joinColumns() { - return this.getJoinColumns().iterator(); - } - - protected ListIterable getJoinColumns() { - return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns(); - } - - public int joinColumnsSize() { - return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize(); - } - - - // ********** specified join columns ********** - - public ListIterator specifiedJoinColumns() { - return this.getSpecifiedJoinColumns().iterator(); - } - - protected ListIterable getSpecifiedJoinColumns() { - return new LiveCloneListIterable(this.specifiedJoinColumns); - } - - public int specifiedJoinColumnsSize() { - return this.specifiedJoinColumns.size(); - } - - public boolean hasSpecifiedJoinColumns() { - return this.specifiedJoinColumns.size() != 0; - } - - public JavaVirtualJoinColumn getSpecifiedJoinColumn(int index) { - return this.specifiedJoinColumns.get(index); - } - - protected void updateSpecifiedJoinColumns() { - ContextContainerTools.update(this.specifiedJoinColumnContainerAdapter); - } - - protected Iterable getOverriddenJoinColumns() { - return CollectionTools.iterable(this.getOverriddenTable().specifiedJoinColumns()); - } - - protected void moveSpecifiedJoinColumn(int index, JavaVirtualJoinColumn joinColumn) { - this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - protected JavaVirtualJoinColumn addSpecifiedJoinColumn(int index, JoinColumn joinColumn) { - JavaVirtualJoinColumn virtualJoinColumn = this.buildJoinColumn(joinColumn); - this.addItemToList(index, virtualJoinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - return virtualJoinColumn; - } - - protected void removeSpecifiedJoinColumn(JavaVirtualJoinColumn joinColumn) { - this.removeItemFromList(joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - /** - * specified join column container adapter - */ - protected class SpecifiedJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractJavaVirtualReferenceTable.this.getSpecifiedJoinColumns(); - } - public Iterable getResourceElements() { - return AbstractJavaVirtualReferenceTable.this.getOverriddenJoinColumns(); - } - public JoinColumn getResourceElement(JavaVirtualJoinColumn contextElement) { - return contextElement.getOverriddenColumn(); - } - public void moveContextElement(int index, JavaVirtualJoinColumn element) { - AbstractJavaVirtualReferenceTable.this.moveSpecifiedJoinColumn(index, element); - } - public void addContextElement(int index, JoinColumn element) { - AbstractJavaVirtualReferenceTable.this.addSpecifiedJoinColumn(index, element); - } - public void removeContextElement(JavaVirtualJoinColumn element) { - AbstractJavaVirtualReferenceTable.this.removeSpecifiedJoinColumn(element); - } - } - - - // ********** default join column ********** - - public JavaVirtualJoinColumn getDefaultJoinColumn() { - return this.defaultJoinColumn; - } - - protected void setDefaultJoinColumn(JavaVirtualJoinColumn joinColumn) { - JavaVirtualJoinColumn old = this.defaultJoinColumn; - this.defaultJoinColumn = joinColumn; - this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn); - } - - protected ListIterable getDefaultJoinColumns() { - return (this.defaultJoinColumn != null) ? - new SingleElementListIterable(this.defaultJoinColumn) : - EmptyListIterable.instance(); - } - - protected int getDefaultJoinColumnsSize() { - return (this.defaultJoinColumn == null) ? 0 : 1; - } - - protected void updateDefaultJoinColumn() { - if (this.buildsDefaultJoinColumn()) { - if (this.defaultJoinColumn == null) { - this.setDefaultJoinColumn(this.buildJoinColumn(this.getOverriddenTable().getDefaultJoinColumn())); - } else { - this.defaultJoinColumn.update(); - } - } else { - this.setDefaultJoinColumn(null); - } - } - - protected boolean buildsDefaultJoinColumn() { - return ! this.hasSpecifiedJoinColumns(); - } - - - // ********** misc ********** - - protected JavaVirtualJoinColumn buildJoinColumn(JoinColumn joinColumn) { - return this.buildJoinColumn(this.joinColumnOwner, joinColumn); - } - - protected JavaVirtualJoinColumn buildJoinColumn(ReadOnlyJoinColumn.Owner owner, JoinColumn joinColumn) { - return this.getJpaFactory().buildJavaVirtualJoinColumn(this, owner, joinColumn); - } - - protected abstract ReadOnlyJoinColumn.Owner buildJoinColumnOwner(); - - @Override - protected String buildDefaultSchema() { - return this.getContextDefaultSchema(); - } - - @Override - protected String buildDefaultCatalog() { - return this.getContextDefaultCatalog(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java deleted file mode 100644 index 466112abe3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/AbstractJavaVirtualTable.java +++ /dev/null @@ -1,315 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.NameTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.UniqueConstraint; -import org.eclipse.jpt.jpa.core.context.VirtualTable; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualUniqueConstraint; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; - -public abstract class AbstractJavaVirtualTable - extends AbstractJavaJpaContextNode - implements VirtualTable -{ - protected String specifiedName; - protected String defaultName; - - protected String specifiedSchema; - protected String defaultSchema; - - protected String specifiedCatalog; - protected String defaultCatalog; - - protected final Vector uniqueConstraints = new Vector(); - protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter(); - - - protected AbstractJavaVirtualTable(JavaJpaContextNode parent) { - super(parent); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - - this.setSpecifiedName(this.buildSpecifiedName()); - this.setDefaultName(this.buildDefaultName()); - - this.setSpecifiedSchema(this.buildSpecifiedSchema()); - this.setDefaultSchema(this.buildDefaultSchema()); - - this.setSpecifiedCatalog(this.buildSpecifiedCatalog()); - this.setDefaultCatalog(this.buildDefaultCatalog()); - - this.updateUniqueConstraints(); - } - - - // ********** table ********** - - /** - * This should never return null. - */ - public abstract T getOverriddenTable(); - - - // ********** name ********** - - public String getName() { - return (this.specifiedName != null) ? this.specifiedName : this.defaultName; - } - - public String getSpecifiedName() { - return this.specifiedName; - } - - protected void setSpecifiedName(String name) { - String old = this.specifiedName; - this.specifiedName = name; - this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedName() { - return this.getOverriddenTable().getSpecifiedName(); - } - - public String getDefaultName() { - return this.defaultName; - } - - protected void setDefaultName(String name) { - String old = this.defaultName; - this.defaultName = name; - this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name); - } - - protected abstract String buildDefaultName(); - - - // ********** schema ********** - - public String getSchema() { - return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema; - } - - public String getSpecifiedSchema() { - return this.specifiedSchema; - } - - protected void setSpecifiedSchema(String schema) { - String old = this.specifiedSchema; - this.specifiedSchema = schema; - this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema); - } - - protected String buildSpecifiedSchema() { - return this.getOverriddenTable().getSchema(); - } - - public String getDefaultSchema() { - return this.defaultSchema; - } - - protected void setDefaultSchema(String schema) { - String old = this.defaultSchema; - this.defaultSchema = schema; - this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema); - } - - protected abstract String buildDefaultSchema(); - - - // ********** catalog ********** - - public String getCatalog() { - return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog; - } - - public String getSpecifiedCatalog() { - return this.specifiedCatalog; - } - - protected void setSpecifiedCatalog(String catalog) { - String old = this.specifiedCatalog; - this.specifiedCatalog = catalog; - this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog); - } - - protected String buildSpecifiedCatalog() { - return this.getOverriddenTable().getCatalog(); - } - - public String getDefaultCatalog() { - return this.defaultCatalog; - } - - protected void setDefaultCatalog(String catalog) { - String old = this.defaultCatalog; - this.defaultCatalog = catalog; - this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog); - } - - protected abstract String buildDefaultCatalog(); - - - // ********** unique constraints ********** - - public ListIterator uniqueConstraints() { - return this.getUniqueConstraints().iterator(); - } - - protected ListIterable getUniqueConstraints() { - return new LiveCloneListIterable(this.uniqueConstraints); - } - - public int uniqueConstraintsSize() { - return this.uniqueConstraints.size(); - } - - public JavaVirtualUniqueConstraint getUniqueConstraint(int index) { - return this.uniqueConstraints.get(index); - } - - protected void updateUniqueConstraints() { - ContextContainerTools.update(this.uniqueConstraintContainerAdapter); - } - - protected Iterable getOverriddenUniqueConstraints() { - return CollectionTools.iterable(this.getOverriddenTable().uniqueConstraints()); - } - - protected void moveUniqueConstraint(int index, JavaVirtualUniqueConstraint constraint) { - this.moveItemInList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - } - - protected JavaVirtualUniqueConstraint addUniqueConstraint(int index, UniqueConstraint uniqueConstraint) { - JavaVirtualUniqueConstraint virtualConstraint = this.buildUniqueConstraint(uniqueConstraint); - this.addItemToList(index, virtualConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - return virtualConstraint; - } - - protected JavaVirtualUniqueConstraint buildUniqueConstraint(UniqueConstraint uniqueConstraint) { - return this.getJpaFactory().buildJavaVirtualUniqueConstraint(this, uniqueConstraint); - } - - protected void removeUniqueConstraint(JavaVirtualUniqueConstraint constraint) { - this.removeItemFromList(constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - } - - /** - * unique constraint container adapter - */ - protected class UniqueConstraintContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractJavaVirtualTable.this.getUniqueConstraints(); - } - public Iterable getResourceElements() { - return AbstractJavaVirtualTable.this.getOverriddenUniqueConstraints(); - } - public UniqueConstraint getResourceElement(JavaVirtualUniqueConstraint contextElement) { - return contextElement.getOverriddenUniqueConstraint(); - } - public void moveContextElement(int index, JavaVirtualUniqueConstraint element) { - AbstractJavaVirtualTable.this.moveUniqueConstraint(index, element); - } - public void addContextElement(int index, UniqueConstraint resourceElement) { - AbstractJavaVirtualTable.this.addUniqueConstraint(index, resourceElement); - } - public void removeContextElement(JavaVirtualUniqueConstraint element) { - AbstractJavaVirtualTable.this.removeUniqueConstraint(element); - } - } - - - // ********** database stuff ********** - - public org.eclipse.jpt.jpa.db.Table getDbTable() { - Schema dbSchema = this.getDbSchema(); - return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getName()); - } - - public Schema getDbSchema() { - SchemaContainer dbSchemaContainer = this.getDbSchemaContainer(); - return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema()); - } - - /** - * If we don't have a catalog (i.e. we don't even have a default catalog), - * then the database probably does not support catalogs; and we need to - * get the schema directly from the database. - */ - public SchemaContainer getDbSchemaContainer() { - String catalog = this.getCatalog(); - return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase(); - } - - /** - * If we don't have a catalog (i.e. we don't even have a default - * catalog), then the database probably does not support catalogs. - */ - public Catalog getDbCatalog() { - String catalog = this.getCatalog(); - return (catalog == null) ? null : this.resolveDbCatalog(catalog); - } - - protected boolean isResolved() { - return this.getDbTable() != null; - } - - protected boolean hasResolvedSchema() { - return this.getDbSchema() != null; - } - - /** - * If we don't have a catalog (i.e. we don't even have a default - * catalog), then the database probably does not support catalogs. - */ - protected boolean hasResolvedCatalog() { - String catalog = this.getCatalog(); - return (catalog == null) || (this.resolveDbCatalog(catalog) != null); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return null; - } - - - // ********** misc ********** - - @Override - public void toString(StringBuilder sb) { - sb.append(this.buildQualifiedName()); - } - - protected String buildQualifiedName() { - return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java deleted file mode 100644 index b4a89125dc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaIdClassReference.java +++ /dev/null @@ -1,239 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * Java ID class reference - */ -public class GenericJavaIdClassReference - extends AbstractJavaJpaContextNode - implements JavaIdClassReference -{ - protected String idClassName; - protected String fullyQualifiedIdClassName; - // the ref holds the type directly because the ref is the type's parent - protected JavaPersistentType idClass; - - - public GenericJavaIdClassReference(JavaTypeMapping parent) { - super(parent); - this.idClassName = this.buildIdClassName(); - // 'idClass' is resolved in the update - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setIdClassName_(this.buildIdClassName()); - if (this.idClass != null) { - this.idClass.synchronizeWithResourceModel(); - } - } - - @Override - public void update() { - super.update(); - this.setFullyQualifiedIdClassName(this.buildFullyQualifiedIdClassName()); - this.updateIdClass(); - } - - - // ********** id class name ********** - - public String getIdClassName() { - return this.getSpecifiedIdClassName(); - } - - public String getSpecifiedIdClassName() { - return this.idClassName; - } - - public void setSpecifiedIdClassName(String name) { - if (this.valuesAreDifferent(name, this.idClassName)) { - this.getIdClassAnnotationForUpdate().setValue(name); - this.removeIdClassAnnotationIfUnset(); - this.setIdClassName_(name); - } - } - - protected void setIdClassName_(String name) { - String old = this.idClassName; - this.idClassName = name; - this.firePropertyChanged(SPECIFIED_ID_CLASS_NAME_PROPERTY, old, name); - } - - protected String buildIdClassName() { - IdClassAnnotation annotation = this.getIdClassAnnotation(); - return (annotation == null) ? null : annotation.getValue(); - } - - public String getDefaultIdClassName() { - return null; - } - - public boolean isSpecified() { - return this.idClassName != null; - } - - - // ********** id class annotation ********** - - /** - * Return null if the annotation does not exists. - */ - protected IdClassAnnotation getIdClassAnnotation() { - return (IdClassAnnotation) this.getResourcePersistentType().getAnnotation(this.getIdClassAnnotationName()); - } - - /** - * Build the annotation if it does not exist. - */ - protected IdClassAnnotation getIdClassAnnotationForUpdate() { - IdClassAnnotation annotation = this.getIdClassAnnotation(); - return (annotation != null) ? annotation : this.buildIdClassAnnotation(); - } - - protected IdClassAnnotation buildIdClassAnnotation() { - return (IdClassAnnotation) this.getResourcePersistentType().addAnnotation(this.getIdClassAnnotationName()); - } - - protected void removeIdClassAnnotationIfUnset() { - if (this.getIdClassAnnotation().isUnset()) { - this.removeIdClassAnnotation(); - } - } - - protected void removeIdClassAnnotation() { - this.getResourcePersistentType().removeAnnotation(this.getIdClassAnnotationName()); - } - - protected String getIdClassAnnotationName() { - return IdClassAnnotation.ANNOTATION_NAME; - } - - - // ********** fully-qualified id class name ********** - - public String getFullyQualifiedIdClassName() { - return this.fullyQualifiedIdClassName; - } - - protected void setFullyQualifiedIdClassName(String name) { - String old = this.fullyQualifiedIdClassName; - this.fullyQualifiedIdClassName = name; - this.firePropertyChanged(FULLY_QUALIFIED_ID_CLASS_PROPERTY, old, name); - } - - protected String buildFullyQualifiedIdClassName() { - IdClassAnnotation annotation = this.getIdClassAnnotation(); - return (annotation == null) ? null : annotation.getFullyQualifiedClassName(); - } - - - // ********** id class ********** - - public JavaPersistentType getIdClass() { - return this.idClass; - } - - protected void setIdClass(JavaPersistentType idClass) { - JavaPersistentType old = this.idClass; - this.idClass = idClass; - this.firePropertyChanged(ID_CLASS_PROPERTY, old, idClass); - } - - protected void updateIdClass() { - JavaResourcePersistentType resourceIdClass = this.resolveResourceIdClass(); - if (resourceIdClass == null) { - if (this.idClass != null) { - this.idClass.dispose(); - this.setIdClass(null); - } - } else { - if (this.idClass == null) { - this.setIdClass(this.buildIdClass(resourceIdClass)); - } else { - if (this.idClass.getResourcePersistentType() == resourceIdClass) { - this.idClass.update(); - } else { - this.idClass.dispose(); - this.setIdClass(this.buildIdClass(resourceIdClass)); - } - } - } - } - - protected JavaResourcePersistentType resolveResourceIdClass() { - return (this.fullyQualifiedIdClassName == null) ? - null : this.getJpaProject().getJavaResourcePersistentType(this.fullyQualifiedIdClassName); - } - - protected JavaPersistentType buildIdClass(JavaResourcePersistentType resourceClass) { - return this.getJpaFactory().buildJavaPersistentType(this, resourceClass); - } - - public char getIdClassEnclosingTypeSeparator() { - return '.'; - } - - - // ********** misc ********** - - @Override - public JavaTypeMapping getParent() { - return (JavaTypeMapping) super.getParent(); - } - - protected JavaTypeMapping getTypeMapping() { - return this.getParent(); - } - - protected JavaPersistentType getPersistentType() { - return this.getTypeMapping().getPersistentType(); - } - - protected JavaResourcePersistentType getResourcePersistentType() { - return this.getPersistentType().getResourcePersistentType(); - } - - - // ********** PersistentType.Owner implementation ********** - - public AccessType getOverridePersistentTypeAccess() { - return this.getPersistentType().getAccess(); - } - - public AccessType getDefaultPersistentTypeAccess() { - // this shouldn't be needed, since we've specified an override access, but just to be safe ... - return this.getPersistentType().getAccess(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - IdClassAnnotation annotation = this.getIdClassAnnotation(); - return (annotation == null) ? - this.getTypeMapping().getValidationTextRange(astRoot) : - annotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java deleted file mode 100644 index acbd82eeb9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToManyRelationship.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.MappedByRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaManyToManyRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaMappedByRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaMappingJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.resource.java.OwnableRelationshipMappingAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaManyToManyRelationship - extends AbstractJavaMappingRelationship - implements JavaManyToManyRelationship -{ - protected final JavaMappedByRelationshipStrategy mappedByStrategy; - - protected final JavaJoinTableRelationshipStrategy joinTableStrategy; - - - public GenericJavaManyToManyRelationship(JavaManyToManyMapping parent) { - super(parent); - this.mappedByStrategy = this.buildMappedByStrategy(); - this.joinTableStrategy = this.buildJoinTableStrategy(); - - this.strategy = this.buildStrategy(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mappedByStrategy.synchronizeWithResourceModel(); - this.joinTableStrategy.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mappedByStrategy.update(); - this.joinTableStrategy.update(); - } - - - // ********** strategy ********** - - @Override - protected JavaRelationshipStrategy buildStrategy() { - if (this.mappedByStrategy.getMappedByAttribute() != null) { - return this.mappedByStrategy; - } - return this.joinTableStrategy; - } - - - // ********** mapped by strategy ********** - - public JavaMappedByRelationshipStrategy getMappedByStrategy() { - return this.mappedByStrategy; - } - - public boolean strategyIsMappedBy() { - return this.strategy == this.mappedByStrategy; - } - - public void setStrategyToMappedBy() { - this.mappedByStrategy.addStrategy(); - this.joinTableStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayBeMappedBy(AttributeMapping mapping) { - return mapping.getKey() == MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY; - } - - protected JavaMappedByRelationshipStrategy buildMappedByStrategy() { - return new GenericJavaMappedByRelationshipStrategy(this); - } - - - // ********** join table strategy ********** - - public JavaJoinTableRelationshipStrategy getJoinTableStrategy() { - return this.joinTableStrategy; - } - - public boolean strategyIsJoinTable() { - return this.strategy == this.joinTableStrategy; - } - - public void setStrategyToJoinTable() { - // join table is default option, so no need to add to resource - this.mappedByStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayHaveDefaultJoinTable() { - return this.getMappedByStrategy().getMappedByAttribute() == null; - } - - protected JavaJoinTableRelationshipStrategy buildJoinTableStrategy() { - return new GenericJavaMappingJoinTableRelationshipStrategy(this); - } - - - // ********** conversions ********** - - public void initializeOn(Relationship newRelationship) { - newRelationship.initializeFromMappedByRelationship(this); - newRelationship.initializeFromJoinTableRelationship(this); - } - - @Override - public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) { - super.initializeFromMappedByRelationship(oldRelationship); - this.mappedByStrategy.initializeFrom(oldRelationship.getMappedByStrategy()); - } - - @Override - public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) { - super.initializeFromJoinTableRelationship(oldRelationship); - this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy()); - } - - - // ********** misc ********** - - @Override - public JavaManyToManyMapping getMapping() { - return this.getParent(); - } - - public OwnableRelationshipMappingAnnotation getMappingAnnotation() { - return this.getMapping().getMappingAnnotation(); - } - - public OwnableRelationshipMappingAnnotation getMappingAnnotationForUpdate() { - return this.getMapping().getAnnotationForUpdate(); - } - - public boolean isOwner() { - return this.mappedByStrategy.getMappedByAttribute() == null; - } - - public boolean isOwnedBy(RelationshipMapping mapping) { - return this.mappedByStrategy.relationshipIsOwnedBy(mapping); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - result = this.mappedByStrategy.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - return this.joinTableStrategy.javaCompletionProposals(pos, filter, astRoot); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.mappedByStrategy.validate(messages, reporter, astRoot); - this.joinTableStrategy.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java deleted file mode 100644 index c0ad6c945b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaManyToOneRelationship.java +++ /dev/null @@ -1,194 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaManyToOneMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaMappingJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaManyToOneRelationship2_0; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaManyToOneRelationship - extends AbstractJavaMappingRelationship - implements JavaManyToOneRelationship2_0 -{ - protected final JavaJoinColumnRelationshipStrategy joinColumnStrategy; - - // JPA 2.0 - protected final JavaJoinTableRelationshipStrategy joinTableStrategy; - - - public GenericJavaManyToOneRelationship(JavaManyToOneMapping parent) { - super(parent); - this.joinColumnStrategy = this.buildJoinColumnStrategy(); - this.joinTableStrategy = this.buildJoinTableStrategy(); - - this.strategy = this.buildStrategy(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.joinColumnStrategy.synchronizeWithResourceModel(); - this.joinTableStrategy.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.joinColumnStrategy.update(); - this.joinTableStrategy.update(); - } - - - // ********** strategy ********** - - @Override - protected JavaRelationshipStrategy buildStrategy() { - if (this.isJpa2_0Compatible()) { - if (this.joinTableStrategy.getJoinTable() != null) { - return this.joinTableStrategy; - } - } - return this.joinColumnStrategy; - } - - - // ********** join table strategy ********** - - public JavaJoinTableRelationshipStrategy getJoinTableStrategy() { - return this.joinTableStrategy; - } - - public boolean strategyIsJoinTable() { - return this.strategy == this.joinTableStrategy; - } - - public final void setStrategyToJoinTable() { - this.joinTableStrategy.addStrategy(); - this.joinColumnStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayHaveDefaultJoinTable() { - return false; - } - - protected JavaJoinTableRelationshipStrategy buildJoinTableStrategy() { - return this.isJpa2_0Compatible() ? - new GenericJavaMappingJoinTableRelationshipStrategy(this) : - new NullJavaJoinTableRelationshipStrategy(this); - } - - - // ********** join column strategy ********** - - public JavaJoinColumnRelationshipStrategy getJoinColumnStrategy() { - return this.joinColumnStrategy; - } - - public boolean strategyIsJoinColumn() { - return this.strategy == this.joinColumnStrategy; - } - - public void setStrategyToJoinColumn() { - // join column strategy is the default; so no need to add stuff, - // just remove all the others - this.joinTableStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayHaveDefaultJoinColumn() { - return this.joinTableStrategy.getJoinTable() == null; - } - - protected JavaJoinColumnRelationshipStrategy buildJoinColumnStrategy() { - return new GenericJavaMappingJoinColumnRelationshipStrategy(this); - } - - - // ********** conversions ********** - - public void initializeOn(Relationship newRelationship) { - newRelationship.initializeFromJoinColumnRelationship(this); - newRelationship.initializeFromJoinTableRelationship(this); - } - - @Override - public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) { - super.initializeFromJoinTableRelationship(oldRelationship); - this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy()); - } - - @Override - public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) { - super.initializeFromJoinColumnRelationship(oldRelationship); - this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy()); - } - - - // ********** misc ********** - - @Override - public JavaManyToOneMapping getMapping() { - return this.getParent(); - } - - public boolean isOwner() { - return true; - } - - public boolean isOwnedBy(RelationshipMapping mapping) { - return false; - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - result = this.joinColumnStrategy.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - return this.joinTableStrategy.javaCompletionProposals(pos, filter, astRoot); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.joinColumnStrategy.validate(messages, reporter, astRoot); - this.joinTableStrategy.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappedByRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappedByRelationshipStrategy.java deleted file mode 100644 index f682c69d90..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappedByRelationshipStrategy.java +++ /dev/null @@ -1,262 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.MappedByRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaMappedByRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaMappedByRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.java.OwnableRelationshipMappingAnnotation; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaMappedByRelationshipStrategy - extends AbstractJavaJpaContextNode - implements JavaMappedByRelationshipStrategy -{ - protected String mappedByAttribute; - - - public GenericJavaMappedByRelationshipStrategy(JavaMappedByRelationship parent) { - super(parent); - this.mappedByAttribute = this.buildMappedByAttribute(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setMappedByAttribute_(this.buildMappedByAttribute()); - } - - - // ********** mapped by attribute ********** - - public String getMappedByAttribute() { - return this.mappedByAttribute; - } - - public void setMappedByAttribute(String mappedByAttribute) { - if (this.valuesAreDifferent(mappedByAttribute, this.mappedByAttribute)) { - this.getMappingAnnotationForUpdate().setMappedBy(mappedByAttribute); - this.setMappedByAttribute_(mappedByAttribute); - } - } - - protected void setMappedByAttribute_(String mappedByAttribute) { - String old = this.mappedByAttribute; - this.mappedByAttribute = mappedByAttribute; - this.firePropertyChanged(MAPPED_BY_ATTRIBUTE_PROPERTY, old, mappedByAttribute); - } - - protected String buildMappedByAttribute() { - OwnableRelationshipMappingAnnotation annotation = this.getMappingAnnotation(); - return (annotation == null) ? null : annotation.getMappedBy(); - } - - - // ********** misc ********** - - protected OwnableRelationshipMappingAnnotation getMappingAnnotation() { - return this.getRelationship().getMappingAnnotation(); - } - - protected OwnableRelationshipMappingAnnotation getMappingAnnotationForUpdate() { - return this.getRelationship().getMappingAnnotationForUpdate(); - } - - @Override - public JavaMappedByRelationship getParent() { - return (JavaMappedByRelationship) super.getParent(); - } - - public JavaMappedByRelationship getRelationship() { - return this.getParent(); - } - - public void initializeFrom(MappedByRelationshipStrategy oldStrategy) { - this.setMappedByAttribute(oldStrategy.getMappedByAttribute()); - } - - public String getTableName() { - RelationshipMapping owner = this.getRelationshipOwner(); - return (owner == null) ? null : owner.getRelationship().getStrategy().getTableName(); - } - - public Table resolveDbTable(String tableName) { - RelationshipMapping owner = this.getRelationshipOwner(); - return (owner == null) ? null : owner.getRelationship().getStrategy().resolveDbTable(tableName); - } - - public boolean tableNameIsInvalid(String tableName) { - RelationshipMapping owner = this.getRelationshipOwner(); - return (owner != null) && owner.getRelationship().getStrategy().tableNameIsInvalid(tableName); - } - - public String getColumnTableNotValidDescription() { - //this will not be called if getRelationshipOwner() is null - return this.getRelationshipOwner().getRelationship().getStrategy().getColumnTableNotValidDescription(); - } - - protected RelationshipMapping getRelationshipOwner() { - return this.getRelationshipMapping().getRelationshipOwner(); - } - - public boolean isOverridable() { - return false; - } - - protected RelationshipMapping getRelationshipMapping() { - return this.getRelationship().getMapping(); - } - - public boolean relationshipIsOwnedBy(RelationshipMapping otherMapping) { - String thisEntityName = this.getEntityName(); - Entity otherEntity = otherMapping.getResolvedTargetEntity(); - String otherEntityName = (otherEntity == null) ? null : otherEntity.getName(); - return Tools.valuesAreEqual(thisEntityName, otherEntityName) && - Tools.valuesAreEqual(this.mappedByAttribute, otherMapping.getName()); - } - - protected String getEntityName() { - Entity entity = this.getRelationship().getEntity(); - return (entity == null) ? null : entity.getName(); - } - - public void addStrategy() { - if (this.mappedByAttribute == null) { - this.setMappedByAttribute(""); //$NON-NLS-1$ - } - } - - public void removeStrategy() { - if (this.mappedByAttribute != null) { - this.setMappedByAttribute(null); - } - } - - - // ********** java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - OwnableRelationshipMappingAnnotation annotation = this.getMappingAnnotation(); - if ((annotation != null) && annotation.mappedByTouches(pos, astRoot)) { - result = this.javaCandidateMappedByAttributeNames(filter); - } - return result; - } - - public Iterator candidateMappedByAttributeNames() { - return this.getRelationshipMapping().allTargetEntityAttributeNames(); - } - - protected Iterator candidateMappedByAttributeNames(Filter filter) { - return new FilteringIterator(this.candidateMappedByAttributeNames(), filter); - } - - protected Iterator javaCandidateMappedByAttributeNames(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.candidateMappedByAttributeNames(filter)); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - OwnableRelationshipMappingAnnotation annotation = this.getMappingAnnotation(); - return (annotation == null) ? null : annotation.getMappedByTextRange(astRoot); - } - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - - if (this.mappedByAttribute == null) { - return; - } - - Entity targetEntity = this.getRelationshipMapping().getResolvedTargetEntity(); - if (targetEntity == null) { - return; // null target entity is validated elsewhere - } - - AttributeMapping mappedByMapping = targetEntity.resolveAttributeMapping(this.mappedByAttribute); - - if (mappedByMapping == null) { - messages.add( - this.buildMessage( - JpaValidationMessages.MAPPING_UNRESOLVED_MAPPED_BY, - new String[] {this.mappedByAttribute}, - astRoot - ) - ); - return; - } - - if ( ! this.getRelationship().mayBeMappedBy(mappedByMapping)) { - messages.add( - this.buildMessage( - JpaValidationMessages.MAPPING_INVALID_MAPPED_BY, - new String[] {this.mappedByAttribute}, - astRoot - ) - ); - return; - } - - // if mappedByMapping is not a relationship owner, then it should have - // been flagged in above rule (mappedByIsValid) - if ( ! ((RelationshipMapping) mappedByMapping).isRelationshipOwner()) { - messages.add( - this.buildMessage( - JpaValidationMessages.MAPPING_MAPPED_BY_ON_BOTH_SIDES, - new String[] {this.mappedByAttribute}, - astRoot - ) - ); - } - } - - protected IMessage buildMessage(String msgID, String[] parms, CompilationUnit astRoot) { - PersistentAttribute attribute = this.getRelationshipMapping().getPersistentAttribute(); - String attributeDescription = NLS.bind(JpaValidationDescriptionMessages.ATTRIBUTE_DESC, attribute.getName()); - parms = ArrayTools.add(parms, 0, attributeDescription); - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - msgID, - parms, - this, - this.getValidationTextRange(astRoot) - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java deleted file mode 100644 index 79b88ac1c5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaMappingJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,216 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaMappingJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.jpa.db.Table; - -public class GenericJavaMappingJoinColumnRelationshipStrategy - extends AbstractJavaJoinColumnRelationshipStrategy -{ - protected final boolean targetForeignKey; - - - /** - * The default strategy is for a "source" foreign key. - */ - public GenericJavaMappingJoinColumnRelationshipStrategy(JavaMappingJoinColumnRelationship parent) { - this(parent, false); - } - - public GenericJavaMappingJoinColumnRelationshipStrategy(JavaMappingJoinColumnRelationship parent, boolean targetForeignKey) { - super(parent); - this.targetForeignKey = targetForeignKey; - } - - - // ********** join column annotations ********** - - @Override - protected Iterator joinColumnAnnotations() { - return new SubIteratorWrapper(this.joinColumnAnnotations_()); - } - - protected Iterator joinColumnAnnotations_() { - return this.getResourcePersistentAttribute().annotations(JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); - } - - @Override - protected JoinColumnAnnotation addJoinColumnAnnotation(int index) { - return (JoinColumnAnnotation) this.getResourcePersistentAttribute().addAnnotation(index, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); - } - - @Override - protected void removeJoinColumnAnnotation(int index) { - this.getResourcePersistentAttribute().removeAnnotation(index, JoinColumnAnnotation.ANNOTATION_NAME, JoinColumnsAnnotation.ANNOTATION_NAME); - } - - @Override - protected void moveJoinColumnAnnotation(int targetIndex, int sourceIndex) { - this.getResourcePersistentAttribute().moveAnnotation(targetIndex, sourceIndex, JoinColumnsAnnotation.ANNOTATION_NAME); - } - - @Override - protected JoinColumnAnnotation buildNullJoinColumnAnnotation() { - return new NullJoinColumnAnnotation(this.getResourcePersistentAttribute()); - } - - - // ********** misc ********** - - protected JavaResourcePersistentAttribute getResourcePersistentAttribute() { - return this.getRelationship().getMapping().getResourcePersistentAttribute(); - } - - @Override - public JavaMappingJoinColumnRelationship getRelationship() { - return (JavaMappingJoinColumnRelationship) super.getRelationship(); - } - - @Override - protected JavaJoinColumn.Owner buildJoinColumnOwner() { - return new JoinColumnOwner(); - } - - public boolean isOverridable() { - return true; - } - - public TypeMapping getRelationshipSource() { - RelationshipMapping mapping = this.getRelationshipMapping(); - return this.targetForeignKey ? - mapping.getResolvedTargetEntity() : - mapping.getTypeMapping(); - } - - public TypeMapping getRelationshipTarget() { - RelationshipMapping mapping = this.getRelationshipMapping(); - return this.targetForeignKey ? - mapping.getTypeMapping() : - mapping.getResolvedTargetEntity(); - } - - protected Entity getRelationshipTargetEntity() { - TypeMapping target = this.getRelationshipTarget(); - return (target instanceof Entity) ? (Entity) target : null; - } - - public boolean isTargetForeignKey() { - return this.targetForeignKey; - } - - - // ********** validation ********** - - public String getColumnTableNotValidDescription() { - return JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY; - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getRelationship().getValidationTextRange(astRoot); - } - - - // ********** join column owner ********** - - protected class JoinColumnOwner - implements JavaJoinColumn.Owner - { - protected JoinColumnOwner() { - super(); - } - - /** - * by default, the join column is in the type mapping's primary table - */ - public String getDefaultTableName() { - return GenericJavaMappingJoinColumnRelationshipStrategy.this.getTableName(); - } - - public String getDefaultColumnName() { - //built in MappingTools.buildJoinColumnDefaultName() - return null; - } - - public String getAttributeName() { - return GenericJavaMappingJoinColumnRelationshipStrategy.this.getRelationshipMapping().getName(); - } - - public PersistentAttribute getPersistentAttribute() { - return GenericJavaMappingJoinColumnRelationshipStrategy.this.getRelationshipMapping().getPersistentAttribute(); - } - - public TypeMapping getTypeMapping() { - return GenericJavaMappingJoinColumnRelationshipStrategy.this.getRelationshipSource(); - } - - public Entity getRelationshipTarget() { - return GenericJavaMappingJoinColumnRelationshipStrategy.this.getRelationshipTargetEntity(); - } - - public boolean tableNameIsInvalid(String tableName) { - return GenericJavaMappingJoinColumnRelationshipStrategy.this.tableNameIsInvalid(tableName); - } - - /** - * the join column can be on a secondary table - */ - public Iterator candidateTableNames() { - return GenericJavaMappingJoinColumnRelationshipStrategy.this.candidateTableNames(); - } - - public Table resolveDbTable(String tableName) { - return GenericJavaMappingJoinColumnRelationshipStrategy.this.resolveDbTable(tableName); - } - - public Table getReferencedColumnDbTable() { - return GenericJavaMappingJoinColumnRelationshipStrategy.this.getReferencedColumnDbTable(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return GenericJavaMappingJoinColumnRelationshipStrategy.this.defaultJoinColumn == joinColumn; - } - - public int joinColumnsSize() { - return GenericJavaMappingJoinColumnRelationshipStrategy.this.joinColumnsSize(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return GenericJavaMappingJoinColumnRelationshipStrategy.this.getValidationTextRange(astRoot); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new JoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java deleted file mode 100644 index 318babfe30..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToManyRelationship.java +++ /dev/null @@ -1,272 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.MappedByRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaMappedByRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaOneToManyMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaMappingJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOneToManyRelationship2_0; -import org.eclipse.jpt.jpa.core.resource.java.OneToManyAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaOneToManyRelationship - extends AbstractJavaMappingRelationship - implements JavaOneToManyRelationship2_0 -{ - protected final JavaMappedByRelationshipStrategy mappedByStrategy; - - protected final JavaJoinTableRelationshipStrategy joinTableStrategy; - - // JPA 2.0 or EclipseLink - protected final boolean supportsJoinColumnStrategy; - protected final JavaJoinColumnRelationshipStrategy joinColumnStrategy; - - - public GenericJavaOneToManyRelationship(JavaOneToManyMapping parent, boolean supportsJoinColumnStrategy) { - super(parent); - this.mappedByStrategy = this.buildMappedByStrategy(); - this.supportsJoinColumnStrategy = supportsJoinColumnStrategy; - this.joinColumnStrategy = this.buildJoinColumnStrategy(); - - // build join table strategy last since it's dependent on the other strategies - this.joinTableStrategy = this.buildJoinTableStrategy(); - - this.strategy = this.buildStrategy(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mappedByStrategy.synchronizeWithResourceModel(); - this.joinColumnStrategy.synchronizeWithResourceModel(); - this.joinTableStrategy.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mappedByStrategy.update(); - this.joinColumnStrategy.update(); - this.joinTableStrategy.update(); - } - - - // ********** strategy ********** - - @Override - protected JavaRelationshipStrategy buildStrategy() { - if (this.mappedByStrategy.getMappedByAttribute() != null) { - return this.mappedByStrategy; - } - if (this.supportsJoinColumnStrategy) { - if (this.joinColumnStrategy.hasSpecifiedJoinColumns()) { - return this.joinColumnStrategy; - } - } - return this.joinTableStrategy; - } - - - // ********** mapped by strategy ********** - - public JavaMappedByRelationshipStrategy getMappedByStrategy() { - return this.mappedByStrategy; - } - - public boolean strategyIsMappedBy() { - return this.strategy == this.mappedByStrategy; - } - - public final void setStrategyToMappedBy() { - this.mappedByStrategy.addStrategy(); - this.joinTableStrategy.removeStrategy(); - this.joinColumnStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayBeMappedBy(AttributeMapping mapping) { - String key = mapping.getKey(); - if (key == MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) { - return true; - } - if (this.supportsJoinColumnStrategy) { - return key == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - return false; - } - - protected JavaMappedByRelationshipStrategy buildMappedByStrategy() { - return new GenericJavaMappedByRelationshipStrategy(this); - } - - - // ********** join table strategy ********** - - public JavaJoinTableRelationshipStrategy getJoinTableStrategy() { - return this.joinTableStrategy; - } - - public boolean strategyIsJoinTable() { - return this.strategy == this.joinTableStrategy; - } - - public final void setStrategyToJoinTable() { - // join table is default, so no need to add annotation - this.mappedByStrategy.removeStrategy(); - this.joinColumnStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayHaveDefaultJoinTable() { - return (this.mappedByStrategy.getMappedByAttribute() == null) && - ! this.joinColumnStrategy.hasSpecifiedJoinColumns(); - } - - protected JavaJoinTableRelationshipStrategy buildJoinTableStrategy() { - return new GenericJavaMappingJoinTableRelationshipStrategy(this); - } - - - // ********** join column strategy ********** - - public JavaJoinColumnRelationshipStrategy getJoinColumnStrategy() { - return this.joinColumnStrategy; - } - - public boolean strategyIsJoinColumn() { - return this.strategy == this.joinColumnStrategy; - } - - public void setStrategyToJoinColumn() { - this.joinColumnStrategy.addStrategy(); - this.mappedByStrategy.removeStrategy(); - this.joinTableStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayHaveDefaultJoinColumn() { - return false; - } - - protected JavaJoinColumnRelationshipStrategy buildJoinColumnStrategy() { - return this.supportsJoinColumnStrategy ? - new GenericJavaMappingJoinColumnRelationshipStrategy(this, true) : // true = target foreign key - new NullJavaJoinColumnRelationshipStrategy(this); - } - - - // ********** conversions ********** - - public void initializeOn(Relationship newRelationship) { - newRelationship.initializeFromMappedByRelationship(this); - newRelationship.initializeFromJoinTableRelationship(this); - newRelationship.initializeFromJoinColumnRelationship(this); - } - - @Override - public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) { - super.initializeFromMappedByRelationship(oldRelationship); - this.mappedByStrategy.initializeFrom(oldRelationship.getMappedByStrategy()); - } - - @Override - public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) { - super.initializeFromJoinTableRelationship(oldRelationship); - this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy()); - } - - @Override - public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) { - super.initializeFromJoinColumnRelationship(oldRelationship); - this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy()); - } - - - // ********** misc ********** - - @Override - public JavaOneToManyMapping getMapping() { - return this.getParent(); - } - - public OneToManyAnnotation getMappingAnnotation() { - return this.getMapping().getMappingAnnotation(); - } - - public OneToManyAnnotation getMappingAnnotationForUpdate() { - return this.getMapping().getAnnotationForUpdate(); - } - - public boolean isOwner() { - return this.mappedByStrategy.getMappedByAttribute() == null; - } - - public boolean isOwnedBy(RelationshipMapping mapping) { - return this.mappedByStrategy.relationshipIsOwnedBy(mapping); - } - - @Override - public boolean isTargetForeignKey() { - return this.joinColumnStrategy.isTargetForeignKey(); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - result = this.mappedByStrategy.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - result = this.joinTableStrategy.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - return this.joinColumnStrategy.javaCompletionProposals(pos, filter, astRoot); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.mappedByStrategy.validate(messages, reporter, astRoot); - this.joinTableStrategy.validate(messages, reporter, astRoot); - this.joinColumnStrategy.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java deleted file mode 100644 index 8ea6e4ef66..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOneToOneRelationship.java +++ /dev/null @@ -1,300 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.MappedByRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaMappedByRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaOneToOneMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaMappingJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOneToOneRelationship2_0; -import org.eclipse.jpt.jpa.core.resource.java.OwnableRelationshipMappingAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaOneToOneRelationship - extends AbstractJavaMappingRelationship - implements JavaOneToOneRelationship2_0 -{ - protected final JavaMappedByRelationshipStrategy mappedByStrategy; - - protected final JavaPrimaryKeyJoinColumnRelationshipStrategy primaryKeyJoinColumnStrategy; - - // JPA 2.0 - protected final JavaJoinTableRelationshipStrategy joinTableStrategy; - - protected final JavaJoinColumnRelationshipStrategy joinColumnStrategy; - - - public GenericJavaOneToOneRelationship(JavaOneToOneMapping parent) { - super(parent); - this.mappedByStrategy = this.buildMappedByStrategy(); - this.primaryKeyJoinColumnStrategy = this.buildPrimaryKeyJoinColumnStrategy(); - this.joinTableStrategy = this.buildJoinTableStrategy(); - this.joinColumnStrategy = this.buildJoinColumnStrategy(); - - this.strategy = this.buildStrategy(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mappedByStrategy.synchronizeWithResourceModel(); - this.primaryKeyJoinColumnStrategy.synchronizeWithResourceModel(); - this.joinTableStrategy.synchronizeWithResourceModel(); - this.joinColumnStrategy.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mappedByStrategy.update(); - this.primaryKeyJoinColumnStrategy.update(); - this.joinTableStrategy.update(); - this.joinColumnStrategy.update(); - } - - - // ********** strategy ********** - - @Override - protected JavaRelationshipStrategy buildStrategy() { - if (this.mappedByStrategy.getMappedByAttribute() != null) { - return this.mappedByStrategy; - } - if (this.primaryKeyJoinColumnStrategy.hasPrimaryKeyJoinColumns()) { - return this.primaryKeyJoinColumnStrategy; - } - if (this.isJpa2_0Compatible()) { - if (this.joinTableStrategy.getJoinTable() != null) { - return this.joinTableStrategy; - } - } - return this.joinColumnStrategy; - } - - - // ********** mapped by strategy ********** - - public JavaMappedByRelationshipStrategy getMappedByStrategy() { - return this.mappedByStrategy; - } - - public boolean strategyIsMappedBy() { - return this.strategy == this.mappedByStrategy; - } - - public void setStrategyToMappedBy() { - this.mappedByStrategy.addStrategy(); - this.joinColumnStrategy.removeStrategy(); - this.primaryKeyJoinColumnStrategy.removeStrategy(); - this.joinTableStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayBeMappedBy(AttributeMapping mapping) { - return mapping.getKey() == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - protected JavaMappedByRelationshipStrategy buildMappedByStrategy() { - return new GenericJavaMappedByRelationshipStrategy(this); - } - - - // ********** primary key join column strategy ********** - - public JavaPrimaryKeyJoinColumnRelationshipStrategy getPrimaryKeyJoinColumnStrategy() { - return this.primaryKeyJoinColumnStrategy; - } - - public boolean strategyIsPrimaryKeyJoinColumn() { - return this.strategy == this.primaryKeyJoinColumnStrategy; - } - - public void setStrategyToPrimaryKeyJoinColumn() { - this.primaryKeyJoinColumnStrategy.addStrategy(); - this.mappedByStrategy.removeStrategy(); - this.joinColumnStrategy.removeStrategy(); - this.joinTableStrategy.removeStrategy(); - this.updateStrategy(); - } - - protected JavaPrimaryKeyJoinColumnRelationshipStrategy buildPrimaryKeyJoinColumnStrategy() { - return new GenericJavaPrimaryKeyJoinColumnRelationshipStrategy(this); - } - - - // ********** join table strategy ********** - - public JavaJoinTableRelationshipStrategy getJoinTableStrategy() { - return this.joinTableStrategy; - } - - public boolean strategyIsJoinTable() { - return this.strategy == this.joinTableStrategy; - } - - public final void setStrategyToJoinTable() { - this.joinTableStrategy.addStrategy(); - this.mappedByStrategy.removeStrategy(); - this.joinColumnStrategy.removeStrategy(); - this.primaryKeyJoinColumnStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayHaveDefaultJoinTable() { - return false; - } - - protected JavaJoinTableRelationshipStrategy buildJoinTableStrategy() { - return this.isJpa2_0Compatible() ? - new GenericJavaMappingJoinTableRelationshipStrategy(this) : - new NullJavaJoinTableRelationshipStrategy(this); - } - - - // ********** join column strategy ********** - - public JavaJoinColumnRelationshipStrategy getJoinColumnStrategy() { - return this.joinColumnStrategy; - } - - public boolean strategyIsJoinColumn() { - return this.strategy == this.joinColumnStrategy; - } - - public void setStrategyToJoinColumn() { - // join column strategy is the default; so no need to add stuff, - // just remove all the others - this.mappedByStrategy.removeStrategy(); - this.primaryKeyJoinColumnStrategy.removeStrategy(); - this.joinTableStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayHaveDefaultJoinColumn() { - return (this.mappedByStrategy.getMappedByAttribute() == null) && - (this.primaryKeyJoinColumnStrategy.primaryKeyJoinColumnsSize() == 0) && - (this.joinTableStrategy.getJoinTable() == null); - } - - protected JavaJoinColumnRelationshipStrategy buildJoinColumnStrategy() { - return new GenericJavaMappingJoinColumnRelationshipStrategy(this); - } - - - // ********** conversions ********** - - public void initializeOn(Relationship newRelationship) { - newRelationship.initializeFromMappedByRelationship(this); - newRelationship.initializeFromJoinTableRelationship(this); - newRelationship.initializeFromJoinColumnRelationship(this); - // no other pk join column relationships yet - } - - @Override - public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) { - super.initializeFromMappedByRelationship(oldRelationship); - this.mappedByStrategy.initializeFrom(oldRelationship.getMappedByStrategy()); - } - - @Override - public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) { - super.initializeFromJoinTableRelationship(oldRelationship); - this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy()); - } - - @Override - public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) { - super.initializeFromJoinColumnRelationship(oldRelationship); - this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy()); - } - - - // ********** misc ********** - - @Override - public JavaOneToOneMapping getMapping() { - return this.getParent(); - } - - public OwnableRelationshipMappingAnnotation getMappingAnnotation() { - return this.getMapping().getMappingAnnotation(); - } - - public OwnableRelationshipMappingAnnotation getMappingAnnotationForUpdate() { - return this.getMapping().getAnnotationForUpdate(); - } - - public boolean isOwner() { - return this.mappedByStrategy.getMappedByAttribute() == null; - } - - public boolean isOwnedBy(RelationshipMapping mapping) { - return this.mappedByStrategy.relationshipIsOwnedBy(mapping); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - result = this.mappedByStrategy.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - result = this.primaryKeyJoinColumnStrategy.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - result = this.joinTableStrategy.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - return this.joinColumnStrategy.javaCompletionProposals(pos, filter, astRoot); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.mappedByStrategy.validate(messages, reporter, astRoot); - this.primaryKeyJoinColumnStrategy.validate(messages, reporter, astRoot); - this.joinColumnStrategy.validate(messages, reporter, astRoot); - this.joinTableStrategy.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java deleted file mode 100644 index 9190e16939..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaOverrideJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,249 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.ListIterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaOverrideRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn.Owner; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; -import org.eclipse.jpt.jpa.db.Table; - -public class GenericJavaOverrideJoinColumnRelationshipStrategy - extends AbstractJavaJoinColumnRelationshipStrategy -{ - public GenericJavaOverrideJoinColumnRelationshipStrategy(JavaOverrideRelationship parent) { - super(parent); - } - - - // ********** join column annotations ********** - - @Override - protected ListIterator joinColumnAnnotations() { - return this.getOverrideAnnotation().joinColumns(); - } - - @Override - protected JoinColumnAnnotation addJoinColumnAnnotation(int index) { - return this.getOverrideAnnotation().addJoinColumn(index); - } - - @Override - protected void removeJoinColumnAnnotation(int index) { - this.getOverrideAnnotation().removeJoinColumn(index); - } - - @Override - protected void moveJoinColumnAnnotation(int targetIndex, int sourceIndex) { - this.getOverrideAnnotation().moveJoinColumn(targetIndex, sourceIndex); - } - - @Override - protected JoinColumnAnnotation buildNullJoinColumnAnnotation() { - return new NullJoinColumnAnnotation(this.getOverrideAnnotation()); - } - - protected AssociationOverrideAnnotation getOverrideAnnotation() { - return this.getAssociationOverride().getOverrideAnnotation(); - } - - - // ********** misc ********** - - @Override - protected Owner buildJoinColumnOwner() { - return new JoinColumnOwner(); - } - - public boolean isTargetForeignKey() { - RelationshipMapping relationshipMapping = this.getRelationshipMapping(); - return (relationshipMapping != null) && - relationshipMapping.getRelationship().isTargetForeignKey(); - } - - public TypeMapping getRelationshipSource() { - return this.isTargetForeignKey() ? - this.getRelationshipMapping().getResolvedTargetEntity() : - this.getAssociationOverrideContainer().getTypeMapping(); - } - - public TypeMapping getRelationshipTarget() { - return this.isTargetForeignKey() ? - this.getAssociationOverrideContainer().getTypeMapping() : - this.getRelationshipMappingTargetEntity(); - } - - protected TypeMapping getRelationshipMappingTargetEntity() { - RelationshipMapping mapping = this.getRelationshipMapping(); - return (mapping == null) ? null : mapping.getResolvedTargetEntity(); - } - - protected Entity getRelationshipTargetEntity() { - TypeMapping target = this.getRelationshipTarget(); - return (target instanceof Entity) ? (Entity) target : null; - } - - @Override - public RelationshipMapping getRelationshipMapping() { - return this.getAssociationOverride().getMapping(); - } - - protected String getAttributeName() { - return this.getAssociationOverride().getName(); - } - - @Override - public String getTableName() { - return this.isTargetForeignKey() ? - super.getTableName() : - this.getAssociationOverrideContainer().getDefaultTableName(); - } - - @Override - public Table resolveDbTable(String tableName) { - return this.isTargetForeignKey() ? - super.resolveDbTable(tableName) : - this.getAssociationOverrideContainer().resolveDbTable(tableName); - } - - @Override - public boolean tableNameIsInvalid(String tableName) { - return this.isTargetForeignKey() ? - super.tableNameIsInvalid(tableName) : - this.getAssociationOverrideContainer().tableNameIsInvalid(tableName); - } - - @Override - public Iterator candidateTableNames() { - return this.isTargetForeignKey() ? - super.candidateTableNames() : - this.getAssociationOverrideContainer().candidateTableNames(); - } - - public String getColumnTableNotValidDescription() { - return null; - } - - public boolean isOverridable() { - return false; - } - - protected JavaAssociationOverride getAssociationOverride() { - return this.getRelationship().getAssociationOverride(); - } - - protected JavaAssociationOverrideContainer getAssociationOverrideContainer() { - return this.getAssociationOverride().getContainer(); - } - - @Override - public JavaOverrideRelationship getRelationship() { - return (JavaOverrideRelationship) super.getRelationship(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getRelationship().getValidationTextRange(astRoot); - } - - - // ********** join column owner adapter ********** - - protected class JoinColumnOwner - implements JavaJoinColumn.Owner - { - protected JoinColumnOwner() { - super(); - } - - public String getDefaultTableName() { - return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getTableName(); - } - - public String getDefaultColumnName() { - //built in MappingTools.buildJoinColumnDefaultName() - return null; - } - - public String getAttributeName() { - return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getAttributeName(); - } - - public PersistentAttribute getPersistentAttribute() { - RelationshipMapping relationshipMapping = GenericJavaOverrideJoinColumnRelationshipStrategy.this.getRelationshipMapping(); - return relationshipMapping == null ? null : relationshipMapping.getPersistentAttribute(); - } - - public TypeMapping getTypeMapping() { - return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getRelationshipSource(); - } - - public Entity getRelationshipTarget() { - return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getRelationshipTargetEntity(); - } - - public boolean tableNameIsInvalid(String tableName) { - return GenericJavaOverrideJoinColumnRelationshipStrategy.this.tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return GenericJavaOverrideJoinColumnRelationshipStrategy.this.candidateTableNames(); - } - - public Table resolveDbTable(String tableName) { - return GenericJavaOverrideJoinColumnRelationshipStrategy.this.resolveDbTable(tableName); - } - - public Table getReferencedColumnDbTable() { - return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getReferencedColumnDbTable(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return false; - } - - public int joinColumnsSize() { - return GenericJavaOverrideJoinColumnRelationshipStrategy.this.joinColumnsSize(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getValidationTextRange(astRoot); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return this.getAssociationOverrideContainer().buildColumnValidator(this.getAssociationOverride(), (BaseColumn) column, this, (BaseColumnTextRangeResolver) textRangeResolver); - } - - protected JavaAssociationOverride getAssociationOverride() { - return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getAssociationOverride(); - } - - protected JavaAssociationOverrideContainer getAssociationOverrideContainer() { - return GenericJavaOverrideJoinColumnRelationshipStrategy.this.getAssociationOverrideContainer(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java deleted file mode 100644 index 188364f29b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,385 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper; -import org.eclipse.jpt.jpa.core.context.BaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipMapping; -import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.OneToOnePrimaryKeyJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaPrimaryKeyJoinColumnRelationshipStrategy - extends AbstractJavaJpaContextNode - implements JavaPrimaryKeyJoinColumnRelationshipStrategy -{ - protected final Vector primaryKeyJoinColumns = new Vector(); - protected final PrimaryKeyJoinColumnContainerAdapter primaryKeyJoinColumnContainerAdapter; - protected final JavaJoinColumn.Owner primaryKeyJoinColumnOwner; - - - public GenericJavaPrimaryKeyJoinColumnRelationshipStrategy(JavaPrimaryKeyJoinColumnRelationship parent) { - super(parent); - this.primaryKeyJoinColumnContainerAdapter = this.buildPrimaryKeyJoinColumnContainerAdapter(); - this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner(); - this.initializePrimaryKeyJoinColumns(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncPrimaryKeyJoinColumns(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getPrimaryKeyJoinColumns()); - } - - - // ********** primary key join columns ********** - - public ListIterator primaryKeyJoinColumns() { - return this.getPrimaryKeyJoinColumns().iterator(); - } - - public ListIterable getPrimaryKeyJoinColumns() { - return new LiveCloneListIterable(this.primaryKeyJoinColumns); - } - - public int primaryKeyJoinColumnsSize() { - return this.primaryKeyJoinColumns.size(); - } - - public boolean hasPrimaryKeyJoinColumns() { - return this.primaryKeyJoinColumns.size() != 0; - } - - public JavaPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index) { - return this.primaryKeyJoinColumns.get(index); - } - - public JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn() { - return this.addPrimaryKeyJoinColumn(this.primaryKeyJoinColumns.size()); - } - - public JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index) { - PrimaryKeyJoinColumnAnnotation annotation = this.addPrimaryKeyJoinColumnAnnotation(index); - return this.addPrimaryKeyJoinColumn_(index, annotation); - } - - public void removePrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) { - this.removePrimaryKeyJoinColumn(this.primaryKeyJoinColumns.indexOf(joinColumn)); - } - - public void removePrimaryKeyJoinColumn(int index) { - this.removePrimaryKeyJoinColumnAnnotation(index); - this.removePrimaryKeyJoinColumn_(index); - } - - protected void removePrimaryKeyJoinColumn_(int index) { - this.removeItemFromList(index, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - public void movePrimaryKeyJoinColumn(int targetIndex, int sourceIndex) { - this.movePrimaryKeyJoinColumnAnnotation(targetIndex, sourceIndex); - this.moveItemInList(targetIndex, sourceIndex, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - protected void initializePrimaryKeyJoinColumns() { - for (PrimaryKeyJoinColumnAnnotation annotation : this.getPrimaryKeyJoinColumnAnnotations()) { - this.primaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(annotation)); - } - } - - protected void syncPrimaryKeyJoinColumns() { - ContextContainerTools.synchronizeWithResourceModel(this.primaryKeyJoinColumnContainerAdapter); - } - - protected Iterable getPrimaryKeyJoinColumnAnnotations() { - return CollectionTools.iterable(this.primaryKeyJoinColumnAnnotations()); - } - - protected void movePrimaryKeyJoinColumn_(int index, JavaPrimaryKeyJoinColumn joinColumn) { - this.moveItemInList(index, joinColumn, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - protected JavaPrimaryKeyJoinColumn addPrimaryKeyJoinColumn_(int index, PrimaryKeyJoinColumnAnnotation pkJoinColumnAnnotation) { - JavaPrimaryKeyJoinColumn joinColumn = this.buildPrimaryKeyJoinColumn(pkJoinColumnAnnotation); - this.addItemToList(index, joinColumn, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST); - return joinColumn; - } - - protected void removePrimaryKeyJoinColumn_(JavaPrimaryKeyJoinColumn joinColumn) { - this.removePrimaryKeyJoinColumn_(this.primaryKeyJoinColumns.indexOf(joinColumn)); - } - - protected PrimaryKeyJoinColumnContainerAdapter buildPrimaryKeyJoinColumnContainerAdapter() { - return new PrimaryKeyJoinColumnContainerAdapter(); - } - - /** - * primary key join column container adapter - */ - protected class PrimaryKeyJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getPrimaryKeyJoinColumns(); - } - public Iterable getResourceElements() { - return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getPrimaryKeyJoinColumnAnnotations(); - } - public PrimaryKeyJoinColumnAnnotation getResourceElement(JavaPrimaryKeyJoinColumn contextElement) { - return contextElement.getColumnAnnotation(); - } - public void moveContextElement(int index, JavaPrimaryKeyJoinColumn element) { - GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.movePrimaryKeyJoinColumn_(index, element); - } - public void addContextElement(int index, PrimaryKeyJoinColumnAnnotation resourceElement) { - GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.addPrimaryKeyJoinColumn_(index, resourceElement); - } - public void removeContextElement(JavaPrimaryKeyJoinColumn element) { - GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.removePrimaryKeyJoinColumn_(element); - } - } - - protected JavaJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() { - return new PrimaryKeyJoinColumnOwner(); - } - - protected JavaPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(PrimaryKeyJoinColumnAnnotation annotation) { - return this.getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, annotation); - } - - - // ********** primary key join column annotations ********** - - protected Iterator primaryKeyJoinColumnAnnotations() { - return new SubIteratorWrapper(this.primaryKeyJoinColumnAnnotations_()); - } - - protected Iterator primaryKeyJoinColumnAnnotations_() { - return this.getResourcePersistentAttribute().annotations(PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); - } - - protected PrimaryKeyJoinColumnAnnotation addPrimaryKeyJoinColumnAnnotation(int index) { - return (PrimaryKeyJoinColumnAnnotation) this.getResourcePersistentAttribute().addAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); - } - - protected void removePrimaryKeyJoinColumnAnnotation(int index) { - this.getResourcePersistentAttribute().removeAnnotation(index, PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); - } - - protected void movePrimaryKeyJoinColumnAnnotation(int targetIndex, int sourceIndex) { - this.getResourcePersistentAttribute().moveAnnotation(targetIndex, sourceIndex, PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME); - } - - - // ********** misc ********** - - @Override - public JavaPrimaryKeyJoinColumnRelationship getParent() { - return (JavaPrimaryKeyJoinColumnRelationship) super.getParent(); - } - - public JavaPrimaryKeyJoinColumnRelationship getRelationship() { - return this.getParent(); - } - - protected JavaRelationshipMapping getRelationshipMapping() { - return this.getRelationship().getMapping(); - } - - protected JavaResourcePersistentAttribute getResourcePersistentAttribute() { - return this.getRelationship().getMapping().getResourcePersistentAttribute(); - } - - public String getTableName() { - return this.getTypeMapping().getPrimaryTableName(); - } - - public Table resolveDbTable(String tableName) { - return this.getTypeMapping().resolveDbTable(tableName); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getTypeMapping().tableNameIsInvalid(tableName); - } - - public boolean isOverridable() { - return false; - } - - public String getColumnTableNotValidDescription() { - return JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY; - } - - protected TypeMapping getTypeMapping() { - return this.getRelationshipMapping().getTypeMapping(); - } - - public void addStrategy() { - if (this.primaryKeyJoinColumns.size() == 0) { - this.addPrimaryKeyJoinColumn(); - } - } - - public void removeStrategy() { - for (int i = this.primaryKeyJoinColumns.size(); i-- > 0; ) { - this.removePrimaryKeyJoinColumn(i); - } - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - for (JavaPrimaryKeyJoinColumn column : this.getPrimaryKeyJoinColumns()) { - result = column.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - return null; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - for (JavaPrimaryKeyJoinColumn pkJoinColumn : this.getPrimaryKeyJoinColumns()) { - pkJoinColumn.validate(messages, reporter, astRoot); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getRelationship().getValidationTextRange(astRoot); - } - - - // ********** join column owner ********** - - protected class PrimaryKeyJoinColumnOwner - implements JavaJoinColumn.Owner - { - protected PrimaryKeyJoinColumnOwner() { - super(); - } - - /** - * by default, the join column is in the type mapping's primary table - */ - public String getDefaultTableName() { - return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getTableName(); - } - - public Entity getRelationshipTarget() { - return this.getRelationshipMapping().getResolvedTargetEntity(); - } - - public String getAttributeName() { - return this.getRelationshipMapping().getName(); - } - - public PersistentAttribute getPersistentAttribute() { - return this.getRelationshipMapping().getPersistentAttribute(); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getTypeMapping().tableNameIsInvalid(tableName); - } - - /** - * the join column can be on a secondary table - */ - public Iterator candidateTableNames() { - return this.getTypeMapping().allAssociatedTableNames(); - } - - public TypeMapping getTypeMapping() { - return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getTypeMapping(); - } - - public Table resolveDbTable(String tableName) { - return this.getTypeMapping().resolveDbTable(tableName); - } - - public Table getReferencedColumnDbTable() { - Entity targetEntity = this.getRelationshipTarget(); - return (targetEntity == null) ? null : targetEntity.getPrimaryDbTable(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return false; - } - - public String getDefaultColumnName() { - return null; - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getValidationTextRange(astRoot); - } - - public int joinColumnsSize() { - return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.primaryKeyJoinColumnsSize(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new OneToOnePrimaryKeyJoinColumnValidator((BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver); - } - - protected JavaRelationshipMapping getRelationshipMapping() { - return GenericJavaPrimaryKeyJoinColumnRelationshipStrategy.this.getRelationshipMapping(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java deleted file mode 100644 index f27ca4df39..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/GenericJavaVirtualJoinTable.java +++ /dev/null @@ -1,333 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTable; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualRelationship; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; - -/** - * Java virtual join table - */ -public class GenericJavaVirtualJoinTable - extends AbstractJavaVirtualReferenceTable - implements JavaVirtualJoinTable -{ - protected final JoinTable overriddenTable; - - protected final Vector specifiedInverseJoinColumns = new Vector(); - protected final SpecifiedInverseJoinColumnContainerAdapter specifiedInverseJoinColumnContainerAdapter = new SpecifiedInverseJoinColumnContainerAdapter(); - protected final ReadOnlyJoinColumn.Owner inverseJoinColumnOwner; - - protected JavaVirtualJoinColumn defaultInverseJoinColumn; - - - public GenericJavaVirtualJoinTable(JavaVirtualJoinTableRelationshipStrategy parent, JoinTable overriddenTable) { - super(parent); - this.overriddenTable = overriddenTable; - this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner(); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.updateSpecifiedInverseJoinColumns(); - this.updateDefaultInverseJoinColumn(); - } - - - // ********** table ********** - - @Override - public JoinTable getOverriddenTable() { - return this.overriddenTable; - } - - - // ********** inverse join columns ********** - - public ListIterator inverseJoinColumns() { - return this.getInverseJoinColumns().iterator(); - } - - protected ListIterable getInverseJoinColumns() { - return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns(); - } - - public int inverseJoinColumnsSize() { - return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumnsSize() : this.getDefaultInverseJoinColumnsSize(); - } - - - // ********** inverse specified join columns ********** - - public ListIterator specifiedInverseJoinColumns() { - return this.getSpecifiedInverseJoinColumns().iterator(); - } - - protected ListIterable getSpecifiedInverseJoinColumns() { - return new LiveCloneListIterable(this.specifiedInverseJoinColumns); - } - - public int specifiedInverseJoinColumnsSize() { - return this.specifiedInverseJoinColumns.size(); - } - - public boolean hasSpecifiedInverseJoinColumns() { - return this.specifiedInverseJoinColumns.size() != 0; - } - - public JavaVirtualJoinColumn getSpecifiedInverseJoinColumn(int index) { - return this.specifiedInverseJoinColumns.get(index); - } - - protected void updateSpecifiedInverseJoinColumns() { - ContextContainerTools.update(this.specifiedInverseJoinColumnContainerAdapter); - } - - protected Iterable getOverriddenInverseJoinColumns() { - return CollectionTools.iterable(this.getOverriddenTable().specifiedInverseJoinColumns()); - } - - protected void moveSpecifiedInverseJoinColumn(int index, JavaVirtualJoinColumn joinColumn) { - this.moveItemInList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST); - } - - protected JavaVirtualJoinColumn addSpecifiedInverseJoinColumn(int index, JoinColumn joinColumn) { - JavaVirtualJoinColumn virtualJoinColumn = this.buildInverseJoinColumn(joinColumn); - this.addItemToList(index, virtualJoinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST); - return virtualJoinColumn; - } - - protected void removeSpecifiedInverseJoinColumn(JavaVirtualJoinColumn joinColumn) { - this.removeItemFromList(joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST); - } - - /** - * specified inverse join column container adapter - */ - protected class SpecifiedInverseJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericJavaVirtualJoinTable.this.getSpecifiedInverseJoinColumns(); - } - public Iterable getResourceElements() { - return GenericJavaVirtualJoinTable.this.getOverriddenInverseJoinColumns(); - } - public JoinColumn getResourceElement(JavaVirtualJoinColumn contextElement) { - return contextElement.getOverriddenColumn(); - } - public void moveContextElement(int index, JavaVirtualJoinColumn element) { - GenericJavaVirtualJoinTable.this.moveSpecifiedInverseJoinColumn(index, element); - } - public void addContextElement(int index, JoinColumn element) { - GenericJavaVirtualJoinTable.this.addSpecifiedInverseJoinColumn(index, element); - } - public void removeContextElement(JavaVirtualJoinColumn element) { - GenericJavaVirtualJoinTable.this.removeSpecifiedInverseJoinColumn(element); - } - } - - - // ********** default inverse join column ********** - - public JavaVirtualJoinColumn getDefaultInverseJoinColumn() { - return this.defaultInverseJoinColumn; - } - - protected void setDefaultInverseJoinColumn(JavaVirtualJoinColumn joinColumn) { - JavaVirtualJoinColumn old = this.defaultInverseJoinColumn; - this.defaultInverseJoinColumn = joinColumn; - this.firePropertyChanged(DEFAULT_INVERSE_JOIN_COLUMN, old, joinColumn); - } - - protected ListIterable getDefaultInverseJoinColumns() { - return (this.defaultInverseJoinColumn != null) ? - new SingleElementListIterable(this.defaultInverseJoinColumn) : - EmptyListIterable.instance(); - } - - protected int getDefaultInverseJoinColumnsSize() { - return (this.defaultInverseJoinColumn == null) ? 0 : 1; - } - - protected void updateDefaultInverseJoinColumn() { - if (this.buildsDefaultInverseJoinColumn()) { - if (this.defaultInverseJoinColumn == null) { - this.setDefaultInverseJoinColumn(this.buildInverseJoinColumn(this.getOverriddenTable().getDefaultInverseJoinColumn())); - } else { - this.defaultInverseJoinColumn.update(); - } - } else { - this.setDefaultInverseJoinColumn(null); - } - } - - protected boolean buildsDefaultInverseJoinColumn() { - return ! this.hasSpecifiedInverseJoinColumns(); - } - - - // ********** misc ********** - - @Override - public JavaVirtualJoinTableRelationshipStrategy getParent() { - return (JavaVirtualJoinTableRelationshipStrategy) super.getParent(); - } - - protected JavaVirtualJoinTableRelationshipStrategy getJoinStrategy() { - return this.getParent(); - } - - @Override - protected ReadOnlyJoinColumn.Owner buildJoinColumnOwner() { - return new JoinColumnOwner(); - } - - protected ReadOnlyJoinColumn.Owner buildInverseJoinColumnOwner() { - return new InverseJoinColumnOwner(); - } - - protected JavaVirtualJoinColumn buildInverseJoinColumn(JoinColumn joinColumn) { - return this.buildJoinColumn(this.inverseJoinColumnOwner, joinColumn); - } - - @Override - protected String buildDefaultName() { - return this.getJoinStrategy().getJoinTableDefaultName(); - } - - public RelationshipMapping getRelationshipMapping() { - return this.getJoinStrategy().getRelationship().getMapping(); - } - - public PersistentAttribute getPersistentAttribute() { - return this.getRelationshipMapping().getPersistentAttribute(); - } - - - // ********** join column owners ********** - - /** - * just a little common behavior - */ - protected abstract class AbstractJoinColumnOwner - implements ReadOnlyJoinColumn.Owner - { - protected AbstractJoinColumnOwner() { - super(); - } - - public TypeMapping getTypeMapping() { - return this.getRelationship().getTypeMapping(); - } - - /** - * by default, the join column is, obviously, in the join table; - * not sure whether it can be anywhere else... - */ - public String getDefaultTableName() { - return GenericJavaVirtualJoinTable.this.getName(); - } - - /** - * @see MappingTools#buildJoinColumnDefaultName(org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn.Owner) - */ - public String getDefaultColumnName() { - throw new UnsupportedOperationException(); - } - - protected JavaVirtualRelationship getRelationship() { - return GenericJavaVirtualJoinTable.this.getJoinStrategy().getRelationship(); - } - } - - - /** - * owner for "back-pointer" join columns; - * these point at the source/owning entity - */ - protected class JoinColumnOwner - extends AbstractJoinColumnOwner - { - protected JoinColumnOwner() { - super(); - } - - public Entity getRelationshipTarget() { - return this.getRelationship().getEntity(); - } - - public String getAttributeName() { - return MappingTools.getTargetAttributeName(GenericJavaVirtualJoinTable.this.getRelationshipMapping()); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return GenericJavaVirtualJoinTable.this.defaultJoinColumn == joinColumn; - } - - public int joinColumnsSize() { - return GenericJavaVirtualJoinTable.this.joinColumnsSize(); - } - } - - - /** - * owner for "forward-pointer" join columns; - * these point at the target/inverse entity - */ - protected class InverseJoinColumnOwner - extends AbstractJoinColumnOwner - { - protected InverseJoinColumnOwner() { - super(); - } - - public Entity getRelationshipTarget() { - RelationshipMapping relationshipMapping = GenericJavaVirtualJoinTable.this.getRelationshipMapping(); - return (relationshipMapping == null) ? null : relationshipMapping.getResolvedTargetEntity(); - } - - public String getAttributeName() { - RelationshipMapping relationshipMapping = GenericJavaVirtualJoinTable.this.getRelationshipMapping(); - return (relationshipMapping == null) ? null : relationshipMapping.getName(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return GenericJavaVirtualJoinTable.this.defaultInverseJoinColumn == joinColumn; - } - - public int joinColumnsSize() { - return GenericJavaVirtualJoinTable.this.inverseJoinColumnsSize(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBaseColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBaseColumnTextRangeResolver.java deleted file mode 100644 index 951094aed6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBaseColumnTextRangeResolver.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaBaseColumn; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; - -public class JavaBaseColumnTextRangeResolver - extends JavaNamedColumnTextRangeResolver - implements BaseColumnTextRangeResolver -{ - - public JavaBaseColumnTextRangeResolver(JavaBaseColumn column, CompilationUnit astRoot) { - super(column, astRoot); - } - - @Override - protected JavaBaseColumn getColumn() { - return (JavaBaseColumn) super.getColumn(); - } - public TextRange getTableTextRange() { - return this.getColumn().getTableTextRange(this.astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java deleted file mode 100644 index 7d13a41785..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaBasicMappingDefinition.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; - -public class JavaBasicMappingDefinition - extends AbstractJavaBasicMappingDefinition -{ - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new JavaBasicMappingDefinition(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaBasicMappingDefinition() { - super(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java deleted file mode 100644 index db5e442034..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddableDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation; - -public class JavaEmbeddableDefinition - implements JavaTypeMappingDefinition -{ - // singleton - private static final JavaEmbeddableDefinition INSTANCE = new JavaEmbeddableDefinition(); - - /** - * Return the singleton - */ - public static JavaTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEmbeddableDefinition() { - super(); - } - - public String getKey() { - return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EmbeddableAnnotation.ANNOTATION_NAME; - } - - public Iterable getSupportingAnnotationNames() { - return EmptyIterable.instance(); - } - - public JavaEmbeddable buildMapping(JavaPersistentType persistentType, Annotation mappingAnnotation, JpaFactory factory) { - return factory.buildJavaEmbeddable(persistentType, (EmbeddableAnnotation) mappingAnnotation); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java deleted file mode 100644 index 9695b24aca..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedIdMappingDefinition.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation; - -public class JavaEmbeddedIdMappingDefinition - implements JavaAttributeMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaEmbeddedIdMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singletong usage - */ - private JavaEmbeddedIdMappingDefinition() { - super(); - } - - public String getKey() { - return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EmbeddedIdAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable getSupportingAnnotationNames() { - return SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - AttributeOverrideAnnotation.ANNOTATION_NAME, - AttributeOverridesAnnotation.ANNOTATION_NAME, - }; - protected static final Iterable SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(SUPPORTING_ANNOTATION_NAMES_ARRAY); - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return factory.buildJavaEmbeddedIdMapping(persistentAttribute); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java deleted file mode 100644 index fc94ac724a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEmbeddedMappingDefinition.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; - -public class JavaEmbeddedMappingDefinition - extends AbstractJavaEmbeddedMappingDefinition -{ - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new JavaEmbeddedMappingDefinition(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEmbeddedMappingDefinition() { - super(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java deleted file mode 100644 index 485e0b658b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityDefinition.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaEntity; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JPA; -import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueriesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnsAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.SecondaryTablesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation; - -public class JavaEntityDefinition - implements JavaTypeMappingDefinition -{ - // singleton - private static final JavaEntityDefinition INSTANCE = new JavaEntityDefinition(); - - /** - * Return the singleton - */ - public static JavaTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEntityDefinition() { - super(); - } - - public String getKey() { - return MappingKeys.ENTITY_TYPE_MAPPING_KEY; - } - - public String getAnnotationName() { - return EntityAnnotation.ANNOTATION_NAME; - } - - public Iterable getSupportingAnnotationNames() { - return SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - TableAnnotation.ANNOTATION_NAME, - SecondaryTableAnnotation.ANNOTATION_NAME, - SecondaryTablesAnnotation.ANNOTATION_NAME, - PrimaryKeyJoinColumnAnnotation.ANNOTATION_NAME, - PrimaryKeyJoinColumnsAnnotation.ANNOTATION_NAME, - IdClassAnnotation.ANNOTATION_NAME, - InheritanceAnnotation.ANNOTATION_NAME, - DiscriminatorValueAnnotation.ANNOTATION_NAME, - DiscriminatorColumnAnnotation.ANNOTATION_NAME, - SequenceGeneratorAnnotation.ANNOTATION_NAME, - TableGeneratorAnnotation.ANNOTATION_NAME, - NamedQueryAnnotation.ANNOTATION_NAME, - NamedQueriesAnnotation.ANNOTATION_NAME, - NamedNativeQueryAnnotation.ANNOTATION_NAME, - NamedNativeQueriesAnnotation.ANNOTATION_NAME, - JPA.SQL_RESULT_SET_MAPPING, - JPA.EXCLUDE_DEFAULT_LISTENERS, - JPA.EXCLUDE_SUPERCLASS_LISTENERS, - JPA.ENTITY_LISTENERS, - JPA.PRE_PERSIST, - JPA.POST_PERSIST, - JPA.PRE_REMOVE, - JPA.POST_REMOVE, - JPA.PRE_UPDATE, - JPA.POST_UPDATE, - JPA.POST_LOAD, - AttributeOverrideAnnotation.ANNOTATION_NAME, - AttributeOverridesAnnotation.ANNOTATION_NAME, - AssociationOverrideAnnotation.ANNOTATION_NAME, - AssociationOverridesAnnotation.ANNOTATION_NAME - }; - protected static final Iterable SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(SUPPORTING_ANNOTATION_NAMES_ARRAY); - - public JavaEntity buildMapping(JavaPersistentType persistentType, Annotation mappingAnnotation, JpaFactory factory) { - return factory.buildJavaEntity(persistentType, (EntityAnnotation) mappingAnnotation); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityTextRangeResolver.java deleted file mode 100644 index af74224308..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaEntityTextRangeResolver.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaEntity; -import org.eclipse.jpt.jpa.core.internal.context.EntityTextRangeResolver; - -public class JavaEntityTextRangeResolver - implements EntityTextRangeResolver -{ - private JavaEntity entity; - - private CompilationUnit astRoot; - - - public JavaEntityTextRangeResolver(JavaEntity entity, CompilationUnit astRoot) { - this.entity = entity; - this.astRoot = astRoot; - } - - - public TextRange getTypeMappingTextRange() { - return this.entity.getValidationTextRange(this.astRoot); - } - - public TextRange getIdClassTextRange() { - return this.entity.getIdClassReference().getValidationTextRange(this.astRoot); - } - - public TextRange getAttributeMappingTextRange(String attributeName) { - return this.entity.getPersistentType(). - getAttributeNamed(attributeName).getMapping().getValidationTextRange(this.astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java deleted file mode 100644 index 1297324074..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaIdMappingDefinition.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; - -public class JavaIdMappingDefinition - extends AbstractJavaIdMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaIdMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaIdMappingDefinition() { - super(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaJoinColumnTextRangeResolver.java deleted file mode 100644 index e715135955..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaJoinColumnTextRangeResolver.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; - -public class JavaJoinColumnTextRangeResolver - extends JavaNamedColumnTextRangeResolver - implements JoinColumnTextRangeResolver -{ - public JavaJoinColumnTextRangeResolver(JavaJoinColumn column, CompilationUnit astRoot) { - super(column, astRoot); - } - - @Override - protected JavaJoinColumn getColumn() { - return (JavaJoinColumn) super.getColumn(); - } - - public TextRange getTableTextRange() { - return this.getColumn().getTableTextRange(this.astRoot); - } - - public TextRange getReferencedColumnNameTextRange() { - return this.getColumn().getReferencedColumnNameTextRange(this.astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java deleted file mode 100644 index dbce1decd9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToManyMappingDefinition.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; - -public class JavaManyToManyMappingDefinition - extends AbstractJavaManyToManyMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaManyToManyMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaManyToManyMappingDefinition() { - super(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java deleted file mode 100644 index f93744128a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaManyToOneMappingDefinition.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; - -public class JavaManyToOneMappingDefinition - extends AbstractJavaManyToOneMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaManyToOneMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaManyToOneMappingDefinition() { - super(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java deleted file mode 100644 index ce234ec00c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassDefinition.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JPA; -import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation; - -public class JavaMappedSuperclassDefinition - implements JavaTypeMappingDefinition -{ - // singleton - private static final JavaMappedSuperclassDefinition INSTANCE = new JavaMappedSuperclassDefinition(); - - /** - * Return the singleton - */ - public static JavaTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaMappedSuperclassDefinition() { - super(); - } - - public String getKey() { - return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY; - } - - public String getAnnotationName() { - return MappedSuperclassAnnotation.ANNOTATION_NAME; - } - - public Iterable getSupportingAnnotationNames() { - return SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - IdClassAnnotation.ANNOTATION_NAME, - JPA.EXCLUDE_DEFAULT_LISTENERS, - JPA.EXCLUDE_SUPERCLASS_LISTENERS, - JPA.ENTITY_LISTENERS, - JPA.PRE_PERSIST, - JPA.POST_PERSIST, - JPA.PRE_REMOVE, - JPA.POST_REMOVE, - JPA.PRE_UPDATE, - JPA.POST_UPDATE, - JPA.POST_LOAD - }; - protected static final Iterable SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(SUPPORTING_ANNOTATION_NAMES_ARRAY); - - public JavaMappedSuperclass buildMapping(JavaPersistentType persistentType, Annotation mappingAnnotation, JpaFactory factory) { - return factory.buildJavaMappedSuperclass(persistentType, (MappedSuperclassAnnotation) mappingAnnotation); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassTextRangeResolver.java deleted file mode 100644 index c9319716ea..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaMappedSuperclassTextRangeResolver.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass; -import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver; - -public class JavaMappedSuperclassTextRangeResolver - implements PrimaryKeyTextRangeResolver -{ - private JavaMappedSuperclass mappedSuperclass; - - private CompilationUnit astRoot; - - - public JavaMappedSuperclassTextRangeResolver( - JavaMappedSuperclass mappedSuperclass, CompilationUnit astRoot) { - - this.mappedSuperclass = mappedSuperclass; - this.astRoot = astRoot; - } - - - public TextRange getTypeMappingTextRange() { - return this.mappedSuperclass.getValidationTextRange(this.astRoot); - } - - public TextRange getIdClassTextRange() { - return this.mappedSuperclass.getIdClassReference().getValidationTextRange(this.astRoot); - } - - public TextRange getAttributeMappingTextRange(String attributeName) { - return this.mappedSuperclass.getPersistentType(). - getAttributeNamed(attributeName).getMapping().getValidationTextRange(this.astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNamedColumnTextRangeResolver.java deleted file mode 100644 index cab6e08e67..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNamedColumnTextRangeResolver.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; - -public class JavaNamedColumnTextRangeResolver - implements NamedColumnTextRangeResolver -{ - protected final JavaNamedColumn javaNamedColumn; - - protected final CompilationUnit astRoot; - - public JavaNamedColumnTextRangeResolver(JavaNamedColumn javaNamedColumn, CompilationUnit astRoot) { - this.javaNamedColumn = javaNamedColumn; - this.astRoot = astRoot; - } - - protected JavaNamedColumn getColumn() { - return this.javaNamedColumn; - } - - public TextRange getNameTextRange() { - return this.javaNamedColumn.getNameTextRange(this.astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java deleted file mode 100644 index b48a3deef0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaNullTypeMapping.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import java.util.List; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java null type mapping - */ -public class JavaNullTypeMapping - extends AbstractJavaTypeMapping -{ - public JavaNullTypeMapping(JavaPersistentType parent) { - super(parent, null); - } - - public String getKey() { - return MappingKeys.NULL_TYPE_MAPPING_KEY; - } - - public JavaPersistentType getIdClass() { - return null; - } - - public boolean isMapped() { - return false; - } - - public boolean tableNameIsInvalid(String tableName) { - return false; - } - - - // ********** validation ********** - - /** - * We added this message here because the most likely solution is to add - * an annotation to the .java file. - * This message used to be found on the tag in persistence.xml. - * The other possible way to fix the error is to remove it from persistence.xml. - * This can be accomplished with the Synchronize Classes action. - * We could also add a quick fix for this error. - */ - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENCE_UNIT_INVALID_CLASS, - new String[] {this.getPersistentType().getName()}, - this, - this.getValidationTextRange(astRoot) - ) - ); - } - - @Override - public boolean validatesAgainstDatabase() { - return false; - } - - @Override - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getPersistentType().getValidationTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java deleted file mode 100644 index e2029a4f07..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToManyMappingDefinition.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; - -public class JavaOneToManyMappingDefinition - extends AbstractJavaOneToManyMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaOneToManyMappingDefinition(); - - /** - * Return the singleton - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaOneToManyMappingDefinition() { - super(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java deleted file mode 100644 index 6ed2d0b317..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOneToOneMappingDefinition.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; - -public class JavaOneToOneMappingDefinition - extends AbstractJavaOneToOneMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaOneToOneMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaOneToOneMappingDefinition() { - super(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOverrideTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOverrideTextRangeResolver.java deleted file mode 100644 index 7dcd7ce470..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaOverrideTextRangeResolver.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaOverride; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; - -public class JavaOverrideTextRangeResolver - implements OverrideTextRangeResolver -{ - protected final JavaOverride javaOverride; - - protected final CompilationUnit astRoot; - - public JavaOverrideTextRangeResolver(JavaOverride javaOverride, CompilationUnit astRoot) { - this.javaOverride = javaOverride; - this.astRoot = astRoot; - } - - protected JavaOverride getOverride() { - return this.javaOverride; - } - - public TextRange getNameTextRange() { - return this.javaOverride.getNameTextRange(this.astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPersistentAttributeTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPersistentAttributeTextRangeResolver.java deleted file mode 100644 index 83fe6f95ca..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPersistentAttributeTextRangeResolver.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver; - -public class JavaPersistentAttributeTextRangeResolver - implements PersistentAttributeTextRangeResolver -{ - private JavaPersistentAttribute javaPersistentAttribute; - - private CompilationUnit astRoot; - - public JavaPersistentAttributeTextRangeResolver(JavaPersistentAttribute javaPersistentAttribute, CompilationUnit astRoot) { - this.javaPersistentAttribute = javaPersistentAttribute; - this.astRoot = astRoot; - } - - public TextRange getAttributeTextRange() { - return this.javaPersistentAttribute.getValidationTextRange(this.astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java deleted file mode 100644 index 261f522f4a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaPrimaryKeyJoinColumnTextRangeResolver.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver; - -public class JavaPrimaryKeyJoinColumnTextRangeResolver - extends JavaNamedColumnTextRangeResolver - implements BaseJoinColumnTextRangeResolver -{ - - public JavaPrimaryKeyJoinColumnTextRangeResolver(JavaPrimaryKeyJoinColumn column, CompilationUnit astRoot) { - super(column, astRoot); - } - - @Override - protected JavaPrimaryKeyJoinColumn getColumn() { - return (JavaPrimaryKeyJoinColumn) super.getColumn(); - } - - public TextRange getReferencedColumnNameTextRange() { - return this.getColumn().getReferencedColumnNameTextRange(this.astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTableTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTableTextRangeResolver.java deleted file mode 100644 index 2f431635bb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTableTextRangeResolver.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaTable; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; - -public class JavaTableTextRangeResolver - implements TableTextRangeResolver -{ - protected final JavaTable javaTable; - - protected final CompilationUnit astRoot; - - public JavaTableTextRangeResolver(JavaTable javaTable, CompilationUnit astRoot) { - this.javaTable = javaTable; - this.astRoot = astRoot; - } - - protected JavaTable getTable() { - return this.javaTable; - } - - public TextRange getNameTextRange() { - return this.javaTable.getNameTextRange(this.astRoot); - } - - public TextRange getCatalogTextRange() { - return this.javaTable.getCatalogTextRange(this.astRoot); - } - - public TextRange getSchemaTextRange() { - return this.javaTable.getSchemaTextRange(this.astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java deleted file mode 100644 index 4618a9ec32..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTransientMappingDefinition.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation; - -public class JavaTransientMappingDefinition - implements JavaAttributeMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaTransientMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaTransientMappingDefinition() { - super(); - } - - public String getKey() { - return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return TransientAnnotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable getSupportingAnnotationNames() { - return EmptyIterable.instance(); - } - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return factory.buildJavaTransientMapping(persistentAttribute); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTypeMappingTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTypeMappingTextRangeResolver.java deleted file mode 100644 index 174e6b2b7a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaTypeMappingTextRangeResolver.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver; - -public class JavaTypeMappingTextRangeResolver - implements TypeMappingTextRangeResolver -{ - private JavaTypeMapping typeMapping; - - private CompilationUnit astRoot; - - public JavaTypeMappingTextRangeResolver(JavaTypeMapping typeMapping, CompilationUnit astRoot) { - this.typeMapping = typeMapping; - this.astRoot = astRoot; - } - - public TextRange getTypeMappingTextRange() { - return this.typeMapping.getValidationTextRange(this.astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java deleted file mode 100644 index c078d6fced..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/java/JavaVersionMappingDefinition.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; - -public class JavaVersionMappingDefinition - extends AbstractJavaVersionMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaVersionMappingDefinition(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaVersionMappingDefinition() { - super(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java deleted file mode 100644 index 1ba0d7ae9c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractEntityMappings.java +++ /dev/null @@ -1,1016 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.Vector; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.Generator; -import org.eclipse.jpt.jpa.core.context.MappingFileRoot; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; -import org.eclipse.jpt.jpa.core.context.orm.OrmGenerator; -import org.eclipse.jpt.jpa.core.context.orm.OrmIdClassReference; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator; -import org.eclipse.jpt.jpa.core.context.orm.OrmStructureNodes; -import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmXml; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml file - *
- * entity-mappings element - */ -public abstract class AbstractEntityMappings - extends AbstractOrmXmlContextNode - implements EntityMappings -{ - protected final XmlEntityMappings xmlEntityMappings; - - protected String description; - - protected String package_; // "package" is a Java keyword - - protected AccessType specifiedAccess; - protected AccessType defaultAccess; - - protected String specifiedCatalog; - protected String defaultCatalog; - - protected String specifiedSchema; - protected String defaultSchema; - - protected final OrmPersistenceUnitMetadata persistenceUnitMetadata; - - protected final Vector persistentTypes = new Vector(); - protected final PersistentTypeContainerAdapter persistentTypeContainerAdapter = new PersistentTypeContainerAdapter(); - - protected final Vector sequenceGenerators = new Vector(); - protected final SequenceGeneratorContainerAdapter sequenceGeneratorContainerAdapter = new SequenceGeneratorContainerAdapter(); - - protected final Vector tableGenerators = new Vector(); - protected final TableGeneratorContainerAdapter tableGeneratorContainerAdapter = new TableGeneratorContainerAdapter(); - - protected final OrmQueryContainer queryContainer; - - - protected AbstractEntityMappings(OrmXml parent, XmlEntityMappings xmlEntityMappings) { - super(parent); - this.xmlEntityMappings = xmlEntityMappings; - - this.description = this.xmlEntityMappings.getDescription(); - this.package_ = this.xmlEntityMappings.getPackage(); - - this.specifiedAccess = this.buildSpecifiedAccess(); - this.specifiedCatalog = this.xmlEntityMappings.getCatalog(); - this.specifiedSchema = this.xmlEntityMappings.getSchema(); - - this.persistenceUnitMetadata = this.buildPersistenceUnitMetadata(); - - this.initializePersistentTypes(); - this.initializeSequenceGenerators(); - this.initializeTableGenerators(); - - this.queryContainer = this.buildQueryContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - - this.setDescription_(this.xmlEntityMappings.getDescription()); - this.setPackage_(this.xmlEntityMappings.getPackage()); - - this.setSpecifiedAccess_(this.buildSpecifiedAccess()); - this.setSpecifiedCatalog_(this.xmlEntityMappings.getCatalog()); - this.setSpecifiedSchema_(this.xmlEntityMappings.getSchema()); - - this.persistenceUnitMetadata.synchronizeWithResourceModel(); - - this.syncPersistentTypes(); - this.syncSequenceGenerators(); - this.syncTableGenerators(); - - this.queryContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - - this.setDefaultAccess(this.buildDefaultAccess()); - this.setDefaultCatalog(this.buildDefaultCatalog()); - this.setDefaultSchema(this.buildDefaultSchema()); - - this.persistenceUnitMetadata.update(); - - this.updateNodes(this.getPersistentTypes()); - this.updateNodes(this.getSequenceGenerators()); - this.updateNodes(this.getTableGenerators()); - - this.queryContainer.update(); - } - - - // ********** overrides ********** - - @Override - public OrmXml getParent() { - return (OrmXml) super.getParent(); - } - - public OrmXml getOrmXml() { - return this.getParent(); - } - - @Override - public MappingFileRoot getMappingFileRoot() { - return this; - } - - - // ********** JpaStructureNode implementation ********** - - public String getId() { - return OrmStructureNodes.ENTITY_MAPPINGS_ID; - } - - public JpaStructureNode getStructureNode(int textOffset) { - for (OrmPersistentType persistentType: this.getPersistentTypes()) { - if (persistentType.contains(textOffset)) { - return persistentType.getStructureNode(textOffset); - } - } - return this; - } - - public TextRange getSelectionTextRange() { - return this.xmlEntityMappings.getSelectionTextRange(); - } - - public void dispose() { - for (OrmPersistentType ormPersistentType : this.getPersistentTypes()) { - ormPersistentType.dispose(); - } - } - - - // ********** PersistentType.Owner implementation ********** - - public AccessType getOverridePersistentTypeAccess() { - return this.isXmlMappingMetadataComplete() ? this.specifiedAccess : null; - } - - public AccessType getDefaultPersistentTypeAccess() { - return this.getAccess(); - } - - public String getDefaultPersistentTypePackage() { - return this.getPackage(); - } - - protected boolean isXmlMappingMetadataComplete() { - return this.getPersistenceUnit().isXmlMappingMetadataComplete(); - } - - - // ********** persistence unit metadata ********** - - public OrmPersistenceUnitMetadata getPersistenceUnitMetadata() { - return this.persistenceUnitMetadata; - } - - protected OrmPersistenceUnitMetadata buildPersistenceUnitMetadata() { - return this.getContextNodeFactory().buildOrmPersistenceUnitMetadata(this); - } - - - // ********** misc ********** - - public XmlEntityMappings getXmlEntityMappings() { - return this.xmlEntityMappings; - } - - public String getVersion() { - return this.xmlEntityMappings.getVersion(); - } - - public void changeMapping(OrmPersistentType ormPersistentType, OrmTypeMapping oldMapping, OrmTypeMapping newMapping) { - AccessType savedAccess = ormPersistentType.getSpecifiedAccess(); - int sourceIndex = this.persistentTypes.indexOf(ormPersistentType); - this.persistentTypes.remove(sourceIndex); - oldMapping.removeXmlTypeMappingFrom(this.xmlEntityMappings); - int targetIndex = this.calculateInsertionIndex(ormPersistentType); - this.persistentTypes.add(targetIndex, ormPersistentType); - newMapping.addXmlTypeMappingTo(this.xmlEntityMappings); - - newMapping.initializeFrom(oldMapping); - //not sure where else to put this, need to set the access on the resource model - ormPersistentType.setSpecifiedAccess(savedAccess); - this.fireItemMoved(PERSISTENT_TYPES_LIST, targetIndex, sourceIndex); - } - - public TextRange getValidationTextRange() { - return null; - } - - public boolean containsOffset(int textOffset) { - return (this.xmlEntityMappings != null) && this.xmlEntityMappings.containsOffset(textOffset); - } - - - // ********** description ********** - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.setDescription_(description); - this.xmlEntityMappings.setDescription(description); - } - - protected void setDescription_(String description) { - String old = this.description; - this.description = description; - this.firePropertyChanged(DESCRIPTION_PROPERTY, old, description); - } - - - // ********** package ********** - - public String getPackage() { - return this.package_; - } - - public void setPackage(String package_) { - this.setPackage_(package_); - this.xmlEntityMappings.setPackage(package_); - } - - /** - * TODO If the package changes, we should probably clear out all resolved - * references to persistent types:
    - *
  • {@link OrmIdClassReference#getIdClass()} - *
  • {@link OrmPersistentType#getJavaPersistentType()} - *
- */ - protected void setPackage_(String package_) { - String old = this.package_; - this.package_ = package_; - this.firePropertyChanged(PACKAGE_PROPERTY, old, package_); - } - - - // ********** access ********** - - public AccessType getAccess() { - return (this.specifiedAccess != null) ? this.specifiedAccess : this.defaultAccess; - } - - public AccessType getSpecifiedAccess() { - return this.specifiedAccess; - } - - public void setSpecifiedAccess(AccessType access) { - this.setSpecifiedAccess_(access); - this.xmlEntityMappings.setAccess(AccessType.toOrmResourceModel(access)); - } - - protected void setSpecifiedAccess_(AccessType access) { - AccessType old = this.specifiedAccess; - this.specifiedAccess = access; - this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, access); - } - - protected AccessType buildSpecifiedAccess() { - return AccessType.fromOrmResourceModel(this.xmlEntityMappings.getAccess()); - } - - public AccessType getDefaultAccess() { - return this.defaultAccess; - } - - protected void setDefaultAccess(AccessType access) { - AccessType old = this.defaultAccess; - this.defaultAccess = access; - this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, access); - } - - protected AccessType buildDefaultAccess() { - return this.getPersistenceUnit().getDefaultAccess(); - } - - - // ********** catalog ********** - - public String getCatalog() { - return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog; - } - - public String getSpecifiedCatalog() { - return this.specifiedCatalog; - } - - public void setSpecifiedCatalog(String catalog) { - this.setSpecifiedCatalog_(catalog); - this.xmlEntityMappings.setCatalog(catalog); - } - - protected void setSpecifiedCatalog_(String catalog) { - String old = this.specifiedCatalog; - this.specifiedCatalog = catalog; - this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog); - } - - public String getDefaultCatalog() { - return this.defaultCatalog; - } - - protected void setDefaultCatalog(String catalog) { - String old = this.defaultCatalog; - this.defaultCatalog = catalog; - this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog); - } - - protected String buildDefaultCatalog() { - return this.getPersistenceUnit().getDefaultCatalog(); - } - - /** - * If we don't have a catalog (i.e. we don't even have a default - * catalog), then the database probably does not support catalogs. - */ - public Catalog getDbCatalog() { - String catalog = this.getCatalog(); - return (catalog == null) ? null : this.resolveDbCatalog(catalog); - } - - - // ********** schema ********** - - public String getSchema() { - return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema; - } - - public String getSpecifiedSchema() { - return this.specifiedSchema; - } - - public void setSpecifiedSchema(String schema) { - this.setSpecifiedSchema_(schema); - this.xmlEntityMappings.setSchema(schema); - } - - protected void setSpecifiedSchema_(String schema) { - String old = this.specifiedSchema; - this.specifiedSchema = schema; - this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema); - } - - public String getDefaultSchema() { - return this.defaultSchema; - } - - protected void setDefaultSchema(String schema) { - String old = this.defaultSchema; - this.defaultSchema = schema; - this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema); - } - - protected String buildDefaultSchema() { - return this.getPersistenceUnit().getDefaultSchema(); - } - - public Schema getDbSchema() { - SchemaContainer dbSchemaContainer = this.getDbSchemaContainer(); - return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema()); - } - - - // ********** schema container ********** - - /** - * If we don't have a catalog (i.e. we don't even have a default catalog), - * then the database probably does not support catalogs; and we need to - * get the schema directly from the database. - */ - public SchemaContainer getDbSchemaContainer() { - String catalog = this.getCatalog(); - return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase(); - } - - - // ********** persistent types ********** - - public ListIterable getPersistentTypes() { - return new LiveCloneListIterable(this.persistentTypes); - } - - public int getPersistentTypesSize() { - return this.persistentTypes.size(); - } - - public OrmPersistentType getPersistentType(String className) { - for (OrmPersistentType ormPersistentType : this.getPersistentTypes()) { - if (ormPersistentType.isFor(className)) { - return ormPersistentType; - } - } - return null; - } - - public boolean containsPersistentType(String className) { - return this.getPersistentType(className) != null; - } - - public PersistentType resolvePersistentType(String className) { - return (PersistentType) this.resolvePersistentType(PERSISTENT_TYPE_LOOKUP_ADAPTER, className); - } - - public JavaResourcePersistentType resolveJavaResourcePersistentType(String className) { - return (JavaResourcePersistentType) this.resolvePersistentType(RESOURCE_PERSISTENT_TYPE_LOOKUP_ADAPTER, className); - } - - protected Object resolvePersistentType(PersistentTypeLookupAdapter adapter, String className) { - if (className == null) { - return null; - } - - // static inner class listed in orm.xml will use '$', replace with '.' - className = className.replace('$', '.'); - - // first try to resolve using only the locally specified name... - Object persistentType = adapter.resolvePersistentType(this, className); - if (persistentType != null) { - return persistentType; - } - - // ...then try to resolve by prepending the global package name - if (this.getPackage() == null) { - return null; - } - return adapter.resolvePersistentType(this, this.getPackage() + '.' + className); - } - - protected interface PersistentTypeLookupAdapter { - Object resolvePersistentType(EntityMappings entityMappings, String className); - } - - protected static final PersistentTypeLookupAdapter PERSISTENT_TYPE_LOOKUP_ADAPTER = - new PersistentTypeLookupAdapter() { - public Object resolvePersistentType(EntityMappings entityMappings, String className) { - return entityMappings.getPersistenceUnit().getPersistentType(className); - } - }; - - protected static final PersistentTypeLookupAdapter RESOURCE_PERSISTENT_TYPE_LOOKUP_ADAPTER = - new PersistentTypeLookupAdapter() { - public Object resolvePersistentType(EntityMappings entityMappings, String className) { - return entityMappings.getJpaProject().getJavaResourcePersistentType(className); - } - }; - - /** - * We have to calculate the new persistent type's index. - * We will use the type's short name if the entity mappings's - * package is the same as the type's package. - */ - public OrmPersistentType addPersistentType(String mappingKey, String className) { - OrmTypeMappingDefinition md = this.getMappingFileDefinition().getTypeMappingDefinition(mappingKey); - XmlTypeMapping xmlTypeMapping = md.buildResourceMapping(this.getResourceNodeFactory()); - OrmPersistentType persistentType = this.buildPersistentType(xmlTypeMapping); - int index = this.calculateInsertionIndex(persistentType); - this.addItemToList(index, persistentType, this.persistentTypes, PERSISTENT_TYPES_LIST); - - persistentType.getMapping().addXmlTypeMappingTo(this.xmlEntityMappings); - - // adds short name if package name is relevant - className = this.normalizeClassName(className); - persistentType.getMapping().setClass(className); - - return persistentType; - } - - /** - * Shorten the specified class name if it is in the entity mappings's package. - */ - protected String normalizeClassName(String className) { - return ((this.package_ != null) && - className.startsWith(this.package_) && - (className.charAt(this.package_.length()) == '.')) ? - className.substring(this.package_.length() + 1) : - className; - } - - protected OrmPersistentType buildPersistentType(XmlTypeMapping xmlTypeMapping) { - return this.getContextNodeFactory().buildOrmPersistentType(this, xmlTypeMapping); - } - - protected int calculateInsertionIndex(OrmPersistentType ormPersistentType) { - return CollectionTools.insertionIndexOf(this.persistentTypes, ormPersistentType, MAPPING_COMPARATOR); - } - - protected static final Comparator MAPPING_COMPARATOR = - new Comparator() { - public int compare(OrmPersistentType o1, OrmPersistentType o2) { - int o1Sequence = o1.getMapping().getXmlSequence(); - int o2Sequence = o2.getMapping().getXmlSequence(); - if (o1Sequence < o2Sequence) { - return -1; - } - if (o1Sequence == o2Sequence) { - return 0; - } - return 1; - } - }; - - public void removePersistentType(int index) { - OrmPersistentType persistentType = this.removePersistentType_(index); - persistentType.getMapping().removeXmlTypeMappingFrom(this.xmlEntityMappings); - } - - /** - * dispose and return the persistent type - */ - protected OrmPersistentType removePersistentType_(int index) { - OrmPersistentType persistentType = this.removeItemFromList(index, this.persistentTypes, PERSISTENT_TYPES_LIST); - persistentType.dispose(); - return persistentType; - } - - public void removePersistentType(OrmPersistentType persistentType) { - this.removePersistentType(this.persistentTypes.indexOf(persistentType)); - } - - protected void initializePersistentTypes() { - for (XmlTypeMapping xmlTypeMapping : this.getXmlTypeMappings()) { - this.persistentTypes.add(this.buildPersistentType(xmlTypeMapping)); - } - } - - protected void syncPersistentTypes() { - ContextContainerTools.synchronizeWithResourceModel(this.persistentTypeContainerAdapter); - } - - protected Iterable getXmlTypeMappings() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.xmlEntityMappings.getTypeMappings()); - } - - protected void movePersistentType_(int index, OrmPersistentType persistentType) { - this.moveItemInList(index, persistentType, this.persistentTypes, PERSISTENT_TYPES_LIST); - } - - protected void addPersistentType_(int index, XmlTypeMapping xmlTypeMapping) { - this.addItemToList(index, this.buildPersistentType(xmlTypeMapping), this.persistentTypes, PERSISTENT_TYPES_LIST); - } - - protected void removePersistentType_(OrmPersistentType persistentType) { - this.removePersistentType_(this.persistentTypes.indexOf(persistentType)); - } - - /** - * persistent type container adapter - */ - protected class PersistentTypeContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractEntityMappings.this.getPersistentTypes(); - } - public Iterable getResourceElements() { - return AbstractEntityMappings.this.getXmlTypeMappings(); - } - public XmlTypeMapping getResourceElement(OrmPersistentType contextElement) { - return contextElement.getMapping().getXmlTypeMapping(); - } - public void moveContextElement(int index, OrmPersistentType element) { - AbstractEntityMappings.this.movePersistentType_(index, element); - } - public void addContextElement(int index, XmlTypeMapping resourceElement) { - AbstractEntityMappings.this.addPersistentType_(index, resourceElement); - } - public void removeContextElement(OrmPersistentType element) { - AbstractEntityMappings.this.removePersistentType_(element); - } - } - - - // ********** sequence generators ********** - - public ListIterable getSequenceGenerators() { - return new LiveCloneListIterable(this.sequenceGenerators); - } - - public int getSequenceGeneratorsSize() { - return this.sequenceGenerators.size(); - } - - public OrmSequenceGenerator addSequenceGenerator() { - return this.addSequenceGenerator(this.sequenceGenerators.size()); - } - - public OrmSequenceGenerator addSequenceGenerator(int index) { - XmlSequenceGenerator xmlGenerator = this.buildXmlSequenceGenerator(); - OrmSequenceGenerator sequenceGenerator = this.addSequenceGenerator_(index, xmlGenerator); - this.xmlEntityMappings.getSequenceGenerators().add(index, xmlGenerator); - return sequenceGenerator; - } - - protected XmlSequenceGenerator buildXmlSequenceGenerator() { - return OrmFactory.eINSTANCE.createXmlSequenceGenerator(); - } - - protected OrmSequenceGenerator buildSequenceGenerator(XmlSequenceGenerator xmlSequenceGenerator) { - return this.getContextNodeFactory().buildOrmSequenceGenerator(this, xmlSequenceGenerator); - } - - public void removeSequenceGenerator(OrmSequenceGenerator sequenceGenerator) { - this.removeSequenceGenerator(this.sequenceGenerators.indexOf(sequenceGenerator)); - } - - public void removeSequenceGenerator(int index) { - this.removeSequenceGenerator_(index); - this.xmlEntityMappings.getSequenceGenerators().remove(index); - } - - protected void removeSequenceGenerator_(int index) { - this.removeItemFromList(index, this.sequenceGenerators, SEQUENCE_GENERATORS_LIST); - } - - public void moveSequenceGenerator(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.sequenceGenerators, SEQUENCE_GENERATORS_LIST); - this.xmlEntityMappings.getSequenceGenerators().move(targetIndex, sourceIndex); - } - - protected void initializeSequenceGenerators() { - for (XmlSequenceGenerator sequenceGenerator : this.getXmlSequenceGenerators()) { - this.sequenceGenerators.add(this.buildSequenceGenerator(sequenceGenerator)); - } - } - - protected void syncSequenceGenerators() { - ContextContainerTools.synchronizeWithResourceModel(this.sequenceGeneratorContainerAdapter); - } - - protected Iterable getXmlSequenceGenerators() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.xmlEntityMappings.getSequenceGenerators()); - } - - protected void moveSequenceGenerator_(int index, OrmSequenceGenerator sequenceGenerator) { - this.moveItemInList(index, sequenceGenerator, this.sequenceGenerators, SEQUENCE_GENERATORS_LIST); - } - - protected OrmSequenceGenerator addSequenceGenerator_(int index, XmlSequenceGenerator xmlSequenceGenerator) { - OrmSequenceGenerator sequenceGenerator = this.buildSequenceGenerator(xmlSequenceGenerator); - this.addItemToList(index, sequenceGenerator, this.sequenceGenerators, SEQUENCE_GENERATORS_LIST); - return sequenceGenerator; - } - - protected void removeSequenceGenerator_(OrmSequenceGenerator sequenceGenerator) { - this.removeSequenceGenerator_(this.sequenceGenerators.indexOf(sequenceGenerator)); - } - - /** - * sequence generator container adapter - */ - protected class SequenceGeneratorContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractEntityMappings.this.getSequenceGenerators(); - } - public Iterable getResourceElements() { - return AbstractEntityMappings.this.getXmlSequenceGenerators(); - } - public XmlSequenceGenerator getResourceElement(OrmSequenceGenerator contextElement) { - return contextElement.getXmlGenerator(); - } - public void moveContextElement(int index, OrmSequenceGenerator element) { - AbstractEntityMappings.this.moveSequenceGenerator_(index, element); - } - public void addContextElement(int index, XmlSequenceGenerator resourceElement) { - AbstractEntityMappings.this.addSequenceGenerator_(index, resourceElement); - } - public void removeContextElement(OrmSequenceGenerator element) { - AbstractEntityMappings.this.removeSequenceGenerator_(element); - } - } - - - // ********** table generators ********** - - public ListIterable getTableGenerators() { - return new LiveCloneListIterable(this.tableGenerators); - } - - public int getTableGeneratorsSize() { - return this.tableGenerators.size(); - } - - public OrmTableGenerator addTableGenerator() { - return this.addTableGenerator(this.tableGenerators.size()); - } - - public OrmTableGenerator addTableGenerator(int index) { - XmlTableGenerator xmlTableGenerator = this.buildXmlTableGenerator(); - OrmTableGenerator tableGenerator = this.addTableGenerator_(index, xmlTableGenerator); - this.xmlEntityMappings.getTableGenerators().add(index, xmlTableGenerator); - return tableGenerator; - } - - protected XmlTableGenerator buildXmlTableGenerator() { - return OrmFactory.eINSTANCE.createXmlTableGenerator(); - } - - protected OrmTableGenerator buildTableGenerator(XmlTableGenerator xmlTableGenerator) { - return this.getContextNodeFactory().buildOrmTableGenerator(this, xmlTableGenerator); - } - - public void removeTableGenerator(OrmTableGenerator tableGenerator) { - this.removeTableGenerator(this.tableGenerators.indexOf(tableGenerator)); - } - - public void removeTableGenerator(int index) { - this.removeTableGenerator_(index); - this.xmlEntityMappings.getTableGenerators().remove(index); - } - - protected void removeTableGenerator_(int index) { - this.removeItemFromList(index, this.tableGenerators, TABLE_GENERATORS_LIST); - } - - public void moveTableGenerator(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.tableGenerators, TABLE_GENERATORS_LIST); - this.xmlEntityMappings.getTableGenerators().move(targetIndex, sourceIndex); - } - - protected void initializeTableGenerators() { - for (XmlTableGenerator tableGenerator : this.getXmlTableGenerators()) { - this.tableGenerators.add(this.buildTableGenerator(tableGenerator)); - } - } - - protected void syncTableGenerators() { - ContextContainerTools.synchronizeWithResourceModel(this.tableGeneratorContainerAdapter); - } - - protected Iterable getXmlTableGenerators() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.xmlEntityMappings.getTableGenerators()); - } - - protected void moveTableGenerator_(int index, OrmTableGenerator tableGenerator) { - this.moveItemInList(index, tableGenerator, this.tableGenerators, TABLE_GENERATORS_LIST); - } - - protected OrmTableGenerator addTableGenerator_(int index, XmlTableGenerator xmlTableGenerator) { - OrmTableGenerator tableGenerator = this.buildTableGenerator(xmlTableGenerator); - this.addItemToList(index, tableGenerator, this.tableGenerators, TABLE_GENERATORS_LIST); - return tableGenerator; - } - - protected void removeTableGenerator_(OrmTableGenerator tableGenerator) { - this.removeTableGenerator_(this.tableGenerators.indexOf(tableGenerator)); - } - - /** - * table generator container adapter - */ - protected class TableGeneratorContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractEntityMappings.this.getTableGenerators(); - } - public Iterable getResourceElements() { - return AbstractEntityMappings.this.getXmlTableGenerators(); - } - public XmlTableGenerator getResourceElement(OrmTableGenerator contextElement) { - return contextElement.getXmlGenerator(); - } - public void moveContextElement(int index, OrmTableGenerator element) { - AbstractEntityMappings.this.moveTableGenerator_(index, element); - } - public void addContextElement(int index, XmlTableGenerator resourceElement) { - AbstractEntityMappings.this.addTableGenerator_(index, resourceElement); - } - public void removeContextElement(OrmTableGenerator element) { - AbstractEntityMappings.this.removeTableGenerator_(element); - } - } - - - // ********** query container ********** - - public OrmQueryContainer getQueryContainer() { - return this.queryContainer; - } - - protected OrmQueryContainer buildQueryContainer() { - return this.getContextNodeFactory().buildOrmQueryContainer(this, this.xmlEntityMappings); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateVersion(messages); - this.validateGenerators(messages); - this.queryContainer.validate(messages, reporter); - for (OrmPersistentType ormPersistentType : this.getPersistentTypes()) { - this.validatePersistentType(ormPersistentType, messages, reporter); - } - } - - protected void validateVersion(List messages) { - if (! this.getLatestDocumentVersion().equals(this.xmlEntityMappings.getVersion())) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.LOW_SEVERITY, - JpaValidationMessages.XML_VERSION_NOT_LATEST, - this, - this.xmlEntityMappings.getVersionTextRange() - ) - ); - } - } - - /** - * Return the latest version of the document supported by the platform - */ - protected String getLatestDocumentVersion() { - return this.getJpaPlatform().getMostRecentSupportedResourceType(this.getContentType()).getVersion(); - } - - protected IContentType getContentType() { - return JptJpaCorePlugin.ORM_XML_CONTENT_TYPE; - } - - protected void validateGenerators(List messages) { - for (OrmGenerator localGenerator : this.getGenerators()) { - String name = localGenerator.getName(); - if (StringTools.stringIsEmpty(name)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.GENERATOR_NAME_UNDEFINED, - new String[] {}, - localGenerator, - localGenerator.getNameTextRange() - )); - } else { - List reportedNames = new ArrayList(); - for (Iterator globalGenerators = this.getPersistenceUnit().generators(); globalGenerators.hasNext(); ) { - if (localGenerator.duplicates(globalGenerators.next()) && !reportedNames.contains(name)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.GENERATOR_DUPLICATE_NAME, - new String[] {localGenerator.getName()}, - localGenerator, - localGenerator.getNameTextRange() - ) - ); - reportedNames.add(name); - } - } - } - } - } - - /** - * Return all the generators, table and sequence. - */ - @SuppressWarnings("unchecked") - protected Iterable getGenerators() { - return new CompositeIterable( - this.getTableGenerators(), - this.getSequenceGenerators() - ); - } - - - protected void validatePersistentType(OrmPersistentType persistentType, List messages, IReporter reporter) { - try { - persistentType.validate(messages, reporter); - } catch (Throwable exception) { - JptJpaCorePlugin.log(exception); - } - } - - - // ********** refactoring ********** - - public Iterable createDeleteTypeEdits(final IType type) { - return new CompositeIterable( - new TransformationIterable>(this.getPersistentTypes()) { - @Override - protected Iterable transform(OrmPersistentType persistentType) { - return persistentType.createDeleteTypeEdits(type); - } - } - ); - } - - public Iterable createRenameTypeEdits(final IType originalType, final String newName) { - return new CompositeIterable( - new TransformationIterable>(this.getPersistentTypes()) { - @Override - protected Iterable transform(OrmPersistentType persistentType) { - return persistentType.createRenameTypeEdits(originalType, newName); - } - } - ); - } - - public Iterable createMoveTypeEdits(final IType originalType, final IPackageFragment newPackage) { - return new CompositeIterable( - new TransformationIterable>(this.getPersistentTypes()) { - @Override - protected Iterable transform(OrmPersistentType persistentType) { - return persistentType.createMoveTypeEdits(originalType, newPackage); - } - } - ); - } - - @SuppressWarnings("unchecked") - public Iterable createRenamePackageEdits(final IPackageFragment originalPackage, final String newName) { - return new CompositeIterable( - this.createPersistentTypeRenamePackageEdits(originalPackage, newName), - this.createRenamePackageEdit(originalPackage, newName)); - } - - protected Iterable createPersistentTypeRenamePackageEdits(final IPackageFragment originalPackage, final String newName) { - return new CompositeIterable( - new TransformationIterable>(this.getPersistentTypes()) { - @Override - protected Iterable transform(OrmPersistentType persistentType) { - return persistentType.createRenamePackageEdits(originalPackage, newName); - } - } - ); - } - - protected Iterable createRenamePackageEdit(final IPackageFragment originalPackage, final String newName) { - return Tools.valuesAreEqual(this.package_, originalPackage.getElementName()) ? - new SingleElementIterable(this.xmlEntityMappings.createRenamePackageEdit(newName)) : - EmptyIterable.instance(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java deleted file mode 100644 index 0c05faba25..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmAttributeMapping.java +++ /dev/null @@ -1,419 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.SingleElementIterator; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.ColumnMapping; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmBaseEmbeddedMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmBasicMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmColumnMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedIdMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmIdMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmManyToOneMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmMultiRelationshipMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmOneToManyMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmOneToOneMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmSingleRelationshipMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmTransientMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmVersionMapping; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.SimpleMetamodelField; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.AttributeMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentAttribute2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class AbstractOrmAttributeMapping - extends AbstractOrmXmlContextNode - implements OrmAttributeMapping, AttributeMapping2_0 -{ - protected final X xmlAttributeMapping; - - protected String name; - - - protected AbstractOrmAttributeMapping(OrmPersistentAttribute parent, X xmlAttributeMapping) { - super(parent); - this.xmlAttributeMapping = xmlAttributeMapping; - this.name = xmlAttributeMapping.getName(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setName_(this.xmlAttributeMapping.getName()); - } - - - // ********** name ********** - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.setName_(name); - this.xmlAttributeMapping.setName(name); - } - - protected void setName_(String name) { - String old = this.name; - this.name = name; - if (this.firePropertyChanged(NAME_PROPERTY, old, name)) { - // tell our attribute its name has, effectively, changed - this.getPersistentAttribute().nameChanged(old, name); - } - } - - - // ********** morphing mappings ********** - - public void initializeFromOrmAttributeMapping(OrmAttributeMapping oldMapping) { - this.setName(oldMapping.getName()); - } - - protected void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) { - this.initializeFromOrmAttributeMapping(oldMapping); - } - - public void initializeFromOrmBasicMapping(OrmBasicMapping oldMapping) { - this.initializeFromOrmColumnMapping(oldMapping); - } - - public void initializeFromOrmIdMapping(OrmIdMapping oldMapping) { - this.initializeFromOrmColumnMapping(oldMapping); - } - - public void initializeFromOrmTransientMapping(OrmTransientMapping oldMapping) { - this.initializeFromOrmAttributeMapping(oldMapping); - } - - protected void initializeFromOrmBaseEmbeddedMapping(OrmBaseEmbeddedMapping oldMapping) { - this.initializeFromOrmAttributeMapping(oldMapping); - } - - public void initializeFromOrmEmbeddedMapping(OrmEmbeddedMapping oldMapping) { - this.initializeFromOrmBaseEmbeddedMapping(oldMapping); - } - - public void initializeFromOrmEmbeddedIdMapping(OrmEmbeddedIdMapping oldMapping) { - this.initializeFromOrmBaseEmbeddedMapping(oldMapping); - } - - public void initializeFromOrmVersionMapping(OrmVersionMapping oldMapping) { - this.initializeFromOrmColumnMapping(oldMapping); - } - - protected void initializeFromOrmRelationshipMapping(OrmRelationshipMapping oldMapping) { - this.initializeFromOrmAttributeMapping(oldMapping); - } - - protected void initializeFromOrmMultiRelationshipMapping(OrmMultiRelationshipMapping oldMapping) { - this.initializeFromOrmRelationshipMapping(oldMapping); - } - - protected void initializeFromOrmSingleRelationshipMapping(OrmSingleRelationshipMapping oldMapping) { - this.initializeFromOrmRelationshipMapping(oldMapping); - } - - public void initializeFromOrmOneToManyMapping(OrmOneToManyMapping oldMapping) { - this.initializeFromOrmMultiRelationshipMapping(oldMapping); - } - - public void initializeFromOrmManyToOneMapping(OrmManyToOneMapping oldMapping) { - this.initializeFromOrmSingleRelationshipMapping(oldMapping); - } - - public void initializeFromOrmOneToOneMapping(OrmOneToOneMapping oldMapping) { - this.initializeFromOrmSingleRelationshipMapping(oldMapping); - } - - public void initializeFromOrmManyToManyMapping(OrmManyToManyMapping oldMapping) { - this.initializeFromOrmMultiRelationshipMapping(oldMapping); - } - - - // ********** misc ********** - - public X getXmlAttributeMapping() { - return this.xmlAttributeMapping; - } - - @Override - public OrmPersistentAttribute getParent() { - return (OrmPersistentAttribute) super.getParent(); - } - - public OrmPersistentAttribute getPersistentAttribute() { - return this.getParent(); - } - - public OrmTypeMapping getTypeMapping() { - return this.getPersistentAttribute().getOwningTypeMapping(); - } - - protected JavaPersistentAttribute getJavaPersistentAttribute() { - return this.getPersistentAttribute().getJavaPersistentAttribute(); - } - - // TODO remove this method - it will always return false... - // subclass member classes like this method - public boolean isVirtual() { - return false; - } - - protected EntityMappings getEntityMappings() { - return this.getPersistentAttribute().getOwningPersistentType().getParent(); - } - - protected PersistentType resolvePersistentType(String className) { - return this.getEntityMappings().resolvePersistentType(className); - } - - public boolean isDefault() { - return false; - } - - public String getPrimaryKeyColumnName() { - return null; - } - - public boolean isOverridableAttributeMapping() { - return false; - } - - public boolean isOverridableAssociationMapping() { - return false; - } - - public boolean isRelationshipOwner() { - return false; - } - - public boolean isOwnedBy(AttributeMapping mapping) { - return false; - } - - public boolean validatesAgainstDatabase() { - return this.getTypeMapping().validatesAgainstDatabase(); - } - - public boolean contains(int textOffset) { - return this.xmlAttributeMapping.containsOffset(textOffset); - } - - public TextRange getSelectionTextRange() { - return this.xmlAttributeMapping.getSelectionTextRange(); - } - - public TextRange getValidationTextRange() { - return this.xmlAttributeMapping.getValidationTextRange(); - } - - public TextRange getNameTextRange() { - return this.xmlAttributeMapping.getNameTextRange(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** embedded mappings ********** - - public Iterator allMappingNames() { - return (this.name != null) ? - new SingleElementIterator(this.name) : - EmptyIterator.instance(); - } - - public Iterator allOverridableAttributeMappingNames() { - return ((this.name != null) && this.isOverridableAttributeMapping()) ? - new SingleElementIterator(this.name) : - EmptyIterator.instance(); - } - - public Iterator allOverridableAssociationMappingNames() { - return ((this.name != null) && this.isOverridableAssociationMapping()) ? - new SingleElementIterator(this.name) : - EmptyIterator.instance(); - } - - public Column resolveOverriddenColumn(String attributeName) { - ColumnMapping mapping = this.resolveColumnMapping(attributeName); - return (mapping == null) ? null : mapping.getColumn(); - } - - protected ColumnMapping resolveColumnMapping(String attributeName) { - AttributeMapping mapping = this.resolveAttributeMapping(attributeName); - return ((mapping != null) && mapping.isOverridableAttributeMapping()) ? (ColumnMapping) mapping : null; - } - - public Relationship resolveOverriddenRelationship(String attributeName) { - RelationshipMapping mapping = this.resolveRelationshipMapping(attributeName); - return (mapping == null) ? null : mapping.getRelationship(); - } - - protected RelationshipMapping resolveRelationshipMapping(String attributeName) { - AttributeMapping mapping = this.resolveAttributeMapping(attributeName); - return ((mapping != null) && mapping.isOverridableAssociationMapping()) ? - (RelationshipMapping) mapping : - null; - } - - public AttributeMapping resolveAttributeMapping(String attributeName) { - return Tools.valuesAreEqual(attributeName, this.name) ? this : null; - } - - protected Transformer buildQualifierTransformer() { - return new MappingTools.QualifierTransformer(this.name); - } - - protected String unqualify(String attributeName) { - return MappingTools.unqualify(this.name, attributeName); - } - - - // ********** metamodel ********** - - public MetamodelField getMetamodelField() { - // if we don't have a name we can't build a metamodel field... - String metamodelFieldName = this.getMetamodelFieldName(); - return (metamodelFieldName == null) ? null : - new SimpleMetamodelField( - this.getMetamodelFieldModifiers(), - this.getMetamodelFieldTypeName(), - this.getMetamodelFieldTypeArgumentNames(), - metamodelFieldName - ); - } - - protected Iterable getMetamodelFieldModifiers() { - return STANDARD_METAMODEL_FIELD_MODIFIERS; - } - - /** - * most mappings are "singular" - */ - protected String getMetamodelFieldTypeName() { - return JPA2_0.SINGULAR_ATTRIBUTE; - } - - protected final Iterable getMetamodelFieldTypeArgumentNames() { - ArrayList typeArgumentNames = new ArrayList(3); - typeArgumentNames.add(this.getTypeMapping().getPersistentType().getName()); - this.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames); - return typeArgumentNames; - } - - /** - * by default, we add only the mapping's attribute type name; - * but collection relationship mappings will also need to add the key type - * name if the "collection" is of type java.util.Map - */ - protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList typeArgumentNames) { - typeArgumentNames.add(this.getMetamodelTypeName()); - } - - public String getMetamodelTypeName() { - return ((OrmPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelTypeName(); - } - - protected String getMetamodelFieldName() { - return this.name; - } - - - // ********** refactoring ********** - - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return EmptyIterable.instance(); - } - - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return EmptyIterable.instance(); - } - - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return EmptyIterable.instance(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateAttribute(messages); - this.validateMapping(messages); - } - - protected void validateAttribute(List messages) { - if (StringTools.stringIsEmpty(this.name)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENT_ATTRIBUTE_UNSPECIFIED_NAME, - this, - this.getValidationTextRange() - ) - ); - } - } - - //TODO validation message - i think more info is needed in this message. include type mapping type? - protected void validateMapping(List messages) { - if ( ! this.getTypeMapping().attributeMappingKeyAllowed(this.getKey())) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENT_ATTRIBUTE_INVALID_MAPPING, - new String[] {this.name}, - this, - this.getValidationTextRange() - ) - ); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseColumn.java deleted file mode 100644 index 75782eb2f6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseColumn.java +++ /dev/null @@ -1,302 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Iterator; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseColumn; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmBaseColumn; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlColumn; - -/** - * orm.xml column or join column - */ -public abstract class AbstractOrmBaseColumn - extends AbstractOrmNamedColumn - implements OrmBaseColumn -{ - protected String specifiedTable; - protected String defaultTable; - - // TODO defaults from java for all of these settings - protected Boolean specifiedUnique; - - protected Boolean specifiedNullable; - - protected Boolean specifiedInsertable; - - protected Boolean specifiedUpdatable; - - - // ********** constructor/initialization ********** - - protected AbstractOrmBaseColumn(XmlContextNode parent, O owner) { - this(parent, owner, null); - } - - protected AbstractOrmBaseColumn(XmlContextNode parent, O owner, X xmlColumn) { - super(parent, owner, xmlColumn); - this.specifiedTable = this.buildSpecifiedTable(); - this.specifiedUnique = this.buildSpecifiedUnique(); - this.specifiedNullable = this.buildSpecifiedNullable(); - this.specifiedInsertable = this.buildSpecifiedInsertable(); - this.specifiedUpdatable = this.buildSpecifiedUpdatable(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedTable_(this.buildSpecifiedTable()); - this.setSpecifiedUnique_(this.buildSpecifiedUnique()); - this.setSpecifiedNullable_(this.buildSpecifiedNullable()); - this.setSpecifiedInsertable_(this.buildSpecifiedInsertable()); - this.setSpecifiedUpdatable_(this.buildSpecifiedUpdatable()); - } - - @Override - public void update() { - super.update(); - this.setDefaultTable(this.buildDefaultTable()); - } - - - // ********** table ********** - - @Override - public String getTable() { - return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable; - } - - public String getSpecifiedTable() { - return this.specifiedTable; - } - - public void setSpecifiedTable(String table) { - if (this.valuesAreDifferent(this.specifiedTable, table)) { - X xmlColumn = this.getXmlColumnForUpdate(); - this.setSpecifiedTable_(table); - xmlColumn.setTable(table); - this.removeXmlColumnIfUnset(); - } - } - - protected void setSpecifiedTable_(String table) { - String old = this.specifiedTable; - this.specifiedTable = table; - this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table); - } - - protected String buildSpecifiedTable() { - X xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getTable(); - } - - public String getDefaultTable() { - return this.defaultTable; - } - - protected void setDefaultTable(String table) { - String old = this.defaultTable; - this.defaultTable = table; - this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table); - } - - protected String buildDefaultTable() { - return this.owner.getDefaultTableName(); - } - - - // ********** unique ********** - - public boolean isUnique() { - return (this.specifiedUnique != null) ? this.specifiedUnique.booleanValue() : this.isDefaultUnique(); - } - - public Boolean getSpecifiedUnique() { - return this.specifiedUnique; - } - - public void setSpecifiedUnique(Boolean unique) { - if (this.valuesAreDifferent(this.specifiedUnique, unique)) { - X xmlColumn = this.getXmlColumnForUpdate(); - this.setSpecifiedUnique_(unique); - xmlColumn.setUnique(unique); - this.removeXmlColumnIfUnset(); - } - } - - protected void setSpecifiedUnique_(Boolean unique) { - Boolean old = this.specifiedUnique; - this.specifiedUnique = unique; - this.firePropertyChanged(SPECIFIED_UNIQUE_PROPERTY, old, unique); - } - - protected Boolean buildSpecifiedUnique() { - X xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getUnique(); - } - - public boolean isDefaultUnique() { - return DEFAULT_UNIQUE; - } - - - // ********** nullable ********** - - public boolean isNullable() { - return (this.specifiedNullable != null) ? this.specifiedNullable.booleanValue() : this.isDefaultNullable(); - } - - public Boolean getSpecifiedNullable() { - return this.specifiedNullable; - } - - public void setSpecifiedNullable(Boolean nullable) { - if (this.valuesAreDifferent(this.specifiedNullable, nullable)) { - X xmlColumn = this.getXmlColumnForUpdate(); - this.setSpecifiedNullable_(nullable); - xmlColumn.setNullable(nullable); - this.removeXmlColumnIfUnset(); - } - } - - protected void setSpecifiedNullable_(Boolean nullable) { - Boolean old = this.specifiedNullable; - this.specifiedNullable = nullable; - this.firePropertyChanged(SPECIFIED_NULLABLE_PROPERTY, old, nullable); - } - - protected Boolean buildSpecifiedNullable() { - X xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getNullable(); - } - - public boolean isDefaultNullable() { - return DEFAULT_NULLABLE; - } - - - // ********** insertable ********** - - public boolean isInsertable() { - return (this.specifiedInsertable != null) ? this.specifiedInsertable.booleanValue() : this.isDefaultInsertable(); - } - - public Boolean getSpecifiedInsertable() { - return this.specifiedInsertable; - } - - public void setSpecifiedInsertable(Boolean insertable) { - if (this.valuesAreDifferent(this.specifiedInsertable, insertable)) { - X xmlColumn = this.getXmlColumnForUpdate(); - this.setSpecifiedInsertable_(insertable); - xmlColumn.setInsertable(insertable); - this.removeXmlColumnIfUnset(); - } - } - - protected void setSpecifiedInsertable_(Boolean insertable) { - Boolean old = this.specifiedInsertable; - this.specifiedInsertable = insertable; - this.firePropertyChanged(SPECIFIED_INSERTABLE_PROPERTY, old, insertable); - } - - protected Boolean buildSpecifiedInsertable() { - X xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getInsertable(); - } - - public boolean isDefaultInsertable() { - return DEFAULT_INSERTABLE; - } - - - // ********** updatable ********** - - public boolean isUpdatable() { - return (this.specifiedUpdatable != null) ? this.specifiedUpdatable.booleanValue() : this.isDefaultUpdatable(); - } - - public Boolean getSpecifiedUpdatable() { - return this.specifiedUpdatable; - } - - public void setSpecifiedUpdatable(Boolean updatable) { - if (this.valuesAreDifferent(this.specifiedUpdatable, updatable)) { - X xmlColumn = this.getXmlColumnForUpdate(); - this.setSpecifiedUpdatable_(updatable); - xmlColumn.setUpdatable(updatable); - this.removeXmlColumnIfUnset(); - } - } - - protected void setSpecifiedUpdatable_(Boolean updatable) { - Boolean old = this.specifiedUpdatable; - this.specifiedUpdatable = updatable; - this.firePropertyChanged(SPECIFIED_UPDATABLE_PROPERTY, old, updatable); - } - - protected Boolean buildSpecifiedUpdatable() { - X xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getUpdatable(); - } - - public boolean isDefaultUpdatable() { - return DEFAULT_UPDATABLE; - } - - - // ********** misc ********** - - protected void initializeFrom(ReadOnlyBaseColumn oldColumn) { - super.initializeFrom(oldColumn); - this.setSpecifiedTable(oldColumn.getSpecifiedTable()); - this.setSpecifiedUnique(oldColumn.getSpecifiedUnique()); - this.setSpecifiedNullable(oldColumn.getSpecifiedNullable()); - this.setSpecifiedInsertable(oldColumn.getSpecifiedInsertable()); - this.setSpecifiedUpdatable(oldColumn.getSpecifiedUpdatable()); - } - - protected void initializeFromVirtual(ReadOnlyBaseColumn virtualColumn) { - super.initializeFromVirtual(virtualColumn); - this.setSpecifiedTable(virtualColumn.getTable()); - // ignore other settings? - } - - public boolean tableNameIsInvalid() { - return this.owner.tableNameIsInvalid(this.getTable()); - } - - public Iterator candidateTableNames() { - return this.owner.candidateTableNames(); - } - - - // ********** validation ********** - - public TextRange getTableTextRange() { - return this.getTextRange(this.getXmlColumnTableTextRange()); - } - - protected TextRange getXmlColumnTableTextRange() { - X xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getTableTextRange(); - } - - @Override - protected NamedColumnTextRangeResolver buildTextRangeResolver() { - return new OrmBaseColumnTextRangeResolver(this); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java deleted file mode 100644 index 98cc922c63..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBaseEmbeddedMapping.java +++ /dev/null @@ -1,328 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.AttributeOverride; -import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.Embeddable; -import org.eclipse.jpt.jpa.core.context.OverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaBaseEmbeddedMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmBaseEmbeddedMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEmbeddedIdMapping; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlEmbedded; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml embedded or embedded ID mapping - */ -public abstract class AbstractOrmBaseEmbeddedMapping - extends AbstractOrmAttributeMapping - implements OrmBaseEmbeddedMapping -{ - protected final OrmAttributeOverrideContainer attributeOverrideContainer; - - protected Embeddable targetEmbeddable; - - - protected AbstractOrmBaseEmbeddedMapping(OrmPersistentAttribute parent, X xmlMapping) { - super(parent, xmlMapping); - this.attributeOverrideContainer = this.buildAttributeOverrideContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.attributeOverrideContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.attributeOverrideContainer.update(); - this.setTargetEmbeddable(this.buildTargetEmbeddable()); - } - - - // ********** attribute override container ********** - - public OrmAttributeOverrideContainer getAttributeOverrideContainer() { - return this.attributeOverrideContainer; - } - - protected OrmAttributeOverrideContainer buildAttributeOverrideContainer() { - return this.getContextNodeFactory().buildOrmAttributeOverrideContainer(this, this.buildAttributeOverrideContainerOwner()); - } - - protected OrmAttributeOverrideContainer.Owner buildAttributeOverrideContainerOwner() { - return new AttributeOverrideContainerOwner(); - } - - - // ********** target embeddable ********** - - public Embeddable getTargetEmbeddable() { - return this.targetEmbeddable; - } - - protected void setTargetEmbeddable(Embeddable embeddable) { - Embeddable old = this.targetEmbeddable; - this.targetEmbeddable = embeddable; - this.firePropertyChanged(TARGET_EMBEDDABLE_PROPERTY, old, embeddable); - } - - protected Embeddable buildTargetEmbeddable() { - JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute(); - return (javaAttribute == null) ? null : javaAttribute.getEmbeddable(); - } - - - // ********** embedded mappings ********** - - @Override - public Iterator allOverridableAttributeMappingNames() { - return this.isJpa2_0Compatible() ? - this.embeddableOverridableAttributeMappingNames() : - super.allOverridableAttributeMappingNames(); - } - - protected Iterator embeddableOverridableAttributeMappingNames() { - return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER); - } - - @Override - public Iterator allOverridableAssociationMappingNames() { - return this.isJpa2_0Compatible() ? - this.embeddableOverridableAssociationMappingNames() : - super.allOverridableAssociationMappingNames(); - } - - protected Iterator embeddableOverridableAssociationMappingNames() { - return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER); - } - - protected Iterator qualifiedEmbeddableOverridableMappingNames(Transformer> transformer) { - return new TransformationIterator(this.embeddableAttributeMappingNames(transformer), this.buildQualifierTransformer()); - } - - protected Iterator embeddableAttributeMappingNames(Transformer> transformer) { - return new CompositeIterator(this.embeddableAttributeMappingNamesLists(transformer)); - } - - /** - * Return a list of lists; each nested list holds the names for one of the - * embedded mapping's target embeddable type mapping's attribute mappings - * (attribute or association mappings, depending on the specified transformer). - */ - protected Iterator> embeddableAttributeMappingNamesLists(Transformer> transformer) { - return new TransformationIterator>(this.embeddableAttributeMappings(), transformer); - } - - /** - * Return the target embeddable's attribute mappings. - */ - protected Iterator embeddableAttributeMappings() { - return ((this.targetEmbeddable != null) && (this.targetEmbeddable != this.getTypeMapping())) ? - this.targetEmbeddable.attributeMappings() : - EmptyIterator.instance(); - } - - - // ********** misc ********** - - @Override - protected void initializeFromOrmBaseEmbeddedMapping(OrmBaseEmbeddedMapping oldMapping) { - super.initializeFromOrmBaseEmbeddedMapping(oldMapping); - this.attributeOverrideContainer.initializeFrom(oldMapping.getAttributeOverrideContainer()); - } - - protected JavaAttributeOverride getSpecifiedJavaAttributeOverrideNamed(String attributeName) { - JavaBaseEmbeddedMapping javaMapping = this.getJavaEmbeddedMapping(); - return (javaMapping == null) ? null : javaMapping.getAttributeOverrideContainer().getSpecifiedOverrideNamed(attributeName); - } - - protected JavaBaseEmbeddedMapping getJavaEmbeddedMapping() { - JavaAttributeMapping javaMapping = this.getJavaAttributeMapping(); - return ((javaMapping != null) && this.valuesAreEqual(javaMapping.getKey(), this.getKey())) ? - (JavaBaseEmbeddedMapping) javaMapping : null; - } - - protected JavaAttributeMapping getJavaAttributeMapping() { - JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute(); - return (javaAttribute == null) ? null : javaAttribute.getMapping(); - } - - @Override - public Column resolveOverriddenColumn(String attributeName) { - return this.isJpa2_0Compatible() ? this.resolveOverriddenColumn_(attributeName) : null; - } - - protected Column resolveOverriddenColumn_(String attributeName) { - attributeName = this.unqualify(attributeName); - if (attributeName == null) { - return null; - } - AttributeOverride override = this.attributeOverrideContainer.getSpecifiedOverrideNamed(attributeName); - // recurse into the target embeddable if necessary - return (override != null) ? override.getColumn() : this.resolveOverriddenColumnInTargetEmbeddable(attributeName); - } - - protected Column resolveOverriddenColumnInTargetEmbeddable(String attributeName) { - return (this.targetEmbeddable == null) ? null : this.targetEmbeddable.resolveOverriddenColumn(attributeName); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - if (this.validateTargetEmbeddable(messages)) { - this.validateOverrides(messages, reporter); - } - } - - protected boolean validateTargetEmbeddable(List messages) { - if (this.targetEmbeddable == null) { - String targetEmbeddableTypeName = this.getPersistentAttribute().getTypeName(); - // if the type isn't resolvable, there'll already be a java error - if (targetEmbeddableTypeName != null) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TARGET_NOT_AN_EMBEDDABLE, - new String[] {targetEmbeddableTypeName}, - this, - this.getValidationTextRange() - ) - ); - } - return false; - } - return true; - } - - protected void validateOverrides(List messages, IReporter reporter) { - this.attributeOverrideContainer.validate(messages, reporter); - } - - - // ********** attribute override container owner ********* - - protected class AttributeOverrideContainerOwner - implements OrmAttributeOverrideContainer.Owner - { - public OrmTypeMapping getTypeMapping() { - return AbstractOrmBaseEmbeddedMapping.this.getTypeMapping(); - } - - public TypeMapping getOverridableTypeMapping() { - return AbstractOrmBaseEmbeddedMapping.this.getTargetEmbeddable(); - } - - public Iterator allOverridableNames() { - TypeMapping typeMapping = this.getOverridableTypeMapping(); - return (typeMapping != null) ? this.allOverridableAttributeNames_(typeMapping) : EmptyIterator.instance(); - } - - /** - * pre-condition: type mapping is not null - *

- * NB: Overridden in {@link GenericOrmEmbeddedIdMapping.AttributeOverrideContainerOwner} - */ - protected Iterator allOverridableAttributeNames_(TypeMapping typeMapping) { - return typeMapping.allOverridableAttributeNames(); - } - - public EList getXmlOverrides() { - return AbstractOrmBaseEmbeddedMapping.this.getXmlAttributeMapping().getAttributeOverrides(); - } - - public Column resolveOverriddenColumn(String attributeName) { - if (this.mappingIsVirtual() && ! this.getTypeMapping().isMetadataComplete()) { - JavaAttributeOverride javaOverride = AbstractOrmBaseEmbeddedMapping.this.getSpecifiedJavaAttributeOverrideNamed(attributeName); - if (javaOverride != null) { - return javaOverride.getColumn(); - } - } - return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getTypeMapping().tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return this.getTypeMapping().allAssociatedTableNames(); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return this.getTypeMapping().resolveDbTable(tableName); - } - - public String getDefaultTableName() { - return this.getTypeMapping().getPrimaryTableName(); - } - - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new AttributeOverrideValidator(this.getPersistentAttribute(), (AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) { - return new AttributeOverrideColumnValidator(this.getPersistentAttribute(), (AttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider()); - } - - public TextRange getValidationTextRange() { - return AbstractOrmBaseEmbeddedMapping.this.getValidationTextRange(); - } - - protected OrmPersistentAttribute getPersistentAttribute() { - return AbstractOrmBaseEmbeddedMapping.this.getPersistentAttribute(); - } - - protected boolean mappingIsVirtual() { - return AbstractOrmBaseEmbeddedMapping.this.isVirtual(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java deleted file mode 100644 index 60ab3a1f63..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmBasicMapping.java +++ /dev/null @@ -1,425 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.FetchType; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmBasicMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmColumnMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmEnumeratedConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmLobConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmConverter; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic; -import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml basic mapping - */ -public abstract class AbstractOrmBasicMapping - extends AbstractOrmAttributeMapping - implements OrmBasicMapping -{ - protected final OrmColumn column; - - protected FetchType specifiedFetch; - protected FetchType defaultFetch; - - protected Boolean specifiedOptional; - protected boolean defaultOptional; - - protected OrmConverter converter; // never null - - - protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] { - OrmEnumeratedConverter.Adapter.instance(), - OrmTemporalConverter.Adapter.instance(), - OrmLobConverter.Adapter.instance() - }; - protected static final Iterable CONVERTER_ADAPTERS = new ArrayIterable(CONVERTER_ADAPTER_ARRAY); - - - protected AbstractOrmBasicMapping(OrmPersistentAttribute parent, X xmlMapping) { - super(parent, xmlMapping); - this.column = this.buildColumn(); - this.specifiedFetch = this.buildSpecifiedFetch(); - this.specifiedOptional = this.buildSpecifiedOptional(); - this.converter = this.buildConverter(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.column.synchronizeWithResourceModel(); - this.setSpecifiedFetch_(this.buildSpecifiedFetch()); - this.setSpecifiedOptional_(this.buildSpecifiedOptional()); - this.syncConverter(); - } - - @Override - public void update() { - super.update(); - this.column.update(); - this.setDefaultFetch(this.buildDefaultFetch()); - this.setDefaultOptional(this.buildDefaultOptional()); - this.converter.update(); - } - - - // ********** column ********** - - public OrmColumn getColumn() { - return this.column; - } - - protected OrmColumn buildColumn() { - return this.getContextNodeFactory().buildOrmColumn(this, this); - } - - - // ********** fetch ********** - - public FetchType getFetch() { - return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch; - } - - public FetchType getSpecifiedFetch() { - return this.specifiedFetch; - } - - public void setSpecifiedFetch(FetchType fetch) { - this.setSpecifiedFetch_(fetch); - this.xmlAttributeMapping.setFetch(FetchType.toOrmResourceModel(fetch)); - } - - protected void setSpecifiedFetch_(FetchType fetch) { - FetchType old = this.specifiedFetch; - this.specifiedFetch = fetch; - this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch); - } - - protected FetchType buildSpecifiedFetch() { - return FetchType.fromOrmResourceModel(this.xmlAttributeMapping.getFetch()); - } - - public FetchType getDefaultFetch() { - return this.defaultFetch; - } - - protected void setDefaultFetch(FetchType fetch) { - FetchType old = this.defaultFetch; - this.defaultFetch = fetch; - this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch); - } - - protected FetchType buildDefaultFetch() { - return DEFAULT_FETCH_TYPE; - } - - - // ********** optional ********** - - public boolean isOptional() { - return (this.specifiedOptional != null) ? this.specifiedOptional.booleanValue() : this.isDefaultOptional(); - } - - public Boolean getSpecifiedOptional() { - return this.specifiedOptional; - } - - public void setSpecifiedOptional(Boolean optional) { - this.setSpecifiedOptional_(optional); - this.xmlAttributeMapping.setOptional(optional); - } - - protected void setSpecifiedOptional_(Boolean optional) { - Boolean old = this.specifiedOptional; - this.specifiedOptional = optional; - this.firePropertyChanged(SPECIFIED_OPTIONAL_PROPERTY, old, optional); - } - - protected Boolean buildSpecifiedOptional() { - return this.xmlAttributeMapping.getOptional(); - } - - public boolean isDefaultOptional() { - return this.defaultOptional; - } - - protected void setDefaultOptional(boolean optional) { - boolean old = this.defaultOptional; - this.defaultOptional = optional; - this.firePropertyChanged(DEFAULT_OPTIONAL_PROPERTY, old, optional); - } - - protected boolean buildDefaultOptional() { - return DEFAULT_OPTIONAL; - } - - - // ********** converter ********** - - public OrmConverter getConverter() { - return this.converter; - } - - public void setConverter(Class converterType) { - if (this.converter.getType() != converterType) { - // note: we may also clear the XML value we want; - // but if we leave it, the resulting sync will screw things up... - this.clearXmlConverterValues(); - OrmConverter.Adapter converterAdapter = this.getConverterAdapter(converterType); - this.setConverter_(this.buildConverter(converterAdapter)); - this.converter.initialize(); - } - } - - protected OrmConverter buildConverter(OrmConverter.Adapter converterAdapter) { - return (converterAdapter != null) ? - converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) : - this.buildNullConverter(); - } - - protected void setConverter_(OrmConverter converter) { - Converter old = this.converter; - this.converter = converter; - this.firePropertyChanged(CONVERTER_PROPERTY, old, converter); - } - - protected void clearXmlConverterValues() { - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - adapter.clearXmlValue(this.xmlAttributeMapping); - } - } - - protected OrmConverter buildConverter() { - OrmXmlContextNodeFactory factory = this.getContextNodeFactory(); - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - OrmConverter ormConverter = adapter.buildConverter(this, factory); - if (ormConverter != null) { - return ormConverter; - } - } - return this.buildNullConverter(); - } - - protected void syncConverter() { - OrmConverter.Adapter adapter = this.getXmlConverterAdapter(); - if (adapter == null) { - if (this.converter.getType() != null) { - this.setConverter_(this.buildNullConverter()); - } - } else { - if (this.converter.getType() == adapter.getConverterType()) { - this.converter.synchronizeWithResourceModel(); - } else { - this.setConverter_(adapter.buildNewConverter(this, this.getContextNodeFactory())); - } - } - } - - /** - * Return the first adapter whose converter value is set in the XML mapping. - * Return null if there are no converter values in the XML. - */ - protected OrmConverter.Adapter getXmlConverterAdapter() { - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.isActive(this.xmlAttributeMapping)) { - return adapter; - } - } - return null; - } - - protected OrmConverter buildNullConverter() { - return new NullOrmConverter(this); - } - - - // ********** converter adapters ********** - - /** - * Return the converter adapter for the specified converter type. - */ - protected OrmConverter.Adapter getConverterAdapter(Class converterType) { - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.getConverterType() == converterType) { - return adapter; - } - } - return null; - } - - protected Iterable getConverterAdapters() { - return CONVERTER_ADAPTERS; - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY; - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmBasicMapping(this); - } - - @Override - protected void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) { - super.initializeFromOrmColumnMapping(oldMapping); - this.column.initializeFrom(oldMapping.getColumn()); - } - - public int getXmlSequence() { - return 20; - } - - @Override - public boolean isOverridableAttributeMapping() { - return true; - } - - public void addXmlAttributeMappingTo(Attributes xmlAttributes) { - xmlAttributes.getBasics().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) { - xmlAttributes.getBasics().remove(this.xmlAttributeMapping); - } - - - // ********** OrmColumn.Owner implementation ********** - - public String getDefaultColumnName() { - return this.name; - } - - public String getDefaultTableName() { - return this.getTypeMapping().getPrimaryTableName(); - } - - public Table resolveDbTable(String tableName) { - return this.getTypeMapping().resolveDbTable(tableName); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getTypeMapping().tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return this.getTypeMapping().allAssociatedTableNames(); - } - - public XmlColumn getXmlColumn() { - return this.xmlAttributeMapping.getColumn(); - } - - public XmlColumn buildXmlColumn() { - XmlColumn xmlColumn = OrmFactory.eINSTANCE.createXmlColumn(); - this.xmlAttributeMapping.setColumn(xmlColumn); - return xmlColumn; - } - - public void removeXmlColumn() { - this.xmlAttributeMapping.setColumn(null); - } - - - //************ refactoring ************ - - @Override - @SuppressWarnings("unchecked") - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable( - super.createRenameTypeEdits(originalType, newName), - this.createConverterRenameTypeEdits(originalType, newName) - ); - } - - protected Iterable createConverterRenameTypeEdits(IType originalType, String newName) { - return (this.converter != null) ? - this.converter.createRenameTypeEdits(originalType, newName) : - EmptyIterable.instance(); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable( - super.createMoveTypeEdits(originalType, newPackage), - this.createConverterMoveTypeEdits(originalType, newPackage) - ); - } - - protected Iterable createConverterMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return (this.converter != null) ? - this.converter.createMoveTypeEdits(originalType, newPackage) : - EmptyIterable.instance(); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable( - super.createRenamePackageEdits(originalPackage, newName), - this.createConverterRenamePackageEdits(originalPackage, newName) - ); - } - - protected Iterable createConverterRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return (this.converter != null) ? - this.converter.createRenamePackageEdits(originalPackage, newName) : - EmptyIterable.instance(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.column.validate(messages, reporter); - this.converter.validate(messages, reporter); - } - - public JptValidator buildColumnValidator(NamedColumn col, NamedColumnTextRangeResolver textRangeResolver) { - return new NamedColumnValidator(this.getPersistentAttribute(), (BaseColumn) col, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEmbeddable.java deleted file mode 100644 index e2883a2d88..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEmbeddable.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Iterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.ReadOnlyTable; -import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddable; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings; - -/** - * orm.xml embeddable type mapping - */ -public abstract class AbstractOrmEmbeddable - extends AbstractOrmTypeMapping - implements OrmEmbeddable -{ - protected AbstractOrmEmbeddable(OrmPersistentType parent, X resourceMapping) { - super(parent, resourceMapping); - } - - - // ********** key ********** - - public String getKey() { - return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY; - } - - - // ********** id class ********** - - public JavaPersistentType getIdClass() { - return null; - } - - - // ********** tables ********** - - public Iterator associatedTables() { - return EmptyIterator.instance(); - } - - public Iterator allAssociatedTables() { - return EmptyIterator.instance(); - } - - public Iterator allAssociatedTableNames() { - return EmptyIterator.instance(); - } - - public boolean tableNameIsInvalid(String tableName) { - return false; - } - - - // ********** Java ********** - - @Override - public JavaEmbeddable getJavaTypeMapping() { - return (JavaEmbeddable) super.getJavaTypeMapping(); - } - - @Override - public JavaEmbeddable getJavaTypeMappingForDefaults() { - return (JavaEmbeddable) super.getJavaTypeMappingForDefaults(); - } - - - // ********** entity mappings ********** - - public int getXmlSequence() { - return 2; - } - - public void addXmlTypeMappingTo(XmlEntityMappings entityMappings) { - entityMappings.getEmbeddables().add(this.xmlTypeMapping); - } - - public void removeXmlTypeMappingFrom(XmlEntityMappings entityMappings) { - entityMappings.getEmbeddables().remove(this.xmlTypeMapping); - } - - - // ********** validation ********** - - @Override - public boolean validatesAgainstDatabase() { - return false; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java deleted file mode 100644 index 61ea1f67a5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmEntity.java +++ /dev/null @@ -1,2285 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.emf.common.util.EList; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.ClassName; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.NotNullFilter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.JpaPlatformVariation.Supported; -import org.eclipse.jpt.jpa.core.context.AssociationOverride; -import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.AttributeOverride; -import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.BaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.DiscriminatorColumn; -import org.eclipse.jpt.jpa.core.context.DiscriminatorType; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.InheritanceType; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.OverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable; -import org.eclipse.jpt.jpa.core.context.ReadOnlyTable; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.SecondaryTable; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner; -import org.eclipse.jpt.jpa.core.context.java.JavaEntity; -import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyAttributeOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmDiscriminatorColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmEntity; -import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratorContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmIdClassReference; -import org.eclipse.jpt.jpa.core.context.orm.OrmNamedColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmSecondaryTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualSecondaryTable; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.EntityTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinTableValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.DiscriminatorColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityPrimaryKeyJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericEntityPrimaryKeyValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.MappedSuperclassOverrideDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.SecondaryTableValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.TableValidator; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.SingleRelationshipMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.orm.Inheritance; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride; -import org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer; -import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml entity - */ -public abstract class AbstractOrmEntity - extends AbstractOrmTypeMapping - implements OrmEntity, OrmCacheableHolder2_0, OrmIdClassReference.Owner -{ - protected String specifiedName; - protected String defaultName; - - protected Entity rootEntity; - protected final Vector descendants = new Vector(); - - protected final OrmIdClassReference idClassReference; - - protected final OrmTable table; - protected boolean specifiedTableIsAllowed; - protected boolean tableIsUndefined; - - protected final Vector specifiedSecondaryTables = new Vector(); - protected final SpecifiedSecondaryTableContainerAdapter specifiedSecondaryTableContainerAdapter = new SpecifiedSecondaryTableContainerAdapter(); - - protected final Vector virtualSecondaryTables = new Vector(); - protected final VirtualSecondaryTableContainerAdapter virtualSecondaryTableContainerAdapter = new VirtualSecondaryTableContainerAdapter(); - - protected final PrimaryKeyJoinColumnOwner primaryKeyJoinColumnOwner; - protected final Vector specifiedPrimaryKeyJoinColumns = new Vector(); - protected final SpecifiedPrimaryKeyJoinColumnContainerAdapter specifiedPrimaryKeyJoinColumnContainerAdapter = new SpecifiedPrimaryKeyJoinColumnContainerAdapter(); - - // this is the default if there are Java columns - protected final Vector virtualPrimaryKeyJoinColumns = new Vector(); - protected final VirtualPrimaryKeyJoinColumnContainerAdapter virtualPrimaryKeyJoinColumnContainerAdapter = new VirtualPrimaryKeyJoinColumnContainerAdapter(); - - // this is the default if there are *no* Java columns - protected ReadOnlyPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn; - - protected InheritanceType specifiedInheritanceStrategy; - protected InheritanceType defaultInheritanceStrategy; - - protected String specifiedDiscriminatorValue; - protected String defaultDiscriminatorValue; - protected boolean specifiedDiscriminatorValueIsAllowed; - protected boolean discriminatorValueIsUndefined; - - protected final OrmDiscriminatorColumn discriminatorColumn; - protected boolean specifiedDiscriminatorColumnIsAllowed; - protected boolean discriminatorColumnIsUndefined; - - protected final OrmAttributeOverrideContainer attributeOverrideContainer; - protected final OrmAssociationOverrideContainer associationOverrideContainer; - - protected final OrmGeneratorContainer generatorContainer; - protected final OrmQueryContainer queryContainer; - - - // ********** construction ********** - - protected AbstractOrmEntity(OrmPersistentType parent, X xmlEntity) { - super(parent, xmlEntity); - this.specifiedName = xmlEntity.getName(); - this.idClassReference = this.buildIdClassReference(); - this.table = this.buildTable(); - this.initializeSpecifiedSecondaryTables(); - this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner(); - this.initializeSpecifiedPrimaryKeyJoinColumns(); - this.specifiedInheritanceStrategy = this.buildSpecifiedInheritanceStrategy(); - this.specifiedDiscriminatorValue = xmlEntity.getDiscriminatorValue(); - this.discriminatorColumn = this.buildDiscriminatorColumn(); - // start with the entity as the root - it will be recalculated in update() - this.rootEntity = this; - this.attributeOverrideContainer = this.buildAttributeOverrideContainer(); - this.associationOverrideContainer = this.buildAssociationOverrideContainer(); - this.generatorContainer = this.buildGeneratorContainer(); - this.queryContainer = this.buildQueryContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - - this.setSpecifiedName_(this.xmlTypeMapping.getName()); - - this.idClassReference.synchronizeWithResourceModel(); - - this.table.synchronizeWithResourceModel(); - - this.syncSpecifiedSecondaryTables(); - - this.syncSpecifiedPrimaryKeyJoinColumns(); - - this.setSpecifiedInheritanceStrategy_(this.buildSpecifiedInheritanceStrategy()); - this.setSpecifiedDiscriminatorValue_(this.xmlTypeMapping.getDiscriminatorValue()); - this.discriminatorColumn.synchronizeWithResourceModel(); - - this.attributeOverrideContainer.synchronizeWithResourceModel(); - this.associationOverrideContainer.synchronizeWithResourceModel(); - - this.generatorContainer.synchronizeWithResourceModel(); - this.queryContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - - this.setDefaultName(this.buildDefaultName()); - - // calculate root entity early - other things depend on it - this.setRootEntity(this.buildRootEntity()); - this.updateDescendants(); - - this.idClassReference.update(); - - this.table.update(); - this.setSpecifiedTableIsAllowed(this.buildSpecifiedTableIsAllowed()); - this.setTableIsUndefined(this.buildTableIsUndefined()); - - this.updateVirtualSecondaryTables(); - this.updateNodes(this.getSecondaryTables()); - - this.updateDefaultPrimaryKeyJoinColumns(); - this.updateNodes(this.getPrimaryKeyJoinColumns()); - - this.setDefaultInheritanceStrategy(this.buildDefaultInheritanceStrategy()); - - this.setDefaultDiscriminatorValue(this.buildDefaultDiscriminatorValue()); - this.setSpecifiedDiscriminatorValueIsAllowed(this.buildSpecifiedDiscriminatorValueIsAllowed()); - this.setDiscriminatorValueIsUndefined(this.buildDiscriminatorValueIsUndefined()); - - this.discriminatorColumn.update(); - this.setSpecifiedDiscriminatorColumnIsAllowed(this.buildSpecifiedDiscriminatorColumnIsAllowed()); - this.setDiscriminatorColumnIsUndefined(this.buildDiscriminatorColumnIsUndefined()); - - this.attributeOverrideContainer.update(); - this.associationOverrideContainer.update(); - - this.generatorContainer.update(); - this.queryContainer.update(); - } - - - // ********** name ********** - - @Override - public String getName() { - return (this.specifiedName != null) ? this.specifiedName : this.defaultName; - } - - public String getSpecifiedName() { - return this.specifiedName; - } - - public void setSpecifiedName(String name) { - this.setSpecifiedName_(name); - this.xmlTypeMapping.setName(name); - } - - protected void setSpecifiedName_(String name) { - String old = this.specifiedName; - this.specifiedName = name; - this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name); - } - - public String getDefaultName() { - return this.defaultName; - } - - protected void setDefaultName(String name) { - String old = this.defaultName; - this.defaultName = name; - this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name); - } - - protected String buildDefaultName() { - JavaEntity javaEntity = this.getJavaTypeMappingForDefaults(); - if (javaEntity != null) { - return javaEntity.getName(); - } - String className = this.getClass_(); - return StringTools.stringIsEmpty(className) ? null : ClassName.getSimpleName(className); - } - - - // ********** root entity ********** - - public Entity getRootEntity() { - return this.rootEntity; - } - - protected void setRootEntity(Entity entity) { - Entity old = this.rootEntity; - this.rootEntity = entity; - this.firePropertyChanged(ROOT_ENTITY_PROPERTY, old, entity); - } - - protected Entity buildRootEntity() { - Entity result = this; - for (TypeMapping typeMapping : this.getAncestors()) { - if (typeMapping instanceof Entity) { - result = (Entity) typeMapping; - } - } - return result; - } - - - // ********** descendants ********** - - public Iterable getDescendants() { - return new LiveCloneListIterable(this.descendants); - } - - protected void updateDescendants() { - this.synchronizeCollection(this.buildDescendants(), this.descendants, DESCENDANTS_COLLECTION); - } - - protected Iterable buildDescendants() { - return new FilteringIterable(this.getPersistenceUnit().getEntities()) { - @Override - protected boolean accept(Entity entity) { - return AbstractOrmEntity.this.entityIsDescendant(entity); - } - }; - } - - /** - * Return whether specified entity is a descendant of the entity. - */ - protected boolean entityIsDescendant(Entity entity) { - String typeName = this.getPersistentType().getName(); - String entityTypeName = entity.getPersistentType().getName(); - String rootEntityTypeName = entity.getRootEntity().getPersistentType().getName(); - return Tools.valuesAreDifferent(typeName, entityTypeName) && - Tools.valuesAreEqual(typeName, rootEntityTypeName); - } - - - // ********** id class ********** - - public OrmIdClassReference getIdClassReference() { - return this.idClassReference; - } - - protected OrmIdClassReference buildIdClassReference() { - return new GenericOrmIdClassReference(this, this); - } - - public XmlIdClassContainer getXmlIdClassContainer() { - return this.getXmlTypeMapping(); - } - - public JavaIdClassReference getJavaIdClassReferenceForDefaults() { - JavaEntity javaEntity = this.getJavaTypeMappingForDefaults(); - return (javaEntity == null) ? null : javaEntity.getIdClassReference(); - } - - public JavaPersistentType getIdClass() { - return this.idClassReference.getIdClass(); - } - - - // ********** table ********** - - public OrmTable getTable() { - return this.table; - } - - protected OrmTable buildTable() { - return this.getContextNodeFactory().buildOrmTable(this, this.buildTableOwner()); - } - - protected Table.Owner buildTableOwner() { - return new TableOwner(); - } - - public boolean specifiedTableIsAllowed() { - return this.specifiedTableIsAllowed; - } - - protected void setSpecifiedTableIsAllowed(boolean specifiedTableIsAllowed) { - boolean old = this.specifiedTableIsAllowed; - this.specifiedTableIsAllowed = specifiedTableIsAllowed; - this.firePropertyChanged(SPECIFIED_TABLE_IS_ALLOWED_PROPERTY, old, specifiedTableIsAllowed); - } - - protected boolean buildSpecifiedTableIsAllowed() { - return ! this.isAbstractTablePerClass() && ! this.isSingleTableDescendant(); - } - - public boolean tableIsUndefined() { - return this.tableIsUndefined; - } - - protected void setTableIsUndefined(boolean tableIsUndefined) { - boolean old = this.tableIsUndefined; - this.tableIsUndefined = tableIsUndefined; - this.firePropertyChanged(TABLE_IS_UNDEFINED_PROPERTY, old, tableIsUndefined); - } - - protected boolean buildTableIsUndefined() { - return this.isAbstractTablePerClass(); - } - - public String getDefaultTableName() { - JavaEntity javaEntity = this.getJavaTypeMappingForDefaults(); - if (javaEntity != null) { - String javaName = javaEntity.getTable().getSpecifiedName(); - if ((javaName != null) && ! this.table.isSpecifiedInResource()) { - return javaName; - } - } - return this.isSingleTableDescendant() ? - this.rootEntity.getTable().getName() : - this.isAbstractTablePerClass() ? - null : - this.getName(); - } - - public String getDefaultSchema() { - JavaEntity javaEntity = this.getJavaTypeMappingForDefaults(); - if (javaEntity != null) { - String javaSchema = javaEntity.getTable().getSpecifiedSchema(); - if ((javaSchema != null) && ! this.table.isSpecifiedInResource()) { - return javaSchema; - } - } - return this.isSingleTableDescendant() ? - this.rootEntity.getTable().getSchema() : - this.isAbstractTablePerClass() ? - null : - this.getContextDefaultSchema(); - } - - public String getDefaultCatalog() { - JavaEntity javaEntity = this.getJavaTypeMappingForDefaults(); - if (javaEntity != null) { - String javaCatalog = javaEntity.getTable().getSpecifiedCatalog(); - if ((javaCatalog != null) && ! this.table.isSpecifiedInResource()) { - return javaCatalog; - } - } - return this.isSingleTableDescendant() ? - this.rootEntity.getTable().getCatalog() : - this.isAbstractTablePerClass() ? - null : - this.getContextDefaultCatalog(); - } - - protected static class TableOwner - implements Table.Owner - { - public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) { - return new TableValidator(table, textRangeResolver); - } - } - - - // ********** secondary tables ********** - - public ListIterator secondaryTables() { - return this.getSecondaryTables().iterator(); - } - - protected ListIterable getSecondaryTables() { - return this.specifiedSecondaryTables.isEmpty() ? - this.getReadOnlyVirtualSecondaryTables() : - this.getReadOnlySpecifiedSecondaryTables(); - } - - public int secondaryTablesSize() { - return this.specifiedSecondaryTables.isEmpty() ? - this.virtualSecondaryTables.size() : - this.specifiedSecondaryTables.size(); - } - - - // ********** specified secondary tables ********** - - public ListIterator specifiedSecondaryTables() { - return this.getSpecifiedSecondaryTables().iterator(); - } - - protected ListIterable getSpecifiedSecondaryTables() { - return new LiveCloneListIterable(this.specifiedSecondaryTables); - } - - protected ListIterable getReadOnlySpecifiedSecondaryTables() { - return new LiveCloneListIterable(this.specifiedSecondaryTables); - } - - public int specifiedSecondaryTablesSize() { - return this.specifiedSecondaryTables.size(); - } - - public OrmSecondaryTable addSpecifiedSecondaryTable() { - return this.addSpecifiedSecondaryTable(this.specifiedSecondaryTables.size()); - } - - /** - * no state check - */ - protected OrmSecondaryTable addSpecifiedSecondaryTable_() { - return this.addSpecifiedSecondaryTable_(this.specifiedSecondaryTables.size()); - } - - /** - * @see #setSecondaryTablesAreDefinedInXml(boolean) - */ - public OrmSecondaryTable addSpecifiedSecondaryTable(int index) { - if ( ! this.secondaryTablesAreDefinedInXml()) { - throw new IllegalStateException("virtual secondary tables exist - call OrmEntity.setSecondaryTablesAreDefinedInXml(true) first"); //$NON-NLS-1$ - } - return this.addSpecifiedSecondaryTable_(index); - } - - /** - * no state check - */ - protected OrmSecondaryTable addSpecifiedSecondaryTable_(int index) { - XmlSecondaryTable xmlSecondaryTable = this.buildXmlSecondaryTable(); - OrmSecondaryTable secondaryTable = this.addSpecifiedSecondaryTable_(index, xmlSecondaryTable); - this.xmlTypeMapping.getSecondaryTables().add(index, xmlSecondaryTable); - return secondaryTable; - } - - protected XmlSecondaryTable buildXmlSecondaryTable() { - return OrmFactory.eINSTANCE.createXmlSecondaryTable(); - } - - public void removeSpecifiedSecondaryTable(SecondaryTable secondaryTable) { - this.removeSpecifiedSecondaryTable(this.specifiedSecondaryTables.indexOf(secondaryTable)); - } - - public void removeSpecifiedSecondaryTable(int index) { - this.removeSpecifiedSecondaryTable_(index); - this.xmlTypeMapping.getSecondaryTables().remove(index); - } - - protected void removeSpecifiedSecondaryTable_(int index) { - this.removeItemFromList(index, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST); - } - - public void moveSpecifiedSecondaryTable(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST); - this.xmlTypeMapping.getSecondaryTables().move(targetIndex, sourceIndex); - } - - protected void initializeSpecifiedSecondaryTables() { - for (XmlSecondaryTable xmlTable : this.getXmlSecondaryTables()) { - this.specifiedSecondaryTables.add(this.buildSecondaryTable(xmlTable)); - } - } - - protected OrmSecondaryTable buildSecondaryTable(XmlSecondaryTable xmlSecondaryTable) { - return this.getContextNodeFactory().buildOrmSecondaryTable(this, this.buildSecondaryTableOwner(), xmlSecondaryTable); - } - - protected Table.Owner buildSecondaryTableOwner() { - return new SecondaryTableOwner(); - } - - protected void clearSpecifiedSecondaryTables() { - this.clearList(this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST); - this.xmlTypeMapping.getSecondaryTables().clear(); - } - - protected void syncSpecifiedSecondaryTables() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedSecondaryTableContainerAdapter); - } - - protected Iterable getXmlSecondaryTables() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.xmlTypeMapping.getSecondaryTables()); - } - - protected void moveSpecifiedSecondaryTable_(int index, OrmSecondaryTable secondaryTable) { - this.moveItemInList(index, secondaryTable, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST); - } - - protected OrmSecondaryTable addSpecifiedSecondaryTable_(int index, XmlSecondaryTable xmlSecondaryTable) { - OrmSecondaryTable secondaryTable = this.buildSecondaryTable(xmlSecondaryTable); - this.addItemToList(index, secondaryTable, this.specifiedSecondaryTables, SPECIFIED_SECONDARY_TABLES_LIST); - return secondaryTable; - } - - protected void removeSpecifiedSecondaryTable_(OrmSecondaryTable secondaryTable) { - this.removeSpecifiedSecondaryTable_(this.specifiedSecondaryTables.indexOf(secondaryTable)); - } - - /** - * specified secondary table container adapter - */ - protected class SpecifiedSecondaryTableContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractOrmEntity.this.getSpecifiedSecondaryTables(); - } - public Iterable getResourceElements() { - return AbstractOrmEntity.this.getXmlSecondaryTables(); - } - public XmlSecondaryTable getResourceElement(OrmSecondaryTable contextElement) { - return contextElement.getXmlTable(); - } - public void moveContextElement(int index, OrmSecondaryTable element) { - AbstractOrmEntity.this.moveSpecifiedSecondaryTable_(index, element); - } - public void addContextElement(int index, XmlSecondaryTable resourceElement) { - AbstractOrmEntity.this.addSpecifiedSecondaryTable_(index, resourceElement); - } - public void removeContextElement(OrmSecondaryTable element) { - AbstractOrmEntity.this.removeSpecifiedSecondaryTable_(element); - } - } - - protected static class SecondaryTableOwner - implements Table.Owner - { - public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) { - return new SecondaryTableValidator((SecondaryTable) table, textRangeResolver); - } - } - - - // ********** virtual secondary tables ********** - - public ListIterator virtualSecondaryTables() { - return this.getVirtualSecondaryTables().iterator(); - } - - protected ListIterable getVirtualSecondaryTables() { - return new LiveCloneListIterable(this.virtualSecondaryTables); - } - - protected ListIterable getReadOnlyVirtualSecondaryTables() { - return new LiveCloneListIterable(this.virtualSecondaryTables); - } - - public int virtualSecondaryTablesSize() { - return this.virtualSecondaryTables.size(); - } - - protected void clearVirtualSecondaryTables() { - this.clearList(this.virtualSecondaryTables, VIRTUAL_SECONDARY_TABLES_LIST); - } - - /** - * If there are any specified secondary tables, then there are no virtual - * secondary tables. - * If there are Java specified secondary tables, then those are the virtual - * secondary tables. - * @see #getJavaSecondaryTablesForVirtuals() - */ - protected void updateVirtualSecondaryTables() { - ContextContainerTools.update(this.virtualSecondaryTableContainerAdapter); - } - - protected Iterable getJavaSecondaryTablesForVirtuals() { - if (this.specifiedSecondaryTables.size() > 0) { - return EmptyIterable.instance(); - } - JavaEntity javaEntity = this.getJavaTypeMappingForDefaults(); - return (javaEntity == null) ? - EmptyIterable.instance() : - CollectionTools.iterable(javaEntity.secondaryTables()); - } - - protected void moveVirtualSecondaryTable(int index, OrmVirtualSecondaryTable secondaryTable) { - this.moveItemInList(index, secondaryTable, this.virtualSecondaryTables, VIRTUAL_SECONDARY_TABLES_LIST); - } - - protected OrmVirtualSecondaryTable addVirtualSecondaryTable(int index, JavaSecondaryTable javaSecondaryTable) { - OrmVirtualSecondaryTable secondaryTable = this.buildVirtualSecondaryTable(javaSecondaryTable); - this.addItemToList(index, secondaryTable, this.virtualSecondaryTables, VIRTUAL_SECONDARY_TABLES_LIST); - return secondaryTable; - } - - protected OrmVirtualSecondaryTable buildVirtualSecondaryTable(JavaSecondaryTable javaSecondaryTable) { - return this.getContextNodeFactory().buildOrmVirtualSecondaryTable(this, javaSecondaryTable); - } - - protected void removeVirtualSecondaryTable(OrmVirtualSecondaryTable secondaryTable) { - this.removeItemFromList(secondaryTable, this.virtualSecondaryTables, VIRTUAL_SECONDARY_TABLES_LIST); - } - - /** - * virtual secondary table container adapter - */ - protected class VirtualSecondaryTableContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractOrmEntity.this.getVirtualSecondaryTables(); - } - public Iterable getResourceElements() { - return AbstractOrmEntity.this.getJavaSecondaryTablesForVirtuals(); - } - public JavaSecondaryTable getResourceElement(OrmVirtualSecondaryTable contextElement) { - return contextElement.getOverriddenTable(); - } - public void moveContextElement(int index, OrmVirtualSecondaryTable element) { - AbstractOrmEntity.this.moveVirtualSecondaryTable(index, element); - } - public void addContextElement(int index, JavaSecondaryTable resourceElement) { - AbstractOrmEntity.this.addVirtualSecondaryTable(index, resourceElement); - } - public void removeContextElement(OrmVirtualSecondaryTable element) { - AbstractOrmEntity.this.removeVirtualSecondaryTable(element); - } - } - - - // ********** secondary table transitions ********** - - /** - * If the list of virtual secondary tables is empty, then either the - * secondary tables are defined in XML or there are no secondary tables at - * all (implying they are defined in XML). - */ - public boolean secondaryTablesAreDefinedInXml() { - return this.virtualSecondaryTables.isEmpty(); - } - - public void setSecondaryTablesAreDefinedInXml(boolean defineInXml) { - if (defineInXml != this.secondaryTablesAreDefinedInXml()) { - this.setSecondaryTablesAreDefinedInXml_(defineInXml); - } - } - - protected void setSecondaryTablesAreDefinedInXml_(boolean defineInXml) { - if (defineInXml) { - this.specifySecondaryTablesInXml(); - } else { - this.removeSecondaryTablesFromXml(); - } - } - - /** - * This is used to take all the Java secondary tables and specify them in - * the XML. You must use {@link #setSecondaryTablesAreDefinedInXml(boolean)} - * before calling {@link #addSpecifiedSecondaryTable()}. - */ - protected void specifySecondaryTablesInXml() { - Iterable oldVirtualSecondaryTables = new SnapshotCloneIterable(this.virtualSecondaryTables); - for (OrmVirtualSecondaryTable oldVirtualSecondaryTable : oldVirtualSecondaryTables) { - this.addSpecifiedSecondaryTable_().initializeFrom(oldVirtualSecondaryTable); - } - // the virtual secondary tables will be cleared during the update - } - - protected void removeSecondaryTablesFromXml() { - this.clearSpecifiedSecondaryTables(); - // the virtual secondary tables will be built during the update - } - - - // ********** primary key join columns ********** - - public ListIterator primaryKeyJoinColumns() { - return this.getPrimaryKeyJoinColumns().iterator(); - } - - protected ListIterable getPrimaryKeyJoinColumns() { - return this.specifiedPrimaryKeyJoinColumns.isEmpty() ? - this.getDefaultPrimaryKeyJoinColumns() : - this.getReadOnlySpecifiedPrimaryKeyJoinColumns(); - } - - public int primaryKeyJoinColumnsSize() { - return this.specifiedPrimaryKeyJoinColumns.isEmpty() ? - this.defaultPrimaryKeyJoinColumnsSize() : - this.specifiedPrimaryKeyJoinColumnsSize(); - } - - protected OrmPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(XmlPrimaryKeyJoinColumn xmlPkJoinColumn) { - return this.getContextNodeFactory().buildOrmPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, xmlPkJoinColumn); - } - - - // ********** specified primary key join columns ********** - - public ListIterator specifiedPrimaryKeyJoinColumns() { - return this.getSpecifiedPrimaryKeyJoinColumns().iterator(); - } - - protected ListIterable getSpecifiedPrimaryKeyJoinColumns() { - return new LiveCloneListIterable(this.specifiedPrimaryKeyJoinColumns); - } - - protected ListIterable getReadOnlySpecifiedPrimaryKeyJoinColumns() { - return new LiveCloneListIterable(this.specifiedPrimaryKeyJoinColumns); - } - - public int specifiedPrimaryKeyJoinColumnsSize() { - return this.specifiedPrimaryKeyJoinColumns.size(); - } - - public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() { - return this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size()); - } - - public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) { - this.clearDefaultPrimaryKeyJoinColumns(); // could leave for update? - - XmlPrimaryKeyJoinColumn xmlPkJoinColumn = this.buildXmlPrimaryKeyJoinColumn(); - OrmPrimaryKeyJoinColumn pkJoinColumn = this.addSpecifiedPrimaryKeyJoinColumn_(index, xmlPkJoinColumn); - this.xmlTypeMapping.getPrimaryKeyJoinColumns().add(index, xmlPkJoinColumn); - return pkJoinColumn; - } - - protected XmlPrimaryKeyJoinColumn buildXmlPrimaryKeyJoinColumn() { - return OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn(); - } - - public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn primaryKeyJoinColumn) { - this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(primaryKeyJoinColumn)); - } - - public void removeSpecifiedPrimaryKeyJoinColumn(int index) { - this.removeSpecifiedPrimaryKeyJoinColumn_(index); - this.xmlTypeMapping.getPrimaryKeyJoinColumns().remove(index); - } - - protected void removeSpecifiedPrimaryKeyJoinColumn_(int index) { - this.removeItemFromList(index, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - this.xmlTypeMapping.getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex); - } - - protected PrimaryKeyJoinColumnOwner buildPrimaryKeyJoinColumnOwner() { - return new PrimaryKeyJoinColumnOwner(); - } - - protected void initializeSpecifiedPrimaryKeyJoinColumns() { - for (XmlPrimaryKeyJoinColumn xmlPkJoinColumn : this.getXmlPrimaryKeyJoinColumns()) { - this.specifiedPrimaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(xmlPkJoinColumn)); - } - } - - protected void syncSpecifiedPrimaryKeyJoinColumns() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedPrimaryKeyJoinColumnContainerAdapter); - } - - protected Iterable getXmlPrimaryKeyJoinColumns() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.xmlTypeMapping.getPrimaryKeyJoinColumns()); - } - - protected void moveSpecifiedPrimaryKeyJoinColumn_(int index, OrmPrimaryKeyJoinColumn pkJoinColumn) { - this.moveItemInList(index, pkJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - protected OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn_(int index, XmlPrimaryKeyJoinColumn xmlPkJoinColumn) { - OrmPrimaryKeyJoinColumn pkJoinColumn = this.buildPrimaryKeyJoinColumn(xmlPkJoinColumn); - this.addItemToList(index, pkJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - return pkJoinColumn; - } - - protected void removeSpecifiedPrimaryKeyJoinColumn_(OrmPrimaryKeyJoinColumn pkJoinColumn) { - this.removeSpecifiedPrimaryKeyJoinColumn_(this.specifiedPrimaryKeyJoinColumns.indexOf(pkJoinColumn)); - } - - /** - * specified primary key join column container adapter - */ - protected class SpecifiedPrimaryKeyJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractOrmEntity.this.getSpecifiedPrimaryKeyJoinColumns(); - } - public Iterable getResourceElements() { - return AbstractOrmEntity.this.getXmlPrimaryKeyJoinColumns(); - } - public XmlPrimaryKeyJoinColumn getResourceElement(OrmPrimaryKeyJoinColumn contextElement) { - return contextElement.getXmlColumn(); - } - public void moveContextElement(int index, OrmPrimaryKeyJoinColumn element) { - AbstractOrmEntity.this.moveSpecifiedPrimaryKeyJoinColumn_(index, element); - } - public void addContextElement(int index, XmlPrimaryKeyJoinColumn resourceElement) { - AbstractOrmEntity.this.addSpecifiedPrimaryKeyJoinColumn_(index, resourceElement); - } - public void removeContextElement(OrmPrimaryKeyJoinColumn element) { - AbstractOrmEntity.this.removeSpecifiedPrimaryKeyJoinColumn_(element); - } - } - - - // ********** default primary key join columns ********** - - public ListIterator defaultPrimaryKeyJoinColumns() { - return this.getDefaultPrimaryKeyJoinColumns().iterator(); - } - - protected ListIterable getDefaultPrimaryKeyJoinColumns() { - int virtualSize = this.virtualPrimaryKeyJoinColumns.size(); - return (virtualSize != 0) ? - this.getReadOnlyVirtualPrimaryKeyJoinColumns() : - this.getReadOnlyDefaultPrimaryKeyJoinColumns(); - } - - public int defaultPrimaryKeyJoinColumnsSize() { - int virtualSize = this.virtualPrimaryKeyJoinColumns.size(); - return (virtualSize != 0) ? - virtualSize : - (this.defaultPrimaryKeyJoinColumn != null) ? 1 : 0; - } - - /** - * This is (blindly) called whenever a specified pk join column is added. - */ - protected void clearDefaultPrimaryKeyJoinColumns() { - int virtualSize = this.virtualPrimaryKeyJoinColumns.size(); - if (virtualSize != 0) { - this.clearVirtualPrimaryKeyJoinColumns(); - } else { - if (this.defaultPrimaryKeyJoinColumn != null) { - this.removeDefaultPrimaryKeyJoinColumn(); - } else { - // nothing to clear - } - } - } - - /** - * If there are any specified pk join columns, then there are no default - * pk join columns. - * If there are Java specified pk join columns, then those are the default - * pk join columns. - * Otherwise, there is a single, spec-defined, default pk join column. - */ - protected void updateDefaultPrimaryKeyJoinColumns() { - if (this.specifiedPrimaryKeyJoinColumns.size() > 0) { - // specified/java/default => specified - this.clearDefaultPrimaryKeyJoinColumns(); - } else { - // specified - if (this.defaultPrimaryKeyJoinColumnsSize() == 0) { - if (this.javaPrimaryKeyJoinColumnsWillBeDefaults()) { - // specified => java - this.initializeVirtualPrimaryKeyJoinColumns(); - } else { - // specified => default - this.addDefaultPrimaryKeyJoinColumn(); - } - } else { - // default - if (this.defaultPrimaryKeyJoinColumn != null) { - if (this.javaPrimaryKeyJoinColumnsWillBeDefaults()) { - // default => java - this.removeDefaultPrimaryKeyJoinColumn(); - this.initializeVirtualPrimaryKeyJoinColumns(); - } else { - // default => default (no change) - } - // java - } else { - if (this.javaPrimaryKeyJoinColumnsWillBeDefaults()) { - // java => java ("normal" update) - this.updateVirtualPrimaryKeyJoinColumns(); - } else { - // java => default - this.clearVirtualPrimaryKeyJoinColumns(); - this.addDefaultPrimaryKeyJoinColumn(); - } - } - } - } - } - - protected void updateVirtualPrimaryKeyJoinColumns() { - ContextContainerTools.update(this.virtualPrimaryKeyJoinColumnContainerAdapter); - } - - /** - * Return whether we have Java pk join columns that will be used to populate - * our virtual pk join column collection. - */ - protected boolean javaPrimaryKeyJoinColumnsWillBeDefaults() { - JavaEntity javaEntity = this.getJavaTypeMappingForDefaults(); - return (javaEntity != null) && (javaEntity.primaryKeyJoinColumnsSize() > 0); - } - - - // ********** virtual primary key join columns ********** - - protected ListIterable getVirtualPrimaryKeyJoinColumns() { - return new LiveCloneListIterable(this.virtualPrimaryKeyJoinColumns); - } - - protected ListIterable getReadOnlyVirtualPrimaryKeyJoinColumns() { - return new LiveCloneListIterable(this.virtualPrimaryKeyJoinColumns); - } - - protected void initializeVirtualPrimaryKeyJoinColumns() { - for (JavaPrimaryKeyJoinColumn javaPkJoinColumn : this.getJavaPrimaryKeyJoinColumnsForVirtuals()) { - this.addVirtualPrimaryKeyJoinColumn(this.buildVirtualPrimaryKeyJoinColumn(javaPkJoinColumn)); - } - } - - protected void addVirtualPrimaryKeyJoinColumn(OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) { - this.addVirtualPrimaryKeyJoinColumn(this.virtualPrimaryKeyJoinColumns.size(), pkJoinColumn); - } - - protected void addVirtualPrimaryKeyJoinColumn(int index, OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) { - this.addItemToList(index, pkJoinColumn, this.virtualPrimaryKeyJoinColumns, DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - protected void clearVirtualPrimaryKeyJoinColumns() { - this.clearList(this.virtualPrimaryKeyJoinColumns, DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - /** - * This will only be called when there are Java pk join columns to return. - * @see #javaPrimaryKeyJoinColumnsWillBeDefaults() - */ - protected Iterable getJavaPrimaryKeyJoinColumnsForVirtuals() { - return CollectionTools.iterable(this.getJavaTypeMappingForDefaults().primaryKeyJoinColumns()); - } - - protected void moveVirtualPrimaryKeyJoinColumn(int index, OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) { - this.moveItemInList(index, pkJoinColumn, this.virtualPrimaryKeyJoinColumns, DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - protected OrmVirtualPrimaryKeyJoinColumn addVirtualPrimaryKeyJoinColumn(int index, JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn) { - OrmVirtualPrimaryKeyJoinColumn pkJoinColumn = this.buildVirtualPrimaryKeyJoinColumn(javaPrimaryKeyJoinColumn); - this.addVirtualPrimaryKeyJoinColumn(index, pkJoinColumn); - return pkJoinColumn; - } - - protected OrmVirtualPrimaryKeyJoinColumn buildVirtualPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn) { - return this.getContextNodeFactory().buildOrmVirtualPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, javaPrimaryKeyJoinColumn); - } - - protected void removeVirtualPrimaryKeyJoinColumn(OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) { - this.removeItemFromList(pkJoinColumn, this.virtualPrimaryKeyJoinColumns, DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - /** - * virtual primary key join column container adapter - */ - protected class VirtualPrimaryKeyJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractOrmEntity.this.getVirtualPrimaryKeyJoinColumns(); - } - public Iterable getResourceElements() { - return AbstractOrmEntity.this.getJavaPrimaryKeyJoinColumnsForVirtuals(); - } - public JavaPrimaryKeyJoinColumn getResourceElement(OrmVirtualPrimaryKeyJoinColumn contextElement) { - return contextElement.getOverriddenColumn(); - } - public void moveContextElement(int index, OrmVirtualPrimaryKeyJoinColumn element) { - AbstractOrmEntity.this.moveVirtualPrimaryKeyJoinColumn(index, element); - } - public void addContextElement(int index, JavaPrimaryKeyJoinColumn resourceElement) { - AbstractOrmEntity.this.addVirtualPrimaryKeyJoinColumn(index, resourceElement); - } - public void removeContextElement(OrmVirtualPrimaryKeyJoinColumn element) { - AbstractOrmEntity.this.removeVirtualPrimaryKeyJoinColumn(element); - } - } - - - // ********** default primary key join column ********** - - protected ListIterable getReadOnlyDefaultPrimaryKeyJoinColumns() { - return (this.defaultPrimaryKeyJoinColumn != null) ? - new SingleElementListIterable(this.defaultPrimaryKeyJoinColumn) : - EmptyListIterable.instance(); - } - - protected void addDefaultPrimaryKeyJoinColumn() { - this.defaultPrimaryKeyJoinColumn = this.buildPrimaryKeyJoinColumn(null); - this.fireItemAdded(DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST, 0, this.defaultPrimaryKeyJoinColumn); - } - - protected void removeDefaultPrimaryKeyJoinColumn() { - ReadOnlyPrimaryKeyJoinColumn old = this.defaultPrimaryKeyJoinColumn; - this.defaultPrimaryKeyJoinColumn = null; - this.fireItemRemoved(DEFAULT_PRIMARY_KEY_JOIN_COLUMNS_LIST, 0, old); - } - - protected ReadOnlyPrimaryKeyJoinColumn buildDefaultPrimaryKeyJoinColumn() { - return this.buildPrimaryKeyJoinColumn(null); - } - - - // ********** inheritance strategy ********** - - public InheritanceType getInheritanceStrategy() { - return (this.specifiedInheritanceStrategy != null) ? this.specifiedInheritanceStrategy : this.defaultInheritanceStrategy; - } - - public InheritanceType getSpecifiedInheritanceStrategy() { - return this.specifiedInheritanceStrategy; - } - - public void setSpecifiedInheritanceStrategy(InheritanceType inheritanceType) { - if (this.valuesAreDifferent(this.specifiedInheritanceStrategy, inheritanceType)) { - Inheritance xmlInheritance = this.getXmlInheritanceForUpdate(); - this.setSpecifiedInheritanceStrategy_(inheritanceType); - xmlInheritance.setStrategy(InheritanceType.toOrmResourceModel(inheritanceType)); - this.removeXmlInheritanceIfUnset(); - } - } - - protected void setSpecifiedInheritanceStrategy_(InheritanceType inheritanceType) { - InheritanceType old = this.specifiedInheritanceStrategy; - this.specifiedInheritanceStrategy = inheritanceType; - this.firePropertyChanged(SPECIFIED_INHERITANCE_STRATEGY_PROPERTY, old, inheritanceType); - } - - protected InheritanceType buildSpecifiedInheritanceStrategy() { - Inheritance xmlInheritance = this.xmlTypeMapping.getInheritance(); - return (xmlInheritance == null) ? null : InheritanceType.fromOrmResourceModel(xmlInheritance.getStrategy()); - } - - protected Inheritance getXmlInheritanceForUpdate() { - Inheritance xmlInheritance = this.xmlTypeMapping.getInheritance(); - return (xmlInheritance != null) ? xmlInheritance : this.buildXmlInheritance(); - } - - protected Inheritance buildXmlInheritance() { - Inheritance xmlInheritance = OrmFactory.eINSTANCE.createInheritance(); - this.xmlTypeMapping.setInheritance(xmlInheritance); - return xmlInheritance; - } - - protected void removeXmlInheritanceIfUnset() { - if (this.xmlTypeMapping.getInheritance().isUnset()) { - this.xmlTypeMapping.setInheritance(null); - } - } - - public InheritanceType getDefaultInheritanceStrategy() { - return this.defaultInheritanceStrategy; - } - - protected void setDefaultInheritanceStrategy(InheritanceType inheritanceType) { - InheritanceType old = this.defaultInheritanceStrategy; - this.defaultInheritanceStrategy = inheritanceType; - this.firePropertyChanged(DEFAULT_INHERITANCE_STRATEGY_PROPERTY, old, inheritanceType); - } - - protected InheritanceType buildDefaultInheritanceStrategy() { - JavaEntity javaEntity = this.getJavaTypeMappingForDefaults(); - if ((javaEntity != null) && (this.xmlTypeMapping.getInheritance() == null)) { - return javaEntity.getInheritanceStrategy(); - } - return this.isRoot() ? - InheritanceType.SINGLE_TABLE : - this.rootEntity.getInheritanceStrategy(); - } - - - // ********** discriminator value ********** - - public String getDiscriminatorValue() { - return (this.specifiedDiscriminatorValue != null) ? this.specifiedDiscriminatorValue : this.defaultDiscriminatorValue; - } - - public String getSpecifiedDiscriminatorValue() { - return this.specifiedDiscriminatorValue; - } - - public void setSpecifiedDiscriminatorValue(String discriminatorValue) { - this.setSpecifiedDiscriminatorValue_(discriminatorValue); - this.xmlTypeMapping.setDiscriminatorValue(discriminatorValue); - } - - protected void setSpecifiedDiscriminatorValue_(String discriminatorValue) { - String old = this.specifiedDiscriminatorValue; - this.specifiedDiscriminatorValue = discriminatorValue; - this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_PROPERTY, old, discriminatorValue); - } - - public String getDefaultDiscriminatorValue() { - return this.defaultDiscriminatorValue; - } - - protected void setDefaultDiscriminatorValue(String discriminatorValue) { - String old = this.defaultDiscriminatorValue; - this.defaultDiscriminatorValue = discriminatorValue; - this.firePropertyChanged(DEFAULT_DISCRIMINATOR_VALUE_PROPERTY, old, discriminatorValue); - } - - /** - * From the Spec: - * If the DiscriminatorValue annotation is not specified, a - * provider-specific function to generate a value representing - * the entity type is used for the value of the discriminator - * column. If the DiscriminatorType is STRING, the discriminator - * value default is the entity name. - */ - // TODO extension point for provider-specific function? - protected String buildDefaultDiscriminatorValue() { - JavaEntity javaEntity = this.getJavaTypeMappingForDefaults(); - if (javaEntity != null) { - return javaEntity.getDiscriminatorValue(); - } - if (this.discriminatorValueIsUndefined) { - return null; - } - return (this.getDiscriminatorType() == DiscriminatorType.STRING) ? this.getName() : null; - } - - protected DiscriminatorType getDiscriminatorType() { - return this.discriminatorColumn.getDiscriminatorType(); - } - - public boolean specifiedDiscriminatorValueIsAllowed() { - return this.specifiedDiscriminatorValueIsAllowed; - } - - protected void setSpecifiedDiscriminatorValueIsAllowed(boolean allowed) { - boolean old = this.specifiedDiscriminatorValueIsAllowed; - this.specifiedDiscriminatorValueIsAllowed = allowed; - this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_VALUE_IS_ALLOWED_PROPERTY, old, allowed); - } - - protected boolean buildSpecifiedDiscriminatorValueIsAllowed() { - return ! this.isTablePerClass() && ! this.isAbstract(); - } - - public boolean discriminatorValueIsUndefined() { - return this.discriminatorValueIsUndefined; - } - - protected void setDiscriminatorValueIsUndefined(boolean undefined) { - boolean old = this.discriminatorValueIsUndefined; - this.discriminatorValueIsUndefined = undefined; - this.firePropertyChanged(DISCRIMINATOR_VALUE_IS_UNDEFINED_PROPERTY, old, undefined); - } - - protected boolean buildDiscriminatorValueIsUndefined() { - return this.isTablePerClass() || - this.isAbstract() || - this.isRootNoDescendantsNoStrategyDefined(); - } - - - // ********** discriminator column ********** - - public OrmDiscriminatorColumn getDiscriminatorColumn() { - return this.discriminatorColumn; - } - - protected OrmDiscriminatorColumn buildDiscriminatorColumn() { - return this.getContextNodeFactory().buildOrmDiscriminatorColumn(this, this.buildDiscriminatorColumnOwner()); - } - - protected OrmDiscriminatorColumn.Owner buildDiscriminatorColumnOwner() { - return new DiscriminatorColumnOwner(); - } - - public boolean specifiedDiscriminatorColumnIsAllowed() { - return this.specifiedDiscriminatorColumnIsAllowed; - } - - protected void setSpecifiedDiscriminatorColumnIsAllowed(boolean allowed) { - boolean old = this.specifiedDiscriminatorColumnIsAllowed; - this.specifiedDiscriminatorColumnIsAllowed = allowed; - this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_COLUMN_IS_ALLOWED_PROPERTY, old, allowed); - } - - protected boolean buildSpecifiedDiscriminatorColumnIsAllowed() { - return ! this.isTablePerClass() && this.isRoot(); - } - - public boolean discriminatorColumnIsUndefined() { - return this.discriminatorColumnIsUndefined; - } - - protected void setDiscriminatorColumnIsUndefined(boolean undefined) { - boolean old = this.discriminatorColumnIsUndefined; - this.discriminatorColumnIsUndefined = undefined; - this.firePropertyChanged(DISCRIMINATOR_COLUMN_IS_UNDEFINED_PROPERTY, old, undefined); - } - - protected boolean buildDiscriminatorColumnIsUndefined() { - return this.isTablePerClass() || - this.isRootNoDescendantsNoStrategyDefined(); - } - - - // ********** attribute override container ********** - - public OrmAttributeOverrideContainer getAttributeOverrideContainer() { - return this.attributeOverrideContainer; - } - - protected OrmAttributeOverrideContainer buildAttributeOverrideContainer() { - return this.getContextNodeFactory().buildOrmAttributeOverrideContainer(this, new AttributeOverrideContainerOwner()); - } - - protected TypeMapping getOverridableTypeMapping() { - PersistentType superPersistentType = this.getPersistentType().getSuperPersistentType(); - return (superPersistentType == null) ? null : superPersistentType.getMapping(); - } - - protected Column resolveOverriddenColumnForAttributeOverride(String attributeName) { - if ( ! this.isMetadataComplete()) { - JavaPersistentType javaType = this.getJavaPersistentType(); - if (javaType != null) { - Column column = javaType.getMapping().resolveOverriddenColumn(attributeName); - if (column != null) { - return column; - } - } - } - return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName); - } - - protected JavaReadOnlyAttributeOverride getJavaAttributeOverrideNamedForVirtual(String attributeName) { - JavaEntity javaEntity = this.getJavaTypeMappingForDefaults(); - return (javaEntity == null) ? null : javaEntity.getAttributeOverrideContainer().getOverrideNamed(attributeName); - } - - - // ********** association override container ********** - - public OrmAssociationOverrideContainer getAssociationOverrideContainer() { - return this.associationOverrideContainer; - } - - protected OrmAssociationOverrideContainer buildAssociationOverrideContainer() { - return this.getContextNodeFactory().buildOrmAssociationOverrideContainer(this, new AssociationOverrideContainerOwner()); - } - - @Override - public Relationship resolveOverriddenRelationship(String attributeName) { - if (this.isJpa2_0Compatible()) { - // strip off the first segment - int dotIndex = attributeName.indexOf('.'); - if (dotIndex != -1) { - AssociationOverride override = this.associationOverrideContainer.getSpecifiedOverrideNamed(attributeName.substring(dotIndex + 1)); - if (override != null) { - return override.getRelationship(); - } - } - } - return super.resolveOverriddenRelationship(attributeName); - } - - protected Relationship resolveOverriddenRelationshipForAssociationOverride(String attributeName) { - if ( ! this.isMetadataComplete()) { - JavaPersistentType javaType = this.getJavaPersistentType(); - if (javaType != null) { - Relationship relationship = javaType.getMapping().resolveOverriddenRelationship(attributeName); - if (relationship != null) { - return relationship; - } - } - } - return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName); - } - - - // ********** generator container ********** - - public OrmGeneratorContainer getGeneratorContainer() { - return this.generatorContainer; - } - - protected OrmGeneratorContainer buildGeneratorContainer() { - return this.getContextNodeFactory().buildOrmGeneratorContainer(this, this.xmlTypeMapping); - } - - - // ********** query container ********** - - public OrmQueryContainer getQueryContainer() { - return this.queryContainer; - } - - protected OrmQueryContainer buildQueryContainer() { - return this.getContextNodeFactory().buildOrmQueryContainer(this, this.xmlTypeMapping); - } - - - // ********** associated tables ********** - - public Iterator associatedTables() { - return this.getAssociatedTables().iterator(); - } - - public Iterable getAssociatedTables() { - return new CompositeIterable(this.table, this.getSecondaryTables()); - } - - public Iterator allAssociatedTables() { - return new CompositeIterator(this.allAssociatedTablesLists()); - } - - public Iterable getAllAssociatedTables() { - return CollectionTools.iterable(this.allAssociatedTables()); - } - - // TODO eliminate duplicate tables? - protected Iterator> allAssociatedTablesLists() { - return new TransformationIterator>(this.inheritanceHierarchy(), TypeMappingTools.ASSOCIATED_TABLES_TRANSFORMER); - } - - public Iterator allAssociatedTableNames() { - return this.getAllAssociatedTableNames().iterator(); - } - - public Iterable getAllAssociatedTableNames() { - return this.convertToNames(this.getAllAssociatedTables()); - } - - /** - * strip out null names - */ - protected Iterable convertToNames(Iterable tables) { - return new FilteringIterable(this.convertToNames_(tables), NotNullFilter.instance()); - } - - protected Iterable convertToNames_(Iterable tables) { - return new TransformationIterable(tables) { - @Override - protected String transform(ReadOnlyTable t) { - return t.getName(); - } - }; - } - - public boolean tableNameIsInvalid(String tableName) { - return ! this.tableNameIsValid(tableName); - } - - protected boolean tableNameIsValid(String tableName) { - return this.tableIsUndefined || CollectionTools.contains(this.getAllAssociatedTableNames(), tableName); - } - - - // ********** Java ********** - - @Override - public JavaEntity getJavaTypeMapping() { - return (JavaEntity) super.getJavaTypeMapping(); - } - - @Override - public JavaEntity getJavaTypeMappingForDefaults() { - return (JavaEntity) super.getJavaTypeMappingForDefaults(); - } - - - // ********** database ********** - - @Override - public String getPrimaryTableName() { - return this.table.getName(); - } - - @Override - public org.eclipse.jpt.jpa.db.Table getPrimaryDbTable() { - return this.table.getDbTable(); - } - - @Override - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - // matching database objects and identifiers is database platform-specific - return this.getDataSource().selectDatabaseObjectForIdentifier(this.getAllAssociatedDbTables(), tableName); - } - - /** - * strip out null db tables - */ - protected Iterable getAllAssociatedDbTables() { - return new FilteringIterable(this.getAllAssociatedDbTables_(), NotNullFilter.instance()); - } - - protected Iterable getAllAssociatedDbTables_() { - return new TransformationIterable(this.getAllAssociatedTables()) { - @Override - protected org.eclipse.jpt.jpa.db.Table transform(ReadOnlyTable t) { - return t.getDbTable(); - } - }; - } - - @Override - public Schema getDbSchema() { - return this.table.getDbSchema(); - } - - - // ********** primary key ********** - - public String getPrimaryKeyColumnName() { - return MappingTools.getPrimaryKeyColumnName(this); - } - - public PersistentAttribute getIdAttribute() { - Iterator idAttributeMappings = this.getAllAttributeMappings(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY).iterator(); - if (idAttributeMappings.hasNext()) { - PersistentAttribute attribute = idAttributeMappings.next().getPersistentAttribute(); - return idAttributeMappings.hasNext() ? null /*more than one*/: attribute; - } - return null; - } - - - // ********** key ********** - - public String getKey() { - return MappingKeys.ENTITY_TYPE_MAPPING_KEY; - } - - - // ********** entity mappings ********** - - public int getXmlSequence() { - return 1; - } - - public void addXmlTypeMappingTo(XmlEntityMappings entityMappings) { - entityMappings.getEntities().add(this.xmlTypeMapping); - } - - public void removeXmlTypeMappingFrom(XmlEntityMappings entityMappings) { - entityMappings.getEntities().remove(this.xmlTypeMapping); - } - - - // ********** attribute mappings ********** - - @Override - public Column resolveOverriddenColumn(String attributeName) { - if (this.isJpa2_0Compatible()) { - // strip off the first segment - int dotIndex = attributeName.indexOf('.'); - if (dotIndex != -1) { - AttributeOverride override = this.attributeOverrideContainer.getSpecifiedOverrideNamed(attributeName.substring(dotIndex + 1)); - if (override != null) { - return override.getColumn(); - } - } - } - return super.resolveOverriddenColumn(attributeName); - } - - @Override - public Iterator overridableAttributeNames() { - return this.isTablePerClass() ? - super.overridableAttributeNames() : - EmptyIterator.instance(); - } - - @Override - public Iterator overridableAssociationNames() { - return this.isTablePerClass() ? - super.overridableAssociationNames() : - EmptyIterator.instance(); - } - - public AttributeMapping resolveAttributeMapping(String name) { - for (AttributeMapping attributeMapping : CollectionTools.iterable(this.allAttributeMappings())) { - AttributeMapping resolvedMapping = attributeMapping.resolveAttributeMapping(name); - if (resolvedMapping != null) { - return resolvedMapping; - } - } - return null; - } - - - // ********** inheritance ********** - - public Entity getParentEntity() { - for (TypeMapping typeMapping : this.getAncestors()) { - if (typeMapping instanceof Entity) { - return (Entity) typeMapping; - } - } - return null; - } - - /** - * Return whether the entity is the top of an inheritance hierarchy. - */ - public boolean isRoot() { - return this == this.rootEntity; - } - - /** - * Return whether the entity is a descendant in (as opposed to the root of) - * an inheritance hierarchy. - */ - protected boolean isDescendant() { - return ! this.isRoot(); - } - - /** - * Return whether the entity is a descendant of the root entity - * of a "single table" inheritance hierarchy. - */ - protected boolean isSingleTableDescendant() { - return this.isDescendant() && - (this.getInheritanceStrategy() == InheritanceType.SINGLE_TABLE); - } - - /** - * Return whether the entity is the top of an inheritance hierarchy - * and has no descendants and no specified inheritance strategy has been defined. - */ - protected boolean isRootNoDescendantsNoStrategyDefined() { - return this.isRoot() && - this.descendants.isEmpty() && - (this.specifiedInheritanceStrategy == null); - } - - /** - * Return whether the entity is abstract and is a part of a - * "table per class" inheritance hierarchy. - */ - protected boolean isAbstractTablePerClass() { - return this.isAbstract() && this.isTablePerClass(); - } - - protected boolean resourceTableIsSpecified() { - return this.table.isSpecifiedInResource() || this.javaResourceTableIsSpecified(); - } - - protected boolean javaResourceTableIsSpecified() { - JavaEntity javaEntity = this.getJavaTypeMapping(); - return (javaEntity != null) && javaEntity.getTable().isSpecifiedInResource(); - } - - /** - * Return whether the entity is a part of a "table per class" - * inheritance hierarchy. - */ - protected boolean isTablePerClass() { - return this.getInheritanceStrategy() == InheritanceType.TABLE_PER_CLASS; - } - - /** - * Return whether the type is abstract; false if no java type exists. - */ - protected boolean isAbstract() { - JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType(); - return (jrpt != null) && jrpt.isAbstract(); - } - - /** - * Return whether the entity's type is abstract. - */ - protected boolean isFinal() { - JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType(); - return (jrpt != null) && jrpt.isFinal(); - } - - /** - * Return whether the entity's type is a member of another type. - */ - protected boolean isMember() { - JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType(); - return (jrpt != null) && jrpt.isMemberType(); - } - - /** - * Return whether the entity's type is static. - */ - protected boolean isStatic() { - JavaResourcePersistentType jrpt = this.getJavaResourcePersistentType(); - return (jrpt != null) && jrpt.isStatic(); - } - - - // ********** refactoring ********** - - @Override - @SuppressWarnings("unchecked") - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable( - super.createRenameTypeEdits(originalType, newName), - this.createIdClassRenameTypeEdits(originalType, newName)); - } - - protected Iterable createIdClassRenameTypeEdits(IType originalType, String newName) { - return this.idClassReference.createRenameTypeEdits(originalType, newName); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable( - super.createMoveTypeEdits(originalType, newPackage), - this.createIdClassMoveTypeEdits(originalType, newPackage)); - } - - protected Iterable createIdClassMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.idClassReference.createMoveTypeEdits(originalType, newPackage); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable( - super.createRenamePackageEdits(originalPackage, newName), - this.createIdClassRenamePackageEdits(originalPackage, newName)); - } - - protected Iterable createIdClassRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.idClassReference.createRenamePackageEdits(originalPackage, newName); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - - this.validatePrimaryKey(messages, reporter); - this.validateTable(messages, reporter); - for (OrmSecondaryTable secondaryTable : this.getSpecifiedSecondaryTables()) { - secondaryTable.validate(messages, reporter); - } - this.validateInheritance(messages, reporter); - for (OrmPrimaryKeyJoinColumn pkJoinColumn : this.getSpecifiedPrimaryKeyJoinColumns()) { - pkJoinColumn.validate(messages, reporter); - } - this.attributeOverrideContainer.validate(messages, reporter); - this.associationOverrideContainer.validate(messages, reporter); - this.generatorContainer.validate(messages, reporter); - this.queryContainer.validate(messages, reporter); - this.validateEntityName(messages, reporter); - this.validateDuplicateEntityNames(messages, reporter); - } - - protected void validateEntityName(List messages, IReporter reporter) { - if (StringTools.stringIsEmpty(this.getName())){ - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ENTITY_NAME_MISSING, - new String[] {this.getClass_()}, - this, - this.getNameTextRange() - ) - ); - } - } - - protected void validateDuplicateEntityNames(List messages, - IReporter reporter) { - HashBag ormEntityNames = new HashBag(); - CollectionTools.addAll(ormEntityNames, this.getPersistenceUnit().ormEntityNames()); - HashBag javaEntityNamesExclOverridden = new HashBag(); - CollectionTools.addAll(javaEntityNamesExclOverridden, this.getPersistenceUnit().javaEntityNamesExclOverridden()); - String name = this.getName(); - if ((name != null) && - // Check whether or not this entity name has duplicates among the orm entities - ((ormEntityNames.count(name) > 1) - // Check whether or not this entity name has duplicates among - // the java entities that are not defined in the mapping files - || (javaEntityNamesExclOverridden.contains(name)))) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENCE_UNIT_ENTITY_NAME_ATTRIBUTE_MISSING, - new String[] {name}, - this, - this.getClassTextRange() - ) - ); - } - } - - protected void validatePrimaryKey(List messages, IReporter reporter) { - this.buildPrimaryKeyValidator().validate(messages, reporter); - } - - protected JptValidator buildPrimaryKeyValidator() { - return new GenericEntityPrimaryKeyValidator(this, this.buildTextRangeResolver()); - // TODO - JPA 2.0 validation - } - - @Override - protected EntityTextRangeResolver buildTextRangeResolver() { - return new OrmEntityTextRangeResolver(this); - } - - protected void validateTable(List messages, IReporter reporter) { - if (this.isAbstractTablePerClass()) { - if (this.resourceTableIsSpecified()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ENTITY_ABSTRACT_TABLE_PER_CLASS_DEFINES_TABLE, - new String[] {this.getName()}, - this, - this.table.getValidationTextRange() - ) - ); - } - return; - } - if (this.isSingleTableDescendant()) { - if (this.resourceTableIsSpecified()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ENTITY_SINGLE_TABLE_DESCENDANT_DEFINES_TABLE, - new String[] {this.getName()}, - this, - this.table.getValidationTextRange() - ) - ); - } - return; - } - this.table.validate(messages, reporter); - } - - protected void validateInheritance(List messages, IReporter reporter) { - this.validateInheritanceStrategy(messages); - this.validateDiscriminatorColumn(messages, reporter); - this.validateDiscriminatorValue(messages); - } - - protected void validateDiscriminatorColumn(List messages, IReporter reporter) { - if (this.specifiedDiscriminatorColumnIsAllowed && ! this.discriminatorColumnIsUndefined) { - this.discriminatorColumn.validate(messages, reporter); - } - else if (this.discriminatorColumn.isResourceSpecified()) { - if (this.isDescendant()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ENTITY_NON_ROOT_DISCRIMINATOR_COLUMN_DEFINED, - new String[] {this.getName()}, - this, - this.getDiscriminatorColumnTextRange() - ) - ); - } - else if (this.isTablePerClass()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_COLUMN_DEFINED, - new String[] {this.getName()}, - this, - this.getDiscriminatorColumnTextRange() - ) - ); - - } - } - } - - protected void validateDiscriminatorValue(List messages) { - if (this.discriminatorValueIsUndefined && (this.specifiedDiscriminatorValue != null)) { - if (this.isAbstract()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - JpaValidationMessages.ENTITY_ABSTRACT_DISCRIMINATOR_VALUE_DEFINED, - new String[] {this.getName()}, - this, - this.getDiscriminatorValueTextRange() - ) - ); - } - else if (this.isTablePerClass()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - JpaValidationMessages.ENTITY_TABLE_PER_CLASS_DISCRIMINATOR_VALUE_DEFINED, - new String[] {this.getName()}, - this, - this.getDiscriminatorValueTextRange() - ) - ); - } - } - } - - protected void validateInheritanceStrategy(List messages) { - Supported tablePerConcreteClassInheritanceIsSupported = this.getJpaPlatformVariation().getTablePerConcreteClassInheritanceIsSupported(); - if (tablePerConcreteClassInheritanceIsSupported == Supported.YES) { - return; - } - if ((this.getInheritanceStrategy() == InheritanceType.TABLE_PER_CLASS) && this.isRoot()) { - if (tablePerConcreteClassInheritanceIsSupported == Supported.NO) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ENTITY_TABLE_PER_CLASS_NOT_SUPPORTED_ON_PLATFORM, - new String[] {this.getName()}, - this, - this.getInheritanceStrategyTextRange() - ) - ); - } - else { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - JpaValidationMessages.ENTITY_TABLE_PER_CLASS_NOT_PORTABLE_ON_PLATFORM, - new String[] {this.getName()}, - this, - this.getInheritanceStrategyTextRange() - ) - ); - } - } - } - - protected TextRange getDiscriminatorValueTextRange() { - return this.xmlTypeMapping.getDiscriminatorValueTextRange(); - } - - protected TextRange getDiscriminatorColumnTextRange() { - return this.xmlTypeMapping.getDiscriminatorColumn().getValidationTextRange(); - } - - protected TextRange getInheritanceStrategyTextRange() { - return this.xmlTypeMapping.getInheritanceStrategyTextRange(); - } - - - // ********** OrmOverrideContainer.Owner implementation ********** - - /** - * some common behavior - */ - protected abstract class OverrideContainerOwner - implements OrmOverrideContainer.Owner - { - public OrmTypeMapping getTypeMapping() { - return AbstractOrmEntity.this; - } - - public TextRange getValidationTextRange() { - return AbstractOrmEntity.this.getValidationTextRange(); - } - - public TypeMapping getOverridableTypeMapping() { - return AbstractOrmEntity.this.getOverridableTypeMapping(); - } - - public Iterator allOverridableNames() { - TypeMapping typeMapping = this.getOverridableTypeMapping(); - return (typeMapping != null) ? this.allOverridableNames_(typeMapping) : EmptyIterator.instance(); - } - - /** - * pre-condition: typeMapping is not null - */ - protected abstract Iterator allOverridableNames_(TypeMapping typeMapping); - - public String getDefaultTableName() { - return AbstractOrmEntity.this.getPrimaryTableName(); - } - - public boolean tableNameIsInvalid(String tableName) { - return AbstractOrmEntity.this.tableNameIsInvalid(tableName); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return AbstractOrmEntity.this.resolveDbTable(tableName); - } - - public Iterator candidateTableNames() { - return AbstractOrmEntity.this.allAssociatedTableNames(); - } - } - - - // ********** OrmAttributeOverrideContainer.Owner implementation ********** - - protected class AttributeOverrideContainerOwner - extends OverrideContainerOwner - implements OrmAttributeOverrideContainer.Owner - { - @Override - protected Iterator allOverridableNames_(TypeMapping typeMapping) { - final Collection mappedByRelationshipAttributes = CollectionTools.collection( - new TransformationIterator(this.getMapsIdRelationships()) { - @Override - protected String transform(SingleRelationshipMapping2_0 mapping) { - return mapping.getDerivedIdentity().getMapsIdDerivedIdentityStrategy().getValue(); - } - }); - return new FilteringIterator(typeMapping.allOverridableAttributeNames()) { - @Override - protected boolean accept(String name) { - if (mappedByRelationshipAttributes.isEmpty()) { - return true; - } - // overridable names are (usually?) qualified with a container mapping, - // which may also be the one mapped by a relationship - int index = name.indexOf('.'); - String qualifier = (index > 0) ? name.substring(0, index) : name; - return ! mappedByRelationshipAttributes.contains(qualifier); - } - }; - } - - protected Iterable getMapsIdRelationships() { - return new FilteringIterable(this.getSingleRelationshipMappings()) { - @Override - protected boolean accept(SingleRelationshipMapping2_0 mapping) { - return mapping.getDerivedIdentity().usesMapsIdDerivedIdentityStrategy(); - } - }; - } - - protected Iterable getSingleRelationshipMappings() { - return new SubIterableWrapper(this.getSingleRelationshipMappings_()); - } - - @SuppressWarnings("unchecked") - protected Iterable getSingleRelationshipMappings_() { - return new CompositeIterable( - this.getTypeMapping().getAllAttributeMappings(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY), - this.getTypeMapping().getAllAttributeMappings(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) - ); - } - - public EList getXmlOverrides() { - return AbstractOrmEntity.this.xmlTypeMapping.getAttributeOverrides(); - } - - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new AttributeOverrideValidator((AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new MappedSuperclassOverrideDescriptionProvider()); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) { - return new AttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new EntityTableDescriptionProvider()); - } - - public Column resolveOverriddenColumn(String attributeName) { - return AbstractOrmEntity.this.resolveOverriddenColumnForAttributeOverride(attributeName); - } - } - - - // ********** OrmAssociationOverrideContainer.Owner implementation ********** - - protected class AssociationOverrideContainerOwner - extends OverrideContainerOwner - implements OrmAssociationOverrideContainer.Owner - { - @Override - protected Iterator allOverridableNames_(TypeMapping typeMapping) { - return typeMapping.allOverridableAssociationNames(); - } - - public EList getXmlOverrides() { - return AbstractOrmEntity.this.xmlTypeMapping.getAssociationOverrides(); - } - - public Relationship resolveOverriddenRelationship(String attributeName) { - return AbstractOrmEntity.this.resolveOverriddenRelationshipForAssociationOverride(attributeName); - } - - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new AssociationOverrideValidator((AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new MappedSuperclassOverrideDescriptionProvider()); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); - } - - public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); - } - - public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideInverseJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); - } - - public JptValidator buildTableValidator(AssociationOverride override, Table t, TableTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinTableValidator(override, (JoinTable) t, textRangeResolver); - } - } - - - // ********** OrmNamedColumn.Owner implementation ********** - - /** - * some common behavior - */ - protected abstract class NamedColumnOwner - implements OrmNamedColumn.Owner - { - public TypeMapping getTypeMapping() { - return AbstractOrmEntity.this; - } - - public String getDefaultTableName() { - return AbstractOrmEntity.this.getPrimaryTableName(); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return AbstractOrmEntity.this.resolveDbTable(tableName); - } - - public TextRange getValidationTextRange() { - return AbstractOrmEntity.this.getValidationTextRange(); - } - } - - - // ********** OrmBaseJoinColumn.Owner implementation ********** - - protected class PrimaryKeyJoinColumnOwner - extends NamedColumnOwner - implements OrmBaseJoinColumn.Owner - { - public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() { - Entity parentEntity = AbstractOrmEntity.this.getParentEntity(); - return (parentEntity == null) ? null : parentEntity.getPrimaryDbTable(); - } - - public int joinColumnsSize() { - return AbstractOrmEntity.this.primaryKeyJoinColumnsSize(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return CollectionTools.contains(AbstractOrmEntity.this.defaultPrimaryKeyJoinColumns(), joinColumn); - } - - public String getDefaultColumnName() { - if (this.joinColumnsSize() != 1) { - return null; - } - Entity parentEntity = AbstractOrmEntity.this.getParentEntity(); - return (parentEntity == null) ? AbstractOrmEntity.this.getPrimaryKeyColumnName() : parentEntity.getPrimaryKeyColumnName(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new EntityPrimaryKeyJoinColumnValidator((BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver); - } - } - - - // ********** OrmDiscriminatorColumn.Owner implementation ********** - - protected class DiscriminatorColumnOwner - extends NamedColumnOwner - implements OrmDiscriminatorColumn.Owner - { - public String getDefaultColumnName() { - if (this.getXmlColumn() == null) { - JavaEntity javaEntity = this.getJavaEntityForDefaults(); - if (javaEntity != null) { - String name = javaEntity.getDiscriminatorColumn().getSpecifiedName(); - if (name != null) { - return name; - } - } - } - return AbstractOrmEntity.this.isDescendant() ? - this.getRootDiscriminatorColumn().getName() : - this.isTablePerClass() ? null : DiscriminatorColumn.DEFAULT_NAME; - } - - public int getDefaultLength() { - if (this.getXmlColumn() == null) { - JavaEntity javaEntity = this.getJavaEntityForDefaults(); - if (javaEntity != null) { - Integer length = javaEntity.getDiscriminatorColumn().getSpecifiedLength(); - if (length != null) { - return length.intValue(); - } - } - } - return AbstractOrmEntity.this.isDescendant() ? - this.getRootDiscriminatorColumn().getLength() : - this.isTablePerClass() ? 0 : DiscriminatorColumn.DEFAULT_LENGTH; - } - - public DiscriminatorType getDefaultDiscriminatorType() { - if (this.getXmlColumn() == null) { - JavaEntity javaEntity = this.getJavaEntityForDefaults(); - if (javaEntity != null) { - DiscriminatorType dt = javaEntity.getDiscriminatorColumn().getSpecifiedDiscriminatorType(); - if (dt != null) { - return dt; - } - } - } - return AbstractOrmEntity.this.isDescendant() ? - this.getRootDiscriminatorColumn().getDiscriminatorType() : - this.isTablePerClass() ? null : DiscriminatorColumn.DEFAULT_DISCRIMINATOR_TYPE; - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new DiscriminatorColumnValidator(column, textRangeResolver); - } - - public XmlDiscriminatorColumn getXmlColumn() { - return this.getXmlEntity().getDiscriminatorColumn(); - } - - public XmlDiscriminatorColumn buildXmlColumn() { - XmlDiscriminatorColumn xmlColumn = OrmFactory.eINSTANCE.createXmlDiscriminatorColumn(); - this.getXmlEntity().setDiscriminatorColumn(xmlColumn); - return xmlColumn; - } - - public void removeXmlColumn() { - this.getXmlEntity().setDiscriminatorColumn(null); - } - - protected XmlEntity getXmlEntity() { - return AbstractOrmEntity.this.getXmlTypeMapping(); - } - - protected DiscriminatorColumn getRootDiscriminatorColumn() { - return AbstractOrmEntity.this.rootEntity.getDiscriminatorColumn(); - } - - protected boolean isMetadataComplete() { - return AbstractOrmEntity.this.isMetadataComplete(); - } - - protected boolean isTablePerClass() { - return AbstractOrmEntity.this.isTablePerClass(); - } - - protected JavaEntity getJavaEntityForDefaults() { - return AbstractOrmEntity.this.getJavaTypeMappingForDefaults(); - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java deleted file mode 100644 index 1a57454851..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmGenerator.java +++ /dev/null @@ -1,224 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Generator; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmGenerator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.resource.orm.XmlGenerator; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; - -/** - * orm.xml sequence or table generator - */ -public abstract class AbstractOrmGenerator - extends AbstractOrmXmlContextNode - implements OrmGenerator -{ - protected final X xmlGenerator; - - protected String name; - - protected Integer specifiedInitialValue; - protected int defaultInitialValue; - - protected Integer specifiedAllocationSize; - protected int defaultAllocationSize; - - - protected AbstractOrmGenerator(XmlContextNode parent, X xmlGenerator) { - super(parent); - this.xmlGenerator = xmlGenerator; - this.name = xmlGenerator.getName(); - this.specifiedInitialValue = xmlGenerator.getInitialValue(); - this.specifiedAllocationSize = xmlGenerator.getAllocationSize(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setName_(this.xmlGenerator.getName()); - this.setSpecifiedInitialValue_(this.xmlGenerator.getInitialValue()); - this.setSpecifiedAllocationSize_(this.xmlGenerator.getAllocationSize()); - } - - @Override - public void update() { - super.update(); - this.setDefaultInitialValue(this.buildDefaultInitialValue()); - this.setDefaultAllocationSize(this.buildDefaultAllocationSize()); - this.getPersistenceUnit().addGenerator(this); - } - - - // ********** name ********** - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.setName_(name); - this.xmlGenerator.setName(name); - } - - protected void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - - // ********** initial value ********** - - public int getInitialValue() { - return (this.specifiedInitialValue != null) ? this.specifiedInitialValue.intValue() : this.defaultInitialValue; - } - - public Integer getSpecifiedInitialValue() { - return this.specifiedInitialValue; - } - - public void setSpecifiedInitialValue(Integer specifiedInitialValue) { - this.setSpecifiedInitialValue_(specifiedInitialValue); - this.xmlGenerator.setInitialValue(specifiedInitialValue); - } - - protected void setSpecifiedInitialValue_(Integer specifiedInitialValue) { - Integer old = this.specifiedInitialValue; - this.specifiedInitialValue = specifiedInitialValue; - this.firePropertyChanged(SPECIFIED_INITIAL_VALUE_PROPERTY, old, specifiedInitialValue); - } - - public int getDefaultInitialValue() { - return this.defaultInitialValue; - } - - protected void setDefaultInitialValue(int defaultInitialValue) { - int old = this.defaultInitialValue; - this.defaultInitialValue = defaultInitialValue; - this.firePropertyChanged(DEFAULT_INITIAL_VALUE_PROPERTY, old, defaultInitialValue); - } - - protected abstract int buildDefaultInitialValue(); - - - // ********** allocation size ********** - - public int getAllocationSize() { - return (this.specifiedAllocationSize != null) ? this.specifiedAllocationSize.intValue() : this.defaultAllocationSize; - } - - public Integer getSpecifiedAllocationSize() { - return this.specifiedAllocationSize; - } - - public void setSpecifiedAllocationSize(Integer specifiedAllocationSize) { - this.setSpecifiedAllocationSize_(specifiedAllocationSize); - this.xmlGenerator.setAllocationSize(specifiedAllocationSize); - } - - protected void setSpecifiedAllocationSize_(Integer specifiedAllocationSize) { - Integer old = this.specifiedAllocationSize; - this.specifiedAllocationSize = specifiedAllocationSize; - this.firePropertyChanged(SPECIFIED_ALLOCATION_SIZE_PROPERTY, old, specifiedAllocationSize); - } - - public int getDefaultAllocationSize() { - return this.defaultAllocationSize; - } - - protected void setDefaultAllocationSize(int defaultAllocationSize) { - int old = this.defaultAllocationSize; - this.defaultAllocationSize = defaultAllocationSize; - this.firePropertyChanged(DEFAULT_ALLOCATION_SIZE_PROPERTY, old, defaultAllocationSize); - } - - protected int buildDefaultAllocationSize() { - return DEFAULT_ALLOCATION_SIZE; - } - - - // ********** text ranges ********** - - public TextRange getValidationTextRange() { - TextRange validationTextRange = this.xmlGenerator.getValidationTextRange(); - return (validationTextRange != null) ? validationTextRange : this.getParent().getValidationTextRange(); - } - - public TextRange getNameTextRange() { - TextRange nameTextRange = this.xmlGenerator.getNameTextRange(); - return (nameTextRange != null) ? nameTextRange : this.getValidationTextRange(); - } - - - // ********** database stuff ********** - - public Schema getDbSchema() { - SchemaContainer dbSchemaContainer = this.getDbSchemaContainer(); - return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema()); - } - - /** - * If we don't have a catalog (i.e. we don't even have a default catalog), - * then the database probably does not support catalogs; and we need to - * get the schema directly from the database. - */ - public SchemaContainer getDbSchemaContainer() { - String catalog = this.getCatalog(); - return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase(); - } - - protected abstract String getSchema(); - - /** - * If we don't have a catalog (i.e. we don't even have a default - * catalog), then the database probably does not support catalogs. - */ - public Catalog getDbCatalog() { - String catalog = this.getCatalog(); - return (catalog == null) ? null : this.resolveDbCatalog(catalog); - } - - protected abstract String getCatalog(); - - - // ********** misc ********** - - public X getXmlGenerator() { - return this.xmlGenerator; - } - - @Override - public XmlContextNode getParent() { - return (XmlContextNode) super.getParent(); - } - - public boolean overrides(Generator other) { - return MappingTools.nodeOverrides(this, other, PRECEDENCE_TYPE_LIST); - } - - public boolean duplicates(Generator other) { - return MappingTools.nodesAreDuplicates(this, other); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java deleted file mode 100644 index 6b01a760a2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmIdMapping.java +++ /dev/null @@ -1,508 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmColumnMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratedValue; -import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratorContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmIdMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmConverter; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.IdMapping2_0; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue; -import org.eclipse.jpt.jpa.core.resource.orm.XmlId; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.osgi.util.NLS; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml ID mapping - */ -public abstract class AbstractOrmIdMapping - extends AbstractOrmAttributeMapping - implements OrmIdMapping, IdMapping2_0 -{ - protected final OrmColumn column; - - protected final OrmGeneratorContainer generatorContainer; - - protected OrmGeneratedValue generatedValue; - - protected OrmConverter converter; // never null - - /* 2.0 feature - a relationship may map this ID */ - protected boolean mappedByRelationship; - - - protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] { - OrmTemporalConverter.Adapter.instance(), - }; - protected static final Iterable CONVERTER_ADAPTERS = new ArrayIterable(CONVERTER_ADAPTER_ARRAY); - - - protected AbstractOrmIdMapping(OrmPersistentAttribute parent, X xmlMapping) { - super(parent, xmlMapping); - this.column = this.buildColumn(); - this.generatorContainer = this.buildGeneratorContainer(); - this.generatedValue = this.buildGeneratedValue(); - this.converter = this.buildConverter(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.column.synchronizeWithResourceModel(); - this.generatorContainer.synchronizeWithResourceModel(); - this.syncGeneratedValue(); - this.syncConverter(); - } - - @Override - public void update() { - super.update(); - this.column.update(); - this.generatorContainer.update(); - if (this.generatedValue != null) { - this.generatedValue.update(); - } - this.converter.update(); - this.setMappedByRelationship(this.buildMappedByRelationship()); - } - - - // ********** column ********** - - public OrmColumn getColumn() { - return this.column; - } - - protected OrmColumn buildColumn() { - return this.getContextNodeFactory().buildOrmColumn(this, this); - } - - - // ********** generator container ********** - - public OrmGeneratorContainer getGeneratorContainer() { - return this.generatorContainer; - } - - protected OrmGeneratorContainer buildGeneratorContainer() { - return this.getContextNodeFactory().buildOrmGeneratorContainer(this, this.xmlAttributeMapping); - } - - - // ********** generated value ********** - - public OrmGeneratedValue getGeneratedValue() { - return this.generatedValue; - } - - public OrmGeneratedValue addGeneratedValue() { - if (this.generatedValue != null) { - throw new IllegalStateException("generated value already exists: " + this.generatedValue); //$NON-NLS-1$ - } - XmlGeneratedValue xmlGeneratedValue = this.buildXmlGeneratedValue(); - OrmGeneratedValue value = this.buildGeneratedValue(xmlGeneratedValue); - this.setGeneratedValue(value); - this.xmlAttributeMapping.setGeneratedValue(xmlGeneratedValue); - return value; - } - - protected XmlGeneratedValue buildXmlGeneratedValue() { - return OrmFactory.eINSTANCE.createXmlGeneratedValue(); - } - - public void removeGeneratedValue() { - if (this.generatedValue == null) { - throw new IllegalStateException("generated value does not exist"); //$NON-NLS-1$ - } - this.setGeneratedValue(null); - this.xmlAttributeMapping.setGeneratedValue(null); - } - - protected void setGeneratedValue(OrmGeneratedValue value) { - OrmGeneratedValue old = this.generatedValue; - this.generatedValue = value; - this.firePropertyChanged(GENERATED_VALUE_PROPERTY, old, value); - } - - protected OrmGeneratedValue buildGeneratedValue() { - XmlGeneratedValue xmlGeneratedValue = this.xmlAttributeMapping.getGeneratedValue(); - return (xmlGeneratedValue == null) ? null : this.buildGeneratedValue(xmlGeneratedValue); - } - - protected OrmGeneratedValue buildGeneratedValue(XmlGeneratedValue xmlGeneratedValue) { - return this.getContextNodeFactory().buildOrmGeneratedValue(this, xmlGeneratedValue); - } - - protected void syncGeneratedValue() { - XmlGeneratedValue xmlGeneratedValue = this.xmlAttributeMapping.getGeneratedValue(); - if (xmlGeneratedValue == null) { - if (this.generatedValue != null) { - this.setGeneratedValue(null); - } - } else { - if ((this.generatedValue != null) && (this.generatedValue.getXmlGeneratedValue() == xmlGeneratedValue)) { - this.generatedValue.synchronizeWithResourceModel(); - } else { - this.setGeneratedValue(this.buildGeneratedValue(xmlGeneratedValue)); - } - } - } - - - // ********** converter ********** - - public OrmConverter getConverter() { - return this.converter; - } - - public void setConverter(Class converterType) { - if (this.converter.getType() != converterType) { - // note: we may also clear the XML value we want; - // but if we leave it, the resulting sync will screw things up... - this.clearXmlConverterValues(); - OrmConverter.Adapter converterAdapter = this.getConverterAdapter(converterType); - this.setConverter_(this.buildConverter(converterAdapter)); - this.converter.initialize(); - } - } - - protected OrmConverter buildConverter(OrmConverter.Adapter converterAdapter) { - return (converterAdapter != null) ? - converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) : - this.buildNullConverter(); - } - - protected void setConverter_(OrmConverter converter) { - Converter old = this.converter; - this.converter = converter; - this.firePropertyChanged(CONVERTER_PROPERTY, old, converter); - } - - protected void clearXmlConverterValues() { - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - adapter.clearXmlValue(this.xmlAttributeMapping); - } - } - - protected OrmConverter buildConverter() { - OrmXmlContextNodeFactory factory = this.getContextNodeFactory(); - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - OrmConverter ormConverter = adapter.buildConverter(this, factory); - if (ormConverter != null) { - return ormConverter; - } - } - return this.buildNullConverter(); - } - - protected void syncConverter() { - OrmConverter.Adapter adapter = this.getXmlConverterAdapter(); - if (adapter == null) { - if (this.converter.getType() != null) { - this.setConverter_(this.buildNullConverter()); - } - } else { - if (this.converter.getType() == adapter.getConverterType()) { - this.converter.synchronizeWithResourceModel(); - } else { - this.setConverter_(adapter.buildNewConverter(this, this.getContextNodeFactory())); - } - } - } - - /** - * Return the first adapter whose converter value is set in the XML mapping. - * Return null if there are no converter values in the XML. - */ - protected OrmConverter.Adapter getXmlConverterAdapter() { - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.isActive(this.xmlAttributeMapping)) { - return adapter; - } - } - return null; - } - - protected OrmConverter buildNullConverter() { - return new NullOrmConverter(this); - } - - - // ********** converter adapters ********** - - /** - * Return the converter adapter for the specified converter type. - */ - protected OrmConverter.Adapter getConverterAdapter(Class converterType) { - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.getConverterType() == converterType) { - return adapter; - } - } - return null; - } - - protected Iterable getConverterAdapters() { - return CONVERTER_ADAPTERS; - } - - - // ********** mapped by relationship ********** - - public boolean isMappedByRelationship() { - return this.mappedByRelationship; - } - - protected void setMappedByRelationship(boolean value) { - boolean old = this.mappedByRelationship; - this.mappedByRelationship = value; - this.firePropertyChanged(MAPPED_BY_RELATIONSHIP_PROPERTY, old, value); - } - - protected boolean buildMappedByRelationship() { - return this.isJpa2_0Compatible() && this.buildMappedByRelationship_(); - } - - protected boolean buildMappedByRelationship_() { - return CollectionTools.contains(this.getMappedByRelationshipAttributeNames(), this.getName()); - } - - protected Iterable getMappedByRelationshipAttributeNames() { - return TypeMappingTools.getMappedByRelationshipAttributeNames(this.getTypeMapping()); - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY; - } - - public int getXmlSequence() { - return 0; - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmIdMapping(this); - } - - @Override - protected void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) { - super.initializeFromOrmColumnMapping(oldMapping); - this.column.initializeFrom(oldMapping.getColumn()); - } - - @Override - public String getPrimaryKeyColumnName() { - return this.column.getName(); - } - - @Override - public boolean isOverridableAttributeMapping() { - return true; - } - - public void addXmlAttributeMappingTo(Attributes resourceAttributes) { - resourceAttributes.getIds().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) { - resourceAttributes.getIds().remove(this.xmlAttributeMapping); - } - - - // ********** OrmColumn.Owner implementation ********** - - public String getDefaultColumnName() { - return (this.mappedByRelationship && ! this.isColumnSpecified()) ? null : this.name; - } - - public String getDefaultTableName() { - return (this.mappedByRelationship && ! this.isColumnSpecified()) ? null : this.getTypeMapping().getPrimaryTableName(); - } - - public Table resolveDbTable(String tableName) { - return this.getTypeMapping().resolveDbTable(tableName); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getTypeMapping().tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return this.getTypeMapping().allAssociatedTableNames(); - } - - public XmlColumn getXmlColumn() { - return this.xmlAttributeMapping.getColumn(); - } - - public XmlColumn buildXmlColumn() { - XmlColumn xmlColumn = OrmFactory.eINSTANCE.createXmlColumn(); - this.xmlAttributeMapping.setColumn(xmlColumn); - return xmlColumn; - } - - public void removeXmlColumn() { - this.xmlAttributeMapping.setColumn(null); - } - - protected boolean isColumnSpecified() { - return this.getXmlColumn() != null; - } - - - // ********** refactoring ********** - - @Override - @SuppressWarnings("unchecked") - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable( - super.createRenameTypeEdits(originalType, newName), - this.createConverterRenameTypeEdits(originalType, newName) - ); - } - - protected Iterable createConverterRenameTypeEdits(IType originalType, String newName) { - return (this.converter != null) ? - this.converter.createRenameTypeEdits(originalType, newName) : - EmptyIterable.instance(); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable( - super.createMoveTypeEdits(originalType, newPackage), - this.createConverterMoveTypeEdits(originalType, newPackage) - ); - } - - protected Iterable createConverterMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return (this.converter != null) ? - this.converter.createMoveTypeEdits(originalType, newPackage) : - EmptyIterable.instance(); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable( - super.createRenamePackageEdits(originalPackage, newName), - this.createConverterRenamePackageEdits(originalPackage, newName) - ); - } - - protected Iterable createConverterRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return (this.converter != null) ? - this.converter.createRenamePackageEdits(originalPackage, newName) : - EmptyIterable.instance(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - - // [JPA 2.0] if the column is specified, or if the id is not mapped by a relationship, - // then the column is validated. - // (In JPA 1.0, the column will always be validated, since the id is never mapped by a - // relationship) - if (this.isColumnSpecified() || ! this.isMappedByRelationship()) { - this.column.validate(messages, reporter); - } - - // [JPA 2.0] if the column is specified and the id is mapped by a relationship, - // then that is an error - // (In JPA 1.0, this will never be the case, since the id is never mapped by a relationship) - if (this.isColumnSpecified() && this.isMappedByRelationship()) { - messages.add(this.buildMappedByRelationshipAndColumnSpecifiedMessage()); - } - - if (this.generatedValue != null) { - this.generatedValue.validate(messages, reporter); - } - this.generatorContainer.validate(messages, reporter); - this.converter.validate(messages, reporter); - } - - protected IMessage buildMappedByRelationshipAndColumnSpecifiedMessage() { - return this.buildMessage( - JpaValidationMessages.ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_COLUMN_SPECIFIED, - EMPTY_STRING_ARRAY, - this.column.getValidationTextRange() - ); - } - - protected IMessage buildMessage(String msgID, String[] parms, TextRange textRange) { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - msgID, - ArrayTools.add(parms, 0, this.buildAttributeDescription()), - this, - textRange - ); - } - - protected String buildAttributeDescription() { - return NLS.bind(this.getAttributeDescriptionTemplate(), this.getPersistentAttribute().getName()); - } - - protected String getAttributeDescriptionTemplate() { - return this.getPersistentAttribute().isVirtual() ? - JpaValidationDescriptionMessages.VIRTUAL_ATTRIBUTE_DESC : - JpaValidationDescriptionMessages.ATTRIBUTE_DESC; - } - - public JptValidator buildColumnValidator(NamedColumn col, NamedColumnTextRangeResolver textRangeResolver) { - return new NamedColumnValidator(this.getPersistentAttribute(), (BaseColumn) col, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java deleted file mode 100644 index 80c03483f2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,332 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumnContainer; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class AbstractOrmJoinColumnRelationshipStrategy - extends AbstractOrmXmlContextNode - implements OrmJoinColumnRelationshipStrategy -{ - protected final Vector specifiedJoinColumns = new Vector(); - protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter; - protected final OrmJoinColumn.Owner joinColumnOwner; - - protected OrmJoinColumn defaultJoinColumn; - - - protected AbstractOrmJoinColumnRelationshipStrategy(OrmJoinColumnRelationship parent) { - super(parent); - this.specifiedJoinColumnContainerAdapter = this.buildSpecifiedJoinColumnContainerAdapter(); - this.joinColumnOwner = this.buildJoinColumnOwner(); - this.initializeSpecifiedJoinColumns(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncSpecifiedJoinColumns(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getSpecifiedJoinColumns()); - this.updateDefaultJoinColumn(); - } - - - // ********** XML join column container ********** - - protected XmlJoinColumnContainer getXmlJoinColumnContainer() { - return this.getRelationship().getXmlContainer(); - } - - - // ********** join columns ********** - - public ListIterator joinColumns() { - return this.getJoinColumns().iterator(); - } - - protected ListIterable getJoinColumns() { - return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns(); - } - - public int joinColumnsSize() { - return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize(); - } - - - // ********** specified join columns ********** - - public ListIterator specifiedJoinColumns() { - return this.getSpecifiedJoinColumns().iterator(); - } - - protected ListIterable getSpecifiedJoinColumns() { - return new LiveCloneListIterable(this.specifiedJoinColumns); - } - - public int specifiedJoinColumnsSize() { - return this.specifiedJoinColumns.size(); - } - - public boolean hasSpecifiedJoinColumns() { - return this.specifiedJoinColumns.size() != 0; - } - - public OrmJoinColumn getSpecifiedJoinColumn(int index) { - return this.specifiedJoinColumns.get(index); - } - - public OrmJoinColumn addSpecifiedJoinColumn() { - return this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size()); - } - - public OrmJoinColumn addSpecifiedJoinColumn(int index) { - XmlJoinColumn xmlJoinColumn = this.buildXmlJoinColumn(); - OrmJoinColumn joinColumn = this.addSpecifiedJoinColumn_(index, xmlJoinColumn); - this.getXmlJoinColumnContainer().getJoinColumns().add(index, xmlJoinColumn); - return joinColumn; - } - - protected XmlJoinColumn buildXmlJoinColumn() { - return OrmFactory.eINSTANCE.createXmlJoinColumn(); - } - - public void removeSpecifiedJoinColumn(JoinColumn joinColumn) { - this.removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn)); - } - - public void removeSpecifiedJoinColumn(int index) { - this.removeSpecifiedJoinColumn_(index); - this.getXmlJoinColumnContainer().getJoinColumns().remove(index); - } - - protected void removeSpecifiedJoinColumn_(int index) { - this.removeItemFromList(index, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - this.getXmlJoinColumnContainer().getJoinColumns().move(targetIndex, sourceIndex); - } - - protected void initializeSpecifiedJoinColumns() { - for (XmlJoinColumn xmlJoinColumn : this.getXmlJoinColumns()) { - this.specifiedJoinColumns.add(this.buildJoinColumn(xmlJoinColumn)); - } - } - - protected void syncSpecifiedJoinColumns() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedJoinColumnContainerAdapter); - } - - protected Iterable getXmlJoinColumns() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.getXmlJoinColumnContainer().getJoinColumns()); - } - - protected void moveSpecifiedJoinColumn_(int index, OrmJoinColumn joinColumn) { - this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - protected OrmJoinColumn addSpecifiedJoinColumn_(int index, XmlJoinColumn xmlJoinColumn) { - OrmJoinColumn joinColumn = this.buildJoinColumn(xmlJoinColumn); - this.addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - return joinColumn; - } - - protected void removeSpecifiedJoinColumn_(OrmJoinColumn joinColumn) { - this.removeSpecifiedJoinColumn_(this.specifiedJoinColumns.indexOf(joinColumn)); - } - - protected SpecifiedJoinColumnContainerAdapter buildSpecifiedJoinColumnContainerAdapter() { - return new SpecifiedJoinColumnContainerAdapter(); - } - - /** - * specified join column container adapter - */ - protected class SpecifiedJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractOrmJoinColumnRelationshipStrategy.this.getSpecifiedJoinColumns(); - } - public Iterable getResourceElements() { - return AbstractOrmJoinColumnRelationshipStrategy.this.getXmlJoinColumns(); - } - public XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) { - return contextElement.getXmlColumn(); - } - public void moveContextElement(int index, OrmJoinColumn element) { - AbstractOrmJoinColumnRelationshipStrategy.this.moveSpecifiedJoinColumn_(index, element); - } - public void addContextElement(int index, XmlJoinColumn resourceElement) { - AbstractOrmJoinColumnRelationshipStrategy.this.addSpecifiedJoinColumn_(index, resourceElement); - } - public void removeContextElement(OrmJoinColumn element) { - AbstractOrmJoinColumnRelationshipStrategy.this.removeSpecifiedJoinColumn_(element); - } - } - - protected abstract OrmJoinColumn.Owner buildJoinColumnOwner(); - - - // ********** default join column ********** - - public OrmJoinColumn getDefaultJoinColumn() { - return this.defaultJoinColumn; - } - - protected void setDefaultJoinColumn(OrmJoinColumn joinColumn) { - OrmJoinColumn old = this.defaultJoinColumn; - this.defaultJoinColumn = joinColumn; - this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn); - } - - protected ListIterable getDefaultJoinColumns() { - return (this.defaultJoinColumn != null) ? - new SingleElementListIterable(this.defaultJoinColumn) : - EmptyListIterable.instance(); - } - - protected int getDefaultJoinColumnsSize() { - return (this.defaultJoinColumn == null) ? 0 : 1; - } - - protected void updateDefaultJoinColumn() { - if (this.buildsDefaultJoinColumn()) { - if (this.defaultJoinColumn == null) { - this.setDefaultJoinColumn(this.buildJoinColumn(null)); - } else { - this.defaultJoinColumn.update(); - } - } else { - this.setDefaultJoinColumn(null); - } - } - - protected boolean buildsDefaultJoinColumn() { - return ! this.hasSpecifiedJoinColumns() && - this.getRelationship().mayHaveDefaultJoinColumn(); - } - - - // ********** misc ********** - - @Override - public OrmJoinColumnRelationship getParent() { - return (OrmJoinColumnRelationship) super.getParent(); - } - - public OrmJoinColumnRelationship getRelationship() { - return this.getParent(); - } - - protected OrmJoinColumn buildJoinColumn(XmlJoinColumn xmlJoinColumn) { - return this.getContextNodeFactory().buildOrmJoinColumn(this, this.joinColumnOwner, xmlJoinColumn); - } - - public void initializeFrom(ReadOnlyJoinColumnRelationshipStrategy oldStrategy) { - for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldStrategy.specifiedJoinColumns())) { - this.addSpecifiedJoinColumn().initializeFrom(joinColumn); - } - } - - public void initializeFromVirtual(ReadOnlyJoinColumnRelationshipStrategy virtualStrategy) { - for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualStrategy.joinColumns())) { - this.addSpecifiedJoinColumn().initializeFromVirtual(joinColumn); - } - } - - protected RelationshipMapping getRelationshipMapping() { - return this.getRelationship().getMapping(); - } - - public String getTableName() { - TypeMapping typeMapping = this.getRelationshipSource(); - return (typeMapping == null) ? null : typeMapping.getPrimaryTableName(); - } - - public Table resolveDbTable(String tableName) { - TypeMapping typeMapping = this.getRelationshipSource(); - return (typeMapping == null) ? null : typeMapping.resolveDbTable(tableName); - } - - public boolean tableNameIsInvalid(String tableName) { - TypeMapping typeMapping = this.getRelationshipSource(); - return (typeMapping != null) && typeMapping.tableNameIsInvalid(tableName); - } - - // subclasses like this to be public - public Table getReferencedColumnDbTable() { - TypeMapping relationshipTarget = this.getRelationshipTarget(); - return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable(); - } - - protected Iterator candidateTableNames() { - TypeMapping typeMapping = this.getRelationshipSource(); - return (typeMapping != null) ? typeMapping.allAssociatedTableNames() : EmptyIterator.instance(); - } - - public void addStrategy() { - if (this.specifiedJoinColumnsSize() == 0) { - this.addSpecifiedJoinColumn(); - } - } - - public void removeStrategy() { - for (int i = this.specifiedJoinColumns.size(); i-- > 0; ) { - this.removeSpecifiedJoinColumn(i); - } - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - for (OrmJoinColumn joinColumn : this.getJoinColumns()) { - joinColumn.validate(messages, reporter); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinTableRelationshipStrategy.java deleted file mode 100644 index 922e5bcd64..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmJoinTableRelationshipStrategy.java +++ /dev/null @@ -1,194 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable; -import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTableContainer; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class AbstractOrmJoinTableRelationshipStrategy - extends AbstractOrmXmlContextNode - implements OrmJoinTableRelationshipStrategy, Table.Owner -{ - protected OrmJoinTable joinTable; - - - protected AbstractOrmJoinTableRelationshipStrategy(OrmJoinTableRelationship parent) { - super(parent); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - if (this.joinTable != null) { - this.joinTable.synchronizeWithResourceModel(); - } - } - - @Override - public void update() { - super.update(); - this.updateJoinTable(); - } - - - // ********** join table ********** - - public OrmJoinTable getJoinTable() { - return this.joinTable; - } - - protected void setJoinTable(OrmJoinTable joinTable) { - OrmJoinTable old = this.joinTable; - this.joinTable = joinTable; - this.firePropertyChanged(JOIN_TABLE_PROPERTY, old, joinTable); - } - - protected void updateJoinTable() { - if (this.buildsJoinTable()) { - if (this.joinTable == null) { - this.setJoinTable(this.buildJoinTable()); - } else { - this.joinTable.update(); - } - } else { - if (this.joinTable != null) { - this.setJoinTable(null); - } - } - } - - /** - * The strategy can have a join table if either the XML table is present - * or the [mapping] relationship supports a default join table. - */ - protected boolean buildsJoinTable() { - return (this.getXmlJoinTable() != null) || - this.getRelationship().mayHaveDefaultJoinTable(); - } - - protected OrmJoinTable buildJoinTable() { - return this.getContextNodeFactory().buildOrmJoinTable(this, this); - } - - - // ********** XML join table ********** - - public XmlJoinTable getXmlJoinTable() { - return this.getXmlJoinTableContainer().getJoinTable(); - } - - public XmlJoinTable buildXmlJoinTable() { - XmlJoinTable xmlJoinTable = OrmFactory.eINSTANCE.createXmlJoinTable(); - this.getXmlJoinTableContainer().setJoinTable(xmlJoinTable); - return xmlJoinTable; - } - - public void removeXmlJoinTable() { - this.getXmlJoinTableContainer().setJoinTable(null); - } - - protected XmlJoinTableContainer getXmlJoinTableContainer() { - return this.getRelationship().getXmlContainer(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - if (this.joinTable != null) { - this.joinTable.validate(messages, reporter); - } - } - - - // ********** misc ********** - - @Override - public OrmJoinTableRelationship getParent() { - return (OrmJoinTableRelationship) super.getParent(); - } - - public OrmJoinTableRelationship getRelationship() { - return this.getParent(); - } - - protected RelationshipMapping getRelationshipMapping() { - return this.getRelationship().getMapping(); - } - - public void initializeFrom(ReadOnlyJoinTableRelationshipStrategy oldStrategy) { - ReadOnlyJoinTable oldJoinTable = oldStrategy.getJoinTable(); - if (oldJoinTable != null) { - this.addStrategy(); - this.joinTable.initializeFrom(oldJoinTable); - } - } - - public void initializeFromVirtual(ReadOnlyJoinTableRelationshipStrategy virtualStrategy) { - ReadOnlyJoinTable oldJoinTable = virtualStrategy.getJoinTable(); - if (oldJoinTable != null) { - this.addStrategy(); - this.joinTable.initializeFromVirtual(oldJoinTable); - } - } - - public String getTableName() { - return (this.joinTable == null) ? null : this.joinTable.getName(); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return (this.joinTable == null) ? null : this.joinTable.getDbTable(); - } - - public boolean tableNameIsInvalid(String tableName) { - return Tools.valuesAreDifferent(this.getTableName(), tableName); - } - - public String getColumnTableNotValidDescription() { - return JpaValidationDescriptionMessages.DOES_NOT_MATCH_JOIN_TABLE; - } - - public String getJoinTableDefaultName() { - return MappingTools.buildJoinTableDefaultName(this.getRelationship()); - } - - public void addStrategy() { - if (this.joinTable == null) { - this.setJoinTable(this.buildJoinTable()); - this.buildXmlJoinTable(); - } - } - - public void removeStrategy() { - if (this.joinTable != null) { - this.setJoinTable(null); - this.removeXmlJoinTable(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToManyMapping.java deleted file mode 100644 index e131cef90a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToManyMapping.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmMappingRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmManyToManyMapping2_0; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany; - -public abstract class AbstractOrmManyToManyMapping - extends AbstractOrmMultiRelationshipMapping - implements OrmManyToManyMapping2_0 -{ - protected AbstractOrmManyToManyMapping(OrmPersistentAttribute parent, X xmlMapping) { - super(parent, xmlMapping); - } - - - // ********** relationship ********** - - @Override - public OrmManyToManyRelationship getRelationship() { - return (OrmManyToManyRelationship) super.getRelationship(); - } - - @Override - protected OrmMappingRelationship buildRelationship() { - return new GenericOrmManyToManyRelationship(this); - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY; - } - - public int getXmlSequence() { - return 70; - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmManyToManyMapping(this); - } - - public void addXmlAttributeMappingTo(Attributes resourceAttributes) { - resourceAttributes.getManyToManys().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) { - resourceAttributes.getManyToManys().remove(this.xmlAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToOneMapping.java deleted file mode 100644 index d5927bd21d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmManyToOneMapping.java +++ /dev/null @@ -1,66 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmManyToOneMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmManyToOneRelationship2_0; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne; - -/** - * orm.xml 1:1 mapping - */ -public abstract class AbstractOrmManyToOneMapping - extends AbstractOrmSingleRelationshipMapping - implements OrmManyToOneMapping2_0 -{ - protected AbstractOrmManyToOneMapping(OrmPersistentAttribute parent, X xmlMapping) { - super(parent, xmlMapping); - } - - - // ********** relationship ********** - - @Override - protected OrmManyToOneRelationship2_0 buildRelationship() { - return new GenericOrmManyToOneRelationship(this); - } - - @Override - public OrmManyToOneRelationship2_0 getRelationship() { - return (OrmManyToOneRelationship2_0) super.getRelationship(); - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public int getXmlSequence() { - return 40; - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmManyToOneMapping(this); - } - - public void addXmlAttributeMappingTo(Attributes resourceAttributes) { - resourceAttributes.getManyToOnes().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) { - resourceAttributes.getManyToOnes().remove(this.xmlAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java deleted file mode 100644 index 1f503a14be..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappedSuperclass.java +++ /dev/null @@ -1,213 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.ReadOnlyTable; -import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference; -import org.eclipse.jpt.jpa.core.context.java.JavaMappedSuperclass; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmIdClassReference; -import org.eclipse.jpt.jpa.core.context.orm.OrmMappedSuperclass; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericMappedSuperclassPrimaryKeyValidator; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer; -import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml mapped superclass - */ -public abstract class AbstractOrmMappedSuperclass - extends AbstractOrmTypeMapping - implements OrmMappedSuperclass, OrmIdClassReference.Owner -{ - protected final OrmIdClassReference idClassReference; - - - protected AbstractOrmMappedSuperclass(OrmPersistentType parent, X xmlMappedSuperclass) { - super(parent, xmlMappedSuperclass); - this.idClassReference = this.buildIdClassReference(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.idClassReference.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.idClassReference.update(); - } - - - // ********** key ********** - - public String getKey() { - return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY; - } - - - // ********** id class ********** - - public OrmIdClassReference getIdClassReference() { - return this.idClassReference; - } - - protected OrmIdClassReference buildIdClassReference() { - return new GenericOrmIdClassReference(this, this); - } - - public JavaPersistentType getIdClass() { - return this.idClassReference.getIdClass(); - } - - public XmlIdClassContainer getXmlIdClassContainer() { - return this.getXmlTypeMapping(); - } - - public JavaIdClassReference getJavaIdClassReferenceForDefaults() { - JavaMappedSuperclass javaMappedSuperclass = this.getJavaTypeMappingForDefaults(); - return (javaMappedSuperclass == null) ? null : javaMappedSuperclass.getIdClassReference(); - } - - - // ********** entity mappings ********** - - public int getXmlSequence() { - return 0; - } - - public void addXmlTypeMappingTo(XmlEntityMappings entityMappings) { - entityMappings.getMappedSuperclasses().add(this.xmlTypeMapping); - } - - public void removeXmlTypeMappingFrom(XmlEntityMappings entityMappings) { - entityMappings.getMappedSuperclasses().remove(this.xmlTypeMapping); - } - - - // ********** Java ********** - - @Override - public JavaMappedSuperclass getJavaTypeMapping() { - return (JavaMappedSuperclass) super.getJavaTypeMapping(); - } - - @Override - public JavaMappedSuperclass getJavaTypeMappingForDefaults() { - return (JavaMappedSuperclass) super.getJavaTypeMappingForDefaults(); - } - - - // ********** tables ********** - - public Iterator associatedTables() { - return EmptyIterator.instance(); - } - - public Iterator allAssociatedTables() { - return EmptyIterator.instance(); - } - - public Iterator allAssociatedTableNames() { - return EmptyIterator.instance(); - } - - public boolean tableNameIsInvalid(String tableName) { - return false; - } - - - // ********** refactoring ********** - - @Override - @SuppressWarnings("unchecked") - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable( - super.createRenameTypeEdits(originalType, newName), - this.createIdClassReplaceTypeEdits(originalType, newName) - ); - } - - protected Iterable createIdClassReplaceTypeEdits(IType originalType, String newName) { - return this.idClassReference.createRenameTypeEdits(originalType, newName); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable( - super.createMoveTypeEdits(originalType, newPackage), - this.createIdClassMoveTypeEdits(originalType, newPackage) - ); - } - - protected Iterable createIdClassMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.idClassReference.createMoveTypeEdits(originalType, newPackage); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable( - super.createRenamePackageEdits(originalPackage, newName), - this.createIdClassRenamePackageEdits(originalPackage, newName) - ); - } - - protected Iterable createIdClassRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.idClassReference.createRenamePackageEdits(originalPackage, newName); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.validatePrimaryKey(messages, reporter); - } - - @Override - public boolean validatesAgainstDatabase() { - return false; - } - - protected void validatePrimaryKey(List messages, IReporter reporter) { - this.buildPrimaryKeyValidator().validate(messages, reporter); - } - - protected JptValidator buildPrimaryKeyValidator() { - return new GenericMappedSuperclassPrimaryKeyValidator(this, this.buildTextRangeResolver()); - // TODO - JPA 2.0 validation - } - - @Override - protected PrimaryKeyTextRangeResolver buildTextRangeResolver() { - return new OrmMappedSuperclassTextRangeResolver(this); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappingRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappingRelationship.java deleted file mode 100644 index b5cc9a7179..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMappingRelationship.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.MappedByRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship; -import org.eclipse.jpt.jpa.core.context.RelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmMappingRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy; -import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping; - -/** - * NB: Subclasses will want to set the {@link #strategy} at the - * end of their constructors; otherwise, it will be null until it - * is set during {@link #update()}. - */ -public abstract class AbstractOrmMappingRelationship - extends AbstractOrmXmlContextNode - implements OrmMappingRelationship -{ - protected OrmRelationshipStrategy strategy; - - - protected AbstractOrmMappingRelationship(M parent) { - super(parent); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.updateStrategy(); - } - - - // ********** strategy ********** - - public OrmRelationshipStrategy getStrategy() { - return this.strategy; - } - - protected void setStrategy(OrmRelationshipStrategy strategy) { - RelationshipStrategy old = this.strategy; - this.strategy = strategy; - this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy); - } - - protected abstract OrmRelationshipStrategy buildStrategy(); - - /** - * This is called by subclasses when the various supported strategies are - * added or removed; allowing the strategy to be set synchronously. (?) - */ - protected void updateStrategy() { - this.setStrategy(this.buildStrategy()); - } - - - // ********** conversions ********** - - public void initializeFrom(ReadOnlyRelationship oldRelationship) { - oldRelationship.initializeOn(this); - } - - public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) { - // NOP - } - - public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) { - // NOP - } - - public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) { - // NOP - } - - - // ********** misc ********** - - @Override - @SuppressWarnings("unchecked") - public M getParent() { - return (M) super.getParent(); - } - - public M getMapping() { - return this.getParent(); - } - - protected AbstractXmlRelationshipMapping getXmlMapping() { - return this.getMapping().getXmlAttributeMapping(); - } - - public TypeMapping getTypeMapping() { - return this.getMapping().getTypeMapping(); - } - - public Entity getEntity() { - TypeMapping typeMapping = this.getTypeMapping(); - return (typeMapping instanceof Entity) ? (Entity) typeMapping : null; - } - - public boolean isOverridable() { - return this.strategy.isOverridable(); - } - - public boolean isVirtual() { - return this.getMapping().getPersistentAttribute().isVirtual(); - } - - public boolean isTargetForeignKey() { - return false; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return this.getMapping().getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java deleted file mode 100644 index 7179f06f50..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmMultiRelationshipMapping.java +++ /dev/null @@ -1,813 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.AttributeOverride; -import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.Embeddable; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.FetchType; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.OverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmMultiRelationshipMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmOrderable; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.RelationshipStrategyTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentAttribute2_0; -import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlMultiRelationshipMapping; -import org.eclipse.jpt.jpa.core.resource.orm.MapKey; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride; -import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference; -import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml multi-relationship (1:m, m:m) mapping - */ -public abstract class AbstractOrmMultiRelationshipMapping - extends AbstractOrmRelationshipMapping - implements OrmMultiRelationshipMapping, OrmCollectionMapping2_0 -{ - protected final OrmOrderable orderable; - - protected String specifiedMapKey; - protected boolean noMapKey = false; - protected boolean pkMapKey = false; - protected boolean customMapKey = false; - - protected String specifiedMapKeyClass; - protected String defaultMapKeyClass; - - protected Type valueType; - protected Type keyType; - - protected final OrmColumn mapKeyColumn; - - protected final OrmAttributeOverrideContainer mapKeyAttributeOverrideContainer; - - - protected AbstractOrmMultiRelationshipMapping(OrmPersistentAttribute parent, X xmlMapping) { - super(parent, xmlMapping); - this.orderable = this.buildOrderable(); - - this.specifiedMapKey = this.buildSpecifiedMapKey(); - this.noMapKey = this.buildNoMapKey(); - this.pkMapKey = this.buildPkMapKey(); - this.customMapKey = this.buildCustomMapKey(); - - this.specifiedMapKeyClass = this.buildSpecifiedMapKeyClass(); - - this.mapKeyColumn = this.buildMapKeyColumn(); - this.mapKeyAttributeOverrideContainer = this.buildMapKeyAttributeOverrideContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.orderable.synchronizeWithResourceModel(); - - this.setSpecifiedMapKey_(this.buildSpecifiedMapKey()); - this.setNoMapKey_(this.buildNoMapKey()); - this.setPkMapKey_(this.buildPkMapKey()); - this.setCustomMapKey_(this.buildCustomMapKey()); - - this.setSpecifiedMapKeyClass_(this.buildSpecifiedMapKeyClass()); - - this.mapKeyColumn.synchronizeWithResourceModel(); - - this.mapKeyAttributeOverrideContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - - this.orderable.update(); - - this.setDefaultMapKeyClass(this.buildDefaultMapKeyClass()); - - this.setValueType(this.buildValueType()); - this.setKeyType(this.buildKeyType()); - - this.mapKeyColumn.update(); - - this.mapKeyAttributeOverrideContainer.update(); - } - - - // ********** orderable ********** - - public OrmOrderable getOrderable() { - return this.orderable; - } - - protected OrmOrderable buildOrderable() { - return this.isJpa2_0Compatible() ? - this.getContextNodeFactory2_0().buildOrmOrderable(this, this.buildOrderableOwner()) : - this.getContextNodeFactory().buildOrmOrderable(this); - } - - protected Orderable2_0.Owner buildOrderableOwner() { - return new OrderableOwner(); - } - - protected class OrderableOwner - implements Orderable2_0.Owner - { - public String getTableName() { - return this.getRelationshipStrategy().getTableName(); - } - public Table resolveDbTable(String tableName) { - return this.getRelationshipStrategy().resolveDbTable(tableName); - } - protected OrmRelationshipStrategy getRelationshipStrategy() { - return AbstractOrmMultiRelationshipMapping.this.getRelationship().getStrategy(); - } - } - - - // ********** map key ********** - - public String getMapKey() { - if (this.noMapKey) { - return null; - } - if (this.pkMapKey) { - return this.getTargetEntityIdAttributeName(); - } - if (this.customMapKey) { - return this.specifiedMapKey; - } - throw new IllegalStateException("unknown map key"); //$NON-NLS-1$ - } - - - // ********** specified map key ********** - - public String getSpecifiedMapKey() { - return this.specifiedMapKey; - } - - public void setSpecifiedMapKey(String mapKey) { - if (mapKey != null) { - this.setSpecifiedMapKey_(mapKey); - this.setNoMapKey_(false); - this.setPkMapKey_(false); - this.setCustomMapKey_(true); - - MapKey xmlMapKey = this.getXmlMapKey(); - if (xmlMapKey == null) { - xmlMapKey = this.buildXmlMapKey(); - } - xmlMapKey.setName(mapKey); - } else { - this.setPkMapKey(true); // hmmm... - } - } - - protected void setSpecifiedMapKey_(String mapKey) { - String old = this.specifiedMapKey; - this.specifiedMapKey = mapKey; - this.firePropertyChanged(SPECIFIED_MAP_KEY_PROPERTY, old, mapKey); - } - - protected String buildSpecifiedMapKey() { - MapKey xmlMapKey = this.getXmlMapKey(); - return (xmlMapKey == null) ? null : xmlMapKey.getName(); - } - - - // ********** no map key ********** - - public boolean isNoMapKey() { - return this.noMapKey; - } - - public void setNoMapKey(boolean noMapKey) { - if (noMapKey) { - this.setSpecifiedMapKey_(null); - this.setNoMapKey_(true); - this.setPkMapKey_(false); - this.setCustomMapKey_(false); - - if (this.getXmlMapKey() != null) { - this.removeXmlMapKey(); - } - } else { - this.setPkMapKey(true); // hmmm... - } - } - - protected void setNoMapKey_(boolean noMapKey) { - boolean old = this.noMapKey; - this.noMapKey = noMapKey; - this.firePropertyChanged(NO_MAP_KEY_PROPERTY, old, noMapKey); - } - - protected boolean buildNoMapKey() { - return this.getXmlMapKey() == null; - } - - - // ********** pk map key ********** - - public boolean isPkMapKey() { - return this.pkMapKey; - } - - public void setPkMapKey(boolean pkMapKey) { - if (pkMapKey) { - this.setSpecifiedMapKey_(null); - this.setNoMapKey_(false); - this.setPkMapKey_(true); - this.setCustomMapKey_(false); - - MapKey xmlMapKey = this.getXmlMapKey(); - if (xmlMapKey == null) { - this.buildXmlMapKey(); - } else { - xmlMapKey.setName(null); - } - } else { - this.setNoMapKey(true); // hmmm... - } - } - - protected void setPkMapKey_(boolean pkMapKey) { - boolean old = this.pkMapKey; - this.pkMapKey = pkMapKey; - this.firePropertyChanged(PK_MAP_KEY_PROPERTY, old, pkMapKey); - } - - protected boolean buildPkMapKey() { - MapKey xmlMapKey = this.getXmlMapKey(); - return (xmlMapKey != null) && (xmlMapKey.getName() == null); - } - - - // ********** custom map key ********** - - public boolean isCustomMapKey() { - return this.customMapKey; - } - - public void setCustomMapKey(boolean customMapKey) { - if (customMapKey) { - this.setSpecifiedMapKey(""); //$NON-NLS-1$ - } else { - this.setNoMapKey(true); // hmmm... - } - } - - protected void setCustomMapKey_(boolean customMapKey) { - boolean old = this.customMapKey; - this.customMapKey = customMapKey; - this.firePropertyChanged(CUSTOM_MAP_KEY_PROPERTY, old, customMapKey); - } - - protected boolean buildCustomMapKey() { - MapKey xmlMapKey = this.getXmlMapKey(); - return (xmlMapKey != null) && (xmlMapKey.getName() != null); - } - - - // ********** xml map key ********** - - protected MapKey getXmlMapKey() { - return this.xmlAttributeMapping.getMapKey(); - } - - protected MapKey buildXmlMapKey() { - MapKey mapKey = OrmFactory.eINSTANCE.createMapKey(); - this.xmlAttributeMapping.setMapKey(mapKey); - return mapKey; - } - - protected void removeXmlMapKey() { - this.xmlAttributeMapping.setMapKey(null); - } - - - // ********** map key class ********** - - public String getMapKeyClass() { - return (this.specifiedMapKeyClass != null) ? this.specifiedMapKeyClass : this.defaultMapKeyClass; - } - - public String getSpecifiedMapKeyClass() { - return this.specifiedMapKeyClass; - } - - public void setSpecifiedMapKeyClass(String mapKeyClass) { - if (this.setSpecifiedMapKeyClass_(mapKeyClass)) { - XmlClassReference xmlClassRef = this.xmlAttributeMapping.getMapKeyClass(); - if (mapKeyClass == null) { - if (xmlClassRef != null) { - this.xmlAttributeMapping.setMapKeyClass(null); - } - } else { - if (xmlClassRef == null) { - xmlClassRef = this.buildXmlMapKeyClassReference(); - } - xmlClassRef.setClassName(mapKeyClass); - } - } - } - - protected boolean setSpecifiedMapKeyClass_(String mapKeyClass) { - String old = this.specifiedMapKeyClass; - this.specifiedMapKeyClass = mapKeyClass; - return this.firePropertyChanged(SPECIFIED_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass); - } - - protected XmlClassReference buildXmlMapKeyClassReference() { - XmlClassReference mapKeyClass = OrmFactory.eINSTANCE.createXmlClassReference(); - this.xmlAttributeMapping.setMapKeyClass(mapKeyClass); - return mapKeyClass; - } - - protected String buildSpecifiedMapKeyClass() { - XmlClassReference xmlClassRef = this.xmlAttributeMapping.getMapKeyClass(); - return (xmlClassRef == null) ? null : xmlClassRef.getClassName(); - } - - public String getDefaultMapKeyClass() { - return this.defaultMapKeyClass; - } - - protected void setDefaultMapKeyClass(String mapKeyClass) { - String old = this.defaultMapKeyClass; - this.defaultMapKeyClass = mapKeyClass; - this.firePropertyChanged(DEFAULT_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass); - } - - protected String buildDefaultMapKeyClass() { - JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute(); - return (javaAttribute == null) ? null : javaAttribute.getMultiReferenceMapKeyTypeName(); - } - - public char getMapKeyClassEnclosingTypeSeparator() { - return '$'; - } - - - // ********** resolved map key embeddable/entity ********** - - protected Embeddable getResolvedMapKeyEmbeddable() { - TypeMapping typeMapping = this.getResolvedMapKeyTypeMapping(); - return (typeMapping instanceof Embeddable) ? (Embeddable) typeMapping : null; - } - - protected Entity getResolvedMapKeyEntity() { - TypeMapping typeMapping = this.getResolvedMapKeyTypeMapping(); - return (typeMapping instanceof Entity) ? (Entity) typeMapping : null; - } - - protected TypeMapping getResolvedMapKeyTypeMapping() { - PersistentType resolvedMapKeyType = this.getResolvedMapKeyType(); - return (resolvedMapKeyType == null) ? null : resolvedMapKeyType.getMapping(); - } - - protected PersistentType getResolvedMapKeyType() { - return this.resolvePersistentType(this.getMapKeyClass()); - } - - - // ********** value type ********** - - public Type getValueType() { - return this.valueType; - } - - protected void setValueType(Type valueType) { - Type old = this.valueType; - this.valueType = valueType; - this.firePropertyChanged(VALUE_TYPE_PROPERTY, old, valueType); - } - - protected Type buildValueType() { - if (this.getResolvedTargetEntity() != null) { - return Type.ENTITY_TYPE; - } - if (this.getResolvedTargetEmbeddable() != null) { - return Type.EMBEDDABLE_TYPE; - } - if (this.getTargetEntity() == null) { - return Type.NO_TYPE; - } - return Type.BASIC_TYPE; - } - - protected Embeddable getResolvedTargetEmbeddable() { - TypeMapping typeMapping = this.getResolvedTargetTypeMapping(); - return (typeMapping instanceof Embeddable) ? (Embeddable) typeMapping : null; - } - - - // ********** key type ********** - - public Type getKeyType() { - return this.keyType; - } - - protected void setKeyType(Type keyType) { - Type old = this.keyType; - this.keyType = keyType; - this.firePropertyChanged(KEY_TYPE_PROPERTY, old, keyType); - } - - protected Type buildKeyType() { - if (this.getResolvedMapKeyEmbeddable() != null) { - return Type.EMBEDDABLE_TYPE; - } - if (this.getResolvedMapKeyEntity() != null) { - return Type.ENTITY_TYPE; - } - if (this.getMapKeyClass() == null) { - return Type.NO_TYPE; - } - return Type.BASIC_TYPE; - } - - - // ********** map key column ********** - - public OrmColumn getMapKeyColumn() { - return this.mapKeyColumn; - } - - protected OrmColumn buildMapKeyColumn() { - return this.getContextNodeFactory().buildOrmColumn(this, this.buildMapKeyColumnOwner()); - } - - protected OrmColumn.Owner buildMapKeyColumnOwner() { - return new MapKeyColumnOwner(); - } - - protected XmlColumn getXmlMapKeyColumn() { - return this.xmlAttributeMapping.getMapKeyColumn(); - } - - protected XmlColumn buildXmlMapKeyColumn() { - XmlColumn xmlColumn = OrmFactory.eINSTANCE.createXmlColumn(); - this.xmlAttributeMapping.setMapKeyColumn(xmlColumn); - return xmlColumn; - } - - protected void removeXmlMapKeyColumn() { - this.xmlAttributeMapping.setMapKeyColumn(null); - } - - - // ********** map key attribute override container ********** - - public OrmAttributeOverrideContainer getMapKeyAttributeOverrideContainer() { - return this.mapKeyAttributeOverrideContainer; - } - - protected OrmAttributeOverrideContainer buildMapKeyAttributeOverrideContainer() { - return this.getContextNodeFactory().buildOrmAttributeOverrideContainer(this, this.buildMapKeyAttributeOverrideContainerOwner()); - } - - protected OrmAttributeOverrideContainer.Owner buildMapKeyAttributeOverrideContainerOwner() { - return new MapKeyAttributeOverrideContainerOwner(); - } - - protected JavaAttributeOverride getSpecifiedJavaMapKeyAttributeOverrideNamed(String attributeName) { - JavaCollectionMapping2_0 javaCollectionMapping = this.getJavaCollectionMapping(); - return (javaCollectionMapping == null) ? null : - javaCollectionMapping.getMapKeyAttributeOverrideContainer().getSpecifiedOverrideNamed(attributeName); - } - - protected JavaCollectionMapping2_0 getJavaCollectionMapping() { - AttributeMapping javaAttributeMapping = this.getJavaAttributeMapping(); - return (javaAttributeMapping.getKey() == this.getKey()) ? - (JavaCollectionMapping2_0) javaAttributeMapping : - null; - } - - protected AttributeMapping getJavaAttributeMapping() { - JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute(); - return (javaAttribute == null) ? null : javaAttribute.getMapping(); - } - - - // ********** misc ********** - - /** - * pre-condition: the mapping's Java persistent attribute is not - * null. - */ - @Override - protected String getJavaTargetType() { - return this.getJavaPersistentAttribute().getMultiReferenceTargetTypeName(); - } - - @Override - protected FetchType buildDefaultFetch() { - return DEFAULT_FETCH_TYPE; - } - - public Iterator candidateMapKeyNames() { - return this.allTargetEntityAttributeNames(); - } - - - // ********** metamodel ********** - - @Override - protected String getMetamodelFieldTypeName() { - return ((OrmPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldTypeName(); - } - - @Override - protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList typeArgumentNames) { - this.addMetamodelFieldMapKeyTypeArgumentNameTo(typeArgumentNames); - super.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames); - } - - protected void addMetamodelFieldMapKeyTypeArgumentNameTo(ArrayList typeArgumentNames) { - String keyTypeName = ((OrmPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldMapKeyTypeName(); - if (keyTypeName != null) { - typeArgumentNames.add(keyTypeName); - } - } - - public String getMetamodelFieldMapKeyTypeName() { - return MappingTools.getMetamodelFieldMapKeyTypeName(this); - } - - - //************* refactoring ************* - - @Override - @SuppressWarnings("unchecked") - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable( - super.createRenameTypeEdits(originalType, newName), - this.createMapKeyClassRenameTypeEdits(originalType, newName) - ); - } - - protected Iterable createMapKeyClassRenameTypeEdits(IType originalType, String newName) { - if (this.specifiedMapKeyClass != null) { - PersistentType mapKeyType = this.getResolvedMapKeyType(); - if ((mapKeyType != null) && mapKeyType.isFor(originalType.getFullyQualifiedName('.'))) { - return new SingleElementIterable(this.createMapKeyClassRenameTypeEdit(originalType, newName)); - } - } - return EmptyIterable.instance(); - } - - protected ReplaceEdit createMapKeyClassRenameTypeEdit(IType originalType, String newName) { - return this.xmlAttributeMapping.createRenameMapKeyClassEdit(originalType, newName); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable( - super.createMoveTypeEdits(originalType, newPackage), - this.createMapKeyClassMoveTypeEdits(originalType, newPackage) - ); - } - - protected Iterable createMapKeyClassMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - if (this.specifiedMapKeyClass != null) { - PersistentType mapKeyType = this.getResolvedMapKeyType(); - if ((mapKeyType != null) && mapKeyType.isFor(originalType.getFullyQualifiedName('.'))) { - return new SingleElementIterable(this.createMapKeyClassRenamePackageEdit(newPackage.getElementName())); - } - } - return EmptyIterable.instance(); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable( - super.createRenamePackageEdits(originalPackage, newName), - this.createMapKeyClassRenamePackageEdits(originalPackage, newName) - ); - } - - protected Iterable createMapKeyClassRenamePackageEdits(IPackageFragment originalPackage, String newName) { - if (this.specifiedMapKeyClass != null) { - PersistentType mapKeyType = this.getResolvedMapKeyType(); - if ((mapKeyType != null) && mapKeyType.isIn(originalPackage)) { - return new SingleElementIterable(this.createMapKeyClassRenamePackageEdit(newName)); - } - } - return EmptyIterable.instance(); - } - - protected ReplaceEdit createMapKeyClassRenamePackageEdit(String newName) { - return this.xmlAttributeMapping.createRenameMapKeyClassPackageEdit(newName); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.orderable.validate(messages, reporter); - this.validateMapKey(messages, reporter); - } - - public void validateMapKey(List messages, IReporter reporter) { - if (this.getMapKey() != null) { - //TODO validate that the map key refers to an existing attribute - return; - } - if (this.keyType == Type.BASIC_TYPE) { - this.mapKeyColumn.validate(messages, reporter); - //validate map key converter - } - else if (this.keyType == Type.ENTITY_TYPE) { - //validate map key join columns - } - else if (this.keyType == Type.EMBEDDABLE_TYPE) { - this.mapKeyAttributeOverrideContainer.validate(messages, reporter); - //validate map key association overrides - } - } - - - // ********** abstract owner ********** - - /** - * some common behavior - */ - protected class AbstractOwner - { - public OrmTypeMapping getTypeMapping() { - return AbstractOrmMultiRelationshipMapping.this.getTypeMapping(); - } - - public String getDefaultTableName() { - return this.getRelationshipStrategy().getTableName(); - } - - public Table resolveDbTable(String tableName) { - return this.getRelationshipStrategy().resolveDbTable(tableName); - } - - public Iterator candidateTableNames() { - return EmptyIterator.instance(); - } - - public TextRange getValidationTextRange() { - return AbstractOrmMultiRelationshipMapping.this.getValidationTextRange(); - } - - protected OrmRelationshipStrategy getRelationshipStrategy() { - return AbstractOrmMultiRelationshipMapping.this.getRelationship().getStrategy(); - } - - protected String getMappingName() { - return AbstractOrmMultiRelationshipMapping.this.getName(); - } - - protected boolean mappingIsVirtual() { - return AbstractOrmMultiRelationshipMapping.this.isVirtual(); - } - - protected OrmPersistentAttribute getPersistentAttribute() { - return AbstractOrmMultiRelationshipMapping.this.getPersistentAttribute(); - } - } - - - // ********** map key column owner ********** - - protected class MapKeyColumnOwner - extends AbstractOwner - implements OrmColumn.Owner - { - public String getDefaultColumnName() { - return this.getMappingName() + "_KEY"; //$NON-NLS-1$ - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getRelationshipStrategy().tableNameIsInvalid(tableName); - } - - public XmlColumn getXmlColumn() { - return AbstractOrmMultiRelationshipMapping.this.getXmlMapKeyColumn(); - } - - public XmlColumn buildXmlColumn() { - return AbstractOrmMultiRelationshipMapping.this.buildXmlMapKeyColumn(); - } - - public void removeXmlColumn() { - AbstractOrmMultiRelationshipMapping.this.removeXmlMapKeyColumn(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new MapKeyColumnValidator(this.getPersistentAttribute(), (BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new RelationshipStrategyTableDescriptionProvider(this.getRelationshipStrategy())); - } - } - - - // ********** map key attribute override container owner ********** - - protected class MapKeyAttributeOverrideContainerOwner - extends AbstractOwner - implements OrmAttributeOverrideContainer.Owner - { - public TypeMapping getOverridableTypeMapping() { - return AbstractOrmMultiRelationshipMapping.this.getResolvedMapKeyEmbeddable(); - } - - public Iterator allOverridableNames() { - TypeMapping typeMapping = this.getOverridableTypeMapping(); - return (typeMapping != null) ? typeMapping.allOverridableAttributeNames() : EmptyIterator.instance(); - } - - protected JavaAttributeOverride getSpecifiedJavaAttributeOverrideNamed(String attributeName) { - return AbstractOrmMultiRelationshipMapping.this.getSpecifiedJavaMapKeyAttributeOverrideNamed(attributeName); - } - - public EList getXmlOverrides() { - return AbstractOrmMultiRelationshipMapping.this.xmlAttributeMapping.getMapKeyAttributeOverrides(); - } - - public Column resolveOverriddenColumn(String attributeName) { - if (this.mappingIsVirtual() && ! this.getTypeMapping().isMetadataComplete()) { - JavaAttributeOverride javaOverride = this.getSpecifiedJavaAttributeOverrideNamed(attributeName); - if (javaOverride != null) { - return javaOverride.getColumn(); - } - } - return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName); - } - - /** - * If there is a specified table name it needs to be the same - * the default table name. the table is always the collection table - */ - public boolean tableNameIsInvalid(String tableName) { - return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName); - } - - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new MapKeyAttributeOverrideValidator(this.getPersistentAttribute(), (AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) { - return new MapKeyAttributeOverrideColumnValidator(this.getPersistentAttribute(), (AttributeOverride) override, column, textRangeResolver, new RelationshipStrategyTableDescriptionProvider(this.getRelationshipStrategy())); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java deleted file mode 100644 index 7bee99543e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmNamedColumn.java +++ /dev/null @@ -1,287 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmNamedColumn; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn; -import org.eclipse.jpt.jpa.db.Column; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml

    - *
  • column - *
  • join column - *
  • discriminator column - *
  • order column - *
  • primary key join column - *
- * NB: any subclass that directly holds its XML column must:
    - *
  • call the "super" constructor that takes an XML column - * {@link #AbstractOrmNamedColumn(XmlContextNode, OrmNamedColumn.Owner, AbstractXmlNamedColumn)} - *
  • override {@link #setXmlColumn(AbstractXmlNamedColumn)} to set the XML column - * so it is in place before the column's state (e.g. {@link #specifiedName}) - * is initialized - *
- * Typically, a column belonging to a list of columns will directly hold its XML - * column; since the context column only exists if the XML column exists. - */ -public abstract class AbstractOrmNamedColumn - extends AbstractOrmXmlContextNode - implements OrmNamedColumn -{ - protected final O owner; - - protected String specifiedName; - protected String defaultName; - - protected String columnDefinition; - - - // ********** constructor/initialization ********** - - protected AbstractOrmNamedColumn(XmlContextNode parent, O owner) { - this(parent, owner, null); - } - - protected AbstractOrmNamedColumn(XmlContextNode parent, O owner, X xmlColumn) { - super(parent); - this.owner = owner; - this.setXmlColumn(xmlColumn); - this.specifiedName = this.buildSpecifiedName(); - this.columnDefinition = this.buildColumnDefinition(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedName_(this.buildSpecifiedName()); - this.setColumnDefinition_(this.buildColumnDefinition()); - } - - @Override - public void update() { - super.update(); - this.setDefaultName(this.buildDefaultName()); - } - - - // ********** XML column ********** - - /** - * Return null if XML column does not exists. - */ - public abstract X getXmlColumn(); - - /** - * see class comment... - */ - protected void setXmlColumn(X xmlColumn) { - if (xmlColumn != null) { - throw new IllegalArgumentException("this method must be overridden if the XML column is not null: " + xmlColumn); //$NON-NLS-1$ - } - } - - /** - * Build the XML column if it does not exist. - */ - protected X getXmlColumnForUpdate() { - X xmlColumn = this.getXmlColumn(); - return (xmlColumn != null) ? xmlColumn : this.buildXmlColumn(); - } - - protected abstract X buildXmlColumn(); - - protected void removeXmlColumnIfUnset() { - if (this.getXmlColumn().isUnset()) { - this.removeXmlColumn(); - } - } - - protected abstract void removeXmlColumn(); - - - // ********** name ********** - - public String getName() { - return (this.specifiedName != null) ? this.specifiedName : this.defaultName; - } - - public String getSpecifiedName() { - return this.specifiedName; - } - - public void setSpecifiedName(String name) { - if (this.valuesAreDifferent(this.specifiedName, name)) { - X xmlColumn = this.getXmlColumnForUpdate(); - this.setSpecifiedName_(name); - xmlColumn.setName(name); - this.removeXmlColumnIfUnset(); - } - } - - protected void setSpecifiedName_(String name) { - String old = this.specifiedName; - this.specifiedName = name; - this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedName() { - X xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getName(); - } - - public String getDefaultName() { - return this.defaultName; - } - - protected void setDefaultName(String name) { - String old = this.defaultName; - this.defaultName = name; - this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name); - } - - protected String buildDefaultName() { - return this.owner.getDefaultColumnName(); - } - - - // ********** column definition ********** - - public String getColumnDefinition() { - return this.columnDefinition; - } - - public void setColumnDefinition(String columnDefinition) { - if (this.valuesAreDifferent(this.columnDefinition, columnDefinition)) { - X xmlColumn = this.getXmlColumnForUpdate(); - this.setColumnDefinition_(columnDefinition); - xmlColumn.setColumnDefinition(columnDefinition); - this.removeXmlColumnIfUnset(); - } - } - - protected void setColumnDefinition_(String columnDefinition) { - String old = this.columnDefinition; - this.columnDefinition = columnDefinition; - this.firePropertyChanged(COLUMN_DEFINITION_PROPERTY, old, columnDefinition); - } - - protected String buildColumnDefinition() { - X xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getColumnDefinition(); - } - - - // ********** database stuff ********** - - protected Column getDbColumn() { - Table table = this.getDbTable(); - return (table == null) ? null : table.getColumnForIdentifier(this.getName()); - } - - public Table getDbTable() { - return this.owner.resolveDbTable(this.getTable()); - } - - /** - * Return the name of the column's table. This is overridden in - * {@link AbstractOrmBaseColumn} (and other places) where a table can be - * defined. - */ - public String getTable() { - return this.owner.getTypeMapping().getPrimaryTableName(); - } - - public boolean isResolved() { - return this.getDbColumn() != null; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.buildColumnValidator().validate(messages, reporter); - } - - protected JptValidator buildColumnValidator() { - return this.owner.buildColumnValidator(this, this.buildTextRangeResolver()); - } - - protected NamedColumnTextRangeResolver buildTextRangeResolver() { - return new OrmNamedColumnTextRangeResolver(this); - } - - public TextRange getValidationTextRange() { - return this.getTextRange(this.getXmlColumnTextRange()); - } - - protected TextRange getXmlColumnTextRange() { - X xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getValidationTextRange(); - } - - public TextRange getNameTextRange() { - return this.getTextRange(this.getXmlColumnNameTextRange()); - } - - protected TextRange getXmlColumnNameTextRange() { - X xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getNameTextRange(); - } - - protected TextRange getTextRange(TextRange textRange) { - return (textRange != null) ? textRange : this.owner.getValidationTextRange(); - } - - - // ********** misc ********** - - @Override - public XmlContextNode getParent() { - return (XmlContextNode) super.getParent(); - } - - public boolean isVirtual() { - return false; - } - - protected void initializeFrom(ReadOnlyNamedColumn oldColumn) { - this.setSpecifiedName(oldColumn.getSpecifiedName()); - this.setColumnDefinition(oldColumn.getColumnDefinition()); - } - - protected void initializeFromVirtual(ReadOnlyNamedColumn virtualColumn) { - this.setSpecifiedName(virtualColumn.getName()); - this.setColumnDefinition(virtualColumn.getColumnDefinition()); - } - - @Override - public void toString(StringBuilder sb) { - String table = this.getTable(); - if (table != null) { - sb.append(table); - sb.append('.'); - } - sb.append(this.getName()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToManyMapping.java deleted file mode 100644 index 3bfa99022a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToManyMapping.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.NullOrmOrphanRemoval2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToManyMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToManyRelationship2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany; - - -public abstract class AbstractOrmOneToManyMapping - extends AbstractOrmMultiRelationshipMapping - implements OrmOneToManyMapping2_0, OrmOrphanRemovalHolder2_0 -{ - protected final OrmOrphanRemovable2_0 orphanRemoval; - - - protected AbstractOrmOneToManyMapping(OrmPersistentAttribute parent, X xmlMapping) { - super(parent, xmlMapping); - this.orphanRemoval = this.buildOrphanRemoval(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.orphanRemoval.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.orphanRemoval.update(); - } - - - // ********** orphan removal ********** - - public OrmOrphanRemovable2_0 getOrphanRemoval() { - return this.orphanRemoval; - } - - protected OrmOrphanRemovable2_0 buildOrphanRemoval() { - return this.isJpa2_0Compatible() ? - this.getContextNodeFactory2_0().buildOrmOrphanRemoval(this) : - new NullOrmOrphanRemoval2_0(this); - } - - - // ********** relationship ********** - - @Override - protected OrmOneToManyRelationship2_0 buildRelationship() { - return new GenericOrmOneToManyRelationship(this, this.isJpa2_0Compatible()); - } - - @Override - public OrmOneToManyRelationship2_0 getRelationship() { - return (OrmOneToManyRelationship2_0) super.getRelationship(); - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY; - } - - public int getXmlSequence() { - return 50; - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmOneToManyMapping(this); - } - - public void addXmlAttributeMappingTo(Attributes resourceAttributes) { - resourceAttributes.getOneToManys().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) { - resourceAttributes.getOneToManys().remove(this.xmlAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToOneMapping.java deleted file mode 100644 index 5305983e1c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmOneToOneMapping.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmMappingRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.NullOrmOrphanRemoval2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToOneMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToOneRelationship2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne; - -/** - * orm.xml 1:1 mapping - */ -public abstract class AbstractOrmOneToOneMapping - extends AbstractOrmSingleRelationshipMapping - implements OrmOneToOneMapping2_0, OrmOrphanRemovalHolder2_0 -{ - protected final OrmOrphanRemovable2_0 orphanRemoval; - - - protected AbstractOrmOneToOneMapping(OrmPersistentAttribute parent, X xmlMapping) { - super(parent, xmlMapping); - this.orphanRemoval = this.buildOrphanRemoval(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.orphanRemoval.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.orphanRemoval.update(); - } - - - // ********** orphan removal ********** - - public OrmOrphanRemovable2_0 getOrphanRemoval() { - return this.orphanRemoval; - } - - protected OrmOrphanRemovable2_0 buildOrphanRemoval() { - return this.isJpa2_0Compatible() ? - this.getContextNodeFactory2_0().buildOrmOrphanRemoval(this) : - new NullOrmOrphanRemoval2_0(this); - } - - - // ********** relationship ********** - - @Override - public OrmOneToOneRelationship2_0 getRelationship() { - return (OrmOneToOneRelationship2_0) super.getRelationship(); - } - - @Override - protected OrmMappingRelationship buildRelationship() { - return new GenericOrmOneToOneRelationship(this); - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public int getXmlSequence() { - return 60; - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmOneToOneMapping(this); - } - - public void addXmlAttributeMappingTo(Attributes resourceAttributes) { - resourceAttributes.getOneToOnes().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) { - resourceAttributes.getOneToOnes().remove(this.xmlAttributeMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java deleted file mode 100644 index df72433811..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmQuery.java +++ /dev/null @@ -1,239 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Vector; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jpa.core.context.Query; -import org.eclipse.jpt.jpa.core.context.QueryHint; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmQuery; -import org.eclipse.jpt.jpa.core.context.orm.OrmQueryHint; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlQuery; -import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint; - -/** - * orm.xml query - */ -public abstract class AbstractOrmQuery - extends AbstractOrmXmlContextNode - implements OrmQuery -{ - protected final X xmlQuery; - - protected String name; - - protected String query; - - protected final Vector hints = new Vector(); - protected final HintContainerAdapter hintContainerAdapter = new HintContainerAdapter(); - - - protected AbstractOrmQuery(XmlContextNode parent, X xmlQuery) { - super(parent); - this.xmlQuery = xmlQuery; - this.name = xmlQuery.getName(); - this.query = xmlQuery.getQuery(); - this.initializeHints(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setName_(this.xmlQuery.getName()); - this.setQuery_(this.xmlQuery.getQuery()); - this.syncHints(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getHints()); - this.getPersistenceUnit().addQuery(this); - } - - - // ********** name ********** - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.setName_(name); - this.xmlQuery.setName(name); - } - - protected void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - - // ********** query ********** - - public String getQuery() { - return this.query; - } - - public void setQuery(String query) { - this.setQuery_(query); - this.xmlQuery.setQuery(query); - } - - protected void setQuery_(String query) { - String old = this.query; - this.query = query; - this.firePropertyChanged(QUERY_PROPERTY, old, query); - } - - - // ********** hints ********** - - public ListIterable getHints() { - return new LiveCloneListIterable(this.hints); - } - - public int getHintsSize() { - return this.hints.size(); - } - - public OrmQueryHint addHint() { - return this.addHint(this.hints.size()); - } - - public OrmQueryHint addHint(int index) { - XmlQueryHint xmlHint = this.buildXmlQueryHint(); - OrmQueryHint hint = this.addHint_(index, xmlHint); - this.xmlQuery.getHints().add(index, xmlHint); - return hint; - } - - protected XmlQueryHint buildXmlQueryHint() { - return OrmFactory.eINSTANCE.createXmlQueryHint(); - } - - public void removeHint(QueryHint hint) { - this.removeHint(this.hints.indexOf(hint)); - } - - public void removeHint(int index) { - this.removeHint_(index); - this.xmlQuery.getHints().remove(index); - } - - protected void removeHint_(int index) { - this.removeItemFromList(index, this.hints, HINTS_LIST); - } - - public void moveHint(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.hints, HINTS_LIST); - this.xmlQuery.getHints().move(targetIndex, sourceIndex); - } - - protected void initializeHints() { - for (XmlQueryHint xmlHint : this.getXmlHints()) { - this.hints.add(this.buildHint(xmlHint)); - } - } - - protected OrmQueryHint buildHint(XmlQueryHint xmlHint) { - return this.getContextNodeFactory().buildOrmQueryHint(this, xmlHint); - } - - protected void syncHints() { - ContextContainerTools.synchronizeWithResourceModel(this.hintContainerAdapter); - } - - protected Iterable getXmlHints() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.xmlQuery.getHints()); - } - - protected void moveHint_(int index, OrmQueryHint hint) { - this.moveItemInList(index, hint, this.hints, HINTS_LIST); - } - - protected OrmQueryHint addHint_(int index, XmlQueryHint xmlHint) { - OrmQueryHint hint = this.buildHint(xmlHint); - this.addItemToList(index, hint, this.hints, HINTS_LIST); - return hint; - } - - protected void removeHint_(OrmQueryHint hint) { - this.removeHint_(this.hints.indexOf(hint)); - } - - /** - * hint container adapter - */ - protected class HintContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractOrmQuery.this.getHints(); - } - public Iterable getResourceElements() { - return AbstractOrmQuery.this.getXmlHints(); - } - public XmlQueryHint getResourceElement(OrmQueryHint contextElement) { - return contextElement.getXmlQueryHint(); - } - public void moveContextElement(int index, OrmQueryHint element) { - AbstractOrmQuery.this.moveHint_(index, element); - } - public void addContextElement(int index, XmlQueryHint resourceElement) { - AbstractOrmQuery.this.addHint_(index, resourceElement); - } - public void removeContextElement(OrmQueryHint element) { - AbstractOrmQuery.this.removeHint_(element); - } - } - - - // ********** misc ********** - - public X getXmlQuery() { - return this.xmlQuery; - } - - public boolean overrides(Query other) { - return MappingTools.nodeOverrides(this, other, PRECEDENCE_TYPE_LIST); - } - - public boolean duplicates(Query other) { - return MappingTools.nodesAreDuplicates(this, other); - } - - public TextRange getValidationTextRange() { - return this.xmlQuery.getValidationTextRange(); - } - - public TextRange getNameTextRange() { - return this.xmlQuery.getNameTextRange(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmReadOnlyUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmReadOnlyUniqueConstraint.java deleted file mode 100644 index caa97f18dc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmReadOnlyUniqueConstraint.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Vector; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyUniqueConstraint; - -public abstract class AbstractOrmReadOnlyUniqueConstraint - extends AbstractOrmXmlContextNode - implements OrmReadOnlyUniqueConstraint -{ - protected final Vector columnNames = new Vector(); - - - public AbstractOrmReadOnlyUniqueConstraint(XmlContextNode parent) { - super(parent); - } - - - // ********** column names ********** - - public Iterable getColumnNames() { - return new LiveCloneListIterable(this.columnNames); - } - - public int getColumnNamesSize() { - return this.columnNames.size(); - } - - public String getColumnName(int index) { - return this.columnNames.get(index); - } - - protected void syncColumnNames() { - this.synchronizeList(this.getResourceColumnNames(), this.columnNames, COLUMN_NAMES_LIST); - } - - protected abstract Iterable getResourceColumnNames(); - - @Override - public void toString(StringBuilder sb) { - sb.append(this.columnNames); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java deleted file mode 100644 index 9382f0a57f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmRelationshipMapping.java +++ /dev/null @@ -1,418 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.FetchType; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmCascade; -import org.eclipse.jpt.jpa.core.context.orm.OrmMappingRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipMapping; -import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmCascade; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml relationship mapping (1:1, 1:m, m:1, m:m) - */ -public abstract class AbstractOrmRelationshipMapping - extends AbstractOrmAttributeMapping - implements OrmRelationshipMapping -{ - protected String specifiedTargetEntity; - protected String defaultTargetEntity; - - protected final OrmMappingRelationship relationship; - - protected final OrmCascade cascade; - - protected FetchType specifiedFetch; - protected FetchType defaultFetch; - - - protected AbstractOrmRelationshipMapping(OrmPersistentAttribute parent, X xmlMapping) { - super(parent, xmlMapping); - this.specifiedTargetEntity = xmlMapping.getTargetEntity(); - this.relationship = this.buildRelationship(); - this.cascade = this.buildCascade(); - this.specifiedFetch = this.buildSpecifiedFetch(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedTargetEntity_(this.xmlAttributeMapping.getTargetEntity()); - this.relationship.synchronizeWithResourceModel(); - this.cascade.synchronizeWithResourceModel(); - this.setSpecifiedFetch_(this.buildSpecifiedFetch()); - } - - @Override - public void update() { - super.update(); - this.setDefaultTargetEntity(this.buildDefaultTargetEntity()); - this.relationship.update(); - this.cascade.update(); - this.setDefaultFetch(this.buildDefaultFetch()); - } - - - // ********** target entity ********** - - public String getTargetEntity() { - return (this.specifiedTargetEntity != null) ? this.specifiedTargetEntity : this.defaultTargetEntity; - } - - public String getSpecifiedTargetEntity() { - return this.specifiedTargetEntity; - } - - public void setSpecifiedTargetEntity(String entity) { - this.setSpecifiedTargetEntity_(entity); - this.xmlAttributeMapping.setTargetEntity(entity); - } - - protected void setSpecifiedTargetEntity_(String entity) { - String old = this.specifiedTargetEntity; - this.specifiedTargetEntity = entity; - this.firePropertyChanged(SPECIFIED_TARGET_ENTITY_PROPERTY, old, entity); - } - - public String getDefaultTargetEntity() { - return this.defaultTargetEntity; - } - - protected void setDefaultTargetEntity(String entity) { - String old = this.defaultTargetEntity; - this.defaultTargetEntity = entity; - this.firePropertyChanged(DEFAULT_TARGET_ENTITY_PROPERTY, old, entity); - } - - protected String buildDefaultTargetEntity() { - return (this.getJavaPersistentAttribute() == null) ? null : this.getJavaTargetType(); - } - - /** - * pre-condition: the mapping's Java persistent attribute is not - * null. - */ - protected abstract String getJavaTargetType(); - - public Entity getResolvedTargetEntity() { - TypeMapping typeMapping = this.getResolvedTargetTypeMapping(); - return (typeMapping instanceof Entity) ? (Entity) typeMapping : null; - } - - protected TypeMapping getResolvedTargetTypeMapping() { - PersistentType resolvedTargetType = this.getResolvedTargetType(); - return (resolvedTargetType == null) ? null : resolvedTargetType.getMapping(); - } - - // sub-classes like this to be public - public PersistentType getResolvedTargetType() { - return this.resolvePersistentType(this.getTargetEntity()); - } - - public char getTargetEntityEnclosingTypeSeparator() { - return '$'; - } - - - // ********** relationship reference ********** - - public OrmMappingRelationship getRelationship() { - return this.relationship; - } - - protected abstract OrmMappingRelationship buildRelationship(); - - - // ********** cascade ********** - - public OrmCascade getCascade() { - return this.cascade; - } - - protected OrmCascade buildCascade() { - // NB: we don't use the platform - return new GenericOrmCascade(this); - } - - - // ********** fetch ********** - - public FetchType getFetch() { - return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch; - } - - public FetchType getSpecifiedFetch() { - return this.specifiedFetch; - } - - public void setSpecifiedFetch(FetchType fetch) { - this.setSpecifiedFetch_(fetch); - this.xmlAttributeMapping.setFetch(FetchType.toOrmResourceModel(fetch)); - } - - protected void setSpecifiedFetch_(FetchType fetch) { - FetchType old = this.specifiedFetch; - this.specifiedFetch = fetch; - this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch); - } - - protected FetchType buildSpecifiedFetch() { - return FetchType.fromOrmResourceModel(this.xmlAttributeMapping.getFetch()); - } - - public FetchType getDefaultFetch() { - return this.defaultFetch; - } - - protected void setDefaultFetch(FetchType fetch) { - FetchType old = this.defaultFetch; - this.defaultFetch = fetch; - this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch); - } - - protected abstract FetchType buildDefaultFetch(); - - - // ********** misc ********** - - @Override - public boolean isRelationshipOwner() { - return this.relationship.isOwner(); - } - - @Override - public boolean isOwnedBy(AttributeMapping mapping) { - return mapping.isRelationshipOwner() && - this.relationship.isOwnedBy((RelationshipMapping) mapping); - } - - public RelationshipMapping getRelationshipOwner() { - Entity entity = this.getResolvedTargetEntity(); - if (entity == null) { - return null; - } - for (ReadOnlyPersistentAttribute attribute : CollectionTools.iterable(entity.getPersistentType().allAttributes())) { - AttributeMapping mapping = attribute.getMapping(); - if (this.isOwnedBy(mapping)) { - return (RelationshipMapping) mapping; - } - } - return null; - } - - @Override - public boolean isOverridableAssociationMapping() { - return this.relationship.isOverridable(); - } - - @Override - protected void initializeFromOrmRelationshipMapping(OrmRelationshipMapping oldMapping) { - super.initializeFromOrmRelationshipMapping(oldMapping); - this.setSpecifiedTargetEntity(oldMapping.getSpecifiedTargetEntity()); - this.setSpecifiedFetch(oldMapping.getSpecifiedFetch()); - oldMapping.getRelationship().initializeOn(this.relationship); - this.cascade.initializeFrom(oldMapping.getCascade()); - //TODO should we set the fetch type from a BasicMapping?? - } - - public Iterator allTargetEntityAttributeNames() { - return new CompositeIterator(this.allTargetEntityAttributeNamesLists()); - } - - protected Iterator> allTargetEntityAttributeNamesLists() { - return new TransformationIterator>(this.allTargetEntityAttributeMappings(), AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER); - } - - protected Iterator allTargetEntityAttributeMappings() { - Entity entity = this.getResolvedTargetEntity(); - return (entity != null) ? entity.allAttributeMappings() : EmptyIterator.instance(); - } - - protected String getTargetEntityIdAttributeName() { - PersistentAttribute attribute = this.getTargetEntityIdAttribute(); - return (attribute == null) ? null : attribute.getName(); - } - - protected PersistentAttribute getTargetEntityIdAttribute() { - Entity entity = this.getResolvedTargetEntity(); - return (entity == null) ? null : entity.getIdAttribute(); - } - - - //************ refactoring ************ - - @Override - @SuppressWarnings("unchecked") - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable( - super.createRenameTypeEdits(originalType, newName), - this.createTargetEntityRenameTypeEdits(originalType, newName) - ); - } - - protected Iterable createTargetEntityRenameTypeEdits(IType originalType, String newName) { - if (this.specifiedTargetEntity != null) { - PersistentType targetType = this.getResolvedTargetType(); - if ((targetType != null) && targetType.isFor(originalType.getFullyQualifiedName('.'))) { - return new SingleElementIterable(this.createTargetEntityRenameTypeEdit(originalType, newName)); - } - } - return EmptyIterable.instance(); - } - - protected ReplaceEdit createTargetEntityRenameTypeEdit(IType originalType, String newName) { - return this.xmlAttributeMapping.createRenameTargetEntityEdit(originalType, newName); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable( - super.createMoveTypeEdits(originalType, newPackage), - this.createTargetEntityMoveTypeEdits(originalType, newPackage) - ); - } - - protected Iterable createTargetEntityMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - if (this.specifiedTargetEntity != null) { - PersistentType targetType = this.getResolvedTargetType(); - if ((targetType != null) && targetType.isFor(originalType.getFullyQualifiedName('.'))) { - return new SingleElementIterable(this.createTargetEntityRenamePackageEdit(newPackage.getElementName())); - } - } - return EmptyIterable.instance(); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable( - super.createRenamePackageEdits(originalPackage, newName), - this.createTargetEntityRenamePackageEdits(originalPackage, newName) - ); - } - - protected Iterable createTargetEntityRenamePackageEdits(IPackageFragment originalPackage, String newName) { - if (this.specifiedTargetEntity != null) { - PersistentType targetType = this.getResolvedTargetType(); - if ((targetType != null) && targetType.isIn(originalPackage)) { - return new SingleElementIterable(this.createTargetEntityRenamePackageEdit(newName)); - } - } - return EmptyIterable.instance(); - } - - protected ReplaceEdit createTargetEntityRenamePackageEdit(String newName) { - return this.xmlAttributeMapping.createRenameTargetEntityPackageEdit(newName); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateTargetEntity(messages); - this.relationship.validate(messages, reporter); - } - - protected void validateTargetEntity(List messages) { - if (this.getTargetEntity() == null) { - String msg = this.isVirtual() ? - JpaValidationMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_NOT_DEFINED : - JpaValidationMessages.TARGET_ENTITY_NOT_DEFINED; - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - msg, - new String[] {this.name}, - this, - this.getValidationTextRange() - ) - ); - } - else if (this.getResolvedTargetEntity() == null) { - if (this.isVirtual()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_ATTRIBUTE_TARGET_ENTITY_IS_NOT_AN_ENTITY, - new String[] {this.name, this.getTargetEntity()}, - this, - this.getValidationTextRange() - ) - ); - } else { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TARGET_ENTITY_IS_NOT_AN_ENTITY, - new String[] {this.getTargetEntity(), this.name}, - this, - this.getTargetEntityTextRange() - ) - ); - } - } - } - - protected TextRange getTextRange(TextRange textRange) { - return (textRange != null) ? textRange : this.getPersistentAttribute().getValidationTextRange(); - } - - protected TextRange getTargetEntityTextRange() { - return this.getTextRange(this.xmlAttributeMapping.getTargetEntityTextRange()); - } - - - // ********** metamodel ********** - - @Override - public String getMetamodelTypeName() { - PersistentType resolvedTargetType = this.getResolvedTargetType(); - if (resolvedTargetType == null) { - return MetamodelField.DEFAULT_TYPE_NAME; - } - String targetTypeName = resolvedTargetType.getName(); - return (targetTypeName != null) ? targetTypeName : MetamodelField.DEFAULT_TYPE_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSequenceGenerator.java deleted file mode 100644 index ee4611f4f6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSequenceGenerator.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator; -import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator; - -/** - * orm.xml sequence generator - */ -public abstract class AbstractOrmSequenceGenerator - extends AbstractOrmGenerator - implements OrmSequenceGenerator -{ - protected String specifiedSequenceName; - protected String defaultSequenceName; - - - protected AbstractOrmSequenceGenerator(XmlContextNode parent, XmlSequenceGenerator xmlSequenceGenerator) { - super(parent, xmlSequenceGenerator); - this.specifiedSequenceName = xmlSequenceGenerator.getSequenceName(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedSequenceName_(this.xmlGenerator.getSequenceName()); - } - - @Override - public void update() { - super.update(); - this.setDefaultSequenceName(this.buildDefaultSequenceName()); - } - - - // ********** initial value ********** - - @Override - protected int buildDefaultInitialValue() { - return DEFAULT_INITIAL_VALUE; - } - - - // ********** sequence name ********** - - public String getSequenceName() { - return (this.specifiedSequenceName != null) ? this.specifiedSequenceName : this.defaultSequenceName; - } - - public String getSpecifiedSequenceName() { - return this.specifiedSequenceName; - } - - public void setSpecifiedSequenceName(String specifiedSequenceName) { - this.setSpecifiedSequenceName_(specifiedSequenceName); - this.xmlGenerator.setSequenceName(specifiedSequenceName); - } - - protected void setSpecifiedSequenceName_(String specifiedSequenceName) { - String old = this.specifiedSequenceName; - this.specifiedSequenceName = specifiedSequenceName; - this.firePropertyChanged(SPECIFIED_SEQUENCE_NAME_PROPERTY, old, specifiedSequenceName); - } - - public String getDefaultSequenceName() { - return this.defaultSequenceName; - } - - protected void setDefaultSequenceName(String defaultSequenceName) { - String old = this.defaultSequenceName; - this.defaultSequenceName = defaultSequenceName; - this.firePropertyChanged(DEFAULT_SEQUENCE_NAME_PROPERTY, old, defaultSequenceName); - } - - protected String buildDefaultSequenceName() { - return null; // TODO the default sequence name is determined by the runtime provider... - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java deleted file mode 100644 index fd744c2e1d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmSingleRelationshipMapping.java +++ /dev/null @@ -1,141 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.FetchType; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmSingleRelationshipMapping; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.NullOrmDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0; -import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlSingleRelationshipMapping; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml single relationship mapping (1:1, m:1) - */ -public abstract class AbstractOrmSingleRelationshipMapping - extends AbstractOrmRelationshipMapping - implements OrmSingleRelationshipMapping2_0 -{ - protected Boolean specifiedOptional; - protected boolean defaultOptional; - - protected final OrmDerivedIdentity2_0 derivedIdentity; - - - protected AbstractOrmSingleRelationshipMapping(OrmPersistentAttribute parent, X xmlMapping) { - super(parent, xmlMapping); - this.specifiedOptional = xmlMapping.getOptional(); - this.derivedIdentity = this.buildDerivedIdentity(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedOptional_(this.xmlAttributeMapping.getOptional()); - this.derivedIdentity.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.setDefaultOptional(this.buildDefaultOptional()); - this.derivedIdentity.update(); - } - - - // ********** optional ********** - - public boolean isOptional() { - return (this.specifiedOptional != null) ? this.specifiedOptional.booleanValue() : this.defaultOptional; - } - - public Boolean getSpecifiedOptional() { - return this.specifiedOptional; - } - - public void setSpecifiedOptional(Boolean optional) { - this.setSpecifiedOptional_(optional); - this.xmlAttributeMapping.setOptional(optional); - } - - protected void setSpecifiedOptional_(Boolean optional) { - Boolean old = this.specifiedOptional; - this.specifiedOptional = optional; - this.firePropertyChanged(SPECIFIED_OPTIONAL_PROPERTY, old, optional); - } - - public boolean isDefaultOptional() { - return this.defaultOptional; - } - - protected void setDefaultOptional(boolean optional) { - boolean old = this.defaultOptional; - this.defaultOptional = optional; - this.firePropertyChanged(DEFAULT_OPTIONAL_PROPERTY, old, optional); - } - - protected boolean buildDefaultOptional() { - return DEFAULT_OPTIONAL; - } - - - // ********** derived identity ********** - - public OrmDerivedIdentity2_0 getDerivedIdentity() { - return this.derivedIdentity; - } - - protected OrmDerivedIdentity2_0 buildDerivedIdentity() { - return this.isJpa2_0Compatible() ? - this.getContextNodeFactory2_0().buildOrmDerivedIdentity(this) : - new NullOrmDerivedIdentity2_0(this); - } - - - // ********** misc ********** - - @Override - protected void initializeFromOrmSingleRelationshipMapping(OrmSingleRelationshipMapping oldMapping) { - super.initializeFromOrmSingleRelationshipMapping(oldMapping); - if (this.isJpa2_0Compatible()) { - this.derivedIdentity.initializeFrom(((OrmSingleRelationshipMapping2_0) oldMapping).getDerivedIdentity()); - } - } - - /** - * pre-condition: the mapping's Java persistent attribute is not - * null. - */ - @Override - protected String getJavaTargetType() { - return this.getJavaPersistentAttribute().getSingleReferenceTargetTypeName(); - } - - @Override - protected FetchType buildDefaultFetch() { - return DEFAULT_FETCH_TYPE; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.derivedIdentity.validate(messages, reporter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java deleted file mode 100644 index c7d5a9e302..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTable.java +++ /dev/null @@ -1,541 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.NameTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.jpa.core.context.ReadOnlyTable; -import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint; -import org.eclipse.jpt.jpa.core.context.UniqueConstraint; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml table, secondary table, join table, or collection table - *

- * NB: any subclass that directly holds its XML table must:

    - *
  • call the "super" constructor that takes an XML table - * {@link #AbstractOrmTable(XmlContextNode, Owner, AbstractXmlTable)} - *
  • override {@link #setXmlTable(AbstractXmlTable)} to set the XML table - * so it is in place before the table's state (e.g. {@link #specifiedName}) - * is initialized - *
- */ -public abstract class AbstractOrmTable - extends AbstractOrmXmlContextNode - implements OrmTable, UniqueConstraint.Owner -{ - protected final Owner owner; - - protected String specifiedName; - protected String defaultName; - - protected String specifiedSchema; - protected String defaultSchema; - - protected String specifiedCatalog; - protected String defaultCatalog; - - protected final Vector uniqueConstraints = new Vector(); - protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter(); - - - // ********** constructor/initialization ********** - - protected AbstractOrmTable(XmlContextNode parent, Owner owner) { - this(parent, owner, null); - } - - protected AbstractOrmTable(XmlContextNode parent, Owner owner, X xmlTable) { - super(parent); - this.owner = owner; - this.setXmlTable(xmlTable); - this.specifiedName = this.buildSpecifiedName(); - this.specifiedSchema = this.buildSpecifiedSchema(); - this.specifiedCatalog = this.buildSpecifiedCatalog(); - this.initializeUniqueContraints(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedName_(this.buildSpecifiedName()); - this.setSpecifiedSchema_(this.buildSpecifiedSchema()); - this.setSpecifiedCatalog_(this.buildSpecifiedCatalog()); - this.syncUniqueConstraints(); - } - - @Override - public void update() { - super.update(); - this.setDefaultName(this.buildDefaultName()); - this.setDefaultSchema(this.buildDefaultSchema()); - this.setDefaultCatalog(this.buildDefaultCatalog()); - this.updateNodes(this.getUniqueConstraints()); - } - - - // ********** XML table ********** - - /** - * Return null if XML table does not exists. - */ - protected abstract X getXmlTable(); - - /** - * see class comment... - */ - protected void setXmlTable(X xmlTable) { - if (xmlTable != null) { - throw new IllegalArgumentException("this method must be overridden if the XML table is not null: " + xmlTable); //$NON-NLS-1$ - } - } - - /** - * Build the XML table if it does not exist. - */ - protected X getXmlTableForUpdate() { - X xmlTable = this.getXmlTable(); - return (xmlTable != null) ? xmlTable : this.buildXmlTable(); - } - - protected abstract X buildXmlTable(); - - protected void removeXmlTableIfUnset() { - if (this.getXmlTable().isUnset()) { - this.removeXmlTable(); - } - } - - protected abstract void removeXmlTable(); - - public boolean isSpecifiedInResource() { - return this.getXmlTable() != null; - } - - - // ********** name ********** - - public String getName() { - return (this.specifiedName != null) ? this.specifiedName : this.defaultName; - } - - public String getSpecifiedName() { - return this.specifiedName; - } - - public void setSpecifiedName(String name) { - if (this.valuesAreDifferent(this.specifiedName, name)) { - X xmlTable = this.getXmlTableForUpdate(); - this.setSpecifiedName_(name); - xmlTable.setName(name); - this.removeXmlTableIfUnset(); - } - } - - protected void setSpecifiedName_(String name) { - String old = this.specifiedName; - this.specifiedName = name; - this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedName() { - X xmlTable = this.getXmlTable(); - return (xmlTable == null) ? null : xmlTable.getName(); - } - - public String getDefaultName() { - return this.defaultName; - } - - protected void setDefaultName(String name) { - String old = this.defaultName; - this.defaultName = name; - this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name); - } - - protected abstract String buildDefaultName(); - - - // ********** schema ********** - - public String getSchema() { - return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema; - } - - public String getSpecifiedSchema() { - return this.specifiedSchema; - } - - public void setSpecifiedSchema(String schema) { - if (this.valuesAreDifferent(this.specifiedSchema, schema)) { - X xmlTable = this.getXmlTableForUpdate(); - this.setSpecifiedSchema_(schema); - xmlTable.setSchema(schema); - this.removeXmlTableIfUnset(); - } - } - - protected void setSpecifiedSchema_(String schema) { - String old = this.specifiedSchema; - this.specifiedSchema = schema; - this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema); - } - - protected String buildSpecifiedSchema() { - X xmlTable = this.getXmlTable(); - return (xmlTable == null) ? null : xmlTable.getSchema(); - } - - public String getDefaultSchema() { - return this.defaultSchema; - } - - protected void setDefaultSchema(String schema) { - String old = this.defaultSchema; - this.defaultSchema = schema; - this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema); - } - - protected abstract String buildDefaultSchema(); - - - // ********** catalog ********** - - public String getCatalog() { - return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog; - } - - public String getSpecifiedCatalog() { - return this.specifiedCatalog; - } - - public void setSpecifiedCatalog(String catalog) { - if (this.valuesAreDifferent(this.specifiedCatalog, catalog)) { - X xmlTable = this.getXmlTableForUpdate(); - this.setSpecifiedCatalog_(catalog); - xmlTable.setCatalog(catalog); - this.removeXmlTableIfUnset(); - } - } - - protected void setSpecifiedCatalog_(String catalog) { - String old = this.specifiedCatalog; - this.specifiedCatalog = catalog; - this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog); - } - - protected String buildSpecifiedCatalog() { - X xmlTable = this.getXmlTable(); - return (xmlTable == null) ? null : xmlTable.getCatalog(); - } - - public String getDefaultCatalog() { - return this.defaultCatalog; - } - - protected void setDefaultCatalog(String catalog) { - String old = this.defaultCatalog; - this.defaultCatalog = catalog; - this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog); - } - - protected abstract String buildDefaultCatalog(); - - - // ********** unique constraints ********** - - public ListIterator uniqueConstraints() { - return this.getUniqueConstraints().iterator(); - } - - protected ListIterable getUniqueConstraints() { - return new LiveCloneListIterable(this.uniqueConstraints); - } - - public int uniqueConstraintsSize() { - return this.uniqueConstraints.size(); - } - - public OrmUniqueConstraint getUniqueConstraint(int index) { - return this.uniqueConstraints.get(index); - } - - public OrmUniqueConstraint addUniqueConstraint() { - return this.addUniqueConstraint(this.uniqueConstraints.size()); - } - - public OrmUniqueConstraint addUniqueConstraint(int index) { - X xmlTable = this.getXmlTableForUpdate(); - XmlUniqueConstraint xmlConstraint = this.buildXmlUniqueConstraint(); - OrmUniqueConstraint constraint = this.addUniqueConstraint_(index, xmlConstraint); - xmlTable.getUniqueConstraints().add(index, xmlConstraint); - return constraint; - } - - protected XmlUniqueConstraint buildXmlUniqueConstraint() { - return OrmFactory.eINSTANCE.createXmlUniqueConstraint(); - } - - public void removeUniqueConstraint(UniqueConstraint constraint) { - this.removeUniqueConstraint(this.uniqueConstraints.indexOf(constraint)); - } - - public void removeUniqueConstraint(int index) { - this.removeUniqueConstraint_(index); - this.getXmlTable().getUniqueConstraints().remove(index); - this.removeXmlTableIfUnset(); - } - - protected void removeUniqueConstraint_(int index) { - this.removeItemFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - } - - public void moveUniqueConstraint(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - this.getXmlTable().getUniqueConstraints().move(targetIndex, sourceIndex); - } - - protected void initializeUniqueContraints() { - for (XmlUniqueConstraint xmlConstraint : this.getXmlUniqueConstraints()) { - this.uniqueConstraints.add(this.buildUniqueConstraint(xmlConstraint)); - } - } - - protected OrmUniqueConstraint buildUniqueConstraint(XmlUniqueConstraint xmlConstraint) { - return this.getContextNodeFactory().buildOrmUniqueConstraint(this, this, xmlConstraint); - } - - protected void syncUniqueConstraints() { - ContextContainerTools.synchronizeWithResourceModel(this.uniqueConstraintContainerAdapter); - } - - protected Iterable getXmlUniqueConstraints() { - X xmlTable = this.getXmlTable(); - return (xmlTable == null) ? - EmptyIterable.instance() : - // clone to reduce chance of concurrency problems - new LiveCloneIterable(xmlTable.getUniqueConstraints()); - } - - protected void moveUniqueConstraint_(int index, OrmUniqueConstraint constraint) { - this.moveItemInList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - } - - protected OrmUniqueConstraint addUniqueConstraint_(int index, XmlUniqueConstraint xmlConstraint) { - OrmUniqueConstraint constraint = this.buildUniqueConstraint(xmlConstraint); - this.addItemToList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - return constraint; - } - - protected void removeUniqueConstraint_(OrmUniqueConstraint constraint) { - this.removeUniqueConstraint_(this.uniqueConstraints.indexOf(constraint)); - } - - /** - * unique constraint container adapter - */ - protected class UniqueConstraintContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractOrmTable.this.getUniqueConstraints(); - } - public Iterable getResourceElements() { - return AbstractOrmTable.this.getXmlUniqueConstraints(); - } - public XmlUniqueConstraint getResourceElement(OrmUniqueConstraint contextElement) { - return contextElement.getXmlUniqueConstraint(); - } - public void moveContextElement(int index, OrmUniqueConstraint element) { - AbstractOrmTable.this.moveUniqueConstraint_(index, element); - } - public void addContextElement(int index, XmlUniqueConstraint resourceElement) { - AbstractOrmTable.this.addUniqueConstraint_(index, resourceElement); - } - public void removeContextElement(OrmUniqueConstraint element) { - AbstractOrmTable.this.removeUniqueConstraint_(element); - } - } - - - // ********** database stuff ********** - - public org.eclipse.jpt.jpa.db.Table getDbTable() { - Schema dbSchema = this.getDbSchema(); - return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getName()); - } - - public Schema getDbSchema() { - SchemaContainer dbSchemaContainer = this.getDbSchemaContainer(); - return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema()); - } - - /** - * If we don't have a catalog (i.e. we don't even have a default catalog), - * then the database probably does not support catalogs; and we need to - * get the schema directly from the database. - */ - public SchemaContainer getDbSchemaContainer() { - String catalog = this.getCatalog(); - return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase(); - } - - /** - * If we don't have a catalog (i.e. we don't even have a default - * catalog), then the database probably does not support catalogs. - */ - public Catalog getDbCatalog() { - String catalog = this.getCatalog(); - return (catalog == null) ? null : this.resolveDbCatalog(catalog); - } - - public boolean isResolved() { - return this.getDbTable() != null; - } - - public boolean schemaIsResolved() { - return this.getDbSchema() != null; - } - - /** - * If we don't have a catalog (i.e. we don't even have a default - * catalog), then the database probably does not support catalogs. - */ - public boolean catalogIsResolved() { - String catalog = this.getCatalog(); - return (catalog == null) || (this.resolveDbCatalog(catalog) != null); - } - - - // ********** UniqueConstraint.Owner implementation ********** - - public Iterator candidateUniqueConstraintColumnNames() { - org.eclipse.jpt.jpa.db.Table dbTable = this.getDbTable(); - return (dbTable != null) ? dbTable.getSortedColumnIdentifiers().iterator() : EmptyIterator.instance(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.buildTableValidator().validate(messages, reporter); - } - - protected JptValidator buildTableValidator() { - return this.owner.buildTableValidator(this, this.buildTextRangeResolver()); - } - - protected TableTextRangeResolver buildTextRangeResolver() { - return new OrmTableTextRangeResolver(this); - } - - public TextRange getValidationTextRange() { - return this.getTextRange(this.getXmlTableValidationTextRange()); - } - - protected TextRange getXmlTableValidationTextRange() { - X xmlTable = this.getXmlTable(); - return (xmlTable == null) ? null : xmlTable.getValidationTextRange(); - } - - public TextRange getNameTextRange() { - return this.getTextRange(this.getXmlTableNameTextRange()); - } - - protected TextRange getXmlTableNameTextRange() { - X xmlTable = this.getXmlTable(); - return (xmlTable == null) ? null : xmlTable.getNameTextRange(); - } - - public TextRange getSchemaTextRange() { - return this.getTextRange(this.getXmlTableSchemaTextRange()); - } - - protected TextRange getXmlTableSchemaTextRange() { - X xmlTable = this.getXmlTable(); - return (xmlTable == null) ? null : xmlTable.getSchemaTextRange(); - } - - public TextRange getCatalogTextRange() { - return this.getTextRange(this.getXmlTableCatalogTextRange()); - } - - protected TextRange getXmlTableCatalogTextRange() { - X xmlTable = this.getXmlTable(); - return (xmlTable == null) ? null : xmlTable.getCatalogTextRange(); - } - - protected TextRange getTextRange(TextRange textRange) { - return (textRange != null) ? textRange : this.getParent().getValidationTextRange(); - } - - - // ********** misc ********** - - /** - * covariant override - */ - @Override - public XmlContextNode getParent() { - return (XmlContextNode) super.getParent(); - } - - protected void initializeFrom(ReadOnlyTable oldTable) { - this.setSpecifiedName(oldTable.getSpecifiedName()); - this.setSpecifiedCatalog(oldTable.getSpecifiedCatalog()); - this.setSpecifiedSchema(oldTable.getSpecifiedSchema()); - for (ReadOnlyUniqueConstraint constraint : CollectionTools.iterable(oldTable.uniqueConstraints())) { - this.addUniqueConstraint().initializeFrom(constraint); - } - } - - protected void initializeFromVirtual(ReadOnlyTable virtualTable) { - this.setSpecifiedName(virtualTable.getName()); - // ignore other settings? - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.buildQualifiedName()); - } - - protected String buildQualifiedName() { - return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java deleted file mode 100644 index 13f8643112..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmTypeMapping.java +++ /dev/null @@ -1,482 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericTypeMappingValidator; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml type mapping - */ -public abstract class AbstractOrmTypeMapping - extends AbstractOrmXmlContextNode - implements OrmTypeMapping -{ - protected final X xmlTypeMapping; - - protected String class_; - - protected Boolean specifiedMetadataComplete; - protected boolean overrideMetadataComplete; - - - protected AbstractOrmTypeMapping(OrmPersistentType parent, X xmlTypeMapping) { - super(parent); - this.xmlTypeMapping = xmlTypeMapping; - this.class_ = xmlTypeMapping.getClassName(); - this.specifiedMetadataComplete = xmlTypeMapping.getMetadataComplete(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setClass_(this.xmlTypeMapping.getClassName()); - this.setSpecifiedMetadataComplete_(this.xmlTypeMapping.getMetadataComplete()); - } - - @Override - public void update() { - super.update(); - this.setOverrideMetadataComplete(this.buildOverrideMetadataComplete()); - } - - - // ********** class ********** - - public String getClass_() { - return this.class_; - } - - public void setClass(String class_) { - this.setClass_(class_); - this.xmlTypeMapping.setClassName(class_); - } - - protected void setClass_(String class_) { - String old = this.class_; - this.class_ = class_; - if (this.firePropertyChanged(CLASS_PROPERTY, old, class_)) { - this.getPersistentType().mappingClassChanged(old, class_); - } - } - - - // ********** metadata complete ********** - - /** - * If entity-mappings/persistence-unit-metadata/xml-mapping-metadata-complete - * is specified, it overrides anything set here. - */ - public boolean isMetadataComplete() { - if (this.overrideMetadataComplete) { - return true; - } - return (this.specifiedMetadataComplete != null) ? this.specifiedMetadataComplete.booleanValue() : false; - } - - public Boolean getSpecifiedMetadataComplete() { - return this.specifiedMetadataComplete; - } - - public void setSpecifiedMetadataComplete(Boolean metadataComplete) { - this.setSpecifiedMetadataComplete_(metadataComplete); - this.xmlTypeMapping.setMetadataComplete(metadataComplete); - } - - protected void setSpecifiedMetadataComplete_(Boolean metadataComplete) { - Boolean old = this.specifiedMetadataComplete; - this.specifiedMetadataComplete = metadataComplete; - this.firePropertyChanged(SPECIFIED_METADATA_COMPLETE_PROPERTY, old, metadataComplete); - } - - public boolean isOverrideMetadataComplete() { - return this.overrideMetadataComplete; - } - - protected void setOverrideMetadataComplete(boolean metadataComplete) { - boolean old = this.overrideMetadataComplete; - this.overrideMetadataComplete = metadataComplete; - this.firePropertyChanged(OVERRIDE_METADATA_COMPLETE_PROPERTY, old, metadataComplete); - } - - protected boolean buildOverrideMetadataComplete() { - return this.getPersistenceUnit().isXmlMappingMetadataComplete(); - } - - - // ********** Java type mapping ********** - - public JavaTypeMapping getJavaTypeMapping() { - JavaPersistentType javaType = this.getJavaPersistentType(); - if (javaType == null) { - return null; - } - return (javaType.getMappingKey() == this.getKey()) ? javaType.getMapping() : null; - } - - public JavaTypeMapping getJavaTypeMappingForDefaults() { - return this.isMetadataComplete() ? null : this.getJavaTypeMapping(); - } - - - // ********** misc ********** - - @Override - public OrmPersistentType getParent() { - return (OrmPersistentType) super.getParent(); - } - - public OrmPersistentType getPersistentType() { - return this.getParent(); - } - - public String getName() { - return this.getPersistentType().getName(); - } - - protected JavaPersistentType getJavaPersistentType() { - return this.getPersistentType().getJavaPersistentType(); - } - - protected JavaResourcePersistentType getJavaResourcePersistentType() { - JavaPersistentType javaType = this.getJavaPersistentType(); - return (javaType == null) ? null : javaType.getResourcePersistentType(); - } - - public boolean isMapped() { - return true; - } - - /** - * A type's mapping is being changed. Copy the common settings from the old - * mapping to the new (this). - */ - public void initializeFrom(OrmTypeMapping oldMapping) { - this.setClass(oldMapping.getClass_()); - this.setSpecifiedMetadataComplete(oldMapping.getSpecifiedMetadataComplete()); - this.setOverrideMetadataComplete(oldMapping.isOverrideMetadataComplete()); - } - - - // ********** tables ********** - - public String getPrimaryTableName() { - return null; - } - - public Table getPrimaryDbTable() { - return null; - } - - public Table resolveDbTable(String tableName) { - return null; - } - - public Schema getDbSchema() { - return null; - } - - - // ********** attribute mappings ********** - - public boolean attributeMappingKeyAllowed(String attributeMappingKey) { - return true; - } - - public Iterator attributeMappings() { - return new TransformationIterator(this.getPersistentType().attributes()) { - @Override - protected AttributeMapping transform(OrmReadOnlyPersistentAttribute attribute) { - return attribute.getMapping(); - } - }; - } - - public Iterator allAttributeMappings() { - return new CompositeIterator(this.allAttributeMappingsLists()); - } - - protected Iterator> allAttributeMappingsLists() { - return new TransformationIterator>(this.inheritanceHierarchy(), TypeMappingTools.ATTRIBUTE_MAPPINGS_TRANSFORMER); - } - - public Iterator overridableAttributeNames() { - return new CompositeIterator(this.overridableAttributeNamesLists()); - } - - protected Iterator> overridableAttributeNamesLists() { - return new TransformationIterator>(this.attributeMappings(), AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER); - } - - public Iterator allOverridableAttributeNames() { - return new CompositeIterator(this.allOverridableAttributeNamesLists()); - } - - protected Iterator> allOverridableAttributeNamesLists() { - return new TransformationIterator>(this.inheritanceHierarchy(), TypeMappingTools.OVERRIDABLE_ATTRIBUTE_NAMES_TRANSFORMER); - } - - public Iterable getAttributeMappings(final String mappingKey) { - return new FilteringIterable(CollectionTools.collection(this.attributeMappings())) { - @Override - protected boolean accept(AttributeMapping o) { - return Tools.valuesAreEqual(o.getKey(), mappingKey); - } - }; - } - - public Iterable getAllAttributeMappings(final String mappingKey) { - return new FilteringIterable(CollectionTools.collection(this.allAttributeMappings())) { - @Override - protected boolean accept(AttributeMapping o) { - return Tools.valuesAreEqual(o.getKey(), mappingKey); - } - }; - } - - public Column resolveOverriddenColumn(String attributeName) { - for (AttributeMapping attributeMapping : CollectionTools.iterable(this.attributeMappings())) { - Column column = attributeMapping.resolveOverriddenColumn(attributeName); - if (column != null) { - return column; - } - } - if ( ! this.isMetadataComplete()) { - JavaPersistentType javaPersistentType = this.getJavaPersistentType(); - if (javaPersistentType != null) { - return javaPersistentType.getMapping().resolveOverriddenColumn(attributeName); - } - } - return null; - } - - public Iterator overridableAssociationNames() { - return new CompositeIterator(this.overridableAssociationNamesLists()); - } - - protected Iterator> overridableAssociationNamesLists() { - return new TransformationIterator>(this.attributeMappings(), AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER); - } - - public Iterator allOverridableAssociationNames() { - return new CompositeIterator(this.allOverridableAssociationNamesLists()); - } - - protected Iterator> allOverridableAssociationNamesLists() { - return new TransformationIterator>(this.inheritanceHierarchy(), TypeMappingTools.OVERRIDABLE_ASSOCIATION_NAMES_TRANSFORMER); - } - - public Relationship resolveOverriddenRelationship(String attributeName) { - for (AttributeMapping attributeMapping : CollectionTools.iterable(this.attributeMappings())) { - Relationship relationship = attributeMapping.resolveOverriddenRelationship(attributeName); - if (relationship != null) { - return relationship; - } - } - if ( ! this.isMetadataComplete()) { - JavaPersistentType javaPersistentType = this.getJavaPersistentType(); - if (javaPersistentType != null) { - return javaPersistentType.getMapping().resolveOverriddenRelationship(attributeName); - } - } - return null; - } - - - // ********** inheritance hierarchy ********** - - public TypeMapping getSuperTypeMapping() { - PersistentType superPersistentType = this.getPersistentType().getSuperPersistentType(); - return (superPersistentType == null) ? null : superPersistentType.getMapping(); - } - - public Iterator inheritanceHierarchy() { - return this.convertToMappings(this.getPersistentType().inheritanceHierarchy()); - } - - protected Iterable getInheritanceHierarchy() { - return CollectionTools.iterable(this.inheritanceHierarchy()); - } - - /** - * Return the type mapping's "persistence" ancestors, - * excluding the type mapping itself. - * The returned iterator will return elements infinitely if the hierarchy - * has a loop. - */ - protected Iterator ancestors() { - return this.convertToMappings(this.getPersistentType().ancestors()); - } - - protected Iterable getAncestors() { - return CollectionTools.iterable(this.ancestors()); - } - - protected Iterator convertToMappings(Iterator types) { - return new TransformationIterator(types) { - @Override - protected TypeMapping transform(PersistentType type) { - return type.getMapping(); - } - }; - } - - - // ********** misc ********** - - public X getXmlTypeMapping() { - return this.xmlTypeMapping; - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getPersistentType().getName()); - } - - - // ********** text ranges ********** - - public JpaStructureNode getStructureNode(int offset) { - return this.xmlTypeMapping.containsOffset(offset) ? this.getPersistentType() : null; - } - - public TextRange getSelectionTextRange() { - return this.xmlTypeMapping.getSelectionTextRange(); - } - - public TextRange getClassTextRange() { - return this.xmlTypeMapping.getClassTextRange(); - } - - public TextRange getAttributesTextRange() { - return this.xmlTypeMapping.getAttributesTextRange(); - } - - public TextRange getNameTextRange() { - return this.xmlTypeMapping.getNameTextRange(); - } - - public boolean containsOffset(int textOffset) { - return this.xmlTypeMapping.containsOffset(textOffset); - } - - - // ********** refactoring ********** - - public DeleteEdit createDeleteEdit() { - return this.xmlTypeMapping.createDeleteEdit(); - } - - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return this.getPersistentType().isFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable(this.createRenameTypeEdit(originalType, newName)) : - EmptyIterable.instance(); - } - - protected ReplaceEdit createRenameTypeEdit(IType originalType, String newName) { - return this.xmlTypeMapping.createRenameTypeEdit(originalType, newName); - } - - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.getPersistentType().isFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable(this.createRenamePackageEdit(newPackage.getElementName())) : - EmptyIterable.instance(); - } - - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.getPersistentType().isIn(originalPackage) ? - new SingleElementIterable(this.createRenamePackageEdit(newName)) : - EmptyIterable.instance(); - } - - protected ReplaceEdit createRenamePackageEdit(String newName) { - return this.xmlTypeMapping.createRenamePackageEdit(newName); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateClass(messages, reporter); - } - - protected void validateClass(List messages, IReporter reporter) { - if (StringTools.stringIsEmpty(this.class_)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENT_TYPE_UNSPECIFIED_CLASS, - this, - this.getClassTextRange() - ) - ); - return; - } - this.buildTypeMappingValidator().validate(messages, reporter); - } - - protected JptValidator buildTypeMappingValidator() { - return new GenericTypeMappingValidator(this, this.getJavaResourcePersistentType(), this.buildTextRangeResolver()); - } - - protected TypeMappingTextRangeResolver buildTextRangeResolver() { - return new OrmTypeMappingTextRangeResolver(this); - } - - public boolean validatesAgainstDatabase() { - return this.getPersistenceUnit().validatesAgainstDatabase(); - } - - public TextRange getValidationTextRange() { - return this.xmlTypeMapping.getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java deleted file mode 100644 index 891bebbdb8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVersionMapping.java +++ /dev/null @@ -1,325 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmColumnMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmVersionMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmConverter; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml version mapping - */ -public abstract class AbstractOrmVersionMapping - extends AbstractOrmAttributeMapping - implements OrmVersionMapping -{ - protected final OrmColumn column; - - protected OrmConverter converter; // never null - - - // the spec does not list Temporal explicitly, - // but it is included in the orm.xml schema... - protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] { - OrmTemporalConverter.Adapter.instance(), - }; - protected static final Iterable CONVERTER_ADAPTERS = new ArrayIterable(CONVERTER_ADAPTER_ARRAY); - - - protected AbstractOrmVersionMapping(OrmPersistentAttribute parent, X xmlMapping) { - super(parent, xmlMapping); - this.column = this.buildColumn(); - this.converter = this.buildConverter(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.column.synchronizeWithResourceModel(); - this.syncConverter(); - } - - @Override - public void update() { - super.update(); - this.column.update(); - this.converter.update(); - } - - - // ********** column ********** - - public OrmColumn getColumn() { - return this.column; - } - - protected OrmColumn buildColumn() { - return this.getContextNodeFactory().buildOrmColumn(this, this); - } - - - // ********** converter ********** - - public OrmConverter getConverter() { - return this.converter; - } - - public void setConverter(Class converterType) { - if (this.converter.getType() != converterType) { - // note: we may also clear the XML value we want; - // but if we leave it, the resulting sync will screw things up... - this.clearXmlConverterValues(); - OrmConverter.Adapter converterAdapter = this.getConverterAdapter(converterType); - this.setConverter_(this.buildConverter(converterAdapter)); - this.converter.initialize(); - } - } - - protected OrmConverter buildConverter(OrmConverter.Adapter converterAdapter) { - return (converterAdapter != null) ? - converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) : - this.buildNullConverter(); - } - - protected void setConverter_(OrmConverter converter) { - Converter old = this.converter; - this.converter = converter; - this.firePropertyChanged(CONVERTER_PROPERTY, old, converter); - } - - protected void clearXmlConverterValues() { - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - adapter.clearXmlValue(this.xmlAttributeMapping); - } - } - - protected OrmConverter buildConverter() { - OrmXmlContextNodeFactory factory = this.getContextNodeFactory(); - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - OrmConverter ormConverter = adapter.buildConverter(this, factory); - if (ormConverter != null) { - return ormConverter; - } - } - return this.buildNullConverter(); - } - - protected void syncConverter() { - OrmConverter.Adapter adapter = this.getXmlConverterAdapter(); - if (adapter == null) { - if (this.converter.getType() != null) { - this.setConverter_(this.buildNullConverter()); - } - } else { - if (this.converter.getType() == adapter.getConverterType()) { - this.converter.synchronizeWithResourceModel(); - } else { - this.setConverter_(adapter.buildNewConverter(this, this.getContextNodeFactory())); - } - } - } - - /** - * Return the first adapter whose converter value is set in the XML mapping. - * Return null if there are no converter values in the XML. - */ - protected OrmConverter.Adapter getXmlConverterAdapter() { - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.isActive(this.xmlAttributeMapping)) { - return adapter; - } - } - return null; - } - - protected OrmConverter buildNullConverter() { - return new NullOrmConverter(this); - } - - - // ********** converter adapters ********** - - /** - * Return the converter adapter for the specified converter type. - */ - protected OrmConverter.Adapter getConverterAdapter(Class converterType) { - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.getConverterType() == converterType) { - return adapter; - } - } - return null; - } - - protected Iterable getConverterAdapters() { - return CONVERTER_ADAPTERS; - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY; - } - - public int getXmlSequence() { - return 30; - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmVersionMapping(this); - } - - @Override - protected void initializeFromOrmColumnMapping(OrmColumnMapping oldMapping) { - super.initializeFromOrmColumnMapping(oldMapping); - this.column.initializeFrom(oldMapping.getColumn()); - } - - public void addXmlAttributeMappingTo(Attributes xmlAttributes) { - xmlAttributes.getVersions().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) { - xmlAttributes.getVersions().remove(this.xmlAttributeMapping); - } - - - // ********** OrmColumn.Owner implementation ********** - - public String getDefaultColumnName() { - return this.name; - } - - public String getDefaultTableName() { - return this.getTypeMapping().getPrimaryTableName(); - } - - public Table resolveDbTable(String tableName) { - return this.getTypeMapping().resolveDbTable(tableName); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getTypeMapping().tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return this.getTypeMapping().allAssociatedTableNames(); - } - - public XmlColumn getXmlColumn() { - return this.xmlAttributeMapping.getColumn(); - } - - public XmlColumn buildXmlColumn() { - XmlColumn xmlColumn = OrmFactory.eINSTANCE.createXmlColumn(); - this.xmlAttributeMapping.setColumn(xmlColumn); - return xmlColumn; - } - - public void removeXmlColumn() { - this.xmlAttributeMapping.setColumn(null); - } - - - // ********** refactoring ********** - - @Override - @SuppressWarnings("unchecked") - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable( - super.createRenameTypeEdits(originalType, newName), - this.createConverterRenameTypeEdits(originalType, newName) - ); - } - - protected Iterable createConverterRenameTypeEdits(IType originalType, String newName) { - return (this.converter != null) ? - this.converter.createRenameTypeEdits(originalType, newName) : - EmptyIterable.instance(); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable( - super.createMoveTypeEdits(originalType, newPackage), - this.createConverterMoveTypeEdits(originalType, newPackage) - ); - } - - protected Iterable createConverterMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return (this.converter != null) ? - this.converter.createMoveTypeEdits(originalType, newPackage) : - EmptyIterable.instance(); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable( - super.createRenamePackageEdits(originalPackage, newName), - this.createConverterRenamePackageEdits(originalPackage, newName) - ); - } - - protected Iterable createConverterRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return (this.converter != null) ? - this.converter.createRenamePackageEdits(originalPackage, newName) : - EmptyIterable.instance(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.column.validate(messages, reporter); - this.converter.validate(messages, reporter); - } - - public JptValidator buildColumnValidator(NamedColumn col, NamedColumnTextRangeResolver textRangeResolver) { - return new NamedColumnValidator(this.getPersistentAttribute(), (BaseColumn) col, (BaseColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualBaseColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualBaseColumn.java deleted file mode 100644 index f41a3492f1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualBaseColumn.java +++ /dev/null @@ -1,238 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.JpaContextNode; -import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn; -import org.eclipse.jpt.jpa.core.context.VirtualBaseColumn; - -public abstract class AbstractOrmVirtualBaseColumn - extends AbstractOrmVirtualNamedColumn - implements VirtualBaseColumn -{ - protected String specifiedTable; - protected String defaultTable; - - protected Boolean specifiedUnique; - protected boolean defaultUnique; - - protected Boolean specifiedNullable; - protected boolean defaultNullable; - - protected Boolean specifiedInsertable; - protected boolean defaultInsertable; - - protected Boolean specifiedUpdatable; - protected boolean defaultUpdatable; - - - protected AbstractOrmVirtualBaseColumn(JpaContextNode parent, O owner) { - super(parent, owner); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - - this.setSpecifiedTable(this.buildSpecifiedTable()); - this.setDefaultTable(this.buildDefaultTable()); - - this.setSpecifiedUnique(this.buildSpecifiedUnique()); - this.setDefaultUnique(this.buildDefaultUnique()); - - this.setSpecifiedNullable(this.buildSpecifiedNullable()); - this.setDefaultNullable(this.buildDefaultNullable()); - - this.setSpecifiedInsertable(this.buildSpecifiedInsertable()); - this.setDefaultInsertable(this.buildDefaultInsertable()); - - this.setSpecifiedUpdatable(this.buildSpecifiedUpdatable()); - this.setDefaultUpdatable(this.buildDefaultUpdatable()); - } - - - // ********** table ********** - - public String getTable() { - return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable; - } - - public String getSpecifiedTable() { - return this.specifiedTable; - } - - protected void setSpecifiedTable(String table) { - String old = this.specifiedTable; - this.specifiedTable = table; - this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table); - } - - protected String buildSpecifiedTable() { - return this.getOverriddenColumn().getSpecifiedTable(); - } - - public String getDefaultTable() { - return this.defaultTable; - } - - protected void setDefaultTable(String table) { - String old = this.defaultTable; - this.defaultTable = table; - this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table); - } - - protected String buildDefaultTable() { - return this.owner.getDefaultTableName(); - } - - - // ********** unique ********** - - public boolean isUnique() { - return (this.specifiedUnique != null) ? this.specifiedUnique.booleanValue() : this.isDefaultUnique(); - } - - public Boolean getSpecifiedUnique() { - return this.specifiedUnique; - } - - protected void setSpecifiedUnique(Boolean unique) { - Boolean old = this.specifiedUnique; - this.specifiedUnique = unique; - this.firePropertyChanged(SPECIFIED_UNIQUE_PROPERTY, old, unique); - } - - protected Boolean buildSpecifiedUnique() { - return this.getOverriddenColumn().getSpecifiedUnique(); - } - - public boolean isDefaultUnique() { - return this.defaultUnique; - } - - protected void setDefaultUnique(boolean unique) { - boolean old = this.defaultUnique; - this.defaultUnique = unique; - this.firePropertyChanged(DEFAULT_UNIQUE_PROPERTY, old, unique); - } - - protected boolean buildDefaultUnique() { - return DEFAULT_UNIQUE; - } - - - // ********** nullable ********** - - public boolean isNullable() { - return (this.specifiedNullable != null) ? this.specifiedNullable.booleanValue() : this.isDefaultNullable(); - } - - public Boolean getSpecifiedNullable() { - return this.specifiedNullable; - } - - protected void setSpecifiedNullable(Boolean nullable) { - Boolean old = this.specifiedNullable; - this.specifiedNullable = nullable; - this.firePropertyChanged(SPECIFIED_NULLABLE_PROPERTY, old, nullable); - } - - protected Boolean buildSpecifiedNullable() { - return this.getOverriddenColumn().getSpecifiedNullable(); - } - - public boolean isDefaultNullable() { - return this.defaultNullable; - } - - protected void setDefaultNullable(boolean nullable) { - boolean old = this.defaultNullable; - this.defaultNullable = nullable; - this.firePropertyChanged(DEFAULT_NULLABLE_PROPERTY, old, nullable); - } - - protected boolean buildDefaultNullable() { - return DEFAULT_NULLABLE; - } - - - // ********** insertable ********** - - public boolean isInsertable() { - return (this.specifiedInsertable != null) ? this.specifiedInsertable.booleanValue() : this.isDefaultInsertable(); - } - - public Boolean getSpecifiedInsertable() { - return this.specifiedInsertable; - } - - protected void setSpecifiedInsertable(Boolean insertable) { - Boolean old = this.specifiedInsertable; - this.specifiedInsertable = insertable; - this.firePropertyChanged(SPECIFIED_INSERTABLE_PROPERTY, old, insertable); - } - - protected Boolean buildSpecifiedInsertable() { - return this.getOverriddenColumn().getSpecifiedInsertable(); - } - - public boolean isDefaultInsertable() { - return this.defaultInsertable; - } - - protected void setDefaultInsertable(boolean insertable) { - boolean old = this.defaultInsertable; - this.defaultInsertable = insertable; - this.firePropertyChanged(DEFAULT_INSERTABLE_PROPERTY, old, insertable); - } - - protected boolean buildDefaultInsertable() { - return DEFAULT_INSERTABLE; - } - - - // ********** updatable ********** - - public boolean isUpdatable() { - return (this.specifiedUpdatable != null) ? this.specifiedUpdatable.booleanValue() : this.isDefaultUpdatable(); - } - - public Boolean getSpecifiedUpdatable() { - return this.specifiedUpdatable; - } - - protected void setSpecifiedUpdatable(Boolean updatable) { - Boolean old = this.specifiedUpdatable; - this.specifiedUpdatable = updatable; - this.firePropertyChanged(SPECIFIED_UPDATABLE_PROPERTY, old, updatable); - } - - protected Boolean buildSpecifiedUpdatable() { - return this.getOverriddenColumn().getSpecifiedUpdatable(); - } - - public boolean isDefaultUpdatable() { - return this.defaultUpdatable; - } - - protected void setDefaultUpdatable(boolean updatable) { - boolean old = this.defaultUpdatable; - this.defaultUpdatable = updatable; - this.firePropertyChanged(DEFAULT_UPDATABLE_PROPERTY, old, updatable); - } - - protected boolean buildDefaultUpdatable() { - return DEFAULT_UPDATABLE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java deleted file mode 100644 index 93213006fc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualNamedColumn.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.JpaContextNode; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyNamedColumn; -import org.eclipse.jpt.jpa.core.context.VirtualNamedColumn; - -/** - * orm.xml virtual
    - *
  • column - *
  • join column - *
- * NB: all state is sync'ed/updated in {@link #update()} - * because all of its derived from the context model (i.e. none of it - * is derived from the resource model). - */ -public abstract class AbstractOrmVirtualNamedColumn - extends AbstractOrmXmlContextNode - implements VirtualNamedColumn -{ - protected final O owner; - - protected String specifiedName; - protected String defaultName; - - protected String columnDefinition; - - - protected AbstractOrmVirtualNamedColumn(JpaContextNode parent, O owner) { - super(parent); - this.owner = owner; - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - - this.setSpecifiedName(this.buildSpecifiedName()); - this.setDefaultName(this.buildDefaultName()); - - this.setColumnDefinition(this.buildColumnDefinition()); - } - - - // ********** column ********** - - /** - * This should never return null. - */ - public abstract C getOverriddenColumn(); - - - // ********** name ********** - - public String getName() { - return (this.specifiedName != null) ? this.specifiedName : this.defaultName; - } - - public String getSpecifiedName() { - return this.specifiedName; - } - - protected void setSpecifiedName(String name) { - String old = this.specifiedName; - this.specifiedName = name; - this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedName() { - return this.getOverriddenColumn().getSpecifiedName(); - } - - public String getDefaultName() { - return this.defaultName; - } - - protected void setDefaultName(String name) { - String old = this.defaultName; - this.defaultName = name; - this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name); - } - - protected String buildDefaultName() { - return this.owner.getDefaultColumnName(); - } - - - // ********** column definition ********** - - public String getColumnDefinition() { - return this.columnDefinition; - } - - protected void setColumnDefinition(String columnDefinition) { - String old = this.columnDefinition; - this.columnDefinition = columnDefinition; - this.firePropertyChanged(COLUMN_DEFINITION_PROPERTY, old, columnDefinition); - } - - protected String buildColumnDefinition() { - return this.getOverriddenColumn().getColumnDefinition(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return null; // not sure this column is validated... - } - - - // ********** misc ********** - - public boolean isVirtual() { - return true; - } - - @Override - public void toString(StringBuilder sb) { - String table = this.getTable(); - if (table != null) { - sb.append(table); - sb.append('.'); - } - sb.append(this.getName()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java deleted file mode 100644 index ff8ec49424..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualReferenceTable.java +++ /dev/null @@ -1,200 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JpaContextNode; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReferenceTable; -import org.eclipse.jpt.jpa.core.context.VirtualReferenceTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; - -public abstract class AbstractOrmVirtualReferenceTable - extends AbstractOrmVirtualTable - implements VirtualReferenceTable -{ - protected final Vector specifiedJoinColumns = new Vector(); - protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter = new SpecifiedJoinColumnContainerAdapter(); - protected final ReadOnlyJoinColumn.Owner joinColumnOwner; - - protected OrmVirtualJoinColumn defaultJoinColumn; - - - protected AbstractOrmVirtualReferenceTable(JpaContextNode parent) { - super(parent); - this.joinColumnOwner = this.buildJoinColumnOwner(); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.updateSpecifiedJoinColumns(); - this.updateDefaultJoinColumn(); - } - - - // ********** join columns ********** - - public ListIterator joinColumns() { - return this.getJoinColumns().iterator(); - } - - protected ListIterable getJoinColumns() { - return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns(); - } - - public int joinColumnsSize() { - return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize(); - } - - - // ********** specified join columns ********** - - public ListIterator specifiedJoinColumns() { - return this.getSpecifiedJoinColumns().iterator(); - } - - protected ListIterable getSpecifiedJoinColumns() { - return new LiveCloneListIterable(this.specifiedJoinColumns); - } - - public int specifiedJoinColumnsSize() { - return this.specifiedJoinColumns.size(); - } - - public boolean hasSpecifiedJoinColumns() { - return this.specifiedJoinColumns.size() != 0; - } - - public OrmVirtualJoinColumn getSpecifiedJoinColumn(int index) { - return this.specifiedJoinColumns.get(index); - } - - protected void updateSpecifiedJoinColumns() { - ContextContainerTools.update(this.specifiedJoinColumnContainerAdapter); - } - - protected Iterable getOverriddenJoinColumns() { - return CollectionTools.iterable(this.getOverriddenTable().specifiedJoinColumns()); - } - - protected void moveSpecifiedJoinColumn(int index, OrmVirtualJoinColumn joinColumn) { - this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - protected OrmVirtualJoinColumn addSpecifiedJoinColumn(int index, JoinColumn joinColumn) { - OrmVirtualJoinColumn virtualJoinColumn = this.buildJoinColumn(joinColumn); - this.addItemToList(index, virtualJoinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - return virtualJoinColumn; - } - - protected void removeSpecifiedJoinColumn(OrmVirtualJoinColumn joinColumn) { - this.removeItemFromList(joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - /** - * specified join column container adapter - */ - protected class SpecifiedJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractOrmVirtualReferenceTable.this.getSpecifiedJoinColumns(); - } - public Iterable getResourceElements() { - return AbstractOrmVirtualReferenceTable.this.getOverriddenJoinColumns(); - } - public JoinColumn getResourceElement(OrmVirtualJoinColumn contextElement) { - return contextElement.getOverriddenColumn(); - } - public void moveContextElement(int index, OrmVirtualJoinColumn element) { - AbstractOrmVirtualReferenceTable.this.moveSpecifiedJoinColumn(index, element); - } - public void addContextElement(int index, JoinColumn element) { - AbstractOrmVirtualReferenceTable.this.addSpecifiedJoinColumn(index, element); - } - public void removeContextElement(OrmVirtualJoinColumn element) { - AbstractOrmVirtualReferenceTable.this.removeSpecifiedJoinColumn(element); - } - } - - - // ********** default join column ********** - - public OrmVirtualJoinColumn getDefaultJoinColumn() { - return this.defaultJoinColumn; - } - - protected void setDefaultJoinColumn(OrmVirtualJoinColumn joinColumn) { - OrmVirtualJoinColumn old = this.defaultJoinColumn; - this.defaultJoinColumn = joinColumn; - this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn); - } - - protected ListIterable getDefaultJoinColumns() { - return (this.defaultJoinColumn != null) ? - new SingleElementListIterable(this.defaultJoinColumn) : - EmptyListIterable.instance(); - } - - protected int getDefaultJoinColumnsSize() { - return (this.defaultJoinColumn == null) ? 0 : 1; - } - - protected void updateDefaultJoinColumn() { - if (this.buildsDefaultJoinColumn()) { - if (this.defaultJoinColumn == null) { - this.setDefaultJoinColumn(this.buildJoinColumn(this.getOverriddenTable().getDefaultJoinColumn())); - } else { - this.defaultJoinColumn.update(); - } - } else { - this.setDefaultJoinColumn(null); - } - } - - protected boolean buildsDefaultJoinColumn() { - return ! this.hasSpecifiedJoinColumns(); - } - - - // ********** misc ********** - - protected OrmVirtualJoinColumn buildJoinColumn(JoinColumn joinColumn) { - return this.buildJoinColumn(this.joinColumnOwner, joinColumn); - } - - protected OrmVirtualJoinColumn buildJoinColumn(ReadOnlyJoinColumn.Owner owner, JoinColumn joinColumn) { - return this.getContextNodeFactory().buildOrmVirtualJoinColumn(this, owner, joinColumn); - } - - protected abstract ReadOnlyJoinColumn.Owner buildJoinColumnOwner(); - - @Override - protected String buildDefaultSchema() { - return this.getContextDefaultSchema(); - } - - @Override - protected String buildDefaultCatalog() { - return this.getContextDefaultCatalog(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java deleted file mode 100644 index becc15dd8a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmVirtualTable.java +++ /dev/null @@ -1,314 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.NameTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jpa.core.context.JpaContextNode; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.UniqueConstraint; -import org.eclipse.jpt.jpa.core.context.VirtualTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualUniqueConstraint; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; - -public abstract class AbstractOrmVirtualTable - extends AbstractOrmXmlContextNode - implements VirtualTable -{ - protected String specifiedName; - protected String defaultName; - - protected String specifiedSchema; - protected String defaultSchema; - - protected String specifiedCatalog; - protected String defaultCatalog; - - protected final Vector uniqueConstraints = new Vector(); - protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter(); - - - protected AbstractOrmVirtualTable(JpaContextNode parent) { - super(parent); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - - this.setSpecifiedName(this.buildSpecifiedName()); - this.setDefaultName(this.buildDefaultName()); - - this.setSpecifiedSchema(this.buildSpecifiedSchema()); - this.setDefaultSchema(this.buildDefaultSchema()); - - this.setSpecifiedCatalog(this.buildSpecifiedCatalog()); - this.setDefaultCatalog(this.buildDefaultCatalog()); - - this.updateUniqueConstraints(); - } - - - // ********** table ********** - - /** - * This should never return null. - */ - public abstract T getOverriddenTable(); - - - // ********** name ********** - - public String getName() { - return (this.specifiedName != null) ? this.specifiedName : this.defaultName; - } - - public String getSpecifiedName() { - return this.specifiedName; - } - - protected void setSpecifiedName(String name) { - String old = this.specifiedName; - this.specifiedName = name; - this.firePropertyChanged(SPECIFIED_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedName() { - return this.getOverriddenTable().getSpecifiedName(); - } - - public String getDefaultName() { - return this.defaultName; - } - - protected void setDefaultName(String name) { - String old = this.defaultName; - this.defaultName = name; - this.firePropertyChanged(DEFAULT_NAME_PROPERTY, old, name); - } - - protected abstract String buildDefaultName(); - - - // ********** schema ********** - - public String getSchema() { - return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema; - } - - public String getSpecifiedSchema() { - return this.specifiedSchema; - } - - protected void setSpecifiedSchema(String schema) { - String old = this.specifiedSchema; - this.specifiedSchema = schema; - this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema); - } - - protected String buildSpecifiedSchema() { - return this.getOverriddenTable().getSchema(); - } - - public String getDefaultSchema() { - return this.defaultSchema; - } - - protected void setDefaultSchema(String schema) { - String old = this.defaultSchema; - this.defaultSchema = schema; - this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema); - } - - protected abstract String buildDefaultSchema(); - - - // ********** catalog ********** - - public String getCatalog() { - return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog; - } - - public String getSpecifiedCatalog() { - return this.specifiedCatalog; - } - - protected void setSpecifiedCatalog(String catalog) { - String old = this.specifiedCatalog; - this.specifiedCatalog = catalog; - this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog); - } - - protected String buildSpecifiedCatalog() { - return this.getOverriddenTable().getCatalog(); - } - - public String getDefaultCatalog() { - return this.defaultCatalog; - } - - protected void setDefaultCatalog(String catalog) { - String old = this.defaultCatalog; - this.defaultCatalog = catalog; - this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog); - } - - protected abstract String buildDefaultCatalog(); - - - // ********** unique constraints ********** - - public ListIterator uniqueConstraints() { - return this.getUniqueConstraints().iterator(); - } - - protected ListIterable getUniqueConstraints() { - return new LiveCloneListIterable(this.uniqueConstraints); - } - - public int uniqueConstraintsSize() { - return this.uniqueConstraints.size(); - } - - public OrmVirtualUniqueConstraint getUniqueConstraint(int index) { - return this.uniqueConstraints.get(index); - } - - protected void updateUniqueConstraints() { - ContextContainerTools.update(this.uniqueConstraintContainerAdapter); - } - - protected Iterable getOverriddenUniqueConstraints() { - return CollectionTools.iterable(this.getOverriddenTable().uniqueConstraints()); - } - - protected void moveUniqueConstraint(int index, OrmVirtualUniqueConstraint constraint) { - this.moveItemInList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - } - - protected OrmVirtualUniqueConstraint addUniqueConstraint(int index, UniqueConstraint uniqueConstraint) { - OrmVirtualUniqueConstraint virtualConstraint = this.buildUniqueConstraint(uniqueConstraint); - this.addItemToList(index, virtualConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - return virtualConstraint; - } - - protected OrmVirtualUniqueConstraint buildUniqueConstraint(UniqueConstraint uniqueConstraint) { - return this.getContextNodeFactory().buildOrmVirtualUniqueConstraint(this, uniqueConstraint); - } - - protected void removeUniqueConstraint(OrmVirtualUniqueConstraint constraint) { - this.removeItemFromList(constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - } - - /** - * unique constraint container adapter - */ - protected class UniqueConstraintContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractOrmVirtualTable.this.getUniqueConstraints(); - } - public Iterable getResourceElements() { - return AbstractOrmVirtualTable.this.getOverriddenUniqueConstraints(); - } - public UniqueConstraint getResourceElement(OrmVirtualUniqueConstraint contextElement) { - return contextElement.getOverriddenUniqueConstraint(); - } - public void moveContextElement(int index, OrmVirtualUniqueConstraint element) { - AbstractOrmVirtualTable.this.moveUniqueConstraint(index, element); - } - public void addContextElement(int index, UniqueConstraint resourceElement) { - AbstractOrmVirtualTable.this.addUniqueConstraint(index, resourceElement); - } - public void removeContextElement(OrmVirtualUniqueConstraint element) { - AbstractOrmVirtualTable.this.removeUniqueConstraint(element); - } - } - - - // ********** database stuff ********** - - public org.eclipse.jpt.jpa.db.Table getDbTable() { - Schema dbSchema = this.getDbSchema(); - return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getName()); - } - - public Schema getDbSchema() { - SchemaContainer dbSchemaContainer = this.getDbSchemaContainer(); - return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema()); - } - - /** - * If we don't have a catalog (i.e. we don't even have a default catalog), - * then the database probably does not support catalogs; and we need to - * get the schema directly from the database. - */ - public SchemaContainer getDbSchemaContainer() { - String catalog = this.getCatalog(); - return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase(); - } - - /** - * If we don't have a catalog (i.e. we don't even have a default - * catalog), then the database probably does not support catalogs. - */ - public Catalog getDbCatalog() { - String catalog = this.getCatalog(); - return (catalog == null) ? null : this.resolveDbCatalog(catalog); - } - - protected boolean isResolved() { - return this.getDbTable() != null; - } - - protected boolean hasResolvedSchema() { - return this.getDbSchema() != null; - } - - /** - * If we don't have a catalog (i.e. we don't even have a default - * catalog), then the database probably does not support catalogs. - */ - protected boolean hasResolvedCatalog() { - String catalog = this.getCatalog(); - return (catalog == null) || (this.resolveDbCatalog(catalog) != null); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return null; - } - - - // ********** misc ********** - - @Override - public void toString(StringBuilder sb) { - sb.append(this.buildQualifiedName()); - } - - protected String buildQualifiedName() { - return NameTools.buildQualifiedDatabaseObjectName(this.getCatalog(), this.getSchema(), this.getName()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java deleted file mode 100644 index 6e8509a234..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNode.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.context.JpaContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.context.AbstractXmlContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory; - -/** - * Use this abstract class for context nodes that are part of an - * orm.xml file. - * This will not work for a pure {@link org.eclipse.jpt.jpa.core.context.MappingFile} - * implementation. - */ -public abstract class AbstractOrmXmlContextNode - extends AbstractXmlContextNode -{ - protected AbstractOrmXmlContextNode(JpaContextNode parent) { - super(parent); - } - - - // ********** convenience methods ********** - - protected OrmXmlDefinition getMappingFileDefinition() { - return (OrmXmlDefinition) this.getJpaPlatform().getResourceDefinition(this.getResourceType()); - } - - protected EFactory getResourceNodeFactory() { - return this.getMappingFileDefinition().getResourceNodeFactory(); - } - - /** - * Call {@link #isJpa2_0Compatible()} before calling this method. - */ - protected OrmXml2_0ContextNodeFactory getContextNodeFactory2_0() { - return (OrmXml2_0ContextNodeFactory) this.getContextNodeFactory(); - } - - protected OrmXmlContextNodeFactory getContextNodeFactory() { - return this.getMappingFileDefinition().getContextNodeFactory(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java deleted file mode 100644 index fd4ac81334..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlContextNodeFactory.java +++ /dev/null @@ -1,386 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.UniqueConstraint; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn.Owner; -import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable; -import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmBasicMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmDiscriminatorColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddable; -import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedIdMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmEntity; -import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratedValue; -import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratorContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmIdMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmManyToOneMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmMappedSuperclass; -import org.eclipse.jpt.jpa.core.context.orm.OrmNamedNativeQuery; -import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery; -import org.eclipse.jpt.jpa.core.context.orm.OrmOneToManyMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmOneToOneMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmOrderable; -import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitDefaults; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmQuery; -import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmQueryHint; -import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmSecondaryTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator; -import org.eclipse.jpt.jpa.core.context.orm.OrmTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator; -import org.eclipse.jpt.jpa.core.context.orm.OrmTransientMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint; -import org.eclipse.jpt.jpa.core.context.orm.OrmVersionMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverrideRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualSecondaryTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualUniqueConstraint; -import org.eclipse.jpt.jpa.core.context.orm.OrmXml; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericEntityMappings; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmAssociationOverride; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmAttributeOverride; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmBasicMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmColumn; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmDiscriminatorColumn; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEmbeddable; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEmbeddedIdMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEmbeddedMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEntity; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmEnumeratedConverter; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmGeneratedValue; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmGeneratorContainer; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmIdMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmJoinColumn; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmJoinTable; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmLobConverter; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmManyToManyMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmManyToOneMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmMappedSuperclass; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmNamedNativeQuery; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmNamedQuery; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmNullAttributeMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOneToManyMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOneToOneMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOrderable; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOverrideRelationship; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistenceUnitDefaults; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistenceUnitMetadata; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPersistentType; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmQueryContainer; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmQueryHint; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmSecondaryTable; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmSequenceGenerator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmTable; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmTableGenerator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmTemporalConverter; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmTransientMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmUniqueConstraint; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVersionMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualAssociationOverride; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualAttributeOverride; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualColumn; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualJoinColumn; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualOverrideRelationship; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmVirtualUniqueConstraint; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.UnsupportedOrmAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride; -import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue; -import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer; -import org.eclipse.jpt.jpa.core.resource.orm.XmlId; -import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany; -import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne; -import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne; -import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer; -import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint; -import org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable; -import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTransient; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint; -import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion; - -public abstract class AbstractOrmXmlContextNodeFactory - implements OrmXmlContextNodeFactory -{ - public EntityMappings buildEntityMappings(OrmXml parent, XmlEntityMappings xmlEntityMappings) { - return new GenericEntityMappings(parent, xmlEntityMappings); - } - - public OrmPersistenceUnitMetadata buildOrmPersistenceUnitMetadata(EntityMappings parent) { - return new GenericOrmPersistenceUnitMetadata(parent); - } - - public OrmPersistenceUnitDefaults buildOrmPersistenceUnitDefaults(OrmPersistenceUnitMetadata parent) { - return new GenericOrmPersistenceUnitDefaults(parent); - } - - public OrmPersistentType buildOrmPersistentType(EntityMappings parent, XmlTypeMapping resourceMapping) { - return new GenericOrmPersistentType(parent, resourceMapping); - } - - public OrmEntity buildOrmEntity(OrmPersistentType parent, XmlEntity resourceMapping) { - return new GenericOrmEntity(parent, resourceMapping); - } - - public OrmMappedSuperclass buildOrmMappedSuperclass(OrmPersistentType parent, XmlMappedSuperclass resourceMapping) { - return new GenericOrmMappedSuperclass(parent, resourceMapping); - } - - public OrmEmbeddable buildOrmEmbeddable(OrmPersistentType parent, XmlEmbeddable resourceMapping) { - return new GenericOrmEmbeddable(parent, resourceMapping); - } - - public OrmPersistentAttribute buildOrmPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlMapping) { - return new GenericOrmPersistentAttribute(parent, xmlMapping); - } - - public OrmReadOnlyPersistentAttribute buildVirtualOrmPersistentAttribute(OrmPersistentType parent, JavaResourcePersistentAttribute javaResourcePersistentAttribute) { - return new VirtualOrmPersistentAttribute(parent, javaResourcePersistentAttribute); - } - - public OrmTable buildOrmTable(OrmEntity parent, Table.Owner owner) { - return new GenericOrmTable(parent, owner); - } - - public OrmSecondaryTable buildOrmSecondaryTable(OrmEntity parent, Table.Owner owner, XmlSecondaryTable xmlSecondaryTable) { - return new GenericOrmSecondaryTable(parent, owner, xmlSecondaryTable); - } - - public OrmVirtualSecondaryTable buildOrmVirtualSecondaryTable(OrmEntity parent, JavaSecondaryTable javaSecondaryTable) { - return new GenericOrmVirtualSecondaryTable(parent, javaSecondaryTable); - } - - public OrmPrimaryKeyJoinColumn buildOrmPrimaryKeyJoinColumn(XmlContextNode parent, OrmBaseJoinColumn.Owner owner, XmlPrimaryKeyJoinColumn resourcePrimaryKeyJoinColumn) { - return new GenericOrmPrimaryKeyJoinColumn(parent, owner, resourcePrimaryKeyJoinColumn); - } - - public OrmVirtualPrimaryKeyJoinColumn buildOrmVirtualPrimaryKeyJoinColumn(XmlContextNode parent, Owner owner, JavaPrimaryKeyJoinColumn javaPrimaryKeyJoinColumn) { - return new GenericOrmVirtualPrimaryKeyJoinColumn(parent, owner, javaPrimaryKeyJoinColumn); - } - - public OrmJoinTable buildOrmJoinTable(OrmJoinTableRelationshipStrategy parent, Table.Owner owner) { - return new GenericOrmJoinTable(parent, owner); - } - - public OrmVirtualJoinTable buildOrmVirtualJoinTable(OrmVirtualJoinTableRelationshipStrategy parent, JoinTable overriddenTable) { - return new GenericOrmVirtualJoinTable(parent, overriddenTable); - } - - public OrmJoinColumn buildOrmJoinColumn(XmlContextNode parent, OrmJoinColumn.Owner owner, XmlJoinColumn xmlJoinColumn) { - return new GenericOrmJoinColumn(parent, owner, xmlJoinColumn); - } - - public OrmVirtualJoinColumn buildOrmVirtualJoinColumn(XmlContextNode parent, ReadOnlyJoinColumn.Owner owner, JoinColumn joinColumn) { - return new GenericOrmVirtualJoinColumn(parent, owner, joinColumn); - } - - public OrmAttributeOverrideContainer buildOrmAttributeOverrideContainer(XmlContextNode parent, OrmAttributeOverrideContainer.Owner owner) { - return new GenericOrmAttributeOverrideContainer(parent, owner); - } - - public OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(XmlContextNode parent, OrmAssociationOverrideContainer.Owner owner) { - return new GenericOrmAssociationOverrideContainer(parent, owner); - } - - public OrmAttributeOverride buildOrmAttributeOverride(OrmAttributeOverrideContainer parent, XmlAttributeOverride xmlOverride) { - return new GenericOrmAttributeOverride(parent, xmlOverride); - } - - public OrmVirtualAttributeOverride buildOrmVirtualAttributeOverride(OrmAttributeOverrideContainer parent, String name) { - return new GenericOrmVirtualAttributeOverride(parent, name); - } - - public OrmAssociationOverride buildOrmAssociationOverride(OrmAssociationOverrideContainer parent, XmlAssociationOverride xmlOverride) { - return new GenericOrmAssociationOverride(parent, xmlOverride); - } - - public OrmVirtualAssociationOverride buildOrmVirtualAssociationOverride(OrmAssociationOverrideContainer parent, String name) { - return new GenericOrmVirtualAssociationOverride(parent, name); - } - - public OrmOverrideRelationship buildOrmOverrideRelationship(OrmAssociationOverride parent) { - return new GenericOrmOverrideRelationship(parent); - } - - public OrmVirtualOverrideRelationship buildOrmVirtualOverrideRelationship(OrmVirtualAssociationOverride parent) { - return new GenericOrmVirtualOverrideRelationship(parent); - } - - public OrmDiscriminatorColumn buildOrmDiscriminatorColumn(OrmEntity parent, OrmDiscriminatorColumn.Owner owner) { - return new GenericOrmDiscriminatorColumn(parent, owner); - } - - public OrmColumn buildOrmColumn(XmlContextNode parent, OrmColumn.Owner owner) { - return new GenericOrmColumn(parent, owner); - } - - public OrmVirtualColumn buildOrmVirtualColumn(XmlContextNode parent, OrmVirtualColumn.Owner owner) { - return new GenericOrmVirtualColumn(parent, owner); - } - - public OrmGeneratedValue buildOrmGeneratedValue(XmlContextNode parent, XmlGeneratedValue resourceGeneratedValue) { - return new GenericOrmGeneratedValue(parent, resourceGeneratedValue); - } - - public OrmGeneratorContainer buildOrmGeneratorContainer(XmlContextNode parent, XmlGeneratorContainer resourceGeneratorContainer) { - return new GenericOrmGeneratorContainer(parent, resourceGeneratorContainer); - } - - public OrmSequenceGenerator buildOrmSequenceGenerator(XmlContextNode parent, XmlSequenceGenerator resourceSequenceGenerator) { - return new GenericOrmSequenceGenerator(parent, resourceSequenceGenerator); - } - - public OrmTableGenerator buildOrmTableGenerator(XmlContextNode parent, XmlTableGenerator resourceTableGenerator) { - return new GenericOrmTableGenerator(parent, resourceTableGenerator); - } - - public OrmQueryContainer buildOrmQueryContainer(XmlContextNode parent, XmlQueryContainer resourceQueryContainer) { - return new GenericOrmQueryContainer(parent, resourceQueryContainer); - } - - public OrmNamedNativeQuery buildOrmNamedNativeQuery(XmlContextNode parent, XmlNamedNativeQuery resourceNamedNativeQuery) { - return new GenericOrmNamedNativeQuery(parent, resourceNamedNativeQuery); - } - - public OrmNamedQuery buildOrmNamedQuery(XmlContextNode parent, XmlNamedQuery resourceNamedQuery) { - return new GenericOrmNamedQuery(parent, resourceNamedQuery); - } - - public OrmQueryHint buildOrmQueryHint(OrmQuery parent, XmlQueryHint resourceQueryHint) { - return new GenericOrmQueryHint(parent, resourceQueryHint); - } - - public OrmBasicMapping buildOrmBasicMapping(OrmPersistentAttribute parent, XmlBasic resourceMapping) { - return new GenericOrmBasicMapping(parent, resourceMapping); - } - - public OrmEmbeddedMapping buildOrmEmbeddedMapping(OrmPersistentAttribute parent, XmlEmbedded resourceMapping) { - return new GenericOrmEmbeddedMapping(parent, resourceMapping); - } - - public OrmEmbeddedIdMapping buildOrmEmbeddedIdMapping(OrmPersistentAttribute parent, XmlEmbeddedId resourceMapping) { - return new GenericOrmEmbeddedIdMapping(parent, resourceMapping); - } - - public OrmIdMapping buildOrmIdMapping(OrmPersistentAttribute parent, XmlId resourceMapping) { - return new GenericOrmIdMapping(parent, resourceMapping); - } - - public OrmManyToManyMapping buildOrmManyToManyMapping(OrmPersistentAttribute parent, XmlManyToMany resourceMapping) { - return new GenericOrmManyToManyMapping(parent, resourceMapping); - } - - public OrmManyToOneMapping buildOrmManyToOneMapping(OrmPersistentAttribute parent, XmlManyToOne resourceMapping) { - return new GenericOrmManyToOneMapping(parent, resourceMapping); - } - - public OrmOneToManyMapping buildOrmOneToManyMapping(OrmPersistentAttribute parent, XmlOneToMany resourceMapping) { - return new GenericOrmOneToManyMapping(parent, resourceMapping); - } - - public OrmOneToOneMapping buildOrmOneToOneMapping(OrmPersistentAttribute parent, XmlOneToOne resourceMapping) { - return new GenericOrmOneToOneMapping(parent, resourceMapping); - } - - public OrmTransientMapping buildOrmTransientMapping(OrmPersistentAttribute parent, XmlTransient resourceMapping) { - return new GenericOrmTransientMapping(parent, resourceMapping); - } - - public OrmVersionMapping buildOrmVersionMapping(OrmPersistentAttribute parent, XmlVersion resourceMapping) { - return new GenericOrmVersionMapping(parent, resourceMapping); - } - - public OrmAttributeMapping buildOrmNullAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping resourceMapping) { - return new GenericOrmNullAttributeMapping(parent, resourceMapping); - } - - public OrmAttributeMapping buildUnsupportedOrmAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping resourceMapping) { - return new UnsupportedOrmAttributeMapping(parent, resourceMapping); - } - - public OrmUniqueConstraint buildOrmUniqueConstraint(XmlContextNode parent, UniqueConstraint.Owner owner, XmlUniqueConstraint resourceUniqueConstraint) { - return new GenericOrmUniqueConstraint(parent, owner, resourceUniqueConstraint); - } - - public OrmVirtualUniqueConstraint buildOrmVirtualUniqueConstraint(XmlContextNode parent, UniqueConstraint overriddenUniqueConstraint) { - return new GenericOrmVirtualUniqueConstraint(parent, overriddenUniqueConstraint); - } - - public OrmConverter buildOrmEnumeratedConverter(OrmAttributeMapping parent) { - return new GenericOrmEnumeratedConverter(parent); - } - - public OrmConverter buildOrmLobConverter(OrmAttributeMapping parent) { - return new GenericOrmLobConverter(parent); - } - - public OrmConverter buildOrmTemporalConverter(OrmAttributeMapping parent) { - return new GenericOrmTemporalConverter(parent); - } - - public OrmOrderable buildOrmOrderable(OrmAttributeMapping parent) { - return new GenericOrmOrderable(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlDefinition.java deleted file mode 100644 index 97b9f47aac..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/AbstractOrmXmlDefinition.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.ArrayList; - -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition; -import org.eclipse.jpt.jpa.core.context.orm.UnsupportedOrmAttributeMappingDefinition; - -/** - * All the state in the definition should be "static" - * (i.e. unchanging once it is initialized). - */ -public abstract class AbstractOrmXmlDefinition - implements OrmXmlDefinition -{ - protected final OrmXmlContextNodeFactory factory; - - protected ArrayList typeMappingDefinitions; - - protected ArrayList attributeMappingDefinitions; - - - /** - * zero-argument constructor - */ - protected AbstractOrmXmlDefinition() { - super(); - this.factory = this.buildContextNodeFactory(); - } - - - // ********** factory ********** - - protected abstract OrmXmlContextNodeFactory buildContextNodeFactory(); - - public OrmXmlContextNodeFactory getContextNodeFactory() { - return this.factory; - } - - - // ********** type mapping definitions ********** - - public OrmTypeMappingDefinition getTypeMappingDefinition(String mappingKey) { - for (OrmTypeMappingDefinition definition : this.getTypeMappingDefinitions()) { - if (Tools.valuesAreEqual(definition.getKey(), mappingKey)) { - return definition; - } - } - throw new IllegalArgumentException("Illegal type mapping key: " + mappingKey); //$NON-NLS-1$ - } - - /** - * Return a list of mapping definitions to use for types in - * orm.xml mapping files. - * The order is unimportant. - */ - protected synchronized ArrayList getTypeMappingDefinitions() { - if (this.typeMappingDefinitions == null) { - this.typeMappingDefinitions = this.buildTypeMappingDefinitions(); - } - return this.typeMappingDefinitions; - } - - protected ArrayList buildTypeMappingDefinitions() { - ArrayList definitions = new ArrayList(); - this.addTypeMappingDefinitionsTo(definitions); - return definitions; - } - - protected abstract void addTypeMappingDefinitionsTo(ArrayList definitions); - - - // ********** attribute mapping definitions ********** - - public OrmAttributeMappingDefinition getAttributeMappingDefinition(String mappingKey) { - for (OrmAttributeMappingDefinition definition : this.getAttributeMappingDefinitions()) { - if (Tools.valuesAreEqual(definition.getKey(), mappingKey)) { - return definition; - } - } - return UnsupportedOrmAttributeMappingDefinition.instance(); - } - - /** - * Return a list of mapping definitions to use for attributes in - * orm.xml mapping files. - * The order is unimportant. - */ - protected synchronized ArrayList getAttributeMappingDefinitions() { - if (this.attributeMappingDefinitions == null) { - this.attributeMappingDefinitions = this.buildAttributeMappingDefinitions(); - } - return this.attributeMappingDefinitions; - } - - protected ArrayList buildAttributeMappingDefinitions() { - ArrayList definitions = new ArrayList(); - this.addAttributeMappingDefinitionsTo(definitions); - return definitions; - } - - protected abstract void addAttributeMappingDefinitionsTo(ArrayList definitions); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java deleted file mode 100644 index b3f7677a18..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmIdClassReference.java +++ /dev/null @@ -1,323 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.java.JavaIdClassReference; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; -import org.eclipse.jpt.jpa.core.context.orm.OrmIdClassReference; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.AbstractXmlContextNode; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference; -import org.eclipse.jpt.jpa.core.resource.orm.XmlIdClassContainer; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml ID class reference - */ -public class GenericOrmIdClassReference - extends AbstractXmlContextNode - implements OrmIdClassReference -{ - protected final Owner owner; - - protected String specifiedIdClassName; - protected String defaultIdClassName; - protected JavaPersistentType idClass; - - - public GenericOrmIdClassReference(OrmTypeMapping parent, Owner owner) { - super(parent); - this.owner = owner; - this.specifiedIdClassName = this.buildSpecifiedIdClassName(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedIdClassName_(this.buildSpecifiedIdClassName()); - // sync the id class *after* we have the specified name - this.syncIdClass(); - } - - @Override - public void update() { - super.update(); - this.setDefaultIdClassName(this.buildDefaultIdClassName()); - this.updateIdClass(); - } - - - // ********** id class name ********** - - public String getIdClassName() { - return (this.specifiedIdClassName != null) ? this.specifiedIdClassName : this.defaultIdClassName; - } - - public String getSpecifiedIdClassName() { - return this.specifiedIdClassName; - } - - public void setSpecifiedIdClassName(String name) { - if (this.valuesAreDifferent(this.specifiedIdClassName, name)) { - XmlClassReference xmlClassRef = this.getXmlIdClassRefForUpdate(); - this.setSpecifiedIdClassName_(name); - xmlClassRef.setClassName(name); - this.removeXmlIdClassRefIfUnset(); - } - } - - /** - * We clear out {@link #idClass} here because we cannot compare its name - * to the specified name, since it may have been prefixed by the entity - * mappings package. - */ - protected void setSpecifiedIdClassName_(String name) { - String old = this.specifiedIdClassName; - this.specifiedIdClassName = name; - if (this.firePropertyChanged(SPECIFIED_ID_CLASS_NAME_PROPERTY, old, name)) { - // clear out the Java type here, it will be rebuilt during "update" - if (this.idClass != null) { - this.idClass.dispose(); - this.setIdClass(null); - } - } - } - - protected String buildSpecifiedIdClassName() { - XmlClassReference xmlIdClassRef = this.getXmlIdClassRef(); - return (xmlIdClassRef == null) ? null : xmlIdClassRef.getClassName(); - } - - public String getDefaultIdClassName() { - return this.defaultIdClassName; - } - - protected void setDefaultIdClassName(String name) { - String old = this.defaultIdClassName; - this.defaultIdClassName = name; - this.firePropertyChanged(DEFAULT_ID_CLASS_NAME_PROPERTY, old, name); - } - - protected String buildDefaultIdClassName() { - JavaIdClassReference javaRef = this.owner.getJavaIdClassReferenceForDefaults(); - return (javaRef == null) ? null : javaRef.getFullyQualifiedIdClassName(); - } - - public boolean isSpecified() { - return this.getIdClassName() != null; - } - - - // ********** xml id class ref ********** - - /** - * Return null if the XML class ref does not exists. - */ - protected XmlClassReference getXmlIdClassRef() { - return this.getXmlIdClassContainer().getIdClass(); - } - - /** - * Build the XML class ref if it does not exist. - */ - protected XmlClassReference getXmlIdClassRefForUpdate() { - XmlClassReference xmlClassRef = this.getXmlIdClassRef(); - return (xmlClassRef != null) ? xmlClassRef : this.buildXmlIdClassRef(); - } - - protected XmlClassReference buildXmlIdClassRef() { - XmlClassReference ref = OrmFactory.eINSTANCE.createXmlClassReference(); - this.getXmlIdClassContainer().setIdClass(ref); - return ref; - } - - protected void removeXmlIdClassRefIfUnset() { - if (this.getXmlIdClassRef().isUnset()) { - this.removeXmlIdClassRef(); - } - } - - protected void removeXmlIdClassRef() { - this.getXmlIdClassContainer().setIdClass(null); - } - - - // ********** id class ********** - - public JavaPersistentType getIdClass() { - return this.idClass; - } - - protected void setIdClass(JavaPersistentType idClass) { - JavaPersistentType old = this.idClass; - this.idClass = idClass; - this.firePropertyChanged(ID_CLASS_PROPERTY, old, idClass); - } - - /** - * If the specified ID class name changes during - * sync, the ID class will be cleared out in - * {@link #setSpecifiedIdClassName_(String)}. If we get here and - * the ID class is still present, we can - * sync it. Of course, it might be still obsolete if the - * entity mappings's package has changed.... - * - * @see #updateIdClass() - */ - protected void syncIdClass() { - if (this.idClass != null) { - this.idClass.synchronizeWithResourceModel(); - } - } - - /** - * @see #syncIdClass() - */ - protected void updateIdClass() { - JavaResourcePersistentType resourceIdClass = this.resolveJavaResourceIdClass(); - if (resourceIdClass == null) { - if (this.idClass != null) { - this.idClass.dispose(); - this.setIdClass(null); - } - } else { - if (this.idClass == null) { - this.setIdClass(this.buildIdClass(resourceIdClass)); - } else { - if (this.idClass.getResourcePersistentType() == resourceIdClass) { - this.idClass.update(); - } else { - this.idClass.dispose(); - this.setIdClass(this.buildIdClass(resourceIdClass)); - } - } - } - } - - // TODO I'm not sure we should be go to the entity mappings to resolve - // our name if it is taken from the Java ID class reference... - protected JavaResourcePersistentType resolveJavaResourceIdClass() { - String idClassName = this.getIdClassName(); - return (idClassName == null) ? null : this.getEntityMappings().resolveJavaResourcePersistentType(idClassName); - } - - protected JavaPersistentType buildIdClass(JavaResourcePersistentType resourceIdClass) { - return this.getJpaFactory().buildJavaPersistentType(this, resourceIdClass); - } - - public char getIdClassEnclosingTypeSeparator() { - return '$'; - } - - - // ********** misc ********** - - @Override - public OrmTypeMapping getParent() { - return (OrmTypeMapping) super.getParent(); - } - - protected OrmTypeMapping getTypeMapping() { - return this.getParent(); - } - - protected OrmPersistentType getPersistentType() { - return this.getTypeMapping().getPersistentType(); - } - - protected XmlIdClassContainer getXmlIdClassContainer() { - return this.owner.getXmlIdClassContainer(); - } - - protected EntityMappings getEntityMappings() { - return (EntityMappings) this.getMappingFileRoot(); - } - - - // ********** PersistentType.Owner implementation ********** - - public AccessType getOverridePersistentTypeAccess() { - return this.getPersistentType().getAccess(); - } - - public AccessType getDefaultPersistentTypeAccess() { - // this shouldn't be needed, since we've specified an override access, but just to be safe ... - return this.getPersistentType().getAccess(); - } - - - // ********** refactoring ********** - - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return this.isFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable(this.createRenameEdit(originalType, newName)) : - EmptyIterable.instance(); - } - - protected ReplaceEdit createRenameEdit(IType originalType, String newName) { - return this.getXmlIdClassRef().createRenameEdit(originalType, newName); - } - - protected boolean isFor(String typeName) { - return (this.idClass != null) && this.idClass.isFor(typeName); - } - - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.isFor(originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable(this.createRenamePackageEdit(newPackage.getElementName())) : - EmptyIterable.instance(); - } - - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.isIn(originalPackage) ? - new SingleElementIterable(this.createRenamePackageEdit(newName)) : - EmptyIterable.instance(); - } - - protected ReplaceEdit createRenamePackageEdit(String newName) { - return this.getXmlIdClassRef().createRenamePackageEdit(newName); - } - - protected boolean isIn(IPackageFragment originalPackage) { - return (this.idClass != null) && this.idClass.isIn(originalPackage); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - // most validation is done "holistically" from the type mapping level - } - - public TextRange getValidationTextRange() { - XmlClassReference xmlIdClassRef = this.getXmlIdClassRef(); - return (xmlIdClassRef == null) ? - this.getTypeMapping().getValidationTextRange() : - xmlIdClassRef.getClassNameTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java deleted file mode 100644 index e4a2fc81e0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToManyRelationship.java +++ /dev/null @@ -1,172 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.MappedByRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmManyToManyRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmMappedByRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy; -import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericOrmManyToManyRelationship - extends AbstractOrmMappingRelationship - implements OrmManyToManyRelationship -{ - protected final OrmMappedByRelationshipStrategy mappedByStrategy; - - protected final OrmJoinTableRelationshipStrategy joinTableStrategy; - - - public GenericOrmManyToManyRelationship(OrmManyToManyMapping parent) { - super(parent); - this.mappedByStrategy = this.buildMappedByStrategy(); - this.joinTableStrategy = this.buildJoinTableStrategy(); - - this.strategy = this.buildStrategy(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mappedByStrategy.synchronizeWithResourceModel(); - this.joinTableStrategy.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mappedByStrategy.update(); - this.joinTableStrategy.update(); - } - - - // ********** strategy ********** - - @Override - protected OrmRelationshipStrategy buildStrategy() { - if (this.mappedByStrategy.getMappedByAttribute() != null) { - return this.mappedByStrategy; - } - return this.joinTableStrategy; - } - - - // ********** mapped by strategy ********** - - public OrmMappedByRelationshipStrategy getMappedByStrategy() { - return this.mappedByStrategy; - } - - public boolean strategyIsMappedBy() { - return this.strategy == this.mappedByStrategy; - } - - public void setStrategyToMappedBy() { - this.mappedByStrategy.addStrategy(); - this.joinTableStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayBeMappedBy(AttributeMapping mapping) { - return mapping.getKey() == MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY; - } - - protected OrmMappedByRelationshipStrategy buildMappedByStrategy() { - return new GenericOrmMappedByRelationshipStrategy(this); - } - - - // ********** join table strategy ********** - - public OrmJoinTableRelationshipStrategy getJoinTableStrategy() { - return this.joinTableStrategy; - } - - public boolean strategyIsJoinTable() { - return this.strategy == this.joinTableStrategy; - } - - public void setStrategyToJoinTable() { - // join table is the default strategy, so no need to add to resource - this.mappedByStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayHaveDefaultJoinTable() { - return this.mappedByStrategy.getMappedByAttribute() == null; - } - - protected OrmJoinTableRelationshipStrategy buildJoinTableStrategy() { - return new GenericOrmMappingJoinTableRelationshipStrategy(this); - } - - - // ********** conversions ********** - - public void initializeOn(Relationship newRelationship) { - newRelationship.initializeFromMappedByRelationship(this); - newRelationship.initializeFromJoinTableRelationship(this); - } - - @Override - public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) { - super.initializeFromMappedByRelationship(oldRelationship); - this.mappedByStrategy.initializeFrom(oldRelationship.getMappedByStrategy()); - } - - @Override - public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) { - super.initializeFromJoinTableRelationship(oldRelationship); - this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy()); - } - - - // ********** misc ********** - - @Override - protected XmlManyToMany getXmlMapping() { - return (XmlManyToMany) super.getXmlMapping(); - } - - public XmlManyToMany getXmlContainer() { - return this.getXmlMapping(); - } - - public boolean isOwner() { - return this.mappedByStrategy.getMappedByAttribute() == null; - } - - public boolean isOwnedBy(RelationshipMapping mapping) { - return this.mappedByStrategy.relationshipIsOwnedBy(mapping); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.mappedByStrategy.validate(messages, reporter); - this.joinTableStrategy.validate(messages, reporter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java deleted file mode 100644 index 39a61109b0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmManyToOneRelationship.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmManyToOneMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmManyToOneRelationship2_0; -import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericOrmManyToOneRelationship - extends AbstractOrmMappingRelationship - implements OrmManyToOneRelationship2_0 -{ - protected final OrmJoinColumnRelationshipStrategy joinColumnStrategy; - - // JPA 2.0 - protected final OrmJoinTableRelationshipStrategy joinTableStrategy; - - - public GenericOrmManyToOneRelationship(OrmManyToOneMapping parent) { - super(parent); - this.joinColumnStrategy = this.buildJoinColumnStrategy(); - this.joinTableStrategy = this.buildJoinTableStrategy(); - - this.strategy = this.buildStrategy(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.joinColumnStrategy.synchronizeWithResourceModel(); - this.joinTableStrategy.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.joinColumnStrategy.update(); - this.joinTableStrategy.update(); - } - - - // ********** strategy ********** - - @Override - protected OrmRelationshipStrategy buildStrategy() { - if (this.isJpa2_0Compatible()) { - if (this.joinTableStrategy.getJoinTable() != null){ - return this.joinTableStrategy; - } - } - return this.joinColumnStrategy; - } - - - // ********** join table strategy ********** - - public OrmJoinTableRelationshipStrategy getJoinTableStrategy() { - return this.joinTableStrategy; - } - - public boolean strategyIsJoinTable() { - return this.strategy == this.joinTableStrategy; - } - - public void setStrategyToJoinTable() { - this.joinTableStrategy.addStrategy(); - this.joinColumnStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayHaveDefaultJoinTable() { - return false; - } - - protected OrmJoinTableRelationshipStrategy buildJoinTableStrategy() { - return this.isJpa2_0Compatible() ? - new GenericOrmMappingJoinTableRelationshipStrategy(this) : - new NullOrmJoinTableRelationshipStrategy(this); - } - - - - // ********** join column strategy ********** - - public OrmJoinColumnRelationshipStrategy getJoinColumnStrategy() { - return this.joinColumnStrategy; - } - - public boolean strategyIsJoinColumn() { - return this.strategy == this.joinColumnStrategy; - } - - public void setStrategyToJoinColumn() { - // join column strategy is the default; so no need to add stuff, - // just remove all the others - this.joinTableStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayHaveDefaultJoinColumn() { - return this.joinTableStrategy.getJoinTable() == null; - } - - protected OrmJoinColumnRelationshipStrategy buildJoinColumnStrategy() { - return new GenericOrmMappingJoinColumnRelationshipStrategy(this); - } - - - // ********** conversions ********** - - public void initializeOn(Relationship newRelationship) { - newRelationship.initializeFromJoinColumnRelationship(this); - newRelationship.initializeFromJoinTableRelationship(this); - } - - @Override - public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) { - super.initializeFromJoinTableRelationship(oldRelationship); - this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy()); - } - - @Override - public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) { - super.initializeFromJoinColumnRelationship(oldRelationship); - this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy()); - } - - - // ********** misc ********** - - @Override - protected XmlManyToOne getXmlMapping() { - return (XmlManyToOne) super.getXmlMapping(); - } - - public XmlManyToOne getXmlContainer() { - return this.getXmlMapping(); - } - - public boolean isOwner() { - return true; - } - - public boolean isOwnedBy(RelationshipMapping mapping) { - return false; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.joinColumnStrategy.validate(messages, reporter); - this.joinTableStrategy.validate(messages, reporter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappedByRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappedByRelationshipStrategy.java deleted file mode 100644 index 903f984532..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappedByRelationshipStrategy.java +++ /dev/null @@ -1,223 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.MappedByRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmMappedByRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmMappedByRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedByMapping; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericOrmMappedByRelationshipStrategy - extends AbstractOrmXmlContextNode - implements OrmMappedByRelationshipStrategy -{ - protected String mappedByAttribute; - - - public GenericOrmMappedByRelationshipStrategy(OrmMappedByRelationship parent) { - super(parent); - this.mappedByAttribute = this.getXmlMappedByMapping().getMappedBy(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setMappedByAttribute_(this.getXmlMappedByMapping().getMappedBy()); - } - - - // ********** mapped by attribute ********** - - public String getMappedByAttribute() { - return this.mappedByAttribute; - } - - public void setMappedByAttribute(String mappedByAttribute) { - this.setMappedByAttribute_(mappedByAttribute); - this.getXmlMappedByMapping().setMappedBy(mappedByAttribute); - } - - protected void setMappedByAttribute_(String mappedByAttribute) { - String old = this.mappedByAttribute; - this.mappedByAttribute = mappedByAttribute; - this.firePropertyChanged(MAPPED_BY_ATTRIBUTE_PROPERTY, old, mappedByAttribute); - } - - - // ********** misc ********** - - @Override - public OrmMappedByRelationship getParent() { - return (OrmMappedByRelationship) super.getParent(); - } - - public OrmMappedByRelationship getRelationship() { - return this.getParent(); - } - - protected XmlMappedByMapping getXmlMappedByMapping() { - return this.getRelationship().getXmlContainer(); - } - - public void initializeFrom(MappedByRelationshipStrategy oldStrategy) { - this.setMappedByAttribute(oldStrategy.getMappedByAttribute()); - } - - public String getTableName() { - RelationshipMapping owner = this.getRelationshipOwner(); - return (owner == null) ? null : owner.getRelationship().getStrategy().getTableName(); - } - - public Table resolveDbTable(String tableName) { - RelationshipMapping owner = this.getRelationshipOwner(); - return (owner == null) ? null : owner.getRelationship().getStrategy().resolveDbTable(tableName); - } - - public boolean tableNameIsInvalid(String tableName) { - RelationshipMapping owner = this.getRelationshipOwner(); - return (owner != null) && owner.getRelationship().getStrategy().tableNameIsInvalid(tableName); - } - - public String getColumnTableNotValidDescription() { - // this will not be called if getRelationshipOwner() returns null - return this.getRelationshipOwner().getRelationship().getStrategy().getColumnTableNotValidDescription(); - } - - protected RelationshipMapping getRelationshipOwner() { - return this.getRelationshipMapping().getRelationshipOwner(); - } - - public boolean isOverridable() { - return false; - } - - protected RelationshipMapping getRelationshipMapping() { - return this.getRelationship().getMapping(); - } - - public boolean relationshipIsOwnedBy(RelationshipMapping otherMapping) { - String thisEntityName = this.getEntityName(); - Entity otherEntity = otherMapping.getResolvedTargetEntity(); - String otherEntityName = (otherEntity == null) ? null : otherEntity.getName(); - return Tools.valuesAreEqual(thisEntityName, otherEntityName) && - Tools.valuesAreEqual(this.mappedByAttribute, otherMapping.getName()); - } - - protected String getEntityName() { - Entity entity = this.getRelationship().getEntity(); - return (entity == null) ? null : entity.getName(); - } - - public void addStrategy() { - if (this.mappedByAttribute == null) { - this.setMappedByAttribute(""); //$NON-NLS-1$ - } - } - - public void removeStrategy() { - if (this.mappedByAttribute != null) { - this.setMappedByAttribute(null); - } - } - - public Iterator candidateMappedByAttributeNames() { - return this.getRelationshipMapping().allTargetEntityAttributeNames(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - TextRange mappedByTextRange = this.getXmlMappedByMapping().getMappedByTextRange(); - return (mappedByTextRange != null) ? mappedByTextRange : this.getRelationship().getValidationTextRange(); - } - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - - if (this.mappedByAttribute == null) { - return; - } - - Entity targetEntity = this.getRelationshipMapping().getResolvedTargetEntity(); - if (targetEntity == null) { - return; // null target entity is validated elsewhere - } - - AttributeMapping mappedByMapping = targetEntity.resolveAttributeMapping(this.mappedByAttribute); - - if (mappedByMapping == null) { - messages.add( - this.buildMessage( - JpaValidationMessages.MAPPING_UNRESOLVED_MAPPED_BY, - new String[] {this.mappedByAttribute} - ) - ); - return; - } - - if ( ! this.getRelationship().mayBeMappedBy(mappedByMapping)) { - messages.add( - this.buildMessage( - JpaValidationMessages.MAPPING_INVALID_MAPPED_BY, - new String[] {this.mappedByAttribute} - ) - ); - return; - } - - // if mappedByMapping is not a relationship owner, then it should have - // been flagged in above rule (mappedByIsValid) - if ( ! ((RelationshipMapping) mappedByMapping).isRelationshipOwner()) { - messages.add( - this.buildMessage( - JpaValidationMessages.MAPPING_MAPPED_BY_ON_BOTH_SIDES, - new String[] {this.mappedByAttribute} - ) - ); - } - } - - protected IMessage buildMessage(String msgID, String[] parms) { - PersistentAttribute attribute = this.getRelationshipMapping().getPersistentAttribute(); - String attributeDescription = attribute.isVirtual() ? - JpaValidationDescriptionMessages.VIRTUAL_ATTRIBUTE_DESC : - JpaValidationDescriptionMessages.ATTRIBUTE_DESC; - attributeDescription = NLS.bind(attributeDescription, attribute.getName()); - parms = ArrayTools.add(parms, 0, attributeDescription); - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - msgID, - parms, - this, - this.getValidationTextRange() - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java deleted file mode 100644 index 3af2618b64..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Iterator; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmMappingJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn.Owner; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; -import org.eclipse.jpt.jpa.db.Table; - -public class GenericOrmMappingJoinColumnRelationshipStrategy - extends AbstractOrmJoinColumnRelationshipStrategy -{ - protected final boolean targetForeignKey; - - - /** - * The default strategy is for a "source" foreign key. - */ - public GenericOrmMappingJoinColumnRelationshipStrategy(OrmMappingJoinColumnRelationship parent) { - this(parent, false); - } - - public GenericOrmMappingJoinColumnRelationshipStrategy(OrmMappingJoinColumnRelationship parent, boolean targetForeignKey) { - super(parent); - this.targetForeignKey = targetForeignKey; - } - - - @Override - protected Owner buildJoinColumnOwner() { - return new JoinColumnOwner(); - } - - public boolean isOverridable() { - return true; - } - - public TypeMapping getRelationshipSource() { - RelationshipMapping mapping = this.getRelationshipMapping(); - return this.targetForeignKey ? - mapping.getResolvedTargetEntity() : - mapping.getTypeMapping(); - } - - public TypeMapping getRelationshipTarget() { - RelationshipMapping mapping = this.getRelationshipMapping(); - return this.targetForeignKey ? - mapping.getTypeMapping() : - mapping.getResolvedTargetEntity(); - } - - protected Entity getRelationshipTargetEntity() { - TypeMapping target = this.getRelationshipTarget(); - return (target instanceof Entity) ? (Entity) target : null; - } - - public boolean isTargetForeignKey() { - return this.targetForeignKey; - } - - - // ********** validation ********** - - public String getColumnTableNotValidDescription() { - return JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY; - } - - public TextRange getValidationTextRange() { - return this.getRelationship().getValidationTextRange(); - } - - - // ********** join column owner ********** - - protected class JoinColumnOwner - implements OrmJoinColumn.Owner - { - protected JoinColumnOwner() { - super(); - } - - /** - * by default, the join column is in the type mapping's primary table - */ - public String getDefaultTableName() { - return GenericOrmMappingJoinColumnRelationshipStrategy.this.getTableName(); - } - - public String getDefaultColumnName() { - //built in MappingTools.buildJoinColumnDefaultName() - return null; - } - - public String getAttributeName() { - return GenericOrmMappingJoinColumnRelationshipStrategy.this.getRelationshipMapping().getName(); - } - - protected PersistentAttribute getPersistentAttribute() { - return GenericOrmMappingJoinColumnRelationshipStrategy.this.getRelationshipMapping().getPersistentAttribute(); - } - - public TypeMapping getTypeMapping() { - return GenericOrmMappingJoinColumnRelationshipStrategy.this.getRelationshipSource(); - } - - public Entity getRelationshipTarget() { - return GenericOrmMappingJoinColumnRelationshipStrategy.this.getRelationshipTargetEntity(); - } - - public boolean tableNameIsInvalid(String tableName) { - return GenericOrmMappingJoinColumnRelationshipStrategy.this.tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return GenericOrmMappingJoinColumnRelationshipStrategy.this.candidateTableNames(); - } - - public Table resolveDbTable(String tableName) { - return GenericOrmMappingJoinColumnRelationshipStrategy.this.resolveDbTable(tableName); - } - - public Table getReferencedColumnDbTable() { - return GenericOrmMappingJoinColumnRelationshipStrategy.this.getReferencedColumnDbTable(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return GenericOrmMappingJoinColumnRelationshipStrategy.this.defaultJoinColumn == joinColumn; - } - - public int joinColumnsSize() { - return GenericOrmMappingJoinColumnRelationshipStrategy.this.joinColumnsSize(); - } - - public TextRange getValidationTextRange() { - return GenericOrmMappingJoinColumnRelationshipStrategy.this.getValidationTextRange(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new JoinColumnValidator(getPersistentAttribute(), (JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java deleted file mode 100644 index fcaeb86560..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmMappingJoinTableRelationshipStrategy.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.orm.OrmMappingJoinTableRelationship; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.InverseJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableValidator; - -public class GenericOrmMappingJoinTableRelationshipStrategy - extends AbstractOrmJoinTableRelationshipStrategy -{ - public GenericOrmMappingJoinTableRelationshipStrategy(OrmMappingJoinTableRelationship parent) { - super(parent); - } - - - public boolean isOverridable() { - return this.getJpaPlatformVariation().isJoinTableOverridable(); - } - - - // ********** validation ********** - - public boolean validatesAgainstDatabase() { - return this.getRelationshipMapping().validatesAgainstDatabase(); - } - - public TextRange getValidationTextRange() { - return this.getRelationship().getValidationTextRange(); - } - - protected PersistentAttribute getPersistentAttribute() { - return getRelationshipMapping().getPersistentAttribute(); - } - - public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return new JoinColumnValidator(this.getPersistentAttribute(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); - } - - public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return new InverseJoinColumnValidator(this.getPersistentAttribute(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); - } - - public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) { - return new JoinTableValidator(getPersistentAttribute(), (JoinTable) table, textRangeResolver); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java deleted file mode 100644 index 674c6bb988..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToManyRelationship.java +++ /dev/null @@ -1,241 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.MappedByRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmMappedByRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmOneToManyMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToManyRelationship2_0; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericOrmOneToManyRelationship - extends AbstractOrmMappingRelationship - implements OrmOneToManyRelationship2_0 -{ - protected final OrmMappedByRelationshipStrategy mappedByStrategy; - - protected final OrmJoinTableRelationshipStrategy joinTableStrategy; - - // JPA 2.0 or EclipseLink - protected final boolean supportsJoinColumnStrategy; - protected final OrmJoinColumnRelationshipStrategy joinColumnStrategy; - - - public GenericOrmOneToManyRelationship(OrmOneToManyMapping parent, boolean supportsJoinColumnStrategy) { - super(parent); - this.mappedByStrategy = this.buildMappedByStrategy(); - this.supportsJoinColumnStrategy = supportsJoinColumnStrategy; - this.joinColumnStrategy = this.buildJoinColumnStrategy(); - - // build join table strategy last since it's dependent on the other strategies - this.joinTableStrategy = this.buildJoinTableStrategy(); - - this.strategy = this.buildStrategy(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mappedByStrategy.synchronizeWithResourceModel(); - this.joinColumnStrategy.synchronizeWithResourceModel(); - this.joinTableStrategy.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mappedByStrategy.update(); - this.joinColumnStrategy.update(); - this.joinTableStrategy.update(); - } - - - // ********** strategy ********** - - @Override - protected OrmRelationshipStrategy buildStrategy() { - if (this.mappedByStrategy.getMappedByAttribute() != null) { - return this.mappedByStrategy; - } - if (this.supportsJoinColumnStrategy) { - if (this.joinColumnStrategy.hasSpecifiedJoinColumns()) { - return this.joinColumnStrategy; - } - } - return this.joinTableStrategy; - } - - - // ********** mapped by strategy ********** - - public OrmMappedByRelationshipStrategy getMappedByStrategy() { - return this.mappedByStrategy; - } - - public boolean strategyIsMappedBy() { - return this.strategy == this.mappedByStrategy; - } - - public final void setStrategyToMappedBy() { - this.mappedByStrategy.addStrategy(); - this.joinTableStrategy.removeStrategy(); - this.joinColumnStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayBeMappedBy(AttributeMapping mapping) { - String key = mapping.getKey(); - if (key == MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) { - return true; - } - if (this.supportsJoinColumnStrategy) { - return key == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - return false; - } - - protected OrmMappedByRelationshipStrategy buildMappedByStrategy() { - return new GenericOrmMappedByRelationshipStrategy(this); - } - - - // ********** join table strategy ********** - - public OrmJoinTableRelationshipStrategy getJoinTableStrategy() { - return this.joinTableStrategy; - } - - public boolean strategyIsJoinTable() { - return this.strategy == this.joinTableStrategy; - } - - public final void setStrategyToJoinTable() { - // join table is default, so no need to add to resource - this.mappedByStrategy.removeStrategy(); - this.joinColumnStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayHaveDefaultJoinTable() { - return (this.mappedByStrategy.getMappedByAttribute() == null) && - ! this.joinColumnStrategy.hasSpecifiedJoinColumns(); - } - - protected OrmJoinTableRelationshipStrategy buildJoinTableStrategy() { - return new GenericOrmMappingJoinTableRelationshipStrategy(this); - } - - - // ********** join column strategy ********** - - public OrmJoinColumnRelationshipStrategy getJoinColumnStrategy() { - return this.joinColumnStrategy; - } - - public boolean strategyIsJoinColumn() { - return this.strategy == this.joinColumnStrategy; - } - - public void setStrategyToJoinColumn() { - this.joinColumnStrategy.addStrategy(); - this.mappedByStrategy.removeStrategy(); - this.joinTableStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayHaveDefaultJoinColumn() { - return false; - } - - protected OrmJoinColumnRelationshipStrategy buildJoinColumnStrategy() { - return this.supportsJoinColumnStrategy ? - new GenericOrmMappingJoinColumnRelationshipStrategy(this, true) : // true = target foreign key - new NullOrmJoinColumnRelationshipStrategy(this); - } - - - // ********** conversions ********** - - public void initializeOn(Relationship newRelationship) { - newRelationship.initializeFromMappedByRelationship(this); - newRelationship.initializeFromJoinTableRelationship(this); - newRelationship.initializeFromJoinColumnRelationship(this); - } - - @Override - public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) { - super.initializeFromMappedByRelationship(oldRelationship); - this.mappedByStrategy.initializeFrom(oldRelationship.getMappedByStrategy()); - } - - @Override - public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) { - super.initializeFromJoinTableRelationship(oldRelationship); - this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy()); - } - - @Override - public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) { - super.initializeFromJoinColumnRelationship(oldRelationship); - this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy()); - } - - - // ********** misc ********** - - @Override - protected XmlOneToMany getXmlMapping() { - return (XmlOneToMany) super.getXmlMapping(); - } - - public XmlOneToMany getXmlContainer() { - return this.getXmlMapping(); - } - - public boolean isOwner() { - return this.mappedByStrategy.getMappedByAttribute() == null; - } - - public boolean isOwnedBy(RelationshipMapping mapping) { - return this.mappedByStrategy.relationshipIsOwnedBy(mapping); - } - - @Override - public boolean isTargetForeignKey() { - return this.joinColumnStrategy.isTargetForeignKey(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.mappedByStrategy.validate(messages, reporter); - this.joinTableStrategy.validate(messages, reporter); - this.joinColumnStrategy.validate(messages, reporter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java deleted file mode 100644 index 1f7fbbd2cb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOneToOneRelationship.java +++ /dev/null @@ -1,263 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.MappedByRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmMappedByRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmOneToOneMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOneToOneRelationship2_0; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericOrmOneToOneRelationship - extends AbstractOrmMappingRelationship - implements OrmOneToOneRelationship2_0 -{ - protected final OrmMappedByRelationshipStrategy mappedByStrategy; - - protected final OrmPrimaryKeyJoinColumnRelationshipStrategy primaryKeyJoinColumnStrategy; - - // JPA 2.0 - protected final OrmJoinTableRelationshipStrategy joinTableStrategy; - - protected final OrmJoinColumnRelationshipStrategy joinColumnStrategy; - - - public GenericOrmOneToOneRelationship(OrmOneToOneMapping parent) { - super(parent); - this.mappedByStrategy = this.buildMappedByStrategy(); - this.primaryKeyJoinColumnStrategy = this.buildPrimaryKeyJoinColumnStrategy(); - this.joinTableStrategy = this.buildJoinTableStrategy(); - this.joinColumnStrategy = this.buildJoinColumnStrategy(); - - this.strategy = this.buildStrategy(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mappedByStrategy.synchronizeWithResourceModel(); - this.primaryKeyJoinColumnStrategy.synchronizeWithResourceModel(); - this.joinTableStrategy.synchronizeWithResourceModel(); - this.joinColumnStrategy.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.mappedByStrategy.update(); - this.primaryKeyJoinColumnStrategy.update(); - this.joinTableStrategy.update(); - this.joinColumnStrategy.update(); - } - - - // ********** strategy ********** - - @Override - protected OrmRelationshipStrategy buildStrategy() { - if (this.mappedByStrategy.getMappedByAttribute() != null) { - return this.mappedByStrategy; - } - if (this.primaryKeyJoinColumnStrategy.hasPrimaryKeyJoinColumns()) { - return this.primaryKeyJoinColumnStrategy; - } - if (this.isJpa2_0Compatible()) { - if (this.joinTableStrategy.getJoinTable() != null){ - return this.joinTableStrategy; - } - } - return this.joinColumnStrategy; - } - - - // ********** mapped by strategy ********** - - public OrmMappedByRelationshipStrategy getMappedByStrategy() { - return this.mappedByStrategy; - } - - public boolean strategyIsMappedBy() { - return this.strategy == this.mappedByStrategy; - } - - public void setStrategyToMappedBy() { - this.mappedByStrategy.addStrategy(); - this.joinColumnStrategy.removeStrategy(); - this.primaryKeyJoinColumnStrategy.removeStrategy(); - this.joinTableStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayBeMappedBy(AttributeMapping mapping) { - return mapping.getKey() == MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - protected OrmMappedByRelationshipStrategy buildMappedByStrategy() { - return new GenericOrmMappedByRelationshipStrategy(this); - } - - - // ********** primary key join column strategy ********** - - public OrmPrimaryKeyJoinColumnRelationshipStrategy getPrimaryKeyJoinColumnStrategy() { - return this.primaryKeyJoinColumnStrategy; - } - - public boolean strategyIsPrimaryKeyJoinColumn() { - return this.strategy == this.primaryKeyJoinColumnStrategy; - } - - public void setStrategyToPrimaryKeyJoinColumn() { - this.primaryKeyJoinColumnStrategy.addStrategy(); - this.mappedByStrategy.removeStrategy(); - this.joinColumnStrategy.removeStrategy(); - this.joinTableStrategy.removeStrategy(); - this.updateStrategy(); - } - - protected OrmPrimaryKeyJoinColumnRelationshipStrategy buildPrimaryKeyJoinColumnStrategy() { - return new GenericOrmPrimaryKeyJoinColumnRelationshipStrategy(this); - } - - - // ********** join table strategy ********** - - public OrmJoinTableRelationshipStrategy getJoinTableStrategy() { - return this.joinTableStrategy; - } - - public boolean strategyIsJoinTable() { - return this.strategy == this.joinTableStrategy; - } - - public void setStrategyToJoinTable() { - this.joinTableStrategy.addStrategy(); - this.mappedByStrategy.removeStrategy(); - this.joinColumnStrategy.removeStrategy(); - this.primaryKeyJoinColumnStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayHaveDefaultJoinTable() { - return false; - } - - protected OrmJoinTableRelationshipStrategy buildJoinTableStrategy() { - return this.isJpa2_0Compatible() ? - new GenericOrmMappingJoinTableRelationshipStrategy(this) : - new NullOrmJoinTableRelationshipStrategy(this); - } - - - // ********** join column strategy ********** - - public OrmJoinColumnRelationshipStrategy getJoinColumnStrategy() { - return this.joinColumnStrategy; - } - - public boolean strategyIsJoinColumn() { - return this.strategy == this.joinColumnStrategy; - } - - public void setStrategyToJoinColumn() { - // join column strategy is the default; so no need to add stuff, - // just remove all the others - this.mappedByStrategy.removeStrategy(); - this.primaryKeyJoinColumnStrategy.removeStrategy(); - this.joinTableStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean mayHaveDefaultJoinColumn() { - return (this.mappedByStrategy.getMappedByAttribute() == null) && - (this.primaryKeyJoinColumnStrategy.primaryKeyJoinColumnsSize() == 0) && - (this.joinTableStrategy.getJoinTable() == null); - } - - protected OrmJoinColumnRelationshipStrategy buildJoinColumnStrategy() { - return new GenericOrmMappingJoinColumnRelationshipStrategy(this); - } - - - // ********** conversions ********** - - public void initializeOn(Relationship newRelationship) { - newRelationship.initializeFromMappedByRelationship(this); - newRelationship.initializeFromJoinTableRelationship(this); - newRelationship.initializeFromJoinColumnRelationship(this); - // no other pk join column relationships yet - } - - @Override - public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) { - super.initializeFromMappedByRelationship(oldRelationship); - this.mappedByStrategy.initializeFrom(oldRelationship.getMappedByStrategy()); - } - - @Override - public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) { - super.initializeFromJoinTableRelationship(oldRelationship); - this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy()); - } - - @Override - public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) { - super.initializeFromJoinColumnRelationship(oldRelationship); - this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy()); - } - - - // ********** misc ********** - - @Override - protected XmlOneToOne getXmlMapping() { - return (XmlOneToOne) super.getXmlMapping(); - } - - public XmlOneToOne getXmlContainer() { - return this.getXmlMapping(); - } - - public boolean isOwner() { - return this.mappedByStrategy.getMappedByAttribute() == null; - } - - public boolean isOwnedBy(RelationshipMapping mapping) { - return this.mappedByStrategy.relationshipIsOwnedBy(mapping); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.mappedByStrategy.validate(messages, reporter); - this.primaryKeyJoinColumnStrategy.validate(messages, reporter); - this.joinTableStrategy.validate(messages, reporter); - this.joinColumnStrategy.validate(messages, reporter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java deleted file mode 100644 index f6f28b8520..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmOverrideJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,209 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Iterator; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn.Owner; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.db.Table; - -public class GenericOrmOverrideJoinColumnRelationshipStrategy - extends AbstractOrmJoinColumnRelationshipStrategy -{ - public GenericOrmOverrideJoinColumnRelationshipStrategy(OrmOverrideRelationship parent) { - super(parent); - } - - @Override - protected Owner buildJoinColumnOwner() { - return new JoinColumnOwner(); - } - - public boolean isTargetForeignKey() { - RelationshipMapping relationshipMapping = this.getRelationshipMapping(); - return (relationshipMapping != null) && - relationshipMapping.getRelationship().isTargetForeignKey(); - } - - public TypeMapping getRelationshipSource() { - return this.isTargetForeignKey() ? - this.getRelationshipMapping().getResolvedTargetEntity() : - this.getAssociationOverrideContainer().getTypeMapping(); - } - - public TypeMapping getRelationshipTarget() { - return this.isTargetForeignKey() ? - this.getAssociationOverrideContainer().getTypeMapping() : - this.getRelationshipMappingTargetEntity(); - } - - protected TypeMapping getRelationshipMappingTargetEntity() { - RelationshipMapping mapping = this.getRelationshipMapping(); - return (mapping == null) ? null : mapping.getResolvedTargetEntity(); - } - - protected Entity getRelationshipTargetEntity() { - TypeMapping target = this.getRelationshipTarget(); - return (target instanceof Entity) ? (Entity) target : null; - } - - @Override - public RelationshipMapping getRelationshipMapping() { - return this.getAssociationOverride().getMapping(); - } - - protected String getAttributeName() { - return this.getAssociationOverride().getName(); - } - - @Override - public String getTableName() { - return this.isTargetForeignKey() ? - super.getTableName() : - this.getAssociationOverrideContainer().getDefaultTableName(); - } - - @Override - public Table resolveDbTable(String tableName) { - return this.isTargetForeignKey() ? - super.resolveDbTable(tableName) : - this.getAssociationOverrideContainer().resolveDbTable(tableName); - } - - @Override - public boolean tableNameIsInvalid(String tableName) { - return this.isTargetForeignKey() ? - super.tableNameIsInvalid(tableName) : - this.getAssociationOverrideContainer().tableNameIsInvalid(tableName); - } - - @Override - public Iterator candidateTableNames() { - return this.isTargetForeignKey() ? - super.candidateTableNames() : - this.getAssociationOverrideContainer().candidateTableNames(); - } - - public String getColumnTableNotValidDescription() { - return null; - } - - public boolean isOverridable() { - return false; - } - - protected OrmAssociationOverride getAssociationOverride() { - return this.getRelationship().getAssociationOverride(); - } - - protected AssociationOverrideContainer getAssociationOverrideContainer() { - return this.getAssociationOverride().getContainer(); - } - - @Override - public OrmOverrideRelationship getRelationship() { - return (OrmOverrideRelationship) super.getRelationship(); - } - - public TextRange getValidationTextRange() { - return this.getRelationship().getValidationTextRange(); - } - - - // ********** join column owner ********** - - protected class JoinColumnOwner - implements OrmJoinColumn.Owner - { - protected JoinColumnOwner() { - super(); - } - - public String getDefaultTableName() { - return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getTableName(); - } - - public String getDefaultColumnName() { - //built in MappingTools.buildJoinColumnDefaultName() - return null; - } - - public String getAttributeName() { - return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getAttributeName(); - } - - public PersistentAttribute getPersistentAttribute() { - RelationshipMapping relationshipMapping = GenericOrmOverrideJoinColumnRelationshipStrategy.this.getRelationshipMapping(); - return relationshipMapping == null ? null : relationshipMapping.getPersistentAttribute(); - } - - public TypeMapping getTypeMapping() { - return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getRelationshipSource(); - } - - public Entity getRelationshipTarget() { - return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getRelationshipTargetEntity(); - } - - public boolean tableNameIsInvalid(String tableName) { - return GenericOrmOverrideJoinColumnRelationshipStrategy.this.tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return GenericOrmOverrideJoinColumnRelationshipStrategy.this.candidateTableNames(); - } - - public Table resolveDbTable(String tableName) { - return GenericOrmOverrideJoinColumnRelationshipStrategy.this.resolveDbTable(tableName); - } - - public Table getReferencedColumnDbTable() { - return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getReferencedColumnDbTable(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return false; - } - - public int joinColumnsSize() { - return GenericOrmOverrideJoinColumnRelationshipStrategy.this.joinColumnsSize(); - } - - public TextRange getValidationTextRange() { - return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getValidationTextRange(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return this.getAssociationOverrideContainer().buildColumnValidator(this.getAssociationOverride(), (BaseColumn) column, this, (BaseColumnTextRangeResolver) textRangeResolver); - } - - protected OrmAssociationOverride getAssociationOverride() { - return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getAssociationOverride(); - } - - protected AssociationOverrideContainer getAssociationOverrideContainer() { - return GenericOrmOverrideJoinColumnRelationshipStrategy.this.getAssociationOverrideContainer(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java deleted file mode 100644 index 8affd5d037..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,344 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jpa.core.context.BaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.OneToOnePrimaryKeyJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumnContainer; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericOrmPrimaryKeyJoinColumnRelationshipStrategy - extends AbstractOrmXmlContextNode - implements OrmPrimaryKeyJoinColumnRelationshipStrategy -{ - protected final Vector primaryKeyJoinColumns = new Vector(); - protected final PrimaryKeyJoinColumnContainerAdapter primaryKeyJoinColumnContainerAdapter; - protected final OrmJoinColumn.Owner primaryKeyJoinColumnOwner; - - - public GenericOrmPrimaryKeyJoinColumnRelationshipStrategy(OrmPrimaryKeyJoinColumnRelationship parent) { - super(parent); - this.primaryKeyJoinColumnContainerAdapter = this.buildPrimaryKeyJoinColumnContainerAdapter(); - this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner(); - this.initializePrimaryKeyJoinColumns(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncPrimaryKeyJoinColumns(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getPrimaryKeyJoinColumns()); - } - - - // ********** primary key join columns ********** - - public ListIterator primaryKeyJoinColumns() { - return this.getPrimaryKeyJoinColumns().iterator(); - } - - protected ListIterable getPrimaryKeyJoinColumns() { - return new LiveCloneListIterable(this.primaryKeyJoinColumns); - } - - public int primaryKeyJoinColumnsSize() { - return this.primaryKeyJoinColumns.size(); - } - - public boolean hasPrimaryKeyJoinColumns() { - return this.primaryKeyJoinColumns.size() != 0; - } - - public OrmPrimaryKeyJoinColumn getPrimaryKeyJoinColumn(int index) { - return this.primaryKeyJoinColumns.get(index); - } - - public OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn() { - return this.addPrimaryKeyJoinColumn(this.primaryKeyJoinColumns.size()); - } - - public OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn(int index) { - XmlPrimaryKeyJoinColumn xmlJoinColumn = this.buildXmlPrimaryKeyJoinColumn(); - OrmPrimaryKeyJoinColumn joinColumn = this.addPrimaryKeyJoinColumn_(index, xmlJoinColumn); - this.getXmlPrimaryKeyJoinColumnContainer().getPrimaryKeyJoinColumns().add(index, xmlJoinColumn); - return joinColumn; - } - - protected XmlPrimaryKeyJoinColumn buildXmlPrimaryKeyJoinColumn() { - return OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn(); - } - - public void removePrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) { - this.removePrimaryKeyJoinColumn(this.primaryKeyJoinColumns.indexOf(joinColumn)); - } - - public void removePrimaryKeyJoinColumn(int index) { - this.removePrimaryKeyJoinColumn_(index); - this.getXmlPrimaryKeyJoinColumnContainer().getPrimaryKeyJoinColumns().remove(index); - } - - protected void removePrimaryKeyJoinColumn_(int index) { - this.removeItemFromList(index, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - public void movePrimaryKeyJoinColumn(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST); - this.getXmlPrimaryKeyJoinColumnContainer().getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex); - } - - protected void initializePrimaryKeyJoinColumns() { - for (XmlPrimaryKeyJoinColumn xmlJoinColumn : this.getXmlPrimaryKeyJoinColumns()) { - this.primaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(xmlJoinColumn)); - } - } - - protected void syncPrimaryKeyJoinColumns() { - ContextContainerTools.synchronizeWithResourceModel(this.primaryKeyJoinColumnContainerAdapter); - } - - protected Iterable getXmlPrimaryKeyJoinColumns() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.getXmlPrimaryKeyJoinColumnContainer().getPrimaryKeyJoinColumns()); - } - - protected void movePrimaryKeyJoinColumn_(int index, OrmPrimaryKeyJoinColumn joinColumn) { - this.moveItemInList(index, joinColumn, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - protected OrmPrimaryKeyJoinColumn addPrimaryKeyJoinColumn_(int index, XmlPrimaryKeyJoinColumn xmlJoinColumn) { - OrmPrimaryKeyJoinColumn joinColumn = this.buildPrimaryKeyJoinColumn(xmlJoinColumn); - this.addItemToList(index, joinColumn, this.primaryKeyJoinColumns, PRIMARY_KEY_JOIN_COLUMNS_LIST); - return joinColumn; - } - - protected void removePrimaryKeyJoinColumn_(OrmPrimaryKeyJoinColumn joinColumn) { - this.removePrimaryKeyJoinColumn_(this.primaryKeyJoinColumns.indexOf(joinColumn)); - } - - protected PrimaryKeyJoinColumnContainerAdapter buildPrimaryKeyJoinColumnContainerAdapter() { - return new PrimaryKeyJoinColumnContainerAdapter(); - } - - /** - * primary key join column container adapter - */ - protected class PrimaryKeyJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getPrimaryKeyJoinColumns(); - } - public Iterable getResourceElements() { - return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getXmlPrimaryKeyJoinColumns(); - } - public XmlPrimaryKeyJoinColumn getResourceElement(OrmPrimaryKeyJoinColumn contextElement) { - return contextElement.getXmlColumn(); - } - public void moveContextElement(int index, OrmPrimaryKeyJoinColumn element) { - GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.movePrimaryKeyJoinColumn_(index, element); - } - public void addContextElement(int index, XmlPrimaryKeyJoinColumn resourceElement) { - GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.addPrimaryKeyJoinColumn_(index, resourceElement); - } - public void removeContextElement(OrmPrimaryKeyJoinColumn element) { - GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.removePrimaryKeyJoinColumn_(element); - } - } - - protected OrmJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() { - return new PrimaryKeyJoinColumnOwner(); - } - - protected OrmPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(XmlPrimaryKeyJoinColumn xmlJoinColumn) { - return this.getContextNodeFactory().buildOrmPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, xmlJoinColumn); - } - - - // ********** misc ********** - - @Override - public OrmPrimaryKeyJoinColumnRelationship getParent() { - return (OrmPrimaryKeyJoinColumnRelationship) super.getParent(); - } - - public OrmPrimaryKeyJoinColumnRelationship getRelationship() { - return this.getParent(); - } - - protected RelationshipMapping getRelationshipMapping() { - return this.getRelationship().getMapping(); - } - - protected XmlPrimaryKeyJoinColumnContainer getXmlPrimaryKeyJoinColumnContainer() { - return this.getRelationship().getXmlContainer(); - } - - public String getTableName() { - return this.getTypeMapping().getPrimaryTableName(); - } - - public Table resolveDbTable(String tableName) { - return this.getTypeMapping().resolveDbTable(tableName); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getTypeMapping().tableNameIsInvalid(tableName); - } - - public String getColumnTableNotValidDescription() { - return JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY; - } - - protected TypeMapping getTypeMapping() { - return this.getRelationshipMapping().getTypeMapping(); - } - - public void addStrategy() { - if (this.primaryKeyJoinColumns.size() == 0) { - this.addPrimaryKeyJoinColumn(); - } - } - - public void removeStrategy() { - for (int i = this.primaryKeyJoinColumns.size(); i-- > 0; ) { - this.removePrimaryKeyJoinColumn(i); - } - } - - public boolean isOverridable() { - return false; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return this.getRelationship().getValidationTextRange(); - } - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - for (OrmPrimaryKeyJoinColumn pkJoinColumn : this.getPrimaryKeyJoinColumns()) { - pkJoinColumn.validate(messages, reporter); - } - } - - - // ********** join column owner ********** - - protected class PrimaryKeyJoinColumnOwner - implements OrmJoinColumn.Owner - { - protected PrimaryKeyJoinColumnOwner() { - super(); - } - - /** - * by default, the join column is in the type mapping's primary table - */ - public String getDefaultTableName() { - return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getTableName(); - } - - public Entity getRelationshipTarget() { - return this.getRelationshipMapping().getResolvedTargetEntity(); - } - - public String getAttributeName() { - return this.getRelationshipMapping().getName(); - } - - public PersistentAttribute getPersistentAttribute() { - return this.getRelationshipMapping().getPersistentAttribute(); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getTypeMapping().tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return this.getTypeMapping().allAssociatedTableNames(); - } - - public TypeMapping getTypeMapping() { - return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getTypeMapping(); - } - - public Table resolveDbTable(String tableName) { - return this.getTypeMapping().resolveDbTable(tableName); - } - - public Table getReferencedColumnDbTable() { - Entity relationshipTarget = this.getRelationshipTarget(); - return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return false; - } - - public String getDefaultColumnName() { - return null; - } - - public int joinColumnsSize() { - return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.primaryKeyJoinColumnsSize(); - } - - public TextRange getValidationTextRange() { - return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getValidationTextRange(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new OneToOnePrimaryKeyJoinColumnValidator(this.getPersistentAttribute(), (BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver); - } - - protected RelationshipMapping getRelationshipMapping() { - return GenericOrmPrimaryKeyJoinColumnRelationshipStrategy.this.getRelationshipMapping(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java deleted file mode 100644 index c93dd749e9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualJoinTable.java +++ /dev/null @@ -1,333 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualRelationship; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; - -/** - * orm.xml virtual join table - */ -public class GenericOrmVirtualJoinTable - extends AbstractOrmVirtualReferenceTable - implements OrmVirtualJoinTable -{ - protected final JoinTable overriddenTable; - - protected final Vector specifiedInverseJoinColumns = new Vector(); - protected final SpecifiedInverseJoinColumnContainerAdapter specifiedInverseJoinColumnContainerAdapter = new SpecifiedInverseJoinColumnContainerAdapter(); - protected final ReadOnlyJoinColumn.Owner inverseJoinColumnOwner; - - protected OrmVirtualJoinColumn defaultInverseJoinColumn; - - - public GenericOrmVirtualJoinTable(OrmVirtualJoinTableRelationshipStrategy parent, JoinTable overriddenTable) { - super(parent); - this.overriddenTable = overriddenTable; - this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner(); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.updateSpecifiedInverseJoinColumns(); - this.updateDefaultInverseJoinColumn(); - } - - - // ********** table ********** - - @Override - public JoinTable getOverriddenTable() { - return this.overriddenTable; - } - - - // ********** inverse join columns ********** - - public ListIterator inverseJoinColumns() { - return this.getInverseJoinColumns().iterator(); - } - - protected ListIterable getInverseJoinColumns() { - return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns(); - } - - public int inverseJoinColumnsSize() { - return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumnsSize() : this.getDefaultInverseJoinColumnsSize(); - } - - - // ********** specified inverse join columns ********** - - public ListIterator specifiedInverseJoinColumns() { - return this.getSpecifiedInverseJoinColumns().iterator(); - } - - protected ListIterable getSpecifiedInverseJoinColumns() { - return new LiveCloneListIterable(this.specifiedInverseJoinColumns); - } - - public int specifiedInverseJoinColumnsSize() { - return this.specifiedInverseJoinColumns.size(); - } - - public boolean hasSpecifiedInverseJoinColumns() { - return this.specifiedInverseJoinColumns.size() != 0; - } - - public OrmVirtualJoinColumn getSpecifiedInverseJoinColumn(int index) { - return this.specifiedInverseJoinColumns.get(index); - } - - protected void updateSpecifiedInverseJoinColumns() { - ContextContainerTools.update(this.specifiedInverseJoinColumnContainerAdapter); - } - - protected Iterable getOverriddenInverseJoinColumns() { - return CollectionTools.iterable(this.getOverriddenTable().specifiedInverseJoinColumns()); - } - - protected void moveSpecifiedInverseJoinColumn(int index, OrmVirtualJoinColumn joinColumn) { - this.moveItemInList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST); - } - - protected OrmVirtualJoinColumn addSpecifiedInverseJoinColumn(int index, JoinColumn joinColumn) { - OrmVirtualJoinColumn virtualJoinColumn = this.buildInverseJoinColumn(joinColumn); - this.addItemToList(index, virtualJoinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST); - return virtualJoinColumn; - } - - protected void removeSpecifiedInverseJoinColumn(OrmVirtualJoinColumn joinColumn) { - this.removeItemFromList(joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST); - } - - /** - * specified inverse join column container adapter - */ - protected class SpecifiedInverseJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericOrmVirtualJoinTable.this.getSpecifiedInverseJoinColumns(); - } - public Iterable getResourceElements() { - return GenericOrmVirtualJoinTable.this.getOverriddenInverseJoinColumns(); - } - public JoinColumn getResourceElement(OrmVirtualJoinColumn contextElement) { - return contextElement.getOverriddenColumn(); - } - public void moveContextElement(int index, OrmVirtualJoinColumn element) { - GenericOrmVirtualJoinTable.this.moveSpecifiedInverseJoinColumn(index, element); - } - public void addContextElement(int index, JoinColumn element) { - GenericOrmVirtualJoinTable.this.addSpecifiedInverseJoinColumn(index, element); - } - public void removeContextElement(OrmVirtualJoinColumn element) { - GenericOrmVirtualJoinTable.this.removeSpecifiedInverseJoinColumn(element); - } - } - - - // ********** default inverse join column ********** - - public OrmVirtualJoinColumn getDefaultInverseJoinColumn() { - return this.defaultInverseJoinColumn; - } - - protected void setDefaultInverseJoinColumn(OrmVirtualJoinColumn joinColumn) { - OrmVirtualJoinColumn old = this.defaultInverseJoinColumn; - this.defaultInverseJoinColumn = joinColumn; - this.firePropertyChanged(DEFAULT_INVERSE_JOIN_COLUMN, old, joinColumn); - } - - protected ListIterable getDefaultInverseJoinColumns() { - return (this.defaultInverseJoinColumn != null) ? - new SingleElementListIterable(this.defaultInverseJoinColumn) : - EmptyListIterable.instance(); - } - - protected int getDefaultInverseJoinColumnsSize() { - return (this.defaultInverseJoinColumn == null) ? 0 : 1; - } - - protected void updateDefaultInverseJoinColumn() { - if (this.buildsDefaultInverseJoinColumn()) { - if (this.defaultInverseJoinColumn == null) { - this.setDefaultInverseJoinColumn(this.buildInverseJoinColumn(this.getOverriddenTable().getDefaultInverseJoinColumn())); - } else { - this.defaultInverseJoinColumn.update(); - } - } else { - this.setDefaultInverseJoinColumn(null); - } - } - - protected boolean buildsDefaultInverseJoinColumn() { - return ! this.hasSpecifiedInverseJoinColumns(); - } - - - // ********** misc ********** - - @Override - public OrmVirtualJoinTableRelationshipStrategy getParent() { - return (OrmVirtualJoinTableRelationshipStrategy) super.getParent(); - } - - protected OrmVirtualJoinTableRelationshipStrategy getJoinStrategy() { - return this.getParent(); - } - - @Override - protected ReadOnlyJoinColumn.Owner buildJoinColumnOwner() { - return new JoinColumnOwner(); - } - - protected ReadOnlyJoinColumn.Owner buildInverseJoinColumnOwner() { - return new InverseJoinColumnOwner(); - } - - protected OrmVirtualJoinColumn buildInverseJoinColumn(JoinColumn joinColumn) { - return this.buildJoinColumn(this.inverseJoinColumnOwner, joinColumn); - } - - @Override - protected String buildDefaultName() { - return this.getJoinStrategy().getJoinTableDefaultName(); - } - - public RelationshipMapping getRelationshipMapping() { - return this.getJoinStrategy().getRelationship().getMapping(); - } - - public PersistentAttribute getPersistentAttribute() { - return this.getRelationshipMapping().getPersistentAttribute(); - } - - - // ********** join column owners ********** - - /** - * just a little common behavior - */ - protected abstract class AbstractJoinColumnOwner - implements ReadOnlyJoinColumn.Owner - { - protected AbstractJoinColumnOwner() { - super(); - } - - public TypeMapping getTypeMapping() { - return this.getRelationship().getTypeMapping(); - } - - /** - * by default, the join column is, obviously, in the join table; - * not sure whether it can be anywhere else... - */ - public String getDefaultTableName() { - return GenericOrmVirtualJoinTable.this.getName(); - } - - /** - * @see MappingTools#buildJoinColumnDefaultName(org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn.Owner) - */ - public String getDefaultColumnName() { - throw new UnsupportedOperationException(); - } - - protected OrmVirtualRelationship getRelationship() { - return GenericOrmVirtualJoinTable.this.getJoinStrategy().getRelationship(); - } - } - - - /** - * owner for "back-pointer" join columns; - * these point at the source/owning entity - */ - protected class JoinColumnOwner - extends AbstractJoinColumnOwner - { - protected JoinColumnOwner() { - super(); - } - - public Entity getRelationshipTarget() { - return this.getRelationship().getEntity(); - } - - public String getAttributeName() { - return MappingTools.getTargetAttributeName(GenericOrmVirtualJoinTable.this.getRelationshipMapping()); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return GenericOrmVirtualJoinTable.this.defaultJoinColumn == joinColumn; - } - - public int joinColumnsSize() { - return GenericOrmVirtualJoinTable.this.joinColumnsSize(); - } - } - - - /** - * owner for "forward-pointer" join columns; - * these point at the target/inverse entity - */ - protected class InverseJoinColumnOwner - extends AbstractJoinColumnOwner - { - protected InverseJoinColumnOwner() { - super(); - } - - public Entity getRelationshipTarget() { - RelationshipMapping relationshipMapping = GenericOrmVirtualJoinTable.this.getRelationshipMapping(); - return (relationshipMapping == null) ? null : relationshipMapping.getResolvedTargetEntity(); - } - - public String getAttributeName() { - RelationshipMapping relationshipMapping = GenericOrmVirtualJoinTable.this.getRelationshipMapping(); - return (relationshipMapping == null) ? null : relationshipMapping.getName(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return GenericOrmVirtualJoinTable.this.defaultInverseJoinColumn == joinColumn; - } - - public int joinColumnsSize() { - return GenericOrmVirtualJoinTable.this.inverseJoinColumnsSize(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java deleted file mode 100644 index 6e10fe98a2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,333 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.JoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyAssociationOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverrideRelationship; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; - -public class GenericOrmVirtualOverrideJoinColumnRelationshipStrategy - extends AbstractOrmXmlContextNode - implements OrmVirtualJoinColumnRelationshipStrategy -{ - protected final Vector specifiedJoinColumns = new Vector(); - protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter; - protected final ReadOnlyJoinColumn.Owner joinColumnOwner; - - protected OrmVirtualJoinColumn defaultJoinColumn; - - - public GenericOrmVirtualOverrideJoinColumnRelationshipStrategy(OrmVirtualJoinColumnRelationship parent) { - super(parent); - this.specifiedJoinColumnContainerAdapter = this.buildSpecifiedJoinColumnContainerAdapter(); - this.joinColumnOwner = this.buildJoinColumnOwner(); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.updateSpecifiedJoinColumns(); - this.updateDefaultJoinColumn(); - } - - - // ********** join columns ********** - - public ListIterator joinColumns() { - return this.getJoinColumns().iterator(); - } - - protected ListIterable getJoinColumns() { - return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns(); - } - - public int joinColumnsSize() { - return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize(); - } - - - // ********** specified join columns ********** - - public ListIterator specifiedJoinColumns() { - return this.getSpecifiedJoinColumns().iterator(); - } - - protected ListIterable getSpecifiedJoinColumns() { - return new LiveCloneListIterable(this.specifiedJoinColumns); - } - - public int specifiedJoinColumnsSize() { - return this.specifiedJoinColumns.size(); - } - - public boolean hasSpecifiedJoinColumns() { - return this.specifiedJoinColumns.size() != 0; - } - - public OrmVirtualJoinColumn getSpecifiedJoinColumn(int index) { - return this.specifiedJoinColumns.get(index); - } - - protected void updateSpecifiedJoinColumns() { - ContextContainerTools.update(this.specifiedJoinColumnContainerAdapter); - } - - protected Iterable getOverriddenSpecifiedJoinColumns() { - JoinColumnRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy(); - return (overriddenStrategy == null) ? - EmptyIterable.instance() : - CollectionTools.iterable(overriddenStrategy.specifiedJoinColumns()); - } - - protected void moveSpecifiedJoinColumn(int index, OrmVirtualJoinColumn joinColumn) { - this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - protected OrmVirtualJoinColumn addSpecifiedJoinColumn(int index, JoinColumn joinColumn) { - OrmVirtualJoinColumn virtualJoinColumn = this.buildJoinColumn(joinColumn); - this.addItemToList(index, virtualJoinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - return virtualJoinColumn; - } - - protected void removeSpecifiedJoinColumn(OrmVirtualJoinColumn joinColumn) { - this.removeItemFromList(joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - protected SpecifiedJoinColumnContainerAdapter buildSpecifiedJoinColumnContainerAdapter() { - return new SpecifiedJoinColumnContainerAdapter(); - } - - /** - * specified join column container adapter - */ - protected class SpecifiedJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getSpecifiedJoinColumns(); - } - public Iterable getResourceElements() { - return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getOverriddenSpecifiedJoinColumns(); - } - public JoinColumn getResourceElement(OrmVirtualJoinColumn contextElement) { - return contextElement.getOverriddenColumn(); - } - public void moveContextElement(int index, OrmVirtualJoinColumn element) { - GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.moveSpecifiedJoinColumn(index, element); - } - public void addContextElement(int index, JoinColumn resourceElement) { - GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.addSpecifiedJoinColumn(index, resourceElement); - } - public void removeContextElement(OrmVirtualJoinColumn element) { - GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.removeSpecifiedJoinColumn(element); - } - } - - protected ReadOnlyJoinColumn.Owner buildJoinColumnOwner() { - return new JoinColumnOwner(); - } - - - // ********** default join column ********** - - public OrmVirtualJoinColumn getDefaultJoinColumn() { - return this.defaultJoinColumn; - } - - protected void setDefaultJoinColumn(OrmVirtualJoinColumn joinColumn) { - OrmVirtualJoinColumn old = this.defaultJoinColumn; - this.defaultJoinColumn = joinColumn; - this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn); - } - - protected ListIterable getDefaultJoinColumns() { - return (this.defaultJoinColumn != null) ? - new SingleElementListIterable(this.defaultJoinColumn) : - EmptyListIterable.instance(); - } - - protected int getDefaultJoinColumnsSize() { - return (this.defaultJoinColumn == null) ? 0 : 1; - } - - protected void updateDefaultJoinColumn() { - JoinColumn overriddenDefaultJoinColumn = this.getOverriddenDefaultJoinColumn(); - if (overriddenDefaultJoinColumn == null) { - if (this.defaultJoinColumn != null) { - this.setDefaultJoinColumn(null); - } - } else { - if ((this.defaultJoinColumn != null) && (this.defaultJoinColumn.getOverriddenColumn() == overriddenDefaultJoinColumn)) { - this.defaultJoinColumn.update(); - } else { - this.setDefaultJoinColumn(this.buildJoinColumn(overriddenDefaultJoinColumn)); - } - } - } - - protected JoinColumn getOverriddenDefaultJoinColumn() { - JoinColumnRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy(); - return (overriddenStrategy == null) ? null : overriddenStrategy.getDefaultJoinColumn(); - } - - - // ********** misc ********** - - @Override - public OrmVirtualJoinColumnRelationship getParent() { - return (OrmVirtualJoinColumnRelationship) super.getParent(); - } - - public OrmVirtualJoinColumnRelationship getRelationship() { - return this.getParent(); - } - - protected JoinColumnRelationshipStrategy getOverriddenStrategy() { - JoinColumnRelationship relationship = this.getOverriddenJoinColumnRelationship(); - return (relationship == null) ? null : relationship.getJoinColumnStrategy(); - } - - protected JoinColumnRelationship getOverriddenJoinColumnRelationship() { - Relationship relationship = this.resolveOverriddenRelationship(); - return (relationship instanceof JoinColumnRelationship) ? (JoinColumnRelationship) relationship : null; - } - - protected Relationship resolveOverriddenRelationship() { - return this.getRelationship().resolveOverriddenRelationship(); - } - - public boolean isTargetForeignKey() { - RelationshipMapping relationshipMapping = this.getRelationshipMapping(); - return (relationshipMapping != null) && - relationshipMapping.getRelationship().isTargetForeignKey(); - } - - public TypeMapping getRelationshipSource() { - return this.isTargetForeignKey() ? - this.getRelationshipMapping().getResolvedTargetEntity() : - this.getAssociationOverrideContainer().getTypeMapping(); - } - - public TypeMapping getRelationshipTarget() { - return this.isTargetForeignKey() ? - this.getAssociationOverrideContainer().getTypeMapping() : - this.getRelationshipMappingTargetEntity(); - } - - protected TypeMapping getRelationshipMappingTargetEntity() { - RelationshipMapping mapping = this.getRelationshipMapping(); - return (mapping == null) ? null : mapping.getResolvedTargetEntity(); - } - - protected Entity getRelationshipTargetEntity() { - TypeMapping target = this.getRelationshipTarget(); - return (target instanceof Entity) ? (Entity) target : null; - } - - protected RelationshipMapping getRelationshipMapping() { - return this.getAssociationOverride().getMapping(); - } - - protected OrmReadOnlyAssociationOverride getAssociationOverride() { - return ((OrmVirtualOverrideRelationship) this.getRelationship()).getAssociationOverride(); - } - - protected OrmAssociationOverrideContainer getAssociationOverrideContainer() { - return this.getAssociationOverride().getContainer(); - } - - public String getTableName() { - return this.isTargetForeignKey() ? - this.getSourceTableName() : - this.getAssociationOverrideContainer().getDefaultTableName(); - } - - protected String getSourceTableName() { - TypeMapping typeMapping = this.getRelationshipSource(); - return (typeMapping == null) ? null : typeMapping.getPrimaryTableName(); - } - - public TextRange getValidationTextRange() { - return null; - } - - protected String getAttributeName() { - return this.getAssociationOverride().getName(); - } - - protected OrmVirtualJoinColumn buildJoinColumn(JoinColumn overriddenJoinColumn) { - return this.getContextNodeFactory().buildOrmVirtualJoinColumn(this, this.joinColumnOwner, overriddenJoinColumn); - } - - - // ********** join column owner ********** - - protected class JoinColumnOwner - implements ReadOnlyJoinColumn.Owner - { - protected JoinColumnOwner() { - super(); - } - - public String getDefaultTableName() { - return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getTableName(); - } - - public String getDefaultColumnName() { - //built in MappingTools.buildJoinColumnDefaultName() - return null; - } - - public String getAttributeName() { - return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getAttributeName(); - } - - public TypeMapping getTypeMapping() { - return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getRelationshipSource(); - } - - public Entity getRelationshipTarget() { - return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.getRelationshipTargetEntity(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return false; - } - - public int joinColumnsSize() { - return GenericOrmVirtualOverrideJoinColumnRelationshipStrategy.this.joinColumnsSize(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java deleted file mode 100644 index 8cb015eeb6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmVirtualSecondaryTable.java +++ /dev/null @@ -1,272 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmEntity; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualSecondaryTable; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; - -/** - * orm.xml virtual secondary table - */ -public class GenericOrmVirtualSecondaryTable - extends AbstractOrmVirtualTable - implements OrmVirtualSecondaryTable -{ - protected final JavaSecondaryTable overriddenTable; - - protected final Vector specifiedPrimaryKeyJoinColumns = new Vector(); - protected final SpecifiedPrimaryKeyJoinColumnContainerAdapter specifiedPrimaryKeyJoinColumnContainerAdapter = new SpecifiedPrimaryKeyJoinColumnContainerAdapter(); - protected final ReadOnlyBaseJoinColumn.Owner primaryKeyJoinColumnOwner; - - protected OrmVirtualPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn; - - - public GenericOrmVirtualSecondaryTable(OrmEntity parent, JavaSecondaryTable overriddenTable) { - super(parent); - this.overriddenTable = overriddenTable; - this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner(); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.updateSpecifiedPrimaryKeyJoinColumns(); - this.updateDefaultPrimaryKeyJoinColumn(); - } - - - // ********** table ********** - - @Override - public JavaSecondaryTable getOverriddenTable() { - return this.overriddenTable; - } - - - // ********** primary key join columns ********** - - public ListIterator primaryKeyJoinColumns() { - return this.getPrimaryKeyJoinColumns().iterator(); - } - - protected ListIterable getPrimaryKeyJoinColumns() { - return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns(); - } - - public int primaryKeyJoinColumnsSize() { - return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize(); - } - - - // ********** specified primary key join columns ********** - - public ListIterator specifiedPrimaryKeyJoinColumns() { - return this.getSpecifiedPrimaryKeyJoinColumns().iterator(); - } - - protected ListIterable getSpecifiedPrimaryKeyJoinColumns() { - return new LiveCloneListIterable(this.specifiedPrimaryKeyJoinColumns); - } - - public int specifiedPrimaryKeyJoinColumnsSize() { - return this.specifiedPrimaryKeyJoinColumns.size(); - } - - public boolean hasSpecifiedPrimaryKeyJoinColumns() { - return this.specifiedPrimaryKeyJoinColumns.size() != 0; - } - - public OrmVirtualPrimaryKeyJoinColumn getSpecifiedPrimaryKeyJoinColumn(int index) { - return this.specifiedPrimaryKeyJoinColumns.get(index); - } - - protected void updateSpecifiedPrimaryKeyJoinColumns() { - ContextContainerTools.update(this.specifiedPrimaryKeyJoinColumnContainerAdapter); - } - - protected Iterable getOverriddenPrimaryKeyJoinColumns() { - return CollectionTools.iterable(this.getOverriddenTable().specifiedPrimaryKeyJoinColumns()); - } - - protected void moveSpecifiedPrimaryKeyJoinColumn(int index, OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) { - this.moveItemInList(index, pkJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - protected OrmVirtualPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index, JavaPrimaryKeyJoinColumn javaColumn) { - OrmVirtualPrimaryKeyJoinColumn virtualColumn = this.buildPrimaryKeyJoinColumn(javaColumn); - this.addItemToList(index, virtualColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - return virtualColumn; - } - - protected void removeSpecifiedPrimaryKeyJoinColumn(OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) { - this.removeItemFromList(pkJoinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - /** - * specified primary key join column container adapter - */ - protected class SpecifiedPrimaryKeyJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericOrmVirtualSecondaryTable.this.getSpecifiedPrimaryKeyJoinColumns(); - } - public Iterable getResourceElements() { - return GenericOrmVirtualSecondaryTable.this.getOverriddenPrimaryKeyJoinColumns(); - } - public JavaPrimaryKeyJoinColumn getResourceElement(OrmVirtualPrimaryKeyJoinColumn contextElement) { - return contextElement.getOverriddenColumn(); - } - public void moveContextElement(int index, OrmVirtualPrimaryKeyJoinColumn element) { - GenericOrmVirtualSecondaryTable.this.moveSpecifiedPrimaryKeyJoinColumn(index, element); - } - public void addContextElement(int index, JavaPrimaryKeyJoinColumn element) { - GenericOrmVirtualSecondaryTable.this.addSpecifiedPrimaryKeyJoinColumn(index, element); - } - public void removeContextElement(OrmVirtualPrimaryKeyJoinColumn element) { - GenericOrmVirtualSecondaryTable.this.removeSpecifiedPrimaryKeyJoinColumn(element); - } - } - - - // ********** default primary key join column ********** - - public OrmVirtualPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn() { - return this.defaultPrimaryKeyJoinColumn; - } - - protected void setDefaultPrimaryKeyJoinColumn(OrmVirtualPrimaryKeyJoinColumn pkJoinColumn) { - OrmVirtualPrimaryKeyJoinColumn old = this.defaultPrimaryKeyJoinColumn; - this.defaultPrimaryKeyJoinColumn = pkJoinColumn; - this.firePropertyChanged(DEFAULT_PRIMARY_KEY_JOIN_COLUMN, old, pkJoinColumn); - } - - protected ListIterable getDefaultPrimaryKeyJoinColumns() { - return (this.defaultPrimaryKeyJoinColumn != null) ? - new SingleElementListIterable(this.defaultPrimaryKeyJoinColumn) : - EmptyListIterable.instance(); - } - - protected int getDefaultPrimaryKeyJoinColumnsSize() { - return (this.defaultPrimaryKeyJoinColumn == null) ? 0 : 1; - } - - protected void updateDefaultPrimaryKeyJoinColumn() { - JavaPrimaryKeyJoinColumn overriddenColumn = this.getOverriddenTable().getDefaultPrimaryKeyJoinColumn(); - if (overriddenColumn == null) { - this.setDefaultPrimaryKeyJoinColumn(null); - } else { - if ((this.defaultPrimaryKeyJoinColumn != null) && (this.defaultPrimaryKeyJoinColumn.getOverriddenColumn() == overriddenColumn)) { - this.defaultPrimaryKeyJoinColumn.update(); - } else { - this.setDefaultPrimaryKeyJoinColumn(this.buildPrimaryKeyJoinColumn(overriddenColumn)); - } - } - } - - - // ********** misc ********** - - @Override - public OrmEntity getParent() { - return (OrmEntity) super.getParent(); - } - - protected OrmEntity getEntity() { - return this.getParent(); - } - - public boolean isVirtual() { - return true; - } - - protected ReadOnlyBaseJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() { - return new PrimaryKeyJoinColumnOwner(); - } - - protected OrmVirtualPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn javaColumn) { - return this.getContextNodeFactory().buildOrmVirtualPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, javaColumn); - } - - - // ********** defaults ********** - - /** - * a secondary table doesn't have a default name - */ - @Override - protected String buildDefaultName() { - return null; - } - - @Override - protected String buildDefaultSchema() { - return this.getContextDefaultSchema(); - } - - @Override - protected String buildDefaultCatalog() { - return this.getContextDefaultCatalog(); - } - - - // ********** primary key join column owner ********** - - protected class PrimaryKeyJoinColumnOwner - implements ReadOnlyBaseJoinColumn.Owner - { - protected OrmEntity getEntity() { - return GenericOrmVirtualSecondaryTable.this.getEntity(); - } - - public TypeMapping getTypeMapping() { - return this.getEntity(); - } - - public String getDefaultTableName() { - return GenericOrmVirtualSecondaryTable.this.getName(); - } - - public String getDefaultColumnName() { - if (this.joinColumnsSize() != 1) { - return null; - } - Entity parentEntity = this.getEntity().getParentEntity(); - return (parentEntity != null) ? - parentEntity.getPrimaryKeyColumnName() : - this.getEntity().getPrimaryKeyColumnName(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return GenericOrmVirtualSecondaryTable.this.defaultPrimaryKeyJoinColumn == joinColumn; - } - - public int joinColumnsSize() { - return GenericOrmVirtualSecondaryTable.this.primaryKeyJoinColumnsSize(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java deleted file mode 100644 index 4711bbc93a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/GenericOrmXmlContextNodeFactory.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - - -public class GenericOrmXmlContextNodeFactory - extends AbstractOrmXmlContextNodeFactory -{ - // nothing -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/NullOrmJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/NullOrmJoinTableRelationshipStrategy.java deleted file mode 100644 index abee8a9261..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/NullOrmJoinTableRelationshipStrategy.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable; -import org.eclipse.jpt.jpa.db.Table; - -public class NullOrmJoinTableRelationshipStrategy - extends AbstractOrmXmlContextNode - implements OrmJoinTableRelationshipStrategy -{ - public NullOrmJoinTableRelationshipStrategy(OrmJoinTableRelationship parent) { - super(parent); - } - - - // ********** join table ********** - - public OrmJoinTable getJoinTable() { - return null; - } - - - // ********** XML join table ********** - - public XmlJoinTable getXmlJoinTable() { - return null; - } - - public XmlJoinTable buildXmlJoinTable() { - throw new UnsupportedOperationException(); - } - - public void removeXmlJoinTable() { - throw new UnsupportedOperationException(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return null; - } - - public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - throw new UnsupportedOperationException(); - } - - public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - throw new UnsupportedOperationException(); - } - - public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) { - throw new UnsupportedOperationException(); - } - - - // ********** misc ********** - - @Override - public OrmJoinTableRelationship getParent() { - return (OrmJoinTableRelationship) super.getParent(); - } - - public OrmJoinTableRelationship getRelationship() { - return this.getParent(); - } - - public void initializeFrom(ReadOnlyJoinTableRelationshipStrategy oldStrategy) { - // NOP - } - - public void initializeFromVirtual(ReadOnlyJoinTableRelationshipStrategy virtualStrategy) { - // NOP - } - - public String getTableName() { - return null; - } - - public Table resolveDbTable(String tableName) { - return null; - } - - public boolean tableNameIsInvalid(String tableName) { - return true; - } - - public String getColumnTableNotValidDescription() { - return null; - } - - public String getJoinTableDefaultName() { - return null; - } - - public void addStrategy() { - // NOP - } - - public void removeStrategy() { - // NOP - } - - public boolean isOverridable() { - return false; - } - - public boolean validatesAgainstDatabase() { - return false; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java deleted file mode 100644 index a26ed24f13..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBaseColumnTextRangeResolver.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.OrmBaseColumn; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; - -public class OrmBaseColumnTextRangeResolver - extends OrmNamedColumnTextRangeResolver - implements BaseColumnTextRangeResolver -{ - - public OrmBaseColumnTextRangeResolver(OrmBaseColumn column) { - super(column); - } - - @Override - protected OrmBaseColumn getColumn() { - return (OrmBaseColumn) super.getColumn(); - } - - public TextRange getTableTextRange() { - return this.getColumn().getTableTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBasicMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBasicMappingDefinition.java deleted file mode 100644 index 503127b997..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmBasicMappingDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmBasicMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; - -public class OrmBasicMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmAttributeMappingDefinition INSTANCE = - new OrmBasicMappingDefinition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmBasicMappingDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - OrmPackage.eINSTANCE.getXmlBasic(), - XmlBasic.class); - } - - public OrmBasicMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return factory.buildOrmBasicMapping(parent, (XmlBasic) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddableDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddableDefinition.java deleted file mode 100644 index 44b9ef4904..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddableDefinition.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddable; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; - -/** - * default ORM Embeddable provider - */ -public class OrmEmbeddableDefinition - implements OrmTypeMappingDefinition -{ - // singleton - private static final OrmEmbeddableDefinition INSTANCE = - new OrmEmbeddableDefinition(); - - - /** - * Return the singleton - */ - public static OrmTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmEmbeddableDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.EMBEDDABLE_TYPE_MAPPING_KEY; - } - - public XmlTypeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - OrmPackage.eINSTANCE.getXmlEmbeddable(), - XmlEmbeddable.class); - } - - public OrmEmbeddable buildContextMapping( - OrmPersistentType parent, - XmlTypeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return factory.buildOrmEmbeddable(parent, (XmlEmbeddable) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java deleted file mode 100644 index 5f73e84734..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedIdMappingDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; - -public class OrmEmbeddedIdMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmAttributeMappingDefinition INSTANCE = - new OrmEmbeddedIdMappingDefinition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmEmbeddedIdMappingDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - OrmPackage.eINSTANCE.getXmlEmbeddedId(), - XmlEmbeddedId.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return factory.buildOrmEmbeddedIdMapping(parent, (XmlEmbeddedId) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedMappingDefinition.java deleted file mode 100644 index 1f05a77656..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEmbeddedMappingDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; - -public class OrmEmbeddedMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmAttributeMappingDefinition INSTANCE = - new OrmEmbeddedMappingDefinition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmEmbeddedMappingDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - OrmPackage.eINSTANCE.getXmlEmbedded(), - XmlEmbedded.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return factory.buildOrmEmbeddedMapping(parent, (XmlEmbedded) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityDefinition.java deleted file mode 100644 index ef4931f35b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityDefinition.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmEntity; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; - -/** - * default ORM Entity provider - */ -public class OrmEntityDefinition - implements OrmTypeMappingDefinition -{ - // singleton - private static final OrmEntityDefinition INSTANCE = - new OrmEntityDefinition(); - - - /** - * Return the singleton - */ - public static OrmTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmEntityDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.ENTITY_TYPE_MAPPING_KEY; - } - - public XmlTypeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - OrmPackage.eINSTANCE.getXmlEntity(), - XmlEntity.class); - } - - public OrmEntity buildContextMapping( - OrmPersistentType parent, - XmlTypeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return factory.buildOrmEntity(parent, (XmlEntity) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityTextRangeResolver.java deleted file mode 100644 index af7d7c03c4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmEntityTextRangeResolver.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.OrmEntity; -import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.EntityTextRangeResolver; - -public class OrmEntityTextRangeResolver - implements EntityTextRangeResolver -{ - private OrmEntity entity; - - - public OrmEntityTextRangeResolver(OrmEntity entity) { - this.entity = entity; - } - - - public TextRange getTypeMappingTextRange() { - return this.entity.getValidationTextRange(); - } - - public TextRange getIdClassTextRange() { - return this.entity.getIdClassReference().getValidationTextRange(); - } - - public TextRange getAttributeMappingTextRange(String attributeName) { - return this.getAttributeNamed(attributeName).getValidationTextRange(); - } - - protected OrmReadOnlyPersistentAttribute getAttributeNamed(String attributeName) { - return this.entity.getPersistentType().getAttributeNamed(attributeName); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmIdMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmIdMappingDefinition.java deleted file mode 100644 index e20a2a6f45..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmIdMappingDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlId; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; - -public class OrmIdMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmAttributeMappingDefinition INSTANCE = - new OrmIdMappingDefinition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmIdMappingDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.ID_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - OrmPackage.eINSTANCE.getXmlId(), - XmlId.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return factory.buildOrmIdMapping(parent, (XmlId) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java deleted file mode 100644 index 94c60a0300..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmJoinColumnTextRangeResolver.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; - -public class OrmJoinColumnTextRangeResolver - extends OrmNamedColumnTextRangeResolver - implements JoinColumnTextRangeResolver -{ - - public OrmJoinColumnTextRangeResolver(OrmJoinColumn column) { - super(column); - } - - @Override - protected OrmJoinColumn getColumn() { - return (OrmJoinColumn) super.getColumn(); - } - - public TextRange getTableTextRange() { - return this.getColumn().getTableTextRange(); - } - - public TextRange getReferencedColumnNameTextRange() { - return this.getColumn().getReferencedColumnNameTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToManyMappingDefinition.java deleted file mode 100644 index f3eac3d4cb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToManyMappingDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; - -public class OrmManyToManyMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmAttributeMappingDefinition INSTANCE = - new OrmManyToManyMappingDefinition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmManyToManyMappingDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - OrmPackage.eINSTANCE.getXmlManyToMany(), - XmlManyToMany.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return factory.buildOrmManyToManyMapping(parent, (XmlManyToMany) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToOneMappingDefinition.java deleted file mode 100644 index a8a8a41efc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmManyToOneMappingDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; - -public class OrmManyToOneMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmAttributeMappingDefinition INSTANCE = - new OrmManyToOneMappingDefinition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmManyToOneMappingDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - OrmPackage.eINSTANCE.getXmlManyToOne(), - XmlManyToOne.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return factory.buildOrmManyToOneMapping(parent, (XmlManyToOne) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassDefinition.java deleted file mode 100644 index e0328eb994..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassDefinition.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmMappedSuperclass; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage; -import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; - -/** - * default ORM MappedSuperclass definition - */ -public class OrmMappedSuperclassDefinition - implements OrmTypeMappingDefinition -{ - // singleton - private static final OrmMappedSuperclassDefinition INSTANCE = - new OrmMappedSuperclassDefinition(); - - - /** - * Return the singleton - */ - public static OrmTypeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmMappedSuperclassDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.MAPPED_SUPERCLASS_TYPE_MAPPING_KEY; - } - - public XmlTypeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - OrmPackage.eINSTANCE.getXmlMappedSuperclass(), - XmlMappedSuperclass.class); - } - - public OrmMappedSuperclass buildContextMapping( - OrmPersistentType parent, - XmlTypeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return factory.buildOrmMappedSuperclass(parent, (XmlMappedSuperclass) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassTextRangeResolver.java deleted file mode 100644 index 03c139a93e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmMappedSuperclassTextRangeResolver.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.OrmMappedSuperclass; -import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver; - -public class OrmMappedSuperclassTextRangeResolver - implements PrimaryKeyTextRangeResolver -{ - private OrmMappedSuperclass mappedSuperclass; - - - public OrmMappedSuperclassTextRangeResolver(OrmMappedSuperclass mappedSuperclass) { - this.mappedSuperclass = mappedSuperclass; - } - - - public TextRange getTypeMappingTextRange() { - return this.mappedSuperclass.getValidationTextRange(); - } - - public TextRange getIdClassTextRange() { - return this.mappedSuperclass.getIdClassReference().getValidationTextRange(); - } - - public TextRange getAttributeMappingTextRange(String attributeName) { - return this.getAttributeNamed(attributeName).getValidationTextRange(); - } - - protected OrmReadOnlyPersistentAttribute getAttributeNamed(String attributeName) { - return this.mappedSuperclass.getPersistentType().getAttributeNamed(attributeName); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java deleted file mode 100644 index 37a19aec80..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmNamedColumnTextRangeResolver.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.OrmNamedColumn; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; - -public class OrmNamedColumnTextRangeResolver - implements NamedColumnTextRangeResolver -{ - protected final OrmNamedColumn ormNamedColumn; - - public OrmNamedColumnTextRangeResolver(OrmNamedColumn javaNamedColumn) { - this.ormNamedColumn = javaNamedColumn; - } - - protected OrmNamedColumn getColumn() { - return this.ormNamedColumn; - } - - public TextRange getNameTextRange() { - return this.ormNamedColumn.getNameTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToManyMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToManyMappingDefinition.java deleted file mode 100644 index ce0214dcd2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToManyMappingDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; - -public class OrmOneToManyMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmAttributeMappingDefinition INSTANCE = - new OrmOneToManyMappingDefinition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmOneToManyMappingDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - OrmPackage.eINSTANCE.getXmlOneToMany(), - XmlOneToMany.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return factory.buildOrmOneToManyMapping(parent, (XmlOneToMany) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToOneMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToOneMappingDefinition.java deleted file mode 100644 index 722738c39c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOneToOneMappingDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; - -public class OrmOneToOneMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmAttributeMappingDefinition INSTANCE = - new OrmOneToOneMappingDefinition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmOneToOneMappingDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - OrmPackage.eINSTANCE.getXmlOneToOne(), - XmlOneToOne.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return factory.buildOrmOneToOneMapping(parent, (XmlOneToOne) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOverrideTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOverrideTextRangeResolver.java deleted file mode 100644 index 0c1d8ee5b5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmOverrideTextRangeResolver.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.OrmOverride; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; - -public class OrmOverrideTextRangeResolver - implements OverrideTextRangeResolver -{ - protected final OrmOverride ormOverride; - - public OrmOverrideTextRangeResolver(OrmOverride ormOverride) { - this.ormOverride = ormOverride; - } - - protected OrmOverride getOverride() { - return this.ormOverride; - } - - public TextRange getNameTextRange() { - return this.ormOverride.getNameTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPersistentAttributeTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPersistentAttributeTextRangeResolver.java deleted file mode 100644 index fe9b812e24..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPersistentAttributeTextRangeResolver.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver; - -public class OrmPersistentAttributeTextRangeResolver - implements PersistentAttributeTextRangeResolver -{ - private OrmPersistentAttribute persistentAttribute; - - public OrmPersistentAttributeTextRangeResolver(OrmPersistentAttribute persistentAttribute) { - this.persistentAttribute = persistentAttribute; - } - - public TextRange getAttributeTextRange() { - return this.persistentAttribute.getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java deleted file mode 100644 index 6fdeb4b124..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmPrimaryKeyJoinColumnTextRangeResolver.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver; - -public class OrmPrimaryKeyJoinColumnTextRangeResolver - extends OrmNamedColumnTextRangeResolver - implements - BaseJoinColumnTextRangeResolver -{ - - public OrmPrimaryKeyJoinColumnTextRangeResolver(OrmPrimaryKeyJoinColumn column) { - super(column); - } - - @Override - protected OrmPrimaryKeyJoinColumn getColumn() { - return (OrmPrimaryKeyJoinColumn) super.getColumn(); - } - - public TextRange getReferencedColumnNameTextRange() { - return this.getColumn().getReferencedColumnNameTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTableTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTableTextRangeResolver.java deleted file mode 100644 index 3a86a729c1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTableTextRangeResolver.java +++ /dev/null @@ -1,40 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.OrmTable; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; - -public class OrmTableTextRangeResolver - implements TableTextRangeResolver -{ - protected final OrmTable ormTable; - - public OrmTableTextRangeResolver(OrmTable ormTable) { - this.ormTable = ormTable; - } - - protected OrmTable getTable() { - return this.ormTable; - } - - public TextRange getNameTextRange() { - return this.ormTable.getNameTextRange(); - } - - public TextRange getCatalogTextRange() { - return this.ormTable.getCatalogTextRange(); - } - - public TextRange getSchemaTextRange() { - return this.ormTable.getSchemaTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTransientMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTransientMappingDefinition.java deleted file mode 100644 index 2f5e612f3a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTransientMappingDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTransient; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; - -public class OrmTransientMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmAttributeMappingDefinition INSTANCE = - new OrmTransientMappingDefinition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmTransientMappingDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - OrmPackage.eINSTANCE.getXmlTransient(), - XmlTransient.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return factory.buildOrmTransientMapping(parent, (XmlTransient) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java deleted file mode 100644 index 3a769597e7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmTypeMappingTextRangeResolver.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver; - -public class OrmTypeMappingTextRangeResolver - implements TypeMappingTextRangeResolver -{ - private OrmTypeMapping typeMapping; - - public OrmTypeMappingTextRangeResolver(OrmTypeMapping typeMapping) { - this.typeMapping = typeMapping; - } - - public TextRange getTypeMappingTextRange() { - return this.typeMapping.getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmVersionMappingDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmVersionMappingDefinition.java deleted file mode 100644 index cf82474d55..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/OrmVersionMappingDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; - -public class OrmVersionMappingDefinition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmAttributeMappingDefinition INSTANCE = - new OrmVersionMappingDefinition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmVersionMappingDefinition() { - super(); - } - - - public String getKey() { - return MappingKeys.VERSION_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - OrmPackage.eINSTANCE.getXmlVersion(), - XmlVersion.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping resourceMapping, - OrmXmlContextNodeFactory factory) { - return factory.buildOrmVersionMapping(parent, (XmlVersion) resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java deleted file mode 100644 index 70e23586d1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/SpecifiedOrmPersistentAttribute.java +++ /dev/null @@ -1,430 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.CollectionMapping; -import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmStructureNodes; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentAttribute2_0; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * specified orm.xml persistent attribute - */ -public abstract class SpecifiedOrmPersistentAttribute - extends AbstractOrmXmlContextNode - implements OrmPersistentAttribute2_0 -{ - protected OrmAttributeMapping mapping; // never null - - /** - * This will point to one of the following:
    - *
  • an existing Java attribute (taken from the appropriate Java type) - *
  • {@link #cachedJavaPersistentAttribute} if there is no such Java attribute - * (i.e. the Java type's acces type is different) - *
  • null if there is no matching Java resource attribute - *
- * @see #buildJavaPersistentAttribute() - */ - protected JavaPersistentAttribute javaPersistentAttribute; - - protected JavaPersistentAttribute cachedJavaPersistentAttribute; - - protected AccessType defaultAccess; - - - protected SpecifiedOrmPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlMapping) { - super(parent); - this.mapping = this.buildMapping(xmlMapping); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mapping.synchronizeWithResourceModel(); - if (this.cachedJavaPersistentAttribute != null) { - this.cachedJavaPersistentAttribute.synchronizeWithResourceModel(); - } - } - - @Override - public void update() { - super.update(); - this.setDefaultAccess(this.buildDefaultAccess()); - this.setJavaPersistentAttribute(this.buildJavaPersistentAttribute()); - this.mapping.update(); - if (this.cachedJavaPersistentAttribute != null) { - this.cachedJavaPersistentAttribute.update(); - } - } - - - // ********** mapping ********** - - public OrmAttributeMapping getMapping() { - return this.mapping; - } - - public String getMappingKey() { - return this.mapping.getKey(); - } - - public OrmAttributeMapping setMappingKey(String mappingKey) { - if (this.valuesAreDifferent(this.getMappingKey(), mappingKey)) { - this.setMappingKey_(mappingKey); - } - return this.mapping; - } - - protected void setMappingKey_(String mappingKey) { - OrmAttributeMappingDefinition mappingDefinition = this.getMappingFileDefinition().getAttributeMappingDefinition(mappingKey); - XmlAttributeMapping xmlAttributeMapping = mappingDefinition.buildResourceMapping(this.getResourceNodeFactory()); - this.setMapping(this.buildMapping(xmlAttributeMapping)); - } - - protected final OrmAttributeMapping buildMapping(XmlAttributeMapping xmlAttributeMapping) { - OrmAttributeMappingDefinition md = this.getMappingFileDefinition().getAttributeMappingDefinition(xmlAttributeMapping.getMappingKey()); - return md.buildContextMapping(this, xmlAttributeMapping, this.getContextNodeFactory()); - } - - protected void setMapping(OrmAttributeMapping mapping) { - OrmAttributeMapping old = this.mapping; - this.mapping = mapping; - this.firePropertyChanged(MAPPING_PROPERTY, old, mapping); - this.getOwningPersistentType().changeMapping(this, old, mapping); - } - - /** - * orm.xml attributes do not have a default mapping; - * they are always specified. - */ - public String getDefaultMappingKey() { - return null; - } - - protected XmlAttributeMapping getXmlAttributeMapping() { - return this.mapping.getXmlAttributeMapping(); - } - - - // ********** name ********** - - public String getName() { - return this.mapping.getName(); - } - - public void nameChanged(String oldName, String newName) { - this.firePropertyChanged(NAME_PROPERTY, oldName, newName); - } - - - // ********** Java persistent attribute ********** - - public JavaPersistentAttribute getJavaPersistentAttribute() { - return this.javaPersistentAttribute; - } - - public JavaPersistentAttribute resolveJavaPersistentAttribute() { - return this.getJavaPersistentAttribute(); - } - - protected void setJavaPersistentAttribute(JavaPersistentAttribute javaPersistentAttribute) { - JavaPersistentAttribute old = this.javaPersistentAttribute; - this.javaPersistentAttribute = javaPersistentAttribute; - this.firePropertyChanged(JAVA_PERSISTENT_ATTRIBUTE_PROPERTY, old, javaPersistentAttribute); - } - - protected JavaPersistentAttribute buildJavaPersistentAttribute() { - String name = this.getName(); - if (name == null) { - return null; - } - JavaPersistentType javaType = this.getOwningJavaPersistentType(); - if (javaType == null) { - return null; - } - - ReadOnlyPersistentAttribute pAttribute = javaType.resolveAttribute(name); - JavaPersistentAttribute javaAttribute = (pAttribute == null) ? null : pAttribute.getJavaPersistentAttribute(); - if ((javaAttribute != null) && (javaAttribute.getAccess() == this.getAccess())) { - // we only want to cache the Java persistent attribute if we built it - this.cachedJavaPersistentAttribute = null; - return javaAttribute; - } - - // If 'javaAttribute' is null, it might exist in a superclass that - // is not persistent. In that case we need to build it ourselves. - // If 'javaAttribute' access is different, 'javaType' will not hold - // a corresponding Java persistent attribute. So, again, we need - // to build it ourselves. - return this.getCachedJavaAttribute(); - } - - protected JavaPersistentAttribute getCachedJavaAttribute() { - JavaResourcePersistentType javaResourceType = this.getOwningJavaPersistentType().getResourcePersistentType(); - JavaResourcePersistentAttribute javaResourceAttribute = this.getJavaResourceAttribute(javaResourceType); - if (javaResourceAttribute == null) { - // nothing in the resource inheritance hierarchy matches our name *and* access type - this.cachedJavaPersistentAttribute = null; - } else { - if ((this.cachedJavaPersistentAttribute == null) || - (this.cachedJavaPersistentAttribute.getResourcePersistentAttribute() != javaResourceAttribute)) { - // cache is stale - this.cachedJavaPersistentAttribute = this.buildJavaPersistentAttribute(javaResourceAttribute); - } - } - return this.cachedJavaPersistentAttribute; - } - - protected JavaResourcePersistentAttribute getJavaResourceAttribute(JavaResourcePersistentType javaResourceType) { - for (JavaResourcePersistentAttribute javaResourceAttribute : this.getJavaResourceAttributes(javaResourceType)) { - if (javaResourceAttribute.getName().equals(this.getName())) { - return javaResourceAttribute; - } - } - // climb up inheritance hierarchy - String superclassName = javaResourceType.getSuperclassQualifiedName(); - if (superclassName == null) { - return null; - } - JavaResourcePersistentType superclass = this.getJpaProject().getJavaResourcePersistentType(superclassName); - if (superclass == null) { - return null; - } - // recurse - return this.getJavaResourceAttribute(superclass); - } - - /** - * Return the resource attributes with compatible access types. - */ - protected Iterable getJavaResourceAttributes(JavaResourcePersistentType javaResourceType) { - return CollectionTools.iterable(javaResourceType.persistableAttributes(this.getAccess().getJavaAccessType())); - } - - protected JavaPersistentAttribute buildJavaPersistentAttribute(JavaResourcePersistentAttribute javaResourceAttribute) { - // pass in our parent orm persistent type as the parent to the cached Java attribute... - return this.getJpaFactory().buildJavaPersistentAttribute(this.getOwningPersistentType(), javaResourceAttribute); - } - - public JavaResourcePersistentAttribute getJavaResourcePersistentAttribute() { - return (this.javaPersistentAttribute == null) ? null : this.javaPersistentAttribute.getResourcePersistentAttribute(); - } - - - // ********** access ********** - - /** - * Subclasses determine the specified access. - */ - public AccessType getAccess() { - AccessType specifiedAccess = this.getSpecifiedAccess(); - return (specifiedAccess != null) ? specifiedAccess : this.defaultAccess; - } - - public abstract AccessType getSpecifiedAccess(); - - public AccessType getDefaultAccess() { - return this.defaultAccess; - } - - protected void setDefaultAccess(AccessType access) { - AccessType old = this.defaultAccess; - this.defaultAccess = access; - this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, access); - } - - protected AccessType buildDefaultAccess() { - return this.getOwningPersistentType().getAccess(); - } - - - // ********** specified/virtual ********** - - public boolean isVirtual() { - return false; - } - - public OrmReadOnlyPersistentAttribute convertToVirtual() { - return this.getOwningPersistentType().convertAttributeToVirtual(this); - } - - public OrmPersistentAttribute convertToSpecified() { - throw new UnsupportedOperationException(); - } - - public OrmPersistentAttribute convertToSpecified(String mappingKey) { - throw new UnsupportedOperationException(); - } - - - // ********** JpaStructureNode implementation ********** - - public String getId() { - return OrmStructureNodes.PERSISTENT_ATTRIBUTE_ID; - } - - public JpaStructureNode getStructureNode(int offset) { - return this; - } - - public boolean contains(int textOffset) { - return this.mapping.contains(textOffset); - } - - public TextRange getSelectionTextRange() { - return this.mapping.getSelectionTextRange(); - } - - public void dispose() { - // nothing to dispose - } - - - // ********** refactoring ********** - - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return this.mapping.createRenameTypeEdits(originalType, newName); - } - - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.mapping.createMoveTypeEdits(originalType, newPackage); - } - - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.mapping.createRenamePackageEdits(originalPackage, newName); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateAttribute(messages, reporter); - this.mapping.validate(messages, reporter); - } - - protected void validateAttribute(List messages, IReporter reporter) { - if (this.javaPersistentAttribute == null) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENT_ATTRIBUTE_UNRESOLVED_NAME, - new String[] { - this.getName(), - this.getOwningTypeMapping().getClass_() - }, - this.mapping, - this.mapping.getNameTextRange() - ) - ); - } else { - this.buildAttibuteValidator().validate(messages, reporter); - } - } - - protected PersistentAttributeTextRangeResolver buildTextRangeResolver() { - return new OrmPersistentAttributeTextRangeResolver(this); - } - - protected abstract JptValidator buildAttibuteValidator(); - - public TextRange getValidationTextRange() { - return this.mapping.getValidationTextRange(); - } - - - // ********** metamodel ********** - - public String getMetamodelContainerFieldTypeName() { - return this.getJpaContainerDefinition().getMetamodelContainerFieldTypeName(); - } - - public String getMetamodelContainerFieldMapKeyTypeName() { - return this.getJpaContainerDefinition().getMetamodelContainerFieldMapKeyTypeName((CollectionMapping) this.mapping); - } - - public String getMetamodelTypeName() { - JavaPersistentAttribute2_0 javaAttribute = (JavaPersistentAttribute2_0) this.javaPersistentAttribute; - return (javaAttribute != null) ? - javaAttribute.getMetamodelTypeName() : - MetamodelField.DEFAULT_TYPE_NAME; - } - - protected JavaPersistentAttribute.JpaContainerDefinition getJpaContainerDefinition() { - JavaPersistentAttribute2_0 javaAttribute = (JavaPersistentAttribute2_0) this.javaPersistentAttribute; - return (javaAttribute != null) ? - javaAttribute.getJpaContainerDefinition() : - JavaPersistentAttribute.JpaContainerDefinition.Null.instance(); - } - - - // ********** misc ********** - - @Override - public OrmPersistentType getParent() { - return (OrmPersistentType) super.getParent(); - } - - public OrmPersistentType getOwningPersistentType() { - return this.getParent(); - } - - protected JavaPersistentType getOwningJavaPersistentType() { - return this.getOwningPersistentType().getJavaPersistentType(); - } - - public OrmTypeMapping getOwningTypeMapping() { - return this.getOwningPersistentType().getMapping(); - } - - public String getPrimaryKeyColumnName() { - return this.mapping.getPrimaryKeyColumnName(); - } - - public String getTypeName() { - return (this.javaPersistentAttribute == null) ? null : this.javaPersistentAttribute.getTypeName(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getName()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java deleted file mode 100644 index a45183eca7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/orm/VirtualOrmPersistentAttribute.java +++ /dev/null @@ -1,585 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.orm; - -import java.util.HashMap; -import java.util.Iterator; -import java.util.ListIterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.MethodSignature; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.model.event.StateChangeEvent; -import org.eclipse.jpt.common.utility.model.listener.StateChangeListener; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmStructureNodes; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNode; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmReadOnlyPersistentAttribute2_0; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation; - -/** - * virtual orm.xml persistent attribute - */ -public class VirtualOrmPersistentAttribute - extends AbstractOrmXmlContextNode - implements OrmReadOnlyPersistentAttribute2_0 -{ - protected final JavaResourcePersistentAttribute javaResourceAttribute; - - /** - * This is an "annotated" Java persistent attribute whose state is - * determined by its annotations (just like a "normal" Java attribute). - * Its parent is an orm.xml persistent type. This is necessary - * because the Java attribute's context is the orm.xml type - * (e.g. the Java attribute's default table is the table set in the - * orm.xml type, not the Java type). - */ - protected final JavaPersistentAttribute annotatedJavaAttribute; - - /** - * This is the "original" Java persistent attribute corresponding to - * {@link #javaResourceAttribute} from the Java context - * model. If it is found (it can be null if the - * orm.xml access type differs from the Java's), we need to - * listen to it for changes so we can - * refresh our "local" Java attributes (since the Java resource model does - * not fire change events, and trigger a sync, when it is modified - * by the Java context model - if there is no Java context attribute, the - * Java resource model can only be modified via source code editing). - */ - protected JavaPersistentAttribute originalJavaAttribute; - protected StateChangeListener originalJavaAttributeListener; - - /** - * This is a simulated "unannotated" Java persistent attribute. It is built - * only if necessary (i.e. when the orm.xml persistent type - * has been tagged metadata complete). Like - * {@link #annotatedJavaAttribute}, its parent is an - * orm.xml persistent type. - */ - protected JavaPersistentAttribute unannotatedJavaAttribute; - - protected JavaAttributeMapping mapping; // never null - - - public VirtualOrmPersistentAttribute(OrmPersistentType parent, JavaResourcePersistentAttribute javaResourceAttribute) { - super(parent); - this.javaResourceAttribute = javaResourceAttribute; - this.annotatedJavaAttribute = this.buildAnnotatedJavaAttribute(); - this.mapping = this.buildMapping(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncLocalJavaAttributes(); - // 'mapping' belongs to one of the "local" Java persistent attributes - } - - @Override - public void update() { - super.update(); - this.updateOriginalJavaAttribute(); - this.updateLocalJavaAttributes(); - this.setMapping(this.buildMapping()); - } - - - // ********** mapping ********** - - public JavaAttributeMapping getMapping() { - return this.mapping; - } - - protected void setMapping(JavaAttributeMapping mapping) { - JavaAttributeMapping old = this.mapping; - this.mapping = mapping; - this.firePropertyChanged(DEFAULT_MAPPING_KEY_PROPERTY, old, mapping); - } - - protected JavaAttributeMapping buildMapping() { - return this.getJavaPersistentAttribute().getMapping(); - } - - public String getMappingKey() { - return this.mapping.getKey(); - } - - public String getDefaultMappingKey() { - return this.mapping.getKey(); - } - - - // ********** name ********** - - public String getName() { - return this.mapping.getName(); - } - - - // ********** Java persistent attribute ********** - - public JavaPersistentAttribute getJavaPersistentAttribute() { - return this.getOwningTypeMapping().isMetadataComplete() ? - this.getUnannotatedJavaAttribute() : - this.annotatedJavaAttribute; - } - - public JavaPersistentAttribute resolveJavaPersistentAttribute() { - JavaPersistentType javaType = this.getOwningPersistentType().getJavaPersistentType(); - return (javaType == null) ? null : javaType.getAttributeFor(this.javaResourceAttribute); - } - - protected JavaPersistentAttribute2_0 getJavaPersistentAttribute2_0() { - return (JavaPersistentAttribute2_0) this.getJavaPersistentAttribute(); - } - - protected JavaPersistentAttribute buildAnnotatedJavaAttribute() { - return this.buildJavaAttribute(this.javaResourceAttribute); - } - - protected JavaPersistentAttribute getUnannotatedJavaAttribute() { - if (this.unannotatedJavaAttribute == null) { - this.unannotatedJavaAttribute = this.buildUnannotatedJavaAttribute(); - } - return this.unannotatedJavaAttribute; - } - - protected JavaPersistentAttribute buildUnannotatedJavaAttribute() { - return this.buildJavaAttribute(this.buildUnannotatedJavaResourceAttribute()); - } - - /** - * Build a Java resource attribute that wraps the original Java resource - * attribute and behaves as though it has no annotations. This will cause - * all the settings in the Java context attribute to default. - */ - protected JavaResourcePersistentAttribute buildUnannotatedJavaResourceAttribute() { - return new UnannotatedJavaResourcePersistentAttribute(this.javaResourceAttribute); - } - - protected JavaPersistentAttribute buildJavaAttribute(JavaResourcePersistentAttribute jrpa) { - // pass in the orm persistent type as the parent... - return this.getJpaFactory().buildJavaPersistentAttribute(this.getOwningPersistentType(), jrpa); - } - - protected void syncLocalJavaAttributes() { - this.annotatedJavaAttribute.synchronizeWithResourceModel(); - if (this.unannotatedJavaAttribute != null) { - this.unannotatedJavaAttribute.synchronizeWithResourceModel(); - } - } - - protected void updateLocalJavaAttributes() { - this.annotatedJavaAttribute.update(); - if (this.unannotatedJavaAttribute != null) { - this.unannotatedJavaAttribute.update(); - } - } - - public JavaResourcePersistentAttribute getJavaResourcePersistentAttribute() { - return this.javaResourceAttribute; - } - - - // ********** original Java persistent attribute ********** - - protected void updateOriginalJavaAttribute() { - JavaPersistentAttribute newJavaAttribute = this.resolveJavaPersistentAttribute(); - if (newJavaAttribute != this.originalJavaAttribute) { - if (newJavaAttribute == null) { - this.originalJavaAttribute.removeStateChangeListener(this.getOriginalJavaAttributeListener()); - this.originalJavaAttribute = null; - } else { - if (this.originalJavaAttribute != null) { - this.originalJavaAttribute.removeStateChangeListener(this.getOriginalJavaAttributeListener()); - } - this.originalJavaAttribute = newJavaAttribute; - this.originalJavaAttribute.addStateChangeListener(this.getOriginalJavaAttributeListener()); - } - } - } - - protected StateChangeListener getOriginalJavaAttributeListener() { - if (this.originalJavaAttributeListener == null) { - this.originalJavaAttributeListener = this.buildOriginalJavaAttributeListener(); - } - return this.originalJavaAttributeListener; - } - - protected StateChangeListener buildOriginalJavaAttributeListener() { - return new StateChangeListener() { - public void stateChanged(StateChangeEvent event) { - VirtualOrmPersistentAttribute.this.originalJavaAttributeChanged(); - } - }; - } - - /** - * If the "original" Java persistent attribute (or any of its parts) changes - * we need to sync our "local" Java persistent attributes with any possible - * changes to the Java resource model. This is necessary for when the Java - * context model is modifying the Java resource model, but is redundant when - * the Java resource model is triggering a sync. - */ - protected void originalJavaAttributeChanged() { - this.syncLocalJavaAttributes(); - } - - - // ********** access ********** - - public AccessType getAccess() { - return this.getJavaPersistentAttribute().getAccess(); - } - - - // ********** specified/virtual ********** - - public boolean isVirtual() { - return true; - } - - public OrmReadOnlyPersistentAttribute convertToVirtual() { - throw new UnsupportedOperationException(); - } - - public OrmPersistentAttribute convertToSpecified() { - if (this.mapping.getKey() == null) { - throw new IllegalStateException("Use convertToSpecified(String) instead and specify a mapping type"); //$NON-NLS-1$ - } - return this.getOwningPersistentType().convertAttributeToSpecified(this); - } - - public OrmPersistentAttribute convertToSpecified(String mappingKey) { - return this.getOwningPersistentType().convertAttributeToSpecified(this, mappingKey); - } - - - // ********** JpaStructureNode implementation ********** - - public String getId() { - return OrmStructureNodes.PERSISTENT_ATTRIBUTE_ID; - } - - public JpaStructureNode getStructureNode(int offset) { - return this; - } - - public boolean contains(int textOffset) { - return false; - } - - public TextRange getSelectionTextRange() { - return null; - } - - public void dispose() { - if (this.originalJavaAttribute != null) { - this.originalJavaAttribute.removeStateChangeListener(this.getOriginalJavaAttributeListener()); - } - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return this.getOwningTypeMapping().getAttributesTextRange(); - } - - - // ********** metamodel ********** - - public String getMetamodelContainerFieldTypeName() { - return this.getJavaPersistentAttribute2_0().getMetamodelContainerFieldTypeName(); - } - - public String getMetamodelContainerFieldMapKeyTypeName() { - return this.getJavaPersistentAttribute2_0().getMetamodelContainerFieldMapKeyTypeName(); - } - - public String getMetamodelTypeName() { - return this.getJavaPersistentAttribute2_0().getMetamodelTypeName(); - } - - - // ********** misc ********** - - @Override - public OrmPersistentType getParent() { - return (OrmPersistentType) super.getParent(); - } - - public OrmPersistentType getOwningPersistentType() { - return this.getParent(); - } - - public OrmTypeMapping getOwningTypeMapping() { - return this.getOwningPersistentType().getMapping(); - } - - public String getPrimaryKeyColumnName() { - return this.mapping.getPrimaryKeyColumnName(); - } - - public String getTypeName() { - return this.getJavaPersistentAttribute().getTypeName(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getName()); - } - - - // ********** unannotated Java resource persistent member ********** - - /** - * Wrap another Java resource member and suppress all its annotations. - */ - protected abstract class UnannotatedJavaResourcePersistentMember - extends SourceNode - implements JavaResourcePersistentMember - { - protected final M member; - - /** - * these are built as needed - */ - protected final HashMap nullAnnotationsCache = new HashMap(); - - - protected UnannotatedJavaResourcePersistentMember(M member) { - super(member.getParent()); - this.member = member; - } - - public void initialize(CompilationUnit astRoot) { - // NOP - } - - public void synchronizeWith(CompilationUnit astRoot) { - // NOP - } - - - // ********** annotations ********** - - public Iterator annotations() { - return EmptyIterator.instance(); - } - - public int annotationsSize() { - return 0; - } - - public Annotation getAnnotation(String annotationName) { - return null; - } - - public synchronized Annotation getNonNullAnnotation(String annotationName) { - Annotation annotation = this.nullAnnotationsCache.get(annotationName); - if (annotation == null) { - annotation = this.buildNullAnnotation(annotationName); - this.nullAnnotationsCache.put(annotationName, annotation); - } - return annotation; - } - - protected abstract Annotation buildNullAnnotation(String annotationName); - - public Iterator annotations(String nestableAnnotationName, String containerAnnotationName) { - return EmptyIterator.instance(); - } - - public Annotation addAnnotation(String annotationName) { - throw new UnsupportedOperationException(); - } - - public NestableAnnotation addAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) { - throw new UnsupportedOperationException(); - } - - public void moveAnnotation(int targetIndex, int sourceIndex, String containerAnnotationName) { - throw new UnsupportedOperationException(); - } - - public void removeAnnotation(String annotationName) { - throw new UnsupportedOperationException(); - } - - public void removeAnnotation(int index, String nestableAnnotationName, String containerAnnotationName) { - throw new UnsupportedOperationException(); - } - - public Annotation setPrimaryAnnotation(String primaryAnnotationName, Iterable supportingAnnotationNames) { - throw new UnsupportedOperationException(); - } - - public void addStandAloneAnnotation(NestableAnnotation standAloneAnnotation) { - throw new UnsupportedOperationException(); - } - - - // ********** persistable ********** - - public boolean isPersistable() { - return this.member.isPersistable(); - } - - - // ********** misc ********** - - public boolean isAnnotated() { - return false; - } - - public boolean isFinal() { - return this.member.isFinal(); - } - - public boolean isFor(String memberName, int occurrence) { - return this.member.isFor(memberName, occurrence); - } - - public TextRange getTextRange(CompilationUnit astRoot) { - return this.member.getTextRange(astRoot); - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return this.member.getNameTextRange(astRoot); - } - - public void resolveTypes(CompilationUnit astRoot) { - // NOP - } - } - - - // ********** unannotated Java resource persistent member ********** - - protected class UnannotatedJavaResourcePersistentAttribute - extends UnannotatedJavaResourcePersistentMember - implements JavaResourcePersistentAttribute - { - protected UnannotatedJavaResourcePersistentAttribute(JavaResourcePersistentAttribute attribute){ - super(attribute); - } - - - // ********** annotations ********** - - @Override - public Annotation buildNullAnnotation(String annotationName) { - return (annotationName == null) ? null : this.buildNullAnnotation_(annotationName); - } - - private Annotation buildNullAnnotation_(String annotationName) { - return this.getAnnotationProvider().buildNullAttributeAnnotation(this, annotationName); - } - - - // ********** delegated behavior ********** - - @Override - public JavaResourcePersistentType getParent() { - return this.member.getParent(); - } - - public JavaResourcePersistentType getResourcePersistentType() { - return this.member.getResourcePersistentType(); - } - - public String getName() { - return this.member.getName(); - } - - public boolean isFor(MethodSignature signature, int occurrence) { - return this.member.isFor(signature, occurrence); - } - - public boolean isField() { - return this.member.isField(); - } - - public boolean isProperty() { - return this.member.isProperty(); - } - - public org.eclipse.jpt.jpa.core.resource.java.AccessType getSpecifiedAccess() { - return null; - } - - public boolean typeIsSubTypeOf(String tn) { - return this.member.typeIsSubTypeOf(tn); - } - - public boolean typeIsVariablePrimitive() { - return this.member.typeIsVariablePrimitive(); - } - - public int getModifiers() { - return this.member.getModifiers(); - } - - public String getTypeName() { - return this.member.getTypeName(); - } - - public boolean typeIsInterface() { - return this.member.typeIsInterface(); - } - - public boolean typeIsEnum() { - return this.member.typeIsEnum(); - } - - public ListIterator typeSuperclassNames() { - return this.member.typeSuperclassNames(); - } - - public Iterator typeInterfaceNames() { - return this.member.typeInterfaceNames(); - } - - public ListIterator typeTypeArgumentNames() { - return this.member.typeTypeArgumentNames(); - } - - public int typeTypeArgumentNamesSize() { - return this.member.typeTypeArgumentNamesSize(); - } - - public String getTypeTypeArgumentName(int index) { - return this.member.getTypeTypeArgumentName(index); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getName()); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java deleted file mode 100644 index 0413d8f066..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractJarFileRef.java +++ /dev/null @@ -1,384 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.persistence; - -import java.util.List; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.jpa.core.JpaFile; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.java.JarFile; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceStructureNodes; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.common.componentcore.ComponentCore; -import org.eclipse.wst.common.componentcore.resources.IVirtualFile; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * persistence.xml file - *
- * jar-file element - */ -public abstract class AbstractJarFileRef - extends AbstractPersistenceXmlContextNode - implements JarFileRef -{ - protected final XmlJarFileRef xmlJarFileRef; - - protected String fileName; - - /** - * the jar file corresponding to the ref's file name; - * this can be null if the name is invalid - */ - protected JarFile jarFile; - - - // ********** construction/initialization ********** - - public AbstractJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) { - super(parent); - this.xmlJarFileRef = xmlJarFileRef; - this.fileName = xmlJarFileRef.getFileName(); - this.jarFile = this.buildJarFile(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setFileName_(this.xmlJarFileRef.getFileName()); - this.syncJarFile(); - } - - @Override - public void update() { - super.update(); - this.updateJarFile(); - } - - - // ********** JpaStructureNode implementation ********** - - public String getId() { - return PersistenceStructureNodes.JAR_FILE_REF_ID; - } - - public JpaStructureNode getStructureNode(int textOffset) { - return this; - } - - public TextRange getSelectionTextRange() { - return (this.xmlJarFileRef == null) ? null : this.xmlJarFileRef.getSelectionTextRange(); - } - - public void dispose() { - if (this.jarFile != null) { - this.jarFile.dispose(); - } - } - - - // ********** file name ********** - - public String getFileName() { - return this.fileName; - } - - public void setFileName(String fileName) { - this.setFileName_(fileName); - this.xmlJarFileRef.setFileName(fileName); - } - - /** - * We clear out {@link #jarFile} here because we cannot compare its file - * name to the ref's file name, since it may have been munged (see - * {@link #resolveJavaResourcePackageFragmentRoot_()}). - */ - protected void setFileName_(String fileName) { - String old = this.fileName; - this.fileName = fileName; - if (this.firePropertyChanged(FILE_NAME_PROPERTY, old, fileName)) { - // clear out the jar file here, it will be rebuilt during "update" - if (this.jarFile != null) { - this.jarFile.dispose(); - this.setJarFile(null); - } - } - } - - - // ********** jar file ********** - - public JarFile getJarFile() { - return this.jarFile; - } - - protected void setJarFile(JarFile jarFile) { - JarFile old = this.jarFile; - this.jarFile = jarFile; - this.firePropertyChanged(JAR_FILE_PROPERTY, old, jarFile); - } - - protected JarFile buildJarFile() { - JavaResourcePackageFragmentRoot jrpfr = this.resolveJavaResourcePackageFragmentRoot(); - return (jrpfr == null) ? null : this.buildJarFile(jrpfr); - } - - /** - * If the file name changes during sync, the jar file will be - * cleared out in {@link #setFileName_(String)}. If we get here and the jar - * file is still present, we can sync it. Of course, it might - * still be obsolete if other things have changed.... - * - * @see #updateJarFile() - */ - protected void syncJarFile() { - if (this.jarFile != null) { - this.jarFile.synchronizeWithResourceModel(); - } - } - - /** - * @see #syncJarFile() - */ - protected void updateJarFile() { - JavaResourcePackageFragmentRoot jrpfr = this.resolveJavaResourcePackageFragmentRoot(); - if (jrpfr == null) { - if (this.jarFile != null) { - this.jarFile.dispose(); - this.setJarFile(null); - } - } else { - if (this.jarFile == null) { - this.setJarFile(this.buildJarFile(jrpfr)); - } else { - if (this.jarFile.getJarResourcePackageFragmentRoot() == jrpfr) { - this.jarFile.update(); - } else { - this.jarFile.dispose(); - this.setJarFile(this.buildJarFile(jrpfr)); - } - } - } - } - - protected JavaResourcePackageFragmentRoot resolveJavaResourcePackageFragmentRoot() { - return StringTools.stringIsEmpty(this.fileName) ? null : this.resolveJavaResourcePackageFragmentRoot_(); - } - - /** - * pre-condition: 'fileName' is neither null nor empty - */ - protected JavaResourcePackageFragmentRoot resolveJavaResourcePackageFragmentRoot_() { - // first, attempt to resolve location specifically... - JavaResourcePackageFragmentRoot jrpfr = this.resolveJrpfrOnDeploymentPath(); - // ...then guess, basically - return (jrpfr != null) ? jrpfr : this.resolveJrpfrBestMatch(); - } - - /** - * pre-condition: 'fileName' is neither null nor empty - */ - protected JavaResourcePackageFragmentRoot resolveJrpfrOnDeploymentPath() { - for (IPath runtimePath : this.buildRuntimeJarFilePath(new Path(this.fileName))) { - IVirtualFile virtualJar = ComponentCore.createFile(this.getProject(), runtimePath); - IFile realJar = virtualJar.getUnderlyingFile(); - if (realJar.exists() && realJar.getProject().equals(this.getProject())) { - return this.getJpaProject().getJavaResourcePackageFragmentRoot(realJar.getProjectRelativePath().toString()); - } - } - return null; - } - - /** - * Return an array of runtime paths that may correspond - * to the given persistence.xml jar file entry - */ - protected IPath[] buildRuntimeJarFilePath(IPath jarFilePath) { - IPath root = this.getJarRuntimeRootPath(); - return this.projectHasWebFacet() ? - this.buildRuntimeJarFilePathWeb(root, jarFilePath) : - this.buildRuntimeJarFilePathNonWeb(root, jarFilePath); - } - - protected IPath getJarRuntimeRootPath() { - return JptJpaCorePlugin.getJarRuntimeRootPath(this.getProject()); - } - - protected boolean projectHasWebFacet() { - return JptJpaCorePlugin.projectHasWebFacet(this.getProject()); - } - - protected IPath[] buildRuntimeJarFilePathWeb(IPath root, IPath jarFilePath) { - return new IPath[] { - // first path entry assumes form "../lib/other.jar" - root.append(jarFilePath.removeFirstSegments(1)), - // second path entry assumes form of first, without ".." ("lib/other.jar") - root.append(jarFilePath) - }; - } - - protected IPath[] buildRuntimeJarFilePathNonWeb(IPath root, IPath jarFilePath) { - return new IPath[] { - // assumes form "../lib/other.jar" - root.append(jarFilePath) - }; - } - - protected IProject getProject() { - return this.getJpaProject().getProject(); - } - - /** - * pre-condition: 'fileName' is neither null nor empty - */ - protected JavaResourcePackageFragmentRoot resolveJrpfrBestMatch() { - String jarFileName = new Path(this.fileName).lastSegment(); - for (JpaFile jpaFile : this.getJpaProject().getJarJpaFiles()) { - if (jpaFile.getFile().getName().equals(jarFileName)) { - return (JavaResourcePackageFragmentRoot) jpaFile.getResourceModel(); - } - } - return null; - } - - /** - * pre-condition: 'jrpfr' is not null - */ - protected JarFile buildJarFile(JavaResourcePackageFragmentRoot jrpfr) { - return this.getContextNodeFactory().buildJarFile(this, jrpfr); - } - - - // ********** JarFileRef implementation ********** - - public XmlJarFileRef getXmlJarFileRef() { - return this.xmlJarFileRef; - } - - public PersistentType getPersistentType(String typeName) { - return (this.jarFile == null) ? null : this.jarFile.getPersistentType(typeName); - } - - public boolean containsOffset(int textOffset) { - return (this.xmlJarFileRef != null) && this.xmlJarFileRef.containsOffset(textOffset); - } - - - // ********** PersistentTypeContainer implementation ********** - - public Iterable getPersistentTypes() { - return (this.jarFile != null) ? this.jarFile.getPersistentTypes() : EmptyIterable.instance(); - } - - - // ********** XmlContextNode implementation ********** - - public TextRange getValidationTextRange() { - return (this.xmlJarFileRef == null) ? null : this.xmlJarFileRef.getValidationTextRange(); - } - - - // ********** refactoring ********** - - public Iterable createReplaceFolderEdits(IFolder originalFolder, String newName) { - return this.isIn(originalFolder) ? - new SingleElementIterable(this.createReplaceFolderEdit(originalFolder, newName)) : - EmptyIterable.instance(); - } - - protected ReplaceEdit createReplaceFolderEdit(IFolder originalFolder, String newName) { - return this.xmlJarFileRef.createReplaceFolderEdit(originalFolder, newName); - } - - protected boolean isIn(IFolder folder) { - return (this.jarFile != null) && this.jarFile.isIn(folder); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - - if (StringTools.stringIsEmpty(this.xmlJarFileRef.getFileName())) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENCE_UNIT_UNSPECIFIED_JAR_FILE, - this, - this.getValidationTextRange() - ) - ); - return; - } - - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - JpaValidationMessages.PERSISTENCE_UNIT_JAR_FILE_DEPLOYMENT_PATH_WARNING, - this, - this.getValidationTextRange() - ) - ); - - if (this.jarFile == null) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENCE_UNIT_NONEXISTENT_JAR_FILE, - new String[] {this.xmlJarFileRef.getFileName()}, - this, - this.getValidationTextRange() - ) - ); - return; - } - - this.jarFile.validate(messages, reporter); - } - - - // ********** overrides ********** - - @Override - public PersistenceUnit getParent() { - return (PersistenceUnit) super.getParent(); - } - - @Override - public void toString(StringBuilder sb) { - super.toString(sb); - sb.append(this.fileName); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java deleted file mode 100644 index 6eb3db74f2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractMappingFileRef.java +++ /dev/null @@ -1,344 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.persistence; - -import java.util.List; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.context.MappingFile; -import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitMetadata; -import org.eclipse.jpt.jpa.core.context.MappingFileRoot; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceStructureNodes; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * persistence.xml file - *
- * mapping-file element - */ -public abstract class AbstractMappingFileRef - extends AbstractPersistenceXmlContextNode - implements MappingFileRef -{ - protected String fileName; - - /** - * The mapping file corresponding to the ref's file name. - * This can be null if the name is invalid. - */ - protected MappingFile mappingFile; - - - // ********** construction/initialization ********** - - protected AbstractMappingFileRef(PersistenceUnit parent, String fileName) { - super(parent); - this.fileName = fileName; - this.mappingFile = this.buildMappingFile(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncMappingFile(); - } - - @Override - public void update() { - super.update(); - this.updateMappingFile(); - } - - - // ********** file name ********** - - public String getFileName() { - return this.fileName; - } - - public boolean isFor(IFile file) { - return (this.mappingFile != null) && file.equals(this.mappingFile.getXmlResource().getFile()); - } - - protected boolean isIn(IFolder folder) { - return (this.mappingFile != null) && this.mappingFile.isIn(folder); - } - - - // ********** mapping file ********** - - public MappingFile getMappingFile() { - return this.mappingFile; - } - - protected void setMappingFile(MappingFile mappingFile) { - MappingFile old = this.mappingFile; - this.mappingFile = mappingFile; - this.firePropertyChanged(MAPPING_FILE_PROPERTY, old, mappingFile); - } - - protected MappingFile buildMappingFile() { - JpaXmlResource xmlResource = this.resolveMappingFileXmlResource(); - return (xmlResource == null) ? null : this.buildMappingFile(xmlResource); - } - - protected void syncMappingFile() { - if (this.mappingFile != null) { - this.mappingFile.synchronizeWithResourceModel(); - } - } - - protected void updateMappingFile() { - JpaXmlResource newXmlResource = this.resolveMappingFileXmlResource(); - if (newXmlResource == null) { - if (this.mappingFile != null) { - this.mappingFile.dispose(); - this.setMappingFile(null); - } - } else { - if (this.mappingFile == null) { - this.setMappingFile(this.buildMappingFile(newXmlResource)); - } else { - if (this.mappingFile.getXmlResource() == newXmlResource) { - this.mappingFile.update(); - } else { - // [seems like we should never get here; since if the file's - // content type changed, the JPA project would return null... ~bjv] - // if the resource's content type has changed, we completely rebuild the mapping file - this.mappingFile.dispose(); - this.setMappingFile(this.buildMappingFile(newXmlResource)); - } - } - } - } - - /** - * The mapping file ref resource is in the persistence xml resource - * (persistence.xml). This returns the resource of - * the mapping file itself (orm.xml). - */ - protected JpaXmlResource resolveMappingFileXmlResource() { - if (this.fileName == null) { - return null; - } - JpaXmlResource xmlResource = this.getJpaProject().getMappingFileXmlResource(new Path(this.fileName)); - if (xmlResource == null) { - return null; - } - if (xmlResource.isReverting()) { - // 308254 - this can happen when orm.xml is closed without saving; - // the model is completely whacked in another thread - so wipe our model(?) - return null; - } - JptResourceType resourceType = xmlResource.getResourceType(); - if (resourceType == null) { - return null; - } - if ( ! this.getJpaPlatform().supportsResourceType(resourceType)) { - return null; - } - return xmlResource; - } - - /** - * pre-condition: 'resource' is not null - */ - protected MappingFile buildMappingFile(JpaXmlResource resource) { - return this.getJpaFactory().buildMappingFile(this, resource); - } - - - // ********** JpaStructureNode implementation ********** - - public String getId() { - return PersistenceStructureNodes.MAPPING_FILE_REF_ID; - } - - public JpaStructureNode getStructureNode(int textOffset) { - return this; - } - - public void dispose() { - if (this.mappingFile != null) { - this.mappingFile.dispose(); - } - } - - - // ********** misc ********** - - public boolean persistenceUnitMetadataExists() { - MappingFilePersistenceUnitMetadata metadata = this.getPersistenceUnitMetadata(); - return (metadata != null) && metadata.resourceExists(); - } - - public MappingFilePersistenceUnitMetadata getPersistenceUnitMetadata() { - MappingFileRoot root = this.getChildMappingFileRoot(); - return (root == null) ? null : root.getPersistenceUnitMetadata(); - } - - /** - * The method {@link #getMappingFileRoot()} is already defined by - * {@link org.eclipse.jpt.jpa.core.internal.context.AbstractJpaContextNode} - * for getting what would be the "mapping file root" that contains - * the context node. We want something slightly different here: i.e. the - * "mapping file root" contained by the mapping file ref (since, actually, - * the mapping file ref is not even contained by a "mapping file root"). - */ - protected MappingFileRoot getChildMappingFileRoot() { - return (this.mappingFile == null) ? null : this.mappingFile.getRoot(); - } - - public PersistentType getPersistentType(String typeName) { - return (this.mappingFile == null) ? null : this.mappingFile.getPersistentType(typeName); - } - - @Override - public PersistenceUnit getParent() { - return (PersistenceUnit) super.getParent(); - } - - @Override - public void toString(StringBuilder sb) { - super.toString(sb); - sb.append(this.fileName); - } - - public Iterable getPersistentTypes() { - return (this.mappingFile != null) ? this.mappingFile.getPersistentTypes() : EmptyIterable.instance(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - - if (StringTools.stringIsEmpty(this.fileName)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENCE_UNIT_UNSPECIFIED_MAPPING_FILE, - this, - this.getValidationTextRange() - ) - ); - return; - } - - if (this.mappingFile == null) { - messages.add(this.buildMappingFileValidationMessage()); - return; - } - - this.mappingFile.validate(messages, reporter); - } - - protected IMessage buildMappingFileValidationMessage() { - int severity = IMessage.HIGH_SEVERITY; - IFile file = this.getPlatformFile(); - if ( ! file.exists()) { - return DefaultJpaValidationMessages.buildMessage( - severity, - JpaValidationMessages.PERSISTENCE_UNIT_NONEXISTENT_MAPPING_FILE, - new String[] {this.fileName}, - this, - this.getValidationTextRange() - ); - } - String msgText = this.mappingFileContentIsUnsupported() ? - JpaValidationMessages.PERSISTENCE_UNIT_UNSUPPORTED_MAPPING_FILE_CONTENT : - JpaValidationMessages.PERSISTENCE_UNIT_INVALID_MAPPING_FILE; - return DefaultJpaValidationMessages.buildMessage( - severity, - msgText, - new String[] {file.getName()}, - file - ); - } - - protected IFile getPlatformFile() { - return this.getJpaProject().getPlatformFile(new Path(this.fileName)); - } - - /** - * pre-condition: {@link #getPlatformFile()} exists - */ - protected boolean mappingFileContentIsUnsupported() { - JpaXmlResource xmlResource = this.getJpaProject().getMappingFileXmlResource(new Path(this.fileName)); - return (xmlResource != null) && ! this.getJpaPlatform().supportsResourceType(xmlResource.getResourceType()); - } - - - // ********** refactoring ********** - - public Iterable createDeleteTypeEdits(IType type) { - return (this.mappingFile != null) ? - this.mappingFile.createDeleteTypeEdits(type) : - EmptyIterable.instance(); - } - - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return (this.mappingFile != null) ? - this.mappingFile.createRenameTypeEdits(originalType, newName) : - EmptyIterable.instance(); - } - - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return (this.mappingFile != null) ? - this.mappingFile.createMoveTypeEdits(originalType, newPackage) : - EmptyIterable.instance(); - } - - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return (this.mappingFile != null) ? - this.mappingFile.createRenamePackageEdits(originalPackage, newName) : - EmptyIterable.instance(); - } - - public Iterable createRenameMappingFileEdits(IFile originalFile, String newName) { - return this.isFor(originalFile) ? - new SingleElementIterable(this.createRenameEdit(originalFile, newName)) : - EmptyIterable.instance(); - } - - protected abstract ReplaceEdit createRenameEdit(IFile originalFile, String newName); - - public Iterable createMoveMappingFileEdits(IFile originalFile, IPath runtineDestination) { - return this.isFor(originalFile) ? - new SingleElementIterable(this.createMoveEdit(originalFile, runtineDestination)) : - EmptyIterable.instance(); - } - - protected abstract ReplaceEdit createMoveEdit(IFile originalFile, IPath runtineDestination); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java deleted file mode 100644 index cfe13da52d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnit.java +++ /dev/null @@ -1,2404 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.persistence; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.Collections; -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Set; -import java.util.Vector; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jpt.common.core.utility.BodySourceWriter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.NotNullFilter; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.common.utility.internal.iterators.CloneIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.Embeddable; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.Generator; -import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitDefaults; -import org.eclipse.jpt.jpa.core.context.MappingFilePersistenceUnitMetadata; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.Query; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.persistence.ClassRef; -import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceStructureNodes; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitTransactionType; -import org.eclipse.jpt.jpa.core.context.persistence.PersistentTypeContainer; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0; -import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.MappingFilePersistenceUnitDefaults2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType; -import org.eclipse.jpt.jpa.core.jpa2.context.PersistentType2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.SharedCacheMode; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.ValidationMode; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JavaResourcePersistentType2_0; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperties; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * persistence.xml file - *
- * persistence-unit element - */ -public abstract class AbstractPersistenceUnit - extends AbstractPersistenceXmlContextNode - implements PersistenceUnit2_0 -{ - protected final XmlPersistenceUnit xmlPersistenceUnit; - - protected String name; - - protected Boolean specifiedExcludeUnlistedClasses; - - protected PersistenceUnitTransactionType specifiedTransactionType; - protected PersistenceUnitTransactionType defaultTransactionType; - - protected String description; - - protected String provider; - - protected String jtaDataSource; - protected String nonJtaDataSource; - - protected final Vector specifiedMappingFileRefs = new Vector(); - protected final SpecifiedMappingFileRefContainerAdapter specifiedMappingFileRefContainerAdapter = new SpecifiedMappingFileRefContainerAdapter(); - protected MappingFileRef impliedMappingFileRef; - - protected final Vector jarFileRefs = new Vector(); - protected final JarFileRefContainerAdapter jarFileRefContainerAdapter = new JarFileRefContainerAdapter(); - - protected final Vector specifiedClassRefs = new Vector(); - protected final SpecifiedClassRefContainerAdapter specifiedClassRefContainerAdapter = new SpecifiedClassRefContainerAdapter(); - - protected final Set impliedClassRefs = Collections.synchronizedSet(new HashSet()); - protected final ImpliedClassRefContainerAdapter impliedClassRefContainerAdapter = new ImpliedClassRefContainerAdapter(); - - protected final Vector properties = new Vector(); - protected final PropertyContainerAdapter propertyContainerAdapter = new PropertyContainerAdapter(); - - /* global generator definitions, defined elsewhere in model */ - protected final Vector generators = new Vector(); - - /* global query definitions, defined elsewhere in model */ - protected final Vector queries = new Vector(); - - protected boolean xmlMappingMetadataComplete; - protected AccessType defaultAccess; - protected String defaultCatalog; - protected String defaultSchema; - protected boolean defaultCascadePersist; - protected boolean defaultDelimitedIdentifiers; - - //****** JPA 2.0 features - protected PersistenceUnitProperties connection; - protected PersistenceUnitProperties options; - - protected SharedCacheMode specifiedSharedCacheMode; - protected SharedCacheMode defaultSharedCacheMode; - - protected ValidationMode specifiedValidationMode; - protected ValidationMode defaultValidationMode; - - protected final Set metamodelFiles = Collections.synchronizedSet(new HashSet()); - - - // ********** construction/initialization ********** - - /** - * NB: Be careful changing the order of the statements in this method - * (bug 258701 is one reason). - */ - protected AbstractPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) { - super(parent); - this.xmlPersistenceUnit = xmlPersistenceUnit; - this.name = xmlPersistenceUnit.getName(); - this.specifiedExcludeUnlistedClasses = xmlPersistenceUnit.getExcludeUnlistedClasses(); - this.specifiedTransactionType = this.buildSpecifiedTransactionType(); - this.description = xmlPersistenceUnit.getDescription(); - this.provider = xmlPersistenceUnit.getProvider(); - this.jtaDataSource = xmlPersistenceUnit.getJtaDataSource(); - this.nonJtaDataSource = xmlPersistenceUnit.getNonJtaDataSource(); - - // initialize the properties early because other things will need them...(?) - this.initializeProperties(); - - this.initializeSpecifiedMappingFileRefs(); - this.initializeJarFileRefs(); - this.initializeSpecifiedClassRefs(); - - this.specifiedSharedCacheMode = this.buildSpecifiedSharedCacheMode(); - this.specifiedValidationMode = this.buildSpecifiedValidationMode(); - - this.initializeMetamodelFiles(); - } - - /** - * These lists are just copies of what is distributed across the context - * model; so, if they have (virtually) changed, the resulting update has - * already been triggered. We don't need to trigger another one here. - */ - @Override - protected void addNonUpdateAspectNamesTo(Set nonUpdateAspectNames) { - super.addNonUpdateAspectNamesTo(nonUpdateAspectNames); - nonUpdateAspectNames.add(GENERATORS_COLLECTION); - nonUpdateAspectNames.add(QUERIES_COLLECTION); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - - this.setName_(this.xmlPersistenceUnit.getName()); - this.setSpecifiedExcludeUnlistedClasses_(this.xmlPersistenceUnit.getExcludeUnlistedClasses()); - this.setSpecifiedTransactionType_(this.buildSpecifiedTransactionType()); - this.setDescription_(this.xmlPersistenceUnit.getDescription()); - this.setProvider_(this.xmlPersistenceUnit.getProvider()); - this.setJtaDataSource_(this.xmlPersistenceUnit.getJtaDataSource()); - this.setNonJtaDataSource_(this.xmlPersistenceUnit.getNonJtaDataSource()); - - this.syncSpecifiedMappingFileRefs(); - this.syncImpliedMappingFileRef(); - - this.syncJarFileRefs(); - - this.syncSpecifiedClassRefs(); - this.synchronizeNodesWithResourceModel(this.getImpliedClassRefs()); - - this.syncProperties(); - - this.setSpecifiedSharedCacheMode_(this.buildSpecifiedSharedCacheMode()); - this.setSpecifiedValidationMode_(this.buildSpecifiedValidationMode()); - } - - // TODO bjv calculate generators and queries directly... - /** - * The 'generators' and 'queries' collections are simply cleared out with - * each "update" and completely rebuilt as the "update" cascades through - * the persistence unit. When the persistence unit's "update" is - * complete, the collections have been populated and we fire change events. - *

- * Note: Clearing and rebuilding 'generators' and 'queries' should work OK - * since JPA project "synchronization" is single-threaded. - * (Either the it takes place synchronously on a single thread or - * asynchronously in jobs that are synchronized via scheduling rules.) - *

- * See calls to the following:

    - *
  • {@link #addGenerator(Generator)} - *
  • {@link #addQuery(Query)} - *
- * [see bug 311093 before attempting to change how this works] - */ - @Override - public void update() { - super.update(); - - // see method comment above - this.generators.clear(); - this.queries.clear(); - - this.setDefaultTransactionType(this.buildDefaultTransactionType()); - - // update specified class refs before mapping file refs because of - // JpaFile root structure nodes - we want the mapping file to "win", - // as it would in a JPA runtime implementation - this.updateNodes(this.getSpecifiedClassRefs()); - - this.updateNodes(this.getSpecifiedMappingFileRefs()); - this.updateImpliedMappingFileRef(); - - this.updateNodes(this.getJarFileRefs()); - - // update the implied class refs after all the other types, both - // specified here and specified in the mapping files, are in place - this.updateImpliedClassRefs(); - - this.updateNodes(this.getProperties()); - - this.updatePersistenceUnitMetadata(); - - this.setDefaultSharedCacheMode(this.buildDefaultSharedCacheMode()); - this.setDefaultValidationMode(this.buildDefaultValidationMode()); - - // see method comment above - this.fireCollectionChanged(GENERATORS_COLLECTION, this.generators); - this.fireCollectionChanged(QUERIES_COLLECTION, this.queries); - } - - - // ********** JpaContextNode implementation ********** - - @Override - public Persistence getParent() { - return (Persistence) super.getParent(); - } - - @Override - public PersistenceUnit getPersistenceUnit() { - return this; - } - - - // ********** JpaStructureNode implementation ********** - - public String getId() { - return PersistenceStructureNodes.PERSISTENCE_UNIT_ID; - } - - public TextRange getSelectionTextRange() { - return this.xmlPersistenceUnit.getSelectionTextRange(); - } - - public void dispose() { - for (ClassRef classRef : this.getClassRefs()) { - classRef.dispose(); - } - for (JarFileRef jarFileRef : this.getJarFileRefs()) { - jarFileRef.dispose(); - } - for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { - mappingFileRef.dispose(); - } - } - - - // ********** name ********** - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.setName_(name); - this.xmlPersistenceUnit.setName(name); - } - - protected void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - - // ********** transaction type ********** - - public PersistenceUnitTransactionType getTransactionType() { - return (this.specifiedTransactionType != null) ? this.specifiedTransactionType : this.defaultTransactionType; - } - - public PersistenceUnitTransactionType getSpecifiedTransactionType() { - return this.specifiedTransactionType; - } - - public void setSpecifiedTransactionType(PersistenceUnitTransactionType transactionType) { - this.setSpecifiedTransactionType_(transactionType); - this.xmlPersistenceUnit.setTransactionType(PersistenceUnitTransactionType.toXmlResourceModel(transactionType)); - } - - protected void setSpecifiedTransactionType_(PersistenceUnitTransactionType transactionType) { - PersistenceUnitTransactionType old = this.specifiedTransactionType; - this.specifiedTransactionType = transactionType; - this.firePropertyChanged(SPECIFIED_TRANSACTION_TYPE_PROPERTY, old, transactionType); - } - - public PersistenceUnitTransactionType getDefaultTransactionType() { - return this.defaultTransactionType; - } - - protected void setDefaultTransactionType(PersistenceUnitTransactionType transactionType) { - PersistenceUnitTransactionType old = this.defaultTransactionType; - this.defaultTransactionType = transactionType; - this.firePropertyChanged(DEFAULT_TRANSACTION_TYPE_PROPERTY, old, transactionType); - } - - protected PersistenceUnitTransactionType buildSpecifiedTransactionType() { - return PersistenceUnitTransactionType.fromXmlResourceModel(this.xmlPersistenceUnit.getTransactionType()); - } - - /** - * TODO - calculate default - * From the JPA spec: "In a Java EE environment, if this element is not - * specified, the default is JTA. In a Java SE environment, if this element - * is not specified, a default of RESOURCE_LOCAL may be assumed." - */ - protected PersistenceUnitTransactionType buildDefaultTransactionType() { - return PersistenceUnitTransactionType.JTA; //return JTA for now, fixing regression in bug 277524 - } - - - // ********** description ********** - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - this.setDescription_(description); - this.xmlPersistenceUnit.setDescription(description); - } - - protected void setDescription_(String description) { - String old = this.description; - this.description = description; - this.firePropertyChanged(DESCRIPTION_PROPERTY, old, description); - } - - - // ********** provider ********** - - public String getProvider() { - return this.provider; - } - - public void setProvider(String provider) { - this.setProvider_(provider); - this.xmlPersistenceUnit.setProvider(provider); - } - - protected void setProvider_(String provider) { - String old = this.provider; - this.provider = provider; - this.firePropertyChanged(PROVIDER_PROPERTY, old, provider); - } - - - // ********** JTA data source ********** - - public String getJtaDataSource() { - return this.jtaDataSource; - } - - public void setJtaDataSource(String jtaDataSource) { - this.setJtaDataSource_(jtaDataSource); - this.xmlPersistenceUnit.setJtaDataSource(jtaDataSource); - } - - protected void setJtaDataSource_(String jtaDataSource) { - String old = this.jtaDataSource; - this.jtaDataSource = jtaDataSource; - this.firePropertyChanged(JTA_DATA_SOURCE_PROPERTY, old, jtaDataSource); - } - - - // ********** non-JTA data source ********** - - public String getNonJtaDataSource() { - return this.nonJtaDataSource; - } - - public void setNonJtaDataSource(String nonJtaDataSource) { - this.setNonJtaDataSource_(nonJtaDataSource); - this.xmlPersistenceUnit.setNonJtaDataSource(nonJtaDataSource); - } - - protected void setNonJtaDataSource_(String nonJtaDataSource) { - String old = this.nonJtaDataSource; - this.nonJtaDataSource = nonJtaDataSource; - this.firePropertyChanged(NON_JTA_DATA_SOURCE_PROPERTY, old, nonJtaDataSource); - } - - - // ********** mapping file refs ********** - - public ListIterator mappingFileRefs() { - return this.getMappingFileRefs().iterator(); - } - - protected Iterator mappingFileRefNames() { - return new TransformationIterator(this.mappingFileRefs()) { - @Override - protected String transform(MappingFileRef mappingFileRef) { - return mappingFileRef.getFileName(); - } - }; - } - - protected ListIterable getMappingFileRefs() { - return (this.impliedMappingFileRef == null) ? - this.getSpecifiedMappingFileRefs() : - this.getCombinedMappingFileRefs(); - } - - protected ListIterator combinedMappingFileRefs() { - return this.getCombinedMappingFileRefs().iterator(); - } - - protected ListIterable getCombinedMappingFileRefs() { - return new CompositeListIterable( - this.getSpecifiedMappingFileRefs(), - this.impliedMappingFileRef - ); - } - - public int mappingFileRefsSize() { - return (this.impliedMappingFileRef == null) ? - this.specifiedMappingFileRefsSize() : - this.combinedMappingFileRefsSize(); - } - - protected int combinedMappingFileRefsSize() { - return this.specifiedMappingFileRefsSize() + 1; - } - - public Iterator mappingFileRefsContaining(final String typeName) { - return new FilteringIterator (this.mappingFileRefs()) { - @Override - protected boolean accept(MappingFileRef mappingFileRef) { - return mappingFileRef.getPersistentType(typeName) != null; - } - }; - } - - - // ********** specified mapping file refs ********** - - public ListIterator specifiedMappingFileRefs() { - return this.getSpecifiedMappingFileRefs().iterator(); - } - - protected ListIterable getSpecifiedMappingFileRefs() { - return new LiveCloneListIterable(this.specifiedMappingFileRefs); - } - - public int specifiedMappingFileRefsSize() { - return this.specifiedMappingFileRefs.size(); - } - - public MappingFileRef addSpecifiedMappingFileRef(String fileName) { - return this.addSpecifiedMappingFileRef(this.specifiedMappingFileRefs.size(), fileName); - } - - public MappingFileRef addSpecifiedMappingFileRef(int index, String fileName) { - XmlMappingFileRef xmlMappingFileRef = this.buildXmlMappingFileRef(fileName); - MappingFileRef mappingFileRef = this.addSpecifiedMappingFileRef_(index, xmlMappingFileRef); - this.xmlPersistenceUnit.getMappingFiles().add(index, xmlMappingFileRef); - return mappingFileRef; - } - - protected XmlMappingFileRef buildXmlMappingFileRef(String fileName) { - XmlMappingFileRef ref = PersistenceFactory.eINSTANCE.createXmlMappingFileRef(); - ref.setFileName(fileName); - return ref; - } - - protected MappingFileRef buildSpecifiedMappingFileRef(XmlMappingFileRef xmlMappingFileRef) { - return this.getContextNodeFactory().buildMappingFileRef(this, xmlMappingFileRef); - } - - public void removeSpecifiedMappingFileRef(MappingFileRef mappingFileRef) { - this.removeSpecifiedMappingFileRef(this.specifiedMappingFileRefs.indexOf(mappingFileRef)); - } - - public void removeSpecifiedMappingFileRef(int index) { - this.removeSpecifiedMappingFileRef_(index); - this.xmlPersistenceUnit.getMappingFiles().remove(index); - } - - /** - * dispose the mapping file ref - */ - protected void removeSpecifiedMappingFileRef_(int index) { - this.removeItemFromList(index, this.specifiedMappingFileRefs, SPECIFIED_MAPPING_FILE_REFS_LIST).dispose(); - } - - protected void initializeSpecifiedMappingFileRefs() { - for (XmlMappingFileRef xmlMappingFileRef : this.getXmlMappingFileRefs()) { - this.specifiedMappingFileRefs.add(this.buildSpecifiedMappingFileRef(xmlMappingFileRef)); - } - } - - protected void syncSpecifiedMappingFileRefs() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedMappingFileRefContainerAdapter); - } - - protected Iterable getXmlMappingFileRefs() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.xmlPersistenceUnit.getMappingFiles()); - } - - protected void moveSpecifiedMappingFileRef_(int index, MappingFileRef mappingFileRef) { - this.moveItemInList(index, mappingFileRef, this.specifiedMappingFileRefs, SPECIFIED_MAPPING_FILE_REFS_LIST); - } - - protected MappingFileRef addSpecifiedMappingFileRef_(int index, XmlMappingFileRef xmlMappingFileRef) { - MappingFileRef mappingFileRef = this.buildSpecifiedMappingFileRef(xmlMappingFileRef); - this.addItemToList(index, mappingFileRef, this.specifiedMappingFileRefs, SPECIFIED_MAPPING_FILE_REFS_LIST); - return mappingFileRef; - } - - protected void removeSpecifiedMappingFileRef_(MappingFileRef mappingFileRef) { - this.removeSpecifiedMappingFileRef_(this.specifiedMappingFileRefs.indexOf(mappingFileRef)); - } - - /** - * specified mapping file ref container adapter - */ - protected class SpecifiedMappingFileRefContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractPersistenceUnit.this.getSpecifiedMappingFileRefs(); - } - public Iterable getResourceElements() { - return AbstractPersistenceUnit.this.getXmlMappingFileRefs(); - } - public XmlMappingFileRef getResourceElement(MappingFileRef contextElement) { - return contextElement.getXmlMappingFileRef(); - } - public void moveContextElement(int index, MappingFileRef element) { - AbstractPersistenceUnit.this.moveSpecifiedMappingFileRef_(index, element); - } - public void addContextElement(int index, XmlMappingFileRef resourceElement) { - AbstractPersistenceUnit.this.addSpecifiedMappingFileRef_(index, resourceElement); - } - public void removeContextElement(MappingFileRef element) { - AbstractPersistenceUnit.this.removeSpecifiedMappingFileRef_(element); - } - } - - - // ********** implied mapping file ref ********** - - public MappingFileRef getImpliedMappingFileRef() { - return this.impliedMappingFileRef; - } - - protected MappingFileRef addImpliedMappingFileRef() { - if (this.impliedMappingFileRef != null) { - throw new IllegalStateException("The implied mapping file ref is already set: " + this.impliedMappingFileRef); //$NON-NLS-1$ - } - this.impliedMappingFileRef = this.buildImpliedMappingFileRef(); - this.firePropertyChanged(IMPLIED_MAPPING_FILE_REF_PROPERTY, null, this.impliedMappingFileRef); - return this.impliedMappingFileRef; - } - - protected MappingFileRef buildImpliedMappingFileRef() { - return this.getContextNodeFactory().buildImpliedMappingFileRef(this); - } - - protected void removeImpliedMappingFileRef() { - if (this.impliedMappingFileRef == null) { - throw new IllegalStateException("The implied mapping file ref is already unset."); //$NON-NLS-1$ - } - MappingFileRef old = this.impliedMappingFileRef; - this.impliedMappingFileRef = null; - old.dispose(); - this.firePropertyChanged(IMPLIED_MAPPING_FILE_REF_PROPERTY, old, null); - } - - protected void syncImpliedMappingFileRef() { - if (this.impliedMappingFileRef != null) { - this.impliedMappingFileRef.synchronizeWithResourceModel(); - } - } - - protected void updateImpliedMappingFileRef() { - if (this.buildsImpliedMappingFile()) { - if (this.impliedMappingFileRef == null) { - this.addImpliedMappingFileRef(); - } else { - this.impliedMappingFileRef.update(); - } - } else { - if (this.impliedMappingFileRef != null) { - this.removeImpliedMappingFileRef(); - } - } - } - - protected boolean buildsImpliedMappingFile() { - return this.impliedMappingFileIsNotSpecified() && this.impliedMappingFileExists(); - } - - protected boolean impliedMappingFileIsNotSpecified() { - return ! this.impliedMappingFileIsSpecified(); - } - - protected boolean impliedMappingFileIsSpecified() { - return this.mappingFileIsSpecified(JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString()); - } - - protected boolean mappingFileIsSpecified(String impliedMappingFileName) { - for (MappingFileRef specifiedMappingFileRef : this.getSpecifiedMappingFileRefs()) { - if (Tools.valuesAreEqual(specifiedMappingFileRef.getFileName(), impliedMappingFileName)) { - return true; - } - } - return false; - } - - protected boolean impliedMappingFileExists() { - return this.getJpaProject().getDefaultOrmXmlResource() != null; - } - - - // ********** JAR file refs ********** - - public ListIterator jarFileRefs() { - return this.getJarFileRefs().iterator(); - } - - protected ListIterable getJarFileRefs() { - return new LiveCloneListIterable(this.jarFileRefs); - } - - public int jarFileRefsSize() { - return this.jarFileRefs.size(); - } - - protected Iterator jarFileNames() { - return new TransformationIterator(this.jarFileRefs()) { - @Override - protected String transform(JarFileRef jarFileRef) { - return jarFileRef.getFileName(); - } - }; - } - - public JarFileRef addJarFileRef(String fileName) { - return this.addJarFileRef(this.jarFileRefs.size(), fileName); - } - - public JarFileRef addJarFileRef(int index, String fileName) { - XmlJarFileRef xmlJarFileRef = this.buildXmlJarFileRef(fileName); - JarFileRef jarFileRef = this.addJarFileRef_(index, xmlJarFileRef); - this.xmlPersistenceUnit.getJarFiles().add(index, xmlJarFileRef); - return jarFileRef; - } - - protected XmlJarFileRef buildXmlJarFileRef(String fileName) { - XmlJarFileRef ref = PersistenceFactory.eINSTANCE.createXmlJarFileRef(); - ref.setFileName(fileName); - return ref; - } - - protected JarFileRef buildJarFileRef(XmlJarFileRef xmlJarFileRef) { - return this.getContextNodeFactory().buildJarFileRef(this, xmlJarFileRef); - } - - public void removeJarFileRef(JarFileRef jarFileRef) { - this.removeJarFileRef(this.jarFileRefs.indexOf(jarFileRef)); - } - - public void removeJarFileRef(int index) { - this.removeJarFileRef_(index); - this.xmlPersistenceUnit.getJarFiles().remove(index); - } - - /** - * dispose the JAR file ref - */ - protected void removeJarFileRef_(int index) { - this.removeItemFromList(index, this.jarFileRefs, JAR_FILE_REFS_LIST).dispose(); - } - - protected void initializeJarFileRefs() { - for (XmlJarFileRef xmlJarFileRef : this.getXmlJarFileRefs()) { - this.jarFileRefs.add(this.buildJarFileRef(xmlJarFileRef)); - } - } - - protected void syncJarFileRefs() { - ContextContainerTools.synchronizeWithResourceModel(this.jarFileRefContainerAdapter); - } - - protected Iterable getXmlJarFileRefs() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.xmlPersistenceUnit.getJarFiles()); - } - - protected void moveJarFileRef_(int index, JarFileRef jarFileRef) { - this.moveItemInList(index, jarFileRef, this.jarFileRefs, JAR_FILE_REFS_LIST); - } - - protected JarFileRef addJarFileRef_(int index, XmlJarFileRef xmlJarFileRef) { - JarFileRef jarFileRef = this.buildJarFileRef(xmlJarFileRef); - this.addItemToList(index, jarFileRef, this.jarFileRefs, JAR_FILE_REFS_LIST); - return jarFileRef; - } - - protected void removeJarFileRef_(JarFileRef jarFileRef) { - this.removeJarFileRef_(this.jarFileRefs.indexOf(jarFileRef)); - } - - /** - * JAR file ref container adapter - */ - protected class JarFileRefContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractPersistenceUnit.this.getJarFileRefs(); - } - public Iterable getResourceElements() { - return AbstractPersistenceUnit.this.getXmlJarFileRefs(); - } - public XmlJarFileRef getResourceElement(JarFileRef contextElement) { - return contextElement.getXmlJarFileRef(); - } - public void moveContextElement(int index, JarFileRef element) { - AbstractPersistenceUnit.this.moveJarFileRef_(index, element); - } - public void addContextElement(int index, XmlJarFileRef resourceElement) { - AbstractPersistenceUnit.this.addJarFileRef_(index, resourceElement); - } - public void removeContextElement(JarFileRef element) { - AbstractPersistenceUnit.this.removeJarFileRef_(element); - } - } - - - // ********** class refs ********** - - public Iterator classRefs() { - return this.getClassRefs().iterator(); - } - - @SuppressWarnings("unchecked") - protected Iterable getClassRefs() { - return new CompositeIterable( - this.getSpecifiedClassRefs(), - this.getImpliedClassRefs() - ); - } - - public int classRefsSize() { - return this.specifiedClassRefs.size() + this.impliedClassRefs.size(); - } - - protected Iterator classRefNames() { - return new TransformationIterator(this.classRefs()) { - @Override - protected String transform(ClassRef classRef) { - return classRef.getClassName(); - } - }; - } - - - // ********** specified class refs ********** - - public ListIterator specifiedClassRefs() { - return this.getSpecifiedClassRefs().iterator(); - } - - protected ListIterable getSpecifiedClassRefs() { - return new LiveCloneListIterable(this.specifiedClassRefs); - } - - public int specifiedClassRefsSize() { - return this.specifiedClassRefs.size(); - } - - public ClassRef addSpecifiedClassRef(String className) { - return this.addSpecifiedClassRef(this.specifiedClassRefs.size(), className); - } - - public ClassRef addSpecifiedClassRef(int index, String className) { - XmlJavaClassRef xmlClassRef = this.buildXmlJavaClassRef(className); - ClassRef classRef = this.addSpecifiedClassRef_(index, xmlClassRef); - this.xmlPersistenceUnit.getClasses().add(index, xmlClassRef); - return classRef; - } - - protected XmlJavaClassRef buildXmlJavaClassRef(String className) { - XmlJavaClassRef ref = PersistenceFactory.eINSTANCE.createXmlJavaClassRef(); - ref.setJavaClass(className); - return ref; - } - - protected ClassRef buildClassRef(XmlJavaClassRef xmlClassRef) { - return this.getContextNodeFactory().buildClassRef(this, xmlClassRef); - } - - public void removeSpecifiedClassRef(ClassRef classRef) { - this.removeSpecifiedClassRef(this.specifiedClassRefs.indexOf(classRef)); - } - - public void removeSpecifiedClassRef(int index) { - this.removeSpecifiedClassRef_(index); - this.xmlPersistenceUnit.getClasses().remove(index); - } - - /** - * dispose the class ref - */ - protected void removeSpecifiedClassRef_(int index) { - this.removeItemFromList(index, this.specifiedClassRefs, SPECIFIED_CLASS_REFS_LIST).dispose(); - } - - protected void initializeSpecifiedClassRefs() { - for (XmlJavaClassRef xmlJavaClassRef : this.getXmlClassRefs()) { - this.specifiedClassRefs.add(this.buildClassRef(xmlJavaClassRef)); - } - } - - protected void syncSpecifiedClassRefs() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedClassRefContainerAdapter); - } - - protected Iterable getXmlClassRefs() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.xmlPersistenceUnit.getClasses()); - } - - protected void moveSpecifiedClassRef_(int index, ClassRef classRef) { - this.moveItemInList(index, classRef, this.specifiedClassRefs, SPECIFIED_CLASS_REFS_LIST); - } - - protected ClassRef addSpecifiedClassRef_(int index, XmlJavaClassRef xmlClassRef) { - ClassRef classRef = this.buildClassRef(xmlClassRef); - this.addItemToList(index, classRef, this.specifiedClassRefs, SPECIFIED_CLASS_REFS_LIST); - return classRef; - } - - protected void removeSpecifiedClassRef_(ClassRef classRef) { - this.removeSpecifiedClassRef_(this.specifiedClassRefs.indexOf(classRef)); - } - - /** - * specified class ref container adapter - */ - protected class SpecifiedClassRefContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractPersistenceUnit.this.getSpecifiedClassRefs(); - } - public Iterable getResourceElements() { - return AbstractPersistenceUnit.this.getXmlClassRefs(); - } - public XmlJavaClassRef getResourceElement(ClassRef contextElement) { - return contextElement.getXmlClassRef(); - } - public void moveContextElement(int index, ClassRef element) { - AbstractPersistenceUnit.this.moveSpecifiedClassRef_(index, element); - } - public void addContextElement(int index, XmlJavaClassRef resourceElement) { - AbstractPersistenceUnit.this.addSpecifiedClassRef_(index, resourceElement); - } - public void removeContextElement(ClassRef element) { - AbstractPersistenceUnit.this.removeSpecifiedClassRef_(element); - } - } - - - // ********** virtual class refs ********** - - public Iterator impliedClassRefs() { - return this.getImpliedClassRefs().iterator(); - } - - protected Iterable getImpliedClassRefs() { - return new LiveCloneIterable(this.impliedClassRefs); - } - - public int impliedClassRefsSize() { - return this.impliedClassRefs.size(); - } - - protected ClassRef addImpliedClassRef(String className) { - ClassRef classRef = this.buildClassRef(className); - this.addItemToCollection(classRef, this.impliedClassRefs, IMPLIED_CLASS_REFS_COLLECTION); - return classRef; - } - - protected ClassRef buildClassRef(String className) { - return this.getContextNodeFactory().buildClassRef(this, className); - } - - protected void removeImpliedClassRef(ClassRef classRef) { - this.impliedClassRefs.remove(classRef); - classRef.dispose(); - this.fireItemRemoved(IMPLIED_CLASS_REFS_COLLECTION, classRef); - } - - protected void updateImpliedClassRefs() { - ContextContainerTools.update(this.impliedClassRefContainerAdapter); - } - - protected Iterable getImpliedClassNames() { - return this.excludesUnlistedClasses() ? - EmptyIterable.instance() : - this.getImpliedClassNames_(); - } - - /** - * Return the names of all the Java classes in the JPA project that are - * mapped (i.e. have the appropriate annotation etc.) but not specified - * in the persistence unit. - */ - protected Iterable getImpliedClassNames_() { - return new FilteringIterable(this.getJpaProject().getMappedJavaSourceClassNames()) { - @Override - protected boolean accept(String mappedClassName) { - return ! AbstractPersistenceUnit.this.specifiesPersistentType(mappedClassName); - } - }; - } - - /** - * Virtual class ref container adapter. - *

- * NB: The context class ref is matched with a resource - * class by name. - *

- * This is used during both sync and - * update because the list of implied class refs can be modified - * in either situation. In particular, we cannot simply rely on - * update because there are situations where a sync is - * triggered but a follow-up update is not. (Of course, any - * change discovered here will trigger an update.) - *

- * The most obvious example is when the JPA project is configured to - * discover annotated classes and a Java class is annotated for the first - * time (via code editing, not via the context model). This will trigger - * a sync; but, since the unannotated class is not yet in the - * context model and, as a result, the context model's state is untouched, - * an update will not be triggered. - *

- * Obviously, other context model changes can change this collection (e.g. - * setting whether the persistence unit excludes unlisted classes); o the - * collection must also be synchronized during update. - */ - protected class ImpliedClassRefContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractPersistenceUnit.this.getImpliedClassRefs(); - } - public Iterable getResourceElements() { - return AbstractPersistenceUnit.this.getImpliedClassNames(); - } - public String getResourceElement(ClassRef contextElement) { - return contextElement.getClassName(); - } - public void moveContextElement(int index, ClassRef element) { - // ignore moves - we don't care about the order of the implied class refs - } - public void addContextElement(int index, String resourceElement) { - // ignore the index - we don't care about the order of the implied class refs - AbstractPersistenceUnit.this.addImpliedClassRef(resourceElement); - } - public void removeContextElement(ClassRef element) { - AbstractPersistenceUnit.this.removeImpliedClassRef(element); - } - } - - - // ********** exclude unlisted classes ********** - - public boolean excludesUnlistedClasses() { - return (this.specifiedExcludeUnlistedClasses != null) ? this.specifiedExcludeUnlistedClasses.booleanValue() : this.getDefaultExcludeUnlistedClasses(); - } - - public Boolean getSpecifiedExcludeUnlistedClasses() { - return this.specifiedExcludeUnlistedClasses; - } - - public void setSpecifiedExcludeUnlistedClasses(Boolean specifiedExcludeUnlistedClasses) { - this.setSpecifiedExcludeUnlistedClasses_(specifiedExcludeUnlistedClasses); - this.xmlPersistenceUnit.setExcludeUnlistedClasses(this.specifiedExcludeUnlistedClasses); - } - - protected void setSpecifiedExcludeUnlistedClasses_(Boolean excludeUnlistedClasses) { - Boolean old = this.specifiedExcludeUnlistedClasses; - this.specifiedExcludeUnlistedClasses = excludeUnlistedClasses; - this.firePropertyChanged(SPECIFIED_EXCLUDE_UNLISTED_CLASSES_PROPERTY, old, excludeUnlistedClasses); - } - - public boolean getDefaultExcludeUnlistedClasses() { - return false; // ??? - } - - - // ********** properties ********** - - public ListIterator properties() { - return this.getProperties().iterator(); - } - - protected ListIterable getProperties() { - return new LiveCloneListIterable(this.properties); - } - - public int propertiesSize() { - return this.properties.size(); - } - - public Property getProperty(String propertyName) { - if (propertyName == null) { - throw new NullPointerException(); - } - for (Property property : this.getProperties()) { - if (propertyName.equals(property.getName())) { - return property; - } - } - return null; - } - - public Iterable getPropertiesNamed(final String propertyName) { - if (propertyName == null) { - throw new NullPointerException(); - } - return new FilteringIterable(this.getProperties()) { - @Override - protected boolean accept(Property property) { - return Tools.valuesAreEqual(property.getName(), propertyName); - } - }; - } - - public Iterator propertiesWithNamePrefix(final String propertyNamePrefix) { - if (propertyNamePrefix == null) { - throw new NullPointerException(); - } - return new FilteringIterator(this.properties()) { - @Override - protected boolean accept(Property property) { - String pName = property.getName(); - return (pName != null) && pName.startsWith(propertyNamePrefix); - } - }; - } - - public Property addProperty() { - return this.addProperty(this.properties.size()); - } - - public Property addProperty(int index) { - XmlProperty xmlProperty = this.buildXmlProperty(); - Property property = this.addProperty_(index, xmlProperty); - - XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties(); - if (xmlProperties == null) { - xmlProperties = this.buildXmlProperties(); - this.xmlPersistenceUnit.setProperties(xmlProperties); - } - - xmlProperties.getProperties().add(index, xmlProperty); - if (property.getName() != null) { - this.propertyAdded(property.getName(), property.getValue()); - } - return property; - } - - protected XmlProperty buildXmlProperty() { - return PersistenceFactory.eINSTANCE.createXmlProperty(); - } - - protected Property buildProperty(XmlProperty xmlProperty) { - return this.getContextNodeFactory().buildProperty(this, xmlProperty); - } - - protected XmlProperties buildXmlProperties() { - return PersistenceFactory.eINSTANCE.createXmlProperties(); - } - - public void setProperty(String propertyName, String value) { - this.setProperty(propertyName, value, false); - } - - public void setProperty(String propertyName, String value, boolean duplicatePropertyNamesAllowed) { - Property prev = this.getProperty(propertyName); - if (prev == null) { - if (value != null) { - this.addProperty(propertyName, value); // add [first] property - } - } else { - if (duplicatePropertyNamesAllowed) { - if (value == null) { - // do nothing? - } else { - this.addProperty(propertyName, value); // add [duplicate] property - } - } else { - if (value == null) { - this.removeProperty(prev); // remove existing property - } else { - prev.setValue(value); // change existing property - } - } - } - } - - protected void addProperty(String propertyName, String value) { - Property property = this.addProperty(); - property.setName(propertyName); - property.setValue(value); - } - - public void removeProperty(Property property) { - this.removeProperty(this.properties.indexOf(property)); - } - - public void removeProperty(String propertyName) { - if (propertyName == null) { - throw new NullPointerException(); - } - for (ListIterator stream = this.properties.listIterator(); stream.hasNext(); ) { - Property property = stream.next(); - if (propertyName.equals(property.getName())) { - this.removeProperty(stream.previousIndex()); - return; - } - } - throw new IllegalArgumentException("invalid property name: " + propertyName); //$NON-NLS-1$ - } - - public void removeProperty(String propertyName, String value) { - if ((propertyName == null) || (value == null)) { - throw new NullPointerException(); - } - for (ListIterator stream = this.properties.listIterator(); stream.hasNext(); ) { - Property property = stream.next(); - if (propertyName.equals(property.getName()) && value.equals(property.getValue())) { - this.removeProperty(stream.previousIndex()); - return; - } - } - throw new IllegalArgumentException("invalid property name/value pair: " + propertyName + " = " + value); //$NON-NLS-1$ //$NON-NLS-2$ - } - - protected void removeProperty(int index) { - Property removedProperty = this.properties.remove(index); - this.xmlPersistenceUnit.getProperties().getProperties().remove(index); - - if (this.xmlPersistenceUnit.getProperties().getProperties().isEmpty()) { - this.xmlPersistenceUnit.setProperties(null); - } - - this.fireItemRemoved(PROPERTIES_LIST, index, removedProperty); - if (removedProperty.getName() != null) { - this.propertyRemoved(removedProperty.getName()); - } - } - - public void propertyNameChanged(String oldPropertyName, String newPropertyName, String value) { - if ((oldPropertyName == null) && (value == null)) { - //this is a property that is currently being added, we don't need to deal with it until the value is set - return; - } - if (oldPropertyName != null) { - this.propertyRemoved(oldPropertyName); - } - if (newPropertyName != null) { - this.propertyAdded(newPropertyName, value); - } - } - - public void propertyValueChanged(String propertyName, String newValue) { - this.connection.propertyValueChanged(propertyName, newValue); - this.options.propertyValueChanged(propertyName, newValue); - } - - protected void propertyAdded(String propertyName, String value) { - this.propertyValueChanged(propertyName, value); - } - - protected void propertyRemoved(String propertyName) { - this.connection.propertyRemoved(propertyName); - this.options.propertyRemoved(propertyName); - } - - protected void initializeProperties() { - for (XmlProperty xmlProperty : this.getXmlProperties()) { - this.properties.add(this.buildProperty(xmlProperty)); - } - this.connection = this.getContextNodeFactory().buildConnection(this); - this.options = this.getContextNodeFactory().buildOptions(this); - } - - protected void syncProperties() { - ContextContainerTools.synchronizeWithResourceModel(this.propertyContainerAdapter); - } - - protected Iterable getXmlProperties() { - XmlProperties xmlProperties = this.xmlPersistenceUnit.getProperties(); - // clone to reduce chance of concurrency problems - return (xmlProperties == null) ? - EmptyIterable.instance() : - new LiveCloneIterable(xmlProperties.getProperties()); - } - - protected void moveProperty_(int index, Property property) { - this.moveItemInList(index, this.properties.indexOf(property), this.properties, PROPERTIES_LIST); - } - - protected Property addProperty_(int index, XmlProperty xmlProperty) { - Property property = this.buildProperty(xmlProperty); - this.addItemToList(index, property, this.properties, PROPERTIES_LIST); - if (property.getName() != null) { - this.propertyAdded(property.getName(), property.getValue()); - } - return property; - } - - protected void removeProperty_(Property property) { - this.removeItemFromList(property, this.properties, PROPERTIES_LIST); - if (property.getName() != null) { - this.propertyRemoved(property.getName()); - } - } - - /** - * property container adapter - */ - protected class PropertyContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractPersistenceUnit.this.getProperties(); - } - public Iterable getResourceElements() { - return AbstractPersistenceUnit.this.getXmlProperties(); - } - public XmlProperty getResourceElement(Property contextElement) { - return contextElement.getXmlProperty(); - } - public void moveContextElement(int index, Property element) { - AbstractPersistenceUnit.this.moveProperty_(index, element); - } - public void addContextElement(int index, XmlProperty resourceElement) { - AbstractPersistenceUnit.this.addProperty_(index, resourceElement); - } - public void removeContextElement(Property element) { - AbstractPersistenceUnit.this.removeProperty_(element); - } - } - - - // ********** mapping file (orm.xml) persistence unit metadata & defaults ********** - - public boolean isXmlMappingMetadataComplete() { - return this.xmlMappingMetadataComplete; - } - - protected void setXmlMappingMetadataComplete(boolean xmlMappingMetadataComplete) { - boolean old = this.xmlMappingMetadataComplete; - this.xmlMappingMetadataComplete = xmlMappingMetadataComplete; - this.firePropertyChanged(XML_MAPPING_METADATA_COMPLETE_PROPERTY, old, xmlMappingMetadataComplete); - } - - protected boolean buildXmlMappingMetadataComplete(MappingFilePersistenceUnitMetadata metadata) { - return (metadata == null) ? false : metadata.isXmlMappingMetadataComplete(); - } - - public AccessType getDefaultAccess() { - return this.defaultAccess; - } - - protected void setDefaultAccess(AccessType access) { - AccessType old = this.defaultAccess; - this.defaultAccess = access; - this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, access); - } - - public String getDefaultCatalog() { - return this.defaultCatalog; - } - - protected void setDefaultCatalog(String catalog) { - String old = this.defaultCatalog; - this.defaultCatalog = catalog; - this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog); - } - - protected String buildDefaultCatalog(MappingFilePersistenceUnitDefaults defaults) { - String catalog = (defaults == null) ? null : defaults.getCatalog(); - return (catalog != null) ? catalog : this.getJpaProject().getDefaultCatalog(); - } - - public String getDefaultSchema() { - return this.defaultSchema; - } - - protected void setDefaultSchema(String schema) { - String old = this.defaultSchema; - this.defaultSchema = schema; - this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema); - } - - protected String buildDefaultSchema(MappingFilePersistenceUnitDefaults defaults) { - String schema = (defaults == null) ? null : defaults.getSchema(); - return (schema != null) ? schema : this.getJpaProject().getDefaultSchema(); - } - - public boolean getDefaultCascadePersist() { - return this.defaultCascadePersist; - } - - protected void setDefaultCascadePersist(boolean cascadePersist) { - boolean old = this.defaultCascadePersist; - this.defaultCascadePersist = cascadePersist; - this.firePropertyChanged(DEFAULT_CASCADE_PERSIST_PROPERTY, old, cascadePersist); - } - - protected boolean buildDefaultCascadePersist(MappingFilePersistenceUnitDefaults defaults) { - return (defaults == null) ? false : defaults.isCascadePersist(); - } - - public boolean getDefaultDelimitedIdentifiers() { - return this.defaultDelimitedIdentifiers; - } - - protected void setDefaultDelimitedIdentifiers(boolean delimitedIdentifiers) { - boolean old = this.defaultDelimitedIdentifiers; - this.defaultDelimitedIdentifiers = delimitedIdentifiers; - this.firePropertyChanged(DEFAULT_DELIMITED_IDENTIFIERS_PROPERTY, old, delimitedIdentifiers); - } - - protected boolean buildDefaultDelimitedIdentifiers(MappingFilePersistenceUnitDefaults defaults) { - return ( ! this.isJpa2_0Compatible()) ? false : - (defaults == null) ? false : ((MappingFilePersistenceUnitDefaults2_0) defaults).isDelimitedIdentifiers(); - } - - protected void updatePersistenceUnitMetadata() { - MappingFilePersistenceUnitMetadata metadata = this.getMetadata(); - this.setXmlMappingMetadataComplete(this.buildXmlMappingMetadataComplete(metadata)); - - MappingFilePersistenceUnitDefaults defaults = (metadata == null) ? null : metadata.getPersistenceUnitDefaults(); - this.setDefaultAccess((defaults == null) ? null : defaults.getAccess()); - this.setDefaultCatalog(this.buildDefaultCatalog(defaults)); - this.setDefaultSchema(this.buildDefaultSchema(defaults)); - this.setDefaultDelimitedIdentifiers(this.buildDefaultDelimitedIdentifiers(defaults)); - } - - /** - * return the first persistence unit metadata we encounter - * in a mapping file - */ - protected MappingFilePersistenceUnitMetadata getMetadata() { - for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { - if (mappingFileRef.persistenceUnitMetadataExists()) { - return mappingFileRef.getPersistenceUnitMetadata(); - } - } - return null; - } - - - // ********** PersistenceUnit2_0 implementation ********** - - public PersistenceUnitProperties getConnection() { - return this.connection; - } - - public PersistenceUnitProperties getOptions() { - return this.options; - } - - - // ********** shared cache mode ********** - - public SharedCacheMode getSharedCacheMode() { - return (this.specifiedSharedCacheMode != null) ? this.specifiedSharedCacheMode : this.defaultSharedCacheMode; - } - - public SharedCacheMode getSpecifiedSharedCacheMode() { - return this.specifiedSharedCacheMode; - } - - public void setSpecifiedSharedCacheMode(SharedCacheMode specifiedSharedCacheMode) { - this.setSpecifiedSharedCacheMode_(specifiedSharedCacheMode); - this.xmlPersistenceUnit.setSharedCacheMode(SharedCacheMode.toXmlResourceModel(specifiedSharedCacheMode)); - } - - protected void setSpecifiedSharedCacheMode_(SharedCacheMode sharedCacheMode) { - SharedCacheMode old = this.specifiedSharedCacheMode; - this.specifiedSharedCacheMode = sharedCacheMode; - this.firePropertyChanged(SPECIFIED_SHARED_CACHE_MODE_PROPERTY, old, sharedCacheMode); - } - - public SharedCacheMode getDefaultSharedCacheMode() { - return this.defaultSharedCacheMode; - } - - protected void setDefaultSharedCacheMode(SharedCacheMode defaultSharedCacheMode) { - SharedCacheMode old = this.defaultSharedCacheMode; - this.defaultSharedCacheMode = defaultSharedCacheMode; - this.firePropertyChanged(DEFAULT_SHARED_CACHE_MODE_PROPERTY, old, defaultSharedCacheMode); - } - - public boolean calculateDefaultCacheable() { - SharedCacheMode sharedCacheMode = this.getSharedCacheMode(); - if (sharedCacheMode == null) { - return false; // this can happen during initial update... - } - switch (sharedCacheMode) { - case NONE: - case ENABLE_SELECTIVE: - case UNSPECIFIED: - return false; - case ALL: - case DISABLE_SELECTIVE: - return true; - default: - throw new IllegalStateException("unknown mode: " + sharedCacheMode); //$NON-NLS-1$ - } - } - - protected SharedCacheMode buildSpecifiedSharedCacheMode() { - return SharedCacheMode.fromXmlResourceModel(this.xmlPersistenceUnit.getSharedCacheMode()); - } - - protected SharedCacheMode buildDefaultSharedCacheMode() { - return SharedCacheMode.UNSPECIFIED; - } - - // ********** validation mode ********** - - public ValidationMode getValidationMode() { - return (this.specifiedValidationMode != null) ? this.specifiedValidationMode : this.defaultValidationMode; - } - - public ValidationMode getSpecifiedValidationMode() { - return this.specifiedValidationMode; - } - - public void setSpecifiedValidationMode(ValidationMode specifiedValidationMode) { - this.setSpecifiedValidationMode_(specifiedValidationMode); - this.xmlPersistenceUnit.setValidationMode(ValidationMode.toXmlResourceModel(specifiedValidationMode)); - } - - protected void setSpecifiedValidationMode_(ValidationMode validationMode) { - ValidationMode old = this.specifiedValidationMode; - this.specifiedValidationMode = validationMode; - this.firePropertyChanged(SPECIFIED_VALIDATION_MODE_PROPERTY, old, validationMode); - } - - public ValidationMode getDefaultValidationMode() { - return this.defaultValidationMode; - } - - protected void setDefaultValidationMode(ValidationMode defaultValidationMode) { - ValidationMode old = this.defaultValidationMode; - this.defaultValidationMode = defaultValidationMode; - this.firePropertyChanged(DEFAULT_VALIDATION_MODE_PROPERTY, old, defaultValidationMode); - } - - protected ValidationMode buildSpecifiedValidationMode() { - return ValidationMode.fromXmlResourceModel(this.xmlPersistenceUnit.getValidationMode()); - } - - protected ValidationMode buildDefaultValidationMode() { - return DEFAULT_VALIDATION_MODE; - } - - - // ********** generators ********** - - public Iterator generators() { - return this.getGenerators().iterator(); - } - - protected Iterable getGenerators() { - return new LiveCloneIterable(this.generators); - } - - public int generatorsSize() { - return this.generators.size(); - } - - public void addGenerator(Generator generator) { - this.generators.add(generator); - } - - public Iterable getUniqueGeneratorNames() { - HashSet names = new HashSet(this.generators.size()); - this.addNonNullGeneratorNamesTo(names); - return names; - } - - protected void addNonNullGeneratorNamesTo(Set names) { - for (Generator generator : this.getGenerators()) { - String generatorName = generator.getName(); - if (generatorName != null) { - names.add(generatorName); - } - } - } - - - // ********** queries ********** - - public Iterator queries() { - return new CloneIterator(this.queries); - } - - public int queriesSize() { - return this.queries.size(); - } - - public void addQuery(Query query) { - this.queries.add(query); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateMappingFiles(messages, reporter); - this.validateClassRefs(messages, reporter); - this.validateJarFileRefs(messages, reporter); - this.validateProperties(messages, reporter); - } - - protected void validateMappingFiles(List messages, IReporter reporter) { - this.checkForMultiplePersistenceUnitMetadata(messages); - this.checkForDuplicateMappingFiles(messages); - for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { - mappingFileRef.validate(messages, reporter); - } - } - - protected void checkForMultiplePersistenceUnitMetadata(List messages) { - boolean first = true; - for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { - if (mappingFileRef.persistenceUnitMetadataExists()) { - if (first) { - first = false; - } else { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - JpaValidationMessages.MAPPING_FILE_EXTRANEOUS_PERSISTENCE_UNIT_METADATA, - new String[] {mappingFileRef.getFileName()}, - mappingFileRef - ) - ); - } - } - } - } - - protected void checkForDuplicateMappingFiles(List messages) { - HashBag fileNames = new HashBag(); - CollectionTools.addAll(fileNames, this.mappingFileRefNames()); - for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { - String fileName = mappingFileRef.getFileName(); - if (fileNames.count(fileName) > 1) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_MAPPING_FILE, - new String[] {fileName}, - mappingFileRef, - mappingFileRef.getValidationTextRange() - ) - ); - } - } - } - - protected void validateClassRefs(List messages, IReporter reporter) { - this.checkForDuplicateClasses(messages); - for (Iterator stream = this.classRefs(); stream.hasNext(); ) { - stream.next().validate(messages, reporter); - } - } - - protected void checkForDuplicateClasses(List messages) { - HashBag ormMappedClassNames = new HashBag(); - CollectionTools.addAll(ormMappedClassNames, this.ormMappedClassNames()); - for (Iterator ormMappedClasses = this.getMappingFilePersistentTypes().iterator(); ormMappedClasses.hasNext();){ - PersistentType ormMappedClass = ormMappedClasses.next(); - String ormMappedClassName = ormMappedClass.getName(); - if ((ormMappedClassName != null) && (ormMappedClassNames.count(ormMappedClassName) > 1)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_CLASS, - new String[] {ormMappedClassName}, - ormMappedClass, - ormMappedClass.getSelectionTextRange() - ) - ); - } - } - HashBag javaClassNames = new HashBag(); - CollectionTools.addAll(javaClassNames, this.classRefNames()); - for (Iterator stream = this.classRefs(); stream.hasNext(); ) { - ClassRef classRef = stream.next(); - String javaClassName = classRef.getClassName(); - if ((javaClassName != null) && (!ormMappedClassNames.contains(javaClassName)) - && (javaClassNames.count(javaClassName) > 1)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_CLASS, - new String[] {javaClassName}, - classRef, - classRef.getValidationTextRange() - ) - ); - } - } - } - - protected void validateJarFileRefs(List messages, IReporter reporter) { - this.checkForDuplicateJarFileRefs(messages); - for (JarFileRef each : CollectionTools.iterable(this.jarFileRefs())) { - each.validate(messages, reporter); - } - } - - protected void checkForDuplicateJarFileRefs(List messages) { - HashBag jarFileNames = new HashBag(); - CollectionTools.addAll(jarFileNames, this.jarFileNames()); - for (JarFileRef jarFileRef : CollectionTools.iterable(this.jarFileRefs())) { - String jarFileName = jarFileRef.getFileName(); - if ((jarFileName != null) && (jarFileNames.count(jarFileName) > 1)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENCE_UNIT_DUPLICATE_JAR_FILE, - new String[] {jarFileName}, - jarFileRef, - jarFileRef.getValidationTextRange() - ) - ); - } - } - } - - protected void validateProperties(List messages, IReporter reporter) { - // do nothing by default - } - - public boolean validatesAgainstDatabase() { - return this.connectionProfileIsActive(); - } - - public TextRange getValidationTextRange() { - return this.xmlPersistenceUnit.getValidationTextRange(); - } - - // ********** refactoring ********** - - public Iterable createDeleteTypeEdits(final IType type) { - return new CompositeIterable( - new TransformationIterable>(this.getSpecifiedClassRefs()) { - @Override - protected Iterable transform(ClassRef classRef) { - return classRef.createDeleteTypeEdits(type); - } - } - ); - } - - public Iterable createDeleteMappingFileEdits(final IFile file) { - return new CompositeIterable( - new TransformationIterable>(this.getSpecifiedMappingFileRefs()) { - @Override - protected Iterable transform(MappingFileRef mappingFileRef) { - return mappingFileRef.createDeleteMappingFileEdits(file); - } - } - ); - } - - @SuppressWarnings("unchecked") - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable( - this.createSpecifiedClassRefRenameTypeEdits(originalType, newName), - this.createPersistenceUnitPropertiesRenameTypeEdits(originalType, newName)); - } - - protected Iterable createSpecifiedClassRefRenameTypeEdits(final IType originalType, final String newName) { - return new CompositeIterable( - new TransformationIterable>(this.getSpecifiedClassRefs()) { - @Override - protected Iterable transform(ClassRef classRef) { - return classRef.createRenameTypeEdits(originalType, newName); - } - } - ); - } - - protected Iterable createPersistenceUnitPropertiesRenameTypeEdits(IType originalType, String newName) { - return this.options.createRenameTypeEdits(originalType, newName); - } - - @SuppressWarnings("unchecked") - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable( - this.createSpecifiedClassRefMoveTypeEdits(originalType, newPackage), - this.createPersistenceUnitPropertiesMoveTypeEdits(originalType, newPackage)); - } - - protected Iterable createSpecifiedClassRefMoveTypeEdits(final IType originalType, final IPackageFragment newPackage) { - return new CompositeIterable( - new TransformationIterable>(this.getSpecifiedClassRefs()) { - @Override - protected Iterable transform(ClassRef classRef) { - return classRef.createMoveTypeEdits(originalType, newPackage); - } - } - ); - } - - protected Iterable createPersistenceUnitPropertiesMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return this.options.createMoveTypeEdits(originalType, newPackage); - } - - - @SuppressWarnings("unchecked") - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable( - this.createSpecifiedClassRefRenamePackageEdits(originalPackage, newName), - this.createPersistenceUnitPropertiesRenamePackageEdits(originalPackage, newName)); - } - - protected Iterable createSpecifiedClassRefRenamePackageEdits(final IPackageFragment originalPackage, final String newName) { - return new CompositeIterable( - new TransformationIterable>(this.getSpecifiedClassRefs()) { - @Override - protected Iterable transform(ClassRef classRef) { - return classRef.createRenamePackageEdits(originalPackage, newName); - } - } - ); - } - - protected Iterable createPersistenceUnitPropertiesRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return this.options.createRenamePackageEdits(originalPackage, newName); - } - - public Iterable createRenameFolderEdits(final IFolder originalFolder, final String newName) { - return this.createMappingFileRefRenameFolderEdits(originalFolder, newName); - } - - protected Iterable createMappingFileRefRenameFolderEdits(final IFolder originalFolder, final String newName) { - return new CompositeIterable( - new TransformationIterable>(this.getSpecifiedMappingFileRefs()) { - @Override - protected Iterable transform(MappingFileRef mappingFileRef) { - return mappingFileRef.createRenameFolderEdits(originalFolder, newName); - } - } - ); - } - - public Iterable createRenameMappingFileEdits(final IFile originalFile, final String newName) { - return new CompositeIterable( - new TransformationIterable>(this.getMappingFileRefs()) { - @Override - protected Iterable transform(MappingFileRef mappingFileRef) { - return mappingFileRef.createRenameMappingFileEdits(originalFile, newName); - } - } - ); - } - - public int findInsertLocationForMappingFileRef() { - return this.xmlPersistenceUnit.getLocationToInsertMappingFileRef(); - } - - public Iterable createMoveMappingFileEdits(final IFile originalFile, final IPath runtineDestination) { - return new CompositeIterable( - new TransformationIterable>(this.getMappingFileRefs()) { - @Override - protected Iterable transform(MappingFileRef mappingFileRef) { - return mappingFileRef.createMoveMappingFileEdits(originalFile, runtineDestination); - } - } - ); - } - - public Iterable createMoveFolderEdits(final IFolder originalFolder, final IPath runtimeDestination) { - return this.createMappingFileRefMoveFolderReplaceEdits(originalFolder, runtimeDestination); - } - - protected Iterable createMappingFileRefMoveFolderReplaceEdits(final IFolder originalFolder, final IPath runtimeDestination) { - return new CompositeIterable( - new TransformationIterable>(this.getSpecifiedMappingFileRefs()) { - @Override - protected Iterable transform(MappingFileRef mappingFileRef) { - return mappingFileRef.createMoveFolderEdits(originalFolder, runtimeDestination); - } - } - ); - } - - // ********** misc ********** - - public XmlPersistenceUnit getXmlPersistenceUnit() { - return this.xmlPersistenceUnit; - } - - public JpaStructureNode getStructureNode(int textOffset) { - for (Iterator stream = this.jarFileRefs(); stream.hasNext(); ) { - JarFileRef jarFileRef = stream.next(); - if (jarFileRef.containsOffset(textOffset)) { - return jarFileRef; - } - } - for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { - if (mappingFileRef.containsOffset(textOffset)) { - return mappingFileRef; - } - } - for (Iterator stream = this.classRefs(); stream.hasNext(); ) { - ClassRef classRef = stream.next(); - if (classRef.containsOffset(textOffset)) { - return classRef; - } - } - return this; - } - - // ------------------- all entities ----------------- - public Iterable getEntities() { - return new SubIterableWrapper(this.getEntities_()); - } - - protected Iterable getEntities_() { - return new FilteringIterable(this.getTypeMappings()) { - @Override - protected boolean accept(TypeMapping typeMapping) { - return typeMapping instanceof Entity; - } - }; - } - - protected Iterable getTypeMappings() { - return new TransformationIterable(this.getPersistentTypes()) { - @Override - protected TypeMapping transform(PersistentType persistentType) { - return persistentType.getMapping(); // the mapping should never be null - } - }; - } - - protected Iterator ormMappedClassNames() { - return new TransformationIterator(this.getMappingFilePersistentTypes()) { - @Override - protected String transform(PersistentType persistentType) { - return persistentType.getName(); - } - }; - } - - // ------------------ orm entities -------------------- - protected Iterator ormEntityClassNames() { - return new TransformationIterator(this.getOrmEntities()) { - @Override - protected String transform(Entity ormEntity) { - return ormEntity.getPersistentType().getName(); - } - }; - } - - public Iterator ormEntityNames() { - return new TransformationIterator(this.getOrmEntities()) { - @Override - protected String transform(Entity ormEntity) { - return ormEntity.getName(); - } - }; - } - - public Iterable getOrmEntities(){ - return new SubIterableWrapper(this.getOrmEntities_()); - } - - protected Iterable getOrmEntities_(){ - return new FilteringIterable(this.getOrmTypeMappings()){ - @Override - protected boolean accept(TypeMapping typeMapping) { - return typeMapping instanceof Entity; - } - }; - } - - private Iterable getOrmTypeMappings() { - return new TransformationIterable(this.getMappingFilePersistentTypes()) { - @Override - protected TypeMapping transform(PersistentType persistentType) { - return persistentType.getMapping(); - } - }; - } - - //--------------- java entities ----------------- - protected Iterator javaEntityClassNames(){ - return new TransformationIterator(this.getJavaEntities()) { - @Override - protected String transform(Entity javaEntity) { - return javaEntity.getPersistentType().getName(); - } - }; - } - - public Iterator javaEntityNamesExclOverridden() { - HashBag ormMappedClassNames = new HashBag(); - CollectionTools.addAll(ormMappedClassNames, this.ormMappedClassNames()); - List javaEntityNamesExclOverridden = new ArrayList(); - for (Iterator javaEntityClassNames = this.javaEntityClassNames(); javaEntityClassNames.hasNext();){ - String javaEntityClassName = javaEntityClassNames.next(); - if (!ormMappedClassNames.contains(javaEntityClassName)) { - javaEntityNamesExclOverridden.add((this.getEntity(javaEntityClassName)).getName()); - } - } - return javaEntityNamesExclOverridden.iterator(); - } - - public Iterator javaEntityNames(){ - return new TransformationIterator(this.getJavaEntities()) { - @Override - protected String transform(Entity javaEntity) { - return javaEntity.getName(); - } - }; - } - - public Iterable getJavaEntities(){ - return new SubIterableWrapper(this.getJavaEntities_()); - } - - protected Iterable getJavaEntities_(){ - return new FilteringIterable(this.getJavaTypeMappings()){ - @Override - protected boolean accept(TypeMapping typeMapping) { - return typeMapping instanceof Entity; - } - }; - } - - private Iterable getJavaTypeMappings() { - return new TransformationIterable(this.getNonNullClassPersistentTypes()) { - @Override - protected TypeMapping transform(PersistentType persistentType) { - return persistentType.getMapping(); - } - }; - } - - @SuppressWarnings("unchecked") - public Iterable getPersistentTypes() { - return new CompositeIterable( - this.getMappingFilePersistentTypes(), - this.getNonNullClassPersistentTypes(), - this.getJarFilePersistentTypes() - ); - } - - protected Iterable getMappingFilePersistentTypes() { - return new CompositeIterable(this.getMappingFilePersistentTypeLists()); - } - - protected Iterable> getMappingFilePersistentTypeLists() { - return new TransformationIterable>( - this.getMappingFileRefs(), - PersistentTypeContainer.TRANSFORMER - ); - } - - protected Iterable getNonNullClassPersistentTypes() { - return new FilteringIterable(this.getClassPersistentTypes(), NotNullFilter.instance()); - } - - protected Iterable getClassPersistentTypes() { - return new TransformationIterable(this.getClassRefs()) { - @Override - protected PersistentType transform(ClassRef classRef) { - return classRef.getJavaPersistentType(); - } - }; - } - - protected Iterable getJarFilePersistentTypes() { - return new CompositeIterable(this.getJarFilePersistentTypeLists()); - } - - protected Iterable> getJarFilePersistentTypeLists() { - return new TransformationIterable>( - this.getJarFileRefs(), - PersistentTypeContainer.TRANSFORMER - ); - } - - public PersistentType getPersistentType(String typeName) { - if (typeName == null) { - return null; - } - for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { - PersistentType persistentType = mappingFileRef.getPersistentType(typeName); - if (persistentType != null) { - return persistentType; - } - } - for (ClassRef classRef : this.getClassRefs()) { - if (classRef.isFor(typeName)) { - return classRef.getJavaPersistentType(); - } - } - for (JarFileRef jarFileRef : this.getJarFileRefs()) { - PersistentType persistentType = jarFileRef.getPersistentType(typeName); - if (persistentType != null) { - return persistentType; - } - } - return null; - } - - public boolean specifiesPersistentType(String className) { - for (ClassRef classRef : this.getSpecifiedClassRefs()) { - if (classRef.isFor(className)) { - return true; - } - } - for (MappingFileRef mappingFileRef : this.getMappingFileRefs()) { - if (mappingFileRef.getPersistentType(className) != null) { - return true; - } - } - return false; - } - - public Entity getEntity(String typeName) { - TypeMapping typeMapping = this.getTypeMapping(typeName); - return (typeMapping instanceof Entity) ? (Entity) typeMapping : null; - } - - public Embeddable getEmbeddable(String typeName) { - TypeMapping typeMapping = this.getTypeMapping(typeName); - return (typeMapping instanceof Embeddable) ? (Embeddable) typeMapping : null; - } - - protected TypeMapping getTypeMapping(String typeName) { - PersistentType persistentType = this.getPersistentType(typeName); - return (persistentType == null) ? null : persistentType.getMapping(); - } - - public boolean containsOffset(int textOffset) { - return (this.xmlPersistenceUnit != null) && this.xmlPersistenceUnit.containsOffset(textOffset); - } - - @Override - public void toString(StringBuilder sb) { - super.toString(sb); - sb.append(this.name); - } - - - // ********** metamodel ********** - // put metamodel stuff here so it can be shared by Generic and EclipseLink implementations - - public void initializeMetamodel() { - this.initializeMetamodelFiles_(); - } - - protected void initializeMetamodelFiles() { - if (this.isJpa2_0Compatible()) { - this.initializeMetamodelFiles_(); - } - } - - protected void initializeMetamodelFiles_() { - CollectionTools.addAll(this.metamodelFiles, this.getGeneratedMetamodelFiles()); - } - - protected Iterable getGeneratedMetamodelFiles() { - return new TransformationIterable(this.getGeneratedMetamodelTopLevelTypes()) { - @Override - protected IFile transform(JavaResourcePersistentType2_0 jrpt) { - return jrpt.getFile(); - } - }; - } - - protected Iterable getGeneratedMetamodelTopLevelTypes() { - return ((JpaProject2_0) this.getJpaProject()).getGeneratedMetamodelTopLevelTypes(); - } - - /** - * Not the prettiest code.... - */ - public void synchronizeMetamodel() { - // gather up the persistent unit's types, eliminating duplicates; - // if we have persistent types with the same name in multiple locations, - // the last one we encounter wins (i.e. the classes in the orm.xml take - // precedence) - HashMap allPersistentTypes = new HashMap(); - this.addPersistentTypesTo_(this.getJarFileRefs(), allPersistentTypes); - this.addPersistentTypesTo(this.getNonNullClassPersistentTypes(), allPersistentTypes); - this.addPersistentTypesTo_(this.getMappingFileRefs(), allPersistentTypes); - - // build a list of the top-level types and a tree of their associated - // member types etc. - ArrayList topLevelTypes = new ArrayList(allPersistentTypes.size()); - HashMap> memberTypeTree = new HashMap>(); - for (PersistentType2_0 type : allPersistentTypes.values()) { - String declaringTypeName = type.getDeclaringTypeName(); - MetamodelSourceType memberType = type; - while (true) { - if (declaringTypeName == null) { - topLevelTypes.add(memberType); - break; // stop at the top-level type - } - - // associate the member type with its declaring type - Collection memberTypes = memberTypeTree.get(declaringTypeName); - if (memberTypes == null) { - memberTypes = new ArrayList(); - memberTypeTree.put(declaringTypeName, memberTypes); - } - memberTypes.add(memberType); - - // move out to the member type's declaring type - String memberTypeName = declaringTypeName; - // check for a context persistent type - memberType = allPersistentTypes.get(memberTypeName); - if (memberType != null) { - break; // stop - this will be processed in the outer 'for' loop - } - // check for a Java resource persistent type - JavaResourcePersistentType jrpt = this.getJpaProject().getJavaResourcePersistentType(memberTypeName); - if (jrpt != null) { - declaringTypeName = jrpt.getDeclaringTypeName(); - } else { - // check for a JDT type - IType jdtType = this.findJdtType(memberTypeName); - if (jdtType != null) { - IType jdtDeclaringType = jdtType.getDeclaringType(); - declaringTypeName = (jdtDeclaringType == null) ? null : jdtDeclaringType.getFullyQualifiedName('.'); - } else { - // assume we have a non-persistent top-level type...? - declaringTypeName = null; - } - } - if (declaringTypeName == null) { - memberType = this.selectSourceType(topLevelTypes, memberTypeName); - } else { - memberType = this.selectSourceType(memberTypeTree.get(declaringTypeName), memberTypeName); - } - if (memberType != null) { - break; // stop - this type has already been processed - } - memberType = this.buildNonPersistentMetamodelSourceType(memberTypeName); - } - } - - // remove any top-level type whose name differs from another only by case, - // since, on Windows, file names are case-insensitive :-( - // sort the original list so we end up with the same top-level type - // remaining every time (i.e. the one that sorts out first) - Collections.sort(topLevelTypes, MetamodelSourceType.COMPARATOR); - HashSet names = new HashSet(topLevelTypes.size()); - for (Iterator stream = topLevelTypes.iterator(); stream.hasNext(); ) { - MetamodelSourceType topLevelType = stream.next(); - // hopefully this is case-insensitive enough... - if ( ! names.add(topLevelType.getName().toLowerCase())) { - stream.remove(); - } - } - - // copy the list of metamodel files... - HashSet deadMetamodelFiles = new HashSet(this.metamodelFiles); - this.metamodelFiles.clear(); - for (MetamodelSourceType topLevelType : topLevelTypes) { - IFile metamodelFile = topLevelType.getMetamodelFile(); - // ...remove whatever files are still present... - deadMetamodelFiles.remove(metamodelFile); - // ...rebuild the list of metamodel files... - if (this.fileIsGeneratedMetamodel(metamodelFile)) { // only add files with the Dali tag - this.metamodelFiles.add(metamodelFile); - } - } - // ...delete the files that are now gone - // [perform the deletes first - this is critical when a file has been - // renamed by only altering its name's case; since we will try to write - // out a new file that, on Windows, collides with the old file :-( ] - for (IFile deadMetamodelFile : deadMetamodelFiles) { - this.deleteMetamodelFile(deadMetamodelFile); - } - - // now generate the metamodel classes - for (MetamodelSourceType topLevelType : topLevelTypes) { - topLevelType.synchronizeMetamodel(memberTypeTree); - } - } - - protected void addPersistentTypesTo_(Iterable ptContainers, HashMap persistentTypeMap) { - for (PersistentTypeContainer ptContainer : ptContainers) { - this.addPersistentTypesTo(ptContainer.getPersistentTypes(), persistentTypeMap); - } - } - - protected void addPersistentTypesTo(Iterable persistentTypes, HashMap persistentTypeMap) { - for (PersistentType persistentType : persistentTypes) { - if (persistentType.getName() != null) { - persistentTypeMap.put(persistentType.getName(), (PersistentType2_0) persistentType); - } - } - } - - protected MetamodelSourceType selectSourceType(Iterable types, String typeName) { - if (types != null) { - for (MetamodelSourceType type : types) { - if (type.getName().equals(typeName)) { - return type; - } - } - } - return null; - } - - protected MetamodelSourceType buildNonPersistentMetamodelSourceType(String nonPersistentTypeName) { - return new NonPersistentMetamodelSourceType(nonPersistentTypeName, this.getJpaProject()); - } - - protected IType findJdtType(String typeName) { - try { - return this.getJpaProject().getJavaProject().findType(typeName); - } catch (JavaModelException ex) { - JptJpaCorePlugin.log(ex); - return null; - } - } - - protected void deleteMetamodelFile(IFile file) { - try { - this.deleteMetamodelFile_(file); - } catch (CoreException ex) { - JptJpaCorePlugin.log(ex); - } - } - - protected void deleteMetamodelFile_(IFile file) throws CoreException { - if (this.fileIsGeneratedMetamodel(file)) { - file.delete(true, null); // true = force - } - } - - protected boolean fileIsGeneratedMetamodel(IFile file) { - return ((JpaProject2_0) this.getJpaProject()).getGeneratedMetamodelTopLevelType(file) != null; - } - - public void disposeMetamodel() { - this.metamodelFiles.clear(); - } - - - // ***** Metamodel source for non-persistent types - protected static class NonPersistentMetamodelSourceType - implements MetamodelSourceType - { - protected final String name; - protected final JpaProject jpaProject; - protected final MetamodelSourceType.Synchronizer metamodelSynchronizer; - - protected NonPersistentMetamodelSourceType(String name, JpaProject jpaProject) { - super(); - this.name = name; - this.jpaProject = jpaProject; - this.metamodelSynchronizer = this.buildMetamodelSynchronizer(); - } - - protected MetamodelSourceType.Synchronizer buildMetamodelSynchronizer() { - return this.getJpaFactory().buildMetamodelSynchronizer(this); - } - - protected JpaFactory2_0 getJpaFactory() { - return (JpaFactory2_0) this.getJpaProject().getJpaPlatform().getJpaFactory(); - } - - public String getName() { - return this.name; - } - - public boolean isManaged() { - return false; - } - - public PersistentType getSuperPersistentType() { - return null; - } - - public ListIterator attributes() { - return EmptyListIterator.instance(); - } - - public IFile getMetamodelFile() { - return this.metamodelSynchronizer.getFile(); - } - - public JpaProject getJpaProject() { - return this.jpaProject; - } - - public void synchronizeMetamodel(Map> memberTypeTree) { - this.metamodelSynchronizer.synchronize(memberTypeTree); - } - - public void printBodySourceOn(BodySourceWriter pw, Map> memberTypeTree) { - this.metamodelSynchronizer.printBodySourceOn(pw, memberTypeTree); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnitProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnitProperties.java deleted file mode 100644 index 96edeee601..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceUnitProperties.java +++ /dev/null @@ -1,529 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.persistence; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.utility.internal.ReflectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * AbstractPersistenceUnitProperties - */ -public abstract class AbstractPersistenceUnitProperties extends AbstractModel - implements PersistenceUnitProperties -{ - private PersistenceUnit persistenceUnit; - - // key = PersistenceUnit property key; value = property id - private Map propertyNames; - - public static final String PROPERTY_VALUE_DELIMITER = ","; //$NON-NLS-1$ - private static final long serialVersionUID = 1L; - - // ********** constructors / initialization ********** - protected AbstractPersistenceUnitProperties(PersistenceUnit parent) { - super(); - this.initialize(); - this.initialize(parent); - this.postInitialize(); - } - - /** - * Base initialization. - */ - protected void initialize() { - this.propertyNames = new HashMap(); - } - - /** - * Initialization based on the persistence unit. - */ - protected void initialize(PersistenceUnit parent) { - this.persistenceUnit = parent; - - this.initializePropertyNames(); - this.initializeProperties(); - } - - protected void initializePropertyNames() { - this.addPropertyNames(this.propertyNames); - } - - /** - * Initializes properties with values from the persistence unit. - */ - protected abstract void initializeProperties(); - - /** - * Does all post treatment in this method after the properties are initialized - */ - protected void postInitialize() { - // do nothing by default - } - - // ********** behavior ********** - public PersistenceUnit getPersistenceUnit() { - return this.persistenceUnit; - } - - public JpaProject getJpaProject() { - return this.persistenceUnit.getJpaProject(); - } - - /** - * Adds property names key/value pairs, used by the methods: itemIsProperty - * and propertyIdFor. - * - * key = property key; value = property id - */ - protected abstract void addPropertyNames(Map pNames); - - /** - * Method used for identifying the given property. - */ - public boolean itemIsProperty(PersistenceUnit.Property item) { - if (item == null) { - throw new NullPointerException(); - } - return this.propertyNames().keySet().contains(item.getName()); - } - - /** - * Returns the property name used for change notification of the given - * property. - */ - public String propertyIdOf(PersistenceUnit.Property property) { - String propertyId = this.propertyNames().get(property.getName()); - if (propertyId == null) { - throw new IllegalArgumentException("Illegal property: " + property); //$NON-NLS-1$ - } - return propertyId; - } - - public String propertyIdOf(String eclipseLinkkey) { - String propertyId = this.propertyNames().get(eclipseLinkkey); - if (propertyId == null) { - throw new IllegalArgumentException("Illegal property: " + eclipseLinkkey); //$NON-NLS-1$ - } - return propertyId; - } - - /* - * Get the PersistenceUnit property key of the given property - */ - protected String persistenceUnitKeyOf(String propertyId) { - for (String persistenceUnitKey : this.propertyNames().keySet()) { - if (this.propertyNames().get(persistenceUnitKey).equals(propertyId)) { - return persistenceUnitKey; - } - } - throw new IllegalArgumentException("Illegal property ID: " + propertyId); //$NON-NLS-1$ - } - - // ******** Convenience methods ******** - /** - * Put into persistenceUnit properties. - * - * @param key - - * property name - * @param value - - * property value - */ - protected void putProperty(String key, Object value) { - this.putProperty(key, value, false); - } - - @SuppressWarnings("unchecked") - protected void putProperty(String key, Object value, boolean allowDuplicates) { - String persistenceUnitKey = this.persistenceUnitKeyOf(key); - if ((value != null) && value.getClass().isEnum()) { - this.putEnumValue(persistenceUnitKey, (Enum) value, allowDuplicates); - } - else { - this.putPersistenceUnitProperty(persistenceUnitKey, null, value, allowDuplicates); - } - } - - /** - * Removes a persistenceUnit property. - * - * @param key - - * property name - * @param value - - * property value - */ - protected void removeProperty(String key, String value) { - String persistenceUnitKey = this.persistenceUnitKeyOf(key); - - this.getPersistenceUnit().removeProperty(persistenceUnitKey, value); - } - - /** - * Returns true when the given key exits in the PersistenceXml. - */ - protected boolean persistenceUnitKeyExists(String persistenceUnitKey) { - return (this.getStringValue(persistenceUnitKey) != null); - } - - // ****** get/set String convenience methods ******* - /** - * Returns the String value of the given Property from the PersistenceXml. - */ - protected String getStringValue(String persistenceUnitKey) { - PersistenceUnit.Property p = this.getPersistenceUnit().getProperty(persistenceUnitKey); - return (p == null) ? null : p.getValue(); - } - - protected String getStringValue(String key, String keySuffix) { - return this.getStringValue((keySuffix == null) ? key : key + keySuffix); - } - - /** - * Put the given String value into the PersistenceXml. - * @param key - - * property key - * @param newValue - * value to be associated with the key - */ - protected void putStringValue(String key, String newValue) { - this.putStringValue(key, null, newValue, false); - } - - /** - * Put the given String value into the PersistenceXml. - * @param key - * property key - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putStringValue(String key, String newValue, boolean allowDuplicate) { - this.putStringValue(key, null, newValue, allowDuplicate); - } - - /** - * Put the given String value into the PersistenceXml. - * @param key - * property key - * @param keySuffix - * e.g. entity name - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putStringValue(String key, String keySuffix, String newValue, boolean allowDuplicate) { - this.putPersistenceUnitProperty(key, keySuffix, newValue, allowDuplicate); - } - - // ****** Integer convenience methods ******* - /** - * Returns the Integer value of the given Property from the PersistenceXml. - */ - protected Integer getIntegerValue(String persistenceUnitKey) { - PersistenceUnit.Property p = this.getPersistenceUnit().getProperty(persistenceUnitKey); - return (p == null) ? null : getIntegerValueOf(p.getValue()); - } - - protected Integer getIntegerValue(String key, String keySuffix) { - return this.getIntegerValue((keySuffix == null) ? key : key + keySuffix); - } - - /** - * Put the given Integer value into the PersistenceXml. - * @param key - - * property key - * @param newValue - * value to be associated with the key - */ - protected void putIntegerValue(String key, Integer newValue) { - this.putIntegerValue(key, null, newValue, false); - } - - /** - * Put the given Integer value into the PersistenceXml. - * @param key - * property key - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putIntegerValue(String key, Integer newValue, boolean allowDuplicate) { - this.putIntegerValue(key, null, newValue, allowDuplicate); - } - - /** - * Put the given Integer value into the PersistenceXml. - * @param key - * property key - * @param keySuffix - * e.g. entity name - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putIntegerValue(String key, String keySuffix, Integer newValue, boolean allowDuplicate) { - this.putPersistenceUnitProperty(key, keySuffix, newValue, allowDuplicate); - } - - // ****** Boolean convenience methods ******* - /** - * Returns the Boolean value of the given Property from the PersistenceXml. - */ - protected Boolean getBooleanValue(String persistenceUnitKey) { - PersistenceUnit.Property p = this.getPersistenceUnit().getProperty(persistenceUnitKey); - return (p == null) ? null : getBooleanValueOf(p.getValue()); - } - - protected Boolean getBooleanValue(String key, String keySuffix) { - return this.getBooleanValue((keySuffix == null) ? key : key + keySuffix); - } - - /** - * Put the given Boolean value into the PersistenceXml. - * @param key - * property key - * @param newValue - * value to be associated with the key - */ - protected void putBooleanValue(String key, Boolean newValue) { - this.putBooleanValue(key, null, newValue, false); - } - - /** - * Put the given Boolean value into the PersistenceXml. - * @param key - * property key - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putBooleanValue(String key, Boolean newValue, boolean allowDuplicate) { - this.putBooleanValue(key, null, newValue, allowDuplicate); - } - - /** - * Put the given Boolean value into the PersistenceXml. - * @param key - * property key - * @param keySuffix - * e.g. entity name - * @param newValue - * value to be associated with the key - * @param allowDuplicate - */ - protected void putBooleanValue(String key, String keySuffix, Boolean newValue, boolean allowDuplicate) { - this.putPersistenceUnitProperty(key, keySuffix, newValue, allowDuplicate); - } - - // ****** Enum convenience methods ******* - /** - * Returns the Enum value of the given Property from the PersistenceXml. - */ - protected > T getEnumValue(String persistenceUnitKey, T[] enumValues) { - PersistenceUnit.Property p = this.getPersistenceUnit().getProperty(persistenceUnitKey); - return (p == null) ? null : getEnumValueOf(p.getValue(), enumValues); - } - - protected > T getEnumValue(String key, String keySuffix, T[] enumValues) { - return this.getEnumValue((keySuffix == null) ? key : key + keySuffix, enumValues); - } - - /** - * Put the given Enum value into the PersistenceXml. - * - * @param key - - * property key - */ - protected > void putEnumValue(String key, T newValue) { - this.putEnumValue(key, null, newValue, false); - } - - protected > void putEnumValue(String key, T newValue, boolean allowDuplicate) { - this.putEnumValue(key, null, newValue, allowDuplicate); - } - - protected > void putEnumValue(String key, String keySuffix, T newValue, boolean allowDuplicate) { - this.putPersistenceUnitProperty(key, keySuffix, getPropertyStringValueOf(newValue), allowDuplicate); - } - - // ****** get/set CompositeValue convenience methods ******* - /** - * Returns the String values of the given Property from the PersistenceXml. - */ - protected List getCompositeValue(String persistenceUnitKey) { - String values = this.getStringValue(persistenceUnitKey); - return this.extractCompositeValue(values); - } - - /** - * Put into persistenceUnit properties. If the property already exists, - * it appends the given value at the end of the property value. - * - * @param key - * @param valueToAppend - */ - protected void putPropertyCompositeValue(String key, String valueToAppend) { - String persistenceUnitKey = this.persistenceUnitKeyOf(key); - - String persistenceUnitValue = this.buildCompositeValue( - this.getStringValue(persistenceUnitKey), valueToAppend); - - this.putPersistenceUnitProperty(persistenceUnitKey, null, persistenceUnitValue, false); - } - - /** - * Removes a value from a property with composite values. - * If the resulting value is empty, the property is removed from the persistenceUnit. - * - * @param key - - * property name - * @param valueToRemove - - * value to remove from the property - */ - protected void removePropertyCompositeValue(String key, String valueToRemove) { - String persistenceUnitKey = this.persistenceUnitKeyOf(key); - - String persistenceUnitValue = this.removeValueFrom( - this.getStringValue(persistenceUnitKey), valueToRemove.trim()); - - this.putPersistenceUnitProperty(persistenceUnitKey, null, persistenceUnitValue, false); - } - - // ****** Static methods ******* - - public static Boolean getBooleanValueOf(String puStringValue) { - if (StringTools.stringIsEmpty(puStringValue)) { - return null; - } - return Boolean.valueOf(puStringValue); - } - - public static Integer getIntegerValueOf(String puStringValue) { - if (StringTools.stringIsEmpty(puStringValue)) { - return null; - } - try { - return Integer.valueOf(puStringValue); - } - catch (NumberFormatException nfe) { - return null; - } - } - - /** - * Returns the enum constant of the specified enum type with the specified - * Property string value. - */ - public static > T getEnumValueOf(String puStringValue, T[] enumValues) { - for (T enumValue : enumValues) { - if (getPropertyStringValueOf(enumValue).equals(puStringValue)) { - return enumValue; - } - } - return null; - } - - /** - * Returns the Property string value of the given property value. - */ - public static String getPropertyStringValueOf(Object value) { - if (value == null) { - return null; - } - if (value.getClass().isEnum()) { - return (String) ReflectionTools.getStaticFieldValue(value.getClass(), value.toString().toUpperCase(Locale.ENGLISH)); - } - return value.toString(); - } - - // ********** internal methods ********** - - private Map propertyNames() { - return this.propertyNames; - } - - private void putPersistenceUnitProperty(String key, String keySuffix, Object value, boolean allowDuplicates) { - String persistenceUnitKey = (keySuffix == null) ? key : key + keySuffix; - String stringValue = (value == null) ? null : value.toString(); - this.getPersistenceUnit().setProperty(persistenceUnitKey, stringValue, allowDuplicates); - } - - private String buildCompositeValue(String value, String valueToAppend) { - if((StringTools.stringIsEmpty(valueToAppend)) ) { - return value; - } - return (StringTools.stringIsEmpty(value)) ? - valueToAppend : - (value + PROPERTY_VALUE_DELIMITER + valueToAppend); - } - - protected List extractCompositeValue(String compositeValue) { - if(StringTools.stringIsEmpty(compositeValue)) { - return new ArrayList(0); - } - String[] values = compositeValue.split(PROPERTY_VALUE_DELIMITER); - List results = new ArrayList(values.length); - for(String value : values) { - results.add(value.trim()); - } - return results; - } - - private String removeValueFrom(String compositeValue, String valueToRemove) { - if((StringTools.stringIsEmpty(valueToRemove))) { - return compositeValue; - } - String[] values = compositeValue.split(PROPERTY_VALUE_DELIMITER); - ArrayList results = new ArrayList(values.length); - - for(String value : values) { - if(value.trim().equals(valueToRemove)) { - continue; - } - results.add(value); - } - if(results.isEmpty()) { - return null; - } - StringBuilder sb = new StringBuilder(values.length); - for(String value : results) { - sb.append(value).append(PROPERTY_VALUE_DELIMITER); - } - sb.deleteCharAt(sb.length() - 1); // remove the last delimiter - return sb.toString(); - } - - - // ********** refactoring ************ - - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return EmptyIterable.instance(); - } - - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return EmptyIterable.instance(); - } - - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return EmptyIterable.instance(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java deleted file mode 100644 index 11431d2f8b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNode.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.persistence; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.context.JpaContextNode; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.context.AbstractXmlContextNode; - -/** - * Use this abstract class for context nodes that are part of an - * orm.xml file. - * This will not work for a pure {@link org.eclipse.jpt.jpa.core.context.MappingFile} - * implementation. - */ -public abstract class AbstractPersistenceXmlContextNode - extends AbstractXmlContextNode -{ - // ********** constructor ********** - - protected AbstractPersistenceXmlContextNode(JpaContextNode parent) { - super(parent); - } - - - // ********** convenience methods ********** - - protected PersistenceXmlDefinition getPersistenceXmlDefinition() { - return (PersistenceXmlDefinition) this.getJpaPlatform().getResourceDefinition(this.getResourceType()); - } - - protected EFactory getResourceNodeFactory() { - return this.getPersistenceXmlDefinition().getResourceNodeFactory(); - } - - protected PersistenceXmlContextNodeFactory getContextNodeFactory() { - return this.getPersistenceXmlDefinition().getContextNodeFactory(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java deleted file mode 100644 index d0f241c83e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlContextNodeFactory.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.persistence; - -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.java.JarFile; -import org.eclipse.jpt.jpa.core.context.persistence.ClassRef; -import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJarFile; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericClassRef; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericJarFileRef; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericMappingFileRef; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistence; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceUnitProperty; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.ImpliedMappingFileRef; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty; - -public abstract class AbstractPersistenceXmlContextNodeFactory implements PersistenceXmlContextNodeFactory -{ - - public Persistence buildPersistence(PersistenceXml parent, XmlPersistence xmlPersistence) { - return new GenericPersistence(parent, xmlPersistence); - } - - public PersistenceUnit buildPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) { - return new GenericPersistenceUnit(parent, xmlPersistenceUnit); - } - - public MappingFileRef buildMappingFileRef(PersistenceUnit parent, XmlMappingFileRef xmlMappingFileRef) { - return new GenericMappingFileRef(parent, xmlMappingFileRef); - } - - public MappingFileRef buildImpliedMappingFileRef(PersistenceUnit parent) { - return new ImpliedMappingFileRef(parent, JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.toString()); - } - - public ClassRef buildClassRef(PersistenceUnit parent, XmlJavaClassRef classRef) { - return new GenericClassRef(parent, classRef); - } - - public ClassRef buildClassRef(PersistenceUnit parent, String className) { - return new GenericClassRef(parent, className); - } - - public JarFileRef buildJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) { - return new GenericJarFileRef(parent, xmlJarFileRef); - } - - public JarFile buildJarFile(JarFileRef parent, JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot) { - return new GenericJarFile(parent, jarResourcePackageFragmentRoot); - } - - public PersistenceUnit.Property buildProperty(PersistenceUnit parent, XmlProperty xmlProperty) { - return new GenericPersistenceUnitProperty(parent, xmlProperty); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java deleted file mode 100644 index 712ef7e546..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/AbstractPersistenceXmlDefinition.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.persistence; - -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition; - -/** - * All the state in the definition should be "static" - * (i.e. unchanging once it is initialized). - */ -public abstract class AbstractPersistenceXmlDefinition - implements PersistenceXmlDefinition -{ - private final PersistenceXmlContextNodeFactory factory; - - - /** - * zero-argument constructor - */ - protected AbstractPersistenceXmlDefinition() { - super(); - this.factory = this.buildContextNodeFactory(); - } - - protected abstract PersistenceXmlContextNodeFactory buildContextNodeFactory(); - - public PersistenceXmlContextNodeFactory getContextNodeFactory() { - return this.factory; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java deleted file mode 100644 index 3f329ec9bd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/context/persistence/GenericPersistenceXmlContextNodeFactory.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.context.persistence; - -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnitProperties; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.connection.NullConnection2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.options.NullOptions2_0; - - -public class GenericPersistenceXmlContextNodeFactory extends AbstractPersistenceXmlContextNodeFactory -{ - - public PersistenceUnitProperties buildConnection(PersistenceUnit parent) { - return new NullConnection2_0(parent); - } - - public PersistenceUnitProperties buildOptions(PersistenceUnit parent) { - return new NullOptions2_0(parent); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/FacetTools.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/FacetTools.java deleted file mode 100644 index a34318fd10..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/FacetTools.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.facet; - -import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase; -import org.eclipse.wst.common.project.facet.core.IGroup; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -public class FacetTools { - - public static IGroup MODULES_GROUP = ProjectFacetsManager.getGroup("modules"); //$NON-NLS-1$ - - - public static boolean hasModuleFacet(IFacetedProjectBase fproj) { - for (IProjectFacetVersion fv : fproj.getProjectFacets()) { - if (MODULES_GROUP.getMembers().contains(fv)) { - return true; - } - } - return false; - } - - public static IProjectFacetVersion getModuleFacet(IFacetedProjectBase fproj) { - for (IProjectFacetVersion fv : fproj.getProjectFacets()) { - if (MODULES_GROUP.getMembers().contains(fv)) { - return fv; - } - } - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetActionDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetActionDelegate.java deleted file mode 100644 index 69485c5d54..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetActionDelegate.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * Performs things common to install, version change - */ -public abstract class JpaFacetActionDelegate - implements IDelegate, JpaFacetDataModelProperties -{ - public final void execute( - IProject project, IProjectFacetVersion fv, - Object config, IProgressMonitor monitor) throws CoreException { - - this.execute_(project, fv, config, monitor); - } - - protected void execute_( - IProject project, IProjectFacetVersion fv, - Object config, IProgressMonitor monitor) throws CoreException { - - SubMonitor subMonitor = SubMonitor.convert(monitor, 7); - - IDataModel dataModel = (IDataModel) config; - - // project settings - JpaPlatformDescription platform = (JpaPlatformDescription) dataModel.getProperty(PLATFORM); - JptJpaCorePlugin.setJpaPlatformId(project, platform.getId()); - subMonitor.worked(1); - - // do NOT use IDataModel.getStringProperty(String) - or the connection profile name can - // be set to an empty string - we want it to be null - JptJpaCorePlugin.setConnectionProfileName(project, (String) dataModel.getProperty(CONNECTION)); - subMonitor.worked(1); - - if (dataModel.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG)) { - JptJpaCorePlugin.setUserOverrideDefaultCatalog(project, dataModel.getStringProperty(USER_OVERRIDE_DEFAULT_CATALOG)); - } - subMonitor.worked(1); - - if (dataModel.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA)) { - JptJpaCorePlugin.setUserOverrideDefaultSchema(project, dataModel.getStringProperty(USER_OVERRIDE_DEFAULT_SCHEMA)); - } - subMonitor.worked(1); - - JptJpaCorePlugin.setDiscoverAnnotatedClasses(project, dataModel.getBooleanProperty(DISCOVER_ANNOTATED_CLASSES)); - subMonitor.worked(1); - - // defaults settings - JptJpaCorePlugin.setDefaultJpaPlatformId(fv.getVersionString(), platform.getId()); - subMonitor.worked(1); - - //Delegate to LibraryInstallDelegate to configure the project classpath - ((LibraryInstallDelegate) dataModel.getProperty(JpaFacetDataModelProperties.LIBRARY_PROVIDER_DELEGATE)).execute(subMonitor.newChild(1)); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProperties.java deleted file mode 100644 index 9b3c1b5b0a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProperties.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.facet; - -import org.eclipse.wst.common.frameworks.datamodel.IDataModelProperties; - -public interface JpaFacetDataModelProperties - extends IDataModelProperties -{ - String PREFIX = "JpaFacetDataModelProperties"; - String PREFIX_ = PREFIX + '.'; - - /** - * Internal, type IRuntime, identifies runtime associated with project - * Used only in conjunction with validation of other properties, because this information - * is otherwise inaccessible to this data model - */ - String RUNTIME = PREFIX_ + "RUNTIME"; - - /** - * Required, type JpaPlatformDescription, identifies Jpa Platform - */ - String PLATFORM = PREFIX_ + "PLATFORM"; - - /** - * Required, type LibraryInstallDelegate, the library install delegate used to configure JPA provider library - */ - String LIBRARY_PROVIDER_DELEGATE = PREFIX_ + "LIBRARY_PROVIDER_DELEGATE"; - - /** - * Not required, type String, identifies database connection - */ - String CONNECTION = PREFIX_ + "CONNECTION"; - - /** - * Required, type Boolean, identifies whether database connection is active - */ - String CONNECTION_ACTIVE = PREFIX_ + "CONNECTION_ACTIVE"; - - /** - * Required, type Boolean, identifies if the user wishes to override default Catalog name - */ - String USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG = PREFIX_ + "USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG"; - - /** - * Not required, type String, identifies the user overridden default Catalog name - */ - String USER_OVERRIDE_DEFAULT_CATALOG = PREFIX_ + "USER_OVERRIDE_DEFAULT_CATALOG"; - - /** - * Required, type Boolean, identifies if the user wishes to override default schema name - */ - String USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA = PREFIX_ + "USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA"; - - /** - * Not required, type String, identifies the user overridden default schema name - */ - String USER_OVERRIDE_DEFAULT_SCHEMA = PREFIX_ + "USER_OVERRIDE_DEFAULT_SCHEMA"; - - /** - * Required, type boolean, opposite of LIST_ANNOTATED_CLASSES, identifies - * whether all annotated classes are to be automatically included as part of - * all persistence units - */ - String DISCOVER_ANNOTATED_CLASSES = PREFIX_ + "DISCOVER_ANNOTATED_CLASSES"; - - /** - * Required, type boolean, opposite of DISCOVER_ANNOTATED_CLASSES, identifies - * if annotated classes should be listed in the persistence.xml in order to - * be considered part of a persistence unit - * (This additional setting is necessary in order to use synchHelper within - * the wizard - there must be a unique property for each radio button. Stupid - * but true) - */ - String LIST_ANNOTATED_CLASSES = PREFIX_ + "LIST_ANNOTATED_CLASSES"; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java deleted file mode 100644 index b342c07b07..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetDataModelProvider.java +++ /dev/null @@ -1,715 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.facet; - -import java.util.ArrayList; -import java.util.Comparator; -import java.util.List; -import java.util.Set; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.internal.JptCoreMessages; -import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.ConnectionProfile; -import org.eclipse.jpt.jpa.db.ConnectionProfileFactory; -import org.eclipse.jpt.jpa.db.Database; -import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter; -import org.eclipse.jpt.jpa.db.JptJpaDbPlugin; -import org.eclipse.jpt.jpa.db.SchemaContainer; -import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider; -import org.eclipse.jst.common.project.facet.core.libprov.IPropertyChangeListener; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.common.componentcore.datamodel.FacetInstallDataModelProvider; -import org.eclipse.wst.common.componentcore.internal.util.IModuleConstants; -import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectWorkingCopy; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; -import org.eclipse.wst.common.project.facet.core.runtime.IRuntime; - -public abstract class JpaFacetDataModelProvider - extends FacetInstallDataModelProvider - implements JpaFacetDataModelProperties -{ - protected static final String EJB_FACET_ID = IModuleConstants.JST_EJB_MODULE; - - protected static final IStatus PLATFORM_NOT_SPECIFIED_STATUS = - buildErrorStatus(JptCoreMessages.VALIDATE_PLATFORM_NOT_SPECIFIED); - - protected static final IStatus CONNECTION_NOT_CONNECTED_STATUS = - buildInfoStatus(JptCoreMessages.VALIDATE_CONNECTION_NOT_CONNECTED); - - protected static final IStatus USER_OVERRIDE_DEFAULT_CATALOG_NOT_SPECIFIED_STATUS = - buildErrorStatus(JptCoreMessages.VALIDATE_DEFAULT_CATALOG_NOT_SPECIFIED); - - protected static final IStatus USER_OVERRIDE_DEFAULT_SCHEMA_NOT_SPECIFIED_STATUS = - buildErrorStatus(JptCoreMessages.VALIDATE_DEFAULT_SCHEMA_NOT_SPECIFIED); - - - private LibraryInstallDelegate defaultLibraryProvider; - - /** cache the connection profile - change it whenever the user selects a different name */ - private ConnectionProfile connectionProfile; - - - /** - * required default constructor - */ - protected JpaFacetDataModelProvider() { - super(); - } - - - @Override - public Set getPropertyNames() { - @SuppressWarnings("unchecked") Set propertyNames = super.getPropertyNames(); - propertyNames.add(RUNTIME); - propertyNames.add(PLATFORM); - propertyNames.add(LIBRARY_PROVIDER_DELEGATE); - propertyNames.add(CONNECTION); - propertyNames.add(CONNECTION_ACTIVE); - propertyNames.add(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG); - propertyNames.add(USER_OVERRIDE_DEFAULT_CATALOG); - propertyNames.add(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA); - propertyNames.add(USER_OVERRIDE_DEFAULT_SCHEMA); - propertyNames.add(DISCOVER_ANNOTATED_CLASSES); - propertyNames.add(LIST_ANNOTATED_CLASSES); - return propertyNames; - } - - - // ********** properties ********** - - protected IFacetedProjectWorkingCopy getFacetedProjectWorkingCopy() { - return (IFacetedProjectWorkingCopy) this.getProperty(FACETED_PROJECT_WORKING_COPY); - } - - protected IProjectFacetVersion getProjectFacetVersion() { - return (IProjectFacetVersion) this.getProperty(FACET_VERSION); - } - - protected IRuntime getRuntime() { - return (IRuntime) this.getProperty(RUNTIME); - } - - protected JpaPlatformDescription getPlatform() { - return (JpaPlatformDescription) getProperty(PLATFORM); - } - - protected LibraryInstallDelegate getLibraryInstallDelegate() { - return (LibraryInstallDelegate) this.getProperty(LIBRARY_PROVIDER_DELEGATE); - } - - protected String getConnectionName() { - return (String) this.getProperty(CONNECTION); - } - - protected boolean userWantsToOverrideDefaultCatalog() { - return this.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG); - } - - protected String getUserOverrideDefaultCatalog() { - return (String) this.getProperty(USER_OVERRIDE_DEFAULT_CATALOG); - } - - protected boolean userWantsToOverrideDefaultSchema() { - return this.getBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA); - } - - protected String getUserOverrideDefaultSchema() { - return (String) this.getProperty(USER_OVERRIDE_DEFAULT_SCHEMA); - } - - protected boolean discoverAnnotatedClasses() { - return this.getBooleanProperty(DISCOVER_ANNOTATED_CLASSES); - } - - - // ********** enabled ********** - - @Override - public boolean isPropertyEnabled(String propertyName) { - if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG)) { - return this.connectionIsActive() && this.databaseSupportsCatalogs(); - } - if (propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) { - return this.userWantsToOverrideDefaultCatalog(); - } - if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA)) { - return this.connectionIsActive(); - } - if (propertyName.equals(USER_OVERRIDE_DEFAULT_SCHEMA)) { - return this.userWantsToOverrideDefaultSchema(); - } - - return super.isPropertyEnabled(propertyName); - } - - - // ********** defaults ********** - - @Override - public Object getDefaultProperty(String propertyName) { - if (propertyName.equals(FACET_ID)) { - return JpaFacet.ID; - } - if (propertyName.equals(RUNTIME)) { - return null; - } - if (propertyName.equals(PLATFORM)) { - return getDefaultPlatform(); - } - if (propertyName.equals(LIBRARY_PROVIDER_DELEGATE)) { - return getDefaultLibraryProvider(); - } - if (propertyName.equals(CONNECTION)) { - return getDefaultConnection(); - } - if (propertyName.equals(CONNECTION_ACTIVE)) { - return Boolean.valueOf(this.connectionIsActive()); - } - if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG)) { - return getDefaultUserWantsToOverrideDefaultCatalog(); - } - if (propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) { - return getDefaultCatalogIdentifier(); - } - if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA)) { - return getDefaultUserWantsToOverrideDefaultSchema(); - } - if (propertyName.equals(USER_OVERRIDE_DEFAULT_SCHEMA)) { - return getDefaultSchemaIdentifier(); - } - if (propertyName.equals(DISCOVER_ANNOTATED_CLASSES)) { - return getDefaultDiscoverAnnotatedClasses(); - } - if (propertyName.equals(LIST_ANNOTATED_CLASSES)) { - return getDefaultListAnnotatedClasses(); - } - - return super.getDefaultProperty(propertyName); - } - - protected abstract JpaPlatformDescription getDefaultPlatform(); - - protected LibraryInstallDelegate getDefaultLibraryProvider() { - // delegate itself changes only when facet version changes - if (this.defaultLibraryProvider == null) { - this.defaultLibraryProvider = buildDefaultLibraryProvider(); - } - else if (! this.defaultLibraryProvider.getProjectFacetVersion().equals(getProjectFacetVersion())) { - this.defaultLibraryProvider.dispose(); - this.defaultLibraryProvider = buildDefaultLibraryProvider(); - } - return defaultLibraryProvider; - } - - protected LibraryInstallDelegate buildDefaultLibraryProvider() { - IFacetedProjectWorkingCopy fpjwc = this.getFacetedProjectWorkingCopy(); - if (fpjwc == null) { - return null; - } - IProjectFacetVersion pfv = this.getProjectFacetVersion(); - if (pfv == null) { - return null; - } - LibraryInstallDelegate lp = new LibraryInstallDelegate(fpjwc, pfv); - lp.addListener(buildLibraryProviderListener()); - return lp; - } - - protected IPropertyChangeListener buildLibraryProviderListener() { - return new IPropertyChangeListener() { - public void propertyChanged(String property, Object oldValue, Object newValue ) { - if (LibraryInstallDelegate.PROP_AVAILABLE_PROVIDERS.equals(property)) { - adjustLibraryProviders(); - } - JpaFacetDataModelProvider.this.getDataModel().notifyPropertyChange( - LIBRARY_PROVIDER_DELEGATE, IDataModel.VALUE_CHG); - } - }; - } - - protected abstract String getDefaultConnection(); - - protected abstract Boolean getDefaultUserWantsToOverrideDefaultCatalog(); - - protected abstract String getDefaultCatalogIdentifier(); - - protected abstract Boolean getDefaultUserWantsToOverrideDefaultSchema(); - - protected abstract String getDefaultSchemaIdentifier(); - - protected abstract Boolean getDefaultDiscoverAnnotatedClasses(); - - protected Boolean getDefaultListAnnotatedClasses() { - return Boolean.valueOf( ! this.discoverAnnotatedClasses()); - } - - protected boolean runtimeSupportsEjb30() { - IRuntime runtime = this.getRuntime(); - return (runtime != null) && runtime.supports(this.getEJB30()); - } - - protected IProjectFacetVersion getEJB30() { - return ProjectFacetsManager.getProjectFacet(EJB_FACET_ID).getVersion("3.0"); //$NON-NLS-1$ - } - - - // ********** synchronize data model ********** - - /** - * The specified property's value has changed to the specified value. - * Return whether to fire a VALUE_CHG DataModelEvent. - */ - @Override - public boolean propertySet(String propertyName, Object propertyValue) { - boolean ok = super.propertySet(propertyName, propertyValue); - - if (propertyName.equals(FACETED_PROJECT_WORKING_COPY)) { - //no-op - } - else if (propertyName.equals(FACET_VERSION)) { - adjustLibraryProviders(); - this.model.notifyPropertyChange(PLATFORM, IDataModel.DEFAULT_CHG); - this.model.notifyPropertyChange(LIBRARY_PROVIDER_DELEGATE, IDataModel.DEFAULT_CHG); - } - else if (propertyName.equals(RUNTIME)) { - LibraryInstallDelegate lid = this.getLibraryInstallDelegate(); - if (lid != null) { - // may be null while model is being built up - // ... or in tests - lid.refresh(); - } - this.model.notifyPropertyChange(DISCOVER_ANNOTATED_CLASSES, IDataModel.DEFAULT_CHG); - this.model.notifyPropertyChange(LIST_ANNOTATED_CLASSES, IDataModel.DEFAULT_CHG); - } - else if (propertyName.equals(PLATFORM)) { - adjustLibraryProviders(); - } - else if (propertyName.equals(CONNECTION)) { - this.setBooleanProperty(CONNECTION_ACTIVE, this.connectionIsActive()); - - // JpaFacetWizardPage sets the connection when the user adds a new connection - // implying that there is a new set of valid connections to choose from - this.model.notifyPropertyChange(CONNECTION, IDataModel.VALID_VALUES_CHG); - - // catalog - if ((propertyValue != null) && this.databaseSupportsCatalogs()) { // connection set to something that supports catalogs - this.setProperty(USER_OVERRIDE_DEFAULT_CATALOG, this.getDefaultCatalogIdentifier()); - } else { // connection either '' or non-catalog database - this.setBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG, false); - } - this.model.notifyPropertyChange(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG, IDataModel.ENABLE_CHG); - this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_CATALOG, IDataModel.DEFAULT_CHG); - this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_CATALOG, IDataModel.VALID_VALUES_CHG); - - // schema - if (propertyValue == null) { // connection set to '' - this.setBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA, false); - } else { - this.setProperty(USER_OVERRIDE_DEFAULT_SCHEMA, this.getDefaultSchemaIdentifier()); - } - this.model.notifyPropertyChange(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA, IDataModel.ENABLE_CHG); - this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_SCHEMA, IDataModel.DEFAULT_CHG); - this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_SCHEMA, IDataModel.VALID_VALUES_CHG); - } - else if (propertyName.equals(CONNECTION_ACTIVE)) { - // catalog - if (this.propertyValueIsFalse(propertyValue)) { // connection is inactive - this.setBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG, false); - } - this.model.notifyPropertyChange(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG, IDataModel.ENABLE_CHG); - this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_CATALOG, IDataModel.DEFAULT_CHG); - this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_CATALOG, IDataModel.VALID_VALUES_CHG); - - // schema - if (this.propertyValueIsFalse(propertyValue)) { // connection is inactive - this.setBooleanProperty(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA, false); - } - this.model.notifyPropertyChange(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA, IDataModel.ENABLE_CHG); - this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_SCHEMA, IDataModel.DEFAULT_CHG); - this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_SCHEMA, IDataModel.VALID_VALUES_CHG); - } - else if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG)) { - this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_CATALOG, IDataModel.ENABLE_CHG); - if (this.propertyValueIsFalse(propertyValue)) { - this.setProperty(USER_OVERRIDE_DEFAULT_CATALOG, null); - } - } - else if (propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) { - this.setProperty(USER_OVERRIDE_DEFAULT_SCHEMA, this.getDefaultSchemaIdentifier()); - this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_SCHEMA, IDataModel.DEFAULT_CHG); - this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_SCHEMA, IDataModel.VALID_VALUES_CHG); - } - else if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA)) { - this.model.notifyPropertyChange(USER_OVERRIDE_DEFAULT_SCHEMA, IDataModel.ENABLE_CHG); - if (this.propertyValueIsFalse(propertyValue)) { - this.setProperty(USER_OVERRIDE_DEFAULT_SCHEMA, null); - } - } - else if (propertyName.equals(DISCOVER_ANNOTATED_CLASSES)) { - this.setBooleanProperty(LIST_ANNOTATED_CLASSES, this.propertyValueIsFalse(propertyValue)); - } - else if (propertyName.equals(LIST_ANNOTATED_CLASSES)) { - this.setBooleanProperty(DISCOVER_ANNOTATED_CLASSES, this.propertyValueIsFalse(propertyValue)); - } - return ok; - } - - protected boolean propertyValueIsFalse(Object propertyValue) { - return ! this.propertyValueIsTrue(propertyValue); - } - - protected boolean propertyValueIsTrue(Object propertyValue) { - return ((Boolean) propertyValue).booleanValue(); - } - - protected void adjustLibraryProviders() { - LibraryInstallDelegate lid = this.getLibraryInstallDelegate(); - if (lid != null) { - List jpaConfigs - = new ArrayList(); - // add the currently selected one first - JpaLibraryProviderInstallOperationConfig currentJpaConfig = null; - LibraryProviderOperationConfig config = lid.getLibraryProviderOperationConfig(); - if (config instanceof JpaLibraryProviderInstallOperationConfig) { - currentJpaConfig = (JpaLibraryProviderInstallOperationConfig) config; - jpaConfigs.add(currentJpaConfig); - } - for (ILibraryProvider lp : lid.getLibraryProviders()) { - config = lid.getLibraryProviderOperationConfig(lp); - if (config instanceof JpaLibraryProviderInstallOperationConfig - && ! config.equals(currentJpaConfig)) { - jpaConfigs.add((JpaLibraryProviderInstallOperationConfig) config); - } - } - for (JpaLibraryProviderInstallOperationConfig jpaConfig : jpaConfigs) { - jpaConfig.setJpaPlatform(getPlatform()); - } - } - } - - - // ********** property descriptors ********** - - @Override - public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) { - if (propertyName.equals(PLATFORM)) { - return this.buildValidPlatformDescriptors(); - } - if (propertyName.equals(CONNECTION)) { - return this.buildValidConnectionDescriptors(); - } - if (propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) { - return this.buildValidCatalogDescriptors(); - } - if (propertyName.equals(USER_OVERRIDE_DEFAULT_SCHEMA)) { - return this.buildValidSchemaDescriptors(); - } - - return super.getValidPropertyDescriptors(propertyName); - } - - protected DataModelPropertyDescriptor[] buildValidPlatformDescriptors() { - Iterable validPlatformDescriptions = buildValidPlatformDescriptions(); - Iterable validPlatformDescriptors = - new TransformationIterable(validPlatformDescriptions) { - @Override - protected DataModelPropertyDescriptor transform(JpaPlatformDescription desc) { - return buildPlatformDescriptor(desc); - } - }; - return ArrayTools.sort(ArrayTools.array(validPlatformDescriptors, EMPTY_DMPD_ARRAY), DESCRIPTOR_COMPARATOR); - } - - protected Iterable buildValidPlatformDescriptions() { - return new FilteringIterable( - JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatforms()) { - @Override - protected boolean accept(JpaPlatformDescription o) { - return o.supportsJpaFacetVersion(getProjectFacetVersion()); - } - }; - } - - protected static final Comparator DESCRIPTOR_COMPARATOR = - new Comparator() { - public int compare(DataModelPropertyDescriptor dmpd1, DataModelPropertyDescriptor dmpd2) { - return dmpd1.getPropertyDescription().compareTo(dmpd2.getPropertyDescription()); - } - }; - - protected DataModelPropertyDescriptor[] buildValidConnectionDescriptors() { - List connectionNames = this.buildValidConnectionNames(); - DataModelPropertyDescriptor[] descriptors = new DataModelPropertyDescriptor[connectionNames.size()]; - for (int i = 0; i < descriptors.length; i++) { - descriptors[i] = this.buildConnectionDescriptor(connectionNames.get(i)); - } - return descriptors; - } - - /** - * put a null entry at the top of the list (for ) - */ - protected List buildValidConnectionNames() { - List connectionNames = CollectionTools.sort(CollectionTools.list(this.getConnectionProfileNames())); - connectionNames.add(0, null); - return connectionNames; - } - - protected DataModelPropertyDescriptor[] buildValidCatalogDescriptors() { - Database db = this.getDatabase(); - return (db == null) ? EMPTY_DMPD_ARRAY : this.buildDescriptors(this.buildValidCatalogIdentifiers(db)); - } - - /** - * pre-condition: 'db' is not null - */ - protected List buildValidCatalogIdentifiers(Database db) { - // use catalog *identifiers* since the string ends up being the "default" for various text entries - return this.buildValidStrings(db.getSortedCatalogIdentifiers(), this.getDefaultCatalogIdentifier()); - } - - protected DataModelPropertyDescriptor[] buildValidSchemaDescriptors() { - Database db = this.getDatabase(); - return (db == null) ? EMPTY_DMPD_ARRAY : this.buildDescriptors(this.buildValidSchemaIdentifiers()); - } - - protected List buildValidSchemaIdentifiers() { - return this.buildValidStrings(this.getSchemaIdentifiers(), this.getDefaultSchemaIdentifier()); - } - - protected Iterable getSchemaIdentifiers() { - SchemaContainer sc = this.getSchemaContainer(); - // use schema *identifiers* since the string ends up being the "default" for various text entries - return (sc != null) ? sc.getSortedSchemaIdentifiers() : EmptyIterable.instance(); - } - - /** - * put an entry for the default at the top of the list - */ - protected List buildValidStrings(Iterable strings, String defaultString) { - List validStrings = CollectionTools.list(strings); - if ((defaultString != null) && ! validStrings.contains(defaultString)) { - validStrings.add(0, defaultString); - } - return validStrings; - } - - protected DataModelPropertyDescriptor[] buildDescriptors(List strings) { - DataModelPropertyDescriptor[] descriptors = new DataModelPropertyDescriptor[strings.size()]; - for (int i = 0; i < descriptors.length; i++) { - descriptors[i] = new DataModelPropertyDescriptor(strings.get(i)); - } - return descriptors; - } - - protected static final DataModelPropertyDescriptor[] EMPTY_DMPD_ARRAY = new DataModelPropertyDescriptor[0]; - - /** - * platform and connection have 'description's (in addition to 'value's) - */ - @Override - public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) { - if (propertyName.equals(PLATFORM)) { - return buildPlatformDescriptor(this.getPlatform()); - } - if (propertyName.equals(CONNECTION)) { - return buildConnectionDescriptor(this.getConnectionName()); - } - return super.getPropertyDescriptor(propertyName); - } - - protected DataModelPropertyDescriptor buildPlatformDescriptor(JpaPlatformDescription platform) { - return new DataModelPropertyDescriptor(platform, platform.getLabel()); - } - - protected String getPlatformLabel(String platformId) { - return JptJpaCorePlugin.getJpaPlatformManager().getJpaPlatform(platformId).getLabel(); - } - - protected DataModelPropertyDescriptor buildConnectionDescriptor(String connectionName) { - String description = (connectionName == null) ? JptCoreMessages.NONE : null; - return new DataModelPropertyDescriptor(connectionName, description); - } - - - // ********** database ********** - - protected SchemaContainer getSchemaContainer() { - return this.databaseSupportsCatalogs() ? this.getCatalog() : this.getDatabase(); - } - - protected Catalog getCatalog() { - String name = this.getUserOverrideDefaultCatalog(); - return (name == null) ? null : this.getCatalog(name); - } - - /** - * pre-condition: 'name' is not null - */ - protected Catalog getCatalog(String name) { - Database db = this.getDatabase(); - return (db == null) ? null : db.getCatalogForIdentifier(name); - } - - protected boolean databaseSupportsCatalogs() { - Database db = this.getDatabase(); - return (db != null) && db.supportsCatalogs(); - } - - protected Database getDatabase() { - ConnectionProfile cp = this.getConnectionProfile(); - return (cp == null) ? null : cp.getDatabase(); - } - - protected boolean connectionIsActive() { - ConnectionProfile cp = this.getConnectionProfile(); - return (cp != null) && cp.isActive(); - } - - protected ConnectionProfile getConnectionProfile() { - String name = this.getConnectionName(); - return (name == null) ? null : this.getConnectionProfile(name); - } - - /** - * pre-condition: 'name' is not null - */ - protected ConnectionProfile getConnectionProfile(String name) { - if (this.cachedConnectionProfileIsStale(name)) { - this.connectionProfile = this.buildConnectionProfile(name); - } - return this.connectionProfile; - } - - protected boolean cachedConnectionProfileIsStale(String name) { - return (this.connectionProfile == null) || ! this.connectionProfile.getName().equals(name); - } - - protected ConnectionProfile buildConnectionProfile(String name) { - return this.getConnectionProfileFactory().buildConnectionProfile(name, DatabaseIdentifierAdapter.Default.instance()); - } - - protected Iterable getConnectionProfileNames() { - return this.getConnectionProfileFactory().getConnectionProfileNames(); - } - - protected ConnectionProfileFactory getConnectionProfileFactory() { - // we don't have a JPA project yet, so go to the db plug-in directly to get the factory - return JptJpaDbPlugin.getConnectionProfileFactory(); - } - - - // ********** validation ********** - - @Override - public IStatus validate(String propertyName) { - if (propertyName.equals(PLATFORM)) { - return this.validatePlatform(); - } - if (propertyName.equals(LIBRARY_PROVIDER_DELEGATE)) { - return this.getLibraryInstallDelegate().validate(); - } - if (propertyName.equals(CONNECTION)) { - return this.validateConnection(); - } - if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_CATALOG) - || propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) { - return this.validateUserOverrideDefaultCatalog(); - } - if (propertyName.equals(USER_WANTS_TO_OVERRIDE_DEFAULT_SCHEMA) - || propertyName.equals(USER_OVERRIDE_DEFAULT_SCHEMA)) { - return this.validateUserOverrideDefaultSchema(); - } - if (propertyName.equals(DISCOVER_ANNOTATED_CLASSES)) { - return this.validatePersistentClassManagement(); - } - - return super.validate(propertyName); - } - - protected IStatus validatePlatform() { - return (this.getPlatform() == null) ? PLATFORM_NOT_SPECIFIED_STATUS : OK_STATUS; - } - - protected IStatus validateConnection() { - String connectionName = this.getConnectionName(); - return (connectionName == null) ? OK_STATUS : this.validateNonNullConnection(connectionName); - } - - protected IStatus validateNonNullConnection(String connectionName) { - ConnectionProfile cp = this.getConnectionProfile(connectionName); - if (cp == null) { - return buildErrorStatus(NLS.bind(JptCoreMessages.VALIDATE_CONNECTION_INVALID, connectionName)); - } - if ( ! cp.isActive()) { - return CONNECTION_NOT_CONNECTED_STATUS; - } - return OK_STATUS; - } - - protected IStatus validateUserOverrideDefaultCatalog() { - if (this.userWantsToOverrideDefaultCatalog()) { - if (this.getUserOverrideDefaultCatalog() == null) { - return USER_OVERRIDE_DEFAULT_CATALOG_NOT_SPECIFIED_STATUS; - } - } - return OK_STATUS; - } - - protected IStatus validateUserOverrideDefaultSchema() { - if (this.userWantsToOverrideDefaultSchema()) { - if (this.getUserOverrideDefaultSchema() == null) { - return USER_OVERRIDE_DEFAULT_SCHEMA_NOT_SPECIFIED_STATUS; - } - } - return OK_STATUS; - } - - protected IStatus validatePersistentClassManagement() { - // TODO warning if "discovery" is used, but no runtime specified ?? - // boolean discoverAnnotatedClasses = this.discoverAnnotatedClasses(); - return OK_STATUS; - } - - - // ********** static methods ********** - - protected static IStatus buildInfoStatus(String message) { - return buildStatus(IStatus.INFO, message); - } - -// private static IStatus buildWarningStatus(String message) { -// return buildStatus(IStatus.WARNING, message); -// } - - protected static IStatus buildErrorStatus(String message) { - return buildStatus(IStatus.ERROR, message); - } - - protected static IStatus buildStatus(int severity, String message) { - return new Status(severity, JptJpaCorePlugin.PLUGIN_ID, message); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProperties.java deleted file mode 100644 index a72c4206a3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProperties.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.facet; - -@SuppressWarnings("nls") -public interface JpaFacetInstallDataModelProperties - extends JpaFacetDataModelProperties -{ - String PREFIX = "JpaFacetInstallDataModelProperties"; - String PREFIX_ = PREFIX + '.'; - - /** - * Required, type Boolean, identifies if the user wishes to add the database driver jars to the classpath - */ - String USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH = PREFIX_ + "USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH"; - - /** - * Not required, type String, identifies the database driver library added to the classpath - */ - String DB_DRIVER_NAME = PREFIX_ + "DB_DRIVER_NAME"; - - /** - * Required, type boolean, details whether orm.xml should be created - */ - String CREATE_ORM_XML = PREFIX_ + "CREATE_ORM_XML"; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProvider.java deleted file mode 100644 index a70e069003..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDataModelProvider.java +++ /dev/null @@ -1,206 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.facet; - -import java.util.Set; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; -import org.eclipse.jpt.jpa.db.ConnectionProfile; -import org.eclipse.jpt.jpa.db.Database; -import org.eclipse.jpt.jpa.db.SchemaContainer; -import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class JpaFacetInstallDataModelProvider - extends JpaFacetDataModelProvider - implements JpaFacetInstallDataModelProperties -{ - /** - * required default constructor - */ - public JpaFacetInstallDataModelProvider() { - super(); - } - - @Override - public Set getPropertyNames() { - Set propertyNames = super.getPropertyNames(); - propertyNames.add(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH); - propertyNames.add(DB_DRIVER_NAME); - propertyNames.add(CREATE_ORM_XML); - return propertyNames; - } - - - // ********** properties ********** - - protected boolean userWantsToAddDbDriverJarsToClasspath() { - return this.getBooleanProperty(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH); - } - - protected String getDriverName() { - return (String) this.getProperty(DB_DRIVER_NAME); - } - - - // ********** enabled ********** - - @Override - public boolean isPropertyEnabled(String propertyName) { - if (propertyName.equals(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)) { - return (this.getConnectionProfile() != null); - } - if (propertyName.equals(DB_DRIVER_NAME)) { - return this.userWantsToAddDbDriverJarsToClasspath(); - } - - return super.isPropertyEnabled(propertyName); - } - - - // ********** defaults ********** - - @Override - public Object getDefaultProperty(String propertyName) { - if (propertyName.equals(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)) { - return Boolean.FALSE; - } - if (propertyName.equals(DB_DRIVER_NAME)) { - return this.getDefaultDriverName(); - } - if (propertyName.equals(CREATE_ORM_XML)) { - return Boolean.FALSE; - } - - return super.getDefaultProperty(propertyName); - } - - @Override - protected JpaPlatformDescription getDefaultPlatform() { - return JptJpaCorePlugin.getDefaultJpaPlatform(getProjectFacetVersion()); - } - - @Override - protected String getDefaultConnection() { - return null; - } - - @Override - protected Boolean getDefaultUserWantsToOverrideDefaultCatalog() { - return Boolean.FALSE; - } - - @Override - protected String getDefaultCatalogIdentifier() { - Database db = this.getDatabase(); - return (db == null) ? null : db.getDefaultCatalogIdentifier(); - } - - @Override - protected Boolean getDefaultUserWantsToOverrideDefaultSchema() { - return Boolean.FALSE; - } - - @Override - protected String getDefaultSchemaIdentifier() { - SchemaContainer sc = this.getSchemaContainer(); - return (sc == null) ? null : sc.getDefaultSchemaIdentifier(); - } - - protected String getDefaultDriverName() { - ConnectionProfile cp = this.getConnectionProfile(); - return (cp == null) ? null : cp.getDriverName(); - } - - @Override - protected Boolean getDefaultDiscoverAnnotatedClasses() { - return Boolean.valueOf(this.runtimeSupportsEjb30()); - } - - - // ********** synchronize data model ********** - - /** - * The specified property's value has changed to the specified value. - * Return whether to fire a VALUE_CHG DataModelEvent. - */ - @Override - public boolean propertySet(String propertyName, Object propertyValue) { - boolean ok = super.propertySet(propertyName, propertyValue); - - if (propertyName.equals(CONNECTION)) { - // db driver - if (propertyValue == null) { // connection set to '' - this.setBooleanProperty(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH, false); - } - this.model.notifyPropertyChange(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH, IDataModel.ENABLE_CHG); - this.model.notifyPropertyChange(DB_DRIVER_NAME, IDataModel.DEFAULT_CHG); - this.model.notifyPropertyChange(DB_DRIVER_NAME, IDataModel.VALID_VALUES_CHG); - } - else if (propertyName.equals(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)) { - this.model.notifyPropertyChange(DB_DRIVER_NAME, IDataModel.ENABLE_CHG); - if (this.propertyValueIsFalse(propertyValue)) { - this.setProperty(DB_DRIVER_NAME, null); - } - } - - return ok; - } - - - // ********** property descriptors ********** - - @Override - public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) { - if (propertyName.equals(PLATFORM)) { - return this.buildValidPlatformDescriptors(); - } - - if (propertyName.equals(CONNECTION)) { - return this.buildValidConnectionDescriptors(); - } - - if (propertyName.equals(DB_DRIVER_NAME)) { - return this.buildValidDriverDescriptors(); - } - - if (propertyName.equals(USER_OVERRIDE_DEFAULT_CATALOG)) { - return this.buildValidCatalogDescriptors(); - } - - if (propertyName.equals(USER_OVERRIDE_DEFAULT_SCHEMA)) { - return this.buildValidSchemaDescriptors(); - } - - return super.getValidPropertyDescriptors(propertyName); - } - - protected DataModelPropertyDescriptor[] buildValidDriverDescriptors() { - return new DataModelPropertyDescriptor[] { new DataModelPropertyDescriptor(this.getDriverName()) }; - } - - - // ********** validation ********** - - @Override - public IStatus validate(String propertyName) { - if (propertyName.equals(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH) - || propertyName.equals(DB_DRIVER_NAME)) { - return this.validateDbDriverName(); - } - - return super.validate(propertyName); - } - - protected IStatus validateDbDriverName() { - return OK_STATUS; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java deleted file mode 100644 index 5c07250f1a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetInstallDelegate.java +++ /dev/null @@ -1,143 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.facet; - -import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.CONTAINER_PATH; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jdt.core.IClasspathContainer; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.resource.ResourceLocator; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.internal.operations.OrmFileCreationDataModelProvider; -import org.eclipse.jpt.jpa.core.internal.operations.PersistenceFileCreationDataModelProvider; -import org.eclipse.jpt.jpa.db.JptJpaDbPlugin; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.validation.ValidationFramework; - -/** - * We don't really "install" the JPA facet here. We simply store all the various - * data model properties in the appropriate preferences. These settings will - * used in the POST_INSTALL event listener to build the JPA project. - */ -public class JpaFacetInstallDelegate - extends JpaFacetActionDelegate - implements JpaFacetInstallDataModelProperties -{ - @Override - protected void execute_( - IProject project, IProjectFacetVersion fv, - Object config, IProgressMonitor monitor) throws CoreException { - - SubMonitor sm = SubMonitor.convert(monitor, 10); - - ValidationFramework.getDefault().addValidationBuilder(project); - - super.execute_(project, fv, config, sm.newChild(1)); - - IJavaProject javaProject = JavaCore.create(project); - IDataModel dataModel = (IDataModel) config; - - // project settings - this.addDbDriverLibraryToClasspath(javaProject, dataModel, sm.newChild(1)); - - // create project XML files - this.createProjectXml(project, dataModel.getBooleanProperty(CREATE_ORM_XML), sm.newChild(8)); - } - - protected void addDbDriverLibraryToClasspath( - IJavaProject javaProject, IDataModel dataModel, - IProgressMonitor monitor) throws CoreException { - - if( ! dataModel.getBooleanProperty(USER_WANTS_TO_ADD_DB_DRIVER_JARS_TO_CLASSPATH)) { - return; - } - String driverName = dataModel.getStringProperty(DB_DRIVER_NAME); - - IClasspathContainer container = JptJpaDbPlugin.instance().buildDriverClasspathContainerFor(driverName); - IClasspathEntry entry = JavaCore.newContainerEntry(container.getPath()); - this.addClasspathEntryToProject(entry, javaProject, monitor); - } - - private void addClasspathEntryToProject( - IClasspathEntry classpathEntry, IJavaProject javaProject, IProgressMonitor monitor) - throws CoreException { - - // if the classpathEntry is already there, do nothing - IClasspathEntry[] classpath = javaProject.getRawClasspath(); - if (ArrayTools.contains(classpath, classpathEntry)) { - return; - } - - // add the given classpathEntry to the project classpath - int len = classpath.length; - IClasspathEntry[] newClasspath = new IClasspathEntry[len + 1]; - System.arraycopy(classpath, 0, newClasspath, 0, len); - newClasspath[len] = classpathEntry; - javaProject.setRawClasspath(newClasspath, monitor); - } - - private void createProjectXml(IProject project, boolean buildOrmXml, IProgressMonitor monitor) { - int tasks = 1 + (buildOrmXml ? 1 : 0); - SubMonitor sm = SubMonitor.convert(monitor, tasks); - - this.createPersistenceXml(project, sm.newChild(1)); - if (buildOrmXml) { - this.createOrmXml(project, sm.newChild(1)); - } - } - - private void createPersistenceXml(IProject project, IProgressMonitor monitor) { - SubMonitor sm = SubMonitor.convert(monitor, 5); - - IDataModel config = DataModelFactory.createDataModel(new PersistenceFileCreationDataModelProvider()); - config.setProperty(CONTAINER_PATH, defaultResourceLocation(project)); - sm.worked(1); - // default values for all other properties should suffice - try { - config.getDefaultOperation().execute(sm.newChild(4), null); - } catch (ExecutionException ex) { - JptJpaCorePlugin.log(ex); - } - } - - private void createOrmXml(IProject project, IProgressMonitor monitor) { - SubMonitor sm = SubMonitor.convert(monitor, 5); - - IDataModel config = DataModelFactory.createDataModel(new OrmFileCreationDataModelProvider()); - config.setProperty(CONTAINER_PATH, defaultResourceLocation(project)); - sm.worked(1); - // default values for all other properties should suffice - try { - config.getDefaultOperation().execute(sm.newChild(4), null); - } catch (ExecutionException ex) { - JptJpaCorePlugin.log(ex); - } - } - - protected IPath defaultResourceLocation(IProject project) { - ResourceLocator resourceLocator = JptCommonCorePlugin.getResourceLocator(project); - if (resourceLocator == null) { - JptJpaCorePlugin.log("No resource locator for project"); - return null; - } - return resourceLocator.getDefaultResourceLocation(project).getFullPath(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java deleted file mode 100644 index b71b2ce923..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetUninstallDelegate.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.wst.common.project.facet.core.IDelegate; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -public class JpaFacetUninstallDelegate - implements IDelegate -{ - public void execute(IProject project, IProjectFacetVersion fv, - Object config, IProgressMonitor monitor) throws CoreException { - - JptJpaCorePlugin.clearProjectPreferences(project); - JptJpaCorePlugin.clearProjectPersistentProperties(project); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java deleted file mode 100644 index ab06bfed9c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDataModelProvider.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.internal.JptCoreMessages; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; - -public class JpaFacetVersionChangeDataModelProvider - extends JpaFacetDataModelProvider - implements JpaFacetDataModelProperties -{ - protected static final IStatus PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION_STATUS = - buildErrorStatus(JptCoreMessages.VALIDATE_PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION); - - - /** - * required default constructor - */ - public JpaFacetVersionChangeDataModelProvider() { - super(); - } - - - protected String getProjectName() { - return getStringProperty(FACET_PROJECT_NAME); - } - - protected JpaProject getJpaProject() { - IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getProjectName()); - return JptJpaCorePlugin.getJpaProject(project); - } - - - // **************** defaults ********************************************** - - @Override - protected JpaPlatformDescription getDefaultPlatform() { - return getJpaProject().getJpaPlatform().getDescription(); - } - - @Override - protected String getDefaultConnection() { - return getJpaProject().getDataSource().getConnectionProfileName(); - } - - @Override - protected Boolean getDefaultUserWantsToOverrideDefaultCatalog() { - return getJpaProject().getUserOverrideDefaultCatalog() != null; - } - - @Override - protected String getDefaultCatalogIdentifier() { - return getJpaProject().getUserOverrideDefaultCatalog(); - } - - @Override - protected Boolean getDefaultUserWantsToOverrideDefaultSchema() { - return getJpaProject().getUserOverrideDefaultSchema() != null; - } - - @Override - protected String getDefaultSchemaIdentifier() { - return getJpaProject().getDefaultSchema(); - } - - @Override - protected Boolean getDefaultDiscoverAnnotatedClasses() { - return getJpaProject().discoversAnnotatedClasses(); - } - - - // **************** valid property descriptors **************************** - - @Override - protected Iterable buildValidPlatformDescriptions() { - // add existing platform to list of choices - Iterable validPlatformDescs = super.buildValidPlatformDescriptions(); - if (! CollectionTools.contains(validPlatformDescs, getDefaultPlatform())) { - validPlatformDescs = new CompositeIterable(getDefaultPlatform(), validPlatformDescs); - } - return validPlatformDescs; - } - - - // **************** validation ******************************************** - - @Override - protected IStatus validatePlatform() { - IStatus status = super.validatePlatform(); - - if (status.isOK()) { - if (! getPlatform().supportsJpaFacetVersion(getProjectFacetVersion())) { - status = PLATFORM_DOES_NOT_SUPPORT_FACET_VERSION_STATUS; - } - } - - return status; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java deleted file mode 100644 index 9935431623..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/JpaFacetVersionChangeDelegate.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -public class JpaFacetVersionChangeDelegate - extends JpaFacetActionDelegate -{ - @Override - protected void execute_( - IProject project, IProjectFacetVersion fv, - Object config, IProgressMonitor monitor) throws CoreException - { - SubMonitor sm = SubMonitor.convert(monitor, 2); - super.execute_(project, fv, config, sm.newChild(1)); - - JptJpaCorePlugin.rebuildJpaProject(project); - sm.worked(1); - // nothing further to do here *just* yet - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java deleted file mode 100644 index 59d4ef4ee1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/facet/RuntimeChangedListener.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.facet; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryInstallDelegate; -import org.eclipse.wst.common.project.facet.core.IFacetedProjectBase; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; -import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectEvent; -import org.eclipse.wst.common.project.facet.core.events.IFacetedProjectListener; - -public class RuntimeChangedListener - implements IFacetedProjectListener { - - public void handleEvent(IFacetedProjectEvent facetedProjectEvent) { - - IFacetedProjectBase fpb = facetedProjectEvent.getWorkingCopy(); - if (fpb == null) { - fpb = facetedProjectEvent.getProject(); - } - IProjectFacetVersion pfv = fpb.getProjectFacetVersion(JpaFacet.FACET); - if (pfv != null) { - LibraryInstallDelegate lp = new LibraryInstallDelegate(fpb, pfv); - try { - lp.execute(new NullProgressMonitor()); - } - catch (CoreException ce) { - JptJpaCorePlugin.log(ce); - } - } - } - - protected String getJpaPlatformId(IProject project) { - JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(project); - return (jpaProject == null) ? null : jpaProject.getJpaPlatform().getId(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java deleted file mode 100644 index f7f658d9e6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaDataSource.java +++ /dev/null @@ -1,230 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1; - -import org.eclipse.jpt.jpa.core.JpaDataSource; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaNode; -import org.eclipse.jpt.jpa.db.ConnectionAdapter; -import org.eclipse.jpt.jpa.db.ConnectionListener; -import org.eclipse.jpt.jpa.db.ConnectionProfile; -import org.eclipse.jpt.jpa.db.ConnectionProfileFactory; -import org.eclipse.jpt.jpa.db.ConnectionProfileListener; -import org.eclipse.jpt.jpa.db.Database; -import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter; -import org.eclipse.jpt.jpa.db.DatabaseObject; - -/** - * GenericJpaDataSource - */ -public class GenericJpaDataSource - extends AbstractJpaNode - implements JpaDataSource -{ - /** - * cache the connection profile name so we can detect when - * it changes and notify listeners - */ - protected String connectionProfileName; - - protected transient ConnectionProfile connectionProfile; - - /** - * listen for the connection to be added or removed or its name changed - */ - protected final ConnectionProfileListener connectionProfileListener; - - /** - * listen for the connection to be opened or closed - */ - protected final ConnectionListener connectionListener; - - private static final long serialVersionUID = 1L; - - - // ********** constructor/initialization ********** - - public GenericJpaDataSource(JpaProject jpaProject, String connectionProfileName) { - super(jpaProject); - //moving the building of the connection profile before the connectionProfileListener - //is added. Need to make sure the loading of db profiles is completed before - //listening, otherwise we get notifications before our model is finished being built. - //this means our updater is called before it is set which results in an IllegalStateException. - //Hopefully this change is temporary and DTP will fix bug 246270 where I suggest they - //not fire events when building profiles. - this.connectionProfileName = connectionProfileName; - this.connectionProfile = this.buildConnectionProfile(connectionProfileName); - - this.connectionProfileListener = this.buildConnectionProfileListener(); - this.getConnectionProfileFactory().addConnectionProfileListener(this.connectionProfileListener); - - this.connectionListener = this.buildConnectionListener(); - if (this.connectionProfile != null) { - this.connectionProfile.addConnectionListener(this.connectionListener); - } - } - - protected ConnectionProfileFactory getConnectionProfileFactory() { - return this.getJpaPlatform().getConnectionProfileFactory(); - } - - protected ConnectionProfileListener buildConnectionProfileListener() { - return new LocalConnectionProfileListener(); - } - - protected ConnectionListener buildConnectionListener() { - return new LocalConnectionListener(); - } - - - // ********** JpaDataSource implementation ********** - - public String getConnectionProfileName() { - return this.connectionProfileName; - } - - public void setConnectionProfileName(String name) { - String old = this.connectionProfileName; - this.connectionProfileName = name; - if (this.firePropertyChanged(CONNECTION_PROFILE_NAME_PROPERTY, old, name)) { - // synch the connection profile when the name changes - this.setConnectionProfile(this.buildConnectionProfile(name)); - JptJpaCorePlugin.setConnectionProfileName(this.getJpaProject().getProject(), name); - } - } - - public ConnectionProfile getConnectionProfile() { - return this.connectionProfile; - } - - @Override - public boolean connectionProfileIsActive() { - ConnectionProfile cp = this.connectionProfile; - return (cp != null) && cp.isActive(); - } - - @Override - public Database getDatabase() { - ConnectionProfile cp = this.connectionProfile; - return (cp == null) ? null : cp.getDatabase(); - } - - public T selectDatabaseObjectForIdentifier(Iterable databaseObjects, String identifier) { - Database db = this.getDatabase(); - return (db == null) ? null : db.selectDatabaseObjectForIdentifier(databaseObjects, identifier); - } - - public void dispose() { - if (this.connectionProfile != null) { - this.connectionProfile.removeConnectionListener(this.connectionListener); - } - this.getConnectionProfileFactory().removeConnectionProfileListener(this.connectionProfileListener); - } - - - // ********** internal methods ********** - - protected ConnectionProfile buildConnectionProfile(String name) { - return this.getConnectionProfileFactory().buildConnectionProfile(name, this.buildDatabaseIdentifierAdapter()); - } - - protected DatabaseIdentifierAdapter buildDatabaseIdentifierAdapter() { - return this.isJpa2_0Compatible() ? - this.getJpaFactory2_0().buildDatabaseIdentifierAdapter(this) : - DatabaseIdentifierAdapter.Default.instance(); - } - - protected void setConnectionProfile(ConnectionProfile connectionProfile) { - ConnectionProfile old = this.connectionProfile; - if (old != null) { - old.removeConnectionListener(this.connectionListener); - } - this.connectionProfile = connectionProfile; - if (connectionProfile != null) { - connectionProfile.addConnectionListener(this.connectionListener); - } - this.firePropertyChanged(CONNECTION_PROFILE_PROPERTY, old, connectionProfile); - } - - - // ********** overrides ********** - - @Override - public void toString(StringBuilder sb) { - sb.append(this.connectionProfileName); - } - - - // ********** member classes ********** - - /** - * Listen for a connection profile with our name being removed. - * Also listen for our connection's name being changed. - */ - protected class LocalConnectionProfileListener - implements ConnectionProfileListener - { - protected LocalConnectionProfileListener() { - super(); - } - - public void connectionProfileAdded(String name) { - // check to see if a connection profile with our name was added - // (assume our connection profile is null) - if (GenericJpaDataSource.this.connectionProfile == null) { - if (name.equals(GenericJpaDataSource.this.getConnectionProfileName())) { - GenericJpaDataSource.this.setConnectionProfileName(name); // this will trigger creation of CP - } - } - } - - public void connectionProfileRemoved(String name) { - if (GenericJpaDataSource.this.connectionProfile == null) { - return; - } - if (name.equals(GenericJpaDataSource.this.connectionProfile.getName())) { - GenericJpaDataSource.this.setConnectionProfile(null); - } - } - - public void connectionProfileRenamed(String oldName, String newName) { - if (GenericJpaDataSource.this.connectionProfile == null) { - if (newName.equals(GenericJpaDataSource.this.connectionProfileName)) { - GenericJpaDataSource.this.setConnectionProfileName(newName); - } - return; - } - // the connection profile will already have the new name, - // we just need to synch the name held by the data source - if (newName.equals(GenericJpaDataSource.this.connectionProfile.getName())) { - GenericJpaDataSource.this.setConnectionProfileName(newName); - } - } - } - - - /** - * Whenever the connection is opened or closed trigger a project update. - */ - protected class LocalConnectionListener - extends ConnectionAdapter - { - @Override - public void opened(ConnectionProfile profile) { - GenericJpaDataSource.this.stateChanged(); - } - - @Override - public void closed(ConnectionProfile profile) { - GenericJpaDataSource.this.stateChanged(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFactory.java deleted file mode 100644 index 5c44239337..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFactory.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1; - -import org.eclipse.jpt.jpa.core.internal.AbstractJpaFactory; - -/** - * Generic JPA - */ -public class GenericJpaFactory - extends AbstractJpaFactory -{ - public GenericJpaFactory() { - super(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFile.java deleted file mode 100644 index ff1204c53c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaFile.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1; - -import java.util.Hashtable; -import java.util.Iterator; -import java.util.Set; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptResourceModel; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.jpa.core.JpaFile; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaNode; - -/** - * The transition between a JPA project and the resource model associated - * with a file. - * Hold the associated root structure nodes, which are hooks to the - * context model. - */ -public class GenericJpaFile - extends AbstractJpaNode - implements JpaFile -{ - /** - * typically a .java or .xml file. - */ - protected final IFile file; - - /** - * cache the content type - if the content type changes, the JPA project - * will throw out the JPA file and build a new one - */ - protected final IContentType contentType; - - /** - * the resource model corresponding to the file - */ - protected final JptResourceModel resourceModel; - - /** - * the root structure (context model) nodes corresponding to the resource - * model - */ - protected final Hashtable rootStructureNodes = new Hashtable(); - - - // ********** construction ********** - - public GenericJpaFile(JpaProject jpaProject, IFile file, IContentType contentType, JptResourceModel resourceModel) { - super(jpaProject); - this.file = file; - this.contentType = contentType; - this.resourceModel = resourceModel; - } - - /** - * Changes to {@link #ROOT_STRUCTURE_NODES_COLLECTION} do not need to trigger a - * project update. Only the UI cares about the root structure nodes. - * If a project update is allowed to happen, an infinite loop will result - * if any Java class is specified in more than one location in the - * persistence unit. - */ - @Override - protected void addNonUpdateAspectNamesTo(Set nonUpdateAspectNames) { - super.addNonUpdateAspectNamesTo(nonUpdateAspectNames); - nonUpdateAspectNames.add(ROOT_STRUCTURE_NODES_COLLECTION); - } - - - // ********** file ********** - - public IFile getFile() { - return this.file; - } - - public IContentType getContentType() { - return this.contentType; - } - - public JptResourceModel getResourceModel() { - return this.resourceModel; - } - - public JptResourceModel getResourceModel(IContentType ct) { - return this.contentType.isKindOf(ct) ? this.resourceModel : null; - } - - - // ********** root structure nodes ********** - - public Iterator rootStructureNodes() { - return this.getRootStructureNodes().iterator(); - } - - protected Iterable getRootStructureNodes() { - return new LiveCloneIterable(this.rootStructureNodes.values()); - } - - public int rootStructureNodesSize() { - return this.rootStructureNodes.size(); - } - - public void addRootStructureNode(Object key, JpaStructureNode rootStructureNode) { - JpaStructureNode old = this.rootStructureNodes.put(key, rootStructureNode); - if (rootStructureNode != old) { - if (old != null) { - this.fireItemRemoved(ROOT_STRUCTURE_NODES_COLLECTION, old); - } - this.fireItemAdded(ROOT_STRUCTURE_NODES_COLLECTION, rootStructureNode); - } - } - - public void removeRootStructureNode(Object key, JpaStructureNode rootStructureNode) { - if (Tools.valuesAreEqual(rootStructureNode, this.rootStructureNodes.get(key))) { - this.fireItemRemoved(ROOT_STRUCTURE_NODES_COLLECTION, this.rootStructureNodes.remove(key)); - } - } - - public JpaStructureNode getStructureNode(int textOffset) { - for (JpaStructureNode rootNode : this.getRootStructureNodes()) { - JpaStructureNode node = rootNode.getStructureNode(textOffset); - if (node != null) { - return node; - } - } - return null; - } - - - // ********** misc ********** - - @Override - public void toString(StringBuilder sb) { - sb.append(this.file); - sb.append('['); - sb.append(this.contentType.getName()); - sb.append(']'); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaProject.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaProject.java deleted file mode 100644 index 2502f19457..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/GenericJpaProject.java +++ /dev/null @@ -1,28 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1; - -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaProject; - -/** - * Not much different from the abstract JPA project. - */ -public class GenericJpaProject - extends AbstractJpaProject -{ - - // ********** constructor/initialization ********** - - public GenericJpaProject(JpaProject.Config config) { - super(config); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractEntityPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractEntityPrimaryKeyValidator.java deleted file mode 100644 index 159df40278..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractEntityPrimaryKeyValidator.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import java.util.List; - -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.IdClassReference; -import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class AbstractEntityPrimaryKeyValidator extends - AbstractPrimaryKeyValidator { - - public AbstractEntityPrimaryKeyValidator(Entity entity, - PrimaryKeyTextRangeResolver textRangeResolver) { - super(entity, textRangeResolver); - } - - protected Entity entity() { - return (Entity) this.typeMapping(); - } - - @Override - protected IdClassReference idClassReference() { - return entity().getIdClassReference(); - } - - public boolean validate(List messages, IReporter reporter) { - // if an entity is non-root, it is not allowed to define primary keys - if (! entity().isRoot()) { - validatePrimaryKeyForNonRoot(messages, reporter); - } - else { - validatePrimaryKeyForRoot(messages, reporter); - } - return true; - } - - protected void validatePrimaryKeyForNonRoot(List messages, IReporter reporter) { - validateNonRootEntityDoesNotSpecifyIdClass(messages, reporter); - validateNonRootEntityDoesNotSpecifyPrimaryKeyAttributes(messages, reporter); - } - - protected void validatePrimaryKeyForRoot(List messages, IReporter reporter) { - validatePrimaryKeyIsNotRedefined(messages, reporter); - validateIdClassIsUsedIfNecessary(messages, reporter); - - // if the primary key is not defined on an ancestor, it must be defined here - if (! definesPrimaryKey(typeMapping())) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ENTITY_NO_PK, - EMPTY_STRING_ARRAY, - entity(), - textRangeResolver().getTypeMappingTextRange())); - } - - // if primary key is composite, it may either use an id class or embedded id, not both - validateOneOfIdClassOrEmbeddedIdIsUsed(messages, reporter); - // ... and only one embedded id - validateOneEmbeddedId(messages, reporter); - - validateMapsIdMappings(messages, reporter); - - if (specifiesIdClass()) { - validateIdClass(idClassReference().getIdClass(), messages, reporter); - } - } - - protected void validateNonRootEntityDoesNotSpecifyIdClass(List messages, IReporter reporter) { - if (idClassReference().isSpecified()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ENTITY_NON_ROOT_ID_CLASS_SPECIFIED, - EMPTY_STRING_ARRAY, - entity(), - textRangeResolver().getIdClassTextRange())); - } - } - - protected void validateNonRootEntityDoesNotSpecifyPrimaryKeyAttributes(List messages, IReporter reporter) { - for (AttributeMapping each : getPrimaryKeyMappingsDefinedLocally(typeMapping())) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ENTITY_NON_ROOT_ID_ATTRIBUTE_SPECIFIED, - EMPTY_STRING_ARRAY, - each, - textRangeResolver().getAttributeMappingTextRange(each.getName()))); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractJoinTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractJoinTableValidator.java deleted file mode 100644 index 58e53d7f21..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractJoinTableValidator.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; - -public abstract class AbstractJoinTableValidator extends AbstractTableValidator -{ - protected AbstractJoinTableValidator(JoinTable table, TableTextRangeResolver textRangeResolver) { - super(table, textRangeResolver); - } - - protected AbstractJoinTableValidator(PersistentAttribute persistentAttribute, JoinTable table, TableTextRangeResolver textRangeResolver) { - super(persistentAttribute, table, textRangeResolver); - } - - @Override - protected String getUnresolvedCatalogMessage() { - return JpaValidationMessages.JOIN_TABLE_UNRESOLVED_CATALOG; - } - - @Override - protected String getUnresolvedSchemaMessage() { - return JpaValidationMessages.JOIN_TABLE_UNRESOLVED_SCHEMA; - } - - @Override - protected String getUnresolvedNameMessage() { - return JpaValidationMessages.JOIN_TABLE_UNRESOLVED_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractMappedSuperclassPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractMappedSuperclassPrimaryKeyValidator.java deleted file mode 100644 index 37552dc286..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractMappedSuperclassPrimaryKeyValidator.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2011 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.IdClassReference; -import org.eclipse.jpt.jpa.core.context.MappedSuperclass; -import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class AbstractMappedSuperclassPrimaryKeyValidator - extends AbstractPrimaryKeyValidator -{ - public AbstractMappedSuperclassPrimaryKeyValidator( - MappedSuperclass mappedSuperclass, PrimaryKeyTextRangeResolver textRangeResolver) { - - super(mappedSuperclass, textRangeResolver); - } - - - protected MappedSuperclass mappedSuperclass() { - return (MappedSuperclass) this.typeMapping(); - } - - @Override - protected IdClassReference idClassReference() { - return mappedSuperclass().getIdClassReference(); - } - - public boolean validate(List messages, IReporter reporter) { - validatePrimaryKeyIsNotRedefined(messages, reporter); - validateIdClassIsUsedIfNecessary(messages, reporter); - - // if primary key is composite, it may either use an id class or embedded id, not both - validateOneOfIdClassOrEmbeddedIdIsUsed(messages, reporter); - // ... and only one embedded id - validateOneEmbeddedId(messages, reporter); - - if (specifiesIdClass()) { - validateIdClass(idClassReference().getIdClass(), messages, reporter); - } - return true; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java deleted file mode 100644 index 81080e19ba..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractNamedColumnValidator.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.NullTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class AbstractNamedColumnValidator - implements JptValidator -{ - protected final PersistentAttribute persistentAttribute; - - protected final C column; - - protected final R textRangeResolver; - - protected final TableValidator tableValidator; - - protected final TableDescriptionProvider tableDescriptionProvider; - - protected AbstractNamedColumnValidator( - C column, - R textRangeResolver) { - this(null, column, textRangeResolver); - } - - protected AbstractNamedColumnValidator( - C column, - R textRangeResolver, - TableDescriptionProvider provider) { - this(null, column, textRangeResolver, provider); - } - - protected AbstractNamedColumnValidator( - PersistentAttribute persistentAttribute, - C column, - R textRangeResolver) { - this(persistentAttribute, column, textRangeResolver, new NullTableDescriptionProvider()); - } - - protected AbstractNamedColumnValidator( - PersistentAttribute persistentAttribute, - C column, - R textRangeResolver, - TableDescriptionProvider provider) { - this.persistentAttribute = persistentAttribute; - this.column = column; - this.textRangeResolver = textRangeResolver; - this.tableDescriptionProvider = provider; - this.tableValidator = this.buildTableValidator(); - } - - protected TableValidator buildTableValidator() { - return new NullTableValidator(); - } - - protected boolean isPersistentAttributeVirtual() { - return (this.persistentAttribute != null) && this.persistentAttribute.isVirtual(); - } - - protected String getPersistentAttributeName() { - return this.persistentAttribute.getName(); - } - - public boolean validate(List messages, IReporter reporter) { - if (this.tableValidator.tableNameIsInvalid()) { - return this.tableValidator.validate(messages, reporter); - } - this.validateName(messages); - return true; - } - - protected void validateName(List messages) { - Table dbTable = this.column.getDbTable(); - if ((dbTable != null) && ! this.column.isResolved()) { - messages.add(this.buildUnresolvedNameMessage()); - } - } - - protected IMessage buildUnresolvedNameMessage() { - return this.isPersistentAttributeVirtual() ? - this.buildVirtualAttributeUnresolvedNameMessage() : - this.buildUnresolvedNameMessage(this.getUnresolvedNameMessage()); - } - - protected IMessage buildUnresolvedNameMessage(String message) { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - message, - new String[] { - this.column.getName(), - this.column.getDbTable().getName() - }, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - protected abstract String getUnresolvedNameMessage(); - - protected IMessage buildVirtualAttributeUnresolvedNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnresolvedNameMessage(), - new String[] { - this.getPersistentAttributeName(), - this.column.getName(), - this.column.getDbTable().getName() - }, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - protected abstract String getVirtualAttributeUnresolvedNameMessage(); - - - // ********** table validator ********** - - public interface TableValidator - extends JptValidator - { - boolean tableNameIsInvalid(); - } - - public static class NullTableValidator - implements TableValidator - { - public boolean validate(List messages, IReporter reporter) { - return true; - } - public boolean tableNameIsInvalid() { - return false; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java deleted file mode 100644 index b62e5a415f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPersistentAttributeValidator.java +++ /dev/null @@ -1,74 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class AbstractPersistentAttributeValidator - implements JptValidator -{ - protected PersistentAttribute persistentAttribute; - - protected JavaPersistentAttribute javaPersistentAttribute; - - protected PersistentAttributeTextRangeResolver textRangeResolver; - - - protected AbstractPersistentAttributeValidator( - PersistentAttribute persistentAttribute, JavaPersistentAttribute javaPersistentAttribute, PersistentAttributeTextRangeResolver textRangeResolver) { - this.persistentAttribute = persistentAttribute; - this.javaPersistentAttribute = javaPersistentAttribute; - this.textRangeResolver = textRangeResolver; - } - - - public boolean validate(List messages, IReporter reporter) { - this.validateAttribute(messages); - return true; - } - - protected abstract void validateAttribute(List messages); - - protected boolean isFieldAttribute() { - if (this.javaPersistentAttribute == null) { - return false; - } - return this.javaPersistentAttribute.isField(); - } - - protected boolean isPropertyAttribute() { - if (this.javaPersistentAttribute == null) { - return false; - } - return this.javaPersistentAttribute.isProperty(); - } - - protected boolean isFinalAttribute() { - if (this.javaPersistentAttribute == null) { - return false; - } - return this.javaPersistentAttribute.isFinal(); - } - - protected boolean isPublicAttribute() { - if (this.javaPersistentAttribute == null) { - return false; - } - return this.javaPersistentAttribute.isPublic(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java deleted file mode 100644 index 4c3f9fd870..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractPrimaryKeyValidator.java +++ /dev/null @@ -1,618 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import java.util.Collection; -import java.util.Iterator; -import java.util.List; -import org.eclipse.jpt.common.utility.internal.ClassName; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.IdClassReference; -import org.eclipse.jpt.jpa.core.context.IdMapping; -import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.SingleRelationshipMapping2_0; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class AbstractPrimaryKeyValidator - implements JptValidator -{ - private TypeMapping typeMapping; - - private PrimaryKeyTextRangeResolver textRangeResolver; - - public static final String[] EMPTY_STRING_ARRAY = StringTools.EMPTY_STRING_ARRAY; - - protected AbstractPrimaryKeyValidator( - TypeMapping typeMapping, PrimaryKeyTextRangeResolver textRangeResolver) { - - this.typeMapping = typeMapping; - this.textRangeResolver = textRangeResolver; - } - - - protected TypeMapping typeMapping() { - return this.typeMapping; - } - - protected abstract IdClassReference idClassReference(); - - protected PrimaryKeyTextRangeResolver textRangeResolver() { - return this.textRangeResolver; - } - - // for JPA portability, a hierarchy must define its primary key on one class - // (entity *or* mapped superclass) - protected void validatePrimaryKeyIsNotRedefined(List messages, IReporter reporter) { - if (definesPrimaryKeyOnAncestor(typeMapping())) { - if (idClassReference().isSpecified()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TYPE_MAPPING_PK_REDEFINED_ID_CLASS, - EMPTY_STRING_ARRAY, - typeMapping(), - textRangeResolver().getIdClassTextRange())); - } - for (AttributeMapping each : getPrimaryKeyMappingsDefinedLocally(typeMapping())) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TYPE_MAPPING_PK_REDEFINED_ID_ATTRIBUTE, - EMPTY_STRING_ARRAY, - each, - textRangeResolver().getAttributeMappingTextRange(each.getName()))); - } - return; - } - } - - // if a primary key defining class has multiple primary keys, it must use an id class - protected void validateIdClassIsUsedIfNecessary(List messages, IReporter reporter) { - if (! specifiesIdClass() && idClassIsRequired()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TYPE_MAPPING_ID_CLASS_REQUIRED, - EMPTY_STRING_ARRAY, - typeMapping(), - textRangeResolver().getTypeMappingTextRange())); - } - } - - // only one composite primary key strategy may be used - protected void validateOneOfIdClassOrEmbeddedIdIsUsed(List messages, IReporter reporter) { - if (idClassReference().isSpecified() - && CollectionTools.size(typeMapping().getAllAttributeMappings(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY)) > 0) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TYPE_MAPPING_ID_CLASS_AND_EMBEDDED_ID_BOTH_USED, - EMPTY_STRING_ARRAY, - typeMapping(), - textRangeResolver().getTypeMappingTextRange())); - } - } - - // only one embedded id may be used - protected void validateOneEmbeddedId(List messages, IReporter reporter) { - if (CollectionTools.size(getEmbeddedIdMappings(typeMapping())) > 1) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TYPE_MAPPING_MULTIPLE_EMBEDDED_ID, - EMPTY_STRING_ARRAY, - typeMapping(), - textRangeResolver().getTypeMappingTextRange())); - } - } - - protected void validateMapsIdMappings(List messages, IReporter reporter) { - for (SingleRelationshipMapping2_0 mapsIdRelationshipMapping : getMapsIdMappingsDefinedLocally(typeMapping())) { - // can't use maps id mappings with an id class - if (definesIdClass(typeMapping())) { - messages.add(DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TYPE_MAPPING_ID_CLASS_WITH_MAPS_ID, - new String[] {mapsIdRelationshipMapping.getName()}, - mapsIdRelationshipMapping, - textRangeResolver().getAttributeMappingTextRange(mapsIdRelationshipMapping.getName()))); - } - - AttributeMapping resolvedAttributeMapping = - mapsIdRelationshipMapping.getDerivedIdentity().getMapsIdDerivedIdentityStrategy().getResolvedAttributeMappingValue(); - if (resolvedAttributeMapping != null - && ! ClassName.areAutoboxEquivalents( - resolvedAttributeMapping.getPersistentAttribute().getTypeName(), - getTargetEntityPrimaryKeyTypeName(mapsIdRelationshipMapping))) { - messages.add(DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TYPE_MAPPING_MAPS_ID_ATTRIBUTE_TYPE_DOES_NOT_AGREE, - new String[] {mapsIdRelationshipMapping.getName()}, - mapsIdRelationshipMapping, - textRangeResolver().getAttributeMappingTextRange(mapsIdRelationshipMapping.getName()))); - } - } - } - - protected void validateIdClass(JavaPersistentType idClass, List messages, IReporter reporter) { - // there should already be a validation error if the id class does not resolve to a class - if (idClass == null) { - return; - } - - if (hasDerivedIdMappingMatchingIdClass(idClass)) { - validateIdClass_derivedIdMappingMatchingIdClass(idClass, messages, reporter); - return; - } - for (JavaPersistentAttribute idClassAttribute : - new SubIterableWrapper( - CollectionTools.iterable(idClass.allAttributes()))) { - boolean foundMatch = false; - for (AttributeMapping attributeMapping : getAttributeMappings(typeMapping())) { - if (idClassAttribute.getName().equals(attributeMapping.getName())) { - foundMatch = true; - - // the matching attribute should be a primary key - if (! definesPrimaryKey(attributeMapping)) { - messages.add(DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TYPE_MAPPING_ID_CLASS_ATTRIBUTE_NOT_PRIMARY_KEY, - new String[] {idClassAttribute.getName()}, - typeMapping(), - textRangeResolver().getIdClassTextRange())); - } - - // the matching attribute's type should agree - String idClassAttributeTypeName = idClassAttribute.getTypeName(); - String attributeMappingTypeName = getTypeNameForIdClass(attributeMapping); - if (attributeMappingTypeName != null // if it's null, there should be - // another failing validation elsewhere - && ! ClassName.areAutoboxEquivalents(idClassAttributeTypeName, attributeMappingTypeName)) { - messages.add(DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TYPE_MAPPING_ID_CLASS_ATTRIBUTE_TYPE_DOES_NOT_AGREE, - new String[] {idClassAttribute.getName(), idClassAttributeTypeName}, - typeMapping(), - textRangeResolver().getIdClassTextRange())); - } - } - } - - if (! foundMatch) { - messages.add(DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TYPE_MAPPING_ID_CLASS_ATTRIBUTE_NO_MATCH, - new String[] {idClassAttribute.getName()}, - typeMapping(), - textRangeResolver().getIdClassTextRange())); - } - } - } - - protected void validateIdClass_derivedIdMappingMatchingIdClass( - JavaPersistentType idClass, List messages, IReporter reporter) { - - Collection errorMappings = new HashBag(); - for (AttributeMapping each - : new CompositeIterable(getIdMappings(typeMapping()), getEmbeddedIdMappings(typeMapping()))) { - errorMappings.add(each); - } - Collection errorDerivedIdMappings = new HashBag(); - for (SingleRelationshipMapping2_0 each : getDerivedIdMappings(typeMapping())) { - if (idClass.getName().equals(getTargetEntityPrimaryKeyTypeName(each))) { - errorDerivedIdMappings.add(each); - } - else { - errorMappings.add(each); - } - } - for (AttributeMapping each : errorMappings) { - addNoIdClassAttributeMatchError(each, messages); - } - if (CollectionTools.size(errorDerivedIdMappings) > 1) { - for (AttributeMapping each : errorDerivedIdMappings) { - addDuplicateIdClassAttributeMatchError(each, messages); - } - } - } - - protected void addNoIdClassAttributeMatchError(AttributeMapping attributeMapping, List messages) { - messages.add(DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TYPE_MAPPING_ID_CLASS_ATTRIBUTE_MAPPING_NO_MATCH, - new String[] {attributeMapping.getName()}, - typeMapping(), - textRangeResolver().getIdClassTextRange())); - } - - protected void addDuplicateIdClassAttributeMatchError(AttributeMapping attributeMapping, List messages) { - messages.add(DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.TYPE_MAPPING_ID_CLASS_ATTRIBUTE_MAPPING_DUPLICATE_MATCH, - new String[] {attributeMapping.getName()}, - typeMapping(), - textRangeResolver().getIdClassTextRange())); - } - - - // **************** convenience methods ******************************************************** - - // **************** primary key overall ******************************************************** - - /** - * Return whether an ancestor class has defined any aspect of the primary key - */ - protected boolean definesPrimaryKeyOnAncestor(TypeMapping typeMapping) { - for (TypeMapping each : CollectionTools.iterable(typeMapping.inheritanceHierarchy())) { - if (each != typeMapping && definesPrimaryKey(each)) { - return true; - } - } - return false; - } - - /** - * Return whether the type mapping has defined any aspect of the primary key - */ - protected boolean definesPrimaryKey(TypeMapping typeMapping) { - return getIdClass(typeMapping) != null - || ! CollectionTools.isEmpty(getPrimaryKeyMappings(typeMapping)); - } - - /** - * Return true if the type mapping has defined any aspect of a complex primary key - */ - protected boolean definesComplexPrimaryKey(TypeMapping typeMapping) { - return definesIdClass(typeMapping) - || getEmbeddedIdMapping(typeMapping) != null; - } - - /** - * Return the overriding type name of the primary key for the type mapping. - * This may be - * - type of the single simple primary key (id) attribute - * - type of the single complex primary key (embedded id) attribute - * - type of the id class - * - null if none of the above are coherent (i.e. there are multiple possibilities, or the - * primary key is invalid) - */ - protected String getPrimaryKeyTypeName(TypeMapping typeMapping) { - JavaPersistentType idClass = getIdClass(typeMapping); - if (idClass != null) { - return idClass.getName(); - } - EmbeddedIdMapping embeddedId = getEmbeddedIdMapping(typeMapping); - if (embeddedId != null) { - return embeddedId.getPersistentAttribute().getTypeName(); - } - IdMapping id = getIdMapping(typeMapping); - if (id != null) { - return id.getPersistentAttribute().getTypeName(); - } - return null; - } - - /** - * Return whether the attribute mapping has defined any aspect of the primary key - */ - protected boolean definesPrimaryKey(AttributeMapping attributeMapping) { - String mappingKey = attributeMapping.getKey(); - if (CollectionTools.contains(this.getIdMappingKeys(), mappingKey)) { - return true; - } - if (CollectionTools.contains(this.getSingleRelationshipMappingKeys(), mappingKey)) { - SingleRelationshipMapping2_0 relationshipMapping = (SingleRelationshipMapping2_0) attributeMapping; - return (relationshipMapping.getDerivedIdentity().usesIdDerivedIdentityStrategy() - || relationshipMapping.getDerivedIdentity().usesMapsIdDerivedIdentityStrategy()); - } - return false; - } - - protected Iterable getIdMappingKeys() { - return ID_MAPPING_KEYS; - } - - protected static final String[] ID_MAPPING_KEYS_ARRAY = new String[] { - MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, - MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY - }; - - protected static final Iterable ID_MAPPING_KEYS = new ArrayIterable(ID_MAPPING_KEYS_ARRAY); - - protected Iterable getSingleRelationshipMappingKeys() { - return SINGLE_RELATIONSHIP_MAPPING_KEYS; - } - - protected static final String[] SINGLE_RELATIONSHIP_MAPPING_KEYS_ARRAY = new String[] { - MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, - MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY - }; - - protected static final Iterable SINGLE_RELATIONSHIP_MAPPING_KEYS = new ArrayIterable(SINGLE_RELATIONSHIP_MAPPING_KEYS_ARRAY); - - - // **************** id class ********************************************** - - protected boolean specifiesIdClass() { - return idClassReference().isSpecified(); - } - - /** - * Return whether an id class is defined on the class - * NOTE: this is different from whether an id class is *specified*. If a specified id class - * is not resolved, it is not defined. There will be a validation error to that effect. - */ - protected boolean definesIdClass(TypeMapping typeMapping) { - return getIdClass(typeMapping) != null; - } - - /** - * Return whether an ancestor class has defined an id class - */ - protected boolean definesIdClassOnAncestor(TypeMapping typeMapping) { - for (TypeMapping each : CollectionTools.iterable(typeMapping.inheritanceHierarchy())) { - if (each != typeMapping && definesIdClass(each)) { - return true; - } - } - return false; - } - - /** - * Return the id class to be used for the type mapping, whether that be locally - * or on an ancestor - */ - protected JavaPersistentType getIdClass(TypeMapping typeMapping) { - for (Iterator stream = typeMapping.inheritanceHierarchy(); stream.hasNext(); ) { - TypeMapping next = stream.next(); - if (next.getIdClass() != null) { - return next.getIdClass(); - } - } - return null; - } - - - // **************** attribute mappings in general ************************* - - protected Iterable getAttributeMappings(TypeMapping typeMapping) { - return CollectionTools.collection(typeMapping.allAttributeMappings()); - } - - /** - * Return all primary key mappings, defined on and above the type mapping - */ - protected Iterable getPrimaryKeyMappings(TypeMapping typeMapping) { - return new CompositeIterable( - getIdMappings(typeMapping), - getEmbeddedIdMappings(typeMapping), - getDerivedIdMappings(typeMapping), - getMapsIdMappings(typeMapping)); - } - - /** - * Return primary key mappings declared directly on the type mapping - */ - protected Iterable getPrimaryKeyMappingsDefinedLocally(TypeMapping typeMapping) { - return new CompositeIterable( - getIdMappingsDefinedLocally(typeMapping), - getEmbeddedIdMappingsDefinedLocally(typeMapping), - getDerivedIdMappingsDefinedLocally(typeMapping), - getMapsIdMappingsDefinedLocally(typeMapping)); - } - - protected boolean hasAnyPrimaryKeyMappings(TypeMapping typeMapping) { - return ! CollectionTools.isEmpty(getPrimaryKeyMappings(typeMapping)); - } - - // **************** id mappings ******************************************* - - protected IdMapping getIdMapping(TypeMapping typeMapping) { - Iterable idMappings = getIdMappings(typeMapping); - if (CollectionTools.size(idMappings) == 1) { - return idMappings.iterator().next(); - } - return null; - } - - protected Iterable getIdMappings(TypeMapping typeMapping) { - return new SubIterableWrapper( - typeMapping.getAllAttributeMappings(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY)); - } - - protected Iterable getIdMappingsDefinedLocally(TypeMapping typeMapping) { - return new SubIterableWrapper( - typeMapping.getAttributeMappings(MappingKeys.ID_ATTRIBUTE_MAPPING_KEY)); - } - - - // **************** embedded id mappings ********************************** - - /** - * Return whether an embedded id is defined for this class, whether that be locally - * or on an ancestor - */ - protected boolean definesEmbeddedIdMapping(TypeMapping typeMapping) { - return ! CollectionTools.isEmpty(getEmbeddedIdMappings(typeMapping)); - } - - protected EmbeddedIdMapping getEmbeddedIdMapping(TypeMapping typeMapping) { - Iterable embeddedIdMappings = getEmbeddedIdMappings(typeMapping); - if (CollectionTools.size(embeddedIdMappings) == 1) { - return embeddedIdMappings.iterator().next(); - } - return null; - } - - protected Iterable getEmbeddedIdMappings(TypeMapping typeMapping) { - return new SubIterableWrapper( - typeMapping.getAllAttributeMappings(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY)); - } - - protected Iterable getEmbeddedIdMappingsDefinedLocally(TypeMapping typeMapping) { - return new SubIterableWrapper( - typeMapping.getAttributeMappings(MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY)); - } - - - // **************** derived id mappings *********************************** - - protected Iterable getDerivedIdMappings(TypeMapping typeMapping) { - return new FilteringIterable(this.getAllSingleRelationshipMappings(typeMapping)) { - @Override - protected boolean accept(SingleRelationshipMapping2_0 o) { - return o.getDerivedIdentity().usesIdDerivedIdentityStrategy(); - } - }; - } - - protected Iterable getAllSingleRelationshipMappings(TypeMapping typeMapping) { - return new SubIterableWrapper(this.getAllSingleRelationshipMappings_(typeMapping)); - } - - @SuppressWarnings("unchecked") - protected Iterable getAllSingleRelationshipMappings_(TypeMapping typeMapping) { - return new CompositeIterable( - typeMapping.getAllAttributeMappings(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY), - typeMapping.getAllAttributeMappings(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) - ); - } - - protected Iterable getDerivedIdMappingsDefinedLocally(TypeMapping typeMapping) { - return new FilteringIterable(this.getSingleRelationshipMappings(typeMapping)) { - @Override - protected boolean accept(SingleRelationshipMapping2_0 o) { - return o.getDerivedIdentity().usesIdDerivedIdentityStrategy(); - } - }; - } - - protected Iterable getSingleRelationshipMappings(TypeMapping typeMapping) { - return new SubIterableWrapper(this.getSingleRelationshipMappings_(typeMapping)); - } - - @SuppressWarnings("unchecked") - protected Iterable getSingleRelationshipMappings_(TypeMapping typeMapping) { - return new CompositeIterable( - typeMapping.getAttributeMappings(MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY), - typeMapping.getAttributeMappings(MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY) - ); - } - - - // **************** maps id mappings ************************************** - - protected Iterable getMapsIdMappings(TypeMapping typeMapping) { - return new FilteringIterable(this.getAllSingleRelationshipMappings(typeMapping)) { - @Override - protected boolean accept(SingleRelationshipMapping2_0 o) { - return o.getDerivedIdentity().usesMapsIdDerivedIdentityStrategy(); - } - }; - } - - protected Iterable getMapsIdMappingsDefinedLocally(TypeMapping typeMapping) { - return new FilteringIterable(this.getSingleRelationshipMappings(typeMapping)) { - @Override - protected boolean accept(SingleRelationshipMapping2_0 o) { - return o.getDerivedIdentity().usesMapsIdDerivedIdentityStrategy(); - } - }; - } - - - // **************** misc ************************************************** - - /** - * Return whether an id class is required for this class - */ - protected boolean idClassIsRequired() { - // An id class is required if - // - there are multiple "simple" primary key mappings - // - or there is at least one "complex" primary key mapping - // A simple primary key mapping can be - // - an id mapping - // - a derived id relationship mapping to an entity with a simple primary key - // A complex primary key mapping can be - // - a derived id relationship mapping to an entity with a complex primary key - int simplePrimaryKeyMappingCount = - CollectionTools.size(getIdMappings(typeMapping())); - if (simplePrimaryKeyMappingCount > 1) { - return true; - } - for (SingleRelationshipMapping2_0 relationshipMapping : getDerivedIdMappings(typeMapping())) { - Entity entity = relationshipMapping.getResolvedTargetEntity(); - if (entity != null) { - if (definesComplexPrimaryKey(entity)) { - return true; - } - else { - simplePrimaryKeyMappingCount++; - } - if (simplePrimaryKeyMappingCount > 1) { - return true; - } - } - } - return false; - } - - protected boolean hasDerivedIdMappingMatchingIdClass(JavaPersistentType idClass) { - for (SingleRelationshipMapping2_0 each : getDerivedIdMappings(typeMapping())) { - String primaryKeyTypeName = getTargetEntityPrimaryKeyTypeName(each); - if (idClass.getName().equals(primaryKeyTypeName)) { - return true; - } - } - return false; - } - - protected String getTargetEntityPrimaryKeyTypeName(SingleRelationshipMapping2_0 relationshipMapping) { - Entity targetEntity = relationshipMapping.getResolvedTargetEntity(); - if (targetEntity != null) { - return getPrimaryKeyTypeName(targetEntity); - } - return null; - } - - protected String getTypeNameForIdClass(AttributeMapping attributeMapping) { - String mappingKey = attributeMapping.getKey(); - if (CollectionTools.contains(this.getIdMappingKeys(), mappingKey)) { - return attributeMapping.getPersistentAttribute().getTypeName(); - } - if (CollectionTools.contains(this.getSingleRelationshipMappingKeys(), mappingKey)) { - SingleRelationshipMapping2_0 relationshipMapping = (SingleRelationshipMapping2_0) attributeMapping; - Entity targetEntity = relationshipMapping.getResolvedTargetEntity(); - if (targetEntity != null) { - return getPrimaryKeyTypeName(targetEntity); - } - } - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTableValidator.java deleted file mode 100644 index 18b0a273bd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTableValidator.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class AbstractTableValidator - implements JptValidator -{ - - protected final PersistentAttribute persistentAttribute; - - protected final Table table; - - protected final TableTextRangeResolver textRangeResolver; - - protected AbstractTableValidator( - Table table, - TableTextRangeResolver textRangeResolver) { - this(null, table, textRangeResolver); - } - - protected AbstractTableValidator( - PersistentAttribute persistentAttribute, - Table table, - TableTextRangeResolver textRangeResolver) { - super(); - this.persistentAttribute = persistentAttribute; - this.table = table; - this.textRangeResolver = textRangeResolver; - } - - protected Table getTable() { - return this.table; - } - - protected TableTextRangeResolver getTextRangeResolver() { - return this.textRangeResolver; - } - - protected boolean isPersistentAttributeVirtual() { - return this.persistentAttribute != null && this.persistentAttribute.isVirtual(); - } - - protected String getPersistentAttributeName() { - return this.persistentAttribute.getName(); - } - - public boolean validate(List messages, IReporter reporter) { - if (this.validatesAgainstDatabase()) { - return this.validateAgainstDatabase(messages); - } - return false; - } - - protected boolean validatesAgainstDatabase() { - return this.table.validatesAgainstDatabase(); - } - - protected boolean validateAgainstDatabase(List messages) { - if ( ! this.table.catalogIsResolved()) { - messages.add(buildUnresolvedCatalogMessage()); - return false; - } - - if ( ! this.table.schemaIsResolved()) { - messages.add(buildUnresolvedSchemaMessage()); - return false; - } - - if ( ! this.table.isResolved()) { - if (this.table.getName() != null) { //if name is null, the validation will be handled elsewhere, such as the target entity is not defined - messages.add(buildUnresolvedNameMessage()); - } - return false; - } - return true; - } - - protected IMessage buildUnresolvedCatalogMessage() { - if (isPersistentAttributeVirtual()) { - return this.buildVirtualAttributeUnresolvedCatalogMessage(); - } - return this.buildUnresolvedCatalogMessage(this.getUnresolvedCatalogMessage()); - } - - protected abstract String getUnresolvedCatalogMessage(); - - protected IMessage buildUnresolvedCatalogMessage(String message) { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - message, - new String[] {this.table.getCatalog(), this.table.getName()}, - this.table, - this.textRangeResolver.getCatalogTextRange() - ); - } - - protected IMessage buildVirtualAttributeUnresolvedCatalogMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnresolvedCatalogMessage(), - new String[] {this.getPersistentAttributeName(), this.table.getCatalog(), this.table.getName()}, - this.table, - this.textRangeResolver.getCatalogTextRange() - ); - } - - protected abstract String getVirtualAttributeUnresolvedCatalogMessage(); - - protected IMessage buildUnresolvedSchemaMessage() { - if (isPersistentAttributeVirtual()) { - return this.buildVirtualAttributeUnresolvedSchemaMessage(); - } - return this.buildUnresolvedSchemaMessage(this.getUnresolvedSchemaMessage()); - } - - protected abstract String getUnresolvedSchemaMessage(); - - protected IMessage buildUnresolvedSchemaMessage(String message) { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - message, - new String[] {this.table.getSchema(), this.table.getName()}, - this.table, - this.textRangeResolver.getSchemaTextRange() - ); - } - - protected IMessage buildVirtualAttributeUnresolvedSchemaMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnresolvedSchemaMessage(), - new String[] {this.getPersistentAttributeName(), this.table.getSchema(), this.table.getName()}, - this.table, - this.textRangeResolver.getSchemaTextRange() - ); - } - - protected abstract String getVirtualAttributeUnresolvedSchemaMessage(); - - protected IMessage buildUnresolvedNameMessage() { - if (isPersistentAttributeVirtual()) { - return this.buildVirtualAttributeUnresolvedNameMessage(); - } - return this.buildUnresolvedNameMessage(this.getUnresolvedNameMessage()); - } - - protected abstract String getUnresolvedNameMessage(); - - protected IMessage buildUnresolvedNameMessage(String message) { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - message, - new String[] {this.table.getName()}, - this.table, - this.textRangeResolver.getNameTextRange() - ); - } - - protected IMessage buildVirtualAttributeUnresolvedNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnresolvedNameMessage(), - new String[] {this.getPersistentAttributeName(), this.table.getName()}, - this.table, - this.textRangeResolver.getNameTextRange() - ); - } - - protected abstract String getVirtualAttributeUnresolvedNameMessage(); - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.java deleted file mode 100644 index 88498168b8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AbstractTypeMappingValidator.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class AbstractTypeMappingValidator - implements JptValidator -{ - protected T typeMapping; - - protected JavaResourcePersistentType jrpt; - - protected TypeMappingTextRangeResolver textRangeResolver; - - - protected AbstractTypeMappingValidator( - T typeMapping, JavaResourcePersistentType jrpt, TypeMappingTextRangeResolver textRangeResolver) { - this.typeMapping = typeMapping; - this.jrpt = jrpt; - this.textRangeResolver = textRangeResolver; - } - - - public boolean validate(List messages, IReporter reporter) { - this.validateType(messages); - return true; - } - - protected abstract void validateType(List messages); - - protected boolean isMemberType() { - if (this.jrpt == null) { - return false; - } - return this.jrpt.isMemberType(); - } - - protected boolean isStaticType() { - if (this.jrpt == null) { - return false; - } - return this.jrpt.isStatic(); - } - - protected boolean isFinalType() { - if (this.jrpt == null) { - return false; - } - return this.jrpt.isFinal(); - } - - protected boolean hasPrivateNoArgConstructor() { - if (this.jrpt == null) { - return false; - } - return this.jrpt.hasPrivateNoArgConstructor(); - } - - protected boolean hasNoArgConstructor() { - if (this.jrpt == null) { - return false; - } - return this.jrpt.hasNoArgConstructor(); - } - - protected IMessage buildTypeMessage(String msgID) { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - msgID, - new String[] {this.typeMapping.getName()}, - this.typeMapping, - this.textRangeResolver.getTypeMappingTextRange() - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java deleted file mode 100644 index 1a154b80b6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideInverseJoinColumnValidator.java +++ /dev/null @@ -1,267 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.AssociationOverride; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class AssociationOverrideInverseJoinColumnValidator - extends InverseJoinColumnValidator -{ - final AssociationOverride override; - - public AssociationOverrideInverseJoinColumnValidator( - AssociationOverride override, - JoinColumn column, - JoinColumn.Owner joinColumnOwner, - JoinColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(column, joinColumnOwner, textRangeResolver, provider); - this.override = override; - } - - public AssociationOverrideInverseJoinColumnValidator( - PersistentAttribute persistentAttribute, - AssociationOverride override, - JoinColumn column, - JoinColumn.Owner joinColumnOwner, - JoinColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(persistentAttribute, column, joinColumnOwner, textRangeResolver, provider); - this.override = override; - } - - @Override - protected TableValidator buildTableValidator() { - return new AssociationOverrideInverseJoinColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider); - } - - @Override - protected IMessage buildUnresolvedNameMessage() { - return this.override.isVirtual() ? - this.buildVirtualOverrideUnresolvedNameMessage() : - super.buildUnresolvedNameMessage(); - } - - protected IMessage buildVirtualOverrideUnresolvedNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME, - new String[] { - this.override.getName(), - this.column.getName(), - this.column.getDbTable().getName() - }, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - @Override - protected IMessage buildVirtualAttributeUnresolvedNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnresolvedNameMessage(), - new String[] { - this.getPersistentAttributeName(), - this.override.getName(), - this.column.getName(), - this.column.getDbTable().getName()}, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME; - } - - @Override - public IMessage buildUnresolvedReferencedColumnNameMessage() { - return this.override.isVirtual() ? - this.buildVirtualOverrideUnresolvedReferencedColumnNameMessage() : - super.buildUnresolvedReferencedColumnNameMessage(); - } - - protected IMessage buildVirtualOverrideUnresolvedReferencedColumnNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME, - new String[] { - this.override.getName(), - this.column.getReferencedColumnName(), - this.column.getReferencedColumnDbTable().getName() - }, - this.column, - this.textRangeResolver.getReferencedColumnNameTextRange() - ); - } - - @Override - protected IMessage buildVirtualAttributeUnresolvedReferencedColumnNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnresolvedReferencedColumnNameMessage(), - new String[] { - this.getPersistentAttributeName(), - this.override.getName(), - this.column.getReferencedColumnName(), - this.column.getReferencedColumnDbTable().getName() - }, - this.column, - this.textRangeResolver.getReferencedColumnNameTextRange() - ); - } - - @Override - protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME; - } - - @Override - protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() { - return this.override.isVirtual() ? - this.buildVirtualOverrideUnspecifiedNameMultipleJoinColumnsMessage() : - super.buildUnspecifiedNameMultipleJoinColumnsMessage(); - } - - protected IMessage buildVirtualOverrideUnspecifiedNameMultipleJoinColumnsMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS, - new String[] {this.override.getName()}, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - @Override - protected IMessage buildVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(), - new String[] { - this.getPersistentAttributeName(), - this.override.getName() - }, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - @Override - protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS; - } - - @Override - protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return this.override.isVirtual() ? - this.buildVirtualOverrideUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() : - super.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(); - } - - protected IMessage buildVirtualOverrideUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS, - new String[] {this.override.getName()}, - this.column, - this.textRangeResolver.getReferencedColumnNameTextRange() - ); - } - - @Override - protected IMessage buildVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(), - new String[] { - this.getPersistentAttributeName(), - this.override.getName() - }, - this.column, - this.textRangeResolver.getReferencedColumnNameTextRange() - ); - } - - @Override - protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_INVERSE_JOIN_COLUMNS; - } - - - public class AssociationOverrideInverseJoinColumnTableValidator - extends InverseJoinColumnTableValidator - { - protected AssociationOverrideInverseJoinColumnTableValidator( - PersistentAttribute persistentAttribute, - JoinColumn column, - JoinColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(persistentAttribute, column, textRangeResolver, provider); - } - - @Override - public IMessage buildTableNotValidMessage() { - return AssociationOverrideInverseJoinColumnValidator.this.override.isVirtual() ? - this.buildVirtualOverrideColumnTableNotValidMessage() : - super.buildTableNotValidMessage(); - } - - protected IMessage buildVirtualOverrideColumnTableNotValidMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualOverrideColumnTableNotValidMessage(), - new String[] { - AssociationOverrideInverseJoinColumnValidator.this.override.getName(), - this.column.getTable(), - this.column.getName(), - this.getColumnTableDescriptionMessage() - }, - this.column, - this.textRangeResolver.getTableTextRange() - ); - } - - protected String getVirtualOverrideColumnTableNotValidMessage() { - return JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID; - } - - @Override - protected IMessage buildVirtualAttributeTableNotValidMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeColumnTableNotValidMessage(), - new String[] { - this.getPersistentAttributeName(), - AssociationOverrideInverseJoinColumnValidator.this.override.getName(), - this.column.getTable(), - this.column.getName(), - this.getColumnTableDescriptionMessage() - }, - this.column, - this.textRangeResolver.getTableTextRange() - ); - } - - @Override - protected String getVirtualAttributeColumnTableNotValidMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java deleted file mode 100644 index 20ee22bc99..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinColumnValidator.java +++ /dev/null @@ -1,269 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.AssociationOverride; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class AssociationOverrideJoinColumnValidator - extends JoinColumnValidator -{ - final AssociationOverride override; - - - public AssociationOverrideJoinColumnValidator( - AssociationOverride override, - JoinColumn column, - JoinColumn.Owner joinColumnOwner, - JoinColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(column, joinColumnOwner, textRangeResolver, provider); - this.override = override; - } - - public AssociationOverrideJoinColumnValidator( - PersistentAttribute persistentAttribute, - AssociationOverride override, - JoinColumn column, - JoinColumn.Owner joinColumnOwner, - JoinColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(persistentAttribute, column, joinColumnOwner, textRangeResolver, provider); - this.override = override; - } - - @Override - protected TableValidator buildTableValidator() { - return new AssociationOverrideJoinColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider); - } - - @Override - protected IMessage buildUnresolvedNameMessage() { - return this.override.isVirtual() ? - this.buildVirtualOverrideUnresolvedNameMessage() : - super.buildUnresolvedNameMessage(); - } - - protected IMessage buildVirtualOverrideUnresolvedNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME, - new String[] { - this.override.getName(), - this.column.getName(), - this.column.getDbTable().getName() - }, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - @Override - protected IMessage buildVirtualAttributeUnresolvedNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnresolvedNameMessage(), - new String[] { - this.getPersistentAttributeName(), - this.override.getName(), - this.column.getName(), - this.column.getDbTable().getName() - }, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_NAME; - } - - @Override - public IMessage buildUnresolvedReferencedColumnNameMessage() { - return this.override.isVirtual() ? - this.buildVirtualOverrideUnresolvedReferencedColumnNameMessage() : - super.buildUnresolvedReferencedColumnNameMessage(); - } - - protected IMessage buildVirtualOverrideUnresolvedReferencedColumnNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME, - new String[] { - this.override.getName(), - this.column.getReferencedColumnName(), - this.column.getReferencedColumnDbTable().getName() - }, - this.column, - this.textRangeResolver.getReferencedColumnNameTextRange() - ); - } - - @Override - protected IMessage buildVirtualAttributeUnresolvedReferencedColumnNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnresolvedReferencedColumnNameMessage(), - new String[] { - this.getPersistentAttributeName(), - this.override.getName(), - this.column.getReferencedColumnName(), - this.column.getReferencedColumnDbTable().getName() - }, - this.column, - this.textRangeResolver.getReferencedColumnNameTextRange() - ); - } - - @Override - protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_UNRESOLVED_NAME; - } - - @Override - protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() { - return this.override.isVirtual() ? - this.buildVirtualOverrideUnspecifiedNameMultipleJoinColumnsMessage() : - super.buildUnspecifiedNameMultipleJoinColumnsMessage(); - } - - protected IMessage buildVirtualOverrideUnspecifiedNameMultipleJoinColumnsMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS, - new String[] {this.override.getName()}, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - @Override - protected IMessage buildVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(), - new String[] { - this.getPersistentAttributeName(), - this.override.getName() - }, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - @Override - protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; - } - - @Override - protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return this.override.isVirtual() ? - this.buildVirtualOverrideUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() : - super.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(); - } - - protected IMessage buildVirtualOverrideUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS, - new String[] {this.override.getName()}, - this.column, - this.textRangeResolver.getReferencedColumnNameTextRange() - ); - } - - @Override - protected IMessage buildVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(), - new String[] { - this.getPersistentAttributeName(), - this.override.getName() - }, - this.column, - this.textRangeResolver.getReferencedColumnNameTextRange() - ); - } - - @Override - protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; - } - - - public class AssociationOverrideJoinColumnTableValidator - extends JoinColumnTableValidator - { - protected AssociationOverrideJoinColumnTableValidator( - PersistentAttribute persistentAttribute, - JoinColumn column, - JoinColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(persistentAttribute, column, textRangeResolver, provider); - } - - @Override - public IMessage buildTableNotValidMessage() { - return AssociationOverrideJoinColumnValidator.this.override.isVirtual() ? - this.buildVirtualOverrideColumnTableNotValidMessage() : - super.buildTableNotValidMessage(); - } - - protected IMessage buildVirtualOverrideColumnTableNotValidMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualOverrideColumnTableNotValidMessage(), - new String[] { - AssociationOverrideJoinColumnValidator.this.override.getName(), - this.column.getTable(), - this.column.getName(), - this.getColumnTableDescriptionMessage() - }, - this.column, - this.textRangeResolver.getTableTextRange() - ); - } - - protected String getVirtualOverrideColumnTableNotValidMessage() { - return JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID; - } - - @Override - protected IMessage buildVirtualAttributeTableNotValidMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeColumnTableNotValidMessage(), - new String[] { - this.getPersistentAttributeName(), - AssociationOverrideJoinColumnValidator.this.override.getName(), - this.column.getTable(), - this.column.getName(), - this.getColumnTableDescriptionMessage() - }, - this.column, - this.textRangeResolver.getTableTextRange() - ); - } - - @Override - protected String getVirtualAttributeColumnTableNotValidMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_JOIN_COLUMN_TABLE_NOT_VALID; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java deleted file mode 100644 index c315e08b8f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideJoinTableValidator.java +++ /dev/null @@ -1,125 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.AssociationOverride; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class AssociationOverrideJoinTableValidator extends AbstractJoinTableValidator -{ - private final AssociationOverride override; - - public AssociationOverrideJoinTableValidator( - AssociationOverride override, - JoinTable table, - TableTextRangeResolver textRangeResolver) { - super(table, textRangeResolver); - this.override = override; - } - - public AssociationOverrideJoinTableValidator( - PersistentAttribute persistentAttribute, - AssociationOverride override, - JoinTable table, - TableTextRangeResolver textRangeResolver) { - super(persistentAttribute, table, textRangeResolver); - this.override = override; - } - - @Override - protected IMessage buildUnresolvedNameMessage() { - if (this.override.isVirtual()) { - return this.buildVirtualOverrideUnresolvedNameMessage(); - } - return super.buildUnresolvedNameMessage(); - } - - protected IMessage buildVirtualOverrideUnresolvedNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_NAME, - new String[] {this.override.getName(), this.getTable().getName()}, - this.getTable(), - this.getTextRangeResolver().getNameTextRange() - ); - } - - @Override - protected IMessage buildUnresolvedCatalogMessage() { - if (this.override.isVirtual()) { - return this.buildVirtualOverrideUnresolvedCatalogMessage(); - } - return super.buildUnresolvedCatalogMessage(); - } - - protected IMessage buildVirtualOverrideUnresolvedCatalogMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_CATALOG, - new String[] {this.override.getName(), this.getTable().getCatalog()}, - this.getTable(), - this.getTextRangeResolver().getCatalogTextRange() - ); - } - - @Override - protected IMessage buildUnresolvedSchemaMessage() { - if (this.override.isVirtual()) { - return this.buildVirtualOverrideUnresolvedSchemaMessage(); - } - return super.buildUnresolvedSchemaMessage(); - } - - protected IMessage buildVirtualOverrideUnresolvedSchemaMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_JOIN_TABLE_UNRESOLVED_SCHEMA, - new String[] {this.override.getName(), this.getTable().getSchema()}, - this.getTable(), - this.getTextRangeResolver().getSchemaTextRange() - ); - } - - @Override - protected IMessage buildVirtualAttributeUnresolvedNameMessage() { - throw new UnsupportedOperationException("Nested relationship mappings with JoinTable are unsupported"); //$NON-NLS-1$ - } - - @Override - protected IMessage buildVirtualAttributeUnresolvedCatalogMessage() { - throw new UnsupportedOperationException("Nested relationship mappings with JoinTable are unsupported"); //$NON-NLS-1$ - } - - @Override - protected IMessage buildVirtualAttributeUnresolvedSchemaMessage() { - throw new UnsupportedOperationException("Nested relationship mappings with JoinTable are unsupported"); //$NON-NLS-1$ - } - - @Override - protected String getVirtualAttributeUnresolvedCatalogMessage() { - throw new UnsupportedOperationException("Nested relationship mappings with JoinTable are unsupported"); //$NON-NLS-1$ - } - - @Override - protected String getVirtualAttributeUnresolvedSchemaMessage() { - throw new UnsupportedOperationException("Nested relationship mappings with JoinTable are unsupported"); //$NON-NLS-1$ - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - throw new UnsupportedOperationException("Nested relationship mappings with JoinTable are unsupported"); //$NON-NLS-1$ - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideValidator.java deleted file mode 100644 index d0d4e0e8ce..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AssociationOverrideValidator.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.AssociationOverride; -import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; - -public class AssociationOverrideValidator - extends OverrideValidator -{ - public AssociationOverrideValidator( - AssociationOverride override, - AssociationOverrideContainer container, - OverrideTextRangeResolver textRangeResolver, - OverrideDescriptionProvider overrideDescriptionProvider) { - super(override, container, textRangeResolver, overrideDescriptionProvider); - } - - public AssociationOverrideValidator( - PersistentAttribute persistentAttribute, - AssociationOverride override, - AssociationOverrideContainer container, - OverrideTextRangeResolver textRangeResolver, - OverrideDescriptionProvider overrideDescriptionProvider) { - super(persistentAttribute, override, container, textRangeResolver, overrideDescriptionProvider); - } - - @Override - protected String getVirtualOverrideUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ASSOCIATION_OVERRIDE_INVALID_NAME; - } - - @Override - protected String getUnresolvedNameMessage() { - return JpaValidationMessages.ASSOCIATION_OVERRIDE_INVALID_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ASSOCIATION_OVERRIDE_INVALID_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideColumnValidator.java deleted file mode 100644 index 9d4b58d081..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideColumnValidator.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.AttributeOverride; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class AttributeOverrideColumnValidator - extends NamedColumnValidator -{ - final AttributeOverride override; - - public AttributeOverrideColumnValidator( - AttributeOverride override, - BaseColumn column, - BaseColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider message) { - super(column, textRangeResolver, message); - this.override = override; - } - - public AttributeOverrideColumnValidator( - PersistentAttribute persistentAttribute, - AttributeOverride override, - BaseColumn column, - BaseColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider message) { - super(persistentAttribute, column, textRangeResolver, message); - this.override = override; - } - - @Override - protected TableValidator buildTableValidator() { - return new AttributeOverrideColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider); - } - - @Override - protected IMessage buildUnresolvedNameMessage() { - return this.override.isVirtual() ? - this.buildVirtualColumnUnresolvedNameMessage() : - super.buildUnresolvedNameMessage(); - } - - protected IMessage buildVirtualColumnUnresolvedNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualOverrideUnresolvedNameMessage(), - new String[] { - this.override.getName(), - this.column.getName(), - this.column.getDbTable().getName() - }, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - protected String getVirtualOverrideUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME; - } - - @Override - protected IMessage buildVirtualAttributeUnresolvedNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnresolvedNameMessage(), - new String[] { - this.getPersistentAttributeName(), - this.override.getName(), - this.column.getName(), - this.column.getDbTable().getName() - }, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME; - } - - - public class AttributeOverrideColumnTableValidator - extends BaseColumnTableValidator - { - protected AttributeOverrideColumnTableValidator( - PersistentAttribute persistentAttribute, - BaseColumn column, - BaseColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(persistentAttribute, column, textRangeResolver, provider); - } - - @Override - public IMessage buildTableNotValidMessage() { - return AttributeOverrideColumnValidator.this.override.isVirtual() ? - this.buildVirtualOverrideColumnTableNotValidMessage() : - super.buildTableNotValidMessage(); - } - - protected IMessage buildVirtualOverrideColumnTableNotValidMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualOverrideColumnTableNotValidMessage(), - new String[] { - AttributeOverrideColumnValidator.this.override.getName(), - this.column.getTable(), - this.column.getName(), - this.getColumnTableDescriptionMessage() - }, - this.column, - this.textRangeResolver.getTableTextRange() - ); - } - - protected String getVirtualOverrideColumnTableNotValidMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID; - } - - @Override - protected IMessage buildVirtualAttributeTableNotValidMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeColumnTableNotValidMessage(), - new String[] { - this.getPersistentAttributeName(), - AttributeOverrideColumnValidator.this.override.getName(), - this.column.getTable(), - this.column.getName(), - this.getColumnTableDescriptionMessage() - }, - this.column, - this.textRangeResolver.getTableTextRange() - ); - } - - @Override - protected String getVirtualAttributeColumnTableNotValidMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideValidator.java deleted file mode 100644 index 4cc07bea91..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/AttributeOverrideValidator.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.AttributeOverride; -import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; - -public class AttributeOverrideValidator - extends OverrideValidator -{ - public AttributeOverrideValidator( - AttributeOverride override, - AttributeOverrideContainer container, - OverrideTextRangeResolver textRangeResolver, - OverrideDescriptionProvider overrideDescriptionProvider) { - super(override, container, textRangeResolver, overrideDescriptionProvider); - } - - public AttributeOverrideValidator( - PersistentAttribute persistentAttribute, - AttributeOverride override, - AttributeOverrideContainer container, - OverrideTextRangeResolver textRangeResolver, - OverrideDescriptionProvider overrideDescriptionProvider) { - super(persistentAttribute, override, container, textRangeResolver, overrideDescriptionProvider); - } - - @Override - protected String getVirtualOverrideUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_OVERRIDE_INVALID_NAME; - } - - @Override - protected String getUnresolvedNameMessage() { - return JpaValidationMessages.ATTRIBUTE_OVERRIDE_INVALID_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ATTRIBUTE_OVERRIDE_INVALID_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseColumnTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseColumnTableValidator.java deleted file mode 100644 index e05ac5aa80..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseColumnTableValidator.java +++ /dev/null @@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractNamedColumnValidator.TableValidator; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class BaseColumnTableValidator - implements TableValidator -{ - protected final PersistentAttribute persistentAttribute; - - protected final BaseColumn column; - - protected final BaseColumnTextRangeResolver textRangeResolver; - - protected final TableDescriptionProvider tableDescriptionProvider; - - - protected BaseColumnTableValidator( - PersistentAttribute persistentAttribute, - BaseColumn column, - BaseColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider tableDescriptionProvider) { - super(); - this.persistentAttribute = persistentAttribute; - this.column = column; - this.textRangeResolver = textRangeResolver; - this.tableDescriptionProvider = tableDescriptionProvider; - } - - protected boolean isPersistentAttributeVirtual() { - return (this.persistentAttribute != null) && this.persistentAttribute.isVirtual(); - } - - protected String getPersistentAttributeName() { - return this.persistentAttribute.getName(); - } - - public boolean tableNameIsInvalid() { - return this.column.tableNameIsInvalid(); - } - - public boolean validate(List messages, IReporter reporter) { - messages.add(this.buildTableNotValidMessage()); - return false; - } - - public IMessage buildTableNotValidMessage() { - if (this.isPersistentAttributeVirtual()) { - return this.buildVirtualAttributeTableNotValidMessage(); - } - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getColumnTableNotValidMessage(), - new String[] { - this.column.getTable(), - this.column.getName(), - this.getColumnTableDescriptionMessage() - }, - this.column, - this.textRangeResolver.getTableTextRange() - ); - } - - protected String getColumnTableNotValidMessage() { - return JpaValidationMessages.COLUMN_TABLE_NOT_VALID; - } - - protected String getColumnTableDescriptionMessage() { - return this.tableDescriptionProvider.getColumnTableDescriptionMessage(); - } - - protected IMessage buildVirtualAttributeTableNotValidMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeColumnTableNotValidMessage(), - new String[] { - this.getPersistentAttributeName(), - this.column.getTable(), - this.column.getName(), - this.getColumnTableDescriptionMessage() - }, - this.column, - this.textRangeResolver.getTableTextRange() - ); - } - - protected String getVirtualAttributeColumnTableNotValidMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_TABLE_NOT_VALID; - } - - public static interface TableDescriptionProvider { - String getColumnTableDescriptionMessage(); - } - - public static class NullTableDescriptionProvider implements TableDescriptionProvider { - public String getColumnTableDescriptionMessage() { - throw new UnsupportedOperationException(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java deleted file mode 100644 index 8867a28110..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/BaseJoinColumnValidator.java +++ /dev/null @@ -1,177 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import java.util.List; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.context.BaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public abstract class BaseJoinColumnValidator - extends AbstractNamedColumnValidator -{ - private final BaseJoinColumn.Owner joinColumnOwner; - - protected BaseJoinColumnValidator( - C column, - BaseJoinColumn.Owner joinColumnOwner, - R textRangeResolver, - TableDescriptionProvider provider) { - super(column, textRangeResolver, provider); - this.joinColumnOwner = joinColumnOwner; - } - - protected BaseJoinColumnValidator( - PersistentAttribute persistentAttribute, - C column, - BaseJoinColumn.Owner joinColumnOwner, - R textRangeResolver, - TableDescriptionProvider provider) { - super(persistentAttribute, column, textRangeResolver, provider); - this.joinColumnOwner = joinColumnOwner; - } - - @Override - //this method will only be called if the table validates correctly - protected void validateName(List messages) { - this.validateJoinColumnName(messages); - this.validateReferencedColumnName(messages); - } - - protected void validateJoinColumnName(List messages) { - if ((this.column.getSpecifiedName() == null) && (this.joinColumnOwner.joinColumnsSize() > 1)) { - messages.add(this.buildUnspecifiedNameMultipleJoinColumnsMessage()); - } - else if (this.column.getName() != null){ - super.validateName(messages); - } - //If the name is null and there is only one join-column, one of these validation messages will apply - // 1. target entity does not have a primary key - // 2. target entity is not specified - // 3. target entity is not an entity - } - - protected void validateReferencedColumnName(List messages) { - if ((this.column.getSpecifiedReferencedColumnName() == null) && (this.joinColumnOwner.joinColumnsSize() > 1)) { - messages.add(this.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage()); - } - //bug 315292 is the reason we are only validating if there is a specified referenced column name - else if (this.column.getSpecifiedReferencedColumnName() != null) { - if ((this.column.getReferencedColumnDbTable() != null) && ! this.column.referencedColumnIsResolved()) { - messages.add(this.buildUnresolvedReferencedColumnNameMessage()); - } - } - //If the referenced column name is null and there is only one join-column, one of these validation messages will apply - // 1. target entity does not have a primary key - // 2. target entity is not specified - // 3. target entity is not an entity - } - - protected IMessage buildUnresolvedReferencedColumnNameMessage() { - return this.isPersistentAttributeVirtual() ? - this.buildVirtualAttributeUnresolvedReferencedColumnNameMessage() : - this.buildUnresolvedReferencedColumnNameMessage(this.getUnresolvedReferencedColumnNameMessage()); - } - - protected abstract String getUnresolvedReferencedColumnNameMessage(); - - protected IMessage buildUnresolvedReferencedColumnNameMessage(String message) { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - message, - new String[] { - this.column.getReferencedColumnName(), - this.column.getReferencedColumnDbTable().getName() - }, - this.column, - this.textRangeResolver.getReferencedColumnNameTextRange() - ); - } - - protected IMessage buildVirtualAttributeUnresolvedReferencedColumnNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnresolvedReferencedColumnNameMessage(), - new String[] { - this.getPersistentAttributeName(), - this.column.getReferencedColumnName(), - this.column.getReferencedColumnDbTable().getName() - }, - this.column, - this.textRangeResolver.getReferencedColumnNameTextRange() - ); - } - - protected abstract String getVirtualAttributeUnresolvedReferencedColumnNameMessage(); - - protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() { - return this.isPersistentAttributeVirtual() ? - this.buildVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() : - this.buildUnspecifiedNameMultipleJoinColumnsMessage(this.getUnspecifiedNameMultipleJoinColumnsMessage()); - } - - protected abstract String getUnspecifiedNameMultipleJoinColumnsMessage(); - - protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage(String message) { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - message, - StringTools.EMPTY_STRING_ARRAY, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - protected IMessage buildVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(), - new String[] {this.getPersistentAttributeName()}, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - protected abstract String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage(); - - protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return this.isPersistentAttributeVirtual() ? - this.buildVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() : - this.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(this.getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage()); - } - - protected abstract String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(); - - protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(String message) { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - message, - StringTools.EMPTY_STRING_ARRAY, - this.column, - this.textRangeResolver.getReferencedColumnNameTextRange() - ); - } - - protected IMessage buildVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(), - new String[] {this.getPersistentAttributeName()}, - this.column, - this.textRangeResolver.getReferencedColumnNameTextRange() - ); - } - - protected abstract String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java deleted file mode 100644 index 3a771f49a2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/CollectionTableTableDescriptionProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; - -public class CollectionTableTableDescriptionProvider implements TableDescriptionProvider -{ - public String getColumnTableDescriptionMessage() { - return JpaValidationDescriptionMessages.DOES_NOT_MATCH_COLLECTION_TABLE; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/DiscriminatorColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/DiscriminatorColumnValidator.java deleted file mode 100644 index 28b4c7c6f0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/DiscriminatorColumnValidator.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; - -public class DiscriminatorColumnValidator - extends AbstractNamedColumnValidator -{ - public DiscriminatorColumnValidator( - NamedColumn namedColumn, - NamedColumnTextRangeResolver textRangeResolver) { - super(namedColumn, textRangeResolver); - } - - @Override - protected String getUnresolvedNameMessage() { - return JpaValidationMessages.DISCRIMINATOR_COLUMN_UNRESOLVED_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EmbeddableOverrideDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EmbeddableOverrideDescriptionProvider.java deleted file mode 100644 index 615e1c2ed0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EmbeddableOverrideDescriptionProvider.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.internal.jpa1.context.OverrideValidator.OverrideDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; - -public class EmbeddableOverrideDescriptionProvider implements OverrideDescriptionProvider -{ - public String getOverrideDescriptionMessage() { - return JpaValidationDescriptionMessages.ON_EMBEDDABLE; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityPrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityPrimaryKeyJoinColumnValidator.java deleted file mode 100644 index a0d355339e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityPrimaryKeyJoinColumnValidator.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.BaseJoinColumn; -import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver; - -public class EntityPrimaryKeyJoinColumnValidator - extends PrimaryKeyJoinColumnValidator -{ - public EntityPrimaryKeyJoinColumnValidator( - BaseJoinColumn column, - BaseJoinColumn.Owner owner, - BaseJoinColumnTextRangeResolver textRangeResolver) { - super(column, owner, textRangeResolver); - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - throw new UnsupportedOperationException(); - } - - @Override - protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() { - throw new UnsupportedOperationException(); - } - - @Override - protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() { - throw new UnsupportedOperationException(); - } - - @Override - protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityTableDescriptionProvider.java deleted file mode 100644 index 9b77915c89..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/EntityTableDescriptionProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; - -public class EntityTableDescriptionProvider implements TableDescriptionProvider -{ - public String getColumnTableDescriptionMessage() { - return JpaValidationDescriptionMessages.NOT_VALID_FOR_THIS_ENTITY; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericEntityPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericEntityPrimaryKeyValidator.java deleted file mode 100644 index 8ce6e54411..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericEntityPrimaryKeyValidator.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver; - -public class GenericEntityPrimaryKeyValidator - extends AbstractEntityPrimaryKeyValidator -{ - public GenericEntityPrimaryKeyValidator(Entity entity, PrimaryKeyTextRangeResolver textRangeResolver) { - super(entity, textRangeResolver); - } - - @Override - protected boolean idClassIsRequired() { - //Short circuit check for idClassIsRequired if any part of the primary key is defined - //in a superclass for Generic types. Other validation will exist and needs to be - //addressed first - if(definesPrimaryKeyOnAncestor(typeMapping())){ - return false; - } - return super.idClassIsRequired(); - } - -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericMappedSuperclassPrimaryKeyValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericMappedSuperclassPrimaryKeyValidator.java deleted file mode 100644 index b500925d93..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericMappedSuperclassPrimaryKeyValidator.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.MappedSuperclass; -import org.eclipse.jpt.jpa.core.internal.context.PrimaryKeyTextRangeResolver; - -public class GenericMappedSuperclassPrimaryKeyValidator extends - AbstractMappedSuperclassPrimaryKeyValidator { - - public GenericMappedSuperclassPrimaryKeyValidator(MappedSuperclass mappedSuperclass, PrimaryKeyTextRangeResolver textRangeResolver) { - super(mappedSuperclass, textRangeResolver); - } - - @Override - protected boolean idClassIsRequired() { - //Short circuit check for idClassIsRequired if any part of the primary key is defined - //in a superclass for Generic types. Other validation will exist and needs to be - //addressed first - if(definesPrimaryKeyOnAncestor(typeMapping())){ - return false; - } - return super.idClassIsRequired(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericPersistentAttributeValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericPersistentAttributeValidator.java deleted file mode 100644 index 8cee29d41a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericPersistentAttributeValidator.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import java.util.List; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.PersistentAttributeTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class GenericPersistentAttributeValidator - extends AbstractPersistentAttributeValidator -{ - public GenericPersistentAttributeValidator( - PersistentAttribute persistentAttribute, JavaPersistentAttribute javaPersistentAttribute, PersistentAttributeTextRangeResolver textRangeResolver) - { - super(persistentAttribute, javaPersistentAttribute, textRangeResolver); - } - - @Override - protected void validateAttribute(List messages) { - if (this.persistentAttribute.getMappingKey() == MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY) { - return; - } - - if (this.isFieldAttribute()) { - if (this.isFinalAttribute()) { - messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_FIELD)); - } - if (this.isPublicAttribute()) { - messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_PUBLIC_FIELD)); - } - } - else if (this.isPropertyAttribute()) { - //TODO need to check both the getter and the setter - if (this.isFinalAttribute()) { - messages.add(this.buildAttributeMessage(JpaValidationMessages.PERSISTENT_ATTRIBUTE_FINAL_GETTER)); - } - } - } - - protected IMessage buildAttributeMessage(String msgID) { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - msgID, - new String[] {this.persistentAttribute.getName()}, - this.persistentAttribute, - this.textRangeResolver.getAttributeTextRange() - ); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java deleted file mode 100644 index cee97f3904..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericRootContextNode.java +++ /dev/null @@ -1,294 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import java.util.List; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IResource; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.HashBag; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.MappingFileRoot; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.jpt.jpa.core.internal.context.AbstractJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.JpaRootContextNode2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceXml2_0; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; -import org.eclipse.jst.j2ee.model.internal.validation.ValidationCancelledException; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * the context model root - */ -public class GenericRootContextNode - extends AbstractJpaContextNode - implements JpaRootContextNode2_0 -{ - /* This object has no parent, so it must point to the JPA project explicitly. */ - protected final JpaProject jpaProject; - - /* Main context object. */ - protected PersistenceXml persistenceXml; - - - public GenericRootContextNode(JpaProject jpaProject) { - super(null); // the JPA project is not really a "parent"... - - if (jpaProject == null) { - throw new NullPointerException(); - } - this.jpaProject = jpaProject; - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncPersistenceXml(); - } - - @Override - public void update() { - super.update(); - this.updatePersistenceXml(); - } - - - // ********** persistence.xml ********** - - public PersistenceXml getPersistenceXml() { - return this.persistenceXml; - } - - protected void setPersistenceXml(PersistenceXml persistenceXml) { - PersistenceXml old = this.persistenceXml; - this.persistenceXml = persistenceXml; - this.firePropertyChanged(PERSISTENCE_XML_PROPERTY, old, persistenceXml); - } - - protected void syncPersistenceXml() { - if (this.persistenceXml != null) { - this.persistenceXml.synchronizeWithResourceModel(); - } - } - - /** - * Check whether the XML resource has either appeared or disappeared. - * If it is still present, it will be the same instance. - */ - protected void updatePersistenceXml() { - JpaXmlResource xmlResource = this.resolvePersistenceXmlResource(); - if (xmlResource == null) { - if (this.persistenceXml != null) { - this.persistenceXml.dispose(); - this.setPersistenceXml(null); - } - } else { - if (this.persistenceXml == null) { - this.setPersistenceXml(this.buildPersistenceXml(xmlResource)); - } else { - this.persistenceXml.update(); - } - } - } - - protected JpaXmlResource resolvePersistenceXmlResource() { - JpaXmlResource xmlResource = this.jpaProject.getPersistenceXmlResource(); - if (xmlResource == null) { - return null; - } - if (xmlResource.isReverting()) { - // 308254 - this can happen when persistence.xml is closed without saving; - // the model is completely whacked in another thread - so wipe our model(?) - return null; - } - JptResourceType resourceType = xmlResource.getResourceType(); - if (resourceType == null) { - return null; - } - if ( ! this.getJpaPlatform().supportsResourceType(resourceType)) { - return null; - } - return xmlResource; - } - - protected PersistenceXml buildPersistenceXml(JpaXmlResource xmlResource) { - return this.getJpaFactory().buildPersistenceXml(this, xmlResource); - } - - - // ********** misc ********** - - @Override - protected boolean requiresParent() { - return false; - } - - @Override - public void stateChanged() { - super.stateChanged(); - // forward to JPA project - this.jpaProject.stateChanged(); - } - - @Override - public JpaProject getJpaProject() { - return this.jpaProject; - } - - @Override - public IResource getResource() { - return this.getProject(); - } - - protected IProject getProject() { - return this.jpaProject.getProject(); - } - - @Override - public PersistenceUnit getPersistenceUnit() { - return null; - } - - @Override - public MappingFileRoot getMappingFileRoot() { - return null; - } - - - // ********** metamodel ********** - - public void initializeMetamodel() { - if (this.persistenceXml != null) { - ((PersistenceXml2_0) this.persistenceXml).initializeMetamodel(); - } - } - - public void synchronizeMetamodel() { - if (this.persistenceXml != null) { - ((PersistenceXml2_0) this.persistenceXml).synchronizeMetamodel(); - } - } - - public void disposeMetamodel() { - if (this.persistenceXml != null) { - ((PersistenceXml2_0) this.persistenceXml).disposeMetamodel(); - } - } - - - // ********** validation ********** - - public void validate(List messages, IReporter reporter) { - if (reporter.isCancelled()) { - throw new ValidationCancelledException(); - } - - if (this.persistenceXml == null) { - messages.add(buildPersistenceXmlValidationMessage()); - return; - } - if ( ! this.jpaProject.discoversAnnotatedClasses()) { - this.validateOrphanClasses(messages); - } - this.persistenceXml.validate(messages, reporter); - } - - protected IMessage buildPersistenceXmlValidationMessage() { - int severity = IMessage.HIGH_SEVERITY; - IFile file = getPlatformFile(); - if (file != null && file.exists()) { - JpaXmlResource xmlResource = this.jpaProject.getPersistenceXmlResource(); - if (xmlResource != null - && ! getJpaPlatform().supportsResourceType(xmlResource.getResourceType())) { - return DefaultJpaValidationMessages.buildMessage( - severity, - JpaValidationMessages.PERSISTENCE_XML_UNSUPPORTED_CONTENT, - file); - } - return DefaultJpaValidationMessages.buildMessage( - severity, - JpaValidationMessages.PERSISTENCE_XML_INVALID_CONTENT, - file); - } - return DefaultJpaValidationMessages.buildMessage( - severity, - JpaValidationMessages.PROJECT_NO_PERSISTENCE_XML, - this); - } - - protected IFile getPlatformFile() { - return this.jpaProject.getPlatformFile(JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH); - } - - protected void validateOrphanClasses(List messages) { - Persistence persistence = this.persistenceXml.getPersistence(); - if (persistence == null) { - return; // handled with other validation - } - if (persistence.persistenceUnitsSize() != 1) { - return; // the context model currently only supports 1 persistence unit - } - - PersistenceUnit persistenceUnit = persistence.persistenceUnits().next(); - HashBag annotatedClassNames = CollectionTools.bag(this.jpaProject.annotatedJavaSourceClassNames()); - HashBag orphans = annotatedClassNames.clone(); - for (String annotatedClassName : annotatedClassNames) { - if (persistenceUnit.specifiesPersistentType(annotatedClassName)) { - orphans.remove(annotatedClassName); - } - } - - // TODO remove 'jrcu' - // replace jrcu.getFile() with jrpt.getFile() - // replace jrpt.getMappingAnnotation().getTextRange(jrcu.buildASTRoot()) - // with jrpt.getMappingAnnotation().getTextRange() - // (new method #getTextRange() ?) - for (String orphan : orphans) { - JavaResourcePersistentType jrpt = this.jpaProject.getJavaResourcePersistentType(orphan); - JavaResourceCompilationUnit jrcu = jrpt.getJavaResourceCompilationUnit(); - if (jrpt.isMapped()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENT_TYPE_MAPPED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT, - new String[] {jrpt.getQualifiedName()}, - jrpt.getFile(), - jrpt.getNameTextRange(jrcu.buildASTRoot()) - ) - ); - } - else { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - JpaValidationMessages.PERSISTENT_TYPE_ANNOTATED_BUT_NOT_INCLUDED_IN_PERSISTENCE_UNIT, - new String[] {jrpt.getName()}, - jrpt.getFile(), - jrpt.getNameTextRange(jrcu.buildASTRoot()) - ) - ); - } - } - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java deleted file mode 100644 index 6a2ab46d5d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/GenericTypeMappingValidator.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class GenericTypeMappingValidator - extends AbstractTypeMappingValidator -{ - public GenericTypeMappingValidator(TypeMapping typeMapping, JavaResourcePersistentType jrpt, TypeMappingTextRangeResolver textRangeResolver) { - super(typeMapping, jrpt, textRangeResolver); - } - - @Override - protected void validateType(List messages) { - if (this.isFinalType()) { - messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_FINAL_CLASS)); - } - if (this.isMemberType()) { - messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_MEMBER_CLASS)); - } - if (this.hasNoArgConstructor()) { - if (this.hasPrivateNoArgConstructor()) { - messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_CLASS_PRIVATE_NO_ARG_CONSTRUCTOR)); - } - } - else { - messages.add(this.buildTypeMessage(JpaValidationMessages.TYPE_MAPPING_CLASS_MISSING_NO_ARG_CONSTRUCTOR)); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/InverseJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/InverseJoinColumnValidator.java deleted file mode 100644 index bad52f726d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/InverseJoinColumnValidator.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; - -public class InverseJoinColumnValidator - extends BaseJoinColumnValidator -{ - public InverseJoinColumnValidator( - JoinColumn column, - JoinColumn.Owner joinColumnOwner, - JoinColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(column, joinColumnOwner, textRangeResolver, provider); - } - - public InverseJoinColumnValidator( - PersistentAttribute persistentAttribute, - JoinColumn column, - JoinColumn.Owner joinColumnOwner, - JoinColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(persistentAttribute, column, joinColumnOwner, textRangeResolver, provider); - } - - @Override - protected TableValidator buildTableValidator() { - return new InverseJoinColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider); - } - - @Override - protected String getUnresolvedNameMessage() { - return JpaValidationMessages.INVERSE_JOIN_COLUMN_UNRESOLVED_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_UNRESOLVED_NAME; - } - - @Override - protected String getUnresolvedReferencedColumnNameMessage() { - return JpaValidationMessages.INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME; - } - - @Override - protected String getUnspecifiedNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; - } - - @Override - protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; - } - - @Override - protected String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; - } - - @Override - protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; - } - - public static class InverseJoinColumnTableValidator - extends BaseColumnTableValidator - { - public InverseJoinColumnTableValidator( - PersistentAttribute persistentAttribute, - JoinColumn column, - JoinColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(persistentAttribute, column, textRangeResolver, provider); - } - - @Override - protected String getColumnTableNotValidMessage() { - return JpaValidationMessages.INVERSE_JOIN_COLUMN_TABLE_NOT_VALID; - } - - @Override - protected String getVirtualAttributeColumnTableNotValidMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_INVERSE_JOIN_COLUMN_TABLE_NOT_VALID; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinColumnValidator.java deleted file mode 100644 index 9fa255dafb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinColumnValidator.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; - -public class JoinColumnValidator - extends BaseJoinColumnValidator -{ - public JoinColumnValidator( - JoinColumn column, - JoinColumn.Owner joinColumnOwner, - JoinColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(column, joinColumnOwner, textRangeResolver, provider); - } - - public JoinColumnValidator( - PersistentAttribute persistentAttribute, - JoinColumn column, - JoinColumn.Owner joinColumnOwner, - JoinColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(persistentAttribute, column, joinColumnOwner, textRangeResolver, provider); - } - - @Override - protected TableValidator buildTableValidator() { - return new JoinColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider); - } - - @Override - protected String getUnresolvedNameMessage() { - return JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_NAME; - } - - @Override - protected String getUnresolvedReferencedColumnNameMessage() { - return JpaValidationMessages.JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME; - } - - @Override - protected String getUnspecifiedNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; - } - - @Override - protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; - } - - @Override - protected String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; - } - - @Override - protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; - } - - public static class JoinColumnTableValidator - extends BaseColumnTableValidator - { - public JoinColumnTableValidator( - PersistentAttribute persistentAttribute, - JoinColumn column, - JoinColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(persistentAttribute, column, textRangeResolver, provider); - } - - @Override - protected String getColumnTableNotValidMessage() { - return JpaValidationMessages.JOIN_COLUMN_TABLE_NOT_VALID; - } - - @Override - protected String getVirtualAttributeColumnTableNotValidMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_COLUMN_TABLE_NOT_VALID; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java deleted file mode 100644 index d2b27a49f7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableTableDescriptionProvider.java +++ /dev/null @@ -1,12 +0,0 @@ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; - -public class JoinTableTableDescriptionProvider implements TableDescriptionProvider -{ - public String getColumnTableDescriptionMessage() { - return JpaValidationDescriptionMessages.DOES_NOT_MATCH_JOIN_TABLE; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableValidator.java deleted file mode 100644 index 352204fe2a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/JoinTableValidator.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; - -public class JoinTableValidator extends AbstractJoinTableValidator -{ - public JoinTableValidator(JoinTable table, TableTextRangeResolver textRangeResolver) { - super(table, textRangeResolver); - } - - public JoinTableValidator(PersistentAttribute persistentAttribute, JoinTable table, TableTextRangeResolver textRangeResolver) { - super(persistentAttribute, table, textRangeResolver); - } - - @Override - protected String getVirtualAttributeUnresolvedCatalogMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_CATALOG; - } - - @Override - protected String getVirtualAttributeUnresolvedSchemaMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_SCHEMA; - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_JOIN_TABLE_UNRESOLVED_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java deleted file mode 100644 index 34ddf7ba46..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideColumnValidator.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.AttributeOverride; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; - -public class MapKeyAttributeOverrideColumnValidator - extends AttributeOverrideColumnValidator -{ - public MapKeyAttributeOverrideColumnValidator( - AttributeOverride override, - BaseColumn column, - BaseColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(override, column, textRangeResolver, provider); - } - - public MapKeyAttributeOverrideColumnValidator( - PersistentAttribute persistentAttribute, - AttributeOverride override, - BaseColumn column, - BaseColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(persistentAttribute, override, column, textRangeResolver, provider); - } - - @Override - protected TableValidator buildTableValidator() { - return new MapKeyAttributeOverrideColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider); - } - - @Override - protected String getVirtualOverrideUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_UNRESOLVED_NAME; - } - - - public class MapKeyAttributeOverrideColumnTableValidator - extends AttributeOverrideColumnTableValidator - { - protected MapKeyAttributeOverrideColumnTableValidator( - PersistentAttribute persistentAttribute, - BaseColumn column, - BaseColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(persistentAttribute, column, textRangeResolver, provider); - } - - @Override - protected String getVirtualOverrideColumnTableNotValidMessage() { - return JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID; - } - - @Override - protected String getVirtualAttributeColumnTableNotValidMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_COLUMN_TABLE_NOT_VALID; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java deleted file mode 100644 index 9f6b16d93e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyAttributeOverrideValidator.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.AttributeOverride; -import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; - -public class MapKeyAttributeOverrideValidator - extends AttributeOverrideValidator -{ - public MapKeyAttributeOverrideValidator( - AttributeOverride override, - AttributeOverrideContainer container, - OverrideTextRangeResolver textRangeResolver, - OverrideDescriptionProvider overrideDescriptionProvider) { - super(override, container, textRangeResolver, overrideDescriptionProvider); - } - - public MapKeyAttributeOverrideValidator( - PersistentAttribute persistentAttribute, - AttributeOverride override, - AttributeOverrideContainer container, - OverrideTextRangeResolver textRangeResolver, - OverrideDescriptionProvider overrideDescriptionProvider) { - super(persistentAttribute, override, container, textRangeResolver, overrideDescriptionProvider); - } - - @Override - protected String getVirtualOverrideUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_MAP_KEY_ATTRIBUTE_OVERRIDE_INVALID_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_ATTRIBUTE_OVERRIDE_INVALID_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyColumnValidator.java deleted file mode 100644 index ce044fed43..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MapKeyColumnValidator.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; - -public class MapKeyColumnValidator - extends AbstractNamedColumnValidator -{ - - public MapKeyColumnValidator( - BaseColumn column, - BaseColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(column, textRangeResolver, provider); - } - - public MapKeyColumnValidator( - PersistentAttribute persistentAttribute, - BaseColumn column, - BaseColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(persistentAttribute, column, textRangeResolver, provider); - } - - @Override - protected TableValidator buildTableValidator() { - return new MapKeyColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider); - } - - @Override - protected String getUnresolvedNameMessage() { - return JpaValidationMessages.MAP_KEY_COLUMN_UNRESOLVED_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_UNRESOLVED_NAME; - } - - public static class MapKeyColumnTableValidator - extends BaseColumnTableValidator - { - protected MapKeyColumnTableValidator( - PersistentAttribute persistentAttribute, - BaseColumn column, - BaseColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(persistentAttribute, column, textRangeResolver, provider); - } - - @Override - protected String getColumnTableNotValidMessage() { - return JpaValidationMessages.MAP_KEY_COLUMN_TABLE_NOT_VALID; - } - - @Override - protected String getVirtualAttributeColumnTableNotValidMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_MAP_KEY_COLUMN_TABLE_NOT_VALID; - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MappedSuperclassOverrideDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MappedSuperclassOverrideDescriptionProvider.java deleted file mode 100644 index 71a7dc083e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/MappedSuperclassOverrideDescriptionProvider.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.internal.jpa1.context.OverrideValidator.OverrideDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; - -public class MappedSuperclassOverrideDescriptionProvider implements OverrideDescriptionProvider -{ - public String getOverrideDescriptionMessage() { - return JpaValidationDescriptionMessages.ON_MAPPED_SUPERCLASS; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/NamedColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/NamedColumnValidator.java deleted file mode 100644 index 76a6fd5513..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/NamedColumnValidator.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; - -public class NamedColumnValidator - extends AbstractNamedColumnValidator -{ - - public NamedColumnValidator( - BaseColumn column, - BaseColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(column, textRangeResolver, provider); - } - - public NamedColumnValidator( - PersistentAttribute persistentAttribute, - BaseColumn column, - BaseColumnTextRangeResolver textRangeResolver, - TableDescriptionProvider provider) { - super(persistentAttribute, column, textRangeResolver, provider); - } - - @Override - protected TableValidator buildTableValidator() { - return new BaseColumnTableValidator(this.persistentAttribute, this.column, this.textRangeResolver, this.tableDescriptionProvider); - } - - @Override - protected String getUnresolvedNameMessage() { - return JpaValidationMessages.COLUMN_UNRESOLVED_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLUMN_UNRESOLVED_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java deleted file mode 100644 index 579b90c317..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OneToOnePrimaryKeyJoinColumnValidator.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.BaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; - -public class OneToOnePrimaryKeyJoinColumnValidator - extends PrimaryKeyJoinColumnValidator -{ - public OneToOnePrimaryKeyJoinColumnValidator( - BaseJoinColumn column, - BaseJoinColumn.Owner owner, - BaseJoinColumnTextRangeResolver textRangeResolver) { - super(column, owner, textRangeResolver); - } - - public OneToOnePrimaryKeyJoinColumnValidator( - PersistentAttribute persistentAttribute, - BaseJoinColumn column, - BaseJoinColumn.Owner owner, - BaseJoinColumnTextRangeResolver textRangeResolver) { - super(persistentAttribute, column, owner, textRangeResolver); - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME; - } - - @Override - protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; - } - - @Override - protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OverrideValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OverrideValidator.java deleted file mode 100644 index 5e78c6a6ba..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/OverrideValidator.java +++ /dev/null @@ -1,144 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import java.util.List; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.context.OverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public abstract class OverrideValidator - implements JptValidator -{ - protected final PersistentAttribute persistentAttribute; - - protected final Override_ override; - - protected final OverrideContainer container; - - protected final OverrideTextRangeResolver textRangeResolver; - - protected final OverrideDescriptionProvider overrideDescriptionProvider; - - protected OverrideValidator( - Override_ override, - OverrideContainer container, - OverrideTextRangeResolver textRangeResolver, - OverrideDescriptionProvider overrideDescriptionProvider) { - this(null, override, container, textRangeResolver, overrideDescriptionProvider); - } - - - protected OverrideValidator( - PersistentAttribute persistentAttribute, - Override_ override, - OverrideContainer container, - OverrideTextRangeResolver textRangeResolver, - OverrideDescriptionProvider overrideDescriptionProvider) { - this.persistentAttribute = persistentAttribute; - this.override = override; - this.container = container; - this.textRangeResolver = textRangeResolver; - this.overrideDescriptionProvider = overrideDescriptionProvider; - } - - protected boolean persistentAttributeIsVirtual() { - return (this.persistentAttribute != null) && this.persistentAttribute.isVirtual(); - } - - protected String getPersistentAttributeName() { - return this.persistentAttribute.getName(); - } - - protected String getOverrideDescriptionMessage() { - return this.overrideDescriptionProvider.getOverrideDescriptionMessage(); - } - - public boolean validate(List messages, IReporter reporter) { - return this.validateName(messages); - } - - protected boolean validateName(List messages) { - if ( ! CollectionTools.contains(this.container.allOverridableNames(), this.override.getName())) { - messages.add(this.buildUnresolvedNameMessage()); - return false; - } - return true; - } - - protected IMessage buildUnresolvedNameMessage() { - if (this.override.isVirtual()) { - return this.buildVirtualUnresolvedNameMessage(); - } - if (this.persistentAttributeIsVirtual()) { - return this.buildVirtualAttributeUnresolvedNameMessage(); - } - return this.buildUnresolvedNameMessage(this.getUnresolvedNameMessage()); - } - - protected IMessage buildVirtualUnresolvedNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualOverrideUnresolvedNameMessage(), - new String[] { - this.override.getName(), - this.getOverrideDescriptionMessage(), - this.container.getOverridableTypeMapping().getName() - }, - this.override, - this.textRangeResolver.getNameTextRange() - ); - } - - protected abstract String getVirtualOverrideUnresolvedNameMessage(); - - protected IMessage buildUnresolvedNameMessage(String message) { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - message, - new String[] { - this.override.getName(), - this.getOverrideDescriptionMessage(), - this.container.getOverridableTypeMapping().getName() - }, - this.override, - this.textRangeResolver.getNameTextRange() - ); - } - - protected abstract String getUnresolvedNameMessage(); - - protected IMessage buildVirtualAttributeUnresolvedNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - this.getVirtualAttributeUnresolvedNameMessage(), - new String[] { - this.getPersistentAttributeName(), - this.override.getName(), - this.getOverrideDescriptionMessage(), - this.container.getOverridableTypeMapping().getName() - }, - this.override, - this.textRangeResolver.getNameTextRange() - ); - } - - protected abstract String getVirtualAttributeUnresolvedNameMessage(); - - public interface OverrideDescriptionProvider { - String getOverrideDescriptionMessage(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java deleted file mode 100644 index 6317b29b16..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/PrimaryKeyJoinColumnValidator.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.BaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.NullTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public abstract class PrimaryKeyJoinColumnValidator - extends BaseJoinColumnValidator -{ - protected PrimaryKeyJoinColumnValidator( - BaseJoinColumn column, - BaseJoinColumn.Owner owner, - BaseJoinColumnTextRangeResolver textRangeResolver) { - super(column, owner, textRangeResolver, new NullTableDescriptionProvider()); - } - - protected PrimaryKeyJoinColumnValidator( - PersistentAttribute persistentAttribute, - BaseJoinColumn column, - BaseJoinColumn.Owner owner, - BaseJoinColumnTextRangeResolver textRangeResolver) { - super(persistentAttribute, column, owner, textRangeResolver, new NullTableDescriptionProvider()); - } - - @Override - public IMessage buildUnresolvedNameMessage() { - return this.column.isVirtual() ? - this.buildUnresolvedNameMessage(this.getVirtualPKJoinColumnUnresolvedNameMessage()) : - super.buildUnresolvedNameMessage(); - } - - protected String getVirtualPKJoinColumnUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME; - } - - @Override - protected IMessage buildUnresolvedReferencedColumnNameMessage() { - return this.column.isVirtual() ? - this.buildUnresolvedReferencedColumnNameMessage(this.getVirtualPKJoinColumnUnresolvedReferencedColumnNameMessage()) : - super.buildUnresolvedReferencedColumnNameMessage(); - } - - protected String getVirtualPKJoinColumnUnresolvedReferencedColumnNameMessage() { - return JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME; - } - - @Override - protected IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() { - return this.column.isVirtual() ? - this.buildUnspecifiedNameMultipleJoinColumnsMessage(this.getVirtualPKJoinColumnUnspecifiedNameMultipleJoinColumnsMessage()) : - super.buildUnspecifiedNameMultipleJoinColumnsMessage(); - } - - protected String getVirtualPKJoinColumnUnspecifiedNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; - } - - @Override - protected IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return this.column.isVirtual() ? - this.buildUnspecifiedNameMultipleJoinColumnsMessage(this.getVirtualPKJoinColumnUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage()) : - super.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(); - } - - protected String getVirtualPKJoinColumnUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.VIRTUAL_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; - } - - @Override - protected String getUnresolvedNameMessage() { - return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME; - } - - @Override - protected String getUnresolvedReferencedColumnNameMessage() { - return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME; - } - - @Override - protected String getUnspecifiedNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; - } - - @Override - protected String getUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return JpaValidationMessages.PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java deleted file mode 100644 index abe27fb5d8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/RelationshipStrategyTableDescriptionProvider.java +++ /dev/null @@ -1,29 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.RelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.BaseColumnTableValidator.TableDescriptionProvider; - -public class RelationshipStrategyTableDescriptionProvider - implements TableDescriptionProvider -{ - private final RelationshipStrategy relationshipStrategy; - - public RelationshipStrategyTableDescriptionProvider(RelationshipStrategy relationshipStrategy) { - super(); - this.relationshipStrategy = relationshipStrategy; - } - - public String getColumnTableDescriptionMessage() { - return this.relationshipStrategy.getColumnTableNotValidDescription(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java deleted file mode 100644 index 15823d3b42..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTablePrimaryKeyJoinColumnValidator.java +++ /dev/null @@ -1,136 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.BaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.SecondaryTable; -import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; - -public class SecondaryTablePrimaryKeyJoinColumnValidator - extends PrimaryKeyJoinColumnValidator -{ - private final SecondaryTable secondaryTable; - - public SecondaryTablePrimaryKeyJoinColumnValidator( - SecondaryTable secondaryTable, - BaseJoinColumn column, - BaseJoinColumn.Owner owner, - BaseJoinColumnTextRangeResolver textRangeResolver) { - super(column, owner, textRangeResolver); - this.secondaryTable = secondaryTable; - } - - protected boolean isSecondaryTableVirtual() { - return this.secondaryTable.isVirtual(); - } - - protected String getSecondaryTableName() { - return this.secondaryTable.getName(); - } - - @Override - public IMessage buildUnresolvedNameMessage() { - return this.isSecondaryTableVirtual() ? - this.buildVirtualSecondaryTableUnresolvedNameMessage() : - super.buildUnresolvedNameMessage(); - } - - protected IMessage buildVirtualSecondaryTableUnresolvedNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_NAME, - new String[] { - this.getSecondaryTableName(), - this.column.getName(), - this.column.getDbTable().getName() - }, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - throw new UnsupportedOperationException(); - } - - @Override - public IMessage buildUnresolvedReferencedColumnNameMessage() { - return this.isSecondaryTableVirtual() ? - this.buildVirtualSecondaryTableUnresolvedReferencedColumnNameMessage() : - super.buildUnresolvedReferencedColumnNameMessage(); - } - - protected IMessage buildVirtualSecondaryTableUnresolvedReferencedColumnNameMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_UNRESOLVED_REFERENCED_COLUMN_NAME, - new String[] { - this.getSecondaryTableName(), - this.column.getReferencedColumnName(), - this.column.getReferencedColumnDbTable().getName() - }, - this.column, - this.textRangeResolver.getReferencedColumnNameTextRange() - ); - } - - @Override - protected String getVirtualAttributeUnresolvedReferencedColumnNameMessage() { - throw new UnsupportedOperationException(); - } - - @Override - public IMessage buildUnspecifiedNameMultipleJoinColumnsMessage() { - return this.isSecondaryTableVirtual() ? - this.buildVirtualSecondaryTableUnspecifiedNameMultipleJoinColumnsMessage() : - super.buildUnspecifiedNameMultipleJoinColumnsMessage(); - } - - protected IMessage buildVirtualSecondaryTableUnspecifiedNameMultipleJoinColumnsMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS, - new String[] {this.getSecondaryTableName()}, - this.column, - this.textRangeResolver.getNameTextRange() - ); - } - - @Override - protected String getVirtualAttributeUnspecifiedNameMultipleJoinColumnsMessage() { - throw new UnsupportedOperationException(); - } - - @Override - public IMessage buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return this.isSecondaryTableVirtual() ? - this.buildVirtualSecondaryTableUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() : - super.buildUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage(); - } - - protected IMessage buildVirtualSecondaryTableUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_SECONDARY_TABLE_PRIMARY_KEY_JOIN_COLUMN_REFERENCED_COLUMN_NAME_MUST_BE_SPECIFIED_MULTIPLE_JOIN_COLUMNS, - new String[] {this.getSecondaryTableName()}, - this.column, - this.textRangeResolver.getReferencedColumnNameTextRange() - ); - } - - @Override - protected String getVirtualAttributeUnspecifiedReferencedColumnNameMultipleJoinColumnsMessage() { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTableValidator.java deleted file mode 100644 index 03b4df0b81..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/SecondaryTableValidator.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.SecondaryTable; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; - -public class SecondaryTableValidator extends AbstractTableValidator -{ - public SecondaryTableValidator(SecondaryTable table, TableTextRangeResolver textRangeResolver) { - super(table, textRangeResolver); - } - - @Override - public SecondaryTable getTable() { - return (SecondaryTable) super.getTable(); - } - - @Override - protected String getUnresolvedCatalogMessage() { - return JpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_CATALOG; - } - - @Override - protected String getVirtualAttributeUnresolvedCatalogMessage() { - throw new UnsupportedOperationException("No SecondaryTable annotations exist on attributes"); //$NON-NLS-1$ - } - - @Override - protected String getUnresolvedSchemaMessage() { - return JpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_SCHEMA; - } - - @Override - protected String getVirtualAttributeUnresolvedSchemaMessage() { - throw new UnsupportedOperationException("No SecondaryTable annotations exist on attributes"); //$NON-NLS-1$ - } - - @Override - protected String getUnresolvedNameMessage() { - return JpaValidationMessages.SECONDARY_TABLE_UNRESOLVED_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - throw new UnsupportedOperationException("No SecondaryTable annotations exist on attributes"); //$NON-NLS-1$ - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/TableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/TableValidator.java deleted file mode 100644 index a0dad72ed6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/TableValidator.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context; - -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; - -public class TableValidator extends AbstractTableValidator -{ - public TableValidator(Table table, TableTextRangeResolver textRangeResolver) { - super(table, textRangeResolver); - } - - @Override - protected String getUnresolvedCatalogMessage() { - return JpaValidationMessages.TABLE_UNRESOLVED_CATALOG; - } - - @Override - protected String getVirtualAttributeUnresolvedCatalogMessage() { - throw new UnsupportedOperationException("No Table annotations exist on attributes"); //$NON-NLS-1$ - } - - @Override - protected String getUnresolvedSchemaMessage() { - return JpaValidationMessages.TABLE_UNRESOLVED_SCHEMA; - } - - @Override - protected String getVirtualAttributeUnresolvedSchemaMessage() { - throw new UnsupportedOperationException("No Table annotations exist on attributes"); //$NON-NLS-1$ - } - - @Override - protected String getUnresolvedNameMessage() { - return JpaValidationMessages.TABLE_UNRESOLVED_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - throw new UnsupportedOperationException("No Table annotations exist on attributes"); //$NON-NLS-1$ - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java deleted file mode 100644 index 71d9610828..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaConverter.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaConverter; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -public abstract class AbstractJavaConverter - extends AbstractJavaJpaContextNode - implements JavaConverter -{ - protected AbstractJavaConverter(JavaAttributeMapping parent) { - super(parent); - } - - - // ********** misc ********** - - @Override - public JavaAttributeMapping getParent() { - return (JavaAttributeMapping) super.getParent(); - } - - protected JavaAttributeMapping getAttributeMapping() { - return this.getParent(); - } - - protected JavaResourcePersistentAttribute getResourcePersistentAttribute() { - return this.getAttributeMapping().getResourcePersistentAttribute(); - } - - public Annotation getConverterAnnotation() { - return this.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()); - } - - public void dispose() { - // NOP - } - - protected abstract String getAnnotationName(); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java deleted file mode 100644 index 860b447bac..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/AbstractJavaOverrideContainer.java +++ /dev/null @@ -1,587 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.VirtualOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverride; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.OverrideAnnotation; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java override container - *

- * NB: Although not typical, a Java override container can - * correspond to only a subset of the annotations in the Java source code. - * In that case, the index of a specified override must be translated to its - * corresponding annotation's index before we manipulate the annotations. - *

- * As of JPA 2.0, the only place we need these translations is for the attribute - * overrides for an embedded collection. If an embedded collection is a - * {@link java.util.Map Map}, the attribute overrides can override the mappings - * for either the map's keys or the map's values. The names of the overrides for - * the map's keys are prefixed with "key." while the overrides - * for the map's values are prefixed with "value.". - * (Just a bit of hack, courtesy of the JPA spec committee.) - */ -public abstract class AbstractJavaOverrideContainer< - O extends JavaOverrideContainer.Owner, - R extends JavaReadOnlyOverride, - S extends JavaOverride, - V extends JavaVirtualOverride, - A extends OverrideAnnotation - > - extends AbstractJavaJpaContextNode - implements JavaOverrideContainer -{ - // this can be null if the container is "read-only" (i.e. a "null" container) - protected final O owner; - - protected final Vector specifiedOverrides = new Vector(); - protected final SpecifiedOverrideContainerAdapter specifiedOverrideContainerAdapter = new SpecifiedOverrideContainerAdapter(); - - protected final Vector virtualOverrides = new Vector(); - protected final VirtualOverrideContainerAdapter virtualOverrideContainerAdapter = new VirtualOverrideContainerAdapter(); - - - protected AbstractJavaOverrideContainer(JavaJpaContextNode parent, O owner) { - super(parent); - this.owner = owner; - this.initializeSpecifiedOverrides(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncSpecifiedOverrides(); - // the virtual overrides do not need a sync - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getSpecifiedOverrides()); - this.updateVirtualOverrides(); - } - - - // ********** overrides ********** - - public ListIterator overrides() { - return this.getOverrides().iterator(); - } - - @SuppressWarnings("unchecked") - protected ListIterable getOverrides() { - return new CompositeListIterable(this.getReadOnlySpecifiedOverrides(), this.getReadOnlyVirtualOverrides()); - } - - public int overridesSize() { - return this.specifiedOverrides.size() + this.virtualOverrides.size(); - } - - public R getOverrideNamed(String name) { - return this.selectOverrideNamed(this.getOverrides(), name); - } - - - // ********** override conversions ********** - - /** - * Silently add the new virtual override before removing the - * specified override, or the update will discover the missing - * virtual override and add it preemptively. - */ - public V convertOverrideToVirtual(Override_ override) { - if (override.isVirtual()) { - throw new IllegalArgumentException("Override is already virtual: " + override); //$NON-NLS-1$ - } - - @SuppressWarnings("unchecked") - S specifiedOverride = (S) override; - int virtualIndex = this.virtualOverrides.size(); - String overrideName = specifiedOverride.getName(); - V virtualOverride = null; - // make sure the specified override actually overrides something before building the virtual override - if (this.overrideWillBeVirtual(overrideName, specifiedOverride)) { - virtualOverride = this.buildVirtualOverride(overrideName); - this.virtualOverrides.add(virtualIndex, virtualOverride); - } - - this.removeSpecifiedOverride(specifiedOverride); // trigger update - - if (virtualOverride != null) { - this.fireItemAdded(VIRTUAL_OVERRIDES_LIST, virtualIndex, virtualOverride); - } - return virtualOverride; - } - - /** - * Return whether the specified override name will be a - * virtual override when the specified specified override is - * removed from the container. The override name must be among the - * valid override names and it must not correspond to any of the - * remaining specified overrides. - */ - protected boolean overrideWillBeVirtual(String overrideName, S specifiedOverrideToBeRemoved) { - return CollectionTools.contains(this.allOverridableNames(), overrideName) && - (this.getSpecifiedOverrideNamed(overrideName, specifiedOverrideToBeRemoved) == null); - } - - /** - * Silently remove the virtual override and add the new specified - * override before naming the specified override, or the update - * will discover the dangling virtual override and remove it preemptively. - */ - public S convertOverrideToSpecified(VirtualOverride override) { - if ( ! override.isVirtual()) { - throw new IllegalArgumentException("Override is already specified: " + override); //$NON-NLS-1$ - } - - @SuppressWarnings("unchecked") - V virtualOverride = (V) override; - int virtualIndex = this.virtualOverrides.indexOf(virtualOverride); - this.virtualOverrides.remove(virtualIndex); - - int specifiedIndex = this.specifiedOverrides.size(); - S specifiedOverride = this.buildSpecifiedOverride(this.buildOverrideAnnotation(specifiedIndex)); - this.specifiedOverrides.add(specifiedIndex, specifiedOverride); - - this.initializeSpecifiedOverride(specifiedOverride, virtualOverride); // trigger update - - this.fireItemRemoved(VIRTUAL_OVERRIDES_LIST, virtualIndex, virtualOverride); - this.fireItemAdded(SPECIFIED_OVERRIDES_LIST, specifiedIndex, specifiedOverride); - return specifiedOverride; - } - - protected abstract void initializeSpecifiedOverride(S specifiedOverride, V virtualOverride); - - - // ********** specified overrides ********** - - public ListIterator specifiedOverrides() { - return this.getSpecifiedOverrides().iterator(); - } - - protected ListIterable getSpecifiedOverrides() { - return new LiveCloneListIterable(this.specifiedOverrides); - } - - @SuppressWarnings("unchecked") - protected ListIterable getReadOnlySpecifiedOverrides() { - // S should always be a subtype of R, but we can't enforce that in the - // class declaration... - return (ListIterable) this.getSpecifiedOverrides(); - } - - public int specifiedOverridesSize() { - return this.specifiedOverrides.size(); - } - - public S getSpecifiedOverride(int index) { - return this.specifiedOverrides.get(index); - } - - public S getSpecifiedOverrideNamed(String name) { - return this.getSpecifiedOverrideNamed(name, null); - } - - @SuppressWarnings("unchecked") - protected S getSpecifiedOverrideNamed(String name, S exclude) { - return (S) this.selectOverrideNamed(this.getReadOnlySpecifiedOverrides(), name, exclude); - } - - protected S addSpecifiedOverride() { - return this.addSpecifiedOverride(this.specifiedOverrides.size()); - } - - protected S addSpecifiedOverride(int index) { - A annotation = this.buildOverrideAnnotation(index); - return this.addSpecifiedOverride_(index, annotation); - } - - @SuppressWarnings("unchecked") - protected A buildOverrideAnnotation(int index) { - int annotationIndex = this.calculateNewAnnotationIndex(index); - return (A) this.getResourcePersistentMember().addAnnotation(annotationIndex, this.getOverrideAnnotationName(), this.getOverrideContainerAnnotationName()); - } - - protected int calculateNewAnnotationIndex(int index) { - // if we are adding to the end of the specified list, - // put the annotation after all the existing annotations - if (index == this.specifiedOverrides.size()) { - return CollectionTools.size(this.getOverrideAnnotations()); - } - - // if we are adding to the front of the specified list, - // put the annotation before of all the existing annotations - if (index == 0) { - return 0; - } - - // if we are adding to the middle of the specified list, - // put the annotation immediately after all the previous override's - // existing annotation - return this.translateToAnnotationIndex(index - 1) + 1; - } - - /** - * pre-condition: override exists at the specified index - */ - protected int translateToAnnotationIndex(int index) { - return CollectionTools.indexOf(this.getOverrideAnnotations(), this.specifiedOverrides.get(index).getOverrideAnnotation()); - } - - protected abstract String getOverrideAnnotationName(); - - protected abstract String getOverrideContainerAnnotationName(); - - protected void removeSpecifiedOverride(S override) { - this.removeSpecifiedOverride(this.specifiedOverrides.indexOf(override)); - } - - protected void removeSpecifiedOverride(int index) { - this.removeOverrideAnnotation(index); - this.removeSpecifiedOverride_(index); - } - - protected void removeOverrideAnnotation(int index) { - int annotationIndex = this.translateToAnnotationIndex(index); - this.getResourcePersistentMember().removeAnnotation(annotationIndex, this.getOverrideAnnotationName(), this.getOverrideContainerAnnotationName()); - } - - protected void removeSpecifiedOverride_(int index) { - this.removeItemFromList(index, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST); - } - - public void moveSpecifiedOverride(int targetIndex, int sourceIndex) { - this.moveOverrideAnnotation(targetIndex, sourceIndex); - this.moveItemInList(targetIndex, sourceIndex, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST); - } - - protected void moveOverrideAnnotation(int targetIndex, int sourceIndex) { - int targetAnnotationIndex = this.translateToAnnotationIndex(targetIndex); - int sourceAnnotationIndex = this.translateToAnnotationIndex(sourceIndex); - this.getResourcePersistentMember().moveAnnotation(targetAnnotationIndex, sourceAnnotationIndex, this.getOverrideContainerAnnotationName()); - } - - protected void initializeSpecifiedOverrides() { - for (A annotation : this.getRelevantOverrideAnnotations()) { - this.specifiedOverrides.add(this.buildSpecifiedOverride(annotation)); - } - } - - protected abstract S buildSpecifiedOverride(A overrideAnnotation); - - protected void syncSpecifiedOverrides() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedOverrideContainerAdapter); - } - - protected Iterable getRelevantOverrideAnnotations() { - return new FilteringIterable(this.getOverrideAnnotations()) { - @Override - protected boolean accept(A annotation) { - String overrideName = annotation.getName(); - return (overrideName != null) && AbstractJavaOverrideContainer.this.owner.isRelevant(overrideName); - } - }; - } - - protected Iterable getOverrideAnnotations() { - return new SubIterableWrapper( - CollectionTools.iterable(this.overrideAnnotations()) - ); - } - - protected Iterator overrideAnnotations() { - return (this.owner == null) ? EmptyIterator.instance() : this.overrideAnnotations_(); - } - - /** - * pre-condition: {@link #owner} is not null - */ - protected Iterator overrideAnnotations_() { - return this.getResourcePersistentMember().annotations(this.getOverrideAnnotationName(), this.getOverrideContainerAnnotationName()); - } - - protected void moveSpecifiedOverride_(int index, S override) { - this.moveItemInList(index, override, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST); - } - - protected S addSpecifiedOverride_(int index, A overrideAnnotation) { - S override = this.buildSpecifiedOverride(overrideAnnotation); - this.addItemToList(index, override, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST); - return override; - } - - protected void removeSpecifiedOverride_(S override) { - this.removeSpecifiedOverride_(this.specifiedOverrides.indexOf(override)); - } - - /** - * specified override container adapter - */ - protected class SpecifiedOverrideContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractJavaOverrideContainer.this.getSpecifiedOverrides(); - } - public Iterable getResourceElements() { - return AbstractJavaOverrideContainer.this.getRelevantOverrideAnnotations(); - } - @SuppressWarnings("unchecked") - public A getResourceElement(S contextElement) { - return (A) contextElement.getOverrideAnnotation(); - } - public void moveContextElement(int index, S element) { - AbstractJavaOverrideContainer.this.moveSpecifiedOverride_(index, element); - } - public void addContextElement(int index, A resourceElement) { - AbstractJavaOverrideContainer.this.addSpecifiedOverride_(index, resourceElement); - } - public void removeContextElement(S element) { - AbstractJavaOverrideContainer.this.removeSpecifiedOverride_(element); - } - } - - - // ********** virtual overrides ********** - - public ListIterator virtualOverrides() { - return this.getVirtualOverrides().iterator(); - } - - protected ListIterable getVirtualOverrides() { - return new LiveCloneListIterable(this.virtualOverrides); - } - - public int virtualOverridesSize() { - return this.virtualOverrides.size(); - } - - @SuppressWarnings("unchecked") - protected ListIterable getReadOnlyVirtualOverrides() { - // V should always be a subtype of R, but we can't enforce that in the - // class declaration... - return (ListIterable) this.getVirtualOverrides(); - } - - protected void updateVirtualOverrides() { - ContextContainerTools.update(this.virtualOverrideContainerAdapter); - } - - /** - * Return the overridable names that are not already in the list of - * specified overrides. - */ - protected Iterable getVirtualOverrideNames() { - return CollectionTools.iterable(this.virtualOverrideNames()); - } - - protected Iterator virtualOverrideNames() { - return new FilteringIterator(this.allOverridableNames()) { - @Override - protected boolean accept(String name) { - return AbstractJavaOverrideContainer.this.overrideIsVirtual(name); - } - }; - } - - protected boolean overrideIsVirtual(String name) { - return this.getSpecifiedOverrideNamed(name) == null; - } - - protected void moveVirtualOverride(int index, V override) { - this.moveItemInList(index, override, this.virtualOverrides, VIRTUAL_OVERRIDES_LIST); - } - - protected V addVirtualOverride(int index, String name) { - V override = this.buildVirtualOverride(name); - this.addItemToList(index, override, this.virtualOverrides, VIRTUAL_OVERRIDES_LIST); - return override; - } - - protected abstract V buildVirtualOverride(String name); - - protected void removeVirtualOverride(V override) { - this.removeItemFromList(override, this.virtualOverrides, VIRTUAL_OVERRIDES_LIST); - } - - /** - * virtual override container adapter - * NB: the context override is matched with a resource override by name - */ - protected class VirtualOverrideContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractJavaOverrideContainer.this.getVirtualOverrides(); - } - public Iterable getResourceElements() { - return AbstractJavaOverrideContainer.this.getVirtualOverrideNames(); - } - public String getResourceElement(V contextElement) { - return contextElement.getName(); - } - public void moveContextElement(int index, V element) { - AbstractJavaOverrideContainer.this.moveVirtualOverride(index, element); - } - public void addContextElement(int index, String resourceElement) { - AbstractJavaOverrideContainer.this.addVirtualOverride(index, resourceElement); - } - public void removeContextElement(V element) { - AbstractJavaOverrideContainer.this.removeVirtualOverride(element); - } - } - - - // ********** misc ********** - - public TypeMapping getTypeMapping() { - return this.owner.getTypeMapping(); - } - - protected JavaResourcePersistentMember getResourcePersistentMember() { - return this.owner.getResourcePersistentMember(); - } - - public TypeMapping getOverridableTypeMapping() { - return this.owner.getOverridableTypeMapping(); - } - - public Iterator allOverridableNames() { - return (this.owner != null) ? this.owner.allOverridableNames() : EmptyIterator.instance(); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.owner.tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return this.owner.candidateTableNames(); - } - - public Table resolveDbTable(String tableName) { - return this.owner.resolveDbTable(tableName); - } - - public String getDefaultTableName() { - return this.owner.getDefaultTableName(); - } - - public JptValidator buildValidator(Override_ override, OverrideTextRangeResolver textRangeResolver) { - return this.owner.buildValidator(override, this, textRangeResolver); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) { - return this.owner.buildColumnValidator(override, column, columnOwner, textRangeResolver); - } - - public String getPossiblePrefix() { - return this.owner.getPossiblePrefix(); - } - - public String getWritePrefix() { - return this.owner.getWritePrefix(); - } - - protected R selectOverrideNamed(Iterable overrides, String name) { - return this.selectOverrideNamed(overrides, name, null); - } - - protected R selectOverrideNamed(Iterable overrides, String name, S exclude) { - for (R override : overrides) { - if (override == exclude) { - continue; // skip - } - if (this.valuesAreEqual(override.getName(), name)) { - return override; - } - } - return null; - } - - - // ********** code completion ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - for (R override : this.getOverrides()) { - result = override.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - return null; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - for (R override: this.getOverrides()) { - override.validate(messages, reporter, astRoot); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - Annotation annotation = this.getValidationAnnotation(); - return (annotation != null) ? - annotation.getTextRange(astRoot) : - this.owner.getValidationTextRange(astRoot); - } - - protected Annotation getValidationAnnotation() { - JavaResourcePersistentMember resourceMember = this.getResourcePersistentMember(); - Annotation annotation = resourceMember.getAnnotation(this.getOverrideContainerAnnotationName()); - return (annotation != null) ? annotation : resourceMember.getAnnotation(this.getOverrideAnnotationName()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java deleted file mode 100644 index 16298f2d59..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJarFile.java +++ /dev/null @@ -1,238 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.Iterator; -import java.util.List; -import java.util.Vector; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IResource; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.java.JarFile; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.persistence.JarFileRef; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePackageFragmentRoot; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Context JAR file - */ -public class GenericJarFile - extends AbstractPersistenceXmlContextNode - implements JarFile, PersistentType.Owner -{ - protected final JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot; - - protected final Vector javaPersistentTypes = new Vector(); - protected final JavaPersistentTypeContainerAdapter javaPersistentTypeContainerAdapter = new JavaPersistentTypeContainerAdapter(); - - - // ********** constructor/initialization ********** - - public GenericJarFile(JarFileRef parent, JavaResourcePackageFragmentRoot jarResourcePackageFragmentRoot) { - super(parent); - this.jarResourcePackageFragmentRoot = jarResourcePackageFragmentRoot; - this.initializeJavaPersistentTypes(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncJavaPersistentTypes(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getJavaPersistentTypes()); - } - - public JavaResourcePackageFragmentRoot getJarResourcePackageFragmentRoot() { - return this.jarResourcePackageFragmentRoot; - } - - - // ********** JpaStructureNode implementation ********** - - public String getId() { - return null; - } - - public TextRange getSelectionTextRange() { - return null; - } - - public JpaStructureNode getStructureNode(int textOffset) { - return null; - } - - public void dispose() { - // nothing yet - } - - - // ********** JpaContextNode implementation ********** - - @Override - public JptResourceType getResourceType() { - return JptCommonCorePlugin.JAR_RESOURCE_TYPE; - } - - - // ********** Java persistent types ********** - - public JavaPersistentType getPersistentType(String typeName) { - for (JavaPersistentType pt : this.getJavaPersistentTypes()) { - if (pt.getName().equals(typeName)) { - return pt; - } - } - return null; - } - - public Iterator javaPersistentTypes() { - return this.getJavaPersistentTypes().iterator(); - } - - protected Iterable getJavaPersistentTypes() { - return new LiveCloneIterable(this.javaPersistentTypes); - } - - public int javaPersistentTypesSize() { - return this.javaPersistentTypes.size(); - } - - protected void initializeJavaPersistentTypes() { - for (JavaResourcePersistentType jrpt : this.getJavaResourcePersistentTypes()) { - this.javaPersistentTypes.add(this.buildJavaPersistentType(jrpt)); - } - } - - protected void syncJavaPersistentTypes() { - ContextContainerTools.synchronizeWithResourceModel(this.javaPersistentTypeContainerAdapter); - } - - protected void addJavaPersistentType(JavaResourcePersistentType jrpt) { - JavaPersistentType javaPersistentType = this.buildJavaPersistentType(jrpt); - this.addItemToCollection(javaPersistentType, this.javaPersistentTypes, JAVA_PERSISTENT_TYPES_COLLECTION); - } - - protected void removeJavaPersistentType(JavaPersistentType javaPersistentType ) { - this.removeItemFromCollection(javaPersistentType, this.javaPersistentTypes, JAVA_PERSISTENT_TYPES_COLLECTION); - } - - /** - * the resource JAR holds only annotated types, so we can use them all for - * building the context types - */ - protected Iterable getJavaResourcePersistentTypes() { - return CollectionTools.iterable(this.jarResourcePackageFragmentRoot.persistentTypes()); - } - - protected JavaPersistentType buildJavaPersistentType(JavaResourcePersistentType jrpt) { - return this.getJpaFactory().buildJavaPersistentType(this, jrpt); - } - - /** - * Java persistent type container adapter - */ - protected class JavaPersistentTypeContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericJarFile.this.getJavaPersistentTypes(); - } - public Iterable getResourceElements() { - return GenericJarFile.this.getJavaResourcePersistentTypes(); - } - public JavaResourcePersistentType getResourceElement(JavaPersistentType contextElement) { - return contextElement.getResourcePersistentType(); - } - public void moveContextElement(int index, JavaPersistentType element) { - // ignore moves - we don't care about the order of the Java persistent types - } - public void addContextElement(int index, JavaResourcePersistentType resourceElement) { - // ignore the index - we don't care about the order of the Java persistent types - GenericJarFile.this.addJavaPersistentType(resourceElement); - } - public void removeContextElement(JavaPersistentType element) { - GenericJarFile.this.removeJavaPersistentType(element); - } - } - - - // ********** PersistentTypeContainer implementation ********** - - public Iterable getPersistentTypes() { - return this.getJavaPersistentTypes(); - } - - - // ********** PersistentType.Owner implementation ********** - - public AccessType getDefaultPersistentTypeAccess() { - return this.getPersistenceUnit().getDefaultAccess(); - } - - public AccessType getOverridePersistentTypeAccess() { - // no access type at this level overrides any local access type specification - return null; - } - - - // ********** JpaNode implementation ********** - - @Override - public JarFileRef getParent() { - return (JarFileRef) super.getParent(); - } - - protected JarFileRef getJarFileRef() { - return this.getParent(); - } - - @Override - public IResource getResource() { - return this.jarResourcePackageFragmentRoot.getFile(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - // TODO validate 'javaPersistentTypes' - } - - public boolean isIn(org.eclipse.core.resources.IFolder folder) { - IResource member = folder.findMember(this.jarResourcePackageFragmentRoot.getFile().getName()); - IFile file = this.jarResourcePackageFragmentRoot.getFile(); - return member != null && file != null && member.equals(file); - } - - public TextRange getValidationTextRange() { - return this.getJarFileRef().getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java deleted file mode 100644 index ebcec5ef3e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverride.java +++ /dev/null @@ -1,122 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaOverrideRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOverride; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Specified Java association override - */ -public class GenericJavaAssociationOverride - extends AbstractJavaOverride - implements JavaAssociationOverride -{ - protected final JavaOverrideRelationship relationship; - - - public GenericJavaAssociationOverride(JavaAssociationOverrideContainer parent, AssociationOverrideAnnotation annotation) { - super(parent, annotation); - this.relationship = this.buildRelationship(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.relationship.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.relationship.update(); - } - - - // ********** specified/virtual ********** - - @Override - public JavaVirtualAssociationOverride convertToVirtual() { - return (JavaVirtualAssociationOverride) super.convertToVirtual(); - } - - - // ********** relationship ********** - - public JavaOverrideRelationship getRelationship() { - return this.relationship; - } - - protected JavaOverrideRelationship buildRelationship() { - return this.getJpaFactory().buildJavaOverrideRelationship(this); - } - - - // ********** misc ********** - - public RelationshipMapping getMapping() { - return this.getContainer().getRelationshipMapping(this.name); - } - - public void initializeFrom(ReadOnlyAssociationOverride oldOverride) { - super.initializeFrom(oldOverride); - this.relationship.initializeFrom(oldOverride.getRelationship()); - } - - public void initializeFromVirtual(ReadOnlyAssociationOverride virtualOverride) { - super.initializeFromVirtual(virtualOverride); - this.relationship.initializeFromVirtual(virtualOverride.getRelationship()); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.relationship.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - return null; - } - - @Override - protected Iterator candidateNames() { - return this.getContainer().allOverridableNames(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.relationship.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java deleted file mode 100644 index 4d672822da..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAssociationOverrideContainer.java +++ /dev/null @@ -1,91 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.AssociationOverride; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyAssociationOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation; - -/** - * Java attribute override container - */ -public class GenericJavaAssociationOverrideContainer - extends AbstractJavaOverrideContainer< - JavaAssociationOverrideContainer.Owner, - JavaReadOnlyAssociationOverride, - JavaAssociationOverride, - JavaVirtualAssociationOverride, - AssociationOverrideAnnotation - > - implements JavaAssociationOverrideContainer -{ - public GenericJavaAssociationOverrideContainer(JavaJpaContextNode parent, JavaAssociationOverrideContainer.Owner owner) { - super(parent, owner); - } - - - public RelationshipMapping getRelationshipMapping(String attributeName) { - return MappingTools.getRelationshipMapping(attributeName, this.owner.getOverridableTypeMapping()); - } - - public Relationship resolveOverriddenRelationship(String associationOverrideName) { - return this.owner.resolveOverriddenRelationship(associationOverrideName); - } - - public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, org.eclipse.jpt.jpa.core.context.JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return this.owner.buildJoinTableJoinColumnValidator(override, column, owner, textRangeResolver); - } - - public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, org.eclipse.jpt.jpa.core.context.JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return this.owner.buildJoinTableInverseJoinColumnValidator(override, column, owner, textRangeResolver); - } - - public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) { - return this.owner.buildTableValidator(override, table, textRangeResolver); - } - - @Override - protected String getOverrideAnnotationName() { - return AssociationOverrideAnnotation.ANNOTATION_NAME; - } - - @Override - protected String getOverrideContainerAnnotationName() { - return AssociationOverridesAnnotation.ANNOTATION_NAME; - } - - @Override - protected JavaAssociationOverride buildSpecifiedOverride(AssociationOverrideAnnotation overrideAnnotation) { - return this.getJpaFactory().buildJavaAssociationOverride(this, overrideAnnotation); - } - - @Override - protected void initializeSpecifiedOverride(JavaAssociationOverride specifiedOverride, JavaVirtualAssociationOverride virtualOverride) { - specifiedOverride.initializeFromVirtual(virtualOverride); - } - - @Override - protected JavaVirtualAssociationOverride buildVirtualOverride(String name) { - return this.getJpaFactory().buildJavaVirtualAssociationOverride(this, name); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java deleted file mode 100644 index dda23b1611..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverride.java +++ /dev/null @@ -1,218 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOverride; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Specified Java attribute override - */ -public class GenericJavaAttributeOverride - extends AbstractJavaOverride - implements JavaAttributeOverride, JavaColumn.Owner -{ - protected final JavaColumn column; - - - public GenericJavaAttributeOverride(JavaAttributeOverrideContainer parent, AttributeOverrideAnnotation annotation) { - super(parent, annotation); - this.column = this.buildColumn(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.column.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.column.update(); - } - - - // ********** specified/virtual ********** - - @Override - public JavaVirtualAttributeOverride convertToVirtual() { - return (JavaVirtualAttributeOverride) super.convertToVirtual(); - } - - - // ********** column ********** - - public JavaColumn getColumn() { - return this.column; - } - - protected JavaColumn buildColumn() { - return this.getJpaFactory().buildJavaColumn(this, this); - } - - - // ********** misc ********** - - public void initializeFrom(ReadOnlyAttributeOverride oldOverride) { - super.initializeFrom(oldOverride); - this.column.initializeFrom(oldOverride.getColumn()); - } - - public void initializeFromVirtual(ReadOnlyAttributeOverride oldOverride) { - super.initializeFromVirtual(oldOverride); - this.column.initializeFromVirtual(oldOverride.getColumn()); - } - - - // ********** column owner implementation ********** - - public TypeMapping getTypeMapping() { - return this.getContainer().getTypeMapping(); - } - - public String getDefaultTableName() { - return this.getContainer().getDefaultTableName(); - } - - public Table resolveDbTable(String tableName) { - return this.getContainer().resolveDbTable(tableName); - } - - public String getDefaultColumnName() { - return this.name; - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return this.getContainer().buildColumnValidator(this, (BaseColumn) column, this, (BaseColumnTextRangeResolver) textRangeResolver); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getContainer().tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return this.getContainer().candidateTableNames(); - } - - public CompleteColumnAnnotation getColumnAnnotation() { - return this.getOverrideAnnotation().getNonNullColumn(); - } - - public void removeColumnAnnotation() { - this.getOverrideAnnotation().removeColumn(); - } - - - // ********** mapped by relationship ********** - - protected boolean isMappedByRelationship() { - return CollectionTools.contains(this.getMappedByRelationshipAttributeNames(), this.buildQualifier()); - } - - protected Iterable getMappedByRelationshipAttributeNames() { - return TypeMappingTools.getMappedByRelationshipAttributeNames(this.getTypeMapping()); - } - - /** - * overridable names are (usually?) qualified with a container mapping, - * which may also be the one mapped by a relationship - */ - protected String buildQualifier() { - if (this.name == null) { - return null; - } - int index = this.name.indexOf('.'); - return (index == -1) ? this.name : this.name.substring(0, index); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.column.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - return null; - } - - @Override - protected Iterator candidateNames() { - return this.getContainer().allOverridableNames(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - - // [JPA 2.0] if the column is specified, or if the override is not mapped by a relationship, - // then the column is validated. - // (In JPA 1.0, the column will always be validated, since the override is never mapped by a - // relationship) - if (this.columnAnnotationIsSpecified() || ! this.isMappedByRelationship()) { - this.column.validate(messages, reporter, astRoot); - } - - // [JPA 2.0] if the override is mapped by a relationship, then that actually is in itself - // a validation error - // (We prevent implied overrides that are mapped by a relationship ... hopefully) - // (In JPA 1.0, this will never occur) - if (this.isMappedByRelationship()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ATTRIBUTE_OVERRIDE_MAPPED_BY_RELATIONSHIP_AND_SPECIFIED, - EMPTY_STRING_ARRAY, - this, - this.getValidationTextRange(astRoot) - ) - ); - } - } - - protected boolean columnAnnotationIsSpecified() { - return this.getOverrideAnnotation().getColumn() != null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java deleted file mode 100644 index 26be7c2ef8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaAttributeOverrideContainer.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyAttributeOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation; - -/** - * Java attribute override container - */ -public class GenericJavaAttributeOverrideContainer - extends AbstractJavaOverrideContainer< - JavaAttributeOverrideContainer.Owner, - JavaReadOnlyAttributeOverride, - JavaAttributeOverride, - JavaVirtualAttributeOverride, - AttributeOverrideAnnotation - > - implements JavaAttributeOverrideContainer -{ - public GenericJavaAttributeOverrideContainer(JavaJpaContextNode parent, JavaAttributeOverrideContainer.Owner owner) { - super(parent, owner); - } - - - public Column resolveOverriddenColumn(String attributeName) { - return (attributeName == null) ? null : this.owner.resolveOverriddenColumn(attributeName); - } - - @Override - protected String getOverrideAnnotationName() { - return AttributeOverrideAnnotation.ANNOTATION_NAME; - } - - @Override - protected String getOverrideContainerAnnotationName() { - return AttributeOverridesAnnotation.ANNOTATION_NAME; - } - - @Override - protected JavaAttributeOverride buildSpecifiedOverride(AttributeOverrideAnnotation overrideAnnotation) { - return this.getJpaFactory().buildJavaAttributeOverride(this, overrideAnnotation); - } - - @Override - protected void initializeSpecifiedOverride(JavaAttributeOverride specifiedOverride, JavaVirtualAttributeOverride virtualOverride) { - specifiedOverride.initializeFromVirtual(virtualOverride); - } - - @Override - protected JavaVirtualAttributeOverride buildVirtualOverride(String name) { - return this.getJpaFactory().buildJavaVirtualAttributeOverride(this, name); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaBasicMapping.java deleted file mode 100644 index fc88aeed80..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaBasicMapping.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBasicMapping; - -public class GenericJavaBasicMapping - extends AbstractJavaBasicMapping -{ - public GenericJavaBasicMapping(JavaPersistentAttribute parent) { - super(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaCascade.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaCascade.java deleted file mode 100644 index 321792eaf2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaCascade.java +++ /dev/null @@ -1,255 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipMapping; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaRelationshipMapping; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCascade2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.RelationshipMapping2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.RelationshipMappingAnnotation; - -public class GenericJavaCascade - extends AbstractJavaJpaContextNode - implements JavaCascade2_0 -{ - protected boolean all; - - protected boolean persist; - - protected boolean merge; - - protected boolean remove; - - protected boolean refresh; - - /* JPA 2.0 */ - protected boolean detach; - - - /** - * This is built directly by the mapping implementation; as opposed to via - * a platform-specific factory. - * @see AbstractJavaRelationshipMapping#buildCascade() - */ - public GenericJavaCascade(JavaRelationshipMapping parent) { - super(parent); - this.all = this.buildAll(); - this.persist = this.buildPersist(); - this.merge = this.buildMerge(); - this.remove = this.buildRemove(); - this.refresh = this.buildRefresh(); - this.detach = this.buildDetach(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setAll_(this.buildAll()); - this.setPersist_(this.buildPersist()); - this.setMerge_(this.buildMerge()); - this.setRemove_(this.buildRemove()); - this.setRefresh_(this.buildRefresh()); - this.setDetach_(this.buildDetach()); - } - - - // ********** all ********** - - public boolean isAll() { - return this.all; - } - - public void setAll(boolean all) { - if (all != this.all) { - this.getMappingAnnotationForUpdate().setCascadeAll(all); - this.setAll_(all); - } - } - - protected void setAll_(boolean all) { - boolean old = this.all; - this.all = all; - this.firePropertyChanged(ALL_PROPERTY, old, all); - } - - protected boolean buildAll() { - RelationshipMappingAnnotation annotation = this.getMappingAnnotation(); - return (annotation != null) && annotation.isCascadeAll(); - } - - - // ********** persist ********** - - public boolean isPersist() { - return this.persist; - } - - public void setPersist(boolean persist) { - if (persist != this.persist) { - this.getMappingAnnotationForUpdate().setCascadePersist(persist); - this.setPersist_(persist); - } - } - - protected void setPersist_(boolean persist) { - boolean old = this.persist; - this.persist = persist; - this.firePropertyChanged(PERSIST_PROPERTY, old, persist); - } - - protected boolean buildPersist() { - RelationshipMappingAnnotation annotation = this.getMappingAnnotation(); - return (annotation != null) && annotation.isCascadePersist(); - } - - - // ********** merge ********** - - public boolean isMerge() { - return this.merge; - } - - public void setMerge(boolean merge) { - if (merge != this.merge) { - this.getMappingAnnotationForUpdate().setCascadeMerge(merge); - this.setMerge_(merge); - } - } - - protected void setMerge_(boolean merge) { - boolean old = this.merge; - this.merge = merge; - this.firePropertyChanged(MERGE_PROPERTY, old, merge); - } - - protected boolean buildMerge() { - RelationshipMappingAnnotation annotation = this.getMappingAnnotation(); - return (annotation != null) && annotation.isCascadeMerge(); - } - - - // ********** remove ********** - - public boolean isRemove() { - return this.remove; - } - - public void setRemove(boolean remove) { - if (remove != this.remove) { - this.getMappingAnnotationForUpdate().setCascadeRemove(remove); - this.setRemove_(remove); - } - } - - protected void setRemove_(boolean remove) { - boolean oldRemove = this.remove; - this.remove = remove; - this.firePropertyChanged(REMOVE_PROPERTY, oldRemove, remove); - } - - protected boolean buildRemove() { - RelationshipMappingAnnotation annotation = this.getMappingAnnotation(); - return (annotation != null) && annotation.isCascadeRemove(); - } - - - // ********** refresh ********** - - public boolean isRefresh() { - return this.refresh; - } - - public void setRefresh(boolean refresh) { - if (refresh != this.refresh) { - this.getMappingAnnotationForUpdate().setCascadeRefresh(refresh); - this.setRefresh_(refresh); - } - } - - protected void setRefresh_(boolean refresh) { - boolean old = this.refresh; - this.refresh = refresh; - this.firePropertyChanged(REFRESH_PROPERTY, old, refresh); - } - - protected boolean buildRefresh() { - RelationshipMappingAnnotation annotation = this.getMappingAnnotation(); - return (annotation != null) && annotation.isCascadeRefresh(); - } - - - // ********** detach ********** - - public boolean isDetach() { - return this.detach; - } - - public void setDetach(boolean detach) { - if (detach != this.detach) { - this.getMappingAnnotationForUpdate2_0().setCascadeDetach(detach); - this.setDetach_(detach); - } - } - - protected void setDetach_(boolean detach) { - boolean old = this.detach; - this.detach = detach; - this.firePropertyChanged(DETACH_PROPERTY, old, detach); - } - - protected boolean buildDetach() { - return this.isJpa2_0Compatible() && this.buildDetach_(); - } - - protected boolean buildDetach_() { - RelationshipMapping2_0Annotation annotation = this.getMappingAnnotation2_0(); - return (annotation != null) && annotation.isCascadeDetach(); - } - - - - // ********** misc ********** - - @Override - public JavaRelationshipMapping getParent() { - return (JavaRelationshipMapping) super.getParent(); - } - - protected JavaRelationshipMapping getMapping() { - return this.getParent(); - } - - protected RelationshipMappingAnnotation getMappingAnnotation() { - return this.getMapping().getMappingAnnotation(); - } - - protected RelationshipMappingAnnotation getMappingAnnotationForUpdate() { - return this.getMapping().getAnnotationForUpdate(); - } - - protected RelationshipMapping2_0Annotation getMappingAnnotation2_0() { - return (RelationshipMapping2_0Annotation) this.getMappingAnnotation(); - } - - protected RelationshipMapping2_0Annotation getMappingAnnotationForUpdate2_0() { - return (RelationshipMapping2_0Annotation) this.getMappingAnnotationForUpdate(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - RelationshipMappingAnnotation annotation = this.getMappingAnnotation(); - return (annotation == null) ? null : annotation.getCascadeTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaColumn.java deleted file mode 100644 index 2af11ca6fa..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaColumn.java +++ /dev/null @@ -1,221 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBaseColumn; -import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation; - -/** - * Java column - *

- * Note: The Column annotation is one of only 2 annotations that - * can be nested outside of an array (i.e. in an AttributeOverride - * annotation); the other is {@link GenericJavaJoinTable JoinTable}. - */ -public class GenericJavaColumn - extends AbstractJavaBaseColumn - implements JavaColumn -{ - protected Integer specifiedLength; - protected int defaultLength; - - protected Integer specifiedPrecision; - protected int defaultPrecision; - - protected Integer specifiedScale; - protected int defaultScale; - - - public GenericJavaColumn(JavaJpaContextNode parent, JavaColumn.Owner owner) { - super(parent, owner); - this.specifiedLength = this.buildSpecifiedLength(); - this.specifiedPrecision = this.buildSpecifiedPrecision(); - this.specifiedScale = this.buildSpecifiedScale(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedLength_(this.buildSpecifiedLength()); - this.setSpecifiedPrecision_(this.buildSpecifiedPrecision()); - this.setSpecifiedScale_(this.buildSpecifiedScale()); - } - - @Override - public void update() { - super.update(); - this.setDefaultLength(this.buildDefaultLength()); - this.setDefaultPrecision(this.buildDefaultPrecision()); - this.setDefaultScale(this.buildDefaultScale()); - } - - - // ********** column annotation ********** - - @Override - public CompleteColumnAnnotation getColumnAnnotation() { - return this.owner.getColumnAnnotation(); - } - - @Override - protected void removeColumnAnnotation() { - this.owner.removeColumnAnnotation(); - } - - - // ********** length ********** - - public int getLength() { - return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.defaultLength; - } - - public Integer getSpecifiedLength() { - return this.specifiedLength; - } - - public void setSpecifiedLength(Integer length) { - if (this.valuesAreDifferent(this.specifiedLength, length)) { - this.getColumnAnnotation().setLength(length); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedLength_(length); - } - } - - protected void setSpecifiedLength_(Integer length) { - Integer old = this.specifiedLength; - this.specifiedLength = length; - this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length); - } - - protected Integer buildSpecifiedLength() { - return this.getColumnAnnotation().getLength(); - } - - public int getDefaultLength() { - return this.defaultLength; - } - - protected void setDefaultLength(int length) { - int old = this.defaultLength; - this.defaultLength = length; - this.firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, length); - } - - protected int buildDefaultLength() { - return DEFAULT_LENGTH; - } - - - // ********** precision ********** - - public int getPrecision() { - return (this.specifiedPrecision != null) ? this.specifiedPrecision.intValue() : this.defaultPrecision; - } - - public Integer getSpecifiedPrecision() { - return this.specifiedPrecision; - } - - public void setSpecifiedPrecision(Integer precision) { - if (this.valuesAreDifferent(this.specifiedPrecision, precision)) { - this.getColumnAnnotation().setPrecision(precision); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedPrecision_(precision); - } - } - - protected void setSpecifiedPrecision_(Integer precision) { - Integer old = this.specifiedPrecision; - this.specifiedPrecision = precision; - this.firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, old, precision); - } - - protected Integer buildSpecifiedPrecision() { - return this.getColumnAnnotation().getPrecision(); - } - - public int getDefaultPrecision() { - return this.defaultPrecision; - } - - protected void setDefaultPrecision(int precision) { - int old = this.defaultPrecision; - this.defaultPrecision = precision; - this.firePropertyChanged(DEFAULT_PRECISION_PROPERTY, old, precision); - } - - protected int buildDefaultPrecision() { - return DEFAULT_PRECISION; - } - - - // ********** scale ********** - - public int getScale() { - return (this.specifiedScale != null) ? this.specifiedScale.intValue() : this.defaultScale; - } - - public Integer getSpecifiedScale() { - return this.specifiedScale; - } - - public void setSpecifiedScale(Integer scale) { - if (this.valuesAreDifferent(this.specifiedScale, scale)) { - this.getColumnAnnotation().setScale(scale); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedScale_(scale); - } - } - - protected void setSpecifiedScale_(Integer scale) { - Integer old = this.specifiedScale; - this.specifiedScale = scale; - this.firePropertyChanged(SPECIFIED_SCALE_PROPERTY, old, scale); - } - - protected Integer buildSpecifiedScale() { - return this.getColumnAnnotation().getScale(); - } - - public int getDefaultScale() { - return this.defaultScale; - } - - protected void setDefaultScale(int scale) { - int old = this.defaultScale; - this.defaultScale = scale; - this.firePropertyChanged(DEFAULT_SCALE_PROPERTY, old, scale); - } - - protected int buildDefaultScale() { - return DEFAULT_SCALE; - } - - - // ********** misc ********** - - public void initializeFrom(ReadOnlyColumn oldColumn) { - super.initializeFrom(oldColumn); - this.setSpecifiedLength(oldColumn.getSpecifiedLength()); - this.setSpecifiedPrecision(oldColumn.getSpecifiedPrecision()); - this.setSpecifiedScale(oldColumn.getSpecifiedScale()); - } - - public void initializeFromVirtual(ReadOnlyColumn virtualColumn) { - super.initializeFromVirtual(virtualColumn); - // ignore other settings? - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java deleted file mode 100644 index a88cc6660c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaDiscriminatorColumn.java +++ /dev/null @@ -1,182 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0, which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.DiscriminatorType; -import org.eclipse.jpt.jpa.core.context.java.JavaDiscriminatorColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaEntity; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaNamedColumn; -import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * Java discriminator column - */ -public class GenericJavaDiscriminatorColumn - extends AbstractJavaNamedColumn - implements JavaDiscriminatorColumn -{ - protected DiscriminatorType specifiedDiscriminatorType; - protected DiscriminatorType defaultDiscriminatorType; - - protected Integer specifiedLength; - protected int defaultLength; - - - public GenericJavaDiscriminatorColumn(JavaEntity parent, JavaDiscriminatorColumn.Owner owner) { - super(parent, owner); - this.specifiedDiscriminatorType = this.buildSpecifiedDiscriminatorType(); - this.specifiedLength = this.buildSpecifiedLength(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedDiscriminatorType_(this.buildSpecifiedDiscriminatorType()); - this.setSpecifiedLength_(this.buildSpecifiedLength()); - } - - @Override - public void update() { - super.update(); - this.setDefaultDiscriminatorType(this.buildDefaultDiscriminatorType()); - this.setDefaultLength(this.buildDefaultLength()); - } - - - // ********** column annotation ********** - - @Override - public DiscriminatorColumnAnnotation getColumnAnnotation() { - return (DiscriminatorColumnAnnotation) this.getResourcePersistentType().getNonNullAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME); - } - - @Override - protected void removeColumnAnnotation() { - this.getResourcePersistentType().removeAnnotation(DiscriminatorColumnAnnotation.ANNOTATION_NAME); - } - - - // ********** discriminator type ********** - - public DiscriminatorType getDiscriminatorType() { - return (this.specifiedDiscriminatorType != null) ? this.specifiedDiscriminatorType : this.defaultDiscriminatorType; - } - - public DiscriminatorType getSpecifiedDiscriminatorType() { - return this.specifiedDiscriminatorType; - } - - public void setSpecifiedDiscriminatorType(DiscriminatorType discriminatorType) { - if (this.valuesAreDifferent(this.specifiedDiscriminatorType, discriminatorType)) { - this.getColumnAnnotation().setDiscriminatorType(DiscriminatorType.toJavaResourceModel(discriminatorType)); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedDiscriminatorType_(discriminatorType); - } - } - - protected void setSpecifiedDiscriminatorType_(DiscriminatorType discriminatorType) { - DiscriminatorType old = this.specifiedDiscriminatorType; - this.specifiedDiscriminatorType = discriminatorType; - this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType); - } - - protected DiscriminatorType buildSpecifiedDiscriminatorType() { - return DiscriminatorType.fromJavaResourceModel(this.getColumnAnnotation().getDiscriminatorType()); - } - - public DiscriminatorType getDefaultDiscriminatorType() { - return this.defaultDiscriminatorType; - } - - protected void setDefaultDiscriminatorType(DiscriminatorType discriminatorType) { - DiscriminatorType old = this.defaultDiscriminatorType; - this.defaultDiscriminatorType = discriminatorType; - this.firePropertyChanged(DEFAULT_DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType); - } - - protected DiscriminatorType buildDefaultDiscriminatorType() { - return this.owner.getDefaultDiscriminatorType(); - } - - - // ********** length ********** - - public int getLength() { - return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.defaultLength; - } - - public Integer getSpecifiedLength() { - return this.specifiedLength; - } - - public void setSpecifiedLength(Integer length) { - if (this.valuesAreDifferent(this.specifiedLength, length)) { - this.getColumnAnnotation().setLength(length); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedLength_(length); - } - } - - protected void setSpecifiedLength_(Integer length) { - Integer old = this.specifiedLength; - this.specifiedLength = length; - this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length); - } - - protected Integer buildSpecifiedLength() { - return this.getColumnAnnotation().getLength(); - } - - public int getDefaultLength() { - return this.defaultLength; - } - - protected void setDefaultLength(int length) { - int old = this.defaultLength; - this.defaultLength = length; - this.firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, length); - } - - protected int buildDefaultLength() { - return this.owner.getDefaultLength(); - } - - - // ********** misc ********** - - @Override - public JavaEntity getParent() { - return (JavaEntity) super.getParent(); - } - - protected JavaEntity getEntity() { - return this.getParent(); - } - - protected JavaPersistentType getPersistentType() { - return this.getEntity().getPersistentType(); - } - - protected JavaResourcePersistentType getResourcePersistentType() { - return this.getPersistentType().getResourcePersistentType(); - } - - - // ********** validation ********** - - public boolean isResourceSpecified() { - return this.getColumnAnnotation().isSpecified(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddable.java deleted file mode 100644 index 75bcc8579a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddable.java +++ /dev/null @@ -1,39 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEmbeddable; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation; - -/** - * Java embeddable type mapping - */ -public class GenericJavaEmbeddable - extends AbstractJavaEmbeddable -{ - public GenericJavaEmbeddable(JavaPersistentType parent, EmbeddableAnnotation mappingAnnotation) { - super(parent, mappingAnnotation); - } - - @Override - public boolean attributeMappingKeyAllowed(String attributeMappingKey) { - //generic only allows basic and transient within an Embeddable - return ArrayTools.contains(ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey); - } - - public static final String[] ALLOWED_ATTRIBUTE_MAPPING_KEYS = - new String[] { - MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, - MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY - }; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java deleted file mode 100644 index 2db8014c83..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedIdMapping.java +++ /dev/null @@ -1,164 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddedIdMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBaseEmbeddedMapping; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.EmbeddedIdMapping2_0; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java embedded ID mapping - */ -public class GenericJavaEmbeddedIdMapping - extends AbstractJavaBaseEmbeddedMapping - implements EmbeddedIdMapping2_0, JavaEmbeddedIdMapping -{ - /* 2.0 feature - a relationship may map this embedded id */ - protected boolean mappedByRelationship; - - - public GenericJavaEmbeddedIdMapping(JavaPersistentAttribute parent) { - super(parent); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.setMappedByRelationship(this.buildMappedByRelationship()); - } - - - // ********** mapped by relationship ********** - - public boolean isMappedByRelationship() { - return this.mappedByRelationship; - } - - protected void setMappedByRelationship(boolean value) { - boolean old = this.mappedByRelationship; - this.mappedByRelationship = value; - this.firePropertyChanged(MAPPED_BY_RELATIONSHIP_PROPERTY, old, value); - } - - protected boolean buildMappedByRelationship() { - return this.isJpa2_0Compatible() && this.buildMappedByRelationship_(); - } - - protected boolean buildMappedByRelationship_() { - return CollectionTools.contains(this.getMappedByRelationshipAttributeNames(), this.getName()); - } - - protected Iterable getMappedByRelationshipAttributeNames() { - return TypeMappingTools.getMappedByRelationshipAttributeNames(this.getTypeMapping()); - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return EmbeddedIdAnnotation.ANNOTATION_NAME; - } - - @Override - protected Iterator embeddableOverridableAttributeMappingNames() { - return (this.mappedByRelationship) ? - EmptyIterator.instance() : - super.embeddableOverridableAttributeMappingNames(); - } - - @Override - protected JavaAttributeOverrideContainer.Owner buildAttributeOverrideContainerOwner() { - return new AttributeOverrideContainerOwner(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - - // [JPA 2.0] if the embedded id is mapped by a relationship, then any specified - // attribute overrides are in error - // (in JPA 1.0, this will obviously never be reached) - if (this.mappedByRelationship - && (this.attributeOverrideContainer.specifiedOverridesSize() > 0)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.EMBEDDED_ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_ATTRIBUTE_OVERRIDES_SPECIFIED, - EMPTY_STRING_ARRAY, - this.attributeOverrideContainer, - this.attributeOverrideContainer.getValidationTextRange(astRoot) - ) - ); - } - } - - // ********** attribute override container owner ********* - - protected class AttributeOverrideContainerOwner - extends AbstractJavaBaseEmbeddedMapping.AttributeOverrideContainerOwner - { - @Override - public Iterator allOverridableNames() { - return GenericJavaEmbeddedIdMapping.this.isMappedByRelationship() ? - EmptyIterator.instance() : - super.allOverridableNames(); - } - - @Override - protected Iterator allOverridableAttributeNames_(TypeMapping typeMapping) { - final Set mappedByRelationshipAttributeNames = this.buildMappedByRelationshipAttributeNames(); - if (mappedByRelationshipAttributeNames.isEmpty()) { - return super.allOverridableAttributeNames_(typeMapping); - } - return new FilteringIterator(super.allOverridableAttributeNames_(typeMapping)) { - @Override - protected boolean accept(String attributeName) { - // overridable names are (usually?) qualified with a container mapping, - // which may also be the one mapped by a relationship - int dotIndex = attributeName.indexOf('.'); - String qualifier = (dotIndex > 0) ? attributeName.substring(0, dotIndex) : attributeName; - return ! mappedByRelationshipAttributeNames.contains(qualifier); - } - }; - } - - protected Set buildMappedByRelationshipAttributeNames() { - return CollectionTools.set(GenericJavaEmbeddedIdMapping.this.getMappedByRelationshipAttributeNames()); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java deleted file mode 100644 index 660bc2d6af..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEmbeddedMapping.java +++ /dev/null @@ -1,284 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.AssociationOverride; -import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.OverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBaseEmbeddedMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinTableValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaEmbeddedMapping2_0; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java embedded mapping - */ -public class GenericJavaEmbeddedMapping - extends AbstractJavaBaseEmbeddedMapping - implements JavaEmbeddedMapping2_0 -{ - protected final JavaAssociationOverrideContainer associationOverrideContainer; - - - public GenericJavaEmbeddedMapping(JavaPersistentAttribute parent) { - super(parent); - this.associationOverrideContainer = this.buildAssociationOverrideContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.associationOverrideContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.associationOverrideContainer.update(); - } - - - // ********** association override container ********** - - protected JavaAssociationOverrideContainer buildAssociationOverrideContainer() { - return this.isJpa2_0Compatible() ? - this.getJpaFactory2_0().buildJavaAssociationOverrideContainer(this, this.buildAssociationOverrideContainerOwner()) : - new GenericJavaAssociationOverrideContainer(this, null); - } - - public JavaAssociationOverrideContainer getAssociationOverrideContainer() { - return this.associationOverrideContainer; - } - - protected JavaAssociationOverrideContainer.Owner buildAssociationOverrideContainerOwner() { - return new AssociationOverrideContainerOwner(); - } - - - // ********** embedded mappings ********** - - /** - * This is only to build the choices for a "mapped by" setting in a - * relationship mapping. JPA 2.0 does not support relationship mappings - * in an embedded ID class; so we only put this logic here. - */ - @Override - @SuppressWarnings("unchecked") - public Iterator allMappingNames() { - return this.isJpa2_0Compatible() ? - new CompositeIterator(super.allMappingNames(), this.allEmbeddableAttributeMappingNames()) : - super.allMappingNames(); - } - - protected Iterator allEmbeddableAttributeMappingNames() { - return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER); - } - - @Override - public AttributeMapping resolveAttributeMapping(String attributeName) { - AttributeMapping resolvedMapping = super.resolveAttributeMapping(attributeName); - if (resolvedMapping != null) { - return resolvedMapping; - } - return this.isJpa2_0Compatible() ? this.resolveAttributeMapping_(attributeName) : null; - } - - protected AttributeMapping resolveAttributeMapping_(String attributeName) { - attributeName = this.unqualify(attributeName); - if (attributeName == null) { - return null; - } - // recurse into the embeddable mappings - for (AttributeMapping mapping : CollectionTools.iterable(this.embeddableAttributeMappings())) { - AttributeMapping resolvedMapping = mapping.resolveAttributeMapping(attributeName); - if (resolvedMapping != null) { - return resolvedMapping; - } - } - return null; - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return EmbeddedAnnotation.ANNOTATION_NAME; - } - - @Override - public Relationship resolveOverriddenRelationship(String attributeName) { - return this.isJpa2_0Compatible() ? this.resolveOverriddenRelationship_(attributeName) : null; - } - - protected Relationship resolveOverriddenRelationship_(String attributeName) { - attributeName = this.unqualify(attributeName); - if (attributeName == null) { - return null; - } - AssociationOverride override = this.associationOverrideContainer.getSpecifiedOverrideNamed(attributeName); - // recurse into the target embeddable if necessary - return (override != null) ? override.getRelationship() : this.resolveOverriddenRelationshipInTargetEmbeddable(attributeName); - } - - protected Relationship resolveOverriddenRelationshipInTargetEmbeddable(String attributeName) { - return (this.targetEmbeddable == null) ? null : this.targetEmbeddable.resolveOverriddenRelationship(attributeName); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - result = this.associationOverrideContainer.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - return null; - } - - - // ********** validation ********** - - @Override - protected void validateOverrides(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validateOverrides(messages, reporter, astRoot); - this.associationOverrideContainer.validate(messages, reporter, astRoot); - } - - - // ********** association override container owner ********** - - protected class AssociationOverrideContainerOwner - implements JavaAssociationOverrideContainer.Owner - { - public JavaResourcePersistentMember getResourcePersistentMember() { - return GenericJavaEmbeddedMapping.this.getResourcePersistentAttribute(); - } - - public TypeMapping getTypeMapping() { - return GenericJavaEmbeddedMapping.this.getTypeMapping(); - } - - public TypeMapping getOverridableTypeMapping() { - return GenericJavaEmbeddedMapping.this.getTargetEmbeddable(); - } - - public Iterator allOverridableNames() { - TypeMapping typeMapping = this.getOverridableTypeMapping(); - return (typeMapping != null) ? typeMapping.allOverridableAssociationNames() : EmptyIterator.instance(); - } - - public Relationship resolveOverriddenRelationship(String attributeName) { - return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getTypeMapping().tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return this.getTypeMapping().allAssociatedTableNames(); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return this.getTypeMapping().resolveDbTable(tableName); - } - - public String getDefaultTableName() { - return this.getTypeMapping().getPrimaryTableName(); - } - - public String getPossiblePrefix() { - return null; - } - - public String getWritePrefix() { - return null; - } - - // no maps, so all overrides are relevant - public boolean isRelevant(String overrideName) { - return true; - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return GenericJavaEmbeddedMapping.this.getValidationTextRange(astRoot); - } - - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new AssociationOverrideValidator((AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); - } - - public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); - } - - public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideInverseJoinColumnValidator(override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); - } - - public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinTableValidator(override, (JoinTable) table, textRangeResolver); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEntity.java deleted file mode 100644 index e123367631..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEntity.java +++ /dev/null @@ -1,72 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEntity; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.NullJavaCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.Cacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.CacheableHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; -import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation; - -public class GenericJavaEntity - extends AbstractJavaEntity -{ - // EclipseLink holds its cacheable in its caching - protected final JavaCacheable2_0 cacheable; - - - public GenericJavaEntity(JavaPersistentType parent, EntityAnnotation mappingAnnotation) { - super(parent, mappingAnnotation); - this.cacheable = this.buildCacheable(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.cacheable.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.cacheable.update(); - } - - - // ********** cacheable ********** - - public JavaCacheable2_0 getCacheable() { - return this.cacheable; - } - - protected JavaCacheable2_0 buildCacheable() { - return this.isJpa2_0Compatible() ? - this.getJpaFactory2_0().buildJavaCacheable(this) : - new NullJavaCacheable2_0(this); - } - - public boolean calculateDefaultCacheable() { - Cacheable2_0 parentCacheable = this.getParentCacheable(); - return (parentCacheable != null) ? - parentCacheable.isCacheable() : - ((PersistenceUnit2_0) this.getPersistenceUnit()).calculateDefaultCacheable(); - } - - protected Cacheable2_0 getParentCacheable() { - CacheableHolder2_0 parentEntity = (CacheableHolder2_0) this.getParentEntity(); - return (parentEntity == null) ? null : parentEntity.getCacheable(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java deleted file mode 100644 index 0ef279813f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaEnumeratedConverter.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.EnumType; -import org.eclipse.jpt.jpa.core.context.EnumeratedConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaEnumeratedConverter; -import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation; - -public class GenericJavaEnumeratedConverter - extends AbstractJavaConverter - implements JavaEnumeratedConverter -{ - protected final EnumeratedAnnotation enumeratedAnnotation; - - protected EnumType specifiedEnumType; - protected EnumType defaultEnumType; - - - public GenericJavaEnumeratedConverter(JavaAttributeMapping parent, EnumeratedAnnotation enumeratedAnnotation) { - super(parent); - this.enumeratedAnnotation = enumeratedAnnotation; - this.specifiedEnumType = this.buildSpecifiedEnumType(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedEnumType_(this.buildSpecifiedEnumType()); - } - - @Override - public void update() { - super.update(); - this.setDefaultEnumType(this.buildDefaultEnumType()); - } - - - // ********** enum type ********** - - public EnumType getEnumType() { - return (this.specifiedEnumType != null) ? this.specifiedEnumType : this.defaultEnumType; - } - - public EnumType getSpecifiedEnumType() { - return this.specifiedEnumType; - } - - public void setSpecifiedEnumType(EnumType enumType) { - this.enumeratedAnnotation.setValue(EnumType.toJavaResourceModel(enumType)); - this.setSpecifiedEnumType_(enumType); - } - - protected void setSpecifiedEnumType_(EnumType enumType) { - EnumType old = this.specifiedEnumType; - this.specifiedEnumType = enumType; - this.firePropertyChanged(SPECIFIED_ENUM_TYPE_PROPERTY, old, enumType); - } - - protected EnumType buildSpecifiedEnumType() { - return EnumType.fromJavaResourceModel(this.enumeratedAnnotation.getValue()); - } - - public EnumType getDefaultEnumType() { - return this.defaultEnumType; - } - - protected void setDefaultEnumType(EnumType enumType) { - EnumType old = this.defaultEnumType; - this.defaultEnumType = enumType; - this.firePropertyChanged(DEFAULT_ENUM_TYPE_PROPERTY, old, enumType); - } - - protected EnumType buildDefaultEnumType() { - return DEFAULT_ENUM_TYPE; - } - - - // ********** misc ********** - - public Class getType() { - return EnumeratedConverter.class; - } - - @Override - protected String getAnnotationName() { - return EnumeratedAnnotation.ANNOTATION_NAME; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.enumeratedAnnotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java deleted file mode 100644 index de5501141b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratedValue.java +++ /dev/null @@ -1,220 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.jpa.core.context.GenerationType; -import org.eclipse.jpt.jpa.core.context.Generator; -import org.eclipse.jpt.jpa.core.context.java.JavaGeneratedValue; -import org.eclipse.jpt.jpa.core.context.java.JavaIdMapping; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java generated value - */ -public class GenericJavaGeneratedValue - extends AbstractJavaJpaContextNode - implements JavaGeneratedValue -{ - protected final GeneratedValueAnnotation generatedValueAnnotation; - - protected GenerationType specifiedStrategy; - protected GenerationType defaultStrategy; - - protected String specifiedGenerator; - protected String defaultGenerator; - - - public GenericJavaGeneratedValue(JavaIdMapping parent, GeneratedValueAnnotation generatedValueAnnotation) { - super(parent); - this.generatedValueAnnotation = generatedValueAnnotation; - this.specifiedStrategy = this.buildSpecifiedStrategy(); - this.specifiedGenerator = generatedValueAnnotation.getGenerator(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedStrategy_(this.buildSpecifiedStrategy()); - this.setSpecifiedGenerator_(this.generatedValueAnnotation.getGenerator()); - } - - @Override - public void update() { - super.update(); - this.setDefaultStrategy(this.buildDefaultStrategy()); - this.setDefaultGenerator(this.buildDefaultGenerator()); - } - - - // ********** strategy ********** - - public GenerationType getStrategy() { - return (this.specifiedStrategy != null) ? this.specifiedStrategy : this.defaultStrategy; - } - - public GenerationType getSpecifiedStrategy() { - return this.specifiedStrategy; - } - - public void setSpecifiedStrategy(GenerationType strategy) { - this.generatedValueAnnotation.setStrategy(GenerationType.toJavaResourceModel(strategy)); - this.setSpecifiedStrategy_(strategy); - } - - protected void setSpecifiedStrategy_(GenerationType strategy) { - GenerationType old = this.specifiedStrategy; - this.specifiedStrategy = strategy; - this.firePropertyChanged(SPECIFIED_STRATEGY_PROPERTY, old, strategy); - } - - protected GenerationType buildSpecifiedStrategy() { - return GenerationType.fromJavaResourceModel(this.generatedValueAnnotation.getStrategy()); - } - - public GenerationType getDefaultStrategy() { - return this.defaultStrategy; - } - - protected void setDefaultStrategy(GenerationType strategy) { - GenerationType old = this.defaultStrategy; - this.defaultStrategy = strategy; - this.firePropertyChanged(DEFAULT_STRATEGY_PROPERTY, old, strategy); - } - - protected GenerationType buildDefaultStrategy() { - return DEFAULT_STRATEGY; - } - - - // ********** generator ********** - - public String getGenerator() { - return (this.specifiedGenerator != null) ? this.specifiedGenerator : this.defaultGenerator; - } - - public String getSpecifiedGenerator() { - return this.specifiedGenerator; - } - - public void setSpecifiedGenerator(String generator) { - this.generatedValueAnnotation.setGenerator(generator); - this.setSpecifiedGenerator_(generator); - } - - protected void setSpecifiedGenerator_(String generator) { - String old = this.specifiedGenerator; - this.specifiedGenerator = generator; - this.firePropertyChanged(SPECIFIED_GENERATOR_PROPERTY, old, generator); - } - - public String getDefaultGenerator() { - return this.defaultGenerator; - } - - protected void setDefaultGenerator(String generator) { - String old = this.defaultGenerator; - this.defaultGenerator = generator; - this.firePropertyChanged(DEFAULT_GENERATOR_PROPERTY, old, generator); - } - - protected String buildDefaultGenerator() { - return null; - } - - public TextRange getGeneratorTextRange(CompilationUnit astRoot) { - return this.generatedValueAnnotation.getGeneratorTextRange(astRoot); - } - - - // ********** misc ********** - - public GeneratedValueAnnotation getGeneratedValueAnnotation() { - return this.generatedValueAnnotation; - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.generatorTouches(pos, astRoot)) { - return this.javaCandidateGeneratorNames(filter); - } - return null; - } - - protected boolean generatorTouches(int pos, CompilationUnit astRoot) { - return this.generatedValueAnnotation.generatorTouches(pos, astRoot); - } - - protected Iterator javaCandidateGeneratorNames(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.candidateGeneratorNames(filter)); - } - - protected Iterator candidateGeneratorNames(Filter filter) { - return new FilteringIterator(this.candidateGeneratorNames(), filter); - } - - protected Iterator candidateGeneratorNames() { - return this.getPersistenceUnit().getUniqueGeneratorNames().iterator(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - - String generator = this.getGenerator(); - if (generator == null) { - return; - } - - for (Iterator stream = this.getPersistenceUnit().generators(); stream.hasNext(); ) { - if (generator.equals(stream.next().getName())) { - return; - } - } - - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ID_MAPPING_UNRESOLVED_GENERATOR_NAME, - new String[] {generator}, - this.getParent(), - this.getGeneratorTextRange(astRoot) - ) - ); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.generatedValueAnnotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java deleted file mode 100644 index 65d1ab157d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaGeneratorContainer.java +++ /dev/null @@ -1,283 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.context.Generator; -import org.eclipse.jpt.jpa.core.context.java.JavaGenerator; -import org.eclipse.jpt.jpa.core.context.java.JavaGeneratorContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator; -import org.eclipse.jpt.jpa.core.context.java.JavaTableGenerator; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaGeneratorContainer - extends AbstractJavaJpaContextNode - implements JavaGeneratorContainer -{ - protected final Owner owner; - - protected JavaSequenceGenerator sequenceGenerator; - - protected JavaTableGenerator tableGenerator; - - - public GenericJavaGeneratorContainer(JavaJpaContextNode parent, Owner owner) { - super(parent); - this.owner = owner; - this.sequenceGenerator = this.buildSequenceGenerator(); - this.tableGenerator = this.buildTableGenerator(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncSequenceGenerator(); - this.syncTableGenerator(); - } - - @Override - public void update() { - super.update(); - if (this.sequenceGenerator != null) { - this.sequenceGenerator.update(); - } - if (this.tableGenerator != null) { - this.tableGenerator.update(); - } - } - - - // ********** sequence generator ********** - - public JavaSequenceGenerator getSequenceGenerator() { - return this.sequenceGenerator; - } - - public JavaSequenceGenerator addSequenceGenerator() { - if (this.sequenceGenerator != null) { - throw new IllegalStateException("sequence generator already exists: " + this.sequenceGenerator); //$NON-NLS-1$ - } - SequenceGeneratorAnnotation annotation = this.buildSequenceGeneratorAnnotation(); - JavaSequenceGenerator generator = this.buildSequenceGenerator(annotation); - this.setSequenceGenerator(generator); - return generator; - } - - protected SequenceGeneratorAnnotation buildSequenceGeneratorAnnotation() { - return (SequenceGeneratorAnnotation) this.owner.getResourceAnnotatedElement().addAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME); - } - - public void removeSequenceGenerator() { - if (this.sequenceGenerator == null) { - throw new IllegalStateException("sequence generator does not exist"); //$NON-NLS-1$ - } - this.owner.getResourceAnnotatedElement().removeAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME); - this.setSequenceGenerator(null); - } - - protected JavaSequenceGenerator buildSequenceGenerator() { - SequenceGeneratorAnnotation annotation = this.getSequenceGeneratorAnnotation(); - return (annotation == null) ? null : this.buildSequenceGenerator(annotation); - } - - protected SequenceGeneratorAnnotation getSequenceGeneratorAnnotation() { - return (SequenceGeneratorAnnotation) this.owner.getResourceAnnotatedElement().getAnnotation(SequenceGeneratorAnnotation.ANNOTATION_NAME); - } - - protected JavaSequenceGenerator buildSequenceGenerator(SequenceGeneratorAnnotation sequenceGeneratorAnnotation) { - return this.getJpaFactory().buildJavaSequenceGenerator(this, sequenceGeneratorAnnotation); - } - - protected void syncSequenceGenerator() { - SequenceGeneratorAnnotation annotation = this.getSequenceGeneratorAnnotation(); - if (annotation == null) { - if (this.sequenceGenerator != null) { - this.setSequenceGenerator(null); - } - } else { - if ((this.sequenceGenerator != null) && (this.sequenceGenerator.getGeneratorAnnotation() == annotation)) { - this.sequenceGenerator.synchronizeWithResourceModel(); - } else { - this.setSequenceGenerator(this.buildSequenceGenerator(annotation)); - } - } - } - - protected void setSequenceGenerator(JavaSequenceGenerator sequenceGenerator) { - JavaSequenceGenerator old = this.sequenceGenerator; - this.sequenceGenerator = sequenceGenerator; - this.firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, old, sequenceGenerator); - } - - - // ********** table generator ********** - - public JavaTableGenerator getTableGenerator() { - return this.tableGenerator; - } - - public JavaTableGenerator addTableGenerator() { - if (this.tableGenerator != null) { - throw new IllegalStateException("table generator already exists: " + this.tableGenerator); //$NON-NLS-1$ - } - TableGeneratorAnnotation annotation = this.buildTableGeneratorAnnotation(); - JavaTableGenerator generator = this.buildTableGenerator(annotation); - this.setTableGenerator(generator); - return generator; - } - - protected TableGeneratorAnnotation buildTableGeneratorAnnotation() { - return (TableGeneratorAnnotation) this.owner.getResourceAnnotatedElement().addAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME); - } - - public void removeTableGenerator() { - if (this.tableGenerator == null) { - throw new IllegalStateException("table generator does not exist"); //$NON-NLS-1$ - } - this.owner.getResourceAnnotatedElement().removeAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME); - this.setTableGenerator(null); - } - - protected JavaTableGenerator buildTableGenerator() { - TableGeneratorAnnotation annotation = this.getTableGeneratorAnnotation(); - return (annotation == null) ? null : this.buildTableGenerator(annotation); - } - - protected TableGeneratorAnnotation getTableGeneratorAnnotation() { - return (TableGeneratorAnnotation) this.owner.getResourceAnnotatedElement().getAnnotation(TableGeneratorAnnotation.ANNOTATION_NAME); - } - - protected JavaTableGenerator buildTableGenerator(TableGeneratorAnnotation tableGeneratorAnnotation) { - return this.getJpaFactory().buildJavaTableGenerator(this, tableGeneratorAnnotation); - } - - protected void syncTableGenerator() { - TableGeneratorAnnotation annotation = this.getTableGeneratorAnnotation(); - if (annotation == null) { - if (this.tableGenerator != null) { - this.setTableGenerator(null); - } - } else { - if ((this.tableGenerator != null) && (this.tableGenerator.getGeneratorAnnotation() == annotation)) { - this.tableGenerator.synchronizeWithResourceModel(); - } else { - this.setTableGenerator(this.buildTableGenerator(annotation)); - } - } - } - - protected void setTableGenerator(JavaTableGenerator tableGenerator) { - JavaTableGenerator old = this.tableGenerator; - this.tableGenerator = tableGenerator; - this.firePropertyChanged(TABLE_GENERATOR_PROPERTY, old, tableGenerator); - } - - - // ********** code completion ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.tableGenerator != null) { - result = this.tableGenerator.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - if (this.sequenceGenerator != null) { - result = this.sequenceGenerator.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - return null; - } - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.validateGenerators(messages, astRoot); - } - - protected void validateGenerators(List messages, CompilationUnit astRoot) { - for (JavaGenerator localGenerator : this.getGenerators()) { - String name = localGenerator.getName(); - if (StringTools.stringIsEmpty(name)){ - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.GENERATOR_NAME_UNDEFINED, - new String[] {}, - localGenerator, - localGenerator.getNameTextRange(astRoot) - ) - ); - } else { - List reportedNames = new ArrayList(); - for (Iterator globalGenerators = this.getPersistenceUnit().generators(); globalGenerators.hasNext(); ) { - if (localGenerator.duplicates(globalGenerators.next()) && !reportedNames.contains(name)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.GENERATOR_DUPLICATE_NAME, - new String[] {name}, - localGenerator, - localGenerator.getNameTextRange(astRoot) - ) - ); - reportedNames.add(name); - } - } - } - } - } - - protected Iterable getGenerators() { - ArrayList generators = new ArrayList(); - this.addGeneratorsTo(generators); - return generators; - } - - protected void addGeneratorsTo(ArrayList generators) { - if (this.sequenceGenerator != null) { - generators.add(this.sequenceGenerator); - } - if (this.tableGenerator != null) { - generators.add(this.tableGenerator); - } - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.owner.getResourceAnnotatedElement().getTextRange(astRoot); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaIdMapping.java deleted file mode 100644 index 7f1aca7b89..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaIdMapping.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaIdMapping; - - -public class GenericJavaIdMapping - extends AbstractJavaIdMapping -{ - public GenericJavaIdMapping(JavaPersistentAttribute parent) { - super(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinColumn.java deleted file mode 100644 index de4e5b0c85..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinColumn.java +++ /dev/null @@ -1,212 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaBaseColumn; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaNamedColumn; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaJoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; -import org.eclipse.jpt.jpa.db.Column; -import org.eclipse.jpt.jpa.db.Table; - -/** - * Java join column - */ -public class GenericJavaJoinColumn - extends AbstractJavaBaseColumn - implements JavaJoinColumn -{ - /** @see AbstractJavaNamedColumn#AbstractJavaNamedColumn(JavaJpaContextNode, org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn.Owner, org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation) */ - protected /* final */ JoinColumnAnnotation columnAnnotation; // never null - - protected String specifiedReferencedColumnName; - protected String defaultReferencedColumnName; - - - public GenericJavaJoinColumn(JavaJpaContextNode parent, JavaJoinColumn.Owner owner) { - this(parent, owner, null); - } - - public GenericJavaJoinColumn(JavaJpaContextNode parent, JavaJoinColumn.Owner owner, JoinColumnAnnotation columnAnnotation) { - super(parent, owner, columnAnnotation); - this.specifiedReferencedColumnName = this.buildSpecifiedReferencedColumnName(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedReferencedColumnName_(this.buildSpecifiedReferencedColumnName()); - } - - @Override - public void update() { - super.update(); - this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName()); - } - - - // ********** column annotation ********** - - @Override - public JoinColumnAnnotation getColumnAnnotation() { - return this.columnAnnotation; - } - - @Override - protected void setColumnAnnotation(JoinColumnAnnotation columnAnnotation) { - this.columnAnnotation = columnAnnotation; - } - - @Override - protected void removeColumnAnnotation() { - // we don't remove a join column annotation when it is empty - } - - - // ********** referenced column name ********** - - public String getReferencedColumnName() { - return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName; - } - - public String getSpecifiedReferencedColumnName() { - return this.specifiedReferencedColumnName; - } - - public void setSpecifiedReferencedColumnName(String name) { - if (this.valuesAreDifferent(this.specifiedReferencedColumnName, name)) { - this.getColumnAnnotation().setReferencedColumnName(name); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedReferencedColumnName_(name); - } - } - - protected void setSpecifiedReferencedColumnName_(String name) { - String old = this.specifiedReferencedColumnName; - this.specifiedReferencedColumnName = name; - this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedReferencedColumnName() { - return this.getColumnAnnotation().getReferencedColumnName(); - } - - public String getDefaultReferencedColumnName() { - return this.defaultReferencedColumnName; - } - - protected void setDefaultReferencedColumnName(String name) { - String old = this.defaultReferencedColumnName; - this.defaultReferencedColumnName = name; - this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name); - } - - protected String buildDefaultReferencedColumnName() { - return MappingTools.buildJoinColumnDefaultReferencedColumnName(this.owner); - } - - public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getColumnAnnotation().getReferencedColumnNameTextRange(astRoot); - return (textRange != null) ? textRange : this.owner.getValidationTextRange(astRoot); - } - - - // ********** database stuff ********** - - public Table getReferencedColumnDbTable() { - return this.owner.getReferencedColumnDbTable(); - } - - protected Column getReferencedDbColumn() { - Table table = this.getReferencedColumnDbTable(); - return (table == null) ? null : table.getColumnForIdentifier(this.getReferencedColumnName()); - } - - public boolean referencedColumnIsResolved() { - return this.getReferencedDbColumn() != null; - } - - - // ********** misc ********** - - public void initializeFrom(ReadOnlyJoinColumn oldColumn) { - super.initializeFrom(oldColumn); - this.setSpecifiedReferencedColumnName(oldColumn.getSpecifiedReferencedColumnName()); - } - - public void initializeFromVirtual(ReadOnlyJoinColumn virtualColumn) { - super.initializeFromVirtual(virtualColumn); - this.setSpecifiedReferencedColumnName(virtualColumn.getReferencedColumnName()); - } - - public boolean isDefault() { - return this.owner.joinColumnIsDefault(this); - } - - @Override - protected String buildDefaultName() { - return MappingTools.buildJoinColumnDefaultName(this, this.owner); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator connectedJavaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.connectedJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.referencedColumnNameTouches(pos, astRoot)) { - return this.getJavaCandidateReferencedColumnNames(filter).iterator(); - } - return null; - } - - protected boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) { - return this.getColumnAnnotation().referencedColumnNameTouches(pos, astRoot); - } - - protected Iterable getJavaCandidateReferencedColumnNames(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.getCandidateReferencedColumnNames(filter)); - } - - protected Iterable getCandidateReferencedColumnNames(Filter filter) { - return new FilteringIterable(this.getCandidateReferencedColumnNames(), filter); - } - - protected Iterable getCandidateReferencedColumnNames() { - Table table = this.owner.getReferencedColumnDbTable(); - return (table != null) ? table.getSortedColumnIdentifiers() : EmptyIterable. instance(); - } - - - // ********** validation ********** - - @Override - protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) { - return new JavaJoinColumnTextRangeResolver(this, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java deleted file mode 100644 index cc6254661b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaJoinTable.java +++ /dev/null @@ -1,496 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTable; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java join table - *

- * Note: The JoinTable annotation is one of only 2 annotations that - * can be nested outside of an array (i.e. in an AssociationOverride - * annotation); the other is {@link GenericJavaColumn Column}. - */ -public class GenericJavaJoinTable - extends GenericJavaReferenceTable - implements JavaJoinTable -{ - protected final Vector specifiedInverseJoinColumns = new Vector(); - protected final SpecifiedInverseJoinColumnContainerAdapter specifiedInverseJoinColumnContainerAdapter = new SpecifiedInverseJoinColumnContainerAdapter(); - protected final JavaJoinColumn.Owner inverseJoinColumnOwner; - - protected JavaJoinColumn defaultInverseJoinColumn; - - - public GenericJavaJoinTable(JavaJoinTableRelationshipStrategy parent, Owner owner) { - super(parent, owner); - this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner(); - this.initializeSpecifiedInverseJoinColumns(); - } - - @Override - protected JavaJoinColumn.Owner buildJoinColumnOwner() { - return new JoinColumnOwner(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncSpecifiedInverseJoinColumns(); - if (this.defaultInverseJoinColumn != null) { - this.defaultInverseJoinColumn.synchronizeWithResourceModel(); - } - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getSpecifiedInverseJoinColumns()); - this.updateDefaultInverseJoinColumn(); - } - - - // ********** table annotation ********** - - @Override - public JoinTableAnnotation getTableAnnotation() { - return this.getRelationshipStrategy().getJoinTableAnnotation(); - } - - @Override - protected void removeTableAnnotation() { - // we don't remove a join table annotation when it is empty - } - - - // ********** inverse join columns ********** - - public ListIterator inverseJoinColumns() { - return this.getInverseJoinColumns().iterator(); - } - - protected ListIterable getInverseJoinColumns() { - return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns(); - } - - public int inverseJoinColumnsSize() { - return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumnsSize() : this.defaultInverseJoinColumnsSize(); - } - - public void convertDefaultToSpecifiedInverseJoinColumn() { - MappingTools.convertJoinTableDefaultToSpecifiedInverseJoinColumn(this); - } - - - // ********** specified inverse join columns ********** - - public ListIterator specifiedInverseJoinColumns() { - return this.getSpecifiedInverseJoinColumns().iterator(); - } - - public ListIterable getSpecifiedInverseJoinColumns() { - return new LiveCloneListIterable(this.specifiedInverseJoinColumns); - } - - public int specifiedInverseJoinColumnsSize() { - return this.specifiedInverseJoinColumns.size(); - } - - public boolean hasSpecifiedInverseJoinColumns() { - return this.specifiedInverseJoinColumns.size() != 0; - } - - public JavaJoinColumn getSpecifiedInverseJoinColumn(int index) { - return this.specifiedInverseJoinColumns.get(index); - } - - public JavaJoinColumn addSpecifiedInverseJoinColumn() { - return this.addSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.size()); - } - - public JavaJoinColumn addSpecifiedInverseJoinColumn(int index) { - JoinColumnAnnotation annotation = this.getTableAnnotation().addInverseJoinColumn(index); - return this.addSpecifiedInverseJoinColumn_(index, annotation); - } - - public void removeSpecifiedInverseJoinColumn(JoinColumn joinColumn) { - this.removeSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.indexOf(joinColumn)); - } - - public void removeSpecifiedInverseJoinColumn(int index) { - this.getTableAnnotation().removeInverseJoinColumn(index); - this.removeTableAnnotationIfUnset(); - this.removeSpecifiedInverseJoinColumn_(index); - } - - protected void removeSpecifiedInverseJoinColumn_(int index) { - this.removeItemFromList(index, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST); - } - - public void moveSpecifiedInverseJoinColumn(int targetIndex, int sourceIndex) { - this.getTableAnnotation().moveInverseJoinColumn(targetIndex, sourceIndex); - this.moveItemInList(targetIndex, sourceIndex, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST); - } - - public void clearSpecifiedInverseJoinColumns() { - // for now, we have to remove annotations one at a time... - for (int i = this.specifiedInverseJoinColumns.size(); i-- > 0; ) { - this.removeSpecifiedInverseJoinColumn(i); - } - } - - protected void initializeSpecifiedInverseJoinColumns() { - for (JoinColumnAnnotation joinColumnAnnotation : this.getInverseJoinColumnAnnotations()) { - this.specifiedInverseJoinColumns.add(this.buildInverseJoinColumn(joinColumnAnnotation)); - } - } - - protected void syncSpecifiedInverseJoinColumns() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedInverseJoinColumnContainerAdapter); - } - - protected Iterable getInverseJoinColumnAnnotations() { - return CollectionTools.iterable(this.getTableAnnotation().inverseJoinColumns()); - } - - protected void moveSpecifiedInverseJoinColumn_(int index, JavaJoinColumn joinColumn) { - this.moveItemInList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST); - } - - protected JavaJoinColumn addSpecifiedInverseJoinColumn_(int index, JoinColumnAnnotation joinColumnAnnotation) { - JavaJoinColumn joinColumn = this.buildInverseJoinColumn(joinColumnAnnotation); - this.addItemToList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST); - return joinColumn; - } - - protected void removeSpecifiedInverseJoinColumn_(JavaJoinColumn joinColumn) { - this.removeSpecifiedInverseJoinColumn_(this.specifiedInverseJoinColumns.indexOf(joinColumn)); - } - - /** - * specified inverse join column container adapter - */ - protected class SpecifiedInverseJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericJavaJoinTable.this.getSpecifiedInverseJoinColumns(); - } - public Iterable getResourceElements() { - return GenericJavaJoinTable.this.getInverseJoinColumnAnnotations(); - } - public JoinColumnAnnotation getResourceElement(JavaJoinColumn contextElement) { - return contextElement.getColumnAnnotation(); - } - public void moveContextElement(int index, JavaJoinColumn element) { - GenericJavaJoinTable.this.moveSpecifiedInverseJoinColumn_(index, element); - } - public void addContextElement(int index, JoinColumnAnnotation resourceElement) { - GenericJavaJoinTable.this.addSpecifiedInverseJoinColumn_(index, resourceElement); - } - public void removeContextElement(JavaJoinColumn element) { - GenericJavaJoinTable.this.removeSpecifiedInverseJoinColumn_(element); - } - } - - protected JavaJoinColumn.Owner buildInverseJoinColumnOwner() { - return new InverseJoinColumnOwner(); - } - - - // ********** default inverse join column ********** - - public JavaJoinColumn getDefaultInverseJoinColumn() { - return this.defaultInverseJoinColumn; - } - - protected void setDefaultInverseJoinColumn(JavaJoinColumn joinColumn) { - JavaJoinColumn old = this.defaultInverseJoinColumn; - this.defaultInverseJoinColumn = joinColumn; - this.firePropertyChanged(DEFAULT_INVERSE_JOIN_COLUMN, old, joinColumn); - } - - protected ListIterable getDefaultInverseJoinColumns() { - return (this.defaultInverseJoinColumn != null) ? - new SingleElementListIterable(this.defaultInverseJoinColumn) : - EmptyListIterable.instance(); - } - - protected int defaultInverseJoinColumnsSize() { - return (this.defaultInverseJoinColumn == null) ? 0 : 1; - } - - protected void updateDefaultInverseJoinColumn() { - if (this.buildsDefaultInverseJoinColumn()) { - if (this.defaultInverseJoinColumn == null) { - this.setDefaultInverseJoinColumn(this.buildInverseJoinColumn(new NullJoinColumnAnnotation(this.getTableAnnotation()))); - } else { - this.defaultInverseJoinColumn.update(); - } - } else { - this.setDefaultInverseJoinColumn(null); - } - } - - protected boolean buildsDefaultInverseJoinColumn() { - return ! this.hasSpecifiedInverseJoinColumns(); - } - - - // ********** misc ********** - - @Override - public JavaJoinTableRelationshipStrategy getParent() { - return (JavaJoinTableRelationshipStrategy) super.getParent(); - } - - protected JavaJoinTableRelationshipStrategy getRelationshipStrategy() { - return this.getParent(); - } - - @Override - protected String buildDefaultName() { - return this.getRelationshipStrategy().getJoinTableDefaultName(); - } - - public void initializeFrom(ReadOnlyJoinTable oldTable) { - super.initializeFrom(oldTable); - for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldTable.specifiedInverseJoinColumns())) { - this.addSpecifiedInverseJoinColumn().initializeFrom(joinColumn); - } - } - - public void initializeFromVirtual(ReadOnlyJoinTable virtualTable) { - super.initializeFromVirtual(virtualTable); - for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualTable.inverseJoinColumns())) { - this.addSpecifiedInverseJoinColumn().initializeFromVirtual(joinColumn); - } - } - - protected JavaJoinColumn buildInverseJoinColumn(JoinColumnAnnotation joinColumnAnnotation) { - return this.buildJoinColumn(this.inverseJoinColumnOwner, joinColumnAnnotation); - } - - public RelationshipMapping getRelationshipMapping() { - return this.getRelationshipStrategy().getRelationship().getMapping(); - } - - public PersistentAttribute getPersistentAttribute() { - return this.getRelationshipMapping().getPersistentAttribute(); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - for (JavaJoinColumn column : CollectionTools.iterable(this.inverseJoinColumns())) { - result = column.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - return null; - } - - - // ********** validation ********** - - @Override - protected void validateJoinColumns(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validateJoinColumns(messages, reporter, astRoot); - this.validateJoinColumns(this.inverseJoinColumns(), messages, reporter, astRoot); - } - - public boolean validatesAgainstDatabase() { - return this.getRelationshipStrategy().validatesAgainstDatabase(); - } - - - // ********** join column owners ********** - - /** - * just a little common behavior - */ - protected abstract class AbstractJoinColumnOwner - implements JavaJoinColumn.Owner - { - protected AbstractJoinColumnOwner() { - super(); - } - - public TypeMapping getTypeMapping() { - return GenericJavaJoinTable.this.getRelationshipStrategy().getRelationship().getTypeMapping(); - } - - public PersistentAttribute getPersistentAttribute() { - return GenericJavaJoinTable.this.getPersistentAttribute(); - } - - /** - * @see MappingTools#buildJoinColumnDefaultName(org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn.Owner) - */ - public String getDefaultColumnName() { - throw new UnsupportedOperationException(); - } - - /** - * If there is a specified table name it needs to be the same - * the default table name. the table is always the join table - */ - public boolean tableNameIsInvalid(String tableName) { - return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName); - } - - /** - * the join column can only be on the join table itself - */ - public Iterator candidateTableNames() { - return EmptyIterator.instance(); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return Tools.valuesAreEqual(GenericJavaJoinTable.this.getName(), tableName) ? - GenericJavaJoinTable.this.getDbTable() : - null; - } - - /** - * by default, the join column is, obviously, in the join table; - * not sure whether it can be anywhere else... - */ - public String getDefaultTableName() { - return GenericJavaJoinTable.this.getName(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return GenericJavaJoinTable.this.getValidationTextRange(astRoot); - } - } - - - /** - * owner for "back-pointer" join columns; - * these point at the source/owning entity - */ - protected class JoinColumnOwner - extends AbstractJoinColumnOwner - { - protected JoinColumnOwner() { - super(); - } - - public Entity getRelationshipTarget() { - return GenericJavaJoinTable.this.getRelationshipStrategy().getRelationship().getEntity(); - } - - public String getAttributeName() { - return MappingTools.getTargetAttributeName(GenericJavaJoinTable.this.getRelationshipMapping()); - } - - public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() { - return this.getTypeMapping().getPrimaryDbTable(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return GenericJavaJoinTable.this.defaultJoinColumn == joinColumn; - } - - public int joinColumnsSize() { - return GenericJavaJoinTable.this.joinColumnsSize(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return GenericJavaJoinTable.this.getParent().buildJoinTableJoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver); - } - } - - - /** - * owner for "forward-pointer" join columns; - * these point at the target/inverse entity - */ - protected class InverseJoinColumnOwner - extends AbstractJoinColumnOwner - { - protected InverseJoinColumnOwner() { - super(); - } - - public Entity getRelationshipTarget() { - RelationshipMapping relationshipMapping = GenericJavaJoinTable.this.getRelationshipMapping(); - return (relationshipMapping == null) ? null : relationshipMapping.getResolvedTargetEntity(); - } - - public String getAttributeName() { - RelationshipMapping relationshipMapping = GenericJavaJoinTable.this.getRelationshipMapping(); - return (relationshipMapping == null) ? null : relationshipMapping.getName(); - } - - public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() { - Entity relationshipTarget = this.getRelationshipTarget(); - return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return GenericJavaJoinTable.this.defaultInverseJoinColumn == joinColumn; - } - - public int joinColumnsSize() { - return GenericJavaJoinTable.this.inverseJoinColumnsSize(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return GenericJavaJoinTable.this.getParent().buildJoinTableInverseJoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaLobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaLobConverter.java deleted file mode 100644 index 9ccb2d3b51..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaLobConverter.java +++ /dev/null @@ -1,49 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.LobConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaLobConverter; -import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation; - -public class GenericJavaLobConverter - extends AbstractJavaConverter - implements JavaLobConverter -{ - protected final LobAnnotation lobAnnotation; - - public GenericJavaLobConverter(JavaAttributeMapping parent, LobAnnotation lobAnnotation) { - super(parent); - this.lobAnnotation = lobAnnotation; - } - - - // ********** misc ********** - - public Class getType() { - return LobConverter.class; - } - - @Override - protected String getAnnotationName() { - return LobAnnotation.ANNOTATION_NAME; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.lobAnnotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java deleted file mode 100644 index 935834c6d3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToManyMapping.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaManyToManyMapping; - -public class GenericJavaManyToManyMapping - extends AbstractJavaManyToManyMapping -{ - public GenericJavaManyToManyMapping(JavaPersistentAttribute parent) { - super(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java deleted file mode 100644 index 4cdc288501..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaManyToOneMapping.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaManyToOneMapping; - -public class GenericJavaManyToOneMapping - extends AbstractJavaManyToOneMapping -{ - public GenericJavaManyToOneMapping(JavaPersistentAttribute parent) { - super(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java deleted file mode 100644 index 36d734b5b4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappedSuperclass.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaMappedSuperclass; -import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation; - -/** - * Java mapped superclass - */ -public class GenericJavaMappedSuperclass - extends AbstractJavaMappedSuperclass -{ - public GenericJavaMappedSuperclass(JavaPersistentType parent, MappedSuperclassAnnotation mappingAnnotation) { - super(parent, mappingAnnotation); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java deleted file mode 100644 index f411dfbf43..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaMappingJoinTableRelationshipStrategy.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner; -import org.eclipse.jpt.jpa.core.context.java.JavaMappingJoinTableRelationship; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.InverseJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableValidator; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; - -public class GenericJavaMappingJoinTableRelationshipStrategy - extends AbstractJavaJoinTableRelationshipStrategy -{ - public GenericJavaMappingJoinTableRelationshipStrategy(JavaMappingJoinTableRelationship parent) { - super(parent); - } - - - // ********** join table annotation ********** - - public JoinTableAnnotation getJoinTableAnnotation() { - return (JoinTableAnnotation) this.getResourcePersistentAttribute().getNonNullAnnotation(JoinTableAnnotation.ANNOTATION_NAME); - } - - @Override - protected JoinTableAnnotation addJoinTableAnnotation() { - return (JoinTableAnnotation) this.getResourcePersistentAttribute().addAnnotation(JoinTableAnnotation.ANNOTATION_NAME); - } - - @Override - protected void removeJoinTableAnnotation() { - this.getResourcePersistentAttribute().removeAnnotation(JoinTableAnnotation.ANNOTATION_NAME); - } - - - // ********** misc ********** - - protected JavaResourcePersistentAttribute getResourcePersistentAttribute() { - return this.getRelationship().getMapping().getResourcePersistentAttribute(); - } - - @Override - public JavaMappingJoinTableRelationship getParent() { - return (JavaMappingJoinTableRelationship) super.getParent(); - } - - @Override - public JavaMappingJoinTableRelationship getRelationship() { - return this.getParent(); - } - - public boolean isOverridable() { - return this.getJpaPlatformVariation().isJoinTableOverridable(); - } - - - // ********** validation ********** - - public boolean validatesAgainstDatabase() { - return this.getRelationshipMapping().validatesAgainstDatabase(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getRelationship().getValidationTextRange(astRoot); - } - - public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) { - return new JoinTableValidator((JoinTable) table, textRangeResolver); - } - - public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return new JoinColumnValidator(column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); - } - - public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return new InverseJoinColumnValidator(column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java deleted file mode 100644 index feaee86f38..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedNativeQuery.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaNamedNativeQuery; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery; -import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation; - -/** - * orm.xml named native query - */ -public class GenericJavaNamedNativeQuery - extends AbstractJavaQuery - implements JavaNamedNativeQuery -{ - protected String resultClass; - - protected String resultSetMapping; - - - public GenericJavaNamedNativeQuery(JavaJpaContextNode parent, NamedNativeQueryAnnotation queryAnnotation) { - super(parent, queryAnnotation); - this.resultClass = queryAnnotation.getResultClass(); - this.resultSetMapping = queryAnnotation.getResultSetMapping(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setResultClass_(this.queryAnnotation.getResultClass()); - this.setResultSetMapping_(this.queryAnnotation.getResultSetMapping()); - } - - - // ********** result class ********** - - public String getResultClass() { - return this.resultClass; - } - - public void setResultClass(String resultClass) { - this.queryAnnotation.setResultClass(resultClass); - this.setResultClass_(resultClass); - } - - protected void setResultClass_(String resultClass) { - String old = this.resultClass; - this.resultClass = resultClass; - this.firePropertyChanged(RESULT_CLASS_PROPERTY, old, resultClass); - } - - public char getResultClassEnclosingTypeSeparator() { - return '.'; - } - - - // ********** result set mapping ********** - - public String getResultSetMapping() { - return this.resultSetMapping; - } - - public void setResultSetMapping(String resultSetMapping) { - this.queryAnnotation.setResultSetMapping(resultSetMapping); - this.setResultSetMapping_(resultSetMapping); - } - - protected void setResultSetMapping_(String resultSetMapping) { - String old = this.resultSetMapping; - this.resultSetMapping = resultSetMapping; - this.firePropertyChanged(RESULT_SET_MAPPING_PROPERTY, old, resultSetMapping); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java deleted file mode 100644 index 8c22d994ed..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNamedQuery.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery; -import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation; - -/** - * Java named query - */ -public class GenericJavaNamedQuery - extends AbstractJavaQuery - implements JavaNamedQuery -{ - public GenericJavaNamedQuery(JavaJpaContextNode parent, NamedQueryAnnotation queryAnnotation) { - super(parent, queryAnnotation); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java deleted file mode 100644 index 864603a34e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaNullAttributeMapping.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; - -/** - * null mapping used when an attribute's default mapping cannot be determined - */ -public class GenericJavaNullAttributeMapping - extends AbstractJavaAttributeMapping -{ - public GenericJavaNullAttributeMapping(JavaPersistentAttribute parent) { - super(parent); - } - - public String getKey() { - return MappingKeys.NULL_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return null; - } - - - // ********** metamodel ********** - - @Override - public MetamodelField getMetamodelField() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java deleted file mode 100644 index bf84573cf3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToManyMapping.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOneToManyMapping; - -public class GenericJavaOneToManyMapping - extends AbstractJavaOneToManyMapping -{ - public GenericJavaOneToManyMapping(JavaPersistentAttribute parent) { - super(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java deleted file mode 100644 index c2f6397a6c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOneToOneMapping.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOneToOneMapping; - -public class GenericJavaOneToOneMapping - extends AbstractJavaOneToOneMapping -{ - public GenericJavaOneToOneMapping(JavaPersistentAttribute parent) { - super(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java deleted file mode 100644 index 653657946e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOrderable.java +++ /dev/null @@ -1,486 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.OrderColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaOrderColumn2_0; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.OrderColumn2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderColumn2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java ordering - *

- * NB: Setting any flag to false (or setting the - * specified "order by" to null) can be a bit unpredictable. The - * intent is to set a flag to true (or set the specified "order by" - * to a non-null value). - *

- * (JPA 2.0 only) NB: If both the "order by" and the "order - * column" annotations are present (which is prohibited by the JPA spec), - * both are ignored. - */ -public class GenericJavaOrderable - extends AbstractJavaJpaContextNode - implements JavaOrderable2_0 -{ - protected String specifiedOrderBy; - protected boolean noOrdering = false; - protected boolean pkOrdering = false; - protected boolean customOrdering = false; - - // JPA 2.0 - protected final Owner owner; // this is null for JPA 1.0 mappings - protected boolean orderColumnOrdering = false; - protected final JavaOrderColumn2_0 orderColumn; - - - /** - * JPA 1.0 - */ - public GenericJavaOrderable(JavaAttributeMapping parent) { - this(parent, null); - } - - /** - * JPA 2.0 - */ - public GenericJavaOrderable(JavaAttributeMapping parent, Owner owner) { - super(parent); - this.specifiedOrderBy = this.buildSpecifiedOrderBy(); - this.noOrdering = this.buildNoOrdering(); - this.pkOrdering = this.buildPkOrdering(); - this.customOrdering = this.buildCustomOrdering(); - - this.owner = owner; - this.orderColumnOrdering = this.buildOrderColumnOrdering(); - this.orderColumn = this.buildOrderColumn(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - - this.setSpecifiedOrderBy_(this.buildSpecifiedOrderBy()); - this.setNoOrdering_(this.buildNoOrdering()); - this.setPkOrdering_(this.buildPkOrdering()); - this.setCustomOrdering_(this.buildCustomOrdering()); - - this.setOrderColumnOrdering_(this.buildOrderColumnOrdering()); - this.orderColumn.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.orderColumn.update(); - } - - - // ********** specified order by ********** - - public String getSpecifiedOrderBy() { - return this.specifiedOrderBy; - } - - public void setSpecifiedOrderBy(String orderBy) { - if (orderBy != null) { - this.removeOrderColumnAnnotation(); - this.getOrderByAnnotationForUpdate().setValue(orderBy); - - this.setSpecifiedOrderBy_(orderBy); - this.setNoOrdering_(false); - this.setPkOrdering_(false); - this.setCustomOrdering_(true); - this.setOrderColumnOrdering_(false); - } else { - this.setNoOrdering(true); // hmmm... - } - } - - protected void setSpecifiedOrderBy_(String orderBy) { - String old = this.specifiedOrderBy; - this.specifiedOrderBy = orderBy; - this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy); - } - - protected String buildSpecifiedOrderBy() { - if (this.orderColumnAnnotationIsPresent()) { - return null; - } - OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation(); - return (orderByAnnotation == null) ? null : orderByAnnotation.getValue(); - } - - - // ********** no ordering ********** - - public boolean isNoOrdering() { - return this.noOrdering; - } - - public void setNoOrdering(boolean noOrdering) { - if (noOrdering) { - this.removeOrderColumnAnnotation(); - if (this.getOrderByAnnotation() != null) { - this.removeOrderByAnnotation(); - } - - this.setSpecifiedOrderBy_(null); - this.setNoOrdering_(true); - this.setPkOrdering_(false); - this.setCustomOrdering_(false); - this.setOrderColumnOrdering_(false); - } else { - this.setPkOrdering(true); // hmmm... - } - } - - protected void setNoOrdering_(boolean noOrdering) { - boolean old = this.noOrdering; - this.noOrdering = noOrdering; - this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering); - } - - protected boolean buildNoOrdering() { - return this.isJpa2_0Compatible() ? this.buildNoOrdering2_0() : this.buildNoOrdering1_0(); - } - - /** - * both annotations are missing or both are present - */ - protected boolean buildNoOrdering2_0() { - boolean orderByMissing = (this.getOrderByAnnotation() == null); - boolean orderByPresent = ! orderByMissing; - boolean orderColumnMissing = (this.getOrderColumnAnnotation() == null); - boolean orderColumnPresent = ! orderColumnMissing; - return (orderByMissing && orderColumnMissing) || (orderByPresent && orderColumnPresent); - } - - /** - * the order-by annotation is missing - */ - protected boolean buildNoOrdering1_0() { - return this.getOrderByAnnotation() == null; - } - - - // ********** pk ordering ********** - - public boolean isPkOrdering() { - return this.pkOrdering; - } - - public void setPkOrdering(boolean pkOrdering) { - if (pkOrdering) { - this.removeOrderColumnAnnotation(); - OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation(); - if (orderByAnnotation == null) { - this.addOrderByAnnotation(); - } else { - orderByAnnotation.setValue(null); - } - - this.setSpecifiedOrderBy_(null); - this.setNoOrdering_(false); - this.setPkOrdering_(true); - this.setCustomOrdering_(false); - this.setOrderColumnOrdering_(false); - } else { - this.setNoOrdering(true); // hmmm... - } - } - - protected void setPkOrdering_(boolean pkOrdering) { - boolean old = this.pkOrdering; - this.pkOrdering = pkOrdering; - this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering); - } - - /** - * the order-by annotation is present but no value specified - */ - protected boolean buildPkOrdering() { - if (this.orderColumnAnnotationIsPresent()) { - return false; - } - OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation(); - return (orderByAnnotation != null) && (orderByAnnotation.getValue() == null); - } - - - // ********** custom ordering ********** - - public boolean isCustomOrdering() { - return this.customOrdering; - } - - public void setCustomOrdering(boolean customOrdering) { - if (customOrdering) { - this.setSpecifiedOrderBy(""); //$NON-NLS-1$ - } else { - this.setNoOrdering(true); // hmmm... - } - } - - protected void setCustomOrdering_(boolean customOrdering) { - boolean old = this.customOrdering; - this.customOrdering = customOrdering; - this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering); - } - - /** - * the order-by annotation is present and it has a specified value - */ - protected boolean buildCustomOrdering() { - if (this.orderColumnAnnotationIsPresent()) { - return false; - } - OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation(); - return (orderByAnnotation != null) && (orderByAnnotation.getValue() != null); - } - - - // ********** order column ordering ********** - - public boolean isOrderColumnOrdering() { - return this.orderColumnOrdering; - } - - public void setOrderColumnOrdering(boolean orderColumnOrdering) { - if (orderColumnOrdering) { - this.removeOrderByAnnotation(); - if (this.getOrderColumnAnnotation() == null) { - this.addOrderColumnAnnotation(); - } - - this.setSpecifiedOrderBy_(null); - this.setNoOrdering_(false); - this.setPkOrdering_(false); - this.setCustomOrdering_(false); - this.setOrderColumnOrdering_(true); - } else { - this.setNoOrdering(true); // hmmm... - } - } - - protected void setOrderColumnOrdering_(boolean orderColumnOrdering) { - boolean old = this.orderColumnOrdering; - this.orderColumnOrdering = orderColumnOrdering; - this.firePropertyChanged(ORDER_COLUMN_ORDERING_PROPERTY, old, orderColumnOrdering); - } - - /** - * JPA 2.0 only; - * the order column annotation is present and - * the order-by annotation is missing - */ - protected boolean buildOrderColumnOrdering() { - return this.orderColumnAnnotationIsPresent() && - (this.getOrderByAnnotation() == null); - } - - - // ********** order column ********** - - public JavaOrderColumn2_0 getOrderColumn() { - return this.orderColumn; - } - - protected JavaOrderColumn2_0 buildOrderColumn() { - JavaNamedColumn.Owner columnOwner = new OrderColumnOwner(); - return this.isJpa2_0Compatible() ? - this.getJpaFactory2_0().buildJavaOrderColumn(this, columnOwner) : - new GenericJavaOrderColumn2_0(this, columnOwner); - } - - - // ********** order by annotation ********** - - protected OrderByAnnotation getOrderByAnnotation() { - return (OrderByAnnotation) this.getResourcePersistentAttribute().getAnnotation(OrderByAnnotation.ANNOTATION_NAME); - } - - protected OrderByAnnotation getOrderByAnnotationForUpdate() { - OrderByAnnotation annotation = this.getOrderByAnnotation(); - return (annotation != null) ? annotation : this.addOrderByAnnotation(); - } - - protected OrderByAnnotation addOrderByAnnotation() { - return (OrderByAnnotation) this.getResourcePersistentAttribute().addAnnotation(OrderByAnnotation.ANNOTATION_NAME); - } - - protected void removeOrderByAnnotation() { - this.getResourcePersistentAttribute().removeAnnotation(OrderByAnnotation.ANNOTATION_NAME); - } - - - // ********** order column annotation ********** - - protected OrderColumn2_0Annotation getOrderColumnAnnotation() { - return (OrderColumn2_0Annotation) this.getResourcePersistentAttribute().getAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME); - } - - /** - * NB: Only return true for JPA 2.0 mappings. - */ - protected boolean orderColumnAnnotationIsPresent() { - return this.isJpa2_0Compatible() && (this.getOrderColumnAnnotation() != null); - } - - protected OrderColumn2_0Annotation addOrderColumnAnnotation() { - return (OrderColumn2_0Annotation) this.getResourcePersistentAttribute().addAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME); - } - - protected void removeOrderColumnAnnotation() { - if (this.orderColumnAnnotationIsPresent()) { - this.removeOrderColumnAnnotation_(); - } - } - - protected void removeOrderColumnAnnotation_() { - this.getResourcePersistentAttribute().removeAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME); - } - - - // ********** misc ********** - - @Override - public JavaAttributeMapping getParent() { - return (JavaAttributeMapping) super.getParent(); - } - - protected JavaAttributeMapping getAttributeMapping() { - return this.getParent(); - } - - protected JavaPersistentAttribute getPersistentAttribute() { - return this.getAttributeMapping().getPersistentAttribute(); - } - - public JavaResourcePersistentAttribute getResourcePersistentAttribute() { - return this.getPersistentAttribute().getResourcePersistentAttribute(); - } - - // JPA 2.0 only - public String getDefaultTableName() { - return this.owner.getTableName(); - } - - // JPA 2.0 only - protected Table resolveDbTable(String tableName) { - return this.owner.resolveDbTable(tableName); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - return this.orderColumn.javaCompletionProposals(pos, filter, astRoot); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - TextRange textRange = this.getOrderByAnnotationTextRange(astRoot); - return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange(astRoot); - } - - protected TextRange getOrderByAnnotationTextRange(CompilationUnit astRoot) { - OrderByAnnotation orderByAnnotation = this.getOrderByAnnotation(); - return (orderByAnnotation == null) ? null : orderByAnnotation.getTextRange(astRoot); - } - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - if (this.orderColumnAnnotationIsPresent() && (this.getOrderByAnnotation() != null)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ORDER_COLUMN_AND_ORDER_BY_BOTH_SPECIFIED, - new String[] {this.getPersistentAttribute().getName()}, - this.getAttributeMapping(), - this.getOrderByAnnotationTextRange(astRoot) - ) - ); - } - if (this.orderColumnOrdering) { - //TODO validation message if type is not List - this.orderColumn.validate(messages, reporter, astRoot); - } - } - - - // ********** order column owner (JPA 2.0) ********** - - protected class OrderColumnOwner - implements JavaNamedColumn.Owner - { - public String getDefaultTableName() { - return GenericJavaOrderable.this.getDefaultTableName(); - } - - public Table resolveDbTable(String tableName) { - return GenericJavaOrderable.this.resolveDbTable(tableName); - } - - public String getDefaultColumnName() { - return this.getPersistentAttribute().getName() + "_ORDER"; //$NON-NLS-1$ - } - - public TypeMapping getTypeMapping() { - return this.getPersistentAttribute().getOwningTypeMapping(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return GenericJavaOrderable.this.getValidationTextRange(astRoot); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new OrderColumnValidator((OrderColumn2_0) column, textRangeResolver); - } - - protected JavaPersistentAttribute getPersistentAttribute() { - return GenericJavaOrderable.this.getPersistentAttribute(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java deleted file mode 100644 index e6804dbb4f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaOverrideRelationship.java +++ /dev/null @@ -1,247 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.MappedByRelationship; -import org.eclipse.jpt.jpa.core.context.OverrideRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyOverrideRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.java.GenericJavaOverrideJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaOverrideJoinTableRelationshipStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOverrideRelationship2_0; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaOverrideRelationship - extends AbstractJavaJpaContextNode - implements JavaOverrideRelationship2_0 -{ - protected JavaRelationshipStrategy strategy; - - protected final JavaJoinColumnRelationshipStrategy joinColumnStrategy; - - // JPA 2.0 - protected final JavaJoinTableRelationshipStrategy joinTableStrategy; - - - public GenericJavaOverrideRelationship(JavaAssociationOverride parent) { - super(parent); - this.joinColumnStrategy = this.buildJoinColumnStrategy(); - this.joinTableStrategy = this.buildJoinTableStrategy(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.joinColumnStrategy.synchronizeWithResourceModel(); - this.joinTableStrategy.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.setStrategy(this.buildStrategy()); - this.joinColumnStrategy.update(); - this.joinTableStrategy.update(); - } - - - // ********** strategy ********** - - public JavaRelationshipStrategy getStrategy() { - return this.strategy; - } - - protected void setStrategy(JavaRelationshipStrategy strategy) { - JavaRelationshipStrategy old = this.strategy; - this.strategy = strategy; - this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy); - } - - protected JavaRelationshipStrategy buildStrategy() { - if (this.isJpa2_0Compatible()) { - if (this.joinColumnStrategy.hasSpecifiedJoinColumns()) { - return this.joinColumnStrategy; - } - return this.joinTableStrategy; - } - return this.joinColumnStrategy; - } - - - // ********** join column strategy ********** - - public JavaJoinColumnRelationshipStrategy getJoinColumnStrategy() { - return this.joinColumnStrategy; - } - - public boolean strategyIsJoinColumn() { - return this.strategy == this.joinColumnStrategy; - } - - public void setStrategyToJoinColumn() { - this.joinColumnStrategy.addStrategy(); - this.joinTableStrategy.removeStrategy(); - } - - public boolean mayHaveDefaultJoinColumn() { - return false; - } - - protected JavaJoinColumnRelationshipStrategy buildJoinColumnStrategy() { - return new GenericJavaOverrideJoinColumnRelationshipStrategy(this); - } - - - // ********** join table strategy ********** - - public JavaJoinTableRelationshipStrategy getJoinTableStrategy() { - return this.joinTableStrategy; - } - - public boolean strategyIsJoinTable() { - return this.strategy == this.joinTableStrategy; - } - - public void setStrategyToJoinTable() { - this.joinTableStrategy.addStrategy(); - this.joinColumnStrategy.removeStrategy(); - } - - public boolean mayHaveDefaultJoinTable() { - return this.isVirtual() && this.strategyIsJoinTable(); - } - - protected JavaJoinTableRelationshipStrategy buildJoinTableStrategy() { - return this.isJpa2_0Compatible() ? - new GenericJavaOverrideJoinTableRelationshipStrategy2_0(this) : - new NullJavaJoinTableRelationshipStrategy(this); - } - - - // ********** conversions ********** - - public void initializeFrom(ReadOnlyRelationship oldRelationship) { - oldRelationship.initializeOn(this); - } - - public void initializeOn(Relationship newRelationship) { - newRelationship.initializeFromJoinTableRelationship(this); - newRelationship.initializeFromJoinColumnRelationship(this); - } - - public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) { - // NOP - } - - public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) { - this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy()); - } - - public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) { - this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy()); - } - - public void initializeFromVirtual(ReadOnlyOverrideRelationship virtualRelationship) { - virtualRelationship.initializeOnSpecified(this); - } - - public void initializeOnSpecified(OverrideRelationship specifiedRelationship) { - throw new UnsupportedOperationException(); - } - - public void initializeFromVirtualJoinTableRelationship(ReadOnlyJoinTableRelationship virtualRelationship) { - this.joinTableStrategy.initializeFromVirtual(virtualRelationship.getJoinTableStrategy()); - } - - public void initializeFromVirtualJoinColumnRelationship(ReadOnlyJoinColumnRelationship virtualRelationship) { - this.joinColumnStrategy.initializeFromVirtual(virtualRelationship.getJoinColumnStrategy()); - } - - - // ********** misc ********** - - @Override - public JavaAssociationOverride getParent() { - return (JavaAssociationOverride) super.getParent(); - } - - public JavaAssociationOverride getAssociationOverride() { - return this.getParent(); - } - - public TypeMapping getTypeMapping() { - return this.getAssociationOverride().getContainer().getTypeMapping(); - } - - public Entity getEntity() { - TypeMapping typeMapping = this.getTypeMapping(); - return (typeMapping instanceof Entity) ? (Entity) typeMapping : null; - } - - public boolean isVirtual() { - return false; - } - - public RelationshipMapping getMapping() { - return this.getAssociationOverride().getMapping(); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - result = this.joinColumnStrategy.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - - return this.joinTableStrategy.javaCompletionProposals(pos, filter, astRoot); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getAssociationOverride().getValidationTextRange(astRoot); - } - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.joinColumnStrategy.validate(messages, reporter, astRoot); - this.joinTableStrategy.validate(messages, reporter, astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java deleted file mode 100644 index 21dd9cd90e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentAttribute.java +++ /dev/null @@ -1,52 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericPersistentAttributeValidator; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * Generic Java persistent attribute - */ -public class GenericJavaPersistentAttribute - extends AbstractJavaPersistentAttribute -{ - - public GenericJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa) { - super(parent, jrpa); - } - - - // ********** access ********** - - /** - * JPA 1.0 does not support specified access, so we return null. - */ - @Override - public AccessType getSpecifiedAccess() { - return null; - } - - public void setSpecifiedAccess(AccessType access) { - throw new UnsupportedOperationException(); - } - - // ********** validation ********** - - @Override - protected JptValidator buildAttibuteValidator(CompilationUnit astRoot) { - return new GenericPersistentAttributeValidator(this, this, buildTextRangeResolver(astRoot)); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java deleted file mode 100644 index b66d1aecf2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPersistentType.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * JPA 1.0 Java persistent type. - * The specified access is always null. - */ -public class GenericJavaPersistentType - extends AbstractJavaPersistentType -{ - public GenericJavaPersistentType(PersistentType.Owner parent, JavaResourcePersistentType jrpt) { - super(parent, jrpt); - } - - - // ********** access ********** - - /** - * Return null - JPA 1.0 does not support a specified access. - */ - @Override - protected AccessType buildSpecifiedAccess() { - return null; - } - - /** - * JPA 1.0 does not support a specified access. - */ - public void setSpecifiedAccess(AccessType specifiedAccess) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java deleted file mode 100644 index 8e5c92d5c4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaPrimaryKeyJoinColumn.java +++ /dev/null @@ -1,208 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaNamedColumn; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaPrimaryKeyJoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.db.Column; -import org.eclipse.jpt.jpa.db.Table; - -/** - * Java primary key join column - */ -public class GenericJavaPrimaryKeyJoinColumn - extends AbstractJavaNamedColumn - implements JavaPrimaryKeyJoinColumn -{ - /** @see AbstractJavaNamedColumn#AbstractJavaNamedColumn(org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode, org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn.Owner, org.eclipse.jpt.jpa.core.resource.java.NamedColumnAnnotation) */ - protected /* final */ PrimaryKeyJoinColumnAnnotation columnAnnotation; // never null - - protected String specifiedReferencedColumnName; - protected String defaultReferencedColumnName; - - - public GenericJavaPrimaryKeyJoinColumn(JavaJpaContextNode parent, JavaBaseJoinColumn.Owner owner, PrimaryKeyJoinColumnAnnotation columnAnnotation) { - super(parent, owner, columnAnnotation); - this.specifiedReferencedColumnName = this.buildSpecifiedReferencedColumnName(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedReferencedColumnName_(this.buildSpecifiedReferencedColumnName()); - } - - @Override - public void update() { - super.update(); - this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName()); - } - - - // ********** column annotation ********** - - @Override - public PrimaryKeyJoinColumnAnnotation getColumnAnnotation() { - return this.columnAnnotation; - } - - @Override - protected void setColumnAnnotation(PrimaryKeyJoinColumnAnnotation columnAnnotation) { - this.columnAnnotation = columnAnnotation; - } - - @Override - protected void removeColumnAnnotation() { - // we don't remove a pk join column annotation when it is empty - } - - - // ********** referenced column name ********** - - public String getReferencedColumnName() { - return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName; - } - - public String getSpecifiedReferencedColumnName() { - return this.specifiedReferencedColumnName; - } - - public void setSpecifiedReferencedColumnName(String name) { - if (this.valuesAreDifferent(this.specifiedReferencedColumnName, name)) { - this.columnAnnotation.setReferencedColumnName(name); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedReferencedColumnName_(name); - } - } - - protected void setSpecifiedReferencedColumnName_(String name) { - String old = this.specifiedReferencedColumnName; - this.specifiedReferencedColumnName = name; - this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedReferencedColumnName() { - return this.columnAnnotation.getReferencedColumnName(); - } - - public String getDefaultReferencedColumnName() { - return this.defaultReferencedColumnName; - } - - protected void setDefaultReferencedColumnName(String name) { - String old = this.defaultReferencedColumnName; - this.defaultReferencedColumnName = name; - this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name); - } - - // TODO not correct when we start supporting - // primary key join columns in 1-1 mappings - protected String buildDefaultReferencedColumnName() { - return this.buildDefaultName(); - } - - - // ********** database stuff ********** - - public Table getReferencedColumnDbTable() { - return this.owner.getReferencedColumnDbTable(); - } - - protected Column getReferencedDbColumn() { - Table table = this.getReferencedColumnDbTable(); - return (table == null) ? null : table.getColumnForIdentifier(this.getReferencedColumnName()); - } - - public boolean referencedColumnIsResolved() { - return this.getReferencedDbColumn() != null; - } - - - // ********** misc ********** - - public boolean isDefault() { - return this.owner.joinColumnIsDefault(this); - } - - @Override - public String getTable() { - return this.owner.getDefaultTableName(); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator connectedJavaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.connectedJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.referencedColumnNameTouches(pos, astRoot)) { - return this.getJavaCandidateReferencedColumnNames(filter).iterator(); - } - return null; - } - - public boolean referencedColumnNameTouches(int pos, CompilationUnit astRoot) { - return this.columnAnnotation.referencedColumnNameTouches(pos, astRoot); - } - - protected Iterable getJavaCandidateReferencedColumnNames(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.getCandidateReferencedColumnNames(filter)); - } - - protected Iterable getCandidateReferencedColumnNames(Filter filter) { - return new FilteringIterable(this.getCandidateReferencedColumnNames(), filter); - } - - protected Iterable getCandidateReferencedColumnNames() { - Table table = this.owner.getReferencedColumnDbTable(); - return (table != null) ? table.getSortedColumnIdentifiers() : EmptyIterable. instance(); - } - - - // ********** validation ********** - - @Override - protected NamedColumnTextRangeResolver buildTextRangeResolver(CompilationUnit astRoot) { - return new JavaPrimaryKeyJoinColumnTextRangeResolver(this, astRoot); - } - - public TextRange getReferencedColumnNameTextRange(CompilationUnit astRoot) { - TextRange textRange = this.columnAnnotation.getReferencedColumnNameTextRange(astRoot); - return textRange != null ? textRange : this.getValidationTextRange(astRoot); - } - - - // ********** misc ********** - - @Override - public void toString(StringBuilder sb) { - super.toString(sb); - sb.append("=>"); //$NON-NLS-1$ - sb.append(this.getReferencedColumnName()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java deleted file mode 100644 index 220db7e932..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryContainer.java +++ /dev/null @@ -1,370 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SubIterableWrapper; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.jpa.core.context.NamedNativeQuery; -import org.eclipse.jpt.jpa.core.context.NamedQuery; -import org.eclipse.jpt.jpa.core.context.Query; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaNamedNativeQuery; -import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery; -import org.eclipse.jpt.jpa.core.context.java.JavaQuery; -import org.eclipse.jpt.jpa.core.context.java.JavaQueryContainer; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueriesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java query container - */ -public class GenericJavaQueryContainer - extends AbstractJavaJpaContextNode - implements JavaQueryContainer -{ - protected final Owner owner; - - protected final Vector namedQueries = new Vector(); - protected NamedQueryContainerAdapter namedQueryContainerAdapter = new NamedQueryContainerAdapter(); - - protected final Vector namedNativeQueries = new Vector(); - protected NamedNativeQueryContainerAdapter namedNativeQueryContainerAdapter = new NamedNativeQueryContainerAdapter(); - - - public GenericJavaQueryContainer(JavaJpaContextNode parent, Owner owner) { - super(parent); - this.owner = owner; - this.initializeNamedQueries(); - this.initializeNamedNativeQueries(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncNamedQueries(); - this.syncNamedNativeQueries(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getNamedQueries()); - this.updateNodes(this.getNamedNativeQueries()); - } - - - // ********** named queries ********** - - public ListIterator namedQueries() { - return this.getNamedQueries().iterator(); - } - - protected ListIterable getNamedQueries() { - return new LiveCloneListIterable(this.namedQueries); - } - - public int namedQueriesSize() { - return this.namedQueries.size(); - } - - public JavaNamedQuery addNamedQuery() { - return this.addNamedQuery(this.namedQueries.size()); - } - - public JavaNamedQuery addNamedQuery(int index) { - NamedQueryAnnotation annotation = this.buildNamedQueryAnnotation(index); - return this.addNamedQuery_(index, annotation); - } - - protected NamedQueryAnnotation buildNamedQueryAnnotation(int index) { - return (NamedQueryAnnotation) this.owner.getResourceAnnotatedElement().addAnnotation(index, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); - } - - public void removeNamedQuery(NamedQuery namedQuery) { - this.removeNamedQuery(this.namedQueries.indexOf(namedQuery)); - } - - public void removeNamedQuery(int index) { - this.owner.getResourceAnnotatedElement().removeAnnotation(index, NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); - this.removeNamedQuery_(index); - } - - protected void removeNamedQuery_(int index) { - this.removeItemFromList(index, this.namedQueries, NAMED_QUERIES_LIST); - } - - public void moveNamedQuery(int targetIndex, int sourceIndex) { - this.owner.getResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, NamedQueriesAnnotation.ANNOTATION_NAME); - this.moveItemInList(targetIndex, sourceIndex, this.namedQueries, NAMED_QUERIES_LIST); - } - - protected void initializeNamedQueries() { - for (NamedQueryAnnotation annotation : this.getNamedQueryAnnotations()) { - this.namedQueries.add(this.buildNamedQuery(annotation)); - } - } - - protected JavaNamedQuery buildNamedQuery(NamedQueryAnnotation namedQueryAnnotation) { - return this.getJpaFactory().buildJavaNamedQuery(this, namedQueryAnnotation); - } - - protected void syncNamedQueries() { - ContextContainerTools.synchronizeWithResourceModel(this.namedQueryContainerAdapter); - } - - protected Iterable getNamedQueryAnnotations() { - return new SubIterableWrapper( - CollectionTools.iterable(this.namedQueryAnnotations()) - ); - } - - protected Iterator namedQueryAnnotations() { - return this.owner.getResourceAnnotatedElement().annotations(NamedQueryAnnotation.ANNOTATION_NAME, NamedQueriesAnnotation.ANNOTATION_NAME); - } - - protected void moveNamedQuery_(int index, JavaNamedQuery namedQuery) { - this.moveItemInList(index, namedQuery, this.namedQueries, NAMED_QUERIES_LIST); - } - - protected JavaNamedQuery addNamedQuery_(int index, NamedQueryAnnotation namedQueryAnnotation) { - JavaNamedQuery query = this.buildNamedQuery(namedQueryAnnotation); - this.addItemToList(index, query, this.namedQueries, NAMED_QUERIES_LIST); - return query; - } - - protected void removeNamedQuery_(JavaNamedQuery namedQuery) { - this.removeNamedQuery_(this.namedQueries.indexOf(namedQuery)); - } - - /** - * named query container adapter - */ - protected class NamedQueryContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericJavaQueryContainer.this.getNamedQueries(); - } - public Iterable getResourceElements() { - return GenericJavaQueryContainer.this.getNamedQueryAnnotations(); - } - public NamedQueryAnnotation getResourceElement(JavaNamedQuery contextElement) { - return contextElement.getQueryAnnotation(); - } - public void moveContextElement(int index, JavaNamedQuery element) { - GenericJavaQueryContainer.this.moveNamedQuery_(index, element); - } - public void addContextElement(int index, NamedQueryAnnotation resourceElement) { - GenericJavaQueryContainer.this.addNamedQuery_(index, resourceElement); - } - public void removeContextElement(JavaNamedQuery element) { - GenericJavaQueryContainer.this.removeNamedQuery_(element); - } - } - - - // ********** named native queries ********** - - public ListIterator namedNativeQueries() { - return this.getNamedNativeQueries().iterator(); - } - - protected ListIterable getNamedNativeQueries() { - return new LiveCloneListIterable(this.namedNativeQueries); - } - - public int namedNativeQueriesSize() { - return this.namedNativeQueries.size(); - } - - public JavaNamedNativeQuery addNamedNativeQuery() { - return this.addNamedNativeQuery(this.namedNativeQueries.size()); - } - - public JavaNamedNativeQuery addNamedNativeQuery(int index) { - NamedNativeQueryAnnotation annotation = this.buildNamedNativeQueryAnnotation(index); - return this.addNamedNativeQuery_(index, annotation); - } - - protected NamedNativeQueryAnnotation buildNamedNativeQueryAnnotation(int index) { - return (NamedNativeQueryAnnotation) this.owner.getResourceAnnotatedElement().addAnnotation(index, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); - } - - public void removeNamedNativeQuery(NamedNativeQuery namedNativeQuery) { - this.removeNamedNativeQuery(this.namedNativeQueries.indexOf(namedNativeQuery)); - } - - public void removeNamedNativeQuery(int index) { - this.owner.getResourceAnnotatedElement().removeAnnotation(index, NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); - this.removeNamedNativeQuery_(index); - } - - protected void removeNamedNativeQuery_(int index) { - this.removeItemFromList(index, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST); - } - - public void moveNamedNativeQuery(int targetIndex, int sourceIndex) { - this.owner.getResourceAnnotatedElement().moveAnnotation(targetIndex, sourceIndex, NamedNativeQueriesAnnotation.ANNOTATION_NAME); - this.moveItemInList(targetIndex, sourceIndex, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST); - } - - protected void initializeNamedNativeQueries() { - for (NamedNativeQueryAnnotation annotation : this.getNamedNativeQueryAnnotations()) { - this.namedNativeQueries.add(this.buildNamedNativeQuery(annotation)); - } - } - - protected JavaNamedNativeQuery buildNamedNativeQuery(NamedNativeQueryAnnotation namedNativeQueryAnnotation) { - return this.getJpaFactory().buildJavaNamedNativeQuery(this, namedNativeQueryAnnotation); - } - - protected void syncNamedNativeQueries() { - ContextContainerTools.synchronizeWithResourceModel(this.namedNativeQueryContainerAdapter); - } - - protected Iterable getNamedNativeQueryAnnotations() { - return new SubIterableWrapper( - CollectionTools.iterable(this.namedNativeQueryAnnotations()) - ); - } - - protected Iterator namedNativeQueryAnnotations() { - return this.owner.getResourceAnnotatedElement().annotations(NamedNativeQueryAnnotation.ANNOTATION_NAME, NamedNativeQueriesAnnotation.ANNOTATION_NAME); - } - - protected void moveNamedNativeQuery_(int index, JavaNamedNativeQuery namedNativeQuery) { - this.moveItemInList(index, namedNativeQuery, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST); - } - - protected JavaNamedNativeQuery addNamedNativeQuery_(int index, NamedNativeQueryAnnotation namedNativeQueryAnnotation) { - JavaNamedNativeQuery query = this.buildNamedNativeQuery(namedNativeQueryAnnotation); - this.addItemToList(index, query, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST); - return query; - } - - protected void removeNamedNativeQuery_(JavaNamedNativeQuery namedNativeQuery) { - this.removeNamedNativeQuery_(this.namedNativeQueries.indexOf(namedNativeQuery)); - } - - /** - * named native query container adapter - */ - protected class NamedNativeQueryContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericJavaQueryContainer.this.getNamedNativeQueries(); - } - public Iterable getResourceElements() { - return GenericJavaQueryContainer.this.getNamedNativeQueryAnnotations(); - } - public NamedNativeQueryAnnotation getResourceElement(JavaNamedNativeQuery contextElement) { - return contextElement.getQueryAnnotation(); - } - public void moveContextElement(int index, JavaNamedNativeQuery element) { - GenericJavaQueryContainer.this.moveNamedNativeQuery_(index, element); - } - public void addContextElement(int index, NamedNativeQueryAnnotation resourceElement) { - GenericJavaQueryContainer.this.addNamedNativeQuery_(index, resourceElement); - } - public void removeContextElement(JavaNamedNativeQuery element) { - GenericJavaQueryContainer.this.removeNamedNativeQuery_(element); - } - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.validateQueries(messages, astRoot); - } - - protected void validateQueries(List messages, CompilationUnit astRoot) { - for (Iterator localQueries = this.queries(); localQueries.hasNext(); ) { - JavaQuery localQuery = localQueries.next(); - String name = localQuery.getName(); - if (StringTools.stringIsEmpty(name)){ - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.QUERY_NAME_UNDEFINED, - new String[] {}, - localQuery, - localQuery.getNameTextRange(astRoot) - ) - ); - } else { - List reportedNames = new ArrayList(); - for (Iterator globalQueries = this.getPersistenceUnit().queries(); globalQueries.hasNext(); ) { - if (localQuery.duplicates(globalQueries.next()) && !reportedNames.contains(name)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.QUERY_DUPLICATE_NAME, - new String[] {name}, - localQuery, - localQuery.getNameTextRange(astRoot) - ) - ); - reportedNames.add(name); - } - } - } - String query = localQuery.getQuery(); - if (StringTools.stringIsEmpty(query)){ - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.QUERY_STATEMENT_UNDEFINED, - new String[] {name}, - localQuery, - localQuery.getNameTextRange(astRoot) - ) - ); - } - } - } - - - @SuppressWarnings("unchecked") - public Iterator queries() { - return new CompositeIterator(this.namedNativeQueries(), this.namedQueries()); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.owner.getResourceAnnotatedElement().getTextRange(astRoot); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryHint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryHint.java deleted file mode 100644 index ee05688b83..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaQueryHint.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaQuery; -import org.eclipse.jpt.jpa.core.context.java.JavaQueryHint; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.resource.java.QueryHintAnnotation; - -/** - * Java query hing - */ -public class GenericJavaQueryHint - extends AbstractJavaJpaContextNode - implements JavaQueryHint -{ - protected final QueryHintAnnotation queryHintAnnotation; - - protected String name; - protected String value; - - - public GenericJavaQueryHint(JavaQuery parent, QueryHintAnnotation queryHintAnnotation) { - super(parent); - this.queryHintAnnotation = queryHintAnnotation; - this.name = queryHintAnnotation.getName(); - this.value = queryHintAnnotation.getValue(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setName_(this.queryHintAnnotation.getName()); - this.setValue_(this.queryHintAnnotation.getValue()); - } - - - // ********** name ********** - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.queryHintAnnotation.setName(name); - this.setName_(name); - } - - protected void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - - // ********** value ********** - - public String getValue() { - return this.value; - } - - public void setValue(String value) { - this.queryHintAnnotation.setValue(value); - this.setValue_(value); - } - - protected void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.queryHintAnnotation.getTextRange(astRoot); - } - - - // ********** miscelleneous ********** - - public QueryHintAnnotation getQueryHintAnnotation() { - return this.queryHintAnnotation; - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java deleted file mode 100644 index 5f8c567183..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaReferenceTable.java +++ /dev/null @@ -1,317 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyReferenceTable; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaReferenceTable; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaTable; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.ReferenceTableAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java join table or collection table - */ -public abstract class GenericJavaReferenceTable - extends AbstractJavaTable - implements JavaReferenceTable -{ - protected final Vector specifiedJoinColumns = new Vector(); - protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter = new SpecifiedJoinColumnContainerAdapter(); - protected final JavaJoinColumn.Owner joinColumnOwner; - - protected JavaJoinColumn defaultJoinColumn; - - - protected GenericJavaReferenceTable(JavaJpaContextNode parent, Owner owner) { - super(parent, owner); - this.joinColumnOwner = this.buildJoinColumnOwner(); - this.initializeSpecifiedJoinColumns(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncSpecifiedJoinColumns(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getSpecifiedJoinColumns()); - this.updateDefaultJoinColumn(); - } - - - // ********** join columns ********** - - public ListIterator joinColumns() { - return this.getJoinColumns().iterator(); - } - - protected ListIterable getJoinColumns() { - return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns(); - } - - public int joinColumnsSize() { - return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize(); - } - - public void convertDefaultToSpecifiedJoinColumn() { - MappingTools.convertReferenceTableDefaultToSpecifiedJoinColumn(this); - } - - - // ********** specified join columns ********** - - public ListIterator specifiedJoinColumns() { - return this.getSpecifiedJoinColumns().iterator(); - } - - protected ListIterable getSpecifiedJoinColumns() { - return new LiveCloneListIterable(this.specifiedJoinColumns); - } - - public int specifiedJoinColumnsSize() { - return this.specifiedJoinColumns.size(); - } - - public boolean hasSpecifiedJoinColumns() { - return this.specifiedJoinColumns.size() != 0; - } - - public JavaJoinColumn getSpecifiedJoinColumn(int index) { - return this.specifiedJoinColumns.get(index); - } - - public JavaJoinColumn addSpecifiedJoinColumn() { - return this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size()); - } - - public JavaJoinColumn addSpecifiedJoinColumn(int index) { - JoinColumnAnnotation annotation = this.getTableAnnotation().addJoinColumn(index); - return this.addSpecifiedJoinColumn_(index, annotation); - } - - public void removeSpecifiedJoinColumn(JoinColumn joinColumn) { - this.removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn)); - } - - public void removeSpecifiedJoinColumn(int index) { - this.getTableAnnotation().removeJoinColumn(index); - this.removeTableAnnotationIfUnset(); - this.removeSpecifiedJoinColumn_(index); - } - - protected void removeSpecifiedJoinColumn_(int index) { - this.removeItemFromList(index, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) { - this.getTableAnnotation().moveJoinColumn(targetIndex, sourceIndex); - this.moveItemInList(targetIndex, sourceIndex, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - protected void initializeSpecifiedJoinColumns() { - for (JoinColumnAnnotation joinColumnAnnotation : this.getJoinColumnAnnotations()) { - this.specifiedJoinColumns.add(this.buildJoinColumn(joinColumnAnnotation)); - } - } - - protected void syncSpecifiedJoinColumns() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedJoinColumnContainerAdapter); - } - - protected Iterable getJoinColumnAnnotations() { - return CollectionTools.iterable(this.getTableAnnotation().joinColumns()); - } - - protected void moveSpecifiedJoinColumn_(int index, JavaJoinColumn joinColumn) { - this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - protected JavaJoinColumn addSpecifiedJoinColumn_(int index, JoinColumnAnnotation joinColumnAnnotation) { - JavaJoinColumn joinColumn = this.buildJoinColumn(joinColumnAnnotation); - this.addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - return joinColumn; - } - - protected void removeSpecifiedJoinColumn_(JavaJoinColumn joinColumn) { - this.removeSpecifiedJoinColumn_(this.specifiedJoinColumns.indexOf(joinColumn)); - } - - /** - * specified join column container adapter - */ - protected class SpecifiedJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericJavaReferenceTable.this.getSpecifiedJoinColumns(); - } - public Iterable getResourceElements() { - return GenericJavaReferenceTable.this.getJoinColumnAnnotations(); - } - public JoinColumnAnnotation getResourceElement(JavaJoinColumn contextElement) { - return contextElement.getColumnAnnotation(); - } - public void moveContextElement(int index, JavaJoinColumn element) { - GenericJavaReferenceTable.this.moveSpecifiedJoinColumn_(index, element); - } - public void addContextElement(int index, JoinColumnAnnotation resourceElement) { - GenericJavaReferenceTable.this.addSpecifiedJoinColumn_(index, resourceElement); - } - public void removeContextElement(JavaJoinColumn element) { - GenericJavaReferenceTable.this.removeSpecifiedJoinColumn_(element); - } - } - - protected abstract JavaJoinColumn.Owner buildJoinColumnOwner(); - - - // ********** default join column ********** - - public JavaJoinColumn getDefaultJoinColumn() { - return this.defaultJoinColumn; - } - - protected void setDefaultJoinColumn(JavaJoinColumn joinColumn) { - JavaJoinColumn old = this.defaultJoinColumn; - this.defaultJoinColumn = joinColumn; - this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn); - } - - protected ListIterable getDefaultJoinColumns() { - return (this.defaultJoinColumn != null) ? - new SingleElementListIterable(this.defaultJoinColumn) : - EmptyListIterable.instance(); - } - - protected int getDefaultJoinColumnsSize() { - return (this.defaultJoinColumn == null) ? 0 : 1; - } - - protected void updateDefaultJoinColumn() { - if (this.buildsDefaultJoinColumn()) { - if (this.defaultJoinColumn == null) { - this.setDefaultJoinColumn(this.buildJoinColumn(new NullJoinColumnAnnotation(this.getTableAnnotation()))); - } else { - this.defaultJoinColumn.update(); - } - } else { - this.setDefaultJoinColumn(null); - } - } - - protected boolean buildsDefaultJoinColumn() { - return ! this.hasSpecifiedJoinColumns(); - } - - - // ********** misc ********** - - protected void initializeFrom(ReadOnlyReferenceTable oldTable) { - super.initializeFrom(oldTable); - for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldTable.specifiedJoinColumns())) { - this.addSpecifiedJoinColumn().initializeFrom(joinColumn); - } - } - - protected void initializeFromVirtual(ReadOnlyReferenceTable virtualTable) { - super.initializeFromVirtual(virtualTable); - for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualTable.joinColumns())) { - this.addSpecifiedJoinColumn().initializeFromVirtual(joinColumn); - } - } - - protected JavaJoinColumn buildJoinColumn(JoinColumnAnnotation joinColumnAnnotation) { - return this.buildJoinColumn(this.joinColumnOwner, joinColumnAnnotation); - } - - protected JavaJoinColumn buildJoinColumn(JavaJoinColumn.Owner jcOwner, JoinColumnAnnotation joinColumnAnnotation) { - return this.getJpaFactory().buildJavaJoinColumn(this, jcOwner, joinColumnAnnotation); - } - - @Override - protected String buildDefaultSchema() { - return this.getContextDefaultSchema(); - } - - @Override - protected String buildDefaultCatalog() { - return this.getContextDefaultCatalog(); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - for (JavaJoinColumn column : CollectionTools.iterable(this.joinColumns())) { - result = column.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - return null; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - boolean continueValidating = this.buildTableValidator(astRoot).validate(messages, reporter); - - //join column validation will handle the check for whether to validate against the database - //some validation messages are not database specific. If the database validation for the - //table fails we will stop there and not validate the join columns at all - if (continueValidating) { - this.validateJoinColumns(messages, reporter, astRoot); - } - } - - protected void validateJoinColumns(List messages, IReporter reporter, CompilationUnit astRoot) { - this.validateJoinColumns(this.joinColumns(), messages, reporter, astRoot); - } - - protected void validateJoinColumns(Iterator joinColumns, List messages, IReporter reporter, CompilationUnit astRoot) { - while (joinColumns.hasNext()) { - joinColumns.next().validate(messages, reporter, astRoot); - } - } -} - diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java deleted file mode 100644 index d65b862cc4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSecondaryTable.java +++ /dev/null @@ -1,400 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.jpa.core.context.BaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaEntity; -import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaSecondaryTable; -import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaTable; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.SecondaryTablePrimaryKeyJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullPrimaryKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.PrimaryKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.SecondaryTableAnnotation; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Java secondary table - */ -public class GenericJavaSecondaryTable - extends AbstractJavaTable - implements JavaSecondaryTable -{ - /** @see AbstractJavaTable#AbstractJavaTable(org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode, org.eclipse.jpt.jpa.core.context.Table.Owner, org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation) */ - protected /* final */ SecondaryTableAnnotation tableAnnotation; - - protected final Vector specifiedPrimaryKeyJoinColumns = new Vector(); - protected final SpecifiedPrimaryKeyJoinColumnContainerAdapter specifiedPrimaryKeyJoinColumnContainerAdapter = new SpecifiedPrimaryKeyJoinColumnContainerAdapter(); - protected final JavaBaseJoinColumn.Owner primaryKeyJoinColumnOwner; - - protected JavaPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn; - - - public GenericJavaSecondaryTable(JavaEntity parent, Owner owner, SecondaryTableAnnotation tableAnnotation) { - super(parent, owner, tableAnnotation); - this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner(); - this.initializeSpecifiedPrimaryKeyJoinColumns(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncSpecifiedPrimaryKeyJoinColumns(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getSpecifiedPrimaryKeyJoinColumns()); - this.updateDefaultPrimaryKeyJoinColumn(); - } - - - // ********** table annotation ********** - - @Override - public SecondaryTableAnnotation getTableAnnotation() { - return this.tableAnnotation; - } - - /** - * @see AbstractJavaTable - */ - @Override - protected void setTableAnnotation(SecondaryTableAnnotation tableAnnotation) { - this.tableAnnotation = tableAnnotation; - } - - @Override - protected void removeTableAnnotation() { - // even though its name is required, we don't remove a secondary table' - // annotation when it is empty since it is part of a list and it's not - // obvious whether this would be very user-helpful... - } - - protected String getAnnotationName() { - return SecondaryTableAnnotation.ANNOTATION_NAME; - } - - - // ********** primary key join columns ********** - - public ListIterator primaryKeyJoinColumns() { - return this.getPrimaryKeyJoinColumns().iterator(); - } - - protected ListIterable getPrimaryKeyJoinColumns() { - return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns(); - } - - public int primaryKeyJoinColumnsSize() { - return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize(); - } - - - // ********** specified primary key join columns ********** - - public ListIterator specifiedPrimaryKeyJoinColumns() { - return this.getSpecifiedPrimaryKeyJoinColumns().iterator(); - } - - public ListIterable getSpecifiedPrimaryKeyJoinColumns() { - return new LiveCloneListIterable(this.specifiedPrimaryKeyJoinColumns); - } - - public int specifiedPrimaryKeyJoinColumnsSize() { - return this.specifiedPrimaryKeyJoinColumns.size(); - } - - protected boolean hasSpecifiedPrimaryKeyJoinColumns() { - return this.specifiedPrimaryKeyJoinColumns.size() != 0; - } - - public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() { - return this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size()); - } - - public JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) { - PrimaryKeyJoinColumnAnnotation annotation = this.tableAnnotation.addPkJoinColumn(index); - return this.addSpecifiedPrimaryKeyJoinColumn_(index, annotation); - } - - public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) { - this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(joinColumn)); - } - - public void removeSpecifiedPrimaryKeyJoinColumn(int index) { - this.tableAnnotation.removePkJoinColumn(index); - this.removeTableAnnotationIfUnset(); - this.removeSpecifiedPrimaryKeyJoinColumn_(index); - } - - protected void removeSpecifiedPrimaryKeyJoinColumn_(int index) { - this.removeItemFromList(index, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) { - this.tableAnnotation.movePkJoinColumn(targetIndex, sourceIndex); - this.moveItemInList(targetIndex, sourceIndex, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - protected void initializeSpecifiedPrimaryKeyJoinColumns() { - for (PrimaryKeyJoinColumnAnnotation annotation : this.getPrimaryKeyJoinColumnAnnotations()) { - this.specifiedPrimaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(annotation)); - } - } - - protected void syncSpecifiedPrimaryKeyJoinColumns() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedPrimaryKeyJoinColumnContainerAdapter); - } - - protected Iterable getPrimaryKeyJoinColumnAnnotations() { - return CollectionTools.iterable(this.tableAnnotation.pkJoinColumns()); - } - - protected void moveSpecifiedPrimaryKeyJoinColumn_(int index, JavaPrimaryKeyJoinColumn joinColumn) { - this.moveItemInList(index, joinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - protected JavaPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn_(int index, PrimaryKeyJoinColumnAnnotation pkJoinColumnAnnotation) { - JavaPrimaryKeyJoinColumn joinColumn = this.buildPrimaryKeyJoinColumn(pkJoinColumnAnnotation); - this.addItemToList(index, joinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - return joinColumn; - } - - protected void removeSpecifiedPrimaryKeyJoinColumn_(JavaPrimaryKeyJoinColumn joinColumn) { - this.removeSpecifiedPrimaryKeyJoinColumn_(this.specifiedPrimaryKeyJoinColumns.indexOf(joinColumn)); - } - - /** - * specified primary key join column container adapter - */ - protected class SpecifiedPrimaryKeyJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericJavaSecondaryTable.this.getSpecifiedPrimaryKeyJoinColumns(); - } - public Iterable getResourceElements() { - return GenericJavaSecondaryTable.this.getPrimaryKeyJoinColumnAnnotations(); - } - public PrimaryKeyJoinColumnAnnotation getResourceElement(JavaPrimaryKeyJoinColumn contextElement) { - return contextElement.getColumnAnnotation(); - } - public void moveContextElement(int index, JavaPrimaryKeyJoinColumn element) { - GenericJavaSecondaryTable.this.moveSpecifiedPrimaryKeyJoinColumn_(index, element); - } - public void addContextElement(int index, PrimaryKeyJoinColumnAnnotation resourceElement) { - GenericJavaSecondaryTable.this.addSpecifiedPrimaryKeyJoinColumn_(index, resourceElement); - } - public void removeContextElement(JavaPrimaryKeyJoinColumn element) { - GenericJavaSecondaryTable.this.removeSpecifiedPrimaryKeyJoinColumn_(element); - } - } - - protected JavaBaseJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() { - return new PrimaryKeyJoinColumnOwner(); - } - - - // ********** default primary key join column ********** - - public JavaPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn() { - return this.defaultPrimaryKeyJoinColumn; - } - - protected void setDefaultPrimaryKeyJoinColumn(JavaPrimaryKeyJoinColumn joinColumn) { - JavaPrimaryKeyJoinColumn old = this.defaultPrimaryKeyJoinColumn; - this.defaultPrimaryKeyJoinColumn = joinColumn; - this.firePropertyChanged(DEFAULT_PRIMARY_KEY_JOIN_COLUMN, old, joinColumn); - } - - protected ListIterable getDefaultPrimaryKeyJoinColumns() { - return (this.defaultPrimaryKeyJoinColumn != null) ? - new SingleElementListIterable(this.defaultPrimaryKeyJoinColumn) : - EmptyListIterable.instance(); - } - - protected int getDefaultPrimaryKeyJoinColumnsSize() { - return (this.defaultPrimaryKeyJoinColumn == null) ? 0 : 1; - } - - protected void updateDefaultPrimaryKeyJoinColumn() { - if (this.buildsDefaultPrimaryKeyJoinColumn()) { - if (this.defaultPrimaryKeyJoinColumn == null) { - this.setDefaultPrimaryKeyJoinColumn(this.buildPrimaryKeyJoinColumn(new NullPrimaryKeyJoinColumnAnnotation(this.tableAnnotation))); - } else { - this.defaultPrimaryKeyJoinColumn.update(); - } - } else { - this.setDefaultPrimaryKeyJoinColumn(null); - } - } - - protected boolean buildsDefaultPrimaryKeyJoinColumn() { - return ! this.hasSpecifiedPrimaryKeyJoinColumns(); - } - - - // ********** misc ********** - - @Override - public JavaEntity getParent() { - return (JavaEntity) super.getParent(); - } - - protected JavaEntity getEntity() { - return this.getParent(); - } - - public boolean isVirtual() { - return false; - } - - protected JavaPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(PrimaryKeyJoinColumnAnnotation pkJoinColumnAnnotation) { - return this.getJpaFactory().buildJavaPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, pkJoinColumnAnnotation); - } - - - // ********** defaults ********** - - /** - * a secondary table doesn't have a default name - */ - @Override - protected String buildDefaultName() { - return null; - } - - @Override - protected String buildDefaultSchema() { - return this.getContextDefaultSchema(); - } - - @Override - protected String buildDefaultCatalog() { - return this.getContextDefaultCatalog(); - } - - - // ********** code completion ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - for (JavaPrimaryKeyJoinColumn column : CollectionTools.iterable(this.primaryKeyJoinColumns())) { - result = column.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - return null; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - boolean continueValidating = this.buildTableValidator(astRoot).validate(messages, reporter); - - //join column validation will handle the check for whether to validate against the database - //some validation messages are not database specific. If the database validation for the - //table fails we will stop there and not validate the join columns at all - if (continueValidating) { - for (Iterator stream = this.primaryKeyJoinColumns(); stream.hasNext(); ) { - stream.next().validate(messages, reporter, astRoot); - } - } - } - - public boolean validatesAgainstDatabase() { - return this.connectionProfileIsActive(); - } - - - // ********** primary key join column owner adapter ********** - - protected class PrimaryKeyJoinColumnOwner - implements JavaBaseJoinColumn.Owner - { - protected JavaEntity getEntity() { - return GenericJavaSecondaryTable.this.getEntity(); - } - - public TypeMapping getTypeMapping() { - return this.getEntity(); - } - - public String getDefaultTableName() { - return GenericJavaSecondaryTable.this.getName(); - } - - public Table resolveDbTable(String tableName) { - return GenericJavaSecondaryTable.this.getDbTable(); - } - - public Table getReferencedColumnDbTable() { - return this.getTypeMapping().getPrimaryDbTable(); - } - - public int joinColumnsSize() { - return GenericJavaSecondaryTable.this.primaryKeyJoinColumnsSize(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return GenericJavaSecondaryTable.this.defaultPrimaryKeyJoinColumn == joinColumn; - } - - public String getDefaultColumnName() { - if (this.joinColumnsSize() != 1) { - return null; - } - return this.getEntity().getPrimaryKeyColumnName(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return GenericJavaSecondaryTable.this.getValidationTextRange(astRoot); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new SecondaryTablePrimaryKeyJoinColumnValidator(GenericJavaSecondaryTable.this, (BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java deleted file mode 100644 index 88c717be27..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaSequenceGenerator.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaSequenceGenerator; -import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation; - -/** - * Java sequence generator - */ -public class GenericJavaSequenceGenerator - extends AbstractJavaSequenceGenerator -{ - public GenericJavaSequenceGenerator(JavaJpaContextNode parent, SequenceGeneratorAnnotation generatorAnnotation) { - super(parent, generatorAnnotation); - } - - - // ********** database stuff ********** - - /** - * The JPA 1.0 spec does not allow a sequence to specify a catalog. - */ - @Override - protected String getCatalog() { - return this.getContextDefaultCatalog(); - } - - /** - * The JPA 1.0 spec does not allow a sequence to specify a schema. - */ - @Override - protected String getSchema() { - return this.getContextDefaultSchema(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java deleted file mode 100644 index 5b2a3ab0a7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTable.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaEntity; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaTable; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.java.TableAnnotation; - -/** - * Java table - */ -public class GenericJavaTable - extends AbstractJavaTable -{ - public GenericJavaTable(JavaEntity parent, Owner owner) { - super(parent, owner); - } - - - // ********** table annotation ********** - - @Override - public TableAnnotation getTableAnnotation() { - // TODO get the NullTableAnnotation from the resource model or build it here in the context model?? - return (TableAnnotation) this.getResourcePersistentType().getNonNullAnnotation(this.getAnnotationName()); - } - - @Override - protected void removeTableAnnotation() { - this.getResourcePersistentType().removeAnnotation(this.getAnnotationName()); - } - - protected String getAnnotationName() { - return TableAnnotation.ANNOTATION_NAME; - } - - protected JavaResourcePersistentType getResourcePersistentType() { - return this.getEntity().getPersistentType().getResourcePersistentType(); - } - - - // ********** defaults ********** - - @Override - protected String buildDefaultName() { - return this.getEntity().getDefaultTableName(); - } - - /** - * Just to remember:

    - *
  1. {@link org.eclipse.jpt.jpa.core.context.Entity#getDefaultSchema()}
    - * check inheritance; get default schema from root - *
  2. {@link org.eclipse.jpt.jpa.core.context.orm.EntityMappings#getSchema()}
    - * check for specified schema - *
  3. {@link org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit#getDefaultSchema()}
    - * {@link org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitDefaults#getSchema()} - *
  4. {@link org.eclipse.jpt.jpa.core.JpaProject#getDefaultSchema()}
    - * check for user override project setting - *
  5. {@link org.eclipse.jpt.jpa.db.Catalog#getDefaultSchema()}
    - * or {@link org.eclipse.jpt.jpa.db.Database#getDefaultSchema()} - *
- */ - @Override - protected String buildDefaultSchema() { - return this.getEntity().getDefaultSchema(); - } - - @Override - protected String buildDefaultCatalog() { - return this.getEntity().getDefaultCatalog(); - } - - - // ********** validation ********** - - public boolean validatesAgainstDatabase() { - return this.connectionProfileIsActive(); - } - - - // ********** misc ********** - - /** - * covariant override - */ - @Override - public JavaEntity getParent() { - return (JavaEntity) super.getParent(); - } - - protected JavaEntity getEntity() { - return this.getParent(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java deleted file mode 100644 index f553c9b717..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTableGenerator.java +++ /dev/null @@ -1,567 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.Iterator; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.jpa.core.context.UniqueConstraint; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaTableGenerator; -import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaGenerator; -import org.eclipse.jpt.jpa.core.resource.java.TableGeneratorAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation; -import org.eclipse.jpt.jpa.db.Database; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; -import org.eclipse.jpt.jpa.db.Table; - -/** - * Java table generator - */ -public class GenericJavaTableGenerator - extends AbstractJavaGenerator - implements JavaTableGenerator, UniqueConstraint.Owner -{ - protected String specifiedTable; - protected String defaultTable; - - protected String specifiedSchema; - protected String defaultSchema; - - protected String specifiedCatalog; - protected String defaultCatalog; - - protected String specifiedPkColumnName; - protected String defaultPkColumnName; - - protected String specifiedValueColumnName; - protected String defaultValueColumnName; - - protected String specifiedPkColumnValue; - protected String defaultPkColumnValue; - - protected final Vector uniqueConstraints = new Vector(); - protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter(); - - - // ********** constructor ********** - - public GenericJavaTableGenerator(JavaJpaContextNode parent, TableGeneratorAnnotation generatorAnnotation) { - super(parent, generatorAnnotation); - this.specifiedTable = generatorAnnotation.getTable(); - this.specifiedSchema = generatorAnnotation.getSchema(); - this.specifiedCatalog = generatorAnnotation.getCatalog(); - this.specifiedPkColumnName = generatorAnnotation.getPkColumnName(); - this.specifiedValueColumnName = generatorAnnotation.getValueColumnName(); - this.specifiedPkColumnValue = generatorAnnotation.getPkColumnValue(); - this.initializeUniqueConstraints(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedTable_(this.generatorAnnotation.getTable()); - this.setSpecifiedSchema_(this.generatorAnnotation.getSchema()); - this.setSpecifiedCatalog_(this.generatorAnnotation.getCatalog()); - this.setSpecifiedPkColumnName_(this.generatorAnnotation.getPkColumnName()); - this.setSpecifiedValueColumnName_(this.generatorAnnotation.getValueColumnName()); - this.setSpecifiedPkColumnValue_(this.generatorAnnotation.getPkColumnValue()); - this.syncUniqueConstraints(); - } - - @Override - public void update() { - super.update(); - this.setDefaultTable(this.buildDefaultTable()); - this.setDefaultSchema(this.buildDefaultSchema()); - this.setDefaultCatalog(this.buildDefaultCatalog()); - this.setDefaultPkColumnName(this.buildDefaultPkColumnName()); - this.setDefaultValueColumnName(this.buildDefaultValueColumnName()); - this.setDefaultPkColumnValue(this.buildDefaultPkColumnValue()); - this.updateNodes(this.getUniqueConstraints()); - } - - - // ********** initial value ********** - - @Override - protected int buildDefaultInitialValue() { - return DEFAULT_INITIAL_VALUE; - } - - - // ********** table ********** - - public String getTable() { - return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable; - } - - public String getSpecifiedTable() { - return this.specifiedTable; - } - - public void setSpecifiedTable(String table) { - this.generatorAnnotation.setTable(table); - this.setSpecifiedTable_(table); - } - - protected void setSpecifiedTable_(String table) { - String old = this.specifiedTable; - this.specifiedTable = table; - this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table); - } - - public String getDefaultTable() { - return this.defaultTable; - } - - protected void setDefaultTable(String table) { - String old = this.defaultTable; - this.defaultTable = table; - this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table); - } - - protected String buildDefaultTable() { - return null; // TODO the default table is determined by the runtime provider... - } - - public Table getDbTable() { - Schema dbSchema = this.getDbSchema(); - return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getTable()); - } - - - // ********** schema ********** - - @Override - public String getSchema() { - return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema; - } - - public String getSpecifiedSchema() { - return this.specifiedSchema; - } - - public void setSpecifiedSchema(String schema) { - this.generatorAnnotation.setSchema(schema); - this.setSpecifiedSchema_(schema); - } - - protected void setSpecifiedSchema_(String schema) { - String old = this.specifiedSchema; - this.specifiedSchema = schema; - this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema); - } - - public String getDefaultSchema() { - return this.defaultSchema; - } - - protected void setDefaultSchema(String schema) { - String old = this.defaultSchema; - this.defaultSchema = schema; - this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema); - } - - protected String buildDefaultSchema() { - return this.getContextDefaultSchema(); - } - - - // ********** catalog ********** - - @Override - public String getCatalog() { - return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog; - } - - public String getSpecifiedCatalog() { - return this.specifiedCatalog; - } - - public void setSpecifiedCatalog(String catalog) { - this.generatorAnnotation.setCatalog(catalog); - this.setSpecifiedCatalog_(catalog); - } - - protected void setSpecifiedCatalog_(String catalog) { - String old = this.specifiedCatalog; - this.specifiedCatalog = catalog; - this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog); - } - - public String getDefaultCatalog() { - return this.defaultCatalog; - } - - protected void setDefaultCatalog(String catalog) { - String old = this.defaultCatalog; - this.defaultCatalog = catalog; - this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog); - } - - protected String buildDefaultCatalog() { - return this.getContextDefaultCatalog(); - } - - - // ********** primary key column name ********** - - public String getPkColumnName() { - return (this.specifiedPkColumnName != null) ? this.specifiedPkColumnName : this.defaultPkColumnName; - } - - public String getSpecifiedPkColumnName() { - return this.specifiedPkColumnName; - } - - public void setSpecifiedPkColumnName(String name) { - this.generatorAnnotation.setPkColumnName(name); - this.setSpecifiedPkColumnName_(name); - } - - protected void setSpecifiedPkColumnName_(String name) { - String old = this.specifiedPkColumnName; - this.specifiedPkColumnName = name; - this.firePropertyChanged(SPECIFIED_PK_COLUMN_NAME_PROPERTY, old, name); - } - - public String getDefaultPkColumnName() { - return this.defaultPkColumnName; - } - - protected void setDefaultPkColumnName(String name) { - String old = this.defaultPkColumnName; - this.defaultPkColumnName = name; - this.firePropertyChanged(DEFAULT_PK_COLUMN_NAME_PROPERTY, old, name); - } - - protected String buildDefaultPkColumnName() { - return null; // TODO the default pk column name is determined by the runtime provider... - } - - - // ********** value column name ********** - - public String getValueColumnName() { - return (this.specifiedValueColumnName != null) ? this.specifiedValueColumnName : this.defaultValueColumnName; - } - - public String getSpecifiedValueColumnName() { - return this.specifiedValueColumnName; - } - - public void setSpecifiedValueColumnName(String name) { - this.generatorAnnotation.setValueColumnName(name); - this.setSpecifiedValueColumnName_(name); - } - - protected void setSpecifiedValueColumnName_(String name) { - String old = this.specifiedValueColumnName; - this.specifiedValueColumnName = name; - this.firePropertyChanged(SPECIFIED_VALUE_COLUMN_NAME_PROPERTY, old, name); - } - - public String getDefaultValueColumnName() { - return this.defaultValueColumnName; - } - - protected void setDefaultValueColumnName(String name) { - String old = this.defaultValueColumnName; - this.defaultValueColumnName = name; - this.firePropertyChanged(DEFAULT_VALUE_COLUMN_NAME_PROPERTY, old, name); - } - - protected String buildDefaultValueColumnName() { - return null; // TODO the default value column name is determined by the runtime provider... - } - - - // ********** primary key column value ********** - - public String getPkColumnValue() { - return (this.specifiedPkColumnValue != null) ? this.specifiedPkColumnValue : this.defaultPkColumnValue; - } - - public String getSpecifiedPkColumnValue() { - return this.specifiedPkColumnValue; - } - - public void setSpecifiedPkColumnValue(String value) { - this.generatorAnnotation.setPkColumnValue(value); - this.setSpecifiedPkColumnValue_(value); - } - - protected void setSpecifiedPkColumnValue_(String value) { - String old = this.specifiedPkColumnValue; - this.specifiedPkColumnValue = value; - this.firePropertyChanged(SPECIFIED_PK_COLUMN_VALUE_PROPERTY, old, value); - } - - public String getDefaultPkColumnValue() { - return this.defaultPkColumnValue; - } - - protected void setDefaultPkColumnValue(String value) { - String old = this.defaultPkColumnValue; - this.defaultPkColumnValue = value; - this.firePropertyChanged(DEFAULT_PK_COLUMN_VALUE_PROPERTY, old, value); - } - - protected String buildDefaultPkColumnValue() { - return null; // TODO the default pk column value is determined by the runtime provider... - } - - - // ********** unique constraints ********** - - public Iterable getUniqueConstraints() { - return new LiveCloneIterable(this.uniqueConstraints); - } - - public int getUniqueConstraintsSize() { - return this.uniqueConstraints.size(); - } - - public JavaUniqueConstraint addUniqueConstraint() { - return this.addUniqueConstraint(this.uniqueConstraints.size()); - } - - public JavaUniqueConstraint addUniqueConstraint(int index) { - UniqueConstraintAnnotation constraintAnnotation = this.generatorAnnotation.addUniqueConstraint(index); - return this.addUniqueConstraint_(index, constraintAnnotation); - } - - public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) { - this.removeUniqueConstraint(this.uniqueConstraints.indexOf(uniqueConstraint)); - } - - public void removeUniqueConstraint(int index) { - this.generatorAnnotation.removeUniqueConstraint(index); - this.removeUniqueConstraint_(index); - } - - protected void removeUniqueConstraint_(int index) { - this.removeItemFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - } - - public void moveUniqueConstraint(int targetIndex, int sourceIndex) { - this.generatorAnnotation.moveUniqueConstraint(targetIndex, sourceIndex); - this.moveItemInList(targetIndex, sourceIndex, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - } - - protected void initializeUniqueConstraints() { - for (Iterator stream = this.generatorAnnotation.uniqueConstraints(); stream.hasNext(); ) { - this.uniqueConstraints.add(this.buildUniqueConstraint(stream.next())); - } - } - - protected JavaUniqueConstraint buildUniqueConstraint(UniqueConstraintAnnotation constraintAnnotation) { - return this.getJpaFactory().buildJavaUniqueConstraint(this, this, constraintAnnotation); - } - - protected void syncUniqueConstraints() { - ContextContainerTools.synchronizeWithResourceModel(this.uniqueConstraintContainerAdapter); - } - - protected Iterable getUniqueConstraintAnnotations() { - return CollectionTools.iterable(this.generatorAnnotation.uniqueConstraints()); - } - - protected void moveUniqueConstraint_(int index, JavaUniqueConstraint uniqueConstraint) { - this.moveItemInList(index, uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - } - - protected JavaUniqueConstraint addUniqueConstraint_(int index, UniqueConstraintAnnotation constraintAnnotation) { - JavaUniqueConstraint constraint = this.buildUniqueConstraint(constraintAnnotation); - this.addItemToList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - return constraint; - } - - protected void removeUniqueConstraint_(JavaUniqueConstraint uniqueConstraint) { - this.removeUniqueConstraint_(this.uniqueConstraints.indexOf(uniqueConstraint)); - } - - /** - * unique constraint container adapter - */ - protected class UniqueConstraintContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericJavaTableGenerator.this.getUniqueConstraints(); - } - public Iterable getResourceElements() { - return GenericJavaTableGenerator.this.getUniqueConstraintAnnotations(); - } - public UniqueConstraintAnnotation getResourceElement(JavaUniqueConstraint contextElement) { - return contextElement.getUniqueConstraintAnnotation(); - } - public void moveContextElement(int index, JavaUniqueConstraint element) { - GenericJavaTableGenerator.this.moveUniqueConstraint_(index, element); - } - public void addContextElement(int index, UniqueConstraintAnnotation resourceElement) { - GenericJavaTableGenerator.this.addUniqueConstraint_(index, resourceElement); - } - public void removeContextElement(JavaUniqueConstraint element) { - GenericJavaTableGenerator.this.removeUniqueConstraint_(element); - } - } - - - // ********** UniqueConstraint.Owner implementation ********** - - public Iterator candidateUniqueConstraintColumnNames() { - org.eclipse.jpt.jpa.db.Table dbTable = this.getDbTable(); - return (dbTable != null) ? dbTable.getSortedColumnIdentifiers().iterator() : EmptyIterator.instance(); - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - for (JavaUniqueConstraint constraint : this.getUniqueConstraints()) { - result = constraint.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - } - return null; - } - - /** - * called if the database is connected: - * table, schema, catalog, pkColumnName, valueColumnName - */ - @Override - public Iterator connectedJavaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.connectedJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.tableTouches(pos, astRoot)) { - return this.getJavaCandidateTables(filter).iterator(); - } - if (this.schemaTouches(pos, astRoot)) { - return this.getJavaCandidateSchemata(filter).iterator(); - } - if (this.catalogTouches(pos, astRoot)) { - return this.getJavaCandidateCatalogs(filter).iterator(); - } - if (this.pkColumnNameTouches(pos, astRoot)) { - return this.getJavaCandidateColumnNames(filter).iterator(); - } - if (this.valueColumnNameTouches(pos, astRoot)) { - return this.getJavaCandidateColumnNames(filter).iterator(); - } - return null; - } - - // ********** code assist: table - - protected boolean tableTouches(int pos, CompilationUnit astRoot) { - return this.generatorAnnotation.tableTouches(pos, astRoot); - } - - protected Iterable getJavaCandidateTables(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.getCandidateTables(filter)); - } - - protected Iterable getCandidateTables(Filter filter) { - return new FilteringIterable(this.getCandidateTables(), filter); - } - - protected Iterable getCandidateTables() { - Schema dbSchema = this.getDbSchema(); - return (dbSchema != null) ? dbSchema.getSortedTableIdentifiers() : EmptyIterable. instance(); - } - - // ********** code assist: schema - - protected boolean schemaTouches(int pos, CompilationUnit astRoot) { - return this.generatorAnnotation.schemaTouches(pos, astRoot); - } - - protected Iterable getJavaCandidateSchemata(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.getCandidateSchemata(filter)); - } - - protected Iterable getCandidateSchemata(Filter filter) { - return new FilteringIterable(this.getCandidateSchemata(), filter); - } - - protected Iterable getCandidateSchemata() { - SchemaContainer schemaContainer = this.getDbSchemaContainer(); - return (schemaContainer != null) ? schemaContainer.getSortedSchemaIdentifiers() : EmptyIterable. instance(); - } - - // ********** code assist: catalog - - protected boolean catalogTouches(int pos, CompilationUnit astRoot) { - return this.generatorAnnotation.catalogTouches(pos, astRoot); - } - - protected Iterable getJavaCandidateCatalogs(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.getCandidateCatalogs(filter)); - } - - protected Iterable getCandidateCatalogs(Filter filter) { - return new FilteringIterable(this.getCandidateCatalogs(), filter); - } - - protected Iterable getCandidateCatalogs() { - Database db = this.getDatabase(); - return (db != null) ? db.getSortedCatalogIdentifiers() : EmptyIterable. instance(); - } - - // ********** code assist: pkColumnName - - protected boolean pkColumnNameTouches(int pos, CompilationUnit astRoot) { - return this.generatorAnnotation.pkColumnNameTouches(pos, astRoot); - } - - protected Iterable getJavaCandidateColumnNames(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.getCandidateColumnNames(filter)); - } - - protected Iterable getCandidateColumnNames(Filter filter) { - return new FilteringIterable(this.getCandidateColumnNames(), filter); - } - - protected Iterable getCandidateColumnNames() { - Table table = this.getDbTable(); - return (table != null) ? table.getSortedColumnIdentifiers() : EmptyIterable. instance(); - } - - // ********** code assist: valueColumnName - - protected boolean valueColumnNameTouches(int pos, CompilationUnit astRoot) { - return this.generatorAnnotation.valueColumnNameTouches(pos, astRoot); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java deleted file mode 100644 index a48e67aeb5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTemporalConverter.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.TemporalConverter; -import org.eclipse.jpt.jpa.core.context.TemporalType; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter; -import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation; - -public class GenericJavaTemporalConverter - extends AbstractJavaConverter - implements JavaTemporalConverter -{ - protected final TemporalAnnotation temporalAnnotation; - - protected TemporalType temporalType; - - - public GenericJavaTemporalConverter(JavaAttributeMapping parent, TemporalAnnotation temporalAnnotation) { - super(parent); - this.temporalAnnotation = temporalAnnotation; - this.temporalType = this.buildTemporalType(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setTemporalType_(this.buildTemporalType()); - } - - - // ********** temporal type ********** - - public TemporalType getTemporalType() { - return this.temporalType; - } - - public void setTemporalType(TemporalType temporalType) { - if (this.valuesAreDifferent(this.temporalType, temporalType)) { - this.temporalAnnotation.setValue(TemporalType.toJavaResourceModel(temporalType)); - this.removeTemporalAnnotationIfUnset(); - this.setTemporalType_(temporalType); - } - } - - protected void setTemporalType_(TemporalType temporalType) { - TemporalType old = this.temporalType; - this.temporalType = temporalType; - this.firePropertyChanged(TEMPORAL_TYPE_PROPERTY, old, temporalType); - } - - protected TemporalType buildTemporalType() { - return TemporalType.fromJavaResourceModel(this.temporalAnnotation.getValue()); - } - - - // ********** misc ********** - - public Class getType() { - return TemporalConverter.class; - } - - @Override - protected String getAnnotationName() { - return TemporalAnnotation.ANNOTATION_NAME; - } - - protected void removeTemporalAnnotationIfUnset() { - if (this.temporalAnnotation.isUnset()) { - this.temporalAnnotation.removeAnnotation(); - } - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.temporalAnnotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTransientMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTransientMapping.java deleted file mode 100644 index 37e46c1c56..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaTransientMapping.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaTransientMapping; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.resource.java.TransientAnnotation; - -/** - * Java transient mapping - */ -public class GenericJavaTransientMapping - extends AbstractJavaAttributeMapping - implements JavaTransientMapping -{ - public GenericJavaTransientMapping(JavaPersistentAttribute parent) { - super(parent); - } - - public String getKey() { - return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return TransientAnnotation.ANNOTATION_NAME; - } - - - // ********** metamodel ********** - - @Override - public MetamodelField getMetamodelField() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java deleted file mode 100644 index 43eef86ff7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaUniqueConstraint.java +++ /dev/null @@ -1,135 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaUniqueConstraint; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaReadOnlyUniqueConstraint; -import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation; - -public class GenericJavaUniqueConstraint - extends AbstractJavaReadOnlyUniqueConstraint - implements JavaUniqueConstraint -{ - protected Owner owner; - protected final UniqueConstraintAnnotation uniqueConstraintAnnotation; - - - public GenericJavaUniqueConstraint(JavaJpaContextNode parent, Owner owner, UniqueConstraintAnnotation uniqueConstraintAnnotation) { - super(parent); - this.owner = owner; - this.uniqueConstraintAnnotation = uniqueConstraintAnnotation; - this.initializeColumnNames(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncColumnNames(); - } - - - // ********** column names ********** - - public void addColumnName(String columnName) { - this.addColumnName(this.columnNames.size(), columnName); - } - - public void addColumnName(int index, String columnName) { - this.uniqueConstraintAnnotation.addColumnName(index, columnName); - this.addItemToList(index, columnName, this.columnNames, COLUMN_NAMES_LIST); - } - - public void removeColumnName(String columnName) { - this.removeColumnName(this.columnNames.indexOf(columnName)); - } - - public void removeColumnName(int index) { - this.uniqueConstraintAnnotation.removeColumnName(index); - this.removeItemFromList(index, this.columnNames, COLUMN_NAMES_LIST); - } - - public void moveColumnName(int targetIndex, int sourceIndex) { - this.uniqueConstraintAnnotation.moveColumnName(targetIndex, sourceIndex); - this.moveItemInList(targetIndex, sourceIndex, this.columnNames, COLUMN_NAMES_LIST); - } - - protected void initializeColumnNames() { - for (Iterator stream = this.uniqueConstraintAnnotation.columnNames(); stream.hasNext(); ) { - this.columnNames.add(stream.next()); - } - } - - @Override - protected Iterable getResourceColumnNames() { - return CollectionTools.iterable(this.uniqueConstraintAnnotation.columnNames()); - } - - // ********** Java completion proposals ********** - - @Override - public Iterator connectedJavaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.connectedJavaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.columnNamesTouches(pos, astRoot)) { - return this.javaCandidateColumnNames(filter); - } - return null; - } - - protected boolean columnNamesTouches(int pos, CompilationUnit astRoot) { - return this.uniqueConstraintAnnotation.columnNamesTouches(pos, astRoot); - } - - protected Iterator javaCandidateColumnNames(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.candidateColumnNames(filter)); - } - - protected Iterator candidateColumnNames(Filter filter) { - return new FilteringIterator(this.candidateColumnNames(), filter); - } - - protected Iterator candidateColumnNames() { - return this.owner.candidateUniqueConstraintColumnNames(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.uniqueConstraintAnnotation.getTextRange(astRoot); - } - - - // ********** misc ********** - - public UniqueConstraintAnnotation getUniqueConstraintAnnotation() { - return this.uniqueConstraintAnnotation; - } - - public void initializeFrom(ReadOnlyUniqueConstraint oldUniqueConstraint) { - for (String columnName : oldUniqueConstraint.getColumnNames()) { - this.addColumnName(columnName); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVersionMapping.java deleted file mode 100644 index 9d66e365f5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVersionMapping.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVersionMapping; - -public class GenericJavaVersionMapping - extends AbstractJavaVersionMapping -{ - public GenericJavaVersionMapping(JavaPersistentAttribute parent) { - super(parent); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAssociationOverride.java deleted file mode 100644 index 2333e0c4d1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAssociationOverride.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverrideRelationship; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVirtualOverride; - -/** - * Virtual Java association override - */ -public class GenericJavaVirtualAssociationOverride - extends AbstractJavaVirtualOverride - implements JavaVirtualAssociationOverride -{ - protected final JavaVirtualOverrideRelationship relationship; - - - public GenericJavaVirtualAssociationOverride(JavaAssociationOverrideContainer parent, String name) { - super(parent, name); - this.relationship = this.buildRelationship(); - } - - @Override - public void update() { - super.update(); - this.relationship.update(); - } - - @Override - public JavaAssociationOverride convertToSpecified() { - return (JavaAssociationOverride) super.convertToSpecified(); - } - - public RelationshipMapping getMapping() { - return this.getContainer().getRelationshipMapping(this.name); - } - - - // ********** relationship ********** - - public JavaVirtualOverrideRelationship getRelationship() { - return this.relationship; - } - - /** - * The relationship should be available (since its presence precipitated the - * creation of the virtual override). - */ - protected JavaVirtualOverrideRelationship buildRelationship() { - return this.getJpaFactory().buildJavaVirtualOverrideRelationship(this); - } - - public Relationship resolveOverriddenRelationship() { - return this.getContainer().resolveOverriddenRelationship(this.name); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAttributeOverride.java deleted file mode 100644 index 9049ad974d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualAttributeOverride.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAttributeOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualColumn; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVirtualOverride; - -/** - * Virtual Java attribute override - */ -public class GenericJavaVirtualAttributeOverride - extends AbstractJavaVirtualOverride - implements JavaVirtualAttributeOverride, JavaVirtualColumn.Owner -{ - protected final JavaVirtualColumn column; - - - public GenericJavaVirtualAttributeOverride(JavaAttributeOverrideContainer parent, String name) { - super(parent, name); - this.column = this.buildColumn(); - } - - @Override - public void update() { - super.update(); - this.column.update(); - } - - @Override - public JavaAttributeOverride convertToSpecified() { - return (JavaAttributeOverride) super.convertToSpecified(); - } - - - // ********** column ********** - - public JavaVirtualColumn getColumn() { - return this.column; - } - - /** - * The original column should be available (since the presence of its - * attribute is what precipitated the creation of the virtual override). - */ - protected JavaVirtualColumn buildColumn() { - return this.getJpaFactory().buildJavaVirtualColumn(this, this); - } - - - // ********** column owner implementation ********** - - public TypeMapping getTypeMapping() { - return this.getContainer().getTypeMapping(); - } - - public String getDefaultTableName() { - String overriddenColumnTable = this.getOverriddenColumnTable(); - return (overriddenColumnTable != null) ? overriddenColumnTable : this.getContainer().getDefaultTableName(); - } - - protected String getOverriddenColumnTable() { - ReadOnlyColumn overriddenColumn = this.resolveOverriddenColumn(); - // pretty sure this is the *specified* table... - return (overriddenColumn == null) ? null : overriddenColumn.getSpecifiedTable(); - } - - public String getDefaultColumnName() { - String overriddenColumnName = this.getOverriddenColumnName(); - return (overriddenColumnName != null) ? overriddenColumnName : this.name; - } - - protected String getOverriddenColumnName() { - ReadOnlyColumn overriddenColumn = this.resolveOverriddenColumn(); - return (overriddenColumn == null) ? null : overriddenColumn.getName(); - } - - public Column resolveOverriddenColumn() { - return this.getContainer().resolveOverriddenColumn(this.name); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualColumn.java deleted file mode 100644 index 0429f71344..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualColumn.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualColumn; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVirtualBaseColumn; - -/** - * Java virtual column - */ -public class GenericJavaVirtualColumn - extends AbstractJavaVirtualBaseColumn - implements JavaVirtualColumn -{ - protected Integer specifiedLength; - protected int defaultLength; - - protected Integer specifiedPrecision; - protected int defaultPrecision; - - protected Integer specifiedScale; - protected int defaultScale; - - - public GenericJavaVirtualColumn(JavaJpaContextNode parent, JavaVirtualColumn.Owner owner) { - super(parent, owner); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - - this.setSpecifiedLength(this.buildSpecifiedLength()); - this.setDefaultLength(this.buildDefaultLength()); - - this.setSpecifiedPrecision(this.buildSpecifiedPrecision()); - this.setDefaultPrecision(this.buildDefaultPrecision()); - - this.setSpecifiedScale(this.buildSpecifiedScale()); - this.setDefaultScale(this.buildDefaultScale()); - } - - - // ********** column ********** - - @Override - public Column getOverriddenColumn() { - return this.owner.resolveOverriddenColumn(); - } - - - // ********** length ********** - - public int getLength() { - return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.defaultLength; - } - - public Integer getSpecifiedLength() { - return this.specifiedLength; - } - - protected void setSpecifiedLength(Integer length) { - Integer old = this.specifiedLength; - this.specifiedLength = length; - this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length); - } - - protected Integer buildSpecifiedLength() { - return this.getOverriddenColumn().getSpecifiedLength(); - } - - public int getDefaultLength() { - return this.defaultLength; - } - - protected void setDefaultLength(int length) { - int old = this.defaultLength; - this.defaultLength = length; - this.firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, length); - } - - protected int buildDefaultLength() { - return DEFAULT_LENGTH; - } - - - // ********** precision ********** - - public int getPrecision() { - return (this.specifiedPrecision != null) ? this.specifiedPrecision.intValue() : this.defaultPrecision; - } - - public Integer getSpecifiedPrecision() { - return this.specifiedPrecision; - } - - protected void setSpecifiedPrecision(Integer precision) { - Integer old = this.specifiedPrecision; - this.specifiedPrecision = precision; - this.firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, old, precision); - } - - protected Integer buildSpecifiedPrecision() { - return this.getOverriddenColumn().getSpecifiedPrecision(); - } - - public int getDefaultPrecision() { - return this.defaultPrecision; - } - - protected void setDefaultPrecision(int precision) { - int old = this.defaultPrecision; - this.defaultPrecision = precision; - this.firePropertyChanged(DEFAULT_PRECISION_PROPERTY, old, precision); - } - - protected int buildDefaultPrecision() { - return DEFAULT_PRECISION; - } - - - // ********** scale ********** - - public int getScale() { - return (this.specifiedScale != null) ? this.specifiedScale.intValue() : this.defaultScale; - } - - public Integer getSpecifiedScale() { - return this.specifiedScale; - } - - protected void setSpecifiedScale(Integer scale) { - Integer old = this.specifiedScale; - this.specifiedScale = scale; - this.firePropertyChanged(SPECIFIED_SCALE_PROPERTY, old, scale); - } - - protected Integer buildSpecifiedScale() { - return this.getOverriddenColumn().getSpecifiedScale(); - } - - public int getDefaultScale() { - return this.defaultScale; - } - - protected void setDefaultScale(int scale) { - int old = this.defaultScale; - this.defaultScale = scale; - this.firePropertyChanged(DEFAULT_SCALE_PROPERTY, old, scale); - } - - protected int buildDefaultScale() { - return DEFAULT_SCALE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualJoinColumn.java deleted file mode 100644 index 6848cb9c65..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualJoinColumn.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaVirtualBaseColumn; - -/** - * Java virtual join column - */ -public class GenericJavaVirtualJoinColumn - extends AbstractJavaVirtualBaseColumn - implements JavaVirtualJoinColumn -{ - protected final JoinColumn overriddenColumn; - - protected String specifiedReferencedColumnName; - protected String defaultReferencedColumnName; - - - public GenericJavaVirtualJoinColumn(JavaJpaContextNode parent, ReadOnlyJoinColumn.Owner owner, JoinColumn overriddenColumn) { - super(parent, owner); - this.overriddenColumn = overriddenColumn; - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - - this.setSpecifiedReferencedColumnName(this.buildSpecifiedReferencedColumnName()); - this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName()); - } - - - // ********** column ********** - - @Override - public JoinColumn getOverriddenColumn() { - return this.overriddenColumn; - } - - public boolean isDefault() { - return this.owner.joinColumnIsDefault(this); - } - - - // ********** referenced column name ********** - - public String getReferencedColumnName() { - return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName; - } - - public String getSpecifiedReferencedColumnName() { - return this.specifiedReferencedColumnName; - } - - protected void setSpecifiedReferencedColumnName(String name) { - String old = this.specifiedReferencedColumnName; - this.specifiedReferencedColumnName = name; - this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedReferencedColumnName() { - return this.getOverriddenColumn().getSpecifiedReferencedColumnName(); - } - - public String getDefaultReferencedColumnName() { - return this.defaultReferencedColumnName; - } - - protected void setDefaultReferencedColumnName(String name) { - String old = this.defaultReferencedColumnName; - this.defaultReferencedColumnName = name; - this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name); - } - - protected String buildDefaultReferencedColumnName() { - return MappingTools.buildJoinColumnDefaultReferencedColumnName(this.owner); - } - - - // ********** misc ********** - - @Override - protected String buildDefaultName() { - return MappingTools.buildJoinColumnDefaultName(this, this.owner); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java deleted file mode 100644 index aeb114470b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,335 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.JoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaReadOnlyAssociationOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualOverrideRelationship; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; - -public class GenericJavaVirtualOverrideJoinColumnRelationshipStrategy - extends AbstractJavaJpaContextNode - implements JavaVirtualJoinColumnRelationshipStrategy -{ - protected final Vector specifiedJoinColumns = new Vector(); - protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter; - protected final ReadOnlyJoinColumn.Owner joinColumnOwner; - - protected JavaVirtualJoinColumn defaultJoinColumn; - - - public GenericJavaVirtualOverrideJoinColumnRelationshipStrategy(JavaVirtualJoinColumnRelationship parent) { - super(parent); - this.specifiedJoinColumnContainerAdapter = this.buildSpecifiedJoinColumnContainerAdapter(); - this.joinColumnOwner = this.buildJoinColumnOwner(); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.updateSpecifiedJoinColumns(); - this.updateDefaultJoinColumn(); - } - - - // ********** join columns ********** - - public ListIterator joinColumns() { - return this.getJoinColumns().iterator(); - } - - protected ListIterable getJoinColumns() { - return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns(); - } - - public int joinColumnsSize() { - return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize(); - } - - - // ********** specified join columns ********** - - public ListIterator specifiedJoinColumns() { - return this.getSpecifiedJoinColumns().iterator(); - } - - protected ListIterable getSpecifiedJoinColumns() { - return new LiveCloneListIterable(this.specifiedJoinColumns); - } - - public int specifiedJoinColumnsSize() { - return this.specifiedJoinColumns.size(); - } - - public boolean hasSpecifiedJoinColumns() { - return this.specifiedJoinColumns.size() != 0; - } - - public JavaVirtualJoinColumn getSpecifiedJoinColumn(int index) { - return this.specifiedJoinColumns.get(index); - } - - protected void updateSpecifiedJoinColumns() { - ContextContainerTools.update(this.specifiedJoinColumnContainerAdapter); - } - - protected Iterable getOverriddenSpecifiedJoinColumns() { - JoinColumnRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy(); - return (overriddenStrategy == null) ? - EmptyIterable.instance() : - CollectionTools.iterable(overriddenStrategy.specifiedJoinColumns()); - } - - protected void moveSpecifiedJoinColumn(int index, JavaVirtualJoinColumn joinColumn) { - this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - protected JavaVirtualJoinColumn addSpecifiedJoinColumn(int index, JoinColumn joinColumn) { - JavaVirtualJoinColumn virtualJoinColumn = this.buildJoinColumn(joinColumn); - this.addItemToList(index, virtualJoinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - return virtualJoinColumn; - } - - protected void removeSpecifiedJoinColumn(JavaVirtualJoinColumn joinColumn) { - this.removeItemFromList(joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - protected SpecifiedJoinColumnContainerAdapter buildSpecifiedJoinColumnContainerAdapter() { - return new SpecifiedJoinColumnContainerAdapter(); - } - - /** - * specified join column container adapter - */ - protected class SpecifiedJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getSpecifiedJoinColumns(); - } - public Iterable getResourceElements() { - return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getOverriddenSpecifiedJoinColumns(); - } - public JoinColumn getResourceElement(JavaVirtualJoinColumn contextElement) { - return contextElement.getOverriddenColumn(); - } - public void moveContextElement(int index, JavaVirtualJoinColumn element) { - GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.moveSpecifiedJoinColumn(index, element); - } - public void addContextElement(int index, JoinColumn resourceElement) { - GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.addSpecifiedJoinColumn(index, resourceElement); - } - public void removeContextElement(JavaVirtualJoinColumn element) { - GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.removeSpecifiedJoinColumn(element); - } - } - - protected ReadOnlyJoinColumn.Owner buildJoinColumnOwner() { - return new JoinColumnOwner(); - } - - - // ********** default join column ********** - - public JavaVirtualJoinColumn getDefaultJoinColumn() { - return this.defaultJoinColumn; - } - - protected void setDefaultJoinColumn(JavaVirtualJoinColumn joinColumn) { - JavaVirtualJoinColumn old = this.defaultJoinColumn; - this.defaultJoinColumn = joinColumn; - this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn); - } - - protected ListIterable getDefaultJoinColumns() { - return (this.defaultJoinColumn != null) ? - new SingleElementListIterable(this.defaultJoinColumn) : - EmptyListIterable.instance(); - } - - protected int getDefaultJoinColumnsSize() { - return (this.defaultJoinColumn == null) ? 0 : 1; - } - - protected void updateDefaultJoinColumn() { - JoinColumn overriddenDefaultJoinColumn = this.getOverriddenDefaultJoinColumn(); - if (overriddenDefaultJoinColumn == null) { - if (this.defaultJoinColumn != null) { - this.setDefaultJoinColumn(null); - } - } else { - if ((this.defaultJoinColumn != null) && (this.defaultJoinColumn.getOverriddenColumn() == overriddenDefaultJoinColumn)) { - this.defaultJoinColumn.update(); - } else { - this.setDefaultJoinColumn(this.buildJoinColumn(overriddenDefaultJoinColumn)); - } - } - } - - protected JoinColumn getOverriddenDefaultJoinColumn() { - JoinColumnRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy(); - return (overriddenStrategy == null) ? null : overriddenStrategy.getDefaultJoinColumn(); - } - - - // ********** misc ********** - - @Override - public JavaVirtualJoinColumnRelationship getParent() { - return (JavaVirtualJoinColumnRelationship) super.getParent(); - } - - public JavaVirtualJoinColumnRelationship getRelationship() { - return this.getParent(); - } - - protected JoinColumnRelationshipStrategy getOverriddenStrategy() { - JoinColumnRelationship relationship = this.getOverriddenJoinColumnRelationship(); - return (relationship == null) ? null : relationship.getJoinColumnStrategy(); - } - - protected JoinColumnRelationship getOverriddenJoinColumnRelationship() { - Relationship relationship = this.resolveOverriddenRelationship(); - return (relationship instanceof JoinColumnRelationship) ? (JoinColumnRelationship) relationship : null; - } - - protected Relationship resolveOverriddenRelationship() { - return this.getRelationship().resolveOverriddenRelationship(); - } - - public boolean isTargetForeignKey() { - RelationshipMapping relationshipMapping = this.getRelationshipMapping(); - return (relationshipMapping != null) && - relationshipMapping.getRelationship().isTargetForeignKey(); - } - - public TypeMapping getRelationshipSource() { - return this.isTargetForeignKey() ? - this.getRelationshipMapping().getResolvedTargetEntity() : - this.getAssociationOverrideContainer().getTypeMapping(); - } - - public TypeMapping getRelationshipTarget() { - return this.isTargetForeignKey() ? - this.getAssociationOverrideContainer().getTypeMapping() : - this.getRelationshipMappingTargetEntity(); - } - - protected TypeMapping getRelationshipMappingTargetEntity() { - RelationshipMapping mapping = this.getRelationshipMapping(); - return (mapping == null) ? null : mapping.getResolvedTargetEntity(); - } - - protected Entity getRelationshipTargetEntity() { - TypeMapping target = this.getRelationshipTarget(); - return (target instanceof Entity) ? (Entity) target : null; - } - - protected RelationshipMapping getRelationshipMapping() { - return this.getAssociationOverride().getMapping(); - } - - protected JavaReadOnlyAssociationOverride getAssociationOverride() { - return ((JavaVirtualOverrideRelationship) this.getRelationship()).getAssociationOverride(); - } - - protected JavaAssociationOverrideContainer getAssociationOverrideContainer() { - return this.getAssociationOverride().getContainer(); - } - - public String getTableName() { - return this.isTargetForeignKey() ? - this.getSourceTableName() : - this.getAssociationOverrideContainer().getDefaultTableName(); - } - - protected String getSourceTableName() { - TypeMapping typeMapping = this.getRelationshipSource(); - return (typeMapping == null) ? null : typeMapping.getPrimaryTableName(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return null; - } - - protected String getAttributeName() { - return this.getAssociationOverride().getName(); - } - - protected JavaVirtualJoinColumn buildJoinColumn(JoinColumn overriddenJoinColumn) { - return this.getJpaFactory().buildJavaVirtualJoinColumn(this, this.joinColumnOwner, overriddenJoinColumn); - } - - - // ********** join column owner ********** - - protected class JoinColumnOwner - implements ReadOnlyJoinColumn.Owner - { - protected JoinColumnOwner() { - super(); - } - - public String getDefaultTableName() { - return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getTableName(); - } - - public String getDefaultColumnName() { - //built in MappingTools.buildJoinColumnDefaultName() - return null; - } - - public String getAttributeName() { - return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getAttributeName(); - } - - public TypeMapping getTypeMapping() { - return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getRelationshipSource(); - } - - public Entity getRelationshipTarget() { - return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.getRelationshipTargetEntity(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return false; - } - - public int joinColumnsSize() { - return GenericJavaVirtualOverrideJoinColumnRelationshipStrategy.this.joinColumnsSize(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java deleted file mode 100644 index b75f1d81a3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualOverrideRelationship.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.OverrideRelationship; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualAssociationOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaVirtualOverrideRelationship2_0; - -public class GenericJavaVirtualOverrideRelationship - extends AbstractJavaJpaContextNode - implements JavaVirtualOverrideRelationship2_0 -{ - protected JavaVirtualRelationshipStrategy strategy; - - protected final JavaVirtualJoinColumnRelationshipStrategy joinColumnStrategy; - - // JPA 2.0 - protected final JavaVirtualJoinTableRelationshipStrategy joinTableStrategy; - - - public GenericJavaVirtualOverrideRelationship(JavaVirtualAssociationOverride parent) { - super(parent); - this.joinColumnStrategy = this.buildJoinColumnStrategy(); - this.joinTableStrategy = this.buildJoinTableStrategy(); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.setStrategy(this.buildStrategy()); - this.joinColumnStrategy.update(); - this.joinTableStrategy.update(); - } - - - // ********** strategy ********** - - public JavaVirtualRelationshipStrategy getStrategy() { - return this.strategy; - } - - protected void setStrategy(JavaVirtualRelationshipStrategy strategy) { - JavaVirtualRelationshipStrategy old = this.strategy; - this.strategy = strategy; - this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy); - } - - protected JavaVirtualRelationshipStrategy buildStrategy() { - if (this.isJpa2_0Compatible()) { - if (this.joinColumnStrategy.hasSpecifiedJoinColumns()) { - return this.joinColumnStrategy; - } - return this.joinTableStrategy; - } - return this.joinColumnStrategy; - } - - - // ********** join column strategy ********** - - public JavaVirtualJoinColumnRelationshipStrategy getJoinColumnStrategy() { - return this.joinColumnStrategy; - } - - public boolean strategyIsJoinColumn() { - return this.strategy == this.joinColumnStrategy; - } - - public boolean mayHaveDefaultJoinColumn() { - return false; - } - - protected JavaVirtualJoinColumnRelationshipStrategy buildJoinColumnStrategy() { - return new GenericJavaVirtualOverrideJoinColumnRelationshipStrategy(this); - } - - - // ********** join table strategy ********** - - public JavaVirtualJoinTableRelationshipStrategy getJoinTableStrategy() { - return this.joinTableStrategy; - } - - public boolean strategyIsJoinTable() { - return this.strategy == this.joinTableStrategy; - } - - public boolean mayHaveDefaultJoinTable() { - return this.isVirtual(); - } - - protected JavaVirtualJoinTableRelationshipStrategy buildJoinTableStrategy() { - return new GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0(this); - } - - - // ********** conversions ********** - - public void initializeOn(Relationship newRelationship) { - newRelationship.initializeFromJoinTableRelationship(this); - newRelationship.initializeFromJoinColumnRelationship(this); - } - - public void initializeOnSpecified(OverrideRelationship specifiedRelationship) { - specifiedRelationship.initializeFromVirtualJoinColumnRelationship(this); - specifiedRelationship.initializeFromVirtualJoinTableRelationship(this); - } - - - // ********** misc ********** - - @Override - public JavaVirtualAssociationOverride getParent() { - return (JavaVirtualAssociationOverride) super.getParent(); - } - - public JavaVirtualAssociationOverride getAssociationOverride() { - return this.getParent(); - } - - public TypeMapping getTypeMapping() { - return this.getAssociationOverride().getContainer().getTypeMapping(); - } - - public Entity getEntity() { - TypeMapping typeMapping = this.getTypeMapping(); - return (typeMapping instanceof Entity) ? (Entity) typeMapping : null; - } - - public boolean isVirtual() { - return true; - } - - public RelationshipMapping getMapping() { - return this.getAssociationOverride().getMapping(); - } - - public Relationship resolveOverriddenRelationship() { - return this.getAssociationOverride().resolveOverriddenRelationship(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualUniqueConstraint.java deleted file mode 100644 index 388f871257..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/GenericJavaVirtualUniqueConstraint.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.UniqueConstraint; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualUniqueConstraint; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaReadOnlyUniqueConstraint; - -public class GenericJavaVirtualUniqueConstraint - extends AbstractJavaReadOnlyUniqueConstraint - implements JavaVirtualUniqueConstraint -{ - protected final UniqueConstraint overriddenUniqueConstraint; - - - public GenericJavaVirtualUniqueConstraint(JavaJpaContextNode parent, UniqueConstraint overriddenUniqueConstraint) { - super(parent); - this.overriddenUniqueConstraint = overriddenUniqueConstraint; - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.syncColumnNames(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return null; - } - - - // ********** misc ********** - - public UniqueConstraint getOverriddenUniqueConstraint() { - return this.overriddenUniqueConstraint; - } - - @Override - protected Iterable getResourceColumnNames() { - return this.overriddenUniqueConstraint.getColumnNames(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java deleted file mode 100644 index 3908130b3c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaConverter.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaConverter; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; - -public class NullJavaConverter - extends AbstractJavaJpaContextNode - implements JavaConverter -{ - public NullJavaConverter(JavaAttributeMapping parent) { - super(parent); - } - - @Override - public JavaAttributeMapping getParent() { - return (JavaAttributeMapping) super.getParent(); - } - - public Class getType() { - return null; - } - - public Annotation getConverterAnnotation() { - return null; - } - - public void dispose() { - // NOP - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java deleted file mode 100644 index 61ba4bc7bc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,166 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import java.util.ListIterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.db.Table; - -/** - * Used by - * {@link org.eclipse.jpt.jpa.core.internal.context.java.GenericJavaOneToManyRelationship#buildJoinColumnStrategy()} - * in a JPA 1.0 project. - */ -public class NullJavaJoinColumnRelationshipStrategy - extends AbstractJavaJpaContextNode - implements JavaJoinColumnRelationshipStrategy -{ - public NullJavaJoinColumnRelationshipStrategy(JavaJoinColumnRelationship parent) { - super(parent); - } - - - // ********** join columns ********** - - public ListIterator joinColumns() { - return EmptyListIterator.instance(); - } - - public int joinColumnsSize() { - return 0; - } - - - // ********** specified join columns ********** - - public ListIterator specifiedJoinColumns() { - return EmptyListIterator.instance(); - } - - public int specifiedJoinColumnsSize() { - return 0; - } - - public boolean hasSpecifiedJoinColumns() { - return false; - } - - public JavaJoinColumn getSpecifiedJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - public JavaJoinColumn addSpecifiedJoinColumn() { - throw new UnsupportedOperationException(); - } - - public JavaJoinColumn addSpecifiedJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - public void removeSpecifiedJoinColumn(JoinColumn joinColumn) { - throw new UnsupportedOperationException(); - } - - public void removeSpecifiedJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - - // ********** default join column ********** - - public JavaJoinColumn getDefaultJoinColumn() { - return null; - } - - - // ********** misc ********** - - @Override - public JavaJoinColumnRelationship getParent() { - return (JavaJoinColumnRelationship) super.getParent(); - } - - public JavaJoinColumnRelationship getRelationship() { - return this.getParent(); - } - - protected RelationshipMapping getRelationshipMapping() { - return this.getRelationship().getMapping(); - } - - public String getTableName() { - return null; - } - - public TypeMapping getRelationshipSource() { - return this.getRelationshipMapping().getTypeMapping(); - } - - public TypeMapping getRelationshipTarget() { - return null; - } - - public boolean isTargetForeignKey() { - return false; - } - - public void initializeFrom(ReadOnlyJoinColumnRelationshipStrategy oldStrategy) { - // NOP - } - - public void initializeFromVirtual(ReadOnlyJoinColumnRelationshipStrategy oldStrategy) { - // NOP - } - - public void addStrategy() { - // NOP - } - - public void removeStrategy() { - // NOP - } - - public boolean isOverridable() { - return false; - } - - public boolean tableNameIsInvalid(String tableName) { - return true; - } - - public Table resolveDbTable(String tableName) { - return null; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return null; - } - - public String getColumnTableNotValidDescription() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinTableRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinTableRelationshipStrategy.java deleted file mode 100644 index b5df2972f5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/java/NullJavaJoinTableRelationshipStrategy.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTable; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; -import org.eclipse.jpt.jpa.db.Table; - -public class NullJavaJoinTableRelationshipStrategy - extends AbstractJavaJpaContextNode - implements JavaJoinTableRelationshipStrategy -{ - public NullJavaJoinTableRelationshipStrategy(JavaJoinTableRelationship parent) { - super(parent); - } - - - // ********** join table ********** - - public JavaJoinTable getJoinTable() { - return null; - } - - public JoinTableAnnotation getJoinTableAnnotation() { - return null; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - - // ********** misc ********** - - @Override - public JavaJoinTableRelationship getParent() { - return (JavaJoinTableRelationship) super.getParent(); - } - - public JavaJoinTableRelationship getRelationship() { - return this.getParent(); - } - - public void initializeFrom(ReadOnlyJoinTableRelationshipStrategy oldStrategy) { - // NOP - } - - public void initializeFromVirtual(ReadOnlyJoinTableRelationshipStrategy virtualStrategy) { - // NOP - } - - public String getTableName() { - return null; - } - - public Table resolveDbTable(String tableName) { - return null; - } - - public boolean tableNameIsInvalid(String tableName) { - return true; - } - - public String getColumnTableNotValidDescription() { - return null; - } - - public String getJoinTableDefaultName() { - return null; - } - - public void addStrategy() { - // NOP - } - - public void removeStrategy() { - // NOP - } - - public boolean isOverridable() { - return false; - } - - public boolean validatesAgainstDatabase() { - return false; - } - - public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - throw new UnsupportedOperationException(); - } - - public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java deleted file mode 100644 index 1c73603b0a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmConverter.java +++ /dev/null @@ -1,45 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlConvertibleMapping; - -public abstract class AbstractOrmConverter - extends AbstractOrmXmlContextNode - implements OrmConverter -{ - protected AbstractOrmConverter(OrmAttributeMapping parent) { - super(parent); - } - - - // ********** misc ********** - - @Override - public OrmAttributeMapping getParent() { - return (OrmAttributeMapping) super.getParent(); - } - - protected OrmAttributeMapping getAttributeMapping() { - return this.getParent(); - } - - protected XmlAttributeMapping getXmlAttributeMapping() { - return this.getAttributeMapping().getXmlAttributeMapping(); - } - - protected XmlConvertibleMapping getXmlConvertibleMapping() { - return (XmlConvertibleMapping) this.getXmlAttributeMapping(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverride.java deleted file mode 100644 index 4494cddecc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverride.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.List; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.ReadOnlyOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverride; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOverride; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Specified orm.xml override - */ -public abstract class AbstractOrmOverride - extends AbstractOrmXmlContextNode - implements OrmOverride -{ - protected final X xmlOverride; - - protected String name; - - - protected AbstractOrmOverride(C parent, X xmlOverride) { - super(parent); - this.xmlOverride = xmlOverride; - this.name = xmlOverride.getName(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setName_(this.xmlOverride.getName()); - } - - - // ********** name ********** - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.setName_(name); - this.xmlOverride.setName(name); - } - - protected void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - - // ********** specified/virtual ********** - - public boolean isVirtual() { - return false; - } - - public OrmVirtualOverride convertToVirtual() { - return this.getContainer().convertOverrideToVirtual(this); - } - - - // ********** misc ********** - - @Override - @SuppressWarnings("unchecked") - public C getParent() { - return (C) super.getParent(); - } - - public C getContainer() { - return this.getParent(); - } - - public X getXmlOverride() { - return this.xmlOverride; - } - - protected void initializeFrom(ReadOnlyOverride oldOverride) { - this.setName(oldOverride.getName()); - } - - protected void initializeFromVirtual(ReadOnlyOverride virtualOverride) { - this.setName(virtualOverride.getName()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.buildValidator().validate(messages, reporter); - } - - protected JptValidator buildValidator() { - return this.getContainer().buildValidator(this, this.buildTextRangeResolver()); - } - - protected OverrideTextRangeResolver buildTextRangeResolver() { - return new OrmOverrideTextRangeResolver(this); - } - - public TextRange getValidationTextRange() { - TextRange textRange = this.xmlOverride.getValidationTextRange(); - return (textRange != null) ? textRange : this.getParent().getValidationTextRange(); - } - - public TextRange getNameTextRange() { - TextRange textRange = this.xmlOverride.getNameTextRange(); - return (textRange != null) ? textRange : this.getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java deleted file mode 100644 index b2d3ad9903..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmOverrideContainer.java +++ /dev/null @@ -1,472 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.VirtualOverride; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverride; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOverride; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml override container - */ -public abstract class AbstractOrmOverrideContainer< - O extends OrmOverrideContainer.Owner, - R extends OrmReadOnlyOverride, - S extends OrmOverride, - V extends OrmVirtualOverride, - X extends XmlOverride - > - extends AbstractOrmXmlContextNode - implements OrmOverrideContainer -{ - // this can be null if the container is "read-only" (i.e. a "null" container) - protected final O owner; - - protected final Vector specifiedOverrides = new Vector(); - protected final SpecifiedOverrideContainerAdapter specifiedOverrideContainerAdapter = new SpecifiedOverrideContainerAdapter(); - - protected final Vector virtualOverrides = new Vector(); - protected final VirtualOverrideContainerAdapter virtualOverrideContainerAdapter = new VirtualOverrideContainerAdapter(); - - - protected AbstractOrmOverrideContainer(XmlContextNode parent, O owner) { - super(parent); - this.owner = owner; - this.initializeSpecifiedOverrides(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncSpecifiedOverrides(); - // the virtual overrides do not need a sync - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getSpecifiedOverrides()); - this.updateVirtualOverrides(); - } - - - // ********** overrides ********** - - public ListIterator overrides() { - return this.getOverrides().iterator(); - } - - @SuppressWarnings("unchecked") - protected ListIterable getOverrides() { - return new CompositeListIterable(this.getReadOnlySpecifiedOverrides(), this.getReadOnlyVirtualOverrides()); - } - - public int overridesSize() { - return this.specifiedOverrides.size() + this.virtualOverrides.size(); - } - - public R getOverrideNamed(String name) { - return this.selectOverrideNamed(this.getOverrides(), name); - } - - - // ********** override conversions ********** - - /** - * Silently add the new virtual override before removing the - * specified override, or the update will discover the missing - * virtual override and add it preemptively. - */ - public V convertOverrideToVirtual(Override_ override) { - if (override.isVirtual()) { - throw new IllegalArgumentException("Override is already virtual: " + override); //$NON-NLS-1$ - } - - @SuppressWarnings("unchecked") - S specifiedOverride = (S) override; - int virtualIndex = this.virtualOverrides.size(); - String overrideName = specifiedOverride.getName(); - V virtualOverride = null; - // make sure the specified override actually overrides something before building the virtual override - if (this.overrideWillBeVirtual(overrideName, specifiedOverride)) { - virtualOverride = this.buildVirtualOverride(overrideName); - this.virtualOverrides.add(virtualIndex, virtualOverride); - } - - this.removeSpecifiedOverride(specifiedOverride); // trigger update - - if (virtualOverride != null) { - this.fireItemAdded(VIRTUAL_OVERRIDES_LIST, virtualIndex, virtualOverride); - } - return virtualOverride; - } - - /** - * Return whether the specified override name will be a - * virtual override when the specified specified override is - * removed from the container. The override name must be among the - * valid override names and it must not correspond to any of the - * remaining specified overrides. - */ - protected boolean overrideWillBeVirtual(String overrideName, S specifiedOverrideToBeRemoved) { - return CollectionTools.contains(this.allOverridableNames(), overrideName) && - (this.getSpecifiedOverrideNamed(overrideName, specifiedOverrideToBeRemoved) == null); - } - - /** - * Silently remove the virtual override and add the new specified - * override before naming the specified override, or the update - * will discover the dangling virtual override and remove it preemptively. - */ - public S convertOverrideToSpecified(VirtualOverride override) { - if ( ! override.isVirtual()) { - throw new IllegalArgumentException("Override is already specified: " + override); //$NON-NLS-1$ - } - - @SuppressWarnings("unchecked") - V virtualOverride = (V) override; - int virtualIndex = this.virtualOverrides.indexOf(virtualOverride); - this.virtualOverrides.remove(virtualIndex); - - int specifiedIndex = this.specifiedOverrides.size(); - X xmlOverride = this.buildXmlOverride(); - S specifiedOverride = this.buildSpecifiedOverride(xmlOverride); - this.specifiedOverrides.add(specifiedIndex, specifiedOverride); - this.owner.getXmlOverrides().add(specifiedIndex, xmlOverride); - - this.initializeSpecifiedOverride(specifiedOverride, virtualOverride); // trigger update - - this.fireItemRemoved(VIRTUAL_OVERRIDES_LIST, virtualIndex, virtualOverride); - this.fireItemAdded(SPECIFIED_OVERRIDES_LIST, specifiedIndex, specifiedOverride); - return specifiedOverride; - } - - protected abstract void initializeSpecifiedOverride(S specifiedOverride, V virtualOverride); - - - // ********** specified overrides ********** - - public ListIterator specifiedOverrides() { - return this.getSpecifiedOverrides().iterator(); - } - - protected ListIterable getSpecifiedOverrides() { - return new LiveCloneListIterable(this.specifiedOverrides); - } - - @SuppressWarnings("unchecked") - protected ListIterable getReadOnlySpecifiedOverrides() { - // S should always be a subtype of R, but we can't enforce that in the - // class declaration... - return (ListIterable) this.getSpecifiedOverrides(); - } - - public int specifiedOverridesSize() { - return this.specifiedOverrides.size(); - } - - public S getSpecifiedOverride(int index) { - return this.specifiedOverrides.get(index); - } - - public S getSpecifiedOverrideNamed(String name) { - return this.getSpecifiedOverrideNamed(name, null); - } - - @SuppressWarnings("unchecked") - protected S getSpecifiedOverrideNamed(String name, S exclude) { - return (S) this.selectOverrideNamed(this.getReadOnlySpecifiedOverrides(), name, exclude); - } - - protected S addSpecifiedOverride() { - return this.addSpecifiedOverride(this.specifiedOverrides.size()); - } - - protected S addSpecifiedOverride(int index) { - X xmlOverride = this.buildXmlOverride(); - S override = this.addSpecifiedOverride_(index, xmlOverride); - this.owner.getXmlOverrides().add(index, xmlOverride); - return override; - } - - protected abstract X buildXmlOverride(); - - protected void removeSpecifiedOverride(S override) { - this.removeSpecifiedOverride(this.specifiedOverrides.indexOf(override)); - } - - protected void removeSpecifiedOverride(int index) { - this.removeSpecifiedOverride_(index); - this.owner.getXmlOverrides().remove(index); - } - - protected void removeSpecifiedOverride_(int index) { - this.removeItemFromList(index, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST); - } - - public void moveSpecifiedOverride(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST); - this.owner.getXmlOverrides().move(targetIndex, sourceIndex); - } - - protected void initializeSpecifiedOverrides() { - for (X xmlOverride : this.getXmlOverrides()) { - this.specifiedOverrides.add(this.buildSpecifiedOverride(xmlOverride)); - } - } - - protected abstract S buildSpecifiedOverride(X xmlOverride); - - protected void syncSpecifiedOverrides() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedOverrideContainerAdapter); - } - - protected Iterable getXmlOverrides() { - return (this.owner == null) ? EmptyIterable.instance() : this.getXmlOverrides_(); - } - - /** - * pre-condition: {@link #owner} is not null - */ - protected abstract Iterable getXmlOverrides_(); - - protected void moveSpecifiedOverride_(int index, S override) { - this.moveItemInList(index, override, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST); - } - - protected S addSpecifiedOverride_(int index, X xmlOverride) { - S override = this.buildSpecifiedOverride(xmlOverride); - this.addItemToList(index, override, this.specifiedOverrides, SPECIFIED_OVERRIDES_LIST); - return override; - } - - protected void removeSpecifiedOverride_(S override) { - this.removeSpecifiedOverride_(this.specifiedOverrides.indexOf(override)); - } - - /** - * specified override container adapter - */ - protected class SpecifiedOverrideContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractOrmOverrideContainer.this.getSpecifiedOverrides(); - } - public Iterable getResourceElements() { - return AbstractOrmOverrideContainer.this.getXmlOverrides(); - } - @SuppressWarnings("unchecked") - public X getResourceElement(S contextElement) { - return (X) contextElement.getXmlOverride(); - } - public void moveContextElement(int index, S element) { - AbstractOrmOverrideContainer.this.moveSpecifiedOverride_(index, element); - } - public void addContextElement(int index, X resourceElement) { - AbstractOrmOverrideContainer.this.addSpecifiedOverride_(index, resourceElement); - } - public void removeContextElement(S element) { - AbstractOrmOverrideContainer.this.removeSpecifiedOverride_(element); - } - } - - - // ********** virtual overrides ********** - - public ListIterator virtualOverrides() { - return this.getVirtualOverrides().iterator(); - } - - protected ListIterable getVirtualOverrides() { - return new LiveCloneListIterable(this.virtualOverrides); - } - - @SuppressWarnings("unchecked") - protected ListIterable getReadOnlyVirtualOverrides() { - // V should always be a subtype of R, but we can't enforce that in the - // class declaration... - return (ListIterable) this.getVirtualOverrides(); - } - - public int virtualOverridesSize() { - return this.virtualOverrides.size(); - } - - protected void updateVirtualOverrides() { - ContextContainerTools.update(this.virtualOverrideContainerAdapter); - } - - /** - * Return the overridable names that are not already in the list of - * specified overrides. - */ - protected Iterable getVirtualOverrideNames() { - return CollectionTools.iterable(this.virtualOverrideNames()); - } - - protected Iterator virtualOverrideNames() { - return new FilteringIterator(this.allOverridableNames()) { - @Override - protected boolean accept(String name) { - return AbstractOrmOverrideContainer.this.overrideIsVirtual(name); - } - }; - } - - protected boolean overrideIsVirtual(String name) { - return this.getSpecifiedOverrideNamed(name) == null; - } - - protected void moveVirtualOverride(int index, V override) { - this.moveItemInList(index, override, this.virtualOverrides, VIRTUAL_OVERRIDES_LIST); - } - - protected V addVirtualOverride(int index, String name) { - V override = this.buildVirtualOverride(name); - this.addItemToList(index, override, this.virtualOverrides, VIRTUAL_OVERRIDES_LIST); - return override; - } - - protected abstract V buildVirtualOverride(String name); - - protected void removeVirtualOverride(V override) { - this.removeItemFromList(override, this.virtualOverrides, VIRTUAL_OVERRIDES_LIST); - } - - /** - * virtual override container adapter - * NB: the context override is matched with a resource override by name - */ - protected class VirtualOverrideContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return AbstractOrmOverrideContainer.this.getVirtualOverrides(); - } - public Iterable getResourceElements() { - return AbstractOrmOverrideContainer.this.getVirtualOverrideNames(); - } - public String getResourceElement(V contextElement) { - return contextElement.getName(); - } - public void moveContextElement(int index, V element) { - AbstractOrmOverrideContainer.this.moveVirtualOverride(index, element); - } - public void addContextElement(int index, String resourceElement) { - AbstractOrmOverrideContainer.this.addVirtualOverride(index, resourceElement); - } - public void removeContextElement(V element) { - AbstractOrmOverrideContainer.this.removeVirtualOverride(element); - } - } - - - // ********** misc ********** - - public TypeMapping getOverridableTypeMapping() { - return this.owner.getOverridableTypeMapping(); - } - - public TypeMapping getTypeMapping() { - return this.owner.getTypeMapping(); - } - - public Iterator allOverridableNames() { - return (this.owner != null) ? this.owner.allOverridableNames() : EmptyIterator.instance(); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.owner.tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return this.owner.candidateTableNames(); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return this.owner.resolveDbTable(tableName); - } - - public String getDefaultTableName() { - return this.owner.getDefaultTableName(); - } - - public JptValidator buildValidator(Override_ override, OverrideTextRangeResolver textRangeResolver) { - return this.owner.buildValidator(override, this, textRangeResolver); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) { - return this.owner.buildColumnValidator(override, column, columnOwner, textRangeResolver); - } - - protected R selectOverrideNamed(Iterable overrides, String name) { - return this.selectOverrideNamed(overrides, name, null); - } - - protected R selectOverrideNamed(Iterable overrides, String name, S exclude) { - for (R override : overrides) { - if (override == exclude) { - continue; // skip - } - if (this.valuesAreEqual(override.getName(), name)) { - return override; - } - } - return null; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - - for (R override : this.getOverrides()) { - override.validate(messages, reporter); - } - } - - public TextRange getValidationTextRange() { - return (this.specifiedOverrides.size() > 0) ? - this.specifiedOverrides.get(0).getValidationTextRange() : - this.owner.getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java deleted file mode 100644 index 2a4dd9cd02..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/AbstractOrmVirtualOverride.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.OrmOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverride; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; - -/** - * Virtual orm.xml override - */ -public abstract class AbstractOrmVirtualOverride - extends AbstractOrmXmlContextNode - implements OrmVirtualOverride -{ - protected final String name; // never null - - - protected AbstractOrmVirtualOverride(C parent, String name) { - super(parent); - this.name = name; - } - - public String getName() { - return this.name; - } - - public boolean isVirtual() { - return true; - } - - public OrmOverride convertToSpecified() { - return this.getContainer().convertOverrideToSpecified(this); - } - - @Override - @SuppressWarnings("unchecked") - public C getParent() { - return (C) super.getParent(); - } - - public C getContainer() { - return this.getParent(); - } - - public TextRange getValidationTextRange() { - return this.getParent().getValidationTextRange(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericEntityMappings.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericEntityMappings.java deleted file mode 100644 index a6ae9ee62b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericEntityMappings.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmXml; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractEntityMappings; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings; - -/** - * orm.xml file - *
- * entity-mappings element - */ -public class GenericEntityMappings - extends AbstractEntityMappings -{ - public GenericEntityMappings(OrmXml parent, XmlEntityMappings resource) { - super(parent, resource); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java deleted file mode 100644 index 25b6eb44c7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverride.java +++ /dev/null @@ -1,97 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.ReadOnlyAssociationOverride; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmOverrideRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Specified orm.xml association override - */ -public class GenericOrmAssociationOverride - extends AbstractOrmOverride - implements OrmAssociationOverride -{ - protected final OrmOverrideRelationship relationship; - - - public GenericOrmAssociationOverride(OrmAssociationOverrideContainer parent, XmlAssociationOverride xmlOverride) { - super(parent, xmlOverride); - this.relationship = this.buildRelationship(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.relationship.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.relationship.update(); - } - - - // ********** specified/virtual ********** - - @Override - public OrmVirtualAssociationOverride convertToVirtual() { - return (OrmVirtualAssociationOverride) super.convertToVirtual(); - } - - - // ********** relationship ********** - - public OrmOverrideRelationship getRelationship() { - return this.relationship; - } - - protected OrmOverrideRelationship buildRelationship() { - return this.getContextNodeFactory().buildOrmOverrideRelationship(this); - } - - - // ********** misc ********** - - public RelationshipMapping getMapping() { - return this.getContainer().getRelationshipMapping(this.name); - } - - public void initializeFrom(ReadOnlyAssociationOverride oldOverride) { - super.initializeFrom(oldOverride); - this.relationship.initializeFrom(oldOverride.getRelationship()); - } - - public void initializeFromVirtual(ReadOnlyAssociationOverride virtualOverride) { - super.initializeFromVirtual(virtualOverride); - this.relationship.initializeFromVirtual(virtualOverride.getRelationship()); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.relationship.validate(messages, reporter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java deleted file mode 100644 index 6b34106360..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAssociationOverrideContainer.java +++ /dev/null @@ -1,93 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.jpa.core.context.AssociationOverride; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyAssociationOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride; - -/** - * orm.xml association override container - */ -public class GenericOrmAssociationOverrideContainer - extends AbstractOrmOverrideContainer< - OrmAssociationOverrideContainer.Owner, - OrmReadOnlyAssociationOverride, - OrmAssociationOverride, - OrmVirtualAssociationOverride, - XmlAssociationOverride - > - implements OrmAssociationOverrideContainer -{ - public GenericOrmAssociationOverrideContainer(XmlContextNode parent, OrmAssociationOverrideContainer.Owner owner) { - super(parent, owner); - } - - - public RelationshipMapping getRelationshipMapping(String attributeName) { - return MappingTools.getRelationshipMapping(attributeName, this.owner.getOverridableTypeMapping()); - } - - public Relationship resolveOverriddenRelationship(String associationOverrideName) { - return this.owner.resolveOverriddenRelationship(associationOverrideName); - } - - public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner columnOwner, JoinColumnTextRangeResolver textRangeResolver) { - return this.owner.buildJoinTableJoinColumnValidator(override, column, columnOwner, textRangeResolver); - } - - public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner columnOwner, JoinColumnTextRangeResolver textRangeResolver) { - return this.owner.buildJoinTableInverseJoinColumnValidator(override, column, columnOwner, textRangeResolver); - } - - public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) { - return this.owner.buildTableValidator(override, table, textRangeResolver); - } - - @Override - protected Iterable getXmlOverrides_() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.owner.getXmlOverrides()); - } - - @Override - protected XmlAssociationOverride buildXmlOverride() { - return OrmFactory.eINSTANCE.createXmlAssociationOverride(); - } - - @Override - protected OrmAssociationOverride buildSpecifiedOverride(XmlAssociationOverride xmlOverride) { - return this.getContextNodeFactory().buildOrmAssociationOverride(this, xmlOverride); - } - - @Override - protected void initializeSpecifiedOverride(OrmAssociationOverride specifiedOverride, OrmVirtualAssociationOverride virtualOverride) { - specifiedOverride.initializeFromVirtual(virtualOverride); - } - - @Override - protected OrmVirtualAssociationOverride buildVirtualOverride(String name) { - return this.getContextNodeFactory().buildOrmVirtualAssociationOverride(this, name); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java deleted file mode 100644 index 9e6b30c0dc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverride.java +++ /dev/null @@ -1,201 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyAttributeOverride; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride; -import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * Specified orm.xml attribute override - */ -public class GenericOrmAttributeOverride - extends AbstractOrmOverride - implements OrmAttributeOverride, OrmColumn.Owner -{ - protected final OrmColumn column; - - - public GenericOrmAttributeOverride(OrmAttributeOverrideContainer parent, XmlAttributeOverride xmlOverride) { - super(parent, xmlOverride); - this.column = this.buildColumn(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.column.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.column.update(); - } - - - // ********** specified/virtual ********** - - @Override - public OrmVirtualAttributeOverride convertToVirtual() { - return (OrmVirtualAttributeOverride) super.convertToVirtual(); - } - - - // ********** column ********** - - public OrmColumn getColumn() { - return this.column; - } - - protected OrmColumn buildColumn() { - return this.getContextNodeFactory().buildOrmColumn(this, this); - } - - - // ********** misc ********** - - public void initializeFrom(ReadOnlyAttributeOverride oldOverride) { - super.initializeFrom(oldOverride); - this.column.initializeFrom(oldOverride.getColumn()); - } - - public void initializeFromVirtual(ReadOnlyAttributeOverride oldOverride) { - super.initializeFromVirtual(oldOverride); - this.column.initializeFromVirtual(oldOverride.getColumn()); - } - - - // ********** column owner implementation ********** - - public TypeMapping getTypeMapping() { - return this.getContainer().getTypeMapping(); - } - - public String getDefaultTableName() { - return this.getContainer().getDefaultTableName(); - } - - public Table resolveDbTable(String tableName) { - return this.getContainer().resolveDbTable(tableName); - } - - public String getDefaultColumnName() { - return this.name; - } - - public JptValidator buildColumnValidator(NamedColumn col, NamedColumnTextRangeResolver textRangeResolver) { - return this.getContainer().buildColumnValidator(this, (BaseColumn) col, this, (BaseColumnTextRangeResolver) textRangeResolver); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getContainer().tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return this.getContainer().candidateTableNames(); - } - - public XmlColumn getXmlColumn() { - return this.getXmlOverride().getColumn(); - } - - public XmlColumn buildXmlColumn() { - XmlColumn xmlColumn = OrmFactory.eINSTANCE.createXmlColumn(); - this.getXmlOverride().setColumn(xmlColumn); - return xmlColumn; - } - - public void removeXmlColumn() { - this.getXmlOverride().setColumn(null); - } - - - // ********** mapped by relationship ********** - - protected boolean isMappedByRelationship() { - return CollectionTools.contains(this.getMappedByRelationshipAttributeNames(), this.buildQualifier()); - } - - protected Iterable getMappedByRelationshipAttributeNames() { - return TypeMappingTools.getMappedByRelationshipAttributeNames(this.getTypeMapping()); - } - - /** - * overridable names are (usually?) qualified with a container mapping, - * which may also be the one mapped by a relationship - */ - protected String buildQualifier() { - if (this.name == null) { - return null; - } - int index = this.name.indexOf('.'); - return (index == -1) ? this.name : this.name.substring(0, index); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - - // [JPA 2.0] if the column is specified, or if the override is not mapped by a relationship, - // then the column is validated. - // (In JPA 1.0, the column will always be validated, since the override is never mapped by a - // relationship) - if (this.xmlColumnIsSpecified() || ! this.isMappedByRelationship()) { - this.column.validate(messages, reporter); - } - - // [JPA 2.0] if the override is mapped by a relationship, then that actually is in itself - // a validation error - // (We prevent implied overrides that are mapped by a relationship ... hopefully) - // (In JPA 1.0, this will never occur) - if (this.isMappedByRelationship()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ATTRIBUTE_OVERRIDE_MAPPED_BY_RELATIONSHIP_AND_SPECIFIED, - EMPTY_STRING_ARRAY, - this, - this.getValidationTextRange() - ) - ); - } - } - - protected boolean xmlColumnIsSpecified() { - return this.getXmlColumn() != null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java deleted file mode 100644 index 7501968550..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmAttributeOverrideContainer.java +++ /dev/null @@ -1,76 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyAttributeOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride; - -/** - * orm.xml attribute override container - */ -public class GenericOrmAttributeOverrideContainer - extends AbstractOrmOverrideContainer< - OrmAttributeOverrideContainer.Owner, - OrmReadOnlyAttributeOverride, - OrmAttributeOverride, - OrmVirtualAttributeOverride, - XmlAttributeOverride - > - implements OrmAttributeOverrideContainer -{ - public GenericOrmAttributeOverrideContainer(XmlContextNode parent, OrmAttributeOverrideContainer.Owner owner) { - super(parent, owner); - } - - - public Column resolveOverriddenColumn(String attributeName) { - return (attributeName == null) ? null : this.owner.resolveOverriddenColumn(attributeName); - } - - @Override - protected Iterable getXmlOverrides_() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.owner.getXmlOverrides()); - } - - @Override - protected XmlAttributeOverride buildXmlOverride() { - return OrmFactory.eINSTANCE.createXmlAttributeOverride(); - } - - @Override - protected OrmAttributeOverride buildSpecifiedOverride(XmlAttributeOverride xmlOverride) { - return this.getContextNodeFactory().buildOrmAttributeOverride(this, xmlOverride); - } - - public void initializeFrom(OrmAttributeOverrideContainer oldContainer) { - for (OrmAttributeOverride oldOverride : CollectionTools.iterable(oldContainer.specifiedOverrides())) { - this.addSpecifiedOverride().initializeFrom(oldOverride); - } - } - - @Override - protected void initializeSpecifiedOverride(OrmAttributeOverride specifiedOverride, OrmVirtualAttributeOverride virtualOverride) { - specifiedOverride.initializeFromVirtual(virtualOverride); - } - - @Override - protected OrmVirtualAttributeOverride buildVirtualOverride(String name) { - return this.getContextNodeFactory().buildOrmVirtualAttributeOverride(this, name); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java deleted file mode 100644 index 99f763d272..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmBasicMapping.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBasicMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlBasic; - -/** - * orm.xml basic mapping - */ -public class GenericOrmBasicMapping - extends AbstractOrmBasicMapping -{ - public GenericOrmBasicMapping(OrmPersistentAttribute parent, XmlBasic xmlMapping) { - super(parent, xmlMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmCascade.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmCascade.java deleted file mode 100644 index f27fde2d17..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmCascade.java +++ /dev/null @@ -1,303 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Cascade; -import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipMapping; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmRelationshipMapping; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.Cascade2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCascade2_0; -import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlRelationshipMapping; -import org.eclipse.jpt.jpa.core.resource.orm.CascadeType; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; - -public class GenericOrmCascade - extends AbstractOrmXmlContextNode - implements OrmCascade2_0 -{ - protected boolean all; - - protected boolean persist; - - protected boolean merge; - - protected boolean remove; - - protected boolean refresh; - - /* JPA 2.0 */ - protected boolean detach; - - - /** - * This is built directly by the mapping implementation; as opposed to via - * a platform-specific factory. - * @see AbstractOrmRelationshipMapping#buildCascade() - */ - public GenericOrmCascade(OrmRelationshipMapping parent) { - super(parent); - this.all = this.buildAll(); - this.persist = this.buildPersist(); - this.merge = this.buildMerge(); - this.remove = this.buildRemove(); - this.refresh = this.buildRefresh(); - this.detach = this.buildDetach(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setAll_(this.buildAll()); - this.setPersist_(this.buildPersist()); - this.setMerge_(this.buildMerge()); - this.setRemove_(this.buildRemove()); - this.setRefresh_(this.buildRefresh()); - this.setDetach_(this.buildDetach()); - } - - - // ********** all ********** - - public boolean isAll() { - return this.all; - } - - public void setAll(boolean all) { - if (this.all != all) { - CascadeType xmlCascade = this.getXmlCascadeForUpdate(); - this.setAll_(all); - xmlCascade.setCascadeAll(all); - this.removeXmlCascadeIfUnset(); - } - } - - protected void setAll_(boolean all) { - boolean old = this.all; - this.all = all; - this.firePropertyChanged(ALL_PROPERTY, old, all); - } - - protected boolean buildAll() { - CascadeType xmlCascade = this.getXmlCascade(); - return (xmlCascade != null) && xmlCascade.isCascadeAll(); - } - - - // ********** persist ********** - - public boolean isPersist() { - return this.persist; - } - - public void setPersist(boolean persist) { - if (this.persist != persist) { - CascadeType xmlCascade = this.getXmlCascadeForUpdate(); - this.setPersist_(persist); - xmlCascade.setCascadePersist(persist); - this.removeXmlCascadeIfUnset(); - } - } - - protected boolean setPersist_(boolean persist) { - boolean old = this.persist; - this.persist = persist; - return this.firePropertyChanged(PERSIST_PROPERTY, old, persist); - } - - protected boolean buildPersist() { - CascadeType xmlCascade = this.getXmlCascade(); - return (xmlCascade != null) && xmlCascade.isCascadePersist(); - } - - - // ********** merge ********** - - public boolean isMerge() { - return this.merge; - } - - public void setMerge(boolean merge) { - if (this.merge != merge) { - CascadeType xmlCascade = this.getXmlCascadeForUpdate(); - this.setMerge_(merge); - xmlCascade.setCascadeMerge(merge); - this.removeXmlCascadeIfUnset(); - } - } - - protected boolean setMerge_(boolean merge) { - boolean old = this.merge; - this.merge = merge; - return this.firePropertyChanged(MERGE_PROPERTY, old, merge); - } - - protected boolean buildMerge() { - CascadeType xmlCascade = this.getXmlCascade(); - return (xmlCascade != null) && xmlCascade.isCascadeMerge(); - } - - - // ********** remove ********** - - public boolean isRemove() { - return this.remove; - } - - public void setRemove(boolean remove) { - if (this.remove != remove) { - CascadeType xmlCascade = this.getXmlCascadeForUpdate(); - this.setRemove_(remove); - xmlCascade.setCascadeRemove(remove); - this.removeXmlCascadeIfUnset(); - } - } - - protected boolean setRemove_(boolean remove) { - boolean old = this.remove; - this.remove = remove; - return this.firePropertyChanged(REMOVE_PROPERTY, old, remove); - } - - protected boolean buildRemove() { - CascadeType xmlCascade = this.getXmlCascade(); - return (xmlCascade != null) && xmlCascade.isCascadeRemove(); - } - - - // ********** refresh ********** - - public boolean isRefresh() { - return this.refresh; - } - - public void setRefresh(boolean refresh) { - if (this.refresh != refresh) { - CascadeType xmlCascade = this.getXmlCascadeForUpdate(); - this.setRefresh_(refresh); - xmlCascade.setCascadeRefresh(refresh); - this.removeXmlCascadeIfUnset(); - } - } - - protected boolean setRefresh_(boolean refresh) { - boolean old = this.refresh; - this.refresh = refresh; - return this.firePropertyChanged(REFRESH_PROPERTY, old, refresh); - } - - protected boolean buildRefresh() { - CascadeType xmlCascade = this.getXmlCascade(); - return (xmlCascade != null) && xmlCascade.isCascadeRefresh(); - } - - - // ********** detach ********** - - public boolean isDetach() { - return this.detach; - } - - public void setDetach(boolean detach) { - if (this.detach != detach) { - CascadeType xmlCascade = this.getXmlCascadeForUpdate(); - this.setDetach_(detach); - xmlCascade.setCascadeDetach(detach); - this.removeXmlCascadeIfUnset(); - } - } - - protected boolean setDetach_(boolean detach) { - boolean old = this.detach; - this.detach = detach; - return this.firePropertyChanged(DETACH_PROPERTY, old, detach); - } - - protected boolean buildDetach() { - return this.isJpa2_0Compatible() && this.buildDetach_(); - } - - protected boolean buildDetach_() { - CascadeType xmlCascade = this.getXmlCascade(); - return (xmlCascade != null) && xmlCascade.isCascadeDetach(); - } - - - // ********** XML cascade ********** - - /** - * Return null if XML cascade does not exists. - */ - protected CascadeType getXmlCascade() { - return this.getXmlRelationshipMapping().getCascade(); - } - - /** - * Build the XML cascade if it does not exist. - */ - protected CascadeType getXmlCascadeForUpdate() { - CascadeType xmlCascade = this.getXmlCascade(); - return (xmlCascade != null) ? xmlCascade : this.buildXmlCascade(); - } - - protected CascadeType buildXmlCascade() { - CascadeType xmlCascade = OrmFactory.eINSTANCE.createCascadeType(); - this.getXmlRelationshipMapping().setCascade(xmlCascade); - return xmlCascade; - } - - protected void removeXmlCascadeIfUnset() { - if (this.getXmlCascade().isUnset()) { - this.removeXmlCascade(); - } - } - - protected void removeXmlCascade() { - this.getXmlRelationshipMapping().setCascade(null); - } - - - // ********** misc ********** - - @Override - public OrmRelationshipMapping getParent() { - return (OrmRelationshipMapping) super.getParent(); - } - - protected OrmRelationshipMapping getRelationshipMapping() { - return this.getParent(); - } - - protected AbstractXmlRelationshipMapping getXmlRelationshipMapping() { - return this.getRelationshipMapping().getXmlAttributeMapping(); - } - - public void initializeFrom(Cascade oldCascade) { - this.setAll(oldCascade.isAll()); - this.setPersist(oldCascade.isPersist()); - this.setMerge(oldCascade.isMerge()); - this.setRemove(oldCascade.isRemove()); - this.setRefresh(oldCascade.isRefresh()); - if (this.isJpa2_0Compatible()) { - this.setDetach(((Cascade2_0) oldCascade).isDetach()); - } - } - - public TextRange getValidationTextRange() { - CascadeType xmlCascade = this.getXmlCascade(); - return (xmlCascade != null) ? - xmlCascade.getValidationTextRange() : - this.getRelationshipMapping().getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmColumn.java deleted file mode 100644 index 6e254476eb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmColumn.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0, which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmColumn; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn; - -/** - * orm.xml column - */ -public class GenericOrmColumn - extends AbstractOrmBaseColumn - implements OrmColumn -{ - // TODO defaults from java for all of these settings - protected Integer specifiedLength; - - protected Integer specifiedPrecision; - - protected Integer specifiedScale; - - - public GenericOrmColumn(XmlContextNode parent, OrmColumn.Owner owner) { - super(parent, owner); - this.specifiedLength = this.buildSpecifiedLength(); - this.specifiedPrecision = this.buildSpecifiedPrecision(); - this.specifiedScale = this.buildSpecifiedScale(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedLength_(this.buildSpecifiedLength()); - this.setSpecifiedPrecision_(this.buildSpecifiedPrecision()); - this.setSpecifiedScale_(this.buildSpecifiedScale()); - } - - - // ********** XML column ********** - - @Override - public XmlColumn getXmlColumn() { - return this.owner.getXmlColumn(); - } - - @Override - protected XmlColumn buildXmlColumn() { - return this.owner.buildXmlColumn(); - } - - @Override - protected void removeXmlColumn() { - this.owner.removeXmlColumn(); - } - - - // ********** length ********** - - public int getLength() { - return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.getDefaultLength(); - } - - public Integer getSpecifiedLength() { - return this.specifiedLength; - } - - public void setSpecifiedLength(Integer length) { - if (this.valuesAreDifferent(this.specifiedLength, length)) { - XmlColumn xmlColumn = this.getXmlColumnForUpdate(); - this.setSpecifiedLength_(length); - xmlColumn.setLength(length); - this.removeXmlColumnIfUnset(); - } - } - - protected void setSpecifiedLength_(Integer length) { - Integer old = this.specifiedLength; - this.specifiedLength = length; - this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length); - } - - protected Integer buildSpecifiedLength() { - XmlColumn xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getLength(); - } - - public int getDefaultLength() { - return DEFAULT_LENGTH; - } - - - // ********** precision ********** - - public int getPrecision() { - return (this.specifiedPrecision != null) ? this.specifiedPrecision.intValue() : this.getDefaultPrecision(); - } - - public Integer getSpecifiedPrecision() { - return this.specifiedPrecision; - } - - public void setSpecifiedPrecision(Integer precision) { - if (this.valuesAreDifferent(this.specifiedPrecision, precision)) { - XmlColumn xmlColumn = this.getXmlColumnForUpdate(); - this.setSpecifiedPrecision_(precision); - xmlColumn.setPrecision(precision); - this.removeXmlColumnIfUnset(); - } - } - - protected void setSpecifiedPrecision_(Integer precision) { - Integer old = this.specifiedPrecision; - this.specifiedPrecision = precision; - this.firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, old, precision); - } - - protected Integer buildSpecifiedPrecision() { - XmlColumn xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getPrecision(); - } - - public int getDefaultPrecision() { - return DEFAULT_PRECISION; - } - - - // ********** scale ********** - - public int getScale() { - return (this.specifiedScale != null) ? this.specifiedScale.intValue() : this.getDefaultScale(); - } - - public Integer getSpecifiedScale() { - return this.specifiedScale; - } - - public void setSpecifiedScale(Integer scale) { - if (this.valuesAreDifferent(this.specifiedScale, scale)) { - XmlColumn xmlColumn = this.getXmlColumnForUpdate(); - this.setSpecifiedScale_(scale); - xmlColumn.setScale(scale); - this.removeXmlColumnIfUnset(); - } - } - - protected void setSpecifiedScale_(Integer scale) { - Integer old = this.specifiedScale; - this.specifiedScale = scale; - this.firePropertyChanged(SPECIFIED_SCALE_PROPERTY, old, scale); - } - - protected Integer buildSpecifiedScale() { - XmlColumn xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getScale(); - } - - public int getDefaultScale() { - return DEFAULT_SCALE; - } - - - // ********** misc ********** - - public void initializeFrom(ReadOnlyColumn oldColumn) { - super.initializeFrom(oldColumn); - this.setSpecifiedLength(oldColumn.getSpecifiedLength()); - this.setSpecifiedPrecision(oldColumn.getSpecifiedPrecision()); - this.setSpecifiedScale(oldColumn.getSpecifiedScale()); - } - - public void initializeFromVirtual(ReadOnlyColumn virtualColumn) { - super.initializeFromVirtual(virtualColumn); - // ignore other settings? - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java deleted file mode 100644 index be90386975..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmDiscriminatorColumn.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0, which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.DiscriminatorType; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmDiscriminatorColumn; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlDiscriminatorColumn; - -/** - * orm.xml discriminator column - */ -public class GenericOrmDiscriminatorColumn - extends AbstractOrmNamedColumn - implements OrmDiscriminatorColumn -{ - protected DiscriminatorType specifiedDiscriminatorType; - protected DiscriminatorType defaultDiscriminatorType; - - protected Integer specifiedLength; - protected int defaultLength; - - - public GenericOrmDiscriminatorColumn(XmlContextNode parent, OrmDiscriminatorColumn.Owner owner) { - super(parent, owner); - this.specifiedDiscriminatorType = this.buildSpecifiedDiscriminatorType(); - this.specifiedLength = this.buildSpecifiedLength(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedDiscriminatorType_(this.buildSpecifiedDiscriminatorType()); - this.setSpecifiedLength_(this.buildSpecifiedLength()); - } - - @Override - public void update() { - super.update(); - this.setDefaultDiscriminatorType(this.buildDefaultDiscriminatorType()); - this.setDefaultLength(this.buildDefaultLength()); - } - - - // ********** XML column ********** - - @Override - public XmlDiscriminatorColumn getXmlColumn() { - return this.owner.getXmlColumn(); - } - - @Override - protected XmlDiscriminatorColumn buildXmlColumn() { - return this.owner.buildXmlColumn(); - } - - @Override - protected void removeXmlColumn() { - this.owner.removeXmlColumn(); - } - - - // ********** discriminator type ********** - - public DiscriminatorType getDiscriminatorType() { - return (this.specifiedDiscriminatorType != null) ? this.specifiedDiscriminatorType : this.defaultDiscriminatorType; - } - - public DiscriminatorType getSpecifiedDiscriminatorType() { - return this.specifiedDiscriminatorType; - } - - public void setSpecifiedDiscriminatorType(DiscriminatorType discriminatorType) { - if (this.valuesAreDifferent(this.specifiedDiscriminatorType, discriminatorType)) { - XmlDiscriminatorColumn xmlColumn = this.getXmlColumnForUpdate(); - this.setSpecifiedDiscriminatorType_(discriminatorType); - xmlColumn.setDiscriminatorType(DiscriminatorType.toOrmResourceModel(discriminatorType)); - this.removeXmlColumnIfUnset(); - } - } - - protected void setSpecifiedDiscriminatorType_(DiscriminatorType discriminatorType) { - DiscriminatorType old = this.specifiedDiscriminatorType; - this.specifiedDiscriminatorType = discriminatorType; - this.firePropertyChanged(SPECIFIED_DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType); - } - - protected DiscriminatorType buildSpecifiedDiscriminatorType() { - XmlDiscriminatorColumn xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : DiscriminatorType.fromOrmResourceModel(xmlColumn.getDiscriminatorType()); - } - - public DiscriminatorType getDefaultDiscriminatorType() { - return this.defaultDiscriminatorType; - } - - protected void setDefaultDiscriminatorType(DiscriminatorType discriminatorType) { - DiscriminatorType old = this.defaultDiscriminatorType; - this.defaultDiscriminatorType = discriminatorType; - this.firePropertyChanged(DEFAULT_DISCRIMINATOR_TYPE_PROPERTY, old, discriminatorType); - } - - protected DiscriminatorType buildDefaultDiscriminatorType() { - return this.owner.getDefaultDiscriminatorType(); - } - - - // ********** length ********** - - public int getLength() { - return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.defaultLength; - } - - public Integer getSpecifiedLength() { - return this.specifiedLength; - } - - public void setSpecifiedLength(Integer length) { - if (this.valuesAreDifferent(this.specifiedLength, length)) { - XmlDiscriminatorColumn xmlColumn = this.getXmlColumnForUpdate(); - this.setSpecifiedLength_(length); - xmlColumn.setLength(length); - this.removeXmlColumnIfUnset(); - } - } - - protected void setSpecifiedLength_(Integer length) { - Integer old = this.specifiedLength; - this.specifiedLength = length; - this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length); - } - - protected Integer buildSpecifiedLength() { - XmlDiscriminatorColumn xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getLength(); - } - - public int getDefaultLength() { - return this.defaultLength; - } - - protected void setDefaultLength(int defaultLength) { - int old = this.defaultLength; - this.defaultLength = defaultLength; - this.firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, defaultLength); - } - - protected int buildDefaultLength() { - return this.owner.getDefaultLength(); - } - - - // ********** validation ********** - - public boolean isResourceSpecified() { - return this.getXmlColumn() != null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java deleted file mode 100644 index 9ecf827277..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddable.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. This - * program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0 which accompanies this distribution, and is - * available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: Oracle. - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmEmbeddable; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaEmbeddable; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable; - -/** - * orm.xml embeddable type mapping - */ -public class GenericOrmEmbeddable - extends AbstractOrmEmbeddable -{ - public GenericOrmEmbeddable(OrmPersistentType parent, XmlEmbeddable resourceMapping) { - super(parent, resourceMapping); - } - - @Override - public boolean attributeMappingKeyAllowed(String attributeMappingKey) { - return ArrayTools.contains(GenericJavaEmbeddable.ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java deleted file mode 100644 index b8fad23d1c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedIdMapping.java +++ /dev/null @@ -1,180 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.Iterator; -import java.util.List; -import java.util.Set; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddedIdMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.TypeMappingTools; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseEmbeddedMapping; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.EmbeddedIdMapping2_0; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddedId; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml embedded ID mapping - */ -public class GenericOrmEmbeddedIdMapping - extends AbstractOrmBaseEmbeddedMapping - implements EmbeddedIdMapping2_0, OrmEmbeddedIdMapping -{ - /* JPA 2.0 feature - a relationship may map this embedded ID */ - protected boolean mappedByRelationship; - - - public GenericOrmEmbeddedIdMapping(OrmPersistentAttribute parent, XmlEmbeddedId xmlMapping) { - super(parent, xmlMapping); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.setMappedByRelationship(this.buildMappedByRelationship()); - } - - - // ********** mapped by relationship ********** - - public boolean isMappedByRelationship() { - return this.mappedByRelationship; - } - - protected void setMappedByRelationship(boolean value) { - boolean old = this.mappedByRelationship; - this.mappedByRelationship = value; - this.firePropertyChanged(MAPPED_BY_RELATIONSHIP_PROPERTY, old, value); - } - - protected boolean buildMappedByRelationship() { - return this.isJpa2_0Compatible() && this.buildMappedByRelationship_(); - } - - protected boolean buildMappedByRelationship_() { - return CollectionTools.contains(this.getMappedByRelationshipAttributeNames(), this.name); - } - - protected Iterable getMappedByRelationshipAttributeNames() { - return TypeMappingTools.getMappedByRelationshipAttributeNames(this.getTypeMapping()); - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY; - } - - public int getXmlSequence() { - return 10; - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmEmbeddedIdMapping(this); - } - - public void addXmlAttributeMappingTo(Attributes xmlAttributes) { - xmlAttributes.getEmbeddedIds().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) { - xmlAttributes.getEmbeddedIds().remove(this.xmlAttributeMapping); - } - - @Override - protected Iterator embeddableOverridableAttributeMappingNames() { - return this.mappedByRelationship ? - EmptyIterator.instance() : - super.embeddableOverridableAttributeMappingNames(); - } - - @Override - protected OrmAttributeOverrideContainer.Owner buildAttributeOverrideContainerOwner() { - return new AttributeOverrideContainerOwner(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - - // [JPA 2.0] if the embedded id is mapped by a relationship, then any specified - // attribute overrides are in error - // (in JPA 1.0, this will obviously never be reached) - if (this.mappedByRelationship - && (this.attributeOverrideContainer.specifiedOverridesSize() > 0)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.EMBEDDED_ID_MAPPING_MAPPED_BY_RELATIONSHIP_AND_ATTRIBUTE_OVERRIDES_SPECIFIED, - EMPTY_STRING_ARRAY, - this.attributeOverrideContainer, - this.attributeOverrideContainer.getValidationTextRange() - ) - ); - } - } - - - // ********** attribute override container owner ********* - - protected class AttributeOverrideContainerOwner - extends AbstractOrmBaseEmbeddedMapping.AttributeOverrideContainerOwner - { - @Override - public Iterator allOverridableNames() { - return GenericOrmEmbeddedIdMapping.this.isMappedByRelationship() ? - EmptyIterator.instance() : - super.allOverridableNames(); - } - - /** - * pre-condition: type mapping is not null - */ - @Override - protected Iterator allOverridableAttributeNames_(TypeMapping typeMapping) { - final Set mappedByRelationshipAttributeNames = this.buildMappedByRelationshipAttributeNames(); - if (mappedByRelationshipAttributeNames.isEmpty()) { - return super.allOverridableAttributeNames_(typeMapping); - } - return new FilteringIterator(super.allOverridableAttributeNames_(typeMapping)) { - @Override - protected boolean accept(String attributeName) { - // overridable names are (usually?) qualified with a container mapping, - // which may also be the one mapped by a relationship - int dotIndex = attributeName.indexOf('.'); - String qualifier = (dotIndex > 0) ? attributeName.substring(0, dotIndex) : attributeName; - return ! mappedByRelationshipAttributeNames.contains(qualifier); - } - }; - } - - protected Set buildMappedByRelationshipAttributeNames() { - return CollectionTools.set(GenericOrmEmbeddedIdMapping.this.getMappedByRelationshipAttributeNames()); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java deleted file mode 100644 index aa025b16e4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEmbeddedMapping.java +++ /dev/null @@ -1,304 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.common.utility.internal.iterators.SubIteratorWrapper; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.AssociationOverride; -import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.OverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseEmbeddedMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinTableValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EntityTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaEmbeddedMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmEmbeddedMapping2_0; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbedded; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml embedded mapping - */ -public class GenericOrmEmbeddedMapping - extends AbstractOrmBaseEmbeddedMapping - implements OrmEmbeddedMapping2_0 -{ - protected final OrmAssociationOverrideContainer associationOverrideContainer; - - - public GenericOrmEmbeddedMapping(OrmPersistentAttribute parent, XmlEmbedded xmlMapping) { - super(parent, xmlMapping); - this.associationOverrideContainer = this.buildAssociationOverrideContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.associationOverrideContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.associationOverrideContainer.update(); - } - - - // ********** association override container ********** - - public OrmAssociationOverrideContainer getAssociationOverrideContainer() { - return this.associationOverrideContainer; - } - - protected OrmAssociationOverrideContainer buildAssociationOverrideContainer() { - return this.isJpa2_0Compatible() ? - this.getContextNodeFactory2_0().buildOrmAssociationOverrideContainer(this, this.buildAssociationOverrideContainerOwner()) : - new GenericOrmAssociationOverrideContainer(this, null); - } - - protected OrmAssociationOverrideContainer.Owner buildAssociationOverrideContainerOwner() { - return new AssociationOverrideContainerOwner(); - } - - - // ********** embedded mappings ********** - - /** - * This is only to build the choices for a "mapped by" setting in a - * relationship mapping. JPA 2.0 does not support relationship mappings - * in an embedded ID class; so we only put this logic here. - */ - @Override - @SuppressWarnings("unchecked") - public Iterator allMappingNames() { - return this.isJpa2_0Compatible() ? - new CompositeIterator(super.allMappingNames(), this.allEmbeddableAttributeMappingNames()) : - super.allMappingNames(); - } - - protected Iterator allEmbeddableAttributeMappingNames() { - return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER); - } - - protected Iterator allOverridableAssociations() { - return (this.targetEmbeddable != null) ? - new SubIteratorWrapper(this.allOverridableAssociations_()) : - EmptyIterator.instance(); - } - - protected Iterator allOverridableAssociations_() { - return new FilteringIterator(this.targetEmbeddable.attributeMappings()) { - @Override - protected boolean accept(AttributeMapping attributeMapping) { - return attributeMapping.isOverridableAssociationMapping(); - } - }; - } - - @Override - public AttributeMapping resolveAttributeMapping(String attributeName) { - AttributeMapping resolvedMapping = super.resolveAttributeMapping(attributeName); - if (resolvedMapping != null) { - return resolvedMapping; - } - return this.isJpa2_0Compatible() ? this.resolveAttributeMapping_(attributeName) : null; - } - - protected AttributeMapping resolveAttributeMapping_(String attributeName) { - attributeName = this.unqualify(attributeName); - if (attributeName == null) { - return null; - } - // recurse into the embeddable mappings - for (AttributeMapping mapping : CollectionTools.iterable(this.embeddableAttributeMappings())) { - AttributeMapping resolvedMapping = mapping.resolveAttributeMapping(attributeName); - if (resolvedMapping != null) { - return resolvedMapping; - } - } - return null; - } - - - // ********** misc ********** - - public String getKey() { - return MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY; - } - - public int getXmlSequence() { - return 80; - } - - protected JavaEmbeddedMapping2_0 getJavaEmbeddedMapping2_0() { - return (JavaEmbeddedMapping2_0) this.getJavaEmbeddedMapping(); - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmEmbeddedMapping(this); - } - - public void addXmlAttributeMappingTo(Attributes xmlAttributes) { - xmlAttributes.getEmbeddeds().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) { - xmlAttributes.getEmbeddeds().remove(this.xmlAttributeMapping); - } - - protected JavaAssociationOverride getSpecifiedJavaAssociationOverrideNamed(String attributeName) { - JavaEmbeddedMapping2_0 javaMapping = this.getJavaEmbeddedMapping2_0(); - return (javaMapping == null) ? null : javaMapping.getAssociationOverrideContainer().getSpecifiedOverrideNamed(attributeName); - } - - @Override - public Relationship resolveOverriddenRelationship(String attributeName) { - return this.isJpa2_0Compatible() ? this.resolveOverriddenRelationship_(attributeName) : null; - } - - protected Relationship resolveOverriddenRelationship_(String attributeName) { - attributeName = this.unqualify(attributeName); - if (attributeName == null) { - return null; - } - AssociationOverride override = this.associationOverrideContainer.getSpecifiedOverrideNamed(attributeName); - // recurse into the target embeddable if necessary - return (override != null) ? override.getRelationship() : this.resolveOverriddenRelationshipInTargetEmbeddable(attributeName); - } - - protected Relationship resolveOverriddenRelationshipInTargetEmbeddable(String attributeName) { - return (this.targetEmbeddable == null) ? null : this.targetEmbeddable.resolveOverriddenRelationship(attributeName); - } - - - // ********** validation ********** - - @Override - protected void validateOverrides(List messages, IReporter reporter) { - super.validateOverrides(messages, reporter); - this.associationOverrideContainer.validate(messages, reporter); - } - - - // ********** association override container owner ********** - - protected class AssociationOverrideContainerOwner - implements OrmAssociationOverrideContainer.Owner - { - protected String getMappingName() { - return GenericOrmEmbeddedMapping.this.getName(); - } - - public OrmTypeMapping getTypeMapping() { - return GenericOrmEmbeddedMapping.this.getTypeMapping(); - } - - public TypeMapping getOverridableTypeMapping() { - return GenericOrmEmbeddedMapping.this.getTargetEmbeddable(); - } - - public Iterator allOverridableNames() { - TypeMapping typeMapping = this.getOverridableTypeMapping(); - return (typeMapping != null) ? typeMapping.allOverridableAssociationNames() : EmptyIterator.instance(); - } - - public EList getXmlOverrides() { - return GenericOrmEmbeddedMapping.this.getXmlAttributeMapping().getAssociationOverrides(); - } - - public Relationship resolveOverriddenRelationship(String attributeName) { - return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName); - } - - public boolean tableNameIsInvalid(String tableName) { - return this.getTypeMapping().tableNameIsInvalid(tableName); - } - - public Iterator candidateTableNames() { - return this.getTypeMapping().allAssociatedTableNames(); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return this.getTypeMapping().resolveDbTable(tableName); - } - - public String getDefaultTableName() { - return this.getTypeMapping().getPrimaryTableName(); - } - - public TextRange getValidationTextRange() { - return GenericOrmEmbeddedMapping.this.getValidationTextRange(); - } - - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new AssociationOverrideValidator(this.getPersistentAttribute(), (AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner owner, BaseColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), (AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) owner, (JoinColumnTextRangeResolver) textRangeResolver, new EntityTableDescriptionProvider()); - } - - public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); - } - - public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideInverseJoinColumnValidator(this.getPersistentAttribute(), override, column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); - } - - public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinTableValidator(this.getPersistentAttribute(), override, (JoinTable) table, textRangeResolver); - } - - protected OrmPersistentAttribute getPersistentAttribute() { - return GenericOrmEmbeddedMapping.this.getPersistentAttribute(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEntity.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEntity.java deleted file mode 100644 index 469d04a4e8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEntity.java +++ /dev/null @@ -1,82 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmEntity; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.NullOrmCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.Cacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.CacheableHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity; -import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0; - -public class GenericOrmEntity - extends AbstractOrmEntity -{ - // EclipseLink holds its cacheable in its caching - protected final OrmCacheable2_0 cacheable; - - - public GenericOrmEntity(OrmPersistentType parent, XmlEntity xmlEntity) { - super(parent, xmlEntity); - this.cacheable = this.buildCacheable(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.cacheable.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.cacheable.update(); - } - - - // ********** cacheable ********** - - public OrmCacheable2_0 getCacheable() { - return this.cacheable; - } - - protected OrmCacheable2_0 buildCacheable() { - return this.isJpa2_0Compatible() ? - this.getContextNodeFactory2_0().buildOrmCacheable(this) : - new NullOrmCacheable2_0(this); - } - - public boolean calculateDefaultCacheable() { - CacheableHolder2_0 javaEntity = (CacheableHolder2_0) this.getJavaTypeMappingForDefaults(); - if (javaEntity != null) { - return javaEntity.getCacheable().isCacheable(); - } - - Cacheable2_0 parentCacheable = this.getParentCacheable(); - return (parentCacheable != null) ? - parentCacheable.isCacheable() : - ((PersistenceUnit2_0) this.getPersistenceUnit()).calculateDefaultCacheable(); - } - - protected Cacheable2_0 getParentCacheable() { - CacheableHolder2_0 parentEntity = (CacheableHolder2_0) this.getParentEntity(); - return (parentEntity == null) ? null : parentEntity.getCacheable(); - } - - public XmlCacheable_2_0 getXmlCacheable() { - return this.getXmlTypeMapping(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java deleted file mode 100644 index d923aec695..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmEnumeratedConverter.java +++ /dev/null @@ -1,134 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.EnumType; -import org.eclipse.jpt.jpa.core.context.EnumeratedConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmEnumeratedConverter; -import org.eclipse.text.edits.ReplaceEdit; - -public class GenericOrmEnumeratedConverter - extends AbstractOrmConverter - implements OrmEnumeratedConverter -{ - protected EnumType specifiedEnumType; - protected EnumType defaultEnumType; - - - public GenericOrmEnumeratedConverter(OrmAttributeMapping parent) { - super(parent); - this.specifiedEnumType = this.buildSpecifiedEnumType(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedEnumType_(this.buildSpecifiedEnumType()); - } - - @Override - public void update() { - super.update(); - this.setDefaultEnumType(this.buildDefaultEnumType()); - } - - - // ********** enum type ********** - - public EnumType getEnumType() { - return (this.specifiedEnumType != null) ? this.specifiedEnumType : this.getDefaultEnumType(); - } - - public EnumType getSpecifiedEnumType() { - return this.specifiedEnumType; - } - - public void setSpecifiedEnumType(EnumType enumType) { - this.setSpecifiedEnumType_(enumType); - this.setXmlEnumerated(enumType); - } - - protected void setSpecifiedEnumType_(EnumType enumType) { - EnumType old = this.specifiedEnumType; - this.specifiedEnumType = enumType; - this.firePropertyChanged(SPECIFIED_ENUM_TYPE_PROPERTY, old, enumType); - } - - protected void setXmlEnumerated(EnumType enumType) { - this.getXmlConvertibleMapping().setEnumerated(EnumType.toOrmResourceModel(enumType)); - } - - protected EnumType buildSpecifiedEnumType() { - return EnumType.fromOrmResourceModel(this.getXmlConvertibleMapping().getEnumerated()); - } - - public EnumType getDefaultEnumType() { - return this.defaultEnumType; - } - - protected void setDefaultEnumType(EnumType enumType) { - EnumType old = this.defaultEnumType; - this.defaultEnumType = enumType; - this.firePropertyChanged(DEFAULT_ENUM_TYPE_PROPERTY, old, enumType); - } - - /** - * There is no default enum type in XML. - * If you specify the enumerated element, you must - * specify either {@link EnumType#ORDINAL} or - * {@link EnumType#STRING}. - */ - protected EnumType buildDefaultEnumType() { - return null; - } - - - // ********** misc ********** - - public Class getType() { - return EnumeratedConverter.class; - } - - public void initialize() { - this.specifiedEnumType = DEFAULT_ENUM_TYPE; - this.setXmlEnumerated(this.specifiedEnumType); - } - - - // ********** refactoring ********** - - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return EmptyIterable.instance(); - } - - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return EmptyIterable.instance(); - } - - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return EmptyIterable.instance(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return this.getXmlConvertibleMapping().getEnumeratedTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java deleted file mode 100644 index 107502d1fe..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratedValue.java +++ /dev/null @@ -1,194 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.GenerationType; -import org.eclipse.jpt.jpa.core.context.Generator; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratedValue; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratedValue; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml generated value - */ -public class GenericOrmGeneratedValue - extends AbstractOrmXmlContextNode - implements OrmGeneratedValue -{ - protected final XmlGeneratedValue xmlGeneratedValue; - - protected GenerationType specifiedStrategy; - protected GenerationType defaultStrategy; - - protected String specifiedGenerator; - protected String defaultGenerator; - - - public GenericOrmGeneratedValue(XmlContextNode parent, XmlGeneratedValue xmlGeneratedValue) { - super(parent); - this.xmlGeneratedValue = xmlGeneratedValue; - this.specifiedStrategy = this.buildSpecifiedStrategy(); - this.specifiedGenerator = xmlGeneratedValue.getGenerator(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedStrategy_(this.buildSpecifiedStrategy()); - this.setSpecifiedGenerator_(this.xmlGeneratedValue.getGenerator()); - } - - @Override - public void update() { - super.update(); - this.setDefaultStrategy(this.buildDefaultStrategy()); - this.setDefaultGenerator(this.buildDefaultGenerator()); - } - - - // ********** strategy ********** - - public GenerationType getStrategy() { - return (this.specifiedStrategy != null) ? this.specifiedStrategy : this.defaultStrategy; - } - - public GenerationType getSpecifiedStrategy() { - return this.specifiedStrategy; - } - - public void setSpecifiedStrategy(GenerationType strategy) { - this.setSpecifiedStrategy_(strategy); - this.xmlGeneratedValue.setStrategy(GenerationType.toOrmResourceModel(strategy)); - } - - protected void setSpecifiedStrategy_(GenerationType strategy) { - GenerationType old = this.specifiedStrategy; - this.specifiedStrategy = strategy; - this.firePropertyChanged(SPECIFIED_STRATEGY_PROPERTY, old, strategy); - } - - protected GenerationType buildSpecifiedStrategy() { - return GenerationType.fromOrmResourceModel(this.xmlGeneratedValue.getStrategy()); - } - - public GenerationType getDefaultStrategy() { - return this.defaultStrategy; - } - - protected void setDefaultStrategy(GenerationType strategy) { - GenerationType old = this.defaultStrategy; - this.defaultStrategy = strategy; - this.firePropertyChanged(DEFAULT_STRATEGY_PROPERTY, old, strategy); - } - - // TODO - protected GenerationType buildDefaultStrategy() { - return DEFAULT_STRATEGY; - } - - - // ********** generator ********** - - public String getGenerator() { - return (this.specifiedGenerator != null) ? this.specifiedGenerator : this.defaultGenerator; - } - - public String getSpecifiedGenerator() { - return this.specifiedGenerator; - } - - public void setSpecifiedGenerator(String generator) { - this.setSpecifiedGenerator_(generator); - this.xmlGeneratedValue.setGenerator(generator); - } - - protected void setSpecifiedGenerator_(String generator) { - String old = this.specifiedGenerator; - this.specifiedGenerator = generator; - this.firePropertyChanged(SPECIFIED_GENERATOR_PROPERTY, old, generator); - } - - public String getDefaultGenerator() { - return this.defaultGenerator; - } - - protected void setDefaultGenerator(String generator) { - String old = this.defaultGenerator; - this.defaultGenerator = generator; - this.firePropertyChanged(DEFAULT_GENERATOR_PROPERTY, old, generator); - } - - // TODO - protected String buildDefaultGenerator() { - return null; - } - - public TextRange getGeneratorTextRange() { - TextRange textRange = this.xmlGeneratedValue.getGeneratorTextRange(); - return textRange != null ? textRange : this.getValidationTextRange(); - } - - - // ********** misc ********** - - @Override - public XmlContextNode getParent() { - return (XmlContextNode) super.getParent(); - } - - public XmlGeneratedValue getXmlGeneratedValue() { - return this.xmlGeneratedValue; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - - String generator = this.getGenerator(); - if (generator == null) { - return; - } - - for (Iterator stream = this.getPersistenceUnit().generators(); stream.hasNext(); ) { - if (generator.equals(stream.next().getName())) { - return; - } - } - - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ID_MAPPING_UNRESOLVED_GENERATOR_NAME, - new String[] {generator}, - this.getParent(), - this.getGeneratorTextRange() - ) - ); - } - - public TextRange getValidationTextRange() { - TextRange validationTextRange = this.xmlGeneratedValue.getValidationTextRange(); - return (validationTextRange != null) ? validationTextRange : this.getParent().getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java deleted file mode 100644 index 7cca101c7a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmGeneratorContainer.java +++ /dev/null @@ -1,261 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.context.Generator; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmGenerator; -import org.eclipse.jpt.jpa.core.context.orm.OrmGeneratorContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator; -import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlGeneratorContainer; -import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericOrmGeneratorContainer - extends AbstractOrmXmlContextNode - implements OrmGeneratorContainer -{ - protected final XmlGeneratorContainer xmlGeneratorContainer; - - protected OrmSequenceGenerator sequenceGenerator; - - protected OrmTableGenerator tableGenerator; - - - public GenericOrmGeneratorContainer(XmlContextNode parent, XmlGeneratorContainer xmlGeneratorContainer) { - super(parent); - this.xmlGeneratorContainer = xmlGeneratorContainer; - this.sequenceGenerator = this.buildSequenceGenerator(); - this.tableGenerator = this.buildTableGenerator(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncSequenceGenerator(); - this.syncTableGenerator(); - } - - @Override - public void update() { - super.update(); - if (this.sequenceGenerator != null) { - this.sequenceGenerator.update(); - } - if (this.tableGenerator != null) { - this.tableGenerator.update(); - } - } - - - // ********** sequence generator ********** - - public OrmSequenceGenerator getSequenceGenerator() { - return this.sequenceGenerator; - } - - public OrmSequenceGenerator addSequenceGenerator() { - if (this.sequenceGenerator != null) { - throw new IllegalStateException("sequence generator already exists: " + this.sequenceGenerator); //$NON-NLS-1$ - } - XmlSequenceGenerator xmlGenerator = this.buildXmlSequenceGenerator(); - OrmSequenceGenerator generator = this.buildSequenceGenerator(xmlGenerator); - this.setSequenceGenerator_(generator); - this.xmlGeneratorContainer.setSequenceGenerator(xmlGenerator); - return generator; - } - - protected XmlSequenceGenerator buildXmlSequenceGenerator() { - return OrmFactory.eINSTANCE.createXmlSequenceGenerator(); - } - - public void removeSequenceGenerator() { - if (this.sequenceGenerator == null) { - throw new IllegalStateException("sequence generator does not exist"); //$NON-NLS-1$ - } - this.setSequenceGenerator_(null); - this.xmlGeneratorContainer.setSequenceGenerator(null); - } - - protected OrmSequenceGenerator buildSequenceGenerator() { - XmlSequenceGenerator xmlGenerator = this.getXmlSequenceGenerator(); - return (xmlGenerator == null) ? null : this.buildSequenceGenerator(xmlGenerator); - } - - protected XmlSequenceGenerator getXmlSequenceGenerator() { - return this.xmlGeneratorContainer.getSequenceGenerator(); - } - - protected OrmSequenceGenerator buildSequenceGenerator(XmlSequenceGenerator xmlSequenceGenerator) { - return this.getContextNodeFactory().buildOrmSequenceGenerator(this, xmlSequenceGenerator); - } - - protected void syncSequenceGenerator() { - XmlSequenceGenerator xmlGenerator = this.getXmlSequenceGenerator(); - if (xmlGenerator == null) { - if (this.sequenceGenerator != null) { - this.setSequenceGenerator_(null); - } - } else { - if ((this.sequenceGenerator != null) && (this.sequenceGenerator.getXmlGenerator() == xmlGenerator)) { - this.sequenceGenerator.synchronizeWithResourceModel(); - } else { - this.setSequenceGenerator_(this.buildSequenceGenerator(xmlGenerator)); - } - } - } - - protected void setSequenceGenerator_(OrmSequenceGenerator sequenceGenerator) { - OrmSequenceGenerator old = this.sequenceGenerator; - this.sequenceGenerator = sequenceGenerator; - this.firePropertyChanged(SEQUENCE_GENERATOR_PROPERTY, old, sequenceGenerator); - } - - - // ********** table generator ********** - - public OrmTableGenerator getTableGenerator() { - return this.tableGenerator; - } - - public OrmTableGenerator addTableGenerator() { - if (this.tableGenerator != null) { - throw new IllegalStateException("table generator already exists: " + this.tableGenerator); //$NON-NLS-1$ - } - XmlTableGenerator xmlGenerator = this.buildXmlTableGenerator(); - OrmTableGenerator generator = this.buildTableGenerator(xmlGenerator); - this.setTableGenerator_(generator); - this.xmlGeneratorContainer.setTableGenerator(xmlGenerator); - return generator; - } - - protected XmlTableGenerator buildXmlTableGenerator() { - return OrmFactory.eINSTANCE.createXmlTableGenerator(); - } - - public void removeTableGenerator() { - if (this.tableGenerator == null) { - throw new IllegalStateException("table generator does not exist"); //$NON-NLS-1$ - } - this.setTableGenerator_(null); - this.xmlGeneratorContainer.setTableGenerator(null); - } - - protected OrmTableGenerator buildTableGenerator() { - XmlTableGenerator xmlGenerator = this.getXmlTableGenerator(); - return (xmlGenerator == null) ? null : this.buildTableGenerator(xmlGenerator); - } - - protected XmlTableGenerator getXmlTableGenerator() { - return this.xmlGeneratorContainer.getTableGenerator(); - } - - protected OrmTableGenerator buildTableGenerator(XmlTableGenerator xmlTableGenerator) { - return this.getContextNodeFactory().buildOrmTableGenerator(this, xmlTableGenerator); - } - - protected void syncTableGenerator() { - XmlTableGenerator xmlGenerator = this.getXmlTableGenerator(); - if (xmlGenerator == null) { - if (this.tableGenerator != null) { - this.setTableGenerator_(null); - } - } else { - if ((this.tableGenerator != null) && (this.tableGenerator.getXmlGenerator() == xmlGenerator)) { - this.tableGenerator.synchronizeWithResourceModel(); - } else { - this.setTableGenerator_(this.buildTableGenerator(xmlGenerator)); - } - } - } - - protected void setTableGenerator_(OrmTableGenerator tableGenerator) { - OrmTableGenerator old = this.tableGenerator; - this.tableGenerator = tableGenerator; - this.firePropertyChanged(TABLE_GENERATOR_PROPERTY, old, tableGenerator); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateGenerators(messages); - } - - protected void validateGenerators(List messages) { - for (OrmGenerator localGenerator : this.getGenerators()) { - String name = localGenerator.getName(); - if (StringTools.stringIsEmpty(name)){ - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.GENERATOR_NAME_UNDEFINED, - new String[] {}, - localGenerator, - localGenerator.getNameTextRange() - ) - ); - } else { - List reportedNames = new ArrayList(); - for (Iterator globalGenerators = this.getPersistenceUnit().generators(); globalGenerators.hasNext(); ) { - if (localGenerator.duplicates(globalGenerators.next()) && !reportedNames.contains(name)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.GENERATOR_DUPLICATE_NAME, - new String[] {name}, - localGenerator, - localGenerator.getNameTextRange() - ) - ); - reportedNames.add(name); - } - } - } - } - } - - protected Iterable getGenerators() { - ArrayList generators = new ArrayList(); - this.addGeneratorsTo(generators); - return generators; - } - - protected void addGeneratorsTo(ArrayList generators) { - if (this.sequenceGenerator != null) { - generators.add(this.sequenceGenerator); - } - if (this.tableGenerator != null) { - generators.add(this.tableGenerator); - } - } - - public TextRange getValidationTextRange() { - return this.xmlGeneratorContainer.getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmIdMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmIdMapping.java deleted file mode 100644 index 958b87ddf5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmIdMapping.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmIdMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlId; - -/** - * orm.xml ID mapping - */ -public class GenericOrmIdMapping - extends AbstractOrmIdMapping -{ - public GenericOrmIdMapping(OrmPersistentAttribute parent, XmlId xmlMapping) { - super(parent, xmlMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java deleted file mode 100644 index 165d659ec5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinColumn.java +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmBaseColumn; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmJoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn; -import org.eclipse.jpt.jpa.db.Column; -import org.eclipse.jpt.jpa.db.Table; - -/** - * orm.xml join column - */ -public class GenericOrmJoinColumn - extends AbstractOrmBaseColumn - implements OrmJoinColumn -{ - /** @see org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn#AbstractOrmNamedColumn(XmlContextNode, org.eclipse.jpt.jpa.core.context.orm.OrmNamedColumn.Owner, org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn) */ - protected /* final */ XmlJoinColumn xmlColumn; // null for default join columns - - protected String specifiedReferencedColumnName; - protected String defaultReferencedColumnName; - - - public GenericOrmJoinColumn(XmlContextNode parent, OrmJoinColumn.Owner owner) { - this(parent, owner, null); - } - - public GenericOrmJoinColumn(XmlContextNode parent, OrmJoinColumn.Owner owner, XmlJoinColumn xmlColumn) { - super(parent, owner, xmlColumn); - this.specifiedReferencedColumnName = this.buildSpecifiedReferencedColumnName(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedReferencedColumnName_(this.buildSpecifiedReferencedColumnName()); - } - - @Override - public void update() { - super.update(); - this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName()); - } - - - // ********** XML column ********** - - @Override - public XmlJoinColumn getXmlColumn() { - return this.xmlColumn; - } - - @Override - protected void setXmlColumn(XmlJoinColumn xmlColumn) { - this.xmlColumn = xmlColumn; - } - - /** - * join columns are part of a collection; - * the 'join-column' element will be removed/added - * when the XML join column is removed from/added to - * the owner's collection - */ - @Override - protected XmlJoinColumn buildXmlColumn() { - throw new IllegalStateException("XML join column is missing"); //$NON-NLS-1$ - } - - /** - * @see #buildXmlColumn() - */ - @Override - protected void removeXmlColumn() { - // do nothing - } - - - // ********** referenced column name ********** - - public String getReferencedColumnName() { - return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName; - } - - public String getSpecifiedReferencedColumnName() { - return this.specifiedReferencedColumnName; - } - - public void setSpecifiedReferencedColumnName(String name) { - this.setSpecifiedReferencedColumnName_(name); - this.getXmlColumn().setReferencedColumnName(name); - } - - protected void setSpecifiedReferencedColumnName_(String name) { - String old = this.specifiedReferencedColumnName; - this.specifiedReferencedColumnName = name; - this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedReferencedColumnName() { - XmlJoinColumn joinColumn = this.getXmlColumn(); - return (joinColumn == null) ? null : joinColumn.getReferencedColumnName(); - } - - public String getDefaultReferencedColumnName() { - return this.defaultReferencedColumnName; - } - - protected void setDefaultReferencedColumnName(String name) { - String old = this.defaultReferencedColumnName; - this.defaultReferencedColumnName = name; - this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name); - } - - protected String buildDefaultReferencedColumnName() { - return MappingTools.buildJoinColumnDefaultReferencedColumnName(this.owner); - } - - - // ********** database stuff ********** - - public Table getReferencedColumnDbTable() { - return this.owner.getReferencedColumnDbTable(); - } - - protected Column getReferencedDbColumn() { - Table table = this.getReferencedColumnDbTable(); - return (table == null) ? null : table.getColumnForIdentifier(this.getReferencedColumnName()); - } - - public boolean referencedColumnIsResolved() { - return this.getReferencedDbColumn() != null; - } - - - // ********** misc ********** - - public void initializeFrom(ReadOnlyJoinColumn oldColumn) { - super.initializeFrom(oldColumn); - this.setSpecifiedReferencedColumnName(oldColumn.getSpecifiedReferencedColumnName()); - } - - public void initializeFromVirtual(ReadOnlyJoinColumn virtualColumn) { - super.initializeFromVirtual(virtualColumn); - this.setSpecifiedReferencedColumnName(virtualColumn.getReferencedColumnName()); - } - - public boolean isDefault() { - return this.owner.joinColumnIsDefault(this); - } - - @Override - protected String buildDefaultName() { - return MappingTools.buildJoinColumnDefaultName(this, this.owner); - } - - public TextRange getReferencedColumnNameTextRange() { - return this.getTextRange(this.xmlColumn.getReferencedColumnNameTextRange()); - } - - @Override - protected NamedColumnTextRangeResolver buildTextRangeResolver() { - return new OrmJoinColumnTextRangeResolver(this); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java deleted file mode 100644 index a1bfda698f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmJoinTable.java +++ /dev/null @@ -1,511 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTable; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinTable; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml join table - */ -public class GenericOrmJoinTable - extends GenericOrmReferenceTable - implements OrmJoinTable -{ - protected final Vector specifiedInverseJoinColumns = new Vector(); - protected final SpecifiedInverseJoinColumnContainerAdapter specifiedInverseJoinColumnContainerAdapter = new SpecifiedInverseJoinColumnContainerAdapter(); - protected final OrmJoinColumn.Owner inverseJoinColumnOwner; - - protected OrmJoinColumn defaultInverseJoinColumn; - - - public GenericOrmJoinTable(OrmJoinTableRelationshipStrategy parent, Owner owner) { - super(parent, owner); - this.inverseJoinColumnOwner = this.buildInverseJoinColumnOwner(); - this.initializeSpecifiedInverseJoinColumns(); - } - - @Override - protected OrmJoinColumn.Owner buildJoinColumnOwner() { - return new JoinColumnOwner(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncSpecifiedInverseJoinColumns(); - if (this.defaultInverseJoinColumn != null) { - this.defaultInverseJoinColumn.synchronizeWithResourceModel(); - } - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getSpecifiedInverseJoinColumns()); - this.updateDefaultInverseJoinColumn(); - } - - - // ********** XML table ********** - - @Override - protected XmlJoinTable getXmlTable() { - return this.getJoinStrategy().getXmlJoinTable(); - } - - @Override - protected XmlJoinTable buildXmlTable() { - return this.getJoinStrategy().buildXmlJoinTable(); - } - - @Override - protected void removeXmlTable() { - this.getJoinStrategy().removeXmlJoinTable(); - } - - - // ********** inverse join columns ********** - - public ListIterator inverseJoinColumns() { - return this.getInverseJoinColumns().iterator(); - } - - protected ListIterable getInverseJoinColumns() { - return this.hasSpecifiedInverseJoinColumns() ? this.getSpecifiedInverseJoinColumns() : this.getDefaultInverseJoinColumns(); - } - - public int inverseJoinColumnsSize() { - return this.hasSpecifiedInverseJoinColumns() ? this.specifiedInverseJoinColumnsSize() : this.getDefaultInverseJoinColumnsSize(); - } - - public void convertDefaultToSpecifiedInverseJoinColumn() { - MappingTools.convertJoinTableDefaultToSpecifiedInverseJoinColumn(this); - } - - - // ********** specified inverse join columns ********** - - public ListIterator specifiedInverseJoinColumns() { - return this.getSpecifiedInverseJoinColumns().iterator(); - } - - public ListIterable getSpecifiedInverseJoinColumns() { - return new LiveCloneListIterable(this.specifiedInverseJoinColumns); - } - - public int specifiedInverseJoinColumnsSize() { - return this.specifiedInverseJoinColumns.size(); - } - - public boolean hasSpecifiedInverseJoinColumns() { - return this.specifiedInverseJoinColumns.size() != 0; - } - - public OrmJoinColumn getSpecifiedInverseJoinColumn(int index) { - return this.specifiedInverseJoinColumns.get(index); - } - - public OrmJoinColumn addSpecifiedInverseJoinColumn() { - return this.addSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.size()); - } - - public OrmJoinColumn addSpecifiedInverseJoinColumn(int index) { - XmlJoinTable xmlTable = this.getXmlTableForUpdate(); - XmlJoinColumn xmlJoinColumn = this.buildXmlJoinColumn(); - OrmJoinColumn joinColumn = this.addSpecifiedInverseJoinColumn_(index, xmlJoinColumn); - xmlTable.getInverseJoinColumns().add(index, xmlJoinColumn); - return joinColumn; - } - - public void removeSpecifiedInverseJoinColumn(JoinColumn joinColumn) { - this.removeSpecifiedInverseJoinColumn(this.specifiedInverseJoinColumns.indexOf(joinColumn)); - } - - public void removeSpecifiedInverseJoinColumn(int index) { - this.removeSpecifiedInverseJoinColumn_(index); - this.getXmlTable().getInverseJoinColumns().remove(index); - this.removeXmlTableIfUnset(); - } - - protected void removeSpecifiedInverseJoinColumn_(int index) { - this.removeItemFromList(index, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST); - } - - public void moveSpecifiedInverseJoinColumn(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST); - this.getXmlTable().getInverseJoinColumns().move(targetIndex, sourceIndex); - } - - public void clearSpecifiedInverseJoinColumns() { - this.clearCollection(this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST); - this.getXmlTable().getInverseJoinColumns().clear(); - } - - protected void initializeSpecifiedInverseJoinColumns() { - for (XmlJoinColumn xmlJoinColumn : this.getXmlInverseJoinColumns()) { - this.specifiedInverseJoinColumns.add(this.buildInverseJoinColumn(xmlJoinColumn)); - } - } - - protected void syncSpecifiedInverseJoinColumns() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedInverseJoinColumnContainerAdapter); - } - - protected Iterable getXmlInverseJoinColumns() { - XmlJoinTable xmlTable = this.getXmlTable(); - return (xmlTable == null) ? - EmptyIterable.instance() : - // clone to reduce chance of concurrency problems - new LiveCloneIterable(xmlTable.getInverseJoinColumns()); - } - - protected void moveSpecifiedInverseJoinColumn_(int index, OrmJoinColumn joinColumn) { - this.moveItemInList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST); - } - - protected OrmJoinColumn addSpecifiedInverseJoinColumn_(int index, XmlJoinColumn xmlJoinColumn) { - OrmJoinColumn joinColumn = this.buildInverseJoinColumn(xmlJoinColumn); - this.addItemToList(index, joinColumn, this.specifiedInverseJoinColumns, SPECIFIED_INVERSE_JOIN_COLUMNS_LIST); - return joinColumn; - } - - protected void removeSpecifiedInverseJoinColumn_(OrmJoinColumn joinColumn) { - this.removeSpecifiedInverseJoinColumn_(this.specifiedInverseJoinColumns.indexOf(joinColumn)); - } - - /** - * specified inverse join column container adapter - */ - protected class SpecifiedInverseJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericOrmJoinTable.this.getSpecifiedInverseJoinColumns(); - } - public Iterable getResourceElements() { - return GenericOrmJoinTable.this.getXmlInverseJoinColumns(); - } - public XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) { - return contextElement.getXmlColumn(); - } - public void moveContextElement(int index, OrmJoinColumn element) { - GenericOrmJoinTable.this.moveSpecifiedInverseJoinColumn_(index, element); - } - public void addContextElement(int index, XmlJoinColumn resourceElement) { - GenericOrmJoinTable.this.addSpecifiedInverseJoinColumn_(index, resourceElement); - } - public void removeContextElement(OrmJoinColumn element) { - GenericOrmJoinTable.this.removeSpecifiedInverseJoinColumn_(element); - } - } - - protected OrmJoinColumn.Owner buildInverseJoinColumnOwner() { - return new InverseJoinColumnOwner(); - } - - - // ********** default inverse join column ********** - - public OrmJoinColumn getDefaultInverseJoinColumn() { - return this.defaultInverseJoinColumn; - } - - protected void setDefaultInverseJoinColumn(OrmJoinColumn joinColumn) { - OrmJoinColumn old = this.defaultInverseJoinColumn; - this.defaultInverseJoinColumn = joinColumn; - this.firePropertyChanged(DEFAULT_INVERSE_JOIN_COLUMN, old, joinColumn); - } - - protected ListIterable getDefaultInverseJoinColumns() { - return (this.defaultInverseJoinColumn != null) ? - new SingleElementListIterable(this.defaultInverseJoinColumn) : - EmptyListIterable.instance(); - } - - protected int getDefaultInverseJoinColumnsSize() { - return (this.defaultInverseJoinColumn == null) ? 0 : 1; - } - - protected void updateDefaultInverseJoinColumn() { - if (this.buildsDefaultInverseJoinColumn()) { - if (this.defaultInverseJoinColumn == null) { - this.setDefaultInverseJoinColumn(this.buildInverseJoinColumn(null)); - } else { - this.defaultInverseJoinColumn.update(); - } - } else { - this.setDefaultInverseJoinColumn(null); - } - } - - protected boolean buildsDefaultInverseJoinColumn() { - return ! this.hasSpecifiedInverseJoinColumns(); - } - - - // ********** misc ********** - - @Override - public OrmJoinTableRelationshipStrategy getParent() { - return (OrmJoinTableRelationshipStrategy) super.getParent(); - } - - protected OrmJoinTableRelationshipStrategy getJoinStrategy() { - return this.getParent(); - } - - @Override - protected String buildDefaultName() { - return this.getJoinStrategy().getJoinTableDefaultName(); - } - - public void initializeFrom(ReadOnlyJoinTable oldTable) { - super.initializeFrom(oldTable); - for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldTable.specifiedInverseJoinColumns())) { - this.addSpecifiedInverseJoinColumn().initializeFrom(joinColumn); - } - } - - public void initializeFromVirtual(ReadOnlyJoinTable virtualTable) { - super.initializeFromVirtual(virtualTable); - for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualTable.inverseJoinColumns())) { - this.addSpecifiedInverseJoinColumn().initializeFromVirtual(joinColumn); - } - } - - protected OrmJoinColumn buildInverseJoinColumn(XmlJoinColumn xmlJoinColumn) { - return this.getContextNodeFactory().buildOrmJoinColumn(this, this.inverseJoinColumnOwner, xmlJoinColumn); - } - - public RelationshipMapping getRelationshipMapping() { - return this.getJoinStrategy().getRelationship().getMapping(); - } - - public PersistentAttribute getPersistentAttribute() { - return this.getRelationshipMapping().getPersistentAttribute(); - } - - - // ********** validation ********** - - @Override - protected void validateJoinColumns(List messages, IReporter reporter) { - super.validateJoinColumns(messages, reporter); - this.validateJoinColumns(this.getInverseJoinColumns(), messages, reporter); - } - - public boolean validatesAgainstDatabase() { - return this.getJoinStrategy().validatesAgainstDatabase(); - } - - - // ********** join column owners ********** - - /** - * just a little common behavior - */ - protected abstract class AbstractJoinColumnOwner - implements OrmJoinColumn.Owner - { - protected AbstractJoinColumnOwner() { - super(); - } - - public TypeMapping getTypeMapping() { - return GenericOrmJoinTable.this.getJoinStrategy().getRelationship().getTypeMapping(); - } - - protected PersistentAttribute getPersistentAttribute() { - return GenericOrmJoinTable.this.getPersistentAttribute(); - } - - /** - * @see MappingTools#buildJoinColumnDefaultName(org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn, org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn.Owner) - */ - public String getDefaultColumnName() { - throw new UnsupportedOperationException(); - } - - /** - * If there is a specified table name it needs to be the same - * the default table name. the table is always the join table - */ - public boolean tableNameIsInvalid(String tableName) { - return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName); - } - - /** - * the join column can only be on the join table itself - */ - public Iterator candidateTableNames() { - return EmptyIterator.instance(); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return Tools.valuesAreEqual(GenericOrmJoinTable.this.getName(), tableName) ? - GenericOrmJoinTable.this.getDbTable() : - null; - } - - /** - * by default, the join column is, obviously, in the join table; - * not sure whether it can be anywhere else... - */ - public String getDefaultTableName() { - return GenericOrmJoinTable.this.getName(); - } - - public TextRange getValidationTextRange() { - return GenericOrmJoinTable.this.getValidationTextRange(); - } - - protected boolean isPersistentAttributeVirtual() { - return this.getPersistentAttribute().isVirtual(); - } - - protected String getPersistentAttributeName() { - return this.getPersistentAttribute().getName(); - } - - protected OrmJoinTableRelationshipStrategy getJoinStrategy() { - return GenericOrmJoinTable.this.getJoinStrategy(); - } - } - - - /** - * owner for "back-pointer" join columns; - * these point at the source/owning entity - */ - protected class JoinColumnOwner - extends AbstractJoinColumnOwner - { - protected JoinColumnOwner() { - super(); - } - - public Entity getRelationshipTarget() { - return this.getJoinStrategy().getRelationship().getEntity(); - } - - public String getAttributeName() { - return MappingTools.getTargetAttributeName(GenericOrmJoinTable.this.getRelationshipMapping()); - } - - @Override - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - org.eclipse.jpt.jpa.db.Table dbTable = super.resolveDbTable(tableName); - return (dbTable != null) ? dbTable : this.getTypeMapping().resolveDbTable(tableName); - } - - public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() { - return this.getTypeMapping().getPrimaryDbTable(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return GenericOrmJoinTable.this.defaultJoinColumn == joinColumn; - } - - public int joinColumnsSize() { - return GenericOrmJoinTable.this.joinColumnsSize(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return this.getJoinStrategy().buildJoinTableJoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver); - } - } - - - /** - * owner for "forward-pointer" join columns; - * these point at the target/inverse entity - */ - protected class InverseJoinColumnOwner - extends AbstractJoinColumnOwner - { - protected InverseJoinColumnOwner() { - super(); - } - - public Entity getRelationshipTarget() { - RelationshipMapping relationshipMapping = GenericOrmJoinTable.this.getRelationshipMapping(); - return (relationshipMapping == null) ? null : relationshipMapping.getResolvedTargetEntity(); - } - - public String getAttributeName() { - RelationshipMapping relationshipMapping = GenericOrmJoinTable.this.getRelationshipMapping(); - return (relationshipMapping == null) ? null : relationshipMapping.getName(); - } - - @Override - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - org.eclipse.jpt.jpa.db.Table dbTable = super.resolveDbTable(tableName); - if (dbTable != null) { - return dbTable; - } - Entity relationshipTarget = this.getRelationshipTarget(); - return (relationshipTarget == null) ? null : relationshipTarget.resolveDbTable(tableName); - } - - public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() { - Entity relationshipTarget = this.getRelationshipTarget(); - return (relationshipTarget == null) ? null : relationshipTarget.getPrimaryDbTable(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return GenericOrmJoinTable.this.defaultInverseJoinColumn == joinColumn; - } - - public int joinColumnsSize() { - return GenericOrmJoinTable.this.inverseJoinColumnsSize(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return this.getJoinStrategy().buildJoinTableInverseJoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java deleted file mode 100644 index 324ceb7bff..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmLobConverter.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.LobConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmLobConverter; -import org.eclipse.text.edits.ReplaceEdit; - -public class GenericOrmLobConverter - extends AbstractOrmConverter - implements OrmLobConverter -{ - public GenericOrmLobConverter(OrmAttributeMapping parent) { - super(parent); - } - - - // ********** misc ********** - - public Class getType() { - return LobConverter.class; - } - - public void initialize() { - this.getXmlConvertibleMapping().setLob(true); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return this.getXmlConvertibleMapping().getLobTextRange(); - } - - - // ********** refactoring ********** - - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return EmptyIterable.instance(); - } - - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return EmptyIterable.instance(); - } - - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return EmptyIterable.instance(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java deleted file mode 100644 index 6a002b3d2e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToManyMapping.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmManyToManyMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToMany; - -public class GenericOrmManyToManyMapping - extends AbstractOrmManyToManyMapping -{ - public GenericOrmManyToManyMapping(OrmPersistentAttribute parent, XmlManyToMany xmlMapping) { - super(parent, xmlMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java deleted file mode 100644 index 740c4e01e3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmManyToOneMapping.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmManyToOneMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlManyToOne; - -public class GenericOrmManyToOneMapping - extends AbstractOrmManyToOneMapping -{ - public GenericOrmManyToOneMapping(OrmPersistentAttribute parent, XmlManyToOne xmlMapping) { - super(parent, xmlMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java deleted file mode 100644 index 45014549d5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmMappedSuperclass.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmMappedSuperclass; -import org.eclipse.jpt.jpa.core.resource.orm.XmlMappedSuperclass; - -/** - * orm.xml mapped superclass - */ -public class GenericOrmMappedSuperclass - extends AbstractOrmMappedSuperclass -{ - public GenericOrmMappedSuperclass(OrmPersistentType parent, XmlMappedSuperclass resourceMapping) { - super(parent, resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java deleted file mode 100644 index ffc4ce61b8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedNativeQuery.java +++ /dev/null @@ -1,85 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmNamedNativeQuery; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery; - -/** - * orm.xml named native query - */ -public class GenericOrmNamedNativeQuery - extends AbstractOrmQuery - implements OrmNamedNativeQuery -{ - protected String resultClass; - - protected String resultSetMapping; - - - public GenericOrmNamedNativeQuery(XmlContextNode parent, XmlNamedNativeQuery xmlNamedNativeQuery) { - super(parent, xmlNamedNativeQuery); - this.resultClass = xmlNamedNativeQuery.getResultClass(); - this.resultSetMapping = xmlNamedNativeQuery.getResultSetMapping(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setResultClass_(this.xmlQuery.getResultClass()); - this.setResultSetMapping_(this.xmlQuery.getResultSetMapping()); - } - - - // ********** result class ********** - - public String getResultClass() { - return this.resultClass; - } - - public void setResultClass(String resultClass) { - this.setResultClass_(resultClass); - this.xmlQuery.setResultClass(resultClass); - } - - protected void setResultClass_(String resultClass) { - String old = this.resultClass; - this.resultClass = resultClass; - this.firePropertyChanged(RESULT_CLASS_PROPERTY, old, resultClass); - } - - public char getResultClassEnclosingTypeSeparator() { - return '$'; - } - - - // ********** result set mapping ********** - - public String getResultSetMapping() { - return this.resultSetMapping; - } - - public void setResultSetMapping(String resultSetMapping) { - this.setResultSetMapping_(resultSetMapping); - this.xmlQuery.setResultSetMapping(resultSetMapping); - } - - protected void setResultSetMapping_(String resultSetMapping) { - String old = this.resultSetMapping; - this.resultSetMapping = resultSetMapping; - this.firePropertyChanged(RESULT_SET_MAPPING_PROPERTY, old, resultSetMapping); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java deleted file mode 100644 index 35ef25259f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNamedQuery.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery; - -/** - * orm.xml named query - */ -public class GenericOrmNamedQuery - extends AbstractOrmQuery - implements OrmNamedQuery -{ - public GenericOrmNamedQuery(XmlContextNode parent, XmlNamedQuery resourceNamedQuery) { - super(parent, resourceNamedQuery); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java deleted file mode 100644 index 374f84e338..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmNullAttributeMapping.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping; - -/** - * orm.xml null attribute mapping - */ -public class GenericOrmNullAttributeMapping - extends AbstractOrmAttributeMapping -{ - public GenericOrmNullAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping xmlMapping) { - super(parent, xmlMapping); - } - - public String getKey() { - return null; - } - - public int getXmlSequence() { - return -1; - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public void addXmlAttributeMappingTo(Attributes resourceAttributes) { - throw new UnsupportedOperationException(); - } - - public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) { - throw new UnsupportedOperationException(); - } - - // ********** metamodel ********** - - @Override - public MetamodelField getMetamodelField() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java deleted file mode 100644 index 4fdad7ce7b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToManyMapping.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmOneToManyMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToMany; - -public class GenericOrmOneToManyMapping - extends AbstractOrmOneToManyMapping -{ - public GenericOrmOneToManyMapping(OrmPersistentAttribute parent, XmlOneToMany xmlMapping) { - super(parent, xmlMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java deleted file mode 100644 index e89cef7e89..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOneToOneMapping.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmOneToOneMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOneToOne; - -/** - * orm.xml 1:1 mapping - */ -public class GenericOrmOneToOneMapping - extends AbstractOrmOneToOneMapping -{ - public GenericOrmOneToOneMapping(OrmPersistentAttribute parent, XmlOneToOne xmlMapping) { - super(parent, xmlMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java deleted file mode 100644 index a86fd056d3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOrderable.java +++ /dev/null @@ -1,452 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.List; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.OrderColumnValidator; -import org.eclipse.jpt.jpa.core.jpa2.context.OrderColumn2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderColumn2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderable2_0; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOrderColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOrderable; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml ordering - *

- * NB: Setting any flag to false (or setting the - * specified "order by" to null) can be a bit unpredictable. The - * intent is to set a flag to true (or set the specified "order by" - * to a non-null value). - *

- * (JPA 2.0 only) NB: If both the "order-by" and the - * "order-column" elements are present (which is prohibited by the JPA spec), - * both are ignored. - */ -public class GenericOrmOrderable - extends AbstractOrmXmlContextNode - implements OrmOrderable2_0 -{ - protected String specifiedOrderBy; - protected boolean noOrdering = false; - protected boolean pkOrdering = false; - protected boolean customOrdering = false; - - // JPA 2.0 - protected final Owner owner; // this is null for JPA 1.0 mappings - protected boolean orderColumnOrdering = false; - protected final OrmOrderColumn2_0 orderColumn; // this is null for JPA 1.0 mappings - - - /** - * JPA 1.0 - */ - public GenericOrmOrderable(OrmAttributeMapping parent) { - this(parent, null); - } - - /** - * JPA 2.0 - */ - public GenericOrmOrderable(OrmAttributeMapping parent, Owner owner) { - super(parent); - - this.specifiedOrderBy = this.buildSpecifiedOrderBy(); - this.noOrdering = this.buildNoOrdering(); - this.pkOrdering = this.buildPkOrdering(); - this.customOrdering = this.buildCustomOrdering(); - - this.owner = owner; - this.orderColumnOrdering = this.buildOrderColumnOrdering(); - this.orderColumn = this.buildOrderColumn(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - - this.setSpecifiedOrderBy_(this.buildSpecifiedOrderBy()); - this.setNoOrdering_(this.buildNoOrdering()); - this.setPkOrdering_(this.buildPkOrdering()); - this.setCustomOrdering_(this.buildCustomOrdering()); - - this.setOrderColumnOrdering_(this.buildOrderColumnOrdering()); - if (this.orderColumn != null) { - this.orderColumn.synchronizeWithResourceModel(); - } - } - - @Override - public void update() { - super.update(); - if (this.orderColumn != null) { - this.orderColumn.update(); - } - } - - - // ********** specified order by ********** - - public String getSpecifiedOrderBy() { - return this.specifiedOrderBy; - } - - public void setSpecifiedOrderBy(String orderBy) { - if (orderBy != null) { - this.setSpecifiedOrderBy_(orderBy); - this.setNoOrdering_(false); - this.setPkOrdering_(orderBy.length() == 0); - this.setCustomOrdering_(orderBy.length() != 0); - this.setOrderColumnOrdering_(false); - - this.removeXmlOrderColumn(); - this.getXmlOrderable().setOrderBy(orderBy); - } else { - this.setNoOrdering(true); // hmmm... - } - } - - protected void setSpecifiedOrderBy_(String orderBy) { - String old = this.specifiedOrderBy; - this.specifiedOrderBy = orderBy; - this.firePropertyChanged(SPECIFIED_ORDER_BY_PROPERTY, old, orderBy); - } - - protected String buildSpecifiedOrderBy() { - if (this.xmlOrderColumnIsPresent()) { - return null; - } - return this.getXmlOrderBy(); - } - - - // ********** no ordering ********** - - public boolean isNoOrdering() { - return this.noOrdering; - } - - public void setNoOrdering(boolean noOrdering) { - if (noOrdering) { - this.setSpecifiedOrderBy_(null); - this.setNoOrdering_(true); - this.setPkOrdering_(false); - this.setCustomOrdering_(false); - this.setOrderColumnOrdering_(false); - - this.removeXmlOrderColumn(); - this.getXmlOrderable().setOrderBy(null); - } else { - this.setPkOrdering(true); // hmmm... - } - } - - protected void setNoOrdering_(boolean noOrdering) { - boolean old = this.noOrdering; - this.noOrdering = noOrdering; - this.firePropertyChanged(NO_ORDERING_PROPERTY, old, noOrdering); - } - - protected boolean buildNoOrdering() { - return this.isJpa2_0Compatible() ? this.buildNoOrdering2_0() : this.buildNoOrdering1_0(); - } - - /** - * both elements are missing or both are present - */ - protected boolean buildNoOrdering2_0() { - boolean orderByMissing = (this.getXmlOrderBy() == null); - boolean orderByPresent = ! orderByMissing; - boolean orderColumnMissing = (this.getXmlOrderColumn() == null); - boolean orderColumnPresent = ! orderColumnMissing; - return (orderByMissing && orderColumnMissing) || (orderByPresent && orderColumnPresent); - } - - /** - * the order-by element is missing - */ - protected boolean buildNoOrdering1_0() { - return this.getXmlOrderBy() == null; - } - - - // ********** pk ordering ********** - - public boolean isPkOrdering() { - return this.pkOrdering; - } - - public void setPkOrdering(boolean pkOrdering) { - if (pkOrdering) { - this.setSpecifiedOrderBy(""); //$NON-NLS-1$ - } else { - this.setNoOrdering(true); // hmmm... - } - } - - protected void setPkOrdering_(boolean pkOrdering) { - boolean old = this.pkOrdering; - this.pkOrdering = pkOrdering; - this.firePropertyChanged(PK_ORDERING_PROPERTY, old, pkOrdering); - } - - /** - * the order-by element is present but no value specified - */ - protected boolean buildPkOrdering() { - if (this.xmlOrderColumnIsPresent()) { - return false; - } - String xmlOrderBy = this.getXmlOrderBy(); - return (xmlOrderBy != null) && (xmlOrderBy.length() == 0); - } - - - // ********** custom ordering ********** - - public boolean isCustomOrdering() { - return this.customOrdering; - } - - /** - * Unfortunately, setting the "custom ordering" flag directly is a bit hacky: - * The "specified order-by" is initially set to an empty string, which is - * the same as a "primary key ordering" state.... - */ - public void setCustomOrdering(boolean customOrdering) { - if (customOrdering) { - this.setSpecifiedOrderBy_(""); // hmmm... //$NON-NLS-1$ - this.setNoOrdering_(false); - this.setPkOrdering_(false); - this.setCustomOrdering_(true); - this.setOrderColumnOrdering_(false); - - this.removeXmlOrderColumn(); - this.getXmlOrderable().setOrderBy(""); //$NON-NLS-1$ - } else { - this.setNoOrdering(true); // hmmm... - } - } - - protected void setCustomOrdering_(boolean customOrdering) { - boolean old = this.customOrdering; - this.customOrdering = customOrdering; - this.firePropertyChanged(CUSTOM_ORDERING_PROPERTY, old, customOrdering); - } - - /** - * the order-by element is present and it has a specified value - */ - protected boolean buildCustomOrdering() { - if (this.xmlOrderColumnIsPresent()) { - return false; - } - String xmlOrderBy = this.getXmlOrderBy(); - return (xmlOrderBy != null) && (xmlOrderBy.length() != 0); - } - - - // ********** order column ordering ********** - - public boolean isOrderColumnOrdering() { - return this.orderColumnOrdering; - } - - public void setOrderColumnOrdering(boolean orderColumnOrdering) { - if (orderColumnOrdering) { - this.setSpecifiedOrderBy_(null); - this.setNoOrdering_(false); - this.setPkOrdering_(false); - this.setCustomOrdering_(false); - this.setOrderColumnOrdering_(true); - - this.getXmlOrderable().setOrderBy(null); - this.buildXmlOrderColumn(); - } else { - this.setNoOrdering(true); // hmmm... - } - } - - protected void setOrderColumnOrdering_(boolean orderColumnOrdering) { - boolean old = this.orderColumnOrdering; - this.orderColumnOrdering = orderColumnOrdering; - this.firePropertyChanged(ORDER_COLUMN_ORDERING_PROPERTY, old, orderColumnOrdering); - } - - /** - * JPA 2.0 only; - * the order-column element is present and - * the order-by element is missing - */ - protected boolean buildOrderColumnOrdering() { - return this.xmlOrderColumnIsPresent() && - (this.getXmlOrderBy() == null); - } - - - // ********** order column ********** - - public OrmOrderColumn2_0 getOrderColumn() { - return this.orderColumn; - } - - /** - * JPA 2.0 only - */ - protected OrmOrderColumn2_0 buildOrderColumn() { - return this.isJpa2_0Compatible() ? this.buildOrderColumn_() : null; - } - - protected OrmOrderColumn2_0 buildOrderColumn_() { - return this.getContextNodeFactory2_0().buildOrmOrderColumn(this, new OrderColumnOwner()); - } - - - // ********** xml order by ********** - - protected String getXmlOrderBy() { - return this.getXmlOrderable().getOrderBy(); - } - - - // ********** xml order column ********** - - protected XmlOrderColumn getXmlOrderColumn() { - return this.getXmlOrderable().getOrderColumn(); - } - - /** - * NB: Only return true for JPA 2.0 mappings. - */ - protected boolean xmlOrderColumnIsPresent() { - return this.isJpa2_0Compatible() && (this.getXmlOrderColumn() != null); - } - - protected XmlOrderColumn buildXmlOrderColumn() { - XmlOrderColumn xmlColumn = OrmFactory.eINSTANCE.createXmlOrderColumn(); - GenericOrmOrderable.this.getXmlOrderable().setOrderColumn(xmlColumn); - return xmlColumn; - } - - protected void removeXmlOrderColumn() { - if (this.xmlOrderColumnIsPresent()) { - this.getXmlOrderable().setOrderColumn(null); - } - } - - - // ********** misc ********** - - @Override - public OrmAttributeMapping getParent() { - return (OrmAttributeMapping) super.getParent(); - } - - protected OrmAttributeMapping getAttributeMapping() { - return this.getParent(); - } - - protected OrmPersistentAttribute getPersistentAttribute() { - return this.getAttributeMapping().getPersistentAttribute(); - } - - protected XmlOrderable getXmlOrderable() { - return (XmlOrderable) this.getAttributeMapping().getXmlAttributeMapping(); - } - - // JPA 2.0 - public String getDefaultTableName() { - return this.owner.getTableName(); - } - - // JPA 2.0 - protected Table resolveDbTable(String tableName) { - return this.owner.resolveDbTable(tableName); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - TextRange textRange = this.getXmlOrderable().getValidationTextRange(); - return (textRange != null) ? textRange : this.getAttributeMapping().getValidationTextRange(); - } - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - // order-column and order-by both specified is handled with schema validation - if (this.orderColumnOrdering) { - // TODO validation message if type is not List - this.orderColumn.validate(messages, reporter); - } - } - - - // ********** order column owner (JPA 2.0) ********** - - protected class OrderColumnOwner - implements OrmOrderColumn2_0.Owner - { - public String getDefaultTableName() { - return GenericOrmOrderable.this.getDefaultTableName(); - } - - public Table resolveDbTable(String tableName) { - return GenericOrmOrderable.this.resolveDbTable(tableName); - } - - public String getDefaultColumnName() { - return this.getPersistentAttribute().getName() + "_ORDER"; //$NON-NLS-1$ - } - - public TypeMapping getTypeMapping() { - return this.getPersistentAttribute().getOwningTypeMapping(); - } - - public TextRange getValidationTextRange() { - return GenericOrmOrderable.this.getValidationTextRange(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new OrderColumnValidator(this.getPersistentAttribute(), (OrderColumn2_0) column, textRangeResolver); - } - - public XmlOrderColumn getXmlColumn() { - return GenericOrmOrderable.this.getXmlOrderColumn(); - } - - public XmlOrderColumn buildXmlColumn() { - return GenericOrmOrderable.this.buildXmlOrderColumn(); - } - - public void removeXmlColumn() { - GenericOrmOrderable.this.removeXmlOrderColumn(); - } - - protected OrmPersistentAttribute getPersistentAttribute() { - return GenericOrmOrderable.this.getPersistentAttribute(); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java deleted file mode 100644 index f669f9864d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmOverrideRelationship.java +++ /dev/null @@ -1,249 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.List; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.MappedByRelationship; -import org.eclipse.jpt.jpa.core.context.OverrideRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyOverrideRelationship; -import org.eclipse.jpt.jpa.core.context.ReadOnlyRelationship; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmOverrideJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.orm.NullOrmJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmOverrideJoinTableRelationshipStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOverrideRelationship2_0; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericOrmOverrideRelationship - extends AbstractOrmXmlContextNode - implements OrmOverrideRelationship2_0 -{ - protected OrmRelationshipStrategy strategy; - - protected final OrmJoinColumnRelationshipStrategy joinColumnStrategy; - - // JPA 2.0 - protected final OrmJoinTableRelationshipStrategy joinTableStrategy; - - - public GenericOrmOverrideRelationship(OrmAssociationOverride parent) { - super(parent); - this.joinColumnStrategy = this.buildJoinColumnStrategy(); - this.joinTableStrategy = this.buildJoinTableStrategy(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.joinColumnStrategy.synchronizeWithResourceModel(); - this.joinTableStrategy.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.setStrategy(this.buildStrategy()); - this.joinColumnStrategy.update(); - this.joinTableStrategy.update(); - } - - - // ********** strategy ********** - - public OrmRelationshipStrategy getStrategy() { - return this.strategy; - } - - protected void setStrategy(OrmRelationshipStrategy strategy) { - OrmRelationshipStrategy old = this.strategy; - this.strategy = strategy; - this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy); - } - - protected OrmRelationshipStrategy buildStrategy() { - if (this.isJpa2_0Compatible()) { - if (this.joinColumnStrategy.hasSpecifiedJoinColumns()) { - return this.joinColumnStrategy; - } - return this.joinTableStrategy; - } - return this.joinColumnStrategy; - } - - - // ********** join column strategy ********** - - public OrmJoinColumnRelationshipStrategy getJoinColumnStrategy() { - return this.joinColumnStrategy; - } - - public boolean strategyIsJoinColumn() { - return this.strategy == this.joinColumnStrategy; - } - - public void setStrategyToJoinColumn() { - this.joinColumnStrategy.addStrategy(); - this.joinTableStrategy.removeStrategy(); - } - - public boolean mayHaveDefaultJoinColumn() { - return false; - } - - protected OrmJoinColumnRelationshipStrategy buildJoinColumnStrategy() { - return new GenericOrmOverrideJoinColumnRelationshipStrategy(this); - } - - - // ********** join table strategy ********** - - public OrmJoinTableRelationshipStrategy getJoinTableStrategy() { - return this.joinTableStrategy; - } - - public boolean strategyIsJoinTable() { - return this.strategy == this.joinTableStrategy; - } - - public void setStrategyToJoinTable() { - this.joinTableStrategy.addStrategy(); - this.joinColumnStrategy.removeStrategy(); - } - - public boolean mayHaveDefaultJoinTable() { - return false; - } - - protected OrmJoinTableRelationshipStrategy buildJoinTableStrategy() { - return this.isJpa2_0Compatible() ? - new GenericOrmOverrideJoinTableRelationshipStrategy2_0(this) : - new NullOrmJoinTableRelationshipStrategy(this); - } - - - // ********** conversions ********** - - public void initializeFrom(ReadOnlyRelationship oldRelationship) { - oldRelationship.initializeOn(this); - } - - public void initializeOn(Relationship newRelationship) { - newRelationship.initializeFromJoinTableRelationship(this); - newRelationship.initializeFromJoinColumnRelationship(this); - } - - public void initializeFromMappedByRelationship(MappedByRelationship oldRelationship) { - // NOP - } - - public void initializeFromJoinTableRelationship(ReadOnlyJoinTableRelationship oldRelationship) { - this.joinTableStrategy.initializeFrom(oldRelationship.getJoinTableStrategy()); - } - - public void initializeFromJoinColumnRelationship(ReadOnlyJoinColumnRelationship oldRelationship) { - this.joinColumnStrategy.initializeFrom(oldRelationship.getJoinColumnStrategy()); - } - - public void initializeFromVirtual(ReadOnlyOverrideRelationship virtualRelationship) { - virtualRelationship.initializeOnSpecified(this); - } - - public void initializeOnSpecified(OverrideRelationship specifiedRelationship) { - throw new UnsupportedOperationException(); - } - - public void initializeFromVirtualJoinTableRelationship(ReadOnlyJoinTableRelationship virtualRelationship) { - this.joinTableStrategy.initializeFromVirtual(virtualRelationship.getJoinTableStrategy()); - } - - public void initializeFromVirtualJoinColumnRelationship(ReadOnlyJoinColumnRelationship virtualRelationship) { - this.joinColumnStrategy.initializeFromVirtual(virtualRelationship.getJoinColumnStrategy()); - } - - - // ********** misc ********** - - @Override - public OrmAssociationOverride getParent() { - return (OrmAssociationOverride) super.getParent(); - } - - public OrmAssociationOverride getAssociationOverride() { - return this.getParent(); - } - - public XmlAssociationOverride getXmlContainer() { - return this.getAssociationOverride().getXmlOverride(); - } - - public TypeMapping getTypeMapping() { - return this.getAssociationOverride().getContainer().getTypeMapping(); - } - - public Entity getEntity() { - TypeMapping typeMapping = this.getTypeMapping(); - return (typeMapping instanceof Entity) ? (Entity) typeMapping : null; - } - - public boolean isVirtual() { - return false; - } - - public RelationshipMapping getMapping() { - return this.getAssociationOverride().getMapping(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return this.getAssociationOverride().getValidationTextRange(); - } - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.joinColumnStrategy.validate(messages, reporter); - this.joinTableStrategy.validate(messages, reporter); - } - - public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return this.getAssociationOverride().getContainer().buildJoinTableJoinColumnValidator(this.getAssociationOverride(), column, owner, textRangeResolver); - } - - public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return this.getAssociationOverride().getContainer().buildJoinTableInverseJoinColumnValidator(this.getAssociationOverride(), column, owner, textRangeResolver); - } - - public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) { - return this.getAssociationOverride().getContainer().buildTableValidator(this.getAssociationOverride(), table, textRangeResolver); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java deleted file mode 100644 index 7ff900e4d1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitDefaults.java +++ /dev/null @@ -1,344 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitMetadata; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistenceUnitDefaults2_0; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitDefaults; -import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata; -import org.eclipse.jpt.jpa.db.Catalog; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.SchemaContainer; - -/** - * orm.xml file - *
- * persistence-unit-defaults element - */ -public class GenericOrmPersistenceUnitDefaults - extends AbstractOrmXmlContextNode - implements OrmPersistenceUnitDefaults2_0 -{ - protected AccessType access; - - protected String specifiedCatalog; - protected String defaultCatalog; - - protected String specifiedSchema; - protected String defaultSchema; - - protected boolean cascadePersist; - - protected boolean delimitedIdentifiers; - - - // ********** constructor/initialization ********** - - public GenericOrmPersistenceUnitDefaults(OrmPersistenceUnitMetadata parent) { - super(parent); - this.access = this.buildAccess(); - this.specifiedCatalog = this.buildSpecifiedCatalog(); - this.specifiedSchema = this.buildSpecifiedSchema(); - this.cascadePersist = this.buildCascadePersist(); - this.delimitedIdentifiers = this.buildDelimitedIdentifiers(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setAccess_(this.buildAccess()); - this.setSpecifiedCatalog_(this.buildSpecifiedCatalog()); - this.setSpecifiedSchema_(this.buildSpecifiedSchema()); - this.setCascadePersist_(this.buildCascadePersist()); - this.setDelimitedIdentifiers_(this.buildDelimitedIdentifiers()); - } - - @Override - public void update() { - super.update(); - this.setDefaultCatalog(this.buildDefaultCatalog()); - this.setDefaultSchema(this.buildDefaultSchema()); - } - - - // ********** access ********** - - public AccessType getAccess() { - return this.access; - } - - public void setAccess(AccessType access) { - if (this.valuesAreDifferent(this.access, access)) { - XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaultsForUpdate(); - this.setAccess_(access); - xmlDefaults.setAccess(AccessType.toOrmResourceModel(access)); - this.removeXmlDefaultsIfUnset(); - } - } - - protected void setAccess_(AccessType access) { - AccessType old = this.access; - this.access = access; - this.firePropertyChanged(ACCESS_PROPERTY, old, access); - } - - protected AccessType buildAccess() { - XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults(); - return (xmlDefaults == null) ? null : AccessType.fromOrmResourceModel(xmlDefaults.getAccess()); - } - - - // ********** schema container ********** - - /** - * If we don't have a catalog (i.e. we don't even have a default catalog), - * then the database probably does not support catalogs; and we need to - * get the schema directly from the database. - */ - public SchemaContainer getDbSchemaContainer() { - String catalog = this.getCatalog(); - return (catalog != null) ? this.resolveDbCatalog(catalog) : this.getDatabase(); - } - - - // ********** catalog ********** - - public String getCatalog() { - return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog; - } - - public String getSpecifiedCatalog() { - return this.specifiedCatalog; - } - - public void setSpecifiedCatalog(String catalog) { - if (this.valuesAreDifferent(this.specifiedCatalog, catalog)) { - XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaultsForUpdate(); - this.setSpecifiedCatalog_(catalog); - xmlDefaults.setCatalog(catalog); - this.removeXmlDefaultsIfUnset(); - } - } - - protected void setSpecifiedCatalog_(String catalog) { - String old = this.specifiedCatalog; - this.specifiedCatalog = catalog; - this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog); - } - - protected String buildSpecifiedCatalog() { - XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults(); - return (xmlDefaults == null) ? null : xmlDefaults.getCatalog(); - } - - public String getDefaultCatalog() { - return this.defaultCatalog; - } - - protected void setDefaultCatalog(String catalog) { - String old = this.defaultCatalog; - this.defaultCatalog = catalog; - this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog); - } - - protected String buildDefaultCatalog() { - return this.getJpaProject().getDefaultCatalog(); - } - - /** - * If we don't have a catalog (i.e. we don't even have a default - * catalog), then the database probably does not support catalogs. - */ - public Catalog getDbCatalog() { - String catalog = this.getCatalog(); - return (catalog == null) ? null : this.resolveDbCatalog(catalog); - } - - - // ********** schema ********** - - public String getSchema() { - return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema; - } - - public String getSpecifiedSchema() { - return this.specifiedSchema; - } - - public void setSpecifiedSchema(String schema) { - if (this.valuesAreDifferent(this.specifiedSchema, schema)) { - XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaultsForUpdate(); - this.setSpecifiedSchema_(schema); - xmlDefaults.setSchema(schema); - this.removeXmlDefaultsIfUnset(); - } - } - - protected void setSpecifiedSchema_(String schema) { - String old = this.specifiedSchema; - this.specifiedSchema = schema; - this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema); - } - - protected String buildSpecifiedSchema() { - XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults(); - return (xmlDefaults == null) ? null : xmlDefaults.getSchema(); - } - - public String getDefaultSchema() { - return this.defaultSchema; - } - - protected void setDefaultSchema(String schema) { - String old = this.defaultSchema; - this.defaultSchema = schema; - this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema); - } - - protected String buildDefaultSchema() { - return this.getJpaProject().getDefaultSchema(); - } - - public Schema getDbSchema() { - SchemaContainer dbSchemaContainer = this.getDbSchemaContainer(); - return (dbSchemaContainer == null) ? null : dbSchemaContainer.getSchemaForIdentifier(this.getSchema()); - } - - - // ********** cascade persist ********** - - public boolean isCascadePersist() { - return this.cascadePersist; - } - - public void setCascadePersist(boolean cascadePersist) { - if (this.cascadePersist != cascadePersist) { - XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaultsForUpdate(); - this.setCascadePersist_(cascadePersist); - xmlDefaults.setCascadePersist(cascadePersist); - this.removeXmlDefaultsIfUnset(); - } - } - - protected void setCascadePersist_(boolean cascadePersist) { - boolean old = this.cascadePersist; - this.cascadePersist = cascadePersist; - this.firePropertyChanged(CASCADE_PERSIST_PROPERTY, old, cascadePersist); - } - - protected boolean buildCascadePersist() { - XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults(); - return (xmlDefaults == null) ? false : xmlDefaults.isCascadePersist(); - } - - - // ********** delimited identifiers ********** - - public boolean isDelimitedIdentifiers() { - return this.delimitedIdentifiers; - } - - public void setDelimitedIdentifiers(boolean delimitedIdentifiers) { - if (this.delimitedIdentifiers != delimitedIdentifiers) { - XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaultsForUpdate(); - this.setDelimitedIdentifiers_(delimitedIdentifiers); - xmlDefaults.setDelimitedIdentifiers(delimitedIdentifiers); - this.removeXmlDefaultsIfUnset(); - } - } - - protected void setDelimitedIdentifiers_(boolean di) { - boolean old = this.delimitedIdentifiers; - this.delimitedIdentifiers = di; - this.firePropertyChanged(DELIMITED_IDENTIFIERS_PROPERTY, old, di); - } - - protected boolean buildDelimitedIdentifiers() { - XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults(); - return (xmlDefaults == null) ? false : xmlDefaults.isDelimitedIdentifiers(); - } - - - // ********** XML defaults ********** - - /** - * Return null if the XML defaults does not exist. - */ - protected XmlPersistenceUnitDefaults getXmlDefaults() { - XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadata(); - return (xmlMetadata == null) ? null : xmlMetadata.getPersistenceUnitDefaults(); - } - - protected XmlPersistenceUnitMetadata getXmlPersistenceUnitMetadata() { - return this.getPersistenceUnitMetadata().getXmlPersistenceUnitMetadata(); - } - - /** - * Build the XML defaults (and XML metadata if necessary) if it does not exist. - */ - protected XmlPersistenceUnitDefaults getXmlDefaultsForUpdate() { - XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadataForUpdate(); - XmlPersistenceUnitDefaults xmlDefaults = xmlMetadata.getPersistenceUnitDefaults(); - return (xmlDefaults != null) ? xmlDefaults : this.buildXmlDefaults(xmlMetadata); - } - - protected XmlPersistenceUnitMetadata getXmlPersistenceUnitMetadataForUpdate() { - return this.getPersistenceUnitMetadata().getXmlPersistenceUnitMetadataForUpdate(); - } - - protected XmlPersistenceUnitDefaults buildXmlDefaults(XmlPersistenceUnitMetadata xmlMetadata) { - XmlPersistenceUnitDefaults xmlDefaults = OrmFactory.eINSTANCE.createXmlPersistenceUnitDefaults(); - xmlMetadata.setPersistenceUnitDefaults(xmlDefaults); - return xmlDefaults; - } - - /** - * clear the XML defaults (and the XML metadata) if appropriate - */ - protected void removeXmlDefaultsIfUnset() { - if (this.getXmlDefaults().isUnset()) { - this.getXmlPersistenceUnitMetadata().setPersistenceUnitDefaults(null); - this.removeXmlPersistenceUnitMetadataIfUnset(); - } - } - - protected void removeXmlPersistenceUnitMetadataIfUnset() { - this.getPersistenceUnitMetadata().removeXmlPersistenceUnitMetadataIfUnset(); - } - - - // ********** misc ********** - - @Override - public OrmPersistenceUnitMetadata getParent() { - return (OrmPersistenceUnitMetadata) super.getParent(); - } - - public OrmPersistenceUnitMetadata getPersistenceUnitMetadata() { - return this.getParent(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - XmlPersistenceUnitDefaults xmlDefaults = this.getXmlDefaults(); - return (xmlDefaults != null) ? - xmlDefaults.getValidationTextRange() : - this.getPersistenceUnitMetadata().getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java deleted file mode 100644 index 63409c28f1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistenceUnitMetadata.java +++ /dev/null @@ -1,191 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistenceUnitDefaults; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistenceUnitMetadata2_0; -import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.jpa.core.resource.orm.XmlPersistenceUnitMetadata; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; - -/** - * orm.xml file - *
- * persistence-unit-metadata element - */ -public class GenericOrmPersistenceUnitMetadata - extends AbstractOrmXmlContextNode - implements OrmPersistenceUnitMetadata2_0 -{ - protected boolean xmlMappingMetadataComplete; - - protected String description; - - // never null - protected final OrmPersistenceUnitDefaults persistenceUnitDefaults; - - - public GenericOrmPersistenceUnitMetadata(EntityMappings parent) { - super(parent); - this.xmlMappingMetadataComplete = this.buildXmlMappingMetadataComplete(); - this.description = this.buildDescription(); - this.persistenceUnitDefaults = this.buildPersistenceUnitDefaults(); - } - - protected OrmPersistenceUnitDefaults buildPersistenceUnitDefaults() { - return this.getContextNodeFactory().buildOrmPersistenceUnitDefaults(this); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setXmlMappingMetadataComplete_(this.buildXmlMappingMetadataComplete()); - this.setDescription_(this.buildDescription()); - this.persistenceUnitDefaults.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.persistenceUnitDefaults.update(); - } - - - // ********** XML metadata ********** - - /** - * Return null if the XML metadata does not exist. - */ - public XmlPersistenceUnitMetadata getXmlPersistenceUnitMetadata() { - return this.getXmlEntityMappings().getPersistenceUnitMetadata(); - } - - /** - * Build the XML metadata if it does not exist. - */ - public XmlPersistenceUnitMetadata getXmlPersistenceUnitMetadataForUpdate() { - XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadata(); - return (xmlMetadata != null) ? xmlMetadata : this.buildXmlPersistenceUnitMetadata(); - } - - protected XmlPersistenceUnitMetadata buildXmlPersistenceUnitMetadata() { - XmlPersistenceUnitMetadata xmlMetadata = this.buildXmlPersistenceUnitMetadata_(); - this.getXmlEntityMappings().setPersistenceUnitMetadata(xmlMetadata); - return xmlMetadata; - } - - protected XmlPersistenceUnitMetadata buildXmlPersistenceUnitMetadata_() { - return EmfTools.create( - this.getResourceNodeFactory(), - OrmPackage.eINSTANCE.getXmlPersistenceUnitMetadata(), - XmlPersistenceUnitMetadata.class - ); - } - - public void removeXmlPersistenceUnitMetadataIfUnset() { - if (this.getXmlPersistenceUnitMetadata().isUnset()) { - this.getXmlEntityMappings().setPersistenceUnitMetadata(null); - } - } - - - // ********** XML mapping metadata complete ********** - - public boolean isXmlMappingMetadataComplete() { - return this.xmlMappingMetadataComplete; - } - - public void setXmlMappingMetadataComplete(boolean xmlMappingMetadataComplete) { - if (this.xmlMappingMetadataComplete != xmlMappingMetadataComplete) { - XmlPersistenceUnitMetadata xmlPersistenceUnitMetadata = this.getXmlPersistenceUnitMetadataForUpdate(); - this.setXmlMappingMetadataComplete_(xmlMappingMetadataComplete); - xmlPersistenceUnitMetadata.setXmlMappingMetadataComplete(xmlMappingMetadataComplete); - this.removeXmlPersistenceUnitMetadataIfUnset(); - } - } - - protected void setXmlMappingMetadataComplete_(boolean xmlMappingMetadataComplete) { - boolean old = this.xmlMappingMetadataComplete; - this.xmlMappingMetadataComplete = xmlMappingMetadataComplete; - this.firePropertyChanged(XML_MAPPING_METADATA_COMPLETE_PROPERTY, old, xmlMappingMetadataComplete); - } - - protected boolean buildXmlMappingMetadataComplete() { - XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadata(); - return (xmlMetadata != null) ? xmlMetadata.isXmlMappingMetadataComplete() : false; - } - - - // ********** description ********** - - public String getDescription() { - return this.description; - } - - public void setDescription(String description) { - if (this.valuesAreDifferent(this.description, description)) { - XmlPersistenceUnitMetadata xmlPersistenceUnitMetadata = this.getXmlPersistenceUnitMetadataForUpdate(); - this.setDescription_(description); - xmlPersistenceUnitMetadata.setDescription(description); - this.removeXmlPersistenceUnitMetadataIfUnset(); - } - } - - protected void setDescription_(String description) { - String old = this.description; - this.description = description; - this.firePropertyChanged(DESCRIPTION_PROPERTY, old, description); - } - - protected String buildDescription() { - XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadata(); - return (xmlMetadata == null) ? null : xmlMetadata.getDescription(); - } - - - // ********** persistence unit defaults ********** - - public OrmPersistenceUnitDefaults getPersistenceUnitDefaults() { - return this.persistenceUnitDefaults; - } - - - // ********** misc ********** - - @Override - public EntityMappings getParent() { - return (EntityMappings) super.getParent(); - } - - public XmlEntityMappings getXmlEntityMappings() { - return this.getParent().getXmlEntityMappings(); - } - - public boolean resourceExists() { - return this.getXmlPersistenceUnitMetadata() != null; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - XmlPersistenceUnitMetadata xmlMetadata = this.getXmlPersistenceUnitMetadata(); - return (xmlMetadata != null) ? - xmlMetadata.getValidationTextRange() : - this.getXmlEntityMappings().getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java deleted file mode 100644 index 1bdd5cc4c0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentAttribute.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.List; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.orm.SpecifiedOrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericPersistentAttributeValidator; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml persistent attribute - */ -public class GenericOrmPersistentAttribute - extends SpecifiedOrmPersistentAttribute -{ - public GenericOrmPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlMapping) { - super(parent, xmlMapping); - } - - - // ********** access ********** - - /** - * JPA 1.0 does not support a specified access for attributes. - */ - @Override - public AccessType getSpecifiedAccess() { - return null; - } - - public void setSpecifiedAccess(AccessType access) { - throw new UnsupportedOperationException("A specified access is not supported in JPA 1.0: " + this); //$NON-NLS-1$ - } - - - // ********** validation ********** - - @Override - protected void validateAttribute(List messages, IReporter reporter) { - super.validateAttribute(messages, reporter); - if (this.javaPersistentAttribute != null) { - JavaPersistentType javaPersistentType = this.getOwningPersistentType().getJavaPersistentType(); - if ((javaPersistentType != null) && (javaPersistentType.getAttributeNamed(this.javaPersistentAttribute.getName()) == null)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - JpaValidationMessages.PERSISTENT_ATTRIBUTE_INHERITED_ATTRIBUTES_NOT_SUPPORTED, - new String[] { - this.getName(), - this.getOwningPersistentType().getMapping().getClass_() - }, - this.mapping, - this.mapping.getNameTextRange() - ) - ); - } - } - } - - @Override - protected JptValidator buildAttibuteValidator() { - return new GenericPersistentAttributeValidator(this, getJavaPersistentAttribute(), buildTextRangeResolver()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java deleted file mode 100644 index 9e28935ce4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPersistentType.java +++ /dev/null @@ -1,1195 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.Collection; -import java.util.Comparator; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Vector; -import org.eclipse.core.resources.IFile; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.BodySourceWriter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.ClassName; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.ChainIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SnapshotCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SuperListIterableWrapper; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.ReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmReadOnlyPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmStructureNodes; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentType2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentType2_0; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTypeMapping; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml persistent type:

    - *
  • mapping - *
  • access - *
  • attributes - *
  • super persistent type - *
  • Java persistent type - *
- */ -public class GenericOrmPersistentType - extends AbstractOrmXmlContextNode - implements OrmPersistentType2_0 -{ - protected OrmTypeMapping mapping; // never null - - protected JavaPersistentType javaPersistentType; - - protected AccessType specifiedAccess; - protected AccessType defaultAccess; // never null - - protected final Vector specifiedAttributes = new Vector(); - protected final SpecifiedAttributeContainerAdapter specifiedAttributeContainerAdapter = new SpecifiedAttributeContainerAdapter(); - - protected final Vector virtualAttributes = new Vector(); - protected final VirtualAttributeContainerAdapter virtualAttributeContainerAdapter = new VirtualAttributeContainerAdapter(); - - protected PersistentType superPersistentType; - - protected String declaringTypeName; - - protected final MetamodelSourceType.Synchronizer metamodelSynchronizer; - - - public GenericOrmPersistentType(EntityMappings parent, XmlTypeMapping xmlTypeMapping) { - super(parent); - this.mapping = this.buildMapping(xmlTypeMapping); - // 'javaPersistentType' is resolved in the update - this.specifiedAccess = this.buildSpecifiedAccess(); - this.defaultAccess = AccessType.FIELD; // keep this non-null - this.initializeSpecifiedAttributes(); - this.metamodelSynchronizer = this.buildMetamodelSynchronizer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.mapping.synchronizeWithResourceModel(); - this.syncJavaPersistentType(); - this.setSpecifiedAccess_(this.buildSpecifiedAccess()); - this.syncSpecifiedAttributes(); - this.synchronizeNodesWithResourceModel(this.getVirtualAttributes()); - } - - @Override - public void update() { - super.update(); - this.mapping.update(); - this.updateJavaPersistentType(); - this.setDefaultAccess(this.buildDefaultAccess()); - this.updateNodes(this.getSpecifiedAttributes()); - this.updateVirtualAttributes(); - this.setSuperPersistentType(this.buildSuperPersistentType()); - this.setDeclaringTypeName(this.buildDeclaringTypeName()); - } - - - // ********** mapping ********** - - public OrmTypeMapping getMapping() { - return this.mapping; - } - - public String getMappingKey() { - return this.mapping.getKey(); - } - - public void setMappingKey(String mappingKey) { - if (this.valuesAreDifferent(this.getMappingKey(), mappingKey)) { - this.setMappingKey_(mappingKey); - } - } - - protected void setMappingKey_(String mappingKey) { - OrmTypeMapping old = this.mapping; - OrmTypeMappingDefinition mappingDefinition = this.getMappingFileDefinition().getTypeMappingDefinition(mappingKey); - XmlTypeMapping xmlTypeMapping = mappingDefinition.buildResourceMapping(this.getResourceNodeFactory()); - this.mapping = this.buildMapping(xmlTypeMapping); - this.getEntityMappings().changeMapping(this, old, this.mapping); - this.firePropertyChanged(MAPPING_PROPERTY, old, this.mapping); - } - - protected OrmTypeMapping buildMapping(XmlTypeMapping xmlTypeMapping) { - OrmTypeMappingDefinition md = this.getMappingFileDefinition().getTypeMappingDefinition(xmlTypeMapping.getMappingKey()); - return md.buildContextMapping(this, xmlTypeMapping, this.getContextNodeFactory()); - } - - protected XmlTypeMapping getXmlTypeMapping() { - return this.mapping.getXmlTypeMapping(); - } - - public boolean isMapped() { - return true; - } - - - // ********** name ********** - - public String getName() { - return this.convertMappingClassName(this.mapping.getClass_()); - } - - public String getSimpleName(){ - String className = this.getName(); - return StringTools.stringIsEmpty(className) ? null : ClassName.getSimpleName(className); - } - - /** - * We clear out {@link #javaPersistentType} here because we cannot compare its name - * to the mapping's class name, since it may have been prefixed by the entity - * mappings package. - */ - public void mappingClassChanged(String oldClass, String newClass) { - this.firePropertyChanged(NAME_PROPERTY, this.convertMappingClassName(oldClass), this.convertMappingClassName(newClass)); - // clear out the Java type here, it will be rebuilt during "update" - if (this.javaPersistentType != null) { - this.javaPersistentType.dispose(); - this.setJavaPersistentType(null); - } - } - - /** - * Nested class names are specified with a '$' - * in orm.xml. - */ - protected String convertMappingClassName(String name) { - return (name == null) ? null : name.replace('$', '.'); - } - - - // ********** Java persistent type ********** - - public JavaPersistentType getJavaPersistentType() { - return this.javaPersistentType; - } - - protected void setJavaPersistentType(JavaPersistentType javaPersistentType) { - JavaPersistentType old = this.javaPersistentType; - this.javaPersistentType = javaPersistentType; - this.firePropertyChanged(JAVA_PERSISTENT_TYPE_PROPERTY, old, javaPersistentType); - } - - /** - * If the persistent type's mapping's class (name) changes during - * sync, the Java persistent type will be cleared out in - * {@link #mappingClassChanged(String, String)}. If we get here and - * the Java persistent type is still present, we can - * sync it. Of course, it might still be obsolete if the - * entity mappings's package has changed.... - * - * @see #updateJavaPersistentType() - */ - protected void syncJavaPersistentType() { - if (this.javaPersistentType != null) { - this.javaPersistentType.synchronizeWithResourceModel(); - } - } - - /** - * @see #syncJavaPersistentType() - */ - protected void updateJavaPersistentType() { - JavaResourcePersistentType resourceType = this.resolveJavaResourcePersistentType(); - if (resourceType == null) { - if (this.javaPersistentType != null) { - this.javaPersistentType.dispose(); - this.setJavaPersistentType(null); - } - } else { - if (this.javaPersistentType == null) { - this.setJavaPersistentType(this.buildJavaPersistentType(resourceType)); - } else { - if (this.javaPersistentType.getResourcePersistentType() == resourceType) { - this.javaPersistentType.update(); - } else { - this.javaPersistentType.dispose(); - this.setJavaPersistentType(this.buildJavaPersistentType(resourceType)); - } - } - } - } - - protected JavaResourcePersistentType resolveJavaResourcePersistentType() { - return this.getEntityMappings().resolveJavaResourcePersistentType(this.getName()); - } - - protected JavaPersistentType buildJavaPersistentType(JavaResourcePersistentType jrpt) { - return this.getJpaFactory().buildJavaPersistentType(this, jrpt); - } - - - // ********** access ********** - - public AccessType getAccess() { - return (this.specifiedAccess != null) ? this.specifiedAccess : this.defaultAccess; - } - - public AccessType getSpecifiedAccess() { - return this.specifiedAccess; - } - - public void setSpecifiedAccess(AccessType access) { - this.setSpecifiedAccess_(access); - this.getXmlTypeMapping().setAccess(AccessType.toOrmResourceModel(access)); - } - - protected void setSpecifiedAccess_(AccessType access) { - AccessType old = this.specifiedAccess; - this.specifiedAccess = access; - this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, access); - } - - protected AccessType buildSpecifiedAccess() { - return AccessType.fromOrmResourceModel(this.getXmlTypeMapping().getAccess()); - } - - public AccessType getDefaultAccess() { - return this.defaultAccess; - } - - protected void setDefaultAccess(AccessType access) { - AccessType old = this.defaultAccess; - this.defaultAccess = access; - this.firePropertyChanged(DEFAULT_ACCESS_PROPERTY, old, access); - } - - protected AccessType buildDefaultAccess() { - if ( ! this.mapping.isMetadataComplete()) { - if (this.javaPersistentType != null) { - if (this.javaPersistentTypeHasSpecifiedAccess()) { - return this.javaPersistentType.getAccess(); - } - if (this.superPersistentType != null) { - return this.superPersistentType.getAccess(); - } - } - } - AccessType access = this.getMappingFileRoot().getAccess(); - return (access != null) ? access : AccessType.FIELD; // default to FIELD if no specified access found - } - - /** - * pre-condition: {@link #javaPersistentType} is not null - */ - protected boolean javaPersistentTypeHasSpecifiedAccess() { - return (this.javaPersistentType.getSpecifiedAccess() != null) || - this.javaPersistentType.hasAnyAnnotatedAttributes(); - } - - public AccessType getOwnerOverrideAccess() { - return this.getEntityMappings().getOverridePersistentTypeAccess(); - } - - public AccessType getOwnerDefaultAccess() { - return this.getEntityMappings().getDefaultPersistentTypeAccess(); - } - - - // ********** attributes ********** - - public ListIterator attributes() { - return this.getAttributes().iterator(); - } - - @SuppressWarnings("unchecked") - public ListIterable getAttributes() { - return new CompositeListIterable(this.getReadOnlySpecifiedAttributes(), this.getVirtualAttributes()); - } - - public int attributesSize() { - return this.specifiedAttributesSize() + this.virtualAttributesSize(); - } - - public Iterator attributeNames() { - return this.getAttributeNames().iterator(); - } - - public Iterable getAttributeNames() { - return this.convertToNames(this.getAttributes()); - } - - public OrmReadOnlyPersistentAttribute getAttributeNamed(String attributeName) { - Iterator stream = this.getAttributesNamed(attributeName).iterator(); - return stream.hasNext() ? stream.next() : null; - } - - public Iterator allAttributes() { - return this.getAllAttributes().iterator(); - } - - public Iterable getAllAttributes() { - return new CompositeIterable( - new TransformationIterable>(this.getInheritanceHierarchy()) { - @Override - protected Iterable transform(PersistentType pt) { - return new SnapshotCloneIterable(pt.attributes()); - } - } - ); - } - - public Iterator allAttributeNames() { - return this.getAllAttributeNames().iterator(); - } - - public Iterable getAllAttributeNames() { - return this.convertToNames(this.getAllAttributes()); - } - - protected Iterable getAttributesNamed(final String attributeName) { - return new FilteringIterable(this.getAttributes()) { - @Override - protected boolean accept(OrmReadOnlyPersistentAttribute attribute) { - return Tools.valuesAreEqual(attributeName, attribute.getName()); - } - }; - } - - public ReadOnlyPersistentAttribute resolveAttribute(String attributeName) { - Iterator attributes = this.getAttributesNamed(attributeName).iterator(); - if (attributes.hasNext()) { - OrmReadOnlyPersistentAttribute attribute = attributes.next(); - return attributes.hasNext() ? null /* more than one */: attribute; - } - // recurse - return (this.superPersistentType == null) ? null : this.superPersistentType.resolveAttribute(attributeName); - } - - protected Iterable convertToNames(Iterable attributes) { - return new TransformationIterable(attributes) { - @Override - protected String transform(ReadOnlyPersistentAttribute attribute) { - return attribute.getName(); - } - }; - } - - - // ********** attribute conversions ********** - - public OrmPersistentAttribute convertAttributeToSpecified(OrmReadOnlyPersistentAttribute virtualAttribute) { - return this.convertAttributeToSpecified(virtualAttribute, virtualAttribute.getMappingKey()); - } - - public OrmPersistentAttribute convertAttributeToSpecified(OrmReadOnlyPersistentAttribute virtualAttribute, String mappingKey) { - if ( ! virtualAttribute.isVirtual()) { - throw new IllegalArgumentException("Attribute is already specified: " + virtualAttribute); //$NON-NLS-1$ - } - if (mappingKey == null) { - // this typically happens when the virtual attribute does not have a mapping - throw new IllegalArgumentException("Use convertAttributeToSpecified(OrmReadOnlyPersistentAttribute, String) instead and specify a mapping key"); //$NON-NLS-1$ - } - return this.convertAttributeToSpecified_(virtualAttribute, mappingKey); - } - - /** - * Silently remove the virtual attribute and add specified - * attribute before triggering an update or the dangling - * virtual attribute will be removed preemptively. - */ - protected OrmPersistentAttribute convertAttributeToSpecified_(OrmReadOnlyPersistentAttribute virtualAttribute, String mappingKey) { - // silently remove the virtual attribute - int virtualIndex = this.virtualAttributes.indexOf(virtualAttribute); - this.virtualAttributes.remove(virtualIndex); - virtualAttribute.dispose(); - - // silently add the specified attribute - OrmAttributeMappingDefinition md = this.getMappingFileDefinition().getAttributeMappingDefinition(mappingKey); - XmlAttributeMapping xmlMapping = md.buildResourceMapping(this.getResourceNodeFactory()); - - OrmPersistentAttribute specifiedAttribute = this.buildSpecifiedAttribute(xmlMapping); - // we need to add the attribute to the right spot in the list - stupid spec... - int specifiedIndex = this.getSpecifiedAttributeInsertionIndex(specifiedAttribute); - this.specifiedAttributes.add(specifiedIndex, specifiedAttribute); - - // this will trigger the initial update; - // no changes to either collection (virtual or specified) should be detected at this point - specifiedAttribute.getMapping().setName(virtualAttribute.getName()); - - // fire the list change events - this.fireItemRemoved(VIRTUAL_ATTRIBUTES_LIST, virtualIndex, virtualAttribute); - this.fireItemAdded(SPECIFIED_ATTRIBUTES_LIST, specifiedIndex, specifiedAttribute); - - // it should be safe to update the XML now - Attributes xmlAttributes = this.getXmlAttributesForUpdate(); - specifiedAttribute.getMapping().addXmlAttributeMappingTo(xmlAttributes); - // possibly a NOP, but needed when we trigger the creation of a new 'attributes' - this.getXmlTypeMapping().setAttributes(xmlAttributes); - - // copy over the specified access(?) - AccessType oldAccess = virtualAttribute.getJavaPersistentAttribute().getSpecifiedAccess(); - if (oldAccess != null) { - specifiedAttribute.setSpecifiedAccess(oldAccess); - } - return specifiedAttribute; - } - - // TODO this is used only by our tests... - // we cannot delegate to getAttributeNamed(String).convertToSpecified() - // because the tests use this method to add "orphan" xml attributes (that - // do not have a corresponding java attribute :( ) - public OrmPersistentAttribute addSpecifiedAttribute(String mappingKey, String attributeName) { - // force the creation of an empty xml attribute container beforehand or it will trigger - // a sync and, if we do this after adding the attribute, clear out our context attributes - Attributes xmlAttributes = this.getXmlAttributesForUpdate(); - this.getXmlTypeMapping().setAttributes(xmlAttributes); // possibly a NOP - - OrmAttributeMappingDefinition md = this.getMappingFileDefinition().getAttributeMappingDefinition(mappingKey); - XmlAttributeMapping xmlMapping = md.buildResourceMapping(this.getResourceNodeFactory()); - - OrmPersistentAttribute specifiedAttribute = this.buildSpecifiedAttribute(xmlMapping); - // we need to add the attribute to the right spot in the list - stupid spec... - int specifiedIndex = this.getSpecifiedAttributeInsertionIndex(specifiedAttribute); - // the virtual attributes list should remain unchanged since the specified attribute has no name - this.addItemToList(specifiedIndex, specifiedAttribute, this.specifiedAttributes, SPECIFIED_ATTRIBUTES_LIST); - specifiedAttribute.getMapping().addXmlAttributeMappingTo(xmlAttributes); - - // this will trigger the update of the virtual attributes list - specifiedAttribute.getMapping().setName(attributeName); - - return specifiedAttribute; - } - - protected int getSpecifiedAttributeInsertionIndex(OrmPersistentAttribute attribute) { - return CollectionTools.insertionIndexOf(this.specifiedAttributes, attribute, this.getAttributeComparator()); - } - - protected Comparator getAttributeComparator() { - return ATTRIBUTE_COMPARATOR; - } - - protected static final Comparator ATTRIBUTE_COMPARATOR = - new Comparator() { - public int compare(OrmPersistentAttribute attribute1, OrmPersistentAttribute attribute2) { - int seq1 = attribute1.getMapping().getXmlSequence(); - int seq2 = attribute2.getMapping().getXmlSequence(); - return (seq1 == seq2) ? 0 : (seq1 < seq2) ? -1 : 1; - } - }; - - /** - * Silently add the new virtual attribute before removing the - * specified attribute, or the update will discover the missing - * virtual attribute and add it preemptively. - */ - public OrmReadOnlyPersistentAttribute convertAttributeToVirtual(OrmPersistentAttribute specifiedAttribute) { - if (specifiedAttribute.isVirtual()) { - throw new IllegalArgumentException("Attribute is already virtual: " + specifiedAttribute); //$NON-NLS-1$ - } - - int virtualIndex = this.virtualAttributes.size(); - OrmReadOnlyPersistentAttribute virtualAttribute = null; - // make sure the corresponding resource Java attribute actually exists in the *current* type; - // do *not* take the context Java attribute directly from the specified ORM - // attribute we are converting since it may have come from a superclass; - // instead, use its resource Java attribute (which will match both name and access type, - // but we still need to check its parent type) - JavaResourcePersistentAttribute javaResourceAttribute = specifiedAttribute.getJavaResourcePersistentAttribute(); - if ((javaResourceAttribute != null) && this.javaResourceAttributeWillBeVirtual(javaResourceAttribute, specifiedAttribute)) { - virtualAttribute = this.buildVirtualAttribute(javaResourceAttribute); - this.virtualAttributes.add(virtualIndex, virtualAttribute); - } - - this.removeSpecifiedAttribute(specifiedAttribute); // trigger update - - if (virtualAttribute != null) { - this.fireItemAdded(VIRTUAL_ATTRIBUTES_LIST, virtualIndex, virtualAttribute); - } - return virtualAttribute; - } - - /** - * Return whether the specified Java resource attribute will be a - * virtual attribute when the specified specified attribute is - * removed from the type. The Java resource attribute must be among the - * valid Java resource attributes and it must not correspond to any of the - * remaining specified attributes. - */ - protected boolean javaResourceAttributeWillBeVirtual(JavaResourcePersistentAttribute javaResourceAttribute, OrmPersistentAttribute specifiedAttributeToBeRemoved) { - return CollectionTools.contains(this.getJavaResourceAttributes(), javaResourceAttribute) && - (this.getSpecifiedAttributeFor(javaResourceAttribute, specifiedAttributeToBeRemoved) == null); - } - - - // ********** xml attributes ********** - - /** - * Return null if the attributes element is missing. - */ - protected Attributes getXmlAttributes() { - return this.getXmlTypeMapping().getAttributes(); - } - - /** - * Build a new attributes element if it is not present; - * but do not add it to the XML type mapping. Callers will have - * to add it to the XML type mapping when appropriate. - */ - protected Attributes getXmlAttributesForUpdate() { - Attributes xmlAttributes = this.getXmlAttributes(); - return (xmlAttributes != null) ? xmlAttributes : this.buildXmlAttributes(); - } - - protected Attributes buildXmlAttributes() { - return EmfTools.create(this.getResourceNodeFactory(), OrmPackage.eINSTANCE.getAttributes(), Attributes.class); - } - - protected void removeXmlAttributesIfUnset() { - if (this.getXmlAttributes().isUnset()) { - this.getXmlTypeMapping().setAttributes(null); - } - } - - - // ********** specified attributes ********** - - public ListIterator specifiedAttributes() { - return this.getSpecifiedAttributes().iterator(); - } - - protected ListIterable getSpecifiedAttributes() { - return new LiveCloneListIterable(this.specifiedAttributes); - } - - protected ListIterable getReadOnlySpecifiedAttributes() { - return new SuperListIterableWrapper(this.getSpecifiedAttributes()); - } - - public int specifiedAttributesSize() { - return this.specifiedAttributes.size(); - } - - protected void removeSpecifiedAttribute(OrmPersistentAttribute attribute) { - this.removeSpecifiedAttribute_(attribute); - attribute.getMapping().removeXmlAttributeMappingFrom(this.getXmlAttributes()); - this.removeXmlAttributesIfUnset(); - } - - public void changeMapping(OrmPersistentAttribute attribute, OrmAttributeMapping oldMapping, OrmAttributeMapping newMapping) { - // keep the context model in sync with each change to the resource model - int sourceIndex = this.specifiedAttributes.indexOf(attribute); - this.specifiedAttributes.remove(sourceIndex); - oldMapping.removeXmlAttributeMappingFrom(this.getXmlAttributes()); - - int targetIndex = this.getSpecifiedAttributeInsertionIndex(attribute); - this.specifiedAttributes.add(targetIndex, attribute); - newMapping.addXmlAttributeMappingTo(this.getXmlAttributes()); - - oldMapping.initializeOn(newMapping); - - this.fireItemMoved(SPECIFIED_ATTRIBUTES_LIST, targetIndex, sourceIndex); - } - - protected void initializeSpecifiedAttributes() { - for (XmlAttributeMapping xmlMapping : this.getXmlAttributeMappings()) { - this.specifiedAttributes.add(this.buildSpecifiedAttribute(xmlMapping)); - } - } - - protected Iterable getXmlAttributeMappings() { - Attributes xmlAttributes = this.getXmlAttributes(); - return (xmlAttributes != null) ? xmlAttributes.getAttributeMappings() : EmptyIterable.instance(); - } - - protected OrmPersistentAttribute buildSpecifiedAttribute(XmlAttributeMapping xmlMapping) { - return this.getContextNodeFactory().buildOrmPersistentAttribute(this, xmlMapping); - } - - protected void syncSpecifiedAttributes() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedAttributeContainerAdapter); - } - - protected void moveSpecifiedAttribute_(int index, OrmPersistentAttribute attribute) { - this.moveItemInList(index, attribute, this.specifiedAttributes, SPECIFIED_ATTRIBUTES_LIST); - } - - protected void addSpecifiedAttribute_(int index, XmlAttributeMapping xmlMapping) { - OrmPersistentAttribute attribute = this.buildSpecifiedAttribute(xmlMapping); - this.addItemToList(index, attribute, this.specifiedAttributes, SPECIFIED_ATTRIBUTES_LIST); - } - - protected void removeSpecifiedAttribute_(OrmPersistentAttribute attribute) { - this.removeItemFromList(attribute, this.specifiedAttributes, SPECIFIED_ATTRIBUTES_LIST); - } - - /** - * specified attribute container adapter - */ - protected class SpecifiedAttributeContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericOrmPersistentType.this.getSpecifiedAttributes(); - } - public Iterable getResourceElements() { - return GenericOrmPersistentType.this.getXmlAttributeMappings(); - } - public XmlAttributeMapping getResourceElement(OrmPersistentAttribute contextElement) { - return contextElement.getMapping().getXmlAttributeMapping(); - } - public void moveContextElement(int index, OrmPersistentAttribute element) { - GenericOrmPersistentType.this.moveSpecifiedAttribute_(index, element); - } - public void addContextElement(int index, XmlAttributeMapping resourceElement) { - GenericOrmPersistentType.this.addSpecifiedAttribute_(index, resourceElement); - } - public void removeContextElement(OrmPersistentAttribute element) { - GenericOrmPersistentType.this.removeSpecifiedAttribute_(element); - } - } - - - // ********** virtual attributes ********** - - public ListIterator virtualAttributes() { - return this.getVirtualAttributes().iterator(); - } - - public ListIterable getVirtualAttributes() { - return new LiveCloneListIterable(this.virtualAttributes); - } - - public int virtualAttributesSize() { - return this.virtualAttributes.size(); - } - - protected void updateVirtualAttributes() { - ContextContainerTools.update(this.virtualAttributeContainerAdapter); - } - - /** - * Return all the Java resource attributes that have the appropriate access - * and do not have a corresponding orm.xml mapping currently - * specified in the orm.xml persistent type. - */ - protected Iterable getVirtualJavaResourceAttributes() { - return new FilteringIterable(this.getJavaResourceAttributes()) { - @Override - protected boolean accept(JavaResourcePersistentAttribute javaResourceAttribute) { - return GenericOrmPersistentType.this.javaResourceAttributeIsVirtual(javaResourceAttribute); - } - }; - } - - protected Iterable getJavaResourceAttributes() { - return CollectionTools.iterable(this.javaResourceAttributes()); - } - - /** - * Return the Java resource attributes with the appropriate access type. - */ - protected Iterator javaResourceAttributes() { - JavaResourcePersistentType javaResourceType = this.getJavaResourceType(); - return (javaResourceType != null) ? - javaResourceType.persistableAttributes(this.getVirtualJavaAccess().getJavaAccessType()) : - EmptyListIterator.instance(); - } - - protected JavaResourcePersistentType getJavaResourceType() { - return (this.javaPersistentType == null) ? null : this.javaPersistentType.getResourcePersistentType(); - } - - /** - * Return the access type that determines which Java attributes are to be - * used for the orm.xml type's virtual attributes. - */ - protected AccessType getVirtualJavaAccess() { - if (this.specifiedAccess != null) { - return this.specifiedAccess; - } - if (this.mapping.isMetadataComplete()) { - return this.defaultAccess; - } - AccessType javaAccess = this.javaPersistentType.getSpecifiedAccess(); - return (javaAccess != null) ? javaAccess : this.defaultAccess; - } - - protected boolean javaResourceAttributeIsVirtual(JavaResourcePersistentAttribute javaResourceAttribute) { - return this.getSpecifiedAttributeFor(javaResourceAttribute) == null; - } - - protected OrmPersistentAttribute getSpecifiedAttributeFor(JavaResourcePersistentAttribute javaResourceAttribute) { - return this.getSpecifiedAttributeFor(javaResourceAttribute, null); - } - - /** - * Return the specified attribute corresponding to the specified Java - * resource attribute, ignoring the specified excluded attribute (since - * there can be more than one specified attribute per Java resource - * attribute; albeit erroneously). - */ - protected OrmPersistentAttribute getSpecifiedAttributeFor(JavaResourcePersistentAttribute javaResourceAttribute, OrmPersistentAttribute exclude) { - for (OrmPersistentAttribute ormAttribute : this.getSpecifiedAttributes()) { - if (ormAttribute == exclude) { - continue; // skip - } - if (ormAttribute.getJavaResourcePersistentAttribute() == javaResourceAttribute) { - return ormAttribute; - } - } - return null; - } - - protected void moveVirtualAttribute(int index, OrmReadOnlyPersistentAttribute virtualAttribute) { - this.moveItemInList(index, virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST); - } - - protected void addVirtualAttribute(int index, JavaResourcePersistentAttribute javaResourceAttribute) { - OrmReadOnlyPersistentAttribute virtualAttribute = this.buildVirtualAttribute(javaResourceAttribute); - this.addItemToList(index, virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST); - } - - protected OrmReadOnlyPersistentAttribute buildVirtualAttribute(JavaResourcePersistentAttribute javaResourceAttribute) { - return this.getContextNodeFactory().buildVirtualOrmPersistentAttribute(this, javaResourceAttribute); - } - - protected void removeVirtualAttribute(OrmReadOnlyPersistentAttribute virtualAttribute) { - virtualAttribute.dispose(); - this.removeItemFromList(virtualAttribute, this.virtualAttributes, VIRTUAL_ATTRIBUTES_LIST); - } - - /** - * virtual attribute container adapter - */ - protected class VirtualAttributeContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericOrmPersistentType.this.getVirtualAttributes(); - } - public Iterable getResourceElements() { - return GenericOrmPersistentType.this.getVirtualJavaResourceAttributes(); - } - public JavaResourcePersistentAttribute getResourceElement(OrmReadOnlyPersistentAttribute contextElement) { - return contextElement.getJavaResourcePersistentAttribute(); - } - public void moveContextElement(int index, OrmReadOnlyPersistentAttribute element) { - GenericOrmPersistentType.this.moveVirtualAttribute(index, element); - } - public void addContextElement(int index, JavaResourcePersistentAttribute resourceElement) { - GenericOrmPersistentType.this.addVirtualAttribute(index, resourceElement); - } - public void removeContextElement(OrmReadOnlyPersistentAttribute element) { - GenericOrmPersistentType.this.removeVirtualAttribute(element); - } - } - - - // ********** super persistent type ********** - - public PersistentType getSuperPersistentType() { - return this.superPersistentType; - } - - protected void setSuperPersistentType(PersistentType persistentType) { - PersistentType old = this.superPersistentType; - this.superPersistentType = persistentType; - this.firePropertyChanged(SUPER_PERSISTENT_TYPE_PROPERTY, old, persistentType); - } - - protected PersistentType buildSuperPersistentType() { - PersistentType spt = this.buildSuperPersistentType_(); - if (spt == null) { - return null; - } - // check for circular inheritance - return CollectionTools.contains(spt.inheritanceHierarchy(), this) ? null : spt; - } - - protected PersistentType buildSuperPersistentType_() { - return (this.javaPersistentType == null) ? null : this.javaPersistentType.getSuperPersistentType(); - } - - - // ********** inheritance ********** - - public Iterator inheritanceHierarchy() { - return this.getInheritanceHierarchy().iterator(); - } - - public Iterable getInheritanceHierarchy() { - return this.getInheritanceHierarchyOf(this); - } - - public Iterator ancestors() { - return this.getAncestors().iterator(); - } - - public Iterable getAncestors() { - return this.getInheritanceHierarchyOf(this.superPersistentType); - } - - protected Iterable getInheritanceHierarchyOf(PersistentType start) { - // using a chain iterable to traverse up the inheritance tree - return new ChainIterable(start) { - @Override - protected PersistentType nextLink(PersistentType persistentType) { - return persistentType.getSuperPersistentType(); - } - }; - } - - - // ********** declaring type name ********** - - public String getDeclaringTypeName() { - return this.declaringTypeName; - } - - protected void setDeclaringTypeName(String name) { - String old = this.declaringTypeName; - this.declaringTypeName = name; - this.firePropertyChanged(DECLARING_TYPE_NAME_PROPERTY, old, name); - } - - protected String buildDeclaringTypeName() { - return this.isJpa2_0Compatible() ? this.buildDeclaringTypeName_() : null; - } - - protected String buildDeclaringTypeName_() { - return (this.javaPersistentType == null) ? - null : ((JavaPersistentType2_0) this.javaPersistentType).getDeclaringTypeName(); - } - - - // ********** metamodel ********** - - protected MetamodelSourceType.Synchronizer buildMetamodelSynchronizer() { - return this.isJpa2_0Compatible() ? - this.getJpaFactory2_0().buildMetamodelSynchronizer(this) : - null; - } - - public IFile getMetamodelFile() { - return (this.javaPersistentType == null) ? null : this.metamodelSynchronizer.getFile(); - } - - public void initializeMetamodel() { - // do nothing - probably shouldn't be called... - } - - public boolean isManaged() { - return true; - } - - /** - * All orm.xml persistent types must be able to generate a static metamodel - * because 1.0 orm.xml files can be referenced from 2.0 persistence.xml files. - */ - public void synchronizeMetamodel(Map> memberTypeTree) { - if (this.javaPersistentType != null) { - this.metamodelSynchronizer.synchronize(memberTypeTree); - } - } - - public void printBodySourceOn(BodySourceWriter pw, Map> memberTypeTree) { - if (this.javaPersistentType != null) { - this.metamodelSynchronizer.printBodySourceOn(pw, memberTypeTree); - } - } - - public void disposeMetamodel() { - // do nothing - probably shouldn't be called... - } - - - // ********** JpaStructureNode implementation ********** - - public String getId() { - return OrmStructureNodes.PERSISTENT_TYPE_ID; - } - - public JpaStructureNode getStructureNode(int textOffset) { - for (OrmPersistentAttribute attribute : this.getSpecifiedAttributes()) { - if (attribute.contains(textOffset)) { - return attribute; - } - } - return this; - } - - public TextRange getSelectionTextRange() { - return this.mapping.getSelectionTextRange(); - } - - public void dispose() { - if (this.javaPersistentType != null) { - this.javaPersistentType.dispose(); - } - for (OrmReadOnlyPersistentAttribute virtualAttribute : this.getVirtualAttributes()) { - virtualAttribute.dispose(); - } - } - - - // ********** PersistentType.Owner implementation ********** - - public AccessType getOverridePersistentTypeAccess() { - if (this.specifiedAccess != null) { - return this.specifiedAccess; - } - - if (this.superPersistentType instanceof OrmPersistentType) { - AccessType accessType = ((OrmPersistentType) this.superPersistentType).getSpecifiedAccess(); - if (accessType != null) { - return accessType; - } - } - - if (this.mapping.isMetadataComplete()) { - AccessType accessType = this.getOwnerDefaultAccess(); - if (accessType != null) { - return accessType; - } - } - - // no override access type - return null; - } - - public AccessType getDefaultPersistentTypeAccess() { - if (this.superPersistentType instanceof OrmPersistentType) { - AccessType accessType = ((OrmPersistentType) this.superPersistentType).getDefaultAccess(); - if (accessType != null) { - return accessType; - } - } - - return this.getOwnerDefaultAccess(); - } - - - //*********** refactoring *********** - - public Iterable createDeleteTypeEdits(IType type) { - return this.isFor(type.getFullyQualifiedName('.')) ? - new SingleElementIterable(this.mapping.createDeleteEdit()) : - EmptyIterable.instance(); - } - - @SuppressWarnings("unchecked") - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable( - this.mapping.createRenameTypeEdits(originalType, newName), - this.createSpecifiedAttributesRenameTypeEdits(originalType, newName) - ); - } - - protected Iterable createSpecifiedAttributesRenameTypeEdits(final IType originalType, final String newName) { - return new CompositeIterable( - new TransformationIterable>(this.getSpecifiedAttributes()) { - @Override - protected Iterable transform(OrmPersistentAttribute persistentAttribute) { - return persistentAttribute.createRenameTypeEdits(originalType, newName); - } - } - ); - } - - @SuppressWarnings("unchecked") - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable( - this.mapping.createMoveTypeEdits(originalType, newPackage), - this.createSpecifiedAttributesMoveTypeEdits(originalType, newPackage) - ); - } - - protected Iterable createSpecifiedAttributesMoveTypeEdits(final IType originalType, final IPackageFragment newPackage) { - return new CompositeIterable( - new TransformationIterable>(this.getSpecifiedAttributes()) { - @Override - protected Iterable transform(OrmPersistentAttribute persistentAttribute) { - return persistentAttribute.createMoveTypeEdits(originalType, newPackage); - } - } - ); - } - - @SuppressWarnings("unchecked") - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable( - this.mapping.createRenamePackageEdits(originalPackage, newName), - this.createSpecifiedAttributesRenamePackageEdits(originalPackage, newName) - ); - } - - protected Iterable createSpecifiedAttributesRenamePackageEdits(final IPackageFragment originalPackage, final String newName) { - return new CompositeIterable( - new TransformationIterable>(this.getSpecifiedAttributes()) { - @Override - protected Iterable transform(OrmPersistentAttribute persistentAttribute) { - return persistentAttribute.createRenamePackageEdits(originalPackage, newName); - } - } - ); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateClass(messages); - this.validateMapping(messages, reporter); - this.validateAttributes(messages, reporter); - } - - protected void validateClass(List messages) { - if (this.javaPersistentType == null) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENT_TYPE_UNRESOLVED_CLASS, - new String[] {this.getName()}, - this, - this.mapping.getClassTextRange() - ) - ); - } - } - - protected void validateMapping(List messages, IReporter reporter) { - try { - this.mapping.validate(messages, reporter); - } catch(Throwable t) { - JptJpaCorePlugin.log(t); - } - } - - protected void validateAttributes(List messages, IReporter reporter) { - for (Iterator stream = this.attributes(); stream.hasNext(); ) { - this.validateAttribute(stream.next(), messages, reporter); - } - } - - protected void validateAttribute(OrmReadOnlyPersistentAttribute attribute, List messages, IReporter reporter) { - try { - attribute.validate(messages, reporter); - } catch(Throwable t) { - JptJpaCorePlugin.log(t); - } - } - - public TextRange getValidationTextRange() { - return this.mapping.getValidationTextRange(); - } - - - // ********** misc ********** - - @Override - public EntityMappings getParent() { - return (EntityMappings) super.getParent(); - } - - protected EntityMappings getEntityMappings() { - return this.getParent(); - } - - public String getDefaultPackage() { - return this.getEntityMappings().getPackage(); - } - - public boolean isFor(String typeName) { - String name = this.getName(); - if (name == null) { - return false; - } - if (name.equals(typeName)) { - return true; - } - String defaultPackage = this.getDefaultPackage(); - if (defaultPackage == null) { - return false; - } - return (defaultPackage + '.' + name).equals(typeName); - } - - public boolean isIn(IPackageFragment packageFragment) { - String packageName = this.getPackageName(); - if (Tools.valuesAreEqual(packageName, packageFragment.getElementName())) { - return true; - } - String defaultPackage = this.getDefaultPackage(); - if (defaultPackage == null) { - return false; - } - packageName = (packageName == null) ? defaultPackage : defaultPackage + '.' + packageName; - return packageName.equals(packageFragment.getElementName()); - } - - protected String getPackageName() { - String className = this.getName(); - if (className == null) { - return null; - } - int lastPeriod = className.lastIndexOf('.'); - return (lastPeriod == -1) ? null : className.substring(0, lastPeriod); - } - - public boolean contains(int textOffset) { - return this.mapping.containsOffset(textOffset); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getName()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java deleted file mode 100644 index 9761ef1cce..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmPrimaryKeyJoinColumn.java +++ /dev/null @@ -1,173 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmPrimaryKeyJoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.db.Column; -import org.eclipse.jpt.jpa.db.Table; - -/** - * orm.xml primary key join column - */ -public class GenericOrmPrimaryKeyJoinColumn - extends AbstractOrmNamedColumn - implements OrmPrimaryKeyJoinColumn -{ - /** @see org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn#AbstractOrmNamedColumn(XmlContextNode, org.eclipse.jpt.jpa.core.context.orm.OrmNamedColumn.Owner, org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlNamedColumn) */ - protected /* final */ XmlPrimaryKeyJoinColumn xmlColumn; // null for default pk join columns - - protected String specifiedReferencedColumnName; - protected String defaultReferencedColumnName; - - - public GenericOrmPrimaryKeyJoinColumn(XmlContextNode parent, OrmBaseJoinColumn.Owner owner, XmlPrimaryKeyJoinColumn xmlColumn) { - super(parent, owner, xmlColumn); - this.specifiedReferencedColumnName = this.buildSpecifiedReferencedColumnName(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedReferencedColumnName_(this.buildSpecifiedReferencedColumnName()); - } - - @Override - public void update() { - super.update(); - this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName()); - } - - - // ********** XML column ********** - - @Override - public XmlPrimaryKeyJoinColumn getXmlColumn() { - return this.xmlColumn; - } - - @Override - protected void setXmlColumn(XmlPrimaryKeyJoinColumn xmlColumn) { - this.xmlColumn = xmlColumn; - } - - /** - * primary key join columns are part of a collection; - * the 'primary-key-join-column' element will be removed/added - * when the XML join column is removed from/added to - * the owner's collection - */ - @Override - protected XmlPrimaryKeyJoinColumn buildXmlColumn() { - throw new IllegalStateException("XML primary key join column is missing"); //$NON-NLS-1$ - } - - /** - * @see #buildXmlColumn() - */ - @Override - protected void removeXmlColumn() { - // do nothing - } - - - // ********** referenced column name ********** - - public String getReferencedColumnName() { - return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName; - } - - public String getSpecifiedReferencedColumnName() { - return this.specifiedReferencedColumnName; - } - - public void setSpecifiedReferencedColumnName(String name) { - this.setSpecifiedReferencedColumnName_(name); - this.xmlColumn.setReferencedColumnName(name); - } - - protected void setSpecifiedReferencedColumnName_(String name) { - String old = this.specifiedReferencedColumnName; - this.specifiedReferencedColumnName = name; - this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedReferencedColumnName() { - return (this.xmlColumn == null) ? null : this.xmlColumn.getReferencedColumnName(); - } - - public String getDefaultReferencedColumnName() { - return this.defaultReferencedColumnName; - } - - protected void setDefaultReferencedColumnName(String name) { - String old = this.defaultReferencedColumnName; - this.defaultReferencedColumnName = name; - this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name); - } - - // TODO not correct when we start supporting - // primary key join columns in 1-1 mappings - protected String buildDefaultReferencedColumnName() { - return this.buildDefaultName(); - } - - - // ********** database stuff ********** - - public Table getReferencedColumnDbTable() { - return this.owner.getReferencedColumnDbTable(); - } - - protected Column getReferencedDbColumn() { - Table table = this.getReferencedColumnDbTable(); - return (table == null) ? null : table.getColumnForIdentifier(this.getReferencedColumnName()); - } - - public boolean referencedColumnIsResolved() { - return this.getReferencedDbColumn() != null; - } - - - // ********** misc ********** - - public void initializeFrom(ReadOnlyPrimaryKeyJoinColumn oldColumn) { - super.initializeFrom(oldColumn); - this.setSpecifiedReferencedColumnName(oldColumn.getSpecifiedReferencedColumnName()); - } - - public boolean isDefault() { - return this.owner.joinColumnIsDefault(this); - } - - @Override - public String getTable() { - return this.owner.getDefaultTableName(); - } - - @Override - protected NamedColumnTextRangeResolver buildTextRangeResolver() { - return new OrmPrimaryKeyJoinColumnTextRangeResolver(this); - } - - public TextRange getReferencedColumnNameTextRange() { - return this.getTextRange(this.xmlColumn.getReferencedColumnNameTextRange()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java deleted file mode 100644 index c4858f9420..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryContainer.java +++ /dev/null @@ -1,366 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.jpa.core.context.NamedNativeQuery; -import org.eclipse.jpt.jpa.core.context.NamedQuery; -import org.eclipse.jpt.jpa.core.context.Query; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmNamedNativeQuery; -import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery; -import org.eclipse.jpt.jpa.core.context.orm.OrmQuery; -import org.eclipse.jpt.jpa.core.context.orm.OrmQueryContainer; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedNativeQuery; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery; -import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryContainer; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml query container - */ -public class GenericOrmQueryContainer - extends AbstractOrmXmlContextNode - implements OrmQueryContainer -{ - protected final XmlQueryContainer xmlQueryContainer; - - protected final Vector namedQueries = new Vector(); - protected NamedQueryContainerAdapter namedQueryContainerAdapter = new NamedQueryContainerAdapter(); - - protected final Vector namedNativeQueries = new Vector(); - protected NamedNativeQueryContainerAdapter namedNativeQueryContainerAdapter = new NamedNativeQueryContainerAdapter(); - - - public GenericOrmQueryContainer(XmlContextNode parent, XmlQueryContainer xmlQueryContainer) { - super(parent); - this.xmlQueryContainer = xmlQueryContainer; - this.initializeNamedQueries(); - this.initializeNamedNativeQueries(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncNamedQueries(); - this.syncNamedNativeQueries(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getNamedQueries()); - this.updateNodes(this.getNamedNativeQueries()); - } - - - // ********** named queries ********** - - public ListIterator namedQueries() { - return this.getNamedQueries().iterator(); - } - - protected ListIterable getNamedQueries() { - return new LiveCloneListIterable(this.namedQueries); - } - - public int namedQueriesSize() { - return this.namedQueries.size(); - } - - public OrmNamedQuery addNamedQuery() { - return this.addNamedQuery(this.namedQueries.size()); - } - - public OrmNamedQuery addNamedQuery(int index) { - XmlNamedQuery xmlQuery = this.buildXmlNamedQuery(); - OrmNamedQuery query = this.addNamedQuery_(index, xmlQuery); - this.xmlQueryContainer.getNamedQueries().add(index, xmlQuery); - return query; - } - - protected XmlNamedQuery buildXmlNamedQuery() { - return OrmFactory.eINSTANCE.createXmlNamedQuery(); - } - - public void removeNamedQuery(NamedQuery namedQuery) { - this.removeNamedQuery(this.namedQueries.indexOf(namedQuery)); - } - - public void removeNamedQuery(int index) { - this.removeNamedQuery_(index); - this.xmlQueryContainer.getNamedQueries().remove(index); - } - - protected void removeNamedQuery_(int index) { - this.removeItemFromList(index, this.namedQueries, NAMED_QUERIES_LIST); - } - - public void moveNamedQuery(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.namedQueries, NAMED_QUERIES_LIST); - this.xmlQueryContainer.getNamedQueries().move(targetIndex, sourceIndex); - } - - protected void initializeNamedQueries() { - for (XmlNamedQuery xmlQuery : this.getXmlNamedQueries()) { - this.namedQueries.add(this.buildNamedQuery(xmlQuery)); - } - } - - protected OrmNamedQuery buildNamedQuery(XmlNamedQuery xmlNamedQuery) { - return this.getContextNodeFactory().buildOrmNamedQuery(this, xmlNamedQuery); - } - - protected void syncNamedQueries() { - ContextContainerTools.synchronizeWithResourceModel(this.namedQueryContainerAdapter); - } - - protected Iterable getXmlNamedQueries() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.xmlQueryContainer.getNamedQueries()); - } - - protected void moveNamedQuery_(int index, OrmNamedQuery namedQuery) { - this.moveItemInList(index, namedQuery, this.namedQueries, NAMED_QUERIES_LIST); - } - - protected OrmNamedQuery addNamedQuery_(int index, XmlNamedQuery xmlNamedQuery) { - OrmNamedQuery query = this.buildNamedQuery(xmlNamedQuery); - this.addItemToList(index, query, this.namedQueries, NAMED_QUERIES_LIST); - return query; - } - - protected void removeNamedQuery_(OrmNamedQuery namedQuery) { - this.removeNamedQuery_(this.namedQueries.indexOf(namedQuery)); - } - - /** - * named query container adapter - */ - protected class NamedQueryContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericOrmQueryContainer.this.getNamedQueries(); - } - public Iterable getResourceElements() { - return GenericOrmQueryContainer.this.getXmlNamedQueries(); - } - public XmlNamedQuery getResourceElement(OrmNamedQuery contextElement) { - return contextElement.getXmlQuery(); - } - public void moveContextElement(int index, OrmNamedQuery element) { - GenericOrmQueryContainer.this.moveNamedQuery_(index, element); - } - public void addContextElement(int index, XmlNamedQuery resourceElement) { - GenericOrmQueryContainer.this.addNamedQuery_(index, resourceElement); - } - public void removeContextElement(OrmNamedQuery element) { - GenericOrmQueryContainer.this.removeNamedQuery_(element); - } - } - - - // ********** named native queries ********** - - public ListIterator namedNativeQueries() { - return this.getNamedNativeQueries().iterator(); - } - - protected ListIterable getNamedNativeQueries() { - return new LiveCloneListIterable(this.namedNativeQueries); - } - - public int namedNativeQueriesSize() { - return this.namedNativeQueries.size(); - } - - public OrmNamedNativeQuery addNamedNativeQuery() { - return this.addNamedNativeQuery(this.namedNativeQueries.size()); - } - - public OrmNamedNativeQuery addNamedNativeQuery(int index) { - XmlNamedNativeQuery xmlQuery = this.buildXmlNamedNativeQuery(); - OrmNamedNativeQuery query = this.addNamedNativeQuery_(index, xmlQuery); - this.xmlQueryContainer.getNamedNativeQueries().add(index, xmlQuery); - return query; - } - - protected XmlNamedNativeQuery buildXmlNamedNativeQuery() { - return OrmFactory.eINSTANCE.createXmlNamedNativeQuery(); - } - - public void removeNamedNativeQuery(NamedNativeQuery namedNativeQuery) { - this.removeNamedNativeQuery(this.namedNativeQueries.indexOf(namedNativeQuery)); - } - - public void removeNamedNativeQuery(int index) { - this.removeNamedNativeQuery_(index); - this.xmlQueryContainer.getNamedNativeQueries().remove(index); - } - - protected void removeNamedNativeQuery_(int index) { - this.removeItemFromList(index, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST); - } - - public void moveNamedNativeQuery(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST); - this.xmlQueryContainer.getNamedNativeQueries().move(targetIndex, sourceIndex); - } - - protected void initializeNamedNativeQueries() { - for (XmlNamedNativeQuery xmlQuery : this.getXmlNamedNativeQueries()) { - this.namedNativeQueries.add(this.buildNamedNativeQuery(xmlQuery)); - } - } - - protected OrmNamedNativeQuery buildNamedNativeQuery(XmlNamedNativeQuery xmlNamedNativeQuery) { - return this.getContextNodeFactory().buildOrmNamedNativeQuery(this, xmlNamedNativeQuery); - } - - protected void syncNamedNativeQueries() { - ContextContainerTools.synchronizeWithResourceModel(this.namedNativeQueryContainerAdapter); - } - - protected Iterable getXmlNamedNativeQueries() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.xmlQueryContainer.getNamedNativeQueries()); - } - - protected void moveNamedNativeQuery_(int index, OrmNamedNativeQuery namedNativeQuery) { - this.moveItemInList(index, namedNativeQuery, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST); - } - - protected OrmNamedNativeQuery addNamedNativeQuery_(int index, XmlNamedNativeQuery xmlNamedNativeQuery) { - OrmNamedNativeQuery query = this.buildNamedNativeQuery(xmlNamedNativeQuery); - this.addItemToList(index, query, this.namedNativeQueries, NAMED_NATIVE_QUERIES_LIST); - return query; - } - - protected void removeNamedNativeQuery_(OrmNamedNativeQuery namedNativeQuery) { - this.removeNamedNativeQuery_(this.namedNativeQueries.indexOf(namedNativeQuery)); - } - - /** - * named native query container adapter - */ - protected class NamedNativeQueryContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericOrmQueryContainer.this.getNamedNativeQueries(); - } - public Iterable getResourceElements() { - return GenericOrmQueryContainer.this.getXmlNamedNativeQueries(); - } - public XmlNamedNativeQuery getResourceElement(OrmNamedNativeQuery contextElement) { - return contextElement.getXmlQuery(); - } - public void moveContextElement(int index, OrmNamedNativeQuery element) { - GenericOrmQueryContainer.this.moveNamedNativeQuery_(index, element); - } - public void addContextElement(int index, XmlNamedNativeQuery resourceElement) { - GenericOrmQueryContainer.this.addNamedNativeQuery_(index, resourceElement); - } - public void removeContextElement(OrmNamedNativeQuery element) { - GenericOrmQueryContainer.this.removeNamedNativeQuery_(element); - } - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateQueries(messages); - } - - protected void validateQueries(List messages) { - for (OrmQuery localQuery : this.getQueries()) { - String name = localQuery.getName(); - if (StringTools.stringIsEmpty(name)){ - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.QUERY_NAME_UNDEFINED, - new String[] {}, - localQuery, - localQuery.getNameTextRange() - ) - ); - } else { - List reportedNames = new ArrayList(); - for (Iterator globalQueries = this.getPersistenceUnit().queries(); globalQueries.hasNext(); ) { - Query globalQuery = globalQueries.next(); - if (localQuery.duplicates(globalQuery) && !reportedNames.contains(name)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.QUERY_DUPLICATE_NAME, - new String[] {name}, - localQuery, - localQuery.getNameTextRange()) - ); - reportedNames.add(name); - } - } - } - String query = localQuery.getQuery(); - if (StringTools.stringIsEmpty(query)){ - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.QUERY_STATEMENT_UNDEFINED, - new String[] {name}, - localQuery, - localQuery.getNameTextRange() - ) - ); - } - } - } - - /** - * Return all the queries, named and named native. - */ - @SuppressWarnings("unchecked") - protected Iterable getQueries() { - return new CompositeIterable( - this.getNamedQueries(), - this.getNamedNativeQueries() - ); - } - - public TextRange getValidationTextRange() { - return this.xmlQueryContainer.getValidationTextRange(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryHint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryHint.java deleted file mode 100644 index 36774ef58d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmQueryHint.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.OrmQuery; -import org.eclipse.jpt.jpa.core.context.orm.OrmQueryHint; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.XmlQueryHint; - -/** - * orm.xml query hint - */ -public class GenericOrmQueryHint - extends AbstractOrmXmlContextNode - implements OrmQueryHint -{ - protected final XmlQueryHint xmlQueryHint; - - protected String name; - protected String value; - - - public GenericOrmQueryHint(OrmQuery parent, XmlQueryHint xmlQueryHint) { - super(parent); - this.xmlQueryHint = xmlQueryHint; - this.name = xmlQueryHint.getName(); - this.value = xmlQueryHint.getValue(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setName_(this.xmlQueryHint.getName()); - this.setValue_(this.xmlQueryHint.getValue()); - } - - - // ********** name ********** - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.setName_(name); - this.xmlQueryHint.setName(name); - } - - protected void setName_(String name) { - String old = this.name; - this.name = name; - this.firePropertyChanged(NAME_PROPERTY, old, name); - } - - - // ********** value ********** - - public String getValue() { - return this.value; - } - - public void setValue(String value) { - this.setValue_(value); - this.xmlQueryHint.setValue(value); - } - - protected void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return this.xmlQueryHint.getValidationTextRange(); - } - - - // ********** miscelleneous ********** - - public XmlQueryHint getXmlQueryHint() { - return this.xmlQueryHint; - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java deleted file mode 100644 index f6a5bc41c6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmReferenceTable.java +++ /dev/null @@ -1,304 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyReferenceTable; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmReferenceTable; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTable; -import org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlReferenceTable; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlJoinColumn; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml join table or collection table - */ -public abstract class GenericOrmReferenceTable - extends AbstractOrmTable - implements OrmReferenceTable -{ - protected final Vector specifiedJoinColumns = new Vector(); - protected final SpecifiedJoinColumnContainerAdapter specifiedJoinColumnContainerAdapter = new SpecifiedJoinColumnContainerAdapter(); - protected final OrmJoinColumn.Owner joinColumnOwner; - - protected OrmJoinColumn defaultJoinColumn; - - - protected GenericOrmReferenceTable(XmlContextNode parent, Owner owner) { - super(parent, owner); - this.joinColumnOwner = this.buildJoinColumnOwner(); - this.initializeSpecifiedJoinColumns(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncSpecifiedJoinColumns(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getSpecifiedJoinColumns()); - this.updateDefaultJoinColumn(); - } - - - // ********** join columns ********** - - public ListIterator joinColumns() { - return this.getJoinColumns().iterator(); - } - - protected ListIterable getJoinColumns() { - return this.hasSpecifiedJoinColumns() ? this.getSpecifiedJoinColumns() : this.getDefaultJoinColumns(); - } - - public int joinColumnsSize() { - return this.hasSpecifiedJoinColumns() ? this.specifiedJoinColumnsSize() : this.getDefaultJoinColumnsSize(); - } - - public void convertDefaultToSpecifiedJoinColumn() { - MappingTools.convertReferenceTableDefaultToSpecifiedJoinColumn(this); - } - - - // ********** specified join columns ********** - - public ListIterator specifiedJoinColumns() { - return this.getSpecifiedJoinColumns().iterator(); - } - - protected ListIterable getSpecifiedJoinColumns() { - return new LiveCloneListIterable(this.specifiedJoinColumns); - } - - public int specifiedJoinColumnsSize() { - return this.specifiedJoinColumns.size(); - } - - public boolean hasSpecifiedJoinColumns() { - return this.specifiedJoinColumns.size() != 0; - } - - public OrmJoinColumn getSpecifiedJoinColumn(int index) { - return this.specifiedJoinColumns.get(index); - } - - public OrmJoinColumn addSpecifiedJoinColumn() { - return this.addSpecifiedJoinColumn(this.specifiedJoinColumns.size()); - } - - public OrmJoinColumn addSpecifiedJoinColumn(int index) { - X xmlTable = this.getXmlTableForUpdate(); - XmlJoinColumn xmlJoinColumn = this.buildXmlJoinColumn(); - OrmJoinColumn joinColumn = this.addSpecifiedJoinColumn_(index, xmlJoinColumn); - xmlTable.getJoinColumns().add(index, xmlJoinColumn); - return joinColumn; - } - - protected XmlJoinColumn buildXmlJoinColumn() { - return OrmFactory.eINSTANCE.createXmlJoinColumn(); - } - - public void removeSpecifiedJoinColumn(JoinColumn joinColumn) { - this.removeSpecifiedJoinColumn(this.specifiedJoinColumns.indexOf(joinColumn)); - } - - public void removeSpecifiedJoinColumn(int index) { - this.removeSpecifiedJoinColumn_(index); - this.getXmlTable().getJoinColumns().remove(index); - this.removeXmlTableIfUnset(); - } - - protected void removeSpecifiedJoinColumn_(int index) { - this.removeItemFromList(index, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - this.getXmlTable().getJoinColumns().move(targetIndex, sourceIndex); - } - - protected void initializeSpecifiedJoinColumns() { - for (XmlJoinColumn xmlJoinColumn : this.getXmlJoinColumns()) { - this.specifiedJoinColumns.add(this.buildJoinColumn(xmlJoinColumn)); - } - } - - protected void syncSpecifiedJoinColumns() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedJoinColumnContainerAdapter); - } - - protected Iterable getXmlJoinColumns() { - X xmlTable = this.getXmlTable(); - return (xmlTable == null) ? - EmptyIterable.instance() : - // clone to reduce chance of concurrency problems - new LiveCloneIterable(xmlTable.getJoinColumns()); - } - - protected void moveSpecifiedJoinColumn_(int index, OrmJoinColumn joinColumn) { - this.moveItemInList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - } - - protected OrmJoinColumn addSpecifiedJoinColumn_(int index, XmlJoinColumn xmlJoinColumn) { - OrmJoinColumn joinColumn = this.buildJoinColumn(xmlJoinColumn); - this.addItemToList(index, joinColumn, this.specifiedJoinColumns, SPECIFIED_JOIN_COLUMNS_LIST); - return joinColumn; - } - - protected void removeSpecifiedJoinColumn_(OrmJoinColumn joinColumn) { - this.removeSpecifiedJoinColumn_(this.specifiedJoinColumns.indexOf(joinColumn)); - } - - /** - * specified join column container adapter - */ - protected class SpecifiedJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericOrmReferenceTable.this.getSpecifiedJoinColumns(); - } - public Iterable getResourceElements() { - return GenericOrmReferenceTable.this.getXmlJoinColumns(); - } - public XmlJoinColumn getResourceElement(OrmJoinColumn contextElement) { - return contextElement.getXmlColumn(); - } - public void moveContextElement(int index, OrmJoinColumn element) { - GenericOrmReferenceTable.this.moveSpecifiedJoinColumn_(index, element); - } - public void addContextElement(int index, XmlJoinColumn resourceElement) { - GenericOrmReferenceTable.this.addSpecifiedJoinColumn_(index, resourceElement); - } - public void removeContextElement(OrmJoinColumn element) { - GenericOrmReferenceTable.this.removeSpecifiedJoinColumn_(element); - } - } - - protected abstract OrmJoinColumn.Owner buildJoinColumnOwner(); - - - // ********** default join column ********** - - public OrmJoinColumn getDefaultJoinColumn() { - return this.defaultJoinColumn; - } - - protected void setDefaultJoinColumn(OrmJoinColumn joinColumn) { - OrmJoinColumn old = this.defaultJoinColumn; - this.defaultJoinColumn = joinColumn; - this.firePropertyChanged(DEFAULT_JOIN_COLUMN_PROPERTY, old, joinColumn); - } - - protected ListIterable getDefaultJoinColumns() { - return (this.defaultJoinColumn != null) ? - new SingleElementListIterable(this.defaultJoinColumn) : - EmptyListIterable.instance(); - } - - protected int getDefaultJoinColumnsSize() { - return (this.defaultJoinColumn == null) ? 0 : 1; - } - - protected void updateDefaultJoinColumn() { - if (this.buildsDefaultJoinColumn()) { - if (this.defaultJoinColumn == null) { - this.setDefaultJoinColumn(this.buildJoinColumn(null)); - } else { - this.defaultJoinColumn.update(); - } - } else { - this.setDefaultJoinColumn(null); - } - } - - protected boolean buildsDefaultJoinColumn() { - return ! this.hasSpecifiedJoinColumns(); - } - - - // ********** misc ********** - - protected void initializeFrom(ReadOnlyReferenceTable oldTable) { - super.initializeFrom(oldTable); - for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(oldTable.specifiedJoinColumns())) { - this.addSpecifiedJoinColumn().initializeFrom(joinColumn); - } - } - - protected void initializeFromVirtual(ReadOnlyReferenceTable virtualTable) { - super.initializeFromVirtual(virtualTable); - for (ReadOnlyJoinColumn joinColumn : CollectionTools.iterable(virtualTable.joinColumns())) { - this.addSpecifiedJoinColumn().initializeFromVirtual(joinColumn); - } - } - - protected OrmJoinColumn buildJoinColumn(XmlJoinColumn xmlJoinColumn) { - return this.getContextNodeFactory().buildOrmJoinColumn(this, this.joinColumnOwner, xmlJoinColumn); - } - - @Override - protected String buildDefaultSchema() { - return this.getContextDefaultSchema(); - } - - @Override - protected String buildDefaultCatalog() { - return this.getContextDefaultCatalog(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - boolean continueValidating = this.buildTableValidator().validate(messages, reporter); - - //join column validation will handle the check for whether to validate against the database - //some validation messages are not database specific. If the database validation for the - //table fails we will stop there and not validate the join columns at all - if (continueValidating) { - this.validateJoinColumns(messages, reporter); - } - } - - protected void validateJoinColumns(List messages, IReporter reporter) { - this.validateJoinColumns(this.getJoinColumns(), messages, reporter); - } - - protected void validateJoinColumns(Iterable joinColumns, List messages, IReporter reporter) { - for (OrmJoinColumn joinColumn : joinColumns) { - joinColumn.validate(messages, reporter); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java deleted file mode 100644 index 39971d0abb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSecondaryTable.java +++ /dev/null @@ -1,418 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.List; -import java.util.ListIterator; -import java.util.Vector; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.jpa.core.context.BaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.PrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlySecondaryTable; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmEntity; -import org.eclipse.jpt.jpa.core.context.orm.OrmPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmSecondaryTable; -import org.eclipse.jpt.jpa.core.internal.context.BaseJoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTable; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.SecondaryTablePrimaryKeyJoinColumnValidator; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlSecondaryTable; -import org.eclipse.jpt.jpa.db.Table; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * orm.xml secondary table - */ -public class GenericOrmSecondaryTable - extends AbstractOrmTable - implements OrmSecondaryTable -{ - /** @see AbstractOrmTable#AbstractOrmTable(org.eclipse.jpt.jpa.core.context.XmlContextNode, org.eclipse.jpt.jpa.core.context.Table.Owner, org.eclipse.jpt.jpa.core.resource.orm.AbstractXmlTable) */ - protected /* final */ XmlSecondaryTable xmlSecondaryTable; - - protected final Vector specifiedPrimaryKeyJoinColumns = new Vector(); - protected final SpecifiedPrimaryKeyJoinColumnContainerAdapter specifiedPrimaryKeyJoinColumnContainerAdapter = new SpecifiedPrimaryKeyJoinColumnContainerAdapter(); - protected final OrmBaseJoinColumn.Owner primaryKeyJoinColumnOwner; - - protected OrmPrimaryKeyJoinColumn defaultPrimaryKeyJoinColumn; - - - public GenericOrmSecondaryTable(OrmEntity parent, Owner owner, XmlSecondaryTable xmlSecondaryTable) { - super(parent, owner, xmlSecondaryTable); - this.primaryKeyJoinColumnOwner = this.buildPrimaryKeyJoinColumnOwner(); - this.initializeSpecifiedPrimaryKeyJoinColumns(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncSpecifiedPrimaryKeyJoinColumns(); - if (this.defaultPrimaryKeyJoinColumn != null) { - this.defaultPrimaryKeyJoinColumn.synchronizeWithResourceModel(); - } - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getSpecifiedPrimaryKeyJoinColumns()); - this.updateDefaultPrimaryKeyJoinColumn(); - } - - - // ********** XML table ********** - - @Override - public XmlSecondaryTable getXmlTable() { - return this.xmlSecondaryTable; - } - - /** - * @see AbstractOrmTable - */ - @Override - protected void setXmlTable(XmlSecondaryTable xmlTable) { - this.xmlSecondaryTable = xmlTable; - } - - /** - * secondary tables are part of a collection; - * the 'secondary-table' element will be removed from/added - * when the XML secondary table is removed/added to - * the XML entity's collection - */ - @Override - protected XmlSecondaryTable buildXmlTable() { - throw new IllegalStateException("XML secondary table is missing"); //$NON-NLS-1$ - } - - /** - * @see #buildXmlTable() - */ - @Override - protected void removeXmlTable() { - // do nothing - } - - - // ********** primary key join columns ********** - - public ListIterator primaryKeyJoinColumns() { - return this.getPrimaryKeyJoinColumns().iterator(); - } - - protected ListIterable getPrimaryKeyJoinColumns() { - return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.getSpecifiedPrimaryKeyJoinColumns() : this.getDefaultPrimaryKeyJoinColumns(); - } - - public int primaryKeyJoinColumnsSize() { - return this.hasSpecifiedPrimaryKeyJoinColumns() ? this.specifiedPrimaryKeyJoinColumnsSize() : this.getDefaultPrimaryKeyJoinColumnsSize(); - } - - - // ********** specified primary key join columns ********** - - public ListIterator specifiedPrimaryKeyJoinColumns() { - return this.getSpecifiedPrimaryKeyJoinColumns().iterator(); - } - - public ListIterable getSpecifiedPrimaryKeyJoinColumns() { - return new LiveCloneListIterable(this.specifiedPrimaryKeyJoinColumns); - } - - public int specifiedPrimaryKeyJoinColumnsSize() { - return this.specifiedPrimaryKeyJoinColumns.size(); - } - - protected boolean hasSpecifiedPrimaryKeyJoinColumns() { - return this.specifiedPrimaryKeyJoinColumns.size() != 0; - } - - public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn() { - return this.addSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.size()); - } - - public OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn(int index) { - XmlPrimaryKeyJoinColumn xmlJoinColumn = this.buildXmlPrimaryKeyJoinColumn(); - OrmPrimaryKeyJoinColumn joinColumn = this.addSpecifiedPrimaryKeyJoinColumn_(index, xmlJoinColumn); - this.xmlSecondaryTable.getPrimaryKeyJoinColumns().add(index, xmlJoinColumn); - return joinColumn; - } - - protected XmlPrimaryKeyJoinColumn buildXmlPrimaryKeyJoinColumn() { - return OrmFactory.eINSTANCE.createXmlPrimaryKeyJoinColumn(); - } - - public void removeSpecifiedPrimaryKeyJoinColumn(PrimaryKeyJoinColumn joinColumn) { - this.removeSpecifiedPrimaryKeyJoinColumn(this.specifiedPrimaryKeyJoinColumns.indexOf(joinColumn)); - } - - public void removeSpecifiedPrimaryKeyJoinColumn(int index) { - this.removeSpecifiedPrimaryKeyJoinColumn_(index); - this.xmlSecondaryTable.getPrimaryKeyJoinColumns().remove(index); - } - - protected void removeSpecifiedPrimaryKeyJoinColumn_(int index) { - this.removeItemFromList(index, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - public void moveSpecifiedPrimaryKeyJoinColumn(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - this.xmlSecondaryTable.getPrimaryKeyJoinColumns().move(targetIndex, sourceIndex); - } - - protected void initializeSpecifiedPrimaryKeyJoinColumns() { - for (XmlPrimaryKeyJoinColumn xmlJoinColumn : this.getXmlPrimaryKeyJoinColumns()) { - this.specifiedPrimaryKeyJoinColumns.add(this.buildPrimaryKeyJoinColumn(xmlJoinColumn)); - } - } - - protected void syncSpecifiedPrimaryKeyJoinColumns() { - ContextContainerTools.synchronizeWithResourceModel(this.specifiedPrimaryKeyJoinColumnContainerAdapter); - } - - protected Iterable getXmlPrimaryKeyJoinColumns() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.xmlSecondaryTable.getPrimaryKeyJoinColumns()); - } - - protected void moveSpecifiedPrimaryKeyJoinColumn_(int index, OrmPrimaryKeyJoinColumn joinColumn) { - this.moveItemInList(index, joinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - } - - protected OrmPrimaryKeyJoinColumn addSpecifiedPrimaryKeyJoinColumn_(int index, XmlPrimaryKeyJoinColumn xmlJoinColumn) { - OrmPrimaryKeyJoinColumn joinColumn = this.buildPrimaryKeyJoinColumn(xmlJoinColumn); - this.addItemToList(index, joinColumn, this.specifiedPrimaryKeyJoinColumns, SPECIFIED_PRIMARY_KEY_JOIN_COLUMNS_LIST); - return joinColumn; - } - - protected void removeSpecifiedPrimaryKeyJoinColumn_(OrmPrimaryKeyJoinColumn joinColumn) { - this.removeSpecifiedPrimaryKeyJoinColumn_(this.specifiedPrimaryKeyJoinColumns.indexOf(joinColumn)); - } - - /** - * specified primary key join column container adapter - */ - protected class SpecifiedPrimaryKeyJoinColumnContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericOrmSecondaryTable.this.getSpecifiedPrimaryKeyJoinColumns(); - } - public Iterable getResourceElements() { - return GenericOrmSecondaryTable.this.getXmlPrimaryKeyJoinColumns(); - } - public XmlPrimaryKeyJoinColumn getResourceElement(OrmPrimaryKeyJoinColumn contextElement) { - return contextElement.getXmlColumn(); - } - public void moveContextElement(int index, OrmPrimaryKeyJoinColumn element) { - GenericOrmSecondaryTable.this.moveSpecifiedPrimaryKeyJoinColumn_(index, element); - } - public void addContextElement(int index, XmlPrimaryKeyJoinColumn resourceElement) { - GenericOrmSecondaryTable.this.addSpecifiedPrimaryKeyJoinColumn_(index, resourceElement); - } - public void removeContextElement(OrmPrimaryKeyJoinColumn element) { - GenericOrmSecondaryTable.this.removeSpecifiedPrimaryKeyJoinColumn_(element); - } - } - - protected OrmBaseJoinColumn.Owner buildPrimaryKeyJoinColumnOwner() { - return new PrimaryKeyJoinColumnOwner(); - } - - - // ********** default primary key join column ********** - - public OrmPrimaryKeyJoinColumn getDefaultPrimaryKeyJoinColumn() { - return this.defaultPrimaryKeyJoinColumn; - } - - protected void setDefaultPrimaryKeyJoinColumn(OrmPrimaryKeyJoinColumn joinColumn) { - OrmPrimaryKeyJoinColumn old = this.defaultPrimaryKeyJoinColumn; - this.defaultPrimaryKeyJoinColumn = joinColumn; - this.firePropertyChanged(DEFAULT_PRIMARY_KEY_JOIN_COLUMN, old, joinColumn); - } - - protected ListIterable getDefaultPrimaryKeyJoinColumns() { - return (this.defaultPrimaryKeyJoinColumn != null) ? - new SingleElementListIterable(this.defaultPrimaryKeyJoinColumn) : - EmptyListIterable.instance(); - } - - protected int getDefaultPrimaryKeyJoinColumnsSize() { - return (this.defaultPrimaryKeyJoinColumn == null) ? 0 : 1; - } - - protected void updateDefaultPrimaryKeyJoinColumn() { - if (this.buildsDefaultPrimaryKeyJoinColumn()) { - if (this.defaultPrimaryKeyJoinColumn == null) { - this.setDefaultPrimaryKeyJoinColumn(this.buildPrimaryKeyJoinColumn(null)); - } else { - this.defaultPrimaryKeyJoinColumn.update(); - } - } else { - this.setDefaultPrimaryKeyJoinColumn(null); - } - } - - protected boolean buildsDefaultPrimaryKeyJoinColumn() { - return ! this.hasSpecifiedPrimaryKeyJoinColumns(); - } - - - // ********** misc ********** - - @Override - public OrmEntity getParent() { - return (OrmEntity) super.getParent(); - } - - protected OrmEntity getEntity() { - return this.getParent(); - } - - public boolean isVirtual() { - return false; - } - - public void initializeFrom(ReadOnlySecondaryTable oldSecondaryTable) { - super.initializeFrom(oldSecondaryTable); - for (ReadOnlyPrimaryKeyJoinColumn pkJoinColumn : CollectionTools.iterable(oldSecondaryTable.specifiedPrimaryKeyJoinColumns())) { - this.addSpecifiedPrimaryKeyJoinColumn().initializeFrom(pkJoinColumn); - } - } - - protected OrmPrimaryKeyJoinColumn buildPrimaryKeyJoinColumn(XmlPrimaryKeyJoinColumn xmlJoinColumn) { - return this.getContextNodeFactory().buildOrmPrimaryKeyJoinColumn(this, this.primaryKeyJoinColumnOwner, xmlJoinColumn); - } - - - // ********** defaults ********** - - /** - * a secondary table doesn't have a default name - */ - @Override - protected String buildDefaultName() { - return null; - } - - @Override - protected String buildDefaultSchema() { - return this.getContextDefaultSchema(); - } - - @Override - protected String buildDefaultCatalog() { - return this.getContextDefaultCatalog(); - } - - - // ********** validation ********** - - public boolean validatesAgainstDatabase() { - return this.connectionProfileIsActive(); - } - - @Override - public void validate(List messages, IReporter reporter) { - boolean continueValidating = this.buildTableValidator().validate(messages, reporter); - - //join column validation will handle the check for whether to validate against the database - //some validation messages are not database specific. If the database validation for the - //table fails we will stop there and not validate the join columns at all - if (continueValidating) { - for (OrmPrimaryKeyJoinColumn pkJoinColumn : this.getPrimaryKeyJoinColumns()) { - pkJoinColumn.validate(messages, reporter); - } - } - } - - - // ********** primary key join column owner adapter ********** - - protected class PrimaryKeyJoinColumnOwner - implements OrmBaseJoinColumn.Owner - { - protected OrmEntity getEntity() { - return GenericOrmSecondaryTable.this.getEntity(); - } - - public TypeMapping getTypeMapping() { - return this.getEntity(); - } - - public String getDefaultTableName() { - return GenericOrmSecondaryTable.this.getName(); - } - - public String getDefaultColumnName() { - if (this.joinColumnsSize() != 1) { - return null; - } - Entity parentEntity = this.getEntity().getParentEntity(); - return (parentEntity != null) ? - parentEntity.getPrimaryKeyColumnName() : - this.getEntity().getPrimaryKeyColumnName(); - } - - public Table resolveDbTable(String tableName) { - return GenericOrmSecondaryTable.this.getDbTable(); - } - - public int joinColumnsSize() { - return GenericOrmSecondaryTable.this.primaryKeyJoinColumnsSize(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return GenericOrmSecondaryTable.this.defaultPrimaryKeyJoinColumn == joinColumn; - } - - public Table getReferencedColumnDbTable() { - return this.getTypeMapping().getPrimaryDbTable(); - } - - public TextRange getValidationTextRange() { - return GenericOrmSecondaryTable.this.getValidationTextRange(); - } - - protected boolean isSecondaryTableVirtual() { - return GenericOrmSecondaryTable.this.isVirtual(); - } - - protected String getSecondaryTableName() { - return GenericOrmSecondaryTable.this.getName(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new SecondaryTablePrimaryKeyJoinColumnValidator(GenericOrmSecondaryTable.this, (BaseJoinColumn) column, this, (BaseJoinColumnTextRangeResolver) textRangeResolver); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java deleted file mode 100644 index 5e56c71cc4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmSequenceGenerator.java +++ /dev/null @@ -1,44 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmSequenceGenerator; -import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator; - -/** - * orm.xml sequence generator - */ -public class GenericOrmSequenceGenerator - extends AbstractOrmSequenceGenerator -{ - public GenericOrmSequenceGenerator(XmlContextNode parent, XmlSequenceGenerator xmlSequenceGenerator) { - super(parent, xmlSequenceGenerator); - } - - // ********** database stuff ********** - - /** - * The JPA 1.0 spec does not allow a sequence to specify a catalog. - */ - @Override - protected String getCatalog() { - return this.getContextDefaultCatalog(); - } - - /** - * The JPA 1.0 spec does not allow a sequence to specify a schema. - */ - @Override - protected String getSchema() { - return this.getContextDefaultSchema(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTable.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTable.java deleted file mode 100644 index 0832952ada..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTable.java +++ /dev/null @@ -1,88 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmEntity; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmTable; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntity; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTable; - -/** - * orm.xml table - */ -public class GenericOrmTable - extends AbstractOrmTable -{ - public GenericOrmTable(OrmEntity parent, Owner owner) { - super(parent, owner); - } - - - // ********** XML table ********** - - @Override - protected XmlTable getXmlTable() { - return this.getXmlEntity().getTable(); - } - - @Override - protected XmlTable buildXmlTable() { - XmlTable xmlTable = OrmFactory.eINSTANCE.createXmlTable(); - this.getXmlEntity().setTable(xmlTable); - return xmlTable; - } - - @Override - protected void removeXmlTable() { - this.getXmlEntity().setTable(null); - } - - protected XmlEntity getXmlEntity() { - return this.getEntity().getXmlTypeMapping(); - } - - - // ********** defaults ********** - - @Override - protected String buildDefaultName() { - return this.getEntity().getDefaultTableName(); - } - - @Override - protected String buildDefaultSchema() { - return this.getEntity().getDefaultSchema(); - } - - @Override - protected String buildDefaultCatalog() { - return this.getEntity().getDefaultCatalog(); - } - - - // ********** validation ********** - - public boolean validatesAgainstDatabase() { - return this.connectionProfileIsActive(); - } - - - // ********** misc ********** - - @Override - public OrmEntity getParent() { - return (OrmEntity) super.getParent(); - } - - protected OrmEntity getEntity() { - return this.getParent(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java deleted file mode 100644 index 9805b186f0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTableGenerator.java +++ /dev/null @@ -1,440 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.Iterator; -import java.util.Vector; - -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.jpa.core.context.UniqueConstraint; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmTableGenerator; -import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint; -import org.eclipse.jpt.jpa.core.internal.context.ContextContainerTools; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmGenerator; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTableGenerator; -import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint; -import org.eclipse.jpt.jpa.db.Schema; -import org.eclipse.jpt.jpa.db.Table; - -/** - * orm.xml table generator - */ -public class GenericOrmTableGenerator - extends AbstractOrmGenerator - implements OrmTableGenerator, UniqueConstraint.Owner -{ - protected String specifiedTable; - protected String defaultTable; - - protected String specifiedSchema; - protected String defaultSchema; - - protected String specifiedCatalog; - protected String defaultCatalog; - - protected String specifiedPkColumnName; - protected String defaultPkColumnName; - - protected String specifiedValueColumnName; - protected String defaultValueColumnName; - - protected String specifiedPkColumnValue; - protected String defaultPkColumnValue; - - protected final Vector uniqueConstraints = new Vector(); - protected final UniqueConstraintContainerAdapter uniqueConstraintContainerAdapter = new UniqueConstraintContainerAdapter(); - - - // ********** constructor ********** - - public GenericOrmTableGenerator(XmlContextNode parent, XmlTableGenerator xmlTableGenerator) { - super(parent, xmlTableGenerator); - this.specifiedTable = xmlTableGenerator.getTable(); - this.specifiedSchema = xmlTableGenerator.getSchema(); - this.specifiedCatalog = xmlTableGenerator.getCatalog(); - this.specifiedPkColumnName = xmlTableGenerator.getPkColumnName(); - this.specifiedValueColumnName = xmlTableGenerator.getValueColumnName(); - this.specifiedPkColumnValue = xmlTableGenerator.getPkColumnValue(); - this.initializeUniqueContraints(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedTable_(this.xmlGenerator.getTable()); - this.setSpecifiedSchema_(this.xmlGenerator.getSchema()); - this.setSpecifiedCatalog_(this.xmlGenerator.getCatalog()); - this.setSpecifiedPkColumnName_(this.xmlGenerator.getPkColumnName()); - this.setSpecifiedValueColumnName_(this.xmlGenerator.getValueColumnName()); - this.setSpecifiedPkColumnValue_(this.xmlGenerator.getPkColumnValue()); - this.syncUniqueConstraints(); - } - - @Override - public void update() { - super.update(); - this.setDefaultTable(this.buildDefaultTable()); - this.setDefaultSchema(this.buildDefaultSchema()); - this.setDefaultCatalog(this.buildDefaultCatalog()); - this.setDefaultPkColumnName(this.buildDefaultPkColumnName()); - this.setDefaultValueColumnName(this.buildDefaultValueColumnName()); - this.setDefaultPkColumnValue(this.buildDefaultPkColumnValue()); - this.updateNodes(this.getUniqueConstraints()); - } - - - // ********** initial value ********** - - @Override - protected int buildDefaultInitialValue() { - return DEFAULT_INITIAL_VALUE; - } - - - // ********** table ********** - - public String getTable() { - return (this.specifiedTable != null) ? this.specifiedTable : this.defaultTable; - } - - public String getSpecifiedTable() { - return this.specifiedTable; - } - - public void setSpecifiedTable(String table) { - this.setSpecifiedTable_(table); - this.xmlGenerator.setTable(table); - } - - protected void setSpecifiedTable_(String table) { - String old = this.specifiedTable; - this.specifiedTable = table; - this.firePropertyChanged(SPECIFIED_TABLE_PROPERTY, old, table); - } - - public String getDefaultTable() { - return this.defaultTable; - } - - protected void setDefaultTable(String table) { - String old = this.defaultTable; - this.defaultTable = table; - this.firePropertyChanged(DEFAULT_TABLE_PROPERTY, old, table); - } - - protected String buildDefaultTable() { - return null; // TODO the default table is determined by the runtime provider... - } - - public Table getDbTable() { - Schema dbSchema = this.getDbSchema(); - return (dbSchema == null) ? null : dbSchema.getTableForIdentifier(this.getTable()); - } - - - // ********** schema ********** - - @Override - public String getSchema() { - return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema; - } - - public String getSpecifiedSchema() { - return this.specifiedSchema; - } - - public void setSpecifiedSchema(String schema) { - this.setSpecifiedSchema_(schema); - this.xmlGenerator.setSchema(schema); - } - - protected void setSpecifiedSchema_(String schema) { - String old = this.specifiedSchema; - this.specifiedSchema = schema; - this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema); - } - - public String getDefaultSchema() { - return this.defaultSchema; - } - - protected void setDefaultSchema(String schema) { - String old = this.defaultSchema; - this.defaultSchema = schema; - this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema); - } - - protected String buildDefaultSchema() { - return this.getContextDefaultSchema(); - } - - - // ********** catalog ********** - - @Override - public String getCatalog() { - return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog; - } - - public String getSpecifiedCatalog() { - return this.specifiedCatalog; - } - - public void setSpecifiedCatalog(String catalog) { - this.setSpecifiedCatalog_(catalog); - this.xmlGenerator.setCatalog(catalog); - } - - protected void setSpecifiedCatalog_(String catalog) { - String old = this.specifiedCatalog; - this.specifiedCatalog = catalog; - this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog); - } - - public String getDefaultCatalog() { - return this.defaultCatalog; - } - - protected void setDefaultCatalog(String catalog) { - String old = this.defaultCatalog; - this.defaultCatalog = catalog; - this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog); - } - - protected String buildDefaultCatalog() { - return this.getContextDefaultCatalog(); - } - - - // ********** primary key column name ********** - - public String getPkColumnName() { - return (this.specifiedPkColumnName != null) ? this.specifiedPkColumnName : this.defaultPkColumnName; - } - - public String getSpecifiedPkColumnName() { - return this.specifiedPkColumnName; - } - - public void setSpecifiedPkColumnName(String name) { - this.setSpecifiedPkColumnName_(name); - this.xmlGenerator.setPkColumnName(name); - } - - protected void setSpecifiedPkColumnName_(String name) { - String old = this.specifiedPkColumnName; - this.specifiedPkColumnName = name; - this.firePropertyChanged(SPECIFIED_PK_COLUMN_NAME_PROPERTY, old, name); - } - - public String getDefaultPkColumnName() { - return this.defaultPkColumnName; - } - - protected void setDefaultPkColumnName(String name) { - String old = this.defaultPkColumnName; - this.defaultPkColumnName = name; - this.firePropertyChanged(DEFAULT_PK_COLUMN_NAME_PROPERTY, old, name); - } - - protected String buildDefaultPkColumnName() { - return null; // TODO the default pk column name is determined by the runtime provider... - } - - - // ********** value column name ********** - - public String getValueColumnName() { - return (this.specifiedValueColumnName != null) ? this.specifiedValueColumnName : this.defaultValueColumnName; - } - - public String getSpecifiedValueColumnName() { - return this.specifiedValueColumnName; - } - - public void setSpecifiedValueColumnName(String name) { - this.setSpecifiedValueColumnName_(name); - this.xmlGenerator.setValueColumnName(name); - } - - protected void setSpecifiedValueColumnName_(String name) { - String old = this.specifiedValueColumnName; - this.specifiedValueColumnName = name; - this.firePropertyChanged(SPECIFIED_VALUE_COLUMN_NAME_PROPERTY, old, name); - } - - public String getDefaultValueColumnName() { - return this.defaultValueColumnName; - } - - protected void setDefaultValueColumnName(String name) { - String old = this.defaultValueColumnName; - this.defaultValueColumnName = name; - this.firePropertyChanged(DEFAULT_VALUE_COLUMN_NAME_PROPERTY, old, name); - } - - protected String buildDefaultValueColumnName() { - return null; // TODO the default value column name is determined by the runtime provider... - } - - - // ********** primary key column value ********** - - public String getPkColumnValue() { - return (this.specifiedPkColumnValue != null) ? this.specifiedPkColumnValue : this.defaultPkColumnValue; - } - - public String getSpecifiedPkColumnValue() { - return this.specifiedPkColumnValue; - } - - public void setSpecifiedPkColumnValue(String value) { - this.setSpecifiedPkColumnValue_(value); - this.xmlGenerator.setPkColumnValue(value); - } - - protected void setSpecifiedPkColumnValue_(String value) { - String old = this.specifiedPkColumnValue; - this.specifiedPkColumnValue = value; - this.firePropertyChanged(SPECIFIED_PK_COLUMN_VALUE_PROPERTY, old, value); - } - - public String getDefaultPkColumnValue() { - return this.defaultPkColumnValue; - } - - protected void setDefaultPkColumnValue(String value) { - String old = this.defaultPkColumnValue; - this.defaultPkColumnValue = value; - this.firePropertyChanged(DEFAULT_PK_COLUMN_VALUE_PROPERTY, old, value); - } - - protected String buildDefaultPkColumnValue() { - return null; // TODO the default pk column value is determined by the runtime provider... - } - - - // ********** unique constraints ********** - - public Iterable getUniqueConstraints() { - return new LiveCloneIterable(this.uniqueConstraints); - } - - public int getUniqueConstraintsSize() { - return this.uniqueConstraints.size(); - } - - public OrmUniqueConstraint addUniqueConstraint() { - return this.addUniqueConstraint(this.uniqueConstraints.size()); - } - - public OrmUniqueConstraint addUniqueConstraint(int index) { - XmlUniqueConstraint xmlConstraint = this.buildXmlUniqueConstraint(); - OrmUniqueConstraint constraint = this.addUniqueConstraint_(index, xmlConstraint); - this.xmlGenerator.getUniqueConstraints().add(index, xmlConstraint); - return constraint; - } - - protected XmlUniqueConstraint buildXmlUniqueConstraint() { - return OrmFactory.eINSTANCE.createXmlUniqueConstraint(); - } - - public void removeUniqueConstraint(UniqueConstraint uniqueConstraint) { - this.removeUniqueConstraint(this.uniqueConstraints.indexOf(uniqueConstraint)); - } - - public void removeUniqueConstraint(int index) { - this.removeUniqueConstraint_(index); - this.xmlGenerator.getUniqueConstraints().remove(index); - } - - protected void removeUniqueConstraint_(int index) { - this.removeItemFromList(index, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - } - - public void moveUniqueConstraint(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - this.xmlGenerator.getUniqueConstraints().move(targetIndex, sourceIndex); - } - - protected void initializeUniqueContraints() { - for (XmlUniqueConstraint constraint : this.getXmlUniqueConstraints()) { - this.uniqueConstraints.add(this.buildUniqueConstraint(constraint)); - } - } - - protected OrmUniqueConstraint buildUniqueConstraint(XmlUniqueConstraint resourceUniqueConstraint) { - return this.getContextNodeFactory().buildOrmUniqueConstraint(this, this, resourceUniqueConstraint); - } - - protected void syncUniqueConstraints() { - ContextContainerTools.synchronizeWithResourceModel(this.uniqueConstraintContainerAdapter); - } - - protected Iterable getXmlUniqueConstraints() { - // clone to reduce chance of concurrency problems - return new LiveCloneIterable(this.xmlGenerator.getUniqueConstraints()); - } - - protected void moveUniqueConstraint_(int index, OrmUniqueConstraint uniqueConstraint) { - this.moveItemInList(index, uniqueConstraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - } - - protected OrmUniqueConstraint addUniqueConstraint_(int index, XmlUniqueConstraint xmlConstraint) { - OrmUniqueConstraint constraint = this.buildUniqueConstraint(xmlConstraint); - this.addItemToList(index, constraint, this.uniqueConstraints, UNIQUE_CONSTRAINTS_LIST); - return constraint; - } - - protected void removeUniqueConstraint_(OrmUniqueConstraint uniqueConstraint) { - this.removeUniqueConstraint_(this.uniqueConstraints.indexOf(uniqueConstraint)); - } - - /** - * unique constraint container adapter - */ - protected class UniqueConstraintContainerAdapter - implements ContextContainerTools.Adapter - { - public Iterable getContextElements() { - return GenericOrmTableGenerator.this.getUniqueConstraints(); - } - public Iterable getResourceElements() { - return GenericOrmTableGenerator.this.getXmlUniqueConstraints(); - } - public XmlUniqueConstraint getResourceElement(OrmUniqueConstraint contextElement) { - return contextElement.getXmlUniqueConstraint(); - } - public void moveContextElement(int index, OrmUniqueConstraint element) { - GenericOrmTableGenerator.this.moveUniqueConstraint_(index, element); - } - public void addContextElement(int index, XmlUniqueConstraint resourceElement) { - GenericOrmTableGenerator.this.addUniqueConstraint_(index, resourceElement); - } - public void removeContextElement(OrmUniqueConstraint element) { - GenericOrmTableGenerator.this.removeUniqueConstraint_(element); - } - } - - - // ********** UniqueConstraint.Owner implementation ********** - - public Iterator candidateUniqueConstraintColumnNames() { - org.eclipse.jpt.jpa.db.Table dbTable = this.getDbTable(); - return (dbTable != null) ? dbTable.getSortedColumnIdentifiers().iterator() : EmptyIterator.instance(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java deleted file mode 100644 index c95d8743e9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTemporalConverter.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.TemporalConverter; -import org.eclipse.jpt.jpa.core.context.TemporalType; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter; -import org.eclipse.text.edits.ReplaceEdit; - -public class GenericOrmTemporalConverter - extends AbstractOrmConverter - implements OrmTemporalConverter -{ - protected TemporalType temporalType; - - - public GenericOrmTemporalConverter(OrmAttributeMapping parent) { - super(parent); - this.temporalType = this.buildTemporalType(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setTemporalType_(this.buildTemporalType()); - } - - - // ********** temporal type ********** - - public TemporalType getTemporalType() { - return this.temporalType; - } - - public void setTemporalType(TemporalType temporalType) { - this.setTemporalType_(temporalType); - this.setXmlTemporal(temporalType); - } - - protected void setTemporalType_(TemporalType temporalType) { - TemporalType old = this.temporalType; - this.temporalType = temporalType; - this.firePropertyChanged(TEMPORAL_TYPE_PROPERTY, old, temporalType); - } - - protected void setXmlTemporal(TemporalType temporalType) { - this.getXmlConvertibleMapping().setTemporal(TemporalType.toOrmResourceModel(temporalType)); - } - - protected TemporalType buildTemporalType() { - return TemporalType.fromOrmResourceModel(this.getXmlConvertibleMapping().getTemporal()); - } - - - // ********** misc ********** - - public Class getType() { - return TemporalConverter.class; - } - - public void initialize() { - // start with DATE(?) - this.temporalType = TemporalType.DATE; - this.setXmlTemporal(this.temporalType); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return this.getXmlConvertibleMapping().getTemporalTextRange(); - } - - - // ********** refactoring ********** - - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return EmptyIterable.instance(); - } - - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return EmptyIterable.instance(); - } - - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return EmptyIterable.instance(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java deleted file mode 100644 index fdd0cbbe07..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmTransientMapping.java +++ /dev/null @@ -1,58 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmTransientMapping; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.core.resource.orm.XmlTransient; - -/** - * orm.xml transient mapping - */ -public class GenericOrmTransientMapping - extends AbstractOrmAttributeMapping - implements OrmTransientMapping -{ - public GenericOrmTransientMapping(OrmPersistentAttribute parent, XmlTransient xmlMapping) { - super(parent, xmlMapping); - } - - public String getKey() { - return MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY; - } - - public int getXmlSequence() { - return 90; - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmTransientMapping(this); - } - - public void addXmlAttributeMappingTo(Attributes resourceAttributes) { - resourceAttributes.getTransients().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) { - resourceAttributes.getTransients().remove(this.xmlAttributeMapping); - } - - // ********** metamodel ********** - - @Override - public MetamodelField getMetamodelField() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java deleted file mode 100644 index 372829c881..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmUniqueConstraint.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.ReadOnlyUniqueConstraint; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmUniqueConstraint; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmReadOnlyUniqueConstraint; -import org.eclipse.jpt.jpa.core.resource.orm.XmlUniqueConstraint; - -public class GenericOrmUniqueConstraint - extends AbstractOrmReadOnlyUniqueConstraint - implements OrmUniqueConstraint -{ - protected Owner owner; - protected final XmlUniqueConstraint xmlUniqueConstraint; - - - public GenericOrmUniqueConstraint(XmlContextNode parent, Owner owner, XmlUniqueConstraint xmlUniqueConstraint) { - super(parent); - this.owner = owner; - this.xmlUniqueConstraint = xmlUniqueConstraint; - this.initializeColumnNames(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncColumnNames(); - } - - - // ********** column names ********** - - public void addColumnName(String columnName) { - this.addColumnName(this.columnNames.size(), columnName); - } - - public void addColumnName(int index, String columnName) { - this.addItemToList(index, columnName, this.columnNames, COLUMN_NAMES_LIST); - this.xmlUniqueConstraint.getColumnNames().add(index, columnName); - } - - public void removeColumnName(String columnName) { - this.removeColumnName(this.columnNames.indexOf(columnName)); - } - - public void removeColumnName(int index) { - this.removeItemFromList(index, this.columnNames, COLUMN_NAMES_LIST); - this.xmlUniqueConstraint.getColumnNames().remove(index); - } - - public void moveColumnName(int targetIndex, int sourceIndex) { - this.moveItemInList(targetIndex, sourceIndex, this.columnNames, COLUMN_NAMES_LIST); - this.xmlUniqueConstraint.getColumnNames().move(targetIndex, sourceIndex); - } - - protected void initializeColumnNames() { - for (String xmlColumnName : this.xmlUniqueConstraint.getColumnNames()) { - this.columnNames.add(xmlColumnName); - } - } - - @Override - protected Iterable getResourceColumnNames() { - return this.xmlUniqueConstraint.getColumnNames(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return this.xmlUniqueConstraint.getValidationTextRange(); - } - - - // ********** misc ********** - - public XmlUniqueConstraint getXmlUniqueConstraint() { - return this.xmlUniqueConstraint; - } - - public void initializeFrom(ReadOnlyUniqueConstraint oldUniqueConstraint) { - for (String columnName : oldUniqueConstraint.getColumnNames()) { - this.addColumnName(columnName); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java deleted file mode 100644 index 5cd6602686..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVersionMapping.java +++ /dev/null @@ -1,23 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVersionMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlVersion; - - -public class GenericOrmVersionMapping - extends AbstractOrmVersionMapping -{ - public GenericOrmVersionMapping(OrmPersistentAttribute parent, XmlVersion xmlMapping) { - super(parent, xmlMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java deleted file mode 100644 index aee0a4591d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAssociationOverride.java +++ /dev/null @@ -1,67 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualOverrideRelationship; - -/** - * Virtual orm.xml association override - */ -public class GenericOrmVirtualAssociationOverride - extends AbstractOrmVirtualOverride - implements OrmVirtualAssociationOverride -{ - protected final OrmVirtualOverrideRelationship relationship; - - - public GenericOrmVirtualAssociationOverride(OrmAssociationOverrideContainer parent, String name) { - super(parent, name); - this.relationship = this.buildRelationship(); - } - - @Override - public void update() { - super.update(); - this.relationship.update(); - } - - @Override - public OrmAssociationOverride convertToSpecified() { - return (OrmAssociationOverride) super.convertToSpecified(); - } - - public RelationshipMapping getMapping() { - return this.getContainer().getRelationshipMapping(this.name); - } - - - // ********** relationship ********** - - public OrmVirtualOverrideRelationship getRelationship() { - return this.relationship; - } - - /** - * The relationship should be available (since its presence precipitated the - * creation of the virtual override). - */ - protected OrmVirtualOverrideRelationship buildRelationship() { - return this.getContextNodeFactory().buildOrmVirtualOverrideRelationship(this); - } - - public Relationship resolveOverriddenRelationship() { - return this.getContainer().resolveOverriddenRelationship(this.name); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java deleted file mode 100644 index d1327dba88..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualAttributeOverride.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAttributeOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualColumn; - -/** - * Virtual orm.xml attribute override - */ -public class GenericOrmVirtualAttributeOverride - extends AbstractOrmVirtualOverride - implements OrmVirtualAttributeOverride, OrmVirtualColumn.Owner -{ - protected final OrmVirtualColumn column; - - - public GenericOrmVirtualAttributeOverride(OrmAttributeOverrideContainer parent, String name) { - super(parent, name); - this.column = this.buildColumn(); - } - - @Override - public void update() { - super.update(); - this.column.update(); - } - - @Override - public OrmAttributeOverride convertToSpecified() { - return (OrmAttributeOverride) super.convertToSpecified(); - } - - - // ********** column ********** - - public OrmVirtualColumn getColumn() { - return this.column; - } - - /** - * The original column should be available (since the presence of its - * attribute is what precipitated the creation of the virtual override). - */ - protected OrmVirtualColumn buildColumn() { - return this.getContextNodeFactory().buildOrmVirtualColumn(this, this); - } - - - // ********** column owner implementation ********** - - public TypeMapping getTypeMapping() { - return this.getContainer().getTypeMapping(); - } - - public String getDefaultTableName() { - String overriddenColumnTable = this.getOverriddenColumnTable(); - return (overriddenColumnTable != null) ? overriddenColumnTable : this.getContainer().getDefaultTableName(); - } - - protected String getOverriddenColumnTable() { - ReadOnlyColumn overriddenColumn = this.resolveOverriddenColumn(); - // pretty sure this is the *specified* table... - return (overriddenColumn == null) ? null : overriddenColumn.getSpecifiedTable(); - } - - public String getDefaultColumnName() { - String overriddenColumnName = this.getOverriddenColumnName(); - return (overriddenColumnName != null) ? overriddenColumnName : this.name; - } - - protected String getOverriddenColumnName() { - ReadOnlyColumn overriddenColumn = this.resolveOverriddenColumn(); - return (overriddenColumn == null) ? null : overriddenColumn.getName(); - } - - public Column resolveOverriddenColumn() { - return this.getContainer().resolveOverriddenColumn(this.name); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java deleted file mode 100644 index 3cf168ed05..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualColumn.java +++ /dev/null @@ -1,167 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.JpaContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualColumn; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVirtualBaseColumn; - -/** - * orm.xml virtual column - */ -public class GenericOrmVirtualColumn - extends AbstractOrmVirtualBaseColumn - implements OrmVirtualColumn -{ - protected Integer specifiedLength; - protected int defaultLength; - - protected Integer specifiedPrecision; - protected int defaultPrecision; - - protected Integer specifiedScale; - protected int defaultScale; - - - public GenericOrmVirtualColumn(JpaContextNode parent, OrmVirtualColumn.Owner owner) { - super(parent, owner); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - - this.setSpecifiedLength(this.buildSpecifiedLength()); - this.setDefaultLength(this.buildDefaultLength()); - - this.setSpecifiedPrecision(this.buildSpecifiedPrecision()); - this.setDefaultPrecision(this.buildDefaultPrecision()); - - this.setSpecifiedScale(this.buildSpecifiedScale()); - this.setDefaultScale(this.buildDefaultScale()); - } - - - // ********** column ********** - - @Override - public Column getOverriddenColumn() { - return this.owner.resolveOverriddenColumn(); - } - - - // ********** length ********** - - public int getLength() { - return (this.specifiedLength != null) ? this.specifiedLength.intValue() : this.defaultLength; - } - - public Integer getSpecifiedLength() { - return this.specifiedLength; - } - - protected void setSpecifiedLength(Integer length) { - Integer old = this.specifiedLength; - this.specifiedLength = length; - this.firePropertyChanged(SPECIFIED_LENGTH_PROPERTY, old, length); - } - - protected Integer buildSpecifiedLength() { - return this.getOverriddenColumn().getSpecifiedLength(); - } - - public int getDefaultLength() { - return this.defaultLength; - } - - protected void setDefaultLength(int length) { - int old = this.defaultLength; - this.defaultLength = length; - this.firePropertyChanged(DEFAULT_LENGTH_PROPERTY, old, length); - } - - protected int buildDefaultLength() { - return DEFAULT_LENGTH; - } - - - // ********** precision ********** - - public int getPrecision() { - return (this.specifiedPrecision != null) ? this.specifiedPrecision.intValue() : this.defaultPrecision; - } - - public Integer getSpecifiedPrecision() { - return this.specifiedPrecision; - } - - protected void setSpecifiedPrecision(Integer precision) { - Integer old = this.specifiedPrecision; - this.specifiedPrecision = precision; - this.firePropertyChanged(SPECIFIED_PRECISION_PROPERTY, old, precision); - } - - protected Integer buildSpecifiedPrecision() { - return this.getOverriddenColumn().getSpecifiedPrecision(); - } - - public int getDefaultPrecision() { - return this.defaultPrecision; - } - - protected void setDefaultPrecision(int precision) { - int old = this.defaultPrecision; - this.defaultPrecision = precision; - this.firePropertyChanged(DEFAULT_PRECISION_PROPERTY, old, precision); - } - - protected int buildDefaultPrecision() { - return DEFAULT_PRECISION; - } - - - // ********** scale ********** - - public int getScale() { - return (this.specifiedScale != null) ? this.specifiedScale.intValue() : this.defaultScale; - } - - public Integer getSpecifiedScale() { - return this.specifiedScale; - } - - protected void setSpecifiedScale(Integer scale) { - Integer old = this.specifiedScale; - this.specifiedScale = scale; - this.firePropertyChanged(SPECIFIED_SCALE_PROPERTY, old, scale); - } - - protected Integer buildSpecifiedScale() { - return this.getOverriddenColumn().getSpecifiedScale(); - } - - public int getDefaultScale() { - return this.defaultScale; - } - - protected void setDefaultScale(int scale) { - int old = this.defaultScale; - this.defaultScale = scale; - this.firePropertyChanged(DEFAULT_SCALE_PROPERTY, old, scale); - } - - protected int buildDefaultScale() { - return DEFAULT_SCALE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java deleted file mode 100644 index ceaef0bc75..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualJoinColumn.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JpaContextNode; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumn; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVirtualBaseColumn; - -/** - * orm.xml virtual join column - */ -public class GenericOrmVirtualJoinColumn - extends AbstractOrmVirtualBaseColumn - implements OrmVirtualJoinColumn -{ - protected final JoinColumn overriddenColumn; - - protected String specifiedReferencedColumnName; - protected String defaultReferencedColumnName; - - - public GenericOrmVirtualJoinColumn(JpaContextNode parent, ReadOnlyJoinColumn.Owner owner, JoinColumn overriddenColumn) { - super(parent, owner); - this.overriddenColumn = overriddenColumn; - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - - this.setSpecifiedReferencedColumnName(this.buildSpecifiedReferencedColumnName()); - this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName()); - } - - - // ********** column ********** - - @Override - public JoinColumn getOverriddenColumn() { - return this.overriddenColumn; - } - - public boolean isDefault() { - return this.owner.joinColumnIsDefault(this); - } - - - // ********** referenced column name ********** - - public String getReferencedColumnName() { - return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName; - } - - public String getSpecifiedReferencedColumnName() { - return this.specifiedReferencedColumnName; - } - - protected void setSpecifiedReferencedColumnName(String name) { - String old = this.specifiedReferencedColumnName; - this.specifiedReferencedColumnName = name; - this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedReferencedColumnName() { - return this.getOverriddenColumn().getSpecifiedReferencedColumnName(); - } - - public String getDefaultReferencedColumnName() { - return this.defaultReferencedColumnName; - } - - protected void setDefaultReferencedColumnName(String name) { - String old = this.defaultReferencedColumnName; - this.defaultReferencedColumnName = name; - this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name); - } - - protected String buildDefaultReferencedColumnName() { - return MappingTools.buildJoinColumnDefaultReferencedColumnName(this.owner); - } - - - // ********** misc ********** - - @Override - protected String buildDefaultName() { - return MappingTools.buildJoinColumnDefaultName(this, this.owner); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java deleted file mode 100644 index f8211eddf6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualOverrideRelationship.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.OverrideRelationship; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualAssociationOverride; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmVirtualOverrideJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmVirtualOverrideRelationship2_0; - -public class GenericOrmVirtualOverrideRelationship - extends AbstractOrmXmlContextNode - implements OrmVirtualOverrideRelationship2_0 -{ - protected OrmVirtualRelationshipStrategy strategy; - - protected final OrmVirtualJoinColumnRelationshipStrategy joinColumnStrategy; - - // JPA 2.0 - protected final OrmVirtualJoinTableRelationshipStrategy joinTableStrategy; - - - public GenericOrmVirtualOverrideRelationship(OrmVirtualAssociationOverride parent) { - super(parent); - this.joinColumnStrategy = this.buildJoinColumnStrategy(); - this.joinTableStrategy = this.buildJoinTableStrategy(); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.setStrategy(this.buildStrategy()); - this.joinColumnStrategy.update(); - this.joinTableStrategy.update(); - } - - - // ********** strategy ********** - - public OrmVirtualRelationshipStrategy getStrategy() { - return this.strategy; - } - - protected void setStrategy(OrmVirtualRelationshipStrategy strategy) { - OrmVirtualRelationshipStrategy old = this.strategy; - this.strategy = strategy; - this.firePropertyChanged(STRATEGY_PROPERTY, old, strategy); - } - - protected OrmVirtualRelationshipStrategy buildStrategy() { - if (this.isJpa2_0Compatible()) { - if (this.joinColumnStrategy.hasSpecifiedJoinColumns()) { - return this.joinColumnStrategy; - } - return this.joinTableStrategy; - } - return this.joinColumnStrategy; - } - - - // ********** join column strategy ********** - - public OrmVirtualJoinColumnRelationshipStrategy getJoinColumnStrategy() { - return this.joinColumnStrategy; - } - - public boolean strategyIsJoinColumn() { - return this.strategy == this.joinColumnStrategy; - } - - public boolean mayHaveDefaultJoinColumn() { - return false; - } - - protected OrmVirtualJoinColumnRelationshipStrategy buildJoinColumnStrategy() { - return new GenericOrmVirtualOverrideJoinColumnRelationshipStrategy(this); - } - - - // ********** join table strategy ********** - - public OrmVirtualJoinTableRelationshipStrategy getJoinTableStrategy() { - return this.joinTableStrategy; - } - - public boolean strategyIsJoinTable() { - return this.strategy == this.joinTableStrategy; - } - - public boolean mayHaveDefaultJoinTable() { - return this.isVirtual(); - } - - protected OrmVirtualJoinTableRelationshipStrategy buildJoinTableStrategy() { - return new GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0(this); - } - - - // ********** conversions ********** - - public void initializeOn(Relationship newRelationship) { - newRelationship.initializeFromJoinTableRelationship(this); - newRelationship.initializeFromJoinColumnRelationship(this); - } - - public void initializeOnSpecified(OverrideRelationship specifiedRelationship) { - specifiedRelationship.initializeFromVirtualJoinColumnRelationship(this); - specifiedRelationship.initializeFromVirtualJoinTableRelationship(this); - } - - - // ********** misc ********** - - @Override - public OrmVirtualAssociationOverride getParent() { - return (OrmVirtualAssociationOverride) super.getParent(); - } - - public OrmVirtualAssociationOverride getAssociationOverride() { - return this.getParent(); - } - - public TypeMapping getTypeMapping() { - return this.getAssociationOverride().getContainer().getTypeMapping(); - } - - public Entity getEntity() { - TypeMapping typeMapping = this.getTypeMapping(); - return (typeMapping instanceof Entity) ? (Entity) typeMapping : null; - } - - public boolean isVirtual() { - return true; - } - - public RelationshipMapping getMapping() { - return this.getAssociationOverride().getMapping(); - } - - public Relationship resolveOverriddenRelationship() { - return this.getAssociationOverride().resolveOverriddenRelationship(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java deleted file mode 100644 index d85905fd19..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualPrimaryKeyJoinColumn.java +++ /dev/null @@ -1,100 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualPrimaryKeyJoinColumn; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmVirtualNamedColumn; - -/** - * orm.xml virtual primary key join column - */ -public class GenericOrmVirtualPrimaryKeyJoinColumn - extends AbstractOrmVirtualNamedColumn - implements OrmVirtualPrimaryKeyJoinColumn -{ - protected final JavaPrimaryKeyJoinColumn overriddenColumn; - - protected String specifiedReferencedColumnName; - protected String defaultReferencedColumnName; - - - public GenericOrmVirtualPrimaryKeyJoinColumn(XmlContextNode parent, ReadOnlyBaseJoinColumn.Owner owner, JavaPrimaryKeyJoinColumn overriddenColumn) { - super(parent, owner); - this.overriddenColumn = overriddenColumn; - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - - this.setSpecifiedReferencedColumnName(this.buildSpecifiedReferencedColumnName()); - this.setDefaultReferencedColumnName(this.buildDefaultReferencedColumnName()); - } - - - // ********** column ********** - - @Override - public JavaPrimaryKeyJoinColumn getOverriddenColumn() { - return this.overriddenColumn; - } - - public boolean isDefault() { - return this.owner.joinColumnIsDefault(this); - } - - - // ********** referenced column name ********** - - public String getReferencedColumnName() { - return (this.specifiedReferencedColumnName != null) ? this.specifiedReferencedColumnName : this.defaultReferencedColumnName; - } - - public String getSpecifiedReferencedColumnName() { - return this.specifiedReferencedColumnName; - } - - protected void setSpecifiedReferencedColumnName(String name) { - String old = this.specifiedReferencedColumnName; - this.specifiedReferencedColumnName = name; - this.firePropertyChanged(SPECIFIED_REFERENCED_COLUMN_NAME_PROPERTY, old, name); - } - - protected String buildSpecifiedReferencedColumnName() { - return this.getOverriddenColumn().getSpecifiedReferencedColumnName(); - } - - public String getDefaultReferencedColumnName() { - return this.defaultReferencedColumnName; - } - - protected void setDefaultReferencedColumnName(String name) { - String old = this.defaultReferencedColumnName; - this.defaultReferencedColumnName = name; - this.firePropertyChanged(DEFAULT_REFERENCED_COLUMN_NAME_PROPERTY, old, name); - } - - protected String buildDefaultReferencedColumnName() { - return this.buildDefaultName(); - } - - - // ********** misc ********** - - public String getTable() { - return this.owner.getDefaultTableName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java deleted file mode 100644 index 6fe8eb779c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmVirtualUniqueConstraint.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.UniqueConstraint; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualUniqueConstraint; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmReadOnlyUniqueConstraint; - -public class GenericOrmVirtualUniqueConstraint - extends AbstractOrmReadOnlyUniqueConstraint - implements OrmVirtualUniqueConstraint -{ - protected final UniqueConstraint overriddenUniqueConstraint; - - - public GenericOrmVirtualUniqueConstraint(XmlContextNode parent, UniqueConstraint overriddenUniqueConstraint) { - super(parent); - this.overriddenUniqueConstraint = overriddenUniqueConstraint; - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.syncColumnNames(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return null; - } - - - // ********** misc ********** - - public UniqueConstraint getOverriddenUniqueConstraint() { - return this.overriddenUniqueConstraint; - } - - @Override - protected Iterable getResourceColumnNames() { - return this.overriddenUniqueConstraint.getColumnNames(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java deleted file mode 100644 index 190e0fa341..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXml.java +++ /dev/null @@ -1,281 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.List; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.JpaFile; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.orm.EntityMappings; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmXml; -import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEntityMappings; -import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * JPA orm.xml file. - */ -public class GenericOrmXml - extends AbstractOrmXmlContextNode - implements OrmXml -{ - /** - * If the XML resource's content type changes, the mapping file - * ref will throw out its current mapping file. - */ - protected final JpaXmlResource xmlResource; // never null - - /** - * The resouce type will only change if the XML file's version changes - * (since, if the content type changes, we get garbage-collected). - */ - protected JptResourceType resourceType; - - /** - * The root element of the orm.xml file. - */ - protected EntityMappings root; - - - public GenericOrmXml(MappingFileRef parent, JpaXmlResource xmlResource) { - super(parent); - this.checkXmlResource(xmlResource); - this.xmlResource = xmlResource; - this.resourceType = xmlResource.getResourceType(); - - XmlEntityMappings xmlEntityMappings = (XmlEntityMappings) xmlResource.getRootObject(); - if (xmlEntityMappings != null) { - this.root = this.buildRoot(xmlEntityMappings); - } - } - - - // ********** synchronize/update ********** - - /** - * @see org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXml#synchronizeWithResourceModel() - */ - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - XmlEntityMappings oldXmlEntityMappings = (this.root == null) ? null : this.root.getXmlEntityMappings(); - XmlEntityMappings newXmlEntityMappings = (XmlEntityMappings) this.xmlResource.getRootObject(); - JptResourceType newResourceType = this.xmlResource.getResourceType(); - - // If the old and new XML entity mappings are different instances, - // we scrap the old context entity mappings and rebuild. - // (This can happen when the resource model changes drastically, - // such as a CVS checkout or an edit reversion.) - if ((oldXmlEntityMappings != newXmlEntityMappings) || - (newXmlEntityMappings == null) || - this.valuesAreDifferent(this.resourceType, newResourceType) - ) { - if (this.root != null) { - this.unregisterRootStructureNode(); - this.root.dispose(); - this.setRoot(null); - } - } - - this.resourceType = newResourceType; - - if (newXmlEntityMappings != null) { - if (this.root == null) { - this.setRoot(this.buildRoot(newXmlEntityMappings)); - } else { - // the context entity mappings already holds the XML entity mappings - this.root.synchronizeWithResourceModel(); - } - } - } - - @Override - public void update() { - super.update(); - if (this.root != null) { - this.root.update(); - // this will happen redundantly - need to hold JpaFile? - this.registerRootStructureNode(); - } - } - - - // ********** root ********** - - public EntityMappings getRoot() { - return this.root; - } - - protected void setRoot(EntityMappings root) { - EntityMappings old = this.root; - this.root = root; - this.firePropertyChanged(ROOT_PROPERTY, old, root); - } - - protected EntityMappings buildRoot(XmlEntityMappings xmlEntityMappings) { - return this.getContextNodeFactory().buildEntityMappings(this, xmlEntityMappings); - } - - - // ********** misc ********** - - protected void checkXmlResource(JpaXmlResource resource) { - if (resource == null) { - throw new NullPointerException(); - } - if ( ! resource.getContentType().isKindOf(JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE)) { - throw new IllegalArgumentException("Content type is not 'mapping file': " + resource); //$NON-NLS-1$ - } - } - - @Override - public MappingFileRef getParent() { - return (MappingFileRef) super.getParent(); - } - - @Override - public IResource getResource() { - return this.xmlResource.getFile(); - } - - @Override - public JptResourceType getResourceType() { - return this.resourceType; - } - - protected JpaFile getJpaFile() { - return this.getJpaFile(this.xmlResource.getFile()); - } - - public boolean isIn(IFolder folder) { - IResource member = folder.findMember(this.xmlResource.getFile().getName()); - IFile file = this.xmlResource.getFile(); - return Tools.valuesAreEqual(member, file); - } - - // ********** JpaStructureNode implementation ********** - - public String getId() { - // isn't actually displayed, so needs no details page - return null; - } - - public JpaStructureNode getStructureNode(int textOffset) { - if ((this.root != null) && this.root.containsOffset(textOffset)) { - return this.root.getStructureNode(textOffset); - } - return this; - } - - // never actually selected - public TextRange getSelectionTextRange() { - return TextRange.Empty.instance(); - } - - public void dispose() { - if (this.root != null) { - JpaFile jpaFile = this.getJpaFile(); - if (jpaFile != null) { - this.unregisterRootStructureNode(); - } - this.root.dispose(); - } - } - - // TODO hold the JpaFile? - protected void registerRootStructureNode() { - this.getJpaFile().addRootStructureNode(this.xmlResource, this.root); - } - - protected void unregisterRootStructureNode() { - this.getJpaFile().removeRootStructureNode(this.xmlResource, this.root); - } - - - // ********** MappingFile implementation ********** - - public JpaXmlResource getXmlResource() { - return this.xmlResource; - } - - public OrmPersistentType getPersistentType(String name) { - return (this.root == null) ? null : this.root.getPersistentType(name); - } - - - // ********** PersistentTypeContainer implementation ********** - - /** - * All orm.xml mapping files must be able to generate a static metamodel - * because 1.0 orm.xml files can be referenced from 2.0 - * persistence.xml - * files. - */ - public Iterable getPersistentTypes() { - return (this.root != null) ? this.root.getPersistentTypes() : EmptyIterable.instance(); - } - - - // ********** refactoring ********** - - public Iterable createDeleteTypeEdits(IType type) { - return (this.root != null) ? - this.root.createDeleteTypeEdits(type) : - EmptyIterable.instance(); - } - - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return (this.root != null) ? - this.root.createRenameTypeEdits(originalType, newName) : - EmptyIterable.instance(); - } - - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return (this.root != null) ? - this.root.createMoveTypeEdits(originalType, newPackage) : - EmptyIterable.instance(); - } - - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return (this.root != null) ? - this.root.createRenamePackageEdits(originalPackage, newName) : - EmptyIterable.instance(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - if (this.root != null) { - this.root.validate(messages, reporter); - } - } - - public TextRange getValidationTextRange() { - return TextRange.Empty.instance(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java deleted file mode 100644 index 3a2dbdaa5a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/GenericOrmXmlDefinition.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.ArrayList; -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.orm.NullOrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformProvider; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmBasicMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddableDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEntityDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmMappedSuperclassDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTransientMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmVersionMappingDefinition; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; - -public class GenericOrmXmlDefinition - extends AbstractOrmXmlDefinition -{ - // singleton - private static final OrmXmlDefinition INSTANCE = new GenericOrmXmlDefinition(); - - /** - * Return the singleton - */ - public static OrmXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private GenericOrmXmlDefinition() { - super(); - } - - public JptResourceType getResourceType() { - return JptJpaCorePlugin.ORM_XML_1_0_RESOURCE_TYPE; - } - - public EFactory getResourceNodeFactory() { - return OrmFactory.eINSTANCE; - } - - @Override - protected OrmXmlContextNodeFactory buildContextNodeFactory() { - return new GenericOrmXmlContextNodeFactory(); - } - - @Override - protected void addTypeMappingDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, TYPE_MAPPING_DEFINITIONS); - } - - /** - * Order should not matter here; but we'll use the same order as for Java. - * @see GenericJpaPlatformProvider - */ - protected static final OrmTypeMappingDefinition[] TYPE_MAPPING_DEFINITIONS = new OrmTypeMappingDefinition[] { - OrmEntityDefinition.instance(), - OrmEmbeddableDefinition.instance(), - OrmMappedSuperclassDefinition.instance() - }; - - @Override - protected void addAttributeMappingDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, ATTRIBUTE_MAPPING_DEFINITIONS); - } - - /** - * Order should not matter here; but we'll use the same order as for Java. - * @see GenericJpaPlatformProvider - */ - protected static final OrmAttributeMappingDefinition[] ATTRIBUTE_MAPPING_DEFINITIONS = new OrmAttributeMappingDefinition[] { - OrmTransientMappingDefinition.instance(), - OrmIdMappingDefinition.instance(), - OrmVersionMappingDefinition.instance(), - OrmBasicMappingDefinition.instance(), - OrmEmbeddedMappingDefinition.instance(), - OrmEmbeddedIdMappingDefinition.instance(), - OrmManyToManyMappingDefinition.instance(), - OrmManyToOneMappingDefinition.instance(), - OrmOneToManyMappingDefinition.instance(), - OrmOneToOneMappingDefinition.instance(), - NullOrmAttributeMappingDefinition.instance() - }; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java deleted file mode 100644 index c0b5200071..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmConverter.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.text.edits.ReplaceEdit; - -public class NullOrmConverter - extends AbstractOrmConverter -{ - public NullOrmConverter(OrmAttributeMapping parent) { - super(parent); - } - - public void initialize() { - // NOP - } - - public Class getType() { - return null; - } - - public TextRange getValidationTextRange() { - return null; - } - - - // ********** refactoring ********** - - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return EmptyIterable.instance(); - } - - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return EmptyIterable.instance(); - } - - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return EmptyIterable.instance(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java deleted file mode 100644 index fb9c4fd2b7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/NullOrmJoinColumnRelationshipStrategy.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import java.util.ListIterator; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.ReadOnlyJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.RelationshipMapping; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumnRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.db.Table; - -/** - * Used by - * {@link org.eclipse.jpt.jpa.core.internal.context.orm.GenericOrmOneToManyRelationship#buildJoinColumnStrategy()} - * in a JPA 1.0 project. - */ -public class NullOrmJoinColumnRelationshipStrategy - extends AbstractOrmXmlContextNode - implements OrmJoinColumnRelationshipStrategy -{ - public NullOrmJoinColumnRelationshipStrategy(OrmJoinColumnRelationship parent) { - super(parent); - } - - - // ********** join columns ********** - - public ListIterator joinColumns() { - return EmptyListIterator.instance(); - } - - public int joinColumnsSize() { - return 0; - } - - - // ********** specified join columns ********** - - public ListIterator specifiedJoinColumns() { - return EmptyListIterator.instance(); - } - - public int specifiedJoinColumnsSize() { - return 0; - } - - public boolean hasSpecifiedJoinColumns() { - return false; - } - - public OrmJoinColumn getSpecifiedJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - public OrmJoinColumn addSpecifiedJoinColumn() { - throw new UnsupportedOperationException(); - } - - public OrmJoinColumn addSpecifiedJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - public void removeSpecifiedJoinColumn(JoinColumn joinColumn) { - throw new UnsupportedOperationException(); - } - - public void removeSpecifiedJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - public void moveSpecifiedJoinColumn(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - - // ********** default join column ********** - - public OrmJoinColumn getDefaultJoinColumn() { - return null; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return null; - } - - public String getColumnTableNotValidDescription() { - return null; - } - - - // ********** misc ********** - - @Override - public OrmJoinColumnRelationship getParent() { - return (OrmJoinColumnRelationship) super.getParent(); - } - - public OrmJoinColumnRelationship getRelationship() { - return this.getParent(); - } - - public void initializeFrom(ReadOnlyJoinColumnRelationshipStrategy oldStrategy) { - // NOP - } - - public void initializeFromVirtual(ReadOnlyJoinColumnRelationshipStrategy oldStrategy) { - // NOP - } - - public void addStrategy() { - // NOP - } - - public void removeStrategy() { - // NOP - } - - public boolean isTargetForeignKey() { - return false; - } - - public TypeMapping getRelationshipTarget() { - return null; - } - - public String getTableName() { - return null; - } - - public boolean isOverridable() { - return false; - } - - public boolean tableNameIsInvalid(String tableName) { - return true; - } - - public Table resolveDbTable(String tableName) { - return null; - } - - public TypeMapping getRelationshipSource() { - return this.getRelationshipMapping().getTypeMapping(); - } - - protected RelationshipMapping getRelationshipMapping() { - return this.getRelationship().getMapping(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java deleted file mode 100644 index 1cba7cb9d6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/orm/UnsupportedOrmAttributeMapping.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNullAttributeMapping; - -/** - * This will be used in cases where Java-supported attribute mapping types - * are not supported by the particular version of the orm.xml - * file. For example, EclipseLink supports variable 1:1 mappings, but the - * generic orm.xml file does not. - */ -public class UnsupportedOrmAttributeMapping - extends AbstractOrmAttributeMapping -{ - public UnsupportedOrmAttributeMapping(OrmPersistentAttribute parent, XmlNullAttributeMapping xmlMapping) { - super(parent, xmlMapping); - } - - public String getKey() { - //this ends up returning the java attribute mapping key - return this.xmlAttributeMapping.getMappingKey(); - } - - public int getXmlSequence() { - return -1; - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public void addXmlAttributeMappingTo(Attributes xmlAttributes) { - throw new UnsupportedOperationException(); - } - - public void removeXmlAttributeMappingFrom(Attributes xmlAttributes) { - throw new UnsupportedOperationException(); - } - - - // ********** metamodel ********** - - @Override - public MetamodelField getMetamodelField() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java deleted file mode 100644 index 96ae45722e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericClassRef.java +++ /dev/null @@ -1,378 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.persistence.ClassRef; -import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceStructureNodes; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlJavaClassRef; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * persistence.xml file - *
- * class element - */ -public class GenericClassRef - extends AbstractPersistenceXmlContextNode - implements ClassRef -{ - /** - * This is null for a virtual class ref. - */ - protected final XmlJavaClassRef xmlJavaClassRef; - - protected String className; - - /** - * The Java persistent type corresponding to the ref's class name; - * this can be null if the name is invalid. - */ - protected JavaPersistentType javaPersistentType; - - - // ********** constructors ********** - - /** - * Construct a specified class ref; i.e. a class ref with - * an explicit entry in the persistence.xml. - */ - public GenericClassRef(PersistenceUnit parent, XmlJavaClassRef xmlJavaClassRef) { - this(parent, xmlJavaClassRef, xmlJavaClassRef.getJavaClass()); - } - - /** - * Construct an virtual class ref; i.e. a class ref without - * an explicit entry in the persistence.xml. - */ - public GenericClassRef(PersistenceUnit parent, String className) { - this(parent, null, className); - } - - protected GenericClassRef(PersistenceUnit parent, XmlJavaClassRef xmlJavaClassRef, String className) { - super(parent); - this.xmlJavaClassRef = xmlJavaClassRef; - this.className = className; - // 'javaPersistentType' is resolved in the update - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - // virtual class refs are matched by name in the persistence unit - // so no need to sync it here (also, 'xmlJavaClassRef' is null...) - if (this.isNotVirtual()) { - // the name probably never changes... - this.setClassName_(this.xmlJavaClassRef.getJavaClass()); - } - if (this.javaPersistentType != null) { - this.javaPersistentType.synchronizeWithResourceModel(); - } - } - - @Override - public void update() { - super.update(); - this.updateJavaPersistentType(); - } - - - // ********** class name ********** - - public String getClassName() { - return this.className; - } - - public void setClassName(String className) { - if (this.isVirtual()) { - throw new IllegalStateException("The name of a virtual class ref cannot be changed: " + this); //$NON-NLS-1$ - } - this.setClassName_(className); - this.xmlJavaClassRef.setJavaClass(className); - } - - protected void setClassName_(String className) { - String old = this.className; - this.className = className; - this.firePropertyChanged(CLASS_NAME_PROPERTY, old, className); - } - - /** - * Nested classes will be qualified with a '$'; the Java name is qualified - * with a '.'. Like className, this can be null. - */ - protected String getJavaClassName() { - return StringTools.stringIsEmpty(this.className) ? null : this.className.replace('$', '.'); - } - - - // ********** java persistent type ********** - - public JavaPersistentType getJavaPersistentType() { - return this.javaPersistentType; - } - - protected void setJavaPersistentType(JavaPersistentType javaPersistentType) { - JavaPersistentType old = this.javaPersistentType; - this.javaPersistentType = javaPersistentType; - this.firePropertyChanged(JAVA_PERSISTENT_TYPE_PROPERTY, old, javaPersistentType); - } - - protected void updateJavaPersistentType() { - JavaResourcePersistentType resourceType = this.resolveJavaResourcePersistentType(); - if (resourceType == null) { - if (this.javaPersistentType != null) { - this.javaPersistentType.dispose(); - this.setJavaPersistentType(null); - } - } else { - if (this.javaPersistentType == null) { - this.setJavaPersistentType(this.buildJavaPersistentType(resourceType)); - } else { - if (this.javaPersistentType.getResourcePersistentType() == resourceType) { - this.javaPersistentType.update(); - } else { - this.javaPersistentType.dispose(); - this.setJavaPersistentType(this.buildJavaPersistentType(resourceType)); - } - } - } - } - - protected JavaResourcePersistentType resolveJavaResourcePersistentType() { - String javaClassName = this.getJavaClassName(); - return (javaClassName == null) ? null : this.getJpaProject().getJavaResourcePersistentType(javaClassName); - } - - protected JavaPersistentType buildJavaPersistentType(JavaResourcePersistentType jrpt) { - return this.getJpaFactory().buildJavaPersistentType(this, jrpt); - } - - - // ********** misc ********** - - @Override - public PersistenceUnit getParent() { - return (PersistenceUnit) super.getParent(); - } - - public XmlJavaClassRef getXmlClassRef() { - return this.xmlJavaClassRef; - } - - protected boolean isFor(IType type) { - return this.isFor(type.getFullyQualifiedName('.')); - } - - public boolean isFor(String typeName) { - return Tools.valuesAreEqual(typeName, this.getJavaClassName()); - } - - protected boolean isInPackage(IPackageFragment packageFragment) { - return Tools.valuesAreEqual(this.getPackageName(), packageFragment.getElementName()); - } - - protected String getPackageName() { - int lastPeriod = this.className.lastIndexOf('.'); - return (lastPeriod == -1) ? null : this.className.substring(0, lastPeriod); - } - - public boolean isVirtual() { - return this.xmlJavaClassRef == null; - } - - protected boolean isNotVirtual() { - return ! this.isVirtual(); - } - - public boolean containsOffset(int textOffset) { - return this.isNotVirtual() && this.xmlJavaClassRef.containsOffset(textOffset); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.getJavaClassName()); - } - - - // ********** JpaStructureNode implementation ********** - - public String getId() { - return PersistenceStructureNodes.CLASS_REF_ID; - } - - public JpaStructureNode getStructureNode(int textOffset) { - return this; - } - - public TextRange getSelectionTextRange() { - return this.isVirtual() ? null : this.xmlJavaClassRef.getSelectionTextRange(); - } - - public void dispose() { - if (this.javaPersistentType != null) { - this.javaPersistentType.dispose(); - } - } - - - // ********** PersistentType.Owner implementation ********** - - public AccessType getOverridePersistentTypeAccess() { - // no access type at this level overrides any local access type specification - return null; - } - - public AccessType getDefaultPersistentTypeAccess() { - return this.getPersistenceUnit().getDefaultAccess(); - } - - - //*********** refactoring *********** - - public Iterable createDeleteTypeEdits(final IType type) { - if (this.isVirtual()) { - throw new IllegalStateException(); - } - return this.isFor(type) ? - new SingleElementIterable(this.createDeleteEdit()) : - EmptyIterable.instance(); - } - - protected DeleteEdit createDeleteEdit() { - return this.xmlJavaClassRef.createDeleteEdit(); - } - - public Iterable createRenameTypeEdits(IType originalType, String newName) { - if (this.isVirtual()) { - throw new IllegalStateException(); - } - return this.isFor(originalType) ? - new SingleElementIterable(this.createReplaceEdit(originalType, newName)) : - EmptyIterable.instance(); - } - - protected ReplaceEdit createReplaceEdit(IType originalType, String newName) { - return this.xmlJavaClassRef.createRenameEdit(originalType, newName); - } - - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - if (this.isVirtual()) { - throw new IllegalStateException(); - } - return this.isFor(originalType) ? - new SingleElementIterable(this.createRenamePackageEdit(newPackage.getElementName())) : - EmptyIterable.instance(); - } - - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - if (this.isVirtual()) { - throw new IllegalStateException(); - } - return this.isInPackage(originalPackage) ? - new SingleElementIterable(this.createRenamePackageEdit(newName)) : - EmptyIterable.instance(); - } - - protected ReplaceEdit createRenamePackageEdit(String newName) { - return this.xmlJavaClassRef.createRenamePackageEdit(newName); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - - if (StringTools.stringIsEmpty(this.className)) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENCE_UNIT_UNSPECIFIED_CLASS, - this, - this.getValidationTextRange() - ) - ); - return; - } - - if (this.javaPersistentType == null) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENCE_UNIT_NONEXISTENT_CLASS, - new String[] {this.getJavaClassName()}, - this, - this.getValidationTextRange() - ) - ); - return; - } - - // 190062 validate Java class only if this is the only reference to it - // i.e. the persistence.xml ref is the only ref - none of the mapping - // files reference the same class - boolean validateJavaPersistentType = true; - for (Iterator stream = this.getPersistenceUnit().mappingFileRefsContaining(this.getJavaClassName()); stream.hasNext(); ) { - validateJavaPersistentType = false; - MappingFileRef mappingFileRef = stream.next(); - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.LOW_SEVERITY, - JpaValidationMessages.PERSISTENCE_UNIT_REDUNDANT_CLASS, - new String[] {this.getJavaClassName(), mappingFileRef.getFileName()}, - this, - this.getValidationTextRange() - ) - ); - } - - if (validateJavaPersistentType) { - this.validateJavaPersistentType(messages, reporter); - } - } - - protected void validateJavaPersistentType(List messages, IReporter reporter) { - try { - this.javaPersistentType.validate(messages, reporter); - } catch (Throwable t) { - JptJpaCorePlugin.log(t); - } - } - - public TextRange getValidationTextRange() { - return this.isVirtual() ? null : this.xmlJavaClassRef.getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericJarFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericJarFileRef.java deleted file mode 100644 index eec257e95c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericJarFileRef.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence; - -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractJarFileRef; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlJarFileRef; - -/** - * Context JAR file reference (from the persistence unit) - */ -public class GenericJarFileRef - extends AbstractJarFileRef -{ - public GenericJarFileRef(PersistenceUnit parent, XmlJarFileRef xmlJarFileRef) { - super(parent, xmlJarFileRef); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericMappingFileRef.java deleted file mode 100644 index 45e923a079..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericMappingFileRef.java +++ /dev/null @@ -1,149 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractMappingFileRef; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * persistence.xml file - *
- * mapping-file element - */ -public class GenericMappingFileRef - extends AbstractMappingFileRef -{ - protected final XmlMappingFileRef xmlMappingFileRef; - - - public GenericMappingFileRef(PersistenceUnit parent, XmlMappingFileRef xmlMappingFileRef) { - super(parent, xmlMappingFileRef.getFileName()); - this.xmlMappingFileRef = xmlMappingFileRef; - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - // set the file name *before* calling super - this.setFileName_(this.xmlMappingFileRef.getFileName()); - super.synchronizeWithResourceModel(); - } - - - // ********** file name ********** - - public void setFileName(String fileName) { - this.setFileName_(fileName); - this.xmlMappingFileRef.setFileName(fileName); - } - - protected void setFileName_(String xmlFileName) { - String old = this.fileName; - this.fileName = xmlFileName; - if (this.firePropertyChanged(FILE_NAME_PROPERTY, old, xmlFileName)) { - if (this.mappingFile != null) { - this.mappingFile.dispose(); - this.setMappingFile(null); - } - } - } - - - // ********** misc ********** - - public XmlMappingFileRef getXmlMappingFileRef() { - return this.xmlMappingFileRef; - } - - public boolean isImplied() { - return false; - } - - public boolean containsOffset(int textOffset) { - return this.xmlMappingFileRef.containsOffset(textOffset); - } - - - // ********** JpaStructureNode implementation ********** - - public TextRange getSelectionTextRange() { - return this.xmlMappingFileRef.getSelectionTextRange(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return this.xmlMappingFileRef.getValidationTextRange(); - } - - - // ********** refactoring ********** - - public Iterable createDeleteMappingFileEdits(IFile file) { - return this.isFor(file) ? - new SingleElementIterable(this.createDeleteEdit()) : - EmptyIterable.instance(); - } - - protected DeleteEdit createDeleteEdit() { - return this.xmlMappingFileRef.createDeleteEdit(); - } - - @Override - protected ReplaceEdit createRenameEdit(IFile originalFile, String newName) { - return this.xmlMappingFileRef.createRenameEdit(originalFile, newName); - } - - public Iterable createRenameFolderEdits(IFolder originalFolder, String newName) { - return this.isIn(originalFolder) ? - new SingleElementIterable(this.createRenameFolderEdit(originalFolder, newName)) : - EmptyIterable.instance(); - } - - protected ReplaceEdit createRenameFolderEdit(IFolder originalFolder, String newName) { - return this.xmlMappingFileRef.createRenameFolderEdit(originalFolder, newName); - } - - @Override - protected ReplaceEdit createMoveEdit(IFile originalFile, IPath runtineDestination) { - return this.xmlMappingFileRef.createMoveEdit(originalFile, runtineDestination); - } - - public Iterable createMoveFolderEdits(IFolder originalFolder, IPath runtimeDestination) { - return this.isIn(originalFolder) ? - new SingleElementIterable(this.createMoveEdit(originalFolder, runtimeDestination)) : - EmptyIterable.instance(); - } - - protected ReplaceEdit createMoveEdit(IFolder originalFolder, IPath runtimeDestination) { - IProject project = originalFolder.getProject(); - IPath fullPath = originalFolder.getFullPath(); - IPath originalLocation = JptCommonCorePlugin.getResourceLocator(project).getRuntimePath(project, fullPath); - return this.createMoveEdit(originalLocation, runtimeDestination); - } - - protected ReplaceEdit createMoveEdit(IPath originalLocation, IPath runtineDestination) { - return this.xmlMappingFileRef.createMoveEdit(originalLocation, runtineDestination); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java deleted file mode 100644 index 446be61a1a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistence.java +++ /dev/null @@ -1,302 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence; - -import java.util.List; -import java.util.ListIterator; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.ListIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementListIterable; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceStructureNodes; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.Persistence2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; -import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * persistence.xml file - *
- * persistence element - */ -public class GenericPersistence - extends AbstractPersistenceXmlContextNode - implements Persistence2_0 -{ - protected final XmlPersistence xmlPersistence; - - // The implementation here is a single persistence unit, although the API - // is for a list. We want to support multiple persistence units someday.... - protected PersistenceUnit persistenceUnit; - - - public GenericPersistence(PersistenceXml parent, XmlPersistence xmlPersistence) { - super(parent); - this.xmlPersistence = xmlPersistence; - this.initializePersistenceUnits(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.syncPersistenceUnits(); - } - - @Override - public void update() { - super.update(); - this.updateNodes(this.getPersistenceUnits()); - } - - - // ********** persistence units ********** - - public ListIterator persistenceUnits() { - return this.getPersistenceUnits().iterator(); - } - - protected ListIterable getPersistenceUnits() { - return (this.persistenceUnit == null) ? EmptyListIterable.instance() : this.getPersistenceUnits_(); - } - - protected ListIterable getPersistenceUnits_() { - return new SingleElementListIterable(this.persistenceUnit); - } - - public int persistenceUnitsSize() { - return (this.persistenceUnit == null) ? 0 : 1; - } - - public PersistenceUnit addPersistenceUnit() { - return this.addPersistenceUnit(this.persistenceUnitsSize()); - } - - public PersistenceUnit addPersistenceUnit(int index) { - if ((index > 0) || (this.persistenceUnit != null)) { - throw new IllegalStateException("This implementation does not support multiple persistence units."); //$NON-NLS-1$ - } - XmlPersistenceUnit xmlPersistenceUnit = PersistenceFactory.eINSTANCE.createXmlPersistenceUnit(); - this.persistenceUnit = this.buildPersistenceUnit(xmlPersistenceUnit); - this.xmlPersistence.getPersistenceUnits().add(xmlPersistenceUnit); - this.fireItemAdded(PERSISTENCE_UNITS_LIST, index, this.persistenceUnit); - return this.persistenceUnit; - } - - public void removePersistenceUnit(PersistenceUnit pu) { - if (pu != this.persistenceUnit) { - throw new IllegalArgumentException("Invalid persistence unit: " + pu); //$NON-NLS-1$ - } - this.removePersistenceUnit(0); - } - - public void removePersistenceUnit(int index) { - if ((index > 0) || (this.persistenceUnit == null)) { - throw new IndexOutOfBoundsException("index: " + index); //$NON-NLS-1$ - } - PersistenceUnit old = this.persistenceUnit; - this.persistenceUnit.dispose(); - this.persistenceUnit = null; - this.xmlPersistence.getPersistenceUnits().remove(index); - this.fireItemRemoved(PERSISTENCE_UNITS_LIST, index, old); - } - - // only building one here, until we support multiple persistence units... - protected void initializePersistenceUnits() { - XmlPersistenceUnit xmlPersistenceUnit = this.getXmlPersistenceUnit(); - if (xmlPersistenceUnit != null) { - this.persistenceUnit = this.buildPersistenceUnit(xmlPersistenceUnit); - } - } - - protected void syncPersistenceUnits() { - XmlPersistenceUnit xmlPersistenceUnit = this.getXmlPersistenceUnit(); - if (this.persistenceUnit == null) { - if (xmlPersistenceUnit != null) { - this.addPersistenceUnit_(this.buildPersistenceUnit(xmlPersistenceUnit)); - } - } else { - if (xmlPersistenceUnit == null) { - this.removePersistenceUnit_(); - } else { - if (this.persistenceUnit.getXmlPersistenceUnit() == xmlPersistenceUnit) { - this.persistenceUnit.synchronizeWithResourceModel(); - } else { - this.removePersistenceUnit_(); - this.addPersistenceUnit_(this.buildPersistenceUnit(xmlPersistenceUnit)); - } - } - } - } - - protected XmlPersistenceUnit getXmlPersistenceUnit() { - List xmlPersistenceUnits = this.xmlPersistence.getPersistenceUnits(); - return xmlPersistenceUnits.isEmpty() ? null : xmlPersistenceUnits.get(0); - } - - protected void addPersistenceUnit_(PersistenceUnit pu) { - this.persistenceUnit = pu; - this.fireItemAdded(PERSISTENCE_UNITS_LIST, 0, pu); - } - - protected void removePersistenceUnit_() { - PersistenceUnit old = this.persistenceUnit; - this.persistenceUnit = null; - old.dispose(); - this.fireItemRemoved(PERSISTENCE_UNITS_LIST, 0, old); - } - - protected PersistenceUnit buildPersistenceUnit(XmlPersistenceUnit xmlPersistenceUnit) { - return this.getContextNodeFactory().buildPersistenceUnit(this, xmlPersistenceUnit); - } - - - // ********** metamodel ********** - - public void initializeMetamodel() { - for (PersistenceUnit pu : this.getPersistenceUnits()) { - ((PersistenceUnit2_0) pu).initializeMetamodel(); - } - } - - public void synchronizeMetamodel() { - for (PersistenceUnit pu : this.getPersistenceUnits()) { - ((PersistenceUnit2_0) pu).synchronizeMetamodel(); - } - } - - public void disposeMetamodel() { - for (PersistenceUnit pu : this.getPersistenceUnits()) { - ((PersistenceUnit2_0) pu).disposeMetamodel(); - } - } - - - // ********** Persistence implementation ********** - - public XmlPersistence getXmlPersistence() { - return this.xmlPersistence; - } - - public boolean containsOffset(int textOffset) { - return (this.xmlPersistence == null) ? false : this.xmlPersistence.containsOffset(textOffset); - } - - - // ********** XmlContextNode implementation ********** - - @Override - public PersistenceXml getParent() { - return (PersistenceXml) super.getParent(); - } - - public TextRange getValidationTextRange() { - return this.xmlPersistence.getValidationTextRange(); - } - - - // ********** JpaStructureNode implementation ********** - - public String getId() { - return PersistenceStructureNodes.PERSISTENCE_ID; - } - - public JpaStructureNode getStructureNode(int textOffset) { - for (PersistenceUnit pu : this.getPersistenceUnits()) { - if (pu.containsOffset(textOffset)) { - return pu.getStructureNode(textOffset); - } - } - return this; - } - - public TextRange getSelectionTextRange() { - return this.xmlPersistence.getSelectionTextRange(); - } - - public void dispose() { - for (PersistenceUnit pu : this.getPersistenceUnits()) { - pu.dispose(); - } - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateVersion(messages); - this.checkForMultiplePersistenceUnits(messages); - this.validatePersistenceUnit(messages, reporter); - } - - protected void validateVersion(List messages) { - if (! this.getLatestDocumentVersion().equals(this.xmlPersistence.getVersion())) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.LOW_SEVERITY, - JpaValidationMessages.XML_VERSION_NOT_LATEST, - this, - this.xmlPersistence.getVersionTextRange())); - } - } - - protected String getLatestDocumentVersion() { - return this.getJpaPlatform().getMostRecentSupportedResourceType( - JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE).getVersion(); - } - - /** - * extraneous persistence units can be - * accessed through the XmlPersistence resource object - */ - protected void checkForMultiplePersistenceUnits(List messages) { - if (this.xmlPersistence.getPersistenceUnits().size() > 1) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.NORMAL_SEVERITY, - JpaValidationMessages.PERSISTENCE_MULTIPLE_PERSISTENCE_UNITS, - this, - this.getValidationTextRange() - ) - ); - } - } - - protected void validatePersistenceUnit(List messages, IReporter reporter) { - if (this.persistenceUnit == null) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENCE_NO_PERSISTENCE_UNIT, - this, - this.getValidationTextRange() - ) - ); - return; - } - this.persistenceUnit.validate(messages, reporter); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java deleted file mode 100644 index d7adff868b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnit.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence; - -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnit; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistenceUnit; - -/** - * generic persistence-unit - */ -public class GenericPersistenceUnit - extends AbstractPersistenceUnit -{ - public GenericPersistenceUnit(Persistence parent, XmlPersistenceUnit xmlPersistenceUnit) { - super(parent, xmlPersistenceUnit); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java deleted file mode 100644 index 4c37d3d4b7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceUnitProperty.java +++ /dev/null @@ -1,159 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlProperty; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * Straightforward implementation of the persistence unit property. - * Notifies the persistence unit of any changes to the property. - */ -public class GenericPersistenceUnitProperty - extends AbstractPersistenceXmlContextNode - implements PersistenceUnit.Property -{ - protected final XmlProperty xmlProperty; - protected String name; - protected String value; - - - public GenericPersistenceUnitProperty(PersistenceUnit parent, XmlProperty xmlProperty) { - super(parent); - this.xmlProperty = xmlProperty; - this.name = xmlProperty.getName(); - this.value = xmlProperty.getValue(); - } - - @Override - public PersistenceUnit getParent() { - return (PersistenceUnit) super.getParent(); - } - - public XmlProperty getXmlProperty() { - return this.xmlProperty; - } - - - // ********** synchronize ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setName_(this.xmlProperty.getName()); - this.setValue_(this.xmlProperty.getValue()); - } - - - // ********** name ********** - - public String getName() { - return this.name; - } - - public void setName(String name) { - this.setName_(name); - this.xmlProperty.setName(name); - } - - protected void setName_(String name) { - String old = this.name; - this.name = name; - if (this.firePropertyChanged(NAME_PROPERTY, old, name)) { - this.getParent().propertyNameChanged(old, name, this.value); - } - } - - - // ********** value ********** - - public String getValue() { - return this.value; - } - - public void setValue(String value) { - this.setValue_(value); - this.xmlProperty.setValue(value); - } - - protected void setValue_(String value) { - String old = this.value; - this.value = value; - if (this.firePropertyChanged(VALUE_PROPERTY, old, value)) { - this.getParent().propertyValueChanged(this.name, value); - } - } - - protected String getValuePackageName() { - return (this.value == null) ? null : this.getValuePackageName_(); - } - - /** - * pre-condition: {@link #value} is not null - */ - protected String getValuePackageName_() { - int lastPeriod = this.value.lastIndexOf('.'); - return (lastPeriod == -1) ? null : this.value.substring(0, lastPeriod); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return this.xmlProperty.getValidationTextRange(); - } - - - // ********** refactoring ********** - - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return Tools.valuesAreEqual(this.value, originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable(this.createRenameTypeEdit(originalType, newName)) : - EmptyIterable.instance(); - } - - protected ReplaceEdit createRenameTypeEdit(IType originalType, String newName) { - return this.xmlProperty.createRenameTypeEdit(originalType, newName); - } - - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return Tools.valuesAreEqual(this.value, originalType.getFullyQualifiedName('.')) ? - new SingleElementIterable(this.createRenamePackageEdit(newPackage.getElementName())) : - EmptyIterable.instance(); - } - - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return Tools.valuesAreEqual(this.getValuePackageName(), originalPackage.getElementName()) ? - new SingleElementIterable(this.createRenamePackageEdit(newName)) : - EmptyIterable.instance(); - } - - protected ReplaceEdit createRenamePackageEdit(String newName) { - return this.xmlProperty.createRenamePackageEdit(newName); - } - - - // ********** misc ********** - - @Override - public void toString(StringBuilder sb) { - sb.append(this.name); - sb.append(" = "); //$NON-NLS-1$ - sb.append(this.value); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java deleted file mode 100644 index fda1d6c9bf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXml.java +++ /dev/null @@ -1,251 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence; - -import java.util.List; - -import org.eclipse.core.resources.IResource; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.JpaFile; -import org.eclipse.jpt.jpa.core.JpaStructureNode; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.JpaRootContextNode; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNode; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.Persistence2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceXml2_0; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlPersistence; -import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * context model persistence.xml file - */ -public class GenericPersistenceXml - extends AbstractPersistenceXmlContextNode - implements PersistenceXml2_0 -{ - /** - * If the XML resource's content type changes, the root context - * node will throw out its current persistence XML. - */ - protected final JpaXmlResource xmlResource; // never null - - /** - * The resource type will only change if the XML file's version changes - * (since, if the content type changes, we get garbage-collected). - */ - protected JptResourceType resourceType; - - /** - * The root element of the persistence.xml file. - */ - protected Persistence persistence; - - - public GenericPersistenceXml(JpaRootContextNode parent, JpaXmlResource xmlResource) { - super(parent); - this.checkXmlResource(xmlResource); - this.xmlResource = xmlResource; - this.resourceType = xmlResource.getResourceType(); - - XmlPersistence xmlPersistence = (XmlPersistence) xmlResource.getRootObject(); - if (xmlPersistence != null) { - this.persistence = this.buildPersistence(xmlPersistence); - } - } - - - // ********** synchronize/update ********** - - /** - * @see org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXml#synchronizeWithResourceModel() - */ - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - XmlPersistence oldXmlPersistence = (this.persistence == null) ? null : this.persistence.getXmlPersistence(); - XmlPersistence newXmlPersistence = (XmlPersistence) this.xmlResource.getRootObject(); - JptResourceType newResourceType = this.xmlResource.getResourceType(); - - // If the old and new XML persistences are different instances, - // we scrap the old context persistence and rebuild. - // (This can happen when the resource model changes drastically, - // such as a CVS checkout or an edit reversion.) - if ((oldXmlPersistence != newXmlPersistence) || - (newXmlPersistence == null) || - this.valuesAreDifferent(this.resourceType, newResourceType) - ) { - if (this.persistence != null) { - this.unregisterRootStructureNode(); - this.persistence.dispose(); - this.setPersistence(null); - } - } - - this.resourceType = newResourceType; - - if (newXmlPersistence != null) { - if (this.persistence == null) { - this.setPersistence(this.buildPersistence(newXmlPersistence)); - } else { - // the context persistence already holds the XML persistence - this.persistence.synchronizeWithResourceModel(); - } - } - } - - @Override - public void update() { - super.update(); - if (this.persistence != null) { - this.persistence.update(); - // this will happen redundantly - need to hold JpaFile? - this.registerRootStructureNode(); - } - } - - - // ********** persistence ********** - - public Persistence getPersistence() { - return this.persistence; - } - - protected void setPersistence(Persistence persistence) { - Persistence old = this.persistence; - this.persistence = persistence; - this.firePropertyChanged(PERSISTENCE_PROPERTY, old, persistence); - } - - protected Persistence buildPersistence(XmlPersistence xmlPersistence) { - return this.getContextNodeFactory().buildPersistence(this, xmlPersistence); - } - - - // ********** misc ********** - - protected void checkXmlResource(JpaXmlResource resource) { - if (resource == null) { - throw new NullPointerException(); - } - if ( ! resource.getContentType().isKindOf(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) { - throw new IllegalArgumentException("Content type is not 'persistence': " + resource); //$NON-NLS-1$ - } - } - - public JpaXmlResource getXmlResource() { - return this.xmlResource; - } - - @Override - public IResource getResource() { - return this.xmlResource.getFile(); - } - - @Override - public JptResourceType getResourceType() { - return this.xmlResource.getResourceType(); - } - - protected JpaFile getJpaFile() { - return this.getJpaFile(this.xmlResource.getFile()); - } - - - // ********** metamodel ********** - - public void initializeMetamodel() { - if (this.persistence != null) { - ((Persistence2_0) this.persistence).initializeMetamodel(); - } - } - - public void synchronizeMetamodel() { - if (this.persistence != null) { - ((Persistence2_0) this.persistence).synchronizeMetamodel(); - } - } - - public void disposeMetamodel() { - if (this.persistence != null) { - ((Persistence2_0) this.persistence).disposeMetamodel(); - } - } - - - // ********** JpaStructureNode implementation ********** - - public String getId() { - // isn't actually displayed, so needs no details page - return null; - } - - public JpaStructureNode getStructureNode(int textOffset) { - if (this.persistence.containsOffset(textOffset)) { - return this.persistence.getStructureNode(textOffset); - } - return this; - } - - // never actually selected - public TextRange getSelectionTextRange() { - return TextRange.Empty.instance(); - } - - public void dispose() { - if (this.persistence != null) { - JpaFile jpaFile = this.getJpaFile(); - if (jpaFile != null) { - this.unregisterRootStructureNode(); - } - this.persistence.dispose(); - } - } - - // TODO hold the JpaFile? - protected void registerRootStructureNode() { - this.getJpaFile().addRootStructureNode(this.xmlResource, this.persistence); - } - - protected void unregisterRootStructureNode() { - this.getJpaFile().removeRootStructureNode(this.xmlResource, this.persistence); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - - if (this.persistence == null) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.PERSISTENCE_XML_INVALID_CONTENT, - this - ) - ); - return; - } - - this.persistence.validate(messages, reporter); - } - - // never actually selected - public TextRange getValidationTextRange() { - return TextRange.Empty.instance(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java deleted file mode 100644 index 57d9a22b6e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/GenericPersistenceXmlDefinition.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.context.persistence.GenericPersistenceXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.persistence.PersistenceFactory; - -public class GenericPersistenceXmlDefinition - extends AbstractPersistenceXmlDefinition -{ - // singleton - private static final PersistenceXmlDefinition INSTANCE = new GenericPersistenceXmlDefinition(); - - /** - * Return the singleton - */ - public static PersistenceXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private GenericPersistenceXmlDefinition() { - super(); - } - - public JptResourceType getResourceType() { - return JptJpaCorePlugin.PERSISTENCE_XML_1_0_RESOURCE_TYPE; - } - - public EFactory getResourceNodeFactory() { - return PersistenceFactory.eINSTANCE; - } - - @Override - protected PersistenceXmlContextNodeFactory buildContextNodeFactory() { - return new GenericPersistenceXmlContextNodeFactory(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java deleted file mode 100644 index dca36559d9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/context/persistence/ImpliedMappingFileRef.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence; - -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.runtime.IPath; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractMappingFileRef; -import org.eclipse.jpt.jpa.core.resource.persistence.XmlMappingFileRef; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.ReplaceEdit; - -/** - * Used by the persistence unit for the - * META-INF/orm.xml file when it is not explicitly listed - * in the persistence.xml file. - */ -public class ImpliedMappingFileRef - extends AbstractMappingFileRef -{ - - // ********** construction/initialization ********** - - public ImpliedMappingFileRef(PersistenceUnit parent, String fileName) { - super(parent, fileName); - } - - - // ********** MappingFileRef implementation ********** - - public XmlMappingFileRef getXmlMappingFileRef() { - throw new UnsupportedOperationException(); - } - - public boolean isImplied() { - return true; - } - - public void setFileName(String fileName) { - throw new UnsupportedOperationException("Cannot set an implied mapping file ref's 'fileName': " + fileName); //$NON-NLS-1$ - } - - public boolean containsOffset(int textOffset) { - return false; - } - - - // ********** JpaStructureNode implementation ********** - - public TextRange getSelectionTextRange() { - return null; - } - - - // ********** XmlContextNode implementation ********** - - public TextRange getValidationTextRange() { - return this.getPersistenceUnit().getValidationTextRange(); - } - - - // ********** refactoring ********** - - public Iterable createDeleteMappingFileEdits(IFile file) { - throw new IllegalStateException("This reference cannot be deleted - it is implied"); //$NON-NLS-1$ - } - - public Iterable createRenameFolderEdits(IFolder originalFolder, String newName) { - throw new IllegalStateException("This reference cannot be moved - it is implied"); //$NON-NLS-1$ - } - - @Override - protected ReplaceEdit createRenameEdit(IFile originalFile, String newName) { - return this.createReplaceEdit(this.fileName.substring(0, this.fileName.lastIndexOf('/') + 1) + newName); - } - - @Override - protected ReplaceEdit createMoveEdit(IFile originalFile, IPath runtimeDestination) { - return this.createReplaceEdit(runtimeDestination.append(originalFile.getName()).toString()); - } - - protected ReplaceEdit createReplaceEdit(String newMappingFileName) { - StringBuilder sb = new StringBuilder(); - sb.append(StringTools.CR); - sb.append("\t\t"); //$NON-NLS-1$ - sb.append(newMappingFileName); - sb.append(""); //$NON-NLS-1$ - int offset = this.getPersistenceUnit().findInsertLocationForMappingFileRef(); - return new ReplaceEdit(offset, 0, sb.toString()); - } - - public Iterable createMoveFolderEdits(IFolder originalFolder, IPath runtimeDestination) { - throw new IllegalStateException("This reference cannot be moved - it is implied"); //$NON-NLS-1$ - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java deleted file mode 100644 index 84286b57c7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverride1_0Annotation.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAssociationOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * javax.persistence.AssociationOverride - */ -public final class BinaryAssociationOverride1_0Annotation - extends BinaryAssociationOverrideAnnotation -{ - - public BinaryAssociationOverride1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java deleted file mode 100644 index 7dbc81b9bd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryAssociationOverrides1_0Annotation.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAssociationOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation; - -/** - * javax.persistence.AssociationOverrides - */ -public final class BinaryAssociationOverrides1_0Annotation - extends BinaryAssociationOverridesAnnotation -{ - - public BinaryAssociationOverrides1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - @Override - protected NestableAssociationOverrideAnnotation buildAssociationOverride(Object jdtAssociationOverride) { - return new BinaryAssociationOverride1_0Annotation(this, (IAnnotation) jdtAssociationOverride); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java deleted file mode 100644 index f1bd6aac02..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQueries1_0Annotation.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedQueriesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation; - -/** - * javax.persistence.NamedQueries - */ -public final class BinaryNamedQueries1_0Annotation - extends BinaryNamedQueriesAnnotation -{ - public BinaryNamedQueries1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - @Override - protected NestableNamedQueryAnnotation buildNamedQuery(Object jdtQuery) { - return new BinaryNamedQuery1_0Annotation(this, (IAnnotation) jdtQuery); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java deleted file mode 100644 index 3b315898d1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinaryNamedQuery1_0Annotation.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedQueryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * javax.persistence.NamedQuery - */ -public final class BinaryNamedQuery1_0Annotation - extends BinaryNamedQueryAnnotation -{ - - public BinaryNamedQuery1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java deleted file mode 100644 index 0415109916..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/binary/BinarySequenceGenerator1_0Annotation.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinarySequenceGeneratorAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * javax.persistence.SequenceGenerator - */ -public final class BinarySequenceGenerator1_0Annotation - extends BinarySequenceGeneratorAnnotation -{ - - public BinarySequenceGenerator1_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java deleted file mode 100644 index 529a51a775..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverride1_0Annotation.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source; - -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAssociationOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * javax.persistence.AssociationOverride - */ -public final class SourceAssociationOverride1_0Annotation - extends SourceAssociationOverrideAnnotation -{ - public SourceAssociationOverride1_0Annotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, member, daa, annotationAdapter); - } - - // ********** static methods ********** - - public static SourceAssociationOverride1_0Annotation buildAssociationOverride(JavaResourceNode parent, Member member) { - return new SourceAssociationOverride1_0Annotation(parent, member, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER)); - } - - static SourceAssociationOverride1_0Annotation buildNestedAssociationOverride(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) { - IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME); - IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(member, idaa); - return new SourceAssociationOverride1_0Annotation(parent, member, idaa, annotationAdapter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java deleted file mode 100644 index f4c8ed5d23..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceAssociationOverrides1_0Annotation.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source; - -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAssociationOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation; - -/** - * javax.persistence.AssociationOverrides - */ -public final class SourceAssociationOverrides1_0Annotation - extends SourceAssociationOverridesAnnotation -{ - public SourceAssociationOverrides1_0Annotation(JavaResourceNode parent, Member member) { - super(parent, member); - } - - @Override - protected NestableAssociationOverrideAnnotation buildAssociationOverride(int index) { - // pass the Java resource persistent member as the nested annotation's parent - // since the nested annotation can be converted to stand-alone - return SourceAssociationOverride1_0Annotation.buildNestedAssociationOverride(this.parent, this.annotatedElement, index, this.daa); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java deleted file mode 100644 index fa1baaabf2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceNamedQuery1_0Annotation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source; - -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedQueryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * javax.persistence.NamedQuery - */ -public final class SourceNamedQuery1_0Annotation - extends SourceNamedQueryAnnotation -{ - public SourceNamedQuery1_0Annotation(JavaResourceNode parent, Type type) { - super(parent, type); - } - - public SourceNamedQuery1_0Annotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, type, daa, annotationAdapter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java deleted file mode 100644 index 898364a8d5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa1/resource/java/source/SourceSequenceGenerator1_0Annotation.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source; - -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceSequenceGeneratorAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * javax.persistence.SequenceGenerator - */ -public final class SourceSequenceGenerator1_0Annotation - extends SourceSequenceGeneratorAnnotation -{ - - public SourceSequenceGenerator1_0Annotation(JavaResourceNode parent, Member member) { - super(parent, member); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java deleted file mode 100644 index 84009a4467..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaAnnotationDefinitionProvider.java +++ /dev/null @@ -1,191 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2; - -import java.util.ArrayList; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaAnnotationDefinitionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.Access2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.AssociationOverride2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.AssociationOverrides2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.Cacheable2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.CollectionTable2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.ElementCollection2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyClass2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyColumn2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyEnumerated2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyJoinColumn2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyJoinColumns2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapKeyTemporal2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.MapsId2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.NamedQueries2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.NamedQuery2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.OrderColumn2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.SequenceGenerator2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.AttributeOverrideAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.AttributeOverridesAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.BasicAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.ColumnAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.DiscriminatorColumnAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.DiscriminatorValueAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddableAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddedAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.EmbeddedIdAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.EntityAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.EnumeratedAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.GeneratedValueAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.IdAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.IdClassAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.InheritanceAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.JoinColumnAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.JoinColumnsAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.JoinTableAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.LobAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.ManyToManyAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.ManyToOneAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.MapKeyAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.MappedSuperclassAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.NamedNativeQueriesAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.NamedNativeQueryAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.OneToManyAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.OneToOneAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.OrderByAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.PrimaryKeyJoinColumnAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.PrimaryKeyJoinColumnsAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.SecondaryTableAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.SecondaryTablesAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.TableAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.TableGeneratorAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.TemporalAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.TransientAnnotationDefinition; -import org.eclipse.jpt.jpa.core.internal.resource.java.VersionAnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; - -/** - * Support for existing JPA 1.0 annotations, new JPA 2.0 annotations, and - * augmented support for annotations changed from 1.0 to 2.0 - */ -public class Generic2_0JpaAnnotationDefinitionProvider - extends AbstractJpaAnnotationDefinitionProvider -{ - // singleton - private static final JpaAnnotationDefinitionProvider INSTANCE = new Generic2_0JpaAnnotationDefinitionProvider(); - - /** - * Return the singleton - */ - public static JpaAnnotationDefinitionProvider instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private Generic2_0JpaAnnotationDefinitionProvider() { - super(); - } - - @Override - protected void addTypeAnnotationDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, TYPE_ANNOTATION_DEFINITIONS); - } - - protected static final AnnotationDefinition[] TYPE_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] { - Access2_0AnnotationDefinition.instance(), - AssociationOverride2_0AnnotationDefinition.instance(), - AssociationOverrides2_0AnnotationDefinition.instance(), - AttributeOverrideAnnotationDefinition.instance(), - AttributeOverridesAnnotationDefinition.instance(), - Cacheable2_0AnnotationDefinition.instance(), - DiscriminatorColumnAnnotationDefinition.instance(), - DiscriminatorValueAnnotationDefinition.instance(), - EmbeddableAnnotationDefinition.instance(), - EntityAnnotationDefinition.instance(), - IdClassAnnotationDefinition.instance(), - InheritanceAnnotationDefinition.instance(), - MappedSuperclassAnnotationDefinition.instance(), - NamedQuery2_0AnnotationDefinition.instance(), - NamedQueries2_0AnnotationDefinition.instance(), - NamedNativeQueryAnnotationDefinition.instance(), - NamedNativeQueriesAnnotationDefinition.instance(), - PrimaryKeyJoinColumnAnnotationDefinition.instance(), - PrimaryKeyJoinColumnsAnnotationDefinition.instance(), - SecondaryTableAnnotationDefinition.instance(), - SecondaryTablesAnnotationDefinition.instance(), - SequenceGenerator2_0AnnotationDefinition.instance(), - TableAnnotationDefinition.instance(), - TableGeneratorAnnotationDefinition.instance() - }; - - @Override - protected void addTypeMappingAnnotationDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, TYPE_MAPPING_ANNOTATION_DEFINITIONS); - } - - protected static final AnnotationDefinition[] TYPE_MAPPING_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] { - EmbeddableAnnotationDefinition.instance(), - EntityAnnotationDefinition.instance(), - MappedSuperclassAnnotationDefinition.instance() - }; - - @Override - protected void addAttributeAnnotationDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, ATTRIBUTE_ANNOTATION_DEFINITIONS); - } - - protected static final AnnotationDefinition[] ATTRIBUTE_ANNOTATION_DEFINITIONS = new AnnotationDefinition[] { - Access2_0AnnotationDefinition.instance(), - AssociationOverride2_0AnnotationDefinition.instance(), - AssociationOverrides2_0AnnotationDefinition.instance(), - AttributeOverrideAnnotationDefinition.instance(), - AttributeOverridesAnnotationDefinition.instance(), - BasicAnnotationDefinition.instance(), - CollectionTable2_0AnnotationDefinition.instance(), - ColumnAnnotationDefinition.instance(), - ElementCollection2_0AnnotationDefinition.instance(), - EmbeddedAnnotationDefinition.instance(), - EmbeddedIdAnnotationDefinition.instance(), - EnumeratedAnnotationDefinition.instance(), - GeneratedValueAnnotationDefinition.instance(), - IdAnnotationDefinition.instance(), - JoinColumnAnnotationDefinition.instance(), - JoinColumnsAnnotationDefinition.instance(), - JoinTableAnnotationDefinition.instance(), - LobAnnotationDefinition.instance(), - ManyToManyAnnotationDefinition.instance(), - ManyToOneAnnotationDefinition.instance(), - MapsId2_0AnnotationDefinition.instance(), - MapKeyAnnotationDefinition.instance(), - MapKeyClass2_0AnnotationDefinition.instance(), - MapKeyColumn2_0AnnotationDefinition.instance(), - MapKeyEnumerated2_0AnnotationDefinition.instance(), - MapKeyJoinColumn2_0AnnotationDefinition.instance(), - MapKeyJoinColumns2_0AnnotationDefinition.instance(), - MapKeyTemporal2_0AnnotationDefinition.instance(), - OneToManyAnnotationDefinition.instance(), - OneToOneAnnotationDefinition.instance(), - OrderByAnnotationDefinition.instance(), - OrderColumn2_0AnnotationDefinition.instance(), - PrimaryKeyJoinColumnAnnotationDefinition.instance(), - PrimaryKeyJoinColumnsAnnotationDefinition.instance(), - SequenceGenerator2_0AnnotationDefinition.instance(), - TableGeneratorAnnotationDefinition.instance(), - TemporalAnnotationDefinition.instance(), - TransientAnnotationDefinition.instance(), - VersionAnnotationDefinition.instance() - }; - - @Override - protected void addPackageAnnotationDefinitionsTo(ArrayList definitions) { - // no package annotations - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java deleted file mode 100644 index fc808c9fa0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformFactory.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2; - -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaPlatformFactory; -import org.eclipse.jpt.jpa.core.JpaPlatformVariation; -import org.eclipse.jpt.jpa.core.internal.GenericJpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatform; -import org.eclipse.jpt.jpa.core.internal.GenericJpaPlatformFactory.SimpleVersion; - -/** - * All the state in the JPA platform should be "static" (i.e. unchanging once - * it is initialized). - */ -public class Generic2_0JpaPlatformFactory - implements JpaPlatformFactory -{ - /** - * zero-argument constructor - */ - public Generic2_0JpaPlatformFactory() { - super(); - } - - - public JpaPlatform buildJpaPlatform(String id) { - return new GenericJpaPlatform( - id, - this.buildJpaVersion(), - new GenericJpaFactory2_0(), - new GenericJpaAnnotationProvider(Generic2_0JpaAnnotationDefinitionProvider.instance()), - Generic2_0JpaPlatformProvider.instance(), - this.buildJpaPlatformVariation()); - } - - private JpaPlatform.Version buildJpaVersion() { - return new SimpleVersion(JpaFacet.VERSION_2_0.getVersionString()); - } - - protected JpaPlatformVariation buildJpaPlatformVariation() { - return new JpaPlatformVariation() { - //table_per_class inheritance support is optional in the 2.0 spec - public Supported getTablePerConcreteClassInheritanceIsSupported() { - return Supported.MAYBE; - } - public boolean isJoinTableOverridable() { - return true; - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java deleted file mode 100644 index 42ae0fa973..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/Generic2_0JpaPlatformProvider.java +++ /dev/null @@ -1,170 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2; - -import java.util.ArrayList; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaPlatformProvider; -import org.eclipse.jpt.jpa.core.JpaResourceModelProvider; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.ResourceDefinition; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaPlatformProvider; -import org.eclipse.jpt.jpa.core.internal.JarResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.JavaResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.OrmResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.PersistenceResourceModelProvider; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaBasicMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddableDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEmbeddedIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaEntityDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaMappedSuperclassDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaTransientMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.JavaVersionMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.persistence.GenericPersistenceXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaElementCollectionMappingDefinition2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaEmbeddedMappingDefinition2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaIdMappingDefinition2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaManyToManyMappingDefinition2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaManyToOneMappingDefinition2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaOneToManyMappingDefinition2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.JavaOneToOneMappingDefinition2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.orm.GenericOrmXml2_0Definition; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.Generic2_0PersistenceXmlDefinition; - -/** - * All the state in the JPA platform should be "static" (i.e. unchanging once - * it is initialized). - */ -public class Generic2_0JpaPlatformProvider - extends AbstractJpaPlatformProvider -{ - // singleton - private static final JpaPlatformProvider INSTANCE = new Generic2_0JpaPlatformProvider(); - - /** - * Return the singleton - */ - public static JpaPlatformProvider instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private Generic2_0JpaPlatformProvider() { - super(); - } - - - // ********** resource models ********** - - public JptResourceType getMostRecentSupportedResourceType(IContentType contentType) { - if (contentType.equals(JptCommonCorePlugin.JAVA_SOURCE_CONTENT_TYPE)) { - return JptCommonCorePlugin.JAVA_SOURCE_RESOURCE_TYPE; - } - else if (contentType.equals(JptCommonCorePlugin.JAR_CONTENT_TYPE)) { - return JptCommonCorePlugin.JAR_RESOURCE_TYPE; - } - else if (contentType.equals(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE)) { - return JptJpaCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE; - } - else if (contentType.equals(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE)) { - return JptJpaCorePlugin.ORM_XML_2_0_RESOURCE_TYPE; - } - else { - throw new IllegalArgumentException(contentType.toString()); - } - } - - @Override - protected void addResourceModelProvidersTo(ArrayList providers) { - CollectionTools.addAll(providers, RESOURCE_MODEL_PROVIDERS); - } - - // order should not be important here - protected static final JpaResourceModelProvider[] RESOURCE_MODEL_PROVIDERS = new JpaResourceModelProvider[] { - JavaResourceModelProvider.instance(), - JarResourceModelProvider.instance(), - PersistenceResourceModelProvider.instance(), - OrmResourceModelProvider.instance() - }; - - - // ********** Java type mappings ********** - - @Override - protected void addJavaTypeMappingDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, JAVA_TYPE_MAPPING_DEFINITIONS); - } - - // order matches that used by the Reference Implementation (EclipseLink) - protected static final JavaTypeMappingDefinition[] JAVA_TYPE_MAPPING_DEFINITIONS = new JavaTypeMappingDefinition[] { - JavaEntityDefinition.instance(), - JavaEmbeddableDefinition.instance(), - JavaMappedSuperclassDefinition.instance() - }; - - - // ********** Java attribute mappings ********** - - @Override - protected void addDefaultJavaAttributeMappingDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by the Reference Implementation (EclipseLink) - protected static final DefaultJavaAttributeMappingDefinition[] DEFAULT_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new DefaultJavaAttributeMappingDefinition[] { - JavaEmbeddedMappingDefinition2_0.instance(), - JavaBasicMappingDefinition.instance() - }; - - @Override - protected void addSpecifiedJavaAttributeMappingDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS); - } - - // order matches that used by the Reference Implementation (EclipseLink) - protected static final JavaAttributeMappingDefinition[] SPECIFIED_JAVA_ATTRIBUTE_MAPPING_DEFINITIONS = new JavaAttributeMappingDefinition[] { - JavaTransientMappingDefinition.instance(), - JavaElementCollectionMappingDefinition2_0.instance(), - JavaIdMappingDefinition2_0.instance(), - JavaVersionMappingDefinition.instance(), - JavaBasicMappingDefinition.instance(), - JavaEmbeddedMappingDefinition2_0.instance(), - JavaEmbeddedIdMappingDefinition.instance(), - JavaManyToManyMappingDefinition2_0.instance(), - JavaManyToOneMappingDefinition2_0.instance(), - JavaOneToManyMappingDefinition2_0.instance(), - JavaOneToOneMappingDefinition2_0.instance() - }; - - - // ********** resource definitions ********** - - @Override - protected void addResourceDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, RESOURCE_DEFINITIONS); - } - - protected static final ResourceDefinition[] RESOURCE_DEFINITIONS = new ResourceDefinition[] { - GenericPersistenceXmlDefinition.instance(), - Generic2_0PersistenceXmlDefinition.instance(), - GenericOrmXmlDefinition.instance(), - GenericOrmXml2_0Definition.instance() - }; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java deleted file mode 100644 index 7556b60b23..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaDatabaseIdentifierAdapter.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2; - -import java.util.Iterator; - -import org.eclipse.jpt.jpa.core.JpaDataSource; -import org.eclipse.jpt.jpa.core.context.JpaRootContextNode; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; -import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter; - -/** - * Conversions are determined by the delimited-identifiers - * flag in orm.xml. - *

- * Assume we are in a JPA 2.0-compatible project. - */ -public class GenericJpaDatabaseIdentifierAdapter - implements DatabaseIdentifierAdapter -{ - private final JpaDataSource dataSource; - - public GenericJpaDatabaseIdentifierAdapter(JpaDataSource dataSource) { - super(); - this.dataSource = dataSource; - } - - /** - * If the flag is set, "identifiers" are treated as "names". - */ - public String convertIdentifierToName(String identifier, DefaultCallback defaultCallback) { - return this.getDefaultDelimitedIdentifiers() ? identifier : defaultCallback.convertIdentifierToName(identifier); - } - - /** - * If the flag is set, "names" are treated as "identifiers". - */ - public String convertNameToIdentifier(String name, DefaultCallback defaultCallback) { - return this.getDefaultDelimitedIdentifiers() ? name : defaultCallback.convertNameToIdentifier(name); - } - - protected boolean getDefaultDelimitedIdentifiers() { - PersistenceUnit2_0 pu = this.getPersistenceUnit(); - return (pu != null) && pu.getDefaultDelimitedIdentifiers(); - } - - protected PersistenceUnit2_0 getPersistenceUnit() { - Persistence p = this.getPersistence(); - if (p == null) { - return null; - } - Iterator units = this.getPersistence().persistenceUnits(); - return (PersistenceUnit2_0) (units.hasNext() ? units.next() : null); - } - - protected Persistence getPersistence() { - PersistenceXml pxml = this.getPersistenceXml(); - return (pxml == null) ? null : pxml.getPersistence(); - } - - protected PersistenceXml getPersistenceXml() { - // TODO this null check can be removed if the data source is moved to the persistence unit; - // the root context node can be null during construction; - // this shouldn't be a problem since the default-delimiters flag - // is recalculated during the initial, post-project construction, "update" - JpaRootContextNode rcn = this.dataSource.getJpaProject().getRootContextNode(); - return (rcn == null) ? null : rcn.getPersistenceXml(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java deleted file mode 100644 index da28b49192..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericJpaFactory2_0.java +++ /dev/null @@ -1,169 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2; - -import org.eclipse.jpt.jpa.core.JpaDataSource; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaProject.Config; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaEmbeddable; -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaNamedQuery; -import org.eclipse.jpt.jpa.core.context.java.JavaOrderable; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaSequenceGenerator; -import org.eclipse.jpt.jpa.core.internal.AbstractJpaFactory; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaColumn; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaOrderable; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaCacheable2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaCollectionTable2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaEmbeddable2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaNamedQuery2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaOrderColumn2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaOrphanRemoval2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaPersistentAttribute2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaPersistentType2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaSequenceGenerator2_0; -import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0; -import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType; -import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0.Owner; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionTable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaEmbeddedMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderColumn2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation; -import org.eclipse.jpt.jpa.db.DatabaseIdentifierAdapter; - - -/** - * Central class that allows extenders to easily replace implementations of - * various Dali interfaces. - */ -public class GenericJpaFactory2_0 - extends AbstractJpaFactory - implements JpaFactory2_0 -{ - - public GenericJpaFactory2_0() { - super(); - } - - - // ********** Core Model ********** - - @Override - public JpaProject buildJpaProject(Config config) { - if ( ! (config instanceof JpaProject2_0.Config)) { - throw new IllegalArgumentException("config must be 2.0-compatible: " + config); //$NON-NLS-1$ - } - return super.buildJpaProject(config); - } - - public MetamodelSourceType.Synchronizer buildMetamodelSynchronizer(MetamodelSourceType sourceType) { - return new GenericMetamodelSynchronizer(sourceType); - } - - public DatabaseIdentifierAdapter buildDatabaseIdentifierAdapter(JpaDataSource dataSource) { - return new GenericJpaDatabaseIdentifierAdapter(dataSource); - } - - - // ********** Java Context Model ********** - - @Override - public JavaPersistentType buildJavaPersistentType(PersistentType.Owner owner, JavaResourcePersistentType jrpt) { - return new GenericJavaPersistentType2_0(owner, jrpt); - } - - @Override - public JavaPersistentAttribute buildJavaPersistentAttribute(PersistentType parent, JavaResourcePersistentAttribute jrpa) { - return new GenericJavaPersistentAttribute2_0(parent, jrpa); - } - - @Override - public JavaEmbeddable buildJavaEmbeddable(JavaPersistentType parent, EmbeddableAnnotation embeddableAnnotation) { - return new GenericJavaEmbeddable2_0(parent, embeddableAnnotation); - } - - @Override - public JavaSequenceGenerator buildJavaSequenceGenerator(JavaJpaContextNode parent, SequenceGeneratorAnnotation annotation) { - return new GenericJavaSequenceGenerator2_0(parent, (SequenceGenerator2_0Annotation) annotation); - } - - //The 2.0 JPA spec supports association overrides on an embedded mapping while the 1.0 spec did not - public JavaAssociationOverrideContainer buildJavaAssociationOverrideContainer(JavaEmbeddedMapping2_0 parent, JavaAssociationOverrideContainer.Owner owner) { - return new GenericJavaAssociationOverrideContainer(parent, owner); - } - - public JavaDerivedIdentity2_0 buildJavaDerivedIdentity(JavaSingleRelationshipMapping2_0 parent) { - return new GenericJavaDerivedIdentity2_0(parent); - } - - public JavaElementCollectionMapping2_0 buildJavaElementCollectionMapping2_0(JavaPersistentAttribute parent) { - return new GenericJavaElementCollectionMapping2_0(parent); - } - - public JavaCacheable2_0 buildJavaCacheable(JavaCacheableHolder2_0 parent) { - return new GenericJavaCacheable2_0(parent); - } - - public JavaOrphanRemovable2_0 buildJavaOrphanRemoval(JavaOrphanRemovalHolder2_0 parent) { - return new GenericJavaOrphanRemoval2_0(parent); - } - - @Override - public JavaNamedQuery buildJavaNamedQuery(JavaJpaContextNode parent, NamedQueryAnnotation annotation) { - return new GenericJavaNamedQuery2_0(parent, (NamedQuery2_0Annotation) annotation); - } - - public JavaCollectionTable2_0 buildJavaCollectionTable(JavaElementCollectionMapping2_0 parent, Table.Owner owner) { - return new GenericJavaCollectionTable2_0(parent, owner); - } - - public JavaOrderColumn2_0 buildJavaOrderColumn(JavaOrderable2_0 parent, JavaNamedColumn.Owner owner) { - return new GenericJavaOrderColumn2_0(parent, owner); - } - - public JavaColumn buildJavaMapKeyColumn(JavaJpaContextNode parent, JavaColumn.Owner owner) { - return new GenericJavaColumn(parent, owner); - } - - public JavaOrderable2_0 buildJavaOrderable(JavaAttributeMapping parent, Owner owner) { - return new GenericJavaOrderable(parent, owner); - } - - @Override - public JavaOrderable buildJavaOrderable(JavaAttributeMapping parent) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java deleted file mode 100644 index 4b1817069d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/GenericMetamodelSynchronizer.java +++ /dev/null @@ -1,432 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2; - -import java.io.PrintWriter; -import java.io.StringWriter; -import java.util.Collection; -import java.util.Date; -import java.util.Iterator; -import java.util.Map; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jpt.common.core.utility.BodySourceWriter; -import org.eclipse.jpt.common.utility.internal.ClassName; -import org.eclipse.jpt.common.utility.internal.SimpleStack; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.jpa2.JpaProject2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.AttributeMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JavaResourcePersistentType2_0; - -import com.ibm.icu.text.DateFormat; -import com.ibm.icu.text.SimpleDateFormat; - -/** - * For now, the "synchronization" is simple brute-force: we generate the source - * code and then compare it with what is already present in the file. - * If the new source is different, we replace the file contents; otherwise, we - * leave the file unchanged. - */ -@SuppressWarnings("nls") -public class GenericMetamodelSynchronizer - implements MetamodelSourceType.Synchronizer -{ - protected final MetamodelSourceType sourceType; - - - public GenericMetamodelSynchronizer(MetamodelSourceType sourceType) { - super(); - this.sourceType = sourceType; - } - - public IFile getFile() { - return (IFile) this.getPackageFragment().getCompilationUnit(this.getFileName()).getResource(); - } - - - // ********** synchronize ********** - - public void synchronize(Map> memberTypeTree) { - try { - this.synchronize_(memberTypeTree); - } catch (JavaModelException ex) { - JptJpaCorePlugin.log(ex); - } - } - - protected void synchronize_(Map> memberTypeTree) throws JavaModelException { - IPackageFragment pkg = this.getPackageFragment(); - String fileName = this.getFileName(); - - ICompilationUnit compilationUnit = pkg.getCompilationUnit(fileName); - if (compilationUnit.exists()) { - // overwrite existing file if it has changed (ignoring the timestamp) - String newSource = this.buildSource(compilationUnit, memberTypeTree); - if (newSource != null) { - pkg.createCompilationUnit(fileName, newSource, true, null); // true=force - } - } else { - // write a new file, creating the package folders if necessary - if ( ! pkg.exists()) { - this.getSourceFolder().createPackageFragment(pkg.getElementName(), true, null); // true=force - } - pkg.createCompilationUnit(fileName, this.buildSource(memberTypeTree), false, null); // false=no force - } - } - - /** - * pre-condition: the compilation unit exists - * - * return null if the old source is not to be replaced - */ - protected String buildSource(ICompilationUnit compilationUnit, Map> memberTypeTree) throws JavaModelException { - IFile file = (IFile) compilationUnit.getResource(); - JavaResourcePersistentType2_0 genType = this.getJpaProject().getGeneratedMetamodelTopLevelType(file); - if (genType == null) { - return null; // the file exists, but its source is not a generated metamodel top-level class - } - - String oldSource = compilationUnit.getSource(); - int oldLength = oldSource.length(); - - String newSource = this.buildSource(memberTypeTree); - int newLength = newSource.length(); - if (newLength != oldLength) { - return newSource; - } - - String date = genType.getGeneratedAnnotation().getDate(); // if we get here, this will be non-empty - int dateBegin = oldSource.indexOf(date); - if (dateBegin == -1) { - return null; // hmmm... - } - int dateEnd = dateBegin + date.length(); - if (dateEnd > oldLength) { - return null; // hmmm... - } - - if (newSource.regionMatches(0, oldSource, 0, dateBegin) && - newSource.regionMatches(dateEnd, oldSource, dateEnd, oldLength - dateEnd)) { - return null; - } - return newSource; - } - - - // ********** package/file ********** - - protected IPackageFragment getPackageFragment() { - return this.getSourceFolder().getPackageFragment(this.getPackageName()); - } - - protected IPackageFragmentRoot getSourceFolder() { - return this.getJpaProject().getMetamodelPackageFragmentRoot(); - } - - protected JpaProject2_0 getJpaProject() { - return (JpaProject2_0) this.sourceType.getJpaProject(); - } - - protected String getPackageName() { - return this.buildPackageName(this.sourceType.getName()); - } - - protected String buildPackageName(String topLevelSourceTypeName) { - return this.buildPackageName_(ClassName.getPackageName(topLevelSourceTypeName)); - } - - // TODO - protected String buildPackageName_(String sourcePackageName) { - // the default is to store the metamodel class in the same package as the source type - return sourcePackageName; - } - - protected String getFileName() { - return ClassName.getSimpleName(this.getClassName()) + ".java"; - } - - protected String getClassName() { - return this.buildClassName(this.sourceType.getName()); - } - - protected String buildClassName(Map> memberTypeTree) { - return this.buildClassName(this.sourceType.getName(), memberTypeTree); - } - - protected String buildClassName(String sourceTypeName, Map> memberTypeTree) { - String current = sourceTypeName; - SimpleStack stack = new SimpleStack(); - - while (true) { - stack.push(ClassName.getSimpleName(current)); - String declaringTypeName = this.getDeclaringTypeName(current, memberTypeTree); - if (declaringTypeName == null) { - break; - } - current = declaringTypeName; - } - - StringBuilder sb = new StringBuilder(sourceTypeName.length() + 10); - sb.append(this.buildPackageName(current)); - while ( ! stack.isEmpty()) { - sb.append('.'); - sb.append(this.buildSimpleClassName(stack.pop())); - } - return sb.toString(); - } - - protected String buildClassName(String topLevelSourceTypeName) { - return this.buildPackageName(topLevelSourceTypeName) + '.' + this.buildSimpleClassName(ClassName.getSimpleName(topLevelSourceTypeName)); - } - - protected String getSimpleClassName() { - return this.buildSimpleClassName(ClassName.getSimpleName(this.sourceType.getName())); - } - - // TODO - protected String buildSimpleClassName(String simpleSourceTypeName) { - // the default is to simply append an underscore to the source type name - return simpleSourceTypeName + '_'; - } - - - // ********** source code ********** - - /** - * build the "body" source first; then build the "package" and "imports" source - * and concatenate the "body" source to it - */ - protected String buildSource(Map> memberTypeTree) { - // build the body source first so we can gather up the import statements - BodySourceWriter bodySourceWriter = this.buildBodySourceWriter(memberTypeTree); - - StringWriter sw = new StringWriter(bodySourceWriter.getLength() + 2000); - PrintWriter pw = new PrintWriter(sw); - this.printPackageAndImportsOn(pw, bodySourceWriter); - pw.print(bodySourceWriter.getSource()); - return sw.toString(); - } - - protected BodySourceWriter buildBodySourceWriter(Map> memberTypeTree) { - BodySourceWriter pw = new BodySourceWriter(this.getPackageName(), this.getClassName()); - this.printBodySourceOn(pw, memberTypeTree); - return pw; - } - - public void printBodySourceOn(BodySourceWriter pw, Map> memberTypeTree) { - this.printClassDeclarationOn(pw, memberTypeTree); - pw.print(" {"); - pw.println(); - - pw.indent(); - boolean attributesPrinted = this.printAttributesOn(pw); - this.printMemberTypesOn(pw, memberTypeTree, attributesPrinted); - pw.undent(); - - pw.print('}'); - pw.println(); // EOF - } - - - // ********** class declaration ********** - - protected void printClassDeclarationOn(BodySourceWriter pw, Map> memberTypeTree) { - boolean topLevel = this.sourceTypeIsTopLevel(memberTypeTree); - if (topLevel) { - this.printGeneratedAnnotationOn(pw); - } - if (this.sourceType.isManaged()) { - this.printStaticMetamodelAnnotationOn(pw); - } - - pw.print("public "); - if ( ! topLevel) { - pw.print("static "); - } - pw.print("class "); - pw.print(this.getSimpleClassName()); // this is always the simple name - PersistentType superPersistentType = this.sourceType.getSuperPersistentType(); - if (superPersistentType != null) { - pw.print(" extends "); - pw.printTypeDeclaration(this.buildClassName(superPersistentType.getName(), memberTypeTree)); - } - } - - /** - * Return whether the source type is a top level type. - * This can be inferred from the specified member type tree. - */ - protected boolean sourceTypeIsTopLevel(Map> memberTypeTree) { - return this.sourceTypeIsTopLevel(this.sourceType.getName(), memberTypeTree); - } - - /** - * Return whether the specified source type is a top level type. - * This can be inferred from the specified member type tree. - */ - protected boolean sourceTypeIsTopLevel(String sourceTypeName, Map> memberTypeTree) { - return this.getDeclaringTypeName(sourceTypeName, memberTypeTree) == null; - } - - /** - * Return the name of the specified source type's declaring type, as - * implied by the specified member type tree. Return null if the source - * type is a top-level type. - */ - protected String getDeclaringTypeName(String sourceTypeName, Map> memberTypeTree) { - int lastPeriod = sourceTypeName.lastIndexOf('.'); - if (lastPeriod == -1) { - return null; // default package top-level type - } - String declaringTypeName = sourceTypeName.substring(0, lastPeriod); - return (memberTypeTree.get(declaringTypeName) == null) ? null : declaringTypeName; - } - - protected void printGeneratedAnnotationOn(BodySourceWriter pw) { - pw.printAnnotation("javax.annotation.Generated"); - pw.print('('); - pw.print("value="); - pw.printStringLiteral(JavaResourcePersistentType2_0.METAMODEL_GENERATED_ANNOTATION_VALUE); - pw.print(", "); - pw.print("date="); - pw.printStringLiteral(format(new Date())); - pw.print(')'); - pw.println(); - } - - protected void printStaticMetamodelAnnotationOn(BodySourceWriter pw) { - pw.printAnnotation(JPA2_0.STATIC_METAMODEL); - pw.print('('); - pw.printTypeDeclaration(this.sourceType.getName()); - pw.print(".class"); - pw.print(')'); - pw.println(); - } - - /** - * {@link SimpleDateFormat} is not thread-safe. - */ - protected static synchronized String format(Date date) { - return DATE_FORMAT.format(date); - } - /** - * Recommended date format is ISO 8601. - * See javax.annotation.Generated - */ - private static final DateFormat DATE_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSZ"); - - - // ********** attributes ********** - - /** - * Return whether any attributes were printed. - */ - protected boolean printAttributesOn(BodySourceWriter pw) { - boolean printed = false; - for (Iterator stream = this.sourceType.attributes(); stream.hasNext(); ) { - this.printAttributeOn(stream.next(), pw); - printed = true; - } - return printed; - } - - protected void printAttributeOn(PersistentAttribute persistentAttribute, BodySourceWriter pw) { - AttributeMapping attributeMapping = persistentAttribute.getMapping(); - if (attributeMapping != null) { // probably shouldn't be null? - this.printAttributeMappingOn(attributeMapping, pw); - } - } - - protected void printAttributeMappingOn(AttributeMapping attributeMapping, BodySourceWriter pw) { - MetamodelField field = ((AttributeMapping2_0) attributeMapping).getMetamodelField(); - if (field != null) { - this.printFieldOn(field, pw); - } - } - - protected void printFieldOn(MetamodelField field, BodySourceWriter pw) { - for (String modifier : field.getModifiers()) { - pw.print(modifier); - pw.print(' '); - } - pw.printTypeDeclaration(field.getTypeName()); - pw.print('<'); - for (Iterator stream = field.getTypeArgumentNames().iterator(); stream.hasNext(); ) { - pw.printTypeDeclaration(stream.next()); - if (stream.hasNext()) { - pw.print(", "); - } - } - pw.print('>'); - pw.print(' '); - pw.print(field.getName()); - pw.print(';'); - pw.println(); - } - - - // ********** member types ********** - - protected void printMemberTypesOn(BodySourceWriter pw, Map> memberTypeTree, boolean attributesPrinted) { - Collection memberTypes = memberTypeTree.get(this.sourceType.getName()); - if (memberTypes != null) { - if (attributesPrinted) { - pw.println(); - } - for (Iterator stream = memberTypes.iterator(); stream.hasNext(); ) { - stream.next().printBodySourceOn(pw, memberTypeTree); - if (stream.hasNext()) { - pw.println(); - } - } - } - } - - - // ********** package and imports ********** - - protected void printPackageAndImportsOn(PrintWriter pw, BodySourceWriter bodySourceWriter) { - if (this.getPackageName().length() != 0) { - pw.print("package "); - pw.print(this.getPackageName()); - pw.print(';'); - pw.println(); - pw.println(); - } - - for (String import_ : bodySourceWriter.getImports()) { - pw.print("import "); - pw.print(import_); - pw.print(';'); - pw.println(); - } - pw.println(); - } - - - // ********** misc ********** - - @Override - public String toString() { - return StringTools.buildToStringFor(this, this.sourceType.getName()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/CollectionTableValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/CollectionTableValidator.java deleted file mode 100644 index a54439ba79..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/CollectionTableValidator.java +++ /dev/null @@ -1,57 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context; - -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractTableValidator; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0; - -public class CollectionTableValidator extends AbstractTableValidator -{ - public CollectionTableValidator(CollectionTable2_0 table, TableTextRangeResolver textRangeResolver) { - super(table, textRangeResolver); - } - - public CollectionTableValidator(PersistentAttribute persistentAttribute, CollectionTable2_0 table, TableTextRangeResolver textRangeResolver) { - super(persistentAttribute, table, textRangeResolver); - } - - @Override - protected String getUnresolvedCatalogMessage() { - return JpaValidationMessages.COLLECTION_TABLE_UNRESOLVED_CATALOG; - } - - @Override - protected String getVirtualAttributeUnresolvedCatalogMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_CATALOG; - } - - @Override - protected String getUnresolvedSchemaMessage() { - return JpaValidationMessages.COLLECTION_TABLE_UNRESOLVED_SCHEMA; - } - - @Override - protected String getVirtualAttributeUnresolvedSchemaMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_SCHEMA; - } - - @Override - protected String getUnresolvedNameMessage() { - return JpaValidationMessages.COLLECTION_TABLE_UNRESOLVED_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_COLLECTION_TABLE_UNRESOLVED_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/OrderColumnValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/OrderColumnValidator.java deleted file mode 100644 index 687472f808..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/OrderColumnValidator.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context; - -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AbstractNamedColumnValidator; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.OrderColumn2_0; - -public class OrderColumnValidator - extends AbstractNamedColumnValidator -{ - public OrderColumnValidator( - OrderColumn2_0 column, - NamedColumnTextRangeResolver textRangeResolver) { - super(column, textRangeResolver); - } - - public OrderColumnValidator( - PersistentAttribute persistentAttribute, - OrderColumn2_0 column, - NamedColumnTextRangeResolver textRangeResolver) { - super(persistentAttribute, column, textRangeResolver); - } - - @Override - protected String getUnresolvedNameMessage() { - return JpaValidationMessages.ORDER_COLUMN_UNRESOLVED_NAME; - } - - @Override - protected String getVirtualAttributeUnresolvedNameMessage() { - return JpaValidationMessages.VIRTUAL_ATTRIBUTE_ORDER_COLUMN_UNRESOLVED_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/SimpleMetamodelField.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/SimpleMetamodelField.java deleted file mode 100644 index 7720bfbd30..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/SimpleMetamodelField.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context; - -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; - -/** - * Straightforward implementation. - */ -public class SimpleMetamodelField - implements MetamodelField -{ - protected final Iterable modifiers; - protected final String typeName; - protected final Iterable typeArgumentNames; - protected final String name; - - public SimpleMetamodelField( - Iterable modifiers, - String typeName, - Iterable typeArgumentNames, - String name - ) { - super(); - if (modifiers == null) { - throw new NullPointerException(); - } - if (typeName == null) { - throw new NullPointerException(); - } - if (typeArgumentNames == null) { - throw new NullPointerException(); - } - if (name == null) { - throw new NullPointerException(); - } - this.modifiers = modifiers; - this.typeName = typeName; - this.typeArgumentNames = typeArgumentNames; - this.name = name; - } - - public Iterable getModifiers() { - return this.modifiers; - } - - public String getTypeName() { - return this.typeName; - } - - public Iterable getTypeArgumentNames() { - return this.typeArgumentNames; - } - - public String getName() { - return this.name; - } - - @Override - public int hashCode() { - return CollectionTools.hashCode(this.modifiers) ^ - this.typeName.hashCode() ^ - CollectionTools.hashCode(this.typeArgumentNames) ^ - this.name.hashCode(); - } - - @Override - public boolean equals(Object o) { - if ( ! (o instanceof MetamodelField)) { - return false; - } - MetamodelField other = (MetamodelField) o; - return CollectionTools.elementsAreEqual(this.getModifiers(), other.getModifiers()) && - this.getTypeName().equals(other.getTypeName()) && - CollectionTools.elementsAreEqual(this.getTypeArgumentNames(), other.getTypeArgumentNames()) && - this.getName().equals(other.getName()); - } - - @Override - public String toString() { - StringBuilder sb = new StringBuilder(); - for (String modifier : this.modifiers) { - sb.append(modifier); - sb.append(' '); - } - sb.append(this.typeName); - sb.append('<'); - for (String typeArgumentName : this.typeArgumentNames) { - sb.append(typeArgumentName); - sb.append(", "); //$NON-NLS-1$ - } - sb.setLength(sb.length() - 2); - sb.append('>'); - sb.append(' '); - sb.append(this.name); - return sb.toString(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java deleted file mode 100644 index 48d9c79669..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMapping2_0.java +++ /dev/null @@ -1,1530 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.Association; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.SimpleAssociation; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.AssociationOverride; -import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.AttributeOverride; -import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.Embeddable; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.FetchType; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.OverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.java.JavaColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaEnumeratedConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaLobConverter; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.java.JavaTemporalConverter; -import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaAttributeMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.CollectionTableTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.NullJavaConverter; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.CollectionTableValidator; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0; -import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionTable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentAttribute2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.CompleteColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * JPA 2.0 Frankenstein mapping - */ -public abstract class AbstractJavaElementCollectionMapping2_0 - extends AbstractJavaAttributeMapping - implements JavaElementCollectionMapping2_0 -{ - protected String specifiedTargetClass; - protected String defaultTargetClass; - protected String fullyQualifiedTargetClass; - - protected FetchType specifiedFetch; - protected FetchType defaultFetch; - - protected final JavaOrderable2_0 orderable; - - protected final JavaCollectionTable2_0 collectionTable; - - protected Type valueType; - protected final JavaColumn valueColumn; - protected JavaConverter converter; // value converter - never null - protected final JavaAttributeOverrideContainer valueAttributeOverrideContainer; - protected final JavaAssociationOverrideContainer valueAssociationOverrideContainer; - - protected Type keyType; - - //MapKey is not supported by the spec, so this is only for EclipseLink - //In the generic case we can handle this with validation and not showing the UI widgets - protected String specifiedMapKey; - protected boolean noMapKey = false; - protected boolean pkMapKey = false; - protected boolean customMapKey = false; - - protected String specifiedMapKeyClass; - protected String defaultMapKeyClass; - protected String fullyQualifiedMapKeyClass; - - protected final JavaColumn mapKeyColumn; - - protected final JavaAttributeOverrideContainer mapKeyAttributeOverrideContainer; - - - protected static final JavaConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new JavaConverter.Adapter[] { - JavaEnumeratedConverter.Adapter.instance(), - JavaTemporalConverter.Adapter.instance(), - JavaLobConverter.Adapter.instance() - }; - protected static final Iterable CONVERTER_ADAPTERS = new ArrayIterable(CONVERTER_ADAPTER_ARRAY); - - - protected AbstractJavaElementCollectionMapping2_0(JavaPersistentAttribute parent) { - super(parent); - this.specifiedTargetClass = this.buildSpecifiedTargetClass(); - this.specifiedFetch = this.buildSpecifiedFetch(); - this.orderable = this.buildOrderable(); - this.collectionTable = this.buildCollectionTable(); - - this.valueColumn = this.buildValueColumn(); - this.converter = this.buildConverter(); - this.valueAttributeOverrideContainer = this.buildValueAttributeOverrideContainer(); - this.valueAssociationOverrideContainer = this.buildValueAssociationOverrideContainer(); - - this.specifiedMapKey = this.buildSpecifiedMapKey(); - this.noMapKey = this.buildNoMapKey(); - this.pkMapKey = this.buildPkMapKey(); - this.customMapKey = this.buildCustomMapKey(); - this.specifiedMapKeyClass = this.buildSpecifiedMapKeyClass(); - - this.mapKeyColumn = this.buildMapKeyColumn(); - this.mapKeyAttributeOverrideContainer = this.buildMapKeyAttributeOverrideContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedTargetClass_(this.buildSpecifiedTargetClass()); - this.setSpecifiedFetch_(this.buildSpecifiedFetch()); - this.orderable.synchronizeWithResourceModel(); - this.collectionTable.synchronizeWithResourceModel(); - - this.valueColumn.synchronizeWithResourceModel(); - this.syncConverter(); - this.valueAttributeOverrideContainer.synchronizeWithResourceModel(); - this.valueAssociationOverrideContainer.synchronizeWithResourceModel(); - - this.setSpecifiedMapKey_(this.buildSpecifiedMapKey()); - this.setNoMapKey_(this.buildNoMapKey()); - this.setPkMapKey_(this.buildPkMapKey()); - this.setCustomMapKey_(this.buildCustomMapKey()); - this.setSpecifiedMapKeyClass_(this.buildSpecifiedMapKeyClass()); - - this.mapKeyColumn.synchronizeWithResourceModel(); - this.mapKeyAttributeOverrideContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - - this.setDefaultTargetClass(this.buildDefaultTargetClass()); - this.setFullyQualifiedTargetClass(this.buildFullyQualifiedTargetClass()); - this.setDefaultFetch(this.buildDefaultFetch()); - - this.orderable.update(); - this.collectionTable.update(); - - this.setValueType(this.buildValueType()); - this.valueColumn.update(); - this.converter.update(); - this.valueAttributeOverrideContainer.update(); - this.valueAssociationOverrideContainer.update(); - - this.setKeyType(this.buildKeyType()); - this.setDefaultMapKeyClass(this.buildDefaultMapKeyClass()); - this.setFullyQualifiedMapKeyClass(this.buildFullyQualifiedMapKeyClass()); - - this.mapKeyColumn.update(); - this.mapKeyAttributeOverrideContainer.update(); - } - - - // ********** target class ********** - - public String getTargetClass() { - return (this.specifiedTargetClass != null) ? this.specifiedTargetClass : this.defaultTargetClass; - } - - public String getSpecifiedTargetClass() { - return this.specifiedTargetClass; - } - - public void setSpecifiedTargetClass(String targetClass) { - if (this.valuesAreDifferent(targetClass, this.specifiedTargetClass)) { - this.getAnnotationForUpdate().setTargetClass(targetClass); - this.setSpecifiedTargetClass_(targetClass); - } - } - - protected void setSpecifiedTargetClass_(String targetClass) { - String old = this.specifiedTargetClass; - this.specifiedTargetClass = targetClass; - this.firePropertyChanged(SPECIFIED_TARGET_CLASS_PROPERTY, old, targetClass); - } - - protected String buildSpecifiedTargetClass() { - ElementCollection2_0Annotation annotation = this.getMappingAnnotation(); - return (annotation == null) ? null : annotation.getTargetClass(); - } - - public String getDefaultTargetClass() { - return this.defaultTargetClass; - } - - protected void setDefaultTargetClass(String targetClass) { - String old = this.defaultTargetClass; - this.defaultTargetClass = targetClass; - this.firePropertyChanged(DEFAULT_TARGET_CLASS_PROPERTY, old, targetClass); - } - - protected String buildDefaultTargetClass() { - return this.getPersistentAttribute().getMultiReferenceTargetTypeName(); - } - - public String getFullyQualifiedTargetClass() { - return this.fullyQualifiedTargetClass; - } - - protected void setFullyQualifiedTargetClass(String targetClass) { - String old = this.fullyQualifiedTargetClass; - this.fullyQualifiedTargetClass = targetClass; - this.firePropertyChanged(FULLY_QUALIFIED_TARGET_CLASS_PROPERTY, old, targetClass); - } - - protected String buildFullyQualifiedTargetClass() { - return (this.specifiedTargetClass == null) ? - this.defaultTargetClass : - this.getMappingAnnotation().getFullyQualifiedTargetClassName(); - } - - public char getTargetClassEnclosingTypeSeparator() { - return '.'; - } - - - // ********** resolved target type/embeddable/entity ********** - - public PersistentType getResolvedTargetType() { - return this.getPersistenceUnit().getPersistentType(this.fullyQualifiedTargetClass); - } - - protected Embeddable getResolvedTargetEmbeddable() { - return this.getPersistenceUnit().getEmbeddable(this.fullyQualifiedTargetClass); - } - - protected Entity getResolvedTargetEntity() { - return this.getPersistenceUnit().getEntity(this.fullyQualifiedTargetClass); - } - - - // ********** fetch ********** - - public FetchType getFetch() { - return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch; - } - - public FetchType getSpecifiedFetch() { - return this.specifiedFetch; - } - - public void setSpecifiedFetch(FetchType fetch) { - if (this.valuesAreDifferent(fetch, this.specifiedFetch)) { - this.getAnnotationForUpdate().setFetch(FetchType.toJavaResourceModel(fetch)); - this.setSpecifiedFetch_(fetch); - } - } - - protected void setSpecifiedFetch_(FetchType fetch) { - FetchType old = this.specifiedFetch; - this.specifiedFetch = fetch; - this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch); - } - - protected FetchType buildSpecifiedFetch() { - ElementCollection2_0Annotation annotation = this.getMappingAnnotation(); - return (annotation == null) ? null : FetchType.fromJavaResourceModel(annotation.getFetch()); - } - - public FetchType getDefaultFetch() { - return this.defaultFetch; - } - - protected void setDefaultFetch(FetchType fetch) { - FetchType old = this.defaultFetch; - this.defaultFetch = fetch; - this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch); - } - - protected FetchType buildDefaultFetch() { - return DEFAULT_FETCH_TYPE; - } - - - // ********** orderable ********** - - public JavaOrderable2_0 getOrderable() { - return this.orderable; - } - - protected JavaOrderable2_0 buildOrderable() { - return this.getJpaFactory().buildJavaOrderable(this, this.buildOrderableOwner()); - } - - protected Orderable2_0.Owner buildOrderableOwner() { - return new OrderableOwner(); - } - - protected class OrderableOwner - implements Orderable2_0.Owner - { - public String getTableName() { - return this.getCollectionTable().getName(); - } - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return this.getCollectionTable().getDbTable(); - } - protected JavaCollectionTable2_0 getCollectionTable() { - return AbstractJavaElementCollectionMapping2_0.this.getCollectionTable(); - } - } - - - // ********** collection table ********** - - public JavaCollectionTable2_0 getCollectionTable() { - return this.collectionTable; - } - - protected JavaCollectionTable2_0 buildCollectionTable() { - return this.getJpaFactory().buildJavaCollectionTable(this, this.buildCollectionTableOwner()); - } - - protected Table.Owner buildCollectionTableOwner() { - return new CollectionTableOwner(); - } - - protected class CollectionTableOwner - implements Table.Owner - { - public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) { - return new CollectionTableValidator((CollectionTable2_0) table, textRangeResolver); - } - } - - - // ********** value type ********** - - public Type getValueType() { - return this.valueType; - } - - protected void setValueType(Type valueType) { - Type old = this.valueType; - this.valueType = valueType; - this.firePropertyChanged(VALUE_TYPE_PROPERTY, old, valueType); - } - - protected Type buildValueType() { - if (this.getResolvedTargetEmbeddable() != null) { - return Type.EMBEDDABLE_TYPE; - } - if (this.getResolvedTargetEntity() != null) { - return Type.ENTITY_TYPE; - } - if (this.getTargetClass() == null) { - return Type.NO_TYPE; - } - return Type.BASIC_TYPE; - } - - - // ********** value column ********** - - public JavaColumn getValueColumn() { - return this.valueColumn; - } - - protected JavaColumn buildValueColumn() { - return this.getJpaFactory().buildJavaColumn(this, this.buildValueColumnOwner()); - } - - protected JavaColumn.Owner buildValueColumnOwner() { - return new ValueColumnOwner(); - } - - protected ColumnAnnotation getValueColumnAnnotation() { - return (ColumnAnnotation) this.getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME); - } - - protected void removeValueColumnAnnotation() { - this.getResourcePersistentAttribute().removeAnnotation(ColumnAnnotation.ANNOTATION_NAME); - } - - - // ********** converter ********** - - public JavaConverter getConverter() { - return this.converter; - } - - public void setConverter(Class converterType) { - if (this.converter.getType() != converterType) { - this.converter.dispose(); - JavaConverter.Adapter converterAdapter = this.getConverterAdapter(converterType); - this.retainConverterAnnotation(converterAdapter); - this.setConverter_(this.buildConverter(converterAdapter)); - } - } - - protected JavaConverter buildConverter(JavaConverter.Adapter converterAdapter) { - return (converterAdapter != null) ? - converterAdapter.buildNewConverter(this, this.getJpaFactory()) : - this.buildNullConverter(); - } - - protected void setConverter_(JavaConverter converter) { - Converter old = this.converter; - this.converter = converter; - this.firePropertyChanged(CONVERTER_PROPERTY, old, converter); - } - - /** - * Clear all the converter annotations except for the annotation - * corresponding to the specified adapter. If the specified adapter is - * null, remove all the converter annotations. - */ - protected void retainConverterAnnotation(JavaConverter.Adapter converterAdapter) { - JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute(); - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter != converterAdapter) { - adapter.removeConverterAnnotation(resourceAttribute); - } - } - } - - protected JavaConverter buildConverter() { - JpaFactory jpaFactory = this.getJpaFactory(); - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - JavaConverter javaConverter = adapter.buildConverter(this, jpaFactory); - if (javaConverter != null) { - return javaConverter; - } - } - return this.buildNullConverter(); - } - - protected void syncConverter() { - Association assoc = this.getConverterAnnotation(); - if (assoc == null) { - if (this.converter.getType() != null) { - this.setConverter_(this.buildNullConverter()); - } - } else { - JavaConverter.Adapter adapter = assoc.getKey(); - Annotation annotation = assoc.getValue(); - if ((this.converter.getType() == adapter.getConverterType()) && - (this.converter.getConverterAnnotation() == annotation)) { - this.converter.synchronizeWithResourceModel(); - } else { - this.setConverter_(adapter.buildConverter(annotation, this, this.getJpaFactory())); - } - } - } - - /** - * Return the first converter annotation we find along with its corresponding - * adapter. Return null if there are no converter annotations. - */ - protected Association getConverterAnnotation() { - JavaResourcePersistentAttribute resourceAttribute = this.getResourcePersistentAttribute(); - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - Annotation annotation = adapter.getConverterAnnotation(resourceAttribute); - if (annotation != null) { - return new SimpleAssociation(adapter, annotation); - } - } - return null; - } - - protected JavaConverter buildNullConverter() { - return new NullJavaConverter(this); - } - - - // ********** converter adapters ********** - - /** - * Return the converter adapter for the specified converter type. - */ - protected JavaConverter.Adapter getConverterAdapter(Class converterType) { - for (JavaConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.getConverterType() == converterType) { - return adapter; - } - } - return null; - } - - protected Iterable getConverterAdapters() { - return CONVERTER_ADAPTERS; - } - - - // ********** value attribute override container ********** - - public JavaAttributeOverrideContainer getValueAttributeOverrideContainer() { - return this.valueAttributeOverrideContainer; - } - - protected JavaAttributeOverrideContainer buildValueAttributeOverrideContainer() { - return this.getJpaFactory().buildJavaAttributeOverrideContainer(this, this.buildValueAttributeOverrideContainerOwner()); - } - - protected JavaAttributeOverrideContainer.Owner buildValueAttributeOverrideContainerOwner() { - return new ValueAttributeOverrideContainerOwner(); - } - - - // ********** value association override container ********** - - public JavaAssociationOverrideContainer getValueAssociationOverrideContainer() { - return this.valueAssociationOverrideContainer; - } - - protected JavaAssociationOverrideContainer buildValueAssociationOverrideContainer() { - return this.getJpaFactory().buildJavaAssociationOverrideContainer(this, this.buildValueAssociationOverrideContainerOwner()); - } - - protected JavaAssociationOverrideContainer.Owner buildValueAssociationOverrideContainerOwner() { - return new ValueAssociationOverrideContainerOwner(); - } - - - // ********** key type ********** - - public Type getKeyType() { - return this.keyType; - } - - protected void setKeyType(Type keyType) { - Type old = this.keyType; - this.keyType = keyType; - this.firePropertyChanged(KEY_TYPE_PROPERTY, old, keyType); - } - - protected Type buildKeyType() { - if (this.getResolvedMapKeyEmbeddable() != null) { - return Type.EMBEDDABLE_TYPE; - } - if (this.getResolvedMapKeyEntity() != null) { - return Type.ENTITY_TYPE; - } - if (this.getMapKeyClass() == null) { - return Type.NO_TYPE; - } - return Type.BASIC_TYPE; - } - - - // ********** map key ********** - - public String getMapKey() { - if (this.noMapKey) { - return null; - } - if (this.pkMapKey) { - // the target is either embeddable or basic, so a key will have to be specified - return null; - } - if (this.customMapKey) { - return this.specifiedMapKey; - } - throw new IllegalStateException("unknown map key"); //$NON-NLS-1$ - } - - - // ********** specified map key ********** - - public String getSpecifiedMapKey() { - return this.specifiedMapKey; - } - - public void setSpecifiedMapKey(String mapKey) { - if (mapKey != null) { - this.getMapKeyAnnotationForUpdate().setName(mapKey); - - this.setSpecifiedMapKey_(mapKey); - this.setNoMapKey_(false); - this.setPkMapKey_(false); - this.setCustomMapKey_(true); - } else { - this.setPkMapKey(true); // hmmm... - } - } - - protected void setSpecifiedMapKey_(String mapKey) { - String old = this.specifiedMapKey; - this.specifiedMapKey = mapKey; - this.firePropertyChanged(SPECIFIED_MAP_KEY_PROPERTY, old, mapKey); - } - - protected String buildSpecifiedMapKey() { - MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation(); - return (mapKeyAnnotation == null) ? null : mapKeyAnnotation.getName(); - } - - - // ********** no map key ********** - - public boolean isNoMapKey() { - return this.noMapKey; - } - - public void setNoMapKey(boolean noMapKey) { - if (noMapKey) { - if (this.getMapKeyAnnotation() != null) { - this.removeMapKeyAnnotation(); - } - - this.setSpecifiedMapKey_(null); - this.setNoMapKey_(true); - this.setPkMapKey_(false); - this.setCustomMapKey_(false); - } else { - this.setPkMapKey(true); // hmmm... - } - } - - protected void setNoMapKey_(boolean noMapKey) { - boolean old = this.noMapKey; - this.noMapKey = noMapKey; - this.firePropertyChanged(NO_MAP_KEY_PROPERTY, old, noMapKey); - } - - protected boolean buildNoMapKey() { - return this.getMapKeyAnnotation() == null; - } - - - // ********** pk map key ********** - - public boolean isPkMapKey() { - return this.pkMapKey; - } - - public void setPkMapKey(boolean pkMapKey) { - if (pkMapKey) { - MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation(); - if (mapKeyAnnotation == null) { - mapKeyAnnotation = this.addMapKeyAnnotation(); - } else { - mapKeyAnnotation.setName(null); - } - - this.setSpecifiedMapKey_(null); - this.setNoMapKey_(false); - this.setPkMapKey_(true); - this.setCustomMapKey_(false); - } else { - this.setNoMapKey(true); // hmmm... - } - } - - protected void setPkMapKey_(boolean pkMapKey) { - boolean old = this.pkMapKey; - this.pkMapKey = pkMapKey; - this.firePropertyChanged(PK_MAP_KEY_PROPERTY, old, pkMapKey); - } - - protected boolean buildPkMapKey() { - MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation(); - return (mapKeyAnnotation != null) && (mapKeyAnnotation.getName() == null); - } - - - // ********** custom map key ********** - - public boolean isCustomMapKey() { - return this.customMapKey; - } - - public void setCustomMapKey(boolean customMapKey) { - if (customMapKey) { - this.setSpecifiedMapKey(""); //$NON-NLS-1$ - } else { - this.setNoMapKey(true); // hmmm... - } - } - - protected void setCustomMapKey_(boolean customMapKey) { - boolean old = this.customMapKey; - this.customMapKey = customMapKey; - this.firePropertyChanged(CUSTOM_MAP_KEY_PROPERTY, old, customMapKey); - } - - protected boolean buildCustomMapKey() { - MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation(); - return (mapKeyAnnotation != null) && (mapKeyAnnotation.getName() != null); - } - - - // ********** map key annotation ********** - - protected MapKeyAnnotation getMapKeyAnnotation() { - return (MapKeyAnnotation) this.getResourcePersistentAttribute().getAnnotation(MapKeyAnnotation.ANNOTATION_NAME); - } - - protected MapKeyAnnotation getMapKeyAnnotationForUpdate() { - MapKeyAnnotation annotation = this.getMapKeyAnnotation(); - return (annotation != null ) ? annotation : this.addMapKeyAnnotation(); - } - - protected MapKeyAnnotation addMapKeyAnnotation() { - return (MapKeyAnnotation) this.getResourcePersistentAttribute().addAnnotation(MapKeyAnnotation.ANNOTATION_NAME); - } - - protected void removeMapKeyAnnotation() { - this.getResourcePersistentAttribute().removeAnnotation(MapKeyAnnotation.ANNOTATION_NAME); - } - - protected boolean mapKeyNameTouches(int pos, CompilationUnit astRoot) { - MapKeyAnnotation mapKeyAnnotation = this.getMapKeyAnnotation(); - return (mapKeyAnnotation != null) && mapKeyAnnotation.nameTouches(pos, astRoot); - } - - - // ********** map key class ********** - - public String getMapKeyClass() { - return (this.specifiedMapKeyClass != null) ? this.specifiedMapKeyClass : this.defaultMapKeyClass; - } - - public String getSpecifiedMapKeyClass() { - return this.specifiedMapKeyClass; - } - - public void setSpecifiedMapKeyClass(String mapKeyClass) { - if (this.valuesAreDifferent(mapKeyClass, this.specifiedMapKeyClass)) { - MapKeyClass2_0Annotation annotation = this.getMapKeyClassAnnotation(); - if (mapKeyClass == null) { - if (annotation != null) { - this.removeMapKeyClassAnnotation(); - } - } else { - if (annotation == null) { - annotation = this.addMapKeyClassAnnotation(); - } - annotation.setValue(mapKeyClass); - } - - this.setSpecifiedMapKeyClass_(mapKeyClass); - } - } - - protected void setSpecifiedMapKeyClass_(String mapKeyClass) { - String old = this.specifiedMapKeyClass; - this.specifiedMapKeyClass = mapKeyClass; - this.firePropertyChanged(SPECIFIED_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass); - } - - protected String buildSpecifiedMapKeyClass() { - MapKeyClass2_0Annotation annotation = this.getMapKeyClassAnnotation(); - return (annotation == null) ? null : annotation.getValue(); - } - - public String getDefaultMapKeyClass() { - return this.defaultMapKeyClass; - } - - protected void setDefaultMapKeyClass(String mapKeyClass) { - String old = this.defaultMapKeyClass; - this.defaultMapKeyClass = mapKeyClass; - this.firePropertyChanged(DEFAULT_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass); - } - - protected String buildDefaultMapKeyClass() { - return this.getPersistentAttribute().getMultiReferenceMapKeyTypeName(); - } - - public String getFullyQualifiedMapKeyClass() { - return this.fullyQualifiedMapKeyClass; - } - - protected void setFullyQualifiedMapKeyClass(String mapKeyClass) { - String old = this.fullyQualifiedMapKeyClass; - this.fullyQualifiedMapKeyClass = mapKeyClass; - this.firePropertyChanged(FULLY_QUALIFIED_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass); - } - - protected String buildFullyQualifiedMapKeyClass() { - return (this.specifiedMapKeyClass == null) ? - this.defaultMapKeyClass : - this.getMapKeyClassAnnotation().getFullyQualifiedClassName(); - } - - public char getMapKeyClassEnclosingTypeSeparator() { - return '.'; - } - - - // ********** resolved map key embeddable/entity ********** - - protected Embeddable getResolvedMapKeyEmbeddable() { - return this.getPersistenceUnit().getEmbeddable(this.fullyQualifiedMapKeyClass); - } - - protected Entity getResolvedMapKeyEntity() { - return this.getPersistenceUnit().getEntity(this.fullyQualifiedMapKeyClass); - } - - - // ********** map key class annotation ********** - - protected MapKeyClass2_0Annotation getMapKeyClassAnnotation() { - return (MapKeyClass2_0Annotation) this.getResourcePersistentAttribute().getAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME); - } - - protected MapKeyClass2_0Annotation addMapKeyClassAnnotation() { - return (MapKeyClass2_0Annotation) this.getResourcePersistentAttribute().addAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME); - } - - protected void removeMapKeyClassAnnotation() { - this.getResourcePersistentAttribute().removeAnnotation(MapKeyClass2_0Annotation.ANNOTATION_NAME); - } - - - // ********** map key column ********** - - public JavaColumn getMapKeyColumn() { - return this.mapKeyColumn; - } - - protected JavaColumn buildMapKeyColumn() { - return this.getJpaFactory().buildJavaMapKeyColumn(this, this.buildMapKeyColumnOwner()); - } - - protected JavaColumn.Owner buildMapKeyColumnOwner() { - return new MapKeyColumnOwner(); - } - - protected MapKeyColumn2_0Annotation getMapKeyColumnAnnotation() { - return (MapKeyColumn2_0Annotation) this.getResourcePersistentAttribute().getNonNullAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME); - } - - protected void removeMapKeyColumnAnnotation() { - this.getResourcePersistentAttribute().removeAnnotation(MapKeyColumn2_0Annotation.ANNOTATION_NAME); - } - - - // ********** map key attribute override container ********** - - public JavaAttributeOverrideContainer getMapKeyAttributeOverrideContainer() { - return this.mapKeyAttributeOverrideContainer; - } - - protected JavaAttributeOverrideContainer buildMapKeyAttributeOverrideContainer() { - return this.getJpaFactory().buildJavaAttributeOverrideContainer(this, this.buildMapKeyAttributeOverrideContainerOwner()); - } - - protected JavaAttributeOverrideContainer.Owner buildMapKeyAttributeOverrideContainerOwner() { - return new MapKeyAttributeOverrideContainerOwner(); - } - - - // ********** embedded mappings ********** - - public Iterator candidateMapKeyNames() { - return this.allTargetEmbeddableAttributeNames(); - } - - protected Iterator allTargetEmbeddableAttributeNames() { - return new CompositeIterator(this.allTargetEmbeddableAttributeNamesLists()); - } - - /** - * Return a list of lists; each nested list holds the names for one of the - * embedded mapping's target embeddable type mapping's attribute mappings - * (attribute or association mappings, depending on the specified transformer). - */ - protected Iterator> allTargetEmbeddableAttributeNamesLists() { - return new TransformationIterator>(this.allTargetEmbeddableAttributeMappings(), AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER); - } - - protected Iterator allTargetEmbeddableAttributeMappings() { - Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable(); - return (targetEmbeddable != null) ? targetEmbeddable.allAttributeMappings() : EmptyIterator. instance(); - } - - @Override - @SuppressWarnings("unchecked") - public Iterator allMappingNames() { - return new CompositeIterator(super.allMappingNames(), this.allEmbeddableAttributeMappingNames()); - } - - protected Iterator allEmbeddableAttributeMappingNames() { - return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER); - } - - @Override - public Iterator allOverridableAttributeMappingNames() { - return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER); - } - - @Override - public Iterator allOverridableAssociationMappingNames() { - return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER); - } - - protected Iterator qualifiedEmbeddableOverridableMappingNames(Transformer> transformer) { - return new TransformationIterator(this.embeddableOverridableMappingNames(transformer), this.buildQualifierTransformer()); - } - - protected Iterator embeddableOverridableMappingNames(Transformer> transformer) { - return new CompositeIterator(this.embeddableOverridableMappingNamesLists(transformer)); - } - - /** - * Return a list of lists; each nested list holds the names for one of the - * embedded mapping's target embeddable type mapping's attribute mappings - * (attribute or association mappings, depending on the specified transformer). - */ - protected Iterator> embeddableOverridableMappingNamesLists(Transformer> transformer) { - return new TransformationIterator>(this.embeddableAttributeMappings(), transformer); - } - - @Override - public AttributeMapping resolveAttributeMapping(String attributeName) { - AttributeMapping resolvedMapping = super.resolveAttributeMapping(attributeName); - if (resolvedMapping != null) { - return resolvedMapping; - } - attributeName = this.unqualify(attributeName); - if (attributeName == null) { - return null; - } - // recurse into the embeddable mappings - for (AttributeMapping mapping : CollectionTools.iterable(this.embeddableAttributeMappings())) { - resolvedMapping = mapping.resolveAttributeMapping(attributeName); - if (resolvedMapping != null) { - return resolvedMapping; - } - } - return null; - } - - protected Iterator embeddableAttributeMappings() { - Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable(); - return ((targetEmbeddable != null) && (targetEmbeddable != this.getTypeMapping())) ? - targetEmbeddable.attributeMappings() : - EmptyIterator.instance(); - } - - @Override - public Column resolveOverriddenColumn(String attributeName) { - attributeName = this.unqualify(attributeName); - if (attributeName == null) { - return null; - } - AttributeOverride override = this.valueAttributeOverrideContainer.getSpecifiedOverrideNamed(attributeName); - // recurse into the target embeddable if necessary - return (override != null) ? override.getColumn() : this.resolveOverriddenColumnInTargetEmbeddable(attributeName); - } - - protected Column resolveOverriddenColumnInTargetEmbeddable(String attributeName) { - Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable(); - return (targetEmbeddable == null) ? null : targetEmbeddable.resolveOverriddenColumn(attributeName); - } - - @Override - public Relationship resolveOverriddenRelationship(String attributeName) { - attributeName = this.unqualify(attributeName); - if (attributeName == null) { - return null; - } - AssociationOverride override = this.valueAssociationOverrideContainer.getSpecifiedOverrideNamed(attributeName); - // recurse into the target embeddable if necessary - return (override != null) ? override.getRelationship() : this.resolveRelationshipInTargetEmbeddable(attributeName); - } - - protected Relationship resolveRelationshipInTargetEmbeddable(String attributeName) { - Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable(); - return (targetEmbeddable == null) ? null : targetEmbeddable.resolveOverriddenRelationship(attributeName); - } - - - // ********** misc ********** - - @Override - protected JpaFactory2_0 getJpaFactory() { - return (JpaFactory2_0) super.getJpaFactory(); - } - - public String getKey() { - return MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - @Override - protected String getAnnotationName() { - return ElementCollection2_0Annotation.ANNOTATION_NAME; - } - - public Entity getEntity() { - TypeMapping typeMapping = this.getTypeMapping(); - return (typeMapping instanceof Entity) ? (Entity) typeMapping : null; - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.collectionTable.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.valueColumn.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.converter.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.orderable.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.valueAttributeOverrideContainer.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.valueAssociationOverrideContainer.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.mapKeyNameTouches(pos, astRoot)) { - return this.javaCandidateMapKeyNames(filter); - } - result = this.mapKeyColumn.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.mapKeyAttributeOverrideContainer.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - return null; - } - - protected Iterator javaCandidateMapKeyNames(Filter filter) { - return StringTools.convertToJavaStringLiterals(this.candidateMapKeyNames(filter)); - } - - protected Iterator candidateMapKeyNames(Filter filter) { - return new FilteringIterator(this.candidateMapKeyNames(), filter); - } - - - // ********** metamodel ********** - - @Override - protected String getMetamodelFieldTypeName() { - return ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldTypeName(); - } - - @Override - public String getMetamodelTypeName() { - return (this.fullyQualifiedTargetClass != null) ? this.fullyQualifiedTargetClass : MetamodelField.DEFAULT_TYPE_NAME; - } - - @Override - protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList typeArgumentNames) { - this.addMetamodelFieldMapKeyTypeArgumentNameTo(typeArgumentNames); - super.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames); - } - - protected void addMetamodelFieldMapKeyTypeArgumentNameTo(ArrayList typeArgumentNames) { - String keyTypeName = ((JavaPersistentAttribute2_0) this.getPersistentAttribute()).getMetamodelContainerFieldMapKeyTypeName(); - if (keyTypeName != null) { - typeArgumentNames.add(keyTypeName); - } - } - - public String getMetamodelFieldMapKeyTypeName() { - return MappingTools.getMetamodelFieldMapKeyTypeName(this); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.validateTargetClass(messages, astRoot); - this.validateMapKeyClass(messages, astRoot); - this.orderable.validate(messages, reporter, astRoot); - this.collectionTable.validate(messages, reporter, astRoot); - this.validateValue(messages, reporter, astRoot); - this.validateMapKey(messages, reporter, astRoot); - } - - protected void validateTargetClass(List messages, CompilationUnit astRoot) { - if (this.getTargetClass() == null) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED, - EMPTY_STRING_ARRAY, - this, - this.getValidationTextRange(astRoot) - ) - ); - } - //TODO this does not give an error for unmapped, unlisted types that aren't basic - bug 310464 - if (this.getResolvedTargetType() != null) { - if (this.getResolvedTargetEmbeddable() == null) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE, - new String[] {this.getTargetClass()}, - this, - this.getTargetClassTextRange(astRoot) - ) - ); - } - } - } - - protected TextRange getTargetClassTextRange(CompilationUnit astRoot) { - ElementCollection2_0Annotation annotation = this.getMappingAnnotation(); - return (annotation == null) ? null : this.getTextRange(annotation.getTargetClassTextRange(astRoot), astRoot); - } - - protected TextRange getTextRange(TextRange textRange, CompilationUnit astRoot) { - return (textRange != null) ? textRange : this.getParent().getValidationTextRange(astRoot); - } - - protected void validateMapKeyClass(List messages, CompilationUnit astRoot) { - if (this.getPersistentAttribute().getJpaContainerDefinition().isMap()) { - this.validateMapKeyClass_(messages, astRoot); - } - } - - protected void validateMapKeyClass_(List messages, CompilationUnit astRoot) { - if (this.getMapKeyClass() == null) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED, - EMPTY_STRING_ARRAY, - this, - this.getValidationTextRange(astRoot) - ) - ); - } - } - - protected void validateValue(List messages, IReporter reporter, CompilationUnit astRoot) { - //TODO should we handle validation when the type is embeddable, - //but a value column is specified, or things like that if that is invalid? - switch (this.valueType) { - case BASIC_TYPE : - this.valueColumn.validate(messages, reporter, astRoot); - this.converter.validate(messages, reporter, astRoot); - break; - case EMBEDDABLE_TYPE : - this.valueAttributeOverrideContainer.validate(messages, reporter, astRoot); - this.valueAssociationOverrideContainer.validate(messages, reporter, astRoot); - break; - default : - break; - } - } - - protected void validateMapKey(List messages, IReporter reporter, CompilationUnit astRoot) { - if (this.getMapKey() == null) { - this.validateMapKey_(messages, reporter, astRoot); - } else { - //TODO validate that the map key refers to an existing attribute - } - } - - protected void validateMapKey_(List messages, IReporter reporter, CompilationUnit astRoot) { - switch (this.keyType) { - case BASIC_TYPE : - this.mapKeyColumn.validate(messages, reporter, astRoot); - //validate map key converter - break; - case ENTITY_TYPE : - //validate map key join columns - break; - case EMBEDDABLE_TYPE : - this.mapKeyAttributeOverrideContainer.validate(messages, reporter, astRoot); - //validate map key association overrides - break; - default : - break; - } - } - - - // ********** abstract owner ********** - - /** - * the various (column and override) owners have lots of common - * interactions with the mapping - */ - protected abstract class AbstractOwner - { - public JavaResourcePersistentMember getResourcePersistentMember() { - return AbstractJavaElementCollectionMapping2_0.this.getResourcePersistentAttribute(); - } - - public TypeMapping getTypeMapping() { - return AbstractJavaElementCollectionMapping2_0.this.getTypeMapping(); - } - - public String getDefaultTableName() { - return this.getCollectionTable().getName(); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - JavaCollectionTable2_0 table = this.getCollectionTable(); - return Tools.valuesAreEqual(table.getName(), tableName) ? table.getDbTable() : null; - } - - public java.util.Iterator candidateTableNames() { - return EmptyIterator.instance(); - } - - /** - * If there is a specified table name it needs to be the same - * the default table name. the table is always the collection table - */ - public boolean tableNameIsInvalid(String tableName) { - return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return AbstractJavaElementCollectionMapping2_0.this.getValidationTextRange(astRoot); - } - - protected String getMappingName() { - return AbstractJavaElementCollectionMapping2_0.this.getName(); - } - - protected JavaCollectionTable2_0 getCollectionTable() { - return AbstractJavaElementCollectionMapping2_0.this.getCollectionTable(); - } - } - - - // ********** value column owner ********** - - protected class ValueColumnOwner - extends AbstractOwner - implements JavaColumn.Owner - { - public CompleteColumnAnnotation getColumnAnnotation() { - return AbstractJavaElementCollectionMapping2_0.this.getValueColumnAnnotation(); - } - - public void removeColumnAnnotation() { - AbstractJavaElementCollectionMapping2_0.this.removeValueColumnAnnotation(); - } - - public String getDefaultColumnName() { - return this.getMappingName(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new NamedColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); - } - } - - - // ********** map key column owner ********** - - protected class MapKeyColumnOwner - extends AbstractOwner - implements JavaColumn.Owner - { - public MapKeyColumn2_0Annotation getColumnAnnotation() { - return AbstractJavaElementCollectionMapping2_0.this.getMapKeyColumnAnnotation(); - } - - public void removeColumnAnnotation() { - AbstractJavaElementCollectionMapping2_0.this.removeMapKeyColumnAnnotation(); - } - - public String getDefaultColumnName() { - return this.getMappingName() + "_KEY"; //$NON-NLS-1$ - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new MapKeyColumnValidator((BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); - } - } - - - // ********** value override container owner ********** - - protected abstract class ValueOverrideContainerOwner - extends AbstractOwner - { - protected static final String POSSIBLE_PREFIX = "value"; //$NON-NLS-1$ - - public TypeMapping getOverridableTypeMapping() { - return AbstractJavaElementCollectionMapping2_0.this.getResolvedTargetEmbeddable(); - } - - public String getPossiblePrefix() { - return POSSIBLE_PREFIX; - } - - public String getWritePrefix() { - return this.getPersistentAttribute().getJpaContainerDefinition().isMap() ? this.getPossiblePrefix() : null; - } - - //return false if the override is prefixed with "key.", these will be part of the MapKeyAttributeOverrideContainer. - //a prefix of "value." or no prefix at all is relevant. If the type is not a Map then return true since all attribute overrides - //need to apply to the value. - public boolean isRelevant(String overrideName) { - if (AbstractJavaElementCollectionMapping2_0.this.getKeyType() != Type.EMBEDDABLE_TYPE) { - return true; - } - return ! overrideName.startsWith(MapKeyAttributeOverrideContainerOwner.RELEVANT_PREFIX_); - } - - protected JavaPersistentAttribute getPersistentAttribute() { - return AbstractJavaElementCollectionMapping2_0.this.getPersistentAttribute(); - } - - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new AssociationOverrideValidator((AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) columnOwner, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); - } - - public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$ - } - - public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$ - } - - public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) { - throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$ - } - } - - - // ********** value attribute override container owner ********** - - protected class ValueAttributeOverrideContainerOwner - extends ValueOverrideContainerOwner - implements JavaAttributeOverrideContainer.Owner - { - public Iterator allOverridableNames() { - TypeMapping typeMapping = this.getOverridableTypeMapping(); - return (typeMapping != null) ? typeMapping.allOverridableAttributeNames() : EmptyIterator.instance(); - } - - public Column resolveOverriddenColumn(String attributeName) { - return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName); - } - - @Override - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new AttributeOverrideValidator((AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); - } - - @Override - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) { - return new AttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider()); - } - } - - - // ********** value association override container owner ********** - - protected class ValueAssociationOverrideContainerOwner - extends ValueOverrideContainerOwner - implements JavaAssociationOverrideContainer.Owner - { - public Iterator allOverridableNames() { - TypeMapping typeMapping = this.getOverridableTypeMapping(); - return (typeMapping != null) ? typeMapping.allOverridableAssociationNames() : EmptyIterator.instance(); - } - - public Relationship resolveOverriddenRelationship(String attributeName) { - return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName); - } - - @Override - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new AssociationOverrideValidator((AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); - } - - @Override - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinColumnValidator((AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) columnOwner, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); - } - - @Override - public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$ - } - - @Override - public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$ - } - - @Override - public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) { - throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$ - } - } - - - // ********** map key attribute override container owner ********** - - protected class MapKeyAttributeOverrideContainerOwner - extends AbstractOwner - implements JavaAttributeOverrideContainer.Owner - { - protected static final String POSSIBLE_PREFIX = "key"; //$NON-NLS-1$ - protected static final String RELEVANT_PREFIX_ = "key."; //$NON-NLS-1$ - - public TypeMapping getOverridableTypeMapping() { - return AbstractJavaElementCollectionMapping2_0.this.getResolvedMapKeyEmbeddable(); - } - - public Iterator allOverridableNames() { - TypeMapping typeMapping = this.getOverridableTypeMapping(); - return (typeMapping != null) ? typeMapping.allOverridableAttributeNames() : EmptyIterator.instance(); - } - - public String getPossiblePrefix() { - return POSSIBLE_PREFIX; - } - - public String getWritePrefix() { - return this.getPossiblePrefix(); - } - - // the only relevant overrides are those that start with "key."; - // no prefix will be a value attribute override - public boolean isRelevant(String overrideName) { - if (AbstractJavaElementCollectionMapping2_0.this.getValueType() != Type.EMBEDDABLE_TYPE) { - return true; - } - return overrideName.startsWith(RELEVANT_PREFIX_); - } - - public Column resolveOverriddenColumn(String attributeName) { - return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName); - } - - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new MapKeyAttributeOverrideValidator((AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) { - return new MapKeyAttributeOverrideColumnValidator((AttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider()); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMappingDefinition2_0.java deleted file mode 100644 index afa599982c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaElementCollectionMappingDefinition2_0.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.JpaFactory; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.jpa2.JpaFactory2_0; -import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.OrderByAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.TemporalAnnotation; - -public abstract class AbstractJavaElementCollectionMappingDefinition2_0 - implements JavaAttributeMappingDefinition -{ - protected AbstractJavaElementCollectionMappingDefinition2_0() { - super(); - } - - public String getKey() { - return MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public String getAnnotationName() { - return ElementCollection2_0Annotation.ANNOTATION_NAME; - } - - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - return persistentAttribute.getResourcePersistentAttribute().getAnnotation(this.getAnnotationName()) != null; - } - - public Iterable getSupportingAnnotationNames() { - return SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY = new String[] { - AssociationOverrideAnnotation.ANNOTATION_NAME, - AssociationOverridesAnnotation.ANNOTATION_NAME, - AttributeOverrideAnnotation.ANNOTATION_NAME, - AttributeOverridesAnnotation.ANNOTATION_NAME, - CollectionTable2_0Annotation.ANNOTATION_NAME, - ColumnAnnotation.ANNOTATION_NAME, - EnumeratedAnnotation.ANNOTATION_NAME, - LobAnnotation.ANNOTATION_NAME, - MapKeyAnnotation.ANNOTATION_NAME, - MapKeyClass2_0Annotation.ANNOTATION_NAME, - MapKeyColumn2_0Annotation.ANNOTATION_NAME, - MapKeyEnumerated2_0Annotation.ANNOTATION_NAME, - MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME, - MapKeyJoinColumns2_0Annotation.ANNOTATION_NAME, - MapKeyTemporal2_0Annotation.ANNOTATION_NAME, - OrderByAnnotation.ANNOTATION_NAME, - OrderColumn2_0Annotation.ANNOTATION_NAME, - TemporalAnnotation.ANNOTATION_NAME - }; - protected static final Iterable SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(SUPPORTING_ANNOTATION_NAMES_ARRAY); - - public JavaAttributeMapping buildMapping(JavaPersistentAttribute persistentAttribute, JpaFactory factory) { - return ((JpaFactory2_0) factory).buildJavaElementCollectionMapping2_0(persistentAttribute); - } - - @Override - public String toString() { - return this.getClass().getSimpleName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaIdMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaIdMappingDefinition2_0.java deleted file mode 100644 index 72615562d6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/AbstractJavaIdMappingDefinition2_0.java +++ /dev/null @@ -1,56 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaIdMappingDefinition; - -/** - * JPA 2.0 Id mapping - */ -public abstract class AbstractJavaIdMappingDefinition2_0 - extends AbstractJavaIdMappingDefinition -{ - protected AbstractJavaIdMappingDefinition2_0() { - super(); - } - - /** - * Return the annotation only if it is not "derived". - */ - @Override - public boolean isSpecified(JavaPersistentAttribute persistentAttribute) { - boolean idSpecified = super.isSpecified(persistentAttribute); - return idSpecified && ! this.isDerivedId(persistentAttribute); - } - - /** - * Return whether the specified attribute's Id annotation is - * a supporting annotation for M-1 or 1-1 mapping, as opposed to a primary - * mapping annotation. - *

- * This might produce confusing behavior if the annotations look something - * like:

-	 *     @Id @Basic @ManyToOne private int foo;
-	 * 
- */ - protected boolean isDerivedId(JavaPersistentAttribute persistentAttribute) { - return this.attributeHasManyToOneMapping(persistentAttribute) || - this.attributeHasOneToOneMapping(persistentAttribute); - } - - protected boolean attributeHasManyToOneMapping(JavaPersistentAttribute persistentAttribute) { - return JavaManyToOneMappingDefinition2_0.instance().isSpecified(persistentAttribute); - } - - protected boolean attributeHasOneToOneMapping(JavaPersistentAttribute persistentAttribute) { - return JavaOneToOneMappingDefinition2_0.instance().isSpecified(persistentAttribute); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java deleted file mode 100644 index 0220fc6606..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCacheable2_0.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * Java cacheable - */ -public class GenericJavaCacheable2_0 - extends AbstractJavaJpaContextNode - implements JavaCacheable2_0 -{ - protected Boolean specifiedCacheable; - protected boolean defaultCacheable; - - - public GenericJavaCacheable2_0(JavaCacheableHolder2_0 parent) { - super(parent); - this.specifiedCacheable = this.buildSpecifiedCacheable(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedCacheable_(this.buildSpecifiedCacheable()); - } - - @Override - public void update() { - super.update(); - this.setDefaultCacheable(this.buildDefaultCacheable()); - } - - - // ********** cacheable ********** - - public boolean isCacheable() { - return (this.specifiedCacheable != null) ? this.specifiedCacheable.booleanValue() : this.defaultCacheable; - } - - public Boolean getSpecifiedCacheable() { - return this.specifiedCacheable; - } - - public void setSpecifiedCacheable(Boolean cacheable) { - if (this.valuesAreDifferent(cacheable, this.specifiedCacheable)) { - if (cacheable == null) { - this.removeCacheableAnnotation(); - } else { - Cacheable2_0Annotation annotation = this.getCacheableAnnotationForUpdate(); - Boolean value = annotation.getValue(); - if (cacheable.booleanValue()) { - if ((value != null) && ! value.booleanValue()) { // @Cacheable(false) - annotation.setValue(null); // set to @Cacheable - } - } else { - annotation.setValue(Boolean.FALSE); - } - } - - this.setSpecifiedCacheable_(cacheable); - } - } - - protected void setSpecifiedCacheable_(Boolean cacheable) { - Boolean old = this.specifiedCacheable; - this.specifiedCacheable = cacheable; - this.firePropertyChanged(SPECIFIED_CACHEABLE_PROPERTY, old, cacheable); - } - - private Boolean buildSpecifiedCacheable() { - Cacheable2_0Annotation annotation = this.getCacheableAnnotation(); - if (annotation == null) { - return null; - } - Boolean value = annotation.getValue(); - // @Cacheable is equivalent to @Cacheable(true) - return (value != null) ? value : Boolean.TRUE; - } - - public boolean isDefaultCacheable() { - return this.defaultCacheable; - } - - protected void setDefaultCacheable(boolean cacheable) { - boolean old = this.defaultCacheable; - this.defaultCacheable = cacheable; - this.firePropertyChanged(DEFAULT_CACHEABLE_PROPERTY, old, cacheable); - } - - protected boolean buildDefaultCacheable() { - return this.getCacheableHolder().calculateDefaultCacheable(); - } - - - // ********** cacheable annotation ********** - - /** - * Return null if the annotation does not exists. - */ - protected Cacheable2_0Annotation getCacheableAnnotation() { - return (Cacheable2_0Annotation) this.getResourcePersistentType().getAnnotation(this.getCacheableAnnotationName()); - } - - /** - * Build the annotation if it does not exist. - */ - protected Cacheable2_0Annotation getCacheableAnnotationForUpdate() { - Cacheable2_0Annotation annotation = this.getCacheableAnnotation(); - return (annotation != null) ? annotation : this.buildCacheableAnnotation(); - } - - protected Cacheable2_0Annotation buildCacheableAnnotation() { - return (Cacheable2_0Annotation) this.getResourcePersistentType().addAnnotation(this.getCacheableAnnotationName()); - } - - protected void removeCacheableAnnotation() { - this.getResourcePersistentType().removeAnnotation(this.getCacheableAnnotationName()); - } - - protected String getCacheableAnnotationName() { - return Cacheable2_0Annotation.ANNOTATION_NAME; - } - - - // ********** misc ********** - - @Override - public JavaCacheableHolder2_0 getParent() { - return (JavaCacheableHolder2_0) super.getParent(); - } - - protected JavaCacheableHolder2_0 getCacheableHolder() { - return this.getParent(); - } - - protected JavaResourcePersistentType getResourcePersistentType() { - return this.getCacheableHolder().getResourcePersistentType(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - Cacheable2_0Annotation annotation = this.getCacheableAnnotation(); - return (annotation == null) ? null : annotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java deleted file mode 100644 index 2efb54baa2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaCollectionTable2_0.java +++ /dev/null @@ -1,178 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaJoinColumn; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.CollectionTableTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.java.GenericJavaReferenceTable; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCollectionTable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation; - -/** - * Java collection table - */ -public class GenericJavaCollectionTable2_0 - extends GenericJavaReferenceTable - implements JavaCollectionTable2_0 -{ - public GenericJavaCollectionTable2_0(JavaElementCollectionMapping2_0 parent, Owner owner) { - super(parent, owner); - } - - @Override - protected JavaJoinColumn.Owner buildJoinColumnOwner() { - return new JoinColumnOwner(); - } - - - // ********** table annotation ********** - - @Override - public CollectionTable2_0Annotation getTableAnnotation() { - return (CollectionTable2_0Annotation) this.getElementCollectionMapping().getResourcePersistentAttribute().getNonNullAnnotation(CollectionTable2_0Annotation.ANNOTATION_NAME); - } - - @Override - protected void removeTableAnnotation() { - this.getElementCollectionMapping().getResourcePersistentAttribute().removeAnnotation(CollectionTable2_0Annotation.ANNOTATION_NAME); - } - - - // ********** misc ********** - - public PersistentAttribute getPersistentAttribute() { - return this.getElementCollectionMapping().getPersistentAttribute(); - } - - @Override - public JavaElementCollectionMapping2_0 getParent() { - return (JavaElementCollectionMapping2_0) super.getParent(); - } - - protected JavaElementCollectionMapping2_0 getElementCollectionMapping() { - return this.getParent(); - } - - @Override - protected String buildDefaultName() { - return MappingTools.buildCollectionTableDefaultName(this.getElementCollectionMapping()); - } - - - // ********** validation ********** - - public boolean validatesAgainstDatabase() { - return this.getElementCollectionMapping().validatesAgainstDatabase(); - } - - - // ********** join column owner ********** - - /** - * owner for "back-pointer" join columns; - * these point at the source/owning entity - */ - protected class JoinColumnOwner - implements JavaJoinColumn.Owner - { - protected JoinColumnOwner() { - super(); - } - - public TypeMapping getTypeMapping() { - return GenericJavaCollectionTable2_0.this.getElementCollectionMapping().getTypeMapping(); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return Tools.valuesAreEqual(GenericJavaCollectionTable2_0.this.getName(), tableName) ? - GenericJavaCollectionTable2_0.this.getDbTable() : - null; - } - - public String getDefaultColumnName() { - //built in MappingTools.buildJoinColumnDefaultName() - return null; - } - - /** - * by default, the join column is, obviously, in the collection table; - * not sure whether it can be anywhere else... - */ - public String getDefaultTableName() { - return GenericJavaCollectionTable2_0.this.getName(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return GenericJavaCollectionTable2_0.this.getValidationTextRange(astRoot); - } - - public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() { - return this.getTypeMapping().getPrimaryDbTable(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return GenericJavaCollectionTable2_0.this.getDefaultJoinColumn() == joinColumn; - } - - /** - * If there is a specified table name it needs to be the same - * the default table name. The table is always the collection table. - */ - public boolean tableNameIsInvalid(String tableName) { - return ! StringTools.stringsAreEqual(this.getDefaultTableName(), tableName); - } - - /** - * the join column can only be on the collection table itself - */ - public Iterator candidateTableNames() { - return EmptyIterator.instance(); - } - - public Entity getRelationshipTarget() { - return GenericJavaCollectionTable2_0.this.getElementCollectionMapping().getEntity(); - } - - public String getAttributeName() { - return null; //I *think* this is correct - //return GenericJavaCollectionTable2_0.this.getParent().getName(); - } - - public PersistentAttribute getPersistentAttribute() { - return GenericJavaCollectionTable2_0.this.getElementCollectionMapping().getPersistentAttribute(); - } - - public int joinColumnsSize() { - return GenericJavaCollectionTable2_0.this.joinColumnsSize(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new JoinColumnValidator((JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java deleted file mode 100644 index 0816a1f901..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaDerivedIdentity2_0.java +++ /dev/null @@ -1,198 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.DerivedIdentityStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaIdDerivedIdentityStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMapsIdDerivedIdentityStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaDerivedIdentity2_0 - extends AbstractJavaJpaContextNode - implements JavaDerivedIdentity2_0 -{ - protected DerivedIdentityStrategy2_0 strategy; - - protected final JavaIdDerivedIdentityStrategy2_0 idStrategy; - - protected final JavaMapsIdDerivedIdentityStrategy2_0 mapsIdStrategy; - - - public GenericJavaDerivedIdentity2_0(JavaSingleRelationshipMapping2_0 parent) { - super(parent); - this.idStrategy = this.buildIdStrategy(); - this.mapsIdStrategy = this.buildMapsIdStrategy(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.idStrategy.synchronizeWithResourceModel(); - this.mapsIdStrategy.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.idStrategy.update(); - this.mapsIdStrategy.update(); - this.updateStrategy(); - } - - - // ********** predominant strategy ********** - - public DerivedIdentityStrategy2_0 getPredominantDerivedIdentityStrategy() { - return this.strategy; - } - - protected void setStrategy(DerivedIdentityStrategy2_0 strategy) { - DerivedIdentityStrategy2_0 old = this.strategy; - this.strategy = strategy; - this.firePropertyChanged(PREDOMINANT_DERIVED_IDENTITY_STRATEGY_PROPERTY, old, strategy); - } - - protected void updateStrategy() { - this.setStrategy(this.buildStrategy()); - } - - protected DerivedIdentityStrategy2_0 buildStrategy() { - if (this.mapsIdStrategy.isSpecified()) { - return this.mapsIdStrategy; - } - if (this.idStrategy.isSpecified()) { - return this.idStrategy; - } - return null; - } - - - // ********** null strategy ********** - - public boolean usesNullDerivedIdentityStrategy() { - return this.strategy == null; - } - - public void setNullDerivedIdentityStrategy() { - this.mapsIdStrategy.removeStrategy(); - this.idStrategy.removeStrategy(); - this.updateStrategy(); - } - - - // ********** ID strategy ********** - - public JavaIdDerivedIdentityStrategy2_0 getIdDerivedIdentityStrategy() { - return this.idStrategy; - } - - public void setIdDerivedIdentityStrategy() { - this.idStrategy.addStrategy(); - this.mapsIdStrategy.removeStrategy(); - this.updateStrategy(); - } - - public void unsetIdDerivedIdentityStrategy() { - this.idStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean usesIdDerivedIdentityStrategy() { - return this.strategy == this.idStrategy; - } - - protected JavaIdDerivedIdentityStrategy2_0 buildIdStrategy() { - return new GenericJavaIdDerivedIdentityStrategy2_0(this); - } - - - // ********** maps ID strategy ********** - - public JavaMapsIdDerivedIdentityStrategy2_0 getMapsIdDerivedIdentityStrategy() { - return this.mapsIdStrategy; - } - - public void setMapsIdDerivedIdentityStrategy() { - this.mapsIdStrategy.addStrategy(); - this.idStrategy.removeStrategy(); - this.updateStrategy(); - } - - public void unsetMapsIdDerivedIdentityStrategy() { - this.mapsIdStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean usesMapsIdDerivedIdentityStrategy() { - return this.strategy == this.mapsIdStrategy; - } - - protected JavaMapsIdDerivedIdentityStrategy2_0 buildMapsIdStrategy() { - return new GenericJavaMapsIdDerivedIdentityStrategy2_0(this); - } - - - // ********** misc ********** - - @Override - public JavaSingleRelationshipMapping2_0 getParent() { - return (JavaSingleRelationshipMapping2_0) super.getParent(); - } - - public JavaSingleRelationshipMapping2_0 getMapping() { - return this.getParent(); - } - - - // ********** java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.mapsIdStrategy.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - result = this.idStrategy.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - return null; - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.idStrategy.validate(messages, reporter, astRoot); - this.mapsIdStrategy.validate(messages, reporter, astRoot); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getMapping().getValidationTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java deleted file mode 100644 index acaed18545..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaElementCollectionMapping2_0.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; - -public class GenericJavaElementCollectionMapping2_0 - extends AbstractJavaElementCollectionMapping2_0 -{ - public GenericJavaElementCollectionMapping2_0(JavaPersistentAttribute parent) { - super(parent); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java deleted file mode 100644 index 2635174885..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaEmbeddable2_0.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEmbeddable; -import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation; - -/** - * JPA 2.0 - * Java embeddable type mapping - */ -public class GenericJavaEmbeddable2_0 - extends AbstractJavaEmbeddable -{ - public GenericJavaEmbeddable2_0(JavaPersistentType parent, EmbeddableAnnotation mappingAnnotation) { - super(parent, mappingAnnotation); - } - - @Override - public boolean attributeMappingKeyAllowed(String attributeMappingKey) { - return ArrayTools.contains(ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey); - } - - public static final String[] ALLOWED_ATTRIBUTE_MAPPING_KEYS = - new String[] { - MappingKeys.BASIC_ATTRIBUTE_MAPPING_KEY, - MappingKeys.MANY_TO_ONE_ATTRIBUTE_MAPPING_KEY, - MappingKeys.ONE_TO_MANY_ATTRIBUTE_MAPPING_KEY, - MappingKeys.ONE_TO_ONE_ATTRIBUTE_MAPPING_KEY, - MappingKeys.MANY_TO_MANY_ATTRIBUTE_MAPPING_KEY, - MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY, - MappingKeys.EMBEDDED_ATTRIBUTE_MAPPING_KEY, - MappingKeys.TRANSIENT_ATTRIBUTE_MAPPING_KEY - }; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java deleted file mode 100644 index 9f5ec69202..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaIdDerivedIdentityStrategy2_0.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaIdDerivedIdentityStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0; -import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaIdDerivedIdentityStrategy2_0 - extends AbstractJavaJpaContextNode - implements JavaIdDerivedIdentityStrategy2_0 -{ - protected boolean value; - - - public GenericJavaIdDerivedIdentityStrategy2_0(JavaDerivedIdentity2_0 parent) { - super(parent); - this.value = this.buildValue(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setValue_(this.buildValue()); - } - - - // ********** value ********** - - public boolean getValue() { - return this.value; - } - - public void setValue(boolean value) { - if (value != this.value) { - if (value) { - this.addAnnotation(); - } else { - this.removeAnnotation(); - } - this.setValue_(value); - } - } - - protected void setValue_(boolean value) { - boolean old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - protected boolean buildValue() { - return this.getAnnotation() != null; - } - - - // ********** annotation ********** - - protected IdAnnotation getAnnotation() { - return (IdAnnotation) this.getResourceAttribute().getAnnotation(this.getAnnotationName()); - } - - protected void addAnnotation() { - this.getResourceAttribute().addAnnotation(this.getAnnotationName()); - } - - protected void removeAnnotation() { - this.getResourceAttribute().removeAnnotation(this.getAnnotationName()); - } - - protected String getAnnotationName() { - return IdAnnotation.ANNOTATION_NAME; - } - - - // ********** misc ********** - - @Override - public JavaDerivedIdentity2_0 getParent() { - return (JavaDerivedIdentity2_0) super.getParent(); - } - - protected JavaDerivedIdentity2_0 getDerivedIdentity() { - return this.getParent(); - } - - protected JavaSingleRelationshipMapping2_0 getMapping() { - return this.getDerivedIdentity().getMapping(); - } - - protected JavaResourcePersistentAttribute getResourceAttribute() { - return this.getMapping().getPersistentAttribute().getResourcePersistentAttribute(); - } - - public boolean isSpecified() { - return this.value; - } - - public void addStrategy() { - this.setValue(true); - } - - public void removeStrategy() { - this.setValue(false); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - // no validation rules - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - IdAnnotation annotation = this.getAnnotation(); - return (annotation == null) ? null : annotation.getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java deleted file mode 100644 index df745d2cca..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaMapsIdDerivedIdentityStrategy2_0.java +++ /dev/null @@ -1,361 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import java.util.Iterator; -import java.util.List; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.Filter; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.common.utility.internal.iterators.FilteringIterator; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.Embeddable; -import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMapsIdDerivedIdentityStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericJavaMapsIdDerivedIdentityStrategy2_0 - extends AbstractJavaJpaContextNode - implements JavaMapsIdDerivedIdentityStrategy2_0 -{ - protected String specifiedValue; - protected String defaultValue; - - - public GenericJavaMapsIdDerivedIdentityStrategy2_0(JavaDerivedIdentity2_0 parent) { - super(parent); - this.specifiedValue = this.buildSpecifiedValue(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedValue_(this.buildSpecifiedValue()); - } - - @Override - public void update() { - super.update(); - this.setDefaultValue(this.buildDefaultValue()); - } - - - // ********** value ********** - - public String getValue() { - return (this.specifiedValue != null) ? this.specifiedValue : this.defaultValue; - } - - public String getSpecifiedValue() { - return this.specifiedValue; - } - - public void setSpecifiedValue(String value) { - if (this.valuesAreDifferent(value, this.specifiedValue)) { - this.getAnnotation().setValue(value); - this.setSpecifiedValue_(value); - } - } - - protected void setSpecifiedValue_(String value) { - String old = this.specifiedValue; - this.specifiedValue = value; - this.firePropertyChanged(SPECIFIED_VALUE_PROPERTY, old, value); - } - - protected String buildSpecifiedValue() { - return this.getAnnotation().getValue(); - } - - public String getDefaultValue() { - return this.defaultValue; - } - - protected void setDefaultValue(String value) { - String old = this.defaultValue; - this.defaultValue = value; - this.firePropertyChanged(SPECIFIED_VALUE_PROPERTY, old, value); - } - - protected String buildDefaultValue() { - Iterator stream = this.getIdAttributeMappings().iterator(); - if (stream.hasNext()) { - AttributeMapping mapping = stream.next(); - // return null if we have more than one id mapping - return stream.hasNext() ? null : mapping.getName(); - } - return null; // empty - } - - public boolean usesDefaultValue() { - return true; - } - - - // ********** annotation ********** - - /** - * Do not return null. - */ - protected MapsId2_0Annotation getAnnotation() { - return (MapsId2_0Annotation) this.getResourceAttribute().getNonNullAnnotation(this.getAnnotationName()); - } - - /** - * Return null if the annotation is not present. - */ - protected MapsId2_0Annotation getAnnotationOrNull() { - return (MapsId2_0Annotation) this.getResourceAttribute().getAnnotation(this.getAnnotationName()); - } - - protected void addAnnotation() { - this.getResourceAttribute().addAnnotation(this.getAnnotationName()); - } - - protected void removeAnnotation() { - this.getResourceAttribute().removeAnnotation(this.getAnnotationName()); - } - - protected String getAnnotationName() { - return MapsId2_0Annotation.ANNOTATION_NAME; - } - - - // ********** misc ********** - - @Override - public JavaDerivedIdentity2_0 getParent() { - return (JavaDerivedIdentity2_0) super.getParent(); - } - - protected JavaDerivedIdentity2_0 getDerivedIdentity() { - return this.getParent(); - } - - protected JavaSingleRelationshipMapping2_0 getMapping() { - return this.getDerivedIdentity().getMapping(); - } - - protected JavaPersistentAttribute getPersistentAttribute() { - return this.getMapping().getPersistentAttribute(); - } - - protected JavaResourcePersistentAttribute getResourceAttribute() { - return this.getPersistentAttribute().getResourcePersistentAttribute(); - } - - protected Iterable getAllAttributeMappings() { - return CollectionTools.collection(this.getPersistentAttribute().getOwningTypeMapping().allAttributeMappings()); - } - - public Iterable getSortedValueChoices() { - return CollectionTools.sort(this.getAllAttributeMappingChoiceNames()); - } - - protected Iterable getAllAttributeMappingChoiceNames() { - return new TransformationIterable(this.getAllAttributeMappingChoices()) { - @Override - protected String transform(AttributeMapping mapping) { - return mapping.getName(); - } - }; - } - - protected Iterable getAllAttributeMappingChoices() { - return this.buildAttributeMappingChoices(this.getAllAttributeMappings()); - } - - protected Iterable buildAttributeMappingChoices(Iterable attributeMappings) { - return new CompositeIterable(this.getAttributeMappingChoiceIterables(attributeMappings)); - } - - /** - * @see #getEmbeddedIdMappingChoiceIterable(EmbeddedIdMapping) - */ - protected Iterable> getAttributeMappingChoiceIterables(Iterable availableMappings) { - return new TransformationIterable>(availableMappings) { - @Override - protected Iterable transform(AttributeMapping mapping) { - if (Tools.valuesAreEqual(mapping.getKey(), MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY)) { - return GenericJavaMapsIdDerivedIdentityStrategy2_0.this.getEmbeddedIdMappingChoiceIterable((EmbeddedIdMapping) mapping); - } - return new SingleElementIterable(mapping); - } - }; - } - - /** - * Convert the specified mapping into a collection of its "mappings". - * Typically, this collection will include just the mapping itself; - * but, if the mapping is an embedded ID, this collection will include - * the mapping itself plus all the mappings of its target embeddable. - */ - protected Iterable getEmbeddedIdMappingChoiceIterable(EmbeddedIdMapping mapping) { - Embeddable embeddable = mapping.getTargetEmbeddable(); - if (embeddable == null) { - return new SingleElementIterable(mapping); - } - return new CompositeIterable( - mapping, - CollectionTools.collection(embeddable.allAttributeMappings()) - ); - } - - public AttributeMapping getResolvedAttributeMappingValue() { - String value = this.getValue(); - if (value != null) { - for (AttributeMapping mapping : this.getAllAttributeMappingChoices()) { - if (value.equals(mapping.getName())) { - return mapping; - } - } - } - return null; - } - - public boolean isSpecified() { - return this.getAnnotationOrNull() != null; - } - - public void addStrategy() { - if (this.getAnnotationOrNull() == null) { - this.addAnnotation(); - } - } - - public void removeStrategy() { - if (this.getAnnotationOrNull() != null) { - this.removeAnnotation(); - } - } - - - // ********** Java completion proposals ********** - - @Override - public Iterator javaCompletionProposals(int pos, Filter filter, CompilationUnit astRoot) { - Iterator result = super.javaCompletionProposals(pos, filter, astRoot); - if (result != null) { - return result; - } - if (this.getAnnotation().valueTouches(pos, astRoot)) { - result = this.sortedJavaValueChoices(filter); - } - return result; - } - - protected Iterator sortedJavaValueChoices(Filter filter) { - return StringTools.convertToJavaStringLiterals(new FilteringIterator(this.getSortedValueChoices(), filter)); - } - - - // ********** ID mappings ********** - - protected Iterable getIdAttributeMappings() { - return new FilteringIterable(this.getAllAttributeMappings()) { - @Override - protected boolean accept(AttributeMapping mapping) { - return GenericJavaMapsIdDerivedIdentityStrategy2_0.this.mappingIsIdMapping(mapping); - } - }; - } - - protected boolean mappingIsIdMapping(AttributeMapping mapping) { - return CollectionTools.contains(this.getIdMappingKeys(), mapping.getKey()); - } - - protected Iterable getIdMappingKeys() { - return ID_MAPPING_KEYS; - } - - protected static final String[] ID_MAPPING_KEYS_ARRAY = new String[] { - MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, - MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY - }; - - protected static final Iterable ID_MAPPING_KEYS = new ArrayIterable(ID_MAPPING_KEYS_ARRAY); - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter, CompilationUnit astRoot) { - super.validate(messages, reporter, astRoot); - this.validateMapsId(messages, astRoot); - } - - protected void validateMapsId(List messages, CompilationUnit astRoot) { - if (this.getDerivedIdentity().usesMapsIdDerivedIdentityStrategy()) { - this.validateMapsId_(messages, astRoot); - } - } - - protected void validateMapsId_(List messages, CompilationUnit astRoot) { - // test whether value can be resolved - AttributeMapping attributeMapping = this.getResolvedAttributeMappingValue(); - if (attributeMapping == null) { - // if value is not specified, use that message - if (this.specifiedValue == null) { - messages.add(this.buildMessage(JpaValidationMessages.MAPS_ID_VALUE_NOT_SPECIFIED, EMPTY_STRING_ARRAY, astRoot)); - } else { - messages.add(this.buildMessage(JpaValidationMessages.MAPS_ID_VALUE_NOT_RESOLVED, new String[] {this.getValue()}, astRoot)); - } - } else { - // test whether attribute mapping is allowable - if ( ! CollectionTools.contains(this.getValidAttributeMappingChoices(), attributeMapping)) { - messages.add(this.buildMessage(JpaValidationMessages.MAPS_ID_VALUE_INVALID, new String[] {this.getValue()}, astRoot)); - } - } - } - - protected Iterable getValidAttributeMappingChoices() { - return this.buildAttributeMappingChoices(this.getIdAttributeMappings()); - } - - protected IMessage buildMessage(String msgID, String[] parms, CompilationUnit astRoot) { - String attributeDescription = NLS.bind(JpaValidationDescriptionMessages.ATTRIBUTE_DESC, this.getPersistentAttribute().getName()); - parms = ArrayTools.add(parms, 0, attributeDescription); - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - msgID, - parms, - this, - this.getValidationTextRange(astRoot) - ); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getAnnotation().getTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java deleted file mode 100644 index 5b168c306e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaNamedQuery2_0.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaQuery; -import org.eclipse.jpt.jpa.core.jpa2.context.LockModeType2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaNamedQuery2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation; - -/** - * JPA 2.0 - * Java named query - */ -public class GenericJavaNamedQuery2_0 - extends AbstractJavaQuery - implements JavaNamedQuery2_0 -{ - protected LockModeType2_0 specifiedLockMode; - protected LockModeType2_0 defaultLockMode; - - - public GenericJavaNamedQuery2_0(JavaJpaContextNode parent, NamedQuery2_0Annotation queryAnnotation) { - super(parent, queryAnnotation); - this.specifiedLockMode = this.buildSpecifiedLockMode(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedLockMode_(this.buildSpecifiedLockMode()); - } - - @Override - public void update() { - super.update(); - this.setDefaultLockMode(this.buildDefaultLockMode()); - } - - - // ********** lock mode ********** - - public LockModeType2_0 getLockMode() { - return (this.specifiedLockMode != null) ? this.specifiedLockMode : this.defaultLockMode; - } - - public LockModeType2_0 getSpecifiedLockMode() { - return this.specifiedLockMode; - } - - public void setSpecifiedLockMode(LockModeType2_0 lockMode) { - this.queryAnnotation.setLockMode(LockModeType2_0.toJavaResourceModel(lockMode)); - this.setSpecifiedLockMode_(lockMode); - } - - protected void setSpecifiedLockMode_(LockModeType2_0 lockMode) { - LockModeType2_0 old = this.specifiedLockMode; - this.specifiedLockMode = lockMode; - this.firePropertyChanged(SPECIFIED_LOCK_MODE_PROPERTY, old, lockMode); - } - - protected LockModeType2_0 buildSpecifiedLockMode() { - return LockModeType2_0.fromJavaResourceModel(this.queryAnnotation.getLockMode()); - } - - public LockModeType2_0 getDefaultLockMode() { - return this.defaultLockMode; - } - - protected void setDefaultLockMode(LockModeType2_0 lockMode) { - LockModeType2_0 old = this.defaultLockMode; - this.defaultLockMode = lockMode; - this.firePropertyChanged(DEFAULT_LOCK_MODE_PROPERTY, old, lockMode); - } - - protected LockModeType2_0 buildDefaultLockMode() { - return LockModeType2_0.NONE; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java deleted file mode 100644 index 3d727384a0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrderColumn2_0.java +++ /dev/null @@ -1,250 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaNamedColumn; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaNamedColumn; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.OrderColumn2_0AnnotationDefinition; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderColumn2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrderable2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * Java order column - */ -public class GenericJavaOrderColumn2_0 - extends AbstractJavaNamedColumn - implements JavaOrderColumn2_0 -{ - protected Boolean specifiedNullable; - protected boolean defaultNullable; - - protected Boolean specifiedInsertable; - protected boolean defaultInsertable; - - protected Boolean specifiedUpdatable; - protected boolean defaultUpdatable; - - // JPA 1.0 - protected OrderColumn2_0Annotation nullColumnAnnotation; - - - public GenericJavaOrderColumn2_0(JavaOrderable2_0 parent, JavaNamedColumn.Owner owner) { - super(parent, owner); - this.specifiedNullable = this.buildSpecifiedNullable(); - this.specifiedInsertable = this.buildSpecifiedInsertable(); - this.specifiedUpdatable = this.buildSpecifiedUpdatable(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedNullable_(this.buildSpecifiedNullable()); - this.setSpecifiedInsertable_(this.buildSpecifiedInsertable()); - this.setSpecifiedUpdatable_(this.buildSpecifiedUpdatable()); - } - - @Override - public void update() { - super.update(); - this.setDefaultNullable(this.buildDefaultNullable()); - this.setDefaultInsertable(this.buildDefaultInsertable()); - this.setDefaultUpdatable(this.buildDefaultUpdatable()); - } - - - // ********** column annotation ********** - - /** - * If we are in a JPA 1.0 project, return a null annotation. - */ - @Override - public OrderColumn2_0Annotation getColumnAnnotation() { - // hmmmm... - return this.isJpa2_0Compatible() ? - (OrderColumn2_0Annotation) this.getResourcePersistentAttribute().getNonNullAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME) : - this.getNullColumnAnnotation(); - } - - protected OrderColumn2_0Annotation getNullColumnAnnotation() { - if (this.nullColumnAnnotation == null) { - this.nullColumnAnnotation = this.buildNullColumnAnnotation(); - } - return this.nullColumnAnnotation; - } - - protected OrderColumn2_0Annotation buildNullColumnAnnotation() { - // hmmmm... - return (OrderColumn2_0Annotation) OrderColumn2_0AnnotationDefinition.instance().buildNullAnnotation(this.getResourcePersistentAttribute()); - } - - @Override - protected void removeColumnAnnotation() { - if (this.isJpa2_0Compatible()) { - this.getResourcePersistentAttribute().removeAnnotation(OrderColumn2_0Annotation.ANNOTATION_NAME); - } else { - throw new IllegalStateException(); - } - } - - - // ********** nullable ********** - - public boolean isNullable() { - return (this.specifiedNullable != null) ? this.specifiedNullable.booleanValue() : this.isDefaultNullable(); - } - - public Boolean getSpecifiedNullable() { - return this.specifiedNullable; - } - - public void setSpecifiedNullable(Boolean nullable) { - if (this.valuesAreDifferent(this.specifiedNullable, nullable)) { - this.getColumnAnnotation().setNullable(nullable); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedNullable_(nullable); - } - } - - protected void setSpecifiedNullable_(Boolean nullable) { - Boolean old = this.specifiedNullable; - this.specifiedNullable = nullable; - this.firePropertyChanged(SPECIFIED_NULLABLE_PROPERTY, old, nullable); - } - - protected Boolean buildSpecifiedNullable() { - return this.getColumnAnnotation().getNullable(); - } - - public boolean isDefaultNullable() { - return this.defaultNullable; - } - - protected void setDefaultNullable(boolean nullable) { - boolean old = this.defaultNullable; - this.defaultNullable = nullable; - this.firePropertyChanged(DEFAULT_NULLABLE_PROPERTY, old, nullable); - } - - protected boolean buildDefaultNullable() { - return DEFAULT_NULLABLE; - } - - - // ********** insertable ********** - - public boolean isInsertable() { - return (this.specifiedInsertable != null) ? this.specifiedInsertable.booleanValue() : this.isDefaultInsertable(); - } - - public Boolean getSpecifiedInsertable() { - return this.specifiedInsertable; - } - - public void setSpecifiedInsertable(Boolean insertable) { - if (this.valuesAreDifferent(this.specifiedInsertable, insertable)) { - this.getColumnAnnotation().setInsertable(insertable); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedInsertable_(insertable); - } - } - - protected void setSpecifiedInsertable_(Boolean insertable) { - Boolean old = this.specifiedInsertable; - this.specifiedInsertable = insertable; - this.firePropertyChanged(SPECIFIED_INSERTABLE_PROPERTY, old, insertable); - } - - protected Boolean buildSpecifiedInsertable() { - return this.getColumnAnnotation().getInsertable(); - } - - public boolean isDefaultInsertable() { - return this.defaultInsertable; - } - - protected void setDefaultInsertable(boolean insertable) { - boolean old = this.defaultInsertable; - this.defaultInsertable = insertable; - this.firePropertyChanged(DEFAULT_INSERTABLE_PROPERTY, old, insertable); - } - - protected boolean buildDefaultInsertable() { - return DEFAULT_INSERTABLE; - } - - - // ********** updatable ********** - - public boolean isUpdatable() { - return (this.specifiedUpdatable != null) ? this.specifiedUpdatable.booleanValue() : this.isDefaultUpdatable(); - } - - public Boolean getSpecifiedUpdatable() { - return this.specifiedUpdatable; - } - - public void setSpecifiedUpdatable(Boolean updatable) { - if (this.valuesAreDifferent(this.specifiedUpdatable, updatable)) { - this.getColumnAnnotation().setUpdatable(updatable); - this.removeColumnAnnotationIfUnset(); - this.setSpecifiedUpdatable_(updatable); - } - } - - protected void setSpecifiedUpdatable_(Boolean updatable) { - Boolean old = this.specifiedUpdatable; - this.specifiedUpdatable = updatable; - this.firePropertyChanged(SPECIFIED_UPDATABLE_PROPERTY, old, updatable); - } - - protected Boolean buildSpecifiedUpdatable() { - return this.getColumnAnnotation().getUpdatable(); - } - - public boolean isDefaultUpdatable() { - return this.defaultUpdatable; - } - - protected void setDefaultUpdatable(boolean updatable) { - boolean old = this.defaultUpdatable; - this.defaultUpdatable = updatable; - this.firePropertyChanged(DEFAULT_UPDATABLE_PROPERTY, old, updatable); - } - - protected boolean buildDefaultUpdatable() { - return DEFAULT_UPDATABLE; - } - - - // ********** misc ********** - - @Override - public JavaOrderable2_0 getParent() { - return (JavaOrderable2_0) super.getParent(); - } - - protected JavaOrderable2_0 getOrderable() { - return this.getParent(); - } - - protected JavaResourcePersistentAttribute getResourcePersistentAttribute() { - return this.getOrderable().getResourcePersistentAttribute(); - } - - @Override - public String getTable() { - return this.getOrderable().getDefaultTableName(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java deleted file mode 100644 index c48a4acdc5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOrphanRemoval2_0.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.OwningRelationshipMapping2_0Annotation; - -/** - * Java orphan removal - */ -public class GenericJavaOrphanRemoval2_0 - extends AbstractJavaJpaContextNode - implements JavaOrphanRemovable2_0 -{ - protected Boolean specifiedOrphanRemoval; - protected boolean defaultOrphanRemoval; - - - public GenericJavaOrphanRemoval2_0(JavaOrphanRemovalHolder2_0 parent) { - super(parent); - this.specifiedOrphanRemoval = this.buildSpecifiedOrphanRemoval(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedOrphanRemoval_(this.buildSpecifiedOrphanRemoval()); - } - - @Override - public void update() { - super.update(); - this.setDefaultOrphanRemoval(this.buildDefaultOrphanRemoval()); - } - - - // ********** orphan removal ********** - - public boolean isOrphanRemoval() { - return (this.specifiedOrphanRemoval != null) ? this.specifiedOrphanRemoval.booleanValue() : this.defaultOrphanRemoval; - } - - public Boolean getSpecifiedOrphanRemoval() { - return this.specifiedOrphanRemoval; - } - - public void setSpecifiedOrphanRemoval(Boolean orphanRemoval) { - if (this.valuesAreDifferent(orphanRemoval, this.specifiedOrphanRemoval)) { - this.getMappingAnnotationForUpdate().setOrphanRemoval(orphanRemoval); - this.setSpecifiedOrphanRemoval_(orphanRemoval); - } - } - - protected void setSpecifiedOrphanRemoval_(Boolean orphanRemoval) { - Boolean old = this.specifiedOrphanRemoval; - this.specifiedOrphanRemoval = orphanRemoval; - this.firePropertyChanged(SPECIFIED_ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval); - } - - protected Boolean buildSpecifiedOrphanRemoval() { - OwningRelationshipMapping2_0Annotation annotation = this.getMappingAnnotation(); - return (annotation == null) ? null : annotation.getOrphanRemoval(); - } - - public boolean isDefaultOrphanRemoval() { - return this.defaultOrphanRemoval; - } - - protected void setDefaultOrphanRemoval(boolean orphanRemoval) { - boolean old = this.defaultOrphanRemoval; - this.defaultOrphanRemoval = orphanRemoval; - this.firePropertyChanged(DEFAULT_ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval); - } - - protected boolean buildDefaultOrphanRemoval() { - return DEFAULT_ORPHAN_REMOVAL; - } - - - // ********** misc ********** - - @Override - public JavaOrphanRemovalHolder2_0 getParent() { - return (JavaOrphanRemovalHolder2_0) super.getParent(); - } - - protected JavaAttributeMapping getMapping() { - return (JavaAttributeMapping) this.getParent(); - } - - protected OwningRelationshipMapping2_0Annotation getMappingAnnotation() { - return (OwningRelationshipMapping2_0Annotation) this.getMapping().getMappingAnnotation(); - } - - protected OwningRelationshipMapping2_0Annotation getMappingAnnotationForUpdate() { - return (OwningRelationshipMapping2_0Annotation) this.getMapping().getAnnotationForUpdate(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - OwningRelationshipMapping2_0Annotation annotation = this.getMappingAnnotation(); - return (annotation == null) ? null : annotation.getOrphanRemovalTextRange(astRoot); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java deleted file mode 100644 index c484111d2d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaOverrideJoinTableRelationshipStrategy2_0.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideInverseJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinTableValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinTableTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOverrideRelationship2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; - -public class GenericJavaOverrideJoinTableRelationshipStrategy2_0 - extends AbstractJavaJoinTableRelationshipStrategy -{ - public GenericJavaOverrideJoinTableRelationshipStrategy2_0(JavaOverrideRelationship2_0 parent) { - super(parent); - } - - - // ********** join table annotation ********** - - public JoinTableAnnotation getJoinTableAnnotation() { - return this.getOverrideAnnotation().getNonNullJoinTable(); - } - - @Override - protected JoinTableAnnotation addJoinTableAnnotation() { - return this.getOverrideAnnotation().addJoinTable(); - } - - @Override - protected void removeJoinTableAnnotation() { - this.getOverrideAnnotation().removeJoinTable(); - } - - protected AssociationOverride2_0Annotation getOverrideAnnotation() { - // only JPA 2.0 association overrides can have a join table (join strategy) - return (AssociationOverride2_0Annotation) this.getAssociationOverride().getOverrideAnnotation(); - } - - - // ********** misc ********** - - @Override - public JavaOverrideRelationship2_0 getParent() { - return (JavaOverrideRelationship2_0) super.getParent(); - } - - @Override - public JavaOverrideRelationship2_0 getRelationship() { - return this.getParent(); - } - - protected JavaAssociationOverride getAssociationOverride() { - return this.getRelationship().getAssociationOverride(); - } - - public boolean isOverridable() { - return false; - } - - - // ********** validation ********** - - public boolean validatesAgainstDatabase() { - return this.getRelationship().getTypeMapping().validatesAgainstDatabase(); - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return this.getRelationship().getValidationTextRange(astRoot); - } - - public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinTableValidator(this.getRelationship().getAssociationOverride(), (JoinTable) table, textRangeResolver); - } - - public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinColumnValidator(this.getRelationship().getAssociationOverride(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); - } - - public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideInverseJoinColumnValidator(this.getRelationship().getAssociationOverride(), column, owner, textRangeResolver, new JoinTableTableDescriptionProvider()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java deleted file mode 100644 index e4eea90893..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentAttribute2_0.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericPersistentAttributeValidator; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * JPA 2.0 Java persistent attribute - */ -public class GenericJavaPersistentAttribute2_0 - extends AbstractJavaPersistentAttribute -{ - protected AccessType specifiedAccess; - - - public GenericJavaPersistentAttribute2_0(PersistentType parent, JavaResourcePersistentAttribute resourcePersistentAttribute) { - super(parent, resourcePersistentAttribute); - this.specifiedAccess = this.buildSpecifiedAccess(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedAccess_(this.buildSpecifiedAccess()); - } - - - // ********** access ********** - - @Override - public AccessType getSpecifiedAccess() { - return this.specifiedAccess; - } - - /** - * Don't support changing to specified access on a java persistent attribute, this - * involves a larger process of moving the annotations to the corresponding field/property - * which may or may not exist or might need to be created. - */ - public void setSpecifiedAccess(AccessType specifiedAccess) { - throw new UnsupportedOperationException(); - } - - protected void setSpecifiedAccess_(AccessType access) { - AccessType old = this.specifiedAccess; - this.specifiedAccess = access; - this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, access); - } - - protected AccessType buildSpecifiedAccess() { - Access2_0Annotation accessAnnotation = this.getAccessAnnotation(); - return (accessAnnotation == null) ? null : AccessType.fromJavaResourceModel(accessAnnotation.getValue()); - } - - protected Access2_0Annotation getAccessAnnotation() { - return (Access2_0Annotation) this.resourcePersistentAttribute.getAnnotation(Access2_0Annotation.ANNOTATION_NAME); - } - - - // ********** validation ********** - - @Override - protected JptValidator buildAttibuteValidator(CompilationUnit astRoot) { - return new GenericPersistentAttributeValidator(this, this, buildTextRangeResolver(astRoot)); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java deleted file mode 100644 index 284b7c5b0c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaPersistentType2_0.java +++ /dev/null @@ -1,156 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import java.util.Collection; -import java.util.Iterator; -import java.util.ListIterator; -import java.util.Map; -import org.eclipse.core.resources.IFile; -import org.eclipse.jpt.common.core.utility.BodySourceWriter; -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaPersistentType; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelSourceType; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaPersistentType2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * JPA 2.0 Java persistent type. - * Support for specified access and metamodel generation. - */ -public class GenericJavaPersistentType2_0 - extends AbstractJavaPersistentType - implements JavaPersistentType2_0 -{ - protected String declaringTypeName; - - protected final MetamodelSourceType.Synchronizer metamodelSynchronizer; - - - public GenericJavaPersistentType2_0(PersistentType.Owner parent, JavaResourcePersistentType jrpt) { - super(parent, jrpt); - this.declaringTypeName = this.buildDeclaringTypeName(); - this.metamodelSynchronizer = this.buildMetamodelSynchronizer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setDeclaringTypeName(this.buildDeclaringTypeName()); - } - - - // ********** access annotation ********** - - protected Access2_0Annotation getAccessAnnotation() { - return (Access2_0Annotation) this.resourcePersistentType.getNonNullAnnotation(this.getAccessAnnotationName()); - } - - protected void removeAccessAnnotationIfUnset() { - if (this.getAccessAnnotation().isUnset()) { - this.removeAccessAnnotation(); - } - } - - protected void removeAccessAnnotation() { - this.resourcePersistentType.removeAnnotation(this.getAccessAnnotationName()); - } - - protected String getAccessAnnotationName() { - return Access2_0Annotation.ANNOTATION_NAME; - } - - - // ********** access ********** - - public void setSpecifiedAccess(AccessType access) { - if (this.valuesAreDifferent(this.specifiedAccess, access)) { - this.getAccessAnnotation().setValue(AccessType.toJavaResourceModel(access)); - this.removeAccessAnnotationIfUnset(); - this.setSpecifiedAccess_(access); - } - } - - @Override - protected AccessType buildSpecifiedAccess() { - return AccessType.fromJavaResourceModel(this.getAccessAnnotation().getValue()); - } - - - // ********** attributes ********** - - // suppress type-safety warning - @Override - public ListIterator attributes() { - return super.attributes(); - } - - @Override - protected Iterator resourceAttributes() { - return (this.specifiedAccess == null) ? - super.resourceAttributes() : - this.resourcePersistentType.persistableAttributes(AccessType.toJavaResourceModel(this.specifiedAccess)); - } - - - // ********** declaring type name ********** - - public String getDeclaringTypeName() { - return this.declaringTypeName; - } - - protected void setDeclaringTypeName(String declaringTypeName) { - String old = this.declaringTypeName; - this.declaringTypeName = declaringTypeName; - this.firePropertyChanged(DECLARING_TYPE_NAME_PROPERTY, old, declaringTypeName); - } - - protected String buildDeclaringTypeName() { - return this.resourcePersistentType.getDeclaringTypeName(); - } - - - // ********** metamodel ********** - - public IFile getMetamodelFile() { - return this.metamodelSynchronizer.getFile(); - } - - public void initializeMetamodel() { - // do nothing - probably shouldn't be called... - } - - public boolean isManaged() { - return true; - } - - public void synchronizeMetamodel(Map> memberTypeTree) { - this.metamodelSynchronizer.synchronize(memberTypeTree); - } - - public void printBodySourceOn(BodySourceWriter pw, Map> memberTypeTree) { - this.metamodelSynchronizer.printBodySourceOn(pw, memberTypeTree); - } - - public void disposeMetamodel() { - // do nothing - probably shouldn't be called... - } - - protected MetamodelSourceType.Synchronizer buildMetamodelSynchronizer() { - return this.getJpaFactory2_0().buildMetamodelSynchronizer(this); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java deleted file mode 100644 index 8b1e0c2f73..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaSequenceGenerator2_0.java +++ /dev/null @@ -1,129 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaJpaContextNode; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaSequenceGenerator; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSequenceGenerator2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation; - -/** - * JPA 2.0 - * Java sequence generator - */ -public class GenericJavaSequenceGenerator2_0 - extends AbstractJavaSequenceGenerator - implements JavaSequenceGenerator2_0 -{ - protected String specifiedCatalog; - protected String defaultCatalog; - - protected String specifiedSchema; - protected String defaultSchema; - - - public GenericJavaSequenceGenerator2_0(JavaJpaContextNode parent, SequenceGenerator2_0Annotation generatorAnnotation) { - super(parent, generatorAnnotation); - this.specifiedCatalog = generatorAnnotation.getCatalog(); - this.specifiedSchema = generatorAnnotation.getSchema(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedCatalog_(this.generatorAnnotation.getCatalog()); - this.setSpecifiedSchema_(this.generatorAnnotation.getSchema()); - } - - @Override - public void update() { - super.update(); - this.setDefaultCatalog(this.buildDefaultCatalog()); - this.setDefaultSchema(this.buildDefaultSchema()); - } - - - // ********** catalog ********** - - @Override - public String getCatalog() { - return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog; - } - - public String getSpecifiedCatalog() { - return this.specifiedCatalog; - } - - public void setSpecifiedCatalog(String catalog) { - this.generatorAnnotation.setCatalog(catalog); - this.setSpecifiedCatalog_(catalog); - } - - protected void setSpecifiedCatalog_(String catalog) { - String old = this.specifiedCatalog; - this.specifiedCatalog = catalog; - this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog); - } - - public String getDefaultCatalog() { - return this.defaultCatalog; - } - - protected void setDefaultCatalog(String catalog) { - String old = this.defaultCatalog; - this.defaultCatalog = catalog; - this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog); - } - - protected String buildDefaultCatalog() { - return this.getContextDefaultCatalog(); - } - - - // ********** schema ********** - - @Override - public String getSchema() { - return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema; - } - - public String getSpecifiedSchema() { - return this.specifiedSchema; - } - - public void setSpecifiedSchema(String schema) { - this.generatorAnnotation.setSchema(schema); - this.setSpecifiedSchema_(schema); - } - - protected void setSpecifiedSchema_(String schema) { - String old = this.specifiedSchema; - this.specifiedSchema = schema; - this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema); - } - - public String getDefaultSchema() { - return this.defaultSchema; - } - - protected void setDefaultSchema(String schema) { - String old = this.defaultSchema; - this.defaultSchema = schema; - this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema); - } - - protected String buildDefaultSchema() { - return this.getContextDefaultSchema(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0.java deleted file mode 100644 index 2a4d21001e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0.java +++ /dev/null @@ -1,121 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.JoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.JoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTable; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.java.JavaVirtualJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; - -public class GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0 - extends AbstractJavaJpaContextNode - implements JavaVirtualJoinTableRelationshipStrategy -{ - protected JavaVirtualJoinTable joinTable; - - - public GenericJavaVirtualOverrideJoinTableRelationshipStrategy2_0(JavaVirtualJoinTableRelationship parent) { - super(parent); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.updateJoinTable(); - } - - - // ********** join table ********** - - public JavaVirtualJoinTable getJoinTable() { - return this.joinTable; - } - - protected void setJoinTable(JavaVirtualJoinTable joinTable) { - JavaVirtualJoinTable old = this.joinTable; - this.joinTable = joinTable; - this.firePropertyChanged(JOIN_TABLE_PROPERTY, old, joinTable); - } - - protected void updateJoinTable() { - JoinTable overriddenJoinTable = this.getOverriddenJoinTable(); - if (overriddenJoinTable == null) { - if (this.joinTable != null) { - this.setJoinTable(null); - } - } else { - if ((this.joinTable != null) && (this.joinTable.getOverriddenTable() == overriddenJoinTable)) { - this.joinTable.update(); - } else { - this.setJoinTable(this.buildJoinTable(overriddenJoinTable)); - } - } - } - - protected JoinTable getOverriddenJoinTable() { - JoinTableRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy(); - return (overriddenStrategy == null) ? null : overriddenStrategy.getJoinTable(); - } - - protected JavaVirtualJoinTable buildJoinTable(JoinTable overriddenJoinTable) { - return this.getJpaFactory().buildJavaVirtualJoinTable(this, overriddenJoinTable); - } - - - // ********** misc ********** - - @Override - public JavaVirtualJoinTableRelationship getParent() { - return (JavaVirtualJoinTableRelationship) super.getParent(); - } - - public JavaVirtualJoinTableRelationship getRelationship() { - return this.getParent(); - } - - protected JoinTableRelationshipStrategy getOverriddenStrategy() { - JoinTableRelationship relationship = this.getOverriddenJoinTableRelationship(); - return (relationship == null) ? null : relationship.getJoinTableStrategy(); - } - - protected JoinTableRelationship getOverriddenJoinTableRelationship() { - Relationship relationship = this.resolveOverriddenRelationship(); - return (relationship instanceof JoinTableRelationship) ? (JoinTableRelationship) relationship : null; - } - - protected Relationship resolveOverriddenRelationship() { - return this.getRelationship().resolveOverriddenRelationship(); - } - - public String getTableName() { - return this.joinTable.getName(); - } - - public String getJoinTableDefaultName() { - return MappingTools.buildJoinTableDefaultName(this.getRelationship()); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java deleted file mode 100644 index d9ebeaaca5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaElementCollectionMappingDefinition2_0.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; - -public class JavaElementCollectionMappingDefinition2_0 - extends AbstractJavaElementCollectionMappingDefinition2_0 -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaElementCollectionMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaElementCollectionMappingDefinition2_0() { - super(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java deleted file mode 100644 index acbb6cc15e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaEmbeddedMappingDefinition2_0.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.DefaultJavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaEmbeddedMappingDefinition; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation; - -public class JavaEmbeddedMappingDefinition2_0 - extends AbstractJavaEmbeddedMappingDefinition -{ - // singleton - private static final DefaultJavaAttributeMappingDefinition INSTANCE = new JavaEmbeddedMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static DefaultJavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaEmbeddedMappingDefinition2_0() { - super(); - } - - @Override - public Iterable getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - protected static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] { - AssociationOverrideAnnotation.ANNOTATION_NAME, - AssociationOverridesAnnotation.ANNOTATION_NAME, - }; - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 - ); - protected static final Iterable COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java deleted file mode 100644 index b2732da58c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaIdMappingDefinition2_0.java +++ /dev/null @@ -1,34 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; - -public class JavaIdMappingDefinition2_0 - extends AbstractJavaIdMappingDefinition2_0 -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaIdMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaIdMappingDefinition2_0() { - super(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java deleted file mode 100644 index b1d12687bd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToManyMappingDefinition2_0.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation; - -public class JavaManyToManyMappingDefinition2_0 - extends AbstractJavaManyToManyMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaManyToManyMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaManyToManyMappingDefinition2_0() { - super(); - } - - @Override - public Iterable getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] { - AttributeOverrideAnnotation.ANNOTATION_NAME, - AttributeOverridesAnnotation.ANNOTATION_NAME, - MapKeyClass2_0Annotation.ANNOTATION_NAME, - MapKeyColumn2_0Annotation.ANNOTATION_NAME, - MapKeyEnumerated2_0Annotation.ANNOTATION_NAME, - MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME, - MapKeyJoinColumns2_0Annotation.ANNOTATION_NAME, - MapKeyTemporal2_0Annotation.ANNOTATION_NAME, - OrderColumn2_0Annotation.ANNOTATION_NAME - }; - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 - ); - protected static final Iterable COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToOneMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToOneMappingDefinition2_0.java deleted file mode 100644 index 6c60879a41..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaManyToOneMappingDefinition2_0.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation; - -public class JavaManyToOneMappingDefinition2_0 - extends AbstractJavaManyToOneMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaManyToOneMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaManyToOneMappingDefinition2_0() { - super(); - } - - @Override - public Iterable getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] { - IdAnnotation.ANNOTATION_NAME, - MapsId2_0Annotation.ANNOTATION_NAME - }; - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 - ); - protected static final Iterable COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java deleted file mode 100644 index 381acd5d74..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToManyMappingDefinition2_0.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation; - -public class JavaOneToManyMappingDefinition2_0 - extends AbstractJavaOneToManyMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaOneToManyMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaOneToManyMappingDefinition2_0() { - super(); - } - - @Override - public Iterable getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] { - AttributeOverrideAnnotation.ANNOTATION_NAME, - AttributeOverridesAnnotation.ANNOTATION_NAME, - MapKeyClass2_0Annotation.ANNOTATION_NAME, - MapKeyColumn2_0Annotation.ANNOTATION_NAME, - MapKeyEnumerated2_0Annotation.ANNOTATION_NAME, - MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME, - MapKeyJoinColumns2_0Annotation.ANNOTATION_NAME, - MapKeyTemporal2_0Annotation.ANNOTATION_NAME, - OrderColumn2_0Annotation.ANNOTATION_NAME - }; - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 - ); - protected static final Iterable COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToOneMappingDefinition2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToOneMappingDefinition2_0.java deleted file mode 100644 index 7beb0679bc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/JavaOneToOneMappingDefinition2_0.java +++ /dev/null @@ -1,55 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation; - -public class JavaOneToOneMappingDefinition2_0 - extends AbstractJavaOneToOneMappingDefinition -{ - // singleton - private static final JavaAttributeMappingDefinition INSTANCE = new JavaOneToOneMappingDefinition2_0(); - - /** - * Return the singleton. - */ - public static JavaAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private JavaOneToOneMappingDefinition2_0() { - super(); - } - - @Override - public Iterable getSupportingAnnotationNames() { - return COMBINED_SUPPORTING_ANNOTATION_NAMES; - } - - public static final String[] SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 = new String[] { - IdAnnotation.ANNOTATION_NAME, - MapsId2_0Annotation.ANNOTATION_NAME - }; - - protected static final String[] COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY = ArrayTools.concatenate( - SUPPORTING_ANNOTATION_NAMES_ARRAY, - SUPPORTING_ANNOTATION_NAMES_ARRAY_2_0 - ); - protected static final Iterable COMBINED_SUPPORTING_ANNOTATION_NAMES = new ArrayIterable(COMBINED_SUPPORTING_ANNOTATION_NAMES_ARRAY); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaCacheable2_0.java deleted file mode 100644 index 275358b747..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaCacheable2_0.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaCacheableHolder2_0; - -/** - * null Java cacheable - */ -public class NullJavaCacheable2_0 - extends AbstractJavaJpaContextNode - implements JavaCacheable2_0 -{ - public NullJavaCacheable2_0(JavaCacheableHolder2_0 parent) { - super(parent); - } - - - // ********** cacheable ********** - - public boolean isCacheable() { - return false; - } - - public Boolean getSpecifiedCacheable() { - return null; - } - - public void setSpecifiedCacheable(Boolean cacheable) { - throw new UnsupportedOperationException(); - } - - public boolean isDefaultCacheable() { - return false; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaDerivedIdentity2_0.java deleted file mode 100644 index b03515ecd4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaDerivedIdentity2_0.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.java.JavaSingleRelationshipMapping; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.DerivedIdentityStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaIdDerivedIdentityStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaMapsIdDerivedIdentityStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaSingleRelationshipMapping2_0; - -public class NullJavaDerivedIdentity2_0 - extends AbstractJavaJpaContextNode - implements JavaDerivedIdentity2_0 -{ - public NullJavaDerivedIdentity2_0(JavaSingleRelationshipMapping mapping) { - super(mapping); - } - - - // ********** predominant derived identity strategy ********** - - public DerivedIdentityStrategy2_0 getPredominantDerivedIdentityStrategy() { - return null; - } - - - // ********** null derived identity strategy ********** - - public boolean usesNullDerivedIdentityStrategy() { - return true; - } - - public void setNullDerivedIdentityStrategy() { - // NOP - } - - - // ********** ID derived identity strategy ********** - - public JavaIdDerivedIdentityStrategy2_0 getIdDerivedIdentityStrategy() { - return null; - } - - public boolean usesIdDerivedIdentityStrategy() { - return false; - } - - public void setIdDerivedIdentityStrategy() { - // NOP - } - - public void unsetIdDerivedIdentityStrategy() { - // NOP - } - - - // ********** maps ID derived identity strategy ********** - - public JavaMapsIdDerivedIdentityStrategy2_0 getMapsIdDerivedIdentityStrategy() { - return null; - } - - public boolean usesMapsIdDerivedIdentityStrategy() { - return false; - } - - public void setMapsIdDerivedIdentityStrategy() { - // NOP - } - - public void unsetMapsIdDerivedIdentityStrategy() { - // NOP - } - - - // ********** misc ********** - - public JavaSingleRelationshipMapping2_0 getMapping() { - return null; - } - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java deleted file mode 100644 index 10f019ee07..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaMapKeyColumn2_0.java +++ /dev/null @@ -1,276 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import java.util.Iterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.jpa.core.context.ReadOnlyColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaColumn; -import org.eclipse.jpt.jpa.core.context.java.JavaMultiRelationshipMapping; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.jpa.db.Table; - -/** - * - */ -public class NullJavaMapKeyColumn2_0 - extends AbstractJavaJpaContextNode - implements JavaColumn -{ - public NullJavaMapKeyColumn2_0(JavaMultiRelationshipMapping parent) { - super(parent); - } - - - // ********** column annotation ********** - - public ColumnAnnotation getColumnAnnotation() { - return (ColumnAnnotation) this.getParent().getPersistentAttribute().getResourcePersistentAttribute().getNonNullAnnotation(ColumnAnnotation.ANNOTATION_NAME); - } - - - // ********** name ********** - - public String getName() { - return null; - } - - public String getSpecifiedName() { - return null; - } - - public void setSpecifiedName(String name) { - throw new UnsupportedOperationException(); - } - - public String getDefaultName() { - return null; - } - - - // ********** column definition ********** - - public String getColumnDefinition() { - return null; - } - - public void setColumnDefinition(String columnDefinition) { - throw new UnsupportedOperationException(); - } - - - // ********** table ********** - - public String getTable() { - return null; - } - - public String getSpecifiedTable() { - return null; - } - - public void setSpecifiedTable(String table) { - throw new UnsupportedOperationException(); - } - - public String getDefaultTable() { - return null; - } - - - // ********** unique ********** - - public boolean isUnique() { - return false; - } - - public Boolean getSpecifiedUnique() { - return null; - } - - public void setSpecifiedUnique(Boolean unique) { - throw new UnsupportedOperationException(); - } - - public boolean isDefaultUnique() { - return false; - } - - - // ********** nullable ********** - - public boolean isNullable() { - return false; - } - - public Boolean getSpecifiedNullable() { - return null; - } - - public void setSpecifiedNullable(Boolean nullable) { - throw new UnsupportedOperationException(); - } - - public boolean isDefaultNullable() { - return false; - } - - - // ********** insertable ********** - - public boolean isInsertable() { - return false; - } - - public Boolean getSpecifiedInsertable() { - return null; - } - - public void setSpecifiedInsertable(Boolean insertable) { - throw new UnsupportedOperationException(); - } - - public boolean isDefaultInsertable() { - return false; - } - - - // ********** updatable ********** - - public boolean isUpdatable() { - return false; - } - - public Boolean getSpecifiedUpdatable() { - return null; - } - - public void setSpecifiedUpdatable(Boolean updatable) { - throw new UnsupportedOperationException(); - } - - public boolean isDefaultUpdatable() { - return false; - } - - - // ********** length ********** - - public int getLength() { - return 0; - } - - public Integer getSpecifiedLength() { - return null; - } - - public void setSpecifiedLength(Integer length) { - throw new UnsupportedOperationException(); - } - - public int getDefaultLength() { - return 0; - } - - - // ********** precision ********** - - public int getPrecision() { - return 0; - } - - public Integer getSpecifiedPrecision() { - return null; - } - - public void setSpecifiedPrecision(Integer precision) { - throw new UnsupportedOperationException(); - } - - public int getDefaultPrecision() { - return 0; - } - - - // ********** scale ********** - - public int getScale() { - return 0; - } - - public Integer getSpecifiedScale() { - return null; - } - - public void setSpecifiedScale(Integer scale) { - throw new UnsupportedOperationException(); - } - - public int getDefaultScale() { - return 0; - } - - - // ********** misc ********** - - @Override - public JavaMultiRelationshipMapping getParent() { - return (JavaMultiRelationshipMapping) super.getParent(); - } - - public void initializeFrom(ReadOnlyColumn oldColumn) { - // NOP - } - - public void initializeFromVirtual(ReadOnlyColumn virtualColumn) { - // NOP - } - - public Iterator candidateTableNames() { - return EmptyIterator.instance(); - } - - - // ********** database stuff ********** - - public org.eclipse.jpt.jpa.db.Column getDbColumn() { - return null; - } - - public Table getDbTable() { - return null; - } - - public boolean isResolved() { - return false; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getNameTextRange(CompilationUnit astRoot) { - return null; - } - - public TextRange getTableTextRange(CompilationUnit astRoot) { - return null; - } - - public boolean tableNameIsInvalid() { - return false; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java deleted file mode 100644 index e2fd32bc54..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/java/NullJavaOrphanRemoval2_0.java +++ /dev/null @@ -1,54 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.java.AbstractJavaJpaContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaOrphanRemovalHolder2_0; - -/** - * Null Java orphan removal - */ -public class NullJavaOrphanRemoval2_0 - extends AbstractJavaJpaContextNode - implements JavaOrphanRemovable2_0 -{ - public NullJavaOrphanRemoval2_0(JavaOrphanRemovalHolder2_0 parent) { - super(parent); - } - - - // ********** orphan removal ********** - - public boolean isOrphanRemoval() { - return false; - } - - public Boolean getSpecifiedOrphanRemoval() { - return null; - } - - public boolean isDefaultOrphanRemoval() { - return false; - } - - public void setSpecifiedOrphanRemoval(Boolean newSpecifiedOrphanRemoval) { - throw new UnsupportedOperationException(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java deleted file mode 100644 index 7bdf59840d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/AbstractOrmElementCollectionMapping2_0.java +++ /dev/null @@ -1,1592 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import org.eclipse.emf.common.util.EList; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.Transformer; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.jpa.core.context.AssociationOverride; -import org.eclipse.jpt.jpa.core.context.AssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.AttributeOverride; -import org.eclipse.jpt.jpa.core.context.AttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.BaseColumn; -import org.eclipse.jpt.jpa.core.context.Column; -import org.eclipse.jpt.jpa.core.context.Converter; -import org.eclipse.jpt.jpa.core.context.Embeddable; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.FetchType; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.OverrideContainer; -import org.eclipse.jpt.jpa.core.context.Override_; -import org.eclipse.jpt.jpa.core.context.PersistentType; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.JoinColumn.Owner; -import org.eclipse.jpt.jpa.core.context.java.JavaAssociationOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeMapping; -import org.eclipse.jpt.jpa.core.context.java.JavaAttributeOverride; -import org.eclipse.jpt.jpa.core.context.java.JavaPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmColumn; -import org.eclipse.jpt.jpa.core.context.orm.OrmConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmEnumeratedConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmLobConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmOrderable; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmTemporalConverter; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.internal.context.AttributeMappingTools; -import org.eclipse.jpt.jpa.core.internal.context.BaseColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.OverrideTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmAttributeMapping; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideJoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AssociationOverrideValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.AttributeOverrideValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.CollectionTableTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.EmbeddableOverrideDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyAttributeOverrideValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.MapKeyColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.NamedColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.NullOrmConverter; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.CollectionTableValidator; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.MetamodelField; -import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.java.JavaElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionTable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmPersistentAttribute2_0; -import org.eclipse.jpt.jpa.core.resource.orm.Attributes; -import org.eclipse.jpt.jpa.core.resource.orm.MapKey; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAssociationOverride; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeOverride; -import org.eclipse.jpt.jpa.core.resource.orm.XmlClassReference; -import org.eclipse.jpt.jpa.core.resource.orm.XmlCollectionTable; -import org.eclipse.jpt.jpa.core.resource.orm.XmlColumn; -import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -/** - * JPA 2.0 Frankenstein mapping - */ -public abstract class AbstractOrmElementCollectionMapping2_0 - extends AbstractOrmAttributeMapping - implements OrmElementCollectionMapping2_0 -{ - protected String specifiedTargetClass; - protected String defaultTargetClass; - - protected FetchType specifiedFetch; - protected FetchType defaultFetch; - - protected final OrmOrderable2_0 orderable; - - protected final OrmCollectionTable2_0 collectionTable; - - protected Type valueType; - protected final OrmColumn valueColumn; - protected OrmConverter converter; // value converter - never null - protected final OrmAttributeOverrideContainer valueAttributeOverrideContainer; - protected final OrmAssociationOverrideContainer valueAssociationOverrideContainer; - - protected Type keyType; - - protected String specifiedMapKey; - protected boolean noMapKey = false; - protected boolean pkMapKey = false; - protected boolean customMapKey = false; - - protected String specifiedMapKeyClass; - protected String defaultMapKeyClass; - - protected final OrmColumn mapKeyColumn; - - protected final OrmAttributeOverrideContainer mapKeyAttributeOverrideContainer; - - - protected static final OrmConverter.Adapter[] CONVERTER_ADAPTER_ARRAY = new OrmConverter.Adapter[] { - OrmEnumeratedConverter.Adapter.instance(), - OrmTemporalConverter.Adapter.instance(), - OrmLobConverter.Adapter.instance() - }; - protected static final Iterable CONVERTER_ADAPTERS = new ArrayIterable(CONVERTER_ADAPTER_ARRAY); - - - protected AbstractOrmElementCollectionMapping2_0(OrmPersistentAttribute parent, X xmlMapping) { - super(parent, xmlMapping); - this.specifiedTargetClass = xmlMapping.getTargetClass(); - this.specifiedFetch = this.buildSpecifiedFetch(); - this.orderable = this.buildOrderable(); - this.collectionTable = this.buildCollectionTable(); - - this.valueColumn = this.buildValueColumn(); - this.converter = this.buildConverter(); - this.valueAttributeOverrideContainer = this.buildValueAttributeOverrideContainer(); - this.valueAssociationOverrideContainer = this.buildValueAssociationOverrideContainer(); - - this.specifiedMapKey = this.buildSpecifiedMapKey(); - this.noMapKey = this.buildNoMapKey(); - this.pkMapKey = this.buildPkMapKey(); - this.customMapKey = this.buildCustomMapKey(); - this.specifiedMapKeyClass = this.buildSpecifiedMapKeyClass(); - - this.mapKeyColumn = this.buildMapKeyColumn(); - this.mapKeyAttributeOverrideContainer = this.buildMapKeyAttributeOverrideContainer(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedTargetClass_(this.xmlAttributeMapping.getTargetClass()); - this.setSpecifiedFetch_(this.buildSpecifiedFetch()); - this.orderable.synchronizeWithResourceModel(); - this.collectionTable.synchronizeWithResourceModel(); - - this.valueColumn.synchronizeWithResourceModel(); - this.syncConverter(); - this.valueAttributeOverrideContainer.synchronizeWithResourceModel(); - this.valueAssociationOverrideContainer.synchronizeWithResourceModel(); - - this.setSpecifiedMapKey_(this.buildSpecifiedMapKey()); - this.setNoMapKey_(this.buildNoMapKey()); - this.setPkMapKey_(this.buildPkMapKey()); - this.setCustomMapKey_(this.buildCustomMapKey()); - this.setSpecifiedMapKeyClass_(this.buildSpecifiedMapKeyClass()); - - this.mapKeyColumn.synchronizeWithResourceModel(); - this.mapKeyAttributeOverrideContainer.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.setDefaultTargetClass(this.buildDefaultTargetClass()); - this.setDefaultFetch(this.buildDefaultFetch()); - this.orderable.update(); - this.collectionTable.update(); - - this.setValueType(this.buildValueType()); - this.valueColumn.update(); - this.converter.update(); - this.valueAttributeOverrideContainer.update(); - this.valueAssociationOverrideContainer.update(); - - this.setKeyType(this.buildKeyType()); - this.setDefaultMapKeyClass(this.buildDefaultMapKeyClass()); - - this.mapKeyColumn.update(); - this.mapKeyAttributeOverrideContainer.update(); - } - - - // ********** target class ********** - - public String getTargetClass() { - return (this.specifiedTargetClass != null) ? this.specifiedTargetClass : this.defaultTargetClass; - } - - public String getSpecifiedTargetClass() { - return this.specifiedTargetClass; - } - - public void setSpecifiedTargetClass(String targetClass) { - this.setSpecifiedTargetClass_(targetClass); - this.xmlAttributeMapping.setTargetClass(targetClass); - } - - protected void setSpecifiedTargetClass_(String targetClass) { - String old = this.specifiedTargetClass; - this.specifiedTargetClass = targetClass; - this.firePropertyChanged(SPECIFIED_TARGET_CLASS_PROPERTY, old, targetClass); - } - - public String getDefaultTargetClass() { - return this.defaultTargetClass; - } - - protected void setDefaultTargetClass(String targetClass) { - String old = this.defaultTargetClass; - this.defaultTargetClass = targetClass; - this.firePropertyChanged(DEFAULT_TARGET_CLASS_PROPERTY, old, targetClass); - } - - protected String buildDefaultTargetClass() { - JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute(); - return (javaAttribute == null) ? null : javaAttribute.getMultiReferenceTargetTypeName(); - } - - public char getTargetClassEnclosingTypeSeparator() { - return '$'; - } - - - // ********** resolved target type/embeddable/entity ********** - - public PersistentType getResolvedTargetType() { - return this.resolvePersistentType(this.getTargetClass()); - } - - protected Embeddable getResolvedTargetEmbeddable() { - TypeMapping typeMapping = this.getResolvedTargetTypeMapping(); - return (typeMapping instanceof Embeddable) ? (Embeddable) typeMapping : null; - } - - protected Entity getResolvedTargetEntity() { - TypeMapping typeMapping = this.getResolvedTargetTypeMapping(); - return (typeMapping instanceof Entity) ? (Entity) typeMapping : null; - } - - protected TypeMapping getResolvedTargetTypeMapping() { - PersistentType resolvedTargetType = this.getResolvedTargetType(); - return (resolvedTargetType == null) ? null : resolvedTargetType.getMapping(); - } - - - // ********** fetch ********** - - public FetchType getFetch() { - return (this.specifiedFetch != null) ? this.specifiedFetch : this.defaultFetch; - } - - public FetchType getSpecifiedFetch() { - return this.specifiedFetch; - } - - public void setSpecifiedFetch(FetchType fetch) { - this.setSpecifiedFetch_(fetch); - this.xmlAttributeMapping.setFetch(FetchType.toOrmResourceModel(fetch)); - } - - protected void setSpecifiedFetch_(FetchType fetch) { - FetchType old = this.specifiedFetch; - this.specifiedFetch = fetch; - this.firePropertyChanged(SPECIFIED_FETCH_PROPERTY, old, fetch); - } - - protected FetchType buildSpecifiedFetch() { - return FetchType.fromOrmResourceModel(this.xmlAttributeMapping.getFetch()); - } - - public FetchType getDefaultFetch() { - return this.defaultFetch; - } - - protected void setDefaultFetch(FetchType fetch) { - FetchType old = this.defaultFetch; - this.defaultFetch = fetch; - this.firePropertyChanged(DEFAULT_FETCH_PROPERTY, old, fetch); - } - - protected FetchType buildDefaultFetch() { - return DEFAULT_FETCH_TYPE; - } - - - // ********** orderable ********** - - public OrmOrderable getOrderable() { - return this.orderable; - } - - protected OrmOrderable2_0 buildOrderable() { - return this.getContextNodeFactory2_0().buildOrmOrderable(this, this.buildOrderableOwner()); - } - - protected Orderable2_0.Owner buildOrderableOwner() { - return new OrderableOwner(); - } - - protected class OrderableOwner - implements Orderable2_0.Owner - { - public String getTableName() { - return this.getCollectionTable().getName(); - } - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return this.getCollectionTable().getDbTable(); - } - protected OrmCollectionTable2_0 getCollectionTable() { - return AbstractOrmElementCollectionMapping2_0.this.getCollectionTable(); - } - } - - - // ********** collection table ********** - - public OrmCollectionTable2_0 getCollectionTable() { - return this.collectionTable; - } - - protected OrmCollectionTable2_0 buildCollectionTable() { - return this.getContextNodeFactory2_0().buildOrmCollectionTable(this, this.buildCollectionTableOwner()); - } - - protected Table.Owner buildCollectionTableOwner() { - return new CollectionTableOwner(); - } - - public XmlCollectionTable getResourceCollectionTable() { - return this.xmlAttributeMapping.getCollectionTable(); - } - - protected class CollectionTableOwner - implements Table.Owner - { - public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) { - return new CollectionTableValidator(AbstractOrmElementCollectionMapping2_0.this.getPersistentAttribute(), (CollectionTable2_0) table, textRangeResolver); - } - } - - - // ********** value type ********** - - public Type getValueType() { - return this.valueType; - } - - protected void setValueType(Type valueType) { - Type old = this.valueType; - this.valueType = valueType; - this.firePropertyChanged(VALUE_TYPE_PROPERTY, old, valueType); - } - - protected Type buildValueType() { - if (this.getResolvedTargetEmbeddable() != null) { - return Type.EMBEDDABLE_TYPE; - } - if (this.getTargetClass() == null) { - return Type.NO_TYPE; - } - return Type.BASIC_TYPE; - } - - - // ********** value column ********** - - public OrmColumn getValueColumn() { - return this.valueColumn; - } - - protected OrmColumn buildValueColumn() { - return this.getContextNodeFactory().buildOrmColumn(this, this.buildValueColumnOwner()); - } - - protected OrmColumn.Owner buildValueColumnOwner() { - return new ValueColumnOwner(); - } - - - // ********** converter ********** - - public OrmConverter getConverter() { - return this.converter; - } - - public void setConverter(Class converterType) { - if (this.converter.getType() != converterType) { - // note: we may also clear the XML value we want; - // but if we leave it, the resulting sync will screw things up... - this.clearXmlConverterValues(); - OrmConverter.Adapter converterAdapter = this.getConverterAdapter(converterType); - this.setConverter_(this.buildConverter(converterAdapter)); - this.converter.initialize(); - } - } - - protected OrmConverter buildConverter(OrmConverter.Adapter converterAdapter) { - return (converterAdapter != null) ? - converterAdapter.buildNewConverter(this, this.getContextNodeFactory()) : - this.buildNullConverter(); - } - - protected void setConverter_(OrmConverter converter) { - Converter old = this.converter; - this.converter = converter; - this.firePropertyChanged(CONVERTER_PROPERTY, old, converter); - } - - protected void clearXmlConverterValues() { - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - adapter.clearXmlValue(this.xmlAttributeMapping); - } - } - - protected OrmConverter buildConverter() { - OrmXmlContextNodeFactory factory = this.getContextNodeFactory(); - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - OrmConverter ormConverter = adapter.buildConverter(this, factory); - if (ormConverter != null) { - return ormConverter; - } - } - return this.buildNullConverter(); - } - - protected void syncConverter() { - OrmConverter.Adapter adapter = this.getXmlConverterAdapter(); - if (adapter == null) { - if (this.converter.getType() != null) { - this.setConverter_(this.buildNullConverter()); - } - } else { - if (this.converter.getType() == adapter.getConverterType()) { - this.converter.synchronizeWithResourceModel(); - } else { - this.setConverter_(adapter.buildNewConverter(this, this.getContextNodeFactory())); - } - } - } - - /** - * Return the first adapter whose converter value is set in the XML mapping. - * Return null if there are no converter values in the XML. - */ - protected OrmConverter.Adapter getXmlConverterAdapter() { - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.isActive(this.xmlAttributeMapping)) { - return adapter; - } - } - return null; - } - - protected OrmConverter buildNullConverter() { - return new NullOrmConverter(this); - } - - - // ********** converter adapters ********** - - /** - * Return the converter adapter for the specified converter type. - */ - protected OrmConverter.Adapter getConverterAdapter(Class converterType) { - for (OrmConverter.Adapter adapter : this.getConverterAdapters()) { - if (adapter.getConverterType() == converterType) { - return adapter; - } - } - return null; - } - - protected Iterable getConverterAdapters() { - return CONVERTER_ADAPTERS; - } - - - // ********** value attribute override container ********** - - public OrmAttributeOverrideContainer getValueAttributeOverrideContainer() { - return this.valueAttributeOverrideContainer; - } - - protected OrmAttributeOverrideContainer buildValueAttributeOverrideContainer() { - return this.getContextNodeFactory().buildOrmAttributeOverrideContainer(this, this.buildValueAttributeOverrideContainerOwner()); - } - - protected OrmAttributeOverrideContainer.Owner buildValueAttributeOverrideContainerOwner() { - return new ValueAttributeOverrideContainerOwner(); - } - - - // ********** value association override container ********** - - public OrmAssociationOverrideContainer getValueAssociationOverrideContainer() { - return this.valueAssociationOverrideContainer; - } - - protected OrmAssociationOverrideContainer buildValueAssociationOverrideContainer() { - return this.getContextNodeFactory().buildOrmAssociationOverrideContainer(this, this.buildValueAssociationOverrideContainerOwner()); - } - - protected OrmAssociationOverrideContainer.Owner buildValueAssociationOverrideContainerOwner() { - return new ValueAssociationOverrideContainerOwner(); - } - - - // ********** key type ********** - - public Type getKeyType() { - return this.keyType; - } - - protected void setKeyType(Type keyType) { - Type old = this.keyType; - this.keyType = keyType; - this.firePropertyChanged(KEY_TYPE_PROPERTY, old, keyType); - } - - protected Type buildKeyType() { - if (this.getResolvedMapKeyEmbeddable() != null) { - return Type.EMBEDDABLE_TYPE; - } - if (this.getResolvedMapKeyEntity() != null) { - return Type.ENTITY_TYPE; - } - if (this.getMapKeyClass() == null) { - return Type.NO_TYPE; - } - return Type.BASIC_TYPE; - } - - - // ********** map key ********** - - public String getMapKey() { - if (this.noMapKey) { - return null; - } - if (this.pkMapKey) { - // the target is either embeddable or basic, so a key will have to be specified - return null; - } - if (this.customMapKey) { - return this.specifiedMapKey; - } - throw new IllegalStateException("unknown map key"); //$NON-NLS-1$ - } - - - // ********** specified map key ********** - - public String getSpecifiedMapKey() { - return this.specifiedMapKey; - } - - public void setSpecifiedMapKey(String mapKey) { - if (mapKey != null) { - this.setSpecifiedMapKey_(mapKey); - this.setNoMapKey_(false); - this.setPkMapKey_(false); - this.setCustomMapKey_(true); - - MapKey xmlMapKey = this.getXmlMapKey(); - if (xmlMapKey == null) { - xmlMapKey = this.buildXmlMapKey(); - } - xmlMapKey.setName(mapKey); - } else { - this.setPkMapKey(true); // hmmm... - } - } - - protected void setSpecifiedMapKey_(String mapKey) { - String old = this.specifiedMapKey; - this.specifiedMapKey = mapKey; - this.firePropertyChanged(SPECIFIED_MAP_KEY_PROPERTY, old, mapKey); - } - - protected String buildSpecifiedMapKey() { - MapKey xmlMapKey = this.getXmlMapKey(); - return (xmlMapKey == null) ? null : xmlMapKey.getName(); - } - - - // ********** no map key ********** - - public boolean isNoMapKey() { - return this.noMapKey; - } - - public void setNoMapKey(boolean noMapKey) { - if (noMapKey) { - this.setSpecifiedMapKey_(null); - this.setNoMapKey_(true); - this.setPkMapKey_(false); - this.setCustomMapKey_(false); - - if (this.getXmlMapKey() != null) { - this.removeXmlMapKey(); - } - } else { - this.setPkMapKey(true); // hmmm... - } - } - - protected void setNoMapKey_(boolean noMapKey) { - boolean old = this.noMapKey; - this.noMapKey = noMapKey; - this.firePropertyChanged(NO_MAP_KEY_PROPERTY, old, noMapKey); - } - - protected boolean buildNoMapKey() { - return this.getXmlMapKey() == null; - } - - - // ********** pk map key ********** - - public boolean isPkMapKey() { - return this.pkMapKey; - } - - public void setPkMapKey(boolean pkMapKey) { - if (pkMapKey) { - this.setSpecifiedMapKey_(null); - this.setNoMapKey_(false); - this.setPkMapKey_(true); - this.setCustomMapKey_(false); - - MapKey xmlMapKey = this.getXmlMapKey(); - if (xmlMapKey == null) { - this.buildXmlMapKey(); - } else { - xmlMapKey.setName(null); - } - } else { - this.setNoMapKey(true); // hmmm... - } - } - - protected void setPkMapKey_(boolean pkMapKey) { - boolean old = this.pkMapKey; - this.pkMapKey = pkMapKey; - this.firePropertyChanged(PK_MAP_KEY_PROPERTY, old, pkMapKey); - } - - protected boolean buildPkMapKey() { - MapKey xmlMapKey = this.getXmlMapKey(); - return (xmlMapKey != null) && (xmlMapKey.getName() == null); - } - - - // ********** custom map key ********** - - public boolean isCustomMapKey() { - return this.customMapKey; - } - - public void setCustomMapKey(boolean customMapKey) { - if (customMapKey) { - this.setSpecifiedMapKey(""); //$NON-NLS-1$ - } else { - this.setNoMapKey(true); // hmmm... - } - } - - protected void setCustomMapKey_(boolean customMapKey) { - boolean old = this.customMapKey; - this.customMapKey = customMapKey; - this.firePropertyChanged(CUSTOM_MAP_KEY_PROPERTY, old, customMapKey); - } - - protected boolean buildCustomMapKey() { - MapKey xmlMapKey = this.getXmlMapKey(); - return (xmlMapKey != null) && (xmlMapKey.getName() != null); - } - - - // ********** xml map key ********** - - protected MapKey getXmlMapKey() { - return this.xmlAttributeMapping.getMapKey(); - } - - protected MapKey buildXmlMapKey() { - MapKey mapKey = OrmFactory.eINSTANCE.createMapKey(); - this.xmlAttributeMapping.setMapKey(mapKey); - return mapKey; - } - - protected void removeXmlMapKey() { - this.xmlAttributeMapping.setMapKey(null); - } - - - // ********** map key class ********** - - public String getMapKeyClass() { - return (this.specifiedMapKeyClass != null) ? this.specifiedMapKeyClass : this.defaultMapKeyClass; - } - - public String getSpecifiedMapKeyClass() { - return this.specifiedMapKeyClass; - } - - public void setSpecifiedMapKeyClass(String mapKeyClass) { - if (this.setSpecifiedMapKeyClass_(mapKeyClass)) { - XmlClassReference xmlMapKeyClassRef = this.xmlAttributeMapping.getMapKeyClass(); - if (mapKeyClass == null) { - if (xmlMapKeyClassRef != null) { - this.xmlAttributeMapping.setMapKeyClass(null); - } - } else { - if (xmlMapKeyClassRef == null) { - xmlMapKeyClassRef = this.buildXmlMapKeyClassReference(); - } - xmlMapKeyClassRef.setClassName(mapKeyClass); - } - } - } - - protected boolean setSpecifiedMapKeyClass_(String mapKeyClass) { - String old = this.specifiedMapKeyClass; - this.specifiedMapKeyClass = mapKeyClass; - return this.firePropertyChanged(SPECIFIED_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass); - } - - protected XmlClassReference buildXmlMapKeyClassReference() { - XmlClassReference mapKeyClass = OrmFactory.eINSTANCE.createXmlClassReference(); - this.xmlAttributeMapping.setMapKeyClass(mapKeyClass); - return mapKeyClass; - } - - protected String buildSpecifiedMapKeyClass() { - XmlClassReference xmlClassRef = this.xmlAttributeMapping.getMapKeyClass(); - return (xmlClassRef == null) ? null : xmlClassRef.getClassName(); - } - - public String getDefaultMapKeyClass() { - return this.defaultMapKeyClass; - } - - protected void setDefaultMapKeyClass(String mapKeyClass) { - String old = this.defaultMapKeyClass; - this.defaultMapKeyClass = mapKeyClass; - this.firePropertyChanged(DEFAULT_MAP_KEY_CLASS_PROPERTY, old, mapKeyClass); - } - - protected String buildDefaultMapKeyClass() { - JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute(); - return (javaAttribute == null) ? null : javaAttribute.getMultiReferenceMapKeyTypeName(); - } - - public char getMapKeyClassEnclosingTypeSeparator() { - return '$'; - } - - - // ********** resolved map key embeddable/entity ********** - - protected Embeddable getResolvedMapKeyEmbeddable() { - TypeMapping typeMapping = this.getResolvedMapKeyTypeMapping(); - return (typeMapping instanceof Embeddable) ? (Embeddable) typeMapping : null; - } - - protected Entity getResolvedMapKeyEntity() { - TypeMapping typeMapping = this.getResolvedMapKeyTypeMapping(); - return (typeMapping instanceof Entity) ? (Entity) typeMapping : null; - } - - protected TypeMapping getResolvedMapKeyTypeMapping() { - PersistentType resolvedMapKeyType = this.getResolvedMapKeyType(); - return (resolvedMapKeyType == null) ? null : resolvedMapKeyType.getMapping(); - } - - protected PersistentType getResolvedMapKeyType() { - return this.resolvePersistentType(this.getMapKeyClass()); - } - - - // ********** map key column ********** - - public OrmColumn getMapKeyColumn() { - return this.mapKeyColumn; - } - - protected OrmColumn buildMapKeyColumn() { - return this.getContextNodeFactory().buildOrmColumn(this, this.buildMapKeyColumnOwner()); - } - - protected OrmColumn.Owner buildMapKeyColumnOwner() { - return new MapKeyColumnOwner(); - } - - - // ********** map key attribute override container ********** - - public OrmAttributeOverrideContainer getMapKeyAttributeOverrideContainer() { - return this.mapKeyAttributeOverrideContainer; - } - - protected OrmAttributeOverrideContainer buildMapKeyAttributeOverrideContainer() { - return this.getContextNodeFactory().buildOrmAttributeOverrideContainer(this, this.buildMapKeyAttributeOverrideContainerOwner()); - } - - protected OrmAttributeOverrideContainer.Owner buildMapKeyAttributeOverrideContainerOwner() { - return new MapKeyAttributeOverrideContainerOwner(); - } - - - // ********** Java override lookups ********** - - protected JavaAttributeOverride getSpecifiedJavaValueAttributeOverrideNamed(String attributeName) { - JavaElementCollectionMapping2_0 javaMapping = this.getJavaElementCollectionMapping(); - return (javaMapping == null) ? null : - javaMapping.getValueAttributeOverrideContainer().getSpecifiedOverrideNamed(attributeName); - } - - protected JavaAssociationOverride getSpecifiedJavaValueAssociationOverrideNamed(String attributeName) { - JavaElementCollectionMapping2_0 javaMapping = this.getJavaElementCollectionMapping(); - return (javaMapping == null) ? null : - javaMapping.getValueAssociationOverrideContainer().getSpecifiedOverrideNamed(attributeName); - } - - protected JavaAttributeOverride getSpecifiedJavaMapKeyAttributeOverrideNamed(String attributeName) { - JavaElementCollectionMapping2_0 javaMapping = this.getJavaElementCollectionMapping(); - return (javaMapping == null) ? null : - javaMapping.getMapKeyAttributeOverrideContainer().getSpecifiedOverrideNamed(attributeName); - } - - protected JavaElementCollectionMapping2_0 getJavaElementCollectionMapping() { - AttributeMapping javaAttributeMapping = this.getJavaAttributeMapping(); - return (javaAttributeMapping instanceof JavaElementCollectionMapping2_0) ? - (JavaElementCollectionMapping2_0) javaAttributeMapping : - null; - } - - protected JavaAttributeMapping getJavaAttributeMapping() { - JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute(); - return (javaAttribute == null) ? null : javaAttribute.getMapping(); - } - - - // ********** misc ********** - - @Override - public OrmPersistentAttribute2_0 getParent() { - return (OrmPersistentAttribute2_0) super.getParent(); - } - - @Override - public OrmPersistentAttribute2_0 getPersistentAttribute() { - return (OrmPersistentAttribute2_0) super.getPersistentAttribute(); - } - - public String getKey() { - return MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public int getXmlSequence() { - return 75; - } - - public Entity getEntity() { - OrmTypeMapping typeMapping = this.getTypeMapping(); - return (typeMapping instanceof Entity) ? (Entity) typeMapping : null; - } - - public void initializeOn(OrmAttributeMapping newMapping) { - newMapping.initializeFromOrmAttributeMapping(this); - } - - public void addXmlAttributeMappingTo(Attributes resourceAttributes) { - resourceAttributes.getElementCollections().add(this.xmlAttributeMapping); - } - - public void removeXmlAttributeMappingFrom(Attributes resourceAttributes) { - resourceAttributes.getElementCollections().remove(this.xmlAttributeMapping); - } - - - // ********** metamodel ********** - - @Override - protected String getMetamodelFieldTypeName() { - return this.getPersistentAttribute().getMetamodelContainerFieldTypeName(); - } - - @Override - public String getMetamodelTypeName() { - if (this.valueType == Type.BASIC_TYPE) { - return this.getTargetClass(); - } - PersistentType targetType = this.getResolvedTargetType(); - if (targetType == null) { - return MetamodelField.DEFAULT_TYPE_NAME; - } - String targetTypeName = targetType.getName(); - return (targetTypeName != null) ? targetTypeName : MetamodelField.DEFAULT_TYPE_NAME; - } - - @Override - protected void addMetamodelFieldTypeArgumentNamesTo(ArrayList typeArgumentNames) { - this.addMetamodelFieldMapKeyTypeArgumentNameTo(typeArgumentNames); - super.addMetamodelFieldTypeArgumentNamesTo(typeArgumentNames); - } - - protected void addMetamodelFieldMapKeyTypeArgumentNameTo(ArrayList typeArgumentNames) { - String keyTypeName = this.getPersistentAttribute().getMetamodelContainerFieldMapKeyTypeName(); - if (keyTypeName != null) { - typeArgumentNames.add(keyTypeName); - } - } - - public String getMetamodelFieldMapKeyTypeName() { - return MappingTools.getMetamodelFieldMapKeyTypeName(this); - } - - - // ********** embedded mappings ********** - - public Iterator candidateMapKeyNames() { - return new CompositeIterator(this.allTargetEmbeddableAttributeNamesLists()); - } - - /** - * Return a list of lists; each nested list holds the names for one of the - * embedded mapping's target embeddable type mapping's attribute mappings - * (attribute or association mappings, depending on the specified transformer). - */ - protected Iterator> allTargetEmbeddableAttributeNamesLists() { - return new TransformationIterator>(this.allTargetEmbeddableAttributeMappings(), AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER); - } - - protected Iterator allTargetEmbeddableAttributeMappings() { - Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable(); - return (targetEmbeddable != null) ? targetEmbeddable.allAttributeMappings() : EmptyIterator. instance(); - } - - @Override - @SuppressWarnings("unchecked") - public Iterator allMappingNames() { - return new CompositeIterator(super.allMappingNames(), this.allEmbeddableAttributeMappingNames()); - } - - protected Iterator allEmbeddableAttributeMappingNames() { - return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_MAPPING_NAMES_TRANSFORMER); - } - - @Override - public Iterator allOverridableAttributeMappingNames() { - return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ATTRIBUTE_MAPPING_NAMES_TRANSFORMER); - } - - @Override - public Iterator allOverridableAssociationMappingNames() { - return this.qualifiedEmbeddableOverridableMappingNames(AttributeMappingTools.ALL_OVERRIDABLE_ASSOCIATION_MAPPING_NAMES_TRANSFORMER); - } - - protected Iterator qualifiedEmbeddableOverridableMappingNames(Transformer> transformer) { - return new TransformationIterator(this.embeddableOverridableMappingNames(transformer), this.buildQualifierTransformer()); - } - - protected Iterator embeddableOverridableMappingNames(Transformer> transformer) { - return new CompositeIterator(this.embeddableOverridableMappingNamesLists(transformer)); - } - - /** - * Return a list of lists; each nested list holds the names for one of the - * embedded mapping's target embeddable type mapping's attribute mappings - * (attribute or association mappings, depending on the specified transformer). - */ - protected Iterator> embeddableOverridableMappingNamesLists(Transformer> transformer) { - return new TransformationIterator>(this.embeddableAttributeMappings(), transformer); - } - - @Override - public AttributeMapping resolveAttributeMapping(String attributeName) { - AttributeMapping resolvedMapping = super.resolveAttributeMapping(attributeName); - if (resolvedMapping != null) { - return resolvedMapping; - } - attributeName = this.unqualify(attributeName); - if (attributeName == null) { - return null; - } - // recurse into the embeddable mappings - for (AttributeMapping mapping : CollectionTools.iterable(this.embeddableAttributeMappings())) { - resolvedMapping = mapping.resolveAttributeMapping(attributeName); - if (resolvedMapping != null) { - return resolvedMapping; - } - } - return null; - } - - protected Iterator embeddableAttributeMappings() { - Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable(); - return ((targetEmbeddable != null) && (targetEmbeddable != this.getTypeMapping())) ? - targetEmbeddable.attributeMappings() : - EmptyIterator.instance(); - } - - @Override - public Column resolveOverriddenColumn(String attributeName) { - attributeName = this.unqualify(attributeName); - if (attributeName == null) { - return null; - } - AttributeOverride override = this.valueAttributeOverrideContainer.getSpecifiedOverrideNamed(attributeName); - // recurse into the target embeddable if necessary - return (override != null) ? override.getColumn() : this.resolveOverriddenColumnInTargetEmbeddable(attributeName); - } - - protected Column resolveOverriddenColumnInTargetEmbeddable(String attributeName) { - Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable(); - return (targetEmbeddable == null) ? null : targetEmbeddable.resolveOverriddenColumn(attributeName); - } - - @Override - public Relationship resolveOverriddenRelationship(String attributeName) { - attributeName = this.unqualify(attributeName); - if (attributeName == null) { - return null; - } - AssociationOverride override = this.valueAssociationOverrideContainer.getSpecifiedOverrideNamed(attributeName); - // recurse into the target embeddable if necessary - return (override != null) ? override.getRelationship() : this.resolveOverriddenRelationshipInTargetEmbeddable(attributeName); - } - - protected Relationship resolveOverriddenRelationshipInTargetEmbeddable(String attributeName) { - Embeddable targetEmbeddable = this.getResolvedTargetEmbeddable(); - return (targetEmbeddable == null) ? null : targetEmbeddable.resolveOverriddenRelationship(attributeName); - } - - - //*********** refactoring *********** - - @Override - @SuppressWarnings("unchecked") - public Iterable createRenameTypeEdits(IType originalType, String newName) { - return new CompositeIterable( - super.createRenameTypeEdits(originalType, newName), - this.createMapKeyClassRenameTypeEdits(originalType, newName), - this.createTargetClassRenameTypeEdits(originalType, newName), - this.createConverterRenameTypeEdits(originalType, newName) - ); - } - - protected Iterable createMapKeyClassRenameTypeEdits(IType originalType, String newName) { - if (this.specifiedMapKeyClass != null) { - PersistentType mapKeyType = this.getResolvedMapKeyType(); - if ((mapKeyType != null) && mapKeyType.isFor(originalType.getFullyQualifiedName('.'))) { - return new SingleElementIterable(this.createRenameMapKeyClassEdit(originalType, newName)); - } - } - return EmptyIterable.instance(); - } - - protected ReplaceEdit createRenameMapKeyClassEdit(IType originalType, String newName) { - return this.xmlAttributeMapping.createRenameMapKeyClassEdit(originalType, newName); - } - - protected Iterable createTargetClassRenameTypeEdits(IType originalType, String newName) { - if (this.specifiedTargetClass != null) { - PersistentType targetType = this.getResolvedTargetType(); - if ((targetType != null) && targetType.isFor(originalType.getFullyQualifiedName('.'))) { - return new SingleElementIterable(this.xmlAttributeMapping.createRenameTargetClassEdit(originalType, newName)); - } - } - return EmptyIterable.instance(); - } - - protected Iterable createConverterRenameTypeEdits(IType originalType, String newName) { - return (this.converter != null) ? - this.converter.createRenameTypeEdits(originalType, newName) : - EmptyIterable.instance(); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable createMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return new CompositeIterable( - super.createMoveTypeEdits(originalType, newPackage), - this.createMapKeyClassMoveTypeEdits(originalType, newPackage), - this.createTargetClassMoveTypeEdits(originalType, newPackage), - this.createConverterMoveTypeEdits(originalType, newPackage) - ); - } - - protected Iterable createMapKeyClassMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - if (this.specifiedMapKeyClass != null) { - PersistentType mapKeyType = this.getResolvedMapKeyType(); - if ((mapKeyType != null) && mapKeyType.isFor(originalType.getFullyQualifiedName('.'))) { - return new SingleElementIterable(this.createMapKeyClassRenamePackageEdit(newPackage.getElementName())); - } - } - return EmptyIterable.instance(); - } - - protected Iterable createTargetClassMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - if (this.specifiedTargetClass != null) { - PersistentType targetType = this.getResolvedTargetType(); - if ((targetType != null) && targetType.isFor(originalType.getFullyQualifiedName('.'))) { - return new SingleElementIterable(this.xmlAttributeMapping.createRenameTargetClassPackageEdit(newPackage.getElementName())); - } - } - return EmptyIterable.instance(); - } - - protected Iterable createConverterMoveTypeEdits(IType originalType, IPackageFragment newPackage) { - return (this.converter != null) ? - this.converter.createMoveTypeEdits(originalType, newPackage) : - EmptyIterable.instance(); - } - - @Override - @SuppressWarnings("unchecked") - public Iterable createRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return new CompositeIterable( - super.createRenamePackageEdits(originalPackage, newName), - this.createMapKeyClassRenamePackageEdits(originalPackage, newName), - this.createTargetClassRenamePackageEdits(originalPackage, newName), - this.createConverterRenamePackageEdits(originalPackage, newName) - ); - } - - protected Iterable createMapKeyClassRenamePackageEdits(IPackageFragment originalPackage, String newName) { - if (this.specifiedMapKeyClass != null) { - PersistentType mapKeyType = this.getResolvedMapKeyType(); - if ((mapKeyType != null) && mapKeyType.isIn(originalPackage)) { - return new SingleElementIterable(this.createMapKeyClassRenamePackageEdit(newName)); - } - } - return EmptyIterable.instance(); - } - - protected ReplaceEdit createMapKeyClassRenamePackageEdit(String newName) { - return this.xmlAttributeMapping.createRenameMapKeyClassPackageEdit(newName); - } - - protected Iterable createTargetClassRenamePackageEdits(IPackageFragment originalPackage, String newName) { - if (this.specifiedTargetClass != null) { - PersistentType targetType = this.getResolvedTargetType(); - if ((targetType != null) && targetType.isIn(originalPackage)) { - return new SingleElementIterable(this.xmlAttributeMapping.createRenameTargetClassPackageEdit(newName)); - } - } - return EmptyIterable.instance(); - } - - protected Iterable createConverterRenamePackageEdits(IPackageFragment originalPackage, String newName) { - return (this.converter != null) ? - this.converter.createRenamePackageEdits(originalPackage, newName) : - EmptyIterable.instance(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateTargetClass(messages); - this.validateMapKeyClass(messages); - this.orderable.validate(messages, reporter); - this.collectionTable.validate(messages, reporter); - this.validateValue(messages, reporter); - this.validateMapKey(messages, reporter); - } - - protected void validateTargetClass(List messages) { - if (this.getTargetClass() == null) { - if (this.isVirtual()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED, - new String[] {this.name}, - this, - this.getValidationTextRange() - ) - ); - } else { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ELEMENT_COLLECTION_TARGET_CLASS_NOT_DEFINED, - EMPTY_STRING_ARRAY, - this, - this.getValidationTextRange() - ) - ); - } - } - //TODO this does not give an error for unmapped, unlisted types that aren't basic - bug 310464 - if (this.getResolvedTargetType() != null) { - if (this.getResolvedTargetEmbeddable() == null) { - if (this.isVirtual()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE, - new String[] {this.name, this.getTargetClass()}, - this, - this.getValidationTextRange() - ) - ); - } else { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ELEMENT_COLLECTION_TARGET_CLASS_MUST_BE_EMBEDDABLE_OR_BASIC_TYPE, - new String[] {this.getTargetClass(), this.name}, - this, - this.getTargetClassTextRange() - ) - ); - } - } - } - } - - protected TextRange getTargetClassTextRange() { - return this.xmlAttributeMapping.getTargetClassTextRange(); - } - - protected void validateMapKeyClass(List messages) { - JavaPersistentAttribute javaAttribute = this.getJavaPersistentAttribute(); - if ((javaAttribute != null) && ! javaAttribute.getJpaContainerDefinition().isMap()) { - return; - } - if (this.getMapKeyClass() == null) { - if (this.isVirtual()) { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.VIRTUAL_ATTRIBUTE_ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED, - new String[] {this.name}, - this, - this.getValidationTextRange() - ) - ); - } else { - messages.add( - DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - JpaValidationMessages.ELEMENT_COLLECTION_MAP_KEY_CLASS_NOT_DEFINED, - EMPTY_STRING_ARRAY, - this, - this.getValidationTextRange() - ) - ); - } - } - } - - public void validateValue(List messages, IReporter reporter) { - //TODO should we handle validation when the type is embeddable, - //but a value column is specified, or things like that if that is invalid? - switch (this.valueType) { - case BASIC_TYPE : - this.valueColumn.validate(messages, reporter); - this.converter.validate(messages, reporter); - break; - case EMBEDDABLE_TYPE : - this.valueAttributeOverrideContainer.validate(messages, reporter); - this.valueAssociationOverrideContainer.validate(messages, reporter); - break; - default : - break; - } - } - - protected void validateMapKey(List messages, IReporter reporter) { - if (this.getMapKey() == null) { - this.validateMapKey_(messages, reporter); - } else { - //TODO validate that the map key refers to an existing attribute - } - } - - protected void validateMapKey_(List messages, IReporter reporter) { - switch (this.keyType) { - case BASIC_TYPE : - this.mapKeyColumn.validate(messages, reporter); - //validate map key converter - break; - case ENTITY_TYPE : - //validate map key join columns - break; - case EMBEDDABLE_TYPE : - this.mapKeyAttributeOverrideContainer.validate(messages, reporter); - //validate map key association overrides - break; - default : - break; - } - } - - - // ********** abstract owner ********** - - /** - * the various (column and override) owners have lots of common - * interactions with the mapping - */ - protected abstract class AbstractOwner - { - public OrmTypeMapping getTypeMapping() { - return AbstractOrmElementCollectionMapping2_0.this.getTypeMapping(); - } - - public String getDefaultTableName() { - return this.getCollectionTable().getName(); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - OrmCollectionTable2_0 table = this.getCollectionTable(); - return table.getName().equals(tableName) ? table.getDbTable() : null; - } - - public Iterator candidateTableNames() { - return EmptyIterator.instance(); - } - - /** - * If there is a specified table name it needs to be the same - * the default table name. the table is always the collection table - */ - public boolean tableNameIsInvalid(String tableName) { - return Tools.valuesAreDifferent(this.getDefaultTableName(), tableName); - } - - public TextRange getValidationTextRange() { - return AbstractOrmElementCollectionMapping2_0.this.getValidationTextRange(); - } - - protected String getMappingName() { - return AbstractOrmElementCollectionMapping2_0.this.getName(); - } - - protected boolean mappingIsVirtual() { - return AbstractOrmElementCollectionMapping2_0.this.isVirtual(); - } - - protected OrmCollectionTable2_0 getCollectionTable() { - return AbstractOrmElementCollectionMapping2_0.this.getCollectionTable(); - } - - protected OrmPersistentAttribute2_0 getPersistentAttribute() { - return AbstractOrmElementCollectionMapping2_0.this.getPersistentAttribute(); - } - - protected XmlElementCollection getXmlMapping() { - return AbstractOrmElementCollectionMapping2_0.this.getXmlAttributeMapping(); - } - } - - - // ********** value column owner ********** - - protected class ValueColumnOwner - extends AbstractOwner - implements OrmColumn.Owner - { - public XmlColumn getXmlColumn() { - return this.getXmlMapping().getColumn(); - } - - public XmlColumn buildXmlColumn() { - XmlColumn xmlColumn = OrmFactory.eINSTANCE.createXmlColumn(); - this.getXmlMapping().setColumn(xmlColumn); - return xmlColumn; - } - - public void removeXmlColumn() { - this.getXmlMapping().setColumn(null); - } - - public String getDefaultColumnName() { - return this.getMappingName(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new NamedColumnValidator(this.getPersistentAttribute(), (BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); - } - } - - - // ********** map key column owner ********** - - protected class MapKeyColumnOwner - extends AbstractOwner - implements OrmColumn.Owner - { - public XmlColumn getXmlColumn() { - return this.getXmlMapping().getMapKeyColumn(); - } - - public XmlColumn buildXmlColumn() { - XmlColumn xmlColumn = OrmFactory.eINSTANCE.createXmlColumn(); - this.getXmlMapping().setMapKeyColumn(xmlColumn); - return xmlColumn; - } - - public void removeXmlColumn() { - this.getXmlMapping().setMapKeyColumn(null); - } - - public String getDefaultColumnName() { - return this.getMappingName() + "_KEY"; //$NON-NLS-1$ - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new MapKeyColumnValidator(this.getPersistentAttribute(), (BaseColumn) column, (BaseColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); - } - } - - - // ********** value association override container owner ********** - - protected class ValueAssociationOverrideContainerOwner - extends AbstractOwner - implements OrmAssociationOverrideContainer.Owner - { - public TypeMapping getOverridableTypeMapping() { - return AbstractOrmElementCollectionMapping2_0.this.getResolvedTargetEmbeddable(); - } - - public Iterator allOverridableNames() { - TypeMapping typeMapping = this.getOverridableTypeMapping(); - return (typeMapping != null) ? typeMapping.allOverridableAssociationNames() : EmptyIterator.instance(); - } - - public EList getXmlOverrides() { - return this.getXmlMapping().getAssociationOverrides(); - } - - public Relationship resolveOverriddenRelationship(String attributeName) { - if (this.mappingIsVirtual() && ! this.getTypeMapping().isMetadataComplete()) { - JavaAssociationOverride override = AbstractOrmElementCollectionMapping2_0.this.getSpecifiedJavaValueAssociationOverrideNamed(attributeName); - if (override != null) { - return override.getRelationship(); - } - } - return MappingTools.resolveOverriddenRelationship(this.getOverridableTypeMapping(), attributeName); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) { - return new AssociationOverrideJoinColumnValidator(this.getPersistentAttribute(), (AssociationOverride) override, (JoinColumn) column, (JoinColumn.Owner) columnOwner, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); - } - - public JptValidator buildJoinTableJoinColumnValidator(AssociationOverride override, JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$ - } - - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new AssociationOverrideValidator(this.getPersistentAttribute(), (AssociationOverride) override, (AssociationOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); - } - - public JptValidator buildJoinTableInverseJoinColumnValidator(AssociationOverride override, JoinColumn column, Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$ - } - - public JptValidator buildTableValidator(AssociationOverride override, Table table, TableTextRangeResolver textRangeResolver) { - throw new UnsupportedOperationException("An element collection containing a nested relationship mapping using a JoinTable is not supported"); //$NON-NLS-1$ - } - } - - - // ********** value attribute override container owner ********** - - protected class ValueAttributeOverrideContainerOwner - extends AbstractOwner - implements OrmAttributeOverrideContainer.Owner - { - public TypeMapping getOverridableTypeMapping() { - return AbstractOrmElementCollectionMapping2_0.this.getResolvedTargetEmbeddable(); - } - - public Iterator allOverridableNames() { - TypeMapping typeMapping = this.getOverridableTypeMapping(); - return (typeMapping != null) ? typeMapping.allOverridableAttributeNames() : EmptyIterator.instance(); - } - - public EList getXmlOverrides() { - return this.getXmlMapping().getAttributeOverrides(); - } - - public Column resolveOverriddenColumn(String attributeName) { - if (this.mappingIsVirtual() && ! this.getTypeMapping().isMetadataComplete()) { - JavaAttributeOverride override = AbstractOrmElementCollectionMapping2_0.this.getSpecifiedJavaValueAttributeOverrideNamed(attributeName); - if (override != null) { - return override.getColumn(); - } - } - return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName); - } - - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new AttributeOverrideValidator(this.getPersistentAttribute(), (AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) { - return new AttributeOverrideColumnValidator(this.getPersistentAttribute(), (AttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider()); - } - } - - - // ********** map key attribute override container owner ********** - - protected class MapKeyAttributeOverrideContainerOwner - extends AbstractOwner - implements OrmAttributeOverrideContainer.Owner - { - public TypeMapping getOverridableTypeMapping() { - return AbstractOrmElementCollectionMapping2_0.this.getResolvedMapKeyEmbeddable(); - } - - public Iterator allOverridableNames() { - TypeMapping typeMapping = this.getOverridableTypeMapping(); - return (typeMapping != null) ? typeMapping.allOverridableAttributeNames() : EmptyIterator.instance(); - } - - public EList getXmlOverrides() { - return this.getXmlMapping().getMapKeyAttributeOverrides(); - } - - public Column resolveOverriddenColumn(String attributeName) { - if (this.mappingIsVirtual() && ! this.getTypeMapping().isMetadataComplete()) { - JavaAttributeOverride override = AbstractOrmElementCollectionMapping2_0.this.getSpecifiedJavaMapKeyAttributeOverrideNamed(attributeName); - if (override != null) { - return override.getColumn(); - } - } - return MappingTools.resolveOverriddenColumn(this.getOverridableTypeMapping(), attributeName); - } - - public JptValidator buildValidator(Override_ override, OverrideContainer container, OverrideTextRangeResolver textRangeResolver) { - return new MapKeyAttributeOverrideValidator(this.getPersistentAttribute(), (AttributeOverride) override, (AttributeOverrideContainer) container, textRangeResolver, new EmbeddableOverrideDescriptionProvider()); - } - - public JptValidator buildColumnValidator(Override_ override, BaseColumn column, BaseColumn.Owner columnOwner, BaseColumnTextRangeResolver textRangeResolver) { - return new MapKeyAttributeOverrideColumnValidator(this.getPersistentAttribute(), (AttributeOverride) override, column, textRangeResolver, new CollectionTableTableDescriptionProvider()); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java deleted file mode 100644 index e3b01a30f2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCacheable2_0.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0; -import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlCacheable_2_0; - -/** - * orm.xml cacheable - */ -public class GenericOrmCacheable2_0 - extends AbstractOrmXmlContextNode - implements OrmCacheable2_0 -{ - protected Boolean specifiedCacheable; - protected boolean defaultCacheable; - - - public GenericOrmCacheable2_0(OrmCacheableHolder2_0 parent) { - super(parent); - this.specifiedCacheable = this.getXmlCacheable().getCacheable(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedCacheable_(this.getXmlCacheable().getCacheable()); - } - - @Override - public void update() { - super.update(); - this.setDefaultCacheable(this.buildDefaultCacheable()); - } - - - // ********** cacheable ********** - - public boolean isCacheable() { - return (this.specifiedCacheable != null) ? this.specifiedCacheable.booleanValue() : this.defaultCacheable; - } - - public Boolean getSpecifiedCacheable() { - return this.specifiedCacheable; - } - - public void setSpecifiedCacheable(Boolean cacheable) { - this.setSpecifiedCacheable_(cacheable); - this.getXmlCacheable().setCacheable(cacheable); - } - - protected void setSpecifiedCacheable_(Boolean cacheable) { - Boolean old = this.specifiedCacheable; - this.specifiedCacheable = cacheable; - this.firePropertyChanged(SPECIFIED_CACHEABLE_PROPERTY, old, cacheable); - } - - public boolean isDefaultCacheable() { - return this.defaultCacheable; - } - - protected void setDefaultCacheable(boolean cacheable) { - boolean old = this.defaultCacheable; - this.defaultCacheable = cacheable; - this.firePropertyChanged(DEFAULT_CACHEABLE_PROPERTY, old, cacheable); - } - - protected boolean buildDefaultCacheable() { - return this.getCacheableHolder().calculateDefaultCacheable(); - } - - - // ********** misc ********** - - @Override - public OrmCacheableHolder2_0 getParent() { - return (OrmCacheableHolder2_0) super.getParent(); - } - - protected OrmCacheableHolder2_0 getCacheableHolder() { - return this.getParent(); - } - - protected XmlCacheable_2_0 getXmlCacheable() { - return this.getCacheableHolder().getXmlCacheable(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return this.getXmlCacheable().getCacheableTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java deleted file mode 100644 index 9e8b3ffbdc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmCollectionTable2_0.java +++ /dev/null @@ -1,206 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import java.util.Iterator; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.jpa.core.context.Entity; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.NamedColumn; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.ReadOnlyBaseJoinColumn; -import org.eclipse.jpt.jpa.core.context.TypeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmJoinColumn; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.NamedColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.CollectionTableTableDescriptionProvider; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.JoinColumnValidator; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmReferenceTable; -import org.eclipse.jpt.jpa.core.jpa2.context.CollectionTable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionTable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlCollectionTable; -import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection; - -/** - * orm.xml collection table - */ -public class GenericOrmCollectionTable2_0 - extends GenericOrmReferenceTable - implements OrmCollectionTable2_0 -{ - public GenericOrmCollectionTable2_0(OrmElementCollectionMapping2_0 parent, Owner owner) { - super(parent, owner); - } - - @Override - protected OrmJoinColumn.Owner buildJoinColumnOwner() { - return new JoinColumnOwner(); - } - - - // ********** XML table ********** - - @Override - protected XmlCollectionTable getXmlTable() { - return this.getXmlAttributeMapping().getCollectionTable(); - } - - @Override - protected XmlCollectionTable buildXmlTable() { - XmlCollectionTable xmlCollectionTable = OrmFactory.eINSTANCE.createXmlCollectionTable(); - this.getXmlAttributeMapping().setCollectionTable(xmlCollectionTable); - return xmlCollectionTable; - } - - @Override - protected void removeXmlTable() { - this.getXmlAttributeMapping().setCollectionTable(null); - } - - protected XmlElementCollection getXmlAttributeMapping() { - return this.getElementCollectionMapping().getXmlAttributeMapping(); - } - - - // ********** misc ********** - - public PersistentAttribute getPersistentAttribute() { - return this.getElementCollectionMapping().getPersistentAttribute(); - } - - @Override - public OrmElementCollectionMapping2_0 getParent() { - return (OrmElementCollectionMapping2_0) super.getParent(); - } - - protected OrmElementCollectionMapping2_0 getElementCollectionMapping() { - return this.getParent(); - } - - @Override - protected String buildDefaultName() { - return MappingTools.buildCollectionTableDefaultName(this.getElementCollectionMapping()); - } - - public void initializeFrom(CollectionTable2_0 oldCollectionTable) { - super.initializeFrom(oldCollectionTable); - } - - - // ********** validation ********** - - public boolean validatesAgainstDatabase() { - return this.getElementCollectionMapping().validatesAgainstDatabase(); - } - - - // ********** join column owner ********** - - /** - * owner for "back-pointer" join columns; - * these point at the source/owning entity - */ - protected class JoinColumnOwner - implements OrmJoinColumn.Owner - { - protected JoinColumnOwner() { - super(); - } - - public TypeMapping getTypeMapping() { - return this.getElementCollectionMapping().getTypeMapping(); - } - - public org.eclipse.jpt.jpa.db.Table resolveDbTable(String tableName) { - return Tools.valuesAreEqual(GenericOrmCollectionTable2_0.this.getName(), tableName) ? - GenericOrmCollectionTable2_0.this.getDbTable() : - null; - } - - public String getDefaultColumnName() { - //built in MappingTools.buildJoinColumnDefaultName() - return null; - } - - /** - * by default, the join column is, obviously, in the collection table; - * not sure whether it can be anywhere else... - */ - public String getDefaultTableName() { - return GenericOrmCollectionTable2_0.this.getName(); - } - - public TextRange getValidationTextRange() { - return GenericOrmCollectionTable2_0.this.getValidationTextRange(); - } - - public org.eclipse.jpt.jpa.db.Table getReferencedColumnDbTable() { - return this.getTypeMapping().getPrimaryDbTable(); - } - - public boolean joinColumnIsDefault(ReadOnlyBaseJoinColumn joinColumn) { - return GenericOrmCollectionTable2_0.this.getDefaultJoinColumn() == joinColumn; - } - - /** - * the default table name is always valid and a specified table name - * is prohibited (which will be handled elsewhere) - */ - public boolean tableNameIsInvalid(String tableName) { - return false; - } - - public Iterator candidateTableNames() { - return EmptyIterator.instance(); - } - - public Entity getRelationshipTarget() { - return this.getElementCollectionMapping().getEntity(); - } - - public String getAttributeName() { - //TODO - return null; //I *think* this is correct -// //return GenericJavaCollectionTable2_0.this.getParent().getName(); -// Entity targetEntity = GenericOrmCollectionTable2_0.this.getRelationshipMapping().getResolvedTargetEntity(); -// if (targetEntity == null) { -// return null; -// } -// for (PersistentAttribute each : CollectionTools.iterable(targetEntity.getPersistentType().allAttributes())) { -// if (each.getMapping().isOwnedBy(getRelationshipMapping())) { -// return each.getName(); -// } -// } -// return null; - } - - protected PersistentAttribute getPersistentAttribute() { - return GenericOrmCollectionTable2_0.this.getPersistentAttribute(); - } - - public int joinColumnsSize() { - return GenericOrmCollectionTable2_0.this.joinColumnsSize(); - } - - protected OrmElementCollectionMapping2_0 getElementCollectionMapping() { - return GenericOrmCollectionTable2_0.this.getElementCollectionMapping(); - } - - public JptValidator buildColumnValidator(NamedColumn column, NamedColumnTextRangeResolver textRangeResolver) { - return new JoinColumnValidator(this.getPersistentAttribute(), (JoinColumn) column, this, (JoinColumnTextRangeResolver) textRangeResolver, new CollectionTableTableDescriptionProvider()); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java deleted file mode 100644 index 7db7be432c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmDerivedIdentity2_0.java +++ /dev/null @@ -1,181 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import java.util.List; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.DerivedIdentityStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmIdDerivedIdentityStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMapsIdDerivedIdentityStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericOrmDerivedIdentity2_0 - extends AbstractOrmXmlContextNode - implements OrmDerivedIdentity2_0 -{ - protected DerivedIdentityStrategy2_0 strategy; - - protected OrmIdDerivedIdentityStrategy2_0 idStrategy; - - protected OrmMapsIdDerivedIdentityStrategy2_0 mapsIdStrategy; - - - public GenericOrmDerivedIdentity2_0(OrmSingleRelationshipMapping2_0 parent) { - super(parent); - this.idStrategy = this.buildIdStrategy(); - this.mapsIdStrategy = this.buildMapsIdStrategy(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.idStrategy.synchronizeWithResourceModel(); - this.mapsIdStrategy.synchronizeWithResourceModel(); - } - - @Override - public void update() { - super.update(); - this.idStrategy.update(); - this.mapsIdStrategy.update(); - this.updateStrategy(); - } - - - // ********** predominant strategy ********** - - public DerivedIdentityStrategy2_0 getPredominantDerivedIdentityStrategy() { - return this.strategy; - } - - protected void setStrategy(DerivedIdentityStrategy2_0 strategy) { - DerivedIdentityStrategy2_0 old = this.strategy; - this.strategy = strategy; - this.firePropertyChanged(PREDOMINANT_DERIVED_IDENTITY_STRATEGY_PROPERTY, old, strategy); - } - - protected void updateStrategy() { - this.setStrategy(this.buildStrategy()); - } - - protected DerivedIdentityStrategy2_0 buildStrategy() { - if (this.mapsIdStrategy.isSpecified()) { - return this.mapsIdStrategy; - } - if (this.idStrategy.isSpecified()) { - return this.idStrategy; - } - return null; - } - - - // ********** null strategy ********** - - public boolean usesNullDerivedIdentityStrategy() { - return this.strategy == null; - } - - public void setNullDerivedIdentityStrategy() { - this.mapsIdStrategy.removeStrategy(); - this.idStrategy.removeStrategy(); - this.updateStrategy(); - } - - - // ********** ID strategy ********** - - public OrmIdDerivedIdentityStrategy2_0 getIdDerivedIdentityStrategy() { - return this.idStrategy; - } - - public void setIdDerivedIdentityStrategy() { - this.idStrategy.addStrategy(); - this.mapsIdStrategy.removeStrategy(); - this.updateStrategy(); - } - - public void unsetIdDerivedIdentityStrategy() { - this.idStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean usesIdDerivedIdentityStrategy() { - return this.strategy == this.idStrategy; - } - - protected OrmIdDerivedIdentityStrategy2_0 buildIdStrategy() { - return new GenericOrmIdDerivedIdentityStrategy2_0(this); - } - - - // ********** maps ID strategy ********** - - public OrmMapsIdDerivedIdentityStrategy2_0 getMapsIdDerivedIdentityStrategy() { - return this.mapsIdStrategy; - } - - public void setMapsIdDerivedIdentityStrategy() { - this.mapsIdStrategy.addStrategy(); - this.idStrategy.removeStrategy(); - this.updateStrategy(); - } - - public void unsetMapsIdDerivedIdentityStrategy() { - this.mapsIdStrategy.removeStrategy(); - this.updateStrategy(); - } - - public boolean usesMapsIdDerivedIdentityStrategy() { - return this.strategy == this.mapsIdStrategy; - } - - protected OrmMapsIdDerivedIdentityStrategy2_0 buildMapsIdStrategy() { - return new GenericOrmMapsIdDerivedIdentityStrategy2_0(this); - } - - - // ********** misc ********** - - @Override - public OrmSingleRelationshipMapping2_0 getParent() { - return (OrmSingleRelationshipMapping2_0) super.getParent(); - } - - public OrmSingleRelationshipMapping2_0 getMapping() { - return this.getParent(); - } - - public void initializeFrom(OrmDerivedIdentity2_0 oldDerivedIdentity) { - this.idStrategy.initializeFrom(oldDerivedIdentity.getIdDerivedIdentityStrategy()); - this.mapsIdStrategy.initializeFrom(oldDerivedIdentity.getMapsIdDerivedIdentityStrategy()); - this.updateStrategy(); - } - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.idStrategy.validate(messages, reporter); - this.mapsIdStrategy.validate(messages, reporter); - } - - public TextRange getValidationTextRange() { - return this.getMapping().getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java deleted file mode 100644 index 105c822071..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmElementCollectionMapping2_0.java +++ /dev/null @@ -1,21 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the terms of - * the Eclipse Public License v1.0, which accompanies this distribution and is available at - * http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection; - -public class GenericOrmElementCollectionMapping2_0 - extends AbstractOrmElementCollectionMapping2_0 -{ - public GenericOrmElementCollectionMapping2_0(OrmPersistentAttribute parent, XmlElementCollection resourceMapping) { - super(parent, resourceMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java deleted file mode 100644 index 7d5525de4d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmEmbeddable2_0.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmEmbeddable; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.java.GenericJavaEmbeddable2_0; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable; - -/** - * JPA 2.0 - * orm.xml embeddable type mapping - */ -public class GenericOrmEmbeddable2_0 - extends AbstractOrmEmbeddable -{ - public GenericOrmEmbeddable2_0(OrmPersistentType parent, XmlEmbeddable resourceMapping) { - super(parent, resourceMapping); - } - - @Override - public boolean attributeMappingKeyAllowed(String attributeMappingKey) { - return ArrayTools.contains(GenericJavaEmbeddable2_0.ALLOWED_ATTRIBUTE_MAPPING_KEYS, attributeMappingKey); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmIdDerivedIdentityStrategy2_0.java deleted file mode 100644 index cdf4e2a343..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmIdDerivedIdentityStrategy2_0.java +++ /dev/null @@ -1,114 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import java.util.List; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmIdDerivedIdentityStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0; -import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSingleRelationshipMapping_2_0; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericOrmIdDerivedIdentityStrategy2_0 - extends AbstractOrmXmlContextNode - implements OrmIdDerivedIdentityStrategy2_0 -{ - protected boolean value; - - - public GenericOrmIdDerivedIdentityStrategy2_0(OrmDerivedIdentity2_0 parent) { - super(parent); - this.value = this.buildValue(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setValue_(this.buildValue()); - } - - - // ********** value ********** - - public boolean getValue() { - return this.value; - } - - public void setValue(boolean value) { - this.setValue_(value); - this.getXmlMapping().setId(value ? Boolean.TRUE : null); - } - - protected void setValue_(boolean value) { - boolean old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - protected boolean buildValue() { - Boolean xmlValue = this.getXmlMapping().getId(); - return (xmlValue != null) && xmlValue.booleanValue(); - } - - - // ********** misc ********** - - @Override - public OrmDerivedIdentity2_0 getParent() { - return (OrmDerivedIdentity2_0) super.getParent(); - } - - protected OrmDerivedIdentity2_0 getDerivedIdentity() { - return this.getParent(); - } - - protected OrmSingleRelationshipMapping2_0 getMapping() { - return this.getDerivedIdentity().getMapping(); - } - - protected XmlSingleRelationshipMapping_2_0 getXmlMapping() { - return this.getMapping().getXmlAttributeMapping(); - } - - public boolean isSpecified() { - return this.value; - } - - public void addStrategy() { - this.setValue(true); - } - - public void removeStrategy() { - this.setValue(false); - } - - public void initializeFrom(OrmIdDerivedIdentityStrategy2_0 oldStrategy) { - this.setValue(oldStrategy.getValue()); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return this.getXmlMapping().getIdTextRange(); - } - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - // no validation rules - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmMapsIdDerivedIdentityStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmMapsIdDerivedIdentityStrategy2_0.java deleted file mode 100644 index a795658ba1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmMapsIdDerivedIdentityStrategy2_0.java +++ /dev/null @@ -1,282 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import java.util.List; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.Tools; -import org.eclipse.jpt.common.utility.internal.iterables.ArrayIterable; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.SingleElementIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.MappingKeys; -import org.eclipse.jpt.jpa.core.context.AttributeMapping; -import org.eclipse.jpt.jpa.core.context.Embeddable; -import org.eclipse.jpt.jpa.core.context.EmbeddedIdMapping; -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.internal.validation.DefaultJpaValidationMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationDescriptionMessages; -import org.eclipse.jpt.jpa.core.internal.validation.JpaValidationMessages; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMapsIdDerivedIdentityStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0; -import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlSingleRelationshipMapping_2_0; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.validation.internal.provisional.core.IMessage; -import org.eclipse.wst.validation.internal.provisional.core.IReporter; - -public class GenericOrmMapsIdDerivedIdentityStrategy2_0 - extends AbstractOrmXmlContextNode - implements OrmMapsIdDerivedIdentityStrategy2_0 -{ - protected String specifiedValue; - // no default value - - - public GenericOrmMapsIdDerivedIdentityStrategy2_0(OrmDerivedIdentity2_0 parent) { - super(parent); - this.specifiedValue = this.getXmlMapping().getMapsId(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedValue_(this.getXmlMapping().getMapsId()); - } - - - // ********** value ********** - - public String getValue() { - // there is no default value - return this.specifiedValue; - } - - public String getSpecifiedValue() { - return this.specifiedValue; - } - - public void setSpecifiedValue(String value) { - this.setSpecifiedValue_(value); - this.getXmlMapping().setMapsId(value); - } - - protected void setSpecifiedValue_(String value) { - String old = this.specifiedValue; - this.specifiedValue = value; - this.firePropertyChanged(SPECIFIED_VALUE_PROPERTY, old, value); - } - - public String getDefaultValue() { - // there is no way to have default values in xml - return null; - } - - public boolean usesDefaultValue() { - return false; - } - - - // ********** misc ********** - - @Override - public OrmDerivedIdentity2_0 getParent() { - return (OrmDerivedIdentity2_0) super.getParent(); - } - - protected OrmDerivedIdentity2_0 getDerivedIdentity() { - return this.getParent(); - } - - public OrmSingleRelationshipMapping2_0 getMapping() { - return this.getDerivedIdentity().getMapping(); - } - - protected OrmPersistentAttribute getPersistentAttribute() { - return this.getMapping().getPersistentAttribute(); - } - - protected XmlSingleRelationshipMapping_2_0 getXmlMapping() { - return this.getMapping().getXmlAttributeMapping(); - } - - protected Iterable getAllAttributeMappings() { - return CollectionTools.collection(this.getPersistentAttribute().getOwningTypeMapping().allAttributeMappings()); - } - - public Iterable getSortedValueChoices() { - return CollectionTools.sort(this.getAllAttributeMappingChoiceNames()); - } - - protected Iterable getAllAttributeMappingChoiceNames() { - return new TransformationIterable(this.getAllAttributeMappingChoices()) { - @Override - protected String transform(AttributeMapping mapping) { - return mapping.getName(); - } - }; - } - - protected Iterable getAllAttributeMappingChoices() { - return this.buildAttributeMappingChoices(this.getAllAttributeMappings()); - } - - protected Iterable buildAttributeMappingChoices(Iterable attributeMappings) { - return new CompositeIterable(this.getAttributeMappingChoiceIterables(attributeMappings)); - } - - /** - * @see #getEmbeddedIdMappingChoiceIterable(EmbeddedIdMapping) - */ - protected Iterable> getAttributeMappingChoiceIterables(Iterable availableMappings) { - return new TransformationIterable>(availableMappings) { - @Override - protected Iterable transform(AttributeMapping o) { - return Tools.valuesAreEqual(o.getKey(), MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY) ? - GenericOrmMapsIdDerivedIdentityStrategy2_0.this.getEmbeddedIdMappingChoiceIterable((EmbeddedIdMapping) o) : - new SingleElementIterable(o); - } - }; - } - - /** - * Convert the specified mapping into a collection of its "mappings". - * Typically, this collection will include just the mapping itself; - * but, if the mapping is an embedded ID, this collection will include - * the mapping itself plus all the mappings of its target embeddable. - */ - protected Iterable getEmbeddedIdMappingChoiceIterable(EmbeddedIdMapping mapping) { - Embeddable embeddable = mapping.getTargetEmbeddable(); - if (embeddable == null) { - return new SingleElementIterable(mapping); - } - return new CompositeIterable( - mapping, - CollectionTools.collection(embeddable.allAttributeMappings()) - ); - } - - public AttributeMapping getResolvedAttributeMappingValue() { - String value = this.getValue(); - if (value != null) { - for (AttributeMapping mapping : this.getAllAttributeMappingChoices()) { - if (value.equals(mapping.getName())) { - return mapping; - } - } - } - return null; - } - - public boolean isSpecified() { - return this.getXmlMapping().getMapsId() != null; - } - - public void addStrategy() { - this.getXmlMapping().setMapsId(""); //$NON-NLS-1$ - } - - public void removeStrategy() { - this.getXmlMapping().setMapsId(null); - } - - public void initializeFrom(OrmMapsIdDerivedIdentityStrategy2_0 oldStrategy) { - this.setSpecifiedValue(oldStrategy.getSpecifiedValue()); - } - - - // ********** ID mappings ********** - - protected Iterable getIdAttributeMappings() { - return new FilteringIterable(this.getAllAttributeMappings()) { - @Override - protected boolean accept(AttributeMapping mapping) { - return GenericOrmMapsIdDerivedIdentityStrategy2_0.this.mappingIsIdMapping(mapping); - } - }; - } - - protected boolean mappingIsIdMapping(AttributeMapping mapping) { - return CollectionTools.contains(this.getIdMappingKeys(), mapping.getKey()); - } - - protected Iterable getIdMappingKeys() { - return ID_MAPPING_KEYS; - } - - protected static final String[] ID_MAPPING_KEYS_ARRAY = new String[] { - MappingKeys.ID_ATTRIBUTE_MAPPING_KEY, - MappingKeys.EMBEDDED_ID_ATTRIBUTE_MAPPING_KEY - }; - - protected static final Iterable ID_MAPPING_KEYS = new ArrayIterable(ID_MAPPING_KEYS_ARRAY); - - - // ********** validation ********** - - @Override - public void validate(List messages, IReporter reporter) { - super.validate(messages, reporter); - this.validateMapsId(messages); - } - - protected void validateMapsId(List messages) { - if (this.getDerivedIdentity().usesMapsIdDerivedIdentityStrategy()) { - this.validateMapsId_(messages); - } - } - - protected void validateMapsId_(List messages) { - // test whether value can be resolved - AttributeMapping attributeMapping = this.getResolvedAttributeMappingValue(); - if (attributeMapping == null) { - // there is no defaulting, so only use the 'resolved' error, even if the value is empty string - messages.add(this.buildMessage(JpaValidationMessages.MAPS_ID_VALUE_NOT_RESOLVED, new String[] {this.getValue()})); - } else { - // test whether attribute mapping is allowable - if ( ! CollectionTools.contains(this.getValidAttributeMappingChoices(), attributeMapping)) { - messages.add(this.buildMessage(JpaValidationMessages.MAPS_ID_VALUE_INVALID, new String[] {this.getValue()})); - } - } - } - - protected Iterable getValidAttributeMappingChoices() { - return this.buildAttributeMappingChoices(this.getIdAttributeMappings()); - } - - protected IMessage buildMessage(String msgID, String[] parms) { - PersistentAttribute attribute = this.getPersistentAttribute(); - String attributeDescription = attribute.isVirtual() ? - JpaValidationDescriptionMessages.VIRTUAL_ATTRIBUTE_DESC : - JpaValidationDescriptionMessages.ATTRIBUTE_DESC; - attributeDescription = NLS.bind(attributeDescription, attribute.getName()); - parms = ArrayTools.add(parms, 0, attributeDescription); - return DefaultJpaValidationMessages.buildMessage( - IMessage.HIGH_SEVERITY, - msgID, - parms, - this, - this.getValidationTextRange() - ); - } - - public TextRange getValidationTextRange() { - TextRange textRange = this.getXmlMapping().getMapsIdTextRange(); - return (textRange != null) ? textRange : this.getDerivedIdentity().getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java deleted file mode 100644 index 639bf61ada..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmNamedQuery2_0.java +++ /dev/null @@ -1,90 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmQuery; -import org.eclipse.jpt.jpa.core.jpa2.context.LockModeType2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmNamedQuery2_0; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery; - -/** - * JPA 2.0 - * orm.xml named query - */ -public class GenericOrmNamedQuery2_0 - extends AbstractOrmQuery - implements OrmNamedQuery2_0 -{ - private LockModeType2_0 specifiedLockMode; - private LockModeType2_0 defaultLockMode; - - - public GenericOrmNamedQuery2_0(XmlContextNode parent, XmlNamedQuery xmlNamedQuery) { - super(parent, xmlNamedQuery); - this.specifiedLockMode = this.buildSpecifiedLockMode(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedLockMode_(this.buildSpecifiedLockMode()); - } - - @Override - public void update() { - super.update(); - this.setDefaultLockMode(this.buildDefaultLockMode()); - } - - - // ********** lock mode ********** - - public LockModeType2_0 getLockMode() { - return (this.specifiedLockMode != null) ? this.specifiedLockMode : this.defaultLockMode; - } - - public LockModeType2_0 getSpecifiedLockMode() { - return this.specifiedLockMode; - } - - public void setSpecifiedLockMode(LockModeType2_0 lockMode) { - this.setSpecifiedLockMode_(lockMode); - this.xmlQuery.setLockMode(LockModeType2_0.toOrmResourceModel(lockMode)); - } - - public void setSpecifiedLockMode_(LockModeType2_0 lockMode) { - LockModeType2_0 old = this.specifiedLockMode; - this.specifiedLockMode = lockMode; - this.firePropertyChanged(SPECIFIED_LOCK_MODE_PROPERTY, old, lockMode); - } - - protected LockModeType2_0 buildSpecifiedLockMode() { - return LockModeType2_0.fromOrmResourceModel(this.xmlQuery.getLockMode()); - } - - public LockModeType2_0 getDefaultLockMode() { - return this.defaultLockMode; - } - - protected void setDefaultLockMode(LockModeType2_0 lockMode) { - LockModeType2_0 old = this.defaultLockMode; - this.defaultLockMode = lockMode; - this.firePropertyChanged(DEFAULT_LOCK_MODE_PROPERTY, old, lockMode); - } - - protected LockModeType2_0 buildDefaultLockMode() { - return LockModeType2_0.NONE; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java deleted file mode 100644 index 48922a3903..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrderColumn2_0.java +++ /dev/null @@ -1,200 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import org.eclipse.jpt.jpa.core.context.PersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmNamedColumn; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderColumn2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderable2_0; -import org.eclipse.jpt.jpa.core.resource.orm.XmlOrderColumn; - -/** - * orm.xml order column - */ -public class GenericOrmOrderColumn2_0 - extends AbstractOrmNamedColumn - implements OrmOrderColumn2_0 -{ - // TODO defaults from java for all of these settings - protected Boolean specifiedNullable; - - protected Boolean specifiedInsertable; - - protected Boolean specifiedUpdatable; - - - public GenericOrmOrderColumn2_0(OrmOrderable2_0 parent, OrmOrderColumn2_0.Owner owner) { - super(parent, owner); - this.specifiedNullable = this.buildSpecifiedNullable(); - this.specifiedInsertable = this.buildSpecifiedInsertable(); - this.specifiedUpdatable = this.buildSpecifiedUpdatable(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedNullable_(this.buildSpecifiedNullable()); - this.setSpecifiedInsertable_(this.buildSpecifiedInsertable()); - this.setSpecifiedUpdatable_(this.buildSpecifiedUpdatable()); - } - - - // ********** XML column ********** - - @Override - public XmlOrderColumn getXmlColumn() { - return this.owner.getXmlColumn(); - } - - @Override - protected XmlOrderColumn buildXmlColumn() { - return this.owner.buildXmlColumn(); - } - - @Override - protected void removeXmlColumn() { - this.owner.removeXmlColumn(); - } - - - // ********** nullable ********** - - public boolean isNullable() { - return (this.specifiedNullable != null) ? this.specifiedNullable.booleanValue() : this.isDefaultNullable(); - } - - public Boolean getSpecifiedNullable() { - return this.specifiedNullable; - } - - public void setSpecifiedNullable(Boolean nullable) { - if (this.valuesAreDifferent(this.specifiedNullable, nullable)) { - XmlOrderColumn xmlColumn = this.getXmlColumnForUpdate(); - this.setSpecifiedNullable_(nullable); - xmlColumn.setNullable(nullable); - this.removeXmlColumnIfUnset(); - } - } - - protected void setSpecifiedNullable_(Boolean nullable) { - Boolean old = this.specifiedNullable; - this.specifiedNullable = nullable; - this.firePropertyChanged(SPECIFIED_NULLABLE_PROPERTY, old, nullable); - } - - protected Boolean buildSpecifiedNullable() { - XmlOrderColumn xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getNullable(); - } - - public boolean isDefaultNullable() { - return DEFAULT_NULLABLE; - } - - - // ********** insertable ********** - - public boolean isInsertable() { - return (this.specifiedInsertable != null) ? this.specifiedInsertable.booleanValue() : this.isDefaultInsertable(); - } - - public Boolean getSpecifiedInsertable() { - return this.specifiedInsertable; - } - - public void setSpecifiedInsertable(Boolean insertable) { - if (this.valuesAreDifferent(this.specifiedInsertable, insertable)) { - XmlOrderColumn xmlColumn = this.getXmlColumnForUpdate(); - this.setSpecifiedInsertable_(insertable); - xmlColumn.setInsertable(insertable); - this.removeXmlColumnIfUnset(); - } - } - - protected void setSpecifiedInsertable_(Boolean insertable) { - Boolean old = this.specifiedInsertable; - this.specifiedInsertable = insertable; - this.firePropertyChanged(SPECIFIED_INSERTABLE_PROPERTY, old, insertable); - } - - protected Boolean buildSpecifiedInsertable() { - XmlOrderColumn xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getInsertable(); - } - - public boolean isDefaultInsertable() { - return DEFAULT_INSERTABLE; - } - - - // ********** updatable ********** - - public boolean isUpdatable() { - return (this.specifiedUpdatable != null) ? this.specifiedUpdatable.booleanValue() : this.isDefaultUpdatable(); - } - - public Boolean getSpecifiedUpdatable() { - return this.specifiedUpdatable; - } - - public void setSpecifiedUpdatable(Boolean updatable) { - if (this.valuesAreDifferent(this.specifiedUpdatable, updatable)) { - XmlOrderColumn xmlColumn = this.getXmlColumnForUpdate(); - this.setSpecifiedUpdatable_(updatable); - xmlColumn.setUpdatable(updatable); - this.removeXmlColumnIfUnset(); - } - } - - protected void setSpecifiedUpdatable_(Boolean updatable) { - Boolean old = this.specifiedUpdatable; - this.specifiedUpdatable = updatable; - this.firePropertyChanged(SPECIFIED_UPDATABLE_PROPERTY, old, updatable); - } - - protected Boolean buildSpecifiedUpdatable() { - XmlOrderColumn xmlColumn = this.getXmlColumn(); - return (xmlColumn == null) ? null : xmlColumn.getUpdatable(); - } - - public boolean isDefaultUpdatable() { - return DEFAULT_UPDATABLE; - } - - - // ********** misc ********** - - @Override - public OrmOrderable2_0 getParent() { - return (OrmOrderable2_0) super.getParent(); - } - - protected OrmOrderable2_0 getOrderable() { - return this.getParent(); - } - - protected OrmAttributeMapping getAttributeMapping() { - return this.getOrderable().getParent(); - } - - protected PersistentAttribute getPersistentAttribute() { - return this.getAttributeMapping().getPersistentAttribute(); - } - - @Override - public String getTable() { - return this.getParent().getDefaultTableName(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java deleted file mode 100644 index 69ec1920af..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOrphanRemoval2_0.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.v2_0.XmlOrphanRemovable_2_0; - -/** - * orm.xml orphan removal - */ -public class GenericOrmOrphanRemoval2_0 - extends AbstractOrmXmlContextNode - implements OrmOrphanRemovable2_0 -{ - protected Boolean specifiedOrphanRemoval; - protected boolean defaultOrphanRemoval; - - - public GenericOrmOrphanRemoval2_0(OrmOrphanRemovalHolder2_0 parent) { - super(parent); - this.specifiedOrphanRemoval = this.buildSpecifiedOrphanRemoval(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedOrphanRemoval_(this.buildSpecifiedOrphanRemoval()); - } - - @Override - public void update() { - super.update(); - this.setDefaultOrphanRemoval(this.buildDefaultOrphanRemoval()); - } - - - // ********** orphan removal ********** - - public boolean isOrphanRemoval() { - return (this.specifiedOrphanRemoval != null) ? this.specifiedOrphanRemoval.booleanValue() : this.defaultOrphanRemoval; - } - - public Boolean getSpecifiedOrphanRemoval() { - return this.specifiedOrphanRemoval; - } - - public void setSpecifiedOrphanRemoval(Boolean orphanRemoval) { - this.setSpecifiedOrphanRemoval_(orphanRemoval); - this.getXmlOrphanRemovable().setOrphanRemoval(orphanRemoval); - } - - protected void setSpecifiedOrphanRemoval_(Boolean orphanRemoval) { - Boolean old = this.specifiedOrphanRemoval; - this.specifiedOrphanRemoval = orphanRemoval; - this.firePropertyChanged(SPECIFIED_ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval); - } - - protected Boolean buildSpecifiedOrphanRemoval() { - return this.getXmlOrphanRemovable().getOrphanRemoval(); - } - - public boolean isDefaultOrphanRemoval() { - return this.defaultOrphanRemoval; - } - - protected void setDefaultOrphanRemoval(boolean orphanRemoval) { - boolean old = this.defaultOrphanRemoval; - this.defaultOrphanRemoval = orphanRemoval; - this.firePropertyChanged(DEFAULT_ORPHAN_REMOVAL_PROPERTY, old, orphanRemoval); - } - - protected boolean buildDefaultOrphanRemoval() { - return DEFAULT_ORPHAN_REMOVAL; - } - - - // ********** misc ********** - - @Override - public OrmOrphanRemovalHolder2_0 getParent() { - return (OrmOrphanRemovalHolder2_0) super.getParent(); - } - - protected OrmAttributeMapping getMapping() { - return (OrmAttributeMapping) this.getParent(); - } - - protected XmlAttributeMapping getXmlMapping() { - return this.getMapping().getXmlAttributeMapping(); - } - - protected XmlOrphanRemovable_2_0 getXmlOrphanRemovable() { - return (XmlOrphanRemovable_2_0) this.getXmlMapping(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - // TODO - return this.getXmlOrphanRemovable().getValidationTextRange(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOverrideJoinTableRelationshipStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOverrideJoinTableRelationshipStrategy2_0.java deleted file mode 100644 index 12ca663dbf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmOverrideJoinTableRelationshipStrategy2_0.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.JoinColumn; -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.internal.context.JoinColumnTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.TableTextRangeResolver; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOverrideRelationship2_0; - -public class GenericOrmOverrideJoinTableRelationshipStrategy2_0 - extends AbstractOrmJoinTableRelationshipStrategy -{ - public GenericOrmOverrideJoinTableRelationshipStrategy2_0(OrmOverrideRelationship2_0 parent) { - super(parent); - } - - - @Override - public OrmOverrideRelationship2_0 getRelationship() { - return (OrmOverrideRelationship2_0) super.getRelationship(); - } - - public boolean isOverridable() { - return false; - } - - - // ********** validation ********** - - public boolean validatesAgainstDatabase() { - return this.getRelationship().getTypeMapping().validatesAgainstDatabase(); - } - - public TextRange getValidationTextRange() { - TextRange textRange = this.getRelationship().getAssociationOverride().getXmlOverride().getValidationTextRange(); - return (textRange != null) ? textRange : this.getRelationship().getValidationTextRange(); - } - - public JptValidator buildJoinTableJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return this.getRelationship().buildJoinTableJoinColumnValidator(column, owner, textRangeResolver); - } - - public JptValidator buildJoinTableInverseJoinColumnValidator(JoinColumn column, JoinColumn.Owner owner, JoinColumnTextRangeResolver textRangeResolver) { - return this.getRelationship().buildJoinTableInverseJoinColumnValidator(column, owner, textRangeResolver); - } - - public JptValidator buildTableValidator(Table table, TableTextRangeResolver textRangeResolver) { - return this.getRelationship().buildTableValidator(table, textRangeResolver); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0.java deleted file mode 100644 index 7b3684a80b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmPersistentAttribute2_0.java +++ /dev/null @@ -1,78 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import org.eclipse.jpt.jpa.core.context.AccessType; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.internal.context.JptValidator; -import org.eclipse.jpt.jpa.core.internal.context.orm.SpecifiedOrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.GenericPersistentAttributeValidator; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAccessHolder; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; - -/** - * JPA 2.0 - * orm.xml persistent attribute - */ -public class GenericOrmPersistentAttribute2_0 - extends SpecifiedOrmPersistentAttribute -{ - protected AccessType specifiedAccess; - - - public GenericOrmPersistentAttribute2_0(OrmPersistentType parent, XmlAttributeMapping xmlMapping) { - super(parent, xmlMapping); - this.specifiedAccess = this.buildSpecifiedAccess(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedAccess_(this.buildSpecifiedAccess()); - } - - - // ********** access ********** - - @Override - public AccessType getSpecifiedAccess() { - return this.specifiedAccess; - } - - public void setSpecifiedAccess(AccessType access) { - this.setSpecifiedAccess_(access); - this.getXmlAccessHolder().setAccess(AccessType.toOrmResourceModel(access)); - } - - protected void setSpecifiedAccess_(AccessType access) { - AccessType old = this.specifiedAccess; - this.specifiedAccess = access; - this.firePropertyChanged(SPECIFIED_ACCESS_PROPERTY, old, access); - } - - protected AccessType buildSpecifiedAccess() { - return AccessType.fromOrmResourceModel(this.getXmlAccessHolder().getAccess()); - } - - protected XmlAccessHolder getXmlAccessHolder() { - return this.getXmlAttributeMapping(); - } - - - // ********** validation ********** - - @Override - protected JptValidator buildAttibuteValidator() { - return new GenericPersistentAttributeValidator(this, this.getJavaPersistentAttribute(), this.buildTextRangeResolver()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java deleted file mode 100644 index 548a4a0f50..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmSequenceGenerator2_0.java +++ /dev/null @@ -1,128 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmSequenceGenerator; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSequenceGenerator2_0; -import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator; - -/** - * JPA 2.0 - * orm.xml sequence generator - */ -public class GenericOrmSequenceGenerator2_0 - extends AbstractOrmSequenceGenerator - implements OrmSequenceGenerator2_0 -{ - protected String specifiedCatalog; - protected String defaultCatalog; - - protected String specifiedSchema; - protected String defaultSchema; - - - public GenericOrmSequenceGenerator2_0(XmlContextNode parent, XmlSequenceGenerator xmlSequenceGenerator) { - super(parent, xmlSequenceGenerator); - this.specifiedCatalog = xmlSequenceGenerator.getCatalog(); - this.specifiedSchema = xmlSequenceGenerator.getSchema(); - } - - - // ********** synchronize/update ********** - - @Override - public void synchronizeWithResourceModel() { - super.synchronizeWithResourceModel(); - this.setSpecifiedCatalog_(this.xmlGenerator.getCatalog()); - this.setSpecifiedSchema_(this.xmlGenerator.getSchema()); - } - - @Override - public void update() { - super.update(); - this.setDefaultCatalog(this.buildDefaultCatalog()); - this.setDefaultSchema(this.buildDefaultSchema()); - } - - - // ********** catalog ********** - - @Override - public String getCatalog() { - return (this.specifiedCatalog != null) ? this.specifiedCatalog : this.defaultCatalog; - } - - public String getSpecifiedCatalog() { - return this.specifiedCatalog; - } - - public void setSpecifiedCatalog(String catalog) { - this.setSpecifiedCatalog_(catalog); - this.xmlGenerator.setCatalog(catalog); - } - - protected void setSpecifiedCatalog_(String catalog) { - String old = this.specifiedCatalog; - this.specifiedCatalog = catalog; - this.firePropertyChanged(SPECIFIED_CATALOG_PROPERTY, old, catalog); - } - - public String getDefaultCatalog() { - return this.defaultCatalog; - } - - protected void setDefaultCatalog(String catalog) { - String old = this.defaultCatalog; - this.defaultCatalog = catalog; - this.firePropertyChanged(DEFAULT_CATALOG_PROPERTY, old, catalog); - } - - protected String buildDefaultCatalog() { - return this.getContextDefaultCatalog(); - } - - - // ********** schema ********** - - @Override - public String getSchema() { - return (this.specifiedSchema != null) ? this.specifiedSchema : this.defaultSchema; - } - - public String getSpecifiedSchema() { - return this.specifiedSchema; - } - - public void setSpecifiedSchema(String schema) { - this.setSpecifiedSchema_(schema); - this.xmlGenerator.setSchema(schema); - } - - protected void setSpecifiedSchema_(String schema) { - String old = this.specifiedSchema; - this.specifiedSchema = schema; - this.firePropertyChanged(SPECIFIED_SCHEMA_PROPERTY, old, schema); - } - - public String getDefaultSchema() { - return this.defaultSchema; - } - - protected void setDefaultSchema(String schema) { - String old = this.defaultSchema; - this.defaultSchema = schema; - this.firePropertyChanged(DEFAULT_SCHEMA_PROPERTY, old, schema); - } - - protected String buildDefaultSchema() { - return this.getContextDefaultSchema(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0.java deleted file mode 100644 index 72502c6d33..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0.java +++ /dev/null @@ -1,120 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.context.JoinTable; -import org.eclipse.jpt.jpa.core.context.JoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.JoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.context.Relationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTable; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationship; -import org.eclipse.jpt.jpa.core.context.orm.OrmVirtualJoinTableRelationshipStrategy; -import org.eclipse.jpt.jpa.core.internal.context.MappingTools; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; - -public class GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0 - extends AbstractOrmXmlContextNode - implements OrmVirtualJoinTableRelationshipStrategy -{ - protected OrmVirtualJoinTable joinTable; - - - public GenericOrmVirtualOverrideJoinTableRelationshipStrategy2_0(OrmVirtualJoinTableRelationship parent) { - super(parent); - } - - - // ********** synchronize/update ********** - - @Override - public void update() { - super.update(); - this.updateJoinTable(); - } - - - // ********** join table ********** - - public OrmVirtualJoinTable getJoinTable() { - return this.joinTable; - } - - protected void setJoinTable(OrmVirtualJoinTable joinTable) { - OrmVirtualJoinTable old = this.joinTable; - this.joinTable = joinTable; - this.firePropertyChanged(JOIN_TABLE_PROPERTY, old, joinTable); - } - - protected void updateJoinTable() { - JoinTable overriddenJoinTable = this.getOverriddenJoinTable(); - if (overriddenJoinTable == null) { - if (this.joinTable != null) { - this.setJoinTable(null); - } - } else { - if ((this.joinTable != null) && (this.joinTable.getOverriddenTable() == overriddenJoinTable)) { - this.joinTable.update(); - } else { - this.setJoinTable(this.buildJoinTable(overriddenJoinTable)); - } - } - } - - protected JoinTable getOverriddenJoinTable() { - JoinTableRelationshipStrategy overriddenStrategy = this.getOverriddenStrategy(); - return (overriddenStrategy == null) ? null : overriddenStrategy.getJoinTable(); - } - - protected OrmVirtualJoinTable buildJoinTable(JoinTable overriddenJoinTable) { - return this.getContextNodeFactory().buildOrmVirtualJoinTable(this, overriddenJoinTable); - } - - - // ********** misc ********** - - @Override - public OrmVirtualJoinTableRelationship getParent() { - return (OrmVirtualJoinTableRelationship) super.getParent(); - } - - public OrmVirtualJoinTableRelationship getRelationship() { - return this.getParent(); - } - - protected JoinTableRelationshipStrategy getOverriddenStrategy() { - JoinTableRelationship relationship = this.getOverriddenJoinTableRelationship(); - return (relationship == null) ? null : relationship.getJoinTableStrategy(); - } - - protected JoinTableRelationship getOverriddenJoinTableRelationship() { - Relationship relationship = this.resolveOverriddenRelationship(); - return (relationship instanceof JoinTableRelationship) ? (JoinTableRelationship) relationship : null; - } - - protected Relationship resolveOverriddenRelationship() { - return this.getRelationship().resolveOverriddenRelationship(); - } - - public String getTableName() { - return this.joinTable.getName(); - } - - public String getJoinTableDefaultName() { - return MappingTools.buildJoinTableDefaultName(this.getRelationship()); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java deleted file mode 100644 index 6da85e8058..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0ContextNodeFactory.java +++ /dev/null @@ -1,107 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import org.eclipse.jpt.jpa.core.context.Table; -import org.eclipse.jpt.jpa.core.context.XmlContextNode; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmEmbeddable; -import org.eclipse.jpt.jpa.core.context.orm.OrmNamedQuery; -import org.eclipse.jpt.jpa.core.context.orm.OrmOrderable; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentType; -import org.eclipse.jpt.jpa.core.context.orm.OrmSequenceGenerator; -import org.eclipse.jpt.jpa.core.context.orm.OrmAssociationOverrideContainer.Owner; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmAssociationOverrideContainer; -import org.eclipse.jpt.jpa.core.internal.jpa1.context.orm.GenericOrmOrderable; -import org.eclipse.jpt.jpa.core.jpa2.context.Orderable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCollectionTable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmElementCollectionMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmEmbeddedMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderColumn2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrderable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection; -import org.eclipse.jpt.jpa.core.resource.orm.XmlEmbeddable; -import org.eclipse.jpt.jpa.core.resource.orm.XmlNamedQuery; -import org.eclipse.jpt.jpa.core.resource.orm.XmlSequenceGenerator; - -public class GenericOrmXml2_0ContextNodeFactory - extends AbstractOrmXmlContextNodeFactory - implements OrmXml2_0ContextNodeFactory -{ - @Override - public OrmOrderable buildOrmOrderable(OrmAttributeMapping parent) { - throw new UnsupportedOperationException("use #buildOrmOrderable(OrmAttributeMapping parent, Orderable2_0.Owner owner)"); //$NON-NLS-1$ - } - - @Override - public OrmEmbeddable buildOrmEmbeddable(OrmPersistentType parent, XmlEmbeddable resourceMapping) { - return new GenericOrmEmbeddable2_0(parent, resourceMapping); - } - - @Override - public OrmPersistentAttribute buildOrmPersistentAttribute(OrmPersistentType parent, XmlAttributeMapping xmlMapping) { - return new GenericOrmPersistentAttribute2_0(parent, xmlMapping); - } - - @Override - public OrmSequenceGenerator buildOrmSequenceGenerator(XmlContextNode parent, XmlSequenceGenerator resourceSequenceGenerator) { - return new GenericOrmSequenceGenerator2_0(parent, resourceSequenceGenerator); - } - - public OrmAssociationOverrideContainer buildOrmAssociationOverrideContainer(OrmEmbeddedMapping2_0 parent, Owner owner) { - return new GenericOrmAssociationOverrideContainer(parent, owner); - } - - public OrmDerivedIdentity2_0 buildOrmDerivedIdentity(OrmSingleRelationshipMapping2_0 parent) { - return new GenericOrmDerivedIdentity2_0(parent); - } - - public OrmElementCollectionMapping2_0 buildOrmElementCollectionMapping2_0( - OrmPersistentAttribute parent, XmlElementCollection resourceMapping) { - - return new GenericOrmElementCollectionMapping2_0(parent, resourceMapping); - } - - public OrmCacheable2_0 buildOrmCacheable(OrmCacheableHolder2_0 parent) { - return new GenericOrmCacheable2_0(parent); - } - - public OrmOrphanRemovable2_0 buildOrmOrphanRemoval(OrmOrphanRemovalHolder2_0 parent) { - return new GenericOrmOrphanRemoval2_0(parent); - } - - @Override - public OrmNamedQuery buildOrmNamedQuery(XmlContextNode parent, XmlNamedQuery resourceNamedQuery) { - return new GenericOrmNamedQuery2_0(parent, resourceNamedQuery); - } - - public OrmCollectionTable2_0 buildOrmCollectionTable(OrmElementCollectionMapping2_0 parent, Table.Owner owner) { - return new GenericOrmCollectionTable2_0(parent, owner); - } - - public OrmOrderable2_0 buildOrmOrderable(OrmAttributeMapping parent, Orderable2_0.Owner owner) { - return new GenericOrmOrderable(parent, owner); - } - - public OrmOrderColumn2_0 buildOrmOrderColumn(OrmOrderable2_0 parent, OrmOrderColumn2_0.Owner owner) { - return new GenericOrmOrderColumn2_0(parent, owner); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java deleted file mode 100644 index 25d286b699..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/GenericOrmXml2_0Definition.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import java.util.ArrayList; -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.orm.NullOrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmTypeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmBasicMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddableDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEmbeddedMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmEntityDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmIdMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToManyMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmManyToOneMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmMappedSuperclassDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToManyMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmOneToOneMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmTransientMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.context.orm.OrmVersionMappingDefinition; -import org.eclipse.jpt.jpa.core.internal.jpa2.Generic2_0JpaPlatformProvider; -import org.eclipse.jpt.jpa.core.resource.orm.OrmFactory; - -public class GenericOrmXml2_0Definition - extends AbstractOrmXmlDefinition -{ - // singleton - private static final OrmXmlDefinition INSTANCE = new GenericOrmXml2_0Definition(); - - /** - * Return the singleton - */ - public static OrmXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private GenericOrmXml2_0Definition() { - super(); - } - - public JptResourceType getResourceType() { - return JptJpaCorePlugin.ORM_XML_2_0_RESOURCE_TYPE; - } - - public EFactory getResourceNodeFactory() { - return OrmFactory.eINSTANCE; - } - - @Override - protected OrmXmlContextNodeFactory buildContextNodeFactory() { - return new GenericOrmXml2_0ContextNodeFactory(); - } - - @Override - protected void addTypeMappingDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, TYPE_MAPPING_DEFINITIONS); - } - - /** - * Order should not matter here; but we'll use the same order as for Java. - * @see Generic2_0JpaPlatformProvider - */ - protected static final OrmTypeMappingDefinition[] TYPE_MAPPING_DEFINITIONS = new OrmTypeMappingDefinition[] { - OrmEntityDefinition.instance(), - OrmEmbeddableDefinition.instance(), - OrmMappedSuperclassDefinition.instance() - }; - - @Override - protected void addAttributeMappingDefinitionsTo(ArrayList definitions) { - CollectionTools.addAll(definitions, ATTRIBUTE_MAPPING_DEFINITIONS); - } - - /** - * Order should not matter here; but we'll use the same order as for Java. - * @see Generic2_0JpaPlatformProvider - */ - protected static final OrmAttributeMappingDefinition[] ATTRIBUTE_MAPPING_DEFINITIONS = new OrmAttributeMappingDefinition[] { - OrmTransientMappingDefinition.instance(), - OrmElementCollectionMapping2_0Definition.instance(), - OrmIdMappingDefinition.instance(), - OrmVersionMappingDefinition.instance(), - OrmBasicMappingDefinition.instance(), - OrmEmbeddedMappingDefinition.instance(), - OrmEmbeddedIdMappingDefinition.instance(), - OrmManyToManyMappingDefinition.instance(), - OrmManyToOneMappingDefinition.instance(), - OrmOneToManyMappingDefinition.instance(), - OrmOneToOneMappingDefinition.instance(), - NullOrmAttributeMappingDefinition.instance() - }; -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java deleted file mode 100644 index 7ae634f53b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmCacheable2_0.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmCacheableHolder2_0; - -/** - * null orm.xml cacheable - */ -public class NullOrmCacheable2_0 - extends AbstractOrmXmlContextNode - implements OrmCacheable2_0 -{ - public NullOrmCacheable2_0(OrmCacheableHolder2_0 parent) { - super(parent); - } - - - // ********** cacheable ********** - - public boolean isCacheable() { - return false; - } - - public Boolean getSpecifiedCacheable() { - return null; - } - - public void setSpecifiedCacheable(Boolean cacheable) { - throw new UnsupportedOperationException(); - } - - public boolean isDefaultCacheable() { - return false; - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmDerivedIdentity2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmDerivedIdentity2_0.java deleted file mode 100644 index 9bb81d55ea..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmDerivedIdentity2_0.java +++ /dev/null @@ -1,99 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.AbstractXmlContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.DerivedIdentityStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmDerivedIdentity2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmIdDerivedIdentityStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmMapsIdDerivedIdentityStrategy2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmSingleRelationshipMapping2_0; - -public class NullOrmDerivedIdentity2_0 - extends AbstractXmlContextNode - implements OrmDerivedIdentity2_0 -{ - public NullOrmDerivedIdentity2_0(OrmSingleRelationshipMapping2_0 parent) { - super(parent); - } - - - - // ********** predominant derived identity strategy ********** - - public DerivedIdentityStrategy2_0 getPredominantDerivedIdentityStrategy() { - return null; - } - - - // ********** null derived identity strategy ********** - - public boolean usesNullDerivedIdentityStrategy() { - return true; - } - - public void setNullDerivedIdentityStrategy() { - // NOP - } - - - // ********** ID derived identity strategy ********** - - public OrmIdDerivedIdentityStrategy2_0 getIdDerivedIdentityStrategy() { - return null; - } - - public boolean usesIdDerivedIdentityStrategy() { - return false; - } - - public void setIdDerivedIdentityStrategy() { - // NOP - } - - public void unsetIdDerivedIdentityStrategy() { - // NOP - } - - - // ********** maps ID derived identity strategy ********** - - public OrmMapsIdDerivedIdentityStrategy2_0 getMapsIdDerivedIdentityStrategy() { - return null; - } - - public boolean usesMapsIdDerivedIdentityStrategy() { - return false; - } - - public void setMapsIdDerivedIdentityStrategy() { - // NOP - } - - public void unsetMapsIdDerivedIdentityStrategy() { - // NOP - } - - - // ********** misc ********** - - public OrmSingleRelationshipMapping2_0 getMapping() { - return (OrmSingleRelationshipMapping2_0) this.getParent(); - } - - public void initializeFrom(OrmDerivedIdentity2_0 oldDerivedIdentity) { - // NOP - } - - public TextRange getValidationTextRange() { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java deleted file mode 100644 index 6ecbf93f32..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/NullOrmOrphanRemoval2_0.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.context.orm.AbstractOrmXmlContextNode; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovable2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmOrphanRemovalHolder2_0; - -/** - * Null orm.xml orphan removal - */ -public class NullOrmOrphanRemoval2_0 - extends AbstractOrmXmlContextNode - implements OrmOrphanRemovable2_0 -{ - public NullOrmOrphanRemoval2_0(OrmOrphanRemovalHolder2_0 parent) { - super(parent); - } - - - // ********** orphan removal ********** - - public boolean isDefaultOrphanRemoval() { - return false; - } - - public boolean isOrphanRemoval() { - return false; - } - - public Boolean getSpecifiedOrphanRemoval() { - return null; - } - - public void setSpecifiedOrphanRemoval(Boolean newSpecifiedOrphanRemoval) { - throw new UnsupportedOperationException(); - } - - - // ********** validation ********** - - public TextRange getValidationTextRange() { - return null; - } -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java deleted file mode 100644 index 44e92594b4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/orm/OrmElementCollectionMapping2_0Definition.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.orm; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMapping; -import org.eclipse.jpt.jpa.core.context.orm.OrmAttributeMappingDefinition; -import org.eclipse.jpt.jpa.core.context.orm.OrmPersistentAttribute; -import org.eclipse.jpt.jpa.core.context.orm.OrmXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.jpa2.MappingKeys2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.orm.OrmXml2_0ContextNodeFactory; -import org.eclipse.jpt.jpa.core.resource.orm.OrmPackage; -import org.eclipse.jpt.jpa.core.resource.orm.XmlAttributeMapping; -import org.eclipse.jpt.jpa.core.resource.orm.XmlElementCollection; -import org.eclipse.jpt.jpa.core.resource.xml.EmfTools; - -public class OrmElementCollectionMapping2_0Definition - implements OrmAttributeMappingDefinition -{ - // singleton - private static final OrmAttributeMappingDefinition INSTANCE = - new OrmElementCollectionMapping2_0Definition(); - - - /** - * Return the singleton - */ - public static OrmAttributeMappingDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private OrmElementCollectionMapping2_0Definition() { - super(); - } - - - public String getKey() { - return MappingKeys2_0.ELEMENT_COLLECTION_ATTRIBUTE_MAPPING_KEY; - } - - public XmlAttributeMapping buildResourceMapping(EFactory factory) { - return EmfTools.create( - factory, - OrmPackage.eINSTANCE.getXmlElementCollection(), - XmlElementCollection.class); - } - - public OrmAttributeMapping buildContextMapping( - OrmPersistentAttribute parent, - XmlAttributeMapping xmlMapping, - OrmXmlContextNodeFactory factory) { - return ((OrmXml2_0ContextNodeFactory) factory).buildOrmElementCollectionMapping2_0(parent, (XmlElementCollection) xmlMapping); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java deleted file mode 100644 index cc6131ac51..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlContextNodeFactory.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence; - -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.connection.GenericConnection2_0; -import org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.options.GenericOptions2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.JpaOptions2_0; - - -public class Generic2_0PersistenceXmlContextNodeFactory extends AbstractPersistenceXmlContextNodeFactory -{ - - public JpaConnection2_0 buildConnection(PersistenceUnit parent) { - return new GenericConnection2_0(parent); - } - - public JpaOptions2_0 buildOptions(PersistenceUnit parent) { - return new GenericOptions2_0(parent); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java deleted file mode 100644 index c2ea049fd9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/Generic2_0PersistenceXmlDefinition.java +++ /dev/null @@ -1,53 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence; - -import org.eclipse.emf.ecore.EFactory; -import org.eclipse.jpt.common.core.JptResourceType; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlContextNodeFactory; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXmlDefinition; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceXmlDefinition; -import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.PersistenceV2_0Factory; - -public class Generic2_0PersistenceXmlDefinition - extends AbstractPersistenceXmlDefinition -{ - // singleton - private static final PersistenceXmlDefinition INSTANCE = new Generic2_0PersistenceXmlDefinition(); - - /** - * Return the singleton - */ - public static PersistenceXmlDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private Generic2_0PersistenceXmlDefinition() { - super(); - } - - public JptResourceType getResourceType() { - return JptJpaCorePlugin.PERSISTENCE_XML_2_0_RESOURCE_TYPE; - } - - public EFactory getResourceNodeFactory() { - return PersistenceV2_0Factory.eINSTANCE; - } - - @Override - protected PersistenceXmlContextNodeFactory buildContextNodeFactory() { - return new Generic2_0PersistenceXmlContextNodeFactory(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java deleted file mode 100644 index f8129b5932..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/GenericConnection2_0.java +++ /dev/null @@ -1,194 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.connection; - -import java.util.Map; - -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnitProperties; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0; - -/** - * GenericConnection2_0 - */ -public class GenericConnection2_0 extends AbstractPersistenceUnitProperties - implements JpaConnection2_0 -{ - // ********** GenericConnection properties ********** - private String driver; - private String url; - private String user; - private String password; - - - // ********** constructors ********** - public GenericConnection2_0(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - this.driver = - this.getStringValue(PERSISTENCE_JDBC_DRIVER); - this.url = - this.getStringValue(PERSISTENCE_JDBC_URL); - this.user = - this.getStringValue(PERSISTENCE_JDBC_USER); - this.password = - this.getStringValue(PERSISTENCE_JDBC_PASSWORD); - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(PERSISTENCE_JDBC_DRIVER)) { - this.driverChanged(newValue); - } - else if (propertyName.equals(PERSISTENCE_JDBC_URL)) { - this.urlChanged(newValue); - } - else if (propertyName.equals(PERSISTENCE_JDBC_USER)) { - this.userChanged(newValue); - } - else if (propertyName.equals(PERSISTENCE_JDBC_PASSWORD)) { - this.passwordChanged(newValue); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(PERSISTENCE_JDBC_DRIVER)) { - this.driverChanged(null); - } - else if (propertyName.equals(PERSISTENCE_JDBC_URL)) { - this.urlChanged(null); - } - else if (propertyName.equals(PERSISTENCE_JDBC_USER)) { - this.userChanged(null); - } - else if (propertyName.equals(PERSISTENCE_JDBC_PASSWORD)) { - this.passwordChanged(null); - } - } - - /** - * Adds property names key/value pairs, where: - * key = PU property key - * value = property id - */ - @Override - protected void addPropertyNames(Map propertyNames) { - propertyNames.put( - PERSISTENCE_JDBC_DRIVER, - DRIVER_PROPERTY); - propertyNames.put( - PERSISTENCE_JDBC_URL, - URL_PROPERTY); - propertyNames.put( - PERSISTENCE_JDBC_USER, - USER_PROPERTY); - propertyNames.put( - PERSISTENCE_JDBC_PASSWORD, - PASSWORD_PROPERTY); - } - - // ********** Driver ********** - public String getDriver() { - return this.driver; - } - - public void setDriver(String newDriver) { - String old = this.driver; - this.driver = newDriver; - this.putProperty(DRIVER_PROPERTY, newDriver); - this.firePropertyChanged(DRIVER_PROPERTY, old, newDriver); - } - - private void driverChanged(String newValue) { - String old = this.driver; - this.driver = newValue; - this.firePropertyChanged(DRIVER_PROPERTY, old, newValue); - } - - public String getDefaultDriver() { - return DEFAULT_JDBC_DRIVER; - } - - // ********** URL ********** - public String getUrl() { - return this.url; - } - - public void setUrl(String newUrl) { - String old = this.url; - this.url = newUrl; - this.putProperty(URL_PROPERTY, newUrl); - this.firePropertyChanged(URL_PROPERTY, old, newUrl); - } - - private void urlChanged(String newValue) { - String old = this.url; - this.url = newValue; - this.firePropertyChanged(URL_PROPERTY, old, newValue); - } - - public String getDefaultUrl() { - return DEFAULT_JDBC_URL; - } - - // ********** User ********** - public String getUser() { - return this.user; - } - - public void setUser(String newUser) { - String old = this.user; - this.user = newUser; - this.putProperty(USER_PROPERTY, newUser); - this.firePropertyChanged(USER_PROPERTY, old, newUser); - } - - private void userChanged(String newValue) { - String old = this.user; - this.user = newValue; - this.firePropertyChanged(USER_PROPERTY, old, newValue); - } - - public String getDefaultUser() { - return DEFAULT_JDBC_USER; - } - - // ********** Password ********** - public String getPassword() { - return this.password; - } - - public void setPassword(String newPassword) { - String old = this.password; - this.password = newPassword; - this.putProperty(PASSWORD_PROPERTY, newPassword); - this.firePropertyChanged(PASSWORD_PROPERTY, old, newPassword); - } - - private void passwordChanged(String newValue) { - String old = this.password; - this.password = newValue; - this.firePropertyChanged(PASSWORD_PROPERTY, old, newValue); - } - - public String getDefaultPassword() { - return DEFAULT_JDBC_PASSWORD; - } - - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java deleted file mode 100644 index 0131c28cb9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/connection/NullConnection2_0.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.connection; - -import java.util.Map; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnitProperties; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.connection.JpaConnection2_0; - -/** - * GenericConnection2_0 - */ -public class NullConnection2_0 extends AbstractPersistenceUnitProperties - implements JpaConnection2_0 -{ - - - // ********** constructors ********** - public NullConnection2_0(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - //do nothing - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - //do nothing - } - - public void propertyRemoved(String propertyName) { - //do nothing - } - - /** - * Adds property names key/value pairs, where: - * key = PU property key - * value = property id - */ - @Override - protected void addPropertyNames(Map propertyNames) { - //do nothing - } - - // ********** Driver ********** - public String getDriver() { - return null; - } - - public void setDriver(String newDriver) { - throw new UnsupportedOperationException(); - } - - public String getDefaultDriver() { - return DEFAULT_JDBC_DRIVER; - } - - // ********** URL ********** - public String getUrl() { - return null; - } - - public void setUrl(String newUrl) { - throw new UnsupportedOperationException(); - } - - public String getDefaultUrl() { - return DEFAULT_JDBC_URL; - } - - // ********** User ********** - public String getUser() { - return null; - } - - public void setUser(String newUser) { - throw new UnsupportedOperationException(); - } - - public String getDefaultUser() { - return DEFAULT_JDBC_USER; - } - - // ********** Password ********** - public String getPassword() { - return null; - } - - public void setPassword(String newPassword) { - throw new UnsupportedOperationException(); - } - - public String getDefaultPassword() { - return DEFAULT_JDBC_PASSWORD; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java deleted file mode 100644 index b432df0d5b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/GenericOptions2_0.java +++ /dev/null @@ -1,337 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.options; - -import java.util.List; -import java.util.ListIterator; -import java.util.Map; - -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnitProperties; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.PersistenceUnit2_0; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.JpaOptions2_0; - -/** - * JPA 2.0 options - */ -public class GenericOptions2_0 extends AbstractPersistenceUnitProperties - implements JpaOptions2_0 -{ - // ********** GenericConnection properties ********** - private Integer lockTimeout; - private Integer queryTimeout; - private List validationGroupPrePersists; - private List validationGroupPreUpdates; - private List validationGroupPreRemoves; - - // ********** constructors ********** - public GenericOptions2_0(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - this.lockTimeout = - this.getIntegerValue(PERSISTENCE_LOCK_TIMEOUT); - this.queryTimeout = - this.getIntegerValue(PERSISTENCE_QUERY_TIMEOUT); - - // ValidationMode is initialized with the persistence unit element - this.validationGroupPrePersists = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST); - this.validationGroupPreUpdates = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE); - this.validationGroupPreRemoves = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE); - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - if (propertyName.equals(PERSISTENCE_LOCK_TIMEOUT)) { - this.lockTimeoutChanged(newValue); - } - else if (propertyName.equals(PERSISTENCE_QUERY_TIMEOUT)) { - this.queryTimeoutChanged(newValue); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST)) { - this.validationGroupPrePersistsChanged(); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE)) { - this.validationGroupPreUpdatesChanged(); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE)) { - this.validationGroupPreRemovesChanged(); - } - } - - public void propertyRemoved(String propertyName) { - if (propertyName.equals(PERSISTENCE_LOCK_TIMEOUT)) { - this.lockTimeoutChanged(null); - } - else if (propertyName.equals(PERSISTENCE_QUERY_TIMEOUT)) { - this.queryTimeoutChanged(null); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST)) { - this.validationGroupPrePersistsChanged(); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE)) { - this.validationGroupPreUpdatesChanged(); - } - else if (propertyName.equals(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE)) { - this.validationGroupPreRemovesChanged(); - } - } - - /** - * Adds property names key/value pairs, where: - * key = PU property key - * value = property id - */ - @Override - protected void addPropertyNames(Map propertyNames) { - propertyNames.put( - PERSISTENCE_LOCK_TIMEOUT, - LOCK_TIMEOUT_PROPERTY); - propertyNames.put( - PERSISTENCE_QUERY_TIMEOUT, - QUERY_TIMEOUT_PROPERTY); - propertyNames.put( - PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST, - VALIDATION_GROUP_PRE_PERSIST_PROPERTY); - propertyNames.put( - PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE, - VALIDATION_GROUP_PRE_UPDATE_PROPERTY); - propertyNames.put( - PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE, - VALIDATION_GROUP_PRE_REMOVE_PROPERTY); - } - - @Override - public PersistenceUnit2_0 getPersistenceUnit() { - return (PersistenceUnit2_0) super.getPersistenceUnit(); - } - - // ********** LockTimeout ********** - public Integer getLockTimeout() { - return this.lockTimeout; - } - - public void setLockTimeout(Integer newLockTimeout) { - Integer old = this.lockTimeout; - this.lockTimeout = newLockTimeout; - this.putProperty(LOCK_TIMEOUT_PROPERTY, newLockTimeout); - this.firePropertyChanged(LOCK_TIMEOUT_PROPERTY, old, newLockTimeout); - } - - private void lockTimeoutChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.lockTimeout; - this.lockTimeout = newValue; - this.firePropertyChanged(LOCK_TIMEOUT_PROPERTY, old, newValue); - } - - public Integer getDefaultLockTimeout() { - return DEFAULT_LOCK_TIMEOUT; - } - - // ********** QueryTimeout ********** - public Integer getQueryTimeout() { - return this.queryTimeout; - } - - public void setQueryTimeout(Integer newQueryTimeout) { - Integer old = this.queryTimeout; - this.queryTimeout = newQueryTimeout; - this.putProperty(QUERY_TIMEOUT_PROPERTY, newQueryTimeout); - this.firePropertyChanged(QUERY_TIMEOUT_PROPERTY, old, newQueryTimeout); - } - - private void queryTimeoutChanged(String stringValue) { - Integer newValue = getIntegerValueOf(stringValue); - - Integer old = this.queryTimeout; - this.queryTimeout = newValue; - this.firePropertyChanged(QUERY_TIMEOUT_PROPERTY, old, newValue); - } - - public Integer getDefaultQueryTimeout() { - return DEFAULT_QUERY_TIMEOUT; - } - - // ********** ValidationGroupPrePersists ********** - public ListIterator validationGroupPrePersists(){ - return new CloneListIterator(this.validationGroupPrePersists); - } - - public int validationGroupPrePersistsSize(){ - return this.validationGroupPrePersists.size(); - } - - public boolean validationGroupPrePersistExists(String validationGroupPrePersistClassName) { - for (String validationGroupPrePersist : this.validationGroupPrePersists) { - if(validationGroupPrePersist.equals(validationGroupPrePersistClassName)) { - return true; - } - } - return false; - } - - public String addValidationGroupPrePersist(String newPrePersistClassName){ - - if( ! this.validationGroupPrePersistExists(newPrePersistClassName)) { - this.validationGroupPrePersists.add(newPrePersistClassName); - this.putPropertyCompositeValue(VALIDATION_GROUP_PRE_PERSIST_PROPERTY, newPrePersistClassName); - this.fireListChanged(VALIDATION_GROUP_PRE_PERSIST_LIST, this.validationGroupPrePersists); - return newPrePersistClassName; - } - return null; - } - - public void removeValidationGroupPrePersist(String className){ - - if(this.removeValidationGroupPrePersist_(className) != null) { - this.removePropertyCompositeValue(VALIDATION_GROUP_PRE_PERSIST_PROPERTY, className); - this.fireListChanged(VALIDATION_GROUP_PRE_PERSIST_LIST, this.validationGroupPrePersists); - } - } - - private String removeValidationGroupPrePersist_(String className){ - - for ( ListIterator i = this.validationGroupPrePersists(); i.hasNext();) { - String validationGroupPrePersist = i.next(); - if(validationGroupPrePersist.equals(className)) { - this.validationGroupPrePersists.remove(validationGroupPrePersist); - return validationGroupPrePersist; - } - } - return null; - } - - private void validationGroupPrePersistsChanged() { - this.validationGroupPrePersists = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_PERSIST); - this.fireListChanged(VALIDATION_GROUP_PRE_PERSIST_LIST, this.validationGroupPrePersists); - } - - // ********** ValidationGroupPreUpdates ********** - - public ListIterator validationGroupPreUpdates(){ - return new CloneListIterator(this.validationGroupPreUpdates); - } - - public int validationGroupPreUpdatesSize(){ - return this.validationGroupPreUpdates.size(); - } - - public boolean validationGroupPreUpdateExists(String validationGroupPreUpdateClassName) { - - for (String validationGroupPreUpdate : this.validationGroupPreUpdates) { - if(validationGroupPreUpdate.equals(validationGroupPreUpdateClassName)) { - return true; - } - } - return false; - } - - public String addValidationGroupPreUpdate(String newPreUpdateClassName){ - - if( ! this.validationGroupPreUpdateExists(newPreUpdateClassName)) { - this.validationGroupPreUpdates.add(newPreUpdateClassName); - this.putPropertyCompositeValue(VALIDATION_GROUP_PRE_UPDATE_PROPERTY, newPreUpdateClassName); - this.fireListChanged(VALIDATION_GROUP_PRE_UPDATE_LIST, this.validationGroupPreUpdates); - return newPreUpdateClassName; - } - return null; - } - - public void removeValidationGroupPreUpdate(String className){ - - if(this.removeValidationGroupPreUpdate_(className) != null) { - this.removePropertyCompositeValue(VALIDATION_GROUP_PRE_UPDATE_PROPERTY, className); - this.fireListChanged(VALIDATION_GROUP_PRE_UPDATE_LIST, this.validationGroupPreUpdates); - } - } - - private String removeValidationGroupPreUpdate_(String className){ - - for(ListIterator i = this.validationGroupPreUpdates(); i.hasNext();) { - String validationGroupPreUpdate = i.next(); - if(validationGroupPreUpdate.equals(className)) { - this.validationGroupPreUpdates.remove(validationGroupPreUpdate); - return validationGroupPreUpdate; - } - } - return null; - } - - private void validationGroupPreUpdatesChanged() { - this.validationGroupPreUpdates = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_UPDATE); - this.fireListChanged(VALIDATION_GROUP_PRE_UPDATE_LIST, this.validationGroupPreUpdates); - } - - // ********** ValidationGroupPreRemoves ********** - - public ListIterator validationGroupPreRemoves(){ - return new CloneListIterator(this.validationGroupPreRemoves); - } - - public int validationGroupPreRemovesSize(){ - return this.validationGroupPreRemoves.size(); - } - - public boolean validationGroupPreRemoveExists(String validationGroupPreRemoveClassName) { - - for (String validationGroupPreRemove : this.validationGroupPreRemoves) { - if(validationGroupPreRemove.equals(validationGroupPreRemoveClassName)) { - return true; - } - } - return false; - } - - public String addValidationGroupPreRemove(String newPreRemoveClassName){ - - if( ! this.validationGroupPreRemoveExists(newPreRemoveClassName)) { - this.validationGroupPreRemoves.add(newPreRemoveClassName); - this.putPropertyCompositeValue(VALIDATION_GROUP_PRE_REMOVE_PROPERTY, newPreRemoveClassName); - this.fireListChanged(VALIDATION_GROUP_PRE_REMOVE_LIST, this.validationGroupPreRemoves); - return newPreRemoveClassName; - } - return null; - } - - public void removeValidationGroupPreRemove(String className){ - - if(this.removeValidationGroupPreRemove_(className) != null) { - this.removePropertyCompositeValue(VALIDATION_GROUP_PRE_REMOVE_PROPERTY, className); - this.fireListChanged(VALIDATION_GROUP_PRE_REMOVE_LIST, this.validationGroupPreRemoves); - } - } - - private String removeValidationGroupPreRemove_(String className){ - - for(ListIterator i = this.validationGroupPreRemoves(); i.hasNext();) { - String validationGroupPreRemove = i.next(); - if(validationGroupPreRemove.equals(className)) { - this.validationGroupPreRemoves.remove(validationGroupPreRemove); - return validationGroupPreRemove; - } - } - return null; - } - - private void validationGroupPreRemovesChanged() { - this.validationGroupPreRemoves = this.getCompositeValue(PERSISTENCE_VALIDATION_GROUP_PRE_REMOVE); - this.fireListChanged(VALIDATION_GROUP_PRE_REMOVE_LIST, this.validationGroupPreRemoves); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/NullOptions2_0.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/NullOptions2_0.java deleted file mode 100644 index b7625ed94f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/context/persistence/options/NullOptions2_0.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.context.persistence.options; - -import java.util.ListIterator; -import java.util.Map; - -import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.internal.context.persistence.AbstractPersistenceUnitProperties; -import org.eclipse.jpt.jpa.core.jpa2.context.persistence.options.JpaOptions2_0; - -/** - * JPA 2.0 options - */ -public class NullOptions2_0 extends AbstractPersistenceUnitProperties - implements JpaOptions2_0 -{ - - - // ********** constructors ********** - public NullOptions2_0(PersistenceUnit parent) { - super(parent); - } - - // ********** initialization ********** - /** - * Initializes properties with values from the persistence unit. - */ - @Override - protected void initializeProperties() { - //do nothing - } - - // ********** behavior ********** - - public void propertyValueChanged(String propertyName, String newValue) { - //do nothing - } - - public void propertyRemoved(String propertyName) { - //do nothing - } - - /** - * Adds property names key/value pairs, where: - * key = PU property key - * value = property id - */ - @Override - protected void addPropertyNames(Map propertyNames) { - //do nothing - } - - // ********** LockTimeout ********** - public Integer getLockTimeout() { - return null; - } - - public void setLockTimeout(Integer newLockTimeout) { - throw new UnsupportedOperationException(); - } - - public Integer getDefaultLockTimeout() { - return DEFAULT_LOCK_TIMEOUT; - } - - // ********** QueryTimeout ********** - public Integer getQueryTimeout() { - return null; - } - - public void setQueryTimeout(Integer newQueryTimeout) { - throw new UnsupportedOperationException(); - } - - public Integer getDefaultQueryTimeout() { - return DEFAULT_QUERY_TIMEOUT; - } - - - // ********** ValidationGroupPrePersists ********** - public ListIterator validationGroupPrePersists() { - return EmptyListIterator.instance(); - } - - public int validationGroupPrePersistsSize() { - return 0; - } - - public boolean validationGroupPrePersistExists(String validationGroupPrePersistClassName) { - return false; - } - - public String addValidationGroupPrePersist(String newValidationGroupPrePersistClassName) { - throw new UnsupportedOperationException(); - } - - public void removeValidationGroupPrePersist(String validationGroupPrePersistClassName) { - throw new UnsupportedOperationException(); - } - - // ********** ValidationGroupPreUpdates ********** - public ListIterator validationGroupPreUpdates() { - return EmptyListIterator.instance(); - } - - public int validationGroupPreUpdatesSize() { - return 0; - } - - public boolean validationGroupPreUpdateExists(String validationGroupPreUpdateClassName) { - return false; - } - - public String addValidationGroupPreUpdate(String newValidationGroupPreUpdateClassName) { - throw new UnsupportedOperationException(); - } - - public void removeValidationGroupPreUpdate(String validationGroupPreUpdateClassName) { - throw new UnsupportedOperationException(); - } - - // ********** ValidationGroupPreRemoves ********** - public ListIterator validationGroupPreRemoves() { - return EmptyListIterator.instance(); - } - - public int validationGroupPreRemovesSize() { - return 0; - } - - public boolean validationGroupPreRemoveExists(String validationGroupPreRemoveClassName) { - return false; - } - - public String addValidationGroupPreRemove(String newValidationGroupPreRemoveClassName) { - throw new UnsupportedOperationException(); - } - - public void removeValidationGroupPreRemove(String validationGroupPreRemoveClassName) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java deleted file mode 100644 index 0e3e95e81d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Access2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryAccess2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceAccess2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.Access - */ -public final class Access2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new Access2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private Access2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceAccess2_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullAccess2_0Annotation((JavaResourcePersistentMember) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryAccess2_0Annotation((JavaResourcePersistentMember) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return Access2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java deleted file mode 100644 index 12d1fe772f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverride2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryAssociationOverride2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceAssociationOverride2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.AssociationOverride - */ -public final class AssociationOverride2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new AssociationOverride2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private AssociationOverride2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return SourceAssociationOverride2_0Annotation.buildAssociationOverride((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryAssociationOverride2_0Annotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return AssociationOverrideAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java deleted file mode 100644 index 87eaa59f93..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/AssociationOverrides2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryAssociationOverrides2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceAssociationOverrides2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.AssociationOverrides - */ -public final class AssociationOverrides2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new AssociationOverrides2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private AssociationOverrides2_0AnnotationDefinition() { - super(); - } - - public AssociationOverridesAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceAssociationOverrides2_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public AssociationOverridesAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryAssociationOverrides2_0Annotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return AssociationOverridesAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java deleted file mode 100644 index 0e99636386..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/Cacheable2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryCacheable2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceCacheable2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.Cacheable - */ -public final class Cacheable2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new Cacheable2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private Cacheable2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceCacheable2_0Annotation((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryCacheable2_0Annotation((JavaResourcePersistentType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return Cacheable2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java deleted file mode 100644 index 34710f0028..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/CollectionTable2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryCollectionTable2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceCollectionTable2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.CollectionTable - */ -public final class CollectionTable2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new CollectionTable2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private CollectionTable2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceCollectionTable2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullCollectionTable2_0Annotation(parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryCollectionTable2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return CollectionTable2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java deleted file mode 100644 index 3d99fe6c92..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/ElementCollection2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryElementCollection2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceElementCollection2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.ElementCollection - */ -public final class ElementCollection2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new ElementCollection2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private ElementCollection2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceElementCollection2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryElementCollection2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ElementCollection2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java deleted file mode 100644 index 5b897d1620..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/GeneratedAnnotationDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryGeneratedAnnotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceGeneratedAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.annotation.Generated - *

- * This annotation definition is not really required; it's just here for a bit - * of consistency.... - */ -public final class GeneratedAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final GeneratedAnnotationDefinition INSTANCE = new GeneratedAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static GeneratedAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private GeneratedAnnotationDefinition() { - super(); - } - - public GeneratedAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceGeneratedAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public GeneratedAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public GeneratedAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryGeneratedAnnotation((JavaResourcePersistentType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return GeneratedAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java deleted file mode 100644 index 37b7e18382..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyClass2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyClass2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyClass2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyClass - */ -public final class MapKeyClass2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new MapKeyClass2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private MapKeyClass2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceMapKeyClass2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryMapKeyClass2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyClass2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java deleted file mode 100644 index 53a40c8fcf..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyColumn2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyColumn - */ -public final class MapKeyColumn2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new MapKeyColumn2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private MapKeyColumn2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceMapKeyColumn2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullMapKeyColumnAnnotation(parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryMapKeyColumn2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyColumn2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java deleted file mode 100644 index 6ba277bdc2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyEnumerated2_0AnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyEnumerated2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyEnumerated2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyTemporal - */ -public final class MapKeyEnumerated2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new MapKeyEnumerated2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private MapKeyEnumerated2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceMapKeyEnumerated2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullMapKeyEnumerated2_0Annotation((JavaResourcePersistentAttribute) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryMapKeyEnumerated2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyEnumerated2_0Annotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java deleted file mode 100644 index c943113e00..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumn2_0AnnotationDefinition.java +++ /dev/null @@ -1,60 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyJoinColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; - -/** - * javax.persistence.MapKeyJoinColumn - */ -public final class MapKeyJoinColumn2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new MapKeyJoinColumn2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private MapKeyJoinColumn2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return SourceMapKeyJoinColumn2_0Annotation.createMapKeyJoinColumn(parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryMapKeyJoinColumn2_0Annotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java deleted file mode 100644 index 23ddfdc204..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyJoinColumns2_0AnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyJoinColumns2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyJoinColumns - */ -public final class MapKeyJoinColumns2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new MapKeyJoinColumns2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private MapKeyJoinColumns2_0AnnotationDefinition() { - super(); - } - - public MapKeyJoinColumns2_0Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceMapKeyJoinColumns2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public MapKeyJoinColumns2_0Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryMapKeyJoinColumns2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyJoinColumns2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java deleted file mode 100644 index 4539b09588..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapKeyTemporal2_0AnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapKeyTemporal2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapKeyTemporal2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyTemporal - */ -public final class MapKeyTemporal2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new MapKeyTemporal2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private MapKeyTemporal2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceMapKeyTemporal2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullMapKeyTemporal2_0Annotation((JavaResourcePersistentAttribute) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryMapKeyTemporal2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyTemporal2_0Annotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java deleted file mode 100644 index a597251aee..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/MapsId2_0AnnotationDefinition.java +++ /dev/null @@ -1,65 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryMapsId2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceMapsId2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.MapsId - */ -public class MapsId2_0AnnotationDefinition implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new MapsId2_0AnnotationDefinition(); - - - /** - * Return the singleton - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - - /** - * Enforce singleton usage - */ - private MapsId2_0AnnotationDefinition() { - super(); - } - - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceMapsId2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullMapsId2_0Annotation((JavaResourcePersistentMember) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryMapsId2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapsId2_0Annotation.ANNOTATION_NAME; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java deleted file mode 100644 index 888cc8e2a8..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQueries2_0AnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryNamedQueries2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceNamedQueries2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation; - -/** - * javax.persistence.NamedQueries - */ -public class NamedQueries2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new NamedQueries2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private NamedQueries2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceNamedQueries2_0Annotation(parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryNamedQueries2_0Annotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return NamedQueriesAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java deleted file mode 100644 index 86ba2b97c6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NamedQuery2_0AnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryNamedQuery2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceNamedQuery2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation; - -/** - * javax.persistence.NamedQuery - */ -public class NamedQuery2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new NamedQuery2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private NamedQuery2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceNamedQuery2_0Annotation(parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryNamedQuery2_0Annotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return NamedQueryAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java deleted file mode 100644 index 2aa8b84300..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAccess2_0Annotation.java +++ /dev/null @@ -1,50 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AccessType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.Access - */ -public final class NullAccess2_0Annotation - extends NullAnnotation - implements Access2_0Annotation -{ - - protected NullAccess2_0Annotation(JavaResourcePersistentMember parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** value - public AccessType getValue() { - return null; - } - - public void setValue(AccessType value) { - if (value != null) { - this.addAnnotation().setValue(value); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java deleted file mode 100644 index 2393ed2dd2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullAssociationOverrideJoinTableAnnotation.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinTableAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; - -/** - * javax.persistence.JoinTable found in a - * javax.persistence.AssociationOverride annotation - */ -public final class NullAssociationOverrideJoinTableAnnotation - extends NullJoinTableAnnotation -{ - public NullAssociationOverrideJoinTableAnnotation(AssociationOverride2_0Annotation parent) { - super(parent); - } - - private AssociationOverride2_0Annotation getAssociationOverride2_0Annotation() { - return (AssociationOverride2_0Annotation) this.parent; - } - - @Override - protected JoinTableAnnotation addAnnotation() { - return this.getAssociationOverride2_0Annotation().addJoinTable(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java deleted file mode 100644 index eba00c41e3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullCollectionTable2_0Annotation.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import java.util.ListIterator; - -import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullBaseTableAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; - -/** - * javax.persistence.CollectionTable - */ -public final class NullCollectionTable2_0Annotation - extends NullBaseTableAnnotation - implements CollectionTable2_0Annotation -{ - public NullCollectionTable2_0Annotation(JavaResourceNode parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** join columns - public ListIterator joinColumns() { - return EmptyListIterator.instance(); - } - - public int joinColumnsSize() { - return 0; - } - - public JoinColumnAnnotation joinColumnAt(int index) { - return null; - } - - public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) { - throw new UnsupportedOperationException(); - } - - public JoinColumnAnnotation addJoinColumn(int index) { - // the CollectionTable annotation is missing, add both it and a join column at the same time - return this.addAnnotation().addJoinColumn(index); - } - - public void moveJoinColumn(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeJoinColumn(int index) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java deleted file mode 100644 index 6a4b869bbe..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyColumnAnnotation.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullBaseColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * javax.persistence.MapKeyColumn - */ -public final class NullMapKeyColumnAnnotation - extends NullBaseColumnAnnotation - implements MapKeyColumn2_0Annotation -{ - public NullMapKeyColumnAnnotation(JavaResourceNode parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** length - public Integer getLength() { - return null; - } - - public void setLength(Integer length) { - if (length != null) { - this.addAnnotation().setLength(length); - } - } - - public TextRange getLengthTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** scale - public Integer getScale() { - return null; - } - - public void setScale(Integer scale) { - if (scale != null) { - this.addAnnotation().setScale(scale); - } - } - - public TextRange getScaleTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** precision - public Integer getPrecision() { - return null; - } - - public void setPrecision(Integer precision) { - if (precision != null) { - this.addAnnotation().setPrecision(precision); - } - } - - public TextRange getPrecisionTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java deleted file mode 100644 index c9eaf62795..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyEnumerated2_0Annotation.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.EnumType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyEnumerated - */ -public final class NullMapKeyEnumerated2_0Annotation - extends NullAnnotation - implements MapKeyEnumerated2_0Annotation -{ - protected NullMapKeyEnumerated2_0Annotation(JavaResourcePersistentAttribute parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** value - public EnumType getValue() { - return null; - } - - public void setValue(EnumType value) { - if (value != null) { - this.addAnnotation().setValue(value); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java deleted file mode 100644 index 2a8a676aba..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapKeyTemporal2_0Annotation.java +++ /dev/null @@ -1,48 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.TemporalType; - -/** - * javax.persistence.MapKeyTemporal - */ -public final class NullMapKeyTemporal2_0Annotation - extends NullAnnotation - implements MapKeyTemporal2_0Annotation -{ - protected NullMapKeyTemporal2_0Annotation(JavaResourcePersistentAttribute parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** value - public TemporalType getValue() { - return null; - } - - public void setValue(TemporalType value) { - if (value != null) { - this.addAnnotation().setValue(value); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java deleted file mode 100644 index 0dcf181809..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullMapsId2_0Annotation.java +++ /dev/null @@ -1,51 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.MapsId - */ -public final class NullMapsId2_0Annotation - extends NullAnnotation - implements MapsId2_0Annotation -{ - protected NullMapsId2_0Annotation(JavaResourcePersistentMember parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** value - public String getValue() { - return null; - } - - public void setValue(String newValue) { - if (newValue != null) { - this.addAnnotation().setValue(newValue); - } - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return null; - } - - public boolean valueTouches(int pos, CompilationUnit astRoot) { - return false; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java deleted file mode 100644 index ca2a7b5123..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/NullOrderColumn2_0Annotation.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullNamedColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.OrderColumn - */ -public final class NullOrderColumn2_0Annotation - extends NullNamedColumnAnnotation - implements OrderColumn2_0Annotation -{ - public NullOrderColumn2_0Annotation(JavaResourcePersistentAttribute parent) { - super(parent); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ***** updatable - public Boolean getUpdatable() { - return null; - } - - public void setUpdatable(Boolean updatable) { - if (updatable != null) { - this.addAnnotation().setUpdatable(updatable); - } - } - - public TextRange getUpdatableTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** insertable - public Boolean getInsertable() { - return null; - } - - public void setInsertable(Boolean insertable) { - if (insertable != null) { - this.addAnnotation().setInsertable(insertable); - } - } - - public TextRange getInsertableTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** nullable - public Boolean getNullable() { - return null; - } - - public void setNullable(Boolean nullable) { - if (nullable != null) { - this.addAnnotation().setNullable(nullable); - } - } - - public TextRange getNullableTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java deleted file mode 100644 index 91ff5ae6fc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/OrderColumn2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryOrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceOrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.OrderColumn - */ -public final class OrderColumn2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new OrderColumn2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private OrderColumn2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceOrderColumn2_0Annotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullOrderColumn2_0Annotation((JavaResourcePersistentAttribute) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryOrderColumn2_0Annotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return OrderColumn2_0Annotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java deleted file mode 100644 index 513678f78d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SequenceGenerator2_0AnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinarySequenceGenerator2_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceSequenceGenerator2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.core.resource.java.SequenceGeneratorAnnotation; - -/** - * javax.persistence.SequenceGenerator - */ -public final class SequenceGenerator2_0AnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new SequenceGenerator2_0AnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private SequenceGenerator2_0AnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceSequenceGenerator2_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinarySequenceGenerator2_0Annotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return SequenceGeneratorAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java deleted file mode 100644 index 1d1d2289a2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumn2_0Annotation.java +++ /dev/null @@ -1,111 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * javax.persistence.MapKeyJoinColumn - */ -public final class SourceMapKeyJoinColumn2_0Annotation - extends SourceBaseJoinColumnAnnotation - implements NestableMapKeyJoinColumnAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - - public SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, attribute, daa, annotationAdapter); - } - - public SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, Attribute attribute, DeclarationAnnotationAdapter daa) { - this(parent, attribute, daa, new ElementAnnotationAdapter(attribute, daa)); - } - - public SourceMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, Attribute attribute, IndexedDeclarationAnnotationAdapter idaa) { - this(parent, attribute, idaa, new ElementIndexedAnnotationAdapter(attribute, idaa)); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - // ********** SourceNamedColumnAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__NAME; - } - - @Override - protected String getColumnDefinitionElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__COLUMN_DEFINITION; - } - - - // ********** SourceBaseColumnAnnotation implementation ********** - - @Override - protected String getTableElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__TABLE; - } - - @Override - protected String getUniqueElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__UNIQUE; - } - - @Override - protected String getNullableElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__NULLABLE; - } - - @Override - protected String getInsertableElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__INSERTABLE; - } - - @Override - protected String getUpdatableElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__UPDATABLE; - } - - - // ********** SourceBaseJoinColumnAnnotation implementation ********** - - @Override - protected String getReferencedColumnNameElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME; - } - - - // ********** static methods ********** - - public static SourceMapKeyJoinColumn2_0Annotation createMapKeyJoinColumn(JavaResourceNode parent, Attribute attribute) { - return new SourceMapKeyJoinColumn2_0Annotation(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - static SourceMapKeyJoinColumn2_0Annotation createNestedMapKeyJoinColumn(JavaResourceNode parent, Attribute attribute, int index, DeclarationAnnotationAdapter joinColumnsAdapter) { - IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, joinColumnsAdapter, ANNOTATION_NAME); - IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(attribute, idaa); - return new SourceMapKeyJoinColumn2_0Annotation(parent, attribute, idaa, annotationAdapter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java deleted file mode 100644 index c538288cb1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/SourceMapKeyJoinColumns2_0Annotation.java +++ /dev/null @@ -1,137 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import java.util.Vector; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.AnnotationContainerTools; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.NestableAnnotation; - -/** - * javax.persistence.MapKeyJoinColumns - */ -public final class SourceMapKeyJoinColumns2_0Annotation - extends SourceAnnotation - implements MapKeyJoinColumns2_0Annotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private final Vector mapKeyJoinColumns = new Vector(); - - - public SourceMapKeyJoinColumns2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - AnnotationContainerTools.initialize(this, astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - AnnotationContainerTools.synchronize(this, astRoot); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - this.mapKeyJoinColumns.isEmpty(); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.mapKeyJoinColumns); - } - - - // ********** AnnotationContainer implementation ********** - - public String getElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMNS__VALUE; - } - - public String getNestedAnnotationName() { - return MapKeyJoinColumn2_0Annotation.ANNOTATION_NAME; - } - - public Iterable getNestedAnnotations() { - return new LiveCloneIterable(this.mapKeyJoinColumns); - } - - public int getNestedAnnotationsSize() { - return this.mapKeyJoinColumns.size(); - } - - public void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation) { - this.nestStandAloneAnnotation(standAloneAnnotation, this.mapKeyJoinColumns.size()); - } - - private void nestStandAloneAnnotation(NestableAnnotation standAloneAnnotation, int index) { - standAloneAnnotation.convertToNested(this, this.daa, index); - } - - public void addNestedAnnotation(int index, NestableAnnotation annotation) { - this.mapKeyJoinColumns.add(index, (NestableMapKeyJoinColumnAnnotation) annotation); - } - - public void convertLastNestedAnnotationToStandAlone() { - this.mapKeyJoinColumns.remove(0).convertToStandAlone(); - } - - public NestableMapKeyJoinColumnAnnotation addNestedAnnotation() { - return this.addNestedAnnotation(this.mapKeyJoinColumns.size()); - } - - private NestableMapKeyJoinColumnAnnotation addNestedAnnotation(int index) { - NestableMapKeyJoinColumnAnnotation joinColumn = this.buildMapKeyJoinColumn(index); - this.mapKeyJoinColumns.add(index, joinColumn); - return joinColumn; - } - - public void syncAddNestedAnnotation(Annotation astAnnotation) { - int index = this.mapKeyJoinColumns.size(); - NestableMapKeyJoinColumnAnnotation joinColumn = this.addNestedAnnotation(index); - joinColumn.initialize((CompilationUnit) astAnnotation.getRoot()); - this.fireItemAdded(MAP_KEY_JOIN_COLUMNS_LIST, index, joinColumn); - } - - private NestableMapKeyJoinColumnAnnotation buildMapKeyJoinColumn(int index) { - // pass the Java resource persistent member as the nested annotation's parent - // since the nested annotation can be converted to stand-alone - return SourceMapKeyJoinColumn2_0Annotation.createNestedMapKeyJoinColumn(this.parent, this.annotatedElement, index, this.daa); - } - - public NestableMapKeyJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) { - return CollectionTools.move(this.mapKeyJoinColumns, targetIndex, sourceIndex).get(targetIndex); - } - - public NestableMapKeyJoinColumnAnnotation removeNestedAnnotation(int index) { - return this.mapKeyJoinColumns.remove(index); - } - - public void syncRemoveNestedAnnotations(int index) { - this.removeItemsFromList(index, this.mapKeyJoinColumns, MAP_KEY_JOIN_COLUMNS_LIST); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java deleted file mode 100644 index b88a0b18bc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/StaticMetamodelAnnotationDefinition.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary.BinaryStaticMetamodelAnnotation; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source.SourceStaticMetamodelAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.metamodel.StaticMetamodel - *

- * Pre-condition: The annotation's parent must be a persistent member - * (type or attribute). - */ - @SuppressWarnings("unchecked") - protected A addAnnotation() { - return (A) this.addAnnotation_(); - } - - protected Annotation addAnnotation_() { - return this.getMember().addAnnotation(this.getAnnotationName()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java deleted file mode 100644 index 8271825126..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAttributeOverrideColumnAnnotation.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation; - -/** - * javax.persistence.Column - */ -public final class NullAttributeOverrideColumnAnnotation - extends NullColumnAnnotation -{ - public NullAttributeOverrideColumnAnnotation(AttributeOverrideAnnotation parent) { - super(parent); - } - - private AttributeOverrideAnnotation getAttributeOverrideAnnotation() { - return (AttributeOverrideAnnotation) this.parent; - } - - @Override - protected ColumnAnnotation addAnnotation() { - return this.getAttributeOverrideAnnotation().addColumn(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java deleted file mode 100644 index 44696dab1c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseColumnAnnotation.java +++ /dev/null @@ -1,110 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.resource.java.BaseColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - *

- */ -public abstract class NullBaseColumnAnnotation - extends NullNamedColumnAnnotation - implements BaseColumnAnnotation -{ - protected NullBaseColumnAnnotation(JavaResourceNode parent) { - super(parent); - } - - // ***** table - public String getTable() { - return null; - } - - public void setTable(String table) { - if (table != null) { - this.addAnnotation().setTable(table); - } - } - - public TextRange getTableTextRange(CompilationUnit astRoot) { - return null; - } - - public boolean tableTouches(int pos, CompilationUnit astRoot) { - return false; - } - - // ***** unique - public Boolean getUnique() { - return null; - } - - public void setUnique(Boolean unique) { - if (unique != null) { - this.addAnnotation().setUnique(unique); - } - } - - public TextRange getUniqueTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** updatable - public Boolean getUpdatable() { - return null; - } - - public void setUpdatable(Boolean updatable) { - if (updatable != null) { - this.addAnnotation().setUpdatable(updatable); - } - } - - public TextRange getUpdatableTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** insertable - public Boolean getInsertable() { - return null; - } - - public void setInsertable(Boolean insertable) { - if (insertable != null) { - this.addAnnotation().setInsertable(insertable); - } - } - - public TextRange getInsertableTextRange(CompilationUnit astRoot) { - return null; - } - - // ***** nullable - public Boolean getNullable() { - return null; - } - - public void setNullable(Boolean nullable) { - if (nullable != null) { - this.addAnnotation().setNullable(nullable); - } - } - - public TextRange getNullableTextRange(CompilationUnit astRoot) { - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java deleted file mode 100644 index 931b3cd56a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullBaseTableAnnotation.java +++ /dev/null @@ -1,124 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import java.util.ListIterator; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyListIterator; -import org.eclipse.jpt.jpa.core.resource.java.BaseTableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.UniqueConstraintAnnotation; - -/** - *

- * This annotation definition is not really required; it's just here for a bit - * of consistency.... - */ -public final class StaticMetamodelAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final StaticMetamodelAnnotationDefinition INSTANCE = new StaticMetamodelAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static StaticMetamodelAnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private StaticMetamodelAnnotationDefinition() { - super(); - } - - public StaticMetamodelAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceStaticMetamodelAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public StaticMetamodelAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public StaticMetamodelAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryStaticMetamodelAnnotation((JavaResourcePersistentType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return StaticMetamodelAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java deleted file mode 100644 index ee01d96507..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAccess2_0Annotation.java +++ /dev/null @@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.AccessType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.Access - */ -public final class BinaryAccess2_0Annotation - extends BinaryAnnotation - implements Access2_0Annotation -{ - private AccessType value; - - - public BinaryAccess2_0Annotation(JavaResourcePersistentMember parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** AccessAnnotation implementation ********** - - // ***** value - public AccessType getValue() { - return this.value; - } - - public void setValue(AccessType value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(AccessType value) { - AccessType old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private AccessType buildValue() { - return AccessType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA2_0.ACCESS)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java deleted file mode 100644 index eb213548d2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverride2_0Annotation.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.NullJoinTableAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAssociationOverrideAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinTableAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; - -/** - * BinarySequenceGenerator2_0Annotation - */ -public final class BinaryAssociationOverride2_0Annotation - extends BinaryAssociationOverrideAnnotation - implements AssociationOverride2_0Annotation -{ - private JoinTableAnnotation joinTable; - private final JoinTableAnnotation nullJoinTable; - - public BinaryAssociationOverride2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.joinTable = this.buildJoinTable(); - this.nullJoinTable = this.buildNullJoinTable(); - } - - @Override - public void update() { - super.update(); - this.updateJoinTable(); - } - - - // ********** AssociationOverride2_0Annotation implementation ********** - - // ***** joinTable - public JoinTableAnnotation getJoinTable() { - return this.joinTable; - } - - public JoinTableAnnotation getNonNullJoinTable() { - return (this.joinTable != null) ? this.joinTable : this.nullJoinTable; - } - - public JoinTableAnnotation addJoinTable() { - throw new UnsupportedOperationException(); - } - - public void removeJoinTable() { - throw new UnsupportedOperationException(); - } - - private JoinTableAnnotation buildJoinTable() { - IAnnotation jdtJoinTable = this.getJdtJoinTable(); - return (jdtJoinTable == null) ? null : this.buildJoinTable(jdtJoinTable); - } - - private JoinTableAnnotation buildNullJoinTable() { - return new NullJoinTableAnnotation(this); - } - - private JoinTableAnnotation buildJoinTable(IAnnotation jdtJoinTable) { - return new BinaryJoinTableAnnotation(this, jdtJoinTable); - } - - private IAnnotation getJdtJoinTable() { - return (IAnnotation) this.getJdtMemberValue(JPA2_0.ASSOCIATION_OVERRIDE__JOIN_TABLE); - } - - // TODO - private void updateJoinTable() { - throw new UnsupportedOperationException(); -// IAnnotation jdtJoinTable = this.getJdtJoinTable(); -// if (jdtJoinTable == null) { -// this.setJoinTable(null); -// } else { -// if (this.column == null) { -// this.setJoinTable(this.buildJoinTable(jdtJoinTable)); -// } else { -// this.column.update(jdtJoinTable); -// } -// } - } - -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java deleted file mode 100644 index e2877de83d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryAssociationOverrides2_0Annotation.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAssociationOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation; - -/** - * javax.persistence.AssociationOverrides - */ -public class BinaryAssociationOverrides2_0Annotation - extends BinaryAssociationOverridesAnnotation -{ - - public BinaryAssociationOverrides2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - @Override - protected NestableAssociationOverrideAnnotation buildAssociationOverride(Object jdtAssociationOverride) { - return new BinaryAssociationOverride2_0Annotation(this, (IAnnotation) jdtAssociationOverride); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java deleted file mode 100644 index 3702c2ec5f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCacheable2_0Annotation.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.Cacheable - */ -public final class BinaryCacheable2_0Annotation - extends BinaryAnnotation - implements Cacheable2_0Annotation -{ - private Boolean value; - - - public BinaryCacheable2_0Annotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** Cacheable2_0Annotation implementation ********** - - // ***** value - public Boolean getValue() { - return this.value; - } - - public void setValue(Boolean value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(Boolean value) { - Boolean old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private Boolean buildValue() { - return (Boolean) this.getJdtMemberValue(JPA2_0.CACHEABLE__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java deleted file mode 100644 index 324ac63515..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryCollectionTable2_0Annotation.java +++ /dev/null @@ -1,118 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseTableAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; - -/** - * javax.persistence.CollectionTable - */ -public final class BinaryCollectionTable2_0Annotation - extends BinaryBaseTableAnnotation - implements CollectionTable2_0Annotation -{ - private final Vector joinColumns; - - - public BinaryCollectionTable2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.joinColumns = this.buildJoinColumns(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.updateJoinColumns(); - } - - - // ********** BinaryBaseTableAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA2_0.COLLECTION_TABLE__NAME; - } - - @Override - protected String getSchemaElementName() { - return JPA2_0.COLLECTION_TABLE__SCHEMA; - } - - @Override - protected String getCatalogElementName() { - return JPA2_0.COLLECTION_TABLE__CATALOG; - } - - @Override - protected String getUniqueConstraintElementName() { - return JPA2_0.COLLECTION_TABLE__UNIQUE_CONSTRAINTS; - } - - - // ********** CollectionTable2_0Annotation implementation ********** - - // ***** join columns - public ListIterator joinColumns() { - return new CloneListIterator(this.joinColumns); - } - - public int joinColumnsSize() { - return this.joinColumns.size(); - } - - public JoinColumnAnnotation joinColumnAt(int index) { - return this.joinColumns.get(index); - } - - public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) { - return this.joinColumns.indexOf(joinColumn); - } - - public JoinColumnAnnotation addJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - public void moveJoinColumn(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeJoinColumn(int index) { - throw new UnsupportedOperationException(); - } - - private Vector buildJoinColumns() { - Object[] jdtJoinColumns = this.getJdtMemberValues(JPA2_0.COLLECTION_TABLE__JOIN_COLUMNS); - Vector result = new Vector(jdtJoinColumns.length); - for (Object jdtJoinColumn : jdtJoinColumns) { - result.add(new BinaryJoinColumnAnnotation(this, (IAnnotation) jdtJoinColumn)); - } - return result; - } - - // TODO - private void updateJoinColumns() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java deleted file mode 100644 index b4774b3c3c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryElementCollection2_0Annotation.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.FetchType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * org.eclipse.persistence.annotations.Transformation - */ -public class BinaryElementCollection2_0Annotation - extends BinaryAnnotation - implements ElementCollection2_0Annotation -{ - private String targetClass; - private FetchType fetch; - - - public BinaryElementCollection2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.targetClass = this.buildTargetClass(); - this.fetch = this.buildFetch(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setTargetClass_(this.buildTargetClass()); - this.setFetch_(this.buildFetch()); - } - - - // ********** ElementCollection2_0Annotation implementation ********** - - // ***** target entity - public String getTargetClass() { - return this.targetClass; - } - - public void setTargetClass(String targetClass) { - throw new UnsupportedOperationException(); - } - - private void setTargetClass_(String targetClass) { - String old = this.targetClass; - this.targetClass = targetClass; - this.firePropertyChanged(TARGET_CLASS_PROPERTY, old, targetClass); - } - - private String buildTargetClass() { - return (String) this.getJdtMemberValue(JPA2_0.ELEMENT_COLLECTION__TARGET_CLASS); - } - - public TextRange getTargetClassTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified target entity class name - public String getFullyQualifiedTargetClassName() { - return this.targetClass; - } - - // ***** fetch - public FetchType getFetch() { - return this.fetch; - } - - public void setFetch(FetchType fetch) { - throw new UnsupportedOperationException(); - } - - private void setFetch_(FetchType fetch) { - FetchType old = this.fetch; - this.fetch = fetch; - this.firePropertyChanged(FETCH_PROPERTY, old, fetch); - } - - private FetchType buildFetch() { - return FetchType.fromJavaAnnotationValue(this.getJdtMemberValue(JPA2_0.ELEMENT_COLLECTION__FETCH)); - } - - public TextRange getFetchTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java deleted file mode 100644 index 798b809e9e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryGeneratedAnnotation.java +++ /dev/null @@ -1,140 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.annotation.Generated - */ -public final class BinaryGeneratedAnnotation - extends BinaryAnnotation - implements GeneratedAnnotation -{ - private final Vector values; - private String date; - private String comments; - - - public BinaryGeneratedAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.values = this.buildValues(); - this.date = this.buildDate(); - this.comments = this.buildComments(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.updateValues(); - this.setDate_(this.buildDate()); - this.setComments_(this.buildComments()); - } - - // TODO - private void updateValues() { - throw new UnsupportedOperationException(); - } - - - // ********** GeneratedAnnotation implementation ********** - - // ***** values - public ListIterator values() { - return new CloneListIterator(this.values); - } - - public int valuesSize() { - return this.values.size(); - } - - public String getValue(int index) { - return this.values.get(index); - } - - private Vector buildValues() { - Object[] jdtValues = this.getJdtMemberValues(VALUE_ELEMENT_NAME); - Vector result = new Vector(jdtValues.length); - for (Object value : jdtValues) { - result.add((String) value); - } - return result; - } - - public void addValue(String value) { - throw new UnsupportedOperationException(); - } - - public void addValue(int index, String value) { - throw new UnsupportedOperationException(); - } - - public void moveValue(int targetIndex, int sourceIndex) { - throw new UnsupportedOperationException(); - } - - public void removeValue(String value) { - throw new UnsupportedOperationException(); - } - - public void removeValue(int index) { - throw new UnsupportedOperationException(); - } - - // ***** date - public String getDate() { - return this.date; - } - - public void setDate(String date) { - throw new UnsupportedOperationException(); - } - - private void setDate_(String date) { - String old = this.date; - this.date = date; - this.firePropertyChanged(DATE_PROPERTY, old, date); - } - - private String buildDate() { - return (String) this.getJdtMemberValue(DATE_ELEMENT_NAME); - } - - // ***** comments - public String getComments() { - return this.comments; - } - - public void setComments(String comments) { - throw new UnsupportedOperationException(); - } - - private void setComments_(String comments) { - String old = this.comments; - this.comments = comments; - this.firePropertyChanged(COMMENTS_PROPERTY, old, comments); - } - - private String buildComments() { - return (String) this.getJdtMemberValue(COMMENTS_ELEMENT_NAME); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java deleted file mode 100644 index e20a405b5c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyClass2_0Annotation.java +++ /dev/null @@ -1,79 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyClass - */ -public final class BinaryMapKeyClass2_0Annotation - extends BinaryAnnotation - implements MapKeyClass2_0Annotation -{ - private String value; - - - public BinaryMapKeyClass2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** MapKeyClass2_0Annotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JPA2_0.MAP_KEY_CLASS__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** fully-qualified class name - /** - * binary is already fully-qualified - */ - public String getFullyQualifiedClassName() { - return this.value; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java deleted file mode 100644 index f2a2415614..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyColumn2_0Annotation.java +++ /dev/null @@ -1,92 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryCompleteColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyColumn - */ -public final class BinaryMapKeyColumn2_0Annotation - extends BinaryCompleteColumnAnnotation - implements MapKeyColumn2_0Annotation -{ - - public BinaryMapKeyColumn2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - // ********** BinaryNamedColumnAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA2_0.MAP_KEY_COLUMN__NAME; - } - - @Override - protected String getColumnDefinitionElementName() { - return JPA2_0.MAP_KEY_COLUMN__COLUMN_DEFINITION; - } - - - // ********** BinaryBaseColumnAnnotation implementation ********** - - @Override - protected String getTableElementName() { - return JPA2_0.MAP_KEY_COLUMN__TABLE; - } - - @Override - protected String getUniqueElementName() { - return JPA2_0.MAP_KEY_COLUMN__UNIQUE; - } - - @Override - protected String getNullableElementName() { - return JPA2_0.MAP_KEY_COLUMN__NULLABLE; - } - - @Override - protected String getInsertableElementName() { - return JPA2_0.MAP_KEY_COLUMN__INSERTABLE; - } - - @Override - protected String getUpdatableElementName() { - return JPA2_0.MAP_KEY_COLUMN__UPDATABLE; - } - - - // ********** BinaryCompleteColumnAnnotation implementation ********** - - @Override - protected String getLengthElementName() { - return JPA2_0.MAP_KEY_COLUMN__LENGTH; - } - - @Override - protected String getPrecisionElementName() { - return JPA2_0.MAP_KEY_COLUMN__PRECISION; - } - - @Override - protected String getScaleElementName() { - return JPA2_0.MAP_KEY_COLUMN__SCALE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java deleted file mode 100644 index 39f3229e74..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyEnumerated2_0Annotation.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseEnumeratedAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyEnumerated - */ -public final class BinaryMapKeyEnumerated2_0Annotation - extends BinaryBaseEnumeratedAnnotation - implements MapKeyEnumerated2_0Annotation -{ - - public BinaryMapKeyEnumerated2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyEnumerated2_0Annotation.ANNOTATION_NAME; - } - - @Override - protected String getValueElementName() { - return JPA2_0.MAP_KEY_ENUMERATED__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java deleted file mode 100644 index c4d25d3ed2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumn2_0Annotation.java +++ /dev/null @@ -1,83 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * javax.persistence.MapKeyJoinColumn - */ -public final class BinaryMapKeyJoinColumn2_0Annotation - extends BinaryBaseJoinColumnAnnotation - implements NestableMapKeyJoinColumnAnnotation -{ - - public BinaryMapKeyJoinColumn2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - // ********** BinaryNamedColumnAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__NAME; - } - - @Override - protected String getColumnDefinitionElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__COLUMN_DEFINITION; - } - - - // ********** BinaryBaseColumnAnnotation implementation ********** - - @Override - protected String getTableElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__TABLE; - } - - @Override - protected String getUniqueElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__UNIQUE; - } - - @Override - protected String getNullableElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__NULLABLE; - } - - @Override - protected String getInsertableElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__INSERTABLE; - } - - @Override - protected String getUpdatableElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__UPDATABLE; - } - - - // ********** BinaryBaseJoinColumnAnnotation implementation ********** - - @Override - protected String getReferencedColumnNameElementName() { - return JPA2_0.MAP_KEY_JOIN_COLUMN__REFERENCED_COLUMN_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java deleted file mode 100644 index 2622efab7c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyJoinColumns2_0Annotation.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import java.util.Vector; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryContainerAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyJoinColumns2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.NestableMapKeyJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyJoinColumns - */ -public final class BinaryMapKeyJoinColumns2_0Annotation - extends BinaryContainerAnnotation - implements MapKeyJoinColumns2_0Annotation -{ - private final Vector mapKeyJoinColumns; - - - public BinaryMapKeyJoinColumns2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.mapKeyJoinColumns = this.buildMapKeyJoinColumns(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public Iterable getNestedAnnotations() { - return new LiveCloneIterable(this.mapKeyJoinColumns); - } - - public int getNestedAnnotationsSize() { - return this.mapKeyJoinColumns.size(); - } - - private Vector buildMapKeyJoinColumns() { - Object[] jdtMapKeyJoinColumns = this.getJdtMemberValues(JPA2_0.MAP_KEY_JOIN_COLUMNS__VALUE); - Vector result = new Vector(jdtMapKeyJoinColumns.length); - for (Object jdtMapKeyJoinColumn : jdtMapKeyJoinColumns) { - result.add(new BinaryMapKeyJoinColumn2_0Annotation(this, (IAnnotation) jdtMapKeyJoinColumn)); - } - return result; - } - - @Override - public void update() { - super.update(); - this.updateMapKeyJoinColumns(); - } - - // TODO - private void updateMapKeyJoinColumns() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java deleted file mode 100644 index 1c5b97b821..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapKeyTemporal2_0Annotation.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBaseTemporalAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyTemporal - */ -public final class BinaryMapKeyTemporal2_0Annotation - extends BinaryBaseTemporalAnnotation - implements MapKeyTemporal2_0Annotation -{ - - public BinaryMapKeyTemporal2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyTemporal2_0Annotation.ANNOTATION_NAME; - } - - @Override - protected String getValueElementName() { - return JPA2_0.MAP_KEY_TEMPORAL__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java deleted file mode 100644 index c7d7e03c05..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryMapsId2_0Annotation.java +++ /dev/null @@ -1,80 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapsId - */ -public class BinaryMapsId2_0Annotation - extends BinaryAnnotation - implements MapsId2_0Annotation -{ - private String value; - - - public BinaryMapsId2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** MapsId2_0Annotation implementation ********** - - public String getValue() { - return this.value; - } - - public void setValue(String newValue) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String newValue) { - String oldValue = this.value; - this.value = newValue; - this.firePropertyChanged(VALUE_PROPERTY, oldValue, newValue); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JPA2_0.MAPS_ID__VALUE); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean valueTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java deleted file mode 100644 index b6270a6eb5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQueries2_0Annotation.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedQueriesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation; - -/** - * javax.persistence.NamedQueries - */ -public final class BinaryNamedQueries2_0Annotation - extends BinaryNamedQueriesAnnotation -{ - public BinaryNamedQueries2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - } - - @Override - protected NestableNamedQueryAnnotation buildNamedQuery(Object jdtQuery) { - return new BinaryNamedQuery2_0Annotation(this, (IAnnotation) jdtQuery); - } - -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java deleted file mode 100644 index 83e2f3e112..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryNamedQuery2_0Annotation.java +++ /dev/null @@ -1,69 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedQueryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * BinaryNamedQuery2_0Annotation - */ -public final class BinaryNamedQuery2_0Annotation - extends BinaryNamedQueryAnnotation - implements NamedQuery2_0Annotation -{ - private LockModeType_2_0 lockMode; - - public BinaryNamedQuery2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.lockMode = this.buildLockMode(); - } - - @Override - public void update() { - super.update(); - this.setLockMode_(this.buildLockMode()); - } - - // ********** NamedQuery2_0Annotation implementation ********** - - public LockModeType_2_0 getLockMode() { - return this.lockMode; - } - - public void setLockMode(LockModeType_2_0 lockMode) { - throw new UnsupportedOperationException(); - } - - private void setLockMode_(LockModeType_2_0 lockMode) { - LockModeType_2_0 old = this.lockMode; - this.lockMode = lockMode; - this.firePropertyChanged(LOCK_MODE_PROPERTY, old, lockMode); - } - - public TextRange getLockModeTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean lockModeTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - private LockModeType_2_0 buildLockMode() { - return LockModeType_2_0.fromJavaAnnotationValue(this.getJdtMemberValue(JPA2_0.NAMED_QUERY__LOCK_MODE)); - } - -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java deleted file mode 100644 index 446297a6a6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryOrderColumn2_0Annotation.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JPA; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.OrderColumn - */ -public class BinaryOrderColumn2_0Annotation - extends BinaryNamedColumnAnnotation - implements OrderColumn2_0Annotation -{ - private Boolean nullable; - private Boolean insertable; - private Boolean updatable; - - - public BinaryOrderColumn2_0Annotation(JavaResourcePersistentAttribute parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.nullable = this.buildNullable(); - this.insertable = this.buildInsertable(); - this.updatable = this.buildUpdatable(); - } - - @Override - public void update() { - super.update(); - this.setNullable_(this.buildNullable()); - this.setInsertable_(this.buildInsertable()); - this.setUpdatable_(this.buildUpdatable()); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - - //************* BinaryNamedColumnAnnotation implementation ************* - - @Override - protected String getColumnDefinitionElementName() { - return JPA.COLUMN__COLUMN_DEFINITION; - } - - @Override - protected String getNameElementName() { - return JPA.COLUMN__NAME; - } - - //************* OrderColumn2_0Annotation implementation ************* - - // ***** nullable - public Boolean getNullable() { - return this.nullable; - } - - public void setNullable(Boolean nullable) { - throw new UnsupportedOperationException(); - } - - private void setNullable_(Boolean nullable) { - Boolean old = this.nullable; - this.nullable = nullable; - this.firePropertyChanged(NULLABLE_PROPERTY, old, nullable); - } - - private Boolean buildNullable() { - return (Boolean) this.getJdtMemberValue(getNullableElementName()); - } - - String getNullableElementName() { - return JPA.COLUMN__NULLABLE; - } - - public TextRange getNullableTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** insertable - public Boolean getInsertable() { - return this.insertable; - } - - public void setInsertable(Boolean insertable) { - throw new UnsupportedOperationException(); - } - - private void setInsertable_(Boolean insertable) { - Boolean old = this.insertable; - this.insertable = insertable; - this.firePropertyChanged(INSERTABLE_PROPERTY, old, insertable); - } - - private Boolean buildInsertable() { - return (Boolean) this.getJdtMemberValue(this.getInsertableElementName()); - } - - String getInsertableElementName() { - return JPA.COLUMN__INSERTABLE; - } - - public TextRange getInsertableTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ***** updatable - public Boolean getUpdatable() { - return this.updatable; - } - - public void setUpdatable(Boolean updatable) { - throw new UnsupportedOperationException(); - } - - private void setUpdatable_(Boolean updatable) { - Boolean old = this.updatable; - this.updatable = updatable; - this.firePropertyChanged(UPDATABLE_PROPERTY, old, updatable); - } - - private Boolean buildUpdatable() { - return (Boolean) this.getJdtMemberValue(this.getUpdatableElementName()); - } - - String getUpdatableElementName() { - return JPA.COLUMN__UPDATABLE; - } - - public TextRange getUpdatableTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java deleted file mode 100644 index b9b94ad58d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinarySequenceGenerator2_0Annotation.java +++ /dev/null @@ -1,102 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinarySequenceGeneratorAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * BinarySequenceGenerator2_0Annotation - */ -public final class BinarySequenceGenerator2_0Annotation - extends BinarySequenceGeneratorAnnotation - implements SequenceGenerator2_0Annotation -{ - private String catalog; - private String schema; - - - public BinarySequenceGenerator2_0Annotation(JavaResourceNode parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.catalog = this.buildCatalog(); - this.schema = this.buildSchema(); - } - - @Override - public void update() { - super.update(); - this.setCatalog_(this.buildCatalog()); - this.setSchema_(this.buildSchema()); - } - - // ********** SequenceGenerator2_0Annotation implementation ********** - - // ********** catalog ********** - - public String getCatalog() { - return this.catalog; - } - - public void setCatalog(String catalog) { - throw new UnsupportedOperationException(); - } - - private void setCatalog_(String catalog) { - String old = this.catalog; - this.catalog = catalog; - this.firePropertyChanged(CATALOG_PROPERTY, old, catalog); - } - - private String buildCatalog() { - return (String) this.getJdtMemberValue(JPA2_0.SEQUENCE_GENERATOR__CATALOG); - } - - public TextRange getCatalogTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean catalogTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - // ********** schema ********** - - public String getSchema() { - return this.schema; - } - - public void setSchema(String schema) { - throw new UnsupportedOperationException(); - } - - private void setSchema_(String schema) { - String old = this.schema; - this.schema = schema; - this.firePropertyChanged(SCHEMA_PROPERTY, old, schema); - } - - private String buildSchema() { - return (String) this.getJdtMemberValue(JPA2_0.SEQUENCE_GENERATOR__SCHEMA); - } - - public TextRange getSchemaTextRange(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - public boolean schemaTouches(int pos, CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java deleted file mode 100644 index 3f30009013..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/binary/BinaryStaticMetamodelAnnotation.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.binary; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.metamodel.StaticMetamodel - */ -public final class BinaryStaticMetamodelAnnotation - extends BinaryAnnotation - implements StaticMetamodelAnnotation -{ - private String value; - - - public BinaryStaticMetamodelAnnotation(JavaResourcePersistentType parent, IAnnotation jdtAnnotation) { - super(parent, jdtAnnotation); - this.value = this.buildValue(); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void update() { - super.update(); - this.setValue_(this.buildValue()); - } - - - // ********** StaticMetamodelAnnotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - throw new UnsupportedOperationException(); - } - - private void setValue_(String value) { - String old = this.value; - this.value = value; - this.firePropertyChanged(VALUE_PROPERTY, old, value); - } - - private String buildValue() { - return (String) this.getJdtMemberValue(JPA2_0.STATIC_METAMODEL__VALUE); - } - - // ***** fully-qualified class name - /** - * binary is already fully-qualified - */ - public String getFullyQualifiedClassName() { - return this.value; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java deleted file mode 100644 index 4b8790b08b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAccess2_0Annotation.java +++ /dev/null @@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Access2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.AccessType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.Access - */ -public final class SourceAccess2_0Annotation - extends SourceAnnotation - implements Access2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter valueAdapter; - private AccessType value; - - - public SourceAccess2_0Annotation(JavaResourcePersistentMember parent, Member member) { - super(parent, member, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter(member, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** AccessAnnotation implementation ********** - - // ***** value - public AccessType getValue() { - return this.value; - } - - public void setValue(AccessType value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(AccessType.toJavaAnnotationValue(value)); - } - } - - private void syncValue(AccessType astValue) { - AccessType old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private AccessType buildValue(CompilationUnit astRoot) { - return AccessType.fromJavaAnnotationValue(this.valueAdapter.getValue(astRoot)); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter buildValueAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ACCESS__VALUE); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java deleted file mode 100644 index 9ea428b84a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverride2_0Annotation.java +++ /dev/null @@ -1,180 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.NestedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.NullAssociationOverrideJoinTableAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAssociationOverrideAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinTableAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.AssociationOverride2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.JPA; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; - -/** - * javax.persistence.AssociationOverride - */ -public final class SourceAssociationOverride2_0Annotation - extends SourceAssociationOverrideAnnotation - implements AssociationOverride2_0Annotation -{ - private ElementAnnotationAdapter joinTableAdapter; - private JoinTableAnnotation joinTable; - private final JoinTableAnnotation nullJoinTable; - - - public SourceAssociationOverride2_0Annotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, member, daa, annotationAdapter); - this.joinTableAdapter = this.buildJoinTableAdapter(); - this.nullJoinTable = this.buildNullJoinTable(); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - if (this.joinTableAdapter.getAnnotation(astRoot) != null) { - this.joinTable = buildJoinTableAnnotation(this, this.annotatedElement, this.daa); - this.joinTable.initialize(astRoot); - } - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncJoinTable(astRoot); - } - - - //************ AssociationOverride2_0Annotation implementation **************** - - // ***** joinTable - public JoinTableAnnotation getJoinTable() { - return this.joinTable; - } - - public JoinTableAnnotation getNonNullJoinTable() { - return (this.joinTable != null) ? this.joinTable : this.nullJoinTable; - } - - public JoinTableAnnotation addJoinTable() { - if (this.joinTable != null) { - throw new IllegalStateException("'joinTable' element already exists: " + this.joinTable); //$NON-NLS-1$ - } - this.joinTable = buildJoinTableAnnotation(this, this.annotatedElement, this.daa); - this.joinTable.newAnnotation(); - return this.joinTable; - } - - public void removeJoinTable() { - if (this.joinTable == null) { - throw new IllegalStateException("'joinTable' element does not exist"); //$NON-NLS-1$ - } - JoinTableAnnotation old = this.joinTable; - this.joinTable = null; - old.removeAnnotation(); - } - - private void syncJoinTable(CompilationUnit astRoot) { - if (this.joinTableAdapter.getAnnotation(astRoot) == null) { - this.syncJoinTable_(null); - } else { - if (this.joinTable == null) { - JoinTableAnnotation table = buildJoinTableAnnotation(this, this.annotatedElement, this.daa); - table.initialize(astRoot); - this.syncJoinTable_(table); - } else { - this.joinTable.synchronizeWith(astRoot); - } - } - } - - private void syncJoinTable_(JoinTableAnnotation astJoinTable) { - JoinTableAnnotation old = this.joinTable; - this.joinTable = astJoinTable; - this.firePropertyChanged(JOIN_TABLE_PROPERTY, old, astJoinTable); - } - - private ElementAnnotationAdapter buildJoinTableAdapter() { - return new ElementAnnotationAdapter(this.annotatedElement, buildJoinTableAnnotationAdapter(this.daa)); - } - - private JoinTableAnnotation buildNullJoinTable() { - return new NullAssociationOverrideJoinTableAnnotation(this); - } - - - // ********** misc ********** - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.joinTable == null); - } - - @Override - protected void rebuildAdapters() { - super.rebuildAdapters(); - this.joinTableAdapter = this.buildJoinTableAdapter(); - } - - @Override - public void storeOn(Map map) { - super.storeOn(map); - if (this.joinTable != null) { - Map joinTableState = new HashMap(); - this.joinTable.storeOn(joinTableState); - map.put(JOIN_TABLE_PROPERTY, joinTableState); - this.joinTable = null; - } - } - - @Override - public void restoreFrom(Map map) { - super.restoreFrom(map); - @SuppressWarnings("unchecked") - Map joinTableState = (Map) map.get(JOIN_TABLE_PROPERTY); - if (joinTableState != null) { - this.addJoinTable().restoreFrom(joinTableState); - } - } - - - // ********** static methods ********** - - public static SourceAssociationOverride2_0Annotation buildAssociationOverride(JavaResourceNode parent, Member member) { - return new SourceAssociationOverride2_0Annotation(parent, member, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(member, DECLARATION_ANNOTATION_ADAPTER)); - } - - static JoinTableAnnotation buildJoinTableAnnotation(JavaResourceNode parent, Member member, DeclarationAnnotationAdapter associationOverrideAnnotationAdapter) { - return new SourceJoinTableAnnotation(parent, member, buildJoinTableAnnotationAdapter(associationOverrideAnnotationAdapter)); - } - - static DeclarationAnnotationAdapter buildJoinTableAnnotationAdapter(DeclarationAnnotationAdapter associationOverrideAnnotationAdapter) { - return new NestedDeclarationAnnotationAdapter(associationOverrideAnnotationAdapter, JPA2_0.ASSOCIATION_OVERRIDE__JOIN_TABLE, JPA.JOIN_TABLE); - } - - - static SourceAssociationOverrideAnnotation buildNestedAssociationOverride(JavaResourceNode parent, Member member, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) { - IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME); - IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(member, idaa); - return new SourceAssociationOverride2_0Annotation(parent, member, idaa, annotationAdapter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java deleted file mode 100644 index be45b19954..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceAssociationOverrides2_0Annotation.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAssociationOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.NestableAssociationOverrideAnnotation; - -/** - * javax.persistence.AssociationOverrides - */ -public final class SourceAssociationOverrides2_0Annotation - extends SourceAssociationOverridesAnnotation -{ - public SourceAssociationOverrides2_0Annotation(JavaResourceNode parent, Member member) { - super(parent, member); - } - - @Override - protected NestableAssociationOverrideAnnotation buildAssociationOverride(int index) { - // pass the Java resource persistent member as the nested annotation's parent - // since the nested annotation can be converted to stand-alone - return SourceAssociationOverride2_0Annotation.buildNestedAssociationOverride(this.parent, this.annotatedElement, index, this.daa); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java deleted file mode 100644 index f89f48edd4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCacheable2_0Annotation.java +++ /dev/null @@ -1,105 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.BooleanExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.Cacheable2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.Cacheable - */ -public final class SourceCacheable2_0Annotation - extends SourceAnnotation - implements Cacheable2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter valueAdapter; - private Boolean value; - - - public SourceCacheable2_0Annotation(JavaResourcePersistentType parent, Type type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter(type, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** Cacheable2_0Annotation implementation ********** - - // ***** value - public Boolean getValue() { - return this.value; - } - - public void setValue(Boolean value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(Boolean astValue) { - Boolean old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private Boolean buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter buildValueAdapter() { - return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.CACHEABLE__VALUE, BooleanExpressionConverter.instance()); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java deleted file mode 100644 index 8243f24a36..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceCollectionTable2_0Annotation.java +++ /dev/null @@ -1,272 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import java.util.HashMap; -import java.util.List; -import java.util.ListIterator; -import java.util.Map; -import java.util.Vector; -import org.eclipse.jdt.core.dom.Annotation; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.NestedIndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterables.LiveCloneIterable; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.AnnotationContainerTools; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseTableAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.CollectionTable2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationContainer; -import org.eclipse.jpt.jpa.core.resource.java.JPA; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.NestableJoinColumnAnnotation; - -/** - * javax.persistence.CollectionTable - */ -public final class SourceCollectionTable2_0Annotation - extends SourceBaseTableAnnotation - implements CollectionTable2_0Annotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(CollectionTable2_0Annotation.ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter NAME_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.COLLECTION_TABLE__NAME); - - private static final DeclarationAnnotationElementAdapter SCHEMA_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.COLLECTION_TABLE__SCHEMA); - - private static final DeclarationAnnotationElementAdapter CATALOG_ADAPTER = ConversionDeclarationAnnotationElementAdapter.forStrings(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.COLLECTION_TABLE__CATALOG); - - - private final Vector joinColumns = new Vector(); - private final JoinColumnsAnnotationContainer joinColumnsContainer = new JoinColumnsAnnotationContainer(); - - - public SourceCollectionTable2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - AnnotationContainerTools.initialize(this.joinColumnsContainer, astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - AnnotationContainerTools.synchronize(this.joinColumnsContainer, astRoot); - } - - - // ********** SourceBaseTableAnnotation implementation ********** - - @Override - protected DeclarationAnnotationElementAdapter buildNameDeclarationAdapter() { - return NAME_ADAPTER; - } - - @Override - protected DeclarationAnnotationElementAdapter buildSchemaDeclarationAdapter() { - return SCHEMA_ADAPTER; - } - - @Override - protected DeclarationAnnotationElementAdapter buildCatalogDeclarationAdapter() { - return CATALOG_ADAPTER; - } - - @Override - protected String getUniqueConstraintsElementName() { - return JPA2_0.COLLECTION_TABLE__UNIQUE_CONSTRAINTS; - } - - // ********** CollectionTable2_0Annotation implementation ********** - - // ***** join columns - public ListIterator joinColumns() { - return new CloneListIterator(this.joinColumns); - } - - Iterable getNestableJoinColumns() { - return new LiveCloneIterable(this.joinColumns); - } - - public int joinColumnsSize() { - return this.joinColumns.size(); - } - - public NestableJoinColumnAnnotation joinColumnAt(int index) { - return this.joinColumns.get(index); - } - - public int indexOfJoinColumn(JoinColumnAnnotation joinColumn) { - return this.joinColumns.indexOf(joinColumn); - } - - private NestableJoinColumnAnnotation addJoinColumn() { - return this.addJoinColumn(this.joinColumns.size()); - } - - public NestableJoinColumnAnnotation addJoinColumn(int index) { - return (NestableJoinColumnAnnotation) AnnotationContainerTools.addNestedAnnotation(index, this.joinColumnsContainer); - } - - NestableJoinColumnAnnotation addJoinColumn_() { - return this.addJoinColumn_(this.joinColumns.size()); - } - - private NestableJoinColumnAnnotation addJoinColumn_(int index) { - NestableJoinColumnAnnotation joinColumn = this.buildJoinColumn(index); - this.joinColumns.add(index, joinColumn); - return joinColumn; - } - - void syncAddJoinColumn(Annotation astAnnotation) { - int index = this.joinColumns.size(); - NestableJoinColumnAnnotation joinColumn = this.addJoinColumn_(index); - joinColumn.initialize((CompilationUnit) astAnnotation.getRoot()); - this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn); - } - - private NestableJoinColumnAnnotation buildJoinColumn(int index) { - return new SourceJoinColumnAnnotation(this, this.annotatedElement, buildJoinColumnAnnotationAdapter(index)); - } - - private IndexedDeclarationAnnotationAdapter buildJoinColumnAnnotationAdapter(int index) { - return new NestedIndexedDeclarationAnnotationAdapter(this.daa, JPA.JOIN_TABLE__JOIN_COLUMNS, index, JPA.JOIN_COLUMN); - } - - void joinColumnAdded(int index, NestableJoinColumnAnnotation joinColumn) { - this.fireItemAdded(JOIN_COLUMNS_LIST, index, joinColumn); - } - - public void moveJoinColumn(int targetIndex, int sourceIndex) { - AnnotationContainerTools.moveNestedAnnotation(targetIndex, sourceIndex, this.joinColumnsContainer); - } - - NestableJoinColumnAnnotation moveJoinColumn_(int targetIndex, int sourceIndex) { - return CollectionTools.move(this.joinColumns, targetIndex, sourceIndex).get(targetIndex); - } - - public void removeJoinColumn(int index) { - AnnotationContainerTools.removeNestedAnnotation(index, this.joinColumnsContainer); - } - - NestableJoinColumnAnnotation removeJoinColumn_(int index) { - return this.joinColumns.remove(index); - } - - void syncRemoveJoinColumns(int index) { - this.removeItemsFromList(index, this.joinColumns, JOIN_COLUMNS_LIST); - } - - - // ********** misc ********** - - @Override - public boolean isUnset() { - return super.isUnset() && - this.joinColumns.isEmpty(); - } - - @Override - public void storeOn(Map map) { - super.storeOn(map); - - List> joinColumnsState = this.buildStateList(this.joinColumns.size()); - for (NestableJoinColumnAnnotation joinColumn : this.getNestableJoinColumns()) { - Map joinColumnState = new HashMap(); - joinColumn.storeOn(joinColumnState); - joinColumnsState.add(joinColumnState); - } - map.put(JOIN_COLUMNS_LIST, joinColumnsState); - this.joinColumns.clear(); - } - - @Override - public void restoreFrom(Map map) { - super.restoreFrom(map); - - @SuppressWarnings("unchecked") - List> joinColumnsState = (List>) map.get(JOIN_COLUMNS_LIST); - for (Map joinColumnState : joinColumnsState) { - this.addJoinColumn().restoreFrom(joinColumnState); - } - } - - - // ********** join column container ********** - - /** - * adapt the AnnotationContainer interface to the collection table's join columns - */ - class JoinColumnsAnnotationContainer - implements AnnotationContainer - { - public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) { - return SourceCollectionTable2_0Annotation.this.getAstAnnotation(astRoot); - } - - public String getElementName() { - return JPA2_0.COLLECTION_TABLE__JOIN_COLUMNS; - } - - public String getNestedAnnotationName() { - return JoinColumnAnnotation.ANNOTATION_NAME; - } - - public Iterable getNestedAnnotations() { - return SourceCollectionTable2_0Annotation.this.getNestableJoinColumns(); - } - - public int getNestedAnnotationsSize() { - return SourceCollectionTable2_0Annotation.this.joinColumnsSize(); - } - - public NestableJoinColumnAnnotation addNestedAnnotation() { - return SourceCollectionTable2_0Annotation.this.addJoinColumn_(); - } - - public void syncAddNestedAnnotation(Annotation astAnnotation) { - SourceCollectionTable2_0Annotation.this.syncAddJoinColumn(astAnnotation); - } - - public NestableJoinColumnAnnotation moveNestedAnnotation(int targetIndex, int sourceIndex) { - return SourceCollectionTable2_0Annotation.this.moveJoinColumn_(targetIndex, sourceIndex); - } - - public NestableJoinColumnAnnotation removeNestedAnnotation(int index) { - return SourceCollectionTable2_0Annotation.this.removeJoinColumn_(index); - } - - public void syncRemoveNestedAnnotations(int index) { - SourceCollectionTable2_0Annotation.this.syncRemoveJoinColumns(index); - } - - @Override - public String toString() { - return StringTools.buildToStringFor(this); - } - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java deleted file mode 100644 index 3910e85f42..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceElementCollection2_0Annotation.java +++ /dev/null @@ -1,188 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.ElementCollection2_0Annotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.resource.java.FetchType; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * org.eclipse.persistence.annotations.Transformation - */ -public final class SourceElementCollection2_0Annotation - extends SourceAnnotation - implements ElementCollection2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter TARGET_CLASS_ADAPTER = buildTargetClassAdapter(); - private final AnnotationElementAdapter targetClassAdapter; - private String targetClass; - - /** - * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName - */ - private String fullyQualifiedTargetClassName; - // we need a flag since the f-q name can be null - private boolean fqTargetClassNameStale = true; - - private static final DeclarationAnnotationElementAdapter FETCH_ADAPTER = buildFetchAdapter(); - private final AnnotationElementAdapter fetchAdapter; - private FetchType fetch; - - - public SourceElementCollection2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.targetClassAdapter = new AnnotatedElementAnnotationElementAdapter(attribute, TARGET_CLASS_ADAPTER); - this.fetchAdapter = new AnnotatedElementAnnotationElementAdapter(attribute, FETCH_ADAPTER); - } - - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.targetClass = this.buildTargetClass(astRoot); - this.fetch = this.buildFetch(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncTargetClass(this.buildTargetClass(astRoot)); - this.syncFetch(this.buildFetch(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.targetClass == null) && - (this.fetch == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.targetClass); - } - - - // ********** ElementCollection2_0Annotation implementation ********** - - // ***** target class - public String getTargetClass() { - return this.targetClass; - } - - public void setTargetClass(String targetClass) { - if (this.attributeValueHasChanged(this.targetClass, targetClass)) { - this.targetClass = targetClass; - this.fqTargetClassNameStale = true; - this.targetClassAdapter.setValue(targetClass); - } - } - - private void syncTargetClass(String astTargetClass) { - if (this.attributeValueHasChanged(this.targetClass, astTargetClass)) { - this.syncTargetClass_(astTargetClass); - } - } - - private void syncTargetClass_(String astTargetClass) { - String old = this.targetClass; - this.targetClass = astTargetClass; - this.fqTargetClassNameStale = true; - this.firePropertyChanged(TARGET_CLASS_PROPERTY, old, astTargetClass); - } - - private String buildTargetClass(CompilationUnit astRoot) { - return this.targetClassAdapter.getValue(astRoot); - } - - public TextRange getTargetClassTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(TARGET_CLASS_ADAPTER, astRoot); - } - - // ***** fully-qualified target entity class name - public String getFullyQualifiedTargetClassName() { - if (this.fqTargetClassNameStale) { - this.fullyQualifiedTargetClassName = this.buildFullyQualifiedTargetClassName(); - this.fqTargetClassNameStale = false; - } - return this.fullyQualifiedTargetClassName; - } - - private String buildFullyQualifiedTargetClassName() { - return (this.targetClass == null) ? null : this.buildFullyQualifiedTargetClassName_(); - } - - private String buildFullyQualifiedTargetClassName_() { - return ASTTools.resolveFullyQualifiedName(this.targetClassAdapter.getExpression(this.buildASTRoot())); - } - - // ***** fetch - public FetchType getFetch() { - return this.fetch; - } - - public void setFetch(FetchType fetch) { - if (this.attributeValueHasChanged(this.fetch, fetch)) { - this.fetch = fetch; - this.fetchAdapter.setValue(FetchType.toJavaAnnotationValue(fetch)); - } - } - - private void syncFetch(FetchType astFetch) { - FetchType old = this.fetch; - this.fetch = astFetch; - this.firePropertyChanged(FETCH_PROPERTY, old, astFetch); - } - - private FetchType buildFetch(CompilationUnit astRoot) { - return FetchType.fromJavaAnnotationValue(this.fetchAdapter.getValue(astRoot)); - } - - public TextRange getFetchTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(FETCH_ADAPTER, astRoot); - } - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter buildFetchAdapter() { - return new EnumDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ELEMENT_COLLECTION__FETCH); - } - - private static DeclarationAnnotationElementAdapter buildTargetClassAdapter() { - return buildTargetClassAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.ELEMENT_COLLECTION__TARGET_CLASS); - } - - private static DeclarationAnnotationElementAdapter buildTargetClassAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) { - // TODO what about QualifiedType? - return buildAnnotationElementAdapter(annotationAdapter, elementName, SimpleTypeStringExpressionConverter.instance()); - } - - private static DeclarationAnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter converter) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, converter); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java deleted file mode 100644 index 4e68a01b21..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceGeneratedAnnotation.java +++ /dev/null @@ -1,222 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import java.util.Arrays; -import java.util.ListIterator; -import java.util.Vector; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotationStringArrayExpressionConverter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.ExpressionConverter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterators.CloneListIterator; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.GeneratedAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.annotation.Generated - */ -public final class SourceGeneratedAnnotation - extends SourceAnnotation - implements GeneratedAnnotation -{ - public static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter valueAdapter; - private final Vector values = new Vector(); - - private static final DeclarationAnnotationElementAdapter DATE_ADAPTER = buildAdapter(DATE_ELEMENT_NAME); - private final AnnotationElementAdapter dateAdapter; - private String date; - - private static final DeclarationAnnotationElementAdapter COMMENTS_ADAPTER = buildAdapter(COMMENTS_ELEMENT_NAME); - private final AnnotationElementAdapter commentsAdapter; - private String comments; - - - public SourceGeneratedAnnotation(JavaResourcePersistentType parent, Type type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = this.buildAnnotationElementAdapter(VALUE_ADAPTER); - this.dateAdapter = this.buildAdapter(DATE_ADAPTER); - this.commentsAdapter = this.buildAdapter(COMMENTS_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - private AnnotationElementAdapter buildAnnotationElementAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - private AnnotationElementAdapter buildAdapter(DeclarationAnnotationElementAdapter daea) { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, daea); - } - - public void initialize(CompilationUnit astRoot) { - this.initializeValues(astRoot); - this.date = this.buildDate(astRoot); - this.comments = this.buildComments(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValues(astRoot); - this.syncDate(this.buildDate(astRoot)); - this.syncComments(this.buildComments(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - this.values.isEmpty() && - (this.date == null) && - (this.comments == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.values); - } - - - // ********** GeneratedAnnotation implementation ********** - - // ***** values - public ListIterator values() { - return new CloneListIterator(this.values); - } - - public int valuesSize() { - return this.values.size(); - } - - public String getValue(int index) { - return this.values.get(index); - } - - public void addValue(String value) { - this.addValue(this.values.size(), value); - } - - public void addValue(int index, String value) { - this.values.add(index, value); - this.writeValues(); - } - - public void moveValue(int targetIndex, int sourceIndex) { - CollectionTools.move(this.values, targetIndex, sourceIndex); - this.writeValues(); - } - - public void removeValue(String value) { - this.values.remove(value); - this.writeValues(); - } - - public void removeValue(int index) { - this.values.remove(index); - this.writeValues(); - } - - private void writeValues() { - this.valueAdapter.setValue(this.values.toArray(new String[this.values.size()])); - } - - private void initializeValues(CompilationUnit astRoot) { - String[] astValues = this.valueAdapter.getValue(astRoot); - for (int i = 0; i < astValues.length; i++) { - this.values.add(astValues[i]); - } - } - - private void syncValues(CompilationUnit astRoot) { - String[] astValues = this.valueAdapter.getValue(astRoot); - this.synchronizeList(Arrays.asList(astValues), this.values, VALUES_LIST); - } - - // ***** date - public String getDate() { - return this.date; - } - - public void setDate(String date) { - if (this.attributeValueHasChanged(this.date, date)) { - this.date = date; - this.dateAdapter.setValue(date); - } - } - - protected void syncDate(String astDate) { - String old = this.date; - this.date = astDate; - this.firePropertyChanged(DATE_PROPERTY, old, astDate); - } - - private String buildDate(CompilationUnit astRoot) { - return this.dateAdapter.getValue(astRoot); - } - - // ***** comments - public String getComments() { - return this.comments; - } - - public void setComments(String comments) { - if (this.attributeValueHasChanged(this.comments, comments)) { - this.comments = comments; - this.commentsAdapter.setValue(comments); - } - } - - protected void syncComments(String astComments) { - String old = this.comments; - this.comments = astComments; - this.firePropertyChanged(COMMENTS_PROPERTY, old, astComments); - } - - private String buildComments(CompilationUnit astRoot) { - return this.commentsAdapter.getValue(astRoot); - } - - - // ********** static methods ********** - - protected static DeclarationAnnotationElementAdapter buildValueAdapter() { - return buildArrayAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, VALUE_ELEMENT_NAME); - } - - private static DeclarationAnnotationElementAdapter buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) { - return buildArrayAnnotationElementAdapter(annotationAdapter, elementName, AnnotationStringArrayExpressionConverter.forStrings()); - } - - private static DeclarationAnnotationElementAdapter buildArrayAnnotationElementAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName, ExpressionConverter converter) { - return new ConversionDeclarationAnnotationElementAdapter(annotationAdapter, elementName, converter); - } - - protected static DeclarationAnnotationElementAdapter buildAdapter(String elementName) { - return buildAdapter(DECLARATION_ANNOTATION_ADAPTER, elementName); - } - - static DeclarationAnnotationElementAdapter buildAdapter(DeclarationAnnotationAdapter annotationAdapter, String elementName) { - return ConversionDeclarationAnnotationElementAdapter.forStrings(annotationAdapter, elementName); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java deleted file mode 100644 index ca2f005792..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyClass2_0Annotation.java +++ /dev/null @@ -1,138 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyClass2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyClass - */ -public final class SourceMapKeyClass2_0Annotation - extends SourceAnnotation - implements MapKeyClass2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter valueAdapter; - private String value; - - /** - * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName - */ - private String fullyQualifiedClassName; - // we need a flag since the f-q name can be null - private boolean fqClassNameStale = true; - - - public SourceMapKeyClass2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter(attribute, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** MapKeyClass2_0Annotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.fqClassNameStale = true; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(String astValue) { - if (this.attributeValueHasChanged(this.value, astValue)) { - this.syncValue_(astValue); - } - } - - private void syncValue_(String astValue) { - String old = this.value; - this.value = astValue; - this.fqClassNameStale = true; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private String buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - // ***** fully-qualified class name - public String getFullyQualifiedClassName() { - if (this.fqClassNameStale) { - this.fullyQualifiedClassName = this.buildFullyQualifiedClassName(); - this.fqClassNameStale = false; - } - return this.fullyQualifiedClassName; - } - - private String buildFullyQualifiedClassName() { - return (this.value == null) ? null : this.buildFullyQualifiedClassName_(); - } - - private String buildFullyQualifiedClassName_() { - return ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(this.buildASTRoot())); - } - - - // ********** static methods ********** - - protected static DeclarationAnnotationElementAdapter buildValueAdapter() { - return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.MAP_KEY_CLASS__VALUE, SimpleTypeStringExpressionConverter.instance()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java deleted file mode 100644 index e0ee92ad8f..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyColumn2_0Annotation.java +++ /dev/null @@ -1,95 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceCompleteColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyColumn - */ -public final class SourceMapKeyColumn2_0Annotation - extends SourceCompleteColumnAnnotation - implements MapKeyColumn2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(MapKeyColumn2_0Annotation.ANNOTATION_NAME); - - - public SourceMapKeyColumn2_0Annotation(JavaResourcePersistentAttribute parent, Member member) { - super(parent, member, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return MapKeyColumn2_0Annotation.ANNOTATION_NAME; - } - - - // ********** SourceNamedColumnAnnotation implementation ********** - - @Override - protected String getNameElementName() { - return JPA2_0.MAP_KEY_COLUMN__NAME; - } - - @Override - protected String getColumnDefinitionElementName() { - return JPA2_0.MAP_KEY_COLUMN__COLUMN_DEFINITION; - } - - - // ********** SourceBaseColumnAnnotation implementation ********** - - @Override - protected String getTableElementName() { - return JPA2_0.MAP_KEY_COLUMN__TABLE; - } - - @Override - protected String getUniqueElementName() { - return JPA2_0.MAP_KEY_COLUMN__UNIQUE; - } - - @Override - protected String getNullableElementName() { - return JPA2_0.MAP_KEY_COLUMN__NULLABLE; - } - - @Override - protected String getInsertableElementName() { - return JPA2_0.MAP_KEY_COLUMN__INSERTABLE; - } - - @Override - protected String getUpdatableElementName() { - return JPA2_0.MAP_KEY_COLUMN__UPDATABLE; - } - - // ********** SourceCompleteColumnAnnotation implementation ********** - - @Override - protected String getLengthElementName() { - return JPA2_0.MAP_KEY_COLUMN__LENGTH; - } - - @Override - protected String getPrecisionElementName() { - return JPA2_0.MAP_KEY_COLUMN__PRECISION; - } - - @Override - protected String getScaleElementName() { - return JPA2_0.MAP_KEY_COLUMN__SCALE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java deleted file mode 100644 index 6a6adffa06..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyEnumerated2_0Annotation.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseEnumeratedAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyEnumerated2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyEnumerated - */ -public final class SourceMapKeyEnumerated2_0Annotation - extends SourceBaseEnumeratedAnnotation - implements MapKeyEnumerated2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(MapKeyEnumerated2_0Annotation.ANNOTATION_NAME); - - public SourceMapKeyEnumerated2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return MapKeyEnumerated2_0Annotation.ANNOTATION_NAME; - } - - @Override - protected String getValueElementName() { - return JPA2_0.MAP_KEY_ENUMERATED__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java deleted file mode 100644 index 6f119b77fb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapKeyTemporal2_0Annotation.java +++ /dev/null @@ -1,42 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBaseTemporalAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapKeyTemporal2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapKeyTemporal - */ -public final class SourceMapKeyTemporal2_0Annotation - extends SourceBaseTemporalAnnotation - implements MapKeyTemporal2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(MapKeyTemporal2_0Annotation.ANNOTATION_NAME); - - - public SourceMapKeyTemporal2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - } - - public String getAnnotationName() { - return MapKeyTemporal2_0Annotation.ANNOTATION_NAME; - } - - @Override - protected String getValueElementName() { - return JPA2_0.MAP_KEY_TEMPORAL__VALUE; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java deleted file mode 100644 index 866f42d481..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceMapsId2_0Annotation.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.MapsId2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.MapsId - */ -public final class SourceMapsId2_0Annotation - extends SourceAnnotation - implements MapsId2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter valueAdapter; - private String value; - - - public SourceMapsId2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter(attribute, VALUE_ADAPTER); - } - - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** MapsId2_0Annotation implementation ********** - - public String getValue() { - return this.value; - } - - public void setValue(String value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(String astValue) { - String old = this.value; - this.value = astValue; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private String buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - public TextRange getValueTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(VALUE_ADAPTER, astRoot); - } - - public boolean valueTouches(int pos, CompilationUnit astRoot) { - return this.elementTouches(VALUE_ADAPTER, pos, astRoot); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter buildValueAdapter() { - return ConversionDeclarationAnnotationElementAdapter.forStrings( - DECLARATION_ANNOTATION_ADAPTER, JPA2_0.MAPS_ID__VALUE); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java deleted file mode 100644 index 71a614c996..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQueries2_0Annotation.java +++ /dev/null @@ -1,33 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedQueriesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.NestableNamedQueryAnnotation; - -/** - * javax.persistence.NamedQueries - */ -public final class SourceNamedQueries2_0Annotation - extends SourceNamedQueriesAnnotation -{ - public SourceNamedQueries2_0Annotation(JavaResourceNode parent, Type type) { - super(parent, type); - } - - @Override - protected NestableNamedQueryAnnotation buildNamedQuery(int index) { - // pass the Java resource persistent member as the nested annotation's parent - // since the nested annotation can be converted to stand-alone - return SourceNamedQuery2_0Annotation.createNestedNamedQuery(this.parent, this.annotatedElement, index, this.daa); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java deleted file mode 100644 index 780c127a30..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceNamedQuery2_0Annotation.java +++ /dev/null @@ -1,147 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import java.util.Map; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ElementIndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.EnumDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.IndexedDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedQueryAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.LockModeType_2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.NamedQuery2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * javax.persistence.NamedQuery - */ -public final class SourceNamedQuery2_0Annotation - extends SourceNamedQueryAnnotation - implements NamedQuery2_0Annotation -{ - private DeclarationAnnotationElementAdapter lockModeDeclarationAdapter; - private AnnotationElementAdapter lockModeAdapter; - private LockModeType_2_0 lockMode; - - - public SourceNamedQuery2_0Annotation(JavaResourceNode parent, Type type, DeclarationAnnotationAdapter daa, AnnotationAdapter annotationAdapter) { - super(parent, type, daa, annotationAdapter); - this.lockModeDeclarationAdapter = this.buildLockModeDeclarationAdapter(); - this.lockModeAdapter = this.buildLockModeAdapter(); - } - - public SourceNamedQuery2_0Annotation(JavaResourceNode parent, Type type) { - this(parent, type, DECLARATION_ANNOTATION_ADAPTER, new ElementAnnotationAdapter(type, DECLARATION_ANNOTATION_ADAPTER)); - } - - private String getLockModeElementName() { - return JPA2_0.NAMED_QUERY__LOCK_MODE; - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - this.lockMode = this.buildLockMode(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncLockMode(this.buildLockMode(astRoot)); - } - - - // ********** NamedQuery2_0Annotation implementation ********** - - public LockModeType_2_0 getLockMode() { - return this.lockMode; - } - - public void setLockMode(LockModeType_2_0 lockMode) { - if (this.attributeValueHasChanged(this.lockMode, lockMode)) { - this.lockMode = lockMode; - this.lockModeAdapter.setValue(LockModeType_2_0.toJavaAnnotationValue(lockMode)); - } - } - - private void syncLockMode(LockModeType_2_0 astLockMode) { - LockModeType_2_0 old = this.lockMode; - this.lockMode = astLockMode; - this.firePropertyChanged(LOCK_MODE_PROPERTY, old, astLockMode); - } - - private LockModeType_2_0 buildLockMode(CompilationUnit astRoot) { - return LockModeType_2_0.fromJavaAnnotationValue(this.lockModeAdapter.getValue(astRoot)); - } - - public TextRange getLockModeTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.lockModeDeclarationAdapter, astRoot); - } - - public boolean lockModeTouches(int pos, CompilationUnit astRoot) { - return this.elementTouches(this.lockModeDeclarationAdapter, pos, astRoot); - } - - private DeclarationAnnotationElementAdapter buildLockModeDeclarationAdapter() { - return new EnumDeclarationAnnotationElementAdapter(this.daa, this.getLockModeElementName()); - } - - private AnnotationElementAdapter buildLockModeAdapter() { - return new AnnotatedElementAnnotationElementAdapter(this.annotatedElement, this.lockModeDeclarationAdapter); - } - - - // ********** misc ********** - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.lockMode == null); - } - - @Override - protected void rebuildAdapters() { - super.rebuildAdapters(); - this.lockModeDeclarationAdapter = this.buildLockModeDeclarationAdapter(); - this.lockModeAdapter = this.buildLockModeAdapter(); - } - - @Override - public void storeOn(Map map) { - super.storeOn(map); - map.put(LOCK_MODE_PROPERTY, this.lockMode); - this.lockMode = null; - } - - @Override - public void restoreFrom(Map map) { - super.restoreFrom(map); - this.setLockMode((LockModeType_2_0) map.get(LOCK_MODE_PROPERTY)); - } - - - // ********** static methods ********** - - static SourceNamedQuery2_0Annotation createNestedNamedQuery(JavaResourceNode parent, Type type, int index, DeclarationAnnotationAdapter attributeOverridesAdapter) { - IndexedDeclarationAnnotationAdapter idaa = buildNestedDeclarationAnnotationAdapter(index, attributeOverridesAdapter, ANNOTATION_NAME); - IndexedAnnotationAdapter annotationAdapter = new ElementIndexedAnnotationAdapter(type, idaa); - return new SourceNamedQuery2_0Annotation(parent, type, idaa, annotationAdapter); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java deleted file mode 100644 index 9d45f1d4b1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceOrderColumn2_0Annotation.java +++ /dev/null @@ -1,244 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import java.util.Map; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedColumnAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.OrderColumn2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.OrderColumn - */ -public final class SourceOrderColumn2_0Annotation - extends SourceNamedColumnAnnotation - implements OrderColumn2_0Annotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private DeclarationAnnotationElementAdapter nullableDeclarationAdapter; - private AnnotationElementAdapter nullableAdapter; - private Boolean nullable; - - private DeclarationAnnotationElementAdapter insertableDeclarationAdapter; - private AnnotationElementAdapter insertableAdapter; - private Boolean insertable; - - private DeclarationAnnotationElementAdapter updatableDeclarationAdapter; - private AnnotationElementAdapter updatableAdapter; - private Boolean updatable; - - - public SourceOrderColumn2_0Annotation(JavaResourcePersistentAttribute parent, Attribute attribute) { - super(parent, attribute, DECLARATION_ANNOTATION_ADAPTER); - this.nullableDeclarationAdapter = this.buildNullableDeclarationAdapter(); - this.nullableAdapter = this.buildNullableAdapter(); - this.insertableDeclarationAdapter = this.buildInsertableDeclarationAdapter(); - this.insertableAdapter = this.buildInsertableAdapter(); - this.updatableDeclarationAdapter = this.buildUpdatableDeclarationAdapter(); - this.updatableAdapter = this.buildUpdatableAdapter(); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - this.nullable = this.buildNullable(astRoot); - this.insertable = this.buildInsertable(astRoot); - this.updatable = this.buildUpdatable(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncNullable(this.buildNullable(astRoot)); - this.syncInsertable(this.buildInsertable(astRoot)); - this.syncUpdatable(this.buildUpdatable(astRoot)); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - @Override - protected String getNameElementName() { - return JPA2_0.ORDER_COLUMN__NAME; - } - - @Override - protected String getColumnDefinitionElementName() { - return JPA2_0.ORDER_COLUMN__COLUMN_DEFINITION; - } - - - //************* OrderColumn2_0Annotation implementation ************* - - // ***** nullable - public Boolean getNullable() { - return this.nullable; - } - - public void setNullable(Boolean nullable) { - if (this.attributeValueHasChanged(this.nullable, nullable)) { - this.nullable = nullable; - this.nullableAdapter.setValue(nullable); - } - } - - private void syncNullable(Boolean astNullable) { - Boolean old = this.nullable; - this.nullable = astNullable; - this.firePropertyChanged(NULLABLE_PROPERTY, old, astNullable); - } - - private Boolean buildNullable(CompilationUnit astRoot) { - return this.nullableAdapter.getValue(astRoot); - } - - public TextRange getNullableTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.nullableDeclarationAdapter, astRoot); - } - - private DeclarationAnnotationElementAdapter buildNullableDeclarationAdapter() { - return this.buildBooleanElementAdapter(this.getNullableElementName()); - } - - private AnnotationElementAdapter buildNullableAdapter() { - return this.buildBooleanElementAdapter(this.nullableDeclarationAdapter); - } - - String getNullableElementName() { - return JPA2_0.ORDER_COLUMN__NULLABLE; - } - - // ***** insertable - public Boolean getInsertable() { - return this.insertable; - } - - public void setInsertable(Boolean insertable) { - if (this.attributeValueHasChanged(this.insertable, insertable)) { - this.insertable = insertable; - this.insertableAdapter.setValue(insertable); - } - } - - private void syncInsertable(Boolean astInsertable) { - Boolean old = this.insertable; - this.insertable = astInsertable; - this.firePropertyChanged(INSERTABLE_PROPERTY, old, astInsertable); - } - - private Boolean buildInsertable(CompilationUnit astRoot) { - return this.insertableAdapter.getValue(astRoot); - } - - public TextRange getInsertableTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.insertableDeclarationAdapter, astRoot); - } - - private DeclarationAnnotationElementAdapter buildInsertableDeclarationAdapter() { - return this.buildBooleanElementAdapter(this.getInsertableElementName()); - } - - private AnnotationElementAdapter buildInsertableAdapter() { - return this.buildBooleanElementAdapter(this.insertableDeclarationAdapter); - } - - String getInsertableElementName() { - return JPA2_0.ORDER_COLUMN__INSERTABLE; - } - - // ***** updatable - public Boolean getUpdatable() { - return this.updatable; - } - - public void setUpdatable(Boolean updatable) { - if (this.attributeValueHasChanged(this.updatable, updatable)) { - this.updatable = updatable; - this.updatableAdapter.setValue(updatable); - } - } - - private void syncUpdatable(Boolean astUpdatable) { - Boolean old = this.updatable; - this.updatable = astUpdatable; - this.firePropertyChanged(UPDATABLE_PROPERTY, old, astUpdatable); - } - - private Boolean buildUpdatable(CompilationUnit astRoot) { - return this.updatableAdapter.getValue(astRoot); - } - - public TextRange getUpdatableTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(this.updatableDeclarationAdapter, astRoot); - } - - private DeclarationAnnotationElementAdapter buildUpdatableDeclarationAdapter() { - return this.buildBooleanElementAdapter(this.getUpdatableElementName()); - } - - private AnnotationElementAdapter buildUpdatableAdapter() { - return this.buildBooleanElementAdapter(this.updatableDeclarationAdapter); - } - - String getUpdatableElementName() { - return JPA2_0.ORDER_COLUMN__UPDATABLE; - } - - - // ********** misc ********** - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.nullable == null) && - (this.insertable == null) && - (this.updatable == null); - } - - @Override - protected void rebuildAdapters() { - super.rebuildAdapters(); - this.nullableDeclarationAdapter = this.buildNullableDeclarationAdapter(); - this.nullableAdapter = this.buildNullableAdapter(); - this.insertableDeclarationAdapter = this.buildInsertableDeclarationAdapter(); - this.insertableAdapter = this.buildInsertableAdapter(); - this.updatableDeclarationAdapter = this.buildUpdatableDeclarationAdapter(); - this.updatableAdapter = this.buildUpdatableAdapter(); - } - - @Override - public void storeOn(Map map) { - super.storeOn(map); - map.put(NULLABLE_PROPERTY, this.nullable); - this.nullable = null; - map.put(INSERTABLE_PROPERTY, this.insertable); - this.insertable = null; - map.put(UPDATABLE_PROPERTY, this.updatable); - this.updatable = null; - } - - @Override - public void restoreFrom(Map map) { - super.restoreFrom(map); - this.setNullable((Boolean) map.get(NULLABLE_PROPERTY)); - this.setInsertable((Boolean) map.get(INSERTABLE_PROPERTY)); - this.setUpdatable((Boolean) map.get(UPDATABLE_PROPERTY)); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java deleted file mode 100644 index f6fbcbcef1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceSequenceGenerator2_0Annotation.java +++ /dev/null @@ -1,127 +0,0 @@ -/******************************************************************************* -* Copyright (c) 2009, 2010 Oracle. All rights reserved. -* This program and the accompanying materials are made available under the -* terms of the Eclipse Public License v1.0, which accompanies this distribution -* and is available at http://www.eclipse.org/legal/epl-v10.html. -* -* Contributors: -* Oracle - initial API and implementation -*******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceSequenceGeneratorAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.SequenceGenerator2_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * SourceSequenceGenerator2_0Annotation - */ -public final class SourceSequenceGenerator2_0Annotation - extends SourceSequenceGeneratorAnnotation - implements SequenceGenerator2_0Annotation -{ - private static final DeclarationAnnotationElementAdapter CATALOG_ADAPTER = buildAdapter(JPA2_0.SEQUENCE_GENERATOR__CATALOG); - private final AnnotationElementAdapter catalogAdapter; - private String catalog; - - private static final DeclarationAnnotationElementAdapter SCHEMA_ADAPTER = buildAdapter(JPA2_0.SEQUENCE_GENERATOR__SCHEMA); - private final AnnotationElementAdapter schemaAdapter; - private String schema; - - - // ********** constructor ********** - public SourceSequenceGenerator2_0Annotation(JavaResourceNode parent, Member member) { - super(parent, member); - this.catalogAdapter = this.buildAdapter(CATALOG_ADAPTER); - this.schemaAdapter = this.buildAdapter(SCHEMA_ADAPTER); - } - - @Override - public void initialize(CompilationUnit astRoot) { - super.initialize(astRoot); - this.catalog = this.buildCatalog(astRoot); - this.schema = this.buildSchema(astRoot); - } - - @Override - public void synchronizeWith(CompilationUnit astRoot) { - super.synchronizeWith(astRoot); - this.syncCatalog(this.buildCatalog(astRoot)); - this.syncSchema(this.buildSchema(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.catalog == null) && - (this.schema == null); - } - - - // ********** catalog ********** - public String getCatalog() { - return this.catalog; - } - - public void setCatalog(String catalog) { - if (this.attributeValueHasChanged(this.catalog, catalog)) { - this.catalog = catalog; - this.catalogAdapter.setValue(catalog); - } - } - - private void syncCatalog(String astCatalog) { - String old = this.catalog; - this.catalog = astCatalog; - this.firePropertyChanged(CATALOG_PROPERTY, old, astCatalog); - } - - private String buildCatalog(CompilationUnit astRoot) { - return this.catalogAdapter.getValue(astRoot); - } - - public TextRange getCatalogTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(CATALOG_ADAPTER, astRoot); - } - - public boolean catalogTouches(int pos, CompilationUnit astRoot) { - return this.elementTouches(CATALOG_ADAPTER, pos, astRoot); - } - - // ********** schema ********** - public String getSchema() { - return this.schema; - } - - public void setSchema(String schema) { - if (this.attributeValueHasChanged(this.schema, schema)) { - this.schema = schema; - this.schemaAdapter.setValue(schema); - } - } - - private void syncSchema(String astSchema) { - String old = this.schema; - this.schema = astSchema; - this.firePropertyChanged(SCHEMA_PROPERTY, old, astSchema); - } - - private String buildSchema(CompilationUnit astRoot) { - return this.schemaAdapter.getValue(astRoot); - } - - public TextRange getSchemaTextRange(CompilationUnit astRoot) { - return this.getElementTextRange(SCHEMA_ADAPTER, astRoot); - } - - public boolean schemaTouches(int pos, CompilationUnit astRoot) { - return this.elementTouches(SCHEMA_ADAPTER, pos, astRoot); - } - -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java deleted file mode 100644 index 165188d7e6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/jpa2/resource/java/source/SourceStaticMetamodelAnnotation.java +++ /dev/null @@ -1,133 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.jpa2.resource.java.source; - -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.internal.utility.jdt.ASTTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.AnnotatedElementAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.ConversionDeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleDeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.internal.utility.jdt.SimpleTypeStringExpressionConverter; -import org.eclipse.jpt.common.core.utility.jdt.AnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationAdapter; -import org.eclipse.jpt.common.core.utility.jdt.DeclarationAnnotationElementAdapter; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAnnotation; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.JPA2_0; -import org.eclipse.jpt.jpa.core.jpa2.resource.java.StaticMetamodelAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.metamodel.StaticMetamodel - */ -public final class SourceStaticMetamodelAnnotation - extends SourceAnnotation - implements StaticMetamodelAnnotation -{ - private static final DeclarationAnnotationAdapter DECLARATION_ANNOTATION_ADAPTER = new SimpleDeclarationAnnotationAdapter(ANNOTATION_NAME); - - private static final DeclarationAnnotationElementAdapter VALUE_ADAPTER = buildValueAdapter(); - private final AnnotationElementAdapter valueAdapter; - private String value; - - /** - * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation#fullyQualifiedClassName - */ - private String fullyQualifiedClassName; - // we need a flag since the f-q name can be null - private boolean fqClassNameStale = true; - - - public SourceStaticMetamodelAnnotation(JavaResourcePersistentType parent, Type type) { - super(parent, type, DECLARATION_ANNOTATION_ADAPTER); - this.valueAdapter = new AnnotatedElementAnnotationElementAdapter(type, VALUE_ADAPTER); - } - - public String getAnnotationName() { - return ANNOTATION_NAME; - } - - public void initialize(CompilationUnit astRoot) { - this.value = this.buildValue(astRoot); - } - - public void synchronizeWith(CompilationUnit astRoot) { - this.syncValue(this.buildValue(astRoot)); - } - - @Override - public boolean isUnset() { - return super.isUnset() && - (this.value == null); - } - - @Override - public void toString(StringBuilder sb) { - sb.append(this.value); - } - - - // ********** StaticMetamodelAnnotation implementation ********** - - // ***** value - public String getValue() { - return this.value; - } - - public void setValue(String value) { - if (this.attributeValueHasChanged(this.value, value)) { - this.value = value; - this.fqClassNameStale = true; - this.valueAdapter.setValue(value); - } - } - - private void syncValue(String astValue) { - if (this.attributeValueHasChanged(this.value, astValue)) { - this.syncValue_(astValue); - } - } - - private void syncValue_(String astValue) { - String old = this.value; - this.value = astValue; - this.fqClassNameStale = true; - this.firePropertyChanged(VALUE_PROPERTY, old, astValue); - } - - private String buildValue(CompilationUnit astRoot) { - return this.valueAdapter.getValue(astRoot); - } - - // ***** fully-qualified class name - public String getFullyQualifiedClassName() { - if (this.fqClassNameStale) { - this.fullyQualifiedClassName = this.buildFullyQualifiedClassName(); - this.fqClassNameStale = false; - } - return this.fullyQualifiedClassName; - } - - private String buildFullyQualifiedClassName() { - return (this.value == null) ? null : this.buildFullyQualifiedClassName_(); - } - - private String buildFullyQualifiedClassName_() { - return ASTTools.resolveFullyQualifiedName(this.valueAdapter.getExpression(this.buildASTRoot())); - } - - - // ********** static methods ********** - - private static DeclarationAnnotationElementAdapter buildValueAdapter() { - return new ConversionDeclarationAnnotationElementAdapter(DECLARATION_ANNOTATION_ADAPTER, JPA2_0.STATIC_METAMODEL__VALUE, SimpleTypeStringExpressionConverter.instance()); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaOsgiBundlesLibraryProviderInstallOperationConfig.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaOsgiBundlesLibraryProviderInstallOperationConfig.java deleted file mode 100644 index 1414a3b681..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaOsgiBundlesLibraryProviderInstallOperationConfig.java +++ /dev/null @@ -1,36 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.libprov; - -import org.eclipse.jpt.common.core.internal.libprov.JptOsgiBundlesLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; - -public class JpaOsgiBundlesLibraryProviderInstallOperationConfig - extends JptOsgiBundlesLibraryProviderInstallOperationConfig - implements JpaLibraryProviderInstallOperationConfig { - - private JpaPlatformDescription jpaPlatform; - - - public JpaOsgiBundlesLibraryProviderInstallOperationConfig() { - super(); - } - - public JpaPlatformDescription getJpaPlatform() { - return this.jpaPlatform; - } - - public void setJpaPlatform(JpaPlatformDescription jpaPlatform) { - JpaPlatformDescription old = this.jpaPlatform; - this.jpaPlatform = jpaPlatform; - notifyListeners(PROP_JPA_PLATFORM, old, jpaPlatform); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaUserLibraryProviderInstallOperationConfig.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaUserLibraryProviderInstallOperationConfig.java deleted file mode 100644 index 9f28287e06..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/JpaUserLibraryProviderInstallOperationConfig.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.libprov; - -import org.eclipse.jpt.common.core.internal.libprov.JptUserLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jpa.core.libprov.JpaLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; - -public class JpaUserLibraryProviderInstallOperationConfig - extends JptUserLibraryProviderInstallOperationConfig - implements JpaLibraryProviderInstallOperationConfig { - - private JpaPlatformDescription jpaPlatform; - - - public JpaUserLibraryProviderInstallOperationConfig() { - super(); - } - - - public JpaPlatformDescription getJpaPlatform() { - return this.jpaPlatform; - } - - public void setJpaPlatform(JpaPlatformDescription jpaPlatform) { - JpaPlatformDescription old = this.jpaPlatform; - this.jpaPlatform = jpaPlatform; - notifyListeners(PROP_JPA_PLATFORM, old, jpaPlatform); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderDetector.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderDetector.java deleted file mode 100644 index 1a7c1eca30..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderDetector.java +++ /dev/null @@ -1,35 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.libprov; - -import org.eclipse.core.resources.IProject; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jst.common.project.facet.core.libprov.ILibraryProvider; -import org.eclipse.jst.common.project.facet.core.libprov.LegacyLibraryProviderDetector; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderFramework; -import org.eclipse.wst.common.project.facet.core.IProjectFacet; - -public class LegacyJpaLibraryProviderDetector - extends LegacyLibraryProviderDetector -{ - public static final String LEGACY_JPA_LIBRARY_PROVIDER_ID - = "jpa-legacy-library-provider"; //$NON-NLS-1$ - - - @Override - public ILibraryProvider detect( - final IProject project, final IProjectFacet facet) { - if (facet.equals(JpaFacet.FACET)) { - return LibraryProviderFramework.getProvider(LEGACY_JPA_LIBRARY_PROVIDER_ID); - } - return null; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderUninstallOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderUninstallOperation.java deleted file mode 100644 index 996c67dcfd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libprov/LegacyJpaLibraryProviderUninstallOperation.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.libprov; - -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperation; -import org.eclipse.jst.common.project.facet.core.libprov.LibraryProviderOperationConfig; - -public class LegacyJpaLibraryProviderUninstallOperation - extends LibraryProviderOperation -{ - @Override - public void execute( - LibraryProviderOperationConfig config, IProgressMonitor monitor) - throws CoreException { - // no op - nothing to uninstall - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java deleted file mode 100644 index 71e7bf352b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/AbstractOsgiBundlesLibraryValidator.java +++ /dev/null @@ -1,64 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.libval; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jpt.common.core.libval.LibraryValidator; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.internal.JptCoreMessages; -import org.eclipse.jpt.jpa.core.internal.libprov.JpaOsgiBundlesLibraryProviderInstallOperationConfig; -import org.eclipse.jst.common.project.facet.core.libprov.osgi.BundleReference; -import org.eclipse.osgi.service.resolver.VersionRange; -import org.eclipse.osgi.util.NLS; -import org.osgi.framework.Bundle; - -public abstract class AbstractOsgiBundlesLibraryValidator - implements LibraryValidator { - - protected IStatus validate( - JpaOsgiBundlesLibraryProviderInstallOperationConfig config, - Map bundleVersionRanges) { - - Map bundles = new HashMap(); - - for (BundleReference bundleRef : config.getBundleReferences()) { - for (String bundleName : bundleVersionRanges.keySet()) { - // if we've gotten here, the bundle references are resolvable - if (bundleRef.getBundle().getSymbolicName().equals(bundleName)) { - bundles.put(bundleName, bundleRef.getBundle()); - } - } - } - - for (String bundleName : bundleVersionRanges.keySet()) { - if (bundles.get(bundleName) == null) { - String message - = NLS.bind(JptCoreMessages.OSGI_BUNDLES_LIBRARY_VALIDATOR__BUNDLE_NOT_FOUND, bundleName); - return new Status(IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID, message); - } - } - - for (String bundleName : bundleVersionRanges.keySet()) { - Bundle bundle = bundles.get(bundleName); - for (VersionRange versionRange : bundleVersionRanges.get(bundleName)) { - if (! versionRange.isIncluded(bundle.getVersion())) { - String message - = NLS.bind(JptCoreMessages.OSGI_BUNDLES_LIBRARY_VALIDATOR__IMPROPER_BUNDLE_VERSION, bundleName); - return new Status(IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID, message); - } - } - } - - return Status.OK_STATUS; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java deleted file mode 100644 index 93e8012aab..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericEclipseLinkBundlesLibraryValidator.java +++ /dev/null @@ -1,38 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.libval; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.internal.libprov.JpaOsgiBundlesLibraryProviderInstallOperationConfig; -import org.eclipse.osgi.service.resolver.VersionRange; - -public class GenericEclipseLinkBundlesLibraryValidator - extends AbstractOsgiBundlesLibraryValidator { - - public IStatus validate(JptLibraryProviderInstallOperationConfig config) { - JpaOsgiBundlesLibraryProviderInstallOperationConfig jpaConfig - = (JpaOsgiBundlesLibraryProviderInstallOperationConfig) config; - Map bundleVersionRanges = new HashMap(); - String bundleName = "javax.persistence"; //$NON-NLS-1$ - VersionRange[] versionRanges = new VersionRange[0]; - if (config.getProjectFacetVersion().equals(JpaFacet.VERSION_1_0)) { - versionRanges = new VersionRange[] {new VersionRange("[1.0, 3.0)")}; //$NON-NLS-1$ - } - else if (config.getProjectFacetVersion().equals(JpaFacet.VERSION_2_0)) { - versionRanges = new VersionRange[] {new VersionRange("[2.0, 3.0)")}; //$NON-NLS-1$ - } - bundleVersionRanges.put(bundleName, versionRanges); - return validate(jpaConfig, bundleVersionRanges); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java deleted file mode 100644 index 6c7c9de652..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/libval/GenericJpaUserLibraryValidator.java +++ /dev/null @@ -1,46 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.libval; - -import java.util.HashSet; -import java.util.Set; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.jdt.core.IClasspathEntry; -import org.eclipse.jpt.common.core.internal.libval.LibValUtil; -import org.eclipse.jpt.common.core.libprov.JptLibraryProviderInstallOperationConfig; -import org.eclipse.jpt.common.core.libval.LibraryValidator; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.internal.libprov.JpaUserLibraryProviderInstallOperationConfig; - -public class GenericJpaUserLibraryValidator - implements LibraryValidator { - - public IStatus validate(JptLibraryProviderInstallOperationConfig config) { - JpaUserLibraryProviderInstallOperationConfig jpaConfig - = (JpaUserLibraryProviderInstallOperationConfig) config; - Set classNames = new HashSet(); - classNames.add("javax.persistence.Entity"); //$NON-NLS-1$ - if (config.getProjectFacetVersion().compareTo(JpaFacet.VERSION_2_0) >= 0) { - classNames.add("javax.persistence.ElementCollection"); //$NON-NLS-1$ - } - - Iterable libraryPaths = - new TransformationIterable(jpaConfig.resolve()) { - @Override - protected IPath transform(IClasspathEntry o) { - return o.getPath(); - } - }; - - return LibValUtil.validate(libraryPaths, classNames); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java deleted file mode 100644 index 1ab0a16337..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationDataModelProvider.java +++ /dev/null @@ -1,157 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.operations; - -import java.util.Set; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.internal.operations.AbstractJptFileCreationDataModelProvider; -import org.eclipse.jpt.common.core.resource.ResourceLocator; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.internal.JptCoreMessages; -import org.eclipse.wst.common.project.facet.core.IFacetedProject; -import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager; - -public abstract class AbstractJpaFileCreationDataModelProvider - extends AbstractJptFileCreationDataModelProvider - implements JpaFileCreationDataModelProperties -{ - protected AbstractJpaFileCreationDataModelProvider() { - super(); - } - - - @Override - public Set getPropertyNames() { - Set propertyNames = super.getPropertyNames(); - propertyNames.add(VERSION); - return propertyNames; - } - - @Override - public Object getDefaultProperty(String propertyName) { - if (propertyName.equals(VERSION)) { - return getDefaultVersion(); - } - return super.getDefaultProperty(propertyName); - } - - protected abstract String getDefaultVersion(); - - - // **************** validation ********************************************* - - @Override - public IStatus validate(String propertyName) { - IStatus status = super.validate(propertyName); - if (! status.isOK()) { - return status; - } - if (propertyName.equals(CONTAINER_PATH) - || propertyName.equals(VERSION)) { - status = validateVersion(); - } - if (! status.isOK()) { - return status; - } - - return status; - } - - @Override - protected IStatus validateContainerPathAndFileName() { - IStatus status = super.validateContainerPathAndFileName(); - if (! status.isOK()) { - return status; - } - IContainer container = getContainer(); - IProject project = getProject(container); - if (! JpaFacet.isInstalled(project)) { - // verifies project has jpa facet - return new Status( - IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID, - JptCoreMessages.VALIDATE_PROJECT_NOT_JPA); - } - if (! hasSupportedPlatform(project)) { - // verifies project has platform that supports this file type - return new Status( - IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID, - JptCoreMessages.VALIDATE_PROJECT_IMPROPER_PLATFORM); - } - ResourceLocator resourceLocator = JptCommonCorePlugin.getResourceLocator(project); - if (resourceLocator != null /* should never be null, but there might be crazy circumstances */ - && ! resourceLocator.acceptResourceLocation(project, container)) { - return new Status( - IStatus.WARNING, JptJpaCorePlugin.PLUGIN_ID, - JptCoreMessages.VALIDATE_CONTAINER_QUESTIONABLE); - } - return Status.OK_STATUS; - } - - protected IStatus validateVersion() { - if (getProject() == null) { - return Status.OK_STATUS; - } - String fileVersion = getStringProperty(VERSION); - if (! fileVersionSupported(fileVersion)) { - return new Status( - IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID, - JptCoreMessages.VALIDATE_FILE_VERSION_NOT_SUPPORTED); - } - try { - String jpaFacetVersion = getJpaFacetVersion(getProject()); - if (! fileVersionSupportedForFacetVersion(fileVersion, jpaFacetVersion)) { - return new Status( - IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID, - JptCoreMessages.VALIDATE_FILE_VERSION_NOT_SUPPORTED_FOR_FACET_VERSION); - } - } - catch (CoreException ce) { - // project should have been validated already, so assume that this will never get hit - // fall through to final return - } - return Status.OK_STATUS; - } - - protected abstract boolean fileVersionSupported(String fileVersion); - - protected abstract boolean fileVersionSupportedForFacetVersion(String fileVersion, String jpaFacetVersion); - - - // **************** helper methods ***************************************** - - protected JpaProject getJpaProject() { - return getJpaProject(getProject()); - } - - protected JpaProject getJpaProject(IProject project) { - return (project == null) ? null : JptJpaCorePlugin.getJpaProject(project); - } - - protected String getJpaFacetVersion(IProject project) throws CoreException { - IFacetedProject fproj = ProjectFacetsManager.create(project); - return fproj.getProjectFacetVersion(JpaFacet.FACET).getVersionString(); - } - - protected boolean hasSupportedPlatform(IProject project) { - JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(project); - return (jpaProject != null) && isSupportedPlatformId(jpaProject.getJpaPlatform().getId()); - } - - protected boolean isSupportedPlatformId(@SuppressWarnings("unused") String id) { - return true; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java deleted file mode 100644 index e27c9479b5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/AbstractJpaFileCreationOperation.java +++ /dev/null @@ -1,132 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.operations; - - -import static org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties.*; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.jpt.common.core.internal.utility.PlatformTools; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider; -import org.eclipse.wst.common.frameworks.datamodel.AbstractDataModelOperation; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public abstract class AbstractJpaFileCreationOperation - extends AbstractDataModelOperation -{ - /** - * Will be null until container is created or verified to exist - */ - protected IContainer container; - - /** - * Will be null until file is created or verified to exist - */ - protected IFile file; - - - protected AbstractJpaFileCreationOperation(IDataModel dataModel) { - super(dataModel); - } - - - @Override - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - SubMonitor sm = SubMonitor.convert(monitor, 5); - // Create folder if it does not exist - createContainer(sm.newChild(1)); - // Create file - createFile(sm.newChild(4)); - return OK_STATUS; - } - - protected IContainer getContainer() throws ExecutionException { - IPath containerPath = (IPath) getDataModel().getProperty(CONTAINER_PATH); - IContainer container = PlatformTools.getContainer(containerPath); - if (container == null) { - throw new ExecutionException("No container path specified"); //$NON-NLS-1$ - } - return container; - } - - protected IProject getProject() throws ExecutionException { - return getContainer().getProject(); - } - - protected JpaProject getJpaProject() throws ExecutionException { - IProject project = getProject(); - JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(project); - if (jpaProject == null) { - throw new ExecutionException("Project does not have JPA facet"); //$NON-NLS-1$ - } - return jpaProject; - } - - /** - * This method will create the container as specified in the data model if it does not exist. - */ - protected void createContainer(IProgressMonitor monitor) throws ExecutionException { - IContainer container = getContainer(); - if (! container.exists()) { - if (container.getType() == IContainer.PROJECT) { - throw new ExecutionException("Project does not exist"); - } - else if (container.getType() == IContainer.FOLDER) { - try { - ((IFolder) container).create(true, true, null); - } - catch (CoreException e) { - throw new ExecutionException("Could not create folder", e); //$NON-NLS-1$ - } - } - else { - throw new ExecutionException("Container is not a project or folder"); //$NON-NLS-1$ - } - } - this.container = container; - } - - protected void createFile(IProgressMonitor monitor) throws ExecutionException { - String fileName = getDataModel().getStringProperty(FILE_NAME); - IFile newFile = this.container.getFile(new Path(fileName)); - AbstractXmlResourceProvider resourceProvider = getXmlResourceProvider(newFile); - try { - resourceProvider.createFileAndResource(getDataModel(), monitor); - } - catch (CoreException e) { - throw new ExecutionException("Could not create file", e); - } - this.file = newFile; - } - - @Override - public ISchedulingRule getSchedulingRule() { - try { - return this.getProject(); - } catch (ExecutionException ex) { - throw new RuntimeException(ex); - } - } - - protected abstract AbstractXmlResourceProvider getXmlResourceProvider(IFile file); -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/JpaFileCreationDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/JpaFileCreationDataModelProperties.java deleted file mode 100644 index e321504544..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/JpaFileCreationDataModelProperties.java +++ /dev/null @@ -1,22 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2011 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.operations; - -import org.eclipse.jpt.common.core.internal.operations.JptFileCreationDataModelProperties; - -public interface JpaFileCreationDataModelProperties extends JptFileCreationDataModelProperties -{ - - /** - * Required, type {@link String}, identifies the version of the file to create - */ - String VERSION = "JpaFileCreationDataModelProperties.VERSION"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProperties.java deleted file mode 100644 index 2f7bb7ebc5..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProperties.java +++ /dev/null @@ -1,32 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2011 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.operations; - -public interface OrmFileCreationDataModelProperties - extends JpaFileCreationDataModelProperties -{ - /** - * Optional, type AccessType, specifies the default access type (or null) - */ - String DEFAULT_ACCESS = "OrmFileCreationDataModelProperties.DEFAULT_ACCESS"; //$NON-NLS-1$ - - /** - * Required, type Boolean, specifies whether to add a reference to the file - * in the persistence unit - */ - String ADD_TO_PERSISTENCE_UNIT = "OrmFileCreationDataModelProperties.ADD_TO_PERSISTENCE_UNIT"; //$NON-NLS-1$ - - /** - * Optional (unless ADD_TO_PERSISTENCE_UNIT property is true), type String, - * identifies the persistence unit to which to add a reference to the file - */ - String PERSISTENCE_UNIT = "OrmFileCreationDataModelProperties.PERSISTENCE_UNIT"; //$NON-NLS-1$ -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java deleted file mode 100644 index 57cf4806bb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationDataModelProvider.java +++ /dev/null @@ -1,280 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.operations; - -import java.util.Iterator; -import java.util.Set; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.Status; -import org.eclipse.jpt.common.utility.internal.ArrayTools; -import org.eclipse.jpt.common.utility.internal.StringTools; -import org.eclipse.jpt.common.utility.internal.iterators.CompositeIterator; -import org.eclipse.jpt.common.utility.internal.iterators.EmptyIterator; -import org.eclipse.jpt.common.utility.internal.iterators.TransformationIterator; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.jpt.jpa.core.internal.JptCoreMessages; -import org.eclipse.jpt.jpa.core.resource.orm.AccessType; -import org.eclipse.jpt.jpa.core.resource.orm.JPA; -import org.eclipse.jpt.jpa.core.resource.orm.v2_0.JPA2_0; -import org.eclipse.osgi.util.NLS; -import org.eclipse.wst.common.frameworks.datamodel.DataModelPropertyDescriptor; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - -public class OrmFileCreationDataModelProvider - extends AbstractJpaFileCreationDataModelProvider - implements OrmFileCreationDataModelProperties -{ - /** - * required default constructor - */ - public OrmFileCreationDataModelProvider() { - super(); - } - - - @Override - public IDataModelOperation getDefaultOperation() { - return new OrmFileCreationOperation(getDataModel()); - } - - @Override - public Set getPropertyNames() { - Set propertyNames = super.getPropertyNames(); - propertyNames.add(DEFAULT_ACCESS); - propertyNames.add(ADD_TO_PERSISTENCE_UNIT); - propertyNames.add(PERSISTENCE_UNIT); - return propertyNames; - } - - @Override - public boolean isPropertyEnabled(String propertyName) { - if (propertyName.equals(PERSISTENCE_UNIT)) { - return getBooleanProperty(ADD_TO_PERSISTENCE_UNIT); - } - return super.isPropertyEnabled(propertyName); - } - - @Override - public Object getDefaultProperty(String propertyName) { - if (propertyName.equals(DEFAULT_ACCESS)) { - return null; - } - else if (propertyName.equals(ADD_TO_PERSISTENCE_UNIT)) { - return Boolean.FALSE; - } - else if (propertyName.equals(PERSISTENCE_UNIT)) { - PersistenceUnit pUnit = getDefaultPersistenceUnit(); - if (pUnit != null) { - return pUnit.getName(); - } - } - return super.getDefaultProperty(propertyName); - } - - @Override - protected String getDefaultFileName() { - return JptJpaCorePlugin.DEFAULT_ORM_XML_RUNTIME_PATH.lastSegment(); - } - - @Override - protected String getDefaultVersion() { - if (getProject() == null) { - return null; - } - JpaPlatform jpaPlatform; - JpaProject jpaProject = getJpaProject(); - jpaPlatform = (jpaProject == null) - ? JptJpaCorePlugin.getJpaPlatformManager().buildJpaPlatformImplementation(getProject()) - : jpaProject.getJpaPlatform(); - return jpaPlatform.getMostRecentSupportedResourceType(JptJpaCorePlugin.ORM_XML_CONTENT_TYPE).getVersion(); - } - - protected PersistenceUnit getDefaultPersistenceUnit() { - JpaProject jpaProject = getJpaProject(); - if (jpaProject == null) { - return null; - } - PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml(); - if (persistenceXml == null) { - return null; - } - Persistence persistence = persistenceXml.getPersistence(); - if (persistence == null) { - return null; - } - if (persistence.persistenceUnitsSize() == 0) { - return null; - } - return persistence.persistenceUnits().next(); - } - - @Override - public boolean propertySet(String propertyName, Object propertyValue) { - boolean ok = super.propertySet(propertyName, propertyValue); - if (propertyName.equals(CONTAINER_PATH)) { - this.model.notifyPropertyChange(PERSISTENCE_UNIT, IDataModel.DEFAULT_CHG); - this.model.notifyPropertyChange(PERSISTENCE_UNIT, IDataModel.VALID_VALUES_CHG); - } - else if (propertyName.equals(ADD_TO_PERSISTENCE_UNIT)) { - this.model.notifyPropertyChange(PERSISTENCE_UNIT, IDataModel.ENABLE_CHG); - } - return ok; - } - - @Override - public DataModelPropertyDescriptor[] getValidPropertyDescriptors(String propertyName) { - if (propertyName.equals(DEFAULT_ACCESS)) { - DataModelPropertyDescriptor[] accessTypes = new DataModelPropertyDescriptor[3]; - accessTypes[0] = accessPropertyDescriptor(null); - accessTypes[1] = accessPropertyDescriptor(AccessType.FIELD); - accessTypes[2] = accessPropertyDescriptor(AccessType.PROPERTY); - return accessTypes; - } - else if (propertyName.equals(PERSISTENCE_UNIT)) { - return ArrayTools.array( - new TransformationIterator(new CompositeIterator(null, persistenceUnitNames())) { - @Override - protected DataModelPropertyDescriptor transform(String next) { - return persistenceUnitPropertyDescriptor(next); - } - }, - new DataModelPropertyDescriptor[0]); - } - return super.getValidPropertyDescriptors(propertyName); - } - - @Override - public DataModelPropertyDescriptor getPropertyDescriptor(String propertyName) { - if (propertyName.equals(DEFAULT_ACCESS)) { - return accessPropertyDescriptor((AccessType) getProperty(DEFAULT_ACCESS)); - } - if (propertyName.equals(PERSISTENCE_UNIT)) { - return persistenceUnitPropertyDescriptor(getStringProperty(PERSISTENCE_UNIT)); - } - return super.getPropertyDescriptor(propertyName); - } - - protected DataModelPropertyDescriptor accessPropertyDescriptor(AccessType accessType) { - if (accessType == null) { - return new DataModelPropertyDescriptor(null, JptCoreMessages.NONE); - } - return new DataModelPropertyDescriptor(accessType, accessType.getName()); - } - - DataModelPropertyDescriptor persistenceUnitPropertyDescriptor(String persistenceUnitName) { - if (StringTools.stringIsEmpty(persistenceUnitName)) { - return new DataModelPropertyDescriptor(null, JptCoreMessages.NONE); - } - return new DataModelPropertyDescriptor(persistenceUnitName); - } - - - // **************** validation ********************************************* - - @Override - public IStatus validate(String propertyName) { - IStatus status = super.validate(propertyName); - if (! status.isOK()) { - return status; - } - - if (propertyName.equals(ADD_TO_PERSISTENCE_UNIT) - || propertyName.equals(PERSISTENCE_UNIT)) { - status = validatePersistenceUnit(); - } - if (! status.isOK()) { - return status; - } - - return Status.OK_STATUS; - } - - @Override - protected boolean fileVersionSupported(String fileVersion) { - return (fileVersion.equals(JPA.SCHEMA_VERSION) - || fileVersion.equals(JPA2_0.SCHEMA_VERSION)); - } - - @Override - protected boolean fileVersionSupportedForFacetVersion(String fileVersion, String jpaFacetVersion) { - if (jpaFacetVersion.equals(JpaFacet.VERSION_1_0.getVersionString()) - && fileVersion.equals(JPA2_0.SCHEMA_VERSION)) { - return false; - } - return true; - } - - protected IStatus validatePersistenceUnit() { - boolean addToPUnit = getBooleanProperty(ADD_TO_PERSISTENCE_UNIT); - String projectName = getProject().getName(); - String pUnitName = getStringProperty(PERSISTENCE_UNIT); - if (addToPUnit) { - if (StringTools.stringIsEmpty(pUnitName)) { - return new Status( - IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID, - NLS.bind(JptCoreMessages.VALIDATE_PERSISTENCE_UNIT_DOES_NOT_SPECIFIED, pUnitName)); - } - if (getPersistenceUnit() == null) { - return new Status( - IStatus.ERROR, JptJpaCorePlugin.PLUGIN_ID, - NLS.bind(JptCoreMessages.VALIDATE_PERSISTENCE_UNIT_NOT_IN_PROJECT, pUnitName, projectName)); - } - } - return Status.OK_STATUS; - } - - - // **************** helper methods ***************************************** - - protected PersistenceUnit getPersistenceUnit() { - String pUnitName = getStringProperty(PERSISTENCE_UNIT); - JpaProject jpaProject = - (StringTools.stringIsEmpty(pUnitName)) ? null : getJpaProject(); - PersistenceXml persistenceXml = - (jpaProject == null) ? null : jpaProject.getRootContextNode().getPersistenceXml(); - Persistence persistence = - (persistenceXml == null) ? null : persistenceXml.getPersistence(); - if (persistence != null) { - for (Iterator stream = persistence.persistenceUnits(); stream.hasNext(); ) { - PersistenceUnit next = stream.next(); - if (pUnitName.equals(next.getName())) { - return next; - } - } - } - return null; - } - - protected Iterator persistenceUnits() { - //only get the persistence units for the selected JpaProject, - //if no jpa project is selected, then no persistence units will be listed in the combo - JpaProject jpaProject = getJpaProject(); - PersistenceXml persistenceXml = (jpaProject == null) ? null : jpaProject.getRootContextNode().getPersistenceXml(); - Persistence persistence = (persistenceXml == null) ? null : persistenceXml.getPersistence(); - return (persistence == null) ? EmptyIterator.instance() : persistence.persistenceUnits(); - } - - protected Iterator persistenceUnitNames() { - return new TransformationIterator(persistenceUnits()) { - @Override - protected String transform(PersistenceUnit next) { - return next.getName(); - } - }; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java deleted file mode 100644 index 7f2879eede..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/OrmFileCreationOperation.java +++ /dev/null @@ -1,108 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.operations; - -import java.util.Iterator; -import org.eclipse.core.commands.ExecutionException; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IAdaptable; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.IStatus; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.core.internal.utility.PlatformTools; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.jpt.jpa.core.internal.resource.orm.OrmXmlResourceProvider; -import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider; -import org.eclipse.jpt.jpa.core.resource.xml.JpaXmlResource; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class OrmFileCreationOperation - extends AbstractJpaFileCreationOperation - implements OrmFileCreationDataModelProperties -{ - public OrmFileCreationOperation(IDataModel dataModel) { - super(dataModel); - } - - - @Override - public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { - SubMonitor sm = SubMonitor.convert(monitor, 5); - IStatus status = super.execute(sm.newChild(4), info); - - if (status.isOK()) { - addMappingFileToPersistenceXml(); - sm.worked(1); - } - - return OK_STATUS; - } - - protected PersistenceUnit getPersistenceUnit() throws ExecutionException { - String pUnitName = getDataModel().getStringProperty(PERSISTENCE_UNIT); - JpaProject jpaProject = getJpaProject(); - PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml(); - if (persistenceXml == null) { - throw new ExecutionException("Project does not have a persistence.xml file"); //$NON-NLS-1$ - } - Persistence persistence = persistenceXml.getPersistence(); - if (persistence == null) { - throw new ExecutionException("persistence.xml does not have a persistence node."); //$NON-NLS-1$ - } - for (Iterator stream = persistence.persistenceUnits(); stream.hasNext(); ) { - PersistenceUnit pUnit = stream.next(); - if (pUnitName.equals(pUnit.getName())) { - return pUnit; - } - } - throw new ExecutionException("persistence.xml does not have persistence unit named \'" + pUnitName + "\'"); //$NON-NLS-1$ - } - - protected void addMappingFileToPersistenceXml() throws ExecutionException { - if (! getDataModel().getBooleanProperty(ADD_TO_PERSISTENCE_UNIT)) { - return; - } - JpaProject jpaProject = JptJpaCorePlugin.getJpaProject(this.file.getProject()); - JpaXmlResource resource = jpaProject.getPersistenceXmlResource(); - - final PersistenceUnit pUnit = getPersistenceUnit(); - - resource.modify(new Runnable() { - public void run() { - IPath containerPath = (IPath) getDataModel().getProperty(CONTAINER_PATH); - String fileName = getDataModel().getStringProperty(FILE_NAME); - IContainer container = PlatformTools.getContainer(containerPath); - IPath filePath = container.getFullPath().append(fileName); - IProject project = container.getProject(); - IPath runtimePath = JptCommonCorePlugin.getResourceLocator(project).getRuntimePath(project, filePath); - for (Iterator stream = pUnit.specifiedMappingFileRefs(); stream.hasNext(); ) { - if (runtimePath.equals(stream.next().getFileName())) { - return; - } - } - pUnit.addSpecifiedMappingFileRef(runtimePath.toString()); - } - }); - } - - @Override - protected AbstractXmlResourceProvider getXmlResourceProvider(IFile file) { - return OrmXmlResourceProvider.getXmlResourceProvider(file); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProperties.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProperties.java deleted file mode 100644 index 9b74e68753..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProperties.java +++ /dev/null @@ -1,17 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.operations; - -public interface PersistenceFileCreationDataModelProperties - extends JpaFileCreationDataModelProperties -{ - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProvider.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProvider.java deleted file mode 100644 index 506f97545a..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationDataModelProvider.java +++ /dev/null @@ -1,73 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.operations; - -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.resource.persistence.JPA; -import org.eclipse.jpt.jpa.core.resource.persistence.v2_0.JPA2_0; -import org.eclipse.wst.common.frameworks.datamodel.IDataModelOperation; - -public class PersistenceFileCreationDataModelProvider - extends AbstractJpaFileCreationDataModelProvider - implements PersistenceFileCreationDataModelProperties -{ - /** - * required default constructor - */ - public PersistenceFileCreationDataModelProvider() { - super(); - } - - - @Override - public IDataModelOperation getDefaultOperation() { - return new PersistenceFileCreationOperation(getDataModel()); - } - - @Override - protected String getDefaultFileName() { - return JptJpaCorePlugin.DEFAULT_PERSISTENCE_XML_RUNTIME_PATH.lastSegment(); - } - - @Override - protected String getDefaultVersion() { - if (getProject() == null) { - return null; - } - JpaPlatform jpaPlatform; - JpaProject jpaProject = getJpaProject(); - jpaPlatform = (jpaProject == null) - ? JptJpaCorePlugin.getJpaPlatformManager().buildJpaPlatformImplementation(getProject()) - : jpaProject.getJpaPlatform(); - return jpaPlatform.getMostRecentSupportedResourceType(JptJpaCorePlugin.PERSISTENCE_XML_CONTENT_TYPE).getVersion(); - } - - - // **************** validation ********************************************* - - @Override - protected boolean fileVersionSupported(String fileVersion) { - return (fileVersion.equals(JPA.SCHEMA_VERSION) - || fileVersion.equals(JPA2_0.SCHEMA_VERSION)); - } - - @Override - protected boolean fileVersionSupportedForFacetVersion(String fileVersion, String jpaFacetVersion) { - if (jpaFacetVersion.equals(JpaFacet.VERSION_1_0.getVersionString()) - && fileVersion.equals(JPA2_0.SCHEMA_VERSION)) { - return false; - } - return true; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationOperation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationOperation.java deleted file mode 100644 index 996b0454b3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/operations/PersistenceFileCreationOperation.java +++ /dev/null @@ -1,31 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.operations; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jpt.jpa.core.internal.resource.persistence.PersistenceXmlResourceProvider; -import org.eclipse.jpt.jpa.core.resource.AbstractXmlResourceProvider; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; - -public class PersistenceFileCreationOperation - extends AbstractJpaFileCreationOperation - implements PersistenceFileCreationDataModelProperties -{ - public PersistenceFileCreationOperation(IDataModel dataModel) { - super(dataModel); - } - - - @Override - protected AbstractXmlResourceProvider getXmlResourceProvider(IFile file) { - return PersistenceXmlResourceProvider.getXmlResourceProvider(file); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java deleted file mode 100644 index 4a602f15f7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformDescriptionImpl.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.platform; - -import org.eclipse.jpt.common.core.internal.XPointUtil; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JpaPlatformFactory; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -public class JpaPlatformDescriptionImpl - implements JpaPlatformDescription { - - private String id; - private String pluginId; - private String label; - private String factoryClassName; - private IProjectFacetVersion jpaFacetVersion; - private boolean default_ = false; - private JpaPlatformGroupDescriptionImpl group; - - - public String getId() { - return this.id; - } - - void setId(String id) { - this.id = id; - } - - public String getPluginId() { - return this.pluginId; - } - - void setPluginId(String pluginId) { - this.pluginId = pluginId; - } - - public String getLabel() { - return this.label; - } - - void setLabel(String label) { - this.label = label; - } - - public String getFactoryClassName() { - return this.factoryClassName; - } - - void setFactoryClassName(String className) { - this.factoryClassName = className; - } - - public IProjectFacetVersion getJpaFacetVersion() { - return this.jpaFacetVersion; - } - - void setJpaFacetVersion(IProjectFacetVersion jpaFacetVersion) { - if (! jpaFacetVersion.getProjectFacet().equals(JpaFacet.FACET)) { - throw new IllegalArgumentException(jpaFacetVersion.toString()); - } - this.jpaFacetVersion = jpaFacetVersion; - } - - public boolean supportsJpaFacetVersion(IProjectFacetVersion jpaFacetVersion) { - if (! jpaFacetVersion.getProjectFacet().equals(JpaFacet.FACET)) { - throw new IllegalArgumentException(jpaFacetVersion.toString()); - } - return (this.jpaFacetVersion != null) ? this.jpaFacetVersion.equals(jpaFacetVersion) : true; - } - - public boolean isDefault() { - return this.default_; - } - - void setDefault(boolean default_) { - this.default_ = default_; - } - - public JpaPlatformGroupDescription getGroup() { - return this.group; - } - - void setGroup(JpaPlatformGroupDescriptionImpl group) { - this.group = group; - } - - public JpaPlatform buildJpaPlatform() { - JpaPlatformFactory factory = (JpaPlatformFactory) XPointUtil.instantiate( - this.pluginId, JpaPlatformManagerImpl.QUALIFIED_EXTENSION_POINT_ID, - this.factoryClassName, JpaPlatformFactory.class); - return factory.buildJpaPlatform(getId()); - } - - @Override - public String toString() { - return this.label; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformGroupDescriptionImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformGroupDescriptionImpl.java deleted file mode 100644 index 2ca9afe58c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformGroupDescriptionImpl.java +++ /dev/null @@ -1,68 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.platform; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription; - -public class JpaPlatformGroupDescriptionImpl - implements JpaPlatformGroupDescription { - - private String id; - private String pluginId; - private String label; - private Map platforms; - - - JpaPlatformGroupDescriptionImpl() { - this.platforms = new HashMap(); - } - - public String getId() { - return this.id; - } - - void setId(String id) { - this.id = id; - } - - public String getPluginId() { - return this.pluginId; - } - - void setPluginId(String pluginId) { - this.pluginId = pluginId; - } - - public String getLabel() { - return this.label; - } - - void setLabel(String label) { - this.label = label; - } - - void addPlatform(JpaPlatformDescriptionImpl platform) { - this.platforms.put(platform.getId(), platform); - } - - public Iterable getPlatforms() { - return new SuperIterableWrapper(CollectionTools.collection(this.platforms.values())); - } - - @Override - public String toString() { - return this.label; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformManagerImpl.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformManagerImpl.java deleted file mode 100644 index 847aa3b558..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/platform/JpaPlatformManagerImpl.java +++ /dev/null @@ -1,238 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.platform; - -import static org.eclipse.jpt.common.core.internal.XPointUtil.*; -import java.util.ArrayList; -import java.util.List; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.IConfigurationElement; -import org.eclipse.core.runtime.IExtension; -import org.eclipse.core.runtime.IExtensionPoint; -import org.eclipse.core.runtime.IExtensionRegistry; -import org.eclipse.core.runtime.Platform; -import org.eclipse.jpt.common.core.internal.XPointUtil.XPointException; -import org.eclipse.jpt.common.utility.internal.KeyedSet; -import org.eclipse.jpt.common.utility.internal.iterables.SuperIterableWrapper; -import org.eclipse.jpt.jpa.core.JpaFacet; -import org.eclipse.jpt.jpa.core.JpaPlatform; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformDescription; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformGroupDescription; -import org.eclipse.jpt.jpa.core.platform.JpaPlatformManager; -import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion; - -/** - * Singleton registry for storing all the registered JPA platform configuration - * elements and instantiating JPA platforms from them. - */ -public class JpaPlatformManagerImpl - implements JpaPlatformManager { - - static final String EXTENSION_POINT_ID = "jpaPlatforms"; //$NON-NLS-1$ - static final String QUALIFIED_EXTENSION_POINT_ID = JptJpaCorePlugin.PLUGIN_ID_ + EXTENSION_POINT_ID; - static final String PLATFORM_GROUP_ELEMENT = "jpaPlatformGroup"; //$NON-NLS-1$ - static final String PLATFORM_ELEMENT = "jpaPlatform"; //$NON-NLS-1$ - static final String ID_ATTRIBUTE = "id"; //$NON-NLS-1$ - static final String LABEL_ATTRIBUTE = "label"; //$NON-NLS-1$ - static final String FACTORY_CLASS_ATTRIBUTE = "factoryClass"; //$NON-NLS-1$ - static final String JPA_FACET_VERSION_ATTRIBUTE = "jpaFacetVersion"; //$NON-NLS-1$ - static final String DEFAULT_ATTRIBUTE = "default"; //$NON-NLS-1$ - static final String GROUP_ELEMENT = "group"; //$NON-NLS-1$ - - - private static final JpaPlatformManagerImpl INSTANCE = new JpaPlatformManagerImpl(); - - - public static JpaPlatformManagerImpl instance() { - return INSTANCE; - } - - - private KeyedSet jpaPlatformGroupDescriptions; - private KeyedSet jpaPlatformDescriptions; - - - // ********** constructor/initialization ********** - - private JpaPlatformManagerImpl() { - super(); - this.jpaPlatformGroupDescriptions = new KeyedSet(); - this.jpaPlatformDescriptions = new KeyedSet(); - readExtensions(); - } - - - private void readExtensions() { - final IExtensionRegistry registry = Platform.getExtensionRegistry(); - - final IExtensionPoint xpoint - = registry.getExtensionPoint(JptJpaCorePlugin.PLUGIN_ID, EXTENSION_POINT_ID); - - if (xpoint == null) { - throw new IllegalStateException(); - } - - List platformGroupConfigs = new ArrayList(); - List platformConfigs = new ArrayList(); - - for (IExtension extension : xpoint.getExtensions()) { - for (IConfigurationElement element : extension.getConfigurationElements()) { - if (element.getName().equals(PLATFORM_GROUP_ELEMENT)) { - platformGroupConfigs.add(element); - } - else if (element.getName().equals(PLATFORM_ELEMENT)) { - platformConfigs.add(element); - } - } - } - - for (IConfigurationElement element : platformGroupConfigs) { - readPlatformGroupExtension(element); - } - - for (IConfigurationElement element : platformConfigs) { - readPlatformExtension(element); - } - } - - private void readPlatformGroupExtension(IConfigurationElement element) { - try { - final JpaPlatformGroupDescriptionImpl desc = new JpaPlatformGroupDescriptionImpl(); - - // plug-in id - desc.setPluginId(element.getContributor().getName()); - - // id - desc.setId(findRequiredAttribute(element, ID_ATTRIBUTE)); - - if (this.jpaPlatformGroupDescriptions.containsKey(desc.getId())) { - logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, desc.getId()); - throw new XPointException(); - } - - // label - desc.setLabel(findRequiredAttribute(element, LABEL_ATTRIBUTE)); - - this.jpaPlatformGroupDescriptions.addItem(desc.getId(), desc); - } - catch (XPointException e) { - // Ignore and continue. The problem has already been reported to the user - // in the log. - } - } - - private void readPlatformExtension(IConfigurationElement element) { - try { - final JpaPlatformDescriptionImpl desc = new JpaPlatformDescriptionImpl(); - - // plug-in id - desc.setPluginId(element.getContributor().getName()); - - // id - desc.setId(findRequiredAttribute(element, ID_ATTRIBUTE)); - - if (this.jpaPlatformDescriptions.containsKey(desc.getId())) { - logDuplicateExtension(QUALIFIED_EXTENSION_POINT_ID, ID_ATTRIBUTE, desc.getId()); - throw new XPointException(); - } - - // label - desc.setLabel(findRequiredAttribute(element, LABEL_ATTRIBUTE)); - - // factory class - desc.setFactoryClassName(findRequiredAttribute(element, FACTORY_CLASS_ATTRIBUTE)); - - // JPA facet version - String jpaFacetVersionString = element.getAttribute(JPA_FACET_VERSION_ATTRIBUTE); - if (jpaFacetVersionString != null) { - IProjectFacetVersion jpaFacetVersion = JpaFacet.FACET.getVersion(jpaFacetVersionString); - if (jpaFacetVersion != null) { - desc.setJpaFacetVersion(jpaFacetVersion); - } - else { - logInvalidValue(element, JPA_FACET_VERSION_ATTRIBUTE, jpaFacetVersionString); - throw new XPointException(); - } - } - - // default - String defaultString = element.getAttribute(DEFAULT_ATTRIBUTE); - if (defaultString != null) { - if (defaultString.equals("true")) { - desc.setDefault(true); - } - else if (defaultString.equals("false")) { - desc.setDefault(false); - } - else { - logInvalidValue(element, DEFAULT_ATTRIBUTE, defaultString); - throw new XPointException(); - } - } - - // group - String groupId = element.getAttribute(GROUP_ELEMENT); - if (groupId != null) { - JpaPlatformGroupDescriptionImpl group = this.jpaPlatformGroupDescriptions.getItem(groupId); - if (group != null) { - desc.setGroup(group); - group.addPlatform(desc); - } - else { - logInvalidValue(element, GROUP_ELEMENT, groupId); - throw new XPointException(); - } - } - - this.jpaPlatformDescriptions.addItem(desc.getId(), desc); - } - catch (XPointException e) { - // Ignore and continue. The problem has already been reported to the user - // in the log. - } - } - - - // ********** public methods ********** - - public Iterable getJpaPlatformGroups() { - return new SuperIterableWrapper(this.jpaPlatformGroupDescriptions.getItemSet()); - } - - public JpaPlatformGroupDescription getJpaPlatformGroup(String groupId) { - return this.jpaPlatformGroupDescriptions.getItem(groupId); - } - - public Iterable getJpaPlatforms() { - return new SuperIterableWrapper(this.jpaPlatformDescriptions.getItemSet()); - } - - public JpaPlatformDescription getJpaPlatform(String platformId) { - return this.jpaPlatformDescriptions.getItem(platformId); - } - - public JpaPlatformDescription getDefaultJpaPlatform(IProjectFacetVersion jpaFacetVersion) { - for (JpaPlatformDescription platform : getJpaPlatforms()) { - if (platform.isDefault() && platform.supportsJpaFacetVersion(jpaFacetVersion)) { - return platform; - } - } - return null; - } - public JpaPlatform buildJpaPlatformImplementation(IProject project) { - String jpaPlatformId = JptJpaCorePlugin.getJpaPlatformId(project); - JpaPlatformDescriptionImpl platformDesc = this.jpaPlatformDescriptions.getItem(jpaPlatformId); - if (platformDesc == null) { - throw new IllegalArgumentException("Project does not have a recognized JPA platform."); - } - return platformDesc.buildJpaPlatform(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferenceInitializer.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferenceInitializer.java deleted file mode 100644 index d6fd0418ca..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/prefs/JpaPreferenceInitializer.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2006, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.prefs; - -import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; - -/** - * Class used to initialize default preference values. - * See org.eclipse.core.runtime.preferences extension point. - */ -public class JpaPreferenceInitializer - extends AbstractPreferenceInitializer -{ - @Override - public void initializeDefaultPreferences() { - JptJpaCorePlugin.initializeDefaultPreferences(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java deleted file mode 100644 index 9a9ada9879..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaDeleteTypeParticipant.java +++ /dev/null @@ -1,288 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.refactoring; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Map; -import java.util.Set; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaProjectManager; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.ltk.core.refactoring.Change; -import org.eclipse.ltk.core.refactoring.CompositeChange; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.ltk.core.refactoring.TextChange; -import org.eclipse.ltk.core.refactoring.TextFileChange; -import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; -import org.eclipse.ltk.core.refactoring.participants.DeleteParticipant; -import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.MultiTextEdit; -import org.eclipse.text.edits.TextEdit; - - -public abstract class AbstractJpaDeleteTypeParticipant - extends DeleteParticipant -{ - - /** - * Store all the types that are going to be deleted including nestedTypes. - */ - protected final Set allTypes; - - /** - * Store the persistence.xml DeleteEdits in the checkConditions() call - * to avoid duplicated effort in createChange(). - */ - protected final Map> persistenceXmlDeleteEdits; - - /** - * Store the mapping file DeleteEdits in the checkConditions() call - * to avoid duplicated effort in createChange(). - */ - protected final Map> mappingFilePersistentTypeDeleteEdits; - - protected AbstractJpaDeleteTypeParticipant() { - super(); - this.allTypes = new HashSet(); - this.persistenceXmlDeleteEdits = new HashMap>(); - this.mappingFilePersistentTypeDeleteEdits = new HashMap>(); - } - - /** - * Nested types are not added to the deleteParticipant when the parent is deleted. - * We must handle them in case they are mapped. - */ - protected void addType(IType type) { - this.allTypes.add(type); - this.addNestedTypes(type); - } - - private void addNestedTypes(IType type) { - IType[] nestedTypes; - try { - nestedTypes = type.getTypes(); - } - catch (JavaModelException ex) { - JptJpaCorePlugin.log(ex); - return; - } - - for (IType nestedType : nestedTypes) { - this.addType(nestedType); - } - } - - //**************** RefactoringParticipant implementation ***************** - - /** - * Inform the refactoring processor of any files that are going to change. In the process of determining - * this go ahead and build up the appropriate DeleteEdits to be used in the createChange() - */ - @Override - public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException { - //since the progress bar will hang if a large JPA project is being loaded, - //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called. - monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME); - JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager(); - if (jpaProjectManager.getJpaProjectsSize() == 0) { - return null; - } - SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 2); - sm.subTask(this.getCheckConditionsSubTaskName()); - ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class); - IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory(); - - for (JpaProject jpaProject : jpaProjectManager.getJpaProjects()) { - this.createDeleteEdits(sm.newChild(10), jpaProject); - } - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - for (IFile file : this.persistenceXmlDeleteEdits.keySet()) { - deltaFactory.change(file); - } - sm.worked(1); - for (IFile file : this.mappingFilePersistentTypeDeleteEdits.keySet()) { - deltaFactory.change(file); - } - sm.worked(1); - - return null; - } - - /** - * This will be appended to the main refactoring task named : 'Checking preconditions...' - */ - protected String getCheckConditionsSubTaskName() { - return JpaCoreRefactoringMessages.JPA_DELETE_TYPE_REFACTORING_SUB_TASK_NAME; - } - - @Override - public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException { - if (this.persistenceXmlDeleteEdits.isEmpty() && this.mappingFilePersistentTypeDeleteEdits.isEmpty()) { - return null; - } - SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlDeleteEdits.size() + this.mappingFilePersistentTypeDeleteEdits.size()); - sm.subTask(this.getCreateChangeSubTaskName()); - CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_DELETE_TYPE_REFACTORING_CHANGE_NAME); - for (IFile persistenceXmlFile : this.persistenceXmlDeleteEdits.keySet()) { - this.addPersistenceXmlDeleteTypeChange(persistenceXmlFile, compositeChange); - sm.worked(1); - } - for (IFile mappingFile : this.mappingFilePersistentTypeDeleteEdits.keySet()) { - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - this.addMappingFileDeleteTypeChange(mappingFile, compositeChange); - sm.worked(1); - } - //must check for children in case all changes were made in other participant's TextChanges, - //want to return null so our node does not appear in the preview tree - return compositeChange.getChildren().length == 0 ? null : compositeChange; - } - - /** - * This will be appended to the main refactoring task named : 'Creating workspace modifications...' - */ - protected String getCreateChangeSubTaskName() { - return JpaCoreRefactoringMessages.JPA_DELETE_TYPE_REFACTORING_SUB_TASK_NAME; - } - - protected void createDeleteEdits(IProgressMonitor monitor, JpaProject jpaProject) throws OperationCanceledException { - PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject); - if (persistenceUnit == null) { - return; - } - SubMonitor sm = SubMonitor.convert(monitor, 1 + persistenceUnit.mappingFileRefsSize()); - Iterable persistenceXmlDeleteEdits = this.createPersistenceXmlDeleteEdits(persistenceUnit); - if (!CollectionTools.isEmpty(persistenceXmlDeleteEdits)) { - this.persistenceXmlDeleteEdits.put(jpaProject.getPersistenceXmlResource().getFile(), persistenceXmlDeleteEdits); - } - sm.worked(1); - for (MappingFileRef mappingFileRef : CollectionTools.iterable(persistenceUnit.mappingFileRefs())) { - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - Iterable mappingFileDeleteEdits = this.createMappingFileDeleteTypeEdits(mappingFileRef); - if (!CollectionTools.isEmpty(mappingFileDeleteEdits)) { - this.mappingFilePersistentTypeDeleteEdits.put((IFile) mappingFileRef.getMappingFile().getResource(), mappingFileDeleteEdits); - } - sm.worked(1); - } - } - - protected Iterable createPersistenceXmlDeleteEdits(final PersistenceUnit persistenceUnit) { - return new CompositeIterable( - new TransformationIterable>(this.getTypesOnClasspath(persistenceUnit.getJpaProject())) { - @Override - protected Iterable transform(IType type) { - return persistenceUnit.createDeleteTypeEdits(type); - } - } - ); - } - - protected Iterable getTypesOnClasspath(final JpaProject jpaProject) { - final IJavaProject javaProject = jpaProject.getJavaProject(); - return new FilteringIterable(this.allTypes) { - @Override - protected boolean accept(IType type) { - return javaProject.isOnClasspath(type); - } - }; - } - - protected void addPersistenceXmlDeleteTypeChange(IFile persistenceXmlFile, CompositeChange compositeChange) { - Iterable deleteTypeEdits = this.persistenceXmlDeleteEdits.get(persistenceXmlFile); - - TextChange textChange = getTextChange(persistenceXmlFile); - if (textChange == null) { - textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_DELETE_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile); - //TODO probably need to figure out TextEditGroups since these can be used to show check boxes under the file in the preview dialog - //also used to add edits to existing changes?? - MultiTextEdit multiTextEdit = new MultiTextEdit(); - textChange.setEdit(multiTextEdit); -// textChange.addTextEditGroup(new TextEditGroup("edit persistence unit", multiTextEdit));??? - compositeChange.add(textChange); - } - this.addEdits(textChange, deleteTypeEdits); - } - - private Iterable createMappingFileDeleteTypeEdits(final MappingFileRef mappingFileRef) { - return new CompositeIterable( - new TransformationIterable>(this.getTypesOnClasspath(mappingFileRef.getJpaProject())) { - @Override - protected Iterable transform(IType type) { - return mappingFileRef.createDeleteTypeEdits(type); - } - } - ); - } - - protected void addMappingFileDeleteTypeChange(IFile mappingFile, CompositeChange compositeChange) { - Iterable deleteTypeEdits = this.mappingFilePersistentTypeDeleteEdits.get(mappingFile); - - TextChange textChange = getTextChange(mappingFile); - if (textChange == null) { - textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_DELETE_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME, mappingFile); - MultiTextEdit multiTextEdit = new MultiTextEdit(); - textChange.setEdit(multiTextEdit); - compositeChange.add(textChange); - } - this.addEdits(textChange, deleteTypeEdits); - } - - private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) { - PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml(); - if (persistenceXml == null) { - return null; - } - Persistence persistence = persistenceXml.getPersistence(); - if (persistence == null) { - return null; - } - if (persistence.persistenceUnitsSize() != 1) { - return null; // the context model currently only supports 1 persistence unit - } - return persistence.persistenceUnits().next(); - } - - private void addEdits(TextChange textChange, Iterable textEdits) { - for (TextEdit textEdit : textEdits) { - try { - textChange.addEdit(textEdit); - } - catch (MalformedTreeException ex) { - //log exception and don't add this persistence.xml type deletion to the conflicting change object - JptJpaCorePlugin.log(ex); - } - } - } -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java deleted file mode 100644 index 13bc76ed57..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaMoveJavaElementParticipant.java +++ /dev/null @@ -1,294 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.refactoring; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaProjectManager; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.ltk.core.refactoring.Change; -import org.eclipse.ltk.core.refactoring.CompositeChange; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.ltk.core.refactoring.TextChange; -import org.eclipse.ltk.core.refactoring.TextFileChange; -import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; -import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant; -import org.eclipse.ltk.core.refactoring.participants.MoveArguments; -import org.eclipse.ltk.core.refactoring.participants.MoveParticipant; -import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments; -import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.MultiTextEdit; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.text.edits.TextEdit; - -public abstract class AbstractJpaMoveJavaElementParticipant - extends MoveParticipant implements ISharableParticipant { - - /** - * Store the {@link IJavaElements}s to be moved and their corresponding {@link MoveArguments} - */ - protected final Map originalJavaElements; - - /** - * Store the persistence.xml ReplaceEdits in the checkConditions() call - * to avoid duplicated effort in createChange(). - */ - protected final Map> persistenceXmlReplaceEdits; - - /** - * Store the mapping file ReplaceEdits in the checkConditions() call - * to avoid duplicated effort in createChange(). - */ - protected final Map> mappingFileReplaceEdits; - - protected AbstractJpaMoveJavaElementParticipant() { - super(); - this.originalJavaElements = new HashMap(); - this.persistenceXmlReplaceEdits = new HashMap>(); - this.mappingFileReplaceEdits = new HashMap>(); - } - - @Override - protected boolean initialize(Object element) { - if (!getArguments().getUpdateReferences()) { - //we do not want to do any refactoring if the user chooses not to update references - return false; - } - this.addElement(element, getArguments()); - return true; - } - - - //****************ISharableParticipant implementation ***************** - /** - * This is used when multiple mapping files are deleted. - * RefactoringParticipant#initialize(Object) is called for the first deleted IFile. - * RefactoringParticipant#getArguments() only applies to the first deleted IFile - */ - public void addElement(Object element, RefactoringArguments arguments) { - this.originalJavaElements.put((IJavaElement) element, (MoveArguments) arguments); - } - - protected MoveArguments getArguments(IJavaElement element) { - return this.originalJavaElements.get(element); - } - - //**************** RefactoringParticipant implementation ***************** - - /** - * Inform the refactoring processor of any files that are going to change. In the process of determining - * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange() - */ - @Override - public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException { - monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME); - JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager(); - if (jpaProjectManager.getJpaProjectsSize() == 0) { - return null; - } - SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 2); - sm.subTask(this.getCheckConditionsSubTaskName()); - ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class); - IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory(); - - for (JpaProject jpaProject : jpaProjectManager.getJpaProjects()) { - this.createReplaceEdits(sm.newChild(10), jpaProject); - } - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - for (IFile file : this.persistenceXmlReplaceEdits.keySet()) { - deltaFactory.change(file); - } - sm.worked(1); - for (IFile file : this.mappingFileReplaceEdits.keySet()) { - deltaFactory.change(file); - } - sm.worked(1); - - return null; - } - - protected abstract String getCompositeChangeName(); - - /** - * This will be appended to the main refactoring task named : 'Checking preconditions...' - */ - protected abstract String getCheckConditionsSubTaskName(); - - @Override - public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException { - if (this.persistenceXmlReplaceEdits.isEmpty() && this.mappingFileReplaceEdits.isEmpty()) { - return null; - } - SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlReplaceEdits.size() + this.mappingFileReplaceEdits.size()); - sm.subTask(this.getCreateChangeSubTaskName()); - CompositeChange compositeChange = new CompositeChange(this.getCompositeChangeName()); - for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) { - this.addPersistenceXmlRenameEdits(persistenceXmlFile, compositeChange); - sm.worked(1); - } - for (IFile mappingFile : this.mappingFileReplaceEdits.keySet()) { - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - this.addMappingFileRenameEdits(mappingFile, compositeChange); - sm.worked(1); - } - //must check for children in case all changes were made in other participant's TextChanges, - //want to return null so our node does not appear in the preview tree - return compositeChange.getChildren().length == 0 ? null : compositeChange; - } - - /** - * This will be appended to the main refactoring task named : 'Creating workspace modifications...' - */ - protected abstract String getCreateChangeSubTaskName(); - - protected void createReplaceEdits(IProgressMonitor monitor, JpaProject jpaProject) throws OperationCanceledException { - PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject); - if (persistenceUnit == null) { - return; - } - SubMonitor sm = SubMonitor.convert(monitor, 1 + persistenceUnit.mappingFileRefsSize()); - Iterable classRefDeleteEdits = this.createPersistenceUnitReplaceEditsCheckClasspath(persistenceUnit); - sm.worked(1); - if (!CollectionTools.isEmpty(classRefDeleteEdits)) { - this.persistenceXmlReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), classRefDeleteEdits); - } - for (MappingFileRef mappingFileRef : CollectionTools.iterable(persistenceUnit.mappingFileRefs())) { - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - Iterable mappingFileReplaceEdits = this.createMappingFileReplaceEditsCheckClasspath(mappingFileRef); - if (!CollectionTools.isEmpty(mappingFileReplaceEdits)) { - IFile file = (IFile) mappingFileRef.getMappingFile().getResource(); - this.mappingFileReplaceEdits.put(file, mappingFileReplaceEdits); - } - sm.worked(1); - } - } - - protected Iterable createPersistenceUnitReplaceEditsCheckClasspath(final PersistenceUnit persistenceUnit) { - return new CompositeIterable( - new TransformationIterable>(this.getElementsOnClasspath(persistenceUnit.getJpaProject())) { - @Override - protected Iterable transform(IJavaElement javaElement) { - return createPersistenceXmlReplaceEdits(persistenceUnit, javaElement, getArguments(javaElement).getDestination()); - } - } - ); - } - - protected Iterable getElementsOnClasspath(final JpaProject jpaProject) { - final IJavaProject javaProject = jpaProject.getJavaProject(); - return new FilteringIterable(this.originalJavaElements.keySet()) { - @Override - protected boolean accept(IJavaElement javaElement) { - return javaProject.isOnClasspath(javaElement); - } - }; - } - - protected abstract Iterable createPersistenceXmlReplaceEdits(PersistenceUnit persistenceUnit, IJavaElement javaElement, Object destination); - - protected void addPersistenceXmlRenameEdits(IFile persistenceXmlFile, CompositeChange compositeChange) { - Iterable replacePackageEdits = this.persistenceXmlReplaceEdits.get(persistenceXmlFile); - - TextChange textChange = getTextChange(persistenceXmlFile); - if (textChange == null) { - textChange = new TextFileChange(this.getPersistenceXmlChangeName(), persistenceXmlFile); - //TODO probably need to figure out TextEditGroups since these can be used to show check boxes under the file in the preview dialog - //also used to add edits to existing changes?? - MultiTextEdit multiTextEdit = new MultiTextEdit(); - textChange.setEdit(multiTextEdit); -// textChange.addTextEditGroup(new TextEditGroup("edit persistence unit", multiTextEdit));??? - compositeChange.add(textChange); - } - this.addEdits(textChange, replacePackageEdits); - } - - protected abstract String getPersistenceXmlChangeName(); - - - private Iterable createMappingFileReplaceEditsCheckClasspath(final MappingFileRef mappingFileRef) { - return new CompositeIterable( - new TransformationIterable>(this.getElementsOnClasspath(mappingFileRef.getJpaProject())) { - @Override - protected Iterable transform(IJavaElement javaElement) { - return createMappingFileReplaceEdits(mappingFileRef, javaElement, getArguments(javaElement).getDestination()); - } - } - ); - } - - protected abstract Iterable createMappingFileReplaceEdits(MappingFileRef mappingFileRef, IJavaElement javaElement, Object destination); - - - protected void addMappingFileRenameEdits(IFile mappingFile, CompositeChange compositeChange) { - Iterable replacedTypeEdits = this.mappingFileReplaceEdits.get(mappingFile); - - TextChange textChange = getTextChange(mappingFile); - if (textChange == null) { - textChange = new TextFileChange(this.getMappingFileChangeName(), mappingFile); - MultiTextEdit multiTextEdit = new MultiTextEdit(); - textChange.setEdit(multiTextEdit); - compositeChange.add(textChange); - } - this.addEdits(textChange, replacedTypeEdits); - } - - protected abstract String getMappingFileChangeName(); - - private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) { - PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml(); - if (persistenceXml == null) { - return null; - } - Persistence persistence = persistenceXml.getPersistence(); - if (persistence == null) { - return null; - } - if (persistence.persistenceUnitsSize() != 1) { - return null; // the context model currently only supports 1 persistence unit - } - return persistence.persistenceUnits().next(); - } - - private void addEdits(TextChange textChange, Iterable textEdits) { - for (TextEdit textEdit : textEdits) { - try { - textChange.addEdit(textEdit); - } - catch (MalformedTreeException ex) { - //log exception and don't add this persistence.xml type deletion to the conflicting change object - JptJpaCorePlugin.log(ex); - } - } - } -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java deleted file mode 100644 index d0d951594c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/AbstractJpaRenameJavaElementParticipant.java +++ /dev/null @@ -1,257 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.refactoring; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaProjectManager; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.ltk.core.refactoring.Change; -import org.eclipse.ltk.core.refactoring.CompositeChange; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.ltk.core.refactoring.TextChange; -import org.eclipse.ltk.core.refactoring.TextFileChange; -import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; -import org.eclipse.ltk.core.refactoring.participants.RenameParticipant; -import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.MultiTextEdit; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.text.edits.TextEdit; - -public abstract class AbstractJpaRenameJavaElementParticipant - extends RenameParticipant { - - protected IJavaElement originalJavaElement; - - /** - * Store the persistence.xml ReplaceEdits in the checkConditions() call - * to avoid duplicated effort in createChange(). - */ - protected final Map> persistenceXmlReplaceEdits; - - /** - * Store the mapping file ReplaceEdits in the checkConditions() call - * to avoid duplicated effort in createChange(). - */ - protected final Map> mappingFileReplaceEdits; - - protected AbstractJpaRenameJavaElementParticipant() { - super(); - this.persistenceXmlReplaceEdits = new HashMap>(); - this.mappingFileReplaceEdits = new HashMap>(); - } - - @Override - protected boolean initialize(Object element) { - if (!getArguments().getUpdateReferences()) { - //we do not want to do any refactoring if the user chooses not to update references - return false; - } - this.originalJavaElement = (IJavaElement) element; - return true; - } - - protected IJavaElement getOriginalJavaElement() { - return this.originalJavaElement; - } - - - //**************** RefactoringParticipant implementation ***************** - - /** - * Inform the refactoring processor of any files that are going to change. In the process of determining - * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange() - */ - @Override - public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException { - monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME); - JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager(); - if (jpaProjectManager.getJpaProjectsSize() == 0) { - return null; - } - SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 2); - sm.subTask(this.getCheckConditionsSubTaskName()); - ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class); - IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory(); - - for (JpaProject jpaProject : jpaProjectManager.getJpaProjects()) { - this.createReplaceEdits(sm.newChild(10), jpaProject); - } - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - for (IFile file : this.persistenceXmlReplaceEdits.keySet()) { - deltaFactory.change(file); - } - sm.worked(1); - for (IFile file : this.mappingFileReplaceEdits.keySet()) { - deltaFactory.change(file); - } - sm.worked(1); - - return null; - } - - protected abstract String getCompositeChangeName(); - - /** - * This will be appended to the main refactoring task named : 'Checking preconditions...' - */ - protected abstract String getCheckConditionsSubTaskName(); - - @Override - public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException { - if (this.persistenceXmlReplaceEdits.isEmpty() && this.mappingFileReplaceEdits.isEmpty()) { - return null; - } - SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlReplaceEdits.size() + this.mappingFileReplaceEdits.size()); - sm.subTask(this.getCreateChangeSubTaskName()); - CompositeChange compositeChange = new CompositeChange(this.getCompositeChangeName()); - for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) { - this.addPersistenceXmlRenameEdits(persistenceXmlFile, compositeChange); - sm.worked(1); - } - for (IFile mappingFile : this.mappingFileReplaceEdits.keySet()) { - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - this.addMappingFileRenameEdits(mappingFile, compositeChange); - sm.worked(1); - } - //must check for children in case all changes were made in other participant's TextChanges, - //want to return null so our node does not appear in the preview tree - return compositeChange.getChildren().length == 0 ? null : compositeChange; - } - - /** - * This will be appended to the main refactoring task named : 'Creating workspace modifications...' - */ - protected abstract String getCreateChangeSubTaskName(); - - protected void createReplaceEdits(IProgressMonitor monitor, JpaProject jpaProject) throws OperationCanceledException { - PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject); - if (persistenceUnit == null) { - return; - } - SubMonitor sm = SubMonitor.convert(monitor, 1 + persistenceUnit.mappingFileRefsSize()); - Iterable classRefDeleteEdits = this.createPersistenceXmlReplaceEditsCheckClasspath(persistenceUnit); - sm.worked(1); - if (!CollectionTools.isEmpty(classRefDeleteEdits)) { - this.persistenceXmlReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), classRefDeleteEdits); - } - for (MappingFileRef mappingFileRef : CollectionTools.iterable(persistenceUnit.mappingFileRefs())) { - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - Iterable mappingFileReplaceEdits = this.createMappingFileReplaceEditsCheckClasspath(mappingFileRef); - if (!CollectionTools.isEmpty(mappingFileReplaceEdits)) { - IFile file = (IFile) mappingFileRef.getMappingFile().getResource(); - this.mappingFileReplaceEdits.put(file, mappingFileReplaceEdits); - } - sm.worked(1); - } - } - - protected Iterable createPersistenceXmlReplaceEditsCheckClasspath(PersistenceUnit persistenceUnit) { - //check isOnClassPath since there could be types with the same name in different projects - if (persistenceUnit.getJpaProject().getJavaProject().isOnClasspath(this.originalJavaElement)) { - return createPersistenceXmlReplaceEdits(persistenceUnit); - } - return EmptyIterable.instance(); - } - - protected abstract Iterable createPersistenceXmlReplaceEdits(PersistenceUnit persistenceUnit); - - protected void addPersistenceXmlRenameEdits(IFile persistenceXmlFile, CompositeChange compositeChange) { - Iterable replacePackageEdits = this.persistenceXmlReplaceEdits.get(persistenceXmlFile); - - TextChange textChange = getTextChange(persistenceXmlFile); - if (textChange == null) { - textChange = new TextFileChange(this.getPersistenceXmlChangeName(), persistenceXmlFile); - //TODO probably need to figure out TextEditGroups since these can be used to show check boxes under the file in the preview dialog - //also used to add edits to existing changes?? - MultiTextEdit multiTextEdit = new MultiTextEdit(); - textChange.setEdit(multiTextEdit); -// textChange.addTextEditGroup(new TextEditGroup("edit persistence unit", multiTextEdit));??? - compositeChange.add(textChange); - } - this.addEdits(textChange, replacePackageEdits); - } - - protected abstract String getPersistenceXmlChangeName(); - - protected Iterable createMappingFileReplaceEditsCheckClasspath(MappingFileRef mappingFileRef) { - //check isOnClassPath since there could be types with the same name in different projects - if (mappingFileRef.getJpaProject().getJavaProject().isOnClasspath(this.originalJavaElement)) { - return this.createMappingFileReplaceEdits(mappingFileRef); - } - return EmptyIterable.instance(); - } - - protected abstract Iterable createMappingFileReplaceEdits(MappingFileRef mappingFileRef); - - - protected void addMappingFileRenameEdits(IFile mappingFile, CompositeChange compositeChange) { - Iterable replacedTypeEdits = this.mappingFileReplaceEdits.get(mappingFile); - - TextChange textChange = getTextChange(mappingFile); - if (textChange == null) { - textChange = new TextFileChange(this.getMappingFileChangeName(), mappingFile); - MultiTextEdit multiTextEdit = new MultiTextEdit(); - textChange.setEdit(multiTextEdit); - compositeChange.add(textChange); - } - this.addEdits(textChange, replacedTypeEdits); - } - - protected abstract String getMappingFileChangeName(); - - private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) { - PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml(); - if (persistenceXml == null) { - return null; - } - Persistence persistence = persistenceXml.getPersistence(); - if (persistence == null) { - return null; - } - if (persistence.persistenceUnitsSize() != 1) { - return null; // the context model currently only supports 1 persistence unit - } - return persistence.persistenceUnits().next(); - } - - private void addEdits(TextChange textChange, Iterable textEdits) { - for (TextEdit textEdit : textEdits) { - try { - textChange.addEdit(textEdit); - } - catch (MalformedTreeException ex) { - //log exception and don't add this persistence.xml type deletion to the conflicting change object - JptJpaCorePlugin.log(ex); - } - } - } -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaCoreRefactoringMessages.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaCoreRefactoringMessages.java deleted file mode 100644 index 5ff1a8444b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaCoreRefactoringMessages.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.refactoring; - -import org.eclipse.osgi.util.NLS; - -/** - * Localized messages used by Dali core. - */ -public class JpaCoreRefactoringMessages { - - public static String JPA_DELETE_TYPE_REFACTORING_PARTICIPANT_NAME; - public static String JPA_DELETE_PACKAGE_OR_FOLDER_REFACTORING_PARTICIPANT_NAME; - public static String JPA_DELETE_TYPE_REFACTORING_CHANGE_NAME; - public static String JPA_DELETE_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME; - public static String JPA_DELETE_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME; - public static String JPA_DELETE_TYPE_REFACTORING_SUB_TASK_NAME; - - public static String JPA_DELETE_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME; - public static String JPA_DELETE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME; - public static String JPA_DELETE_MAPPING_FILE_REFACTORING_CHANGE_NAME; - public static String JPA_DELETE_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME; - - public static String JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME; - - public static String JPA_RENAME_TYPE_REFACTORING_PARTICIPANT_NAME; - public static String JPA_RENAME_TYPE_REFACTORING_CHANGE_NAME; - public static String JPA_RENAME_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME; - public static String JPA_RENAME_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME; - public static String JPA_RENAME_TYPE_REFACTORING_SUB_TASK_NAME; - - public static String JPA_RENAME_PACKAGE_REFACTORING_PARTICIPANT_NAME; - public static String JPA_RENAME_PACKAGE_REFACTORING_CHANGE_NAME; - public static String JPA_RENAME_PACKAGE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME; - public static String JPA_RENAME_PACKAGE_REFACTORING_CHANGE_MAPPING_FILE_NAME; - public static String JPA_RENAME_PACKAGE_REFACTORING_SUB_TASK_NAME; - - public static String JPA_RENAME_FOLDER_REFACTORING_PARTICIPANT_NAME; - public static String JPA_RENAME_FOLDER_REFACTORING_CHANGE_NAME; - public static String JPA_RENAME_FOLDER_REFACTORING_CHANGE_PERSISTENCE_XML_NAME; - public static String JPA_RENAME_FOLDER_REFACTORING_SUB_TASK_NAME; - - public static String JPA_RENAME_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME; - public static String JPA_RENAME_MAPPING_FILE_REFACTORING_SUB_TASK_NAME; - public static String JPA_RENAME_MAPPING_FILE_REFACTORING_CHANGE_NAME; - public static String JPA_RENAME_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME; - - public static String JPA_MOVE_TYPE_REFACTORING_PARTICIPANT_NAME; - public static String JPA_MOVE_TYPE_REFACTORING_CHANGE_NAME; - public static String JPA_MOVE_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME; - public static String JPA_MOVE_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME; - public static String JPA_MOVE_TYPE_REFACTORING_SUB_TASK_NAME; - - public static String JPA_MOVE_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME; - public static String JPA_MOVE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME; - public static String JPA_MOVE_MAPPING_FILE_REFACTORING_CHANGE_NAME; - public static String JPA_MOVE_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME; - - public static String JPA_MOVE_FOLDER_REFACTORING_PARTICIPANT_NAME; - public static String JPA_MOVE_FOLDER_REFACTORING_CHANGE_NAME; - public static String JPA_MOVE_FOLDER_REFACTORING_CHANGE_PERSISTENCE_XML_NAME; - public static String JPA_MOVE_FOLDER_REFACTORING_SUB_TASK_NAME; - - private static final String BUNDLE_NAME = "jpa_core_refactoring"; //$NON-NLS-1$ - private static final Class BUNDLE_CLASS = JpaCoreRefactoringMessages.class; - static { - NLS.initializeMessages(BUNDLE_NAME, BUNDLE_CLASS); - } - - private JpaCoreRefactoringMessages() { - throw new UnsupportedOperationException(); - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java deleted file mode 100644 index 9627149c6d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteMappingFileParticipant.java +++ /dev/null @@ -1,210 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.refactoring; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaProjectManager; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.ltk.core.refactoring.Change; -import org.eclipse.ltk.core.refactoring.CompositeChange; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.ltk.core.refactoring.TextChange; -import org.eclipse.ltk.core.refactoring.TextFileChange; -import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; -import org.eclipse.ltk.core.refactoring.participants.DeleteArguments; -import org.eclipse.ltk.core.refactoring.participants.DeleteParticipant; -import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant; -import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments; -import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker; -import org.eclipse.text.edits.DeleteEdit; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.MultiTextEdit; -import org.eclipse.text.edits.TextEdit; - -/** - * Participant in the delete refactoring of {@link IFile}s with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}. - * If the deleted mapping file is listed in a persistence.xml file of any JpaProject - * then a Change object is created that will delete that reference from the file. - */ -public class JpaDeleteMappingFileParticipant - extends DeleteParticipant - implements ISharableParticipant -{ - - /** - * Store the {@link IFile}s to be deleted with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE} - * and their corresponding {@link DeleteArguments} - */ - protected final Map mappingFiles; - - /** - * Store the persistence.xml DeleteEdits in the checkConditions() call - * to avoid duplicated effort in createChange(). - */ - protected final Map> persistenceXmlMappingFileDeleteEdits; - - public JpaDeleteMappingFileParticipant() { - super(); - this.mappingFiles = new HashMap(); - this.persistenceXmlMappingFileDeleteEdits = new HashMap>(); - } - - @Override - public String getName() { - return JpaCoreRefactoringMessages.JPA_DELETE_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME; - } - - @Override - protected boolean initialize(Object element) { - this.addElement(element, getArguments()); - return true; - } - - - //****************ISharableParticipant implementation ***************** - /** - * This is used when multiple mapping files are deleted. - * RefactoringParticipant#initialize(Object) is called for the first deleted IFile. - * RefactoringParticipant#getArguments() only applies to the first deleted IFile - */ - public void addElement(Object element, RefactoringArguments arguments) { - this.mappingFiles.put((IFile) element, (DeleteArguments) arguments); - } - - - //**************** RefactoringParticipant implementation ***************** - - /** - * Inform the refactoring processor of any files that are going to change. In the process of determining - * this go ahead and build up the appropriate DeleteEdits to be used in the createChange() - */ - @Override - public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException { - //since the progress bar will hang if a large JPA project is being loaded, - //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called. - monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME); - JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager(); - if (jpaProjectManager.getJpaProjectsSize() == 0) { - return null; - } - SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 1); - sm.subTask(JpaCoreRefactoringMessages.JPA_DELETE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME); - ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class); - IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory(); - - for (JpaProject jpaProject : JptJpaCorePlugin.getJpaProjectManager().getJpaProjects()) { - this.createDeleteEdits(jpaProject); - sm.worked(10); - } - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - for (IFile persistenceXmlFile : this.persistenceXmlMappingFileDeleteEdits.keySet()) { - deltaFactory.change(persistenceXmlFile); - } - sm.worked(1); - - return null; - } - - protected void createDeleteEdits(JpaProject jpaProject) throws OperationCanceledException { - PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject); - if (persistenceUnit == null) { - return; - } - Iterable classRefDeleteEdits = this.createSpecifiedMappingFileRefDeleteEdits(persistenceUnit); - if (!CollectionTools.isEmpty(classRefDeleteEdits)) { - this.persistenceXmlMappingFileDeleteEdits.put(jpaProject.getPersistenceXmlResource().getFile(), classRefDeleteEdits); - } - } - - @Override - public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException { - if (this.persistenceXmlMappingFileDeleteEdits.isEmpty()) { - return null; - } - SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlMappingFileDeleteEdits.size()); - sm.subTask(JpaCoreRefactoringMessages.JPA_DELETE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME); - CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_DELETE_MAPPING_FILE_REFACTORING_CHANGE_NAME); - for (IFile persistenceXmlFile : this.persistenceXmlMappingFileDeleteEdits.keySet()) { - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - this.addPersistenceXmlDeleteMappingFileChange(persistenceXmlFile, compositeChange); - } - //must check for children in case all changes were made in other participants TextChanges, - //want to return null so our node does not appear in the preview tree - return compositeChange.getChildren().length == 0 ? null : compositeChange; - } - - private Iterable createSpecifiedMappingFileRefDeleteEdits(final PersistenceUnit persistenceUnit) { - return new CompositeIterable( - new TransformationIterable>(this.mappingFiles.keySet()) { - @Override - protected Iterable transform(IFile file) { - return persistenceUnit.createDeleteMappingFileEdits(file); - } - } - ); - } - - protected void addPersistenceXmlDeleteMappingFileChange(IFile persistenceXmlFile, CompositeChange compositeChange) { - TextChange textChange = getTextChange(persistenceXmlFile); - if (textChange == null) { - textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_DELETE_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile); - MultiTextEdit multiTextEdit = new MultiTextEdit(); - textChange.setEdit(multiTextEdit); - compositeChange.add(textChange); - } - Iterable mappingFileDeleteEdits = this.persistenceXmlMappingFileDeleteEdits.get(persistenceXmlFile); - this.addEdits(textChange, mappingFileDeleteEdits); - } - - private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) { - PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml(); - if (persistenceXml == null) { - return null; - } - Persistence persistence = persistenceXml.getPersistence(); - if (persistence == null) { - return null; - } - if (persistence.persistenceUnitsSize() != 1) { - return null; // the context model currently only supports 1 persistence unit - } - return persistence.persistenceUnits().next(); - } - - private void addEdits(TextChange textChange, Iterable textEdits) { - for (TextEdit textEdit : textEdits) { - try { - textChange.addEdit(textEdit); - } - catch (MalformedTreeException e) { - //log exception and don't add this persistence.xml type deletion to the conflicting change object - JptJpaCorePlugin.log(e); - } - } - } -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java deleted file mode 100644 index e2ce790017..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeletePackageOrFolderParticipant.java +++ /dev/null @@ -1,255 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.refactoring; - -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashSet; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IResource; -import org.eclipse.core.resources.IResourceProxy; -import org.eclipse.core.resources.IResourceProxyVisitor; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.jdt.core.ICompilationUnit; -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IPackageFragmentRoot; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaCore; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jpt.common.core.internal.utility.PlatformTools; -import org.eclipse.jpt.common.core.internal.utility.jdt.JDTTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant; -import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments; -import org.eclipse.ltk.core.refactoring.participants.RenameProcessor; -import org.eclipse.text.edits.DeleteEdit; - -public class JpaDeletePackageOrFolderParticipant - extends AbstractJpaDeleteTypeParticipant - implements ISharableParticipant -{ - - /** - * The folders that are going to be deleted. - * Only folders which are not also IPackageFragments or IPackageFragmentRoots are added to this collection. - */ - protected final Collection folders; - - /** - * The IPackageFragments that are going to be deleted. - */ - protected final Collection packageFragments; - - public JpaDeletePackageOrFolderParticipant() { - super(); - this.folders = new ArrayList(); - this.packageFragments = new ArrayList(); - } - - //**************** RefactoringParticipant implementation ***************** - - @Override - public String getName() { - return JpaCoreRefactoringMessages.JPA_DELETE_PACKAGE_OR_FOLDER_REFACTORING_PARTICIPANT_NAME; - } - - @Override - protected boolean initialize(Object element) { - if (getProcessor() instanceof RenameProcessor) { - //Renaming a package that then ends up with no subpackages or types will call the delete folder participant. - //We do not want to delete references in the persistence.xml and mapping files in this case, will be handled - //with the rename participant - return false; - } - this.addElement(element, getArguments()); - return true; - } - - //**************** ISharableParticipant implementation ***************** - /** - * This is used when multiple IPackageFraments/IFolders are deleted. - * RefactoringParticipant#initialize(Object) is called for the first deleted IPackageFragment/IFolder. - * RefactoringParticipant#getArguments() only applies to the first deleted IPackageFragment/IFolder - */ - public void addElement(Object element, RefactoringArguments arguments) { - if (element instanceof IFolder) { - IJavaElement javaElement = JavaCore.create((IFolder) element); - if (javaElement != null) { - if (javaElement.getElementType() == IJavaElement.PACKAGE_FRAGMENT_ROOT) { - this.addPackageFragmentRoot((IPackageFragmentRoot) javaElement); - } - else { - this.addPackageFragment((IPackageFragment) javaElement); - } - } - else { - this.addFolder((IFolder) element); - } - } - else { - this.addPackageFragment((IPackageFragment) element); - } - } - - protected void addFolder(IFolder folder) { - this.folders.add(folder); - } - - protected void addPackageFragmentRoot(IPackageFragmentRoot root) { - if (JDTTools.packageFragmentRootIsSourceFolder(root)) { - IJavaElement[] children = JDTTools.getJDTChildren(root); - for (IJavaElement child : children) { - this.addPackageFragment((IPackageFragment) child); - } - } - } - - protected void addPackageFragment(IPackageFragment packageFragment) { - this.packageFragments.add(packageFragment); - Collection allDeletedTypes = new HashSet(); - addAffectedTypes(allDeletedTypes, packageFragment); - for (IType deletedType : allDeletedTypes) { - this.addType(deletedType); - } - } - - //nestedTypes are handled in AbstractJpaDeleteTypeParticipant - static void addAffectedTypes(Collection types, IPackageFragment fragment) { - try { - if (fragment.containsJavaResources()) { - ICompilationUnit[] cunits = fragment.getCompilationUnits(); - IType type = null; - for (int i = 0; i < cunits.length; i++) { - type = cunits[i].findPrimaryType(); - if (type == null) { - continue; - } - types.add(type); - } - } - } - catch (JavaModelException ex) { - JptJpaCorePlugin.log(ex); - } - } - - /** - * Add mapping file delete edits here, super.createPersistenceXmlDeleteEdits() is - * called to add the type delete edits. - */ - @Override - @SuppressWarnings("unchecked") - protected Iterable createPersistenceXmlDeleteEdits(final PersistenceUnit persistenceUnit) { - return new CompositeIterable( - super.createPersistenceXmlDeleteEdits(persistenceUnit), - new CompositeIterable( - new TransformationIterable>(this.getMappingFilesOnClasspath(persistenceUnit.getJpaProject())) { - @Override - protected Iterable transform(IFile file) { - return persistenceUnit.createDeleteMappingFileEdits(file); - } - } - ) - ); - } - - @SuppressWarnings("unchecked") - protected Iterable getMappingFilesOnClasspath(final JpaProject jpaProject) { - final IJavaProject javaProject = jpaProject.getJavaProject(); - return new FilteringIterable(new CompositeIterable( - getPossibleMappingFilesInFolders(), - getPossibleMappingFilesInPackageFragments())) - { - @Override - protected boolean accept(IFile file) { - return javaProject.isOnClasspath(file) - && PlatformTools.getContentType(file).isKindOf(JptJpaCorePlugin.MAPPING_FILE_CONTENT_TYPE); - } - }; - } - - protected Iterable getPossibleMappingFilesInFolders() { - Collection files = new ArrayList(); - FolderResourceProxyVisitor visitor = new FolderResourceProxyVisitor(files); - for (IFolder folder : this.folders) { - visitor.visitFolder(folder); - } - return files; - } - - protected Iterable getPossibleMappingFilesInPackageFragments() { - return new CompositeIterable( - new TransformationIterable>(this.packageFragments) { - @Override - protected Iterable transform(IPackageFragment packageFragment) { - return getNonJavaFiles(packageFragment); - } - } - ); - } - - protected static Iterable getNonJavaFiles(IPackageFragment packageFragment) { - Collection files = new ArrayList(); - Object[] resources = getNonJavaResources(packageFragment); - for (Object resource : resources) { - if (resource instanceof IFile) { - files.add((IFile) resource); - } - } - return files; - } - - protected static Object[] getNonJavaResources(IPackageFragment packageFragment) { - try { - return packageFragment.getNonJavaResources(); - } - catch (JavaModelException e) { - JptJpaCorePlugin.log(e); - return EMPTY_OBJECT_ARRAY; - } - } - - private static final Object[] EMPTY_OBJECT_ARRAY = new Object[0]; - - protected class FolderResourceProxyVisitor implements IResourceProxyVisitor { - private Collection files; - protected FolderResourceProxyVisitor(Collection files) { - super(); - this.files = files; - } - protected void visitFolder(IFolder folder) { - try { - folder.accept(this, IResource.NONE); - } catch (CoreException ex) { - // shouldn't happen - we don't throw any CoreExceptions - throw new RuntimeException(ex); - } - } - public boolean visit(IResourceProxy resource) { - switch (resource.getType()) { - case IResource.FOLDER : - return true; // visit children - case IResource.FILE : - this.files.add((IFile) resource.requestResource()); - return false; // no children - default : - return false; // no children - } - } - } -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteTypeParticipant.java deleted file mode 100644 index 7801496e65..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaDeleteTypeParticipant.java +++ /dev/null @@ -1,47 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.refactoring; - -import org.eclipse.jdt.core.IType; -import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant; -import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments; - -public class JpaDeleteTypeParticipant - extends AbstractJpaDeleteTypeParticipant - implements ISharableParticipant -{ - - public JpaDeleteTypeParticipant() { - super(); - } - - @Override - protected boolean initialize(Object element) { - this.addElement(element, getArguments()); - return true; - } - - @Override - public String getName() { - return JpaCoreRefactoringMessages.JPA_DELETE_TYPE_REFACTORING_PARTICIPANT_NAME; - } - - - //****************ISharableParticipant implementation ***************** - - /** - * This is used when multiple ITypes are deleted. - * RefactoringParticipant#initialize(Object) is called for the first deleted IType. - * RefactoringParticipant#getArguments() only applies to the first deleted IType - */ - public void addElement(Object element, RefactoringArguments arguments) { - this.addType((IType) element); - } -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java deleted file mode 100644 index 160e216b3c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveFolderParticipant.java +++ /dev/null @@ -1,239 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.refactoring; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.resources.IContainer; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaProjectManager; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.ltk.core.refactoring.Change; -import org.eclipse.ltk.core.refactoring.CompositeChange; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.ltk.core.refactoring.TextChange; -import org.eclipse.ltk.core.refactoring.TextFileChange; -import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; -import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant; -import org.eclipse.ltk.core.refactoring.participants.MoveArguments; -import org.eclipse.ltk.core.refactoring.participants.MoveParticipant; -import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments; -import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.MultiTextEdit; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.text.edits.TextEdit; - -/** - * Participant in the move refactoring of {@link IFolders}s. - * Any mapping file references in the persistence.xml will be updated to reflect the new location. - */ -public class JpaMoveFolderParticipant - extends MoveParticipant - implements ISharableParticipant -{ - - /** - * Store the {@link IFolder}s to be moved and their corresponding MoveArguments - */ - protected final Map originalFolders; - - /** - * Store the persistence.xml ReplaceEdit in the checkConditions() call - * to avoid duplicated effort in createChange(). - */ - protected final Map> persistenceXmlReplaceEdits; - - public JpaMoveFolderParticipant() { - super(); - this.originalFolders = new HashMap(); - this.persistenceXmlReplaceEdits = new HashMap>(); - } - - @Override - public String getName() { - return JpaCoreRefactoringMessages.JPA_MOVE_FOLDER_REFACTORING_PARTICIPANT_NAME; - } - - @Override - protected boolean initialize(Object element) { - if (!getArguments().getUpdateReferences()) { - return false; - } - this.addElement(element, getArguments()); - return true; - } - - //****************ISharableParticipant implementation ***************** - - /** - * This is used when multiple folders are moved. - * RefactoringParticipant#initialize(Object) is called for the first moved IFolder. - * RefactoringParticipant#getArguments() only applies to the first moved IFolder. - */ - public void addElement(Object element, RefactoringArguments arguments) { - this.originalFolders.put((IFolder) element, (MoveArguments) arguments); - } - - protected MoveArguments getArguments(IFolder element) { - return this.originalFolders.get(element); - } - - - //**************** RefactoringParticipant implementation ***************** - - /** - * Inform the refactoring processor of any files that are going to change. In the process of determining - * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange() - */ - @Override - public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException { - //since the progress bar will hang if a large JPA project is being loaded, - //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called. - monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME); - JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager(); - if (jpaProjectManager.getJpaProjectsSize() == 0) { - return null; - } - SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 1); - sm.subTask(JpaCoreRefactoringMessages.JPA_MOVE_FOLDER_REFACTORING_SUB_TASK_NAME); - ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class); - IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory(); - - for (JpaProject jpaProject : JptJpaCorePlugin.getJpaProjectManager().getJpaProjects()) { - this.createReplaceEdits(jpaProject); - sm.worked(10); - } - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) { - deltaFactory.change(persistenceXmlFile); - } - sm.worked(1); - - return null; - } - - protected void createReplaceEdits(JpaProject jpaProject) throws OperationCanceledException { - PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject); - if (persistenceUnit == null) { - return; - } - Iterable replaceEdits = this.createPersistenceUnitReplaceEditsCheckClasspath(persistenceUnit); - if (!CollectionTools.isEmpty(replaceEdits)) { - this.persistenceXmlReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), replaceEdits); - } - } - - @Override - public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException { - if (this.persistenceXmlReplaceEdits.isEmpty()) { - return null; - } - SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlReplaceEdits.size()); - sm.subTask(JpaCoreRefactoringMessages.JPA_MOVE_FOLDER_REFACTORING_SUB_TASK_NAME); - CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_MOVE_FOLDER_REFACTORING_CHANGE_NAME); - for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) { - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - this.addPersistenceXmlRenameChange(persistenceXmlFile, compositeChange); - } - //must check for children in case all changes were made in other participants TextChanges, - //want to return null so our node does not appear in the preview tree - return compositeChange.getChildren().length == 0 ? null : compositeChange; - } - - protected Iterable createPersistenceUnitReplaceEditsCheckClasspath(final PersistenceUnit persistenceUnit) { - return new CompositeIterable( - new TransformationIterable>(this.getOriginalFoldersOnClasspath(persistenceUnit.getJpaProject())) { - @Override - protected Iterable transform(IFolder folder) { - return createPersistenceUnitReplaceEdits(persistenceUnit, folder, (IContainer) getArguments(folder).getDestination()); - } - } - ); - } - - protected Iterable getOriginalFoldersOnClasspath(final JpaProject jpaProject) { - final IJavaProject javaProject = jpaProject.getJavaProject(); - return new FilteringIterable(this.originalFolders.keySet()) { - @Override - protected boolean accept(IFolder folder) { - return javaProject.isOnClasspath(folder); - } - }; - } - - protected Iterable createPersistenceUnitReplaceEdits(PersistenceUnit persistenceUnit, IFolder folder, IContainer destination) { - IProject project = destination.getProject(); - IPath fullPath = destination.getFullPath().append(folder.getName()); - IPath runtimePath = JptCommonCorePlugin.getResourceLocator(project).getRuntimePath(project, fullPath); - return persistenceUnit.createMoveFolderEdits(folder, runtimePath); - } - - protected void addPersistenceXmlRenameChange(IFile persistenceXmlFile, CompositeChange compositeChange) { - TextChange textChange = getTextChange(persistenceXmlFile); - if (textChange == null) { - textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_MOVE_FOLDER_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile); - MultiTextEdit multiTextEdit = new MultiTextEdit(); - textChange.setEdit(multiTextEdit); - compositeChange.add(textChange); - } - Iterable mappingFileReplaceEdits = this.persistenceXmlReplaceEdits.get(persistenceXmlFile); - this.addEdits(textChange, mappingFileReplaceEdits); - } - - private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) { - PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml(); - if (persistenceXml == null) { - return null; - } - Persistence persistence = persistenceXml.getPersistence(); - if (persistence == null) { - return null; - } - if (persistence.persistenceUnitsSize() != 1) { - return null; // the context model currently only supports 1 persistence unit - } - return persistence.persistenceUnits().next(); - } - - private void addEdits(TextChange textChange, Iterable textEdits) { - for (TextEdit textEdit : textEdits) { - try { - textChange.addEdit(textEdit); - } - catch (MalformedTreeException e) { - //log exception and don't add this persistence.xml type deletion to the conflicting change object - JptJpaCorePlugin.log(e); - } - } - } -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java deleted file mode 100644 index 0adac39634..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveMappingFileParticipant.java +++ /dev/null @@ -1,242 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.refactoring; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jdt.core.IJavaProject; -import org.eclipse.jpt.common.core.JptCommonCorePlugin; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.FilteringIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaProjectManager; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.ltk.core.refactoring.Change; -import org.eclipse.ltk.core.refactoring.CompositeChange; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.ltk.core.refactoring.TextChange; -import org.eclipse.ltk.core.refactoring.TextFileChange; -import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; -import org.eclipse.ltk.core.refactoring.participants.ISharableParticipant; -import org.eclipse.ltk.core.refactoring.participants.MoveArguments; -import org.eclipse.ltk.core.refactoring.participants.MoveParticipant; -import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments; -import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.MultiTextEdit; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.text.edits.TextEdit; - -/** - * Participant in the rename refactoring of {@link IFile}s with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}. - * If the renamed mapping file is listed in a persistence.xml file of any JpaProject - * then a Change object is created that will rename that reference from the file. - * If the renamed mapping file is an implied mapping file, then an actual reference to the mapping file will be specified. - */ -public class JpaMoveMappingFileParticipant - extends MoveParticipant - implements ISharableParticipant -{ - - /** - * Store the {@link IFile}s to be renamed with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE} - * and their corresponding {@link MoveArguments} - */ - protected final Map originalMappingFiles; - - /** - * Store the persistence.xml ReplaceEdit in the checkConditions() call - * to avoid duplicated effort in createChange(). - */ - protected final Map> persistenceXmlMappingFileReplaceEdits; - - public JpaMoveMappingFileParticipant() { - super(); - this.originalMappingFiles = new HashMap(); - this.persistenceXmlMappingFileReplaceEdits = new HashMap>(); - } - - @Override - public String getName() { - return JpaCoreRefactoringMessages.JPA_MOVE_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME; - } - - @Override - protected boolean initialize(Object element) { - if (!getArguments().getUpdateReferences()) { - return false; - } - this.addElement(element, getArguments()); - return true; - } - - //****************ISharableParticipant implementation ***************** - - /** - * This is used when multiple mapping files are deleted. - * RefactoringParticipant#initialize(Object) is called for the first deleted IFile. - * RefactoringParticipant#getArguments() only applies to the first deleted IFile - */ - public void addElement(Object element, RefactoringArguments arguments) { - this.originalMappingFiles.put((IFile) element, (MoveArguments) arguments); - } - - protected MoveArguments getArguments(IFile element) { - return this.originalMappingFiles.get(element); - } - - - //**************** RefactoringParticipant implementation ***************** - - /** - * Inform the refactoring processor of any files that are going to change. In the process of determining - * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange() - */ - @Override - public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException { - //since the progress bar will hang if a large JPA project is being loaded, - //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called. - monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME); - JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager(); - if (jpaProjectManager.getJpaProjectsSize() == 0) { - return null; - } - SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 1); - sm.subTask(JpaCoreRefactoringMessages.JPA_MOVE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME); - ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class); - IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory(); - - for (JpaProject jpaProject : JptJpaCorePlugin.getJpaProjectManager().getJpaProjects()) { - this.createReplaceEdits(jpaProject); - sm.worked(10); - } - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - for (IFile persistenceXmlFile : this.persistenceXmlMappingFileReplaceEdits.keySet()) { - deltaFactory.change(persistenceXmlFile); - } - sm.worked(1); - - return null; - } - - protected void createReplaceEdits(JpaProject jpaProject) throws OperationCanceledException { - PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject); - if (persistenceUnit == null) { - return; - } - Iterable replaceEdits = this.createPersistenceUnitReplaceEditsCheckClasspath(persistenceUnit); - if (!CollectionTools.isEmpty(replaceEdits)) { - this.persistenceXmlMappingFileReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), replaceEdits); - } - } - - @Override - public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException { - if (this.persistenceXmlMappingFileReplaceEdits.isEmpty()) { - return null; - } - SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlMappingFileReplaceEdits.size()); - sm.subTask(JpaCoreRefactoringMessages.JPA_MOVE_MAPPING_FILE_REFACTORING_SUB_TASK_NAME); - CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_MOVE_MAPPING_FILE_REFACTORING_CHANGE_NAME); - for (IFile persistenceXmlFile : this.persistenceXmlMappingFileReplaceEdits.keySet()) { - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - this.addPersistenceXmlRenameMappingFileChange(persistenceXmlFile, compositeChange); - } - //must check for children in case all changes were made in other participants TextChanges, - //want to return null so our node does not appear in the preview tree - return compositeChange.getChildren().length == 0 ? null : compositeChange; - } - - - protected Iterable createPersistenceUnitReplaceEditsCheckClasspath(final PersistenceUnit persistenceUnit) { - return new CompositeIterable( - new TransformationIterable>(this.getOriginalFoldersOnClasspath(persistenceUnit.getJpaProject())) { - @Override - protected Iterable transform(IFile mappingFile) { - return createPersistenceUnitReplaceEdits(persistenceUnit, mappingFile, (IFolder) getArguments(mappingFile).getDestination()); - } - } - ); - } - - protected Iterable getOriginalFoldersOnClasspath(final JpaProject jpaProject) { - final IJavaProject javaProject = jpaProject.getJavaProject(); - return new FilteringIterable(this.originalMappingFiles.keySet()) { - @Override - protected boolean accept(IFile file) { - return javaProject.isOnClasspath(file); - } - }; - } - - private Iterable createPersistenceUnitReplaceEdits(PersistenceUnit persistenceUnit, IFile mappingFile, IFolder destination) { - IProject project = destination.getProject(); - IPath fullPath = destination.getFullPath(); - IPath runtimePath = JptCommonCorePlugin.getResourceLocator(project).getRuntimePath(project, fullPath); - return persistenceUnit.createMoveMappingFileEdits(mappingFile, runtimePath); - } - - protected void addPersistenceXmlRenameMappingFileChange(IFile persistenceXmlFile, CompositeChange compositeChange) { - TextChange textChange = getTextChange(persistenceXmlFile); - if (textChange == null) { - textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_MOVE_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile); - MultiTextEdit multiTextEdit = new MultiTextEdit(); - textChange.setEdit(multiTextEdit); - compositeChange.add(textChange); - } - Iterable mappingFileReplaceEdits = this.persistenceXmlMappingFileReplaceEdits.get(persistenceXmlFile); - this.addEdits(textChange, mappingFileReplaceEdits); - } - - private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) { - PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml(); - if (persistenceXml == null) { - return null; - } - Persistence persistence = persistenceXml.getPersistence(); - if (persistence == null) { - return null; - } - if (persistence.persistenceUnitsSize() != 1) { - return null; // the context model currently only supports 1 persistence unit - } - return persistence.persistenceUnits().next(); - } - - private void addEdits(TextChange textChange, Iterable textEdits) { - for (TextEdit textEdit : textEdits) { - try { - textChange.addEdit(textEdit); - } - catch (MalformedTreeException e) { - //log exception and don't add this persistence.xml type deletion to the conflicting change object - JptJpaCorePlugin.log(e); - } - } - } -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveTypeParticipant.java deleted file mode 100644 index 969ad22c60..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaMoveTypeParticipant.java +++ /dev/null @@ -1,113 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.refactoring; - -import org.eclipse.jdt.core.IJavaElement; -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.ltk.core.refactoring.participants.RefactoringArguments; -import org.eclipse.text.edits.ReplaceEdit; - -public class JpaMoveTypeParticipant - extends AbstractJpaMoveJavaElementParticipant { - - public JpaMoveTypeParticipant() { - super(); - } - - @Override - public String getName() { - return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_PARTICIPANT_NAME; - } - - @Override - public void addElement(Object element, RefactoringArguments arguments) { - super.addElement(element, arguments); - this.addNestedTypes((IType) element, arguments); - } - - protected void addNestedType(IType renamedType, RefactoringArguments arguments) { - super.addElement(renamedType, arguments); - this.addNestedTypes(renamedType, arguments); - } - - private void addNestedTypes(IType renamedType, RefactoringArguments arguments) { - IType[] nestedTypes; - try { - nestedTypes = renamedType.getTypes(); - } - catch (JavaModelException ex) { - JptJpaCorePlugin.log(ex); - return; - } - - for (IType nestedType : nestedTypes) { - this.addNestedType(nestedType, arguments); - } - } - - - //**************** AbstractJpaRenameJavaElementParticipant implementation ***************** - - @Override - protected Iterable createPersistenceXmlReplaceEdits(PersistenceUnit persistenceUnit, IJavaElement javaElement, Object destination) { - IType type = (IType) javaElement; - if (((IJavaElement) destination).getElementType() == IJavaElement.PACKAGE_FRAGMENT) { - return persistenceUnit.createMoveTypeEdits(type, (IPackageFragment) destination); - } - return persistenceUnit.createRenameTypeEdits(type, getNewNameForNestedType(type, (IType) destination)); - } - - @Override - protected Iterable createMappingFileReplaceEdits(MappingFileRef mappingFileRef, IJavaElement javaElement, Object destination) { - IType type = (IType) javaElement; - if (((IJavaElement) destination).getElementType() == IJavaElement.PACKAGE_FRAGMENT) { - return mappingFileRef.createMoveTypeEdits(type, (IPackageFragment) destination); - } - return mappingFileRef.createRenameTypeEdits(type, getNewNameForNestedType(type, (IType) destination)); - } - - protected String getNewNameForNestedType(IType nestedType, IType destination) { - return nestedType.getTypeQualifiedName('$').replaceFirst(nestedType.getDeclaringType().getElementName(), destination.getElementName()); - } - - protected IPackageFragment getNewPackage() { - return (IPackageFragment) getArguments().getDestination(); - } - - @Override - protected String getCheckConditionsSubTaskName() { - return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_SUB_TASK_NAME; - } - - @Override - protected String getCreateChangeSubTaskName() { - return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_SUB_TASK_NAME; - } - - @Override - protected String getCompositeChangeName() { - return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_CHANGE_NAME; - } - - @Override - protected String getPersistenceXmlChangeName() { - return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME; - } - - @Override - protected String getMappingFileChangeName() { - return JpaCoreRefactoringMessages.JPA_MOVE_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME; - } -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java deleted file mode 100644 index 57cd8b335d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameFolderParticipant.java +++ /dev/null @@ -1,194 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.refactoring; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.IFolder; -import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.common.utility.internal.iterables.EmptyIterable; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaProjectManager; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.ltk.core.refactoring.Change; -import org.eclipse.ltk.core.refactoring.CompositeChange; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.ltk.core.refactoring.TextChange; -import org.eclipse.ltk.core.refactoring.TextFileChange; -import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; -import org.eclipse.ltk.core.refactoring.participants.RenameParticipant; -import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.MultiTextEdit; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.text.edits.TextEdit; - -/** - * Participant in the rename refactoring of {@link IFolders}s. - * If the renamed mapping file is listed in a persistence.xml file of any JpaProject - * then a Change object is created that will rename that reference from the file. - * If the renamed mapping file is an implied mapping file, then an actual reference to the mapping file will be specified. - */ -public class JpaRenameFolderParticipant - extends RenameParticipant -{ - - /** - * Store the {@link IFolder}s to be renamed - */ - - protected IFolder originalFolder; - - /** - * Store the persistence.xml ReplaceEdit in the checkConditions() call - * to avoid duplicated effort in createChange(). - */ - protected final Map> persistenceXmlReplaceEdits; - - public JpaRenameFolderParticipant() { - super(); - this.persistenceXmlReplaceEdits = new HashMap>(); - } - - @Override - public String getName() { - return JpaCoreRefactoringMessages.JPA_RENAME_FOLDER_REFACTORING_PARTICIPANT_NAME; - } - - @Override - protected boolean initialize(Object element) { - if (!getArguments().getUpdateReferences()) { - return false; - } - this.originalFolder = (IFolder) element; - return true; - } - - - //**************** RefactoringParticipant implementation ***************** - - /** - * Inform the refactoring processor of any files that are going to change. In the process of determining - * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange() - */ - @Override - public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException { - //since the progress bar will hang if a large JPA project is being loaded, - //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called. - monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME); - JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager(); - if (jpaProjectManager.getJpaProjectsSize() == 0) { - return null; - } - SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 1); - sm.subTask(JpaCoreRefactoringMessages.JPA_RENAME_FOLDER_REFACTORING_SUB_TASK_NAME); - ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class); - IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory(); - - for (JpaProject jpaProject : JptJpaCorePlugin.getJpaProjectManager().getJpaProjects()) { - this.createReplaceEdits(jpaProject); - sm.worked(10); - } - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) { - deltaFactory.change(persistenceXmlFile); - } - sm.worked(1); - - return null; - } - - protected void createReplaceEdits(JpaProject jpaProject) throws OperationCanceledException { - PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject); - if (persistenceUnit == null) { - return; - } - Iterable replaceEdits = this.createPersistenceUnitReplaceEdits(persistenceUnit); - if (!CollectionTools.isEmpty(replaceEdits)) { - this.persistenceXmlReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), replaceEdits); - } - } - - @Override - public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException { - if (this.persistenceXmlReplaceEdits.isEmpty()) { - return null; - } - SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlReplaceEdits.size()); - sm.subTask(JpaCoreRefactoringMessages.JPA_RENAME_FOLDER_REFACTORING_SUB_TASK_NAME); - CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_RENAME_FOLDER_REFACTORING_CHANGE_NAME); - for (IFile persistenceXmlFile : this.persistenceXmlReplaceEdits.keySet()) { - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - this.addPersistenceXmlRenameChange(persistenceXmlFile, compositeChange); - } - //must check for children in case all changes were made in other participants TextChanges, - //want to return null so our node does not appear in the preview tree - return compositeChange.getChildren().length == 0 ? null : compositeChange; - } - - private Iterable createPersistenceUnitReplaceEdits(final PersistenceUnit persistenceUnit) { - if (persistenceUnit.getJpaProject().getJavaProject().isOnClasspath(this.originalFolder) || persistenceUnit.getJpaProject().getProject() == this.originalFolder.getProject()) { - return persistenceUnit.createRenameFolderEdits(this.originalFolder, getArguments().getNewName()); - } - return EmptyIterable.instance(); - } - - protected void addPersistenceXmlRenameChange(IFile persistenceXmlFile, CompositeChange compositeChange) { - TextChange textChange = getTextChange(persistenceXmlFile); - if (textChange == null) { - textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_RENAME_FOLDER_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile); - MultiTextEdit multiTextEdit = new MultiTextEdit(); - textChange.setEdit(multiTextEdit); - compositeChange.add(textChange); - } - Iterable mappingFileReplaceEdits = this.persistenceXmlReplaceEdits.get(persistenceXmlFile); - this.addEdits(textChange, mappingFileReplaceEdits); - } - - private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) { - PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml(); - if (persistenceXml == null) { - return null; - } - Persistence persistence = persistenceXml.getPersistence(); - if (persistence == null) { - return null; - } - if (persistence.persistenceUnitsSize() != 1) { - return null; // the context model currently only supports 1 persistence unit - } - return persistence.persistenceUnits().next(); - } - - private void addEdits(TextChange textChange, Iterable textEdits) { - for (TextEdit textEdit : textEdits) { - try { - textChange.addEdit(textEdit); - } - catch (MalformedTreeException e) { - //log exception and don't add this persistence.xml type deletion to the conflicting change object - JptJpaCorePlugin.log(e); - } - } - } -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java deleted file mode 100644 index 69349e3481..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameMappingFileParticipant.java +++ /dev/null @@ -1,189 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.refactoring; - -import java.util.HashMap; -import java.util.Map; -import org.eclipse.core.resources.IFile; -import org.eclipse.core.resources.mapping.IResourceChangeDescriptionFactory; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.OperationCanceledException; -import org.eclipse.core.runtime.SubMonitor; -import org.eclipse.jpt.common.utility.internal.CollectionTools; -import org.eclipse.jpt.jpa.core.JpaProject; -import org.eclipse.jpt.jpa.core.JpaProjectManager; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.Persistence; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceXml; -import org.eclipse.ltk.core.refactoring.Change; -import org.eclipse.ltk.core.refactoring.CompositeChange; -import org.eclipse.ltk.core.refactoring.RefactoringStatus; -import org.eclipse.ltk.core.refactoring.TextChange; -import org.eclipse.ltk.core.refactoring.TextFileChange; -import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext; -import org.eclipse.ltk.core.refactoring.participants.RenameParticipant; -import org.eclipse.ltk.core.refactoring.participants.ResourceChangeChecker; -import org.eclipse.text.edits.MalformedTreeException; -import org.eclipse.text.edits.MultiTextEdit; -import org.eclipse.text.edits.ReplaceEdit; -import org.eclipse.text.edits.TextEdit; - -/** - * Participant in the rename refactoring of {@link IFile}s with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE}. - * If the renamed mapping file is listed in a persistence.xml file of any JpaProject - * then a Change object is created that will rename that reference from the file. - * If the renamed mapping file is an implied mapping file, then an actual reference to the mapping file will be specified. - */ -public class JpaRenameMappingFileParticipant - extends RenameParticipant -{ - - /** - * Store the {@link IFile}s to be renamed with content type {@link JptJpaCorePlugin#MAPPING_FILE_CONTENT_TYPE} - */ - - protected IFile originalMappingFile; - - /** - * Store the persistence.xml ReplaceEdit in the checkConditions() call - * to avoid duplicated effort in createChange(). - */ - protected final Map> persistenceXmlMappingFileReplaceEdits; - - public JpaRenameMappingFileParticipant() { - super(); - this.persistenceXmlMappingFileReplaceEdits = new HashMap>(); - } - - @Override - public String getName() { - return JpaCoreRefactoringMessages.JPA_RENAME_MAPPING_FILE_REFACTORING_PARTICIPANT_NAME; - } - - @Override - protected boolean initialize(Object element) { - if (!getArguments().getUpdateReferences()) { - return false; - } - this.originalMappingFile = (IFile) element; - return true; - } - - - //**************** RefactoringParticipant implementation ***************** - - /** - * Inform the refactoring processor of any files that are going to change. In the process of determining - * this go ahead and build up the appropriate ReplaceEdits to be used in the createChange() - */ - @Override - public RefactoringStatus checkConditions(IProgressMonitor monitor, CheckConditionsContext context) throws OperationCanceledException { - //since the progress bar will hang if a large JPA project is being loaded, - //we can at least set the subtask and report no progress. Only happens first time getJpaProjectManager() is called. - monitor.subTask(JpaCoreRefactoringMessages.JPA_REFACORING_PARTICIPANT_LOADING_JPA_PROJECTS_SUB_TASK_NAME); - JpaProjectManager jpaProjectManager = JptJpaCorePlugin.getJpaProjectManager(); - if (jpaProjectManager.getJpaProjectsSize() == 0) { - return null; - } - SubMonitor sm = SubMonitor.convert(monitor, jpaProjectManager.getJpaProjectsSize()*10 + 1); - sm.subTask(JpaCoreRefactoringMessages.JPA_RENAME_MAPPING_FILE_REFACTORING_SUB_TASK_NAME); - ResourceChangeChecker checker = (ResourceChangeChecker) context.getChecker(ResourceChangeChecker.class); - IResourceChangeDescriptionFactory deltaFactory = checker.getDeltaFactory(); - - for (JpaProject jpaProject : JptJpaCorePlugin.getJpaProjectManager().getJpaProjects()) { - this.createReplaceEdits(jpaProject); - sm.worked(10); - } - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - for (IFile persistenceXmlFile : this.persistenceXmlMappingFileReplaceEdits.keySet()) { - deltaFactory.change(persistenceXmlFile); - } - sm.worked(1); - - return null; - } - - protected void createReplaceEdits(JpaProject jpaProject) throws OperationCanceledException { - PersistenceUnit persistenceUnit = getPersistenceUnit(jpaProject); - if (persistenceUnit == null) { - return; - } - Iterable replaceEdits = this.createMappingFileRefReplaceEdits(persistenceUnit); - if (!CollectionTools.isEmpty(replaceEdits)) { - this.persistenceXmlMappingFileReplaceEdits.put(jpaProject.getPersistenceXmlResource().getFile(), replaceEdits); - } - } - - @Override - public Change createChange(IProgressMonitor monitor) throws CoreException, OperationCanceledException { - if (this.persistenceXmlMappingFileReplaceEdits.isEmpty()) { - return null; - } - SubMonitor sm = SubMonitor.convert(monitor, this.persistenceXmlMappingFileReplaceEdits.size()); - sm.subTask(JpaCoreRefactoringMessages.JPA_RENAME_MAPPING_FILE_REFACTORING_SUB_TASK_NAME); - CompositeChange compositeChange = new CompositeChange(JpaCoreRefactoringMessages.JPA_RENAME_MAPPING_FILE_REFACTORING_CHANGE_NAME); - for (IFile persistenceXmlFile : this.persistenceXmlMappingFileReplaceEdits.keySet()) { - if (sm.isCanceled()) { - throw new OperationCanceledException(); - } - this.addPersistenceXmlRenameMappingFileChange(persistenceXmlFile, compositeChange); - } - //must check for children in case all changes were made in other participants TextChanges, - //want to return null so our node does not appear in the preview tree - return compositeChange.getChildren().length == 0 ? null : compositeChange; - } - - private Iterable createMappingFileRefReplaceEdits(final PersistenceUnit persistenceUnit) { - return persistenceUnit.createRenameMappingFileEdits(this.originalMappingFile, getArguments().getNewName()); - } - - protected void addPersistenceXmlRenameMappingFileChange(IFile persistenceXmlFile, CompositeChange compositeChange) { - TextChange textChange = getTextChange(persistenceXmlFile); - if (textChange == null) { - textChange = new TextFileChange(JpaCoreRefactoringMessages.JPA_RENAME_MAPPING_FILE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME, persistenceXmlFile); - MultiTextEdit multiTextEdit = new MultiTextEdit(); - textChange.setEdit(multiTextEdit); - compositeChange.add(textChange); - } - Iterable mappingFileReplaceEdits = this.persistenceXmlMappingFileReplaceEdits.get(persistenceXmlFile); - this.addEdits(textChange, mappingFileReplaceEdits); - } - - private PersistenceUnit getPersistenceUnit(JpaProject jpaProject) { - PersistenceXml persistenceXml = jpaProject.getRootContextNode().getPersistenceXml(); - if (persistenceXml == null) { - return null; - } - Persistence persistence = persistenceXml.getPersistence(); - if (persistence == null) { - return null; - } - if (persistence.persistenceUnitsSize() != 1) { - return null; // the context model currently only supports 1 persistence unit - } - return persistence.persistenceUnits().next(); - } - - private void addEdits(TextChange textChange, Iterable textEdits) { - for (TextEdit textEdit : textEdits) { - try { - textChange.addEdit(textEdit); - } - catch (MalformedTreeException e) { - //log exception and don't add this persistence.xml type deletion to the conflicting change object - JptJpaCorePlugin.log(e); - } - } - } -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenamePackageParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenamePackageParticipant.java deleted file mode 100644 index 830c6c86be..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenamePackageParticipant.java +++ /dev/null @@ -1,75 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.refactoring; - -import org.eclipse.jdt.core.IPackageFragment; -import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.text.edits.ReplaceEdit; - -public class JpaRenamePackageParticipant - extends AbstractJpaRenameJavaElementParticipant { - - - public JpaRenamePackageParticipant() { - super(); - } - - @Override - public String getName() { - return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_PARTICIPANT_NAME; - } - - protected IPackageFragment getOriginalPackage() { - return (IPackageFragment) super.getOriginalJavaElement(); - } - - - //**************** AbstractJpaRenameJavaElementParticipant implementation ***************** - - @Override - protected Iterable createPersistenceXmlReplaceEdits(PersistenceUnit persistenceUnit) { - return persistenceUnit.createRenamePackageEdits(this.getOriginalPackage(), this.getNewName()); - } - - @Override - protected Iterable createMappingFileReplaceEdits(MappingFileRef mappingFileRef) { - return mappingFileRef.createRenamePackageEdits(this.getOriginalPackage(), this.getNewName()); - } - - protected String getNewName() { - return getArguments().getNewName(); - } - - @Override - protected String getCheckConditionsSubTaskName() { - return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_SUB_TASK_NAME; - } - - @Override - protected String getCreateChangeSubTaskName() { - return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_SUB_TASK_NAME; - } - - @Override - protected String getCompositeChangeName() { - return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_CHANGE_NAME; - } - - @Override - protected String getPersistenceXmlChangeName() { - return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME; - } - - @Override - protected String getMappingFileChangeName() { - return JpaCoreRefactoringMessages.JPA_RENAME_PACKAGE_REFACTORING_CHANGE_MAPPING_FILE_NAME; - } -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameTypeParticipant.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameTypeParticipant.java deleted file mode 100644 index c72b74c34c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/refactoring/JpaRenameTypeParticipant.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.refactoring; - -import java.util.ArrayList; -import java.util.Collection; -import org.eclipse.jdt.core.IType; -import org.eclipse.jdt.core.JavaModelException; -import org.eclipse.jpt.common.utility.internal.iterables.CompositeIterable; -import org.eclipse.jpt.common.utility.internal.iterables.TransformationIterable; -import org.eclipse.jpt.jpa.core.JptJpaCorePlugin; -import org.eclipse.jpt.jpa.core.context.persistence.MappingFileRef; -import org.eclipse.jpt.jpa.core.context.persistence.PersistenceUnit; -import org.eclipse.text.edits.ReplaceEdit; - -//TODO RenameTypeArguments.updateSimilarDeclarations() - http://www.eclipse.org/jdt/ui/r3_2/RenameType.html -public class JpaRenameTypeParticipant - extends AbstractJpaRenameJavaElementParticipant { - - protected final Collection nestedTypes; - - public JpaRenameTypeParticipant() { - super(); - this.nestedTypes = new ArrayList(); - } - - @Override - public String getName() { - return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_PARTICIPANT_NAME; - } - - protected IType getOriginalType() { - return (IType) super.getOriginalJavaElement(); - } - - @Override - protected boolean initialize(Object element) { - boolean initialize = super.initialize(element); - if (initialize) { - this.addNestedTypes(this.getOriginalType()); - return true; - } - return false; - } - - protected void addNestedType(IType renamedType) { - this.nestedTypes.add(renamedType); - this.addNestedTypes(renamedType); - } - - private void addNestedTypes(IType renamedType) { - IType[] nestedTypes; - try { - nestedTypes = renamedType.getTypes(); - } - catch (JavaModelException ex) { - JptJpaCorePlugin.log(ex); - return; - } - - for (IType nestedType : nestedTypes) { - this.addNestedType(nestedType); - } - } - - - //**************** AbstractJpaRenameJavaElementParticipant implementation ***************** - - @SuppressWarnings("unchecked") - @Override - protected Iterable createPersistenceXmlReplaceEdits(PersistenceUnit persistenceUnit) { - return new CompositeIterable( - this.createPersistenceXmlReplaceOriginalTypeEdits(persistenceUnit), - this.createPersistenceXmlReplaceNestedTypeEdits(persistenceUnit)); - } - - private Iterable createPersistenceXmlReplaceOriginalTypeEdits(PersistenceUnit persistenceUnit) { - return persistenceUnit.createRenameTypeEdits(this.getOriginalType(), this.getNewName()); - } - - private Iterable createPersistenceXmlReplaceNestedTypeEdits(final PersistenceUnit persistenceUnit) { - return new CompositeIterable( - new TransformationIterable>(this.nestedTypes) { - @Override - protected Iterable transform(IType nestedType) { - String newName = getNewNameForNestedType(nestedType); - return persistenceUnit.createRenameTypeEdits(nestedType, newName); - } - } - ); - } - - @SuppressWarnings("unchecked") - @Override - protected Iterable createMappingFileReplaceEdits(MappingFileRef mappingFileRef) { - return new CompositeIterable( - this.createMappingFileReplaceOriginalTypeEdits(mappingFileRef), - this.createMappingFileReplaceNestedTypeEdits(mappingFileRef)); - } - - private Iterable createMappingFileReplaceOriginalTypeEdits(MappingFileRef mappingFileRef) { - return mappingFileRef.createRenameTypeEdits(this.getOriginalType(), this.getNewName()); - } - - private Iterable createMappingFileReplaceNestedTypeEdits(final MappingFileRef mappingFileRef) { - return new CompositeIterable( - new TransformationIterable>(this.nestedTypes) { - @Override - protected Iterable transform(IType nestedType) { - String newName = getNewNameForNestedType(nestedType); - return mappingFileRef.createRenameTypeEdits(nestedType, newName); - } - } - ); - } - - protected String getNewName() { - String newName = getArguments().getNewName(); - try { - if (this.getOriginalType().isMember()) { - newName = this.getOriginalType().getTypeQualifiedName().substring(0, this.getOriginalType().getTypeQualifiedName().lastIndexOf('$')) + '$' + newName; - } - } - catch (JavaModelException e) { - JptJpaCorePlugin.log(e); - } - return newName; - } - - protected String getNewNameForNestedType(IType nestedType) { - return nestedType.getTypeQualifiedName('$').replaceFirst(this.getOriginalType().getElementName(), getArguments().getNewName()); - } - - @Override - protected String getCheckConditionsSubTaskName() { - return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_SUB_TASK_NAME; - } - - @Override - protected String getCreateChangeSubTaskName() { - return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_SUB_TASK_NAME; - } - - @Override - protected String getCompositeChangeName() { - return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_CHANGE_NAME; - } - - @Override - protected String getPersistenceXmlChangeName() { - return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_CHANGE_PERSISTENCE_XML_NAME; - } - - @Override - protected String getMappingFileChangeName() { - return JpaCoreRefactoringMessages.JPA_RENAME_TYPE_REFACTORING_CHANGE_MAPPING_FILE_NAME; - } -} \ No newline at end of file diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/contenttypes/IndeterminateContentDescriber.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/contenttypes/IndeterminateContentDescriber.java deleted file mode 100644 index 7f5320de28..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/contenttypes/IndeterminateContentDescriber.java +++ /dev/null @@ -1,41 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2008, 2010 Oracle. - * All rights reserved. This program and the accompanying materials are - * made available under the terms of the Eclipse Public License v1.0 which - * accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * Oracle - initial API and implementation - *******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.contenttypes; - -import java.io.InputStream; -import java.io.Reader; -import org.eclipse.core.runtime.QualifiedName; -import org.eclipse.core.runtime.content.IContentDescription; -import org.eclipse.core.runtime.content.ITextContentDescriber; - -/** - * This class simply returns INDETERMINATE for any contents it receives. - * - * It is used currently for org.eclipse.jpt.jpa.core.content.baseJpaContent in order - * to make that content type act as an "abstract" content type. - * - * This is in its own package so that it can be excluded from bundle activation in the plugin.xml. - * Content describers must be self-contained and not trigger auto-activation. - */ -public class IndeterminateContentDescriber implements ITextContentDescriber -{ - public int describe(InputStream contents, IContentDescription description) { - return INDETERMINATE; - } - - public int describe(Reader contents, IContentDescription description) { - return INDETERMINATE; - } - - public QualifiedName[] getSupportedOptions() { - return new QualifiedName[0]; - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AbstractJavaResourceNode.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AbstractJavaResourceNode.java deleted file mode 100644 index 8cb4a5f3d2..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AbstractJavaResourceNode.java +++ /dev/null @@ -1,109 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2007, 2009 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.core.resources.IFile; -import org.eclipse.jpt.common.utility.internal.model.AbstractModel; -import org.eclipse.jpt.common.utility.internal.model.AspectChangeSupport; -import org.eclipse.jpt.common.utility.internal.model.ChangeSupport; -import org.eclipse.jpt.jpa.core.JpaAnnotationProvider; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; - -/** - * Java resource containment hierarchy - */ -public abstract class AbstractJavaResourceNode - extends AbstractModel - implements JavaResourceNode -{ - protected final JavaResourceNode parent; - - - // ********** constructor ********** - - protected AbstractJavaResourceNode(JavaResourceNode parent) { - super(); - this.checkParent(parent); - this.parent = parent; - } - - - // ********** parent ********** - - public JavaResourceNode getParent() { - return this.parent; - } - - protected void checkParent(JavaResourceNode p) { - if (p == null) { - if (this.requiresParent()) { - throw new IllegalArgumentException("'parent' cannot be null"); //$NON-NLS-1$ - } - } else { - if (this.forbidsParent()) { - throw new IllegalArgumentException("'parent' must be null"); //$NON-NLS-1$ - } - } - } - - protected boolean requiresParent() { - return true; - } - - protected boolean forbidsParent() { - return ! this.requiresParent(); // assume 'parent' is not optional - } - - - // ********** change support callback hook ********** - - @Override - protected final ChangeSupport buildChangeSupport() { - return new AspectChangeSupport(this, this.buildChangeSupportListener()); - } - - private AspectChangeSupport.Listener buildChangeSupportListener() { - return new AspectChangeSupport.Listener() { - public void aspectChanged(String aspectName) { - AbstractJavaResourceNode.this.aspectChanged(aspectName); - } - }; - } - - /** - * ignore the aspect name, we notify listeners of *every* change - */ - protected void aspectChanged(@SuppressWarnings("unused") String aspectName) { - this.getRoot().resourceModelChanged(); - } - - - // ********** JavaResourceNode implementation ********** - - /** - * @see org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceCompilationUnit#getRoot() - * @see org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPackageFragmentRoot#getRoot() - * @see org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryPersistentTypeCache#getRoot() - */ - public Root getRoot() { - return this.parent.getRoot(); - } - - public IFile getFile() { - return this.getRoot().getFile(); - } - - - // ********** misc ********** - - protected JpaAnnotationProvider getAnnotationProvider() { - return this.getRoot().getAnnotationProvider(); - } -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java deleted file mode 100644 index d92334b88b..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverrideAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinaryAssociationOverride1_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source.SourceAssociationOverride1_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.AssociationOverride - */ -public final class AssociationOverrideAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new AssociationOverrideAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private AssociationOverrideAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return SourceAssociationOverride1_0Annotation.buildAssociationOverride((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryAssociationOverride1_0Annotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return AssociationOverrideAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java deleted file mode 100644 index 42561b2853..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AssociationOverridesAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinaryAssociationOverrides1_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source.SourceAssociationOverrides1_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.AssociationOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.AssociationOverrides - */ -public final class AssociationOverridesAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new AssociationOverridesAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private AssociationOverridesAnnotationDefinition() { - super(); - } - - public AssociationOverridesAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceAssociationOverrides1_0Annotation((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public AssociationOverridesAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryAssociationOverrides1_0Annotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return AssociationOverridesAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java deleted file mode 100644 index e0c82a25cc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverrideAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAttributeOverrideAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAttributeOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverrideAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.AttributeOverride - */ -public final class AttributeOverrideAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new AttributeOverrideAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private AttributeOverrideAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return SourceAttributeOverrideAnnotation.buildAttributeOverride((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryAttributeOverrideAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return AttributeOverrideAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java deleted file mode 100644 index 8e0629aca6..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/AttributeOverridesAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryAttributeOverridesAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceAttributeOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.AttributeOverridesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.AttributeOverrides - */ -public final class AttributeOverridesAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new AttributeOverridesAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private AttributeOverridesAnnotationDefinition() { - super(); - } - - public AttributeOverridesAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceAttributeOverridesAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public AttributeOverridesAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryAttributeOverridesAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return AttributeOverridesAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java deleted file mode 100644 index a5f249a48d..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/BasicAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryBasicAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceBasicAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.BasicAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.Basic - */ -public final class BasicAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new BasicAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private BasicAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceBasicAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryBasicAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return BasicAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java deleted file mode 100644 index 56fec881a3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ColumnAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryColumnAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.ColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * javax.persistence.Column - */ -public final class ColumnAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new ColumnAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private ColumnAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceColumnAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement, SourceColumnAnnotation.MAPPING_DECLARATION_ANNOTATION_ADAPTER); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullColumnAnnotation(parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryColumnAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ColumnAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java deleted file mode 100644 index a9d8797d59..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorColumnAnnotationDefinition.java +++ /dev/null @@ -1,63 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryDiscriminatorColumnAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceDiscriminatorColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.DiscriminatorColumn - */ -public final class DiscriminatorColumnAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new DiscriminatorColumnAnnotationDefinition(); - - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private DiscriminatorColumnAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceDiscriminatorColumnAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullDiscriminatorColumnAnnotation((JavaResourcePersistentType) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryDiscriminatorColumnAnnotation((JavaResourcePersistentType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return DiscriminatorColumnAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java deleted file mode 100644 index 1150a7d7a4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/DiscriminatorValueAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryDiscriminatorValueAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceDiscriminatorValueAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.DiscriminatorValueAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.DiscriminatorValue - */ -public final class DiscriminatorValueAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new DiscriminatorValueAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private DiscriminatorValueAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceDiscriminatorValueAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullDiscriminatorValueAnnotation((JavaResourcePersistentType) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryDiscriminatorValueAnnotation((JavaResourcePersistentType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return DiscriminatorValueAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java deleted file mode 100644 index 995417e071..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddableAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEmbeddableAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEmbeddableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.Embeddable - */ -public final class EmbeddableAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EmbeddableAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EmbeddableAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEmbeddableAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEmbeddableAnnotation((JavaResourcePersistentType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EmbeddableAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java deleted file mode 100644 index 50818c215e..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEmbeddedAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEmbeddedAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddedAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.Embedded - */ -public final class EmbeddedAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EmbeddedAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EmbeddedAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEmbeddedAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEmbeddedAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EmbeddedAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java deleted file mode 100644 index 572fde6d2c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EmbeddedIdAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEmbeddedIdAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEmbeddedIdAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.EmbeddedIdAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.EmbeddedId - */ -public final class EmbeddedIdAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EmbeddedIdAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EmbeddedIdAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEmbeddedIdAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEmbeddedIdAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EmbeddedIdAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java deleted file mode 100644 index f13e842fbc..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EntityAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEntityAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEntityAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.EntityAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.Entity - */ -public final class EntityAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EntityAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EntityAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEntityAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEntityAnnotation((JavaResourcePersistentType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EntityAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java deleted file mode 100644 index 79ce931c82..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/EnumeratedAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryEnumeratedAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceEnumeratedAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.EnumeratedAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.Enumerated - */ -public final class EnumeratedAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new EnumeratedAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private EnumeratedAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceEnumeratedAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullEnumeratedAnnotation((JavaResourcePersistentAttribute) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryEnumeratedAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return EnumeratedAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java deleted file mode 100644 index 0cc96173bb..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/GeneratedValueAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryGeneratedValueAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceGeneratedValueAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.GeneratedValueAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.GeneratedValue - */ -public final class GeneratedValueAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new GeneratedValueAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private GeneratedValueAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceGeneratedValueAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryGeneratedValueAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return GeneratedValueAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java deleted file mode 100644 index 8628cfede1..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryIdAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.IdAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; - -/** - * javax.persistence.Id - */ -public final class IdAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new IdAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private IdAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceIdAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryIdAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return IdAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java deleted file mode 100644 index e5cbb6c281..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/IdClassAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryIdClassAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceIdClassAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.IdClassAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.IdClass - */ -public final class IdClassAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new IdClassAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private IdClassAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceIdClassAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryIdClassAnnotation((JavaResourcePersistentType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return IdClassAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java deleted file mode 100644 index d0d4734830..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/InheritanceAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryInheritanceAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceInheritanceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.InheritanceAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; - -/** - * javax.persistence.Inheritance - */ -public final class InheritanceAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new InheritanceAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private InheritanceAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceInheritanceAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullInheritanceAnnotation((JavaResourcePersistentType) parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryInheritanceAnnotation((JavaResourcePersistentType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return InheritanceAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java deleted file mode 100644 index 8430099980..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinColumnAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnAnnotation; - -/** - * javax.persistence.JoinColumn - */ -public final class JoinColumnAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new JoinColumnAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private JoinColumnAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return SourceJoinColumnAnnotation.createJoinColumn((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryJoinColumnAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return JoinColumnAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java deleted file mode 100644 index e0e07b6efd..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinColumnsAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinColumnsAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinColumnsAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.core.resource.java.JoinColumnsAnnotation; - -/** - * javax.persistence.JoinColumns - */ -public final class JoinColumnsAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new JoinColumnsAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private JoinColumnsAnnotationDefinition() { - super(); - } - - public JoinColumnsAnnotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceJoinColumnsAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public JoinColumnsAnnotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryJoinColumnsAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return JoinColumnsAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java deleted file mode 100644 index ad35ea19e3..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/JoinTableAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Member; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryJoinTableAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceJoinTableAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; -import org.eclipse.jpt.jpa.core.resource.java.JoinTableAnnotation; - -/** - * javax.persistence.JoinTable - */ -public final class JoinTableAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new JoinTableAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private JoinTableAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceJoinTableAnnotation((JavaResourcePersistentMember) parent, (Member) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - return new NullJoinTableAnnotation(parent); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryJoinTableAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return JoinTableAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java deleted file mode 100644 index 593295e108..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/LobAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryLobAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceLobAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.LobAnnotation; - -/** - * javax.persistence.Lob - */ -public final class LobAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new LobAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private LobAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceLobAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryLobAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return LobAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java deleted file mode 100644 index 173ae215c9..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToManyAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryManyToManyAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceManyToManyAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.ManyToManyAnnotation; - -/** - * javax.persistence.ManyToMany - */ -public final class ManyToManyAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new ManyToManyAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private ManyToManyAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceManyToManyAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryManyToManyAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ManyToManyAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java deleted file mode 100644 index 7d8571e116..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/ManyToOneAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryManyToOneAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceManyToOneAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.ManyToOneAnnotation; - -/** - * javax.persistence.ManyToOne - */ -public final class ManyToOneAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new ManyToOneAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private ManyToOneAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceManyToOneAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryManyToOneAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return ManyToOneAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java deleted file mode 100644 index db92373fe0..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MapKeyAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Attribute; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryMapKeyAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceMapKeyAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentAttribute; -import org.eclipse.jpt.jpa.core.resource.java.MapKeyAnnotation; - -/** - * javax.persistence.MapKey - */ -public final class MapKeyAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new MapKeyAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private MapKeyAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceMapKeyAnnotation((JavaResourcePersistentAttribute) parent, (Attribute) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryMapKeyAnnotation((JavaResourcePersistentAttribute) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MapKeyAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java deleted file mode 100644 index 2d03a17fe4..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/MappedSuperclassAnnotationDefinition.java +++ /dev/null @@ -1,62 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryMappedSuperclassAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceMappedSuperclassAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentType; -import org.eclipse.jpt.jpa.core.resource.java.MappedSuperclassAnnotation; - -/** - * javax.persistence.MappedSuperclass - */ -public final class MappedSuperclassAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new MappedSuperclassAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private MappedSuperclassAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceMappedSuperclassAnnotation((JavaResourcePersistentType) parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryMappedSuperclassAnnotation((JavaResourcePersistentType) parent, jdtAnnotation); - } - - public String getAnnotationName() { - return MappedSuperclassAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java deleted file mode 100644 index 64d1419a8c..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueriesAnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedNativeQueriesAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedNativeQueriesAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueriesAnnotation; - -/** - * javax.persistence.NamedNativeQueries - */ -public final class NamedNativeQueriesAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new NamedNativeQueriesAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private NamedNativeQueriesAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceNamedNativeQueriesAnnotation(parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryNamedNativeQueriesAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return NamedNativeQueriesAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java deleted file mode 100644 index 07aa297403..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedNativeQueryAnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.resource.java.binary.BinaryNamedNativeQueryAnnotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedNativeQueryAnnotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.NamedNativeQueryAnnotation; - -/** - * javax.persistence.NamedNativeQuery - */ -public final class NamedNativeQueryAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new NamedNativeQueryAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private NamedNativeQueryAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return SourceNamedNativeQueryAnnotation.createNamedNativeQuery(parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryNamedNativeQueryAnnotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return NamedNativeQueryAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java deleted file mode 100644 index 4636029019..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueriesAnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinaryNamedQueries1_0Annotation; -import org.eclipse.jpt.jpa.core.internal.resource.java.source.SourceNamedQueries1_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.NamedQueriesAnnotation; - -/** - * javax.persistence.NamedQueries - */ -public final class NamedQueriesAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new NamedQueriesAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private NamedQueriesAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceNamedQueries1_0Annotation(parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryNamedQueries1_0Annotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return NamedQueriesAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java deleted file mode 100644 index 3b49b07818..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NamedQueryAnnotationDefinition.java +++ /dev/null @@ -1,61 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import org.eclipse.jdt.core.IAnnotation; -import org.eclipse.jpt.common.core.utility.jdt.AnnotatedElement; -import org.eclipse.jpt.common.core.utility.jdt.Type; -import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.binary.BinaryNamedQuery1_0Annotation; -import org.eclipse.jpt.jpa.core.internal.jpa1.resource.java.source.SourceNamedQuery1_0Annotation; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.AnnotationDefinition; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceAnnotatedElement; -import org.eclipse.jpt.jpa.core.resource.java.NamedQueryAnnotation; - -/** - * javax.persistence.NamedQuery - */ -public final class NamedQueryAnnotationDefinition - implements AnnotationDefinition -{ - // singleton - private static final AnnotationDefinition INSTANCE = new NamedQueryAnnotationDefinition(); - - /** - * Return the singleton. - */ - public static AnnotationDefinition instance() { - return INSTANCE; - } - - /** - * Ensure single instance. - */ - private NamedQueryAnnotationDefinition() { - super(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, AnnotatedElement annotatedElement) { - return new SourceNamedQuery1_0Annotation(parent, (Type) annotatedElement); - } - - public Annotation buildNullAnnotation(JavaResourceAnnotatedElement parent) { - throw new UnsupportedOperationException(); - } - - public Annotation buildAnnotation(JavaResourceAnnotatedElement parent, IAnnotation jdtAnnotation) { - return new BinaryNamedQuery1_0Annotation(parent, jdtAnnotation); - } - - public String getAnnotationName() { - return NamedQueryAnnotation.ANNOTATION_NAME; - } - -} diff --git a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAnnotation.java b/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAnnotation.java deleted file mode 100644 index ab7a3377a7..0000000000 --- a/jpa/plugins/org.eclipse.jpt.jpa.core/src/org/eclipse/jpt/jpa/core/internal/resource/java/NullAnnotation.java +++ /dev/null @@ -1,94 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2009, 2010 Oracle. All rights reserved. - * This program and the accompanying materials are made available under the - * terms of the Eclipse Public License v1.0, which accompanies this distribution - * and is available at http://www.eclipse.org/legal/epl-v10.html. - * - * Contributors: - * Oracle - initial API and implementation - ******************************************************************************/ -package org.eclipse.jpt.jpa.core.internal.resource.java; - -import java.util.Map; -import org.eclipse.jdt.core.dom.CompilationUnit; -import org.eclipse.jpt.common.core.utility.TextRange; -import org.eclipse.jpt.jpa.core.resource.java.Annotation; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceCompilationUnit; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourceNode; -import org.eclipse.jpt.jpa.core.resource.java.JavaResourcePersistentMember; - -/** - * Simplify null annotation classes. - */ -public abstract class NullAnnotation - extends AbstractJavaResourceNode - implements Annotation -{ - protected NullAnnotation(JavaResourceNode parent) { - super(parent); - } - - public void initialize(CompilationUnit astRoot) { - // do nothing - } - - public org.eclipse.jdt.core.dom.Annotation getAstAnnotation(CompilationUnit astRoot) { - return null; - } - - public JavaResourceCompilationUnit getJavaResourceCompilationUnit() { - throw new UnsupportedOperationException(); - } - - public void newAnnotation() { - throw new UnsupportedOperationException(); - } - - public void removeAnnotation() { - throw new UnsupportedOperationException(); - } - - public boolean isUnset() { - throw new UnsupportedOperationException(); - } - - public void storeOn(Map map) { - // NOP - } - - public void restoreFrom(Map map) { - // NOP - } - - public TextRange getTextRange(CompilationUnit astRoot) { - return null; - } - - public void synchronizeWith(CompilationUnit astRoot) { - throw new UnsupportedOperationException(); - } - - /** - * Convenience method: Cast the annotation's parent to a - * persistent member. - */ - protected JavaResourcePersistentMember getMember() { - return (JavaResourcePersistentMember) this.parent; - } - - /** - * Convenience method: Add the type or attribute's annotation - * and return it. - *